From 6cafa6a0609243b22d51f753a6357b88f75fb27d Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 13 Dec 2021 12:13:03 -0800 Subject: [PATCH 001/886] Remove sdk/export/metric module, embed into the sdk/metric (#2382) Signed-off-by: Bogdan Drutu --- CHANGELOG.md | 5 + bridge/opencensus/aggregation.go | 2 +- bridge/opencensus/aggregation_test.go | 2 +- bridge/opencensus/exporter.go | 4 +- bridge/opencensus/exporter_test.go | 9 +- bridge/opencensus/go.mod | 1 - example/opencensus/go.mod | 2 +- example/opencensus/main.go | 4 +- example/prometheus/go.mod | 1 - example/prometheus/main.go | 2 +- exporters/otlp/otlpmetric/exporter.go | 8 +- exporters/otlp/otlpmetric/exporter_test.go | 18 +- exporters/otlp/otlpmetric/go.mod | 1 - .../internal/metrictransform/metric.go | 4 +- .../internal/metrictransform/metric_test.go | 4 +- .../internal/otlpmetrictest/data.go | 16 +- .../internal/otlpmetrictest/otlptest.go | 2 +- exporters/otlp/otlpmetric/options.go | 2 +- exporters/prometheus/go.mod | 1 - exporters/prometheus/prometheus.go | 4 +- exporters/prometheus/prometheus_test.go | 2 +- exporters/stdout/stdoutmetric/exporter.go | 6 +- exporters/stdout/stdoutmetric/go.mod | 1 - exporters/stdout/stdoutmetric/metric.go | 12 +- exporters/stdout/stdoutmetric/metric_test.go | 2 +- sdk/export/metric/aggregation/aggregation.go | 135 ++----- sdk/export/metric/aggregation/temporality.go | 98 +---- sdk/export/metric/go.mod | 4 +- sdk/export/metric/go.sum | 2 +- sdk/export/metric/metric.go | 332 ++--------------- sdk/metric/aggregator/aggregator.go | 4 +- sdk/metric/aggregator/aggregator_test.go | 2 +- sdk/metric/aggregator/aggregatortest/test.go | 4 +- sdk/metric/aggregator/histogram/histogram.go | 4 +- .../aggregator/histogram/histogram_test.go | 2 +- sdk/metric/aggregator/lastvalue/lastvalue.go | 4 +- .../aggregator/lastvalue/lastvalue_test.go | 4 +- sdk/metric/aggregator/sum/sum.go | 4 +- sdk/metric/aggregator/sum/sum_test.go | 2 +- sdk/metric/benchmark_test.go | 2 +- sdk/metric/controller/basic/config.go | 2 +- sdk/metric/controller/basic/controller.go | 2 +- .../controller/basic/controller_test.go | 4 +- sdk/metric/controller/basic/pull_test.go | 2 +- sdk/metric/controller/basic/push_test.go | 4 +- sdk/metric/controller/controllertest/test.go | 4 +- sdk/metric/correct_test.go | 4 +- sdk/metric/doc.go | 2 +- sdk/metric/export/aggregation/aggregation.go | 131 +++++++ sdk/metric/export/aggregation/temporality.go | 117 ++++++ .../export}/aggregation/temporality_string.go | 0 .../export}/aggregation/temporality_test.go | 0 sdk/metric/export/metric.go | 343 ++++++++++++++++++ .../metric => metric/export}/metric_test.go | 2 +- sdk/metric/go.mod | 1 - sdk/metric/processor/basic/basic.go | 4 +- sdk/metric/processor/basic/basic_test.go | 4 +- sdk/metric/processor/processortest/test.go | 4 +- .../processor/processortest/test_test.go | 4 +- sdk/metric/processor/reducer/reducer.go | 2 +- sdk/metric/processor/reducer/reducer_test.go | 2 +- sdk/metric/sdk.go | 2 +- sdk/metric/selector/simple/simple.go | 2 +- sdk/metric/selector/simple/simple_test.go | 2 +- sdk/metric/stress_test.go | 4 +- 65 files changed, 776 insertions(+), 590 deletions(-) create mode 100644 sdk/metric/export/aggregation/aggregation.go create mode 100644 sdk/metric/export/aggregation/temporality.go rename sdk/{export/metric => metric/export}/aggregation/temporality_string.go (100%) rename sdk/{export/metric => metric/export}/aggregation/temporality_test.go (100%) create mode 100644 sdk/metric/export/metric.go rename sdk/{export/metric => metric/export}/metric_test.go (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6665b12def0..57c8612379a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Deprecated + +- Deprecate module `"go.opentelemetry.io/otel/sdk/export/metric"`, new functionality available in "go.opentelemetry.io/otel/sdk/metric" module: + - Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382). + ## [1.3.0] - 2021-12-10 ### ⚠️ Notice ⚠️ diff --git a/bridge/opencensus/aggregation.go b/bridge/opencensus/aggregation.go index 10616b993aa..3d88f7589a4 100644 --- a/bridge/opencensus/aggregation.go +++ b/bridge/opencensus/aggregation.go @@ -22,7 +22,7 @@ import ( "go.opencensus.io/metric/metricdata" "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) var ( diff --git a/bridge/opencensus/aggregation_test.go b/bridge/opencensus/aggregation_test.go index dbd9d69b827..13093c67336 100644 --- a/bridge/opencensus/aggregation_test.go +++ b/bridge/opencensus/aggregation_test.go @@ -21,7 +21,7 @@ import ( "go.opencensus.io/metric/metricdata" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) func TestNewAggregationFromPoints(t *testing.T) { diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index 1720c67f21f..bdc22eced73 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -31,9 +31,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/metric/unit" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/bridge/opencensus/exporter_test.go b/bridge/opencensus/exporter_test.go index 0910cb5720b..8fe6893477e 100644 --- a/bridge/opencensus/exporter_test.go +++ b/bridge/opencensus/exporter_test.go @@ -31,11 +31,10 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/metric/unit" - export "go.opentelemetry.io/otel/sdk/export/metric" - exportmetric "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) @@ -46,9 +45,9 @@ type fakeExporter struct { err error } -func (f *fakeExporter) Export(ctx context.Context, res *resource.Resource, ilr exportmetric.InstrumentationLibraryReader) error { +func (f *fakeExporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error { return controllertest.ReadAll(ilr, aggregation.StatelessTemporalitySelector(), - func(_ instrumentation.Library, record exportmetric.Record) error { + func(_ instrumentation.Library, record export.Record) error { f.resource = res f.records = append(f.records, record) return f.err diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 6dd08623d08..30a69366c61 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -7,7 +7,6 @@ require ( go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/otel/trace v1.3.0 ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 0c3e02ac4eb..a1fb87122a0 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.26.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 + go.opentelemetry.io/otel/sdk/metric v0.26.0 ) replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing diff --git a/example/opencensus/main.go b/example/opencensus/main.go index 8014bb15d34..ceccb82d083 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -33,7 +33,7 @@ import ( "go.opentelemetry.io/otel/bridge/opencensus" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - otmetricexport "go.opentelemetry.io/otel/sdk/export/metric" + "go.opentelemetry.io/otel/sdk/metric/export" sdktrace "go.opentelemetry.io/otel/sdk/trace" ) @@ -100,7 +100,7 @@ func tracing(otExporter sdktrace.SpanExporter) { // monitoring demonstrates creating an IntervalReader using the OpenTelemetry // exporter to send metrics to the exporter by using either an OpenCensus // registry or an OpenCensus view. -func monitoring(otExporter otmetricexport.Exporter) { +func monitoring(otExporter export.Exporter) { log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.") ocExporter := opencensus.NewMetricExporter(otExporter) intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 81c01ae990b..62bb10691ee 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -12,7 +12,6 @@ require ( go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/exporters/prometheus v0.26.0 go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 ) diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 968beb3d483..4ef0f2e89e2 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -26,9 +26,9 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" ) diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 798b690be01..d6c9a6f4e76 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -21,8 +21,8 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" "go.opentelemetry.io/otel/metric/sdkapi" - metricsdk "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -44,7 +44,7 @@ type Exporter struct { } // Export exports a batch of metrics. -func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr metricsdk.InstrumentationLibraryReader) error { +func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error { rm, err := metrictransform.InstrumentationLibraryReader(ctx, e, res, ilr, 1) if err != nil { return err @@ -100,7 +100,7 @@ func (e *Exporter) TemporalityFor(descriptor *sdkapi.Descriptor, kind aggregatio return e.temporalitySelector.TemporalityFor(descriptor, kind) } -var _ metricsdk.Exporter = (*Exporter)(nil) +var _ export.Exporter = (*Exporter)(nil) // New constructs a new Exporter and starts it. func New(ctx context.Context, client Client, opts ...Option) (*Exporter, error) { diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 733d1978826..229d8838e27 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -32,11 +32,11 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - metricsdk "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" commonpb "go.opentelemetry.io/proto/otlp/common/v1" @@ -675,14 +675,14 @@ func TestStatelessAggregationTemporality(t *testing.T) { func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource.Resource, records []testRecord, expected []*metricpb.ResourceMetrics) { exp, driver := newExporter(t, opts...) - libraryRecs := map[instrumentation.Library][]metricsdk.Record{} + libraryRecs := map[instrumentation.Library][]export.Record{} for _, r := range records { lcopy := make([]attribute.KeyValue, len(r.labels)) copy(lcopy, r.labels) desc := metrictest.NewDescriptor(r.name, r.iKind, r.nKind) labs := attribute.NewSet(lcopy...) - var agg, ckpt metricsdk.Aggregator + var agg, ckpt export.Aggregator if r.iKind.Adding() { sums := sum.New(2) agg, ckpt = &sums[0], &sums[1] @@ -723,7 +723,7 @@ func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource. Version: meterCfg.InstrumentationVersion(), SchemaURL: meterCfg.SchemaURL(), } - libraryRecs[lib] = append(libraryRecs[lib], metricsdk.NewRecord(&desc, &labs, ckpt.Aggregation(), intervalStart, intervalEnd)) + libraryRecs[lib] = append(libraryRecs[lib], export.NewRecord(&desc, &labs, ckpt.Aggregation(), intervalStart, intervalEnd)) } assert.NoError(t, exp.Export(context.Background(), res, processortest.MultiInstrumentationLibraryReader(libraryRecs))) @@ -772,20 +772,20 @@ func TestEmptyMetricExport(t *testing.T) { exp, driver := newExporter(t) for _, test := range []struct { - records []metricsdk.Record + records []export.Record want []*metricpb.ResourceMetrics }{ { - []metricsdk.Record(nil), + []export.Record(nil), []*metricpb.ResourceMetrics(nil), }, { - []metricsdk.Record{}, + []export.Record{}, []*metricpb.ResourceMetrics(nil), }, } { driver.Reset() - require.NoError(t, exp.Export(context.Background(), resource.Empty(), processortest.MultiInstrumentationLibraryReader(map[instrumentation.Library][]metricsdk.Record{ + require.NoError(t, exp.Export(context.Background(), resource.Empty(), processortest.MultiInstrumentationLibraryReader(map[instrumentation.Library][]export.Record{ { Name: testLibName, }: test.records, diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index fd520446cd3..93d3ff6a2be 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/proto/otlp v0.11.0 google.golang.org/grpc v1.42.0 diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index ac3673d72ed..e1ba26dccd0 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -25,9 +25,9 @@ import ( "time" "go.opentelemetry.io/otel/metric/number" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" commonpb "go.opentelemetry.io/proto/otlp/common/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index 3dd6c1db8fa..e103c3e9c53 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -28,10 +28,10 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" commonpb "go.opentelemetry.io/proto/otlp/common/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go index 65f79594ee6..cc3f7871598 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go @@ -23,16 +23,16 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - exportmetric "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" ) // OneRecordReader is a Reader that returns just one // filled record. It may be useful for testing driver's metrics // export. -func OneRecordReader() exportmetric.InstrumentationLibraryReader { +func OneRecordReader() export.InstrumentationLibraryReader { desc := metrictest.NewDescriptor( "foo", sdkapi.CounterInstrumentKind, @@ -45,17 +45,17 @@ func OneRecordReader() exportmetric.InstrumentationLibraryReader { start := time.Date(2020, time.December, 8, 19, 15, 0, 0, time.UTC) end := time.Date(2020, time.December, 8, 19, 16, 0, 0, time.UTC) labels := attribute.NewSet(attribute.String("abc", "def"), attribute.Int64("one", 1)) - rec := exportmetric.NewRecord(&desc, &labels, agg[0].Aggregation(), start, end) + rec := export.NewRecord(&desc, &labels, agg[0].Aggregation(), start, end) return processortest.MultiInstrumentationLibraryReader( - map[instrumentation.Library][]exportmetric.Record{ + map[instrumentation.Library][]export.Record{ { Name: "onelib", }: {rec}, }) } -func EmptyReader() exportmetric.InstrumentationLibraryReader { +func EmptyReader() export.InstrumentationLibraryReader { return processortest.MultiInstrumentationLibraryReader(nil) } @@ -63,9 +63,9 @@ func EmptyReader() exportmetric.InstrumentationLibraryReader { // ForEach. type FailReader struct{} -var _ exportmetric.InstrumentationLibraryReader = FailReader{} +var _ export.InstrumentationLibraryReader = FailReader{} -// ForEach implements exportmetric.Reader. It always fails. -func (FailReader) ForEach(readerFunc func(instrumentation.Library, exportmetric.Reader) error) error { +// ForEach implements export.Reader. It always fails. +func (FailReader) ForEach(readerFunc func(instrumentation.Library, export.Reader) error) error { return fmt.Errorf("fail") } diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go index e14d548e84d..53af9d5565a 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go @@ -28,8 +28,8 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/selector/simple" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" diff --git a/exporters/otlp/otlpmetric/options.go b/exporters/otlp/otlpmetric/options.go index dab33127be6..ce8a5f58c5a 100644 --- a/exporters/otlp/otlpmetric/options.go +++ b/exporters/otlp/otlpmetric/options.go @@ -14,7 +14,7 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" +import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" // Option are setting options passed to an Exporter on creation. type Option interface { diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 0875adce2eb..0546ae8466b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -8,7 +8,6 @@ require ( go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 ) diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go index 369c0ce1fe1..08595526263 100644 --- a/exporters/prometheus/prometheus.go +++ b/exporters/prometheus/prometheus.go @@ -31,10 +31,10 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go index 5efdba33469..907db0db4b7 100644 --- a/exporters/prometheus/prometheus_test.go +++ b/exporters/prometheus/prometheus_test.go @@ -27,9 +27,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" "go.opentelemetry.io/otel/sdk/resource" diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 25b129dcdfd..e1ea02339c0 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -14,16 +14,14 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" -import ( - "go.opentelemetry.io/otel/sdk/export/metric" -) +import "go.opentelemetry.io/otel/sdk/metric/export" type Exporter struct { metricExporter } var ( - _ metric.Exporter = &Exporter{} + _ export.Exporter = &Exporter{} ) // New creates an Exporter with the passed options. diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 8347a15084c..c438a6f0037 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -12,7 +12,6 @@ require ( go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 ) diff --git a/exporters/stdout/stdoutmetric/metric.go b/exporters/stdout/stdoutmetric/metric.go index 4dde782da66..56e449de20d 100644 --- a/exporters/stdout/stdoutmetric/metric.go +++ b/exporters/stdout/stdoutmetric/metric.go @@ -23,9 +23,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" - exportmetric "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) @@ -33,7 +33,7 @@ type metricExporter struct { config config } -var _ exportmetric.Exporter = &metricExporter{} +var _ export.Exporter = &metricExporter{} type line struct { Name string `json:"Name"` @@ -49,10 +49,10 @@ func (e *metricExporter) TemporalityFor(desc *sdkapi.Descriptor, kind aggregatio return aggregation.StatelessTemporalitySelector().TemporalityFor(desc, kind) } -func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reader exportmetric.InstrumentationLibraryReader) error { +func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reader export.InstrumentationLibraryReader) error { var aggError error var batch []line - aggError = reader.ForEach(func(lib instrumentation.Library, mr exportmetric.Reader) error { + aggError = reader.ForEach(func(lib instrumentation.Library, mr export.Reader) error { var instLabels []attribute.KeyValue if name := lib.Name; name != "" { @@ -67,7 +67,7 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade instSet := attribute.NewSet(instLabels...) encodedInstLabels := instSet.Encoded(e.config.LabelEncoder) - return mr.ForEach(e, func(record exportmetric.Record) error { + return mr.ForEach(e, func(record export.Record) error { desc := record.Descriptor() agg := record.Aggregation() kind := desc.NumberKind() diff --git a/exporters/stdout/stdoutmetric/metric_test.go b/exporters/stdout/stdoutmetric/metric_test.go index 2106e65501c..e9153fcfd0a 100644 --- a/exporters/stdout/stdoutmetric/metric_test.go +++ b/exporters/stdout/stdoutmetric/metric_test.go @@ -29,8 +29,8 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/export/metric/aggregation/aggregation.go b/sdk/export/metric/aggregation/aggregation.go index 800ec88fdbc..75617a237f7 100644 --- a/sdk/export/metric/aggregation/aggregation.go +++ b/sdk/export/metric/aggregation/aggregation.go @@ -15,117 +15,56 @@ package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" import ( - "fmt" - "time" - - "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) -// These interfaces describe the various ways to access state from an -// Aggregation. - -type ( - // Aggregation is an interface returned by the Aggregator - // containing an interval of metric data. - Aggregation interface { - // Kind returns a short identifying string to identify - // the Aggregator that was used to produce the - // Aggregation (e.g., "Sum"). - Kind() Kind - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Aggregation = aggregation.Aggregation - // Sum returns an aggregated sum. - Sum interface { - Aggregation - Sum() (number.Number, error) - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Sum = aggregation.Sum - // Count returns the number of values that were aggregated. - Count interface { - Aggregation - Count() (uint64, error) - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Count = aggregation.Count - // Min returns the minimum value over the set of values that were aggregated. - Min interface { - Aggregation - Min() (number.Number, error) - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Min = aggregation.Min - // Max returns the maximum value over the set of values that were aggregated. - Max interface { - Aggregation - Max() (number.Number, error) - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Max = aggregation.Max - // LastValue returns the latest value that was aggregated. - LastValue interface { - Aggregation - LastValue() (number.Number, time.Time, error) - } +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type LastValue = aggregation.LastValue - // Buckets represents histogram buckets boundaries and counts. - // - // For a Histogram with N defined boundaries, e.g, [x, y, z]. - // There are N+1 counts: [-inf, x), [x, y), [y, z), [z, +inf] - Buckets struct { - // Boundaries are floating point numbers, even when - // aggregating integers. - Boundaries []float64 +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Buckets = aggregation.Buckets - // Counts holds the count in each bucket. - Counts []uint64 - } - - // Histogram returns the count of events in pre-determined buckets. - Histogram interface { - Aggregation - Count() (uint64, error) - Sum() (number.Number, error) - Histogram() (Buckets, error) - } -) +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Histogram = aggregation.Histogram -type ( - // Kind is a short name for the Aggregator that produces an - // Aggregation, used for descriptive purpose only. Kind is a - // string to allow user-defined Aggregators. - // - // When deciding how to handle an Aggregation, Exporters are - // encouraged to decide based on conversion to the above - // interfaces based on strength, not on Kind value, when - // deciding how to expose metric data. This enables - // user-supplied Aggregators to replace builtin Aggregators. - // - // For example, test for a Histogram before testing for a - // Sum, and so on. - Kind string -) +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Kind = aggregation.Kind -// Kind description constants. const ( - SumKind Kind = "Sum" - HistogramKind Kind = "Histogram" - LastValueKind Kind = "Lastvalue" + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + SumKind = aggregation.SumKind + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + HistogramKind = aggregation.HistogramKind + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + LastValueKind = aggregation.LastValueKind ) -// Sentinel errors for Aggregation interface. var ( - ErrNegativeInput = fmt.Errorf("negative value is out of range for this instrument") - ErrNaNInput = fmt.Errorf("NaN value is an invalid input") - ErrInconsistentType = fmt.Errorf("inconsistent aggregator types") - - // ErrNoCumulativeToDelta is returned when requesting delta - // export kind for a precomputed sum instrument. - ErrNoCumulativeToDelta = fmt.Errorf("cumulative to delta not implemented") - - // ErrNoData is returned when (due to a race with collection) - // the Aggregator is check-pointed before the first value is set. - // The aggregator should simply be skipped in this case. - ErrNoData = fmt.Errorf("no data collected by this aggregator") + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + ErrNegativeInput = aggregation.ErrNegativeInput + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + ErrNaNInput = aggregation.ErrNaNInput + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + ErrInconsistentType = aggregation.ErrInconsistentType + + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + ErrNoCumulativeToDelta = aggregation.ErrNoCumulativeToDelta + + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + ErrNoData = aggregation.ErrNoData ) - -// String returns the string value of Kind. -func (k Kind) String() string { - return string(k) -} diff --git a/sdk/export/metric/aggregation/temporality.go b/sdk/export/metric/aggregation/temporality.go index 4a4a733aa28..2e3e705662b 100644 --- a/sdk/export/metric/aggregation/temporality.go +++ b/sdk/export/metric/aggregation/temporality.go @@ -12,106 +12,42 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate stringer -type=Temporality - package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" import ( - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) -// Temporality indicates the temporal aggregation exported by an exporter. -// These bits may be OR-d together when multiple exporters are in use. -type Temporality uint8 +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type Temporality = aggregation.Temporality const ( - // CumulativeTemporality indicates that an Exporter expects a - // Cumulative Aggregation. - CumulativeTemporality Temporality = 1 - - // DeltaTemporality indicates that an Exporter expects a - // Delta Aggregation. - DeltaTemporality Temporality = 2 -) - -// Includes returns if t includes support for other temporality. -func (t Temporality) Includes(other Temporality) bool { - return t&other != 0 -} - -// MemoryRequired returns whether an exporter of this temporality requires -// memory to export correctly. -func (t Temporality) MemoryRequired(mkind sdkapi.InstrumentKind) bool { - switch mkind { - case sdkapi.HistogramInstrumentKind, sdkapi.GaugeObserverInstrumentKind, - sdkapi.CounterInstrumentKind, sdkapi.UpDownCounterInstrumentKind: - // Delta-oriented instruments: - return t.Includes(CumulativeTemporality) - - case sdkapi.CounterObserverInstrumentKind, sdkapi.UpDownCounterObserverInstrumentKind: - // Cumulative-oriented instruments: - return t.Includes(DeltaTemporality) - } - // Something unexpected is happening--we could panic. This - // will become an error when the exporter tries to access a - // checkpoint, presumably, so let it be. - return false -} + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + CumulativeTemporality = aggregation.CumulativeTemporality -type ( - constantTemporalitySelector Temporality - statelessTemporalitySelector struct{} + // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + DeltaTemporality = aggregation.DeltaTemporality ) -var ( - _ TemporalitySelector = constantTemporalitySelector(0) - _ TemporalitySelector = statelessTemporalitySelector{} -) - -// ConstantTemporalitySelector returns an TemporalitySelector that returns -// a constant Temporality. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" func ConstantTemporalitySelector(t Temporality) TemporalitySelector { - return constantTemporalitySelector(t) + return aggregation.ConstantTemporalitySelector(t) } -// CumulativeTemporalitySelector returns an TemporalitySelector that -// always returns CumulativeTemporality. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" func CumulativeTemporalitySelector() TemporalitySelector { - return ConstantTemporalitySelector(CumulativeTemporality) + return aggregation.CumulativeTemporalitySelector() } -// DeltaTemporalitySelector returns an TemporalitySelector that -// always returns DeltaTemporality. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" func DeltaTemporalitySelector() TemporalitySelector { - return ConstantTemporalitySelector(DeltaTemporality) + return aggregation.DeltaTemporalitySelector() } -// StatelessTemporalitySelector returns an TemporalitySelector that -// always returns the Temporality that avoids long-term memory -// requirements. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" func StatelessTemporalitySelector() TemporalitySelector { - return statelessTemporalitySelector{} -} - -// TemporalityFor implements TemporalitySelector. -func (c constantTemporalitySelector) TemporalityFor(_ *sdkapi.Descriptor, _ Kind) Temporality { - return Temporality(c) + return aggregation.StatelessTemporalitySelector() } -// TemporalityFor implements TemporalitySelector. -func (s statelessTemporalitySelector) TemporalityFor(desc *sdkapi.Descriptor, kind Kind) Temporality { - if kind == SumKind && desc.InstrumentKind().PrecomputedSum() { - return CumulativeTemporality - } - return DeltaTemporality -} - -// TemporalitySelector is a sub-interface of Exporter used to indicate -// whether the Processor should compute Delta or Cumulative -// Aggregations. -type TemporalitySelector interface { - // TemporalityFor should return the correct Temporality that - // should be used when exporting data for the given metric - // instrument and Aggregator kind. - TemporalityFor(descriptor *sdkapi.Descriptor, aggregationKind Kind) Temporality -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" +type TemporalitySelector = aggregation.TemporalitySelector diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 09404489a42..2b10328d6a7 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -1,3 +1,4 @@ +// Deprecated: use go.opentelemetry.io/otel/sdk/metric instead. module go.opentelemetry.io/otel/sdk/export/metric go 1.16 @@ -41,10 +42,9 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 + go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 ) replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough diff --git a/sdk/export/metric/go.sum b/sdk/export/metric/go.sum index 7c328dde18e..a5e093f7231 100644 --- a/sdk/export/metric/go.sum +++ b/sdk/export/metric/go.sum @@ -1,3 +1,4 @@ +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -15,7 +16,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/export/metric/metric.go b/sdk/export/metric/metric.go index 81e579b8bab..5da6b3f061f 100644 --- a/sdk/export/metric/metric.go +++ b/sdk/export/metric/metric.go @@ -15,329 +15,53 @@ package metric // import "go.opentelemetry.io/otel/sdk/export/metric" import ( - "context" - "sync" "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) -// Processor is responsible for deciding which kind of aggregation to -// use (via AggregatorSelector), gathering exported results from the -// SDK during collection, and deciding over which dimensions to group -// the exported data. -// -// The SDK supports binding only one of these interfaces, as it has -// the sole responsibility of determining which Aggregator to use for -// each record. -// -// The embedded AggregatorSelector interface is called (concurrently) -// in instrumentation context to select the appropriate Aggregator for -// an instrument. -// -// The `Process` method is called during collection in a -// single-threaded context from the SDK, after the aggregator is -// checkpointed, allowing the processor to build the set of metrics -// currently being exported. -type Processor interface { - // AggregatorSelector is responsible for selecting the - // concrete type of Aggregator used for a metric in the SDK. - // - // This may be a static decision based on fields of the - // Descriptor, or it could use an external configuration - // source to customize the treatment of each metric - // instrument. - // - // The result from AggregatorSelector.AggregatorFor should be - // the same type for a given Descriptor or else nil. The same - // type should be returned for a given descriptor, because - // Aggregators only know how to Merge with their own type. If - // the result is nil, the metric instrument will be disabled. - // - // Note that the SDK only calls AggregatorFor when new records - // require an Aggregator. This does not provide a way to - // disable metrics with active records. - AggregatorSelector - - // Process is called by the SDK once per internal record, - // passing the export Accumulation (a Descriptor, the corresponding - // Labels, and the checkpointed Aggregator). This call has no - // Context argument because it is expected to perform only - // computation. An SDK is not expected to call exporters from - // with Process, use a controller for that (see - // ./controllers/{pull,push}. - Process(accum Accumulation) error -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Accumulation = export.Accumulation -// AggregatorSelector supports selecting the kind of Aggregator to -// use at runtime for a specific metric instrument. -type AggregatorSelector interface { - // AggregatorFor allocates a variable number of aggregators of - // a kind suitable for the requested export. This method - // initializes a `...*Aggregator`, to support making a single - // allocation. - // - // When the call returns without initializing the *Aggregator - // to a non-nil value, the metric instrument is explicitly - // disabled. - // - // This must return a consistent type to avoid confusion in - // later stages of the metrics export process, i.e., when - // Merging or Checkpointing aggregators for a specific - // instrument. - // - // Note: This is context-free because the aggregator should - // not relate to the incoming context. This call should not - // block. - AggregatorFor(descriptor *sdkapi.Descriptor, aggregator ...*Aggregator) -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Aggregator = export.Aggregator -// Checkpointer is the interface used by a Controller to coordinate -// the Processor with Accumulator(s) and Exporter(s). The -// StartCollection() and FinishCollection() methods start and finish a -// collection interval. Controllers call the Accumulator(s) during -// collection to process Accumulations. -type Checkpointer interface { - // Processor processes metric data for export. The Process - // method is bracketed by StartCollection and FinishCollection - // calls. The embedded AggregatorSelector can be called at - // any time. - Processor +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type AggregatorSelector = export.AggregatorSelector - // Reader returns the current data set. This may be - // called before and after collection. The - // implementation is required to return the same value - // throughout its lifetime, since Reader exposes a - // sync.Locker interface. The caller is responsible for - // locking the Reader before initiating collection. - Reader() Reader +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Checkpointer = export.Checkpointer - // StartCollection begins a collection interval. - StartCollection() +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type CheckpointerFactory = export.CheckpointerFactory - // FinishCollection ends a collection interval. - FinishCollection() error -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Exporter = export.Exporter -// CheckpointerFactory is an interface for producing configured -// Checkpointer instances. -type CheckpointerFactory interface { - NewCheckpointer() Checkpointer -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type InstrumentationLibraryReader = export.Exporter -// Aggregator implements a specific aggregation behavior, e.g., a -// behavior to track a sequence of updates to an instrument. Counter -// instruments commonly use a simple Sum aggregator, but for the -// distribution instruments (Histogram, GaugeObserver) there are a -// number of possible aggregators with different cost and accuracy -// tradeoffs. -// -// Note that any Aggregator may be attached to any instrument--this is -// the result of the OpenTelemetry API/SDK separation. It is possible -// to attach a Sum aggregator to a Histogram instrument. -type Aggregator interface { - // Aggregation returns an Aggregation interface to access the - // current state of this Aggregator. The caller is - // responsible for synchronization and must not call any the - // other methods in this interface concurrently while using - // the Aggregation. - Aggregation() aggregation.Aggregation +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Metadata = export.Metadata - // Update receives a new measured value and incorporates it - // into the aggregation. Update() calls may be called - // concurrently. - // - // Descriptor.NumberKind() should be consulted to determine - // whether the provided number is an int64 or float64. - // - // The Context argument comes from user-level code and could be - // inspected for a `correlation.Map` or `trace.SpanContext`. - Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Processor = export.Processor - // SynchronizedMove is called during collection to finish one - // period of aggregation by atomically saving the - // currently-updating state into the argument Aggregator AND - // resetting the current value to the zero state. - // - // SynchronizedMove() is called concurrently with Update(). These - // two methods must be synchronized with respect to each - // other, for correctness. - // - // After saving a synchronized copy, the Aggregator can be converted - // into one or more of the interfaces in the `aggregation` sub-package, - // according to kind of Aggregator that was selected. - // - // This method will return an InconsistentAggregatorError if - // this Aggregator cannot be copied into the destination due - // to an incompatible type. - // - // This call has no Context argument because it is expected to - // perform only computation. - // - // When called with a nil `destination`, this Aggregator is reset - // and the current value is discarded. - SynchronizedMove(destination Aggregator, descriptor *sdkapi.Descriptor) error +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Reader = export.Reader - // Merge combines the checkpointed state from the argument - // Aggregator into this Aggregator. Merge is not synchronized - // with respect to Update or SynchronizedMove. - // - // The owner of an Aggregator being merged is responsible for - // synchronization of both Aggregator states. - Merge(aggregator Aggregator, descriptor *sdkapi.Descriptor) error -} - -// Exporter handles presentation of the checkpoint of aggregate -// metrics. This is the final stage of a metrics export pipeline, -// where metric data are formatted for a specific system. -type Exporter interface { - // Export is called immediately after completing a collection - // pass in the SDK. - // - // The Context comes from the controller that initiated - // collection. - // - // The InstrumentationLibraryReader interface refers to the - // Processor that just completed collection. - Export(ctx context.Context, resource *resource.Resource, reader InstrumentationLibraryReader) error - - // TemporalitySelector is an interface used by the Processor - // in deciding whether to compute Delta or Cumulative - // Aggregations when passing Records to this Exporter. - aggregation.TemporalitySelector -} - -// InstrumentationLibraryReader is an interface for exporters to iterate -// over one instrumentation library of metric data at a time. -type InstrumentationLibraryReader interface { - // ForEach calls the passed function once per instrumentation library, - // allowing the caller to emit metrics grouped by the library that - // produced them. - ForEach(readerFunc func(instrumentation.Library, Reader) error) error -} - -// Reader allows a controller to access a complete checkpoint of -// aggregated metrics from the Processor for a single library of -// metric data. This is passed to the Exporter which may then use -// ForEach to iterate over the collection of aggregated metrics. -type Reader interface { - // ForEach iterates over aggregated checkpoints for all - // metrics that were updated during the last collection - // period. Each aggregated checkpoint returned by the - // function parameter may return an error. - // - // The TemporalitySelector argument is used to determine - // whether the Record is computed using Delta or Cumulative - // aggregation. - // - // ForEach tolerates ErrNoData silently, as this is - // expected from the Meter implementation. Any other kind - // of error will immediately halt ForEach and return - // the error to the caller. - ForEach(tempSelector aggregation.TemporalitySelector, recordFunc func(Record) error) error - - // Locker supports locking the checkpoint set. Collection - // into the checkpoint set cannot take place (in case of a - // stateful processor) while it is locked. - // - // The Processor attached to the Accumulator MUST be called - // with the lock held. - sync.Locker - - // RLock acquires a read lock corresponding to this Locker. - RLock() - // RUnlock releases a read lock corresponding to this Locker. - RUnlock() -} +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" +type Record = export.Record -// Metadata contains the common elements for exported metric data that -// are shared by the Accumulator->Processor and Processor->Exporter -// steps. -type Metadata struct { - descriptor *sdkapi.Descriptor - labels *attribute.Set -} - -// Accumulation contains the exported data for a single metric instrument -// and label set, as prepared by an Accumulator for the Processor. -type Accumulation struct { - Metadata - aggregator Aggregator -} - -// Record contains the exported data for a single metric instrument -// and label set, as prepared by the Processor for the Exporter. -// This includes the effective start and end time for the aggregation. -type Record struct { - Metadata - aggregation aggregation.Aggregation - start time.Time - end time.Time -} - -// Descriptor describes the metric instrument being exported. -func (m Metadata) Descriptor() *sdkapi.Descriptor { - return m.descriptor -} - -// Labels describes the labels associated with the instrument and the -// aggregated data. -func (m Metadata) Labels() *attribute.Set { - return m.labels -} - -// NewAccumulation allows Accumulator implementations to construct new -// Accumulations to send to Processors. The Descriptor, Labels, -// and Aggregator represent aggregate metric events received over a single -// collection period. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator Aggregator) Accumulation { - return Accumulation{ - Metadata: Metadata{ - descriptor: descriptor, - labels: labels, - }, - aggregator: aggregator, - } -} - -// Aggregator returns the checkpointed aggregator. It is safe to -// access the checkpointed state without locking. -func (r Accumulation) Aggregator() Aggregator { - return r.aggregator + return export.NewAccumulation(descriptor, labels, aggregator) } -// NewRecord allows Processor implementations to construct export -// records. The Descriptor, Labels, and Aggregator represent -// aggregate metric events received over a single collection period. +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" func NewRecord(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { - return Record{ - Metadata: Metadata{ - descriptor: descriptor, - labels: labels, - }, - aggregation: aggregation, - start: start, - end: end, - } -} - -// Aggregation returns the aggregation, an interface to the record and -// its aggregator, dependent on the kind of both the input and exporter. -func (r Record) Aggregation() aggregation.Aggregation { - return r.aggregation -} - -// StartTime is the start time of the interval covered by this aggregation. -func (r Record) StartTime() time.Time { - return r.start -} - -// EndTime is the end time of the interval covered by this aggregation. -func (r Record) EndTime() time.Time { - return r.end + return export.NewRecord(descriptor, labels, aggregation, start, end) } diff --git a/sdk/metric/aggregator/aggregator.go b/sdk/metric/aggregator/aggregator.go index 13a315e2d4a..103c08cfa0b 100644 --- a/sdk/metric/aggregator/aggregator.go +++ b/sdk/metric/aggregator/aggregator.go @@ -20,8 +20,8 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) // NewInconsistentAggregatorError formats an error describing an attempt to diff --git a/sdk/metric/aggregator/aggregator_test.go b/sdk/metric/aggregator/aggregator_test.go index fd85297ed1d..bf405b5c3f8 100644 --- a/sdk/metric/aggregator/aggregator_test.go +++ b/sdk/metric/aggregator/aggregator_test.go @@ -24,10 +24,10 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) func TestInconsistentAggregatorErr(t *testing.T) { diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go index 2fbfca5eed9..48b92ec9c7e 100644 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ b/sdk/metric/aggregator/aggregatortest/test.go @@ -29,9 +29,9 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) const Magnitude = 1000 diff --git a/sdk/metric/aggregator/histogram/histogram.go b/sdk/metric/aggregator/histogram/histogram.go index 899c71cacd1..888c985ce3e 100644 --- a/sdk/metric/aggregator/histogram/histogram.go +++ b/sdk/metric/aggregator/histogram/histogram.go @@ -21,9 +21,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) // Note: This code uses a Mutex to govern access to the exclusive diff --git a/sdk/metric/aggregator/histogram/histogram_test.go b/sdk/metric/aggregator/histogram/histogram_test.go index a4c5c6da687..2d09edbfdc9 100644 --- a/sdk/metric/aggregator/histogram/histogram_test.go +++ b/sdk/metric/aggregator/histogram/histogram_test.go @@ -25,9 +25,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" + "go.opentelemetry.io/otel/sdk/metric/export" ) const count = 100 diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go index 71b117890cb..4a1da706062 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue.go @@ -22,9 +22,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) type ( diff --git a/sdk/metric/aggregator/lastvalue/lastvalue_test.go b/sdk/metric/aggregator/lastvalue/lastvalue_test.go index 8f1a771009c..bdfe6a65bd4 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue_test.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue_test.go @@ -27,9 +27,9 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) const count = 100 diff --git a/sdk/metric/aggregator/sum/sum.go b/sdk/metric/aggregator/sum/sum.go index 8c1d11c715d..d048e9bc253 100644 --- a/sdk/metric/aggregator/sum/sum.go +++ b/sdk/metric/aggregator/sum/sum.go @@ -19,9 +19,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/aggregator" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) // Aggregator aggregates counter events. diff --git a/sdk/metric/aggregator/sum/sum_test.go b/sdk/metric/aggregator/sum/sum_test.go index 3387c83cc8d..da614d83f49 100644 --- a/sdk/metric/aggregator/sum/sum_test.go +++ b/sdk/metric/aggregator/sum/sum_test.go @@ -24,8 +24,8 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" + "go.opentelemetry.io/otel/sdk/metric/export" ) const count = 100 diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 585bf43609c..eb89f54b330 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -24,8 +24,8 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" sdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" ) diff --git a/sdk/metric/controller/basic/config.go b/sdk/metric/controller/basic/config.go index cbc91a8f59d..01691ecadd1 100644 --- a/sdk/metric/controller/basic/config.go +++ b/sdk/metric/controller/basic/config.go @@ -18,7 +18,7 @@ import ( "time" "go.opentelemetry.io/otel" - export "go.opentelemetry.io/otel/sdk/export/metric" + "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index bf3be5fe1c9..a684f65678e 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -23,10 +23,10 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/internal/metric/registry" "go.opentelemetry.io/otel/metric" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/instrumentation" sdk "go.opentelemetry.io/otel/sdk/metric" controllerTime "go.opentelemetry.io/otel/sdk/metric/controller/time" + "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/sdk/metric/controller/basic/controller_test.go b/sdk/metric/controller/basic/controller_test.go index 870e65f2c0c..503a278148c 100644 --- a/sdk/metric/controller/basic/controller_test.go +++ b/sdk/metric/controller/basic/controller_test.go @@ -27,11 +27,11 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/metric/controller/basic/pull_test.go b/sdk/metric/controller/basic/pull_test.go index 6e87c6f6a97..96d1e1adad1 100644 --- a/sdk/metric/controller/basic/pull_test.go +++ b/sdk/metric/controller/basic/pull_test.go @@ -24,9 +24,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/metric/controller/basic/push_test.go b/sdk/metric/controller/basic/push_test.go index 775754774bf..0a6679b29de 100644 --- a/sdk/metric/controller/basic/push_test.go +++ b/sdk/metric/controller/basic/push_test.go @@ -28,10 +28,10 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/metric/controller/controllertest/test.go b/sdk/metric/controller/controllertest/test.go index 8676129ebe5..ed0bb88f1a3 100644 --- a/sdk/metric/controller/controllertest/test.go +++ b/sdk/metric/controller/controllertest/test.go @@ -19,10 +19,10 @@ import ( "github.com/benbjohnson/clock" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" controllerTime "go.opentelemetry.io/otel/sdk/metric/controller/time" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) type MockClock struct { diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index 70eadfeca86..f5fd7ea814f 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -27,9 +27,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" metricsdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" ) diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index 752c3db85c0..e3270211be1 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -65,7 +65,7 @@ Export Pipeline While the SDK serves to maintain a current set of records and coordinate collection, the behavior of a metrics export pipeline is configured through the export types in -go.opentelemetry.io/otel/sdk/export/metric. It is important to keep +go.opentelemetry.io/otel/sdk/metric/export. It is important to keep in mind the context these interfaces are called from. There are two contexts, instrumentation context, where a user-level goroutine that enters the SDK resulting in a new record, and collection context, diff --git a/sdk/metric/export/aggregation/aggregation.go b/sdk/metric/export/aggregation/aggregation.go new file mode 100644 index 00000000000..4d5254ed71b --- /dev/null +++ b/sdk/metric/export/aggregation/aggregation.go @@ -0,0 +1,131 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregation // import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + +import ( + "fmt" + "time" + + "go.opentelemetry.io/otel/metric/number" +) + +// These interfaces describe the various ways to access state from an +// Aggregation. + +type ( + // Aggregation is an interface returned by the Aggregator + // containing an interval of metric data. + Aggregation interface { + // Kind returns a short identifying string to identify + // the Aggregator that was used to produce the + // Aggregation (e.g., "Sum"). + Kind() Kind + } + + // Sum returns an aggregated sum. + Sum interface { + Aggregation + Sum() (number.Number, error) + } + + // Count returns the number of values that were aggregated. + Count interface { + Aggregation + Count() (uint64, error) + } + + // Min returns the minimum value over the set of values that were aggregated. + Min interface { + Aggregation + Min() (number.Number, error) + } + + // Max returns the maximum value over the set of values that were aggregated. + Max interface { + Aggregation + Max() (number.Number, error) + } + + // LastValue returns the latest value that was aggregated. + LastValue interface { + Aggregation + LastValue() (number.Number, time.Time, error) + } + + // Buckets represents histogram buckets boundaries and counts. + // + // For a Histogram with N defined boundaries, e.g, [x, y, z]. + // There are N+1 counts: [-inf, x), [x, y), [y, z), [z, +inf] + Buckets struct { + // Boundaries are floating point numbers, even when + // aggregating integers. + Boundaries []float64 + + // Counts holds the count in each bucket. + Counts []uint64 + } + + // Histogram returns the count of events in pre-determined buckets. + Histogram interface { + Aggregation + Count() (uint64, error) + Sum() (number.Number, error) + Histogram() (Buckets, error) + } +) + +type ( + // Kind is a short name for the Aggregator that produces an + // Aggregation, used for descriptive purpose only. Kind is a + // string to allow user-defined Aggregators. + // + // When deciding how to handle an Aggregation, Exporters are + // encouraged to decide based on conversion to the above + // interfaces based on strength, not on Kind value, when + // deciding how to expose metric data. This enables + // user-supplied Aggregators to replace builtin Aggregators. + // + // For example, test for a Histogram before testing for a + // Sum, and so on. + Kind string +) + +// Kind description constants. +const ( + SumKind Kind = "Sum" + HistogramKind Kind = "Histogram" + LastValueKind Kind = "Lastvalue" +) + +// Sentinel errors for Aggregation interface. +var ( + ErrNegativeInput = fmt.Errorf("negative value is out of range for this instrument") + ErrNaNInput = fmt.Errorf("NaN value is an invalid input") + ErrInconsistentType = fmt.Errorf("inconsistent aggregator types") + + // ErrNoCumulativeToDelta is returned when requesting delta + // export kind for a precomputed sum instrument. + ErrNoCumulativeToDelta = fmt.Errorf("cumulative to delta not implemented") + + // ErrNoData is returned when (due to a race with collection) + // the Aggregator is check-pointed before the first value is set. + // The aggregator should simply be skipped in this case. + ErrNoData = fmt.Errorf("no data collected by this aggregator") +) + +// String returns the string value of Kind. +func (k Kind) String() string { + return string(k) +} diff --git a/sdk/metric/export/aggregation/temporality.go b/sdk/metric/export/aggregation/temporality.go new file mode 100644 index 00000000000..ca71b79d03f --- /dev/null +++ b/sdk/metric/export/aggregation/temporality.go @@ -0,0 +1,117 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:generate stringer -type=Temporality + +package aggregation // import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + +import ( + "go.opentelemetry.io/otel/metric/sdkapi" +) + +// Temporality indicates the temporal aggregation exported by an exporter. +// These bits may be OR-d together when multiple exporters are in use. +type Temporality uint8 + +const ( + // CumulativeTemporality indicates that an Exporter expects a + // Cumulative Aggregation. + CumulativeTemporality Temporality = 1 + + // DeltaTemporality indicates that an Exporter expects a + // Delta Aggregation. + DeltaTemporality Temporality = 2 +) + +// Includes returns if t includes support for other temporality. +func (t Temporality) Includes(other Temporality) bool { + return t&other != 0 +} + +// MemoryRequired returns whether an exporter of this temporality requires +// memory to export correctly. +func (t Temporality) MemoryRequired(mkind sdkapi.InstrumentKind) bool { + switch mkind { + case sdkapi.HistogramInstrumentKind, sdkapi.GaugeObserverInstrumentKind, + sdkapi.CounterInstrumentKind, sdkapi.UpDownCounterInstrumentKind: + // Delta-oriented instruments: + return t.Includes(CumulativeTemporality) + + case sdkapi.CounterObserverInstrumentKind, sdkapi.UpDownCounterObserverInstrumentKind: + // Cumulative-oriented instruments: + return t.Includes(DeltaTemporality) + } + // Something unexpected is happening--we could panic. This + // will become an error when the exporter tries to access a + // checkpoint, presumably, so let it be. + return false +} + +type ( + constantTemporalitySelector Temporality + statelessTemporalitySelector struct{} +) + +var ( + _ TemporalitySelector = constantTemporalitySelector(0) + _ TemporalitySelector = statelessTemporalitySelector{} +) + +// ConstantTemporalitySelector returns an TemporalitySelector that returns +// a constant Temporality. +func ConstantTemporalitySelector(t Temporality) TemporalitySelector { + return constantTemporalitySelector(t) +} + +// CumulativeTemporalitySelector returns an TemporalitySelector that +// always returns CumulativeTemporality. +func CumulativeTemporalitySelector() TemporalitySelector { + return ConstantTemporalitySelector(CumulativeTemporality) +} + +// DeltaTemporalitySelector returns an TemporalitySelector that +// always returns DeltaTemporality. +func DeltaTemporalitySelector() TemporalitySelector { + return ConstantTemporalitySelector(DeltaTemporality) +} + +// StatelessTemporalitySelector returns an TemporalitySelector that +// always returns the Temporality that avoids long-term memory +// requirements. +func StatelessTemporalitySelector() TemporalitySelector { + return statelessTemporalitySelector{} +} + +// TemporalityFor implements TemporalitySelector. +func (c constantTemporalitySelector) TemporalityFor(_ *sdkapi.Descriptor, _ Kind) Temporality { + return Temporality(c) +} + +// TemporalityFor implements TemporalitySelector. +func (s statelessTemporalitySelector) TemporalityFor(desc *sdkapi.Descriptor, kind Kind) Temporality { + if kind == SumKind && desc.InstrumentKind().PrecomputedSum() { + return CumulativeTemporality + } + return DeltaTemporality +} + +// TemporalitySelector is a sub-interface of Exporter used to indicate +// whether the Processor should compute Delta or Cumulative +// Aggregations. +type TemporalitySelector interface { + // TemporalityFor should return the correct Temporality that + // should be used when exporting data for the given metric + // instrument and Aggregator kind. + TemporalityFor(descriptor *sdkapi.Descriptor, aggregationKind Kind) Temporality +} diff --git a/sdk/export/metric/aggregation/temporality_string.go b/sdk/metric/export/aggregation/temporality_string.go similarity index 100% rename from sdk/export/metric/aggregation/temporality_string.go rename to sdk/metric/export/aggregation/temporality_string.go diff --git a/sdk/export/metric/aggregation/temporality_test.go b/sdk/metric/export/aggregation/temporality_test.go similarity index 100% rename from sdk/export/metric/aggregation/temporality_test.go rename to sdk/metric/export/aggregation/temporality_test.go diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go new file mode 100644 index 00000000000..46a809a354f --- /dev/null +++ b/sdk/metric/export/metric.go @@ -0,0 +1,343 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package export // import "go.opentelemetry.io/otel/sdk/metric/export" + +import ( + "context" + "sync" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/resource" +) + +// Processor is responsible for deciding which kind of aggregation to +// use (via AggregatorSelector), gathering exported results from the +// SDK during collection, and deciding over which dimensions to group +// the exported data. +// +// The SDK supports binding only one of these interfaces, as it has +// the sole responsibility of determining which Aggregator to use for +// each record. +// +// The embedded AggregatorSelector interface is called (concurrently) +// in instrumentation context to select the appropriate Aggregator for +// an instrument. +// +// The `Process` method is called during collection in a +// single-threaded context from the SDK, after the aggregator is +// checkpointed, allowing the processor to build the set of metrics +// currently being exported. +type Processor interface { + // AggregatorSelector is responsible for selecting the + // concrete type of Aggregator used for a metric in the SDK. + // + // This may be a static decision based on fields of the + // Descriptor, or it could use an external configuration + // source to customize the treatment of each metric + // instrument. + // + // The result from AggregatorSelector.AggregatorFor should be + // the same type for a given Descriptor or else nil. The same + // type should be returned for a given descriptor, because + // Aggregators only know how to Merge with their own type. If + // the result is nil, the metric instrument will be disabled. + // + // Note that the SDK only calls AggregatorFor when new records + // require an Aggregator. This does not provide a way to + // disable metrics with active records. + AggregatorSelector + + // Process is called by the SDK once per internal record, + // passing the export Accumulation (a Descriptor, the corresponding + // Labels, and the checkpointed Aggregator). This call has no + // Context argument because it is expected to perform only + // computation. An SDK is not expected to call exporters from + // with Process, use a controller for that (see + // ./controllers/{pull,push}. + Process(accum Accumulation) error +} + +// AggregatorSelector supports selecting the kind of Aggregator to +// use at runtime for a specific metric instrument. +type AggregatorSelector interface { + // AggregatorFor allocates a variable number of aggregators of + // a kind suitable for the requested export. This method + // initializes a `...*Aggregator`, to support making a single + // allocation. + // + // When the call returns without initializing the *Aggregator + // to a non-nil value, the metric instrument is explicitly + // disabled. + // + // This must return a consistent type to avoid confusion in + // later stages of the metrics export process, i.e., when + // Merging or Checkpointing aggregators for a specific + // instrument. + // + // Note: This is context-free because the aggregator should + // not relate to the incoming context. This call should not + // block. + AggregatorFor(descriptor *sdkapi.Descriptor, aggregator ...*Aggregator) +} + +// Checkpointer is the interface used by a Controller to coordinate +// the Processor with Accumulator(s) and Exporter(s). The +// StartCollection() and FinishCollection() methods start and finish a +// collection interval. Controllers call the Accumulator(s) during +// collection to process Accumulations. +type Checkpointer interface { + // Processor processes metric data for export. The Process + // method is bracketed by StartCollection and FinishCollection + // calls. The embedded AggregatorSelector can be called at + // any time. + Processor + + // Reader returns the current data set. This may be + // called before and after collection. The + // implementation is required to return the same value + // throughout its lifetime, since Reader exposes a + // sync.Locker interface. The caller is responsible for + // locking the Reader before initiating collection. + Reader() Reader + + // StartCollection begins a collection interval. + StartCollection() + + // FinishCollection ends a collection interval. + FinishCollection() error +} + +// CheckpointerFactory is an interface for producing configured +// Checkpointer instances. +type CheckpointerFactory interface { + NewCheckpointer() Checkpointer +} + +// Aggregator implements a specific aggregation behavior, e.g., a +// behavior to track a sequence of updates to an instrument. Counter +// instruments commonly use a simple Sum aggregator, but for the +// distribution instruments (Histogram, GaugeObserver) there are a +// number of possible aggregators with different cost and accuracy +// tradeoffs. +// +// Note that any Aggregator may be attached to any instrument--this is +// the result of the OpenTelemetry API/SDK separation. It is possible +// to attach a Sum aggregator to a Histogram instrument. +type Aggregator interface { + // Aggregation returns an Aggregation interface to access the + // current state of this Aggregator. The caller is + // responsible for synchronization and must not call any the + // other methods in this interface concurrently while using + // the Aggregation. + Aggregation() aggregation.Aggregation + + // Update receives a new measured value and incorporates it + // into the aggregation. Update() calls may be called + // concurrently. + // + // Descriptor.NumberKind() should be consulted to determine + // whether the provided number is an int64 or float64. + // + // The Context argument comes from user-level code and could be + // inspected for a `correlation.Map` or `trace.SpanContext`. + Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error + + // SynchronizedMove is called during collection to finish one + // period of aggregation by atomically saving the + // currently-updating state into the argument Aggregator AND + // resetting the current value to the zero state. + // + // SynchronizedMove() is called concurrently with Update(). These + // two methods must be synchronized with respect to each + // other, for correctness. + // + // After saving a synchronized copy, the Aggregator can be converted + // into one or more of the interfaces in the `aggregation` sub-package, + // according to kind of Aggregator that was selected. + // + // This method will return an InconsistentAggregatorError if + // this Aggregator cannot be copied into the destination due + // to an incompatible type. + // + // This call has no Context argument because it is expected to + // perform only computation. + // + // When called with a nil `destination`, this Aggregator is reset + // and the current value is discarded. + SynchronizedMove(destination Aggregator, descriptor *sdkapi.Descriptor) error + + // Merge combines the checkpointed state from the argument + // Aggregator into this Aggregator. Merge is not synchronized + // with respect to Update or SynchronizedMove. + // + // The owner of an Aggregator being merged is responsible for + // synchronization of both Aggregator states. + Merge(aggregator Aggregator, descriptor *sdkapi.Descriptor) error +} + +// Exporter handles presentation of the checkpoint of aggregate +// metrics. This is the final stage of a metrics export pipeline, +// where metric data are formatted for a specific system. +type Exporter interface { + // Export is called immediately after completing a collection + // pass in the SDK. + // + // The Context comes from the controller that initiated + // collection. + // + // The InstrumentationLibraryReader interface refers to the + // Processor that just completed collection. + Export(ctx context.Context, resource *resource.Resource, reader InstrumentationLibraryReader) error + + // TemporalitySelector is an interface used by the Processor + // in deciding whether to compute Delta or Cumulative + // Aggregations when passing Records to this Exporter. + aggregation.TemporalitySelector +} + +// InstrumentationLibraryReader is an interface for exporters to iterate +// over one instrumentation library of metric data at a time. +type InstrumentationLibraryReader interface { + // ForEach calls the passed function once per instrumentation library, + // allowing the caller to emit metrics grouped by the library that + // produced them. + ForEach(readerFunc func(instrumentation.Library, Reader) error) error +} + +// Reader allows a controller to access a complete checkpoint of +// aggregated metrics from the Processor for a single library of +// metric data. This is passed to the Exporter which may then use +// ForEach to iterate over the collection of aggregated metrics. +type Reader interface { + // ForEach iterates over aggregated checkpoints for all + // metrics that were updated during the last collection + // period. Each aggregated checkpoint returned by the + // function parameter may return an error. + // + // The TemporalitySelector argument is used to determine + // whether the Record is computed using Delta or Cumulative + // aggregation. + // + // ForEach tolerates ErrNoData silently, as this is + // expected from the Meter implementation. Any other kind + // of error will immediately halt ForEach and return + // the error to the caller. + ForEach(tempSelector aggregation.TemporalitySelector, recordFunc func(Record) error) error + + // Locker supports locking the checkpoint set. Collection + // into the checkpoint set cannot take place (in case of a + // stateful processor) while it is locked. + // + // The Processor attached to the Accumulator MUST be called + // with the lock held. + sync.Locker + + // RLock acquires a read lock corresponding to this Locker. + RLock() + // RUnlock releases a read lock corresponding to this Locker. + RUnlock() +} + +// Metadata contains the common elements for exported metric data that +// are shared by the Accumulator->Processor and Processor->Exporter +// steps. +type Metadata struct { + descriptor *sdkapi.Descriptor + labels *attribute.Set +} + +// Accumulation contains the exported data for a single metric instrument +// and label set, as prepared by an Accumulator for the Processor. +type Accumulation struct { + Metadata + aggregator Aggregator +} + +// Record contains the exported data for a single metric instrument +// and label set, as prepared by the Processor for the Exporter. +// This includes the effective start and end time for the aggregation. +type Record struct { + Metadata + aggregation aggregation.Aggregation + start time.Time + end time.Time +} + +// Descriptor describes the metric instrument being exported. +func (m Metadata) Descriptor() *sdkapi.Descriptor { + return m.descriptor +} + +// Labels describes the labels associated with the instrument and the +// aggregated data. +func (m Metadata) Labels() *attribute.Set { + return m.labels +} + +// NewAccumulation allows Accumulator implementations to construct new +// Accumulations to send to Processors. The Descriptor, Labels, +// and Aggregator represent aggregate metric events received over a single +// collection period. +func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator Aggregator) Accumulation { + return Accumulation{ + Metadata: Metadata{ + descriptor: descriptor, + labels: labels, + }, + aggregator: aggregator, + } +} + +// Aggregator returns the checkpointed aggregator. It is safe to +// access the checkpointed state without locking. +func (r Accumulation) Aggregator() Aggregator { + return r.aggregator +} + +// NewRecord allows Processor implementations to construct export +// records. The Descriptor, Labels, and Aggregator represent +// aggregate metric events received over a single collection period. +func NewRecord(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { + return Record{ + Metadata: Metadata{ + descriptor: descriptor, + labels: labels, + }, + aggregation: aggregation, + start: start, + end: end, + } +} + +// Aggregation returns the aggregation, an interface to the record and +// its aggregator, dependent on the kind of both the input and exporter. +func (r Record) Aggregation() aggregation.Aggregation { + return r.aggregation +} + +// StartTime is the start time of the interval covered by this aggregation. +func (r Record) StartTime() time.Time { + return r.start +} + +// EndTime is the end time of the interval covered by this aggregation. +func (r Record) EndTime() time.Time { + return r.end +} diff --git a/sdk/export/metric/metric_test.go b/sdk/metric/export/metric_test.go similarity index 99% rename from sdk/export/metric/metric_test.go rename to sdk/metric/export/metric_test.go index 706e3b83a51..5337d11c9e8 100644 --- a/sdk/export/metric/metric_test.go +++ b/sdk/metric/export/metric_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric +package export import ( "testing" diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index a03a0ea80a3..1424e5674cf 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -47,7 +47,6 @@ require ( go.opentelemetry.io/otel/internal/metric v0.26.0 go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/export/metric v0.26.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index 7ea491cf417..c86af124bb3 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -22,8 +22,8 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) type ( diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go index a465db2c1a0..482a82a2efd 100644 --- a/sdk/metric/processor/basic/basic_test.go +++ b/sdk/metric/processor/basic/basic_test.go @@ -29,11 +29,11 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" sdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index 49e9b45662c..840af80acf7 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -23,12 +23,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/sdk/metric/processor/processortest/test_test.go b/sdk/metric/processor/processortest/test_test.go index 2ddbafc0ec8..4cc990c344a 100644 --- a/sdk/metric/processor/processortest/test_test.go +++ b/sdk/metric/processor/processortest/test_test.go @@ -22,10 +22,10 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" metricsdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/metric/processor/reducer/reducer.go b/sdk/metric/processor/reducer/reducer.go index deb9edd34f1..b7fb4894036 100644 --- a/sdk/metric/processor/reducer/reducer.go +++ b/sdk/metric/processor/reducer/reducer.go @@ -17,7 +17,7 @@ package reducer // import "go.opentelemetry.io/otel/sdk/metric/processor/reducer import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" + "go.opentelemetry.io/otel/sdk/metric/export" ) type ( diff --git a/sdk/metric/processor/reducer/reducer_test.go b/sdk/metric/processor/reducer/reducer_test.go index bac96ae2b6c..3da65d313ef 100644 --- a/sdk/metric/processor/reducer/reducer_test.go +++ b/sdk/metric/processor/reducer/reducer_test.go @@ -23,9 +23,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" "go.opentelemetry.io/otel/sdk/instrumentation" metricsdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go index 998e31f6fa6..97e0d852dcd 100644 --- a/sdk/metric/sdk.go +++ b/sdk/metric/sdk.go @@ -26,8 +26,8 @@ import ( internal "go.opentelemetry.io/otel/internal/metric" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator" + "go.opentelemetry.io/otel/sdk/metric/export" ) type ( diff --git a/sdk/metric/selector/simple/simple.go b/sdk/metric/selector/simple/simple.go index 3a23be1d70c..5a8d9a23b04 100644 --- a/sdk/metric/selector/simple/simple.go +++ b/sdk/metric/selector/simple/simple.go @@ -16,10 +16,10 @@ package simple // import "go.opentelemetry.io/otel/sdk/metric/selector/simple" import ( "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" ) type ( diff --git a/sdk/metric/selector/simple/simple_test.go b/sdk/metric/selector/simple/simple_test.go index bd7325518e6..e47f3439414 100644 --- a/sdk/metric/selector/simple/simple_test.go +++ b/sdk/metric/selector/simple/simple_test.go @@ -22,10 +22,10 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" + "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/selector/simple" ) diff --git a/sdk/metric/stress_test.go b/sdk/metric/stress_test.go index 229b9fe7c20..f6b9eb4ba02 100644 --- a/sdk/metric/stress_test.go +++ b/sdk/metric/stress_test.go @@ -36,8 +36,8 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - export "go.opentelemetry.io/otel/sdk/export/metric" - "go.opentelemetry.io/otel/sdk/export/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" ) From 01fe5328f7e3353ffd71f8c47eb1a2f2ff337657 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 14 Dec 2021 08:27:56 -0800 Subject: [PATCH 002/886] Small nit in comments (#2446) Signed-off-by: Bogdan Drutu --- metric/sdkapi/sdkapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metric/sdkapi/sdkapi.go b/metric/sdkapi/sdkapi.go index 43a20efc946..36836364bdc 100644 --- a/metric/sdkapi/sdkapi.go +++ b/metric/sdkapi/sdkapi.go @@ -72,7 +72,7 @@ type AsyncImpl interface { // AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner // does not satisfy one of these interfaces. type AsyncRunner interface { - // AnyRunner() is a non-exported method with no functional use + // AnyRunner is a non-exported method with no functional use // other than to make this a non-empty interface. AnyRunner() } From 43daab9cab5b20ebbd9f61ce248f5ebcb9f79e33 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 14 Dec 2021 08:46:15 -0800 Subject: [PATCH 003/886] Add 'Using instrumentation libraries' page for docs (#2437) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add automatic instrumentation page for docs * Update website_docs/automatic_instrumentation.md Co-authored-by: Sam Xie * Updates as per feedback * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update website_docs/using_instrumentation_libraries.md Co-authored-by: Robert Pająk * fix docs build Co-authored-by: Sam Xie Co-authored-by: Tyler Yahn Co-authored-by: Robert Pająk --- ...mentation.md => manual_instrumentation.md} | 7 -- .../using_instrumentation_libraries.md | 93 +++++++++++++++++++ 2 files changed, 93 insertions(+), 7 deletions(-) rename website_docs/{instrumentation.md => manual_instrumentation.md} (87%) create mode 100644 website_docs/using_instrumentation_libraries.md diff --git a/website_docs/instrumentation.md b/website_docs/manual_instrumentation.md similarity index 87% rename from website_docs/instrumentation.md rename to website_docs/manual_instrumentation.md index db1738d1c48..92d7d2f3a76 100644 --- a/website_docs/instrumentation.md +++ b/website_docs/manual_instrumentation.md @@ -107,10 +107,3 @@ otel.SetTextMapPropagator(propagation.TraceContext{}) > OpenTelemetry also supports the B3 header format, for compatibility with existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that do not support the W3C TraceContext standard. After configuring context propagation, you'll most likely want to use automatic instrumentation to handle the behind-the-scenes work of actually managing serializing the context. - -# Automatic Instrumentation - -Automatic instrumentation, broadly, refers to instrumentation code that you didn't write. OpenTelemetry for Go supports this process through wrappers and helper functions around many popular frameworks and libraries. You can find a current list [here](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation), as well as at the [registry](/registry). - -[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}} -[Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}} diff --git a/website_docs/using_instrumentation_libraries.md b/website_docs/using_instrumentation_libraries.md new file mode 100644 index 00000000000..aef81b60cd1 --- /dev/null +++ b/website_docs/using_instrumentation_libraries.md @@ -0,0 +1,93 @@ +--- +title: Using instrumentation libraries +weight: 3 +--- + +Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](https://opentelemetry.io/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/hhtp` will automatically create spans that track inbound and outbound requests once you configure it in your code. + +## Setup + +Each instrumentation library is a package. In general, this means you need to `go get` the appropriate package: + +```console +go get go.opentelemetry.io/contrib/instrumentation/{import-path}/otel{package-name} +``` + +And then configure it in your code based on what the library requires to be activated. + +## Example with `net/http` + +As an example, here's how you can set up automatic instrumentation for inbound HTTP requests for `net/http`: + +First, get the `net/http` instrumentation library: + +```console +go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp +``` + +Next, use the library to wrap an HTTP handler in your code: + +```go +package main + +import ( + "context" + "fmt" + "log" + "net/http" + "time" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" +) + +// Package-level tracer. +// This should be configured in your code setup instead of here. +var tracer = otel.Tracer("github.com/full/path/to/mypkg") + +// sleepy mocks work that your application does. +func sleepy(ctx context.Context) { + _, span := tracer.Start(ctx, "sleep") + defer span.End() + + sleepTime := 1 * time.Second + time.Sleep(sleepTime) + span.SetAttributes(attribute.Int("sleep.duration", int(sleepTime))) +} + +// httpHandler is an HTTP handler function that is going to be instrumented. +func httpHandler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, World! I am instrumented autoamtically!") + ctx := r.Context() + sleepy(ctx) +} + +func main() { + // Wrap your httpHandler function. + handler := http.HandlerFunc(httpHandler) + wrappedHandler := otelhttp.NewHandler(handler, "hello-instrumented") + http.Handle("/hello-instrumented", wrappedHandler) + + // And start the HTTP serve. + log.Fatal(http.ListenAndServe(":3030", nil)) +} +``` + +Assuming that you have a `Tracer` and [exporter](exporting_data.md) configured, this code will: + +* Start an HTTP server on port `3030` +* Automatically generate a span for each inbound HTTP request to `/hello-instrumented` +* Create a child span of the automatically-generated one that tracks the work done in `sleepy` + +Connecting manual instrumentation you write in your app with instrumentation generated from a library is essential to get good observability into your apps and services. + +## Available packages + +A full list of instrumentation libraries available can be found in the [OpenTelementry registry](https://opentelemetry.io/registry/?language=go&component=instrumentation). + +## Next steps + +Instrumentation libraries can do things like generate telemtry data for inbound and outbound HTTP requests, but they don't instrument your actual application. + +To get richer telemetry data, use [manual instrumentatiion](manual_instrumentation.md) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. From db762533f99168102943d8aa399f70233e356687 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 14 Dec 2021 12:27:23 -0800 Subject: [PATCH 004/886] Remove unused internal interfaces (#2447) Signed-off-by: Bogdan Drutu --- internal/metric/global/meter.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/internal/metric/global/meter.go b/internal/metric/global/meter.go index 07158d8789d..77781ead118 100644 --- a/internal/metric/global/meter.go +++ b/internal/metric/global/meter.go @@ -92,18 +92,6 @@ type asyncImpl struct { runner sdkapi.AsyncRunner } -// SyncImpler is implemented by all of the sync metric -// instruments. -type SyncImpler interface { - SyncImpl() sdkapi.SyncImpl -} - -// AsyncImpler is implemented by all of the async -// metric instruments. -type AsyncImpler interface { - AsyncImpl() sdkapi.AsyncImpl -} - var _ metric.MeterProvider = &meterProvider{} var _ sdkapi.MeterImpl = &meterImpl{} var _ sdkapi.InstrumentImpl = &syncImpl{} From 44bb795e7885435bd4eba050945f467838aacacc Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Tue, 14 Dec 2021 13:15:53 -0800 Subject: [PATCH 005/886] nit: Change metrics configs to have funcs on pointers (#2451) This avoids copying the whole object, also consistent with trace. Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- metric/config.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metric/config.go b/metric/config.go index 4f856e5677b..686ca7c1acb 100644 --- a/metric/config.go +++ b/metric/config.go @@ -25,12 +25,12 @@ type InstrumentConfig struct { } // Description describes the instrument in human-readable terms. -func (cfg InstrumentConfig) Description() string { +func (cfg *InstrumentConfig) Description() string { return cfg.description } // Unit describes the measurement unit for a instrument. -func (cfg InstrumentConfig) Unit() unit.Unit { +func (cfg *InstrumentConfig) Unit() unit.Unit { return cfg.unit } @@ -78,12 +78,12 @@ type MeterConfig struct { } // InstrumentationVersion is the version of the library providing instrumentation. -func (cfg MeterConfig) InstrumentationVersion() string { +func (cfg *MeterConfig) InstrumentationVersion() string { return cfg.instrumentationVersion } // SchemaURL is the schema_url of the library providing instrumentation. -func (cfg MeterConfig) SchemaURL() string { +func (cfg *MeterConfig) SchemaURL() string { return cfg.schemaURL } From 24aecc561d872d33d96e80ade7a4fcbc6e9b4b97 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Wed, 15 Dec 2021 22:45:53 +0800 Subject: [PATCH 006/886] Update affiliation for Sam Xie (#2458) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd6c1e3ad3c..f25fd9008b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -478,7 +478,7 @@ Approvers: - [Evan Torrie](https://github.com/evantorrie), Verizon Media - [Josh MacDonald](https://github.com/jmacd), LightStep -- [Sam Xie](https://github.com/XSAM) +- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [David Ashpole](https://github.com/dashpole), Google - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep - [Robert Pająk](https://github.com/pellared), Splunk From 8f4a47732f84ec089ac0a2233edbb0e184a28f93 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 15 Dec 2021 07:42:37 -0800 Subject: [PATCH 007/886] nit: Simplify test condition in trace_test.go (#2448) Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- trace_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trace_test.go b/trace_test.go index f7cb2142149..e85488e348d 100644 --- a/trace_test.go +++ b/trace_test.go @@ -17,6 +17,8 @@ package otel import ( "testing" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/internal/trace/noop" "go.opentelemetry.io/otel/trace" ) @@ -36,8 +38,5 @@ func TestMultipleGlobalTracerProvider(t *testing.T) { SetTracerProvider(p2) got := GetTracerProvider() - want := p2 - if got != want { - t.Fatalf("TracerProvider: got %p, want %p\n", got, want) - } + assert.Equal(t, p2, got) } From 4702f6fd6f7a8b5af5f55342685dbf811c5acac7 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 15 Dec 2021 08:01:14 -0800 Subject: [PATCH 008/886] Deprecate and add warning to remove AtomicFieldOffsets, unnecessary public func (#2445) Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/metric/alignment_test.go | 6 +++++- sdk/metric/atomicfields.go | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57c8612379a..95f44bc9930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Deprecate module `"go.opentelemetry.io/otel/sdk/export/metric"`, new functionality available in "go.opentelemetry.io/otel/sdk/metric" module: - Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382). +- Deprecate `AtomicFieldOffsets`, unnecessary public func (#2445) ## [1.3.0] - 2021-12-10 diff --git a/sdk/metric/alignment_test.go b/sdk/metric/alignment_test.go index 1fdc3804c58..e0839aa95ee 100644 --- a/sdk/metric/alignment_test.go +++ b/sdk/metric/alignment_test.go @@ -17,13 +17,17 @@ package metric import ( "os" "testing" + "unsafe" ottest "go.opentelemetry.io/otel/internal/internaltest" ) // Ensure struct alignment prior to running tests. func TestMain(m *testing.M) { - offsets := AtomicFieldOffsets() + offsets := map[string]uintptr{ + "record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value), + "record.updateCount": unsafe.Offsetof(record{}.updateCount), + } var r []ottest.FieldOffset for name, offset := range offsets { r = append(r, ottest.FieldOffset{ diff --git a/sdk/metric/atomicfields.go b/sdk/metric/atomicfields.go index bcb56b7eaa1..7cea2e54374 100644 --- a/sdk/metric/atomicfields.go +++ b/sdk/metric/atomicfields.go @@ -16,6 +16,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import "unsafe" +// Deprecated: will be removed soon. func AtomicFieldOffsets() map[string]uintptr { return map[string]uintptr{ "record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value), From 4654d78104bcea5d2e3dfbdfc07ca1a117249c41 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 15 Dec 2021 08:13:48 -0800 Subject: [PATCH 009/886] Move Aggregator interface to aggregator package (#2444) Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- exporters/otlp/otlpmetric/exporter_test.go | 3 +- .../internal/metrictransform/metric_test.go | 7 +- sdk/export/metric/metric.go | 5 +- sdk/metric/aggregator/aggregator.go | 66 ++++++++++++++++- sdk/metric/aggregator/aggregatortest/test.go | 13 ++-- sdk/metric/aggregator/histogram/histogram.go | 7 +- .../aggregator/histogram/histogram_test.go | 4 +- sdk/metric/aggregator/lastvalue/lastvalue.go | 7 +- .../aggregator/lastvalue/lastvalue_test.go | 6 +- sdk/metric/aggregator/sum/sum.go | 7 +- sdk/metric/aggregator/sum/sum_test.go | 4 +- sdk/metric/correct_test.go | 3 +- sdk/metric/export/metric.go | 72 ++----------------- sdk/metric/processor/basic/basic.go | 5 +- sdk/metric/processor/basic/basic_test.go | 3 +- sdk/metric/processor/processortest/test.go | 9 +-- sdk/metric/sdk.go | 10 +-- sdk/metric/selector/simple/simple.go | 9 +-- sdk/metric/selector/simple/simple_test.go | 5 +- 19 files changed, 125 insertions(+), 120 deletions(-) diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 229d8838e27..cc7d4728461 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -33,6 +33,7 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" @@ -682,7 +683,7 @@ func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource. desc := metrictest.NewDescriptor(r.name, r.iKind, r.nKind) labs := attribute.NewSet(lcopy...) - var agg, ckpt export.Aggregator + var agg, ckpt aggregator.Aggregator if r.iKind.Adding() { sums := sum.New(2) agg, ckpt = &sums[0], &sums[1] diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index e103c3e9c53..0394451b019 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" @@ -241,10 +242,10 @@ func (t *testAgg) Aggregation() aggregation.Aggregation { func (t *testAgg) Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error { return nil } -func (t *testAgg) SynchronizedMove(destination export.Aggregator, descriptor *sdkapi.Descriptor) error { +func (t *testAgg) SynchronizedMove(destination aggregator.Aggregator, descriptor *sdkapi.Descriptor) error { return nil } -func (t *testAgg) Merge(aggregator export.Aggregator, descriptor *sdkapi.Descriptor) error { +func (t *testAgg) Merge(aggregator aggregator.Aggregator, descriptor *sdkapi.Descriptor) error { return nil } @@ -270,7 +271,7 @@ func (te *testErrSum) Kind() aggregation.Kind { return aggregation.SumKind } -var _ export.Aggregator = &testAgg{} +var _ aggregator.Aggregator = &testAgg{} var _ aggregation.Aggregation = &testAgg{} var _ aggregation.Sum = &testErrSum{} var _ aggregation.LastValue = &testErrLastValue{} diff --git a/sdk/export/metric/metric.go b/sdk/export/metric/metric.go index 5da6b3f061f..00d3f67b3bc 100644 --- a/sdk/export/metric/metric.go +++ b/sdk/export/metric/metric.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -26,8 +27,8 @@ import ( // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" type Accumulation = export.Accumulation -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Aggregator = export.Aggregator +// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/aggregator" +type Aggregator = aggregator.Aggregator // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" type AggregatorSelector = export.AggregatorSelector diff --git a/sdk/metric/aggregator/aggregator.go b/sdk/metric/aggregator/aggregator.go index 103c08cfa0b..85d2b3fbdb3 100644 --- a/sdk/metric/aggregator/aggregator.go +++ b/sdk/metric/aggregator/aggregator.go @@ -15,19 +15,81 @@ package aggregator // import "go.opentelemetry.io/otel/sdk/metric/aggregator" import ( + "context" "fmt" "math" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) +// Aggregator implements a specific aggregation behavior, e.g., a +// behavior to track a sequence of updates to an instrument. Counter +// instruments commonly use a simple Sum aggregator, but for the +// distribution instruments (Histogram, GaugeObserver) there are a +// number of possible aggregators with different cost and accuracy +// tradeoffs. +// +// Note that any Aggregator may be attached to any instrument--this is +// the result of the OpenTelemetry API/SDK separation. It is possible +// to attach a Sum aggregator to a Histogram instrument. +type Aggregator interface { + // Aggregation returns an Aggregation interface to access the + // current state of this Aggregator. The caller is + // responsible for synchronization and must not call any the + // other methods in this interface concurrently while using + // the Aggregation. + Aggregation() aggregation.Aggregation + + // Update receives a new measured value and incorporates it + // into the aggregation. Update() calls may be called + // concurrently. + // + // Descriptor.NumberKind() should be consulted to determine + // whether the provided number is an int64 or float64. + // + // The Context argument comes from user-level code and could be + // inspected for a `correlation.Map` or `trace.SpanContext`. + Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error + + // SynchronizedMove is called during collection to finish one + // period of aggregation by atomically saving the + // currently-updating state into the argument Aggregator AND + // resetting the current value to the zero state. + // + // SynchronizedMove() is called concurrently with Update(). These + // two methods must be synchronized with respect to each + // other, for correctness. + // + // After saving a synchronized copy, the Aggregator can be converted + // into one or more of the interfaces in the `aggregation` sub-package, + // according to kind of Aggregator that was selected. + // + // This method will return an InconsistentAggregatorError if + // this Aggregator cannot be copied into the destination due + // to an incompatible type. + // + // This call has no Context argument because it is expected to + // perform only computation. + // + // When called with a nil `destination`, this Aggregator is reset + // and the current value is discarded. + SynchronizedMove(destination Aggregator, descriptor *sdkapi.Descriptor) error + + // Merge combines the checkpointed state from the argument + // Aggregator into this Aggregator. Merge is not synchronized + // with respect to Update or SynchronizedMove. + // + // The owner of an Aggregator being merged is responsible for + // synchronization of both Aggregator states. + Merge(aggregator Aggregator, descriptor *sdkapi.Descriptor) error +} + // NewInconsistentAggregatorError formats an error describing an attempt to // Checkpoint or Merge different-type aggregators. The result can be unwrapped as // an ErrInconsistentType. -func NewInconsistentAggregatorError(a1, a2 export.Aggregator) error { +func NewInconsistentAggregatorError(a1, a2 Aggregator) error { return fmt.Errorf("%w: %T and %T", aggregation.ErrInconsistentType, a1, a2) } diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go index 48b92ec9c7e..2d2a197e635 100644 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ b/sdk/metric/aggregator/aggregatortest/test.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -44,7 +43,7 @@ type Profile struct { type NoopAggregator struct{} type NoopAggregation struct{} -var _ export.Aggregator = NoopAggregator{} +var _ aggregator.Aggregator = NoopAggregator{} var _ aggregation.Aggregation = NoopAggregation{} func newProfiles() []Profile { @@ -150,7 +149,7 @@ func (n *Numbers) Points() []number.Number { } // CheckedUpdate performs the same range test the SDK does on behalf of the aggregator. -func CheckedUpdate(t *testing.T, agg export.Aggregator, number number.Number, descriptor *sdkapi.Descriptor) { +func CheckedUpdate(t *testing.T, agg aggregator.Aggregator, number number.Number, descriptor *sdkapi.Descriptor) { ctx := context.Background() // Note: Aggregator tests are written assuming that the SDK @@ -166,7 +165,7 @@ func CheckedUpdate(t *testing.T, agg export.Aggregator, number number.Number, de } } -func CheckedMerge(t *testing.T, aggInto, aggFrom export.Aggregator, descriptor *sdkapi.Descriptor) { +func CheckedMerge(t *testing.T, aggInto, aggFrom aggregator.Aggregator, descriptor *sdkapi.Descriptor) { if err := aggInto.Merge(aggFrom, descriptor); err != nil { t.Error("Unexpected Merge failure", err) } @@ -184,15 +183,15 @@ func (NoopAggregator) Update(context.Context, number.Number, *sdkapi.Descriptor) return nil } -func (NoopAggregator) SynchronizedMove(export.Aggregator, *sdkapi.Descriptor) error { +func (NoopAggregator) SynchronizedMove(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } -func (NoopAggregator) Merge(export.Aggregator, *sdkapi.Descriptor) error { +func (NoopAggregator) Merge(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } -func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf func(*sdkapi.Descriptor) export.Aggregator) { +func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf func(*sdkapi.Descriptor) aggregator.Aggregator) { t.Run("reset on nil", func(t *testing.T) { // Ensures that SynchronizedMove(nil, descriptor) discards and // resets the aggregator. diff --git a/sdk/metric/aggregator/histogram/histogram.go b/sdk/metric/aggregator/histogram/histogram.go index 888c985ce3e..142ca24ebef 100644 --- a/sdk/metric/aggregator/histogram/histogram.go +++ b/sdk/metric/aggregator/histogram/histogram.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -97,7 +96,7 @@ var defaultInt64ExplicitBoundaries = func(bounds []float64) (asint []float64) { return }(defaultFloat64ExplicitBoundaries) -var _ export.Aggregator = &Aggregator{} +var _ aggregator.Aggregator = &Aggregator{} var _ aggregation.Sum = &Aggregator{} var _ aggregation.Count = &Aggregator{} var _ aggregation.Histogram = &Aggregator{} @@ -174,7 +173,7 @@ func (c *Aggregator) Histogram() (aggregation.Buckets, error) { // the empty set. Since no locks are taken, there is a chance that // the independent Sum, Count and Bucket Count are not consistent with each // other. -func (c *Aggregator) SynchronizedMove(oa export.Aggregator, desc *sdkapi.Descriptor) error { +func (c *Aggregator) SynchronizedMove(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { o, _ := oa.(*Aggregator) if oa != nil && o == nil { @@ -254,7 +253,7 @@ func (c *Aggregator) Update(_ context.Context, number number.Number, desc *sdkap } // Merge combines two histograms that have the same buckets into a single one. -func (c *Aggregator) Merge(oa export.Aggregator, desc *sdkapi.Descriptor) error { +func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { o, _ := oa.(*Aggregator) if o == nil { return aggregator.NewInconsistentAggregatorError(c, oa) diff --git a/sdk/metric/aggregator/histogram/histogram_test.go b/sdk/metric/aggregator/histogram/histogram_test.go index 2d09edbfdc9..00acf2e772d 100644 --- a/sdk/metric/aggregator/histogram/histogram_test.go +++ b/sdk/metric/aggregator/histogram/histogram_test.go @@ -25,9 +25,9 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/export" ) const count = 100 @@ -240,7 +240,7 @@ func TestSynchronizedMoveReset(t *testing.T) { aggregatortest.SynchronizedMoveResetTest( t, sdkapi.HistogramInstrumentKind, - func(desc *sdkapi.Descriptor) export.Aggregator { + func(desc *sdkapi.Descriptor) aggregator.Aggregator { return &histogram.New(1, desc, histogram.WithExplicitBoundaries(testBoundaries))[0] }, ) diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go index 4a1da706062..59a7ac8236a 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -51,7 +50,7 @@ type ( } ) -var _ export.Aggregator = &Aggregator{} +var _ aggregator.Aggregator = &Aggregator{} var _ aggregation.LastValue = &Aggregator{} // An unset lastValue has zero timestamp and zero value. @@ -92,7 +91,7 @@ func (g *Aggregator) LastValue() (number.Number, time.Time, error) { } // SynchronizedMove atomically saves the current value. -func (g *Aggregator) SynchronizedMove(oa export.Aggregator, _ *sdkapi.Descriptor) error { +func (g *Aggregator) SynchronizedMove(oa aggregator.Aggregator, _ *sdkapi.Descriptor) error { if oa == nil { atomic.StorePointer(&g.value, unsafe.Pointer(unsetLastValue)) return nil @@ -117,7 +116,7 @@ func (g *Aggregator) Update(_ context.Context, number number.Number, desc *sdkap // Merge combines state from two aggregators. The most-recently set // value is chosen. -func (g *Aggregator) Merge(oa export.Aggregator, desc *sdkapi.Descriptor) error { +func (g *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { o, _ := oa.(*Aggregator) if o == nil { return aggregator.NewInconsistentAggregatorError(g, oa) diff --git a/sdk/metric/aggregator/lastvalue/lastvalue_test.go b/sdk/metric/aggregator/lastvalue/lastvalue_test.go index bdfe6a65bd4..3d105a75cd2 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue_test.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue_test.go @@ -27,14 +27,14 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) const count = 100 -var _ export.Aggregator = &Aggregator{} +var _ aggregator.Aggregator = &Aggregator{} // Ensure struct alignment prior to running tests. func TestMain(m *testing.M) { @@ -139,7 +139,7 @@ func TestSynchronizedMoveReset(t *testing.T) { aggregatortest.SynchronizedMoveResetTest( t, sdkapi.GaugeObserverInstrumentKind, - func(desc *sdkapi.Descriptor) export.Aggregator { + func(desc *sdkapi.Descriptor) aggregator.Aggregator { return &New(1)[0] }, ) diff --git a/sdk/metric/aggregator/sum/sum.go b/sdk/metric/aggregator/sum/sum.go index d048e9bc253..be3c6dfff89 100644 --- a/sdk/metric/aggregator/sum/sum.go +++ b/sdk/metric/aggregator/sum/sum.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -31,7 +30,7 @@ type Aggregator struct { value number.Number } -var _ export.Aggregator = &Aggregator{} +var _ aggregator.Aggregator = &Aggregator{} var _ aggregation.Sum = &Aggregator{} // New returns a new counter aggregator implemented by atomic @@ -59,7 +58,7 @@ func (c *Aggregator) Sum() (number.Number, error) { // SynchronizedMove atomically saves the current value into oa and resets the // current sum to zero. -func (c *Aggregator) SynchronizedMove(oa export.Aggregator, _ *sdkapi.Descriptor) error { +func (c *Aggregator) SynchronizedMove(oa aggregator.Aggregator, _ *sdkapi.Descriptor) error { if oa == nil { c.value.SetRawAtomic(0) return nil @@ -79,7 +78,7 @@ func (c *Aggregator) Update(_ context.Context, num number.Number, desc *sdkapi.D } // Merge combines two counters by adding their sums. -func (c *Aggregator) Merge(oa export.Aggregator, desc *sdkapi.Descriptor) error { +func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { o, _ := oa.(*Aggregator) if o == nil { return aggregator.NewInconsistentAggregatorError(c, oa) diff --git a/sdk/metric/aggregator/sum/sum_test.go b/sdk/metric/aggregator/sum/sum_test.go index da614d83f49..59480e2c8cc 100644 --- a/sdk/metric/aggregator/sum/sum_test.go +++ b/sdk/metric/aggregator/sum/sum_test.go @@ -24,8 +24,8 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/export" ) const count = 100 @@ -147,7 +147,7 @@ func TestSynchronizedMoveReset(t *testing.T) { aggregatortest.SynchronizedMoveResetTest( t, sdkapi.CounterObserverInstrumentKind, - func(desc *sdkapi.Descriptor) export.Aggregator { + func(desc *sdkapi.Descriptor) aggregator.Aggregator { return &New(1)[0] }, ) diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index f5fd7ea814f..25e7fc60875 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/sdkapi" metricsdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" @@ -72,7 +73,7 @@ type testSelector struct { newAggCount int } -func (ts *testSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*export.Aggregator) { +func (ts *testSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { ts.newAggCount += len(aggPtrs) processortest.AggregatorSelector().AggregatorFor(desc, aggPtrs...) } diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go index 46a809a354f..5251a059e1a 100644 --- a/sdk/metric/export/metric.go +++ b/sdk/metric/export/metric.go @@ -20,9 +20,9 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" ) @@ -94,7 +94,7 @@ type AggregatorSelector interface { // Note: This is context-free because the aggregator should // not relate to the incoming context. This call should not // block. - AggregatorFor(descriptor *sdkapi.Descriptor, aggregator ...*Aggregator) + AggregatorFor(descriptor *sdkapi.Descriptor, aggregator ...*aggregator.Aggregator) } // Checkpointer is the interface used by a Controller to coordinate @@ -130,68 +130,6 @@ type CheckpointerFactory interface { NewCheckpointer() Checkpointer } -// Aggregator implements a specific aggregation behavior, e.g., a -// behavior to track a sequence of updates to an instrument. Counter -// instruments commonly use a simple Sum aggregator, but for the -// distribution instruments (Histogram, GaugeObserver) there are a -// number of possible aggregators with different cost and accuracy -// tradeoffs. -// -// Note that any Aggregator may be attached to any instrument--this is -// the result of the OpenTelemetry API/SDK separation. It is possible -// to attach a Sum aggregator to a Histogram instrument. -type Aggregator interface { - // Aggregation returns an Aggregation interface to access the - // current state of this Aggregator. The caller is - // responsible for synchronization and must not call any the - // other methods in this interface concurrently while using - // the Aggregation. - Aggregation() aggregation.Aggregation - - // Update receives a new measured value and incorporates it - // into the aggregation. Update() calls may be called - // concurrently. - // - // Descriptor.NumberKind() should be consulted to determine - // whether the provided number is an int64 or float64. - // - // The Context argument comes from user-level code and could be - // inspected for a `correlation.Map` or `trace.SpanContext`. - Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error - - // SynchronizedMove is called during collection to finish one - // period of aggregation by atomically saving the - // currently-updating state into the argument Aggregator AND - // resetting the current value to the zero state. - // - // SynchronizedMove() is called concurrently with Update(). These - // two methods must be synchronized with respect to each - // other, for correctness. - // - // After saving a synchronized copy, the Aggregator can be converted - // into one or more of the interfaces in the `aggregation` sub-package, - // according to kind of Aggregator that was selected. - // - // This method will return an InconsistentAggregatorError if - // this Aggregator cannot be copied into the destination due - // to an incompatible type. - // - // This call has no Context argument because it is expected to - // perform only computation. - // - // When called with a nil `destination`, this Aggregator is reset - // and the current value is discarded. - SynchronizedMove(destination Aggregator, descriptor *sdkapi.Descriptor) error - - // Merge combines the checkpointed state from the argument - // Aggregator into this Aggregator. Merge is not synchronized - // with respect to Update or SynchronizedMove. - // - // The owner of an Aggregator being merged is responsible for - // synchronization of both Aggregator states. - Merge(aggregator Aggregator, descriptor *sdkapi.Descriptor) error -} - // Exporter handles presentation of the checkpoint of aggregate // metrics. This is the final stage of a metrics export pipeline, // where metric data are formatted for a specific system. @@ -267,7 +205,7 @@ type Metadata struct { // and label set, as prepared by an Accumulator for the Processor. type Accumulation struct { Metadata - aggregator Aggregator + aggregator aggregator.Aggregator } // Record contains the exported data for a single metric instrument @@ -295,7 +233,7 @@ func (m Metadata) Labels() *attribute.Set { // Accumulations to send to Processors. The Descriptor, Labels, // and Aggregator represent aggregate metric events received over a single // collection period. -func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator Aggregator) Accumulation { +func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator aggregator.Aggregator) Accumulation { return Accumulation{ Metadata: Metadata{ descriptor: descriptor, @@ -307,7 +245,7 @@ func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggre // Aggregator returns the checkpointed aggregator. It is safe to // access the checkpointed state without locking. -func (r Accumulation) Aggregator() Aggregator { +func (r Accumulation) Aggregator() aggregator.Aggregator { return r.aggregator } diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index c86af124bb3..08912da0308 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -74,12 +75,12 @@ type ( // (if !currentOwned) or it refers to an Aggregator // owned by the processor used to accumulate multiple // values in a single collection round. - current export.Aggregator + current aggregator.Aggregator // cumulative, if non-nil, refers to an Aggregator owned // by the processor used to store the last cumulative // value. - cumulative export.Aggregator + cumulative aggregator.Aggregator } state struct { diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go index 482a82a2efd..1378bf60d6e 100644 --- a/sdk/metric/processor/basic/basic_test.go +++ b/sdk/metric/processor/basic/basic_test.go @@ -31,6 +31,7 @@ import ( "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" sdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" @@ -110,7 +111,7 @@ func asNumber(nkind number.Kind, value int64) number.Number { func updateFor(t *testing.T, desc *sdkapi.Descriptor, selector export.AggregatorSelector, value int64, labs ...attribute.KeyValue) export.Accumulation { ls := attribute.NewSet(labs...) - var agg export.Aggregator + var agg aggregator.Aggregator selector.AggregatorFor(desc, &agg) require.NoError(t, agg.Update(context.Background(), asNumber(desc.NumberKind(), value), desc)) diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index 840af80acf7..6dbad262489 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" @@ -47,7 +48,7 @@ type ( mapValue struct { labels *attribute.Set resource *resource.Resource - aggregator export.Aggregator + aggregator aggregator.Aggregator } // Output implements export.Reader. @@ -178,7 +179,7 @@ func AggregatorSelector() export.AggregatorSelector { } // AggregatorFor implements export.AggregatorSelector. -func (testAggregatorSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*export.Aggregator) { +func (testAggregatorSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { switch { case strings.HasSuffix(desc.Name(), ".disabled"): @@ -251,7 +252,7 @@ func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource resource: res.Equivalent(), } if _, ok := o.m[key]; !ok { - var agg export.Aggregator + var agg aggregator.Aggregator testAggregatorSelector{}.AggregatorFor(rec.Descriptor(), &agg) o.m[key] = mapValue{ aggregator: agg, @@ -259,7 +260,7 @@ func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource resource: res, } } - return o.m[key].aggregator.Merge(rec.Aggregation().(export.Aggregator), rec.Descriptor()) + return o.m[key].aggregator.Merge(rec.Aggregation().(aggregator.Aggregator), rec.Descriptor()) } // Map returns the calculated values for test validation from a set of diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go index 97e0d852dcd..a043342627b 100644 --- a/sdk/metric/sdk.go +++ b/sdk/metric/sdk.go @@ -114,8 +114,8 @@ type ( // current implements the actual RecordOne() API, // depending on the type of aggregation. If nil, the // metric was disabled by the exporter. - current export.Aggregator - checkpoint export.Aggregator + current aggregator.Aggregator + checkpoint aggregator.Aggregator } instrument struct { @@ -133,7 +133,7 @@ type ( labeledRecorder struct { observedEpoch int64 labels *attribute.Set - observed export.Aggregator + observed aggregator.Aggregator } ) @@ -175,7 +175,7 @@ func (a *asyncInstrument) observe(num number.Number, labels *attribute.Set) { } } -func (a *asyncInstrument) getRecorder(labels *attribute.Set) export.Aggregator { +func (a *asyncInstrument) getRecorder(labels *attribute.Set) aggregator.Aggregator { lrec, ok := a.recorders[labels.Equivalent()] if ok { // Note: SynchronizedMove(nil) can't return an error @@ -184,7 +184,7 @@ func (a *asyncInstrument) getRecorder(labels *attribute.Set) export.Aggregator { a.recorders[labels.Equivalent()] = lrec return lrec.observed } - var rec export.Aggregator + var rec aggregator.Aggregator a.meter.processor.AggregatorFor(&a.descriptor, &rec) if a.recorders == nil { a.recorders = make(map[attribute.Distinct]*labeledRecorder) diff --git a/sdk/metric/selector/simple/simple.go b/sdk/metric/selector/simple/simple.go index 5a8d9a23b04..5b3e1c5fd5e 100644 --- a/sdk/metric/selector/simple/simple.go +++ b/sdk/metric/selector/simple/simple.go @@ -16,6 +16,7 @@ package simple // import "go.opentelemetry.io/otel/sdk/metric/selector/simple" import ( "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" @@ -50,21 +51,21 @@ func NewWithHistogramDistribution(options ...histogram.Option) export.Aggregator return selectorHistogram{options: options} } -func sumAggs(aggPtrs []*export.Aggregator) { +func sumAggs(aggPtrs []*aggregator.Aggregator) { aggs := sum.New(len(aggPtrs)) for i := range aggPtrs { *aggPtrs[i] = &aggs[i] } } -func lastValueAggs(aggPtrs []*export.Aggregator) { +func lastValueAggs(aggPtrs []*aggregator.Aggregator) { aggs := lastvalue.New(len(aggPtrs)) for i := range aggPtrs { *aggPtrs[i] = &aggs[i] } } -func (selectorInexpensive) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*export.Aggregator) { +func (selectorInexpensive) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { switch descriptor.InstrumentKind() { case sdkapi.GaugeObserverInstrumentKind: lastValueAggs(aggPtrs) @@ -78,7 +79,7 @@ func (selectorInexpensive) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs } } -func (s selectorHistogram) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*export.Aggregator) { +func (s selectorHistogram) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { switch descriptor.InstrumentKind() { case sdkapi.GaugeObserverInstrumentKind: lastValueAggs(aggPtrs) diff --git a/sdk/metric/selector/simple/simple_test.go b/sdk/metric/selector/simple/simple_test.go index e47f3439414..a25291b5112 100644 --- a/sdk/metric/selector/simple/simple_test.go +++ b/sdk/metric/selector/simple/simple_test.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/metric/metrictest" "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" @@ -38,8 +39,8 @@ var ( testGaugeObserverDesc = metrictest.NewDescriptor("gauge", sdkapi.GaugeObserverInstrumentKind, number.Int64Kind) ) -func oneAgg(sel export.AggregatorSelector, desc *sdkapi.Descriptor) export.Aggregator { - var agg export.Aggregator +func oneAgg(sel export.AggregatorSelector, desc *sdkapi.Descriptor) aggregator.Aggregator { + var agg aggregator.Aggregator sel.AggregatorFor(desc, &agg) return agg } From 134a6104409da8fb873d86b91b7a7c313886e1bd Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Thu, 16 Dec 2021 14:22:53 -0600 Subject: [PATCH 010/886] Fixes because of removal of exact type. (#2459) Co-authored-by: Aaron Clawson Co-authored-by: Anthony Mirabella --- sdk/metric/benchmark_test.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index eb89f54b330..c4ecf306293 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -230,11 +230,11 @@ func BenchmarkFloat64LastValueAdd(b *testing.B) { // Histograms -func benchmarkInt64HistogramAdd(b *testing.B, name string) { +func BenchmarkInt64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewInt64Histogram(name) + mea := fix.meterMust().NewInt64Histogram("int64.histogram") b.ResetTimer() @@ -243,11 +243,11 @@ func benchmarkInt64HistogramAdd(b *testing.B, name string) { } } -func benchmarkFloat64HistogramAdd(b *testing.B, name string) { +func BenchmarkFloat64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewFloat64Histogram(name) + mea := fix.meterMust().NewFloat64Histogram("float64.histogram") b.ResetTimer() @@ -303,16 +303,6 @@ func BenchmarkGaugeObserverObservationFloat64(b *testing.B) { fix.accumulator.Collect(ctx) } -// Exact - -func BenchmarkInt64ExactAdd(b *testing.B) { - benchmarkInt64HistogramAdd(b, "int64.exact") -} - -func BenchmarkFloat64ExactAdd(b *testing.B) { - benchmarkFloat64HistogramAdd(b, "float64.exact") -} - // BatchRecord func benchmarkBatchRecord8Labels(b *testing.B, numInst int) { From 7aba6f796f9882d2512da8442c181a3dac3e5419 Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Tue, 21 Dec 2021 00:10:34 +0800 Subject: [PATCH 011/886] update wrong doc comment with attribute value (#2476) --- attribute/value.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attribute/value.go b/attribute/value.go index 545bea50c9d..6ec5cb290df 100644 --- a/attribute/value.go +++ b/attribute/value.go @@ -187,7 +187,7 @@ func (v Value) AsFloat64() float64 { } // AsFloat64Slice returns the []float64 value. Make sure that the Value's type is -// INT64SLICE. +// FLOAT64SLICE. func (v Value) AsFloat64Slice() []float64 { if s, ok := v.slice.(*[]float64); ok { return *s @@ -202,7 +202,7 @@ func (v Value) AsString() string { } // AsStringSlice returns the []string value. Make sure that the Value's type is -// INT64SLICE. +// STRINGSLICE. func (v Value) AsStringSlice() []string { if s, ok := v.slice.(*[]string); ok { return *s From 8849597744d4c8ee278cff061f602c5f1824f3ae Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 20 Dec 2021 10:54:44 -0600 Subject: [PATCH 012/886] Dependabot bump (#2477) * Bump github.com/go-logr/stdr from 1.2.0 to 1.2.2 Bumps [github.com/go-logr/stdr](https://github.com/go-logr/stdr) from 1.2.0 to 1.2.2. - [Release notes](https://github.com/go-logr/stdr/releases) - [Commits](https://github.com/go-logr/stdr/compare/v1.2.0...v1.2.2) --- updated-dependencies: - dependency-name: github.com/go-logr/stdr dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/go-logr/logr from 1.2.1 to 1.2.2 Bumps [github.com/go-logr/logr](https://github.com/go-logr/logr) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/go-logr/logr/releases) - [Changelog](https://github.com/go-logr/logr/blob/master/CHANGELOG.md) - [Commits](https://github.com/go-logr/logr/compare/v1.2.1...v1.2.2) --- updated-dependencies: - dependency-name: github.com/go-logr/logr dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump github.com/go-logr/stdr from 1.2.0 to 1.2.2 in /example/namedtracer Bumps [github.com/go-logr/stdr](https://github.com/go-logr/stdr) from 1.2.0 to 1.2.2. - [Release notes](https://github.com/go-logr/stdr/releases) - [Commits](https://github.com/go-logr/stdr/compare/v1.2.0...v1.2.2) --- updated-dependencies: - dependency-name: github.com/go-logr/stdr dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump google.golang.org/grpc in /example/otel-collector Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric/otlpmetricgrpc Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump google.golang.org/grpc in /exporters/otlp/otlptrace/otlptracegrpc Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- bridge/opencensus/go.sum | 9 ++++----- bridge/opencensus/test/go.sum | 9 ++++----- bridge/opentracing/go.sum | 9 ++++----- example/fib/go.sum | 9 ++++----- example/jaeger/go.sum | 9 ++++----- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 9 ++++----- example/opencensus/go.sum | 9 ++++----- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 12 ++++++------ example/otel-collector/main.go | 3 ++- example/passthrough/go.sum | 9 ++++----- example/prometheus/go.sum | 9 ++++----- example/zipkin/go.sum | 9 ++++----- exporters/jaeger/go.sum | 9 ++++----- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 12 ++++++------ .../otlp/otlpmetric/internal/otlpconfig/options.go | 3 ++- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 12 ++++++------ exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 12 ++++++------ .../otlp/otlptrace/internal/otlpconfig/options.go | 3 ++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.sum | 12 ++++++------ exporters/prometheus/go.sum | 9 ++++----- exporters/stdout/stdoutmetric/go.sum | 9 ++++----- exporters/stdout/stdouttrace/go.sum | 9 ++++----- exporters/zipkin/go.sum | 9 ++++----- go.mod | 4 ++-- go.sum | 9 ++++----- internal/metric/go.sum | 9 ++++----- metric/go.sum | 9 ++++----- sdk/export/metric/go.sum | 9 ++++----- sdk/go.sum | 9 ++++----- sdk/metric/go.sum | 9 ++++----- trace/go.sum | 5 ++--- 39 files changed, 142 insertions(+), 161 deletions(-) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 242e03d1811..def7312910b 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -5,11 +5,10 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 98de6849410..b23e0c300c7 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -11,11 +11,10 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index df3b15e6af1..f3e322dee84 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= diff --git a/example/fib/go.sum b/example/fib/go.sum index f550e8d32f9..8c51f62e82b 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 75667504dbd..3ebf1b74f6d 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 1b9a5334ad8..a9452a19c75 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/go-logr/stdr v1.2.0 + github.com/go-logr/stdr v1.2.2 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index f550e8d32f9..8c51f62e82b 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 4bf4049d11e..66d4f9fb724 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -5,11 +5,10 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 852b9e1c29e..7391dc1dd97 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 - google.golang.org/grpc v1.42.0 + google.golang.org/grpc v1.43.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 3da5242722d..5bc4c7e9965 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -22,11 +22,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -135,8 +134,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index d9246004975..61a0d2b5ca9 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -24,6 +24,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -53,7 +54,7 @@ func initProvider() func() { // `localhost:30080` endpoint. Otherwise, replace `localhost` with the // endpoint of your cluster. If you run the app inside k8s, then you can // probably connect directly to the service through dns - conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithInsecure(), grpc.WithBlock()) + conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) handleErr(err, "failed to create gRPC connection to collector") // Set up a trace exporter diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index f550e8d32f9..8c51f62e82b 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 6f9c6f28028..3650cf21855 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -21,11 +21,10 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 6a383ef749a..a7605e72a1f 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -29,11 +29,10 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 04abb686318..7d3e827c100 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 93d3ff6a2be..9459b0376db 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/proto/otlp v0.11.0 - google.golang.org/grpc v1.42.0 + google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 31b24cd6e48..024a53e2a79 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -24,11 +24,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -115,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go index afae071f7c8..8cfbc7dfcf8 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go @@ -22,6 +22,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" @@ -101,7 +102,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Metrics.GRPCCredentials != nil { cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials)) } else if cfg.Metrics.Insecure { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithInsecure()) + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) } else { // Default to using the host's root CA. creds := credentials.NewTLS(nil) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e87808fce24..dd959445002 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/proto/otlp v0.11.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.42.0 + google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 31b24cd6e48..024a53e2a79 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -24,11 +24,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -115,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 31b24cd6e48..024a53e2a79 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -24,11 +24,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -115,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 03d3eddc9af..ffc119b105e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 go.opentelemetry.io/proto/otlp v0.11.0 - google.golang.org/grpc v1.42.0 + google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 154c315443e..dd5774c4dc0 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -22,11 +22,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -113,8 +112,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 47c0344c62c..2af734a9de8 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -22,6 +22,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/backoff" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" @@ -94,7 +95,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Traces.GRPCCredentials != nil { cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials)) } else if cfg.Traces.Insecure { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithInsecure()) + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) } else { // Default to using the host's root CA. creds := credentials.NewTLS(nil) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8a783f5ffc5..53210f0137a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.11.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.42.0 + google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 1e6992c36ed..e251c34b04f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -22,11 +22,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -139,8 +138,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 154c315443e..dd5774c4dc0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -22,11 +22,10 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -113,8 +112,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index aca5dcc5ee3..a825f37d2ad 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -21,11 +21,10 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index a4acc8a9b04..22190692ec3 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -2,11 +2,10 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 7c328dde18e..495c139cc93 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index b69dcb4d218..3a42504f5c7 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -29,11 +29,10 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= diff --git a/go.mod b/go.mod index ee17695df58..2223957fa0d 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module go.opentelemetry.io/otel go 1.16 require ( - github.com/go-logr/logr v1.2.1 - github.com/go-logr/stdr v1.2.0 + github.com/go-logr/logr v1.2.2 + github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.6 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel/trace v1.3.0 diff --git a/go.sum b/go.sum index eebdae0c23e..1b1fdc6e060 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/internal/metric/go.sum b/internal/metric/go.sum index 094bf423f68..934370ffef9 100644 --- a/internal/metric/go.sum +++ b/internal/metric/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/metric/go.sum b/metric/go.sum index eebdae0c23e..1b1fdc6e060 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/sdk/export/metric/go.sum b/sdk/export/metric/go.sum index a5e093f7231..88877a08cf1 100644 --- a/sdk/export/metric/go.sum +++ b/sdk/export/metric/go.sum @@ -1,11 +1,10 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/sdk/go.sum b/sdk/go.sum index ff5b32d74aa..dc32dbd6c8d 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,10 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index a4acc8a9b04..22190692ec3 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -2,11 +2,10 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/trace/go.sum b/trace/go.sum index 5615ed1b5ba..77c421b16f1 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,8 +1,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= From 69326eaef8a571a6159a1747242e643f592d56bc Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 20 Dec 2021 14:00:14 -0800 Subject: [PATCH 013/886] Add sections to docs for current span and nested spans (#2452) * Add sections to docs for current span and nested spans * Apply suggestions from code review Co-authored-by: Anthony Mirabella * Update based on review * satisfy linter * Apply suggestions from code review Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- website_docs/manual_instrumentation.md | 74 ++++++++++++++++++-------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/website_docs/manual_instrumentation.md b/website_docs/manual_instrumentation.md index 92d7d2f3a76..8438d36e1eb 100644 --- a/website_docs/manual_instrumentation.md +++ b/website_docs/manual_instrumentation.md @@ -5,42 +5,68 @@ weight: 3 Instrumentation is the process of adding observability code to your application. There are two general types of instrumentation - automatic, and manual - and you should be familiar with both in order to effectively instrument your software. -# Creating Spans +## Creating Spans -Spans are created by tracers, which can be acquired from a Tracer Provider. +Spans are created by tracers, which can be acquired from a Tracer Provider. Typically a tracer is instantiated at the module level. + +To create a span with a tracer, you'll also need a handle on a `context.Context` instance. These will typically come from things like a request object and may already contain a parent span from an [instrumentation library][]. ```go -ctx := context.Background() -tracer := otel.Tracer("example/main") -var span trace.Span -ctx, span = tracer.Start(ctx, "helloWorld") -defer span.End() +func httpHandler(w http.ResponseWriter, r *http.Request) { + ctx, span := tracer.Start(r.Context(), "hello-span") + defer span.End() + + // do some work to track with hello-span +} ``` -In Go, the `context` package is used to store the active span. When you start a span, you'll get a handle on not only the span that's created, but the modified context that contains it. When starting a new span using this context, a parent-child relationship will automatically be created between the two spans, as seen here: +In Go, the `context` package is used to store the active span. When you start a span, you'll get a handle on not only the span that's created, but the modified context that contains it. + +Once a span has completed, it is immutable and can no longer be modified. + +### Get the current span + +To get the current span, you'll need to pull it out of a `context.Context` you have a handle on: ```go -func parentFunction() { - ctx := context.Background() - var parentSpan trace.Span - ctx, parentSpan = tracer.Start(ctx, "parent") +// This context needs contain the active span you plan to extract. +ctx := context.TODO() +span := trace.SpanFromContext(ctx) + +// Do something with the current span, optionally calling `span.End()` if you want it to end +``` + +This can helpful if you'd like to add information to the current span at a point in time. + +### Create nested spans + +You can create a nested span to track work in a nested operation. + +If the current `context.Context` you have a handle on already contains a span inside of it, creating a new span makes it a nested span. For example: + +```go +func parentFunction(ctx context.Context) { + ctx, parentSpan := tracer.Start(ctx, "parent") defer parentSpan.End() - // call our child function + + // call the child function and start a nested span in there childFunction(ctx) - // do more work, when this function ends, parentSpan will complete. + + // do more work - when this function ends, parentSpan will complete. } func childFunction(ctx context.Context) { - var childSpan trace.Span - ctx, childSpan = tracer.Start(ctx, "child") + // Create a span to track `childFunction()` - this is a nested span whose parent is `parentSpan` + ctx, childSpan := tracer.Start(ctx, "child") defer childSpan.End() + // do work here, when this function returns, childSpan will complete. } ``` Once a span has completed, it is immutable and can no longer be modified. -## Attributes +### Span Attributes Attributes are keys and values that are applied as metadata to your spans and are useful for aggregating, filtering, and grouping traces. Attributes can be added at span creation, or at any other time during the lifecycle of a span before it has completed. @@ -51,20 +77,20 @@ ctx, span = tracer.Start(ctx, "attributesAtCreation", trace.WithAttributes(attri span.SetAttributes(attribute.Bool("isTrue", true), attribute.String("stringAttr", "hi!")) ``` -Attribute keys can be precomputed, as well - +Attribute keys can be precomputed, as well: ```go var myKey = attribute.Key("myCoolAttribute") span.SetAttributes(myKey.String("a value")) ``` -### Semantic Attributes +#### Semantic Attributes Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.7.0` package. For details, see [Trace semantic conventions][]. -## Events +### Events An event is a human-readable message on a span that represents "something happening" during it's lifetime. For example, imagine a function that requires exclusive access to a resource that is under a mutex. An event could be created at two points - once, when we try to gain access to the resource, and another when we acquire the mutex. @@ -85,11 +111,11 @@ Events can also have attributes of their own - span.AddEvent("Cancelled wait due to external signal", trace.WithAttributes(attribute.Int("pid", 4328), attribute.String("signal", "SIGHUP"))) ``` -# Creating Metrics +## Creating Metrics The metrics API is currently unstable, documentation TBA. -# Propagators and Context +## Propagators and Context Traces can extend beyond a single process. This requires _context propagation_, a mechanism where identifiers for a trace are sent to remote processes. @@ -107,3 +133,7 @@ otel.SetTextMapPropagator(propagation.TraceContext{}) > OpenTelemetry also supports the B3 header format, for compatibility with existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that do not support the W3C TraceContext standard. After configuring context propagation, you'll most likely want to use automatic instrumentation to handle the behind-the-scenes work of actually managing serializing the context. + +[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}} +[Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}} +[instrumentation library]: using_instrumentation_libraries From 1e46549f61312a8389eb8ab34ffd133372036869 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 21 Dec 2021 08:33:35 -0800 Subject: [PATCH 014/886] Update relref link for manual instrumentation (#2478) Looks like this was missed in https://github.com/open-telemetry/opentelemetry-go/pull/2437 --- website_docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 6053bda1325..24cf5880a15 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -536,7 +536,7 @@ start adding OpenTelemetry Go to your projects at this point. Go instrument your code! For more information about instrumenting your code and things you can do with -spans, refer to the [Instrumenting]({{< relref "instrumentation" >}}) +spans, refer to the [Instrumenting]({{< relref "manual_instrumentation" >}}) documentation. Likewise, advanced topics about processing and exporting telemetry data can be found in the [Processing and Exporting Data]({{< relref "exporting_data" >}}) documentation. From c555a7b592d39cdd910a18820e39e73a85d6e386 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 21 Dec 2021 10:49:18 -0800 Subject: [PATCH 015/886] Change markdown links to relref (#2479) --- website_docs/manual_instrumentation.md | 2 +- website_docs/using_instrumentation_libraries.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/website_docs/manual_instrumentation.md b/website_docs/manual_instrumentation.md index 8438d36e1eb..f473d049144 100644 --- a/website_docs/manual_instrumentation.md +++ b/website_docs/manual_instrumentation.md @@ -136,4 +136,4 @@ After configuring context propagation, you'll most likely want to use automatic [OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}} [Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}} -[instrumentation library]: using_instrumentation_libraries +[instrumentation library]: {{< relref "using_instrumentation_libraries" >}} diff --git a/website_docs/using_instrumentation_libraries.md b/website_docs/using_instrumentation_libraries.md index aef81b60cd1..cbdab86652d 100644 --- a/website_docs/using_instrumentation_libraries.md +++ b/website_docs/using_instrumentation_libraries.md @@ -74,7 +74,7 @@ func main() { } ``` -Assuming that you have a `Tracer` and [exporter](exporting_data.md) configured, this code will: +Assuming that you have a `Tracer` and [exporter]({{< relref "exporting_data" >}}) configured, this code will: * Start an HTTP server on port `3030` * Automatically generate a span for each inbound HTTP request to `/hello-instrumented` @@ -90,4 +90,4 @@ A full list of instrumentation libraries available can be found in the [OpenTele Instrumentation libraries can do things like generate telemtry data for inbound and outbound HTTP requests, but they don't instrument your actual application. -To get richer telemetry data, use [manual instrumentatiion](manual_instrumentation.md) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. +To get richer telemetry data, use [manual instrumentatiion]({{< relref "manual_instrumentation" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. From 49987ad8525d15f91e82de8cecf01d3b6ca9ff61 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 21 Dec 2021 16:11:19 -0800 Subject: [PATCH 016/886] Rename manual_instrumentation and add redirects (#2480) * Rename manual_instrumentation and add redirects * Update * More feedback + name adjustment * Go back --- website_docs/exporting_data.md | 3 ++- website_docs/getting-started.md | 2 +- .../{using_instrumentation_libraries.md => libraries.md} | 4 +++- website_docs/{manual_instrumentation.md => manual.md} | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) rename website_docs/{using_instrumentation_libraries.md => libraries.md} (92%) rename website_docs/{manual_instrumentation.md => manual.md} (97%) diff --git a/website_docs/exporting_data.md b/website_docs/exporting_data.md index 7c436575f36..64152c71f47 100644 --- a/website_docs/exporting_data.md +++ b/website_docs/exporting_data.md @@ -1,6 +1,7 @@ --- -title: "Processing and Exporting Data" +title: Processing and Exporting Data weight: 4 +linkTitle: Exporting data --- Once you've instrumented your code, you need to get the data out in order to do anything useful with it. This page will cover the basics of the process and export pipeline. diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 24cf5880a15..35886692be4 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -536,7 +536,7 @@ start adding OpenTelemetry Go to your projects at this point. Go instrument your code! For more information about instrumenting your code and things you can do with -spans, refer to the [Instrumenting]({{< relref "manual_instrumentation" >}}) +spans, refer to the [Instrumenting]({{< relref "manual" >}}) documentation. Likewise, advanced topics about processing and exporting telemetry data can be found in the [Processing and Exporting Data]({{< relref "exporting_data" >}}) documentation. diff --git a/website_docs/using_instrumentation_libraries.md b/website_docs/libraries.md similarity index 92% rename from website_docs/using_instrumentation_libraries.md rename to website_docs/libraries.md index cbdab86652d..a41a408e824 100644 --- a/website_docs/using_instrumentation_libraries.md +++ b/website_docs/libraries.md @@ -1,6 +1,8 @@ --- title: Using instrumentation libraries weight: 3 +linkTitle: Libraries +aliases: [/docs/instrumentation/go/using_instrumentation_libraries, /docs/instrumentation/go/automatic_instrumentation] --- Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](https://opentelemetry.io/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/hhtp` will automatically create spans that track inbound and outbound requests once you configure it in your code. @@ -90,4 +92,4 @@ A full list of instrumentation libraries available can be found in the [OpenTele Instrumentation libraries can do things like generate telemtry data for inbound and outbound HTTP requests, but they don't instrument your actual application. -To get richer telemetry data, use [manual instrumentatiion]({{< relref "manual_instrumentation" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. +To get richer telemetry data, use [manual instrumentatiion]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. diff --git a/website_docs/manual_instrumentation.md b/website_docs/manual.md similarity index 97% rename from website_docs/manual_instrumentation.md rename to website_docs/manual.md index f473d049144..530aef208a0 100644 --- a/website_docs/manual_instrumentation.md +++ b/website_docs/manual.md @@ -1,6 +1,8 @@ --- -title: Instrumentation +title: Manual Instrumentation weight: 3 +linkTitle: Manual +aliases: [/docs/instrumentation/go/instrumentation, /docs/instrumentation/go/manual_instrumentation] --- Instrumentation is the process of adding observability code to your application. There are two general types of instrumentation - automatic, and manual - and you should be familiar with both in order to effectively instrument your software. From 4aedc1cdaf9475971b77520f6fa88e04a2cc4a04 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 22 Dec 2021 14:36:17 -0800 Subject: [PATCH 017/886] Fixes the instrument kind for noop async instruments (#2461) * Fixes the instrument kind for noop async instruments Signed-off-by: Bogdan Drutu * Update CHANGELOG.md Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ metric/sdkapi/noop.go | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f44bc9930..1bc1eef716d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382). - Deprecate `AtomicFieldOffsets`, unnecessary public func (#2445) +### Fixed + +- Fixes the instrument kind for noop async instruments. (#2461) + ## [1.3.0] - 2021-12-10 ### ⚠️ Notice ⚠️ diff --git a/metric/sdkapi/noop.go b/metric/sdkapi/noop.go index 986f5efec45..f22895dae6f 100644 --- a/metric/sdkapi/noop.go +++ b/metric/sdkapi/noop.go @@ -21,7 +21,9 @@ import ( "go.opentelemetry.io/otel/metric/number" ) -type noopInstrument struct{} +type noopInstrument struct { + descriptor Descriptor +} type noopSyncInstrument struct{ noopInstrument } type noopAsyncInstrument struct{ noopInstrument } @@ -31,21 +33,33 @@ var _ AsyncImpl = noopAsyncInstrument{} // NewNoopSyncInstrument returns a No-op implementation of the // synchronous instrument interface. func NewNoopSyncInstrument() SyncImpl { - return noopSyncInstrument{} + return noopSyncInstrument{ + noopInstrument{ + descriptor: Descriptor{ + instrumentKind: CounterInstrumentKind, + }, + }, + } } // NewNoopAsyncInstrument returns a No-op implementation of the // asynchronous instrument interface. func NewNoopAsyncInstrument() AsyncImpl { - return noopAsyncInstrument{} + return noopAsyncInstrument{ + noopInstrument{ + descriptor: Descriptor{ + instrumentKind: CounterObserverInstrumentKind, + }, + }, + } } func (noopInstrument) Implementation() interface{} { return nil } -func (noopInstrument) Descriptor() Descriptor { - return Descriptor{} +func (n noopInstrument) Descriptor() Descriptor { + return n.descriptor } func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) { From 9778aa328f8d98f77e2df45b6b60d1e9c7e82031 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 23 Dec 2021 08:35:32 -0800 Subject: [PATCH 018/886] Remove Min/Max unused interfaces from the moved code (#2454) Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- sdk/export/metric/aggregation/aggregation.go | 15 +++++++++++---- sdk/metric/export/aggregation/aggregation.go | 12 ------------ 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/sdk/export/metric/aggregation/aggregation.go b/sdk/export/metric/aggregation/aggregation.go index 75617a237f7..09b20306051 100644 --- a/sdk/export/metric/aggregation/aggregation.go +++ b/sdk/export/metric/aggregation/aggregation.go @@ -15,6 +15,7 @@ package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" import ( + "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) @@ -27,11 +28,17 @@ type Sum = aggregation.Sum // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" type Count = aggregation.Count -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Min = aggregation.Min +// Deprecated: Will be removed soon. +type Min interface { + Aggregation + Min() (number.Number, error) +} -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Max = aggregation.Max +// Deprecated: Will be removed soon. +type Max interface { + Aggregation + Max() (number.Number, error) +} // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" type LastValue = aggregation.LastValue diff --git a/sdk/metric/export/aggregation/aggregation.go b/sdk/metric/export/aggregation/aggregation.go index 4d5254ed71b..44c8c3320e2 100644 --- a/sdk/metric/export/aggregation/aggregation.go +++ b/sdk/metric/export/aggregation/aggregation.go @@ -46,18 +46,6 @@ type ( Count() (uint64, error) } - // Min returns the minimum value over the set of values that were aggregated. - Min interface { - Aggregation - Min() (number.Number, error) - } - - // Max returns the maximum value over the set of values that were aggregated. - Max interface { - Aggregation - Max() (number.Number, error) - } - // LastValue returns the latest value that was aggregated. LastValue interface { Aggregation From 109d8531ea4237873d9512c18a5c03e85643dd47 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Thu, 23 Dec 2021 08:43:30 -0800 Subject: [PATCH 019/886] Update relref link in manual instrumentation (#2482) Co-authored-by: Tyler Yahn --- website_docs/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index 530aef208a0..2b17e075abe 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -138,4 +138,4 @@ After configuring context propagation, you'll most likely want to use automatic [OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}} [Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}} -[instrumentation library]: {{< relref "using_instrumentation_libraries" >}} +[instrumentation library]: {{< relref "libraries" >}} From 245f13baaccd2cfb729b5bbc074c3b72b72a7f45 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Thu, 23 Dec 2021 09:18:08 -0800 Subject: [PATCH 020/886] Add section in docs for initializing a tracer (#2481) * Add section in docs for initializing a tracer * Apply suggestions from code review Co-authored-by: Anthony Mirabella * Change weird incomplete sentence * update some of the bullets to be a tad less opinionated * Rename section so it's open to different ways to acquire a tracer * Remove guidance as it is orthogonal * Apply suggestions from code review Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- website_docs/manual.md | 76 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index 2b17e075abe..825a68f46b9 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -7,9 +7,83 @@ aliases: [/docs/instrumentation/go/instrumentation, /docs/instrumentation/go/man Instrumentation is the process of adding observability code to your application. There are two general types of instrumentation - automatic, and manual - and you should be familiar with both in order to effectively instrument your software. +## Getting a Tracer + +To create spans, you'll need to acquire or initialize a tracer first. + +### Initiallizing a new tracer + +Ensure you have the right packages installed: + +``` +go get go.opentelemetry.io/otel \ + go.opentelemetry.io/otel/trace \ + go.opentelemetry.io/otel/sdk \ +``` + +Then initialize an exporter, resources, tracer provider, and finally a tracer. + +```go +package app + +import ( + "context" + "fmt" + "log" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + "go.opentelemetry.io/otel/trace" +) + +var tracer trace.Tracer + +func newExporter(ctx context.Context) /* (someExporter.Exporter, error) */ { + // Your preferred exporter: console, jaeger, zipkin, OTLP, etc. +} + +func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { + // The service.name attribute is required. + resource := resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("ExampleService"), + ) + + return sdktrace.NewTracerProvider( + sdktrace.WithBatcher(exp), + sdktrace.WithResource(resource), + ) +} + +func main() { + ctx := context.Background() + + exp, err := newExporter(ctx) + if err != nil { + log.Fatalf("failed to initialize exporter: %v", err) + } + + // Create a new tracer provider with a batch span processor and the given exporter. + tp := newTraceProvider(exp) + + // Handle shutdown properly so nothing leaks. + defer func() { _ = tp.Shutdown(ctx) }() + + otel.SetTracerProvider(tp) + + // Finally, set the tracer that can be used for this package. + tracer = tp.Tracer("ExampleService") +} +``` + +You can now access `tracer` to manually instrument your code. + ## Creating Spans -Spans are created by tracers, which can be acquired from a Tracer Provider. Typically a tracer is instantiated at the module level. +Spans are created by tracers. If you don't have one initialized, you'll need to do that. To create a span with a tracer, you'll also need a handle on a `context.Context` instance. These will typically come from things like a request object and may already contain a parent span from an [instrumentation library][]. From 4769bbe7d85e6c2b6ea302254d4d040cbe12aa53 Mon Sep 17 00:00:00 2001 From: Travis Jefferson Date: Tue, 28 Dec 2021 11:34:41 -0500 Subject: [PATCH 021/886] Update docs: don't reference `WithBuiltinDetectors` (#2486) * Update docs: don't reference `WithBuiltinDetectors` The method was removed in 25d739b * Update docs: use `WithFromEnv()` in example --- website_docs/exporting_data.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/website_docs/exporting_data.md b/website_docs/exporting_data.md index 64152c71f47..b1045e7a842 100644 --- a/website_docs/exporting_data.md +++ b/website_docs/exporting_data.md @@ -55,9 +55,7 @@ system it is running on, the cloud provider hosting that operating system instan ```go resources := resource.New(context.Background(), - // Builtin detectors provide default values and support - // OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables - resource.WithBuiltinDetectors(), + resource.WithFromEnv(), // pull attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables resource.WithProcess(), // This option configures a set of Detectors that discover process information resource.WithDetectors(thirdparty.Detector{}), // Bring your own external Detector implementation resource.WithAttributes(attribute.String("foo", "bar")), // Or specify resource attributes directly From c772d579507d961beb150d71c68b75f601cf4eb4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jan 2022 10:09:43 -0800 Subject: [PATCH 022/886] Bump actions/setup-go from 2.1.4 to 2.1.5 (#2485) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.4 to 2.1.5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2.1.4...v2.1.5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/dependabot.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf0a6667e96..09abecea0cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -123,7 +123,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2.1.4 + uses: actions/setup-go@v2.1.5 with: go-version: ${{ matrix.go-version }} - name: Checkout code diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index e1ffc0b640f..4ff7b99d7f3 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v2.1.4 + - uses: actions/setup-go@v2.1.5 with: go-version: '^1.16.0' - uses: evantorrie/mott-the-tidier@v1-beta From 776bfdcb2358157b894b3552187b1ab49c6ae0d1 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Tue, 4 Jan 2022 10:01:53 -0800 Subject: [PATCH 023/886] add additional batch overhead in jaeger agent udp exporter (#2489) * add additional batch overhead in jaeger agent udp exporter Signed-off-by: Ben Ye * update changelog Signed-off-by: Ben Ye Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ exporters/jaeger/agent.go | 11 ++++++++--- exporters/jaeger/agent_test.go | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bc1eef716d..3c524fc28b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489) + ### Deprecated - Deprecate module `"go.opentelemetry.io/otel/sdk/export/metric"`, new functionality available in "go.opentelemetry.io/otel/sdk/metric" module: diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go index 5dbb5805c9b..ce53e4386b2 100644 --- a/exporters/jaeger/agent.go +++ b/exporters/jaeger/agent.go @@ -28,8 +28,13 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" ) -// udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent -const udpPacketMaxLength = 65000 +const ( + // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent + udpPacketMaxLength = 65000 + // emitBatchOverhead is the additional overhead bytes used for enveloping the datagram, + // synced with jaeger-agent https://github.com/jaegertracing/jaeger-client-go/blob/master/transport_udp.go#L37 + emitBatchOverhead = 70 +) // agentClientUDP is a UDP client to Jaeger agent that implements gen.Agent interface. type agentClientUDP struct { @@ -67,7 +72,7 @@ func newAgentClientUDP(params agentClientUDPParams) (*agentClientUDP, error) { } if params.MaxPacketSize <= 0 { - params.MaxPacketSize = udpPacketMaxLength + params.MaxPacketSize = udpPacketMaxLength - emitBatchOverhead } if params.AttemptReconnecting && params.AttemptReconnectInterval <= 0 { diff --git a/exporters/jaeger/agent_test.go b/exporters/jaeger/agent_test.go index 62de111dae5..933d364e3df 100644 --- a/exporters/jaeger/agent_test.go +++ b/exporters/jaeger/agent_test.go @@ -73,7 +73,7 @@ func TestNewAgentClientUDPWithParamsDefaults(t *testing.T) { }) assert.NoError(t, err) assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) + assert.Equal(t, udpPacketMaxLength-emitBatchOverhead, agentClient.maxPacketSize) if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { assert.Equal(t, (*log.Logger)(nil), agentClient.connUDP.(*reconnectingUDPConn).logger) @@ -97,7 +97,7 @@ func TestNewAgentClientUDPWithParamsReconnectingDisabled(t *testing.T) { }) assert.NoError(t, err) assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) + assert.Equal(t, udpPacketMaxLength-emitBatchOverhead, agentClient.maxPacketSize) assert.IsType(t, &net.UDPConn{}, agentClient.connUDP) From 4b815ff70ca0edc00e6b9d2c828119ec99d03fb6 Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Wed, 5 Jan 2022 02:14:03 +0800 Subject: [PATCH 024/886] change UploadMetrics signature from slice to single Resource (#2491) * change UploadMetrics signature from slice to single Resource * add changelog * fix otlp exporter bug. * Update exporters/otlp/otlpmetric/exporter_test.go Co-authored-by: Anthony Mirabella * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/otlp/otlpmetric/clients.go | 2 +- exporters/otlp/otlpmetric/exporter.go | 3 +-- exporters/otlp/otlpmetric/exporter_test.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/client.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c524fc28b7..daede6742ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Fixes the instrument kind for noop async instruments. (#2461) +- Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) ## [1.3.0] - 2021-12-10 diff --git a/exporters/otlp/otlpmetric/clients.go b/exporters/otlp/otlpmetric/clients.go index 540ab614307..6808d464761 100644 --- a/exporters/otlp/otlpmetric/clients.go +++ b/exporters/otlp/otlpmetric/clients.go @@ -39,5 +39,5 @@ type Client interface { // UploadMetrics should transform the passed metrics to the // wire format and send it to the collector. May be called // concurrently. - UploadMetrics(ctx context.Context, protoMetrics []*metricpb.ResourceMetrics) error + UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error } diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index d6c9a6f4e76..2cd90ac435a 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/resource" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) var ( @@ -57,7 +56,7 @@ func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr expor // call, as per the specification. We can change the // signature of UploadMetrics correspondingly. Here create a // singleton list to reduce the size of the current PR: - return e.client.UploadMetrics(ctx, []*metricpb.ResourceMetrics{rm}) + return e.client.UploadMetrics(ctx, rm) } // Start establishes a connection to the receiving endpoint. diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index cc7d4728461..31e3f3e6848 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -63,8 +63,8 @@ func (m *stubClient) Stop(ctx context.Context) error { return nil } -func (m *stubClient) UploadMetrics(ctx context.Context, protoMetrics []*metricpb.ResourceMetrics) error { - m.rm = append(m.rm, protoMetrics...) +func (m *stubClient) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { + m.rm = append(m.rm, protoMetrics) return nil } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index ee08f8a00b2..cb67a4fe812 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -180,7 +180,7 @@ var errShutdown = errors.New("the client is shutdown") // // Retryable errors from the server will be handled according to any // RetryConfig the client was created with. -func (c *client) UploadMetrics(ctx context.Context, protoMetrics []*metricpb.ResourceMetrics) error { +func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { // Hold a read lock to ensure a shut down initiated after this starts does // not abandon the export. This read lock acquire has less priority than a // write lock acquire (i.e. Stop), meaning if the client is shutting down @@ -197,7 +197,7 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics []*metricpb.Res return c.requestFunc(ctx, func(iCtx context.Context) error { _, err := c.msc.Export(iCtx, &colmetricpb.ExportMetricsServiceRequest{ - ResourceMetrics: protoMetrics, + ResourceMetrics: []*metricpb.ResourceMetrics{protoMetrics}, }) // nil is converted to OK. if status.Code(err) == codes.OK { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 55334a221c6..b472611fb40 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -144,9 +144,9 @@ func (d *client) Stop(ctx context.Context) error { } // UploadMetrics sends a batch of metrics to the collector. -func (d *client) UploadMetrics(ctx context.Context, protoMetrics []*metricpb.ResourceMetrics) error { +func (d *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { pbRequest := &colmetricpb.ExportMetricsServiceRequest{ - ResourceMetrics: protoMetrics, + ResourceMetrics: []*metricpb.ResourceMetrics{protoMetrics}, } rawRequest, err := proto.Marshal(pbRequest) if err != nil { From 1c1e84614dda2c002ecc0a674786d6b7105ad8e7 Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Wed, 5 Jan 2022 02:33:18 +0800 Subject: [PATCH 025/886] fix specify explicit buckets in example (#2493) * fix specify explicit buckets in example * add changelog * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 1 + example/prometheus/main.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daede6742ae..bfb9ffd1556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fixes the instrument kind for noop async instruments. (#2461) - Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) +- Specify explicit buckets in Prometheus example. (#2493) ## [1.3.0] - 2021-12-10 diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 4ef0f2e89e2..8a1248a358e 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -38,7 +38,9 @@ var ( ) func initMeter() { - config := prometheus.Config{} + config := prometheus.Config{ + DefaultHistogramBoundaries: []float64{1, 2, 5, 10, 20, 50}, + } c := controller.New( processor.NewFactory( selector.NewWithHistogramDistribution( From 11ce2ddd24f78721e5cc28020ee65a7dba839cf7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 5 Jan 2022 17:04:55 -0800 Subject: [PATCH 026/886] Fix sporadic test failure in otlp exporter http client tests (#2496) * Fix flaky TestTimeout in otlpmetrichttp * Fix flaky TestTimeout in otlptracehttp --- .../otlp/otlpmetric/otlpmetrichttp/client_test.go | 10 +++++----- .../otlpmetrichttp/mock_collector_test.go | 15 +++++++++------ .../otlp/otlptrace/otlptracehttp/client_test.go | 10 +++++----- .../otlptracehttp/mock_collector_test.go | 15 +++++++++------ 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index e15d8b35d6d..5e614da2640 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -144,15 +144,15 @@ func TestExporterShutdown(t *testing.T) { } func TestTimeout(t *testing.T) { - mcCfg := mockCollectorConfig{ - InjectDelay: 100 * time.Millisecond, - } + delay := make(chan struct{}) + mcCfg := mockCollectorConfig{Delay: delay} mc := runMockCollector(t, mcCfg) defer mc.MustStop(t) + defer func() { close(delay) }() client := otlpmetrichttp.NewClient( otlpmetrichttp.WithEndpoint(mc.Endpoint()), otlpmetrichttp.WithInsecure(), - otlpmetrichttp.WithTimeout(50*time.Millisecond), + otlpmetrichttp.WithTimeout(time.Nanosecond), ) ctx := context.Background() exporter, err := otlpmetric.New(ctx, client) @@ -161,7 +161,7 @@ func TestTimeout(t *testing.T) { assert.NoError(t, exporter.Shutdown(ctx)) }() err = exporter.Export(ctx, testResource, oneRecord) - assert.Equal(t, true, os.IsTimeout(err)) + assert.Equalf(t, true, os.IsTimeout(err), "expected timeout error, got: %v", err) } func TestEmptyData(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go index 042866c2eef..876f8608c3d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go @@ -26,7 +26,6 @@ import ( "net/http" "sync" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -47,7 +46,7 @@ type mockCollector struct { injectHTTPStatus []int injectContentType string - injectDelay time.Duration + delay <-chan struct{} clientTLSConfig *tls.Config expectedHeaders map[string]string @@ -76,8 +75,12 @@ func (c *mockCollector) ClientTLSConfig() *tls.Config { } func (c *mockCollector) serveMetrics(w http.ResponseWriter, r *http.Request) { - if c.injectDelay != 0 { - time.Sleep(c.injectDelay) + if c.delay != nil { + select { + case <-c.delay: + case <-r.Context().Done(): + return + } } if !c.checkHeaders(r) { @@ -182,7 +185,7 @@ type mockCollectorConfig struct { Port int InjectHTTPStatus []int InjectContentType string - InjectDelay time.Duration + Delay <-chan struct{} WithTLS bool ExpectedHeaders map[string]string } @@ -204,7 +207,7 @@ func runMockCollector(t *testing.T, cfg mockCollectorConfig) *mockCollector { metricsStorage: otlpmetrictest.NewMetricsStorage(), injectHTTPStatus: cfg.InjectHTTPStatus, injectContentType: cfg.InjectContentType, - injectDelay: cfg.InjectDelay, + delay: cfg.Delay, expectedHeaders: cfg.ExpectedHeaders, } mux := http.NewServeMux() diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 445717e08d5..d14a6ce806f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -187,15 +187,15 @@ func TestExporterShutdown(t *testing.T) { } func TestTimeout(t *testing.T) { - mcCfg := mockCollectorConfig{ - InjectDelay: 100 * time.Millisecond, - } + delay := make(chan struct{}) + mcCfg := mockCollectorConfig{Delay: delay} mc := runMockCollector(t, mcCfg) defer mc.MustStop(t) + defer func() { close(delay) }() client := otlptracehttp.NewClient( otlptracehttp.WithEndpoint(mc.Endpoint()), otlptracehttp.WithInsecure(), - otlptracehttp.WithTimeout(50*time.Millisecond), + otlptracehttp.WithTimeout(time.Nanosecond), ) ctx := context.Background() exporter, err := otlptrace.New(ctx, client) @@ -204,7 +204,7 @@ func TestTimeout(t *testing.T) { assert.NoError(t, exporter.Shutdown(ctx)) }() err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) - assert.Equal(t, true, os.IsTimeout(err)) + assert.Equalf(t, true, os.IsTimeout(err), "expected timeout error, got: %v", err) } func TestNoRetry(t *testing.T) { diff --git a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go index 01d79daf8c4..468506466c4 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go @@ -26,7 +26,6 @@ import ( "net/http" "sync" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -48,7 +47,7 @@ type mockCollector struct { injectHTTPStatus []int injectResponseHeader []map[string]string injectContentType string - injectDelay time.Duration + delay <-chan struct{} clientTLSConfig *tls.Config expectedHeaders map[string]string @@ -83,8 +82,12 @@ func (c *mockCollector) ClientTLSConfig() *tls.Config { } func (c *mockCollector) serveTraces(w http.ResponseWriter, r *http.Request) { - if c.injectDelay != 0 { - time.Sleep(c.injectDelay) + if c.delay != nil { + select { + case <-c.delay: + case <-r.Context().Done(): + return + } } if !c.checkHeaders(r) { @@ -205,7 +208,7 @@ type mockCollectorConfig struct { InjectHTTPStatus []int InjectContentType string InjectResponseHeader []map[string]string - InjectDelay time.Duration + Delay <-chan struct{} WithTLS bool ExpectedHeaders map[string]string } @@ -228,7 +231,7 @@ func runMockCollector(t *testing.T, cfg mockCollectorConfig) *mockCollector { injectHTTPStatus: cfg.InjectHTTPStatus, injectResponseHeader: cfg.InjectResponseHeader, injectContentType: cfg.InjectContentType, - injectDelay: cfg.InjectDelay, + delay: cfg.Delay, expectedHeaders: cfg.ExpectedHeaders, } mux := http.NewServeMux() From 1e4a609495e34e253d3bddbe8bd2929dc51c61b6 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Thu, 6 Jan 2022 08:28:42 -0800 Subject: [PATCH 027/886] support zipkin exporter endpoint env (#2490) * support zipkin exporter endpoint env Signed-off-by: Ben Ye * update interface and changelog Signed-off-by: Ben Ye * add pr number Signed-off-by: Ben Ye * fix lint Signed-off-by: Ben Ye * add import Signed-off-by: Ben Ye Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 +++ exporters/zipkin/env.go | 31 +++++++++++++++++ exporters/zipkin/env_test.go | 62 +++++++++++++++++++++++++++++++++ exporters/zipkin/zipkin.go | 11 +++--- exporters/zipkin/zipkin_test.go | 57 +++++++++++++++++++++--------- 5 files changed, 144 insertions(+), 21 deletions(-) create mode 100644 exporters/zipkin/env.go create mode 100644 exporters/zipkin/env_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb9ffd1556..7ecfe184715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) + ### Changed - Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489) diff --git a/exporters/zipkin/env.go b/exporters/zipkin/env.go new file mode 100644 index 00000000000..5c072ee67b5 --- /dev/null +++ b/exporters/zipkin/env.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package zipkin // import "go.opentelemetry.io/otel/exporters/zipkin" + +import "os" + +// Environment variable names +const ( + // Endpoint for Zipkin collector + envEndpoint = "OTEL_EXPORTER_ZIPKIN_ENDPOINT" +) + +// envOr returns an env variable's value if it is exists or the default if not +func envOr(key, defaultValue string) string { + if v, ok := os.LookupEnv(key); ok && v != "" { + return v + } + return defaultValue +} diff --git a/exporters/zipkin/env_test.go b/exporters/zipkin/env_test.go new file mode 100644 index 00000000000..b06fc785650 --- /dev/null +++ b/exporters/zipkin/env_test.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package zipkin + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + ottest "go.opentelemetry.io/otel/internal/internaltest" +) + +func TestEnvOrWithCollectorEndpointOptionsFromEnv(t *testing.T) { + testCases := []struct { + name string + envEndpoint string + defaultCollectorEndpoint string + expectedCollectorEndpoint string + }{ + { + name: "overrides value via environment variables", + envEndpoint: "http://localhost:19411/foo", + defaultCollectorEndpoint: defaultCollectorURL, + expectedCollectorEndpoint: "http://localhost:19411/foo", + }, + { + name: "environment variables is empty, will not overwrite value", + envEndpoint: "", + defaultCollectorEndpoint: defaultCollectorURL, + expectedCollectorEndpoint: defaultCollectorURL, + }, + } + + envStore := ottest.NewEnvStore() + envStore.Record(envEndpoint) + defer func() { + require.NoError(t, envStore.Restore()) + }() + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + require.NoError(t, os.Setenv(envEndpoint, tc.envEndpoint)) + + endpoint := envOr(envEndpoint, tc.defaultCollectorEndpoint) + + assert.Equal(t, tc.expectedCollectorEndpoint, endpoint) + }) + } +} diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 2d45301dd79..23a44a1ba97 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -18,7 +18,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "io" "io/ioutil" @@ -30,12 +29,15 @@ import ( sdktrace "go.opentelemetry.io/otel/sdk/trace" ) +const ( + defaultCollectorURL = "http://localhost:9411/api/v2/spans" +) + // Exporter exports spans to the zipkin collector. type Exporter struct { url string client *http.Client logger *log.Logger - config config stoppedMu sync.RWMutex stopped bool @@ -79,7 +81,8 @@ func WithClient(client *http.Client) Option { // New creates a new Zipkin exporter. func New(collectorURL string, opts ...Option) (*Exporter, error) { if collectorURL == "" { - return nil, errors.New("collector URL cannot be empty") + // Use endpoint from env var or default collector URL. + collectorURL = envOr(envEndpoint, defaultCollectorURL) } u, err := url.Parse(collectorURL) if err != nil { @@ -93,6 +96,7 @@ func New(collectorURL string, opts ...Option) (*Exporter, error) { for _, opt := range opts { opt.apply(&cfg) } + if cfg.client == nil { cfg.client = http.DefaultClient } @@ -100,7 +104,6 @@ func New(collectorURL string, opts ...Option) (*Exporter, error) { url: collectorURL, client: cfg.client, logger: cfg.logger, - config: cfg, }, nil } diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 9a57b2c657c..c6984e572e1 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -26,6 +26,8 @@ import ( "testing" "time" + ottest "go.opentelemetry.io/otel/internal/internaltest" + zkmodel "github.com/openzipkin/zipkin-go/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -38,13 +40,9 @@ import ( "go.opentelemetry.io/otel/trace" ) -const ( - collectorURL = "http://localhost:9411/api/v2/spans" -) - func TestNewRawExporter(t *testing.T) { _, err := New( - collectorURL, + defaultCollectorURL, ) assert.NoError(t, err) @@ -56,15 +54,6 @@ func TestNewRawExporterShouldFailInvalidCollectorURL(t *testing.T) { err error ) - // cannot be empty - exp, err = New( - "", - ) - - assert.Error(t, err) - assert.EqualError(t, err, "collector URL cannot be empty") - assert.Nil(t, exp) - // invalid URL exp, err = New( "localhost", @@ -75,6 +64,40 @@ func TestNewRawExporterShouldFailInvalidCollectorURL(t *testing.T) { assert.Nil(t, exp) } +func TestNewRawExporterEmptyDefaultCollectorURL(t *testing.T) { + var ( + exp *Exporter + err error + ) + + // use default collector URL if not specified + exp, err = New("") + + assert.NoError(t, err) + assert.Equal(t, defaultCollectorURL, exp.url) +} + +func TestNewRawExporterCollectorURLFromEnv(t *testing.T) { + var ( + exp *Exporter + err error + ) + + expectedEndpoint := "http://localhost:19411/api/v2/spans" + envStore, err := ottest.SetEnvVariables(map[string]string{ + envEndpoint: expectedEndpoint, + }) + assert.NoError(t, err) + defer func() { + require.NoError(t, envStore.Restore()) + }() + + exp, err = New("") + + assert.NoError(t, err) + assert.Equal(t, expectedEndpoint, exp.url) +} + type mockZipkinCollector struct { t *testing.T url string @@ -309,7 +332,7 @@ func TestExporterShutdownHonorsTimeout(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() - exp, err := New(collectorURL) + exp, err := New("") require.NoError(t, err) innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) @@ -322,7 +345,7 @@ func TestExporterShutdownHonorsCancel(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() - exp, err := New(collectorURL) + exp, err := New("") require.NoError(t, err) innerCtx, innerCancel := context.WithCancel(ctx) @@ -331,7 +354,7 @@ func TestExporterShutdownHonorsCancel(t *testing.T) { } func TestErrorOnExportShutdownExporter(t *testing.T) { - exp, err := New(collectorURL) + exp, err := New("") require.NoError(t, err) assert.NoError(t, exp.Shutdown(context.Background())) assert.NoError(t, exp.ExportSpans(context.Background(), nil)) From c37f485678458f6784b44179b83d84b2df419039 Mon Sep 17 00:00:00 2001 From: Eric Hsueh <39718333+erichsueh3@users.noreply.github.com> Date: Mon, 10 Jan 2022 15:22:31 -0800 Subject: [PATCH 028/886] added Float64 CounterObserver and UDCounterObserver tests (#2487) Co-authored-by: Anthony Mirabella --- exporters/prometheus/prometheus_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go index 907db0db4b7..b05d9232117 100644 --- a/exporters/prometheus/prometheus_test.go +++ b/exporters/prometheus/prometheus_test.go @@ -124,11 +124,11 @@ func TestPrometheusExporter(t *testing.T) { expected = append(expected, expectCounter("counter", `counter{A="B",C="D",R="V"} 15.3`)) - _ = metric.Must(meter).NewInt64GaugeObserver("intobserver", func(_ context.Context, result metric.Int64ObserverResult) { + _ = metric.Must(meter).NewInt64GaugeObserver("intgaugeobserver", func(_ context.Context, result metric.Int64ObserverResult) { result.Observe(1, labels...) }) - expected = append(expected, expectGauge("intobserver", `intobserver{A="B",C="D",R="V"} 1`)) + expected = append(expected, expectGauge("intgaugeobserver", `intgaugeobserver{A="B",C="D",R="V"} 1`)) histogram.Record(ctx, -0.6, labels...) histogram.Record(ctx, -0.4, labels...) @@ -148,6 +148,18 @@ func TestPrometheusExporter(t *testing.T) { expected = append(expected, expectGauge("updowncounter", `updowncounter{A="B",C="D",R="V"} 6.8`)) + _ = metric.Must(meter).NewFloat64CounterObserver("floatcounterobserver", func(_ context.Context, result metric.Float64ObserverResult) { + result.Observe(7.7, labels...) + }) + + expected = append(expected, expectCounter("floatcounterobserver", `floatcounterobserver{A="B",C="D",R="V"} 7.7`)) + + _ = metric.Must(meter).NewFloat64UpDownCounterObserver("floatupdowncounterobserver", func(_ context.Context, result metric.Float64ObserverResult) { + result.Observe(-7.7, labels...) + }) + + expected = append(expected, expectGauge("floatupdowncounterobserver", `floatupdowncounterobserver{A="B",C="D",R="V"} -7.7`)) + compareExport(t, exporter, expected) compareExport(t, exporter, expected) } From f24f52aa064b7626273daab61c716d4cf14fb8f8 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 10 Jan 2022 18:58:01 -0600 Subject: [PATCH 029/886] Debug Logging for sdk/trace (#2500) * Debug Logging for sdk/trace * Fixes spelling, adds marshaling to attribute sets Co-authored-by: Aaron Clawson Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 1 + attribute/set.go | 9 ++++++ example/namedtracer/main.go | 2 +- exporters/stdout/stdouttrace/trace.go | 11 +++++++ sdk/go.mod | 1 + sdk/resource/resource.go | 11 +++++++ sdk/trace/batch_span_processor.go | 15 ++++++++- sdk/trace/batch_span_processor_test.go | 43 ++++++++++++++++++++++++++ sdk/trace/provider.go | 21 +++++++++++++ sdk/trace/simple_span_processor.go | 11 +++++++ 10 files changed, 123 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ecfe184715..6c49b2dec7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) +- Log the configuration of TracerProviders, and Tracers for debugging. To enable use a logger with Verbosity (V level) >=1 ### Changed diff --git a/attribute/set.go b/attribute/set.go index bd591894de5..a28f1435cb9 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -410,6 +410,15 @@ func (l *Set) MarshalJSON() ([]byte, error) { return json.Marshal(l.equivalent.iface) } +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (l Set) MarshalLog() interface{} { + kvs := make(map[string]string) + for _, kv := range l.ToSlice() { + kvs[string(kv.Key)] = kv.Value.Emit() + } + return kvs +} + // Len implements `sort.Interface`. func (l *Sortable) Len() int { return len(*l) diff --git a/example/namedtracer/main.go b/example/namedtracer/main.go index a091e88f6c9..bde51637f8b 100644 --- a/example/namedtracer/main.go +++ b/example/namedtracer/main.go @@ -55,7 +55,7 @@ func initTracer() { func main() { // Set logging level to info to see SDK status messages - stdr.SetVerbosity(1) + stdr.SetVerbosity(5) // initialize trace provider. initTracer() diff --git a/exporters/stdout/stdouttrace/trace.go b/exporters/stdout/stdouttrace/trace.go index f1937a28ebe..c1da03c9365 100644 --- a/exporters/stdout/stdouttrace/trace.go +++ b/exporters/stdout/stdouttrace/trace.go @@ -106,3 +106,14 @@ func (e *Exporter) Shutdown(ctx context.Context) error { } return nil } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + WithTimestamps bool + }{ + Type: "stdout", + WithTimestamps: e.timestamps, + } +} diff --git a/sdk/go.mod b/sdk/go.mod index 41e782d9c72..2cd10292323 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,6 +5,7 @@ go 1.16 replace go.opentelemetry.io/otel => ../ require ( + github.com/go-logr/logr v1.2.2 github.com/google/go-cmp v0.5.6 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index eb0ecd2cf91..4ef49b314fc 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -109,6 +109,17 @@ func (r *Resource) String() string { return r.attrs.Encoded(attribute.DefaultEncoder()) } +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (r *Resource) MarshalLog() interface{} { + return struct { + Attributes attribute.Set + SchemaURL string + }{ + Attributes: r.attrs, + SchemaURL: r.schemaURL, + } +} + // Attributes returns a copy of attributes from the resource in a sorted order. // To avoid allocating a new slice, use an iterator. func (r *Resource) Attributes() []attribute.KeyValue { diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 75f519a67b4..dda62c452c6 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -238,7 +238,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { } if l := len(bsp.batch); l > 0 { - global.Debug("exporting spans", "count", len(bsp.batch)) + global.Debug("exporting spans", "count", len(bsp.batch), "dropped", bsp.dropped) err := bsp.e.ExportSpans(ctx, bsp.batch) // A new batch is always created after exporting, even if the batch failed to be exported. @@ -369,3 +369,16 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd R } return false } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (bsp *batchSpanProcessor) MarshalLog() interface{} { + return struct { + Type string + SpanExporter SpanExporter + Config BatchSpanProcessorOptions + }{ + Type: "BatchSpanProcessor", + SpanExporter: bsp.e, + Config: bsp.o, + } +} diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index acc2d906426..f66c6bd1b43 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -23,9 +23,11 @@ import ( "testing" "time" + "github.com/go-logr/logr/funcr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/internal/global" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.opentelemetry.io/otel/trace" @@ -480,3 +482,44 @@ func TestBatchSpanProcessorForceFlushQueuedSpans(t *testing.T) { assert.Len(t, exp.GetSpans(), i+1) } } + +func BenchmarkSpanProcessor(b *testing.B) { + tp := sdktrace.NewTracerProvider( + sdktrace.WithBatcher( + tracetest.NewNoopExporter(), + sdktrace.WithMaxExportBatchSize(10), + )) + tracer := tp.Tracer("bench") + ctx := context.Background() + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + for j := 0; j < 10; j++ { + _, span := tracer.Start(ctx, "bench") + span.End() + } + } +} + +func BenchmarkSpanProcessorVerboseLogging(b *testing.B) { + global.SetLogger(funcr.New(func(prefix, args string) {}, funcr.Options{Verbosity: 5})) + tp := sdktrace.NewTracerProvider( + sdktrace.WithBatcher( + tracetest.NewNoopExporter(), + sdktrace.WithMaxExportBatchSize(10), + )) + tracer := tp.Tracer("bench") + ctx := context.Background() + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + for j := 0; j < 10; j++ { + _, span := tracer.Start(ctx, "bench") + span.End() + } + } +} diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 47ff5fad1e2..68bdefe0c94 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -21,6 +21,7 @@ import ( "sync/atomic" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/trace" @@ -52,6 +53,23 @@ type tracerProviderConfig struct { resource *resource.Resource } +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (cfg tracerProviderConfig) MarshalLog() interface{} { + return struct { + SpanProcessors []SpanProcessor + SamplerType string + IDGeneratorType string + SpanLimits SpanLimits + Resource *resource.Resource + }{ + SpanProcessors: cfg.processors, + SamplerType: fmt.Sprintf("%T", cfg.sampler), + IDGeneratorType: fmt.Sprintf("%T", cfg.idGenerator), + SpanLimits: cfg.spanLimits, + Resource: cfg.resource, + } +} + type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Library]*tracer @@ -91,6 +109,8 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { resource: o.resource, } + global.Info("TracerProvider created", "config", o) + for _, sp := range o.processors { tp.RegisterSpanProcessor(sp) } @@ -125,6 +145,7 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T instrumentationLibrary: il, } p.namedTracer[il] = t + global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) } return t } diff --git a/sdk/trace/simple_span_processor.go b/sdk/trace/simple_span_processor.go index ecc45bc6c38..d31d3c1caff 100644 --- a/sdk/trace/simple_span_processor.go +++ b/sdk/trace/simple_span_processor.go @@ -115,3 +115,14 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error { func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error { return nil } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (ssp *simpleSpanProcessor) MarshalLog() interface{} { + return struct { + Type string + Exporter SpanExporter + }{ + Type: "SimpleSpanProcessor", + Exporter: ssp.exporter, + } +} From 73edf3dfcca4b0696597b0412ba3b5106ed794e7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 11 Jan 2022 14:50:58 -0800 Subject: [PATCH 030/886] Remove old release bash scripts (#2506) --- RELEASING.md | 1 - pre_release.sh | 95 -------------------------- tag.sh | 178 ------------------------------------------------- 3 files changed, 274 deletions(-) delete mode 100755 pre_release.sh delete mode 100755 tag.sh diff --git a/RELEASING.md b/RELEASING.md index aef6510a2ee..e3bff66c6a9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -108,7 +108,6 @@ It is critical you make sure the version you push upstream is correct. Finally create a Release for the new `` on GitHub. The release body should include all the release notes from the Changelog for this release. -Additionally, the `tag.sh` script generates commit logs since last release which can be used to supplement the release notes. ## Verify Examples diff --git a/pre_release.sh b/pre_release.sh deleted file mode 100755 index 0de22169cfc..00000000000 --- a/pre_release.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -help() -{ - printf "\n" - printf "Usage: $0 -t tag\n" - printf "\t-t Unreleased tag. Update all go.mod with this tag.\n" - exit 1 # Exit script after printing help -} - -while getopts "t:" opt -do - case "$opt" in - t ) TAG="$OPTARG" ;; - ? ) help ;; # Print help - esac -done - -# Print help in case parameters are empty -if [ -z "$TAG" ] -then - printf "Tag is missing\n"; - help -fi - -# Validate semver -SEMVER_REGEX="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$" -if [[ "${TAG}" =~ ${SEMVER_REGEX} ]]; then - printf "${TAG} is valid semver tag.\n" -else - printf "${TAG} is not a valid semver tag.\n" - exit -1 -fi - -TAG_FOUND=`git tag --list ${TAG}` -if [[ ${TAG_FOUND} = ${TAG} ]] ; then - printf "Tag ${TAG} already exists\n" - exit -1 -fi - -# Get version for version.go -OTEL_VERSION=$(echo "${TAG}" | grep -o '^v[0-9]\+\.[0-9]\+\.[0-9]\+') -# Strip leading v -OTEL_VERSION="${OTEL_VERSION#v}" - -cd $(dirname $0) - -if ! git diff --quiet; then \ - printf "Working tree is not clean, can't proceed with the release process\n" - git status - git diff - exit 1 -fi - -# Update version.go -cp ./version.go ./version.go.bak -sed "s/\(return \"\)[0-9]*\.[0-9]*\.[0-9]*\"/\1${OTEL_VERSION}\"/" ./version.go.bak >./version.go -rm -f ./version.go.bak - -# Update go.mod -git checkout -b pre_release_${TAG} main -PACKAGE_DIRS=$(find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; | egrep -v 'tools' | sed 's/^\.\///' | sort) - -for dir in $PACKAGE_DIRS; do - cp "${dir}/go.mod" "${dir}/go.mod.bak" - sed "s/opentelemetry.io\/otel\([^ ]*\) v[0-9]*\.[0-9]*\.[0-9]/opentelemetry.io\/otel\1 ${TAG}/" "${dir}/go.mod.bak" >"${dir}/go.mod" - rm -f "${dir}/go.mod.bak" -done - -# Run lint to update go.sum -make lint - -# Add changes and commit. -git add . -make ci -git commit -m "Prepare for releasing $TAG" - -printf "Now run following to verify the changes.\ngit diff main\n" -printf "\nThen push the changes to upstream\n" diff --git a/tag.sh b/tag.sh deleted file mode 100755 index 70767c70377..00000000000 --- a/tag.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env bash - -# Copyright The OpenTelemetry Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -readonly PROGNAME=$(basename "$0") -readonly PROGDIR=$(readlink -m "$(dirname "$0")") - -readonly EXCLUDE_PACKAGES="internal/tools" -readonly SEMVER_REGEX="v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?" - -usage() { - cat <<- EOF -Usage: $PROGNAME [OPTIONS] SEMVER_TAG COMMIT_HASH - -Creates git tag for all Go packages in project. - -OPTIONS: - -h --help Show this help. - -ARGUMENTS: - SEMVER_TAG Semantic version to tag with. - COMMIT_HASH Git commit hash to tag. -EOF -} - -cmdline() { - local arg commit - - for arg - do - local delim="" - case "$arg" in - # Translate long form options to short form. - --help) args="${args}-h ";; - # Pass through for everything else. - *) [[ "${arg:0:1}" == "-" ]] || delim="\"" - args="${args}${delim}${arg}${delim} ";; - esac - done - - # Reset and process short form options. - eval set -- "$args" - - while getopts "h" OPTION - do - case $OPTION in - h) - usage - exit 0 - ;; - *) - echo "unknown option: $OPTION" - usage - exit 1 - ;; - esac - done - - # Positional arguments. - shift $((OPTIND-1)) - readonly TAG="$1" - if [ -z "$TAG" ] - then - echo "missing SEMVER_TAG" - usage - exit 1 - fi - if [[ ! "$TAG" =~ $SEMVER_REGEX ]] - then - printf "invalid semantic version: %s\n" "$TAG" - exit 2 - fi - if [[ "$( git tag --list "$TAG" )" ]] - then - printf "tag already exists: %s\n" "$TAG" - exit 2 - fi - - shift - commit="$1" - if [ -z "$commit" ] - then - echo "missing COMMIT_HASH" - usage - exit 1 - fi - # Verify rev is for a commit and unify hashes into a complete SHA1. - readonly SHA="$( git rev-parse --quiet --verify "${commit}^{commit}" )" - if [ -z "$SHA" ] - then - printf "invalid commit hash: %s\n" "$commit" - exit 2 - fi - if [ "$( git merge-base "$SHA" HEAD )" != "$SHA" ] - then - printf "commit '%s' not found on this branch\n" "$commit" - exit 2 - fi -} - -package_dirs() { - # Return a list of package directories in the form: - # - # package/directory/a - # package/directory/b - # deeper/package/directory/a - # ... - # - # Making sure to exclude any packages in the EXCLUDE_PACKAGES regexp. - find . -mindepth 2 -type f -name 'go.mod' -exec dirname {} \; \ - | grep -E -v "$EXCLUDE_PACKAGES" \ - | sed 's/^\.\///' \ - | sort -} - -git_tag() { - local tag="$1" - local commit="$2" - - git tag -a "$tag" -s -m "Version $tag" "$commit" -} - -previous_version() { - local current="$1" - - # Requires git > 2.0 - git tag -l --sort=v:refname \ - | grep -E "^${SEMVER_REGEX}$" \ - | grep -v "$current" \ - | tail -1 -} - -print_changes() { - local tag="$1" - local previous - - previous="$( previous_version "$tag" )" - if [ -n "$previous" ] - then - printf "\nRaw changes made between %s and %s\n" "$previous" "$tag" - printf "======================================\n" - git --no-pager log --pretty=oneline "${previous}..$tag" - fi -} - -main() { - local dir - - cmdline "$@" - - cd "$PROGDIR" || exit 3 - - # Create tag for root package. - git_tag "$TAG" "$SHA" - printf "created tag: %s\n" "$TAG" - - # Create tag for all sub-packages. - for dir in $( package_dirs ) - do - git_tag "${dir}/$TAG" "$SHA" - printf "created tag: %s\n" "${dir}/$TAG" - done - - print_changes "$TAG" -} -main "$@" From 0b03aae0da5ef1674c8e8e0ac1d2b74b8c0d6301 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 09:06:31 -0800 Subject: [PATCH 031/886] Bump github.com/openzipkin/zipkin-go from 0.3.0 to 0.4.0 in /exporters/zipkin (#2514) * Bump github.com/openzipkin/zipkin-go in /exporters/zipkin Bumps [github.com/openzipkin/zipkin-go](https://github.com/openzipkin/zipkin-go) from 0.3.0 to 0.4.0. - [Release notes](https://github.com/openzipkin/zipkin-go/releases) - [Commits](https://github.com/openzipkin/zipkin-go/compare/v0.3.0...v0.4.0) --- updated-dependencies: - dependency-name: github.com/openzipkin/zipkin-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/zipkin/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index a7605e72a1f..4ffcefa0d69 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -86,8 +86,8 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/openzipkin/zipkin-go v0.3.0 h1:XtuXmOLIXLjiU2XduuWREDT0LOKtSgos/g7i7RYyoZQ= -github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= +github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw= +github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 5fb28cba3a0..4fdb1c2ab5b 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/google/go-cmp v0.5.6 - github.com/openzipkin/zipkin-go v0.3.0 + github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 3a42504f5c7..0707ba97dc2 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -88,8 +88,8 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/openzipkin/zipkin-go v0.3.0 h1:XtuXmOLIXLjiU2XduuWREDT0LOKtSgos/g7i7RYyoZQ= -github.com/openzipkin/zipkin-go v0.3.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= +github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw= +github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= From 0c1f156b5b5f9cfd20c275dbc7477a89b78bb839 Mon Sep 17 00:00:00 2001 From: jaychung Date: Wed, 19 Jan 2022 00:42:24 +0800 Subject: [PATCH 032/886] emitBatchOverhead should only be used for splitting spans into batches (#2512) * emitBatchOverhead should only be used for splitting spans into batches (#2503) * limit max packet size parameter --- CHANGELOG.md | 2 +- exporters/jaeger/agent.go | 13 +++++++++---- exporters/jaeger/agent_test.go | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c49b2dec7d..6e1c838e32e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed -- Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489) +- Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489, #2512) ### Deprecated diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go index ce53e4386b2..17692fb570e 100644 --- a/exporters/jaeger/agent.go +++ b/exporters/jaeger/agent.go @@ -71,8 +71,8 @@ func newAgentClientUDP(params agentClientUDPParams) (*agentClientUDP, error) { return nil, err } - if params.MaxPacketSize <= 0 { - params.MaxPacketSize = udpPacketMaxLength - emitBatchOverhead + if params.MaxPacketSize <= 0 || params.MaxPacketSize > udpPacketMaxLength { + params.MaxPacketSize = udpPacketMaxLength } if params.AttemptReconnecting && params.AttemptReconnectInterval <= 0 { @@ -126,6 +126,11 @@ func (a *agentClientUDP) EmitBatch(ctx context.Context, batch *gen.Batch) error // drop the batch if serialization of process fails. return err } + + maxPacketSize := a.maxPacketSize + if maxPacketSize > udpPacketMaxLength-emitBatchOverhead { + maxPacketSize = udpPacketMaxLength - emitBatchOverhead + } totalSize := processSize var spans []*gen.Span for _, span := range batch.Spans { @@ -134,12 +139,12 @@ func (a *agentClientUDP) EmitBatch(ctx context.Context, batch *gen.Batch) error errs = append(errs, fmt.Errorf("thrift serialization failed: %v", span)) continue } - if spanSize+processSize >= a.maxPacketSize { + if spanSize+processSize >= maxPacketSize { // drop the span that exceeds the limit. errs = append(errs, fmt.Errorf("span too large to send: %v", span)) continue } - if totalSize+spanSize >= a.maxPacketSize { + if totalSize+spanSize >= maxPacketSize { if err := a.flush(ctx, &gen.Batch{ Process: batch.Process, Spans: spans, diff --git a/exporters/jaeger/agent_test.go b/exporters/jaeger/agent_test.go index 933d364e3df..62de111dae5 100644 --- a/exporters/jaeger/agent_test.go +++ b/exporters/jaeger/agent_test.go @@ -73,7 +73,7 @@ func TestNewAgentClientUDPWithParamsDefaults(t *testing.T) { }) assert.NoError(t, err) assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength-emitBatchOverhead, agentClient.maxPacketSize) + assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { assert.Equal(t, (*log.Logger)(nil), agentClient.connUDP.(*reconnectingUDPConn).logger) @@ -97,7 +97,7 @@ func TestNewAgentClientUDPWithParamsReconnectingDisabled(t *testing.T) { }) assert.NoError(t, err) assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength-emitBatchOverhead, agentClient.maxPacketSize) + assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) assert.IsType(t, &net.UDPConn{}, agentClient.connUDP) From 3c2e08ae0bc3eca96c4336e26d40482bddd83cd1 Mon Sep 17 00:00:00 2001 From: Ben Wells Date: Wed, 19 Jan 2022 19:55:55 +0000 Subject: [PATCH 033/886] Fix typo in jaeger example (#2524) --- example/jaeger/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 5cfff89c4f9..9f4ec492e1c 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -48,7 +48,7 @@ func tracerProvider(url string) (*tracesdk.TracerProvider, error) { tp := tracesdk.NewTracerProvider( // Always be sure to batch in production. tracesdk.WithBatcher(exp), - // Record information about this application in an Resource. + // Record information about this application in a Resource. tracesdk.WithResource(resource.NewWithAttributes( semconv.SchemaURL, semconv.ServiceNameKey.String(service), From 9407bf396e6939ef2927bcecfceb89db07df2590 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Thu, 20 Jan 2022 15:08:58 -0800 Subject: [PATCH 034/886] Fix some typos in docs for Go libraries (#2520) Co-authored-by: Tyler Yahn --- website_docs/libraries.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website_docs/libraries.md b/website_docs/libraries.md index a41a408e824..064af7ba0fc 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -5,7 +5,7 @@ linkTitle: Libraries aliases: [/docs/instrumentation/go/using_instrumentation_libraries, /docs/instrumentation/go/automatic_instrumentation] --- -Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](https://opentelemetry.io/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/hhtp` will automatically create spans that track inbound and outbound requests once you configure it in your code. +Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](https://opentelemetry.io/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code. ## Setup @@ -86,10 +86,10 @@ Connecting manual instrumentation you write in your app with instrumentation gen ## Available packages -A full list of instrumentation libraries available can be found in the [OpenTelementry registry](https://opentelemetry.io/registry/?language=go&component=instrumentation). +A full list of instrumentation libraries available can be found in the [OpenTelemetry registry](https://opentelemetry.io/registry/?language=go&component=instrumentation). ## Next steps -Instrumentation libraries can do things like generate telemtry data for inbound and outbound HTTP requests, but they don't instrument your actual application. +Instrumentation libraries can do things like generate telemetry data for inbound and outbound HTTP requests, but they don't instrument your actual application. To get richer telemetry data, use [manual instrumentatiion]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. From 4ec3a3476f5007cfe39e683a29097d6e85eb041a Mon Sep 17 00:00:00 2001 From: thinkgo <49174849+thinkgos@users.noreply.github.com> Date: Sun, 23 Jan 2022 00:28:40 +0800 Subject: [PATCH 035/886] Fix getting-started.md Run function (#2527) * Fix getting-started.md Run function, it assigns this new context to a variable shared between connections in to accept loop. Thus creating a growing chain of contexts. so every calculate fibonacci request, all spans in a trace. * add a comment explaining the reason for that new variable * update example fib --- example/fib/app.go | 8 ++++---- website_docs/getting-started.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/fib/app.go b/example/fib/app.go index 5085a852dba..907779e613a 100644 --- a/example/fib/app.go +++ b/example/fib/app.go @@ -44,16 +44,16 @@ func NewApp(r io.Reader, l *log.Logger) *App { // Run starts polling users for Fibonacci number requests and writes results. func (a *App) Run(ctx context.Context) error { for { - var span trace.Span - ctx, span = otel.Tracer(name).Start(ctx, "Run") + // Each execution of the run loop, we should get a new "root" span and context. + newCtx, span := otel.Tracer(name).Start(ctx, "Run") - n, err := a.Poll(ctx) + n, err := a.Poll(newCtx) if err != nil { span.End() return err } - a.Write(ctx, n) + a.Write(newCtx, n) span.End() } } diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 35886692be4..3814f49b108 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -184,16 +184,16 @@ Start by instrumenting the `Run` method. // Run starts polling users for Fibonacci number requests and writes results. func (a *App) Run(ctx context.Context) error { for { - var span trace.Span - ctx, span = otel.Tracer(name).Start(ctx, "Run") + // Each execution of the run loop, we should get a new "root" span and context. + newCtx, span := otel.Tracer(name).Start(ctx, "Run") - n, err := a.Poll(ctx) + n, err := a.Poll(newCtx) if err != nil { span.End() return err } - a.Write(ctx, n) + a.Write(newCtx, n) span.End() } } From d1b6a7d66f0557b156af75cd3ef589d45a988b79 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 24 Jan 2022 10:35:53 -0600 Subject: [PATCH 036/886] Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 across the project (#2545) * update go-cmp to 0.5.7 * fixes go.sums Co-authored-by: Aaron Clawson --- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/go.sum | 4 ++-- example/fib/go.sum | 4 ++-- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.sum | 4 ++-- example/prometheus/go.sum | 4 ++-- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- internal/metric/go.sum | 4 ++-- metric/go.mod | 2 +- metric/go.sum | 4 ++-- sdk/export/metric/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.sum | 4 ++-- trace/go.mod | 2 +- trace/go.sum | 4 ++-- 37 files changed, 66 insertions(+), 66 deletions(-) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index def7312910b..9d4421e648c 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -16,8 +16,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index b23e0c300c7..b0e85632d32 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -36,8 +36,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index f3e322dee84..767a256a278 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/fib/go.sum b/example/fib/go.sum index 8c51f62e82b..388165251c8 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 3ebf1b74f6d..e1b25057edf 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 8c51f62e82b..388165251c8 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 66d4f9fb724..61a2e293569 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -16,8 +16,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 5bc4c7e9965..122ddb6ec73 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -48,8 +48,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 8c51f62e82b..388165251c8 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 3650cf21855..94ff33de071 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -43,8 +43,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 4ffcefa0d69..4592dbd0760 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -57,8 +57,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 8278dcaa5aa..ce530fbdfa2 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/jaeger go 1.16 require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 7d3e827c100..3d22834d0f4 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9459b0376db..64f25233371 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric go 1.16 require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 024a53e2a79..98a376fed13 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -50,8 +50,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 024a53e2a79..98a376fed13 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -50,8 +50,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 024a53e2a79..98a376fed13 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -50,8 +50,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index ffc119b105e..e4d59dcf065 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.16 require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index dd5774c4dc0..e4e45721759 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -48,8 +48,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index e251c34b04f..30782366de8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -48,8 +48,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index dd5774c4dc0..e4e45721759 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -48,8 +48,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index a825f37d2ad..8a1cbb2b49e 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -43,8 +43,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 22190692ec3..e7e3c1a2040 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -6,8 +6,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 495c139cc93..fbd4605e0ee 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 4fdb1c2ab5b..e517881375e 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.16 require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 0707ba97dc2..c0f74fbc982 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -57,8 +57,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= diff --git a/go.mod b/go.mod index 2223957fa0d..0469e2fa55d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/go-logr/logr v1.2.2 github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel/trace v1.3.0 ) diff --git a/go.sum b/go.sum index 1b1fdc6e060..531cae722ed 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/internal/metric/go.sum b/internal/metric/go.sum index 934370ffef9..4f1776cd92b 100644 --- a/internal/metric/go.sum +++ b/internal/metric/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/metric/go.mod b/metric/go.mod index e4db995746f..5b9387bf3f6 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric replace go.opentelemetry.io/otel/trace => ../trace require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/internal/metric v0.26.0 diff --git a/metric/go.sum b/metric/go.sum index 1b1fdc6e060..531cae722ed 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/sdk/export/metric/go.sum b/sdk/export/metric/go.sum index 88877a08cf1..038e4dbddc8 100644 --- a/sdk/export/metric/go.sum +++ b/sdk/export/metric/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/sdk/go.mod b/sdk/go.mod index 2cd10292323..548e5460134 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.2 - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 diff --git a/sdk/go.sum b/sdk/go.sum index dc32dbd6c8d..5ba370adf67 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -4,8 +4,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 22190692ec3..e7e3c1a2040 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -6,8 +6,8 @@ github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/trace/go.mod b/trace/go.mod index 32bc66158d8..1b19ac02308 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric replace go.opentelemetry.io/otel/trace => ./ require ( - github.com/google/go-cmp v0.5.6 + github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 ) diff --git a/trace/go.sum b/trace/go.sum index 77c421b16f1..83b153d9d1c 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 5f418686753161f37f4011fe9a904dab8dede078 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 24 Jan 2022 11:17:45 -0600 Subject: [PATCH 037/886] Un-escape url coding when parsing baggage. (#2529) * un-escape url coding when parsing baggage. * Added changelog Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + baggage/baggage.go | 7 ++++++- baggage/baggage_test.go | 7 +++++++ propagation/baggage_test.go | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1c838e32e..9e1a6a7014e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fixes the instrument kind for noop async instruments. (#2461) - Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) - Specify explicit buckets in Prometheus example. (#2493) +- W3C baggage will now decode urlescaped values. (#2529) ## [1.3.0] - 2021-12-10 diff --git a/baggage/baggage.go b/baggage/baggage.go index 3427c51b477..d52a298ed1b 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -269,7 +269,12 @@ func parseMember(member string) (Member, error) { } // "Leading and trailing whitespaces are allowed but MUST be trimmed // when converting the header into a data structure." - key, value = strings.TrimSpace(kv[0]), strings.TrimSpace(kv[1]) + key = strings.TrimSpace(kv[0]) + var err error + value, err = url.QueryUnescape(strings.TrimSpace(kv[1])) + if err != nil { + return Member{}, fmt.Errorf("%w: %q", err, value) + } if !keyRe.MatchString(key) { return Member{}, fmt.Errorf("%w: %q", errInvalidKey, key) } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 0635c823e9e..88c820319b5 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -339,6 +339,13 @@ func TestBaggageParse(t *testing.T) { "foo": {Value: "2"}, }, }, + { + name: "url encoded value", + in: "key1=val%252", + want: baggage.List{ + "key1": {Value: "val%2"}, + }, + }, { name: "invalid member: empty", in: "foo=,,bar=", diff --git a/propagation/baggage_test.go b/propagation/baggage_test.go index 299e009e3cf..e98230a94ea 100644 --- a/propagation/baggage_test.go +++ b/propagation/baggage_test.go @@ -118,6 +118,13 @@ func TestExtractValidBaggageFromHTTPReq(t *testing.T) { {Key: "key2", Value: "val2"}, }, }, + { + name: "valid header with url encoded string", + header: "key1=val%252", + want: members{ + {Key: "key1", Value: "val%2"}, + }, + }, } for _, tt := range tests { From 86ced11f2c060e479817477f614438faa799ce93 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 24 Jan 2022 13:53:20 -0600 Subject: [PATCH 038/886] Bump go.opentelemetry.io/proto/otlp from 0.11.0 to 0.12.0 (#2546) * Update go.opentelemetry.io/proto/otlp to v0.12.0 * Changelog * Update CHANGELOG.md Fix's md linting Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- CHANGELOG.md | 7 +++++++ example/otel-collector/go.sum | 5 ++--- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 5 ++--- .../otlpmetric/internal/metrictransform/metric_test.go | 10 +--------- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 5 ++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 5 ++--- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 5 ++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 5 ++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 5 ++--- 15 files changed, 28 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e1a6a7014e..4040dd1b32b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Specify explicit buckets in Prometheus example. (#2493) - W3C baggage will now decode urlescaped values. (#2529) +### Removed + +- Updated `go.opentelemetry.io/proto/otlp` from `v0.11.0` to `v0.12.0`. This version removes a number of deprecated methods. (#2546) + - [`Metric.GetIntGauge()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntGauge) + - [`Metric.GetIntHistogram()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntHistogram) + - [`Metric.GetIntSum()`](https://pkg.go.dev/go.opentelemetry.io/proto/otlp@v0.11.0/metrics/v1#Metric.GetIntSum) + ## [1.3.0] - 2021-12-10 ### ⚠️ Notice ⚠️ diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 122ddb6ec73..1cc6cdbcf0e 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -66,8 +66,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -134,7 +134,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 64f25233371..8394ba3362b 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 98a376fed13..983af28691b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -64,8 +64,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -114,7 +114,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index 0394451b019..7b5b801eb6b 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -130,9 +130,6 @@ func TestSumIntDataPoints(t *testing.T) { }, m.GetSum()) assert.Nil(t, m.GetHistogram()) assert.Nil(t, m.GetSummary()) - assert.Nil(t, m.GetIntGauge()) // nolint - assert.Nil(t, m.GetIntSum()) // nolint - assert.Nil(t, m.GetIntHistogram()) // nolint } } @@ -168,9 +165,7 @@ func TestSumFloatDataPoints(t *testing.T) { }}}, m.GetSum()) assert.Nil(t, m.GetHistogram()) assert.Nil(t, m.GetSummary()) - assert.Nil(t, m.GetIntGauge()) // nolint - assert.Nil(t, m.GetIntSum()) // nolint - assert.Nil(t, m.GetIntHistogram()) // nolint + } } @@ -203,9 +198,6 @@ func TestLastValueIntDataPoints(t *testing.T) { assert.Nil(t, m.GetSum()) assert.Nil(t, m.GetHistogram()) assert.Nil(t, m.GetSummary()) - assert.Nil(t, m.GetIntGauge()) // nolint - assert.Nil(t, m.GetIntSum()) // nolint - assert.Nil(t, m.GetIntHistogram()) // nolint } } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index dd959445002..8ca2da5ccf3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 98a376fed13..983af28691b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -64,8 +64,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -114,7 +114,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 901652b9d0f..810db0a898c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.26.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 98a376fed13..983af28691b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -64,8 +64,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -114,7 +114,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e4d59dcf065..91ebb6e0ce7 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.43.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index e4e45721759..8bfa2adcab2 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -62,8 +62,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -112,7 +112,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 53210f0137a..55b90f84f98 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.43.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 30782366de8..963b22efe7a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -68,8 +68,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -138,7 +138,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 203edcc868c..5c3486dc0c4 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 - go.opentelemetry.io/proto/otlp v0.11.0 + go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index e4e45721759..8bfa2adcab2 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -62,8 +62,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU= -go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= +go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= +go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -112,7 +112,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= From 6e549fe97457b2a872bbd0b992fc95d0bc571599 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 26 Jan 2022 13:27:59 -0800 Subject: [PATCH 039/886] Remove unused sdk/internal/santize (#2549) --- sdk/internal/sanitize.go | 50 -------------------------- sdk/internal/sanitize_test.go | 67 ----------------------------------- 2 files changed, 117 deletions(-) delete mode 100644 sdk/internal/sanitize.go delete mode 100644 sdk/internal/sanitize_test.go diff --git a/sdk/internal/sanitize.go b/sdk/internal/sanitize.go deleted file mode 100644 index ff35185569d..00000000000 --- a/sdk/internal/sanitize.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/sdk/internal" - -import ( - "strings" - "unicode" -) - -const labelKeySizeLimit = 100 - -// Sanitize returns a string that is trunacated to 100 characters if it's too -// long, and replaces non-alphanumeric characters to underscores. -func Sanitize(s string) string { - if len(s) == 0 { - return s - } - if len(s) > labelKeySizeLimit { - s = s[:labelKeySizeLimit] - } - s = strings.Map(sanitizeRune, s) - if unicode.IsDigit(rune(s[0])) { - s = "key_" + s - } - if s[0] == '_' { - s = "key" + s - } - return s -} - -// converts anything that is not a letter or digit to an underscore -func sanitizeRune(r rune) rune { - if unicode.IsLetter(r) || unicode.IsDigit(r) { - return r - } - // Everything else turns into an underscore - return '_' -} diff --git a/sdk/internal/sanitize_test.go b/sdk/internal/sanitize_test.go deleted file mode 100644 index bf4ef37e212..00000000000 --- a/sdk/internal/sanitize_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "strings" - "testing" -) - -func TestSanitize(t *testing.T) { - tests := []struct { - name string - input string - want string - }{ - { - name: "trunacate long string", - input: strings.Repeat("a", 101), - want: strings.Repeat("a", 100), - }, - { - name: "replace character", - input: "test/key-1", - want: "test_key_1", - }, - { - name: "add prefix if starting with digit", - input: "0123456789", - want: "key_0123456789", - }, - { - name: "add prefix if starting with _", - input: "_0123456789", - want: "key_0123456789", - }, - { - name: "starts with _ after sanitization", - input: "/0123456789", - want: "key_0123456789", - }, - { - name: "valid input", - input: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789", - want: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got, want := Sanitize(tt.input), tt.want; got != want { - t.Errorf("sanitize() = %q; want %q", got, want) - } - }) - } -} From b0286fe46a09ef2655750918143818672df5dfc6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 26 Jan 2022 15:19:28 -0800 Subject: [PATCH 040/886] Add links to code examples and docs (#2551) --- website_docs/getting-started.md | 38 ++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 3814f49b108..8956f1623e1 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -7,6 +7,8 @@ Welcome to the OpenTelemetry for Go getting started guide! This guide will walk Understand how a system is functioning when it is failing or having issues is critical to resolving those issues. One strategy to understand this is with tracing. This guide shows how the OpenTelemetry Go project can be used to trace an example application. You will start with an application that computes Fibonacci numbers for users, and from there you will add instrumentation to produce tracing telemetry with OpenTelemetry Go. +For reference, a complete example of the code you will build can be found [here](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/fib). + To start building the application, make a new directory named `fib` to house our Fibonacci project. Next, add the following to a new file named `fib.go` in that directory. ```go @@ -134,7 +136,7 @@ The application can be exited with CTRL+C. You should see a similar output as ab # Trace Instrumentation -OpenTelemetry is split into two parts: an API to instrument code with, and SDKs that implement the API. To start integrating OpenTelemetry into any project, the API is used to define how telemetry is generated. To generate tracing telemetry in your application you will use the OpenTelemetry Trace API from the `go.opentelemetry.io/otel/trace` package. +OpenTelemetry is split into two parts: an API to instrument code with, and SDKs that implement the API. To start integrating OpenTelemetry into any project, the API is used to define how telemetry is generated. To generate tracing telemetry in your application you will use the OpenTelemetry Trace API from the [`go.opentelemetry.io/otel/trace`] package. First, you need to install the necessary packages for the Trace API. Run the following command in your working directory. @@ -161,14 +163,14 @@ import ( With the imports added, you can start instrumenting. -The OpenTelemetry Tracing API provides a `Tracer` to create traces. These `Tracer`s are designed to be associated with one instrumentation library. That way telemetry they produce can be understood to come from that part of a code base. To uniquely identify your application to the `Tracer` you will use create a constant with the package name in `app.go`. +The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These [`Tracer`]s are designed to be associated with one instrumentation library. That way telemetry they produce can be understood to come from that part of a code base. To uniquely identify your application to the [`Tracer`] you will use create a constant with the package name in `app.go`. ```go // name is the Tracer name used to identify this instrumentation library. const name = "fib" ``` -Using the full-qualified package name, something that should be unique for Go packages, is the standard way to identify a `Tracer`. If your example package name differs, be sure to update the name you use here to match. +Using the full-qualified package name, something that should be unique for Go packages, is the standard way to identify a [`Tracer`]. If your example package name differs, be sure to update the name you use here to match. Everything should be in place now to start tracing your application. But first, what is a trace? And, how exactly should you build them for you application? @@ -199,7 +201,7 @@ func (a *App) Run(ctx context.Context) error { } ``` -The above code creates a span for every iteration of the for loop. The span is created using a `Tracer` from the global `TracerProvider`. You will learn more about `TracerProvider`s and handle the other side of setting up a global `TracerProvider` when you install an SDK in a later section. For now, as an instrumentation author, all you need to worry about is that you are using an appropriately named `Tracer` from a `TracerProvider` when you write `otel.Tracer(name)`. +The above code creates a span for every iteration of the for loop. The span is created using a [`Tracer`] from the [global `TracerProvider`](https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). You will learn more about [`TracerProvider`]s and handle the other side of setting up a global [`TracerProvider`] when you install an SDK in a later section. For now, as an instrumentation author, all you need to worry about is that you are using an appropriately named [`Tracer`] from a [`TracerProvider`] when you write `otel.Tracer(name)`. Next, instrument the `Poll` method. @@ -263,7 +265,7 @@ Now how do you actually see the produced spans? To do this you will need to conf # SDK Installation -OpenTelemetry is designed to be modular in its implementation of the OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, `go.opentelemetry.io/otel/sdk`, that implements this API and adheres to the OpenTelemetry specification. To start using this SDK you will first need to create an exporter, but before anything can happen we need to install some packages. Run the following in the `fib` directory to install the trace STDOUT exporter and the SDK. +OpenTelemetry is designed to be modular in its implementation of the OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, [`go.opentelemetry.io/otel/sdk`], that implements this API and adheres to the OpenTelemetry specification. To start using this SDK you will first need to create an exporter, but before anything can happen we need to install some packages. Run the following in the `fib` directory to install the trace STDOUT exporter and the SDK. ```sh $ go get go.opentelemetry.io/otel/sdk \ @@ -287,7 +289,7 @@ import ( ## Creating a Console Exporter -The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like Jaeger, Zipkin, and Prometheus. +The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like [Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), [Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/trace/zipkin), and [Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). To initialize the console exporter, add the following function to the `main.go` file: @@ -308,7 +310,7 @@ This creates a new console exporter with basic options. You will use this functi ## Creating a Resource -Telemetry data can be crucial to solving issues with a service. The catch is, you need a way to identify what service, or even what service instance, that data is coming from. OpenTelemetry uses a `Resource` to represent the entity producing telemetry. Add the following function to the `main.go` file to create an appropriate `Resource` for the application. +Telemetry data can be crucial to solving issues with a service. The catch is, you need a way to identify what service, or even what service instance, that data is coming from. OpenTelemetry uses a [`Resource`] to represent the entity producing telemetry. Add the following function to the `main.go` file to create an appropriate [`Resource`] for the application. ```go // newResource returns a resource describing this application. @@ -326,13 +328,13 @@ func newResource() *resource.Resource { } ``` -Any information you would like to associate with all telemetry data the SDK handles can be added to the returned `Resource`. This is done by registering the `Resource` with the `TracerProvider`. Something you can now create! +Any information you would like to associate with all telemetry data the SDK handles can be added to the returned [`Resource`]. This is done by registering the [`Resource`] with the [`TracerProvider`]. Something you can now create! ## Installing a Tracer Provider -You have your application instrumented to produce telemetry data and you have an exporter to send that data to the console, but how are they connected? This is where the `TracerProvider` is used. It is a centralized point where instrumentation will get a `Tracer` from and funnels the telemetry data from these `Tracer`s to export pipelines. +You have your application instrumented to produce telemetry data and you have an exporter to send that data to the console, but how are they connected? This is where the [`TracerProvider`] is used. It is a centralized point where instrumentation will get a [`Tracer`] from and funnels the telemetry data from these [`Tracer`]s to export pipelines. -The pipelines that receive and ultimately transmit data to exporters are called `SpanProcessor`s. A `TracerProvider` can be configured to have multiple span processors, but for this example you will only need to configure only one. Update your `main` function in `main.go` with the following. +The pipelines that receive and ultimately transmit data to exporters are called [`SpanProcessor`]s. A [`TracerProvider`] can be configured to have multiple span processors, but for this example you will only need to configure only one. Update your `main` function in `main.go` with the following. ```go func main() { @@ -365,9 +367,9 @@ func main() { } ``` -There's a fair amount going on here. First you are creating a console exporter that will export to a file. You are then registering the exporter with a new `TracerProvider`. This is done with a `BatchSpanProcessor` when it is passed to the `trace.WithBatcher` option. Batching data is a good practice and will help not overload systems downstream. Finally, with the `TracerProvider` created, you are deferring a function to flush and stop it, and registering it as the global OpenTelemetry `TracerProvider`. +There's a fair amount going on here. First you are creating a console exporter that will export to a file. You are then registering the exporter with a new [`TracerProvider`]. This is done with a [`BatchSpanProcessor`] when it is passed to the [`trace.WithBatcher`] option. Batching data is a good practice and will help not overload systems downstream. Finally, with the [`TracerProvider`] created, you are deferring a function to flush and stop it, and registering it as the global OpenTelemetry [`TracerProvider`]. -Do you remember in the previous instrumentation section when we used the global `TracerProvider` to get a `Tracer`? This last step, registering the `TracerProvider` globally, is what will connect that instrumentation's `Tracer` with this `TracerProvider`. This pattern, using a global `TracerProvider`, is convenient, but not always appropriate. `TracerProvider`s can be explicitly passed to instrumentation or inferred from a context that contains a span. For this simple example using a global provider makes sense, but for more complex or distributed codebases these other ways of passing `TracerProvider`s may make more sense. +Do you remember in the previous instrumentation section when we used the global [`TracerProvider`] to get a [`Tracer`]? This last step, registering the [`TracerProvider`] globally, is what will connect that instrumentation's [`Tracer`] with this [`TracerProvider`]. This pattern, using a global [`TracerProvider`], is convenient, but not always appropriate. [`TracerProvider`]s can be explicitly passed to instrumentation or inferred from a context that contains a span. For this simple example using a global provider makes sense, but for more complex or distributed codebases these other ways of passing [`TracerProvider`]s may make more sense. # Putting It All Together @@ -471,7 +473,7 @@ func (a *App) Poll(ctx context.Context) (uint, error) { } ``` -All that is left is updating imports for the `app.go` file to include the `go.opentelemetry.io/otel/codes` package. +All that is left is updating imports for the `app.go` file to include the [`go.opentelemetry.io/otel/codes`] package. ```go import ( @@ -540,3 +542,13 @@ spans, refer to the [Instrumenting]({{< relref "manual" >}}) documentation. Likewise, advanced topics about processing and exporting telemetry data can be found in the [Processing and Exporting Data]({{< relref "exporting_data" >}}) documentation. + +[`go.opentelemetry.io/otel/trace`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace +[`go.opentelemetry.io/otel/sdk`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk +[`go.opentelemetry.io/otel/codes`]: https://pkg.go.dev/go.opentelemetry.io/otel/codes +[`Tracer`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#Tracer +[`TracerProvider`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#TracerProvider +[`Resource`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Resource +[`SpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor +[`BatchSpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#NewBatchSpanProcessor +[`trace.WithBatcher`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#WithBatcher From 310c7be3b465ed9aaf1f2c3c00fa7d6cebd81e7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Jan 2022 15:51:47 -0800 Subject: [PATCH 041/886] Bump github.com/prometheus/client_golang from 1.11.0 to 1.12.0 in /exporters/prometheus (#2541) * Bump github.com/prometheus/client_golang in /exporters/prometheus Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * go mod tidy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- example/prometheus/go.sum | 341 +++++++++++++++++++++++++++++++++++- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 341 +++++++++++++++++++++++++++++++++++- 3 files changed, 667 insertions(+), 17 deletions(-) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 94ff33de071..e8f2367048a 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -1,4 +1,38 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -10,11 +44,25 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -27,31 +75,73 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -64,6 +154,7 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -74,21 +165,26 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -99,54 +195,283 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 0546ae8466b..1e555dd7983 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.16 require ( - github.com/prometheus/client_golang v1.11.0 + github.com/prometheus/client_golang v1.12.0 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 8a1cbb2b49e..8d10405bfe0 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -1,4 +1,38 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -10,11 +44,25 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= @@ -27,31 +75,73 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -66,6 +156,7 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -76,21 +167,26 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -101,55 +197,284 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From d3bb03883b84cca08a8fb82a9253449772a54084 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Jan 2022 13:55:21 -0800 Subject: [PATCH 042/886] Optimize evictedQueue implementation and use (#2556) * Optimize evictedQueue impl and use Avoid unnecessary allocations in the recordingSpan by using an evictedQueue type instead of a pointer to one. Lazy allocate the evictedQueue queue to prevent unnecessary operations for spans without any use of the queue. Document the evictedQueue * Fix grammar --- sdk/trace/evictedqueue.go | 17 +++++++++-------- sdk/trace/span.go | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sdk/trace/evictedqueue.go b/sdk/trace/evictedqueue.go index 3c5817a6a02..8e89e19d4b9 100644 --- a/sdk/trace/evictedqueue.go +++ b/sdk/trace/evictedqueue.go @@ -14,24 +14,25 @@ package trace // import "go.opentelemetry.io/otel/sdk/trace" +// evictedQueue is a FIFO queue with a configurable capacity. type evictedQueue struct { queue []interface{} capacity int droppedCount int } -func newEvictedQueue(capacity int) *evictedQueue { - eq := &evictedQueue{ - capacity: capacity, - queue: make([]interface{}, 0), - } - - return eq +func newEvictedQueue(capacity int) evictedQueue { + // Do not pre-allocate queue, do this lazily. + return evictedQueue{capacity: capacity} } +// add adds value to the evictedQueue eq. If eq is at capacity, the oldest +// queued value will be discarded and the drop count incremented. func (eq *evictedQueue) add(value interface{}) { if len(eq.queue) == eq.capacity { - eq.queue = eq.queue[1:] + // Drop first-in while avoiding allocating more capacity to eq.queue. + copy(eq.queue[:eq.capacity-1], eq.queue[1:]) + eq.queue = eq.queue[:eq.capacity-1] eq.droppedCount++ } eq.queue = append(eq.queue, value) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 41a68b58551..0111c475895 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -142,10 +142,10 @@ type recordingSpan struct { attributes *attributesMap // events are stored in FIFO queue capped by configured limit. - events *evictedQueue + events evictedQueue // links are stored in FIFO queue capped by configured limit. - links *evictedQueue + links evictedQueue // executionTracerTaskEnd ends the execution tracer span. executionTracerTaskEnd func() From 3cf35bdad6f9c64c54f1774cc57a50ebdc372939 Mon Sep 17 00:00:00 2001 From: Chao Weng <19381524+sincejune@users.noreply.github.com> Date: Sat, 29 Jan 2022 00:07:21 +0800 Subject: [PATCH 043/886] Add env support for batch span processor (#2515) * Add env support for batch span processor * Update changelog * lint --- CHANGELOG.md | 1 + sdk/trace/batch_span_processor.go | 23 +++++-- sdk/trace/batch_span_processor_test.go | 83 ++++++++++++++++++++++++++ sdk/trace/env.go | 59 ++++++++++++++++++ sdk/trace/env_test.go | 60 +++++++++++++++++++ 5 files changed, 220 insertions(+), 6 deletions(-) create mode 100644 sdk/trace/env.go create mode 100644 sdk/trace/env_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4040dd1b32b..fb91daf7486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) - Log the configuration of TracerProviders, and Tracers for debugging. To enable use a logger with Verbosity (V level) >=1 +- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) ### Changed diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index dda62c452c6..57f346aa08b 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -29,8 +29,8 @@ import ( // Defaults for BatchSpanProcessorOptions. const ( DefaultMaxQueueSize = 2048 - DefaultBatchTimeout = 5000 * time.Millisecond - DefaultExportTimeout = 30000 * time.Millisecond + DefaultScheduleDelay = 5000 + DefaultExportTimeout = 30000 DefaultMaxExportBatchSize = 512 ) @@ -89,11 +89,22 @@ var _ SpanProcessor = (*batchSpanProcessor)(nil) // // If the exporter is nil, the span processor will preform no action. func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor { + maxQueueSize := intEnvOr(EnvBatchSpanProcessorMaxQueueSize, DefaultMaxQueueSize) + maxExportBatchSize := intEnvOr(EnvBatchSpanProcessorMaxExportBatchSize, DefaultMaxExportBatchSize) + + if maxExportBatchSize > maxQueueSize { + if DefaultMaxExportBatchSize > maxQueueSize { + maxExportBatchSize = maxQueueSize + } else { + maxExportBatchSize = DefaultMaxExportBatchSize + } + } + o := BatchSpanProcessorOptions{ - BatchTimeout: DefaultBatchTimeout, - ExportTimeout: DefaultExportTimeout, - MaxQueueSize: DefaultMaxQueueSize, - MaxExportBatchSize: DefaultMaxExportBatchSize, + BatchTimeout: time.Duration(intEnvOr(EnvBatchSpanProcessorScheduleDelay, DefaultScheduleDelay)) * time.Millisecond, + ExportTimeout: time.Duration(intEnvOr(EnvBatchSpanProcessorExportTimeout, DefaultExportTimeout)) * time.Millisecond, + MaxQueueSize: maxQueueSize, + MaxExportBatchSize: maxExportBatchSize, } for _, opt := range options { opt(&o) diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index f66c6bd1b43..f361b535d0f 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -19,10 +19,13 @@ import ( "encoding/binary" "errors" "fmt" + "os" "sync" "testing" "time" + ottest "go.opentelemetry.io/otel/internal/internaltest" + "github.com/go-logr/logr/funcr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -115,6 +118,7 @@ type testOption struct { wantBatchCount int genNumSpans int parallel bool + envs map[string]string } func TestNewBatchSpanProcessorWithOptions(t *testing.T) { @@ -221,6 +225,85 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) { } } +func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) { + options := []testOption{ + { + name: "BatchSpanProcessorEnvOptions - Basic", + wantNumSpans: 2053, + wantBatchCount: 1, + genNumSpans: 2053, + envs: map[string]string{ + sdktrace.EnvBatchSpanProcessorMaxQueueSize: "5000", + sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "5000", + }, + }, + { + name: "BatchSpanProcessorEnvOptions - A lager max export batch size than queue size", + wantNumSpans: 2053, + wantBatchCount: 4, + genNumSpans: 2053, + envs: map[string]string{ + sdktrace.EnvBatchSpanProcessorMaxQueueSize: "5000", + sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "10000", + }, + }, + { + name: "BatchSpanProcessorEnvOptions - A lage max export batch size with a small queue size", + wantNumSpans: 2053, + wantBatchCount: 42, + genNumSpans: 2053, + envs: map[string]string{ + sdktrace.EnvBatchSpanProcessorMaxQueueSize: "50", + sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "10000", + }, + }, + } + + envStore := ottest.NewEnvStore() + envStore.Record(sdktrace.EnvBatchSpanProcessorScheduleDelay) + envStore.Record(sdktrace.EnvBatchSpanProcessorExportTimeout) + envStore.Record(sdktrace.EnvBatchSpanProcessorMaxQueueSize) + envStore.Record(sdktrace.EnvBatchSpanProcessorMaxExportBatchSize) + + defer func() { + require.NoError(t, envStore.Restore()) + }() + + for _, option := range options { + t.Run(option.name, func(t *testing.T) { + for k, v := range option.envs { + require.NoError(t, os.Setenv(k, v)) + } + + te := testBatchExporter{} + tp := basicTracerProvider(t) + ssp := createAndRegisterBatchSP(option, &te) + if ssp == nil { + t.Fatalf("%s: Error creating new instance of BatchSpanProcessor\n", option.name) + } + tp.RegisterSpanProcessor(ssp) + tr := tp.Tracer("BatchSpanProcessorWithOptions") + + generateSpan(t, option.parallel, tr, option) + + tp.UnregisterSpanProcessor(ssp) + + gotNumOfSpans := te.len() + if option.wantNumSpans > 0 && option.wantNumSpans != gotNumOfSpans { + t.Errorf("number of exported span: got %+v, want %+v\n", + gotNumOfSpans, option.wantNumSpans) + } + + gotBatchCount := te.getBatchCount() + if option.wantBatchCount > 0 && gotBatchCount < option.wantBatchCount { + t.Errorf("number batches: got %+v, want >= %+v\n", + gotBatchCount, option.wantBatchCount) + t.Errorf("Batches %v\n", te.sizes) + } + }) + } +} + type stuckExporter struct { testBatchExporter } diff --git a/sdk/trace/env.go b/sdk/trace/env.go new file mode 100644 index 00000000000..da7ea412e53 --- /dev/null +++ b/sdk/trace/env.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/sdk/trace" + +import ( + "os" + "strconv" + + "go.opentelemetry.io/otel/internal/global" +) + +// Environment variable names +const ( + // EnvBatchSpanProcessorScheduleDelay + // Delay interval between two consecutive exports. + // i.e. 5000 + EnvBatchSpanProcessorScheduleDelay = "OTEL_BSP_SCHEDULE_DELAY" + // EnvBatchSpanProcessorExportTimeout + // Maximum allowed time to export data. + // i.e. 3000 + EnvBatchSpanProcessorExportTimeout = "OTEL_BSP_EXPORT_TIMEOUT" + // EnvBatchSpanProcessorMaxQueueSize + // Maximum queue size + // i.e. 2048 + EnvBatchSpanProcessorMaxQueueSize = "OTEL_BSP_MAX_QUEUE_SIZE" + // EnvBatchSpanProcessorMaxExportBatchSize + // Maximum batch size + // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize + // i.e. 512 + EnvBatchSpanProcessorMaxExportBatchSize = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" +) + +// intEnvOr returns an env variable's numeric value if it is exists (and valid) or the default if not +func intEnvOr(key string, defaultValue int) int { + value, ok := os.LookupEnv(key) + if !ok { + return defaultValue + } + + intValue, err := strconv.Atoi(value) + if err != nil { + global.Info("Got invalid value, number value expected.", key, value) + return defaultValue + } + + return intValue +} diff --git a/sdk/trace/env_test.go b/sdk/trace/env_test.go new file mode 100644 index 00000000000..be37eae5744 --- /dev/null +++ b/sdk/trace/env_test.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + ottest "go.opentelemetry.io/otel/internal/internaltest" +) + +func TestIntEnvOr(t *testing.T) { + testCases := []struct { + name string + envValue string + defaultValue int + expectedValue int + }{ + { + name: "IntEnvOrTest - Basic", + envValue: "2500", + defaultValue: 500, + expectedValue: 2500, + }, + { + name: "IntEnvOrTest - Invalid Number", + envValue: "localhost", + defaultValue: 500, + expectedValue: 500, + }, + } + + envStore := ottest.NewEnvStore() + envStore.Record(EnvBatchSpanProcessorMaxQueueSize) + defer func() { + require.NoError(t, envStore.Restore()) + }() + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + require.NoError(t, os.Setenv(EnvBatchSpanProcessorMaxQueueSize, tc.envValue)) + actualValue := intEnvOr(EnvBatchSpanProcessorMaxQueueSize, tc.defaultValue) + assert.Equal(t, tc.expectedValue, actualValue) + }) + } +} From d2459b84bac9b461ae17b7d0bbeb03508e3b8c93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 30 Jan 2022 08:57:45 -0800 Subject: [PATCH 044/886] Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools (#2566) * Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.1.8...v0.1.9) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index f67b70401b6..40cb31f1b9b 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -11,7 +11,7 @@ require ( github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 - golang.org/x/tools v0.1.8 + golang.org/x/tools v0.1.9 ) replace go.opentelemetry.io/otel => ../.. diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 6212d1d9bb1..1e21d7f2219 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1177,8 +1177,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8= +golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 6c15f9d455014287ebdb698e3cef2eb5ce20d2ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 30 Jan 2022 09:39:48 -0800 Subject: [PATCH 045/886] Bump github.com/golangci/golangci-lint from 1.43.0 to 1.44.0 in /internal/tools (#2567) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 284 +++++++++++++++++++++++++++++------------- 2 files changed, 195 insertions(+), 91 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 40cb31f1b9b..fbaac2e35a9 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.43.0 + github.com/golangci/golangci-lint v1.44.0 github.com/itchyny/gojq v0.12.6 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 1e21d7f2219..ae43fe3288b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -27,6 +27,10 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= +cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -37,6 +41,7 @@ cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7 cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= +cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -55,9 +60,10 @@ github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCq github.com/Antonboom/nilnil v0.1.0 h1:DLDavmg0a6G/F4Lt9t7Enrbgb3Oph6LnDE6YVsmTt74= github.com/Antonboom/nilnil v0.1.0/go.mod h1:PhHLvRPSghY5Y7mX4TW+BHZQYo1A8flE5H20D3IPZBo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= -github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= @@ -70,11 +76,10 @@ github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jB github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= -github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= +github.com/OpenPeeDeeP/depguard v1.1.0 h1:pjK9nLPS1FwQYGGpPxoMYpe7qACHOhAWQMQzV71i49o= +github.com/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -93,14 +98,15 @@ github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ashanbrown/forbidigo v1.2.0 h1:RMlEFupPCxQ1IogYOQUnIQwGEUGK8g5vAPMRyJoSxbc= -github.com/ashanbrown/forbidigo v1.2.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= -github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde h1:YOsoVXsZQPA9aOTy1g0lAJv5VzZUvwQuZqug8XPeqfM= -github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= +github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= +github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/ashanbrown/makezero v1.1.0 h1:b2FVq4dTlBpy9f6qxhbyWH+6zy56IETE9cFbBGtDqs8= +github.com/ashanbrown/makezero v1.1.0/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= @@ -112,19 +118,23 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.3.0 h1:80mYO7Y5ppeEefg1Jzu+NBg16iwToOQVnDnNIoWSShs= -github.com/blizzy78/varnamelen v0.3.0/go.mod h1:hbwRdBvoBqxk34XyQ6HA0UH3G0/1TKuv5AC4eaBT0Ec= +github.com/blizzy78/varnamelen v0.5.0 h1:v9LpMwxzTqAJC4lsD/jR7zWb8a66trcqhTEH4Mk6Fio= +github.com/blizzy78/varnamelen v0.5.0/go.mod h1:Mc0nLBKI1/FP0Ga4kqMOgBig0eS5QtR107JnMAb1Wuc= github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/breml/bidichk v0.1.1 h1:Qpy8Rmgos9qdJxhka0K7ADEE5bQZX9PQUthkgggHpFM= -github.com/breml/bidichk v0.1.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= +github.com/breml/bidichk v0.2.1 h1:SRNtZuLdfkxtocj+xyHXKC1Uv3jVi6EPYx+NHSTNQvE= +github.com/breml/bidichk v0.2.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= +github.com/breml/errchkjson v0.2.1 h1:QCToXnY9BNngrbJoW3qfCTt3BdtbnsI6wyP/WGrxxSE= +github.com/breml/errchkjson v0.2.1/go.mod h1:jZEATw/jF69cL1iy7//Yih8yp/mXp2CBoBr9GJwCAsY= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af h1:spmv8nSH9h5oCQf40jt/ufBCt9j0/58u4G+rkeMqXGI= @@ -132,12 +142,20 @@ github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3/ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -151,6 +169,7 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfc github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/daixiang0/gci v0.2.9 h1:iwJvwQpBZmMg31w+QQ6jsyZ54KEATn6/nfARbBNW294= @@ -173,10 +192,13 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/esimonov/ifshort v1.0.3 h1:JD6x035opqGec5fZ0TLjXeROD2p5H7oLGn8MKfy9HTM= -github.com/esimonov/ifshort v1.0.3/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+M1LBpeZE= +github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= +github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= +github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -187,18 +209,20 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss= +github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= -github.com/fzipp/gocyclo v0.3.1 h1:A9UeX3HJSXTBzvHzhqoYVuE0eAhe+aM8XBCCwsPMZOc= -github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= +github.com/fzipp/gocyclo v0.4.0 h1:IykTnjwh2YLyYkGa0y92iTTEQcnyAz0r9zOo15EbJ7k= +github.com/fzipp/gocyclo v0.4.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-critic/go-critic v0.6.1 h1:lS8B9LH/VVsvQQP7Ao5TJyQqteVKVs3E4dXiHMyubtI= -github.com/go-critic/go-critic v0.6.1/go.mod h1:SdNCfU0yF3UBjtaZGw6586/WocupMOJuiqgom5DsQxM= +github.com/go-critic/go-critic v0.6.2 h1:L5SDut1N4ZfsWZY0sH4DCrsHLHnhuuWak2wa165t9gs= +github.com/go-critic/go-critic v0.6.2/go.mod h1:td1s27kfmLpe5G/DPjlnFI7o1UCzePptwU7Az0V5iCM= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -215,7 +239,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -231,14 +254,12 @@ github.com/go-toolsmith/astequal v1.0.1 h1:JbSszi42Jiqu36Gnf363HWS9MTEAz67vTQLpo github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw= github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= -github.com/go-toolsmith/pkgload v1.0.0 h1:4DFWWMXVfbcN5So1sBNW9+yeiMqLFGl1wFLTL5R0Tgg= -github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= +github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= +github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= @@ -259,6 +280,7 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -296,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.43.0 h1:SLwZFEmDgopqZpfP495zCtV9REUf551JJlJ51Ql7NZA= -github.com/golangci/golangci-lint v1.43.0/go.mod h1:VIFlUqidx5ggxDfQagdvd9E67UjMXtTHBkBQ7sHoC5Q= +github.com/golangci/golangci-lint v1.44.0 h1:YJPouGNQEdK+x2KsCpWMIBy0q6MSuxHjkWMxJMNj/DU= +github.com/golangci/golangci-lint v1.44.0/go.mod h1:aBolpzNkmYogKPynGKdOWDCEc8LlwnxZC6w/SJ1TaEs= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -342,6 +364,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -355,11 +378,12 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= -github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 h1:Nb2aRlC404yz7gQIfRZxX9/MLvQiqXyiBTJtgAy6yrI= -github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254/go.mod h1:M9mZEtGIsR1oDaZagNPNG9iq9n2HrhZ17dsXk73V3Lw= +github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= +github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -374,8 +398,8 @@ github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnq github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= -github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5 h1:rx8127mFPqXXsfPSo8BwnIU97MKFZc89WHAHt8PwDVY= -github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= +github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= @@ -390,18 +414,25 @@ github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqC github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= @@ -419,13 +450,17 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= +github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= +github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -459,15 +494,17 @@ github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUB github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d h1:XeSMXURZPtUffuWAaq90o6kLgZdgu+QA8wk4MPC8ikI= -github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= +github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= @@ -487,14 +524,15 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.4.0 h1:2Nx7XbdbE/BYZeoip2mURKUdtHQRuy6Ug+wR7K9ywNM= -github.com/kulti/thelper v0.4.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= +github.com/kulti/thelper v0.5.0 h1:CiEKStgoG4K9bjf/zk3eNX0D0J2iFWzxEY+h9UXmlJg= +github.com/kulti/thelper v0.5.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= github.com/kunwardeep/paralleltest v1.0.3 h1:UdKIkImEAXjR1chUWLn+PNXqWUGs//7tzMeWuP7NhmI= github.com/kunwardeep/paralleltest v1.0.3/go.mod h1:vLydzomDFpk7yu5UX02RmP0H8QfRPOV/oFhWN85Mjb4= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= @@ -502,15 +540,18 @@ github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77 github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/ldez/gomoddirectives v0.2.2 h1:p9/sXuNFArS2RLc+UpYZSI4KQwGMEDWC/LbtF5OPFVg= github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.2.0 h1:693V8Bf1NdShJ8eu/s84QySA0J2VWBanVBa2WwXD/Wk= -github.com/ldez/tagliatelle v0.2.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/ldez/tagliatelle v0.3.0 h1:Aubm2ZsrsjIGFvdxemMPJaXrSJ5Cys6VWyTQFt9k2dI= +github.com/ldez/tagliatelle v0.3.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= +github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -526,8 +567,8 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -542,18 +583,18 @@ github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.1.2 h1:MiYA/o9M7REjvOF20QN43U8OtXDDHQFKLCtJnxLGLog= -github.com/mgechev/revive v1.1.2/go.mod h1:bnXsMr+ZTH09V5rssEI+jHAZ4z+ZdyhgO/zsy3EhK+0= +github.com/mgechev/revive v1.1.3 h1:6tBZacs2/uv9UOpkBQhCtXh2NGgu2Ry97ZyjcN6uDCM= +github.com/mgechev/revive v1.1.3/go.mod h1:jMzDa13teAuv/KLeqgJw79NDe+1IT0ZO3Mht0vN1Yls= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -569,14 +610,16 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= @@ -590,13 +633,12 @@ github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4N github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.2.3 h1:+ANTMqRNrqwInnP9aszg/0jDo+zbXa4x66U19Bx/oTk= -github.com/nishanths/exhaustive v0.2.3/go.mod h1:bhIX678Nx8inLM9PbpvK1yv6oGtoP8BfaIeMzgBNKvc= +github.com/nishanths/exhaustive v0.7.11 h1:xV/WU3Vdwh5BUH4N06JNUznb6d5zhRPOnlgCrpNYNKA= +github.com/nishanths/exhaustive v0.7.11/go.mod h1:gX+MP7DWMKJmNa1HfMozK+u04hQd3na9i0hyqf3/dOI= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= github.com/nishanths/predeclared v0.2.1 h1:1TXtjmy4f3YCFjTxRd8zcFHOmoUir+gp0ESzjFzG2sw= github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB9sbB1usJ+xjQE= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -608,10 +650,12 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.16.0 h1:6gjqkI8iiRHMvdccRJM8rVKjCWk6ZIm6FTm3ddIe4/c= -github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= @@ -620,7 +664,7 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6 github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= @@ -628,6 +672,7 @@ github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -636,12 +681,14 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349 h1:Kq/3kL0k033ds3tyez5lFPrfQ74fNJ+OqCclRipubwA= -github.com/polyfloyd/go-errorlint v0.0.0-20210722154253-910bb7978349/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= +github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b h1:/BDyEJWLnDUYKGWdlNx/82qSaVu2bUok/EvPUtIGuvw= +github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -650,48 +697,58 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= -github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.13 h1:O1G41cq1jUr3cJmqp7vOUT0SokqjzmS9aESWJuIDRaY= -github.com/quasilyte/go-ruleguard v0.3.13/go.mod h1:Ul8wwdqR6kBVOCt2dipDBkE+T6vAV/iixkrKuRTN1oQ= +github.com/quasilyte/go-ruleguard v0.3.15 h1:iWYzp1z72IlXTioET0+XI6SjQdPfMGfuAiZiKznOt7g= +github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSxxwHgxWoPsn9llB4= github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.10/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.15/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20210428214800-545e0d2e0bf7/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= +github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= +github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= +github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= +github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.2.3 h1:ww2fsjqocGCAFamzvv/b8IsRduuHHeK2MHTcTxZTQX8= github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.9.1 h1:anHKLS/ApTYU6NZkKa/5cQqqcbKZURjvc+MtR++S4EQ= -github.com/securego/gosec/v2 v2.9.1/go.mod h1:oDcDLcatOJxkCGaCaq8lua1jTnYf6Sou4wdiJ1n4iHc= +github.com/securego/gosec/v2 v2.9.6 h1:ysfvgQBp2zmTgXQl65UkqEkYlQGbnVSRUGpCrJiiR4c= +github.com/securego/gosec/v2 v2.9.6/go.mod h1:EESY9Ywxo/Zc5NyF/qIj6Cop+4PSWM0F0OfGD7FdIXc= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.21.10/go.mod h1:t75NhzCZ/dYyPQjyQmrAYP6c8+LCdFANeBMdLPCNnew= +github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -702,6 +759,8 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sivchari/containedctx v1.0.1 h1:fJq44cX+tD+uT5xGrsg25GwiaY61NGybQk9WWKij3Uo= +github.com/sivchari/containedctx v1.0.1/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/tenv v1.4.7 h1:FdTpgRlTue5eb5nXIYgS/lyVXSjugU8UUVDwhP1NLU8= github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -713,6 +772,7 @@ github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0H github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -721,8 +781,9 @@ github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -732,8 +793,10 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= -github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -752,16 +815,16 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= -github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b h1:HxLVTlqcHhFAz3nWUcuvpH7WuOMv8LQoCWmruLfFH2U= -github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= +github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94 h1:ig99OeTyDwQWhPe2iw9lwfQVF1KB3Q4fpP3X7/2VBG8= -github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= +github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -770,8 +833,9 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1 github.com/tomarrell/wrapcheck/v2 v2.4.0 h1:mU4H9KsqqPZUALOUbVOpjy8qNQbWLoLI9fV68/1tq30= github.com/tomarrell/wrapcheck/v2 v2.4.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/tommy-muehle/go-mnd/v2 v2.4.0 h1:1t0f8Uiaq+fqKteUR4N9Umr6E99R+lDnLnq7PwX2PPE= -github.com/tommy-muehle/go-mnd/v2 v2.4.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= +github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= @@ -793,8 +857,10 @@ github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6e github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yeya24/promlinter v0.1.0 h1:goWULN0jH5Yajmu/K+v1xCqIREeB+48OiJ2uu2ssc7U= -github.com/yeya24/promlinter v0.1.0/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= +github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 h1:YAaOqqMTstELMMGblt6yJ/fcOt4owSYuw3IttMnKfAM= +github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= @@ -805,12 +871,18 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +gitlab.com/bosi/decorder v0.2.1 h1:ehqZe8hI4w7O4b1vgsDZw1YU1PE7iJXrQWFMsocbQ1w= +gitlab.com/bosi/decorder v0.2.1/go.mod h1:6C/nhLSbF6qZbYD8bRmISBwc6vcWdNsiIBkRvjJFrH0= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -855,8 +927,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI= +golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -942,12 +1014,15 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -964,6 +1039,8 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1028,11 +1105,13 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1050,14 +1129,21 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 h1:TyHqChC80pFkXWraUUf6RuB5IqFdQieMLwwCJokV2pc= +golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1080,7 +1166,6 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= @@ -1163,8 +1248,6 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210104081019-d8d6ddbec6ee/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -1175,8 +1258,9 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1212,7 +1296,13 @@ google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtuk google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= +google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1279,6 +1369,17 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1308,6 +1409,9 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1336,10 +1440,10 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= +gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= @@ -1364,16 +1468,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.2.1 h1:/EPr//+UMMXwMTkXvCCoaJDq8cpjMO80Ou+L4PDo2mY= -honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= -mvdan.cc/gofumpt v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA= -mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= +honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= +honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= +mvdan.cc/gofumpt v0.2.1 h1:7jakRGkQcLAJdT+C8Bwc9d0BANkVPSkHZkzNv07pJAs= +mvdan.cc/gofumpt v0.2.1/go.mod h1:a/rvZPhsNaedOJBzqRD9omnwVwHZsBdJirXHa9Gh9Ig= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 h1:HT3e4Krq+IE44tiN36RvVEb6tvqeIdtsVSsxmNPqlFU= -mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7/go.mod h1:hBpJkZE8H/sb+VRFvw2+rBpHNsTBcvSpk61hr8mzXZE= +mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 h1:Jh3LAeMt1eGpxomyu3jVkmVZWW2MxZ1qIIV2TZ/nRio= +mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 2623a46dfeca6f935305b072b93cd242d80f99d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jan 2022 12:23:13 -0800 Subject: [PATCH 046/886] Bump github.com/prometheus/client_golang from 1.12.0 to 1.12.1 in /exporters/prometheus (#2570) * Bump github.com/prometheus/client_golang in /exporters/prometheus Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/prometheus/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index e8f2367048a..673fc937581 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -166,8 +166,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= -github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 1e555dd7983..bfdbb4ab561 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.16 require ( - github.com/prometheus/client_golang v1.12.0 + github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.3.0 go.opentelemetry.io/otel/metric v0.26.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 8d10405bfe0..3a133e8de69 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -168,8 +168,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.0 h1:C+UIj/QWtmqY13Arb8kwMt5j34/0Z2iKamrJ+ryC0Gg= -github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 53ead308b89c3107f3363ebf75e9a2ffb5abb24b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 31 Jan 2022 12:32:56 -0800 Subject: [PATCH 047/886] Fix TestBackoffRetry in otlp/internal/retry package (#2562) * Fix TestBackoffRetry in otlp retry pkg The delay of the retry is within two times a randomization factor (the back-off time is delay * random number within [1 - factor, 1 + factor]. This means the waitFunc in TestBackoffRetry needs to check the delay is within an appropriate delta, not equal to configure initial delay. * Fix delta value * Fix delta Co-authored-by: Aaron Clawson --- exporters/otlp/internal/retry/retry_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/exporters/otlp/internal/retry/retry_test.go b/exporters/otlp/internal/retry/retry_test.go index d2b5b6c4b59..2b2f92e69c9 100644 --- a/exporters/otlp/internal/retry/retry_test.go +++ b/exporters/otlp/internal/retry/retry_test.go @@ -17,9 +17,11 @@ package retry import ( "context" "errors" + "math" "testing" "time" + "github.com/cenkalti/backoff/v4" "github.com/stretchr/testify/assert" ) @@ -131,7 +133,8 @@ func TestBackoffRetry(t *testing.T) { origWait := waitFunc var done bool waitFunc = func(_ context.Context, d time.Duration) error { - assert.Equal(t, delay, d, "retry not backoffed") + delta := math.Ceil(float64(delay)*backoff.DefaultRandomizationFactor) - float64(delay) + assert.InDelta(t, delay, d, delta, "retry not backoffed") // Try twice to ensure call is attempted again after delay. if done { return assert.AnError @@ -139,7 +142,7 @@ func TestBackoffRetry(t *testing.T) { done = true return nil } - defer func() { waitFunc = origWait }() + t.Cleanup(func() { waitFunc = origWait }) ctx := context.Background() assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { From 0cc7d8d702b76be7d4cb8e0ed2b50dda95dbcd28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:04:00 -0800 Subject: [PATCH 048/886] Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlptrace (#2568) * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 3 ++- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracehttp/go.sum | 3 ++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7391dc1dd97..acbc10cd1bb 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 1cc6cdbcf0e..ca5dbebdb8b 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -134,8 +134,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 91ebb6e0ce7..ddc8f8a5ed8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/trace v1.3.0 go.opentelemetry.io/proto/otlp v0.12.0 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 8bfa2adcab2..b41a0280fd8 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -112,8 +112,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 55b90f84f98..7324309e2d9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 963b22efe7a..d2dc43a4872 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -138,8 +138,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 8bfa2adcab2..b41a0280fd8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -112,8 +112,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 4a7f54e29c57da3f2555669164cb3c56fe043f57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:13:34 -0800 Subject: [PATCH 049/886] Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /example/otel-collector (#2565) * Bump google.golang.org/grpc in /example/otel-collector Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias From e58070a1147149ce7acfaeb84cc6fc8e9c93a3de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Feb 2022 10:28:31 -0800 Subject: [PATCH 050/886] Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlpmetric (#2572) * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 8394ba3362b..ba19e06432d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.3.0 go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/proto/otlp v0.12.0 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 983af28691b..c965d892816 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -114,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 8ca2da5ccf3..11fe57e8a7c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.26.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 983af28691b..c965d892816 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -114,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 983af28691b..c965d892816 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -114,8 +114,9 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From bd817df68c274fbace901fab63da2bea267315ab Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 1 Feb 2022 13:51:23 -0800 Subject: [PATCH 051/886] Change Options to accept type not pointer (#2558) * Change trace options to accept type not pointer Add benchmark to show allocation improvement. * Update CONTRIBUTING.md guidelines * Update all Option iface * Fix grammar in CONTRIBUTING --- CONTRIBUTING.md | 64 +++++++++----- exporters/jaeger/uploader.go | 54 +++++++----- exporters/otlp/otlpmetric/exporter.go | 2 +- .../internal/otlpconfig/envconfig.go | 30 ++++--- .../otlpmetric/internal/otlpconfig/options.go | 84 +++++++++++-------- .../internal/otlpconfig/options_test.go | 4 +- exporters/otlp/otlpmetric/options.go | 11 +-- .../otlp/otlpmetric/otlpmetricgrpc/options.go | 21 +++-- .../otlp/otlpmetric/otlpmetrichttp/client.go | 4 +- .../otlp/otlpmetric/otlpmetrichttp/options.go | 15 ++-- .../internal/otlpconfig/envconfig.go | 30 ++++--- .../otlptrace/internal/otlpconfig/options.go | 84 +++++++++++-------- .../internal/otlpconfig/options_test.go | 4 +- .../otlp/otlptrace/otlptracegrpc/options.go | 21 +++-- .../otlp/otlptrace/otlptracehttp/client.go | 4 +- .../otlp/otlptrace/otlptracehttp/options.go | 6 +- exporters/stdout/stdoutmetric/config.go | 16 ++-- exporters/stdout/stdouttrace/config.go | 13 +-- exporters/zipkin/zipkin.go | 16 ++-- metric/config.go | 32 +++---- sdk/metric/controller/basic/config.go | 17 ++-- sdk/metric/controller/basic/config_test.go | 8 +- sdk/metric/controller/basic/controller.go | 4 +- sdk/metric/processor/basic/basic.go | 2 +- sdk/metric/processor/basic/config.go | 5 +- sdk/resource/config.go | 8 +- sdk/resource/resource.go | 2 +- sdk/trace/provider.go | 32 ++++--- sdk/trace/sampling.go | 16 ++-- trace/config.go | 77 ++++++++++------- trace/config_test.go | 68 +++++++++++++++ 31 files changed, 477 insertions(+), 277 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f25fd9008b4..7dead7084d3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -228,11 +228,11 @@ all options to create a configured `config`. ```go // newConfig returns an appropriately configured config. -func newConfig([]Option) config { +func newConfig(options ...Option) config { // Set default values for config. config := config{/* […] */} for _, option := range options { - option.apply(&config) + config = option.apply(config) } // Preform any validation here. return config @@ -253,7 +253,7 @@ To set the value of the options a `config` contains, a corresponding ```go type Option interface { - apply(*config) + apply(config) config } ``` @@ -261,6 +261,9 @@ Having `apply` unexported makes sure that it will not be used externally. Moreover, the interface becomes sealed so the user cannot easily implement the interface on its own. +The `apply` method should return a modified version of the passed config. +This approach, instead of passing a pointer, is used to prevent the config from being allocated to the heap. + The name of the interface should be prefixed in the same way the corresponding `config` is (if at all). @@ -283,8 +286,9 @@ func With*(…) Option { … } ```go type defaultFalseOption bool -func (o defaultFalseOption) apply(c *config) { +func (o defaultFalseOption) apply(c config) config { c.Bool = bool(o) + return c } // WithOption sets a T to have an option included. @@ -296,8 +300,9 @@ func WithOption() Option { ```go type defaultTrueOption bool -func (o defaultTrueOption) apply(c *config) { +func (o defaultTrueOption) apply(c config) config { c.Bool = bool(o) + return c } // WithoutOption sets a T to have Bool option excluded. @@ -313,8 +318,9 @@ type myTypeOption struct { MyType MyType } -func (o myTypeOption) apply(c *config) { +func (o myTypeOption) apply(c config) config { c.MyType = o.MyType + return c } // WithMyType sets T to have include MyType. @@ -326,16 +332,17 @@ func WithMyType(t MyType) Option { ##### Functional Options ```go -type optionFunc func(*config) +type optionFunc func(config) config -func (fn optionFunc) apply(c *config) { - fn(c) +func (fn optionFunc) apply(c config) config { + return fn(c) } // WithMyType sets t as MyType. func WithMyType(t MyType) Option { - return optionFunc(func(c *config) { + return optionFunc(func(c config) config { c.MyType = t + return c }) } ``` @@ -370,12 +377,12 @@ type config struct { // DogOption apply Dog specific options. type DogOption interface { - applyDog(*config) + applyDog(config) config } // BirdOption apply Bird specific options. type BirdOption interface { - applyBird(*config) + applyBird(config) config } // Option apply options for all animals. @@ -385,17 +392,36 @@ type Option interface { } type weightOption float64 -func (o weightOption) applyDog(c *config) { c.Weight = float64(o) } -func (o weightOption) applyBird(c *config) { c.Weight = float64(o) } -func WithWeight(w float64) Option { return weightOption(w) } + +func (o weightOption) applyDog(c config) config { + c.Weight = float64(o) + return c +} + +func (o weightOption) applyBird(c config) config { + c.Weight = float64(o) + return c +} + +func WithWeight(w float64) Option { return weightOption(w) } type furColorOption string -func (o furColorOption) applyDog(c *config) { c.Color = string(o) } -func WithFurColor(c string) DogOption { return furColorOption(c) } + +func (o furColorOption) applyDog(c config) config { + c.Color = string(o) + return c +} + +func WithFurColor(c string) DogOption { return furColorOption(c) } type maxAltitudeOption float64 -func (o maxAltitudeOption) applyBird(c *config) { c.MaxAltitude = float64(o) } -func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) } + +func (o maxAltitudeOption) applyBird(c config) config { + c.MaxAltitude = float64(o) + return c +} + +func WithMaxAltitude(a float64) BirdOption { return maxAltitudeOption(a) } func NewDog(name string, o ...DogOption) Dog {…} func NewBird(name string, o ...BirdOption) Bird {…} diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index 84a517985a7..d907f74b9f3 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -55,7 +55,7 @@ func (fn endpointOptionFunc) newBatchUploader() (batchUploader, error) { // will be used if neither are provided. func WithAgentEndpoint(options ...AgentEndpointOption) EndpointOption { return endpointOptionFunc(func() (batchUploader, error) { - cfg := &agentEndpointConfig{ + cfg := agentEndpointConfig{ agentClientUDPParams{ AttemptReconnecting: true, Host: envOr(envAgentHost, "localhost"), @@ -63,7 +63,7 @@ func WithAgentEndpoint(options ...AgentEndpointOption) EndpointOption { }, } for _, opt := range options { - opt.apply(cfg) + cfg = opt.apply(cfg) } client, err := newAgentClientUDP(cfg.agentClientUDPParams) @@ -76,17 +76,17 @@ func WithAgentEndpoint(options ...AgentEndpointOption) EndpointOption { } type AgentEndpointOption interface { - apply(*agentEndpointConfig) + apply(agentEndpointConfig) agentEndpointConfig } type agentEndpointConfig struct { agentClientUDPParams } -type agentEndpointOptionFunc func(*agentEndpointConfig) +type agentEndpointOptionFunc func(agentEndpointConfig) agentEndpointConfig -func (fn agentEndpointOptionFunc) apply(cfg *agentEndpointConfig) { - fn(cfg) +func (fn agentEndpointOptionFunc) apply(cfg agentEndpointConfig) agentEndpointConfig { + return fn(cfg) } // WithAgentHost sets a host to be used in the agent client endpoint. @@ -94,8 +94,9 @@ func (fn agentEndpointOptionFunc) apply(cfg *agentEndpointConfig) { // OTEL_EXPORTER_JAEGER_AGENT_HOST environment variable. // If this option is not passed and the env var is not set, "localhost" will be used by default. func WithAgentHost(host string) AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.Host = host + return o }) } @@ -104,36 +105,41 @@ func WithAgentHost(host string) AgentEndpointOption { // OTEL_EXPORTER_JAEGER_AGENT_PORT environment variable. // If this option is not passed and the env var is not set, "6831" will be used by default. func WithAgentPort(port string) AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.Port = port + return o }) } // WithLogger sets a logger to be used by agent client. func WithLogger(logger *log.Logger) AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.Logger = logger + return o }) } // WithDisableAttemptReconnecting sets option to disable reconnecting udp client. func WithDisableAttemptReconnecting() AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.AttemptReconnecting = false + return o }) } // WithAttemptReconnectingInterval sets the interval between attempts to re resolve agent endpoint. func WithAttemptReconnectingInterval(interval time.Duration) AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.AttemptReconnectInterval = interval + return o }) } // WithMaxPacketSize sets the maximum UDP packet size for transport to the Jaeger agent. func WithMaxPacketSize(size int) AgentEndpointOption { - return agentEndpointOptionFunc(func(o *agentEndpointConfig) { + return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.MaxPacketSize = size + return o }) } @@ -149,7 +155,7 @@ func WithMaxPacketSize(size int) AgentEndpointOption { // If neither values are provided for the username or the password, they will not be set since there is no default. func WithCollectorEndpoint(options ...CollectorEndpointOption) EndpointOption { return endpointOptionFunc(func() (batchUploader, error) { - cfg := &collectorEndpointConfig{ + cfg := collectorEndpointConfig{ endpoint: envOr(envEndpoint, "http://localhost:14268/api/traces"), username: envOr(envUser, ""), password: envOr(envPassword, ""), @@ -157,7 +163,7 @@ func WithCollectorEndpoint(options ...CollectorEndpointOption) EndpointOption { } for _, opt := range options { - opt.apply(cfg) + cfg = opt.apply(cfg) } return &collectorUploader{ @@ -170,7 +176,7 @@ func WithCollectorEndpoint(options ...CollectorEndpointOption) EndpointOption { } type CollectorEndpointOption interface { - apply(*collectorEndpointConfig) + apply(collectorEndpointConfig) collectorEndpointConfig } type collectorEndpointConfig struct { @@ -187,10 +193,10 @@ type collectorEndpointConfig struct { httpClient *http.Client } -type collectorEndpointOptionFunc func(*collectorEndpointConfig) +type collectorEndpointOptionFunc func(collectorEndpointConfig) collectorEndpointConfig -func (fn collectorEndpointOptionFunc) apply(cfg *collectorEndpointConfig) { - fn(cfg) +func (fn collectorEndpointOptionFunc) apply(cfg collectorEndpointConfig) collectorEndpointConfig { + return fn(cfg) } // WithEndpoint is the URL for the Jaeger collector that spans are sent to. @@ -199,8 +205,9 @@ func (fn collectorEndpointOptionFunc) apply(cfg *collectorEndpointConfig) { // If this option is not passed and the environment variable is not set, // "http://localhost:14268/api/traces" will be used by default. func WithEndpoint(endpoint string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o *collectorEndpointConfig) { + return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { o.endpoint = endpoint + return o }) } @@ -209,8 +216,9 @@ func WithEndpoint(endpoint string) CollectorEndpointOption { // OTEL_EXPORTER_JAEGER_USER environment variable. // If this option is not passed and the environment variable is not set, no username will be set. func WithUsername(username string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o *collectorEndpointConfig) { + return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { o.username = username + return o }) } @@ -219,15 +227,17 @@ func WithUsername(username string) CollectorEndpointOption { // OTEL_EXPORTER_JAEGER_PASSWORD environment variable. // If this option is not passed and the environment variable is not set, no password will be set. func WithPassword(password string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o *collectorEndpointConfig) { + return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { o.password = password + return o }) } // WithHTTPClient sets the http client to be used to make request to the collector endpoint. func WithHTTPClient(client *http.Client) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o *collectorEndpointConfig) { + return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { o.httpClient = client + return o }) } diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 2cd90ac435a..36c41cce762 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -120,7 +120,7 @@ func NewUnstarted(client Client, opts ...Option) *Exporter { } for _, opt := range opts { - opt.apply(&cfg) + cfg = opt.apply(cfg) } e := &Exporter{ diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index a62b548496f..ecf2ecaf9c2 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -33,12 +33,12 @@ var DefaultEnvOptionsReader = EnvOptionsReader{ ReadFile: ioutil.ReadFile, } -func ApplyGRPCEnvConfigs(cfg *Config) { - DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) +func ApplyGRPCEnvConfigs(cfg Config) Config { + return DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) } -func ApplyHTTPEnvConfigs(cfg *Config) { - DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) +func ApplyHTTPEnvConfigs(cfg Config) Config { + return DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) } type EnvOptionsReader struct { @@ -46,18 +46,20 @@ type EnvOptionsReader struct { ReadFile func(filename string) ([]byte, error) } -func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg *Config) { +func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg Config) Config { opts := e.GetOptionsFromEnv() for _, opt := range opts { - opt.ApplyHTTPOption(cfg) + cfg = opt.ApplyHTTPOption(cfg) } + return cfg } -func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg *Config) { +func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg Config) Config { opts := e.GetOptionsFromEnv() for _, opt := range opts { - opt.ApplyGRPCOption(cfg) + cfg = opt.ApplyGRPCOption(cfg) } + return cfg } func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { @@ -74,7 +76,7 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } else { opts = append(opts, WithSecure()) } - opts = append(opts, newSplitOption(func(cfg *Config) { + opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Metrics.Endpoint = u.Host // For endpoint URLs for OTLP/HTTP per-signal variables, the // URL MUST be used as-is without any modification. The only @@ -85,10 +87,12 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { path = "/" } cfg.Metrics.URLPath = path - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { // For OTLP/gRPC endpoints, this is the target to which the // exporter is going to send telemetry. cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg })) } } else if v, ok = e.getEnvValue("ENDPOINT"); ok { @@ -101,16 +105,18 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } else { opts = append(opts, WithSecure()) } - opts = append(opts, newSplitOption(func(cfg *Config) { + opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Metrics.Endpoint = u.Host // For OTLP/HTTP endpoint URLs without a per-signal // configuration, the passed endpoint is used as a base URL // and the signals are sent to these paths relative to that. cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { // For OTLP/gRPC endpoints, this is the target to which the // exporter is going to send telemetry. cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg })) } } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go index 8cfbc7dfcf8..fed8a82f1c7 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go @@ -90,9 +90,9 @@ func NewDefaultConfig() Config { // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { cfg := NewDefaultConfig() - ApplyGRPCEnvConfigs(&cfg) + cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { - opt.ApplyGRPCOption(&cfg) + cfg = opt.ApplyGRPCOption(cfg) } if cfg.ServiceConfig != "" { @@ -129,8 +129,8 @@ func NewGRPCConfig(opts ...GRPCOption) Config { type ( // GenericOption applies an option to the HTTP or gRPC driver. GenericOption interface { - ApplyHTTPOption(*Config) - ApplyGRPCOption(*Config) + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -140,7 +140,7 @@ type ( // HTTPOption applies an option to the HTTP driver. HTTPOption interface { - ApplyHTTPOption(*Config) + ApplyHTTPOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -150,7 +150,7 @@ type ( // GRPCOption applies an option to the gRPC driver. GRPCOption interface { - ApplyGRPCOption(*Config) + ApplyGRPCOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -162,128 +162,138 @@ type ( // genericOption is an option that applies the same logic // for both gRPC and HTTP. type genericOption struct { - fn func(*Config) + fn func(Config) Config } -func (g *genericOption) ApplyGRPCOption(cfg *Config) { - g.fn(cfg) +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) } -func (g *genericOption) ApplyHTTPOption(cfg *Config) { - g.fn(cfg) +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) } func (genericOption) private() {} -func newGenericOption(fn func(cfg *Config)) GenericOption { +func newGenericOption(fn func(cfg Config) Config) GenericOption { return &genericOption{fn: fn} } // splitOption is an option that applies different logics // for gRPC and HTTP. type splitOption struct { - httpFn func(*Config) - grpcFn func(*Config) + httpFn func(Config) Config + grpcFn func(Config) Config } -func (g *splitOption) ApplyGRPCOption(cfg *Config) { - g.grpcFn(cfg) +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) } -func (g *splitOption) ApplyHTTPOption(cfg *Config) { - g.httpFn(cfg) +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) } func (splitOption) private() {} -func newSplitOption(httpFn func(cfg *Config), grpcFn func(cfg *Config)) GenericOption { +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { return &splitOption{httpFn: httpFn, grpcFn: grpcFn} } // httpOption is an option that is only applied to the HTTP driver. type httpOption struct { - fn func(*Config) + fn func(Config) Config } -func (h *httpOption) ApplyHTTPOption(cfg *Config) { - h.fn(cfg) +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) } func (httpOption) private() {} -func NewHTTPOption(fn func(cfg *Config)) HTTPOption { +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { return &httpOption{fn: fn} } // grpcOption is an option that is only applied to the gRPC driver. type grpcOption struct { - fn func(*Config) + fn func(Config) Config } -func (h *grpcOption) ApplyGRPCOption(cfg *Config) { - h.fn(cfg) +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) } func (grpcOption) private() {} -func NewGRPCOption(fn func(cfg *Config)) GRPCOption { +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { return &grpcOption{fn: fn} } // Generic Options func WithEndpoint(endpoint string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Endpoint = endpoint + return cfg }) } func WithCompression(compression Compression) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Compression = compression + return cfg }) } func WithURLPath(urlPath string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.URLPath = urlPath + return cfg }) } func WithRetry(rc retry.Config) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.RetryConfig = rc + return cfg }) } func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { - return newSplitOption(func(cfg *Config) { + return newSplitOption(func(cfg Config) Config { cfg.Metrics.TLSCfg = tlsCfg.Clone() - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { cfg.Metrics.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg }) } func WithInsecure() GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Insecure = true + return cfg }) } func WithSecure() GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Insecure = false + return cfg }) } func WithHeaders(headers map[string]string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Headers = headers + return cfg }) } func WithTimeout(duration time.Duration) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Metrics.Timeout = duration + return cfg }) } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index ee267e4fd00..d82802603e3 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -387,9 +387,9 @@ func TestConfigs(t *testing.T) { // Tests Generic options as HTTP Options cfg := otlpconfig.NewDefaultConfig() - otlpconfig.ApplyHTTPEnvConfigs(&cfg) + cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) for _, opt := range tt.opts { - opt.ApplyHTTPOption(&cfg) + cfg = opt.ApplyHTTPOption(cfg) } tt.asserts(t, &cfg, false) diff --git a/exporters/otlp/otlpmetric/options.go b/exporters/otlp/otlpmetric/options.go index ce8a5f58c5a..bd8706a74d3 100644 --- a/exporters/otlp/otlpmetric/options.go +++ b/exporters/otlp/otlpmetric/options.go @@ -18,13 +18,13 @@ import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" // Option are setting options passed to an Exporter on creation. type Option interface { - apply(*config) + apply(config) config } -type exporterOptionFunc func(*config) +type exporterOptionFunc func(config) config -func (fn exporterOptionFunc) apply(cfg *config) { - fn(cfg) +func (fn exporterOptionFunc) apply(cfg config) config { + return fn(cfg) } type config struct { @@ -36,7 +36,8 @@ type config struct { // aggregation). If not specified otherwise, exporter will use a // cumulative temporality selector. func WithMetricAggregationTemporalitySelector(selector aggregation.TemporalitySelector) Option { - return exporterOptionFunc(func(cfg *config) { + return exporterOptionFunc(func(cfg config) config { cfg.temporalitySelector = selector + return cfg }) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go index e6d3919eab1..27769ff6b7c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go @@ -28,7 +28,7 @@ import ( // Option applies an option to the gRPC driver. type Option interface { - applyGRPCOption(*otlpconfig.Config) + applyGRPCOption(otlpconfig.Config) otlpconfig.Config } func asGRPCOptions(opts []Option) []otlpconfig.GRPCOption { @@ -50,8 +50,8 @@ type wrappedOption struct { otlpconfig.GRPCOption } -func (w wrappedOption) applyGRPCOption(cfg *otlpconfig.Config) { - w.ApplyGRPCOption(cfg) +func (w wrappedOption) applyGRPCOption(cfg otlpconfig.Config) otlpconfig.Config { + return w.ApplyGRPCOption(cfg) } // WithInsecure disables client transport security for the exporter's gRPC @@ -77,8 +77,9 @@ func WithEndpoint(endpoint string) Option { // // This option has no effect if WithGRPCConn is used. func WithReconnectionPeriod(rp time.Duration) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.ReconnectionPeriod = rp + return cfg })} } @@ -117,8 +118,9 @@ func WithHeaders(headers map[string]string) Option { // // This option has no effect if WithGRPCConn is used. func WithTLSCredentials(creds credentials.TransportCredentials) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.Metrics.GRPCCredentials = creds + return cfg })} } @@ -126,8 +128,9 @@ func WithTLSCredentials(creds credentials.TransportCredentials) Option { // // This option has no effect if WithGRPCConn is used. func WithServiceConfig(serviceConfig string) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.ServiceConfig = serviceConfig + return cfg })} } @@ -138,8 +141,9 @@ func WithServiceConfig(serviceConfig string) Option { // // This option has no effect if WithGRPCConn is used. func WithDialOption(opts ...grpc.DialOption) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.DialOptions = opts + return cfg })} } @@ -152,8 +156,9 @@ func WithDialOption(opts ...grpc.DialOption) Option { // It is the callers responsibility to close the passed conn. The client // Shutdown method will not close this connection. func WithGRPCConn(conn *grpc.ClientConn) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.GRPCConn = conn + return cfg })} } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index b472611fb40..aa381f8e038 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -78,9 +78,9 @@ type client struct { // NewClient creates a new HTTP metric client. func NewClient(opts ...Option) otlpmetric.Client { cfg := otlpconfig.NewDefaultConfig() - otlpconfig.ApplyHTTPEnvConfigs(&cfg) + cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) for _, opt := range opts { - opt.applyHTTPOption(&cfg) + cfg = opt.applyHTTPOption(cfg) } for pathPtr, defaultPath := range map[*string]string{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go index 61dbccc3078..bec26204c74 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go @@ -37,7 +37,7 @@ const ( // Option applies an option to the HTTP client. type Option interface { - applyHTTPOption(*otlpconfig.Config) + applyHTTPOption(otlpconfig.Config) otlpconfig.Config } // RetryConfig defines configuration for retrying batches in case of export @@ -48,8 +48,8 @@ type wrappedOption struct { otlpconfig.HTTPOption } -func (w wrappedOption) applyHTTPOption(cfg *otlpconfig.Config) { - w.ApplyHTTPOption(cfg) +func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config { + return w.ApplyHTTPOption(cfg) } // WithEndpoint allows one to set the address of the collector @@ -83,7 +83,7 @@ func WithMaxAttempts(maxAttempts int) Option { maxAttempts = 5 } return wrappedOption{ - otlpconfig.NewHTTPOption(func(cfg *otlpconfig.Config) { + otlpconfig.NewHTTPOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.RetryConfig.Enabled = true var ( @@ -104,7 +104,7 @@ func WithMaxAttempts(maxAttempts int) Option { attempts := int64(maxE+init) / int64(maxI) if int64(maxAttempts) == attempts { - return + return cfg } maxE = time.Duration(int64(maxAttempts)*int64(maxI)) - init @@ -112,6 +112,8 @@ func WithMaxAttempts(maxAttempts int) Option { cfg.RetryConfig.InitialInterval = init cfg.RetryConfig.MaxInterval = maxI cfg.RetryConfig.MaxElapsedTime = maxE + + return cfg }), } } @@ -126,7 +128,7 @@ func WithBackoff(duration time.Duration) Option { duration = 300 * time.Millisecond } return wrappedOption{ - otlpconfig.NewHTTPOption(func(cfg *otlpconfig.Config) { + otlpconfig.NewHTTPOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.RetryConfig.Enabled = true cfg.RetryConfig.MaxInterval = duration if cfg.RetryConfig.InitialInterval == 0 { @@ -135,6 +137,7 @@ func WithBackoff(duration time.Duration) Option { if cfg.RetryConfig.MaxElapsedTime == 0 { cfg.RetryConfig.MaxElapsedTime = retry.DefaultConfig.MaxElapsedTime } + return cfg }), } } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 2d1937beda2..77f13a1937b 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -33,12 +33,12 @@ var DefaultEnvOptionsReader = EnvOptionsReader{ ReadFile: ioutil.ReadFile, } -func ApplyGRPCEnvConfigs(cfg *Config) { - DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) +func ApplyGRPCEnvConfigs(cfg Config) Config { + return DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) } -func ApplyHTTPEnvConfigs(cfg *Config) { - DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) +func ApplyHTTPEnvConfigs(cfg Config) Config { + return DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) } type EnvOptionsReader struct { @@ -46,18 +46,20 @@ type EnvOptionsReader struct { ReadFile func(filename string) ([]byte, error) } -func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg *Config) { +func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg Config) Config { opts := e.GetOptionsFromEnv() for _, opt := range opts { - opt.ApplyHTTPOption(cfg) + cfg = opt.ApplyHTTPOption(cfg) } + return cfg } -func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg *Config) { +func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg Config) Config { opts := e.GetOptionsFromEnv() for _, opt := range opts { - opt.ApplyGRPCOption(cfg) + cfg = opt.ApplyGRPCOption(cfg) } + return cfg } func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { @@ -74,7 +76,7 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } else { opts = append(opts, WithSecure()) } - opts = append(opts, newSplitOption(func(cfg *Config) { + opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Traces.Endpoint = u.Host // For endpoint URLs for OTLP/HTTP per-signal variables, the // URL MUST be used as-is without any modification. The only @@ -85,10 +87,12 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { path = "/" } cfg.Traces.URLPath = path - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { // For OTLP/gRPC endpoints, this is the target to which the // exporter is going to send telemetry. cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg })) } } else if v, ok = e.getEnvValue("ENDPOINT"); ok { @@ -101,16 +105,18 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } else { opts = append(opts, WithSecure()) } - opts = append(opts, newSplitOption(func(cfg *Config) { + opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Traces.Endpoint = u.Host // For OTLP/HTTP endpoint URLs without a per-signal // configuration, the passed endpoint is used as a base URL // and the signals are sent to these paths relative to that. cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { // For OTLP/gRPC endpoints, this is the target to which the // exporter is going to send telemetry. cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg })) } } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 2af734a9de8..e6fb14e00e8 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -83,9 +83,9 @@ func NewDefaultConfig() Config { // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { cfg := NewDefaultConfig() - ApplyGRPCEnvConfigs(&cfg) + cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { - opt.ApplyGRPCOption(&cfg) + cfg = opt.ApplyGRPCOption(cfg) } if cfg.ServiceConfig != "" { @@ -122,8 +122,8 @@ func NewGRPCConfig(opts ...GRPCOption) Config { type ( // GenericOption applies an option to the HTTP or gRPC driver. GenericOption interface { - ApplyHTTPOption(*Config) - ApplyGRPCOption(*Config) + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -133,7 +133,7 @@ type ( // HTTPOption applies an option to the HTTP driver. HTTPOption interface { - ApplyHTTPOption(*Config) + ApplyHTTPOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -143,7 +143,7 @@ type ( // GRPCOption applies an option to the gRPC driver. GRPCOption interface { - ApplyGRPCOption(*Config) + ApplyGRPCOption(Config) Config // A private method to prevent users implementing the // interface and so future additions to it will not @@ -155,128 +155,138 @@ type ( // genericOption is an option that applies the same logic // for both gRPC and HTTP. type genericOption struct { - fn func(*Config) + fn func(Config) Config } -func (g *genericOption) ApplyGRPCOption(cfg *Config) { - g.fn(cfg) +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) } -func (g *genericOption) ApplyHTTPOption(cfg *Config) { - g.fn(cfg) +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) } func (genericOption) private() {} -func newGenericOption(fn func(cfg *Config)) GenericOption { +func newGenericOption(fn func(cfg Config) Config) GenericOption { return &genericOption{fn: fn} } // splitOption is an option that applies different logics // for gRPC and HTTP. type splitOption struct { - httpFn func(*Config) - grpcFn func(*Config) + httpFn func(Config) Config + grpcFn func(Config) Config } -func (g *splitOption) ApplyGRPCOption(cfg *Config) { - g.grpcFn(cfg) +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) } -func (g *splitOption) ApplyHTTPOption(cfg *Config) { - g.httpFn(cfg) +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) } func (splitOption) private() {} -func newSplitOption(httpFn func(cfg *Config), grpcFn func(cfg *Config)) GenericOption { +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { return &splitOption{httpFn: httpFn, grpcFn: grpcFn} } // httpOption is an option that is only applied to the HTTP driver. type httpOption struct { - fn func(*Config) + fn func(Config) Config } -func (h *httpOption) ApplyHTTPOption(cfg *Config) { - h.fn(cfg) +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) } func (httpOption) private() {} -func NewHTTPOption(fn func(cfg *Config)) HTTPOption { +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { return &httpOption{fn: fn} } // grpcOption is an option that is only applied to the gRPC driver. type grpcOption struct { - fn func(*Config) + fn func(Config) Config } -func (h *grpcOption) ApplyGRPCOption(cfg *Config) { - h.fn(cfg) +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) } func (grpcOption) private() {} -func NewGRPCOption(fn func(cfg *Config)) GRPCOption { +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { return &grpcOption{fn: fn} } // Generic Options func WithEndpoint(endpoint string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Endpoint = endpoint + return cfg }) } func WithCompression(compression Compression) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression + return cfg }) } func WithURLPath(urlPath string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.URLPath = urlPath + return cfg }) } func WithRetry(rc retry.Config) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.RetryConfig = rc + return cfg }) } func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { - return newSplitOption(func(cfg *Config) { + return newSplitOption(func(cfg Config) Config { cfg.Traces.TLSCfg = tlsCfg.Clone() - }, func(cfg *Config) { + return cfg + }, func(cfg Config) Config { cfg.Traces.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg }) } func WithInsecure() GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Insecure = true + return cfg }) } func WithSecure() GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Insecure = false + return cfg }) } func WithHeaders(headers map[string]string) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Headers = headers + return cfg }) } func WithTimeout(duration time.Duration) GenericOption { - return newGenericOption(func(cfg *Config) { + return newGenericOption(func(cfg Config) Config { cfg.Traces.Timeout = duration + return cfg }) } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index 20decbc37bc..b12e0bd9a5c 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -385,9 +385,9 @@ func TestConfigs(t *testing.T) { // Tests Generic options as HTTP Options cfg := otlpconfig.NewDefaultConfig() - otlpconfig.ApplyHTTPEnvConfigs(&cfg) + cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) for _, opt := range tt.opts { - opt.ApplyHTTPOption(&cfg) + cfg = opt.ApplyHTTPOption(cfg) } tt.asserts(t, &cfg, false) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 0b27a35a8e1..e2e5bd696f6 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -28,7 +28,7 @@ import ( // Option applies an option to the gRPC driver. type Option interface { - applyGRPCOption(*otlpconfig.Config) + applyGRPCOption(otlpconfig.Config) otlpconfig.Config } func asGRPCOptions(opts []Option) []otlpconfig.GRPCOption { @@ -50,8 +50,8 @@ type wrappedOption struct { otlpconfig.GRPCOption } -func (w wrappedOption) applyGRPCOption(cfg *otlpconfig.Config) { - w.ApplyGRPCOption(cfg) +func (w wrappedOption) applyGRPCOption(cfg otlpconfig.Config) otlpconfig.Config { + return w.ApplyGRPCOption(cfg) } // WithInsecure disables client transport security for the exporter's gRPC @@ -77,8 +77,9 @@ func WithEndpoint(endpoint string) Option { // // This option has no effect if WithGRPCConn is used. func WithReconnectionPeriod(rp time.Duration) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.ReconnectionPeriod = rp + return cfg })} } @@ -117,8 +118,9 @@ func WithHeaders(headers map[string]string) Option { // // This option has no effect if WithGRPCConn is used. func WithTLSCredentials(creds credentials.TransportCredentials) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.Traces.GRPCCredentials = creds + return cfg })} } @@ -126,8 +128,9 @@ func WithTLSCredentials(creds credentials.TransportCredentials) Option { // // This option has no effect if WithGRPCConn is used. func WithServiceConfig(serviceConfig string) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.ServiceConfig = serviceConfig + return cfg })} } @@ -138,8 +141,9 @@ func WithServiceConfig(serviceConfig string) Option { // // This option has no effect if WithGRPCConn is used. func WithDialOption(opts ...grpc.DialOption) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.DialOptions = opts + return cfg })} } @@ -152,8 +156,9 @@ func WithDialOption(opts ...grpc.DialOption) Option { // It is the callers responsibility to close the passed conn. The client // Shutdown method will not close this connection. func WithGRPCConn(conn *grpc.ClientConn) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg *otlpconfig.Config) { + return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { cfg.GRPCConn = conn + return cfg })} } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index dbc6c5ba785..81487f9b6f9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -80,9 +80,9 @@ var _ otlptrace.Client = (*client)(nil) // NewClient creates a new HTTP trace client. func NewClient(opts ...Option) otlptrace.Client { cfg := otlpconfig.NewDefaultConfig() - otlpconfig.ApplyHTTPEnvConfigs(&cfg) + cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) for _, opt := range opts { - opt.applyHTTPOption(&cfg) + cfg = opt.applyHTTPOption(cfg) } for pathPtr, defaultPath := range map[*string]string{ diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index 5b52f8fc65c..e550cfb5d51 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -37,7 +37,7 @@ const ( // Option applies an option to the HTTP client. type Option interface { - applyHTTPOption(*otlpconfig.Config) + applyHTTPOption(otlpconfig.Config) otlpconfig.Config } // RetryConfig defines configuration for retrying batches in case of export @@ -48,8 +48,8 @@ type wrappedOption struct { otlpconfig.HTTPOption } -func (w wrappedOption) applyHTTPOption(cfg *otlpconfig.Config) { - w.ApplyHTTPOption(cfg) +func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config { + return w.ApplyHTTPOption(cfg) } // WithEndpoint allows one to set the address of the collector diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 097afda83ce..305800ddbde 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -54,7 +54,7 @@ func newConfig(options ...Option) (config, error) { LabelEncoder: defaultLabelEncoder, } for _, opt := range options { - opt.apply(&cfg) + cfg = opt.apply(cfg) } return cfg, nil @@ -62,7 +62,7 @@ func newConfig(options ...Option) (config, error) { // Option sets the value of an option for a Config. type Option interface { - apply(*config) + apply(config) config } // WithWriter sets the export stream destination. @@ -74,8 +74,9 @@ type writerOption struct { W io.Writer } -func (o writerOption) apply(cfg *config) { +func (o writerOption) apply(cfg config) config { cfg.Writer = o.W + return cfg } // WithPrettyPrint sets the export stream format to use JSON. @@ -85,8 +86,9 @@ func WithPrettyPrint() Option { type prettyPrintOption bool -func (o prettyPrintOption) apply(cfg *config) { +func (o prettyPrintOption) apply(cfg config) config { cfg.PrettyPrint = bool(o) + return cfg } // WithoutTimestamps sets the export stream to not include timestamps. @@ -96,8 +98,9 @@ func WithoutTimestamps() Option { type timestampsOption bool -func (o timestampsOption) apply(cfg *config) { +func (o timestampsOption) apply(cfg config) config { cfg.Timestamps = bool(o) + return cfg } // WithLabelEncoder sets the label encoder used in export. @@ -109,6 +112,7 @@ type labelEncoderOption struct { LabelEncoder attribute.Encoder } -func (o labelEncoderOption) apply(cfg *config) { +func (o labelEncoderOption) apply(cfg config) config { cfg.LabelEncoder = o.LabelEncoder + return cfg } diff --git a/exporters/stdout/stdouttrace/config.go b/exporters/stdout/stdouttrace/config.go index c645ec86455..6b5a97b04cf 100644 --- a/exporters/stdout/stdouttrace/config.go +++ b/exporters/stdout/stdouttrace/config.go @@ -47,7 +47,7 @@ func newConfig(options ...Option) (config, error) { Timestamps: defaultTimestamps, } for _, opt := range options { - opt.apply(&cfg) + cfg = opt.apply(cfg) } return cfg, nil @@ -55,7 +55,7 @@ func newConfig(options ...Option) (config, error) { // Option sets the value of an option for a Config. type Option interface { - apply(*config) + apply(config) config } // WithWriter sets the export stream destination. @@ -67,8 +67,9 @@ type writerOption struct { W io.Writer } -func (o writerOption) apply(cfg *config) { +func (o writerOption) apply(cfg config) config { cfg.Writer = o.W + return cfg } // WithPrettyPrint sets the export stream format to use JSON. @@ -78,8 +79,9 @@ func WithPrettyPrint() Option { type prettyPrintOption bool -func (o prettyPrintOption) apply(cfg *config) { +func (o prettyPrintOption) apply(cfg config) config { cfg.PrettyPrint = bool(o) + return cfg } // WithoutTimestamps sets the export stream to not include timestamps. @@ -89,6 +91,7 @@ func WithoutTimestamps() Option { type timestampsOption bool -func (o timestampsOption) apply(cfg *config) { +func (o timestampsOption) apply(cfg config) config { cfg.Timestamps = bool(o) + return cfg } diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 23a44a1ba97..5c7c20049d9 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -55,26 +55,28 @@ type config struct { // Option defines a function that configures the exporter. type Option interface { - apply(*config) + apply(config) config } -type optionFunc func(*config) +type optionFunc func(config) config -func (fn optionFunc) apply(cfg *config) { - fn(cfg) +func (fn optionFunc) apply(cfg config) config { + return fn(cfg) } // WithLogger configures the exporter to use the passed logger. func WithLogger(logger *log.Logger) Option { - return optionFunc(func(cfg *config) { + return optionFunc(func(cfg config) config { cfg.logger = logger + return cfg }) } // WithClient configures the exporter to use the passed HTTP client. func WithClient(client *http.Client) Option { - return optionFunc(func(cfg *config) { + return optionFunc(func(cfg config) config { cfg.client = client + return cfg }) } @@ -94,7 +96,7 @@ func New(collectorURL string, opts ...Option) (*Exporter, error) { cfg := config{} for _, opt := range opts { - opt.apply(&cfg) + cfg = opt.apply(cfg) } if cfg.client == nil { diff --git a/metric/config.go b/metric/config.go index 686ca7c1acb..3f722344fa7 100644 --- a/metric/config.go +++ b/metric/config.go @@ -38,7 +38,7 @@ func (cfg *InstrumentConfig) Unit() unit.Unit { type InstrumentOption interface { // ApplyMeter is used to set a InstrumentOption value of a // InstrumentConfig. - applyInstrument(*InstrumentConfig) + applyInstrument(InstrumentConfig) InstrumentConfig } // NewInstrumentConfig creates a new InstrumentConfig @@ -46,28 +46,30 @@ type InstrumentOption interface { func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig { var config InstrumentConfig for _, o := range opts { - o.applyInstrument(&config) + config = o.applyInstrument(config) } return config } -type instrumentOptionFunc func(*InstrumentConfig) +type instrumentOptionFunc func(InstrumentConfig) InstrumentConfig -func (fn instrumentOptionFunc) applyInstrument(cfg *InstrumentConfig) { - fn(cfg) +func (fn instrumentOptionFunc) applyInstrument(cfg InstrumentConfig) InstrumentConfig { + return fn(cfg) } // WithDescription applies provided description. func WithDescription(desc string) InstrumentOption { - return instrumentOptionFunc(func(cfg *InstrumentConfig) { + return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig { cfg.description = desc + return cfg }) } // WithUnit applies provided unit. func WithUnit(unit unit.Unit) InstrumentOption { - return instrumentOptionFunc(func(cfg *InstrumentConfig) { + return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig { cfg.unit = unit + return cfg }) } @@ -90,7 +92,7 @@ func (cfg *MeterConfig) SchemaURL() string { // MeterOption is an interface for applying Meter options. type MeterOption interface { // ApplyMeter is used to set a MeterOption value of a MeterConfig. - applyMeter(*MeterConfig) + applyMeter(MeterConfig) MeterConfig } // NewMeterConfig creates a new MeterConfig and applies @@ -98,27 +100,29 @@ type MeterOption interface { func NewMeterConfig(opts ...MeterOption) MeterConfig { var config MeterConfig for _, o := range opts { - o.applyMeter(&config) + config = o.applyMeter(config) } return config } -type meterOptionFunc func(*MeterConfig) +type meterOptionFunc func(MeterConfig) MeterConfig -func (fn meterOptionFunc) applyMeter(cfg *MeterConfig) { - fn(cfg) +func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig { + return fn(cfg) } // WithInstrumentationVersion sets the instrumentation version. func WithInstrumentationVersion(version string) MeterOption { - return meterOptionFunc(func(config *MeterConfig) { + return meterOptionFunc(func(config MeterConfig) MeterConfig { config.instrumentationVersion = version + return config }) } // WithSchemaURL sets the schema URL. func WithSchemaURL(schemaURL string) MeterOption { - return meterOptionFunc(func(config *MeterConfig) { + return meterOptionFunc(func(config MeterConfig) MeterConfig { config.schemaURL = schemaURL + return config }) } diff --git a/sdk/metric/controller/basic/config.go b/sdk/metric/controller/basic/config.go index 01691ecadd1..f3a9830c6af 100644 --- a/sdk/metric/controller/basic/config.go +++ b/sdk/metric/controller/basic/config.go @@ -62,7 +62,7 @@ type config struct { // Option is the interface that applies the value to a configuration option. type Option interface { // apply sets the Option value of a Config. - apply(*config) + apply(config) config } // WithResource sets the Resource configuration option of a Config by merging it @@ -73,12 +73,13 @@ func WithResource(r *resource.Resource) Option { type resourceOption struct{ *resource.Resource } -func (o resourceOption) apply(cfg *config) { +func (o resourceOption) apply(cfg config) config { res, err := resource.Merge(cfg.Resource, o.Resource) if err != nil { otel.Handle(err) } cfg.Resource = res + return cfg } // WithCollectPeriod sets the CollectPeriod configuration option of a Config. @@ -88,8 +89,9 @@ func WithCollectPeriod(period time.Duration) Option { type collectPeriodOption time.Duration -func (o collectPeriodOption) apply(cfg *config) { +func (o collectPeriodOption) apply(cfg config) config { cfg.CollectPeriod = time.Duration(o) + return cfg } // WithCollectTimeout sets the CollectTimeout configuration option of a Config. @@ -99,8 +101,9 @@ func WithCollectTimeout(timeout time.Duration) Option { type collectTimeoutOption time.Duration -func (o collectTimeoutOption) apply(cfg *config) { +func (o collectTimeoutOption) apply(cfg config) config { cfg.CollectTimeout = time.Duration(o) + return cfg } // WithExporter sets the exporter configuration option of a Config. @@ -110,8 +113,9 @@ func WithExporter(exporter export.Exporter) Option { type exporterOption struct{ exporter export.Exporter } -func (o exporterOption) apply(cfg *config) { +func (o exporterOption) apply(cfg config) config { cfg.Exporter = o.exporter + return cfg } // WithPushTimeout sets the PushTimeout configuration option of a Config. @@ -121,6 +125,7 @@ func WithPushTimeout(timeout time.Duration) Option { type pushTimeoutOption time.Duration -func (o pushTimeoutOption) apply(cfg *config) { +func (o pushTimeoutOption) apply(cfg config) config { cfg.PushTimeout = time.Duration(o) + return cfg } diff --git a/sdk/metric/controller/basic/config_test.go b/sdk/metric/controller/basic/config_test.go index d93cc53a677..32757b8a966 100644 --- a/sdk/metric/controller/basic/config_test.go +++ b/sdk/metric/controller/basic/config_test.go @@ -26,12 +26,12 @@ import ( func TestWithResource(t *testing.T) { r := resource.NewSchemaless(attribute.String("A", "a")) - c := &config{} - WithResource(r).apply(c) + c := config{} + c = WithResource(r).apply(c) assert.Equal(t, r.Equivalent(), c.Resource.Equivalent()) // Ensure overwriting works. - c = &config{Resource: &resource.Resource{}} - WithResource(r).apply(c) + c = config{Resource: &resource.Resource{}} + c = WithResource(r).apply(c) assert.Equal(t, r.Equivalent(), c.Resource.Equivalent()) } diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index a684f65678e..ee694056228 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -112,13 +112,13 @@ type accumulatorCheckpointer struct { // and options (including optional exporter) to configure a metric // export pipeline. func New(checkpointerFactory export.CheckpointerFactory, opts ...Option) *Controller { - c := &config{ + c := config{ CollectPeriod: DefaultPeriod, CollectTimeout: DefaultPeriod, PushTimeout: DefaultPeriod, } for _, opt := range opts { - opt.apply(c) + c = opt.apply(c) } if c.Resource == nil { c.Resource = resource.Default() diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index 08912da0308..71101bc4bce 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -132,7 +132,7 @@ type factory struct { func NewFactory(aselector export.AggregatorSelector, tselector aggregation.TemporalitySelector, opts ...Option) export.CheckpointerFactory { var config config for _, opt := range opts { - opt.applyProcessor(&config) + config = opt.applyProcessor(config) } return factory{ aselector: aselector, diff --git a/sdk/metric/processor/basic/config.go b/sdk/metric/processor/basic/config.go index f4cf440cf4c..5170864d7e9 100644 --- a/sdk/metric/processor/basic/config.go +++ b/sdk/metric/processor/basic/config.go @@ -24,7 +24,7 @@ type config struct { } type Option interface { - applyProcessor(*config) + applyProcessor(config) config } // WithMemory sets the memory behavior of a Processor. If this is @@ -37,6 +37,7 @@ func WithMemory(memory bool) Option { type memoryOption bool -func (m memoryOption) applyProcessor(cfg *config) { +func (m memoryOption) applyProcessor(cfg config) config { cfg.Memory = bool(m) + return cfg } diff --git a/sdk/resource/config.go b/sdk/resource/config.go index 5fa45859b53..d80b5ae6214 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -31,7 +31,7 @@ type config struct { // Option is the interface that applies a configuration option. type Option interface { // apply sets the Option value of a config. - apply(*config) + apply(config) config } // WithAttributes adds attributes to the configured Resource. @@ -56,8 +56,9 @@ type detectorsOption struct { detectors []Detector } -func (o detectorsOption) apply(cfg *config) { +func (o detectorsOption) apply(cfg config) config { cfg.detectors = append(cfg.detectors, o.detectors...) + return cfg } // WithFromEnv adds attributes from environment variables to the configured resource. @@ -82,8 +83,9 @@ func WithSchemaURL(schemaURL string) Option { type schemaURLOption string -func (o schemaURLOption) apply(cfg *config) { +func (o schemaURLOption) apply(cfg config) config { cfg.schemaURL = string(o) + return cfg } // WithOS adds all the OS attributes to the configured Resource. diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 4ef49b314fc..e842744ae91 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -48,7 +48,7 @@ var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflic func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg := config{} for _, opt := range opts { - opt.apply(&cfg) + cfg = opt.apply(cfg) } resource, err := Detect(ctx, cfg.detectors...) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 68bdefe0c94..b4fdcd317a4 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -93,13 +93,13 @@ var _ trace.TracerProvider = &TracerProvider{} // The passed opts are used to override these default values and configure the // returned TracerProvider appropriately. func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { - o := &tracerProviderConfig{} + o := tracerProviderConfig{} for _, opt := range opts { - opt.apply(o) + o = opt.apply(o) } - ensureValidTracerProviderConfig(o) + o = ensureValidTracerProviderConfig(o) tp := &TracerProvider{ namedTracer: make(map[instrumentation.Library]*tracer), @@ -256,13 +256,13 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { } type TracerProviderOption interface { - apply(*tracerProviderConfig) + apply(tracerProviderConfig) tracerProviderConfig } -type traceProviderOptionFunc func(*tracerProviderConfig) +type traceProviderOptionFunc func(tracerProviderConfig) tracerProviderConfig -func (fn traceProviderOptionFunc) apply(cfg *tracerProviderConfig) { - fn(cfg) +func (fn traceProviderOptionFunc) apply(cfg tracerProviderConfig) tracerProviderConfig { + return fn(cfg) } // WithSyncer registers the exporter with the TracerProvider using a @@ -285,8 +285,9 @@ func WithBatcher(e SpanExporter, opts ...BatchSpanProcessorOption) TracerProvide // WithSpanProcessor registers the SpanProcessor with a TracerProvider. func WithSpanProcessor(sp SpanProcessor) TracerProviderOption { - return traceProviderOptionFunc(func(cfg *tracerProviderConfig) { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { cfg.processors = append(cfg.processors, sp) + return cfg }) } @@ -298,12 +299,13 @@ func WithSpanProcessor(sp SpanProcessor) TracerProviderOption { // If this option is not used, the TracerProvider will use the // resource.Default() Resource by default. func WithResource(r *resource.Resource) TracerProviderOption { - return traceProviderOptionFunc(func(cfg *tracerProviderConfig) { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { var err error cfg.resource, err = resource.Merge(resource.Environment(), r) if err != nil { otel.Handle(err) } + return cfg }) } @@ -315,10 +317,11 @@ func WithResource(r *resource.Resource) TracerProviderOption { // If this option is not used, the TracerProvider will use a random number // IDGenerator by default. func WithIDGenerator(g IDGenerator) TracerProviderOption { - return traceProviderOptionFunc(func(cfg *tracerProviderConfig) { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { if g != nil { cfg.idGenerator = g } + return cfg }) } @@ -330,10 +333,11 @@ func WithIDGenerator(g IDGenerator) TracerProviderOption { // If this option is not used, the TracerProvider will use a // ParentBased(AlwaysSample) Sampler by default. func WithSampler(s Sampler) TracerProviderOption { - return traceProviderOptionFunc(func(cfg *tracerProviderConfig) { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { if s != nil { cfg.sampler = s } + return cfg }) } @@ -345,13 +349,14 @@ func WithSampler(s Sampler) TracerProviderOption { // If this option is not used, the TracerProvider will use the default // SpanLimits. func WithSpanLimits(sl SpanLimits) TracerProviderOption { - return traceProviderOptionFunc(func(cfg *tracerProviderConfig) { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { cfg.spanLimits = sl + return cfg }) } // ensureValidTracerProviderConfig ensures that given TracerProviderConfig is valid. -func ensureValidTracerProviderConfig(cfg *tracerProviderConfig) { +func ensureValidTracerProviderConfig(cfg tracerProviderConfig) tracerProviderConfig { if cfg.sampler == nil { cfg.sampler = ParentBased(AlwaysSample()) } @@ -362,4 +367,5 @@ func ensureValidTracerProviderConfig(cfg *tracerProviderConfig) { if cfg.resource == nil { cfg.resource = resource.Default() } + return cfg } diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index 849248638c4..a4ac588f666 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -187,7 +187,7 @@ func configureSamplersForParentBased(samplers []ParentBasedSamplerOption) sample } for _, so := range samplers { - so.apply(&c) + c = so.apply(c) } return c @@ -201,7 +201,7 @@ type samplerConfig struct { // ParentBasedSamplerOption configures the sampler for a particular sampling case. type ParentBasedSamplerOption interface { - apply(*samplerConfig) + apply(samplerConfig) samplerConfig } // WithRemoteParentSampled sets the sampler for the case of sampled remote parent. @@ -213,8 +213,9 @@ type remoteParentSampledOption struct { s Sampler } -func (o remoteParentSampledOption) apply(config *samplerConfig) { +func (o remoteParentSampledOption) apply(config samplerConfig) samplerConfig { config.remoteParentSampled = o.s + return config } // WithRemoteParentNotSampled sets the sampler for the case of remote parent @@ -227,8 +228,9 @@ type remoteParentNotSampledOption struct { s Sampler } -func (o remoteParentNotSampledOption) apply(config *samplerConfig) { +func (o remoteParentNotSampledOption) apply(config samplerConfig) samplerConfig { config.remoteParentNotSampled = o.s + return config } // WithLocalParentSampled sets the sampler for the case of sampled local parent. @@ -240,8 +242,9 @@ type localParentSampledOption struct { s Sampler } -func (o localParentSampledOption) apply(config *samplerConfig) { +func (o localParentSampledOption) apply(config samplerConfig) samplerConfig { config.localParentSampled = o.s + return config } // WithLocalParentNotSampled sets the sampler for the case of local parent @@ -254,8 +257,9 @@ type localParentNotSampledOption struct { s Sampler } -func (o localParentNotSampledOption) apply(config *samplerConfig) { +func (o localParentNotSampledOption) apply(config samplerConfig) samplerConfig { config.localParentNotSampled = o.s + return config } func (pb parentBased) ShouldSample(p SamplingParameters) SamplingResult { diff --git a/trace/config.go b/trace/config.go index 8461a15ccd4..bcc333e04e2 100644 --- a/trace/config.go +++ b/trace/config.go @@ -41,20 +41,20 @@ func (t *TracerConfig) SchemaURL() string { func NewTracerConfig(options ...TracerOption) TracerConfig { var config TracerConfig for _, option := range options { - option.apply(&config) + config = option.apply(config) } return config } // TracerOption applies an option to a TracerConfig. type TracerOption interface { - apply(*TracerConfig) + apply(TracerConfig) TracerConfig } -type tracerOptionFunc func(*TracerConfig) +type tracerOptionFunc func(TracerConfig) TracerConfig -func (fn tracerOptionFunc) apply(cfg *TracerConfig) { - fn(cfg) +func (fn tracerOptionFunc) apply(cfg TracerConfig) TracerConfig { + return fn(cfg) } // SpanConfig is a group of options for a Span. @@ -106,7 +106,7 @@ func (cfg *SpanConfig) SpanKind() SpanKind { func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { var c SpanConfig for _, option := range options { - option.applySpanStart(&c) + c = option.applySpanStart(c) } return c } @@ -118,7 +118,7 @@ func NewSpanStartConfig(options ...SpanStartOption) SpanConfig { func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { var c SpanConfig for _, option := range options { - option.applySpanEnd(&c) + c = option.applySpanEnd(c) } return c } @@ -126,19 +126,19 @@ func NewSpanEndConfig(options ...SpanEndOption) SpanConfig { // SpanStartOption applies an option to a SpanConfig. These options are applicable // only when the span is created type SpanStartOption interface { - applySpanStart(*SpanConfig) + applySpanStart(SpanConfig) SpanConfig } -type spanOptionFunc func(*SpanConfig) +type spanOptionFunc func(SpanConfig) SpanConfig -func (fn spanOptionFunc) applySpanStart(cfg *SpanConfig) { - fn(cfg) +func (fn spanOptionFunc) applySpanStart(cfg SpanConfig) SpanConfig { + return fn(cfg) } // SpanEndOption applies an option to a SpanConfig. These options are // applicable only when the span is ended. type SpanEndOption interface { - applySpanEnd(*SpanConfig) + applySpanEnd(SpanConfig) SpanConfig } // EventConfig is a group of options for an Event. @@ -170,7 +170,7 @@ func (cfg *EventConfig) StackTrace() bool { func NewEventConfig(options ...EventOption) EventConfig { var c EventConfig for _, option := range options { - option.applyEvent(&c) + c = option.applyEvent(c) } if c.timestamp.IsZero() { c.timestamp = time.Now() @@ -180,7 +180,7 @@ func NewEventConfig(options ...EventOption) EventConfig { // EventOption applies span event options to an EventConfig. type EventOption interface { - applyEvent(*EventConfig) + applyEvent(EventConfig) EventConfig } // SpanOption are options that can be used at both the beginning and end of a span. @@ -203,12 +203,14 @@ type SpanEndEventOption interface { type attributeOption []attribute.KeyValue -func (o attributeOption) applySpan(c *SpanConfig) { +func (o attributeOption) applySpan(c SpanConfig) SpanConfig { c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c } -func (o attributeOption) applySpanStart(c *SpanConfig) { o.applySpan(c) } -func (o attributeOption) applyEvent(c *EventConfig) { +func (o attributeOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o attributeOption) applyEvent(c EventConfig) EventConfig { c.attributes = append(c.attributes, []attribute.KeyValue(o)...) + return c } var _ SpanStartEventOption = attributeOption{} @@ -234,10 +236,16 @@ type SpanEventOption interface { type timestampOption time.Time -func (o timestampOption) applySpan(c *SpanConfig) { c.timestamp = time.Time(o) } -func (o timestampOption) applySpanStart(c *SpanConfig) { o.applySpan(c) } -func (o timestampOption) applySpanEnd(c *SpanConfig) { o.applySpan(c) } -func (o timestampOption) applyEvent(c *EventConfig) { c.timestamp = time.Time(o) } +func (o timestampOption) applySpan(c SpanConfig) SpanConfig { + c.timestamp = time.Time(o) + return c +} +func (o timestampOption) applySpanStart(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } +func (o timestampOption) applyEvent(c EventConfig) EventConfig { + c.timestamp = time.Time(o) + return c +} var _ SpanEventOption = timestampOption{} @@ -249,9 +257,15 @@ func WithTimestamp(t time.Time) SpanEventOption { type stackTraceOption bool -func (o stackTraceOption) applyEvent(c *EventConfig) { c.stackTrace = bool(o) } -func (o stackTraceOption) applySpan(c *SpanConfig) { c.stackTrace = bool(o) } -func (o stackTraceOption) applySpanEnd(c *SpanConfig) { o.applySpan(c) } +func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { + c.stackTrace = bool(o) + return c +} +func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { + c.stackTrace = bool(o) + return c +} +func (o stackTraceOption) applySpanEnd(c SpanConfig) SpanConfig { return o.applySpan(c) } // WithStackTrace sets the flag to capture the error with stack trace (e.g. true, false). func WithStackTrace(b bool) SpanEndEventOption { @@ -261,8 +275,9 @@ func WithStackTrace(b bool) SpanEndEventOption { // WithLinks adds links to a Span. The links are added to the existing Span // links, i.e. this does not overwrite. Links with invalid span context are ignored. func WithLinks(links ...Link) SpanStartOption { - return spanOptionFunc(func(cfg *SpanConfig) { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { cfg.links = append(cfg.links, links...) + return cfg }) } @@ -270,28 +285,32 @@ func WithLinks(links ...Link) SpanStartOption { // existing parent span context will be ignored when defining the Span's trace // identifiers. func WithNewRoot() SpanStartOption { - return spanOptionFunc(func(cfg *SpanConfig) { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { cfg.newRoot = true + return cfg }) } // WithSpanKind sets the SpanKind of a Span. func WithSpanKind(kind SpanKind) SpanStartOption { - return spanOptionFunc(func(cfg *SpanConfig) { + return spanOptionFunc(func(cfg SpanConfig) SpanConfig { cfg.spanKind = kind + return cfg }) } // WithInstrumentationVersion sets the instrumentation version. func WithInstrumentationVersion(version string) TracerOption { - return tracerOptionFunc(func(cfg *TracerConfig) { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { cfg.instrumentationVersion = version + return cfg }) } // WithSchemaURL sets the schema URL for the Tracer. func WithSchemaURL(schemaURL string) TracerOption { - return tracerOptionFunc(func(cfg *TracerConfig) { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { cfg.schemaURL = schemaURL + return cfg }) } diff --git a/trace/config_test.go b/trace/config_test.go index 877bd024eeb..a4cafcbcd09 100644 --- a/trace/config_test.go +++ b/trace/config_test.go @@ -252,3 +252,71 @@ func TestTracerConfig(t *testing.T) { assert.Equal(t, test.expected, config) } } + +// Save benchmark results to a file level var to avoid the compiler optimizing +// away the actual work. +var ( + tracerConfig TracerConfig + spanConfig SpanConfig + eventConfig EventConfig +) + +func BenchmarkNewTracerConfig(b *testing.B) { + opts := []TracerOption{ + WithInstrumentationVersion("testing verion"), + WithSchemaURL("testing URL"), + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + tracerConfig = NewTracerConfig(opts...) + } +} + +func BenchmarkNewSpanStartConfig(b *testing.B) { + opts := []SpanStartOption{ + WithAttributes(attribute.Bool("key", true)), + WithTimestamp(time.Now()), + WithLinks(Link{}), + WithNewRoot(), + WithSpanKind(SpanKindClient), + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + spanConfig = NewSpanStartConfig(opts...) + } +} + +func BenchmarkNewSpanEndConfig(b *testing.B) { + opts := []SpanEndOption{ + WithTimestamp(time.Now()), + WithStackTrace(true), + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + spanConfig = NewSpanEndConfig(opts...) + } +} + +func BenchmarkNewEventConfig(b *testing.B) { + opts := []EventOption{ + WithAttributes(attribute.Bool("key", true)), + WithTimestamp(time.Now()), + WithStackTrace(true), + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + eventConfig = NewEventConfig(opts...) + } +} From d5292e3cd1c2ff1d759aacc5959243520000ce0a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 1 Feb 2022 15:20:35 -0800 Subject: [PATCH 052/886] Do not store TracerProvider or Tracer fields in SDK recordingSpan (#2575) * Do not store TracerProvider fields in span Instead of keeping a reference to the span's Tracer, and therefore also it's TracerProvider, and the associated resource and spanLimits just keep the reference to the Tracer. Refer to the TracerProvider fields when needed instead. * Make span refer to the inst lib via the Tracer Instead of holding a field in the span, refer to the field in the parent Tracer. --- sdk/trace/provider.go | 11 +++++++---- sdk/trace/span.go | 31 ++++++++++--------------------- sdk/trace/tracer.go | 21 +++++++++------------ 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index b4fdcd317a4..c6b311f9cdc 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -74,10 +74,13 @@ type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Library]*tracer spanProcessors atomic.Value - sampler Sampler - idGenerator IDGenerator - spanLimits SpanLimits - resource *resource.Resource + + // These fields are not protected by the lock mu. They are assumed to be + // immutable after creation of the TracerProvider. + sampler Sampler + idGenerator IDGenerator + spanLimits SpanLimits + resource *resource.Resource } var _ trace.TracerProvider = &TracerProvider{} diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 0111c475895..bf0c41c1112 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -126,14 +126,6 @@ type recordingSpan struct { // childSpanCount holds the number of child spans created for this span. childSpanCount int - // resource contains attributes representing an entity that produced this - // span. - resource *resource.Resource - - // instrumentationLibrary defines the instrumentation library used to - // provide instrumentation. - instrumentationLibrary instrumentation.Library - // spanContext holds the SpanContext of this span. spanContext trace.SpanContext @@ -152,9 +144,6 @@ type recordingSpan struct { // tracer is the SDK tracer that created this span. tracer *tracer - - // spanLimits holds the limits to this span. - spanLimits SpanLimits } var _ ReadWriteSpan = (*recordingSpan)(nil) @@ -336,9 +325,9 @@ func (s *recordingSpan) addEvent(name string, o ...trace.EventOption) { // Discard over limited attributes attributes := c.Attributes() var discarded int - if len(attributes) > s.spanLimits.AttributePerEventCountLimit { - discarded = len(attributes) - s.spanLimits.AttributePerEventCountLimit - attributes = attributes[:s.spanLimits.AttributePerEventCountLimit] + if len(attributes) > s.tracer.provider.spanLimits.AttributePerEventCountLimit { + discarded = len(attributes) - s.tracer.provider.spanLimits.AttributePerEventCountLimit + attributes = attributes[:s.tracer.provider.spanLimits.AttributePerEventCountLimit] } s.mu.Lock() defer s.mu.Unlock() @@ -440,7 +429,7 @@ func (s *recordingSpan) Status() Status { func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { s.mu.Lock() defer s.mu.Unlock() - return s.instrumentationLibrary + return s.tracer.instrumentationLibrary } // Resource returns the Resource associated with the Tracer that created this @@ -448,7 +437,7 @@ func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { func (s *recordingSpan) Resource() *resource.Resource { s.mu.Lock() defer s.mu.Unlock() - return s.resource + return s.tracer.provider.resource } func (s *recordingSpan) addLink(link trace.Link) { @@ -461,9 +450,9 @@ func (s *recordingSpan) addLink(link trace.Link) { var droppedAttributeCount int // Discard over limited attributes - if len(link.Attributes) > s.spanLimits.AttributePerLinkCountLimit { - droppedAttributeCount = len(link.Attributes) - s.spanLimits.AttributePerLinkCountLimit - link.Attributes = link.Attributes[:s.spanLimits.AttributePerLinkCountLimit] + if len(link.Attributes) > s.tracer.provider.spanLimits.AttributePerLinkCountLimit { + droppedAttributeCount = len(link.Attributes) - s.tracer.provider.spanLimits.AttributePerLinkCountLimit + link.Attributes = link.Attributes[:s.tracer.provider.spanLimits.AttributePerLinkCountLimit] } s.links.add(Link{link.SpanContext, link.Attributes, droppedAttributeCount}) @@ -514,10 +503,10 @@ func (s *recordingSpan) snapshot() ReadOnlySpan { defer s.mu.Unlock() sd.endTime = s.endTime - sd.instrumentationLibrary = s.instrumentationLibrary + sd.instrumentationLibrary = s.tracer.instrumentationLibrary sd.name = s.name sd.parent = s.parent - sd.resource = s.resource + sd.resource = s.tracer.provider.resource sd.spanContext = s.spanContext sd.spanKind = s.spanKind sd.startTime = s.startTime diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index 1177c729a8f..b63b4196516 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -122,18 +122,15 @@ func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr Sa } s := &recordingSpan{ - parent: psc, - spanContext: sc, - spanKind: trace.ValidateSpanKind(config.SpanKind()), - name: name, - startTime: startTime, - attributes: newAttributesMap(tr.provider.spanLimits.AttributeCountLimit), - events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit), - links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit), - tracer: tr, - spanLimits: tr.provider.spanLimits, - resource: tr.provider.resource, - instrumentationLibrary: tr.instrumentationLibrary, + parent: psc, + spanContext: sc, + spanKind: trace.ValidateSpanKind(config.SpanKind()), + name: name, + startTime: startTime, + attributes: newAttributesMap(tr.provider.spanLimits.AttributeCountLimit), + events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit), + links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit), + tracer: tr, } for _, l := range config.Links() { From c5776cc953121df58f59d8870caab7e0afbae4bc Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 3 Feb 2022 18:24:44 -0500 Subject: [PATCH 053/886] [website_docs] fix page meta-links (#2580) Contributes to https://github.com/open-telemetry/opentelemetry.io/issues/1096 /cc @cartermp @austinlparker --- website_docs/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/_index.md b/website_docs/_index.md index 818e0c26eab..a21cc50329d 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -7,7 +7,7 @@ aliases: [/golang, /golang/metrics, /golang/tracing] cascade: github_repo: &repo https://github.com/open-telemetry/opentelemetry-go github_subdir: website_docs - path_base_for_github_subdir: content/en/docs/go/ + path_base_for_github_subdir: content/en/docs/instrumentation/go/ github_project_repo: *repo spelling: cSpell:ignore godoc weight: 16 From cb76cf1b0d4f2f1dc38814df616c45f14c6a4c33 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 4 Feb 2022 17:19:39 +0100 Subject: [PATCH 054/886] Validate members once, in `NewMember` (#2522) * use NewMember, or specify if the member is not validated when creating new ones * expect members to already be validated when creating a new package * add changelog entry * add an isEmpty field to member and property for quick validation * rename isEmpty to hasData So by default, an empty struct really is marked as having no data * Update baggage/baggage_test.go Co-authored-by: Aaron Clawson * don't validate the member in parseMember, we alredy ran that validation We also don't want to use NewMember, as that runs the property validation again, making the benchmark quite slower * move changelog entry to the fixed section * provide the member/property data when returning an invalid error Co-authored-by: Aaron Clawson --- CHANGELOG.md | 1 + baggage/baggage.go | 100 ++++++++++++++++++++++++++++------------ baggage/baggage_test.go | 90 +++++++++++++++++++++++++++--------- 3 files changed, 140 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb91daf7486..89df8a8c5a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) - Specify explicit buckets in Prometheus example. (#2493) - W3C baggage will now decode urlescaped values. (#2529) +- Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) ### Removed diff --git a/baggage/baggage.go b/baggage/baggage.go index d52a298ed1b..824c67b27a3 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -61,45 +61,57 @@ type Property struct { // hasValue indicates if a zero-value value means the property does not // have a value or if it was the zero-value. hasValue bool + + // hasData indicates whether the created property contains data or not. + // Properties that do not contain data are invalid with no other check + // required. + hasData bool } func NewKeyProperty(key string) (Property, error) { - p := Property{} if !keyRe.MatchString(key) { - return p, fmt.Errorf("%w: %q", errInvalidKey, key) + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } - p.key = key + + p := Property{key: key, hasData: true} return p, nil } func NewKeyValueProperty(key, value string) (Property, error) { - p := Property{} if !keyRe.MatchString(key) { - return p, fmt.Errorf("%w: %q", errInvalidKey, key) + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } if !valueRe.MatchString(value) { - return p, fmt.Errorf("%w: %q", errInvalidValue, value) + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + + p := Property{ + key: key, + value: value, + hasValue: true, + hasData: true, } - p.key = key - p.value = value - p.hasValue = true return p, nil } +func newInvalidProperty() Property { + return Property{} +} + // parseProperty attempts to decode a Property from the passed string. It // returns an error if the input is invalid according to the W3C Baggage // specification. func parseProperty(property string) (Property, error) { - p := Property{} if property == "" { - return p, nil + return newInvalidProperty(), nil } match := propertyRe.FindStringSubmatch(property) if len(match) != 4 { - return p, fmt.Errorf("%w: %q", errInvalidProperty, property) + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) } + p := Property{hasData: true} if match[1] != "" { p.key = match[1] } else { @@ -107,6 +119,7 @@ func parseProperty(property string) (Property, error) { p.value = match[3] p.hasValue = true } + return p, nil } @@ -117,6 +130,10 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } + if !p.hasData { + return errFunc(fmt.Errorf("%w: %q", errInvalidProperty, p)) + } + if !keyRe.MatchString(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } @@ -220,26 +237,40 @@ func (p properties) String() string { type Member struct { key, value string properties properties + + // hasData indicates whether the created property contains data or not. + // Properties that do not contain data are invalid with no other check + // required. + hasData bool } // NewMember returns a new Member from the passed arguments. An error is // returned if the created Member would be invalid according to the W3C // Baggage specification. func NewMember(key, value string, props ...Property) (Member, error) { - m := Member{key: key, value: value, properties: properties(props).Copy()} + m := Member{ + key: key, + value: value, + properties: properties(props).Copy(), + hasData: true, + } if err := m.validate(); err != nil { - return Member{}, err + return newInvalidMember(), err } return m, nil } +func newInvalidMember() Member { + return Member{} +} + // parseMember attempts to decode a Member from the passed string. It returns // an error if the input is invalid according to the W3C Baggage // specification. func parseMember(member string) (Member, error) { if n := len(member); n > maxBytesPerMembers { - return Member{}, fmt.Errorf("%w: %d", errMemberBytes, n) + return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n) } var ( @@ -254,7 +285,7 @@ func parseMember(member string) (Member, error) { for _, pStr := range strings.Split(parts[1], propertyDelimiter) { p, err := parseProperty(pStr) if err != nil { - return Member{}, err + return newInvalidMember(), err } props = append(props, p) } @@ -265,7 +296,7 @@ func parseMember(member string) (Member, error) { // Take into account a value can contain equal signs (=). kv := strings.SplitN(parts[0], keyValueDelimiter, 2) if len(kv) != 2 { - return Member{}, fmt.Errorf("%w: %q", errInvalidMember, member) + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) } // "Leading and trailing whitespaces are allowed but MUST be trimmed // when converting the header into a data structure." @@ -273,13 +304,13 @@ func parseMember(member string) (Member, error) { var err error value, err = url.QueryUnescape(strings.TrimSpace(kv[1])) if err != nil { - return Member{}, fmt.Errorf("%w: %q", err, value) + return newInvalidMember(), fmt.Errorf("%w: %q", err, value) } if !keyRe.MatchString(key) { - return Member{}, fmt.Errorf("%w: %q", errInvalidKey, key) + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) } if !valueRe.MatchString(value) { - return Member{}, fmt.Errorf("%w: %q", errInvalidValue, value) + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } default: // This should never happen unless a developer has changed the string @@ -288,12 +319,16 @@ func parseMember(member string) (Member, error) { panic("failed to parse baggage member") } - return Member{key: key, value: value, properties: props}, nil + return Member{key: key, value: value, properties: props, hasData: true}, nil } // validate ensures m conforms to the W3C Baggage specification, returning an // error otherwise. func (m Member) validate() error { + if !m.hasData { + return fmt.Errorf("%w: %q", errInvalidMember, m) + } + if !keyRe.MatchString(m.key) { return fmt.Errorf("%w: %q", errInvalidKey, m.key) } @@ -329,9 +364,10 @@ type Baggage struct { //nolint:golint list baggage.List } -// New returns a new valid Baggage. It returns an error if the passed members -// are invalid according to the W3C Baggage specification or if it results in -// a Baggage exceeding limits set in that specification. +// New returns a new valid Baggage. It returns an error if it results in a +// Baggage exceeding limits set in that specification. +// +// It expects all the provided members to have already been validated. func New(members ...Member) (Baggage, error) { if len(members) == 0 { return Baggage{}, nil @@ -339,9 +375,10 @@ func New(members ...Member) (Baggage, error) { b := make(baggage.List) for _, m := range members { - if err := m.validate(); err != nil { - return Baggage{}, err + if !m.hasData { + return Baggage{}, errInvalidMember } + // OpenTelemetry resolves duplicates by last-one-wins. b[m.key] = baggage.Item{ Value: m.value, @@ -406,6 +443,8 @@ func Parse(bStr string) (Baggage, error) { // // If there is no list-member matching the passed key the returned Member will // be a zero-value Member. +// The returned member is not validated, as we assume the validation happened +// when it was added to the Baggage. func (b Baggage) Member(key string) Member { v, ok := b.list[key] if !ok { @@ -413,7 +452,7 @@ func (b Baggage) Member(key string) Member { // where a zero-valued Member is included in the Baggage because a // zero-valued Member is invalid according to the W3C Baggage // specification (it has an empty key). - return Member{} + return newInvalidMember() } return Member{ @@ -425,6 +464,9 @@ func (b Baggage) Member(key string) Member { // Members returns all the baggage list-members. // The order of the returned list-members does not have significance. +// +// The returned members are not validated, as we assume the validation happened +// when they were added to the Baggage. func (b Baggage) Members() []Member { if len(b.list) == 0 { return nil @@ -448,8 +490,8 @@ func (b Baggage) Members() []Member { // If member is invalid according to the W3C Baggage specification, an error // is returned with the original Baggage. func (b Baggage) SetMember(member Member) (Baggage, error) { - if err := member.validate(); err != nil { - return b, fmt.Errorf("%w: %s", errInvalidMember, err) + if !member.hasData { + return b, errInvalidMember } n := len(b.list) diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 88c820319b5..8cc4832ad00 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -138,7 +138,7 @@ func TestNewKeyProperty(t *testing.T) { p, err = NewKeyProperty("key") assert.NoError(t, err) - assert.Equal(t, Property{key: "key"}, p) + assert.Equal(t, Property{key: "key", hasData: true}, p) } func TestNewKeyValueProperty(t *testing.T) { @@ -152,11 +152,14 @@ func TestNewKeyValueProperty(t *testing.T) { p, err = NewKeyValueProperty("key", "value") assert.NoError(t, err) - assert.Equal(t, Property{key: "key", value: "value", hasValue: true}, p) + assert.Equal(t, Property{key: "key", value: "value", hasValue: true, hasData: true}, p) } func TestPropertyValidate(t *testing.T) { p := Property{} + assert.ErrorIs(t, p.validate(), errInvalidProperty) + + p.hasData = true assert.ErrorIs(t, p.validate(), errInvalidKey) p.key = "k" @@ -179,7 +182,7 @@ func TestNewEmptyBaggage(t *testing.T) { } func TestNewBaggage(t *testing.T) { - b, err := New(Member{key: "k"}) + b, err := New(Member{key: "k", hasData: true}) assert.NoError(t, err) assert.Equal(t, Baggage{list: baggage.List{"k": {}}}, b) } @@ -192,8 +195,9 @@ func TestNewBaggageWithDuplicates(t *testing.T) { for i := range m { // Duplicates are collapsed. m[i] = Member{ - key: "a", - value: fmt.Sprintf("%d", i), + key: "a", + value: fmt.Sprintf("%d", i), + hasData: true, } } b, err := New(m...) @@ -205,9 +209,9 @@ func TestNewBaggageWithDuplicates(t *testing.T) { assert.Equal(t, want, b) } -func TestNewBaggageErrorInvalidMember(t *testing.T) { - _, err := New(Member{key: ""}) - assert.ErrorIs(t, err, errInvalidKey) +func TestNewBaggageErrorEmptyMember(t *testing.T) { + _, err := New(Member{}) + assert.ErrorIs(t, err, errInvalidMember) } func key(n int) string { @@ -223,7 +227,7 @@ func key(n int) string { func TestNewBaggageErrorTooManyBytes(t *testing.T) { m := make([]Member, (maxBytesPerBaggageString/maxBytesPerMembers)+1) for i := range m { - m[i] = Member{key: key(maxBytesPerMembers)} + m[i] = Member{key: key(maxBytesPerMembers), hasData: true} } _, err := New(m...) assert.ErrorIs(t, err, errBaggageBytes) @@ -232,7 +236,7 @@ func TestNewBaggageErrorTooManyBytes(t *testing.T) { func TestNewBaggageErrorTooManyMembers(t *testing.T) { m := make([]Member, maxMembers+1) for i := range m { - m[i] = Member{key: fmt.Sprintf("%d", i)} + m[i] = Member{key: fmt.Sprintf("%d", i), hasData: true} } _, err := New(m...) assert.ErrorIs(t, err, errMemberNumber) @@ -533,7 +537,7 @@ func TestBaggageDeleteMember(t *testing.T) { assert.NotContains(t, b1.list, key) } -func TestBaggageSetMemberError(t *testing.T) { +func TestBaggageSetMemberEmpty(t *testing.T) { _, err := Baggage{}.SetMember(Member{}) assert.ErrorIs(t, err, errInvalidMember) } @@ -542,7 +546,7 @@ func TestBaggageSetMember(t *testing.T) { b0 := Baggage{} key := "k" - m := Member{key: key} + m := Member{key: key, hasData: true} b1, err := b0.SetMember(m) assert.NoError(t, err) assert.NotContains(t, b0.list, key) @@ -558,7 +562,7 @@ func TestBaggageSetMember(t *testing.T) { assert.Equal(t, 1, len(b1.list)) assert.Equal(t, 1, len(b2.list)) - p := properties{{key: "p"}} + p := properties{{key: "p", hasData: true}} m.properties = p b3, err := b2.SetMember(m) assert.NoError(t, err) @@ -569,12 +573,12 @@ func TestBaggageSetMember(t *testing.T) { // The returned baggage needs to be immutable and should use a copy of the // properties slice. - p[0] = Property{key: "different"} + p[0] = Property{key: "different", hasData: true} assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) // Reset for below. - p[0] = Property{key: "p"} + p[0] = Property{key: "p", hasData: true} - m = Member{key: "another"} + m = Member{key: "another", hasData: true} b4, err := b3.SetMember(m) assert.NoError(t, err) assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) @@ -664,7 +668,10 @@ func TestMemberProperties(t *testing.T) { } func TestMemberValidation(t *testing.T) { - m := Member{} + m := Member{hasData: false} + assert.ErrorIs(t, m.validate(), errInvalidMember) + + m.hasData = true assert.ErrorIs(t, m.validate(), errInvalidKey) m.key, m.value = "k", "\\" @@ -677,13 +684,18 @@ func TestMemberValidation(t *testing.T) { func TestNewMember(t *testing.T) { m, err := NewMember("", "") assert.ErrorIs(t, err, errInvalidKey) - assert.Equal(t, Member{}, m) + assert.Equal(t, Member{hasData: false}, m) key, val := "k", "v" - p := Property{key: "foo"} + p := Property{key: "foo", hasData: true} m, err = NewMember(key, val, p) assert.NoError(t, err) - expected := Member{key: key, value: val, properties: properties{{key: "foo"}}} + expected := Member{ + key: key, + value: val, + properties: properties{{key: "foo", hasData: true}}, + hasData: true, + } assert.Equal(t, expected, m) // Ensure new member is immutable. @@ -692,12 +704,46 @@ func TestNewMember(t *testing.T) { } func TestPropertiesValidate(t *testing.T) { - p := properties{{}} + p := properties{{hasData: true}} assert.ErrorIs(t, p.validate(), errInvalidKey) p[0].key = "foo" assert.NoError(t, p.validate()) - p = append(p, Property{key: "bar"}) + p = append(p, Property{key: "bar", hasData: true}) assert.NoError(t, p.validate()) } + +var benchBaggage Baggage + +func BenchmarkNew(b *testing.B) { + mem1, _ := NewMember("key1", "val1") + mem2, _ := NewMember("key2", "val2") + mem3, _ := NewMember("key3", "val3") + mem4, _ := NewMember("key4", "val4") + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + benchBaggage, _ = New(mem1, mem2, mem3, mem4) + } +} + +var benchMember Member + +func BenchmarkNewMember(b *testing.B) { + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + benchMember, _ = NewMember("key", "value") + } +} + +func BenchmarkParse(b *testing.B) { + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + benchBaggage, _ = Parse(`userId=alice,serverNode = DF28 , isProduction = false,hasProp=stuff;propKey;propWValue=value`) + } +} From 219af21e21da1828e2ddf90ae57a56e1b3f26324 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 6 Feb 2022 20:46:57 -0800 Subject: [PATCH 055/886] Fix link to Zipkin exporter (#2581) Currently it is linked to the old package that was moved. --- website_docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 8956f1623e1..4262cd6ff83 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -289,7 +289,7 @@ import ( ## Creating a Console Exporter -The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like [Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), [Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/trace/zipkin), and [Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). +The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like [Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), [Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/zipkin), and [Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). To initialize the console exporter, add the following function to the `main.go` file: From b60d53d31601841a90cb0265bad4a477c7840f95 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 7 Feb 2022 07:57:44 -0800 Subject: [PATCH 056/886] Unexport EnvBatchSpanProcessor* constants (#2583) * Move BSP env support to internal * Use pkg name * Update env test * Use internal/env in sdk/trace --- sdk/internal/env/env.go | 88 +++++++++++++++++++++++++ sdk/{trace => internal/env}/env_test.go | 8 +-- sdk/trace/batch_span_processor.go | 9 +-- sdk/trace/batch_span_processor_test.go | 21 +++--- sdk/trace/env.go | 59 ----------------- 5 files changed, 108 insertions(+), 77 deletions(-) create mode 100644 sdk/internal/env/env.go rename sdk/{trace => internal/env}/env_test.go (86%) delete mode 100644 sdk/trace/env.go diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go new file mode 100644 index 00000000000..397fd9593cc --- /dev/null +++ b/sdk/internal/env/env.go @@ -0,0 +1,88 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package env // import "go.opentelemetry.io/otel/sdk/internal/env" + +import ( + "os" + "strconv" + + "go.opentelemetry.io/otel/internal/global" +) + +// Environment variable names +const ( + // BatchSpanProcessorScheduleDelayKey + // Delay interval between two consecutive exports. + // i.e. 5000 + BatchSpanProcessorScheduleDelayKey = "OTEL_BSP_SCHEDULE_DELAY" + // BatchSpanProcessorExportTimeoutKey + // Maximum allowed time to export data. + // i.e. 3000 + BatchSpanProcessorExportTimeoutKey = "OTEL_BSP_EXPORT_TIMEOUT" + // BatchSpanProcessorMaxQueueSizeKey + // Maximum queue size + // i.e. 2048 + BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE" + // BatchSpanProcessorMaxExportBatchSizeKey + // Maximum batch size + // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize + // i.e. 512 + BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" +) + +// IntEnvOr returns the int value of the environment variable with name key if +// it exists and the value is an int. Otherwise, defaultValue is returned. +func IntEnvOr(key string, defaultValue int) int { + value, ok := os.LookupEnv(key) + if !ok { + return defaultValue + } + + intValue, err := strconv.Atoi(value) + if err != nil { + global.Info("Got invalid value, number value expected.", key, value) + return defaultValue + } + + return intValue +} + +// BatchSpanProcessorScheduleDelay returns the environment variable value for +// the OTEL_BSP_SCHEDULE_DELAY key if it exists, otherwise defaultValue is +// returned. +func BatchSpanProcessorScheduleDelay(defaultValue int) int { + return IntEnvOr(BatchSpanProcessorScheduleDelayKey, defaultValue) +} + +// BatchSpanProcessorExportTimeout returns the environment variable value for +// the OTEL_BSP_EXPORT_TIMEOUT key if it exists, otherwise defaultValue is +// returned. +func BatchSpanProcessorExportTimeout(defaultValue int) int { + return IntEnvOr(BatchSpanProcessorExportTimeoutKey, defaultValue) +} + +// BatchSpanProcessorMaxQueueSize returns the environment variable value for +// the OTEL_BSP_MAX_QUEUE_SIZE key if it exists, otherwise defaultValue is +// returned. +func BatchSpanProcessorMaxQueueSize(defaultValue int) int { + return IntEnvOr(BatchSpanProcessorMaxQueueSizeKey, defaultValue) +} + +// BatchSpanProcessorMaxExportBatchSize returns the environment variable value for +// the OTEL_BSP_MAX_EXPORT_BATCH_SIZE key if it exists, otherwise defaultValue +// is returned. +func BatchSpanProcessorMaxExportBatchSize(defaultValue int) int { + return IntEnvOr(BatchSpanProcessorMaxExportBatchSizeKey, defaultValue) +} diff --git a/sdk/trace/env_test.go b/sdk/internal/env/env_test.go similarity index 86% rename from sdk/trace/env_test.go rename to sdk/internal/env/env_test.go index be37eae5744..8c293f65453 100644 --- a/sdk/trace/env_test.go +++ b/sdk/internal/env/env_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package trace +package env import ( "os" @@ -46,14 +46,14 @@ func TestIntEnvOr(t *testing.T) { } envStore := ottest.NewEnvStore() - envStore.Record(EnvBatchSpanProcessorMaxQueueSize) + envStore.Record(BatchSpanProcessorMaxQueueSizeKey) defer func() { require.NoError(t, envStore.Restore()) }() for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - require.NoError(t, os.Setenv(EnvBatchSpanProcessorMaxQueueSize, tc.envValue)) - actualValue := intEnvOr(EnvBatchSpanProcessorMaxQueueSize, tc.defaultValue) + require.NoError(t, os.Setenv(BatchSpanProcessorMaxQueueSizeKey, tc.envValue)) + actualValue := BatchSpanProcessorMaxQueueSize(tc.defaultValue) assert.Equal(t, tc.expectedValue, actualValue) }) } diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 57f346aa08b..6a7b9dc31bd 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/internal/env" "go.opentelemetry.io/otel/trace" ) @@ -89,8 +90,8 @@ var _ SpanProcessor = (*batchSpanProcessor)(nil) // // If the exporter is nil, the span processor will preform no action. func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor { - maxQueueSize := intEnvOr(EnvBatchSpanProcessorMaxQueueSize, DefaultMaxQueueSize) - maxExportBatchSize := intEnvOr(EnvBatchSpanProcessorMaxExportBatchSize, DefaultMaxExportBatchSize) + maxQueueSize := env.BatchSpanProcessorMaxQueueSize(DefaultMaxQueueSize) + maxExportBatchSize := env.BatchSpanProcessorMaxExportBatchSize(DefaultMaxExportBatchSize) if maxExportBatchSize > maxQueueSize { if DefaultMaxExportBatchSize > maxQueueSize { @@ -101,8 +102,8 @@ func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorO } o := BatchSpanProcessorOptions{ - BatchTimeout: time.Duration(intEnvOr(EnvBatchSpanProcessorScheduleDelay, DefaultScheduleDelay)) * time.Millisecond, - ExportTimeout: time.Duration(intEnvOr(EnvBatchSpanProcessorExportTimeout, DefaultExportTimeout)) * time.Millisecond, + BatchTimeout: time.Duration(env.BatchSpanProcessorScheduleDelay(DefaultScheduleDelay)) * time.Millisecond, + ExportTimeout: time.Duration(env.BatchSpanProcessorExportTimeout(DefaultExportTimeout)) * time.Millisecond, MaxQueueSize: maxQueueSize, MaxExportBatchSize: maxExportBatchSize, } diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index f361b535d0f..255f8621160 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -31,6 +31,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/internal/env" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.opentelemetry.io/otel/trace" @@ -233,8 +234,8 @@ func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) { wantBatchCount: 1, genNumSpans: 2053, envs: map[string]string{ - sdktrace.EnvBatchSpanProcessorMaxQueueSize: "5000", - sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "5000", + env.BatchSpanProcessorMaxQueueSizeKey: "5000", + env.BatchSpanProcessorMaxExportBatchSizeKey: "5000", }, }, { @@ -243,8 +244,8 @@ func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) { wantBatchCount: 4, genNumSpans: 2053, envs: map[string]string{ - sdktrace.EnvBatchSpanProcessorMaxQueueSize: "5000", - sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "10000", + env.BatchSpanProcessorMaxQueueSizeKey: "5000", + env.BatchSpanProcessorMaxExportBatchSizeKey: "10000", }, }, { @@ -253,17 +254,17 @@ func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) { wantBatchCount: 42, genNumSpans: 2053, envs: map[string]string{ - sdktrace.EnvBatchSpanProcessorMaxQueueSize: "50", - sdktrace.EnvBatchSpanProcessorMaxExportBatchSize: "10000", + env.BatchSpanProcessorMaxQueueSizeKey: "50", + env.BatchSpanProcessorMaxExportBatchSizeKey: "10000", }, }, } envStore := ottest.NewEnvStore() - envStore.Record(sdktrace.EnvBatchSpanProcessorScheduleDelay) - envStore.Record(sdktrace.EnvBatchSpanProcessorExportTimeout) - envStore.Record(sdktrace.EnvBatchSpanProcessorMaxQueueSize) - envStore.Record(sdktrace.EnvBatchSpanProcessorMaxExportBatchSize) + envStore.Record(env.BatchSpanProcessorScheduleDelayKey) + envStore.Record(env.BatchSpanProcessorExportTimeoutKey) + envStore.Record(env.BatchSpanProcessorMaxQueueSizeKey) + envStore.Record(env.BatchSpanProcessorMaxExportBatchSizeKey) defer func() { require.NoError(t, envStore.Restore()) diff --git a/sdk/trace/env.go b/sdk/trace/env.go deleted file mode 100644 index da7ea412e53..00000000000 --- a/sdk/trace/env.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package trace // import "go.opentelemetry.io/otel/sdk/trace" - -import ( - "os" - "strconv" - - "go.opentelemetry.io/otel/internal/global" -) - -// Environment variable names -const ( - // EnvBatchSpanProcessorScheduleDelay - // Delay interval between two consecutive exports. - // i.e. 5000 - EnvBatchSpanProcessorScheduleDelay = "OTEL_BSP_SCHEDULE_DELAY" - // EnvBatchSpanProcessorExportTimeout - // Maximum allowed time to export data. - // i.e. 3000 - EnvBatchSpanProcessorExportTimeout = "OTEL_BSP_EXPORT_TIMEOUT" - // EnvBatchSpanProcessorMaxQueueSize - // Maximum queue size - // i.e. 2048 - EnvBatchSpanProcessorMaxQueueSize = "OTEL_BSP_MAX_QUEUE_SIZE" - // EnvBatchSpanProcessorMaxExportBatchSize - // Maximum batch size - // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize - // i.e. 512 - EnvBatchSpanProcessorMaxExportBatchSize = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" -) - -// intEnvOr returns an env variable's numeric value if it is exists (and valid) or the default if not -func intEnvOr(key string, defaultValue int) int { - value, ok := os.LookupEnv(key) - if !ok { - return defaultValue - } - - intValue, err := strconv.Atoi(value) - if err != nil { - global.Info("Got invalid value, number value expected.", key, value) - return defaultValue - } - - return intValue -} From 98bb1056c028ff816ed33b12fad7ab8661f8f9c7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 7 Feb 2022 12:58:05 -0800 Subject: [PATCH 057/886] Replace recordingSpan attributes implementation with slice of attributes (#2576) * Replace recordingSpan attributes implementation Instead of an LRU strategy for cap-ing span attributes, comply with the specification and drop last added. To do this, the attributesmap is replaced with a slice of attributes. * Remove attributesmap files * Refine addition algorithm Unify duplicated code. Fix deduplication algorithm. Fix droppedAttributes to always be returned, even if the span has no attributes. * Unify span SetAttributes tests * Doc fix to attr drop order in changelog * Test span and snapshot attrs * fix lint * Add tests for recordingSpan method defaults * Comment why pre-allocation is not done * Correct grammar in recordingSpan allocation comment * Update sdk/trace/tracer.go Co-authored-by: Anthony Mirabella Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 4 + sdk/trace/attributesmap.go | 91 ----------- sdk/trace/attributesmap_test.go | 103 ------------ sdk/trace/benchmark_test.go | 23 +++ sdk/trace/span.go | 142 ++++++++++++++--- sdk/trace/trace_test.go | 271 ++++++++++++++++++++++---------- sdk/trace/tracer.go | 9 +- 7 files changed, 340 insertions(+), 303 deletions(-) delete mode 100644 sdk/trace/attributesmap.go delete mode 100644 sdk/trace/attributesmap_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 89df8a8c5a0..b65fd81c2de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Specify explicit buckets in Prometheus example. (#2493) - W3C baggage will now decode urlescaped values. (#2529) - Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) +- The order attributes are dropped from spans in the `go.opentelemetry.io/otel/sdk/trace` package when capacity is reached is fixed to be in compliance with the OpenTelemetry specification. + Instead of dropping the least-recently-used attribute, the last added attribute is dropped. + This drop order still only applies to attributes with unique keys not already contained in the span. + If an attribute is added with a key already contained in the span, that attribute is updated to the new value being added. (#2576) ### Removed diff --git a/sdk/trace/attributesmap.go b/sdk/trace/attributesmap.go deleted file mode 100644 index b891c8178b7..00000000000 --- a/sdk/trace/attributesmap.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package trace // import "go.opentelemetry.io/otel/sdk/trace" - -import ( - "container/list" - - "go.opentelemetry.io/otel/attribute" -) - -// attributesMap is a capped map of attributes, holding the most recent attributes. -// Eviction is done via a LRU method, the oldest entry is removed to create room for a new entry. -// Updates are allowed and they refresh the usage of the key. -// -// This is based from https://github.com/hashicorp/golang-lru/blob/master/simplelru/lru.go -// With a subset of the its operations and specific for holding attribute.KeyValue -type attributesMap struct { - attributes map[attribute.Key]*list.Element - evictList *list.List - droppedCount int - capacity int -} - -func newAttributesMap(capacity int) *attributesMap { - lm := &attributesMap{ - attributes: make(map[attribute.Key]*list.Element), - evictList: list.New(), - capacity: capacity, - } - return lm -} - -func (am *attributesMap) add(kv attribute.KeyValue) { - // Check for existing item - if ent, ok := am.attributes[kv.Key]; ok { - am.evictList.MoveToFront(ent) - ent.Value = &kv - return - } - - // Add new item - entry := am.evictList.PushFront(&kv) - am.attributes[kv.Key] = entry - - // Verify size not exceeded - if am.evictList.Len() > am.capacity { - am.removeOldest() - am.droppedCount++ - } -} - -// toKeyValue copies the attributesMap into a slice of attribute.KeyValue and -// returns it. If the map is empty, a nil is returned. -// TODO: Is it more efficient to return a pointer to the slice? -func (am *attributesMap) toKeyValue() []attribute.KeyValue { - len := am.evictList.Len() - if len == 0 { - return nil - } - - attributes := make([]attribute.KeyValue, 0, len) - for ent := am.evictList.Back(); ent != nil; ent = ent.Prev() { - if value, ok := ent.Value.(*attribute.KeyValue); ok { - attributes = append(attributes, *value) - } - } - - return attributes -} - -// removeOldest removes the oldest item from the cache. -func (am *attributesMap) removeOldest() { - ent := am.evictList.Back() - if ent != nil { - am.evictList.Remove(ent) - kv := ent.Value.(*attribute.KeyValue) - delete(am.attributes, kv.Key) - } -} diff --git a/sdk/trace/attributesmap_test.go b/sdk/trace/attributesmap_test.go deleted file mode 100644 index 90a201e2195..00000000000 --- a/sdk/trace/attributesmap_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package trace - -import ( - "fmt" - "testing" - - "go.opentelemetry.io/otel/attribute" -) - -const testKeyFmt = "test-key-%d" - -func TestAttributesMap(t *testing.T) { - wantCapacity := 128 - attrMap := newAttributesMap(wantCapacity) - - for i := 0; i < 256; i++ { - attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i)) - } - if attrMap.capacity != wantCapacity { - t.Errorf("attrMap.capacity: got '%d'; want '%d'", attrMap.capacity, wantCapacity) - } - - if attrMap.droppedCount != wantCapacity { - t.Errorf("attrMap.droppedCount: got '%d'; want '%d'", attrMap.droppedCount, wantCapacity) - } - - for i := 0; i < wantCapacity; i++ { - key := attribute.Key(fmt.Sprintf(testKeyFmt, i)) - _, ok := attrMap.attributes[key] - if ok { - t.Errorf("key %q should be dropped", testKeyFmt) - } - } - for i := wantCapacity; i < 256; i++ { - key := attribute.Key(fmt.Sprintf(testKeyFmt, i)) - _, ok := attrMap.attributes[key] - if !ok { - t.Errorf("key %q should not be dropped", key) - } - } -} - -func TestAttributesMapGetOldestRemoveOldest(t *testing.T) { - attrMap := newAttributesMap(128) - - for i := 0; i < 128; i++ { - attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i)) - } - - attrMap.removeOldest() - attrMap.removeOldest() - attrMap.removeOldest() - - for i := 0; i < 3; i++ { - key := attribute.Key(fmt.Sprintf(testKeyFmt, i)) - _, ok := attrMap.attributes[key] - if ok { - t.Errorf("key %q should be removed", key) - } - } -} - -func TestAttributesMapToKeyValue(t *testing.T) { - attrMap := newAttributesMap(128) - - for i := 0; i < 128; i++ { - attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i)) - } - - kv := attrMap.toKeyValue() - - gotAttrLen := len(kv) - wantAttrLen := 128 - if gotAttrLen != wantAttrLen { - t.Errorf("len(attrMap.attributes): got '%d'; want '%d'", gotAttrLen, wantAttrLen) - } -} - -func BenchmarkAttributesMapToKeyValue(b *testing.B) { - attrMap := newAttributesMap(128) - - for i := 0; i < 128; i++ { - attrMap.add(attribute.Int(fmt.Sprintf(testKeyFmt, i), i)) - } - - for n := 0; n < b.N; n++ { - attrMap.toKeyValue() - } -} diff --git a/sdk/trace/benchmark_test.go b/sdk/trace/benchmark_test.go index 335deaf4fc3..81a06e2f8f9 100644 --- a/sdk/trace/benchmark_test.go +++ b/sdk/trace/benchmark_test.go @@ -16,6 +16,7 @@ package trace_test import ( "context" + "fmt" "testing" "time" @@ -24,6 +25,28 @@ import ( "go.opentelemetry.io/otel/trace" ) +func BenchmarkSpanSetAttributesOverCapacity(b *testing.B) { + tp := sdktrace.NewTracerProvider( + sdktrace.WithSpanLimits(sdktrace.SpanLimits{AttributeCountLimit: 1}), + ) + tracer := tp.Tracer("BenchmarkSpanSetAttributesOverCapacity") + ctx := context.Background() + attrs := make([]attribute.KeyValue, 128) + for i := range attrs { + key := fmt.Sprintf("key-%d", i) + attrs[i] = attribute.Bool(key, true) + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, span := tracer.Start(ctx, "/foo") + span.SetAttributes(attrs...) + span.End() + } +} + func BenchmarkStartEndSpan(b *testing.B) { traceBenchmark(b, "Benchmark StartEndSpan", func(b *testing.B, t trace.Tracer) { ctx := context.Background() diff --git a/sdk/trace/span.go b/sdk/trace/span.go index bf0c41c1112..779cde691dd 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -54,6 +54,7 @@ type ReadOnlySpan interface { // the span has not ended. EndTime() time.Time // Attributes returns the defining attributes of the span. + // The order of the returned attributes is not guaranteed to be stable across invocations. Attributes() []attribute.KeyValue // Links returns all the links the span has to other spans. Links() []Link @@ -129,9 +130,14 @@ type recordingSpan struct { // spanContext holds the SpanContext of this span. spanContext trace.SpanContext - // attributes are capped at configured limit. When the capacity is reached - // an oldest entry is removed to create room for a new entry. - attributes *attributesMap + // attributes is a collection of user provided key/values. The collection + // is constrained by a configurable maximum held by the parent + // TracerProvider. When additional attributes are added after this maximum + // is reached these attributes the user is attempting to add are dropped. + // This dropped number of attributes is tracked and reported in the + // ReadOnlySpan exported when the span ends. + attributes []attribute.KeyValue + droppedAttributes int // events are stored in FIFO queue capped by configured limit. events evictedQueue @@ -194,11 +200,80 @@ func (s *recordingSpan) SetStatus(code codes.Code, description string) { // will be overwritten with the value contained in attributes. // // If this span is not being recorded than this method does nothing. +// +// If adding attributes to the span would exceed the maximum amount of +// attributes the span is configured to have, the last added attributes will +// be dropped. func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { if !s.IsRecording() { return } - s.copyToCappedAttributes(attributes...) + + s.mu.Lock() + defer s.mu.Unlock() + + // If adding these attributes could exceed the capacity of s perform a + // de-duplication and truncation while adding to avoid over allocation. + if len(s.attributes)+len(attributes) > s.tracer.provider.spanLimits.AttributeCountLimit { + s.addOverCapAttrs(attributes) + return + } + + // Otherwise, add without deduplication. When attributes are read they + // will be deduplicated, optimizing the operation. + for _, a := range attributes { + if !a.Valid() { + // Drop all invalid attributes. + s.droppedAttributes++ + continue + } + s.attributes = append(s.attributes, a) + } +} + +// addOverCapAttrs adds the attributes attrs to the span s while +// de-duplicating the attributes of s and attrs and dropping attributes that +// exceed the capacity of s. +// +// This method assumes s.mu.Lock is held by the caller. +// +// This method should only be called when there is a possibility that adding +// attrs to s will exceed the capacity of s. Otherwise, attrs should be added +// to s without checking for duplicates and all retrieval methods of the +// attributes for s will de-duplicate as needed. +func (s *recordingSpan) addOverCapAttrs(attrs []attribute.KeyValue) { + // In order to not allocate more capacity to s.attributes than needed, + // prune and truncate this addition of attributes while adding. + + // Do not set a capacity when creating this map. Benchmark testing has + // showed this to only add unused memory allocations in general use. + exists := make(map[attribute.Key]int) + s.dedupeAttrsFromRecord(&exists) + + // Now that s.attributes is deduplicated, adding unique attributes up to + // the capacity of s will not over allocate s.attributes. + for _, a := range attrs { + if !a.Valid() { + // Drop all invalid attributes. + s.droppedAttributes++ + continue + } + + if idx, ok := exists[a.Key]; ok { + // Perform all updates before dropping, even when at capacity. + s.attributes[idx] = a + continue + } + + if len(s.attributes) >= s.tracer.provider.spanLimits.AttributeCountLimit { + // Do not just drop all of the remaining attributes, make sure + // updates are checked and performed. + s.droppedAttributes++ + } else { + s.attributes = append(s.attributes, a) + exists[a.Key] = len(s.attributes) - 1 + } + } } // End ends the span. This method does nothing if the span is already ended or @@ -388,13 +463,45 @@ func (s *recordingSpan) EndTime() time.Time { } // Attributes returns the attributes of this span. +// +// The order of the returned attributes is not guaranteed to be stable. func (s *recordingSpan) Attributes() []attribute.KeyValue { s.mu.Lock() defer s.mu.Unlock() - if s.attributes.evictList.Len() == 0 { - return []attribute.KeyValue{} + s.dedupeAttrs() + return s.attributes +} + +// dedupeAttrs deduplicates the attributes of s to fit capacity. +// +// This method assumes s.mu.Lock is held by the caller. +func (s *recordingSpan) dedupeAttrs() { + // Do not set a capacity when creating this map. Benchmark testing has + // showed this to only add unused memory allocations in general use. + exists := make(map[attribute.Key]int) + s.dedupeAttrsFromRecord(&exists) +} + +// dedupeAttrsFromRecord deduplicates the attributes of s to fit capacity +// using record as the record of unique attribute keys to their index. +// +// This method assumes s.mu.Lock is held by the caller. +func (s *recordingSpan) dedupeAttrsFromRecord(record *map[attribute.Key]int) { + // Use the fact that slices share the same backing array. + unique := s.attributes[:0] + for _, a := range s.attributes { + if idx, ok := (*record)[a.Key]; ok { + unique[idx] = a + } else { + unique = append(unique, a) + (*record)[a.Key] = len(unique) - 1 + } } - return s.attributes.toKeyValue() + // s.attributes have element types of attribute.KeyValue. These types are + // not pointers and they themselves do not contain pointer fields, + // therefore the duplicate values do not need to be zeroed for them to be + // garbage collected. + s.attributes = unique } // Links returns the links of this span. @@ -463,7 +570,7 @@ func (s *recordingSpan) addLink(link trace.Link) { func (s *recordingSpan) DroppedAttributes() int { s.mu.Lock() defer s.mu.Unlock() - return s.attributes.droppedCount + return s.droppedAttributes } // DroppedLinks returns the number of links dropped by the span due to limits @@ -513,10 +620,11 @@ func (s *recordingSpan) snapshot() ReadOnlySpan { sd.status = s.status sd.childSpanCount = s.childSpanCount - if s.attributes.evictList.Len() > 0 { - sd.attributes = s.attributes.toKeyValue() - sd.droppedAttributeCount = s.attributes.droppedCount + if len(s.attributes) > 0 { + s.dedupeAttrs() + sd.attributes = s.attributes } + sd.droppedAttributeCount = s.droppedAttributes if len(s.events.queue) > 0 { sd.events = s.interfaceArrayToEventArray() sd.droppedEventCount = s.events.droppedCount @@ -544,18 +652,6 @@ func (s *recordingSpan) interfaceArrayToEventArray() []Event { return eventArr } -func (s *recordingSpan) copyToCappedAttributes(attributes ...attribute.KeyValue) { - s.mu.Lock() - defer s.mu.Unlock() - for _, a := range attributes { - // Ensure attributes conform to the specification: - // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/common/common.md#attributes - if a.Valid() { - s.attributes.add(a) - } - } -} - func (s *recordingSpan) addChild() { if !s.IsRecording() { return diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index be27ed62041..5ba0015584a 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -419,34 +419,6 @@ func TestSetSpanAttributesOnStart(t *testing.T) { } } -func TestSetSpanAttributes(t *testing.T) { - te := NewTestExporter() - tp := NewTracerProvider(WithSyncer(te), WithResource(resource.Empty())) - span := startSpan(tp, "SpanAttribute") - span.SetAttributes(attribute.String("key1", "value1")) - got, err := endSpan(te, span) - if err != nil { - t.Fatal(err) - } - - want := &snapshot{ - spanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: tid, - TraceFlags: 0x1, - }), - parent: sc.WithRemote(true), - name: "span0", - attributes: []attribute.KeyValue{ - attribute.String("key1", "value1"), - }, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "SpanAttribute"}, - } - if diff := cmpDiff(got, want); diff != "" { - t.Errorf("SetSpanAttributes: -got +want %s", diff) - } -} - func TestSamplerAttributesLocalChildSpan(t *testing.T) { sampler := &testSampler{prefix: "span", t: t} te := NewTestExporter() @@ -469,72 +441,193 @@ func TestSamplerAttributesLocalChildSpan(t *testing.T) { assert.Equal(t, []attribute.KeyValue{attribute.Int("callCount", 1)}, gotSpan1.Attributes()) } -func TestSetSpanAttributesOverLimit(t *testing.T) { - te := NewTestExporter() - tp := NewTracerProvider(WithSpanLimits(SpanLimits{AttributeCountLimit: 2}), WithSyncer(te), WithResource(resource.Empty())) - - span := startSpan(tp, "SpanAttributesOverLimit") - span.SetAttributes( - attribute.Bool("key1", true), +func TestSpanSetAttributes(t *testing.T) { + attrs := [...]attribute.KeyValue{ + attribute.String("key1", "value1"), attribute.String("key2", "value2"), - attribute.Bool("key1", false), // Replace key1. - attribute.Int64("key4", 4), // Remove key2 and add key4 - ) - got, err := endSpan(te, span) - if err != nil { - t.Fatal(err) + attribute.String("key3", "value3"), + attribute.String("key4", "value4"), + attribute.String("key1", "value5"), + attribute.String("key2", "value6"), + attribute.String("key3", "value7"), } + invalid := attribute.KeyValue{} - want := &snapshot{ - spanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: tid, - TraceFlags: 0x1, - }), - parent: sc.WithRemote(true), - name: "span0", - attributes: []attribute.KeyValue{ - attribute.Bool("key1", false), - attribute.Int64("key4", 4), + tests := []struct { + name string + input [][]attribute.KeyValue + wantAttrs []attribute.KeyValue + wantDropped int + }{ + { + name: "array", + input: [][]attribute.KeyValue{attrs[:3]}, + wantAttrs: attrs[:3], + }, + { + name: "single_value:array", + input: [][]attribute.KeyValue{attrs[:1], attrs[1:3]}, + wantAttrs: attrs[:3], + }, + { + name: "array:single_value", + input: [][]attribute.KeyValue{attrs[:2], attrs[2:3]}, + wantAttrs: attrs[:3], + }, + { + name: "single_values", + input: [][]attribute.KeyValue{attrs[:1], attrs[1:2], attrs[2:3]}, + wantAttrs: attrs[:3], }, - spanKind: trace.SpanKindInternal, - droppedAttributeCount: 1, - instrumentationLibrary: instrumentation.Library{Name: "SpanAttributesOverLimit"}, - } - if diff := cmpDiff(got, want); diff != "" { - t.Errorf("SetSpanAttributesOverLimit: -got +want %s", diff) - } -} -func TestSetSpanAttributesWithInvalidKey(t *testing.T) { - te := NewTestExporter() - tp := NewTracerProvider(WithSpanLimits(SpanLimits{}), WithSyncer(te), WithResource(resource.Empty())) + // The tracing specification states: + // + // For each unique attribute key, addition of which would result in + // exceeding the limit, SDK MUST discard that key/value pair + // + // Therefore, adding attributes after the capacity is reached should + // result in those attributes being dropped. - span := startSpan(tp, "SpanToSetInvalidKeyOrValue") - span.SetAttributes( - attribute.Bool("", true), - attribute.Bool("key1", false), - ) - got, err := endSpan(te, span) - if err != nil { - t.Fatal(err) - } + { + name: "drop_last_added", + input: [][]attribute.KeyValue{attrs[:3], attrs[3:4], attrs[3:4]}, + wantAttrs: attrs[:3], + wantDropped: 2, + }, - want := &snapshot{ - spanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: tid, - TraceFlags: 0x1, - }), - parent: sc.WithRemote(true), - name: "span0", - attributes: []attribute.KeyValue{ - attribute.Bool("key1", false), + // The tracing specification states: + // + // Setting an attribute with the same key as an existing attribute + // SHOULD overwrite the existing attribute's value. + // + // Therefore, attributes are updated regardless of capacity state. + + { + name: "single_value_update", + input: [][]attribute.KeyValue{attrs[:1], attrs[:3]}, + wantAttrs: attrs[:3], + }, + { + name: "all_update", + input: [][]attribute.KeyValue{attrs[:3], attrs[4:7]}, + wantAttrs: attrs[4:7], + }, + { + name: "all_update/multi", + input: [][]attribute.KeyValue{attrs[:3], attrs[4:7], attrs[:3]}, + wantAttrs: attrs[:3], + }, + { + name: "deduplicate/under_capacity", + input: [][]attribute.KeyValue{attrs[:1], attrs[:1], attrs[:1]}, + wantAttrs: attrs[:1], + }, + { + name: "deduplicate/over_capacity", + input: [][]attribute.KeyValue{attrs[:1], attrs[:1], attrs[:1], attrs[:3]}, + wantAttrs: attrs[:3], + }, + { + name: "deduplicate/added", + input: [][]attribute.KeyValue{ + attrs[:2], + {attrs[2], attrs[2], attrs[2]}, + }, + wantAttrs: attrs[:3], + }, + { + name: "deduplicate/added_at_cappacity", + input: [][]attribute.KeyValue{ + attrs[:3], + {attrs[2], attrs[2], attrs[2]}, + }, + wantAttrs: attrs[:3], + }, + { + name: "invalid", + input: [][]attribute.KeyValue{ + {invalid}, + }, + wantDropped: 1, + }, + { + name: "invalid_with_valid", + input: [][]attribute.KeyValue{ + {invalid, attrs[0]}, + }, + wantAttrs: attrs[:1], + wantDropped: 1, + }, + { + name: "invalid_over_capacity", + input: [][]attribute.KeyValue{ + {invalid, invalid, invalid, invalid, attrs[0]}, + }, + wantAttrs: attrs[:1], + wantDropped: 4, + }, + { + name: "valid:invalid/under_capacity", + input: [][]attribute.KeyValue{ + attrs[:1], + {invalid}, + }, + wantAttrs: attrs[:1], + wantDropped: 1, + }, + { + name: "valid:invalid/over_capacity", + input: [][]attribute.KeyValue{ + attrs[:1], + {invalid, invalid, invalid, invalid}, + }, + wantAttrs: attrs[:1], + wantDropped: 4, + }, + { + name: "valid_at_capacity:invalid", + input: [][]attribute.KeyValue{ + attrs[:3], + {invalid, invalid, invalid, invalid}, + }, + wantAttrs: attrs[:3], + wantDropped: 4, }, - spanKind: trace.SpanKindInternal, - droppedAttributeCount: 0, - instrumentationLibrary: instrumentation.Library{Name: "SpanToSetInvalidKeyOrValue"}, } - if diff := cmpDiff(got, want); diff != "" { - t.Errorf("SetSpanAttributesWithInvalidKey: -got +want %s", diff) + + const ( + capacity = 3 + instName = "TestSpanAttributeCapacity" + spanName = "test span" + ) + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + te := NewTestExporter() + tp := NewTracerProvider( + WithSyncer(te), + WithSpanLimits(SpanLimits{AttributeCountLimit: capacity}), + ) + _, span := tp.Tracer(instName).Start(context.Background(), spanName) + for _, a := range test.input { + span.SetAttributes(a...) + } + span.End() + + require.Implements(t, (*ReadOnlySpan)(nil), span) + roSpan := span.(ReadOnlySpan) + + // Ensure the span itself is valid. + assert.ElementsMatch(t, test.wantAttrs, roSpan.Attributes(), "exected attributes") + assert.Equal(t, test.wantDropped, roSpan.DroppedAttributes(), "dropped attributes") + + snap, ok := te.GetSpan(spanName) + require.Truef(t, ok, "span %s not exported", spanName) + + // Ensure the exported span snapshot is valid. + assert.ElementsMatch(t, test.wantAttrs, snap.Attributes(), "exected attributes") + assert.Equal(t, test.wantDropped, snap.DroppedAttributes(), "dropped attributes") + }) } } @@ -1852,3 +1945,11 @@ func TestWithIDGenerator(t *testing.T) { require.NoError(t, err) } } + +func TestEmptyRecordingSpanAttributes(t *testing.T) { + assert.Nil(t, (&recordingSpan{}).Attributes()) +} + +func TestEmptyRecordingSpanDroppedAttributes(t *testing.T) { + assert.Equal(t, 0, (&recordingSpan{}).DroppedAttributes()) +} diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index b63b4196516..5b8ab43be3d 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -122,12 +122,19 @@ func (tr *tracer) newRecordingSpan(psc, sc trace.SpanContext, name string, sr Sa } s := &recordingSpan{ + // Do not pre-allocate the attributes slice here! Doing so will + // allocate memory that is likely never going to be used, or if used, + // will be over-sized. The default Go compiler has been tested to + // dynamically allocate needed space very well. Benchmarking has shown + // it to be more performant than what we can predetermine here, + // especially for the common use case of few to no added + // attributes. + parent: psc, spanContext: sc, spanKind: trace.ValidateSpanKind(config.SpanKind()), name: name, startTime: startTime, - attributes: newAttributesMap(tr.provider.spanLimits.AttributeCountLimit), events: newEvictedQueue(tr.provider.spanLimits.EventCountLimit), links: newEvictedQueue(tr.provider.spanLimits.LinkCountLimit), tracer: tr, From 10b58d631c5d4268864a9f3dd1ab8da5bbde32e2 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Tue, 8 Feb 2022 23:43:47 +0800 Subject: [PATCH 058/886] Update tracestate.go (#2590) --- trace/tracestate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trace/tracestate.go b/trace/tracestate.go index 9fad16fd277..86fc62c1d8f 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -58,7 +58,7 @@ func newMember(key, value string) (member, error) { return member{Key: key, Value: value}, nil } -func parseMemeber(m string) (member, error) { +func parseMember(m string) (member, error) { matches := memberRe.FindStringSubmatch(m) if len(matches) != 5 { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) @@ -114,7 +114,7 @@ func ParseTraceState(tracestate string) (TraceState, error) { continue } - m, err := parseMemeber(memberStr) + m, err := parseMember(memberStr) if err != nil { return TraceState{}, wrapErr(err) } From 9f42a81a5f8b4faf5689b72f9e4093361d8e5885 Mon Sep 17 00:00:00 2001 From: tani <13175394+tttanikawa@users.noreply.github.com> Date: Thu, 10 Feb 2022 03:26:45 +0900 Subject: [PATCH 059/886] Export resource attributes from zipkin exporter (#2589) * Export resource attributes from zipkin exporter * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Refactoring * Refactoring Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/zipkin/model.go | 47 ++++++++++++++++++++------------- exporters/zipkin/model_test.go | 42 ++++++++++++++++++++++++++++- exporters/zipkin/zipkin_test.go | 5 ++++ 4 files changed, 76 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b65fd81c2de..3bb9f3301da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489, #2512) +- Zipkin exporter exports `Resource` attributes as the `Tags` field. (#2589) ### Deprecated diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index ba9b0f00987..38a7368b7a5 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -168,6 +168,27 @@ func attributesToJSONMapString(attributes []attribute.KeyValue) string { return (string)(jsonBytes) } +// attributeToStringPair serializes each attribute to a string pair +func attributeToStringPair(kv attribute.KeyValue) (string, string) { + switch kv.Value.Type() { + // For slice attributes, serialize as JSON list string. + case attribute.BOOLSLICE: + json, _ := json.Marshal(kv.Value.AsBoolSlice()) + return (string)(kv.Key), (string)(json) + case attribute.INT64SLICE: + json, _ := json.Marshal(kv.Value.AsInt64Slice()) + return (string)(kv.Key), (string)(json) + case attribute.FLOAT64SLICE: + json, _ := json.Marshal(kv.Value.AsFloat64Slice()) + return (string)(kv.Key), (string)(json) + case attribute.STRINGSLICE: + json, _ := json.Marshal(kv.Value.AsStringSlice()) + return (string)(kv.Key), (string)(json) + default: + return (string)(kv.Key), kv.Value.Emit() + } +} + // extraZipkinTags are those that may be added to every outgoing span var extraZipkinTags = []string{ "otel.status_code", @@ -177,25 +198,15 @@ var extraZipkinTags = []string{ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { attr := data.Attributes() - m := make(map[string]string, len(attr)+len(extraZipkinTags)) + resourceAttr := data.Resource().Attributes() + m := make(map[string]string, len(attr)+len(resourceAttr)+len(extraZipkinTags)) for _, kv := range attr { - switch kv.Value.Type() { - // For slice attributes, serialize as JSON list string. - case attribute.BOOLSLICE: - json, _ := json.Marshal(kv.Value.AsBoolSlice()) - m[(string)(kv.Key)] = (string)(json) - case attribute.INT64SLICE: - json, _ := json.Marshal(kv.Value.AsInt64Slice()) - m[(string)(kv.Key)] = (string)(json) - case attribute.FLOAT64SLICE: - json, _ := json.Marshal(kv.Value.AsFloat64Slice()) - m[(string)(kv.Key)] = (string)(json) - case attribute.STRINGSLICE: - json, _ := json.Marshal(kv.Value.AsStringSlice()) - m[(string)(kv.Key)] = (string)(json) - default: - m[(string)(kv.Key)] = kv.Value.Emit() - } + k, v := attributeToStringPair(kv) + m[k] = v + } + for _, kv := range resourceAttr { + k, v := attributeToStringPair(kv) + m[k] = v } if data.Status().Code != codes.Unset { diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index d4ca9c43ec0..09c6f704418 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -39,6 +39,9 @@ import ( func TestModelConversion(t *testing.T) { resource := resource.NewSchemaless( semconv.ServiceNameKey.String("model-test"), + semconv.ServiceVersionKey.String("0.1.0"), + attribute.Int64("resource-attr1", 42), + attribute.IntSlice("resource-attr2", []int{0, 1, 2}), ) inputBatch := tracetest.SpanStubs{ @@ -408,6 +411,10 @@ func TestModelConversion(t *testing.T) { "attr3": "[0,1,2]", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data with no parent @@ -447,6 +454,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of unspecified kind @@ -486,6 +497,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of internal kind @@ -525,6 +540,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of client kind @@ -570,6 +589,10 @@ func TestModelConversion(t *testing.T) { "peer.hostname": "test-peer-hostname", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of producer kind @@ -609,6 +632,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of consumer kind @@ -648,6 +675,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data with no events @@ -678,6 +709,10 @@ func TestModelConversion(t *testing.T) { "attr2": "bar", "otel.status_code": "Error", "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data with an "error" attribute set to "false" @@ -712,7 +747,12 @@ func TestModelConversion(t *testing.T) { Value: "ev2", }, }, - Tags: nil, // should be omitted + Tags: map[string]string{ + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", + }, // only resource tags should be included }, } gottenOutputBatch := SpanModels(inputBatch) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index c6984e572e1..c3abe353a37 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -200,6 +200,7 @@ func logStoreLogger(s *logStore) *log.Logger { func TestExportSpans(t *testing.T) { resource := resource.NewSchemaless( semconv.ServiceNameKey.String("exporter-test"), + semconv.ServiceVersionKey.String("0.1.0"), ) spans := tracetest.SpanStubs{ @@ -271,6 +272,8 @@ func TestExportSpans(t *testing.T) { Tags: map[string]string{ "otel.status_code": "Error", "error": "404, file not found", + "service.name": "exporter-test", + "service.version": "0.1.0", }, }, // model of child @@ -299,6 +302,8 @@ func TestExportSpans(t *testing.T) { Tags: map[string]string{ "otel.status_code": "Error", "error": "403, forbidden", + "service.name": "exporter-test", + "service.version": "0.1.0", }, }, } From 010ca4f2b13f68fbc6cd40f83e174e3b1f61c240 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 9 Feb 2022 21:05:06 +0100 Subject: [PATCH 060/886] use subtests in the trace package (#2594) --- trace/tracestate_test.go | 207 +++++++++++++++++++++++---------------- 1 file changed, 124 insertions(+), 83 deletions(-) diff --git a/trace/tracestate_test.go b/trace/tracestate_test.go index edb89073de8..a1ef14f6f7b 100644 --- a/trace/tracestate_test.go +++ b/trace/tracestate_test.go @@ -26,74 +26,91 @@ import ( // Taken from the W3C tests: // https://github.com/w3c/trace-context/blob/dcd3ad9b7d6ac36f70ff3739874b73c11b0302a1/test/test_data.json var testcases = []struct { + name string in string tracestate TraceState out string err error }{ { - in: "foo=1,foo=1", - err: errDuplicate, + name: "duplicate with the same value", + in: "foo=1,foo=1", + err: errDuplicate, }, { - in: "foo=1,foo=2", - err: errDuplicate, + name: "duplicate with different values", + in: "foo=1,foo=2", + err: errDuplicate, }, { - in: "foo =1", - err: errInvalidMember, + name: "improperly formatted key/value pair", + in: "foo =1", + err: errInvalidMember, }, { - in: "FOO=1", - err: errInvalidMember, + name: "upper case key", + in: "FOO=1", + err: errInvalidMember, }, { - in: "foo.bar=1", - err: errInvalidMember, + name: "key with invalid character", + in: "foo.bar=1", + err: errInvalidMember, }, { - in: "foo@=1,bar=2", - err: errInvalidMember, + name: "multiple keys, one with empty tenant key", + in: "foo@=1,bar=2", + err: errInvalidMember, }, { - in: "@foo=1,bar=2", - err: errInvalidMember, + name: "multiple keys, one with only tenant", + in: "@foo=1,bar=2", + err: errInvalidMember, }, { - in: "foo@@bar=1,bar=2", - err: errInvalidMember, + name: "multiple keys, one with double tenant separator", + in: "foo@@bar=1,bar=2", + err: errInvalidMember, }, { - in: "foo@bar@baz=1,bar=2", - err: errInvalidMember, + name: "multiple keys, one with multiple tenants", + in: "foo@bar@baz=1,bar=2", + err: errInvalidMember, }, { - in: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", - err: errInvalidMember, + name: "key too long", + in: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", + err: errInvalidMember, }, { - in: "foo=1,tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@v=1", - err: errInvalidMember, + name: "key too long, with tenant", + in: "foo=1,tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@v=1", + err: errInvalidMember, }, { - in: "foo=1,t@vvvvvvvvvvvvvvv=1", - err: errInvalidMember, + name: "tenant too long", + in: "foo=1,t@vvvvvvvvvvvvvvv=1", + err: errInvalidMember, }, { - in: "foo=bar=baz", - err: errInvalidMember, + name: "multiple values for a single key", + in: "foo=bar=baz", + err: errInvalidMember, }, { - in: "foo=,bar=3", - err: errInvalidMember, + name: "no value", + in: "foo=,bar=3", + err: errInvalidMember, }, { - in: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32,bar33=33", - err: errMemberNumber, + name: "too many members", + in: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32,bar33=33", + err: errMemberNumber, }, { - in: "abcdefghijklmnopqrstuvwxyz0123456789_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - out: "abcdefghijklmnopqrstuvwxyz0123456789_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + name: "valid key/value list", + in: "abcdefghijklmnopqrstuvwxyz0123456789_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + out: "abcdefghijklmnopqrstuvwxyz0123456789_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", tracestate: TraceState{list: []member{ { Key: "abcdefghijklmnopqrstuvwxyz0123456789_-*/", @@ -102,8 +119,9 @@ var testcases = []struct { }}, }, { - in: "abcdefghijklmnopqrstuvwxyz0123456789_-*/@a-z0-9_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", - out: "abcdefghijklmnopqrstuvwxyz0123456789_-*/@a-z0-9_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + name: "valid key/value list with tenant", + in: "abcdefghijklmnopqrstuvwxyz0123456789_-*/@a-z0-9_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", + out: "abcdefghijklmnopqrstuvwxyz0123456789_-*/@a-z0-9_-*/= !\"#$%&'()*+-./0123456789:;<>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", tracestate: TraceState{list: []member{ { Key: "abcdefghijklmnopqrstuvwxyz0123456789_-*/@a-z0-9_-*/", @@ -112,35 +130,40 @@ var testcases = []struct { }}, }, { + name: "empty input", // Empty input should result in no error and a zero value // TraceState being returned, that TraceState should be encoded as an // empty string. }, { - in: "foo=1", - out: "foo=1", + name: "single key and value", + in: "foo=1", + out: "foo=1", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, }}, }, { - in: "foo=1,", - out: "foo=1", + name: "single key and value with empty separator", + in: "foo=1,", + out: "foo=1", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, }}, }, { - in: "foo=1,bar=2", - out: "foo=1,bar=2", + name: "multiple keys and values", + in: "foo=1,bar=2", + out: "foo=1,bar=2", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, {Key: "bar", Value: "2"}, }}, }, { - in: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", - out: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", + name: "with a key at maximum length", + in: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", + out: "foo=1,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz=1", tracestate: TraceState{list: []member{ { Key: "foo", @@ -153,8 +176,9 @@ var testcases = []struct { }}, }, { - in: "foo=1,ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@vvvvvvvvvvvvvv=1", - out: "foo=1,ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@vvvvvvvvvvvvvv=1", + name: "with a key and tenant at maximum length", + in: "foo=1,ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@vvvvvvvvvvvvvv=1", + out: "foo=1,ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt@vvvvvvvvvvvvvv=1", tracestate: TraceState{list: []member{ { Key: "foo", @@ -167,8 +191,9 @@ var testcases = []struct { }}, }, { - in: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32", - out: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32", + name: "with maximum members", + in: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32", + out: "bar01=01,bar02=02,bar03=03,bar04=04,bar05=05,bar06=06,bar07=07,bar08=08,bar09=09,bar10=10,bar11=11,bar12=12,bar13=13,bar14=14,bar15=15,bar16=16,bar17=17,bar18=18,bar19=19,bar20=20,bar21=21,bar22=22,bar23=23,bar24=24,bar25=25,bar26=26,bar27=27,bar28=28,bar29=29,bar30=30,bar31=31,bar32=32", tracestate: TraceState{list: []member{ {Key: "bar01", Value: "01"}, {Key: "bar02", Value: "02"}, @@ -205,8 +230,9 @@ var testcases = []struct { }}, }, { - in: "foo=1,bar=2,rojo=1,congo=2,baz=3", - out: "foo=1,bar=2,rojo=1,congo=2,baz=3", + name: "with several members", + in: "foo=1,bar=2,rojo=1,congo=2,baz=3", + out: "foo=1,bar=2,rojo=1,congo=2,baz=3", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, {Key: "bar", Value: "2"}, @@ -216,8 +242,9 @@ var testcases = []struct { }}, }, { - in: "foo=1 \t , \t bar=2, \t baz=3", - out: "foo=1,bar=2,baz=3", + name: "with tabs between members", + in: "foo=1 \t , \t bar=2, \t baz=3", + out: "foo=1,bar=2,baz=3", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, {Key: "bar", Value: "2"}, @@ -225,8 +252,9 @@ var testcases = []struct { }}, }, { - in: "foo=1\t \t,\t \tbar=2,\t \tbaz=3", - out: "foo=1,bar=2,baz=3", + name: "with multiple tabs between members", + in: "foo=1\t \t,\t \tbar=2,\t \tbaz=3", + out: "foo=1,bar=2,baz=3", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, {Key: "bar", Value: "2"}, @@ -234,22 +262,25 @@ var testcases = []struct { }}, }, { - in: "foo=1 ", - out: "foo=1", + name: "with space at the end of the member", + in: "foo=1 ", + out: "foo=1", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, }}, }, { - in: "foo=1\t", - out: "foo=1", + name: "with tab at the end of the member", + in: "foo=1\t", + out: "foo=1", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, }}, }, { - in: "foo=1 \t", - out: "foo=1", + name: "with tab and space at the end of the member", + in: "foo=1 \t", + out: "foo=1", tracestate: TraceState{list: []member{ {Key: "foo", Value: "1"}, }}, @@ -269,13 +300,15 @@ var maxMembers = func() TraceState { func TestParseTraceState(t *testing.T) { for _, tc := range testcases { - got, err := ParseTraceState(tc.in) - assert.Equal(t, tc.tracestate, got) - if tc.err != nil { - assert.ErrorIs(t, err, tc.err, tc.in) - } else { - assert.NoError(t, err, tc.in) - } + t.Run(tc.name, func(t *testing.T) { + got, err := ParseTraceState(tc.in) + assert.Equal(t, tc.tracestate, got) + if tc.err != nil { + assert.ErrorIs(t, err, tc.err, tc.in) + } else { + assert.NoError(t, err, tc.in) + } + }) } } @@ -285,8 +318,9 @@ func TestTraceStateString(t *testing.T) { // Only test non-zero value TraceState. continue } - - assert.Equal(t, tc.out, tc.tracestate.String()) + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.out, tc.tracestate.String()) + }) } } @@ -296,15 +330,16 @@ func TestTraceStateMarshalJSON(t *testing.T) { // Only test non-zero value TraceState. continue } + t.Run(tc.name, func(t *testing.T) { + // Encode UTF-8. + expected, err := json.Marshal(tc.out) + require.NoError(t, err) - // Encode UTF-8. - expected, err := json.Marshal(tc.out) - require.NoError(t, err) + actual, err := json.Marshal(tc.tracestate) + require.NoError(t, err) - actual, err := json.Marshal(tc.tracestate) - require.NoError(t, err) - - assert.Equal(t, expected, actual) + assert.Equal(t, expected, actual) + }) } } @@ -332,7 +367,9 @@ func TestTraceStateGet(t *testing.T) { } for _, tc := range testCases { - assert.Equal(t, tc.expected, maxMembers.Get(tc.key), tc.name) + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.expected, maxMembers.Get(tc.key)) + }) } } @@ -377,7 +414,9 @@ func TestTraceStateDelete(t *testing.T) { } for _, tc := range testCases { - assert.Equal(t, tc.expected, ts.Delete(tc.key), tc.name) + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.expected, ts.Delete(tc.key)) + }) } } @@ -453,13 +492,15 @@ func TestTraceStateInsert(t *testing.T) { } for _, tc := range testCases { - actual, err := tc.tracestate.Insert(tc.key, tc.value) - assert.ErrorIs(t, err, tc.err, tc.name) - if tc.err != nil { - assert.Equal(t, tc.tracestate, actual, tc.name) - } else { - assert.Equal(t, tc.expected, actual, tc.name) - } + t.Run(tc.name, func(t *testing.T) { + actual, err := tc.tracestate.Insert(tc.key, tc.value) + assert.ErrorIs(t, err, tc.err, tc.name) + if tc.err != nil { + assert.Equal(t, tc.tracestate, actual) + } else { + assert.Equal(t, tc.expected, actual) + } + }) } } From b01dc21f6c118216bc62bdcd40086b5bc45ebdc3 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Fri, 11 Feb 2022 08:41:34 +0800 Subject: [PATCH 061/886] refactor: use Key's Defined method (#2593) * optimize(attribute): use Key's Defined method * Update kv.go --- attribute/kv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attribute/kv.go b/attribute/kv.go index 8f579338554..1ddf3ce0580 100644 --- a/attribute/kv.go +++ b/attribute/kv.go @@ -26,7 +26,7 @@ type KeyValue struct { // Valid returns if kv is a valid OpenTelemetry attribute. func (kv KeyValue) Valid() bool { - return kv.Key != "" && kv.Value.Type() != INVALID + return kv.Key.Defined() && kv.Value.Type() != INVALID } // Bool creates a KeyValue with a BOOL Value type. From 1bda06288e6df99bdb0705c4ca4870b1f2c82a16 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 11 Feb 2022 08:29:27 -0800 Subject: [PATCH 062/886] Release v1.4.0/v0.27.0 (#2600) * Update versions.yaml * Update changelog * Upgrade stable-v1 to version v1.4.0 * Upgrade experimental-metrics to version v0.27.0 * Upgrade bridge to version v0.27.0 * Update CHANGELOG.md --- CHANGELOG.md | 31 ++++++++++++------- bridge/opencensus/go.mod | 10 +++--- bridge/opencensus/test/go.mod | 8 ++--- bridge/opentracing/go.mod | 4 +-- example/fib/go.mod | 8 ++--- example/jaeger/go.mod | 6 ++-- example/namedtracer/go.mod | 8 ++--- example/opencensus/go.mod | 12 +++---- example/otel-collector/go.mod | 8 ++--- example/passthrough/go.mod | 8 ++--- example/prometheus/go.mod | 8 ++--- example/zipkin/go.mod | 8 ++--- exporters/jaeger/go.mod | 6 ++-- exporters/otlp/otlpmetric/go.mod | 10 +++--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 +++---- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 6 ++-- exporters/otlp/otlptrace/go.mod | 8 ++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++--- exporters/prometheus/go.mod | 8 ++--- exporters/stdout/stdoutmetric/go.mod | 8 ++--- exporters/stdout/stdouttrace/go.mod | 6 ++-- exporters/zipkin/go.mod | 6 ++-- go.mod | 2 +- internal/metric/go.mod | 4 +-- metric/go.mod | 4 +-- sdk/export/metric/go.mod | 6 ++-- sdk/go.mod | 4 +-- sdk/metric/go.mod | 8 ++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 8 ++--- 32 files changed, 128 insertions(+), 119 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bb9f3301da..7e124d10a9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,28 +8,36 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.4.0] - 2022-02-11 + ### Added -- Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) -- Log the configuration of TracerProviders, and Tracers for debugging. To enable use a logger with Verbosity (V level) >=1 -- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) +- Use `OTEL_EXPORTER_ZIPKIN_ENDPOINT` environment variable to specify zipkin collector endpoint. (#2490) +- Log the configuration of `TracerProvider`s, and `Tracer`s for debugging. + To enable use a logger with Verbosity (V level) `>=1`. (#2500) +- Added support to configure the batch span-processor with environment variables. + The following environment variables are used. (#2515) + - `OTEL_BSP_SCHEDULE_DELAY` + - `OTEL_BSP_EXPORT_TIMEOUT` + - `OTEL_BSP_MAX_QUEUE_SIZE`. + - `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` ### Changed -- Jaeger exporter takes into additional 70 bytes overhead into consideration when sending UDP packets (#2489, #2512) -- Zipkin exporter exports `Resource` attributes as the `Tags` field. (#2589) +- Zipkin exporter exports `Resource` attributes in the `Tags` field. (#2589) ### Deprecated -- Deprecate module `"go.opentelemetry.io/otel/sdk/export/metric"`, new functionality available in "go.opentelemetry.io/otel/sdk/metric" module: - - Import path changed `import "go.opentelemetry.io/otel/sdk/export/metric"` to `import go.opentelemetry.io/otel/sdk/metric/export` (#2382). -- Deprecate `AtomicFieldOffsets`, unnecessary public func (#2445) +- Deprecate module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2382) +- Deprecate `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets`. (#2445) ### Fixed -- Fixes the instrument kind for noop async instruments. (#2461) +- Fixed the instrument kind for noop async instruments to correctly report an implementation. (#2461) +- Fix UDP packets overflowing with Jaeger payloads. (#2489, #2512) - Change the `otlpmetric.Client` interface's `UploadMetrics` method to accept a single `ResourceMetrics` instead of a slice of them. (#2491) -- Specify explicit buckets in Prometheus example. (#2493) +- Specify explicit buckets in Prometheus example, fixing issue where example only has `+inf` bucket. (#2419, #2493) - W3C baggage will now decode urlescaped values. (#2529) - Baggage members are now only validated once, when calling `NewMember` and not also when adding it to the baggage itself. (#2522) - The order attributes are dropped from spans in the `go.opentelemetry.io/otel/sdk/trace` package when capacity is reached is fixed to be in compliance with the OpenTelemetry specification. @@ -1675,7 +1683,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.3.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.4.0...HEAD +[1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 [1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 [1.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.2.0 [1.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.1.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 30a69366c61..73c8afe13ac 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 95c30b75eaa..3d43a986d26 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/bridge/opencensus v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/bridge/opencensus v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index fb9ff78019a..9a08f2c4f05 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index 6c36e2a64a8..b5fb3d0dcaa 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index af7f7f20b68..089ac0508fd 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/jaeger v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/jaeger v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index a9452a19c75..3fcc222af22 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index a1fb87122a0..caf2f82ef19 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,12 +10,12 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/bridge/opencensus v0.26.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.26.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/bridge/opencensus v0.27.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 ) replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index acbc10cd1bb..8cfa4e7ca3c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 google.golang.org/grpc v1.44.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 0c023e59c36..b0065d1c2d5 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 62bb10691ee..734e2caa278 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/prometheus v0.26.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/prometheus v0.27.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index da82762c21e..c6e1abcbc86 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/zipkin v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/zipkin v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index ce530fbdfa2..2f07c958556 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index ba19e06432d..f48e2e6b92b 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 11fe57e8a7c..bd4b89a04f7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,12 +4,12 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.26.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.44.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 810db0a898c..33184b92c73 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index ddc8f8a5ed8..614758e93d0 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7324309e2d9..f10407b086f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 5c3486dc0c4..bbceab82ba7 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index bfdbb4ab561..744c7d0fa37 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index c438a6f0037..169b0ec76ab 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/sdk/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 9407448a61a..2b8b41d84fb 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index e517881375e..16a411848f5 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/sdk v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index 0469e2fa55d..7fcb8402a73 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel/trace v1.4.0 ) replace go.opentelemetry.io/otel => ./ diff --git a/internal/metric/go.mod b/internal/metric/go.mod index b1106ef6340..eb1564965c4 100644 --- a/internal/metric/go.mod +++ b/internal/metric/go.mod @@ -4,8 +4,8 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/metric/go.mod b/metric/go.mod index 5b9387bf3f6..bc974ff5de0 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -43,8 +43,8 @@ replace go.opentelemetry.io/otel/trace => ../trace require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/internal/metric v0.26.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/internal/metric v0.27.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 2b10328d6a7..2af08739603 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -42,9 +42,9 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk/metric v0.27.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough diff --git a/sdk/go.mod b/sdk/go.mod index 548e5460134..fc16b899e7a 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/trace v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/trace v1.4.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 1424e5674cf..ce81fee4f04 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -43,10 +43,10 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 - go.opentelemetry.io/otel/internal/metric v0.26.0 - go.opentelemetry.io/otel/metric v0.26.0 - go.opentelemetry.io/otel/sdk v1.3.0 + go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel/internal/metric v0.27.0 + go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/sdk v1.4.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 1b19ac02308..75b71fb5a09 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -43,7 +43,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.3.0 + go.opentelemetry.io/otel v1.4.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index e62acd66e7b..9958db2c087 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.3.0" + return "1.4.0" } diff --git a/versions.yaml b/versions.yaml index 3e13849987d..eb7eadea273 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.3.0 + version: v1.4.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.26.0 + version: v0.27.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -47,11 +47,11 @@ module-sets: - go.opentelemetry.io/otel/sdk/export/metric - go.opentelemetry.io/otel/sdk/metric experimental-schema: - version: v0.0.1 + version: v0.0.2 modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.26.0 + version: v0.27.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 25827f01aa4547fc64e8bb453408651ee1572dbc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 14 Feb 2022 09:09:41 -0800 Subject: [PATCH 063/886] Lock down golangci-lint config (#2602) Disable all default linters prior to enabling the ones we want to ensure that no upgrade that include new default linters introduce changes to the CI system. --- .golangci.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d40bdedc397..7a5fdc07abf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,11 +4,26 @@ run: tests: true #Default linters: + # Disable everything by default so upgrades to not include new "default + # enabled" linters. + disable-all: true + # Specifically enable linters we want to use. enable: - - misspell + - deadcode + - errcheck + - gofmt - goimports + - gosimple + - govet + - ineffassign + - misspell - revive - - gofmt + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + issues: exclude-rules: From f5c487406006642f75a5289e56f7abbeba2c6e8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Feb 2022 11:27:58 -0800 Subject: [PATCH 064/886] Bump actions/setup-go from 2.1.5 to 2.2.0 (#2603) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.1.5 to 2.2.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2.1.5...v2.2.0) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/dependabot.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09abecea0cb..20ba7a7b1b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.5 + uses: actions/setup-go@v2.2.0 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.5 + uses: actions/setup-go@v2.2.0 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.1.5 + uses: actions/setup-go@v2.2.0 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -123,7 +123,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2.1.5 + uses: actions/setup-go@v2.2.0 with: go-version: ${{ matrix.go-version }} - name: Checkout code diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 4ff7b99d7f3..b679cbaf7f9 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v2.1.5 + - uses: actions/setup-go@v2.2.0 with: go-version: '^1.16.0' - uses: evantorrie/mott-the-tidier@v1-beta From cd21df42c41f1ac22c80ffc93d877179b3fee98a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 15 Feb 2022 14:03:38 -0800 Subject: [PATCH 065/886] Refactor development/CI tooling (#2609) * Refactor Makefile * Update dependabot targets * Sync github actions config with Makefile ci target * Update test targets * Use sed instead of parameter indexing * Remove dependabot-generate Address in #2613 instead. --- .github/workflows/ci.yml | 2 +- Makefile | 135 ++++++++++++++++++++------------------- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20ba7a7b1b2..3cb2893edcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Run linters run: make dependabot-check license-check lint vanity-import-check - name: Build - run: make examples build + run: make build - name: Check clean repository run: make check-clean-work-tree diff --git a/Makefile b/Makefile index f360b56daf3..b085561dbaa 100644 --- a/Makefile +++ b/Makefile @@ -12,13 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -EXAMPLES := $(shell ./get_main_pkgs.sh ./example) TOOLS_MOD_DIR := ./internal/tools -# All source code and documents. Used in spell check. ALL_DOCS := $(shell find . -name '*.md' -type f | sort) -# All directories with go.mod files related to opentelemetry library. Used for building, testing and linting. -ALL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example' | sort)) $(shell find ./example -type f -name 'go.mod' -exec dirname {} \; | sort) +ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) +OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort) GO = go @@ -27,8 +25,8 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: dependabot-check license-check lint build examples test-default -ci: precommit check-clean-work-tree test-coverage +precommit: license-check misspell go-mod-tidy golangci-lint-fix test-default +ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -72,51 +70,47 @@ tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(POR # Build -.PHONY: examples generate build -examples: - @set -e; for dir in $(EXAMPLES); do \ - echo "$(GO) build $${dir}/..."; \ - (cd "$${dir}" && \ - $(GO) build .); \ - done - -generate: $(STRINGER) $(PORTO) - set -e; for dir in $(ALL_GO_MOD_DIRS); do \ - echo "$(GO) generate $${dir}/..."; \ - (cd "$${dir}" && \ - PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && \ - $(PORTO) -w .); \ - done - -build: generate - # Build all package code including testing code. - set -e; for dir in $(ALL_GO_MOD_DIRS); do \ - echo "$(GO) build $${dir}/..."; \ - (cd "$${dir}" && \ - $(GO) build ./... && \ - $(GO) list ./... \ - | grep -v third_party \ - | xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null); \ - done +.PHONY: generate build + +generate: $(OTEL_GO_MOD_DIRS:%=generate/%) +generate/%: DIR=$* +generate/%: | $(STRINGER) $(PORTO) + @echo "$(GO) generate $(DIR)/..." \ + && cd $(DIR) \ + && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w . + +build: generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) +build/%: DIR=$* +build/%: + @echo "$(GO) build $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) build ./... + +build-tests/%: DIR=$* +build-tests/%: + @echo "$(GO) build tests $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -vet=off -run xxxxxMatchNothingxxxxx >/dev/null # Tests TEST_TARGETS := test-default test-bench test-short test-verbose test-race .PHONY: $(TEST_TARGETS) test -test-default: ARGS=-v -race +test-default test-race: ARGS=-race test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=. test-short: ARGS=-short -test-verbose: ARGS=-v -test-race: ARGS=-race +test-verbose: ARGS=-v -race $(TEST_TARGETS): test -test: - @set -e; for dir in $(ALL_GO_MOD_DIRS); do \ - echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $${dir}/..."; \ - (cd "$${dir}" && \ - $(GO) list ./... \ - | grep -v third_party \ - | xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS)); \ - done +test: $(OTEL_GO_MOD_DIRS:%=test/%) +test/%: DIR=$* +test/%: + @echo "$(GO) test -timeout $(TIMEOUT)s $(ARGS) $(DIR)/..." \ + && cd $(DIR) \ + && $(GO) list ./... \ + | grep -v third_party \ + | xargs $(GO) test -timeout $(TIMEOUT)s $(ARGS) COVERAGE_MODE = atomic COVERAGE_PROFILE = coverage.out @@ -134,32 +128,42 @@ test-coverage: | $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt +.PHONY: golangci-lint golangci-lint-fix +golangci-lint-fix: ARGS=--fix +golangci-lint-fix: golangci-lint +golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%) +golangci-lint/%: DIR=$* +golangci-lint/%: | $(GOLANGCI_LINT) + @echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \ + && cd $(DIR) \ + && $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS) + +.PHONY: crosslink +crosslink: | $(CROSSLINK) + @echo "cross-linking all go modules" \ + && $(CROSSLINK) + +.PHONY: go-mod-tidy +go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) +go-mod-tidy/%: DIR=$* +go-mod-tidy/%: | crosslink + @echo "$(GO) mod tidy in $(DIR)" \ + && cd $(DIR) \ + && $(GO) mod tidy + +.PHONY: lint-modules +lint-modules: go-mod-tidy + .PHONY: lint -lint: misspell lint-modules | $(GOLANGCI_LINT) - set -e; for dir in $(ALL_GO_MOD_DIRS); do \ - echo "golangci-lint in $${dir}"; \ - (cd "$${dir}" && \ - $(GOLANGCI_LINT) run --fix && \ - $(GOLANGCI_LINT) run); \ - done +lint: misspell lint-modules golangci-lint .PHONY: vanity-import-check vanity-import-check: | $(PORTO) - $(PORTO) --include-internal -l . + @$(PORTO) --include-internal -l . .PHONY: misspell misspell: | $(MISSPELL) - $(MISSPELL) -w $(ALL_DOCS) - -.PHONY: lint-modules -lint-modules: | $(CROSSLINK) - set -e; for dir in $(ALL_GO_MOD_DIRS) $(TOOLS_MOD_DIR); do \ - echo "$(GO) mod tidy in $${dir}"; \ - (cd "$${dir}" && \ - $(GO) mod tidy); \ - done - echo "cross-linking all go modules" - $(CROSSLINK) + @$(MISSPELL) -w $(ALL_DOCS) .PHONY: license-check license-check: @@ -171,17 +175,18 @@ license-check: exit 1; \ fi +DEPENDABOT_PATH=./.github/dependabot.yml .PHONY: dependabot-check dependabot-check: @result=$$( \ for f in $$( find . -type f -name go.mod -exec dirname {} \; | sed 's/^.//' ); \ - do grep -q "directory: \+$$f" .github/dependabot.yml \ + do grep -q "directory: \+$$f" $(DEPENDABOT_PATH) \ || echo "$$f"; \ done; \ ); \ if [ -n "$$result" ]; then \ - echo "missing go.mod dependabot check:"; echo "$$result"; \ - echo "new modules need to be added to the .github/dependabot.yml file"; \ + echo "missing dependabot entry:"; echo "$$result"; \ + echo "new modules need to be added to the $(DEPENDABOT_PATH) file"; \ exit 1; \ fi From 2a9cedf5fe27462e10ff66d0ab6401534ad4f0f5 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 16 Feb 2022 09:00:31 -0800 Subject: [PATCH 066/886] Fix race condition in reading the dropped spans number (#2615) * Fix race condition in reading the dropped spans number As any race condition this should be consider an undefined behavior, and a patch release should be done. Signed-off-by: Bogdan Drutu * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ sdk/trace/batch_span_processor.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e124d10a9f..0fa8067bfbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- Fix race condition in reading the dropped spans number. (#2615) + ## [1.4.0] - 2022-02-11 ### Added diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 6a7b9dc31bd..67e2732c3c7 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -250,7 +250,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { } if l := len(bsp.batch); l > 0 { - global.Debug("exporting spans", "count", len(bsp.batch), "dropped", bsp.dropped) + global.Debug("exporting spans", "count", len(bsp.batch), "dropped", atomic.LoadUint32(&bsp.dropped)) err := bsp.e.ExportSpans(ctx, bsp.batch) // A new batch is always created after exporting, even if the batch failed to be exported. From 065ba75c4b9750665d8b577b170997cafeb8f903 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 16 Feb 2022 09:49:05 -0800 Subject: [PATCH 067/886] Release v1.4.1/v0.27.1 (#2619) * Update versions.yaml * Prepare stable-v1 for version v1.4.1 * Prepare experimental-metrics for version v0.27.1 * Prepare bridge for version v0.27.1 * Update CHANGELOG * Revert "Prepare experimental-metrics for version v0.27.1" This reverts commit 838743af2175c9874f94e92f4dbdb3cc6a1a10be. * Do not release experimental-metrics with v0.27.1 --- CHANGELOG.md | 7 +++++-- bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 8 ++++---- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 6 +++--- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 8 ++++---- example/otel-collector/go.mod | 8 ++++---- example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 2 +- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- internal/metric/go.mod | 2 +- metric/go.mod | 2 +- sdk/export/metric/go.mod | 2 +- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 4 ++-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 32 files changed, 88 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa8067bfbb..42dada4905b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.4.1] - 2022-02-16 + ### Fixed -- Fix race condition in reading the dropped spans number. (#2615) +- Fix race condition in reading the dropped spans number for the `BatchSpanProcessor`. (#2615) ## [1.4.0] - 2022-02-11 @@ -1687,7 +1689,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.4.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.4.1...HEAD +[1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 [1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 [1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 [1.2.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.2.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 73c8afe13ac..c275b1ac003 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 3d43a986d26..b262f82d5e8 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/bridge/opencensus v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/bridge/opencensus v0.27.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 9a08f2c4f05..8bea859d6f1 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index b5fb3d0dcaa..f32a17d8ed9 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 089ac0508fd..89e704f77ef 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/jaeger v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/jaeger v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 3fcc222af22..eb1052a5c34 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index caf2f82ef19..bac77c24e0f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/bridge/opencensus v0.27.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/bridge/opencensus v0.27.1 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 8cfa4e7ca3c..e353ef0ef1c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 google.golang.org/grpc v1.44.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index b0065d1c2d5..0bab8c3ca85 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 734e2caa278..510707da899 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/exporters/prometheus v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index c6e1abcbc86..3a09af7e14f 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/zipkin v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/zipkin v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 2f07c958556..165ded9b2e3 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index f48e2e6b92b..3a1567c0ec2 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.44.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index bd4b89a04f7..9023dc3014f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 33184b92c73..8fe02304d3c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 614758e93d0..a722bfb6969 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index f10407b086f..bbff4b4ab34 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index bbceab82ba7..9a522d90550 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 744c7d0fa37..77519e04d3f 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 169b0ec76ab..de0b27d97c7 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 2b8b41d84fb..1848b11100f 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 16a411848f5..2d5e28d19ef 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/sdk v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index 7fcb8402a73..0065f9e3e0c 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel/trace v1.4.1 ) replace go.opentelemetry.io/otel => ./ diff --git a/internal/metric/go.mod b/internal/metric/go.mod index eb1564965c4..1b8af6b8d15 100644 --- a/internal/metric/go.mod +++ b/internal/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 ) diff --git a/metric/go.mod b/metric/go.mod index bc974ff5de0..839b03b4c98 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -43,7 +43,7 @@ replace go.opentelemetry.io/otel/trace => ../trace require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/internal/metric v0.27.0 ) diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 2af08739603..6affa3e5e5e 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -42,7 +42,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/sdk/go.mod b/sdk/go.mod index fc16b899e7a..403cc024da0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 - go.opentelemetry.io/otel/trace v1.4.0 + go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel/trace v1.4.1 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index ce81fee4f04..a027704356f 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -43,10 +43,10 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/internal/metric v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.0 + go.opentelemetry.io/otel/sdk v1.4.1 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 75b71fb5a09..90174c5c617 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -43,7 +43,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.0 + go.opentelemetry.io/otel v1.4.1 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index 9958db2c087..a09bcbb5e8f 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.4.0" + return "1.4.1" } diff --git a/versions.yaml b/versions.yaml index eb7eadea273..3f06f299346 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.4.0 + version: v1.4.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -51,7 +51,7 @@ module-sets: modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.27.0 + version: v0.27.1 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 67f508b866c79501d469c19c60a944ad921513b3 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Thu, 17 Feb 2022 03:50:45 +0800 Subject: [PATCH 068/886] feature/exporter: add Drop Counts for oltptracer's event and link (#2601) * feature/exporter: add Drop Counts for oltptracer's event Signed-off-by: 1046102779 * feature/exporter: add Drop Counts for oltptracer's event Signed-off-by: 1046102779 * feature/exporter: add Drop Counts for oltptracer's event and link Signed-off-by: 1046102779 * feature/exporter: add Drop Counts for oltptracer's event and link Signed-off-by: 1046102779 Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 +++ .../otlptrace/internal/tracetransform/span.go | 28 ++++++++----------- .../internal/tracetransform/span_test.go | 24 ++++++++++------ 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42dada4905b..6b2bcfe09bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) + ## [1.4.1] - 2022-02-16 ### Fixed diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index 2f0f5eacb77..3c6a3ec4291 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -162,9 +162,10 @@ func links(links []tracesdk.Link) []*tracepb.Span_Link { sid := otLink.SpanContext.SpanID() sl = append(sl, &tracepb.Span_Link{ - TraceId: tid[:], - SpanId: sid[:], - Attributes: KeyValues(otLink.Attributes), + TraceId: tid[:], + SpanId: sid[:], + Attributes: KeyValues(otLink.Attributes), + DroppedAttributesCount: uint32(otLink.DroppedAttributeCount), }) } return sl @@ -180,23 +181,16 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { if evCount > maxEventsPerSpan { evCount = maxEventsPerSpan } - events := make([]*tracepb.Span_Event, 0, evCount) - nEvents := 0 + events := make([]*tracepb.Span_Event, evCount) // Transform message events - for _, e := range es { - if nEvents >= maxEventsPerSpan { - break + for i := 0; i < evCount; i++ { + events[i] = &tracepb.Span_Event{ + Name: es[i].Name, + TimeUnixNano: uint64(es[i].Time.UnixNano()), + Attributes: KeyValues(es[i].Attributes), + DroppedAttributesCount: uint32(es[i].DroppedAttributeCount), } - nEvents++ - events = append(events, - &tracepb.Span_Event{ - Name: e.Name, - TimeUnixNano: uint64(e.Time.UnixNano()), - Attributes: KeyValues(e.Attributes), - // TODO (rghetia) : Add Drop Counts when supported. - }, - ) } return events diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 351de0367ef..f83d748d63c 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -87,9 +87,10 @@ func TestSpanEvent(t *testing.T) { Time: eventTime, }, { - Name: "test 2", - Attributes: attrs, - Time: eventTime, + Name: "test 2", + Attributes: attrs, + Time: eventTime, + DroppedAttributeCount: 2, }, }) if !assert.Len(t, got, 2) { @@ -98,7 +99,7 @@ func TestSpanEvent(t *testing.T) { eventTimestamp := uint64(1589932800 * 1e9) assert.Equal(t, &tracepb.Span_Event{Name: "test 1", Attributes: nil, TimeUnixNano: eventTimestamp}, got[0]) // Do not test Attributes directly, just that the return value goes to the correct field. - assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp}, got[1]) + assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp, DroppedAttributesCount: 2}, got[1]) } func TestExcessiveSpanEvents(t *testing.T) { @@ -124,10 +125,13 @@ func TestEmptyLinks(t *testing.T) { func TestLinks(t *testing.T) { attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} l := []tracesdk.Link{ - {}, { - SpanContext: trace.SpanContext{}, - Attributes: attrs, + DroppedAttributeCount: 3, + }, + { + SpanContext: trace.SpanContext{}, + Attributes: attrs, + DroppedAttributeCount: 3, }, } got := links(l) @@ -139,8 +143,9 @@ func TestLinks(t *testing.T) { // Empty should be empty. expected := &tracepb.Span_Link{ - TraceId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - SpanId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + TraceId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + SpanId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + DroppedAttributesCount: 3, } assert.Equal(t, expected, got[0]) @@ -151,6 +156,7 @@ func TestLinks(t *testing.T) { // Changes to our links should not change the produced links. l[1].SpanContext = l[1].SpanContext.WithTraceID(trace.TraceID{}) assert.Equal(t, expected, got[1]) + assert.Equal(t, l[1].DroppedAttributeCount, int(got[1].DroppedAttributesCount)) } func TestStatus(t *testing.T) { From d46c0d2e361423ea019bc2d18049066c889ac14e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 17 Feb 2022 07:45:10 -0800 Subject: [PATCH 069/886] Add dependabot-generate make target (#2613) * Refactor common repo code for crosslink * Add dbotconf utility * Add dependabot-generate target to Makefile * Generate dependabot.yml * Update Makefile targets related to dependabot-generate --- .github/dependabot.yml | 170 +++++++++----------------- Makefile | 13 +- internal/tools/common.go | 79 +++++++++++- internal/tools/crosslink/crosslink.go | 112 ++++------------- internal/tools/dbotconf/dbotconf.go | 112 +++++++++++++++++ internal/tools/go.mod | 1 + 6 files changed, 276 insertions(+), 211 deletions(-) create mode 100644 internal/tools/dbotconf/dbotconf.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d326b38e49c..ca2daee0cbd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,8 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates -# \todo Eliminate duplication when/if Dependabot supports YAML anchors +# File generated by "make dependabot-generate"; DO NOT EDIT. version: 2 updates: - - - package-ecosystem: github-actions + - package-ecosystem: github-actions directory: / labels: - dependencies @@ -16,8 +11,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: / labels: - dependencies @@ -26,18 +20,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /bridge/opentracing - labels: - - dependencies - - go - - "Skip Changelog" - schedule: - day: sunday - interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /bridge/opencensus labels: - dependencies @@ -46,8 +29,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /bridge/opencensus/test labels: - dependencies @@ -56,9 +38,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /example/fib + - package-ecosystem: gomod + directory: /bridge/opentracing labels: - dependencies - go @@ -66,9 +47,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /example/prom-collector + - package-ecosystem: gomod + directory: /example/fib labels: - dependencies - go @@ -76,8 +56,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/jaeger labels: - dependencies @@ -86,8 +65,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/namedtracer labels: - dependencies @@ -96,8 +74,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/opencensus labels: - dependencies @@ -106,8 +83,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/otel-collector labels: - dependencies @@ -116,8 +92,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/passthrough labels: - dependencies @@ -126,8 +101,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/prometheus labels: - dependencies @@ -136,8 +110,7 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod + - package-ecosystem: gomod directory: /example/zipkin labels: - dependencies @@ -146,19 +119,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/prometheus - labels: - - dependencies - - go - - "Skip Changelog" - schedule: - day: sunday - interval: weekly - - - package-ecosystem: gomod - directory: /exporters/stdout/stdouttrace + - package-ecosystem: gomod + directory: /exporters/jaeger labels: - dependencies - go @@ -166,9 +128,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/stdout/stdoutmetric + - package-ecosystem: gomod + directory: /exporters/otlp/internal/retry labels: - dependencies - go @@ -176,9 +137,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/jaeger + - package-ecosystem: gomod + directory: /exporters/otlp/otlpmetric labels: - dependencies - go @@ -186,9 +146,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/zipkin + - package-ecosystem: gomod + directory: /exporters/otlp/otlpmetric/otlpmetricgrpc labels: - dependencies - go @@ -196,9 +155,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /sdk + - package-ecosystem: gomod + directory: /exporters/otlp/otlpmetric/otlpmetrichttp labels: - dependencies - go @@ -206,9 +164,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /internal/metric + - package-ecosystem: gomod + directory: /exporters/otlp/otlptrace labels: - dependencies - go @@ -216,9 +173,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /internal/tools + - package-ecosystem: gomod + directory: /exporters/otlp/otlptrace/otlptracegrpc labels: - dependencies - go @@ -226,9 +182,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /metric + - package-ecosystem: gomod + directory: /exporters/otlp/otlptrace/otlptracehttp labels: - dependencies - go @@ -236,9 +191,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /sdk/export/metric + - package-ecosystem: gomod + directory: /exporters/prometheus labels: - dependencies - go @@ -246,9 +200,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /sdk/metric + - package-ecosystem: gomod + directory: /exporters/stdout/stdoutmetric labels: - dependencies - go @@ -256,9 +209,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /internal/tools/semconv-gen + - package-ecosystem: gomod + directory: /exporters/stdout/stdouttrace labels: - dependencies - go @@ -266,9 +218,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/internal/retry + - package-ecosystem: gomod + directory: /exporters/zipkin labels: - dependencies - go @@ -276,9 +227,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlptrace + - package-ecosystem: gomod + directory: /internal/metric labels: - dependencies - go @@ -286,9 +236,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlptrace/otlptracegrpc + - package-ecosystem: gomod + directory: /internal/tools labels: - dependencies - go @@ -296,9 +245,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlptrace/otlptracehttp + - package-ecosystem: gomod + directory: /metric labels: - dependencies - go @@ -306,9 +254,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlpmetric + - package-ecosystem: gomod + directory: /schema labels: - dependencies - go @@ -316,9 +263,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlpmetric/otlpmetricgrpc + - package-ecosystem: gomod + directory: /sdk labels: - dependencies - go @@ -326,9 +272,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /trace + - package-ecosystem: gomod + directory: /sdk/export/metric labels: - dependencies - go @@ -336,9 +281,8 @@ updates: schedule: day: sunday interval: weekly - - - package-ecosystem: gomod - directory: /exporters/otlp/otlpmetric/otlpmetrichttp + - package-ecosystem: gomod + directory: /sdk/metric labels: - dependencies - go @@ -346,10 +290,8 @@ updates: schedule: day: sunday interval: weekly - - - - package-ecosystem: gomod - directory: /schema + - package-ecosystem: gomod + directory: /trace labels: - dependencies - go diff --git a/Makefile b/Makefile index b085561dbaa..bcb3a6d8629 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: license-check misspell go-mod-tidy golangci-lint-fix test-default +precommit: dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -47,6 +47,9 @@ $(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen CROSSLINK = $(TOOLS)/crosslink $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink +DBOTCONF = $(TOOLS)/dbotconf +$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/dbotconf + GOLANGCI_LINT = $(TOOLS)/golangci-lint $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint @@ -66,7 +69,7 @@ GOJQ = $(TOOLS)/gojq $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools -tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) # Build @@ -187,9 +190,15 @@ dependabot-check: if [ -n "$$result" ]; then \ echo "missing dependabot entry:"; echo "$$result"; \ echo "new modules need to be added to the $(DEPENDABOT_PATH) file"; \ + echo "(run: make dependabot-generate)"; \ exit 1; \ fi +.PHONY: dependabot-generate +dependabot-generate: $(DBOTCONF) + @echo "gerating dependabot configuration"; \ + $(DBOTCONF) + .PHONY: check-clean-work-tree check-clean-work-tree: @if ! git diff --quiet; then \ diff --git a/internal/tools/common.go b/internal/tools/common.go index 525e5adcf3b..0c7389934ca 100644 --- a/internal/tools/common.go +++ b/internal/tools/common.go @@ -18,18 +18,28 @@ package tools // import "go.opentelemetry.io/otel/internal/tools" import ( + "bytes" "errors" "fmt" + "io" "os" "path/filepath" + "sort" "strings" + "text/tabwriter" + + "golang.org/x/mod/modfile" ) -// FindRepoRoot retrieves the root of the repository containing the current working directory. -// Beginning at the current working directory (dir), the algorithm checks if joining the ".git" -// suffix, such as "dir.get", is a valid file. Otherwise, it will continue checking the dir's -// parent directory until it reaches the repo root or returns an error if it cannot be found. -func FindRepoRoot() (string, error) { +// Repo represents a git repository. +type Repo string + +// FindRepoRoot retrieves the root of the repository containing the current +// working directory. Beginning at the current working directory (dir), the +// algorithm checks if joining the ".git" suffix, such as "dir.get", is a +// valid file. Otherwise, it will continue checking the dir's parent directory +// until it reaches the repo root or returns an error if it cannot be found. +func FindRepoRoot() (Repo, error) { start, err := os.Getwd() if err != nil { return "", err @@ -52,6 +62,63 @@ func FindRepoRoot() (string, error) { return "", err } - return dir, nil + return Repo(dir), nil + } +} + +// FindModules returns all Go modules contained in Repo r. +func (r Repo) FindModules() ([]*modfile.File, error) { + var results []*modfile.File + err := filepath.Walk(string(r), func(path string, info os.FileInfo, walkErr error) error { + if walkErr != nil { + // Walk failed to walk into this directory. Stop walking and + // signal this error. + return walkErr + } + + if !info.IsDir() { + return nil + } + + goMod := filepath.Join(path, "go.mod") + f, err := os.Open(goMod) + if errors.Is(err, os.ErrNotExist) { + return nil + } + if err != nil { + return err + } + + var b bytes.Buffer + io.Copy(&b, f) + if err = f.Close(); err != nil { + return err + } + + mFile, err := modfile.Parse(goMod, b.Bytes(), nil) + if err != nil { + return err + } + results = append(results, mFile) + return nil + }) + + sort.SliceStable(results, func(i, j int) bool { + return results[i].Syntax.Name < results[j].Syntax.Name + }) + + return results, err +} + +func PrintModFiles(w io.Writer, mFiles []*modfile.File) error { + tw := tabwriter.NewWriter(w, 0, 0, 1, ' ', 0) + if _, err := fmt.Fprintln(tw, "FILE PATH\tIMPORT PATH"); err != nil { + return err + } + for _, m := range mFiles { + if _, err := fmt.Fprintf(tw, "%s\t%s\n", m.Syntax.Name, m.Module.Mod.Path); err != nil { + return err + } } + return tw.Flush() } diff --git a/internal/tools/crosslink/crosslink.go b/internal/tools/crosslink/crosslink.go index a229bfa6db0..5f19d5b946e 100644 --- a/internal/tools/crosslink/crosslink.go +++ b/internal/tools/crosslink/crosslink.go @@ -25,106 +25,42 @@ package main import ( - "encoding/json" - "errors" - "fmt" - "io" "log" "os" - "os/exec" "path/filepath" "strings" - "text/tabwriter" "go.opentelemetry.io/otel/internal/tools" + "golang.org/x/mod/modfile" ) -type repo string - -type mod struct { - filePath string - importPath string -} - -func (r repo) findModules() (mods, error) { - var results []mod - err := filepath.Walk(string(r), func(path string, info os.FileInfo, err error) error { - if !info.IsDir() { - return nil - } - - _, err = os.Stat(filepath.Join(path, "go.mod")) - if errors.Is(err, os.ErrNotExist) { - return nil - } - if err != nil { - return err - } - - cmd := exec.Command("go", "mod", "edit", "-json") - cmd.Dir = path - out, err := cmd.Output() - if err != nil { - return err - } - - var result struct { - Module struct { - Path string - } - } - err = json.Unmarshal(out, &result) - if err != nil { - return err - } - - results = append(results, mod{ - filePath: path, - importPath: result.Module.Path, - }) - return nil - }) - - return results, err -} - -type mods []mod - -func (m mods) print(w io.Writer) error { - tw := tabwriter.NewWriter(w, 0, 0, 1, ' ', 0) - if _, err := fmt.Fprintln(tw, "FILE PATH\tIMPORT PATH"); err != nil { - return err - } - for _, m := range m { - if _, err := fmt.Fprintf(tw, "%s\t%s\n", m.filePath, m.importPath); err != nil { - return err - } - } - return tw.Flush() -} - -func (m mods) crossLink() error { +func crossLink(m []*modfile.File) error { for _, from := range m { - args := []string{"mod", "edit"} - + basepath := filepath.Dir(from.Syntax.Name) for _, to := range m { - localPath, err := filepath.Rel(from.filePath, to.filePath) + newPath, err := filepath.Rel(basepath, filepath.Dir(to.Syntax.Name)) if err != nil { return err } - if localPath == "." || localPath == ".." { - localPath += "/" - } else if !strings.HasPrefix(localPath, "..") { - localPath = "./" + localPath + switch { + case newPath == ".", newPath == "..": + newPath += "/" + case !strings.HasPrefix(newPath, ".."): + newPath = "./" + newPath } - args = append(args, "-replace", to.importPath+"="+localPath) + from.AddReplace(to.Module.Mod.Path, "", newPath, "") } - cmd := exec.Command("go", args...) - cmd.Dir = from.filePath - out, err := cmd.CombinedOutput() + from.Cleanup() + + f, err := os.OpenFile(from.Syntax.Name, os.O_RDWR|os.O_TRUNC, 0755) if err != nil { - log.Println(string(out)) + return err + } + if _, err = f.Write(modfile.Format(from.Syntax)); err != nil { + return err + } + if err = f.Close(); err != nil { return err } } @@ -132,23 +68,21 @@ func (m mods) crossLink() error { } func main() { - repoRootStr, err := tools.FindRepoRoot() + root, err := tools.FindRepoRoot() if err != nil { log.Fatalf("unable to find repo root: %v", err) } - repoRoot := repo(repoRootStr) - - mods, err := repoRoot.findModules() + mods, err := root.FindModules() if err != nil { log.Fatalf("unable to list modules: %v", err) } - if err := mods.print(os.Stdout); err != nil { + if err := tools.PrintModFiles(os.Stdout, mods); err != nil { log.Fatalf("unable to print modules: %v", err) } - if err := mods.crossLink(); err != nil { + if err := crossLink(mods); err != nil { log.Fatalf("unable to crosslink: %v", err) } } diff --git a/internal/tools/dbotconf/dbotconf.go b/internal/tools/dbotconf/dbotconf.go new file mode 100644 index 00000000000..a81a3a83fb9 --- /dev/null +++ b/internal/tools/dbotconf/dbotconf.go @@ -0,0 +1,112 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main provides a utility to generate a complete dependabot +// configuration for a repository with multiple Go modules. +package main + +import ( + "flag" + "fmt" + "log" + "os" + "path/filepath" + "sort" + "strings" + "text/template" + + "go.opentelemetry.io/otel/internal/tools" + "golang.org/x/mod/modfile" +) + +var configPtr = flag.String("config", "./.github/dependabot.yml", "dependabot configuration path") + +const configTemplate = `# File generated by "make dependabot-generate"; DO NOT EDIT. + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + labels: + - dependencies + - actions + - "Skip Changelog" + schedule: + day: sunday + interval: weekly +{{- range .}} + - package-ecosystem: gomod + directory: {{.}} + labels: + - dependencies + - go + - "Skip Changelog" + schedule: + day: sunday + interval: weekly +{{- end}} +` + +func gomodDirectories(basePath string, mods []*modfile.File) []string { + var dirs []string + for _, m := range mods { + targetPath := filepath.Dir(m.Syntax.Name) + relPath := strings.TrimPrefix(targetPath, basePath) + if relPath == "" { + relPath = "/" + } + dirs = append(dirs, relPath) + } + sort.Strings(dirs) + return dirs +} + +func generate(path string) error { + tpl, err := template.New("dependabot.yml").Parse(configTemplate) + if err != nil { + return fmt.Errorf("parse template: %w", err) + } + + root, err := tools.FindRepoRoot() + if err != nil { + return fmt.Errorf("find repo root: %w", err) + } + + mods, err := root.FindModules() + if err != nil { + return fmt.Errorf("list modules: %w", err) + } + data := gomodDirectories(string(root), mods) + + f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755) + if err != nil { + return err + } + if err = tpl.Execute(f, data); err != nil { + // Best effort. + _ = f.Close() + return fmt.Errorf("rendering template: %w", err) + } + if err = f.Close(); err != nil { + return fmt.Errorf("closing %s: %w", path, err) + } + return nil +} + +func main() { + flag.Parse() + if err := generate(*configPtr); err != nil { + log.Fatalf("failed to generate dependabot configuration: %v", err) + } +} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index fbaac2e35a9..aac8b9cb1c0 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -11,6 +11,7 @@ require ( github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 + golang.org/x/mod v0.5.1 golang.org/x/tools v0.1.9 ) From b675dda67e56a6e1d4165444289c5da816a828ff Mon Sep 17 00:00:00 2001 From: Ben Wells Date: Thu, 17 Feb 2022 16:11:09 +0000 Subject: [PATCH 070/886] Fix typo in using instrumentation libraries markdown (#2621) Co-authored-by: Tyler Yahn --- website_docs/libraries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 064af7ba0fc..8cd772da06d 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -92,4 +92,4 @@ A full list of instrumentation libraries available can be found in the [OpenTele Instrumentation libraries can do things like generate telemetry data for inbound and outbound HTTP requests, but they don't instrument your actual application. -To get richer telemetry data, use [manual instrumentatiion]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. +To get richer telemetry data, use [manual instrumentation]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. From 98c2c9d96c84816d1a6a65440b5a8c45bc748bfe Mon Sep 17 00:00:00 2001 From: Will Li Date: Fri, 18 Feb 2022 00:21:13 +0800 Subject: [PATCH 071/886] Add env support for span limits configuration (#2606) * add env support for otel_span configuration Signed-off-by: Cuichen Li * update changelog * update changelog and some logic based on comment * Update CHANGELOG.md Co-authored-by: Anthony Mirabella * add document about retrieve value from environment variable Signed-off-by: Cuichen Li * remove trailing whitespace Signed-off-by: Cuichen Li * parse environment variable before apply the options * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update sdk/trace/provider_test.go Co-authored-by: Tyler Yahn * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 10 +++++++ sdk/internal/env/env.go | 15 ++++++++++ sdk/trace/config.go | 16 ++++++++++ sdk/trace/provider.go | 1 + sdk/trace/provider_test.go | 61 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2bcfe09bf..59d0b7bad66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Added support to configure the span limits with environment variables. + The following environment variables are used. (#2606) + - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` + - `OTEL_SPAN_EVENT_COUNT_LIMIT` + - `OTEL_SPAN_LINK_COUNT_LIMIT` + + If the provided environment variables are invalid (negative), the default values would be used. + ### Changed - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index 397fd9593cc..df7a05626b3 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -40,6 +40,21 @@ const ( // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize // i.e. 512 BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" + + // SpanAttributesCountKey + // Maximum allowed span attribute count + // Default: 128 + SpanAttributesCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" + + // SpanEventCountKey + // Maximum allowed span event count + // Default: 128 + SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT" + + // SpanLinkCountKey + // Maximum allowed span link count + // Default: 128 + SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT" ) // IntEnvOr returns the int value of the environment variable with name key if diff --git a/sdk/trace/config.go b/sdk/trace/config.go index 61a30439251..efea7b302f9 100644 --- a/sdk/trace/config.go +++ b/sdk/trace/config.go @@ -13,6 +13,7 @@ // limitations under the License. package trace // import "go.opentelemetry.io/otel/sdk/trace" +import "go.opentelemetry.io/otel/sdk/internal/env" // SpanLimits represents the limits of a span. type SpanLimits struct { @@ -50,14 +51,29 @@ func (sl *SpanLimits) ensureDefault() { } } +func (sl *SpanLimits) parsePotentialEnvConfigs() { + sl.AttributeCountLimit = env.IntEnvOr(env.SpanAttributesCountKey, sl.AttributeCountLimit) + sl.LinkCountLimit = env.IntEnvOr(env.SpanLinkCountKey, sl.LinkCountLimit) + sl.EventCountLimit = env.IntEnvOr(env.SpanEventCountKey, sl.EventCountLimit) +} + const ( // DefaultAttributeCountLimit is the default maximum allowed span attribute count. + // If not specified via WithSpanLimits, will try to retrieve the value from + // environment variable `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`. + // If Invalid value (negative or zero) is provided, the default value 128 will be used. DefaultAttributeCountLimit = 128 // DefaultEventCountLimit is the default maximum allowed span event count. + // If not specified via WithSpanLimits, will try to retrieve the value from + // environment variable `OTEL_SPAN_EVENT_COUNT_LIMIT`. + // If Invalid value (negative or zero) is provided, the default value 128 will be used. DefaultEventCountLimit = 128 // DefaultLinkCountLimit is the default maximum allowed span link count. + // If the value is not specified via WithSpanLimits, will try to retrieve the value from + // environment variable `OTEL_SPAN_LINK_COUNT_LIMIT`. + // If Invalid value (negative or zero) is provided, the default value 128 will be used. DefaultLinkCountLimit = 128 // DefaultAttributePerEventCountLimit is the default maximum allowed attribute per span event count. diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index c6b311f9cdc..2de79f03397 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -98,6 +98,7 @@ var _ trace.TracerProvider = &TracerProvider{} func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { o := tracerProviderConfig{} + o.spanLimits.parsePotentialEnvConfigs() for _, opt := range opts { o = opt.apply(o) } diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index e2fce31d7f7..0633889bdc2 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -17,8 +17,14 @@ package trace import ( "context" "errors" + "os" "testing" + "github.com/stretchr/testify/require" + + ottest "go.opentelemetry.io/otel/internal/internaltest" + "go.opentelemetry.io/otel/sdk/internal/env" + "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/trace" @@ -94,3 +100,58 @@ func TestSchemaURL(t *testing.T) { tracerStruct := tracerIface.(*tracer) assert.EqualValues(t, schemaURL, tracerStruct.instrumentationLibrary.SchemaURL) } + +func TestNewTraceProviderWithoutSpanLimitConfiguration(t *testing.T) { + envStore := ottest.NewEnvStore() + defer func() { + require.NoError(t, envStore.Restore()) + }() + envStore.Record(env.SpanAttributesCountKey) + envStore.Record(env.SpanEventCountKey) + envStore.Record(env.SpanLinkCountKey) + require.NoError(t, os.Setenv(env.SpanEventCountKey, "111")) + require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "222")) + require.NoError(t, os.Setenv(env.SpanLinkCountKey, "333")) + tp := NewTracerProvider() + assert.Equal(t, 111, tp.spanLimits.EventCountLimit) + assert.Equal(t, 222, tp.spanLimits.AttributeCountLimit) + assert.Equal(t, 333, tp.spanLimits.LinkCountLimit) +} + +func TestNewTraceProviderWithSpanLimitConfigurationFromOptsAndEnvironmentVariable(t *testing.T) { + envStore := ottest.NewEnvStore() + defer func() { + require.NoError(t, envStore.Restore()) + }() + envStore.Record(env.SpanAttributesCountKey) + envStore.Record(env.SpanEventCountKey) + envStore.Record(env.SpanLinkCountKey) + require.NoError(t, os.Setenv(env.SpanEventCountKey, "111")) + require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "222")) + require.NoError(t, os.Setenv(env.SpanLinkCountKey, "333")) + tp := NewTracerProvider(WithSpanLimits(SpanLimits{ + EventCountLimit: 1, + AttributeCountLimit: 2, + LinkCountLimit: 3, + })) + assert.Equal(t, 1, tp.spanLimits.EventCountLimit) + assert.Equal(t, 2, tp.spanLimits.AttributeCountLimit) + assert.Equal(t, 3, tp.spanLimits.LinkCountLimit) +} + +func TestNewTraceProviderWithInvalidSpanLimitConfigurationFromEnvironmentVariable(t *testing.T) { + envStore := ottest.NewEnvStore() + defer func() { + require.NoError(t, envStore.Restore()) + }() + envStore.Record(env.SpanAttributesCountKey) + envStore.Record(env.SpanEventCountKey) + envStore.Record(env.SpanLinkCountKey) + require.NoError(t, os.Setenv(env.SpanEventCountKey, "-111")) + require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "-222")) + require.NoError(t, os.Setenv(env.SpanLinkCountKey, "-333")) + tp := NewTracerProvider() + assert.Equal(t, 128, tp.spanLimits.EventCountLimit) + assert.Equal(t, 128, tp.spanLimits.AttributeCountLimit) + assert.Equal(t, 128, tp.spanLimits.LinkCountLimit) +} From 8297dbf422d4ff9aa7edb4f7dfe80074f8dd8698 Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Fri, 18 Feb 2022 00:29:18 +0800 Subject: [PATCH 072/886] Remove the otlp trace exporter limit of SpanEvents when exporting (#2616) * remove the limit of SpanEvents when exporting * fix changelog * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie * Update exporters/otlp/otlptrace/internal/tracetransform/span.go Co-authored-by: Sam Xie * Update CHANGELOG.md Co-authored-by: Sam Xie * fix unused param * fix changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn * fix unittest * fix code format Co-authored-by: Sam Xie Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ .../otlp/otlptrace/internal/tracetransform/span.go | 14 ++------------ .../otlptrace/internal/tracetransform/span_test.go | 13 ------------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59d0b7bad66..06e9bcda974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +### Fixed + +- Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) + ## [1.4.1] - 2022-02-16 ### Fixed diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index 3c6a3ec4291..88c05912f0d 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -23,10 +23,6 @@ import ( tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) -const ( - maxEventsPerSpan = 128 -) - // Spans transforms a slice of OpenTelemetry spans into a slice of OTLP // ResourceSpans. func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { @@ -177,14 +173,9 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { return nil } - evCount := len(es) - if evCount > maxEventsPerSpan { - evCount = maxEventsPerSpan - } - events := make([]*tracepb.Span_Event, evCount) - + events := make([]*tracepb.Span_Event, len(es)) // Transform message events - for i := 0; i < evCount; i++ { + for i := 0; i < len(es); i++ { events[i] = &tracepb.Span_Event{ Name: es[i].Name, TimeUnixNano: uint64(es[i].Time.UnixNano()), @@ -192,7 +183,6 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { DroppedAttributesCount: uint32(es[i].DroppedAttributeCount), } } - return events } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index f83d748d63c..37860d2e047 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -15,7 +15,6 @@ package tracetransform import ( - "strconv" "testing" "time" @@ -102,18 +101,6 @@ func TestSpanEvent(t *testing.T) { assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp, DroppedAttributesCount: 2}, got[1]) } -func TestExcessiveSpanEvents(t *testing.T) { - e := make([]tracesdk.Event, maxEventsPerSpan+1) - for i := 0; i < maxEventsPerSpan+1; i++ { - e[i] = tracesdk.Event{Name: strconv.Itoa(i)} - } - assert.Len(t, e, maxEventsPerSpan+1) - got := spanEvents(e) - assert.Len(t, got, maxEventsPerSpan) - // Ensure the drop order. - assert.Equal(t, strconv.Itoa(maxEventsPerSpan-1), got[len(got)-1].Name) -} - func TestNilLinks(t *testing.T) { assert.Nil(t, links(nil)) } From 8ebef7563fa38e092915a74db150570faba7b979 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Feb 2022 08:36:53 -0800 Subject: [PATCH 073/886] Bump github.com/golangci/golangci-lint from 1.44.0 to 1.44.1 in /internal/tools (#2624) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.44.0 to 1.44.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.44.0...v1.44.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 47 +++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index aac8b9cb1c0..5ca64048db6 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.44.0 + github.com/golangci/golangci-lint v1.44.1 github.com/itchyny/gojq v0.12.6 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ae43fe3288b..8a5ca47194e 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -118,14 +118,14 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.5.0 h1:v9LpMwxzTqAJC4lsD/jR7zWb8a66trcqhTEH4Mk6Fio= -github.com/blizzy78/varnamelen v0.5.0/go.mod h1:Mc0nLBKI1/FP0Ga4kqMOgBig0eS5QtR107JnMAb1Wuc= +github.com/blizzy78/varnamelen v0.6.0 h1:TOIDk9qRIMspALZKX8x+5hQfAjuvAFogppnxtvuNmBo= +github.com/blizzy78/varnamelen v0.6.0/go.mod h1:zy2Eic4qWqjrxa60jG34cfL0VXcSwzUrIx68eJPb4Q8= github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/breml/bidichk v0.2.1 h1:SRNtZuLdfkxtocj+xyHXKC1Uv3jVi6EPYx+NHSTNQvE= -github.com/breml/bidichk v0.2.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= -github.com/breml/errchkjson v0.2.1 h1:QCToXnY9BNngrbJoW3qfCTt3BdtbnsI6wyP/WGrxxSE= -github.com/breml/errchkjson v0.2.1/go.mod h1:jZEATw/jF69cL1iy7//Yih8yp/mXp2CBoBr9GJwCAsY= +github.com/breml/bidichk v0.2.2 h1:w7QXnpH0eCBJm55zGCTJveZEkQBt6Fs5zThIdA6qQ9Y= +github.com/breml/bidichk v0.2.2/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= +github.com/breml/errchkjson v0.2.3 h1:97eGTmR/w0paL2SwfRPI1jaAZHaH/fXnxWTw2eEIqE0= +github.com/breml/errchkjson v0.2.3/go.mod h1:jZEATw/jF69cL1iy7//Yih8yp/mXp2CBoBr9GJwCAsY= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -172,8 +172,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.2.9 h1:iwJvwQpBZmMg31w+QQ6jsyZ54KEATn6/nfARbBNW294= -github.com/daixiang0/gci v0.2.9/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc= +github.com/daixiang0/gci v0.3.0 h1:6x2xp99la0TfGmdDJ6T2VrLtCoZwYUVp4/5zT8J7+Go= +github.com/daixiang0/gci v0.3.0/go.mod h1:jaASoJmv/ykO9dAAPy31iJnreV19248qKDdVWf3QgC4= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -318,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.44.0 h1:YJPouGNQEdK+x2KsCpWMIBy0q6MSuxHjkWMxJMNj/DU= -github.com/golangci/golangci-lint v1.44.0/go.mod h1:aBolpzNkmYogKPynGKdOWDCEc8LlwnxZC6w/SJ1TaEs= +github.com/golangci/golangci-lint v1.44.1 h1:/jcmjp9715WazPIu4oZz8KaV9xSq5HTuedjpWm/RVvc= +github.com/golangci/golangci-lint v1.44.1/go.mod h1:s0UbBHNNBlEPt8OcPsJV7IPONwQ+WEVywSk+FPpLV18= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -345,8 +345,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -457,6 +458,8 @@ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= @@ -531,8 +534,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.5.0 h1:CiEKStgoG4K9bjf/zk3eNX0D0J2iFWzxEY+h9UXmlJg= -github.com/kulti/thelper v0.5.0/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= +github.com/kulti/thelper v0.5.1 h1:Uf4CUekH0OvzQTFPrWkstJvXgm6pnNEtQu3HiqEkpB0= +github.com/kulti/thelper v0.5.1/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= github.com/kunwardeep/paralleltest v1.0.3 h1:UdKIkImEAXjR1chUWLn+PNXqWUGs//7tzMeWuP7NhmI= github.com/kunwardeep/paralleltest v1.0.3/go.mod h1:vLydzomDFpk7yu5UX02RmP0H8QfRPOV/oFhWN85Mjb4= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= @@ -540,8 +543,8 @@ github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77 github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/ldez/gomoddirectives v0.2.2 h1:p9/sXuNFArS2RLc+UpYZSI4KQwGMEDWC/LbtF5OPFVg= github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.3.0 h1:Aubm2ZsrsjIGFvdxemMPJaXrSJ5Cys6VWyTQFt9k2dI= -github.com/ldez/tagliatelle v0.3.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= +github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKiM= +github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= @@ -589,8 +592,8 @@ github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwg github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.1.3 h1:6tBZacs2/uv9UOpkBQhCtXh2NGgu2Ry97ZyjcN6uDCM= -github.com/mgechev/revive v1.1.3/go.mod h1:jMzDa13teAuv/KLeqgJw79NDe+1IT0ZO3Mht0vN1Yls= +github.com/mgechev/revive v1.1.4 h1:sZOjY6GU35Kr9jKa/wsKSHgrFz8eASIB5i3tqWZMp0A= +github.com/mgechev/revive v1.1.4/go.mod h1:ZZq2bmyssGh8MSPz3VVziqRNIMYTJXzP8MUKG90vZ9A= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= @@ -714,7 +717,7 @@ github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSx github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.15/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.17/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= @@ -748,7 +751,7 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA= +github.com/shirou/gopsutil/v3 v3.22.1/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1052,6 +1055,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1135,15 +1139,15 @@ golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY= +golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1243,7 +1247,6 @@ golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= From 5ba3866b4a60dae4ee860a1c771bf22ed5863df5 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 18 Feb 2022 20:52:52 +0100 Subject: [PATCH 074/886] Setup benchmarks github action (#2559) * setup benchmarks github action * run on go 1.16 * only run benchmarks on a push * pin all actions --- .github/workflows/benchmark.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000000..c14b91aa4f1 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,32 @@ +name: Benchmark +on: + push: + branches: + - main +env: + DEFAULT_GO_VERSION: 1.16 +jobs: + benchmark: + name: Benchmarks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.4.0 + - uses: actions/setup-go@v2.2.0 + with: + go-version: ${{ env.DEFAULT_GO_VERSION }} + - name: Run benchmarks + run: make test-bench | tee output.txt + - name: Download previous benchmark data + uses: actions/cache@v2.1.7 + with: + path: ./benchmarks + key: ${{ runner.os }}-benchmark + - name: Store benchmarks result + uses: benchmark-action/github-action-benchmark@v1.13.0 + with: + name: Benchmarks + tool: 'go' + output-file-path: output.txt + external-data-json-path: ./benchmarks/data.json + auto-push: false + fail-on-alert: true From 8ba8f68d42f2d476411f196e30e21ae1ae0c54f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Feb 2022 09:46:50 -0800 Subject: [PATCH 075/886] Bump github.com/golangci/golangci-lint from 1.44.1 to 1.44.2 in /internal/tools (#2626) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.44.1 to 1.44.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.44.1...v1.44.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5ca64048db6..583d72b1a50 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.44.1 + github.com/golangci/golangci-lint v1.44.2 github.com/itchyny/gojq v0.12.6 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 8a5ca47194e..1604fe5e896 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -172,8 +172,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.3.0 h1:6x2xp99la0TfGmdDJ6T2VrLtCoZwYUVp4/5zT8J7+Go= -github.com/daixiang0/gci v0.3.0/go.mod h1:jaASoJmv/ykO9dAAPy31iJnreV19248qKDdVWf3QgC4= +github.com/daixiang0/gci v0.3.1-0.20220208004058-76d765e3ab48 h1:9rJGqaC5do9zkvKrtRdx0HJoxj7Jd6vDa0O2eBU0AbU= +github.com/daixiang0/gci v0.3.1-0.20220208004058-76d765e3ab48/go.mod h1:jaASoJmv/ykO9dAAPy31iJnreV19248qKDdVWf3QgC4= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -318,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.44.1 h1:/jcmjp9715WazPIu4oZz8KaV9xSq5HTuedjpWm/RVvc= -github.com/golangci/golangci-lint v1.44.1/go.mod h1:s0UbBHNNBlEPt8OcPsJV7IPONwQ+WEVywSk+FPpLV18= +github.com/golangci/golangci-lint v1.44.2 h1:MzvkDt1j1OHkv42/feNJVNNXRFACPp7aAWBWDo5aYQw= +github.com/golangci/golangci-lint v1.44.2/go.mod h1:KjBgkLvsTWDkhfu12iCrv0gwL1kON5KNhbyjQ6qN7Jo= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -842,8 +842,8 @@ github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqri github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= -github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= -github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= +github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/uudashr/gocognit v1.0.5 h1:rrSex7oHr3/pPLQ0xoWq108XMU8s678FJcQ+aSfOHa4= From d51d1b3090760d226a10786fba233f648b3ad662 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 23 Feb 2022 00:03:17 +0100 Subject: [PATCH 076/886] Use randomly-available port in otlp exporters tests (#2627) * use randomly-available port in otlp exporters tests * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlptrace/otlptracegrpc/client_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella --- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/client_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index bc979541c90..dc7eeda51d9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -93,7 +93,7 @@ func newGRPCExporter(t *testing.T, ctx context.Context, endpoint string, additio } func newExporterEndToEndTest(t *testing.T, additionalOpts []otlpmetricgrpc.Option) { - mc := runMockCollectorAtEndpoint(t, "localhost:56561") + mc := runMockCollector(t) defer func() { _ = mc.stop() @@ -115,7 +115,7 @@ func newExporterEndToEndTest(t *testing.T, additionalOpts []otlpmetricgrpc.Optio } func TestExporterShutdown(t *testing.T) { - mc := runMockCollectorAtEndpoint(t, "localhost:56561") + mc := runMockCollector(t) defer func() { _ = mc.Stop() }() @@ -296,7 +296,7 @@ func TestStartErrorInvalidAddress(t *testing.T) { } func TestEmptyData(t *testing.T) { - mc := runMockCollectorAtEndpoint(t, "localhost:56561") + mc := runMockCollector(t) defer func() { _ = mc.stop() @@ -314,7 +314,7 @@ func TestEmptyData(t *testing.T) { } func TestFailedMetricTransform(t *testing.T) { - mc := runMockCollectorAtEndpoint(t, "localhost:56561") + mc := runMockCollector(t) defer func() { _ = mc.stop() diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 9a02ca227b6..191ff23afd4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -374,7 +374,7 @@ func TestStartErrorInvalidAddress(t *testing.T) { } func TestEmptyData(t *testing.T) { - mc := runMockCollectorAtEndpoint(t, "localhost:56561") + mc := runMockCollector(t) t.Cleanup(func() { require.NoError(t, mc.stop()) }) <-time.After(5 * time.Millisecond) From 94b1848a562232f7aa3f6976132f88399b0e4653 Mon Sep 17 00:00:00 2001 From: yellow chicks Date: Thu, 24 Feb 2022 00:55:49 +0800 Subject: [PATCH 077/886] fix(tracestate): drop right-most member in tracestate (#2592) * todo(tracestate): drop right-most member in tracestate Signed-off-by: 1046102779 * fix(tracestate): drop right-most member in tracestate Signed-off-by: 1046102779 * fix(tracestate): drop right-most member in tracestate Signed-off-by: 1046102779 * fix(tracestate): drop right-most member in tracestate Signed-off-by: 1046102779 * fix(tracestate): drop right-most member in tracestate Signed-off-by: 1046102779 * Update trace/tracestate.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + trace/tracestate.go | 16 +++++----------- trace/tracestate_test.go | 16 +++++++++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06e9bcda974..073ef899045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- For tracestate's members, prepend the new element and remove the oldest one, which is over capacity (#2592) - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) ### Fixed diff --git a/trace/tracestate.go b/trace/tracestate.go index 86fc62c1d8f..7b7af6955f9 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -171,7 +171,8 @@ func (ts TraceState) Get(key string) string { // specification an error is returned with the original TraceState. // // If adding a new list-member means the TraceState would have more members -// than is allowed an error is returned instead with the original TraceState. +// then is allowed, the new list-member will be inserted and the right-most +// list-member will be dropped in the returned TraceState. func (ts TraceState) Insert(key, value string) (TraceState, error) { m, err := newMember(key, value) if err != nil { @@ -179,17 +180,10 @@ func (ts TraceState) Insert(key, value string) (TraceState, error) { } cTS := ts.Delete(key) - if cTS.Len()+1 > maxListMembers { - // TODO (MrAlias): When the second version of the Trace Context - // specification is published this needs to not return an error. - // Instead it should drop the "right-most" member and insert the new - // member at the front. - // - // https://github.com/w3c/trace-context/pull/448 - return ts, fmt.Errorf("failed to insert: %w", errMemberNumber) + if cTS.Len()+1 <= maxListMembers { + cTS.list = append(cTS.list, member{}) } - - cTS.list = append(cTS.list, member{}) + // When the number of members exceeds capacity, drop the "right-most". copy(cTS.list[1:], cTS.list) cTS.list[0] = m diff --git a/trace/tracestate_test.go b/trace/tracestate_test.go index a1ef14f6f7b..784c1589219 100644 --- a/trace/tracestate_test.go +++ b/trace/tracestate_test.go @@ -482,14 +482,20 @@ func TestTraceStateInsert(t *testing.T) { err: errInvalidKey, }, { - name: "too many entries", + name: "drop the right-most member(oldest) in queue", tracestate: maxMembers, key: "keyx", value: "valx", - expected: maxMembers, - err: errMemberNumber, - }, - } + expected: func() TraceState { + // Prepend the new element and remove the oldest one, which is over capacity. + return TraceState{ + list: append( + []member{{Key: "keyx", Value: "valx"}}, + maxMembers.list[:len(maxMembers.list)-1]..., + ), + } + }(), + }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { From 0a6e4d8218fc1876fbda156e87dd67451e6a56a5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 23 Feb 2022 09:21:04 -0800 Subject: [PATCH 078/886] Use port 4318 for otlp*http client default (#2625) * Use port 4318 for otlptracehttp client default * Use port 4318 for otlpmetrichttp client default * Add changes to changelog * Fix arg pass error * Simplify defaultPath path parsing --- CHANGELOG.md | 1 + .../otlpmetric/internal/otlpconfig/options.go | 36 ++++++++++++++++--- .../internal/otlpconfig/options_test.go | 20 +++++++---- .../internal/otlpconfig/optiontypes.go | 7 ++-- .../otlp/otlpmetric/otlpmetrichttp/client.go | 23 +----------- .../otlp/otlpmetric/otlpmetrichttp/options.go | 17 ++++++--- exporters/otlp/otlptrace/README.md | 16 +++++---- .../otlptrace/internal/otlpconfig/options.go | 36 ++++++++++++++++--- .../internal/otlpconfig/options_test.go | 20 +++++++---- .../internal/otlpconfig/optiontypes.go | 7 ++-- .../otlp/otlptrace/otlptracehttp/client.go | 23 +----------- .../otlp/otlptrace/otlptracehttp/options.go | 10 +++++- 12 files changed, 131 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 073ef899045..1d27104380a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) +- Use port `4318` instead of `4317` for default for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) ## [1.4.1] - 2022-02-16 diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go index fed8a82f1c7..c2f442f998f 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go @@ -17,6 +17,8 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "crypto/tls" "fmt" + "path" + "strings" "time" "google.golang.org/grpc" @@ -72,24 +74,48 @@ type ( } ) -func NewDefaultConfig() Config { - c := Config{ +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ Metrics: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorPort), + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), URLPath: DefaultMetricsPath, Compression: NoCompression, Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } - return c + tmp := strings.TrimSpace(cfg.Metrics.URLPath) + if tmp == "" { + tmp = DefaultMetricsPath + } else { + tmp = path.Clean(tmp) + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + } + cfg.Metrics.URLPath = tmp + return cfg } // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { - cfg := NewDefaultConfig() + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { cfg = opt.ApplyGRPCOption(cfg) diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index d82802603e3..44c9af4d94c 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -76,7 +76,11 @@ func TestConfigs(t *testing.T) { { name: "Test default configs", asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } assert.Equal(t, otlpconfig.NoCompression, c.Metrics.Compression) assert.Equal(t, map[string]string(nil), c.Metrics.Headers) assert.Equal(t, 10*time.Second, c.Metrics.Timeout) @@ -386,11 +390,7 @@ func TestConfigs(t *testing.T) { t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) // Tests Generic options as HTTP Options - cfg := otlpconfig.NewDefaultConfig() - cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) - for _, opt := range tt.opts { - cfg = opt.ApplyHTTPOption(cfg) - } + cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(tt.opts)...) tt.asserts(t, &cfg, false) // Tests Generic options as gRPC Options @@ -400,6 +400,14 @@ func TestConfigs(t *testing.T) { } } +func asHTTPOptions(opts []otlpconfig.GenericOption) []otlpconfig.HTTPOption { + converted := make([]otlpconfig.HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = otlpconfig.NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + func asGRPCOptions(opts []otlpconfig.GenericOption) []otlpconfig.GRPCOption { converted := make([]otlpconfig.GRPCOption, len(opts)) for i, o := range opts { diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go index beb0eb08b3b..1d6f83f366d 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go @@ -17,9 +17,10 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import "time" const ( - // DefaultCollectorPort is the port the Exporter will attempt connect to - // if no collector port is provided. - DefaultCollectorPort uint16 = 4317 + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 // DefaultCollectorHost is the host address the Exporter will attempt // connect to if no collector address is provided. DefaultCollectorHost string = "localhost" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index aa381f8e038..dab28ff8fb2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -24,9 +24,7 @@ import ( "net" "net/http" "net/url" - "path" "strconv" - "strings" "sync" "time" @@ -77,26 +75,7 @@ type client struct { // NewClient creates a new HTTP metric client. func NewClient(opts ...Option) otlpmetric.Client { - cfg := otlpconfig.NewDefaultConfig() - cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.applyHTTPOption(cfg) - } - - for pathPtr, defaultPath := range map[*string]string{ - &cfg.Metrics.URLPath: otlpconfig.DefaultMetricsPath, - } { - tmp := strings.TrimSpace(*pathPtr) - if tmp == "" { - tmp = defaultPath - } else { - tmp = path.Clean(tmp) - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - } - *pathPtr = tmp - } + cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(opts)...) httpClient := &http.Client{ Transport: ourTransport, diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go index bec26204c74..8d12c791954 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go @@ -40,6 +40,14 @@ type Option interface { applyHTTPOption(otlpconfig.Config) otlpconfig.Config } +func asHTTPOptions(opts []Option) []otlpconfig.HTTPOption { + converted := make([]otlpconfig.HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = otlpconfig.NewHTTPOption(o.applyHTTPOption) + } + return converted +} + // RetryConfig defines configuration for retrying batches in case of export // failure using an exponential backoff. type RetryConfig retry.Config @@ -52,11 +60,10 @@ func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config return w.ApplyHTTPOption(cfg) } -// WithEndpoint allows one to set the address of the collector -// endpoint that the driver will use to send metrics. If -// unset, it will instead try to use -// the default endpoint (localhost:4317). Note that the endpoint -// must not contain any URL path. +// WithEndpoint allows one to set the address of the collector endpoint that +// the driver will use to send metrics. If unset, it will instead try to use +// the default endpoint (localhost:4318). Note that the endpoint must not +// contain any URL path. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } diff --git a/exporters/otlp/otlptrace/README.md b/exporters/otlp/otlptrace/README.md index 8a40a86a246..ca91fd4f489 100644 --- a/exporters/otlp/otlptrace/README.md +++ b/exporters/otlp/otlptrace/README.md @@ -38,12 +38,14 @@ override the default configuration. For more information about how each of these environment variables is interpreted, see [the OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md). -| Environment variable | Option | Default value | -| ------------------------------------------------------------------------ |------------------------------ | ----------------------------------- | -| `OTEL_EXPORTER_OTLP_ENDPOINT` `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `WithEndpoint` `WithInsecure` | `https://localhost:4317` | -| `OTEL_EXPORTER_OTLP_CERTIFICATE` `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` | `WithTLSClientConfig` | | -| `OTEL_EXPORTER_OTLP_HEADERS` `OTEL_EXPORTER_OTLP_TRACES_HEADERS` | `WithHeaders` | | -| `OTEL_EXPORTER_OTLP_COMPRESSION` `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` | `WithCompression` | | -| `OTEL_EXPORTER_OTLP_TIMEOUT` `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` | `WithTimeout` | `10s` | +| Environment variable | Option | Default value | +| ------------------------------------------------------------------------ |------------------------------ | -------------------------------------------------------- | +| `OTEL_EXPORTER_OTLP_ENDPOINT` `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `WithEndpoint` `WithInsecure` | `https://localhost:4317` or `https://localhost:4318`[^1] | +| `OTEL_EXPORTER_OTLP_CERTIFICATE` `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` | `WithTLSClientConfig` | | +| `OTEL_EXPORTER_OTLP_HEADERS` `OTEL_EXPORTER_OTLP_TRACES_HEADERS` | `WithHeaders` | | +| `OTEL_EXPORTER_OTLP_COMPRESSION` `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` | `WithCompression` | | +| `OTEL_EXPORTER_OTLP_TIMEOUT` `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` | `WithTimeout` | `10s` | + +[^1]: The gRPC client defaults to `https://localhost:4317` and the HTTP client `https://localhost:4318`. Configuration using options have precedence over the environment variables. diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index e6fb14e00e8..f874c146e25 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -17,6 +17,8 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "path" + "strings" "time" "google.golang.org/grpc" @@ -65,24 +67,48 @@ type ( } ) -func NewDefaultConfig() Config { - c := Config{ +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ Traces: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorPort), + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), URLPath: DefaultTracesPath, Compression: NoCompression, Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } - return c + tmp := strings.TrimSpace(cfg.Traces.URLPath) + if tmp == "" { + tmp = DefaultTracesPath + } else { + tmp = path.Clean(tmp) + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + } + cfg.Traces.URLPath = tmp + return cfg } // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { - cfg := NewDefaultConfig() + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { cfg = opt.ApplyGRPCOption(cfg) diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index b12e0bd9a5c..4efa2f7c630 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -76,7 +76,11 @@ func TestConfigs(t *testing.T) { { name: "Test default configs", asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } assert.Equal(t, otlpconfig.NoCompression, c.Traces.Compression) assert.Equal(t, map[string]string(nil), c.Traces.Headers) assert.Equal(t, 10*time.Second, c.Traces.Timeout) @@ -384,11 +388,7 @@ func TestConfigs(t *testing.T) { t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) // Tests Generic options as HTTP Options - cfg := otlpconfig.NewDefaultConfig() - cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) - for _, opt := range tt.opts { - cfg = opt.ApplyHTTPOption(cfg) - } + cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(tt.opts)...) tt.asserts(t, &cfg, false) // Tests Generic options as gRPC Options @@ -398,6 +398,14 @@ func TestConfigs(t *testing.T) { } } +func asHTTPOptions(opts []otlpconfig.GenericOption) []otlpconfig.HTTPOption { + converted := make([]otlpconfig.HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = otlpconfig.NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + func asGRPCOptions(opts []otlpconfig.GenericOption) []otlpconfig.GRPCOption { converted := make([]otlpconfig.GRPCOption, len(opts)) for i, o := range opts { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go index f69e31095d2..d4331e8749f 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go @@ -15,9 +15,10 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" const ( - // DefaultCollectorPort is the port the Exporter will attempt connect to - // if no collector port is provided. - DefaultCollectorPort uint16 = 4317 + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 // DefaultCollectorHost is the host address the Exporter will attempt // connect to if no collector address is provided. DefaultCollectorHost string = "localhost" diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 81487f9b6f9..613b09284d0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -24,9 +24,7 @@ import ( "net" "net/http" "net/url" - "path" "strconv" - "strings" "sync" "time" @@ -79,26 +77,7 @@ var _ otlptrace.Client = (*client)(nil) // NewClient creates a new HTTP trace client. func NewClient(opts ...Option) otlptrace.Client { - cfg := otlpconfig.NewDefaultConfig() - cfg = otlpconfig.ApplyHTTPEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.applyHTTPOption(cfg) - } - - for pathPtr, defaultPath := range map[*string]string{ - &cfg.Traces.URLPath: otlpconfig.DefaultTracesPath, - } { - tmp := strings.TrimSpace(*pathPtr) - if tmp == "" { - tmp = defaultPath - } else { - tmp = path.Clean(tmp) - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - } - *pathPtr = tmp - } + cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(opts)...) httpClient := &http.Client{ Transport: ourTransport, diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index e550cfb5d51..4257ce3473f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -40,6 +40,14 @@ type Option interface { applyHTTPOption(otlpconfig.Config) otlpconfig.Config } +func asHTTPOptions(opts []Option) []otlpconfig.HTTPOption { + converted := make([]otlpconfig.HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = otlpconfig.NewHTTPOption(o.applyHTTPOption) + } + return converted +} + // RetryConfig defines configuration for retrying batches in case of export // failure using an exponential backoff. type RetryConfig retry.Config @@ -55,7 +63,7 @@ func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config // WithEndpoint allows one to set the address of the collector // endpoint that the driver will use to send spans. If // unset, it will instead try to use -// the default endpoint (localhost:4317). Note that the endpoint +// the default endpoint (localhost:4318). Note that the endpoint // must not contain any URL path. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} From a15269a28ab81204f71bf62e821303f8be9574eb Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 23 Feb 2022 18:27:52 +0100 Subject: [PATCH 079/886] change `gc` runtime name to `go` (#2560) Per the specification: https://github.com/open-telemetry/opentelemetry-specification/pull/2262 Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/resource/process.go | 7 ++++++- sdk/resource/process_test.go | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d27104380a..c68d06b7d30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OTEL_SPAN_LINK_COUNT_LIMIT` If the provided environment variables are invalid (negative), the default values would be used. +- Rename the `gc` runtime name to `go` (#2560) ### Changed diff --git a/sdk/resource/process.go b/sdk/resource/process.go index 80d5e699323..c1e5ae90a5b 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -39,7 +39,12 @@ var ( defaultExecutablePathProvider executablePathProvider = os.Executable defaultCommandArgsProvider commandArgsProvider = func() []string { return os.Args } defaultOwnerProvider ownerProvider = user.Current - defaultRuntimeNameProvider runtimeNameProvider = func() string { return runtime.Compiler } + defaultRuntimeNameProvider runtimeNameProvider = func() string { + if runtime.Compiler == "gc" { + return "go" + } + return runtime.Compiler + } defaultRuntimeVersionProvider runtimeVersionProvider = runtime.Version defaultRuntimeOSProvider runtimeOSProvider = func() string { return runtime.GOOS } defaultRuntimeArchProvider runtimeArchProvider = func() string { return runtime.GOARCH } diff --git a/sdk/resource/process_test.go b/sdk/resource/process_test.go index d60c48411c4..0f9c628cc8d 100644 --- a/sdk/resource/process_test.go +++ b/sdk/resource/process_test.go @@ -118,7 +118,11 @@ func TestCommandArgs(t *testing.T) { } func TestRuntimeName(t *testing.T) { - require.EqualValues(t, runtime.Compiler, resource.RuntimeName()) + if runtime.Compiler == "gc" { + require.EqualValues(t, "go", resource.RuntimeName()) + } else { + require.EqualValues(t, runtime.Compiler, resource.RuntimeName()) + } } func TestRuntimeOS(t *testing.T) { From 8eb376615eb1255eec5f1ad4fd669aa75327020d Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Fri, 25 Feb 2022 09:55:50 -0600 Subject: [PATCH 080/886] Update BatchSpanProcessor debug message (#2640) * update debug message * update changelog Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/batch_span_processor.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c68d06b7d30..71b9781efb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - For tracestate's members, prepend the new element and remove the oldest one, which is over capacity (#2592) - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +- Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) ### Fixed diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 67e2732c3c7..56847d9ccba 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -250,7 +250,7 @@ func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { } if l := len(bsp.batch); l > 0 { - global.Debug("exporting spans", "count", len(bsp.batch), "dropped", atomic.LoadUint32(&bsp.dropped)) + global.Debug("exporting spans", "count", len(bsp.batch), "total_dropped", atomic.LoadUint32(&bsp.dropped)) err := bsp.e.ExportSpans(ctx, bsp.batch) // A new batch is always created after exporting, even if the batch failed to be exported. From 76bff3fe89afc3e1681ad3b5b507da4de182d38f Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Sat, 26 Feb 2022 00:03:15 +0800 Subject: [PATCH 081/886] add hanyuancheung as an approver (#2638) Co-authored-by: Tyler Yahn --- CODEOWNERS | 2 +- CONTRIBUTING.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 808755fe20c..76d959d237a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @paivagustavo @MadVikingGod @pellared +* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @paivagustavo @MadVikingGod @pellared @hanyuancheung CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7dead7084d3..098a7c54fbe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -508,6 +508,7 @@ Approvers: - [David Ashpole](https://github.com/dashpole), Google - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep - [Robert Pająk](https://github.com/pellared), Splunk +- [Chester Cheung](https://github.com/hanyuancheung), Tencent Maintainers: From a1fff3c2588c783d1f3f6fd2315aa2660fc6d330 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Fri, 25 Feb 2022 12:28:28 -0600 Subject: [PATCH 082/886] Add Marshaling implementations for exporters (#2578) * Add Marshaling implementations for exporters * Changelog * Fix changelog Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/jaeger/jaeger.go | 9 +++++++++ exporters/otlp/otlptrace/exporter.go | 11 +++++++++++ exporters/otlp/otlptrace/otlptracegrpc/client.go | 11 +++++++++++ exporters/otlp/otlptrace/otlptracehttp/client.go | 13 +++++++++++++ exporters/zipkin/zipkin.go | 11 +++++++++++ sdk/trace/simple_span_processor.go | 2 +- 7 files changed, 57 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b9781efb7..99f62c59cb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) +- Log the Exporters configuration in the TracerProviders message. (#2578) ### Changed diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index 22a5ed1afa8..d87b79621ef 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -123,6 +123,15 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return e.uploader.shutdown(ctx) } +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + }{ + Type: "jaeger", + } +} + func spanToThrift(ss sdktrace.ReadOnlySpan) *gen.Span { attr := ss.Attributes() tags := make([]*gen.Tag, 0, len(attr)) diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index 7e9bb6c47ae..c5ee6c098cc 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -100,3 +100,14 @@ func NewUnstarted(client Client) *Exporter { client: client, } } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + Client Client + }{ + Type: "otlptrace", + Client: e.client, + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index d709ffa96e1..31ed8190b67 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -273,3 +273,14 @@ func throttleDelay(status *status.Status) time.Duration { } return 0 } + +// MarshalLog is the marshaling function used by the logging system to represent this Client. +func (c *client) MarshalLog() interface{} { + return struct { + Type string + Endpoint string + }{ + Type: "otlphttpgrpc", + Endpoint: c.endpoint, + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 613b09284d0..9a1428b444c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -222,6 +222,19 @@ func (d *client) newRequest(body []byte) (request, error) { return req, nil } +// MarshalLog is the marshaling function used by the logging system to represent this Client. +func (d *client) MarshalLog() interface{} { + return struct { + Type string + Endpoint string + Insecure bool + }{ + Type: "otlphttphttp", + Endpoint: d.cfg.Endpoint, + Insecure: d.cfg.Insecure, + } +} + // bodyReader returns a closure returning a new reader for buf. func bodyReader(buf []byte) func() io.ReadCloser { return func() io.ReadCloser { diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 5c7c20049d9..be14ff12879 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -180,3 +180,14 @@ func (e *Exporter) errf(format string, args ...interface{}) error { e.logf(format, args...) return fmt.Errorf(format, args...) } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + URL string + }{ + Type: "zipkin", + URL: e.url, + } +} diff --git a/sdk/trace/simple_span_processor.go b/sdk/trace/simple_span_processor.go index d31d3c1caff..e8530a95932 100644 --- a/sdk/trace/simple_span_processor.go +++ b/sdk/trace/simple_span_processor.go @@ -116,7 +116,7 @@ func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error { return nil } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (ssp *simpleSpanProcessor) MarshalLog() interface{} { return struct { Type string From 33a5a495a45f872cccb7c2ddf437eecb8c77cfce Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Tue, 1 Mar 2022 23:48:37 +0800 Subject: [PATCH 083/886] Replace master with specific jaeger tag version in otel-collector (#2622) * replace master with specific jaeger tag version in otel-collector * change version * update jeager-operator version in makefile --- example/otel-collector/Makefile | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/example/otel-collector/Makefile b/example/otel-collector/Makefile index 606e8f86ef4..47c560b34c8 100644 --- a/example/otel-collector/Makefile +++ b/example/otel-collector/Makefile @@ -3,15 +3,7 @@ namespace-k8s: jaeger-operator-k8s: # Create the jaeger operator and necessary artifacts in ns observability - kubectl create -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/crds/jaegertracing.io_jaegers_crd.yaml - kubectl create -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/service_account.yaml - kubectl create -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role.yaml - kubectl create -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml - kubectl create -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/operator.yaml - - # Create the cluster role & bindings - kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/cluster_role.yaml - kubectl create -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/cluster_role_binding.yaml + kubectl create -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.31.0/jaeger-operator.yaml jaeger-k8s: kubectl apply -f k8s/jaeger.yaml @@ -31,11 +23,4 @@ clean-k8s: - kubectl delete -f k8s/jaeger.yaml - - kubectl delete -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/cluster_role.yaml - - kubectl delete -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/cluster_role_binding.yaml - - - kubectl delete -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/crds/jaegertracing.io_jaegers_crd.yaml - - kubectl delete -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/service_account.yaml - - kubectl delete -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role.yaml - - kubectl delete -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/role_binding.yaml - - kubectl delete -n observability -f https://raw.githubusercontent.com/jaegertracing/jaeger-operator/master/deploy/operator.yaml + - kubectl delete -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.31.0/jaeger-operator.yaml From 79f6bc1208be88374bddbd5b285ba21c1d3068fc Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Wed, 2 Mar 2022 04:09:51 +0800 Subject: [PATCH 084/886] remove old prom-collector depandence (#2643) --- .gitignore | 1 - bridge/opencensus/go.mod | 2 -- bridge/opentracing/go.mod | 2 -- example/jaeger/go.mod | 2 -- example/namedtracer/go.mod | 2 -- example/opencensus/go.mod | 2 -- example/otel-collector/go.mod | 2 -- example/passthrough/go.mod | 2 -- example/prometheus/go.mod | 2 -- example/zipkin/go.mod | 2 -- exporters/jaeger/go.mod | 2 -- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 -- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 8 -------- exporters/otlp/otlptrace/go.mod | 2 -- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 -- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 -- exporters/prometheus/go.mod | 2 -- exporters/stdout/stdoutmetric/go.mod | 2 -- exporters/stdout/stdouttrace/go.mod | 2 -- exporters/zipkin/go.mod | 2 -- go.mod | 2 -- internal/metric/go.mod | 2 -- metric/go.mod | 2 -- sdk/export/metric/go.mod | 2 -- sdk/go.mod | 2 -- sdk/metric/go.mod | 2 -- trace/go.mod | 2 -- 27 files changed, 59 deletions(-) diff --git a/.gitignore b/.gitignore index 759cf53e002..99230bae28b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,5 @@ gen/ /example/opencensus/opencensus /example/passthrough/passthrough /example/prometheus/prometheus -/example/prom-collector/prom-collector /example/zipkin/zipkin /example/otel-collector/otel-collector diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index c275b1ac003..db2733fc484 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -25,8 +25,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 8bea859d6f1..6a36fde8822 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -22,8 +22,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 89e704f77ef..c67a139299d 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -26,8 +26,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index eb1052a5c34..3873edf2951 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index bac77c24e0f..ba0fa9db3de 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -28,8 +28,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ./ replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e353ef0ef1c..bc705fd9bac 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../opencensus replace go.opentelemetry.io/otel/example/otel-collector => ./ -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 0bab8c3ca85..b738a24061b 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -29,8 +29,6 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector replace go.opentelemetry.io/otel/example/passthrough => ./ -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 510707da899..b30c60e547f 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ./ replace go.opentelemetry.io/otel/example/zipkin => ../zipkin diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 3a09af7e14f..c47de71dfda 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../prometheus replace go.opentelemetry.io/otel/example/zipkin => ./ diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 165ded9b2e3..265bbc92eb3 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -22,8 +22,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 9023dc3014f..cba505c7944 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -42,8 +42,6 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/o replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough -replace go.opentelemetry.io/otel/example/prom-collector => ../../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 8fe02304d3c..a91939eff01 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -37,14 +37,10 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/o replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough -replace go.opentelemetry.io/otel/example/prom-collector => ../../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin -replace go.opentelemetry.io/otel/exporters/metric/prometheus => ../../../metric/prometheus - replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ./ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlptrace @@ -53,10 +49,6 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../.. replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlptrace/otlptracehttp -replace go.opentelemetry.io/otel/exporters/trace/jaeger => ../../../trace/jaeger - -replace go.opentelemetry.io/otel/exporters/trace/zipkin => ../../../trace/zipkin - replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index a722bfb6969..dd9eb1815aa 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -34,8 +34,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencens replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bbff4b4ab34..024bd30407c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -37,8 +37,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/openc replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 9a522d90550..fb3ca1c3429 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -31,8 +31,6 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/o replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough -replace go.opentelemetry.io/otel/example/prom-collector => ../../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 77519e04d3f..3d02af45d5f 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-co replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index de0b27d97c7..07989e72e67 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -27,8 +27,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencens replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 1848b11100f..88d59d2d605 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -26,8 +26,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencens replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 2d5e28d19ef..c9d56ed8d03 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -23,8 +23,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/go.mod b/go.mod index 0065f9e3e0c..f37c9bf371a 100644 --- a/go.mod +++ b/go.mod @@ -24,8 +24,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ./example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ./example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ./example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ./example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ./example/zipkin diff --git a/internal/metric/go.mod b/internal/metric/go.mod index 1b8af6b8d15..7e92e2dcb10 100644 --- a/internal/metric/go.mod +++ b/internal/metric/go.mod @@ -28,8 +28,6 @@ replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-co replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/metric/go.mod b/metric/go.mod index 839b03b4c98..17780384f4c 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -16,8 +16,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 6affa3e5e5e..8f728464774 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -17,8 +17,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencens replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin diff --git a/sdk/go.mod b/sdk/go.mod index 403cc024da0..bad9bd0c41c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -25,8 +25,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index a027704356f..fc70fcf873e 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -16,8 +16,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin diff --git a/trace/go.mod b/trace/go.mod index 90174c5c617..e7a32932464 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -16,8 +16,6 @@ replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector -replace go.opentelemetry.io/otel/example/prom-collector => ../example/prom-collector - replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin From b66c9027776ed667c7a21f187a9a15416876225f Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Wed, 2 Mar 2022 23:13:43 +0800 Subject: [PATCH 085/886] Unify OTLP path parsing/default Logic (#2639) * unify otlp path parsing/default logic * add changelog * add license and unit test * remove else branch * increase unitt test coverage * add vanity import * Update exporters/otlp/internal/config.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/config.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/config.go Co-authored-by: Tyler Yahn * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/config_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/config_test.go Co-authored-by: Tyler Yahn * format the config_test.go * Update exporters/otlp/internal/config_test.go Co-authored-by: Sam Xie * Update exporters/otlp/internal/config_test.go Co-authored-by: Sam Xie * Update exporters/otlp/internal/config_test.go Co-authored-by: Sam Xie * Update exporters/otlp/internal/config_test.go Co-authored-by: Sam Xie * Update exporters/otlp/internal/config.go Co-authored-by: Sam Xie * Update exporters/otlp/internal/config.go Co-authored-by: Sam Xie * change URLPath to urlPath Co-authored-by: Tyler Yahn Co-authored-by: Sam Xie --- CHANGELOG.md | 1 + exporters/otlp/internal/config.go | 34 ++++++++ exporters/otlp/internal/config_test.go | 83 +++++++++++++++++++ .../otlpmetric/internal/otlpconfig/options.go | 15 +--- .../otlptrace/internal/otlpconfig/options.go | 15 +--- 5 files changed, 122 insertions(+), 26 deletions(-) create mode 100644 exporters/otlp/internal/config.go create mode 100644 exporters/otlp/internal/config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 99f62c59cb6..73e1f723a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - For tracestate's members, prepend the new element and remove the oldest one, which is over capacity (#2592) - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` config. (#2639) - Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) ### Fixed diff --git a/exporters/otlp/internal/config.go b/exporters/otlp/internal/config.go new file mode 100644 index 00000000000..b3fd45d9d31 --- /dev/null +++ b/exporters/otlp/internal/config.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal contains common functionality for all OTLP exporters. +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" + +import ( + "fmt" + "path" + "strings" +) + +// CleanPath returns a path with all spaces trimmed and all redundancies removed. If urlPath is empty or cleaning it results in an empty string, defaultPath is returned instead. +func CleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} diff --git a/exporters/otlp/internal/config_test.go b/exporters/otlp/internal/config_test.go new file mode 100644 index 00000000000..92a819a1f2b --- /dev/null +++ b/exporters/otlp/internal/config_test.go @@ -0,0 +1,83 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import "testing" + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := CleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go index c2f442f998f..f2c8ee5d21a 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options.go @@ -17,8 +17,6 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "crypto/tls" "fmt" - "path" - "strings" "time" "google.golang.org/grpc" @@ -27,6 +25,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" ) @@ -90,17 +89,7 @@ func NewHTTPConfig(opts ...HTTPOption) Config { for _, opt := range opts { cfg = opt.ApplyHTTPOption(cfg) } - - tmp := strings.TrimSpace(cfg.Metrics.URLPath) - if tmp == "" { - tmp = DefaultMetricsPath - } else { - tmp = path.Clean(tmp) - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - } - cfg.Metrics.URLPath = tmp + cfg.Metrics.URLPath = internal.CleanPath(cfg.Metrics.URLPath, DefaultMetricsPath) return cfg } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index f874c146e25..56e83b85334 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -17,8 +17,6 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" - "path" - "strings" "time" "google.golang.org/grpc" @@ -27,6 +25,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" ) @@ -83,17 +82,7 @@ func NewHTTPConfig(opts ...HTTPOption) Config { for _, opt := range opts { cfg = opt.ApplyHTTPOption(cfg) } - - tmp := strings.TrimSpace(cfg.Traces.URLPath) - if tmp == "" { - tmp = DefaultTracesPath - } else { - tmp = path.Clean(tmp) - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - } - cfg.Traces.URLPath = tmp + cfg.Traces.URLPath = internal.CleanPath(cfg.Traces.URLPath, DefaultTracesPath) return cfg } From 18f4cb85ece82b12cb9bd9af02efe2a47bd8f76e Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Wed, 2 Mar 2022 09:50:29 -0600 Subject: [PATCH 086/886] [API EPIC 4/4] Fix tests and examples (#2587) * Empty All of the metrics dir * Add instrument api with documentation * Add a NoOp implementation. * Updated to the new config standard * Address PR comments * This change moves components to sdk/metrics The Moved components are: - metric/metrictest - metric/number - metric/internal/registry - metric/sdkapi * The SDK changes necessary to satasify the new api * This fixes the remaing tests. * Update changelog * refactor the Noop meter and instruments into one package. * Renamed pkg.Instruments to pkg.InstrumentProvider Co-authored-by: Aaron Clawson --- .github/dependabot.yml | 9 - CHANGELOG.md | 5 + bridge/opencensus/aggregation.go | 2 +- bridge/opencensus/exporter.go | 18 +- bridge/opencensus/exporter_test.go | 24 +- example/prometheus/main.go | 62 +- exporters/otlp/otlpmetric/exporter.go | 2 +- exporters/otlp/otlpmetric/exporter_test.go | 6 +- .../internal/metrictransform/metric.go | 2 +- .../internal/metrictransform/metric_test.go | 6 +- .../internal/otlpmetrictest/data.go | 6 +- .../internal/otlpmetrictest/otlptest.go | 35 +- .../otlpmetric/otlpmetricgrpc/example_test.go | 52 +- exporters/prometheus/prometheus.go | 4 +- exporters/prometheus/prometheus_test.go | 41 +- exporters/stdout/stdoutmetric/example_test.go | 31 +- exporters/stdout/stdoutmetric/metric.go | 2 +- exporters/stdout/stdoutmetric/metric_test.go | 18 +- internal/metric/async.go | 149 ----- internal/metric/global/benchmark_test.go | 41 -- internal/metric/global/internal_test.go | 40 -- internal/metric/global/meter.go | 287 ---------- internal/metric/global/meter_test.go | 253 -------- internal/metric/global/metric.go | 66 --- internal/metric/global/registry_test.go | 131 ----- internal/metric/global/state_test.go | 45 -- internal/metric/go.mod | 73 --- internal/metric/go.sum | 18 - metric/config.go | 65 +-- metric/doc.go | 44 -- metric/example_test.go | 116 ++++ metric/global/metric.go | 49 -- metric/global/metric_test.go | 42 -- metric/go.mod | 11 +- metric/go.sum | 4 - .../instrument/asyncfloat64/asyncfloat64.go | 70 +++ metric/instrument/asyncint64/asyncint64.go | 70 +++ metric/instrument/config.go | 69 +++ .../instrument.go} | 28 +- metric/instrument/syncfloat64/syncfloat64.go | 56 ++ metric/instrument/syncint64/syncint64.go | 56 ++ metric/meter.go | 60 ++ metric/metric.go | 538 ------------------ metric/metric_instrument.go | 464 --------------- metric/metric_test.go | 497 ---------------- metric/metrictest/meter.go | 290 ---------- metric/nonrecording/instruments.go | 138 +++++ metric/nonrecording/meter.go | 64 +++ metric/noop.go | 30 - sdk/export/metric/aggregation/aggregation.go | 2 +- sdk/export/metric/go.mod | 1 - sdk/export/metric/metric.go | 2 +- sdk/metric/aggregator/aggregator.go | 4 +- sdk/metric/aggregator/aggregator_test.go | 6 +- sdk/metric/aggregator/aggregatortest/test.go | 6 +- .../aggregator/histogram/benchmark_test.go | 4 +- sdk/metric/aggregator/histogram/histogram.go | 4 +- .../aggregator/histogram/histogram_test.go | 4 +- sdk/metric/aggregator/lastvalue/lastvalue.go | 4 +- .../aggregator/lastvalue/lastvalue_test.go | 4 +- sdk/metric/aggregator/sum/sum.go | 4 +- sdk/metric/aggregator/sum/sum_test.go | 4 +- sdk/metric/benchmark_test.go | 116 ++-- sdk/metric/controller/basic/controller.go | 7 +- .../controller/basic/controller_test.go | 100 ++-- sdk/metric/controller/basic/pull_test.go | 7 +- sdk/metric/controller/basic/push_test.go | 10 +- sdk/metric/correct_test.go | 329 ++++++----- sdk/metric/export/aggregation/aggregation.go | 2 +- sdk/metric/export/aggregation/temporality.go | 2 +- .../export/aggregation/temporality_test.go | 6 +- sdk/metric/export/metric.go | 2 +- sdk/metric/go.mod | 3 - sdk/metric/histogram_stress_test.go | 6 +- .../metric}/metrictest/alignment_test.go | 0 sdk/metric/metrictest/meter.go | 56 ++ {metric => sdk/metric}/number/doc.go | 2 +- {metric => sdk/metric}/number/kind_string.go | 0 {metric => sdk/metric}/number/number.go | 2 +- {metric => sdk/metric}/number/number_test.go | 0 sdk/metric/processor/basic/basic.go | 2 +- sdk/metric/processor/basic/basic_test.go | 23 +- sdk/metric/processor/processortest/test.go | 2 +- .../processor/processortest/test_test.go | 28 +- sdk/metric/processor/reducer/reducer.go | 2 +- sdk/metric/processor/reducer/reducer_test.go | 31 +- {internal => sdk}/metric/registry/doc.go | 2 +- {internal => sdk}/metric/registry/registry.go | 25 +- .../metric/registry/registry_test.go | 41 +- sdk/metric/sdk.go | 328 ++++------- {metric => sdk/metric}/sdkapi/descriptor.go | 4 +- .../metric}/sdkapi/descriptor_test.go | 2 +- .../metric}/sdkapi/instrumentkind.go | 2 +- .../metric}/sdkapi/instrumentkind_string.go | 0 .../metric}/sdkapi/instrumentkind_test.go | 2 +- {metric => sdk/metric}/sdkapi/noop.go | 31 +- {metric => sdk/metric}/sdkapi/sdkapi.go | 21 +- {metric => sdk/metric}/sdkapi/sdkapi_test.go | 2 +- sdk/metric/sdkapi/wrap.go | 181 ++++++ sdk/metric/selector/simple/simple.go | 2 +- sdk/metric/selector/simple/simple_test.go | 6 +- sdk/metric/stress_test.go | 502 ---------------- 102 files changed, 1722 insertions(+), 4405 deletions(-) delete mode 100644 internal/metric/async.go delete mode 100644 internal/metric/global/benchmark_test.go delete mode 100644 internal/metric/global/internal_test.go delete mode 100644 internal/metric/global/meter.go delete mode 100644 internal/metric/global/meter_test.go delete mode 100644 internal/metric/global/metric.go delete mode 100644 internal/metric/global/registry_test.go delete mode 100644 internal/metric/global/state_test.go delete mode 100644 internal/metric/go.mod delete mode 100644 internal/metric/go.sum create mode 100644 metric/example_test.go delete mode 100644 metric/global/metric.go delete mode 100644 metric/global/metric_test.go create mode 100644 metric/instrument/asyncfloat64/asyncfloat64.go create mode 100644 metric/instrument/asyncint64/asyncint64.go create mode 100644 metric/instrument/config.go rename metric/{noop_test.go => instrument/instrument.go} (54%) create mode 100644 metric/instrument/syncfloat64/syncfloat64.go create mode 100644 metric/instrument/syncint64/syncint64.go create mode 100644 metric/meter.go delete mode 100644 metric/metric.go delete mode 100644 metric/metric_instrument.go delete mode 100644 metric/metric_test.go delete mode 100644 metric/metrictest/meter.go create mode 100644 metric/nonrecording/instruments.go create mode 100644 metric/nonrecording/meter.go delete mode 100644 metric/noop.go rename {metric => sdk/metric}/metrictest/alignment_test.go (100%) create mode 100644 sdk/metric/metrictest/meter.go rename {metric => sdk/metric}/number/doc.go (92%) rename {metric => sdk/metric}/number/kind_string.go (100%) rename {metric => sdk/metric}/number/number.go (99%) rename {metric => sdk/metric}/number/number_test.go (100%) rename {internal => sdk}/metric/registry/doc.go (92%) rename {internal => sdk}/metric/registry/registry.go (86%) rename {internal => sdk}/metric/registry/registry_test.go (71%) rename {metric => sdk/metric}/sdkapi/descriptor.go (94%) rename {metric => sdk/metric}/sdkapi/descriptor_test.go (96%) rename {metric => sdk/metric}/sdkapi/instrumentkind.go (97%) rename {metric => sdk/metric}/sdkapi/instrumentkind_string.go (100%) rename {metric => sdk/metric}/sdkapi/instrumentkind_test.go (96%) rename {metric => sdk/metric}/sdkapi/noop.go (71%) rename {metric => sdk/metric}/sdkapi/sdkapi.go (90%) rename {metric => sdk/metric}/sdkapi/sdkapi_test.go (96%) create mode 100644 sdk/metric/sdkapi/wrap.go delete mode 100644 sdk/metric/stress_test.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ca2daee0cbd..5e4fc315deb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -227,15 +227,6 @@ updates: schedule: day: sunday interval: weekly - - package-ecosystem: gomod - directory: /internal/metric - labels: - - dependencies - - go - - "Skip Changelog" - schedule: - day: sunday - interval: weekly - package-ecosystem: gomod directory: /internal/tools labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index 73e1f723a65..30b4333441d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### ⚠️ Notice ⚠️ + +This update is a breaking change of the unstable Metrics API. Code instrumented with the `go.opentelemetry.io/otel/metric` <= v0.27.0 will need to be modified. + ### Added - Added support to configure the span limits with environment variables. @@ -24,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - For tracestate's members, prepend the new element and remove the oldest one, which is over capacity (#2592) - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) +- The metrics API has been significantly changed. (#2587) - Unify path cleaning functionally in the `otlpmetric` and `otlptrace` config. (#2639) - Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) diff --git a/bridge/opencensus/aggregation.go b/bridge/opencensus/aggregation.go index 3d88f7589a4..99d2b07afad 100644 --- a/bridge/opencensus/aggregation.go +++ b/bridge/opencensus/aggregation.go @@ -21,8 +21,8 @@ import ( "go.opencensus.io/metric/metricdata" - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" ) var ( diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index bdc22eced73..d40ddc9d665 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -27,13 +27,13 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -170,17 +170,17 @@ func convertDescriptor(ocDescriptor metricdata.Descriptor) (sdkapi.Descriptor, e // Includes TypeGaugeDistribution, TypeCumulativeDistribution, TypeSummary return sdkapi.Descriptor{}, fmt.Errorf("%w; descriptor type: %v", errConversion, ocDescriptor.Type) } - opts := []metric.InstrumentOption{ - metric.WithDescription(ocDescriptor.Description), + opts := []instrument.Option{ + instrument.WithDescription(ocDescriptor.Description), } switch ocDescriptor.Unit { case metricdata.UnitDimensionless: - opts = append(opts, metric.WithUnit(unit.Dimensionless)) + opts = append(opts, instrument.WithUnit(unit.Dimensionless)) case metricdata.UnitBytes: - opts = append(opts, metric.WithUnit(unit.Bytes)) + opts = append(opts, instrument.WithUnit(unit.Bytes)) case metricdata.UnitMilliseconds: - opts = append(opts, metric.WithUnit(unit.Milliseconds)) + opts = append(opts, instrument.WithUnit(unit.Milliseconds)) } - cfg := metric.NewInstrumentConfig(opts...) + cfg := instrument.NewConfig(opts...) return sdkapi.NewDescriptor(ocDescriptor.Name, ikind, nkind, cfg.Description(), cfg.Unit()), nil } diff --git a/bridge/opencensus/exporter_test.go b/bridge/opencensus/exporter_test.go index 8fe6893477e..79e195c1f6c 100644 --- a/bridge/opencensus/exporter_test.go +++ b/bridge/opencensus/exporter_test.go @@ -26,15 +26,15 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -400,8 +400,8 @@ func TestConvertDescriptor(t *testing.T) { "foo", sdkapi.GaugeObserverInstrumentKind, number.Int64Kind, - metric.WithDescription("bar"), - metric.WithUnit(unit.Bytes), + instrument.WithDescription("bar"), + instrument.WithUnit(unit.Bytes), ), }, { @@ -416,8 +416,8 @@ func TestConvertDescriptor(t *testing.T) { "foo", sdkapi.GaugeObserverInstrumentKind, number.Float64Kind, - metric.WithDescription("bar"), - metric.WithUnit(unit.Milliseconds), + instrument.WithDescription("bar"), + instrument.WithUnit(unit.Milliseconds), ), }, { @@ -432,8 +432,8 @@ func TestConvertDescriptor(t *testing.T) { "foo", sdkapi.CounterObserverInstrumentKind, number.Int64Kind, - metric.WithDescription("bar"), - metric.WithUnit(unit.Dimensionless), + instrument.WithDescription("bar"), + instrument.WithUnit(unit.Dimensionless), ), }, { @@ -448,8 +448,8 @@ func TestConvertDescriptor(t *testing.T) { "foo", sdkapi.CounterObserverInstrumentKind, number.Float64Kind, - metric.WithDescription("bar"), - metric.WithUnit(unit.Dimensionless), + instrument.WithDescription("bar"), + instrument.WithUnit(unit.Dimensionless), ), }, { diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 8a1248a358e..12148d2595f 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" @@ -35,6 +35,9 @@ import ( var ( lemonsKey = attribute.Key("ex.com/lemons") + + // TODO Bring back Global package + meterProvider metric.MeterProvider ) func initMeter() { @@ -54,7 +57,9 @@ func initMeter() { if err != nil { log.Panicf("failed to initialize prometheus exporter %v", err) } - global.SetMeterProvider(exporter.MeterProvider()) + // TODO Bring back Global package + // global.SetMeterProvider(exporter.MeterProvider()) + meterProvider = exporter.MeterProvider() http.HandleFunc("/", exporter.ServeHTTP) go func() { @@ -67,23 +72,33 @@ func initMeter() { func main() { initMeter() - meter := global.Meter("ex.com/basic") + // TODO Bring back Global package + // meter := global.Meter("ex.com/basic") + meter := meterProvider.Meter("ex.com/basic") observerLock := new(sync.RWMutex) observerValueToReport := new(float64) observerLabelsToReport := new([]attribute.KeyValue) - cb := func(_ context.Context, result metric.Float64ObserverResult) { + + gaugeObserver, err := meter.AsyncFloat64().Gauge("ex.com.one") + if err != nil { + log.Panicf("failed to initialize instrument: %v", err) + } + _ = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { (*observerLock).RLock() value := *observerValueToReport labels := *observerLabelsToReport (*observerLock).RUnlock() - result.Observe(value, labels...) - } - _ = metric.Must(meter).NewFloat64GaugeObserver("ex.com.one", cb, - metric.WithDescription("A GaugeObserver set to 1.0"), - ) + gaugeObserver.Observe(ctx, value, labels...) + }) - histogram := metric.Must(meter).NewFloat64Histogram("ex.com.two") - counter := metric.Must(meter).NewFloat64Counter("ex.com.three") + histogram, err := meter.SyncFloat64().Histogram("ex.com.two") + if err != nil { + log.Panicf("failed to initialize instrument: %v", err) + } + counter, err := meter.SyncFloat64().Counter("ex.com.three") + if err != nil { + log.Panicf("failed to initialize instrument: %v", err) + } commonLabels := []attribute.KeyValue{lemonsKey.Int(10), attribute.String("A", "1"), attribute.String("B", "2"), attribute.String("C", "3")} notSoCommonLabels := []attribute.KeyValue{lemonsKey.Int(13)} @@ -94,12 +109,9 @@ func main() { *observerValueToReport = 1.0 *observerLabelsToReport = commonLabels (*observerLock).Unlock() - meter.RecordBatch( - ctx, - commonLabels, - histogram.Measurement(2.0), - counter.Measurement(12.0), - ) + + histogram.Record(ctx, 2.0, commonLabels...) + counter.Add(ctx, 12.0, commonLabels...) time.Sleep(5 * time.Second) @@ -107,12 +119,8 @@ func main() { *observerValueToReport = 1.0 *observerLabelsToReport = notSoCommonLabels (*observerLock).Unlock() - meter.RecordBatch( - ctx, - notSoCommonLabels, - histogram.Measurement(2.0), - counter.Measurement(22.0), - ) + histogram.Record(ctx, 2.0, notSoCommonLabels...) + counter.Add(ctx, 22.0, notSoCommonLabels...) time.Sleep(5 * time.Second) @@ -120,12 +128,8 @@ func main() { *observerValueToReport = 13.0 *observerLabelsToReport = commonLabels (*observerLock).Unlock() - meter.RecordBatch( - ctx, - commonLabels, - histogram.Measurement(12.0), - counter.Measurement(13.0), - ) + histogram.Record(ctx, 12.0, commonLabels...) + counter.Add(ctx, 13.0, commonLabels...) fmt.Println("Example finished updating, please visit :2222") diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 36c41cce762..caf21eaf2a3 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -20,9 +20,9 @@ import ( "sync" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 31e3f3e6848..b8ba3dce95e 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -29,16 +29,16 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" commonpb "go.opentelemetry.io/proto/otlp/common/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index e1ba26dccd0..002bb64a997 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -24,10 +24,10 @@ import ( "sync" "time" - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/resource" commonpb "go.opentelemetry.io/proto/otlp/common/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index 7b5b801eb6b..d8f2a1c8b62 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -25,14 +25,14 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" commonpb "go.opentelemetry.io/proto/otlp/common/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go index cc3f7871598..2da921f142c 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go @@ -20,13 +20,13 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // OneRecordReader is a Reader that returns just one diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go index 53af9d5565a..524cb774588 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go @@ -25,12 +25,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/selector/simple" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -63,34 +63,37 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter case sdkapi.CounterInstrumentKind: switch data.nKind { case number.Int64Kind: - metric.Must(meter).NewInt64Counter(name).Add(ctx, data.val, labels...) + c, _ := meter.SyncInt64().Counter(name) + c.Add(ctx, data.val, labels...) case number.Float64Kind: - metric.Must(meter).NewFloat64Counter(name).Add(ctx, float64(data.val), labels...) + c, _ := meter.SyncFloat64().Counter(name) + c.Add(ctx, float64(data.val), labels...) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) } case sdkapi.HistogramInstrumentKind: switch data.nKind { case number.Int64Kind: - metric.Must(meter).NewInt64Histogram(name).Record(ctx, data.val, labels...) + c, _ := meter.SyncInt64().Histogram(name) + c.Record(ctx, data.val, labels...) case number.Float64Kind: - metric.Must(meter).NewFloat64Histogram(name).Record(ctx, float64(data.val), labels...) + c, _ := meter.SyncFloat64().Histogram(name) + c.Record(ctx, float64(data.val), labels...) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) } case sdkapi.GaugeObserverInstrumentKind: switch data.nKind { case number.Int64Kind: - metric.Must(meter).NewInt64GaugeObserver(name, - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(data.val, labels...) - }, - ) + g, _ := meter.AsyncInt64().Gauge(name) + _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { + g.Observe(ctx, data.val, labels...) + }) case number.Float64Kind: - callback := func(v float64) metric.Float64ObserverFunc { - return metric.Float64ObserverFunc(func(_ context.Context, result metric.Float64ObserverResult) { result.Observe(v, labels...) }) - }(float64(data.val)) - metric.Must(meter).NewFloat64GaugeObserver(name, callback) + g, _ := meter.AsyncFloat64().Gauge(name) + _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { + g.Observe(ctx, float64(data.val), labels...) + }) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index f37c39095f7..fe0866b7af5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -24,8 +24,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/selector/simple" @@ -54,7 +53,8 @@ func Example_insecure() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - global.SetMeterProvider(pusher) + // TODO Bring back Global package + // global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { log.Fatalf("could not start metric controoler: %v", err) @@ -68,14 +68,16 @@ func Example_insecure() { } }() - meter := global.Meter("test-meter") + // TODO Bring Back Global package + // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example - counter := metric.Must(meter). - NewFloat64Counter( - "an_important_metric", - metric.WithDescription("Measures the cumulative epicness of the app"), - ) + + counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) + if err != nil { + log.Fatalf("Failed to create the instrument: %v", err) + } for i := 0; i < 10; i++ { log.Printf("Doing really hard work (%d / 10)\n", i+1) @@ -113,7 +115,8 @@ func Example_withTLS() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - global.SetMeterProvider(pusher) + // TODO Bring back Global package + // global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { log.Fatalf("could not start metric controoler: %v", err) @@ -128,14 +131,15 @@ func Example_withTLS() { } }() - meter := global.Meter("test-meter") + // TODO Bring back Global package + // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example - counter := metric.Must(meter). - NewFloat64Counter( - "an_important_metric", - metric.WithDescription("Measures the cumulative epicness of the app"), - ) + counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) + if err != nil { + log.Fatalf("Failed to create the instrument: %v", err) + } for i := 0; i < 10; i++ { log.Printf("Doing really hard work (%d / 10)\n", i+1) @@ -170,7 +174,8 @@ func Example_withDifferentSignalCollectors() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - global.SetMeterProvider(pusher) + // TODO Bring back Global package + // global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { log.Fatalf("could not start metric controoler: %v", err) @@ -184,14 +189,15 @@ func Example_withDifferentSignalCollectors() { } }() - meter := global.Meter("test-meter") + // TODO Bring back Global package + // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example - counter := metric.Must(meter). - NewFloat64Counter( - "an_important_metric", - metric.WithDescription("Measures the cumulative epicness of the app"), - ) + counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) + if err != nil { + log.Fatalf("Failed to create the instrument: %v", err) + } for i := 0; i < 10; i++ { log.Printf("Doing really hard work (%d / 10)\n", i+1) diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go index 08595526263..7d31514fb5f 100644 --- a/exporters/prometheus/prometheus.go +++ b/exporters/prometheus/prometheus.go @@ -29,12 +29,12 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go index b05d9232117..587c8633e78 100644 --- a/exporters/prometheus/prometheus_test.go +++ b/exporters/prometheus/prometheus_test.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" @@ -107,9 +107,12 @@ func TestPrometheusExporter(t *testing.T) { require.NoError(t, err) meter := exporter.MeterProvider().Meter("test") - upDownCounter := metric.Must(meter).NewFloat64UpDownCounter("updowncounter") - counter := metric.Must(meter).NewFloat64Counter("counter") - histogram := metric.Must(meter).NewFloat64Histogram("histogram") + upDownCounter, err := meter.SyncFloat64().UpDownCounter("updowncounter") + require.NoError(t, err) + counter, err := meter.SyncFloat64().Counter("counter") + require.NoError(t, err) + histogram, err := meter.SyncFloat64().Histogram("histogram") + require.NoError(t, err) labels := []attribute.KeyValue{ attribute.Key("A").String("B"), @@ -124,9 +127,13 @@ func TestPrometheusExporter(t *testing.T) { expected = append(expected, expectCounter("counter", `counter{A="B",C="D",R="V"} 15.3`)) - _ = metric.Must(meter).NewInt64GaugeObserver("intgaugeobserver", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(1, labels...) + gaugeObserver, err := meter.AsyncInt64().Gauge("intgaugeobserver") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { + gaugeObserver.Observe(ctx, 1, labels...) }) + require.NoError(t, err) expected = append(expected, expectGauge("intgaugeobserver", `intgaugeobserver{A="B",C="D",R="V"} 1`)) @@ -148,15 +155,23 @@ func TestPrometheusExporter(t *testing.T) { expected = append(expected, expectGauge("updowncounter", `updowncounter{A="B",C="D",R="V"} 6.8`)) - _ = metric.Must(meter).NewFloat64CounterObserver("floatcounterobserver", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(7.7, labels...) + counterObserver, err := meter.AsyncFloat64().Counter("floatcounterobserver") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + counterObserver.Observe(ctx, 7.7, labels...) }) + require.NoError(t, err) expected = append(expected, expectCounter("floatcounterobserver", `floatcounterobserver{A="B",C="D",R="V"} 7.7`)) - _ = metric.Must(meter).NewFloat64UpDownCounterObserver("floatupdowncounterobserver", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(-7.7, labels...) + upDownCounterObserver, err := meter.AsyncFloat64().UpDownCounter("floatupdowncounterobserver") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{upDownCounterObserver}, func(ctx context.Context) { + upDownCounterObserver.Observe(ctx, -7.7, labels...) }) + require.NoError(t, err) expected = append(expected, expectGauge("floatupdowncounterobserver", `floatupdowncounterobserver{A="B",C="D",R="V"} -7.7`)) @@ -196,10 +211,8 @@ func TestPrometheusStatefulness(t *testing.T) { ctx := context.Background() - counter := metric.Must(meter).NewInt64Counter( - "a.counter", - metric.WithDescription("Counts things"), - ) + counter, err := meter.SyncInt64().Counter("a.counter", instrument.WithDescription("Counts things")) + require.NoError(t, err) counter.Add(ctx, 100, attribute.String("key", "value")) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index c367b767040..1250a463a8c 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument/syncint64" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/selector/simple" @@ -33,13 +33,15 @@ const ( ) var ( - meter = global.GetMeterProvider().Meter( - instrumentationName, - metric.WithInstrumentationVersion(instrumentationVersion), - ) + // TODO Bring back Global package + // meter = global.GetMeterProvider().Meter( + // instrumentationName, + // metric.WithInstrumentationVersion(instrumentationVersion), + // ) + meter metric.Meter - loopCounter = metric.Must(meter).NewInt64Counter("function.loops") - paramValue = metric.Must(meter).NewInt64Histogram("function.param") + loopCounter syncint64.Counter + paramValue syncint64.Histogram nameKey = attribute.Key("function.name") ) @@ -80,7 +82,18 @@ func InstallExportPipeline(ctx context.Context) func() { if err = pusher.Start(ctx); err != nil { log.Fatalf("starting push controller: %v", err) } - global.SetMeterProvider(pusher) + // TODO Bring back Global package + // global.SetMeterProvider(pusher) + meter = pusher.Meter(instrumentationName, metric.WithInstrumentationVersion(instrumentationVersion)) + + loopCounter, err = meter.SyncInt64().Counter("function.loops") + if err != nil { + log.Fatalf("creating instrument: %v", err) + } + paramValue, err = meter.SyncInt64().Histogram("function.param") + if err != nil { + log.Fatalf("creating instrument: %v", err) + } return func() { if err := pusher.Stop(ctx); err != nil { @@ -92,7 +105,7 @@ func InstallExportPipeline(ctx context.Context) func() { func Example() { ctx := context.Background() - // Registers a meter Provider globally. + // TODO: Registers a meter Provider globally. cleanup := InstallExportPipeline(ctx) defer cleanup() diff --git a/exporters/stdout/stdoutmetric/metric.go b/exporters/stdout/stdoutmetric/metric.go index 56e449de20d..c816c035b1c 100644 --- a/exporters/stdout/stdoutmetric/metric.go +++ b/exporters/stdout/stdoutmetric/metric.go @@ -22,10 +22,10 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/exporters/stdout/stdoutmetric/metric_test.go b/exporters/stdout/stdoutmetric/metric_test.go index e9153fcfd0a..33e2831dbd7 100644 --- a/exporters/stdout/stdoutmetric/metric_test.go +++ b/exporters/stdout/stdoutmetric/metric_test.go @@ -101,7 +101,8 @@ func TestStdoutTimestamp(t *testing.T) { require.NoError(t, cont.Start(ctx)) meter := cont.Meter("test") - counter := metric.Must(meter).NewInt64Counter("name.lastvalue") + counter, err := meter.SyncInt64().Counter("name.lastvalue") + require.NoError(t, err) before := time.Now() // Ensure the timestamp is after before. @@ -137,7 +138,8 @@ func TestStdoutTimestamp(t *testing.T) { func TestStdoutCounterFormat(t *testing.T) { fix := newFixture(t) - counter := metric.Must(fix.meter).NewInt64Counter("name.sum") + counter, err := fix.meter.SyncInt64().Counter("name.sum") + require.NoError(t, err) counter.Add(fix.ctx, 123, attribute.String("A", "B"), attribute.String("C", "D")) require.NoError(t, fix.cont.Stop(fix.ctx)) @@ -148,7 +150,8 @@ func TestStdoutCounterFormat(t *testing.T) { func TestStdoutLastValueFormat(t *testing.T) { fix := newFixture(t) - counter := metric.Must(fix.meter).NewFloat64Counter("name.lastvalue") + counter, err := fix.meter.SyncFloat64().Counter("name.lastvalue") + require.NoError(t, err) counter.Add(fix.ctx, 123.456, attribute.String("A", "B"), attribute.String("C", "D")) require.NoError(t, fix.cont.Stop(fix.ctx)) @@ -159,7 +162,8 @@ func TestStdoutLastValueFormat(t *testing.T) { func TestStdoutHistogramFormat(t *testing.T) { fix := newFixture(t, stdoutmetric.WithPrettyPrint()) - inst := metric.Must(fix.meter).NewFloat64Histogram("name.histogram") + inst, err := fix.meter.SyncFloat64().Histogram("name.histogram") + require.NoError(t, err) for i := 0; i < 1000; i++ { inst.Record(fix.ctx, float64(i)+0.5, attribute.String("A", "B"), attribute.String("C", "D")) @@ -181,7 +185,8 @@ func TestStdoutNoData(t *testing.T) { t.Parallel() fix := newFixture(t) - _ = metric.Must(fix.meter).NewFloat64Counter(fmt.Sprint("name.", aggName)) + _, err := fix.meter.SyncFloat64().Counter(fmt.Sprint("name.", aggName)) + require.NoError(t, err) require.NoError(t, fix.cont.Stop(fix.ctx)) require.Equal(t, "", fix.Output()) @@ -243,7 +248,8 @@ func TestStdoutResource(t *testing.T) { ctx := context.Background() fix := newFixtureWithResource(t, tc.res) - counter := metric.Must(fix.meter).NewFloat64Counter("name.lastvalue") + counter, err := fix.meter.SyncFloat64().Counter("name.lastvalue") + require.NoError(t, err) counter.Add(ctx, 123.456, tc.attrs...) require.NoError(t, fix.cont.Stop(fix.ctx)) diff --git a/internal/metric/async.go b/internal/metric/async.go deleted file mode 100644 index 94801b7ff3c..00000000000 --- a/internal/metric/async.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/internal/metric" - -import ( - "context" - "errors" - "fmt" - "sync" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -//nolint:revive // ignoring missing comments for exported error in an internal package -var ErrInvalidAsyncRunner = errors.New("unknown async runner type") - -// AsyncCollector is an interface used between the MeterImpl and the -// AsyncInstrumentState helper below. This interface is implemented by -// the SDK to provide support for running observer callbacks. -type AsyncCollector interface { - // CollectAsync passes a batch of observations to the MeterImpl. - CollectAsync(labels []attribute.KeyValue, observation ...sdkapi.Observation) -} - -// AsyncInstrumentState manages an ordered set of asynchronous -// instruments and the distinct runners, taking into account batch -// observer callbacks. -type AsyncInstrumentState struct { - lock sync.Mutex - - // errorOnce will use the otel.Handler to report an error - // once in case of an invalid runner attempting to run. - errorOnce sync.Once - - // runnerMap keeps the set of runners that will run each - // collection interval. Singletons are entered with a real - // instrument each, batch observers are entered with a nil - // instrument, ensuring that when a singleton callback is used - // repeatedly, it is executed repeatedly in the interval, while - // when a batch callback is used repeatedly, it only executes - // once per interval. - runnerMap map[asyncRunnerPair]struct{} - - // runners maintains the set of runners in the order they were - // registered. - runners []asyncRunnerPair - - // instruments maintains the set of instruments in the order - // they were registered. - instruments []sdkapi.AsyncImpl -} - -// asyncRunnerPair is a map entry for Observer callback runners. -type asyncRunnerPair struct { - // runner is used as a map key here. The API ensures - // that all callbacks are pointers for this reason. - runner sdkapi.AsyncRunner - - // inst refers to a non-nil instrument when `runner` is a - // AsyncSingleRunner. - inst sdkapi.AsyncImpl -} - -// NewAsyncInstrumentState returns a new *AsyncInstrumentState, for -// use by MeterImpl to manage running the set of observer callbacks in -// the correct order. -func NewAsyncInstrumentState() *AsyncInstrumentState { - return &AsyncInstrumentState{ - runnerMap: map[asyncRunnerPair]struct{}{}, - } -} - -// Instruments returns the asynchronous instruments managed by this -// object, the set that should be checkpointed after observers are -// run. -func (a *AsyncInstrumentState) Instruments() []sdkapi.AsyncImpl { - a.lock.Lock() - defer a.lock.Unlock() - return a.instruments -} - -// Register adds a new asynchronous instrument to by managed by this -// object. This should be called during NewAsyncInstrument() and -// assumes that errors (e.g., duplicate registration) have already -// been checked. -func (a *AsyncInstrumentState) Register(inst sdkapi.AsyncImpl, runner sdkapi.AsyncRunner) { - a.lock.Lock() - defer a.lock.Unlock() - - a.instruments = append(a.instruments, inst) - - // asyncRunnerPair reflects this callback in the asyncRunners - // list. If this is a batch runner, the instrument is nil. - // If this is a single-Observer runner, the instrument is - // included. This ensures that batch callbacks are called - // once and single callbacks are called once per instrument. - rp := asyncRunnerPair{ - runner: runner, - } - if _, ok := runner.(sdkapi.AsyncSingleRunner); ok { - rp.inst = inst - } - - if _, ok := a.runnerMap[rp]; !ok { - a.runnerMap[rp] = struct{}{} - a.runners = append(a.runners, rp) - } -} - -// Run executes the complete set of observer callbacks. -func (a *AsyncInstrumentState) Run(ctx context.Context, collector AsyncCollector) { - a.lock.Lock() - runners := a.runners - a.lock.Unlock() - - for _, rp := range runners { - // The runner must be a single or batch runner, no - // other implementations are possible because the - // interface has un-exported methods. - - if singleRunner, ok := rp.runner.(sdkapi.AsyncSingleRunner); ok { - singleRunner.Run(ctx, rp.inst, collector.CollectAsync) - continue - } - - if multiRunner, ok := rp.runner.(sdkapi.AsyncBatchRunner); ok { - multiRunner.Run(ctx, collector.CollectAsync) - continue - } - - a.errorOnce.Do(func() { - otel.Handle(fmt.Errorf("%w: type %T (reported once)", ErrInvalidAsyncRunner, rp)) - }) - } -} diff --git a/internal/metric/global/benchmark_test.go b/internal/metric/global/benchmark_test.go deleted file mode 100644 index 05cab62d2dc..00000000000 --- a/internal/metric/global/benchmark_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global_test - -import ( - "context" - "testing" - - "go.opentelemetry.io/otel/attribute" - internalglobal "go.opentelemetry.io/otel/internal/metric/global" - metricglobal "go.opentelemetry.io/otel/metric/global" -) - -func BenchmarkGlobalInt64CounterAddNoSDK(b *testing.B) { - // Compare with BenchmarkGlobalInt64CounterAddWithSDK() in - // ../../sdk/metric/benchmark_test.go to see the overhead of the - // global no-op system against a registered SDK. - internalglobal.ResetForTest() - ctx := context.Background() - sdk := metricglobal.Meter("test") - labs := []attribute.KeyValue{attribute.String("A", "B")} - cnt := Must(sdk).NewInt64Counter("int64.counter") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} diff --git a/internal/metric/global/internal_test.go b/internal/metric/global/internal_test.go deleted file mode 100644 index 44e1904aefe..00000000000 --- a/internal/metric/global/internal_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global_test - -import ( - "os" - "testing" - - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/internal/metric/global" -) - -// Ensure struct alignment prior to running tests. -func TestMain(m *testing.M) { - fieldsMap := global.AtomicFieldOffsets() - fields := make([]ottest.FieldOffset, 0, len(fieldsMap)) - for name, offset := range fieldsMap { - fields = append(fields, ottest.FieldOffset{ - Name: name, - Offset: offset, - }) - } - if !ottest.Aligned8Byte(fields, os.Stderr) { - os.Exit(1) - } - - os.Exit(m.Run()) -} diff --git a/internal/metric/global/meter.go b/internal/metric/global/meter.go deleted file mode 100644 index 77781ead118..00000000000 --- a/internal/metric/global/meter.go +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/internal/metric/global" - -import ( - "context" - "sync" - "sync/atomic" - "unsafe" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/internal/metric/registry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -// This file contains the forwarding implementation of MeterProvider used as -// the default global instance. Metric events using instruments provided by -// this implementation are no-ops until the first Meter implementation is set -// as the global provider. -// -// The implementation here uses Mutexes to maintain a list of active Meters in -// the MeterProvider and Instruments in each Meter, under the assumption that -// these interfaces are not performance-critical. -// -// We have the invariant that setDelegate() will be called before a new -// MeterProvider implementation is registered as the global provider. Mutexes -// in the MeterProvider and Meters ensure that each instrument has a delegate -// before the global provider is set. -// -// Metric uniqueness checking is implemented by calling the exported -// methods of the api/metric/registry package. - -type meterKey struct { - InstrumentationName string - InstrumentationVersion string - SchemaURL string -} - -type meterProvider struct { - delegate metric.MeterProvider - - // lock protects `delegate` and `meters`. - lock sync.Mutex - - // meters maintains a unique entry for every named Meter - // that has been registered through the global instance. - meters map[meterKey]*meterEntry -} - -type meterImpl struct { - delegate unsafe.Pointer // (*metric.MeterImpl) - - lock sync.Mutex - syncInsts []*syncImpl - asyncInsts []*asyncImpl -} - -type meterEntry struct { - unique sdkapi.MeterImpl - impl meterImpl -} - -type instrument struct { - descriptor sdkapi.Descriptor -} - -type syncImpl struct { - delegate unsafe.Pointer // (*sdkapi.SyncImpl) - - instrument -} - -type asyncImpl struct { - delegate unsafe.Pointer // (*sdkapi.AsyncImpl) - - instrument - - runner sdkapi.AsyncRunner -} - -var _ metric.MeterProvider = &meterProvider{} -var _ sdkapi.MeterImpl = &meterImpl{} -var _ sdkapi.InstrumentImpl = &syncImpl{} -var _ sdkapi.AsyncImpl = &asyncImpl{} - -func (inst *instrument) Descriptor() sdkapi.Descriptor { - return inst.descriptor -} - -// MeterProvider interface and delegation - -func newMeterProvider() *meterProvider { - return &meterProvider{ - meters: map[meterKey]*meterEntry{}, - } -} - -func (p *meterProvider) setDelegate(provider metric.MeterProvider) { - p.lock.Lock() - defer p.lock.Unlock() - - p.delegate = provider - for key, entry := range p.meters { - entry.impl.setDelegate(key, provider) - } - p.meters = nil -} - -func (p *meterProvider) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - p.lock.Lock() - defer p.lock.Unlock() - - if p.delegate != nil { - return p.delegate.Meter(instrumentationName, opts...) - } - - cfg := metric.NewMeterConfig(opts...) - key := meterKey{ - InstrumentationName: instrumentationName, - InstrumentationVersion: cfg.InstrumentationVersion(), - SchemaURL: cfg.SchemaURL(), - } - entry, ok := p.meters[key] - if !ok { - entry = &meterEntry{} - // Note: This code implements its own MeterProvider - // name-uniqueness logic because there is - // synchronization required at the moment of - // delegation. We use the same instrument-uniqueness - // checking the real SDK uses here: - entry.unique = registry.NewUniqueInstrumentMeterImpl(&entry.impl) - p.meters[key] = entry - } - return metric.WrapMeterImpl(entry.unique) -} - -// Meter interface and delegation - -func (m *meterImpl) setDelegate(key meterKey, provider metric.MeterProvider) { - m.lock.Lock() - defer m.lock.Unlock() - - d := new(sdkapi.MeterImpl) - *d = provider.Meter( - key.InstrumentationName, - metric.WithInstrumentationVersion(key.InstrumentationVersion), - metric.WithSchemaURL(key.SchemaURL), - ).MeterImpl() - m.delegate = unsafe.Pointer(d) - - for _, inst := range m.syncInsts { - inst.setDelegate(*d) - } - m.syncInsts = nil - for _, obs := range m.asyncInsts { - obs.setDelegate(*d) - } - m.asyncInsts = nil -} - -func (m *meterImpl) NewSyncInstrument(desc sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - m.lock.Lock() - defer m.lock.Unlock() - - if meterPtr := (*sdkapi.MeterImpl)(atomic.LoadPointer(&m.delegate)); meterPtr != nil { - return (*meterPtr).NewSyncInstrument(desc) - } - - inst := &syncImpl{ - instrument: instrument{ - descriptor: desc, - }, - } - m.syncInsts = append(m.syncInsts, inst) - return inst, nil -} - -// Synchronous delegation - -func (inst *syncImpl) setDelegate(d sdkapi.MeterImpl) { - implPtr := new(sdkapi.SyncImpl) - - var err error - *implPtr, err = d.NewSyncInstrument(inst.descriptor) - - if err != nil { - // TODO: There is no standard way to deliver this error to the user. - // See https://github.com/open-telemetry/opentelemetry-go/issues/514 - // Note that the default SDK will not generate any errors yet, this is - // only for added safety. - panic(err) - } - - atomic.StorePointer(&inst.delegate, unsafe.Pointer(implPtr)) -} - -func (inst *syncImpl) Implementation() interface{} { - if implPtr := (*sdkapi.SyncImpl)(atomic.LoadPointer(&inst.delegate)); implPtr != nil { - return (*implPtr).Implementation() - } - return inst -} - -// Async delegation - -func (m *meterImpl) NewAsyncInstrument( - desc sdkapi.Descriptor, - runner sdkapi.AsyncRunner, -) (sdkapi.AsyncImpl, error) { - - m.lock.Lock() - defer m.lock.Unlock() - - if meterPtr := (*sdkapi.MeterImpl)(atomic.LoadPointer(&m.delegate)); meterPtr != nil { - return (*meterPtr).NewAsyncInstrument(desc, runner) - } - - inst := &asyncImpl{ - instrument: instrument{ - descriptor: desc, - }, - runner: runner, - } - m.asyncInsts = append(m.asyncInsts, inst) - return inst, nil -} - -func (obs *asyncImpl) Implementation() interface{} { - if implPtr := (*sdkapi.AsyncImpl)(atomic.LoadPointer(&obs.delegate)); implPtr != nil { - return (*implPtr).Implementation() - } - return obs -} - -func (obs *asyncImpl) setDelegate(d sdkapi.MeterImpl) { - implPtr := new(sdkapi.AsyncImpl) - - var err error - *implPtr, err = d.NewAsyncInstrument(obs.descriptor, obs.runner) - - if err != nil { - // TODO: There is no standard way to deliver this error to the user. - // See https://github.com/open-telemetry/opentelemetry-go/issues/514 - // Note that the default SDK will not generate any errors yet, this is - // only for added safety. - panic(err) - } - - atomic.StorePointer(&obs.delegate, unsafe.Pointer(implPtr)) -} - -// Metric updates - -func (m *meterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurements ...sdkapi.Measurement) { - if delegatePtr := (*sdkapi.MeterImpl)(atomic.LoadPointer(&m.delegate)); delegatePtr != nil { - (*delegatePtr).RecordBatch(ctx, labels, measurements...) - } -} - -func (inst *syncImpl) RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) { - if instPtr := (*sdkapi.SyncImpl)(atomic.LoadPointer(&inst.delegate)); instPtr != nil { - (*instPtr).RecordOne(ctx, number, labels) - } -} - -func AtomicFieldOffsets() map[string]uintptr { - return map[string]uintptr{ - "meterProvider.delegate": unsafe.Offsetof(meterProvider{}.delegate), - "meterImpl.delegate": unsafe.Offsetof(meterImpl{}.delegate), - "syncImpl.delegate": unsafe.Offsetof(syncImpl{}.delegate), - "asyncImpl.delegate": unsafe.Offsetof(asyncImpl{}.delegate), - } -} diff --git a/internal/metric/global/meter_test.go b/internal/metric/global/meter_test.go deleted file mode 100644 index 2062ecf8b07..00000000000 --- a/internal/metric/global/meter_test.go +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global_test - -import ( - "context" - "errors" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/internal/metric/global" - "go.opentelemetry.io/otel/metric" - metricglobal "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -var Must = metric.Must - -var asInt = number.NewInt64Number -var asFloat = number.NewFloat64Number - -func TestDirect(t *testing.T) { - global.ResetForTest() - - ctx := context.Background() - meter1 := metricglobal.Meter("test1", metric.WithInstrumentationVersion("semver:v1.0.0")) - meter2 := metricglobal.Meter("test2", metric.WithSchemaURL("hello")) - - library1 := metrictest.Library{ - InstrumentationName: "test1", - InstrumentationVersion: "semver:v1.0.0", - } - library2 := metrictest.Library{ - InstrumentationName: "test2", - SchemaURL: "hello", - } - - labels1 := []attribute.KeyValue{attribute.String("A", "B")} - labels2 := []attribute.KeyValue{attribute.String("C", "D")} - labels3 := []attribute.KeyValue{attribute.String("E", "F")} - - counter := Must(meter1).NewInt64Counter("test.counter") - counter.Add(ctx, 1, labels1...) - counter.Add(ctx, 1, labels1...) - - histogram := Must(meter1).NewFloat64Histogram("test.histogram") - histogram.Record(ctx, 1, labels1...) - histogram.Record(ctx, 2, labels1...) - - _ = Must(meter1).NewFloat64GaugeObserver("test.gauge.float", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(1., labels1...) - result.Observe(2., labels2...) - }) - - _ = Must(meter1).NewInt64GaugeObserver("test.gauge.int", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(1, labels1...) - result.Observe(2, labels2...) - }) - - second := Must(meter2).NewFloat64Histogram("test.second") - second.Record(ctx, 1, labels3...) - second.Record(ctx, 2, labels3...) - - provider := metrictest.NewMeterProvider() - metricglobal.SetMeterProvider(provider) - - counter.Add(ctx, 1, labels1...) - histogram.Record(ctx, 3, labels1...) - second.Record(ctx, 3, labels3...) - - provider.RunAsyncInstruments() - - measurements := metrictest.AsStructs(provider.MeasurementBatches) - - require.EqualValues(t, - []metrictest.Measured{ - { - Name: "test.counter", - Library: library1, - Labels: metrictest.LabelsToMap(labels1...), - Number: asInt(1), - }, - { - Name: "test.histogram", - Library: library1, - Labels: metrictest.LabelsToMap(labels1...), - Number: asFloat(3), - }, - { - Name: "test.second", - Library: library2, - Labels: metrictest.LabelsToMap(labels3...), - Number: asFloat(3), - }, - { - Name: "test.gauge.float", - Library: library1, - Labels: metrictest.LabelsToMap(labels1...), - Number: asFloat(1), - }, - { - Name: "test.gauge.float", - Library: library1, - Labels: metrictest.LabelsToMap(labels2...), - Number: asFloat(2), - }, - { - Name: "test.gauge.int", - Library: library1, - Labels: metrictest.LabelsToMap(labels1...), - Number: asInt(1), - }, - { - Name: "test.gauge.int", - Library: library1, - Labels: metrictest.LabelsToMap(labels2...), - Number: asInt(2), - }, - }, - measurements, - ) -} - -type meterProviderWithConstructorError struct { - metric.MeterProvider -} - -type meterWithConstructorError struct { - sdkapi.MeterImpl -} - -func (m *meterProviderWithConstructorError) Meter(iName string, opts ...metric.MeterOption) metric.Meter { - return metric.WrapMeterImpl(&meterWithConstructorError{m.MeterProvider.Meter(iName, opts...).MeterImpl()}) -} - -func (m *meterWithConstructorError) NewSyncInstrument(_ sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - return sdkapi.NewNoopSyncInstrument(), errors.New("constructor error") -} - -func TestErrorInDeferredConstructor(t *testing.T) { - global.ResetForTest() - - ctx := context.Background() - meter := metricglobal.GetMeterProvider().Meter("builtin") - - c1 := Must(meter).NewInt64Counter("test") - c2 := Must(meter).NewInt64Counter("test") - - provider := metrictest.NewMeterProvider() - sdk := &meterProviderWithConstructorError{provider} - - require.Panics(t, func() { - metricglobal.SetMeterProvider(sdk) - }) - - c1.Add(ctx, 1) - c2.Add(ctx, 2) -} - -func TestImplementationIndirection(t *testing.T) { - global.ResetForTest() - - // Test that Implementation() does the proper indirection, i.e., - // returns the implementation interface not the global, after - // registered. - - meter1 := metricglobal.Meter("test1") - - // Sync: no SDK yet - counter := Must(meter1).NewInt64Counter("interface.counter") - - ival := counter.Measurement(1).SyncImpl().Implementation() - require.NotNil(t, ival) - - _, ok := ival.(*metrictest.Sync) - require.False(t, ok) - - // Async: no SDK yet - gauge := Must(meter1).NewFloat64GaugeObserver( - "interface.gauge", - func(_ context.Context, result metric.Float64ObserverResult) {}, - ) - - ival = gauge.AsyncImpl().Implementation() - require.NotNil(t, ival) - - _, ok = ival.(*metrictest.Async) - require.False(t, ok) - - // Register the SDK - provider := metrictest.NewMeterProvider() - metricglobal.SetMeterProvider(provider) - - // Repeat the above tests - - // Sync - ival = counter.Measurement(1).SyncImpl().Implementation() - require.NotNil(t, ival) - - _, ok = ival.(*metrictest.Sync) - require.True(t, ok) - - // Async - ival = gauge.AsyncImpl().Implementation() - require.NotNil(t, ival) - - _, ok = ival.(*metrictest.Async) - require.True(t, ok) -} - -func TestRecordBatchMock(t *testing.T) { - global.ResetForTest() - - meter := metricglobal.GetMeterProvider().Meter("builtin") - - counter := Must(meter).NewInt64Counter("test.counter") - - meter.RecordBatch(context.Background(), nil, counter.Measurement(1)) - - provider := metrictest.NewMeterProvider() - metricglobal.SetMeterProvider(provider) - - meter.RecordBatch(context.Background(), nil, counter.Measurement(1)) - - require.EqualValues(t, - []metrictest.Measured{ - { - Name: "test.counter", - Library: metrictest.Library{ - InstrumentationName: "builtin", - }, - Labels: metrictest.LabelsToMap(), - Number: asInt(1), - }, - }, - metrictest.AsStructs(provider.MeasurementBatches)) -} diff --git a/internal/metric/global/metric.go b/internal/metric/global/metric.go deleted file mode 100644 index 896c6dd1c30..00000000000 --- a/internal/metric/global/metric.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/internal/metric/global" - -import ( - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/metric" -) - -type meterProviderHolder struct { - mp metric.MeterProvider -} - -var ( - globalMeter = defaultMeterValue() - - delegateMeterOnce sync.Once -) - -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeter.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - delegateMeterOnce.Do(func() { - current := MeterProvider() - - if current == mp { - // Setting the provider to the prior default is nonsense, panic. - // Panic is acceptable because we are likely still early in the - // process lifetime. - panic("invalid MeterProvider, the global instance cannot be reinstalled") - } else if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeter.Store(meterProviderHolder{mp: mp}) -} - -func defaultMeterValue() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: newMeterProvider()}) - return v -} - -// ResetForTest restores the initial global state, for testing purposes. -func ResetForTest() { - globalMeter = defaultMeterValue() - delegateMeterOnce = sync.Once{} -} diff --git a/internal/metric/global/registry_test.go b/internal/metric/global/registry_test.go deleted file mode 100644 index 0d92c044ef1..00000000000 --- a/internal/metric/global/registry_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global - -import ( - "context" - "errors" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/internal/metric/registry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -type ( - newFunc func(name, libraryName string) (sdkapi.InstrumentImpl, error) -) - -var ( - allNew = map[string]newFunc{ - "counter.int64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewInt64Counter(name)) - }, - "counter.float64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewFloat64Counter(name)) - }, - "histogram.int64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewInt64Histogram(name)) - }, - "histogram.float64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewFloat64Histogram(name)) - }, - "gauge.int64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewInt64GaugeObserver(name, func(context.Context, metric.Int64ObserverResult) {})) - }, - "gauge.float64": func(name, libraryName string) (sdkapi.InstrumentImpl, error) { - return unwrap(MeterProvider().Meter(libraryName).NewFloat64GaugeObserver(name, func(context.Context, metric.Float64ObserverResult) {})) - }, - } -) - -func unwrap(impl interface{}, err error) (sdkapi.InstrumentImpl, error) { - if impl == nil { - return nil, err - } - if s, ok := impl.(interface { - SyncImpl() sdkapi.SyncImpl - }); ok { - return s.SyncImpl(), err - } - if a, ok := impl.(interface { - AsyncImpl() sdkapi.AsyncImpl - }); ok { - return a.AsyncImpl(), err - } - return nil, err -} - -func TestRegistrySameInstruments(t *testing.T) { - for _, nf := range allNew { - ResetForTest() - inst1, err1 := nf("this", "meter") - inst2, err2 := nf("this", "meter") - - require.NoError(t, err1) - require.NoError(t, err2) - require.Equal(t, inst1, inst2) - - SetMeterProvider(metrictest.NewMeterProvider()) - - require.Equal(t, inst1, inst2) - } -} - -func TestRegistryDifferentNamespace(t *testing.T) { - for _, nf := range allNew { - ResetForTest() - inst1, err1 := nf("this", "meter1") - inst2, err2 := nf("this", "meter2") - - require.NoError(t, err1) - require.NoError(t, err2) - - if inst1.Descriptor().InstrumentKind().Synchronous() { - // They're equal because of a `nil` pointer at this point. - // (Only for synchronous instruments, which lack callacks.) - require.EqualValues(t, inst1, inst2) - } - - SetMeterProvider(metrictest.NewMeterProvider()) - - // They're different after the deferred setup. - require.NotEqual(t, inst1, inst2) - } -} - -func TestRegistryDiffInstruments(t *testing.T) { - for origName, origf := range allNew { - ResetForTest() - - _, err := origf("this", "super") - require.NoError(t, err) - - for newName, nf := range allNew { - if newName == origName { - continue - } - - other, err := nf("this", "super") - require.Error(t, err) - require.NotNil(t, other) - require.True(t, errors.Is(err, registry.ErrMetricKindMismatch)) - require.Contains(t, err.Error(), "by this name with another kind or number type") - } - } -} diff --git a/internal/metric/global/state_test.go b/internal/metric/global/state_test.go deleted file mode 100644 index 526eac7fa69..00000000000 --- a/internal/metric/global/state_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global_test - -import ( - "testing" - - internalglobal "go.opentelemetry.io/otel/internal/metric/global" - metricglobal "go.opentelemetry.io/otel/metric/global" -) - -func TestResetsOfGlobalsPanic(t *testing.T) { - internalglobal.ResetForTest() - tests := map[string]func(){ - "SetMeterProvider": func() { - metricglobal.SetMeterProvider(metricglobal.GetMeterProvider()) - }, - } - - for name, test := range tests { - shouldPanic(t, name, test) - } -} - -func shouldPanic(t *testing.T, name string, f func()) { - defer func() { - if r := recover(); r == nil { - t.Errorf("calling %s with default global did not panic", name) - } - }() - - f() -} diff --git a/internal/metric/go.mod b/internal/metric/go.mod deleted file mode 100644 index 7e92e2dcb10..00000000000 --- a/internal/metric/go.mod +++ /dev/null @@ -1,73 +0,0 @@ -module go.opentelemetry.io/otel/internal/metric - -go 1.16 - -require ( - github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/metric v0.27.0 -) - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/internal/metric => ./ - -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../tools - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/internal/metric/go.sum b/internal/metric/go.sum deleted file mode 100644 index 4f1776cd92b..00000000000 --- a/internal/metric/go.sum +++ /dev/null @@ -1,18 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/metric/config.go b/metric/config.go index 3f722344fa7..621e4c5fcb8 100644 --- a/metric/config.go +++ b/metric/config.go @@ -14,65 +14,6 @@ package metric // import "go.opentelemetry.io/otel/metric" -import ( - "go.opentelemetry.io/otel/metric/unit" -) - -// InstrumentConfig contains options for metric instrument descriptors. -type InstrumentConfig struct { - description string - unit unit.Unit -} - -// Description describes the instrument in human-readable terms. -func (cfg *InstrumentConfig) Description() string { - return cfg.description -} - -// Unit describes the measurement unit for a instrument. -func (cfg *InstrumentConfig) Unit() unit.Unit { - return cfg.unit -} - -// InstrumentOption is an interface for applying metric instrument options. -type InstrumentOption interface { - // ApplyMeter is used to set a InstrumentOption value of a - // InstrumentConfig. - applyInstrument(InstrumentConfig) InstrumentConfig -} - -// NewInstrumentConfig creates a new InstrumentConfig -// and applies all the given options. -func NewInstrumentConfig(opts ...InstrumentOption) InstrumentConfig { - var config InstrumentConfig - for _, o := range opts { - config = o.applyInstrument(config) - } - return config -} - -type instrumentOptionFunc func(InstrumentConfig) InstrumentConfig - -func (fn instrumentOptionFunc) applyInstrument(cfg InstrumentConfig) InstrumentConfig { - return fn(cfg) -} - -// WithDescription applies provided description. -func WithDescription(desc string) InstrumentOption { - return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig { - cfg.description = desc - return cfg - }) -} - -// WithUnit applies provided unit. -func WithUnit(unit unit.Unit) InstrumentOption { - return instrumentOptionFunc(func(cfg InstrumentConfig) InstrumentConfig { - cfg.unit = unit - return cfg - }) -} - // MeterConfig contains options for Meters. type MeterConfig struct { instrumentationVersion string @@ -80,18 +21,18 @@ type MeterConfig struct { } // InstrumentationVersion is the version of the library providing instrumentation. -func (cfg *MeterConfig) InstrumentationVersion() string { +func (cfg MeterConfig) InstrumentationVersion() string { return cfg.instrumentationVersion } // SchemaURL is the schema_url of the library providing instrumentation. -func (cfg *MeterConfig) SchemaURL() string { +func (cfg MeterConfig) SchemaURL() string { return cfg.schemaURL } // MeterOption is an interface for applying Meter options. type MeterOption interface { - // ApplyMeter is used to set a MeterOption value of a MeterConfig. + // applyMeter is used to set a MeterOption value of a MeterConfig. applyMeter(MeterConfig) MeterConfig } diff --git a/metric/doc.go b/metric/doc.go index 4baf0719fcc..bd6f4343720 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -19,49 +19,5 @@ OpenTelemetry API. This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback. - -Measurements can be made about an operation being performed or the state of a -system in general. These measurements can be crucial to the reliable operation -of code and provide valuable insights about the inner workings of a system. - -Measurements are made using instruments provided by this package. The type of -instrument used will depend on the type of measurement being made and of what -part of a system is being measured. - -Instruments are categorized as Synchronous or Asynchronous and independently -as Adding or Grouping. Synchronous instruments are called by the user with a -Context. Asynchronous instruments are called by the SDK during collection. -Adding instruments are semantically intended for capturing a sum. Grouping -instruments are intended for capturing a distribution. - -Adding instruments may be monotonic, in which case they are non-decreasing -and naturally define a rate. - -The synchronous instrument names are: - - Counter: adding, monotonic - UpDownCounter: adding - Histogram: grouping - -and the asynchronous instruments are: - - CounterObserver: adding, monotonic - UpDownCounterObserver: adding - GaugeObserver: grouping - -All instruments are provided with support for either float64 or int64 input -values. - -An instrument is created using a Meter. Additionally, a Meter is used to -record batches of synchronous measurements or asynchronous observations. A -Meter is obtained using a MeterProvider. A Meter, like a Tracer, is unique to -the instrumentation it instruments and must be named and versioned when -created with a MeterProvider with the name and version of the instrumentation -library. - -Instrumentation should be designed to accept a MeterProvider from which it can -create its own unique Meter. Alternatively, the registered global -MeterProvider from the go.opentelemetry.io/otel package can be used as a -default. */ package metric // import "go.opentelemetry.io/otel/metric" diff --git a/metric/example_test.go b/metric/example_test.go new file mode 100644 index 00000000000..92e0e2cd958 --- /dev/null +++ b/metric/example_test.go @@ -0,0 +1,116 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric_test + +import ( + "context" + "fmt" + "runtime" + "time" + + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/nonrecording" + "go.opentelemetry.io/otel/metric/unit" +) + +//nolint:govet // Meter doesn't register for go vet +func ExampleMeter_synchronous() { + // In a library or program this would be provided by otel.GetMeterProvider(). + meterProvider := nonrecording.NewNoopMeterProvider() + + workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").SyncInt64().Histogram( + "workDuration", + instrument.WithUnit(unit.Milliseconds)) + if err != nil { + fmt.Println("Failed to register instrument") + panic(err) + } + + startTime := time.Now() + ctx := context.Background() + // Do work + // ... + workDuration.Record(ctx, time.Since(startTime).Milliseconds()) + +} + +//nolint:govet // Meter doesn't register for go vet +func ExampleMeter_asynchronous_single() { + // In a library or program this would be provided by otel.GetMeterProvider(). + meterProvider := nonrecording.NewNoopMeterProvider() + meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") + + memoryUsage, err := meter.AsyncInt64().Gauge( + "MemoryUsage", + instrument.WithUnit(unit.Bytes), + ) + if err != nil { + fmt.Println("Failed to register instrument") + panic(err) + } + + err = meter.RegisterCallback([]instrument.Asynchronous{memoryUsage}, + func(ctx context.Context) { + // instrument.WithCallbackFunc(func(ctx context.Context) { + //Do Work to get the real memoryUsage + // mem := GatherMemory(ctx) + mem := 75000 + + memoryUsage.Observe(ctx, int64(mem)) + }) + if err != nil { + fmt.Println("Failed to register callback") + panic(err) + } +} + +//nolint:govet // Meter doesn't register for go vet +func ExampleMeter_asynchronous_multiple() { + meterProvider := nonrecording.NewNoopMeterProvider() + meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") + + // This is just a sample of memory stats to record from the Memstats + heapAlloc, _ := meter.AsyncInt64().UpDownCounter("heapAllocs") + gcCount, _ := meter.AsyncInt64().Counter("gcCount") + gcPause, _ := meter.SyncFloat64().Histogram("gcPause") + + err := meter.RegisterCallback([]instrument.Asynchronous{ + heapAlloc, + gcCount, + }, + func(ctx context.Context) { + memStats := &runtime.MemStats{} + // This call does work + runtime.ReadMemStats(memStats) + + heapAlloc.Observe(ctx, int64(memStats.HeapAlloc)) + gcCount.Observe(ctx, int64(memStats.NumGC)) + + // This function synchronously records the pauses + computeGCPauses(ctx, gcPause, memStats.PauseNs[:]) + }, + ) + + if err != nil { + fmt.Println("Failed to register callback") + panic(err) + } +} + +//This is just an example, see the the contrib runtime instrumentation for real implementation +func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) { + +} diff --git a/metric/global/metric.go b/metric/global/metric.go deleted file mode 100644 index 14ba862002a..00000000000 --- a/metric/global/metric.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/global" - -import ( - "go.opentelemetry.io/otel/internal/metric/global" - "go.opentelemetry.io/otel/metric" -) - -// Meter creates an implementation of the Meter interface from the global -// MeterProvider. The instrumentationName must be the name of the library -// providing instrumentation. This name may be the same as the instrumented -// code only if that code provides built-in instrumentation. If the -// instrumentationName is empty, then a implementation defined default name -// will be used instead. -// -// This is short for MeterProvider().Meter(name) -func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - return GetMeterProvider().Meter(instrumentationName, opts...) -} - -// GetMeterProvider returns the registered global meter provider. If -// none is registered then a default meter provider is returned that -// forwards the Meter interface to the first registered Meter. -// -// Use the meter provider to create a named meter. E.g. -// meter := global.MeterProvider().Meter("example.com/foo") -// or -// meter := global.Meter("example.com/foo") -func GetMeterProvider() metric.MeterProvider { - return global.MeterProvider() -} - -// SetMeterProvider registers `mp` as the global meter provider. -func SetMeterProvider(mp metric.MeterProvider) { - global.SetMeterProvider(mp) -} diff --git a/metric/global/metric_test.go b/metric/global/metric_test.go deleted file mode 100644 index dc4d9370a92..00000000000 --- a/metric/global/metric_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global - -import ( - "testing" - - "go.opentelemetry.io/otel/metric" -) - -type testMeterProvider struct{} - -var _ metric.MeterProvider = &testMeterProvider{} - -func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter { - return metric.Meter{} -} - -func TestMultipleGlobalMeterProvider(t *testing.T) { - p1 := testMeterProvider{} - p2 := metric.NewNoopMeterProvider() - SetMeterProvider(&p1) - SetMeterProvider(p2) - - got := GetMeterProvider() - want := p2 - if got != want { - t.Fatalf("MeterProvider: got %p, want %p\n", got, want) - } -} diff --git a/metric/go.mod b/metric/go.mod index 17780384f4c..7d510be1f32 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -2,6 +2,8 @@ module go.opentelemetry.io/otel/metric go 1.16 +require go.opentelemetry.io/otel v1.4.1 + replace go.opentelemetry.io/otel => ../ replace go.opentelemetry.io/otel/bridge/opencensus => ../bridge/opencensus @@ -38,13 +40,6 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric replace go.opentelemetry.io/otel/trace => ../trace -require ( - github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/internal/metric v0.27.0 -) - replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../exporters/otlp/otlptrace @@ -53,8 +48,6 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../ex replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../exporters/otlp/otlptrace/otlptracehttp -replace go.opentelemetry.io/otel/internal/metric => ../internal/metric - replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../exporters/otlp/otlpmetric replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../exporters/otlp/otlpmetric/otlpmetricgrpc diff --git a/metric/go.sum b/metric/go.sum index 531cae722ed..5457c7626c5 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,8 +1,6 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= @@ -11,9 +9,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go new file mode 100644 index 00000000000..91c034fb2a0 --- /dev/null +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -0,0 +1,70 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" +) + +// InstrumentProvider provides access to individual instruments. +type InstrumentProvider interface { + // Counter creates an instrument for recording increasing values. + Counter(name string, opts ...instrument.Option) (Counter, error) + + // UpDownCounter creates an instrument for recording changes of a value. + UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) + + // Gauge creates an instrument for recording the current value. + Gauge(name string, opts ...instrument.Option) (Gauge, error) +} + +// Counter is an instrument that records increasing values. +type Counter interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} + +// UpDownCounter is an instrument that records increasing or decresing values. +type UpDownCounter interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} + +// Gauge is an instrument that records independent readings. +type Gauge interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go new file mode 100644 index 00000000000..9dfba553d78 --- /dev/null +++ b/metric/instrument/asyncint64/asyncint64.go @@ -0,0 +1,70 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" +) + +// InstrumentProvider provides access to individual instruments. +type InstrumentProvider interface { + // Counter creates an instrument for recording increasing values. + Counter(name string, opts ...instrument.Option) (Counter, error) + + // UpDownCounter creates an instrument for recording changes of a value. + UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) + + // Gauge creates an instrument for recording the current value. + Gauge(name string, opts ...instrument.Option) (Gauge, error) +} + +// Counter is an instrument that records increasing values. +type Counter interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} + +// UpDownCounter is an instrument that records increasing or decresing values. +type UpDownCounter interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} + +// Gauge is an instrument that records independent readings. +type Gauge interface { + // Observe records the state of the instrument. + // + // It is only valid to call this within a callback. If called outside of the + // registered callback it should have no effect on the instrument, and an + // error will be reported via the error handler. + Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) + + instrument.Asynchronous +} diff --git a/metric/instrument/config.go b/metric/instrument/config.go new file mode 100644 index 00000000000..d6ea25a8da2 --- /dev/null +++ b/metric/instrument/config.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import "go.opentelemetry.io/otel/metric/unit" + +// Config contains options for metric instrument descriptors. +type Config struct { + description string + unit unit.Unit +} + +// Description describes the instrument in human-readable terms. +func (cfg Config) Description() string { + return cfg.description +} + +// Unit describes the measurement unit for a instrument. +func (cfg Config) Unit() unit.Unit { + return cfg.unit +} + +// Option is an interface for applying metric instrument options. +type Option interface { + applyInstrument(Config) Config +} + +// NewConfig creates a new Config and applies all the given options. +func NewConfig(opts ...Option) Config { + var config Config + for _, o := range opts { + config = o.applyInstrument(config) + } + return config +} + +type optionFunc func(Config) Config + +func (fn optionFunc) applyInstrument(cfg Config) Config { + return fn(cfg) +} + +// WithDescription applies provided description. +func WithDescription(desc string) Option { + return optionFunc(func(cfg Config) Config { + cfg.description = desc + return cfg + }) +} + +// WithUnit applies provided unit. +func WithUnit(unit unit.Unit) Option { + return optionFunc(func(cfg Config) Config { + cfg.unit = unit + return cfg + }) +} diff --git a/metric/noop_test.go b/metric/instrument/instrument.go similarity index 54% rename from metric/noop_test.go rename to metric/instrument/instrument.go index e5a7528a217..e1bbb850d76 100644 --- a/metric/noop_test.go +++ b/metric/instrument/instrument.go @@ -12,23 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric +package instrument // import "go.opentelemetry.io/otel/metric/instrument" -import ( - "testing" -) - -func TestNewNoopMeterProvider(t *testing.T) { - got, want := NewNoopMeterProvider(), noopMeterProvider{} - if got != want { - t.Errorf("NewNoopMeterProvider() returned %#v, want %#v", got, want) - } +// Asynchronous instruments are instruments that are updated within a Callback. +// If an instrument is observed outside of it's callback it should be an error. +// +// This interface is used as a grouping mechanism. +type Asynchronous interface { + asynchronous() } -func TestNoopMeterProviderMeter(t *testing.T) { - mp := NewNoopMeterProvider() - got, want := mp.Meter(""), Meter{} - if got != want { - t.Errorf("noopMeterProvider.Meter() returned %#v, want %#v", got, want) - } +// Synchronous instruments are updated in line with application code. +// +// This interface is used as a grouping mechanism. +type Synchronous interface { + synchronous() } diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go new file mode 100644 index 00000000000..1989292ecf8 --- /dev/null +++ b/metric/instrument/syncfloat64/syncfloat64.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" +) + +// InstrumentProvider provides access to individual instruments. +type InstrumentProvider interface { + // Counter creates an instrument for recording increasing values. + Counter(name string, opts ...instrument.Option) (Counter, error) + // UpDownCounter creates an instrument for recording changes of a value. + UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) + // Histogram creates an instrument for recording a distribution of values. + Histogram(name string, opts ...instrument.Option) (Histogram, error) +} + +// Counter is an instrument that records increasing values. +type Counter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} + +// UpDownCounter is an instrument that records increasing or decresing values. +type UpDownCounter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} + +// Histogram is an instrument that records a distribution of values. +type Histogram interface { + // Record adds an additional value to the distribution. + Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go new file mode 100644 index 00000000000..ee882bcd922 --- /dev/null +++ b/metric/instrument/syncint64/syncint64.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" +) + +// InstrumentProvider provides access to individual instruments. +type InstrumentProvider interface { + // Counter creates an instrument for recording increasing values. + Counter(name string, opts ...instrument.Option) (Counter, error) + // UpDownCounter creates an instrument for recording changes of a value. + UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) + // Histogram creates an instrument for recording a distribution of values. + Histogram(name string, opts ...instrument.Option) (Histogram, error) +} + +// Counter is an instrument that records increasing values. +type Counter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} + +// UpDownCounter is an instrument that records increasing or decresing values. +type UpDownCounter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} + +// Histogram is an instrument that records a distribution of values. +type Histogram interface { + // Record adds an additional value to the distribution. + Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + instrument.Synchronous +} diff --git a/metric/meter.go b/metric/meter.go new file mode 100644 index 00000000000..21fc1c499fb --- /dev/null +++ b/metric/meter.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +// MeterProvider provides access to named Meter instances, for instrumenting +// an application or library. +type MeterProvider interface { + // Meter creates an instance of a `Meter` interface. The instrumentationName + // must be the name of the library providing instrumentation. This name may + // be the same as the instrumented code only if that code provides built-in + // instrumentation. If the instrumentationName is empty, then a + // implementation defined default name will be used instead. + Meter(instrumentationName string, opts ...MeterOption) Meter +} + +// Meter provides access to instrument instances for recording metrics. +type Meter interface { + // AsyncInt64 is the namespace for the Asynchronous Integer instruments. + // + // To Observe data with instruments it must be registered in a callback. + AsyncInt64() asyncint64.InstrumentProvider + + // AsyncFloat64 is the namespace for the Asynchronous Float instruments + // + // To Observe data with instruments it must be registered in a callback. + AsyncFloat64() asyncfloat64.InstrumentProvider + + // RegisterCallback captures the function that will be called during Collect. + // + // It is only valid to call Observe within the scope of the passed function, + // and only on the instruments that were registered with this call. + RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error + + // SyncInt64 is the namespace for the Synchronous Integer instruments + SyncInt64() syncint64.InstrumentProvider + // SyncFloat64 is the namespace for the Synchronous Float instruments + SyncFloat64() syncfloat64.InstrumentProvider +} diff --git a/metric/metric.go b/metric/metric.go deleted file mode 100644 index d8c5a6b3f35..00000000000 --- a/metric/metric.go +++ /dev/null @@ -1,538 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -// MeterProvider supports named Meter instances. -type MeterProvider interface { - // Meter creates an implementation of the Meter interface. - // The instrumentationName must be the name of the library providing - // instrumentation. This name may be the same as the instrumented code - // only if that code provides built-in instrumentation. If the - // instrumentationName is empty, then a implementation defined default - // name will be used instead. - Meter(instrumentationName string, opts ...MeterOption) Meter -} - -// Meter is the creator of metric instruments. -// -// An uninitialized Meter is a no-op implementation. -type Meter struct { - impl sdkapi.MeterImpl -} - -// WrapMeterImpl constructs a `Meter` implementation from a -// `MeterImpl` implementation. -func WrapMeterImpl(impl sdkapi.MeterImpl) Meter { - return Meter{ - impl: impl, - } -} - -// Measurement is used for reporting a synchronous batch of metric -// values. Instances of this type should be created by synchronous -// instruments (e.g., Int64Counter.Measurement()). -// -// Note: This is an alias because it is a first-class member of the -// API but is also part of the lower-level sdkapi interface. -type Measurement = sdkapi.Measurement - -// Observation is used for reporting an asynchronous batch of metric -// values. Instances of this type should be created by asynchronous -// instruments (e.g., Int64GaugeObserver.Observation()). -// -// Note: This is an alias because it is a first-class member of the -// API but is also part of the lower-level sdkapi interface. -type Observation = sdkapi.Observation - -// RecordBatch atomically records a batch of measurements. -func (m Meter) RecordBatch(ctx context.Context, ls []attribute.KeyValue, ms ...Measurement) { - if m.impl == nil { - return - } - m.impl.RecordBatch(ctx, ls, ms...) -} - -// NewBatchObserver creates a new BatchObserver that supports -// making batches of observations for multiple instruments. -func (m Meter) NewBatchObserver(callback BatchObserverFunc) BatchObserver { - return BatchObserver{ - meter: m, - runner: newBatchAsyncRunner(callback), - } -} - -// NewInt64Counter creates a new integer Counter instrument with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewInt64Counter(name string, options ...InstrumentOption) (Int64Counter, error) { - return wrapInt64CounterInstrument( - m.newSync(name, sdkapi.CounterInstrumentKind, number.Int64Kind, options)) -} - -// NewFloat64Counter creates a new floating point Counter with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewFloat64Counter(name string, options ...InstrumentOption) (Float64Counter, error) { - return wrapFloat64CounterInstrument( - m.newSync(name, sdkapi.CounterInstrumentKind, number.Float64Kind, options)) -} - -// NewInt64UpDownCounter creates a new integer UpDownCounter instrument with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewInt64UpDownCounter(name string, options ...InstrumentOption) (Int64UpDownCounter, error) { - return wrapInt64UpDownCounterInstrument( - m.newSync(name, sdkapi.UpDownCounterInstrumentKind, number.Int64Kind, options)) -} - -// NewFloat64UpDownCounter creates a new floating point UpDownCounter with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewFloat64UpDownCounter(name string, options ...InstrumentOption) (Float64UpDownCounter, error) { - return wrapFloat64UpDownCounterInstrument( - m.newSync(name, sdkapi.UpDownCounterInstrumentKind, number.Float64Kind, options)) -} - -// NewInt64Histogram creates a new integer Histogram instrument with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewInt64Histogram(name string, opts ...InstrumentOption) (Int64Histogram, error) { - return wrapInt64HistogramInstrument( - m.newSync(name, sdkapi.HistogramInstrumentKind, number.Int64Kind, opts)) -} - -// NewFloat64Histogram creates a new floating point Histogram with the -// given name, customized with options. May return an error if the -// name is invalid (e.g., empty) or improperly registered (e.g., -// duplicate registration). -func (m Meter) NewFloat64Histogram(name string, opts ...InstrumentOption) (Float64Histogram, error) { - return wrapFloat64HistogramInstrument( - m.newSync(name, sdkapi.HistogramInstrumentKind, number.Float64Kind, opts)) -} - -// NewInt64GaugeObserver creates a new integer GaugeObserver instrument -// with the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewInt64GaugeObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64GaugeObserver, error) { - if callback == nil { - return wrapInt64GaugeObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64GaugeObserverInstrument( - m.newAsync(name, sdkapi.GaugeObserverInstrumentKind, number.Int64Kind, opts, - newInt64AsyncRunner(callback))) -} - -// NewFloat64GaugeObserver creates a new floating point GaugeObserver with -// the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewFloat64GaugeObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64GaugeObserver, error) { - if callback == nil { - return wrapFloat64GaugeObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64GaugeObserverInstrument( - m.newAsync(name, sdkapi.GaugeObserverInstrumentKind, number.Float64Kind, opts, - newFloat64AsyncRunner(callback))) -} - -// NewInt64CounterObserver creates a new integer CounterObserver instrument -// with the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewInt64CounterObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64CounterObserver, error) { - if callback == nil { - return wrapInt64CounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64CounterObserverInstrument( - m.newAsync(name, sdkapi.CounterObserverInstrumentKind, number.Int64Kind, opts, - newInt64AsyncRunner(callback))) -} - -// NewFloat64CounterObserver creates a new floating point CounterObserver with -// the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewFloat64CounterObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64CounterObserver, error) { - if callback == nil { - return wrapFloat64CounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64CounterObserverInstrument( - m.newAsync(name, sdkapi.CounterObserverInstrumentKind, number.Float64Kind, opts, - newFloat64AsyncRunner(callback))) -} - -// NewInt64UpDownCounterObserver creates a new integer UpDownCounterObserver instrument -// with the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewInt64UpDownCounterObserver(name string, callback Int64ObserverFunc, opts ...InstrumentOption) (Int64UpDownCounterObserver, error) { - if callback == nil { - return wrapInt64UpDownCounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64UpDownCounterObserverInstrument( - m.newAsync(name, sdkapi.UpDownCounterObserverInstrumentKind, number.Int64Kind, opts, - newInt64AsyncRunner(callback))) -} - -// NewFloat64UpDownCounterObserver creates a new floating point UpDownCounterObserver with -// the given name, running a given callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (m Meter) NewFloat64UpDownCounterObserver(name string, callback Float64ObserverFunc, opts ...InstrumentOption) (Float64UpDownCounterObserver, error) { - if callback == nil { - return wrapFloat64UpDownCounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64UpDownCounterObserverInstrument( - m.newAsync(name, sdkapi.UpDownCounterObserverInstrumentKind, number.Float64Kind, opts, - newFloat64AsyncRunner(callback))) -} - -// NewInt64GaugeObserver creates a new integer GaugeObserver instrument -// with the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewInt64GaugeObserver(name string, opts ...InstrumentOption) (Int64GaugeObserver, error) { - if b.runner == nil { - return wrapInt64GaugeObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64GaugeObserverInstrument( - b.meter.newAsync(name, sdkapi.GaugeObserverInstrumentKind, number.Int64Kind, opts, b.runner)) -} - -// NewFloat64GaugeObserver creates a new floating point GaugeObserver with -// the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewFloat64GaugeObserver(name string, opts ...InstrumentOption) (Float64GaugeObserver, error) { - if b.runner == nil { - return wrapFloat64GaugeObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64GaugeObserverInstrument( - b.meter.newAsync(name, sdkapi.GaugeObserverInstrumentKind, number.Float64Kind, opts, - b.runner)) -} - -// NewInt64CounterObserver creates a new integer CounterObserver instrument -// with the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewInt64CounterObserver(name string, opts ...InstrumentOption) (Int64CounterObserver, error) { - if b.runner == nil { - return wrapInt64CounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64CounterObserverInstrument( - b.meter.newAsync(name, sdkapi.CounterObserverInstrumentKind, number.Int64Kind, opts, b.runner)) -} - -// NewFloat64CounterObserver creates a new floating point CounterObserver with -// the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewFloat64CounterObserver(name string, opts ...InstrumentOption) (Float64CounterObserver, error) { - if b.runner == nil { - return wrapFloat64CounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64CounterObserverInstrument( - b.meter.newAsync(name, sdkapi.CounterObserverInstrumentKind, number.Float64Kind, opts, - b.runner)) -} - -// NewInt64UpDownCounterObserver creates a new integer UpDownCounterObserver instrument -// with the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewInt64UpDownCounterObserver(name string, opts ...InstrumentOption) (Int64UpDownCounterObserver, error) { - if b.runner == nil { - return wrapInt64UpDownCounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapInt64UpDownCounterObserverInstrument( - b.meter.newAsync(name, sdkapi.UpDownCounterObserverInstrumentKind, number.Int64Kind, opts, b.runner)) -} - -// NewFloat64UpDownCounterObserver creates a new floating point UpDownCounterObserver with -// the given name, running in a batch callback, and customized with -// options. May return an error if the name is invalid (e.g., empty) -// or improperly registered (e.g., duplicate registration). -func (b BatchObserver) NewFloat64UpDownCounterObserver(name string, opts ...InstrumentOption) (Float64UpDownCounterObserver, error) { - if b.runner == nil { - return wrapFloat64UpDownCounterObserverInstrument(sdkapi.NewNoopAsyncInstrument(), nil) - } - return wrapFloat64UpDownCounterObserverInstrument( - b.meter.newAsync(name, sdkapi.UpDownCounterObserverInstrumentKind, number.Float64Kind, opts, - b.runner)) -} - -// MeterImpl returns the underlying MeterImpl of this Meter. -func (m Meter) MeterImpl() sdkapi.MeterImpl { - return m.impl -} - -// newAsync constructs one new asynchronous instrument. -func (m Meter) newAsync( - name string, - mkind sdkapi.InstrumentKind, - nkind number.Kind, - opts []InstrumentOption, - runner sdkapi.AsyncRunner, -) ( - sdkapi.AsyncImpl, - error, -) { - if m.impl == nil { - return sdkapi.NewNoopAsyncInstrument(), nil - } - cfg := NewInstrumentConfig(opts...) - desc := sdkapi.NewDescriptor(name, mkind, nkind, cfg.description, cfg.unit) - return m.impl.NewAsyncInstrument(desc, runner) -} - -// newSync constructs one new synchronous instrument. -func (m Meter) newSync( - name string, - metricKind sdkapi.InstrumentKind, - numberKind number.Kind, - opts []InstrumentOption, -) ( - sdkapi.SyncImpl, - error, -) { - if m.impl == nil { - return sdkapi.NewNoopSyncInstrument(), nil - } - cfg := NewInstrumentConfig(opts...) - desc := sdkapi.NewDescriptor(name, metricKind, numberKind, cfg.description, cfg.unit) - return m.impl.NewSyncInstrument(desc) -} - -// MeterMust is a wrapper for Meter interfaces that panics when any -// instrument constructor encounters an error. -type MeterMust struct { - meter Meter -} - -// BatchObserverMust is a wrapper for BatchObserver that panics when -// any instrument constructor encounters an error. -type BatchObserverMust struct { - batch BatchObserver -} - -// Must constructs a MeterMust implementation from a Meter, allowing -// the application to panic when any instrument constructor yields an -// error. -func Must(meter Meter) MeterMust { - return MeterMust{meter: meter} -} - -// NewInt64Counter calls `Meter.NewInt64Counter` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64Counter(name string, cos ...InstrumentOption) Int64Counter { - if inst, err := mm.meter.NewInt64Counter(name, cos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64Counter calls `Meter.NewFloat64Counter` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64Counter(name string, cos ...InstrumentOption) Float64Counter { - if inst, err := mm.meter.NewFloat64Counter(name, cos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64UpDownCounter calls `Meter.NewInt64UpDownCounter` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64UpDownCounter(name string, cos ...InstrumentOption) Int64UpDownCounter { - if inst, err := mm.meter.NewInt64UpDownCounter(name, cos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64UpDownCounter calls `Meter.NewFloat64UpDownCounter` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64UpDownCounter(name string, cos ...InstrumentOption) Float64UpDownCounter { - if inst, err := mm.meter.NewFloat64UpDownCounter(name, cos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64Histogram calls `Meter.NewInt64Histogram` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64Histogram(name string, mos ...InstrumentOption) Int64Histogram { - if inst, err := mm.meter.NewInt64Histogram(name, mos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64Histogram calls `Meter.NewFloat64Histogram` and returns the -// instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64Histogram(name string, mos ...InstrumentOption) Float64Histogram { - if inst, err := mm.meter.NewFloat64Histogram(name, mos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64GaugeObserver calls `Meter.NewInt64GaugeObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64GaugeObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64GaugeObserver { - if inst, err := mm.meter.NewInt64GaugeObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64GaugeObserver calls `Meter.NewFloat64GaugeObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64GaugeObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64GaugeObserver { - if inst, err := mm.meter.NewFloat64GaugeObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64CounterObserver calls `Meter.NewInt64CounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64CounterObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64CounterObserver { - if inst, err := mm.meter.NewInt64CounterObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64CounterObserver calls `Meter.NewFloat64CounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64CounterObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64CounterObserver { - if inst, err := mm.meter.NewFloat64CounterObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64UpDownCounterObserver calls `Meter.NewInt64UpDownCounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewInt64UpDownCounterObserver(name string, callback Int64ObserverFunc, oos ...InstrumentOption) Int64UpDownCounterObserver { - if inst, err := mm.meter.NewInt64UpDownCounterObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64UpDownCounterObserver calls `Meter.NewFloat64UpDownCounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (mm MeterMust) NewFloat64UpDownCounterObserver(name string, callback Float64ObserverFunc, oos ...InstrumentOption) Float64UpDownCounterObserver { - if inst, err := mm.meter.NewFloat64UpDownCounterObserver(name, callback, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewBatchObserver returns a wrapper around BatchObserver that panics -// when any instrument constructor returns an error. -func (mm MeterMust) NewBatchObserver(callback BatchObserverFunc) BatchObserverMust { - return BatchObserverMust{ - batch: mm.meter.NewBatchObserver(callback), - } -} - -// NewInt64GaugeObserver calls `BatchObserver.NewInt64GaugeObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewInt64GaugeObserver(name string, oos ...InstrumentOption) Int64GaugeObserver { - if inst, err := bm.batch.NewInt64GaugeObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64GaugeObserver calls `BatchObserver.NewFloat64GaugeObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewFloat64GaugeObserver(name string, oos ...InstrumentOption) Float64GaugeObserver { - if inst, err := bm.batch.NewFloat64GaugeObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64CounterObserver calls `BatchObserver.NewInt64CounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewInt64CounterObserver(name string, oos ...InstrumentOption) Int64CounterObserver { - if inst, err := bm.batch.NewInt64CounterObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64CounterObserver calls `BatchObserver.NewFloat64CounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewFloat64CounterObserver(name string, oos ...InstrumentOption) Float64CounterObserver { - if inst, err := bm.batch.NewFloat64CounterObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewInt64UpDownCounterObserver calls `BatchObserver.NewInt64UpDownCounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewInt64UpDownCounterObserver(name string, oos ...InstrumentOption) Int64UpDownCounterObserver { - if inst, err := bm.batch.NewInt64UpDownCounterObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} - -// NewFloat64UpDownCounterObserver calls `BatchObserver.NewFloat64UpDownCounterObserver` and -// returns the instrument, panicking if it encounters an error. -func (bm BatchObserverMust) NewFloat64UpDownCounterObserver(name string, oos ...InstrumentOption) Float64UpDownCounterObserver { - if inst, err := bm.batch.NewFloat64UpDownCounterObserver(name, oos...); err != nil { - panic(err) - } else { - return inst - } -} diff --git a/metric/metric_instrument.go b/metric/metric_instrument.go deleted file mode 100644 index 2da24c8f211..00000000000 --- a/metric/metric_instrument.go +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - "errors" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -// ErrSDKReturnedNilImpl is returned when a new `MeterImpl` returns nil. -var ErrSDKReturnedNilImpl = errors.New("SDK returned a nil implementation") - -// Int64ObserverFunc is a type of callback that integral -// observers run. -type Int64ObserverFunc func(context.Context, Int64ObserverResult) - -// Float64ObserverFunc is a type of callback that floating point -// observers run. -type Float64ObserverFunc func(context.Context, Float64ObserverResult) - -// BatchObserverFunc is a callback argument for use with any -// Observer instrument that will be reported as a batch of -// observations. -type BatchObserverFunc func(context.Context, BatchObserverResult) - -// Int64ObserverResult is passed to an observer callback to capture -// observations for one asynchronous integer metric instrument. -type Int64ObserverResult struct { - instrument sdkapi.AsyncImpl - function func([]attribute.KeyValue, ...Observation) -} - -// Float64ObserverResult is passed to an observer callback to capture -// observations for one asynchronous floating point metric instrument. -type Float64ObserverResult struct { - instrument sdkapi.AsyncImpl - function func([]attribute.KeyValue, ...Observation) -} - -// BatchObserverResult is passed to a batch observer callback to -// capture observations for multiple asynchronous instruments. -type BatchObserverResult struct { - function func([]attribute.KeyValue, ...Observation) -} - -// Observe captures a single integer value from the associated -// instrument callback, with the given labels. -func (ir Int64ObserverResult) Observe(value int64, labels ...attribute.KeyValue) { - ir.function(labels, sdkapi.NewObservation(ir.instrument, number.NewInt64Number(value))) -} - -// Observe captures a single floating point value from the associated -// instrument callback, with the given labels. -func (fr Float64ObserverResult) Observe(value float64, labels ...attribute.KeyValue) { - fr.function(labels, sdkapi.NewObservation(fr.instrument, number.NewFloat64Number(value))) -} - -// Observe captures a multiple observations from the associated batch -// instrument callback, with the given labels. -func (br BatchObserverResult) Observe(labels []attribute.KeyValue, obs ...Observation) { - br.function(labels, obs...) -} - -var _ sdkapi.AsyncSingleRunner = (*Int64ObserverFunc)(nil) -var _ sdkapi.AsyncSingleRunner = (*Float64ObserverFunc)(nil) -var _ sdkapi.AsyncBatchRunner = (*BatchObserverFunc)(nil) - -// newInt64AsyncRunner returns a single-observer callback for integer Observer instruments. -func newInt64AsyncRunner(c Int64ObserverFunc) sdkapi.AsyncSingleRunner { - return &c -} - -// newFloat64AsyncRunner returns a single-observer callback for floating point Observer instruments. -func newFloat64AsyncRunner(c Float64ObserverFunc) sdkapi.AsyncSingleRunner { - return &c -} - -// newBatchAsyncRunner returns a batch-observer callback use with multiple Observer instruments. -func newBatchAsyncRunner(c BatchObserverFunc) sdkapi.AsyncBatchRunner { - return &c -} - -// AnyRunner implements AsyncRunner. -func (*Int64ObserverFunc) AnyRunner() {} - -// AnyRunner implements AsyncRunner. -func (*Float64ObserverFunc) AnyRunner() {} - -// AnyRunner implements AsyncRunner. -func (*BatchObserverFunc) AnyRunner() {} - -// Run implements AsyncSingleRunner. -func (i *Int64ObserverFunc) Run(ctx context.Context, impl sdkapi.AsyncImpl, function func([]attribute.KeyValue, ...Observation)) { - (*i)(ctx, Int64ObserverResult{ - instrument: impl, - function: function, - }) -} - -// Run implements AsyncSingleRunner. -func (f *Float64ObserverFunc) Run(ctx context.Context, impl sdkapi.AsyncImpl, function func([]attribute.KeyValue, ...Observation)) { - (*f)(ctx, Float64ObserverResult{ - instrument: impl, - function: function, - }) -} - -// Run implements AsyncBatchRunner. -func (b *BatchObserverFunc) Run(ctx context.Context, function func([]attribute.KeyValue, ...Observation)) { - (*b)(ctx, BatchObserverResult{ - function: function, - }) -} - -// wrapInt64GaugeObserverInstrument converts an AsyncImpl into Int64GaugeObserver. -func wrapInt64GaugeObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64GaugeObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Int64GaugeObserver{asyncInstrument: common}, err -} - -// wrapFloat64GaugeObserverInstrument converts an AsyncImpl into Float64GaugeObserver. -func wrapFloat64GaugeObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64GaugeObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Float64GaugeObserver{asyncInstrument: common}, err -} - -// wrapInt64CounterObserverInstrument converts an AsyncImpl into Int64CounterObserver. -func wrapInt64CounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64CounterObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Int64CounterObserver{asyncInstrument: common}, err -} - -// wrapFloat64CounterObserverInstrument converts an AsyncImpl into Float64CounterObserver. -func wrapFloat64CounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64CounterObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Float64CounterObserver{asyncInstrument: common}, err -} - -// wrapInt64UpDownCounterObserverInstrument converts an AsyncImpl into Int64UpDownCounterObserver. -func wrapInt64UpDownCounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Int64UpDownCounterObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Int64UpDownCounterObserver{asyncInstrument: common}, err -} - -// wrapFloat64UpDownCounterObserverInstrument converts an AsyncImpl into Float64UpDownCounterObserver. -func wrapFloat64UpDownCounterObserverInstrument(asyncInst sdkapi.AsyncImpl, err error) (Float64UpDownCounterObserver, error) { - common, err := checkNewAsync(asyncInst, err) - return Float64UpDownCounterObserver{asyncInstrument: common}, err -} - -// BatchObserver represents an Observer callback that can report -// observations for multiple instruments. -type BatchObserver struct { - meter Meter - runner sdkapi.AsyncBatchRunner -} - -// Int64GaugeObserver is a metric that captures a set of int64 values at a -// point in time. -type Int64GaugeObserver struct { - asyncInstrument -} - -// Float64GaugeObserver is a metric that captures a set of float64 values -// at a point in time. -type Float64GaugeObserver struct { - asyncInstrument -} - -// Int64CounterObserver is a metric that captures a precomputed sum of -// int64 values at a point in time. -type Int64CounterObserver struct { - asyncInstrument -} - -// Float64CounterObserver is a metric that captures a precomputed sum of -// float64 values at a point in time. -type Float64CounterObserver struct { - asyncInstrument -} - -// Int64UpDownCounterObserver is a metric that captures a precomputed sum of -// int64 values at a point in time. -type Int64UpDownCounterObserver struct { - asyncInstrument -} - -// Float64UpDownCounterObserver is a metric that captures a precomputed sum of -// float64 values at a point in time. -type Float64UpDownCounterObserver struct { - asyncInstrument -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (i Int64GaugeObserver) Observation(v int64) Observation { - return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v)) -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (f Float64GaugeObserver) Observation(v float64) Observation { - return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v)) -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (i Int64CounterObserver) Observation(v int64) Observation { - return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v)) -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (f Float64CounterObserver) Observation(v float64) Observation { - return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v)) -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (i Int64UpDownCounterObserver) Observation(v int64) Observation { - return sdkapi.NewObservation(i.instrument, number.NewInt64Number(v)) -} - -// Observation returns an Observation, a BatchObserverFunc -// argument, for an asynchronous integer instrument. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (f Float64UpDownCounterObserver) Observation(v float64) Observation { - return sdkapi.NewObservation(f.instrument, number.NewFloat64Number(v)) -} - -// syncInstrument contains a SyncImpl. -type syncInstrument struct { - instrument sdkapi.SyncImpl -} - -// asyncInstrument contains a AsyncImpl. -type asyncInstrument struct { - instrument sdkapi.AsyncImpl -} - -// AsyncImpl implements AsyncImpl. -func (a asyncInstrument) AsyncImpl() sdkapi.AsyncImpl { - return a.instrument -} - -// SyncImpl returns the implementation object for synchronous instruments. -func (s syncInstrument) SyncImpl() sdkapi.SyncImpl { - return s.instrument -} - -func (s syncInstrument) float64Measurement(value float64) Measurement { - return sdkapi.NewMeasurement(s.instrument, number.NewFloat64Number(value)) -} - -func (s syncInstrument) int64Measurement(value int64) Measurement { - return sdkapi.NewMeasurement(s.instrument, number.NewInt64Number(value)) -} - -func (s syncInstrument) directRecord(ctx context.Context, number number.Number, labels []attribute.KeyValue) { - s.instrument.RecordOne(ctx, number, labels) -} - -// checkNewAsync receives an AsyncImpl and potential -// error, and returns the same types, checking for and ensuring that -// the returned interface is not nil. -func checkNewAsync(instrument sdkapi.AsyncImpl, err error) (asyncInstrument, error) { - if instrument == nil { - if err == nil { - err = ErrSDKReturnedNilImpl - } - instrument = sdkapi.NewNoopAsyncInstrument() - } - return asyncInstrument{ - instrument: instrument, - }, err -} - -// checkNewSync receives an SyncImpl and potential -// error, and returns the same types, checking for and ensuring that -// the returned interface is not nil. -func checkNewSync(instrument sdkapi.SyncImpl, err error) (syncInstrument, error) { - if instrument == nil { - if err == nil { - err = ErrSDKReturnedNilImpl - } - // Note: an alternate behavior would be to synthesize a new name - // or group all duplicately-named instruments of a certain type - // together and use a tag for the original name, e.g., - // name = 'invalid.counter.int64' - // label = 'original-name=duplicate-counter-name' - instrument = sdkapi.NewNoopSyncInstrument() - } - return syncInstrument{ - instrument: instrument, - }, err -} - -// wrapInt64CounterInstrument converts a SyncImpl into Int64Counter. -func wrapInt64CounterInstrument(syncInst sdkapi.SyncImpl, err error) (Int64Counter, error) { - common, err := checkNewSync(syncInst, err) - return Int64Counter{syncInstrument: common}, err -} - -// wrapFloat64CounterInstrument converts a SyncImpl into Float64Counter. -func wrapFloat64CounterInstrument(syncInst sdkapi.SyncImpl, err error) (Float64Counter, error) { - common, err := checkNewSync(syncInst, err) - return Float64Counter{syncInstrument: common}, err -} - -// wrapInt64UpDownCounterInstrument converts a SyncImpl into Int64UpDownCounter. -func wrapInt64UpDownCounterInstrument(syncInst sdkapi.SyncImpl, err error) (Int64UpDownCounter, error) { - common, err := checkNewSync(syncInst, err) - return Int64UpDownCounter{syncInstrument: common}, err -} - -// wrapFloat64UpDownCounterInstrument converts a SyncImpl into Float64UpDownCounter. -func wrapFloat64UpDownCounterInstrument(syncInst sdkapi.SyncImpl, err error) (Float64UpDownCounter, error) { - common, err := checkNewSync(syncInst, err) - return Float64UpDownCounter{syncInstrument: common}, err -} - -// wrapInt64HistogramInstrument converts a SyncImpl into Int64Histogram. -func wrapInt64HistogramInstrument(syncInst sdkapi.SyncImpl, err error) (Int64Histogram, error) { - common, err := checkNewSync(syncInst, err) - return Int64Histogram{syncInstrument: common}, err -} - -// wrapFloat64HistogramInstrument converts a SyncImpl into Float64Histogram. -func wrapFloat64HistogramInstrument(syncInst sdkapi.SyncImpl, err error) (Float64Histogram, error) { - common, err := checkNewSync(syncInst, err) - return Float64Histogram{syncInstrument: common}, err -} - -// Float64Counter is a metric that accumulates float64 values. -type Float64Counter struct { - syncInstrument -} - -// Int64Counter is a metric that accumulates int64 values. -type Int64Counter struct { - syncInstrument -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Float64Counter) Measurement(value float64) Measurement { - return c.float64Measurement(value) -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Int64Counter) Measurement(value int64) Measurement { - return c.int64Measurement(value) -} - -// Add adds the value to the counter's sum. The labels should contain -// the keys and values to be associated with this value. -func (c Float64Counter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewFloat64Number(value), labels) -} - -// Add adds the value to the counter's sum. The labels should contain -// the keys and values to be associated with this value. -func (c Int64Counter) Add(ctx context.Context, value int64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewInt64Number(value), labels) -} - -// Float64UpDownCounter is a metric instrument that sums floating -// point values. -type Float64UpDownCounter struct { - syncInstrument -} - -// Int64UpDownCounter is a metric instrument that sums integer values. -type Int64UpDownCounter struct { - syncInstrument -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Float64UpDownCounter) Measurement(value float64) Measurement { - return c.float64Measurement(value) -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Int64UpDownCounter) Measurement(value int64) Measurement { - return c.int64Measurement(value) -} - -// Add adds the value to the counter's sum. The labels should contain -// the keys and values to be associated with this value. -func (c Float64UpDownCounter) Add(ctx context.Context, value float64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewFloat64Number(value), labels) -} - -// Add adds the value to the counter's sum. The labels should contain -// the keys and values to be associated with this value. -func (c Int64UpDownCounter) Add(ctx context.Context, value int64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewInt64Number(value), labels) -} - -// Float64Histogram is a metric that records float64 values. -type Float64Histogram struct { - syncInstrument -} - -// Int64Histogram is a metric that records int64 values. -type Int64Histogram struct { - syncInstrument -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Float64Histogram) Measurement(value float64) Measurement { - return c.float64Measurement(value) -} - -// Measurement creates a Measurement object to use with batch -// recording. -func (c Int64Histogram) Measurement(value int64) Measurement { - return c.int64Measurement(value) -} - -// Record adds a new value to the list of Histogram's records. The -// labels should contain the keys and values to be associated with -// this value. -func (c Float64Histogram) Record(ctx context.Context, value float64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewFloat64Number(value), labels) -} - -// Record adds a new value to the Histogram's distribution. The -// labels should contain the keys and values to be associated with -// this value. -func (c Int64Histogram) Record(ctx context.Context, value int64, labels ...attribute.KeyValue) { - c.directRecord(ctx, number.NewInt64Number(value), labels) -} diff --git a/metric/metric_test.go b/metric/metric_test.go deleted file mode 100644 index ab8e916b829..00000000000 --- a/metric/metric_test.go +++ /dev/null @@ -1,497 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric_test - -import ( - "context" - "errors" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/metric/unit" -) - -var Must = metric.Must - -var ( - syncKinds = []sdkapi.InstrumentKind{ - sdkapi.HistogramInstrumentKind, - sdkapi.CounterInstrumentKind, - sdkapi.UpDownCounterInstrumentKind, - } - asyncKinds = []sdkapi.InstrumentKind{ - sdkapi.GaugeObserverInstrumentKind, - sdkapi.CounterObserverInstrumentKind, - sdkapi.UpDownCounterObserverInstrumentKind, - } - addingKinds = []sdkapi.InstrumentKind{ - sdkapi.CounterInstrumentKind, - sdkapi.UpDownCounterInstrumentKind, - sdkapi.CounterObserverInstrumentKind, - sdkapi.UpDownCounterObserverInstrumentKind, - } - groupingKinds = []sdkapi.InstrumentKind{ - sdkapi.HistogramInstrumentKind, - sdkapi.GaugeObserverInstrumentKind, - } - - monotonicKinds = []sdkapi.InstrumentKind{ - sdkapi.CounterInstrumentKind, - sdkapi.CounterObserverInstrumentKind, - } - - nonMonotonicKinds = []sdkapi.InstrumentKind{ - sdkapi.UpDownCounterInstrumentKind, - sdkapi.UpDownCounterObserverInstrumentKind, - sdkapi.HistogramInstrumentKind, - sdkapi.GaugeObserverInstrumentKind, - } - - precomputedSumKinds = []sdkapi.InstrumentKind{ - sdkapi.CounterObserverInstrumentKind, - sdkapi.UpDownCounterObserverInstrumentKind, - } - - nonPrecomputedSumKinds = []sdkapi.InstrumentKind{ - sdkapi.CounterInstrumentKind, - sdkapi.UpDownCounterInstrumentKind, - sdkapi.HistogramInstrumentKind, - sdkapi.GaugeObserverInstrumentKind, - } -) - -func TestSynchronous(t *testing.T) { - for _, k := range syncKinds { - require.True(t, k.Synchronous()) - require.False(t, k.Asynchronous()) - } - for _, k := range asyncKinds { - require.True(t, k.Asynchronous()) - require.False(t, k.Synchronous()) - } -} - -func TestGrouping(t *testing.T) { - for _, k := range groupingKinds { - require.True(t, k.Grouping()) - require.False(t, k.Adding()) - } - for _, k := range addingKinds { - require.True(t, k.Adding()) - require.False(t, k.Grouping()) - } -} - -func TestMonotonic(t *testing.T) { - for _, k := range monotonicKinds { - require.True(t, k.Monotonic()) - } - for _, k := range nonMonotonicKinds { - require.False(t, k.Monotonic()) - } -} - -func TestPrecomputedSum(t *testing.T) { - for _, k := range precomputedSumKinds { - require.True(t, k.PrecomputedSum()) - } - for _, k := range nonPrecomputedSumKinds { - require.False(t, k.PrecomputedSum()) - } -} - -func checkSyncBatches(ctx context.Context, t *testing.T, labels []attribute.KeyValue, provider *metrictest.MeterProvider, nkind number.Kind, mkind sdkapi.InstrumentKind, instrument sdkapi.InstrumentImpl, expected ...float64) { - t.Helper() - - batchesCount := len(provider.MeasurementBatches) - if len(provider.MeasurementBatches) != len(expected) { - t.Errorf("Expected %d recorded measurement batches, got %d", batchesCount, len(provider.MeasurementBatches)) - } - recorded := metrictest.AsStructs(provider.MeasurementBatches) - - for i, batch := range provider.MeasurementBatches { - if len(batch.Measurements) != 1 { - t.Errorf("Expected 1 measurement in batch %d, got %d", i, len(batch.Measurements)) - } - - measurement := batch.Measurements[0] - descriptor := measurement.Instrument.Descriptor() - - expected := metrictest.Measured{ - Name: descriptor.Name(), - Library: metrictest.Library{ - InstrumentationName: "apitest", - }, - Labels: metrictest.LabelsToMap(labels...), - Number: metrictest.ResolveNumberByKind(t, nkind, expected[i]), - } - require.Equal(t, expected, recorded[i]) - } -} - -func TestOptions(t *testing.T) { - type testcase struct { - name string - opts []metric.InstrumentOption - desc string - unit unit.Unit - } - testcases := []testcase{ - { - name: "no opts", - opts: nil, - desc: "", - unit: "", - }, - { - name: "description", - opts: []metric.InstrumentOption{ - metric.WithDescription("stuff"), - }, - desc: "stuff", - unit: "", - }, - { - name: "description override", - opts: []metric.InstrumentOption{ - metric.WithDescription("stuff"), - metric.WithDescription("things"), - }, - desc: "things", - unit: "", - }, - { - name: "unit", - opts: []metric.InstrumentOption{ - metric.WithUnit("s"), - }, - desc: "", - unit: "s", - }, - { - name: "description override", - opts: []metric.InstrumentOption{ - metric.WithDescription("stuff"), - metric.WithDescription("things"), - }, - desc: "things", - unit: "", - }, - { - name: "unit", - opts: []metric.InstrumentOption{ - metric.WithUnit("s"), - }, - desc: "", - unit: "s", - }, - - { - name: "unit override", - opts: []metric.InstrumentOption{ - metric.WithUnit("s"), - metric.WithUnit("h"), - }, - desc: "", - unit: "h", - }, - { - name: "all", - opts: []metric.InstrumentOption{ - metric.WithDescription("stuff"), - metric.WithUnit("s"), - }, - desc: "stuff", - unit: "s", - }, - } - for idx, tt := range testcases { - t.Logf("Testing counter case %s (%d)", tt.name, idx) - cfg := metric.NewInstrumentConfig(tt.opts...) - if diff := cmp.Diff(cfg.Description(), tt.desc); diff != "" { - t.Errorf("Compare Description: -got +want %s", diff) - } - if diff := cmp.Diff(cfg.Unit(), tt.unit); diff != "" { - t.Errorf("Compare Unit: -got +want %s", diff) - } - } -} -func testPair() (*metrictest.MeterProvider, metric.Meter) { - provider := metrictest.NewMeterProvider() - return provider, provider.Meter("apitest") -} - -func TestCounter(t *testing.T) { - // N.B. the API does not check for negative - // values, that's the SDK's responsibility. - t.Run("float64 counter", func(t *testing.T) { - provider, meter := testPair() - c := Must(meter).NewFloat64Counter("test.counter.float") - ctx := context.Background() - labels := []attribute.KeyValue{attribute.String("A", "B")} - c.Add(ctx, 1994.1, labels...) - meter.RecordBatch(ctx, labels, c.Measurement(42)) - checkSyncBatches(ctx, t, labels, provider, number.Float64Kind, sdkapi.CounterInstrumentKind, c.SyncImpl(), - 1994.1, 42, - ) - }) - t.Run("int64 counter", func(t *testing.T) { - provider, meter := testPair() - c := Must(meter).NewInt64Counter("test.counter.int") - ctx := context.Background() - labels := []attribute.KeyValue{attribute.String("A", "B"), attribute.String("C", "D")} - c.Add(ctx, 42, labels...) - meter.RecordBatch(ctx, labels, c.Measurement(420000)) - checkSyncBatches(ctx, t, labels, provider, number.Int64Kind, sdkapi.CounterInstrumentKind, c.SyncImpl(), - 42, 420000, - ) - - }) - t.Run("int64 updowncounter", func(t *testing.T) { - provider, meter := testPair() - c := Must(meter).NewInt64UpDownCounter("test.updowncounter.int") - ctx := context.Background() - labels := []attribute.KeyValue{attribute.String("A", "B"), attribute.String("C", "D")} - c.Add(ctx, 100, labels...) - meter.RecordBatch(ctx, labels, c.Measurement(42)) - checkSyncBatches(ctx, t, labels, provider, number.Int64Kind, sdkapi.UpDownCounterInstrumentKind, c.SyncImpl(), - 100, 42, - ) - }) - t.Run("float64 updowncounter", func(t *testing.T) { - provider, meter := testPair() - c := Must(meter).NewFloat64UpDownCounter("test.updowncounter.float") - ctx := context.Background() - labels := []attribute.KeyValue{attribute.String("A", "B"), attribute.String("C", "D")} - c.Add(ctx, 100.1, labels...) - meter.RecordBatch(ctx, labels, c.Measurement(-100.1)) - checkSyncBatches(ctx, t, labels, provider, number.Float64Kind, sdkapi.UpDownCounterInstrumentKind, c.SyncImpl(), - 100.1, -100.1, - ) - }) -} - -func TestHistogram(t *testing.T) { - t.Run("float64 histogram", func(t *testing.T) { - provider, meter := testPair() - m := Must(meter).NewFloat64Histogram("test.histogram.float") - ctx := context.Background() - labels := []attribute.KeyValue{} - m.Record(ctx, 42, labels...) - meter.RecordBatch(ctx, labels, m.Measurement(-100.5)) - checkSyncBatches(ctx, t, labels, provider, number.Float64Kind, sdkapi.HistogramInstrumentKind, m.SyncImpl(), - 42, -100.5, - ) - }) - t.Run("int64 histogram", func(t *testing.T) { - provider, meter := testPair() - m := Must(meter).NewInt64Histogram("test.histogram.int") - ctx := context.Background() - labels := []attribute.KeyValue{attribute.Int("I", 1)} - m.Record(ctx, 173, labels...) - meter.RecordBatch(ctx, labels, m.Measurement(0)) - checkSyncBatches(ctx, t, labels, provider, number.Int64Kind, sdkapi.HistogramInstrumentKind, m.SyncImpl(), - 173, 0, - ) - }) -} - -func TestObserverInstruments(t *testing.T) { - t.Run("float gauge", func(t *testing.T) { - labels := []attribute.KeyValue{attribute.String("O", "P")} - provider, meter := testPair() - o := Must(meter).NewFloat64GaugeObserver("test.gauge.float", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(42.1, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Float64Kind, sdkapi.GaugeObserverInstrumentKind, o.AsyncImpl(), - 42.1, - ) - }) - t.Run("int gauge", func(t *testing.T) { - labels := []attribute.KeyValue{} - provider, meter := testPair() - o := Must(meter).NewInt64GaugeObserver("test.gauge.int", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(-142, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Int64Kind, sdkapi.GaugeObserverInstrumentKind, o.AsyncImpl(), - -142, - ) - }) - t.Run("float counterobserver", func(t *testing.T) { - labels := []attribute.KeyValue{attribute.String("O", "P")} - provider, meter := testPair() - o := Must(meter).NewFloat64CounterObserver("test.counter.float", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(42.1, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Float64Kind, sdkapi.CounterObserverInstrumentKind, o.AsyncImpl(), - 42.1, - ) - }) - t.Run("int counterobserver", func(t *testing.T) { - labels := []attribute.KeyValue{} - provider, meter := testPair() - o := Must(meter).NewInt64CounterObserver("test.counter.int", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(-142, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Int64Kind, sdkapi.CounterObserverInstrumentKind, o.AsyncImpl(), - -142, - ) - }) - t.Run("float updowncounterobserver", func(t *testing.T) { - labels := []attribute.KeyValue{attribute.String("O", "P")} - provider, meter := testPair() - o := Must(meter).NewFloat64UpDownCounterObserver("test.updowncounter.float", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(42.1, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Float64Kind, sdkapi.UpDownCounterObserverInstrumentKind, o.AsyncImpl(), - 42.1, - ) - }) - t.Run("int updowncounterobserver", func(t *testing.T) { - labels := []attribute.KeyValue{} - provider, meter := testPair() - o := Must(meter).NewInt64UpDownCounterObserver("test..int", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(-142, labels...) - }) - provider.RunAsyncInstruments() - checkObserverBatch(t, labels, provider, number.Int64Kind, sdkapi.UpDownCounterObserverInstrumentKind, o.AsyncImpl(), - -142, - ) - }) -} - -func TestBatchObserverInstruments(t *testing.T) { - provider, meter := testPair() - - var obs1 metric.Int64GaugeObserver - var obs2 metric.Float64GaugeObserver - - labels := []attribute.KeyValue{ - attribute.String("A", "B"), - attribute.String("C", "D"), - } - - cb := Must(meter).NewBatchObserver( - func(_ context.Context, result metric.BatchObserverResult) { - result.Observe(labels, - obs1.Observation(42), - obs2.Observation(42.0), - ) - }, - ) - obs1 = cb.NewInt64GaugeObserver("test.gauge.int") - obs2 = cb.NewFloat64GaugeObserver("test.gauge.float") - - provider.RunAsyncInstruments() - - require.Len(t, provider.MeasurementBatches, 1) - - impl1 := obs1.AsyncImpl().Implementation().(*metrictest.Async) - impl2 := obs2.AsyncImpl().Implementation().(*metrictest.Async) - - require.NotNil(t, impl1) - require.NotNil(t, impl2) - - got := provider.MeasurementBatches[0] - require.Equal(t, labels, got.Labels) - require.Len(t, got.Measurements, 2) - - m1 := got.Measurements[0] - require.Equal(t, impl1, m1.Instrument.Implementation().(*metrictest.Async)) - require.Equal(t, 0, m1.Number.CompareNumber(number.Int64Kind, metrictest.ResolveNumberByKind(t, number.Int64Kind, 42))) - - m2 := got.Measurements[1] - require.Equal(t, impl2, m2.Instrument.Implementation().(*metrictest.Async)) - require.Equal(t, 0, m2.Number.CompareNumber(number.Float64Kind, metrictest.ResolveNumberByKind(t, number.Float64Kind, 42))) -} - -func checkObserverBatch(t *testing.T, labels []attribute.KeyValue, provider *metrictest.MeterProvider, nkind number.Kind, mkind sdkapi.InstrumentKind, observer sdkapi.AsyncImpl, expected float64) { - t.Helper() - assert.Len(t, provider.MeasurementBatches, 1) - if len(provider.MeasurementBatches) < 1 { - return - } - o := observer.Implementation().(*metrictest.Async) - if !assert.NotNil(t, o) { - return - } - got := provider.MeasurementBatches[0] - assert.Equal(t, labels, got.Labels) - assert.Len(t, got.Measurements, 1) - if len(got.Measurements) < 1 { - return - } - measurement := got.Measurements[0] - require.Equal(t, mkind, measurement.Instrument.Descriptor().InstrumentKind()) - assert.Equal(t, o, measurement.Instrument.Implementation().(*metrictest.Async)) - ft := metrictest.ResolveNumberByKind(t, nkind, expected) - assert.Equal(t, 0, measurement.Number.CompareNumber(nkind, ft)) -} - -type testWrappedMeter struct { -} - -var _ sdkapi.MeterImpl = testWrappedMeter{} - -func (testWrappedMeter) RecordBatch(context.Context, []attribute.KeyValue, ...sdkapi.Measurement) { -} - -func (testWrappedMeter) NewSyncInstrument(_ sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - return nil, nil -} - -func (testWrappedMeter) NewAsyncInstrument(_ sdkapi.Descriptor, _ sdkapi.AsyncRunner) (sdkapi.AsyncImpl, error) { - return nil, errors.New("Test wrap error") -} - -func TestWrappedInstrumentError(t *testing.T) { - impl := &testWrappedMeter{} - meter := metric.WrapMeterImpl(impl) - - histogram, err := meter.NewInt64Histogram("test.histogram") - - require.Equal(t, err, metric.ErrSDKReturnedNilImpl) - require.NotNil(t, histogram.SyncImpl()) - - observer, err := meter.NewInt64GaugeObserver("test.observer", func(_ context.Context, result metric.Int64ObserverResult) {}) - - require.NotNil(t, err) - require.NotNil(t, observer.AsyncImpl()) -} - -func TestNilCallbackObserverNoop(t *testing.T) { - // Tests that a nil callback yields a no-op observer without error. - _, meter := testPair() - - observer := Must(meter).NewInt64GaugeObserver("test.observer", nil) - - impl := observer.AsyncImpl().Implementation() - desc := observer.AsyncImpl().Descriptor() - require.Equal(t, nil, impl) - require.Equal(t, "", desc.Name()) -} diff --git a/metric/metrictest/meter.go b/metric/metrictest/meter.go deleted file mode 100644 index 759bb04baec..00000000000 --- a/metric/metrictest/meter.go +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest // import "go.opentelemetry.io/otel/metric/metrictest" - -import ( - "context" - "sync" - "testing" - - "go.opentelemetry.io/otel/attribute" - internalmetric "go.opentelemetry.io/otel/internal/metric" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" -) - -type ( - Handle struct { - Instrument *Sync - Labels []attribute.KeyValue - } - - // Library is the same as "sdk/instrumentation".Library but there is - // a package cycle to use it. - Library struct { - InstrumentationName string - InstrumentationVersion string - SchemaURL string - } - - Batch struct { - // Measurement needs to be aligned for 64-bit atomic operations. - Measurements []Measurement - Ctx context.Context - Labels []attribute.KeyValue - Library Library - } - - // MeterImpl is an OpenTelemetry Meter implementation used for testing. - MeterImpl struct { - library Library - provider *MeterProvider - asyncInstruments *internalmetric.AsyncInstrumentState - } - - // MeterProvider is a collection of named MeterImpls used for testing. - MeterProvider struct { - lock sync.Mutex - - MeasurementBatches []Batch - impls []*MeterImpl - } - - Measurement struct { - // Number needs to be aligned for 64-bit atomic operations. - Number number.Number - Instrument sdkapi.InstrumentImpl - } - - Instrument struct { - meter *MeterImpl - descriptor sdkapi.Descriptor - } - - Async struct { - Instrument - - runner sdkapi.AsyncRunner - } - - Sync struct { - Instrument - } -) - -var ( - _ sdkapi.SyncImpl = &Sync{} - _ sdkapi.MeterImpl = &MeterImpl{} - _ sdkapi.AsyncImpl = &Async{} -) - -// NewDescriptor is a test helper for constructing test metric -// descriptors using standard options. -func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...metric.InstrumentOption) sdkapi.Descriptor { - cfg := metric.NewInstrumentConfig(opts...) - return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()) -} - -func (i Instrument) Descriptor() sdkapi.Descriptor { - return i.descriptor -} - -func (a *Async) Implementation() interface{} { - return a -} - -func (s *Sync) Implementation() interface{} { - return s -} - -func (s *Sync) RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) { - s.meter.doRecordSingle(ctx, labels, s, number) -} - -func (h *Handle) RecordOne(ctx context.Context, number number.Number) { - h.Instrument.meter.doRecordSingle(ctx, h.Labels, h.Instrument, number) -} - -func (h *Handle) Unbind() { -} - -func (m *MeterImpl) doRecordSingle(ctx context.Context, labels []attribute.KeyValue, instrument sdkapi.InstrumentImpl, number number.Number) { - m.collect(ctx, labels, []Measurement{{ - Instrument: instrument, - Number: number, - }}) -} - -// NewMeterProvider returns a MeterProvider suitable for testing. -// When the test is complete, consult MeterProvider.MeasurementBatches. -func NewMeterProvider() *MeterProvider { - return &MeterProvider{} -} - -// Meter implements metric.MeterProvider. -func (p *MeterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { - p.lock.Lock() - defer p.lock.Unlock() - cfg := metric.NewMeterConfig(opts...) - impl := &MeterImpl{ - library: Library{ - InstrumentationName: name, - InstrumentationVersion: cfg.InstrumentationVersion(), - SchemaURL: cfg.SchemaURL(), - }, - provider: p, - asyncInstruments: internalmetric.NewAsyncInstrumentState(), - } - p.impls = append(p.impls, impl) - return metric.WrapMeterImpl(impl) -} - -// NewSyncInstrument implements sdkapi.MeterImpl. -func (m *MeterImpl) NewSyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - return &Sync{ - Instrument{ - descriptor: descriptor, - meter: m, - }, - }, nil -} - -// NewAsyncInstrument implements sdkapi.MeterImpl. -func (m *MeterImpl) NewAsyncInstrument(descriptor sdkapi.Descriptor, runner sdkapi.AsyncRunner) (sdkapi.AsyncImpl, error) { - a := &Async{ - Instrument: Instrument{ - descriptor: descriptor, - meter: m, - }, - runner: runner, - } - m.provider.registerAsyncInstrument(a, m, runner) - return a, nil -} - -// RecordBatch implements sdkapi.MeterImpl. -func (m *MeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurements ...sdkapi.Measurement) { - mm := make([]Measurement, len(measurements)) - for i := 0; i < len(measurements); i++ { - m := measurements[i] - mm[i] = Measurement{ - Instrument: m.SyncImpl().Implementation().(*Sync), - Number: m.Number(), - } - } - m.collect(ctx, labels, mm) -} - -// CollectAsync is called from asyncInstruments.Run() with the lock held. -func (m *MeterImpl) CollectAsync(labels []attribute.KeyValue, obs ...sdkapi.Observation) { - mm := make([]Measurement, len(obs)) - for i := 0; i < len(obs); i++ { - o := obs[i] - mm[i] = Measurement{ - Instrument: o.AsyncImpl(), - Number: o.Number(), - } - } - m.collect(context.Background(), labels, mm) -} - -// collect is called from CollectAsync() or RecordBatch() with the lock held. -func (m *MeterImpl) collect(ctx context.Context, labels []attribute.KeyValue, measurements []Measurement) { - m.provider.addMeasurement(Batch{ - Ctx: ctx, - Labels: labels, - Measurements: measurements, - Library: m.library, - }) -} - -// registerAsyncInstrument locks the provider and registers the new Async instrument. -func (p *MeterProvider) registerAsyncInstrument(a *Async, m *MeterImpl, runner sdkapi.AsyncRunner) { - p.lock.Lock() - defer p.lock.Unlock() - - m.asyncInstruments.Register(a, runner) -} - -// addMeasurement locks the provider and adds the new measurement batch. -func (p *MeterProvider) addMeasurement(b Batch) { - p.lock.Lock() - defer p.lock.Unlock() - p.MeasurementBatches = append(p.MeasurementBatches, b) -} - -// copyImpls locks the provider and copies the current list of *MeterImpls. -func (p *MeterProvider) copyImpls() []*MeterImpl { - p.lock.Lock() - defer p.lock.Unlock() - cpy := make([]*MeterImpl, len(p.impls)) - copy(cpy, p.impls) - return cpy -} - -// RunAsyncInstruments is used in tests to trigger collection from -// asynchronous instruments. -func (p *MeterProvider) RunAsyncInstruments() { - for _, impl := range p.copyImpls() { - impl.asyncInstruments.Run(context.Background(), impl) - } -} - -// Measured is the helper struct which provides flat representation of recorded measurements -// to simplify testing -type Measured struct { - Name string - Labels map[attribute.Key]attribute.Value - Number number.Number - Library Library -} - -// LabelsToMap converts label set to keyValue map, to be easily used in tests -func LabelsToMap(kvs ...attribute.KeyValue) map[attribute.Key]attribute.Value { - m := map[attribute.Key]attribute.Value{} - for _, label := range kvs { - m[label.Key] = label.Value - } - return m -} - -// AsStructs converts recorded batches to array of flat, readable Measured helper structures -func AsStructs(batches []Batch) []Measured { - var r []Measured - for _, batch := range batches { - for _, m := range batch.Measurements { - r = append(r, Measured{ - Name: m.Instrument.Descriptor().Name(), - Labels: LabelsToMap(batch.Labels...), - Number: m.Number, - Library: batch.Library, - }) - } - } - return r -} - -// ResolveNumberByKind takes defined metric descriptor creates a concrete typed metric number -func ResolveNumberByKind(t *testing.T, kind number.Kind, value float64) number.Number { - t.Helper() - switch kind { - case number.Int64Kind: - return number.NewInt64Number(int64(value)) - case number.Float64Kind: - return number.NewFloat64Number(value) - } - panic("invalid number kind") -} diff --git a/metric/nonrecording/instruments.go b/metric/nonrecording/instruments.go new file mode 100644 index 00000000000..84a6aa89c31 --- /dev/null +++ b/metric/nonrecording/instruments.go @@ -0,0 +1,138 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nonrecording // import "go.opentelemetry.io/otel/metric/nonrecording" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +type nonrecordingAsyncFloat64Instrument struct { + instrument.Asynchronous +} + +var ( + _ asyncfloat64.InstrumentProvider = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} +) + +func (n nonrecordingAsyncFloat64Instrument) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { + return n, nil +} + +func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + return n, nil +} + +func (n nonrecordingAsyncFloat64Instrument) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { + return n, nil +} + +func (nonrecordingAsyncFloat64Instrument) Observe(context.Context, float64, ...attribute.KeyValue) { + +} + +type nonrecordingAsyncInt64Instrument struct { + instrument.Asynchronous +} + +var ( + _ asyncint64.InstrumentProvider = nonrecordingAsyncInt64Instrument{} + _ asyncint64.Counter = nonrecordingAsyncInt64Instrument{} + _ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{} + _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} +) + +func (n nonrecordingAsyncInt64Instrument) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + return n, nil +} + +func (n nonrecordingAsyncInt64Instrument) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { + return n, nil +} + +func (n nonrecordingAsyncInt64Instrument) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { + return n, nil +} + +func (nonrecordingAsyncInt64Instrument) Observe(context.Context, int64, ...attribute.KeyValue) { +} + +type nonrecordingSyncFloat64Instrument struct { + instrument.Synchronous +} + +var ( + _ syncfloat64.InstrumentProvider = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} +) + +func (n nonrecordingSyncFloat64Instrument) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { + return n, nil +} + +func (n nonrecordingSyncFloat64Instrument) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { + return n, nil +} + +func (n nonrecordingSyncFloat64Instrument) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { + return n, nil +} + +func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) { + +} + +func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) { + +} + +type nonrecordingSyncInt64Instrument struct { + instrument.Synchronous +} + +var ( + _ syncint64.InstrumentProvider = nonrecordingSyncInt64Instrument{} + _ syncint64.Counter = nonrecordingSyncInt64Instrument{} + _ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{} + _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} +) + +func (n nonrecordingSyncInt64Instrument) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { + return n, nil +} + +func (n nonrecordingSyncInt64Instrument) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { + return n, nil +} + +func (n nonrecordingSyncInt64Instrument) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { + return n, nil +} + +func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) { +} +func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) { +} diff --git a/metric/nonrecording/meter.go b/metric/nonrecording/meter.go new file mode 100644 index 00000000000..2acea49d8a1 --- /dev/null +++ b/metric/nonrecording/meter.go @@ -0,0 +1,64 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package nonrecording // import "go.opentelemetry.io/otel/metric/nonrecording" + +import ( + "context" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. +func NewNoopMeterProvider() metric.MeterProvider { + return noopMeterProvider{} +} + +type noopMeterProvider struct{} + +var _ metric.MeterProvider = noopMeterProvider{} + +func (noopMeterProvider) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { + return noopMeter{} +} + +// NewNoopMeter creates a Meter that does not record any metrics. +func NewNoopMeter() metric.Meter { + return noopMeter{} +} + +type noopMeter struct{} + +var _ metric.Meter = noopMeter{} + +func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { + return nonrecordingAsyncInt64Instrument{} +} +func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { + return nonrecordingAsyncFloat64Instrument{} +} +func (noopMeter) SyncInt64() syncint64.InstrumentProvider { + return nonrecordingSyncInt64Instrument{} +} +func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { + return nonrecordingSyncFloat64Instrument{} +} +func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error { + return nil +} diff --git a/metric/noop.go b/metric/noop.go deleted file mode 100644 index 37c653f51a1..00000000000 --- a/metric/noop.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -type noopMeterProvider struct{} - -// NewNoopMeterProvider returns an implementation of MeterProvider that -// performs no operations. The Meter and Instrument created from the returned -// MeterProvider also perform no operations. -func NewNoopMeterProvider() MeterProvider { - return noopMeterProvider{} -} - -var _ MeterProvider = noopMeterProvider{} - -func (noopMeterProvider) Meter(instrumentationName string, opts ...MeterOption) Meter { - return Meter{} -} diff --git a/sdk/export/metric/aggregation/aggregation.go b/sdk/export/metric/aggregation/aggregation.go index 09b20306051..702c5b2bc82 100644 --- a/sdk/export/metric/aggregation/aggregation.go +++ b/sdk/export/metric/aggregation/aggregation.go @@ -15,8 +15,8 @@ package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" import ( - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" ) // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 8f728464774..415e71a87f9 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -41,7 +41,6 @@ replace go.opentelemetry.io/otel/trace => ../../../trace require ( go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/sdk/export/metric/metric.go b/sdk/export/metric/metric.go index 00d3f67b3bc..b3dccccd9dc 100644 --- a/sdk/export/metric/metric.go +++ b/sdk/export/metric/metric.go @@ -18,10 +18,10 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" diff --git a/sdk/metric/aggregator/aggregator.go b/sdk/metric/aggregator/aggregator.go index 85d2b3fbdb3..59d42b1a80a 100644 --- a/sdk/metric/aggregator/aggregator.go +++ b/sdk/metric/aggregator/aggregator.go @@ -19,9 +19,9 @@ import ( "fmt" "math" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // Aggregator implements a specific aggregation behavior, e.g., a diff --git a/sdk/metric/aggregator/aggregator_test.go b/sdk/metric/aggregator/aggregator_test.go index bf405b5c3f8..aab8393c932 100644 --- a/sdk/metric/aggregator/aggregator_test.go +++ b/sdk/metric/aggregator/aggregator_test.go @@ -21,13 +21,13 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) func TestInconsistentAggregatorErr(t *testing.T) { diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go index 2d2a197e635..b9ea62da9bd 100644 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ b/sdk/metric/aggregator/aggregatortest/test.go @@ -26,11 +26,11 @@ import ( "github.com/stretchr/testify/require" ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) const Magnitude = 1000 diff --git a/sdk/metric/aggregator/histogram/benchmark_test.go b/sdk/metric/aggregator/histogram/benchmark_test.go index 4902c11b7e5..597af3eb714 100644 --- a/sdk/metric/aggregator/histogram/benchmark_test.go +++ b/sdk/metric/aggregator/histogram/benchmark_test.go @@ -19,10 +19,10 @@ import ( "math/rand" "testing" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) const inputRange = 1e6 diff --git a/sdk/metric/aggregator/histogram/histogram.go b/sdk/metric/aggregator/histogram/histogram.go index 142ca24ebef..f4d94b38c5e 100644 --- a/sdk/metric/aggregator/histogram/histogram.go +++ b/sdk/metric/aggregator/histogram/histogram.go @@ -19,10 +19,10 @@ import ( "sort" "sync" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // Note: This code uses a Mutex to govern access to the exclusive diff --git a/sdk/metric/aggregator/histogram/histogram_test.go b/sdk/metric/aggregator/histogram/histogram_test.go index 00acf2e772d..b22bd149e5e 100644 --- a/sdk/metric/aggregator/histogram/histogram_test.go +++ b/sdk/metric/aggregator/histogram/histogram_test.go @@ -23,11 +23,11 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) const count = 100 diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go index 59a7ac8236a..7e88f6b8db3 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue.go @@ -20,10 +20,10 @@ import ( "time" "unsafe" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( diff --git a/sdk/metric/aggregator/lastvalue/lastvalue_test.go b/sdk/metric/aggregator/lastvalue/lastvalue_test.go index 3d105a75cd2..16f9614c25a 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue_test.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue_test.go @@ -25,11 +25,11 @@ import ( "github.com/stretchr/testify/require" ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) const count = 100 diff --git a/sdk/metric/aggregator/sum/sum.go b/sdk/metric/aggregator/sum/sum.go index be3c6dfff89..d5c70e59bdf 100644 --- a/sdk/metric/aggregator/sum/sum.go +++ b/sdk/metric/aggregator/sum/sum.go @@ -17,10 +17,10 @@ package sum // import "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" import ( "context" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // Aggregator aggregates counter events. diff --git a/sdk/metric/aggregator/sum/sum_test.go b/sdk/metric/aggregator/sum/sum_test.go index 59480e2c8cc..c92594a460c 100644 --- a/sdk/metric/aggregator/sum/sum_test.go +++ b/sdk/metric/aggregator/sum/sum_test.go @@ -22,10 +22,10 @@ import ( "github.com/stretchr/testify/require" ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) const count = 100 diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index c4ecf306293..fd5f49bd1ef 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -22,11 +22,13 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" sdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type benchFixture struct { @@ -44,7 +46,7 @@ func newFixture(b *testing.B) *benchFixture { } bf.accumulator = sdk.NewAccumulator(bf) - bf.meter = metric.WrapMeterImpl(bf.accumulator) + bf.meter = sdkapi.WrapMeterImpl(bf.accumulator) return bf } @@ -56,8 +58,33 @@ func (f *benchFixture) Meter(_ string, _ ...metric.MeterOption) metric.Meter { return f.meter } -func (f *benchFixture) meterMust() metric.MeterMust { - return metric.Must(f.meter) +func (f *benchFixture) iCounter(name string) syncint64.Counter { + ctr, err := f.meter.SyncInt64().Counter(name) + if err != nil { + f.B.Error(err) + } + return ctr +} +func (f *benchFixture) fCounter(name string) syncfloat64.Counter { + ctr, err := f.meter.SyncFloat64().Counter(name) + if err != nil { + f.B.Error(err) + } + return ctr +} +func (f *benchFixture) iHistogram(name string) syncint64.Histogram { + ctr, err := f.meter.SyncInt64().Histogram(name) + if err != nil { + f.B.Error(err) + } + return ctr +} +func (f *benchFixture) fHistogram(name string) syncfloat64.Histogram { + ctr, err := f.meter.SyncFloat64().Histogram(name) + if err != nil { + f.B.Error(err) + } + return ctr } func makeLabels(n int) []attribute.KeyValue { @@ -81,7 +108,7 @@ func benchmarkLabels(b *testing.B, n int) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(n) - cnt := fix.meterMust().NewInt64Counter("int64.sum") + cnt := fix.iCounter("int64.sum") b.ResetTimer() @@ -154,31 +181,33 @@ func BenchmarkIterator_16(b *testing.B) { // Counters -func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { - // Compare with BenchmarkInt64CounterAdd() to see overhead of global - // package. This is in the SDK to avoid the API from depending on the - // SDK. - ctx := context.Background() - fix := newFixture(b) +// TODO readd global - sdk := global.Meter("test") - global.SetMeterProvider(fix) +// func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { +// // Compare with BenchmarkInt64CounterAdd() to see overhead of global +// // package. This is in the SDK to avoid the API from depending on the +// // SDK. +// ctx := context.Background() +// fix := newFixture(b) - labs := []attribute.KeyValue{attribute.String("A", "B")} - cnt := Must(sdk).NewInt64Counter("int64.sum") +// sdk := global.Meter("test") +// global.SetMeterProvider(fix) - b.ResetTimer() +// labs := []attribute.KeyValue{attribute.String("A", "B")} +// cnt := Must(sdk).NewInt64Counter("int64.sum") - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} +// b.ResetTimer() + +// for i := 0; i < b.N; i++ { +// cnt.Add(ctx, 1, labs...) +// } +// } func BenchmarkInt64CounterAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - cnt := fix.meterMust().NewInt64Counter("int64.sum") + cnt := fix.iCounter("int64.sum") b.ResetTimer() @@ -191,7 +220,7 @@ func BenchmarkFloat64CounterAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - cnt := fix.meterMust().NewFloat64Counter("float64.sum") + cnt := fix.fCounter("float64.sum") b.ResetTimer() @@ -206,7 +235,7 @@ func BenchmarkInt64LastValueAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewInt64Histogram("int64.lastvalue") + mea := fix.iHistogram("int64.lastvalue") b.ResetTimer() @@ -219,7 +248,7 @@ func BenchmarkFloat64LastValueAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewFloat64Histogram("float64.lastvalue") + mea := fix.fHistogram("float64.lastvalue") b.ResetTimer() @@ -234,7 +263,7 @@ func BenchmarkInt64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewInt64Histogram("int64.histogram") + mea := fix.iHistogram("int64.histogram") b.ResetTimer() @@ -247,7 +276,7 @@ func BenchmarkFloat64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - mea := fix.meterMust().NewFloat64Histogram("float64.histogram") + mea := fix.fHistogram("float64.histogram") b.ResetTimer() @@ -264,12 +293,12 @@ func BenchmarkObserverRegistration(b *testing.B) { for i := 0; i < b.N; i++ { names = append(names, fmt.Sprintf("test.%d.lastvalue", i)) } - cb := func(_ context.Context, result metric.Int64ObserverResult) {} b.ResetTimer() for i := 0; i < b.N; i++ { - fix.meterMust().NewInt64GaugeObserver(names[i], cb) + ctr, _ := fix.meter.AsyncInt64().Counter(names[i]) + _ = fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(context.Context) {}) } } @@ -277,11 +306,16 @@ func BenchmarkGaugeObserverObservationInt64(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - _ = fix.meterMust().NewInt64GaugeObserver("test.lastvalue", func(_ context.Context, result metric.Int64ObserverResult) { + ctr, _ := fix.meter.AsyncInt64().Counter("test.lastvalue") + err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { for i := 0; i < b.N; i++ { - result.Observe((int64)(i), labs...) + ctr.Observe(ctx, (int64)(i), labs...) } }) + if err != nil { + b.Errorf("could not register callback: %v", err) + b.FailNow() + } b.ResetTimer() @@ -292,11 +326,16 @@ func BenchmarkGaugeObserverObservationFloat64(b *testing.B) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(1) - _ = fix.meterMust().NewFloat64GaugeObserver("test.lastvalue", func(_ context.Context, result metric.Float64ObserverResult) { + ctr, _ := fix.meter.AsyncFloat64().Counter("test.lastvalue") + err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { for i := 0; i < b.N; i++ { - result.Observe((float64)(i), labs...) + ctr.Observe(ctx, (float64)(i), labs...) } }) + if err != nil { + b.Errorf("could not register callback: %v", err) + b.FailNow() + } b.ResetTimer() @@ -310,17 +349,18 @@ func benchmarkBatchRecord8Labels(b *testing.B, numInst int) { ctx := context.Background() fix := newFixture(b) labs := makeLabels(numLabels) - var meas []sdkapi.Measurement + var meas []syncint64.Counter for i := 0; i < numInst; i++ { - inst := fix.meterMust().NewInt64Counter(fmt.Sprintf("int64.%d.sum", i)) - meas = append(meas, inst.Measurement(1)) + meas = append(meas, fix.iCounter(fmt.Sprintf("int64.%d.sum", i))) } b.ResetTimer() for i := 0; i < b.N; i++ { - fix.accumulator.RecordBatch(ctx, labs, meas...) + for _, ctr := range meas { + ctr.Add(ctx, 1, labs...) + } } } @@ -346,7 +386,7 @@ func BenchmarkRepeatedDirectCalls(b *testing.B) { ctx := context.Background() fix := newFixture(b) - c := fix.meterMust().NewInt64Counter("int64.sum") + c := fix.iCounter("int64.sum") k := attribute.String("bench", "true") b.ResetTimer() diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index ee694056228..de0da5484c9 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -21,12 +21,13 @@ import ( "time" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/internal/metric/registry" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" sdk "go.opentelemetry.io/otel/sdk/metric" controllerTime "go.opentelemetry.io/otel/sdk/metric/controller/time" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/registry" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -99,7 +100,7 @@ func (c *Controller) Meter(instrumentationName string, opts ...metric.MeterOptio library: library, })) } - return metric.WrapMeterImpl(m.(*registry.UniqueInstrumentMeterImpl)) + return sdkapi.WrapMeterImpl(m.(*registry.UniqueInstrumentMeterImpl)) } type accumulatorCheckpointer struct { @@ -108,6 +109,8 @@ type accumulatorCheckpointer struct { library instrumentation.Library } +var _ sdkapi.MeterImpl = &accumulatorCheckpointer{} + // New constructs a Controller using the provided checkpointer factory // and options (including optional exporter) to configure a metric // export pipeline. diff --git a/sdk/metric/controller/basic/controller_test.go b/sdk/metric/controller/basic/controller_test.go index 503a278148c..26dcf4bb286 100644 --- a/sdk/metric/controller/basic/controller_test.go +++ b/sdk/metric/controller/basic/controller_test.go @@ -25,8 +25,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" @@ -34,6 +33,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/export/aggregation" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -127,7 +127,7 @@ func TestControllerUsesResource(t *testing.T) { ctx := context.Background() require.NoError(t, cont.Start(ctx)) - ctr := metric.Must(cont.Meter("named")).NewFloat64Counter("calls.sum") + ctr, _ := cont.Meter("named").SyncFloat64().Counter("calls.sum") ctr.Add(context.Background(), 1.) // Collect once @@ -152,16 +152,19 @@ func TestStartNoExporter(t *testing.T) { ) mock := controllertest.NewMockClock() cont.SetClock(mock) + meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#StartNoExporter") calls := int64(0) - _ = metric.Must(cont.Meter("named")).NewInt64CounterObserver("calls.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - calls++ - checkTestContext(t, ctx) - result.Observe(calls, attribute.String("A", "B")) - }, - ) + counterObserver, err := meter.AsyncInt64().Counter("calls.lastvalue") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + calls++ + checkTestContext(t, ctx) + counterObserver.Observe(ctx, calls, attribute.String("A", "B")) + }) + require.NoError(t, err) // Collect() has not been called. The controller is unstarted. expect := map[string]float64{} @@ -220,18 +223,22 @@ func TestObserverCanceled(t *testing.T) { controller.WithCollectTimeout(time.Millisecond), controller.WithResource(resource.Empty()), ) + meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ObserverCanceled") calls := int64(0) - _ = metric.Must(cont.Meter("named")).NewInt64CounterObserver("done.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - <-ctx.Done() - calls++ - result.Observe(calls) - }, - ) + counterObserver, err := meter.AsyncInt64().Counter("done.lastvalue") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + <-ctx.Done() + calls++ + counterObserver.Observe(ctx, calls) + }) + require.NoError(t, err) + // This relies on the context timing out - err := cont.Collect(context.Background()) + err = cont.Collect(context.Background()) require.Error(t, err) require.True(t, errors.Is(err, context.DeadlineExceeded)) @@ -251,14 +258,18 @@ func TestObserverContext(t *testing.T) { controller.WithCollectTimeout(0), controller.WithResource(resource.Empty()), ) + meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ObserverContext") + + counterObserver, err := meter.AsyncInt64().Counter("done.lastvalue") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + time.Sleep(10 * time.Millisecond) + checkTestContext(t, ctx) + counterObserver.Observe(ctx, 1) + }) + require.NoError(t, err) - _ = metric.Must(cont.Meter("named")).NewInt64CounterObserver("done.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - time.Sleep(10 * time.Millisecond) - checkTestContext(t, ctx) - result.Observe(1) - }, - ) ctx := testContext() require.NoError(t, cont.Collect(ctx)) @@ -314,14 +325,17 @@ func TestExportTimeout(t *testing.T) { ) mock := controllertest.NewMockClock() cont.SetClock(mock) + meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ExportTimeout") calls := int64(0) - _ = metric.Must(cont.Meter("named")).NewInt64CounterObserver("one.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - calls++ - result.Observe(calls) - }, - ) + counterObserver, err := meter.AsyncInt64().Counter("one.lastvalue") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + calls++ + counterObserver.Observe(ctx, calls) + }) + require.NoError(t, err) require.NoError(t, cont.Start(context.Background())) @@ -332,7 +346,7 @@ func TestExportTimeout(t *testing.T) { // Collect after 1s, timeout mock.Add(time.Second) - err := testHandler.Flush() + err = testHandler.Flush() require.Error(t, err) require.True(t, errors.Is(err, context.DeadlineExceeded)) @@ -369,13 +383,17 @@ func TestCollectAfterStopThenStartAgain(t *testing.T) { mock := controllertest.NewMockClock() cont.SetClock(mock) + meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#CollectAfterStopThenStartAgain") + calls := 0 - _ = metric.Must(cont.Meter("named")).NewInt64CounterObserver("one.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - calls++ - result.Observe(int64(calls)) - }, - ) + counterObserver, err := meter.AsyncInt64().Counter("one.lastvalue") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + calls++ + counterObserver.Observe(ctx, int64(calls)) + }) + require.NoError(t, err) // No collections happen (because mock clock does not advance): require.NoError(t, cont.Start(context.Background())) @@ -403,7 +421,7 @@ func TestCollectAfterStopThenStartAgain(t *testing.T) { // explicit collection should still fail. require.NoError(t, cont.Start(context.Background())) require.True(t, cont.IsRunning()) - err := cont.Collect(context.Background()) + err = cont.Collect(context.Background()) require.Error(t, err) require.Equal(t, controller.ErrControllerStarted, err) @@ -452,10 +470,10 @@ func TestRegistryFunction(t *testing.T) { require.NotNil(t, m1) require.Equal(t, m1, m2) - c1, err := m1.NewInt64Counter("counter.sum") + c1, err := m1.SyncInt64().Counter("counter.sum") require.NoError(t, err) - c2, err := m1.NewInt64Counter("counter.sum") + c2, err := m1.SyncInt64().Counter("counter.sum") require.NoError(t, err) require.Equal(t, c1, c2) diff --git a/sdk/metric/controller/basic/pull_test.go b/sdk/metric/controller/basic/pull_test.go index 96d1e1adad1..2284e68a71d 100644 --- a/sdk/metric/controller/basic/pull_test.go +++ b/sdk/metric/controller/basic/pull_test.go @@ -23,7 +23,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" @@ -45,7 +44,8 @@ func TestPullNoCollect(t *testing.T) { ctx := context.Background() meter := puller.Meter("nocache") - counter := metric.Must(meter).NewInt64Counter("counter.sum") + counter, err := meter.SyncInt64().Counter("counter.sum") + require.NoError(t, err) counter.Add(ctx, 10, attribute.String("A", "B")) @@ -83,7 +83,8 @@ func TestPullWithCollect(t *testing.T) { ctx := context.Background() meter := puller.Meter("nocache") - counter := metric.Must(meter).NewInt64Counter("counter.sum") + counter, err := meter.SyncInt64().Counter("counter.sum") + require.NoError(t, err) counter.Add(ctx, 10, attribute.String("A", "B")) diff --git a/sdk/metric/controller/basic/push_test.go b/sdk/metric/controller/basic/push_test.go index 0a6679b29de..67bbddfdc84 100644 --- a/sdk/metric/controller/basic/push_test.go +++ b/sdk/metric/controller/basic/push_test.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" "go.opentelemetry.io/otel/sdk/metric/export" @@ -117,7 +116,8 @@ func TestPushTicker(t *testing.T) { ctx := context.Background() - counter := metric.Must(meter).NewInt64Counter("counter.sum") + counter, err := meter.SyncInt64().Counter("counter.sum") + require.NoError(t, err) require.NoError(t, p.Start(ctx)) @@ -197,8 +197,10 @@ func TestPushExportError(t *testing.T) { ctx := context.Background() meter := p.Meter("name") - counter1 := metric.Must(meter).NewInt64Counter("counter1.sum") - counter2 := metric.Must(meter).NewInt64Counter("counter2.sum") + counter1, err := meter.SyncInt64().Counter("counter1.sum") + require.NoError(t, err) + counter2, err := meter.SyncInt64().Counter("counter2.sum") + require.NoError(t, err) require.NoError(t, p.Start(ctx)) runtime.Gosched() diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index 25e7fc60875..1b24a209c76 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -26,16 +26,17 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/nonrecording" metricsdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) -var Must = metric.Must - type handler struct { sync.Mutex err error @@ -88,7 +89,7 @@ func newSDK(t *testing.T) (metric.Meter, *metricsdk.Accumulator, *testSelector, accum := metricsdk.NewAccumulator( processor, ) - meter := metric.WrapMeterImpl(accum) + meter := sdkapi.WrapMeterImpl(accum) return meter, accum, testSelector, processor } @@ -96,7 +97,8 @@ func TestInputRangeCounter(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - counter := Must(meter).NewInt64Counter("name.sum") + counter, err := meter.SyncInt64().Counter("name.sum") + require.NoError(t, err) counter.Add(ctx, -1) require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) @@ -118,7 +120,8 @@ func TestInputRangeUpDownCounter(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - counter := Must(meter).NewInt64UpDownCounter("name.sum") + counter, err := meter.SyncInt64().UpDownCounter("name.sum") + require.NoError(t, err) counter.Add(ctx, -1) counter.Add(ctx, -1) @@ -137,7 +140,8 @@ func TestInputRangeHistogram(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - histogram := Must(meter).NewFloat64Histogram("name.histogram") + histogram, err := meter.SyncFloat64().Histogram("name.histogram") + require.NoError(t, err) histogram.Record(ctx, math.NaN()) require.Equal(t, aggregation.ErrNaNInput, testHandler.Flush()) @@ -162,7 +166,8 @@ func TestDisabledInstrument(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - histogram := Must(meter).NewFloat64Histogram("name.disabled") + histogram, err := meter.SyncFloat64().Histogram("name.disabled") + require.NoError(t, err) histogram.Record(ctx, -1) checkpointed := sdk.Collect(ctx) @@ -175,7 +180,8 @@ func TestRecordNaN(t *testing.T) { ctx := context.Background() meter, _, _, _ := newSDK(t) - c := Must(meter).NewFloat64Counter("name.sum") + c, err := meter.SyncFloat64().Counter("name.sum") + require.NoError(t, err) require.Nil(t, testHandler.Flush()) c.Add(ctx, math.NaN()) @@ -186,7 +192,8 @@ func TestSDKLabelsDeduplication(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - counter := Must(meter).NewInt64Counter("name.sum") + counter, err := meter.SyncInt64().Counter("name.sum") + require.NoError(t, err) const ( maxKeys = 21 @@ -277,48 +284,86 @@ func TestObserverCollection(t *testing.T) { meter, sdk, _, processor := newSDK(t) mult := 1 - _ = Must(meter).NewFloat64GaugeObserver("float.gauge.lastvalue", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(float64(mult), attribute.String("A", "B")) + gaugeF, err := meter.AsyncFloat64().Gauge("float.gauge.lastvalue") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + gaugeF, + }, func(ctx context.Context) { + gaugeF.Observe(ctx, float64(mult), attribute.String("A", "B")) // last value wins - result.Observe(float64(-mult), attribute.String("A", "B")) - result.Observe(float64(-mult), attribute.String("C", "D")) + gaugeF.Observe(ctx, float64(-mult), attribute.String("A", "B")) + gaugeF.Observe(ctx, float64(-mult), attribute.String("C", "D")) }) - _ = Must(meter).NewInt64GaugeObserver("int.gauge.lastvalue", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(int64(-mult), attribute.String("A", "B")) - result.Observe(int64(mult)) + require.NoError(t, err) + + gaugeI, err := meter.AsyncInt64().Gauge("int.gauge.lastvalue") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + gaugeI, + }, func(ctx context.Context) { + gaugeI.Observe(ctx, int64(-mult), attribute.String("A", "B")) + gaugeI.Observe(ctx, int64(mult)) // last value wins - result.Observe(int64(mult), attribute.String("A", "B")) - result.Observe(int64(mult)) + gaugeI.Observe(ctx, int64(mult), attribute.String("A", "B")) + gaugeI.Observe(ctx, int64(mult)) }) - - _ = Must(meter).NewFloat64CounterObserver("float.counterobserver.sum", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(float64(mult), attribute.String("A", "B")) - result.Observe(float64(2*mult), attribute.String("A", "B")) - result.Observe(float64(mult), attribute.String("C", "D")) + require.NoError(t, err) + + counterF, err := meter.AsyncFloat64().Counter("float.counterobserver.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + counterF, + }, func(ctx context.Context) { + counterF.Observe(ctx, float64(mult), attribute.String("A", "B")) + counterF.Observe(ctx, float64(2*mult), attribute.String("A", "B")) + counterF.Observe(ctx, float64(mult), attribute.String("C", "D")) }) - _ = Must(meter).NewInt64CounterObserver("int.counterobserver.sum", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(int64(2*mult), attribute.String("A", "B")) - result.Observe(int64(mult)) + require.NoError(t, err) + + counterI, err := meter.AsyncInt64().Counter("int.counterobserver.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + counterI, + }, func(ctx context.Context) { + counterI.Observe(ctx, int64(2*mult), attribute.String("A", "B")) + counterI.Observe(ctx, int64(mult)) // last value wins - result.Observe(int64(mult), attribute.String("A", "B")) - result.Observe(int64(mult)) + counterI.Observe(ctx, int64(mult), attribute.String("A", "B")) + counterI.Observe(ctx, int64(mult)) }) - - _ = Must(meter).NewFloat64UpDownCounterObserver("float.updowncounterobserver.sum", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(float64(mult), attribute.String("A", "B")) - result.Observe(float64(-2*mult), attribute.String("A", "B")) - result.Observe(float64(mult), attribute.String("C", "D")) + require.NoError(t, err) + + updowncounterF, err := meter.AsyncFloat64().UpDownCounter("float.updowncounterobserver.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + updowncounterF, + }, func(ctx context.Context) { + updowncounterF.Observe(ctx, float64(mult), attribute.String("A", "B")) + updowncounterF.Observe(ctx, float64(-2*mult), attribute.String("A", "B")) + updowncounterF.Observe(ctx, float64(mult), attribute.String("C", "D")) }) - _ = Must(meter).NewInt64UpDownCounterObserver("int.updowncounterobserver.sum", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(int64(2*mult), attribute.String("A", "B")) - result.Observe(int64(mult)) + require.NoError(t, err) + + updowncounterI, err := meter.AsyncInt64().UpDownCounter("int.updowncounterobserver.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + updowncounterI, + }, func(ctx context.Context) { + updowncounterI.Observe(ctx, int64(2*mult), attribute.String("A", "B")) + updowncounterI.Observe(ctx, int64(mult)) // last value wins - result.Observe(int64(mult), attribute.String("A", "B")) - result.Observe(int64(-mult)) + updowncounterI.Observe(ctx, int64(mult), attribute.String("A", "B")) + updowncounterI.Observe(ctx, int64(-mult)) }) + require.NoError(t, err) - _ = Must(meter).NewInt64GaugeObserver("empty.gauge.sum", func(_ context.Context, result metric.Int64ObserverResult) { + unused, err := meter.AsyncInt64().Gauge("empty.gauge.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ + unused, + }, func(ctx context.Context) { }) + require.NoError(t, err) for mult = 0; mult < 3; mult++ { processor.Reset() @@ -333,15 +378,15 @@ func TestObserverCollection(t *testing.T) { "int.gauge.lastvalue//": mult, "int.gauge.lastvalue/A=B/": mult, - "float.counterobserver.sum/A=B/": 2 * mult, + "float.counterobserver.sum/A=B/": 3 * mult, "float.counterobserver.sum/C=D/": mult, - "int.counterobserver.sum//": mult, - "int.counterobserver.sum/A=B/": mult, + "int.counterobserver.sum//": 2 * mult, + "int.counterobserver.sum/A=B/": 3 * mult, - "float.updowncounterobserver.sum/A=B/": -2 * mult, + "float.updowncounterobserver.sum/A=B/": -mult, "float.updowncounterobserver.sum/C=D/": mult, - "int.updowncounterobserver.sum//": -mult, - "int.updowncounterobserver.sum/A=B/": mult, + "int.updowncounterobserver.sum//": 0, + "int.updowncounterobserver.sum/A=B/": 3 * mult, }, processor.Values()) } } @@ -351,18 +396,26 @@ func TestCounterObserverInputRange(t *testing.T) { meter, sdk, _, processor := newSDK(t) // TODO: these tests are testing for negative values, not for _descending values_. Fix. - _ = Must(meter).NewFloat64CounterObserver("float.counterobserver.sum", func(_ context.Context, result metric.Float64ObserverResult) { - result.Observe(-2, attribute.String("A", "B")) + counterF, _ := meter.AsyncFloat64().Counter("float.counterobserver.sum") + err := meter.RegisterCallback([]instrument.Asynchronous{ + counterF, + }, func(ctx context.Context) { + counterF.Observe(ctx, -2, attribute.String("A", "B")) require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - result.Observe(-1, attribute.String("C", "D")) + counterF.Observe(ctx, -1, attribute.String("C", "D")) require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) }) - _ = Must(meter).NewInt64CounterObserver("int.counterobserver.sum", func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(-1, attribute.String("A", "B")) + require.NoError(t, err) + counterI, _ := meter.AsyncInt64().Counter("int.counterobserver.sum") + err = meter.RegisterCallback([]instrument.Asynchronous{ + counterI, + }, func(ctx context.Context) { + counterI.Observe(ctx, -1, attribute.String("A", "B")) require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - result.Observe(-1) + counterI.Observe(ctx, -1) require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) }) + require.NoError(t, err) collected := sdk.Collect(ctx) @@ -377,51 +430,43 @@ func TestObserverBatch(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - var floatGaugeObs metric.Float64GaugeObserver - var intGaugeObs metric.Int64GaugeObserver - var floatCounterObs metric.Float64CounterObserver - var intCounterObs metric.Int64CounterObserver - var floatUpDownCounterObs metric.Float64UpDownCounterObserver - var intUpDownCounterObs metric.Int64UpDownCounterObserver - - var batch = Must(meter).NewBatchObserver( - func(_ context.Context, result metric.BatchObserverResult) { - result.Observe( - []attribute.KeyValue{ - attribute.String("A", "B"), - }, - floatGaugeObs.Observation(1), - floatGaugeObs.Observation(-1), - intGaugeObs.Observation(-1), - intGaugeObs.Observation(1), - floatCounterObs.Observation(1000), - intCounterObs.Observation(100), - floatUpDownCounterObs.Observation(-1000), - intUpDownCounterObs.Observation(-100), - ) - result.Observe( - []attribute.KeyValue{ - attribute.String("C", "D"), - }, - floatGaugeObs.Observation(-1), - floatCounterObs.Observation(-1), - floatUpDownCounterObs.Observation(-1), - ) - result.Observe( - nil, - intGaugeObs.Observation(1), - intGaugeObs.Observation(1), - intCounterObs.Observation(10), - floatCounterObs.Observation(1.1), - intUpDownCounterObs.Observation(10), - ) - }) - floatGaugeObs = batch.NewFloat64GaugeObserver("float.gauge.lastvalue") - intGaugeObs = batch.NewInt64GaugeObserver("int.gauge.lastvalue") - floatCounterObs = batch.NewFloat64CounterObserver("float.counterobserver.sum") - intCounterObs = batch.NewInt64CounterObserver("int.counterobserver.sum") - floatUpDownCounterObs = batch.NewFloat64UpDownCounterObserver("float.updowncounterobserver.sum") - intUpDownCounterObs = batch.NewInt64UpDownCounterObserver("int.updowncounterobserver.sum") + floatGaugeObs, _ := meter.AsyncFloat64().Gauge("float.gauge.lastvalue") + intGaugeObs, _ := meter.AsyncInt64().Gauge("int.gauge.lastvalue") + floatCounterObs, _ := meter.AsyncFloat64().Counter("float.counterobserver.sum") + intCounterObs, _ := meter.AsyncInt64().Counter("int.counterobserver.sum") + floatUpDownCounterObs, _ := meter.AsyncFloat64().UpDownCounter("float.updowncounterobserver.sum") + intUpDownCounterObs, _ := meter.AsyncInt64().UpDownCounter("int.updowncounterobserver.sum") + + err := meter.RegisterCallback([]instrument.Asynchronous{ + floatGaugeObs, + intGaugeObs, + floatCounterObs, + intCounterObs, + floatUpDownCounterObs, + intUpDownCounterObs, + }, func(ctx context.Context) { + ab := attribute.String("A", "B") + floatGaugeObs.Observe(ctx, 1, ab) + floatGaugeObs.Observe(ctx, -1, ab) + intGaugeObs.Observe(ctx, -1, ab) + intGaugeObs.Observe(ctx, 1, ab) + floatCounterObs.Observe(ctx, 1000, ab) + intCounterObs.Observe(ctx, 100, ab) + floatUpDownCounterObs.Observe(ctx, -1000, ab) + intUpDownCounterObs.Observe(ctx, -100, ab) + + cd := attribute.String("C", "D") + floatGaugeObs.Observe(ctx, -1, cd) + floatCounterObs.Observe(ctx, -1, cd) + floatUpDownCounterObs.Observe(ctx, -1, cd) + + intGaugeObs.Observe(ctx, 1) + intGaugeObs.Observe(ctx, 1) + intCounterObs.Observe(ctx, 10) + floatCounterObs.Observe(ctx, 1.1) + intUpDownCounterObs.Observe(ctx, 10) + }) + require.NoError(t, err) collected := sdk.Collect(ctx) @@ -445,37 +490,6 @@ func TestObserverBatch(t *testing.T) { }, processor.Values()) } -func TestRecordBatch(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - counter1 := Must(meter).NewInt64Counter("int64.sum") - counter2 := Must(meter).NewFloat64Counter("float64.sum") - histogram1 := Must(meter).NewInt64Histogram("int64.histogram") - histogram2 := Must(meter).NewFloat64Histogram("float64.histogram") - - sdk.RecordBatch( - ctx, - []attribute.KeyValue{ - attribute.String("A", "B"), - attribute.String("C", "D"), - }, - counter1.Measurement(1), - counter2.Measurement(2), - histogram1.Measurement(3), - histogram2.Measurement(4), - ) - - sdk.Collect(ctx) - - require.EqualValues(t, map[string]float64{ - "int64.sum/A=B,C=D/": 1, - "float64.sum/A=B,C=D/": 2, - "int64.histogram/A=B,C=D/": 3, - "float64.histogram/A=B,C=D/": 4, - }, processor.Values()) -} - // TestRecordPersistence ensures that a direct-called instrument that // is repeatedly used each interval results in a persistent record, so // that its encoded labels will be cached across collection intervals. @@ -483,7 +497,9 @@ func TestRecordPersistence(t *testing.T) { ctx := context.Background() meter, sdk, selector, _ := newSDK(t) - c := Must(meter).NewFloat64Counter("name.sum") + c, err := meter.SyncFloat64().Counter("name.sum") + require.NoError(t, err) + uk := attribute.String("bound", "false") for i := 0; i < 100; i++ { @@ -497,51 +513,58 @@ func TestRecordPersistence(t *testing.T) { func TestIncorrectInstruments(t *testing.T) { // The Batch observe/record APIs are susceptible to // uninitialized instruments. - var counter metric.Int64Counter - var observer metric.Int64GaugeObserver + var observer asyncint64.Gauge ctx := context.Background() meter, sdk, _, processor := newSDK(t) // Now try with uninitialized instruments. - meter.RecordBatch(ctx, nil, counter.Measurement(1)) - meter.NewBatchObserver(func(_ context.Context, result metric.BatchObserverResult) { - result.Observe(nil, observer.Observation(1)) + err := meter.RegisterCallback([]instrument.Asynchronous{ + observer, + }, func(ctx context.Context) { + observer.Observe(ctx, 1) }) + require.ErrorIs(t, err, metricsdk.ErrBadInstrument) collected := sdk.Collect(ctx) - require.Equal(t, metricsdk.ErrUninitializedInstrument, testHandler.Flush()) + err = testHandler.Flush() + require.NoError(t, err) require.Equal(t, 0, collected) // Now try with instruments from another SDK. - var noopMeter metric.Meter - counter = metric.Must(noopMeter).NewInt64Counter("name.sum") - observer = metric.Must(noopMeter).NewBatchObserver( - func(context.Context, metric.BatchObserverResult) {}, - ).NewInt64GaugeObserver("observer") - - meter.RecordBatch(ctx, nil, counter.Measurement(1)) - meter.NewBatchObserver(func(_ context.Context, result metric.BatchObserverResult) { - result.Observe(nil, observer.Observation(1)) - }) + noopMeter := nonrecording.NewNoopMeter() + observer, _ = noopMeter.AsyncInt64().Gauge("observer") + + err = meter.RegisterCallback( + []instrument.Asynchronous{observer}, + func(ctx context.Context) { + observer.Observe(ctx, 1) + }, + ) + require.ErrorIs(t, err, metricsdk.ErrBadInstrument) collected = sdk.Collect(ctx) require.Equal(t, 0, collected) require.EqualValues(t, map[string]float64{}, processor.Values()) - require.Equal(t, metricsdk.ErrUninitializedInstrument, testHandler.Flush()) + + err = testHandler.Flush() + require.NoError(t, err) } func TestSyncInAsync(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) - counter := Must(meter).NewFloat64Counter("counter.sum") - _ = Must(meter).NewInt64GaugeObserver("observer.lastvalue", - func(ctx context.Context, result metric.Int64ObserverResult) { - result.Observe(10) - counter.Add(ctx, 100) - }, - ) + counter, _ := meter.SyncFloat64().Counter("counter.sum") + gauge, _ := meter.AsyncInt64().Gauge("observer.lastvalue") + + err := meter.RegisterCallback([]instrument.Asynchronous{ + gauge, + }, func(ctx context.Context) { + gauge.Observe(ctx, 10) + counter.Add(ctx, 100) + }) + require.NoError(t, err) sdk.Collect(ctx) diff --git a/sdk/metric/export/aggregation/aggregation.go b/sdk/metric/export/aggregation/aggregation.go index 44c8c3320e2..ea09fa68344 100644 --- a/sdk/metric/export/aggregation/aggregation.go +++ b/sdk/metric/export/aggregation/aggregation.go @@ -18,7 +18,7 @@ import ( "fmt" "time" - "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/sdk/metric/number" ) // These interfaces describe the various ways to access state from an diff --git a/sdk/metric/export/aggregation/temporality.go b/sdk/metric/export/aggregation/temporality.go index ca71b79d03f..0612fe06af0 100644 --- a/sdk/metric/export/aggregation/temporality.go +++ b/sdk/metric/export/aggregation/temporality.go @@ -17,7 +17,7 @@ package aggregation // import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" import ( - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // Temporality indicates the temporal aggregation exported by an exporter. diff --git a/sdk/metric/export/aggregation/temporality_test.go b/sdk/metric/export/aggregation/temporality_test.go index d5d73e9d049..69b976da773 100644 --- a/sdk/metric/export/aggregation/temporality_test.go +++ b/sdk/metric/export/aggregation/temporality_test.go @@ -19,9 +19,9 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) func TestTemporalityIncludes(t *testing.T) { diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go index 5251a059e1a..7937995e5cc 100644 --- a/sdk/metric/export/metric.go +++ b/sdk/metric/export/metric.go @@ -20,10 +20,10 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index fc70fcf873e..33fda254764 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -42,7 +42,6 @@ require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.0 go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/internal/metric v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk v1.4.1 ) @@ -55,8 +54,6 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../.. replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc diff --git a/sdk/metric/histogram_stress_test.go b/sdk/metric/histogram_stress_test.go index caca662aa0e..abc8b967c60 100644 --- a/sdk/metric/histogram_stress_test.go +++ b/sdk/metric/histogram_stress_test.go @@ -22,10 +22,10 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) func TestStressInt64Histogram(t *testing.T) { diff --git a/metric/metrictest/alignment_test.go b/sdk/metric/metrictest/alignment_test.go similarity index 100% rename from metric/metrictest/alignment_test.go rename to sdk/metric/metrictest/alignment_test.go diff --git a/sdk/metric/metrictest/meter.go b/sdk/metric/metrictest/meter.go new file mode 100644 index 00000000000..8222441e48f --- /dev/null +++ b/sdk/metric/metrictest/meter.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" +) + +type ( + + // Library is the same as "sdk/instrumentation".Library but there is + // a package cycle to use it. + Library struct { + InstrumentationName string + InstrumentationVersion string + SchemaURL string + } + + Batch struct { + // Measurement needs to be aligned for 64-bit atomic operations. + Measurements []Measurement + Ctx context.Context + Labels []attribute.KeyValue + Library Library + } + + Measurement struct { + // Number needs to be aligned for 64-bit atomic operations. + Number number.Number + Instrument sdkapi.InstrumentImpl + } +) + +// NewDescriptor is a test helper for constructing test metric +// descriptors using standard options. +func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor { + cfg := instrument.NewConfig(opts...) + return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()) +} diff --git a/metric/number/doc.go b/sdk/metric/number/doc.go similarity index 92% rename from metric/number/doc.go rename to sdk/metric/number/doc.go index 0649ff875e7..6f947400a4b 100644 --- a/metric/number/doc.go +++ b/sdk/metric/number/doc.go @@ -20,4 +20,4 @@ This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback. */ -package number // import "go.opentelemetry.io/otel/metric/number" +package number // import "go.opentelemetry.io/otel/sdk/metric/number" diff --git a/metric/number/kind_string.go b/sdk/metric/number/kind_string.go similarity index 100% rename from metric/number/kind_string.go rename to sdk/metric/number/kind_string.go diff --git a/metric/number/number.go b/sdk/metric/number/number.go similarity index 99% rename from metric/number/number.go rename to sdk/metric/number/number.go index 3ec95e2014d..5fd2f38f663 100644 --- a/metric/number/number.go +++ b/sdk/metric/number/number.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package number // import "go.opentelemetry.io/otel/metric/number" +package number // import "go.opentelemetry.io/otel/sdk/metric/number" //go:generate stringer -type=Kind diff --git a/metric/number/number_test.go b/sdk/metric/number/number_test.go similarity index 100% rename from metric/number/number_test.go rename to sdk/metric/number/number_test.go diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index 71101bc4bce..096044c043c 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -21,10 +21,10 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go index 1378bf60d6e..80d0e2a20d8 100644 --- a/sdk/metric/processor/basic/basic_test.go +++ b/sdk/metric/processor/basic/basic_test.go @@ -25,19 +25,19 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" sdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -450,15 +450,16 @@ func TestCounterObserverEndToEnd(t *testing.T) { eselector, ) accum := sdk.NewAccumulator(proc) - meter := metric.WrapMeterImpl(accum) + meter := sdkapi.WrapMeterImpl(accum) var calls int64 - metric.Must(meter).NewInt64CounterObserver("observer.sum", - func(_ context.Context, result metric.Int64ObserverResult) { - calls++ - result.Observe(calls) - }, - ) + ctr, err := meter.AsyncInt64().Counter("observer.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + calls++ + ctr.Observe(ctx, calls) + }) + require.NoError(t, err) reader := proc.Reader() var startTime [3]time.Time diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index 6dbad262489..8931fc833f8 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -22,7 +22,6 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" @@ -30,6 +29,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) diff --git a/sdk/metric/processor/processortest/test_test.go b/sdk/metric/processor/processortest/test_test.go index 4cc990c344a..c157ad47e3e 100644 --- a/sdk/metric/processor/processortest/test_test.go +++ b/sdk/metric/processor/processortest/test_test.go @@ -21,33 +21,37 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" metricsdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) -func generateTestData(proc export.Processor) { +func generateTestData(t *testing.T, proc export.Processor) { ctx := context.Background() accum := metricsdk.NewAccumulator(proc) - meter := metric.WrapMeterImpl(accum) + meter := sdkapi.WrapMeterImpl(accum) - counter := metric.Must(meter).NewFloat64Counter("counter.sum") - - _ = metric.Must(meter).NewInt64CounterObserver("observer.sum", - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(10, attribute.String("K1", "V1")) - result.Observe(11, attribute.String("K1", "V2")) - }, - ) + counter, err := meter.SyncFloat64().Counter("counter.sum") + require.NoError(t, err) counter.Add(ctx, 100, attribute.String("K1", "V1")) counter.Add(ctx, 101, attribute.String("K1", "V2")) + counterObserver, err := meter.AsyncInt64().Counter("observer.sum") + require.NoError(t, err) + + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + counterObserver.Observe(ctx, 10, attribute.String("K1", "V1")) + counterObserver.Observe(ctx, 11, attribute.String("K1", "V2")) + }) + require.NoError(t, err) + accum.Collect(ctx) } @@ -60,7 +64,7 @@ func TestProcessorTesting(t *testing.T) { attribute.DefaultEncoder(), ), ) - generateTestData(checkpointer) + generateTestData(t, checkpointer) res := resource.NewSchemaless(attribute.String("R", "V")) expect := map[string]float64{ diff --git a/sdk/metric/processor/reducer/reducer.go b/sdk/metric/processor/reducer/reducer.go index b7fb4894036..d26fd55345e 100644 --- a/sdk/metric/processor/reducer/reducer.go +++ b/sdk/metric/processor/reducer/reducer.go @@ -16,8 +16,8 @@ package reducer // import "go.opentelemetry.io/otel/sdk/metric/processor/reducer import ( "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( diff --git a/sdk/metric/processor/reducer/reducer_test.go b/sdk/metric/processor/reducer/reducer_test.go index 3da65d313ef..22fc774f17e 100644 --- a/sdk/metric/processor/reducer/reducer_test.go +++ b/sdk/metric/processor/reducer/reducer_test.go @@ -21,8 +21,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" metricsdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" @@ -30,6 +29,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/processor/processortest" processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/metric/processor/reducer" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -54,21 +54,22 @@ func (testFilter) LabelFilterFor(_ *sdkapi.Descriptor) attribute.Filter { } } -func generateData(impl sdkapi.MeterImpl) { +func generateData(t *testing.T, impl sdkapi.MeterImpl) { ctx := context.Background() - meter := metric.WrapMeterImpl(impl) - - counter := metric.Must(meter).NewFloat64Counter("counter.sum") - - _ = metric.Must(meter).NewInt64CounterObserver("observer.sum", - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(10, kvs1...) - result.Observe(10, kvs2...) - }, - ) + meter := sdkapi.WrapMeterImpl(impl) + counter, err := meter.SyncFloat64().Counter("counter.sum") + require.NoError(t, err) counter.Add(ctx, 100, kvs1...) counter.Add(ctx, 100, kvs2...) + + counterObserver, err := meter.AsyncInt64().Counter("observer.sum") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { + counterObserver.Observe(ctx, 10, kvs1...) + counterObserver.Observe(ctx, 10, kvs2...) + }) + require.NoError(t, err) } func TestFilterProcessor(t *testing.T) { @@ -79,7 +80,7 @@ func TestFilterProcessor(t *testing.T) { accum := metricsdk.NewAccumulator( reducer.New(testFilter{}, processorTest.NewCheckpointer(testProc)), ) - generateData(accum) + generateData(t, accum) accum.Collect(context.Background()) @@ -97,7 +98,7 @@ func TestFilterBasicProcessor(t *testing.T) { ) exporter := processorTest.New(basicProc, attribute.DefaultEncoder()) - generateData(accum) + generateData(t, accum) basicProc.StartCollection() accum.Collect(context.Background()) diff --git a/internal/metric/registry/doc.go b/sdk/metric/registry/doc.go similarity index 92% rename from internal/metric/registry/doc.go rename to sdk/metric/registry/doc.go index 2f17562f0eb..b401408beef 100644 --- a/internal/metric/registry/doc.go +++ b/sdk/metric/registry/doc.go @@ -21,4 +21,4 @@ This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback. */ -package registry // import "go.opentelemetry.io/otel/internal/metric/registry" +package registry // import "go.opentelemetry.io/otel/sdk/metric/registry" diff --git a/internal/metric/registry/registry.go b/sdk/metric/registry/registry.go similarity index 86% rename from internal/metric/registry/registry.go rename to sdk/metric/registry/registry.go index c929bf45c85..c2870e483d1 100644 --- a/internal/metric/registry/registry.go +++ b/sdk/metric/registry/registry.go @@ -12,15 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -package registry // import "go.opentelemetry.io/otel/internal/metric/registry" +package registry // import "go.opentelemetry.io/otel/sdk/metric/registry" import ( "context" "fmt" "sync" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) // UniqueInstrumentMeterImpl implements the metric.MeterImpl interface, adding @@ -53,11 +53,6 @@ func (u *UniqueInstrumentMeterImpl) MeterImpl() sdkapi.MeterImpl { return u.impl } -// RecordBatch implements sdkapi.MeterImpl. -func (u *UniqueInstrumentMeterImpl) RecordBatch(ctx context.Context, labels []attribute.KeyValue, ms ...sdkapi.Measurement) { - u.impl.RecordBatch(ctx, labels, ms...) -} - // NewMetricKindMismatchError formats an error that describes a // mismatched metric instrument definition. func NewMetricKindMismatchError(desc sdkapi.Descriptor) error { @@ -115,10 +110,7 @@ func (u *UniqueInstrumentMeterImpl) NewSyncInstrument(descriptor sdkapi.Descript } // NewAsyncInstrument implements sdkapi.MeterImpl. -func (u *UniqueInstrumentMeterImpl) NewAsyncInstrument( - descriptor sdkapi.Descriptor, - runner sdkapi.AsyncRunner, -) (sdkapi.AsyncImpl, error) { +func (u *UniqueInstrumentMeterImpl) NewAsyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.AsyncImpl, error) { u.lock.Lock() defer u.lock.Unlock() @@ -130,10 +122,17 @@ func (u *UniqueInstrumentMeterImpl) NewAsyncInstrument( return impl.(sdkapi.AsyncImpl), nil } - asyncInst, err := u.impl.NewAsyncInstrument(descriptor, runner) + asyncInst, err := u.impl.NewAsyncInstrument(descriptor) if err != nil { return nil, err } u.state[descriptor.Name()] = asyncInst return asyncInst, nil } + +func (u *UniqueInstrumentMeterImpl) RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error { + u.lock.Lock() + defer u.lock.Unlock() + + return u.impl.RegisterCallback(insts, callback) +} diff --git a/internal/metric/registry/registry_test.go b/sdk/metric/registry/registry_test.go similarity index 71% rename from internal/metric/registry/registry_test.go rename to sdk/metric/registry/registry_test.go index 04884898822..5d2bc9b108f 100644 --- a/internal/metric/registry/registry_test.go +++ b/sdk/metric/registry/registry_test.go @@ -15,16 +15,15 @@ package registry_test import ( - "context" "errors" "testing" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/internal/metric/registry" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/sdkapi" + metricsdk "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/registry" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( @@ -34,22 +33,22 @@ type ( var ( allNew = map[string]newFunc{ "counter.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewInt64Counter(name)) + return unwrap(m.SyncInt64().Counter(name)) }, "counter.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewFloat64Counter(name)) + return unwrap(m.SyncFloat64().Counter(name)) }, "histogram.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewInt64Histogram(name)) + return unwrap(m.SyncInt64().Histogram(name)) }, "histogram.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewFloat64Histogram(name)) + return unwrap(m.SyncFloat64().Histogram(name)) }, "gaugeobserver.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewInt64GaugeObserver(name, func(context.Context, metric.Int64ObserverResult) {})) + return unwrap(m.AsyncInt64().Gauge(name)) }, "gaugeobserver.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.NewFloat64GaugeObserver(name, func(context.Context, metric.Float64ObserverResult) {})) + return unwrap(m.AsyncFloat64().Gauge(name)) }, } ) @@ -71,10 +70,11 @@ func unwrap(impl interface{}, err error) (sdkapi.InstrumentImpl, error) { return nil, err } +// TODO Replace with controller func testMeterWithRegistry(name string) metric.Meter { - return metric.WrapMeterImpl( + return sdkapi.WrapMeterImpl( registry.NewUniqueInstrumentMeterImpl( - metrictest.NewMeterProvider().Meter(name).MeterImpl(), + metricsdk.NewAccumulator(nil), ), ) } @@ -91,21 +91,6 @@ func TestRegistrySameInstruments(t *testing.T) { } } -func TestRegistryDifferentNamespace(t *testing.T) { - for _, nf := range allNew { - provider := metrictest.NewMeterProvider() - - meter1 := provider.Meter("meter1") - meter2 := provider.Meter("meter2") - inst1, err1 := nf(meter1, "this") - inst2, err2 := nf(meter2, "this") - - require.NoError(t, err1) - require.NoError(t, err2) - require.NotEqual(t, inst1, inst2) - } -} - func TestRegistryDiffInstruments(t *testing.T) { for origName, origf := range allNew { meter := testMeterWithRegistry("meter") @@ -120,7 +105,7 @@ func TestRegistryDiffInstruments(t *testing.T) { other, err := nf(meter, "this") require.Error(t, err) - require.NotNil(t, other) + require.Nil(t, other) require.True(t, errors.Is(err, registry.ErrMetricKindMismatch)) } } diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go index a043342627b..db3ad330213 100644 --- a/sdk/metric/sdk.go +++ b/sdk/metric/sdk.go @@ -23,11 +23,11 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - internal "go.opentelemetry.io/otel/internal/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( @@ -44,10 +44,8 @@ type ( // current maps `mapkey` to *record. current sync.Map - // asyncInstruments is a set of - // `*asyncInstrument` instances - asyncLock sync.Mutex - asyncInstruments *internal.AsyncInstrumentState + callbackLock sync.Mutex + callbacks map[*callback]struct{} // currentEpoch is the current epoch number. It is // incremented in `Collect()`. @@ -58,15 +56,23 @@ type ( // collectLock prevents simultaneous calls to Collect(). collectLock sync.Mutex + } - // asyncSortSlice has a single purpose - as a temporary - // place for sorting during labels creation to avoid - // allocation. It is cleared after use. - asyncSortSlice attribute.Sortable + callback struct { + insts map[*asyncInstrument]struct{} + f func(context.Context) + } + + asyncContextKey struct{} + + asyncInstrument struct { + baseInstrument + instrument.Asynchronous } syncInstrument struct { - instrument + baseInstrument + instrument.Synchronous } // mapkey uniquely describes a metric instrument in terms of @@ -92,16 +98,10 @@ type ( // supports checking for no updates during a round. collectedCount int64 - // storage is the stored label set for this record, + // labels is the stored label set for this record, // except in cases where a label set is shared due to // batch recording. - storage attribute.Set - - // labels is the processed label set for this record. - // this may refer to the `storage` field in another - // record if this label set is shared resulting from - // `RecordBatch`. - labels *attribute.Set + labels attribute.Set // sortSlice has a single purpose - as a temporary // place for sorting during labels creation to avoid @@ -109,7 +109,7 @@ type ( sortSlice attribute.Sortable // inst is a pointer to the corresponding instrument. - inst *syncInstrument + inst *baseInstrument // current implements the actual RecordOne() API, // depending on the type of aggregation. If nil, the @@ -118,36 +118,23 @@ type ( checkpoint aggregator.Aggregator } - instrument struct { + baseInstrument struct { meter *Accumulator descriptor sdkapi.Descriptor } - - asyncInstrument struct { - instrument - // recorders maps ordered labels to the pair of - // labelset and recorder - recorders map[attribute.Distinct]*labeledRecorder - } - - labeledRecorder struct { - observedEpoch int64 - labels *attribute.Set - observed aggregator.Aggregator - } ) var ( _ sdkapi.MeterImpl = &Accumulator{} - _ sdkapi.AsyncImpl = &asyncInstrument{} - _ sdkapi.SyncImpl = &syncInstrument{} // ErrUninitializedInstrument is returned when an instrument is used when uninitialized. ErrUninitializedInstrument = fmt.Errorf("use of an uninitialized instrument") + + ErrBadInstrument = fmt.Errorf("use of a instrument from another SDK") ) -func (inst *instrument) Descriptor() sdkapi.Descriptor { - return inst.descriptor +func (b *baseInstrument) Descriptor() sdkapi.Descriptor { + return b.descriptor } func (a *asyncInstrument) Implementation() interface{} { @@ -158,77 +145,24 @@ func (s *syncInstrument) Implementation() interface{} { return s } -func (a *asyncInstrument) observe(num number.Number, labels *attribute.Set) { - if err := aggregator.RangeTest(num, &a.descriptor); err != nil { - otel.Handle(err) - return - } - recorder := a.getRecorder(labels) - if recorder == nil { - // The instrument is disabled according to the - // AggregatorSelector. - return - } - if err := recorder.Update(context.Background(), num, &a.descriptor); err != nil { - otel.Handle(err) - return - } -} - -func (a *asyncInstrument) getRecorder(labels *attribute.Set) aggregator.Aggregator { - lrec, ok := a.recorders[labels.Equivalent()] - if ok { - // Note: SynchronizedMove(nil) can't return an error - _ = lrec.observed.SynchronizedMove(nil, &a.descriptor) - lrec.observedEpoch = a.meter.currentEpoch - a.recorders[labels.Equivalent()] = lrec - return lrec.observed - } - var rec aggregator.Aggregator - a.meter.processor.AggregatorFor(&a.descriptor, &rec) - if a.recorders == nil { - a.recorders = make(map[attribute.Distinct]*labeledRecorder) - } - // This may store nil recorder in the map, thus disabling the - // asyncInstrument for the labelset for good. This is intentional, - // but will be revisited later. - a.recorders[labels.Equivalent()] = &labeledRecorder{ - observed: rec, - labels: labels, - observedEpoch: a.meter.currentEpoch, - } - return rec -} - // acquireHandle gets or creates a `*record` corresponding to `kvs`, -// the input labels. The second argument `labels` is passed in to -// support re-use of the orderedLabels computed by a previous -// measurement in the same batch. This performs two allocations -// in the common case. -func (s *syncInstrument) acquireHandle(kvs []attribute.KeyValue, labelPtr *attribute.Set) *record { - var rec *record - var equiv attribute.Distinct - - if labelPtr == nil { - // This memory allocation may not be used, but it's - // needed for the `sortSlice` field, to avoid an - // allocation while sorting. - rec = &record{} - rec.storage = attribute.NewSetWithSortable(kvs, &rec.sortSlice) - rec.labels = &rec.storage - equiv = rec.storage.Equivalent() - } else { - equiv = labelPtr.Equivalent() - } +// the input labels. +func (b *baseInstrument) acquireHandle(kvs []attribute.KeyValue) *record { + + // This memory allocation may not be used, but it's + // needed for the `sortSlice` field, to avoid an + // allocation while sorting. + rec := &record{} + rec.labels = attribute.NewSetWithSortable(kvs, &rec.sortSlice) // Create lookup key for sync.Map (one allocation, as this // passes through an interface{}) mk := mapkey{ - descriptor: &s.descriptor, - ordered: equiv, + descriptor: &b.descriptor, + ordered: rec.labels.Equivalent(), } - if actual, ok := s.meter.current.Load(mk); ok { + if actual, ok := b.meter.current.Load(mk); ok { // Existing record case. existingRec := actual.(*record) if existingRec.refMapped.ref() { @@ -239,19 +173,15 @@ func (s *syncInstrument) acquireHandle(kvs []attribute.KeyValue, labelPtr *attri // This entry is no longer mapped, try to add a new entry. } - if rec == nil { - rec = &record{} - rec.labels = labelPtr - } rec.refMapped = refcountMapped{value: 2} - rec.inst = s + rec.inst = b - s.meter.processor.AggregatorFor(&s.descriptor, &rec.current, &rec.checkpoint) + b.meter.processor.AggregatorFor(&b.descriptor, &rec.current, &rec.checkpoint) for { // Load/Store: there's a memory allocation to place `mk` into // an interface here. - if actual, loaded := s.meter.current.LoadOrStore(mk, rec); loaded { + if actual, loaded := b.meter.current.LoadOrStore(mk, rec); loaded { // Existing record case. Cannot change rec here because if fail // will try to add rec again to avoid new allocations. oldRec := actual.(*record) @@ -278,11 +208,22 @@ func (s *syncInstrument) acquireHandle(kvs []attribute.KeyValue, labelPtr *attri } } +// RecordOne captures a single synchronous metric event. +// // The order of the input array `kvs` may be sorted after the function is called. func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs []attribute.KeyValue) { - h := s.acquireHandle(kvs, nil) + h := s.acquireHandle(kvs) defer h.unbind() - h.RecordOne(ctx, num) + h.captureOne(ctx, num) +} + +// ObserveOne captures a single asynchronous metric event. + +// The order of the input array `kvs` may be sorted after the function is called. +func (a *asyncInstrument) ObserveOne(ctx context.Context, num number.Number, attrs []attribute.KeyValue) { + h := a.acquireHandle(attrs) + defer h.unbind() + h.captureOne(ctx, num) } // NewAccumulator constructs a new Accumulator for the given @@ -296,15 +237,17 @@ func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs [ // own periodic collection. func NewAccumulator(processor export.Processor) *Accumulator { return &Accumulator{ - processor: processor, - asyncInstruments: internal.NewAsyncInstrumentState(), + processor: processor, + callbacks: map[*callback]struct{}{}, } } +var _ sdkapi.MeterImpl = &Accumulator{} + // NewSyncInstrument implements sdkapi.MetricImpl. func (m *Accumulator) NewSyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.SyncImpl, error) { return &syncInstrument{ - instrument: instrument{ + baseInstrument: baseInstrument{ descriptor: descriptor, meter: m, }, @@ -312,19 +255,40 @@ func (m *Accumulator) NewSyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.Sy } // NewAsyncInstrument implements sdkapi.MetricImpl. -func (m *Accumulator) NewAsyncInstrument(descriptor sdkapi.Descriptor, runner sdkapi.AsyncRunner) (sdkapi.AsyncImpl, error) { +func (m *Accumulator) NewAsyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.AsyncImpl, error) { a := &asyncInstrument{ - instrument: instrument{ + baseInstrument: baseInstrument{ descriptor: descriptor, meter: m, }, } - m.asyncLock.Lock() - defer m.asyncLock.Unlock() - m.asyncInstruments.Register(a, runner) return a, nil } +func (m *Accumulator) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { + cb := &callback{ + insts: map[*asyncInstrument]struct{}{}, + f: f, + } + for _, inst := range insts { + impl, ok := inst.(sdkapi.AsyncImpl) + if !ok { + return ErrBadInstrument + } + + ai, err := m.fromAsync(impl) + if err != nil { + return err + } + cb.insts[ai] = struct{}{} + } + + m.callbackLock.Lock() + defer m.callbackLock.Unlock() + m.callbacks[cb] = struct{}{} + return nil +} + // Collect traverses the list of active records and observers and // exports data for each active instrument. Collect() may not be // called concurrently. @@ -337,14 +301,14 @@ func (m *Accumulator) Collect(ctx context.Context) int { m.collectLock.Lock() defer m.collectLock.Unlock() - checkpointed := m.observeAsyncInstruments(ctx) - checkpointed += m.collectSyncInstruments() + m.runAsyncCallbacks(ctx) + checkpointed := m.collectInstruments() m.currentEpoch++ return checkpointed } -func (m *Accumulator) collectSyncInstruments() int { +func (m *Accumulator) collectInstruments() int { checkpointed := 0 m.current.Range(func(key interface{}, value interface{}) bool { @@ -387,33 +351,15 @@ func (m *Accumulator) collectSyncInstruments() int { return checkpointed } -// CollectAsync implements internal.AsyncCollector. -// The order of the input array `kvs` may be sorted after the function is called. -func (m *Accumulator) CollectAsync(kv []attribute.KeyValue, obs ...sdkapi.Observation) { - labels := attribute.NewSetWithSortable(kv, &m.asyncSortSlice) - - for _, ob := range obs { - if a := m.fromAsync(ob.AsyncImpl()); a != nil { - a.observe(ob.Number(), &labels) - } - } -} - -func (m *Accumulator) observeAsyncInstruments(ctx context.Context) int { - m.asyncLock.Lock() - defer m.asyncLock.Unlock() - - asyncCollected := 0 +func (m *Accumulator) runAsyncCallbacks(ctx context.Context) { + m.callbackLock.Lock() + defer m.callbackLock.Unlock() - m.asyncInstruments.Run(ctx, m) + ctx = context.WithValue(ctx, asyncContextKey{}, m) - for _, inst := range m.asyncInstruments.Instruments() { - if a := m.fromAsync(inst); a != nil { - asyncCollected += m.checkpointAsync(a) - } + for cb := range m.callbacks { + cb.f(ctx) } - - return asyncCollected } func (m *Accumulator) checkpointRecord(r *record) int { @@ -426,7 +372,7 @@ func (m *Accumulator) checkpointRecord(r *record) int { return 0 } - a := export.NewAccumulation(&r.inst.descriptor, r.labels, r.checkpoint) + a := export.NewAccumulation(&r.inst.descriptor, &r.labels, r.checkpoint) err = m.processor.Process(a) if err != nil { otel.Handle(err) @@ -434,63 +380,7 @@ func (m *Accumulator) checkpointRecord(r *record) int { return 1 } -func (m *Accumulator) checkpointAsync(a *asyncInstrument) int { - if len(a.recorders) == 0 { - return 0 - } - checkpointed := 0 - for encodedLabels, lrec := range a.recorders { - lrec := lrec - epochDiff := m.currentEpoch - lrec.observedEpoch - if epochDiff == 0 { - if lrec.observed != nil { - a := export.NewAccumulation(&a.descriptor, lrec.labels, lrec.observed) - err := m.processor.Process(a) - if err != nil { - otel.Handle(err) - } - checkpointed++ - } - } else if epochDiff > 1 { - // This is second collection cycle with no - // observations for this labelset. Remove the - // recorder. - delete(a.recorders, encodedLabels) - } - } - if len(a.recorders) == 0 { - a.recorders = nil - } - return checkpointed -} - -// RecordBatch enters a batch of metric events. -// The order of the input array `kvs` may be sorted after the function is called. -func (m *Accumulator) RecordBatch(ctx context.Context, kvs []attribute.KeyValue, measurements ...sdkapi.Measurement) { - // Labels will be computed the first time acquireHandle is - // called. Subsequent calls to acquireHandle will re-use the - // previously computed value instead of recomputing the - // ordered labels. - var labelsPtr *attribute.Set - for i, meas := range measurements { - s := m.fromSync(meas.SyncImpl()) - if s == nil { - continue - } - h := s.acquireHandle(kvs, labelsPtr) - - // Re-use labels for the next measurement. - if i == 0 { - labelsPtr = h.labels - } - - defer h.unbind() - h.RecordOne(ctx, meas.Number()) - } -} - -// RecordOne implements sdkapi.SyncImpl. -func (r *record) RecordOne(ctx context.Context, num number.Number) { +func (r *record) captureOne(ctx context.Context, num number.Number) { if r.current == nil { // The instrument is disabled according to the AggregatorSelector. return @@ -519,26 +409,16 @@ func (r *record) mapkey() mapkey { } } -// fromSync gets a sync implementation object, checking for -// uninitialized instruments and instruments created by another SDK. -func (m *Accumulator) fromSync(sync sdkapi.SyncImpl) *syncInstrument { - if sync != nil { - if inst, ok := sync.Implementation().(*syncInstrument); ok { - return inst - } - } - otel.Handle(ErrUninitializedInstrument) - return nil -} - // fromSync gets an async implementation object, checking for // uninitialized instruments and instruments created by another SDK. -func (m *Accumulator) fromAsync(async sdkapi.AsyncImpl) *asyncInstrument { - if async != nil { - if inst, ok := async.Implementation().(*asyncInstrument); ok { - return inst - } +func (m *Accumulator) fromAsync(async sdkapi.AsyncImpl) (*asyncInstrument, error) { + if async == nil { + return nil, ErrUninitializedInstrument } - otel.Handle(ErrUninitializedInstrument) - return nil + inst, ok := async.Implementation().(*asyncInstrument) + if !ok { + return nil, ErrBadInstrument + } + return inst, nil + } diff --git a/metric/sdkapi/descriptor.go b/sdk/metric/sdkapi/descriptor.go similarity index 94% rename from metric/sdkapi/descriptor.go rename to sdk/metric/sdkapi/descriptor.go index 14eb0532e45..f86e4473459 100644 --- a/metric/sdkapi/descriptor.go +++ b/sdk/metric/sdkapi/descriptor.go @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package sdkapi // import "go.opentelemetry.io/otel/metric/sdkapi" +package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" import ( - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/metric/number" ) // Descriptor contains all the settings that describe an instrument, diff --git a/metric/sdkapi/descriptor_test.go b/sdk/metric/sdkapi/descriptor_test.go similarity index 96% rename from metric/sdkapi/descriptor_test.go rename to sdk/metric/sdkapi/descriptor_test.go index 6b6927075f9..1f084472535 100644 --- a/metric/sdkapi/descriptor_test.go +++ b/sdk/metric/sdkapi/descriptor_test.go @@ -19,8 +19,8 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/number" "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/metric/number" ) func TestDescriptorGetters(t *testing.T) { diff --git a/metric/sdkapi/instrumentkind.go b/sdk/metric/sdkapi/instrumentkind.go similarity index 97% rename from metric/sdkapi/instrumentkind.go rename to sdk/metric/sdkapi/instrumentkind.go index 64aa5ead123..c7406a3e49a 100644 --- a/metric/sdkapi/instrumentkind.go +++ b/sdk/metric/sdkapi/instrumentkind.go @@ -14,7 +14,7 @@ //go:generate stringer -type=InstrumentKind -package sdkapi // import "go.opentelemetry.io/otel/metric/sdkapi" +package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" // InstrumentKind describes the kind of instrument. type InstrumentKind int8 diff --git a/metric/sdkapi/instrumentkind_string.go b/sdk/metric/sdkapi/instrumentkind_string.go similarity index 100% rename from metric/sdkapi/instrumentkind_string.go rename to sdk/metric/sdkapi/instrumentkind_string.go diff --git a/metric/sdkapi/instrumentkind_test.go b/sdk/metric/sdkapi/instrumentkind_test.go similarity index 96% rename from metric/sdkapi/instrumentkind_test.go rename to sdk/metric/sdkapi/instrumentkind_test.go index 0b2901383b2..cd1db02a898 100644 --- a/metric/sdkapi/instrumentkind_test.go +++ b/sdk/metric/sdkapi/instrumentkind_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/sdkapi" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) func TestInstrumentKinds(t *testing.T) { diff --git a/metric/sdkapi/noop.go b/sdk/metric/sdkapi/noop.go similarity index 71% rename from metric/sdkapi/noop.go rename to sdk/metric/sdkapi/noop.go index f22895dae6f..6b2374b68a3 100644 --- a/metric/sdkapi/noop.go +++ b/sdk/metric/sdkapi/noop.go @@ -12,20 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -package sdkapi // import "go.opentelemetry.io/otel/metric/sdkapi" +package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" -) + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/number" +) // import ( +// "context" + +// "go.opentelemetry.io/otel/attribute" +// "go.opentelemetry.io/otel/sdk/metric/number" +// ) type noopInstrument struct { descriptor Descriptor } -type noopSyncInstrument struct{ noopInstrument } -type noopAsyncInstrument struct{ noopInstrument } +type noopSyncInstrument struct { + noopInstrument + + instrument.Synchronous +} +type noopAsyncInstrument struct { + noopInstrument + + instrument.Asynchronous +} var _ SyncImpl = noopSyncInstrument{} var _ AsyncImpl = noopAsyncInstrument{} @@ -34,7 +48,7 @@ var _ AsyncImpl = noopAsyncInstrument{} // synchronous instrument interface. func NewNoopSyncInstrument() SyncImpl { return noopSyncInstrument{ - noopInstrument{ + noopInstrument: noopInstrument{ descriptor: Descriptor{ instrumentKind: CounterInstrumentKind, }, @@ -46,7 +60,7 @@ func NewNoopSyncInstrument() SyncImpl { // asynchronous instrument interface. func NewNoopAsyncInstrument() AsyncImpl { return noopAsyncInstrument{ - noopInstrument{ + noopInstrument: noopInstrument{ descriptor: Descriptor{ instrumentKind: CounterObserverInstrumentKind, }, @@ -64,3 +78,6 @@ func (n noopInstrument) Descriptor() Descriptor { func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) { } + +func (noopAsyncInstrument) ObserveOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) { +} diff --git a/metric/sdkapi/sdkapi.go b/sdk/metric/sdkapi/sdkapi.go similarity index 90% rename from metric/sdkapi/sdkapi.go rename to sdk/metric/sdkapi/sdkapi.go index 36836364bdc..4345358ff3e 100644 --- a/metric/sdkapi/sdkapi.go +++ b/sdk/metric/sdkapi/sdkapi.go @@ -12,21 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -package sdkapi // import "go.opentelemetry.io/otel/metric/sdkapi" +package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/number" ) // MeterImpl is the interface an SDK must implement to supply a Meter // implementation. type MeterImpl interface { - // RecordBatch atomically records a batch of measurements. - RecordBatch(ctx context.Context, labels []attribute.KeyValue, measurement ...Measurement) - // NewSyncInstrument returns a newly constructed // synchronous instrument implementation or an error, should // one occur. @@ -35,10 +33,10 @@ type MeterImpl interface { // NewAsyncInstrument returns a newly constructed // asynchronous instrument implementation or an error, should // one occur. - NewAsyncInstrument( - descriptor Descriptor, - runner AsyncRunner, - ) (AsyncImpl, error) + NewAsyncInstrument(descriptor Descriptor) (AsyncImpl, error) + + // Etc. + RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error } // InstrumentImpl is a common interface for synchronous and @@ -57,6 +55,7 @@ type InstrumentImpl interface { // synchronous instrument (e.g., Histogram and Counter instruments). type SyncImpl interface { InstrumentImpl + instrument.Synchronous // RecordOne captures a single synchronous metric event. RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) @@ -66,6 +65,10 @@ type SyncImpl interface { // asynchronous instrument (e.g., Observer instruments). type AsyncImpl interface { InstrumentImpl + instrument.Asynchronous + + // ObserveOne captures a single synchronous metric event. + ObserveOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) } // AsyncRunner is expected to convert into an AsyncSingleRunner or an diff --git a/metric/sdkapi/sdkapi_test.go b/sdk/metric/sdkapi/sdkapi_test.go similarity index 96% rename from metric/sdkapi/sdkapi_test.go rename to sdk/metric/sdkapi/sdkapi_test.go index 9c80f89bddb..69fec0fe692 100644 --- a/metric/sdkapi/sdkapi_test.go +++ b/sdk/metric/sdkapi/sdkapi_test.go @@ -19,7 +19,7 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/sdk/metric/number" ) func TestMeasurementGetters(t *testing.T) { diff --git a/sdk/metric/sdkapi/wrap.go b/sdk/metric/sdkapi/wrap.go new file mode 100644 index 00000000000..9a4d5b0de14 --- /dev/null +++ b/sdk/metric/sdkapi/wrap.go @@ -0,0 +1,181 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/metric/number" +) + +type ( + meter struct{ MeterImpl } + sfMeter struct{ meter } + siMeter struct{ meter } + afMeter struct{ meter } + aiMeter struct{ meter } + + iAdder struct{ SyncImpl } + fAdder struct{ SyncImpl } + iRecorder struct{ SyncImpl } + fRecorder struct{ SyncImpl } + iObserver struct{ AsyncImpl } + fObserver struct{ AsyncImpl } +) + +func WrapMeterImpl(impl MeterImpl) metric.Meter { + return meter{impl} +} + +func UnwrapMeterImpl(m metric.Meter) MeterImpl { + mm, ok := m.(meter) + if !ok { + return nil + } + return mm.MeterImpl +} + +func (m meter) AsyncFloat64() asyncfloat64.InstrumentProvider { + return afMeter{m} +} + +func (m meter) AsyncInt64() asyncint64.InstrumentProvider { + return aiMeter{m} +} + +func (m meter) SyncFloat64() syncfloat64.InstrumentProvider { + return sfMeter{m} +} + +func (m meter) SyncInt64() syncint64.InstrumentProvider { + return siMeter{m} +} + +func (m meter) RegisterCallback(insts []instrument.Asynchronous, cb func(ctx context.Context)) error { + return m.MeterImpl.RegisterCallback(insts, cb) +} + +func (m meter) newSync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (SyncImpl, error) { + cfg := instrument.NewConfig(opts...) + return m.NewSyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())) +} + +func (m meter) newAsync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (AsyncImpl, error) { + cfg := instrument.NewConfig(opts...) + return m.NewAsyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())) +} + +func (m afMeter) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { + inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Float64Kind, opts) + return fObserver{inst}, err +} + +func (m afMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Float64Kind, opts) + return fObserver{inst}, err +} + +func (m afMeter) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { + inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Float64Kind, opts) + return fObserver{inst}, err +} + +func (m aiMeter) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Int64Kind, opts) + return iObserver{inst}, err +} + +func (m aiMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { + inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Int64Kind, opts) + return iObserver{inst}, err +} + +func (m aiMeter) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { + inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Int64Kind, opts) + return iObserver{inst}, err +} + +func (m sfMeter) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { + inst, err := m.newSync(name, CounterInstrumentKind, number.Float64Kind, opts) + return fAdder{inst}, err +} + +func (m sfMeter) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { + inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Float64Kind, opts) + return fAdder{inst}, err +} + +func (m sfMeter) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { + inst, err := m.newSync(name, HistogramInstrumentKind, number.Float64Kind, opts) + return fRecorder{inst}, err +} + +func (m siMeter) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { + inst, err := m.newSync(name, CounterInstrumentKind, number.Int64Kind, opts) + return iAdder{inst}, err +} + +func (m siMeter) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { + inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Int64Kind, opts) + return iAdder{inst}, err +} + +func (m siMeter) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { + inst, err := m.newSync(name, HistogramInstrumentKind, number.Int64Kind, opts) + return iRecorder{inst}, err +} + +func (a fAdder) Add(ctx context.Context, value float64, attrs ...attribute.KeyValue) { + if a.SyncImpl != nil { + a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs) + } +} + +func (a iAdder) Add(ctx context.Context, value int64, attrs ...attribute.KeyValue) { + if a.SyncImpl != nil { + a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs) + } +} + +func (a fRecorder) Record(ctx context.Context, value float64, attrs ...attribute.KeyValue) { + if a.SyncImpl != nil { + a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs) + } +} + +func (a iRecorder) Record(ctx context.Context, value int64, attrs ...attribute.KeyValue) { + if a.SyncImpl != nil { + a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs) + } +} + +func (a fObserver) Observe(ctx context.Context, value float64, attrs ...attribute.KeyValue) { + if a.AsyncImpl != nil { + a.AsyncImpl.ObserveOne(ctx, number.NewFloat64Number(value), attrs) + } +} + +func (a iObserver) Observe(ctx context.Context, value int64, attrs ...attribute.KeyValue) { + if a.AsyncImpl != nil { + a.AsyncImpl.ObserveOne(ctx, number.NewInt64Number(value), attrs) + } +} diff --git a/sdk/metric/selector/simple/simple.go b/sdk/metric/selector/simple/simple.go index 5b3e1c5fd5e..5451072f607 100644 --- a/sdk/metric/selector/simple/simple.go +++ b/sdk/metric/selector/simple/simple.go @@ -15,12 +15,12 @@ package simple // import "go.opentelemetry.io/otel/sdk/metric/selector/simple" import ( - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) type ( diff --git a/sdk/metric/selector/simple/simple_test.go b/sdk/metric/selector/simple/simple_test.go index a25291b5112..9e946864e53 100644 --- a/sdk/metric/selector/simple/simple_test.go +++ b/sdk/metric/selector/simple/simple_test.go @@ -19,14 +19,14 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/metric/selector/simple" ) diff --git a/sdk/metric/stress_test.go b/sdk/metric/stress_test.go deleted file mode 100644 index f6b9eb4ba02..00000000000 --- a/sdk/metric/stress_test.go +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This test is too large for the race detector. This SDK uses no locks -// that the race detector would help with, anyway. -//go:build !race -// +build !race - -package metric - -import ( - "context" - "fmt" - "math" - "math/rand" - "runtime" - "sort" - "strings" - "sync" - "sync/atomic" - "testing" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/number" - "go.opentelemetry.io/otel/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" -) - -const ( - concurrencyPerCPU = 100 - reclaimPeriod = time.Millisecond * 100 - testRun = 5 * time.Second - epsilon = 1e-10 -) - -var Must = metric.Must - -type ( - testFixture struct { - // stop has to be aligned for 64-bit atomic operations. - stop int64 - expected sync.Map - received sync.Map // Note: doesn't require synchronization - wg sync.WaitGroup - impl testImpl - T *testing.T - - export.AggregatorSelector - - lock sync.Mutex - lused map[string]bool - - dupCheck map[testKey]int - totalDups int64 - } - - testKey struct { - labels string - descriptor *sdkapi.Descriptor - } - - testImpl struct { - newInstrument func(meter metric.Meter, name string) SyncImpler - getUpdateValue func() number.Number - operate func(interface{}, context.Context, number.Number, []attribute.KeyValue) - newStore func() interface{} - - // storeCollect and storeExpect are the same for - // counters, different for lastValues, to ensure we are - // testing the timestamps correctly. - storeCollect func(store interface{}, value number.Number, ts time.Time) - storeExpect func(store interface{}, value number.Number) - readStore func(store interface{}) number.Number - equalValues func(a, b number.Number) bool - } - - SyncImpler interface { - SyncImpl() sdkapi.SyncImpl - } - - // lastValueState supports merging lastValue values, for the case - // where a race condition causes duplicate records. We always - // take the later timestamp. - lastValueState struct { - // raw has to be aligned for 64-bit atomic operations. - raw number.Number - ts time.Time - } -) - -func concurrency() int { - return concurrencyPerCPU * runtime.NumCPU() -} - -func canonicalizeLabels(ls []attribute.KeyValue) string { - copy := append(ls[0:0:0], ls...) - sort.SliceStable(copy, func(i, j int) bool { - return copy[i].Key < copy[j].Key - }) - var b strings.Builder - for _, kv := range copy { - b.WriteString(string(kv.Key)) - b.WriteString("=") - b.WriteString(kv.Value.Emit()) - b.WriteString("$") - } - return b.String() -} - -func getPeriod() time.Duration { - dur := math.Max( - float64(reclaimPeriod)/10, - float64(reclaimPeriod)*(1+0.1*rand.NormFloat64()), - ) - return time.Duration(dur) -} - -func (f *testFixture) someLabels() []attribute.KeyValue { - n := 1 + rand.Intn(3) - l := make([]attribute.KeyValue, n) - - for { - oused := map[string]bool{} - for i := 0; i < n; i++ { - var k string - for { - k = fmt.Sprint("k", rand.Intn(1000000000)) - if !oused[k] { - oused[k] = true - break - } - } - l[i] = attribute.String(k, fmt.Sprint("v", rand.Intn(1000000000))) - } - lc := canonicalizeLabels(l) - f.lock.Lock() - avail := !f.lused[lc] - if avail { - f.lused[lc] = true - f.lock.Unlock() - return l - } - f.lock.Unlock() - } -} - -func (f *testFixture) startWorker(impl *Accumulator, meter metric.Meter, wg *sync.WaitGroup, i int) { - ctx := context.Background() - name := fmt.Sprint("test_", i) - instrument := f.impl.newInstrument(meter, name) - var descriptor *sdkapi.Descriptor - if ii, ok := instrument.SyncImpl().(*syncInstrument); ok { - descriptor = &ii.descriptor - } - kvs := f.someLabels() - clabs := canonicalizeLabels(kvs) - dur := getPeriod() - key := testKey{ - labels: clabs, - descriptor: descriptor, - } - for { - sleep := time.Duration(rand.ExpFloat64() * float64(dur)) - time.Sleep(sleep) - value := f.impl.getUpdateValue() - f.impl.operate(instrument, ctx, value, kvs) - - actual, _ := f.expected.LoadOrStore(key, f.impl.newStore()) - - f.impl.storeExpect(actual, value) - - if atomic.LoadInt64(&f.stop) != 0 { - wg.Done() - return - } - } -} - -func (f *testFixture) assertTest(numCollect int) { - var allErrs []func() - csize := 0 - f.received.Range(func(key, gstore interface{}) bool { - csize++ - gvalue := f.impl.readStore(gstore) - - estore, loaded := f.expected.Load(key) - if !loaded { - allErrs = append(allErrs, func() { - f.T.Error("Could not locate expected key: ", key) - }) - return true - } - evalue := f.impl.readStore(estore) - - if !f.impl.equalValues(evalue, gvalue) { - allErrs = append(allErrs, func() { - f.T.Error("Expected value mismatch: ", - evalue, "!=", gvalue, " for ", key) - }) - } - return true - }) - rsize := 0 - f.expected.Range(func(key, value interface{}) bool { - rsize++ - if _, loaded := f.received.Load(key); !loaded { - allErrs = append(allErrs, func() { - f.T.Error("Did not receive expected key: ", key) - }) - } - return true - }) - if rsize != csize { - f.T.Error("Did not receive the correct set of metrics: Received != Expected", rsize, csize) - } - - for _, anErr := range allErrs { - anErr() - } - - // Note: It's useful to know the test triggers this condition, - // but we can't assert it. Infrequently no duplicates are - // found, and we can't really force a race to happen. - // - // fmt.Printf("Test duplicate records seen: %.1f%%\n", - // float64(100*f.totalDups/int64(numCollect*concurrency()))) -} - -func (f *testFixture) preCollect() { - // Collect calls Process in a single-threaded context. No need - // to lock this struct. - f.dupCheck = map[testKey]int{} -} - -func (*testFixture) Reader() export.Reader { - return nil -} - -func (f *testFixture) Process(accumulation export.Accumulation) error { - labels := accumulation.Labels().ToSlice() - key := testKey{ - labels: canonicalizeLabels(labels), - descriptor: accumulation.Descriptor(), - } - if f.dupCheck[key] == 0 { - f.dupCheck[key]++ - } else { - f.totalDups++ - } - - actual, _ := f.received.LoadOrStore(key, f.impl.newStore()) - - agg := accumulation.Aggregator() - switch accumulation.Descriptor().InstrumentKind() { - case sdkapi.CounterInstrumentKind: - sum, err := agg.(aggregation.Sum).Sum() - if err != nil { - f.T.Fatal("Sum error: ", err) - } - f.impl.storeCollect(actual, sum, time.Time{}) - case sdkapi.HistogramInstrumentKind: - lv, ts, err := agg.(aggregation.LastValue).LastValue() - if err != nil && err != aggregation.ErrNoData { - f.T.Fatal("Last value error: ", err) - } - f.impl.storeCollect(actual, lv, ts) - default: - panic("Not used in this test") - } - return nil -} - -func stressTest(t *testing.T, impl testImpl) { - ctx := context.Background() - t.Parallel() - fixture := &testFixture{ - T: t, - impl: impl, - lused: map[string]bool{}, - AggregatorSelector: processortest.AggregatorSelector(), - } - cc := concurrency() - - sdk := NewAccumulator(fixture) - meter := metric.WrapMeterImpl(sdk) - fixture.wg.Add(cc + 1) - - for i := 0; i < cc; i++ { - go fixture.startWorker(sdk, meter, &fixture.wg, i) - } - - numCollect := 0 - - go func() { - for { - time.Sleep(reclaimPeriod) - fixture.preCollect() - sdk.Collect(ctx) - numCollect++ - if atomic.LoadInt64(&fixture.stop) != 0 { - fixture.wg.Done() - return - } - } - }() - - time.Sleep(testRun) - atomic.StoreInt64(&fixture.stop, 1) - fixture.wg.Wait() - fixture.preCollect() - sdk.Collect(ctx) - numCollect++ - - fixture.assertTest(numCollect) -} - -func int64sEqual(a, b number.Number) bool { - return a.AsInt64() == b.AsInt64() -} - -func float64sEqual(a, b number.Number) bool { - diff := math.Abs(a.AsFloat64() - b.AsFloat64()) - return diff < math.Abs(a.AsFloat64())*epsilon -} - -// Counters - -func intCounterTestImpl() testImpl { - return testImpl{ - newInstrument: func(meter metric.Meter, name string) SyncImpler { - return Must(meter).NewInt64Counter(name + ".sum") - }, - getUpdateValue: func() number.Number { - for { - x := int64(rand.Intn(100)) - if x != 0 { - return number.NewInt64Number(x) - } - } - }, - operate: func(inst interface{}, ctx context.Context, value number.Number, labels []attribute.KeyValue) { - counter := inst.(metric.Int64Counter) - counter.Add(ctx, value.AsInt64(), labels...) - }, - newStore: func() interface{} { - n := number.NewInt64Number(0) - return &n - }, - storeCollect: func(store interface{}, value number.Number, _ time.Time) { - store.(*number.Number).AddInt64Atomic(value.AsInt64()) - }, - storeExpect: func(store interface{}, value number.Number) { - store.(*number.Number).AddInt64Atomic(value.AsInt64()) - }, - readStore: func(store interface{}) number.Number { - return store.(*number.Number).AsNumberAtomic() - }, - equalValues: int64sEqual, - } -} - -func TestStressInt64Counter(t *testing.T) { - stressTest(t, intCounterTestImpl()) -} - -func floatCounterTestImpl() testImpl { - return testImpl{ - newInstrument: func(meter metric.Meter, name string) SyncImpler { - return Must(meter).NewFloat64Counter(name + ".sum") - }, - getUpdateValue: func() number.Number { - for { - x := rand.Float64() - if x != 0 { - return number.NewFloat64Number(x) - } - } - }, - operate: func(inst interface{}, ctx context.Context, value number.Number, labels []attribute.KeyValue) { - counter := inst.(metric.Float64Counter) - counter.Add(ctx, value.AsFloat64(), labels...) - }, - newStore: func() interface{} { - n := number.NewFloat64Number(0.0) - return &n - }, - storeCollect: func(store interface{}, value number.Number, _ time.Time) { - store.(*number.Number).AddFloat64Atomic(value.AsFloat64()) - }, - storeExpect: func(store interface{}, value number.Number) { - store.(*number.Number).AddFloat64Atomic(value.AsFloat64()) - }, - readStore: func(store interface{}) number.Number { - return store.(*number.Number).AsNumberAtomic() - }, - equalValues: float64sEqual, - } -} - -func TestStressFloat64Counter(t *testing.T) { - stressTest(t, floatCounterTestImpl()) -} - -// LastValue - -func intLastValueTestImpl() testImpl { - return testImpl{ - newInstrument: func(meter metric.Meter, name string) SyncImpler { - return Must(meter).NewInt64Histogram(name + ".lastvalue") - }, - getUpdateValue: func() number.Number { - r1 := rand.Int63() - return number.NewInt64Number(rand.Int63() - r1) - }, - operate: func(inst interface{}, ctx context.Context, value number.Number, labels []attribute.KeyValue) { - histogram := inst.(metric.Int64Histogram) - histogram.Record(ctx, value.AsInt64(), labels...) - }, - newStore: func() interface{} { - return &lastValueState{ - raw: number.NewInt64Number(0), - } - }, - storeCollect: func(store interface{}, value number.Number, ts time.Time) { - gs := store.(*lastValueState) - - if !ts.Before(gs.ts) { - gs.ts = ts - gs.raw.SetInt64Atomic(value.AsInt64()) - } - }, - storeExpect: func(store interface{}, value number.Number) { - gs := store.(*lastValueState) - gs.raw.SetInt64Atomic(value.AsInt64()) - }, - readStore: func(store interface{}) number.Number { - gs := store.(*lastValueState) - return gs.raw.AsNumberAtomic() - }, - equalValues: int64sEqual, - } -} - -func TestStressInt64LastValue(t *testing.T) { - stressTest(t, intLastValueTestImpl()) -} - -func floatLastValueTestImpl() testImpl { - return testImpl{ - newInstrument: func(meter metric.Meter, name string) SyncImpler { - return Must(meter).NewFloat64Histogram(name + ".lastvalue") - }, - getUpdateValue: func() number.Number { - return number.NewFloat64Number((-0.5 + rand.Float64()) * 100000) - }, - operate: func(inst interface{}, ctx context.Context, value number.Number, labels []attribute.KeyValue) { - histogram := inst.(metric.Float64Histogram) - histogram.Record(ctx, value.AsFloat64(), labels...) - }, - newStore: func() interface{} { - return &lastValueState{ - raw: number.NewFloat64Number(0), - } - }, - storeCollect: func(store interface{}, value number.Number, ts time.Time) { - gs := store.(*lastValueState) - - if !ts.Before(gs.ts) { - gs.ts = ts - gs.raw.SetFloat64Atomic(value.AsFloat64()) - } - }, - storeExpect: func(store interface{}, value number.Number) { - gs := store.(*lastValueState) - gs.raw.SetFloat64Atomic(value.AsFloat64()) - }, - readStore: func(store interface{}) number.Number { - gs := store.(*lastValueState) - return gs.raw.AsNumberAtomic() - }, - equalValues: float64sEqual, - } -} - -func TestStressFloat64LastValue(t *testing.T) { - stressTest(t, floatLastValueTestImpl()) -} From 24414b2455ec9331feaa49370c79b83d60dd21cc Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 3 Mar 2022 03:07:06 +0100 Subject: [PATCH 087/886] Refactor OTLP exporter env config to be shared across all exporters (#2608) * setup global envconfig package for otlp exporter * use envconfig in otlpmetrics package * fix lint * add changelog entry * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Chester Cheung * fix lint Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 1 + .../otlp/internal/envconfig/envconfig.go | 148 ++++++++ .../otlp/internal/envconfig/envconfig_test.go | 345 ++++++++++++++++++ .../internal/otlpconfig/envconfig.go | 225 ++++-------- .../internal/otlpconfig/envconfig_test.go | 60 --- .../internal/otlpconfig/options_test.go | 8 +- .../internal/otlpconfig/envconfig.go | 218 +++-------- .../internal/otlpconfig/envconfig_test.go | 60 --- .../internal/otlpconfig/options_test.go | 8 +- 9 files changed, 627 insertions(+), 446 deletions(-) create mode 100644 exporters/otlp/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/internal/envconfig/envconfig_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b4333441d..b90c3a4b167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This update is a breaking change of the unstable Metrics API. Code instrumented - The metrics API has been significantly changed. (#2587) - Unify path cleaning functionally in the `otlpmetric` and `otlptrace` config. (#2639) - Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) +- Introduce new internal envconfig package for OTLP exporters (#2608) ### Fixed diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..b696338ec9a --- /dev/null +++ b/exporters/otlp/internal/envconfig/envconfig.go @@ -0,0 +1,148 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" +) + +// ConfigFn is the generic function used to set a config +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + if d, err := strconv.Atoi(v); err == nil { + fn(time.Duration(d) * time.Millisecond) + } + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + if u, err := url.Parse(v); err == nil { + fn(u) + } + } + } +} + +// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config +func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + if b, err := e.ReadFile(v); err == nil { + if c, err := createTLSConfig(b); err == nil { + fn(c) + } + } + } + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + nameValue := strings.SplitN(header, "=", 2) + if len(nameValue) < 2 { + continue + } + name, err := url.QueryUnescape(nameValue[0]) + if err != nil { + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(nameValue[1]) + if err != nil { + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/exporters/otlp/internal/envconfig/envconfig_test.go b/exporters/otlp/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..b141cd42b93 --- /dev/null +++ b/exporters/otlp/internal/envconfig/envconfig_test.go @@ -0,0 +1,345 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + +import ( + "crypto/tls" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + tlsCert, err := createTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithTLSConfig("CERTIFICATE", func(v *tls.Config) { + option = testOption{TestTLS: v} + })) + assert.Equal(t, tlsCert.RootCAs.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index ecf2ecaf9c2..d59912ddb6e 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -16,66 +16,58 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "crypto/tls" - "fmt" "io/ioutil" "net/url" "os" "path" - "strconv" "strings" "time" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -var DefaultEnvOptionsReader = EnvOptionsReader{ - GetEnv: os.Getenv, - ReadFile: ioutil.ReadFile, +// DefaultEnvOptionsReader is the default environments reader +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: ioutil.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", } +// ApplyGRPCEnvConfigs applies the env configurations for gRPC func ApplyGRPCEnvConfigs(cfg Config) Config { - return DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) -} - -func ApplyHTTPEnvConfigs(cfg Config) Config { - return DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) -} - -type EnvOptionsReader struct { - GetEnv func(string) string - ReadFile func(filename string) ([]byte, error) -} - -func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg Config) Config { - opts := e.GetOptionsFromEnv() + opts := getOptionsFromEnv() for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) + cfg = opt.ApplyGRPCOption(cfg) } return cfg } -func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg Config) Config { - opts := e.GetOptionsFromEnv() +// ApplyHTTPEnvConfigs applies the env configurations for HTTP +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) + cfg = opt.ApplyHTTPOption(cfg) } return cfg } -func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { - var opts []GenericOption +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} - // Endpoint - if v, ok := e.getEnvValue("METRICS_ENDPOINT"); ok { - u, err := url.Parse(v) - // Ignore invalid values. - if err == nil { - // This is used to set the scheme for OTLP/HTTP. - if insecureSchema(u.Scheme) { - opts = append(opts, WithInsecure()) - } else { - opts = append(opts, WithSecure()) - } + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Metrics.Endpoint = u.Host // For endpoint URLs for OTLP/HTTP per-signal variables, the @@ -88,141 +80,50 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } cfg.Metrics.URLPath = path return cfg - }, func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) - return cfg - })) - } - } else if v, ok = e.getEnvValue("ENDPOINT"); ok { - u, err := url.Parse(v) - // Ignore invalid values. - if err == nil { - // This is used to set the scheme for OTLP/HTTP. - if insecureSchema(u.Scheme) { - opts = append(opts, WithInsecure()) - } else { - opts = append(opts, WithSecure()) - } - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Metrics.Endpoint = u.Host - // For OTLP/HTTP endpoint URLs without a per-signal - // configuration, the passed endpoint is used as a base URL - // and the signals are sent to these paths relative to that. - cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) - return cfg - }, func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) - return cfg - })) - } - } - - // Certificate File - if path, ok := e.getEnvValue("CERTIFICATE"); ok { - if tls, err := e.readTLSConfig(path); err == nil { - opts = append(opts, WithTLSClientConfig(tls)) - } else { - otel.Handle(fmt.Errorf("failed to configure otlp exporter certificate '%s': %w", path, err)) - } - } - if path, ok := e.getEnvValue("METRICS_CERTIFICATE"); ok { - if tls, err := e.readTLSConfig(path); err == nil { - opts = append(opts, WithTLSClientConfig(tls)) - } else { - otel.Handle(fmt.Errorf("failed to configure otlp exporter certificate '%s': %w", path, err)) - } - } - - // Headers - if h, ok := e.getEnvValue("HEADERS"); ok { - opts = append(opts, WithHeaders(stringToHeader(h))) - } - if h, ok := e.getEnvValue("METRICS_HEADERS"); ok { - opts = append(opts, WithHeaders(stringToHeader(h))) - } - - // Compression - if c, ok := e.getEnvValue("COMPRESSION"); ok { - opts = append(opts, WithCompression(stringToCompression(c))) - } - if c, ok := e.getEnvValue("METRICS_COMPRESSION"); ok { - opts = append(opts, WithCompression(stringToCompression(c))) - } - - // Timeout - if t, ok := e.getEnvValue("TIMEOUT"); ok { - if d, err := strconv.Atoi(t); err == nil { - opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) - } - } - if t, ok := e.getEnvValue("METRICS_TIMEOUT"); ok { - if d, err := strconv.Atoi(t); err == nil { - opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) - } - } + }, withEndpointForGRPC(u))) + }), + envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithTLSConfig("METRICS_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + ) return opts } -func insecureSchema(schema string) bool { - switch strings.ToLower(schema) { - case "http", "unix": - return true - default: - return false +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg } } -// getEnvValue gets an OTLP environment variable value of the specified key using the GetEnv function. -// This function already prepends the OTLP prefix to all key lookup. -func (e *EnvOptionsReader) getEnvValue(key string) (string, bool) { - v := strings.TrimSpace(e.GetEnv(fmt.Sprintf("OTEL_EXPORTER_OTLP_%s", key))) - return v, v != "" -} - -func (e *EnvOptionsReader) readTLSConfig(path string) (*tls.Config, error) { - b, err := e.ReadFile(path) - if err != nil { - return nil, err - } - return CreateTLSConfig(b) -} +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + switch v { + case "gzip": + cp = GzipCompression + } -func stringToCompression(value string) Compression { - switch value { - case "gzip": - return GzipCompression + fn(cp) + } } - - return NoCompression } -func stringToHeader(value string) map[string]string { - headersPairs := strings.Split(value, ",") - headers := make(map[string]string) - - for _, header := range headersPairs { - nameValue := strings.SplitN(header, "=", 2) - if len(nameValue) < 2 { - continue - } - name, err := url.QueryUnescape(nameValue[0]) - if err != nil { - continue - } - trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(nameValue[1]) - if err != nil { - continue - } - trimmedValue := strings.TrimSpace(value) - - headers[trimmedName] = trimmedValue +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() } - - return headers } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go index 7a6316a2d10..25021f7328c 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go @@ -13,63 +13,3 @@ // limitations under the License. package otlpconfig - -import ( - "reflect" - "testing" -) - -func TestStringToHeader(t *testing.T) { - tests := []struct { - name string - value string - want map[string]string - }{ - { - name: "simple test", - value: "userId=alice", - want: map[string]string{"userId": "alice"}, - }, - { - name: "simple test with spaces", - value: " userId = alice ", - want: map[string]string{"userId": "alice"}, - }, - { - name: "multiples headers encoded", - value: "userId=alice,serverNode=DF%3A28,isProduction=false", - want: map[string]string{ - "userId": "alice", - "serverNode": "DF:28", - "isProduction": "false", - }, - }, - { - name: "invalid headers format", - value: "userId:alice", - want: map[string]string{}, - }, - { - name: "invalid key", - value: "%XX=missing,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - { - name: "invalid value", - value: "missing=%XX,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := stringToHeader(tt.value); !reflect.DeepEqual(got, tt.want) { - t.Errorf("stringToHeader() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index 44c9af4d94c..fad37d60be5 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" ) @@ -383,9 +384,10 @@ func TestConfigs(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { origEOR := otlpconfig.DefaultEnvOptionsReader - otlpconfig.DefaultEnvOptionsReader = otlpconfig.EnvOptionsReader{ - GetEnv: tt.env.getEnv, - ReadFile: tt.fileReader.readFile, + otlpconfig.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", } t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 77f13a1937b..1ff8b1d5fc9 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -16,66 +16,58 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" - "fmt" "io/ioutil" "net/url" "os" "path" - "strconv" "strings" "time" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -var DefaultEnvOptionsReader = EnvOptionsReader{ - GetEnv: os.Getenv, - ReadFile: ioutil.ReadFile, +// DefaultEnvOptionsReader is the default environments reader +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: ioutil.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", } +// ApplyGRPCEnvConfigs applies the env configurations for gRPC func ApplyGRPCEnvConfigs(cfg Config) Config { - return DefaultEnvOptionsReader.ApplyGRPCEnvConfigs(cfg) -} - -func ApplyHTTPEnvConfigs(cfg Config) Config { - return DefaultEnvOptionsReader.ApplyHTTPEnvConfigs(cfg) -} - -type EnvOptionsReader struct { - GetEnv func(string) string - ReadFile func(filename string) ([]byte, error) -} - -func (e *EnvOptionsReader) ApplyHTTPEnvConfigs(cfg Config) Config { - opts := e.GetOptionsFromEnv() + opts := getOptionsFromEnv() for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) + cfg = opt.ApplyGRPCOption(cfg) } return cfg } -func (e *EnvOptionsReader) ApplyGRPCEnvConfigs(cfg Config) Config { - opts := e.GetOptionsFromEnv() +// ApplyHTTPEnvConfigs applies the env configurations for HTTP +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) + cfg = opt.ApplyHTTPOption(cfg) } return cfg } -func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { - var opts []GenericOption +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} - // Endpoint - if v, ok := e.getEnvValue("TRACES_ENDPOINT"); ok { - u, err := url.Parse(v) - // Ignore invalid values. - if err == nil { - // This is used to set the scheme for OTLP/HTTP. - if insecureSchema(u.Scheme) { - opts = append(opts, WithInsecure()) - } else { - opts = append(opts, WithSecure()) - } + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("TRACES_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) opts = append(opts, newSplitOption(func(cfg Config) Config { cfg.Traces.Endpoint = u.Host // For endpoint URLs for OTLP/HTTP per-signal variables, the @@ -88,140 +80,50 @@ func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { } cfg.Traces.URLPath = path return cfg - }, func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Traces.Endpoint = path.Join(u.Host, u.Path) - return cfg - })) - } - } else if v, ok = e.getEnvValue("ENDPOINT"); ok { - u, err := url.Parse(v) - // Ignore invalid values. - if err == nil { - // This is used to set the scheme for OTLP/HTTP. - if insecureSchema(u.Scheme) { - opts = append(opts, WithInsecure()) - } else { - opts = append(opts, WithSecure()) - } - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Traces.Endpoint = u.Host - // For OTLP/HTTP endpoint URLs without a per-signal - // configuration, the passed endpoint is used as a base URL - // and the signals are sent to these paths relative to that. - cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) - return cfg - }, func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Traces.Endpoint = path.Join(u.Host, u.Path) - return cfg - })) - } - } - - // Certificate File - if path, ok := e.getEnvValue("CERTIFICATE"); ok { - if tls, err := e.readTLSConfig(path); err == nil { - opts = append(opts, WithTLSClientConfig(tls)) - } else { - otel.Handle(fmt.Errorf("failed to configure otlp exporter certificate '%s': %w", path, err)) - } - } - if path, ok := e.getEnvValue("TRACES_CERTIFICATE"); ok { - if tls, err := e.readTLSConfig(path); err == nil { - opts = append(opts, WithTLSClientConfig(tls)) - } else { - otel.Handle(fmt.Errorf("failed to configure otlp traces exporter certificate '%s': %w", path, err)) - } - } - - // Headers - if h, ok := e.getEnvValue("HEADERS"); ok { - opts = append(opts, WithHeaders(stringToHeader(h))) - } - if h, ok := e.getEnvValue("TRACES_HEADERS"); ok { - opts = append(opts, WithHeaders(stringToHeader(h))) - } - - // Compression - if c, ok := e.getEnvValue("COMPRESSION"); ok { - opts = append(opts, WithCompression(stringToCompression(c))) - } - if c, ok := e.getEnvValue("TRACES_COMPRESSION"); ok { - opts = append(opts, WithCompression(stringToCompression(c))) - } - // Timeout - if t, ok := e.getEnvValue("TIMEOUT"); ok { - if d, err := strconv.Atoi(t); err == nil { - opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) - } - } - if t, ok := e.getEnvValue("TRACES_TIMEOUT"); ok { - if d, err := strconv.Atoi(t); err == nil { - opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) - } - } + }, withEndpointForGRPC(u))) + }), + envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithTLSConfig("TRACES_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("TRACES_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("TRACES_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + ) return opts } -func insecureSchema(schema string) bool { - switch strings.ToLower(schema) { +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { case "http", "unix": - return true + return WithInsecure() default: - return false - } -} - -// getEnvValue gets an OTLP environment variable value of the specified key using the GetEnv function. -// This function already prepends the OTLP prefix to all key lookup. -func (e *EnvOptionsReader) getEnvValue(key string) (string, bool) { - v := strings.TrimSpace(e.GetEnv(fmt.Sprintf("OTEL_EXPORTER_OTLP_%s", key))) - return v, v != "" -} - -func (e *EnvOptionsReader) readTLSConfig(path string) (*tls.Config, error) { - b, err := e.ReadFile(path) - if err != nil { - return nil, err + return WithSecure() } - return CreateTLSConfig(b) } -func stringToCompression(value string) Compression { - switch value { - case "gzip": - return GzipCompression +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg } - - return NoCompression } -func stringToHeader(value string) map[string]string { - headersPairs := strings.Split(value, ",") - headers := make(map[string]string) +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + switch v { + case "gzip": + cp = GzipCompression + } - for _, header := range headersPairs { - nameValue := strings.SplitN(header, "=", 2) - if len(nameValue) < 2 { - continue - } - name, err := url.QueryUnescape(nameValue[0]) - if err != nil { - continue + fn(cp) } - trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(nameValue[1]) - if err != nil { - continue - } - trimmedValue := strings.TrimSpace(value) - - headers[trimmedName] = trimmedValue } - - return headers } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go index 7a6316a2d10..25021f7328c 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go @@ -13,63 +13,3 @@ // limitations under the License. package otlpconfig - -import ( - "reflect" - "testing" -) - -func TestStringToHeader(t *testing.T) { - tests := []struct { - name string - value string - want map[string]string - }{ - { - name: "simple test", - value: "userId=alice", - want: map[string]string{"userId": "alice"}, - }, - { - name: "simple test with spaces", - value: " userId = alice ", - want: map[string]string{"userId": "alice"}, - }, - { - name: "multiples headers encoded", - value: "userId=alice,serverNode=DF%3A28,isProduction=false", - want: map[string]string{ - "userId": "alice", - "serverNode": "DF:28", - "isProduction": "false", - }, - }, - { - name: "invalid headers format", - value: "userId:alice", - want: map[string]string{}, - }, - { - name: "invalid key", - value: "%XX=missing,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - { - name: "invalid value", - value: "missing=%XX,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := stringToHeader(tt.value); !reflect.DeepEqual(got, tt.want) { - t.Errorf("stringToHeader() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index 4efa2f7c630..30dc5ea8015 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -21,6 +21,7 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" ) @@ -381,9 +382,10 @@ func TestConfigs(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { origEOR := otlpconfig.DefaultEnvOptionsReader - otlpconfig.DefaultEnvOptionsReader = otlpconfig.EnvOptionsReader{ - GetEnv: tt.env.getEnv, - ReadFile: tt.fileReader.readFile, + otlpconfig.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", } t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) From 0d0a7320e6eab18df12e2542b4ea000ced32d5bb Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 3 Mar 2022 07:56:07 -0800 Subject: [PATCH 088/886] Update span limits to comply with specification (#2637) * PoC for span limit refactor * Rename config.go to span_limits.go * Add unit tests for truncateAttr * Add unit tests for non-string attrs * Add span limit benchmark tests * Fix lint * Isolate span limit tests * Clean span limits test * Test limits on exported spans * Remove duplicate test code * Fix lint * Add WithRawSpanLimits option * Add test for raw and orig span limits opts * Add changes to changelog * Add tests for span resource disabled * Test unlimited instead of default limit * Update docs * Add fix to changelog * Fix option docs * Do no mutate attribute * Fix truncateAttr comment * Remake NewSpanLimits to be newEnvSpanLimits Update and unify documentation accordingly. * Update truncateAttr string slice update comment * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 23 ++- sdk/internal/env/env.go | 61 +++++++- sdk/trace/benchmark_test.go | 102 +++++++++++- sdk/trace/config.go | 84 ---------- sdk/trace/evictedqueue.go | 7 +- sdk/trace/provider.go | 66 ++++++-- sdk/trace/provider_test.go | 61 -------- sdk/trace/span.go | 116 ++++++++++---- sdk/trace/span_limits.go | 126 +++++++++++++++ sdk/trace/span_limits_test.go | 283 ++++++++++++++++++++++++++++++++++ sdk/trace/span_test.go | 145 +++++++++++++++++ sdk/trace/trace_test.go | 23 ++- 12 files changed, 895 insertions(+), 202 deletions(-) delete mode 100644 sdk/trace/config.go create mode 100644 sdk/trace/span_limits.go create mode 100644 sdk/trace/span_limits_test.go create mode 100644 sdk/trace/span_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b90c3a4b167..d7d51e21893 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,15 +14,26 @@ This update is a breaking change of the unstable Metrics API. Code instrumented ### Added +- Log the Exporters configuration in the TracerProviders message. (#2578) - Added support to configure the span limits with environment variables. - The following environment variables are used. (#2606) + The following environment variables are used. (#2606, #2637) + - `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` - `OTEL_SPAN_EVENT_COUNT_LIMIT` + - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` - `OTEL_SPAN_LINK_COUNT_LIMIT` + - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) -- Log the Exporters configuration in the TracerProviders message. (#2578) +- Add span attribute value length limit. + The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. + The default limit for this resource is "unlimited". (#2637) +- Add the `WithRawSpanLimits` option to `go.opentelemetry.io/otel/sdk/trace`. + This option replaces the `WithSpanLimits` option. + Zero or negative values will not be changed to the default value like `WithSpanLimits` does. + Setting a limit to zero will effectively disable the related resource it limits and setting to a negative value will mean that resource is unlimited. + Consequentially, limits should be constructed using `NewSpanLimits` and updated accordingly. (#2637) ### Changed @@ -37,6 +48,14 @@ This update is a breaking change of the unstable Metrics API. Code instrumented - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) - Use port `4318` instead of `4317` for default for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) +- Unlimited span limits are now supported (negative values). (#2636, #2637) + +### Deprecated + +- Deprecated `"go.opentelemetry.io/otel/sdk/trace".WithSpanLimits`. + Use `WithRawSpanLimits` instead. + That option allows setting unlimited and zero limits, this option does not. + This option will be kept until the next major version incremented release. (#2637) ## [1.4.1] - 2022-02-16 diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index df7a05626b3..dbc8f512492 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -41,20 +41,29 @@ const ( // i.e. 512 BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" - // SpanAttributesCountKey + // SpanAttributeValueLengthKey + // Maximum allowed attribute value size. + SpanAttributeValueLengthKey = "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT" + + // SpanAttributeCountKey // Maximum allowed span attribute count - // Default: 128 - SpanAttributesCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" + SpanAttributeCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" // SpanEventCountKey // Maximum allowed span event count - // Default: 128 SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT" + // SpanEventAttributeCountKey + // Maximum allowed attribute per span event count. + SpanEventAttributeCountKey = "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT" + // SpanLinkCountKey // Maximum allowed span link count - // Default: 128 SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT" + + // SpanLinkAttributeCountKey + // Maximum allowed attribute per span link count + SpanLinkAttributeCountKey = "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT" ) // IntEnvOr returns the int value of the environment variable with name key if @@ -101,3 +110,45 @@ func BatchSpanProcessorMaxQueueSize(defaultValue int) int { func BatchSpanProcessorMaxExportBatchSize(defaultValue int) int { return IntEnvOr(BatchSpanProcessorMaxExportBatchSizeKey, defaultValue) } + +// SpanAttributeValueLength returns the environment variable value for the +// OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists, otherwise +// defaultValue is returned. +func SpanAttributeValueLength(defaultValue int) int { + return IntEnvOr(SpanAttributeValueLengthKey, defaultValue) +} + +// SpanAttributeCount returns the environment variable value for the +// OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue is +// returned. +func SpanAttributeCount(defaultValue int) int { + return IntEnvOr(SpanAttributeCountKey, defaultValue) +} + +// SpanEventCount returns the environment variable value for the +// OTEL_SPAN_EVENT_COUNT_LIMIT key if it exists, otherwise defaultValue is +// returned. +func SpanEventCount(defaultValue int) int { + return IntEnvOr(SpanEventCountKey, defaultValue) +} + +// SpanEventAttributeCount returns the environment variable value for the +// OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue +// is returned. +func SpanEventAttributeCount(defaultValue int) int { + return IntEnvOr(SpanEventAttributeCountKey, defaultValue) +} + +// SpanLinkCount returns the environment variable value for the +// OTEL_SPAN_LINK_COUNT_LIMIT key if it exists, otherwise defaultValue is +// returned. +func SpanLinkCount(defaultValue int) int { + return IntEnvOr(SpanLinkCountKey, defaultValue) +} + +// SpanLinkAttributeCount returns the environment variable value for the +// OTEL_LINK_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue is +// returned. +func SpanLinkAttributeCount(defaultValue int) int { + return IntEnvOr(SpanLinkAttributeCountKey, defaultValue) +} diff --git a/sdk/trace/benchmark_test.go b/sdk/trace/benchmark_test.go index 81a06e2f8f9..b7dde8d96b0 100644 --- a/sdk/trace/benchmark_test.go +++ b/sdk/trace/benchmark_test.go @@ -25,10 +25,106 @@ import ( "go.opentelemetry.io/otel/trace" ) +func benchmarkSpanLimits(b *testing.B, limits sdktrace.SpanLimits) { + tp := sdktrace.NewTracerProvider(sdktrace.WithSpanLimits(limits)) + tracer := tp.Tracer(b.Name()) + ctx := context.Background() + + const count = 8 + + attrs := []attribute.KeyValue{ + attribute.Bool("bool", true), + attribute.BoolSlice("boolSlice", []bool{true, false}), + attribute.Int("int", 42), + attribute.IntSlice("intSlice", []int{42, -1}), + attribute.Int64("int64", 42), + attribute.Int64Slice("int64Slice", []int64{42, -1}), + attribute.Float64("float64", 42), + attribute.Float64Slice("float64Slice", []float64{42, -1}), + attribute.String("string", "value"), + attribute.StringSlice("stringSlice", []string{"value", "value-1"}), + } + + links := make([]trace.Link, count) + for i := range links { + links[i] = trace.Link{ + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: [16]byte{0x01}, + SpanID: [8]byte{0x01}, + }), + Attributes: attrs, + } + } + + events := make([]struct { + name string + attr []attribute.KeyValue + }, count) + for i := range events { + events[i] = struct { + name string + attr []attribute.KeyValue + }{ + name: fmt.Sprintf("event-%d", i), + attr: attrs, + } + } + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, span := tracer.Start(ctx, "span-name", trace.WithLinks(links...)) + span.SetAttributes(attrs...) + for _, e := range events { + span.AddEvent(e.name, trace.WithAttributes(e.attr...)) + } + span.End() + } +} + +func BenchmarkSpanLimits(b *testing.B) { + b.Run("AttributeValueLengthLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.AttributeValueLengthLimit = 2 + benchmarkSpanLimits(b, limits) + }) + + b.Run("AttributeCountLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.AttributeCountLimit = 1 + benchmarkSpanLimits(b, limits) + }) + + b.Run("EventCountLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.EventCountLimit = 1 + benchmarkSpanLimits(b, limits) + }) + + b.Run("LinkCountLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.LinkCountLimit = 1 + benchmarkSpanLimits(b, limits) + }) + + b.Run("AttributePerEventCountLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.AttributePerEventCountLimit = 1 + benchmarkSpanLimits(b, limits) + }) + + b.Run("AttributePerLinkCountLimit", func(b *testing.B) { + limits := sdktrace.NewSpanLimits() + limits.AttributePerLinkCountLimit = 1 + benchmarkSpanLimits(b, limits) + }) +} + func BenchmarkSpanSetAttributesOverCapacity(b *testing.B) { - tp := sdktrace.NewTracerProvider( - sdktrace.WithSpanLimits(sdktrace.SpanLimits{AttributeCountLimit: 1}), - ) + limits := sdktrace.NewSpanLimits() + limits.AttributeCountLimit = 1 + tp := sdktrace.NewTracerProvider(sdktrace.WithSpanLimits(limits)) tracer := tp.Tracer("BenchmarkSpanSetAttributesOverCapacity") ctx := context.Background() attrs := make([]attribute.KeyValue, 128) diff --git a/sdk/trace/config.go b/sdk/trace/config.go deleted file mode 100644 index efea7b302f9..00000000000 --- a/sdk/trace/config.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package trace // import "go.opentelemetry.io/otel/sdk/trace" -import "go.opentelemetry.io/otel/sdk/internal/env" - -// SpanLimits represents the limits of a span. -type SpanLimits struct { - // AttributeCountLimit is the maximum allowed span attribute count. - AttributeCountLimit int - - // EventCountLimit is the maximum allowed span event count. - EventCountLimit int - - // LinkCountLimit is the maximum allowed span link count. - LinkCountLimit int - - // AttributePerEventCountLimit is the maximum allowed attribute per span event count. - AttributePerEventCountLimit int - - // AttributePerLinkCountLimit is the maximum allowed attribute per span link count. - AttributePerLinkCountLimit int -} - -func (sl *SpanLimits) ensureDefault() { - if sl.EventCountLimit <= 0 { - sl.EventCountLimit = DefaultEventCountLimit - } - if sl.AttributeCountLimit <= 0 { - sl.AttributeCountLimit = DefaultAttributeCountLimit - } - if sl.LinkCountLimit <= 0 { - sl.LinkCountLimit = DefaultLinkCountLimit - } - if sl.AttributePerEventCountLimit <= 0 { - sl.AttributePerEventCountLimit = DefaultAttributePerEventCountLimit - } - if sl.AttributePerLinkCountLimit <= 0 { - sl.AttributePerLinkCountLimit = DefaultAttributePerLinkCountLimit - } -} - -func (sl *SpanLimits) parsePotentialEnvConfigs() { - sl.AttributeCountLimit = env.IntEnvOr(env.SpanAttributesCountKey, sl.AttributeCountLimit) - sl.LinkCountLimit = env.IntEnvOr(env.SpanLinkCountKey, sl.LinkCountLimit) - sl.EventCountLimit = env.IntEnvOr(env.SpanEventCountKey, sl.EventCountLimit) -} - -const ( - // DefaultAttributeCountLimit is the default maximum allowed span attribute count. - // If not specified via WithSpanLimits, will try to retrieve the value from - // environment variable `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`. - // If Invalid value (negative or zero) is provided, the default value 128 will be used. - DefaultAttributeCountLimit = 128 - - // DefaultEventCountLimit is the default maximum allowed span event count. - // If not specified via WithSpanLimits, will try to retrieve the value from - // environment variable `OTEL_SPAN_EVENT_COUNT_LIMIT`. - // If Invalid value (negative or zero) is provided, the default value 128 will be used. - DefaultEventCountLimit = 128 - - // DefaultLinkCountLimit is the default maximum allowed span link count. - // If the value is not specified via WithSpanLimits, will try to retrieve the value from - // environment variable `OTEL_SPAN_LINK_COUNT_LIMIT`. - // If Invalid value (negative or zero) is provided, the default value 128 will be used. - DefaultLinkCountLimit = 128 - - // DefaultAttributePerEventCountLimit is the default maximum allowed attribute per span event count. - DefaultAttributePerEventCountLimit = 128 - - // DefaultAttributePerLinkCountLimit is the default maximum allowed attribute per span link count. - DefaultAttributePerLinkCountLimit = 128 -) diff --git a/sdk/trace/evictedqueue.go b/sdk/trace/evictedqueue.go index 8e89e19d4b9..d1c86e59b22 100644 --- a/sdk/trace/evictedqueue.go +++ b/sdk/trace/evictedqueue.go @@ -29,7 +29,12 @@ func newEvictedQueue(capacity int) evictedQueue { // add adds value to the evictedQueue eq. If eq is at capacity, the oldest // queued value will be discarded and the drop count incremented. func (eq *evictedQueue) add(value interface{}) { - if len(eq.queue) == eq.capacity { + if eq.capacity == 0 { + eq.droppedCount++ + return + } + + if eq.capacity > 0 && len(eq.queue) == eq.capacity { // Drop first-in while avoiding allocating more capacity to eq.queue. copy(eq.queue[:eq.capacity-1], eq.queue[1:]) eq.queue = eq.queue[:eq.capacity-1] diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 2de79f03397..0643d1a1611 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -96,9 +96,10 @@ var _ trace.TracerProvider = &TracerProvider{} // The passed opts are used to override these default values and configure the // returned TracerProvider appropriately. func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { - o := tracerProviderConfig{} + o := tracerProviderConfig{ + spanLimits: NewSpanLimits(), + } - o.spanLimits.parsePotentialEnvConfigs() for _, opt := range opts { o = opt.apply(o) } @@ -345,20 +346,68 @@ func WithSampler(s Sampler) TracerProviderOption { }) } -// WithSpanLimits returns a TracerProviderOption that will configure the -// SpanLimits sl as a TracerProvider's SpanLimits. The configured SpanLimits -// are used used by the Tracers the TracerProvider and the Spans they create -// to limit tracing resources used. +// WithSpanLimits returns a TracerProviderOption that configures a +// TracerProvider to use the SpanLimits sl. These SpanLimits bound any Span +// created by a Tracer from the TracerProvider. +// +// If any field of sl is zero or negative it will be replaced with the default +// value for that field. // -// If this option is not used, the TracerProvider will use the default -// SpanLimits. +// If this or WithRawSpanLimits are not provided, the TracerProvider will use +// the limits defined by environment variables, or the defaults if unset. +// Refer to the NewSpanLimits documentation for information about this +// relationship. +// +// Deprecated: Use WithRawSpanLimits instead which allows setting unlimited +// and zero limits. This option will be kept until the next major version +// incremented release. func WithSpanLimits(sl SpanLimits) TracerProviderOption { + if sl.AttributeValueLengthLimit <= 0 { + sl.AttributeValueLengthLimit = DefaultAttributeValueLengthLimit + } + if sl.AttributeCountLimit <= 0 { + sl.AttributeCountLimit = DefaultAttributeCountLimit + } + if sl.EventCountLimit <= 0 { + sl.EventCountLimit = DefaultEventCountLimit + } + if sl.AttributePerEventCountLimit <= 0 { + sl.AttributePerEventCountLimit = DefaultAttributePerEventCountLimit + } + if sl.LinkCountLimit <= 0 { + sl.LinkCountLimit = DefaultLinkCountLimit + } + if sl.AttributePerLinkCountLimit <= 0 { + sl.AttributePerLinkCountLimit = DefaultAttributePerLinkCountLimit + } return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { cfg.spanLimits = sl return cfg }) } +// WithRawSpanLimits returns a TracerProviderOption that configures a +// TracerProvider to use these limits. These limits bound any Span created by +// a Tracer from the TracerProvider. +// +// The limits will be used as-is. Zero or negative values will not be changed +// to the default value like WithSpanLimits does. Setting a limit to zero will +// effectively disable the related resource it limits and setting to a +// negative value will mean that resource is unlimited. Consequentially, this +// means that the zero-value SpanLimits will disable all span resources. +// Because of this, limits should be constructed using NewSpanLimits and +// updated accordingly. +// +// If this or WithSpanLimits are not provided, the TracerProvider will use the +// limits defined by environment variables, or the defaults if unset. Refer to +// the NewSpanLimits documentation for information about this relationship. +func WithRawSpanLimits(limits SpanLimits) TracerProviderOption { + return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { + cfg.spanLimits = limits + return cfg + }) +} + // ensureValidTracerProviderConfig ensures that given TracerProviderConfig is valid. func ensureValidTracerProviderConfig(cfg tracerProviderConfig) tracerProviderConfig { if cfg.sampler == nil { @@ -367,7 +416,6 @@ func ensureValidTracerProviderConfig(cfg tracerProviderConfig) tracerProviderCon if cfg.idGenerator == nil { cfg.idGenerator = defaultIDGenerator() } - cfg.spanLimits.ensureDefault() if cfg.resource == nil { cfg.resource = resource.Default() } diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 0633889bdc2..e2fce31d7f7 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -17,14 +17,8 @@ package trace import ( "context" "errors" - "os" "testing" - "github.com/stretchr/testify/require" - - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/sdk/internal/env" - "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/trace" @@ -100,58 +94,3 @@ func TestSchemaURL(t *testing.T) { tracerStruct := tracerIface.(*tracer) assert.EqualValues(t, schemaURL, tracerStruct.instrumentationLibrary.SchemaURL) } - -func TestNewTraceProviderWithoutSpanLimitConfiguration(t *testing.T) { - envStore := ottest.NewEnvStore() - defer func() { - require.NoError(t, envStore.Restore()) - }() - envStore.Record(env.SpanAttributesCountKey) - envStore.Record(env.SpanEventCountKey) - envStore.Record(env.SpanLinkCountKey) - require.NoError(t, os.Setenv(env.SpanEventCountKey, "111")) - require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "222")) - require.NoError(t, os.Setenv(env.SpanLinkCountKey, "333")) - tp := NewTracerProvider() - assert.Equal(t, 111, tp.spanLimits.EventCountLimit) - assert.Equal(t, 222, tp.spanLimits.AttributeCountLimit) - assert.Equal(t, 333, tp.spanLimits.LinkCountLimit) -} - -func TestNewTraceProviderWithSpanLimitConfigurationFromOptsAndEnvironmentVariable(t *testing.T) { - envStore := ottest.NewEnvStore() - defer func() { - require.NoError(t, envStore.Restore()) - }() - envStore.Record(env.SpanAttributesCountKey) - envStore.Record(env.SpanEventCountKey) - envStore.Record(env.SpanLinkCountKey) - require.NoError(t, os.Setenv(env.SpanEventCountKey, "111")) - require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "222")) - require.NoError(t, os.Setenv(env.SpanLinkCountKey, "333")) - tp := NewTracerProvider(WithSpanLimits(SpanLimits{ - EventCountLimit: 1, - AttributeCountLimit: 2, - LinkCountLimit: 3, - })) - assert.Equal(t, 1, tp.spanLimits.EventCountLimit) - assert.Equal(t, 2, tp.spanLimits.AttributeCountLimit) - assert.Equal(t, 3, tp.spanLimits.LinkCountLimit) -} - -func TestNewTraceProviderWithInvalidSpanLimitConfigurationFromEnvironmentVariable(t *testing.T) { - envStore := ottest.NewEnvStore() - defer func() { - require.NoError(t, envStore.Restore()) - }() - envStore.Record(env.SpanAttributesCountKey) - envStore.Record(env.SpanEventCountKey) - envStore.Record(env.SpanLinkCountKey) - require.NoError(t, os.Setenv(env.SpanEventCountKey, "-111")) - require.NoError(t, os.Setenv(env.SpanAttributesCountKey, "-222")) - require.NoError(t, os.Setenv(env.SpanLinkCountKey, "-333")) - tp := NewTracerProvider() - assert.Equal(t, 128, tp.spanLimits.EventCountLimit) - assert.Equal(t, 128, tp.spanLimits.AttributeCountLimit) - assert.Equal(t, 128, tp.spanLimits.LinkCountLimit) -} diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 779cde691dd..f2dda294580 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -212,10 +212,17 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { s.mu.Lock() defer s.mu.Unlock() + limit := s.tracer.provider.spanLimits.AttributeCountLimit + if limit == 0 { + // No attributes allowed. + s.droppedAttributes += len(attributes) + return + } + // If adding these attributes could exceed the capacity of s perform a // de-duplication and truncation while adding to avoid over allocation. - if len(s.attributes)+len(attributes) > s.tracer.provider.spanLimits.AttributeCountLimit { - s.addOverCapAttrs(attributes) + if limit > 0 && len(s.attributes)+len(attributes) > limit { + s.addOverCapAttrs(limit, attributes) return } @@ -227,21 +234,25 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { s.droppedAttributes++ continue } + a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a) s.attributes = append(s.attributes, a) } } // addOverCapAttrs adds the attributes attrs to the span s while // de-duplicating the attributes of s and attrs and dropping attributes that -// exceed the capacity of s. +// exceed the limit. // // This method assumes s.mu.Lock is held by the caller. // // This method should only be called when there is a possibility that adding -// attrs to s will exceed the capacity of s. Otherwise, attrs should be added -// to s without checking for duplicates and all retrieval methods of the -// attributes for s will de-duplicate as needed. -func (s *recordingSpan) addOverCapAttrs(attrs []attribute.KeyValue) { +// attrs to s will exceed the limit. Otherwise, attrs should be added to s +// without checking for duplicates and all retrieval methods of the attributes +// for s will de-duplicate as needed. +// +// This method assumes limit is a value > 0. The argument should be validated +// by the caller. +func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // In order to not allocate more capacity to s.attributes than needed, // prune and truncate this addition of attributes while adding. @@ -265,17 +276,58 @@ func (s *recordingSpan) addOverCapAttrs(attrs []attribute.KeyValue) { continue } - if len(s.attributes) >= s.tracer.provider.spanLimits.AttributeCountLimit { + if len(s.attributes) >= limit { // Do not just drop all of the remaining attributes, make sure // updates are checked and performed. s.droppedAttributes++ } else { + a = truncateAttr(s.tracer.provider.spanLimits.AttributeValueLengthLimit, a) s.attributes = append(s.attributes, a) exists[a.Key] = len(s.attributes) - 1 } } } +// truncateAttr returns a truncated version of attr. Only string and string +// slice attribute values are truncated. String values are truncated to at +// most a length of limit. Each string slice value is truncated in this fasion +// (the slice length itself is unaffected). +// +// No truncation is perfromed for a negative limit. +func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { + if limit < 0 { + return attr + } + switch attr.Value.Type() { + case attribute.STRING: + if v := attr.Value.AsString(); len(v) > limit { + return attr.Key.String(v[:limit]) + } + case attribute.STRINGSLICE: + // Do no mutate the original, make a copy. + trucated := attr.Key.StringSlice(attr.Value.AsStringSlice()) + // Do not do this. + // + // v := trucated.Value.AsStringSlice() + // cp := make([]string, len(v)) + // /* Copy and truncate values to cp ... */ + // trucated.Value = attribute.StringSliceValue(cp) + // + // Copying the []string and then assigning it back as a new value with + // attribute.StringSliceValue will copy the data twice. Instead, we + // already made a copy above that only this function owns, update the + // underlying slice data of our copy. + v := trucated.Value.AsStringSlice() + for i := range v { + if len(v[i]) > limit { + v[i] = v[i][:limit] + } + } + return trucated + } + return attr +} + // End ends the span. This method does nothing if the span is already ended or // is not being recorded. // @@ -396,22 +448,23 @@ func (s *recordingSpan) AddEvent(name string, o ...trace.EventOption) { func (s *recordingSpan) addEvent(name string, o ...trace.EventOption) { c := trace.NewEventConfig(o...) + e := Event{Name: name, Attributes: c.Attributes(), Time: c.Timestamp()} - // Discard over limited attributes - attributes := c.Attributes() - var discarded int - if len(attributes) > s.tracer.provider.spanLimits.AttributePerEventCountLimit { - discarded = len(attributes) - s.tracer.provider.spanLimits.AttributePerEventCountLimit - attributes = attributes[:s.tracer.provider.spanLimits.AttributePerEventCountLimit] + // Discard attributes over limit. + limit := s.tracer.provider.spanLimits.AttributePerEventCountLimit + if limit == 0 { + // Drop all attributes. + e.DroppedAttributeCount = len(e.Attributes) + e.Attributes = nil + } else if limit > 0 && len(e.Attributes) > limit { + // Drop over capacity. + e.DroppedAttributeCount = len(e.Attributes) - limit + e.Attributes = e.Attributes[:limit] } + s.mu.Lock() - defer s.mu.Unlock() - s.events.add(Event{ - Name: name, - Attributes: attributes, - DroppedAttributeCount: discarded, - Time: c.Timestamp(), - }) + s.events.add(e) + s.mu.Unlock() } // SetName sets the name of this span. If this span is not being recorded than @@ -551,18 +604,23 @@ func (s *recordingSpan) addLink(link trace.Link) { if !s.IsRecording() || !link.SpanContext.IsValid() { return } - s.mu.Lock() - defer s.mu.Unlock() - var droppedAttributeCount int + l := Link{SpanContext: link.SpanContext, Attributes: link.Attributes} - // Discard over limited attributes - if len(link.Attributes) > s.tracer.provider.spanLimits.AttributePerLinkCountLimit { - droppedAttributeCount = len(link.Attributes) - s.tracer.provider.spanLimits.AttributePerLinkCountLimit - link.Attributes = link.Attributes[:s.tracer.provider.spanLimits.AttributePerLinkCountLimit] + // Discard attributes over limit. + limit := s.tracer.provider.spanLimits.AttributePerLinkCountLimit + if limit == 0 { + // Drop all attributes. + l.DroppedAttributeCount = len(l.Attributes) + l.Attributes = nil + } else if limit > 0 && len(l.Attributes) > limit { + l.DroppedAttributeCount = len(l.Attributes) - limit + l.Attributes = l.Attributes[:limit] } - s.links.add(Link{link.SpanContext, link.Attributes, droppedAttributeCount}) + s.mu.Lock() + s.links.add(l) + s.mu.Unlock() } // DroppedAttributes returns the number of attributes dropped by the span diff --git a/sdk/trace/span_limits.go b/sdk/trace/span_limits.go new file mode 100644 index 00000000000..b2c47584ae5 --- /dev/null +++ b/sdk/trace/span_limits.go @@ -0,0 +1,126 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/sdk/trace" + +import "go.opentelemetry.io/otel/sdk/internal/env" + +const ( + // DefaultAttributeValueLengthLimit is the default maximum allowed + // attribute value length, unlimited. + DefaultAttributeValueLengthLimit = -1 + + // DefaultAttributeCountLimit is the default maximum number of attributes + // a span can have. + DefaultAttributeCountLimit = 128 + + // DefaultEventCountLimit is the default maximum number of events a span + // can have. + DefaultEventCountLimit = 128 + + // DefaultLinkCountLimit is the default maximum number of links a span can + // have. + DefaultLinkCountLimit = 128 + + // DefaultAttributePerEventCountLimit is the default maximum number of + // attributes a span event can have. + DefaultAttributePerEventCountLimit = 128 + + // DefaultAttributePerLinkCountLimit is the default maximum number of + // attributes a span link can have. + DefaultAttributePerLinkCountLimit = 128 +) + +// SpanLimits represents the limits of a span. +type SpanLimits struct { + // AttributeValueLengthLimit is the maximum allowed attribute value length. + // + // This limit only applies to string and string slice attribute values. + // Any string longer than this value will be truncated to this length. + // + // Setting this to a negative value means no limit is applied. + AttributeValueLengthLimit int + + // AttributeCountLimit is the maximum allowed span attribute count. Any + // attribute added to a span once this limit is reached will be dropped. + // + // Setting this to zero means no attributes will be recorded. + // + // Setting this to a negative value means no limit is applied. + AttributeCountLimit int + + // EventCountLimit is the maximum allowed span event count. Any event + // added to a span once this limit is reached means it will be added but + // the oldest event will be dropped. + // + // Setting this to zero means no events we be recorded. + // + // Setting this to a negative value means no limit is applied. + EventCountLimit int + + // LinkCountLimit is the maximum allowed span link count. Any link added + // to a span once this limit is reached means it will be added but the + // oldest link will be dropped. + // + // Setting this to zero means no links we be recorded. + // + // Setting this to a negative value means no limit is applied. + LinkCountLimit int + + // AttributePerEventCountLimit is the maximum number of attributes allowed + // per span event. Any attribute added after this limit reached will be + // dropped. + // + // Setting this to zero means no attributes will be recorded for events. + // + // Setting this to a negative value means no limit is applied. + AttributePerEventCountLimit int + + // AttributePerLinkCountLimit is the maximum number of attributes allowed + // per span link. Any attribute added after this limit reached will be + // dropped. + // + // Setting this to zero means no attributes will be recorded for links. + // + // Setting this to a negative value means no limit is applied. + AttributePerLinkCountLimit int +} + +// NewSpanLimits returns a SpanLimits with all limits set to the value their +// corresponding environment variable holds, or the default if unset. +// +// • AttributeValueLengthLimit: OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT +// (default: unlimited) +// +// • AttributeCountLimit: OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT (default: 128) +// +// • EventCountLimit: OTEL_SPAN_EVENT_COUNT_LIMIT (default: 128) +// +// • AttributePerEventCountLimit: OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT (default: +// 128) +// +// • LinkCountLimit: OTEL_SPAN_LINK_COUNT_LIMIT (default: 128) +// +// • AttributePerLinkCountLimit: OTEL_LINK_ATTRIBUTE_COUNT_LIMIT (default: +// 128) +func NewSpanLimits() SpanLimits { + return SpanLimits{ + AttributeValueLengthLimit: env.SpanAttributeValueLength(DefaultAttributeValueLengthLimit), + AttributeCountLimit: env.SpanAttributeCount(DefaultAttributeCountLimit), + EventCountLimit: env.SpanEventCount(DefaultEventCountLimit), + LinkCountLimit: env.SpanLinkCount(DefaultLinkCountLimit), + AttributePerEventCountLimit: env.SpanEventAttributeCount(DefaultAttributePerEventCountLimit), + AttributePerLinkCountLimit: env.SpanLinkAttributeCount(DefaultAttributePerLinkCountLimit), + } +} diff --git a/sdk/trace/span_limits_test.go b/sdk/trace/span_limits_test.go new file mode 100644 index 00000000000..91199516c56 --- /dev/null +++ b/sdk/trace/span_limits_test.go @@ -0,0 +1,283 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "context" + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + ottest "go.opentelemetry.io/otel/internal/internaltest" + "go.opentelemetry.io/otel/sdk/internal/env" + "go.opentelemetry.io/otel/trace" +) + +func TestSettingSpanLimits(t *testing.T) { + envLimits := func(val string) map[string]string { + return map[string]string{ + env.SpanAttributeValueLengthKey: val, + env.SpanEventCountKey: val, + env.SpanAttributeCountKey: val, + env.SpanLinkCountKey: val, + env.SpanEventAttributeCountKey: val, + env.SpanLinkAttributeCountKey: val, + } + } + + limits := func(n int) *SpanLimits { + lims := NewSpanLimits() + lims.AttributeValueLengthLimit = n + lims.AttributeCountLimit = n + lims.EventCountLimit = n + lims.LinkCountLimit = n + lims.AttributePerEventCountLimit = n + lims.AttributePerLinkCountLimit = n + return &lims + } + + tests := []struct { + name string + env map[string]string + opt *SpanLimits + rawOpt *SpanLimits + want SpanLimits + }{ + { + name: "defaults", + want: NewSpanLimits(), + }, + { + name: "env", + env: envLimits("42"), + want: *(limits(42)), + }, + { + name: "opt", + opt: limits(42), + want: *(limits(42)), + }, + { + name: "raw-opt", + rawOpt: limits(42), + want: *(limits(42)), + }, + { + name: "opt-override", + env: envLimits("-2"), + // Option take priority. + opt: limits(43), + want: *(limits(43)), + }, + { + name: "raw-opt-override", + env: envLimits("-2"), + // Option take priority. + rawOpt: limits(43), + want: *(limits(43)), + }, + { + name: "last-opt-wins", + opt: limits(-2), + rawOpt: limits(-3), + want: *(limits(-3)), + }, + { + name: "env(unlimited)", + // OTel spec says negative SpanLinkAttributeCountKey is invalid, + // but since we will revert to the default (unlimited) which uses + // negative values to signal this than this value is expected to + // pass through. + env: envLimits("-1"), + want: *(limits(-1)), + }, + { + name: "opt(unlimited)", + // Corrects to defaults. + opt: limits(-1), + want: NewSpanLimits(), + }, + { + name: "raw-opt(unlimited)", + rawOpt: limits(-1), + want: *(limits(-1)), + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if test.env != nil { + es := ottest.NewEnvStore() + t.Cleanup(func() { require.NoError(t, es.Restore()) }) + for k, v := range test.env { + es.Record(k) + require.NoError(t, os.Setenv(k, v)) + } + } + + var opts []TracerProviderOption + if test.opt != nil { + opts = append(opts, WithSpanLimits(*test.opt)) + } + if test.rawOpt != nil { + opts = append(opts, WithRawSpanLimits(*test.rawOpt)) + } + + assert.Equal(t, test.want, NewTracerProvider(opts...).spanLimits) + }) + } +} + +type recorder []ReadOnlySpan + +func (r *recorder) OnStart(context.Context, ReadWriteSpan) {} +func (r *recorder) OnEnd(s ReadOnlySpan) { *r = append(*r, s) } +func (r *recorder) ForceFlush(context.Context) error { return nil } +func (r *recorder) Shutdown(context.Context) error { return nil } + +func testSpanLimits(t *testing.T, limits SpanLimits) ReadOnlySpan { + rec := new(recorder) + tp := NewTracerProvider(WithRawSpanLimits(limits), WithSpanProcessor(rec)) + tracer := tp.Tracer("testSpanLimits") + + ctx := context.Background() + a := []attribute.KeyValue{attribute.Bool("one", true), attribute.Bool("two", true)} + l := trace.Link{ + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: [16]byte{0x01}, + SpanID: [8]byte{0x01}, + }), + Attributes: a, + } + _, span := tracer.Start(ctx, "span-name", trace.WithLinks(l, l)) + span.SetAttributes( + attribute.String("string", "abc"), + attribute.StringSlice("stringSlice", []string{"abc", "def"}), + ) + span.AddEvent("event 1", trace.WithAttributes(a...)) + span.AddEvent("event 2", trace.WithAttributes(a...)) + span.End() + require.NoError(t, tp.Shutdown(ctx)) + + require.Len(t, *rec, 1, "exported spans") + return (*rec)[0] +} + +func TestSpanLimits(t *testing.T) { + t.Run("AttributeValueLengthLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.AttributeValueLengthLimit = -1 + attrs := testSpanLimits(t, limits).Attributes() + assert.Contains(t, attrs, attribute.String("string", "abc")) + assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"abc", "def"})) + + limits.AttributeValueLengthLimit = 2 + attrs = testSpanLimits(t, limits).Attributes() + // Ensure string and string slice attributes are truncated. + assert.Contains(t, attrs, attribute.String("string", "ab")) + assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"ab", "de"})) + + limits.AttributeValueLengthLimit = 0 + attrs = testSpanLimits(t, limits).Attributes() + assert.Contains(t, attrs, attribute.String("string", "")) + assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"", ""})) + }) + + t.Run("AttributeCountLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.AttributeCountLimit = -1 + assert.Len(t, testSpanLimits(t, limits).Attributes(), 2) + + limits.AttributeCountLimit = 1 + assert.Len(t, testSpanLimits(t, limits).Attributes(), 1) + + // Ensure this can be disabled. + limits.AttributeCountLimit = 0 + assert.Len(t, testSpanLimits(t, limits).Attributes(), 0) + }) + + t.Run("EventCountLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.EventCountLimit = -1 + assert.Len(t, testSpanLimits(t, limits).Events(), 2) + + limits.EventCountLimit = 1 + assert.Len(t, testSpanLimits(t, limits).Events(), 1) + + // Ensure this can be disabled. + limits.EventCountLimit = 0 + assert.Len(t, testSpanLimits(t, limits).Events(), 0) + }) + + t.Run("AttributePerEventCountLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.AttributePerEventCountLimit = -1 + for _, e := range testSpanLimits(t, limits).Events() { + assert.Len(t, e.Attributes, 2) + } + + limits.AttributePerEventCountLimit = 1 + for _, e := range testSpanLimits(t, limits).Events() { + assert.Len(t, e.Attributes, 1) + } + + // Ensure this can be disabled. + limits.AttributePerEventCountLimit = 0 + for _, e := range testSpanLimits(t, limits).Events() { + assert.Len(t, e.Attributes, 0) + } + }) + + t.Run("LinkCountLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.LinkCountLimit = -1 + assert.Len(t, testSpanLimits(t, limits).Links(), 2) + + limits.LinkCountLimit = 1 + assert.Len(t, testSpanLimits(t, limits).Links(), 1) + + // Ensure this can be disabled. + limits.LinkCountLimit = 0 + assert.Len(t, testSpanLimits(t, limits).Links(), 0) + }) + + t.Run("AttributePerLinkCountLimit", func(t *testing.T) { + limits := NewSpanLimits() + // Unlimited. + limits.AttributePerLinkCountLimit = -1 + for _, l := range testSpanLimits(t, limits).Links() { + assert.Len(t, l.Attributes, 2) + } + + limits.AttributePerLinkCountLimit = 1 + for _, l := range testSpanLimits(t, limits).Links() { + assert.Len(t, l.Attributes, 1) + } + + // Ensure this can be disabled. + limits.AttributePerLinkCountLimit = 0 + for _, l := range testSpanLimits(t, limits).Links() { + assert.Len(t, l.Attributes, 0) + } + }) +} diff --git a/sdk/trace/span_test.go b/sdk/trace/span_test.go new file mode 100644 index 00000000000..2c7992e457e --- /dev/null +++ b/sdk/trace/span_test.go @@ -0,0 +1,145 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "bytes" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" +) + +func TestTruncateAttr(t *testing.T) { + const key = "key" + + strAttr := attribute.String(key, "value") + strSliceAttr := attribute.StringSlice(key, []string{"value-0", "value-1"}) + + tests := []struct { + limit int + attr, want attribute.KeyValue + }{ + { + limit: -1, + attr: strAttr, + want: strAttr, + }, + { + limit: -1, + attr: strSliceAttr, + want: strSliceAttr, + }, + { + limit: 0, + attr: attribute.Bool(key, true), + want: attribute.Bool(key, true), + }, + { + limit: 0, + attr: attribute.BoolSlice(key, []bool{true, false}), + want: attribute.BoolSlice(key, []bool{true, false}), + }, + { + limit: 0, + attr: attribute.Int(key, 42), + want: attribute.Int(key, 42), + }, + { + limit: 0, + attr: attribute.IntSlice(key, []int{42, -1}), + want: attribute.IntSlice(key, []int{42, -1}), + }, + { + limit: 0, + attr: attribute.Int64(key, 42), + want: attribute.Int64(key, 42), + }, + { + limit: 0, + attr: attribute.Int64Slice(key, []int64{42, -1}), + want: attribute.Int64Slice(key, []int64{42, -1}), + }, + { + limit: 0, + attr: attribute.Float64(key, 42), + want: attribute.Float64(key, 42), + }, + { + limit: 0, + attr: attribute.Float64Slice(key, []float64{42, -1}), + want: attribute.Float64Slice(key, []float64{42, -1}), + }, + { + limit: 0, + attr: strAttr, + want: attribute.String(key, ""), + }, + { + limit: 0, + attr: strSliceAttr, + want: attribute.StringSlice(key, []string{"", ""}), + }, + { + limit: 0, + attr: attribute.Stringer(key, bytes.NewBufferString("value")), + want: attribute.String(key, ""), + }, + { + limit: 1, + attr: strAttr, + want: attribute.String(key, "v"), + }, + { + limit: 1, + attr: strSliceAttr, + want: attribute.StringSlice(key, []string{"v", "v"}), + }, + { + limit: 5, + attr: strAttr, + want: strAttr, + }, + { + limit: 7, + attr: strSliceAttr, + want: strSliceAttr, + }, + { + limit: 6, + attr: attribute.StringSlice(key, []string{"value", "value-1"}), + want: attribute.StringSlice(key, []string{"value", "value-"}), + }, + { + limit: 128, + attr: strAttr, + want: strAttr, + }, + { + limit: 128, + attr: strSliceAttr, + want: strSliceAttr, + }, + } + + for _, test := range tests { + name := fmt.Sprintf("%s->%s(limit:%d)", test.attr.Key, test.attr.Value.Emit(), test.limit) + t.Run(name, func(t *testing.T) { + assert.Equal(t, test.want, truncateAttr(test.limit, test.attr)) + }) + } +} diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 5ba0015584a..fe401d06535 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -604,10 +604,9 @@ func TestSpanSetAttributes(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { te := NewTestExporter() - tp := NewTracerProvider( - WithSyncer(te), - WithSpanLimits(SpanLimits{AttributeCountLimit: capacity}), - ) + sl := NewSpanLimits() + sl.AttributeCountLimit = capacity + tp := NewTracerProvider(WithSyncer(te), WithSpanLimits(sl)) _, span := tp.Tracer(instName).Start(context.Background(), spanName) for _, a := range test.input { span.SetAttributes(a...) @@ -677,7 +676,9 @@ func TestEvents(t *testing.T) { func TestEventsOverLimit(t *testing.T) { te := NewTestExporter() - tp := NewTracerProvider(WithSpanLimits(SpanLimits{EventCountLimit: 2}), WithSyncer(te), WithResource(resource.Empty())) + sl := NewSpanLimits() + sl.EventCountLimit = 2 + tp := NewTracerProvider(WithSpanLimits(sl), WithSyncer(te), WithResource(resource.Empty())) span := startSpan(tp, "EventsOverLimit") k1v1 := attribute.String("key1", "value1") @@ -779,7 +780,9 @@ func TestLinksOverLimit(t *testing.T) { sc2 := trace.NewSpanContext(trace.SpanContextConfig{TraceID: trace.TraceID([16]byte{1, 1}), SpanID: trace.SpanID{3}}) sc3 := trace.NewSpanContext(trace.SpanContextConfig{TraceID: trace.TraceID([16]byte{1, 1}), SpanID: trace.SpanID{3}}) - tp := NewTracerProvider(WithSpanLimits(SpanLimits{LinkCountLimit: 2}), WithSyncer(te), WithResource(resource.Empty())) + sl := NewSpanLimits() + sl.LinkCountLimit = 2 + tp := NewTracerProvider(WithSpanLimits(sl), WithSyncer(te), WithResource(resource.Empty())) span := startSpan(tp, "LinksOverLimit", trace.WithLinks( @@ -1637,8 +1640,10 @@ func TestReadWriteSpan(t *testing.T) { func TestAddEventsWithMoreAttributesThanLimit(t *testing.T) { te := NewTestExporter() + sl := NewSpanLimits() + sl.AttributePerEventCountLimit = 2 tp := NewTracerProvider( - WithSpanLimits(SpanLimits{AttributePerEventCountLimit: 2}), + WithSpanLimits(sl), WithSyncer(te), WithResource(resource.Empty()), ) @@ -1701,8 +1706,10 @@ func TestAddEventsWithMoreAttributesThanLimit(t *testing.T) { func TestAddLinksWithMoreAttributesThanLimit(t *testing.T) { te := NewTestExporter() + sl := NewSpanLimits() + sl.AttributePerLinkCountLimit = 1 tp := NewTracerProvider( - WithSpanLimits(SpanLimits{AttributePerLinkCountLimit: 1}), + WithSpanLimits(sl), WithSyncer(te), WithResource(resource.Empty()), ) From f4ec95d027ddc97d4808b7e808c4720aec1fb858 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Fri, 4 Mar 2022 01:13:31 +0800 Subject: [PATCH 089/886] Add container id support to Resource (#2418) * Add container id support to Resource * Fix wrong test case name * Add WithContainer option * Update CHANGELOG * Fix comments * Update CHANGELOG * Use regex to find container id * Add tests for reading cgroup file * Update sdk/resource/container.go Co-authored-by: Chester Cheung * Update format Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 1 + sdk/resource/config.go | 13 +++ sdk/resource/container.go | 100 +++++++++++++++++++ sdk/resource/container_test.go | 169 +++++++++++++++++++++++++++++++++ sdk/resource/export_test.go | 2 + sdk/resource/process_test.go | 5 +- sdk/resource/resource_test.go | 71 ++++++++++++++ 7 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 sdk/resource/container.go create mode 100644 sdk/resource/container_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d7d51e21893..52cc0c413e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This update is a breaking change of the unstable Metrics API. Code instrumented If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) +- Add container id support to Resource. (#2418) - Add span attribute value length limit. The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. The default limit for this resource is "unlimited". (#2637) diff --git a/sdk/resource/config.go b/sdk/resource/config.go index d80b5ae6214..09f30d57127 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -171,3 +171,16 @@ func WithProcessRuntimeVersion() Option { func WithProcessRuntimeDescription() Option { return WithDetectors(processRuntimeDescriptionDetector{}) } + +// WithContainer adds all the Container attributes to the configured Resource. +// See individual WithContainer* functions to configure specific attributes. +func WithContainer() Option { + return WithDetectors( + cgroupContainerIDDetector{}, + ) +} + +// WithContainerID adds an attribute with the id of the container to the configured Resource. +func WithContainerID() Option { + return WithDetectors(cgroupContainerIDDetector{}) +} diff --git a/sdk/resource/container.go b/sdk/resource/container.go new file mode 100644 index 00000000000..e56978adad5 --- /dev/null +++ b/sdk/resource/container.go @@ -0,0 +1,100 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "bufio" + "context" + "errors" + "io" + "os" + "regexp" + + semconv "go.opentelemetry.io/otel/semconv/v1.7.0" +) + +type containerIDProvider func() (string, error) + +var ( + containerID containerIDProvider = getContainerIDFromCGroup + cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`) +) + +type cgroupContainerIDDetector struct{} + +const cgroupPath = "/proc/self/cgroup" + +// Detect returns a *Resource that describes the id of the container. +// If no container id found, an empty resource will be returned. +func (cgroupContainerIDDetector) Detect(ctx context.Context) (*Resource, error) { + containerID, err := containerID() + if err != nil { + return nil, err + } + + if containerID == "" { + return Empty(), nil + } + return NewWithAttributes(semconv.SchemaURL, semconv.ContainerIDKey.String(containerID)), nil +} + +var ( + defaultOSStat = os.Stat + osStat = defaultOSStat + + defaultOSOpen = func(name string) (io.ReadCloser, error) { + return os.Open(name) + } + osOpen = defaultOSOpen +) + +// getContainerIDFromCGroup returns the id of the container from the cgroup file. +// If no container id found, an empty string will be returned. +func getContainerIDFromCGroup() (string, error) { + if _, err := osStat(cgroupPath); errors.Is(err, os.ErrNotExist) { + // File does not exist, skip + return "", nil + } + + file, err := osOpen(cgroupPath) + if err != nil { + return "", err + } + defer file.Close() + + return getContainerIDFromReader(file), nil +} + +// getContainerIDFromReader returns the id of the container from reader. +func getContainerIDFromReader(reader io.Reader) string { + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + line := scanner.Text() + + if id := getContainerIDFromLine(line); id != "" { + return id + } + } + return "" +} + +// getContainerIDFromLine returns the id of the container from one string line. +func getContainerIDFromLine(line string) string { + matches := cgroupContainerIDRe.FindStringSubmatch(line) + if len(matches) <= 1 { + return "" + } + return matches[1] +} diff --git a/sdk/resource/container_test.go b/sdk/resource/container_test.go new file mode 100644 index 00000000000..b09160da872 --- /dev/null +++ b/sdk/resource/container_test.go @@ -0,0 +1,169 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource + +import ( + "errors" + "io" + "os" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func setDefaultContainerProviders() { + setContainerProviders( + getContainerIDFromCGroup, + ) +} + +func setContainerProviders( + idProvider containerIDProvider, +) { + containerID = idProvider +} + +func TestGetContainerIDFromLine(t *testing.T) { + testCases := []struct { + name string + line string + expectedContainerID string + }{ + { + name: "with suffix", + line: "13:name=systemd:/podruntime/docker/kubepods/ac679f8a8319c8cf7d38e1adf263bc08d23.aaaa", + expectedContainerID: "ac679f8a8319c8cf7d38e1adf263bc08d23", + }, + { + name: "with prefix and suffix", + line: "13:name=systemd:/podruntime/docker/kubepods/crio-dc679f8a8319c8cf7d38e1adf263bc08d23.stuff", + expectedContainerID: "dc679f8a8319c8cf7d38e1adf263bc08d23", + }, + { + name: "no prefix and suffix", + line: "13:name=systemd:/pod/d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356", + expectedContainerID: "d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356", + }, + { + name: "with space", + line: " 13:name=systemd:/pod/d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356 ", + expectedContainerID: "d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356", + }, + { + name: "invalid hex string", + line: "13:name=systemd:/podruntime/docker/kubepods/ac679f8a8319c8cf7d38e1adf263bc08d23zzzz", + }, + { + name: "no container id - 1", + line: "pids: /", + }, + { + name: "no container id - 2", + line: "pids: ", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + containerID := getContainerIDFromLine(tc.line) + assert.Equal(t, tc.expectedContainerID, containerID) + }) + } +} + +func TestGetContainerIDFromReader(t *testing.T) { + testCases := []struct { + name string + reader io.Reader + expectedContainerID string + }{ + { + name: "multiple lines", + reader: strings.NewReader(`// +1:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d23 +1:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d24 +`), + expectedContainerID: "dc579f8a8319c8cf7d38e1adf263bc08d23", + }, + { + name: "no container id", + reader: strings.NewReader(`// +1:name=systemd:/podruntime/docker +`), + expectedContainerID: "", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + containerID := getContainerIDFromReader(tc.reader) + assert.Equal(t, tc.expectedContainerID, containerID) + }) + } +} + +func TestGetContainerIDFromCGroup(t *testing.T) { + t.Cleanup(func() { + osStat = defaultOSStat + osOpen = defaultOSOpen + }) + + testCases := []struct { + name string + cgroupFileNotExist bool + openFileError error + content string + expectedContainerID string + expectedError bool + }{ + { + name: "the cgroup file does not exist", + cgroupFileNotExist: true, + }, + { + name: "error when opening cgroup file", + openFileError: errors.New("test"), + expectedError: true, + }, + { + name: "cgroup file", + content: "1:name=systemd:/podruntime/docker/kubepods/docker-dc579f8a8319c8cf7d38e1adf263bc08d23", + expectedContainerID: "dc579f8a8319c8cf7d38e1adf263bc08d23", + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + osStat = func(name string) (os.FileInfo, error) { + if tc.cgroupFileNotExist { + return nil, os.ErrNotExist + } + return nil, nil + } + + osOpen = func(name string) (io.ReadCloser, error) { + if tc.openFileError != nil { + return nil, tc.openFileError + } + return io.NopCloser(strings.NewReader(tc.content)), nil + } + + containerID, err := getContainerIDFromCGroup() + assert.Equal(t, tc.expectedError, err != nil) + assert.Equal(t, tc.expectedContainerID, containerID) + }) + } +} diff --git a/sdk/resource/export_test.go b/sdk/resource/export_test.go index 4cad64f0b65..6c767e595c5 100644 --- a/sdk/resource/export_test.go +++ b/sdk/resource/export_test.go @@ -23,6 +23,8 @@ var ( SetUserProviders = setUserProviders SetDefaultOSDescriptionProvider = setDefaultOSDescriptionProvider SetOSDescriptionProvider = setOSDescriptionProvider + SetDefaultContainerProviders = setDefaultContainerProviders + SetContainerProviders = setContainerProviders ) var ( diff --git a/sdk/resource/process_test.go b/sdk/resource/process_test.go index 0f9c628cc8d..408d0a5a300 100644 --- a/sdk/resource/process_test.go +++ b/sdk/resource/process_test.go @@ -102,13 +102,14 @@ func restoreAttributesProviders() { resource.SetDefaultRuntimeProviders() resource.SetDefaultUserProviders() resource.SetDefaultOSDescriptionProvider() + resource.SetDefaultContainerProviders() } func TestWithProcessFuncsErrors(t *testing.T) { mockProcessAttributesProvidersWithErrors() - t.Run("WithPID", testWithProcessExecutablePathError) - t.Run("WithExecutableName", testWithProcessOwnerError) + t.Run("WithExecutablePath", testWithProcessExecutablePathError) + t.Run("WithOwner", testWithProcessOwnerError) restoreAttributesProviders() } diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 526ad13008f..fa9b9e4ea05 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -649,3 +649,74 @@ func hostname() string { } return hn } + +func TestWithContainerID(t *testing.T) { + t.Cleanup(restoreAttributesProviders) + + fakeContainerID := "fake-container-id" + + testCases := []struct { + name string + containerIDProvider func() (string, error) + expectedResource map[string]string + expectedErr bool + }{ + { + name: "get container id", + containerIDProvider: func() (string, error) { + return fakeContainerID, nil + }, + expectedResource: map[string]string{ + string(semconv.ContainerIDKey): fakeContainerID, + }, + }, + { + name: "no container id found", + containerIDProvider: func() (string, error) { + return "", nil + }, + expectedResource: map[string]string{}, + }, + { + name: "error", + containerIDProvider: func() (string, error) { + return "", fmt.Errorf("unable to get container id") + }, + expectedResource: map[string]string{}, + expectedErr: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + resource.SetContainerProviders(tc.containerIDProvider) + + res, err := resource.New(context.Background(), + resource.WithContainerID(), + ) + + if tc.expectedErr { + assert.Error(t, err) + } + assert.Equal(t, tc.expectedResource, toMap(res)) + }) + } +} + +func TestWithContainer(t *testing.T) { + t.Cleanup(restoreAttributesProviders) + + fakeContainerID := "fake-container-id" + resource.SetContainerProviders(func() (string, error) { + return fakeContainerID, nil + }) + + res, err := resource.New(context.Background(), + resource.WithContainer(), + ) + + assert.NoError(t, err) + assert.Equal(t, map[string]string{ + string(semconv.ContainerIDKey): fakeContainerID, + }, toMap(res)) +} From 4eb3cc4f1cc99ec12812e33de27d8ad6a33a5c46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 08:54:12 -0800 Subject: [PATCH 090/886] Bump github.com/itchyny/gojq from 0.12.6 to 0.12.7 in /internal/tools (#2647) * Bump github.com/itchyny/gojq from 0.12.6 to 0.12.7 in /internal/tools Bumps [github.com/itchyny/gojq](https://github.com/itchyny/gojq) from 0.12.6 to 0.12.7. - [Release notes](https://github.com/itchyny/gojq/releases) - [Changelog](https://github.com/itchyny/gojq/blob/main/CHANGELOG.md) - [Commits](https://github.com/itchyny/gojq/compare/v0.12.6...v0.12.7) --- updated-dependencies: - dependency-name: github.com/itchyny/gojq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 583d72b1a50..9aefef1006d 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.44.2 - github.com/itchyny/gojq v0.12.6 + github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 1604fe5e896..58392f05da5 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -472,8 +472,8 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/itchyny/gojq v0.12.6 h1:VjaFn59Em2wTxDNGcrRkDK9ZHMNa8IksOgL13sLL4d0= -github.com/itchyny/gojq v0.12.6/go.mod h1:ZHrkfu7A+RbZLy5J1/JKpS4poEqrzItSTGDItqsfP0A= +github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ= +github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw= github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -1146,8 +1146,9 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220111092808-5a964db01320 h1:0jf+tOCoZ3LyutmCOWpVni1chK4VfFLhRsDK7MhqGRY= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From a27afaae364c65306730cb289f4c7acad13acbca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 09:30:19 -0800 Subject: [PATCH 091/886] Bump actions/setup-go from 2.2.0 to 3 (#2646) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2.2.0 to 3. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v2.2.0...v3) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/dependabot.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c14b91aa4f1..d523602e125 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.4.0 - - uses: actions/setup-go@v2.2.0 + - uses: actions/setup-go@v3 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Run benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cb2893edcf..247a64dedf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.2.0 + uses: actions/setup-go@v3 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.2.0 + uses: actions/setup-go@v3 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v2.2.0 + uses: actions/setup-go@v3 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -123,7 +123,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v2.2.0 + uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - name: Checkout code diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index b679cbaf7f9..067b033ff3c 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v2.2.0 + - uses: actions/setup-go@v3 with: go-version: '^1.16.0' - uses: evantorrie/mott-the-tidier@v1-beta From d6f9d0d38723e540ba8b66215d405dec90ab6b0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 10:15:56 -0800 Subject: [PATCH 092/886] Bump actions/checkout from 2.4.0 to 3 (#2645) Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/changelog.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependabot.yml | 2 +- .github/workflows/gosec.yml | 2 +- .github/workflows/markdown.yml | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d523602e125..c08b4f69b90 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -10,7 +10,7 @@ jobs: name: Benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: go-version: ${{ env.DEFAULT_GO_VERSION }} diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index f11751142b4..10ea8d4bbeb 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -15,7 +15,7 @@ jobs: if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Check for CHANGELOG changes run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 247a64dedf5..353df7ce38d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -52,7 +52,7 @@ jobs: with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -75,7 +75,7 @@ jobs: with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -127,7 +127,7 @@ jobs: with: go-version: ${{ matrix.go-version }} - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 780ad807831..521063ac4b5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 067b033ff3c..c101ef4bb32 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -8,7 +8,7 @@ jobs: if: ${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} - uses: actions/setup-go@v3 diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index 7050dbe2d53..c0c1c621b16 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -19,7 +19,7 @@ jobs: GO111MODULE: on steps: - name: Checkout Source - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run Gosec Security Scanner uses: securego/gosec@master with: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 31271c2e968..ff8ddc1d9e0 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -12,7 +12,7 @@ jobs: md: ${{ steps.changes.outputs.md }} steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Get changed files @@ -27,7 +27,7 @@ jobs: if: ${{needs.changedfiles.outputs.md}} steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run linter uses: docker://avtodev/markdown-lint:v1 with: @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - uses: gaurav-nelson/github-action-markdown-link-check@v1 From 16e52ed9cc8e80a4adcc531246b3384fd1b37da5 Mon Sep 17 00:00:00 2001 From: Nathan Landis Date: Fri, 4 Mar 2022 12:49:36 -0600 Subject: [PATCH 093/886] Fix typo in go libraries (#2652) --- website_docs/libraries.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 8cd772da06d..c4bdc16c356 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -60,7 +60,7 @@ func sleepy(ctx context.Context) { // httpHandler is an HTTP handler function that is going to be instrumented. func httpHandler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello, World! I am instrumented autoamtically!") + fmt.Fprintf(w, "Hello, World! I am instrumented automatically!") ctx := r.Context() sleepy(ctx) } From 0e4c1563e9931ebb178576bb28360293d90b443c Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 4 Mar 2022 20:32:49 +0100 Subject: [PATCH 094/886] double benchmark alert threshold (#2649) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/benchmark.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index c08b4f69b90..8366db387dd 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -30,3 +30,4 @@ jobs: external-data-json-path: ./benchmarks/data.json auto-push: false fail-on-alert: true + alert-threshold: "400%" From 68e24958ff7a8885b9f8b3ea269190ac3b5629a7 Mon Sep 17 00:00:00 2001 From: Nelz <88060063+nelzkiddom@users.noreply.github.com> Date: Wed, 9 Mar 2022 08:00:10 -0800 Subject: [PATCH 095/886] fallback to URL.Host if Request.Host is empty (#2661) * fallback to URL.Host if Request.Host is empty * changelog * previous versions --- CHANGELOG.md | 1 + semconv/v1.4.0/http.go | 2 ++ semconv/v1.4.0/http_test.go | 47 +++++++++++++++++++++++++++++++++++++ semconv/v1.5.0/http.go | 2 ++ semconv/v1.5.0/http_test.go | 47 +++++++++++++++++++++++++++++++++++++ semconv/v1.6.1/http.go | 2 ++ semconv/v1.6.1/http_test.go | 47 +++++++++++++++++++++++++++++++++++++ semconv/v1.7.0/http.go | 2 ++ semconv/v1.7.0/http_test.go | 47 +++++++++++++++++++++++++++++++++++++ 9 files changed, 197 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52cc0c413e7..b83debc78bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This update is a breaking change of the unstable Metrics API. Code instrumented - Unify path cleaning functionally in the `otlpmetric` and `otlptrace` config. (#2639) - Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) - Introduce new internal envconfig package for OTLP exporters (#2608) +- If `http.Request.Host` is empty, fall back to use `URL.Host` when populating `http.host` in the `semconv` packages. (#2661) ### Fixed diff --git a/semconv/v1.4.0/http.go b/semconv/v1.4.0/http.go index d9537ff3903..a9032ccc3c2 100644 --- a/semconv/v1.4.0/http.go +++ b/semconv/v1.4.0/http.go @@ -166,6 +166,8 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa if request.Host != "" { attrs = append(attrs, HTTPHostKey.String(request.Host)) + } else if request.URL != nil && request.URL.Host != "" { + attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) } flavor := "" diff --git a/semconv/v1.4.0/http_test.go b/semconv/v1.4.0/http_test.go index 5d707be5d61..2a76bd68714 100644 --- a/semconv/v1.4.0/http_test.go +++ b/semconv/v1.4.0/http_test.go @@ -705,6 +705,31 @@ func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + serverName: "my-server-name", + route: "/user/:id", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", "/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.route", "/user/:id"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", serverName: "my-server-name", @@ -1042,6 +1067,28 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Scheme: "https", + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.url", "https://example.com/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", method: "GET", diff --git a/semconv/v1.5.0/http.go b/semconv/v1.5.0/http.go index 1ab89a93aa8..114e24b0512 100644 --- a/semconv/v1.5.0/http.go +++ b/semconv/v1.5.0/http.go @@ -166,6 +166,8 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa if request.Host != "" { attrs = append(attrs, HTTPHostKey.String(request.Host)) + } else if request.URL != nil && request.URL.Host != "" { + attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) } flavor := "" diff --git a/semconv/v1.5.0/http_test.go b/semconv/v1.5.0/http_test.go index af8567e1d18..c2043860bf7 100644 --- a/semconv/v1.5.0/http_test.go +++ b/semconv/v1.5.0/http_test.go @@ -705,6 +705,31 @@ func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + serverName: "my-server-name", + route: "/user/:id", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", "/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.route", "/user/:id"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", serverName: "my-server-name", @@ -1042,6 +1067,28 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Scheme: "https", + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.url", "https://example.com/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", method: "GET", diff --git a/semconv/v1.6.1/http.go b/semconv/v1.6.1/http.go index 838e5135b00..d2194b3e47b 100644 --- a/semconv/v1.6.1/http.go +++ b/semconv/v1.6.1/http.go @@ -166,6 +166,8 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa if request.Host != "" { attrs = append(attrs, HTTPHostKey.String(request.Host)) + } else if request.URL != nil && request.URL.Host != "" { + attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) } flavor := "" diff --git a/semconv/v1.6.1/http_test.go b/semconv/v1.6.1/http_test.go index 017bd13502d..4b4a652c74d 100644 --- a/semconv/v1.6.1/http_test.go +++ b/semconv/v1.6.1/http_test.go @@ -704,6 +704,31 @@ func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + serverName: "my-server-name", + route: "/user/:id", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", "/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.route", "/user/:id"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", serverName: "my-server-name", @@ -1041,6 +1066,28 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Scheme: "https", + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.url", "https://example.com/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", method: "GET", diff --git a/semconv/v1.7.0/http.go b/semconv/v1.7.0/http.go index 9b430fac0c6..fafee88a953 100644 --- a/semconv/v1.7.0/http.go +++ b/semconv/v1.7.0/http.go @@ -167,6 +167,8 @@ func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyVa if request.Host != "" { attrs = append(attrs, HTTPHostKey.String(request.Host)) + } else if request.URL != nil && request.URL.Host != "" { + attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) } flavor := "" diff --git a/semconv/v1.7.0/http_test.go b/semconv/v1.7.0/http_test.go index 5d707be5d61..2a76bd68714 100644 --- a/semconv/v1.7.0/http_test.go +++ b/semconv/v1.7.0/http_test.go @@ -705,6 +705,31 @@ func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + serverName: "my-server-name", + route: "/user/:id", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", "/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.route", "/user/:id"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", serverName: "my-server-name", @@ -1042,6 +1067,28 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { attribute.String("http.host", "example.com"), }, }, + { + name: "with host fallback", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Scheme: "https", + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.url", "https://example.com/user/123"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.host", "example.com"), + }, + }, { name: "with user agent", method: "GET", From d3ab885e2993f0e343d03989b7f177e668777ebd Mon Sep 17 00:00:00 2001 From: Mike Dame Date: Thu, 10 Mar 2022 13:54:24 -0500 Subject: [PATCH 096/886] Update otel-collector example readme (#2662) Co-authored-by: Tyler Yahn --- example/otel-collector/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/example/otel-collector/README.md b/example/otel-collector/README.md index 5a1e937dd5b..6e13a59144a 100644 --- a/example/otel-collector/README.md +++ b/example/otel-collector/README.md @@ -30,6 +30,9 @@ Ideally you'd want to either have your application running as part of the kubernetes cluster, or use a secured connection (NodePort/LoadBalancer with TLS or an ingress extension). +If not using microk8s, ensure that cert-manager is installed by following [the +instructions here](https://cert-manager.io/docs/installation/). + # Deploying to Kubernetes All the necessary Kubernetes deployment files are available in this demo, in the @@ -51,10 +54,10 @@ microk8s enable prometheus and you're good to go. Move on to [Using the makefile](#using-the-makefile). Otherwise, obtain a copy of the Prometheus Operator stack from -[coreos](https://github.com/coreos/kube-prometheus): +[prometheus-operator](https://github.com/prometheus-operator/kube-prometheus): ```bash -git clone https://github.com/coreos/kube-prometheus.git +git clone https://github.com/prometheus-operator/kube-prometheus.git cd kube-prometheus kubectl create -f manifests/setup From 005eefef95fbd7dc111e7ba5bde9aa97bcb6acc9 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Thu, 10 Mar 2022 16:01:29 -0500 Subject: [PATCH 097/886] [website_docs] Fix link intra-site link refs (#2666) * [website_docs] Fix link intra-site link refs * Markdown-link config: add replace pattern for /docs/ Co-authored-by: Tyler Yahn --- .markdown-link.json | 4 ++++ website_docs/libraries.md | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.markdown-link.json b/.markdown-link.json index f222ad89c31..bd786f03c15 100644 --- a/.markdown-link.json +++ b/.markdown-link.json @@ -8,6 +8,10 @@ { "pattern": "^/registry", "replacement": "https://opentelemetry.io/registry" + }, + { + "pattern": "^/docs/", + "replacement": "https://opentelemetry.io/docs/" } ], "retryOn429": true, diff --git a/website_docs/libraries.md b/website_docs/libraries.md index c4bdc16c356..5e069a26de3 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -5,7 +5,7 @@ linkTitle: Libraries aliases: [/docs/instrumentation/go/using_instrumentation_libraries, /docs/instrumentation/go/automatic_instrumentation] --- -Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](https://opentelemetry.io/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code. +Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code. ## Setup @@ -86,7 +86,7 @@ Connecting manual instrumentation you write in your app with instrumentation gen ## Available packages -A full list of instrumentation libraries available can be found in the [OpenTelemetry registry](https://opentelemetry.io/registry/?language=go&component=instrumentation). +A full list of instrumentation libraries available can be found in the [OpenTelemetry registry](/registry/?language=go&component=instrumentation). ## Next steps From 27633f0a3265abc8353b4c5cad48622f7d4a951d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 09:09:46 -0700 Subject: [PATCH 098/886] Bump google.golang.org/grpc from 1.44.0 to 1.45.0 in /example/otel-collector (#2669) * Bump google.golang.org/grpc in /example/otel-collector Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.44.0 to 1.45.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.44.0...v1.45.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index bc705fd9bac..080fa32ce79 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1 go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/trace v1.4.1 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index ca5dbebdb8b..8612268ef70 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -135,8 +135,9 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From b1d29783a7a793ef711b3628f8b4f7009ff23cc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 09:27:38 -0700 Subject: [PATCH 099/886] Bump google.golang.org/grpc from 1.44.0 to 1.45.0 in /exporters/otlp/otlpmetric (#2672) * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.44.0 to 1.45.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.44.0...v1.45.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 3a1567c0ec2..9676fc3b2d2 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index c965d892816..fa7935b2ab3 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -115,8 +115,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index cba505c7944..b8c7ce3d048 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index c965d892816..fa7935b2ab3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -115,8 +115,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index c965d892816..fa7935b2ab3 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -115,8 +115,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From b22999748b5997c19b25556f3e98c3273cd49e9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Mar 2022 09:47:52 -0700 Subject: [PATCH 100/886] Bump google.golang.org/grpc from 1.44.0 to 1.45.0 in /exporters/otlp/otlptrace (#2671) * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.44.0 to 1.45.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.44.0...v1.45.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/otel-collector/go.sum | 1 - exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 8612268ef70..f0cc9cfefcb 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -135,7 +135,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index dd9eb1815aa..8ccda24f2bd 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.4.1 go.opentelemetry.io/otel/trace v1.4.1 go.opentelemetry.io/proto/otlp v0.12.0 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index b41a0280fd8..090d0fa09c9 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -113,8 +113,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 024bd30407c..17bfa61093f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 - google.golang.org/grpc v1.44.0 + google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index d2dc43a4872..6b09989fa98 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -139,8 +139,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index b41a0280fd8..090d0fa09c9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -113,8 +113,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 2cfc5210f254e9fa3537582830446a64ab3016ab Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 16 Mar 2022 09:13:17 -0700 Subject: [PATCH 101/886] Release v1.5.0 (#2676) * Bump stable-v1 from v1.4.1 to v1.5.0 * Remove internal/metric module from versions file This module was removed from the project. * Prepare stable-v1 for version v1.5.0 * Update changelog * Update CHANGELOG.md --- CHANGELOG.md | 25 ++++++++++++------- bridge/opencensus/go.mod | 6 ++--- bridge/opencensus/test/go.mod | 6 ++--- bridge/opentracing/go.mod | 4 +-- example/fib/go.mod | 8 +++--- example/jaeger/go.mod | 6 ++--- example/namedtracer/go.mod | 8 +++--- example/opencensus/go.mod | 6 ++--- example/otel-collector/go.mod | 8 +++--- example/passthrough/go.mod | 8 +++--- example/prometheus/go.mod | 2 +- example/zipkin/go.mod | 8 +++--- exporters/jaeger/go.mod | 6 ++--- exporters/otlp/otlpmetric/go.mod | 6 ++--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 ++--- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 4 +-- exporters/otlp/otlptrace/go.mod | 8 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 +++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++++---- exporters/prometheus/go.mod | 4 +-- exporters/stdout/stdoutmetric/go.mod | 4 +-- exporters/stdout/stdouttrace/go.mod | 6 ++--- exporters/zipkin/go.mod | 6 ++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/export/metric/go.mod | 2 +- sdk/go.mod | 4 +-- sdk/metric/go.mod | 4 +-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 3 +-- 31 files changed, 95 insertions(+), 89 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b83debc78bc..da2760a0e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### ⚠️ Notice ⚠️ -This update is a breaking change of the unstable Metrics API. Code instrumented with the `go.opentelemetry.io/otel/metric` <= v0.27.0 will need to be modified. +This update is a breaking change of the unstable Metrics API. +Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be modified. + +### Changed + +- The metrics API has been significantly changed. (#2587) + +## [1.5.0] - 2022-03-16 ### Added - Log the Exporters configuration in the TracerProviders message. (#2578) - Added support to configure the span limits with environment variables. - The following environment variables are used. (#2606, #2637) + The following environment variables are supported. (#2606, #2637) - `OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT` - `OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT` - `OTEL_SPAN_EVENT_COUNT_LIMIT` @@ -26,7 +33,7 @@ This update is a breaking change of the unstable Metrics API. Code instrumented If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) -- Add container id support to Resource. (#2418) +- Add resource container ID detection. (#2418) - Add span attribute value length limit. The new `AttributeValueLengthLimit` field is added to the `"go.opentelemetry.io/otel/sdk/trace".SpanLimits` type to configure this limit for a `TracerProvider`. The default limit for this resource is "unlimited". (#2637) @@ -38,18 +45,17 @@ This update is a breaking change of the unstable Metrics API. Code instrumented ### Changed -- For tracestate's members, prepend the new element and remove the oldest one, which is over capacity (#2592) +- Drop oldest tracestate `Member` when capacity is reached. (#2592) - Add event and link drop counts to the exported data from the `oltptrace` exporter. (#2601) -- The metrics API has been significantly changed. (#2587) -- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` config. (#2639) +- Unify path cleaning functionally in the `otlpmetric` and `otlptrace` configuration. (#2639) - Change the debug message from the `sdk/trace.BatchSpanProcessor` to reflect the count is cumulative. (#2640) -- Introduce new internal envconfig package for OTLP exporters (#2608) +- Introduce new internal `envconfig` package for OTLP exporters. (#2608) - If `http.Request.Host` is empty, fall back to use `URL.Host` when populating `http.host` in the `semconv` packages. (#2661) ### Fixed - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) -- Use port `4318` instead of `4317` for default for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) +- Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) - Unlimited span limits are now supported (negative values). (#2636, #2637) ### Deprecated @@ -1740,7 +1746,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.4.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.5.0...HEAD +[1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 [1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 [1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 [1.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.3.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index db2733fc484..dce769c4a7c 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index b262f82d5e8..bbd8c7df52c 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/bridge/opencensus v0.27.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 6a36fde8822..446fd94bbd1 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index f32a17d8ed9..a76f072c296 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index c67a139299d..06e6cdef268 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/jaeger v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/jaeger v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 3873edf2951..0efbd773dbc 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index ba0fa9db3de..d4073d2aabe 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/bridge/opencensus v0.27.1 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 080fa32ce79..ca6a4b4aefe 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 google.golang.org/grpc v1.45.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index b738a24061b..50b16bda87f 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b30c60e547f..21d620dbce1 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/prometheus v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index c47de71dfda..fc2a8a0bdf9 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/zipkin v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/zipkin v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 265bbc92eb3..9254779fa2c 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9676fc3b2d2..6dc1807cddb 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index b8c7ce3d048..c4d6a575adc 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index a91939eff01..b70ba6e66e5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 8ccda24f2bd..48d7c36ee82 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 17bfa61093f..58acd836e9e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index fb3ca1c3429..774b04e51ae 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.4.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3d02af45d5f..a9c686515ae 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 07989e72e67..d44e40119db 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 88d59d2d605..81ffc9ad995 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index c9d56ed8d03..ea061de6174 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/sdk v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index f37c9bf371a..90517f78fb0 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel/trace v1.5.0 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index 7d510be1f32..188c44326eb 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -2,7 +2,7 @@ module go.opentelemetry.io/otel/metric go 1.16 -require go.opentelemetry.io/otel v1.4.1 +require go.opentelemetry.io/otel v1.5.0 replace go.opentelemetry.io/otel => ../ diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 415e71a87f9..9752e1e771a 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -40,7 +40,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/sdk/metric v0.27.0 ) diff --git a/sdk/go.mod b/sdk/go.mod index bad9bd0c41c..37b14cf6120 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 - go.opentelemetry.io/otel/trace v1.4.1 + go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel/trace v1.5.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 33fda254764..5f4c7f54118 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.4.1 + go.opentelemetry.io/otel/sdk v1.5.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index e7a32932464..112d54673bb 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.0 - go.opentelemetry.io/otel v1.4.1 + go.opentelemetry.io/otel v1.5.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index a09bcbb5e8f..92d9fda8ff4 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.4.1" + return "1.5.0" } diff --git a/versions.yaml b/versions.yaml index 3f06f299346..15b35e14fe1 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.4.1 + version: v1.5.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -42,7 +42,6 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/internal/metric - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/export/metric - go.opentelemetry.io/otel/sdk/metric From 0fe5eee21f6bc40ab7eb9dfaef36f2b451d511e7 Mon Sep 17 00:00:00 2001 From: Sourik Ghosh <61813998+sourikghosh@users.noreply.github.com> Date: Wed, 16 Mar 2022 22:33:35 +0530 Subject: [PATCH 102/886] silence tlsCert.RootCAs.Subjects is deprecated lint err (#2674) * silence tlsCert.RootCAs.Subjects is deprecated lint err Signed-off-by: Sourik Ghosh * silence rest of the occurrence Signed-off-by: Sourik Ghosh Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn --- exporters/otlp/internal/envconfig/envconfig_test.go | 2 ++ exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go | 3 +++ exporters/otlp/otlptrace/internal/otlpconfig/options_test.go | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/exporters/otlp/internal/envconfig/envconfig_test.go b/exporters/otlp/internal/envconfig/envconfig_test.go index b141cd42b93..eaf85b1ec7a 100644 --- a/exporters/otlp/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/internal/envconfig/envconfig_test.go @@ -288,6 +288,8 @@ func TestWithTLSConfig(t *testing.T) { WithTLSConfig("CERTIFICATE", func(v *tls.Config) { option = testOption{TestTLS: v} })) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), option.TestTLS.RootCAs.Subjects()) } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index fad37d60be5..3496b17cccd 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -202,6 +202,7 @@ func TestConfigs(t *testing.T) { //TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Metrics.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) } }, @@ -218,6 +219,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) } }, @@ -236,6 +238,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) } }, diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index 30dc5ea8015..3d50e057bef 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -202,6 +202,7 @@ func TestConfigs(t *testing.T) { //TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Traces.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) } }, @@ -218,6 +219,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) } }, @@ -236,6 +238,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) } }, @@ -253,6 +256,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) } }, From b1c1e781e6df6ac8a280da21766a00d16a45a9ed Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 16 Mar 2022 14:33:59 -0700 Subject: [PATCH 103/886] Support general attribute limits for spans (#2677) * Support general attribute limits for spans When model specific limits are not set fallback to the general ones defined by environment variables before defaults for attribute length and count limits. This is in compliance with the specification. * Update env pkg unit tests Test all environment variable helper functions. * Add changes to changelog * Update firstInt doc --- CHANGELOG.md | 1 + sdk/internal/env/env.go | 54 ++++++++++++++---- sdk/internal/env/env_test.go | 103 ++++++++++++++++++++++++++++------- 3 files changed, 126 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da2760a0e2f..53543ace68a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) - Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) - Unlimited span limits are now supported (negative values). (#2636, #2637) +- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) ### Deprecated diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index dbc8f512492..1a03bf7af49 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -41,16 +41,24 @@ const ( // i.e. 512 BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" - // SpanAttributeValueLengthKey + // AttributeValueLengthKey // Maximum allowed attribute value size. + AttributeValueLengthKey = "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT" + + // AttributeCountKey + // Maximum allowed span attribute count + AttributeCountKey = "OTEL_ATTRIBUTE_COUNT_LIMIT" + + // SpanAttributeValueLengthKey + // Maximum allowed attribute value size for a span. SpanAttributeValueLengthKey = "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT" // SpanAttributeCountKey - // Maximum allowed span attribute count + // Maximum allowed span attribute count for a span. SpanAttributeCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" // SpanEventCountKey - // Maximum allowed span event count + // Maximum allowed span event count. SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT" // SpanEventAttributeCountKey @@ -58,14 +66,36 @@ const ( SpanEventAttributeCountKey = "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT" // SpanLinkCountKey - // Maximum allowed span link count + // Maximum allowed span link count. SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT" // SpanLinkAttributeCountKey - // Maximum allowed attribute per span link count + // Maximum allowed attribute per span link count. SpanLinkAttributeCountKey = "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT" ) +// firstInt returns the value of the first matching environment variable from +// keys. If the value is not an integer or no match is found, defaultValue is +// returned. +func firstInt(defaultValue int, keys ...string) int { + for _, key := range keys { + value, ok := os.LookupEnv(key) + if !ok { + continue + } + + intValue, err := strconv.Atoi(value) + if err != nil { + global.Info("Got invalid value, number value expected.", key, value) + return defaultValue + } + + return intValue + } + + return defaultValue +} + // IntEnvOr returns the int value of the environment variable with name key if // it exists and the value is an int. Otherwise, defaultValue is returned. func IntEnvOr(key string, defaultValue int) int { @@ -112,17 +142,19 @@ func BatchSpanProcessorMaxExportBatchSize(defaultValue int) int { } // SpanAttributeValueLength returns the environment variable value for the -// OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists, otherwise -// defaultValue is returned. +// OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT key if it exists. Otherwise, the +// environment variable value for OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT is +// returned or defaultValue if that is not set. func SpanAttributeValueLength(defaultValue int) int { - return IntEnvOr(SpanAttributeValueLengthKey, defaultValue) + return firstInt(defaultValue, SpanAttributeValueLengthKey, AttributeValueLengthKey) } // SpanAttributeCount returns the environment variable value for the -// OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists, otherwise defaultValue is -// returned. +// OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT key if it exists. Otherwise, the +// environment variable value for OTEL_ATTRIBUTE_COUNT_LIMIT is returned or +// defaultValue if that is not set. func SpanAttributeCount(defaultValue int) int { - return IntEnvOr(SpanAttributeCountKey, defaultValue) + return firstInt(defaultValue, SpanAttributeCountKey, AttributeCountKey) } // SpanEventCount returns the environment variable value for the diff --git a/sdk/internal/env/env_test.go b/sdk/internal/env/env_test.go index 8c293f65453..e150f108c5d 100644 --- a/sdk/internal/env/env_test.go +++ b/sdk/internal/env/env_test.go @@ -24,37 +24,98 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" ) -func TestIntEnvOr(t *testing.T) { +func TestEnvParse(t *testing.T) { testCases := []struct { - name string - envValue string - defaultValue int - expectedValue int + name string + keys []string + f func(int) int }{ { - name: "IntEnvOrTest - Basic", - envValue: "2500", - defaultValue: 500, - expectedValue: 2500, + name: "BatchSpanProcessorScheduleDelay", + keys: []string{BatchSpanProcessorScheduleDelayKey}, + f: BatchSpanProcessorScheduleDelay, }, + + { + name: "BatchSpanProcessorExportTimeout", + keys: []string{BatchSpanProcessorExportTimeoutKey}, + f: BatchSpanProcessorExportTimeout, + }, + + { + name: "BatchSpanProcessorMaxQueueSize", + keys: []string{BatchSpanProcessorMaxQueueSizeKey}, + f: BatchSpanProcessorMaxQueueSize, + }, + + { + name: "BatchSpanProcessorMaxExportBatchSize", + keys: []string{BatchSpanProcessorMaxExportBatchSizeKey}, + f: BatchSpanProcessorMaxExportBatchSize, + }, + + { + name: "SpanAttributeValueLength", + keys: []string{SpanAttributeValueLengthKey, AttributeValueLengthKey}, + f: SpanAttributeValueLength, + }, + + { + name: "SpanAttributeCount", + keys: []string{SpanAttributeCountKey, AttributeCountKey}, + f: SpanAttributeCount, + }, + + { + name: "SpanEventCount", + keys: []string{SpanEventCountKey}, + f: SpanEventCount, + }, + { - name: "IntEnvOrTest - Invalid Number", - envValue: "localhost", - defaultValue: 500, - expectedValue: 500, + name: "SpanEventAttributeCount", + keys: []string{SpanEventAttributeCountKey}, + f: SpanEventAttributeCount, + }, + + { + name: "SpanLinkCount", + keys: []string{SpanLinkCountKey}, + f: SpanLinkCount, + }, + + { + name: "SpanLinkAttributeCount", + keys: []string{SpanLinkAttributeCountKey}, + f: SpanLinkAttributeCount, }, } - envStore := ottest.NewEnvStore() - envStore.Record(BatchSpanProcessorMaxQueueSizeKey) - defer func() { - require.NoError(t, envStore.Restore()) - }() + const ( + defVal = 500 + envVal = 2500 + envValStr = "2500" + invalid = "localhost" + ) + for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - require.NoError(t, os.Setenv(BatchSpanProcessorMaxQueueSizeKey, tc.envValue)) - actualValue := BatchSpanProcessorMaxQueueSize(tc.defaultValue) - assert.Equal(t, tc.expectedValue, actualValue) + for _, key := range tc.keys { + t.Run(key, func(t *testing.T) { + envStore := ottest.NewEnvStore() + t.Cleanup(func() { require.NoError(t, envStore.Restore()) }) + envStore.Record(key) + + assert.Equal(t, defVal, tc.f(defVal), "environment variable unset") + + require.NoError(t, os.Setenv(key, envValStr)) + assert.Equal(t, envVal, tc.f(defVal), "environment variable set/valid") + + require.NoError(t, os.Setenv(key, invalid)) + assert.Equal(t, defVal, tc.f(defVal), "invalid value") + }) + + } }) } } From a4ea45c38cbcf76c43ab0555b2d4bcacbbfdce9a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 17 Mar 2022 08:49:33 -0700 Subject: [PATCH 104/886] Fix changelog entry section to be unreleased (#2680) --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53543ace68a..b103051c6ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - The metrics API has been significantly changed. (#2587) +### Fixed + +- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) + ## [1.5.0] - 2022-03-16 ### Added @@ -57,7 +61,6 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - Remove the OTLP trace exporter limit of SpanEvents when exporting. (#2616) - Default to port `4318` instead of `4317` for the `otlpmetrichttp` and `otlptracehttp` client. (#2614, #2625) - Unlimited span limits are now supported (negative values). (#2636, #2637) -- Fallback to general attribute limits when span specific ones are not set in the environment. (#2675, #2677) ### Deprecated From 5bf1f48e80f1fba149b447c25e7e42294d868d7c Mon Sep 17 00:00:00 2001 From: Sam <370182+plantfansam@users.noreply.github.com> Date: Fri, 18 Mar 2022 10:01:52 -0600 Subject: [PATCH 105/886] Remove link to exporters in opentelemetry-go-contrib (#2683) --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 21c2a71612e..4e8639ec8cd 100644 --- a/README.md +++ b/README.md @@ -95,8 +95,6 @@ All officially supported exporters for the OpenTelemetry project are contained i | [stdout](./exporters/stdout/) | ✓ | ✓ | | [Zipkin](./exporters/zipkin/) | | ✓ | -Additionally, OpenTelemetry community supported exporters can be found in the [contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/exporters). - ## Contributing See the [contributing documentation](CONTRIBUTING.md). From 421d6867eea4656a207c6fd2595a7cb919d85677 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 18 Mar 2022 11:36:16 -0500 Subject: [PATCH 106/886] Add Go 1.18 to our supported versions. (#2679) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds go1.18 to tests, moves default version to 1.17 * Added note to readme. * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update README.md Co-authored-by: Robert Pająk * Move default go version back to 1.16 * Move changelog entry to unreleased section Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 4 ++++ README.md | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 353df7ce38d..1c16023015b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: [1.17, 1.16] + go-version: [1.18, 1.17, 1.16] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner diff --git a/CHANGELOG.md b/CHANGELOG.md index b103051c6ba..b4c0d047217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This update is a breaking change of the unstable Metrics API. Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be modified. +### Added + +- Add go 1.18 to our compatibility tests. (#2679) + ### Changed - The metrics API has been significantly changed. (#2587) diff --git a/README.md b/README.md index 4e8639ec8cd..3eee84a671f 100644 --- a/README.md +++ b/README.md @@ -41,20 +41,28 @@ This project is tested on the following systems. | OS | Go Version | Architecture | | ------- | ---------- | ------------ | +| Ubuntu | 1.18 | amd64 | | Ubuntu | 1.17 | amd64 | | Ubuntu | 1.16 | amd64 | +| Ubuntu | 1.18 | 386 | | Ubuntu | 1.17 | 386 | | Ubuntu | 1.16 | 386 | +| MacOS | 1.18 | amd64 | | MacOS | 1.17 | amd64 | | MacOS | 1.16 | amd64 | +| Windows | 1.18 | amd64 | | Windows | 1.17 | amd64 | | Windows | 1.16 | amd64 | +| Windows | 1.18 | 386 | | Windows | 1.17 | 386 | | Windows | 1.16 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. +Go 1.18 was added in March of 2022. +Go 1.16 will be removed around June 2022. + ## Getting Started You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/). From 2f8698c3b1539fbdd31cc8df8d44652062800c83 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 21 Mar 2022 10:05:16 -0500 Subject: [PATCH 107/886] Update versions of dependences (#2710) github.com/stretchr/testify v1.7.1 github.com/go-logr/logr v1.2.3 github.com/golangci/golangci-lint v1.45.0 golang.org/x/tools v0.1.10 --- bridge/opencensus/go.sum | 7 ++- bridge/opencensus/test/go.sum | 7 ++- bridge/opentracing/go.sum | 7 ++- example/fib/go.sum | 7 ++- example/jaeger/go.sum | 7 ++- example/namedtracer/go.sum | 7 ++- example/opencensus/go.sum | 7 ++- example/otel-collector/go.sum | 6 +- example/passthrough/go.sum | 7 ++- example/prometheus/go.sum | 7 ++- example/zipkin/go.sum | 6 +- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 7 ++- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 6 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 6 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 6 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 6 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 6 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 6 +- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 7 ++- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 7 ++- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 7 ++- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 6 +- go.mod | 4 +- go.sum | 7 ++- internal/tools/go.mod | 6 +- internal/tools/go.sum | 62 ++++++++++--------- metric/go.sum | 5 +- schema/go.mod | 2 +- schema/go.sum | 4 +- sdk/export/metric/go.sum | 7 ++- sdk/go.mod | 4 +- sdk/go.sum | 7 ++- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 7 ++- trace/go.mod | 2 +- trace/go.sum | 5 +- 49 files changed, 169 insertions(+), 128 deletions(-) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 9d4421e648c..a123b0ac005 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -5,8 +5,9 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -22,8 +23,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index b0e85632d32..fcb0c9af429 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -11,8 +11,9 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -45,8 +46,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 767a256a278..42b3e118d70 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -12,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/example/fib/go.sum b/example/fib/go.sum index 388165251c8..3a091225429 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index e1b25057edf..3ecfae9ef6d 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -10,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 388165251c8..3a091225429 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 61a2e293569..435e0b939e7 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -5,8 +5,9 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZx github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -22,8 +23,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index f0cc9cfefcb..7a3e7b70a74 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -22,8 +22,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -62,8 +63,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 388165251c8..3a091225429 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 673fc937581..039a63a4b81 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -69,8 +69,9 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -193,8 +194,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 4592dbd0760..fc8c693a77b 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -29,8 +29,9 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -103,8 +104,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 9254779fa2c..ac956110f1e 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/trace v1.5.0 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 3d22834d0f4..58eb3804ae5 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -10,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 8e064415d31..8884eee4d99 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/cenkalti/backoff/v4 v4.1.2 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index de50e341131..0d874b89e7d 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 6dc1807cddb..fb9e63ab831 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index fa7935b2ab3..8115e273a2b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -24,8 +24,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -61,8 +62,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index c4d6a575adc..8449a1cb4a9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc go 1.16 require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index fa7935b2ab3..8115e273a2b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -24,8 +24,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -61,8 +62,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b70ba6e66e5..65359ee8bf1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp go 1.16 require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 go.opentelemetry.io/otel/sdk v1.5.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index fa7935b2ab3..8115e273a2b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -24,8 +24,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -61,8 +62,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 48d7c36ee82..4754211d0ef 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/sdk v1.5.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 090d0fa09c9..52075ac7cec 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -22,8 +22,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -59,8 +60,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 58acd836e9e..bcb789a4da7 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.16 require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 6b09989fa98..1d81ffaf09a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -22,8 +22,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -64,8 +65,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 774b04e51ae..92f98e0e789 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.16 require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 090d0fa09c9..52075ac7cec 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -22,8 +22,9 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -59,8 +60,9 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index a9c686515ae..7d08f50325d 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk v1.5.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 3a133e8de69..43be0c26beb 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -69,8 +69,9 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -195,8 +196,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index d44e40119db..babf8838612 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk v1.5.0 diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index e7e3c1a2040..9ab648da527 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -2,8 +2,9 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,8 +12,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 81ffc9ad995..31d458c9630 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/trace v1.5.0 diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index fbd4605e0ee..f9af6c5ae9d 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index ea061de6174..917d0eab385 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/sdk v1.5.0 go.opentelemetry.io/otel/trace v1.5.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index c0f74fbc982..f578de1840a 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -29,8 +29,9 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= @@ -105,8 +106,9 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= diff --git a/go.mod b/go.mod index 90517f78fb0..c7de5095b18 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel go 1.16 require ( - github.com/go-logr/logr v1.2.2 + github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/trace v1.5.0 ) diff --git a/go.sum b/go.sum index 531cae722ed..301997e9530 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 9aefef1006d..9ce202b9249 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,14 +5,14 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.44.2 + github.com/golangci/golangci-lint v1.45.0 github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 - golang.org/x/mod v0.5.1 - golang.org/x/tools v0.1.9 + golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 + golang.org/x/tools v0.1.10 ) replace go.opentelemetry.io/otel => ../.. diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 58392f05da5..a579c8d18e7 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -105,8 +105,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= -github.com/ashanbrown/makezero v1.1.0 h1:b2FVq4dTlBpy9f6qxhbyWH+6zy56IETE9cFbBGtDqs8= -github.com/ashanbrown/makezero v1.1.0/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= +github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= +github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= @@ -172,14 +172,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.3.1-0.20220208004058-76d765e3ab48 h1:9rJGqaC5do9zkvKrtRdx0HJoxj7Jd6vDa0O2eBU0AbU= -github.com/daixiang0/gci v0.3.1-0.20220208004058-76d765e3ab48/go.mod h1:jaASoJmv/ykO9dAAPy31iJnreV19248qKDdVWf3QgC4= +github.com/daixiang0/gci v0.3.3 h1:55xJKH7Gl9Vk6oQ1cMkwrDWjAkT1D+D1G9kNmRcAIY4= +github.com/daixiang0/gci v0.3.3/go.mod h1:1Xr2bxnQbDxCqqulUOv8qpGqkgRw9RSCGGjEC2LjF8o= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/denis-tingajkin/go-header v0.4.2 h1:jEeSF4sdv8/3cT/WY8AgDHUoItNSoEZ7qg9dX7pc218= -github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA= +github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= +github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -209,8 +209,8 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss= -github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= +github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= +github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= @@ -318,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.44.2 h1:MzvkDt1j1OHkv42/feNJVNNXRFACPp7aAWBWDo5aYQw= -github.com/golangci/golangci-lint v1.44.2/go.mod h1:KjBgkLvsTWDkhfu12iCrv0gwL1kON5KNhbyjQ6qN7Jo= +github.com/golangci/golangci-lint v1.45.0 h1:T2oCVkYoeckBxcNS6DTYiSXN2QcTNuAWaHyLGfqzMlU= +github.com/golangci/golangci-lint v1.45.0/go.mod h1:Y6grRO3drH/7kGP88i9jSl9fGWwCrbA5u7i++jOXll4= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -522,7 +522,6 @@ github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8 github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -590,7 +589,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= github.com/mgechev/revive v1.1.4 h1:sZOjY6GU35Kr9jKa/wsKSHgrFz8eASIB5i3tqWZMp0A= github.com/mgechev/revive v1.1.4/go.mod h1:ZZq2bmyssGh8MSPz3VVziqRNIMYTJXzP8MUKG90vZ9A= @@ -653,12 +651,14 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= @@ -745,25 +745,24 @@ github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDN github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.9.6 h1:ysfvgQBp2zmTgXQl65UkqEkYlQGbnVSRUGpCrJiiR4c= -github.com/securego/gosec/v2 v2.9.6/go.mod h1:EESY9Ywxo/Zc5NyF/qIj6Cop+4PSWM0F0OfGD7FdIXc= +github.com/securego/gosec/v2 v2.10.0 h1:l6BET4EzWtyUXCpY2v7N92v0DDCas0L7ngg3bpqbr8g= +github.com/securego/gosec/v2 v2.10.0/go.mod h1:PVq8Ewh/nCN8l/kKC6zrGXSr7m2NmEK6ITIAWMtIaA0= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.22.1/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= +github.com/shirou/gopsutil/v3 v3.22.2/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sivchari/containedctx v1.0.1 h1:fJq44cX+tD+uT5xGrsg25GwiaY61NGybQk9WWKij3Uo= -github.com/sivchari/containedctx v1.0.1/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= +github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= +github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/tenv v1.4.7 h1:FdTpgRlTue5eb5nXIYgS/lyVXSjugU8UUVDwhP1NLU8= github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -785,8 +784,9 @@ github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= +github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= +github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -833,8 +833,8 @@ github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcy github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.4.0 h1:mU4H9KsqqPZUALOUbVOpjy8qNQbWLoLI9fV68/1tq30= -github.com/tomarrell/wrapcheck/v2 v2.4.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= +github.com/tomarrell/wrapcheck/v2 v2.5.0 h1:g27SGGHNoQdvHz4KZA9o4v09RcWzylR+b1yueE5ECiw= +github.com/tomarrell/wrapcheck/v2 v2.5.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= @@ -930,8 +930,9 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI= -golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -969,8 +970,9 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1147,6 +1149,7 @@ golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1265,8 +1268,9 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1474,8 +1478,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= -mvdan.cc/gofumpt v0.2.1 h1:7jakRGkQcLAJdT+C8Bwc9d0BANkVPSkHZkzNv07pJAs= -mvdan.cc/gofumpt v0.2.1/go.mod h1:a/rvZPhsNaedOJBzqRD9omnwVwHZsBdJirXHa9Gh9Ig= +mvdan.cc/gofumpt v0.3.0 h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4= +mvdan.cc/gofumpt v0.3.0/go.mod h1:0+VyGZWleeIj5oostkOex+nDBA0eyavuDnDusAJ8ylo= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= diff --git a/metric/go.sum b/metric/go.sum index 5457c7626c5..2bcb4b5e74c 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,14 +1,15 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/schema/go.mod b/schema/go.mod index f98187eeaee..bd5888f698d 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/Masterminds/semver/v3 v3.1.1 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index e524be97373..05b233a6568 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sdk/export/metric/go.sum b/sdk/export/metric/go.sum index 038e4dbddc8..5f902e9646f 100644 --- a/sdk/export/metric/go.sum +++ b/sdk/export/metric/go.sum @@ -1,8 +1,9 @@ github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -10,8 +11,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index 37b14cf6120..019a61e12ba 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,9 +5,9 @@ go 1.16 replace go.opentelemetry.io/otel => ../ require ( - github.com/go-logr/logr v1.2.2 + github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/trace v1.5.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 diff --git a/sdk/go.sum b/sdk/go.sum index 5ba370adf67..46b2d5b84b6 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,8 +10,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 5f4c7f54118..ef2922af43c 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -40,7 +40,7 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 go.opentelemetry.io/otel/metric v0.27.0 go.opentelemetry.io/otel/sdk v1.5.0 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index e7e3c1a2040..9ab648da527 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -2,8 +2,9 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,8 +12,8 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/trace/go.mod b/trace/go.mod index 112d54673bb..050a05e3d83 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -40,7 +40,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 - github.com/stretchr/testify v1.7.0 + github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.5.0 ) diff --git a/trace/go.sum b/trace/go.sum index 83b153d9d1c..9b66702ac6a 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,14 +1,15 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= From fdbcf71c8f11616210dea17e20a98b138566c6fb Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Mon, 21 Mar 2022 22:09:30 +0530 Subject: [PATCH 108/886] Allow setting the Sampler via environment variables (#2517) * Allow setting the Sampler via environment variables (#2305) * Add changelog entry. * Replace t.Setenv with internaltest/SetEnvVariables for Go <= 1.6. * Handle the lack of a sampler argument without logging errors. * Add additional test cases and error checks. * Refactor documentation. Co-authored-by: Joshua MacDonald * emitBatchOverhead should only be used for splitting spans into batches (#2512) * emitBatchOverhead should only be used for splitting spans into batches (#2503) * limit max packet size parameter * Add additional errors types, simplify abstractions and error handling * Make error comparisons less fragile. * Fix typo in jaeger example (#2524) * Fix some typos in docs for Go libraries (#2520) Co-authored-by: Tyler Yahn * Fix getting-started.md Run function (#2527) * Fix getting-started.md Run function, it assigns this new context to a variable shared between connections in to accept loop. Thus creating a growing chain of contexts. so every calculate fibonacci request, all spans in a trace. * add a comment explaining the reason for that new variable * update example fib * Bump github.com/google/go-cmp from 0.5.6 to 0.5.7 across the project (#2545) * update go-cmp to 0.5.7 * fixes go.sums Co-authored-by: Aaron Clawson * Un-escape url coding when parsing baggage. (#2529) * un-escape url coding when parsing baggage. * Added changelog Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn * Bump go.opentelemetry.io/proto/otlp from 0.11.0 to 0.12.0 (#2546) * Update go.opentelemetry.io/proto/otlp to v0.12.0 * Changelog * Update CHANGELOG.md Fix's md linting Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn * Remove unused sdk/internal/santize (#2549) * Add links to code examples and docs (#2551) * Bump github.com/prometheus/client_golang from 1.11.0 to 1.12.0 in /exporters/prometheus (#2541) * Bump github.com/prometheus/client_golang in /exporters/prometheus Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.11.0 to 1.12.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.11.0...v1.12.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * go mod tidy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Optimize evictedQueue implementation and use (#2556) * Optimize evictedQueue impl and use Avoid unnecessary allocations in the recordingSpan by using an evictedQueue type instead of a pointer to one. Lazy allocate the evictedQueue queue to prevent unnecessary operations for spans without any use of the queue. Document the evictedQueue * Fix grammar * Add env support for batch span processor (#2515) * Add env support for batch span processor * Update changelog * lint * Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools (#2566) * Bump golang.org/x/tools from 0.1.8 to 0.1.9 in /internal/tools Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.1.8...v0.1.9) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Bump github.com/golangci/golangci-lint from 1.43.0 to 1.44.0 in /internal/tools (#2567) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Bump github.com/prometheus/client_golang from 1.12.0 to 1.12.1 in /exporters/prometheus (#2570) * Bump github.com/prometheus/client_golang in /exporters/prometheus Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.0 to 1.12.1. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.12.0...v1.12.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Fix TestBackoffRetry in otlp/internal/retry package (#2562) * Fix TestBackoffRetry in otlp retry pkg The delay of the retry is within two times a randomization factor (the back-off time is delay * random number within [1 - factor, 1 + factor]. This means the waitFunc in TestBackoffRetry needs to check the delay is within an appropriate delta, not equal to configure initial delay. * Fix delta value * Fix delta Co-authored-by: Aaron Clawson * Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlptrace (#2568) * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /example/otel-collector (#2565) * Bump google.golang.org/grpc in /example/otel-collector Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Bump google.golang.org/grpc from 1.43.0 to 1.44.0 in /exporters/otlp/otlpmetric (#2572) * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias * Change Options to accept type not pointer (#2558) * Change trace options to accept type not pointer Add benchmark to show allocation improvement. * Update CONTRIBUTING.md guidelines * Update all Option iface * Fix grammar in CONTRIBUTING * Do not store TracerProvider or Tracer fields in SDK recordingSpan (#2575) * Do not store TracerProvider fields in span Instead of keeping a reference to the span's Tracer, and therefore also it's TracerProvider, and the associated resource and spanLimits just keep the reference to the Tracer. Refer to the TracerProvider fields when needed instead. * Make span refer to the inst lib via the Tracer Instead of holding a field in the span, refer to the field in the parent Tracer. * [website_docs] fix page meta-links (#2580) Contributes to https://github.com/open-telemetry/opentelemetry.io/issues/1096 /cc @cartermp @austinlparker * Validate members once, in `NewMember` (#2522) * use NewMember, or specify if the member is not validated when creating new ones * expect members to already be validated when creating a new package * add changelog entry * add an isEmpty field to member and property for quick validation * rename isEmpty to hasData So by default, an empty struct really is marked as having no data * Update baggage/baggage_test.go Co-authored-by: Aaron Clawson * don't validate the member in parseMember, we alredy ran that validation We also don't want to use NewMember, as that runs the property validation again, making the benchmark quite slower * move changelog entry to the fixed section * provide the member/property data when returning an invalid error Co-authored-by: Aaron Clawson * Fix link to Zipkin exporter (#2581) Currently it is linked to the old package that was moved. * Unexport EnvBatchSpanProcessor* constants (#2583) * Move BSP env support to internal * Use pkg name * Update env test * Use internal/env in sdk/trace * Avoid an extra allocation in applyTracerProviderEnvConfigs. * Add additional errors for ratio > 1.0. * Add test cases for ratio > 1.0. * Update CHANGELOG.md Co-authored-by: Joshua MacDonald Co-authored-by: jaychung Co-authored-by: Ben Wells Co-authored-by: Jeremy Kaplan Co-authored-by: Tyler Yahn Co-authored-by: thinkgo <49174849+thinkgos@users.noreply.github.com> Co-authored-by: Aaron Clawson Co-authored-by: Aaron Clawson Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Chao Weng <19381524+sincejune@users.noreply.github.com> Co-authored-by: Patrice Chalin Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 1 + sdk/trace/provider.go | 29 ++++++- sdk/trace/provider_test.go | 165 +++++++++++++++++++++++++++++++++++++ sdk/trace/sampler_env.go | 107 ++++++++++++++++++++++++ 4 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 sdk/trace/sampler_env.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c0d047217..137bf9ff910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod ### Added - Add go 1.18 to our compatibility tests. (#2679) +- Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) ### Changed diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 0643d1a1611..77b86a84feb 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -99,6 +99,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { o := tracerProviderConfig{ spanLimits: NewSpanLimits(), } + o = applyTracerProviderEnvConfigs(o) for _, opt := range opts { o = opt.apply(o) @@ -335,7 +336,10 @@ func WithIDGenerator(g IDGenerator) TracerProviderOption { // Tracers the TracerProvider creates to make their sampling decisions for the // Spans they create. // -// If this option is not used, the TracerProvider will use a +// This option overrides the Sampler configured through the OTEL_TRACES_SAMPLER +// and OTEL_TRACES_SAMPLER_ARG environment variables. If this option is not used +// and the sampler is not configured through environment variables or the environment +// contains invalid/unsupported configuration, the TracerProvider will use a // ParentBased(AlwaysSample) Sampler by default. func WithSampler(s Sampler) TracerProviderOption { return traceProviderOptionFunc(func(cfg tracerProviderConfig) tracerProviderConfig { @@ -408,6 +412,29 @@ func WithRawSpanLimits(limits SpanLimits) TracerProviderOption { }) } +func applyTracerProviderEnvConfigs(cfg tracerProviderConfig) tracerProviderConfig { + for _, opt := range tracerProviderOptionsFromEnv() { + cfg = opt.apply(cfg) + } + + return cfg +} + +func tracerProviderOptionsFromEnv() []TracerProviderOption { + var opts []TracerProviderOption + + sampler, err := samplerFromEnv() + if err != nil { + otel.Handle(err) + } + + if sampler != nil { + opts = append(opts, WithSampler(sampler)) + } + + return opts +} + // ensureValidTracerProviderConfig ensures that given TracerProviderConfig is valid. func ensureValidTracerProviderConfig(cfg tracerProviderConfig) tracerProviderConfig { if cfg.sampler == nil { diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index e2fce31d7f7..0cfe584c926 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -17,10 +17,14 @@ package trace import ( "context" "errors" + "fmt" + "math/rand" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/trace" ) @@ -94,3 +98,164 @@ func TestSchemaURL(t *testing.T) { tracerStruct := tracerIface.(*tracer) assert.EqualValues(t, schemaURL, tracerStruct.instrumentationLibrary.SchemaURL) } + +func TestTracerProviderSamplerConfigFromEnv(t *testing.T) { + type testCase struct { + sampler string + samplerArg string + argOptional bool + description string + errorType error + invalidArgErrorType interface{} + } + + randFloat := rand.Float64() + + tests := []testCase{ + { + sampler: "invalid-sampler", + argOptional: true, + description: ParentBased(AlwaysSample()).Description(), + errorType: errUnsupportedSampler("invalid-sampler"), + invalidArgErrorType: func() *errUnsupportedSampler { e := errUnsupportedSampler("invalid-sampler"); return &e }(), + }, + { + sampler: "always_on", + argOptional: true, + description: AlwaysSample().Description(), + }, + { + sampler: "always_off", + argOptional: true, + description: NeverSample().Description(), + }, + { + sampler: "traceidratio", + samplerArg: fmt.Sprintf("%g", randFloat), + description: TraceIDRatioBased(randFloat).Description(), + }, + { + sampler: "traceidratio", + samplerArg: fmt.Sprintf("%g", -randFloat), + description: TraceIDRatioBased(1.0).Description(), + errorType: errNegativeTraceIDRatio, + }, + { + sampler: "traceidratio", + samplerArg: fmt.Sprintf("%g", 1+randFloat), + description: TraceIDRatioBased(1.0).Description(), + errorType: errGreaterThanOneTraceIDRatio, + }, + { + sampler: "traceidratio", + argOptional: true, + description: TraceIDRatioBased(1.0).Description(), + invalidArgErrorType: new(samplerArgParseError), + }, + { + sampler: "parentbased_always_on", + argOptional: true, + description: ParentBased(AlwaysSample()).Description(), + }, + { + sampler: "parentbased_always_off", + argOptional: true, + description: ParentBased(NeverSample()).Description(), + }, + { + sampler: "parentbased_traceidratio", + samplerArg: fmt.Sprintf("%g", randFloat), + description: ParentBased(TraceIDRatioBased(randFloat)).Description(), + }, + { + sampler: "parentbased_traceidratio", + samplerArg: fmt.Sprintf("%g", -randFloat), + description: ParentBased(TraceIDRatioBased(1.0)).Description(), + errorType: errNegativeTraceIDRatio, + }, + { + sampler: "parentbased_traceidratio", + samplerArg: fmt.Sprintf("%g", 1+randFloat), + description: ParentBased(TraceIDRatioBased(1.0)).Description(), + errorType: errGreaterThanOneTraceIDRatio, + }, + { + sampler: "parentbased_traceidratio", + argOptional: true, + description: ParentBased(TraceIDRatioBased(1.0)).Description(), + invalidArgErrorType: new(samplerArgParseError), + }, + } + + handler.Reset() + + for _, test := range tests { + t.Run(test.sampler, func(t *testing.T) { + envVars := map[string]string{ + "OTEL_TRACES_SAMPLER": test.sampler, + } + + if test.samplerArg != "" { + envVars["OTEL_TRACES_SAMPLER_ARG"] = test.samplerArg + } + envStore, err := ottest.SetEnvVariables(envVars) + require.NoError(t, err) + t.Cleanup(func() { + handler.Reset() + require.NoError(t, envStore.Restore()) + }) + + stp := NewTracerProvider(WithSyncer(NewTestExporter())) + assert.Equal(t, test.description, stp.sampler.Description()) + if test.errorType != nil { + testStoredError(t, test.errorType) + } else { + assert.Empty(t, handler.errs) + } + + if test.argOptional { + t.Run("invalid sampler arg", func(t *testing.T) { + envStore, err := ottest.SetEnvVariables(map[string]string{ + "OTEL_TRACES_SAMPLER": test.sampler, + "OTEL_TRACES_SAMPLER_ARG": "invalid-ignored-string", + }) + require.NoError(t, err) + t.Cleanup(func() { + handler.Reset() + require.NoError(t, envStore.Restore()) + }) + + stp := NewTracerProvider(WithSyncer(NewTestExporter())) + t.Cleanup(func() { + require.NoError(t, stp.Shutdown(context.Background())) + }) + assert.Equal(t, test.description, stp.sampler.Description()) + + if test.invalidArgErrorType != nil { + testStoredError(t, test.invalidArgErrorType) + } else { + assert.Empty(t, handler.errs) + } + }) + } + }) + } +} + +func testStoredError(t *testing.T, target interface{}) { + t.Helper() + + if assert.Len(t, handler.errs, 1) && assert.Error(t, handler.errs[0]) { + err := handler.errs[0] + + require.Implements(t, (*error)(nil), target) + require.NotNil(t, target.(error)) + + defer handler.Reset() + if errors.Is(err, target.(error)) { + return + } + + assert.ErrorAs(t, err, target) + } +} diff --git a/sdk/trace/sampler_env.go b/sdk/trace/sampler_env.go new file mode 100644 index 00000000000..97f80576e68 --- /dev/null +++ b/sdk/trace/sampler_env.go @@ -0,0 +1,107 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/sdk/trace" + +import ( + "errors" + "fmt" + "os" + "strconv" + "strings" +) + +const ( + tracesSamplerKey = "OTEL_TRACES_SAMPLER" + tracesSamplerArgKey = "OTEL_TRACES_SAMPLER_ARG" + + samplerAlwaysOn = "always_on" + samplerAlwaysOff = "always_off" + samplerTraceIDRatio = "traceidratio" + samplerParentBasedAlwaysOn = "parentbased_always_on" + samplerParsedBasedAlwaysOff = "parentbased_always_off" + samplerParentBasedTraceIDRatio = "parentbased_traceidratio" +) + +type errUnsupportedSampler string + +func (e errUnsupportedSampler) Error() string { + return fmt.Sprintf("unsupported sampler: %s", string(e)) +} + +var ( + errNegativeTraceIDRatio = errors.New("invalid trace ID ratio: less than 0.0") + errGreaterThanOneTraceIDRatio = errors.New("invalid trace ID ratio: greater than 1.0") +) + +type samplerArgParseError struct { + parseErr error +} + +func (e samplerArgParseError) Error() string { + return fmt.Sprintf("parsing sampler argument: %s", e.parseErr.Error()) +} + +func (e samplerArgParseError) Unwrap() error { + return e.parseErr +} + +func samplerFromEnv() (Sampler, error) { + sampler, ok := os.LookupEnv(tracesSamplerKey) + if !ok { + return nil, nil + } + + sampler = strings.ToLower(strings.TrimSpace(sampler)) + samplerArg, hasSamplerArg := os.LookupEnv(tracesSamplerArgKey) + samplerArg = strings.TrimSpace(samplerArg) + + switch sampler { + case samplerAlwaysOn: + return AlwaysSample(), nil + case samplerAlwaysOff: + return NeverSample(), nil + case samplerTraceIDRatio: + ratio, err := parseTraceIDRatio(samplerArg, hasSamplerArg) + return ratio, err + case samplerParentBasedAlwaysOn: + return ParentBased(AlwaysSample()), nil + case samplerParsedBasedAlwaysOff: + return ParentBased(NeverSample()), nil + case samplerParentBasedTraceIDRatio: + ratio, err := parseTraceIDRatio(samplerArg, hasSamplerArg) + return ParentBased(ratio), err + default: + return nil, errUnsupportedSampler(sampler) + } + +} + +func parseTraceIDRatio(arg string, hasSamplerArg bool) (Sampler, error) { + if !hasSamplerArg { + return TraceIDRatioBased(1.0), nil + } + v, err := strconv.ParseFloat(arg, 64) + if err != nil { + return TraceIDRatioBased(1.0), samplerArgParseError{err} + } + if v < 0.0 { + return TraceIDRatioBased(1.0), errNegativeTraceIDRatio + } + if v > 1.0 { + return TraceIDRatioBased(1.0), errGreaterThanOneTraceIDRatio + } + + return TraceIDRatioBased(v), nil +} From 6132008a78658465be62f3ff851a7768e186a475 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 21 Mar 2022 12:38:13 -0700 Subject: [PATCH 109/886] Use upstream dbotconf (#2713) * Add upstream dbotconf dep * Remove local dbotconf * Update Makefile * Run dependabot generation --- .github/dependabot.yml | 131 ++++++++++++++-------------- Makefile | 24 ++--- internal/tools/dbotconf/dbotconf.go | 112 ------------------------ internal/tools/go.mod | 1 + internal/tools/go.sum | 8 +- internal/tools/tools.go | 1 + 6 files changed, 79 insertions(+), 198 deletions(-) delete mode 100644 internal/tools/dbotconf/dbotconf.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5e4fc315deb..dd586259af2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,4 @@ -# File generated by "make dependabot-generate"; DO NOT EDIT. - +# File generated by dbotconf; DO NOT EDIT. version: 2 updates: - package-ecosystem: github-actions @@ -7,286 +6,286 @@ updates: labels: - dependencies - actions - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: / labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /bridge/opencensus labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /bridge/opencensus/test labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /bridge/opentracing labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/fib labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/jaeger labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/namedtracer labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/opencensus labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/otel-collector labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/passthrough labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/prometheus labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/zipkin labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/jaeger labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/internal/retry labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlpmetric labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlpmetric/otlpmetricgrpc labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlpmetric/otlpmetrichttp labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlptrace labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlptrace/otlptracegrpc labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlptrace/otlptracehttp labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/prometheus labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/stdout/stdoutmetric labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/stdout/stdouttrace labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /exporters/zipkin labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /internal/tools labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /metric labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /schema labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /sdk labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /sdk/export/metric labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /sdk/metric labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday - package-ecosystem: gomod directory: /trace labels: - dependencies - go - - "Skip Changelog" + - Skip Changelog schedule: - day: sunday interval: weekly + day: sunday diff --git a/Makefile b/Makefile index bcb3a6d8629..1b80eb72adf 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ CROSSLINK = $(TOOLS)/crosslink $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink DBOTCONF = $(TOOLS)/dbotconf -$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/dbotconf +$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf GOLANGCI_LINT = $(TOOLS)/golangci-lint $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint @@ -178,26 +178,14 @@ license-check: exit 1; \ fi -DEPENDABOT_PATH=./.github/dependabot.yml +DEPENDABOT_CONFIG = .github/dependabot.yml .PHONY: dependabot-check -dependabot-check: - @result=$$( \ - for f in $$( find . -type f -name go.mod -exec dirname {} \; | sed 's/^.//' ); \ - do grep -q "directory: \+$$f" $(DEPENDABOT_PATH) \ - || echo "$$f"; \ - done; \ - ); \ - if [ -n "$$result" ]; then \ - echo "missing dependabot entry:"; echo "$$result"; \ - echo "new modules need to be added to the $(DEPENDABOT_PATH) file"; \ - echo "(run: make dependabot-generate)"; \ - exit 1; \ - fi +dependabot-check: | $(DBOTCONF) + @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || echo "(run: make dependabot-generate)" .PHONY: dependabot-generate -dependabot-generate: $(DBOTCONF) - @echo "gerating dependabot configuration"; \ - $(DBOTCONF) +dependabot-generate: | $(DBOTCONF) + @$(DBOTCONF) generate > $(DEPENDABOT_CONFIG) .PHONY: check-clean-work-tree check-clean-work-tree: diff --git a/internal/tools/dbotconf/dbotconf.go b/internal/tools/dbotconf/dbotconf.go deleted file mode 100644 index a81a3a83fb9..00000000000 --- a/internal/tools/dbotconf/dbotconf.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package main provides a utility to generate a complete dependabot -// configuration for a repository with multiple Go modules. -package main - -import ( - "flag" - "fmt" - "log" - "os" - "path/filepath" - "sort" - "strings" - "text/template" - - "go.opentelemetry.io/otel/internal/tools" - "golang.org/x/mod/modfile" -) - -var configPtr = flag.String("config", "./.github/dependabot.yml", "dependabot configuration path") - -const configTemplate = `# File generated by "make dependabot-generate"; DO NOT EDIT. - -version: 2 -updates: - - package-ecosystem: github-actions - directory: / - labels: - - dependencies - - actions - - "Skip Changelog" - schedule: - day: sunday - interval: weekly -{{- range .}} - - package-ecosystem: gomod - directory: {{.}} - labels: - - dependencies - - go - - "Skip Changelog" - schedule: - day: sunday - interval: weekly -{{- end}} -` - -func gomodDirectories(basePath string, mods []*modfile.File) []string { - var dirs []string - for _, m := range mods { - targetPath := filepath.Dir(m.Syntax.Name) - relPath := strings.TrimPrefix(targetPath, basePath) - if relPath == "" { - relPath = "/" - } - dirs = append(dirs, relPath) - } - sort.Strings(dirs) - return dirs -} - -func generate(path string) error { - tpl, err := template.New("dependabot.yml").Parse(configTemplate) - if err != nil { - return fmt.Errorf("parse template: %w", err) - } - - root, err := tools.FindRepoRoot() - if err != nil { - return fmt.Errorf("find repo root: %w", err) - } - - mods, err := root.FindModules() - if err != nil { - return fmt.Errorf("list modules: %w", err) - } - data := gomodDirectories(string(root), mods) - - f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755) - if err != nil { - return err - } - if err = tpl.Execute(f, data); err != nil { - // Best effort. - _ = f.Close() - return fmt.Errorf("rendering template: %w", err) - } - if err = f.Close(); err != nil { - return fmt.Errorf("closing %s: %w", path, err) - } - return nil -} - -func main() { - flag.Parse() - if err := generate(*configPtr); err != nil { - log.Fatalf("failed to generate dependabot configuration: %v", err) - } -} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 9ce202b9249..78aee63e85e 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,6 +9,7 @@ require ( github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad + go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index a579c8d18e7..5f1e09c9329 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -812,8 +812,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= @@ -894,8 +895,11 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/build-tools v0.0.0-20210719163622-92017e64f35b h1:tFMjUqEDGM2F82663yYidqTluwEJmmihk/AXr19J7rI= go.opentelemetry.io/build-tools v0.0.0-20210719163622-92017e64f35b/go.mod h1:zZRrJN8qdwDdPNkCEyww4SW54mM1Da0v9H3TyQet9T4= +go.opentelemetry.io/build-tools v0.0.0-20220304161722-feb5ff5848f1 h1:R/LC1WK1TDCbS2ANSeI2XcKrO5Ym6tx1YCUo+AaiFoE= +go.opentelemetry.io/build-tools v0.0.0-20220304161722-feb5ff5848f1/go.mod h1:qO4vrNgLf0V5FHckLNwEw2CfBTaL8w6pKDm3bF6nhMk= +go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a h1:VCNW72z+YKDAH8O5y+WmMuj2Jlgd+ZG5Abk9xTGw6dQ= +go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a/go.mod h1:/X2uGFIoHCUyQiBqL6pY6AEU2j8q1e+EMWhZlCsY5dk= go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 h1:5zVDNFcOwiMee9Qm8sH08iw+9cJZk+l/Y3mVa2D/zmM= go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375/go.mod h1:mPh1L/tfTGyVNnSQOTlTSi2CBpci13Ft8jE4Glik2es= go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 h1:EaeArFokiObXc/jkX0Ck3u2d6lWDmeWdEPy2IdlF6iw= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 2966e7bfd26..53b4a545b23 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -24,6 +24,7 @@ import ( _ "github.com/itchyny/gojq" _ "github.com/jcchavezs/porto/cmd/porto" _ "github.com/wadey/gocovmerge" + _ "go.opentelemetry.io/build-tools/dbotconf" _ "go.opentelemetry.io/build-tools/multimod" _ "go.opentelemetry.io/build-tools/semconvgen" _ "golang.org/x/tools/cmd/stringer" From 9a51174e633d309ed922b9e69f3bff644a096008 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Mar 2022 16:18:20 -0400 Subject: [PATCH 110/886] Bump actions/cache from 2.1.7 to 3 (#2714) Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.7...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8366db387dd..5328bd89576 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -17,7 +17,7 @@ jobs: - name: Run benchmarks run: make test-bench | tee output.txt - name: Download previous benchmark data - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: ./benchmarks key: ${{ runner.os }}-benchmark diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c16023015b..a5126759634 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,14 +24,14 @@ jobs: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Module cache - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 env: cache-name: go-mod-cache with: path: ~/go/pkg/mod key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} - name: Tools cache - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 env: cache-name: go-tools-cache with: @@ -58,7 +58,7 @@ jobs: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Module cache - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 env: cache-name: go-mod-cache with: @@ -81,7 +81,7 @@ jobs: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Module cache - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 env: cache-name: go-mod-cache with: @@ -134,7 +134,7 @@ jobs: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH shell: bash - name: Module cache - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 env: cache-name: go-mod-cache with: From 8a7dcd9650c9f44cc514575a5d011bbb5f91a7c3 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:33:13 -0500 Subject: [PATCH 111/886] Adds metrics Global (#2660) * WIP: add global API * WIP * Add a global meter. * moved global access out of metric because of loop imports * fix linting issues * remove changes from other lint failures. * Add changelog * Fixes for comments. Changed name of global API. Added stop to all race tests go routine. Added race tests for other instruments. * Apply suggestions from code review Co-authored-by: Tyler Yahn * Consolidated instrument tests * fixed lint, and removed unneeded type checking * change require's to asserts. * Update misspelling Co-authored-by: Tyler Yahn * Fix meter race test. * Copy SetTracerProvider logic. * Fix global test for panic. * Fix linting error * bump testify version * moved changelog into unreleased Co-authored-by: Aaron Clawson Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + metric/global/global.go | 31 ++ metric/go.mod | 5 +- metric/go.sum | 3 + metric/internal/global/instruments.go | 341 +++++++++++++++++++++ metric/internal/global/instruments_test.go | 171 +++++++++++ metric/internal/global/meter.go | 327 ++++++++++++++++++++ metric/internal/global/meter_test.go | 265 ++++++++++++++++ metric/internal/global/meter_types_test.go | 158 ++++++++++ metric/internal/global/state.go | 59 ++++ metric/internal/global/state_test.go | 68 ++++ 11 files changed, 1428 insertions(+), 1 deletion(-) create mode 100644 metric/global/global.go create mode 100644 metric/internal/global/instruments.go create mode 100644 metric/internal/global/instruments_test.go create mode 100644 metric/internal/global/meter.go create mode 100644 metric/internal/global/meter_test.go create mode 100644 metric/internal/global/meter_types_test.go create mode 100644 metric/internal/global/state.go create mode 100644 metric/internal/global/state_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 137bf9ff910..c6465e99e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - Add go 1.18 to our compatibility tests. (#2679) - Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) +- Add the `metric/global` for obtaining and setting the global `MeterProvider` (#2660) ### Changed diff --git a/metric/global/global.go b/metric/global/global.go new file mode 100644 index 00000000000..8578c99ae5a --- /dev/null +++ b/metric/global/global.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/global" + +import ( + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/internal/global" +) + +// MeterProvider returns the registered global trace provider. +// If none is registered then a No-op MeterProvider is returned. +func MeterProvider() metric.MeterProvider { + return global.MeterProvider() +} + +// SetMeterProvider registers `mp` as the global meter provider. +func SetMeterProvider(mp metric.MeterProvider) { + global.SetMeterProvider(mp) +} diff --git a/metric/go.mod b/metric/go.mod index 188c44326eb..9714c1150a6 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -2,7 +2,10 @@ module go.opentelemetry.io/otel/metric go 1.16 -require go.opentelemetry.io/otel v1.5.0 +require ( + github.com/stretchr/testify v1.7.1 + go.opentelemetry.io/otel v1.5.0 +) replace go.opentelemetry.io/otel => ../ diff --git a/metric/go.sum b/metric/go.sum index 2bcb4b5e74c..f2ec9b9fab0 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,7 +1,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= @@ -11,6 +13,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go new file mode 100644 index 00000000000..6b2004af65f --- /dev/null +++ b/metric/internal/global/instruments.go @@ -0,0 +1,341 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "context" + "sync/atomic" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +type afCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncfloat64.Counter + + instrument.Asynchronous +} + +func (i *afCounter) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncFloat64().Counter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncfloat64.Counter).Observe(ctx, x, attrs...) + } +} + +type afUpDownCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncfloat64.UpDownCounter + + instrument.Asynchronous +} + +func (i *afUpDownCounter) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncFloat64().UpDownCounter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncfloat64.UpDownCounter).Observe(ctx, x, attrs...) + } +} + +type afGauge struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncfloat64.Gauge + + instrument.Asynchronous +} + +func (i *afGauge) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncFloat64().Gauge(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncfloat64.Gauge).Observe(ctx, x, attrs...) + } +} + +type aiCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncint64.Counter + + instrument.Asynchronous +} + +func (i *aiCounter) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncInt64().Counter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncint64.Counter).Observe(ctx, x, attrs...) + } +} + +type aiUpDownCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncint64.UpDownCounter + + instrument.Asynchronous +} + +func (i *aiUpDownCounter) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncInt64().UpDownCounter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncint64.UpDownCounter).Observe(ctx, x, attrs...) + } +} + +type aiGauge struct { + name string + opts []instrument.Option + + delegate atomic.Value //asyncint64.Gauge + + instrument.Asynchronous +} + +func (i *aiGauge) setDelegate(m metric.Meter) { + + ctr, err := m.AsyncInt64().Gauge(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(asyncint64.Gauge).Observe(ctx, x, attrs...) + } +} + +//Sync Instruments +type sfCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncfloat64.Counter + + instrument.Synchronous +} + +func (i *sfCounter) setDelegate(m metric.Meter) { + + ctr, err := m.SyncFloat64().Counter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncfloat64.Counter).Add(ctx, incr, attrs...) + } +} + +type sfUpDownCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncfloat64.UpDownCounter + + instrument.Synchronous +} + +func (i *sfUpDownCounter) setDelegate(m metric.Meter) { + + ctr, err := m.SyncFloat64().UpDownCounter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncfloat64.UpDownCounter).Add(ctx, incr, attrs...) + } +} + +type sfHistogram struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncfloat64.Histogram + + instrument.Synchronous +} + +func (i *sfHistogram) setDelegate(m metric.Meter) { + ctr, err := m.SyncFloat64().Histogram(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncfloat64.Histogram).Record(ctx, x, attrs...) + } +} + +type siCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncint64.Counter + + instrument.Synchronous +} + +func (i *siCounter) setDelegate(m metric.Meter) { + + ctr, err := m.SyncInt64().Counter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncint64.Counter).Add(ctx, x, attrs...) + } +} + +type siUpDownCounter struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncint64.UpDownCounter + + instrument.Synchronous +} + +func (i *siUpDownCounter) setDelegate(m metric.Meter) { + + ctr, err := m.SyncInt64().UpDownCounter(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncint64.UpDownCounter).Add(ctx, x, attrs...) + } +} + +type siHistogram struct { + name string + opts []instrument.Option + + delegate atomic.Value //syncint64.Histogram + + instrument.Synchronous +} + +func (i *siHistogram) setDelegate(m metric.Meter) { + + ctr, err := m.SyncInt64().Histogram(i.name, i.opts...) + if err != nil { + otel.Handle(err) + return + } + i.delegate.Store(ctr) + +} + +func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { + if ctr := i.delegate.Load(); ctr != nil { + ctr.(syncint64.Histogram).Record(ctx, x, attrs...) + } +} diff --git a/metric/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go new file mode 100644 index 00000000000..33c88f6b6f1 --- /dev/null +++ b/metric/internal/global/instruments_test.go @@ -0,0 +1,171 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/nonrecording" +) + +func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { + finish := make(chan struct{}) + go func() { + for { + interact(context.Background(), 1) + select { + case <-finish: + return + default: + } + } + }() + + setDelegate(nonrecording.NewNoopMeter()) + close(finish) +} + +func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { + finish := make(chan struct{}) + go func() { + for { + interact(context.Background(), 1) + select { + case <-finish: + return + default: + } + } + }() + + setDelegate(nonrecording.NewNoopMeter()) + close(finish) +} + +func TestAsyncInstrumentSetDelegateRace(t *testing.T) { + // Float64 Instruments + t.Run("Float64", func(t *testing.T) { + t.Run("Counter", func(t *testing.T) { + delegate := &afCounter{} + testFloat64Race(delegate.Observe, delegate.setDelegate) + }) + + t.Run("UpDownCounter", func(t *testing.T) { + delegate := &afUpDownCounter{} + testFloat64Race(delegate.Observe, delegate.setDelegate) + }) + + t.Run("Gauge", func(t *testing.T) { + delegate := &afGauge{} + testFloat64Race(delegate.Observe, delegate.setDelegate) + }) + }) + + // Int64 Instruments + + t.Run("Int64", func(t *testing.T) { + t.Run("Counter", func(t *testing.T) { + delegate := &aiCounter{} + testInt64Race(delegate.Observe, delegate.setDelegate) + }) + + t.Run("UpDownCounter", func(t *testing.T) { + delegate := &aiUpDownCounter{} + testInt64Race(delegate.Observe, delegate.setDelegate) + }) + + t.Run("Gauge", func(t *testing.T) { + delegate := &aiGauge{} + testInt64Race(delegate.Observe, delegate.setDelegate) + }) + }) +} + +func TestSyncInstrumentSetDelegateRace(t *testing.T) { + // Float64 Instruments + t.Run("Float64", func(t *testing.T) { + t.Run("Counter", func(t *testing.T) { + delegate := &sfCounter{} + testFloat64Race(delegate.Add, delegate.setDelegate) + }) + + t.Run("UpDownCounter", func(t *testing.T) { + delegate := &sfUpDownCounter{} + testFloat64Race(delegate.Add, delegate.setDelegate) + }) + + t.Run("Histogram", func(t *testing.T) { + delegate := &sfHistogram{} + testFloat64Race(delegate.Record, delegate.setDelegate) + }) + }) + + // Int64 Instruments + + t.Run("Int64", func(t *testing.T) { + t.Run("Counter", func(t *testing.T) { + delegate := &siCounter{} + testInt64Race(delegate.Add, delegate.setDelegate) + }) + + t.Run("UpDownCounter", func(t *testing.T) { + delegate := &siUpDownCounter{} + testInt64Race(delegate.Add, delegate.setDelegate) + }) + + t.Run("Histogram", func(t *testing.T) { + delegate := &siHistogram{} + testInt64Race(delegate.Record, delegate.setDelegate) + }) + }) +} + +type testCountingFloatInstrument struct { + count int + + instrument.Asynchronous + instrument.Synchronous +} + +func (i *testCountingFloatInstrument) Observe(context.Context, float64, ...attribute.KeyValue) { + i.count++ +} +func (i *testCountingFloatInstrument) Add(context.Context, float64, ...attribute.KeyValue) { + i.count++ +} +func (i *testCountingFloatInstrument) Record(context.Context, float64, ...attribute.KeyValue) { + i.count++ +} + +type testCountingIntInstrument struct { + count int + + instrument.Asynchronous + instrument.Synchronous +} + +func (i *testCountingIntInstrument) Observe(context.Context, int64, ...attribute.KeyValue) { + i.count++ +} +func (i *testCountingIntInstrument) Add(context.Context, int64, ...attribute.KeyValue) { + i.count++ +} +func (i *testCountingIntInstrument) Record(context.Context, int64, ...attribute.KeyValue) { + i.count++ +} diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go new file mode 100644 index 00000000000..9001ae9427b --- /dev/null +++ b/metric/internal/global/meter.go @@ -0,0 +1,327 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "context" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +// meterProvider is a placeholder for a configured SDK MeterProvider. +// +// All MeterProvider functionality is forwarded to a delegate once +// configured. +type meterProvider struct { + mtx sync.Mutex + meters map[il]*meter + + delegate metric.MeterProvider +} + +type il struct { + name string + version string +} + +// setDelegate configures p to delegate all MeterProvider functionality to +// provider. +// +// All Meters provided prior to this function call are switched out to be +// Meters provided by provider. All instruments and callbacks are recreated and +// delegated. +// +// It is guaranteed by the caller that this happens only once. +func (p *meterProvider) setDelegate(provider metric.MeterProvider) { + p.mtx.Lock() + defer p.mtx.Unlock() + + p.delegate = provider + + if len(p.meters) == 0 { + return + } + + for _, meter := range p.meters { + meter.setDelegate(provider) + } + + p.meters = nil +} + +// Meter implements MeterProvider. +func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { + p.mtx.Lock() + defer p.mtx.Unlock() + + if p.delegate != nil { + return p.delegate.Meter(name, opts...) + } + + // At this moment it is guaranteed that no sdk is installed, save the meter in the meters map. + + c := metric.NewMeterConfig(opts...) + key := il{ + name: name, + version: c.InstrumentationVersion(), + } + + if p.meters == nil { + p.meters = make(map[il]*meter) + } + + if val, ok := p.meters[key]; ok { + return val + } + + t := &meter{name: name, opts: opts} + p.meters[key] = t + return t +} + +// meter is a placeholder for a metric.Meter. +// +// All Meter functionality is forwarded to a delegate once configured. +// Otherwise, all functionality is forwarded to a NoopMeter. +type meter struct { + name string + opts []metric.MeterOption + + mtx sync.Mutex + instruments []delegatedInstrument + callbacks []delegatedCallback + + delegate atomic.Value // metric.Meter +} + +type delegatedInstrument interface { + setDelegate(metric.Meter) +} + +// setDelegate configures m to delegate all Meter functionality to Meters +// created by provider. +// +// All subsequent calls to the Meter methods will be passed to the delegate. +// +// It is guaranteed by the caller that this happens only once. +func (m *meter) setDelegate(provider metric.MeterProvider) { + meter := provider.Meter(m.name, m.opts...) + m.delegate.Store(meter) + + m.mtx.Lock() + defer m.mtx.Unlock() + + for _, inst := range m.instruments { + inst.setDelegate(meter) + } + + for _, callback := range m.callbacks { + callback.setDelegate(meter) + } + + m.instruments = nil + m.callbacks = nil +} + +// AsyncInt64 is the namespace for the Asynchronous Integer instruments. +// +// To Observe data with instruments it must be registered in a callback. +func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.AsyncInt64() + } + return (*aiInstProvider)(m) +} + +// AsyncFloat64 is the namespace for the Asynchronous Float instruments. +// +// To Observe data with instruments it must be registered in a callback. +func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.AsyncFloat64() + } + return (*afInstProvider)(m) +} + +// RegisterCallback captures the function that will be called during Collect. +// +// It is only valid to call Observe within the scope of the passed function, +// and only on the instruments that were registered with this call. +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.RegisterCallback(insts, function) + } + + m.mtx.Lock() + defer m.mtx.Unlock() + m.callbacks = append(m.callbacks, delegatedCallback{ + instruments: insts, + function: function, + }) + + return nil +} + +// SyncInt64 is the namespace for the Synchronous Integer instruments +func (m *meter) SyncInt64() syncint64.InstrumentProvider { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.SyncInt64() + } + return (*siInstProvider)(m) +} + +// SyncFloat64 is the namespace for the Synchronous Float instruments +func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.SyncFloat64() + } + return (*sfInstProvider)(m) +} + +type delegatedCallback struct { + instruments []instrument.Asynchronous + function func(context.Context) +} + +func (c *delegatedCallback) setDelegate(m metric.Meter) { + err := m.RegisterCallback(c.instruments, c.function) + if err != nil { + otel.Handle(err) + } +} + +type afInstProvider meter + +// Counter creates an instrument for recording increasing values. +func (ip *afInstProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &afCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip *afInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &afUpDownCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// Gauge creates an instrument for recording the current value. +func (ip *afInstProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &afGauge{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +type aiInstProvider meter + +// Counter creates an instrument for recording increasing values. +func (ip *aiInstProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &aiCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip *aiInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &aiUpDownCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// Gauge creates an instrument for recording the current value. +func (ip *aiInstProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &aiGauge{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +type sfInstProvider meter + +// Counter creates an instrument for recording increasing values. +func (ip *sfInstProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &sfCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip *sfInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &sfUpDownCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// Histogram creates an instrument for recording a distribution of values. +func (ip *sfInstProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &sfHistogram{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +type siInstProvider meter + +// Counter creates an instrument for recording increasing values. +func (ip *siInstProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &siCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip *siInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &siUpDownCounter{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} + +// Histogram creates an instrument for recording a distribution of values. +func (ip *siInstProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { + ip.mtx.Lock() + defer ip.mtx.Unlock() + ctr := &siHistogram{name: name, opts: opts} + ip.instruments = append(ip.instruments, ctr) + return ctr, nil +} diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go new file mode 100644 index 00000000000..481c55e2273 --- /dev/null +++ b/metric/internal/global/meter_test.go @@ -0,0 +1,265 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "context" + "fmt" + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/nonrecording" +) + +func TestMeterProviderRace(t *testing.T) { + mp := &meterProvider{} + finish := make(chan struct{}) + go func() { + for i := 0; ; i++ { + mp.Meter(fmt.Sprintf("a%d", i)) + select { + case <-finish: + return + default: + } + } + }() + + mp.setDelegate(nonrecording.NewNoopMeterProvider()) + close(finish) + +} + +func TestMeterRace(t *testing.T) { + mtr := &meter{} + + wg := &sync.WaitGroup{} + wg.Add(1) + finish := make(chan struct{}) + go func() { + for i, once := 0, false; ; i++ { + name := fmt.Sprintf("a%d", i) + _, _ = mtr.AsyncFloat64().Counter(name) + _, _ = mtr.AsyncFloat64().UpDownCounter(name) + _, _ = mtr.AsyncFloat64().Gauge(name) + _, _ = mtr.AsyncInt64().Counter(name) + _, _ = mtr.AsyncInt64().UpDownCounter(name) + _, _ = mtr.AsyncInt64().Gauge(name) + _, _ = mtr.SyncFloat64().Counter(name) + _, _ = mtr.SyncFloat64().UpDownCounter(name) + _, _ = mtr.SyncFloat64().Histogram(name) + _, _ = mtr.SyncInt64().Counter(name) + _, _ = mtr.SyncInt64().UpDownCounter(name) + _, _ = mtr.SyncInt64().Histogram(name) + _ = mtr.RegisterCallback(nil, func(ctx context.Context) {}) + if !once { + wg.Done() + once = true + } + select { + case <-finish: + return + default: + } + } + }() + + wg.Wait() + mtr.setDelegate(nonrecording.NewNoopMeterProvider()) + close(finish) +} + +func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Counter, asyncfloat64.Counter) { + + afcounter, err := m.AsyncFloat64().Counter("test_Async_Counter") + require.NoError(t, err) + _, err = m.AsyncFloat64().UpDownCounter("test_Async_UpDownCounter") + assert.NoError(t, err) + _, err = m.AsyncFloat64().Gauge("test_Async_Gauge") + assert.NoError(t, err) + + _, err = m.AsyncInt64().Counter("test_Async_Counter") + assert.NoError(t, err) + _, err = m.AsyncInt64().UpDownCounter("test_Async_UpDownCounter") + assert.NoError(t, err) + _, err = m.AsyncInt64().Gauge("test_Async_Gauge") + assert.NoError(t, err) + + require.NoError(t, m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) { + afcounter.Observe(ctx, 3) + })) + + sfcounter, err := m.SyncFloat64().Counter("test_Async_Counter") + require.NoError(t, err) + _, err = m.SyncFloat64().UpDownCounter("test_Async_UpDownCounter") + assert.NoError(t, err) + _, err = m.SyncFloat64().Histogram("test_Async_Histogram") + assert.NoError(t, err) + + _, err = m.SyncInt64().Counter("test_Async_Counter") + assert.NoError(t, err) + _, err = m.SyncInt64().UpDownCounter("test_Async_UpDownCounter") + assert.NoError(t, err) + _, err = m.SyncInt64().Histogram("test_Async_Histogram") + assert.NoError(t, err) + + return sfcounter, afcounter +} + +// This is to emulate a read from an exporter. +func testCollect(t *testing.T, m metric.Meter) { + if tMeter, ok := m.(*meter); ok { + m, ok = tMeter.delegate.Load().(metric.Meter) + if !ok { + t.Error("meter was not delegated") + return + } + } + tMeter, ok := m.(*testMeter) + if !ok { + t.Error("collect called on non-test Meter") + return + } + tMeter.collect() +} + +func TestMeterProviderDelegatesCalls(t *testing.T) { + + // The global MeterProvider should directly call the underlying MeterProvider + // if it is set prior to Meter() being called. + + // globalMeterProvider := otel.GetMeterProvider + globalMeterProvider := &meterProvider{} + + mp := &testMeterProvider{} + + // otel.SetMeterProvider(mp) + globalMeterProvider.setDelegate(mp) + + assert.Equal(t, 0, mp.count) + + meter := globalMeterProvider.Meter("go.opentelemetry.io/otel/metric/internal/global/meter_test") + + ctr, actr := testSetupAllInstrumentTypes(t, meter) + + ctr.Add(context.Background(), 5) + + testCollect(t, meter) // This is a hacky way to emulate a read from an exporter + + // Calls to Meter() after setDelegate() should be executed by the delegate + require.IsType(t, &testMeter{}, meter) + tMeter := meter.(*testMeter) + assert.Equal(t, 3, tMeter.afCount) + assert.Equal(t, 3, tMeter.aiCount) + assert.Equal(t, 3, tMeter.sfCount) + assert.Equal(t, 3, tMeter.siCount) + assert.Equal(t, 1, len(tMeter.callbacks)) + + // Because the Meter was provided by testmeterProvider it should also return our test instrument + require.IsType(t, &testCountingFloatInstrument{}, ctr, "the meter did not delegate calls to the meter") + assert.Equal(t, 1, ctr.(*testCountingFloatInstrument).count) + + require.IsType(t, &testCountingFloatInstrument{}, actr, "the meter did not delegate calls to the meter") + assert.Equal(t, 1, actr.(*testCountingFloatInstrument).count) + + assert.Equal(t, 1, mp.count) +} + +func TestMeterDelegatesCalls(t *testing.T) { + + // The global MeterProvider should directly provide a Meter instance that + // can be updated. If the SetMeterProvider is called after a Meter was + // obtained, but before instruments only the instrument should be generated + // by the delegated type. + + globalMeterProvider := &meterProvider{} + + mp := &testMeterProvider{} + + assert.Equal(t, 0, mp.count) + + m := globalMeterProvider.Meter("go.opentelemetry.io/otel/metric/internal/global/meter_test") + + globalMeterProvider.setDelegate(mp) + + ctr, actr := testSetupAllInstrumentTypes(t, m) + + ctr.Add(context.Background(), 5) + + testCollect(t, m) // This is a hacky way to emulate a read from an exporter + + // Calls to Meter methods after setDelegate() should be executed by the delegate + require.IsType(t, &meter{}, m) + tMeter := m.(*meter).delegate.Load().(*testMeter) + require.NotNil(t, tMeter) + assert.Equal(t, 3, tMeter.afCount) + assert.Equal(t, 3, tMeter.aiCount) + assert.Equal(t, 3, tMeter.sfCount) + assert.Equal(t, 3, tMeter.siCount) + + // Because the Meter was provided by testmeterProvider it should also return our test instrument + require.IsType(t, &testCountingFloatInstrument{}, ctr, "the meter did not delegate calls to the meter") + assert.Equal(t, 1, ctr.(*testCountingFloatInstrument).count) + + // Because the Meter was provided by testmeterProvider it should also return our test instrument + require.IsType(t, &testCountingFloatInstrument{}, actr, "the meter did not delegate calls to the meter") + assert.Equal(t, 1, actr.(*testCountingFloatInstrument).count) + + assert.Equal(t, 1, mp.count) +} + +func TestMeterDefersDelegations(t *testing.T) { + + // If SetMeterProvider is called after instruments are registered, the + // instruments should be recreated with the new meter. + + // globalMeterProvider := otel.GetMeterProvider + globalMeterProvider := &meterProvider{} + + m := globalMeterProvider.Meter("go.opentelemetry.io/otel/metric/internal/global/meter_test") + + ctr, actr := testSetupAllInstrumentTypes(t, m) + + ctr.Add(context.Background(), 5) + + mp := &testMeterProvider{} + + // otel.SetMeterProvider(mp) + globalMeterProvider.setDelegate(mp) + + testCollect(t, m) // This is a hacky way to emulate a read from an exporter + + // Calls to Meter() before setDelegate() should be the delegated type + require.IsType(t, &meter{}, m) + tMeter := m.(*meter).delegate.Load().(*testMeter) + require.NotNil(t, tMeter) + assert.Equal(t, 3, tMeter.afCount) + assert.Equal(t, 3, tMeter.aiCount) + assert.Equal(t, 3, tMeter.sfCount) + assert.Equal(t, 3, tMeter.siCount) + + // Because the Meter was a delegate it should return a delegated instrument + + assert.IsType(t, &sfCounter{}, ctr) + assert.IsType(t, &afCounter{}, actr) + assert.Equal(t, 1, mp.count) +} diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go new file mode 100644 index 00000000000..acd07de1847 --- /dev/null +++ b/metric/internal/global/meter_types_test.go @@ -0,0 +1,158 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "context" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" +) + +type testMeterProvider struct { + count int +} + +func (p *testMeterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter { + p.count++ + + return &testMeter{} +} + +type testMeter struct { + afCount int + aiCount int + sfCount int + siCount int + + callbacks []func(context.Context) +} + +// AsyncInt64 is the namespace for the Asynchronous Integer instruments. +// +// To Observe data with instruments it must be registered in a callback. +func (m *testMeter) AsyncInt64() asyncint64.InstrumentProvider { + m.aiCount++ + return &testAIInstrumentProvider{} +} + +// AsyncFloat64 is the namespace for the Asynchronous Float instruments +// +// To Observe data with instruments it must be registered in a callback. +func (m *testMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { + m.afCount++ + return &testAFInstrumentProvider{} +} + +// RegisterCallback captures the function that will be called during Collect. +// +// It is only valid to call Observe within the scope of the passed function, +// and only on the instruments that were registered with this call. +func (m *testMeter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { + m.callbacks = append(m.callbacks, function) + return nil +} + +// SyncInt64 is the namespace for the Synchronous Integer instruments +func (m *testMeter) SyncInt64() syncint64.InstrumentProvider { + m.siCount++ + return &testSIInstrumentProvider{} +} + +// SyncFloat64 is the namespace for the Synchronous Float instruments +func (m *testMeter) SyncFloat64() syncfloat64.InstrumentProvider { + m.sfCount++ + return &testSFInstrumentProvider{} +} + +// This enables async collection +func (m *testMeter) collect() { + ctx := context.Background() + for _, f := range m.callbacks { + f(ctx) + } +} + +type testAFInstrumentProvider struct{} + +// Counter creates an instrument for recording increasing values. +func (ip testAFInstrumentProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { + return &testCountingFloatInstrument{}, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip testAFInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + return &testCountingFloatInstrument{}, nil +} + +// Gauge creates an instrument for recording the current value. +func (ip testAFInstrumentProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { + return &testCountingFloatInstrument{}, nil +} + +type testAIInstrumentProvider struct{} + +// Counter creates an instrument for recording increasing values. +func (ip testAIInstrumentProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + return &testCountingIntInstrument{}, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip testAIInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { + return &testCountingIntInstrument{}, nil +} + +// Gauge creates an instrument for recording the current value. +func (ip testAIInstrumentProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { + return &testCountingIntInstrument{}, nil +} + +type testSFInstrumentProvider struct{} + +// Counter creates an instrument for recording increasing values. +func (ip testSFInstrumentProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { + return &testCountingFloatInstrument{}, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip testSFInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { + return &testCountingFloatInstrument{}, nil +} + +// Histogram creates an instrument for recording a distribution of values. +func (ip testSFInstrumentProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { + return &testCountingFloatInstrument{}, nil +} + +type testSIInstrumentProvider struct{} + +// Counter creates an instrument for recording increasing values. +func (ip testSIInstrumentProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { + return &testCountingIntInstrument{}, nil +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (ip testSIInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { + return &testCountingIntInstrument{}, nil +} + +// Histogram creates an instrument for recording a distribution of values. +func (ip testSIInstrumentProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { + return &testCountingIntInstrument{}, nil +} diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go new file mode 100644 index 00000000000..29a67c5dbe4 --- /dev/null +++ b/metric/internal/global/state.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// htmp://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/metric" +) + +var ( + globalMeterProvider = defaultMeterProvider() + + delegateMeterOnce sync.Once +) + +type meterProviderHolder struct { + mp metric.MeterProvider +} + +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + delegateMeterOnce.Do(func() { + current := MeterProvider() + if current == mp { + // Setting the provider to the prior default is nonsense, panic. + // Panic is acceptable because we are likely still early in the + // process lifetime. + panic("invalid MeterProvider, the global instance cannot be reinstalled") + } else if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go new file mode 100644 index 00000000000..69cb9b917d6 --- /dev/null +++ b/metric/internal/global/state_test.go @@ -0,0 +1,68 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// htmp://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "sync" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric/nonrecording" +) + +func resetGlobalMeterProvider() { + globalMeterProvider = defaultMeterProvider() + delegateMeterOnce = sync.Once{} +} + +func TestSetMeterProvider(t *testing.T) { + t.Cleanup(resetGlobalMeterProvider) + + t.Run("Set With default panics", func(t *testing.T) { + resetGlobalMeterProvider() + + assert.Panics(t, func() { + SetMeterProvider(MeterProvider()) + }) + + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + resetGlobalMeterProvider() + + SetMeterProvider(nonrecording.NewNoopMeterProvider()) + + _, ok := MeterProvider().(*meterProvider) + if ok { + t.Error("Global Meter Provider was not changed") + return + } + }) + + t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { + resetGlobalMeterProvider() + + mp := MeterProvider() + + SetMeterProvider(nonrecording.NewNoopMeterProvider()) + + dmp := mp.(*meterProvider) + + if dmp.delegate == nil { + t.Error("The delegated meter providers should have a delegate") + } + }) +} From 07ad32dc388ec09b457fb399cd198ff35ee683ee Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Tue, 22 Mar 2022 12:44:10 -0700 Subject: [PATCH 112/886] Exponential Histogram mapping functions for public use (#2502) * Exponential Histogram mapping functions for public use * pr num * Apply suggestions from code review :+1: Co-authored-by: Anthony Mirabella * mapping interface comments * missed add * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 + sdk/metric/aggregator/exponential/README.md | 27 ++ .../exponential/mapping/exponent/exponent.go | 117 +++++++ .../mapping/exponent/exponent_test.go | 310 ++++++++++++++++++ .../exponential/mapping/exponent/float64.go | 69 ++++ .../mapping/logarithm/logarithm.go | 171 ++++++++++ .../mapping/logarithm/logarithm_test.go | 250 ++++++++++++++ .../aggregator/exponential/mapping/mapping.go | 48 +++ 8 files changed, 996 insertions(+) create mode 100644 sdk/metric/aggregator/exponential/README.md create mode 100644 sdk/metric/aggregator/exponential/mapping/exponent/exponent.go create mode 100644 sdk/metric/aggregator/exponential/mapping/exponent/exponent_test.go create mode 100644 sdk/metric/aggregator/exponential/mapping/exponent/float64.go create mode 100644 sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go create mode 100644 sdk/metric/aggregator/exponential/mapping/logarithm/logarithm_test.go create mode 100644 sdk/metric/aggregator/exponential/mapping/mapping.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c6465e99e34..e4533184470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod ### Added +- Log the Exporters configuration in the TracerProviders message. (#2578) +- Metrics Exponential Histogram support: Mapping functions have been made available + in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take + dependencies on. (#2502) - Add go 1.18 to our compatibility tests. (#2679) - Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) - Add the `metric/global` for obtaining and setting the global `MeterProvider` (#2660) diff --git a/sdk/metric/aggregator/exponential/README.md b/sdk/metric/aggregator/exponential/README.md new file mode 100644 index 00000000000..b58d6aecbb2 --- /dev/null +++ b/sdk/metric/aggregator/exponential/README.md @@ -0,0 +1,27 @@ +# Base-2 Exponential Histogram + +## Design + +This document is a placeholder for future Aggregator, once seen in [PR +2393](https://github.com/open-telemetry/opentelemetry-go/pull/2393). + +Only the mapping functions have been made available at this time. The +equations tested here are specified in the [data model for Exponential +Histogram data points](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponentialhistogram). + +### Mapping function + +There are two mapping functions used, depending on the sign of the +scale. Negative and zero scales use the `mapping/exponent` mapping +function, which computes the bucket index directly from the bits of +the `float64` exponent. This mapping function is used with scale `-10 +<= scale <= 0`. Scales smaller than -10 map the entire normal +`float64` number range into a single bucket, thus are not considered +useful. + +The `mapping/logarithm` mapping function uses `math.Log(value)` times +the scaling factor `math.Ldexp(math.Log2E, scale)`. This mapping +function is used with `0 < scale <= 20`. The maximum scale is +selected because at scale 21, simply, it becomes difficult to test +correctness--at this point `math.MaxFloat64` maps to index +`math.MaxInt32` and the `math/big` logic used in testing breaks down. diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go b/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go new file mode 100644 index 00000000000..93dff7ef007 --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go @@ -0,0 +1,117 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exponent // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" + +import ( + "fmt" + "math" + + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" +) + +const ( + // MinScale defines the point at which the exponential mapping + // function becomes useless for float64. With scale -10, ignoring + // subnormal values, bucket indices range from -1 to 1. + MinScale int32 = -10 + + // MaxScale is the largest scale supported in this code. Use + // ../logarithm for larger scales. + MaxScale int32 = 0 +) + +type exponentMapping struct { + shift uint8 // equals negative scale +} + +// exponentMapping is used for negative scales, effectively a +// mapping of the base-2 logarithm of the exponent. +var prebuiltMappings = [-MinScale + 1]exponentMapping{ + {10}, + {9}, + {8}, + {7}, + {6}, + {5}, + {4}, + {3}, + {2}, + {1}, + {0}, +} + +// NewMapping constructs an exponential mapping function, used for scales <= 0. +func NewMapping(scale int32) (mapping.Mapping, error) { + if scale > MaxScale { + return nil, fmt.Errorf("exponent mapping requires scale <= 0") + } + if scale < MinScale { + return nil, fmt.Errorf("scale too low") + } + return &prebuiltMappings[scale-MinScale], nil +} + +// MapToIndex implements mapping.Mapping. +func (e *exponentMapping) MapToIndex(value float64) int32 { + // Note: we can assume not a 0, Inf, or NaN; positive sign bit. + + // Note: bit-shifting does the right thing for negative + // exponents, e.g., -1 >> 1 == -1. + return getBase2(value) >> e.shift +} + +func (e *exponentMapping) minIndex() int32 { + return int32(MinNormalExponent) >> e.shift +} + +func (e *exponentMapping) maxIndex() int32 { + return int32(MaxNormalExponent) >> e.shift +} + +// LowerBoundary implements mapping.Mapping. +func (e *exponentMapping) LowerBoundary(index int32) (float64, error) { + if min := e.minIndex(); index < min { + return 0, mapping.ErrUnderflow + } + + if max := e.maxIndex(); index > max { + return 0, mapping.ErrOverflow + } + + unbiased := int64(index << e.shift) + + // Note: although the mapping function rounds subnormal values + // up to the smallest normal value, there are still buckets + // that may be filled that start at subnormal values. The + // following code handles this correctly. It's equivalent to and + // faster than math.Ldexp(1, int(unbiased)). + if unbiased < int64(MinNormalExponent) { + subnormal := uint64(1 << SignificandWidth) + for unbiased < int64(MinNormalExponent) { + unbiased++ + subnormal >>= 1 + } + return math.Float64frombits(subnormal), nil + } + exponent := unbiased + ExponentBias + + bits := uint64(exponent << SignificandWidth) + return math.Float64frombits(bits), nil +} + +// Scale implements mapping.Mapping. +func (e *exponentMapping) Scale() int32 { + return -int32(e.shift) +} diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/exponent_test.go b/sdk/metric/aggregator/exponential/mapping/exponent/exponent_test.go new file mode 100644 index 00000000000..0258aaf8dc6 --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/exponent/exponent_test.go @@ -0,0 +1,310 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exponent + +import ( + "fmt" + "math" + "math/big" + "testing" + + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" +) + +type expectMapping struct { + value float64 + index int32 +} + +// Tests that getBase2 returns the base-2 exponent as documented, unlike +// math.Frexp. +func TestGetBase2(t *testing.T) { + require.Equal(t, int32(-1022), MinNormalExponent) + require.Equal(t, int32(+1023), MaxNormalExponent) + + require.Equal(t, MaxNormalExponent, getBase2(0x1p+1023)) + require.Equal(t, int32(1022), getBase2(0x1p+1022)) + + require.Equal(t, int32(0), getBase2(1)) + + require.Equal(t, int32(-1021), getBase2(0x1p-1021)) + require.Equal(t, int32(-1022), getBase2(0x1p-1022)) + + // Subnormals below this point + require.Equal(t, int32(-1022), getBase2(0x1p-1023)) + require.Equal(t, int32(-1022), getBase2(0x1p-1024)) + require.Equal(t, int32(-1022), getBase2(0x1p-1025)) + require.Equal(t, int32(-1022), getBase2(0x1p-1074)) +} + +// Tests a few cases with scale=0. +func TestExponentMappingZero(t *testing.T) { + m, err := NewMapping(0) + require.NoError(t, err) + + require.Equal(t, int32(0), m.Scale()) + + for _, pair := range []expectMapping{ + {math.MaxFloat64, MaxNormalExponent}, + {0x1p+1023, MaxNormalExponent}, + {0x1p-1022, MinNormalExponent}, + {math.SmallestNonzeroFloat64, MinNormalExponent}, + {4, 2}, + {3, 1}, + {2, 1}, + {1.5, 0}, + {1, 0}, + {0.75, -1}, + {0.5, -1}, + {0.25, -2}, + } { + idx := m.MapToIndex(pair.value) + + require.Equal(t, pair.index, idx) + } +} + +// Tests a few cases with scale=MinScale. +func TestExponentMappingMinScale(t *testing.T) { + m, err := NewMapping(MinScale) + require.NoError(t, err) + + require.Equal(t, MinScale, m.Scale()) + + for _, pair := range []expectMapping{ + {1, 0}, + {math.MaxFloat64 / 2, 0}, + {math.MaxFloat64, 0}, + {math.SmallestNonzeroFloat64, -1}, + {0.5, -1}, + } { + t.Run(fmt.Sprint(pair.value), func(t *testing.T) { + idx := m.MapToIndex(pair.value) + + require.Equal(t, pair.index, idx) + }) + } +} + +// Tests invalid scales. +func TestInvalidScale(t *testing.T) { + m, err := NewMapping(1) + require.Error(t, err) + require.Nil(t, m) + + m, err = NewMapping(MinScale - 1) + require.Error(t, err) + require.Nil(t, m) +} + +// Tests a few cases with scale=-1. +func TestExponentMappingNegOne(t *testing.T) { + m, _ := NewMapping(-1) + + for _, pair := range []expectMapping{ + {16, 2}, + {15, 1}, + {9, 1}, + {8, 1}, + {5, 1}, + {4, 1}, + {3, 0}, + {2, 0}, + {1.5, 0}, + {1, 0}, + {0.75, -1}, + {0.5, -1}, + {0.25, -1}, + {0.20, -2}, + {0.13, -2}, + {0.125, -2}, + {0.10, -2}, + {0.0625, -2}, + {0.06, -3}, + } { + idx := m.MapToIndex(pair.value) + require.Equal(t, pair.index, idx, "value: %v", pair.value) + } +} + +// Tests a few cases with scale=-4. +func TestExponentMappingNegFour(t *testing.T) { + m, err := NewMapping(-4) + require.NoError(t, err) + require.Equal(t, int32(-4), m.Scale()) + + for _, pair := range []expectMapping{ + {float64(0x1), 0}, + {float64(0x10), 0}, + {float64(0x100), 0}, + {float64(0x1000), 0}, + {float64(0x10000), 1}, // Base == 2**16 + {float64(0x100000), 1}, + {float64(0x1000000), 1}, + {float64(0x10000000), 1}, + {float64(0x100000000), 2}, // == 2**32 + {float64(0x1000000000), 2}, + {float64(0x10000000000), 2}, + {float64(0x100000000000), 2}, + {float64(0x1000000000000), 3}, // 2**48 + {float64(0x10000000000000), 3}, + {float64(0x100000000000000), 3}, + {float64(0x1000000000000000), 3}, + {float64(0x10000000000000000), 4}, // 2**64 + {float64(0x100000000000000000), 4}, + {float64(0x1000000000000000000), 4}, + {float64(0x10000000000000000000), 4}, + {float64(0x100000000000000000000), 5}, + + {1 / float64(0x1), 0}, + {1 / float64(0x10), -1}, + {1 / float64(0x100), -1}, + {1 / float64(0x1000), -1}, + {1 / float64(0x10000), -1}, // 2**-16 + {1 / float64(0x100000), -2}, + {1 / float64(0x1000000), -2}, + {1 / float64(0x10000000), -2}, + {1 / float64(0x100000000), -2}, // 2**-32 + {1 / float64(0x1000000000), -3}, + {1 / float64(0x10000000000), -3}, + {1 / float64(0x100000000000), -3}, + {1 / float64(0x1000000000000), -3}, // 2**-48 + {1 / float64(0x10000000000000), -4}, + {1 / float64(0x100000000000000), -4}, + {1 / float64(0x1000000000000000), -4}, + {1 / float64(0x10000000000000000), -4}, // 2**-64 + {1 / float64(0x100000000000000000), -5}, + + // Max values + {0x1.FFFFFFFFFFFFFp1023, 63}, + {0x1p1023, 63}, + {0x1p1019, 63}, + {0x1p1008, 63}, + {0x1p1007, 62}, + {0x1p1000, 62}, + {0x1p0992, 62}, + {0x1p0991, 61}, + + // Min and subnormal values + {0x1p-1074, -64}, + {0x1p-1073, -64}, + {0x1p-1072, -64}, + {0x1p-1057, -64}, + {0x1p-1056, -64}, + {0x1p-1041, -64}, + {0x1p-1040, -64}, + {0x1p-1025, -64}, + {0x1p-1024, -64}, + {0x1p-1023, -64}, + {0x1p-1022, -64}, + {0x1p-1009, -64}, + {0x1p-1008, -63}, + {0x1p-0993, -63}, + {0x1p-0992, -62}, + {0x1p-0977, -62}, + {0x1p-0976, -61}, + } { + t.Run(fmt.Sprintf("%x", pair.value), func(t *testing.T) { + index := m.MapToIndex(pair.value) + + require.Equal(t, pair.index, index, "value: %#x", pair.value) + }) + } +} + +// roundedBoundary computes the correct boundary rounded to a float64 +// using math/big. Note that this function uses a Square() where the +// one in ../logarithm uses a SquareRoot(). +func roundedBoundary(scale, index int32) float64 { + one := big.NewFloat(1) + f := (&big.Float{}).SetMantExp(one, int(index)) + for i := scale; i < 0; i++ { + f = (&big.Float{}).Mul(f, f) + } + + result, _ := f.Float64() + return result +} + +// TestExponentIndexMax ensures that for every valid scale, MaxFloat +// maps into the correct maximum index. Also tests that the reverse +// lookup does not produce infinity and the following index produces +// an overflow error. +func TestExponentIndexMax(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + index := m.MapToIndex(MaxValue) + + // Correct max index is one less than the first index + // that overflows math.MaxFloat64, i.e., one less than + // the index of +Inf. + maxIndex := (int32(MaxNormalExponent+1) >> -scale) - 1 + require.Equal(t, index, int32(maxIndex)) + + // The index maps to a finite boundary. + bound, err := m.LowerBoundary(index) + require.NoError(t, err) + + require.Equal(t, bound, roundedBoundary(scale, maxIndex)) + + // One larger index will overflow. + _, err = m.LowerBoundary(index + 1) + require.Equal(t, err, mapping.ErrOverflow) + } +} + +// TestExponentIndexMin ensures that for every valid scale, the +// smallest normal number and all smaller numbers map to the correct +// index, which is that of the smallest normal number. +// +// Tests that the lower boundary of the smallest bucket is correct, +// even when that number is subnormal. +func TestExponentIndexMin(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + minIndex := m.MapToIndex(MinValue) + + boundary, err := m.LowerBoundary(minIndex) + require.NoError(t, err) + + correctMinIndex := int64(MinNormalExponent) >> -scale + require.Greater(t, correctMinIndex, int64(math.MinInt32)) + require.Equal(t, int32(correctMinIndex), minIndex) + + correctBoundary := roundedBoundary(scale, int32(correctMinIndex)) + + require.Equal(t, correctBoundary, boundary) + require.Greater(t, roundedBoundary(scale, int32(correctMinIndex+1)), boundary) + + // Subnormal values map to the min index: + require.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex)) + + // One smaller index will underflow. + _, err = m.LowerBoundary(minIndex - 1) + require.Equal(t, err, mapping.ErrUnderflow) + } +} diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go new file mode 100644 index 00000000000..6deb81192de --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exponent // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" + +import "math" + +const ( + // SignificandWidth is the size of an IEEE 754 double-precision + // floating-point significand. + SignificandWidth = 52 + // ExponentWidth is the size of an IEEE 754 double-precision + // floating-point exponent. + ExponentWidth = 11 + + // SignificandMask is the mask for the significand of an IEEE 754 + // double-precision floating-point value: 0xFFFFFFFFFFFFF. + SignificandMask = 1<> SignificandWidth + return int32(rawExponent - ExponentBias) +} diff --git a/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go b/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go new file mode 100644 index 00000000000..223c93d16a9 --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go @@ -0,0 +1,171 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package logarithm // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/logarithm" + +import ( + "fmt" + "math" + "sync" + + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" +) + +const ( + // MinScale ensures that the ../exponent mapper is used for + // zero and negative scale values. Do not use the logarithm + // mapper for scales <= 0. + MinScale int32 = 1 + + // MaxScale is selected as the largest scale that is possible + // in current code, considering there are 10 bits of base-2 + // exponent combined with scale-bits of range. At this scale, + // the growth factor is 0.0000661%. + // + // Scales larger than 20 complicate the logic in cmd/prebuild, + // because math/big overflows when exponent is math.MaxInt32 + // (== the index of math.MaxFloat64 at scale=21), + // + // At scale=20, index values are in the interval [-0x3fe00000, + // 0x3fffffff], having 31 bits of information. This is + // sensible given that the OTLP exponential histogram data + // point uses a signed 32 bit integer for indices. + MaxScale int32 = 20 + + // MaxValue is the largest normal number. + MaxValue = math.MaxFloat64 + + // MinValue is the smallest normal number. + MinValue = 0x1p-1022 +) + +// logarithmMapping contains the constants used to implement the +// exponential mapping function for a particular scale > 0. Note that +// these structs are compiled in using code generated by the +// ./cmd/prebuild package, this way no allocations are required as the +// aggregators switch between mapping functions and the two mapping +// functions are kept separate. +// +// Note that some of these fields could be calculated easily at +// runtime, but they are compiled in to avoid those operations at +// runtime (e.g., calls to math.Ldexp(math.Log2E, scale) for every +// measurement). +type logarithmMapping struct { + // scale is between MinScale and MaxScale + scale int32 + + // minIndex is the index of MinValue + minIndex int32 + // maxIndex is the index of MaxValue + maxIndex int32 + + // scaleFactor is used and computed as follows: + // index = log(value) / log(base) + // = log(value) / log(2^(2^-scale)) + // = log(value) / (2^-scale * log(2)) + // = log(value) * (1/log(2) * 2^scale) + // = log(value) * scaleFactor + // where: + // scaleFactor = (1/log(2) * 2^scale) + // = math.Log2E * math.Exp2(scale) + // = math.Ldexp(math.Log2E, scale) + // Because multiplication is faster than division, we define scaleFactor as a multiplier. + // This implementation was copied from a Java prototype. See: + // https://github.com/newrelic-experimental/newrelic-sketch-java/blob/1ce245713603d61ba3a4510f6df930a5479cd3f6/src/main/java/com/newrelic/nrsketch/indexer/LogIndexer.java + // for the equations used here. + scaleFactor float64 + + // log(boundary) = index * log(base) + // log(boundary) = index * log(2^(2^-scale)) + // log(boundary) = index * 2^-scale * log(2) + // boundary = exp(index * inverseFactor) + // where: + // inverseFactor = 2^-scale * log(2) + // = math.Ldexp(math.Ln2, -scale) + inverseFactor float64 +} + +var ( + _ mapping.Mapping = &logarithmMapping{} + + prebuiltMappingsLock sync.Mutex + prebuiltMappings = map[int32]*logarithmMapping{} +) + +// NewMapping constructs a logarithm mapping function, used for scales > 0. +func NewMapping(scale int32) (mapping.Mapping, error) { + // An assumption used in this code is that scale is > 0. If + // scale is <= 0 it's better to use the exponent mapping. + if scale < MinScale || scale > MaxScale { + // scale 20 can represent the entire float64 range + // with a 30 bit index, and we don't handle larger + // scales to simplify range tests in this package. + return nil, fmt.Errorf("scale out of bounds") + } + prebuiltMappingsLock.Lock() + defer prebuiltMappingsLock.Unlock() + + if p := prebuiltMappings[scale]; p != nil { + return p, nil + } + l := &logarithmMapping{ + scale: scale, + maxIndex: int32((int64(exponent.MaxNormalExponent+1) << scale) - 1), + minIndex: int32(int64(exponent.MinNormalExponent) << scale), + scaleFactor: math.Ldexp(math.Log2E, int(scale)), + inverseFactor: math.Ldexp(math.Ln2, int(-scale)), + } + prebuiltMappings[scale] = l + return l, nil +} + +// MapToIndex implements mapping.Mapping. +func (l *logarithmMapping) MapToIndex(value float64) int32 { + // Note: we can assume not a 0, Inf, or NaN; positive sign bit. + if value <= MinValue { + return l.minIndex + } + // Use Floor() to round toward 0. + index := int32(math.Floor(math.Log(value) * l.scaleFactor)) + + if index > l.maxIndex { + return l.maxIndex + } + return index +} + +// LowerBoundary implements mapping.Mapping. +func (l *logarithmMapping) LowerBoundary(index int32) (float64, error) { + if index >= l.maxIndex { + if index == l.maxIndex { + // Note that the equation on the last line of this + // function returns +Inf. Use the alternate equation. + return 2 * math.Exp(float64(index-(int32(1)< 0; i-- { + f = (&big.Float{}).Sqrt(f) + } + + result, _ := f.Float64() + return result +} + +// TestLogarithmIndexMax ensures that for every valid scale, MaxFloat +// maps into the correct maximum index. Also tests that the reverse +// lookup does not produce infinity and the following index produces +// an overflow error. +func TestLogarithmIndexMax(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + index := m.MapToIndex(MaxValue) + + // Correct max index is one less than the first index + // that overflows math.MaxFloat64, i.e., one less than + // the index of +Inf. + maxIndex64 := (int64(exponent.MaxNormalExponent+1) << scale) - 1 + require.Less(t, maxIndex64, int64(math.MaxInt32)) + require.Equal(t, index, int32(maxIndex64)) + + // The index maps to a finite boundary near MaxFloat. + bound, err := m.LowerBoundary(index) + require.NoError(t, err) + + base, _ := m.LowerBoundary(1) + + require.Less(t, bound, MaxValue) + + // The expected ratio equals the base factor. + require.InEpsilon(t, (MaxValue-bound)/bound, base-1, 1e-6) + + // One larger index will overflow. + _, err = m.LowerBoundary(index + 1) + require.Equal(t, err, mapping.ErrOverflow) + } +} + +// TestLogarithmIndexMin ensures that for every valid scale, Non-zero numbers +func TestLogarithmIndexMin(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + minIndex := m.MapToIndex(MinValue) + + mapped, err := m.LowerBoundary(minIndex) + require.NoError(t, err) + + correctMinIndex := int64(exponent.MinNormalExponent) << scale + require.Greater(t, correctMinIndex, int64(math.MinInt32)) + + correctMapped := roundedBoundary(scale, int32(correctMinIndex)) + require.Equal(t, correctMapped, MinValue) + require.InEpsilon(t, mapped, MinValue, 1e-6) + + require.Equal(t, minIndex, int32(correctMinIndex)) + + // Subnormal values map to the min index: + require.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex)) + + // One smaller index will underflow. + _, err = m.LowerBoundary(minIndex - 1) + require.Equal(t, err, mapping.ErrUnderflow) + } +} + +// TestExponentIndexMax ensures that for every valid scale, MaxFloat +// maps into the correct maximum index. Also tests that the reverse +// lookup does not produce infinity and the following index produces +// an overflow error. +func TestExponentIndexMax(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + index := m.MapToIndex(MaxValue) + + // Correct max index is one less than the first index + // that overflows math.MaxFloat64, i.e., one less than + // the index of +Inf. + maxIndex64 := (int64(exponent.MaxNormalExponent+1) << scale) - 1 + require.Less(t, maxIndex64, int64(math.MaxInt32)) + require.Equal(t, index, int32(maxIndex64)) + + // The index maps to a finite boundary near MaxFloat. + bound, err := m.LowerBoundary(index) + require.NoError(t, err) + + base, _ := m.LowerBoundary(1) + + require.Less(t, bound, MaxValue) + + // The expected ratio equals the base factor. + require.InEpsilon(t, (MaxValue-bound)/bound, base-1, 1e-6) + + // One larger index will overflow. + _, err = m.LowerBoundary(index + 1) + require.Equal(t, err, mapping.ErrOverflow) + } +} + +// TestExponentIndexMin ensures that for every valid scale, the +// smallest normal number and all smaller numbers map to the correct +// index, which is that of the smallest normal number. +func TestExponentIndexMin(t *testing.T) { + for scale := MinScale; scale <= MaxScale; scale++ { + m, err := NewMapping(scale) + require.NoError(t, err) + + minIndex := m.MapToIndex(MinValue) + + mapped, err := m.LowerBoundary(minIndex) + require.NoError(t, err) + + correctMinIndex := int64(exponent.MinNormalExponent) << scale + require.Greater(t, correctMinIndex, int64(math.MinInt32)) + + correctMapped := roundedBoundary(scale, int32(correctMinIndex)) + require.Equal(t, correctMapped, MinValue) + require.InEpsilon(t, mapped, MinValue, 1e-6) + + require.Equal(t, minIndex, int32(correctMinIndex)) + + // Subnormal values map to the min index: + require.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex)) + require.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex)) + + // One smaller index will underflow. + _, err = m.LowerBoundary(minIndex - 1) + require.Equal(t, err, mapping.ErrUnderflow) + } +} diff --git a/sdk/metric/aggregator/exponential/mapping/mapping.go b/sdk/metric/aggregator/exponential/mapping/mapping.go new file mode 100644 index 00000000000..19bf9df72d1 --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/mapping.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mapping // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" + +import "fmt" + +// Mapping is the interface of an exponential histogram mapper. +type Mapping interface { + // MapToIndex maps positive floating point values to indexes + // corresponding to Scale(). Implementations are not expected + // to handle zeros, +Inf, NaN, or negative values. + MapToIndex(value float64) int32 + + // LowerBoundary returns the lower boundary of a given bucket + // index. The index is expected to map onto a range that is + // at least partially inside the range of normalized floating + // point values. If the corresponding bucket's upper boundary + // is less than or equal to 0x1p-1022, ErrUnderflow will be + // returned. If the corresponding bucket's lower boundary is + // greater than math.MaxFloat64, ErrOverflow will be returned. + LowerBoundary(index int32) (float64, error) + + // Scale returns the parameter that controls the resolution of + // this mapping. For details see: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponential-scale + Scale() int32 +} + +var ( + // ErrUnderflow is returned when computing the lower boundary + // of an index that maps into a denormalized floating point value. + ErrUnderflow = fmt.Errorf("underflow") + // ErrOverflow is returned when computing the lower boundary + // of an index that maps into +Inf. + ErrOverflow = fmt.Errorf("overflow") +) From 3dac50a968d6192cc02e8c0e800483ebb40368af Mon Sep 17 00:00:00 2001 From: Jacob953 <710297349@qq.com> Date: Thu, 24 Mar 2022 03:26:13 +0800 Subject: [PATCH 113/886] test: --20220112 fix histogram instrument unit test (#2507) Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- exporters/otlp/otlpmetric/exporter_test.go | 56 ++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index b8ba3dce95e..2517d91d201 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -225,9 +225,9 @@ func TestNoGroupingExport(t *testing.T) { ) } -func TestHistogramMetricGroupingExport(t *testing.T) { +func TestHistogramInt64MetricGroupingExport(t *testing.T) { r := record( - "histogram", + "int64-histogram", sdkapi.HistogramInstrumentKind, number.Int64Kind, append(baseKeyValues, cpuKey.Int(1)), @@ -240,7 +240,7 @@ func TestHistogramMetricGroupingExport(t *testing.T) { { Metrics: []*metricpb.Metric{ { - Name: "histogram", + Name: "int64-histogram", Data: &metricpb.Metric_Histogram{ Histogram: &metricpb.Histogram{ AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, @@ -275,6 +275,56 @@ func TestHistogramMetricGroupingExport(t *testing.T) { runMetricExportTests(t, nil, resource.Empty(), []testRecord{r, r}, expected) } +func TestHistogramFloat64MetricGroupingExport(t *testing.T) { + r := record( + "float64-histogram", + sdkapi.HistogramInstrumentKind, + number.Float64Kind, + append(baseKeyValues, cpuKey.Int(1)), + testLibName, + ) + expected := []*metricpb.ResourceMetrics{ + { + Resource: nil, + InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + { + Metrics: []*metricpb.Metric{ + { + Name: "float64-histogram", + Data: &metricpb.Metric_Histogram{ + Histogram: &metricpb.Histogram{ + AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + DataPoints: []*metricpb.HistogramDataPoint{ + { + Attributes: cpu1Labels, + StartTimeUnixNano: startTime(), + TimeUnixNano: pointTime(), + Count: 2, + Sum: 11.0, + ExplicitBounds: testHistogramBoundaries, + BucketCounts: []uint64{1, 0, 0, 1}, + }, + { + Attributes: cpu1Labels, + Count: 2, + Sum: 11.0, + ExplicitBounds: testHistogramBoundaries, + BucketCounts: []uint64{1, 0, 0, 1}, + StartTimeUnixNano: startTime(), + TimeUnixNano: pointTime(), + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + runMetricExportTests(t, nil, resource.Empty(), []testRecord{r, r}, expected) +} + func TestCountInt64MetricGroupingExport(t *testing.T) { r := record( "int64-count", From 17667f5eef540dc84c67447912028b27152692f9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 23 Mar 2022 14:24:14 -0700 Subject: [PATCH 114/886] Release v1.6.0/v0.28.0 (#2718) * Update versions.yaml * Bump version in changelog * Prepare stable-v1 for version v1.6.0 * Prepare experimental-metrics for version v0.28.0 * Prepare bridge for version v0.28.0 * Update changelog language --- CHANGELOG.md | 25 +++++++++++++------ bridge/opencensus/go.mod | 10 ++++---- bridge/opencensus/test/go.mod | 8 +++--- bridge/opentracing/go.mod | 4 +-- example/fib/go.mod | 8 +++--- example/jaeger/go.mod | 6 ++--- example/namedtracer/go.mod | 8 +++--- example/opencensus/go.mod | 12 ++++----- example/otel-collector/go.mod | 8 +++--- example/passthrough/go.mod | 8 +++--- example/prometheus/go.mod | 8 +++--- example/zipkin/go.mod | 8 +++--- exporters/jaeger/go.mod | 6 ++--- exporters/otlp/otlpmetric/go.mod | 10 ++++---- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++++----- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 6 ++--- exporters/otlp/otlptrace/go.mod | 8 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 +++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++++---- exporters/prometheus/go.mod | 8 +++--- exporters/stdout/stdoutmetric/go.mod | 8 +++--- exporters/stdout/stdouttrace/go.mod | 6 ++--- exporters/zipkin/go.mod | 6 ++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/export/metric/go.mod | 4 +-- sdk/go.mod | 4 +-- sdk/metric/go.mod | 6 ++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 6 ++--- 31 files changed, 119 insertions(+), 110 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4533184470..0ce2a90cf91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.6.0/0.28.0] - 2022-03-23 + ### ⚠️ Notice ⚠️ This update is a breaking change of the unstable Metrics API. @@ -15,17 +17,23 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod ### Added -- Log the Exporters configuration in the TracerProviders message. (#2578) -- Metrics Exponential Histogram support: Mapping functions have been made available - in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take - dependencies on. (#2502) -- Add go 1.18 to our compatibility tests. (#2679) +- Add metrics exponential histogram support. + New mapping functions have been made available in `sdk/metric/aggregator/exponential/mapping` for other OpenTelemetry projects to take dependencies on. (#2502) +- Add Go 1.18 to our compatibility tests. (#2679) - Allow configuring the Sampler with the `OTEL_TRACES_SAMPLER` and `OTEL_TRACES_SAMPLER_ARG` environment variables. (#2305, #2517) -- Add the `metric/global` for obtaining and setting the global `MeterProvider` (#2660) +- Add the `metric/global` for obtaining and setting the global `MeterProvider`. (#2660) ### Changed -- The metrics API has been significantly changed. (#2587) +- The metrics API has been significantly changed to match the revised OpenTelemetry specification. + High-level changes include: + + - Synchronous and asynchronous instruments are now handled by independent `InstrumentProvider`s. + These `InstrumentProvider`s are manged a `Meter`. + - Synchronous and asynchronous instruments are grouped into their own packages based on value types. + - Asynchronous callbacks can now be registered with a `Meter`. + + Be sure to check out the metric module documentation for more information on how to use the revised API. (#2587, #2660) ### Fixed @@ -1760,7 +1768,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.5.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.0...HEAD +[1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 [1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 [1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 [1.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index dce769c4a7c..a63b24784df 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index bbd8c7df52c..3b180bdeb36 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/bridge/opencensus v0.27.1 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/bridge/opencensus v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 446fd94bbd1..be4871754ef 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index a76f072c296..617b6a5bb75 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 06e6cdef268..7a77c37cdbd 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/jaeger v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/jaeger v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 0efbd773dbc..eb713699d54 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index d4073d2aabe..586843102ca 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,12 +10,12 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/bridge/opencensus v0.27.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/bridge/opencensus v0.28.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index ca6a4b4aefe..957a5efff34 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 google.golang.org/grpc v1.45.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 50b16bda87f..ec53ef984e9 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 21d620dbce1..d8200474d63 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/prometheus v0.27.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/prometheus v0.28.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index fc2a8a0bdf9..907d62c0fe9 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/zipkin v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/zipkin v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index ac956110f1e..cd37734c203 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index fb9e63ab831..be75c66dff6 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 8449a1cb4a9..2752e46c89f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,12 +4,12 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 65359ee8bf1..51720a02d9b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 4754211d0ef..4b329ee92a2 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bcb789a4da7..2393c9e022d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/proto/otlp v0.12.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 92f98e0e789..f38b28b704a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.5.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 go.opentelemetry.io/proto/otlp v0.12.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 7d08f50325d..700c35dadd3 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index babf8838612..bc09715fd00 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 31d458c9630..c158e33d58e 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 917d0eab385..a11a0efbcbe 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index c7de5095b18..6b238c8749a 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index 9714c1150a6..b561560bc97 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel v1.6.0 ) replace go.opentelemetry.io/otel => ../ diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index 9752e1e771a..aa2e6a7952a 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -40,8 +40,8 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough diff --git a/sdk/go.mod b/sdk/go.mod index 019a61e12ba..fd9f349a974 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index ef2922af43c..52656af7bc8 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 050a05e3d83..e9346b27464 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 + go.opentelemetry.io/otel v1.6.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index 92d9fda8ff4..bfcd5a0e493 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.5.0" + return "1.6.0" } diff --git a/versions.yaml b/versions.yaml index 15b35e14fe1..2ed0030ea5a 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.5.0 + version: v1.6.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.27.0 + version: v0.28.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -50,7 +50,7 @@ module-sets: modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.27.1 + version: v0.28.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 4399e2202ce10e245c8ab5340785b296e8fcd0ed Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Wed, 23 Mar 2022 15:37:46 -0700 Subject: [PATCH 115/886] Update CHANGELOG.md (#2721) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce2a90cf91..3dc9db7ca1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod High-level changes include: - Synchronous and asynchronous instruments are now handled by independent `InstrumentProvider`s. - These `InstrumentProvider`s are manged a `Meter`. + These `InstrumentProvider`s are managed with a `Meter`. - Synchronous and asynchronous instruments are grouped into their own packages based on value types. - Asynchronous callbacks can now be registered with a `Meter`. From 70a54468ae56f4064d8afc75273c6a52b4a7c778 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 24 Mar 2022 15:57:14 -0700 Subject: [PATCH 116/886] Apply fix from #2674 to all applicable lines (#2719) --- exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index 3496b17cccd..9bfafcf85fe 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -256,6 +256,7 @@ func TestConfigs(t *testing.T) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. assert.Equal(t, 1, len(c.Metrics.TLSCfg.RootCAs.Subjects())) } }, From 0024f7c0329783dacc0dfe40c42ab234ac81c913 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Fri, 25 Mar 2022 17:49:48 +0000 Subject: [PATCH 117/886] Fix link to the Go otel package (#2726) Signed-off-by: Martin Hickey --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3eee84a671f..e7e0749748d 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ libraries](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/ If you need to extend the telemetry an instrumentation library provides or want to build your own instrumentation for your application directly you will need to use the -[go.opentelemetry.io/otel/api](https://pkg.go.dev/go.opentelemetry.io/otel/api) +[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel) package. The included [examples](./example/) are a good way to see some practical uses of this process. From 7a1ebf7f28c82c8cb64cdd8fe4b98e8c2fec0c39 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 26 Mar 2022 17:30:52 -0700 Subject: [PATCH 118/886] Upgrade go.opentelemetry.io/proto/otlp v0.12.0 -> v0.12.1 (#2728) * Upgrade go.opentelemetry.io/proto/otlp v0.12.0 -> v0.12.1 Fix #2724 * Update changelog --- CHANGELOG.md | 5 + example/otel-collector/go.sum | 283 +++++++++++++++- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 308 +++++++++++++++++- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 308 +++++++++++++++++- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 308 +++++++++++++++++- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 308 +++++++++++++++++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 285 +++++++++++++++- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 308 +++++++++++++++++- 14 files changed, 2070 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dc9db7ca1b..8f9f190d1c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Security + +- Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. + This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #TBD) + ## [1.6.0/0.28.0] - 2022-03-23 ### ⚠️ Notice ⚠️ diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 7a3e7b70a74..503be9bf3a6 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -1,15 +1,53 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -19,19 +57,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -43,17 +99,42 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -61,25 +142,63 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -87,56 +206,200 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -147,6 +410,7 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= @@ -154,9 +418,18 @@ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+Rur google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index be75c66dff6..9edca2d4b5a 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/proto/otlp v0.12.0 + go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 8115e273a2b..165932b0a00 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -1,17 +1,55 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -21,19 +59,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -45,78 +101,303 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -127,16 +408,27 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2752e46c89f..0292fabf164 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/proto/otlp v0.12.0 - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 + go.opentelemetry.io/proto/otlp v0.12.1 + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 8115e273a2b..165932b0a00 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -1,17 +1,55 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -21,19 +59,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -45,78 +101,303 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -127,16 +408,27 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 51720a02d9b..3f1f542dbdc 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/proto/otlp v0.12.0 + go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 8115e273a2b..165932b0a00 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -1,17 +1,55 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -21,19 +59,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -45,78 +101,303 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -127,16 +408,27 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 4b329ee92a2..e6583f3c550 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/otel/trace v1.6.0 - go.opentelemetry.io/proto/otlp v0.12.0 + go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 52075ac7cec..60790292bd3 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -1,15 +1,53 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -19,19 +57,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -43,78 +99,303 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -125,16 +406,27 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 2393c9e022d..17be1649ac8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,9 +8,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/proto/otlp v0.12.0 + go.opentelemetry.io/proto/otlp v0.12.1 go.uber.org/goleak v1.1.12 - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 1d81ffaf09a..bfc46725a4b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -1,15 +1,53 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -19,19 +57,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -43,17 +99,42 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -63,26 +144,64 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -90,36 +209,124 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -127,20 +334,76 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -151,6 +414,7 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= @@ -159,9 +423,18 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f38b28b704a..976b9f09178 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/otel/trace v1.6.0 - go.opentelemetry.io/proto/otlp v0.12.0 + go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/protobuf v1.27.1 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 52075ac7cec..60790292bd3 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -1,15 +1,53 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -19,19 +57,37 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -43,78 +99,303 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.0 h1:CMJ/3Wp7iOWES+CYLfnBv+DVmPbB+kmy9PJ92XvlR6c= -go.opentelemetry.io/proto/otlp v0.12.0/go.mod h1:TsIjwGWIx5VFYv9KGVlOpxoBl5Dy+63SUguV7GGvlSQ= +go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= +go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -125,16 +406,27 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 0a7cf5abf177a7384b5ec6eecfd7091439a5ccd0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 28 Mar 2022 07:35:09 -0700 Subject: [PATCH 119/886] Document Resource options that potentially leak secrets (#2727) The WithProcess and WithProcessCommandArgs options contain command line arguments as resource attributes. These could potentially expose user secrets. Document this fact so users better understand the implications of using these options. --- sdk/resource/config.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sdk/resource/config.go b/sdk/resource/config.go index 09f30d57127..8e212b12182 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -110,7 +110,16 @@ func WithOSDescription() Option { } // WithProcess adds all the Process attributes to the configured Resource. -// See individual WithProcess* functions to configure specific attributes. +// +// Warning! This option will include process command line arguments. If these +// contain sensitive information it will be included in the exported resource. +// +// This option is equivalent to calling WithProcessPID, +// WithProcessExecutableName, WithProcessExecutablePath, +// WithProcessCommandArgs, WithProcessOwner, WithProcessRuntimeName, +// WithProcessRuntimeVersion, and WithProcessRuntimeDescription. See each +// option function for information about what resource attributes each +// includes. func WithProcess() Option { return WithDetectors( processPIDDetector{}, @@ -143,7 +152,11 @@ func WithProcessExecutablePath() Option { } // WithProcessCommandArgs adds an attribute with all the command arguments (including -// the command/executable itself) as received by the process the configured Resource. +// the command/executable itself) as received by the process to the configured +// Resource. +// +// Warning! This option will include process command line arguments. If these +// contain sensitive information it will be included in the exported resource. func WithProcessCommandArgs() Option { return WithDetectors(processCommandArgsDetector{}) } From 465653d80e397dc1b4a4134391dd0d9ccd8d6673 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:47:38 -0700 Subject: [PATCH 120/886] Bump github.com/golangci/golangci-lint from 1.45.0 to 1.45.2 in /internal/tools (#2729) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.45.0 to 1.45.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.45.0...v1.45.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 78aee63e85e..3419bf5fc65 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.45.0 + github.com/golangci/golangci-lint v1.45.2 github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 5f1e09c9329..239876bd63c 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -118,8 +118,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.6.0 h1:TOIDk9qRIMspALZKX8x+5hQfAjuvAFogppnxtvuNmBo= -github.com/blizzy78/varnamelen v0.6.0/go.mod h1:zy2Eic4qWqjrxa60jG34cfL0VXcSwzUrIx68eJPb4Q8= +github.com/blizzy78/varnamelen v0.6.1 h1:kttPCLzXFa+0nt++Cw9fb7GrSSM4KkyIAoX/vXsbuqA= +github.com/blizzy78/varnamelen v0.6.1/go.mod h1:zy2Eic4qWqjrxa60jG34cfL0VXcSwzUrIx68eJPb4Q8= github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/breml/bidichk v0.2.2 h1:w7QXnpH0eCBJm55zGCTJveZEkQBt6Fs5zThIdA6qQ9Y= @@ -318,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.45.0 h1:T2oCVkYoeckBxcNS6DTYiSXN2QcTNuAWaHyLGfqzMlU= -github.com/golangci/golangci-lint v1.45.0/go.mod h1:Y6grRO3drH/7kGP88i9jSl9fGWwCrbA5u7i++jOXll4= +github.com/golangci/golangci-lint v1.45.2 h1:9I3PzkvscJkFAQpTQi5Ga0V4qWdJERajX1UZ7QqkW+I= +github.com/golangci/golangci-lint v1.45.2/go.mod h1:f20dpzMmUTRp+oYnX0OGjV1Au3Jm2JeI9yLqHq1/xsI= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -440,8 +440,9 @@ github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerX github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4= +github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= From 9d61fd024d5472617406585066f4c5a770664e4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 07:59:39 -0700 Subject: [PATCH 121/886] Bump google.golang.org/protobuf from 1.27.1 to 1.28.0 in /exporters/otlp/otlptrace (#2730) * Bump google.golang.org/protobuf in /exporters/otlp/otlptrace Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.27.1 to 1.28.0. - [Release notes](https://github.com/protocolbuffers/protobuf-go/releases) - [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash) - [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.27.1...v1.28.0) --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/otel-collector/go.sum | 3 ++- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 3 ++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 503be9bf3a6..89018ef5d58 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -414,8 +414,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e6583f3c550..7a449e9c241 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/trace v1.6.0 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 60790292bd3..a195bb61171 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -410,8 +410,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 17be1649ac8..699ae36ef2b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index bfc46725a4b..936ae6ac805 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -418,8 +418,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 976b9f09178..92f3c3aa79d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/otel/trace v1.6.0 go.opentelemetry.io/proto/otlp v0.12.1 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 60790292bd3..a195bb61171 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -410,8 +410,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b89da6f8a62c6b164adbb1fba23e6f8e41155dcb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 08:22:31 -0700 Subject: [PATCH 122/886] Bump google.golang.org/protobuf from 1.27.1 to 1.28.0 in /exporters/otlp/otlpmetric (#2738) * Bump google.golang.org/protobuf in /exporters/otlp/otlpmetric Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.27.1 to 1.28.0. - [Release notes](https://github.com/protocolbuffers/protobuf-go/releases) - [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash) - [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.27.1...v1.28.0) --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 3 ++- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9edca2d4b5a..86ca0f599a6 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 165932b0a00..2c77b390846 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -412,8 +412,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 0292fabf164..e9e177d0322 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 165932b0a00..2c77b390846 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -412,8 +412,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3f1f542dbdc..9e56f58b67e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.0 go.opentelemetry.io/proto/otlp v0.12.1 - google.golang.org/protobuf v1.27.1 + google.golang.org/protobuf v1.28.0 ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 165932b0a00..2c77b390846 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -412,8 +412,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 1f8ad000fffc5ae24933d7b4dcbb99cc00bfb649 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 28 Mar 2022 09:23:13 -0700 Subject: [PATCH 123/886] Fix schema URLs (#2744) * Fix schema URLs * Add changelog entry --- CHANGELOG.md | 5 +++++ semconv/v1.4.0/schema.go | 2 +- semconv/v1.5.0/schema.go | 2 +- semconv/v1.6.1/schema.go | 2 +- semconv/v1.7.0/schema.go | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f9f190d1c2..ddc987b34c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- The `go.opentelemetry.io/otel/schema/*` packages now use the correct schema URL for their `SchemaURL` constant. + Instead of using `"https://opentelemetry.io/schemas/v"` they now use the correct URL without a `v` prefix, `"https://opentelemetry.io/schemas/"`. (#2743, #2744) + ### Security - Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. diff --git a/semconv/v1.4.0/schema.go b/semconv/v1.4.0/schema.go index 467a30b9ed7..a78f1bf4008 100644 --- a/semconv/v1.4.0/schema.go +++ b/semconv/v1.4.0/schema.go @@ -17,4 +17,4 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/v1.4.0" +const SchemaURL = "https://opentelemetry.io/schemas/1.4.0" diff --git a/semconv/v1.5.0/schema.go b/semconv/v1.5.0/schema.go index 9a2f60647c0..6175b00d2dd 100644 --- a/semconv/v1.5.0/schema.go +++ b/semconv/v1.5.0/schema.go @@ -17,4 +17,4 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.5.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/v1.5.0" +const SchemaURL = "https://opentelemetry.io/schemas/1.5.0" diff --git a/semconv/v1.6.1/schema.go b/semconv/v1.6.1/schema.go index c7574ab200c..be540d6df4a 100644 --- a/semconv/v1.6.1/schema.go +++ b/semconv/v1.6.1/schema.go @@ -17,4 +17,4 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.6.1" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/v1.6.1" +const SchemaURL = "https://opentelemetry.io/schemas/1.6.1" diff --git a/semconv/v1.7.0/schema.go b/semconv/v1.7.0/schema.go index ec8b463d98e..64b6c46a58d 100644 --- a/semconv/v1.7.0/schema.go +++ b/semconv/v1.7.0/schema.go @@ -17,4 +17,4 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0" // SchemaURL is the schema URL that matches the version of the semantic conventions // that this package defines. Semconv packages starting from v1.4.0 must declare // non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/v1.7.0" +const SchemaURL = "https://opentelemetry.io/schemas/1.7.0" From 8747a29580089f75bde96aab00b44b8fa1a18278 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 28 Mar 2022 09:50:10 -0700 Subject: [PATCH 124/886] Release v1.6.1 (#2746) * Upgrade stable-v1 to v1.6.1 * Prepare stable-v1 for version v1.6.1 * Update changelog --- CHANGELOG.md | 7 +++++-- bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 6 +++--- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 6 +++--- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 6 +++--- example/otel-collector/go.mod | 8 ++++---- example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 2 +- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/export/metric/go.mod | 2 +- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 4 ++-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 2 +- 31 files changed, 84 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddc987b34c1..0b3f8e9d74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.6.1] - 2022-03-28 + ### Fixed - The `go.opentelemetry.io/otel/schema/*` packages now use the correct schema URL for their `SchemaURL` constant. @@ -16,7 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Security - Upgrade `go.opentelemetry.io/proto/otlp` from `v0.12.0` to `v0.12.1`. - This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #TBD) + This includes an indirect upgrade of `github.com/grpc-ecosystem/grpc-gateway` which resolves [a vulnerability](https://nvd.nist.gov/vuln/detail/CVE-2019-11254) from `gopkg.in/yaml.v2` in version `v2.2.3`. (#2724, #2728) ## [1.6.0/0.28.0] - 2022-03-23 @@ -1778,7 +1780,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.1...HEAD +[1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 [1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 [1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 [1.4.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.4.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a63b24784df..a48d8bbc64d 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 3b180bdeb36..3e7bb8996ad 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index be4871754ef..d260a60e33b 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index 617b6a5bb75..4f1411a9891 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 7a77c37cdbd..120eb41e62e 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/jaeger v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/jaeger v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index eb713699d54..930de80aa2d 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 586843102ca..5a45f14473f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 957a5efff34..e6d9097d333 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 google.golang.org/grpc v1.45.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index ec53ef984e9..ba53122bfb3 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index d8200474d63..65a3ab932df 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/exporters/prometheus v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk/metric v0.28.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 907d62c0fe9..225d2f6798d 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/zipkin v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/zipkin v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index cd37734c203..091b208c682 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 86ca0f599a6..18d26170af7 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e9e177d0322..d354381acc9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9e56f58b67e..3cdee92b241 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 7a449e9c241..b7a02218c69 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 699ae36ef2b..22a9ea67b6d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/proto/otlp v0.12.1 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 92f3c3aa79d..b3963de7e32 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 go.opentelemetry.io/proto/otlp v0.12.1 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 700c35dadd3..ddc5dcb9b32 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index bc09715fd00..c05efdd7119 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c158e33d58e..aadba86c81d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index a11a0efbcbe..a83141ced15 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index 6b238c8749a..eba789c09f7 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel/trace v1.6.1 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index b561560bc97..a34701e6781 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 ) replace go.opentelemetry.io/otel => ../ diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod index aa2e6a7952a..7dff9c294e4 100644 --- a/sdk/export/metric/go.mod +++ b/sdk/export/metric/go.mod @@ -40,7 +40,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../../metric replace go.opentelemetry.io/otel/trace => ../../../trace require ( - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/sdk/go.mod b/sdk/go.mod index fd9f349a974..c0c3e98d1ef 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 - go.opentelemetry.io/otel/trace v1.6.0 + go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel/trace v1.6.1 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 52656af7bc8..92ac0a3aab8 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.1 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index e9346b27464..97ad4d13993 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel v1.6.1 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index bfcd5a0e493..70f6bed1e8f 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.6.0" + return "1.6.1" } diff --git a/versions.yaml b/versions.yaml index 2ed0030ea5a..d6d593bf5fc 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.6.0 + version: v1.6.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing From bbcdc75ede428d61212caee9222d68300b7e70a7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 29 Mar 2022 07:31:09 -0700 Subject: [PATCH 125/886] Remove sdk/export/metric module (#2720) * Remove the sdk/export/metric module * Add change to changelog * Update PR number Co-authored-by: Chester Cheung --- CHANGELOG.md | 5 ++ sdk/export/metric/aggregation/aggregation.go | 77 -------------------- sdk/export/metric/aggregation/temporality.go | 53 -------------- sdk/export/metric/go.mod | 73 ------------------- sdk/export/metric/go.sum | 21 ------ sdk/export/metric/metric.go | 68 ----------------- 6 files changed, 5 insertions(+), 292 deletions(-) delete mode 100644 sdk/export/metric/aggregation/aggregation.go delete mode 100644 sdk/export/metric/aggregation/temporality.go delete mode 100644 sdk/export/metric/go.mod delete mode 100644 sdk/export/metric/go.sum delete mode 100644 sdk/export/metric/metric.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b3f8e9d74a..c38fd62ad69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) + ## [1.6.1] - 2022-03-28 ### Fixed diff --git a/sdk/export/metric/aggregation/aggregation.go b/sdk/export/metric/aggregation/aggregation.go deleted file mode 100644 index 702c5b2bc82..00000000000 --- a/sdk/export/metric/aggregation/aggregation.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" - -import ( - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Aggregation = aggregation.Aggregation - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Sum = aggregation.Sum - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Count = aggregation.Count - -// Deprecated: Will be removed soon. -type Min interface { - Aggregation - Min() (number.Number, error) -} - -// Deprecated: Will be removed soon. -type Max interface { - Aggregation - Max() (number.Number, error) -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type LastValue = aggregation.LastValue - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Buckets = aggregation.Buckets - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Histogram = aggregation.Histogram - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Kind = aggregation.Kind - -const ( - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - SumKind = aggregation.SumKind - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - HistogramKind = aggregation.HistogramKind - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - LastValueKind = aggregation.LastValueKind -) - -var ( - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - ErrNegativeInput = aggregation.ErrNegativeInput - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - ErrNaNInput = aggregation.ErrNaNInput - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - ErrInconsistentType = aggregation.ErrInconsistentType - - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - ErrNoCumulativeToDelta = aggregation.ErrNoCumulativeToDelta - - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - ErrNoData = aggregation.ErrNoData -) diff --git a/sdk/export/metric/aggregation/temporality.go b/sdk/export/metric/aggregation/temporality.go deleted file mode 100644 index 2e3e705662b..00000000000 --- a/sdk/export/metric/aggregation/temporality.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregation // import "go.opentelemetry.io/otel/sdk/export/metric/aggregation" - -import ( - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -) - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type Temporality = aggregation.Temporality - -const ( - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - CumulativeTemporality = aggregation.CumulativeTemporality - - // Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - DeltaTemporality = aggregation.DeltaTemporality -) - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -func ConstantTemporalitySelector(t Temporality) TemporalitySelector { - return aggregation.ConstantTemporalitySelector(t) -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -func CumulativeTemporalitySelector() TemporalitySelector { - return aggregation.CumulativeTemporalitySelector() -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -func DeltaTemporalitySelector() TemporalitySelector { - return aggregation.DeltaTemporalitySelector() -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -func StatelessTemporalitySelector() TemporalitySelector { - return aggregation.StatelessTemporalitySelector() -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -type TemporalitySelector = aggregation.TemporalitySelector diff --git a/sdk/export/metric/go.mod b/sdk/export/metric/go.mod deleted file mode 100644 index 7dff9c294e4..00000000000 --- a/sdk/export/metric/go.mod +++ /dev/null @@ -1,73 +0,0 @@ -// Deprecated: use go.opentelemetry.io/otel/sdk/metric instead. -module go.opentelemetry.io/otel/sdk/export/metric - -go 1.16 - -replace go.opentelemetry.io/otel => ../../.. - -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../../metric - -replace go.opentelemetry.io/otel/sdk => ../.. - -replace go.opentelemetry.io/otel/sdk/export/metric => ./ - -replace go.opentelemetry.io/otel/sdk/metric => ../../metric - -replace go.opentelemetry.io/otel/trace => ../../../trace - -require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/sdk/metric v0.28.0 -) - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../../exporters/otlp/internal/retry diff --git a/sdk/export/metric/go.sum b/sdk/export/metric/go.sum deleted file mode 100644 index 5f902e9646f..00000000000 --- a/sdk/export/metric/go.sum +++ /dev/null @@ -1,21 +0,0 @@ -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/export/metric/metric.go b/sdk/export/metric/metric.go deleted file mode 100644 index b3dccccd9dc..00000000000 --- a/sdk/export/metric/metric.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/sdk/export/metric" - -import ( - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Accumulation = export.Accumulation - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/aggregator" -type Aggregator = aggregator.Aggregator - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type AggregatorSelector = export.AggregatorSelector - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Checkpointer = export.Checkpointer - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type CheckpointerFactory = export.CheckpointerFactory - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Exporter = export.Exporter - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type InstrumentationLibraryReader = export.Exporter - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Metadata = export.Metadata - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Processor = export.Processor - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Reader = export.Reader - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -type Record = export.Record - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator Aggregator) Accumulation { - return export.NewAccumulation(descriptor, labels, aggregator) -} - -// Deprecated: use module "go.opentelemetry.io/otel/sdk/metric/export" -func NewRecord(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { - return export.NewRecord(descriptor, labels, aggregation, start, end) -} From 628723630fe3773684da6855b980d4d9c03f8ea1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 30 Mar 2022 08:18:59 -0700 Subject: [PATCH 126/886] Upgrade go.opentelemetry.io/proto to v0.15.0 (#2748) * Upgrade go.opentelemetry.io/proto to v0.15.0 * Fix otlpmetric exporter test * Fix lint in otlpmetric * Update otlptrace * Clean new line breaks * Fix comment in otlpmetric exporter_test.go * Add changes to changelog --- CHANGELOG.md | 7 +++ example/otel-collector/go.sum | 4 +- exporters/otlp/otlpmetric/exporter_test.go | 60 ++++++++++--------- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +- .../internal/metrictransform/metric.go | 17 +++--- .../internal/otlpmetrictest/collector.go | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +- .../internal/otlptracetest/collector.go | 16 +++-- .../internal/otlptracetest/otlptest.go | 8 +-- .../tracetransform/instrumentation.go | 4 +- .../otlptrace/internal/tracetransform/span.go | 30 +++++----- .../internal/tracetransform/span_test.go | 16 ++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +- 22 files changed, 106 insertions(+), 96 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c38fd62ad69..c8012c656bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) +- Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. + This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) + ### Removed - Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 89018ef5d58..1360dc0941e 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -160,8 +160,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 2517d91d201..242079a20c7 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -191,7 +191,7 @@ func TestNoGroupingExport(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: nil, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -233,10 +233,11 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { append(baseKeyValues, cpuKey.Int(1)), testLibName, ) + sum := 11.0 expected := []*metricpb.ResourceMetrics{ { Resource: nil, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -250,14 +251,14 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, - Sum: 11, + Sum: &sum, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, }, { Attributes: cpu1Labels, Count: 2, - Sum: 11, + Sum: &sum, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, StartTimeUnixNano: startTime(), @@ -283,10 +284,11 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { append(baseKeyValues, cpuKey.Int(1)), testLibName, ) + sum := 11.0 expected := []*metricpb.ResourceMetrics{ { Resource: nil, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -300,14 +302,14 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, - Sum: 11.0, + Sum: &sum, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, }, { Attributes: cpu1Labels, Count: 2, - Sum: 11.0, + Sum: &sum, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, StartTimeUnixNano: startTime(), @@ -341,7 +343,7 @@ func TestCountInt64MetricGroupingExport(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: nil, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -391,7 +393,7 @@ func TestCountFloat64MetricGroupingExport(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: nil, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -463,7 +465,7 @@ func TestResourceMetricGroupingExport(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: testerAResourcePb, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -564,9 +566,9 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: testerAResourcePb, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { - InstrumentationLibrary: &commonpb.InstrumentationLibrary{ + Scope: &commonpb.InstrumentationScope{ Name: "counting-lib", Version: "v1", }, @@ -603,7 +605,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { }, }, { - InstrumentationLibrary: &commonpb.InstrumentationLibrary{ + Scope: &commonpb.InstrumentationScope{ Name: "counting-lib", Version: "v2", }, @@ -628,7 +630,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { }, }, { - InstrumentationLibrary: &commonpb.InstrumentationLibrary{ + Scope: &commonpb.InstrumentationScope{ Name: "summing-lib", }, SchemaUrl: "schurl", @@ -693,7 +695,7 @@ func TestStatelessAggregationTemporality(t *testing.T) { []*metricpb.ResourceMetrics{ { Resource: testerAResourcePb, - InstrumentationLibraryMetrics: []*metricpb.InstrumentationLibraryMetrics{ + ScopeMetrics: []*metricpb.ScopeMetrics{ { Metrics: []*metricpb.Metric{ { @@ -780,41 +782,41 @@ func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource. // assert.ElementsMatch does not equate nested slices of different order, // therefore this requires the top level slice to be broken down. - // Build a map of Resource/InstrumentationLibrary pairs to Metrics, from - // that validate the metric elements match for all expected pairs. Finally, - // make we saw all expected pairs. - keyFor := func(ilm *metricpb.InstrumentationLibraryMetrics) string { - return fmt.Sprintf("%s/%s/%s", ilm.GetInstrumentationLibrary().GetName(), ilm.GetInstrumentationLibrary().GetVersion(), ilm.GetSchemaUrl()) + // Build a map of Resource/Scope pairs to Metrics, from that validate the + // metric elements match for all expected pairs. Finally, make we saw all + // expected pairs. + keyFor := func(sm *metricpb.ScopeMetrics) string { + return fmt.Sprintf("%s/%s/%s", sm.GetScope().GetName(), sm.GetScope().GetVersion(), sm.GetSchemaUrl()) } got := map[string][]*metricpb.Metric{} for _, rm := range driver.rm { - for _, ilm := range rm.InstrumentationLibraryMetrics { - k := keyFor(ilm) - got[k] = append(got[k], ilm.GetMetrics()...) + for _, sm := range rm.ScopeMetrics { + k := keyFor(sm) + got[k] = append(got[k], sm.GetMetrics()...) } } seen := map[string]struct{}{} for _, rm := range expected { - for _, ilm := range rm.InstrumentationLibraryMetrics { - k := keyFor(ilm) + for _, sm := range rm.ScopeMetrics { + k := keyFor(sm) seen[k] = struct{}{} g, ok := got[k] if !ok { - t.Errorf("missing metrics for:\n\tInstrumentationLibrary: %q\n", k) + t.Errorf("missing metrics for:\n\tInstrumentationScope: %q\n", k) continue } - if !assert.Len(t, g, len(ilm.GetMetrics())) { + if !assert.Len(t, g, len(sm.GetMetrics())) { continue } - for i, expected := range ilm.GetMetrics() { + for i, expected := range sm.GetMetrics() { assert.Equal(t, "", cmp.Diff(expected, g[i], protocmp.Transform())) } } } for k := range got { if _, ok := seen[k]; !ok { - t.Errorf("did not expect metrics for:\n\tInstrumentationLibrary: %s\n", k) + t.Errorf("did not expect metrics for:\n\tInstrumentationScope: %s\n", k) } } } diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 18d26170af7..fdab05efd87 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 2c77b390846..98fd383612f 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index 002bb64a997..03a3d250ab0 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -72,7 +72,7 @@ func toNanos(t time.Time) uint64 { // InstrumentationLibraryReader transforms all records contained in a checkpoint into // batched OTLP ResourceMetrics. func InstrumentationLibraryReader(ctx context.Context, temporalitySelector aggregation.TemporalitySelector, res *resource.Resource, ilmr export.InstrumentationLibraryReader, numWorkers uint) (*metricpb.ResourceMetrics, error) { - var ilms []*metricpb.InstrumentationLibraryMetrics + var sms []*metricpb.ScopeMetrics err := ilmr.ForEach(func(lib instrumentation.Library, mr export.Reader) error { @@ -107,24 +107,24 @@ func InstrumentationLibraryReader(ctx context.Context, temporalitySelector aggre return nil } - ilms = append(ilms, &metricpb.InstrumentationLibraryMetrics{ + sms = append(sms, &metricpb.ScopeMetrics{ Metrics: ms, SchemaUrl: lib.SchemaURL, - InstrumentationLibrary: &commonpb.InstrumentationLibrary{ + Scope: &commonpb.InstrumentationScope{ Name: lib.Name, Version: lib.Version, }, }) return nil }) - if len(ilms) == 0 { + if len(sms) == 0 { return nil, err } rms := &metricpb.ResourceMetrics{ - Resource: Resource(res), - SchemaUrl: res.SchemaURL(), - InstrumentationLibraryMetrics: ilms, + Resource: Resource(res), + SchemaUrl: res.SchemaURL(), + ScopeMetrics: sms, } return rms, err @@ -415,6 +415,7 @@ func histogramPoint(record export.Record, temporality aggregation.Temporality, a return nil, err } + sumFloat64 := sum.CoerceToFloat64(desc.NumberKind()) m := &metricpb.Metric{ Name: desc.Name(), Description: desc.Description(), @@ -424,7 +425,7 @@ func histogramPoint(record export.Record, temporality aggregation.Temporality, a AggregationTemporality: sdkTemporalityToTemporality(temporality), DataPoints: []*metricpb.HistogramDataPoint{ { - Sum: sum.CoerceToFloat64(desc.NumberKind()), + Sum: &sumFloat64, Attributes: Iterator(labels.Iter()), StartTimeUnixNano: toNanos(record.StartTime()), TimeUnixNano: toNanos(record.EndTime()), diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go index 73b54b9bf2c..20915724a53 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go @@ -41,8 +41,8 @@ func NewMetricsStorage() MetricsStorage { func (s *MetricsStorage) AddMetrics(request *collectormetricpb.ExportMetricsServiceRequest) { for _, rm := range request.GetResourceMetrics() { // TODO (rghetia) handle multiple resource and library info. - if len(rm.InstrumentationLibraryMetrics) > 0 { - s.metrics = append(s.metrics, rm.InstrumentationLibraryMetrics[0].Metrics...) + if len(rm.ScopeMetrics) > 0 { + s.metrics = append(s.metrics, rm.ScopeMetrics[0].Metrics...) } } } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d354381acc9..d643ecf73b9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 2c77b390846..98fd383612f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3cdee92b241..4b3c46a3f37 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 2c77b390846..98fd383612f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index b7a02218c69..54c622e3ea1 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/trace v1.6.1 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index a195bb61171..7f886d05d81 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -161,8 +161,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go index 992f9de2eab..865fabba27d 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go @@ -50,20 +50,18 @@ func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequ if existingRs, ok := s.rsm[rstr]; !ok { s.rsm[rstr] = rs // TODO (rghetia): Add support for library Info. - if len(rs.InstrumentationLibrarySpans) == 0 { - rs.InstrumentationLibrarySpans = []*tracepb.InstrumentationLibrarySpans{ + if len(rs.ScopeSpans) == 0 { + rs.ScopeSpans = []*tracepb.ScopeSpans{ { Spans: []*tracepb.Span{}, }, } } - s.spanCount += len(rs.InstrumentationLibrarySpans[0].Spans) + s.spanCount += len(rs.ScopeSpans[0].Spans) } else { - if len(rs.InstrumentationLibrarySpans) > 0 { - newSpans := rs.InstrumentationLibrarySpans[0].GetSpans() - existingRs.InstrumentationLibrarySpans[0].Spans = - append(existingRs.InstrumentationLibrarySpans[0].Spans, - newSpans...) + if len(rs.ScopeSpans) > 0 { + newSpans := rs.ScopeSpans[0].GetSpans() + existingRs.ScopeSpans[0].Spans = append(existingRs.ScopeSpans[0].Spans, newSpans...) s.spanCount += len(newSpans) } } @@ -74,7 +72,7 @@ func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequ func (s *SpansStorage) GetSpans() []*tracepb.Span { spans := make([]*tracepb.Span, 0, s.spanCount) for _, rs := range s.rsm { - spans = append(spans, rs.InstrumentationLibrarySpans[0].Spans...) + spans = append(spans, rs.ScopeSpans[0].Spans...) } return spans } diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go index 812b7b42902..91c098d1539 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go @@ -99,14 +99,14 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, // Now verify spans and attributes for each resource span. for _, rs := range rss { - if len(rs.InstrumentationLibrarySpans) == 0 { - t.Fatalf("zero Instrumentation Library Spans") + if len(rs.ScopeSpans) == 0 { + t.Fatalf("zero ScopeSpans") } - if got, want := len(rs.InstrumentationLibrarySpans[0].Spans), m; got != want { + if got, want := len(rs.ScopeSpans[0].Spans), m; got != want { t.Fatalf("span counts: got %d, want %d", got, want) } attrMap := map[int64]bool{} - for _, s := range rs.InstrumentationLibrarySpans[0].Spans { + for _, s := range rs.ScopeSpans[0].Spans { if gotName, want := s.Name, "AlwaysSample"; gotName != want { t.Fatalf("span name: got %s, want %s", gotName, want) } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 6246b17f578..213f9f92a4e 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -19,11 +19,11 @@ import ( commonpb "go.opentelemetry.io/proto/otlp/common/v1" ) -func InstrumentationLibrary(il instrumentation.Library) *commonpb.InstrumentationLibrary { +func InstrumentationScope(il instrumentation.Library) *commonpb.InstrumentationScope { if il == (instrumentation.Library{}) { return nil } - return &commonpb.InstrumentationLibrary{ + return &commonpb.InstrumentationScope{ Name: il.Name, Version: il.Version, } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index 88c05912f0d..0e8d00a0494 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -32,11 +32,11 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { rsm := make(map[attribute.Distinct]*tracepb.ResourceSpans) - type ilsKey struct { + type key struct { r attribute.Distinct il instrumentation.Library } - ilsm := make(map[ilsKey]*tracepb.InstrumentationLibrarySpans) + ssm := make(map[key]*tracepb.ScopeSpans) var resources int for _, sd := range sdl { @@ -45,30 +45,30 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { } rKey := sd.Resource().Equivalent() - iKey := ilsKey{ + k := key{ r: rKey, il: sd.InstrumentationLibrary(), } - ils, iOk := ilsm[iKey] + scopeSpan, iOk := ssm[k] if !iOk { // Either the resource or instrumentation library were unknown. - ils = &tracepb.InstrumentationLibrarySpans{ - InstrumentationLibrary: InstrumentationLibrary(sd.InstrumentationLibrary()), - Spans: []*tracepb.Span{}, - SchemaUrl: sd.InstrumentationLibrary().SchemaURL, + scopeSpan = &tracepb.ScopeSpans{ + Scope: InstrumentationScope(sd.InstrumentationLibrary()), + Spans: []*tracepb.Span{}, + SchemaUrl: sd.InstrumentationLibrary().SchemaURL, } } - ils.Spans = append(ils.Spans, span(sd)) - ilsm[iKey] = ils + scopeSpan.Spans = append(scopeSpan.Spans, span(sd)) + ssm[k] = scopeSpan rs, rOk := rsm[rKey] if !rOk { resources++ // The resource was unknown. rs = &tracepb.ResourceSpans{ - Resource: Resource(sd.Resource()), - InstrumentationLibrarySpans: []*tracepb.InstrumentationLibrarySpans{ils}, - SchemaUrl: sd.Resource().SchemaURL(), + Resource: Resource(sd.Resource()), + ScopeSpans: []*tracepb.ScopeSpans{scopeSpan}, + SchemaUrl: sd.Resource().SchemaURL(), } rsm[rKey] = rs continue @@ -78,9 +78,9 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { // library lookup was unknown because if so we need to add it to the // ResourceSpans. Otherwise, the instrumentation library has already // been seen and the append we did above will be included it in the - // InstrumentationLibrarySpans reference. + // ScopeSpans reference. if !iOk { - rs.InstrumentationLibrarySpans = append(rs.InstrumentationLibrarySpans, ils) + rs.ScopeSpans = append(rs.ScopeSpans, scopeSpan) } } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 37860d2e047..8f27033b14e 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -298,12 +298,12 @@ func TestSpanData(t *testing.T) { assert.Equal(t, got[0].GetResource(), Resource(spanData.Resource)) assert.Equal(t, got[0].SchemaUrl, spanData.Resource.SchemaURL()) - ilSpans := got[0].GetInstrumentationLibrarySpans() - require.Len(t, ilSpans, 1) - assert.Equal(t, ilSpans[0].SchemaUrl, spanData.InstrumentationLibrary.SchemaURL) - assert.Equal(t, ilSpans[0].GetInstrumentationLibrary(), InstrumentationLibrary(spanData.InstrumentationLibrary)) - require.Len(t, ilSpans[0].Spans, 1) - actualSpan := ilSpans[0].Spans[0] + scopeSpans := got[0].GetScopeSpans() + require.Len(t, scopeSpans, 1) + assert.Equal(t, scopeSpans[0].SchemaUrl, spanData.InstrumentationLibrary.SchemaURL) + assert.Equal(t, scopeSpans[0].GetScope(), InstrumentationScope(spanData.InstrumentationLibrary)) + require.Len(t, scopeSpans[0].Spans, 1) + actualSpan := scopeSpans[0].Spans[0] if diff := cmp.Diff(expectedSpan, actualSpan, cmp.Comparer(proto.Equal)); diff != "" { t.Fatalf("transformed span differs %v\n", diff) @@ -315,7 +315,9 @@ func TestRootSpanData(t *testing.T) { sd := Spans(tracetest.SpanStubs{{}}.Snapshots()) require.Len(t, sd, 1) rs := sd[0] - got := rs.GetInstrumentationLibrarySpans()[0].GetSpans()[0].GetParentSpanId() + scopeSpans := rs.GetScopeSpans() + require.Len(t, scopeSpans, 1) + got := scopeSpans[0].GetSpans()[0].GetParentSpanId() // Empty means root span. assert.Nil(t, got, "incorrect transform of root parent span ID") diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 22a9ea67b6d..35939459f37 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 936ae6ac805..ae12aff51b9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index b3963de7e32..0e57f0a444d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 go.opentelemetry.io/otel/sdk v1.6.1 go.opentelemetry.io/otel/trace v1.6.1 - go.opentelemetry.io/proto/otlp v0.12.1 + go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index a195bb61171..7f886d05d81 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -161,8 +161,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.12.1 h1:kfx2sboxOGFvGJcH2C408CiVo2wVHC2av2XHNqj4vEg= -go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= +go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 4385621e8c96dffcd65446d63cc8ec8538307ffc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 30 Mar 2022 16:19:19 -0700 Subject: [PATCH 127/886] Remove removed module from dependabot conf (#2751) --- .github/dependabot.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dd586259af2..e1ae982eb5c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -262,15 +262,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /sdk/export/metric - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /sdk/metric labels: From ceead4a2cd2d11005d9d723529946f899599a9cd Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 30 Mar 2022 16:50:14 -0700 Subject: [PATCH 128/886] Add back global metric Meter function (#2750) * Add back global metric Meter function * Add change to changelog --- CHANGELOG.md | 5 +++++ metric/global/global.go | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8012c656bf..5533d07f33f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. + This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) + ### Changed - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. diff --git a/metric/global/global.go b/metric/global/global.go index 8578c99ae5a..25071bb88ed 100644 --- a/metric/global/global.go +++ b/metric/global/global.go @@ -19,6 +19,17 @@ import ( "go.opentelemetry.io/otel/metric/internal/global" ) +// Meter returns a Meter from the global MeterProvider. The +// instrumentationName must be the name of the library providing +// instrumentation. This name may be the same as the instrumented code only if +// that code provides built-in instrumentation. If the instrumentationName is +// empty, then a implementation defined default name will be used instead. +// +// This is short for MeterProvider().Meter(name) +func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { + return MeterProvider().Meter(instrumentationName, opts...) +} + // MeterProvider returns the registered global trace provider. // If none is registered then a No-op MeterProvider is returned. func MeterProvider() metric.MeterProvider { From 60041d29928a24c872a22382f41a098978b72503 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 31 Mar 2022 19:21:14 +0200 Subject: [PATCH 129/886] run ResetForTest during cleanup (#2754) Co-authored-by: Chester Cheung --- internal/global/benchmark_test.go | 2 +- internal/global/propagator_test.go | 6 +++--- internal/global/state.go | 16 ++++++++++------ internal/global/state_test.go | 2 +- internal/global/trace_test.go | 12 ++++++------ 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/internal/global/benchmark_test.go b/internal/global/benchmark_test.go index ef37194f4c6..f001844642c 100644 --- a/internal/global/benchmark_test.go +++ b/internal/global/benchmark_test.go @@ -25,7 +25,7 @@ import ( func BenchmarkStartEndSpanNoSDK(b *testing.B) { // Compare with BenchmarkStartEndSpan() in // ../../sdk/trace/benchmark_test.go. - global.ResetForTest() + global.ResetForTest(b) t := otel.Tracer("Benchmark StartEndSpan") ctx := context.Background() b.ResetTimer() diff --git a/internal/global/propagator_test.go b/internal/global/propagator_test.go index afaff13e4a2..b58ae445691 100644 --- a/internal/global/propagator_test.go +++ b/internal/global/propagator_test.go @@ -23,7 +23,7 @@ import ( ) func TestTextMapPropagatorDelegation(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) ctx := context.Background() carrier := internaltest.NewTextMapCarrier(nil) @@ -53,7 +53,7 @@ func TestTextMapPropagatorDelegation(t *testing.T) { } func TestTextMapPropagatorDelegationNil(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) ctx := context.Background() carrier := internaltest.NewTextMapCarrier(nil) @@ -75,7 +75,7 @@ func TestTextMapPropagatorDelegationNil(t *testing.T) { } func TestTextMapPropagatorFields(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) initial := global.TextMapPropagator() delegate := internaltest.NewTextMapPropagator("test") delegateFields := delegate.Fields() diff --git a/internal/global/state.go b/internal/global/state.go index d6b3e900cd4..a0e66918332 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -17,6 +17,7 @@ package global // import "go.opentelemetry.io/otel/internal/global" import ( "sync" "sync/atomic" + "testing" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -97,10 +98,13 @@ func defaultPropagatorsValue() *atomic.Value { return v } -// ResetForTest restores the initial global state, for testing purposes. -func ResetForTest() { - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() - delegateTraceOnce = sync.Once{} - delegateTextMapPropagatorOnce = sync.Once{} +// ResetForTest configures the test to restores the initial global state during +// its Cleanup step +func ResetForTest(t testing.TB) { + t.Cleanup(func() { + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + delegateTraceOnce = sync.Once{} + delegateTextMapPropagatorOnce = sync.Once{} + }) } diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 9e812083a13..3f497cce61b 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -21,7 +21,7 @@ import ( ) func TestResetsOfGlobalsPanic(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) tests := map[string]func(){ "SetTextMapPropagator": func() { global.SetTextMapPropagator(global.TextMapPropagator()) diff --git a/internal/global/trace_test.go b/internal/global/trace_test.go index 827dad3c8e9..fc16ff0e760 100644 --- a/internal/global/trace_test.go +++ b/internal/global/trace_test.go @@ -44,7 +44,7 @@ func (fn fnTracer) Start(ctx context.Context, spanName string, opts ...trace.Spa } func TestTraceProviderDelegation(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) // Map of tracers to expected span names. expected := map[string][]string{ @@ -98,7 +98,7 @@ func TestTraceProviderDelegation(t *testing.T) { } func TestTraceProviderDelegates(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) // Retrieve the placeholder TracerProvider. gtp := otel.GetTracerProvider() @@ -118,7 +118,7 @@ func TestTraceProviderDelegates(t *testing.T) { } func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) // Retrieve the placeholder TracerProvider. gtp := otel.GetTracerProvider() @@ -161,7 +161,7 @@ func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { } func TestTracerDelegatesConcurrentSafe(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) // Retrieve the placeholder TracerProvider. gtp := otel.GetTracerProvider() @@ -210,7 +210,7 @@ func TestTracerDelegatesConcurrentSafe(t *testing.T) { } func TestTraceProviderDelegatesSameInstance(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) // Retrieve the placeholder TracerProvider. gtp := otel.GetTracerProvider() @@ -228,7 +228,7 @@ func TestTraceProviderDelegatesSameInstance(t *testing.T) { } func TestSpanContextPropagatedWithNonRecordingSpan(t *testing.T) { - global.ResetForTest() + global.ResetForTest(t) sc := trace.NewSpanContext(trace.SpanContextConfig{ TraceID: [16]byte{0x01}, From 625d76daea7147c5f28a364cb77540d966615ff3 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 31 Mar 2022 20:16:51 +0200 Subject: [PATCH 130/886] Don't panic when setting a provider to itself (#2749) * don't panic when setting a provider to itself * check for the presence of a delegate in all tests * use t.Fatal instead of t.Error * remove unneeded return * Update CHANGELOG.md Co-authored-by: Tyler Yahn * log errors when skipping providers * check for current provider outside of the run once * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn * Update metric/internal/global/state_test.go Co-authored-by: Tyler Yahn * Update metric/internal/global/state_test.go Co-authored-by: Tyler Yahn * Update internal/global/state_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + internal/global/state.go | 39 +++++++---- internal/global/state_test.go | 99 +++++++++++++++++++++------- metric/internal/global/state.go | 21 ++++-- metric/internal/global/state_test.go | 20 +++--- 5 files changed, 128 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5533d07f33f..2c8bdfa80b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Don't panic anymore when setting a global (Tracer|Meter)Provider or TextMapPropagator to itself. (#2749) - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. diff --git a/internal/global/state.go b/internal/global/state.go index a0e66918332..c7119cc4134 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -15,6 +15,7 @@ package global // import "go.opentelemetry.io/otel/internal/global" import ( + "errors" "sync" "sync/atomic" "testing" @@ -48,17 +49,21 @@ func TracerProvider() trace.TracerProvider { // SetTracerProvider is the internal implementation for global.SetTracerProvider. func SetTracerProvider(tp trace.TracerProvider) { + current := TracerProvider() + if current == tp { + // Setting the provider to the prior default results in a noop. Return + // early. + Error( + errors.New("no delegate configured in tracer provider"), + "Setting tracer provider to it's current value. No delegate will be configured", + ) + return + } + delegateTraceOnce.Do(func() { - current := TracerProvider() - if current == tp { - // Setting the provider to the prior default is nonsense, panic. - // Panic is acceptable because we are likely still early in the - // process lifetime. - panic("invalid TracerProvider, the global instance cannot be reinstalled") - } else if def, ok := current.(*tracerProvider); ok { + if def, ok := current.(*tracerProvider); ok { def.setDelegate(tp) } - }) globalTracer.Store(tracerProviderHolder{tp: tp}) } @@ -70,15 +75,21 @@ func TextMapPropagator() propagation.TextMapPropagator { // SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator. func SetTextMapPropagator(p propagation.TextMapPropagator) { + current := TextMapPropagator() + if current == p { + // Setting the provider to the prior default results in a noop. Return + // early. + Error( + errors.New("no delegate configured in text map propagator"), + "Setting text map propagator to it's current value. No delegate will be configured", + ) + return + } + // For the textMapPropagator already returned by TextMapPropagator // delegate to p. delegateTextMapPropagatorOnce.Do(func() { - if current := TextMapPropagator(); current == p { - // Setting the provider to the prior default is nonsense, panic. - // Panic is acceptable because we are likely still early in the - // process lifetime. - panic("invalid TextMapPropagator, the global instance cannot be reinstalled") - } else if def, ok := current.(*textMapPropagator); ok { + if def, ok := current.(*textMapPropagator); ok { def.SetDelegate(p) } }) diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 3f497cce61b..395f6c5e864 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -12,36 +12,91 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global_test +package global import ( "testing" - "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" ) -func TestResetsOfGlobalsPanic(t *testing.T) { - global.ResetForTest(t) - tests := map[string]func(){ - "SetTextMapPropagator": func() { - global.SetTextMapPropagator(global.TextMapPropagator()) - }, - "SetTracerProvider": func() { - global.SetTracerProvider(global.TracerProvider()) - }, - } - - for name, test := range tests { - shouldPanic(t, name, test) - } +func TestSetTracerProvider(t *testing.T) { + t.Run("Set With default is a noop", func(t *testing.T) { + ResetForTest(t) + SetTracerProvider(TracerProvider()) + + tp, ok := TracerProvider().(*tracerProvider) + if !ok { + t.Fatal("Global TracerProvider should be the default tracer provider") + } + + if tp.delegate != nil { + t.Fatal("tracer provider should not delegate when setting itself") + } + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + ResetForTest(t) + + SetTracerProvider(trace.NewNoopTracerProvider()) + + _, ok := TracerProvider().(*tracerProvider) + if ok { + t.Fatal("Global TracerProvider was not changed") + } + }) + + t.Run("Set() should delegate existing TracerProviders", func(t *testing.T) { + ResetForTest(t) + + tp := TracerProvider() + SetTracerProvider(trace.NewNoopTracerProvider()) + + ntp := tp.(*tracerProvider) + + if ntp.delegate == nil { + t.Fatal("The delegated tracer providers should have a delegate") + } + }) } -func shouldPanic(t *testing.T, name string, f func()) { - defer func() { - if r := recover(); r == nil { - t.Errorf("calling %s with default global did not panic", name) +func TestSetTextMapPropagator(t *testing.T) { + t.Run("Set With default is a noop", func(t *testing.T) { + ResetForTest(t) + SetTextMapPropagator(TextMapPropagator()) + + tmp, ok := TextMapPropagator().(*textMapPropagator) + if !ok { + t.Fatal("Global TextMapPropagator should be the default propagator") + } + + if tmp.delegate != nil { + t.Fatal("TextMapPropagator should not delegate when setting itself") + } + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + ResetForTest(t) + + SetTextMapPropagator(propagation.TraceContext{}) + + _, ok := TextMapPropagator().(*textMapPropagator) + if ok { + t.Fatal("Global TextMapPropagator was not changed") } - }() + }) + + t.Run("Set() should delegate existing propagators", func(t *testing.T) { + ResetForTest(t) - f() + p := TextMapPropagator() + SetTextMapPropagator(propagation.TraceContext{}) + + np := p.(*textMapPropagator) + + if np.delegate == nil { + t.Fatal("The delegated TextMapPropagators should have a delegate") + } + }) } diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go index 29a67c5dbe4..0f0f0b11730 100644 --- a/metric/internal/global/state.go +++ b/metric/internal/global/state.go @@ -15,9 +15,11 @@ package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( + "errors" "sync" "sync/atomic" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" ) @@ -38,14 +40,19 @@ func MeterProvider() metric.MeterProvider { // SetMeterProvider is the internal implementation for global.SetMeterProvider. func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if current == mp { + // Setting the provider to the prior default results in a noop. Return + // early. + global.Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } + delegateMeterOnce.Do(func() { - current := MeterProvider() - if current == mp { - // Setting the provider to the prior default is nonsense, panic. - // Panic is acceptable because we are likely still early in the - // process lifetime. - panic("invalid MeterProvider, the global instance cannot be reinstalled") - } else if def, ok := current.(*meterProvider); ok { + if def, ok := current.(*meterProvider); ok { def.setDelegate(mp) } }) diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go index 69cb9b917d6..bda1e57da19 100644 --- a/metric/internal/global/state_test.go +++ b/metric/internal/global/state_test.go @@ -18,8 +18,6 @@ import ( "sync" "testing" - "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/metric/nonrecording" ) @@ -31,13 +29,18 @@ func resetGlobalMeterProvider() { func TestSetMeterProvider(t *testing.T) { t.Cleanup(resetGlobalMeterProvider) - t.Run("Set With default panics", func(t *testing.T) { + t.Run("Set With default is a noop", func(t *testing.T) { resetGlobalMeterProvider() + SetMeterProvider(MeterProvider()) - assert.Panics(t, func() { - SetMeterProvider(MeterProvider()) - }) + mp, ok := MeterProvider().(*meterProvider) + if !ok { + t.Fatal("Global MeterProvider should be the default meter provider") + } + if mp.delegate != nil { + t.Fatal("meter provider should not delegate when setting itself") + } }) t.Run("First Set() should replace the delegate", func(t *testing.T) { @@ -47,8 +50,7 @@ func TestSetMeterProvider(t *testing.T) { _, ok := MeterProvider().(*meterProvider) if ok { - t.Error("Global Meter Provider was not changed") - return + t.Fatal("Global MeterProvider was not changed") } }) @@ -62,7 +64,7 @@ func TestSetMeterProvider(t *testing.T) { dmp := mp.(*meterProvider) if dmp.delegate == nil { - t.Error("The delegated meter providers should have a delegate") + t.Fatal("The delegated meter providers should have a delegate") } }) } From b7a5c1a4e5205760415024017c20c4188193576f Mon Sep 17 00:00:00 2001 From: Brad Topol Date: Fri, 1 Apr 2022 17:00:57 -0400 Subject: [PATCH 131/886] Update corrupted dependency golangci-lint (#2761) * Update corrupted dependency golangci-lint Signed-off-by: Brad Topol * updated go.sum by running make precommit Signed-off-by: Brad Topol --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 32 +++++++++++++++++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 3419bf5fc65..62fa28a541e 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.45.2 + github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 239876bd63c..07d8237bb28 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -118,14 +118,14 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= -github.com/blizzy78/varnamelen v0.6.1 h1:kttPCLzXFa+0nt++Cw9fb7GrSSM4KkyIAoX/vXsbuqA= -github.com/blizzy78/varnamelen v0.6.1/go.mod h1:zy2Eic4qWqjrxa60jG34cfL0VXcSwzUrIx68eJPb4Q8= +github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= +github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= -github.com/breml/bidichk v0.2.2 h1:w7QXnpH0eCBJm55zGCTJveZEkQBt6Fs5zThIdA6qQ9Y= -github.com/breml/bidichk v0.2.2/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= -github.com/breml/errchkjson v0.2.3 h1:97eGTmR/w0paL2SwfRPI1jaAZHaH/fXnxWTw2eEIqE0= -github.com/breml/errchkjson v0.2.3/go.mod h1:jZEATw/jF69cL1iy7//Yih8yp/mXp2CBoBr9GJwCAsY= +github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= +github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= +github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= +github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -318,8 +318,8 @@ github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZB github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.45.2 h1:9I3PzkvscJkFAQpTQi5Ga0V4qWdJERajX1UZ7QqkW+I= -github.com/golangci/golangci-lint v1.45.2/go.mod h1:f20dpzMmUTRp+oYnX0OGjV1Au3Jm2JeI9yLqHq1/xsI= +github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb h1:ktIXLbKYARKYRdZD8CCvv8BNbobc3L90me+OrZFsiKY= +github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb/go.mod h1:ZRpeoDtir4sFJNtpjgyoQmWFxfVRwRO4tMh3LJMoiug= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -553,6 +553,8 @@ github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/lufeee/execinquery v1.0.0 h1:1XUTuLIVPDlFvUU3LXmmZwHDsolsxXnY67lzhpeqe0I= +github.com/lufeee/execinquery v1.0.0/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -718,7 +720,7 @@ github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSx github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.17/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.19/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= @@ -835,8 +837,8 @@ github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcy github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.5.0 h1:g27SGGHNoQdvHz4KZA9o4v09RcWzylR+b1yueE5ECiw= -github.com/tomarrell/wrapcheck/v2 v2.5.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= +github.com/tomarrell/wrapcheck/v2 v2.6.0 h1:xZOkQCRq3xhRqE2yuM1TbBOYaXgCIoVwUFWo5PMGv70= +github.com/tomarrell/wrapcheck/v2 v2.6.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= @@ -1154,9 +1156,9 @@ golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1483,8 +1485,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= -mvdan.cc/gofumpt v0.3.0 h1:kTojdZo9AcEYbQYhGuLf/zszYthRdhDNDUi2JKTxas4= -mvdan.cc/gofumpt v0.3.0/go.mod h1:0+VyGZWleeIj5oostkOex+nDBA0eyavuDnDusAJ8ylo= +mvdan.cc/gofumpt v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8= +mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= From c91da4181dc9b9fb813f722dfe1db7331a2be1a5 Mon Sep 17 00:00:00 2001 From: Brad Topol Date: Tue, 5 Apr 2022 10:35:16 -0400 Subject: [PATCH 132/886] Bring back the metric global package (#2764) * This PR brings back the metric global package Closes: 2752 Signed-off-by: Brad Topol * updated CHANGELOG.md Signed-off-by: Brad Topol * reformatted CHANGELOG.md Signed-off-by: Brad Topol * Updated change log and removed unnecessary variable declaration Signed-off-by: Brad Topol --- CHANGELOG.md | 1 + example/prometheus/main.go | 15 +++------ .../otlpmetric/otlpmetricgrpc/example_test.go | 31 ++++++++----------- exporters/stdout/stdoutmetric/example_test.go | 14 +++------ sdk/metric/benchmark_test.go | 31 +++++++++---------- 5 files changed, 38 insertions(+), 54 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8bdfa80b6..132087b1aac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- The metrics global package was added back into several test files. (#2764) - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 12148d2595f..0710fc65c4c 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" @@ -35,9 +35,6 @@ import ( var ( lemonsKey = attribute.Key("ex.com/lemons") - - // TODO Bring back Global package - meterProvider metric.MeterProvider ) func initMeter() { @@ -57,9 +54,8 @@ func initMeter() { if err != nil { log.Panicf("failed to initialize prometheus exporter %v", err) } - // TODO Bring back Global package - // global.SetMeterProvider(exporter.MeterProvider()) - meterProvider = exporter.MeterProvider() + + global.SetMeterProvider(exporter.MeterProvider()) http.HandleFunc("/", exporter.ServeHTTP) go func() { @@ -72,9 +68,8 @@ func initMeter() { func main() { initMeter() - // TODO Bring back Global package - // meter := global.Meter("ex.com/basic") - meter := meterProvider.Meter("ex.com/basic") + meter := global.Meter("ex.com/basic") + observerLock := new(sync.RWMutex) observerValueToReport := new(float64) observerLabelsToReport := new([]attribute.KeyValue) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index fe0866b7af5..0b0fbd6967a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" @@ -53,11 +54,11 @@ func Example_insecure() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - // TODO Bring back Global package - // global.SetMeterProvider(pusher) + + global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controoler: %v", err) + log.Fatalf("could not start metric controller: %v", err) } defer func() { ctx, cancel := context.WithTimeout(ctx, time.Second) @@ -68,9 +69,7 @@ func Example_insecure() { } }() - // TODO Bring Back Global package - // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example @@ -115,11 +114,11 @@ func Example_withTLS() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - // TODO Bring back Global package - // global.SetMeterProvider(pusher) + + global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controoler: %v", err) + log.Fatalf("could not start metric controller: %v", err) } defer func() { @@ -131,9 +130,7 @@ func Example_withTLS() { } }() - // TODO Bring back Global package - // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) @@ -174,11 +171,11 @@ func Example_withDifferentSignalCollectors() { controller.WithExporter(exp), controller.WithCollectPeriod(2*time.Second), ) - // TODO Bring back Global package - // global.SetMeterProvider(pusher) + + global.SetMeterProvider(pusher) if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controoler: %v", err) + log.Fatalf("could not start metric controller: %v", err) } defer func() { ctx, cancel := context.WithTimeout(ctx, time.Second) @@ -189,9 +186,7 @@ func Example_withDifferentSignalCollectors() { } }() - // TODO Bring back Global package - // meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - meter := pusher.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") + meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") // Recorder metric example counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 1250a463a8c..1d85a422235 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -21,6 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument/syncint64" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" @@ -33,13 +34,6 @@ const ( ) var ( - // TODO Bring back Global package - // meter = global.GetMeterProvider().Meter( - // instrumentationName, - // metric.WithInstrumentationVersion(instrumentationVersion), - // ) - meter metric.Meter - loopCounter syncint64.Counter paramValue syncint64.Histogram @@ -82,9 +76,9 @@ func InstallExportPipeline(ctx context.Context) func() { if err = pusher.Start(ctx); err != nil { log.Fatalf("starting push controller: %v", err) } - // TODO Bring back Global package - // global.SetMeterProvider(pusher) - meter = pusher.Meter(instrumentationName, metric.WithInstrumentationVersion(instrumentationVersion)) + + global.SetMeterProvider(pusher) + meter := global.Meter(instrumentationName, metric.WithInstrumentationVersion(instrumentationVersion)) loopCounter, err = meter.SyncInt64().Counter("function.loops") if err != nil { diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index fd5f49bd1ef..cb06dcc75fb 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" @@ -181,27 +182,25 @@ func BenchmarkIterator_16(b *testing.B) { // Counters -// TODO readd global +func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { + // Compare with BenchmarkInt64CounterAdd() to see overhead of global + // package. This is in the SDK to avoid the API from depending on the + // SDK. + ctx := context.Background() + fix := newFixture(b) -// func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { -// // Compare with BenchmarkInt64CounterAdd() to see overhead of global -// // package. This is in the SDK to avoid the API from depending on the -// // SDK. -// ctx := context.Background() -// fix := newFixture(b) + global.SetMeterProvider(fix) -// sdk := global.Meter("test") -// global.SetMeterProvider(fix) + labs := []attribute.KeyValue{attribute.String("A", "B")} -// labs := []attribute.KeyValue{attribute.String("A", "B")} -// cnt := Must(sdk).NewInt64Counter("int64.sum") + cnt := fix.iCounter("int64.sum") -// b.ResetTimer() + b.ResetTimer() -// for i := 0; i < b.N; i++ { -// cnt.Add(ctx, 1, labs...) -// } -// } + for i := 0; i < b.N; i++ { + cnt.Add(ctx, 1, labs...) + } +} func BenchmarkInt64CounterAdd(b *testing.B) { ctx := context.Background() From f08bac52593ed66bda5ffeb7405e7d41861fcc4d Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Wed, 6 Apr 2022 17:44:27 -0400 Subject: [PATCH 133/886] Release prep v1.6.2 (#2770) * update changelog and versions for 1.6.2 release Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.6.2 Signed-off-by: Anthony J Mirabella --- CHANGELOG.md | 15 +++++++++------ bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 6 +++--- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 6 +++--- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 6 +++--- example/otel-collector/go.mod | 8 ++++---- example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 2 +- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 4 ++-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 3 +-- 30 files changed, 87 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 132087b1aac..4e2e25faf3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) +### Removed + +- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. + Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) + +## [1.6.2] - 2022-04-06 + ### Changed - Don't panic anymore when setting a global (Tracer|Meter)Provider or TextMapPropagator to itself. (#2749) @@ -22,11 +29,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) -### Removed - -- Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. - Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) - ## [1.6.1] - 2022-03-28 ### Fixed @@ -1799,7 +1801,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.2...HEAD +[1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 [1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 [1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 [1.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.5.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a48d8bbc64d..8d59a106510 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 3e7bb8996ad..6fb00939c21 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index d260a60e33b..e39083834bc 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index 4f1411a9891..cc1046a4015 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 120eb41e62e..2219e1de55a 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/jaeger v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/jaeger v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 930de80aa2d..aab95489454 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 5a45f14473f..8863437a00c 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e6d9097d333..b84825fe3c4 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 google.golang.org/grpc v1.45.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index ba53122bfb3..87cb6f8f2cc 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 65a3ab932df..3d4752f1c27 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/exporters/prometheus v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk/metric v0.28.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 225d2f6798d..e9242bacf48 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/zipkin v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/zipkin v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 091b208c682..488af03c1ff 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index fdab05efd87..4d523b98225 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d643ecf73b9..823508de895 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 4b3c46a3f37..097a1e1ff00 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 54c622e3ea1..aaf6877c5da 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 35939459f37..b61df18ff7e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/proto/otlp v0.15.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0e57f0a444d..8dce2a26586 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index ddc5dcb9b32..3cda2e51100 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index c05efdd7119..480bb8ee7e6 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index aadba86c81d..a69e8582a2d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index a83141ced15..e18adc651c6 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/sdk v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index eba789c09f7..ba3c92ad5c3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel/trace v1.6.2 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index a34701e6781..fef850e7356 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 ) replace go.opentelemetry.io/otel => ../ diff --git a/sdk/go.mod b/sdk/go.mod index c0c3e98d1ef..e0777698311 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 - go.opentelemetry.io/otel/trace v1.6.1 + go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel/trace v1.6.2 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 92ac0a3aab8..b99eb0b57d1 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.1 + go.opentelemetry.io/otel/sdk v1.6.2 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 97ad4d13993..7f385d153cf 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.1 + go.opentelemetry.io/otel v1.6.2 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index 70f6bed1e8f..41bc0753cf3 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.6.1" + return "1.6.2" } diff --git a/versions.yaml b/versions.yaml index d6d593bf5fc..29d6299f8c8 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.6.1 + version: v1.6.2 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -43,7 +43,6 @@ module-sets: - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - go.opentelemetry.io/otel/metric - - go.opentelemetry.io/otel/sdk/export/metric - go.opentelemetry.io/otel/sdk/metric experimental-schema: version: v0.0.2 From 4bbf8d6bcf7f3d2765e3a2f7bcc77da00c6babfb Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Wed, 6 Apr 2022 19:13:29 -0400 Subject: [PATCH 134/886] Fix changelog entries for metrics that should not be in 1.6.2 (#2771) Signed-off-by: Anthony J Mirabella --- CHANGELOG.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2e25faf3a..5d0cb191431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,13 +19,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Removed module the `go.opentelemetry.io/otel/sdk/export/metric`. Use the `go.opentelemetry.io/otel/sdk/metric` module instead. (#2720) -## [1.6.2] - 2022-04-06 - ### Changed -- Don't panic anymore when setting a global (Tracer|Meter)Provider or TextMapPropagator to itself. (#2749) +- Don't panic anymore when setting a global MeterProvider to itself. (#2749) - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) + +## [1.6.2] - 2022-04-06 + +### Changed + +- Don't panic anymore when setting a global TracerProvider or TextMapPropagator to itself. (#2749) - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibrarySpans` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeSpans`. (#2748) From 376c23c25180f7f0406bc96a8c9f4ce023f94dd7 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 7 Apr 2022 11:40:43 -0700 Subject: [PATCH 135/886] Remove unused internal member, shows that Config.DefaultHistogramBoundaries is unused (#2765) Signed-off-by: Bogdan Drutu Co-authored-by: Chester Cheung --- exporters/prometheus/prometheus.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go index 7d31514fb5f..1de8778eb53 100644 --- a/exporters/prometheus/prometheus.go +++ b/exporters/prometheus/prometheus.go @@ -53,8 +53,6 @@ type Exporter struct { // controllers (e.g., with different resources). lock sync.RWMutex controller *controller.Controller - - defaultHistogramBoundaries []float64 } // ErrUnsupportedAggregator is returned for unrepresentable aggregator @@ -104,11 +102,10 @@ func New(config Config, controller *controller.Controller) (*Exporter, error) { } e := &Exporter{ - handler: promhttp.HandlerFor(config.Gatherer, promhttp.HandlerOpts{}), - registerer: config.Registerer, - gatherer: config.Gatherer, - controller: controller, - defaultHistogramBoundaries: config.DefaultHistogramBoundaries, + handler: promhttp.HandlerFor(config.Gatherer, promhttp.HandlerOpts{}), + registerer: config.Registerer, + gatherer: config.Gatherer, + controller: controller, } c := &collector{ From 9838bba16a364f43d9122a90600e3d6cf7c5e131 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 7 Apr 2022 13:22:19 -0700 Subject: [PATCH 136/886] Allow non-comparable global types (#2773) * Fix #2772: allow non-comparable global types The global MeterProvider, TracerProvider, and TextMapPropagator should not panic when they are set to a non-comparable implementation of each. * Add changes to changelog * No lint unused field for testing --- CHANGELOG.md | 4 +++ internal/global/state.go | 38 ++++++++++++++++------------ internal/global/state_test.go | 25 ++++++++++++++++++ metric/internal/global/state.go | 18 +++++++------ metric/internal/global/state_test.go | 17 +++++++++++++ 5 files changed, 78 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d0cb191431..7339afa2f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) +### Fixed + +- Allow non-comparable global `MeterProvider`, `TracerProvider`, and `TextMapPropagator` types to be set. (#2772, #2773) + ## [1.6.2] - 2022-04-06 ### Changed diff --git a/internal/global/state.go b/internal/global/state.go index c7119cc4134..837d3c6c45e 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -50,14 +50,17 @@ func TracerProvider() trace.TracerProvider { // SetTracerProvider is the internal implementation for global.SetTracerProvider. func SetTracerProvider(tp trace.TracerProvider) { current := TracerProvider() - if current == tp { - // Setting the provider to the prior default results in a noop. Return - // early. - Error( - errors.New("no delegate configured in tracer provider"), - "Setting tracer provider to it's current value. No delegate will be configured", - ) - return + + if _, cOk := current.(*tracerProvider); cOk { + if _, tpOk := tp.(*tracerProvider); tpOk && current == tp { + // Do not assign the default delegating TracerProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in tracer provider"), + "Setting tracer provider to it's current value. No delegate will be configured", + ) + return + } } delegateTraceOnce.Do(func() { @@ -76,14 +79,17 @@ func TextMapPropagator() propagation.TextMapPropagator { // SetTextMapPropagator is the internal implementation for global.SetTextMapPropagator. func SetTextMapPropagator(p propagation.TextMapPropagator) { current := TextMapPropagator() - if current == p { - // Setting the provider to the prior default results in a noop. Return - // early. - Error( - errors.New("no delegate configured in text map propagator"), - "Setting text map propagator to it's current value. No delegate will be configured", - ) - return + + if _, cOk := current.(*textMapPropagator); cOk { + if _, pOk := p.(*textMapPropagator); pOk && current == p { + // Do not assign the default delegating TextMapPropagator to + // delegate to itself. + Error( + errors.New("no delegate configured in text map propagator"), + "Setting text map propagator to it's current value. No delegate will be configured", + ) + return + } } // For the textMapPropagator already returned by TextMapPropagator diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 395f6c5e864..f26f9d8c5a4 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -17,10 +17,18 @@ package global import ( "testing" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) +type nonComparableTracerProvider struct { + trace.TracerProvider + + nonComparable func() //nolint:structcheck,unused // This is not called. +} + func TestSetTracerProvider(t *testing.T) { t.Run("Set With default is a noop", func(t *testing.T) { ResetForTest(t) @@ -59,6 +67,14 @@ func TestSetTracerProvider(t *testing.T) { t.Fatal("The delegated tracer providers should have a delegate") } }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + ResetForTest(t) + + tp := nonComparableTracerProvider{} + SetTracerProvider(tp) + assert.NotPanics(t, func() { SetTracerProvider(tp) }) + }) } func TestSetTextMapPropagator(t *testing.T) { @@ -99,4 +115,13 @@ func TestSetTextMapPropagator(t *testing.T) { t.Fatal("The delegated TextMapPropagators should have a delegate") } }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + ResetForTest(t) + + // A composite TextMapPropagator is not comparable. + prop := propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}) + SetTextMapPropagator(prop) + assert.NotPanics(t, func() { SetTextMapPropagator(prop) }) + }) } diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go index 0f0f0b11730..47c0d787d8a 100644 --- a/metric/internal/global/state.go +++ b/metric/internal/global/state.go @@ -41,14 +41,16 @@ func MeterProvider() metric.MeterProvider { // SetMeterProvider is the internal implementation for global.SetMeterProvider. func SetMeterProvider(mp metric.MeterProvider) { current := MeterProvider() - if current == mp { - // Setting the provider to the prior default results in a noop. Return - // early. - global.Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", - ) - return + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + global.Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } } delegateMeterOnce.Do(func() { diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go index bda1e57da19..28b9ea1645a 100644 --- a/metric/internal/global/state_test.go +++ b/metric/internal/global/state_test.go @@ -18,6 +18,9 @@ import ( "sync" "testing" + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/nonrecording" ) @@ -26,6 +29,12 @@ func resetGlobalMeterProvider() { delegateMeterOnce = sync.Once{} } +type nonComparableMeterProvider struct { + metric.MeterProvider + + nonComparable func() //nolint:structcheck,unused // This is not called. +} + func TestSetMeterProvider(t *testing.T) { t.Cleanup(resetGlobalMeterProvider) @@ -67,4 +76,12 @@ func TestSetMeterProvider(t *testing.T) { t.Fatal("The delegated meter providers should have a delegate") } }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + resetGlobalMeterProvider() + + mp := nonComparableMeterProvider{} + SetMeterProvider(mp) + assert.NotPanics(t, func() { SetMeterProvider(mp) }) + }) } From 8c0951ea94cb20bd9e2338b8fdc20036b8cf995b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 7 Apr 2022 13:40:14 -0700 Subject: [PATCH 137/886] Release v1.6.3 (#2775) * Update stable-v1 version in versions.yaml * Update changelog for release * Prepare stable-v1 for version v1.6.3 --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 6 +++--- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 6 +++--- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 6 +++--- example/otel-collector/go.mod | 8 ++++---- example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 2 +- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 4 ++-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 2 +- 30 files changed, 82 insertions(+), 79 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7339afa2f05..381ce2e3281 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Upgrade `go.opentelemetry.io/proto/otlp` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` from `v0.12.1` to `v0.15.0`. This replaces the use of the now deprecated `InstrumentationLibrary` and `InstrumentationLibraryMetrics` types and fields in the proto library with the equivalent `InstrumentationScope` and `ScopeMetrics`. (#2748) +## [1.6.3] - 2022-04-07 + ### Fixed - Allow non-comparable global `MeterProvider`, `TracerProvider`, and `TextMapPropagator` types to be set. (#2772, #2773) @@ -1809,7 +1811,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.2...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.3...HEAD +[1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 [1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 [1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 [1.6.0/0.28.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 8d59a106510..7757f1fbf3b 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 6fb00939c21..9c2200735db 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index e39083834bc..5d669f351c4 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index cc1046a4015..a4418942414 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 2219e1de55a..7f4bfc853ae 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/jaeger v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/jaeger v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index aab95489454..2759dc8fb80 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 8863437a00c..8403f1d9ebc 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/bridge/opencensus v0.28.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index b84825fe3c4..425be7374d8 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 google.golang.org/grpc v1.45.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 87cb6f8f2cc..266846853bc 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 3d4752f1c27..00a5a53c2d6 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/exporters/prometheus v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk/metric v0.28.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index e9242bacf48..bee194c5a8c 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/zipkin v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/zipkin v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 488af03c1ff..724a3a07816 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 4d523b98225..9c637ec7d3a 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 823508de895..2d4d30825a4 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 097a1e1ff00..3e6c89b89a0 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index aaf6877c5da..136d3253adb 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index b61df18ff7e..b515d648381 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/proto/otlp v0.15.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 8dce2a26586..54f33907dcf 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3cda2e51100..37b92428481 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 480bb8ee7e6..da0474818ba 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index a69e8582a2d..8a960973ac4 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index e18adc651c6..9522e3bb11d 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/sdk v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index ba3c92ad5c3..34e9276f6fa 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel/trace v1.6.3 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index fef850e7356..cbc5cf20905 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 ) replace go.opentelemetry.io/otel => ../ diff --git a/sdk/go.mod b/sdk/go.mod index e0777698311..b839715678c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 - go.opentelemetry.io/otel/trace v1.6.2 + go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel/trace v1.6.3 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index b99eb0b57d1..d8aa8720d5e 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk v1.6.2 + go.opentelemetry.io/otel/sdk v1.6.3 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 7f385d153cf..2c8851bb0d1 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.2 + go.opentelemetry.io/otel v1.6.3 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index 41bc0753cf3..e36a226325a 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.6.2" + return "1.6.3" } diff --git a/versions.yaml b/versions.yaml index 29d6299f8c8..f97bd571b12 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.6.2 + version: v1.6.3 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing From 33a46734441193c31d65c51bfa3365b5608868e8 Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Mon, 11 Apr 2022 19:46:26 -0400 Subject: [PATCH 138/886] Release prep for metric/v0.29.0 (#2782) * Update changelog and versions for metric/v0.29.0 release Signed-off-by: Anthony J Mirabella * Prepare experimental-metrics for version v0.29.0 * Prepare bridge for version v0.29.0 --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 4 ++-- bridge/opencensus/test/go.mod | 2 +- example/opencensus/go.mod | 6 +++--- example/prometheus/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- sdk/metric/go.mod | 2 +- versions.yaml | 4 ++-- 12 files changed, 26 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 381ce2e3281..8a4a020f057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [0.29.0] - 2022-04-11 + ### Added - The metrics global package was added back into several test files. (#2764) @@ -1811,7 +1813,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.6.3...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/metric/v0.29.0...HEAD +[0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 [1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 [1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 [1.6.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 7757f1fbf3b..468ec0fb503 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 go.opentelemetry.io/otel/trace v1.6.3 ) diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 9c2200735db..2780a4ddb21 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/bridge/opencensus v0.28.0 + go.opentelemetry.io/otel/bridge/opencensus v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/trace v1.6.3 ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 8403f1d9ebc..9ae6e9d54bb 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -11,11 +11,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/bridge/opencensus v0.28.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 + go.opentelemetry.io/otel/bridge/opencensus v0.29.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.29.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 ) replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 00a5a53c2d6..80b68b0351d 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -10,9 +10,9 @@ replace ( require ( go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/prometheus v0.28.0 - go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/exporters/prometheus v0.29.0 + go.opentelemetry.io/otel/metric v0.29.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9c637ec7d3a..732ae1e22a5 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -7,9 +7,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2d4d30825a4..068637c2534 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,10 +6,10 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.3 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.29.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3e6c89b89a0..501200ad6d5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.28.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/proto/otlp v0.15.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 37b92428481..4db0f072a95 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,9 +6,9 @@ require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index da0474818ba..82efdb5dea7 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -10,9 +10,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.29.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index d8aa8720d5e..14031ee16d6 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -42,7 +42,7 @@ require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 ) diff --git a/versions.yaml b/versions.yaml index f97bd571b12..286c8c077b9 100644 --- a/versions.yaml +++ b/versions.yaml @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.28.0 + version: v0.29.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -49,7 +49,7 @@ module-sets: modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.28.0 + version: v0.29.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From db7fd1bb51ce6ed1171cac15eeecb6871dbbb80a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 12 Apr 2022 13:40:43 -0700 Subject: [PATCH 139/886] Add semantic conventions generation Make target (#2758) * No wrap RELEASING Semantic Convention Generation section * Initial generator * Update template render * Add exception and schema templates * Add semconv/internal http unification * Add http template * Add licenses header * Embed the templates * Update static version in schema tmpl * Add semconv-generate target to Makefile Use this target to generate versions of the semconv packages. * Generate semconv packages * Update RELEASING to use make semconv-generate * Add comments to semconvkit * Make SemVer a method instead of a field * Remove semconv/v* from codecov * Fix lint for semconvkit main.go * Fix documentation of validateHTTPStatusCode Co-authored-by: Chester Cheung --- Makefile | 15 +- RELEASING.md | 40 +- internal/tools/semconvkit/main.go | 84 ++ .../tools/semconvkit/templates/doc.go.tmpl | 20 + .../semconvkit/templates/exception.go.tmpl | 20 + .../tools/semconvkit/templates/http.go.tmpl | 114 ++ .../tools/semconvkit/templates/schema.go.tmpl | 20 + semconv/internal/http.go | 337 +++++ semconv/{v1.4.0 => internal}/http_test.go | 44 +- semconv/v1.4.0/http.go | 273 +--- semconv/v1.5.0/http.go | 273 +--- semconv/v1.5.0/http_test.go | 1210 ----------------- semconv/v1.6.1/http.go | 273 +--- semconv/v1.6.1/http_test.go | 1209 ---------------- semconv/v1.7.0/http.go | 276 +--- semconv/v1.7.0/http_test.go | 1210 ----------------- 16 files changed, 809 insertions(+), 4609 deletions(-) create mode 100644 internal/tools/semconvkit/main.go create mode 100644 internal/tools/semconvkit/templates/doc.go.tmpl create mode 100644 internal/tools/semconvkit/templates/exception.go.tmpl create mode 100644 internal/tools/semconvkit/templates/http.go.tmpl create mode 100644 internal/tools/semconvkit/templates/schema.go.tmpl create mode 100644 semconv/internal/http.go rename semconv/{v1.4.0 => internal}/http_test.go (93%) delete mode 100644 semconv/v1.5.0/http_test.go delete mode 100644 semconv/v1.6.1/http_test.go delete mode 100644 semconv/v1.7.0/http_test.go diff --git a/Makefile b/Makefile index 1b80eb72adf..92e3ce57864 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,9 @@ $(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen CROSSLINK = $(TOOLS)/crosslink $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink +SEMCONVKIT = $(TOOLS)/semconvkit +$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit + DBOTCONF = $(TOOLS)/dbotconf $(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf @@ -69,7 +72,7 @@ GOJQ = $(TOOLS)/gojq $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) # Build @@ -126,6 +129,7 @@ test-coverage: | $(GOCOVMERGE) (cd "$${dir}" && \ $(GO) list ./... \ | grep -v third_party \ + | grep -v 'semconv/v.*' \ | xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \ $(GO) tool cover -html=coverage.out -o coverage.html); \ done; \ @@ -197,6 +201,15 @@ check-clean-work-tree: exit 1; \ fi +SEMCONVPKG ?= "semconv/" +.PHONY: semconv-generate +semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) + @[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) + @[ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) + @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/trace" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/resource" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + @$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" + .PHONY: prerelease prerelease: | $(MULTIMOD) @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) diff --git a/RELEASING.md b/RELEASING.md index e3bff66c6a9..063656fc72b 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,35 +2,23 @@ ## Semantic Convention Generation -If a new version of the OpenTelemetry Specification has been released it will be necessary to generate a new -semantic convention package from the YAML definitions in the specification repository. There is a `semconvgen` utility -installed by `make tools` that can be used to generate the a package with the name matching the specification -version number under the `semconv` package. This will ideally be done soon after the specification release is -tagged. Make sure that the specification repo contains a checkout of the the latest tagged release so that the -generated files match the released semantic conventions. +New versions of the [OpenTelemetry specification] mean new versions of the `semconv` package need to be generated. +The `semconv-generate` make target is used for this. -There are currently two categories of semantic conventions that must be generated, `resource` and `trace`. +1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag. +2. Run the `make semconv-generate ...` target from this repository. -``` -.tools/semconvgen -i /path/to/specification/repo/semantic_conventions/resource -t semconv/template.j2 -.tools/semconvgen -i /path/to/specification/repo/semantic_conventions/trace -t semconv/template.j2 -``` - -Using default values for all options other than `input` will result in using the `template.j2` template to -generate `resource.go` and `trace.go` in `/path/to/otelgo/repo/semconv/`. +For example, -There are several ancillary files that are not generated and should be copied into the new package from the -prior package, with updates made as appropriate to canonical import path statements and constant values. -These files include: - -* doc.go -* exception.go -* http(_test)?.go -* schema.go +```sh +export TAG="v1.7.0" # Change to the release version you are generating. +export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" +cd "$OTEL_SPEC_REPO" && git checkout "tags/$TAG" && cd - +make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. +``` -Uses of the previous schema version in this repository should be updated to use the newly generated version. -No tooling for this exists at present, so use find/replace in your editor of choice or craft a `grep | sed` -pipeline if you like living on the edge. +This should create a new sub-package of [`semconv`](./semconv). +Ensure things look correct before submitting a pull request to include the addition. ## Pre-Release @@ -130,3 +118,5 @@ Once verified be sure to [make a release for the `contrib` repository](https://g Update [the documentation](./website_docs) for [the OpenTelemetry website](https://opentelemetry.io/docs/go/). Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. + +[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification diff --git a/internal/tools/semconvkit/main.go b/internal/tools/semconvkit/main.go new file mode 100644 index 00000000000..913a9ac126f --- /dev/null +++ b/internal/tools/semconvkit/main.go @@ -0,0 +1,84 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconvkit is used to generate opentelemetry-go specific semantic +// convention code. It is expected to be used in with the semconvgen utility +// (go.opentelemetry.io/build-tools/semconvgen) to completely generate +// versioned sub-packages of go.opentelemetry.io/otel/semconv. +package main + +import ( + "embed" + "flag" + "log" + "os" + "path/filepath" + "strings" + "text/template" +) + +var ( + out = flag.String("output", "./", "output directory") + tag = flag.String("tag", "", "OpenTelemetry tagged version") + + //go:embed templates/*.tmpl + rootFS embed.FS +) + +// SemanticConventions are information about the semantic conventions being +// generated. +type SemanticConventions struct { + // TagVer is the tagged version (i.e. v1.7.0 and not 1.7.0). + TagVer string +} + +func (sc SemanticConventions) SemVer() string { + return strings.TrimPrefix(*tag, "v") +} + +// render renders all templates to the dest directory using the data. +func render(dest string, data *SemanticConventions) error { + tmpls, err := template.ParseFS(rootFS, "templates/*.tmpl") + if err != nil { + return err + } + for _, tmpl := range tmpls.Templates() { + target := filepath.Join(dest, strings.TrimSuffix(tmpl.Name(), ".tmpl")) + wr, err := os.Create(target) + if err != nil { + return err + } + + err = tmpl.Execute(wr, data) + if err != nil { + return err + } + } + + return nil +} + +func main() { + flag.Parse() + + if *tag == "" { + log.Fatalf("invalid tag: %q", *tag) + } + + sc := &SemanticConventions{TagVer: *tag} + + if err := render(*out, sc); err != nil { + log.Fatal(err) + } +} diff --git a/internal/tools/semconvkit/templates/doc.go.tmpl b/internal/tools/semconvkit/templates/doc.go.tmpl new file mode 100644 index 00000000000..c8fd7b218ab --- /dev/null +++ b/internal/tools/semconvkit/templates/doc.go.tmpl @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the {{.TagVer}} version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" diff --git a/internal/tools/semconvkit/templates/exception.go.tmpl b/internal/tools/semconvkit/templates/exception.go.tmpl new file mode 100644 index 00000000000..9aa3f5fe65a --- /dev/null +++ b/internal/tools/semconvkit/templates/exception.go.tmpl @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/internal/tools/semconvkit/templates/http.go.tmpl b/internal/tools/semconvkit/templates/http.go.tmpl new file mode 100644 index 00000000000..e1334d501d4 --- /dev/null +++ b/internal/tools/semconvkit/templates/http.go.tmpl @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/internal/tools/semconvkit/templates/schema.go.tmpl b/internal/tools/semconvkit/templates/schema.go.tmpl new file mode 100644 index 00000000000..b23608e02ad --- /dev/null +++ b/internal/tools/semconvkit/templates/schema.go.tmpl @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/{{.SemVer}}" diff --git a/semconv/internal/http.go b/semconv/internal/http.go new file mode 100644 index 00000000000..864ba3f39df --- /dev/null +++ b/semconv/internal/http.go @@ -0,0 +1,337 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal" + +import ( + "fmt" + "net" + "net/http" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" +) + +// SemanticConventions are the semantic convention values defined for a +// version of the OpenTelemetry specification. +type SemanticConventions struct { + EnduserIDKey attribute.Key + HTTPClientIPKey attribute.Key + HTTPFlavorKey attribute.Key + HTTPHostKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPServerNameKey attribute.Key + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + HTTPUserAgentKey attribute.Key + NetHostIPKey attribute.Key + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerIPKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetTransportIP attribute.KeyValue + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportUnix attribute.KeyValue +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func (sc *SemanticConventions) NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + attrs := []attribute.KeyValue{} + + switch network { + case "tcp", "tcp4", "tcp6": + attrs = append(attrs, sc.NetTransportTCP) + case "udp", "udp4", "udp6": + attrs = append(attrs, sc.NetTransportUDP) + case "ip", "ip4", "ip6": + attrs = append(attrs, sc.NetTransportIP) + case "unix", "unixgram", "unixpacket": + attrs = append(attrs, sc.NetTransportUnix) + default: + attrs = append(attrs, sc.NetTransportOther) + } + + peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) + if peerIP != "" { + attrs = append(attrs, sc.NetPeerIPKey.String(peerIP)) + } + if peerName != "" { + attrs = append(attrs, sc.NetPeerNameKey.String(peerName)) + } + if peerPort != 0 { + attrs = append(attrs, sc.NetPeerPortKey.Int(peerPort)) + } + + hostIP, hostName, hostPort := "", "", 0 + for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { + hostIP, hostName, hostPort = hostIPNamePort(someHost) + if hostIP != "" || hostName != "" || hostPort != 0 { + break + } + } + if hostIP != "" { + attrs = append(attrs, sc.NetHostIPKey.String(hostIP)) + } + if hostName != "" { + attrs = append(attrs, sc.NetHostNameKey.String(hostName)) + } + if hostPort != 0 { + attrs = append(attrs, sc.NetHostPortKey.Int(hostPort)) + } + + return attrs +} + +// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. +// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized +// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the +// host portion will instead be returned in `name`. +func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { + var ( + hostPart, portPart string + parsedPort uint64 + err error + ) + if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { + hostPart, portPart = hostWithPort, "" + } + if parsedIP := net.ParseIP(hostPart); parsedIP != nil { + ip = parsedIP.String() + } else { + name = hostPart + } + if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { + port = int(parsedPort) + } + return +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + if username, _, ok := request.BasicAuth(); ok { + return []attribute.KeyValue{sc.EnduserIDKey.String(username)} + } + return nil +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + attrs := []attribute.KeyValue{} + + if request.Method != "" { + attrs = append(attrs, sc.HTTPMethodKey.String(request.Method)) + } else { + attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet)) + } + + // remove any username/password info that may be in the URL + // before adding it to the attributes + userinfo := request.URL.User + request.URL.User = nil + + attrs = append(attrs, sc.HTTPURLKey.String(request.URL.String())) + + // restore any username/password info that was removed + request.URL.User = userinfo + + return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) +} + +func (sc *SemanticConventions) httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + attrs := []attribute.KeyValue{} + if ua := request.UserAgent(); ua != "" { + attrs = append(attrs, sc.HTTPUserAgentKey.String(ua)) + } + if request.ContentLength > 0 { + attrs = append(attrs, sc.HTTPRequestContentLengthKey.Int64(request.ContentLength)) + } + + return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...) +} + +func (sc *SemanticConventions) httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality + attrs := []attribute.KeyValue{} + + if request.TLS != nil { + attrs = append(attrs, sc.HTTPSchemeHTTPS) + } else { + attrs = append(attrs, sc.HTTPSchemeHTTP) + } + + if request.Host != "" { + attrs = append(attrs, sc.HTTPHostKey.String(request.Host)) + } else if request.URL != nil && request.URL.Host != "" { + attrs = append(attrs, sc.HTTPHostKey.String(request.URL.Host)) + } + + flavor := "" + if request.ProtoMajor == 1 { + flavor = fmt.Sprintf("1.%d", request.ProtoMinor) + } else if request.ProtoMajor == 2 { + flavor = "2" + } + if flavor != "" { + attrs = append(attrs, sc.HTTPFlavorKey.String(flavor)) + } + + return attrs +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + attrs := []attribute.KeyValue{} + if serverName != "" { + attrs = append(attrs, sc.HTTPServerNameKey.String(serverName)) + } + return append(attrs, sc.httpBasicAttributesFromHTTPRequest(request)...) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + attrs := []attribute.KeyValue{ + sc.HTTPMethodKey.String(request.Method), + sc.HTTPTargetKey.String(request.RequestURI), + } + + if serverName != "" { + attrs = append(attrs, sc.HTTPServerNameKey.String(serverName)) + } + if route != "" { + attrs = append(attrs, sc.HTTPRouteKey.String(route)) + } + if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { + if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { + attrs = append(attrs, sc.HTTPClientIPKey.String(addresses[0])) + } + } + + return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func (sc *SemanticConventions) HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + attrs := []attribute.KeyValue{ + sc.HTTPStatusCodeKey.Int(code), + } + return attrs +} + +type codeRange struct { + fromInclusive int + toInclusive int +} + +func (r codeRange) contains(code int) bool { + return r.fromInclusive <= code && code <= r.toInclusive +} + +var validRangesPerCategory = map[int][]codeRange{ + 1: { + {http.StatusContinue, http.StatusEarlyHints}, + }, + 2: { + {http.StatusOK, http.StatusAlreadyReported}, + {http.StatusIMUsed, http.StatusIMUsed}, + }, + 3: { + {http.StatusMultipleChoices, http.StatusUseProxy}, + {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, + }, + 4: { + {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… + {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, + {http.StatusPreconditionRequired, http.StatusTooManyRequests}, + {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, + {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, + }, + 5: { + {http.StatusInternalServerError, http.StatusLoopDetected}, + {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, + }, +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + spanCode, valid := validateHTTPStatusCode(code) + if !valid { + return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) + } + return spanCode, "" +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + spanCode, valid := validateHTTPStatusCode(code) + if !valid { + return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) + } + category := code / 100 + if spanKind == trace.SpanKindServer && category == 4 { + return codes.Unset, "" + } + return spanCode, "" +} + +// validateHTTPStatusCode validates the HTTP status code and returns +// corresponding span status code. If the `code` is not a valid HTTP status +// code, returns span status Error and false. +func validateHTTPStatusCode(code int) (codes.Code, bool) { + category := code / 100 + ranges, ok := validRangesPerCategory[category] + if !ok { + return codes.Error, false + } + ok = false + for _, crange := range ranges { + ok = crange.contains(code) + if ok { + break + } + } + if !ok { + return codes.Error, false + } + if category > 0 && category < 4 { + return codes.Unset, true + } + return codes.Error, true +} diff --git a/semconv/v1.4.0/http_test.go b/semconv/internal/http_test.go similarity index 93% rename from semconv/v1.4.0/http_test.go rename to semconv/internal/http_test.go index 2a76bd68714..29b1c49521b 100644 --- a/semconv/v1.4.0/http_test.go +++ b/semconv/internal/http_test.go @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package semconv +package internal import ( "crypto/tls" @@ -36,6 +36,34 @@ const ( withTLS ) +var sc = &SemanticConventions{ + EnduserIDKey: attribute.Key("enduser.id"), + HTTPClientIPKey: attribute.Key("http.client_ip"), + HTTPFlavorKey: attribute.Key("http.flavor"), + HTTPHostKey: attribute.Key("http.host"), + HTTPMethodKey: attribute.Key("http.method"), + HTTPRequestContentLengthKey: attribute.Key("http.request_content_length"), + HTTPRouteKey: attribute.Key("http.route"), + HTTPSchemeHTTP: attribute.String("http.scheme", "http"), + HTTPSchemeHTTPS: attribute.String("http.scheme", "https"), + HTTPServerNameKey: attribute.Key("http.server_name"), + HTTPStatusCodeKey: attribute.Key("http.status_code"), + HTTPTargetKey: attribute.Key("http.target"), + HTTPURLKey: attribute.Key("http.url"), + HTTPUserAgentKey: attribute.Key("http.user_agent"), + NetHostIPKey: attribute.Key("net.host.ip"), + NetHostNameKey: attribute.Key("net.host.name"), + NetHostPortKey: attribute.Key("net.host.port"), + NetPeerIPKey: attribute.Key("net.peer.ip"), + NetPeerNameKey: attribute.Key("net.peer.name"), + NetPeerPortKey: attribute.Key("net.peer.port"), + NetTransportIP: attribute.String("net.transport", "ip"), + NetTransportOther: attribute.String("net.transport", "other"), + NetTransportTCP: attribute.String("net.transport", "ip_tcp"), + NetTransportUDP: attribute.String("net.transport", "ip_udp"), + NetTransportUnix: attribute.String("net.transport", "unix"), +} + func TestNetAttributesFromHTTPRequest(t *testing.T) { type testcase struct { name string @@ -551,7 +579,7 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, noTLS) - got := NetAttributesFromHTTPRequest(tc.network, r) + got := sc.NetAttributesFromHTTPRequest(tc.network, r) if diff := cmp.Diff( tc.expected, got, @@ -565,11 +593,11 @@ func TestNetAttributesFromHTTPRequest(t *testing.T) { func TestEndUserAttributesFromHTTPRequest(t *testing.T) { r := testRequest("GET", "/user/123", "HTTP/1.1", "", "", nil, http.Header{}, withTLS) var expected []attribute.KeyValue - got := EndUserAttributesFromHTTPRequest(r) + got := sc.EndUserAttributesFromHTTPRequest(r) assert.ElementsMatch(t, expected, got) r.SetBasicAuth("admin", "password") expected = []attribute.KeyValue{attribute.String("enduser.id", "admin")} - got = EndUserAttributesFromHTTPRequest(r) + got = sc.EndUserAttributesFromHTTPRequest(r) assert.ElementsMatch(t, expected, got) } @@ -860,7 +888,7 @@ func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { for idx, tc := range testcases { r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) r.ContentLength = tc.contentLength - got := HTTPServerAttributesFromHTTPRequest(tc.serverName, tc.route, r) + got := sc.HTTPServerAttributesFromHTTPRequest(tc.serverName, tc.route, r) assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) } } @@ -869,13 +897,13 @@ func TestHTTPAttributesFromHTTPStatusCode(t *testing.T) { expected := []attribute.KeyValue{ attribute.Int("http.status_code", 404), } - got := HTTPAttributesFromHTTPStatusCode(http.StatusNotFound) + got := sc.HTTPAttributesFromHTTPStatusCode(http.StatusNotFound) assertElementsMatch(t, expected, got, "with valid HTTP status code") assert.ElementsMatch(t, expected, got) expected = []attribute.KeyValue{ attribute.Int("http.status_code", 499), } - got = HTTPAttributesFromHTTPStatusCode(499) + got = sc.HTTPAttributesFromHTTPStatusCode(499) assertElementsMatch(t, expected, got, "with invalid HTTP status code") } @@ -1203,7 +1231,7 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { t.Run(tc.name, func(t *testing.T) { r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) r.ContentLength = tc.contentLength - got := HTTPClientAttributesFromHTTPRequest(r) + got := sc.HTTPClientAttributesFromHTTPRequest(r) assert.ElementsMatch(t, tc.expected, got) }) } diff --git a/semconv/v1.4.0/http.go b/semconv/v1.4.0/http.go index a9032ccc3c2..8d814edc26a 100644 --- a/semconv/v1.4.0/http.go +++ b/semconv/v1.4.0/http.go @@ -15,14 +15,11 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.4.0" import ( - "fmt" - "net" "net/http" - "strconv" - "strings" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" "go.opentelemetry.io/otel/trace" ) @@ -32,165 +29,60 @@ var ( HTTPSchemeHTTPS = HTTPSchemeKey.String("https") ) +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + // NetAttributesFromHTTPRequest generates attributes of the net // namespace as specified by the OpenTelemetry specification for a // span. The network parameter is a string that net.Dial function // from standard library can understand. func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - switch network { - case "tcp", "tcp4", "tcp6": - attrs = append(attrs, NetTransportTCP) - case "udp", "udp4", "udp6": - attrs = append(attrs, NetTransportUDP) - case "ip", "ip4", "ip6": - attrs = append(attrs, NetTransportIP) - case "unix", "unixgram", "unixpacket": - attrs = append(attrs, NetTransportUnix) - default: - attrs = append(attrs, NetTransportOther) - } - - peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) - if peerIP != "" { - attrs = append(attrs, NetPeerIPKey.String(peerIP)) - } - if peerName != "" { - attrs = append(attrs, NetPeerNameKey.String(peerName)) - } - if peerPort != 0 { - attrs = append(attrs, NetPeerPortKey.Int(peerPort)) - } - - hostIP, hostName, hostPort := "", "", 0 - for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { - hostIP, hostName, hostPort = hostIPNamePort(someHost) - if hostIP != "" || hostName != "" || hostPort != 0 { - break - } - } - if hostIP != "" { - attrs = append(attrs, NetHostIPKey.String(hostIP)) - } - if hostName != "" { - attrs = append(attrs, NetHostNameKey.String(hostName)) - } - if hostPort != 0 { - attrs = append(attrs, NetHostPortKey.Int(hostPort)) - } - - return attrs -} - -// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. -// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized -// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the -// host portion will instead be returned in `name`. -func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { - var ( - hostPart, portPart string - parsedPort uint64 - err error - ) - if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { - hostPart, portPart = hostWithPort, "" - } - if parsedIP := net.ParseIP(hostPart); parsedIP != nil { - ip = parsedIP.String() - } else { - name = hostPart - } - if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) - } - return + return sc.NetAttributesFromHTTPRequest(network, request) } // EndUserAttributesFromHTTPRequest generates attributes of the // enduser namespace as specified by the OpenTelemetry specification // for a span. func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - if username, _, ok := request.BasicAuth(); ok { - return []attribute.KeyValue{EnduserIDKey.String(username)} - } - return nil + return sc.EndUserAttributesFromHTTPRequest(request) } // HTTPClientAttributesFromHTTPRequest generates attributes of the // http namespace as specified by the OpenTelemetry specification for // a span on the client side. func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - if request.Method != "" { - attrs = append(attrs, HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, HTTPMethodKey.String(http.MethodGet)) - } - - // remove any username/password info that may be in the URL - // before adding it to the attributes - userinfo := request.URL.User - request.URL.User = nil - - attrs = append(attrs, HTTPURLKey.String(request.URL.String())) - - // restore any username/password info that was removed - request.URL.User = userinfo - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) -} - -func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if ua := request.UserAgent(); ua != "" { - attrs = append(attrs, HTTPUserAgentKey.String(ua)) - } - if request.ContentLength > 0 { - attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength)) - } - - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) -} - -func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality - attrs := []attribute.KeyValue{} - - if request.TLS != nil { - attrs = append(attrs, HTTPSchemeHTTPS) - } else { - attrs = append(attrs, HTTPSchemeHTTP) - } - - if request.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.Host)) - } else if request.URL != nil && request.URL.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) - } - - flavor := "" - if request.ProtoMajor == 1 { - flavor = fmt.Sprintf("1.%d", request.ProtoMinor) - } else if request.ProtoMajor == 2 { - flavor = "2" - } - if flavor != "" { - attrs = append(attrs, HTTPFlavorKey.String(flavor)) - } - - return attrs + return sc.HTTPClientAttributesFromHTTPRequest(request) } // HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes // to be used with server-side HTTP metrics. func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) } // HTTPServerAttributesFromHTTPRequest generates attributes of the @@ -198,116 +90,25 @@ func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http. // a span on the server side. Currently, only basic authentication is // supported. func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPMethodKey.String(request.Method), - HTTPTargetKey.String(request.RequestURI), - } - - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - if route != "" { - attrs = append(attrs, HTTPRouteKey.String(route)) - } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, HTTPClientIPKey.String(addresses[0])) - } - } - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) } // HTTPAttributesFromHTTPStatusCode generates attributes of the http // namespace as specified by the OpenTelemetry specification for a // span. func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPStatusCodeKey.Int(code), - } - return attrs -} - -type codeRange struct { - fromInclusive int - toInclusive int -} - -func (r codeRange) contains(code int) bool { - return r.fromInclusive <= code && code <= r.toInclusive -} - -var validRangesPerCategory = map[int][]codeRange{ - 1: { - {http.StatusContinue, http.StatusEarlyHints}, - }, - 2: { - {http.StatusOK, http.StatusAlreadyReported}, - {http.StatusIMUsed, http.StatusIMUsed}, - }, - 3: { - {http.StatusMultipleChoices, http.StatusUseProxy}, - {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, - }, - 4: { - {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… - {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, - {http.StatusPreconditionRequired, http.StatusTooManyRequests}, - {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, - {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, - }, - 5: { - {http.StatusInternalServerError, http.StatusLoopDetected}, - {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, - }, + return sc.HTTPAttributesFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCode generates a status code and a message // as specified by the OpenTelemetry specification for a span. func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - return spanCode, "" + return internal.SpanStatusFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message // as specified by the OpenTelemetry specification for a span. // Exclude 4xx for SERVER to set the appropriate status. func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - category := code / 100 - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset, "" - } - return spanCode, "" -} - -// Validates the HTTP status code and returns corresponding span status code. -// If the `code` is not a valid HTTP status code, returns span status Error -// and false. -func validateHTTPStatusCode(code int) (codes.Code, bool) { - category := code / 100 - ranges, ok := validRangesPerCategory[category] - if !ok { - return codes.Error, false - } - ok = false - for _, crange := range ranges { - ok = crange.contains(code) - if ok { - break - } - } - if !ok { - return codes.Error, false - } - if category > 0 && category < 4 { - return codes.Unset, true - } - return codes.Error, true + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) } diff --git a/semconv/v1.5.0/http.go b/semconv/v1.5.0/http.go index 114e24b0512..c2fe83b530a 100644 --- a/semconv/v1.5.0/http.go +++ b/semconv/v1.5.0/http.go @@ -15,14 +15,11 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.5.0" import ( - "fmt" - "net" "net/http" - "strconv" - "strings" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" "go.opentelemetry.io/otel/trace" ) @@ -32,165 +29,60 @@ var ( HTTPSchemeHTTPS = HTTPSchemeKey.String("https") ) +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + // NetAttributesFromHTTPRequest generates attributes of the net // namespace as specified by the OpenTelemetry specification for a // span. The network parameter is a string that net.Dial function // from standard library can understand. func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - switch network { - case "tcp", "tcp4", "tcp6": - attrs = append(attrs, NetTransportTCP) - case "udp", "udp4", "udp6": - attrs = append(attrs, NetTransportUDP) - case "ip", "ip4", "ip6": - attrs = append(attrs, NetTransportIP) - case "unix", "unixgram", "unixpacket": - attrs = append(attrs, NetTransportUnix) - default: - attrs = append(attrs, NetTransportOther) - } - - peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) - if peerIP != "" { - attrs = append(attrs, NetPeerIPKey.String(peerIP)) - } - if peerName != "" { - attrs = append(attrs, NetPeerNameKey.String(peerName)) - } - if peerPort != 0 { - attrs = append(attrs, NetPeerPortKey.Int(peerPort)) - } - - hostIP, hostName, hostPort := "", "", 0 - for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { - hostIP, hostName, hostPort = hostIPNamePort(someHost) - if hostIP != "" || hostName != "" || hostPort != 0 { - break - } - } - if hostIP != "" { - attrs = append(attrs, NetHostIPKey.String(hostIP)) - } - if hostName != "" { - attrs = append(attrs, NetHostNameKey.String(hostName)) - } - if hostPort != 0 { - attrs = append(attrs, NetHostPortKey.Int(hostPort)) - } - - return attrs -} - -// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. -// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized -// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the -// host portion will instead be returned in `name`. -func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { - var ( - hostPart, portPart string - parsedPort uint64 - err error - ) - if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { - hostPart, portPart = hostWithPort, "" - } - if parsedIP := net.ParseIP(hostPart); parsedIP != nil { - ip = parsedIP.String() - } else { - name = hostPart - } - if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) - } - return + return sc.NetAttributesFromHTTPRequest(network, request) } // EndUserAttributesFromHTTPRequest generates attributes of the // enduser namespace as specified by the OpenTelemetry specification // for a span. func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - if username, _, ok := request.BasicAuth(); ok { - return []attribute.KeyValue{EnduserIDKey.String(username)} - } - return nil + return sc.EndUserAttributesFromHTTPRequest(request) } // HTTPClientAttributesFromHTTPRequest generates attributes of the // http namespace as specified by the OpenTelemetry specification for // a span on the client side. func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - if request.Method != "" { - attrs = append(attrs, HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, HTTPMethodKey.String(http.MethodGet)) - } - - // remove any username/password info that may be in the URL - // before adding it to the attributes - userinfo := request.URL.User - request.URL.User = nil - - attrs = append(attrs, HTTPURLKey.String(request.URL.String())) - - // restore any username/password info that was removed - request.URL.User = userinfo - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) -} - -func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if ua := request.UserAgent(); ua != "" { - attrs = append(attrs, HTTPUserAgentKey.String(ua)) - } - if request.ContentLength > 0 { - attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength)) - } - - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) -} - -func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality - attrs := []attribute.KeyValue{} - - if request.TLS != nil { - attrs = append(attrs, HTTPSchemeHTTPS) - } else { - attrs = append(attrs, HTTPSchemeHTTP) - } - - if request.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.Host)) - } else if request.URL != nil && request.URL.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) - } - - flavor := "" - if request.ProtoMajor == 1 { - flavor = fmt.Sprintf("1.%d", request.ProtoMinor) - } else if request.ProtoMajor == 2 { - flavor = "2" - } - if flavor != "" { - attrs = append(attrs, HTTPFlavorKey.String(flavor)) - } - - return attrs + return sc.HTTPClientAttributesFromHTTPRequest(request) } // HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes // to be used with server-side HTTP metrics. func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) } // HTTPServerAttributesFromHTTPRequest generates attributes of the @@ -198,116 +90,25 @@ func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http. // a span on the server side. Currently, only basic authentication is // supported. func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPMethodKey.String(request.Method), - HTTPTargetKey.String(request.RequestURI), - } - - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - if route != "" { - attrs = append(attrs, HTTPRouteKey.String(route)) - } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, HTTPClientIPKey.String(addresses[0])) - } - } - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) } // HTTPAttributesFromHTTPStatusCode generates attributes of the http // namespace as specified by the OpenTelemetry specification for a // span. func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPStatusCodeKey.Int(code), - } - return attrs -} - -type codeRange struct { - fromInclusive int - toInclusive int -} - -func (r codeRange) contains(code int) bool { - return r.fromInclusive <= code && code <= r.toInclusive -} - -var validRangesPerCategory = map[int][]codeRange{ - 1: { - {http.StatusContinue, http.StatusEarlyHints}, - }, - 2: { - {http.StatusOK, http.StatusAlreadyReported}, - {http.StatusIMUsed, http.StatusIMUsed}, - }, - 3: { - {http.StatusMultipleChoices, http.StatusUseProxy}, - {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, - }, - 4: { - {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… - {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, - {http.StatusPreconditionRequired, http.StatusTooManyRequests}, - {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, - {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, - }, - 5: { - {http.StatusInternalServerError, http.StatusLoopDetected}, - {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, - }, + return sc.HTTPAttributesFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCode generates a status code and a message // as specified by the OpenTelemetry specification for a span. func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - return spanCode, "" + return internal.SpanStatusFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message // as specified by the OpenTelemetry specification for a span. // Exclude 4xx for SERVER to set the appropriate status. func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - category := code / 100 - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset, "" - } - return spanCode, "" -} - -// Validates the HTTP status code and returns corresponding span status code. -// If the `code` is not a valid HTTP status code, returns span status Error -// and false. -func validateHTTPStatusCode(code int) (codes.Code, bool) { - category := code / 100 - ranges, ok := validRangesPerCategory[category] - if !ok { - return codes.Error, false - } - ok = false - for _, crange := range ranges { - ok = crange.contains(code) - if ok { - break - } - } - if !ok { - return codes.Error, false - } - if category > 0 && category < 4 { - return codes.Unset, true - } - return codes.Error, true + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) } diff --git a/semconv/v1.5.0/http_test.go b/semconv/v1.5.0/http_test.go deleted file mode 100644 index c2043860bf7..00000000000 --- a/semconv/v1.5.0/http_test.go +++ /dev/null @@ -1,1210 +0,0 @@ -// Copyright The OpenTelemetry Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv - -import ( - "crypto/tls" - "net/http" - "net/url" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/trace" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" -) - -type tlsOption int - -const ( - noTLS tlsOption = iota - withTLS -) - -func TestNetAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - network string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped, tcp", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - }, - }, - { - name: "stripped, udp", - network: "udp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_udp"), - }, - }, - { - name: "stripped, ip", - network: "ip", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip"), - }, - }, - { - name: "stripped, unix", - network: "unix", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "unix"), - }, - }, - { - name: "stripped, other", - network: "nih", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "other"), - }, - }, - { - name: "with remote ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[fe80::0202:b3ff:fe1e:8329]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4-in-v6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[::ffff:192.168.0.1]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - }, - }, - { - name: "with remote ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "fe80::0202:b3ff:fe1e:8329", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with remote ipv4_in_v6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "::ffff:192.168.0.1", // section 2.5.5.2 of RFC4291 - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - }, - }, - { - name: "with remote name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - }, - }, - { - name: "with remote port only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: ":56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with host name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "fe80::0202:b3ff:fe1e:8329", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with host name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host name and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with empty host and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: ":80", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.Int("net.host.port", 80), - }, - }, - { - name: "with host ip and port in headers", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "Host": []string{"4.3.2.1:78"}, - }, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "4.3.2.1:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "[fe80::202:b3ff:fe1e:8329]:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, noTLS) - got := NetAttributesFromHTTPRequest(tc.network, r) - if diff := cmp.Diff( - tc.expected, - got, - cmp.AllowUnexported(attribute.Value{})); diff != "" { - t.Fatalf("attributes differ: diff %+v,", diff) - } - }) - } -} - -func TestEndUserAttributesFromHTTPRequest(t *testing.T) { - r := testRequest("GET", "/user/123", "HTTP/1.1", "", "", nil, http.Header{}, withTLS) - var expected []attribute.KeyValue - got := EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) - r.SetBasicAuth("admin", "password") - expected = []attribute.KeyValue{attribute.String("enduser.id", "admin")} - got = EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) -} - -func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - serverName string - route string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped", - serverName: "", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with server name", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with tls", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with route", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - }, - }, - { - name: "with host", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with proxy info", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"203.0.113.195, 70.41.3.18, 150.172.238.178"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "203.0.113.195"), - }, - }, - { - name: "with http 1.1", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with http 2", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with content length", - method: "GET", - requestURI: "/user/123", - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - } - for idx, tc := range testcases { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPServerAttributesFromHTTPRequest(tc.serverName, tc.route, r) - assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) - } -} - -func TestHTTPAttributesFromHTTPStatusCode(t *testing.T) { - expected := []attribute.KeyValue{ - attribute.Int("http.status_code", 404), - } - got := HTTPAttributesFromHTTPStatusCode(http.StatusNotFound) - assertElementsMatch(t, expected, got, "with valid HTTP status code") - assert.ElementsMatch(t, expected, got) - expected = []attribute.KeyValue{ - attribute.Int("http.status_code", 499), - } - got = HTTPAttributesFromHTTPStatusCode(499) - assertElementsMatch(t, expected, got, "with invalid HTTP status code") -} - -func TestSpanStatusFromHTTPStatusCode(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCode(code) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } -} - -func TestSpanStatusFromHTTPStatusCodeAndSpanKind(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCodeAndSpanKind(code, trace.SpanKindClient) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } - code, _ := SpanStatusFromHTTPStatusCodeAndSpanKind(400, trace.SpanKindServer) - assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code") -} - -func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code { - if http.StatusText(code) == "" { - return codes.Error - } - switch code { - case - http.StatusUnauthorized, - http.StatusForbidden, - http.StatusNotFound, - http.StatusTooManyRequests, - http.StatusNotImplemented, - http.StatusServiceUnavailable, - http.StatusGatewayTimeout: - return codes.Error - } - category := code / 100 - if category > 0 && category < 4 { - return codes.Unset - } - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset - } - return codes.Error -} - -func assertElementsMatch(t *testing.T, expected, got []attribute.KeyValue, format string, args ...interface{}) { - if !assert.ElementsMatchf(t, expected, got, format, args...) { - t.Log("expected:", kvStr(expected)) - t.Log("got:", kvStr(got)) - } -} - -func testRequest(method, requestURI, proto, remoteAddr, host string, u *url.URL, header http.Header, tlsopt tlsOption) *http.Request { - major, minor := protoToInts(proto) - var tlsConn *tls.ConnectionState - switch tlsopt { - case noTLS: - case withTLS: - tlsConn = &tls.ConnectionState{} - } - return &http.Request{ - Method: method, - URL: u, - Proto: proto, - ProtoMajor: major, - ProtoMinor: minor, - Header: header, - Host: host, - RemoteAddr: remoteAddr, - RequestURI: requestURI, - TLS: tlsConn, - } -} - -func protoToInts(proto string) (int, int) { - switch proto { - case "HTTP/1.0": - return 1, 0 - case "HTTP/1.1": - return 1, 1 - case "HTTP/2.0": - return 2, 0 - } - // invalid proto - return 13, 42 -} - -func kvStr(kvs []attribute.KeyValue) string { - sb := strings.Builder{} - sb.WriteRune('[') - for idx, label := range kvs { - if idx > 0 { - sb.WriteString(", ") - } - sb.WriteString((string)(label.Key)) - sb.WriteString(": ") - sb.WriteString(label.Value.Emit()) - } - sb.WriteRune(']') - return sb.String() -} - -func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { - testCases := []struct { - name string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - }{ - { - name: "stripped", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with tls", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with host", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Scheme: "https", - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "https://example.com/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 1.1", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 2", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with content length", - method: "GET", - url: &url.URL{ - Path: "/user/123", - }, - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - { - name: "with empty method (fallback to GET)", - method: "", - url: &url.URL{ - Path: "/user/123", - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - { - name: "authentication information is stripped", - method: "", - url: &url.URL{ - Path: "/user/123", - User: url.UserPassword("foo", "bar"), - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPClientAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, tc.expected, got) - }) - } -} diff --git a/semconv/v1.6.1/http.go b/semconv/v1.6.1/http.go index d2194b3e47b..3df9a299783 100644 --- a/semconv/v1.6.1/http.go +++ b/semconv/v1.6.1/http.go @@ -15,14 +15,11 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.6.1" import ( - "fmt" - "net" "net/http" - "strconv" - "strings" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" "go.opentelemetry.io/otel/trace" ) @@ -32,165 +29,60 @@ var ( HTTPSchemeHTTPS = HTTPSchemeKey.String("https") ) +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + // NetAttributesFromHTTPRequest generates attributes of the net // namespace as specified by the OpenTelemetry specification for a // span. The network parameter is a string that net.Dial function // from standard library can understand. func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - switch network { - case "tcp", "tcp4", "tcp6": - attrs = append(attrs, NetTransportTCP) - case "udp", "udp4", "udp6": - attrs = append(attrs, NetTransportUDP) - case "ip", "ip4", "ip6": - attrs = append(attrs, NetTransportIP) - case "unix", "unixgram", "unixpacket": - attrs = append(attrs, NetTransportUnix) - default: - attrs = append(attrs, NetTransportOther) - } - - peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) - if peerIP != "" { - attrs = append(attrs, NetPeerIPKey.String(peerIP)) - } - if peerName != "" { - attrs = append(attrs, NetPeerNameKey.String(peerName)) - } - if peerPort != 0 { - attrs = append(attrs, NetPeerPortKey.Int(peerPort)) - } - - hostIP, hostName, hostPort := "", "", 0 - for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { - hostIP, hostName, hostPort = hostIPNamePort(someHost) - if hostIP != "" || hostName != "" || hostPort != 0 { - break - } - } - if hostIP != "" { - attrs = append(attrs, NetHostIPKey.String(hostIP)) - } - if hostName != "" { - attrs = append(attrs, NetHostNameKey.String(hostName)) - } - if hostPort != 0 { - attrs = append(attrs, NetHostPortKey.Int(hostPort)) - } - - return attrs -} - -// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. -// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized -// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the -// host portion will instead be returned in `name`. -func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { - var ( - hostPart, portPart string - parsedPort uint64 - err error - ) - if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { - hostPart, portPart = hostWithPort, "" - } - if parsedIP := net.ParseIP(hostPart); parsedIP != nil { - ip = parsedIP.String() - } else { - name = hostPart - } - if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) - } - return + return sc.NetAttributesFromHTTPRequest(network, request) } // EndUserAttributesFromHTTPRequest generates attributes of the // enduser namespace as specified by the OpenTelemetry specification // for a span. func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - if username, _, ok := request.BasicAuth(); ok { - return []attribute.KeyValue{EnduserIDKey.String(username)} - } - return nil + return sc.EndUserAttributesFromHTTPRequest(request) } // HTTPClientAttributesFromHTTPRequest generates attributes of the // http namespace as specified by the OpenTelemetry specification for // a span on the client side. func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - if request.Method != "" { - attrs = append(attrs, HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, HTTPMethodKey.String(http.MethodGet)) - } - - // remove any username/password info that may be in the URL - // before adding it to the attributes - userinfo := request.URL.User - request.URL.User = nil - - attrs = append(attrs, HTTPURLKey.String(request.URL.String())) - - // restore any username/password info that was removed - request.URL.User = userinfo - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) -} - -func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if ua := request.UserAgent(); ua != "" { - attrs = append(attrs, HTTPUserAgentKey.String(ua)) - } - if request.ContentLength > 0 { - attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength)) - } - - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) -} - -func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality - attrs := []attribute.KeyValue{} - - if request.TLS != nil { - attrs = append(attrs, HTTPSchemeHTTPS) - } else { - attrs = append(attrs, HTTPSchemeHTTP) - } - - if request.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.Host)) - } else if request.URL != nil && request.URL.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) - } - - flavor := "" - if request.ProtoMajor == 1 { - flavor = fmt.Sprintf("1.%d", request.ProtoMinor) - } else if request.ProtoMajor == 2 { - flavor = "2" - } - if flavor != "" { - attrs = append(attrs, HTTPFlavorKey.String(flavor)) - } - - return attrs + return sc.HTTPClientAttributesFromHTTPRequest(request) } // HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes // to be used with server-side HTTP metrics. func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) } // HTTPServerAttributesFromHTTPRequest generates attributes of the @@ -198,116 +90,25 @@ func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http. // a span on the server side. Currently, only basic authentication is // supported. func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPMethodKey.String(request.Method), - HTTPTargetKey.String(request.RequestURI), - } - - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - if route != "" { - attrs = append(attrs, HTTPRouteKey.String(route)) - } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, HTTPClientIPKey.String(addresses[0])) - } - } - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) } // HTTPAttributesFromHTTPStatusCode generates attributes of the http // namespace as specified by the OpenTelemetry specification for a // span. func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPStatusCodeKey.Int(code), - } - return attrs -} - -type codeRange struct { - fromInclusive int - toInclusive int -} - -func (r codeRange) contains(code int) bool { - return r.fromInclusive <= code && code <= r.toInclusive -} - -var validRangesPerCategory = map[int][]codeRange{ - 1: { - {http.StatusContinue, http.StatusEarlyHints}, - }, - 2: { - {http.StatusOK, http.StatusAlreadyReported}, - {http.StatusIMUsed, http.StatusIMUsed}, - }, - 3: { - {http.StatusMultipleChoices, http.StatusUseProxy}, - {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, - }, - 4: { - {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… - {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, - {http.StatusPreconditionRequired, http.StatusTooManyRequests}, - {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, - {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, - }, - 5: { - {http.StatusInternalServerError, http.StatusLoopDetected}, - {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, - }, + return sc.HTTPAttributesFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCode generates a status code and a message // as specified by the OpenTelemetry specification for a span. func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - return spanCode, "" + return internal.SpanStatusFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message // as specified by the OpenTelemetry specification for a span. // Exclude 4xx for SERVER to set the appropriate status. func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - category := code / 100 - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset, "" - } - return spanCode, "" -} - -// Validates the HTTP status code and returns corresponding span status code. -// If the `code` is not a valid HTTP status code, returns span status Error -// and false. -func validateHTTPStatusCode(code int) (codes.Code, bool) { - category := code / 100 - ranges, ok := validRangesPerCategory[category] - if !ok { - return codes.Error, false - } - ok = false - for _, crange := range ranges { - ok = crange.contains(code) - if ok { - break - } - } - if !ok { - return codes.Error, false - } - if category > 0 && category < 4 { - return codes.Unset, true - } - return codes.Error, true + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) } diff --git a/semconv/v1.6.1/http_test.go b/semconv/v1.6.1/http_test.go deleted file mode 100644 index 4b4a652c74d..00000000000 --- a/semconv/v1.6.1/http_test.go +++ /dev/null @@ -1,1209 +0,0 @@ -// Copyright The OpenTelemetry Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv - -import ( - "crypto/tls" - "net/http" - "net/url" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" -) - -type tlsOption int - -const ( - noTLS tlsOption = iota - withTLS -) - -func TestNetAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - network string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped, tcp", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - }, - }, - { - name: "stripped, udp", - network: "udp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_udp"), - }, - }, - { - name: "stripped, ip", - network: "ip", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip"), - }, - }, - { - name: "stripped, unix", - network: "unix", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "unix"), - }, - }, - { - name: "stripped, other", - network: "nih", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "other"), - }, - }, - { - name: "with remote ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[fe80::0202:b3ff:fe1e:8329]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4-in-v6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[::ffff:192.168.0.1]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - }, - }, - { - name: "with remote ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "fe80::0202:b3ff:fe1e:8329", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with remote ipv4_in_v6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "::ffff:192.168.0.1", // section 2.5.5.2 of RFC4291 - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - }, - }, - { - name: "with remote name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - }, - }, - { - name: "with remote port only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: ":56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with host name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "fe80::0202:b3ff:fe1e:8329", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with host name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host name and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with empty host and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: ":80", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.Int("net.host.port", 80), - }, - }, - { - name: "with host ip and port in headers", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "Host": []string{"4.3.2.1:78"}, - }, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "4.3.2.1:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "[fe80::202:b3ff:fe1e:8329]:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, noTLS) - got := NetAttributesFromHTTPRequest(tc.network, r) - if diff := cmp.Diff( - tc.expected, - got, - cmp.AllowUnexported(attribute.Value{})); diff != "" { - t.Fatalf("attributes differ: diff %+v,", diff) - } - }) - } -} - -func TestEndUserAttributesFromHTTPRequest(t *testing.T) { - r := testRequest("GET", "/user/123", "HTTP/1.1", "", "", nil, http.Header{}, withTLS) - var expected []attribute.KeyValue - got := EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) - r.SetBasicAuth("admin", "password") - expected = []attribute.KeyValue{attribute.String("enduser.id", "admin")} - got = EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) -} - -func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - serverName string - route string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped", - serverName: "", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with server name", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with tls", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with route", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - }, - }, - { - name: "with host", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with proxy info", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"203.0.113.195, 70.41.3.18, 150.172.238.178"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "203.0.113.195"), - }, - }, - { - name: "with http 1.1", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with http 2", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with content length", - method: "GET", - requestURI: "/user/123", - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - } - for idx, tc := range testcases { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPServerAttributesFromHTTPRequest(tc.serverName, tc.route, r) - assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) - } -} - -func TestHTTPAttributesFromHTTPStatusCode(t *testing.T) { - expected := []attribute.KeyValue{ - attribute.Int("http.status_code", 404), - } - got := HTTPAttributesFromHTTPStatusCode(http.StatusNotFound) - assertElementsMatch(t, expected, got, "with valid HTTP status code") - assert.ElementsMatch(t, expected, got) - expected = []attribute.KeyValue{ - attribute.Int("http.status_code", 499), - } - got = HTTPAttributesFromHTTPStatusCode(499) - assertElementsMatch(t, expected, got, "with invalid HTTP status code") -} - -func TestSpanStatusFromHTTPStatusCode(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCode(code) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } -} - -func TestSpanStatusFromHTTPStatusCodeAndSpanKind(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCodeAndSpanKind(code, trace.SpanKindClient) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } - code, _ := SpanStatusFromHTTPStatusCodeAndSpanKind(400, trace.SpanKindServer) - assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code") -} - -func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code { - if http.StatusText(code) == "" { - return codes.Error - } - switch code { - case - http.StatusUnauthorized, - http.StatusForbidden, - http.StatusNotFound, - http.StatusTooManyRequests, - http.StatusNotImplemented, - http.StatusServiceUnavailable, - http.StatusGatewayTimeout: - return codes.Error - } - category := code / 100 - if category > 0 && category < 4 { - return codes.Unset - } - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset - } - return codes.Error -} - -func assertElementsMatch(t *testing.T, expected, got []attribute.KeyValue, format string, args ...interface{}) { - if !assert.ElementsMatchf(t, expected, got, format, args...) { - t.Log("expected:", kvStr(expected)) - t.Log("got:", kvStr(got)) - } -} - -func testRequest(method, requestURI, proto, remoteAddr, host string, u *url.URL, header http.Header, tlsopt tlsOption) *http.Request { - major, minor := protoToInts(proto) - var tlsConn *tls.ConnectionState - switch tlsopt { - case noTLS: - case withTLS: - tlsConn = &tls.ConnectionState{} - } - return &http.Request{ - Method: method, - URL: u, - Proto: proto, - ProtoMajor: major, - ProtoMinor: minor, - Header: header, - Host: host, - RemoteAddr: remoteAddr, - RequestURI: requestURI, - TLS: tlsConn, - } -} - -func protoToInts(proto string) (int, int) { - switch proto { - case "HTTP/1.0": - return 1, 0 - case "HTTP/1.1": - return 1, 1 - case "HTTP/2.0": - return 2, 0 - } - // invalid proto - return 13, 42 -} - -func kvStr(kvs []attribute.KeyValue) string { - sb := strings.Builder{} - sb.WriteRune('[') - for idx, label := range kvs { - if idx > 0 { - sb.WriteString(", ") - } - sb.WriteString((string)(label.Key)) - sb.WriteString(": ") - sb.WriteString(label.Value.Emit()) - } - sb.WriteRune(']') - return sb.String() -} - -func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { - testCases := []struct { - name string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - }{ - { - name: "stripped", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with tls", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with host", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Scheme: "https", - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "https://example.com/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 1.1", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 2", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with content length", - method: "GET", - url: &url.URL{ - Path: "/user/123", - }, - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - { - name: "with empty method (fallback to GET)", - method: "", - url: &url.URL{ - Path: "/user/123", - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - { - name: "authentication information is stripped", - method: "", - url: &url.URL{ - Path: "/user/123", - User: url.UserPassword("foo", "bar"), - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPClientAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, tc.expected, got) - }) - } -} diff --git a/semconv/v1.7.0/http.go b/semconv/v1.7.0/http.go index fafee88a953..945c95a18ad 100644 --- a/semconv/v1.7.0/http.go +++ b/semconv/v1.7.0/http.go @@ -15,16 +15,12 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.7.0" import ( - "fmt" - "net" "net/http" - "strconv" - "strings" - - "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" ) // HTTP scheme attributes. @@ -33,165 +29,60 @@ var ( HTTPSchemeHTTPS = HTTPSchemeKey.String("https") ) +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + // NetAttributesFromHTTPRequest generates attributes of the net // namespace as specified by the OpenTelemetry specification for a // span. The network parameter is a string that net.Dial function // from standard library can understand. func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - switch network { - case "tcp", "tcp4", "tcp6": - attrs = append(attrs, NetTransportTCP) - case "udp", "udp4", "udp6": - attrs = append(attrs, NetTransportUDP) - case "ip", "ip4", "ip6": - attrs = append(attrs, NetTransportIP) - case "unix", "unixgram", "unixpacket": - attrs = append(attrs, NetTransportUnix) - default: - attrs = append(attrs, NetTransportOther) - } - - peerIP, peerName, peerPort := hostIPNamePort(request.RemoteAddr) - if peerIP != "" { - attrs = append(attrs, NetPeerIPKey.String(peerIP)) - } - if peerName != "" { - attrs = append(attrs, NetPeerNameKey.String(peerName)) - } - if peerPort != 0 { - attrs = append(attrs, NetPeerPortKey.Int(peerPort)) - } - - hostIP, hostName, hostPort := "", "", 0 - for _, someHost := range []string{request.Host, request.Header.Get("Host"), request.URL.Host} { - hostIP, hostName, hostPort = hostIPNamePort(someHost) - if hostIP != "" || hostName != "" || hostPort != 0 { - break - } - } - if hostIP != "" { - attrs = append(attrs, NetHostIPKey.String(hostIP)) - } - if hostName != "" { - attrs = append(attrs, NetHostNameKey.String(hostName)) - } - if hostPort != 0 { - attrs = append(attrs, NetHostPortKey.Int(hostPort)) - } - - return attrs -} - -// hostIPNamePort extracts the IP address, name and (optional) port from hostWithPort. -// It handles both IPv4 and IPv6 addresses. If the host portion is not recognized -// as a valid IPv4 or IPv6 address, the `ip` result will be empty and the -// host portion will instead be returned in `name`. -func hostIPNamePort(hostWithPort string) (ip string, name string, port int) { - var ( - hostPart, portPart string - parsedPort uint64 - err error - ) - if hostPart, portPart, err = net.SplitHostPort(hostWithPort); err != nil { - hostPart, portPart = hostWithPort, "" - } - if parsedIP := net.ParseIP(hostPart); parsedIP != nil { - ip = parsedIP.String() - } else { - name = hostPart - } - if parsedPort, err = strconv.ParseUint(portPart, 10, 16); err == nil { - port = int(parsedPort) - } - return + return sc.NetAttributesFromHTTPRequest(network, request) } // EndUserAttributesFromHTTPRequest generates attributes of the // enduser namespace as specified by the OpenTelemetry specification // for a span. func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - if username, _, ok := request.BasicAuth(); ok { - return []attribute.KeyValue{EnduserIDKey.String(username)} - } - return nil + return sc.EndUserAttributesFromHTTPRequest(request) } // HTTPClientAttributesFromHTTPRequest generates attributes of the // http namespace as specified by the OpenTelemetry specification for // a span on the client side. func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - - if request.Method != "" { - attrs = append(attrs, HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, HTTPMethodKey.String(http.MethodGet)) - } - - // remove any username/password info that may be in the URL - // before adding it to the attributes - userinfo := request.URL.User - request.URL.User = nil - - attrs = append(attrs, HTTPURLKey.String(request.URL.String())) - - // restore any username/password info that was removed - request.URL.User = userinfo - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) -} - -func httpCommonAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if ua := request.UserAgent(); ua != "" { - attrs = append(attrs, HTTPUserAgentKey.String(ua)) - } - if request.ContentLength > 0 { - attrs = append(attrs, HTTPRequestContentLengthKey.Int64(request.ContentLength)) - } - - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) -} - -func httpBasicAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - // as these attributes are used by HTTPServerMetricAttributesFromHTTPRequest, they should be low-cardinality - attrs := []attribute.KeyValue{} - - if request.TLS != nil { - attrs = append(attrs, HTTPSchemeHTTPS) - } else { - attrs = append(attrs, HTTPSchemeHTTP) - } - - if request.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.Host)) - } else if request.URL != nil && request.URL.Host != "" { - attrs = append(attrs, HTTPHostKey.String(request.URL.Host)) - } - - flavor := "" - if request.ProtoMajor == 1 { - flavor = fmt.Sprintf("1.%d", request.ProtoMinor) - } else if request.ProtoMajor == 2 { - flavor = "2" - } - if flavor != "" { - attrs = append(attrs, HTTPFlavorKey.String(flavor)) - } - - return attrs + return sc.HTTPClientAttributesFromHTTPRequest(request) } // HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes // to be used with server-side HTTP metrics. func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{} - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - return append(attrs, httpBasicAttributesFromHTTPRequest(request)...) + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) } // HTTPServerAttributesFromHTTPRequest generates attributes of the @@ -199,116 +90,25 @@ func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http. // a span on the server side. Currently, only basic authentication is // supported. func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPMethodKey.String(request.Method), - HTTPTargetKey.String(request.RequestURI), - } - - if serverName != "" { - attrs = append(attrs, HTTPServerNameKey.String(serverName)) - } - if route != "" { - attrs = append(attrs, HTTPRouteKey.String(route)) - } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, HTTPClientIPKey.String(addresses[0])) - } - } - - return append(attrs, httpCommonAttributesFromHTTPRequest(request)...) + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) } // HTTPAttributesFromHTTPStatusCode generates attributes of the http // namespace as specified by the OpenTelemetry specification for a // span. func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - attrs := []attribute.KeyValue{ - HTTPStatusCodeKey.Int(code), - } - return attrs -} - -type codeRange struct { - fromInclusive int - toInclusive int -} - -func (r codeRange) contains(code int) bool { - return r.fromInclusive <= code && code <= r.toInclusive -} - -var validRangesPerCategory = map[int][]codeRange{ - 1: { - {http.StatusContinue, http.StatusEarlyHints}, - }, - 2: { - {http.StatusOK, http.StatusAlreadyReported}, - {http.StatusIMUsed, http.StatusIMUsed}, - }, - 3: { - {http.StatusMultipleChoices, http.StatusUseProxy}, - {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, - }, - 4: { - {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… - {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, - {http.StatusPreconditionRequired, http.StatusTooManyRequests}, - {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, - {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, - }, - 5: { - {http.StatusInternalServerError, http.StatusLoopDetected}, - {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, - }, + return sc.HTTPAttributesFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCode generates a status code and a message // as specified by the OpenTelemetry specification for a span. func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - return spanCode, "" + return internal.SpanStatusFromHTTPStatusCode(code) } // SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message // as specified by the OpenTelemetry specification for a span. // Exclude 4xx for SERVER to set the appropriate status. func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - spanCode, valid := validateHTTPStatusCode(code) - if !valid { - return spanCode, fmt.Sprintf("Invalid HTTP status code %d", code) - } - category := code / 100 - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset, "" - } - return spanCode, "" -} - -// Validates the HTTP status code and returns corresponding span status code. -// If the `code` is not a valid HTTP status code, returns span status Error -// and false. -func validateHTTPStatusCode(code int) (codes.Code, bool) { - category := code / 100 - ranges, ok := validRangesPerCategory[category] - if !ok { - return codes.Error, false - } - ok = false - for _, crange := range ranges { - ok = crange.contains(code) - if ok { - break - } - } - if !ok { - return codes.Error, false - } - if category > 0 && category < 4 { - return codes.Unset, true - } - return codes.Error, true + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) } diff --git a/semconv/v1.7.0/http_test.go b/semconv/v1.7.0/http_test.go deleted file mode 100644 index 2a76bd68714..00000000000 --- a/semconv/v1.7.0/http_test.go +++ /dev/null @@ -1,1210 +0,0 @@ -// Copyright The OpenTelemetry Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv - -import ( - "crypto/tls" - "net/http" - "net/url" - "strings" - "testing" - - "go.opentelemetry.io/otel/trace" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" -) - -type tlsOption int - -const ( - noTLS tlsOption = iota - withTLS -) - -func TestNetAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - network string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped, tcp", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - }, - }, - { - name: "stripped, udp", - network: "udp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_udp"), - }, - }, - { - name: "stripped, ip", - network: "ip", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip"), - }, - }, - { - name: "stripped, unix", - network: "unix", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "unix"), - }, - }, - { - name: "stripped, other", - network: "nih", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "other"), - }, - }, - { - name: "with remote ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[fe80::0202:b3ff:fe1e:8329]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4-in-v6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "[::ffff:192.168.0.1]:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with remote ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - }, - }, - { - name: "with remote ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "fe80::0202:b3ff:fe1e:8329", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with remote ipv4_in_v6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "::ffff:192.168.0.1", // section 2.5.5.2 of RFC4291 - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "192.168.0.1"), - }, - }, - { - name: "with remote name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "example.com", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.name", "example.com"), - }, - }, - { - name: "with remote port only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: ":56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.Int("net.peer.port", 56), - }, - }, - { - name: "with host name only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 only", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "fe80::0202:b3ff:fe1e:8329", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with host name and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:78", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host name and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "example.com:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.name", "example.com"), - }, - }, - { - name: "with host ipv4 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "4.3.2.1:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - }, - }, - { - name: "with host ipv6 and bogus port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "[fe80::202:b3ff:fe1e:8329]:qwerty", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - }, - }, - { - name: "with empty host and port", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: ":80", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.Int("net.host.port", 80), - }, - }, - { - name: "with host ip and port in headers", - network: "tcp", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "Host": []string{"4.3.2.1:78"}, - }, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv4 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "4.3.2.1:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "4.3.2.1"), - attribute.Int("net.host.port", 78), - }, - }, - { - name: "with host ipv6 and port in url", - network: "tcp", - method: "GET", - requestURI: "http://4.3.2.1:78/user/123", - proto: "HTTP/1.0", - remoteAddr: "1.2.3.4:56", - host: "", - url: &url.URL{ - Host: "[fe80::202:b3ff:fe1e:8329]:78", - Path: "/user/123", - }, - header: nil, - expected: []attribute.KeyValue{ - attribute.String("net.transport", "ip_tcp"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int("net.peer.port", 56), - attribute.String("net.host.ip", "fe80::202:b3ff:fe1e:8329"), - attribute.Int("net.host.port", 78), - }, - }, - } - for _, tc := range testcases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, noTLS) - got := NetAttributesFromHTTPRequest(tc.network, r) - if diff := cmp.Diff( - tc.expected, - got, - cmp.AllowUnexported(attribute.Value{})); diff != "" { - t.Fatalf("attributes differ: diff %+v,", diff) - } - }) - } -} - -func TestEndUserAttributesFromHTTPRequest(t *testing.T) { - r := testRequest("GET", "/user/123", "HTTP/1.1", "", "", nil, http.Header{}, withTLS) - var expected []attribute.KeyValue - got := EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) - r.SetBasicAuth("admin", "password") - expected = []attribute.KeyValue{attribute.String("enduser.id", "admin")} - got = EndUserAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, expected, got) -} - -func TestHTTPServerAttributesFromHTTPRequest(t *testing.T) { - type testcase struct { - name string - - serverName string - route string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - } - testcases := []testcase{ - { - name: "stripped", - serverName: "", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with server name", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with tls", - serverName: "my-server-name", - route: "", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - }, - }, - { - name: "with route", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - }, - }, - { - name: "with host", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with proxy info", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"203.0.113.195, 70.41.3.18, 150.172.238.178"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "203.0.113.195"), - }, - }, - { - name: "with http 1.1", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with http 2", - serverName: "my-server-name", - route: "/user/:id", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - "X-Forwarded-For": []string{"1.2.3.4"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.server_name", "my-server-name"), - attribute.String("http.route", "/user/:id"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - attribute.String("http.client_ip", "1.2.3.4"), - }, - }, - { - name: "with content length", - method: "GET", - requestURI: "/user/123", - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.target", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - } - for idx, tc := range testcases { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPServerAttributesFromHTTPRequest(tc.serverName, tc.route, r) - assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) - } -} - -func TestHTTPAttributesFromHTTPStatusCode(t *testing.T) { - expected := []attribute.KeyValue{ - attribute.Int("http.status_code", 404), - } - got := HTTPAttributesFromHTTPStatusCode(http.StatusNotFound) - assertElementsMatch(t, expected, got, "with valid HTTP status code") - assert.ElementsMatch(t, expected, got) - expected = []attribute.KeyValue{ - attribute.Int("http.status_code", 499), - } - got = HTTPAttributesFromHTTPStatusCode(499) - assertElementsMatch(t, expected, got, "with invalid HTTP status code") -} - -func TestSpanStatusFromHTTPStatusCode(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCode(code) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } -} - -func TestSpanStatusFromHTTPStatusCodeAndSpanKind(t *testing.T) { - for code := 0; code < 1000; code++ { - expected := getExpectedCodeForHTTPCode(code, trace.SpanKindClient) - got, msg := SpanStatusFromHTTPStatusCodeAndSpanKind(code, trace.SpanKindClient) - assert.Equalf(t, expected, got, "%s vs %s", expected, got) - - _, valid := validateHTTPStatusCode(code) - if !valid { - assert.NotEmpty(t, msg, "message should be set if error cannot be inferred from code") - } else { - assert.Empty(t, msg, "message should not be set if error can be inferred from code") - } - } - code, _ := SpanStatusFromHTTPStatusCodeAndSpanKind(400, trace.SpanKindServer) - assert.Equalf(t, codes.Unset, code, "message should be set if error cannot be inferred from code") -} - -func getExpectedCodeForHTTPCode(code int, spanKind trace.SpanKind) codes.Code { - if http.StatusText(code) == "" { - return codes.Error - } - switch code { - case - http.StatusUnauthorized, - http.StatusForbidden, - http.StatusNotFound, - http.StatusTooManyRequests, - http.StatusNotImplemented, - http.StatusServiceUnavailable, - http.StatusGatewayTimeout: - return codes.Error - } - category := code / 100 - if category > 0 && category < 4 { - return codes.Unset - } - if spanKind == trace.SpanKindServer && category == 4 { - return codes.Unset - } - return codes.Error -} - -func assertElementsMatch(t *testing.T, expected, got []attribute.KeyValue, format string, args ...interface{}) { - if !assert.ElementsMatchf(t, expected, got, format, args...) { - t.Log("expected:", kvStr(expected)) - t.Log("got:", kvStr(got)) - } -} - -func testRequest(method, requestURI, proto, remoteAddr, host string, u *url.URL, header http.Header, tlsopt tlsOption) *http.Request { - major, minor := protoToInts(proto) - var tlsConn *tls.ConnectionState - switch tlsopt { - case noTLS: - case withTLS: - tlsConn = &tls.ConnectionState{} - } - return &http.Request{ - Method: method, - URL: u, - Proto: proto, - ProtoMajor: major, - ProtoMinor: minor, - Header: header, - Host: host, - RemoteAddr: remoteAddr, - RequestURI: requestURI, - TLS: tlsConn, - } -} - -func protoToInts(proto string) (int, int) { - switch proto { - case "HTTP/1.0": - return 1, 0 - case "HTTP/1.1": - return 1, 1 - case "HTTP/2.0": - return 2, 0 - } - // invalid proto - return 13, 42 -} - -func kvStr(kvs []attribute.KeyValue) string { - sb := strings.Builder{} - sb.WriteRune('[') - for idx, label := range kvs { - if idx > 0 { - sb.WriteString(", ") - } - sb.WriteString((string)(label.Key)) - sb.WriteString(": ") - sb.WriteString(label.Value.Emit()) - } - sb.WriteRune(']') - return sb.String() -} - -func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { - testCases := []struct { - name string - - method string - requestURI string - proto string - remoteAddr string - host string - url *url.URL - header http.Header - tls tlsOption - contentLength int64 - - expected []attribute.KeyValue - }{ - { - name: "stripped", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: noTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with tls", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - }, - }, - { - name: "with host", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with host fallback", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "", - url: &url.URL{ - Scheme: "https", - Host: "example.com", - Path: "/user/123", - }, - header: nil, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "https://example.com/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - }, - }, - { - name: "with user agent", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.0"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 1.1", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/1.1", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "1.1"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with http 2", - method: "GET", - requestURI: "/user/123", - proto: "HTTP/2.0", - remoteAddr: "", - host: "example.com", - url: &url.URL{ - Path: "/user/123", - }, - header: http.Header{ - "User-Agent": []string{"foodownloader"}, - }, - tls: withTLS, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "https"), - attribute.String("http.flavor", "2"), - attribute.String("http.host", "example.com"), - attribute.String("http.user_agent", "foodownloader"), - }, - }, - { - name: "with content length", - method: "GET", - url: &url.URL{ - Path: "/user/123", - }, - contentLength: 100, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - attribute.Int64("http.request_content_length", 100), - }, - }, - { - name: "with empty method (fallback to GET)", - method: "", - url: &url.URL{ - Path: "/user/123", - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - { - name: "authentication information is stripped", - method: "", - url: &url.URL{ - Path: "/user/123", - User: url.UserPassword("foo", "bar"), - }, - expected: []attribute.KeyValue{ - attribute.String("http.method", "GET"), - attribute.String("http.url", "/user/123"), - attribute.String("http.scheme", "http"), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) - r.ContentLength = tc.contentLength - got := HTTPClientAttributesFromHTTPRequest(r) - assert.ElementsMatch(t, tc.expected, got) - }) - } -} From 57a248d37518dde41f2fc11de09114280f7515f5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 12 Apr 2022 17:04:06 -0700 Subject: [PATCH 140/886] Replace markdown link check action with script (#2785) * Replace markdown link check action with script * Add change to changelog * Fix spelling error in CHANGELOG --- .github/workflows/markdown.yml | 23 +++++++++++++++-------- CHANGELOG.md | 4 ++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index ff8ddc1d9e0..92a8b8727a9 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -35,16 +35,23 @@ jobs: check-links: runs-on: ubuntu-latest + needs: changedfiles + if: ${{needs.changedfiles.outputs.md}} steps: - name: Checkout Repo uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - base-branch: 'main' - use-quiet-mode: 'yes' - use-verbose-mode: 'yes' - config-file: '.markdown-link.json' - check-modified-files-only: 'yes' - folder-path: '' + # This doesn't use gaurav-nelson/github-action-markdown-link-check + # intentionally. As of v1.0.13 the base image was not pinned to a LTS + # version of node and updates upstream to the base image caused CI + # failures. This boils down the entrypoint script from that repository + # and calls markdown-link-check directly instead. + - name: Install markdown-link-check + run: npm install -g markdown-link-check + - name: Run markdown-link-check + run: | + markdown-link-check \ + --verbose \ + --config .markdown-link.json \ + ${{needs.changedfiles.outputs.md}} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a4a020f057..23a4d7e8eae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- Resolve supply-chain failure for the markdown-link-checker GitHub action by calling the CLI directly. (#2834) + ## [0.29.0] - 2022-04-11 ### Added From 46a10bba880408aff2cf2ab120901b6b8a90059c Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 13 Apr 2022 19:49:06 -0500 Subject: [PATCH 141/886] Fix for delayed global registration (#2784) * Fix for delayed global registration * Changelog * Fix license * Fix ChangeLog --- CHANGELOG.md | 1 + metric/internal/global/instruments.go | 42 ++++++++++++ metric/internal/global/meter.go | 22 +++++- .../controllertest/controller_test.go | 67 +++++++++++++++++++ 4 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 sdk/metric/controller/controllertest/controller_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a4d7e8eae..dcb939728e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed +- Delegated instruments are unwrapped before delegating Callbacks. (#2784) - Resolve supply-chain failure for the markdown-link-checker GitHub action by calling the CLI directly. (#2834) ## [0.29.0] - 2022-04-11 diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 6b2004af65f..c98dfdf7c99 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -54,6 +54,13 @@ func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.K } } +func (i *afCounter) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncfloat64.Counter) + } + return nil +} + type afUpDownCounter struct { name string opts []instrument.Option @@ -80,6 +87,13 @@ func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attri } } +func (i *afUpDownCounter) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncfloat64.UpDownCounter) + } + return nil +} + type afGauge struct { name string opts []instrument.Option @@ -106,6 +120,13 @@ func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.Key } } +func (i *afGauge) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncfloat64.Gauge) + } + return nil +} + type aiCounter struct { name string opts []instrument.Option @@ -132,6 +153,13 @@ func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.Key } } +func (i *aiCounter) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncint64.Counter) + } + return nil +} + type aiUpDownCounter struct { name string opts []instrument.Option @@ -158,6 +186,13 @@ func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribu } } +func (i *aiUpDownCounter) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncint64.UpDownCounter) + } + return nil +} + type aiGauge struct { name string opts []instrument.Option @@ -184,6 +219,13 @@ func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyVa } } +func (i *aiGauge) unwrap() instrument.Asynchronous { + if ctr := i.delegate.Load(); ctr != nil { + return ctr.(asyncint64.Gauge) + } + return nil +} + //Sync Instruments type sfCounter struct { name string diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 9001ae9427b..1acac5c20cc 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -169,6 +169,7 @@ func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { // and only on the instruments that were registered with this call. func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { if del, ok := m.delegate.Load().(metric.Meter); ok { + insts = unwrapInstruments(insts) return del.RegisterCallback(insts, function) } @@ -182,6 +183,24 @@ func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func( return nil } +type wrapped interface { + unwrap() instrument.Asynchronous +} + +func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous { + out := make([]instrument.Asynchronous, 0, len(instruments)) + + for _, inst := range instruments { + if in, ok := inst.(wrapped); ok { + out = append(out, in.unwrap()) + } else { + out = append(out, inst) + } + } + + return out +} + // SyncInt64 is the namespace for the Synchronous Integer instruments func (m *meter) SyncInt64() syncint64.InstrumentProvider { if del, ok := m.delegate.Load().(metric.Meter); ok { @@ -204,7 +223,8 @@ type delegatedCallback struct { } func (c *delegatedCallback) setDelegate(m metric.Meter) { - err := m.RegisterCallback(c.instruments, c.function) + insts := unwrapInstruments(c.instruments) + err := m.RegisterCallback(insts, c.function) if err != nil { otel.Handle(err) } diff --git a/sdk/metric/controller/controllertest/controller_test.go b/sdk/metric/controller/controllertest/controller_test.go new file mode 100644 index 00000000000..394d806238b --- /dev/null +++ b/sdk/metric/controller/controllertest/controller_test.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package controllertest // import "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" + +import ( + "context" + "sync" + "testing" + + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument" + controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/processor/basic" + "go.opentelemetry.io/otel/sdk/metric/selector/simple" +) + +type errorCatcher struct { + lock sync.Mutex + errors []error +} + +func (e *errorCatcher) Handle(err error) { + e.lock.Lock() + defer e.lock.Unlock() + + e.errors = append(e.errors, err) +} + +func TestEndToEnd(t *testing.T) { + h := &errorCatcher{} + otel.SetErrorHandler(h) + + meter := global.Meter("go.opentelemetry.io/otel/sdk/metric/controller/controllertest_EndToEnd") + gauge, err := meter.AsyncInt64().Gauge("test") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(context.Context) {}) + require.NoError(t, err) + + c := controller.New(basic.NewFactory(simple.NewWithInexpensiveDistribution(), aggregation.CumulativeTemporalitySelector())) + + global.SetMeterProvider(c) + + gauge, err = meter.AsyncInt64().Gauge("test2") + require.NoError(t, err) + err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(context.Context) {}) + require.NoError(t, err) + + h.lock.Lock() + require.Len(t, h.errors, 0) + +} From c65c3becb066b82b84e33e781d016ed86015f6f5 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 14 Apr 2022 17:22:03 +0200 Subject: [PATCH 142/886] Don't import testing package in production builds (#2786) * switch all tests to be on the global package * move ResetForTest to be available only during tests Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + internal/global/benchmark_test.go | 9 +++---- internal/global/propagator_test.go | 23 +++++++++--------- internal/global/state.go | 12 ---------- internal/global/trace_test.go | 38 ++++++++++++++---------------- internal/global/util_test.go | 31 ++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 50 deletions(-) create mode 100644 internal/global/util_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index dcb939728e8..ebd5a72511d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Delegated instruments are unwrapped before delegating Callbacks. (#2784) - Resolve supply-chain failure for the markdown-link-checker GitHub action by calling the CLI directly. (#2834) +- Remove import of `testing` package in non-tests builds. (#2786) ## [0.29.0] - 2022-04-11 diff --git a/internal/global/benchmark_test.go b/internal/global/benchmark_test.go index f001844642c..5d4d3b9cf8b 100644 --- a/internal/global/benchmark_test.go +++ b/internal/global/benchmark_test.go @@ -12,21 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global_test +package global import ( "context" "testing" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/internal/global" ) func BenchmarkStartEndSpanNoSDK(b *testing.B) { // Compare with BenchmarkStartEndSpan() in // ../../sdk/trace/benchmark_test.go. - global.ResetForTest(b) - t := otel.Tracer("Benchmark StartEndSpan") + ResetForTest(b) + t := TracerProvider().Tracer("Benchmark StartEndSpan") ctx := context.Background() b.ResetTimer() for i := 0; i < b.N; i++ { diff --git a/internal/global/propagator_test.go b/internal/global/propagator_test.go index b58ae445691..d13be35c715 100644 --- a/internal/global/propagator_test.go +++ b/internal/global/propagator_test.go @@ -12,23 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global_test +package global import ( "context" "testing" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/internal/internaltest" ) func TestTextMapPropagatorDelegation(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) ctx := context.Background() carrier := internaltest.NewTextMapCarrier(nil) // The default should be a noop. - initial := global.TextMapPropagator() + initial := TextMapPropagator() initial.Inject(ctx, carrier) ctx = initial.Extract(ctx, carrier) if !carrier.GotN(t, 0) || !carrier.SetN(t, 0) { @@ -45,7 +44,7 @@ func TestTextMapPropagatorDelegation(t *testing.T) { // The initial propagator should use the delegate after it is set as the // global. - global.SetTextMapPropagator(delegate) + SetTextMapPropagator(delegate) initial.Inject(ctx, carrier) ctx = initial.Extract(ctx, carrier) delegate.InjectedN(t, carrier, 2) @@ -53,12 +52,12 @@ func TestTextMapPropagatorDelegation(t *testing.T) { } func TestTextMapPropagatorDelegationNil(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) ctx := context.Background() carrier := internaltest.NewTextMapCarrier(nil) // The default should be a noop. - initial := global.TextMapPropagator() + initial := TextMapPropagator() initial.Inject(ctx, carrier) ctx = initial.Extract(ctx, carrier) if !carrier.GotN(t, 0) || !carrier.SetN(t, 0) { @@ -66,7 +65,7 @@ func TestTextMapPropagatorDelegationNil(t *testing.T) { } // Delegation to nil should not make a change. - global.SetTextMapPropagator(nil) + SetTextMapPropagator(nil) initial.Inject(ctx, carrier) initial.Extract(ctx, carrier) if !carrier.GotN(t, 0) || !carrier.SetN(t, 0) { @@ -75,8 +74,8 @@ func TestTextMapPropagatorDelegationNil(t *testing.T) { } func TestTextMapPropagatorFields(t *testing.T) { - global.ResetForTest(t) - initial := global.TextMapPropagator() + ResetForTest(t) + initial := TextMapPropagator() delegate := internaltest.NewTextMapPropagator("test") delegateFields := delegate.Fields() @@ -84,13 +83,13 @@ func TestTextMapPropagatorFields(t *testing.T) { if got := initial.Fields(); fieldsEqual(got, delegateFields) { t.Fatalf("testing fields (%v) matched Noop fields (%v)", delegateFields, got) } - global.SetTextMapPropagator(delegate) + SetTextMapPropagator(delegate) // Check previous returns from global not correctly delegate. if got := initial.Fields(); !fieldsEqual(got, delegateFields) { t.Errorf("global TextMapPropagator.Fields returned %v instead of delegating, want (%v)", got, delegateFields) } // Check new calls to global. - if got := global.TextMapPropagator().Fields(); !fieldsEqual(got, delegateFields) { + if got := TextMapPropagator().Fields(); !fieldsEqual(got, delegateFields) { t.Errorf("global TextMapPropagator.Fields returned %v, want (%v)", got, delegateFields) } } diff --git a/internal/global/state.go b/internal/global/state.go index 837d3c6c45e..1ad38f828ec 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -18,7 +18,6 @@ import ( "errors" "sync" "sync/atomic" - "testing" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -114,14 +113,3 @@ func defaultPropagatorsValue() *atomic.Value { v.Store(propagatorsHolder{tm: newTextMapPropagator()}) return v } - -// ResetForTest configures the test to restores the initial global state during -// its Cleanup step -func ResetForTest(t testing.TB) { - t.Cleanup(func() { - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() - delegateTraceOnce = sync.Once{} - delegateTextMapPropagatorOnce = sync.Once{} - }) -} diff --git a/internal/global/trace_test.go b/internal/global/trace_test.go index fc16ff0e760..f8f9149d9e0 100644 --- a/internal/global/trace_test.go +++ b/internal/global/trace_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global_test +package global import ( "context" @@ -22,8 +22,6 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/trace" ) @@ -44,7 +42,7 @@ func (fn fnTracer) Start(ctx context.Context, spanName string, opts ...trace.Spa } func TestTraceProviderDelegation(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) // Map of tracers to expected span names. expected := map[string][]string{ @@ -54,12 +52,12 @@ func TestTraceProviderDelegation(t *testing.T) { } ctx := context.Background() - gtp := otel.GetTracerProvider() + gtp := TracerProvider() tracer1 := gtp.Tracer("pre") // This is started before an SDK was registered and should be dropped. _, span1 := tracer1.Start(ctx, "span1") - otel.SetTracerProvider(fnTracerProvider{ + SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { spans, ok := expected[name] assert.Truef(t, ok, "invalid tracer: %s", name) @@ -98,14 +96,14 @@ func TestTraceProviderDelegation(t *testing.T) { } func TestTraceProviderDelegates(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) // Retrieve the placeholder TracerProvider. - gtp := otel.GetTracerProvider() + gtp := TracerProvider() // Configure it with a spy. called := false - otel.SetTracerProvider(fnTracerProvider{ + SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { called = true assert.Equal(t, "abc", name) @@ -118,10 +116,10 @@ func TestTraceProviderDelegates(t *testing.T) { } func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) // Retrieve the placeholder TracerProvider. - gtp := otel.GetTracerProvider() + gtp := TracerProvider() done := make(chan struct{}) quit := make(chan struct{}) @@ -142,7 +140,7 @@ func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { // Configure it with a spy. called := int32(0) - otel.SetTracerProvider(fnTracerProvider{ + SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { newVal := atomic.AddInt32(&called, 1) assert.Equal(t, "abc", name) @@ -161,10 +159,10 @@ func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { } func TestTracerDelegatesConcurrentSafe(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) // Retrieve the placeholder TracerProvider. - gtp := otel.GetTracerProvider() + gtp := TracerProvider() tracer := gtp.Tracer("abc", trace.WithInstrumentationVersion("xyz")) done := make(chan struct{}) @@ -186,7 +184,7 @@ func TestTracerDelegatesConcurrentSafe(t *testing.T) { // Configure it with a spy. called := int32(0) - otel.SetTracerProvider(fnTracerProvider{ + SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { assert.Equal(t, "abc", name) return fnTracer{ @@ -210,15 +208,15 @@ func TestTracerDelegatesConcurrentSafe(t *testing.T) { } func TestTraceProviderDelegatesSameInstance(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) // Retrieve the placeholder TracerProvider. - gtp := otel.GetTracerProvider() + gtp := TracerProvider() tracer := gtp.Tracer("abc", trace.WithInstrumentationVersion("xyz")) assert.Same(t, tracer, gtp.Tracer("abc", trace.WithInstrumentationVersion("xyz"))) assert.Same(t, tracer, gtp.Tracer("abc", trace.WithInstrumentationVersion("xyz"))) - otel.SetTracerProvider(fnTracerProvider{ + SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { return trace.NewNoopTracerProvider().Tracer("") }, @@ -228,7 +226,7 @@ func TestTraceProviderDelegatesSameInstance(t *testing.T) { } func TestSpanContextPropagatedWithNonRecordingSpan(t *testing.T) { - global.ResetForTest(t) + ResetForTest(t) sc := trace.NewSpanContext(trace.SpanContextConfig{ TraceID: [16]byte{0x01}, @@ -237,7 +235,7 @@ func TestSpanContextPropagatedWithNonRecordingSpan(t *testing.T) { Remote: true, }) ctx := trace.ContextWithSpanContext(context.Background(), sc) - _, span := otel.Tracer("test").Start(ctx, "test") + _, span := TracerProvider().Tracer("test").Start(ctx, "test") assert.Equal(t, sc, span.SpanContext()) assert.False(t, span.IsRecording()) diff --git a/internal/global/util_test.go b/internal/global/util_test.go new file mode 100644 index 00000000000..b066a74a20e --- /dev/null +++ b/internal/global/util_test.go @@ -0,0 +1,31 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global + +import ( + "sync" + "testing" +) + +// ResetForTest configures the test to restores the initial global state during +// its Cleanup step +func ResetForTest(t testing.TB) { + t.Cleanup(func() { + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + delegateTraceOnce = sync.Once{} + delegateTextMapPropagatorOnce = sync.Once{} + }) +} From 6729811b77d28ca9b0cca93e929864678d811989 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Thu, 14 Apr 2022 23:37:47 +0800 Subject: [PATCH 143/886] Fix histogram e2e test (#2716) * Fix histogram e2e test * Fix tests Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .../otlpmetric/internal/otlpmetrictest/otlptest.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go index 524cb774588..3047c0adfc0 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go @@ -38,7 +38,7 @@ import ( // RunEndToEndTest can be used by protocol driver tests to validate // themselves. func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter, mcMetrics Collector) { - selector := simple.NewWithInexpensiveDistribution() + selector := simple.NewWithHistogramDistribution() proc := processor.NewFactory(selector, aggregation.StatelessTemporalitySelector()) cont := controller.New(proc, controller.WithExporter(exp)) require.NoError(t, cont.Start(ctx)) @@ -54,6 +54,8 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter instruments := map[string]data{ "test-int64-counter": {sdkapi.CounterInstrumentKind, number.Int64Kind, 1}, "test-float64-counter": {sdkapi.CounterInstrumentKind, number.Float64Kind, 1}, + "test-int64-histogram": {sdkapi.HistogramInstrumentKind, number.Int64Kind, 2}, + "test-float64-histogram": {sdkapi.HistogramInstrumentKind, number.Float64Kind, 2}, "test-int64-gaugeobserver": {sdkapi.GaugeObserverInstrumentKind, number.Int64Kind, 3}, "test-float64-gaugeobserver": {sdkapi.GaugeObserverInstrumentKind, number.Float64Kind, 3}, } @@ -152,11 +154,12 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter } } case sdkapi.HistogramInstrumentKind: - require.NotNil(t, m.GetSummary()) - if dp := m.GetSummary().DataPoints; assert.Len(t, dp, 1) { + require.NotNil(t, m.GetHistogram()) + if dp := m.GetHistogram().DataPoints; assert.Len(t, dp, 1) { count := dp[0].Count assert.Equal(t, uint64(1), count, "invalid count for %q", m.Name) - assert.Equal(t, float64(data.val*int64(count)), dp[0].Sum, "invalid sum for %q (value %d)", m.Name, data.val) + require.NotNil(t, dp[0].Sum) + assert.Equal(t, float64(data.val*int64(count)), *dp[0].Sum, "invalid sum for %q (value %d)", m.Name, data.val) } default: assert.Failf(t, "invalid metrics kind", data.iKind.String()) From b47f16776172ffa4c18bd1acf1f2b5149446fb1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 08:50:40 -0700 Subject: [PATCH 144/886] Bump actions/upload-artifact from 2 to 3 (#2778) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5126759634..a327ef9e394 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,7 @@ jobs: fail_ci_if_error: true verbose: true - name: Store coverage test output - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: opentelemetry-go-test-output path: ${{ env.TEST_RESULTS }} From 3f9a8aabba9bf8b7ee9559f6ebeaf204b32d2c5c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 08:57:01 -0700 Subject: [PATCH 145/886] Bump codecov/codecov-action from 2.1.0 to 3.0.0 (#2779) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.1.0 to 3.0.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.1.0...v3.0.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a327ef9e394..9d869125703 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v2.1.0 + uses: codecov/codecov-action@v3.0.0 with: file: ./coverage.txt fail_ci_if_error: true From f6d691efa75a9081db0c288a1ae770cef58a4ef8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Apr 2022 09:13:05 -0700 Subject: [PATCH 146/886] Bump github.com/cenkalti/backoff/v4 from 4.1.2 to 4.1.3 in /exporters/otlp/internal/retry (#2780) * Bump github.com/cenkalti/backoff/v4 in /exporters/otlp/internal/retry Bumps [github.com/cenkalti/backoff/v4](https://github.com/cenkalti/backoff) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/cenkalti/backoff/releases) - [Commits](https://github.com/cenkalti/backoff/compare/v4.1.2...v4.1.3) --- updated-dependencies: - dependency-name: github.com/cenkalti/backoff/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Chester Cheung Co-authored-by: MrAlias --- example/otel-collector/go.sum | 4 ++-- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 1360dc0941e..b2a565d9bbe 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 8884eee4d99..8263d50146f 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry go 1.16 require ( - github.com/cenkalti/backoff/v4 v4.1.2 + github.com/cenkalti/backoff/v4 v4.1.3 github.com/stretchr/testify v1.7.1 ) diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index 0d874b89e7d..c7e998fc26a 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -1,5 +1,5 @@ -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 98fd383612f..f69a11110a4 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -37,8 +37,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 98fd383612f..f69a11110a4 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -37,8 +37,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 98fd383612f..f69a11110a4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -37,8 +37,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 7f886d05d81..de1726e24dc 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index ae12aff51b9..c78274ecb0d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 7f886d05d81..de1726e24dc 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo= -github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= +github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= From ff0857afc49b44cbbbbf0aae8f58a0dfee95d1ec Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 14 Apr 2022 11:17:22 -0700 Subject: [PATCH 147/886] Update RELEASING docs git command for semconv gen (#2789) --- RELEASING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index 063656fc72b..71e57625479 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -13,7 +13,7 @@ For example, ```sh export TAG="v1.7.0" # Change to the release version you are generating. export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" -cd "$OTEL_SPEC_REPO" && git checkout "tags/$TAG" && cd - +git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. ``` From 0f3ab76ff31af174bd0f8af54f194b91a80479f5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 15 Apr 2022 08:47:09 -0700 Subject: [PATCH 148/886] Rename all test funcs that mix camel and snake (#2788) Unify on Go standard camel case naming. Co-authored-by: Chester Cheung --- bridge/opentracing/mix_test.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/client_test.go | 12 ++++++------ .../otlp/otlptrace/otlptracegrpc/client_test.go | 12 ++++++------ exporters/stdout/stdouttrace/trace_test.go | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bridge/opentracing/mix_test.go b/bridge/opentracing/mix_test.go index 2d0de4ccd67..8fba1f06878 100644 --- a/bridge/opentracing/mix_test.go +++ b/bridge/opentracing/mix_test.go @@ -652,7 +652,7 @@ func runOTOtelOT(t *testing.T, ctx context.Context, name string, callback func(* }(ctx) } -func TestOtTagToOTelLabel_CheckTypeConversions(t *testing.T) { +func TestOtTagToOTelLabelCheckTypeConversions(t *testing.T) { tableTest := []struct { key string value interface{} diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index b9965a3ac9f..e843b054095 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -146,7 +146,7 @@ func TestExporterExportSpan(t *testing.T) { assert.Equal(t, tagVal, uploadedBatch.GetProcess().GetTags()[0].GetVStr()) } -func Test_spanSnapshotToThrift(t *testing.T) { +func TestSpanSnapshotToThrift(t *testing.T) { now := time.Now() traceID, _ := trace.TraceIDFromHex("0102030405060708090a0b0c0d0e0f10") spanID, _ := trace.SpanIDFromHex("0102030405060708") diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index dc7eeda51d9..c81e51e4fe9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -41,7 +41,7 @@ var ( testResource = resource.Empty() ) -func TestNewExporter_endToEnd(t *testing.T) { +func TestNewExporterEndToEnd(t *testing.T) { tests := []struct { name string additionalOpts []otlpmetricgrpc.Option @@ -131,7 +131,7 @@ func TestExporterShutdown(t *testing.T) { }) } -func TestNewExporter_invokeStartThenStopManyTimes(t *testing.T) { +func TestNewExporterInvokeStartThenStopManyTimes(t *testing.T) { mc := runMockCollector(t) defer func() { _ = mc.stop() @@ -164,7 +164,7 @@ func TestNewExporter_invokeStartThenStopManyTimes(t *testing.T) { } // This test takes a long time to run: to skip it, run tests using: -short -func TestNewExporter_collectorOnBadConnection(t *testing.T) { +func TestNewExporterCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") } @@ -185,7 +185,7 @@ func TestNewExporter_collectorOnBadConnection(t *testing.T) { _ = exp.Shutdown(ctx) } -func TestNewExporter_withEndpoint(t *testing.T) { +func TestNewExporterWithEndpoint(t *testing.T) { mc := runMockCollector(t) defer func() { _ = mc.stop() @@ -196,7 +196,7 @@ func TestNewExporter_withEndpoint(t *testing.T) { _ = exp.Shutdown(ctx) } -func TestNewExporter_withHeaders(t *testing.T) { +func TestNewExporterWithHeaders(t *testing.T) { mc := runMockCollector(t) defer func() { _ = mc.stop() @@ -216,7 +216,7 @@ func TestNewExporter_withHeaders(t *testing.T) { assert.Equal(t, "value1", headers.Get("header1")[0]) } -func TestNewExporter_WithTimeout(t *testing.T) { +func TestNewExporterWithTimeout(t *testing.T) { tts := []struct { name string fn func(exp *otlpmetric.Exporter) error diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 191ff23afd4..9228001a78c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -58,7 +58,7 @@ func contextWithTimeout(parent context.Context, t *testing.T, timeout time.Durat return context.WithDeadline(parent, d) } -func TestNew_endToEnd(t *testing.T) { +func TestNewEndToEnd(t *testing.T) { tests := []struct { name string additionalOpts []otlptracegrpc.Option @@ -141,7 +141,7 @@ func TestExporterShutdown(t *testing.T) { otlptracetest.RunExporterShutdownTest(t, factory) } -func TestNew_invokeStartThenStopManyTimes(t *testing.T) { +func TestNewInvokeStartThenStopManyTimes(t *testing.T) { mc := runMockCollector(t) t.Cleanup(func() { require.NoError(t, mc.stop()) }) @@ -168,7 +168,7 @@ func TestNew_invokeStartThenStopManyTimes(t *testing.T) { } // This test takes a long time to run: to skip it, run tests using: -short -func TestNew_collectorOnBadConnection(t *testing.T) { +func TestNewCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") } @@ -189,7 +189,7 @@ func TestNew_collectorOnBadConnection(t *testing.T) { _ = exp.Shutdown(ctx) } -func TestNew_withEndpoint(t *testing.T) { +func TestNewWithEndpoint(t *testing.T) { mc := runMockCollector(t) t.Cleanup(func() { require.NoError(t, mc.stop()) }) @@ -198,7 +198,7 @@ func TestNew_withEndpoint(t *testing.T) { _ = exp.Shutdown(ctx) } -func TestNew_withHeaders(t *testing.T) { +func TestNewWithHeaders(t *testing.T) { mc := runMockCollector(t) t.Cleanup(func() { require.NoError(t, mc.stop()) }) @@ -238,7 +238,7 @@ func TestExportSpansTimeoutHonored(t *testing.T) { require.Equal(t, codes.DeadlineExceeded, status.Convert(err).Code()) } -func TestNew_withMultipleAttributeTypes(t *testing.T) { +func TestNewWithMultipleAttributeTypes(t *testing.T) { mc := runMockCollector(t) <-time.After(5 * time.Millisecond) diff --git a/exporters/stdout/stdouttrace/trace_test.go b/exporters/stdout/stdouttrace/trace_test.go index 1095cb5666c..77ceae2baeb 100644 --- a/exporters/stdout/stdouttrace/trace_test.go +++ b/exporters/stdout/stdouttrace/trace_test.go @@ -33,7 +33,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -func TestExporter_ExportSpan(t *testing.T) { +func TestExporterExportSpan(t *testing.T) { // setup test span now := time.Now() traceID, _ := trace.TraceIDFromHex("0102030405060708090a0b0c0d0e0f10") From 1884de2b4b68aaf6e7613339b6d0b4397e5aa5c8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 15 Apr 2022 22:58:24 -0700 Subject: [PATCH 149/886] Add semconv/v1.8.0 (#2763) * No wrap RELEASING Semantic Convention Generation section * Initial generator * Update template render * Add exception and schema templates * Add semconv/internal http unification * Add http template * Add licenses header * Embed the templates * Update static version in schema tmpl * Add semconv-generate target to Makefile Use this target to generate versions of the semconv packages. * Generate semconv packages * Update RELEASING to use make semconv-generate * Add comments to semconvkit * Generate semconv/v1.8.0 * Use new version of semconv * Add changes to changelog Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 2 + bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- semconv/v1.8.0/doc.go | 20 + semconv/v1.8.0/exception.go | 20 + semconv/v1.8.0/http.go | 114 ++ semconv/v1.8.0/resource.go | 971 ++++++++++ semconv/v1.8.0/schema.go | 20 + semconv/v1.8.0/trace.go | 1617 +++++++++++++++++ website_docs/manual.md | 4 +- 32 files changed, 2790 insertions(+), 26 deletions(-) create mode 100644 semconv/v1.8.0/doc.go create mode 100644 semconv/v1.8.0/exception.go create mode 100644 semconv/v1.8.0/http.go create mode 100644 semconv/v1.8.0/resource.go create mode 100644 semconv/v1.8.0/schema.go create mode 100644 semconv/v1.8.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index ebd5a72511d..4db1d233028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The metrics global package was added back into several test files. (#2764) - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) +- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. + The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) ### Removed diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 4694a8e9b28..bc96d0d2fe0 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index 7ed61c05be8..d29a58df623 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 9f4ec492e1c..db92a1fec6d 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 61a0d2b5ca9..a6bbceec190 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 858a8f46976..2b568d6686f 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index d87b79621ef..046a4c059b9 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index e843b054095..0beee98be31 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 8f27033b14e..41c0b757bb5 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index c0791bd96c1..2cecb9211d6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 64660c341ac..3b3708603c3 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -22,7 +22,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 38a7368b7a5..9a9d7c187a7 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 09c6f704418..0f76bddbb51 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index c3abe353a37..1216fa97030 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 20e8baf4f07..70ad8bca931 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 701eae40a39..86e462e79ca 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index e56978adad5..2810cd600c5 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 9392296cbab..95225fb57a3 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -21,7 +21,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 460f1f52607..31ee9916880 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 59329770cf0..bcad43e7df2 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 97c982cf8fa..61087c92cf0 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index c1e5ae90a5b..b34c4e3bad3 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index fa9b9e4ea05..7e44657e41b 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index f2dda294580..51410f16efa 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index fe401d06535..0365f2714f9 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) diff --git a/semconv/v1.8.0/doc.go b/semconv/v1.8.0/doc.go new file mode 100644 index 00000000000..0cf6b7927aa --- /dev/null +++ b/semconv/v1.8.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.8.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" diff --git a/semconv/v1.8.0/exception.go b/semconv/v1.8.0/exception.go new file mode 100644 index 00000000000..40b3ddcacdd --- /dev/null +++ b/semconv/v1.8.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.8.0/http.go b/semconv/v1.8.0/http.go new file mode 100644 index 00000000000..fa1f4b69488 --- /dev/null +++ b/semconv/v1.8.0/http.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/semconv/v1.8.0/resource.go b/semconv/v1.8.0/resource.go new file mode 100644 index 00000000000..d12158bfbf6 --- /dev/null +++ b/semconv/v1.8.0/resource.go @@ -0,0 +1,971 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // Required: No + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // Required: No + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback function (which + // may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) span attributes). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: Depending on the cloud provider, use: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) with the resolved function version, as the same runtime instance + // may be invokable with multiple + // different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id). + + // On some providers, it may not be possible to determine the full ID at startup, + // which is why this field cannot be made required. For example, on AWS the + // account ID + // part of the ARN is not available without calling another AWS API + // which may be deemed too slow for a short-running lambda function. + // As an alternative, consider setting `faas.id` as a span attribute instead. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // Required: No + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // Required: Always + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // Required: See below + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // Required: No + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.8.0/schema.go b/semconv/v1.8.0/schema.go new file mode 100644 index 00000000000..9586a21047e --- /dev/null +++ b/semconv/v1.8.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.8.0" diff --git a/semconv/v1.8.0/trace.go b/semconv/v1.8.0/trace.go new file mode 100644 index 00000000000..154ebbe885b --- /dev/null +++ b/semconv/v1.8.0/trace.go @@ -0,0 +1,1617 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.8.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // Required: Required, if applicable. + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // Required: Required if applicable and not explicitly disabled via + // instrumentation configuration. + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // Required: Required, if `db.statement` is not applicable. + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // Required: No + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // Required: No + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // Required: Required, if other than the default database (`0`). + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // Required: No + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#exception-end-example). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // Required: Always + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // Required: No + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // Required: Always + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // Required: For some cloud providers, like AWS or GCP, the region in which a + // function is hosted is essential to uniquely identify the function and also part + // of its endpoint. Since it's part of the endpoint being called, the region is + // always known to clients. In these cases, `faas.invoked_region` MUST be set + // accordingly. If the region is unknown to the client or not required for + // identifying the invoked function, setting `faas.invoked_region` is optional. + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // Required: No + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Remote address of the peer (dotted decimal for IPv4 or + // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) + // + // Type: string + // Required: No + // Stability: stable + // Examples: '127.0.0.1' + NetPeerIPKey = attribute.Key("net.peer.ip") + // Remote port number. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Remote hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + NetPeerNameKey = attribute.Key("net.peer.name") + // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '192.168.0.1' + NetHostIPKey = attribute.Key("net.host.ip") + // Like `net.peer.port` but for the host port. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 35555 + NetHostPortKey = attribute.Key("net.host.port") + // Local hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // The internet connection type currently being used by the host. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Another IP-based protocol + NetTransportIP = NetTransportKey.String("ip") + // Unix Domain socket. See below + NetTransportUnix = NetTransportKey.String("unix") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/path/12314/?q=ddds#123' + HTTPTargetKey = attribute.Key("http.target") + // The value of the [HTTP host + // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header + // should also be reported, see note. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'www.example.org' + // Note: When the header is present but empty the attribute SHOULD be set to the + // empty string. Note that this is a valid situation that is expected in certain + // cases, according the aforementioned [section of RFC + // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not + // set the attribute MUST NOT be set. + HTTPHostKey = attribute.Key("http.host") + // The URI scheme identifying the used protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // Required: If and only if one was received/sent. + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User- + // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the + // client. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the uncompressed request payload body after transport decoding. Not + // set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + // The size of the uncompressed response payload body after transport decoding. + // Not set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") +) + +var ( + // HTTP 1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP 1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP 2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Server +const ( + // The primary server name of the matched virtual host. This should be obtained + // via configuration. If no such configuration can be obtained, this attribute + // MUST NOT be set ( `net.host.name` should be used instead). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `http.url` is usually not readily available on the server side but would + // have to be assembled in a cumbersome and sometimes lossy process from other + // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus + // preferred to supply the raw data that is available. + HTTPServerNameKey = attribute.Key("http.server_name") + // The matched route (path template). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/users/:userID?' + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.peer.ip`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.peer.ip`, is available even if that other + // source just confirms the same value as `net.peer.ip`. + // Rationale: For `net.peer.ip`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.peer.ip` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // Required: Required only if the message destination is either a `queue` or + // `topic`. + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // Required: Unless it is empty. + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'grpc', 'java_rmi', 'wcf' + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // Required: No + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // Required: No + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) diff --git a/website_docs/manual.md b/website_docs/manual.md index 825a68f46b9..4c66bfc2614 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" + semconv "go.opentelemetry.io/otel/semconv/v1.8.0" "go.opentelemetry.io/otel/trace" ) @@ -162,7 +162,7 @@ span.SetAttributes(myKey.String("a value")) #### Semantic Attributes -Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.7.0` package. +Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.8.0` package. For details, see [Trace semantic conventions][]. From a8ea3dbb460d973f14de7e56ff4b3aa42956c3dd Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 18 Apr 2022 07:31:31 -0700 Subject: [PATCH 150/886] Replace use of old term label with attribute (#2790) * Replace use of old term label with attribute The specification has unified on the term attribute to describe key-value pairs. There exist still many hold-overs of the use of the term label. This updates those uses or deprecates exported types and functions in favor of renamed forms. * fix infinite recursion * Remove backticks from attribute set docs * Remove LabelFilterSelector entirely * Remove Metadata.Labels instead of deprecate * Update changelog with public changes * Revert OC err msg --- CHANGELOG.md | 18 +++ attribute/encoder.go | 82 +++++----- attribute/iterator.go | 78 ++++++---- attribute/iterator_test.go | 22 +-- attribute/set.go | 143 ++++++++---------- attribute/set_test.go | 4 +- bridge/opencensus/exporter.go | 22 +-- bridge/opencensus/exporter_test.go | 22 +-- bridge/opentracing/bridge.go | 20 +-- bridge/opentracing/mix_test.go | 4 +- example/otel-collector/main.go | 14 +- example/prometheus/main.go | 28 ++-- exporters/otlp/otlpmetric/exporter_test.go | 60 ++++---- .../internal/metrictransform/metric.go | 28 ++-- .../internal/metrictransform/metric_test.go | 28 ++-- .../internal/otlpmetrictest/data.go | 4 +- .../internal/otlpmetrictest/otlptest.go | 14 +- exporters/prometheus/prometheus.go | 66 ++++---- exporters/prometheus/prometheus_test.go | 24 +-- exporters/stdout/stdoutmetric/config.go | 34 ++--- exporters/stdout/stdoutmetric/metric.go | 30 ++-- exporters/stdout/stdoutmetric/metric_test.go | 2 +- sdk/metric/aggregator/lastvalue/lastvalue.go | 7 +- sdk/metric/benchmark_test.go | 74 ++++----- sdk/metric/correct_test.go | 18 +-- sdk/metric/doc.go | 26 ++-- sdk/metric/export/metric.go | 41 +++-- sdk/metric/export/metric_test.go | 16 +- sdk/metric/metrictest/meter.go | 2 +- sdk/metric/processor/basic/basic.go | 12 +- sdk/metric/processor/basic/basic_test.go | 4 +- sdk/metric/processor/basic/config.go | 15 +- sdk/metric/processor/processortest/test.go | 51 +++---- sdk/metric/processor/reducer/doc.go | 16 +- sdk/metric/processor/reducer/reducer.go | 24 +-- sdk/metric/processor/reducer/reducer_test.go | 6 +- sdk/metric/sdk.go | 26 ++-- sdk/metric/sdkapi/noop.go | 2 +- sdk/metric/sdkapi/sdkapi.go | 4 +- sdk/resource/benchmark_test.go | 4 +- sdk/resource/resource.go | 2 +- semconv/internal/http_test.go | 6 +- 42 files changed, 554 insertions(+), 549 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4db1d233028..deebc30c51c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,24 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Resolve supply-chain failure for the markdown-link-checker GitHub action by calling the CLI directly. (#2834) - Remove import of `testing` package in non-tests builds. (#2786) +### Changed + +- The `WithLabelEncoder` option from the `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` package is renamed to `WithAttributeEncoder`. (#2790) +- The `Batch.Labels` field from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package is renamed to `Batch.Attributes`. (#2790) +- The `LabelFilterSelector` interface from `go.opentelemetry.io/otel/sdk/metric/processor/reducer` is renamed to `AttributeFilterSelector`. + The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) +- The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. + Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) + +### Deprecated + +- The `Iterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.Attribute` method instead. (#2790) +- The `Iterator.IndexedLabel` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `Iterator.IndexedAttribute` method instead. (#2790) +- The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. + Use the equivalent `MergeIterator.Attribute` method instead. (#2790) + ## [0.29.0] - 2022-04-11 ### Added diff --git a/attribute/encoder.go b/attribute/encoder.go index 8b940f78dc4..dae1d8f61fd 100644 --- a/attribute/encoder.go +++ b/attribute/encoder.go @@ -21,19 +21,17 @@ import ( ) type ( - // Encoder is a mechanism for serializing a label set into a - // specific string representation that supports caching, to - // avoid repeated serialization. An example could be an - // exporter encoding the label set into a wire representation. + // Encoder is a mechanism for serializing an attribute set into a specific + // string representation that supports caching, to avoid repeated + // serialization. An example could be an exporter encoding the attribute + // set into a wire representation. Encoder interface { - // Encode returns the serialized encoding of the label - // set using its Iterator. This result may be cached - // by a attribute.Set. + // Encode returns the serialized encoding of the attribute set using + // its Iterator. This result may be cached by a attribute.Set. Encode(iterator Iterator) string - // ID returns a value that is unique for each class of - // label encoder. Label encoders allocate these using - // `NewEncoderID`. + // ID returns a value that is unique for each class of attribute + // encoder. Attribute encoders allocate these using `NewEncoderID`. ID() EncoderID } @@ -43,54 +41,53 @@ type ( value uint64 } - // defaultLabelEncoder uses a sync.Pool of buffers to reduce - // the number of allocations used in encoding labels. This - // implementation encodes a comma-separated list of key=value, - // with '/'-escaping of '=', ',', and '\'. - defaultLabelEncoder struct { - // pool is a pool of labelset builders. The buffers in this - // pool grow to a size that most label encodings will not - // allocate new memory. + // defaultAttrEncoder uses a sync.Pool of buffers to reduce the number of + // allocations used in encoding attributes. This implementation encodes a + // comma-separated list of key=value, with '/'-escaping of '=', ',', and + // '\'. + defaultAttrEncoder struct { + // pool is a pool of attribute set builders. The buffers in this pool + // grow to a size that most attribute encodings will not allocate new + // memory. pool sync.Pool // *bytes.Buffer } ) -// escapeChar is used to ensure uniqueness of the label encoding where -// keys or values contain either '=' or ','. Since there is no parser -// needed for this encoding and its only requirement is to be unique, -// this choice is arbitrary. Users will see these in some exporters -// (e.g., stdout), so the backslash ('\') is used as a conventional choice. +// escapeChar is used to ensure uniqueness of the attribute encoding where +// keys or values contain either '=' or ','. Since there is no parser needed +// for this encoding and its only requirement is to be unique, this choice is +// arbitrary. Users will see these in some exporters (e.g., stdout), so the +// backslash ('\') is used as a conventional choice. const escapeChar = '\\' var ( - _ Encoder = &defaultLabelEncoder{} + _ Encoder = &defaultAttrEncoder{} - // encoderIDCounter is for generating IDs for other label - // encoders. + // encoderIDCounter is for generating IDs for other attribute encoders. encoderIDCounter uint64 defaultEncoderOnce sync.Once defaultEncoderID = NewEncoderID() - defaultEncoderInstance *defaultLabelEncoder + defaultEncoderInstance *defaultAttrEncoder ) -// NewEncoderID returns a unique label encoder ID. It should be -// called once per each type of label encoder. Preferably in init() or -// in var definition. +// NewEncoderID returns a unique attribute encoder ID. It should be called +// once per each type of attribute encoder. Preferably in init() or in var +// definition. func NewEncoderID() EncoderID { return EncoderID{value: atomic.AddUint64(&encoderIDCounter, 1)} } -// DefaultEncoder returns a label encoder that encodes labels -// in such a way that each escaped label's key is followed by an equal -// sign and then by an escaped label's value. All key-value pairs are -// separated by a comma. +// DefaultEncoder returns an attribute encoder that encodes attributes in such +// a way that each escaped attribute's key is followed by an equal sign and +// then by an escaped attribute's value. All key-value pairs are separated by +// a comma. // -// Escaping is done by prepending a backslash before either a -// backslash, equal sign or a comma. +// Escaping is done by prepending a backslash before either a backslash, equal +// sign or a comma. func DefaultEncoder() Encoder { defaultEncoderOnce.Do(func() { - defaultEncoderInstance = &defaultLabelEncoder{ + defaultEncoderInstance = &defaultAttrEncoder{ pool: sync.Pool{ New: func() interface{} { return &bytes.Buffer{} @@ -101,15 +98,14 @@ func DefaultEncoder() Encoder { return defaultEncoderInstance } -// Encode is a part of an implementation of the LabelEncoder -// interface. -func (d *defaultLabelEncoder) Encode(iter Iterator) string { +// Encode is a part of an implementation of the AttributeEncoder interface. +func (d *defaultAttrEncoder) Encode(iter Iterator) string { buf := d.pool.Get().(*bytes.Buffer) defer d.pool.Put(buf) buf.Reset() for iter.Next() { - i, keyValue := iter.IndexedLabel() + i, keyValue := iter.IndexedAttribute() if i > 0 { _, _ = buf.WriteRune(',') } @@ -126,8 +122,8 @@ func (d *defaultLabelEncoder) Encode(iter Iterator) string { return buf.String() } -// ID is a part of an implementation of the LabelEncoder interface. -func (*defaultLabelEncoder) ID() EncoderID { +// ID is a part of an implementation of the AttributeEncoder interface. +func (*defaultAttrEncoder) ID() EncoderID { return defaultEncoderID } diff --git a/attribute/iterator.go b/attribute/iterator.go index e03aabb62bd..841b271fb7d 100644 --- a/attribute/iterator.go +++ b/attribute/iterator.go @@ -14,16 +14,16 @@ package attribute // import "go.opentelemetry.io/otel/attribute" -// Iterator allows iterating over the set of labels in order, -// sorted by key. +// Iterator allows iterating over the set of attributes in order, sorted by +// key. type Iterator struct { storage *Set idx int } -// MergeIterator supports iterating over two sets of labels while -// eliminating duplicate values from the combined set. The first -// iterator value takes precedence. +// MergeIterator supports iterating over two sets of attributes while +// eliminating duplicate values from the combined set. The first iterator +// value takes precedence. type MergeIterator struct { one oneIterator two oneIterator @@ -31,13 +31,13 @@ type MergeIterator struct { } type oneIterator struct { - iter Iterator - done bool - label KeyValue + iter Iterator + done bool + attr KeyValue } -// Next moves the iterator to the next position. Returns false if there -// are no more labels. +// Next moves the iterator to the next position. Returns false if there are no +// more attributes. func (i *Iterator) Next() bool { i.idx++ return i.idx < i.Len() @@ -45,30 +45,41 @@ func (i *Iterator) Next() bool { // Label returns current KeyValue. Must be called only after Next returns // true. +// +// Deprecated: Use Attribute instead. func (i *Iterator) Label() KeyValue { - kv, _ := i.storage.Get(i.idx) - return kv + return i.Attribute() } -// Attribute is a synonym for Label(). +// Attribute returns the current KeyValue of the Iterator. It must be called +// only after Next returns true. func (i *Iterator) Attribute() KeyValue { - return i.Label() + kv, _ := i.storage.Get(i.idx) + return kv } // IndexedLabel returns current index and attribute. Must be called only // after Next returns true. +// +// Deprecated: Use IndexedAttribute instead. func (i *Iterator) IndexedLabel() (int, KeyValue) { - return i.idx, i.Label() + return i.idx, i.Attribute() } -// Len returns a number of labels in the iterator's `*Set`. +// IndexedAttribute returns current index and attribute. Must be called only +// after Next returns true. +func (i *Iterator) IndexedAttribute() (int, KeyValue) { + return i.idx, i.Attribute() +} + +// Len returns a number of attributes in the iterated set. func (i *Iterator) Len() int { return i.storage.Len() } -// ToSlice is a convenience function that creates a slice of labels -// from the passed iterator. The iterator is set up to start from the -// beginning before creating the slice. +// ToSlice is a convenience function that creates a slice of attributes from +// the passed iterator. The iterator is set up to start from the beginning +// before creating the slice. func (i *Iterator) ToSlice() []KeyValue { l := i.Len() if l == 0 { @@ -77,12 +88,12 @@ func (i *Iterator) ToSlice() []KeyValue { i.idx = -1 slice := make([]KeyValue, 0, l) for i.Next() { - slice = append(slice, i.Label()) + slice = append(slice, i.Attribute()) } return slice } -// NewMergeIterator returns a MergeIterator for merging two label sets +// NewMergeIterator returns a MergeIterator for merging two attribute sets. // Duplicates are resolved by taking the value from the first set. func NewMergeIterator(s1, s2 *Set) MergeIterator { mi := MergeIterator{ @@ -102,42 +113,49 @@ func makeOne(iter Iterator) oneIterator { func (oi *oneIterator) advance() { if oi.done = !oi.iter.Next(); !oi.done { - oi.label = oi.iter.Label() + oi.attr = oi.iter.Attribute() } } -// Next returns true if there is another label available. +// Next returns true if there is another attribute available. func (m *MergeIterator) Next() bool { if m.one.done && m.two.done { return false } if m.one.done { - m.current = m.two.label + m.current = m.two.attr m.two.advance() return true } if m.two.done { - m.current = m.one.label + m.current = m.one.attr m.one.advance() return true } - if m.one.label.Key == m.two.label.Key { - m.current = m.one.label // first iterator label value wins + if m.one.attr.Key == m.two.attr.Key { + m.current = m.one.attr // first iterator attribute value wins m.one.advance() m.two.advance() return true } - if m.one.label.Key < m.two.label.Key { - m.current = m.one.label + if m.one.attr.Key < m.two.attr.Key { + m.current = m.one.attr m.one.advance() return true } - m.current = m.two.label + m.current = m.two.attr m.two.advance() return true } // Label returns the current value after Next() returns true. +// +// Deprecated: Use Attribute instead. func (m *MergeIterator) Label() KeyValue { return m.current } + +// Attribute returns the current value after Next() returns true. +func (m *MergeIterator) Attribute() KeyValue { + return m.current +} diff --git a/attribute/iterator_test.go b/attribute/iterator_test.go index 9c5d4d7dbda..0a6ea92e172 100644 --- a/attribute/iterator_test.go +++ b/attribute/iterator_test.go @@ -31,15 +31,15 @@ func TestIterator(t *testing.T) { require.Equal(t, 2, iter.Len()) require.True(t, iter.Next()) - require.Equal(t, one, iter.Label()) - idx, attr := iter.IndexedLabel() + require.Equal(t, one, iter.Attribute()) + idx, attr := iter.IndexedAttribute() require.Equal(t, 0, idx) require.Equal(t, one, attr) require.Equal(t, 2, iter.Len()) require.True(t, iter.Next()) - require.Equal(t, two, iter.Label()) - idx, attr = iter.IndexedLabel() + require.Equal(t, two, iter.Attribute()) + idx, attr = iter.IndexedAttribute() require.Equal(t, 1, idx) require.Equal(t, two, attr) require.Equal(t, 2, iter.Len()) @@ -64,7 +64,7 @@ func TestMergedIterator(t *testing.T) { expect []string } - makeLabels := func(keys []string, num int) (result []attribute.KeyValue) { + makeAttributes := func(keys []string, num int) (result []attribute.KeyValue) { for _, k := range keys { result = append(result, attribute.Int(k, num)) } @@ -128,19 +128,19 @@ func TestMergedIterator(t *testing.T) { }, } { t.Run(input.name, func(t *testing.T) { - labels1 := makeLabels(input.keys1, 1) - labels2 := makeLabels(input.keys2, 2) + attr1 := makeAttributes(input.keys1, 1) + attr2 := makeAttributes(input.keys2, 2) - set1 := attribute.NewSet(labels1...) - set2 := attribute.NewSet(labels2...) + set1 := attribute.NewSet(attr1...) + set2 := attribute.NewSet(attr2...) merge := attribute.NewMergeIterator(&set1, &set2) var result []string for merge.Next() { - label := merge.Label() - result = append(result, fmt.Sprint(label.Key, "/", label.Value.Emit())) + attr := merge.Attribute() + result = append(result, fmt.Sprint(attr.Key, "/", attr.Value.Emit())) } require.Equal(t, input.expect, result) diff --git a/attribute/set.go b/attribute/set.go index a28f1435cb9..5c24700866d 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -21,49 +21,42 @@ import ( ) type ( - // Set is the representation for a distinct label set. It - // manages an immutable set of labels, with an internal cache - // for storing label encodings. + // Set is the representation for a distinct attribute set. It manages an + // immutable set of attributes, with an internal cache for storing + // attribute encodings. // - // This type supports the `Equivalent` method of comparison - // using values of type `Distinct`. - // - // This type is used to implement: - // 1. Metric labels - // 2. Resource sets - // 3. Correlation map (TODO) + // This type supports the Equivalent method of comparison using values of + // type Distinct. Set struct { equivalent Distinct } - // Distinct wraps a variable-size array of `KeyValue`, - // constructed with keys in sorted order. This can be used as - // a map key or for equality checking between Sets. + // Distinct wraps a variable-size array of KeyValue, constructed with keys + // in sorted order. This can be used as a map key or for equality checking + // between Sets. Distinct struct { iface interface{} } - // Filter supports removing certain labels from label sets. - // When the filter returns true, the label will be kept in - // the filtered label set. When the filter returns false, the - // label is excluded from the filtered label set, and the - // label instead appears in the `removed` list of excluded labels. + // Filter supports removing certain attributes from attribute sets. When + // the filter returns true, the attribute will be kept in the filtered + // attribute set. When the filter returns false, the attribute is excluded + // from the filtered attribute set, and the attribute instead appears in + // the removed list of excluded attributes. Filter func(KeyValue) bool - // Sortable implements `sort.Interface`, used for sorting - // `KeyValue`. This is an exported type to support a - // memory optimization. A pointer to one of these is needed - // for the call to `sort.Stable()`, which the caller may - // provide in order to avoid an allocation. See - // `NewSetWithSortable()`. + // Sortable implements sort.Interface, used for sorting KeyValue. This is + // an exported type to support a memory optimization. A pointer to one of + // these is needed for the call to sort.Stable(), which the caller may + // provide in order to avoid an allocation. See NewSetWithSortable(). Sortable []KeyValue ) var ( - // keyValueType is used in `computeDistinctReflect`. + // keyValueType is used in computeDistinctReflect. keyValueType = reflect.TypeOf(KeyValue{}) - // emptySet is returned for empty label sets. + // emptySet is returned for empty attribute sets. emptySet = &Set{ equivalent: Distinct{ iface: [0]KeyValue{}, @@ -78,17 +71,17 @@ func EmptySet() *Set { return emptySet } -// reflect abbreviates `reflect.ValueOf`. +// reflect abbreviates reflect.ValueOf. func (d Distinct) reflect() reflect.Value { return reflect.ValueOf(d.iface) } -// Valid returns true if this value refers to a valid `*Set`. +// Valid returns true if this value refers to a valid Set. func (d Distinct) Valid() bool { return d.iface != nil } -// Len returns the number of labels in this set. +// Len returns the number of attributes in this set. func (l *Set) Len() int { if l == nil || !l.equivalent.Valid() { return 0 @@ -96,7 +89,7 @@ func (l *Set) Len() int { return l.equivalent.reflect().Len() } -// Get returns the KeyValue at ordered position `idx` in this set. +// Get returns the KeyValue at ordered position idx in this set. func (l *Set) Get(idx int) (KeyValue, bool) { if l == nil { return KeyValue{}, false @@ -142,7 +135,7 @@ func (l *Set) HasValue(k Key) bool { return ok } -// Iter returns an iterator for visiting the labels in this set. +// Iter returns an iterator for visiting the attributes in this set. func (l *Set) Iter() Iterator { return Iterator{ storage: l, @@ -150,18 +143,17 @@ func (l *Set) Iter() Iterator { } } -// ToSlice returns the set of labels belonging to this set, sorted, -// where keys appear no more than once. +// ToSlice returns the set of attributes belonging to this set, sorted, where +// keys appear no more than once. func (l *Set) ToSlice() []KeyValue { iter := l.Iter() return iter.ToSlice() } -// Equivalent returns a value that may be used as a map key. The -// Distinct type guarantees that the result will equal the equivalent -// Distinct value of any label set with the same elements as this, -// where sets are made unique by choosing the last value in the input -// for any given key. +// Equivalent returns a value that may be used as a map key. The Distinct type +// guarantees that the result will equal the equivalent. Distinct value of any +// attribute set with the same elements as this, where sets are made unique by +// choosing the last value in the input for any given key. func (l *Set) Equivalent() Distinct { if l == nil || !l.equivalent.Valid() { return emptySet.equivalent @@ -174,8 +166,7 @@ func (l *Set) Equals(o *Set) bool { return l.Equivalent() == o.Equivalent() } -// Encoded returns the encoded form of this set, according to -// `encoder`. +// Encoded returns the encoded form of this set, according to encoder. func (l *Set) Encoded(encoder Encoder) string { if l == nil || encoder == nil { return "" @@ -190,11 +181,11 @@ func empty() Set { } } -// NewSet returns a new `Set`. See the documentation for -// `NewSetWithSortableFiltered` for more details. +// NewSet returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. // -// Except for empty sets, this method adds an additional allocation -// compared with calls that include a `*Sortable`. +// Except for empty sets, this method adds an additional allocation compared +// with calls that include a Sortable. func NewSet(kvs ...KeyValue) Set { // Check for empty set. if len(kvs) == 0 { @@ -204,10 +195,10 @@ func NewSet(kvs ...KeyValue) Set { return s } -// NewSetWithSortable returns a new `Set`. See the documentation for -// `NewSetWithSortableFiltered` for more details. +// NewSetWithSortable returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. // -// This call includes a `*Sortable` option as a memory optimization. +// This call includes a Sortable option as a memory optimization. func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { // Check for empty set. if len(kvs) == 0 { @@ -217,12 +208,11 @@ func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { return s } -// NewSetWithFiltered returns a new `Set`. See the documentation for -// `NewSetWithSortableFiltered` for more details. +// NewSetWithFiltered returns a new Set. See the documentation for +// NewSetWithSortableFiltered for more details. // -// This call includes a `Filter` to include/exclude label keys from -// the return value. Excluded keys are returned as a slice of label -// values. +// This call includes a Filter to include/exclude attribute keys from the +// return value. Excluded keys are returned as a slice of attribute values. func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { // Check for empty set. if len(kvs) == 0 { @@ -231,7 +221,7 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { return NewSetWithSortableFiltered(kvs, new(Sortable), filter) } -// NewSetWithSortableFiltered returns a new `Set`. +// NewSetWithSortableFiltered returns a new Set. // // Duplicate keys are eliminated by taking the last value. This // re-orders the input slice so that unique last-values are contiguous @@ -243,17 +233,16 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { // - Caller sees the reordering, but doesn't lose values // - Repeated call preserve last-value wins. // -// Note that methods are defined on `*Set`, although this returns `Set`. -// Callers can avoid memory allocations by: +// Note that methods are defined on Set, although this returns Set. Callers +// can avoid memory allocations by: // -// - allocating a `Sortable` for use as a temporary in this method -// - allocating a `Set` for storing the return value of this -// constructor. +// - allocating a Sortable for use as a temporary in this method +// - allocating a Set for storing the return value of this constructor. // -// The result maintains a cache of encoded labels, by attribute.EncoderID. +// The result maintains a cache of encoded attributes, by attribute.EncoderID. // This value should not be copied after its first use. // -// The second `[]KeyValue` return value is a list of labels that were +// The second []KeyValue return value is a list of attributes that were // excluded by the Filter (if non-nil). func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) { // Check for empty set. @@ -293,13 +282,13 @@ func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (S }, nil } -// filterSet reorders `kvs` so that included keys are contiguous at -// the end of the slice, while excluded keys precede the included keys. +// filterSet reorders kvs so that included keys are contiguous at the end of +// the slice, while excluded keys precede the included keys. func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) { var excluded []KeyValue - // Move labels that do not match the filter so - // they're adjacent before calling computeDistinct(). + // Move attributes that do not match the filter so they're adjacent before + // calling computeDistinct(). distinctPosition := len(kvs) // Swap indistinct keys forward and distinct keys toward the @@ -319,8 +308,8 @@ func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) { }, excluded } -// Filter returns a filtered copy of this `Set`. See the -// documentation for `NewSetWithSortableFiltered` for more details. +// Filter returns a filtered copy of this Set. See the documentation for +// NewSetWithSortableFiltered for more details. func (l *Set) Filter(re Filter) (Set, []KeyValue) { if re == nil { return Set{ @@ -333,9 +322,9 @@ func (l *Set) Filter(re Filter) (Set, []KeyValue) { return filterSet(l.ToSlice(), re) } -// computeDistinct returns a `Distinct` using either the fixed- or -// reflect-oriented code path, depending on the size of the input. -// The input slice is assumed to already be sorted and de-duplicated. +// computeDistinct returns a Distinct using either the fixed- or +// reflect-oriented code path, depending on the size of the input. The input +// slice is assumed to already be sorted and de-duplicated. func computeDistinct(kvs []KeyValue) Distinct { iface := computeDistinctFixed(kvs) if iface == nil { @@ -346,8 +335,8 @@ func computeDistinct(kvs []KeyValue) Distinct { } } -// computeDistinctFixed computes a `Distinct` for small slices. It -// returns nil if the input is too large for this code path. +// computeDistinctFixed computes a Distinct for small slices. It returns nil +// if the input is too large for this code path. func computeDistinctFixed(kvs []KeyValue) interface{} { switch len(kvs) { case 1: @@ -395,8 +384,8 @@ func computeDistinctFixed(kvs []KeyValue) interface{} { } } -// computeDistinctReflect computes a `Distinct` using reflection, -// works for any size input. +// computeDistinctReflect computes a Distinct using reflection, works for any +// size input. func computeDistinctReflect(kvs []KeyValue) interface{} { at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem() for i, keyValue := range kvs { @@ -405,7 +394,7 @@ func computeDistinctReflect(kvs []KeyValue) interface{} { return at.Interface() } -// MarshalJSON returns the JSON encoding of the `*Set`. +// MarshalJSON returns the JSON encoding of the Set. func (l *Set) MarshalJSON() ([]byte, error) { return json.Marshal(l.equivalent.iface) } @@ -419,17 +408,17 @@ func (l Set) MarshalLog() interface{} { return kvs } -// Len implements `sort.Interface`. +// Len implements sort.Interface. func (l *Sortable) Len() int { return len(*l) } -// Swap implements `sort.Interface`. +// Swap implements sort.Interface. func (l *Sortable) Swap(i, j int) { (*l)[i], (*l)[j] = (*l)[j], (*l)[i] } -// Less implements `sort.Interface`. +// Less implements sort.Interface. func (l *Sortable) Less(i, j int) bool { return (*l)[i].Key < (*l)[j].Key } diff --git a/attribute/set_test.go b/attribute/set_test.go index 1293c3aad8f..179a9006a21 100644 --- a/attribute/set_test.go +++ b/attribute/set_test.go @@ -159,8 +159,8 @@ func TestUniqueness(t *testing.T) { for _, tc := range cases { cpy := make([]attribute.KeyValue, len(tc.kvs)) copy(cpy, tc.kvs) - distinct, uniq := attribute.NewSetWithFiltered(cpy, func(label attribute.KeyValue) bool { - return tc.keyRe.MatchString(string(label.Key)) + distinct, uniq := attribute.NewSetWithFiltered(cpy, func(attr attribute.KeyValue) bool { + return tc.keyRe.MatchString(string(attr.Key)) }) full := attribute.NewSet(uniq...) diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index d40ddc9d665..9ec375d3a44 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -91,7 +91,7 @@ func (d *metricReader) ForEach(_ aggregation.TemporalitySelector, f func(export. if len(ts.Points) == 0 { continue } - ls, err := convertLabels(m.Descriptor.LabelKeys, ts.LabelValues) + attrs, err := convertAttrs(m.Descriptor.LabelKeys, ts.LabelValues) if err != nil { otel.Handle(err) continue @@ -101,7 +101,7 @@ func (d *metricReader) ForEach(_ aggregation.TemporalitySelector, f func(export. func(agg aggregation.Aggregation, end time.Time) error { return f(export.NewRecord( &descriptor, - &ls, + &attrs, agg, ts.StartTime, end, @@ -115,36 +115,36 @@ func (d *metricReader) ForEach(_ aggregation.TemporalitySelector, f func(export. return nil } -// convertLabels converts from OpenCensus label keys and values to an -// OpenTelemetry label Set. -func convertLabels(keys []metricdata.LabelKey, values []metricdata.LabelValue) (attribute.Set, error) { +// convertAttrs converts from OpenCensus attribute keys and values to an +// OpenTelemetry attribute Set. +func convertAttrs(keys []metricdata.LabelKey, values []metricdata.LabelValue) (attribute.Set, error) { if len(keys) != len(values) { return attribute.NewSet(), fmt.Errorf("%w different number of label keys (%d) and values (%d)", errConversion, len(keys), len(values)) } - labels := []attribute.KeyValue{} + attrs := []attribute.KeyValue{} for i, lv := range values { if !lv.Present { continue } - labels = append(labels, attribute.KeyValue{ + attrs = append(attrs, attribute.KeyValue{ Key: attribute.Key(keys[i].Key), Value: attribute.StringValue(lv.Value), }) } - return attribute.NewSet(labels...), nil + return attribute.NewSet(attrs...), nil } // convertResource converts an OpenCensus Resource to an OpenTelemetry Resource // Note: the ocresource.Resource Type field is not used. func convertResource(res *ocresource.Resource) *resource.Resource { - labels := []attribute.KeyValue{} + attrs := []attribute.KeyValue{} if res == nil { return nil } for k, v := range res.Labels { - labels = append(labels, attribute.KeyValue{Key: attribute.Key(k), Value: attribute.StringValue(v)}) + attrs = append(attrs, attribute.KeyValue{Key: attribute.Key(k), Value: attribute.StringValue(v)}) } - return resource.NewSchemaless(labels...) + return resource.NewSchemaless(attrs...) } // convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor diff --git a/bridge/opencensus/exporter_test.go b/bridge/opencensus/exporter_test.go index 79e195c1f6c..2634f5334d5 100644 --- a/bridge/opencensus/exporter_test.go +++ b/bridge/opencensus/exporter_test.go @@ -110,12 +110,12 @@ func TestExportMetrics(t *testing.T) { expectedHandledError: errConversion, }, { - desc: "labels conversion error", + desc: "attrs conversion error", input: []*metricdata.Metric{ { - // No descriptor with label keys. + // No descriptor with attribute keys. TimeSeries: []*metricdata.TimeSeries{ - // 1 label value, which doens't exist in keys. + // 1 attribute value, which doens't exist in keys. { LabelValues: []metricdata.LabelValue{{Value: "foo", Present: true}}, Points: []metricdata.Point{ @@ -269,8 +269,8 @@ func TestExportMetrics(t *testing.T) { } // Don't bother with a complete check of the descriptor. // That is checked as part of descriptor conversion tests below. - if !output[i].Labels().Equals(expected.Labels()) { - t.Errorf("ExportMetrics(%+v)[i].Labels() = %+v, want %+v", tc.input, output[i].Labels(), expected.Labels()) + if !output[i].Attributes().Equals(expected.Attributes()) { + t.Errorf("ExportMetrics(%+v)[i].Attributes() = %+v, want %+v", tc.input, output[i].Attributes(), expected.Attributes()) } if output[i].Aggregation().Kind() != expected.Aggregation().Kind() { t.Errorf("ExportMetrics(%+v)[i].Aggregation() = %+v, want %+v", tc.input, output[i].Aggregation().Kind(), expected.Aggregation().Kind()) @@ -282,7 +282,7 @@ func TestExportMetrics(t *testing.T) { } } -func TestConvertLabels(t *testing.T) { +func TestConvertAttributes(t *testing.T) { setWithMultipleKeys := attribute.NewSet( attribute.KeyValue{Key: attribute.Key("first"), Value: attribute.StringValue("1")}, attribute.KeyValue{Key: attribute.Key("second"), Value: attribute.StringValue("2")}, @@ -295,7 +295,7 @@ func TestConvertLabels(t *testing.T) { expectedErr error }{ { - desc: "no labels", + desc: "no attributes", expected: attribute.EmptySet(), }, { @@ -325,12 +325,12 @@ func TestConvertLabels(t *testing.T) { }, } { t.Run(tc.desc, func(t *testing.T) { - output, err := convertLabels(tc.inputKeys, tc.inputValues) + output, err := convertAttrs(tc.inputKeys, tc.inputValues) if !errors.Is(err, tc.expectedErr) { - t.Errorf("convertLabels(keys: %v, values: %v) = err(%v), want err(%v)", tc.inputKeys, tc.inputValues, err, tc.expectedErr) + t.Errorf("convertAttrs(keys: %v, values: %v) = err(%v), want err(%v)", tc.inputKeys, tc.inputValues, err, tc.expectedErr) } if !output.Equals(tc.expected) { - t.Errorf("convertLabels(keys: %v, values: %v) = %+v, want %+v", tc.inputKeys, tc.inputValues, output.ToSlice(), tc.expected.ToSlice()) + t.Errorf("convertAttrs(keys: %v, values: %v) = %+v, want %+v", tc.inputKeys, tc.inputValues, output.ToSlice(), tc.expected.ToSlice()) } }) } @@ -352,7 +352,7 @@ func TestConvertResource(t *testing.T) { expected: resource.NewSchemaless(), }, { - desc: "resource with labels", + desc: "resource with attributes", input: &ocresource.Resource{ Labels: map[string]string{ "foo": "bar", diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 3e931b00e29..8483dbdeca0 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -122,7 +122,7 @@ func (s *bridgeSpan) logRecord(record ot.LogRecord) { s.otelSpan.AddEvent( "", trace.WithTimestamp(record.Timestamp), - trace.WithAttributes(otLogFieldsToOTelLabels(record.Fields)...), + trace.WithAttributes(otLogFieldsToOTelAttrs(record.Fields)...), ) } @@ -153,7 +153,7 @@ func (s *bridgeSpan) SetTag(key string, value interface{}) ot.Span { s.otelSpan.SetStatus(codes.Error, "") } default: - s.otelSpan.SetAttributes(otTagToOTelLabel(key, value)) + s.otelSpan.SetAttributes(otTagToOTelAttr(key, value)) } return s } @@ -161,7 +161,7 @@ func (s *bridgeSpan) SetTag(key string, value interface{}) ot.Span { func (s *bridgeSpan) LogFields(fields ...otlog.Field) { s.otelSpan.AddEvent( "", - trace.WithAttributes(otLogFieldsToOTelLabels(fields)...), + trace.WithAttributes(otLogFieldsToOTelAttrs(fields)...), ) } @@ -216,10 +216,10 @@ func (e *bridgeFieldEncoder) EmitLazyLogger(value otlog.LazyLogger) { } func (e *bridgeFieldEncoder) emitCommon(key string, value interface{}) { - e.pairs = append(e.pairs, otTagToOTelLabel(key, value)) + e.pairs = append(e.pairs, otTagToOTelAttr(key, value)) } -func otLogFieldsToOTelLabels(fields []otlog.Field) []attribute.KeyValue { +func otLogFieldsToOTelAttrs(fields []otlog.Field) []attribute.KeyValue { encoder := &bridgeFieldEncoder{} for _, field := range fields { field.Marshal(encoder) @@ -507,13 +507,13 @@ func otTagsToOTelAttributesKindAndError(tags map[string]interface{}) ([]attribut err = true } default: - pairs = append(pairs, otTagToOTelLabel(k, v)) + pairs = append(pairs, otTagToOTelAttr(k, v)) } } return pairs, kind, err } -// otTagToOTelLabel converts given key-value into attribute.KeyValue. +// otTagToOTelAttr converts given key-value into attribute.KeyValue. // Note that some conversions are not obvious: // - int -> int64 // - uint -> string @@ -521,8 +521,8 @@ func otTagsToOTelAttributesKindAndError(tags map[string]interface{}) ([]attribut // - uint32 -> int64 // - uint64 -> string // - float32 -> float64 -func otTagToOTelLabel(k string, v interface{}) attribute.KeyValue { - key := otTagToOTelLabelKey(k) +func otTagToOTelAttr(k string, v interface{}) attribute.KeyValue { + key := otTagToOTelAttrKey(k) switch val := v.(type) { case bool: return key.Bool(val) @@ -549,7 +549,7 @@ func otTagToOTelLabel(k string, v interface{}) attribute.KeyValue { } } -func otTagToOTelLabelKey(k string) attribute.Key { +func otTagToOTelAttrKey(k string) attribute.Key { return attribute.Key(k) } diff --git a/bridge/opentracing/mix_test.go b/bridge/opentracing/mix_test.go index 8fba1f06878..0cd5a667ca5 100644 --- a/bridge/opentracing/mix_test.go +++ b/bridge/opentracing/mix_test.go @@ -652,7 +652,7 @@ func runOTOtelOT(t *testing.T, ctx context.Context, name string, callback func(* }(ctx) } -func TestOtTagToOTelLabelCheckTypeConversions(t *testing.T) { +func TestOtTagToOTelAttrCheckTypeConversions(t *testing.T) { tableTest := []struct { key string value interface{} @@ -716,7 +716,7 @@ func TestOtTagToOTelLabelCheckTypeConversions(t *testing.T) { } for _, test := range tableTest { - got := otTagToOTelLabel(test.key, test.value) + got := otTagToOTelAttr(test.key, test.value) if test.expectedValueType != got.Value.Type() { t.Errorf("Expected type %s, but got %s after conversion '%v' value", test.expectedValueType, diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index a6bbceec190..67d7c1a5d35 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -88,19 +88,19 @@ func main() { tracer := otel.Tracer("test-tracer") - // labels represent additional key-value descriptors that can be bound to a - // metric observer or recorder. - commonLabels := []attribute.KeyValue{ - attribute.String("labelA", "chocolate"), - attribute.String("labelB", "raspberry"), - attribute.String("labelC", "vanilla"), + // Attributes represent additional key-value descriptors that can be bound + // to a metric observer or recorder. + commonAttrs := []attribute.KeyValue{ + attribute.String("attrA", "chocolate"), + attribute.String("attrB", "raspberry"), + attribute.String("attrC", "vanilla"), } // work begins ctx, span := tracer.Start( context.Background(), "CollectorExporter-Example", - trace.WithAttributes(commonLabels...)) + trace.WithAttributes(commonAttrs...)) defer span.End() for i := 0; i < 10; i++ { _, iSpan := tracer.Start(ctx, fmt.Sprintf("Sample-%d", i)) diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 0710fc65c4c..7b522456972 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -72,7 +72,7 @@ func main() { observerLock := new(sync.RWMutex) observerValueToReport := new(float64) - observerLabelsToReport := new([]attribute.KeyValue) + observerAttrsToReport := new([]attribute.KeyValue) gaugeObserver, err := meter.AsyncFloat64().Gauge("ex.com.one") if err != nil { @@ -81,9 +81,9 @@ func main() { _ = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { (*observerLock).RLock() value := *observerValueToReport - labels := *observerLabelsToReport + attrs := *observerAttrsToReport (*observerLock).RUnlock() - gaugeObserver.Observe(ctx, value, labels...) + gaugeObserver.Observe(ctx, value, attrs...) }) histogram, err := meter.SyncFloat64().Histogram("ex.com.two") @@ -95,36 +95,36 @@ func main() { log.Panicf("failed to initialize instrument: %v", err) } - commonLabels := []attribute.KeyValue{lemonsKey.Int(10), attribute.String("A", "1"), attribute.String("B", "2"), attribute.String("C", "3")} - notSoCommonLabels := []attribute.KeyValue{lemonsKey.Int(13)} + commonAttrs := []attribute.KeyValue{lemonsKey.Int(10), attribute.String("A", "1"), attribute.String("B", "2"), attribute.String("C", "3")} + notSoCommonAttrs := []attribute.KeyValue{lemonsKey.Int(13)} ctx := context.Background() (*observerLock).Lock() *observerValueToReport = 1.0 - *observerLabelsToReport = commonLabels + *observerAttrsToReport = commonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 2.0, commonLabels...) - counter.Add(ctx, 12.0, commonLabels...) + histogram.Record(ctx, 2.0, commonAttrs...) + counter.Add(ctx, 12.0, commonAttrs...) time.Sleep(5 * time.Second) (*observerLock).Lock() *observerValueToReport = 1.0 - *observerLabelsToReport = notSoCommonLabels + *observerAttrsToReport = notSoCommonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 2.0, notSoCommonLabels...) - counter.Add(ctx, 22.0, notSoCommonLabels...) + histogram.Record(ctx, 2.0, notSoCommonAttrs...) + counter.Add(ctx, 22.0, notSoCommonAttrs...) time.Sleep(5 * time.Second) (*observerLock).Lock() *observerValueToReport = 13.0 - *observerLabelsToReport = commonLabels + *observerAttrsToReport = commonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 12.0, commonLabels...) - counter.Add(ctx, 13.0, commonLabels...) + histogram.Record(ctx, 12.0, commonAttrs...) + counter.Add(ctx, 13.0, commonAttrs...) fmt.Println("Example finished updating, please visit :2222") diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 242079a20c7..3b10722d3a5 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -89,10 +89,10 @@ func pointTime() uint64 { } type testRecord struct { - name string - iKind sdkapi.InstrumentKind - nKind number.Kind - labels []attribute.KeyValue + name string + iKind sdkapi.InstrumentKind + nKind number.Kind + attrs []attribute.KeyValue meterName string meterOpts []metric.MeterOption @@ -102,14 +102,14 @@ func record( name string, iKind sdkapi.InstrumentKind, nKind number.Kind, - labels []attribute.KeyValue, + attrs []attribute.KeyValue, meterName string, meterOpts ...metric.MeterOption) testRecord { return testRecord{ name: name, iKind: iKind, nKind: nKind, - labels: labels, + attrs: attrs, meterName: meterName, meterOpts: meterOpts, } @@ -121,7 +121,7 @@ var ( testHistogramBoundaries = []float64{2.0, 4.0, 8.0} - cpu1Labels = []*commonpb.KeyValue{ + cpu1Attrs = []*commonpb.KeyValue{ { Key: "CPU", Value: &commonpb.AnyValue{ @@ -139,7 +139,7 @@ var ( }, }, } - cpu2Labels = []*commonpb.KeyValue{ + cpu2Attrs = []*commonpb.KeyValue{ { Key: "CPU", Value: &commonpb.AnyValue{ @@ -203,13 +203,13 @@ func TestNoGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Labels, + Attributes: cpu2Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -247,7 +247,7 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, DataPoints: []*metricpb.HistogramDataPoint{ { - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, @@ -256,7 +256,7 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { BucketCounts: []uint64{1, 0, 0, 1}, }, { - Attributes: cpu1Labels, + Attributes: cpu1Attrs, Count: 2, Sum: &sum, ExplicitBounds: testHistogramBoundaries, @@ -298,7 +298,7 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, DataPoints: []*metricpb.HistogramDataPoint{ { - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, @@ -307,7 +307,7 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { BucketCounts: []uint64{1, 0, 0, 1}, }, { - Attributes: cpu1Labels, + Attributes: cpu1Attrs, Count: 2, Sum: &sum, ExplicitBounds: testHistogramBoundaries, @@ -355,13 +355,13 @@ func TestCountInt64MetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -405,13 +405,13 @@ func TestCountFloat64MetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -477,25 +477,25 @@ func TestResourceMetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Labels, + Attributes: cpu2Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -582,19 +582,19 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Labels, + Attributes: cpu2Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -619,7 +619,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -644,7 +644,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -707,7 +707,7 @@ func TestStatelessAggregationTemporality(t *testing.T) { DataPoints: []*metricpb.NumberDataPoint{ { Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Labels, + Attributes: cpu1Attrs, StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), }, @@ -730,8 +730,8 @@ func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource. libraryRecs := map[instrumentation.Library][]export.Record{} for _, r := range records { - lcopy := make([]attribute.KeyValue, len(r.labels)) - copy(lcopy, r.labels) + lcopy := make([]attribute.KeyValue, len(r.attrs)) + copy(lcopy, r.attrs) desc := metrictest.NewDescriptor(r.name, r.iKind, r.nKind) labs := attribute.NewSet(lcopy...) diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index 03a3d250ab0..854b271d1fb 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -196,13 +196,11 @@ func sink(ctx context.Context, in <-chan result) ([]*metricpb.Metric, error) { continue } - // Note: There is extra work happening in this code - // that can be improved when the work described in - // #2119 is completed. The SDK has a guarantee that - // no more than one point per period per label set is - // produced, so this fallthrough should never happen. - // The final step of #2119 is to remove all the - // grouping logic here. + // Note: There is extra work happening in this code that can be + // improved when the work described in #2119 is completed. The SDK has + // a guarantee that no more than one point per period per attribute + // set is produced, so this fallthrough should never happen. The final + // step of #2119 is to remove all the grouping logic here. switch res.Metric.Data.(type) { case *metricpb.Metric_Gauge: m.GetGauge().DataPoints = append(m.GetGauge().DataPoints, res.Metric.GetGauge().DataPoints...) @@ -275,7 +273,7 @@ func Record(temporalitySelector aggregation.TemporalitySelector, r export.Record func gaugePoint(record export.Record, num number.Number, start, end time.Time) (*metricpb.Metric, error) { desc := record.Descriptor() - labels := record.Labels() + attrs := record.Attributes() m := &metricpb.Metric{ Name: desc.Name(), @@ -292,7 +290,7 @@ func gaugePoint(record export.Record, num number.Number, start, end time.Time) ( Value: &metricpb.NumberDataPoint_AsInt{ AsInt: num.CoerceToInt64(n), }, - Attributes: Iterator(labels.Iter()), + Attributes: Iterator(attrs.Iter()), StartTimeUnixNano: toNanos(start), TimeUnixNano: toNanos(end), }, @@ -307,7 +305,7 @@ func gaugePoint(record export.Record, num number.Number, start, end time.Time) ( Value: &metricpb.NumberDataPoint_AsDouble{ AsDouble: num.CoerceToFloat64(n), }, - Attributes: Iterator(labels.Iter()), + Attributes: Iterator(attrs.Iter()), StartTimeUnixNano: toNanos(start), TimeUnixNano: toNanos(end), }, @@ -333,7 +331,7 @@ func sdkTemporalityToTemporality(temporality aggregation.Temporality) metricpb.A func sumPoint(record export.Record, num number.Number, start, end time.Time, temporality aggregation.Temporality, monotonic bool) (*metricpb.Metric, error) { desc := record.Descriptor() - labels := record.Labels() + attrs := record.Attributes() m := &metricpb.Metric{ Name: desc.Name(), @@ -352,7 +350,7 @@ func sumPoint(record export.Record, num number.Number, start, end time.Time, tem Value: &metricpb.NumberDataPoint_AsInt{ AsInt: num.CoerceToInt64(n), }, - Attributes: Iterator(labels.Iter()), + Attributes: Iterator(attrs.Iter()), StartTimeUnixNano: toNanos(start), TimeUnixNano: toNanos(end), }, @@ -369,7 +367,7 @@ func sumPoint(record export.Record, num number.Number, start, end time.Time, tem Value: &metricpb.NumberDataPoint_AsDouble{ AsDouble: num.CoerceToFloat64(n), }, - Attributes: Iterator(labels.Iter()), + Attributes: Iterator(attrs.Iter()), StartTimeUnixNano: toNanos(start), TimeUnixNano: toNanos(end), }, @@ -399,7 +397,7 @@ func histogramValues(a aggregation.Histogram) (boundaries []float64, counts []ui // histogram transforms a Histogram Aggregator into an OTLP Metric. func histogramPoint(record export.Record, temporality aggregation.Temporality, a aggregation.Histogram) (*metricpb.Metric, error) { desc := record.Descriptor() - labels := record.Labels() + attrs := record.Attributes() boundaries, counts, err := histogramValues(a) if err != nil { return nil, err @@ -426,7 +424,7 @@ func histogramPoint(record export.Record, temporality aggregation.Temporality, a DataPoints: []*metricpb.HistogramDataPoint{ { Sum: &sumFloat64, - Attributes: Iterator(labels.Iter()), + Attributes: Iterator(attrs.Iter()), StartTimeUnixNano: toNanos(record.StartTime()), TimeUnixNano: toNanos(record.EndTime()), Count: uint64(count), diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index d8f2a1c8b62..43f0c56b940 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -91,20 +91,20 @@ func TestStringKeyValues(t *testing.T) { } for _, test := range tests { - labels := attribute.NewSet(test.kvs...) - assert.Equal(t, test.expected, Iterator(labels.Iter())) + attrs := attribute.NewSet(test.kvs...) + assert.Equal(t, test.expected, Iterator(attrs.Iter())) } } func TestSumIntDataPoints(t *testing.T) { desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Int64Kind) - labels := attribute.NewSet(attribute.String("one", "1")) + attrs := attribute.NewSet(attribute.String("one", "1")) sums := sum.New(2) s, ckpt := &sums[0], &sums[1] assert.NoError(t, s.Update(context.Background(), number.Number(1), &desc)) require.NoError(t, s.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &labels, ckpt.Aggregation(), intervalStart, intervalEnd) + record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) value, err := ckpt.Sum() require.NoError(t, err) @@ -135,13 +135,13 @@ func TestSumIntDataPoints(t *testing.T) { func TestSumFloatDataPoints(t *testing.T) { desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Float64Kind) - labels := attribute.NewSet(attribute.String("one", "1")) + attrs := attribute.NewSet(attribute.String("one", "1")) sums := sum.New(2) s, ckpt := &sums[0], &sums[1] assert.NoError(t, s.Update(context.Background(), number.NewFloat64Number(1), &desc)) require.NoError(t, s.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &labels, ckpt.Aggregation(), intervalStart, intervalEnd) + record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) value, err := ckpt.Sum() require.NoError(t, err) @@ -171,13 +171,13 @@ func TestSumFloatDataPoints(t *testing.T) { func TestLastValueIntDataPoints(t *testing.T) { desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Int64Kind) - labels := attribute.NewSet(attribute.String("one", "1")) + attrs := attribute.NewSet(attribute.String("one", "1")) lvs := lastvalue.New(2) lv, ckpt := &lvs[0], &lvs[1] assert.NoError(t, lv.Update(context.Background(), number.Number(100), &desc)) require.NoError(t, lv.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &labels, ckpt.Aggregation(), intervalStart, intervalEnd) + record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) value, timestamp, err := ckpt.LastValue() require.NoError(t, err) @@ -203,9 +203,9 @@ func TestLastValueIntDataPoints(t *testing.T) { func TestSumErrUnknownValueType(t *testing.T) { desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Kind(-1)) - labels := attribute.NewSet() + attrs := attribute.NewSet() s := &sum.New(1)[0] - record := export.NewRecord(&desc, &labels, s, intervalStart, intervalEnd) + record := export.NewRecord(&desc, &attrs, s, intervalStart, intervalEnd) value, err := s.Sum() require.NoError(t, err) @@ -271,12 +271,12 @@ var _ aggregation.LastValue = &testErrLastValue{} func TestRecordAggregatorIncompatibleErrors(t *testing.T) { makeMpb := func(kind aggregation.Kind, agg aggregation.Aggregation) (*metricpb.Metric, error) { desc := metrictest.NewDescriptor("things", sdkapi.CounterInstrumentKind, number.Int64Kind) - labels := attribute.NewSet() + attrs := attribute.NewSet() test := &testAgg{ kind: kind, agg: agg, } - return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &labels, test, intervalStart, intervalEnd)) + return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &attrs, test, intervalStart, intervalEnd)) } mpb, err := makeMpb(aggregation.SumKind, &lastvalue.New(1)[0]) @@ -295,8 +295,8 @@ func TestRecordAggregatorIncompatibleErrors(t *testing.T) { func TestRecordAggregatorUnexpectedErrors(t *testing.T) { makeMpb := func(kind aggregation.Kind, agg aggregation.Aggregation) (*metricpb.Metric, error) { desc := metrictest.NewDescriptor("things", sdkapi.CounterInstrumentKind, number.Int64Kind) - labels := attribute.NewSet() - return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &labels, agg, intervalStart, intervalEnd)) + attrs := attribute.NewSet() + return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &attrs, agg, intervalStart, intervalEnd)) } errEx := fmt.Errorf("timeout") diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go index 2da921f142c..d8d9c03a31e 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go @@ -44,8 +44,8 @@ func OneRecordReader() export.InstrumentationLibraryReader { } start := time.Date(2020, time.December, 8, 19, 15, 0, 0, time.UTC) end := time.Date(2020, time.December, 8, 19, 16, 0, 0, time.UTC) - labels := attribute.NewSet(attribute.String("abc", "def"), attribute.Int64("one", 1)) - rec := export.NewRecord(&desc, &labels, agg[0].Aggregation(), start, end) + attrs := attribute.NewSet(attribute.String("abc", "def"), attribute.Int64("one", 1)) + rec := export.NewRecord(&desc, &attrs, agg[0].Aggregation(), start, end) return processortest.MultiInstrumentationLibraryReader( map[instrumentation.Library][]export.Record{ diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go index 3047c0adfc0..c12cd5b1b6a 100644 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go +++ b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go @@ -44,7 +44,7 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter require.NoError(t, cont.Start(ctx)) meter := cont.Meter("test-meter") - labels := []attribute.KeyValue{attribute.Bool("test", true)} + attrs := []attribute.KeyValue{attribute.Bool("test", true)} type data struct { iKind sdkapi.InstrumentKind @@ -66,10 +66,10 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter switch data.nKind { case number.Int64Kind: c, _ := meter.SyncInt64().Counter(name) - c.Add(ctx, data.val, labels...) + c.Add(ctx, data.val, attrs...) case number.Float64Kind: c, _ := meter.SyncFloat64().Counter(name) - c.Add(ctx, float64(data.val), labels...) + c.Add(ctx, float64(data.val), attrs...) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) } @@ -77,10 +77,10 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter switch data.nKind { case number.Int64Kind: c, _ := meter.SyncInt64().Histogram(name) - c.Record(ctx, data.val, labels...) + c.Record(ctx, data.val, attrs...) case number.Float64Kind: c, _ := meter.SyncFloat64().Histogram(name) - c.Record(ctx, float64(data.val), labels...) + c.Record(ctx, float64(data.val), attrs...) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) } @@ -89,12 +89,12 @@ func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter case number.Int64Kind: g, _ := meter.AsyncInt64().Gauge(name) _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { - g.Observe(ctx, data.val, labels...) + g.Observe(ctx, data.val, attrs...) }) case number.Float64Kind: g, _ := meter.AsyncFloat64().Gauge(name) _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { - g.Observe(ctx, float64(data.val), labels...) + g.Observe(ctx, float64(data.val), attrs...) }) default: assert.Failf(t, "unsupported number testing kind", data.nKind.String()) diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go index 1de8778eb53..238f6e56c89 100644 --- a/exporters/prometheus/prometheus.go +++ b/exporters/prometheus/prometheus.go @@ -153,9 +153,9 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) { _ = c.exp.Controller().ForEach(func(_ instrumentation.Library, reader export.Reader) error { return reader.ForEach(c.exp, func(record export.Record) error { - var labelKeys []string - mergeLabels(record, c.exp.controller.Resource(), &labelKeys, nil) - ch <- c.toDesc(record, labelKeys) + var attrKeys []string + mergeAttrs(record, c.exp.controller.Resource(), &attrKeys, nil) + ch <- c.toDesc(record, attrKeys) return nil }) }) @@ -181,25 +181,25 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { numberKind := record.Descriptor().NumberKind() instrumentKind := record.Descriptor().InstrumentKind() - var labelKeys, labels []string - mergeLabels(record, c.exp.controller.Resource(), &labelKeys, &labels) + var attrKeys, attrs []string + mergeAttrs(record, c.exp.controller.Resource(), &attrKeys, &attrs) - desc := c.toDesc(record, labelKeys) + desc := c.toDesc(record, attrKeys) if hist, ok := agg.(aggregation.Histogram); ok { - if err := c.exportHistogram(ch, hist, numberKind, desc, labels); err != nil { + if err := c.exportHistogram(ch, hist, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting histogram: %w", err) } } else if sum, ok := agg.(aggregation.Sum); ok && instrumentKind.Monotonic() { - if err := c.exportMonotonicCounter(ch, sum, numberKind, desc, labels); err != nil { + if err := c.exportMonotonicCounter(ch, sum, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting monotonic counter: %w", err) } } else if sum, ok := agg.(aggregation.Sum); ok && !instrumentKind.Monotonic() { - if err := c.exportNonMonotonicCounter(ch, sum, numberKind, desc, labels); err != nil { + if err := c.exportNonMonotonicCounter(ch, sum, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting non monotonic counter: %w", err) } } else if lastValue, ok := agg.(aggregation.LastValue); ok { - if err := c.exportLastValue(ch, lastValue, numberKind, desc, labels); err != nil { + if err := c.exportLastValue(ch, lastValue, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting last value: %w", err) } } else { @@ -213,13 +213,13 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } } -func (c *collector) exportLastValue(ch chan<- prometheus.Metric, lvagg aggregation.LastValue, kind number.Kind, desc *prometheus.Desc, labels []string) error { +func (c *collector) exportLastValue(ch chan<- prometheus.Metric, lvagg aggregation.LastValue, kind number.Kind, desc *prometheus.Desc, attrs []string) error { lv, _, err := lvagg.LastValue() if err != nil { return fmt.Errorf("error retrieving last value: %w", err) } - m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, lv.CoerceToFloat64(kind), labels...) + m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, lv.CoerceToFloat64(kind), attrs...) if err != nil { return fmt.Errorf("error creating constant metric: %w", err) } @@ -228,13 +228,13 @@ func (c *collector) exportLastValue(ch chan<- prometheus.Metric, lvagg aggregati return nil } -func (c *collector) exportNonMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, labels []string) error { +func (c *collector) exportNonMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, attrs []string) error { v, err := sum.Sum() if err != nil { return fmt.Errorf("error retrieving counter: %w", err) } - m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, v.CoerceToFloat64(kind), labels...) + m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, v.CoerceToFloat64(kind), attrs...) if err != nil { return fmt.Errorf("error creating constant metric: %w", err) } @@ -243,13 +243,13 @@ func (c *collector) exportNonMonotonicCounter(ch chan<- prometheus.Metric, sum a return nil } -func (c *collector) exportMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, labels []string) error { +func (c *collector) exportMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, attrs []string) error { v, err := sum.Sum() if err != nil { return fmt.Errorf("error retrieving counter: %w", err) } - m, err := prometheus.NewConstMetric(desc, prometheus.CounterValue, v.CoerceToFloat64(kind), labels...) + m, err := prometheus.NewConstMetric(desc, prometheus.CounterValue, v.CoerceToFloat64(kind), attrs...) if err != nil { return fmt.Errorf("error creating constant metric: %w", err) } @@ -258,7 +258,7 @@ func (c *collector) exportMonotonicCounter(ch chan<- prometheus.Metric, sum aggr return nil } -func (c *collector) exportHistogram(ch chan<- prometheus.Metric, hist aggregation.Histogram, kind number.Kind, desc *prometheus.Desc, labels []string) error { +func (c *collector) exportHistogram(ch chan<- prometheus.Metric, hist aggregation.Histogram, kind number.Kind, desc *prometheus.Desc, attrs []string) error { buckets, err := hist.Histogram() if err != nil { return fmt.Errorf("error retrieving histogram: %w", err) @@ -280,7 +280,7 @@ func (c *collector) exportHistogram(ch chan<- prometheus.Metric, hist aggregatio // Include the +inf bucket in the total count. totalCount += uint64(buckets.Counts[len(buckets.Counts)-1]) - m, err := prometheus.NewConstHistogram(desc, totalCount, sum.CoerceToFloat64(kind), counts, labels...) + m, err := prometheus.NewConstHistogram(desc, totalCount, sum.CoerceToFloat64(kind), counts, attrs...) if err != nil { return fmt.Errorf("error creating constant histogram: %w", err) } @@ -289,34 +289,34 @@ func (c *collector) exportHistogram(ch chan<- prometheus.Metric, hist aggregatio return nil } -func (c *collector) toDesc(record export.Record, labelKeys []string) *prometheus.Desc { +func (c *collector) toDesc(record export.Record, attrKeys []string) *prometheus.Desc { desc := record.Descriptor() - return prometheus.NewDesc(sanitize(desc.Name()), desc.Description(), labelKeys, nil) + return prometheus.NewDesc(sanitize(desc.Name()), desc.Description(), attrKeys, nil) } -// mergeLabels merges the export.Record's labels and resources into a -// single set, giving precedence to the record's labels in case of -// duplicate keys. This outputs one or both of the keys and the -// values as a slice, and either argument may be nil to avoid -// allocating an unnecessary slice. -func mergeLabels(record export.Record, res *resource.Resource, keys, values *[]string) { +// mergeAttrs merges the export.Record's attributes and resources into a +// single set, giving precedence to the record's attributes in case of +// duplicate keys. This outputs one or both of the keys and the values as a +// slice, and either argument may be nil to avoid allocating an unnecessary +// slice. +func mergeAttrs(record export.Record, res *resource.Resource, keys, values *[]string) { if keys != nil { - *keys = make([]string, 0, record.Labels().Len()+res.Len()) + *keys = make([]string, 0, record.Attributes().Len()+res.Len()) } if values != nil { - *values = make([]string, 0, record.Labels().Len()+res.Len()) + *values = make([]string, 0, record.Attributes().Len()+res.Len()) } - // Duplicate keys are resolved by taking the record label value over + // Duplicate keys are resolved by taking the record attribute value over // the resource value. - mi := attribute.NewMergeIterator(record.Labels(), res.Set()) + mi := attribute.NewMergeIterator(record.Attributes(), res.Set()) for mi.Next() { - label := mi.Label() + attr := mi.Attribute() if keys != nil { - *keys = append(*keys, sanitize(string(label.Key))) + *keys = append(*keys, sanitize(string(attr.Key))) } if values != nil { - *values = append(*values, label.Value.Emit()) + *values = append(*values, attr.Value.Emit()) } } } diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go index 587c8633e78..6281fe28005 100644 --- a/exporters/prometheus/prometheus_test.go +++ b/exporters/prometheus/prometheus_test.go @@ -114,7 +114,7 @@ func TestPrometheusExporter(t *testing.T) { histogram, err := meter.SyncFloat64().Histogram("histogram") require.NoError(t, err) - labels := []attribute.KeyValue{ + attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), attribute.Key("C").String("D"), } @@ -122,8 +122,8 @@ func TestPrometheusExporter(t *testing.T) { var expected []expectedMetric - counter.Add(ctx, 10, labels...) - counter.Add(ctx, 5.3, labels...) + counter.Add(ctx, 10, attrs...) + counter.Add(ctx, 5.3, attrs...) expected = append(expected, expectCounter("counter", `counter{A="B",C="D",R="V"} 15.3`)) @@ -131,16 +131,16 @@ func TestPrometheusExporter(t *testing.T) { require.NoError(t, err) err = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { - gaugeObserver.Observe(ctx, 1, labels...) + gaugeObserver.Observe(ctx, 1, attrs...) }) require.NoError(t, err) expected = append(expected, expectGauge("intgaugeobserver", `intgaugeobserver{A="B",C="D",R="V"} 1`)) - histogram.Record(ctx, -0.6, labels...) - histogram.Record(ctx, -0.4, labels...) - histogram.Record(ctx, 0.6, labels...) - histogram.Record(ctx, 20, labels...) + histogram.Record(ctx, -0.6, attrs...) + histogram.Record(ctx, -0.4, attrs...) + histogram.Record(ctx, 0.6, attrs...) + histogram.Record(ctx, 20, attrs...) expected = append(expected, expectHistogram("histogram", `histogram_bucket{A="B",C="D",R="V",le="-0.5"} 1`, @@ -150,8 +150,8 @@ func TestPrometheusExporter(t *testing.T) { `histogram_count{A="B",C="D",R="V"} 4`, )) - upDownCounter.Add(ctx, 10, labels...) - upDownCounter.Add(ctx, -3.2, labels...) + upDownCounter.Add(ctx, 10, attrs...) + upDownCounter.Add(ctx, -3.2, attrs...) expected = append(expected, expectGauge("updowncounter", `updowncounter{A="B",C="D",R="V"} 6.8`)) @@ -159,7 +159,7 @@ func TestPrometheusExporter(t *testing.T) { require.NoError(t, err) err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - counterObserver.Observe(ctx, 7.7, labels...) + counterObserver.Observe(ctx, 7.7, attrs...) }) require.NoError(t, err) @@ -169,7 +169,7 @@ func TestPrometheusExporter(t *testing.T) { require.NoError(t, err) err = meter.RegisterCallback([]instrument.Asynchronous{upDownCounterObserver}, func(ctx context.Context) { - upDownCounterObserver.Observe(ctx, -7.7, labels...) + upDownCounterObserver.Observe(ctx, -7.7, attrs...) }) require.NoError(t, err) diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 305800ddbde..f01c02afb51 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -22,10 +22,10 @@ import ( ) var ( - defaultWriter = os.Stdout - defaultPrettyPrint = false - defaultTimestamps = true - defaultLabelEncoder = attribute.DefaultEncoder() + defaultWriter = os.Stdout + defaultPrettyPrint = false + defaultTimestamps = true + defaultAttrEncoder = attribute.DefaultEncoder() ) // config contains options for the STDOUT exporter. @@ -41,17 +41,17 @@ type config struct { // true. Timestamps bool - // LabelEncoder encodes the labels. - LabelEncoder attribute.Encoder + // Encoder encodes the attributes. + Encoder attribute.Encoder } // newConfig creates a validated Config configured with options. func newConfig(options ...Option) (config, error) { cfg := config{ - Writer: defaultWriter, - PrettyPrint: defaultPrettyPrint, - Timestamps: defaultTimestamps, - LabelEncoder: defaultLabelEncoder, + Writer: defaultWriter, + PrettyPrint: defaultPrettyPrint, + Timestamps: defaultTimestamps, + Encoder: defaultAttrEncoder, } for _, opt := range options { cfg = opt.apply(cfg) @@ -103,16 +103,16 @@ func (o timestampsOption) apply(cfg config) config { return cfg } -// WithLabelEncoder sets the label encoder used in export. -func WithLabelEncoder(enc attribute.Encoder) Option { - return labelEncoderOption{enc} +// WithAttributeEncoder sets the attribute encoder used in export. +func WithAttributeEncoder(enc attribute.Encoder) Option { + return attrEncoderOption{enc} } -type labelEncoderOption struct { - LabelEncoder attribute.Encoder +type attrEncoderOption struct { + encoder attribute.Encoder } -func (o labelEncoderOption) apply(cfg config) config { - cfg.LabelEncoder = o.LabelEncoder +func (o attrEncoderOption) apply(cfg config) config { + cfg.Encoder = o.encoder return cfg } diff --git a/exporters/stdout/stdoutmetric/metric.go b/exporters/stdout/stdoutmetric/metric.go index c816c035b1c..23fe9c6e71c 100644 --- a/exporters/stdout/stdoutmetric/metric.go +++ b/exporters/stdout/stdoutmetric/metric.go @@ -54,24 +54,24 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade var batch []line aggError = reader.ForEach(func(lib instrumentation.Library, mr export.Reader) error { - var instLabels []attribute.KeyValue + var instAttrs []attribute.KeyValue if name := lib.Name; name != "" { - instLabels = append(instLabels, attribute.String("instrumentation.name", name)) + instAttrs = append(instAttrs, attribute.String("instrumentation.name", name)) if version := lib.Version; version != "" { - instLabels = append(instLabels, attribute.String("instrumentation.version", version)) + instAttrs = append(instAttrs, attribute.String("instrumentation.version", version)) } if schema := lib.SchemaURL; schema != "" { - instLabels = append(instLabels, attribute.String("instrumentation.schema_url", schema)) + instAttrs = append(instAttrs, attribute.String("instrumentation.schema_url", schema)) } } - instSet := attribute.NewSet(instLabels...) - encodedInstLabels := instSet.Encoded(e.config.LabelEncoder) + instSet := attribute.NewSet(instAttrs...) + encodedInstAttrs := instSet.Encoded(e.config.Encoder) return mr.ForEach(e, func(record export.Record) error { desc := record.Descriptor() agg := record.Aggregation() kind := desc.NumberKind() - encodedResource := res.Encoded(e.config.LabelEncoder) + encodedResource := res.Encoded(e.config.Encoder) var expose line @@ -93,27 +93,27 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade } } - var encodedLabels string - iter := record.Labels().Iter() + var encodedAttrs string + iter := record.Attributes().Iter() if iter.Len() > 0 { - encodedLabels = record.Labels().Encoded(e.config.LabelEncoder) + encodedAttrs = record.Attributes().Encoded(e.config.Encoder) } var sb strings.Builder sb.WriteString(desc.Name()) - if len(encodedLabels) > 0 || len(encodedResource) > 0 || len(encodedInstLabels) > 0 { + if len(encodedAttrs) > 0 || len(encodedResource) > 0 || len(encodedInstAttrs) > 0 { sb.WriteRune('{') sb.WriteString(encodedResource) - if len(encodedInstLabels) > 0 && len(encodedResource) > 0 { + if len(encodedInstAttrs) > 0 && len(encodedResource) > 0 { sb.WriteRune(',') } - sb.WriteString(encodedInstLabels) - if len(encodedLabels) > 0 && (len(encodedInstLabels) > 0 || len(encodedResource) > 0) { + sb.WriteString(encodedInstAttrs) + if len(encodedAttrs) > 0 && (len(encodedInstAttrs) > 0 || len(encodedResource) > 0) { sb.WriteRune(',') } - sb.WriteString(encodedLabels) + sb.WriteString(encodedAttrs) sb.WriteRune('}') } diff --git a/exporters/stdout/stdoutmetric/metric_test.go b/exporters/stdout/stdoutmetric/metric_test.go index 33e2831dbd7..40cb6fbb8e5 100644 --- a/exporters/stdout/stdoutmetric/metric_test.go +++ b/exporters/stdout/stdoutmetric/metric_test.go @@ -235,7 +235,7 @@ func TestStdoutResource(t *testing.T) { attribute.String("C", "D"), ), // We explicitly do not de-duplicate between resources - // and metric labels in this exporter. + // and metric attributes in this exporter. newCase("resource deduplication", "R1=V1,R2=V2,instrumentation.name=test,R1=V3,R2=V4", resource.NewSchemaless(attribute.String("R1", "V1"), attribute.String("R2", "V2")), diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go index 7e88f6b8db3..111b852fa77 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue.go @@ -42,10 +42,9 @@ type ( // value needs to be aligned for 64-bit atomic operations. value number.Number - // timestamp indicates when this record was submitted. - // this can be used to pick a winner when multiple - // records contain lastValue data for the same labels due - // to races. + // timestamp indicates when this record was submitted. This can be + // used to pick a winner when multiple records contain lastValue data + // for the same attributes due to races. timestamp time.Time } ) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index cb06dcc75fb..5464b80a94c 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -88,7 +88,7 @@ func (f *benchFixture) fHistogram(name string) syncfloat64.Histogram { return ctr } -func makeLabels(n int) []attribute.KeyValue { +func makeAttrs(n int) []attribute.KeyValue { used := map[string]bool{} l := make([]attribute.KeyValue, n) for i := 0; i < n; i++ { @@ -105,10 +105,10 @@ func makeLabels(n int) []attribute.KeyValue { return l } -func benchmarkLabels(b *testing.B, n int) { +func benchmarkAttrs(b *testing.B, n int) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(n) + labs := makeAttrs(n) cnt := fix.iCounter("int64.sum") b.ResetTimer() @@ -118,40 +118,40 @@ func benchmarkLabels(b *testing.B, n int) { } } -func BenchmarkInt64CounterAddWithLabels_1(b *testing.B) { - benchmarkLabels(b, 1) +func BenchmarkInt64CounterAddWithAttrs_1(b *testing.B) { + benchmarkAttrs(b, 1) } -func BenchmarkInt64CounterAddWithLabels_2(b *testing.B) { - benchmarkLabels(b, 2) +func BenchmarkInt64CounterAddWithAttrs_2(b *testing.B) { + benchmarkAttrs(b, 2) } -func BenchmarkInt64CounterAddWithLabels_4(b *testing.B) { - benchmarkLabels(b, 4) +func BenchmarkInt64CounterAddWithAttrs_4(b *testing.B) { + benchmarkAttrs(b, 4) } -func BenchmarkInt64CounterAddWithLabels_8(b *testing.B) { - benchmarkLabels(b, 8) +func BenchmarkInt64CounterAddWithAttrs_8(b *testing.B) { + benchmarkAttrs(b, 8) } -func BenchmarkInt64CounterAddWithLabels_16(b *testing.B) { - benchmarkLabels(b, 16) +func BenchmarkInt64CounterAddWithAttrs_16(b *testing.B) { + benchmarkAttrs(b, 16) } -// Note: performance does not depend on label set size for the -// benchmarks below--all are benchmarked for a single attribute. +// Note: performance does not depend on attribute set size for the benchmarks +// below--all are benchmarked for a single attribute. // Iterators var benchmarkIteratorVar attribute.KeyValue func benchmarkIterator(b *testing.B, n int) { - labels := attribute.NewSet(makeLabels(n)...) + attrs := attribute.NewSet(makeAttrs(n)...) b.ResetTimer() for i := 0; i < b.N; i++ { - iter := labels.Iter() + iter := attrs.Iter() for iter.Next() { - benchmarkIteratorVar = iter.Label() + benchmarkIteratorVar = iter.Attribute() } } } @@ -205,7 +205,7 @@ func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { func BenchmarkInt64CounterAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) cnt := fix.iCounter("int64.sum") b.ResetTimer() @@ -218,7 +218,7 @@ func BenchmarkInt64CounterAdd(b *testing.B) { func BenchmarkFloat64CounterAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) cnt := fix.fCounter("float64.sum") b.ResetTimer() @@ -233,7 +233,7 @@ func BenchmarkFloat64CounterAdd(b *testing.B) { func BenchmarkInt64LastValueAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) mea := fix.iHistogram("int64.lastvalue") b.ResetTimer() @@ -246,7 +246,7 @@ func BenchmarkInt64LastValueAdd(b *testing.B) { func BenchmarkFloat64LastValueAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) mea := fix.fHistogram("float64.lastvalue") b.ResetTimer() @@ -261,7 +261,7 @@ func BenchmarkFloat64LastValueAdd(b *testing.B) { func BenchmarkInt64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) mea := fix.iHistogram("int64.histogram") b.ResetTimer() @@ -274,7 +274,7 @@ func BenchmarkInt64HistogramAdd(b *testing.B) { func BenchmarkFloat64HistogramAdd(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) mea := fix.fHistogram("float64.histogram") b.ResetTimer() @@ -304,7 +304,7 @@ func BenchmarkObserverRegistration(b *testing.B) { func BenchmarkGaugeObserverObservationInt64(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) ctr, _ := fix.meter.AsyncInt64().Counter("test.lastvalue") err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { for i := 0; i < b.N; i++ { @@ -324,7 +324,7 @@ func BenchmarkGaugeObserverObservationInt64(b *testing.B) { func BenchmarkGaugeObserverObservationFloat64(b *testing.B) { ctx := context.Background() fix := newFixture(b) - labs := makeLabels(1) + labs := makeAttrs(1) ctr, _ := fix.meter.AsyncFloat64().Counter("test.lastvalue") err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { for i := 0; i < b.N; i++ { @@ -343,11 +343,11 @@ func BenchmarkGaugeObserverObservationFloat64(b *testing.B) { // BatchRecord -func benchmarkBatchRecord8Labels(b *testing.B, numInst int) { - const numLabels = 8 +func benchmarkBatchRecord8Attrs(b *testing.B, numInst int) { + const numAttrs = 8 ctx := context.Background() fix := newFixture(b) - labs := makeLabels(numLabels) + labs := makeAttrs(numAttrs) var meas []syncint64.Counter for i := 0; i < numInst; i++ { @@ -363,20 +363,20 @@ func benchmarkBatchRecord8Labels(b *testing.B, numInst int) { } } -func BenchmarkBatchRecord8Labels_1Instrument(b *testing.B) { - benchmarkBatchRecord8Labels(b, 1) +func BenchmarkBatchRecord8Attrs_1Instrument(b *testing.B) { + benchmarkBatchRecord8Attrs(b, 1) } -func BenchmarkBatchRecord_8Labels_2Instruments(b *testing.B) { - benchmarkBatchRecord8Labels(b, 2) +func BenchmarkBatchRecord_8Attrs_2Instruments(b *testing.B) { + benchmarkBatchRecord8Attrs(b, 2) } -func BenchmarkBatchRecord_8Labels_4Instruments(b *testing.B) { - benchmarkBatchRecord8Labels(b, 4) +func BenchmarkBatchRecord_8Attrs_4Instruments(b *testing.B) { + benchmarkBatchRecord8Attrs(b, 4) } -func BenchmarkBatchRecord_8Labels_8Instruments(b *testing.B) { - benchmarkBatchRecord8Labels(b, 8) +func BenchmarkBatchRecord_8Attrs_8Instruments(b *testing.B) { + benchmarkBatchRecord8Attrs(b, 8) } // Record creation diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index 1b24a209c76..3d18fc06655 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -188,7 +188,7 @@ func TestRecordNaN(t *testing.T) { require.Error(t, testHandler.Flush()) } -func TestSDKLabelsDeduplication(t *testing.T) { +func TestSDKAttrsDeduplication(t *testing.T) { ctx := context.Background() meter, sdk, _, processor := newSDK(t) @@ -250,11 +250,11 @@ func TestSDKLabelsDeduplication(t *testing.T) { } func newSetIter(kvs ...attribute.KeyValue) attribute.Iterator { - labels := attribute.NewSet(kvs...) - return labels.Iter() + attrs := attribute.NewSet(kvs...) + return attrs.Iter() } -func TestDefaultLabelEncoder(t *testing.T) { +func TestDefaultAttributeEncoder(t *testing.T) { encoder := attribute.DefaultEncoder() encoded := encoder.Encode(newSetIter(attribute.String("A", "B"), attribute.String("C", "D"))) @@ -266,8 +266,8 @@ func TestDefaultLabelEncoder(t *testing.T) { encoded = encoder.Encode(newSetIter(attribute.String(`\`, `=`), attribute.String(`,`, `\`))) require.Equal(t, `\,=\\,\\=\=`, encoded) - // Note: the label encoder does not sort or de-dup values, - // that is done in Labels(...). + // Note: the attr encoder does not sort or de-dup values, + // that is done in Attributes(...). encoded = encoder.Encode(newSetIter( attribute.Int("I", 1), attribute.Int64("I64", 1), @@ -490,9 +490,9 @@ func TestObserverBatch(t *testing.T) { }, processor.Values()) } -// TestRecordPersistence ensures that a direct-called instrument that -// is repeatedly used each interval results in a persistent record, so -// that its encoded labels will be cached across collection intervals. +// TestRecordPersistence ensures that a direct-called instrument that is +// repeatedly used each interval results in a persistent record, so that its +// encoded attribute will be cached across collection intervals. func TestRecordPersistence(t *testing.T) { ctx := context.Background() meter, sdk, selector, _ := newSDK(t) diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index e3270211be1..39eb314ca5d 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -39,15 +39,15 @@ instrument callbacks. Internal Structure Each observer also has its own kind of record stored in the SDK. This -record contains a set of recorders for every specific label set used in the -callback. +record contains a set of recorders for every specific attribute set used in +the callback. -A sync.Map maintains the mapping of current instruments and label sets to -internal records. To find a record, the SDK consults the Map to -locate an existing record, otherwise it constructs a new record. The SDK -maintains a count of the number of references to each record, ensuring -that records are not reclaimed from the Map while they are still active -from the user's perspective. +A sync.Map maintains the mapping of current instruments and attribute sets to +internal records. To find a record, the SDK consults the Map to locate an +existing record, otherwise it constructs a new record. The SDK maintains a +count of the number of references to each record, ensuring that records are +not reclaimed from the Map while they are still active from the user's +perspective. Metric collection is performed via a single-threaded call to Collect that sweeps through all records in the SDK, checkpointing their state. When a @@ -106,11 +106,6 @@ Processor implementations are provided, the "defaultkeys" Processor groups aggregate metrics by their recommended Descriptor.Keys(), the "simple" Processor aggregates metrics at full dimensionality. -LabelEncoder is an optional optimization that allows an exporter to -provide the serialization logic for labels. This allows avoiding -duplicate serialization of labels, once as a unique key in the SDK (or -Processor) and once in the exporter. - Reader is an interface between the Processor and the Exporter. After completing a collection pass, the Processor.Reader() method returns a Reader, which the Exporter uses to iterate over all @@ -118,10 +113,7 @@ the updated metrics. Record is a struct containing the state of an individual exported metric. This is the result of one collection interface for one -instrument and one label set. - -Labels is a struct containing an ordered set of labels, the -corresponding unique encoding, and the encoder that produced it. +instrument and one attribute set. Exporter is the final stage of an export pipeline. It is called with a Reader capable of enumerating all the updated metrics. diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go index 7937995e5cc..5ea07e79eb9 100644 --- a/sdk/metric/export/metric.go +++ b/sdk/metric/export/metric.go @@ -64,12 +64,11 @@ type Processor interface { // disable metrics with active records. AggregatorSelector - // Process is called by the SDK once per internal record, - // passing the export Accumulation (a Descriptor, the corresponding - // Labels, and the checkpointed Aggregator). This call has no - // Context argument because it is expected to perform only - // computation. An SDK is not expected to call exporters from - // with Process, use a controller for that (see + // Process is called by the SDK once per internal record, passing the + // export Accumulation (a Descriptor, the corresponding attributes, and + // the checkpointed Aggregator). This call has no Context argument because + // it is expected to perform only computation. An SDK is not expected to + // call exporters from with Process, use a controller for that (see // ./controllers/{pull,push}. Process(accum Accumulation) error } @@ -198,18 +197,18 @@ type Reader interface { // steps. type Metadata struct { descriptor *sdkapi.Descriptor - labels *attribute.Set + attrs *attribute.Set } // Accumulation contains the exported data for a single metric instrument -// and label set, as prepared by an Accumulator for the Processor. +// and attribute set, as prepared by an Accumulator for the Processor. type Accumulation struct { Metadata aggregator aggregator.Aggregator } // Record contains the exported data for a single metric instrument -// and label set, as prepared by the Processor for the Exporter. +// and attribute set, as prepared by the Processor for the Exporter. // This includes the effective start and end time for the aggregation. type Record struct { Metadata @@ -223,21 +222,21 @@ func (m Metadata) Descriptor() *sdkapi.Descriptor { return m.descriptor } -// Labels describes the labels associated with the instrument and the +// Attributes returns the attribute set associated with the instrument and the // aggregated data. -func (m Metadata) Labels() *attribute.Set { - return m.labels +func (m Metadata) Attributes() *attribute.Set { + return m.attrs } // NewAccumulation allows Accumulator implementations to construct new -// Accumulations to send to Processors. The Descriptor, Labels, -// and Aggregator represent aggregate metric events received over a single +// Accumulations to send to Processors. The Descriptor, attributes, and +// Aggregator represent aggregate metric events received over a single // collection period. -func NewAccumulation(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregator aggregator.Aggregator) Accumulation { +func NewAccumulation(descriptor *sdkapi.Descriptor, attrs *attribute.Set, aggregator aggregator.Aggregator) Accumulation { return Accumulation{ Metadata: Metadata{ descriptor: descriptor, - labels: labels, + attrs: attrs, }, aggregator: aggregator, } @@ -249,14 +248,14 @@ func (r Accumulation) Aggregator() aggregator.Aggregator { return r.aggregator } -// NewRecord allows Processor implementations to construct export -// records. The Descriptor, Labels, and Aggregator represent -// aggregate metric events received over a single collection period. -func NewRecord(descriptor *sdkapi.Descriptor, labels *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { +// NewRecord allows Processor implementations to construct export records. +// The Descriptor, attributes, and Aggregator represent aggregate metric +// events received over a single collection period. +func NewRecord(descriptor *sdkapi.Descriptor, attrs *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { return Record{ Metadata: Metadata{ descriptor: descriptor, - labels: labels, + attrs: attrs, }, aggregation: aggregation, start: start, diff --git a/sdk/metric/export/metric_test.go b/sdk/metric/export/metric_test.go index 5337d11c9e8..4a6b803b0c2 100644 --- a/sdk/metric/export/metric_test.go +++ b/sdk/metric/export/metric_test.go @@ -28,24 +28,24 @@ var testSlice = []attribute.KeyValue{ } func newIter(slice []attribute.KeyValue) attribute.Iterator { - labels := attribute.NewSet(slice...) - return labels.Iter() + attrs := attribute.NewSet(slice...) + return attrs.Iter() } -func TestLabelIterator(t *testing.T) { +func TestAttributeIterator(t *testing.T) { iter := newIter(testSlice) require.Equal(t, 2, iter.Len()) require.True(t, iter.Next()) - require.Equal(t, attribute.String("bar", "baz"), iter.Label()) - idx, kv := iter.IndexedLabel() + require.Equal(t, attribute.String("bar", "baz"), iter.Attribute()) + idx, kv := iter.IndexedAttribute() require.Equal(t, 0, idx) require.Equal(t, attribute.String("bar", "baz"), kv) require.Equal(t, 2, iter.Len()) require.True(t, iter.Next()) - require.Equal(t, attribute.Int("foo", 42), iter.Label()) - idx, kv = iter.IndexedLabel() + require.Equal(t, attribute.Int("foo", 42), iter.Attribute()) + idx, kv = iter.IndexedAttribute() require.Equal(t, 1, idx) require.Equal(t, attribute.Int("foo", 42), kv) require.Equal(t, 2, iter.Len()) @@ -54,7 +54,7 @@ func TestLabelIterator(t *testing.T) { require.Equal(t, 2, iter.Len()) } -func TestEmptyLabelIterator(t *testing.T) { +func TestEmptyAttributeIterator(t *testing.T) { iter := newIter(nil) require.Equal(t, 0, iter.Len()) require.False(t, iter.Next()) diff --git a/sdk/metric/metrictest/meter.go b/sdk/metric/metrictest/meter.go index 8222441e48f..fa1c6a325a4 100644 --- a/sdk/metric/metrictest/meter.go +++ b/sdk/metric/metrictest/meter.go @@ -37,7 +37,7 @@ type ( // Measurement needs to be aligned for 64-bit atomic operations. Measurements []Measurement Ctx context.Context - Labels []attribute.KeyValue + Attributes []attribute.KeyValue Library Library } diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index 096044c043c..493b002142b 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -52,8 +52,8 @@ type ( } stateValue struct { - // labels corresponds to the stateKey.distinct field. - labels *attribute.Set + // attrs corresponds to the stateKey.distinct field. + attrs *attribute.Set // updated indicates the last sequence number when this value had // Process() called by an accumulator. @@ -167,7 +167,7 @@ func (b *Processor) Process(accum export.Accumulation) error { desc := accum.Descriptor() key := stateKey{ descriptor: desc, - distinct: accum.Labels().Equivalent(), + distinct: accum.Attributes().Equivalent(), } agg := accum.Aggregator() @@ -177,7 +177,7 @@ func (b *Processor) Process(accum export.Accumulation) error { stateful := b.TemporalityFor(desc, agg.Aggregation().Kind()).MemoryRequired(desc.InstrumentKind()) newValue := &stateValue{ - labels: accum.Labels(), + attrs: accum.Attributes(), updated: b.state.finishedCollection, stateful: stateful, current: agg, @@ -230,7 +230,7 @@ func (b *Processor) Process(accum export.Accumulation) error { // indicating that the stateKey for Accumulation has already // been seen in the same collection. When this happens, it // implies that multiple Accumulators are being used, or that - // a single Accumulator has been configured with a label key + // a single Accumulator has been configured with a attribute key // filter. if !sameCollection { @@ -370,7 +370,7 @@ func (b *state) ForEach(exporter aggregation.TemporalitySelector, f func(export. if err := f(export.NewRecord( key.descriptor, - value.labels, + value.attrs, agg, start, b.intervalEnd, diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go index 80d0e2a20d8..83e9d4a93f0 100644 --- a/sdk/metric/processor/basic/basic_test.go +++ b/sdk/metric/processor/basic/basic_test.go @@ -235,8 +235,8 @@ func testProcessor( exp := map[string]float64{} if hasMemory || !repetitionAfterEmptyInterval { exp = map[string]float64{ - fmt.Sprintf("inst1%s/L1=V/", instSuffix): float64(multiplier * 10), // labels1 - fmt.Sprintf("inst2%s/L2=V/", instSuffix): float64(multiplier * 10), // labels2 + fmt.Sprintf("inst1%s/L1=V/", instSuffix): float64(multiplier * 10), // attrs1 + fmt.Sprintf("inst2%s/L2=V/", instSuffix): float64(multiplier * 10), // attrs2 } } diff --git a/sdk/metric/processor/basic/config.go b/sdk/metric/processor/basic/config.go index 5170864d7e9..c9114a09943 100644 --- a/sdk/metric/processor/basic/config.go +++ b/sdk/metric/processor/basic/config.go @@ -16,10 +16,10 @@ package basic // import "go.opentelemetry.io/otel/sdk/metric/processor/basic" // config contains the options for configuring a basic metric processor. type config struct { - // Memory controls whether the processor remembers metric - // instruments and label sets that were previously reported. - // When Memory is true, Reader.ForEach() will visit - // metrics that were not updated in the most recent interval. + // Memory controls whether the processor remembers metric instruments and + // attribute sets that were previously reported. When Memory is true, + // Reader.ForEach() will visit metrics that were not updated in the most + // recent interval. Memory bool } @@ -27,10 +27,9 @@ type Option interface { applyProcessor(config) config } -// WithMemory sets the memory behavior of a Processor. If this is -// true, the processor will report metric instruments and label sets -// that were previously reported but not updated in the most recent -// interval. +// WithMemory sets the memory behavior of a Processor. If this is true, the +// processor will report metric instruments and attribute sets that were +// previously reported but not updated in the most recent interval. func WithMemory(memory bool) Option { return memoryOption(memory) } diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index 8931fc833f8..ad3e7360559 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -34,27 +34,26 @@ import ( ) type ( - // mapKey is the unique key for a metric, consisting of its - // unique descriptor, distinct labels, and distinct resource - // attributes. + // mapKey is the unique key for a metric, consisting of its unique + // descriptor, distinct attributes, and distinct resource attributes. mapKey struct { desc *sdkapi.Descriptor - labels attribute.Distinct + attrs attribute.Distinct resource attribute.Distinct } // mapValue is value stored in a processor used to produce a // Reader. mapValue struct { - labels *attribute.Set + attrs *attribute.Set resource *resource.Resource aggregator aggregator.Aggregator } // Output implements export.Reader. Output struct { - m map[mapKey]mapValue - labelEncoder attribute.Encoder + m map[mapKey]mapValue + attrEncoder attribute.Encoder sync.RWMutex } @@ -120,7 +119,7 @@ func (f testFactory) NewCheckpointer() export.Checkpointer { // "counter.sum/A=1,B=2/R=V": 100, // }, processor.Values()) // -// Where in the example A=1,B=2 is the encoded labels and R=V is the +// Where in the example A=1,B=2 is the encoded attributes and R=V is the // encoded resource value. func NewProcessor(selector export.AggregatorSelector, encoder attribute.Encoder) *Processor { return &Processor{ @@ -134,10 +133,10 @@ func (p *Processor) Process(accum export.Accumulation) error { return p.output.AddAccumulation(accum) } -// Values returns the mapping from label set to point values for the -// accumulations that were processed. Point values are chosen as -// either the Sum or the LastValue, whichever is implemented. (All -// the built-in Aggregators implement one of these interfaces.) +// Values returns the mapping from attribute set to point values for the +// accumulations that were processed. Point values are chosen as either the +// Sum or the LastValue, whichever is implemented. (All the built-in +// Aggregators implement one of these interfaces.) func (p *Processor) Values() map[string]float64 { return p.output.Map() } @@ -210,10 +209,10 @@ func (testAggregatorSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ... // (from an Accumulator) or an expected set of Records (from a // Processor). If testing with an Accumulator, it may be simpler to // use the test Processor in this package. -func NewOutput(labelEncoder attribute.Encoder) *Output { +func NewOutput(attrEncoder attribute.Encoder) *Output { return &Output{ - m: make(map[mapKey]mapValue), - labelEncoder: labelEncoder, + m: make(map[mapKey]mapValue), + attrEncoder: attrEncoder, } } @@ -222,7 +221,7 @@ func (o *Output) ForEach(_ aggregation.TemporalitySelector, ff func(export.Recor for key, value := range o.m { if err := ff(export.NewRecord( key.desc, - value.labels, + value.attrs, value.aggregator.Aggregation(), time.Time{}, time.Time{}, @@ -248,7 +247,7 @@ func (o *Output) AddInstrumentationLibraryRecord(_ instrumentation.Library, rec func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource) error { key := mapKey{ desc: rec.Descriptor(), - labels: rec.Labels().Equivalent(), + attrs: rec.Attributes().Equivalent(), resource: res.Equivalent(), } if _, ok := o.m[key]; !ok { @@ -256,7 +255,7 @@ func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource testAggregatorSelector{}.AggregatorFor(rec.Descriptor(), &agg) o.m[key] = mapValue{ aggregator: agg, - labels: rec.Labels(), + attrs: rec.Attributes(), resource: res, } } @@ -271,8 +270,8 @@ func (o *Output) Map() map[string]float64 { r := make(map[string]float64) err := o.ForEach(aggregation.StatelessTemporalitySelector(), func(record export.Record) error { for key, entry := range o.m { - encoded := entry.labels.Encoded(o.labelEncoder) - rencoded := entry.resource.Encoded(o.labelEncoder) + encoded := entry.attrs.Encoded(o.attrEncoder) + rencoded := entry.resource.Encoded(o.attrEncoder) value := 0.0 if s, ok := entry.aggregator.(aggregation.Sum); ok { sum, _ := s.Sum() @@ -308,7 +307,7 @@ func (o *Output) AddAccumulation(acc export.Accumulation) error { return o.AddRecord( export.NewRecord( acc.Descriptor(), - acc.Labels(), + acc.Attributes(), acc.Aggregator().Aggregation(), time.Time{}, time.Time{}, @@ -323,7 +322,7 @@ func (o *Output) AddAccumulation(acc export.Accumulation) error { // "counter.sum/A=1,B=2/R=V": 100, // }, exporter.Values()) // -// Where in the example A=1,B=2 is the encoded labels and R=V is the +// Where in the example A=1,B=2 is the encoded attributes and R=V is the // encoded resource value. func New(selector aggregation.TemporalitySelector, encoder attribute.Encoder) *Exporter { return &Exporter{ @@ -348,10 +347,10 @@ func (e *Exporter) Export(_ context.Context, res *resource.Resource, ckpt export }) } -// Values returns the mapping from label set to point values for the -// accumulations that were processed. Point values are chosen as -// either the Sum or the LastValue, whichever is implemented. (All -// the built-in Aggregators implement one of these interfaces.) +// Values returns the mapping from attribute set to point values for the +// accumulations that were processed. Point values are chosen as either the +// Sum or the LastValue, whichever is implemented. (All the built-in +// Aggregators implement one of these interfaces.) func (e *Exporter) Values() map[string]float64 { e.output.Lock() defer e.output.Unlock() diff --git a/sdk/metric/processor/reducer/doc.go b/sdk/metric/processor/reducer/doc.go index 700a9c97844..a6999e5627b 100644 --- a/sdk/metric/processor/reducer/doc.go +++ b/sdk/metric/processor/reducer/doc.go @@ -13,16 +13,16 @@ // limitations under the License. /* -Package reducer implements a metrics Processor component to reduce labels. +Package reducer implements a metrics Processor component to reduce attributes. This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback. -The metrics Processor component this package implements applies a -`attribute.Filter` to each processed `export.Accumulation` to remove labels before -passing the result to another Processor. This Processor can be used to reduce -inherent dimensionality in the data, as a way to control the cost of +The metrics Processor component this package implements applies an +attribute.Filter to each processed export.Accumulation to remove attributes +before passing the result to another Processor. This Processor can be used to +reduce inherent dimensionality in the data, as a way to control the cost of collecting high cardinality metric data. For example, to compose a push controller with a reducer and a basic @@ -33,9 +33,9 @@ type someFilter struct{ // ... } -func (someFilter) LabelFilterFor(_ *sdkapi.Descriptor) attribute.Filter { - return func(label kv.KeyValue) bool { - // return true to keep this label, false to drop this label +func (someFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { + return func(attr kv.KeyValue) bool { + // return true to keep this attr, false to drop this attr. // ... } } diff --git a/sdk/metric/processor/reducer/reducer.go b/sdk/metric/processor/reducer/reducer.go index d26fd55345e..cd6daeb19d4 100644 --- a/sdk/metric/processor/reducer/reducer.go +++ b/sdk/metric/processor/reducer/reducer.go @@ -22,25 +22,25 @@ import ( type ( // Processor implements "dimensionality reduction" by - // filtering keys from export label sets. + // filtering keys from export attribute sets. Processor struct { export.Checkpointer - filterSelector LabelFilterSelector + filterSelector AttributeFilterSelector } - // LabelFilterSelector is the interface used to configure a - // specific Filter to an instrument. - LabelFilterSelector interface { - LabelFilterFor(descriptor *sdkapi.Descriptor) attribute.Filter + // AttributeFilterSelector selects an attribute filter based on the + // instrument described by the descriptor. + AttributeFilterSelector interface { + AttributeFilterFor(descriptor *sdkapi.Descriptor) attribute.Filter } ) var _ export.Processor = &Processor{} var _ export.Checkpointer = &Processor{} -// New returns a dimensionality-reducing Processor that passes data to -// the next stage in an export pipeline. -func New(filterSelector LabelFilterSelector, ckpter export.Checkpointer) *Processor { +// New returns a dimensionality-reducing Processor that passes data to the +// next stage in an export pipeline. +func New(filterSelector AttributeFilterSelector, ckpter export.Checkpointer) *Processor { return &Processor{ Checkpointer: ckpter, filterSelector: filterSelector, @@ -49,10 +49,10 @@ func New(filterSelector LabelFilterSelector, ckpter export.Checkpointer) *Proces // Process implements export.Processor. func (p *Processor) Process(accum export.Accumulation) error { - // Note: the removed labels are returned and ignored here. + // Note: the removed attributes are returned and ignored here. // Conceivably these inputs could be useful to a sampler. - reduced, _ := accum.Labels().Filter( - p.filterSelector.LabelFilterFor( + reduced, _ := accum.Attributes().Filter( + p.filterSelector.AttributeFilterFor( accum.Descriptor(), ), ) diff --git a/sdk/metric/processor/reducer/reducer_test.go b/sdk/metric/processor/reducer/reducer_test.go index 22fc774f17e..ab043f83d58 100644 --- a/sdk/metric/processor/reducer/reducer_test.go +++ b/sdk/metric/processor/reducer/reducer_test.go @@ -48,9 +48,9 @@ var ( type testFilter struct{} -func (testFilter) LabelFilterFor(_ *sdkapi.Descriptor) attribute.Filter { - return func(label attribute.KeyValue) bool { - return label.Key == "A" || label.Key == "C" +func (testFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { + return func(attr attribute.KeyValue) bool { + return attr.Key == "A" || attr.Key == "C" } } diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go index db3ad330213..4afe14bf0b4 100644 --- a/sdk/metric/sdk.go +++ b/sdk/metric/sdk.go @@ -75,8 +75,8 @@ type ( instrument.Synchronous } - // mapkey uniquely describes a metric instrument in terms of - // its InstrumentID and the encoded form of its labels. + // mapkey uniquely describes a metric instrument in terms of its + // InstrumentID and the encoded form of its attributes. mapkey struct { descriptor *sdkapi.Descriptor ordered attribute.Distinct @@ -98,14 +98,12 @@ type ( // supports checking for no updates during a round. collectedCount int64 - // labels is the stored label set for this record, - // except in cases where a label set is shared due to - // batch recording. - labels attribute.Set + // attrs is the stored attribute set for this record, except in cases + // where a attribute set is shared due to batch recording. + attrs attribute.Set - // sortSlice has a single purpose - as a temporary - // place for sorting during labels creation to avoid - // allocation. + // sortSlice has a single purpose - as a temporary place for sorting + // during attributes creation to avoid allocation. sortSlice attribute.Sortable // inst is a pointer to the corresponding instrument. @@ -146,20 +144,20 @@ func (s *syncInstrument) Implementation() interface{} { } // acquireHandle gets or creates a `*record` corresponding to `kvs`, -// the input labels. +// the input attributes. func (b *baseInstrument) acquireHandle(kvs []attribute.KeyValue) *record { // This memory allocation may not be used, but it's // needed for the `sortSlice` field, to avoid an // allocation while sorting. rec := &record{} - rec.labels = attribute.NewSetWithSortable(kvs, &rec.sortSlice) + rec.attrs = attribute.NewSetWithSortable(kvs, &rec.sortSlice) // Create lookup key for sync.Map (one allocation, as this // passes through an interface{}) mk := mapkey{ descriptor: &b.descriptor, - ordered: rec.labels.Equivalent(), + ordered: rec.attrs.Equivalent(), } if actual, ok := b.meter.current.Load(mk); ok { @@ -372,7 +370,7 @@ func (m *Accumulator) checkpointRecord(r *record) int { return 0 } - a := export.NewAccumulation(&r.inst.descriptor, &r.labels, r.checkpoint) + a := export.NewAccumulation(&r.inst.descriptor, &r.attrs, r.checkpoint) err = m.processor.Process(a) if err != nil { otel.Handle(err) @@ -405,7 +403,7 @@ func (r *record) unbind() { func (r *record) mapkey() mapkey { return mapkey{ descriptor: &r.inst.descriptor, - ordered: r.labels.Equivalent(), + ordered: r.attrs.Equivalent(), } } diff --git a/sdk/metric/sdkapi/noop.go b/sdk/metric/sdkapi/noop.go index 6b2374b68a3..64a28d7b35d 100644 --- a/sdk/metric/sdkapi/noop.go +++ b/sdk/metric/sdkapi/noop.go @@ -79,5 +79,5 @@ func (n noopInstrument) Descriptor() Descriptor { func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) { } -func (noopAsyncInstrument) ObserveOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) { +func (noopAsyncInstrument) ObserveOne(context.Context, number.Number, []attribute.KeyValue) { } diff --git a/sdk/metric/sdkapi/sdkapi.go b/sdk/metric/sdkapi/sdkapi.go index 4345358ff3e..c3a3e04d311 100644 --- a/sdk/metric/sdkapi/sdkapi.go +++ b/sdk/metric/sdkapi/sdkapi.go @@ -58,7 +58,7 @@ type SyncImpl interface { instrument.Synchronous // RecordOne captures a single synchronous metric event. - RecordOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) + RecordOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue) } // AsyncImpl is an implementation-level interface to an @@ -68,7 +68,7 @@ type AsyncImpl interface { instrument.Asynchronous // ObserveOne captures a single synchronous metric event. - ObserveOne(ctx context.Context, number number.Number, labels []attribute.KeyValue) + ObserveOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue) } // AsyncRunner is expected to convert into an AsyncSingleRunner or an diff --git a/sdk/resource/benchmark_test.go b/sdk/resource/benchmark_test.go index 9bde4cb916e..918ec332da8 100644 --- a/sdk/resource/benchmark_test.go +++ b/sdk/resource/benchmark_test.go @@ -25,7 +25,7 @@ import ( const conflict = 0.5 -func makeLabels(n int) (_, _ *resource.Resource) { +func makeAttrs(n int) (_, _ *resource.Resource) { used := map[string]bool{} l1 := make([]attribute.KeyValue, n) l2 := make([]attribute.KeyValue, n) @@ -51,7 +51,7 @@ func makeLabels(n int) (_, _ *resource.Resource) { } func benchmarkMergeResource(b *testing.B, size int) { - r1, r2 := makeLabels(size) + r1, r2 := makeAttrs(size) b.ReportAllocs() b.ResetTimer() diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index e842744ae91..155edfa12cc 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -194,7 +194,7 @@ func Merge(a, b *Resource) (*Resource, error) { mi := attribute.NewMergeIterator(b.Set(), a.Set()) combine := make([]attribute.KeyValue, 0, a.Len()+b.Len()) for mi.Next() { - combine = append(combine, mi.Label()) + combine = append(combine, mi.Attribute()) } merged := NewWithAttributes(schemaURL, combine...) return merged, nil diff --git a/semconv/internal/http_test.go b/semconv/internal/http_test.go index 29b1c49521b..11f7ce57b59 100644 --- a/semconv/internal/http_test.go +++ b/semconv/internal/http_test.go @@ -1009,13 +1009,13 @@ func protoToInts(proto string) (int, int) { func kvStr(kvs []attribute.KeyValue) string { sb := strings.Builder{} sb.WriteRune('[') - for idx, label := range kvs { + for idx, attr := range kvs { if idx > 0 { sb.WriteString(", ") } - sb.WriteString((string)(label.Key)) + sb.WriteString((string)(attr.Key)) sb.WriteString(": ") - sb.WriteString(label.Value.Emit()) + sb.WriteString(attr.Value.Emit()) } sb.WriteRune(']') return sb.String() From 8574d43509681f10808f41455feaf2a750d7dc6a Mon Sep 17 00:00:00 2001 From: Brad Topol Date: Mon, 18 Apr 2022 13:38:55 -0400 Subject: [PATCH 151/886] Add semconv/v1.9.0 package (#2792) * Add semconv/v1.9.0 package Closes: #2756 Signed-off-by: Brad Topol * Updated PR number in CHANGELOG Signed-off-by: Brad Topol --- CHANGELOG.md | 2 + bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- semconv/v1.9.0/doc.go | 20 + semconv/v1.9.0/exception.go | 20 + semconv/v1.9.0/http.go | 114 ++ semconv/v1.9.0/resource.go | 981 ++++++++++ semconv/v1.9.0/schema.go | 20 + semconv/v1.9.0/trace.go | 1635 +++++++++++++++++ website_docs/manual.md | 4 +- 32 files changed, 2818 insertions(+), 26 deletions(-) create mode 100644 semconv/v1.9.0/doc.go create mode 100644 semconv/v1.9.0/exception.go create mode 100644 semconv/v1.9.0/http.go create mode 100644 semconv/v1.9.0/resource.go create mode 100644 semconv/v1.9.0/schema.go create mode 100644 semconv/v1.9.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index deebc30c51c..0efc319bf77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. + The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) - The metrics global package was added back into several test files. (#2764) - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index bc96d0d2fe0..76830bcb963 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index d29a58df623..4e1b676f241 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index db92a1fec6d..53250a30ebe 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 67d7c1a5d35..becf3f7417f 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 2b568d6686f..9a0190e9e67 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index 046a4c059b9..b8abc4b3927 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 0beee98be31..01a577f1fbe 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 41c0b757bb5..27882462ef1 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 2cecb9211d6..e229b7a5688 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 3b3708603c3..74776c77b95 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -22,7 +22,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 9a9d7c187a7..70ac67a01ce 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 0f76bddbb51..a4ca4e814fb 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 1216fa97030..d63665d1acc 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 70ad8bca931..df4ad3b25dc 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 86e462e79ca..f3831457259 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 2810cd600c5..03743e6c1c0 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 95225fb57a3..e4d0fca3343 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -21,7 +21,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 31ee9916880..4028027d014 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index bcad43e7df2..47d76bbd061 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 61087c92cf0..d5a972fc683 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index b34c4e3bad3..c603cb3cb0a 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 7e44657e41b..48fde6bb633 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 51410f16efa..0c6b344d0fc 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 0365f2714f9..bec0cc8aed6 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) diff --git a/semconv/v1.9.0/doc.go b/semconv/v1.9.0/doc.go new file mode 100644 index 00000000000..61aed0e14de --- /dev/null +++ b/semconv/v1.9.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.9.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" diff --git a/semconv/v1.9.0/exception.go b/semconv/v1.9.0/exception.go new file mode 100644 index 00000000000..3568e4916f5 --- /dev/null +++ b/semconv/v1.9.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.9.0/http.go b/semconv/v1.9.0/http.go new file mode 100644 index 00000000000..456e38bd098 --- /dev/null +++ b/semconv/v1.9.0/http.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/semconv/v1.9.0/resource.go b/semconv/v1.9.0/resource.go new file mode 100644 index 00000000000..6388f1048f8 --- /dev/null +++ b/semconv/v1.9.0/resource.go @@ -0,0 +1,981 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // Required: No + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // Required: No + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback function (which + // may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) span attributes). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: Depending on the cloud provider, use: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) with the resolved function version, as the same runtime instance + // may be invokable with multiple + // different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id). + + // On some providers, it may not be possible to determine the full ID at startup, + // which is why this field cannot be made required. For example, on AWS the + // account ID + // part of the ARN is not available without calling another AWS API + // which may be deemed too slow for a short-running lambda function. + // As an alternative, consider setting `faas.id` as a span attribute instead. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // Required: No + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // Required: Always + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // Required: See below + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // Required: No + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.9.0/schema.go b/semconv/v1.9.0/schema.go new file mode 100644 index 00000000000..67d0e9d3fae --- /dev/null +++ b/semconv/v1.9.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.9.0" diff --git a/semconv/v1.9.0/trace.go b/semconv/v1.9.0/trace.go new file mode 100644 index 00000000000..058f3d69980 --- /dev/null +++ b/semconv/v1.9.0/trace.go @@ -0,0 +1,1635 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.9.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // Required: Required, if applicable. + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // Required: Required if applicable and not explicitly disabled via + // instrumentation configuration. + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // Required: Required, if `db.statement` is not applicable. + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // Required: No + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // Required: No + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // Required: Required, if other than the default database (`0`). + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // Required: No + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#exception-end-example). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // Required: Always + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // Required: No + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // Required: Always + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // Required: For some cloud providers, like AWS or GCP, the region in which a + // function is hosted is essential to uniquely identify the function and also part + // of its endpoint. Since it's part of the endpoint being called, the region is + // always known to clients. In these cases, `faas.invoked_region` MUST be set + // accordingly. If the region is unknown to the client or not required for + // identifying the invoked function, setting `faas.invoked_region` is optional. + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // Required: No + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Remote address of the peer (dotted decimal for IPv4 or + // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) + // + // Type: string + // Required: No + // Stability: stable + // Examples: '127.0.0.1' + NetPeerIPKey = attribute.Key("net.peer.ip") + // Remote port number. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Remote hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + NetPeerNameKey = attribute.Key("net.peer.name") + // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '192.168.0.1' + NetHostIPKey = attribute.Key("net.host.ip") + // Like `net.peer.port` but for the host port. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 35555 + NetHostPortKey = attribute.Key("net.host.port") + // Local hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // The internet connection type currently being used by the host. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Another IP-based protocol + NetTransportIP = NetTransportKey.String("ip") + // Unix Domain socket. See below + NetTransportUnix = NetTransportKey.String("unix") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/path/12314/?q=ddds#123' + HTTPTargetKey = attribute.Key("http.target") + // The value of the [HTTP host + // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header + // should also be reported, see note. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'www.example.org' + // Note: When the header is present but empty the attribute SHOULD be set to the + // empty string. Note that this is a valid situation that is expected in certain + // cases, according the aforementioned [section of RFC + // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not + // set the attribute MUST NOT be set. + HTTPHostKey = attribute.Key("http.host") + // The URI scheme identifying the used protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // Required: If and only if one was received/sent. + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User- + // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the + // client. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the uncompressed request payload body after transport decoding. Not + // set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + // The size of the uncompressed response payload body after transport decoding. + // Not set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") +) + +var ( + // HTTP 1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP 1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP 2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Server +const ( + // The primary server name of the matched virtual host. This should be obtained + // via configuration. If no such configuration can be obtained, this attribute + // MUST NOT be set ( `net.host.name` should be used instead). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `http.url` is usually not readily available on the server side but would + // have to be assembled in a cumbersome and sometimes lossy process from other + // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus + // preferred to supply the raw data that is available. + HTTPServerNameKey = attribute.Key("http.server_name") + // The matched route (path template). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/users/:userID?' + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.peer.ip`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.peer.ip`, is available even if that other + // source just confirms the same value as `net.peer.ip`. + // Rationale: For `net.peer.ip`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.peer.ip` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // Required: Required only if the message destination is either a `queue` or + // `topic`. + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // Required: Unless it is empty. + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'grpc', 'java_rmi', 'wcf' + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // Required: No + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // Required: No + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) diff --git a/website_docs/manual.md b/website_docs/manual.md index 4c66bfc2614..e07d09ac1ff 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.8.0" + semconv "go.opentelemetry.io/otel/semconv/v1.9.0" "go.opentelemetry.io/otel/trace" ) @@ -162,7 +162,7 @@ span.SetAttributes(myKey.String("a value")) #### Semantic Attributes -Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.8.0` package. +Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.9.0` package. For details, see [Trace semantic conventions][]. From e8fbfd3ec52d8153eea3f13465b7de15cd8f6320 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 19 Apr 2022 15:13:40 -0700 Subject: [PATCH 152/886] Update Link Checking and Markdown Linting Workflows (#2795) * Add full docs check workflow * Rename file * Remove on pull requests trigger Only run on merge to main and daily at 9am. * Refactor link and markdown lint workflows * Add lycheeignore * Unify link check job name * Remove markdown-link config Co-authored-by: Chester Cheung --- .github/workflows/links-fail-fast.yml | 16 ++++++ .github/workflows/links.yml | 27 ++++++++++ .github/workflows/markdown-fail-fast.yml | 34 ++++++++++++ .github/workflows/markdown.yml | 68 ++++++++---------------- .lycheeignore | 2 + .markdown-link.json | 20 ------- 6 files changed, 100 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/links-fail-fast.yml create mode 100644 .github/workflows/links.yml create mode 100644 .github/workflows/markdown-fail-fast.yml create mode 100644 .lycheeignore delete mode 100644 .markdown-link.json diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml new file mode 100644 index 00000000000..86847617c84 --- /dev/null +++ b/.github/workflows/links-fail-fast.yml @@ -0,0 +1,16 @@ +name: Links (Fail Fast) + +on: + push: + pull_request: + +jobs: + check-links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Link Checker + uses: lycheeverse/lychee-action@v1.4.1 + with: + fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 00000000000..74b7982b81e --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,27 @@ +name: Links + +on: + repository_dispatch: + workflow_dispatch: + schedule: + # Everyday at 9:00 AM. + - cron: "0 9 * * *" + +jobs: + check-links: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1.4.1 + + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v3 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, bot-generated diff --git a/.github/workflows/markdown-fail-fast.yml b/.github/workflows/markdown-fail-fast.yml new file mode 100644 index 00000000000..bcfb0dedaca --- /dev/null +++ b/.github/workflows/markdown-fail-fast.yml @@ -0,0 +1,34 @@ +name: Markdown (Fail Fast) + +on: + push: + pull_request: + +jobs: + changedfiles: + name: changed files + runs-on: ubuntu-latest + outputs: + md: ${{ steps.changes.outputs.md }} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get changed files + id: changes + run: | + echo "::set-output name=md::$(git diff --name-only --diff-filter=ACMRTUXB origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" + + lint: + name: lint markdown files + runs-on: ubuntu-latest + needs: changedfiles + if: ${{needs.changedfiles.outputs.md}} + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Run linter + uses: docker://avtodev/markdown-lint:v1 + with: + args: ${{needs.changedfiles.outputs.md}} diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 92a8b8727a9..b568bdceab5 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -1,57 +1,31 @@ -name: markdown +name: Markdown + on: - push: - branches: - - main - pull_request: -jobs: - changedfiles: - name: changed files - runs-on: ubuntu-latest - outputs: - md: ${{ steps.changes.outputs.md }} - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Get changed files - id: changes - run: | - echo "::set-output name=md::$(git diff --name-only --diff-filter=ACMRTUXB origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" + repository_dispatch: + workflow_dispatch: + schedule: + # Everyday at 9:00 AM. + - cron: "0 9 * * *" - lint: - name: lint markdown files +jobs: + lint-markdown: runs-on: ubuntu-latest - needs: changedfiles - if: ${{needs.changedfiles.outputs.md}} steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Run linter + id: markdownlint uses: docker://avtodev/markdown-lint:v1 with: - args: ${{needs.changedfiles.outputs.md}} + config: .markdownlint.yaml + args: '**/*.md' + output: ./markdownlint.txt - check-links: - runs-on: ubuntu-latest - needs: changedfiles - if: ${{needs.changedfiles.outputs.md}} - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - # This doesn't use gaurav-nelson/github-action-markdown-link-check - # intentionally. As of v1.0.13 the base image was not pinned to a LTS - # version of node and updates upstream to the base image caused CI - # failures. This boils down the entrypoint script from that repository - # and calls markdown-link-check directly instead. - - name: Install markdown-link-check - run: npm install -g markdown-link-check - - name: Run markdown-link-check - run: | - markdown-link-check \ - --verbose \ - --config .markdown-link.json \ - ${{needs.changedfiles.outputs.md}} + - name: Create Issue From File + if: steps.markdownlint.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v3 + with: + title: Markdown Lint Report + content-filepath: ./markdownlint.txt + labels: report, bot-generated diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 00000000000..d300b3f801f --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,2 @@ +http://localhost +http://jaeger-collector diff --git a/.markdown-link.json b/.markdown-link.json deleted file mode 100644 index bd786f03c15..00000000000 --- a/.markdown-link.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "ignorePatterns": [ - { - "pattern": "^http(s)?://localhost" - } - ], - "replacementPatterns": [ - { - "pattern": "^/registry", - "replacement": "https://opentelemetry.io/registry" - }, - { - "pattern": "^/docs/", - "replacement": "https://opentelemetry.io/docs/" - } - ], - "retryOn429": true, - "retryCount": 5, - "fallbackRetryDelay": "30s" -} From bcc5caa6fa6158d46531aa51cc44aa018eceefda Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 20 Apr 2022 11:12:02 -0700 Subject: [PATCH 153/886] Add vanity-import-fix make target (#2836) --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 92e3ce57864..a9a3ef01610 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default +precommit: dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -166,7 +166,11 @@ lint: misspell lint-modules golangci-lint .PHONY: vanity-import-check vanity-import-check: | $(PORTO) - @$(PORTO) --include-internal -l . + @$(PORTO) --include-internal -l . || echo "(run: make vanity-import-fix)" + +.PHONY: vanity-import-fix +vanity-import-fix: | $(PORTO) + @$(PORTO) --include-internal -w . .PHONY: misspell misspell: | $(MISSPELL) From 5f51565cfe23167374aef4766bc571e7727ce300 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 20 Apr 2022 12:32:46 -0600 Subject: [PATCH 154/886] Stop Benchmark Workflow from failing on alert (#2839) * Update benchmark to not failure on alert * update for testing * revert Co-authored-by: Tyler Yahn --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5328bd89576..d73c34b837b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -29,5 +29,5 @@ jobs: output-file-path: output.txt external-data-json-path: ./benchmarks/data.json auto-push: false - fail-on-alert: true + fail-on-alert: false alert-threshold: "400%" From f0a727e0716836e4f0827cbd500bdeeac2d0f455 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 21 Apr 2022 12:42:38 -0700 Subject: [PATCH 155/886] Move unreleased semconv pkgs to unreleased section (#2843) --- CHANGELOG.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0efc319bf77..dffc15e90a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. + The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) +- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. + The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) + ### Fixed - Delegated instruments are unwrapped before delegating Callbacks. (#2784) @@ -34,15 +41,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [0.29.0] - 2022-04-11 -### Added - -- Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. - The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) - The metrics global package was added back into several test files. (#2764) - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) -- Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. - The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) ### Removed From c05c3e237d94cc57e5a87c8fa4b39aaa8b862f65 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 22 Apr 2022 07:41:28 -0700 Subject: [PATCH 156/886] Add semconv/v1.10.0 (#2842) * Add the semconv/v1.10.0 package * Upgrade semconv used to v1.10.0 * Add changes to changelog --- CHANGELOG.md | 2 + bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- semconv/v1.10.0/doc.go | 20 + semconv/v1.10.0/exception.go | 20 + semconv/v1.10.0/http.go | 114 ++ semconv/v1.10.0/resource.go | 981 ++++++++++ semconv/v1.10.0/schema.go | 20 + semconv/v1.10.0/trace.go | 1700 +++++++++++++++++ website_docs/manual.md | 4 +- 32 files changed, 2883 insertions(+), 26 deletions(-) create mode 100644 semconv/v1.10.0/doc.go create mode 100644 semconv/v1.10.0/exception.go create mode 100644 semconv/v1.10.0/http.go create mode 100644 semconv/v1.10.0/resource.go create mode 100644 semconv/v1.10.0/schema.go create mode 100644 semconv/v1.10.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index dffc15e90a0..b82b2e983fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.8.0` version of the OpenTelemetry specification. (#2763) - Add the `go.opentelemetry.io/otel/semconv/v1.9.0` package. The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) +- Add the `go.opentelemetry.io/otel/semconv/v1.10.0` package. + The package contains semantic conventions from the `v1.10.0` version of the OpenTelemetry specification. (#2842) ### Fixed diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 76830bcb963..159e94d4048 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index 4e1b676f241..b728214298a 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 53250a30ebe..06d542f7e1e 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index becf3f7417f..855a55e14bd 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 9a0190e9e67..4b6b2c396ba 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index b8abc4b3927..819db82c149 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 01a577f1fbe..67133ab2c9d 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 27882462ef1..b091b81c921 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index e229b7a5688..10027c03e9f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 74776c77b95..cedfeae6a60 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -22,7 +22,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 70ac67a01ce..b32291d8852 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index a4ca4e814fb..5bf169baf7d 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index d63665d1acc..bd2ed89f878 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index df4ad3b25dc..f05036fdd68 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index f3831457259..2e963f4b547 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 03743e6c1c0..f19470fe333 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index e4d0fca3343..b5b60f467b9 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -21,7 +21,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 4028027d014..8d1952e5f62 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 47d76bbd061..a4d88fa9ccf 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index d5a972fc683..c53867878e9 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index c603cb3cb0a..ad262e0ba84 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 48fde6bb633..1f2e132fecf 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 0c6b344d0fc..edf456d93a7 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index bec0cc8aed6..b0277e83d96 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) diff --git a/semconv/v1.10.0/doc.go b/semconv/v1.10.0/doc.go new file mode 100644 index 00000000000..0c5fbdcee95 --- /dev/null +++ b/semconv/v1.10.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.10.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" diff --git a/semconv/v1.10.0/exception.go b/semconv/v1.10.0/exception.go new file mode 100644 index 00000000000..f4fc8c7aa97 --- /dev/null +++ b/semconv/v1.10.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.10.0/http.go b/semconv/v1.10.0/http.go new file mode 100644 index 00000000000..6271b1926ad --- /dev/null +++ b/semconv/v1.10.0/http.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/semconv/v1.10.0/resource.go b/semconv/v1.10.0/resource.go new file mode 100644 index 00000000000..593017eea4a --- /dev/null +++ b/semconv/v1.10.0/resource.go @@ -0,0 +1,981 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // Required: No + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // Required: No + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback function (which + // may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) span attributes). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: Depending on the cloud provider, use: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) with the resolved function version, as the same runtime instance + // may be invokable with multiple + // different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id). + + // On some providers, it may not be possible to determine the full ID at startup, + // which is why this field cannot be made required. For example, on AWS the + // account ID + // part of the ARN is not available without calling another AWS API + // which may be deemed too slow for a short-running lambda function. + // As an alternative, consider setting `faas.id` as a span attribute instead. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // Required: No + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // Required: Always + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // Required: See below + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // Required: No + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.10.0/schema.go b/semconv/v1.10.0/schema.go new file mode 100644 index 00000000000..74f2e1d509f --- /dev/null +++ b/semconv/v1.10.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.10.0" diff --git a/semconv/v1.10.0/trace.go b/semconv/v1.10.0/trace.go new file mode 100644 index 00000000000..faa3d9c86f3 --- /dev/null +++ b/semconv/v1.10.0/trace.go @@ -0,0 +1,1700 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.10.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // Required: Required, if applicable. + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // Required: Required if applicable and not explicitly disabled via + // instrumentation configuration. + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // Required: Required, if `db.statement` is not applicable. + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // Required: No + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // Required: No + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // Required: Required, if other than the default database (`0`). + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // Required: No + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#recording-an-exception). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // Required: Always + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // Required: No + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // Required: Always + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // Required: For some cloud providers, like AWS or GCP, the region in which a + // function is hosted is essential to uniquely identify the function and also part + // of its endpoint. Since it's part of the endpoint being called, the region is + // always known to clients. In these cases, `faas.invoked_region` MUST be set + // accordingly. If the region is unknown to the client or not required for + // identifying the invoked function, setting `faas.invoked_region` is optional. + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // Required: No + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Remote address of the peer (dotted decimal for IPv4 or + // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) + // + // Type: string + // Required: No + // Stability: stable + // Examples: '127.0.0.1' + NetPeerIPKey = attribute.Key("net.peer.ip") + // Remote port number. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Remote hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + NetPeerNameKey = attribute.Key("net.peer.name") + // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '192.168.0.1' + NetHostIPKey = attribute.Key("net.host.ip") + // Like `net.peer.port` but for the host port. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 35555 + NetHostPortKey = attribute.Key("net.host.port") + // Local hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // The internet connection type currently being used by the host. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Another IP-based protocol + NetTransportIP = NetTransportKey.String("ip") + // Unix Domain socket. See below + NetTransportUnix = NetTransportKey.String("unix") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/path/12314/?q=ddds#123' + HTTPTargetKey = attribute.Key("http.target") + // The value of the [HTTP host + // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header + // should also be reported, see note. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'www.example.org' + // Note: When the header is present but empty the attribute SHOULD be set to the + // empty string. Note that this is a valid situation that is expected in certain + // cases, according the aforementioned [section of RFC + // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not + // set the attribute MUST NOT be set. + HTTPHostKey = attribute.Key("http.host") + // The URI scheme identifying the used protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // Required: If and only if one was received/sent. + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User- + // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the + // client. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the uncompressed request payload body after transport decoding. Not + // set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + // The size of the uncompressed response payload body after transport decoding. + // Not set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") + // The ordinal number of request re-sending attempt. + // + // Type: int + // Required: If and only if a request was retried. + // Stability: stable + // Examples: 3 + HTTPRetryCountKey = attribute.Key("http.retry_count") +) + +var ( + // HTTP 1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP 1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP 2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Server +const ( + // The primary server name of the matched virtual host. This should be obtained + // via configuration. If no such configuration can be obtained, this attribute + // MUST NOT be set ( `net.host.name` should be used instead). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `http.url` is usually not readily available on the server side but would + // have to be assembled in a cumbersome and sometimes lossy process from other + // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus + // preferred to supply the raw data that is available. + HTTPServerNameKey = attribute.Key("http.server_name") + // The matched route (path template). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/users/:userID?' + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.peer.ip`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.peer.ip`, is available even if that other + // source just confirms the same value as `net.peer.ip`. + // Rationale: For `net.peer.ip`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.peer.ip` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // Required: Required only if the message destination is either a `queue` or + // `topic`. + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // Required: Unless it is empty. + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // Required: No + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // Required: No + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) diff --git a/website_docs/manual.md b/website_docs/manual.md index e07d09ac1ff..f71161b3905 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.9.0" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" ) @@ -162,7 +162,7 @@ span.SetAttributes(myKey.String("a value")) #### Semantic Attributes -Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.9.0` package. +Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.10.0` package. For details, see [Trace semantic conventions][]. From 8982a14707131dbb2393230f8564a1f1de127524 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Sun, 24 Apr 2022 09:49:09 -0500 Subject: [PATCH 157/886] Create an Inmemory Exporter for test (#2776) * in memory exporter * Add comments * Split tests and address PR comments * address PR comments. * Changelog * fix Changelog. * Apply suggestions from code review Co-authored-by: Tyler Yahn Co-authored-by: Joshua MacDonald * Add numberkind * Made the tests require.NoError * fix the Label changing * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Joshua MacDonald --- CHANGELOG.md | 3 + sdk/metric/aggregator/aggregatortest/test.go | 3 +- .../export/aggregation/temporality_test.go | 3 +- sdk/metric/metrictest/config.go | 57 +++ sdk/metric/metrictest/doc.go | 18 + sdk/metric/metrictest/exporter.go | 180 ++++++++ sdk/metric/metrictest/exporter_test.go | 424 ++++++++++++++++++ 7 files changed, 684 insertions(+), 4 deletions(-) create mode 100644 sdk/metric/metrictest/config.go create mode 100644 sdk/metric/metrictest/doc.go create mode 100644 sdk/metric/metrictest/exporter.go create mode 100644 sdk/metric/metrictest/exporter_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b82b2e983fa..16f3f0d0f37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.9.0` version of the OpenTelemetry specification. (#2792) - Add the `go.opentelemetry.io/otel/semconv/v1.10.0` package. The package contains semantic conventions from the `v1.10.0` version of the OpenTelemetry specification. (#2842) +- Added an in-memory exporter to metrictest to aid testing with a full SDK. (#2776) ### Fixed @@ -43,6 +44,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [0.29.0] - 2022-04-11 +### Added + - The metrics global package was added back into several test files. (#2764) - The `Meter` function is added back to the `go.opentelemetry.io/otel/metric/global` package. This function is a convenience function equivalent to calling `global.MeterProvider().Meter(...)`. (#2750) diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go index b9ea62da9bd..75fd7d44ff5 100644 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ b/sdk/metric/aggregator/aggregatortest/test.go @@ -28,7 +28,6 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) @@ -65,7 +64,7 @@ func newProfiles() []Profile { } func NewAggregatorTest(mkind sdkapi.InstrumentKind, nkind number.Kind) *sdkapi.Descriptor { - desc := metrictest.NewDescriptor("test.name", mkind, nkind) + desc := sdkapi.NewDescriptor("test.name", mkind, nkind, "", "") return &desc } diff --git a/sdk/metric/export/aggregation/temporality_test.go b/sdk/metric/export/aggregation/temporality_test.go index 69b976da773..ab1682b729d 100644 --- a/sdk/metric/export/aggregation/temporality_test.go +++ b/sdk/metric/export/aggregation/temporality_test.go @@ -19,7 +19,6 @@ import ( "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/sdk/metric/metrictest" "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) @@ -59,7 +58,7 @@ func TestTemporalitySelectors(t *testing.T) { sAggTemp := StatelessTemporalitySelector() for _, ikind := range append(deltaMemoryTemporalties, cumulativeMemoryTemporalties...) { - desc := metrictest.NewDescriptor("instrument", ikind, number.Int64Kind) + desc := sdkapi.NewDescriptor("instrument", ikind, number.Int64Kind, "", "") var akind Kind if ikind.Adding() { diff --git a/sdk/metric/metrictest/config.go b/sdk/metric/metrictest/config.go new file mode 100644 index 00000000000..4531b178fdc --- /dev/null +++ b/sdk/metric/metrictest/config.go @@ -0,0 +1,57 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" + +import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + +type config struct { + temporalitySelector aggregation.TemporalitySelector +} + +func newConfig(opts ...Option) config { + cfg := config{ + temporalitySelector: aggregation.CumulativeTemporalitySelector(), + } + for _, opt := range opts { + cfg = opt.apply(cfg) + } + return cfg +} + +// Option allow for control of details of the TestMeterProvider created. +type Option interface { + apply(config) config +} + +type functionOption func(config) config + +func (f functionOption) apply(cfg config) config { + return f(cfg) +} + +// WithTemporalitySelector allows for the use of either cumulative (default) or +// delta metrics. +// +// Warning: the current SDK does not convert async instruments into delta +// temporality. +func WithTemporalitySelector(ts aggregation.TemporalitySelector) Option { + return functionOption(func(cfg config) config { + if ts == nil { + return cfg + } + cfg.temporalitySelector = ts + return cfg + }) +} diff --git a/sdk/metric/metrictest/doc.go b/sdk/metric/metrictest/doc.go new file mode 100644 index 00000000000..504384dd3ab --- /dev/null +++ b/sdk/metric/metrictest/doc.go @@ -0,0 +1,18 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The metrictest package is a collection of tools used to make testing parts of +// the SDK easier. + +package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" diff --git a/sdk/metric/metrictest/exporter.go b/sdk/metric/metrictest/exporter.go new file mode 100644 index 00000000000..e57c8664c7d --- /dev/null +++ b/sdk/metric/metrictest/exporter.go @@ -0,0 +1,180 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" + controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" + "go.opentelemetry.io/otel/sdk/metric/export" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/number" + processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" + selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" +) + +// Exporter is a manually collected exporter for testing the SDK. It does not +// satisfy the `export.Exporter` interface because it is not intended to be +// used with the periodic collection of the SDK, instead the test should +// manually call `Collect()` +// +// Exporters are not thread safe, and should only be used for testing. +type Exporter struct { + // Records contains the last metrics collected. + Records []ExportRecord + + controller *controller.Controller + temporalitySelector aggregation.TemporalitySelector +} + +// NewTestMeterProvider creates a MeterProvider and Exporter to be used in tests. +func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) { + cfg := newConfig(opts...) + + c := controller.New( + processor.NewFactory( + selector.NewWithHistogramDistribution(), + cfg.temporalitySelector, + ), + controller.WithCollectPeriod(0), + ) + exp := &Exporter{ + controller: c, + temporalitySelector: cfg.temporalitySelector, + } + + return c, exp +} + +// ExportRecord represents one collected datapoint from the Exporter. +type ExportRecord struct { + InstrumentName string + InstrumentationLibrary Library + Attributes []attribute.KeyValue + AggregationKind aggregation.Kind + NumberKind number.Kind + Sum number.Number + Count uint64 + Histogram aggregation.Buckets + LastValue number.Number +} + +// Collect triggers the SDK's collect methods and then aggregates the data into +// ExportRecords. This will overwrite any previous collected metrics. +func (e *Exporter) Collect(ctx context.Context) error { + e.Records = []ExportRecord{} + + err := e.controller.Collect(ctx) + if err != nil { + return err + } + + return e.controller.ForEach(func(l instrumentation.Library, r export.Reader) error { + lib := Library{ + InstrumentationName: l.Name, + InstrumentationVersion: l.Version, + SchemaURL: l.SchemaURL, + } + + return r.ForEach(e.temporalitySelector, func(rec export.Record) error { + record := ExportRecord{ + InstrumentName: rec.Descriptor().Name(), + InstrumentationLibrary: lib, + Attributes: rec.Attributes().ToSlice(), + AggregationKind: rec.Aggregation().Kind(), + NumberKind: rec.Descriptor().NumberKind(), + } + + var err error + switch agg := rec.Aggregation().(type) { + case aggregation.Histogram: + record.AggregationKind = aggregation.HistogramKind + record.Histogram, err = agg.Histogram() + if err != nil { + return err + } + record.Sum, err = agg.Sum() + if err != nil { + return err + } + record.Count, err = agg.Count() + if err != nil { + return err + } + case aggregation.Count: + record.Count, err = agg.Count() + if err != nil { + return err + } + case aggregation.LastValue: + record.LastValue, _, err = agg.LastValue() + if err != nil { + return err + } + case aggregation.Sum: + record.Sum, err = agg.Sum() + if err != nil { + return err + } + } + + e.Records = append(e.Records, record) + return nil + }) + }) +} + +// GetRecords returns all Records found by the SDK. +func (e *Exporter) GetRecords() []ExportRecord { + return e.Records +} + +var errNotFound = fmt.Errorf("record not found") + +// GetByName returns the first Record with a matching instrument name. +func (e *Exporter) GetByName(name string) (ExportRecord, error) { + for _, rec := range e.Records { + if rec.InstrumentName == name { + return rec, nil + } + } + return ExportRecord{}, errNotFound +} + +// GetByNameAndAttributes returns the first Record with a matching name and the sub-set of attributes. +func (e *Exporter) GetByNameAndAttributes(name string, attributes []attribute.KeyValue) (ExportRecord, error) { + for _, rec := range e.Records { + if rec.InstrumentName == name && subSet(attributes, rec.Attributes) { + return rec, nil + } + } + return ExportRecord{}, errNotFound +} + +// subSet returns true if attributesA is a subset of attributesB. +func subSet(attributesA, attributesB []attribute.KeyValue) bool { + b := attribute.NewSet(attributesB...) + + for _, kv := range attributesA { + if v, found := b.Value(kv.Key); !found || v != kv.Value { + return false + } + } + return true +} diff --git a/sdk/metric/metrictest/exporter_test.go b/sdk/metric/metrictest/exporter_test.go new file mode 100644 index 00000000000..8fa8e805bf1 --- /dev/null +++ b/sdk/metric/metrictest/exporter_test.go @@ -0,0 +1,424 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metrictest_test // import "go.opentelemetry.io/otel/sdk/metric/metrictest" + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/export/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" +) + +func TestSyncInstruments(t *testing.T) { + ctx := context.Background() + mp, exp := metrictest.NewTestMeterProvider() + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestSyncInstruments") + + t.Run("Float Counter", func(t *testing.T) { + fcnt, err := meter.SyncFloat64().Counter("fCount") + require.NoError(t, err) + + fcnt.Add(ctx, 2) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fCount") + require.NoError(t, err) + assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + }) + + t.Run("Float UpDownCounter", func(t *testing.T) { + fudcnt, err := meter.SyncFloat64().UpDownCounter("fUDCount") + require.NoError(t, err) + + fudcnt.Add(ctx, 3) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fUDCount") + require.NoError(t, err) + assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + + t.Run("Float Histogram", func(t *testing.T) { + fhis, err := meter.SyncFloat64().Histogram("fHist") + require.NoError(t, err) + + fhis.Record(ctx, 4) + fhis.Record(ctx, 5) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fHist") + require.NoError(t, err) + assert.InDelta(t, 9.0, out.Sum.AsFloat64(), 0.0001) + assert.EqualValues(t, 2, out.Count) + assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) + }) + + t.Run("Int Counter", func(t *testing.T) { + icnt, err := meter.SyncInt64().Counter("iCount") + require.NoError(t, err) + + icnt.Add(ctx, 22) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iCount") + require.NoError(t, err) + assert.EqualValues(t, 22, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + t.Run("Int UpDownCounter", func(t *testing.T) { + iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") + require.NoError(t, err) + + iudcnt.Add(ctx, 23) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iUDCount") + require.NoError(t, err) + assert.EqualValues(t, 23, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + t.Run("Int Histogram", func(t *testing.T) { + + ihis, err := meter.SyncInt64().Histogram("iHist") + require.NoError(t, err) + + ihis.Record(ctx, 24) + ihis.Record(ctx, 25) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iHist") + require.NoError(t, err) + assert.EqualValues(t, 49, out.Sum.AsInt64()) + assert.EqualValues(t, 2, out.Count) + assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) + }) +} + +func TestSyncDeltaInstruments(t *testing.T) { + ctx := context.Background() + mp, exp := metrictest.NewTestMeterProvider(metrictest.WithTemporalitySelector(aggregation.DeltaTemporalitySelector())) + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestSyncDeltaInstruments") + + t.Run("Float Counter", func(t *testing.T) { + fcnt, err := meter.SyncFloat64().Counter("fCount") + require.NoError(t, err) + + fcnt.Add(ctx, 2) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fCount") + require.NoError(t, err) + assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + }) + + t.Run("Float UpDownCounter", func(t *testing.T) { + fudcnt, err := meter.SyncFloat64().UpDownCounter("fUDCount") + require.NoError(t, err) + + fudcnt.Add(ctx, 3) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fUDCount") + require.NoError(t, err) + assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + + t.Run("Float Histogram", func(t *testing.T) { + fhis, err := meter.SyncFloat64().Histogram("fHist") + require.NoError(t, err) + + fhis.Record(ctx, 4) + fhis.Record(ctx, 5) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fHist") + require.NoError(t, err) + assert.InDelta(t, 9.0, out.Sum.AsFloat64(), 0.0001) + assert.EqualValues(t, 2, out.Count) + assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) + }) + + t.Run("Int Counter", func(t *testing.T) { + icnt, err := meter.SyncInt64().Counter("iCount") + require.NoError(t, err) + + icnt.Add(ctx, 22) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iCount") + require.NoError(t, err) + assert.EqualValues(t, 22, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + t.Run("Int UpDownCounter", func(t *testing.T) { + iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") + require.NoError(t, err) + + iudcnt.Add(ctx, 23) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iUDCount") + require.NoError(t, err) + assert.EqualValues(t, 23, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + t.Run("Int Histogram", func(t *testing.T) { + + ihis, err := meter.SyncInt64().Histogram("iHist") + require.NoError(t, err) + + ihis.Record(ctx, 24) + ihis.Record(ctx, 25) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iHist") + require.NoError(t, err) + assert.EqualValues(t, 49, out.Sum.AsInt64()) + assert.EqualValues(t, 2, out.Count) + assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) + }) +} + +func TestAsyncInstruments(t *testing.T) { + ctx := context.Background() + mp, exp := metrictest.NewTestMeterProvider() + + t.Run("Float Counter", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatCounter") + + fcnt, err := meter.AsyncFloat64().Counter("fCount") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + fcnt, + }, func(context.Context) { + fcnt.Observe(ctx, 2) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fCount") + require.NoError(t, err) + assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + }) + + t.Run("Float UpDownCounter", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatUpDownCounter") + + fudcnt, err := meter.AsyncFloat64().UpDownCounter("fUDCount") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + fudcnt, + }, func(context.Context) { + fudcnt.Observe(ctx, 3) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fUDCount") + require.NoError(t, err) + assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + }) + + t.Run("Float Gauge", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatGauge") + + fgauge, err := meter.AsyncFloat64().Gauge("fGauge") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + fgauge, + }, func(context.Context) { + fgauge.Observe(ctx, 4) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("fGauge") + require.NoError(t, err) + assert.InDelta(t, 4.0, out.LastValue.AsFloat64(), 0.0001) + assert.Equal(t, aggregation.LastValueKind, out.AggregationKind) + }) + + t.Run("Int Counter", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntCounter") + + icnt, err := meter.AsyncInt64().Counter("iCount") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + icnt, + }, func(context.Context) { + icnt.Observe(ctx, 22) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iCount") + require.NoError(t, err) + assert.EqualValues(t, 22, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + }) + + t.Run("Int UpDownCounter", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntUpDownCounter") + + iudcnt, err := meter.AsyncInt64().UpDownCounter("iUDCount") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + iudcnt, + }, func(context.Context) { + iudcnt.Observe(ctx, 23) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iUDCount") + require.NoError(t, err) + assert.EqualValues(t, 23, out.Sum.AsInt64()) + assert.Equal(t, aggregation.SumKind, out.AggregationKind) + + }) + t.Run("Int Gauge", func(t *testing.T) { + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntGauge") + + igauge, err := meter.AsyncInt64().Gauge("iGauge") + require.NoError(t, err) + + err = meter.RegisterCallback( + []instrument.Asynchronous{ + igauge, + }, func(context.Context) { + igauge.Observe(ctx, 25) + }) + require.NoError(t, err) + + err = exp.Collect(context.Background()) + require.NoError(t, err) + + out, err := exp.GetByName("iGauge") + require.NoError(t, err) + assert.EqualValues(t, 25, out.LastValue.AsInt64()) + assert.Equal(t, aggregation.LastValueKind, out.AggregationKind) + }) + +} + +func ExampleExporter_GetByName() { + mp, exp := metrictest.NewTestMeterProvider() + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_ExampleExporter_GetByName") + + cnt, err := meter.SyncFloat64().Counter("fCount") + if err != nil { + panic("could not acquire counter") + } + + cnt.Add(context.Background(), 2.5) + + err = exp.Collect(context.Background()) + if err != nil { + panic("collection failed") + } + + out, _ := exp.GetByName("fCount") + + fmt.Println(out.Sum.AsFloat64()) + // Output: 2.5 +} + +func ExampleExporter_GetByNameAndAttributes() { + mp, exp := metrictest.NewTestMeterProvider() + meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_ExampleExporter_GetByNameAndAttributes") + + cnt, err := meter.SyncFloat64().Counter("fCount") + if err != nil { + panic("could not acquire counter") + } + + cnt.Add(context.Background(), 4, attribute.String("foo", "bar"), attribute.Bool("found", false)) + + err = exp.Collect(context.Background()) + if err != nil { + panic("collection failed") + } + + out, err := exp.GetByNameAndAttributes("fCount", []attribute.KeyValue{attribute.String("foo", "bar")}) + if err != nil { + println(err.Error()) + } + + fmt.Println(out.Sum.AsFloat64()) + // Output: 4 +} From e3c8c7437b4b8fc323910b58c23b238c054b35a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 08:21:15 -0700 Subject: [PATCH 158/886] Bump go.opentelemetry.io/proto/otlp from 0.15.0 to 0.16.0 in /exporters/otlp/otlptrace (#2853) * Bump go.opentelemetry.io/proto/otlp in /exporters/otlp/otlptrace Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules * go mod tidy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias Co-authored-by: Tyler Yahn --- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index b2a565d9bbe..89f97dbea82 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -160,8 +160,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 136d3253adb..00bb88f1b1d 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/trace v1.6.3 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index de1726e24dc..d857a234050 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -161,8 +161,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index b515d648381..cf3d2c23e6c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index c78274ecb0d..d3ca3e0cd39 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 54f33907dcf..60091c2507a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/trace v1.6.3 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index de1726e24dc..d857a234050 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -161,8 +161,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 68d538a24f998ad4995a75691bccfdd132537b9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 08:32:18 -0700 Subject: [PATCH 159/886] Bump go.opentelemetry.io/proto/otlp from 0.15.0 to 0.16.0 in /exporters/otlp/otlpmetric (#2858) * Bump go.opentelemetry.io/proto/otlp in /exporters/otlp/otlpmetric Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 0.15.0 to 0.16.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v0.15.0...v0.16.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 732ae1e22a5..a7c14f1c674 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.29.0 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index f69a11110a4..c7db096a27b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 068637c2534..503235c981b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.29.0 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.45.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index f69a11110a4..c7db096a27b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 501200ad6d5..5a5daa5aaf1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.29.0 go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/proto/otlp v0.15.0 + go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index f69a11110a4..c7db096a27b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0 h1:h0bKrvdrT/9sBwEJ6iWUqT/N/xPcS66bL4u3isneJ6w= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= +go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 1ec851e8caed02b8e9370e8fdfcb4f4503de9a34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 07:36:48 -0700 Subject: [PATCH 160/886] Bump google.golang.org/grpc from 1.45.0 to 1.46.0 in /exporters/otlp/otlptrace (#2856) * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.45.0 to 1.46.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.45.0...v1.46.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules * go mod tidy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias Co-authored-by: Tyler Yahn --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 9 +++++++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 9 +++++++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 9 +++++++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 9 +++++++-- 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 425be7374d8..d1d13628dd7 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.3 go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/trace v1.6.3 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 89f97dbea82..b1ca690614e 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -50,6 +50,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -59,6 +60,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -226,6 +228,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -268,7 +271,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -400,8 +405,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 00bb88f1b1d..5501c87ca07 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/trace v1.6.3 go.opentelemetry.io/proto/otlp v0.16.0 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index d857a234050..993767449f8 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -50,6 +50,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -59,6 +60,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -224,6 +226,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -265,7 +268,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -396,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index cf3d2c23e6c..129b7e830a1 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.16.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index d3ca3e0cd39..030086b6046 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -50,6 +50,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -59,6 +60,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -229,6 +231,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -271,7 +274,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -404,8 +409,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index d857a234050..993767449f8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -50,6 +50,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -59,6 +60,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -224,6 +226,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -265,7 +268,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -396,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 907be7963e15eb9769115ee3e020032217031881 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 07:49:10 -0700 Subject: [PATCH 161/886] Bump google.golang.org/grpc from 1.45.0 to 1.46.0 in /exporters/otlp/otlpmetric (#2857) * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.45.0 to 1.46.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.45.0...v1.46.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 9 +++++++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 9 +++++++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 9 +++++++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index a7c14f1c674..71c1a59480c 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.6.3 go.opentelemetry.io/otel/sdk/metric v0.29.0 go.opentelemetry.io/proto/otlp v0.16.0 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index c7db096a27b..3c682483a62 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -52,6 +52,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -61,6 +62,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -226,6 +228,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,7 +270,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -398,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 503235c981b..d26194c2489 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.29.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.45.0 + google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index c7db096a27b..3c682483a62 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -52,6 +52,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -61,6 +62,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -226,6 +228,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,7 +270,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -398,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index c7db096a27b..3c682483a62 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -52,6 +52,7 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -61,6 +62,7 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -226,6 +228,7 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,7 +270,9 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= @@ -398,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 99cd89d9c48a4fbff32955248ea3a720e26f7de7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 07:57:18 -0700 Subject: [PATCH 162/886] Bump codecov/codecov-action from 3.0.0 to 3.1.0 (#2846) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.0.0 to 3.1.0. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.0.0...v3.1.0) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d869125703..1d5f0de1335 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v3.0.0 + uses: codecov/codecov-action@v3.1.0 with: file: ./coverage.txt fail_ci_if_error: true From 1eef1459aa4b2c18deacd8332fee3df1d97dc160 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Apr 2022 08:05:40 -0700 Subject: [PATCH 163/886] Bump peter-evans/create-issue-from-file from 3 to 4 (#2847) Bumps [peter-evans/create-issue-from-file](https://github.com/peter-evans/create-issue-from-file) from 3 to 4. - [Release notes](https://github.com/peter-evans/create-issue-from-file/releases) - [Commits](https://github.com/peter-evans/create-issue-from-file/compare/v3...v4) --- updated-dependencies: - dependency-name: peter-evans/create-issue-from-file dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links.yml | 2 +- .github/workflows/markdown.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 74b7982b81e..d0cffdc0d5c 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -20,7 +20,7 @@ jobs: - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v3 + uses: peter-evans/create-issue-from-file@v4 with: title: Link Checker Report content-filepath: ./lychee/out.md diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index b568bdceab5..02725739c75 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -24,7 +24,7 @@ jobs: - name: Create Issue From File if: steps.markdownlint.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v3 + uses: peter-evans/create-issue-from-file@v4 with: title: Markdown Lint Report content-filepath: ./markdownlint.txt From b8e4241a32f2fc2a8b8f2c8ea2ca4be0b17aecc9 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 25 Apr 2022 08:12:24 -0700 Subject: [PATCH 164/886] [docs] update resource initialization (#2844) * [docs] update resource initialization * Formatting * [docs] handle error case in resource merge * Update manual.md Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- website_docs/manual.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index f71161b3905..6a04387ff7c 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -46,15 +46,22 @@ func newExporter(ctx context.Context) /* (someExporter.Exporter, error) */ { } func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { - // The service.name attribute is required. - resource := resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceNameKey.String("ExampleService"), + // Ensure default SDK resources and the required service name are set. + r, err := resource.Merge( + resource.Default(), + resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("ExampleService"), + ) ) + + if err != nil { + panic(err) + } return sdktrace.NewTracerProvider( sdktrace.WithBatcher(exp), - sdktrace.WithResource(resource), + sdktrace.WithResource(r), ) } From fdfc821bac8357ec1eac271c50454606c318d8de Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 25 Apr 2022 13:22:49 -0700 Subject: [PATCH 165/886] Add godot linter to golangci (#2845) Comment should be complete sentences outside of lists with sentence fragments. This adds the godot linter to check these complete sentences end with punctuation. If they do not, running fix will append a period. --- .golangci.yml | 7 +++ bridge/opencensus/exporter.go | 6 +-- example/opencensus/main.go | 2 +- example/passthrough/handler/handler.go | 4 +- example/passthrough/main.go | 2 +- exporters/jaeger/agent.go | 2 +- exporters/jaeger/env.go | 8 +-- exporters/jaeger/reconnecting_udp_client.go | 6 +-- exporters/jaeger/uploader.go | 2 +- .../otlp/internal/envconfig/envconfig.go | 16 +++--- .../internal/metrictransform/metric.go | 2 +- .../internal/otlpconfig/envconfig.go | 8 +-- .../otlpmetric/otlpmetricgrpc/client_test.go | 2 +- .../otlpmetricgrpc/mock_collector_test.go | 2 +- .../otlp/otlpmetric/otlpmetrichttp/client.go | 2 +- .../internal/otlpconfig/envconfig.go | 8 +-- .../internal/otlpconfig/optiontypes.go | 2 +- .../otlptrace/otlptracegrpc/client_test.go | 2 +- .../otlptracegrpc/mock_collector_test.go | 2 +- .../otlp/otlptrace/otlptracehttp/client.go | 2 +- exporters/prometheus/sanitize.go | 2 +- exporters/zipkin/env.go | 6 +-- exporters/zipkin/model.go | 4 +- handler.go | 2 +- internal/global/internal_logging.go | 4 +- internal/global/util_test.go | 2 +- metric/example_test.go | 2 +- metric/global/global.go | 2 +- metric/internal/global/instruments.go | 2 +- metric/internal/global/meter.go | 4 +- metric/internal/global/meter_types_test.go | 6 +-- schema/v1.0/types/types.go | 2 +- sdk/internal/env/env.go | 51 ++++++++----------- .../exponential/mapping/exponent/float64.go | 8 +-- .../mapping/logarithm/logarithm_test.go | 2 +- sdk/metric/aggregator/histogram/histogram.go | 2 +- .../aggregator/histogram/histogram_test.go | 2 +- sdk/metric/export/aggregation/aggregation.go | 2 +- sdk/metric/number/number.go | 6 +-- sdk/metric/registry/registry_test.go | 2 +- sdk/resource/auto.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/env.go | 4 +- sdk/trace/provider.go | 6 +-- sdk/trace/sampling.go | 8 +-- sdk/trace/span_limits.go | 3 +- sdk/trace/trace_test.go | 2 +- trace/config.go | 2 +- trace/noop.go | 2 +- trace/trace.go | 8 +-- 50 files changed, 118 insertions(+), 121 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 7a5fdc07abf..affba1f8378 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,7 @@ linters: - goimports - gosimple - govet + - godot - ineffassign - misspell - revive @@ -45,3 +46,9 @@ linters-settings: - cancelled goimports: local-prefixes: go.opentelemetry.io + godot: + exclude: + # Exclude sentence fragments for lists. + - '^[ ]*[-•]' + # Exclude sentences prefixing a list. + - ':$' diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index 9ec375d3a44..e5d0410629e 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -40,7 +40,7 @@ import ( var errConversion = errors.New("Unable to convert from OpenCensus to OpenTelemetry") // NewMetricExporter returns an OpenCensus exporter that exports to an -// OpenTelemetry exporter +// OpenTelemetry exporter. func NewMetricExporter(base export.Exporter) metricexport.Exporter { return &exporter{base: base} } @@ -51,7 +51,7 @@ type exporter struct { base export.Exporter } -// ExportMetrics implements the OpenCensus metric Exporter interface +// ExportMetrics implements the OpenCensus metric Exporter interface. func (e *exporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { res := resource.Empty() if len(metrics) != 0 { @@ -147,7 +147,7 @@ func convertResource(res *ocresource.Resource) *resource.Resource { return resource.NewSchemaless(attrs...) } -// convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor +// convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor. func convertDescriptor(ocDescriptor metricdata.Descriptor) (sdkapi.Descriptor, error) { var ( nkind number.Kind diff --git a/example/opencensus/main.go b/example/opencensus/main.go index ceccb82d083..536cce597fa 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -40,7 +40,7 @@ import ( var ( // instrumenttype differentiates between our gauge and view metrics. keyType = tag.MustNewKey("instrumenttype") - // Counts the number of lines read in from standard input + // Counts the number of lines read in from standard input. countMeasure = stats.Int64("test_count", "A count of something", stats.UnitDimensionless) countView = &view.View{ Name: "test_count", diff --git a/example/passthrough/handler/handler.go b/example/passthrough/handler/handler.go index 10664baec6f..1ba439deac2 100644 --- a/example/passthrough/handler/handler.go +++ b/example/passthrough/handler/handler.go @@ -44,7 +44,7 @@ func New(next func(r *http.Request)) *Handler { } } -// HandleHTTPReq mimics what an instrumented http server does +// HandleHTTPReq mimics what an instrumented http server does. func (h *Handler) HandleHTTPReq(r *http.Request) { ctx := h.propagators.Extract(r.Context(), propagation.HeaderCarrier(r.Header)) var span trace.Span @@ -58,7 +58,7 @@ func (h *Handler) HandleHTTPReq(r *http.Request) { h.makeOutgoingRequest(ctx) } -// makeOutgoingRequest mimics what an instrumented http client does +// makeOutgoingRequest mimics what an instrumented http client does. func (h *Handler) makeOutgoingRequest(ctx context.Context) { // make a new http request r, err := http.NewRequest("", "", nil) diff --git a/example/passthrough/main.go b/example/passthrough/main.go index 0d5a2d98322..cfab1dabb21 100644 --- a/example/passthrough/main.go +++ b/example/passthrough/main.go @@ -73,7 +73,7 @@ func initPassthroughGlobals() { } // nonGlobalTracer creates a trace provider instance for testing, but doesn't -// set it as the global tracer provider +// set it as the global tracer provider. func nonGlobalTracer() *sdktrace.TracerProvider { var err error exp, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go index 17692fb570e..ed002b83f7a 100644 --- a/exporters/jaeger/agent.go +++ b/exporters/jaeger/agent.go @@ -29,7 +29,7 @@ import ( ) const ( - // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent + // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent. udpPacketMaxLength = 65000 // emitBatchOverhead is the additional overhead bytes used for enveloping the datagram, // synced with jaeger-agent https://github.com/jaegertracing/jaeger-client-go/blob/master/transport_udp.go#L37 diff --git a/exporters/jaeger/env.go b/exporters/jaeger/env.go index 94518980695..a7253e48311 100644 --- a/exporters/jaeger/env.go +++ b/exporters/jaeger/env.go @@ -18,13 +18,13 @@ import ( "os" ) -// Environment variable names +// Environment variable names. const ( // Hostname for the Jaeger agent, part of address where exporter sends spans - // i.e. "localhost" + // i.e. "localhost". envAgentHost = "OTEL_EXPORTER_JAEGER_AGENT_HOST" // Port for the Jaeger agent, part of address where exporter sends spans - // i.e. 6831 + // i.e. 6831. envAgentPort = "OTEL_EXPORTER_JAEGER_AGENT_PORT" // The HTTP endpoint for sending spans directly to a collector, // i.e. http://jaeger-collector:14268/api/traces. @@ -35,7 +35,7 @@ const ( envPassword = "OTEL_EXPORTER_JAEGER_PASSWORD" ) -// envOr returns an env variable's value if it is exists or the default if not +// envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { if v, ok := os.LookupEnv(key); ok && v != "" { return v diff --git a/exporters/jaeger/reconnecting_udp_client.go b/exporters/jaeger/reconnecting_udp_client.go index ae4bf87f586..fa2c68ead42 100644 --- a/exporters/jaeger/reconnecting_udp_client.go +++ b/exporters/jaeger/reconnecting_udp_client.go @@ -134,7 +134,7 @@ func (c *reconnectingUDPConn) attemptDialNewAddr(newAddr *net.UDPAddr) error { return nil } -// Write calls net.udpConn.Write, if it fails an attempt is made to connect to a new addr, if that succeeds the write is retried before returning +// Write calls net.udpConn.Write, if it fails an attempt is made to connect to a new addr, if that succeeds the write is retried before returning. func (c *reconnectingUDPConn) Write(b []byte) (int, error) { var bytesWritten int var err error @@ -167,7 +167,7 @@ func (c *reconnectingUDPConn) Write(b []byte) (int, error) { return bytesWritten, err } -// Close stops the reconnectLoop, then closes the connection via net.udpConn 's implementation +// Close stops the reconnectLoop, then closes the connection via net.udpConn 's implementation. func (c *reconnectingUDPConn) Close() error { close(c.closeChan) @@ -183,7 +183,7 @@ func (c *reconnectingUDPConn) Close() error { } // SetWriteBuffer defers to the net.udpConn SetWriteBuffer implementation wrapped with a RLock. if no conn is currently held -// and SetWriteBuffer is called store bufferBytes to be set for new conns +// and SetWriteBuffer is called store bufferBytes to be set for new conns. func (c *reconnectingUDPConn) SetWriteBuffer(bytes int) error { var err error diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index d907f74b9f3..c5cdb0040c0 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" ) -// batchUploader send a batch of spans to Jaeger +// batchUploader send a batch of spans to Jaeger. type batchUploader interface { upload(context.Context, *gen.Batch) error shutdown(context.Context) error diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go index b696338ec9a..67003c4a2fa 100644 --- a/exporters/otlp/internal/envconfig/envconfig.go +++ b/exporters/otlp/internal/envconfig/envconfig.go @@ -25,17 +25,17 @@ import ( "time" ) -// ConfigFn is the generic function used to set a config +// ConfigFn is the generic function used to set a config. type ConfigFn func(*EnvOptionsReader) -// EnvOptionsReader reads the required environment variables +// EnvOptionsReader reads the required environment variables. type EnvOptionsReader struct { GetEnv func(string) string ReadFile func(string) ([]byte, error) Namespace string } -// Apply runs every ConfigFn +// Apply runs every ConfigFn. func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { for _, o := range opts { o(e) @@ -50,7 +50,7 @@ func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { return v, v != "" } -// WithString retrieves the specified config and passes it to ConfigFn as a string +// WithString retrieves the specified config and passes it to ConfigFn as a string. func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -59,7 +59,7 @@ func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { } } -// WithDuration retrieves the specified config and passes it to ConfigFn as a duration +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -70,7 +70,7 @@ func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { } } -// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -79,7 +79,7 @@ func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) } } -// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { @@ -90,7 +90,7 @@ func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { } } -// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config +// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config. func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index 854b271d1fb..c3c514d5a6c 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -40,7 +40,7 @@ var ( // ErrIncompatibleAgg is returned when // aggregation.Kind implies an interface conversion that has - // failed + // failed. ErrIncompatibleAgg = errors.New("incompatible aggregation type") // ErrUnknownValueType is returned when a transformation of an unknown value diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index d59912ddb6e..36737c9c0e7 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -26,14 +26,14 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -// DefaultEnvOptionsReader is the default environments reader +// DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, ReadFile: ioutil.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } -// ApplyGRPCEnvConfigs applies the env configurations for gRPC +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. func ApplyGRPCEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -42,7 +42,7 @@ func ApplyGRPCEnvConfigs(cfg Config) Config { return cfg } -// ApplyHTTPEnvConfigs applies the env configurations for HTTP +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. func ApplyHTTPEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -104,7 +104,7 @@ func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { } } -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index c81e51e4fe9..694bb3c270a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -163,7 +163,7 @@ func TestNewExporterInvokeStartThenStopManyTimes(t *testing.T) { } } -// This test takes a long time to run: to skip it, run tests using: -short +// This test takes a long time to run: to skip it, run tests using: -short. func TestNewExporterCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go index 3eecfef39c0..96e5303320a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go @@ -139,7 +139,7 @@ func (mc *mockCollector) GetMetrics() []*metricpb.Metric { return mc.getMetrics() } -// runMockCollector is a helper function to create a mock Collector +// runMockCollector is a helper function to create a mock Collector. func runMockCollector(t *testing.T) *mockCollector { return runMockCollectorAtEndpoint(t, "localhost:0") } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index dab28ff8fb2..dcc57ceb05f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -98,7 +98,7 @@ func NewClient(opts ...Option) otlpmetric.Client { } } -// Start does nothing in a HTTP client +// Start does nothing in a HTTP client. func (d *client) Start(ctx context.Context) error { // nothing to do select { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 1ff8b1d5fc9..c2c56595985 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -26,14 +26,14 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" ) -// DefaultEnvOptionsReader is the default environments reader +// DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, ReadFile: ioutil.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } -// ApplyGRPCEnvConfigs applies the env configurations for gRPC +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. func ApplyGRPCEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -42,7 +42,7 @@ func ApplyGRPCEnvConfigs(cfg Config) Config { return cfg } -// ApplyHTTPEnvConfigs applies the env configurations for HTTP +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. func ApplyHTTPEnvConfigs(cfg Config) Config { opts := getOptionsFromEnv() for _, opt := range opts { @@ -113,7 +113,7 @@ func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { } } -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go index d4331e8749f..c2d6c036152 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go @@ -37,7 +37,7 @@ const ( GzipCompression ) -// Marshaler describes the kind of message format sent to the collector +// Marshaler describes the kind of message format sent to the collector. type Marshaler int const ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 9228001a78c..8f62e393c46 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -167,7 +167,7 @@ func TestNewInvokeStartThenStopManyTimes(t *testing.T) { } } -// This test takes a long time to run: to skip it, run tests using: -short +// This test takes a long time to run: to skip it, run tests using: -short. func TestNewCollectorOnBadConnection(t *testing.T) { if testing.Short() { t.Skipf("Skipping this long running test") diff --git a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go index 359202aed05..d3ebd8357c7 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go @@ -150,7 +150,7 @@ func (mc *mockCollector) getHeaders() metadata.MD { return mc.traceSvc.getHeaders() } -// runMockCollector is a helper function to create a mock Collector +// runMockCollector is a helper function to create a mock Collector. func runMockCollector(t *testing.T) *mockCollector { return runMockCollectorAtEndpoint(t, "localhost:0") } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 9a1428b444c..45b4b70f1ad 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -100,7 +100,7 @@ func NewClient(opts ...Option) otlptrace.Client { } } -// Start does nothing in a HTTP client +// Start does nothing in a HTTP client. func (d *client) Start(ctx context.Context) error { // nothing to do select { diff --git a/exporters/prometheus/sanitize.go b/exporters/prometheus/sanitize.go index cc9eff358cc..b5588435359 100644 --- a/exporters/prometheus/sanitize.go +++ b/exporters/prometheus/sanitize.go @@ -40,7 +40,7 @@ func sanitize(s string) string { return s } -// converts anything that is not a letter or digit to an underscore +// converts anything that is not a letter or digit to an underscore. func sanitizeRune(r rune) rune { if unicode.IsLetter(r) || unicode.IsDigit(r) { return r diff --git a/exporters/zipkin/env.go b/exporters/zipkin/env.go index 5c072ee67b5..7f1b60fa4f0 100644 --- a/exporters/zipkin/env.go +++ b/exporters/zipkin/env.go @@ -16,13 +16,13 @@ package zipkin // import "go.opentelemetry.io/otel/exporters/zipkin" import "os" -// Environment variable names +// Environment variable names. const ( - // Endpoint for Zipkin collector + // Endpoint for Zipkin collector. envEndpoint = "OTEL_EXPORTER_ZIPKIN_ENDPOINT" ) -// envOr returns an env variable's value if it is exists or the default if not +// envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { if v, ok := os.LookupEnv(key); ok && v != "" { return v diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index b32291d8852..e3a84ba6ac9 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -168,7 +168,7 @@ func attributesToJSONMapString(attributes []attribute.KeyValue) string { return (string)(jsonBytes) } -// attributeToStringPair serializes each attribute to a string pair +// attributeToStringPair serializes each attribute to a string pair. func attributeToStringPair(kv attribute.KeyValue) (string, string) { switch kv.Value.Type() { // For slice attributes, serialize as JSON list string. @@ -189,7 +189,7 @@ func attributeToStringPair(kv attribute.KeyValue) (string, string) { } } -// extraZipkinTags are those that may be added to every outgoing span +// extraZipkinTags are those that may be added to every outgoing span. var extraZipkinTags = []string{ "otel.status_code", keyInstrumentationLibraryName, diff --git a/handler.go b/handler.go index 35263e01ac2..b5797bceaa9 100644 --- a/handler.go +++ b/handler.go @@ -92,7 +92,7 @@ func SetErrorHandler(h ErrorHandler) { globalErrorHandler.setDelegate(h) } -// Handle is a convenience function for ErrorHandler().Handle(err) +// Handle is a convenience function for ErrorHandler().Handle(err). func Handle(err error) { GetErrorHandler().Handle(err) } diff --git a/internal/global/internal_logging.go b/internal/global/internal_logging.go index 0a378476b0f..ccb3258711a 100644 --- a/internal/global/internal_logging.go +++ b/internal/global/internal_logging.go @@ -33,7 +33,7 @@ var globalLoggerLock = &sync.RWMutex{} // SetLogger overrides the globalLogger with l. // // To see Info messages use a logger with `l.V(1).Enabled() == true` -// To see Debug messages use a logger with `l.V(5).Enabled() == true` +// To see Debug messages use a logger with `l.V(5).Enabled() == true`. func SetLogger(l logr.Logger) { globalLoggerLock.Lock() defer globalLoggerLock.Unlock() @@ -41,7 +41,7 @@ func SetLogger(l logr.Logger) { } // Info prints messages about the general state of the API or SDK. -// This should usually be less then 5 messages a minute +// This should usually be less then 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { globalLoggerLock.RLock() defer globalLoggerLock.RUnlock() diff --git a/internal/global/util_test.go b/internal/global/util_test.go index b066a74a20e..d0bca92f6c6 100644 --- a/internal/global/util_test.go +++ b/internal/global/util_test.go @@ -20,7 +20,7 @@ import ( ) // ResetForTest configures the test to restores the initial global state during -// its Cleanup step +// its Cleanup step. func ResetForTest(t testing.TB) { t.Cleanup(func() { globalTracer = defaultTracerValue() diff --git a/metric/example_test.go b/metric/example_test.go index 92e0e2cd958..ed5c80e208a 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -110,7 +110,7 @@ func ExampleMeter_asynchronous_multiple() { } } -//This is just an example, see the the contrib runtime instrumentation for real implementation +//This is just an example, see the the contrib runtime instrumentation for real implementation. func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) { } diff --git a/metric/global/global.go b/metric/global/global.go index 25071bb88ed..05a67c2e999 100644 --- a/metric/global/global.go +++ b/metric/global/global.go @@ -25,7 +25,7 @@ import ( // that code provides built-in instrumentation. If the instrumentationName is // empty, then a implementation defined default name will be used instead. // -// This is short for MeterProvider().Meter(name) +// This is short for MeterProvider().Meter(name). func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { return MeterProvider().Meter(instrumentationName, opts...) } diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index c98dfdf7c99..605771d105f 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -226,7 +226,7 @@ func (i *aiGauge) unwrap() instrument.Asynchronous { return nil } -//Sync Instruments +//Sync Instruments. type sfCounter struct { name string opts []instrument.Option diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 1acac5c20cc..0fa924f397c 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -201,7 +201,7 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async return out } -// SyncInt64 is the namespace for the Synchronous Integer instruments +// SyncInt64 is the namespace for the Synchronous Integer instruments. func (m *meter) SyncInt64() syncint64.InstrumentProvider { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.SyncInt64() @@ -209,7 +209,7 @@ func (m *meter) SyncInt64() syncint64.InstrumentProvider { return (*siInstProvider)(m) } -// SyncFloat64 is the namespace for the Synchronous Float instruments +// SyncFloat64 is the namespace for the Synchronous Float instruments. func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.SyncFloat64() diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index acd07de1847..ac6e93ebe38 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -69,19 +69,19 @@ func (m *testMeter) RegisterCallback(insts []instrument.Asynchronous, function f return nil } -// SyncInt64 is the namespace for the Synchronous Integer instruments +// SyncInt64 is the namespace for the Synchronous Integer instruments. func (m *testMeter) SyncInt64() syncint64.InstrumentProvider { m.siCount++ return &testSIInstrumentProvider{} } -// SyncFloat64 is the namespace for the Synchronous Float instruments +// SyncFloat64 is the namespace for the Synchronous Float instruments. func (m *testMeter) SyncFloat64() syncfloat64.InstrumentProvider { m.sfCount++ return &testSFInstrumentProvider{} } -// This enables async collection +// This enables async collection. func (m *testMeter) collect() { ctx := context.Background() for _, f := range m.callbacks { diff --git a/schema/v1.0/types/types.go b/schema/v1.0/types/types.go index 8d7e0583c1f..02caa4485a1 100644 --- a/schema/v1.0/types/types.go +++ b/schema/v1.0/types/types.go @@ -14,7 +14,7 @@ package types // import "go.opentelemetry.io/otel/schema/v1.0/types" -// TelemetryVersion is a version number key in the schema file (e.g. "1.7.0") +// TelemetryVersion is a version number key in the schema file (e.g. "1.7.0"). type TelemetryVersion string // SpanName is span name string. diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index 1a03bf7af49..5e94b8ae521 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -21,56 +21,47 @@ import ( "go.opentelemetry.io/otel/internal/global" ) -// Environment variable names +// Environment variable names. const ( - // BatchSpanProcessorScheduleDelayKey - // Delay interval between two consecutive exports. - // i.e. 5000 + // BatchSpanProcessorScheduleDelayKey is the delay interval between two + // consecutive exports (i.e. 5000). BatchSpanProcessorScheduleDelayKey = "OTEL_BSP_SCHEDULE_DELAY" - // BatchSpanProcessorExportTimeoutKey - // Maximum allowed time to export data. - // i.e. 3000 + // BatchSpanProcessorExportTimeoutKey is the maximum allowed time to + // export data (i.e. 3000). BatchSpanProcessorExportTimeoutKey = "OTEL_BSP_EXPORT_TIMEOUT" - // BatchSpanProcessorMaxQueueSizeKey - // Maximum queue size - // i.e. 2048 + // BatchSpanProcessorMaxQueueSizeKey is the maximum queue size (i.e. 2048). BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE" - // BatchSpanProcessorMaxExportBatchSizeKey - // Maximum batch size - // Note: Must be less than or equal to EnvBatchSpanProcessorMaxQueueSize - // i.e. 512 + // BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e. + // 512). Note: it must be less than or equal to + // EnvBatchSpanProcessorMaxQueueSize. BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE" - // AttributeValueLengthKey - // Maximum allowed attribute value size. + // AttributeValueLengthKey is the maximum allowed attribute value size. AttributeValueLengthKey = "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT" - // AttributeCountKey - // Maximum allowed span attribute count + // AttributeCountKey is the maximum allowed span attribute count. AttributeCountKey = "OTEL_ATTRIBUTE_COUNT_LIMIT" - // SpanAttributeValueLengthKey - // Maximum allowed attribute value size for a span. + // SpanAttributeValueLengthKey is the maximum allowed attribute value size + // for a span. SpanAttributeValueLengthKey = "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT" - // SpanAttributeCountKey - // Maximum allowed span attribute count for a span. + // SpanAttributeCountKey is the maximum allowed span attribute count for a + // span. SpanAttributeCountKey = "OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT" - // SpanEventCountKey - // Maximum allowed span event count. + // SpanEventCountKey is the maximum allowed span event count. SpanEventCountKey = "OTEL_SPAN_EVENT_COUNT_LIMIT" - // SpanEventAttributeCountKey - // Maximum allowed attribute per span event count. + // SpanEventAttributeCountKey is the maximum allowed attribute per span + // event count. SpanEventAttributeCountKey = "OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT" - // SpanLinkCountKey - // Maximum allowed span link count. + // SpanLinkCountKey is the maximum allowed span link count. SpanLinkCountKey = "OTEL_SPAN_LINK_COUNT_LIMIT" - // SpanLinkAttributeCountKey - // Maximum allowed attribute per span link count. + // SpanLinkAttributeCountKey is the maximum allowed attribute per span + // link count. SpanLinkAttributeCountKey = "OTEL_LINK_ATTRIBUTE_COUNT_LIMIT" ) diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go index 6deb81192de..41fd45025ba 100644 --- a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go +++ b/sdk/metric/aggregator/exponential/mapping/exponent/float64.go @@ -29,11 +29,11 @@ const ( SignificandMask = 1< Date: Wed, 27 Apr 2022 01:48:30 +0800 Subject: [PATCH 166/886] Fix a bug in example/fib/app.go line:69 (#2860) * modify the Fscanf function param in example/fib/app.go line:69 to avoid process break by "unexpected newline" * Add pull reqesut ID into CHANGELOG.md * append "\n" to the string param of Fscanf() in getting-started.md * delete a line in CHANGELOG.md. Co-authored-by: Tyler Yahn --- example/fib/app.go | 2 +- website_docs/getting-started.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/fib/app.go b/example/fib/app.go index 907779e613a..a92074258fb 100644 --- a/example/fib/app.go +++ b/example/fib/app.go @@ -66,7 +66,7 @@ func (a *App) Poll(ctx context.Context) (uint, error) { a.l.Print("What Fibonacci number would you like to know: ") var n uint - _, err := fmt.Fscanf(a.r, "%d", &n) + _, err := fmt.Fscanf(a.r, "%d\n", &n) if err != nil { span.RecordError(err) span.SetStatus(codes.Error, err.Error()) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 4262cd6ff83..5fdf2418187 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -214,7 +214,7 @@ func (a *App) Poll(ctx context.Context) (uint, error) { a.l.Print("What Fibonacci number would you like to know: ") var n uint - _, err := fmt.Fscanf(a.r, "%d", &n) + _, err := fmt.Fscanf(a.r, "%d\n", &n) // Store n as a string to not overflow an int64. nStr := strconv.FormatUint(uint64(n), 10) @@ -458,7 +458,7 @@ func (a *App) Poll(ctx context.Context) (uint, error) { a.l.Print("What Fibonacci number would you like to know: ") var n uint - _, err := fmt.Fscanf(a.r, "%d", &n) + _, err := fmt.Fscanf(a.r, "%d\n", &n) if err != nil { span.RecordError(err) span.SetStatus(codes.Error, err.Error()) From 776accd250719e5e7bb44025b32e62d8933e504e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 27 Apr 2022 11:38:54 -0700 Subject: [PATCH 167/886] Remove unneeded metrictest types (#2864) * Remove unneeded metrictest types * Add changes to changelog * Revert removal of NewDescriptor --- CHANGELOG.md | 5 +++ sdk/metric/metrictest/alignment_test.go | 42 ------------------- sdk/metric/metrictest/exporter.go | 17 ++++++++ sdk/metric/metrictest/meter.go | 56 ------------------------- 4 files changed, 22 insertions(+), 98 deletions(-) delete mode 100644 sdk/metric/metrictest/alignment_test.go delete mode 100644 sdk/metric/metrictest/meter.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 16f3f0d0f37..444429393c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `MergeIterator.Label` method in the `go.opentelemetry.io/otel/attribute` package is deprecated. Use the equivalent `MergeIterator.Attribute` method instead. (#2790) +### Removed + +- Removed the `Batch` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) +- Removed the `Measurement` type from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package. (#2864) + ## [0.29.0] - 2022-04-11 ### Added diff --git a/sdk/metric/metrictest/alignment_test.go b/sdk/metric/metrictest/alignment_test.go deleted file mode 100644 index 183d46bda82..00000000000 --- a/sdk/metric/metrictest/alignment_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest - -import ( - "os" - "testing" - "unsafe" - - "go.opentelemetry.io/otel/internal/internaltest" -) - -// TestMain ensures struct alignment prior to running tests. -func TestMain(m *testing.M) { - fields := []internaltest.FieldOffset{ - { - Name: "Batch.Measurments", - Offset: unsafe.Offsetof(Batch{}.Measurements), - }, - { - Name: "Measurement.Number", - Offset: unsafe.Offsetof(Measurement{}.Number), - }, - } - if !internaltest.Aligned8Byte(fields, os.Stderr) { - os.Exit(1) - } - - os.Exit(m.Run()) -} diff --git a/sdk/metric/metrictest/exporter.go b/sdk/metric/metrictest/exporter.go index e57c8664c7d..e767702019a 100644 --- a/sdk/metric/metrictest/exporter.go +++ b/sdk/metric/metrictest/exporter.go @@ -20,12 +20,14 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/number" processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" + "go.opentelemetry.io/otel/sdk/metric/sdkapi" selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" ) @@ -62,6 +64,14 @@ func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) { return c, exp } +// Library is the same as "sdk/instrumentation".Library but there is +// a package cycle to use it so it is redeclared here. +type Library struct { + InstrumentationName string + InstrumentationVersion string + SchemaURL string +} + // ExportRecord represents one collected datapoint from the Exporter. type ExportRecord struct { InstrumentName string @@ -178,3 +188,10 @@ func subSet(attributesA, attributesB []attribute.KeyValue) bool { } return true } + +// NewDescriptor is a test helper for constructing test metric +// descriptors using standard options. +func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor { + cfg := instrument.NewConfig(opts...) + return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()) +} diff --git a/sdk/metric/metrictest/meter.go b/sdk/metric/metrictest/meter.go deleted file mode 100644 index fa1c6a325a4..00000000000 --- a/sdk/metric/metrictest/meter.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - - // Library is the same as "sdk/instrumentation".Library but there is - // a package cycle to use it. - Library struct { - InstrumentationName string - InstrumentationVersion string - SchemaURL string - } - - Batch struct { - // Measurement needs to be aligned for 64-bit atomic operations. - Measurements []Measurement - Ctx context.Context - Attributes []attribute.KeyValue - Library Library - } - - Measurement struct { - // Number needs to be aligned for 64-bit atomic operations. - Number number.Number - Instrument sdkapi.InstrumentImpl - } -) - -// NewDescriptor is a test helper for constructing test metric -// descriptors using standard options. -func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor { - cfg := instrument.NewConfig(opts...) - return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()) -} From a50cf6aadd582f9760c578e2c4b5230b6c30913d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 28 Apr 2022 08:51:40 -0700 Subject: [PATCH 168/886] Release v1.7.0 (#2869) * Bump versions * Prepare stable-v1 for version v1.7.0 * Prepare experimental-metrics for version v0.30.0 * Prepare bridge for version v0.30.0 * Update changelog --- CHANGELOG.md | 11 ++++++----- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 8 ++++---- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 6 +++--- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 12 ++++++------ example/otel-collector/go.mod | 8 ++++---- example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 8 ++++---- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 8 ++++---- exporters/stdout/stdoutmetric/go.mod | 8 ++++---- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 2 +- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 6 +++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 6 +++--- 30 files changed, 106 insertions(+), 105 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 444429393c7..1bdedced0fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.7.0/0.30.0] - 2022-04-28 + ### Added - Add the `go.opentelemetry.io/otel/semconv/v1.8.0` package. @@ -20,14 +22,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed -- Delegated instruments are unwrapped before delegating Callbacks. (#2784) -- Resolve supply-chain failure for the markdown-link-checker GitHub action by calling the CLI directly. (#2834) -- Remove import of `testing` package in non-tests builds. (#2786) +- Globally delegated instruments are unwrapped before delegating asynchronous callbacks. (#2784) +- Remove import of `testing` package in non-tests builds of the `go.opentelemetry.io/otel` package. (#2786) ### Changed - The `WithLabelEncoder` option from the `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` package is renamed to `WithAttributeEncoder`. (#2790) -- The `Batch.Labels` field from the `go.opentelemetry.io/otel/sdk/metric/metrictest` package is renamed to `Batch.Attributes`. (#2790) - The `LabelFilterSelector` interface from `go.opentelemetry.io/otel/sdk/metric/processor/reducer` is renamed to `AttributeFilterSelector`. The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) - The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. @@ -1852,7 +1852,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/metric/v0.29.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.7.0...HEAD +[1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 [0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 [1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 [1.6.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.2 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 468ec0fb503..8acc612e542 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 2780a4ddb21..7ac137e1291 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/bridge/opencensus v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/bridge/opencensus v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 5d669f351c4..58504ffe18d 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,8 +6,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus diff --git a/example/fib/go.mod b/example/fib/go.mod index a4418942414..579478f06b5 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.16 require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 7f4bfc853ae..a3aa6e7a2c9 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/jaeger v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/jaeger v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 2759dc8fb80..2e7fbe73c1a 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 9ae6e9d54bb..d595ae6a99b 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,12 +10,12 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/bridge/opencensus v0.29.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.29.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/bridge/opencensus v0.30.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.30.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 ) replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d1d13628dd7..3c6f108a3dd 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 google.golang.org/grpc v1.46.0 ) diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 266846853bc..09df93d9fd3 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.16 require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 80b68b0351d..0a4d2c1236c 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/prometheus v0.29.0 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/prometheus v0.30.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index bee194c5a8c..d11b2597ea5 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/zipkin v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/zipkin v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 724a3a07816..4f43d3dee94 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 71c1a59480c..14df2170083 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d26194c2489..9cb6acc30db 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,12 +4,12 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.29.0 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.30.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 5a5daa5aaf1..7515cc11d9a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 5501c87ca07..d4914ea0b93 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/grpc v1.46.0 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 129b7e830a1..2a760b0320f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/proto/otlp v0.16.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 60091c2507a..a49ca02e574 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.3 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 4db0f072a95..bdd037be053 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/prometheus/client_golang v1.12.1 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 ) replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 82efdb5dea7..3902d39bc3a 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/sdk/metric v0.29.0 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/sdk/metric v0.30.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 8a960973ac4..586949a1157 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 9522e3bb11d..ed86a58d189 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.7 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/sdk v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus diff --git a/go.mod b/go.mod index 34e9276f6fa..cb026c095e3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel/trace v1.7.0 ) replace go.opentelemetry.io/otel => ./ diff --git a/metric/go.mod b/metric/go.mod index cbc5cf20905..02e82e3601f 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel v1.7.0 ) replace go.opentelemetry.io/otel => ../ diff --git a/sdk/go.mod b/sdk/go.mod index b839715678c..00e876eead3 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/trace v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/trace v1.7.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 14031ee16d6..f81c840dfc0 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -41,9 +41,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 - go.opentelemetry.io/otel/metric v0.29.0 - go.opentelemetry.io/otel/sdk v1.6.3 + go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel/metric v0.30.0 + go.opentelemetry.io/otel/sdk v1.7.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough diff --git a/trace/go.mod b/trace/go.mod index 2c8851bb0d1..7496b0f2dac 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -41,7 +41,7 @@ replace go.opentelemetry.io/otel/trace => ./ require ( github.com/google/go-cmp v0.5.7 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.6.3 + go.opentelemetry.io/otel v1.7.0 ) replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough diff --git a/version.go b/version.go index e36a226325a..da940c6323f 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.6.3" + return "1.7.0" } diff --git a/versions.yaml b/versions.yaml index 286c8c077b9..b992d0fb06d 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.6.3 + version: v1.7.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.29.0 + version: v0.30.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -49,7 +49,7 @@ module-sets: modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.29.0 + version: v0.30.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From a14ecc7a570fe398838175a4c397608dfe254787 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 28 Apr 2022 12:11:17 -0700 Subject: [PATCH 169/886] Remove unnecessary internal package for noop instances (#2867) Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- bridge/opentracing/bridge.go | 13 ++++++++++--- internal/trace/noop/noop.go | 35 ----------------------------------- trace_test.go | 3 +-- 3 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 internal/trace/noop/noop.go diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 8483dbdeca0..6b0e102e331 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -31,11 +31,18 @@ import ( "go.opentelemetry.io/otel/bridge/opentracing/migration" "go.opentelemetry.io/otel/codes" iBaggage "go.opentelemetry.io/otel/internal/baggage" - "go.opentelemetry.io/otel/internal/trace/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) +var ( + noopTracer = trace.NewNoopTracerProvider().Tracer("") + noopSpan = func() trace.Span { + _, s := noopTracer.Start(context.Background(), "") + return s + }() +) + type bridgeSpanContext struct { bag baggage.Baggage otelSpanContext trace.SpanContext @@ -321,7 +328,7 @@ var _ ot.TracerContextWithSpanExtension = &BridgeTracer{} func NewBridgeTracer() *BridgeTracer { return &BridgeTracer{ setTracer: bridgeSetTracer{ - otelTracer: noop.Tracer, + otelTracer: noopTracer, }, warningHandler: func(msg string) {}, propagator: nil, @@ -641,7 +648,7 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int } header := http.Header(hhcarrier) fs := fakeSpan{ - Span: noop.Span, + Span: noopSpan, sc: bridgeSC.otelSpanContext, } ctx := trace.ContextWithSpan(context.Background(), fs) diff --git a/internal/trace/noop/noop.go b/internal/trace/noop/noop.go deleted file mode 100644 index f8f3c49f0bc..00000000000 --- a/internal/trace/noop/noop.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package noop provides noop tracing implementations for tracer and span. -package noop // import "go.opentelemetry.io/otel/internal/trace/noop" - -import ( - "context" - - "go.opentelemetry.io/otel/trace" -) - -var ( - // Tracer is a noop tracer that starts noop spans. - Tracer trace.Tracer - - // Span is a noop Span. - Span trace.Span -) - -func init() { - Tracer = trace.NewNoopTracerProvider().Tracer("") - _, Span = Tracer.Start(context.Background(), "") -} diff --git a/trace_test.go b/trace_test.go index e85488e348d..48d245b4116 100644 --- a/trace_test.go +++ b/trace_test.go @@ -19,7 +19,6 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/internal/trace/noop" "go.opentelemetry.io/otel/trace" ) @@ -28,7 +27,7 @@ type testTracerProvider struct{} var _ trace.TracerProvider = &testTracerProvider{} func (*testTracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace.Tracer { - return noop.Tracer + return trace.NewNoopTracerProvider().Tracer("") } func TestMultipleGlobalTracerProvider(t *testing.T) { From a9a519277a178181341d2420cb3e81bc0c8de4a7 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Thu, 28 Apr 2022 12:52:10 -0700 Subject: [PATCH 170/886] Move metric no-op implementation to metric package (#2866) * Move metric no-op implementation to metric package This is to be consistent with trace package. Fixes: https://github.com/open-telemetry/opentelemetry-go/issues/2767 Signed-off-by: Bogdan Drutu * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update metric/noop.go Co-authored-by: Chester Cheung * Update noop.go Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + metric/example_test.go | 8 +- metric/internal/global/instruments_test.go | 5 +- metric/internal/global/meter_test.go | 5 +- metric/internal/global/state_test.go | 5 +- metric/nonrecording/meter.go | 64 ---------- .../{nonrecording/instruments.go => noop.go} | 69 +++++++++-- metric/noop_test.go | 116 ++++++++++++++++++ sdk/metric/correct_test.go | 3 +- 9 files changed, 184 insertions(+), 92 deletions(-) delete mode 100644 metric/nonrecording/meter.go rename metric/{nonrecording/instruments.go => noop.go} (53%) create mode 100644 metric/noop_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bdedced0fc..b64a142286d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) - The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) +- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) ### Deprecated diff --git a/metric/example_test.go b/metric/example_test.go index ed5c80e208a..9c18b9a6890 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -20,16 +20,16 @@ import ( "runtime" "time" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/nonrecording" "go.opentelemetry.io/otel/metric/unit" ) //nolint:govet // Meter doesn't register for go vet func ExampleMeter_synchronous() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := nonrecording.NewNoopMeterProvider() + meterProvider := metric.NewNoopMeterProvider() workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").SyncInt64().Histogram( "workDuration", @@ -50,7 +50,7 @@ func ExampleMeter_synchronous() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_single() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := nonrecording.NewNoopMeterProvider() + meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") memoryUsage, err := meter.AsyncInt64().Gauge( @@ -79,7 +79,7 @@ func ExampleMeter_asynchronous_single() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_multiple() { - meterProvider := nonrecording.NewNoopMeterProvider() + meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats diff --git a/metric/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go index 33c88f6b6f1..24c5eb4322e 100644 --- a/metric/internal/global/instruments_test.go +++ b/metric/internal/global/instruments_test.go @@ -21,7 +21,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/nonrecording" ) func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { @@ -37,7 +36,7 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal } }() - setDelegate(nonrecording.NewNoopMeter()) + setDelegate(metric.NewNoopMeter()) close(finish) } @@ -54,7 +53,7 @@ func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), } }() - setDelegate(nonrecording.NewNoopMeter()) + setDelegate(metric.NewNoopMeter()) close(finish) } diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 481c55e2273..447db967d84 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/nonrecording" ) func TestMeterProviderRace(t *testing.T) { @@ -44,7 +43,7 @@ func TestMeterProviderRace(t *testing.T) { } }() - mp.setDelegate(nonrecording.NewNoopMeterProvider()) + mp.setDelegate(metric.NewNoopMeterProvider()) close(finish) } @@ -84,7 +83,7 @@ func TestMeterRace(t *testing.T) { }() wg.Wait() - mtr.setDelegate(nonrecording.NewNoopMeterProvider()) + mtr.setDelegate(metric.NewNoopMeterProvider()) close(finish) } diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go index 28b9ea1645a..0ef1f80f3a4 100644 --- a/metric/internal/global/state_test.go +++ b/metric/internal/global/state_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/nonrecording" ) func resetGlobalMeterProvider() { @@ -55,7 +54,7 @@ func TestSetMeterProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { resetGlobalMeterProvider() - SetMeterProvider(nonrecording.NewNoopMeterProvider()) + SetMeterProvider(metric.NewNoopMeterProvider()) _, ok := MeterProvider().(*meterProvider) if ok { @@ -68,7 +67,7 @@ func TestSetMeterProvider(t *testing.T) { mp := MeterProvider() - SetMeterProvider(nonrecording.NewNoopMeterProvider()) + SetMeterProvider(metric.NewNoopMeterProvider()) dmp := mp.(*meterProvider) diff --git a/metric/nonrecording/meter.go b/metric/nonrecording/meter.go deleted file mode 100644 index 2acea49d8a1..00000000000 --- a/metric/nonrecording/meter.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package nonrecording // import "go.opentelemetry.io/otel/metric/nonrecording" - -import ( - "context" - - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" -) - -// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. -func NewNoopMeterProvider() metric.MeterProvider { - return noopMeterProvider{} -} - -type noopMeterProvider struct{} - -var _ metric.MeterProvider = noopMeterProvider{} - -func (noopMeterProvider) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - return noopMeter{} -} - -// NewNoopMeter creates a Meter that does not record any metrics. -func NewNoopMeter() metric.Meter { - return noopMeter{} -} - -type noopMeter struct{} - -var _ metric.Meter = noopMeter{} - -func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { - return nonrecordingAsyncInt64Instrument{} -} -func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return nonrecordingAsyncFloat64Instrument{} -} -func (noopMeter) SyncInt64() syncint64.InstrumentProvider { - return nonrecordingSyncInt64Instrument{} -} -func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { - return nonrecordingSyncFloat64Instrument{} -} -func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error { - return nil -} diff --git a/metric/nonrecording/instruments.go b/metric/noop.go similarity index 53% rename from metric/nonrecording/instruments.go rename to metric/noop.go index 84a6aa89c31..622c99ace94 100644 --- a/metric/nonrecording/instruments.go +++ b/metric/noop.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package nonrecording // import "go.opentelemetry.io/otel/metric/nonrecording" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" @@ -25,6 +25,49 @@ import ( "go.opentelemetry.io/otel/metric/instrument/syncint64" ) +// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. +func NewNoopMeterProvider() MeterProvider { + return noopMeterProvider{} +} + +type noopMeterProvider struct{} + +func (noopMeterProvider) Meter(string, ...MeterOption) Meter { + return noopMeter{} +} + +// NewNoopMeter creates a Meter that does not record any metrics. +func NewNoopMeter() Meter { + return noopMeter{} +} + +type noopMeter struct{} + +// AsyncInt64 creates a instrument that does not record any metrics. +func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { + return nonrecordingAsyncInt64Instrument{} +} + +// AsyncFloat64 creates a instrument that does not record any metrics. +func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { + return nonrecordingAsyncFloat64Instrument{} +} + +// SyncInt64 creates a instrument that does not record any metrics. +func (noopMeter) SyncInt64() syncint64.InstrumentProvider { + return nonrecordingSyncInt64Instrument{} +} + +// SyncFloat64 creates a instrument that does not record any metrics. +func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { + return nonrecordingSyncFloat64Instrument{} +} + +// RegisterCallback creates a register callback that does not record any metrics. +func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error { + return nil +} + type nonrecordingAsyncFloat64Instrument struct { instrument.Asynchronous } @@ -36,15 +79,15 @@ var ( _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} ) -func (n nonrecordingAsyncFloat64Instrument) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { +func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Option) (asyncfloat64.Counter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { +func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { +func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) { return n, nil } @@ -63,15 +106,15 @@ var ( _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} ) -func (n nonrecordingAsyncInt64Instrument) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { +func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Option) (asyncint64.Counter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { +func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { +func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Option) (asyncint64.Gauge, error) { return n, nil } @@ -89,15 +132,15 @@ var ( _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} ) -func (n nonrecordingSyncFloat64Instrument) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { +func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { +func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { +func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) { return n, nil } @@ -120,15 +163,15 @@ var ( _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} ) -func (n nonrecordingSyncInt64Instrument) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { +func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Option) (syncint64.Counter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { +func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { +func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { return n, nil } diff --git a/metric/noop_test.go b/metric/noop_test.go new file mode 100644 index 00000000000..4603cfce57b --- /dev/null +++ b/metric/noop_test.go @@ -0,0 +1,116 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" +) + +func TestNewNoopMeterProvider(t *testing.T) { + mp := NewNoopMeterProvider() + assert.Equal(t, mp, noopMeterProvider{}) + meter := mp.Meter("") + assert.Equal(t, meter, noopMeter{}) +} + +func TestSyncFloat64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.SyncFloat64().Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.SyncFloat64().UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.SyncFloat64().Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1.0, attribute.String("key", "value")) + }) +} + +func TestSyncInt64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.SyncInt64().Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.SyncInt64().UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.SyncInt64().Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1, attribute.String("key", "value")) + }) +} + +func TestAsyncFloat64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.AsyncFloat64().Counter("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.AsyncFloat64().UpDownCounter("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), -1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.AsyncFloat64().Gauge("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) + }) +} + +func TestAsyncInt64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.AsyncInt64().Counter("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), 1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.AsyncInt64().UpDownCounter("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), -1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.AsyncInt64().Gauge("test instrument") + require.NoError(t, err) + inst.Observe(context.Background(), 1, attribute.String("key", "value")) + }) +} diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index 3d18fc06655..4d63ccdc3f7 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/nonrecording" metricsdk "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregator" "go.opentelemetry.io/otel/sdk/metric/export" @@ -532,7 +531,7 @@ func TestIncorrectInstruments(t *testing.T) { require.Equal(t, 0, collected) // Now try with instruments from another SDK. - noopMeter := nonrecording.NewNoopMeter() + noopMeter := metric.NewNoopMeter() observer, _ = noopMeter.AsyncInt64().Gauge("observer") err = meter.RegisterCallback( From 28aecfcf2562f2ceb997a3c8cbeeeb18ee0a69d7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 29 Apr 2022 08:22:10 -0700 Subject: [PATCH 171/886] Fix license header check (#2870) Do not look in the .git directory. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a9a3ef01610..8cd7eea76b3 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,7 @@ misspell: | $(MISSPELL) .PHONY: license-check license-check: - @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*') ; do \ + @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \ done); \ if [ -n "$${licRes}" ]; then \ From 789a433311aac5375e3ac5de2b1d088ebe287709 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 May 2022 07:50:59 -0700 Subject: [PATCH 172/886] Bump github/codeql-action from 1 to 2 (#2876) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v1...v2) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 521063ac4b5..72ab609eb45 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,13 +24,13 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 From c7cf945d8eb3e4a0f60c56bd3bb02bba61a393e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 May 2022 08:19:09 -0700 Subject: [PATCH 173/886] Bump github.com/google/go-cmp from 0.5.7 to 0.5.8 (#2875) * Bump github.com/google/go-cmp from 0.5.7 to 0.5.8 Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.5.7 to 0.5.8. - [Release notes](https://github.com/google/go-cmp/releases) - [Commits](https://github.com/google/go-cmp/compare/v0.5.7...v0.5.8) --- updated-dependencies: - dependency-name: github.com/google/go-cmp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules * go mod tidy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias Co-authored-by: Tyler Yahn --- bridge/opencensus/go.sum | 5 ++--- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/go.sum | 5 ++--- example/fib/go.sum | 5 ++--- example/jaeger/go.sum | 5 ++--- example/namedtracer/go.sum | 5 ++--- example/opencensus/go.sum | 6 ++---- example/otel-collector/go.sum | 5 ++--- example/passthrough/go.sum | 5 ++--- example/prometheus/go.sum | 5 ++--- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 6 ++---- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 5 ++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 5 ++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 5 ++--- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 5 ++--- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 5 ++--- exporters/otlp/otlptrace/otlptracehttp/go.sum | 5 ++--- exporters/prometheus/go.sum | 5 ++--- exporters/stdout/stdoutmetric/go.sum | 5 ++--- exporters/stdout/stdouttrace/go.sum | 5 ++--- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 5 ++--- go.mod | 2 +- go.sum | 6 ++---- metric/go.sum | 5 ++--- sdk/go.mod | 2 +- sdk/go.sum | 6 ++---- sdk/metric/go.sum | 5 ++--- trace/go.mod | 2 +- trace/go.sum | 6 ++---- 34 files changed, 61 insertions(+), 91 deletions(-) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index a123b0ac005..7c7b5a977f6 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -17,8 +17,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -52,7 +52,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index fcb0c9af429..92cc1105e60 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -37,8 +37,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 42b3e118d70..5ec9e745497 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -15,7 +15,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/fib/go.sum b/example/fib/go.sum index 3a091225429..3bc5db07919 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -14,7 +14,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 3ecfae9ef6d..d739c043586 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= @@ -15,7 +15,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 3a091225429..3bc5db07919 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -14,7 +14,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 435e0b939e7..7c7b5a977f6 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -17,8 +17,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -52,8 +52,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index b1ca690614e..f32e3e82287 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -112,8 +112,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -333,7 +333,6 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 3a091225429..3bc5db07919 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -14,7 +14,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 039a63a4b81..8a58d449e01 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -115,8 +115,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -375,7 +375,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index fc8c693a77b..169935452f1 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -58,8 +58,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 4f43d3dee94..ffacb71f606 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/jaeger go 1.16 require ( - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/sdk v1.7.0 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 58eb3804ae5..3b6e32a4a50 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= @@ -15,8 +15,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 14df2170083..bf5598dfb88 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric go 1.16 require ( - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 3c682483a62..92464dd801a 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -114,8 +114,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -331,7 +331,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 3c682483a62..92464dd801a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -114,8 +114,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -331,7 +331,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 3c682483a62..92464dd801a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -114,8 +114,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -331,7 +331,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index d4914ea0b93..4b78fd4bbe1 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.16 require ( - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 993767449f8..0cd487711bd 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -112,8 +112,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -329,7 +329,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 030086b6046..2b8ba71d081 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -112,8 +112,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -337,7 +337,6 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 993767449f8..0cd487711bd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -112,8 +112,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -329,7 +329,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 43be0c26beb..127d9082de7 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -115,8 +115,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -377,7 +377,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 9ab648da527..48e5a987067 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -7,8 +7,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -16,7 +16,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index f9af6c5ae9d..ac3360c6fee 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -14,7 +14,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index ed86a58d189..0a2de40baf9 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.16 require ( - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index f578de1840a..c4da081fc22 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -58,8 +58,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= @@ -179,7 +179,6 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/go.mod b/go.mod index cb026c095e3..be9574814c4 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/trace v1.7.0 ) diff --git a/go.sum b/go.sum index 301997e9530..f6a0b224951 100644 --- a/go.sum +++ b/go.sum @@ -5,15 +5,13 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/metric/go.sum b/metric/go.sum index f2ec9b9fab0..f6a0b224951 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -5,14 +5,13 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/go.mod b/sdk/go.mod index 00e876eead3..99d1ddc815b 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.3 - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 diff --git a/sdk/go.sum b/sdk/go.sum index 46b2d5b84b6..ac3360c6fee 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -14,8 +14,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 9ab648da527..48e5a987067 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -7,8 +7,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -16,7 +16,6 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/trace/go.mod b/trace/go.mod index 7496b0f2dac..33c7efa1de5 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -39,7 +39,7 @@ replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric replace go.opentelemetry.io/otel/trace => ./ require ( - github.com/google/go-cmp v0.5.7 + github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 ) diff --git a/trace/go.sum b/trace/go.sum index 9b66702ac6a..16e48e5a87a 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -3,15 +3,13 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= From b51c22123a5b8d708f4d82f3c50ffe2ab483130c Mon Sep 17 00:00:00 2001 From: bryan-aguilar <46550959+bryan-aguilar@users.noreply.github.com> Date: Fri, 6 May 2022 07:40:59 -0700 Subject: [PATCH 174/886] Integrate go-build-tools crosslink (#2886) * Add crosslink build tool to makefile * Execute crosslink prune * Remove internal crosslink tool * Add go-build-tools crosslink * Fix crosslink target * Execute make crosslink to clean up go.mod files * Update CHANGELOG * Misc go.sum update from make precommit * Update CHANGELOG PR number * Update crosslink target to include prune --- CHANGELOG.md | 4 + Makefile | 6 +- bridge/opencensus/go.mod | 54 ------------ bridge/opencensus/test/go.mod | 52 ----------- bridge/opentracing/go.mod | 60 ------------- example/fib/go.mod | 56 ------------ example/jaeger/go.mod | 56 ------------ example/namedtracer/go.mod | 56 ------------ example/opencensus/go.mod | 48 ---------- example/otel-collector/go.mod | 52 ----------- example/passthrough/go.mod | 58 ------------ example/prometheus/go.mod | 52 ----------- example/zipkin/go.mod | 56 ------------ exporters/jaeger/go.mod | 58 ------------ exporters/otlp/internal/retry/go.mod | 64 -------------- exporters/otlp/otlpmetric/go.mod | 52 ----------- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 50 ----------- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 50 ----------- exporters/otlp/otlptrace/go.mod | 56 ------------ exporters/otlp/otlptrace/otlptracegrpc/go.mod | 54 ------------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 54 ------------ exporters/prometheus/go.mod | 54 ------------ exporters/stdout/stdoutmetric/go.mod | 54 ------------ exporters/stdout/stdouttrace/go.mod | 58 ------------ exporters/zipkin/go.mod | 58 ------------ go.mod | 62 ------------- go.sum | 3 + internal/tools/crosslink/crosslink.go | 88 ------------------- internal/tools/go.mod | 67 +------------- internal/tools/go.sum | 23 ++++- internal/tools/tools.go | 1 + metric/go.mod | 58 ------------ schema/go.mod | 64 -------------- sdk/go.mod | 60 ------------- sdk/metric/go.mod | 54 ------------ trace/go.mod | 62 ------------- trace/go.sum | 3 + 37 files changed, 35 insertions(+), 1782 deletions(-) delete mode 100644 internal/tools/crosslink/crosslink.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b64a142286d..3e13e50b309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) + ## [1.7.0/0.30.0] - 2022-04-28 ### Added diff --git a/Makefile b/Makefile index 8cd7eea76b3..d847bd13d54 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SEMCONVGEN = $(TOOLS)/semconvgen $(TOOLS)/semconvgen: PACKAGE=go.opentelemetry.io/build-tools/semconvgen CROSSLINK = $(TOOLS)/crosslink -$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/crosslink +$(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink SEMCONVKIT = $(TOOLS)/semconvkit $(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit @@ -147,8 +147,8 @@ golangci-lint/%: | $(GOLANGCI_LINT) .PHONY: crosslink crosslink: | $(CROSSLINK) - @echo "cross-linking all go modules" \ - && $(CROSSLINK) + @echo "Updating intra-repository dependencies in all go modules" \ + && $(CROSSLINK) --root=$(shell pwd) --prune .PHONY: go-mod-tidy go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 8acc612e542..f14be6325c1 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -13,64 +13,10 @@ require ( replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/bridge/opencensus => ./ - -replace go.opentelemetry.io/otel/bridge/opentracing => ../opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/metric => ../../metric -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ./test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 7ac137e1291..722676c4739 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -14,62 +14,10 @@ replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/bridge/opencensus => ../ -replace go.opentelemetry.io/otel/bridge/opencensus/test => ./ - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../../metric replace go.opentelemetry.io/otel/sdk => ../../../sdk -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../../trace - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../../exporters/otlp/internal/retry diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 58504ffe18d..5e362031cc9 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -10,64 +10,4 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ./ - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/fib/go.mod b/example/fib/go.mod index 579478f06b5..3a401f92ee2 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -11,64 +11,8 @@ require ( replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - replace go.opentelemetry.io/otel/sdk => ../../sdk -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/fib => ./ - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index a3aa6e7a2c9..dfa5b00d5d8 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -14,60 +14,4 @@ require ( go.opentelemetry.io/otel/sdk v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ./ - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 2e7fbe73c1a..c35fe5bf676 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -15,62 +15,6 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ./ - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index d595ae6a99b..a51adf7751f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -18,60 +18,12 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ./ - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../metric -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../trace -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 3c6f108a3dd..f256b8dd8c3 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -15,62 +15,10 @@ require ( google.golang.org/grpc v1.46.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ./ - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 09df93d9fd3..4aa81e1666e 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -15,62 +15,4 @@ replace ( go.opentelemetry.io/otel/trace => ../../trace ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ./ - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/sdk/trace => ../../sdk/trace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 0a4d2c1236c..3bcc02f96fd 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -15,60 +15,8 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ./ - -replace go.opentelemetry.io/otel/example/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../metric -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index d11b2597ea5..12867fd9f45 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -15,60 +15,4 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ./ - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index ffacb71f606..c246328a566 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -10,66 +10,8 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ./ - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/exporters/zipkin => ../zipkin - replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../otlp/internal/retry diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 8263d50146f..5f5641a4f3a 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -6,67 +6,3 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 github.com/stretchr/testify v1.7.1 ) - -replace go.opentelemetry.io/otel => ../../../.. - -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib - -replace go.opentelemetry.io/otel/example/jaeger => ../../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../jaeger - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ./ - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../zipkin - -replace go.opentelemetry.io/otel/internal/metric => ../../../../internal/metric - -replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../../../metric - -replace go.opentelemetry.io/otel/schema => ../../../../schema - -replace go.opentelemetry.io/otel/sdk => ../../../../sdk - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../../../../trace diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index bf5598dfb88..6e799618cd0 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -23,58 +23,6 @@ replace go.opentelemetry.io/otel/metric => ../../../metric replace go.opentelemetry.io/otel/trace => ../../../trace -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ./ - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ./otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../jaeger - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../prometheus - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../zipkin - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ./otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 9cb6acc30db..8520c54e566 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -28,54 +28,4 @@ replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ./ - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric - -replace go.opentelemetry.io/otel/internal/metric => ../../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../jaeger - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../prometheus - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../zipkin - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7515cc11d9a..0b1234dc1a6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -23,54 +23,4 @@ replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ./ - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric - -replace go.opentelemetry.io/otel/internal/metric => ../../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../jaeger - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../prometheus - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../zipkin - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../otlpmetricgrpc - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 4b78fd4bbe1..233484864fa 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -18,62 +18,6 @@ replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/sdk => ../../../sdk -replace go.opentelemetry.io/otel/metric => ../../../metric - replace go.opentelemetry.io/otel/trace => ../../../trace -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../prometheus - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ./ - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ./otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ./otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 2a760b0320f..47705ca77a6 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -21,60 +21,6 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ -replace go.opentelemetry.io/otel/metric => ../../../../metric - replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../prometheus - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ./ - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../../sdk/metric - -replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index a49ca02e574..23940e9a5c0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -17,62 +17,8 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel => ../../../.. -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../../prometheus - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ./ - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../../zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../../../metric - replace go.opentelemetry.io/otel/sdk => ../../../../sdk -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/internal/metric => ../../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../../schema - replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index bdd037be053..c0681369192 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -13,64 +13,10 @@ require ( replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/prometheus => ./ - -replace go.opentelemetry.io/otel/exporters/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../zipkin - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../metric replace go.opentelemetry.io/otel/sdk => ../../sdk -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../otlp/internal/retry diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 3902d39bc3a..83436139ede 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -15,62 +15,8 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ./ - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../../metric -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric - replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../otlp/internal/retry diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 586949a1157..8edf46f1dc5 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -14,62 +14,4 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ./ - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../stdoutmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../otlp/internal/retry diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 0a2de40baf9..40cc03313a8 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -11,66 +11,8 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ./ - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../../internal/metric - replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../otlp/internal/retry diff --git a/go.mod b/go.mod index be9574814c4..cb6feb023fd 100644 --- a/go.mod +++ b/go.mod @@ -10,66 +10,4 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) -replace go.opentelemetry.io/otel => ./ - -replace go.opentelemetry.io/otel/bridge/opencensus => ./bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ./bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ./example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ./example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ./example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ./example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ./example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ./example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ./exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ./exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ./exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ./internal/tools - -replace go.opentelemetry.io/otel/sdk => ./sdk - -replace go.opentelemetry.io/otel/internal/metric => ./internal/metric - -replace go.opentelemetry.io/otel/metric => ./metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ./sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ./sdk/metric - replace go.opentelemetry.io/otel/trace => ./trace - -replace go.opentelemetry.io/otel/example/passthrough => ./example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ./exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ./exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ./exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ./exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ./exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ./exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ./exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ./exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ./bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ./example/fib - -replace go.opentelemetry.io/otel/schema => ./schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ./exporters/otlp/internal/retry diff --git a/go.sum b/go.sum index f6a0b224951..da1754cb88e 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,7 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -12,6 +13,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/internal/tools/crosslink/crosslink.go b/internal/tools/crosslink/crosslink.go deleted file mode 100644 index 5f19d5b946e..00000000000 --- a/internal/tools/crosslink/crosslink.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// The crosslink tool generates and maintains replace directives in all -// the go.mod files within this repository. Some directives are superfluous -// (e.g. because the replaced module doesn't occur in the dependency tree), -// but we generate them anyway for the sake of consistency (#1529 tracks -// pruning this to a mininal set). -// -// In particular, we generate a replace directive from each module to itself -// (i.e., the target path "./"). This is actually necessary in the presence of -// cyclic dependencies between modules. - -package main - -import ( - "log" - "os" - "path/filepath" - "strings" - - "go.opentelemetry.io/otel/internal/tools" - "golang.org/x/mod/modfile" -) - -func crossLink(m []*modfile.File) error { - for _, from := range m { - basepath := filepath.Dir(from.Syntax.Name) - for _, to := range m { - newPath, err := filepath.Rel(basepath, filepath.Dir(to.Syntax.Name)) - if err != nil { - return err - } - switch { - case newPath == ".", newPath == "..": - newPath += "/" - case !strings.HasPrefix(newPath, ".."): - newPath = "./" + newPath - } - from.AddReplace(to.Module.Mod.Path, "", newPath, "") - } - - from.Cleanup() - - f, err := os.OpenFile(from.Syntax.Name, os.O_RDWR|os.O_TRUNC, 0755) - if err != nil { - return err - } - if _, err = f.Write(modfile.Format(from.Syntax)); err != nil { - return err - } - if err = f.Close(); err != nil { - return err - } - } - return nil -} - -func main() { - root, err := tools.FindRepoRoot() - if err != nil { - log.Fatalf("unable to find repo root: %v", err) - } - - mods, err := root.FindModules() - if err != nil { - log.Fatalf("unable to list modules: %v", err) - } - - if err := tools.PrintModFiles(os.Stdout, mods); err != nil { - log.Fatalf("unable to print modules: %v", err) - } - - if err := crossLink(mods); err != nil { - log.Fatalf("unable to crosslink: %v", err) - } -} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 62fa28a541e..8821a9cb5a2 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,75 +9,10 @@ require ( github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad + go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0 go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 golang.org/x/tools v0.1.10 ) - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prom-collector => ../../example/prom-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ./ - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ../../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 07d8237bb28..59ec1d3b032 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -110,6 +110,8 @@ github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvx github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -346,8 +348,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -663,12 +666,15 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= +github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI= +github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -899,8 +905,11 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/build-tools v0.0.0-20210719163622-92017e64f35b/go.mod h1:zZRrJN8qdwDdPNkCEyww4SW54mM1Da0v9H3TyQet9T4= -go.opentelemetry.io/build-tools v0.0.0-20220304161722-feb5ff5848f1 h1:R/LC1WK1TDCbS2ANSeI2XcKrO5Ym6tx1YCUo+AaiFoE= go.opentelemetry.io/build-tools v0.0.0-20220304161722-feb5ff5848f1/go.mod h1:qO4vrNgLf0V5FHckLNwEw2CfBTaL8w6pKDm3bF6nhMk= +go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a h1:yLxbGYl9MXOqD0o3unX/nJn+y+1loFNWZJWkfeguYV8= +go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a/go.mod h1:gkLviEngQuoeD670EP1KA/Oj4i5oNAzb+pjkk+4ecaQ= +go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0 h1:yumJiwLmJ3xQXgvhywkGqkhbh9hbTsAWEuCGoRJi8bQ= +go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0/go.mod h1:0mci40GSYELJTxavWNtFzuy2Z76uzf4dbT+1P0E8MAo= go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a h1:VCNW72z+YKDAH8O5y+WmMuj2Jlgd+ZG5Abk9xTGw6dQ= go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a/go.mod h1:/X2uGFIoHCUyQiBqL6pY6AEU2j8q1e+EMWhZlCsY5dk= go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 h1:5zVDNFcOwiMee9Qm8sH08iw+9cJZk+l/Y3mVa2D/zmM= @@ -912,14 +921,22 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= +go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= +go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 53b4a545b23..463d26a493f 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -24,6 +24,7 @@ import ( _ "github.com/itchyny/gojq" _ "github.com/jcchavezs/porto/cmd/porto" _ "github.com/wadey/gocovmerge" + _ "go.opentelemetry.io/build-tools/crosslink" _ "go.opentelemetry.io/build-tools/dbotconf" _ "go.opentelemetry.io/build-tools/multimod" _ "go.opentelemetry.io/build-tools/semconvgen" diff --git a/metric/go.mod b/metric/go.mod index 02e82e3601f..223f1e9fcd9 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,62 +9,4 @@ require ( replace go.opentelemetry.io/otel => ../ -replace go.opentelemetry.io/otel/bridge/opencensus => ../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../internal/tools - -replace go.opentelemetry.io/otel/metric => ./ - -replace go.opentelemetry.io/otel/sdk => ../sdk - -replace go.opentelemetry.io/otel/sdk/export/metric => ../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric - replace go.opentelemetry.io/otel/trace => ../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../example/fib - -replace go.opentelemetry.io/otel/schema => ../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../exporters/otlp/internal/retry diff --git a/schema/go.mod b/schema/go.mod index bd5888f698d..e2127999806 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -7,67 +7,3 @@ require ( github.com/stretchr/testify v1.7.1 gopkg.in/yaml.v2 v2.4.0 ) - -replace go.opentelemetry.io/otel => ../ - -replace go.opentelemetry.io/otel/bridge/opencensus => ../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../bridge/opencensus/test - -replace go.opentelemetry.io/otel/bridge/opentracing => ../bridge/opentracing - -replace go.opentelemetry.io/otel/example/fib => ../example/fib - -replace go.opentelemetry.io/otel/example/jaeger => ../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector - -replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough - -replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin - -replace go.opentelemetry.io/otel/exporters/jaeger => ../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/prometheus => ../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/zipkin => ../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/metric => ../internal/metric - -replace go.opentelemetry.io/otel/internal/tools => ../internal/tools - -replace go.opentelemetry.io/otel/metric => ../metric - -replace go.opentelemetry.io/otel/schema => ./ - -replace go.opentelemetry.io/otel/sdk => ../sdk - -replace go.opentelemetry.io/otel/sdk/export/metric => ../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../trace - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../exporters/otlp/internal/retry diff --git a/sdk/go.mod b/sdk/go.mod index 99d1ddc815b..4f4212332c6 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -13,64 +13,4 @@ require ( golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) -replace go.opentelemetry.io/otel/bridge/opencensus => ../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../internal/tools - -replace go.opentelemetry.io/otel/sdk => ./ - -replace go.opentelemetry.io/otel/metric => ../metric - -replace go.opentelemetry.io/otel/sdk/export/metric => ./export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ./metric - replace go.opentelemetry.io/otel/trace => ../trace - -replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../example/fib - -replace go.opentelemetry.io/otel/schema => ../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../exporters/otlp/internal/retry diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index f81c840dfc0..0fb932027b8 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,38 +4,10 @@ go 1.16 replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../../internal/tools - replace go.opentelemetry.io/otel/metric => ../../metric replace go.opentelemetry.io/otel/sdk => ../ -replace go.opentelemetry.io/otel/sdk/export/metric => ../export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ./ - replace go.opentelemetry.io/otel/trace => ../../trace require ( @@ -45,29 +17,3 @@ require ( go.opentelemetry.io/otel/metric v0.30.0 go.opentelemetry.io/otel/sdk v1.7.0 ) - -replace go.opentelemetry.io/otel/example/passthrough => ../../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../../example/fib - -replace go.opentelemetry.io/otel/schema => ../../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry diff --git a/trace/go.mod b/trace/go.mod index 33c7efa1de5..1a8d9723229 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -4,70 +4,8 @@ go 1.16 replace go.opentelemetry.io/otel => ../ -replace go.opentelemetry.io/otel/bridge/opencensus => ../bridge/opencensus - -replace go.opentelemetry.io/otel/bridge/opentracing => ../bridge/opentracing - -replace go.opentelemetry.io/otel/example/jaeger => ../example/jaeger - -replace go.opentelemetry.io/otel/example/namedtracer => ../example/namedtracer - -replace go.opentelemetry.io/otel/example/opencensus => ../example/opencensus - -replace go.opentelemetry.io/otel/example/otel-collector => ../example/otel-collector - -replace go.opentelemetry.io/otel/example/prometheus => ../example/prometheus - -replace go.opentelemetry.io/otel/example/zipkin => ../example/zipkin - -replace go.opentelemetry.io/otel/exporters/prometheus => ../exporters/prometheus - -replace go.opentelemetry.io/otel/exporters/jaeger => ../exporters/jaeger - -replace go.opentelemetry.io/otel/exporters/zipkin => ../exporters/zipkin - -replace go.opentelemetry.io/otel/internal/tools => ../internal/tools - -replace go.opentelemetry.io/otel/metric => ../metric - -replace go.opentelemetry.io/otel/sdk => ../sdk - -replace go.opentelemetry.io/otel/sdk/export/metric => ../sdk/export/metric - -replace go.opentelemetry.io/otel/sdk/metric => ../sdk/metric - -replace go.opentelemetry.io/otel/trace => ./ - require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 ) - -replace go.opentelemetry.io/otel/example/passthrough => ../example/passthrough - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../exporters/otlp/otlptrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../exporters/otlp/otlptrace/otlptracegrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp => ../exporters/otlp/otlptrace/otlptracehttp - -replace go.opentelemetry.io/otel/internal/metric => ../internal/metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp => ../exporters/otlp/otlpmetric/otlpmetrichttp - -replace go.opentelemetry.io/otel/bridge/opencensus/test => ../bridge/opencensus/test - -replace go.opentelemetry.io/otel/example/fib => ../example/fib - -replace go.opentelemetry.io/otel/schema => ../schema - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../exporters/otlp/internal/retry diff --git a/trace/go.sum b/trace/go.sum index 16e48e5a87a..146a5ee561f 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -3,6 +3,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -10,6 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= From a0bed80424cf63d977a3066e6e01670a06666fc1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 6 May 2022 11:06:38 -0700 Subject: [PATCH 175/886] Change @paivagustavo to emeritus status (#2888) --- CODEOWNERS | 2 +- CONTRIBUTING.md | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 76d959d237a..8185867e097 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @paivagustavo @MadVikingGod @pellared @hanyuancheung +* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 098a7c54fbe..bbcfd6573e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -506,7 +506,6 @@ Approvers: - [Josh MacDonald](https://github.com/jmacd), LightStep - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [David Ashpole](https://github.com/dashpole), Google -- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep - [Robert Pająk](https://github.com/pellared), Splunk - [Chester Cheung](https://github.com/hanyuancheung), Tencent @@ -516,6 +515,10 @@ Maintainers: - [Anthony Mirabella](https://github.com/Aneurysm9), AWS - [Tyler Yahn](https://github.com/MrAlias), Splunk +Emeritus: + +- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep + ### Become an Approver or a Maintainer See the [community membership document in OpenTelemetry community From 2a02a55c375b8d2a8feae61e4933acaedf70d6ba Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 10 May 2022 11:17:38 -0700 Subject: [PATCH 176/886] Add span status and error recording subsections to trace docs (#2893) * Add span status and error recording subsections to trace docs * Add codes import in relevant docs sections * Update website_docs/manual.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- website_docs/manual.md | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/website_docs/manual.md b/website_docs/manual.md index 6a04387ff7c..5ea73dc3394 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -194,6 +194,50 @@ Events can also have attributes of their own - span.AddEvent("Cancelled wait due to external signal", trace.WithAttributes(attribute.Int("pid", 4328), attribute.String("signal", "SIGHUP"))) ``` +### Set span status + +A status can be set on a span, typically used to specify that there was an error in the operation a span is tracking - .`Error`. + +```go +import ( + // ... + "go.opentelemetry.io/otel/codes" + // ... +) + +// ... + +result, err := operationThatCouldFail() +if err != nil { + span.SetStatus(codes.Error, "operationThatCouldFail failed") +} +``` + +By default, the status for all spans is `Unset`. In rare cases, you may also wish to set the status to `Ok`. This should generally not be necessary, though. + +### Record errors + +If you have an operation that failed and you wish to capture the error it produced, you can record that error. + +```go +import ( + // ... + "go.opentelemetry.io/otel/codes" + // ... +) + +// ... + +result, err := operationThatCouldFail() +if err != nil { + span.SetStatus(codes.Error, "operationThatCouldFail failed") + span.RecordError(err) +} +``` + +It is highly recommended that you also set a span's status to `Error` when using `RecordError`, unless you do not wish to consider the span tracking a failed operation as an error span. +The `RecordError` function does **not** automatically set a span status when called. + ## Creating Metrics The metrics API is currently unstable, documentation TBA. From 4475aaa8f88089e505da4ad79993004719f6d2c2 Mon Sep 17 00:00:00 2001 From: John Watson Date: Tue, 17 May 2022 02:13:49 -0700 Subject: [PATCH 177/886] Create README.md for the ot bridge (#2896) * Create README.md Some very bare-bones introductory documentation on how to use the ot bridge * Update README.md linting * Update README.md more linting * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- bridge/opentracing/README.md | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 bridge/opentracing/README.md diff --git a/bridge/opentracing/README.md b/bridge/opentracing/README.md new file mode 100644 index 00000000000..a4477a87306 --- /dev/null +++ b/bridge/opentracing/README.md @@ -0,0 +1,40 @@ +# OpenTelemetry/OpenTracing Bridge + +## Getting started + +`go get go.opentelemetry.io/otel/bridge/opentracing` + +Assuming you have configured an OpenTelemetry `TracerProvider`, these will be the steps to follow to wire up the bridge: + +```go +import ( + "go.opentelemetry.io/otel" + otelBridge "go.opentelemetry.io/otel/bridge/opentracing" +) + +func main() { + /* Create tracerProvider and configure OpenTelemetry ... */ + + otelTracer := tracerProvider.Tracer("tracer_name") + // Use the bridgeTracer as your OpenTracing tracer. + bridgeTracer, wrapperTracerProvider := otelBridge.NewTracerPair(otelTracer) + // Set the wrapperTracerProvider as the global OpenTelemetry + // TracerProvider so instrumentation will use it by default. + otel.SetTracerProvider(wrapperTracerProvider) + + /* ... */ +} +``` + +## Interop from trace context from OpenTracing to OpenTelemetry + +In order to get OpenTracing spans properly into the OpenTelemetry context, so they can be propagated (both internally, and externally), you will need to explicitly use the `BridgeTracer` for creating your OpenTracing spans, rather than a bare OpenTracing `Tracer` instance. + +When you have started an OpenTracing Span, make sure the OpenTelemetry knows about it like this: + +```go + ctxWithOTSpan := opentracing.ContextWithSpan(ctx, otSpan) + ctxWithOTAndOTelSpan := bridgeTracer.ContextWithSpanHook(ctxWithOTSpan, otSpan) + // Propagate the otSpan to both OpenTracing and OpenTelemetry + // instrumentation by using the ctxWithOTAndOTelSpan context. +``` From a496d2285d566236bddb63c73067bcee7613a742 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 18 May 2022 18:21:57 +0200 Subject: [PATCH 178/886] add @dmathieu as an approver (#2908) --- CODEOWNERS | 2 +- CONTRIBUTING.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 8185867e097..c4012ed6ca1 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung +* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bbcfd6573e2..9371a481ab1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -508,6 +508,7 @@ Approvers: - [David Ashpole](https://github.com/dashpole), Google - [Robert Pająk](https://github.com/pellared), Splunk - [Chester Cheung](https://github.com/hanyuancheung), Tencent +- [Damien Mathieu](https://github.com/dmathieu), Auth0/Okta Maintainers: From f127a1590fd0bdf99d52e909d4779df99c755079 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 09:37:38 -0700 Subject: [PATCH 179/886] Bump google.golang.org/grpc from 1.46.0 to 1.46.2 in /exporters/otlp/otlpmetric (#2903) * Bump google.golang.org/grpc in /exporters/otlp/otlpmetric Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.46.0 to 1.46.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.46.0...v1.46.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 6e799618cd0..5b388032c15 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/sdk/metric v0.30.0 go.opentelemetry.io/proto/otlp v0.16.0 - google.golang.org/grpc v1.46.0 + google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 92464dd801a..454fcd46d27 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 8520c54e566..58f8ea59ef0 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 go.opentelemetry.io/proto/otlp v0.16.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.46.0 + google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 92464dd801a..454fcd46d27 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 92464dd801a..454fcd46d27 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 82cf8ada83b3ec42ed030f2b0a1848a498009c06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 09:57:52 -0700 Subject: [PATCH 180/886] Bump google.golang.org/grpc from 1.46.0 to 1.46.2 in /exporters/otlp/otlptrace (#2900) * Bump google.golang.org/grpc in /exporters/otlp/otlptrace Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.46.0 to 1.46.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.46.0...v1.46.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index f256b8dd8c3..5232c23bf15 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0 go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 - google.golang.org/grpc v1.46.0 + google.golang.org/grpc v1.46.2 ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index f32e3e82287..4d8dc9f83af 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -404,8 +404,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 233484864fa..bd2046ee07e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 go.opentelemetry.io/proto/otlp v0.16.0 - google.golang.org/grpc v1.46.0 + google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 0cd487711bd..212a83e8ee3 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -400,8 +400,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 47705ca77a6..06b8c21fb4c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.16.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.46.0 + google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 2b8ba71d081..3a1e26f6e76 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -408,8 +408,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 0cd487711bd..212a83e8ee3 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -400,8 +400,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From c5809aa8c7c3955e0c92a598e0e9416ce84816e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 May 2022 10:10:32 -0700 Subject: [PATCH 181/886] Bump github.com/prometheus/client_golang from 1.12.1 to 1.12.2 in /exporters/prometheus (#2902) * Bump github.com/prometheus/client_golang in /exporters/prometheus Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.1 to 1.12.2. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.12.1...v1.12.2) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias --- example/prometheus/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 8a58d449e01..d24eae03d37 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -167,8 +167,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index c0681369192..3eac5d1fd6b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.16 require ( - github.com/prometheus/client_golang v1.12.1 + github.com/prometheus/client_golang v1.12.2 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/metric v0.30.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 127d9082de7..56f6444835b 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -169,8 +169,8 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= From 1f5b159161e0ff54df4677284fa7d6718dc9186d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 19 May 2022 13:15:07 -0700 Subject: [PATCH 182/886] Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files --- .golangci.yml | 216 +++++++++++++++++- attribute/encoder.go | 4 +- attribute/iterator_test.go | 1 - attribute/set.go | 10 +- attribute/value.go | 2 +- baggage/baggage.go | 6 + baggage/baggage_test.go | 10 +- bridge/opencensus/aggregation_test.go | 2 +- bridge/opencensus/exporter.go | 2 +- bridge/opencensus/test/bridge_test.go | 1 - bridge/opentracing/bridge.go | 8 +- bridge/opentracing/internal/mock.go | 4 +- bridge/opentracing/util.go | 3 + bridge/opentracing/wrapper.go | 2 + example/namedtracer/main.go | 12 +- example/opencensus/main.go | 19 +- example/otel-collector/main.go | 44 ++-- example/passthrough/handler/handler.go | 2 + example/passthrough/main.go | 13 +- example/prometheus/main.go | 24 +- example/zipkin/main.go | 23 +- exporters/jaeger/jaeger.go | 4 +- .../jaeger/reconnecting_udp_client_test.go | 6 +- exporters/jaeger/uploader.go | 7 +- exporters/otlp/otlpmetric/exporter.go | 2 +- exporters/otlp/otlpmetric/exporter_test.go | 12 +- .../internal/metrictransform/attribute.go | 4 +- .../metrictransform/attribute_test.go | 1 - .../internal/metrictransform/metric.go | 2 - .../internal/metrictransform/metric_test.go | 7 +- .../internal/otlpconfig/envconfig.go | 3 +- .../internal/otlpconfig/options_test.go | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/client.go | 4 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 1 - .../otlp/otlpmetric/otlpmetricgrpc/options.go | 3 +- .../internal/otlpconfig/envconfig.go | 3 +- .../internal/otlpconfig/options_test.go | 2 +- .../internal/tracetransform/attribute.go | 4 +- .../internal/tracetransform/attribute_test.go | 1 - .../internal/tracetransform/span_test.go | 1 - .../otlp/otlptrace/otlptracegrpc/client.go | 4 +- .../otlp/otlptrace/otlptracegrpc/options.go | 3 +- .../otlptrace/otlptracehttp/example_test.go | 22 +- exporters/prometheus/prometheus.go | 32 +-- exporters/prometheus/prometheus_test.go | 10 +- exporters/stdout/stdoutmetric/config.go | 1 - exporters/stdout/stdoutmetric/doc.go | 4 +- exporters/stdout/stdoutmetric/example_test.go | 22 +- exporters/stdout/stdoutmetric/exporter.go | 2 + exporters/stdout/stdoutmetric/metric.go | 17 +- exporters/stdout/stdouttrace/config.go | 1 - exporters/stdout/stdouttrace/doc.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 22 +- exporters/stdout/stdouttrace/trace_test.go | 4 +- exporters/zipkin/model.go | 23 +- exporters/zipkin/model_test.go | 20 +- exporters/zipkin/zipkin_test.go | 6 +- handler.go | 1 - handler_test.go | 8 +- internal/baggage/context.go | 9 +- internal/matchers/expectation.go | 49 ++-- internal/rawhelpers.go | 2 +- metric/example_test.go | 5 +- metric/instrument/config.go | 4 +- metric/internal/global/instruments.go | 23 -- metric/internal/global/meter_test.go | 5 - metric/unit/unit.go | 1 + sdk/internal/env/env_test.go | 1 - sdk/metric/aggregator/aggregator.go | 2 +- sdk/metric/aggregator/aggregatortest/test.go | 38 ++- sdk/metric/aggregator/histogram/histogram.go | 6 +- .../aggregator/histogram/histogram_test.go | 1 - sdk/metric/aggregator/lastvalue/lastvalue.go | 4 +- sdk/metric/controller/basic/controller.go | 4 +- sdk/metric/controller/basic/pull_test.go | 1 - .../controllertest/controller_test.go | 1 - sdk/metric/controller/controllertest/test.go | 9 + sdk/metric/controller/time/time.go | 18 +- sdk/metric/correct_test.go | 2 - sdk/metric/export/aggregation/aggregation.go | 2 +- sdk/metric/export/metric.go | 12 +- sdk/metric/metrictest/exporter_test.go | 10 - sdk/metric/processor/basic/basic.go | 3 +- sdk/metric/processor/basic/basic_test.go | 31 ++- sdk/metric/processor/basic/config.go | 1 + sdk/metric/processor/processortest/test.go | 11 +- .../processor/processortest/test_test.go | 9 +- sdk/metric/processor/reducer/reducer_test.go | 11 +- sdk/metric/registry/registry.go | 1 + sdk/metric/sdk.go | 5 +- sdk/metric/sdkapi/descriptor.go | 4 +- sdk/metric/sdkapi/sdkapi.go | 16 +- sdk/metric/sdkapi/wrap.go | 2 + sdk/resource/auto_test.go | 1 - sdk/resource/benchmark_test.go | 1 - sdk/resource/builtin_test.go | 5 +- sdk/resource/os_unix_test.go | 2 +- sdk/resource/process_test.go | 4 +- sdk/resource/resource.go | 10 +- sdk/trace/batch_span_processor.go | 82 +++++-- sdk/trace/batch_span_processor_test.go | 59 +++-- sdk/trace/id_generator.go | 6 +- sdk/trace/provider.go | 3 + sdk/trace/provider_test.go | 2 +- sdk/trace/sampler_env.go | 17 +- sdk/trace/sampling_test.go | 1 - sdk/trace/trace_test.go | 18 +- sdk/trace/tracetest/recorder.go | 1 + sdk/trace/tracetest/span.go | 1 + semconv/internal/http_test.go | 12 +- trace/trace.go | 2 +- trace/trace_test.go | 4 +- trace/tracestate.go | 1 - 113 files changed, 767 insertions(+), 449 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index affba1f8378..253e3b35b52 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,12 +10,13 @@ linters: # Specifically enable linters we want to use. enable: - deadcode + - depguard - errcheck + - godot - gofmt - goimports - gosimple - govet - - godot - ineffassign - misspell - revive @@ -25,30 +26,221 @@ linters: - unused - varcheck - issues: + # Maximum issues count per one linter. + # Set to 0 to disable. + # Default: 50 + # Setting to unlimited so the linter only is run once to debug all issues. + max-issues-per-linter: 0 + # Maximum count of issues with the same text. + # Set to 0 to disable. + # Default: 3 + # Setting to unlimited so the linter only is run once to debug all issues. + max-same-issues: 0 + # Excluding configuration per-path, per-linter, per-text and per-source. exclude-rules: - # helpers in tests often (rightfully) pass a *testing.T as their first argument - - path: _test\.go - text: "context.Context should be the first parameter of a function" + # TODO: Having appropriate comments for exported objects helps development, + # even for objects in internal packages. Appropriate comments for all + # exported objects should be added and this exclusion removed. + - path: '.*internal/.*' + text: "exported (method|function|type|const) (.+) should have comment or be unexported" linters: - revive - # Yes, they are, but it's okay in a test + # Yes, they are, but it's okay in a test. - path: _test\.go text: "exported func.*returns unexported type.*which can be annoying to use" linters: - revive + # Example test functions should be treated like main. + - path: example.*_test\.go + text: "calls to (.+) only in main[(][)] or init[(][)] functions" + linters: + - revive + include: + # revive exported should have comment or be unexported. + - EXC0012 + # revive package comment should be of the form ... + - EXC0013 linters-settings: - misspell: - locale: US - ignore-words: - - cancelled - goimports: - local-prefixes: go.opentelemetry.io + depguard: + # Check the list against standard lib. + # Default: false + include-go-root: true + # A list of packages for the list type specified. + # Default: [] + packages: + - "crypto/md5" + - "crypto/sha1" + - "crypto/**/pkix" + ignore-file-rules: + - "**/*_test.go" + additional-guards: + # Do not allow testing packages in non-test files. + - list-type: denylist + include-go-root: true + packages: + - testing + - github.com/stretchr/testify + ignore-file-rules: + - "**/*_test.go" + - "**/*test/*.go" + - "**/internal/matchers/*.go" godot: exclude: # Exclude sentence fragments for lists. - '^[ ]*[-•]' # Exclude sentences prefixing a list. - ':$' + goimports: + local-prefixes: go.opentelemetry.io + misspell: + locale: US + ignore-words: + - cancelled + revive: + # Sets the default failure confidence. + # This means that linting errors with less than 0.8 confidence will be ignored. + # Default: 0.8 + confidence: 0.01 + rules: + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#blank-imports + - name: blank-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#bool-literal-in-expr + - name: bool-literal-in-expr + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#constant-logical-expr + - name: constant-logical-expr + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + - name: context-as-argument + disabled: false + arguments: + allowTypesBefore: "*testing.T" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type + - name: context-keys-type + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#deep-exit + - name: deep-exit + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#defer + - name: defer + disabled: false + arguments: + - ["call-chain", "loop"] + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#dot-imports + - name: dot-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#duplicated-imports + - name: duplicated-imports + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#early-return + - name: early-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block + - name: empty-block + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines + - name: empty-lines + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-naming + - name: error-naming + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-return + - name: error-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#error-strings + - name: error-strings + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#errorf + - name: errorf + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported + - name: exported + disabled: false + arguments: + - "sayRepetitiveInsteadOfStutters" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#flag-parameter + - name: flag-parameter + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#identical-branches + - name: identical-branches + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#if-return + - name: if-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#increment-decrement + - name: increment-decrement + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#indent-error-flow + - name: indent-error-flow + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#import-shadowing + - name: import-shadowing + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#package-comments + - name: package-comments + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range + - name: range + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-in-closure + - name: range-val-in-closure + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#range-val-address + - name: range-val-address + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#redefines-builtin-id + - name: redefines-builtin-id + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#string-format + - name: string-format + disabled: false + arguments: + - - panic + - '/^[^\n]*$/' + - must not contain line breaks + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#struct-tag + - name: struct-tag + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#superfluous-else + - name: superfluous-else + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#time-equal + - name: time-equal + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-naming + - name: var-naming + disabled: false + arguments: + - ["ID"] # AllowList + - ["Otel", "Aws", "Gcp"] # DenyList + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#var-declaration + - name: var-declaration + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unconditional-recursion + - name: unconditional-recursion + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unexported-return + - name: unexported-return + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error + - name: unhandled-error + disabled: false + arguments: + - "fmt.Fprint" + - "fmt.Fprintf" + - "fmt.Fprintln" + - "fmt.Print" + - "fmt.Printf" + - "fmt.Println" + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt + - name: unnecessary-stmt + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#useless-break + - name: useless-break + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value + - name: waitgroup-by-value + disabled: false diff --git a/attribute/encoder.go b/attribute/encoder.go index dae1d8f61fd..fe2bc5766cf 100644 --- a/attribute/encoder.go +++ b/attribute/encoder.go @@ -133,9 +133,9 @@ func copyAndEscape(buf *bytes.Buffer, val string) { for _, ch := range val { switch ch { case '=', ',', escapeChar: - buf.WriteRune(escapeChar) + _, _ = buf.WriteRune(escapeChar) } - buf.WriteRune(ch) + _, _ = buf.WriteRune(ch) } } diff --git a/attribute/iterator_test.go b/attribute/iterator_test.go index 0a6ea92e172..a40432aaacc 100644 --- a/attribute/iterator_test.go +++ b/attribute/iterator_test.go @@ -56,7 +56,6 @@ func TestEmptyIterator(t *testing.T) { } func TestMergedIterator(t *testing.T) { - type inputs struct { name string keys1 []string diff --git a/attribute/set.go b/attribute/set.go index 5c24700866d..26be5983223 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -71,8 +71,8 @@ func EmptySet() *Set { return emptySet } -// reflect abbreviates reflect.ValueOf. -func (d Distinct) reflect() reflect.Value { +// reflectValue abbreviates reflect.ValueOf(d). +func (d Distinct) reflectValue() reflect.Value { return reflect.ValueOf(d.iface) } @@ -86,7 +86,7 @@ func (l *Set) Len() int { if l == nil || !l.equivalent.Valid() { return 0 } - return l.equivalent.reflect().Len() + return l.equivalent.reflectValue().Len() } // Get returns the KeyValue at ordered position idx in this set. @@ -94,7 +94,7 @@ func (l *Set) Get(idx int) (KeyValue, bool) { if l == nil { return KeyValue{}, false } - value := l.equivalent.reflect() + value := l.equivalent.reflectValue() if idx >= 0 && idx < value.Len() { // Note: The Go compiler successfully avoids an allocation for @@ -110,7 +110,7 @@ func (l *Set) Value(k Key) (Value, bool) { if l == nil { return Value{}, false } - rValue := l.equivalent.reflect() + rValue := l.equivalent.reflectValue() vlen := rValue.Len() idx := sort.Search(vlen, func(idx int) bool { diff --git a/attribute/value.go b/attribute/value.go index 6ec5cb290df..57899f682e7 100644 --- a/attribute/value.go +++ b/attribute/value.go @@ -25,7 +25,7 @@ import ( //go:generate stringer -type=Type // Type describes the type of the data Value holds. -type Type int +type Type int // nolint: revive // redefines builtin Type. // Value represents the value part in key-value pairs. type Value struct { diff --git a/baggage/baggage.go b/baggage/baggage.go index 824c67b27a3..9f82a2507b8 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -68,6 +68,9 @@ type Property struct { hasData bool } +// NewKeyProperty returns a new Property for key. +// +// If key is invalid, an error will be returned. func NewKeyProperty(key string) (Property, error) { if !keyRe.MatchString(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) @@ -77,6 +80,9 @@ func NewKeyProperty(key string) (Property, error) { return p, nil } +// NewKeyValueProperty returns a new Property for key with value. +// +// If key or value are invalid, an error will be returned. func NewKeyValueProperty(key, value string) (Property, error) { if !keyRe.MatchString(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 8cc4832ad00..609d6d05de9 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -612,7 +612,7 @@ func TestBaggageMembers(t *testing.T) { }, } - baggage := Baggage{list: baggage.List{ + bag := Baggage{list: baggage.List{ "foo": { Value: "1", Properties: []baggage.Property{ @@ -626,13 +626,13 @@ func TestBaggageMembers(t *testing.T) { }, }} - assert.ElementsMatch(t, members, baggage.Members()) + assert.ElementsMatch(t, members, bag.Members()) } func TestBaggageMember(t *testing.T) { - baggage := Baggage{list: baggage.List{"foo": {Value: "1"}}} - assert.Equal(t, Member{key: "foo", value: "1"}, baggage.Member("foo")) - assert.Equal(t, Member{}, baggage.Member("bar")) + bag := Baggage{list: baggage.List{"foo": {Value: "1"}}} + assert.Equal(t, Member{key: "foo", value: "1"}, bag.Member("foo")) + assert.Equal(t, Member{}, bag.Member("bar")) } func TestMemberKey(t *testing.T) { diff --git a/bridge/opencensus/aggregation_test.go b/bridge/opencensus/aggregation_test.go index 13093c67336..bbaff5c6440 100644 --- a/bridge/opencensus/aggregation_test.go +++ b/bridge/opencensus/aggregation_test.go @@ -276,7 +276,7 @@ func TestHistogramAggregation(t *testing.T) { if output.Kind() != aggregation.HistogramKind { t.Errorf("recordAggregationsFromPoints(%v) = %v, want %v", input, output.Kind(), aggregation.HistogramKind) } - if end != now { + if !end.Equal(now) { t.Errorf("recordAggregationsFromPoints(%v).end() = %v, want %v", input, end, now) } distAgg, ok := output.(aggregation.Histogram) diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go index e5d0410629e..7e7e7960007 100644 --- a/bridge/opencensus/exporter.go +++ b/bridge/opencensus/exporter.go @@ -37,7 +37,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) -var errConversion = errors.New("Unable to convert from OpenCensus to OpenTelemetry") +var errConversion = errors.New("unable to convert from OpenCensus to OpenTelemetry") // NewMetricExporter returns an OpenCensus exporter that exports to an // OpenTelemetry exporter. diff --git a/bridge/opencensus/test/bridge_test.go b/bridge/opencensus/test/bridge_test.go index 4caa7e79025..fb8647bd204 100644 --- a/bridge/opencensus/test/bridge_test.go +++ b/bridge/opencensus/test/bridge_test.go @@ -137,7 +137,6 @@ func TestToFromContext(t *testing.T) { // Get the opentelemetry span using the OpenCensus FromContext, and end it otSpan2 := octrace.FromContext(ctx) defer otSpan2.End() - }() spans := sr.Ended() diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 6b0e102e331..947321debc0 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -349,10 +349,14 @@ func (t *BridgeTracer) SetOpenTelemetryTracer(tracer trace.Tracer) { t.setTracer.isSet = true } +// SetTextMapPropagator sets propagator as the TextMapPropagator to use by the +// BridgeTracer. func (t *BridgeTracer) SetTextMapPropagator(propagator propagation.TextMapPropagator) { t.propagator = propagator } +// NewHookedContext returns a Context that has ctx as its parent and is +// wrapped to handle baggage set and get operations. func (t *BridgeTracer) NewHookedContext(ctx context.Context) context.Context { ctx = iBaggage.ContextWithSetHook(ctx, t.baggageSetHook) ctx = iBaggage.ContextWithGetHook(ctx, t.baggageGetHook) @@ -671,9 +675,9 @@ func (t *BridgeTracer) Extract(format interface{}, carrier interface{}) (ot.Span } header := http.Header(hhcarrier) ctx := t.getPropagator().Extract(context.Background(), propagation.HeaderCarrier(header)) - baggage := baggage.FromContext(ctx) + bag := baggage.FromContext(ctx) bridgeSC := &bridgeSpanContext{ - bag: baggage, + bag: bag, otelSpanContext: trace.SpanContextFromContext(ctx), } if !bridgeSC.otelSpanContext.IsValid() { diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 159e94d4048..4aeaad0096b 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -155,7 +155,7 @@ func (t *MockTracer) getRandSpanID() trace.SpanID { defer t.randLock.Unlock() sid := trace.SpanID{} - t.rand.Read(sid[:]) + _, _ = t.rand.Read(sid[:]) return sid } @@ -165,7 +165,7 @@ func (t *MockTracer) getRandTraceID() trace.TraceID { defer t.randLock.Unlock() tid := trace.TraceID{} - t.rand.Read(tid[:]) + _, _ = t.rand.Read(tid[:]) return tid } diff --git a/bridge/opentracing/util.go b/bridge/opentracing/util.go index 4914607f7f8..d770bacec42 100644 --- a/bridge/opentracing/util.go +++ b/bridge/opentracing/util.go @@ -33,6 +33,9 @@ func NewTracerPair(tracer trace.Tracer) (*BridgeTracer, *WrapperTracerProvider) return bridgeTracer, wrapperProvider } +// NewTracerPairWithContext is a convience function. It calls NewTracerPair +// and returns a hooked version of ctx with the created BridgeTracer along +// with the BridgeTracer and WrapperTracerProvider. func NewTracerPairWithContext(ctx context.Context, tracer trace.Tracer) (context.Context, *BridgeTracer, *WrapperTracerProvider) { bridgeTracer, wrapperProvider := NewTracerPair(tracer) ctx = bridgeTracer.NewHookedContext(ctx) diff --git a/bridge/opentracing/wrapper.go b/bridge/opentracing/wrapper.go index 3b6fa7bdb9a..8016ea2a87c 100644 --- a/bridge/opentracing/wrapper.go +++ b/bridge/opentracing/wrapper.go @@ -21,6 +21,8 @@ import ( "go.opentelemetry.io/otel/trace" ) +// WrapperTracerProvider is an OpenTelemetry TracerProvider that wraps an +// OpenTracing Tracer. type WrapperTracerProvider struct { wTracer *WrapperTracer } diff --git a/example/namedtracer/main.go b/example/namedtracer/main.go index bde51637f8b..68c51ce45c8 100644 --- a/example/namedtracer/main.go +++ b/example/namedtracer/main.go @@ -16,6 +16,7 @@ package main import ( "context" + "fmt" "log" "github.com/go-logr/stdr" @@ -38,12 +39,10 @@ var ( var tp *sdktrace.TracerProvider // initTracer creates and registers trace provider instance. -func initTracer() { - var err error +func initTracer() error { exp, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) if err != nil { - log.Panicf("failed to initialize stdouttrace exporter %v\n", err) - return + return fmt.Errorf("failed to initialize stdouttrace exporter: %w", err) } bsp := sdktrace.NewBatchSpanProcessor(exp) tp = sdktrace.NewTracerProvider( @@ -51,6 +50,7 @@ func initTracer() { sdktrace.WithSpanProcessor(bsp), ) otel.SetTracerProvider(tp) + return nil } func main() { @@ -58,7 +58,9 @@ func main() { stdr.SetVerbosity(5) // initialize trace provider. - initTracer() + if err := initTracer(); err != nil { + log.Panic(err) + } // Create a named tracer with package path as its name. tracer := tp.Tracer("example/namedtracer/main") diff --git a/example/opencensus/main.go b/example/opencensus/main.go index 536cce597fa..26c648d5948 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -62,7 +62,9 @@ func main() { log.Fatal(fmt.Errorf("error creating metric exporter: %w", err)) } tracing(traceExporter) - monitoring(metricsExporter) + if err := monitoring(metricsExporter); err != nil { + log.Fatal(err) + } } // tracing demonstrates overriding the OpenCensus DefaultTracer to send spans @@ -100,18 +102,18 @@ func tracing(otExporter sdktrace.SpanExporter) { // monitoring demonstrates creating an IntervalReader using the OpenTelemetry // exporter to send metrics to the exporter by using either an OpenCensus // registry or an OpenCensus view. -func monitoring(otExporter export.Exporter) { +func monitoring(otExporter export.Exporter) error { log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.") ocExporter := opencensus.NewMetricExporter(otExporter) intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter) if err != nil { - log.Fatalf("Failed to create interval reader: %v\n", err) + return fmt.Errorf("failed to create interval reader: %w", err) } intervalReader.ReportingInterval = 10 * time.Second log.Println("Emitting metrics using OpenCensus APIs. These should be printed out using the OpenTelemetry stdoutmetric exporter.") err = intervalReader.Start() if err != nil { - log.Fatalf("Failed to start interval reader: %v\n", err) + return fmt.Errorf("failed to start interval reader: %w", err) } defer intervalReader.Stop() @@ -126,20 +128,20 @@ func monitoring(otExporter export.Exporter) { }), ) if err != nil { - log.Fatalf("Failed to add gauge: %v\n", err) + return fmt.Errorf("failed to add gauge: %w", err) } entry, err := gauge.GetEntry() if err != nil { - log.Fatalf("Failed to get gauge entry: %v\n", err) + return fmt.Errorf("failed to get gauge entry: %w", err) } log.Println("Registering a cumulative metric using an OpenCensus view.") if err := view.Register(countView); err != nil { - log.Fatalf("Failed to register views: %v", err) + return fmt.Errorf("failed to register views: %w", err) } ctx, err := tag.New(context.Background(), tag.Insert(keyType, "view")) if err != nil { - log.Fatalf("Failed to set tag: %v\n", err) + return fmt.Errorf("failed to set tag: %w", err) } for i := int64(1); true; i++ { // update stats for our gauge @@ -148,4 +150,5 @@ func monitoring(otExporter export.Exporter) { stats.Record(ctx, countMeasure.M(1)) time.Sleep(time.Second) } + return nil } diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 855a55e14bd..c3372ab482a 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -21,6 +21,8 @@ import ( "context" "fmt" "log" + "os" + "os/signal" "time" "google.golang.org/grpc" @@ -38,7 +40,7 @@ import ( // Initializes an OTLP exporter, and configures the corresponding trace and // metric providers. -func initProvider() func() { +func initProvider() (func(context.Context) error, error) { ctx := context.Background() res, err := resource.New(ctx, @@ -47,7 +49,9 @@ func initProvider() func() { semconv.ServiceNameKey.String("test-service"), ), ) - handleErr(err, "failed to create resource") + if err != nil { + return nil, fmt.Errorf("failed to create resource: %w", err) + } // If the OpenTelemetry Collector is running on a local cluster (minikube or // microk8s), it should be accessible through the NodePort service at the @@ -55,11 +59,15 @@ func initProvider() func() { // endpoint of your cluster. If you run the app inside k8s, then you can // probably connect directly to the service through dns conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) - handleErr(err, "failed to create gRPC connection to collector") + if err != nil { + return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err) + } // Set up a trace exporter traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithGRPCConn(conn)) - handleErr(err, "failed to create trace exporter") + if err != nil { + return nil, fmt.Errorf("failed to create trace exporter: %w", err) + } // Register the trace exporter with a TracerProvider, using a batch // span processor to aggregate spans before export. @@ -74,17 +82,25 @@ func initProvider() func() { // set global propagator to tracecontext (the default is no-op). otel.SetTextMapPropagator(propagation.TraceContext{}) - return func() { - // Shutdown will flush any remaining spans and shut down the exporter. - handleErr(tracerProvider.Shutdown(ctx), "failed to shutdown TracerProvider") - } + // Shutdown will flush any remaining spans and shut down the exporter. + return tracerProvider.Shutdown, nil } func main() { log.Printf("Waiting for connection...") - shutdown := initProvider() - defer shutdown() + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) + defer cancel() + + shutdown, err := initProvider() + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal("failed to shutdown TracerProvider: %w", err) + } + }() tracer := otel.Tracer("test-tracer") @@ -98,7 +114,7 @@ func main() { // work begins ctx, span := tracer.Start( - context.Background(), + ctx, "CollectorExporter-Example", trace.WithAttributes(commonAttrs...)) defer span.End() @@ -112,9 +128,3 @@ func main() { log.Printf("Done!") } - -func handleErr(err error, message string) { - if err != nil { - log.Fatalf("%s: %v", message, err) - } -} diff --git a/example/passthrough/handler/handler.go b/example/passthrough/handler/handler.go index 1ba439deac2..b199dd2cf94 100644 --- a/example/passthrough/handler/handler.go +++ b/example/passthrough/handler/handler.go @@ -34,6 +34,8 @@ type Handler struct { next func(r *http.Request) } +// New returns a new Handler that will trace requests before handing them off +// to next. func New(next func(r *http.Request)) *Handler { // Like most instrumentation packages, this handler defaults to using the // global progatators and tracer providers. diff --git a/example/passthrough/main.go b/example/passthrough/main.go index cfab1dabb21..edd8f443016 100644 --- a/example/passthrough/main.go +++ b/example/passthrough/main.go @@ -16,6 +16,7 @@ package main import ( "context" + "fmt" "log" "net/http" "time" @@ -32,7 +33,10 @@ func main() { ctx := context.Background() initPassthroughGlobals() - tp := nonGlobalTracer() + tp, err := nonGlobalTracer() + if err != nil { + log.Fatal(err) + } defer func() { _ = tp.Shutdown(ctx) }() // make an initial http request @@ -74,16 +78,15 @@ func initPassthroughGlobals() { // nonGlobalTracer creates a trace provider instance for testing, but doesn't // set it as the global tracer provider. -func nonGlobalTracer() *sdktrace.TracerProvider { - var err error +func nonGlobalTracer() (*sdktrace.TracerProvider, error) { exp, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) if err != nil { - log.Panicf("failed to initialize stdouttrace exporter %v\n", err) + return nil, fmt.Errorf("failed to initialize stdouttrace exporter: %w", err) } bsp := sdktrace.NewBatchSpanProcessor(exp) tp := sdktrace.NewTracerProvider( sdktrace.WithSampler(sdktrace.AlwaysSample()), sdktrace.WithSpanProcessor(bsp), ) - return tp + return tp, nil } diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 7b522456972..1a64371b764 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -19,6 +19,8 @@ import ( "fmt" "log" "net/http" + "os" + "os/signal" "sync" "time" @@ -37,7 +39,7 @@ var ( lemonsKey = attribute.Key("ex.com/lemons") ) -func initMeter() { +func initMeter() error { config := prometheus.Config{ DefaultHistogramBoundaries: []float64{1, 2, 5, 10, 20, 50}, } @@ -52,7 +54,7 @@ func initMeter() { ) exporter, err := prometheus.New(config, c) if err != nil { - log.Panicf("failed to initialize prometheus exporter %v", err) + return fmt.Errorf("failed to initialize prometheus exporter: %w", err) } global.SetMeterProvider(exporter.MeterProvider()) @@ -63,10 +65,13 @@ func initMeter() { }() fmt.Println("Prometheus server running on :2222") + return nil } func main() { - initMeter() + if err := initMeter(); err != nil { + log.Fatal(err) + } meter := global.Meter("ex.com/basic") @@ -86,7 +91,7 @@ func main() { gaugeObserver.Observe(ctx, value, attrs...) }) - histogram, err := meter.SyncFloat64().Histogram("ex.com.two") + hist, err := meter.SyncFloat64().Histogram("ex.com.two") if err != nil { log.Panicf("failed to initialize instrument: %v", err) } @@ -98,14 +103,15 @@ func main() { commonAttrs := []attribute.KeyValue{lemonsKey.Int(10), attribute.String("A", "1"), attribute.String("B", "2"), attribute.String("C", "3")} notSoCommonAttrs := []attribute.KeyValue{lemonsKey.Int(13)} - ctx := context.Background() + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) + defer stop() (*observerLock).Lock() *observerValueToReport = 1.0 *observerAttrsToReport = commonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 2.0, commonAttrs...) + hist.Record(ctx, 2.0, commonAttrs...) counter.Add(ctx, 12.0, commonAttrs...) time.Sleep(5 * time.Second) @@ -114,7 +120,7 @@ func main() { *observerValueToReport = 1.0 *observerAttrsToReport = notSoCommonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 2.0, notSoCommonAttrs...) + hist.Record(ctx, 2.0, notSoCommonAttrs...) counter.Add(ctx, 22.0, notSoCommonAttrs...) time.Sleep(5 * time.Second) @@ -123,10 +129,10 @@ func main() { *observerValueToReport = 13.0 *observerAttrsToReport = commonAttrs (*observerLock).Unlock() - histogram.Record(ctx, 12.0, commonAttrs...) + hist.Record(ctx, 12.0, commonAttrs...) counter.Add(ctx, 13.0, commonAttrs...) fmt.Println("Example finished updating, please visit :2222") - select {} + <-ctx.Done() } diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 4b6b2c396ba..c2e4a5f57b1 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -21,6 +21,7 @@ import ( "flag" "log" "os" + "os/signal" "time" "go.opentelemetry.io/otel" @@ -34,7 +35,7 @@ import ( var logger = log.New(os.Stderr, "zipkin-example", log.Ldate|log.Ltime|log.Llongfile) // initTracer creates a new trace provider instance and registers it as global trace provider. -func initTracer(url string) func() { +func initTracer(url string) (func(context.Context) error, error) { // Create Zipkin Exporter and install it as a global tracer. // // For demoing purposes, always sample. In a production application, you should @@ -45,7 +46,7 @@ func initTracer(url string) func() { zipkin.WithLogger(logger), ) if err != nil { - log.Fatal(err) + return nil, err } batcher := sdktrace.NewBatchSpanProcessor(exporter) @@ -59,19 +60,25 @@ func initTracer(url string) func() { ) otel.SetTracerProvider(tp) - return func() { - _ = tp.Shutdown(context.Background()) - } + return tp.Shutdown, nil } func main() { url := flag.String("zipkin", "http://localhost:9411/api/v2/spans", "zipkin url") flag.Parse() - shutdown := initTracer(*url) - defer shutdown() + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) + defer cancel() - ctx := context.Background() + shutdown, err := initTracer(*url) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal("failed to shutdown TracerProvider: %w", err) + } + }() tr := otel.GetTracerProvider().Tracer("component-main") ctx, span := tr.Start(ctx, "foo", trace.WithSpanKind(trace.SpanKindServer)) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index 819db82c149..d9b58ec4f82 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -263,8 +263,8 @@ func keyValueToTag(keyValue attribute.KeyValue) *gen.Tag { attribute.INT64SLICE, attribute.FLOAT64SLICE, attribute.STRINGSLICE: - json, _ := json.Marshal(keyValue.Value.AsInterface()) - a := (string)(json) + data, _ := json.Marshal(keyValue.Value.AsInterface()) + a := (string)(data) tag = &gen.Tag{ Key: string(keyValue.Key), VStr: &a, diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go index f21d4c13b0f..ba4b6cbef31 100644 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ b/exporters/jaeger/reconnecting_udp_client_test.go @@ -67,13 +67,15 @@ func newUDPConn() (net.PacketConn, *net.UDPConn, error) { addr, err := net.ResolveUDPAddr("udp", mockServer.LocalAddr().String()) if err != nil { - mockServer.Close() + // Best effort. + _ = mockServer.Close() return nil, nil, err } conn, err := net.DialUDP("udp", nil, addr) if err != nil { - mockServer.Close() + // Best effort. + _ = mockServer.Close() return nil, nil, err } diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index c5cdb0040c0..0b9d6e14d3e 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -34,6 +34,7 @@ type batchUploader interface { shutdown(context.Context) error } +// EndpointOption configures a Jaeger endpoint. type EndpointOption interface { newBatchUploader() (batchUploader, error) } @@ -75,6 +76,7 @@ func WithAgentEndpoint(options ...AgentEndpointOption) EndpointOption { }) } +// AgentEndpointOption configures a Jaeger agent endpoint. type AgentEndpointOption interface { apply(agentEndpointConfig) agentEndpointConfig } @@ -175,6 +177,7 @@ func WithCollectorEndpoint(options ...CollectorEndpointOption) EndpointOption { }) } +// CollectorEndpointOption configures a Jaeger collector endpoint. type CollectorEndpointOption interface { apply(collectorEndpointConfig) collectorEndpointConfig } @@ -306,7 +309,9 @@ func (c *collectorUploader) upload(ctx context.Context, batch *gen.Batch) error } _, _ = io.Copy(ioutil.Discard, resp.Body) - resp.Body.Close() + if err = resp.Body.Close(); err != nil { + return err + } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return fmt.Errorf("failed to upload traces; HTTP status code: %d", resp.StatusCode) diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index caf21eaf2a3..e46c6bea790 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -74,7 +74,6 @@ func (e *Exporter) Start(ctx context.Context) error { // Shutdown flushes all exports and closes all connections to the receiving endpoint. func (e *Exporter) Shutdown(ctx context.Context) error { - e.mu.RLock() started := e.started e.mu.RUnlock() @@ -95,6 +94,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return err } +// TemporalityFor returns the accepted temporality for a metric measurment. func (e *Exporter) TemporalityFor(descriptor *sdkapi.Descriptor, kind aggregation.Kind) aggregation.Temporality { return e.temporalitySelector.TemporalityFor(descriptor, kind) } diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 3b10722d3a5..d5208fc26d6 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -233,7 +233,7 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { append(baseKeyValues, cpuKey.Int(1)), testLibName, ) - sum := 11.0 + sumVal := 11.0 expected := []*metricpb.ResourceMetrics{ { Resource: nil, @@ -251,14 +251,14 @@ func TestHistogramInt64MetricGroupingExport(t *testing.T) { StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, - Sum: &sum, + Sum: &sumVal, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, }, { Attributes: cpu1Attrs, Count: 2, - Sum: &sum, + Sum: &sumVal, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, StartTimeUnixNano: startTime(), @@ -284,7 +284,7 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { append(baseKeyValues, cpuKey.Int(1)), testLibName, ) - sum := 11.0 + sumVal := 11.0 expected := []*metricpb.ResourceMetrics{ { Resource: nil, @@ -302,14 +302,14 @@ func TestHistogramFloat64MetricGroupingExport(t *testing.T) { StartTimeUnixNano: startTime(), TimeUnixNano: pointTime(), Count: 2, - Sum: &sum, + Sum: &sumVal, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, }, { Attributes: cpu1Attrs, Count: 2, - Sum: &sum, + Sum: &sumVal, ExplicitBounds: testHistogramBoundaries, BucketCounts: []uint64{1, 0, 0, 1}, StartTimeUnixNano: startTime(), diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go b/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go index 4a59073824c..5432906cf95 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go @@ -48,8 +48,8 @@ func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { } // ResourceAttributes transforms a Resource OTLP key-values. -func ResourceAttributes(resource *resource.Resource) []*commonpb.KeyValue { - return Iterator(resource.Iter()) +func ResourceAttributes(res *resource.Resource) []*commonpb.KeyValue { + return Iterator(res.Iter()) } // KeyValue transforms an attribute KeyValue into an OTLP key-value. diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go index 4c468da694c..e728e24b721 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go @@ -168,7 +168,6 @@ func TestArrayAttributes(t *testing.T) { assertExpectedArrayValues(t, expected.Values, actual.Values) } } - } } diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go index c3c514d5a6c..2d7c9049905 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go @@ -75,7 +75,6 @@ func InstrumentationLibraryReader(ctx context.Context, temporalitySelector aggre var sms []*metricpb.ScopeMetrics err := ilmr.ForEach(func(lib instrumentation.Library, mr export.Reader) error { - records, errc := source(ctx, temporalitySelector, mr) // Start a fixed number of goroutines to transform records. @@ -194,7 +193,6 @@ func sink(ctx context.Context, in <-chan result) ([]*metricpb.Metric, error) { if !ok { grouped[mID] = res.Metric continue - } // Note: There is extra work happening in this code that can be // improved when the work described in #2119 is completed. The SDK has diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go index 43f0c56b940..3acf98e0cda 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go @@ -165,7 +165,6 @@ func TestSumFloatDataPoints(t *testing.T) { }}}, m.GetSum()) assert.Nil(t, m.GetHistogram()) assert.Nil(t, m.GetSummary()) - } } @@ -231,13 +230,13 @@ func (t *testAgg) Aggregation() aggregation.Aggregation { // None of these three are used: -func (t *testAgg) Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error { +func (t *testAgg) Update(context.Context, number.Number, *sdkapi.Descriptor) error { return nil } -func (t *testAgg) SynchronizedMove(destination aggregator.Aggregator, descriptor *sdkapi.Descriptor) error { +func (t *testAgg) SynchronizedMove(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } -func (t *testAgg) Merge(aggregator aggregator.Aggregator, descriptor *sdkapi.Descriptor) error { +func (t *testAgg) Merge(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index 36737c9c0e7..44c295169e8 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -109,8 +109,7 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { cp := NoCompression - switch v { - case "gzip": + if v == "gzip" { cp = GzipCompression } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go index 9bfafcf85fe..7687e3fdbb3 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go @@ -60,7 +60,7 @@ func (f *fileReader) readFile(filename string) ([]byte, error) { if b, ok := (*f)[filename]; ok { return b, nil } - return nil, errors.New("File not found") + return nil, errors.New("file not found") } func TestConfigs(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index cb67a4fe812..16cc5322da8 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -265,8 +265,8 @@ func retryable(err error) (bool, time.Duration) { // throttleDelay returns a duration to wait for if an explicit throttle time // is included in the response status. -func throttleDelay(status *status.Status) time.Duration { - for _, detail := range status.Details() { +func throttleDelay(s *status.Status) time.Duration { + for _, detail := range s.Details() { if t, ok := detail.(*errdetails.RetryInfo); ok { return t.RetryDelay.AsDuration() } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 694bb3c270a..1f54bf5c610 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -249,7 +249,6 @@ func TestNewExporterWithTimeout(t *testing.T) { for _, tt := range tts { t.Run(tt.name, func(t *testing.T) { - mc := runMockCollector(t) if tt.delay { mc.metricSvc.delay = time.Second * 10 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go index 27769ff6b7c..e733677f00d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go @@ -84,8 +84,7 @@ func WithReconnectionPeriod(rp time.Duration) Option { } func compressorToCompression(compressor string) otlpconfig.Compression { - switch compressor { - case "gzip": + if compressor == "gzip" { return otlpconfig.GzipCompression } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index c2c56595985..2fafbcd82bf 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -118,8 +118,7 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt return func(e *envconfig.EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { cp := NoCompression - switch v { - case "gzip": + if v == "gzip" { cp = GzipCompression } diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index 3d50e057bef..adbdc932f53 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -60,7 +60,7 @@ func (f *fileReader) readFile(filename string) ([]byte, error) { if b, ok := (*f)[filename]; ok { return b, nil } - return nil, errors.New("File not found") + return nil, errors.New("file not found") } func TestConfigs(t *testing.T) { diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index d9086a390de..ec74f1aad75 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -48,8 +48,8 @@ func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { } // ResourceAttributes transforms a Resource OTLP key-values. -func ResourceAttributes(resource *resource.Resource) []*commonpb.KeyValue { - return Iterator(resource.Iter()) +func ResourceAttributes(res *resource.Resource) []*commonpb.KeyValue { + return Iterator(res.Iter()) } // KeyValue transforms an attribute KeyValue into an OTLP key-value. diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go index 09f6a4c335d..3f335f12392 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go @@ -168,7 +168,6 @@ func TestArrayAttributes(t *testing.T) { assertExpectedArrayValues(t, expected.Values, actual.Values) } } - } } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index b091b81c921..3bb203eae80 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -175,7 +175,6 @@ func TestStatus(t *testing.T) { expected := &tracepb.Status{Code: test.otlpStatus, Message: test.message} assert.Equal(t, expected, status(test.code, test.message)) } - } func TestNilSpan(t *testing.T) { diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 31ed8190b67..6be3fec8626 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -265,8 +265,8 @@ func retryable(err error) (bool, time.Duration) { // throttleDelay returns a duration to wait for if an explicit throttle time // is included in the response status. -func throttleDelay(status *status.Status) time.Duration { - for _, detail := range status.Details() { +func throttleDelay(s *status.Status) time.Duration { + for _, detail := range s.Details() { if t, ok := detail.(*errdetails.RetryInfo); ok { return t.RetryDelay.AsDuration() } diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index e2e5bd696f6..3d09ce590d0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -84,8 +84,7 @@ func WithReconnectionPeriod(rp time.Duration) Option { } func compressorToCompression(compressor string) otlpconfig.Compression { - switch compressor { - case "gzip": + if compressor == "gzip" { return otlpconfig.GzipCompression } diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 10027c03e9f..459ee94d6f8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -16,6 +16,7 @@ package otlptracehttp_test import ( "context" + "fmt" "log" "go.opentelemetry.io/otel" @@ -64,11 +65,11 @@ func newResource() *resource.Resource { ) } -func installExportPipeline(ctx context.Context) func() { +func installExportPipeline(ctx context.Context) (func(context.Context) error, error) { client := otlptracehttp.NewClient() exporter, err := otlptrace.New(ctx, client) if err != nil { - log.Fatalf("creating OTLP trace exporter: %v", err) + return nil, fmt.Errorf("creating OTLP trace exporter: %w", err) } tracerProvider := sdktrace.NewTracerProvider( @@ -77,18 +78,21 @@ func installExportPipeline(ctx context.Context) func() { ) otel.SetTracerProvider(tracerProvider) - return func() { - if err := tracerProvider.Shutdown(ctx); err != nil { - log.Fatalf("stopping tracer provider: %v", err) - } - } + return tracerProvider.Shutdown, nil } func Example() { ctx := context.Background() // Registers a tracer Provider globally. - cleanup := installExportPipeline(ctx) - defer cleanup() + shutdown, err := installExportPipeline(ctx) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal(err) + } + }() log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) } diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go index 238f6e56c89..fb544d004fb 100644 --- a/exporters/prometheus/prometheus.go +++ b/exporters/prometheus/prometheus.go @@ -88,7 +88,7 @@ type Config struct { // New returns a new Prometheus exporter using the configured metric // controller. See controller.New(). -func New(config Config, controller *controller.Controller) (*Exporter, error) { +func New(config Config, ctrl *controller.Controller) (*Exporter, error) { if config.Registry == nil { config.Registry = prometheus.NewRegistry() } @@ -105,7 +105,7 @@ func New(config Config, controller *controller.Controller) (*Exporter, error) { handler: promhttp.HandlerFor(config.Gatherer, promhttp.HandlerOpts{}), registerer: config.Registerer, gatherer: config.Gatherer, - controller: controller, + controller: ctrl, } c := &collector{ @@ -176,7 +176,6 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { err := ctrl.ForEach(func(_ instrumentation.Library, reader export.Reader) error { return reader.ForEach(c.exp, func(record export.Record) error { - agg := record.Aggregation() numberKind := record.Descriptor().NumberKind() instrumentKind := record.Descriptor().InstrumentKind() @@ -186,23 +185,26 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { desc := c.toDesc(record, attrKeys) - if hist, ok := agg.(aggregation.Histogram); ok { - if err := c.exportHistogram(ch, hist, numberKind, desc, attrs); err != nil { + switch v := agg.(type) { + case aggregation.Histogram: + if err := c.exportHistogram(ch, v, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting histogram: %w", err) } - } else if sum, ok := agg.(aggregation.Sum); ok && instrumentKind.Monotonic() { - if err := c.exportMonotonicCounter(ch, sum, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting monotonic counter: %w", err) - } - } else if sum, ok := agg.(aggregation.Sum); ok && !instrumentKind.Monotonic() { - if err := c.exportNonMonotonicCounter(ch, sum, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting non monotonic counter: %w", err) + case aggregation.Sum: + if instrumentKind.Monotonic() { + if err := c.exportMonotonicCounter(ch, v, numberKind, desc, attrs); err != nil { + return fmt.Errorf("exporting monotonic counter: %w", err) + } + } else { + if err := c.exportNonMonotonicCounter(ch, v, numberKind, desc, attrs); err != nil { + return fmt.Errorf("exporting non monotonic counter: %w", err) + } } - } else if lastValue, ok := agg.(aggregation.LastValue); ok { - if err := c.exportLastValue(ch, lastValue, numberKind, desc, attrs); err != nil { + case aggregation.LastValue: + if err := c.exportLastValue(ch, v, numberKind, desc, attrs); err != nil { return fmt.Errorf("exporting last value: %w", err) } - } else { + default: return fmt.Errorf("%w: %s", ErrUnsupportedAggregator, agg.Kind()) } return nil diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go index 6281fe28005..749965ba575 100644 --- a/exporters/prometheus/prometheus_test.go +++ b/exporters/prometheus/prometheus_test.go @@ -111,7 +111,7 @@ func TestPrometheusExporter(t *testing.T) { require.NoError(t, err) counter, err := meter.SyncFloat64().Counter("counter") require.NoError(t, err) - histogram, err := meter.SyncFloat64().Histogram("histogram") + hist, err := meter.SyncFloat64().Histogram("histogram") require.NoError(t, err) attrs := []attribute.KeyValue{ @@ -137,10 +137,10 @@ func TestPrometheusExporter(t *testing.T) { expected = append(expected, expectGauge("intgaugeobserver", `intgaugeobserver{A="B",C="D",R="V"} 1`)) - histogram.Record(ctx, -0.6, attrs...) - histogram.Record(ctx, -0.4, attrs...) - histogram.Record(ctx, 0.6, attrs...) - histogram.Record(ctx, 20, attrs...) + hist.Record(ctx, -0.6, attrs...) + hist.Record(ctx, -0.4, attrs...) + hist.Record(ctx, 0.6, attrs...) + hist.Record(ctx, 20, attrs...) expected = append(expected, expectHistogram("histogram", `histogram_bucket{A="B",C="D",R="V",le="-0.5"} 1`, diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index f01c02afb51..95374aaef1d 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -55,7 +55,6 @@ func newConfig(options ...Option) (config, error) { } for _, opt := range options { cfg = opt.apply(cfg) - } return cfg, nil } diff --git a/exporters/stdout/stdoutmetric/doc.go b/exporters/stdout/stdoutmetric/doc.go index 4cf41f32121..0bffd34b9ff 100644 --- a/exporters/stdout/stdoutmetric/doc.go +++ b/exporters/stdout/stdoutmetric/doc.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package stdout contains an OpenTelemetry exporter for metric telemetry -// to be written to an output destination as JSON. +// Package stdoutmetric contains an OpenTelemetry exporter for metric +// telemetry to be written to an output destination as JSON. // // This package is currently in a pre-GA phase. Backwards incompatible changes // may be introduced in subsequent minor version releases as we work to track diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 1d85a422235..82723ffa7ce 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -16,6 +16,7 @@ package stdoutmetric_test import ( "context" + "fmt" "log" "go.opentelemetry.io/otel/attribute" @@ -60,10 +61,10 @@ func multiply(ctx context.Context, x, y int64) int64 { return x * y } -func InstallExportPipeline(ctx context.Context) func() { +func InstallExportPipeline(ctx context.Context) (func(context.Context) error, error) { exporter, err := stdoutmetric.New(stdoutmetric.WithPrettyPrint()) if err != nil { - log.Fatalf("creating stdoutmetric exporter: %v", err) + return nil, fmt.Errorf("creating stdoutmetric exporter: %w", err) } pusher := controller.New( @@ -89,19 +90,22 @@ func InstallExportPipeline(ctx context.Context) func() { log.Fatalf("creating instrument: %v", err) } - return func() { - if err := pusher.Stop(ctx); err != nil { - log.Fatalf("stopping push controller: %v", err) - } - } + return pusher.Stop, nil } func Example() { ctx := context.Background() // TODO: Registers a meter Provider globally. - cleanup := InstallExportPipeline(ctx) - defer cleanup() + shutdown, err := InstallExportPipeline(ctx) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal(err) + } + }() log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) } diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index e1ea02339c0..5f8ff4f7baf 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -16,6 +16,8 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdout import "go.opentelemetry.io/otel/sdk/metric/export" +// Exporter is an OpenTelemetry metric exporter that transmits telemetry to +// the local STDOUT. type Exporter struct { metricExporter } diff --git a/exporters/stdout/stdoutmetric/metric.go b/exporters/stdout/stdoutmetric/metric.go index 23fe9c6e71c..38289d281a7 100644 --- a/exporters/stdout/stdoutmetric/metric.go +++ b/exporters/stdout/stdoutmetric/metric.go @@ -53,7 +53,6 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade var aggError error var batch []line aggError = reader.ForEach(func(lib instrumentation.Library, mr export.Reader) error { - var instAttrs []attribute.KeyValue if name := lib.Name; name != "" { instAttrs = append(instAttrs, attribute.String("instrumentation.name", name)) @@ -101,20 +100,20 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade var sb strings.Builder - sb.WriteString(desc.Name()) + _, _ = sb.WriteString(desc.Name()) if len(encodedAttrs) > 0 || len(encodedResource) > 0 || len(encodedInstAttrs) > 0 { - sb.WriteRune('{') - sb.WriteString(encodedResource) + _, _ = sb.WriteRune('{') + _, _ = sb.WriteString(encodedResource) if len(encodedInstAttrs) > 0 && len(encodedResource) > 0 { - sb.WriteRune(',') + _, _ = sb.WriteRune(',') } - sb.WriteString(encodedInstAttrs) + _, _ = sb.WriteString(encodedInstAttrs) if len(encodedAttrs) > 0 && (len(encodedInstAttrs) > 0 || len(encodedResource) > 0) { - sb.WriteRune(',') + _, _ = sb.WriteRune(',') } - sb.WriteString(encodedAttrs) - sb.WriteRune('}') + _, _ = sb.WriteString(encodedAttrs) + _, _ = sb.WriteRune('}') } expose.Name = sb.String() diff --git a/exporters/stdout/stdouttrace/config.go b/exporters/stdout/stdouttrace/config.go index 6b5a97b04cf..2cb534a75e9 100644 --- a/exporters/stdout/stdouttrace/config.go +++ b/exporters/stdout/stdouttrace/config.go @@ -48,7 +48,6 @@ func newConfig(options ...Option) (config, error) { } for _, opt := range options { cfg = opt.apply(cfg) - } return cfg, nil } diff --git a/exporters/stdout/stdouttrace/doc.go b/exporters/stdout/stdouttrace/doc.go index b76af55960f..8da3268c7c7 100644 --- a/exporters/stdout/stdouttrace/doc.go +++ b/exporters/stdout/stdouttrace/doc.go @@ -12,6 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package stdout contains an OpenTelemetry exporter for tracing +// Package stdouttrace contains an OpenTelemetry exporter for tracing // telemetry to be written to an output destination as JSON. package stdouttrace // import "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index cedfeae6a60..3a8c1c005d7 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -16,6 +16,7 @@ package stdouttrace_test import ( "context" + "fmt" "log" "go.opentelemetry.io/otel" @@ -63,10 +64,10 @@ func Resource() *resource.Resource { ) } -func InstallExportPipeline(ctx context.Context) func() { +func InstallExportPipeline(ctx context.Context) (func(context.Context) error, error) { exporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) if err != nil { - log.Fatalf("creating stdout exporter: %v", err) + return nil, fmt.Errorf("creating stdout exporter: %w", err) } tracerProvider := sdktrace.NewTracerProvider( @@ -75,19 +76,22 @@ func InstallExportPipeline(ctx context.Context) func() { ) otel.SetTracerProvider(tracerProvider) - return func() { - if err := tracerProvider.Shutdown(ctx); err != nil { - log.Fatalf("stopping tracer provider: %v", err) - } - } + return tracerProvider.Shutdown, nil } func Example() { ctx := context.Background() // Registers a tracer Provider globally. - cleanup := InstallExportPipeline(ctx) - defer cleanup() + shutdown, err := InstallExportPipeline(ctx) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal(err) + } + }() log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) } diff --git a/exporters/stdout/stdouttrace/trace_test.go b/exporters/stdout/stdouttrace/trace_test.go index 77ceae2baeb..649312bf697 100644 --- a/exporters/stdout/stdouttrace/trace_test.go +++ b/exporters/stdout/stdouttrace/trace_test.go @@ -41,7 +41,7 @@ func TestExporterExportSpan(t *testing.T) { traceState, _ := trace.ParseTraceState("key=val") keyValue := "value" doubleValue := 123.456 - resource := resource.NewSchemaless(attribute.String("rk1", "rv11")) + res := resource.NewSchemaless(attribute.String("rk1", "rv11")) ss := tracetest.SpanStub{ SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ @@ -65,7 +65,7 @@ func TestExporterExportSpan(t *testing.T) { Code: codes.Error, Description: "interesting", }, - Resource: resource, + Resource: res, } tests := []struct { diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index e3a84ba6ac9..f733651dac6 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" tracesdk "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.10.0" "go.opentelemetry.io/otel/trace" @@ -160,8 +159,8 @@ func toZipkinAnnotations(events []tracesdk.Event) []zkmodel.Annotation { func attributesToJSONMapString(attributes []attribute.KeyValue) string { m := make(map[string]interface{}, len(attributes)) - for _, attribute := range attributes { - m[(string)(attribute.Key)] = attribute.Value.AsInterface() + for _, a := range attributes { + m[(string)(a.Key)] = a.Value.AsInterface() } // if an error happens, the result will be an empty string jsonBytes, _ := json.Marshal(m) @@ -173,17 +172,17 @@ func attributeToStringPair(kv attribute.KeyValue) (string, string) { switch kv.Value.Type() { // For slice attributes, serialize as JSON list string. case attribute.BOOLSLICE: - json, _ := json.Marshal(kv.Value.AsBoolSlice()) - return (string)(kv.Key), (string)(json) + data, _ := json.Marshal(kv.Value.AsBoolSlice()) + return (string)(kv.Key), (string)(data) case attribute.INT64SLICE: - json, _ := json.Marshal(kv.Value.AsInt64Slice()) - return (string)(kv.Key), (string)(json) + data, _ := json.Marshal(kv.Value.AsInt64Slice()) + return (string)(kv.Key), (string)(data) case attribute.FLOAT64SLICE: - json, _ := json.Marshal(kv.Value.AsFloat64Slice()) - return (string)(kv.Key), (string)(json) + data, _ := json.Marshal(kv.Value.AsFloat64Slice()) + return (string)(kv.Key), (string)(data) case attribute.STRINGSLICE: - json, _ := json.Marshal(kv.Value.AsStringSlice()) - return (string)(kv.Key), (string)(json) + data, _ := json.Marshal(kv.Value.AsStringSlice()) + return (string)(kv.Key), (string)(data) default: return (string)(kv.Key), kv.Value.Emit() } @@ -245,7 +244,7 @@ var remoteEndpointKeyRank = map[attribute.Key]int{ semconv.DBNameKey: 6, } -func toZipkinRemoteEndpoint(data sdktrace.ReadOnlySpan) *zkmodel.Endpoint { +func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint { // Should be set only for client or producer kind if sk := data.SpanKind(); sk != trace.SpanKindClient && sk != trace.SpanKindProducer { return nil diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 5bf169baf7d..f8869988e7a 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -37,7 +37,7 @@ import ( ) func TestModelConversion(t *testing.T) { - resource := resource.NewSchemaless( + res := resource.NewSchemaless( semconv.ServiceNameKey.String("model-test"), semconv.ServiceVersionKey.String("0.1.0"), attribute.Int64("resource-attr1", 42), @@ -82,7 +82,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data with no parent (same as typical, but has // invalid parent) @@ -117,7 +117,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data of unspecified kind { @@ -155,7 +155,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data of internal kind { @@ -193,7 +193,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data of client kind { @@ -234,7 +234,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data of producer kind { @@ -272,7 +272,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data of consumer kind { @@ -310,7 +310,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data with no events { @@ -335,7 +335,7 @@ func TestModelConversion(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // span data with an "error" attribute set to "false" { @@ -368,7 +368,7 @@ func TestModelConversion(t *testing.T) { Attributes: nil, }, }, - Resource: resource, + Resource: res, }, }.Snapshots() diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index bd2ed89f878..183a536b9c2 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -198,7 +198,7 @@ func logStoreLogger(s *logStore) *log.Logger { } func TestExportSpans(t *testing.T) { - resource := resource.NewSchemaless( + res := resource.NewSchemaless( semconv.ServiceNameKey.String("exporter-test"), semconv.ServiceVersionKey.String("0.1.0"), ) @@ -220,7 +220,7 @@ func TestExportSpans(t *testing.T) { Code: codes.Error, Description: "404, file not found", }, - Resource: resource, + Resource: res, }, // child { @@ -242,7 +242,7 @@ func TestExportSpans(t *testing.T) { Code: codes.Error, Description: "403, forbidden", }, - Resource: resource, + Resource: res, }, }.Snapshots() models := []zkmodel.SpanModel{ diff --git a/handler.go b/handler.go index b5797bceaa9..36cf09f7290 100644 --- a/handler.go +++ b/handler.go @@ -56,7 +56,6 @@ func defaultErrorHandler() *delegator { lock: &sync.RWMutex{}, eh: &errLogger{l: log.New(os.Stderr, "", log.LstdFlags)}, } - } // errLogger logs errors if no delegate is set, otherwise they are delegated. diff --git a/handler_test.go b/handler_test.go index b06fea071eb..8a7c4301543 100644 --- a/handler_test.go +++ b/handler_test.go @@ -125,7 +125,7 @@ func TestHandlerTestSuite(t *testing.T) { func TestHandlerRace(t *testing.T) { go SetErrorHandler(&errLogger{log.New(os.Stderr, "", 0)}) - go Handle(errors.New("Error")) + go Handle(errors.New("error")) } func BenchmarkErrorHandler(b *testing.B) { @@ -135,7 +135,7 @@ func BenchmarkErrorHandler(b *testing.B) { globalErrorHandler.setDelegate(primary) - err := errors.New("BenchmarkErrorHandler") + err := errors.New("benchmark error handler") b.ReportAllocs() b.ResetTimer() @@ -184,7 +184,7 @@ func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { ) eh := GetErrorHandler() - err := errors.New("BenchmarkDefaultErrorHandlerHandle") + err := errors.New("benchmark default error handler handle") b.ReportAllocs() b.ResetTimer() @@ -198,7 +198,7 @@ func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { func BenchmarkDelegatedErrorHandlerHandle(b *testing.B) { eh := GetErrorHandler() SetErrorHandler(&errLogger{l: log.New(ioutil.Discard, "", 0)}) - err := errors.New("BenchmarkDelegatedErrorHandlerHandle") + err := errors.New("benchmark delegated error handler handle") b.ReportAllocs() b.ResetTimer() diff --git a/internal/baggage/context.go b/internal/baggage/context.go index 3c2784eea33..4469700d9cb 100644 --- a/internal/baggage/context.go +++ b/internal/baggage/context.go @@ -39,8 +39,7 @@ type baggageState struct { // Passing nil SetHookFunc creates a context with no set hook to call. func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Context { var s baggageState - switch v := parent.Value(baggageKey).(type) { - case baggageState: + if v, ok := parent.Value(baggageKey).(baggageState); ok { s = v } @@ -54,8 +53,7 @@ func ContextWithSetHook(parent context.Context, hook SetHookFunc) context.Contex // Passing nil GetHookFunc creates a context with no get hook to call. func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Context { var s baggageState - switch v := parent.Value(baggageKey).(type) { - case baggageState: + if v, ok := parent.Value(baggageKey).(baggageState); ok { s = v } @@ -67,8 +65,7 @@ func ContextWithGetHook(parent context.Context, hook GetHookFunc) context.Contex // returns a context without any baggage. func ContextWithList(parent context.Context, list List) context.Context { var s baggageState - switch v := parent.Value(baggageKey).(type) { - case baggageState: + if v, ok := parent.Value(baggageKey).(baggageState); ok { s = v } diff --git a/internal/matchers/expectation.go b/internal/matchers/expectation.go index 49200aafee3..0bf26266925 100644 --- a/internal/matchers/expectation.go +++ b/internal/matchers/expectation.go @@ -64,7 +64,7 @@ func (e *Expectation) NotToBeNil() { func (e *Expectation) ToBeTrue() { switch a := e.actual.(type) { case bool: - if e.actual == false { + if !a { e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) } default: @@ -75,7 +75,7 @@ func (e *Expectation) ToBeTrue() { func (e *Expectation) ToBeFalse() { switch a := e.actual.(type) { case bool: - if e.actual == true { + if a { e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) } default: @@ -253,32 +253,33 @@ func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { if actual, ok := e.actual.(time.Time); ok { - if ct, ok := compareTo.(time.Time); ok { - switch matcher { - case Before: - if !actual.Before(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) - } - case BeforeOrSameTime: - if actual.After(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) - } - case After: - if !actual.After(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) - } - case AfterOrSameTime: - if actual.Before(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) - } - default: - e.fail("Cannot compare times with unexpected temporal matcher") - } - } else { + ct, ok := compareTo.(time.Time) + if !ok { e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) return } + switch matcher { + case Before: + if !actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) + } + case BeforeOrSameTime: + if actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) + } + case After: + if !actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) + } + case AfterOrSameTime: + if actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) + } + default: + e.fail("Cannot compare times with unexpected temporal matcher") + } + return } diff --git a/internal/rawhelpers.go b/internal/rawhelpers.go index ce7afaa1880..e07e7940004 100644 --- a/internal/rawhelpers.go +++ b/internal/rawhelpers.go @@ -19,7 +19,7 @@ import ( "unsafe" ) -func BoolToRaw(b bool) uint64 { +func BoolToRaw(b bool) uint64 { // nolint:revive // b is not a control flag. if b { return 1 } diff --git a/metric/example_test.go b/metric/example_test.go index 9c18b9a6890..49b2e2ca663 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -44,7 +44,6 @@ func ExampleMeter_synchronous() { // Do work // ... workDuration.Record(ctx, time.Since(startTime).Milliseconds()) - } //nolint:govet // Meter doesn't register for go vet @@ -111,6 +110,4 @@ func ExampleMeter_asynchronous_multiple() { } //This is just an example, see the the contrib runtime instrumentation for real implementation. -func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) { - -} +func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) {} diff --git a/metric/instrument/config.go b/metric/instrument/config.go index d6ea25a8da2..842c65336d2 100644 --- a/metric/instrument/config.go +++ b/metric/instrument/config.go @@ -61,9 +61,9 @@ func WithDescription(desc string) Option { } // WithUnit applies provided unit. -func WithUnit(unit unit.Unit) Option { +func WithUnit(u unit.Unit) Option { return optionFunc(func(cfg Config) Config { - cfg.unit = unit + cfg.unit = u return cfg }) } diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 605771d105f..aed8b6660a5 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -38,14 +38,12 @@ type afCounter struct { } func (i *afCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { @@ -71,14 +69,12 @@ type afUpDownCounter struct { } func (i *afUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { @@ -104,14 +100,12 @@ type afGauge struct { } func (i *afGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Gauge(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { @@ -137,14 +131,12 @@ type aiCounter struct { } func (i *aiCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { @@ -170,14 +162,12 @@ type aiUpDownCounter struct { } func (i *aiUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { @@ -203,14 +193,12 @@ type aiGauge struct { } func (i *aiGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Gauge(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { @@ -237,14 +225,12 @@ type sfCounter struct { } func (i *sfCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { @@ -263,14 +249,12 @@ type sfUpDownCounter struct { } func (i *sfUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { @@ -295,7 +279,6 @@ func (i *sfHistogram) setDelegate(m metric.Meter) { return } i.delegate.Store(ctr) - } func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { @@ -314,14 +297,12 @@ type siCounter struct { } func (i *siCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { @@ -340,14 +321,12 @@ type siUpDownCounter struct { } func (i *siUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { @@ -366,14 +345,12 @@ type siHistogram struct { } func (i *siHistogram) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Histogram(i.name, i.opts...) if err != nil { otel.Handle(err) return } i.delegate.Store(ctr) - } func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 447db967d84..8865f06d57b 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -45,7 +45,6 @@ func TestMeterProviderRace(t *testing.T) { mp.setDelegate(metric.NewNoopMeterProvider()) close(finish) - } func TestMeterRace(t *testing.T) { @@ -88,7 +87,6 @@ func TestMeterRace(t *testing.T) { } func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Counter, asyncfloat64.Counter) { - afcounter, err := m.AsyncFloat64().Counter("test_Async_Counter") require.NoError(t, err) _, err = m.AsyncFloat64().UpDownCounter("test_Async_UpDownCounter") @@ -142,7 +140,6 @@ func testCollect(t *testing.T, m metric.Meter) { } func TestMeterProviderDelegatesCalls(t *testing.T) { - // The global MeterProvider should directly call the underlying MeterProvider // if it is set prior to Meter() being called. @@ -184,7 +181,6 @@ func TestMeterProviderDelegatesCalls(t *testing.T) { } func TestMeterDelegatesCalls(t *testing.T) { - // The global MeterProvider should directly provide a Meter instance that // can be updated. If the SetMeterProvider is called after a Meter was // obtained, but before instruments only the instrument should be generated @@ -227,7 +223,6 @@ func TestMeterDelegatesCalls(t *testing.T) { } func TestMeterDefersDelegations(t *testing.T) { - // If SetMeterProvider is called after instruments are registered, the // instruments should be recreated with the new meter. diff --git a/metric/unit/unit.go b/metric/unit/unit.go index 4615eb16f69..647d77302de 100644 --- a/metric/unit/unit.go +++ b/metric/unit/unit.go @@ -14,6 +14,7 @@ package unit // import "go.opentelemetry.io/otel/metric/unit" +// Unit is a determinate standard quantity of measurement. type Unit string // Units defined by OpenTelemetry. diff --git a/sdk/internal/env/env_test.go b/sdk/internal/env/env_test.go index e150f108c5d..f456ae10817 100644 --- a/sdk/internal/env/env_test.go +++ b/sdk/internal/env/env_test.go @@ -114,7 +114,6 @@ func TestEnvParse(t *testing.T) { require.NoError(t, os.Setenv(key, invalid)) assert.Equal(t, defVal, tc.f(defVal), "invalid value") }) - } }) } diff --git a/sdk/metric/aggregator/aggregator.go b/sdk/metric/aggregator/aggregator.go index 59d42b1a80a..59a2b4ffa68 100644 --- a/sdk/metric/aggregator/aggregator.go +++ b/sdk/metric/aggregator/aggregator.go @@ -51,7 +51,7 @@ type Aggregator interface { // // The Context argument comes from user-level code and could be // inspected for a `correlation.Map` or `trace.SpanContext`. - Update(ctx context.Context, number number.Number, descriptor *sdkapi.Descriptor) error + Update(ctx context.Context, n number.Number, descriptor *sdkapi.Descriptor) error // SynchronizedMove is called during collection to finish one // period of aggregation by atomically saving the diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go index 75fd7d44ff5..f4778528b82 100644 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ b/sdk/metric/aggregator/aggregatortest/test.go @@ -32,14 +32,19 @@ import ( "go.opentelemetry.io/otel/sdk/metric/sdkapi" ) +// Magnitude is the upper-bound of random numbers used in profile tests. const Magnitude = 1000 +// Profile is an aggregator test profile. type Profile struct { NumberKind number.Kind Random func(sign int) number.Number } +// NoopAggregator is an aggregator that performs no operations. type NoopAggregator struct{} + +// NoopAggregation is an aggregation that performs no operations. type NoopAggregation struct{} var _ aggregator.Aggregator = NoopAggregator{} @@ -63,11 +68,13 @@ func newProfiles() []Profile { } } +// NewAggregatorTest returns a descriptor for mkind and nkind. func NewAggregatorTest(mkind sdkapi.InstrumentKind, nkind number.Kind) *sdkapi.Descriptor { desc := sdkapi.NewDescriptor("test.name", mkind, nkind, "", "") return &desc } +// RunProfiles runs all test profile against the factory function f. func RunProfiles(t *testing.T, f func(*testing.T, Profile)) { for _, profile := range newProfiles() { t.Run(profile.NumberKind.String(), func(t *testing.T) { @@ -85,44 +92,54 @@ func TestMain(m *testing.M) { }, } if !ottest.Aligned8Byte(fields, os.Stderr) { + // nolint:revive // this is a main func, allow Exit. os.Exit(1) } + // nolint:revive // this is a main func, allow Exit. os.Exit(m.Run()) } +// Numbers are a collection of measured data point values. type Numbers struct { // numbers has to be aligned for 64-bit atomic operations. numbers []number.Number kind number.Kind } +// NewNumbers returns a new Numbers for the passed kind. func NewNumbers(kind number.Kind) Numbers { return Numbers{ kind: kind, } } +// Append appends v to the numbers n. func (n *Numbers) Append(v number.Number) { n.numbers = append(n.numbers, v) } +// Sort sorts all the numbers contained in n. func (n *Numbers) Sort() { sort.Sort(n) } +// Less returns if the number at index i is less than the number at index j. func (n *Numbers) Less(i, j int) bool { return n.numbers[i].CompareNumber(n.kind, n.numbers[j]) < 0 } +// Len returns number of data points Numbers contains. func (n *Numbers) Len() int { return len(n.numbers) } +// Swap swaps the location of the numbers at index i and j. func (n *Numbers) Swap(i, j int) { n.numbers[i], n.numbers[j] = n.numbers[j], n.numbers[i] } +// Sum returns the sum of all data points. func (n *Numbers) Sum() number.Number { var sum number.Number for _, num := range n.numbers { @@ -131,65 +148,78 @@ func (n *Numbers) Sum() number.Number { return sum } +// Count returns the number of data points Numbers contains. func (n *Numbers) Count() uint64 { return uint64(len(n.numbers)) } +// Min returns the min number. func (n *Numbers) Min() number.Number { return n.numbers[0] } +// Max returns the max number. func (n *Numbers) Max() number.Number { return n.numbers[len(n.numbers)-1] } +// Points returns the slice of number for all data points. func (n *Numbers) Points() []number.Number { return n.numbers } // CheckedUpdate performs the same range test the SDK does on behalf of the aggregator. -func CheckedUpdate(t *testing.T, agg aggregator.Aggregator, number number.Number, descriptor *sdkapi.Descriptor) { +func CheckedUpdate(t *testing.T, agg aggregator.Aggregator, n number.Number, descriptor *sdkapi.Descriptor) { ctx := context.Background() // Note: Aggregator tests are written assuming that the SDK // has performed the RangeTest. Therefore we skip errors that // would have been detected by the RangeTest. - err := aggregator.RangeTest(number, descriptor) + err := aggregator.RangeTest(n, descriptor) if err != nil { return } - if err := agg.Update(ctx, number, descriptor); err != nil { + if err := agg.Update(ctx, n, descriptor); err != nil { t.Error("Unexpected Update failure", err) } } +// CheckedMerge verifies aggFrom merges into aggInto with the scope of +// descriptor. func CheckedMerge(t *testing.T, aggInto, aggFrom aggregator.Aggregator, descriptor *sdkapi.Descriptor) { if err := aggInto.Merge(aggFrom, descriptor); err != nil { t.Error("Unexpected Merge failure", err) } } +// Kind returns a Noop aggregation Kind. func (NoopAggregation) Kind() aggregation.Kind { return aggregation.Kind("Noop") } +// Aggregation returns a NoopAggregation. func (NoopAggregator) Aggregation() aggregation.Aggregation { return NoopAggregation{} } +// Update performs no operation. func (NoopAggregator) Update(context.Context, number.Number, *sdkapi.Descriptor) error { return nil } +// SynchronizedMove performs no operation. func (NoopAggregator) SynchronizedMove(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } +// Merge performs no operation. func (NoopAggregator) Merge(aggregator.Aggregator, *sdkapi.Descriptor) error { return nil } +// SynchronizedMoveResetTest tests SynchronizedMove behavior for an aggregator +// during resets. func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf func(*sdkapi.Descriptor) aggregator.Aggregator) { t.Run("reset on nil", func(t *testing.T) { // Ensures that SynchronizedMove(nil, descriptor) discards and @@ -272,8 +302,6 @@ func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf fun require.Equal(t, input, v) require.NoError(t, err) } - }) }) - } diff --git a/sdk/metric/aggregator/histogram/histogram.go b/sdk/metric/aggregator/histogram/histogram.go index 1f57f53d392..69722ace113 100644 --- a/sdk/metric/aggregator/histogram/histogram.go +++ b/sdk/metric/aggregator/histogram/histogram.go @@ -219,9 +219,9 @@ func (c *Aggregator) clearState() { } // Update adds the recorded measurement to the current data set. -func (c *Aggregator) Update(_ context.Context, number number.Number, desc *sdkapi.Descriptor) error { +func (c *Aggregator) Update(_ context.Context, n number.Number, desc *sdkapi.Descriptor) error { kind := desc.NumberKind() - asFloat := number.CoerceToFloat64(kind) + asFloat := n.CoerceToFloat64(kind) bucketID := len(c.boundaries) for i, boundary := range c.boundaries { @@ -246,7 +246,7 @@ func (c *Aggregator) Update(_ context.Context, number number.Number, desc *sdkap defer c.lock.Unlock() c.state.count++ - c.state.sum.AddNumber(kind, number) + c.state.sum.AddNumber(kind, n) c.state.bucketCounts[bucketID]++ return nil diff --git a/sdk/metric/aggregator/histogram/histogram_test.go b/sdk/metric/aggregator/histogram/histogram_test.go index d799bb8931f..d19940ac54f 100644 --- a/sdk/metric/aggregator/histogram/histogram_test.go +++ b/sdk/metric/aggregator/histogram/histogram_test.go @@ -193,7 +193,6 @@ func TestHistogramNotSet(t *testing.T) { // checkHistogram ensures the correct aggregated state between `all` // (test aggregator) and `agg` (code under test). func checkHistogram(t *testing.T, all aggregatortest.Numbers, profile aggregatortest.Profile, agg *histogram.Aggregator) { - all.Sort() asum, err := agg.Sum() diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go index 111b852fa77..17e51faefc1 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue.go @@ -104,9 +104,9 @@ func (g *Aggregator) SynchronizedMove(oa aggregator.Aggregator, _ *sdkapi.Descri } // Update atomically sets the current "last" value. -func (g *Aggregator) Update(_ context.Context, number number.Number, desc *sdkapi.Descriptor) error { +func (g *Aggregator) Update(_ context.Context, n number.Number, desc *sdkapi.Descriptor) error { ngd := &lastValueData{ - value: number, + value: n, timestamp: time.Now(), } atomic.StorePointer(&g.value, unsafe.Pointer(ngd)) diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index de0da5484c9..a46e3835e3b 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -81,6 +81,8 @@ type Controller struct { var _ export.InstrumentationLibraryReader = &Controller{} var _ metric.MeterProvider = &Controller{} +// Meter returns a new Meter defined by instrumentationName and configured +// with opts. func (c *Controller) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { cfg := metric.NewMeterConfig(opts...) library := instrumentation.Library{ @@ -310,7 +312,7 @@ func (c *Controller) checkpointSingleAccumulator(ctx context.Context, ac *accumu // export calls the exporter with a read lock on the Reader, // applying the configured export timeout. -func (c *Controller) export(ctx context.Context) error { +func (c *Controller) export(ctx context.Context) error { // nolint:revive // method name shadows import. if c.pushTimeout > 0 { var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, c.pushTimeout) diff --git a/sdk/metric/controller/basic/pull_test.go b/sdk/metric/controller/basic/pull_test.go index 2284e68a71d..98496f6e780 100644 --- a/sdk/metric/controller/basic/pull_test.go +++ b/sdk/metric/controller/basic/pull_test.go @@ -118,5 +118,4 @@ func TestPullWithCollect(t *testing.T) { require.EqualValues(t, map[string]float64{ "counter.sum/A=B/": 20, }, records.Map()) - } diff --git a/sdk/metric/controller/controllertest/controller_test.go b/sdk/metric/controller/controllertest/controller_test.go index 394d806238b..0f85ca37f9c 100644 --- a/sdk/metric/controller/controllertest/controller_test.go +++ b/sdk/metric/controller/controllertest/controller_test.go @@ -63,5 +63,4 @@ func TestEndToEnd(t *testing.T) { h.lock.Lock() require.Len(t, h.errors, 0) - } diff --git a/sdk/metric/controller/controllertest/test.go b/sdk/metric/controller/controllertest/test.go index ed0bb88f1a3..9c1a3421972 100644 --- a/sdk/metric/controller/controllertest/test.go +++ b/sdk/metric/controller/controllertest/test.go @@ -25,10 +25,12 @@ import ( "go.opentelemetry.io/otel/sdk/metric/export/aggregation" ) +// MockClock is a Clock used for testing. type MockClock struct { mock *clock.Mock } +// MockTicker is a Ticker used for testing. type MockTicker struct { ticker *clock.Ticker } @@ -36,26 +38,33 @@ type MockTicker struct { var _ controllerTime.Clock = MockClock{} var _ controllerTime.Ticker = MockTicker{} +// NewMockClock returns a new unset MockClock. func NewMockClock() MockClock { return MockClock{clock.NewMock()} } +// Now returns the current time. func (c MockClock) Now() time.Time { return c.mock.Now() } +// Ticker creates a new instance of a Ticker. func (c MockClock) Ticker(period time.Duration) controllerTime.Ticker { return MockTicker{c.mock.Ticker(period)} } +// Add moves the current time of the MockClock forward by the specified +// duration. func (c MockClock) Add(d time.Duration) { c.mock.Add(d) } +// Stop turns off the MockTicker. func (t MockTicker) Stop() { t.ticker.Stop() } +// C returns a channel that receives the current time when MockTicker ticks. func (t MockTicker) C() <-chan time.Time { return t.ticker.C } diff --git a/sdk/metric/controller/time/time.go b/sdk/metric/controller/time/time.go index 08bc44dbf73..10b3cd8726f 100644 --- a/sdk/metric/controller/time/time.go +++ b/sdk/metric/controller/time/time.go @@ -16,44 +16,52 @@ package time // import "go.opentelemetry.io/otel/sdk/metric/controller/time" import ( "time" - lib "time" ) // Several types below are created to match "github.com/benbjohnson/clock" // so that it remains a test-only dependency. +// Clock keeps track of time for a metric SDK. type Clock interface { - Now() lib.Time - Ticker(duration lib.Duration) Ticker + Now() time.Time + Ticker(duration time.Duration) Ticker } +// Ticker signals time intervals. type Ticker interface { Stop() - C() <-chan lib.Time + C() <-chan time.Time } +// RealClock wraps the time package and uses the system time to tell time. type RealClock struct { } +// RealTicker wraps the time package and uses system time to tick time +// intervals. type RealTicker struct { - ticker *lib.Ticker + ticker *time.Ticker } var _ Clock = RealClock{} var _ Ticker = RealTicker{} +// Now returns the current time. func (RealClock) Now() time.Time { return time.Now() } +// Ticker creates a new RealTicker that will tick with period. func (RealClock) Ticker(period time.Duration) Ticker { return RealTicker{time.NewTicker(period)} } +// Stop turns off the RealTicker. func (t RealTicker) Stop() { t.ticker.Stop() } +// C returns a channel that receives the current time when RealTicker ticks. func (t RealTicker) C() <-chan time.Time { return t.ticker.C } diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go index 4d63ccdc3f7..944570375ae 100644 --- a/sdk/metric/correct_test.go +++ b/sdk/metric/correct_test.go @@ -209,7 +209,6 @@ func TestSDKAttrsDeduplication(t *testing.T) { allExpect := map[string]float64{} for numKeys := 0; numKeys < maxKeys; numKeys++ { - var kvsA []attribute.KeyValue var kvsB []attribute.KeyValue for r := 0; r < repeats; r++ { @@ -240,7 +239,6 @@ func TestSDKAttrsDeduplication(t *testing.T) { counter.Add(ctx, 1, kvsB...) allExpect[format(expectB)] += 2 } - } sdk.Collect(ctx) diff --git a/sdk/metric/export/aggregation/aggregation.go b/sdk/metric/export/aggregation/aggregation.go index 92d6e463ded..c43651c5889 100644 --- a/sdk/metric/export/aggregation/aggregation.go +++ b/sdk/metric/export/aggregation/aggregation.go @@ -100,7 +100,7 @@ const ( // Sentinel errors for Aggregation interface. var ( ErrNegativeInput = fmt.Errorf("negative value is out of range for this instrument") - ErrNaNInput = fmt.Errorf("NaN value is an invalid input") + ErrNaNInput = fmt.Errorf("invalid input value: NaN") ErrInconsistentType = fmt.Errorf("inconsistent aggregator types") // ErrNoCumulativeToDelta is returned when requesting delta diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go index 5ea07e79eb9..6168ca445ba 100644 --- a/sdk/metric/export/metric.go +++ b/sdk/metric/export/metric.go @@ -93,7 +93,7 @@ type AggregatorSelector interface { // Note: This is context-free because the aggregator should // not relate to the incoming context. This call should not // block. - AggregatorFor(descriptor *sdkapi.Descriptor, aggregator ...*aggregator.Aggregator) + AggregatorFor(descriptor *sdkapi.Descriptor, agg ...*aggregator.Aggregator) } // Checkpointer is the interface used by a Controller to coordinate @@ -141,7 +141,7 @@ type Exporter interface { // // The InstrumentationLibraryReader interface refers to the // Processor that just completed collection. - Export(ctx context.Context, resource *resource.Resource, reader InstrumentationLibraryReader) error + Export(ctx context.Context, res *resource.Resource, reader InstrumentationLibraryReader) error // TemporalitySelector is an interface used by the Processor // in deciding whether to compute Delta or Cumulative @@ -232,13 +232,13 @@ func (m Metadata) Attributes() *attribute.Set { // Accumulations to send to Processors. The Descriptor, attributes, and // Aggregator represent aggregate metric events received over a single // collection period. -func NewAccumulation(descriptor *sdkapi.Descriptor, attrs *attribute.Set, aggregator aggregator.Aggregator) Accumulation { +func NewAccumulation(descriptor *sdkapi.Descriptor, attrs *attribute.Set, agg aggregator.Aggregator) Accumulation { return Accumulation{ Metadata: Metadata{ descriptor: descriptor, attrs: attrs, }, - aggregator: aggregator, + aggregator: agg, } } @@ -251,13 +251,13 @@ func (r Accumulation) Aggregator() aggregator.Aggregator { // NewRecord allows Processor implementations to construct export records. // The Descriptor, attributes, and Aggregator represent aggregate metric // events received over a single collection period. -func NewRecord(descriptor *sdkapi.Descriptor, attrs *attribute.Set, aggregation aggregation.Aggregation, start, end time.Time) Record { +func NewRecord(descriptor *sdkapi.Descriptor, attrs *attribute.Set, agg aggregation.Aggregation, start, end time.Time) Record { return Record{ Metadata: Metadata{ descriptor: descriptor, attrs: attrs, }, - aggregation: aggregation, + aggregation: agg, start: start, end: end, } diff --git a/sdk/metric/metrictest/exporter_test.go b/sdk/metric/metrictest/exporter_test.go index 8fa8e805bf1..10f4fb4358c 100644 --- a/sdk/metric/metrictest/exporter_test.go +++ b/sdk/metric/metrictest/exporter_test.go @@ -61,7 +61,6 @@ func TestSyncInstruments(t *testing.T) { require.NoError(t, err) assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Float Histogram", func(t *testing.T) { @@ -94,7 +93,6 @@ func TestSyncInstruments(t *testing.T) { require.NoError(t, err) assert.EqualValues(t, 22, out.Sum.AsInt64()) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Int UpDownCounter", func(t *testing.T) { iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") @@ -109,10 +107,8 @@ func TestSyncInstruments(t *testing.T) { require.NoError(t, err) assert.EqualValues(t, 23, out.Sum.AsInt64()) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Int Histogram", func(t *testing.T) { - ihis, err := meter.SyncInt64().Histogram("iHist") require.NoError(t, err) @@ -163,7 +159,6 @@ func TestSyncDeltaInstruments(t *testing.T) { require.NoError(t, err) assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Float Histogram", func(t *testing.T) { @@ -196,7 +191,6 @@ func TestSyncDeltaInstruments(t *testing.T) { require.NoError(t, err) assert.EqualValues(t, 22, out.Sum.AsInt64()) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Int UpDownCounter", func(t *testing.T) { iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") @@ -211,10 +205,8 @@ func TestSyncDeltaInstruments(t *testing.T) { require.NoError(t, err) assert.EqualValues(t, 23, out.Sum.AsInt64()) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Int Histogram", func(t *testing.T) { - ihis, err := meter.SyncInt64().Histogram("iHist") require.NoError(t, err) @@ -349,7 +341,6 @@ func TestAsyncInstruments(t *testing.T) { require.NoError(t, err) assert.EqualValues(t, 23, out.Sum.AsInt64()) assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) t.Run("Int Gauge", func(t *testing.T) { meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntGauge") @@ -373,7 +364,6 @@ func TestAsyncInstruments(t *testing.T) { assert.EqualValues(t, 25, out.LastValue.AsInt64()) assert.Equal(t, aggregation.LastValueKind, out.AggregationKind) }) - } func ExampleExporter_GetByName() { diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go index 493b002142b..8ed07484bef 100644 --- a/sdk/metric/processor/basic/basic.go +++ b/sdk/metric/processor/basic/basic.go @@ -28,6 +28,7 @@ import ( ) type ( + // Processor is a basic metric processor. Processor struct { aggregation.TemporalitySelector export.AggregatorSelector @@ -129,6 +130,7 @@ type factory struct { config config } +// NewFactory returns a new basic CheckpointerFactory. func NewFactory(aselector export.AggregatorSelector, tselector aggregation.TemporalitySelector, opts ...Option) export.CheckpointerFactory { var config config for _, opt := range opts { @@ -156,7 +158,6 @@ func (f factory) NewCheckpointer() export.Checkpointer { }, } return p - } // Process implements export.Processor. diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go index 83e9d4a93f0..21d816b44a0 100644 --- a/sdk/metric/processor/basic/basic_test.go +++ b/sdk/metric/processor/basic/basic_test.go @@ -36,7 +36,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/number" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -138,7 +137,7 @@ func testProcessor( // Note: this selector uses the instrument name to dictate // aggregation kind. - selector := processorTest.AggregatorSelector() + selector := processortest.AggregatorSelector() labs1 := []attribute.KeyValue{attribute.String("L1", "V")} labs2 := []attribute.KeyValue{attribute.String("L2", "V")} @@ -152,7 +151,6 @@ func testProcessor( desc2 := metrictest.NewDescriptor(fmt.Sprint("inst2", instSuffix), mkind, nkind) for nc := 0; nc < nCheckpoint; nc++ { - // The input is 10 per update, scaled by // the number of checkpoints for // cumulative instruments: @@ -188,7 +186,7 @@ func testProcessor( } // Test the final checkpoint state. - records1 := processorTest.NewOutput(attribute.DefaultEncoder()) + records1 := processortest.NewOutput(attribute.DefaultEncoder()) require.NoError(t, reader.ForEach(aggregation.ConstantTemporalitySelector(aggTemp), records1.AddRecord)) if !expectConversion { @@ -274,19 +272,19 @@ func (bogusExporter) Export(context.Context, export.Reader) error { func TestBasicInconsistent(t *testing.T) { // Test double-start - b := basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b := basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) b.StartCollection() b.StartCollection() require.Equal(t, basic.ErrInconsistentState, b.FinishCollection()) // Test finish without start - b = basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) require.Equal(t, basic.ErrInconsistentState, b.FinishCollection()) // Test no finish - b = basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) b.StartCollection() require.Equal( @@ -299,14 +297,14 @@ func TestBasicInconsistent(t *testing.T) { ) // Test no start - b = basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) desc := metrictest.NewDescriptor("inst", sdkapi.CounterInstrumentKind, number.Int64Kind) accum := export.NewAccumulation(&desc, attribute.EmptySet(), aggregatortest.NoopAggregator{}) require.Equal(t, basic.ErrInconsistentState, b.Process(accum)) // Test invalid kind: - b = basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) b.StartCollection() require.NoError(t, b.Process(accum)) require.NoError(t, b.FinishCollection()) @@ -316,13 +314,12 @@ func TestBasicInconsistent(t *testing.T) { func(export.Record) error { return nil }, ) require.True(t, errors.Is(err, basic.ErrInvalidTemporality)) - } func TestBasicTimestamps(t *testing.T) { beforeNew := time.Now() time.Sleep(time.Nanosecond) - b := basic.New(processorTest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) + b := basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) time.Sleep(time.Nanosecond) afterNew := time.Now() @@ -372,7 +369,7 @@ func TestStatefulNoMemoryCumulative(t *testing.T) { aggTempSel := aggregation.CumulativeTemporalitySelector() desc := metrictest.NewDescriptor("inst.sum", sdkapi.CounterInstrumentKind, number.Int64Kind) - selector := processorTest.AggregatorSelector() + selector := processortest.AggregatorSelector() processor := basic.New(selector, aggTempSel, basic.WithMemory(false)) reader := processor.Reader() @@ -383,7 +380,7 @@ func TestStatefulNoMemoryCumulative(t *testing.T) { require.NoError(t, processor.FinishCollection()) // Verify zero elements - records := processorTest.NewOutput(attribute.DefaultEncoder()) + records := processortest.NewOutput(attribute.DefaultEncoder()) require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) require.EqualValues(t, map[string]float64{}, records.Map()) @@ -393,7 +390,7 @@ func TestStatefulNoMemoryCumulative(t *testing.T) { require.NoError(t, processor.FinishCollection()) // Verify one element - records = processorTest.NewOutput(attribute.DefaultEncoder()) + records = processortest.NewOutput(attribute.DefaultEncoder()) require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) require.EqualValues(t, map[string]float64{ "inst.sum/A=B/": float64(i * 10), @@ -413,7 +410,7 @@ func TestMultiObserverSum(t *testing.T) { t.Run(test.name, func(t *testing.T) { aggTempSel := test.TemporalitySelector desc := metrictest.NewDescriptor("observe.sum", sdkapi.CounterObserverInstrumentKind, number.Int64Kind) - selector := processorTest.AggregatorSelector() + selector := processortest.AggregatorSelector() processor := basic.New(selector, aggTempSel, basic.WithMemory(false)) reader := processor.Reader() @@ -427,7 +424,7 @@ func TestMultiObserverSum(t *testing.T) { require.NoError(t, processor.FinishCollection()) // Verify one element - records := processorTest.NewOutput(attribute.DefaultEncoder()) + records := processortest.NewOutput(attribute.DefaultEncoder()) if test.expectProcessErr == nil { require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) require.EqualValues(t, map[string]float64{ @@ -446,7 +443,7 @@ func TestCounterObserverEndToEnd(t *testing.T) { ctx := context.Background() eselector := aggregation.CumulativeTemporalitySelector() proc := basic.New( - processorTest.AggregatorSelector(), + processortest.AggregatorSelector(), eselector, ) accum := sdk.NewAccumulator(proc) diff --git a/sdk/metric/processor/basic/config.go b/sdk/metric/processor/basic/config.go index c9114a09943..ca8127629dc 100644 --- a/sdk/metric/processor/basic/config.go +++ b/sdk/metric/processor/basic/config.go @@ -23,6 +23,7 @@ type config struct { Memory bool } +// Option configures a basic processor configuration. type Option interface { applyProcessor(config) config } diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index ad3e7360559..fa0e902d255 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -95,6 +95,8 @@ type testFactory struct { encoder attribute.Encoder } +// NewCheckpointerFactory returns a new CheckpointerFactory for the selector +// and encoder pair. func NewCheckpointerFactory(selector export.AggregatorSelector, encoder attribute.Encoder) export.CheckpointerFactory { return testFactory{ selector: selector, @@ -102,6 +104,7 @@ func NewCheckpointerFactory(selector export.AggregatorSelector, encoder attribut } } +// NewCheckpointer returns a new Checkpointer for Processor p. func NewCheckpointer(p *Processor) export.Checkpointer { return &testCheckpointer{ Processor: p, @@ -179,7 +182,6 @@ func AggregatorSelector() export.AggregatorSelector { // AggregatorFor implements export.AggregatorSelector. func (testAggregatorSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { - switch { case strings.HasSuffix(desc.Name(), ".disabled"): for i := range aggPtrs { @@ -240,10 +242,12 @@ func (o *Output) AddRecord(rec export.Record) error { return o.AddRecordWithResource(rec, resource.Empty()) } +// AddRecordWithResource merges rec into this Output. func (o *Output) AddInstrumentationLibraryRecord(_ instrumentation.Library, rec export.Record) error { return o.AddRecordWithResource(rec, resource.Empty()) } +// AddRecordWithResource merges rec into this Output scoping it with res. func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource) error { key := mapKey{ desc: rec.Descriptor(), @@ -331,6 +335,7 @@ func New(selector aggregation.TemporalitySelector, encoder attribute.Encoder) *E } } +// Export records all the measurements aggregated in ckpt for res. func (e *Exporter) Export(_ context.Context, res *resource.Resource, ckpt export.InstrumentationLibraryReader) error { e.output.Lock() defer e.output.Unlock() @@ -374,6 +379,8 @@ func (e *Exporter) Reset() { e.exportCount = 0 } +// OneInstrumentationLibraryReader returns an InstrumentationLibraryReader for +// a single instrumentation library. func OneInstrumentationLibraryReader(l instrumentation.Library, r export.Reader) export.InstrumentationLibraryReader { return oneLibraryReader{l, r} } @@ -387,6 +394,8 @@ func (o oneLibraryReader) ForEach(readerFunc func(instrumentation.Library, expor return readerFunc(o.library, o.reader) } +// MultiInstrumentationLibraryReader returns an InstrumentationLibraryReader +// for a group of records that came from multiple instrumentation libraries. func MultiInstrumentationLibraryReader(records map[instrumentation.Library][]export.Record) export.InstrumentationLibraryReader { return instrumentationLibraryReader{records: records} } diff --git a/sdk/metric/processor/processortest/test_test.go b/sdk/metric/processor/processortest/test_test.go index c157ad47e3e..98c15f2f763 100644 --- a/sdk/metric/processor/processortest/test_test.go +++ b/sdk/metric/processor/processortest/test_test.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/export" "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" ) @@ -58,9 +57,9 @@ func generateTestData(t *testing.T, proc export.Processor) { func TestProcessorTesting(t *testing.T) { // Test the Processor test helper using a real Accumulator to // generate Accumulations. - checkpointer := processorTest.NewCheckpointer( - processorTest.NewProcessor( - processorTest.AggregatorSelector(), + checkpointer := processortest.NewCheckpointer( + processortest.NewProcessor( + processortest.AggregatorSelector(), attribute.DefaultEncoder(), ), ) @@ -75,7 +74,7 @@ func TestProcessorTesting(t *testing.T) { } // Export the data and validate it again. - exporter := processorTest.New( + exporter := processortest.New( aggregation.StatelessTemporalitySelector(), attribute.DefaultEncoder(), ) diff --git a/sdk/metric/processor/reducer/reducer_test.go b/sdk/metric/processor/reducer/reducer_test.go index ab043f83d58..12fbb7f86e0 100644 --- a/sdk/metric/processor/reducer/reducer_test.go +++ b/sdk/metric/processor/reducer/reducer_test.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/export/aggregation" "go.opentelemetry.io/otel/sdk/metric/processor/basic" "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - processorTest "go.opentelemetry.io/otel/sdk/metric/processor/processortest" "go.opentelemetry.io/otel/sdk/metric/processor/reducer" "go.opentelemetry.io/otel/sdk/metric/sdkapi" "go.opentelemetry.io/otel/sdk/resource" @@ -73,12 +72,12 @@ func generateData(t *testing.T, impl sdkapi.MeterImpl) { } func TestFilterProcessor(t *testing.T) { - testProc := processorTest.NewProcessor( - processorTest.AggregatorSelector(), + testProc := processortest.NewProcessor( + processortest.AggregatorSelector(), attribute.DefaultEncoder(), ) accum := metricsdk.NewAccumulator( - reducer.New(testFilter{}, processorTest.NewCheckpointer(testProc)), + reducer.New(testFilter{}, processortest.NewCheckpointer(testProc)), ) generateData(t, accum) @@ -92,11 +91,11 @@ func TestFilterProcessor(t *testing.T) { // Test a filter with the ../basic Processor. func TestFilterBasicProcessor(t *testing.T) { - basicProc := basic.New(processorTest.AggregatorSelector(), aggregation.CumulativeTemporalitySelector()) + basicProc := basic.New(processortest.AggregatorSelector(), aggregation.CumulativeTemporalitySelector()) accum := metricsdk.NewAccumulator( reducer.New(testFilter{}, basicProc), ) - exporter := processorTest.New(basicProc, attribute.DefaultEncoder()) + exporter := processortest.New(basicProc, attribute.DefaultEncoder()) generateData(t, accum) diff --git a/sdk/metric/registry/registry.go b/sdk/metric/registry/registry.go index c2870e483d1..4d339ab7d69 100644 --- a/sdk/metric/registry/registry.go +++ b/sdk/metric/registry/registry.go @@ -130,6 +130,7 @@ func (u *UniqueInstrumentMeterImpl) NewAsyncInstrument(descriptor sdkapi.Descrip return asyncInst, nil } +// RegisterCallback registers callback with insts. func (u *UniqueInstrumentMeterImpl) RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error { u.lock.Lock() defer u.lock.Unlock() diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go index 4afe14bf0b4..a942f86f2d4 100644 --- a/sdk/metric/sdk.go +++ b/sdk/metric/sdk.go @@ -128,6 +128,8 @@ var ( // ErrUninitializedInstrument is returned when an instrument is used when uninitialized. ErrUninitializedInstrument = fmt.Errorf("use of an uninitialized instrument") + // ErrBadInstrument is returned when an instrument from another SDK is + // attempted to be registered with this SDK. ErrBadInstrument = fmt.Errorf("use of a instrument from another SDK") ) @@ -146,7 +148,6 @@ func (s *syncInstrument) Implementation() interface{} { // acquireHandle gets or creates a `*record` corresponding to `kvs`, // the input attributes. func (b *baseInstrument) acquireHandle(kvs []attribute.KeyValue) *record { - // This memory allocation may not be used, but it's // needed for the `sortSlice` field, to avoid an // allocation while sorting. @@ -263,6 +264,7 @@ func (m *Accumulator) NewAsyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.A return a, nil } +// RegisterCallback registers f to be called for insts. func (m *Accumulator) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { cb := &callback{ insts: map[*asyncInstrument]struct{}{}, @@ -418,5 +420,4 @@ func (m *Accumulator) fromAsync(async sdkapi.AsyncImpl) (*asyncInstrument, error return nil, ErrBadInstrument } return inst, nil - } diff --git a/sdk/metric/sdkapi/descriptor.go b/sdk/metric/sdkapi/descriptor.go index f86e4473459..778e9321eea 100644 --- a/sdk/metric/sdkapi/descriptor.go +++ b/sdk/metric/sdkapi/descriptor.go @@ -31,13 +31,13 @@ type Descriptor struct { } // NewDescriptor returns a Descriptor with the given contents. -func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, unit unit.Unit) Descriptor { +func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, u unit.Unit) Descriptor { return Descriptor{ name: name, instrumentKind: ikind, numberKind: nkind, description: description, - unit: unit, + unit: u, } } diff --git a/sdk/metric/sdkapi/sdkapi.go b/sdk/metric/sdkapi/sdkapi.go index c3a3e04d311..86226c456db 100644 --- a/sdk/metric/sdkapi/sdkapi.go +++ b/sdk/metric/sdkapi/sdkapi.go @@ -58,7 +58,7 @@ type SyncImpl interface { instrument.Synchronous // RecordOne captures a single synchronous metric event. - RecordOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue) + RecordOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) } // AsyncImpl is an implementation-level interface to an @@ -68,7 +68,7 @@ type AsyncImpl interface { instrument.Asynchronous // ObserveOne captures a single synchronous metric event. - ObserveOne(ctx context.Context, number number.Number, attrs []attribute.KeyValue) + ObserveOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) } // AsyncRunner is expected to convert into an AsyncSingleRunner or an @@ -105,10 +105,10 @@ type AsyncBatchRunner interface { // NewMeasurement constructs a single observation, a binding between // an asynchronous instrument and a number. -func NewMeasurement(instrument SyncImpl, number number.Number) Measurement { +func NewMeasurement(inst SyncImpl, n number.Number) Measurement { return Measurement{ - instrument: instrument, - number: number, + instrument: inst, + number: n, } } @@ -134,10 +134,10 @@ func (m Measurement) Number() number.Number { // NewObservation constructs a single observation, a binding between // an asynchronous instrument and a number. -func NewObservation(instrument AsyncImpl, number number.Number) Observation { +func NewObservation(inst AsyncImpl, n number.Number) Observation { return Observation{ - instrument: instrument, - number: number, + instrument: inst, + number: n, } } diff --git a/sdk/metric/sdkapi/wrap.go b/sdk/metric/sdkapi/wrap.go index 9a4d5b0de14..aa6356f7e8f 100644 --- a/sdk/metric/sdkapi/wrap.go +++ b/sdk/metric/sdkapi/wrap.go @@ -42,10 +42,12 @@ type ( fObserver struct{ AsyncImpl } ) +// WrapMeterImpl wraps impl to be a full implementation of a Meter. func WrapMeterImpl(impl MeterImpl) metric.Meter { return meter{impl} } +// UnwrapMeterImpl unwraps the Meter to its bare MeterImpl. func UnwrapMeterImpl(m metric.Meter) MeterImpl { mm, ok := m.(meter) if !ok { diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index f05036fdd68..ad490c11c00 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -27,7 +27,6 @@ import ( ) func TestDetect(t *testing.T) { - cases := []struct { name string schema1, schema2 string diff --git a/sdk/resource/benchmark_test.go b/sdk/resource/benchmark_test.go index 918ec332da8..ea72c5a2186 100644 --- a/sdk/resource/benchmark_test.go +++ b/sdk/resource/benchmark_test.go @@ -45,7 +45,6 @@ func makeAttrs(n int) (_, _ *resource.Resource) { } else { l2[i] = attribute.String(k, fmt.Sprint("v", rand.Intn(1000000000))) } - } return resource.NewSchemaless(l1...), resource.NewSchemaless(l2...) } diff --git a/sdk/resource/builtin_test.go b/sdk/resource/builtin_test.go index 04c8ee9909e..20a4e350a93 100644 --- a/sdk/resource/builtin_test.go +++ b/sdk/resource/builtin_test.go @@ -45,9 +45,9 @@ func TestStringDetectorErrors(t *testing.T) { { desc: "explicit error from func should be returned", s: resource.StringDetector("", attribute.Key("K"), func() (string, error) { - return "", fmt.Errorf("K-IS-MISSING") + return "", fmt.Errorf("k-is-missing") }), - errContains: "K-IS-MISSING", + errContains: "k-is-missing", }, { desc: "empty key is an invalid", @@ -74,5 +74,4 @@ func TestStringDetectorErrors(t *testing.T) { } require.EqualValues(t, map[string]string{"A": "B"}, m) } - } diff --git a/sdk/resource/os_unix_test.go b/sdk/resource/os_unix_test.go index 2f03980c4a8..af6178613e1 100644 --- a/sdk/resource/os_unix_test.go +++ b/sdk/resource/os_unix_test.go @@ -39,7 +39,7 @@ func fakeUnameProvider(buf *unix.Utsname) error { } func fakeUnameProviderWithError(buf *unix.Utsname) error { - return fmt.Errorf("Error invoking uname(2)") + return fmt.Errorf("error invoking uname(2)") } func TestUname(t *testing.T) { diff --git a/sdk/resource/process_test.go b/sdk/resource/process_test.go index 408d0a5a300..7ddb66acdd4 100644 --- a/sdk/resource/process_test.go +++ b/sdk/resource/process_test.go @@ -56,10 +56,10 @@ var ( var ( fakeExecutablePathProviderWithError = func() (string, error) { - return "", fmt.Errorf("Unable to get process executable") + return "", fmt.Errorf("unable to get process executable") } fakeOwnerProviderWithError = func() (*user.User, error) { - return nil, fmt.Errorf("Unable to get process user") + return nil, fmt.Errorf("unable to get process user") } ) diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 155edfa12cc..c425ff05db5 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -129,6 +129,7 @@ func (r *Resource) Attributes() []attribute.KeyValue { return r.attrs.ToSlice() } +// SchemaURL returns the schema URL associated with Resource r. func (r *Resource) SchemaURL() string { if r == nil { return "" @@ -179,13 +180,14 @@ func Merge(a, b *Resource) (*Resource, error) { // Merge the schema URL. var schemaURL string - if a.schemaURL == "" { + switch true { + case a.schemaURL == "": schemaURL = b.schemaURL - } else if b.schemaURL == "" { + case b.schemaURL == "": schemaURL = a.schemaURL - } else if a.schemaURL == b.schemaURL { + case a.schemaURL == b.schemaURL: schemaURL = a.schemaURL - } else { + default: return Empty(), errMergeConflictSchemaURL } diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 56847d9ccba..a2d7db49001 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -35,8 +35,11 @@ const ( DefaultMaxExportBatchSize = 512 ) +// BatchSpanProcessorOption configures a BatchSpanProcessor. type BatchSpanProcessorOption func(o *BatchSpanProcessorOptions) +// BatchSpanProcessorOptions is configuration settings for a +// BatchSpanProcessor. type BatchSpanProcessorOptions struct { // MaxQueueSize is the maximum queue size to buffer spans for delayed processing. If the // queue gets full it drops the spans. Use BlockOnQueueFull to change this behavior. @@ -181,7 +184,7 @@ func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { var err error if bsp.e != nil { flushCh := make(chan struct{}) - if bsp.enqueueBlockOnQueueFull(ctx, forceFlushSpan{flushed: flushCh}, true) { + if bsp.enqueueBlockOnQueueFull(ctx, forceFlushSpan{flushed: flushCh}) { select { case <-flushCh: // Processed any items in queue prior to ForceFlush being called @@ -205,30 +208,43 @@ func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { return err } +// WithMaxQueueSize returns a BatchSpanProcessorOption that configures the +// maximum queue size allowed for a BatchSpanProcessor. func WithMaxQueueSize(size int) BatchSpanProcessorOption { return func(o *BatchSpanProcessorOptions) { o.MaxQueueSize = size } } +// WithMaxExportBatchSize returns a BatchSpanProcessorOption that configures +// the maximum export batch size allowed for a BatchSpanProcessor. func WithMaxExportBatchSize(size int) BatchSpanProcessorOption { return func(o *BatchSpanProcessorOptions) { o.MaxExportBatchSize = size } } +// WithBatchTimeout returns a BatchSpanProcessorOption that configures the +// maximum delay allowed for a BatchSpanProcessor before it will export any +// held span (whether the queue is full or not). func WithBatchTimeout(delay time.Duration) BatchSpanProcessorOption { return func(o *BatchSpanProcessorOptions) { o.BatchTimeout = delay } } +// WithExportTimeout returns a BatchSpanProcessorOption that configures the +// amount of time a BatchSpanProcessor waits for an exporter to export before +// abandoning the export. func WithExportTimeout(timeout time.Duration) BatchSpanProcessorOption { return func(o *BatchSpanProcessorOptions) { o.ExportTimeout = timeout } } +// WithBlocking returns a BatchSpanProcessorOption that configures a +// BatchSpanProcessor to wait for enqueue operations to succeed instead of +// dropping data when the queue is full. func WithBlocking() BatchSpanProcessorOption { return func(o *BatchSpanProcessorOptions) { o.BlockOnQueueFull = true @@ -237,7 +253,6 @@ func WithBlocking() BatchSpanProcessorOption { // exportSpans is a subroutine of processing and draining the queue. func (bsp *batchSpanProcessor) exportSpans(ctx context.Context) error { - bsp.timer.Reset(bsp.o.BatchTimeout) bsp.batchMutex.Lock() @@ -335,28 +350,35 @@ func (bsp *batchSpanProcessor) drainQueue() { } func (bsp *batchSpanProcessor) enqueue(sd ReadOnlySpan) { - bsp.enqueueBlockOnQueueFull(context.TODO(), sd, bsp.o.BlockOnQueueFull) + ctx := context.TODO() + if bsp.o.BlockOnQueueFull { + bsp.enqueueBlockOnQueueFull(ctx, sd) + } else { + bsp.enqueueDrop(ctx, sd) + } } -func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd ReadOnlySpan, block bool) bool { +func recoverSendOnClosedChan() { + x := recover() + switch err := x.(type) { + case nil: + return + case runtime.Error: + if err.Error() == "send on closed channel" { + return + } + } + panic(x) +} + +func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } // This ensures the bsp.queue<- below does not panic as the // processor shuts down. - defer func() { - x := recover() - switch err := x.(type) { - case nil: - return - case runtime.Error: - if err.Error() == "send on closed channel" { - return - } - } - panic(x) - }() + defer recoverSendOnClosedChan() select { case <-bsp.stopCh: @@ -364,13 +386,27 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd R default: } - if block { - select { - case bsp.queue <- sd: - return true - case <-ctx.Done(): - return false - } + select { + case bsp.queue <- sd: + return true + case <-ctx.Done(): + return false + } +} + +func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) bool { + if !sd.SpanContext().IsSampled() { + return false + } + + // This ensures the bsp.queue<- below does not panic as the + // processor shuts down. + defer recoverSendOnClosedChan() + + select { + case <-bsp.stopCh: + return false + default: } select { diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index 255f8621160..a033b6a0082 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -206,7 +206,11 @@ func TestNewBatchSpanProcessorWithOptions(t *testing.T) { tp.RegisterSpanProcessor(ssp) tr := tp.Tracer("BatchSpanProcessorWithOptions") - generateSpan(t, option.parallel, tr, option) + if option.parallel { + generateSpanParallel(t, tr, option) + } else { + generateSpan(t, tr, option) + } tp.UnregisterSpanProcessor(ssp) @@ -285,7 +289,11 @@ func TestNewBatchSpanProcessorWithEnvOptions(t *testing.T) { tp.RegisterSpanProcessor(ssp) tr := tp.Tracer("BatchSpanProcessorWithOptions") - generateSpan(t, option.parallel, tr, option) + if option.parallel { + generateSpanParallel(t, tr, option) + } else { + generateSpan(t, tr, option) + } tp.UnregisterSpanProcessor(ssp) @@ -328,7 +336,7 @@ func TestBatchSpanProcessorExportTimeout(t *testing.T) { tp.RegisterSpanProcessor(bsp) tr := tp.Tracer("BatchSpanProcessorExportTimeout") - generateSpan(t, false, tr, testOption{genNumSpans: 1}) + generateSpan(t, tr, testOption{genNumSpans: 1}) tp.UnregisterSpanProcessor(bsp) if exp.err != context.DeadlineExceeded { @@ -342,27 +350,34 @@ func createAndRegisterBatchSP(option testOption, te *testBatchExporter) sdktrace return sdktrace.NewBatchSpanProcessor(te, options...) } -func generateSpan(t *testing.T, parallel bool, tr trace.Tracer, option testOption) { +func generateSpan(t *testing.T, tr trace.Tracer, option testOption) { sc := getSpanContext() - wg := &sync.WaitGroup{} for i := 0; i < option.genNumSpans; i++ { tid := sc.TraceID() binary.BigEndian.PutUint64(tid[0:8], uint64(i+1)) newSc := sc.WithTraceID(tid) + ctx := trace.ContextWithRemoteSpanContext(context.Background(), newSc) + _, span := tr.Start(ctx, option.name) + span.End() + } +} + +func generateSpanParallel(t *testing.T, tr trace.Tracer, option testOption) { + sc := getSpanContext() + + wg := &sync.WaitGroup{} + for i := 0; i < option.genNumSpans; i++ { + tid := sc.TraceID() + binary.BigEndian.PutUint64(tid[0:8], uint64(i+1)) wg.Add(1) - f := func(sc trace.SpanContext) { + go func(sc trace.SpanContext) { ctx := trace.ContextWithRemoteSpanContext(context.Background(), sc) _, span := tr.Start(ctx, option.name) span.End() wg.Done() - } - if parallel { - go f(newSc) - } else { - f(newSc) - } + }(sc.WithTraceID(tid)) } wg.Wait() } @@ -403,7 +418,7 @@ func TestBatchSpanProcessorPostShutdown(t *testing.T) { tp.RegisterSpanProcessor(bsp) tr := tp.Tracer("Normal") - generateSpan(t, true, tr, testOption{ + generateSpanParallel(t, tr, testOption{ o: []sdktrace.BatchSpanProcessorOption{ sdktrace.WithMaxExportBatchSize(50), }, @@ -439,7 +454,11 @@ func TestBatchSpanProcessorForceFlushSucceeds(t *testing.T) { } tp.RegisterSpanProcessor(ssp) tr := tp.Tracer("BatchSpanProcessorWithOption") - generateSpan(t, option.parallel, tr, option) + if option.parallel { + generateSpanParallel(t, tr, option) + } else { + generateSpan(t, tr, option) + } // Force flush any held span batches err := ssp.ForceFlush(context.Background()) @@ -475,7 +494,11 @@ func TestBatchSpanProcessorDropBatchIfFailed(t *testing.T) { } tp.RegisterSpanProcessor(ssp) tr := tp.Tracer("BatchSpanProcessorWithOption") - generateSpan(t, option.parallel, tr, option) + if option.parallel { + generateSpanParallel(t, tr, option) + } else { + generateSpan(t, tr, option) + } // Force flush any held span batches err := ssp.ForceFlush(context.Background()) @@ -488,7 +511,11 @@ func TestBatchSpanProcessorDropBatchIfFailed(t *testing.T) { assert.Equal(t, 0, te.getBatchCount()) // Generate a new batch, this will succeed - generateSpan(t, option.parallel, tr, option) + if option.parallel { + generateSpanParallel(t, tr, option) + } else { + generateSpan(t, tr, option) + } // Force flush any held span batches err = ssp.ForceFlush(context.Background()) diff --git a/sdk/trace/id_generator.go b/sdk/trace/id_generator.go index c9e2802ac53..bba246041a4 100644 --- a/sdk/trace/id_generator.go +++ b/sdk/trace/id_generator.go @@ -52,7 +52,7 @@ func (gen *randomIDGenerator) NewSpanID(ctx context.Context, traceID trace.Trace gen.Lock() defer gen.Unlock() sid := trace.SpanID{} - gen.randSource.Read(sid[:]) + _, _ = gen.randSource.Read(sid[:]) return sid } @@ -62,9 +62,9 @@ func (gen *randomIDGenerator) NewIDs(ctx context.Context) (trace.TraceID, trace. gen.Lock() defer gen.Unlock() tid := trace.TraceID{} - gen.randSource.Read(tid[:]) + _, _ = gen.randSource.Read(tid[:]) sid := trace.SpanID{} - gen.randSource.Read(sid[:]) + _, _ = gen.randSource.Read(sid[:]) return tid, sid } diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 82246af593c..3f526c1d3cf 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -70,6 +70,8 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} { } } +// TracerProvider is an OpenTelemetry TracerProvider. It provides Tracers to +// instrumentation so it can trace operational flow through a system. type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Library]*tracer @@ -261,6 +263,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { return nil } +// TracerProviderOption configures a TracerProvider. type TracerProviderOption interface { apply(tracerProviderConfig) tracerProviderConfig } diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 0cfe584c926..1f5d460d739 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -53,7 +53,7 @@ func TestShutdownTraceProvider(t *testing.T) { _ = stp.Shutdown(context.Background()) - if sp.running != false { + if sp.running { t.Errorf("Error shutdown basicSpanProcesor\n") } } diff --git a/sdk/trace/sampler_env.go b/sdk/trace/sampler_env.go index 97f80576e68..02053b318ae 100644 --- a/sdk/trace/sampler_env.go +++ b/sdk/trace/sampler_env.go @@ -73,25 +73,26 @@ func samplerFromEnv() (Sampler, error) { case samplerAlwaysOff: return NeverSample(), nil case samplerTraceIDRatio: - ratio, err := parseTraceIDRatio(samplerArg, hasSamplerArg) - return ratio, err + if !hasSamplerArg { + return TraceIDRatioBased(1.0), nil + } + return parseTraceIDRatio(samplerArg) case samplerParentBasedAlwaysOn: return ParentBased(AlwaysSample()), nil case samplerParsedBasedAlwaysOff: return ParentBased(NeverSample()), nil case samplerParentBasedTraceIDRatio: - ratio, err := parseTraceIDRatio(samplerArg, hasSamplerArg) + if !hasSamplerArg { + return ParentBased(TraceIDRatioBased(1.0)), nil + } + ratio, err := parseTraceIDRatio(samplerArg) return ParentBased(ratio), err default: return nil, errUnsupportedSampler(sampler) } - } -func parseTraceIDRatio(arg string, hasSamplerArg bool) (Sampler, error) { - if !hasSamplerArg { - return TraceIDRatioBased(1.0), nil - } +func parseTraceIDRatio(arg string) (Sampler, error) { v, err := strconv.ParseFloat(arg, 64) if err != nil { return TraceIDRatioBased(1.0), samplerArgParseError{err} diff --git a/sdk/trace/sampling_test.go b/sdk/trace/sampling_test.go index 28e3e7736b3..a675ba93f0c 100644 --- a/sdk/trace/sampling_test.go +++ b/sdk/trace/sampling_test.go @@ -177,7 +177,6 @@ func TestParentBasedDefaultDescription(t *testing.T) { sampler.Description(), ) } - } // TraceIDRatioBased sampler requirements state diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index f359eef99d6..7ea04a86f05 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -223,8 +223,8 @@ func TestSpanIsRecording(t *testing.T) { } { tp := NewTracerProvider(WithSampler(tc.sampler)) _, span := tp.Tracer(name).Start(context.Background(), "StartSpan") - defer span.End() got := span.IsRecording() + span.End() assert.Equal(t, got, tc.want, name) } }) @@ -425,8 +425,8 @@ func TestSamplerAttributesLocalChildSpan(t *testing.T) { tp := NewTracerProvider(WithSampler(sampler), WithSyncer(te), WithResource(resource.Empty())) ctx := context.Background() - ctx, span := startLocalSpan(tp, ctx, "SpanOne", "span0") - _, spanTwo := startLocalSpan(tp, ctx, "SpanTwo", "span1") + ctx, span := startLocalSpan(ctx, tp, "SpanOne", "span0") + _, spanTwo := startLocalSpan(ctx, tp, "SpanTwo", "span1") spanTwo.End() span.End() @@ -950,7 +950,7 @@ func startNamedSpan(tp *TracerProvider, trName, name string, args ...trace.SpanS // passed name and with the passed context. The context is returned // along with the span so this parent can be used to create child // spans. -func startLocalSpan(tp *TracerProvider, ctx context.Context, trName, name string, args ...trace.SpanStartOption) (context.Context, trace.Span) { +func startLocalSpan(ctx context.Context, tp *TracerProvider, trName, name string, args ...trace.SpanStartOption) (context.Context, trace.Span) { ctx, span := tp.Tracer(trName).Start( ctx, name, @@ -970,10 +970,10 @@ func startLocalSpan(tp *TracerProvider, ctx context.Context, trName, name string // It also clears spanID in the to make the comparison easier. func endSpan(te *testExporter, span trace.Span) (*snapshot, error) { if !span.IsRecording() { - return nil, fmt.Errorf("IsRecording: got false, want true") + return nil, fmt.Errorf("method IsRecording: got false, want true") } if !span.SpanContext().IsSampled() { - return nil, fmt.Errorf("IsSampled: got false, want true") + return nil, fmt.Errorf("method IsSampled: got false, want true") } span.End() if te.Len() != 1 { @@ -1172,10 +1172,10 @@ func TestCustomStartEndTime(t *testing.T) { t.Fatalf("got %d exported spans, want one span", te.Len()) } got := te.Spans()[0] - if got.StartTime() != startTime { + if !got.StartTime().Equal(startTime) { t.Errorf("expected start time to be %s, got %s", startTime, got.StartTime()) } - if got.EndTime() != endTime { + if !got.EndTime().Equal(endTime) { t.Errorf("expected end time to be %s, got %s", endTime, got.EndTime()) } } @@ -1630,7 +1630,6 @@ func TestReadWriteSpan(t *testing.T) { // Verify the span can be written to. rw.SetName("bar") assert.Equal(t, "bar", rw.Name()) - // NOTE: This function tests ReadWriteSpan which is an interface which // embeds trace.Span and ReadOnlySpan. Since both of these interfaces have // their own tests, there is no point in testing all the possible methods @@ -1902,7 +1901,6 @@ func TestSamplerTraceState(t *testing.T) { } }) } - } type testIDGenerator struct { diff --git a/sdk/trace/tracetest/recorder.go b/sdk/trace/tracetest/recorder.go index dcf32c148dd..06673a1c049 100644 --- a/sdk/trace/tracetest/recorder.go +++ b/sdk/trace/tracetest/recorder.go @@ -32,6 +32,7 @@ type SpanRecorder struct { var _ sdktrace.SpanProcessor = (*SpanRecorder)(nil) +// NewSpanRecorder returns a new initialized SpanRecorder. func NewSpanRecorder() *SpanRecorder { return new(SpanRecorder) } diff --git a/sdk/trace/tracetest/span.go b/sdk/trace/tracetest/span.go index ece4633c525..b5f47735c1f 100644 --- a/sdk/trace/tracetest/span.go +++ b/sdk/trace/tracetest/span.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/otel/trace" ) +// SpanStubs is a slice of SpanStub use for testing an SDK. type SpanStubs []SpanStub // SpanStubsFromReadOnlySpans returns SpanStubs populated from ro. diff --git a/semconv/internal/http_test.go b/semconv/internal/http_test.go index 11f7ce57b59..302c3e0ea0a 100644 --- a/semconv/internal/http_test.go +++ b/semconv/internal/http_test.go @@ -1008,16 +1008,16 @@ func protoToInts(proto string) (int, int) { func kvStr(kvs []attribute.KeyValue) string { sb := strings.Builder{} - sb.WriteRune('[') + _, _ = sb.WriteRune('[') for idx, attr := range kvs { if idx > 0 { - sb.WriteString(", ") + _, _ = sb.WriteString(", ") } - sb.WriteString((string)(attr.Key)) - sb.WriteString(": ") - sb.WriteString(attr.Value.Emit()) + _, _ = sb.WriteString((string)(attr.Key)) + _, _ = sb.WriteString(": ") + _, _ = sb.WriteString(attr.Value.Emit()) } - sb.WriteRune(']') + _, _ = sb.WriteRune(']') return sb.String() } diff --git a/trace/trace.go b/trace/trace.go index 1bc040c2764..e1f61e0735b 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -160,7 +160,7 @@ func (tf TraceFlags) IsSampled() bool { } // WithSampled sets the sampling bit in a new copy of the TraceFlags. -func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { +func (tf TraceFlags) WithSampled(sampled bool) TraceFlags { // nolint:revive // sampled is not a control flag. if sampled { return tf | FlagsSampled } diff --git a/trace/trace_test.go b/trace/trace_test.go index c9ffbf69572..42003822037 100644 --- a/trace/trace_test.go +++ b/trace/trace_test.go @@ -83,11 +83,11 @@ func TestSpanContextEqual(t *testing.T) { spanID: [8]byte{42}, } - if a.Equal(b) != true { + if !a.Equal(b) { t.Error("Want: true, but have: false") } - if a.Equal(c) != false { + if a.Equal(c) { t.Error("Want: false, but have: true") } } diff --git a/trace/tracestate.go b/trace/tracestate.go index 7b7af6955f9..5e775ce5fbe 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -68,7 +68,6 @@ func parseMember(m string) (member, error) { Key: matches[1], Value: matches[4], }, nil - } // String encodes member into a string compliant with the W3C Trace Context From 7458aa961b3a4cfcf047b0990eefeb70a8c6d920 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 25 May 2022 10:04:56 -0500 Subject: [PATCH 183/886] Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 +- .github/workflows/dependabot.yml | 2 +- CHANGELOG.md | 4 + README.md | 8 - bridge/opencensus/go.mod | 10 +- bridge/opencensus/test/go.mod | 11 +- bridge/opentracing/go.mod | 7 +- example/fib/go.mod | 8 +- example/jaeger/go.mod | 11 +- example/jaeger/go.sum | 6 +- example/namedtracer/go.mod | 7 +- example/opencensus/go.mod | 11 +- example/otel-collector/go.mod | 18 +- example/passthrough/go.mod | 8 +- example/prometheus/go.mod | 19 +- example/zipkin/Dockerfile | 2 +- example/zipkin/go.mod | 9 +- exporters/jaeger/go.mod | 12 +- exporters/otlp/internal/retry/go.mod | 8 +- exporters/otlp/otlpmetric/go.mod | 18 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 17 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 22 ++- exporters/otlp/otlptrace/go.mod | 17 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 17 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 18 +- exporters/prometheus/go.mod | 20 +- exporters/stdout/stdoutmetric/go.mod | 12 +- exporters/stdout/stdouttrace/go.mod | 11 +- exporters/zipkin/go.mod | 11 +- go.mod | 8 +- internal/tools/go.mod | 175 +++++++++++++++++- metric/go.mod | 11 +- schema/go.mod | 8 +- sdk/go.mod | 9 +- sdk/metric/go.mod | 12 +- trace/go.mod | 8 +- 37 files changed, 516 insertions(+), 45 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d73c34b837b..06d52b94a50 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: 1.16 + DEFAULT_GO_VERSION: 1.17 jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d5f0de1335..da3fcf1b71f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: # Path to where test results will be saved. TEST_RESULTS: /tmp/test-results # Default minimum version of Go to support. - DEFAULT_GO_VERSION: 1.16 + DEFAULT_GO_VERSION: 1.17 jobs: lint: runs-on: ubuntu-latest @@ -109,7 +109,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: [1.18, 1.17, 1.16] + go-version: [1.18, 1.17] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index c101ef4bb32..763d0427b00 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v3 with: - go-version: '^1.16.0' + go-version: '^1.17.0' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e13e50b309..ca0334fbcea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) +### Removed + +- Support for go1.16. Support is now only for go1.17 and go1.18 (#2917) + ## [1.7.0/0.30.0] - 2022-04-28 ### Added diff --git a/README.md b/README.md index e7e0749748d..c87f800b948 100644 --- a/README.md +++ b/README.md @@ -43,26 +43,18 @@ This project is tested on the following systems. | ------- | ---------- | ------------ | | Ubuntu | 1.18 | amd64 | | Ubuntu | 1.17 | amd64 | -| Ubuntu | 1.16 | amd64 | | Ubuntu | 1.18 | 386 | | Ubuntu | 1.17 | 386 | -| Ubuntu | 1.16 | 386 | | MacOS | 1.18 | amd64 | | MacOS | 1.17 | amd64 | -| MacOS | 1.16 | amd64 | | Windows | 1.18 | amd64 | | Windows | 1.17 | amd64 | -| Windows | 1.16 | amd64 | | Windows | 1.18 | 386 | | Windows | 1.17 | 386 | -| Windows | 1.16 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. -Go 1.18 was added in March of 2022. -Go 1.16 will be removed around June 2022. - ## Getting Started You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/). diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index f14be6325c1..f625ab578e8 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus -go 1.16 +go 1.17 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f @@ -11,6 +11,14 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/benbjohnson/clock v1.3.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 722676c4739..937387f895c 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus/test -go 1.16 +go 1.17 require ( go.opencensus.io v0.23.0 @@ -10,6 +10,15 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + go.opentelemetry.io/otel/metric v0.30.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.30.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/bridge/opencensus => ../ diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 5e362031cc9..ef802c32103 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing -go 1.16 +go 1.17 replace go.opentelemetry.io/otel => ../.. @@ -10,4 +10,9 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/fib/go.mod b/example/fib/go.mod index 3a401f92ee2..ab7f0b26dc6 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/fib -go 1.16 +go 1.17 require ( go.opentelemetry.io/otel v1.7.0 @@ -9,6 +9,12 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index dfa5b00d5d8..08730f4584e 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/jaeger -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -14,4 +14,13 @@ require ( go.opentelemetry.io/otel/sdk v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/stretchr/objx v0.4.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index d739c043586..233cfd29693 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -1,5 +1,6 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -9,8 +10,9 @@ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index c35fe5bf676..86006a44c7c 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/namedtracer -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -15,6 +15,11 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index a51adf7751f..6f9017d734c 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/opencensus -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -18,6 +18,15 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect + go.opentelemetry.io/otel/metric v0.30.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace go.opentelemetry.io/otel/metric => ../../metric replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 5232c23bf15..502d4f1d4f6 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/otel-collector -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -15,6 +15,22 @@ require ( google.golang.org/grpc v1.46.2 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 // indirect + go.opentelemetry.io/proto/otlp v0.16.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + google.golang.org/protobuf v1.28.0 // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otlp/otlptrace diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 4aa81e1666e..309ab90fda2 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/passthrough -go 1.16 +go 1.17 require ( go.opentelemetry.io/otel v1.7.0 @@ -9,6 +9,12 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + replace ( go.opentelemetry.io/otel => ../.. go.opentelemetry.io/otel/sdk => ../../sdk diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 3bcc02f96fd..fca49abafcf 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/prometheus -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -15,6 +15,23 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/prometheus/client_golang v1.12.2 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + go.opentelemetry.io/otel/sdk v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect + google.golang.org/protobuf v1.26.0 // indirect +) + replace go.opentelemetry.io/otel/metric => ../../metric replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric diff --git a/example/zipkin/Dockerfile b/example/zipkin/Dockerfile index e269b63c56c..d7984583006 100644 --- a/example/zipkin/Dockerfile +++ b/example/zipkin/Dockerfile @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.16-alpine +FROM golang:1.17-alpine COPY . /go/src/github.com/open-telemetry/opentelemetry-go/ WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/zipkin/ RUN go install ./main.go diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 12867fd9f45..ee973ef4c18 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/zipkin -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../.. @@ -15,4 +15,11 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/openzipkin/zipkin-go v0.4.0 // indirect + golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index c246328a566..d3565af55c8 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/jaeger -go 1.16 +go 1.17 require ( github.com/google/go-cmp v0.5.8 @@ -10,6 +10,16 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/objx v0.1.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 5f5641a4f3a..932a47ef7c6 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -1,8 +1,14 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry -go 1.16 +go 1.17 require ( github.com/cenkalti/backoff/v4 v4.1.3 github.com/stretchr/testify v1.7.1 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 5b388032c15..6a4a19896f5 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric -go 1.16 +go 1.17 require ( github.com/google/go-cmp v0.5.8 @@ -15,6 +15,22 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/sdk => ../../../sdk diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 58f8ea59ef0..182ebe73672 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc -go 1.16 +go 1.17 require ( github.com/stretchr/testify v1.7.1 @@ -16,6 +16,21 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../../../.. replace go.opentelemetry.io/otel/sdk => ../../../../sdk diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 0b1234dc1a6..89c3993655e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp -go 1.16 +go 1.17 require ( github.com/stretchr/testify v1.7.1 @@ -11,6 +11,26 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel v1.7.0 // indirect + go.opentelemetry.io/otel/metric v0.30.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.30.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + google.golang.org/grpc v1.46.2 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../../../.. replace go.opentelemetry.io/otel/sdk => ../../../../sdk diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index bd2046ee07e..1046997b7a6 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace -go 1.16 +go 1.17 require ( github.com/google/go-cmp v0.5.8 @@ -14,6 +14,21 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/sdk => ../../../sdk diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 06b8c21fb4c..bd28d8dcf7c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -go 1.16 +go 1.17 require ( github.com/stretchr/testify v1.7.1 @@ -15,6 +15,21 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../../../.. replace go.opentelemetry.io/otel/sdk => ../../../../sdk diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 23940e9a5c0..0a4943c84ea 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp -go 1.16 +go 1.17 require ( github.com/stretchr/testify v1.7.1 @@ -13,6 +13,22 @@ require ( google.golang.org/protobuf v1.28.0 ) +require ( + github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/text v0.3.5 // indirect + google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + google.golang.org/grpc v1.46.2 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3eac5d1fd6b..d82186d0514 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/prometheus -go 1.16 +go 1.17 require ( github.com/prometheus/client_golang v1.12.2 @@ -11,6 +11,24 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect + google.golang.org/protobuf v1.26.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 83436139ede..4e6340d4a82 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../../.. @@ -15,6 +15,16 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.30.0 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/metric => ../../../metric replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 8edf46f1dc5..c88327cb2ae 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdouttrace -go 1.16 +go 1.17 replace ( go.opentelemetry.io/otel => ../../.. @@ -14,4 +14,13 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 40cc03313a8..fd070111af8 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/zipkin -go 1.16 +go 1.17 require ( github.com/google/go-cmp v0.5.8 @@ -11,6 +11,15 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) + replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. diff --git a/go.mod b/go.mod index cb6feb023fd..fb8ce985ea6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel -go 1.16 +go 1.17 require ( github.com/go-logr/logr v1.2.3 @@ -10,4 +10,10 @@ require ( go.opentelemetry.io/otel/trace v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/trace => ./trace diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 8821a9cb5a2..8cbe5097d3b 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/internal/tools -go 1.16 +go 1.17 require ( github.com/client9/misspell v0.3.4 @@ -16,3 +16,176 @@ require ( golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 golang.org/x/tools v0.1.10 ) + +require ( + 4d63.com/gochecknoglobals v0.1.0 // indirect + github.com/Antonboom/errname v0.1.5 // indirect + github.com/Antonboom/nilnil v0.1.0 // indirect + github.com/BurntSushi/toml v1.0.0 // indirect + github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Microsoft/go-winio v0.4.16 // indirect + github.com/OpenPeeDeeP/depguard v1.1.0 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect + github.com/acomagu/bufpipe v1.0.3 // indirect + github.com/alexkohler/prealloc v1.0.0 // indirect + github.com/ashanbrown/forbidigo v1.3.0 // indirect + github.com/ashanbrown/makezero v1.1.1 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/bkielbasa/cyclop v1.2.0 // indirect + github.com/blizzy78/varnamelen v0.8.0 // indirect + github.com/bombsimon/wsl/v3 v3.3.0 // indirect + github.com/breml/bidichk v0.2.3 // indirect + github.com/breml/errchkjson v0.3.0 // indirect + github.com/butuzov/ireturn v0.1.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/charithe/durationcheck v0.0.9 // indirect + github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect + github.com/daixiang0/gci v0.3.3 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/denis-tingaikin/go-header v0.4.3 // indirect + github.com/emirpasic/gods v1.12.0 // indirect + github.com/esimonov/ifshort v1.0.4 // indirect + github.com/ettle/strcase v0.1.1 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/fatih/structtag v1.2.0 // indirect + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fzipp/gocyclo v0.4.0 // indirect + github.com/go-critic/go-critic v0.6.2 // indirect + github.com/go-git/gcfg v1.5.0 // indirect + github.com/go-git/go-billy/v5 v5.3.1 // indirect + github.com/go-git/go-git/v5 v5.4.2 // indirect + github.com/go-toolsmith/astcast v1.0.0 // indirect + github.com/go-toolsmith/astcopy v1.0.0 // indirect + github.com/go-toolsmith/astequal v1.0.1 // indirect + github.com/go-toolsmith/astfmt v1.0.0 // indirect + github.com/go-toolsmith/astp v1.0.0 // indirect + github.com/go-toolsmith/strparse v1.0.0 // indirect + github.com/go-toolsmith/typep v1.0.2 // indirect + github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gofrs/flock v0.8.1 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect + github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect + github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect + github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect + github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect + github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect + github.com/golangci/misspell v0.3.5 // indirect + github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2 // indirect + github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect + github.com/google/go-cmp v0.5.8 // indirect + github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect + github.com/gostaticanalysis/analysisutil v0.7.1 // indirect + github.com/gostaticanalysis/comment v1.4.2 // indirect + github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect + github.com/gostaticanalysis/nilerr v0.1.1 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-version v1.4.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hexops/gotextdiff v1.0.3 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/itchyny/timefmt-go v0.1.3 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/jgautheron/goconst v1.5.1 // indirect + github.com/jingyugao/rowserrcheck v1.1.1 // indirect + github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect + github.com/julz/importas v0.1.0 // indirect + github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect + github.com/kisielk/errcheck v1.6.0 // indirect + github.com/kisielk/gotool v1.0.0 // indirect + github.com/kulti/thelper v0.5.1 // indirect + github.com/kunwardeep/paralleltest v1.0.3 // indirect + github.com/kyoh86/exportloopref v0.1.8 // indirect + github.com/ldez/gomoddirectives v0.2.2 // indirect + github.com/ldez/tagliatelle v0.3.1 // indirect + github.com/leonklingele/grouper v1.1.0 // indirect + github.com/lufeee/execinquery v1.0.0 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/maratori/testpackage v1.0.1 // indirect + github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/mbilski/exhaustivestruct v1.2.0 // indirect + github.com/mgechev/revive v1.1.4 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/moricho/tparallel v0.2.1 // indirect + github.com/nakabonne/nestif v0.3.1 // indirect + github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect + github.com/nishanths/exhaustive v0.7.11 // indirect + github.com/nishanths/predeclared v0.2.1 // indirect + github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/otiai10/copy v1.7.0 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect + github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b // indirect + github.com/prometheus/client_golang v1.7.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.10.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/quasilyte/go-ruleguard v0.3.15 // indirect + github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 // indirect + github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect + github.com/ryancurrah/gomodguard v1.2.3 // indirect + github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect + github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect + github.com/securego/gosec/v2 v2.10.0 // indirect + github.com/sergi/go-diff v1.1.0 // indirect + github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect + github.com/sirupsen/logrus v1.8.1 // indirect + github.com/sivchari/containedctx v1.0.2 // indirect + github.com/sivchari/tenv v1.4.7 // indirect + github.com/sonatard/noctx v0.0.1 // indirect + github.com/sourcegraph/go-diff v0.6.1 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/cobra v1.4.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.10.1 // indirect + github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect + github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/testify v1.7.1 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/sylvia7788/contextcheck v1.0.4 // indirect + github.com/tdakkota/asciicheck v0.1.1 // indirect + github.com/tetafro/godot v1.4.11 // indirect + github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect + github.com/tomarrell/wrapcheck/v2 v2.6.0 // indirect + github.com/tommy-muehle/go-mnd/v2 v2.5.0 // indirect + github.com/ultraware/funlen v0.0.3 // indirect + github.com/ultraware/whitespace v0.0.5 // indirect + github.com/uudashr/gocognit v1.0.5 // indirect + github.com/xanzy/ssh-agent v0.3.0 // indirect + github.com/yagipy/maintidx v1.0.0 // indirect + github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 // indirect + gitlab.com/bosi/decorder v0.2.1 // indirect + go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.7.0 // indirect + go.uber.org/zap v1.21.0 // indirect + golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect + golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/protobuf v1.27.1 // indirect + gopkg.in/ini.v1 v1.66.2 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + honnef.co/go/tools v0.2.2 // indirect + mvdan.cc/gofumpt v0.3.1 // indirect + mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect + mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect + mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 // indirect +) diff --git a/metric/go.mod b/metric/go.mod index 223f1e9fcd9..2f376123d6e 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -1,12 +1,21 @@ module go.opentelemetry.io/otel/metric -go 1.16 +go 1.17 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel => ../ replace go.opentelemetry.io/otel/trace => ../trace diff --git a/schema/go.mod b/schema/go.mod index e2127999806..9114ff31a8f 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -1,9 +1,15 @@ module go.opentelemetry.io/otel/schema -go 1.16 +go 1.17 require ( github.com/Masterminds/semver/v3 v3.1.1 github.com/stretchr/testify v1.7.1 gopkg.in/yaml.v2 v2.4.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/sdk/go.mod b/sdk/go.mod index 4f4212332c6..78069e9d4f2 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk -go 1.16 +go 1.17 replace go.opentelemetry.io/otel => ../ @@ -13,4 +13,11 @@ require ( golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) + replace go.opentelemetry.io/otel/trace => ../trace diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 0fb932027b8..d431c9d348d 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk/metric -go 1.16 +go 1.17 replace go.opentelemetry.io/otel => ../.. @@ -17,3 +17,13 @@ require ( go.opentelemetry.io/otel/metric v0.30.0 go.opentelemetry.io/otel/sdk v1.7.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.7.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/trace/go.mod b/trace/go.mod index 1a8d9723229..d5fde13218b 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/trace -go 1.16 +go 1.17 replace go.opentelemetry.io/otel => ../ @@ -9,3 +9,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.7.0 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) From 4155b356248af84c0a9b3fbb8613695d1bc53f2a Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 26 May 2022 16:31:35 +0200 Subject: [PATCH 184/886] Use ByteSliceToString from golang.org/x/sys/unix (#2924) Use unix.ByteSliceToString to convert Utsname []byte fields to strings. This also allows to drop the charsToString helper which serves the same purpose and matches ByteSliceToString's implementation. Signed-off-by: Tobias Klauser Co-authored-by: Tyler Yahn --- sdk/resource/export_common_unix_test.go | 1 - sdk/resource/os_unix.go | 20 +++++--------------- sdk/resource/os_unix_test.go | 24 ------------------------ 3 files changed, 5 insertions(+), 40 deletions(-) diff --git a/sdk/resource/export_common_unix_test.go b/sdk/resource/export_common_unix_test.go index 3b8b03cf43e..a296ff6f245 100644 --- a/sdk/resource/export_common_unix_test.go +++ b/sdk/resource/export_common_unix_test.go @@ -19,7 +19,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" var ( Uname = uname - CharsToString = charsToString GetFirstAvailableFile = getFirstAvailableFile ) diff --git a/sdk/resource/os_unix.go b/sdk/resource/os_unix.go index 42894a15b5c..1c84afc1852 100644 --- a/sdk/resource/os_unix.go +++ b/sdk/resource/os_unix.go @@ -18,7 +18,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( - "bytes" "fmt" "os" @@ -69,23 +68,14 @@ func uname() (string, error) { } return fmt.Sprintf("%s %s %s %s %s", - charsToString(utsName.Sysname[:]), - charsToString(utsName.Nodename[:]), - charsToString(utsName.Release[:]), - charsToString(utsName.Version[:]), - charsToString(utsName.Machine[:]), + unix.ByteSliceToString(utsName.Sysname[:]), + unix.ByteSliceToString(utsName.Nodename[:]), + unix.ByteSliceToString(utsName.Release[:]), + unix.ByteSliceToString(utsName.Version[:]), + unix.ByteSliceToString(utsName.Machine[:]), ), nil } -// charsToString converts a C-like null-terminated char array to a Go string. -func charsToString(charArray []byte) string { - if i := bytes.IndexByte(charArray, 0); i >= 0 { - charArray = charArray[:i] - } - - return string(charArray) -} - // getFirstAvailableFile returns an *os.File of the first available // file from a list of candidate file paths. func getFirstAvailableFile(candidates []string) (*os.File, error) { diff --git a/sdk/resource/os_unix_test.go b/sdk/resource/os_unix_test.go index af6178613e1..d6522d01dd0 100644 --- a/sdk/resource/os_unix_test.go +++ b/sdk/resource/os_unix_test.go @@ -64,30 +64,6 @@ func TestUnameError(t *testing.T) { resource.SetDefaultUnameProvider() } -func TestCharsToString(t *testing.T) { - tt := []struct { - Name string - Bytes []byte - Expected string - }{ - {"Nil array", nil, ""}, - {"Empty array", []byte{}, ""}, - {"Empty string (null terminated)", []byte{0x00}, ""}, - {"Nonempty string (null terminated)", []byte{0x31, 0x32, 0x33, 0x00}, "123"}, - {"Nonempty string (non-null terminated)", []byte{0x31, 0x32, 0x33}, "123"}, - {"Nonempty string with values after null", []byte{0x31, 0x32, 0x33, 0x00, 0x34}, "123"}, - } - - for _, tc := range tt { - tc := tc - - t.Run(tc.Name, func(t *testing.T) { - result := resource.CharsToString(tc.Bytes) - require.EqualValues(t, tc.Expected, result) - }) - } -} - func TestGetFirstAvailableFile(t *testing.T) { tempDir := t.TempDir() From 1818a823723cfc1c69d3dd063387b338760487b5 Mon Sep 17 00:00:00 2001 From: petrie <244236866@qq.com> Date: Wed, 1 Jun 2022 22:59:27 +0800 Subject: [PATCH 185/886] docs: fix typo (#2935) --- website_docs/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index 5ea73dc3394..ea88547e0d5 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -11,7 +11,7 @@ Instrumentation is the process of adding observability code to your application. To create spans, you'll need to acquire or initialize a tracer first. -### Initiallizing a new tracer +### Initializing a new tracer Ensure you have the right packages installed: From ec33fe0fbcc2004b5ae280eac53faf8b59205a16 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 2 Jun 2022 17:18:17 +0200 Subject: [PATCH 186/886] add timeout to grpc connection in otel-collector example (#2939) --- example/otel-collector/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index c3372ab482a..7720e96f650 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -58,6 +58,8 @@ func initProvider() (func(context.Context) error, error) { // `localhost:30080` endpoint. Otherwise, replace `localhost` with the // endpoint of your cluster. If you run the app inside k8s, then you can // probably connect directly to the service through dns + ctx, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) if err != nil { return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err) From acce4e680bb1128c563b77ac232a4ada1a272a0d Mon Sep 17 00:00:00 2001 From: Brad Topol Date: Fri, 10 Jun 2022 10:38:39 -0400 Subject: [PATCH 187/886] Closes: #2951 (#2952) This PR updates the example listed in the getting started doc so that it will compile without error. It also makes this example consistent with the code found in https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go Signed-off-by: Brad Topol --- website_docs/getting-started.md | 1 + 1 file changed, 1 insertion(+) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 5fdf2418187..b9b14bacbc9 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -284,6 +284,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.10.0" ) ``` From a9ab7e0a88e80f2696d60489a2d2d08e3dab7741 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Tue, 14 Jun 2022 15:49:05 +0200 Subject: [PATCH 188/886] fix data-model link (#2955) --- sdk/metric/aggregator/exponential/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/metric/aggregator/exponential/README.md b/sdk/metric/aggregator/exponential/README.md index b58d6aecbb2..490e1147557 100644 --- a/sdk/metric/aggregator/exponential/README.md +++ b/sdk/metric/aggregator/exponential/README.md @@ -7,7 +7,7 @@ This document is a placeholder for future Aggregator, once seen in [PR Only the mapping functions have been made available at this time. The equations tested here are specified in the [data model for Exponential -Histogram data points](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponentialhistogram). +Histogram data points](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#exponentialhistogram). ### Mapping function From 3e8dd4badfbb46e73b6d46f2f364e6fd1bd30f70 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 20 Jun 2022 11:50:06 -0700 Subject: [PATCH 189/886] Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (#2960) --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 502d4f1d4f6..536a5f99ad1 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -23,7 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 // indirect - go.opentelemetry.io/proto/otlp v0.16.0 // indirect + go.opentelemetry.io/proto/otlp v0.18.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 4d8dc9f83af..574b556389c 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 6a4a19896f5..48415eb8521 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.30.0 go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/sdk/metric v0.30.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 454fcd46d27..0cd110965e4 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -165,8 +165,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 182ebe73672..779e09f9cb8 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.30.0 go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/sdk/metric v0.30.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 454fcd46d27..0cd110965e4 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -165,8 +165,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 89c3993655e..7a5d4a21af4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.30.0 go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 454fcd46d27..0cd110965e4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -165,8 +165,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 1046997b7a6..f4cbc831a3d 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 212a83e8ee3..a8fc336d443 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bd28d8dcf7c..c675c4a66eb 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 3a1e26f6e76..15fe71455fe 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -164,8 +164,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0a4943c84ea..0cbec3ba70c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 go.opentelemetry.io/otel/sdk v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 - go.opentelemetry.io/proto/otlp v0.16.0 + go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 212a83e8ee3..a8fc336d443 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.16.0 h1:WHzDWdXUvbc5bG2ObdrGfaNpQz7ft7QN9HHmJlbiB1E= -go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= +go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 5fabad69e39c94b037eb1fc70ac2154bbd752e34 Mon Sep 17 00:00:00 2001 From: Craig Pastro Date: Fri, 24 Jun 2022 14:17:33 -0700 Subject: [PATCH 190/886] Move to using Instrumentation Scope (#2976) * Move to using Instrumentation Scope * Use type alias, not definition * Add a changelog entry --- CHANGELOG.md | 1 + sdk/instrumentation/library.go | 10 +--------- sdk/instrumentation/scope.go | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 sdk/instrumentation/scope.go diff --git a/CHANGELOG.md b/CHANGELOG.md index ca0334fbcea..b502a1fb6b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) +- In the `go.opentelemetry.io/otel/sdk/instrumentation` package rename `Library` to `Scope` and alias `Library` as `Scope` (#2976) ### Removed diff --git a/sdk/instrumentation/library.go b/sdk/instrumentation/library.go index 6f0016169e3..ec6451849bf 100644 --- a/sdk/instrumentation/library.go +++ b/sdk/instrumentation/library.go @@ -22,12 +22,4 @@ For more information see package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" // Library represents the instrumentation library. -type Library struct { - // Name is the name of the instrumentation library. This should be the - // Go package name of that library. - Name string - // Version is the version of the instrumentation library. - Version string - // SchemaURL of the telemetry emitted by the library. - SchemaURL string -} +type Library = Scope diff --git a/sdk/instrumentation/scope.go b/sdk/instrumentation/scope.go new file mode 100644 index 00000000000..775de40e30c --- /dev/null +++ b/sdk/instrumentation/scope.go @@ -0,0 +1,33 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package instrumentation provides an instrumentation scope structure to be +passed to both the OpenTelemetry Tracer and Meter components. + +For more information see +[this](https://github.com/open-telemetry/oteps/blob/main/text/0083-component.md). +*/ +package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" + +// Scope represents the instrumentation scope. +type Scope struct { + // Name is the name of the instrumentation scope. This should be the + // Go package name of that scope. + Name string + // Version is the version of the instrumentation scope. + Version string + // SchemaURL of the telemetry emitted by the scope. + SchemaURL string +} From ef6c0da0de3b39c20a753354446807d7577aca61 Mon Sep 17 00:00:00 2001 From: Petrie Liu <244236866@qq.com> Date: Sat, 25 Jun 2022 05:27:36 +0800 Subject: [PATCH 191/886] docs(website_docs): fix exporting_data.md and getting-started.md toc (#2930) * docs(website_docs): fix toc * docs(website_docs): fix toc * update exporting_data.md for rerun check-links * update exporting_data.md for rerun check-links Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- website_docs/exporting_data.md | 10 +++++----- website_docs/getting-started.md | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/website_docs/exporting_data.md b/website_docs/exporting_data.md index b1045e7a842..4b409aa574f 100644 --- a/website_docs/exporting_data.md +++ b/website_docs/exporting_data.md @@ -6,7 +6,7 @@ linkTitle: Exporting data Once you've instrumented your code, you need to get the data out in order to do anything useful with it. This page will cover the basics of the process and export pipeline. -# Sampling +## Sampling Sampling is a process that restricts the amount of traces that are generated by a system. The exact sampler you should use depends on your specific needs, but in general you should make a decision at the start of a trace, and allow the sampling decision to propagate to other services. @@ -27,7 +27,7 @@ Other samplers include: When you're in production, you should consider using the `TraceIDRatioBased` sampler with the `ParentBased` sampler. -# Resources +## Resources Resources are a special type of attribute that apply to all spans generated by a process. These should be used to represent underlying metadata about a process that's non-ephemeral - for example, the hostname of a process, or its instance ID. @@ -62,19 +62,19 @@ resources := resource.New(context.Background(), ) ``` -# OTLP Exporter +## OTLP Exporter OpenTelemetry Protocol (OTLP) export is available in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetrics` packages. Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp) -# Jaeger Exporter +## Jaeger Exporter Jaeger export is available in the `go.opentelemetry.io/otel/exporters/jaeger` package. Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger) -# Prometheus Exporter +## Prometheus Exporter Prometheus export is available in the `go.opentelemetry.io/otel/exporters/prometheus` package. diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index b9b14bacbc9..ae9bb0faa55 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -134,7 +134,7 @@ goodbye The application can be exited with CTRL+C. You should see a similar output as above, if not make sure to go back and fix any errors. -# Trace Instrumentation +## Trace Instrumentation OpenTelemetry is split into two parts: an API to instrument code with, and SDKs that implement the API. To start integrating OpenTelemetry into any project, the API is used to define how telemetry is generated. To generate tracing telemetry in your application you will use the OpenTelemetry Trace API from the [`go.opentelemetry.io/otel/trace`] package. @@ -263,7 +263,7 @@ A `Run` span will be a parent to both a `Poll` and `Write` span, and the `Write` Now how do you actually see the produced spans? To do this you will need to configure and install an SDK. -# SDK Installation +## SDK Installation OpenTelemetry is designed to be modular in its implementation of the OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, [`go.opentelemetry.io/otel/sdk`], that implements this API and adheres to the OpenTelemetry specification. To start using this SDK you will first need to create an exporter, but before anything can happen we need to install some packages. Run the following in the `fib` directory to install the trace STDOUT exporter and the SDK. @@ -288,7 +288,7 @@ import ( ) ``` -## Creating a Console Exporter +### Creating a Console Exporter The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like [Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), [Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/zipkin), and [Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). @@ -309,7 +309,7 @@ func newExporter(w io.Writer) (trace.SpanExporter, error) { This creates a new console exporter with basic options. You will use this function later when you configure the SDK to send telemetry data to it, but first you need to make sure that data is identifiable. -## Creating a Resource +### Creating a Resource Telemetry data can be crucial to solving issues with a service. The catch is, you need a way to identify what service, or even what service instance, that data is coming from. OpenTelemetry uses a [`Resource`] to represent the entity producing telemetry. Add the following function to the `main.go` file to create an appropriate [`Resource`] for the application. @@ -331,7 +331,7 @@ func newResource() *resource.Resource { Any information you would like to associate with all telemetry data the SDK handles can be added to the returned [`Resource`]. This is done by registering the [`Resource`] with the [`TracerProvider`]. Something you can now create! -## Installing a Tracer Provider +### Installing a Tracer Provider You have your application instrumented to produce telemetry data and you have an exporter to send that data to the console, but how are they connected? This is where the [`TracerProvider`] is used. It is a centralized point where instrumentation will get a [`Tracer`] from and funnels the telemetry data from these [`Tracer`]s to export pipelines. @@ -372,7 +372,7 @@ There's a fair amount going on here. First you are creating a console exporter t Do you remember in the previous instrumentation section when we used the global [`TracerProvider`] to get a [`Tracer`]? This last step, registering the [`TracerProvider`] globally, is what will connect that instrumentation's [`Tracer`] with this [`TracerProvider`]. This pattern, using a global [`TracerProvider`], is convenient, but not always appropriate. [`TracerProvider`]s can be explicitly passed to instrumentation or inferred from a context that contains a span. For this simple example using a global provider makes sense, but for more complex or distributed codebases these other ways of passing [`TracerProvider`]s may make more sense. -# Putting It All Together +## Putting It All Together You should now have a working application that produces trace telemetry data! Give it a try. @@ -388,7 +388,7 @@ goodbye A new file named `traces.txt` should be created in your working directory. All the traces created from running your application should be in there! -# (Bonus) Errors +## (Bonus) Errors At this point you have a working application and it is producing tracing telemetry data. Unfortunately, it was discovered that there is an error in the core functionality of the `fib` module. @@ -530,7 +530,7 @@ Excellent! The application no longer returns wrong values, and looking at the te ] ``` -# What's Next +## What's Next This guide has walked you through adding tracing instrumentation to an application and using a console exporter to send telemetry data to a file. There From 36b37c4af5780a543f746d872fa134f545b8b4c3 Mon Sep 17 00:00:00 2001 From: Kshitija Murudi Date: Tue, 28 Jun 2022 14:58:51 -0700 Subject: [PATCH 192/886] Update getting-started.md (#2984) grammar edit for line 175 of readme --- website_docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index ae9bb0faa55..f0672a7efb4 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -172,7 +172,7 @@ const name = "fib" Using the full-qualified package name, something that should be unique for Go packages, is the standard way to identify a [`Tracer`]. If your example package name differs, be sure to update the name you use here to match. -Everything should be in place now to start tracing your application. But first, what is a trace? And, how exactly should you build them for you application? +Everything should be in place now to start tracing your application. But first, what is a trace? And, how exactly should you build them for your application? To back up a bit, a trace is a type of telemetry that represents work being done by a service. A trace is a record of the connection(s) between participants processing a transaction, often through client/server requests processing and other forms of communication. From c2dc940e0b48e61712e4f8f6f2320d8fd4c9aac6 Mon Sep 17 00:00:00 2001 From: Petrie Liu Date: Sat, 2 Jul 2022 23:55:14 +0800 Subject: [PATCH 193/886] fix typo (#2986) * fix typo * spell fix --- baggage/baggage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/baggage/baggage.go b/baggage/baggage.go index 9f82a2507b8..eba180e04f8 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -157,7 +157,7 @@ func (p Property) Key() string { return p.key } -// Value returns the Property value. Additionally a boolean value is returned +// Value returns the Property value. Additionally, a boolean value is returned // indicating if the returned value is the empty if the Property has a value // that is empty or if the value is not set. func (p Property) Value() (string, bool) { @@ -392,7 +392,7 @@ func New(members ...Member) (Baggage, error) { } } - // Check member numbers after deduplicating. + // Check member numbers after deduplication. if len(b) > maxMembers { return Baggage{}, errMemberNumber } @@ -454,7 +454,7 @@ func Parse(bStr string) (Baggage, error) { func (b Baggage) Member(key string) Member { v, ok := b.list[key] if !ok { - // We do not need to worry about distiguising between the situation + // We do not need to worry about distinguishing between the situation // where a zero-valued Member is included in the Baggage because a // zero-valued Member is invalid according to the W3C Baggage // specification (it has an empty key). From 376973c2d849168655b56a7af382d36fbe6ac2a6 Mon Sep 17 00:00:00 2001 From: Petrie Liu Date: Tue, 5 Jul 2022 23:35:21 +0800 Subject: [PATCH 194/886] typo fix (#2991) --- metric/instrument/asyncfloat64/asyncfloat64.go | 2 +- metric/instrument/asyncint64/asyncint64.go | 2 +- metric/instrument/config.go | 2 +- metric/instrument/syncfloat64/syncfloat64.go | 2 +- metric/instrument/syncint64/syncint64.go | 2 +- metric/internal/global/state_test.go | 2 +- metric/noop.go | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 91c034fb2a0..370715f694c 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -45,7 +45,7 @@ type Counter interface { instrument.Asynchronous } -// UpDownCounter is an instrument that records increasing or decresing values. +// UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { // Observe records the state of the instrument. // diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 9dfba553d78..41a561bc4a2 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -45,7 +45,7 @@ type Counter interface { instrument.Asynchronous } -// UpDownCounter is an instrument that records increasing or decresing values. +// UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { // Observe records the state of the instrument. // diff --git a/metric/instrument/config.go b/metric/instrument/config.go index 842c65336d2..8778bce1619 100644 --- a/metric/instrument/config.go +++ b/metric/instrument/config.go @@ -27,7 +27,7 @@ func (cfg Config) Description() string { return cfg.description } -// Unit describes the measurement unit for a instrument. +// Unit describes the measurement unit for an instrument. func (cfg Config) Unit() unit.Unit { return cfg.unit } diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go index 1989292ecf8..435db1127bc 100644 --- a/metric/instrument/syncfloat64/syncfloat64.go +++ b/metric/instrument/syncfloat64/syncfloat64.go @@ -39,7 +39,7 @@ type Counter interface { instrument.Synchronous } -// UpDownCounter is an instrument that records increasing or decresing values. +// UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go index ee882bcd922..c77a4672860 100644 --- a/metric/instrument/syncint64/syncint64.go +++ b/metric/instrument/syncint64/syncint64.go @@ -39,7 +39,7 @@ type Counter interface { instrument.Synchronous } -// UpDownCounter is an instrument that records increasing or decresing values. +// UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go index 0ef1f80f3a4..9afd23c3cfa 100644 --- a/metric/internal/global/state_test.go +++ b/metric/internal/global/state_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// htmp://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/metric/noop.go b/metric/noop.go index 622c99ace94..e8b9a9a1458 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -43,22 +43,22 @@ func NewNoopMeter() Meter { type noopMeter struct{} -// AsyncInt64 creates a instrument that does not record any metrics. +// AsyncInt64 creates an instrument that does not record any metrics. func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { return nonrecordingAsyncInt64Instrument{} } -// AsyncFloat64 creates a instrument that does not record any metrics. +// AsyncFloat64 creates an instrument that does not record any metrics. func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { return nonrecordingAsyncFloat64Instrument{} } -// SyncInt64 creates a instrument that does not record any metrics. +// SyncInt64 creates an instrument that does not record any metrics. func (noopMeter) SyncInt64() syncint64.InstrumentProvider { return nonrecordingSyncInt64Instrument{} } -// SyncFloat64 creates a instrument that does not record any metrics. +// SyncFloat64 creates an instrument that does not record any metrics. func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { return nonrecordingSyncFloat64Instrument{} } From 5795c70e0c80d4ae71b83b75c284964557ccfe97 Mon Sep 17 00:00:00 2001 From: Guangya Liu Date: Wed, 6 Jul 2022 14:41:30 -0400 Subject: [PATCH 195/886] added traces.txt to gitignore for fib (#2993) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 99230bae28b..0b605b3d67d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ coverage.* gen/ /example/fib/fib +/example/fib/traces.txt /example/jaeger/jaeger /example/namedtracer/namedtracer /example/opencensus/opencensus From 575e1bb27025c73fd76f1e6b9dc2727b85867fdc Mon Sep 17 00:00:00 2001 From: Craig Pastro Date: Wed, 6 Jul 2022 11:55:46 -0700 Subject: [PATCH 196/886] Deprecate Library and move all uses to Scope (#2977) * Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn * Update based on feedback * Revert change Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 7 ++ exporters/jaeger/jaeger.go | 8 +-- .../tracetransform/instrumentation.go | 4 +- .../otlptrace/internal/tracetransform/span.go | 10 +-- .../internal/tracetransform/span_test.go | 2 +- exporters/zipkin/model.go | 8 +-- sdk/instrumentation/library.go | 1 + sdk/metric/controller/basic/controller.go | 20 +++--- .../controller/basic/controller_test.go | 2 +- sdk/metric/metrictest/exporter.go | 7 +- sdk/trace/provider.go | 14 ++-- sdk/trace/provider_test.go | 2 +- sdk/trace/snapshot.go | 40 ++++++----- sdk/trace/span.go | 16 ++++- .../span_processor_filter_example_test.go | 2 +- sdk/trace/trace_test.go | 58 +++++++-------- sdk/trace/tracer.go | 4 +- sdk/trace/tracetest/span.go | 71 ++++++++++--------- 18 files changed, 155 insertions(+), 121 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b502a1fb6b4..713eed7fd90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support for go1.16. Support is now only for go1.17 and go1.18 (#2917) +### Deprecated + +- The `Library` struct in the `go.opentelemetry.io/otel/sdk/instrumentation` package is deprecated. + Use the equivalent `Scope` struct instead. (#2977) +- The `ReadOnlySpan.InstrumentationLibrary` method from the `go.opentelemetry.io/otel/sdk/trace` package is deprecated. + Use the equivalent `ReadOnlySpan.InstrumentationScope` method instead. (#2977) + ## [1.7.0/0.30.0] - 2022-04-28 ### Added diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index d9b58ec4f82..d6d2fcfbbee 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -142,10 +142,10 @@ func spanToThrift(ss sdktrace.ReadOnlySpan) *gen.Span { } } - if il := ss.InstrumentationLibrary(); il.Name != "" { - tags = append(tags, getStringTag(keyInstrumentationLibraryName, il.Name)) - if il.Version != "" { - tags = append(tags, getStringTag(keyInstrumentationLibraryVersion, il.Version)) + if is := ss.InstrumentationScope(); is.Name != "" { + tags = append(tags, getStringTag(keyInstrumentationLibraryName, is.Name)) + if is.Version != "" { + tags = append(tags, getStringTag(keyInstrumentationLibraryVersion, is.Version)) } } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 213f9f92a4e..7aaec38d22a 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -19,8 +19,8 @@ import ( commonpb "go.opentelemetry.io/proto/otlp/common/v1" ) -func InstrumentationScope(il instrumentation.Library) *commonpb.InstrumentationScope { - if il == (instrumentation.Library{}) { +func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationScope { + if il == (instrumentation.Scope{}) { return nil } return &commonpb.InstrumentationScope{ diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index 0e8d00a0494..b83cbd72478 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -34,7 +34,7 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { type key struct { r attribute.Distinct - il instrumentation.Library + is instrumentation.Scope } ssm := make(map[key]*tracepb.ScopeSpans) @@ -47,15 +47,15 @@ func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { rKey := sd.Resource().Equivalent() k := key{ r: rKey, - il: sd.InstrumentationLibrary(), + is: sd.InstrumentationScope(), } scopeSpan, iOk := ssm[k] if !iOk { - // Either the resource or instrumentation library were unknown. + // Either the resource or instrumentation scope were unknown. scopeSpan = &tracepb.ScopeSpans{ - Scope: InstrumentationScope(sd.InstrumentationLibrary()), + Scope: InstrumentationScope(sd.InstrumentationScope()), Spans: []*tracepb.Span{}, - SchemaUrl: sd.InstrumentationLibrary().SchemaURL, + SchemaUrl: sd.InstrumentationScope().SchemaURL, } } scopeSpan.Spans = append(scopeSpan.Spans, span(sd)) diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 3bb203eae80..20c23d49458 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -264,7 +264,7 @@ func TestSpanData(t *testing.T) { attribute.Int64("rk2", 5), attribute.StringSlice("rk3", []string{"sv1", "sv2"}), ), - InstrumentationLibrary: instrumentation.Library{ + InstrumentationLibrary: instrumentation.Scope{ Name: "go.opentelemetry.io/test/otel", Version: "v0.0.1", SchemaURL: semconv.SchemaURL, diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index f733651dac6..81d0fc1a706 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -218,10 +218,10 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { delete(m, "error") } - if il := data.InstrumentationLibrary(); il.Name != "" { - m[keyInstrumentationLibraryName] = il.Name - if il.Version != "" { - m[keyInstrumentationLibraryVersion] = il.Version + if is := data.InstrumentationScope(); is.Name != "" { + m[keyInstrumentationLibraryName] = is.Name + if is.Version != "" { + m[keyInstrumentationLibraryVersion] = is.Version } } diff --git a/sdk/instrumentation/library.go b/sdk/instrumentation/library.go index ec6451849bf..246873345de 100644 --- a/sdk/instrumentation/library.go +++ b/sdk/instrumentation/library.go @@ -22,4 +22,5 @@ For more information see package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" // Library represents the instrumentation library. +// Deprecated: please use Scope instead. type Library = Scope diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index a46e3835e3b..2107b16cb3c 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -59,7 +59,7 @@ var ErrControllerStarted = fmt.Errorf("controller already started") type Controller struct { // lock synchronizes Start() and Stop(). lock sync.Mutex - libraries sync.Map + scopes sync.Map checkpointerFactory export.CheckpointerFactory resource *resource.Resource @@ -85,21 +85,21 @@ var _ metric.MeterProvider = &Controller{} // with opts. func (c *Controller) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { cfg := metric.NewMeterConfig(opts...) - library := instrumentation.Library{ + scope := instrumentation.Scope{ Name: instrumentationName, Version: cfg.InstrumentationVersion(), SchemaURL: cfg.SchemaURL(), } - m, ok := c.libraries.Load(library) + m, ok := c.scopes.Load(scope) if !ok { checkpointer := c.checkpointerFactory.NewCheckpointer() - m, _ = c.libraries.LoadOrStore( - library, + m, _ = c.scopes.LoadOrStore( + scope, registry.NewUniqueInstrumentMeterImpl(&accumulatorCheckpointer{ Accumulator: sdk.NewAccumulator(checkpointer), checkpointer: checkpointer, - library: library, + scope: scope, })) } return sdkapi.WrapMeterImpl(m.(*registry.UniqueInstrumentMeterImpl)) @@ -108,7 +108,7 @@ func (c *Controller) Meter(instrumentationName string, opts ...metric.MeterOptio type accumulatorCheckpointer struct { *sdk.Accumulator checkpointer export.Checkpointer - library instrumentation.Library + scope instrumentation.Scope } var _ sdkapi.MeterImpl = &accumulatorCheckpointer{} @@ -248,7 +248,7 @@ func (c *Controller) collect(ctx context.Context) error { // registered to this controller. This briefly locks the controller. func (c *Controller) accumulatorList() []*accumulatorCheckpointer { var r []*accumulatorCheckpointer - c.libraries.Range(func(key, value interface{}) bool { + c.scopes.Range(func(key, value interface{}) bool { acc, ok := value.(*registry.UniqueInstrumentMeterImpl).MeterImpl().(*accumulatorCheckpointer) if ok { r = append(r, acc) @@ -272,7 +272,7 @@ func (c *Controller) checkpoint(ctx context.Context) error { } // checkpointSingleAccumulator checkpoints a single instrumentation -// library's accumulator, which involves calling +// scope's accumulator, which involves calling // checkpointer.StartCollection, accumulator.Collect, and // checkpointer.FinishCollection in sequence. func (c *Controller) checkpointSingleAccumulator(ctx context.Context, ac *accumulatorCheckpointer) error { @@ -330,7 +330,7 @@ func (c *Controller) ForEach(readerFunc func(l instrumentation.Library, r export if err := func() error { reader.RLock() defer reader.RUnlock() - return readerFunc(acPair.library, reader) + return readerFunc(acPair.scope, reader) }(); err != nil { return err } diff --git a/sdk/metric/controller/basic/controller_test.go b/sdk/metric/controller/basic/controller_test.go index 26dcf4bb286..74904d68c49 100644 --- a/sdk/metric/controller/basic/controller_test.go +++ b/sdk/metric/controller/basic/controller_test.go @@ -43,7 +43,7 @@ func getMap(t *testing.T, cont *controller.Controller) map[string]float64 { out := processortest.NewOutput(attribute.DefaultEncoder()) require.NoError(t, cont.ForEach( - func(_ instrumentation.Library, reader export.Reader) error { + func(_ instrumentation.Scope, reader export.Reader) error { return reader.ForEach( aggregation.CumulativeTemporalitySelector(), func(record export.Record) error { diff --git a/sdk/metric/metrictest/exporter.go b/sdk/metric/metrictest/exporter.go index e767702019a..c0926dd7cf6 100644 --- a/sdk/metric/metrictest/exporter.go +++ b/sdk/metric/metrictest/exporter.go @@ -64,9 +64,12 @@ func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) { return c, exp } -// Library is the same as "sdk/instrumentation".Library but there is +// Deprecated: please use Scope instead. +type Library = Scope + +// Scope is the same as "sdk/instrumentation".Scope but there is // a package cycle to use it so it is redeclared here. -type Library struct { +type Scope struct { InstrumentationName string InstrumentationVersion string SchemaURL string diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 3f526c1d3cf..eac69f34d76 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -74,7 +74,7 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} { // instrumentation so it can trace operational flow through a system. type TracerProvider struct { mu sync.Mutex - namedTracer map[instrumentation.Library]*tracer + namedTracer map[instrumentation.Scope]*tracer spanProcessors atomic.Value // These fields are not protected by the lock mu. They are assumed to be @@ -110,7 +110,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { o = ensureValidTracerProviderConfig(o) tp := &TracerProvider{ - namedTracer: make(map[instrumentation.Library]*tracer), + namedTracer: make(map[instrumentation.Scope]*tracer), sampler: o.sampler, idGenerator: o.idGenerator, spanLimits: o.spanLimits, @@ -141,18 +141,18 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T if name == "" { name = defaultTracerName } - il := instrumentation.Library{ + is := instrumentation.Scope{ Name: name, Version: c.InstrumentationVersion(), SchemaURL: c.SchemaURL(), } - t, ok := p.namedTracer[il] + t, ok := p.namedTracer[is] if !ok { t = &tracer{ - provider: p, - instrumentationLibrary: il, + provider: p, + instrumentationScope: is, } - p.namedTracer[il] = t + p.namedTracer[is] = t global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) } return t diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 1f5d460d739..39caf5a91df 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -96,7 +96,7 @@ func TestSchemaURL(t *testing.T) { // Verify that the SchemaURL of the constructed Tracer is correctly populated. tracerStruct := tracerIface.(*tracer) - assert.EqualValues(t, schemaURL, tracerStruct.instrumentationLibrary.SchemaURL) + assert.EqualValues(t, schemaURL, tracerStruct.instrumentationScope.SchemaURL) } func TestTracerProviderSamplerConfigFromEnv(t *testing.T) { diff --git a/sdk/trace/snapshot.go b/sdk/trace/snapshot.go index 53aac61f5fe..0349b2f198e 100644 --- a/sdk/trace/snapshot.go +++ b/sdk/trace/snapshot.go @@ -26,22 +26,22 @@ import ( // snapshot is an record of a spans state at a particular checkpointed time. // It is used as a read-only representation of that state. type snapshot struct { - name string - spanContext trace.SpanContext - parent trace.SpanContext - spanKind trace.SpanKind - startTime time.Time - endTime time.Time - attributes []attribute.KeyValue - events []Event - links []Link - status Status - childSpanCount int - droppedAttributeCount int - droppedEventCount int - droppedLinkCount int - resource *resource.Resource - instrumentationLibrary instrumentation.Library + name string + spanContext trace.SpanContext + parent trace.SpanContext + spanKind trace.SpanKind + startTime time.Time + endTime time.Time + attributes []attribute.KeyValue + events []Event + links []Link + status Status + childSpanCount int + droppedAttributeCount int + droppedEventCount int + droppedLinkCount int + resource *resource.Resource + instrumentationScope instrumentation.Scope } var _ ReadOnlySpan = snapshot{} @@ -102,10 +102,16 @@ func (s snapshot) Status() Status { return s.status } +// InstrumentationScope returns information about the instrumentation +// scope that created the span. +func (s snapshot) InstrumentationScope() instrumentation.Scope { + return s.instrumentationScope +} + // InstrumentationLibrary returns information about the instrumentation // library that created the span. func (s snapshot) InstrumentationLibrary() instrumentation.Library { - return s.instrumentationLibrary + return s.instrumentationScope } // Resource returns information about the entity that produced the span. diff --git a/sdk/trace/span.go b/sdk/trace/span.go index edf456d93a7..d380c2719a7 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -63,8 +63,12 @@ type ReadOnlySpan interface { Events() []Event // Status returns the spans status. Status() Status + // InstrumentationScope returns information about the instrumentation + // scope that created the span. + InstrumentationScope() instrumentation.Scope // InstrumentationLibrary returns information about the instrumentation // library that created the span. + // Deprecated: please use InstrumentationScope instead. InstrumentationLibrary() instrumentation.Library // Resource returns information about the entity that produced the span. Resource() *resource.Resource @@ -584,12 +588,20 @@ func (s *recordingSpan) Status() Status { return s.status } +// InstrumentationScope returns the instrumentation.Scope associated with +// the Tracer that created this span. +func (s *recordingSpan) InstrumentationScope() instrumentation.Scope { + s.mu.Lock() + defer s.mu.Unlock() + return s.tracer.instrumentationScope +} + // InstrumentationLibrary returns the instrumentation.Library associated with // the Tracer that created this span. func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { s.mu.Lock() defer s.mu.Unlock() - return s.tracer.instrumentationLibrary + return s.tracer.instrumentationScope } // Resource returns the Resource associated with the Tracer that created this @@ -668,7 +680,7 @@ func (s *recordingSpan) snapshot() ReadOnlySpan { defer s.mu.Unlock() sd.endTime = s.endTime - sd.instrumentationLibrary = s.tracer.instrumentationLibrary + sd.instrumentationScope = s.tracer.instrumentationScope sd.name = s.name sd.parent = s.parent sd.resource = s.tracer.provider.resource diff --git a/sdk/trace/span_processor_filter_example_test.go b/sdk/trace/span_processor_filter_example_test.go index 6409bb57aaf..f5dd84e472a 100644 --- a/sdk/trace/span_processor_filter_example_test.go +++ b/sdk/trace/span_processor_filter_example_test.go @@ -67,7 +67,7 @@ func (f InstrumentationBlacklist) ForceFlush(ctx context.Context) error { return f.Next.ForceFlush(ctx) } func (f InstrumentationBlacklist) OnEnd(s ReadOnlySpan) { - if f.Blacklist != nil && f.Blacklist[s.InstrumentationLibrary().Name] { + if f.Blacklist != nil && f.Blacklist[s.InstrumentationScope().Name] { // Drop spans from this instrumentation return } diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 7ea04a86f05..58b2c04c6e8 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -411,8 +411,8 @@ func TestSetSpanAttributesOnStart(t *testing.T) { attribute.String("key1", "value1"), attribute.String("key2", "value2"), }, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "StartSpanAttribute"}, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "StartSpanAttribute"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SetSpanAttributesOnStart: -got +want %s", diff) @@ -666,8 +666,8 @@ func TestEvents(t *testing.T) { {Name: "foo", Attributes: []attribute.KeyValue{k1v1}}, {Name: "bar", Attributes: []attribute.KeyValue{k2v2, k3v3}}, }, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "Events"}, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "Events"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("Message Events: -got +want %s", diff) @@ -717,9 +717,9 @@ func TestEventsOverLimit(t *testing.T) { {Name: "foo", Attributes: []attribute.KeyValue{k1v1}}, {Name: "bar", Attributes: []attribute.KeyValue{k2v2, k3v3}}, }, - droppedEventCount: 2, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "EventsOverLimit"}, + droppedEventCount: 2, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "EventsOverLimit"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("Message Event over limit: -got +want %s", diff) @@ -753,11 +753,11 @@ func TestLinks(t *testing.T) { TraceID: tid, TraceFlags: 0x1, }), - parent: sc.WithRemote(true), - name: "span0", - links: []Link{{l1.SpanContext, l1.Attributes, 0}, {l2.SpanContext, l2.Attributes, 0}}, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "Links"}, + parent: sc.WithRemote(true), + name: "span0", + links: []Link{{l1.SpanContext, l1.Attributes, 0}, {l2.SpanContext, l2.Attributes, 0}}, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "Links"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("Link: -got +want %s", diff) @@ -811,9 +811,9 @@ func TestLinksOverLimit(t *testing.T) { {SpanContext: sc2, Attributes: []attribute.KeyValue{k2v2}, DroppedAttributeCount: 0}, {SpanContext: sc3, Attributes: []attribute.KeyValue{k3v3}, DroppedAttributeCount: 0}, }, - droppedLinkCount: 1, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "LinksOverLimit"}, + droppedLinkCount: 1, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "LinksOverLimit"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("Link over limit: -got +want %s", diff) @@ -861,7 +861,7 @@ func TestSetSpanStatus(t *testing.T) { Code: codes.Error, Description: "Error", }, - instrumentationLibrary: instrumentation.Library{Name: "SpanStatus"}, + instrumentationScope: instrumentation.Scope{Name: "SpanStatus"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SetSpanStatus: -got +want %s", diff) @@ -891,7 +891,7 @@ func TestSetSpanStatusWithoutMessageWhenStatusIsNotError(t *testing.T) { Code: codes.Ok, Description: "", }, - instrumentationLibrary: instrumentation.Library{Name: "SpanStatus"}, + instrumentationScope: instrumentation.Scope{Name: "SpanStatus"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SetSpanStatus: -got +want %s", diff) @@ -1230,7 +1230,7 @@ func TestRecordError(t *testing.T) { }, }, }, - instrumentationLibrary: instrumentation.Library{Name: "RecordError"}, + instrumentationScope: instrumentation.Scope{Name: "RecordError"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SpanErrorOptions: -got +want %s", diff) @@ -1274,7 +1274,7 @@ func TestRecordErrorWithStackTrace(t *testing.T) { }, }, }, - instrumentationLibrary: instrumentation.Library{Name: "RecordError"}, + instrumentationScope: instrumentation.Scope{Name: "RecordError"}, } assert.Equal(t, got.spanContext, want.spanContext) @@ -1314,7 +1314,7 @@ func TestRecordErrorNil(t *testing.T) { Code: codes.Unset, Description: "", }, - instrumentationLibrary: instrumentation.Library{Name: "RecordErrorNil"}, + instrumentationScope: instrumentation.Scope{Name: "RecordErrorNil"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SpanErrorOptions: -got +want %s", diff) @@ -1428,9 +1428,9 @@ func TestWithResource(t *testing.T) { attributes: []attribute.KeyValue{ attribute.String("key1", "value1"), }, - spanKind: trace.SpanKindInternal, - resource: tc.want, - instrumentationLibrary: instrumentation.Library{Name: "WithResource"}, + spanKind: trace.SpanKindInternal, + resource: tc.want, + instrumentationScope: instrumentation.Scope{Name: "WithResource"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("WithResource:\n -got +want %s", diff) @@ -1463,7 +1463,7 @@ func TestWithInstrumentationVersionAndSchema(t *testing.T) { parent: sc.WithRemote(true), name: "span0", spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{ + instrumentationScope: instrumentation.Scope{ Name: "WithInstrumentationVersion", Version: "v0.1.0", SchemaURL: "https://opentelemetry.io/schemas/1.2.0", @@ -1572,6 +1572,8 @@ func TestReadOnlySpan(t *testing.T) { assert.Equal(t, "", ro.Status().Description) assert.Equal(t, "ReadOnlySpan", ro.InstrumentationLibrary().Name) assert.Equal(t, "3", ro.InstrumentationLibrary().Version) + assert.Equal(t, "ReadOnlySpan", ro.InstrumentationScope().Name) + assert.Equal(t, "3", ro.InstrumentationScope().Version) assert.Equal(t, kv.Key, ro.Resource().Attributes()[0].Key) assert.Equal(t, kv.Value, ro.Resource().Attributes()[0].Value) @@ -1695,8 +1697,8 @@ func TestAddEventsWithMoreAttributesThanLimit(t *testing.T) { DroppedAttributeCount: 2, }, }, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "AddSpanEventWithOverLimitedAttributes"}, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "AddSpanEventWithOverLimitedAttributes"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("SetSpanAttributesOverLimit: -got +want %s", diff) @@ -1750,8 +1752,8 @@ func TestAddLinksWithMoreAttributesThanLimit(t *testing.T) { DroppedAttributeCount: 2, }, }, - spanKind: trace.SpanKindInternal, - instrumentationLibrary: instrumentation.Library{Name: "Links"}, + spanKind: trace.SpanKindInternal, + instrumentationScope: instrumentation.Scope{Name: "Links"}, } if diff := cmpDiff(got, want); diff != "" { t.Errorf("Link: -got +want %s", diff) diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index 5b8ab43be3d..f4a1f96f3d6 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -23,8 +23,8 @@ import ( ) type tracer struct { - provider *TracerProvider - instrumentationLibrary instrumentation.Library + provider *TracerProvider + instrumentationScope instrumentation.Scope } var _ trace.Tracer = &tracer{} diff --git a/sdk/trace/tracetest/span.go b/sdk/trace/tracetest/span.go index b5f47735c1f..bfe73de9c41 100644 --- a/sdk/trace/tracetest/span.go +++ b/sdk/trace/tracetest/span.go @@ -96,29 +96,29 @@ func SpanStubFromReadOnlySpan(ro tracesdk.ReadOnlySpan) SpanStub { DroppedLinks: ro.DroppedLinks(), ChildSpanCount: ro.ChildSpanCount(), Resource: ro.Resource(), - InstrumentationLibrary: ro.InstrumentationLibrary(), + InstrumentationLibrary: ro.InstrumentationScope(), } } // Snapshot returns a read-only copy of the SpanStub. func (s SpanStub) Snapshot() tracesdk.ReadOnlySpan { return spanSnapshot{ - name: s.Name, - spanContext: s.SpanContext, - parent: s.Parent, - spanKind: s.SpanKind, - startTime: s.StartTime, - endTime: s.EndTime, - attributes: s.Attributes, - events: s.Events, - links: s.Links, - status: s.Status, - droppedAttributes: s.DroppedAttributes, - droppedEvents: s.DroppedEvents, - droppedLinks: s.DroppedLinks, - childSpanCount: s.ChildSpanCount, - resource: s.Resource, - instrumentationLibrary: s.InstrumentationLibrary, + name: s.Name, + spanContext: s.SpanContext, + parent: s.Parent, + spanKind: s.SpanKind, + startTime: s.StartTime, + endTime: s.EndTime, + attributes: s.Attributes, + events: s.Events, + links: s.Links, + status: s.Status, + droppedAttributes: s.DroppedAttributes, + droppedEvents: s.DroppedEvents, + droppedLinks: s.DroppedLinks, + childSpanCount: s.ChildSpanCount, + resource: s.Resource, + instrumentationScope: s.InstrumentationLibrary, } } @@ -126,22 +126,22 @@ type spanSnapshot struct { // Embed the interface to implement the private method. tracesdk.ReadOnlySpan - name string - spanContext trace.SpanContext - parent trace.SpanContext - spanKind trace.SpanKind - startTime time.Time - endTime time.Time - attributes []attribute.KeyValue - events []tracesdk.Event - links []tracesdk.Link - status tracesdk.Status - droppedAttributes int - droppedEvents int - droppedLinks int - childSpanCount int - resource *resource.Resource - instrumentationLibrary instrumentation.Library + name string + spanContext trace.SpanContext + parent trace.SpanContext + spanKind trace.SpanKind + startTime time.Time + endTime time.Time + attributes []attribute.KeyValue + events []tracesdk.Event + links []tracesdk.Link + status tracesdk.Status + droppedAttributes int + droppedEvents int + droppedLinks int + childSpanCount int + resource *resource.Resource + instrumentationScope instrumentation.Scope } func (s spanSnapshot) Name() string { return s.name } @@ -159,6 +159,9 @@ func (s spanSnapshot) DroppedLinks() int { return s.droppedLinks func (s spanSnapshot) DroppedEvents() int { return s.droppedEvents } func (s spanSnapshot) ChildSpanCount() int { return s.childSpanCount } func (s spanSnapshot) Resource() *resource.Resource { return s.resource } +func (s spanSnapshot) InstrumentationScope() instrumentation.Scope { + return s.instrumentationScope +} func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library { - return s.instrumentationLibrary + return s.instrumentationScope } From 8b89e49f711b088232129cced09977ca1de6bd3c Mon Sep 17 00:00:00 2001 From: ttoad Date: Thu, 7 Jul 2022 06:24:02 +0800 Subject: [PATCH 197/886] Feat/bridge support text map (#2911) * feat: support TextMap * doc: add comment * test: support for ot.TextMap * Retrieve lost code due to merge * fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders * go mod tidy * Optimized code style, add changelog * doc: Restore comments * wip: add test cases * test: fix args error * delete empty line * Fix syntax and changelog errors * Fix formatting errors Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 5 + bridge/opentracing/bridge.go | 167 ++++++++++++-- bridge/opentracing/bridge_test.go | 362 ++++++++++++++++++++++++++++++ bridge/opentracing/go.mod | 4 + bridge/opentracing/go.sum | 7 +- 5 files changed, 529 insertions(+), 16 deletions(-) create mode 100644 bridge/opentracing/bridge_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 713eed7fd90..d94994675e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods +of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) + ### Changed - The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 947321debc0..2927e86535a 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -634,7 +634,7 @@ func (s fakeSpan) SpanContext() trace.SpanContext { // Inject is a part of the implementation of the OpenTracing Tracer // interface. // -// Currently only the HTTPHeaders format is supported. +// Currently only the HTTPHeaders and TextMap formats are supported. func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier interface{}) error { bridgeSC, ok := sm.(*bridgeSpanContext) if !ok { @@ -643,38 +643,75 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int if !bridgeSC.otelSpanContext.IsValid() { return ot.ErrInvalidSpanContext } - if builtinFormat, ok := format.(ot.BuiltinFormat); !ok || builtinFormat != ot.HTTPHeaders { + + builtinFormat, ok := format.(ot.BuiltinFormat) + if !ok { return ot.ErrUnsupportedFormat } - hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) - if !ok { - return ot.ErrInvalidCarrier + + var textCarrier propagation.TextMapCarrier + + switch builtinFormat { + case ot.HTTPHeaders: + hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) + if !ok { + return ot.ErrInvalidCarrier + } + + textCarrier = propagation.HeaderCarrier(hhcarrier) + case ot.TextMap: + if textCarrier, ok = carrier.(propagation.TextMapCarrier); !ok { + var err error + if textCarrier, err = newTextMapWrapperForInject(carrier); err != nil { + return err + } + } + default: + return ot.ErrUnsupportedFormat } - header := http.Header(hhcarrier) + fs := fakeSpan{ Span: noopSpan, sc: bridgeSC.otelSpanContext, } ctx := trace.ContextWithSpan(context.Background(), fs) ctx = baggage.ContextWithBaggage(ctx, bridgeSC.bag) - t.getPropagator().Inject(ctx, propagation.HeaderCarrier(header)) + t.getPropagator().Inject(ctx, textCarrier) return nil } // Extract is a part of the implementation of the OpenTracing Tracer // interface. // -// Currently only the HTTPHeaders format is supported. +// Currently only the HTTPHeaders and TextMap formats are supported. func (t *BridgeTracer) Extract(format interface{}, carrier interface{}) (ot.SpanContext, error) { - if builtinFormat, ok := format.(ot.BuiltinFormat); !ok || builtinFormat != ot.HTTPHeaders { + builtinFormat, ok := format.(ot.BuiltinFormat) + if !ok { return nil, ot.ErrUnsupportedFormat } - hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) - if !ok { - return nil, ot.ErrInvalidCarrier + + var textCarrier propagation.TextMapCarrier + + switch builtinFormat { + case ot.HTTPHeaders: + hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) + if !ok { + return nil, ot.ErrInvalidCarrier + } + + textCarrier = propagation.HeaderCarrier(hhcarrier) + case ot.TextMap: + if textCarrier, ok = carrier.(propagation.TextMapCarrier); !ok { + var err error + if textCarrier, err = newTextMapWrapperForExtract(carrier); err != nil { + return nil, err + } + } + default: + return nil, ot.ErrUnsupportedFormat } - header := http.Header(hhcarrier) - ctx := t.getPropagator().Extract(context.Background(), propagation.HeaderCarrier(header)) + + ctx := t.getPropagator().Extract(context.Background(), textCarrier) bag := baggage.FromContext(ctx) bridgeSC := &bridgeSpanContext{ bag: bag, @@ -692,3 +729,105 @@ func (t *BridgeTracer) getPropagator() propagation.TextMapPropagator { } return otel.GetTextMapPropagator() } + +// textMapWrapper Provides operating.TextMapWriter and operating.TextMapReader to +// propagation.TextMapCarrier compatibility. +// Usually, Inject method will only use the write-related interface. +// Extract method will only use the reade-related interface. +// To avoid panic, +// when the carrier implements only one of the interfaces, +// it provides a default implementation of the other interface (textMapWriter and textMapReader). +type textMapWrapper struct { + ot.TextMapWriter + ot.TextMapReader + readerMap map[string]string +} + +func (t *textMapWrapper) Get(key string) string { + if t.readerMap == nil { + t.loadMap() + } + + return t.readerMap[key] +} + +func (t *textMapWrapper) Set(key string, value string) { + t.TextMapWriter.Set(key, value) +} + +func (t *textMapWrapper) Keys() []string { + if t.readerMap == nil { + t.loadMap() + } + + str := make([]string, 0, len(t.readerMap)) + for key := range t.readerMap { + str = append(str, key) + } + + return str +} + +func (t *textMapWrapper) loadMap() { + t.readerMap = make(map[string]string) + + _ = t.ForeachKey(func(key, val string) error { + t.readerMap[key] = val + + return nil + }) +} + +func newTextMapWrapperForExtract(carrier interface{}) (*textMapWrapper, error) { + t := &textMapWrapper{} + + reader, ok := carrier.(ot.TextMapReader) + if !ok { + return nil, ot.ErrInvalidCarrier + } + + t.TextMapReader = reader + + writer, ok := carrier.(ot.TextMapWriter) + if ok { + t.TextMapWriter = writer + } else { + t.TextMapWriter = &textMapWriter{} + } + + return t, nil +} + +func newTextMapWrapperForInject(carrier interface{}) (*textMapWrapper, error) { + t := &textMapWrapper{} + + writer, ok := carrier.(ot.TextMapWriter) + if !ok { + return nil, ot.ErrInvalidCarrier + } + + t.TextMapWriter = writer + + reader, ok := carrier.(ot.TextMapReader) + if ok { + t.TextMapReader = reader + } else { + t.TextMapReader = &textMapReader{} + } + + return t, nil +} + +type textMapWriter struct { +} + +func (t *textMapWriter) Set(key string, value string) { + // maybe print a warning log. +} + +type textMapReader struct { +} + +func (t *textMapReader) ForeachKey(handler func(key, val string) error) error { + return nil // maybe print a warning log. +} diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go new file mode 100644 index 00000000000..eea3091f265 --- /dev/null +++ b/bridge/opentracing/bridge_test.go @@ -0,0 +1,362 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opentracing + +import ( + "context" + "errors" + "net/http" + "strings" + "testing" + + ot "github.com/opentracing/opentracing-go" + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/trace" +) + +type testOnlyTextMapReader struct { +} + +func newTestOnlyTextMapReader() *testOnlyTextMapReader { + return &testOnlyTextMapReader{} +} + +func (t *testOnlyTextMapReader) ForeachKey(handler func(key string, val string) error) error { + _ = handler("key1", "val1") + _ = handler("key2", "val2") + + return nil +} + +type testOnlyTextMapWriter struct { + m map[string]string +} + +func newTestOnlyTextMapWriter() *testOnlyTextMapWriter { + return &testOnlyTextMapWriter{m: map[string]string{}} +} + +func (t *testOnlyTextMapWriter) Set(key, val string) { + t.m[key] = val +} + +type testTextMapReaderAndWriter struct { + *testOnlyTextMapReader + *testOnlyTextMapWriter +} + +func newTestTextMapReaderAndWriter() *testTextMapReaderAndWriter { + return &testTextMapReaderAndWriter{ + testOnlyTextMapReader: newTestOnlyTextMapReader(), + testOnlyTextMapWriter: newTestOnlyTextMapWriter(), + } +} + +func TestTextMapWrapper_New(t *testing.T) { + _, err := newTextMapWrapperForExtract(newTestOnlyTextMapReader()) + assert.NoError(t, err) + + _, err = newTextMapWrapperForExtract(newTestOnlyTextMapWriter()) + assert.True(t, errors.Is(err, ot.ErrInvalidCarrier)) + + _, err = newTextMapWrapperForExtract(newTestTextMapReaderAndWriter()) + assert.NoError(t, err) + + _, err = newTextMapWrapperForInject(newTestOnlyTextMapWriter()) + assert.NoError(t, err) + + _, err = newTextMapWrapperForInject(newTestOnlyTextMapReader()) + assert.True(t, errors.Is(err, ot.ErrInvalidCarrier)) + + _, err = newTextMapWrapperForInject(newTestTextMapReaderAndWriter()) + assert.NoError(t, err) +} + +func TestTextMapWrapper_action(t *testing.T) { + testExtractFunc := func(carrier propagation.TextMapCarrier) { + str := carrier.Keys() + assert.Len(t, str, 2) + assert.Contains(t, str, "key1", "key2") + + assert.Equal(t, carrier.Get("key1"), "val1") + assert.Equal(t, carrier.Get("key2"), "val2") + } + + testInjectFunc := func(carrier propagation.TextMapCarrier) { + carrier.Set("key1", "val1") + carrier.Set("key2", "val2") + + wrap, ok := carrier.(*textMapWrapper) + assert.True(t, ok) + + writer, ok := wrap.TextMapWriter.(*testOnlyTextMapWriter) + if ok { + assert.Contains(t, writer.m, "key1", "key2", "val1", "val2") + return + } + + writer2, ok := wrap.TextMapWriter.(*testTextMapReaderAndWriter) + assert.True(t, ok) + assert.Contains(t, writer2.m, "key1", "key2", "val1", "val2") + } + + onlyWriter, err := newTextMapWrapperForExtract(newTestOnlyTextMapReader()) + assert.NoError(t, err) + testExtractFunc(onlyWriter) + + onlyReader, err := newTextMapWrapperForInject(&testOnlyTextMapWriter{m: map[string]string{}}) + assert.NoError(t, err) + testInjectFunc(onlyReader) + + both, err := newTextMapWrapperForExtract(newTestTextMapReaderAndWriter()) + assert.NoError(t, err) + testExtractFunc(both) + + both, err = newTextMapWrapperForInject(newTestTextMapReaderAndWriter()) + assert.NoError(t, err) + testInjectFunc(both) +} + +var ( + testHeader = "test-trace-id" + traceID trace.TraceID = [16]byte{byte(10)} + spanID trace.SpanID = [8]byte{byte(11)} +) + +type testTextMapPropagator struct { +} + +func (t testTextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + carrier.Set(testHeader, strings.Join([]string{traceID.String(), spanID.String()}, ":")) + + // Test for panic + _ = carrier.Get("test") + _ = carrier.Keys() +} + +func (t testTextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + traces := carrier.Get(testHeader) + + str := strings.Split(traces, ":") + if len(str) != 2 { + return ctx + } + + var exist = false + + for _, key := range carrier.Keys() { + if strings.EqualFold(testHeader, key) { + exist = true + + break + } + } + + if !exist { + return ctx + } + + var ( + traceID, _ = trace.TraceIDFromHex(str[0]) + spanID, _ = trace.SpanIDFromHex(str[1]) + sc = trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: traceID, + SpanID: spanID, + }) + ) + + // Test for panic + carrier.Set("key", "val") + + return trace.ContextWithRemoteSpanContext(ctx, sc) +} + +func (t testTextMapPropagator) Fields() []string { + return []string{"test"} +} + +// textMapCarrier Implemented propagation.TextMapCarrier interface. +type textMapCarrier struct { + m map[string]string +} + +func newTextCarrier() *textMapCarrier { + return &textMapCarrier{m: map[string]string{}} +} + +func (t *textMapCarrier) Get(key string) string { + return t.m[key] +} + +func (t *textMapCarrier) Set(key string, value string) { + t.m[key] = value +} + +func (t *textMapCarrier) Keys() []string { + str := make([]string, 0, len(t.m)) + + for key := range t.m { + str = append(str, key) + } + + return str +} + +// testTextMapReader only implemented opentracing.TextMapReader interface. +type testTextMapReader struct { + m *map[string]string +} + +func newTestTextMapReader(m *map[string]string) *testTextMapReader { + return &testTextMapReader{m: m} +} + +func (t *testTextMapReader) ForeachKey(handler func(key string, val string) error) error { + for key, val := range *t.m { + if err := handler(key, val); err != nil { + return err + } + } + + return nil +} + +// testTextMapWriter only implemented opentracing.TextMapWriter interface. +type testTextMapWriter struct { + m *map[string]string +} + +func newTestTextMapWriter(m *map[string]string) *testTextMapWriter { + return &testTextMapWriter{m: m} +} + +func (t *testTextMapWriter) Set(key, val string) { + (*t.m)[key] = val +} + +func TestBridgeTracer_ExtractAndInject(t *testing.T) { + bridge := NewBridgeTracer() + bridge.SetTextMapPropagator(new(testTextMapPropagator)) + + tmc := newTextCarrier() + shareMap := map[string]string{} + otTextMap := ot.TextMapCarrier{} + httpHeader := ot.HTTPHeadersCarrier(http.Header{}) + + testCases := []struct { + name string + injectCarrierType ot.BuiltinFormat + extractCarrierType ot.BuiltinFormat + extractCarrier interface{} + injectCarrier interface{} + extractErr error + injectErr error + }{ + { + name: "support for propagation.TextMapCarrier", + injectCarrierType: ot.TextMap, + injectCarrier: tmc, + extractCarrierType: ot.TextMap, + extractCarrier: tmc, + }, + { + name: "support for opentracing.TextMapReader and opentracing.TextMapWriter", + injectCarrierType: ot.TextMap, + injectCarrier: otTextMap, + extractCarrierType: ot.TextMap, + extractCarrier: otTextMap, + }, + { + name: "support for HTTPHeaders", + injectCarrierType: ot.HTTPHeaders, + injectCarrier: httpHeader, + extractCarrierType: ot.HTTPHeaders, + extractCarrier: httpHeader, + }, + { + name: "support for opentracing.TextMapReader and opentracing.TextMapWriter,non-same instance", + injectCarrierType: ot.TextMap, + injectCarrier: newTestTextMapWriter(&shareMap), + extractCarrierType: ot.TextMap, + extractCarrier: newTestTextMapReader(&shareMap), + }, + { + name: "inject: format type is HTTPHeaders, but carrier is not HTTPHeadersCarrier", + injectCarrierType: ot.HTTPHeaders, + injectCarrier: struct{}{}, + injectErr: ot.ErrInvalidCarrier, + }, + { + name: "extract: format type is HTTPHeaders, but carrier is not HTTPHeadersCarrier", + injectCarrierType: ot.HTTPHeaders, + injectCarrier: httpHeader, + extractCarrierType: ot.HTTPHeaders, + extractCarrier: struct{}{}, + extractErr: ot.ErrInvalidCarrier, + }, + { + name: "inject: format type is TextMap, but carrier is cannot be wrapped into propagation.TextMapCarrier", + injectCarrierType: ot.TextMap, + injectCarrier: struct{}{}, + injectErr: ot.ErrInvalidCarrier, + }, + { + name: "extract: format type is TextMap, but carrier is cannot be wrapped into propagation.TextMapCarrier", + injectCarrierType: ot.TextMap, + injectCarrier: otTextMap, + extractCarrierType: ot.TextMap, + extractCarrier: struct{}{}, + extractErr: ot.ErrInvalidCarrier, + }, + { + name: "inject: unsupported format type", + injectCarrierType: ot.Binary, + injectErr: ot.ErrUnsupportedFormat, + }, + { + name: "extract: unsupported format type", + injectCarrierType: ot.TextMap, + injectCarrier: otTextMap, + extractCarrierType: ot.Binary, + extractCarrier: struct{}{}, + extractErr: ot.ErrUnsupportedFormat, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + err := bridge.Inject(newBridgeSpanContext(trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: [16]byte{byte(1)}, + SpanID: [8]byte{byte(2)}, + }), nil), tc.injectCarrierType, tc.injectCarrier) + assert.Equal(t, tc.injectErr, err) + + if tc.injectErr == nil { + spanContext, err := bridge.Extract(tc.extractCarrierType, tc.extractCarrier) + assert.Equal(t, tc.extractErr, err) + + if tc.extractErr == nil { + bsc, ok := spanContext.(*bridgeSpanContext) + assert.True(t, ok) + + assert.Equal(t, spanID.String(), bsc.otelSpanContext.SpanID().String()) + assert.Equal(t, traceID.String(), bsc.otelSpanContext.TraceID().String()) + } + } + }) + } +} diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index ef802c32103..765d1bad47f 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,13 +6,17 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 + github.com/stretchr/testify v1.7.2 go.opentelemetry.io/otel v1.7.0 go.opentelemetry.io/otel/trace v1.7.0 ) require ( + github.com/davecgh/go-spew v1.1.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 5ec9e745497..4814eca5ba9 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -13,8 +13,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From ac0221e3a39e4734a1db81b20552da8040595550 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 6 Jul 2022 18:00:21 -0500 Subject: [PATCH 198/886] Add a release template (#2863) * Add a release template * Update the about field Co-authored-by: Damien Mathieu <42@dmathieu.com> * Fix linting Issues * Add ignore for template link Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- .github/ISSUE_TEMPLATE/version_release.md | 22 ++++++++++++++++++++++ .lycheeignore | 1 + 2 files changed, 23 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/version_release.md diff --git a/.github/ISSUE_TEMPLATE/version_release.md b/.github/ISSUE_TEMPLATE/version_release.md new file mode 100644 index 00000000000..f0a7c0a975a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/version_release.md @@ -0,0 +1,22 @@ +--- +name: Version Release +about: Checklist to follow when shipping a new release. +title: 'Release Checklist' +labels: '' +assignees: '' + +--- + + + +- [ ] Complete [Milestone](https://github.com/open-telemetry/opentelemetry-go/milestone/) + +- [ ] Update contrib codebase to support changes about to be released (use a git sha version) +- [ ] [Pre-release](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#pre-release) +- [ ] [Tag](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#tag) +- [ ] [Release](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#release) +- [ ] [Check examples](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#verify-examples) +- [ ] [Sync with Contrib](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md#upgrade-goopentelemetryiootel-packages) +- [ ] [Release contrib](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md#release-process) +- [ ] [Sync website docs](https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md#website-documentation) +- [ ] Close the milestone diff --git a/.lycheeignore b/.lycheeignore index d300b3f801f..545d634525d 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -1,2 +1,3 @@ http://localhost http://jaeger-collector +https://github.com/open-telemetry/opentelemetry-go/milestone/ From eb9e0583f748c09454499f3e212c4bb895370729 Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Thu, 7 Jul 2022 13:38:43 -0400 Subject: [PATCH 199/886] Add workflow to automate bundling dependabot PRs (#2997) Signed-off-by: Anthony J Mirabella --- .github/workflows/create-dependabot-pr.yml | 18 ++++++ .github/workflows/scripts/dependabot-pr.sh | 65 ++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/create-dependabot-pr.yml create mode 100755 .github/workflows/scripts/dependabot-pr.sh diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml new file mode 100644 index 00000000000..96b81163127 --- /dev/null +++ b/.github/workflows/create-dependabot-pr.yml @@ -0,0 +1,18 @@ +name: dependabot-pr + +on: + workflow_dispatch: + +jobs: + create-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install zsh + run: sudo apt-get update; sudo apt-get install zsh + + - name: Run dependabot-pr.sh + run: ./.github/workflows/scripts/dependabot-pr.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scripts/dependabot-pr.sh b/.github/workflows/scripts/dependabot-pr.sh new file mode 100755 index 00000000000..e85532eb2aa --- /dev/null +++ b/.github/workflows/scripts/dependabot-pr.sh @@ -0,0 +1,65 @@ +#!/bin/zsh -ex + +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +git config user.name $GITHUB_ACTOR +git config user.email $GITHUB_ACTOR@users.noreply.github.com + +PR_NAME=dependabot-prs/`date +'%Y-%m-%dT%H%M%S'` +git checkout -b $PR_NAME + +IFS=$'\n' +requests=($(gh pr list --search "author:app/dependabot" --json number,title --template '{{range .}}{{tablerow .title}}{{end}}')) +message="" +dirs=(`find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./'`) + +declare -A mods + +for line in $requests; do + echo $line + if [[ $line != Bump* ]]; then + continue + fi + + module=$(echo $line | cut -f 2 -d " ") + if [[ $module == go.opentelemetry.io/otel* ]]; then + continue + fi + version=$(echo $line | cut -f 6 -d " ") + + mods[$module]=$version + message+=$line + message+=$'\n' +done + +for module version in ${(kv)mods}; do + topdir=`pwd` + for dir in $dirs; do + echo "checking $dir" + cd $dir && if grep -q "$module " go.mod; then go get "$module"@v"$version"; fi + cd $topdir + done +done + +make go-mod-tidy +make build + +git add go.sum go.mod +git add "**/go.sum" "**/go.mod" +git commit -m "dependabot updates `date` +$message" +git push origin $PR_NAME + +gh pr create --title "dependabot updates `date`" --body "$message" -l "Skip Changelog" From 08ff959fc4eb8d4b7adf568fab7fa9bc050ceb0b Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Fri, 8 Jul 2022 14:23:16 -0400 Subject: [PATCH 200/886] Release prep 1.8.0 (#3001) * Update CHANGELOG and versions.yaml for 1.8.0 release Signed-off-by: Anthony J Mirabella * Update go-build-tools Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.8.0 * Prepare experimental-metrics for version v0.31.0 * Prepare bridge for version v0.31.0 * `make go-mod-tidy` should use `-compat=1.17` now Signed-off-by: Anthony J Mirabella * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 7 +- Makefile | 2 +- bridge/opencensus/go.mod | 10 +- bridge/opencensus/go.sum | 3 - bridge/opencensus/test/go.mod | 12 +- bridge/opencensus/test/go.sum | 13 - bridge/opentracing/go.mod | 4 +- bridge/opentracing/go.sum | 3 - example/fib/go.mod | 8 +- example/fib/go.sum | 7 - example/jaeger/go.mod | 8 +- example/jaeger/go.sum | 1 - example/namedtracer/go.mod | 8 +- example/namedtracer/go.sum | 7 - example/opencensus/go.mod | 16 +- example/opencensus/go.sum | 4 - example/otel-collector/go.mod | 12 +- example/otel-collector/go.sum | 9 - example/passthrough/go.mod | 8 +- example/passthrough/go.sum | 7 - example/prometheus/go.mod | 12 +- example/prometheus/go.sum | 5 - example/zipkin/go.mod | 8 +- example/zipkin/go.sum | 3 - exporters/jaeger/go.mod | 6 +- exporters/otlp/otlpmetric/go.mod | 12 +- exporters/otlp/otlpmetric/go.sum | 3 - .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 - .../otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 - exporters/otlp/otlptrace/go.mod | 8 +- exporters/otlp/otlptrace/go.sum | 2 - exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 3 - exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 3 - exporters/prometheus/go.mod | 10 +- exporters/prometheus/go.sum | 3 - exporters/stdout/stdoutmetric/go.mod | 10 +- exporters/stdout/stdoutmetric/go.sum | 2 - exporters/stdout/stdouttrace/go.mod | 6 +- exporters/stdout/stdouttrace/go.sum | 1 - exporters/zipkin/go.mod | 6 +- exporters/zipkin/go.sum | 1 - go.mod | 2 +- go.sum | 3 - internal/tools/go.mod | 43 ++-- internal/tools/go.sum | 234 +++++------------- metric/go.mod | 4 +- metric/go.sum | 1 - sdk/go.mod | 4 +- sdk/metric/go.mod | 8 +- sdk/metric/go.sum | 1 - trace/go.mod | 2 +- trace/go.sum | 6 - version.go | 2 +- versions.yaml | 6 +- 58 files changed, 208 insertions(+), 417 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d94994675e7..e92ae7c5b3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.8.0/0.31.0] - 2022-07-08 + ### Added - Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods @@ -17,6 +19,7 @@ of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911 - The `crosslink` make target has been updated to use the `go.opentelemetry.io/build-tools/crosslink` package. (#2886) - In the `go.opentelemetry.io/otel/sdk/instrumentation` package rename `Library` to `Scope` and alias `Library` as `Scope` (#2976) +- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) ### Removed @@ -53,7 +56,6 @@ of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911 The method included in the renamed interface also changed from `LabelFilterFor` to `AttributeFilterFor`. (#2790) - The `Metadata.Labels` method from the `go.opentelemetry.io/otel/sdk/metric/export` package is renamed to `Metadata.Attributes`. Consequentially, the `Record` type from the same package also has had the embedded method renamed. (#2790) -- Move metric no-op implementation form `nonrecording` to `metric` package. (#2866) ### Deprecated @@ -1874,7 +1876,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.7.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.8.0...HEAD +[1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 [1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 [0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 [1.6.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.6.3 diff --git a/Makefile b/Makefile index d847bd13d54..18ffaa33a99 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ go-mod-tidy/%: DIR=$* go-mod-tidy/%: | crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy + && $(GO) mod tidy -compat=1.17 .PHONY: lint-modules lint-modules: go-mod-tidy diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index f625ab578e8..d648368afc1 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 7c7b5a977f6..e42b184d238 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -18,13 +18,11 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -61,5 +59,4 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 937387f895c..04803b1b9a7 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.17 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/bridge/opencensus v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/bridge/opencensus v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.30.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.30.0 // indirect + go.opentelemetry.io/otel/metric v0.31.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 92cc1105e60..cc5af06ea90 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -1,7 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -17,12 +16,10 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= @@ -38,17 +35,13 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -62,17 +55,14 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -87,11 +77,9 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= @@ -106,7 +94,6 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 765d1bad47f..85d322980aa 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.7.2 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 4814eca5ba9..2938fe01d78 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -6,18 +6,15 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/fib/go.mod b/example/fib/go.mod index ab7f0b26dc6..6896036765c 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.17 require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/example/fib/go.sum b/example/fib/go.sum index 3bc5db07919..2af466654a5 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,19 +1,12 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 08730f4584e..9d5732b2301 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/jaeger v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/jaeger v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/stretchr/objx v0.4.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 233cfd29693..ac1d211214a 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -7,7 +7,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 86006a44c7c..d232b625866 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 3bc5db07919..2af466654a5 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,19 +1,12 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 6f9017d734c..e58255c7881 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/bridge/opencensus v0.30.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.30.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/bridge/opencensus v0.31.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect - go.opentelemetry.io/otel/metric v0.30.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/metric v0.31.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 7c7b5a977f6..98f74c56098 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -1,7 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -18,13 +17,11 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -61,5 +58,4 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 536a5f99ad1..d928ba0c644 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 google.golang.org/grpc v1.46.2 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 // indirect go.opentelemetry.io/proto/otlp v0.18.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 574b556389c..565bfac7844 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -113,7 +113,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -127,7 +126,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -151,11 +149,9 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -165,7 +161,6 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -201,7 +196,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -245,7 +239,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -275,7 +268,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -329,7 +321,6 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 309ab90fda2..102683ea744 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.17 require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 3bc5db07919..2af466654a5 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,19 +1,12 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index fca49abafcf..13fb4a4bfc7 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/prometheus v0.30.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/prometheus v0.31.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 ) require ( @@ -26,8 +26,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/sdk v1.7.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/sdk v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index d24eae03d37..5563b0bf878 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -39,7 +39,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -116,7 +115,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -195,7 +193,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -318,7 +315,6 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -464,7 +460,6 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index ee973ef4c18..399bfbe6e72 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/zipkin v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/zipkin v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 169935452f1..88b4d1e9ab0 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -59,7 +59,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= @@ -106,7 +105,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= @@ -158,7 +156,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index d3565af55c8..6278a44eda7 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 48415eb8521..5a4cd191604 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 0cd110965e4..3f5b0b6df58 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -36,7 +36,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -129,7 +128,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -274,7 +272,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 779e09f9cb8..3320deaabef 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,12 +4,12 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.30.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 @@ -24,7 +24,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 0cd110965e4..aa3f8bac4ee 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -36,7 +36,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -115,7 +114,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -129,7 +127,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -274,7 +271,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7a5d4a21af4..30be4dcd352 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) @@ -19,10 +19,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel v1.7.0 // indirect - go.opentelemetry.io/otel/metric v0.30.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.30.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel v1.8.0 // indirect + go.opentelemetry.io/otel/metric v0.31.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 0cd110965e4..aa3f8bac4ee 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -36,7 +36,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -115,7 +114,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -129,7 +127,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -274,7 +271,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f4cbc831a3d..6cb670b5b9c 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index a8fc336d443..ddb7c704e47 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -127,7 +127,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -272,7 +271,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index c675c4a66eb..e1e0ada8c5b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 go.opentelemetry.io/proto/otlp v0.18.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 15fe71455fe..f3253a0f5d2 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -113,7 +113,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -127,7 +126,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -278,7 +276,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0cbec3ba70c..0258e3f20db 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index a8fc336d443..1c39dbea853 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -113,7 +113,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -127,7 +126,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= @@ -272,7 +270,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index d82186d0514..3d293fcfc08 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/prometheus/client_golang v1.12.2 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 56f6444835b..b2cbcef3b03 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -39,7 +39,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -116,7 +115,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -320,7 +318,6 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 4e6340d4a82..90a3a152d7b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/sdk/metric v0.30.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 ) require ( @@ -20,7 +20,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 48e5a987067..bb01dfbad5b 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,5 +1,4 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -8,7 +7,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c88327cb2ae..c3ad693c22c 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index ac3360c6fee..2e2aed63d24 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -6,7 +6,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index fd070111af8..2e20f5dca74 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.8 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/sdk v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index c4da081fc22..5e5211c3d8c 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -160,7 +160,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/go.mod b/go.mod index fb8ce985ea6..a60334c9081 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel/trace v1.8.0 ) require ( diff --git a/go.sum b/go.sum index da1754cb88e..f6a0b224951 100644 --- a/go.sum +++ b/go.sum @@ -5,7 +5,6 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -13,8 +12,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 8cbe5097d3b..5e4fbae7614 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,10 +9,10 @@ require ( github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0 - go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a - go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 - go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 + go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c + go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c + go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c + go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 golang.org/x/tools v0.1.10 ) @@ -49,7 +49,7 @@ require ( github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fatih/structtag v1.2.0 // indirect - github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fzipp/gocyclo v0.4.0 // indirect github.com/go-critic/go-critic v0.6.2 // indirect github.com/go-git/gcfg v1.5.0 // indirect @@ -104,7 +104,7 @@ require ( github.com/ldez/tagliatelle v0.3.1 // indirect github.com/leonklingele/grouper v1.1.0 // indirect github.com/lufeee/execinquery v1.0.0 // indirect - github.com/magiconair/properties v1.8.5 // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/maratori/testpackage v1.0.1 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect github.com/mattn/go-colorable v0.1.12 // indirect @@ -114,7 +114,7 @@ require ( github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.1.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/mapstructure v1.4.3 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect @@ -122,7 +122,8 @@ require ( github.com/nishanths/predeclared v0.2.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.7.0 // indirect - github.com/pelletier/go-toml v1.9.4 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -145,16 +146,16 @@ require ( github.com/sivchari/tenv v1.4.7 // indirect github.com/sonatard/noctx v0.0.1 // indirect github.com/sourcegraph/go-diff v0.6.1 // indirect - github.com/spf13/afero v1.6.0 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/afero v1.8.2 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.4.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.10.1 // indirect + github.com/spf13/viper v1.12.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect - github.com/stretchr/objx v0.1.1 // indirect - github.com/stretchr/testify v1.7.1 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/stretchr/objx v0.4.0 // indirect + github.com/stretchr/testify v1.7.5 // indirect + github.com/subosito/gotenv v1.3.0 // indirect github.com/sylvia7788/contextcheck v1.0.4 // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect @@ -172,17 +173,17 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect + golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect + golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/protobuf v1.27.1 // indirect - gopkg.in/ini.v1 v1.66.2 // indirect + golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect + google.golang.org/protobuf v1.28.0 // indirect + gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.2.2 // indirect mvdan.cc/gofumpt v0.3.1 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 59ec1d3b032..000a2e2f248 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -6,6 +6,7 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -19,6 +20,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= @@ -27,10 +29,6 @@ cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSU cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -39,9 +37,7 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= -cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -53,6 +49,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/Antonboom/errname v0.1.5 h1:IM+A/gz0pDhKmlt5KSNTVAvfLMb+65RxavBXpRtCUEg= @@ -63,7 +60,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= @@ -88,8 +84,6 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= -github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= @@ -98,7 +92,6 @@ github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= @@ -117,7 +110,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= @@ -131,8 +123,6 @@ github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92 github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -144,20 +134,12 @@ github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3/ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= -github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -194,11 +176,8 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPOWUZ7hQAEvzN5Pf27BkQQ= github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= @@ -211,12 +190,12 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= github.com/fzipp/gocyclo v0.4.0 h1:IykTnjwh2YLyYkGa0y92iTTEQcnyAz0r9zOo15EbJ7k= github.com/fzipp/gocyclo v0.4.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= @@ -241,7 +220,6 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -282,7 +260,6 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -348,7 +325,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -366,6 +342,7 @@ github.com/google/pprof v0.0.0-20200507031123-427632fa3b1c/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -382,9 +359,8 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= @@ -408,7 +384,6 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= -github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= @@ -416,28 +391,18 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v1.0.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= @@ -446,28 +411,20 @@ github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4= github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -498,16 +455,12 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= -github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= @@ -522,8 +475,6 @@ github.com/kisielk/errcheck v1.6.0 h1:YTDO4pNy7AUN/021p+JGHycQyYNIyMoenM1YDVK6Rl github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -532,7 +483,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -558,11 +508,10 @@ github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/lufeee/execinquery v1.0.0 h1:1XUTuLIVPDlFvUU3LXmmZwHDsolsxXnY67lzhpeqe0I= github.com/lufeee/execinquery v1.0.0/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/lyft/protoc-gen-star v0.5.3/go.mod h1:V0xaHgaf5oCCqmcxYcWiDfTiKsZsRc87/1qhoTACD8w= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= @@ -601,32 +550,24 @@ github.com/mgechev/revive v1.1.4/go.mod h1:ZZq2bmyssGh8MSPz3VVziqRNIMYTJXzP8MUKG github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= @@ -676,11 +617,12 @@ github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI= github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= +github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= @@ -690,6 +632,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -697,10 +640,8 @@ github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b h1:/BDyEJWL github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -709,12 +650,10 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= @@ -726,7 +665,6 @@ github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSx github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.19/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= @@ -736,7 +674,6 @@ github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:r github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= @@ -749,8 +686,6 @@ github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8 github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= -github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= -github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -760,7 +695,6 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= -github.com/shirou/gopsutil/v3 v3.22.2/go.mod h1:WapW1AOOPlHyXr+yOyw3uYx36enocrtSoSBy0L5vUHY= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -774,8 +708,6 @@ github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYI github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/tenv v1.4.7 h1:FdTpgRlTue5eb5nXIYgS/lyVXSjugU8UUVDwhP1NLU8= github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= @@ -783,17 +715,15 @@ github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0H github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -804,16 +734,15 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= -github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= -github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk= -github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -822,10 +751,12 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q= +github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= @@ -838,8 +769,6 @@ github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= -github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -848,7 +777,6 @@ github.com/tomarrell/wrapcheck/v2 v2.6.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2Ogf github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= @@ -858,10 +786,6 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/uudashr/gocognit v1.0.5 h1:rrSex7oHr3/pPLQ0xoWq108XMU8s678FJcQ+aSfOHa4= github.com/uudashr/gocognit v1.0.5/go.mod h1:wgYz0mitoKOTysqxTDMOUXg+Jb5SvtihkfmugIZYpEA= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= -github.com/valyala/quicktemplate v1.7.0/go.mod h1:sqKJnoaOF88V07vkO+9FL8fb9uZg/VPSJnLYn+LmLk8= -github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= @@ -884,18 +808,14 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= gitlab.com/bosi/decorder v0.2.1 h1:ehqZe8hI4w7O4b1vgsDZw1YU1PE7iJXrQWFMsocbQ1w= gitlab.com/bosi/decorder v0.2.1/go.mod h1:6C/nhLSbF6qZbYD8bRmISBwc6vcWdNsiIBkRvjJFrH0= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/api/v3 v3.5.1/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= -go.etcd.io/etcd/client/v2 v2.305.1/go.mod h1:pMEacxZW7o8pg4CrFE7pquyCJJzZvkvdD2RibOCCCGs= go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -904,18 +824,16 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opentelemetry.io/build-tools v0.0.0-20210719163622-92017e64f35b/go.mod h1:zZRrJN8qdwDdPNkCEyww4SW54mM1Da0v9H3TyQet9T4= -go.opentelemetry.io/build-tools v0.0.0-20220304161722-feb5ff5848f1/go.mod h1:qO4vrNgLf0V5FHckLNwEw2CfBTaL8w6pKDm3bF6nhMk= go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a h1:yLxbGYl9MXOqD0o3unX/nJn+y+1loFNWZJWkfeguYV8= go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a/go.mod h1:gkLviEngQuoeD670EP1KA/Oj4i5oNAzb+pjkk+4ecaQ= -go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0 h1:yumJiwLmJ3xQXgvhywkGqkhbh9hbTsAWEuCGoRJi8bQ= -go.opentelemetry.io/build-tools/crosslink v0.0.0-20220502161954-e2bf744925c0/go.mod h1:0mci40GSYELJTxavWNtFzuy2Z76uzf4dbT+1P0E8MAo= -go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a h1:VCNW72z+YKDAH8O5y+WmMuj2Jlgd+ZG5Abk9xTGw6dQ= -go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220321164008-b8e03aff061a/go.mod h1:/X2uGFIoHCUyQiBqL6pY6AEU2j8q1e+EMWhZlCsY5dk= -go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375 h1:5zVDNFcOwiMee9Qm8sH08iw+9cJZk+l/Y3mVa2D/zmM= -go.opentelemetry.io/build-tools/multimod v0.0.0-20210920164323-2ceabab23375/go.mod h1:mPh1L/tfTGyVNnSQOTlTSi2CBpci13Ft8jE4Glik2es= -go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375 h1:EaeArFokiObXc/jkX0Ck3u2d6lWDmeWdEPy2IdlF6iw= -go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210920164323-2ceabab23375/go.mod h1:QJyAzHKDKGDl52AUIAZhWKx3nOPBZJ3dD44utso2FPE= +go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c h1:29qFnf/xOmEAGv7DwfLLnRejjIcksPdCw+Je0rIlj1Y= +go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c/go.mod h1:HI436k8NShByIY1P0z6IIrVByrJQ9//qnJTFocdY2nM= +go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c h1:LCMy1QnOiursbSFlKYCGkfnSZfRiZgqGfypltWuWn/0= +go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c/go.mod h1:IIF9IbxlzOnHM0E21vDeGSKHDYImShTJ4qTvKs4m+G4= +go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c h1:NaZFvE0Vn3yWNnZxQEl5Zu6Fbl6xGxFy5eqOPi865Q8= +go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c/go.mod h1:EOBbXCes6aVxWqvSy3v1AJD8vtC4++fW1UH5AB8W4uM= +go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c h1:sdRLGv2B9aIRQdLLKlQ6RT/N5MOgsDI+UeYQqNP1g5I= +go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c/go.mod h1:5ykZFab0x3jatwG5Rf2idlko5e5Z42XsyJLMg4h35bg= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -952,11 +870,12 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -993,7 +912,6 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= @@ -1002,7 +920,6 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1038,20 +955,19 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= +golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1063,13 +979,10 @@ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1135,13 +1048,12 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1149,6 +1061,7 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1158,27 +1071,19 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220111092808-5a964db01320/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1207,7 +1112,6 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1224,7 +1128,6 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1272,7 +1175,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1281,6 +1183,7 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= @@ -1298,8 +1201,9 @@ golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1322,19 +1226,12 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1384,7 +1281,9 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1401,17 +1300,6 @@ google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKr google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1441,9 +1329,6 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1457,8 +1342,9 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1471,10 +1357,9 @@ gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI= -gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -1491,8 +1376,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/metric/go.mod b/metric/go.mod index 2f376123d6e..0b21ebfead5 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel v1.8.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/metric/go.sum b/metric/go.sum index f6a0b224951..f62b5a35247 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -6,7 +6,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/sdk/go.mod b/sdk/go.mod index 78069e9d4f2..65222e34237 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/trace v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/trace v1.8.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index d431c9d348d..4d3894e23b9 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -13,9 +13,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 - go.opentelemetry.io/otel/metric v0.30.0 - go.opentelemetry.io/otel/sdk v1.7.0 + go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk v1.8.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.7.0 // indirect + go.opentelemetry.io/otel/trace v1.8.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 48e5a987067..4e67ced5ad4 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -8,7 +8,6 @@ github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/trace/go.mod b/trace/go.mod index d5fde13218b..5e70a8124e0 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.7.0 + go.opentelemetry.io/otel v1.8.0 ) require ( diff --git a/trace/go.sum b/trace/go.sum index 146a5ee561f..587f0fcef84 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,9 +1,5 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -11,8 +7,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/version.go b/version.go index da940c6323f..ddc0abb27f5 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.7.0" + return "1.8.0" } diff --git a/versions.yaml b/versions.yaml index b992d0fb06d..1469512be85 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.7.0 + version: v1.8.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.30.0 + version: v0.31.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -49,7 +49,7 @@ module-sets: modules: - go.opentelemetry.io/otel/schema bridge: - version: v0.30.0 + version: v0.31.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From f7395695b7debafaa052d61138b84c987071898f Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Wed, 13 Jul 2022 03:12:58 +0800 Subject: [PATCH 201/886] Add benchmark metric test for UpDownCounter (#2655) * add benchmark metric test for UpDownCounter * move counter annotation up * fix syncFloat64 to syncInt64 * fix syncFloat64 to syncInt64 * fix go-lint err --- sdk/metric/benchmark_test.go | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 5464b80a94c..ff05792b1b1 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -66,6 +66,7 @@ func (f *benchFixture) iCounter(name string) syncint64.Counter { } return ctr } + func (f *benchFixture) fCounter(name string) syncfloat64.Counter { ctr, err := f.meter.SyncFloat64().Counter(name) if err != nil { @@ -73,6 +74,23 @@ func (f *benchFixture) fCounter(name string) syncfloat64.Counter { } return ctr } + +func (f *benchFixture) iUpDownCounter(name string) syncint64.UpDownCounter { + ctr, err := f.meter.SyncInt64().UpDownCounter(name) + if err != nil { + f.B.Error(err) + } + return ctr +} + +func (f *benchFixture) fUpDownCounter(name string) syncfloat64.UpDownCounter { + ctr, err := f.meter.SyncFloat64().UpDownCounter(name) + if err != nil { + f.B.Error(err) + } + return ctr +} + func (f *benchFixture) iHistogram(name string) syncint64.Histogram { ctr, err := f.meter.SyncInt64().Histogram(name) if err != nil { @@ -80,6 +98,7 @@ func (f *benchFixture) iHistogram(name string) syncint64.Histogram { } return ctr } + func (f *benchFixture) fHistogram(name string) syncfloat64.Histogram { ctr, err := f.meter.SyncFloat64().Histogram(name) if err != nil { @@ -228,6 +247,34 @@ func BenchmarkFloat64CounterAdd(b *testing.B) { } } +// UpDownCounter + +func BenchmarkInt64UpDownCounterAdd(b *testing.B) { + ctx := context.Background() + fix := newFixture(b) + labs := makeAttrs(1) + cnt := fix.iUpDownCounter("int64.sum") + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + cnt.Add(ctx, 1, labs...) + } +} + +func BenchmarkFloat64UpDownCounterAdd(b *testing.B) { + ctx := context.Background() + fix := newFixture(b) + labs := makeAttrs(1) + cnt := fix.fUpDownCounter("float64.sum") + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + cnt.Add(ctx, 1.1, labs...) + } +} + // LastValue func BenchmarkInt64LastValueAdd(b *testing.B) { From aa27169ea8c1b740a05bddbfc850eb0c8c0f5338 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 13 Jul 2022 05:45:46 -0700 Subject: [PATCH 202/886] Add semconv/v1.11.0 (#3009) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 5 + semconv/v1.11.0/doc.go | 20 + semconv/v1.11.0/exception.go | 20 + semconv/v1.11.0/http.go | 114 +++ semconv/v1.11.0/resource.go | 981 +++++++++++++++++++ semconv/v1.11.0/schema.go | 20 + semconv/v1.11.0/trace.go | 1704 ++++++++++++++++++++++++++++++++++ 7 files changed, 2864 insertions(+) create mode 100644 semconv/v1.11.0/doc.go create mode 100644 semconv/v1.11.0/exception.go create mode 100644 semconv/v1.11.0/http.go create mode 100644 semconv/v1.11.0/resource.go create mode 100644 semconv/v1.11.0/schema.go create mode 100644 semconv/v1.11.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e92ae7c5b3e..f5b263940ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. + The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#TBD) + ## [1.8.0/0.31.0] - 2022-07-08 ### Added diff --git a/semconv/v1.11.0/doc.go b/semconv/v1.11.0/doc.go new file mode 100644 index 00000000000..050d28599b8 --- /dev/null +++ b/semconv/v1.11.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.11.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" diff --git a/semconv/v1.11.0/exception.go b/semconv/v1.11.0/exception.go new file mode 100644 index 00000000000..a13404feab0 --- /dev/null +++ b/semconv/v1.11.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.11.0/http.go b/semconv/v1.11.0/http.go new file mode 100644 index 00000000000..49d26603c40 --- /dev/null +++ b/semconv/v1.11.0/http.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/semconv/v1.11.0/resource.go b/semconv/v1.11.0/resource.go new file mode 100644 index 00000000000..a863fdacdf6 --- /dev/null +++ b/semconv/v1.11.0/resource.go @@ -0,0 +1,981 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // Required: No + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // Required: No + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback function (which + // may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) span attributes). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: Depending on the cloud provider, use: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) with the resolved function version, as the same runtime instance + // may be invokable with multiple + // different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id). + + // On some providers, it may not be possible to determine the full ID at startup, + // which is why this field cannot be made required. For example, on AWS the + // account ID + // part of the ARN is not available without calling another AWS API + // which may be deemed too slow for a short-running lambda function. + // As an alternative, consider setting `faas.id` as a span attribute instead. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // Required: No + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // Required: Always + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // Required: See below + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // Required: No + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.11.0/schema.go b/semconv/v1.11.0/schema.go new file mode 100644 index 00000000000..3bb4a929a06 --- /dev/null +++ b/semconv/v1.11.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.11.0" diff --git a/semconv/v1.11.0/trace.go b/semconv/v1.11.0/trace.go new file mode 100644 index 00000000000..f99ee377458 --- /dev/null +++ b/semconv/v1.11.0/trace.go @@ -0,0 +1,1704 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.11.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // Required: Required, if applicable. + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // Required: Required if applicable and not explicitly disabled via + // instrumentation configuration. + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // Required: Required, if `db.statement` is not applicable. + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // Required: No + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // Required: No + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // Required: Required, if other than the default database (`0`). + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // Required: No + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#recording-an-exception). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // Required: Always + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // Required: No + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // Required: Always + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // Required: For some cloud providers, like AWS or GCP, the region in which a + // function is hosted is essential to uniquely identify the function and also part + // of its endpoint. Since it's part of the endpoint being called, the region is + // always known to clients. In these cases, `faas.invoked_region` MUST be set + // accordingly. If the region is unknown to the client or not required for + // identifying the invoked function, setting `faas.invoked_region` is optional. + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // Required: No + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Remote address of the peer (dotted decimal for IPv4 or + // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) + // + // Type: string + // Required: No + // Stability: stable + // Examples: '127.0.0.1' + NetPeerIPKey = attribute.Key("net.peer.ip") + // Remote port number. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Remote hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '192.168.0.1' + NetHostIPKey = attribute.Key("net.host.ip") + // Like `net.peer.port` but for the host port. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 35555 + NetHostPortKey = attribute.Key("net.host.port") + // Local hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // The internet connection type currently being used by the host. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Another IP-based protocol + NetTransportIP = NetTransportKey.String("ip") + // Unix Domain socket. See below + NetTransportUnix = NetTransportKey.String("unix") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/path/12314/?q=ddds#123' + HTTPTargetKey = attribute.Key("http.target") + // The value of the [HTTP host + // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header + // should also be reported, see note. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'www.example.org' + // Note: When the header is present but empty the attribute SHOULD be set to the + // empty string. Note that this is a valid situation that is expected in certain + // cases, according the aforementioned [section of RFC + // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not + // set the attribute MUST NOT be set. + HTTPHostKey = attribute.Key("http.host") + // The URI scheme identifying the used protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // Required: If and only if one was received/sent. + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User- + // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the + // client. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the uncompressed request payload body after transport decoding. Not + // set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + // The size of the uncompressed response payload body after transport decoding. + // Not set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") + // The ordinal number of request re-sending attempt. + // + // Type: int + // Required: If and only if a request was retried. + // Stability: stable + // Examples: 3 + HTTPRetryCountKey = attribute.Key("http.retry_count") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Server +const ( + // The primary server name of the matched virtual host. This should be obtained + // via configuration. If no such configuration can be obtained, this attribute + // MUST NOT be set ( `net.host.name` should be used instead). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `http.url` is usually not readily available on the server side but would + // have to be assembled in a cumbersome and sometimes lossy process from other + // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus + // preferred to supply the raw data that is available. + HTTPServerNameKey = attribute.Key("http.server_name") + // The matched route (path template). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/users/:userID?' + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.peer.ip`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.peer.ip`, is available even if that other + // source just confirms the same value as `net.peer.ip`. + // Rationale: For `net.peer.ip`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.peer.ip` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // Required: Required only if the message destination is either a `queue` or + // `topic`. + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // Required: Unless it is empty. + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // Required: No + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // Required: No + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) From 5568a3072367bb8ac4d2d9e759e7deb5a975b9f5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 13 Jul 2022 06:55:43 -0700 Subject: [PATCH 203/886] Add semconv/v1.12.0 (#3010) * Add semconv/v1.12.0 * Update all semconv use to v1.12.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 4 +- bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- semconv/v1.12.0/doc.go | 20 + semconv/v1.12.0/exception.go | 20 + semconv/v1.12.0/http.go | 114 ++ semconv/v1.12.0/resource.go | 1042 ++++++++++ semconv/v1.12.0/schema.go | 20 + semconv/v1.12.0/trace.go | 1704 +++++++++++++++++ website_docs/getting-started.md | 2 +- website_docs/manual.md | 4 +- 33 files changed, 2950 insertions(+), 28 deletions(-) create mode 100644 semconv/v1.12.0/doc.go create mode 100644 semconv/v1.12.0/exception.go create mode 100644 semconv/v1.12.0/http.go create mode 100644 semconv/v1.12.0/resource.go create mode 100644 semconv/v1.12.0/schema.go create mode 100644 semconv/v1.12.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f5b263940ea..1a1eda5dcd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. + The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) - Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. - The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#TBD) + The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) ## [1.8.0/0.31.0] - 2022-07-08 diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 4aeaad0096b..3875f5ca23d 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index b728214298a..bf70dc2ea91 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 06d542f7e1e..64756216758 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 7720e96f650..507260c8bd5 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index c2e4a5f57b1..27e26ca0a1f 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index d6d2fcfbbee..e0980401728 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 67133ab2c9d..ffc8fe9c3b2 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 20c23d49458..e2c5deea615 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 459ee94d6f8..11bdd2ea4b6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 3a8c1c005d7..48d053bdcdf 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -23,7 +23,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 81d0fc1a706..9bec6676a57 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index f8869988e7a..454d18c495b 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 183a536b9c2..bf0193c231c 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index ad490c11c00..87ad4b06045 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index c5069d111b2..7af46c61af0 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index f19470fe333..7a897e96977 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 531a68424a0..eb22d007922 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -21,7 +21,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 8d1952e5f62..c50a0031c9b 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index a4d88fa9ccf..3b4d0c14dbd 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index c53867878e9..5124eff69c3 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index ad262e0ba84..9a169f663fb 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 1f2e132fecf..513e782b077 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index d380c2719a7..14d0aabfe69 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 58b2c04c6e8..8d95782115b 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) diff --git a/semconv/v1.12.0/doc.go b/semconv/v1.12.0/doc.go new file mode 100644 index 00000000000..181fcc9c520 --- /dev/null +++ b/semconv/v1.12.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.12.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" diff --git a/semconv/v1.12.0/exception.go b/semconv/v1.12.0/exception.go new file mode 100644 index 00000000000..d6892709437 --- /dev/null +++ b/semconv/v1.12.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.12.0/http.go b/semconv/v1.12.0/http.go new file mode 100644 index 00000000000..4b4f3cbaf0b --- /dev/null +++ b/semconv/v1.12.0/http.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal" + "go.opentelemetry.io/otel/trace" +) + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) + +var sc = &internal.SemanticConventions{ + EnduserIDKey: EnduserIDKey, + HTTPClientIPKey: HTTPClientIPKey, + HTTPFlavorKey: HTTPFlavorKey, + HTTPHostKey: HTTPHostKey, + HTTPMethodKey: HTTPMethodKey, + HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, + HTTPRouteKey: HTTPRouteKey, + HTTPSchemeHTTP: HTTPSchemeHTTP, + HTTPSchemeHTTPS: HTTPSchemeHTTPS, + HTTPServerNameKey: HTTPServerNameKey, + HTTPStatusCodeKey: HTTPStatusCodeKey, + HTTPTargetKey: HTTPTargetKey, + HTTPURLKey: HTTPURLKey, + HTTPUserAgentKey: HTTPUserAgentKey, + NetHostIPKey: NetHostIPKey, + NetHostNameKey: NetHostNameKey, + NetHostPortKey: NetHostPortKey, + NetPeerIPKey: NetPeerIPKey, + NetPeerNameKey: NetPeerNameKey, + NetPeerPortKey: NetPeerPortKey, + NetTransportIP: NetTransportIP, + NetTransportOther: NetTransportOther, + NetTransportTCP: NetTransportTCP, + NetTransportUDP: NetTransportUDP, + NetTransportUnix: NetTransportUnix, +} + +// NetAttributesFromHTTPRequest generates attributes of the net +// namespace as specified by the OpenTelemetry specification for a +// span. The network parameter is a string that net.Dial function +// from standard library can understand. +func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { + return sc.NetAttributesFromHTTPRequest(network, request) +} + +// EndUserAttributesFromHTTPRequest generates attributes of the +// enduser namespace as specified by the OpenTelemetry specification +// for a span. +func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.EndUserAttributesFromHTTPRequest(request) +} + +// HTTPClientAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the client side. +func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { + return sc.HTTPClientAttributesFromHTTPRequest(request) +} + +// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes +// to be used with server-side HTTP metrics. +func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) +} + +// HTTPServerAttributesFromHTTPRequest generates attributes of the +// http namespace as specified by the OpenTelemetry specification for +// a span on the server side. Currently, only basic authentication is +// supported. +func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { + return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) +} + +// HTTPAttributesFromHTTPStatusCode generates attributes of the http +// namespace as specified by the OpenTelemetry specification for a +// span. +func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { + return sc.HTTPAttributesFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCode generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCode(code) +} + +// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message +// as specified by the OpenTelemetry specification for a span. +// Exclude 4xx for SERVER to set the appropriate status. +func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { + return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) +} diff --git a/semconv/v1.12.0/resource.go b/semconv/v1.12.0/resource.go new file mode 100644 index 00000000000..b2155676f45 --- /dev/null +++ b/semconv/v1.12.0/resource.go @@ -0,0 +1,1042 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (navigator.userAgentData.brands). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (navigator.userAgentData.platform). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [os.type and os.name attributes](./os.md). However, for consistency, the values + // in the `browser.platform` attribute should capture the exact value that the + // user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // Full user-agent string provided by the browser + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // Required: No + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // Required: No + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // Required: No + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // Required: Always + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // Required: See below + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // Required: See below + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // Required: No + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.12.0/schema.go b/semconv/v1.12.0/schema.go new file mode 100644 index 00000000000..2f2a019e43d --- /dev/null +++ b/semconv/v1.12.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.12.0" diff --git a/semconv/v1.12.0/trace.go b/semconv/v1.12.0/trace.go new file mode 100644 index 00000000000..047d8e95cce --- /dev/null +++ b/semconv/v1.12.0/trace.go @@ -0,0 +1,1704 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.12.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // Required: No + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // Required: Required, if applicable. + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // Required: Required if applicable and not explicitly disabled via + // instrumentation configuration. + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // Required: Required, if `db.statement` is not applicable. + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // Required: No + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // Required: No + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // Required: Required, if other than the default database (`0`). + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // Required: Recommended if available. + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // Required: No + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#recording-an-exception). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // Required: Always + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // Required: Always + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // Required: No + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // Required: Always + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // Required: For some cloud providers, like AWS or GCP, the region in which a + // function is hosted is essential to uniquely identify the function and also part + // of its endpoint. Since it's part of the endpoint being called, the region is + // always known to clients. In these cases, `faas.invoked_region` MUST be set + // accordingly. If the region is unknown to the client or not required for + // identifying the invoked function, setting `faas.invoked_region` is optional. + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // Required: No + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Remote address of the peer (dotted decimal for IPv4 or + // [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6) + // + // Type: string + // Required: No + // Stability: stable + // Examples: '127.0.0.1' + NetPeerIPKey = attribute.Key("net.peer.ip") + // Remote port number. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Remote hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '192.168.0.1' + NetHostIPKey = attribute.Key("net.host.ip") + // Like `net.peer.port` but for the host port. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 35555 + NetHostPortKey = attribute.Key("net.host.port") + // Local hostname or similar, see note below. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // The internet connection type currently being used by the host. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // Required: No + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Another IP-based protocol + NetTransportIP = NetTransportKey.String("ip") + // Unix Domain socket. See below + NetTransportUnix = NetTransportKey.String("unix") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/path/12314/?q=ddds#123' + HTTPTargetKey = attribute.Key("http.target") + // The value of the [HTTP host + // header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header + // should also be reported, see note. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'www.example.org' + // Note: When the header is present but empty the attribute SHOULD be set to the + // empty string. Note that this is a valid situation that is expected in certain + // cases, according the aforementioned [section of RFC + // 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not + // set the attribute MUST NOT be set. + HTTPHostKey = attribute.Key("http.host") + // The URI scheme identifying the used protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // Required: If and only if one was received/sent. + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // Required: No + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User- + // Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the + // client. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the uncompressed request payload body after transport decoding. Not + // set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPRequestContentLengthUncompressedKey = attribute.Key("http.request_content_length_uncompressed") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For + // requests using transport encoding, this should be the compressed size. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + // The size of the uncompressed response payload body after transport decoding. + // Not set if transport encoding not used. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 5493 + HTTPResponseContentLengthUncompressedKey = attribute.Key("http.response_content_length_uncompressed") + // The ordinal number of request re-sending attempt. + // + // Type: int + // Required: If and only if a request was retried. + // Stability: stable + // Examples: 3 + HTTPRetryCountKey = attribute.Key("http.retry_count") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Server +const ( + // The primary server name of the matched virtual host. This should be obtained + // via configuration. If no such configuration can be obtained, this attribute + // MUST NOT be set ( `net.host.name` should be used instead). + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'example.com' + // Note: `http.url` is usually not readily available on the server side but would + // have to be assembled in a cumbersome and sometimes lossy process from other + // information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus + // preferred to supply the raw data that is available. + HTTPServerNameKey = attribute.Key("http.server_name") + // The matched route (path template). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '/users/:userID?' + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // Required: No + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.peer.ip`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.peer.ip`, is available even if that other + // source just confirms the same value as `net.peer.ip`. + // Rationale: For `net.peer.ip`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.peer.ip` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // Required: No + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // Required: No + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // Required: Required only if the message destination is either a `queue` or + // `topic`. + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // Required: Unless it is empty. + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // Required: No + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // Required: If missing, it is assumed to be false. + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // Required: Always + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // Required: No + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // Required: No + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // Required: No, but recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // Required: Always + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // Required: If missing, it is assumed to be "1.0". + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // Required: No + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // Required: If missing, response is assumed to be successful. + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // Required: No + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // Required: No + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // Required: No + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // Required: No + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index f0672a7efb4..5cea707e9f0 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -284,7 +284,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) ``` diff --git a/website_docs/manual.md b/website_docs/manual.md index ea88547e0d5..1d6a4c9544a 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" ) @@ -169,7 +169,7 @@ span.SetAttributes(myKey.String("a value")) #### Semantic Attributes -Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.10.0` package. +Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.12.0` package. For details, see [Trace semantic conventions][]. From 096a1624184285edbf9c82c53ea0b068895915ef Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Tue, 19 Jul 2022 12:07:18 +0800 Subject: [PATCH 204/886] Add http.method attribute to http server metric (#3018) * Add http.method attribute to http server metric Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix for reviews Signed-off-by: Ziqi Zhao * add changelog entry Signed-off-by: Ziqi Zhao --- CHANGELOG.md | 1 + semconv/internal/http.go | 13 +- semconv/internal/http_test.go | 285 ++++++++++++++++++++++++++++++++++ 3 files changed, 292 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1eda5dcd7..21cef2402fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) - Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) +- Add http.method attribute to http server metric. (#3018) ## [1.8.0/0.31.0] - 2022-07-08 diff --git a/semconv/internal/http.go b/semconv/internal/http.go index 864ba3f39df..b580eedeff7 100644 --- a/semconv/internal/http.go +++ b/semconv/internal/http.go @@ -147,12 +147,6 @@ func (sc *SemanticConventions) EndUserAttributesFromHTTPRequest(request *http.Re func (sc *SemanticConventions) HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { attrs := []attribute.KeyValue{} - if request.Method != "" { - attrs = append(attrs, sc.HTTPMethodKey.String(request.Method)) - } else { - attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet)) - } - // remove any username/password info that may be in the URL // before adding it to the attributes userinfo := request.URL.User @@ -204,6 +198,12 @@ func (sc *SemanticConventions) httpBasicAttributesFromHTTPRequest(request *http. attrs = append(attrs, sc.HTTPFlavorKey.String(flavor)) } + if request.Method != "" { + attrs = append(attrs, sc.HTTPMethodKey.String(request.Method)) + } else { + attrs = append(attrs, sc.HTTPMethodKey.String(http.MethodGet)) + } + return attrs } @@ -223,7 +223,6 @@ func (sc *SemanticConventions) HTTPServerMetricAttributesFromHTTPRequest(serverN // supported. func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { attrs := []attribute.KeyValue{ - sc.HTTPMethodKey.String(request.Method), sc.HTTPTargetKey.String(request.RequestURI), } diff --git a/semconv/internal/http_test.go b/semconv/internal/http_test.go index 302c3e0ea0a..3e42f02faf3 100644 --- a/semconv/internal/http_test.go +++ b/semconv/internal/http_test.go @@ -1236,3 +1236,288 @@ func TestHTTPClientAttributesFromHTTPRequest(t *testing.T) { }) } } + +func TestHTTPServerMetricAttributesFromHTTPRequest(t *testing.T) { + type testcase struct { + name string + serverName string + method string + requestURI string + proto string + remoteAddr string + host string + url *url.URL + header http.Header + tls tlsOption + contentLength int64 + expected []attribute.KeyValue + } + testcases := []testcase{ + { + name: "stripped", + serverName: "", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: noTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", "1.0"), + }, + }, + { + name: "with server name", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: noTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + }, + }, + { + name: "with tls", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + }, + }, + { + name: "with route", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + }, + }, + { + name: "with host", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + { + name: "with host fallback", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "", + url: &url.URL{ + Host: "example.com", + Path: "/user/123", + }, + header: nil, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + { + name: "with user agent", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: http.Header{ + "User-Agent": []string{"foodownloader"}, + }, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + { + name: "with proxy info", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: http.Header{ + "User-Agent": []string{"foodownloader"}, + "X-Forwarded-For": []string{"203.0.113.195, 70.41.3.18, 150.172.238.178"}, + }, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + { + name: "with http 1.1", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.1", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: http.Header{ + "User-Agent": []string{"foodownloader"}, + "X-Forwarded-For": []string{"1.2.3.4"}, + }, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "1.1"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + { + name: "with http 2", + serverName: "my-server-name", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/2.0", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: http.Header{ + "User-Agent": []string{"foodownloader"}, + "X-Forwarded-For": []string{"1.2.3.4"}, + }, + tls: withTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "https"), + attribute.String("http.flavor", "2"), + attribute.String("http.server_name", "my-server-name"), + attribute.String("http.host", "example.com"), + }, + }, + } + for idx, tc := range testcases { + r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) + r.ContentLength = tc.contentLength + got := sc.HTTPServerMetricAttributesFromHTTPRequest(tc.serverName, r) + assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) + } +} + +func TestHttpBasicAttributesFromHTTPRequest(t *testing.T) { + type testcase struct { + name string + method string + requestURI string + proto string + remoteAddr string + host string + url *url.URL + header http.Header + tls tlsOption + contentLength int64 + expected []attribute.KeyValue + } + testcases := []testcase{ + { + name: "stripped", + method: "GET", + requestURI: "/user/123", + proto: "HTTP/1.0", + remoteAddr: "", + host: "example.com", + url: &url.URL{ + Path: "/user/123", + }, + header: nil, + tls: noTLS, + expected: []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.host", "example.com"), + }, + }, + } + for idx, tc := range testcases { + r := testRequest(tc.method, tc.requestURI, tc.proto, tc.remoteAddr, tc.host, tc.url, tc.header, tc.tls) + r.ContentLength = tc.contentLength + got := sc.httpBasicAttributesFromHTTPRequest(r) + assertElementsMatch(t, tc.expected, got, "testcase %d - %s", idx, tc.name) + } +} From 05c5509915fc2eca73d5c134d215274d47e157c5 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Fri, 22 Jul 2022 20:46:06 +0200 Subject: [PATCH 205/886] Add tests and fix opentracing bridge defer warning (#3029) * add tests and fix opentracing bridge defer warning * add changelog entry * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/bridge_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++ bridge/opentracing/bridge.go | 5 ++- bridge/opentracing/bridge_test.go | 65 +++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21cef2402fb..4bff4ee4bf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) - Add http.method attribute to http server metric. (#3018) +### Fixed + +- Invalid warning for context setup being deferred in OpenTracing bridge (#3029). + ## [1.8.0/0.31.0] - 2022-07-08 ### Added diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 2927e86535a..2922b9869d5 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -328,7 +328,8 @@ var _ ot.TracerContextWithSpanExtension = &BridgeTracer{} func NewBridgeTracer() *BridgeTracer { return &BridgeTracer{ setTracer: bridgeSetTracer{ - otelTracer: noopTracer, + warningHandler: func(msg string) {}, + otelTracer: noopTracer, }, warningHandler: func(msg string) {}, propagator: nil, @@ -434,7 +435,7 @@ func (t *BridgeTracer) StartSpan(operationName string, opts ...ot.StartSpanOptio trace.WithLinks(links...), trace.WithSpanKind(kind), ) - if checkCtx != checkCtx2 { + if ot.SpanFromContext(checkCtx2) != nil { t.warnOnce.Do(func() { t.warningHandler("SDK should have deferred the context setup, see the documentation of go.opentelemetry.io/otel/bridge/opentracing/migration\n") }) diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index eea3091f265..a64d6f73919 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -24,6 +24,7 @@ import ( ot "github.com/opentracing/opentracing-go" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -360,3 +361,67 @@ func TestBridgeTracer_ExtractAndInject(t *testing.T) { }) } } + +type nonDeferWrapperTracer struct { + *WrapperTracer +} + +func (t *nonDeferWrapperTracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { + // Run start on the parent wrapper with a brand new context + // so `WithDeferredSetup` hasn't been called, and the OpenTracing context is injected. + return t.WrapperTracer.Start(context.Background(), name, opts...) +} + +func TestBridgeTracer_StartSpan(t *testing.T) { + testCases := []struct { + name string + before func(*testing.T, *BridgeTracer) + expectWarnings []string + }{ + { + name: "with no option set", + expectWarnings: []string{ + "The OpenTelemetry tracer is not set, default no-op tracer is used! Call SetOpenTelemetryTracer to set it up.\n", + }, + }, + { + name: "with wrapper tracer set", + before: func(t *testing.T, bridge *BridgeTracer) { + wTracer := NewWrapperTracer(bridge, otel.Tracer("test")) + bridge.SetOpenTelemetryTracer(wTracer) + }, + expectWarnings: []string(nil), + }, + { + name: "with a non-defered wrapper tracer", + before: func(t *testing.T, bridge *BridgeTracer) { + wTracer := &nonDeferWrapperTracer{ + NewWrapperTracer(bridge, otel.Tracer("test")), + } + bridge.SetOpenTelemetryTracer(wTracer) + }, + expectWarnings: []string{ + "SDK should have deferred the context setup, see the documentation of go.opentelemetry.io/otel/bridge/opentracing/migration\n", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + var warningMessages []string + bridge := NewBridgeTracer() + bridge.SetWarningHandler(func(msg string) { + warningMessages = append(warningMessages, msg) + }) + + if tc.before != nil { + tc.before(t, bridge) + } + + span := bridge.StartSpan("test") + assert.NotNil(t, span) + + assert.Equal(t, tc.expectWarnings, warningMessages) + }) + } +} From 1eae91b3b099af62100cd630cd1cab89fe841615 Mon Sep 17 00:00:00 2001 From: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Date: Mon, 25 Jul 2022 11:30:23 -0400 Subject: [PATCH 206/886] Introduce "split" metric schema transformation (#2999) This is a new transformation type that allows to describe a change where a metric is converted to several other metrics by eliminating an attribute. An example of such change that happened recently is this: https://github.com/open-telemetry/opentelemetry-specification/pull/2617 This PR implements specification change https://github.com/open-telemetry/opentelemetry-specification/pull/2653 This PR creates package v1.1 for the new functionality. The old package v1.0 remains unchanged. --- CHANGELOG.md | 1 + schema/README.md | 4 +- schema/internal/parser_checks.go | 74 +++++++ schema/internal/parser_checks_test.go | 41 ++++ schema/v1.0/parser.go | 56 +---- schema/v1.0/parser_test.go | 199 +++++++++--------- .../testdata/unsupported-file-format.yaml | 1 + schema/v1.1/ast/ast_schema.go | 50 +++++ schema/v1.1/ast/metrics.go | 52 +++++ schema/v1.1/parser.go | 62 ++++++ schema/v1.1/parser_test.go | 174 +++++++++++++++ .../testdata/unsupported-file-format.yaml | 10 + schema/v1.1/testdata/valid-example.yaml | 144 +++++++++++++ schema/v1.1/types/types.go | 26 +++ 14 files changed, 741 insertions(+), 153 deletions(-) create mode 100644 schema/internal/parser_checks.go create mode 100644 schema/internal/parser_checks_test.go create mode 100644 schema/v1.1/ast/ast_schema.go create mode 100644 schema/v1.1/ast/metrics.go create mode 100644 schema/v1.1/parser.go create mode 100644 schema/v1.1/parser_test.go create mode 100644 schema/v1.1/testdata/unsupported-file-format.yaml create mode 100644 schema/v1.1/testdata/valid-example.yaml create mode 100644 schema/v1.1/types/types.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bff4ee4bf7..c7ed2b320db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) +- Add support for Schema Files format 1.1.x (metric "split" transform). (#2999) ### Changed diff --git a/schema/README.md b/schema/README.md index 0b02a5f1336..2301b439fac 100644 --- a/schema/README.md +++ b/schema/README.md @@ -11,9 +11,9 @@ then import the corresponding package and use the `Parse` or `ParseFile` functio like this: ```go -import schema "go.opentelemetry.io/otel/schema/v1.0" +import schema "go.opentelemetry.io/otel/schema/v1.1" -// Load the schema from a file in v1.0.x file format. +// Load the schema from a file in v1.1.x file format. func loadSchemaFromFile() error { telSchema, err := schema.ParseFile("schema-file.yaml") if err != nil { diff --git a/schema/internal/parser_checks.go b/schema/internal/parser_checks.go new file mode 100644 index 00000000000..1ea46939444 --- /dev/null +++ b/schema/internal/parser_checks.go @@ -0,0 +1,74 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/schema/internal" + +import ( + "errors" + "fmt" + "net/url" + "strconv" + "strings" + + "github.com/Masterminds/semver/v3" +) + +// CheckFileFormatField validates the file format field according to the rules here: +// https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-file-format-number +func CheckFileFormatField(fileFormat string, supportedFormatMajor, supportedFormatMinor int) error { + // Verify that the version number in the file is a semver. + fileFormatParsed, err := semver.StrictNewVersion(fileFormat) + if err != nil { + return fmt.Errorf( + "invalid schema file format version number %q (expected semver): %w", + fileFormat, err, + ) + } + + // Check that the major version number in the file is the same as what we expect. + if fileFormatParsed.Major() != uint64(supportedFormatMajor) { + return fmt.Errorf( + "this library cannot parse file formats with major version other than %v", + supportedFormatMajor, + ) + } + + // Check that the file minor version number is not greater than + // what is requested supports. + if fileFormatParsed.Minor() > uint64(supportedFormatMinor) { + supportedFormatMajorMinor := strconv.Itoa(supportedFormatMajor) + "." + + strconv.Itoa(supportedFormatMinor) // 1.0 + + return fmt.Errorf( + "unsupported schema file format minor version number, expected no newer than %v, got %v", + supportedFormatMajorMinor+".x", fileFormat, + ) + } + + // Patch, prerelease and metadata version number does not matter, so we don't check it. + + return nil +} + +// CheckSchemaURL verifies that schemaURL is valid. +func CheckSchemaURL(schemaURL string) error { + if strings.TrimSpace(schemaURL) == "" { + return errors.New("schema_url field is missing") + } + + if _, err := url.Parse(schemaURL); err != nil { + return fmt.Errorf("invalid URL specified in schema_url field: %w", err) + } + return nil +} diff --git a/schema/internal/parser_checks_test.go b/schema/internal/parser_checks_test.go new file mode 100644 index 00000000000..dab407de51c --- /dev/null +++ b/schema/internal/parser_checks_test.go @@ -0,0 +1,41 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/schema/internal" + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestCheckFileFormatField(t *testing.T) { + // Invalid file format version numbers. + assert.Error(t, CheckFileFormatField("not a semver", 1, 0)) + assert.Error(t, CheckFileFormatField("2.0.0", 1, 0)) + assert.Error(t, CheckFileFormatField("1.1.0", 1, 0)) + + assert.Error(t, CheckFileFormatField("1.2.0", 1, 1)) + + // Valid cases. + assert.NoError(t, CheckFileFormatField("1.0.0", 1, 0)) + assert.NoError(t, CheckFileFormatField("1.0.1", 1, 0)) + assert.NoError(t, CheckFileFormatField("1.0.10000-alpha+4857", 1, 0)) + + assert.NoError(t, CheckFileFormatField("1.0.0", 1, 1)) + assert.NoError(t, CheckFileFormatField("1.0.1", 1, 1)) + assert.NoError(t, CheckFileFormatField("1.0.10000-alpha+4857", 1, 1)) + assert.NoError(t, CheckFileFormatField("1.1.0", 1, 1)) + assert.NoError(t, CheckFileFormatField("1.1.1", 1, 1)) +} diff --git a/schema/v1.0/parser.go b/schema/v1.0/parser.go index 413cb64c219..a284606bd9c 100644 --- a/schema/v1.0/parser.go +++ b/schema/v1.0/parser.go @@ -15,16 +15,12 @@ package schema // import "go.opentelemetry.io/otel/schema/v1.0" import ( - "fmt" "io" - "net/url" "os" - "strconv" - "strings" - "github.com/Masterminds/semver/v3" "gopkg.in/yaml.v2" + "go.opentelemetry.io/otel/schema/internal" "go.opentelemetry.io/otel/schema/v1.0/ast" ) @@ -34,10 +30,6 @@ const supportedFormatMajor = 1 // Maximum minor version number that this library supports. const supportedFormatMinor = 0 -// Maximum major+minor version number that this library supports, as a string. -var supportedFormatMajorMinor = strconv.Itoa(supportedFormatMajor) + "." + - strconv.Itoa(supportedFormatMinor) // 1.0 - // ParseFile a schema file. schemaFilePath is the file path. func ParseFile(schemaFilePath string) (*ast.Schema, error) { file, err := os.Open(schemaFilePath) @@ -56,51 +48,15 @@ func Parse(schemaFileContent io.Reader) (*ast.Schema, error) { return nil, err } - if err := checkFileFormatField(ts.FileFormat); err != nil { + err = internal.CheckFileFormatField(ts.FileFormat, supportedFormatMajor, supportedFormatMinor) + if err != nil { return nil, err } - if strings.TrimSpace(ts.SchemaURL) == "" { - return nil, fmt.Errorf("schema_url field is missing") - } - - if _, err := url.Parse(ts.SchemaURL); err != nil { - return nil, fmt.Errorf("invalid URL specified in schema_url field: %w", err) - } - - return &ts, nil -} - -// checkFileFormatField validates the file format field according to the rules here: -// https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-file-format-number -func checkFileFormatField(fileFormat string) error { - // Verify that the version number in the file is a semver. - fileFormatParsed, err := semver.StrictNewVersion(fileFormat) + err = internal.CheckSchemaURL(ts.SchemaURL) if err != nil { - return fmt.Errorf( - "invalid schema file format version number %q (expected semver): %w", - fileFormat, err, - ) - } - - // Check that the major version number in the file is the same as what we expect. - if fileFormatParsed.Major() != supportedFormatMajor { - return fmt.Errorf( - "this library cannot parse file formats with major version other than %v", - supportedFormatMajor, - ) - } - - // Check that the file minor version number is not greater than - // what is requested supports. - if fileFormatParsed.Minor() > supportedFormatMinor { - return fmt.Errorf( - "unsupported schema file format minor version number, expected no newer than %v, got %v", - supportedFormatMajorMinor+".x", fileFormat, - ) + return nil, err } - // Patch, prerelease and metadata version number does not matter, so we don't check it. - - return nil + return &ts, nil } diff --git a/schema/v1.0/parser_test.go b/schema/v1.0/parser_test.go index eefe3257992..72d20bd1162 100644 --- a/schema/v1.0/parser_test.go +++ b/schema/v1.0/parser_test.go @@ -28,123 +28,132 @@ func TestParseSchemaFile(t *testing.T) { ts, err := ParseFile("testdata/valid-example.yaml") assert.NoError(t, err) assert.NotNil(t, ts) - assert.EqualValues(t, &ast.Schema{ - FileFormat: "1.0.0", - SchemaURL: "https://opentelemetry.io/schemas/1.1.0", - Versions: map[types.TelemetryVersion]ast.VersionDef{ - "1.0.0": {}, - - "1.1.0": { - All: ast.Attributes{ - Changes: []ast.AttributeChange{ - {RenameAttributes: &ast.AttributeMap{ - "k8s.cluster.name": "kubernetes.cluster.name", - "k8s.namespace.name": "kubernetes.namespace.name", - "k8s.node.name": "kubernetes.node.name", - "k8s.node.uid": "kubernetes.node.uid", - "k8s.pod.name": "kubernetes.pod.name", - "k8s.pod.uid": "kubernetes.pod.uid", - "k8s.container.name": "kubernetes.container.name", - "k8s.replicaset.name": "kubernetes.replicaset.name", - "k8s.replicaset.uid": "kubernetes.replicaset.uid", - "k8s.cronjob.name": "kubernetes.cronjob.name", - "k8s.cronjob.uid": "kubernetes.cronjob.uid", - "k8s.job.name": "kubernetes.job.name", - "k8s.job.uid": "kubernetes.job.uid", - "k8s.statefulset.name": "kubernetes.statefulset.name", - "k8s.statefulset.uid": "kubernetes.statefulset.uid", - "k8s.daemonset.name": "kubernetes.daemonset.name", - "k8s.daemonset.uid": "kubernetes.daemonset.uid", - "k8s.deployment.name": "kubernetes.deployment.name", - "k8s.deployment.uid": "kubernetes.deployment.uid", - "service.namespace": "service.namespace.name", - }}, + assert.EqualValues( + t, &ast.Schema{ + FileFormat: "1.0.0", + SchemaURL: "https://opentelemetry.io/schemas/1.1.0", + Versions: map[types.TelemetryVersion]ast.VersionDef{ + "1.0.0": {}, + + "1.1.0": { + All: ast.Attributes{ + Changes: []ast.AttributeChange{ + { + RenameAttributes: &ast.AttributeMap{ + "k8s.cluster.name": "kubernetes.cluster.name", + "k8s.namespace.name": "kubernetes.namespace.name", + "k8s.node.name": "kubernetes.node.name", + "k8s.node.uid": "kubernetes.node.uid", + "k8s.pod.name": "kubernetes.pod.name", + "k8s.pod.uid": "kubernetes.pod.uid", + "k8s.container.name": "kubernetes.container.name", + "k8s.replicaset.name": "kubernetes.replicaset.name", + "k8s.replicaset.uid": "kubernetes.replicaset.uid", + "k8s.cronjob.name": "kubernetes.cronjob.name", + "k8s.cronjob.uid": "kubernetes.cronjob.uid", + "k8s.job.name": "kubernetes.job.name", + "k8s.job.uid": "kubernetes.job.uid", + "k8s.statefulset.name": "kubernetes.statefulset.name", + "k8s.statefulset.uid": "kubernetes.statefulset.uid", + "k8s.daemonset.name": "kubernetes.daemonset.name", + "k8s.daemonset.uid": "kubernetes.daemonset.uid", + "k8s.deployment.name": "kubernetes.deployment.name", + "k8s.deployment.uid": "kubernetes.deployment.uid", + "service.namespace": "service.namespace.name", + }, + }, + }, }, - }, - Resources: ast.Attributes{ - Changes: []ast.AttributeChange{ - { - RenameAttributes: &ast.AttributeMap{ - "telemetry.auto.version": "telemetry.auto_instr.version", + Resources: ast.Attributes{ + Changes: []ast.AttributeChange{ + { + RenameAttributes: &ast.AttributeMap{ + "telemetry.auto.version": "telemetry.auto_instr.version", + }, }, }, }, - }, - Spans: ast.Spans{ - Changes: []ast.SpansChange{ - { - RenameAttributes: &ast.AttributeMapForSpans{ - AttributeMap: ast.AttributeMap{ - "peer.service": "peer.service.name", + Spans: ast.Spans{ + Changes: []ast.SpansChange{ + { + RenameAttributes: &ast.AttributeMapForSpans{ + AttributeMap: ast.AttributeMap{ + "peer.service": "peer.service.name", + }, + ApplyToSpans: []types.SpanName{"HTTP GET"}, }, - ApplyToSpans: []types.SpanName{"HTTP GET"}, }, }, }, - }, - SpanEvents: ast.SpanEvents{ - Changes: []ast.SpanEventsChange{ - { - RenameEvents: &ast.RenameSpanEvents{ - EventNameMap: map[string]string{ - "exception.stacktrace": "exception.stack_trace", + SpanEvents: ast.SpanEvents{ + Changes: []ast.SpanEventsChange{ + { + RenameEvents: &ast.RenameSpanEvents{ + EventNameMap: map[string]string{ + "exception.stacktrace": "exception.stack_trace", + }, }, }, - }, - { - RenameAttributes: &ast.RenameSpanEventAttributes{ - ApplyToEvents: []types.EventName{"exception.stack_trace"}, - AttributeMap: ast.AttributeMap{ - "peer.service": "peer.service.name", + { + RenameAttributes: &ast.RenameSpanEventAttributes{ + ApplyToEvents: []types.EventName{"exception.stack_trace"}, + AttributeMap: ast.AttributeMap{ + "peer.service": "peer.service.name", + }, }, }, }, }, - }, - Logs: ast.Logs{Changes: []ast.LogsChange{ - {RenameAttributes: &ast.RenameAttributes{ - AttributeMap: map[string]string{ - "process.executable_name": "process.executable.name", - }, - }}, - }}, - - Metrics: ast.Metrics{ - Changes: []ast.MetricsChange{ - { - RenameAttributes: &ast.AttributeMapForMetrics{ - AttributeMap: map[string]string{ - "http.status_code": "http.response_status_code", + Logs: ast.Logs{ + Changes: []ast.LogsChange{ + { + RenameAttributes: &ast.RenameAttributes{ + AttributeMap: map[string]string{ + "process.executable_name": "process.executable.name", + }, }, - }}, - { - RenameMetrics: map[types.MetricName]types.MetricName{ - "container.cpu.usage.total": "cpu.usage.total", - "container.memory.usage.max": "memory.usage.max", }, }, - { - RenameAttributes: &ast.AttributeMapForMetrics{ - ApplyToMetrics: []types.MetricName{ - "system.cpu.utilization", - "system.memory.usage", - "system.memory.utilization", - "system.paging.usage", + }, + + Metrics: ast.Metrics{ + Changes: []ast.MetricsChange{ + { + RenameAttributes: &ast.AttributeMapForMetrics{ + AttributeMap: map[string]string{ + "http.status_code": "http.response_status_code", + }, }, - AttributeMap: map[string]string{ - "status": "state", + }, + { + RenameMetrics: map[types.MetricName]types.MetricName{ + "container.cpu.usage.total": "cpu.usage.total", + "container.memory.usage.max": "memory.usage.max", + }, + }, + { + RenameAttributes: &ast.AttributeMapForMetrics{ + ApplyToMetrics: []types.MetricName{ + "system.cpu.utilization", + "system.memory.usage", + "system.memory.utilization", + "system.paging.usage", + }, + AttributeMap: map[string]string{ + "status": "state", + }, }, }, }, }, }, }, - }, - }, ts) + }, ts, + ) } func TestFailParseSchemaFile(t *testing.T) { @@ -167,15 +176,3 @@ func TestFailParseSchema(t *testing.T) { _, err = Parse(bytes.NewReader([]byte("file_format: 1.0.0"))) assert.Error(t, err) } - -func TestCheckFileFormatField(t *testing.T) { - // Invalid file format version numbers. - assert.Error(t, checkFileFormatField("not a semver")) - assert.Error(t, checkFileFormatField("2.0.0")) - assert.Error(t, checkFileFormatField("1.1.0")) - - // Valid cases. - assert.NoError(t, checkFileFormatField("1.0.0")) - assert.NoError(t, checkFileFormatField("1.0.1")) - assert.NoError(t, checkFileFormatField("1.0.10000-alpha+4857")) -} diff --git a/schema/v1.0/testdata/unsupported-file-format.yaml b/schema/v1.0/testdata/unsupported-file-format.yaml index fb24f4861a8..2348606bcb7 100644 --- a/schema/v1.0/testdata/unsupported-file-format.yaml +++ b/schema/v1.0/testdata/unsupported-file-format.yaml @@ -1,4 +1,5 @@ file_format: 1.1.0 +schema_url: https://opentelemetry.io/schemas/1.1.0 versions: 1.1.0: diff --git a/schema/v1.1/ast/ast_schema.go b/schema/v1.1/ast/ast_schema.go new file mode 100644 index 00000000000..9a62fc4297c --- /dev/null +++ b/schema/v1.1/ast/ast_schema.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast // import "go.opentelemetry.io/otel/schema/v1.1/ast" + +import ( + ast10 "go.opentelemetry.io/otel/schema/v1.0/ast" + "go.opentelemetry.io/otel/schema/v1.1/types" +) + +// Schema represents a Schema file in FileFormat 1.1.0 as defined in +// https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md +type Schema struct { + // Schema file format. SHOULD be 1.1.0 for the current specification version. + // See https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-file-format-number + FileFormat string `yaml:"file_format"` + + // Schema URL is an identifier of a Schema. The URL specifies a location of this + // Schema File that can be retrieved (so it is a URL and not just a URI) using HTTP + // or HTTPS protocol. + // See https://github.com/open-telemetry/oteps/blob/main/text/0152-telemetry-schemas.md#schema-url + SchemaURL string `yaml:"schema_url"` + + // Versions section that lists changes that happened in each particular version. + Versions map[types.TelemetryVersion]VersionDef +} + +// VersionDef corresponds to a section representing one version under the "versions" +// top-level key. +// Note that most of the fields are the same as in ast 1.0 package, only Metrics are defined +// differently, since only that field has changed from 1.0 to 1.1 of schema file format. +type VersionDef struct { + All ast10.Attributes + Resources ast10.Attributes + Spans ast10.Spans + SpanEvents ast10.SpanEvents `yaml:"span_events"` + Logs ast10.Logs + Metrics Metrics +} diff --git a/schema/v1.1/ast/metrics.go b/schema/v1.1/ast/metrics.go new file mode 100644 index 00000000000..0d0e3eacb38 --- /dev/null +++ b/schema/v1.1/ast/metrics.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ast // import "go.opentelemetry.io/otel/schema/v1.1/ast" + +import ( + ast10 "go.opentelemetry.io/otel/schema/v1.0/ast" + types10 "go.opentelemetry.io/otel/schema/v1.0/types" + types11 "go.opentelemetry.io/otel/schema/v1.1/types" +) + +// Metrics corresponds to a section representing a list of changes that happened +// to metrics schema in a particular version. +type Metrics struct { + Changes []MetricsChange +} + +// MetricsChange corresponds to a section representing metrics change. +type MetricsChange struct { + RenameMetrics map[types10.MetricName]types10.MetricName `yaml:"rename_metrics"` + RenameAttributes *ast10.AttributeMapForMetrics `yaml:"rename_attributes"` + Split *SplitMetric `yaml:"split"` +} + +// SplitMetric corresponds to a section representing a splitting of a metric +// into multiple metrics by eliminating an attribute. +// SplitMetrics is introduced in schema file format 1.1, +// see https://github.com/open-telemetry/opentelemetry-specification/pull/2653 +type SplitMetric struct { + // Name of the old metric to split. + ApplyToMetric types10.MetricName `yaml:"apply_to_metric"` + + // Name of attribute in the old metric to use for splitting. The attribute will be + // eliminated, the new metric will not have it. + ByAttribute types11.AttributeName `yaml:"by_attribute"` + + // Names of new metrics to create, one for each possible value of attribute. + // map of key/values. The keys are the new metric name starting from this version, + // the values are old attribute value used in the previous version. + MetricsFromAttributes map[types10.MetricName]types11.AttributeValue `yaml:"metrics_from_attributes"` +} diff --git a/schema/v1.1/parser.go b/schema/v1.1/parser.go new file mode 100644 index 00000000000..7badc1b84fa --- /dev/null +++ b/schema/v1.1/parser.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package schema // import "go.opentelemetry.io/otel/schema/v1.1" + +import ( + "io" + "os" + + "gopkg.in/yaml.v2" + + "go.opentelemetry.io/otel/schema/internal" + "go.opentelemetry.io/otel/schema/v1.1/ast" +) + +// Major file version number that this library supports. +const supportedFormatMajor = 1 + +// Maximum minor version number that this library supports. +const supportedFormatMinor = 1 + +// ParseFile a schema file. schemaFilePath is the file path. +func ParseFile(schemaFilePath string) (*ast.Schema, error) { + file, err := os.Open(schemaFilePath) + if err != nil { + return nil, err + } + return Parse(file) +} + +// Parse a schema file. schemaFileContent is the readable content of the schema file. +func Parse(schemaFileContent io.Reader) (*ast.Schema, error) { + var ts ast.Schema + d := yaml.NewDecoder(schemaFileContent) + err := d.Decode(&ts) + if err != nil { + return nil, err + } + + err = internal.CheckFileFormatField(ts.FileFormat, supportedFormatMajor, supportedFormatMinor) + if err != nil { + return nil, err + } + + err = internal.CheckSchemaURL(ts.SchemaURL) + if err != nil { + return nil, err + } + + return &ts, nil +} diff --git a/schema/v1.1/parser_test.go b/schema/v1.1/parser_test.go new file mode 100644 index 00000000000..5f02a52b225 --- /dev/null +++ b/schema/v1.1/parser_test.go @@ -0,0 +1,174 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package schema + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + ast10 "go.opentelemetry.io/otel/schema/v1.0/ast" + types10 "go.opentelemetry.io/otel/schema/v1.0/types" + ast11 "go.opentelemetry.io/otel/schema/v1.1/ast" + types11 "go.opentelemetry.io/otel/schema/v1.1/types" +) + +func TestParseSchemaFile(t *testing.T) { + ts, err := ParseFile("testdata/valid-example.yaml") + assert.NoError(t, err) + assert.NotNil(t, ts) + assert.EqualValues( + t, &ast11.Schema{ + FileFormat: "1.1.0", + SchemaURL: "https://opentelemetry.io/schemas/1.1.0", + Versions: map[types11.TelemetryVersion]ast11.VersionDef{ + "1.0.0": {}, + + "1.1.0": { + All: ast10.Attributes{ + Changes: []ast10.AttributeChange{ + { + RenameAttributes: &ast10.AttributeMap{ + "k8s.cluster.name": "kubernetes.cluster.name", + "k8s.namespace.name": "kubernetes.namespace.name", + "k8s.node.name": "kubernetes.node.name", + "k8s.node.uid": "kubernetes.node.uid", + "k8s.pod.name": "kubernetes.pod.name", + "k8s.pod.uid": "kubernetes.pod.uid", + "k8s.container.name": "kubernetes.container.name", + "k8s.replicaset.name": "kubernetes.replicaset.name", + "k8s.replicaset.uid": "kubernetes.replicaset.uid", + "k8s.cronjob.name": "kubernetes.cronjob.name", + "k8s.cronjob.uid": "kubernetes.cronjob.uid", + "k8s.job.name": "kubernetes.job.name", + "k8s.job.uid": "kubernetes.job.uid", + "k8s.statefulset.name": "kubernetes.statefulset.name", + "k8s.statefulset.uid": "kubernetes.statefulset.uid", + "k8s.daemonset.name": "kubernetes.daemonset.name", + "k8s.daemonset.uid": "kubernetes.daemonset.uid", + "k8s.deployment.name": "kubernetes.deployment.name", + "k8s.deployment.uid": "kubernetes.deployment.uid", + "service.namespace": "service.namespace.name", + }, + }, + }, + }, + + Resources: ast10.Attributes{ + Changes: []ast10.AttributeChange{ + { + RenameAttributes: &ast10.AttributeMap{ + "telemetry.auto.version": "telemetry.auto_instr.version", + }, + }, + }, + }, + + Spans: ast10.Spans{ + Changes: []ast10.SpansChange{ + { + RenameAttributes: &ast10.AttributeMapForSpans{ + AttributeMap: ast10.AttributeMap{ + "peer.service": "peer.service.name", + }, + ApplyToSpans: []types10.SpanName{"HTTP GET"}, + }, + }, + }, + }, + + SpanEvents: ast10.SpanEvents{ + Changes: []ast10.SpanEventsChange{ + { + RenameEvents: &ast10.RenameSpanEvents{ + EventNameMap: map[string]string{ + "exception.stacktrace": "exception.stack_trace", + }, + }, + }, + { + RenameAttributes: &ast10.RenameSpanEventAttributes{ + ApplyToEvents: []types10.EventName{"exception.stack_trace"}, + AttributeMap: ast10.AttributeMap{ + "peer.service": "peer.service.name", + }, + }, + }, + }, + }, + + Logs: ast10.Logs{ + Changes: []ast10.LogsChange{ + { + RenameAttributes: &ast10.RenameAttributes{ + AttributeMap: map[string]string{ + "process.executable_name": "process.executable.name", + }, + }, + }, + }, + }, + + Metrics: ast11.Metrics{ + Changes: []ast11.MetricsChange{ + { + RenameAttributes: &ast10.AttributeMapForMetrics{ + AttributeMap: map[string]string{ + "http.status_code": "http.response_status_code", + }, + }, + }, + { + RenameMetrics: map[types10.MetricName]types10.MetricName{ + "container.cpu.usage.total": "cpu.usage.total", + "container.memory.usage.max": "memory.usage.max", + }, + }, + { + RenameAttributes: &ast10.AttributeMapForMetrics{ + ApplyToMetrics: []types10.MetricName{ + "system.cpu.utilization", + "system.memory.usage", + "system.memory.utilization", + "system.paging.usage", + }, + AttributeMap: map[string]string{ + "status": "state", + }, + }, + }, + { + Split: &ast11.SplitMetric{ + ApplyToMetric: "system.paging.operations", + ByAttribute: "direction", + MetricsFromAttributes: map[types10.MetricName]types11.AttributeValue{ + "system.paging.operations.in": "in", + "system.paging.operations.out": "out", + }, + }, + }, + }, + }, + }, + }, + }, ts, + ) +} + +func TestFailParseSchemaFile(t *testing.T) { + ts, err := ParseFile("testdata/unsupported-file-format.yaml") + assert.Error(t, err) + assert.Nil(t, ts) +} diff --git a/schema/v1.1/testdata/unsupported-file-format.yaml b/schema/v1.1/testdata/unsupported-file-format.yaml new file mode 100644 index 00000000000..47d30c024fd --- /dev/null +++ b/schema/v1.1/testdata/unsupported-file-format.yaml @@ -0,0 +1,10 @@ +file_format: 1.2.0 +schema_url: https://opentelemetry.io/schemas/1.1.0 + +versions: + 1.1.0: + all: + changes: + - rename_attributes: + k8s.cluster.name: kubernetes.cluster.name + 1.0.0: diff --git a/schema/v1.1/testdata/valid-example.yaml b/schema/v1.1/testdata/valid-example.yaml new file mode 100644 index 00000000000..138f5628cad --- /dev/null +++ b/schema/v1.1/testdata/valid-example.yaml @@ -0,0 +1,144 @@ +file_format: 1.1.0 + +schema_url: https://opentelemetry.io/schemas/1.1.0 + +versions: + 1.1.0: + # Section "all" applies to attribute names for all data types: resources, spans, logs, + # span events, metric labels. + # + # The translations in "all" section are performed first (for each particular version). + # Only after that the translations in the specific section ("resources", "traces", + # "metrics" or "logs") that corresponds to the data type are applied. + # + # The only translation possible in section "all" is renaming of attributes in + # versions. For human readability versions are listed in reverse chronological + # order, however note that the translations are applied in the order defined by + # semver ordering. + all: + changes: + - rename_attributes: + # Mapping of attribute names (label names for metrics). The key is the old name + # used prior to this version, the value is the new name starting from this version. + + # Rename k8s.* to kubernetes.* + k8s.cluster.name: kubernetes.cluster.name + k8s.namespace.name: kubernetes.namespace.name + k8s.node.name: kubernetes.node.name + k8s.node.uid: kubernetes.node.uid + k8s.pod.name: kubernetes.pod.name + k8s.pod.uid: kubernetes.pod.uid + k8s.container.name: kubernetes.container.name + k8s.replicaset.name: kubernetes.replicaset.name + k8s.replicaset.uid: kubernetes.replicaset.uid + k8s.cronjob.name: kubernetes.cronjob.name + k8s.cronjob.uid: kubernetes.cronjob.uid + k8s.job.name: kubernetes.job.name + k8s.job.uid: kubernetes.job.uid + k8s.statefulset.name: kubernetes.statefulset.name + k8s.statefulset.uid: kubernetes.statefulset.uid + k8s.daemonset.name: kubernetes.daemonset.name + k8s.daemonset.uid: kubernetes.daemonset.uid + k8s.deployment.name: kubernetes.deployment.name + k8s.deployment.uid: kubernetes.deployment.uid + + service.namespace: service.namespace.name + + # Like "all" the "resources" section may contain only attribute renaming translations. + # The only translation possible in this section is renaming of attributes in + # versions. + resources: + changes: + - rename_attributes: + # Mapping of attribute names. The key is the old name + # used prior to this version, the value is the new name starting from this version. + telemetry.auto.version: telemetry.auto_instr.version + + spans: + changes: + # Sequence of translations to apply to convert the schema from a prior version + # to this version. The order in this sequence is important. Translations are + # applied from top to bottom in the listed order. + - rename_attributes: + # Rename attributes of all spans, regardless of span name. + # The keys are the old attribute name used prior to this version, the values are + # the new attribute name starting from this version. + attribute_map: + peer.service: peer.service.name + apply_to_spans: + # apply only to spans named "HTTP GET" + - "HTTP GET" + span_events: + changes: + # Sequence of translations to apply to convert the schema from a prior version + # to this version. The order in this sequence is important. Translations are + # applied from top to bottom in the listed order. + - rename_events: + # Rename events. The keys are old event names, the values are the new event names. + name_map: {exception.stacktrace: exception.stack_trace} + + - rename_attributes: + # Rename attributes of events. + # The keys are the old attribute name used prior to this version, the values are + # the new attribute name starting from this version. + attribute_map: + peer.service: peer.service.name + + apply_to_events: + # Optional event names to apply to. If empty applies to all events. + # Conditions in apply_to_spans and apply_to_events are logical AND-ed, + # both should match for transformation to be applied. + - exception.stack_trace + + metrics: + changes: + # Sequence of translations to apply to convert the schema from a prior version + # to this version. The order in this sequence is important. Translations are + # applied from top to bottom in the listed order. + + - rename_attributes: + # Rename attributes of all metrics, regardless of metric name. + # The keys are the old attribute name used prior to this version, the values are + # the new attribute name starting from this version. + attribute_map: + http.status_code: http.response_status_code + + - rename_metrics: + # Rename metrics. The keys are old metric names, the values are the new metric names. + container.cpu.usage.total: cpu.usage.total + container.memory.usage.max: memory.usage.max + + - rename_attributes: + apply_to_metrics: + # Name of the metric to apply this rule to. If empty the rule applies to all metrics. + - system.cpu.utilization + - system.memory.usage + - system.memory.utilization + - system.paging.usage + attribute_map: + # The keys are the old attribute name used prior to this version, the values are + # the new attribute name starting from this version. + status: state + + - split: + # Rules to split a metric into several metrics using an attribute for split. + # This example rule implements the change done by + # https://github.com/open-telemetry/opentelemetry-specification/pull/2617 + # Name of old metric to split. + apply_to_metric: system.paging.operations + # Name of attribute in the old metric to use for splitting. The attribute will be + # eliminated, the new metric will not have it. + by_attribute: direction + # Names of new metrics to create, one for each possible value of the attribute. + metrics_from_attributes: + # If "direction" attribute equals "in" create a new metric called "system.paging.operations.in". + system.paging.operations.in: in + system.paging.operations.out: out + + logs: + changes: + - rename_attributes: + attribute_map: + process.executable_name: process.executable.name + + 1.0.0: diff --git a/schema/v1.1/types/types.go b/schema/v1.1/types/types.go new file mode 100644 index 00000000000..1f703f57daf --- /dev/null +++ b/schema/v1.1/types/types.go @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package types // import "go.opentelemetry.io/otel/schema/v1.1/types" + +import types10 "go.opentelemetry.io/otel/schema/v1.0/types" + +// TelemetryVersion is a version number key in the schema file (e.g. "1.7.0"). +type TelemetryVersion types10.TelemetryVersion + +// AttributeName is an attribute name string. +type AttributeName string + +// AttributeValue is an attribute value. +type AttributeValue interface{} From e99a0ac0b5397c9997449131f7efa7a19442d1bf Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 2 Aug 2022 08:02:33 -0700 Subject: [PATCH 207/886] Release v1.9.0 (#3052) * Bump versions in versions.yaml * Prepare stable-v1 for version v1.9.0 * Prepare experimental-schema for version v0.0.3 * Update changelog for release --- CHANGELOG.md | 15 +++++++++------ bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 6 +++--- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 8 ++++---- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 6 +++--- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 8 ++++---- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 6 +++--- exporters/stdout/stdoutmetric/go.mod | 6 +++--- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 6 +++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 30 files changed, 103 insertions(+), 100 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ed2b320db..c9f73af32b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,17 +8,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.9.0/0.0.3] - 2022-08-01 + ### Added -- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. - The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) +- Add support for Schema Files format 1.1.x (metric "split" transform) with the new `go.opentelemetry.io/otel/schema/v1.1` package. (#2999) - Add the `go.opentelemetry.io/otel/semconv/v1.11.0` package. The package contains semantic conventions from the `v1.11.0` version of the OpenTelemetry specification. (#3009) -- Add http.method attribute to http server metric. (#3018) +- Add the `go.opentelemetry.io/otel/semconv/v1.12.0` package. + The package contains semantic conventions from the `v1.12.0` version of the OpenTelemetry specification. (#3010) +- Add the `http.method` attribute to HTTP server metric from all `go.opentelemetry.io/otel/semconv/*` packages. (#3018) ### Fixed -- Invalid warning for context setup being deferred in OpenTracing bridge (#3029). +- Invalid warning for context setup being deferred in `go.opentelemetry.io/otel/bridge/opentracing` package. (#3029) ## [1.8.0/0.31.0] - 2022-07-08 @@ -26,7 +29,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add support for `opentracing.TextMap` format in the `Inject` and `Extract` methods of the `"go.opentelemetry.io/otel/bridge/opentracing".BridgeTracer` type. (#2911) -- Add support for Schema Files format 1.1.x (metric "split" transform). (#2999) ### Changed @@ -1889,7 +1891,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.8.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...HEAD +[1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 [1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 [1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 [0.29.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/metric/v0.29.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d648368afc1..435653777e7 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 04803b1b9a7..699392faba1 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/bridge/opencensus v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 85d322980aa..2dd7e3a935b 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.7.2 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index 6896036765c..55ca603a603 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.17 require ( - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 9d5732b2301..8e9f9ff0afc 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/jaeger v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/jaeger v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/stretchr/objx v0.4.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index d232b625866..4173fe1974a 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index e58255c7881..0daebaf17ef 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/bridge/opencensus v0.31.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -23,7 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d928ba0c644..c525ea47b5b 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 google.golang.org/grpc v1.46.2 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect go.opentelemetry.io/proto/otlp v0.18.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 102683ea744..5843a3bce83 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.17 require ( - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 13fb4a4bfc7..1d9e238a2e0 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/exporters/prometheus v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 @@ -26,8 +26,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/sdk v1.8.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/sdk v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 399bfbe6e72..5b02b99c85b 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/zipkin v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/zipkin v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 6278a44eda7..f92b4f75019 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 5a4cd191604..ffcb48b151b 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 3320deaabef..8c8226eb867 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -24,7 +24,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 30be4dcd352..6ac02fa0491 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) @@ -19,10 +19,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel v1.8.0 // indirect + go.opentelemetry.io/otel v1.9.0 // indirect go.opentelemetry.io/otel/metric v0.31.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 6cb670b5b9c..f05f2107d64 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index e1e0ada8c5b..957d022466e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/proto/otlp v0.18.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0258e3f20db..1078045a703 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 go.opentelemetry.io/proto/otlp v0.18.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3d293fcfc08..83ebe7de317 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/prometheus/client_golang v1.12.2 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -23,7 +23,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 90a3a152d7b..e2b4d6c2308 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -20,7 +20,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c3ad693c22c..2ce913ee7c9 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 2e20f5dca74..67b428a6533 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.8 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/sdk v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/go.mod b/go.mod index a60334c9081..1237d40cf6d 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel/trace v1.9.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 0b21ebfead5..5b6f1c3ad4f 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 65222e34237..9f869c2f0b6 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 - go.opentelemetry.io/otel/trace v1.8.0 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/trace v1.9.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 4d3894e23b9..480390821fd 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -13,9 +13,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.8.0 + go.opentelemetry.io/otel/sdk v1.9.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.8.0 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 5e70a8124e0..670e2864c20 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.8.0 + go.opentelemetry.io/otel v1.9.0 ) require ( diff --git a/version.go b/version.go index ddc0abb27f5..3de2c94cfe0 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.8.0" + return "1.9.0" } diff --git a/versions.yaml b/versions.yaml index 1469512be85..ec74ef51610 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.8.0 + version: v1.9.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -45,7 +45,7 @@ module-sets: - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/metric experimental-schema: - version: v0.0.2 + version: v0.0.3 modules: - go.opentelemetry.io/otel/schema bridge: From eb55e60d3bb7ba3c7630039a298605a84960cabe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Anda=20Estensen?= Date: Wed, 3 Aug 2022 23:45:05 +0200 Subject: [PATCH 208/886] Replace ioutil with io and os (#3058) --- .../thrift/lib/go/thrift/header_transport.go | 3 +-- .../thrift/lib/go/thrift/http_client.go | 3 +-- exporters/jaeger/uploader.go | 3 +-- .../otlpmetric/internal/otlpconfig/envconfig.go | 3 +-- .../otlp/otlpmetric/internal/otlpconfig/tls.go | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/client.go | 7 +++---- .../otlpmetrichttp/mock_collector_test.go | 3 +-- .../otlptrace/internal/otlpconfig/envconfig.go | 3 +-- exporters/otlp/otlptrace/otlptracehttp/client.go | 7 +++---- .../otlptracehttp/mock_collector_test.go | 3 +-- exporters/zipkin/zipkin.go | 3 +-- exporters/zipkin/zipkin_test.go | 4 ++-- handler_test.go | 16 ++++++++-------- sdk/resource/os_unix_test.go | 6 +++--- 14 files changed, 29 insertions(+), 39 deletions(-) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go index f5736df4276..6a99535a459 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go @@ -28,7 +28,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" ) // Size in bytes for 32-bit ints. @@ -374,7 +373,7 @@ func (t *THeaderTransport) ReadFrame(ctx context.Context) error { if err != nil { return err } - t.frameReader = ioutil.NopCloser(&t.frameBuffer) + t.frameReader = io.NopCloser(&t.frameBuffer) // Peek and handle the next 32 bits. buf = t.frameBuffer.Bytes()[:size32] diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go index 15015864f0f..9a2cc98cc76 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go @@ -24,7 +24,6 @@ import ( "context" "errors" "io" - "io/ioutil" "net/http" "net/url" "strconv" @@ -138,7 +137,7 @@ func (p *THttpClient) closeResponse() error { // reused. Errors are being ignored here because if the connection is invalid // and this fails for some reason, the Close() method will do any remaining // cleanup. - io.Copy(ioutil.Discard, p.response.Body) + io.Copy(io.Discard, p.response.Body) err = p.response.Body.Close() } diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index 0b9d6e14d3e..1bdb4de4f92 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -19,7 +19,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "log" "net/http" "time" @@ -308,7 +307,7 @@ func (c *collectorUploader) upload(ctx context.Context, batch *gen.Batch) error return err } - _, _ = io.Copy(ioutil.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) if err = resp.Body.Close(); err != nil { return err } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go index 44c295169e8..2576a2c75a5 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go @@ -16,7 +16,6 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "crypto/tls" - "io/ioutil" "net/url" "os" "path" @@ -29,7 +28,7 @@ import ( // DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, - ReadFile: ioutil.ReadFile, + ReadFile: os.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go b/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go index ae2b03c4473..efbe0f6f428 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go +++ b/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go @@ -18,13 +18,13 @@ import ( "crypto/tls" "crypto/x509" "errors" - "io/ioutil" + "os" ) // ReadTLSConfigFromFile reads a PEM certificate file and creates // a tls.Config that will use this certifate to verify a server certificate. func ReadTLSConfigFromFile(path string) (*tls.Config, error) { - b, err := ioutil.ReadFile(path) + b, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index dcc57ceb05f..766bcf48744 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" @@ -41,7 +40,7 @@ const contentTypeProto = "application/x-protobuf" var gzPool = sync.Pool{ New: func() interface{} { - w := gzip.NewWriter(ioutil.Discard) + w := gzip.NewWriter(io.Discard) return w }, } @@ -163,7 +162,7 @@ func (d *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou rErr = newResponseError(resp.Header) // Going to retry, drain the body to reuse the connection. - if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { + if _, err := io.Copy(io.Discard, resp.Body); err != nil { _ = resp.Body.Close() return err } @@ -223,7 +222,7 @@ func (d *client) newRequest(body []byte) (request, error) { // bodyReader returns a closure returning a new reader for buf. func bodyReader(buf []byte) func() io.ReadCloser { return func() io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader(buf)) + return io.NopCloser(bytes.NewReader(buf)) } } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go index 876f8608c3d..5776c67a016 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go @@ -21,7 +21,6 @@ import ( "crypto/tls" "fmt" "io" - "io/ioutil" "net" "net/http" "sync" @@ -149,7 +148,7 @@ func readRequest(r *http.Request) ([]byte, error) { if r.Header.Get("Content-Encoding") == "gzip" { return readGzipBody(r.Body) } - return ioutil.ReadAll(r.Body) + return io.ReadAll(r.Body) } func readGzipBody(body io.Reader) ([]byte, error) { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 2fafbcd82bf..b29f618e3de 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -16,7 +16,6 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" - "io/ioutil" "net/url" "os" "path" @@ -29,7 +28,7 @@ import ( // DefaultEnvOptionsReader is the default environments reader. var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: os.Getenv, - ReadFile: ioutil.ReadFile, + ReadFile: os.ReadFile, Namespace: "OTEL_EXPORTER_OTLP", } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 45b4b70f1ad..0c050eb2fa3 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" @@ -41,7 +40,7 @@ const contentTypeProto = "application/x-protobuf" var gzPool = sync.Pool{ New: func() interface{} { - w := gzip.NewWriter(ioutil.Discard) + w := gzip.NewWriter(io.Discard) return w }, } @@ -165,7 +164,7 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc rErr = newResponseError(resp.Header) // Going to retry, drain the body to reuse the connection. - if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil { + if _, err := io.Copy(io.Discard, resp.Body); err != nil { _ = resp.Body.Close() return err } @@ -238,7 +237,7 @@ func (d *client) MarshalLog() interface{} { // bodyReader returns a closure returning a new reader for buf. func bodyReader(buf []byte) func() io.ReadCloser { return func() io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader(buf)) + return io.NopCloser(bytes.NewReader(buf)) } } diff --git a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go index 468506466c4..895b34af4cd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go @@ -21,7 +21,6 @@ import ( "crypto/tls" "fmt" "io" - "io/ioutil" "net" "net/http" "sync" @@ -168,7 +167,7 @@ func readRequest(r *http.Request) ([]byte, error) { if r.Header.Get("Content-Encoding") == "gzip" { return readGzipBody(r.Body) } - return ioutil.ReadAll(r.Body) + return io.ReadAll(r.Body) } func readGzipBody(body io.Reader) ([]byte, error) { diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index be14ff12879..93b027a1557 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -20,7 +20,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "log" "net/http" "net/url" @@ -144,7 +143,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpa // but it is still being read because according to https://golang.org/pkg/net/http/#Response // > The default HTTP client's Transport may not reuse HTTP/1.x "keep-alive" TCP connections // > if the Body is not read to completion and closed. - _, err = io.Copy(ioutil.Discard, resp.Body) + _, err = io.Copy(io.Discard, resp.Body) if err != nil { return e.errf("failed to read response body: %v", err) } diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index bf0193c231c..16fb8bd98da 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -18,7 +18,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "log" "net" "net/http" @@ -135,7 +135,7 @@ func startMockZipkinCollector(t *testing.T) *mockZipkinCollector { } func (c *mockZipkinCollector) handler(w http.ResponseWriter, r *http.Request) { - jsonBytes, err := ioutil.ReadAll(r.Body) + jsonBytes, err := io.ReadAll(r.Body) require.NoError(c.t, err) var models []zkmodel.SpanModel err = json.Unmarshal(jsonBytes, &models) diff --git a/handler_test.go b/handler_test.go index 8a7c4301543..32906198f8c 100644 --- a/handler_test.go +++ b/handler_test.go @@ -17,7 +17,7 @@ package otel import ( "bytes" "errors" - "io/ioutil" + "io" "log" "os" "testing" @@ -129,9 +129,9 @@ func TestHandlerRace(t *testing.T) { } func BenchmarkErrorHandler(b *testing.B) { - primary := &errLogger{l: log.New(ioutil.Discard, "", 0)} - secondary := &errLogger{l: log.New(ioutil.Discard, "", 0)} - tertiary := &errLogger{l: log.New(ioutil.Discard, "", 0)} + primary := &errLogger{l: log.New(io.Discard, "", 0)} + secondary := &errLogger{l: log.New(io.Discard, "", 0)} + tertiary := &errLogger{l: log.New(io.Discard, "", 0)} globalErrorHandler.setDelegate(primary) @@ -167,7 +167,7 @@ func BenchmarkGetDefaultErrorHandler(b *testing.B) { } func BenchmarkGetDelegatedErrorHandler(b *testing.B) { - SetErrorHandler(&errLogger{l: log.New(ioutil.Discard, "", 0)}) + SetErrorHandler(&errLogger{l: log.New(io.Discard, "", 0)}) b.ReportAllocs() b.ResetTimer() @@ -180,7 +180,7 @@ func BenchmarkGetDelegatedErrorHandler(b *testing.B) { func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { globalErrorHandler.setDelegate( - &errLogger{l: log.New(ioutil.Discard, "", 0)}, + &errLogger{l: log.New(io.Discard, "", 0)}, ) eh := GetErrorHandler() @@ -197,7 +197,7 @@ func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { func BenchmarkDelegatedErrorHandlerHandle(b *testing.B) { eh := GetErrorHandler() - SetErrorHandler(&errLogger{l: log.New(ioutil.Discard, "", 0)}) + SetErrorHandler(&errLogger{l: log.New(io.Discard, "", 0)}) err := errors.New("benchmark delegated error handler handle") b.ReportAllocs() @@ -210,7 +210,7 @@ func BenchmarkDelegatedErrorHandlerHandle(b *testing.B) { } func BenchmarkSetErrorHandlerDelegation(b *testing.B) { - alt := &errLogger{l: log.New(ioutil.Discard, "", 0)} + alt := &errLogger{l: log.New(io.Discard, "", 0)} b.ReportAllocs() b.ResetTimer() diff --git a/sdk/resource/os_unix_test.go b/sdk/resource/os_unix_test.go index d6522d01dd0..6c560e454e1 100644 --- a/sdk/resource/os_unix_test.go +++ b/sdk/resource/os_unix_test.go @@ -19,7 +19,7 @@ package resource_test import ( "fmt" - "io/ioutil" + "os" "testing" "github.com/stretchr/testify/require" @@ -67,8 +67,8 @@ func TestUnameError(t *testing.T) { func TestGetFirstAvailableFile(t *testing.T) { tempDir := t.TempDir() - file1, _ := ioutil.TempFile(tempDir, "candidate_") - file2, _ := ioutil.TempFile(tempDir, "candidate_") + file1, _ := os.CreateTemp(tempDir, "candidate_") + file2, _ := os.CreateTemp(tempDir, "candidate_") filename1, filename2 := file1.Name(), file2.Name() From ff51300a2af2581f91d7427ad50d1939f8e99cdb Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Wed, 10 Aug 2022 02:31:06 +1000 Subject: [PATCH 209/886] Make several vars into consts (#3068) --- trace/tracestate.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/trace/tracestate.go b/trace/tracestate.go index 5e775ce5fbe..ca68a82e5f7 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -21,7 +21,7 @@ import ( "strings" ) -var ( +const ( maxListMembers = 32 listDelimiter = "," @@ -32,10 +32,6 @@ var ( withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}` valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]` - keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`) - valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`) - memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) - errInvalidKey errorConst = "invalid tracestate key" errInvalidValue errorConst = "invalid tracestate value" errInvalidMember errorConst = "invalid tracestate list-member" @@ -43,6 +39,12 @@ var ( errDuplicate errorConst = "duplicate list-member in tracestate" ) +var ( + keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`) + valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`) + memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) +) + type member struct { Key string Value string From 6d639e961866dd90674a3416e59841115e62628a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 10 Aug 2022 08:45:14 -0700 Subject: [PATCH 210/886] Add support for Go 1.19 (#3077) * Add support for Go 1.19 * Update CHANGELOG.md Co-authored-by: Sam Xie Co-authored-by: Sam Xie --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 5 +++++ README.md | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da3fcf1b71f..8ed8e96605a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: [1.18, 1.17] + go-version: [1.19, 1.18, 1.17] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f73af32b6..a28332f3fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Support Go 1.19. + Include compatibility testing and document support. (#3077) + ## [1.9.0/0.0.3] - 2022-08-01 ### Added diff --git a/README.md b/README.md index c87f800b948..3c1e6c1e3c9 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,19 @@ This project is tested on the following systems. | OS | Go Version | Architecture | | ------- | ---------- | ------------ | +| Ubuntu | 1.19 | amd64 | | Ubuntu | 1.18 | amd64 | | Ubuntu | 1.17 | amd64 | +| Ubuntu | 1.19 | 386 | | Ubuntu | 1.18 | 386 | | Ubuntu | 1.17 | 386 | +| MacOS | 1.19 | amd64 | | MacOS | 1.18 | amd64 | | MacOS | 1.17 | amd64 | +| Windows | 1.19 | amd64 | | Windows | 1.18 | amd64 | | Windows | 1.17 | amd64 | +| Windows | 1.19 | 386 | | Windows | 1.18 | 386 | | Windows | 1.17 | 386 | From d96e8d2912afcb0d205a80739798b9a56a7f0e70 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 10 Aug 2022 08:57:01 -0700 Subject: [PATCH 211/886] Update compatibility documentation (#3079) Remove 3 month timeline for backwards support of old versions of Go. --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3c1e6c1e3c9..4aeecb8bfe7 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,23 @@ Project versioning information and stability guarantees can be found in the ### Compatibility -OpenTelemetry-Go attempts to track the current supported versions of the -[Go language](https://golang.org/doc/devel/release#policy). The release -schedule after a new minor version of go is as follows: +OpenTelemetry-Go ensures compatibility with the current supported versions of +the [Go language](https://golang.org/doc/devel/release#policy): -- The first release or one month, which ever is sooner, will add build steps for the new go version. -- The first release after three months will remove support for the oldest go version. +> Each major Go release is supported until there are two newer major releases. +> For example, Go 1.5 was supported until the Go 1.7 release, and Go 1.6 was supported until the Go 1.8 release. -This project is tested on the following systems. +For versions of Go that are no longer supported upstream, opentelemetry-go will +stop ensuring compatibility with these versions in the following manner: + +- A minor release of opentelemetry-go will be made to add support for the new + supported release of Go. +- The following minor release of opentelemetry-go will remove compatibility + testing for the oldest (now archived upstream) version of Go. This, and + future, releases of opentelemetry-go may include features only supported by + the currently supported versions of Go. + +Currently, this project supports the following environments. | OS | Go Version | Architecture | | ------- | ---------- | ------------ | From b9adb171b08e3375fb311520043c1aca611cbfec Mon Sep 17 00:00:00 2001 From: Alan Protasio Date: Thu, 18 Aug 2022 10:49:25 -0700 Subject: [PATCH 212/886] Fix `opentracing.Bridge` where it miss identifying the spanKind (#3096) * Fix opentracing.Bridge where it was not identifying the spanKinf correctly * fix test * changelog * Keeping backward comppatibillity * Update CHANGELOG.md Co-authored-by: Anthony Mirabella * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Chester Cheung --- CHANGELOG.md | 4 +++ bridge/opentracing/bridge.go | 22 +++++++++------- bridge/opentracing/bridge_test.go | 43 +++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a28332f3fbc..3dd5926bfda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support Go 1.19. Include compatibility testing and document support. (#3077) +### Fixed + +- Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) + ## [1.9.0/0.0.3] - 2022-08-01 ### Added diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 2922b9869d5..967aaa20d4b 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -502,17 +502,19 @@ func otTagsToOTelAttributesKindAndError(tags map[string]interface{}) ([]attribut for k, v := range tags { switch k { case string(otext.SpanKind): + sk := v if s, ok := v.(string); ok { - switch strings.ToLower(s) { - case "client": - kind = trace.SpanKindClient - case "server": - kind = trace.SpanKindServer - case "producer": - kind = trace.SpanKindProducer - case "consumer": - kind = trace.SpanKindConsumer - } + sk = otext.SpanKindEnum(strings.ToLower(s)) + } + switch sk { + case otext.SpanKindRPCClientEnum: + kind = trace.SpanKindClient + case otext.SpanKindRPCServerEnum: + kind = trace.SpanKindServer + case otext.SpanKindProducerEnum: + kind = trace.SpanKindProducer + case otext.SpanKindConsumerEnum: + kind = trace.SpanKindConsumer } case string(otext.Error): if b, ok := v.(bool); ok && b { diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index a64d6f73919..7286bd77823 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -22,9 +22,11 @@ import ( "testing" ot "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/bridge/opentracing/internal" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -425,3 +427,44 @@ func TestBridgeTracer_StartSpan(t *testing.T) { }) } } + +func Test_otTagsToOTelAttributesKindAndError(t *testing.T) { + tracer := internal.NewMockTracer() + sc := &bridgeSpanContext{} + + testCases := []struct { + name string + opt []ot.StartSpanOption + expected trace.SpanKind + }{ + { + name: "client", + opt: []ot.StartSpanOption{ext.SpanKindRPCClient}, + expected: trace.SpanKindClient, + }, + { + name: "server", + opt: []ot.StartSpanOption{ext.RPCServerOption(sc)}, + expected: trace.SpanKindServer, + }, + { + name: "client string", + opt: []ot.StartSpanOption{ot.Tag{Key: "span.kind", Value: "client"}}, + expected: trace.SpanKindClient, + }, + { + name: "server string", + opt: []ot.StartSpanOption{ot.Tag{Key: "span.kind", Value: "server"}}, + expected: trace.SpanKindServer, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + b, _ := NewTracerPair(tracer) + + s := b.StartSpan(tc.name, tc.opt...) + assert.Equal(t, s.(*bridgeSpan).otelSpan.(*internal.MockSpan).SpanKind, tc.expected) + }) + } +} From 8c3a85a5bee7bd2b30146937400436960e1e3e2a Mon Sep 17 00:00:00 2001 From: Dafei Liu Date: Tue, 23 Aug 2022 00:47:11 +0800 Subject: [PATCH 213/886] replace `required` by `requirementlevel` (#3103) --- semconv/template.j2 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/semconv/template.j2 b/semconv/template.j2 index b9ce5c591f0..1d51bddb2bf 100644 --- a/semconv/template.j2 +++ b/semconv/template.j2 @@ -16,12 +16,16 @@ Type: {{ attr.attr_type }} {%- else %} Type: Enum {%- endif %} -{%- if attr.required == Required.ALWAYS %} -Required: Always -{%- elif attr.required == Required.CONDITIONAL %} -Required: {{ attr.required_msg }} +{%- if attr.requirement_level == RequirementLevel.REQUIRED %} +RequirementLevel: Required +{%- elif attr.requirement_level == RequirementLevel.CONDITIONALLY_REQUIRED %} +RequirementLevel: ConditionallyRequired + {%- if attr.requirement_level_msg != "" %} ({{ attr.requirement_level_msg }}){%- endif %} +{%- elif attr.requirement_level == RequirementLevel.RECOMMENDED %} +RequirementLevel: Recommended + {%- if attr.requirement_level_msg != "" %} ({{ attr.requirement_level_msg }}){%- endif %} {%- else %} -Required: No +RequirementLevel: Optional {%- endif %} {{ attr.stability | replace("Level.", ": ") | capitalize }} {%- if attr.deprecated != None %} From 09bf345912e7d7d8a1a2846c82350b042d3f0185 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Wed, 24 Aug 2022 11:09:37 -0700 Subject: [PATCH 214/886] Change the inclusivity of exponential histogram bounds (#2982) * Use lower-inclusive boundaries * make exponent and logarithm more symmetric Co-authored-by: Anthony Mirabella Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 5 +- .../aggregator/exponential/benchmark_test.go | 67 ++++++++ .../exponential/mapping/exponent/exponent.go | 70 ++++---- .../mapping/exponent/exponent_test.go | 149 +++++++++++------- .../mapping/{exponent => internal}/float64.go | 21 +-- .../mapping/internal/float64_test.go | 47 ++++++ .../mapping/logarithm/logarithm.go | 81 ++++++---- .../mapping/logarithm/logarithm_test.go | 81 ++++------ 8 files changed, 341 insertions(+), 180 deletions(-) create mode 100644 sdk/metric/aggregator/exponential/benchmark_test.go rename sdk/metric/aggregator/exponential/mapping/{exponent => internal}/float64.go (78%) create mode 100644 sdk/metric/aggregator/exponential/mapping/internal/float64_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dd5926bfda..0fd563b84e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support Go 1.19. Include compatibility testing and document support. (#3077) -### Fixed +### Changed - Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) +- The exponential histogram mapping functions have been updated with + exact upper-inclusive boundary support following the [corresponding + specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) ## [1.9.0/0.0.3] - 2022-08-01 diff --git a/sdk/metric/aggregator/exponential/benchmark_test.go b/sdk/metric/aggregator/exponential/benchmark_test.go new file mode 100644 index 00000000000..fd0ce7e41aa --- /dev/null +++ b/sdk/metric/aggregator/exponential/benchmark_test.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exponential + +import ( + "fmt" + "math/rand" + "testing" + + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/logarithm" +) + +func benchmarkMapping(b *testing.B, name string, mapper mapping.Mapping) { + b.Run(fmt.Sprintf("mapping_%s", name), func(b *testing.B) { + src := rand.New(rand.NewSource(54979)) + for i := 0; i < b.N; i++ { + _ = mapper.MapToIndex(1 + src.Float64()) + } + }) +} + +func benchmarkBoundary(b *testing.B, name string, mapper mapping.Mapping) { + b.Run(fmt.Sprintf("boundary_%s", name), func(b *testing.B) { + src := rand.New(rand.NewSource(54979)) + for i := 0; i < b.N; i++ { + _, _ = mapper.LowerBoundary(int32(src.Int63())) + } + }) +} + +// An earlier draft of this benchmark included a lookup-table based +// implementation: +// https://github.com/open-telemetry/opentelemetry-go-contrib/pull/1353 +// That mapping function uses O(2^scale) extra space and falls +// somewhere between the exponent and logarithm methods compared here. +// In the test, lookuptable was 40% faster than logarithm, which did +// not justify the significant extra complexity. + +// Benchmarks the MapToIndex function. +func BenchmarkMapping(b *testing.B) { + em, _ := exponent.NewMapping(-1) + lm, _ := logarithm.NewMapping(1) + benchmarkMapping(b, "exponent", em) + benchmarkMapping(b, "logarithm", lm) +} + +// Benchmarks the LowerBoundary function. +func BenchmarkReverseMapping(b *testing.B) { + em, _ := exponent.NewMapping(-1) + lm, _ := logarithm.NewMapping(1) + benchmarkBoundary(b, "exponent", em) + benchmarkBoundary(b, "logarithm", lm) +} diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go b/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go index 93dff7ef007..3daec4b5a18 100644 --- a/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go +++ b/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go @@ -19,6 +19,7 @@ import ( "math" "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" ) const ( @@ -63,52 +64,61 @@ func NewMapping(scale int32) (mapping.Mapping, error) { return &prebuiltMappings[scale-MinScale], nil } +// minNormalLowerBoundaryIndex is the largest index such that +// base**index is <= MinValue. A histogram bucket with this index +// covers the range (base**index, base**(index+1)], including +// MinValue. +func (e *exponentMapping) minNormalLowerBoundaryIndex() int32 { + idx := int32(internal.MinNormalExponent) >> e.shift + if e.shift < 2 { + // For scales -1 and 0 the minimum value 2**-1022 + // is a power-of-two multiple, meaning it belongs + // to the index one less. + idx-- + } + return idx +} + +// maxNormalLowerBoundaryIndex is the index such that base**index +// equals the largest representable boundary. A histogram bucket with this +// index covers the range (0x1p+1024/base, 0x1p+1024], which includes +// MaxValue; note that this bucket is incomplete, since the upper +// boundary cannot be represented. One greater than this index +// corresponds with the bucket containing values > 0x1p1024. +func (e *exponentMapping) maxNormalLowerBoundaryIndex() int32 { + return int32(internal.MaxNormalExponent) >> e.shift +} + // MapToIndex implements mapping.Mapping. func (e *exponentMapping) MapToIndex(value float64) int32 { // Note: we can assume not a 0, Inf, or NaN; positive sign bit. + if value < internal.MinValue { + return e.minNormalLowerBoundaryIndex() + } - // Note: bit-shifting does the right thing for negative - // exponents, e.g., -1 >> 1 == -1. - return getBase2(value) >> e.shift -} + // Extract the raw exponent. + rawExp := internal.GetNormalBase2(value) -func (e *exponentMapping) minIndex() int32 { - return int32(MinNormalExponent) >> e.shift -} + // In case the value is an exact power of two, compute a + // correction of -1: + correction := int32((internal.GetSignificand(value) - 1) >> internal.SignificandWidth) -func (e *exponentMapping) maxIndex() int32 { - return int32(MaxNormalExponent) >> e.shift + // Note: bit-shifting does the right thing for negative + // exponents, e.g., -1 >> 1 == -1. + return (rawExp + correction) >> e.shift } // LowerBoundary implements mapping.Mapping. func (e *exponentMapping) LowerBoundary(index int32) (float64, error) { - if min := e.minIndex(); index < min { + if min := e.minNormalLowerBoundaryIndex(); index < min { return 0, mapping.ErrUnderflow } - if max := e.maxIndex(); index > max { + if max := e.maxNormalLowerBoundaryIndex(); index > max { return 0, mapping.ErrOverflow } - unbiased := int64(index << e.shift) - - // Note: although the mapping function rounds subnormal values - // up to the smallest normal value, there are still buckets - // that may be filled that start at subnormal values. The - // following code handles this correctly. It's equivalent to and - // faster than math.Ldexp(1, int(unbiased)). - if unbiased < int64(MinNormalExponent) { - subnormal := uint64(1 << SignificandWidth) - for unbiased < int64(MinNormalExponent) { - unbiased++ - subnormal >>= 1 - } - return math.Float64frombits(subnormal), nil - } - exponent := unbiased + ExponentBias - - bits := uint64(exponent << SignificandWidth) - return math.Float64frombits(bits), nil + return math.Ldexp(1, int(index<> -scale + if MinNormalExponent%(int32(1)<<-scale) == 0 { + correctMinIndex-- + } + require.Greater(t, correctMinIndex, int64(math.MinInt32)) require.Equal(t, int32(correctMinIndex), minIndex) @@ -295,16 +317,25 @@ func TestExponentIndexMin(t *testing.T) { require.Greater(t, roundedBoundary(scale, int32(correctMinIndex+1)), boundary) // Subnormal values map to the min index: - require.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/2)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/3)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/100)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1050)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1073)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1.1p-1073)) + require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1074)) // One smaller index will underflow. _, err = m.LowerBoundary(minIndex - 1) require.Equal(t, err, mapping.ErrUnderflow) + + // Next value above MinValue (not a power of two). + minPlus1Index := m.MapToIndex(math.Nextafter(MinValue, math.Inf(+1))) + + // The following boundary equation always works for + // non-powers of two (same as correctMinIndex before its + // power-of-two correction, above). + correctMinPlus1Index := int64(MinNormalExponent) >> -scale + require.Equal(t, int32(correctMinPlus1Index), minPlus1Index) } } diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go b/sdk/metric/aggregator/exponential/mapping/internal/float64.go similarity index 78% rename from sdk/metric/aggregator/exponential/mapping/exponent/float64.go rename to sdk/metric/aggregator/exponential/mapping/internal/float64.go index 41fd45025ba..6bac47fa698 100644 --- a/sdk/metric/aggregator/exponential/mapping/exponent/float64.go +++ b/sdk/metric/aggregator/exponential/mapping/internal/float64.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package exponent // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" +package internal // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" import "math" @@ -55,15 +55,18 @@ const ( MaxValue = math.MaxFloat64 ) -// getBase2 extracts the normalized base-2 fractional exponent. Like -// math.Frexp(), rounds subnormal values up to the minimum normal -// value. Unlike Frexp(), this returns k for the equation f x 2**k -// where f is in the range [1, 2). -func getBase2(value float64) int32 { - if value <= MinValue { - return MinNormalExponent - } +// GetNormalBase2 extracts the normalized base-2 fractional exponent. +// Unlike Frexp(), this returns k for the equation f x 2**k where f is +// in the range [1, 2). Note that this function is not called for +// subnormal numbers. +func GetNormalBase2(value float64) int32 { rawBits := math.Float64bits(value) rawExponent := (int64(rawBits) & ExponentMask) >> SignificandWidth return int32(rawExponent - ExponentBias) } + +// GetSignificand returns the 52 bit (unsigned) significand as a +// signed value. +func GetSignificand(value float64) int64 { + return int64(math.Float64bits(value)) & SignificandMask +} diff --git a/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go b/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go new file mode 100644 index 00000000000..7c86391744c --- /dev/null +++ b/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +// Tests that GetNormalBase2 returns the base-2 exponent as documented, unlike +// math.Frexp. +func TestGetNormalBase2(t *testing.T) { + require.Equal(t, int32(-1022), MinNormalExponent) + require.Equal(t, int32(+1023), MaxNormalExponent) + + require.Equal(t, MaxNormalExponent, GetNormalBase2(0x1p+1023)) + require.Equal(t, int32(1022), GetNormalBase2(0x1p+1022)) + + require.Equal(t, int32(0), GetNormalBase2(1)) + + require.Equal(t, int32(-1021), GetNormalBase2(0x1p-1021)) + require.Equal(t, int32(-1022), GetNormalBase2(0x1p-1022)) + + // Subnormals below this point + require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1023)) + require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1024)) + require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1025)) + require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1074)) +} + +func TestGetSignificand(t *testing.T) { + // The number 1.5 has a single most-significant bit set, i.e., 1<<51. + require.Equal(t, int64(1)<<(SignificandWidth-1), GetSignificand(1.5)) +} diff --git a/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go b/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go index 223c93d16a9..28ab8436e2b 100644 --- a/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go +++ b/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go @@ -20,7 +20,7 @@ import ( "sync" "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" + "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" ) const ( @@ -44,33 +44,20 @@ const ( // point uses a signed 32 bit integer for indices. MaxScale int32 = 20 - // MaxValue is the largest normal number. - MaxValue = math.MaxFloat64 - // MinValue is the smallest normal number. - MinValue = 0x1p-1022 + MinValue = internal.MinValue + + // MaxValue is the largest normal number. + MaxValue = internal.MaxValue ) // logarithmMapping contains the constants used to implement the -// exponential mapping function for a particular scale > 0. Note that -// these structs are compiled in using code generated by the -// ./cmd/prebuild package, this way no allocations are required as the -// aggregators switch between mapping functions and the two mapping -// functions are kept separate. -// -// Note that some of these fields could be calculated easily at -// runtime, but they are compiled in to avoid those operations at -// runtime (e.g., calls to math.Ldexp(math.Log2E, scale) for every -// measurement). +// exponential mapping function for a particular scale > 0. type logarithmMapping struct { - // scale is between MinScale and MaxScale + // scale is between MinScale and MaxScale. The exponential + // base is defined as 2**(2**(-scale)). scale int32 - // minIndex is the index of MinValue - minIndex int32 - // maxIndex is the index of MaxValue - maxIndex int32 - // scaleFactor is used and computed as follows: // index = log(value) / log(base) // = log(value) / log(2^(2^-scale)) @@ -122,8 +109,6 @@ func NewMapping(scale int32) (mapping.Mapping, error) { } l := &logarithmMapping{ scale: scale, - maxIndex: int32((int64(exponent.MaxNormalExponent+1) << scale) - 1), - minIndex: int32(int64(exponent.MinNormalExponent) << scale), scaleFactor: math.Ldexp(math.Log2E, int(scale)), inverseFactor: math.Ldexp(math.Ln2, int(-scale)), } @@ -131,34 +116,68 @@ func NewMapping(scale int32) (mapping.Mapping, error) { return l, nil } +// minNormalLowerBoundaryIndex is the index such that base**index equals +// MinValue. A histogram bucket with this index covers the range +// (MinValue, MinValue*base]. One less than this index corresponds +// with the bucket containing values <= MinValue. +func (l *logarithmMapping) minNormalLowerBoundaryIndex() int32 { + return int32(internal.MinNormalExponent << l.scale) +} + +// maxNormalLowerBoundaryIndex is the index such that base**index equals the +// greatest representable lower boundary. A histogram bucket with this +// index covers the range (0x1p+1024/base, 0x1p+1024], which includes +// MaxValue; note that this bucket is incomplete, since the upper +// boundary cannot be represented. One greater than this index +// corresponds with the bucket containing values > 0x1p1024. +func (l *logarithmMapping) maxNormalLowerBoundaryIndex() int32 { + return (int32(internal.MaxNormalExponent+1) << l.scale) - 1 +} + // MapToIndex implements mapping.Mapping. func (l *logarithmMapping) MapToIndex(value float64) int32 { // Note: we can assume not a 0, Inf, or NaN; positive sign bit. if value <= MinValue { - return l.minIndex + return l.minNormalLowerBoundaryIndex() - 1 } - // Use Floor() to round toward 0. + + // Exact power-of-two correctness: an optional special case. + if internal.GetSignificand(value) == 0 { + exp := internal.GetNormalBase2(value) + return (exp << l.scale) - 1 + } + + // Non-power of two cases. Use Floor(x) to round the scaled + // logarithm. We could use Ceil(x)-1 to achieve the same + // result, though Ceil() is typically defined as -Floor(-x) + // and typically not performed in hardware, so this is likely + // less code. index := int32(math.Floor(math.Log(value) * l.scaleFactor)) - if index > l.maxIndex { - return l.maxIndex + if max := l.maxNormalLowerBoundaryIndex(); index >= max { + return max } return index } // LowerBoundary implements mapping.Mapping. func (l *logarithmMapping) LowerBoundary(index int32) (float64, error) { - if index >= l.maxIndex { - if index == l.maxIndex { + if max := l.maxNormalLowerBoundaryIndex(); index >= max { + if index == max { // Note that the equation on the last line of this // function returns +Inf. Use the alternate equation. return 2 * math.Exp(float64(index-(int32(1)< Date: Wed, 24 Aug 2022 21:42:28 -0500 Subject: [PATCH 215/886] Update golangci-lint to v1.48.0 (#3105) * Update golangci-lint to v1.48.0 Co-authored-by: Chester Cheung --- .github/workflows/ci.yml | 2 +- attribute/set_test.go | 2 +- exporters/jaeger/agent_test.go | 1 + .../jaeger/reconnecting_udp_client_test.go | 1 + .../otlptrace/otlptracegrpc/client_test.go | 1 + internal/tools/go.mod | 103 ++--- internal/tools/go.sum | 403 +++++++----------- metric/example_test.go | 2 +- metric/internal/global/instruments.go | 2 +- .../aggregator/lastvalue/lastvalue_test.go | 2 +- sdk/metric/controller/basic/controller.go | 12 +- sdk/metric/doc.go | 5 +- sdk/metric/number/number.go | 7 +- sdk/metric/processor/processortest/test.go | 12 +- sdk/metric/processor/reducer/doc.go | 56 +-- sdk/metric/refcount_mapped.go | 5 +- sdk/trace/provider.go | 16 +- sdk/trace/sampling.go | 1 + sdk/trace/sampling_test.go | 7 +- trace.go | 7 +- trace/trace.go | 20 +- 21 files changed, 283 insertions(+), 384 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ed8e96605a..d199d8bc131 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: # Path to where test results will be saved. TEST_RESULTS: /tmp/test-results # Default minimum version of Go to support. - DEFAULT_GO_VERSION: 1.17 + DEFAULT_GO_VERSION: 1.18 jobs: lint: runs-on: ubuntu-latest diff --git a/attribute/set_test.go b/attribute/set_test.go index 179a9006a21..0dd3bf12124 100644 --- a/attribute/set_test.go +++ b/attribute/set_test.go @@ -185,6 +185,6 @@ func TestLookup(t *testing.T) { require.True(t, has) require.Equal(t, int64(1), value.AsInt64()) - value, has = set.Value("D") + _, has = set.Value("D") require.False(t, has) } diff --git a/exporters/jaeger/agent_test.go b/exporters/jaeger/agent_test.go index 62de111dae5..fdcd9bb74d6 100644 --- a/exporters/jaeger/agent_test.go +++ b/exporters/jaeger/agent_test.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package jaeger import ( diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go index ba4b6cbef31..43bfe512493 100644 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ b/exporters/jaeger/reconnecting_udp_client_test.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package jaeger import ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 8f62e393c46..84e7da801b1 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. + package otlptracegrpc_test import ( diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5e4fbae7614..1762c2f3db2 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.17 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb + github.com/golangci/golangci-lint v1.48.0 github.com/itchyny/gojq v0.12.7 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -13,22 +13,24 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c - golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 - golang.org/x/tools v0.1.10 + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 + golang.org/x/tools v0.1.12 ) require ( 4d63.com/gochecknoglobals v0.1.0 // indirect - github.com/Antonboom/errname v0.1.5 // indirect - github.com/Antonboom/nilnil v0.1.0 // indirect - github.com/BurntSushi/toml v1.0.0 // indirect + github.com/Antonboom/errname v0.1.7 // indirect + github.com/Antonboom/nilnil v0.1.1 // indirect + github.com/BurntSushi/toml v1.2.0 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.4.16 // indirect github.com/OpenPeeDeeP/depguard v1.1.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect + github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.3.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -40,8 +42,8 @@ require ( github.com/butuzov/ireturn v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/charithe/durationcheck v0.0.9 // indirect - github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect - github.com/daixiang0/gci v0.3.3 // indirect + github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect + github.com/daixiang0/gci v0.6.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.12.0 // indirect @@ -49,9 +51,10 @@ require ( github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fatih/structtag v1.2.0 // indirect + github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect - github.com/fzipp/gocyclo v0.4.0 // indirect - github.com/go-critic/go-critic v0.6.2 // indirect + github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/go-critic/go-critic v0.6.3 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.3.1 // indirect github.com/go-git/go-git/v5 v5.4.2 // indirect @@ -68,12 +71,12 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect - github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect + github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect github.com/golangci/misspell v0.3.5 // indirect - github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2 // indirect + github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.8 // indirect github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect @@ -83,7 +86,7 @@ require ( github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-version v1.4.0 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/imdario/mergo v0.3.12 // indirect @@ -95,98 +98,102 @@ require ( github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect - github.com/kisielk/errcheck v1.6.0 // indirect + github.com/kisielk/errcheck v1.6.2 // indirect github.com/kisielk/gotool v1.0.0 // indirect - github.com/kulti/thelper v0.5.1 // indirect - github.com/kunwardeep/paralleltest v1.0.3 // indirect + github.com/kulti/thelper v0.6.3 // indirect + github.com/kunwardeep/paralleltest v1.0.6 // indirect github.com/kyoh86/exportloopref v0.1.8 // indirect - github.com/ldez/gomoddirectives v0.2.2 // indirect + github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.3.1 // indirect github.com/leonklingele/grouper v1.1.0 // indirect - github.com/lufeee/execinquery v1.0.0 // indirect + github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.6 // indirect - github.com/maratori/testpackage v1.0.1 // indirect + github.com/maratori/testpackage v1.1.0 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.1.4 // indirect + github.com/mgechev/revive v1.2.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.7.11 // indirect - github.com/nishanths/predeclared v0.2.1 // indirect + github.com/nishanths/exhaustive v0.8.1 // indirect + github.com/nishanths/predeclared v0.2.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.7.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.1 // indirect + github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b // indirect - github.com/prometheus/client_golang v1.7.1 // indirect + github.com/polyfloyd/go-errorlint v1.0.0 // indirect + github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.10.0 // indirect - github.com/prometheus/procfs v0.6.0 // indirect - github.com/quasilyte/go-ruleguard v0.3.15 // indirect - github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 // indirect + github.com/prometheus/common v0.32.1 // indirect + github.com/prometheus/procfs v0.7.3 // indirect + github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a // indirect + github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect - github.com/ryancurrah/gomodguard v1.2.3 // indirect + github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect + github.com/ryancurrah/gomodguard v1.2.4 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect - github.com/securego/gosec/v2 v2.10.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.8.0 // indirect + github.com/securego/gosec/v2 v2.12.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/sirupsen/logrus v1.8.1 // indirect + github.com/sirupsen/logrus v1.9.0 // indirect github.com/sivchari/containedctx v1.0.2 // indirect - github.com/sivchari/tenv v1.4.7 // indirect + github.com/sivchari/nosnakecase v1.7.0 // indirect + github.com/sivchari/tenv v1.7.0 // indirect github.com/sonatard/noctx v0.0.1 // indirect github.com/sourcegraph/go-diff v0.6.1 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.4.0 // indirect + github.com/spf13/cobra v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.12.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect + github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.4.0 // indirect - github.com/stretchr/testify v1.7.5 // indirect - github.com/subosito/gotenv v1.3.0 // indirect + github.com/stretchr/testify v1.8.0 // indirect + github.com/subosito/gotenv v1.4.0 // indirect github.com/sylvia7788/contextcheck v1.0.4 // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect - github.com/tomarrell/wrapcheck/v2 v2.6.0 // indirect + github.com/tomarrell/wrapcheck/v2 v2.6.2 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.0 // indirect github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect - github.com/uudashr/gocognit v1.0.5 // indirect + github.com/uudashr/gocognit v1.0.6 // indirect github.com/xanzy/ssh-agent v0.3.0 // indirect github.com/yagipy/maintidx v1.0.0 // indirect - github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 // indirect - gitlab.com/bosi/decorder v0.2.1 // indirect + github.com/yeya24/promlinter v0.2.0 // indirect + gitlab.com/bosi/decorder v0.2.3 // indirect go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect google.golang.org/protobuf v1.28.0 // indirect - gopkg.in/ini.v1 v1.66.4 // indirect + gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.2.2 // indirect + honnef.co/go/tools v0.3.3 // indirect mvdan.cc/gofumpt v0.3.1 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 // indirect + mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 000a2e2f248..0c7c6ee429d 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -21,14 +21,6 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -37,7 +29,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -52,16 +43,19 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Antonboom/errname v0.1.5 h1:IM+A/gz0pDhKmlt5KSNTVAvfLMb+65RxavBXpRtCUEg= -github.com/Antonboom/errname v0.1.5/go.mod h1:DugbBstvPFQbv/5uLcRRzfrNqKE9tVdVCqWCLp6Cifo= -github.com/Antonboom/nilnil v0.1.0 h1:DLDavmg0a6G/F4Lt9t7Enrbgb3Oph6LnDE6YVsmTt74= -github.com/Antonboom/nilnil v0.1.0/go.mod h1:PhHLvRPSghY5Y7mX4TW+BHZQYo1A8flE5H20D3IPZBo= +github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= +github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= +github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= +github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU= -github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= +github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= +github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2 h1:DGdS4FlsdM6OkluXOhgkvwx05ZjD3Idm9WqtYnOmSuY= +github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2/go.mod h1:xj0D2jwLdp6tOKLheyZCsfL0nz8DaicmJxSwj3VcHtY= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= @@ -71,7 +65,6 @@ github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.1.0 h1:pjK9nLPS1FwQYGGpPxoMYpe7qACHOhAWQMQzV71i49o= github.com/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= @@ -82,18 +75,16 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= +github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= +github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= @@ -123,14 +114,13 @@ github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92 github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af h1:spmv8nSH9h5oCQf40jt/ufBCt9j0/58u4G+rkeMqXGI= -github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3//PWVzTeCezG2b9IRn6myJxJSr4TD/xo6ojU= +github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 h1:tFXjAxje9thrTF4h57Ckik+scJjTWdwAtZqZPtOT48M= +github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4/go.mod h1:W8EnPSQ8Nv4fUjc/v1/8tHFqhuOJXnRub0dTfuAQktU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -139,7 +129,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -147,17 +136,17 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.3.3 h1:55xJKH7Gl9Vk6oQ1cMkwrDWjAkT1D+D1G9kNmRcAIY4= -github.com/daixiang0/gci v0.3.3/go.mod h1:1Xr2bxnQbDxCqqulUOv8qpGqkgRw9RSCGGjEC2LjF8o= +github.com/daixiang0/gci v0.6.2 h1:TXCP5RqjE/UupXO+p33MEhqdv7QxjKGw5MVkt9ATiMs= +github.com/daixiang0/gci v0.6.2/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -174,8 +163,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= @@ -183,27 +170,27 @@ github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcH github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= +github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= -github.com/fzipp/gocyclo v0.4.0 h1:IykTnjwh2YLyYkGa0y92iTTEQcnyAz0r9zOo15EbJ7k= -github.com/fzipp/gocyclo v0.4.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= +github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-critic/go-critic v0.6.2 h1:L5SDut1N4ZfsWZY0sH4DCrsHLHnhuuWak2wa165t9gs= -github.com/go-critic/go-critic v0.6.2/go.mod h1:td1s27kfmLpe5G/DPjlnFI7o1UCzePptwU7Az0V5iCM= +github.com/go-critic/go-critic v0.6.3 h1:abibh5XYBTASawfTQ0rA7dVtQT+6KzpGqb/J+DxRDaw= +github.com/go-critic/go-critic v0.6.3/go.mod h1:c6b3ZP1MQ7o6lPR7Rv3lEf7pYQUmAcx8ABHgdZCQt/k= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -218,8 +205,10 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -246,7 +235,6 @@ github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4 github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -267,8 +255,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -285,28 +271,26 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= -github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= +github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= +github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb h1:ktIXLbKYARKYRdZD8CCvv8BNbobc3L90me+OrZFsiKY= -github.com/golangci/golangci-lint v1.45.3-0.20220330010013-d2ccc6d2bbbb/go.mod h1:ZRpeoDtir4sFJNtpjgyoQmWFxfVRwRO4tMh3LJMoiug= +github.com/golangci/golangci-lint v1.48.0 h1:hRiBNk9iRqdAKMa06ntfEiLyza1/3IE9rHLNJaek4a8= +github.com/golangci/golangci-lint v1.48.0/go.mod h1:5N+oxduCho+7yuccW69upg/O7cxjfR/d+IQeiNxGmKM= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= github.com/golangci/misspell v0.3.5 h1:pLzmVdl3VxTOncgzHcvLOKirdvcx/TydsClUQXTehjo= github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= -github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2 h1:SgM7GDZTxtTTQPU84heOxy34iG5Du7F2jcoZnvp+fXI= -github.com/golangci/revgrep v0.0.0-20210930125155-c22e5001d4f2/go.mod h1:LK+zW4MpyytAWQRz0M4xnzEk50lSvqDQKfx304apFkY= +github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= +github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -321,7 +305,6 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -331,7 +314,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -343,12 +325,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEivX+9mPgw= github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -358,9 +335,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.0/go.mod h1:43aQb+Zerm/BWh2GnrgOQm7ffz7tvQXEKV6BFMl7wAo= +github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= @@ -371,7 +347,6 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= -github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0fRgmo1UgHDcbw7F5idXu0= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= @@ -390,36 +365,18 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaD github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4= -github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= +github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= @@ -455,14 +412,17 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= @@ -471,12 +431,13 @@ github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.6.0 h1:YTDO4pNy7AUN/021p+JGHycQyYNIyMoenM1YDVK6RlY= -github.com/kisielk/errcheck v1.6.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/errcheck v1.6.2 h1:uGQ9xI8/pgc9iOoCe7kWQgRE6SBTrCGmTSf0LrEtY7c= +github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -487,15 +448,15 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kulti/thelper v0.5.1 h1:Uf4CUekH0OvzQTFPrWkstJvXgm6pnNEtQu3HiqEkpB0= -github.com/kulti/thelper v0.5.1/go.mod h1:vMu2Cizjy/grP+jmsvOFDx1kYP6+PD1lqg4Yu5exl2U= -github.com/kunwardeep/paralleltest v1.0.3 h1:UdKIkImEAXjR1chUWLn+PNXqWUGs//7tzMeWuP7NhmI= -github.com/kunwardeep/paralleltest v1.0.3/go.mod h1:vLydzomDFpk7yu5UX02RmP0H8QfRPOV/oFhWN85Mjb4= +github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= +github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= +github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= +github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M= github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= -github.com/ldez/gomoddirectives v0.2.2 h1:p9/sXuNFArS2RLc+UpYZSI4KQwGMEDWC/LbtF5OPFVg= -github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= +github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= +github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKiM= github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= @@ -504,16 +465,14 @@ github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lufeee/execinquery v1.0.0 h1:1XUTuLIVPDlFvUU3LXmmZwHDsolsxXnY67lzhpeqe0I= -github.com/lufeee/execinquery v1.0.0/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= +github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= -github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= +github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= +github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= @@ -521,16 +480,13 @@ github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= @@ -545,21 +501,15 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.1.4 h1:sZOjY6GU35Kr9jKa/wsKSHgrFz8eASIB5i3tqWZMp0A= -github.com/mgechev/revive v1.1.4/go.mod h1:ZZq2bmyssGh8MSPz3VVziqRNIMYTJXzP8MUKG90vZ9A= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/mgechev/revive v1.2.1 h1:GjFml7ZsoR0IrQ2E2YIvWFNS5GPDV7xNwvA5GM1HZC4= +github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -568,12 +518,14 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= @@ -581,11 +533,11 @@ github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4N github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.7.11 h1:xV/WU3Vdwh5BUH4N06JNUznb6d5zhRPOnlgCrpNYNKA= -github.com/nishanths/exhaustive v0.7.11/go.mod h1:gX+MP7DWMKJmNa1HfMozK+u04hQd3na9i0hyqf3/dOI= +github.com/nishanths/exhaustive v0.8.1 h1:0QKNascWv9qIHY7zRoZSxeRr6kuk5aAT3YXLTiDmjTo= +github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= -github.com/nishanths/predeclared v0.2.1 h1:1TXtjmy4f3YCFjTxRd8zcFHOmoUir+gp0ESzjFzG2sw= -github.com/nishanths/predeclared v0.2.1/go.mod h1:HvkGJcA3naj4lOwnFXFDkFxVtSqQMB9sbB1usJ+xjQE= +github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= +github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= @@ -598,14 +550,14 @@ github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.3 h1:e/3Cwtogj0HA+25nMP1jCMDIf8RtRYbGwGGuBIFztkc= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= -github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= +github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= @@ -616,81 +568,79 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI= github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= -github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= +github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b h1:/BDyEJWLnDUYKGWdlNx/82qSaVu2bUok/EvPUtIGuvw= -github.com/polyfloyd/go-errorlint v0.0.0-20211125173453-6d6d39c5bb8b/go.mod h1:wi9BfjxjF/bwiZ701TzmfKu6UKC357IOAtNr0Td0Lvw= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/polyfloyd/go-errorlint v1.0.0 h1:pDrQG0lrh68e602Wfp68BlUTRFoHn8PZYAjLgt2LFsM= +github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.15 h1:iWYzp1z72IlXTioET0+XI6SjQdPfMGfuAiZiKznOt7g= -github.com/quasilyte/go-ruleguard v0.3.15/go.mod h1:NhuWhnlVEM1gT1A4VJHYfy9MuYSxxwHgxWoPsn9llB4= +github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a h1:sWFavxtIctGrVs5SYZ5Ml1CvrDAs8Kf5kx2PI3C41dA= +github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a/go.mod h1:VMX+OnnSw4LicdiEGtRSD/1X8kW7GuEscjYNr4cOIT4= github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.12-0.20220101150716-969a394a9451/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.12/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.16/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3 h1:P4QPNn+TK49zJjXKERt/vyPbv/mCHB/zQ4flDYOMN+M= -github.com/quasilyte/gogrep v0.0.0-20220103110004-ffaa07af02e3/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= +github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 h1:PDWGei+Rf2bBiuZIbZmM20J2ftEy9IeUCHA8HbQqed8= +github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.2.3 h1:ww2fsjqocGCAFamzvv/b8IsRduuHHeK2MHTcTxZTQX8= -github.com/ryancurrah/gomodguard v1.2.3/go.mod h1:rYbA/4Tg5c54mV1sv4sQTP5WOPBcoLtnBZ7/TEhXAbg= +github.com/ryancurrah/gomodguard v1.2.4 h1:CpMSDKan0LtNGGhPrvupAoLeObRFjND8/tU1rEOtBp4= +github.com/ryancurrah/gomodguard v1.2.4/go.mod h1:+Kem4VjWwvFpUJRJSwa16s1tBJe+vbv02+naTow2f6M= github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/securego/gosec/v2 v2.10.0 h1:l6BET4EzWtyUXCpY2v7N92v0DDCas0L7ngg3bpqbr8g= -github.com/securego/gosec/v2 v2.10.0/go.mod h1:PVq8Ewh/nCN8l/kKC6zrGXSr7m2NmEK6ITIAWMtIaA0= +github.com/sashamelentyev/usestdlibvars v1.8.0 h1:QnWP9IOEuRyYKH+IG0LlQIjuJlc0rfdo4K3/Zh3WRMw= +github.com/sashamelentyev/usestdlibvars v1.8.0/go.mod h1:BFt7b5mSVHaaa26ZupiNRV2ODViQBxZZVhtAxAJRrjs= +github.com/securego/gosec/v2 v2.12.0 h1:CQWdW7ATFpvLSohMVsajscfyHJ5rsGmEXmsNcsDNmAg= +github.com/securego/gosec/v2 v2.12.0/go.mod h1:iTpT+eKTw59bSgklBHlSnH5O2tNygHMDxfvMubA4i7I= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -701,31 +651,32 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= -github.com/sivchari/tenv v1.4.7 h1:FdTpgRlTue5eb5nXIYgS/lyVXSjugU8UUVDwhP1NLU8= -github.com/sivchari/tenv v1.4.7/go.mod h1:5nF+bITvkebQVanjU6IuMbvIot/7ReNsUV7I5NbprB0= +github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= +github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= +github.com/sivchari/tenv v1.7.0 h1:d4laZMBK6jpe5PWepxlV9S+LC0yXqvYHiq8E6ceoVVE= +github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -734,11 +685,12 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= +github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= +github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= @@ -752,11 +704,12 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.5 h1:s5PTfem8p8EbKQOctVV53k6jCJt3UX4IEJzwh+C324Q= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= -github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= +github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= @@ -772,8 +725,8 @@ github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiff github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.6.0 h1:xZOkQCRq3xhRqE2yuM1TbBOYaXgCIoVwUFWo5PMGv70= -github.com/tomarrell/wrapcheck/v2 v2.6.0/go.mod h1:68bQ/eJg55BROaRTbMjC7vuhL2OgfoG8bLp9ZyoBfyY= +github.com/tomarrell/wrapcheck/v2 v2.6.2 h1:3dI6YNcrJTQ/CJQ6M/DUkc0gnqYSIk6o0rChn9E/D0M= +github.com/tomarrell/wrapcheck/v2 v2.6.2/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= @@ -784,8 +737,8 @@ github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqz github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/uudashr/gocognit v1.0.5 h1:rrSex7oHr3/pPLQ0xoWq108XMU8s678FJcQ+aSfOHa4= -github.com/uudashr/gocognit v1.0.5/go.mod h1:wgYz0mitoKOTysqxTDMOUXg+Jb5SvtihkfmugIZYpEA= +github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y= +github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= @@ -796,8 +749,8 @@ github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1z github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= -github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1 h1:YAaOqqMTstELMMGblt6yJ/fcOt4owSYuw3IttMnKfAM= -github.com/yeya24/promlinter v0.1.1-0.20210918184747-d757024714a1/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= +github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= +github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= @@ -806,16 +759,12 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -gitlab.com/bosi/decorder v0.2.1 h1:ehqZe8hI4w7O4b1vgsDZw1YU1PE7iJXrQWFMsocbQ1w= -gitlab.com/bosi/decorder v0.2.1/go.mod h1:6C/nhLSbF6qZbYD8bRmISBwc6vcWdNsiIBkRvjJFrH0= +gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= +gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -823,7 +772,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a h1:yLxbGYl9MXOqD0o3unX/nJn+y+1loFNWZJWkfeguYV8= go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a/go.mod h1:gkLviEngQuoeD670EP1KA/Oj4i5oNAzb+pjkk+4ecaQ= go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c h1:29qFnf/xOmEAGv7DwfLLnRejjIcksPdCw+Je0rIlj1Y= @@ -834,7 +782,6 @@ go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c h1:N go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c/go.mod h1:EOBbXCes6aVxWqvSy3v1AJD8vtC4++fW1UH5AB8W4uM= go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c h1:sdRLGv2B9aIRQdLLKlQ6RT/N5MOgsDI+UeYQqNP1g5I= go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c/go.mod h1:5ykZFab0x3jatwG5Rf2idlko5e5Z42XsyJLMg4h35bg= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -852,30 +799,24 @@ go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95a go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -887,6 +828,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d h1:+W8Qf4iJtMGKkyAygcKohjxTk4JPsL9DpzApJ22m5Ic= +golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -913,12 +856,12 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -956,18 +899,16 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 h1:NWy5+hlRbC7HK+PmcXVUmW1IMyFce7to56IUvhUFm7Y= -golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -977,12 +918,7 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -994,13 +930,12 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1017,7 +952,6 @@ golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1030,7 +964,6 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1043,6 +976,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1052,45 +986,40 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -1119,7 +1048,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1151,7 +1079,6 @@ golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1176,7 +1103,6 @@ golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4X golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1188,22 +1114,17 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= -golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -1224,14 +1145,6 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1267,7 +1180,6 @@ google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= @@ -1282,24 +1194,7 @@ google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -1317,19 +1212,9 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1342,7 +1227,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1357,9 +1241,8 @@ gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= -gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= +gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -1386,16 +1269,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= -honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= +honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= +honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= mvdan.cc/gofumpt v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8= mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 h1:Jh3LAeMt1eGpxomyu3jVkmVZWW2MxZ1qIIV2TZ/nRio= -mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY= +mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 h1:seuXWbRB1qPrS3NQnHmFKLJLtskWyueeIzmLXghMGgk= +mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2YjFf5CaW0Bw4RL8RfbEf4GRggJk= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/metric/example_test.go b/metric/example_test.go index 49b2e2ca663..bc94d7572ef 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -109,5 +109,5 @@ func ExampleMeter_asynchronous_multiple() { } } -//This is just an example, see the the contrib runtime instrumentation for real implementation. +// This is just an example, see the the contrib runtime instrumentation for real implementation. func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) {} diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index aed8b6660a5..7cce2bd15f4 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -214,7 +214,7 @@ func (i *aiGauge) unwrap() instrument.Asynchronous { return nil } -//Sync Instruments. +// Sync Instruments. type sfCounter struct { name string opts []instrument.Option diff --git a/sdk/metric/aggregator/lastvalue/lastvalue_test.go b/sdk/metric/aggregator/lastvalue/lastvalue_test.go index 16f9614c25a..fd47ad8c4a3 100644 --- a/sdk/metric/aggregator/lastvalue/lastvalue_test.go +++ b/sdk/metric/aggregator/lastvalue/lastvalue_test.go @@ -76,7 +76,7 @@ func TestLastValueUpdate(t *testing.T) { var last number.Number for i := 0; i < count; i++ { - x := profile.Random(rand.Intn(1)*2 - 1) + x := profile.Random(rand.Intn(2)*2 - 1) last = x aggregatortest.CheckedUpdate(t, agg, x, record) } diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go index 2107b16cb3c..31ddb0f1509 100644 --- a/sdk/metric/controller/basic/controller.go +++ b/sdk/metric/controller/basic/controller.go @@ -46,12 +46,12 @@ var ErrControllerStarted = fmt.Errorf("controller already started") // both "pull" and "push" configurations. This supports two distinct // modes: // -// - Push and Pull: Start() must be called to begin calling the exporter; -// Collect() is called periodically by a background thread after starting -// the controller. -// - Pull-Only: Start() is optional in this case, to call Collect periodically. -// If Start() is not called, Collect() can be called manually to initiate -// collection +// - Push and Pull: Start() must be called to begin calling the exporter; +// Collect() is called periodically by a background thread after starting +// the controller. +// - Pull-Only: Start() is optional in this case, to call Collect periodically. +// If Start() is not called, Collect() can be called manually to initiate +// collection // // The controller supports mixing push and pull access to metric data // using the export.Reader RWLock interface. Collection will diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index 39eb314ca5d..bcb641ee446 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -36,7 +36,7 @@ Asynchronous instruments are managed by an internal AsyncInstrumentState, which coordinates calling batch and single instrument callbacks. -Internal Structure +# Internal Structure Each observer also has its own kind of record stored in the SDK. This record contains a set of recorders for every specific attribute set used in @@ -60,7 +60,7 @@ events since its last checkpoint. Aggregators may be lock-free or they may use locking, but they should expect to be called concurrently. Aggregators must be capable of merging with another aggregator of the same type. -Export Pipeline +# Export Pipeline While the SDK serves to maintain a current set of records and coordinate collection, the behavior of a metrics export pipeline is @@ -126,6 +126,5 @@ collection. Either way, the job of the controller is to call the SDK Collect() method, then read the checkpoint, then invoke the exporter. Controllers are expected to implement the public metric.MeterProvider API, meaning they can be installed as the global Meter provider. - */ package metric // import "go.opentelemetry.io/otel/sdk/metric" diff --git a/sdk/metric/number/number.go b/sdk/metric/number/number.go index 05fa9f933f2..6ba16112fde 100644 --- a/sdk/metric/number/number.go +++ b/sdk/metric/number/number.go @@ -424,9 +424,10 @@ func (n *Number) CompareAndSwapFloat64(of, nf float64) bool { // CompareNumber compares two Numbers given their kind. Both numbers // should have the same kind. This returns: -// 0 if the numbers are equal -// -1 if the subject `n` is less than the argument `nn` -// +1 if the subject `n` is greater than the argument `nn` +// +// 0 if the numbers are equal +// -1 if the subject `n` is less than the argument `nn` +// +1 if the subject `n` is greater than the argument `nn` func (n *Number) CompareNumber(kind Kind, nn Number) int { switch kind { case Int64Kind: diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go index fa0e902d255..ce9318c3532 100644 --- a/sdk/metric/processor/processortest/test.go +++ b/sdk/metric/processor/processortest/test.go @@ -118,9 +118,9 @@ func (f testFactory) NewCheckpointer() export.Checkpointer { // NewProcessor returns a new testing Processor implementation. // Verify expected outputs using Values(), e.g.: // -// require.EqualValues(t, map[string]float64{ -// "counter.sum/A=1,B=2/R=V": 100, -// }, processor.Values()) +// require.EqualValues(t, map[string]float64{ +// "counter.sum/A=1,B=2/R=V": 100, +// }, processor.Values()) // // Where in the example A=1,B=2 is the encoded attributes and R=V is the // encoded resource value. @@ -322,9 +322,9 @@ func (o *Output) AddAccumulation(acc export.Accumulation) error { // New returns a new testing Exporter implementation. // Verify exporter outputs using Values(), e.g.,: // -// require.EqualValues(t, map[string]float64{ -// "counter.sum/A=1,B=2/R=V": 100, -// }, exporter.Values()) +// require.EqualValues(t, map[string]float64{ +// "counter.sum/A=1,B=2/R=V": 100, +// }, exporter.Values()) // // Where in the example A=1,B=2 is the encoded attributes and R=V is the // encoded resource value. diff --git a/sdk/metric/processor/reducer/doc.go b/sdk/metric/processor/reducer/doc.go index a6999e5627b..e25079c526f 100644 --- a/sdk/metric/processor/reducer/doc.go +++ b/sdk/metric/processor/reducer/doc.go @@ -28,33 +28,33 @@ collecting high cardinality metric data. For example, to compose a push controller with a reducer and a basic metric processor: -type someFilter struct{ - // configuration for this filter - // ... -} - -func (someFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { - return func(attr kv.KeyValue) bool { - // return true to keep this attr, false to drop this attr. - // ... - } -} - -func setupMetrics(exporter export.Exporter) (stop func()) { - basicProcessorFactory := basic.NewFactory( - simple.NewWithHistogramDistribution(), - exporter, - ) - - reducerProcessor := reducer.NewFactory(someFilter{...}, basicProcessorFactory) - - controller := controller.New( - reducerProcessor, - exporter, - opts..., - ) - controller.Start() - global.SetMeterProvider(controller.Provider()) - return controller.Stop + type someFilter struct{ + // configuration for this filter + // ... + } + + func (someFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { + return func(attr kv.KeyValue) bool { + // return true to keep this attr, false to drop this attr. + // ... + } + } + + func setupMetrics(exporter export.Exporter) (stop func()) { + basicProcessorFactory := basic.NewFactory( + simple.NewWithHistogramDistribution(), + exporter, + ) + + reducerProcessor := reducer.NewFactory(someFilter{...}, basicProcessorFactory) + + controller := controller.New( + reducerProcessor, + exporter, + opts..., + ) + controller.Start() + global.SetMeterProvider(controller.Provider()) + return controller.Stop */ package reducer // import "go.opentelemetry.io/otel/sdk/metric/processor/reducer" diff --git a/sdk/metric/refcount_mapped.go b/sdk/metric/refcount_mapped.go index 9abfb9cca70..d9d2cb701c2 100644 --- a/sdk/metric/refcount_mapped.go +++ b/sdk/metric/refcount_mapped.go @@ -44,8 +44,9 @@ func (rm *refcountMapped) unref() { // tryUnmap flips the mapped bit to "unmapped" state and returns true if both of the // following conditions are true upon entry to this function: -// * There are no active references; -// * The mapped bit is in "mapped" state. +// - There are no active references; +// - The mapped bit is in "mapped" state. +// // Otherwise no changes are done to mapped bit and false is returned. func (rm *refcountMapped) tryUnmap() bool { if atomic.LoadInt64(&rm.value) != 0 { diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index eac69f34d76..3c8abb8c1aa 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -90,10 +90,10 @@ var _ trace.TracerProvider = &TracerProvider{} // NewTracerProvider returns a new and configured TracerProvider. // // By default the returned TracerProvider is configured with: -// - a ParentBased(AlwaysSample) Sampler -// - a random number IDGenerator -// - the resource.Default() Resource -// - the default SpanLimits. +// - a ParentBased(AlwaysSample) Sampler +// - a random number IDGenerator +// - the resource.Default() Resource +// - the default SpanLimits. // // The passed opts are used to override these default values and configure the // returned TracerProvider appropriately. @@ -162,16 +162,16 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T func (p *TracerProvider) RegisterSpanProcessor(s SpanProcessor) { p.mu.Lock() defer p.mu.Unlock() - new := spanProcessorStates{} + newSPS := spanProcessorStates{} if old, ok := p.spanProcessors.Load().(spanProcessorStates); ok { - new = append(new, old...) + newSPS = append(newSPS, old...) } newSpanSync := &spanProcessorState{ sp: s, state: &sync.Once{}, } - new = append(new, newSpanSync) - p.spanProcessors.Store(new) + newSPS = append(newSPS, newSpanSync) + p.spanProcessors.Store(newSPS) } // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index a39d0341e4a..a6dcf4b307c 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -102,6 +102,7 @@ func (ts traceIDRatioSampler) Description() string { // always sample. Fractions < 0 are treated as zero. To respect the // parent trace's `SampledFlag`, the `TraceIDRatioBased` sampler should be used // as a delegate of a `Parent` sampler. +// //nolint:revive // revive complains about stutter of `trace.TraceIDRatioBased` func TraceIDRatioBased(fraction float64) Sampler { if fraction >= 1 { diff --git a/sdk/trace/sampling_test.go b/sdk/trace/sampling_test.go index a675ba93f0c..6ba778db5fa 100644 --- a/sdk/trace/sampling_test.go +++ b/sdk/trace/sampling_test.go @@ -180,9 +180,10 @@ func TestParentBasedDefaultDescription(t *testing.T) { } // TraceIDRatioBased sampler requirements state -// "A TraceIDRatioBased sampler with a given sampling rate MUST also sample -// all traces that any TraceIDRatioBased sampler with a lower sampling rate -// would sample." +// +// "A TraceIDRatioBased sampler with a given sampling rate MUST also sample +// all traces that any TraceIDRatioBased sampler with a lower sampling rate +// would sample." func TestTraceIdRatioSamplesInclusively(t *testing.T) { const ( numSamplers = 1000 diff --git a/trace.go b/trace.go index 28b4f5e4d82..caf7249de85 100644 --- a/trace.go +++ b/trace.go @@ -31,9 +31,12 @@ func Tracer(name string, opts ...trace.TracerOption) trace.Tracer { // If none is registered then an instance of NoopTracerProvider is returned. // // Use the trace provider to create a named tracer. E.g. -// tracer := otel.GetTracerProvider().Tracer("example.com/foo") +// +// tracer := otel.GetTracerProvider().Tracer("example.com/foo") +// // or -// tracer := otel.Tracer("example.com/foo") +// +// tracer := otel.Tracer("example.com/foo") func GetTracerProvider() trace.TracerProvider { return global.TracerProvider() } diff --git a/trace/trace.go b/trace/trace.go index e1f61e0735b..3e009873219 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -386,16 +386,16 @@ type Span interface { // // For example, a Link is used in the following situations: // -// 1. Batch Processing: A batch of operations may contain operations -// associated with one or more traces/spans. Since there can only be one -// parent SpanContext, a Link is used to keep reference to the -// SpanContext of all operations in the batch. -// 2. Public Endpoint: A SpanContext for an in incoming client request on a -// public endpoint should be considered untrusted. In such a case, a new -// trace with its own identity and sampling decision needs to be created, -// but this new trace needs to be related to the original trace in some -// form. A Link is used to keep reference to the original SpanContext and -// track the relationship. +// 1. Batch Processing: A batch of operations may contain operations +// associated with one or more traces/spans. Since there can only be one +// parent SpanContext, a Link is used to keep reference to the +// SpanContext of all operations in the batch. +// 2. Public Endpoint: A SpanContext for an in incoming client request on a +// public endpoint should be considered untrusted. In such a case, a new +// trace with its own identity and sampling decision needs to be created, +// but this new trace needs to be related to the original trace in some +// form. A Link is used to keep reference to the original SpanContext and +// track the relationship. type Link struct { // SpanContext of the linked Span. SpanContext SpanContext From 3810616eb3498953a3dad144116ec36ececcb187 Mon Sep 17 00:00:00 2001 From: Dafei Liu Date: Thu, 25 Aug 2022 21:00:46 +0800 Subject: [PATCH 216/886] Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) * Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 15 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fd563b84e9..508b6b30baa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support Go 1.19. Include compatibility testing and document support. (#3077) +- Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) ### Changed diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index c525ea47b5b..ba2859c29a0 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -23,7 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect - go.opentelemetry.io/proto/otlp v0.18.0 // indirect + go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 565bfac7844..aa7b5fa99e0 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -158,8 +158,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index ffcb48b151b..609a8ee5ad5 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.31.0 go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 3f5b0b6df58..fda59974476 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -163,8 +163,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 8c8226eb867..7379132a9ce 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v0.31.0 go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index aa3f8bac4ee..77a03262881 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 6ac02fa0491..2360acea2f2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -7,7 +7,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index aa3f8bac4ee..77a03262881 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f05f2107d64..32eb84a92c2 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/trace v1.9.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index ddb7c704e47..c066ceeecc1 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 957d022466e..3bff7e4e738 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index f3253a0f5d2..b97b96c7e71 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -162,8 +162,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 1078045a703..da79c3b66d9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 go.opentelemetry.io/otel/sdk v1.9.0 go.opentelemetry.io/otel/trace v1.9.0 - go.opentelemetry.io/proto/otlp v0.18.0 + go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 1c39dbea853..c8a15d98b71 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -161,8 +161,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.18.0 h1:W5hyXNComRa23tGpKwG+FRAc4rfF6ZUg1JReK+QHS80= -go.opentelemetry.io/proto/otlp v0.18.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= +go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 55b49c407e07dc13bdba245c2c13935a37bad971 Mon Sep 17 00:00:00 2001 From: Mitch Usher Date: Fri, 26 Aug 2022 07:53:33 -0600 Subject: [PATCH 217/886] Update tracer to guard for a nil ctx (#3110) * Update tracer to guard for a nil ctx Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/trace_test.go | 10 ++++++++++ sdk/trace/tracer.go | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 508b6b30baa..0a044b0366a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The exponential histogram mapping functions have been updated with exact upper-inclusive boundary support following the [corresponding specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) +- Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) ## [1.9.0/0.0.3] - 2022-08-01 diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 8d95782115b..c6adbb77818 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -363,6 +363,16 @@ func TestStartSpanWithParent(t *testing.T) { } } +// Test we get a successful span as a new root if a nil context is sent in, as opposed to a panic. +// See https://github.com/open-telemetry/opentelemetry-go/issues/3109 +func TestStartSpanWithNilContext(t *testing.T) { + tp := NewTracerProvider() + tr := tp.Tracer("NoPanic") + + // nolint:staticcheck // no nil context, but that's the point of the test. + assert.NotPanics(t, func() { tr.Start(nil, "should-not-panic") }) +} + func TestStartSpanNewRootNotSampled(t *testing.T) { alwaysSampleTp := NewTracerProvider() sampledTr := alwaysSampleTp.Tracer("AlwaysSampled") diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index f4a1f96f3d6..7b11fc465c6 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -37,6 +37,11 @@ var _ trace.Tracer = &tracer{} func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanStartOption) (context.Context, trace.Span) { config := trace.NewSpanStartConfig(options...) + if ctx == nil { + // Prevent trace.ContextWithSpan from panicking. + ctx = context.Background() + } + // For local spans created by this SDK, track child span count. if p := trace.SpanFromContext(ctx); p != nil { if sdkSpan, ok := p.(*recordingSpan); ok { From 454d57b720074d38d7811e302bbf0d67f1f4f36f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 31 Aug 2022 12:01:02 -0700 Subject: [PATCH 218/886] Fix sdk/instrumentation pkg docs (#3130) --- sdk/instrumentation/doc.go | 24 ++++++++++++++++++++++++ sdk/instrumentation/library.go | 7 ------- sdk/instrumentation/scope.go | 7 ------- 3 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 sdk/instrumentation/doc.go diff --git a/sdk/instrumentation/doc.go b/sdk/instrumentation/doc.go new file mode 100644 index 00000000000..6e923acab43 --- /dev/null +++ b/sdk/instrumentation/doc.go @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package instrumentation provides types to represent the code libraries that +// provide OpenTelemetry instrumentation. These types are used in the +// OpenTelemetry signal pipelines to identify the source of telemetry. +// +// See +// https://github.com/open-telemetry/oteps/blob/d226b677d73a785523fe9b9701be13225ebc528d/text/0083-component.md +// and +// https://github.com/open-telemetry/oteps/blob/d226b677d73a785523fe9b9701be13225ebc528d/text/0201-scope-attributes.md +// for more information. +package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" diff --git a/sdk/instrumentation/library.go b/sdk/instrumentation/library.go index 246873345de..39f025a1715 100644 --- a/sdk/instrumentation/library.go +++ b/sdk/instrumentation/library.go @@ -12,13 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package instrumentation provides an instrumentation library structure to be -passed to both the OpenTelemetry Tracer and Meter components. - -For more information see -[this](https://github.com/open-telemetry/oteps/blob/main/text/0083-component.md). -*/ package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" // Library represents the instrumentation library. diff --git a/sdk/instrumentation/scope.go b/sdk/instrumentation/scope.go index 775de40e30c..09c6d93f6d0 100644 --- a/sdk/instrumentation/scope.go +++ b/sdk/instrumentation/scope.go @@ -12,13 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package instrumentation provides an instrumentation scope structure to be -passed to both the OpenTelemetry Tracer and Meter components. - -For more information see -[this](https://github.com/open-telemetry/oteps/blob/main/text/0083-component.md). -*/ package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" // Scope represents the instrumentation scope. From 0078faeb0e84d44dced8230b251b260fb2b912e5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 31 Aug 2022 15:19:50 -0700 Subject: [PATCH 219/886] Add instrumentation scope attributes (#3131) * Add WithScopeAttributes TracerOption to trace API * Add Attributes field to instrumentation Scope * Use scope attributes for new Tracer * Fix stdouttrace expected test output * Allow unexported Set fields in sdk/trace test * Export instrumentation scope attrs in OTLP * Add changes to the changelog * Fix imports with make lint * Add unit tests for WithScopeAttributes * Fix English in Scope documentation --- CHANGELOG.md | 3 ++ .../tracetransform/instrumentation.go | 5 +- .../tracetransform/instrumentation_test.go | 52 +++++++++++++++++++ exporters/stdout/stdouttrace/trace_test.go | 3 +- sdk/instrumentation/scope.go | 18 ++++++- sdk/trace/provider.go | 15 ++++-- sdk/trace/trace_test.go | 2 + trace/config.go | 18 ++++++- trace/config_test.go | 19 +++++++ 9 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a044b0366a..82983be0535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support Go 1.19. Include compatibility testing and document support. (#3077) - Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) +- Add an `Attribute` field to the `Scope` type in `go.opentelemetry.io/otel/sdk/instrumentation`. (#3131) +- Add the `WithScopeAttributes` `TracerOption` to the `go.opentelemetry.io/otel/trace` package. (#3131) ### Changed @@ -21,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm exact upper-inclusive boundary support following the [corresponding specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) - Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) +- Export scope attributes for all exporters provided by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#3131) ## [1.9.0/0.0.3] - 2022-08-01 diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 7aaec38d22a..4dcddb17809 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -24,7 +24,8 @@ func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationSco return nil } return &commonpb.InstrumentationScope{ - Name: il.Name, - Version: il.Version, + Name: il.Name, + Version: il.Version, + Attributes: Iterator(il.Attributes.Iter()), } } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go new file mode 100644 index 00000000000..634d1dfaf00 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/instrumentation" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +func TestInstrumentationScope(t *testing.T) { + t.Run("Empty", func(t *testing.T) { + assert.Nil(t, InstrumentationScope(instrumentation.Scope{})) + }) + + t.Run("Mapping", func(t *testing.T) { + var ( + name = "instrumentation name" + version = "v0.1.0" + attr = attribute.NewSet(attribute.String("domain", "trace")) + attrPb = Iterator(attr.Iter()) + ) + expected := &commonpb.InstrumentationScope{ + Name: name, + Version: version, + Attributes: attrPb, + } + actual := InstrumentationScope(instrumentation.Scope{ + Name: name, + Version: version, + SchemaURL: "http://this.is.mapped.elsewhere.com", + Attributes: attr, + }) + assert.Equal(t, expected, actual) + }) +} diff --git a/exporters/stdout/stdouttrace/trace_test.go b/exporters/stdout/stdouttrace/trace_test.go index 649312bf697..82bd2fcabd7 100644 --- a/exporters/stdout/stdouttrace/trace_test.go +++ b/exporters/stdout/stdouttrace/trace_test.go @@ -186,7 +186,8 @@ func expectedJSON(now time.Time) string { "InstrumentationLibrary": { "Name": "", "Version": "", - "SchemaURL": "" + "SchemaURL": "", + "Attributes": null } } ` diff --git a/sdk/instrumentation/scope.go b/sdk/instrumentation/scope.go index 09c6d93f6d0..3001b6cc907 100644 --- a/sdk/instrumentation/scope.go +++ b/sdk/instrumentation/scope.go @@ -14,7 +14,14 @@ package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" -// Scope represents the instrumentation scope. +import "go.opentelemetry.io/otel/attribute" + +// Scope represents the instrumentation source of OpenTelemetry data. +// +// Code that uses OpenTelemetry APIs or data-models to produce telemetry needs +// to be identifiable by the receiver of that data. A Scope is used for this +// purpose, it uniquely identifies that code as the source and the extent to +// which it is relevant. type Scope struct { // Name is the name of the instrumentation scope. This should be the // Go package name of that scope. @@ -23,4 +30,13 @@ type Scope struct { Version string // SchemaURL of the telemetry emitted by the scope. SchemaURL string + // Attributes describe the unique attributes of an instrumentation scope. + // + // These attributes are used to differentiate an instrumentation scope when + // it emits data that belong to different domains. For example, if both + // profiling data and client-side data are emitted as log records from the + // same instrumentation library, they may need to be differentiated by a + // telemetry receiver. In that case, these attributes are used to scope and + // differentiate the data. + Attributes attribute.Set } diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 3c8abb8c1aa..a4b6c0da1dd 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -142,9 +142,10 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T name = defaultTracerName } is := instrumentation.Scope{ - Name: name, - Version: c.InstrumentationVersion(), - SchemaURL: c.SchemaURL(), + Name: name, + Version: c.InstrumentationVersion(), + SchemaURL: c.SchemaURL(), + Attributes: c.Attributes(), } t, ok := p.namedTracer[is] if !ok { @@ -153,7 +154,13 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T instrumentationScope: is, } p.namedTracer[is] = t - global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) + global.Info( + "Tracer created", + "name", name, + "version", c.InstrumentationVersion(), + "schemaURL", c.SchemaURL(), + "attributes", c.Attributes(), + ) } return t } diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index c6adbb77818..8badccc4240 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -911,6 +911,8 @@ func TestSetSpanStatusWithoutMessageWhenStatusIsNotError(t *testing.T) { func cmpDiff(x, y interface{}) string { return cmp.Diff(x, y, cmp.AllowUnexported(snapshot{}), + cmp.AllowUnexported(attribute.Set{}), + cmp.AllowUnexported(attribute.Distinct{}), cmp.AllowUnexported(attribute.Value{}), cmp.AllowUnexported(Event{}), cmp.AllowUnexported(trace.TraceState{})) diff --git a/trace/config.go b/trace/config.go index f058cc781e0..a7b7eab2172 100644 --- a/trace/config.go +++ b/trace/config.go @@ -24,7 +24,8 @@ import ( type TracerConfig struct { instrumentationVersion string // Schema URL of the telemetry emitted by the Tracer. - schemaURL string + schemaURL string + attributes attribute.Set } // InstrumentationVersion returns the version of the library providing instrumentation. @@ -37,6 +38,11 @@ func (t *TracerConfig) SchemaURL() string { return t.schemaURL } +// Attributes returns the scope attribute set of the Tracer. +func (t *TracerConfig) Attributes() attribute.Set { + return t.attributes +} + // NewTracerConfig applies all the options to a returned TracerConfig. func NewTracerConfig(options ...TracerOption) TracerConfig { var config TracerConfig @@ -314,3 +320,13 @@ func WithSchemaURL(schemaURL string) TracerOption { return cfg }) } + +// WithScopeAttributes sets the attributes for the scope of a Tracer. The +// attributes are stored as an attribute set. Duplicate values are removed, the +// last value is used. +func WithScopeAttributes(attr ...attribute.KeyValue) TracerOption { + return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { + cfg.attributes = attribute.NewSet(attr...) + return cfg + }) +} diff --git a/trace/config_test.go b/trace/config_test.go index a4cafcbcd09..d46a8e137c6 100644 --- a/trace/config_test.go +++ b/trace/config_test.go @@ -211,6 +211,7 @@ func TestTracerConfig(t *testing.T) { v1 := "semver:0.0.1" v2 := "semver:1.0.0" schemaURL := "https://opentelemetry.io/schemas/1.2.0" + one, two := attribute.Int("key", 1), attribute.Int("key", 2) tests := []struct { options []TracerOption expected TracerConfig @@ -246,6 +247,24 @@ func TestTracerConfig(t *testing.T) { schemaURL: schemaURL, }, }, + + { + []TracerOption{ + WithScopeAttributes(one, two), + }, + TracerConfig{ + attributes: attribute.NewSet(two), + }, + }, + { + []TracerOption{ + WithScopeAttributes(two), + WithScopeAttributes(one), + }, + TracerConfig{ + attributes: attribute.NewSet(one), + }, + }, } for _, test := range tests { config := NewTracerConfig(test.options...) From 81a9bab814231c386bfee8078a66f13bd457288d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 1 Sep 2022 14:19:03 -0700 Subject: [PATCH 220/886] Add WithScopeAttributes MeterOption to metric API package (#3132) * Add WithScopeAttributes MeterOption to metric pkg * Add MeterConfig unit tests * Add changes to changelog * Fix import linting * Update MeterProvider documentation Include information about how to use WithScopeAttributes. --- CHANGELOG.md | 1 + metric/config.go | 18 +++++++++++ metric/config_test.go | 69 +++++++++++++++++++++++++++++++++++++++++++ metric/meter.go | 51 +++++++++++++++++++++++++++----- 4 files changed, 131 insertions(+), 8 deletions(-) create mode 100644 metric/config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 82983be0535..9e4a8df6440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) - Add an `Attribute` field to the `Scope` type in `go.opentelemetry.io/otel/sdk/instrumentation`. (#3131) - Add the `WithScopeAttributes` `TracerOption` to the `go.opentelemetry.io/otel/trace` package. (#3131) +- Add the `WithScopeAttributes` `MeterOption` to the `go.opentelemetry.io/otel/metric` package. (#3132) ### Changed diff --git a/metric/config.go b/metric/config.go index 621e4c5fcb8..ddadd62f9f9 100644 --- a/metric/config.go +++ b/metric/config.go @@ -14,10 +14,13 @@ package metric // import "go.opentelemetry.io/otel/metric" +import "go.opentelemetry.io/otel/attribute" + // MeterConfig contains options for Meters. type MeterConfig struct { instrumentationVersion string schemaURL string + attributes attribute.Set } // InstrumentationVersion is the version of the library providing instrumentation. @@ -30,6 +33,11 @@ func (cfg MeterConfig) SchemaURL() string { return cfg.schemaURL } +// Attributes returns the scope attribute set of the Meter. +func (t MeterConfig) Attributes() attribute.Set { + return t.attributes +} + // MeterOption is an interface for applying Meter options. type MeterOption interface { // applyMeter is used to set a MeterOption value of a MeterConfig. @@ -67,3 +75,13 @@ func WithSchemaURL(schemaURL string) MeterOption { return config }) } + +// WithScopeAttributes sets the attributes for the scope of a Meter. The +// attributes are stored as an attribute set. Duplicate values are removed, the +// last value is used. +func WithScopeAttributes(attr ...attribute.KeyValue) MeterOption { + return meterOptionFunc(func(cfg MeterConfig) MeterConfig { + cfg.attributes = attribute.NewSet(attr...) + return cfg + }) +} diff --git a/metric/config_test.go b/metric/config_test.go new file mode 100644 index 00000000000..359e14c0603 --- /dev/null +++ b/metric/config_test.go @@ -0,0 +1,69 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" +) + +func TestMeterConfig(t *testing.T) { + t.Run("Empty", func(t *testing.T) { + assert.Equal(t, NewMeterConfig(), MeterConfig{}) + }) + + t.Run("InstrumentationVersion", func(t *testing.T) { + v0, v1 := "v0.1.0", "v1.0.0" + + assert.Equal(t, NewMeterConfig( + WithInstrumentationVersion(v0), + ).InstrumentationVersion(), v0) + + assert.Equal(t, NewMeterConfig( + WithInstrumentationVersion(v0), + WithInstrumentationVersion(v1), + ).InstrumentationVersion(), v1, "last option has precedence") + }) + + t.Run("SchemaURL", func(t *testing.T) { + s120 := "https://opentelemetry.io/schemas/1.2.0" + s130 := "https://opentelemetry.io/schemas/1.3.0" + + assert.Equal(t, NewMeterConfig( + WithSchemaURL(s120), + ).SchemaURL(), s120) + + assert.Equal(t, NewMeterConfig( + WithSchemaURL(s120), + WithSchemaURL(s130), + ).SchemaURL(), s130, "last option has precedence") + }) + + t.Run("Attributes", func(t *testing.T) { + one, two := attribute.Int("key", 1), attribute.Int("key", 2) + + assert.Equal(t, NewMeterConfig( + WithScopeAttributes(one, two), + ).Attributes(), attribute.NewSet(two), "last attribute is used") + + assert.Equal(t, NewMeterConfig( + WithScopeAttributes(two), + WithScopeAttributes(one), + ).Attributes(), attribute.NewSet(one), "last option has precedence") + }) +} diff --git a/metric/meter.go b/metric/meter.go index 21fc1c499fb..b548405353c 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -24,15 +24,50 @@ import ( "go.opentelemetry.io/otel/metric/instrument/syncint64" ) -// MeterProvider provides access to named Meter instances, for instrumenting -// an application or library. +// MeterProvider provides Meters that are used by instrumentation code to +// create instruments that measure code operations. +// +// A MeterProvider is the collection destination of all measurements made from +// instruments the provided Meters created, it represents a unique telemetry +// collection pipeline. How that pipeline is defined, meaning how those +// measurements are collected, processed, and where they are exported, depends +// on its implementation. Instrumentation authors do not need to define this +// implementation, rather just use the provided Meters to instrument code. +// +// Commonly, instrumentation code will accept a MeterProvider implementation at +// runtime from its users or it can simply use the globally registered one (see +// https://pkg.go.dev/go.opentelemetry.io/otel/metric/global#MeterProvider). +// +// Warning: methods may be added to this interface in minor releases. type MeterProvider interface { - // Meter creates an instance of a `Meter` interface. The instrumentationName - // must be the name of the library providing instrumentation. This name may - // be the same as the instrumented code only if that code provides built-in - // instrumentation. If the instrumentationName is empty, then a - // implementation defined default name will be used instead. - Meter(instrumentationName string, opts ...MeterOption) Meter + // Meter returns a unique Meter scoped to be used by instrumentation code + // to measure code operations. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use metric measurements to communicate different + // domains of code operations data (i.e. using different Meters to + // communicate user experience and back-end operations). If this is the + // case, the WithScopeAttributes option should be used to uniquely identify + // Meters that handle the different domains of code operations data. + // + // If the same name and options are passed multiple times, the same Meter + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Meter or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Meter. All implementations will ensure any MeterProvider + // configuration changes are propagated to all provided Meters. + // + // If name is empty, then an implementation defined default name will be + // used instead. + // + // This method is safe to call concurrently. + Meter(name string, options ...MeterOption) Meter } // Meter provides access to instrument instances for recording metrics. From f2dc8e36c24b0853d5ea458be4779c8dc60613b2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 1 Sep 2022 15:11:48 -0700 Subject: [PATCH 221/886] Refactor TracerProvider documentation (#3133) * Refactor TracerProvider documentation * Fix English article * Grammar fixes --- trace/trace.go | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/trace/trace.go b/trace/trace.go index 3e009873219..97f3d83855b 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -503,17 +503,48 @@ type Tracer interface { Start(ctx context.Context, spanName string, opts ...SpanStartOption) (context.Context, Span) } -// TracerProvider provides access to instrumentation Tracers. +// TracerProvider provides Tracers that are used by instrumentation code to +// trace computational workflows. +// +// A TracerProvider is the collection destination of all Spans from Tracers it +// provides, it represents a unique telemetry collection pipeline. How that +// pipeline is defined, meaning how those Spans are collected, processed, and +// where they are exported, depends on its implementation. Instrumentation +// authors do not need to define this implementation, rather just use the +// provided Tracers to instrument code. +// +// Commonly, instrumentation code will accept a TracerProvider implementation +// at runtime from its users or it can simply use the globally registered one +// (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). // // Warning: methods may be added to this interface in minor releases. type TracerProvider interface { - // Tracer creates an implementation of the Tracer interface. - // The instrumentationName must be the name of the library providing - // instrumentation. This name may be the same as the instrumented code - // only if that code provides built-in instrumentation. If the - // instrumentationName is empty, then a implementation defined default - // name will be used instead. + // Tracer returns a unique Tracer scoped to be used by instrumentation code + // to trace computational workflows. The scope and identity of that + // instrumentation code is uniquely defined by the name and options passed. + // + // The passed name needs to uniquely identify instrumentation code. + // Therefore, it is recommended that name is the Go package name of the + // library providing instrumentation (note: not the code being + // instrumented). Instrumentation libraries can have multiple versions, + // therefore, the WithInstrumentationVersion option should be used to + // distinguish these different codebases. Additionally, instrumentation + // libraries may sometimes use traces to communicate different domains of + // workflow data (i.e. using spans to communicate workflow events only). If + // this is the case, the WithScopeAttributes option should be used to + // uniquely identify Tracers that handle the different domains of workflow + // data. + // + // If the same name and options are passed multiple times, the same Tracer + // will be returned (it is up to the implementation if this will be the + // same underlying instance of that Tracer or not). It is not necessary to + // call this multiple times with the same name and options to get an + // up-to-date Tracer. All implementations will ensure any TracerProvider + // configuration changes are propagated to all provided Tracers. + // + // If name is empty, then an implementation defined default name will be + // used instead. // - // This method must be concurrency safe. - Tracer(instrumentationName string, opts ...TracerOption) Tracer + // This method is safe to call concurrently. + Tracer(name string, options ...TracerOption) Tracer } From 399ffe188890666efda9530db0d6793c26a9204b Mon Sep 17 00:00:00 2001 From: Gaurang Patel Date: Fri, 2 Sep 2022 20:21:35 +0530 Subject: [PATCH 222/886] consistency-of: Changed signal names for website docs (#3137) --- website_docs/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/_index.md b/website_docs/_index.md index a21cc50329d..a1ab8723779 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -19,7 +19,7 @@ This is the OpenTelemetry for Go documentation. OpenTelemetry is an observabilit The current status of the major functional components for OpenTelemetry Go is as follows: -| Tracing | Metrics | Logging | +| Traces | Metrics | Logs | | ------- | ------- | ------- | | Stable | Alpha | Not Yet Implemented | From 13ddf7d31e389c891689eca29428bcc72ef98572 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Sat, 3 Sep 2022 02:50:44 +1000 Subject: [PATCH 223/886] Shut down all processors even on error (#3091) --- sdk/trace/provider.go | 14 ++++++++------ sdk/trace/provider_test.go | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index a4b6c0da1dd..7498017903a 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -248,10 +248,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { if !ok { return fmt.Errorf("failed to load span processors") } - if len(spss) == 0 { - return nil - } - + var retErr error for _, sps := range spss { select { case <-ctx.Done(): @@ -264,10 +261,15 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { err = sps.sp.Shutdown(ctx) }) if err != nil { - return err + if retErr == nil { + retErr = err + } else { + // Poor man's list of errors + retErr = fmt.Errorf("%v; %v", retErr, err) + } } } - return nil + return retErr } // TracerProviderOption configures a TracerProvider. diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 39caf5a91df..6ec3df6794d 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -72,6 +72,28 @@ func TestFailedProcessorShutdown(t *testing.T) { assert.Equal(t, err, spErr) } +func TestFailedProcessorsShutdown(t *testing.T) { + stp := NewTracerProvider() + spErr1 := errors.New("basic span processor shutdown failure1") + spErr2 := errors.New("basic span processor shutdown failure2") + sp1 := &basicSpanProcesor{ + running: true, + injectShutdownError: spErr1, + } + sp2 := &basicSpanProcesor{ + running: true, + injectShutdownError: spErr2, + } + stp.RegisterSpanProcessor(sp1) + stp.RegisterSpanProcessor(sp2) + + err := stp.Shutdown(context.Background()) + assert.Error(t, err) + assert.EqualError(t, err, "basic span processor shutdown failure1; basic span processor shutdown failure2") + assert.False(t, sp1.running) + assert.False(t, sp2.running) +} + func TestFailedProcessorShutdownInUnregister(t *testing.T) { handler.Reset() stp := NewTracerProvider() From 9c2a0c2d6983cf3db6bb1432dc7d7bf3e391b852 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 4 Sep 2022 07:52:34 -0700 Subject: [PATCH 224/886] Add README to the exporter package (#3142) --- exporters/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 exporters/README.md diff --git a/exporters/README.md b/exporters/README.md new file mode 100644 index 00000000000..0a8c16a07f0 --- /dev/null +++ b/exporters/README.md @@ -0,0 +1,22 @@ +# OpenTelemetry Exporters + +Once the OpenTelemetry SDK has created and processed telemetry, it needs to be exported. +This package contains exporters for this purpose. + +## Exporter Packages + +The following exporter packages are provided with the following OpenTelemetry signal support. + +| Exporter Package | Metrics | Traces | +| :-----------------------------------------------------------------------------: | :-----: | :----: | +| [go.opentelemetry.io/otel/exporters/jaeger](./jaeger) | | ✓ | +| [go.opentelemetry.io/otel/exporters/otlp/otlpmetric](./otlp/otlpmetric) | ✓ | | +| [go.opentelemetry.io/otel/exporters/otlp/otlptrace](./otlp/otlptrace) | | ✓ | +| [go.opentelemetry.io/otel/exporters/prometheus](./prometheus) | ✓ | | +| [go.opentelemetry.io/otel/exporters/stdout/stdoutmetric](./stdout/stdoutmetric) | ✓ | | +| [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](./stdout/stdouttrace) | | ✓ | +| [go.opentelemetry.io/otel/exporters/zipkin](./zipkin) | | ✓ | + +See the [OpenTelemetry registry] for 3rd-part exporters compatible with this project. + +[OpenTelemetry registry]: https://opentelemetry.io/registry/?language=go&component=exporter From 569f7430726278f40e562f81e64d21156cc3edb9 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Tue, 6 Sep 2022 12:20:19 -0700 Subject: [PATCH 225/886] Handle partial-success responses for OTLP trace (#3106) * Handle partial-success responses for OTLP trace Co-authored-by: David Ashpole Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + .../otlp/otlptrace/otlptracegrpc/client.go | 11 ++- .../otlptrace/otlptracegrpc/client_test.go | 27 +++++++- .../otlptracegrpc/mock_collector_test.go | 7 +- .../otlp/otlptrace/otlptracehttp/client.go | 50 ++++++++++---- .../otlptrace/otlptracehttp/client_test.go | 34 ++++++++++ .../otlptracehttp/mock_collector_test.go | 7 +- exporters/otlp/partialsuccess.go | 68 +++++++++++++++++++ exporters/otlp/partialsuccess_test.go | 44 ++++++++++++ 9 files changed, 231 insertions(+), 18 deletions(-) create mode 100644 exporters/otlp/partialsuccess.go create mode 100644 exporters/otlp/partialsuccess_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e4a8df6440..4dec154c4e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support Go 1.19. Include compatibility testing and document support. (#3077) +- Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) - Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) - Add an `Attribute` field to the `Scope` type in `go.opentelemetry.io/otel/sdk/instrumentation`. (#3131) - Add the `WithScopeAttributes` `TracerOption` to the `go.opentelemetry.io/otel/trace` package. (#3131) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 6be3fec8626..4a139fc696e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -26,6 +26,8 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" @@ -196,9 +198,16 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc defer cancel() return c.requestFunc(ctx, func(iCtx context.Context) error { - _, err := c.tsc.Export(iCtx, &coltracepb.ExportTraceServiceRequest{ + resp, err := c.tsc.Export(iCtx, &coltracepb.ExportTraceServiceRequest{ ResourceSpans: protoSpans, }) + if resp != nil && resp.PartialSuccess != nil { + otel.Handle(otlp.PartialSuccessToError( + otlp.TracingPartialSuccess, + resp.PartialSuccess.RejectedSpans, + resp.PartialSuccess.ErrorMessage, + )) + } // nil is converted to OK. if status.Code(err) == codes.OK { // Success. diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 84e7da801b1..d11111ed126 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -30,12 +30,14 @@ import ( "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/status" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" + coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" commonpb "go.opentelemetry.io/proto/otlp/common/v1" ) @@ -386,3 +388,26 @@ func TestEmptyData(t *testing.T) { assert.NoError(t, exp.ExportSpans(ctx, nil)) } + +func TestPartialSuccess(t *testing.T) { + mc := runMockCollectorWithConfig(t, &mockConfig{ + partial: &coltracepb.ExportTracePartialSuccess{ + RejectedSpans: 2, + ErrorMessage: "partially successful", + }, + }) + t.Cleanup(func() { require.NoError(t, mc.stop()) }) + + errors := []error{} + otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { + errors = append(errors, err) + })) + ctx := context.Background() + exp := newGRPCExporter(t, ctx, mc.endpoint) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + require.NoError(t, exp.ExportSpans(ctx, roSpans)) + + require.Equal(t, 1, len(errors)) + require.Contains(t, errors[0].Error(), "partially successful") + require.Contains(t, errors[0].Error(), "2 spans rejected") +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go index d3ebd8357c7..56b65a5d67b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go @@ -36,6 +36,7 @@ func makeMockCollector(t *testing.T, mockConfig *mockConfig) *mockCollector { traceSvc: &mockTraceService{ storage: otlptracetest.NewSpansStorage(), errors: mockConfig.errors, + partial: mockConfig.partial, }, } } @@ -44,6 +45,7 @@ type mockTraceService struct { collectortracepb.UnimplementedTraceServiceServer errors []error + partial *collectortracepb.ExportTracePartialSuccess requests int mu sync.RWMutex storage otlptracetest.SpansStorage @@ -82,7 +84,9 @@ func (mts *mockTraceService) Export(ctx context.Context, exp *collectortracepb.E <-mts.exportBlock } - reply := &collectortracepb.ExportTraceServiceResponse{} + reply := &collectortracepb.ExportTraceServiceResponse{ + PartialSuccess: mts.partial, + } if mts.requests < len(mts.errors) { idx := mts.requests return reply, mts.errors[idx] @@ -106,6 +110,7 @@ type mockCollector struct { type mockConfig struct { errors []error endpoint string + partial *collectortracepb.ExportTracePartialSuccess } var _ collectortracepb.TraceServiceServer = (*mockTraceService)(nil) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 0c050eb2fa3..59b7e209264 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -29,6 +29,8 @@ import ( "google.golang.org/protobuf/proto" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" @@ -154,28 +156,48 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc return err } - var rErr error + if resp != nil && resp.Body != nil { + defer func() { + if err := resp.Body.Close(); err != nil { + otel.Handle(err) + } + }() + } + switch resp.StatusCode { case http.StatusOK: // Success, do not retry. - case http.StatusTooManyRequests, - http.StatusServiceUnavailable: - // Retry-able failure. - rErr = newResponseError(resp.Header) + // Read the partial success message, if any. + var respData bytes.Buffer + if _, err := io.Copy(&respData, resp.Body); err != nil { + return err + } + + if respData.Len() != 0 { + var respProto coltracepb.ExportTraceServiceResponse + if err := proto.Unmarshal(respData.Bytes(), &respProto); err != nil { + return err + } + + if respProto.PartialSuccess != nil { + otel.Handle(otlp.PartialSuccessToError( + otlp.TracingPartialSuccess, + respProto.PartialSuccess.RejectedSpans, + respProto.PartialSuccess.ErrorMessage, + )) + } + } + return nil - // Going to retry, drain the body to reuse the connection. + case http.StatusTooManyRequests, http.StatusServiceUnavailable: + // Retry-able failures. Drain the body to reuse the connection. if _, err := io.Copy(io.Discard, resp.Body); err != nil { - _ = resp.Body.Close() - return err + otel.Handle(err) } + return newResponseError(resp.Header) default: - rErr = fmt.Errorf("failed to send %s to %s: %s", d.name, request.URL, resp.Status) - } - - if err := resp.Body.Close(); err != nil { - return err + return fmt.Errorf("failed to send %s to %s: %s", d.name, request.URL, resp.Status) } - return rErr }) } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index d14a6ce806f..bf497bad4be 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -25,9 +25,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" + coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" ) const ( @@ -348,3 +350,35 @@ func TestStopWhileExporting(t *testing.T) { assert.NoError(t, err) <-doneCh } + +func TestPartialSuccess(t *testing.T) { + mcCfg := mockCollectorConfig{ + Partial: &coltracepb.ExportTracePartialSuccess{ + RejectedSpans: 2, + ErrorMessage: "partially successful", + }, + } + mc := runMockCollector(t, mcCfg) + defer mc.MustStop(t) + driver := otlptracehttp.NewClient( + otlptracehttp.WithEndpoint(mc.Endpoint()), + otlptracehttp.WithInsecure(), + ) + ctx := context.Background() + exporter, err := otlptrace.New(ctx, driver) + require.NoError(t, err) + defer func() { + assert.NoError(t, exporter.Shutdown(context.Background())) + }() + + errors := []error{} + otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { + errors = append(errors, err) + })) + err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) + assert.NoError(t, err) + + require.Equal(t, 1, len(errors)) + require.Contains(t, errors[0].Error(), "partially successful") + require.Contains(t, errors[0].Error(), "2 spans rejected") +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go index 895b34af4cd..d999c1c8952 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go @@ -46,6 +46,7 @@ type mockCollector struct { injectHTTPStatus []int injectResponseHeader []map[string]string injectContentType string + partial *collectortracepb.ExportTracePartialSuccess delay <-chan struct{} clientTLSConfig *tls.Config @@ -93,7 +94,9 @@ func (c *mockCollector) serveTraces(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusBadRequest) return } - response := collectortracepb.ExportTraceServiceResponse{} + response := collectortracepb.ExportTraceServiceResponse{ + PartialSuccess: c.partial, + } rawResponse, err := proto.Marshal(&response) if err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -207,6 +210,7 @@ type mockCollectorConfig struct { InjectHTTPStatus []int InjectContentType string InjectResponseHeader []map[string]string + Partial *collectortracepb.ExportTracePartialSuccess Delay <-chan struct{} WithTLS bool ExpectedHeaders map[string]string @@ -230,6 +234,7 @@ func runMockCollector(t *testing.T, cfg mockCollectorConfig) *mockCollector { injectHTTPStatus: cfg.InjectHTTPStatus, injectResponseHeader: cfg.InjectResponseHeader, injectContentType: cfg.InjectContentType, + partial: cfg.Partial, delay: cfg.Delay, expectedHeaders: cfg.ExpectedHeaders, } diff --git a/exporters/otlp/partialsuccess.go b/exporters/otlp/partialsuccess.go new file mode 100644 index 00000000000..2652304e95a --- /dev/null +++ b/exporters/otlp/partialsuccess.go @@ -0,0 +1,68 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlp // import "go.opentelemetry.io/otel/exporters/otlp" + +import "fmt" + +// PartialSuccessDropKind indicates the kind of partial success error +// received by an OTLP exporter, which corresponds with the signal +// being exported. +type PartialSuccessDropKind string + +const ( + // TracingPartialSuccess indicates that some spans were rejected. + TracingPartialSuccess PartialSuccessDropKind = "spans" + + // MetricsPartialSuccess indicates that some metric data points were rejected. + MetricsPartialSuccess PartialSuccessDropKind = "metric data points" +) + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind PartialSuccessDropKind +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// PartialSuccessToError produces an error suitable for passing to +// `otel.Handle()` out of the fields in a partial success response, +// independent of which signal produced the outcome. +func PartialSuccessToError(kind PartialSuccessDropKind, itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: kind, + } +} diff --git a/exporters/otlp/partialsuccess_test.go b/exporters/otlp/partialsuccess_test.go new file mode 100644 index 00000000000..1a6a350a2aa --- /dev/null +++ b/exporters/otlp/partialsuccess_test.go @@ -0,0 +1,44 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlp // import "go.opentelemetry.io/otel/exporters/otlp" + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", PartialSuccessToError(TracingPartialSuccess, 15, "what happened")) + requireErrorString(t, "empty message (7 log records rejected)", PartialSuccessToError("log records", 7, "")) +} From 13906ace5d600e6974a6eaf68b169c0583d246da Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 8 Sep 2022 10:46:36 -0700 Subject: [PATCH 226/886] Move partialsuccess code to internal package (#3146) * Move partialsuccess code to internal package * Fix imports to new pkg --- exporters/otlp/{ => internal}/partialsuccess.go | 2 +- exporters/otlp/{ => internal}/partialsuccess_test.go | 2 +- exporters/otlp/otlptrace/otlptracegrpc/client.go | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/client.go | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) rename exporters/otlp/{ => internal}/partialsuccess.go (96%) rename exporters/otlp/{ => internal}/partialsuccess_test.go (95%) diff --git a/exporters/otlp/partialsuccess.go b/exporters/otlp/internal/partialsuccess.go similarity index 96% rename from exporters/otlp/partialsuccess.go rename to exporters/otlp/internal/partialsuccess.go index 2652304e95a..7994706ab51 100644 --- a/exporters/otlp/partialsuccess.go +++ b/exporters/otlp/internal/partialsuccess.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlp // import "go.opentelemetry.io/otel/exporters/otlp" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" import "fmt" diff --git a/exporters/otlp/partialsuccess_test.go b/exporters/otlp/internal/partialsuccess_test.go similarity index 95% rename from exporters/otlp/partialsuccess_test.go rename to exporters/otlp/internal/partialsuccess_test.go index 1a6a350a2aa..3a7b0f0a6ef 100644 --- a/exporters/otlp/partialsuccess_test.go +++ b/exporters/otlp/internal/partialsuccess_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlp // import "go.opentelemetry.io/otel/exporters/otlp" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" import ( "errors" diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 4a139fc696e..9d6e1898b14 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -27,7 +27,7 @@ import ( "google.golang.org/grpc/status" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" @@ -202,8 +202,8 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ResourceSpans: protoSpans, }) if resp != nil && resp.PartialSuccess != nil { - otel.Handle(otlp.PartialSuccessToError( - otlp.TracingPartialSuccess, + otel.Handle(internal.PartialSuccessToError( + internal.TracingPartialSuccess, resp.PartialSuccess.RejectedSpans, resp.PartialSuccess.ErrorMessage, )) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 59b7e209264..745b6541d42 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -30,7 +30,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" @@ -180,8 +180,8 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc } if respProto.PartialSuccess != nil { - otel.Handle(otlp.PartialSuccessToError( - otlp.TracingPartialSuccess, + otel.Handle(internal.PartialSuccessToError( + internal.TracingPartialSuccess, respProto.PartialSuccess.RejectedSpans, respProto.PartialSuccess.ErrorMessage, )) From 7aba25d651015fb89064991cc3982dfacfda8179 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:06:58 -0500 Subject: [PATCH 227/886] Revert Adding attributes to the instrumentation scope. Revert "Add instrumentation scope attributes (#3131)" (#3154) This reverts commit 0078faeb0e84d44dced8230b251b260fb2b912e5. Revert "Add WithScopeAttributes MeterOption to metric API package (#3132)" This reverts commit 81a9bab814231c386bfee8078a66f13bd457288d. --- CHANGELOG.md | 4 -- .../tracetransform/instrumentation.go | 5 +- .../tracetransform/instrumentation_test.go | 52 -------------- exporters/stdout/stdouttrace/trace_test.go | 3 +- metric/config.go | 18 ----- metric/config_test.go | 69 ------------------- metric/meter.go | 51 +++----------- sdk/instrumentation/scope.go | 18 +---- sdk/trace/provider.go | 15 ++-- sdk/trace/trace_test.go | 2 - trace/config.go | 18 +---- trace/config_test.go | 19 ----- 12 files changed, 17 insertions(+), 257 deletions(-) delete mode 100644 exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go delete mode 100644 metric/config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dec154c4e8..c32557b888c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Include compatibility testing and document support. (#3077) - Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) - Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) -- Add an `Attribute` field to the `Scope` type in `go.opentelemetry.io/otel/sdk/instrumentation`. (#3131) -- Add the `WithScopeAttributes` `TracerOption` to the `go.opentelemetry.io/otel/trace` package. (#3131) -- Add the `WithScopeAttributes` `MeterOption` to the `go.opentelemetry.io/otel/metric` package. (#3132) ### Changed @@ -25,7 +22,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm exact upper-inclusive boundary support following the [corresponding specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) - Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) -- Export scope attributes for all exporters provided by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#3131) ## [1.9.0/0.0.3] - 2022-08-01 diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 4dcddb17809..7aaec38d22a 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -24,8 +24,7 @@ func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationSco return nil } return &commonpb.InstrumentationScope{ - Name: il.Name, - Version: il.Version, - Attributes: Iterator(il.Attributes.Iter()), + Name: il.Name, + Version: il.Version, } } diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go deleted file mode 100644 index 634d1dfaf00..00000000000 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -func TestInstrumentationScope(t *testing.T) { - t.Run("Empty", func(t *testing.T) { - assert.Nil(t, InstrumentationScope(instrumentation.Scope{})) - }) - - t.Run("Mapping", func(t *testing.T) { - var ( - name = "instrumentation name" - version = "v0.1.0" - attr = attribute.NewSet(attribute.String("domain", "trace")) - attrPb = Iterator(attr.Iter()) - ) - expected := &commonpb.InstrumentationScope{ - Name: name, - Version: version, - Attributes: attrPb, - } - actual := InstrumentationScope(instrumentation.Scope{ - Name: name, - Version: version, - SchemaURL: "http://this.is.mapped.elsewhere.com", - Attributes: attr, - }) - assert.Equal(t, expected, actual) - }) -} diff --git a/exporters/stdout/stdouttrace/trace_test.go b/exporters/stdout/stdouttrace/trace_test.go index 82bd2fcabd7..649312bf697 100644 --- a/exporters/stdout/stdouttrace/trace_test.go +++ b/exporters/stdout/stdouttrace/trace_test.go @@ -186,8 +186,7 @@ func expectedJSON(now time.Time) string { "InstrumentationLibrary": { "Name": "", "Version": "", - "SchemaURL": "", - "Attributes": null + "SchemaURL": "" } } ` diff --git a/metric/config.go b/metric/config.go index ddadd62f9f9..621e4c5fcb8 100644 --- a/metric/config.go +++ b/metric/config.go @@ -14,13 +14,10 @@ package metric // import "go.opentelemetry.io/otel/metric" -import "go.opentelemetry.io/otel/attribute" - // MeterConfig contains options for Meters. type MeterConfig struct { instrumentationVersion string schemaURL string - attributes attribute.Set } // InstrumentationVersion is the version of the library providing instrumentation. @@ -33,11 +30,6 @@ func (cfg MeterConfig) SchemaURL() string { return cfg.schemaURL } -// Attributes returns the scope attribute set of the Meter. -func (t MeterConfig) Attributes() attribute.Set { - return t.attributes -} - // MeterOption is an interface for applying Meter options. type MeterOption interface { // applyMeter is used to set a MeterOption value of a MeterConfig. @@ -75,13 +67,3 @@ func WithSchemaURL(schemaURL string) MeterOption { return config }) } - -// WithScopeAttributes sets the attributes for the scope of a Meter. The -// attributes are stored as an attribute set. Duplicate values are removed, the -// last value is used. -func WithScopeAttributes(attr ...attribute.KeyValue) MeterOption { - return meterOptionFunc(func(cfg MeterConfig) MeterConfig { - cfg.attributes = attribute.NewSet(attr...) - return cfg - }) -} diff --git a/metric/config_test.go b/metric/config_test.go deleted file mode 100644 index 359e14c0603..00000000000 --- a/metric/config_test.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" -) - -func TestMeterConfig(t *testing.T) { - t.Run("Empty", func(t *testing.T) { - assert.Equal(t, NewMeterConfig(), MeterConfig{}) - }) - - t.Run("InstrumentationVersion", func(t *testing.T) { - v0, v1 := "v0.1.0", "v1.0.0" - - assert.Equal(t, NewMeterConfig( - WithInstrumentationVersion(v0), - ).InstrumentationVersion(), v0) - - assert.Equal(t, NewMeterConfig( - WithInstrumentationVersion(v0), - WithInstrumentationVersion(v1), - ).InstrumentationVersion(), v1, "last option has precedence") - }) - - t.Run("SchemaURL", func(t *testing.T) { - s120 := "https://opentelemetry.io/schemas/1.2.0" - s130 := "https://opentelemetry.io/schemas/1.3.0" - - assert.Equal(t, NewMeterConfig( - WithSchemaURL(s120), - ).SchemaURL(), s120) - - assert.Equal(t, NewMeterConfig( - WithSchemaURL(s120), - WithSchemaURL(s130), - ).SchemaURL(), s130, "last option has precedence") - }) - - t.Run("Attributes", func(t *testing.T) { - one, two := attribute.Int("key", 1), attribute.Int("key", 2) - - assert.Equal(t, NewMeterConfig( - WithScopeAttributes(one, two), - ).Attributes(), attribute.NewSet(two), "last attribute is used") - - assert.Equal(t, NewMeterConfig( - WithScopeAttributes(two), - WithScopeAttributes(one), - ).Attributes(), attribute.NewSet(one), "last option has precedence") - }) -} diff --git a/metric/meter.go b/metric/meter.go index b548405353c..21fc1c499fb 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -24,50 +24,15 @@ import ( "go.opentelemetry.io/otel/metric/instrument/syncint64" ) -// MeterProvider provides Meters that are used by instrumentation code to -// create instruments that measure code operations. -// -// A MeterProvider is the collection destination of all measurements made from -// instruments the provided Meters created, it represents a unique telemetry -// collection pipeline. How that pipeline is defined, meaning how those -// measurements are collected, processed, and where they are exported, depends -// on its implementation. Instrumentation authors do not need to define this -// implementation, rather just use the provided Meters to instrument code. -// -// Commonly, instrumentation code will accept a MeterProvider implementation at -// runtime from its users or it can simply use the globally registered one (see -// https://pkg.go.dev/go.opentelemetry.io/otel/metric/global#MeterProvider). -// -// Warning: methods may be added to this interface in minor releases. +// MeterProvider provides access to named Meter instances, for instrumenting +// an application or library. type MeterProvider interface { - // Meter returns a unique Meter scoped to be used by instrumentation code - // to measure code operations. The scope and identity of that - // instrumentation code is uniquely defined by the name and options passed. - // - // The passed name needs to uniquely identify instrumentation code. - // Therefore, it is recommended that name is the Go package name of the - // library providing instrumentation (note: not the code being - // instrumented). Instrumentation libraries can have multiple versions, - // therefore, the WithInstrumentationVersion option should be used to - // distinguish these different codebases. Additionally, instrumentation - // libraries may sometimes use metric measurements to communicate different - // domains of code operations data (i.e. using different Meters to - // communicate user experience and back-end operations). If this is the - // case, the WithScopeAttributes option should be used to uniquely identify - // Meters that handle the different domains of code operations data. - // - // If the same name and options are passed multiple times, the same Meter - // will be returned (it is up to the implementation if this will be the - // same underlying instance of that Meter or not). It is not necessary to - // call this multiple times with the same name and options to get an - // up-to-date Meter. All implementations will ensure any MeterProvider - // configuration changes are propagated to all provided Meters. - // - // If name is empty, then an implementation defined default name will be - // used instead. - // - // This method is safe to call concurrently. - Meter(name string, options ...MeterOption) Meter + // Meter creates an instance of a `Meter` interface. The instrumentationName + // must be the name of the library providing instrumentation. This name may + // be the same as the instrumented code only if that code provides built-in + // instrumentation. If the instrumentationName is empty, then a + // implementation defined default name will be used instead. + Meter(instrumentationName string, opts ...MeterOption) Meter } // Meter provides access to instrument instances for recording metrics. diff --git a/sdk/instrumentation/scope.go b/sdk/instrumentation/scope.go index 3001b6cc907..09c6d93f6d0 100644 --- a/sdk/instrumentation/scope.go +++ b/sdk/instrumentation/scope.go @@ -14,14 +14,7 @@ package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation" -import "go.opentelemetry.io/otel/attribute" - -// Scope represents the instrumentation source of OpenTelemetry data. -// -// Code that uses OpenTelemetry APIs or data-models to produce telemetry needs -// to be identifiable by the receiver of that data. A Scope is used for this -// purpose, it uniquely identifies that code as the source and the extent to -// which it is relevant. +// Scope represents the instrumentation scope. type Scope struct { // Name is the name of the instrumentation scope. This should be the // Go package name of that scope. @@ -30,13 +23,4 @@ type Scope struct { Version string // SchemaURL of the telemetry emitted by the scope. SchemaURL string - // Attributes describe the unique attributes of an instrumentation scope. - // - // These attributes are used to differentiate an instrumentation scope when - // it emits data that belong to different domains. For example, if both - // profiling data and client-side data are emitted as log records from the - // same instrumentation library, they may need to be differentiated by a - // telemetry receiver. In that case, these attributes are used to scope and - // differentiate the data. - Attributes attribute.Set } diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 7498017903a..292ea5481bc 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -142,10 +142,9 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T name = defaultTracerName } is := instrumentation.Scope{ - Name: name, - Version: c.InstrumentationVersion(), - SchemaURL: c.SchemaURL(), - Attributes: c.Attributes(), + Name: name, + Version: c.InstrumentationVersion(), + SchemaURL: c.SchemaURL(), } t, ok := p.namedTracer[is] if !ok { @@ -154,13 +153,7 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T instrumentationScope: is, } p.namedTracer[is] = t - global.Info( - "Tracer created", - "name", name, - "version", c.InstrumentationVersion(), - "schemaURL", c.SchemaURL(), - "attributes", c.Attributes(), - ) + global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) } return t } diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 8badccc4240..c6adbb77818 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -911,8 +911,6 @@ func TestSetSpanStatusWithoutMessageWhenStatusIsNotError(t *testing.T) { func cmpDiff(x, y interface{}) string { return cmp.Diff(x, y, cmp.AllowUnexported(snapshot{}), - cmp.AllowUnexported(attribute.Set{}), - cmp.AllowUnexported(attribute.Distinct{}), cmp.AllowUnexported(attribute.Value{}), cmp.AllowUnexported(Event{}), cmp.AllowUnexported(trace.TraceState{})) diff --git a/trace/config.go b/trace/config.go index a7b7eab2172..f058cc781e0 100644 --- a/trace/config.go +++ b/trace/config.go @@ -24,8 +24,7 @@ import ( type TracerConfig struct { instrumentationVersion string // Schema URL of the telemetry emitted by the Tracer. - schemaURL string - attributes attribute.Set + schemaURL string } // InstrumentationVersion returns the version of the library providing instrumentation. @@ -38,11 +37,6 @@ func (t *TracerConfig) SchemaURL() string { return t.schemaURL } -// Attributes returns the scope attribute set of the Tracer. -func (t *TracerConfig) Attributes() attribute.Set { - return t.attributes -} - // NewTracerConfig applies all the options to a returned TracerConfig. func NewTracerConfig(options ...TracerOption) TracerConfig { var config TracerConfig @@ -320,13 +314,3 @@ func WithSchemaURL(schemaURL string) TracerOption { return cfg }) } - -// WithScopeAttributes sets the attributes for the scope of a Tracer. The -// attributes are stored as an attribute set. Duplicate values are removed, the -// last value is used. -func WithScopeAttributes(attr ...attribute.KeyValue) TracerOption { - return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { - cfg.attributes = attribute.NewSet(attr...) - return cfg - }) -} diff --git a/trace/config_test.go b/trace/config_test.go index d46a8e137c6..a4cafcbcd09 100644 --- a/trace/config_test.go +++ b/trace/config_test.go @@ -211,7 +211,6 @@ func TestTracerConfig(t *testing.T) { v1 := "semver:0.0.1" v2 := "semver:1.0.0" schemaURL := "https://opentelemetry.io/schemas/1.2.0" - one, two := attribute.Int("key", 1), attribute.Int("key", 2) tests := []struct { options []TracerOption expected TracerConfig @@ -247,24 +246,6 @@ func TestTracerConfig(t *testing.T) { schemaURL: schemaURL, }, }, - - { - []TracerOption{ - WithScopeAttributes(one, two), - }, - TracerConfig{ - attributes: attribute.NewSet(two), - }, - }, - { - []TracerOption{ - WithScopeAttributes(two), - WithScopeAttributes(one), - }, - TracerConfig{ - attributes: attribute.NewSet(one), - }, - }, } for _, test := range tests { config := NewTracerConfig(test.options...) From 49a653682f1257a66771324e818f6a83fb13d62b Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Mon, 12 Sep 2022 07:54:58 -0700 Subject: [PATCH 228/886] Safely truncate over-length string attributes (#3156) * Safely truncate over-length string attributes Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/span.go | 36 ++++++++++++++++++++++++++++++++--- sdk/trace/span_limits_test.go | 6 +++++- sdk/trace/span_test.go | 24 +++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c32557b888c..9c3e7fab311 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm exact upper-inclusive boundary support following the [corresponding specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) - Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) +- Ensure valid UTF-8 when truncating over-length attribute values. (#3156) ## [1.9.0/0.0.3] - 2022-08-01 diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 14d0aabfe69..449cf6c2552 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -20,8 +20,10 @@ import ( "reflect" "runtime" rt "runtime/trace" + "strings" "sync" "time" + "unicode/utf8" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" @@ -294,7 +296,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // truncateAttr returns a truncated version of attr. Only string and string // slice attribute values are truncated. String values are truncated to at -// most a length of limit. Each string slice value is truncated in this fasion +// most a length of limit. Each string slice value is truncated in this fashion // (the slice length itself is unaffected). // // No truncation is perfromed for a negative limit. @@ -305,7 +307,7 @@ func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { switch attr.Value.Type() { case attribute.STRING: if v := attr.Value.AsString(); len(v) > limit { - return attr.Key.String(v[:limit]) + return attr.Key.String(safeTruncate(v, limit)) } case attribute.STRINGSLICE: // Do no mutate the original, make a copy. @@ -324,7 +326,7 @@ func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { v := trucated.Value.AsStringSlice() for i := range v { if len(v[i]) > limit { - v[i] = v[i][:limit] + v[i] = safeTruncate(v[i], limit) } } return trucated @@ -332,6 +334,34 @@ func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { return attr } +// safeTruncate truncates the string and guarantees valid UTF-8 is returned. +func safeTruncate(input string, limit int) string { + if trunc, ok := safeTruncateValidUTF8(input, limit); ok { + return trunc + } + trunc, _ := safeTruncateValidUTF8(strings.ToValidUTF8(input, ""), limit) + return trunc +} + +// safeTruncateValidUTF8 returns a copy of the input string safely truncated to +// limit. The truncation is ensured to occur at the bounds of complete UTF-8 +// characters. If invalid encoding of UTF-8 is encountered, input is returned +// with false, otherwise, the truncated input will be returned with true. +func safeTruncateValidUTF8(input string, limit int) (string, bool) { + for cnt := 0; cnt <= limit; { + r, size := utf8.DecodeRuneInString(input[cnt:]) + if r == utf8.RuneError { + return input, false + } + + if cnt+size > limit { + return input[:cnt], true + } + cnt += size + } + return input, true +} + // End ends the span. This method does nothing if the span is already ended or // is not being recorded. // diff --git a/sdk/trace/span_limits_test.go b/sdk/trace/span_limits_test.go index 91199516c56..5e88770ae0f 100644 --- a/sdk/trace/span_limits_test.go +++ b/sdk/trace/span_limits_test.go @@ -168,6 +168,7 @@ func testSpanLimits(t *testing.T, limits SpanLimits) ReadOnlySpan { span.SetAttributes( attribute.String("string", "abc"), attribute.StringSlice("stringSlice", []string{"abc", "def"}), + attribute.String("euro", "€"), // this is a 3-byte rune ) span.AddEvent("event 1", trace.WithAttributes(a...)) span.AddEvent("event 2", trace.WithAttributes(a...)) @@ -186,24 +187,27 @@ func TestSpanLimits(t *testing.T) { attrs := testSpanLimits(t, limits).Attributes() assert.Contains(t, attrs, attribute.String("string", "abc")) assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"abc", "def"})) + assert.Contains(t, attrs, attribute.String("euro", "€")) limits.AttributeValueLengthLimit = 2 attrs = testSpanLimits(t, limits).Attributes() // Ensure string and string slice attributes are truncated. assert.Contains(t, attrs, attribute.String("string", "ab")) assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"ab", "de"})) + assert.Contains(t, attrs, attribute.String("euro", "")) limits.AttributeValueLengthLimit = 0 attrs = testSpanLimits(t, limits).Attributes() assert.Contains(t, attrs, attribute.String("string", "")) assert.Contains(t, attrs, attribute.StringSlice("stringSlice", []string{"", ""})) + assert.Contains(t, attrs, attribute.String("euro", "")) }) t.Run("AttributeCountLimit", func(t *testing.T) { limits := NewSpanLimits() // Unlimited. limits.AttributeCountLimit = -1 - assert.Len(t, testSpanLimits(t, limits).Attributes(), 2) + assert.Len(t, testSpanLimits(t, limits).Attributes(), 3) limits.AttributeCountLimit = 1 assert.Len(t, testSpanLimits(t, limits).Attributes(), 1) diff --git a/sdk/trace/span_test.go b/sdk/trace/span_test.go index 2c7992e457e..2441defae71 100644 --- a/sdk/trace/span_test.go +++ b/sdk/trace/span_test.go @@ -134,6 +134,30 @@ func TestTruncateAttr(t *testing.T) { attr: strSliceAttr, want: strSliceAttr, }, + { + // This tests the ordinary safeTruncate(). + limit: 10, + attr: attribute.String(key, "€€€€"), // 3 bytes each + want: attribute.String(key, "€€€"), + }, + { + // This tests truncation with an invalid UTF-8 input. + // + // Note that after removing the invalid rune, + // the string is over length and still has to + // be truncated on a code point boundary. + limit: 10, + attr: attribute.String(key, "€"[0:2]+"hello€€"), // corrupted first rune, then over limit + want: attribute.String(key, "hello€"), + }, + { + // This tests the fallback to invalidTruncate() + // where after validation the string does not require + // truncation. + limit: 6, + attr: attribute.String(key, "€"[0:2]+"hello"), // corrupted first rune, then not over limit + want: attribute.String(key, "hello"), + }, } for _, test := range tests { From 0e6f9c29c10d6078e8131418e1d1d166c7195d61 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 12 Sep 2022 15:19:11 -0500 Subject: [PATCH 229/886] Prerelease v1.10.0 (#3158) * update version file * Prepare stable-v1 for version v1.10.0 * Update changelog --- CHANGELOG.md | 11 ++++++----- bridge/opencensus/go.mod | 6 +++--- bridge/opencensus/test/go.mod | 6 +++--- bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 8 ++++---- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 6 +++--- example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 8 ++++---- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 6 +++--- exporters/stdout/stdoutmetric/go.mod | 6 +++--- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 6 +++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 2 +- 30 files changed, 99 insertions(+), 98 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c3e7fab311..906e17ce94f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.10.0] - 2022-09-09 + ### Added -- Support Go 1.19. +- Support Go 1.19. (#3077) Include compatibility testing and document support. (#3077) - Support the OTLP ExportTracePartialSuccess response; these are passed to the registered error handler. (#3106) - Upgrade go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) @@ -18,10 +20,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Fix misidentification of OpenTelemetry `SpanKind` in OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`). (#3096) -- The exponential histogram mapping functions have been updated with - exact upper-inclusive boundary support following the [corresponding - specification change](https://github.com/open-telemetry/opentelemetry-specification/pull/2633). (#2982) - Attempting to start a span with a nil `context` will no longer cause a panic. (#3110) +- All exporters will be shutdown even if one reports an error (#3091) - Ensure valid UTF-8 when truncating over-length attribute values. (#3156) ## [1.9.0/0.0.3] - 2022-08-01 @@ -1907,7 +1907,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.9.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.10.0...HEAD +[1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 [1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 [1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 [1.7.0/0.30.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.7.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 435653777e7..2fe1c84e302 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 699392faba1..270928f38b5 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/bridge/opencensus v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 2dd7e3a935b..c49a89f8dd7 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.7.2 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index 55ca603a603..be627a76236 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.17 require ( - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 8e9f9ff0afc..15ea8347184 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/jaeger v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/jaeger v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/stretchr/objx v0.4.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 4173fe1974a..41433bff5dd 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 0daebaf17ef..ed539b85d35 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,11 +10,11 @@ replace ( require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/bridge/opencensus v0.31.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -23,7 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index ba2859c29a0..96b14906a70 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 google.golang.org/grpc v1.46.2 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 5843a3bce83..41a68d3bd82 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.17 require ( - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1d9e238a2e0..d51de7fec82 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/prometheus v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 @@ -26,8 +26,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/sdk v1.9.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/sdk v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 5b02b99c85b..5650ba002f4 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/zipkin v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/zipkin v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f92b4f75019..c16db4e58e4 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 609a8ee5ad5..2541614fc71 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.46.2 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 7379132a9ce..d0ad331fdea 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -24,7 +24,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 2360acea2f2..fb8da36dc02 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,9 +4,9 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) @@ -19,10 +19,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel v1.9.0 // indirect + go.opentelemetry.io/otel v1.10.0 // indirect go.opentelemetry.io/otel/metric v0.31.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 32eb84a92c2..1c89ad3ba5c 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.17 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 3bff7e4e738..9e444cbe7e3 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index da79c3b66d9..798b246a743 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.9.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 83ebe7de317..6575457676a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.17 require ( github.com/prometheus/client_golang v1.12.2 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -23,7 +23,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect google.golang.org/protobuf v1.26.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index e2b4d6c2308..8e5752f088b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -20,7 +20,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 2ce913ee7c9..b44e0998199 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 67b428a6533..ca6f259a277 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.8 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/sdk v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/go.mod b/go.mod index 1237d40cf6d..76dbbbaec49 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel/trace v1.10.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 5b6f1c3ad4f..4ce2adacf77 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 9f869c2f0b6..6a9bfa8212f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 - go.opentelemetry.io/otel/trace v1.9.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/trace v1.10.0 golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 480390821fd..7a5922ae9a9 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -13,9 +13,9 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.9.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 670e2864c20..d4b34f0cc64 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel v1.10.0 ) require ( diff --git a/version.go b/version.go index 3de2c94cfe0..806db41c555 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.9.0" + return "1.10.0" } diff --git a/versions.yaml b/versions.yaml index ec74ef51610..ec2ca16d270 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.9.0 + version: v1.10.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing From b1e5e35b5c34dfef19c7b1f55b0f3d497be4d960 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 15 Sep 2022 18:41:24 -0700 Subject: [PATCH 230/886] Merge metric SDK development branch "new_sdk/main" into "main" (#3175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove Old SDK and dependent code on that SDK (#2802) * Remove prometheus example code * Remove prometheus exporter code * Remove stdoutmetric code * Remove sdk/metric/* packages * Remove opencensus example code * Remove otlpmetric exporter code * Remove OpenCensus bridge code * go mod tidy * Remove empty modules * Remove the number and aggregator from the metric SDK (#2840) * Add MeterProvider/meter structure to new SDK (#2822) * Remove prometheus example code * Remove prometheus exporter code * Remove stdoutmetric code * Remove sdk/metric/* packages * Remove opencensus example code * Remove otlpmetric exporter code * Remove OpenCensus bridge code * go mod tidy * Remove empty modules * Add MeterProvider/meter structure to new SDK * Add vanity imports * go mod tidy * Add MeterProvider Flush/Shutdown required by spec * Cast nil ptr instead of alloc for comp time check * Apply suggestions from code review Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Apply suggested Shutdown comment * Apply fixes from feedback Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add sdk/metric/view structure (#2838) * Add sdk/metric/view package structure * Vanity import * Define the reader interface, and create a manual reader (#2885) * Add the manual reader to the sdk. * Incoperate feedback from PR. * additional PR comments * Fix lint * Fixes for PR. * Unexport ManualReader fix a few comments * Refactor reader testing into a harness (#2910) * Refactor reader testing into a harness * Run lint * Removed merge leftover * Use opentracing bridge from main * go mod tidy * crosslink * Remove Prometheus exporter from README for now * Run make with new tool set * Replace testReaderHarness with testify suite (#2915) * Add the periodic reader (#2909) * Add the metric.Exporter interface * Move the reader errors to reader.go * Update Reader.Collect docs Remove TODO being addressed in this PR and restate purpose of method. * Initial draft of the periodic reader * Refer to correct config in periodic reader opts * Refactor reader testing into a harness * Move wait group handling out of run * Refactor ticker creation to allow testing * Honor export timeout in run * Fix wait group wait bug * Add periodic reader tests * Fix lint * Update periodic reader comments * Add concurrency test for readers * Simplify the ticker stop deferral * Only register once * Restrict build of metric sdk to Go>1.16 * Clean up ShutdownBeforeRegister test * Test duplicate Reader registration (#2914) The specification requires the SDK prevent duplicate registrations for readers. This adds a test for that and fixes this for the manualReader. * Add WithReader and WithResource Options (#2905) * Add WithReader and WithResource Options * Run lint * Update WithReader fn signature based on feedback * crosslink * Remove zero-len check in unify * Restrict build to Go > 1.16 * Add bench test for reader collect methods (#2922) * Unify reader implementations (#2923) * Unify reader implementations Use an atomic.Value to manage concurrency without a lock. * Lint * Merge main into new sdk main (#2925) * Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files * Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung * Make lint Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Chester Cheung * Add view to metrics. (#2926) * WIP views public * Add attribute filters and comments. * Fixes for lint * Address comments * Fix lint * Changed view matching to expand end Removed the dscriptor, it was moved in previous patch * change wildcards into regex * Update comments * address comments. * Address more PR comments * renamed WithDescription to WithSetDescription. Co-authored-by: Chester Cheung * Implement MeterProvider's Meter method (#2945) * Implement stubbed meter create method * Rename return value to avoid comment * Encapsulate meterRegistry tests with identifying name * Run lint fix * Comment meterRegistry being concurrent safe * Remove ordered meter tracking in the meterRegistry * Test range completeness instead of order * Remove provider field from meter * Initialize MeterProvider readers field for new (#2948) * Introduce Temporality, WithTemporality Reader options and InstrumentKind (#2949) * Introduce Temporality and InstrumentKind Because Temporality is the responsibility of the Reader additional methods are added to the Reader interface. And New options are created to configure the temporality selector. * Addresses comments, and adds tests. * Fix addition PR comment * Add aggregation package and reader/view options (#2958) * Add aggregation pkg and options * Update documentation for the aggregation pkg * Test Aggregation.Err * Fix aggregation pkg comment * Add WithAggregation comment * Add default aggregation * Rename WithAggregation and add AggregationSelector * Fix DefaultAggregationSelector use and decl * Replace Aggregation struct with iface * Add Copy method to hist and fix Err method * Additional test for monotonic bounds * Add aggregation method to Reader * Use AggregationSelector instead of inline func type * Switch RecordMinMax to NoMinMax * Deep copy and validate in options * Test the DefaultAggregationSelector * nolint for import-shadow of method * Fix Default aggregation comment * Test the explicit bucket histogram deep copy * Update temporality selector option (#2967) Match the WithAggregationSelector option pattern: define a TemporalitySelector type, export the DefaultTemporalitySelector function, and name the option with a Selector suffix. * Minor NewMeterProvider and producer docs fix (#2983) * Add internal package structure for aggregation (#2954) * Add the aggtor package * Restrict to Go 1.18 * Add missing build block to view_test.go * Comment Aggregator iface * Use Go 1.18 as the default ci version * Update Aggregator iface from feedback * Accept hist conf * Flatten aggtor into just internal * Add Cycler interface Separate the duties of aggregation and maintaining state across aggregation periods. * Remove build flags for doc.go * Clarify Cycler documentation * Remove aggregation fold logic * Rename Number to Atomic * Add tests for Atomic impls * Remove unneeded Atomic implementation Add back when filling in structures. * Fix article in Float64 docs * Remove Atomic This is an implementation detail. * Add aggregator_example_test * Fix hist example * Add issue numbers to all TODO and FIXME * Remove zero parameter comment * Combine the cycler into the aggregators * Remove the drop aggregator * Fix lint * Use attribute.Set instead of ptr to it Co-authored-by: Anthony Mirabella * Merge main into new_sdk/main (#2996) * Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files * Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung * Use ByteSliceToString from golang.org/x/sys/unix (#2924) Use unix.ByteSliceToString to convert Utsname []byte fields to strings. This also allows to drop the charsToString helper which serves the same purpose and matches ByteSliceToString's implementation. Signed-off-by: Tobias Klauser Co-authored-by: Tyler Yahn * docs: fix typo (#2935) * add timeout to grpc connection in otel-collector example (#2939) * Closes: #2951 (#2952) This PR updates the example listed in the getting started doc so that it will compile without error. It also makes this example consistent with the code found in https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go Signed-off-by: Brad Topol * fix data-model link (#2955) * Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (#2960) * Move to using Instrumentation Scope (#2976) * Move to using Instrumentation Scope * Use type alias, not definition * Add a changelog entry * docs(website_docs): fix exporting_data.md and getting-started.md toc (#2930) * docs(website_docs): fix toc * docs(website_docs): fix toc * update exporting_data.md for rerun check-links * update exporting_data.md for rerun check-links Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn * Update getting-started.md (#2984) grammar edit for line 175 of readme * fix typo (#2986) * fix typo * spell fix * typo fix (#2991) * added traces.txt to gitignore for fib (#2993) * Deprecate Library and move all uses to Scope (#2977) * Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn * Update based on feedback * Revert change Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella * Feat/bridge support text map (#2911) * feat: support TextMap * doc: add comment * test: support for ot.TextMap * Retrieve lost code due to merge * fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders * go mod tidy * Optimized code style, add changelog * doc: Restore comments * wip: add test cases * test: fix args error * delete empty line * Fix syntax and changelog errors * Fix formatting errors Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add a release template (#2863) * Add a release template * Update the about field Co-authored-by: Damien Mathieu <42@dmathieu.com> * Fix linting Issues * Add ignore for template link Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Fix merge of CHANGELOG.md Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Chester Cheung Co-authored-by: Tobias Klauser Co-authored-by: petrie <244236866@qq.com> Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Brad Topol Co-authored-by: Craig Pastro Co-authored-by: Kshitija Murudi Co-authored-by: Petrie Liu Co-authored-by: Guangya Liu Co-authored-by: Craig Pastro Co-authored-by: Anthony Mirabella Co-authored-by: ttoad * Add structure to the export data. (#2961) * Add structure to the export data. * Fix comments. * Apply suggestions from code review Co-authored-by: Tyler Yahn * Address PR comments. * Updated optional historgram parameters. * Address PR comments. Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung * Use export.Aggregation instead of internal.Aggregation (#3007) * Use export.Aggregation instead of internal * Return an export.Aggregation instead of a slice * Use attribute Sets instead of KeyValues for export data (#3012) Attribute Sets have stronger guarantees about the uniqueness of their keys and more functionality. We already ensure attributes are stored as Sets by the aggregator which will produce these data types. Instead of converting to a KeyValue slice, keep the data as a Set. Any user of the data can always call the ToSlice method to use the data as a slice of KeyValues. * Change Instrument Library to Instrument Scope (#3016) Co-authored-by: Tyler Yahn * move temporality to export/temporality (#3017) * move temporality to export/temporality * fix lint errors Co-authored-by: Tyler Yahn * Rename Package sdk/metric/export into sdk/metric/metricdata (#3014) * fix unrelated changes * fix quote code * fix format * rebase pr * rebase pr * change usage of export to metricdata * Add metricdatatest package (#3025) * Use export.Aggregation instead of internal * Return an export.Aggregation instead of a slice * Use attribute Sets instead of KeyValues for export data Attribute Sets have stronger guarantees about the uniqueness of their keys and more functionality. We already ensure attributes are stored as Sets by the aggregator which will produce these data types. Instead of converting to a KeyValue slice, keep the data as a Set. Any user of the data can always call the ToSlice method to use the data as a slice of KeyValues. * Add export data type comparison testing API * Add Aggregation and Value comparison funcs * Move export testing to own pkg * Move exporttest to metricdatatest * Add licenses headers to files missing them * Use metricdata instead of export Fix merge of new_sdk/main * Rename exporttest pkg to metricdatatest * Fix spelling errors * Fix lint issues * Use testing pkg to error directly Include Helper() method calls to correct the call-stack. * Fix CompareAggregations Set equal to true by default * Generalize assertions and unexport equal checks * Abstract assert tests * Rename all exp var to r * Test AssertAggregationsEqual * Comment why Value and Aggregation are separate * Test AssertValuesEqual * Revert changes to metricdata/temporality.go * Expand pkg doc sentence * Add license header to assertion.go * Update assertion docs * Consolidate comparisons funcs into one file * Consolidate and fix docs * Consolidate assertion.go * Consolidate comparisons.go * make lint * Test with relatively static times * Update sdk/metric/metricdata/metricdatatest/comparisons.go Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Drop equal return from comparison funcs * Refactor AssertEqual * Remove reasN from testDatatype func params * Consolidate AssertEqual type conversions * Fix assertion error message * Add assertion failure tests * Remove unneeded strings join * Make comment include a possessive Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Adds a pipeline for creating reader's output (#3026) * Adds a pipeline for creating reader's output * fix metricdata move * fix lint * Apply suggestions from code review Co-authored-by: Tyler Yahn * Address PR comments * Added resource test Co-authored-by: Tyler Yahn * Use generic Sum, Gauge, and DataPoint value removing Value, Int64, and Float64 from metricdata (#3036) * Use generic DataPoint value * Fix assertion_fail_test.go * Declare Sum and DataPoints type in pipeline_test * Add MatchInstrumentKind filter for Views. (#3037) * Move InstrumentKind to view, Add view filter * remove TODO * Add the Option function, fix lint * use local var over 0 * Fix missing undefinedInstrumnet Co-authored-by: Tyler Yahn * Change View Attribute Filter to detect if not set. (#3039) * Change View Attribute Filter to detect if not set. * Fix PR comments. * Rework test for no filter logic. * Add implementation of last-value aggregator (#3008) * Add last-value aggregator * Add test of last-value reset of unseen attrs * Add benchmark * Use generic DataPoint value * Fix assertion_fail_test.go * Fix tests * Remove unused test increment values * View.New() miss InstrumentKind check (#3043) Signed-off-by: liupengfei Co-authored-by: Tyler Yahn * Add delta/cumulative histogram implementation (#3045) * Add delta/cumulative histogram implementation * Add histogram unit tests * Fix histValues Aggregate Store the new buckets value back to the values map. Ensure min/max are measured values, not zero values. * Fix lint * Add benchmarks * Test histograms internal functionality * Fix lint * Add TODO to look at memory use for cumu hist * Update sdk/metric/internal/histogram.go Co-authored-by: Chester Cheung Co-authored-by: Chester Cheung * use TemporalitySelector (#3050) Signed-off-by: Petrie Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add implementation of Sum aggregators (#3000) * Implement the sum aggregators * Add unit tests for delta/cumulative sums * Add benchmarks * Merge sum tests into one * Remove unused start time from cumulative sum * Refactor benchmark tests Split benchmarks for the Aggregations and Aggregate methods so computational resource use can be determined. * goimports * Move timestamp out of lock * Refactor testing * Fix spelling mistake * Name param of expectFunc * Reset delta sum to zero instead of delete * Revert to deleting unused attr sets * Refactor testing to allow use across other aggs * Add TODO to bound cumulative sum mem usage * Fix misspelling * Unify aggregator benchmark code in aggregator_test * Use generic DataPoint value * Fix assertion_fail_test.go * Use generic metricdata types * Fix tests * Fix benchmarks * Fix lint * Update sum documentation * Remove leftover encapsulating test run * Use t.Cleanup to mock time * Consolidate expecter logic into funcs * Move errNegVal closer to use * Run the agg test * Add tests for monotonic sum Aggregate err * Run make lint * Make monotonic an arg of creation funcs * Remove Aggregate monotonic validation * Rename sum to valueMap The term sum is a good variable name that we do not want to take and valueMap better describes the type as the storage of the aggregator. * Adds a filter Aggregator. (#3040) * Adds a filter Aggregator. * Add lock and tests * Add Concurrency tests * fix lint errors * Add memory constrained todo. * Update filter comment. Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn * Add back the stdoutmetric exporter (#3057) * PoC stdoutmetric exporter * Use stringer to generate String for Temporality * Add vanity imports * Update Temporality string expected output * Do not return error from newConfig * Add shutdown unit tests * Fix spelling error * Unify testing of ctx errors and test ForceFlush * Add unit test for Export handle of ctx errs * Clarify documentation about alt OTLP exporter * Remove unused ErrUnrecognized A third party encoder can produce their own errors. This code does nothing unique with this error, therefore, it is removed. * Lint exporter_test.go * Refactor example_test.go removing FIXME * Add test for Export shutdown err * Add a discard encoder for testing * Acknowledged error is returned from Shutdown * Remove unexpected SchemaURL from stdouttrace test * Remove unneeded *testing.T arg from testEncoderOption * Fix the location of now * Revise and edit docs Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Remove stale TODO from metricdata/data.go (#3064) * Merge main into new_sdk/main (#3082) * Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files * Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung * Use ByteSliceToString from golang.org/x/sys/unix (#2924) Use unix.ByteSliceToString to convert Utsname []byte fields to strings. This also allows to drop the charsToString helper which serves the same purpose and matches ByteSliceToString's implementation. Signed-off-by: Tobias Klauser Co-authored-by: Tyler Yahn * docs: fix typo (#2935) * add timeout to grpc connection in otel-collector example (#2939) * Closes: #2951 (#2952) This PR updates the example listed in the getting started doc so that it will compile without error. It also makes this example consistent with the code found in https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go Signed-off-by: Brad Topol * fix data-model link (#2955) * Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (#2960) * Move to using Instrumentation Scope (#2976) * Move to using Instrumentation Scope * Use type alias, not definition * Add a changelog entry * docs(website_docs): fix exporting_data.md and getting-started.md toc (#2930) * docs(website_docs): fix toc * docs(website_docs): fix toc * update exporting_data.md for rerun check-links * update exporting_data.md for rerun check-links Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn * Update getting-started.md (#2984) grammar edit for line 175 of readme * fix typo (#2986) * fix typo * spell fix * typo fix (#2991) * added traces.txt to gitignore for fib (#2993) * Deprecate Library and move all uses to Scope (#2977) * Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn * Update based on feedback * Revert change Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella * Feat/bridge support text map (#2911) * feat: support TextMap * doc: add comment * test: support for ot.TextMap * Retrieve lost code due to merge * fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders * go mod tidy * Optimized code style, add changelog * doc: Restore comments * wip: add test cases * test: fix args error * delete empty line * Fix syntax and changelog errors * Fix formatting errors Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add a release template (#2863) * Add a release template * Update the about field Co-authored-by: Damien Mathieu <42@dmathieu.com> * Fix linting Issues * Add ignore for template link Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add workflow to automate bundling dependabot PRs (#2997) Signed-off-by: Anthony J Mirabella * Release prep 1.8.0 (#3001) * Update CHANGELOG and versions.yaml for 1.8.0 release Signed-off-by: Anthony J Mirabella * Update go-build-tools Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.8.0 * Prepare experimental-metrics for version v0.31.0 * Prepare bridge for version v0.31.0 * `make go-mod-tidy` should use `-compat=1.17` now Signed-off-by: Anthony J Mirabella * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Add benchmark metric test for UpDownCounter (#2655) * add benchmark metric test for UpDownCounter * move counter annotation up * fix syncFloat64 to syncInt64 * fix syncFloat64 to syncInt64 * fix go-lint err * Add semconv/v1.11.0 (#3009) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add semconv/v1.12.0 (#3010) * Add semconv/v1.12.0 * Update all semconv use to v1.12.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add http.method attribute to http server metric (#3018) * Add http.method attribute to http server metric Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix for reviews Signed-off-by: Ziqi Zhao * add changelog entry Signed-off-by: Ziqi Zhao * Add tests and fix opentracing bridge defer warning (#3029) * add tests and fix opentracing bridge defer warning * add changelog entry * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/bridge_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Introduce "split" metric schema transformation (#2999) This is a new transformation type that allows to describe a change where a metric is converted to several other metrics by eliminating an attribute. An example of such change that happened recently is this: https://github.com/open-telemetry/opentelemetry-specification/pull/2617 This PR implements specification change https://github.com/open-telemetry/opentelemetry-specification/pull/2653 This PR creates package v1.1 for the new functionality. The old package v1.0 remains unchanged. * Release v1.9.0 (#3052) * Bump versions in versions.yaml * Prepare stable-v1 for version v1.9.0 * Prepare experimental-schema for version v0.0.3 * Update changelog for release * Replace ioutil with io and os (#3058) * Make several vars into consts (#3068) * Add support for Go 1.19 (#3077) * Add support for Go 1.19 * Update CHANGELOG.md Co-authored-by: Sam Xie Co-authored-by: Sam Xie * Update compatibility documentation (#3079) Remove 3 month timeline for backwards support of old versions of Go. Signed-off-by: Brad Topol Signed-off-by: Anthony J Mirabella Signed-off-by: Ziqi Zhao Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung Co-authored-by: Tobias Klauser Co-authored-by: petrie <244236866@qq.com> Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Brad Topol Co-authored-by: Craig Pastro Co-authored-by: Kshitija Murudi Co-authored-by: Petrie Liu Co-authored-by: Guangya Liu Co-authored-by: Craig Pastro Co-authored-by: Anthony Mirabella Co-authored-by: ttoad Co-authored-by: Ziqi Zhao Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Co-authored-by: Håvard Anda Estensen Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Sam Xie * Adds the option to ignore timestamps in metric data tests. (#3076) * Adds the option to ignore timestamps in metric data tests * use config over bool Co-authored-by: Tyler Yahn * Adds a pipelineRegistry to manage creating aggregators. (#3044) * Adds a pipelineRegistry to manage creating aggregators. * Made pipeline generic * Add aggregation filter to the registry. Co-authored-by: Chester Cheung * Remove stale TODO (#3083) The aggregation transform function was added in #2958. * Add back the otlpmetric transforms (#3065) * Add otlpmetric transforms * Split aggregation transforms to own file * Rename Iterator to AttrIter * Update pkg docs These are internal docs use developer based language. * Document all exported funcs * Unify metricdata type transforms into one file * Rename metrics.go to metricdata.go * Copy back attribute tests * Copy back in Iterator test * Refactor attribute tests * Add tests for metricdata transforms * Add multiErr support for digestible transform errs * Test transform errors * go mod tidy * Use key field * goimported * gofmt-ed * Fix error documentation * go mod tidy * Changes instruments uniqueness in pipeline. (#3071) * Changes instruments uniquness in pipeline. * Fix lint * Update sdk/metric/pipeline.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Restore the exporters/otlp/otlpmetric/internal/otelconfig package (#3090) * Restore otlpmetric/otlpconfig from main * Rename otlpconfig to oconf * Remove the empty envconfig_test.go * Update import of otlpconfig in oconf_test * go mod tidy * Run make * add internal OpenCensus metric translation library (#3099) * reintroduce opencensus trace bridge (#3098) Co-authored-by: Tyler Yahn * Document the sdk/metric/view package (#3086) * Add package documentation for sdk/metric/view * Refer to views not configs in WithReader docs * Fix vanity url for view_test.go * Add example tests for view options * Add package example * Fix view type docs * Remove build constraint for doc.go * Fix lint * Adds async instruments and providers. (#3084) * Adds instrument providers and instruments. * Don't return nil instrument, return with error * removed sync * Added a number of tests. Signed-off-by: GitHub * Address PR comments * fix error messages * fixes typo in test name Signed-off-by: GitHub * Fix lint issues * moved the testCallback into the TestMeterCreateInstrument Signed-off-by: GitHub Co-authored-by: Tyler Yahn * Merge branch 'main' into new_sdk/main (#3111) * Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files * Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung * Use ByteSliceToString from golang.org/x/sys/unix (#2924) Use unix.ByteSliceToString to convert Utsname []byte fields to strings. This also allows to drop the charsToString helper which serves the same purpose and matches ByteSliceToString's implementation. Signed-off-by: Tobias Klauser Co-authored-by: Tyler Yahn * docs: fix typo (#2935) * add timeout to grpc connection in otel-collector example (#2939) * Closes: #2951 (#2952) This PR updates the example listed in the getting started doc so that it will compile without error. It also makes this example consistent with the code found in https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go Signed-off-by: Brad Topol * fix data-model link (#2955) * Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (#2960) * Move to using Instrumentation Scope (#2976) * Move to using Instrumentation Scope * Use type alias, not definition * Add a changelog entry * docs(website_docs): fix exporting_data.md and getting-started.md toc (#2930) * docs(website_docs): fix toc * docs(website_docs): fix toc * update exporting_data.md for rerun check-links * update exporting_data.md for rerun check-links Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn * Update getting-started.md (#2984) grammar edit for line 175 of readme * fix typo (#2986) * fix typo * spell fix * typo fix (#2991) * added traces.txt to gitignore for fib (#2993) * Deprecate Library and move all uses to Scope (#2977) * Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn * Update based on feedback * Revert change Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella * Feat/bridge support text map (#2911) * feat: support TextMap * doc: add comment * test: support for ot.TextMap * Retrieve lost code due to merge * fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders * go mod tidy * Optimized code style, add changelog * doc: Restore comments * wip: add test cases * test: fix args error * delete empty line * Fix syntax and changelog errors * Fix formatting errors Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add a release template (#2863) * Add a release template * Update the about field Co-authored-by: Damien Mathieu <42@dmathieu.com> * Fix linting Issues * Add ignore for template link Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add workflow to automate bundling dependabot PRs (#2997) Signed-off-by: Anthony J Mirabella * Release prep 1.8.0 (#3001) * Update CHANGELOG and versions.yaml for 1.8.0 release Signed-off-by: Anthony J Mirabella * Update go-build-tools Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.8.0 * Prepare experimental-metrics for version v0.31.0 * Prepare bridge for version v0.31.0 * `make go-mod-tidy` should use `-compat=1.17` now Signed-off-by: Anthony J Mirabella * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Add benchmark metric test for UpDownCounter (#2655) * add benchmark metric test for UpDownCounter * move counter annotation up * fix syncFloat64 to syncInt64 * fix syncFloat64 to syncInt64 * fix go-lint err * Add semconv/v1.11.0 (#3009) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add semconv/v1.12.0 (#3010) * Add semconv/v1.12.0 * Update all semconv use to v1.12.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add http.method attribute to http server metric (#3018) * Add http.method attribute to http server metric Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix for reviews Signed-off-by: Ziqi Zhao * add changelog entry Signed-off-by: Ziqi Zhao * Add tests and fix opentracing bridge defer warning (#3029) * add tests and fix opentracing bridge defer warning * add changelog entry * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/bridge_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Introduce "split" metric schema transformation (#2999) This is a new transformation type that allows to describe a change where a metric is converted to several other metrics by eliminating an attribute. An example of such change that happened recently is this: https://github.com/open-telemetry/opentelemetry-specification/pull/2617 This PR implements specification change https://github.com/open-telemetry/opentelemetry-specification/pull/2653 This PR creates package v1.1 for the new functionality. The old package v1.0 remains unchanged. * Release v1.9.0 (#3052) * Bump versions in versions.yaml * Prepare stable-v1 for version v1.9.0 * Prepare experimental-schema for version v0.0.3 * Update changelog for release * Replace ioutil with io and os (#3058) * Make several vars into consts (#3068) * Add support for Go 1.19 (#3077) * Add support for Go 1.19 * Update CHANGELOG.md Co-authored-by: Sam Xie Co-authored-by: Sam Xie * Update compatibility documentation (#3079) Remove 3 month timeline for backwards support of old versions of Go. * Fix `opentracing.Bridge` where it miss identifying the spanKind (#3096) * Fix opentracing.Bridge where it was not identifying the spanKinf correctly * fix test * changelog * Keeping backward comppatibillity * Update CHANGELOG.md Co-authored-by: Anthony Mirabella * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Chester Cheung * replace `required` by `requirementlevel` (#3103) * Change the inclusivity of exponential histogram bounds (#2982) * Use lower-inclusive boundaries * make exponent and logarithm more symmetric Co-authored-by: Anthony Mirabella Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Update golangci-lint to v1.48.0 (#3105) * Update golangci-lint to v1.48.0 Co-authored-by: Chester Cheung * Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) * Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Signed-off-by: Brad Topol Signed-off-by: Anthony J Mirabella Signed-off-by: Ziqi Zhao Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung Co-authored-by: Tobias Klauser Co-authored-by: petrie <244236866@qq.com> Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Brad Topol Co-authored-by: Craig Pastro Co-authored-by: Kshitija Murudi Co-authored-by: Petrie Liu Co-authored-by: Guangya Liu Co-authored-by: Craig Pastro Co-authored-by: Anthony Mirabella Co-authored-by: ttoad Co-authored-by: Ziqi Zhao Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Co-authored-by: Håvard Anda Estensen Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Sam Xie Co-authored-by: Alan Protasio Co-authored-by: Joshua MacDonald * Add otlpmetric exporter (#3089) * Add otlpmetric package doc * Add Client interface * Add the Exporter Have the Exporter ensure synchronous access to all client methods. * Add race detection test for Exporter * Expand New godocs * Fix lint * Merge transform and upload errors * Fix ineffectual increment * Make pipelineRegistry non-generic (#3115) * Make pipelineRegistry non-generic * Add Synchronous instruments (#3124) * Add Synchronous instruments * remove duplicate code in instrument * Fixes to Histogram comments * Add back the otlpmetricgrpc exporter (#3094) * Add otlpmetric package doc * Add Client interface * Add the Exporter Have the Exporter ensure synchronous access to all client methods. * Add race detection test for Exporter * Expand New godocs * Fix lint * Add the otlpmetricgrpc Go module * Restore otlpmetricgrpc from main * Remove integration testing from otlpmetricgrpc * Fix import of otlpconfig to oconf * Update client Add ForceFlush method to satisfy otlpmetric.Client, unexport Start, and restructure NewClient to return a started client. * Update otlpmetricgrpc New functions Remove NewUnstarted and only export New. * Remove unneeded client sync The exporter handle the synchronization of client method calls. * Update example_test.go * Update client_unit_test.go * Rename client_unit_test.go to client_test.go * Rename options.go to config.go * Add package doc * Unify exporter.go and doc.go into client.go * Unexport NewClient * Correct option documentation * Add env config documentation * go mod tidy * Restrict build to Go 1.18 * Update client.go Fix copied UploadMetrics documentation. * Run make * Close client conn even if context deadline reached * Add sdk/metric Go pkg docs and example (#3139) * Add sdk/metric Go pkg docs * Add example_test.go * Add Go 1.18 build guard to example_test.go * Merge main into new_sdk/main (#3141) * Use already enabled revive linter and add depguard (#2883) * Refactor golangci-lint conf Order settings alphabetically. * Add revive settings to golangci conf * Check blank imports * Check bool-literal-in-expr * Check constant-logical-expr * Check context-as-argument * Check context-key-type * Check deep-exit * Check defer * Check dot-imports * Check duplicated-imports * Check early-return * Check empty-block * Check empty-lines * Check error-naming * Check error-return * Check error-strings * Check errorf * Stop ignoring context first arg in tests * Check exported comments * Check flag-parameter * Check identical branches * Check if-return * Check increment-decrement * Check indent-error-flow * Check deny list of go imports * Check import shadowing * Check package comments * Check range * Check range val in closure * Check range val address * Check redefines builtin id * Check string-format * Check struct tag * Check superfluous else * Check time equal * Check var naming * Check var declaration * Check unconditional recursion * Check unexported return * Check unhandled errors * Check unnecessary stmt * Check unnecessary break * Check waitgroup by value * Exclude deep-exit check in example*_test.go files * Move the minimum version to go 1.17 (#2917) * Move the minimum version to go 1.17 * Update readme and changelog Co-authored-by: Chester Cheung * Use ByteSliceToString from golang.org/x/sys/unix (#2924) Use unix.ByteSliceToString to convert Utsname []byte fields to strings. This also allows to drop the charsToString helper which serves the same purpose and matches ByteSliceToString's implementation. Signed-off-by: Tobias Klauser Co-authored-by: Tyler Yahn * docs: fix typo (#2935) * add timeout to grpc connection in otel-collector example (#2939) * Closes: #2951 (#2952) This PR updates the example listed in the getting started doc so that it will compile without error. It also makes this example consistent with the code found in https://github.com/open-telemetry/opentelemetry-go/blob/main/example/fib/main.go Signed-off-by: Brad Topol * fix data-model link (#2955) * Bump go.opentelemetry.io/proto/otlp from v0.16.0 to v0.18.0 (#2960) * Move to using Instrumentation Scope (#2976) * Move to using Instrumentation Scope * Use type alias, not definition * Add a changelog entry * docs(website_docs): fix exporting_data.md and getting-started.md toc (#2930) * docs(website_docs): fix toc * docs(website_docs): fix toc * update exporting_data.md for rerun check-links * update exporting_data.md for rerun check-links Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn * Update getting-started.md (#2984) grammar edit for line 175 of readme * fix typo (#2986) * fix typo * spell fix * typo fix (#2991) * added traces.txt to gitignore for fib (#2993) * Deprecate Library and move all uses to Scope (#2977) * Deprecate Library and move all uses to Scope * Add PR number to changelog * Don't change signatures in stable modules * Revert some changes * Rename internal struct names * A bit more renaming * Update sdk/trace/span.go Co-authored-by: Tyler Yahn * Update based on feedback * Revert change Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella * Feat/bridge support text map (#2911) * feat: support TextMap * doc: add comment * test: support for ot.TextMap * Retrieve lost code due to merge * fix: retrieve lost code due to merge. test: support for ot.HTTPHeaders * go mod tidy * Optimized code style, add changelog * doc: Restore comments * wip: add test cases * test: fix args error * delete empty line * Fix syntax and changelog errors * Fix formatting errors Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add a release template (#2863) * Add a release template * Update the about field Co-authored-by: Damien Mathieu <42@dmathieu.com> * Fix linting Issues * Add ignore for template link Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella * Add workflow to automate bundling dependabot PRs (#2997) Signed-off-by: Anthony J Mirabella * Release prep 1.8.0 (#3001) * Update CHANGELOG and versions.yaml for 1.8.0 release Signed-off-by: Anthony J Mirabella * Update go-build-tools Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.8.0 * Prepare experimental-metrics for version v0.31.0 * Prepare bridge for version v0.31.0 * `make go-mod-tidy` should use `-compat=1.17` now Signed-off-by: Anthony J Mirabella * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Add benchmark metric test for UpDownCounter (#2655) * add benchmark metric test for UpDownCounter * move counter annotation up * fix syncFloat64 to syncInt64 * fix syncFloat64 to syncInt64 * fix go-lint err * Add semconv/v1.11.0 (#3009) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add semconv/v1.12.0 (#3010) * Add semconv/v1.12.0 * Update all semconv use to v1.12.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add http.method attribute to http server metric (#3018) * Add http.method attribute to http server metric Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix lint Signed-off-by: Ziqi Zhao * fix for reviews Signed-off-by: Ziqi Zhao * add changelog entry Signed-off-by: Ziqi Zhao * Add tests and fix opentracing bridge defer warning (#3029) * add tests and fix opentracing bridge defer warning * add changelog entry * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/bridge_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn * Introduce "split" metric schema transformation (#2999) This is a new transformation type that allows to describe a change where a metric is converted to several other metrics by eliminating an attribute. An example of such change that happened recently is this: https://github.com/open-telemetry/opentelemetry-specification/pull/2617 This PR implements specification change https://github.com/open-telemetry/opentelemetry-specification/pull/2653 This PR creates package v1.1 for the new functionality. The old package v1.0 remains unchanged. * Release v1.9.0 (#3052) * Bump versions in versions.yaml * Prepare stable-v1 for version v1.9.0 * Prepare experimental-schema for version v0.0.3 * Update changelog for release * Replace ioutil with io and os (#3058) * Make several vars into consts (#3068) * Add support for Go 1.19 (#3077) * Add support for Go 1.19 * Update CHANGELOG.md Co-authored-by: Sam Xie Co-authored-by: Sam Xie * Update compatibility documentation (#3079) Remove 3 month timeline for backwards support of old versions of Go. * Fix `opentracing.Bridge` where it miss identifying the spanKind (#3096) * Fix opentracing.Bridge where it was not identifying the spanKinf correctly * fix test * changelog * Keeping backward comppatibillity * Update CHANGELOG.md Co-authored-by: Anthony Mirabella * Update CHANGELOG.md Co-authored-by: Anthony Mirabella Co-authored-by: Chester Cheung * replace `required` by `requirementlevel` (#3103) * Change the inclusivity of exponential histogram bounds (#2982) * Use lower-inclusive boundaries * make exponent and logarithm more symmetric Co-authored-by: Anthony Mirabella Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Update golangci-lint to v1.48.0 (#3105) * Update golangci-lint to v1.48.0 Co-authored-by: Chester Cheung * Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 (#3107) * Bump go.opentelemetry.io/proto/otlp from v0.18.0 to v0.19.0 Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Update tracer to guard for a nil ctx (#3110) * Update tracer to guard for a nil ctx Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn * Fix sdk/instrumentation pkg docs (#3130) * Add instrumentation scope attributes (#3131) * Add WithScopeAttributes TracerOption to trace API * Add Attributes field to instrumentation Scope * Use scope attributes for new Tracer * Fix stdouttrace expected test output * Allow unexported Set fields in sdk/trace test * Export instrumentation scope attrs in OTLP * Add changes to the changelog * Fix imports with make lint * Add unit tests for WithScopeAttributes * Fix English in Scope documentation * Add WithScopeAttributes MeterOption to metric API package (#3132) * Add WithScopeAttributes MeterOption to metric pkg * Add MeterConfig unit tests * Add changes to changelog * Fix import linting * Update MeterProvider documentation Include information about how to use WithScopeAttributes. * Refactor TracerProvider documentation (#3133) * Refactor TracerProvider documentation * Fix English article * Grammar fixes * consistency-of: Changed signal names for website docs (#3137) * Shut down all processors even on error (#3091) * Fix stdoutmetric example test The merged instrumentation Scope includes SchemaURL and Attributes now, add them to the expected output. Signed-off-by: Brad Topol Signed-off-by: Anthony J Mirabella Signed-off-by: Ziqi Zhao Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Chester Cheung Co-authored-by: Tobias Klauser Co-authored-by: petrie <244236866@qq.com> Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Brad Topol Co-authored-by: Craig Pastro Co-authored-by: Kshitija Murudi Co-authored-by: Petrie Liu Co-authored-by: Guangya Liu Co-authored-by: Craig Pastro Co-authored-by: Anthony Mirabella Co-authored-by: ttoad Co-authored-by: Ziqi Zhao Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Co-authored-by: Håvard Anda Estensen Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Sam Xie Co-authored-by: Alan Protasio Co-authored-by: Joshua MacDonald Co-authored-by: Mitch Usher Co-authored-by: Gaurang Patel * Remove empty metrictest pkg (#3148) * Add exporters/otlp/otlpmetric/internal/otest (#3125) * Add otlpmetric package doc * Add Client interface * Add the Exporter Have the Exporter ensure synchronous access to all client methods. * Add race detection test for Exporter * Expand New godocs * Fix lint * Restore otlpmetrictest from main * Rename otlpmetrictest to otest * Remove data.go The functions and types it contains are no longer relevant to the SDK. * Update client context error tests Remove multiple shutdown tests. The Client interface states this should never happen. * Remove collector.go and otlptest.go * Expand client tests with ctx and force-flush * Add UploadMetrics tests * Test the tests with a trivial client * Condense all to client.go * Example of how to run RunClientTests * Add client integration testing * Add GRPCCollector * Remove GRPCCollector to limit scope of PR * Add back the otlpmetrichttp exporter (#3097) * Add otlpmetric package doc * Add Client interface * Add the Exporter Have the Exporter ensure synchronous access to all client methods. * Add race detection test for Exporter * Expand New godocs * Fix lint * Add back the otlpmetrichttp pkg from main * Restrict to Go 1.18 and above * Remove integration testing * Rename client_unit_test.go to client_test.go * Rename options.go to config.go * Remove the NewUnstarted func * Remove Start method from client * Add no-op ForceFlush method to client * Update otlpconfig pkg name to oconf * Rename Stop method to Shutdown Match the otlpmetric.Client interface. * Update creation functions to compile * Remove name field from client * Remove sync of methods from client This is handled by the exporter. * Remove unused generalCfg field from client * Replace cfg client field with used conf vals * Use a http request instead of url/header fields * Remove NewClient and move New into client.go * Rename client.client field to client.httpClient * Update client tests Remove test of a retry config and add functional tests of the client methods honoring a context. * Remove deprecated WithMaxAttempts and WithBackoff * Update option docs Include info on envvars. * Fix lint * Fix lint errors * Revert New to accept a context * Add example test * Update pkg docs * go mod tidy * Use url.URL to form HTTP request URL * Remove stale TODO in sdk/view (#3149) Co-authored-by: Chester Cheung * Use unique metric testing data in reader_test (#3151) Address unresolved TODO. Co-authored-by: Chester Cheung * Add new metric SDK changes to changelog (#3150) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add integration and config testing to otlpmetricgrpc (#3126) * Add the GRPCCollector to otest * Use otest to test otlpmetricgrpc Client * Add WithHeaders and WithTimeout tests * Add integration and config testing to otlpmetrichttp (#3155) * Add HTTPCollector to otest * Add integration testing for otlpmetrichttp * Fix NewHTTPCollector docs * Add config tests * Fix lint * Add WithURLPath test * Add WithTLSClientConfig test * Ignore depguard for crypto/x509/pkix This is a testing package that uses the package to generate a weak testing TLS certificate. * Add Prometheus exporter code (#3135) * Add Prometheus exporter example (#3168) * Add back prom exporter to README.md * Fix removal changes from #3154 in API * Update CHANGELOG with PR number Signed-off-by: Brad Topol Signed-off-by: Anthony J Mirabella Signed-off-by: Ziqi Zhao Signed-off-by: GitHub Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella Co-authored-by: Tobias Klauser Co-authored-by: petrie <244236866@qq.com> Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Brad Topol Co-authored-by: Craig Pastro Co-authored-by: Kshitija Murudi Co-authored-by: Petrie Liu Co-authored-by: Guangya Liu Co-authored-by: Craig Pastro Co-authored-by: ttoad Co-authored-by: Ziqi Zhao Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Co-authored-by: Håvard Anda Estensen Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Sam Xie Co-authored-by: David Ashpole Co-authored-by: Alan Protasio Co-authored-by: Joshua MacDonald Co-authored-by: Mitch Usher Co-authored-by: Gaurang Patel Co-authored-by: Mike Dame --- .github/dependabot.yml | 12 +- CHANGELOG.md | 34 + bridge/opencensus/README.md | 47 - bridge/opencensus/aggregation.go | 157 ---- bridge/opencensus/aggregation_test.go | 322 ------- bridge/opencensus/exporter.go | 186 ---- bridge/opencensus/exporter_test.go | 475 ---------- bridge/opencensus/go.mod | 11 - bridge/opencensus/go.sum | 4 - .../opencensus/opencensusmetric}/doc.go | 8 +- bridge/opencensus/opencensusmetric/go.mod | 28 + bridge/opencensus/opencensusmetric/go.sum | 98 ++ .../opencensusmetric/internal/metric.go | 219 +++++ .../opencensusmetric/internal/metric_test.go | 667 ++++++++++++++ bridge/opencensus/test/go.mod | 6 - bridge/opencensus/test/go.sum | 1 - example/opencensus/go.mod | 38 - example/opencensus/go.sum | 61 -- example/opencensus/main.go | 154 ---- .../prometheus/doc.go | 3 +- example/prometheus/go.mod | 26 +- example/prometheus/go.sum | 27 +- example/prometheus/main.go | 148 ++- exporters/otlp/otlpmetric/client.go | 52 ++ exporters/otlp/otlpmetric/clients.go | 43 - exporters/otlp/otlpmetric/doc.go | 20 + exporters/otlp/otlpmetric/exporter.go | 153 ++-- exporters/otlp/otlpmetric/exporter_test.go | 861 ++---------------- exporters/otlp/otlpmetric/go.mod | 22 +- exporters/otlp/otlpmetric/go.sum | 12 +- .../internal/metrictransform/attribute.go | 158 ---- .../metrictransform/attribute_test.go | 258 ------ .../internal/metrictransform/metric.go | 437 --------- .../internal/metrictransform/metric_test.go | 314 ------- .../internal/metrictransform/resource_test.go | 48 - .../{otlpconfig => oconf}/envconfig.go | 2 +- .../internal/{otlpconfig => oconf}/options.go | 2 +- .../{otlpconfig => oconf}/options_test.go | 132 +-- .../{otlpconfig => oconf}/optiontypes.go | 2 +- .../internal/{otlpconfig => oconf}/tls.go | 2 +- .../otlp/otlpmetric/internal/otest/client.go | 254 ++++++ .../otlpmetric/internal/otest/client_test.go | 54 ++ .../otlpmetric/internal/otest/collector.go | 428 +++++++++ .../internal/otlpmetrictest/client.go | 132 --- .../internal/otlpmetrictest/collector.go | 55 -- .../internal/otlpmetrictest/data.go | 71 -- .../internal/otlpmetrictest/otlptest.go | 174 ---- .../internal/transform/attribute.go | 155 ++++ .../internal/transform/attribute_test.go | 197 ++++ .../otlp/otlpmetric/internal/transform/doc.go | 14 +- .../otlpmetric/internal/transform/error.go | 114 +++ .../internal/transform/error_test.go | 91 ++ .../internal/transform/metricdata.go | 207 +++++ .../internal/transform/metricdata_test.go | 355 ++++++++ exporters/otlp/otlpmetric/options.go | 43 - .../otlp/otlpmetric/otlpmetricgrpc/client.go | 162 ++-- .../otlpmetric/otlpmetricgrpc/client_test.go | 411 +++------ .../otlpmetricgrpc/client_unit_test.go | 193 ---- .../otlp/otlpmetric/otlpmetricgrpc/config.go | 241 +++++ .../otlpmetricgrpc/{exporter.go => doc.go} | 18 +- .../otlpmetric/otlpmetricgrpc/example_test.go | 184 +--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 5 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 2 +- .../otlpmetricgrpc/mock_collector_test.go | 169 ---- .../otlp/otlpmetric/otlpmetricgrpc/options.go | 189 ---- .../otlpmetrichttp/certificate_test.go | 92 -- .../otlp/otlpmetric/otlpmetrichttp/client.go | 190 ++-- .../otlpmetric/otlpmetrichttp/client_test.go | 354 +++---- .../otlpmetrichttp/client_unit_test.go | 68 -- .../otlp/otlpmetric/otlpmetrichttp/config.go | 184 ++++ .../otlp/otlpmetric/otlpmetrichttp/doc.go | 11 +- .../otlpmetric/otlpmetrichttp/example_test.go | 45 + .../otlpmetric/otlpmetrichttp/exporter.go | 31 - .../otlp/otlpmetric/otlpmetrichttp/go.mod | 9 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 2 +- .../otlpmetrichttp/mock_collector_test.go | 239 ----- .../otlp/otlpmetric/otlpmetrichttp/options.go | 185 ---- exporters/prometheus/README.md | 9 - .../number => exporters/prometheus}/doc.go | 13 +- exporters/prometheus/exporter.go | 233 +++++ exporters/prometheus/exporter_test.go | 130 +++ exporters/prometheus/go.mod | 18 +- exporters/prometheus/go.sum | 27 +- exporters/prometheus/prometheus.go | 324 ------- exporters/prometheus/prometheus_test.go | 228 ----- exporters/prometheus/sanitize.go | 50 - exporters/prometheus/sanitize_test.go | 61 -- exporters/prometheus/testdata/counter.txt | 3 + exporters/prometheus/testdata/gauge.txt | 3 + exporters/prometheus/testdata/histogram.txt | 15 + .../prometheus/testdata/sanitized_labels.txt | 3 + exporters/stdout/stdoutmetric/config.go | 110 +-- exporters/stdout/stdoutmetric/doc.go | 12 +- exporters/stdout/stdoutmetric/encoder.go | 43 + exporters/stdout/stdoutmetric/example_test.go | 280 ++++-- exporters/stdout/stdoutmetric/exporter.go | 65 +- .../stdout/stdoutmetric/exporter_test.go | 102 +++ exporters/stdout/stdoutmetric/go.mod | 17 +- exporters/stdout/stdoutmetric/go.sum | 1 - exporters/stdout/stdoutmetric/metric.go | 144 --- exporters/stdout/stdoutmetric/metric_test.go | 260 ------ sdk/metric/aggregation/aggregation.go | 164 ++++ sdk/metric/aggregation/aggregation_test.go | 70 ++ sdk/metric/aggregator/aggregator.go | 114 --- sdk/metric/aggregator/aggregator_test.go | 104 --- sdk/metric/aggregator/aggregatortest/test.go | 307 ------- sdk/metric/aggregator/exponential/README.md | 27 - .../aggregator/exponential/benchmark_test.go | 67 -- .../exponential/mapping/exponent/exponent.go | 127 --- .../mapping/exponent/exponent_test.go | 341 ------- .../exponential/mapping/internal/float64.go | 72 -- .../mapping/internal/float64_test.go | 47 - .../mapping/logarithm/logarithm.go | 190 ---- .../mapping/logarithm/logarithm_test.go | 231 ----- .../aggregator/exponential/mapping/mapping.go | 48 - .../aggregator/histogram/benchmark_test.go | 130 --- sdk/metric/aggregator/histogram/histogram.go | 269 ------ .../aggregator/histogram/histogram_test.go | 295 ------ sdk/metric/aggregator/lastvalue/lastvalue.go | 133 --- .../aggregator/lastvalue/lastvalue_test.go | 146 --- sdk/metric/aggregator/sum/sum.go | 88 -- sdk/metric/aggregator/sum/sum_test.go | 154 ---- sdk/metric/alignment_test.go | 43 - sdk/metric/benchmark_test.go | 444 --------- sdk/metric/config.go | 139 +++ sdk/metric/config_test.go | 134 +++ sdk/metric/controller/basic/config.go | 131 --- sdk/metric/controller/basic/config_test.go | 37 - sdk/metric/controller/basic/controller.go | 382 -------- .../controller/basic/controller_test.go | 493 ---------- sdk/metric/controller/basic/pull_test.go | 121 --- sdk/metric/controller/basic/push_test.go | 230 ----- .../controllertest/controller_test.go | 66 -- sdk/metric/controller/controllertest/test.go | 85 -- sdk/metric/controller/time/time.go | 67 -- sdk/metric/correct_test.go | 572 ------------ sdk/metric/doc.go | 146 +-- sdk/metric/example_test.go | 63 ++ sdk/metric/export/aggregation/aggregation.go | 119 --- sdk/metric/export/aggregation/temporality.go | 117 --- .../export/aggregation/temporality_test.go | 73 -- sdk/metric/export/metric.go | 280 ------ sdk/metric/export/metric_test.go | 71 -- sdk/metric/exporter.go | 61 ++ sdk/metric/go.mod | 25 +- sdk/metric/go.sum | 2 - sdk/metric/histogram_stress_test.go | 67 -- sdk/metric/instrument.go | 76 ++ sdk/metric/instrument_provider.go | 275 ++++++ sdk/metric/internal/aggregator.go | 40 + .../internal/aggregator_example_test.go | 122 +++ sdk/metric/internal/aggregator_test.go | 155 ++++ sdk/metric/internal/doc.go | 18 + sdk/metric/internal/filter.go | 67 ++ sdk/metric/internal/filter_test.go | 202 ++++ sdk/metric/internal/histogram.go | 243 +++++ sdk/metric/internal/histogram_test.go | 203 +++++ sdk/metric/internal/lastvalue.go | 77 ++ sdk/metric/internal/lastvalue_test.go | 91 ++ sdk/metric/internal/sum.go | 156 ++++ sdk/metric/internal/sum_test.go | 135 +++ sdk/metric/manual_reader.go | 134 +++ sdk/metric/manual_reader_test.go | 77 ++ sdk/metric/meter.go | 135 +++ sdk/metric/meter_test.go | 517 +++++++++++ sdk/metric/metricdata/data.go | 133 +++ .../metricdata/metricdatatest/assertion.go | 134 +++ .../metricdatatest/assertion_fail_test.go | 59 ++ .../metricdatatest/assertion_test.go | 319 +++++++ .../metricdata/metricdatatest/comparisons.go | 363 ++++++++ sdk/metric/metricdata/temporality.go | 43 + .../temporality_string.go | 10 +- sdk/metric/metrictest/config.go | 57 -- sdk/metric/metrictest/exporter.go | 200 ---- sdk/metric/metrictest/exporter_test.go | 414 --------- sdk/metric/number/kind_string.go | 24 - sdk/metric/number/number.go | 539 ----------- sdk/metric/number/number_test.go | 212 ----- sdk/metric/periodic_reader.go | 245 +++++ sdk/metric/periodic_reader_test.go | 225 +++++ sdk/metric/pipeline.go | 349 +++++++ sdk/metric/pipeline_registry_test.go | 587 ++++++++++++ sdk/metric/pipeline_test.go | 216 +++++ sdk/metric/processor/basic/basic.go | 383 -------- sdk/metric/processor/basic/basic_test.go | 510 ----------- sdk/metric/processor/basic/config.go | 43 - sdk/metric/processor/processortest/test.go | 432 --------- .../processor/processortest/test_test.go | 90 -- sdk/metric/processor/reducer/doc.go | 60 -- sdk/metric/processor/reducer/reducer.go | 66 -- sdk/metric/processor/reducer/reducer_test.go | 117 --- sdk/metric/provider.go | 126 +++ sdk/metric/provider_test.go | 79 ++ sdk/metric/reader.go | 216 +++++ sdk/metric/reader_test.go | 241 +++++ sdk/metric/refcount_mapped.go | 60 -- sdk/metric/registry/doc.go | 24 - sdk/metric/registry/registry.go | 139 --- sdk/metric/registry/registry_test.go | 112 --- sdk/metric/sdk.go | 423 --------- sdk/metric/sdkapi/descriptor.go | 70 -- sdk/metric/sdkapi/descriptor_test.go | 33 - sdk/metric/sdkapi/instrumentkind.go | 80 -- sdk/metric/sdkapi/instrumentkind_string.go | 28 - sdk/metric/sdkapi/instrumentkind_test.go | 32 - sdk/metric/sdkapi/noop.go | 83 -- sdk/metric/sdkapi/sdkapi.go | 162 ---- sdk/metric/sdkapi/sdkapi_test.go | 41 - sdk/metric/sdkapi/wrap.go | 183 ---- sdk/metric/selector/simple/simple.go | 94 -- sdk/metric/selector/simple/simple_test.go | 66 -- sdk/metric/view/doc.go | 20 + sdk/metric/view/example_test.go | 199 ++++ .../metric/view/instrument.go | 23 +- sdk/metric/view/instrumentkind.go | 46 + sdk/metric/view/view.go | 235 +++++ sdk/metric/view/view_test.go | 447 +++++++++ 217 files changed, 12735 insertions(+), 18901 deletions(-) delete mode 100644 bridge/opencensus/aggregation.go delete mode 100644 bridge/opencensus/aggregation_test.go delete mode 100644 bridge/opencensus/exporter.go delete mode 100644 bridge/opencensus/exporter_test.go rename {sdk/metric/metrictest => bridge/opencensus/opencensusmetric}/doc.go (76%) create mode 100644 bridge/opencensus/opencensusmetric/go.mod create mode 100644 bridge/opencensus/opencensusmetric/go.sum create mode 100644 bridge/opencensus/opencensusmetric/internal/metric.go create mode 100644 bridge/opencensus/opencensusmetric/internal/metric_test.go delete mode 100644 example/opencensus/go.mod delete mode 100644 example/opencensus/go.sum delete mode 100644 example/opencensus/main.go rename exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go => example/prometheus/doc.go (88%) create mode 100644 exporters/otlp/otlpmetric/client.go delete mode 100644 exporters/otlp/otlpmetric/clients.go create mode 100644 exporters/otlp/otlpmetric/doc.go delete mode 100644 exporters/otlp/otlpmetric/internal/metrictransform/attribute.go delete mode 100644 exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/metrictransform/metric.go delete mode 100644 exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/metrictransform/resource_test.go rename exporters/otlp/otlpmetric/internal/{otlpconfig => oconf}/envconfig.go (97%) rename exporters/otlp/otlpmetric/internal/{otlpconfig => oconf}/options.go (98%) rename exporters/otlp/otlpmetric/internal/{otlpconfig => oconf}/options_test.go (70%) rename exporters/otlp/otlpmetric/internal/{otlpconfig => oconf}/optiontypes.go (95%) rename exporters/otlp/otlpmetric/internal/{otlpconfig => oconf}/tls.go (92%) create mode 100644 exporters/otlp/otlpmetric/internal/otest/client.go create mode 100644 exporters/otlp/otlpmetric/internal/otest/client_test.go create mode 100644 exporters/otlp/otlpmetric/internal/otest/collector.go delete mode 100644 exporters/otlp/otlpmetric/internal/otlpmetrictest/client.go delete mode 100644 exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go delete mode 100644 exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go delete mode 100644 exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go create mode 100644 exporters/otlp/otlpmetric/internal/transform/attribute.go create mode 100644 exporters/otlp/otlpmetric/internal/transform/attribute_test.go rename sdk/metric/atomicfields.go => exporters/otlp/otlpmetric/internal/transform/doc.go (64%) create mode 100644 exporters/otlp/otlpmetric/internal/transform/error.go create mode 100644 exporters/otlp/otlpmetric/internal/transform/error_test.go create mode 100644 exporters/otlp/otlpmetric/internal/transform/metricdata.go create mode 100644 exporters/otlp/otlpmetric/internal/transform/metricdata_test.go delete mode 100644 exporters/otlp/otlpmetric/options.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/client_unit_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/config.go rename exporters/otlp/otlpmetric/otlpmetricgrpc/{exporter.go => doc.go} (61%) delete mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/options.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/certificate_test.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/client_unit_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/config.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/options.go delete mode 100644 exporters/prometheus/README.md rename {sdk/metric/number => exporters/prometheus}/doc.go (59%) create mode 100644 exporters/prometheus/exporter.go create mode 100644 exporters/prometheus/exporter_test.go delete mode 100644 exporters/prometheus/prometheus.go delete mode 100644 exporters/prometheus/prometheus_test.go delete mode 100644 exporters/prometheus/sanitize.go delete mode 100644 exporters/prometheus/sanitize_test.go create mode 100755 exporters/prometheus/testdata/counter.txt create mode 100644 exporters/prometheus/testdata/gauge.txt create mode 100644 exporters/prometheus/testdata/histogram.txt create mode 100755 exporters/prometheus/testdata/sanitized_labels.txt create mode 100644 exporters/stdout/stdoutmetric/encoder.go create mode 100644 exporters/stdout/stdoutmetric/exporter_test.go delete mode 100644 exporters/stdout/stdoutmetric/metric.go delete mode 100644 exporters/stdout/stdoutmetric/metric_test.go create mode 100644 sdk/metric/aggregation/aggregation.go create mode 100644 sdk/metric/aggregation/aggregation_test.go delete mode 100644 sdk/metric/aggregator/aggregator.go delete mode 100644 sdk/metric/aggregator/aggregator_test.go delete mode 100644 sdk/metric/aggregator/aggregatortest/test.go delete mode 100644 sdk/metric/aggregator/exponential/README.md delete mode 100644 sdk/metric/aggregator/exponential/benchmark_test.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/exponent/exponent.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/exponent/exponent_test.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/internal/float64.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/internal/float64_test.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/logarithm/logarithm_test.go delete mode 100644 sdk/metric/aggregator/exponential/mapping/mapping.go delete mode 100644 sdk/metric/aggregator/histogram/benchmark_test.go delete mode 100644 sdk/metric/aggregator/histogram/histogram.go delete mode 100644 sdk/metric/aggregator/histogram/histogram_test.go delete mode 100644 sdk/metric/aggregator/lastvalue/lastvalue.go delete mode 100644 sdk/metric/aggregator/lastvalue/lastvalue_test.go delete mode 100644 sdk/metric/aggregator/sum/sum.go delete mode 100644 sdk/metric/aggregator/sum/sum_test.go delete mode 100644 sdk/metric/alignment_test.go delete mode 100644 sdk/metric/benchmark_test.go create mode 100644 sdk/metric/config.go create mode 100644 sdk/metric/config_test.go delete mode 100644 sdk/metric/controller/basic/config.go delete mode 100644 sdk/metric/controller/basic/config_test.go delete mode 100644 sdk/metric/controller/basic/controller.go delete mode 100644 sdk/metric/controller/basic/controller_test.go delete mode 100644 sdk/metric/controller/basic/pull_test.go delete mode 100644 sdk/metric/controller/basic/push_test.go delete mode 100644 sdk/metric/controller/controllertest/controller_test.go delete mode 100644 sdk/metric/controller/controllertest/test.go delete mode 100644 sdk/metric/controller/time/time.go delete mode 100644 sdk/metric/correct_test.go create mode 100644 sdk/metric/example_test.go delete mode 100644 sdk/metric/export/aggregation/aggregation.go delete mode 100644 sdk/metric/export/aggregation/temporality.go delete mode 100644 sdk/metric/export/aggregation/temporality_test.go delete mode 100644 sdk/metric/export/metric.go delete mode 100644 sdk/metric/export/metric_test.go create mode 100644 sdk/metric/exporter.go delete mode 100644 sdk/metric/histogram_stress_test.go create mode 100644 sdk/metric/instrument.go create mode 100644 sdk/metric/instrument_provider.go create mode 100644 sdk/metric/internal/aggregator.go create mode 100644 sdk/metric/internal/aggregator_example_test.go create mode 100644 sdk/metric/internal/aggregator_test.go create mode 100644 sdk/metric/internal/doc.go create mode 100644 sdk/metric/internal/filter.go create mode 100644 sdk/metric/internal/filter_test.go create mode 100644 sdk/metric/internal/histogram.go create mode 100644 sdk/metric/internal/histogram_test.go create mode 100644 sdk/metric/internal/lastvalue.go create mode 100644 sdk/metric/internal/lastvalue_test.go create mode 100644 sdk/metric/internal/sum.go create mode 100644 sdk/metric/internal/sum_test.go create mode 100644 sdk/metric/manual_reader.go create mode 100644 sdk/metric/manual_reader_test.go create mode 100644 sdk/metric/meter.go create mode 100644 sdk/metric/meter_test.go create mode 100644 sdk/metric/metricdata/data.go create mode 100644 sdk/metric/metricdata/metricdatatest/assertion.go create mode 100644 sdk/metric/metricdata/metricdatatest/assertion_fail_test.go create mode 100644 sdk/metric/metricdata/metricdatatest/assertion_test.go create mode 100644 sdk/metric/metricdata/metricdatatest/comparisons.go create mode 100644 sdk/metric/metricdata/temporality.go rename sdk/metric/{export/aggregation => metricdata}/temporality_string.go (66%) delete mode 100644 sdk/metric/metrictest/config.go delete mode 100644 sdk/metric/metrictest/exporter.go delete mode 100644 sdk/metric/metrictest/exporter_test.go delete mode 100644 sdk/metric/number/kind_string.go delete mode 100644 sdk/metric/number/number.go delete mode 100644 sdk/metric/number/number_test.go create mode 100644 sdk/metric/periodic_reader.go create mode 100644 sdk/metric/periodic_reader_test.go create mode 100644 sdk/metric/pipeline.go create mode 100644 sdk/metric/pipeline_registry_test.go create mode 100644 sdk/metric/pipeline_test.go delete mode 100644 sdk/metric/processor/basic/basic.go delete mode 100644 sdk/metric/processor/basic/basic_test.go delete mode 100644 sdk/metric/processor/basic/config.go delete mode 100644 sdk/metric/processor/processortest/test.go delete mode 100644 sdk/metric/processor/processortest/test_test.go delete mode 100644 sdk/metric/processor/reducer/doc.go delete mode 100644 sdk/metric/processor/reducer/reducer.go delete mode 100644 sdk/metric/processor/reducer/reducer_test.go create mode 100644 sdk/metric/provider.go create mode 100644 sdk/metric/provider_test.go create mode 100644 sdk/metric/reader.go create mode 100644 sdk/metric/reader_test.go delete mode 100644 sdk/metric/refcount_mapped.go delete mode 100644 sdk/metric/registry/doc.go delete mode 100644 sdk/metric/registry/registry.go delete mode 100644 sdk/metric/registry/registry_test.go delete mode 100644 sdk/metric/sdk.go delete mode 100644 sdk/metric/sdkapi/descriptor.go delete mode 100644 sdk/metric/sdkapi/descriptor_test.go delete mode 100644 sdk/metric/sdkapi/instrumentkind.go delete mode 100644 sdk/metric/sdkapi/instrumentkind_string.go delete mode 100644 sdk/metric/sdkapi/instrumentkind_test.go delete mode 100644 sdk/metric/sdkapi/noop.go delete mode 100644 sdk/metric/sdkapi/sdkapi.go delete mode 100644 sdk/metric/sdkapi/sdkapi_test.go delete mode 100644 sdk/metric/sdkapi/wrap.go delete mode 100644 sdk/metric/selector/simple/simple.go delete mode 100644 sdk/metric/selector/simple/simple_test.go create mode 100644 sdk/metric/view/doc.go create mode 100644 sdk/metric/view/example_test.go rename exporters/otlp/otlpmetric/internal/metrictransform/resource.go => sdk/metric/view/instrument.go (59%) create mode 100644 sdk/metric/view/instrumentkind.go create mode 100644 sdk/metric/view/view.go create mode 100644 sdk/metric/view/view_test.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e1ae982eb5c..d62ae0b70ea 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -29,7 +29,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /bridge/opencensus/test + directory: /bridge/opencensus/opencensusmetric labels: - dependencies - go @@ -38,7 +38,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /bridge/opentracing + directory: /bridge/opencensus/test labels: - dependencies - go @@ -47,7 +47,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /example/fib + directory: /bridge/opentracing labels: - dependencies - go @@ -56,7 +56,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /example/jaeger + directory: /example/fib labels: - dependencies - go @@ -65,7 +65,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /example/namedtracer + directory: /example/jaeger labels: - dependencies - go @@ -74,7 +74,7 @@ updates: interval: weekly day: sunday - package-ecosystem: gomod - directory: /example/opencensus + directory: /example/namedtracer labels: - dependencies - go diff --git a/CHANGELOG.md b/CHANGELOG.md index 906e17ce94f..486916d00b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,40 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. + Please see the package documentation for how the new SDK is initialized and configured. (#3175) + +### Removed + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been removed. + A new bridge compliant with the revised metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/histogram` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator/sum` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/aggregator` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/controllertest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/controller/time` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export/aggregation` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/export` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/metrictest` package is removed. + A replacement package that supports the new metric SDK will be added back in a future release. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/number` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/basic` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/processortest` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/processor/reducer` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/registry` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/sdkapi` package is removed, see the new metric SDK. (#3175) +- The `go.opentelemetry.io/otel/sdk/metric/selector/simple` package is removed, see the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrUninitializedInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".ErrBadInstrument` variable was removed. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".Accumulator` type was removed, see the `MeterProvider`in the new metric SDK. (#3175) +- The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) +- The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) + ## [1.10.0] - 2022-09-09 ### Added diff --git a/bridge/opencensus/README.md b/bridge/opencensus/README.md index 07dc57380b3..3df9dc7eb07 100644 --- a/bridge/opencensus/README.md +++ b/bridge/opencensus/README.md @@ -79,50 +79,3 @@ OpenCensus and OpenTelemetry APIs are not entirely compatible. If the bridge fi * Custom OpenCensus Samplers specified during StartSpan are ignored. * Links cannot be added to OpenCensus spans. * OpenTelemetry Debug or Deferred trace flags are dropped after an OpenCensus span is created. - -## Metrics - -### The problem: mixing libraries without mixing pipelines - -The problem for monitoring is simpler than the problem for tracing, since there -are no context propagation issues to deal with. However, it still is difficult -for users to migrate an entire applications' monitoring at once. It -should be possible to send metrics generated by OpenCensus libraries to an -OpenTelemetry pipeline so that migrating a metric does not require maintaining -separate export pipelines for OpenCensus and OpenTelemetry. - -### The Exporter "wrapper" solution - -The solution we use here is to allow wrapping an OpenTelemetry exporter such -that it implements the OpenCensus exporter interfaces. This allows a single -exporter to be used for metrics from *both* OpenCensus and OpenTelemetry. - -### User Journey - -Starting from an application using entirely OpenCensus APIs: - -1. Instantiate OpenTelemetry SDK and Exporters. -2. Replace OpenCensus exporters with a wrapped OpenTelemetry exporter from step 1. -3. Migrate libraries individually from OpenCensus to OpenTelemetry -4. Remove OpenCensus Exporters and configuration. - -For example, to swap out the OpenCensus logging exporter for the OpenTelemetry stdout exporter: - -```go -import ( - "go.opencensus.io/metric/metricexport" - "go.opentelemetry.io/otel/bridge/opencensus" - "go.opentelemetry.io/otel/exporters/stdout" - "go.opentelemetry.io/otel" -) -// With OpenCensus, you could have previously configured the logging exporter like this: -// import logexporter "go.opencensus.io/examples/exporter" -// exporter, _ := logexporter.NewLogExporter(logexporter.Options{}) -// Instead, we can create an equivalent using the OpenTelemetry stdout exporter: -openTelemetryExporter, _ := stdout.New(stdout.WithPrettyPrint()) -exporter := opencensus.NewMetricExporter(openTelemetryExporter) - -// Use the wrapped OpenTelemetry exporter like you normally would with OpenCensus -intervalReader, _ := metricexport.NewIntervalReader(&metricexport.Reader{}, exporter) -intervalReader.Start() -``` diff --git a/bridge/opencensus/aggregation.go b/bridge/opencensus/aggregation.go deleted file mode 100644 index 99d2b07afad..00000000000 --- a/bridge/opencensus/aggregation.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" - -import ( - "errors" - "fmt" - "time" - - "go.opencensus.io/metric/metricdata" - - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -var ( - errIncompatibleType = errors.New("incompatible type for aggregation") - errEmpty = errors.New("points may not be empty") - errBadPoint = errors.New("point cannot be converted") -) - -type recordFunc func(agg aggregation.Aggregation, end time.Time) error - -// recordAggregationsFromPoints records one OpenTelemetry aggregation for -// each OpenCensus point. Points may not be empty and must be either -// all (int|float)64 or all *metricdata.Distribution. -func recordAggregationsFromPoints(points []metricdata.Point, recorder recordFunc) error { - if len(points) == 0 { - return errEmpty - } - switch t := points[0].Value.(type) { - case int64: - return recordGaugePoints(points, recorder) - case float64: - return recordGaugePoints(points, recorder) - case *metricdata.Distribution: - return recordDistributionPoint(points, recorder) - default: - // TODO add *metricdata.Summary support - return fmt.Errorf("%w: %v", errIncompatibleType, t) - } -} - -var _ aggregation.Aggregation = &ocRawAggregator{} -var _ aggregation.LastValue = &ocRawAggregator{} - -// recordGaugePoints creates an OpenTelemetry aggregation from OpenCensus points. -// Points may not be empty, and must only contain integers or floats. -func recordGaugePoints(pts []metricdata.Point, recorder recordFunc) error { - for _, pt := range pts { - switch t := pt.Value.(type) { - case int64: - if err := recorder(&ocRawAggregator{ - value: number.NewInt64Number(pt.Value.(int64)), - time: pt.Time, - }, pt.Time); err != nil { - return err - } - case float64: - if err := recorder(&ocRawAggregator{ - value: number.NewFloat64Number(pt.Value.(float64)), - time: pt.Time, - }, pt.Time); err != nil { - return err - } - default: - return fmt.Errorf("%w: %v", errIncompatibleType, t) - } - } - return nil -} - -type ocRawAggregator struct { - value number.Number - time time.Time -} - -// Kind returns the kind of aggregation this is. -func (o *ocRawAggregator) Kind() aggregation.Kind { - return aggregation.LastValueKind -} - -// LastValue returns the last point. -func (o *ocRawAggregator) LastValue() (number.Number, time.Time, error) { - return o.value, o.time, nil -} - -var _ aggregation.Aggregation = &ocDistAggregator{} -var _ aggregation.Histogram = &ocDistAggregator{} - -// recordDistributionPoint creates an OpenTelemetry aggregation from -// OpenCensus points. Points may not be empty, and must only contain -// Distributions. The most recent disribution will be used in the aggregation. -func recordDistributionPoint(pts []metricdata.Point, recorder recordFunc) error { - // only use the most recent datapoint for now. - pt := pts[len(pts)-1] - val, ok := pt.Value.(*metricdata.Distribution) - if !ok { - return fmt.Errorf("%w: %v", errBadPoint, pt.Value) - } - bucketCounts := make([]uint64, len(val.Buckets)) - for i, bucket := range val.Buckets { - if bucket.Count < 0 { - return fmt.Errorf("%w: bucket count may not be negative", errBadPoint) - } - bucketCounts[i] = uint64(bucket.Count) - } - if val.Count < 0 { - return fmt.Errorf("%w: count may not be negative", errBadPoint) - } - return recorder(&ocDistAggregator{ - sum: number.NewFloat64Number(val.Sum), - count: uint64(val.Count), - buckets: aggregation.Buckets{ - Boundaries: val.BucketOptions.Bounds, - Counts: bucketCounts, - }, - }, pts[len(pts)-1].Time) -} - -type ocDistAggregator struct { - sum number.Number - count uint64 - buckets aggregation.Buckets -} - -// Kind returns the kind of aggregation this is. -func (o *ocDistAggregator) Kind() aggregation.Kind { - return aggregation.HistogramKind -} - -// Sum returns the sum of values. -func (o *ocDistAggregator) Sum() (number.Number, error) { - return o.sum, nil -} - -// Count returns the number of values. -func (o *ocDistAggregator) Count() (uint64, error) { - return o.count, nil -} - -// Histogram returns the count of events in pre-determined buckets. -func (o *ocDistAggregator) Histogram() (aggregation.Buckets, error) { - return o.buckets, nil -} diff --git a/bridge/opencensus/aggregation_test.go b/bridge/opencensus/aggregation_test.go deleted file mode 100644 index bbaff5c6440..00000000000 --- a/bridge/opencensus/aggregation_test.go +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package opencensus - -import ( - "errors" - "testing" - "time" - - "go.opencensus.io/metric/metricdata" - - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -) - -func TestNewAggregationFromPoints(t *testing.T) { - now := time.Now() - for _, tc := range []struct { - desc string - input []metricdata.Point - expectedKind aggregation.Kind - expectedErr error - }{ - { - desc: "no points", - expectedErr: errEmpty, - }, - { - desc: "int point", - input: []metricdata.Point{ - { - Time: now, - Value: int64(23), - }, - }, - expectedKind: aggregation.LastValueKind, - }, - { - desc: "float point", - input: []metricdata.Point{ - { - Time: now, - Value: float64(23), - }, - }, - expectedKind: aggregation.LastValueKind, - }, - { - desc: "distribution point", - input: []metricdata.Point{ - { - Time: now, - Value: &metricdata.Distribution{ - Count: 2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 1}, - {Count: 1}, - }, - }, - }, - }, - expectedKind: aggregation.HistogramKind, - }, - { - desc: "bad distribution bucket count", - input: []metricdata.Point{ - { - Time: now, - Value: &metricdata.Distribution{ - Count: 2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - // negative bucket - {Count: -1}, - {Count: 1}, - }, - }, - }, - }, - expectedErr: errBadPoint, - }, - { - desc: "bad distribution count", - input: []metricdata.Point{ - { - Time: now, - Value: &metricdata.Distribution{ - // negative count - Count: -2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 1}, - {Count: 1}, - }, - }, - }, - }, - expectedErr: errBadPoint, - }, - { - desc: "incompatible point type bool", - input: []metricdata.Point{ - { - Time: now, - Value: true, - }, - }, - expectedErr: errIncompatibleType, - }, - { - desc: "dist is incompatible with raw points", - input: []metricdata.Point{ - { - Time: now, - Value: int64(23), - }, - { - Time: now, - Value: &metricdata.Distribution{ - Count: 2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 1}, - {Count: 1}, - }, - }, - }, - }, - expectedErr: errIncompatibleType, - }, - { - desc: "int point is incompatible with dist", - input: []metricdata.Point{ - { - Time: now, - Value: &metricdata.Distribution{ - Count: 2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 1}, - {Count: 1}, - }, - }, - }, - { - Time: now, - Value: int64(23), - }, - }, - expectedErr: errBadPoint, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - var output []aggregation.Aggregation - err := recordAggregationsFromPoints(tc.input, func(agg aggregation.Aggregation, ts time.Time) error { - last := tc.input[len(tc.input)-1] - if ts != last.Time { - t.Errorf("incorrect timestamp %v != %v", ts, last.Time) - } - output = append(output, agg) - return nil - }) - if !errors.Is(err, tc.expectedErr) { - t.Errorf("newAggregationFromPoints(%v) = err(%v), want err(%v)", tc.input, err, tc.expectedErr) - } - for _, out := range output { - if tc.expectedErr == nil && out.Kind() != tc.expectedKind { - t.Errorf("newAggregationFromPoints(%v) = %v, want %v", tc.input, out.Kind(), tc.expectedKind) - } - } - }) - } -} - -func TestLastValueAggregation(t *testing.T) { - now := time.Now() - input := []metricdata.Point{ - {Value: int64(15), Time: now.Add(-time.Minute)}, - {Value: int64(-23), Time: now}, - } - idx := 0 - err := recordAggregationsFromPoints(input, func(agg aggregation.Aggregation, end time.Time) error { - if agg.Kind() != aggregation.LastValueKind { - t.Errorf("recordAggregationsFromPoints(%v) = %v, want %v", input, agg.Kind(), aggregation.LastValueKind) - } - if end != input[idx].Time { - t.Errorf("recordAggregationsFromPoints(%v).end() = %v, want %v", input, end, input[idx].Time) - } - pointsLV, ok := agg.(aggregation.LastValue) - if !ok { - t.Errorf("recordAggregationsFromPoints(%v) = %v does not implement the aggregation.LastValue interface", input, agg) - } - lv, ts, _ := pointsLV.LastValue() - if lv.AsInt64() != input[idx].Value { - t.Errorf("recordAggregationsFromPoints(%v) = %v, want %v", input, lv.AsInt64(), input[idx].Value) - } - if ts != input[idx].Time { - t.Errorf("recordAggregationsFromPoints(%v) = %v, want %v", input, ts, input[idx].Time) - } - idx++ - return nil - }) - if err != nil { - t.Errorf("recordAggregationsFromPoints(%v) = unexpected error %v", input, err) - } -} - -func TestHistogramAggregation(t *testing.T) { - now := time.Now() - input := []metricdata.Point{ - { - Value: &metricdata.Distribution{ - Count: 0, - Sum: 0, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 0}, - {Count: 0}, - }, - }, - }, - { - Time: now, - Value: &metricdata.Distribution{ - Count: 2, - Sum: 55, - BucketOptions: &metricdata.BucketOptions{ - Bounds: []float64{20, 30}, - }, - Buckets: []metricdata.Bucket{ - {Count: 1}, - {Count: 1}, - }, - }, - }, - } - var output aggregation.Aggregation - var end time.Time - err := recordAggregationsFromPoints(input, func(argAgg aggregation.Aggregation, argEnd time.Time) error { - output = argAgg - end = argEnd - return nil - }) - if err != nil { - t.Fatalf("recordAggregationsFromPoints(%v) = err(%v), want ", input, err) - } - if output.Kind() != aggregation.HistogramKind { - t.Errorf("recordAggregationsFromPoints(%v) = %v, want %v", input, output.Kind(), aggregation.HistogramKind) - } - if !end.Equal(now) { - t.Errorf("recordAggregationsFromPoints(%v).end() = %v, want %v", input, end, now) - } - distAgg, ok := output.(aggregation.Histogram) - if !ok { - t.Errorf("recordAggregationsFromPoints(%v) = %v does not implement the aggregation.Points interface", input, output) - } - sum, err := distAgg.Sum() - if err != nil { - t.Fatalf("Unexpected err: %v", err) - } - if sum.AsFloat64() != float64(55) { - t.Errorf("recordAggregationsFromPoints(%v).Sum() = %v, want %v", input, sum.AsFloat64(), float64(55)) - } - count, err := distAgg.Count() - if err != nil { - t.Fatalf("Unexpected err: %v", err) - } - if count != 2 { - t.Errorf("recordAggregationsFromPoints(%v).Count() = %v, want %v", input, count, 2) - } - hist, err := distAgg.Histogram() - if err != nil { - t.Fatalf("Unexpected err: %v", err) - } - inputBucketBoundaries := []float64{20, 30} - if len(hist.Boundaries) != len(inputBucketBoundaries) { - t.Fatalf("recordAggregationsFromPoints(%v).Histogram() produced %d boundaries, want %d boundaries", input, len(hist.Boundaries), len(inputBucketBoundaries)) - } - for i, b := range hist.Boundaries { - if b != inputBucketBoundaries[i] { - t.Errorf("recordAggregationsFromPoints(%v).Histogram().Boundaries[%d] = %v, want %v", input, i, b, inputBucketBoundaries[i]) - } - } - inputBucketCounts := []uint64{1, 1} - if len(hist.Counts) != len(inputBucketCounts) { - t.Fatalf("recordAggregationsFromPoints(%v).Histogram() produced %d buckets, want %d buckets", input, len(hist.Counts), len(inputBucketCounts)) - } - for i, c := range hist.Counts { - if c != inputBucketCounts[i] { - t.Errorf("recordAggregationsFromPoints(%v).Histogram().Counts[%d] = %d, want %d", input, i, c, inputBucketCounts[i]) - } - } -} diff --git a/bridge/opencensus/exporter.go b/bridge/opencensus/exporter.go deleted file mode 100644 index 7e7e7960007..00000000000 --- a/bridge/opencensus/exporter.go +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" - -import ( - "context" - "errors" - "fmt" - "sync" - "time" - - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricexport" - ocresource "go.opencensus.io/resource" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -var errConversion = errors.New("unable to convert from OpenCensus to OpenTelemetry") - -// NewMetricExporter returns an OpenCensus exporter that exports to an -// OpenTelemetry exporter. -func NewMetricExporter(base export.Exporter) metricexport.Exporter { - return &exporter{base: base} -} - -// exporter implements the OpenCensus metric Exporter interface using an -// OpenTelemetry base exporter. -type exporter struct { - base export.Exporter -} - -// ExportMetrics implements the OpenCensus metric Exporter interface. -func (e *exporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { - res := resource.Empty() - if len(metrics) != 0 { - res = convertResource(metrics[0].Resource) - } - return e.base.Export(ctx, res, &censusLibraryReader{metrics: metrics}) -} - -type censusLibraryReader struct { - metrics []*metricdata.Metric -} - -func (r censusLibraryReader) ForEach(readerFunc func(instrumentation.Library, export.Reader) error) error { - return readerFunc(instrumentation.Library{ - Name: "OpenCensus Bridge", - }, &metricReader{metrics: r.metrics}) -} - -type metricReader struct { - // RWMutex implements locking for the `Reader` interface. - sync.RWMutex - metrics []*metricdata.Metric -} - -var _ export.Reader = &metricReader{} - -// ForEach iterates through the metrics data, synthesizing an -// export.Record with the appropriate aggregation for the exporter. -func (d *metricReader) ForEach(_ aggregation.TemporalitySelector, f func(export.Record) error) error { - for _, m := range d.metrics { - descriptor, err := convertDescriptor(m.Descriptor) - if err != nil { - otel.Handle(err) - continue - } - for _, ts := range m.TimeSeries { - if len(ts.Points) == 0 { - continue - } - attrs, err := convertAttrs(m.Descriptor.LabelKeys, ts.LabelValues) - if err != nil { - otel.Handle(err) - continue - } - err = recordAggregationsFromPoints( - ts.Points, - func(agg aggregation.Aggregation, end time.Time) error { - return f(export.NewRecord( - &descriptor, - &attrs, - agg, - ts.StartTime, - end, - )) - }) - if err != nil && !errors.Is(err, aggregation.ErrNoData) { - return err - } - } - } - return nil -} - -// convertAttrs converts from OpenCensus attribute keys and values to an -// OpenTelemetry attribute Set. -func convertAttrs(keys []metricdata.LabelKey, values []metricdata.LabelValue) (attribute.Set, error) { - if len(keys) != len(values) { - return attribute.NewSet(), fmt.Errorf("%w different number of label keys (%d) and values (%d)", errConversion, len(keys), len(values)) - } - attrs := []attribute.KeyValue{} - for i, lv := range values { - if !lv.Present { - continue - } - attrs = append(attrs, attribute.KeyValue{ - Key: attribute.Key(keys[i].Key), - Value: attribute.StringValue(lv.Value), - }) - } - return attribute.NewSet(attrs...), nil -} - -// convertResource converts an OpenCensus Resource to an OpenTelemetry Resource -// Note: the ocresource.Resource Type field is not used. -func convertResource(res *ocresource.Resource) *resource.Resource { - attrs := []attribute.KeyValue{} - if res == nil { - return nil - } - for k, v := range res.Labels { - attrs = append(attrs, attribute.KeyValue{Key: attribute.Key(k), Value: attribute.StringValue(v)}) - } - return resource.NewSchemaless(attrs...) -} - -// convertDescriptor converts an OpenCensus Descriptor to an OpenTelemetry Descriptor. -func convertDescriptor(ocDescriptor metricdata.Descriptor) (sdkapi.Descriptor, error) { - var ( - nkind number.Kind - ikind sdkapi.InstrumentKind - ) - switch ocDescriptor.Type { - case metricdata.TypeGaugeInt64: - nkind = number.Int64Kind - ikind = sdkapi.GaugeObserverInstrumentKind - case metricdata.TypeGaugeFloat64: - nkind = number.Float64Kind - ikind = sdkapi.GaugeObserverInstrumentKind - case metricdata.TypeCumulativeInt64: - nkind = number.Int64Kind - ikind = sdkapi.CounterObserverInstrumentKind - case metricdata.TypeCumulativeFloat64: - nkind = number.Float64Kind - ikind = sdkapi.CounterObserverInstrumentKind - default: - // Includes TypeGaugeDistribution, TypeCumulativeDistribution, TypeSummary - return sdkapi.Descriptor{}, fmt.Errorf("%w; descriptor type: %v", errConversion, ocDescriptor.Type) - } - opts := []instrument.Option{ - instrument.WithDescription(ocDescriptor.Description), - } - switch ocDescriptor.Unit { - case metricdata.UnitDimensionless: - opts = append(opts, instrument.WithUnit(unit.Dimensionless)) - case metricdata.UnitBytes: - opts = append(opts, instrument.WithUnit(unit.Bytes)) - case metricdata.UnitMilliseconds: - opts = append(opts, instrument.WithUnit(unit.Milliseconds)) - } - cfg := instrument.NewConfig(opts...) - return sdkapi.NewDescriptor(ocDescriptor.Name, ikind, nkind, cfg.Description(), cfg.Unit()), nil -} diff --git a/bridge/opencensus/exporter_test.go b/bridge/opencensus/exporter_test.go deleted file mode 100644 index 2634f5334d5..00000000000 --- a/bridge/opencensus/exporter_test.go +++ /dev/null @@ -1,475 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package opencensus - -import ( - "context" - "errors" - "fmt" - "testing" - "time" - - "go.opencensus.io/metric/metricdata" - ocresource "go.opencensus.io/resource" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -type fakeExporter struct { - export.Exporter - records []export.Record - resource *resource.Resource - err error -} - -func (f *fakeExporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error { - return controllertest.ReadAll(ilr, aggregation.StatelessTemporalitySelector(), - func(_ instrumentation.Library, record export.Record) error { - f.resource = res - f.records = append(f.records, record) - return f.err - }) -} - -type fakeErrorHandler struct { - err error -} - -func (f *fakeErrorHandler) Handle(err error) { - f.err = err -} - -func (f *fakeErrorHandler) matches(err error) error { - // make sure err is cleared for the next test - defer func() { f.err = nil }() - if !errors.Is(f.err, err) { - return fmt.Errorf("err(%v), want err(%v)", f.err, err) - } - return nil -} - -func TestExportMetrics(t *testing.T) { - now := time.Now() - basicDesc := metrictest.NewDescriptor( - "", - sdkapi.GaugeObserverInstrumentKind, - number.Int64Kind, - ) - fakeErrorHandler := &fakeErrorHandler{} - otel.SetErrorHandler(fakeErrorHandler) - for _, tc := range []struct { - desc string - input []*metricdata.Metric - exportErr error - expected []export.Record - expectedResource *resource.Resource - expectedHandledError error - }{ - { - desc: "no metrics", - }, - { - desc: "metric without points is dropped", - input: []*metricdata.Metric{ - { - TimeSeries: []*metricdata.TimeSeries{ - {}, - }, - }, - }, - }, - { - desc: "descriptor conversion error", - input: []*metricdata.Metric{ - // TypeGaugeDistribution isn't supported - {Descriptor: metricdata.Descriptor{Type: metricdata.TypeGaugeDistribution}}, - }, - expectedHandledError: errConversion, - }, - { - desc: "attrs conversion error", - input: []*metricdata.Metric{ - { - // No descriptor with attribute keys. - TimeSeries: []*metricdata.TimeSeries{ - // 1 attribute value, which doens't exist in keys. - { - LabelValues: []metricdata.LabelValue{{Value: "foo", Present: true}}, - Points: []metricdata.Point{ - {}, - }, - }, - }, - }, - }, - expectedHandledError: errConversion, - }, - { - desc: "unsupported summary point type", - input: []*metricdata.Metric{ - { - TimeSeries: []*metricdata.TimeSeries{ - { - Points: []metricdata.Point{ - {Value: &metricdata.Summary{}}, - }, - }, - }, - }, - }, - exportErr: errIncompatibleType, - }, - { - desc: "success", - input: []*metricdata.Metric{ - { - Resource: &ocresource.Resource{ - Labels: map[string]string{ - "R1": "V1", - "R2": "V2", - }, - }, - TimeSeries: []*metricdata.TimeSeries{ - { - StartTime: now, - Points: []metricdata.Point{ - {Value: int64(123), Time: now}, - }, - }, - }, - }, - }, - expectedResource: resource.NewSchemaless( - attribute.String("R1", "V1"), - attribute.String("R2", "V2"), - ), - expected: []export.Record{ - export.NewRecord( - &basicDesc, - attribute.EmptySet(), - &ocRawAggregator{ - value: number.NewInt64Number(123), - time: now, - }, - now, - now, - ), - }, - }, - { - desc: "export error after success", - input: []*metricdata.Metric{ - { - TimeSeries: []*metricdata.TimeSeries{ - { - StartTime: now, - Points: []metricdata.Point{ - {Value: int64(123), Time: now}, - }, - }, - }, - }, - }, - expected: []export.Record{ - export.NewRecord( - &basicDesc, - attribute.EmptySet(), - &ocRawAggregator{ - value: number.NewInt64Number(123), - time: now, - }, - now, - now, - ), - }, - exportErr: errors.New("failed to export"), - }, - { - desc: "partial success sends correct metrics and drops incorrect metrics with handled err", - input: []*metricdata.Metric{ - { - TimeSeries: []*metricdata.TimeSeries{ - { - StartTime: now, - Points: []metricdata.Point{ - {Value: int64(123), Time: now}, - }, - }, - }, - }, - // TypeGaugeDistribution isn't supported - {Descriptor: metricdata.Descriptor{Type: metricdata.TypeGaugeDistribution}}, - }, - expected: []export.Record{ - export.NewRecord( - &basicDesc, - attribute.EmptySet(), - &ocRawAggregator{ - value: number.NewInt64Number(123), - time: now, - }, - now, - now, - ), - }, - expectedHandledError: errConversion, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - fakeExporter := &fakeExporter{err: tc.exportErr} - err := NewMetricExporter(fakeExporter).ExportMetrics(context.Background(), tc.input) - if !errors.Is(err, tc.exportErr) { - t.Errorf("NewMetricExporter(%+v) = err(%v), want err(%v)", tc.input, err, tc.exportErr) - } - // Check the global error handler, since we don't return errors - // which occur during conversion. - err = fakeErrorHandler.matches(tc.expectedHandledError) - if err != nil { - t.Fatalf("ExportMetrics(%+v) = %v", tc.input, err) - } - output := fakeExporter.records - if len(tc.expected) != len(output) { - t.Fatalf("ExportMetrics(%+v) = %d records, want %d records", tc.input, len(output), len(tc.expected)) - } - if fakeExporter.resource.String() != tc.expectedResource.String() { - t.Errorf("ExportMetrics(%+v)[i].Resource() = %+v, want %+v", tc.input, fakeExporter.resource.String(), tc.expectedResource.String()) - } - for i, expected := range tc.expected { - if output[i].StartTime() != expected.StartTime() { - t.Errorf("ExportMetrics(%+v)[i].StartTime() = %+v, want %+v", tc.input, output[i].StartTime(), expected.StartTime()) - } - if output[i].EndTime() != expected.EndTime() { - t.Errorf("ExportMetrics(%+v)[i].EndTime() = %+v, want %+v", tc.input, output[i].EndTime(), expected.EndTime()) - } - if output[i].Descriptor().Name() != expected.Descriptor().Name() { - t.Errorf("ExportMetrics(%+v)[i].Descriptor() = %+v, want %+v", tc.input, output[i].Descriptor().Name(), expected.Descriptor().Name()) - } - // Don't bother with a complete check of the descriptor. - // That is checked as part of descriptor conversion tests below. - if !output[i].Attributes().Equals(expected.Attributes()) { - t.Errorf("ExportMetrics(%+v)[i].Attributes() = %+v, want %+v", tc.input, output[i].Attributes(), expected.Attributes()) - } - if output[i].Aggregation().Kind() != expected.Aggregation().Kind() { - t.Errorf("ExportMetrics(%+v)[i].Aggregation() = %+v, want %+v", tc.input, output[i].Aggregation().Kind(), expected.Aggregation().Kind()) - } - // Don't bother checking the contents of the points aggregation. - // Those tests are done with the aggregations themselves - } - }) - } -} - -func TestConvertAttributes(t *testing.T) { - setWithMultipleKeys := attribute.NewSet( - attribute.KeyValue{Key: attribute.Key("first"), Value: attribute.StringValue("1")}, - attribute.KeyValue{Key: attribute.Key("second"), Value: attribute.StringValue("2")}, - ) - for _, tc := range []struct { - desc string - inputKeys []metricdata.LabelKey - inputValues []metricdata.LabelValue - expected *attribute.Set - expectedErr error - }{ - { - desc: "no attributes", - expected: attribute.EmptySet(), - }, - { - desc: "different numbers of keys and values", - inputKeys: []metricdata.LabelKey{{Key: "foo"}}, - expected: attribute.EmptySet(), - expectedErr: errConversion, - }, - { - desc: "multiple keys and values", - inputKeys: []metricdata.LabelKey{{Key: "first"}, {Key: "second"}}, - inputValues: []metricdata.LabelValue{ - {Value: "1", Present: true}, - {Value: "2", Present: true}, - }, - expected: &setWithMultipleKeys, - }, - { - desc: "multiple keys and values with some not present", - inputKeys: []metricdata.LabelKey{{Key: "first"}, {Key: "second"}, {Key: "third"}}, - inputValues: []metricdata.LabelValue{ - {Value: "1", Present: true}, - {Value: "2", Present: true}, - {Present: false}, - }, - expected: &setWithMultipleKeys, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - output, err := convertAttrs(tc.inputKeys, tc.inputValues) - if !errors.Is(err, tc.expectedErr) { - t.Errorf("convertAttrs(keys: %v, values: %v) = err(%v), want err(%v)", tc.inputKeys, tc.inputValues, err, tc.expectedErr) - } - if !output.Equals(tc.expected) { - t.Errorf("convertAttrs(keys: %v, values: %v) = %+v, want %+v", tc.inputKeys, tc.inputValues, output.ToSlice(), tc.expected.ToSlice()) - } - }) - } -} -func TestConvertResource(t *testing.T) { - for _, tc := range []struct { - desc string - input *ocresource.Resource - expected *resource.Resource - }{ - { - desc: "nil resource", - }, - { - desc: "empty resource", - input: &ocresource.Resource{ - Labels: map[string]string{}, - }, - expected: resource.NewSchemaless(), - }, - { - desc: "resource with attributes", - input: &ocresource.Resource{ - Labels: map[string]string{ - "foo": "bar", - "tick": "tock", - }, - }, - expected: resource.NewSchemaless( - attribute.KeyValue{Key: attribute.Key("foo"), Value: attribute.StringValue("bar")}, - attribute.KeyValue{Key: attribute.Key("tick"), Value: attribute.StringValue("tock")}, - ), - }, - } { - t.Run(tc.desc, func(t *testing.T) { - output := convertResource(tc.input) - if !output.Equal(tc.expected) { - t.Errorf("convertResource(%v) = %+v, want %+v", tc.input, output, tc.expected) - } - }) - } -} -func TestConvertDescriptor(t *testing.T) { - for _, tc := range []struct { - desc string - input metricdata.Descriptor - expected sdkapi.Descriptor - expectedErr error - }{ - { - desc: "empty descriptor", - expected: metrictest.NewDescriptor( - "", - sdkapi.GaugeObserverInstrumentKind, - number.Int64Kind, - ), - }, - { - desc: "gauge int64 bytes", - input: metricdata.Descriptor{ - Name: "foo", - Description: "bar", - Unit: metricdata.UnitBytes, - Type: metricdata.TypeGaugeInt64, - }, - expected: metrictest.NewDescriptor( - "foo", - sdkapi.GaugeObserverInstrumentKind, - number.Int64Kind, - instrument.WithDescription("bar"), - instrument.WithUnit(unit.Bytes), - ), - }, - { - desc: "gauge float64 ms", - input: metricdata.Descriptor{ - Name: "foo", - Description: "bar", - Unit: metricdata.UnitMilliseconds, - Type: metricdata.TypeGaugeFloat64, - }, - expected: metrictest.NewDescriptor( - "foo", - sdkapi.GaugeObserverInstrumentKind, - number.Float64Kind, - instrument.WithDescription("bar"), - instrument.WithUnit(unit.Milliseconds), - ), - }, - { - desc: "cumulative int64 dimensionless", - input: metricdata.Descriptor{ - Name: "foo", - Description: "bar", - Unit: metricdata.UnitDimensionless, - Type: metricdata.TypeCumulativeInt64, - }, - expected: metrictest.NewDescriptor( - "foo", - sdkapi.CounterObserverInstrumentKind, - number.Int64Kind, - instrument.WithDescription("bar"), - instrument.WithUnit(unit.Dimensionless), - ), - }, - { - desc: "cumulative float64 dimensionless", - input: metricdata.Descriptor{ - Name: "foo", - Description: "bar", - Unit: metricdata.UnitDimensionless, - Type: metricdata.TypeCumulativeFloat64, - }, - expected: metrictest.NewDescriptor( - "foo", - sdkapi.CounterObserverInstrumentKind, - number.Float64Kind, - instrument.WithDescription("bar"), - instrument.WithUnit(unit.Dimensionless), - ), - }, - { - desc: "incompatible TypeCumulativeDistribution", - input: metricdata.Descriptor{ - Name: "foo", - Description: "bar", - Type: metricdata.TypeCumulativeDistribution, - }, - expectedErr: errConversion, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - output, err := convertDescriptor(tc.input) - if !errors.Is(err, tc.expectedErr) { - t.Errorf("convertDescriptor(%v) = err(%v), want err(%v)", tc.input, err, tc.expectedErr) - } - if output != tc.expected { - t.Errorf("convertDescriptor(%v) = %+v, want %+v", tc.input, output, tc.expected) - } - }) - } -} diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 2fe1c84e302..4faa85d3607 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,26 +5,15 @@ go 1.17 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/otel/trace v1.10.0 ) require ( - github.com/benbjohnson/clock v1.3.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index e42b184d238..2e90b382eb9 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -1,7 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -42,8 +40,6 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/sdk/metric/metrictest/doc.go b/bridge/opencensus/opencensusmetric/doc.go similarity index 76% rename from sdk/metric/metrictest/doc.go rename to bridge/opencensus/opencensusmetric/doc.go index 504384dd3ab..a15e8b2aeb4 100644 --- a/sdk/metric/metrictest/doc.go +++ b/bridge/opencensus/opencensusmetric/doc.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// The metrictest package is a collection of tools used to make testing parts of -// the SDK easier. - -package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" +/* +Package opencensusmetric provides a metric bridge from OpenCensus to OpenTelemetry. +*/ +package opencensusmetric // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric" diff --git a/bridge/opencensus/opencensusmetric/go.mod b/bridge/opencensus/opencensusmetric/go.mod new file mode 100644 index 00000000000..2c98a6e1371 --- /dev/null +++ b/bridge/opencensus/opencensusmetric/go.mod @@ -0,0 +1,28 @@ +module go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric + +go 1.18 + +require ( + go.opencensus.io v0.23.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 +) + +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + +replace go.opentelemetry.io/otel => ../../.. + +replace go.opentelemetry.io/otel/sdk => ../../../sdk + +replace go.opentelemetry.io/otel/metric => ../../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric + +replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/bridge/opencensus/opencensusmetric/go.sum b/bridge/opencensus/opencensusmetric/go.sum new file mode 100644 index 00000000000..099866b7e41 --- /dev/null +++ b/bridge/opencensus/opencensusmetric/go.sum @@ -0,0 +1,98 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/opencensusmetric/internal/metric.go b/bridge/opencensus/opencensusmetric/internal/metric.go new file mode 100644 index 00000000000..8d2e9a53db0 --- /dev/null +++ b/bridge/opencensus/opencensusmetric/internal/metric.go @@ -0,0 +1,219 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric/internal" + +import ( + "errors" + "fmt" + + ocmetricdata "go.opencensus.io/metric/metricdata" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +var ( + errConversion = errors.New("converting from OpenCensus to OpenTelemetry") + errAggregationType = errors.New("unsupported OpenCensus aggregation type") + errMismatchedValueTypes = errors.New("wrong value type for data point") + errNumberDataPoint = errors.New("converting a number data point") + errHistogramDataPoint = errors.New("converting a histogram data point") + errNegativeDistributionCount = errors.New("distribution count is negative") + errNegativeBucketCount = errors.New("distribution bucket count is negative") + errMismatchedAttributeKeyValues = errors.New("mismatched number of attribute keys and values") +) + +// ConvertMetrics converts metric data from OpenCensus to OpenTelemetry. +func ConvertMetrics(ocmetrics []*ocmetricdata.Metric) ([]metricdata.Metrics, error) { + otelMetrics := make([]metricdata.Metrics, 0, len(ocmetrics)) + var errInfo []string + for _, ocm := range ocmetrics { + if ocm == nil { + continue + } + agg, err := convertAggregation(ocm) + if err != nil { + errInfo = append(errInfo, err.Error()) + continue + } + otelMetrics = append(otelMetrics, metricdata.Metrics{ + Name: ocm.Descriptor.Name, + Description: ocm.Descriptor.Description, + Unit: convertUnit(ocm.Descriptor.Unit), + Data: agg, + }) + } + var aggregatedError error + if len(errInfo) > 0 { + aggregatedError = fmt.Errorf("%w: %q", errConversion, errInfo) + } + return otelMetrics, aggregatedError +} + +// convertAggregation produces an aggregation based on the OpenCensus Metric. +func convertAggregation(metric *ocmetricdata.Metric) (metricdata.Aggregation, error) { + labelKeys := metric.Descriptor.LabelKeys + switch metric.Descriptor.Type { + case ocmetricdata.TypeGaugeInt64: + return convertGauge[int64](labelKeys, metric.TimeSeries) + case ocmetricdata.TypeGaugeFloat64: + return convertGauge[float64](labelKeys, metric.TimeSeries) + case ocmetricdata.TypeCumulativeInt64: + return convertSum[int64](labelKeys, metric.TimeSeries) + case ocmetricdata.TypeCumulativeFloat64: + return convertSum[float64](labelKeys, metric.TimeSeries) + case ocmetricdata.TypeCumulativeDistribution: + return convertHistogram(labelKeys, metric.TimeSeries) + // TODO: Support summaries, once it is in the OTel data types. + } + return nil, fmt.Errorf("%w: %q", errAggregationType, metric.Descriptor.Type) +} + +// convertGauge converts an OpenCensus gauge to an OpenTelemetry gauge aggregation. +func convertGauge[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Gauge[N], error) { + points, err := convertNumberDataPoints[N](labelKeys, ts) + return metricdata.Gauge[N]{DataPoints: points}, err +} + +// convertSum converts an OpenCensus cumulative to an OpenTelemetry sum aggregation. +func convertSum[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Sum[N], error) { + points, err := convertNumberDataPoints[N](labelKeys, ts) + // OpenCensus sums are always Cumulative + return metricdata.Sum[N]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, err +} + +// convertNumberDataPoints converts OpenCensus TimeSeries to OpenTelemetry DataPoints. +func convertNumberDataPoints[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) ([]metricdata.DataPoint[N], error) { + var points []metricdata.DataPoint[N] + var errInfo []string + for _, t := range ts { + attrs, err := convertAttrs(labelKeys, t.LabelValues) + if err != nil { + errInfo = append(errInfo, err.Error()) + continue + } + for _, p := range t.Points { + v, ok := p.Value.(N) + if !ok { + errInfo = append(errInfo, fmt.Sprintf("%v: %q", errMismatchedValueTypes, p.Value)) + continue + } + points = append(points, metricdata.DataPoint[N]{ + Attributes: attrs, + StartTime: t.StartTime, + Time: p.Time, + Value: v, + }) + } + } + var aggregatedError error + if len(errInfo) > 0 { + aggregatedError = fmt.Errorf("%w: %v", errNumberDataPoint, errInfo) + } + return points, aggregatedError +} + +// convertHistogram converts OpenCensus Distribution timeseries to an +// OpenTelemetry Histogram aggregation. +func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Histogram, error) { + points := make([]metricdata.HistogramDataPoint, 0, len(ts)) + var errInfo []string + for _, t := range ts { + attrs, err := convertAttrs(labelKeys, t.LabelValues) + if err != nil { + errInfo = append(errInfo, err.Error()) + continue + } + for _, p := range t.Points { + dist, ok := p.Value.(*ocmetricdata.Distribution) + if !ok { + errInfo = append(errInfo, fmt.Sprintf("%v: %d", errMismatchedValueTypes, p.Value)) + continue + } + bucketCounts, err := convertBucketCounts(dist.Buckets) + if err != nil { + errInfo = append(errInfo, err.Error()) + continue + } + if dist.Count < 0 { + errInfo = append(errInfo, fmt.Sprintf("%v: %d", errNegativeDistributionCount, dist.Count)) + continue + } + // TODO: handle exemplars + points = append(points, metricdata.HistogramDataPoint{ + Attributes: attrs, + StartTime: t.StartTime, + Time: p.Time, + Count: uint64(dist.Count), + Sum: dist.Sum, + Bounds: dist.BucketOptions.Bounds, + BucketCounts: bucketCounts, + }) + } + } + var aggregatedError error + if len(errInfo) > 0 { + aggregatedError = fmt.Errorf("%w: %v", errHistogramDataPoint, errInfo) + } + return metricdata.Histogram{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, aggregatedError +} + +// convertBucketCounts converts from OpenCensus bucket counts to slice of uint64. +func convertBucketCounts(buckets []ocmetricdata.Bucket) ([]uint64, error) { + bucketCounts := make([]uint64, len(buckets)) + for i, bucket := range buckets { + if bucket.Count < 0 { + return nil, fmt.Errorf("%w: %q", errNegativeBucketCount, bucket.Count) + } + bucketCounts[i] = uint64(bucket.Count) + } + return bucketCounts, nil +} + +// convertAttrs converts from OpenCensus attribute keys and values to an +// OpenTelemetry attribute Set. +func convertAttrs(keys []ocmetricdata.LabelKey, values []ocmetricdata.LabelValue) (attribute.Set, error) { + if len(keys) != len(values) { + return attribute.NewSet(), fmt.Errorf("%w: keys(%q) values(%q)", errMismatchedAttributeKeyValues, len(keys), len(values)) + } + attrs := []attribute.KeyValue{} + for i, lv := range values { + if !lv.Present { + continue + } + attrs = append(attrs, attribute.KeyValue{ + Key: attribute.Key(keys[i].Key), + Value: attribute.StringValue(lv.Value), + }) + } + return attribute.NewSet(attrs...), nil +} + +// convertUnit converts from the OpenCensus unit to OpenTelemetry unit. +func convertUnit(u ocmetricdata.Unit) unit.Unit { + switch u { + case ocmetricdata.UnitDimensionless: + return unit.Dimensionless + case ocmetricdata.UnitBytes: + return unit.Bytes + case ocmetricdata.UnitMilliseconds: + return unit.Milliseconds + } + return unit.Unit(string(u)) +} diff --git a/bridge/opencensus/opencensusmetric/internal/metric_test.go b/bridge/opencensus/opencensusmetric/internal/metric_test.go new file mode 100644 index 00000000000..4088972cc3f --- /dev/null +++ b/bridge/opencensus/opencensusmetric/internal/metric_test.go @@ -0,0 +1,667 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric/internal" + +import ( + "errors" + "testing" + "time" + + ocmetricdata "go.opencensus.io/metric/metricdata" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +func TestConvertMetrics(t *testing.T) { + endTime1 := time.Now() + endTime2 := endTime1.Add(-time.Millisecond) + startTime := endTime2.Add(-time.Minute) + for _, tc := range []struct { + desc string + input []*ocmetricdata.Metric + expected []metricdata.Metrics + expectedErr error + }{ + { + desc: "empty", + expected: []metricdata.Metrics{}, + }, + { + desc: "normal Histogram, gauges, and sums", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "a"}, + {Key: "b"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "hello", + Present: true, + }, { + Value: "world", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{ + Count: 8, + Sum: 100.0, + BucketOptions: &ocmetricdata.BucketOptions{ + Bounds: []float64{1.0, 2.0, 3.0}, + }, + Buckets: []ocmetricdata.Bucket{ + {Count: 1}, + {Count: 2}, + {Count: 5}, + }, + }), + ocmetricdata.NewDistributionPoint(endTime2, &ocmetricdata.Distribution{ + Count: 10, + Sum: 110.0, + BucketOptions: &ocmetricdata.BucketOptions{ + Bounds: []float64{1.0, 2.0, 3.0}, + }, + Buckets: []ocmetricdata.Bucket{ + {Count: 1}, + {Count: 4}, + {Count: 5}, + }, + }), + }, + StartTime: startTime, + }, + }, + }, { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/gauge-a", + Description: "an int testing gauge", + Unit: ocmetricdata.UnitBytes, + Type: ocmetricdata.TypeGaugeInt64, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "c"}, + {Key: "d"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "foo", + Present: true, + }, { + Value: "bar", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewInt64Point(endTime1, 123), + ocmetricdata.NewInt64Point(endTime2, 1236), + }, + }, + }, + }, { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/gauge-b", + Description: "a float testing gauge", + Unit: ocmetricdata.UnitBytes, + Type: ocmetricdata.TypeGaugeFloat64, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "cf"}, + {Key: "df"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "foof", + Present: true, + }, { + Value: "barf", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewFloat64Point(endTime1, 123.4), + ocmetricdata.NewFloat64Point(endTime2, 1236.7), + }, + }, + }, + }, { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/sum-a", + Description: "an int testing sum", + Unit: ocmetricdata.UnitMilliseconds, + Type: ocmetricdata.TypeCumulativeInt64, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "e"}, + {Key: "f"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "zig", + Present: true, + }, { + Value: "zag", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewInt64Point(endTime1, 13), + ocmetricdata.NewInt64Point(endTime2, 14), + }, + }, + }, + }, { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/sum-b", + Description: "a float testing sum", + Unit: ocmetricdata.UnitMilliseconds, + Type: ocmetricdata.TypeCumulativeFloat64, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "e"}, + {Key: "f"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "zig", + Present: true, + }, { + Value: "zag", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewFloat64Point(endTime1, 12.3), + ocmetricdata.NewFloat64Point(endTime2, 123.4), + }, + }, + }, + }, + }, + expected: []metricdata.Metrics{ + { + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: unit.Dimensionless, + Data: metricdata.Histogram{ + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("a"), + Value: attribute.StringValue("hello"), + }, attribute.KeyValue{ + Key: attribute.Key("b"), + Value: attribute.StringValue("world"), + }), + StartTime: startTime, + Time: endTime1, + Count: 8, + Sum: 100.0, + Bounds: []float64{1.0, 2.0, 3.0}, + BucketCounts: []uint64{1, 2, 5}, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("a"), + Value: attribute.StringValue("hello"), + }, attribute.KeyValue{ + Key: attribute.Key("b"), + Value: attribute.StringValue("world"), + }), + StartTime: startTime, + Time: endTime2, + Count: 10, + Sum: 110.0, + Bounds: []float64{1.0, 2.0, 3.0}, + BucketCounts: []uint64{1, 4, 5}, + }, + }, + Temporality: metricdata.CumulativeTemporality, + }, + }, { + Name: "foo.com/gauge-a", + Description: "an int testing gauge", + Unit: unit.Bytes, + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("c"), + Value: attribute.StringValue("foo"), + }, attribute.KeyValue{ + Key: attribute.Key("d"), + Value: attribute.StringValue("bar"), + }), + Time: endTime1, + Value: 123, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("c"), + Value: attribute.StringValue("foo"), + }, attribute.KeyValue{ + Key: attribute.Key("d"), + Value: attribute.StringValue("bar"), + }), + Time: endTime2, + Value: 1236, + }, + }, + }, + }, { + Name: "foo.com/gauge-b", + Description: "a float testing gauge", + Unit: unit.Bytes, + Data: metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("cf"), + Value: attribute.StringValue("foof"), + }, attribute.KeyValue{ + Key: attribute.Key("df"), + Value: attribute.StringValue("barf"), + }), + Time: endTime1, + Value: 123.4, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("cf"), + Value: attribute.StringValue("foof"), + }, attribute.KeyValue{ + Key: attribute.Key("df"), + Value: attribute.StringValue("barf"), + }), + Time: endTime2, + Value: 1236.7, + }, + }, + }, + }, { + Name: "foo.com/sum-a", + Description: "an int testing sum", + Unit: unit.Milliseconds, + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("e"), + Value: attribute.StringValue("zig"), + }, attribute.KeyValue{ + Key: attribute.Key("f"), + Value: attribute.StringValue("zag"), + }), + Time: endTime1, + Value: 13, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("e"), + Value: attribute.StringValue("zig"), + }, attribute.KeyValue{ + Key: attribute.Key("f"), + Value: attribute.StringValue("zag"), + }), + Time: endTime2, + Value: 14, + }, + }, + }, + }, { + Name: "foo.com/sum-b", + Description: "a float testing sum", + Unit: unit.Milliseconds, + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("e"), + Value: attribute.StringValue("zig"), + }, attribute.KeyValue{ + Key: attribute.Key("f"), + Value: attribute.StringValue("zag"), + }), + Time: endTime1, + Value: 12.3, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("e"), + Value: attribute.StringValue("zig"), + }, attribute.KeyValue{ + Key: attribute.Key("f"), + Value: attribute.StringValue("zag"), + }), + Time: endTime2, + Value: 123.4, + }, + }, + }, + }, + }, + }, { + desc: "histogram without data points", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + }, + }, + }, + expected: []metricdata.Metrics{ + { + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: unit.Dimensionless, + Data: metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint{}, + }, + }, + }, + }, { + desc: "sum without data points", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/sum-a", + Description: "a testing sum", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeFloat64, + }, + }, + }, + expected: []metricdata.Metrics{ + { + Name: "foo.com/sum-a", + Description: "a testing sum", + Unit: unit.Dimensionless, + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[float64]{}, + }, + }, + }, + }, { + desc: "gauge without data points", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/gauge-a", + Description: "a testing gauge", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeGaugeInt64, + }, + }, + }, + expected: []metricdata.Metrics{ + { + Name: "foo.com/gauge-a", + Description: "a testing gauge", + Unit: unit.Dimensionless, + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{}, + }, + }, + }, + }, { + desc: "histogram with negative count", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{ + Count: -8, + }), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errConversion, + }, { + desc: "histogram with negative bucket count", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{ + Buckets: []ocmetricdata.Bucket{ + {Count: -1}, + {Count: 2}, + {Count: 5}, + }, + }), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errConversion, + }, { + desc: "histogram with non-histogram datapoint type", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewFloat64Point(endTime1, 1.0), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errConversion, + }, { + desc: "sum with non-sum datapoint type", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeFloat64, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{}), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errConversion, + }, { + desc: "gauge with non-gauge datapoint type", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeGaugeFloat64, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{}), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errConversion, + }, { + desc: "unsupported Gauge Distribution type", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeGaugeDistribution, + }, + }, + }, + expectedErr: errConversion, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + output, err := ConvertMetrics(tc.input) + if !errors.Is(err, tc.expectedErr) { + t.Errorf("convertAggregation(%+v) = err(%v), want err(%v)", tc.input, err, tc.expectedErr) + } + metricdatatest.AssertEqual[metricdata.ScopeMetrics](t, + metricdata.ScopeMetrics{Metrics: tc.expected}, + metricdata.ScopeMetrics{Metrics: output}) + }) + } +} + +func TestConvertUnits(t *testing.T) { + var noUnit unit.Unit + for _, tc := range []struct { + desc string + input ocmetricdata.Unit + expected unit.Unit + }{{ + desc: "unspecified unit", + expected: noUnit, + }, { + desc: "dimensionless", + input: ocmetricdata.UnitDimensionless, + expected: unit.Dimensionless, + }, { + desc: "milliseconds", + input: ocmetricdata.UnitMilliseconds, + expected: unit.Milliseconds, + }, { + desc: "bytes", + input: ocmetricdata.UnitBytes, + expected: unit.Bytes, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + output := convertUnit(tc.input) + if output != tc.expected { + t.Errorf("convertUnit(%v) = %q, want %q", tc.input, output, tc.expected) + } + }) + } +} + +func TestConvertAttributes(t *testing.T) { + setWithMultipleKeys := attribute.NewSet( + attribute.KeyValue{Key: attribute.Key("first"), Value: attribute.StringValue("1")}, + attribute.KeyValue{Key: attribute.Key("second"), Value: attribute.StringValue("2")}, + ) + for _, tc := range []struct { + desc string + inputKeys []ocmetricdata.LabelKey + inputValues []ocmetricdata.LabelValue + expected *attribute.Set + expectedErr error + }{ + { + desc: "no attributes", + expected: attribute.EmptySet(), + }, + { + desc: "different numbers of keys and values", + inputKeys: []ocmetricdata.LabelKey{{Key: "foo"}}, + expected: attribute.EmptySet(), + expectedErr: errMismatchedAttributeKeyValues, + }, + { + desc: "multiple keys and values", + inputKeys: []ocmetricdata.LabelKey{{Key: "first"}, {Key: "second"}}, + inputValues: []ocmetricdata.LabelValue{ + {Value: "1", Present: true}, + {Value: "2", Present: true}, + }, + expected: &setWithMultipleKeys, + }, + { + desc: "multiple keys and values with some not present", + inputKeys: []ocmetricdata.LabelKey{{Key: "first"}, {Key: "second"}, {Key: "third"}}, + inputValues: []ocmetricdata.LabelValue{ + {Value: "1", Present: true}, + {Value: "2", Present: true}, + {Present: false}, + }, + expected: &setWithMultipleKeys, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + output, err := convertAttrs(tc.inputKeys, tc.inputValues) + if !errors.Is(err, tc.expectedErr) { + t.Errorf("convertAttrs(keys: %v, values: %v) = err(%v), want err(%v)", tc.inputKeys, tc.inputValues, err, tc.expectedErr) + } + if !output.Equals(tc.expected) { + t.Errorf("convertAttrs(keys: %v, values: %v) = %+v, want %+v", tc.inputKeys, tc.inputValues, output.ToSlice(), tc.expected.ToSlice()) + } + }) + } +} diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 270928f38b5..66226d4b6c2 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -14,8 +14,6 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) @@ -23,10 +21,6 @@ replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/bridge/opencensus => ../ -replace go.opentelemetry.io/otel/metric => ../../../metric - replace go.opentelemetry.io/otel/sdk => ../../../sdk -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index cc5af06ea90..c7ddc1e1307 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -1,6 +1,5 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod deleted file mode 100644 index ed539b85d35..00000000000 --- a/example/opencensus/go.mod +++ /dev/null @@ -1,38 +0,0 @@ -module go.opentelemetry.io/otel/example/opencensus - -go 1.17 - -replace ( - go.opentelemetry.io/otel => ../.. - go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus - go.opentelemetry.io/otel/sdk => ../../sdk -) - -require ( - go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.31.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 -) - -require ( - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect - go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect -) - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum deleted file mode 100644 index 98f74c56098..00000000000 --- a/example/opencensus/go.sum +++ /dev/null @@ -1,61 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= -go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/opencensus/main.go b/example/opencensus/main.go deleted file mode 100644 index 26c648d5948..00000000000 --- a/example/opencensus/main.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "context" - "fmt" - "log" - "time" - - "go.opencensus.io/metric" - "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricexport" - "go.opencensus.io/metric/metricproducer" - "go.opencensus.io/stats" - "go.opencensus.io/stats/view" - "go.opencensus.io/tag" - octrace "go.opencensus.io/trace" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/bridge/opencensus" - "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" - "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/sdk/metric/export" - sdktrace "go.opentelemetry.io/otel/sdk/trace" -) - -var ( - // instrumenttype differentiates between our gauge and view metrics. - keyType = tag.MustNewKey("instrumenttype") - // Counts the number of lines read in from standard input. - countMeasure = stats.Int64("test_count", "A count of something", stats.UnitDimensionless) - countView = &view.View{ - Name: "test_count", - Measure: countMeasure, - Description: "A count of something", - Aggregation: view.Count(), - TagKeys: []tag.Key{keyType}, - } -) - -func main() { - log.Println("Using OpenTelemetry stdout exporters.") - traceExporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) - if err != nil { - log.Fatal(fmt.Errorf("error creating trace exporter: %w", err)) - } - metricsExporter, err := stdoutmetric.New(stdoutmetric.WithPrettyPrint()) - if err != nil { - log.Fatal(fmt.Errorf("error creating metric exporter: %w", err)) - } - tracing(traceExporter) - if err := monitoring(metricsExporter); err != nil { - log.Fatal(err) - } -} - -// tracing demonstrates overriding the OpenCensus DefaultTracer to send spans -// to the OpenTelemetry exporter by calling OpenCensus APIs. -func tracing(otExporter sdktrace.SpanExporter) { - ctx := context.Background() - - log.Println("Configuring OpenCensus. Not Registering any OpenCensus exporters.") - octrace.ApplyConfig(octrace.Config{DefaultSampler: octrace.AlwaysSample()}) - - tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(otExporter)) - otel.SetTracerProvider(tp) - - log.Println("Installing the OpenCensus bridge to make OpenCensus libraries write spans using OpenTelemetry.") - tracer := tp.Tracer("simple") - octrace.DefaultTracer = opencensus.NewTracer(tracer) - tp.ForceFlush(ctx) - - log.Println("Creating OpenCensus span, which should be printed out using the OpenTelemetry stdouttrace exporter.\n-- It should have no parent, since it is the first span.") - ctx, outerOCSpan := octrace.StartSpan(ctx, "OpenCensusOuterSpan") - outerOCSpan.End() - tp.ForceFlush(ctx) - - log.Println("Creating OpenTelemetry span\n-- It should have the OpenCensus span as a parent, since the OpenCensus span was written with using OpenTelemetry APIs.") - ctx, otspan := tracer.Start(ctx, "OpenTelemetrySpan") - otspan.End() - tp.ForceFlush(ctx) - - log.Println("Creating OpenCensus span, which should be printed out using the OpenTelemetry stdouttrace exporter.\n-- It should have the OpenTelemetry span as a parent, since it was written using OpenTelemetry APIs") - _, innerOCSpan := octrace.StartSpan(ctx, "OpenCensusInnerSpan") - innerOCSpan.End() - tp.ForceFlush(ctx) -} - -// monitoring demonstrates creating an IntervalReader using the OpenTelemetry -// exporter to send metrics to the exporter by using either an OpenCensus -// registry or an OpenCensus view. -func monitoring(otExporter export.Exporter) error { - log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.") - ocExporter := opencensus.NewMetricExporter(otExporter) - intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter) - if err != nil { - return fmt.Errorf("failed to create interval reader: %w", err) - } - intervalReader.ReportingInterval = 10 * time.Second - log.Println("Emitting metrics using OpenCensus APIs. These should be printed out using the OpenTelemetry stdoutmetric exporter.") - err = intervalReader.Start() - if err != nil { - return fmt.Errorf("failed to start interval reader: %w", err) - } - defer intervalReader.Stop() - - log.Println("Registering a gauge metric using an OpenCensus registry.") - r := metric.NewRegistry() - metricproducer.GlobalManager().AddProducer(r) - gauge, err := r.AddInt64Gauge( - "test_gauge", - metric.WithDescription("A gauge for testing"), - metric.WithConstLabel(map[metricdata.LabelKey]metricdata.LabelValue{ - {Key: keyType.Name()}: metricdata.NewLabelValue("gauge"), - }), - ) - if err != nil { - return fmt.Errorf("failed to add gauge: %w", err) - } - entry, err := gauge.GetEntry() - if err != nil { - return fmt.Errorf("failed to get gauge entry: %w", err) - } - - log.Println("Registering a cumulative metric using an OpenCensus view.") - if err := view.Register(countView); err != nil { - return fmt.Errorf("failed to register views: %w", err) - } - ctx, err := tag.New(context.Background(), tag.Insert(keyType, "view")) - if err != nil { - return fmt.Errorf("failed to set tag: %w", err) - } - for i := int64(1); true; i++ { - // update stats for our gauge - entry.Set(i) - // update stats for our view - stats.Record(ctx, countMeasure.M(1)) - time.Sleep(time.Second) - } - return nil -} diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go b/example/prometheus/doc.go similarity index 88% rename from exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go rename to example/prometheus/doc.go index 25021f7328c..b272a494874 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig_test.go +++ b/example/prometheus/doc.go @@ -12,4 +12,5 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig +// Package main provides a code sample of the Prometheus exporter. +package main diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index d51de7fec82..441f03e5112 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -1,14 +1,9 @@ module go.opentelemetry.io/otel/example/prometheus -go 1.17 - -replace ( - go.opentelemetry.io/otel => ../.. - go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - go.opentelemetry.io/otel/sdk => ../../sdk -) +go 1.18 require ( + github.com/prometheus/client_golang v1.13.0 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/prometheus v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 @@ -22,18 +17,23 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_golang v1.12.2 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.32.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect - google.golang.org/protobuf v1.26.0 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + google.golang.org/protobuf v1.28.1 // indirect ) -replace go.opentelemetry.io/otel/metric => ../../metric +replace go.opentelemetry.io/otel => ../.. + +replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus + +replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric +replace go.opentelemetry.io/otel/metric => ../../metric + replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 5563b0bf878..f652c33031b 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -38,7 +38,6 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -65,9 +64,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -165,8 +166,9 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -175,14 +177,16 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -266,12 +270,15 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -316,15 +323,20 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -446,8 +458,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 1a64371b764..fada742d32b 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package main import ( @@ -21,118 +24,75 @@ import ( "net/http" "os" "os/signal" - "sync" - "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric/global" + otelprom "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" -) - -var ( - lemonsKey = attribute.Key("ex.com/lemons") + "go.opentelemetry.io/otel/sdk/metric" ) -func initMeter() error { - config := prometheus.Config{ - DefaultHistogramBoundaries: []float64{1, 2, 5, 10, 20, 50}, - } - c := controller.New( - processor.NewFactory( - selector.NewWithHistogramDistribution( - histogram.WithExplicitBoundaries(config.DefaultHistogramBoundaries), - ), - aggregation.CumulativeTemporalitySelector(), - processor.WithMemory(true), - ), - ) - exporter, err := prometheus.New(config, c) - if err != nil { - return fmt.Errorf("failed to initialize prometheus exporter: %w", err) - } - - global.SetMeterProvider(exporter.MeterProvider()) +func main() { + ctx := context.Background() - http.HandleFunc("/", exporter.ServeHTTP) - go func() { - _ = http.ListenAndServe(":2222", nil) - }() + // The exporter embeds a default OpenTelemetry Reader and + // implements prometheus.Collector, allowing it to be used as + // both a Reader and Collector. + exporter := otelprom.New() + provider := metric.NewMeterProvider(metric.WithReader(exporter)) + meter := provider.Meter("github.com/open-telemetry/opentelemetry-go/example/prometheus") - fmt.Println("Prometheus server running on :2222") - return nil -} + // Start the prometheus HTTP server and pass the exporter Collector to it + go serveMetrics(exporter.Collector) -func main() { - if err := initMeter(); err != nil { - log.Fatal(err) + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), } - meter := global.Meter("ex.com/basic") - - observerLock := new(sync.RWMutex) - observerValueToReport := new(float64) - observerAttrsToReport := new([]attribute.KeyValue) - - gaugeObserver, err := meter.AsyncFloat64().Gauge("ex.com.one") + // This is the equivalent of prometheus.NewCounterVec + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) if err != nil { - log.Panicf("failed to initialize instrument: %v", err) + log.Fatal(err) } - _ = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { - (*observerLock).RLock() - value := *observerValueToReport - attrs := *observerAttrsToReport - (*observerLock).RUnlock() - gaugeObserver.Observe(ctx, value, attrs...) - }) + counter.Add(ctx, 5, attrs...) - hist, err := meter.SyncFloat64().Histogram("ex.com.two") + gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) if err != nil { - log.Panicf("failed to initialize instrument: %v", err) + log.Fatal(err) } - counter, err := meter.SyncFloat64().Counter("ex.com.three") + gauge.Add(ctx, 100, attrs...) + gauge.Add(ctx, -25, attrs...) + + // This is the equivalent of prometheus.NewHistogramVec + histogram, err := meter.SyncFloat64().Histogram("baz", instrument.WithDescription("a very nice histogram")) if err != nil { - log.Panicf("failed to initialize instrument: %v", err) + log.Fatal(err) } + histogram.Record(ctx, 23, attrs...) + histogram.Record(ctx, 7, attrs...) + histogram.Record(ctx, 101, attrs...) + histogram.Record(ctx, 105, attrs...) - commonAttrs := []attribute.KeyValue{lemonsKey.Int(10), attribute.String("A", "1"), attribute.String("B", "2"), attribute.String("C", "3")} - notSoCommonAttrs := []attribute.KeyValue{lemonsKey.Int(13)} - - ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) - defer stop() - - (*observerLock).Lock() - *observerValueToReport = 1.0 - *observerAttrsToReport = commonAttrs - (*observerLock).Unlock() - - hist.Record(ctx, 2.0, commonAttrs...) - counter.Add(ctx, 12.0, commonAttrs...) - - time.Sleep(5 * time.Second) - - (*observerLock).Lock() - *observerValueToReport = 1.0 - *observerAttrsToReport = notSoCommonAttrs - (*observerLock).Unlock() - hist.Record(ctx, 2.0, notSoCommonAttrs...) - counter.Add(ctx, 22.0, notSoCommonAttrs...) - - time.Sleep(5 * time.Second) - - (*observerLock).Lock() - *observerValueToReport = 13.0 - *observerAttrsToReport = commonAttrs - (*observerLock).Unlock() - hist.Record(ctx, 12.0, commonAttrs...) - counter.Add(ctx, 13.0, commonAttrs...) + ctx, _ = signal.NotifyContext(ctx, os.Interrupt) + <-ctx.Done() +} - fmt.Println("Example finished updating, please visit :2222") +func serveMetrics(collector prometheus.Collector) { + registry := prometheus.NewRegistry() + err := registry.Register(collector) + if err != nil { + fmt.Printf("error registering collector: %v", err) + return + } - <-ctx.Done() + log.Printf("serving metrics at localhost:2222/metrics") + http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) + err = http.ListenAndServe(":2222", nil) + if err != nil { + fmt.Printf("error serving http: %v", err) + return + } } diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/client.go new file mode 100644 index 00000000000..48b0fe805e2 --- /dev/null +++ b/exporters/otlp/otlpmetric/client.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + +import ( + "context" + + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +// Client handles the transmission of OTLP data to an OTLP receiving endpoint. +type Client interface { + // UploadMetrics transmits metric data to an OTLP receiver. + // + // All retry logic must be handled by UploadMetrics alone, the Exporter + // does not implement any retry logic. All returned errors are considered + // unrecoverable. + UploadMetrics(context.Context, *mpb.ResourceMetrics) error + + // ForceFlush flushes any metric data held by an Client. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(context.Context) error + + // Shutdown flushes all metric data held by a Client and closes any + // connections it holds open. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // Shutdown will only be called once by the Exporter. Once a return value + // is received by the Exporter from Shutdown the Client will not be used + // anymore. Therefore all computational resources need to be released + // after this is called so the Client can be garbage collected. + Shutdown(context.Context) error +} diff --git a/exporters/otlp/otlpmetric/clients.go b/exporters/otlp/otlpmetric/clients.go deleted file mode 100644 index 6808d464761..00000000000 --- a/exporters/otlp/otlpmetric/clients.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - -import ( - "context" - - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// Client manages connections to the collector, handles the -// transformation of data into wire format, and the transmission of that -// data to the collector. -type Client interface { - // Start should establish connection(s) to endpoint(s). It is - // called just once by the exporter, so the implementation - // does not need to worry about idempotence and locking. - Start(ctx context.Context) error - // Stop should close the connections. The function is called - // only once by the exporter, so the implementation does not - // need to worry about idempotence, but it may be called - // concurrently with UploadMetrics, so proper - // locking is required. The function serves as a - // synchronization point - after the function returns, the - // process of closing connections is assumed to be finished. - Stop(ctx context.Context) error - // UploadMetrics should transform the passed metrics to the - // wire format and send it to the collector. May be called - // concurrently. - UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error -} diff --git a/exporters/otlp/otlpmetric/doc.go b/exporters/otlp/otlpmetric/doc.go new file mode 100644 index 00000000000..31831c415fe --- /dev/null +++ b/exporters/otlp/otlpmetric/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package otlpmetric provides an OpenTelemetry metric Exporter that can be +// used with PeriodicReader. It transforms metricdata into OTLP and transmits +// the transformed data to OTLP receivers. The Exporter is configurable to use +// different Clients, each using a distinct transport protocol to communicate +// to an OTLP receiving endpoint. +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index e46c6bea790..0bd546e5255 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -12,121 +12,96 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( "context" - "errors" + "fmt" "sync" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -var ( - errAlreadyStarted = errors.New("already started") + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -// Exporter exports metrics data in the OTLP wire format. -type Exporter struct { - client Client - temporalitySelector aggregation.TemporalitySelector +// exporter exports metrics data as OTLP. +type exporter struct { + // Ensure synchronous access to the client across all functionality. + clientMu sync.Mutex + client Client - mu sync.RWMutex - started bool - - startOnce sync.Once - stopOnce sync.Once + shutdownOnce sync.Once } -// Export exports a batch of metrics. -func (e *Exporter) Export(ctx context.Context, res *resource.Resource, ilr export.InstrumentationLibraryReader) error { - rm, err := metrictransform.InstrumentationLibraryReader(ctx, e, res, ilr, 1) - if err != nil { - return err - } - if rm == nil { - return nil +// Export transforms and transmits metric data to an OTLP receiver. +func (e *exporter) Export(ctx context.Context, rm metricdata.ResourceMetrics) error { + otlpRm, err := transform.ResourceMetrics(rm) + // Best effort upload of transformable metrics. + e.clientMu.Lock() + upErr := e.client.UploadMetrics(ctx, otlpRm) + e.clientMu.Unlock() + if upErr != nil { + if err == nil { + return upErr + } + // Merge the two errors. + return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr) } - - // TODO: There is never more than one resource emitted by this - // call, as per the specification. We can change the - // signature of UploadMetrics correspondingly. Here create a - // singleton list to reduce the size of the current PR: - return e.client.UploadMetrics(ctx, rm) -} - -// Start establishes a connection to the receiving endpoint. -func (e *Exporter) Start(ctx context.Context) error { - var err = errAlreadyStarted - e.startOnce.Do(func() { - e.mu.Lock() - e.started = true - e.mu.Unlock() - err = e.client.Start(ctx) - }) - return err } -// Shutdown flushes all exports and closes all connections to the receiving endpoint. -func (e *Exporter) Shutdown(ctx context.Context) error { - e.mu.RLock() - started := e.started - e.mu.RUnlock() - - if !started { - return nil - } - - var err error +// ForceFlush flushes any metric data held by an exporter. +func (e *exporter) ForceFlush(ctx context.Context) error { + // The Exporter does not hold data, forward the command to the client. + e.clientMu.Lock() + defer e.clientMu.Unlock() + return e.client.ForceFlush(ctx) +} - e.stopOnce.Do(func() { - err = e.client.Stop(ctx) - e.mu.Lock() - e.started = false - e.mu.Unlock() +var errShutdown = fmt.Errorf("exporter is shutdown") + +// Shutdown flushes all metric data held by an exporter and releases any held +// computational resources. +func (e *exporter) Shutdown(ctx context.Context) error { + err := errShutdown + e.shutdownOnce.Do(func() { + e.clientMu.Lock() + client := e.client + e.client = shutdownClient{} + e.clientMu.Unlock() + err = client.Shutdown(ctx) }) - return err } -// TemporalityFor returns the accepted temporality for a metric measurment. -func (e *Exporter) TemporalityFor(descriptor *sdkapi.Descriptor, kind aggregation.Kind) aggregation.Temporality { - return e.temporalitySelector.TemporalityFor(descriptor, kind) +// New return an Exporter that uses client to transmits the OTLP data it +// produces. The client is assumed to be fully started and able to communicate +// with its OTLP receiving endpoint. +func New(client Client) metric.Exporter { + return &exporter{client: client} } -var _ export.Exporter = (*Exporter)(nil) +type shutdownClient struct{} -// New constructs a new Exporter and starts it. -func New(ctx context.Context, client Client, opts ...Option) (*Exporter, error) { - exp := NewUnstarted(client, opts...) - if err := exp.Start(ctx); err != nil { - return nil, err +func (c shutdownClient) err(ctx context.Context) error { + if err := ctx.Err(); err != nil { + return err } - return exp, nil + return errShutdown } -// NewUnstarted constructs a new Exporter and does not start it. -func NewUnstarted(client Client, opts ...Option) *Exporter { - cfg := config{ - // Note: the default TemporalitySelector is specified - // as Cumulative: - // https://github.com/open-telemetry/opentelemetry-specification/issues/731 - temporalitySelector: aggregation.CumulativeTemporalitySelector(), - } - - for _, opt := range opts { - cfg = opt.apply(cfg) - } +func (c shutdownClient) UploadMetrics(ctx context.Context, _ *mpb.ResourceMetrics) error { + return c.err(ctx) +} - e := &Exporter{ - client: client, - temporalitySelector: cfg.temporalitySelector, - } +func (c shutdownClient) ForceFlush(ctx context.Context) error { + return c.err(ctx) +} - return e +func (c shutdownClient) Shutdown(ctx context.Context) error { + return c.err(ctx) } diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index d5208fc26d6..0b673f50031 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -12,837 +12,82 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric_test +//go:build go1.18 +// +build go1.18 + +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( "context" - "fmt" + "sync" "testing" - "time" - "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/testing/protocmp" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -var ( - // Timestamps used in this test: - intervalStart = time.Now() - intervalEnd = intervalStart.Add(time.Hour) + "go.opentelemetry.io/otel/sdk/metric/metricdata" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -type stubClient struct { - rm []*metricpb.ResourceMetrics +type client struct { + // n is incremented by all Client methods. If these methods are called + // concurrently this should fail tests run with the race detector. + n int } -func (m *stubClient) Start(ctx context.Context) error { +func (c *client) UploadMetrics(context.Context, *mpb.ResourceMetrics) error { + c.n++ return nil } -func (m *stubClient) Stop(ctx context.Context) error { +func (c *client) ForceFlush(context.Context) error { + c.n++ return nil } -func (m *stubClient) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { - m.rm = append(m.rm, protoMetrics) +func (c *client) Shutdown(context.Context) error { + c.n++ return nil } -var _ otlpmetric.Client = (*stubClient)(nil) - -func (m *stubClient) Reset() { - m.rm = nil -} - -func newExporter(t *testing.T, opts ...otlpmetric.Option) (*otlpmetric.Exporter, *stubClient) { - client := &stubClient{} - exp, _ := otlpmetric.New(context.Background(), client, opts...) - return exp, client -} - -func startTime() uint64 { - return uint64(intervalStart.UnixNano()) -} - -func pointTime() uint64 { - return uint64(intervalEnd.UnixNano()) -} - -type testRecord struct { - name string - iKind sdkapi.InstrumentKind - nKind number.Kind - attrs []attribute.KeyValue - - meterName string - meterOpts []metric.MeterOption -} - -func record( - name string, - iKind sdkapi.InstrumentKind, - nKind number.Kind, - attrs []attribute.KeyValue, - meterName string, - meterOpts ...metric.MeterOption) testRecord { - return testRecord{ - name: name, - iKind: iKind, - nKind: nKind, - attrs: attrs, - meterName: meterName, - meterOpts: meterOpts, - } -} - -var ( - baseKeyValues = []attribute.KeyValue{attribute.String("host", "test.com")} - cpuKey = attribute.Key("CPU") - - testHistogramBoundaries = []float64{2.0, 4.0, 8.0} - - cpu1Attrs = []*commonpb.KeyValue{ - { - Key: "CPU", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 1, - }, - }, - }, - { - Key: "host", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "test.com", - }, - }, - }, - } - cpu2Attrs = []*commonpb.KeyValue{ - { - Key: "CPU", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 2, - }, - }, - }, - { - Key: "host", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "test.com", - }, - }, - }, - } - - testerAResource = resource.NewSchemaless(attribute.String("instance", "tester-a")) - testerAResourcePb = metrictransform.Resource(testerAResource) -) - -const ( - // Most of this test uses an empty instrumentation library name. - testLibName = "" -) - -func TestNoGroupingExport(t *testing.T) { - runMetricExportTests( - t, - nil, - resource.Empty(), - []testRecord{ - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(2)), - testLibName, - ), - }, - []*metricpb.ResourceMetrics{ - { - Resource: nil, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) -} - -func TestHistogramInt64MetricGroupingExport(t *testing.T) { - r := record( - "int64-histogram", - sdkapi.HistogramInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ) - sumVal := 11.0 - expected := []*metricpb.ResourceMetrics{ - { - Resource: nil, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "int64-histogram", - Data: &metricpb.Metric_Histogram{ - Histogram: &metricpb.Histogram{ - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.HistogramDataPoint{ - { - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - Count: 2, - Sum: &sumVal, - ExplicitBounds: testHistogramBoundaries, - BucketCounts: []uint64{1, 0, 0, 1}, - }, - { - Attributes: cpu1Attrs, - Count: 2, - Sum: &sumVal, - ExplicitBounds: testHistogramBoundaries, - BucketCounts: []uint64{1, 0, 0, 1}, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - } - runMetricExportTests(t, nil, resource.Empty(), []testRecord{r, r}, expected) -} - -func TestHistogramFloat64MetricGroupingExport(t *testing.T) { - r := record( - "float64-histogram", - sdkapi.HistogramInstrumentKind, - number.Float64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ) - sumVal := 11.0 - expected := []*metricpb.ResourceMetrics{ - { - Resource: nil, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "float64-histogram", - Data: &metricpb.Metric_Histogram{ - Histogram: &metricpb.Histogram{ - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.HistogramDataPoint{ - { - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - Count: 2, - Sum: &sumVal, - ExplicitBounds: testHistogramBoundaries, - BucketCounts: []uint64{1, 0, 0, 1}, - }, - { - Attributes: cpu1Attrs, - Count: 2, - Sum: &sumVal, - ExplicitBounds: testHistogramBoundaries, - BucketCounts: []uint64{1, 0, 0, 1}, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - } - runMetricExportTests(t, nil, resource.Empty(), []testRecord{r, r}, expected) -} - -func TestCountInt64MetricGroupingExport(t *testing.T) { - r := record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ) - runMetricExportTests( - t, - nil, - resource.Empty(), - []testRecord{r, r}, - []*metricpb.ResourceMetrics{ - { - Resource: nil, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) -} - -func TestCountFloat64MetricGroupingExport(t *testing.T) { - r := record( - "float64-count", - sdkapi.CounterInstrumentKind, - number.Float64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ) - runMetricExportTests( - t, - nil, - resource.Empty(), - []testRecord{r, r}, - []*metricpb.ResourceMetrics{ - { - Resource: nil, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "float64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) -} - -func TestResourceMetricGroupingExport(t *testing.T) { - runMetricExportTests( - t, - nil, - testerAResource, - []testRecord{ - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(2)), - testLibName, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ), - }, - []*metricpb.ResourceMetrics{ - { - Resource: testerAResourcePb, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) -} - -func TestResourceInstLibMetricGroupingExport(t *testing.T) { - version1 := metric.WithInstrumentationVersion("v1") - version2 := metric.WithInstrumentationVersion("v2") - specialSchema := metric.WithSchemaURL("schurl") - summingLib := "summing-lib" - countingLib := "counting-lib" - runMetricExportTests( - t, - nil, - testerAResource, - []testRecord{ - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - countingLib, - version1, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - countingLib, - version2, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - countingLib, - version1, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(2)), - countingLib, - version1, - ), - record( - "int64-count", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - summingLib, - specialSchema, - ), - }, - []*metricpb.ResourceMetrics{ - { - Resource: testerAResourcePb, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Scope: &commonpb.InstrumentationScope{ - Name: "counting-lib", - Version: "v1", - }, - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu2Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - { - Scope: &commonpb.InstrumentationScope{ - Name: "counting-lib", - Version: "v2", - }, - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - { - Scope: &commonpb.InstrumentationScope{ - Name: "summing-lib", - }, - SchemaUrl: "schurl", - Metrics: []*metricpb.Metric{ - { - Name: "int64-count", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: true, - AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) -} - -func TestStatelessAggregationTemporality(t *testing.T) { - type testcase struct { - name string - instrumentKind sdkapi.InstrumentKind - aggTemporality metricpb.AggregationTemporality - monotonic bool - } - - for _, k := range []testcase{ - {"counter", sdkapi.CounterInstrumentKind, metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, true}, - {"updowncounter", sdkapi.UpDownCounterInstrumentKind, metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, false}, - {"counterobserver", sdkapi.CounterObserverInstrumentKind, metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, true}, - {"updowncounterobserver", sdkapi.UpDownCounterObserverInstrumentKind, metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, false}, - } { - t.Run(k.name, func(t *testing.T) { - runMetricExportTests( - t, - []otlpmetric.Option{ - otlpmetric.WithMetricAggregationTemporalitySelector( - aggregation.StatelessTemporalitySelector(), - ), - }, - testerAResource, - []testRecord{ - record( - "instrument", - k.instrumentKind, - number.Int64Kind, - append(baseKeyValues, cpuKey.Int(1)), - testLibName, - ), - }, - []*metricpb.ResourceMetrics{ - { - Resource: testerAResourcePb, - ScopeMetrics: []*metricpb.ScopeMetrics{ - { - Metrics: []*metricpb.Metric{ - { - Name: "instrument", - Data: &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: k.monotonic, - AggregationTemporality: k.aggTemporality, - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11}, - Attributes: cpu1Attrs, - StartTimeUnixNano: startTime(), - TimeUnixNano: pointTime(), - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - ) - }) - } -} - -func runMetricExportTests(t *testing.T, opts []otlpmetric.Option, res *resource.Resource, records []testRecord, expected []*metricpb.ResourceMetrics) { - exp, driver := newExporter(t, opts...) - - libraryRecs := map[instrumentation.Library][]export.Record{} - for _, r := range records { - lcopy := make([]attribute.KeyValue, len(r.attrs)) - copy(lcopy, r.attrs) - desc := metrictest.NewDescriptor(r.name, r.iKind, r.nKind) - labs := attribute.NewSet(lcopy...) - - var agg, ckpt aggregator.Aggregator - if r.iKind.Adding() { - sums := sum.New(2) - agg, ckpt = &sums[0], &sums[1] - } else { - histos := histogram.New(2, &desc, histogram.WithExplicitBoundaries(testHistogramBoundaries)) - agg, ckpt = &histos[0], &histos[1] - } - - ctx := context.Background() - if r.iKind.Synchronous() { - // For synchronous instruments, perform two updates: 1 and 10 - switch r.nKind { - case number.Int64Kind: - require.NoError(t, agg.Update(ctx, number.NewInt64Number(1), &desc)) - require.NoError(t, agg.Update(ctx, number.NewInt64Number(10), &desc)) - case number.Float64Kind: - require.NoError(t, agg.Update(ctx, number.NewFloat64Number(1), &desc)) - require.NoError(t, agg.Update(ctx, number.NewFloat64Number(10), &desc)) - default: - t.Fatalf("invalid number kind: %v", r.nKind) +func TestExporterClientConcurrency(t *testing.T) { + const goroutines = 5 + + exp := New(&client{}) + rm := metricdata.ResourceMetrics{} + ctx := context.Background() + + done := make(chan struct{}) + first := make(chan struct{}, goroutines) + var wg sync.WaitGroup + for i := 0; i < goroutines; i++ { + wg.Add(1) + go func() { + defer wg.Done() + assert.NoError(t, exp.Export(ctx, rm)) + assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. + first <- struct{}{} + + for { + _ = exp.Export(ctx, rm) + _ = exp.ForceFlush(ctx) + + select { + case <-done: + return + default: + } } - } else { - // For asynchronous instruments, perform a single update: 11 - switch r.nKind { - case number.Int64Kind: - require.NoError(t, agg.Update(ctx, number.NewInt64Number(11), &desc)) - case number.Float64Kind: - require.NoError(t, agg.Update(ctx, number.NewFloat64Number(11), &desc)) - default: - t.Fatalf("invalid number kind: %v", r.nKind) - } - } - require.NoError(t, agg.SynchronizedMove(ckpt, &desc)) - - meterCfg := metric.NewMeterConfig(r.meterOpts...) - lib := instrumentation.Library{ - Name: r.meterName, - Version: meterCfg.InstrumentationVersion(), - SchemaURL: meterCfg.SchemaURL(), - } - libraryRecs[lib] = append(libraryRecs[lib], export.NewRecord(&desc, &labs, ckpt.Aggregation(), intervalStart, intervalEnd)) - } - assert.NoError(t, exp.Export(context.Background(), res, processortest.MultiInstrumentationLibraryReader(libraryRecs))) - - // assert.ElementsMatch does not equate nested slices of different order, - // therefore this requires the top level slice to be broken down. - // Build a map of Resource/Scope pairs to Metrics, from that validate the - // metric elements match for all expected pairs. Finally, make we saw all - // expected pairs. - keyFor := func(sm *metricpb.ScopeMetrics) string { - return fmt.Sprintf("%s/%s/%s", sm.GetScope().GetName(), sm.GetScope().GetVersion(), sm.GetSchemaUrl()) - } - got := map[string][]*metricpb.Metric{} - for _, rm := range driver.rm { - for _, sm := range rm.ScopeMetrics { - k := keyFor(sm) - got[k] = append(got[k], sm.GetMetrics()...) - } + }() } - seen := map[string]struct{}{} - for _, rm := range expected { - for _, sm := range rm.ScopeMetrics { - k := keyFor(sm) - seen[k] = struct{}{} - g, ok := got[k] - if !ok { - t.Errorf("missing metrics for:\n\tInstrumentationScope: %q\n", k) - continue - } - if !assert.Len(t, g, len(sm.GetMetrics())) { - continue - } - for i, expected := range sm.GetMetrics() { - assert.Equal(t, "", cmp.Diff(expected, g[i], protocmp.Transform())) - } - } + for i := 0; i < goroutines; i++ { + <-first } - for k := range got { - if _, ok := seen[k]; !ok { - t.Errorf("did not expect metrics for:\n\tInstrumentationScope: %s\n", k) - } - } -} + close(first) + assert.NoError(t, exp.Shutdown(ctx)) + assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) -func TestEmptyMetricExport(t *testing.T) { - exp, driver := newExporter(t) - - for _, test := range []struct { - records []export.Record - want []*metricpb.ResourceMetrics - }{ - { - []export.Record(nil), - []*metricpb.ResourceMetrics(nil), - }, - { - []export.Record{}, - []*metricpb.ResourceMetrics(nil), - }, - } { - driver.Reset() - require.NoError(t, exp.Export(context.Background(), resource.Empty(), processortest.MultiInstrumentationLibraryReader(map[instrumentation.Library][]export.Record{ - { - Name: testLibName, - }: test.records, - }))) - assert.Equal(t, test.want, driver.rm) - } + close(done) + wg.Wait() } diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 2541614fc71..b99be852d34 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -1,18 +1,18 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric -go 1.17 +go 1.18 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.46.2 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.42.0 + google.golang.org/protobuf v1.27.1 ) require ( @@ -31,14 +31,14 @@ require ( gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) +replace go.opentelemetry.io/otel/metric => ../../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric + replace go.opentelemetry.io/otel => ../../.. replace go.opentelemetry.io/otel/sdk => ../../../sdk -replace go.opentelemetry.io/otel/metric => ../../../metric +replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry replace go.opentelemetry.io/otel/trace => ../../../trace - -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index fda59974476..82bf95645f4 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -35,7 +35,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -51,7 +50,6 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -61,7 +59,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -226,7 +223,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -268,9 +264,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -398,9 +392,8 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -413,9 +406,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go b/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go deleted file mode 100644 index 5432906cf95..00000000000 --- a/exporters/otlp/otlpmetric/internal/metrictransform/attribute.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictransform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/resource" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. -func KeyValues(attrs []attribute.KeyValue) []*commonpb.KeyValue { - if len(attrs) == 0 { - return nil - } - - out := make([]*commonpb.KeyValue, 0, len(attrs)) - for _, kv := range attrs { - out = append(out, KeyValue(kv)) - } - return out -} - -// Iterator transforms an attribute iterator into OTLP key-values. -func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { - l := iter.Len() - if l == 0 { - return nil - } - - out := make([]*commonpb.KeyValue, 0, l) - for iter.Next() { - out = append(out, KeyValue(iter.Attribute())) - } - return out -} - -// ResourceAttributes transforms a Resource OTLP key-values. -func ResourceAttributes(res *resource.Resource) []*commonpb.KeyValue { - return Iterator(res.Iter()) -} - -// KeyValue transforms an attribute KeyValue into an OTLP key-value. -func KeyValue(kv attribute.KeyValue) *commonpb.KeyValue { - return &commonpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} -} - -// Value transforms an attribute Value into an OTLP AnyValue. -func Value(v attribute.Value) *commonpb.AnyValue { - av := new(commonpb.AnyValue) - switch v.Type() { - case attribute.BOOL: - av.Value = &commonpb.AnyValue_BoolValue{ - BoolValue: v.AsBool(), - } - case attribute.BOOLSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: boolSliceValues(v.AsBoolSlice()), - }, - } - case attribute.INT64: - av.Value = &commonpb.AnyValue_IntValue{ - IntValue: v.AsInt64(), - } - case attribute.INT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: int64SliceValues(v.AsInt64Slice()), - }, - } - case attribute.FLOAT64: - av.Value = &commonpb.AnyValue_DoubleValue{ - DoubleValue: v.AsFloat64(), - } - case attribute.FLOAT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: float64SliceValues(v.AsFloat64Slice()), - }, - } - case attribute.STRING: - av.Value = &commonpb.AnyValue_StringValue{ - StringValue: v.AsString(), - } - case attribute.STRINGSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: stringSliceValues(v.AsStringSlice()), - }, - } - default: - av.Value = &commonpb.AnyValue_StringValue{ - StringValue: "INVALID", - } - } - return av -} - -func boolSliceValues(vals []bool) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: v, - }, - } - } - return converted -} - -func int64SliceValues(vals []int64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: v, - }, - } - } - return converted -} - -func float64SliceValues(vals []float64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: v, - }, - } - } - return converted -} - -func stringSliceValues(vals []string) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: v, - }, - } - } - return converted -} diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go deleted file mode 100644 index e728e24b721..00000000000 --- a/exporters/otlp/otlpmetric/internal/metrictransform/attribute_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictransform - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -type attributeTest struct { - attrs []attribute.KeyValue - expected []*commonpb.KeyValue -} - -func TestAttributes(t *testing.T) { - for _, test := range []attributeTest{ - {nil, nil}, - { - []attribute.KeyValue{ - attribute.Int("int to int", 123), - attribute.Int64("int64 to int64", 1234567), - attribute.Float64("float64 to double", 1.61), - attribute.String("string to string", "string"), - attribute.Bool("bool to bool", true), - }, - []*commonpb.KeyValue{ - { - Key: "int to int", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 123, - }, - }, - }, - { - Key: "int64 to int64", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 1234567, - }, - }, - }, - { - Key: "float64 to double", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: 1.61, - }, - }, - }, - { - Key: "string to string", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "string", - }, - }, - }, - { - Key: "bool to bool", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: true, - }, - }, - }, - }, - }, - } { - got := KeyValues(test.attrs) - if !assert.Len(t, got, len(test.expected)) { - continue - } - for i, actual := range got { - if a, ok := actual.Value.Value.(*commonpb.AnyValue_DoubleValue); ok { - e, ok := test.expected[i].Value.Value.(*commonpb.AnyValue_DoubleValue) - if !ok { - t.Errorf("expected AnyValue_DoubleValue, got %T", test.expected[i].Value.Value) - continue - } - if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { - continue - } - e.DoubleValue = a.DoubleValue - } - assert.Equal(t, test.expected[i], actual) - } - } -} - -func TestArrayAttributes(t *testing.T) { - // Array KeyValue supports only arrays of primitive types: - // "bool", "int", "int64", - // "float64", "string", - for _, test := range []attributeTest{ - {nil, nil}, - { - []attribute.KeyValue{ - { - Key: attribute.Key("invalid"), - Value: attribute.Value{}, - }, - }, - []*commonpb.KeyValue{ - { - Key: "invalid", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "INVALID", - }, - }, - }, - }, - }, - { - []attribute.KeyValue{ - attribute.BoolSlice("bool slice to bool array", []bool{true, false}), - attribute.IntSlice("int slice to int64 array", []int{1, 2, 3}), - attribute.Int64Slice("int64 slice to int64 array", []int64{1, 2, 3}), - attribute.Float64Slice("float64 slice to double array", []float64{1.11, 2.22, 3.33}), - attribute.StringSlice("string slice to string array", []string{"foo", "bar", "baz"}), - }, - []*commonpb.KeyValue{ - newOTelBoolArray("bool slice to bool array", []bool{true, false}), - newOTelIntArray("int slice to int64 array", []int64{1, 2, 3}), - newOTelIntArray("int64 slice to int64 array", []int64{1, 2, 3}), - newOTelDoubleArray("float64 slice to double array", []float64{1.11, 2.22, 3.33}), - newOTelStringArray("string slice to string array", []string{"foo", "bar", "baz"}), - }, - }, - } { - actualArrayAttributes := KeyValues(test.attrs) - expectedArrayAttributes := test.expected - if !assert.Len(t, actualArrayAttributes, len(expectedArrayAttributes)) { - continue - } - - for i, actualArrayAttr := range actualArrayAttributes { - expectedArrayAttr := expectedArrayAttributes[i] - expectedKey, actualKey := expectedArrayAttr.Key, actualArrayAttr.Key - if !assert.Equal(t, expectedKey, actualKey) { - continue - } - - expected := expectedArrayAttr.Value.GetArrayValue() - actual := actualArrayAttr.Value.GetArrayValue() - if expected == nil { - assert.Nil(t, actual) - continue - } - if assert.NotNil(t, actual, "expected not nil for %s", actualKey) { - assertExpectedArrayValues(t, expected.Values, actual.Values) - } - } - } -} - -func assertExpectedArrayValues(t *testing.T, expectedValues, actualValues []*commonpb.AnyValue) { - for i, actual := range actualValues { - expected := expectedValues[i] - if a, ok := actual.Value.(*commonpb.AnyValue_DoubleValue); ok { - e, ok := expected.Value.(*commonpb.AnyValue_DoubleValue) - if !ok { - t.Errorf("expected AnyValue_DoubleValue, got %T", expected.Value) - continue - } - if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { - continue - } - e.DoubleValue = a.DoubleValue - } - assert.Equal(t, expected, actual) - } -} - -func newOTelBoolArray(key string, values []bool) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - for _, b := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: b, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelIntArray(key string, values []int64) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, i := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: i, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelDoubleArray(key string, values []float64) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, d := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: d, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelStringArray(key string, values []string) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, s := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: s, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelArray(key string, arrayValues []*commonpb.AnyValue) *commonpb.KeyValue { - return &commonpb.KeyValue{ - Key: key, - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: arrayValues, - }, - }, - }, - } -} diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric.go deleted file mode 100644 index 2d7c9049905..00000000000 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric.go +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package metrictransform provides translations for opentelemetry-go concepts and -// structures to otlp structures. -package metrictransform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" - -import ( - "context" - "errors" - "fmt" - "strings" - "sync" - "time" - - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/resource" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -var ( - // ErrUnimplementedAgg is returned when a transformation of an unimplemented - // aggregator is attempted. - ErrUnimplementedAgg = errors.New("unimplemented aggregator") - - // ErrIncompatibleAgg is returned when - // aggregation.Kind implies an interface conversion that has - // failed. - ErrIncompatibleAgg = errors.New("incompatible aggregation type") - - // ErrUnknownValueType is returned when a transformation of an unknown value - // is attempted. - ErrUnknownValueType = errors.New("invalid value type") - - // ErrContextCanceled is returned when a context cancellation halts a - // transformation. - ErrContextCanceled = errors.New("context canceled") - - // ErrTransforming is returned when an unexected error is encountered transforming. - ErrTransforming = errors.New("transforming failed") -) - -// result is the product of transforming Records into OTLP Metrics. -type result struct { - Metric *metricpb.Metric - Err error -} - -// toNanos returns the number of nanoseconds since the UNIX epoch. -func toNanos(t time.Time) uint64 { - if t.IsZero() { - return 0 - } - return uint64(t.UnixNano()) -} - -// InstrumentationLibraryReader transforms all records contained in a checkpoint into -// batched OTLP ResourceMetrics. -func InstrumentationLibraryReader(ctx context.Context, temporalitySelector aggregation.TemporalitySelector, res *resource.Resource, ilmr export.InstrumentationLibraryReader, numWorkers uint) (*metricpb.ResourceMetrics, error) { - var sms []*metricpb.ScopeMetrics - - err := ilmr.ForEach(func(lib instrumentation.Library, mr export.Reader) error { - records, errc := source(ctx, temporalitySelector, mr) - - // Start a fixed number of goroutines to transform records. - transformed := make(chan result) - var wg sync.WaitGroup - wg.Add(int(numWorkers)) - for i := uint(0); i < numWorkers; i++ { - go func() { - defer wg.Done() - transformer(ctx, temporalitySelector, records, transformed) - }() - } - go func() { - wg.Wait() - close(transformed) - }() - - // Synchronously collect the transformed records and transmit. - ms, err := sink(ctx, transformed) - if err != nil { - return nil - } - - // source is complete, check for any errors. - if err := <-errc; err != nil { - return err - } - if len(ms) == 0 { - return nil - } - - sms = append(sms, &metricpb.ScopeMetrics{ - Metrics: ms, - SchemaUrl: lib.SchemaURL, - Scope: &commonpb.InstrumentationScope{ - Name: lib.Name, - Version: lib.Version, - }, - }) - return nil - }) - if len(sms) == 0 { - return nil, err - } - - rms := &metricpb.ResourceMetrics{ - Resource: Resource(res), - SchemaUrl: res.SchemaURL(), - ScopeMetrics: sms, - } - - return rms, err -} - -// source starts a goroutine that sends each one of the Records yielded by -// the Reader on the returned chan. Any error encountered will be sent -// on the returned error chan after seeding is complete. -func source(ctx context.Context, temporalitySelector aggregation.TemporalitySelector, mr export.Reader) (<-chan export.Record, <-chan error) { - errc := make(chan error, 1) - out := make(chan export.Record) - // Seed records into process. - go func() { - defer close(out) - // No select is needed since errc is buffered. - errc <- mr.ForEach(temporalitySelector, func(r export.Record) error { - select { - case <-ctx.Done(): - return ErrContextCanceled - case out <- r: - } - return nil - }) - }() - return out, errc -} - -// transformer transforms records read from the passed in chan into -// OTLP Metrics which are sent on the out chan. -func transformer(ctx context.Context, temporalitySelector aggregation.TemporalitySelector, in <-chan export.Record, out chan<- result) { - for r := range in { - m, err := Record(temporalitySelector, r) - // Propagate errors, but do not send empty results. - if err == nil && m == nil { - continue - } - res := result{ - Metric: m, - Err: err, - } - select { - case <-ctx.Done(): - return - case out <- res: - } - } -} - -// sink collects transformed Records and batches them. -// -// Any errors encountered transforming input will be reported with an -// ErrTransforming as well as the completed ResourceMetrics. It is up to the -// caller to handle any incorrect data in these ResourceMetric. -func sink(ctx context.Context, in <-chan result) ([]*metricpb.Metric, error) { - var errStrings []string - - // Group by the MetricDescriptor. - grouped := map[string]*metricpb.Metric{} - for res := range in { - if res.Err != nil { - errStrings = append(errStrings, res.Err.Error()) - continue - } - - mID := res.Metric.GetName() - m, ok := grouped[mID] - if !ok { - grouped[mID] = res.Metric - continue - } - // Note: There is extra work happening in this code that can be - // improved when the work described in #2119 is completed. The SDK has - // a guarantee that no more than one point per period per attribute - // set is produced, so this fallthrough should never happen. The final - // step of #2119 is to remove all the grouping logic here. - switch res.Metric.Data.(type) { - case *metricpb.Metric_Gauge: - m.GetGauge().DataPoints = append(m.GetGauge().DataPoints, res.Metric.GetGauge().DataPoints...) - case *metricpb.Metric_Sum: - m.GetSum().DataPoints = append(m.GetSum().DataPoints, res.Metric.GetSum().DataPoints...) - case *metricpb.Metric_Histogram: - m.GetHistogram().DataPoints = append(m.GetHistogram().DataPoints, res.Metric.GetHistogram().DataPoints...) - case *metricpb.Metric_Summary: - m.GetSummary().DataPoints = append(m.GetSummary().DataPoints, res.Metric.GetSummary().DataPoints...) - default: - err := fmt.Sprintf("unsupported metric type: %T", res.Metric.Data) - errStrings = append(errStrings, err) - } - } - - if len(grouped) == 0 { - return nil, nil - } - - ms := make([]*metricpb.Metric, 0, len(grouped)) - for _, m := range grouped { - ms = append(ms, m) - } - - // Report any transform errors. - if len(errStrings) > 0 { - return ms, fmt.Errorf("%w:\n -%s", ErrTransforming, strings.Join(errStrings, "\n -")) - } - return ms, nil -} - -// Record transforms a Record into an OTLP Metric. An ErrIncompatibleAgg -// error is returned if the Record Aggregator is not supported. -func Record(temporalitySelector aggregation.TemporalitySelector, r export.Record) (*metricpb.Metric, error) { - agg := r.Aggregation() - switch agg.Kind() { - case aggregation.HistogramKind: - h, ok := agg.(aggregation.Histogram) - if !ok { - return nil, fmt.Errorf("%w: %T", ErrIncompatibleAgg, agg) - } - return histogramPoint(r, temporalitySelector.TemporalityFor(r.Descriptor(), aggregation.HistogramKind), h) - - case aggregation.SumKind: - s, ok := agg.(aggregation.Sum) - if !ok { - return nil, fmt.Errorf("%w: %T", ErrIncompatibleAgg, agg) - } - sum, err := s.Sum() - if err != nil { - return nil, err - } - return sumPoint(r, sum, r.StartTime(), r.EndTime(), temporalitySelector.TemporalityFor(r.Descriptor(), aggregation.SumKind), r.Descriptor().InstrumentKind().Monotonic()) - - case aggregation.LastValueKind: - lv, ok := agg.(aggregation.LastValue) - if !ok { - return nil, fmt.Errorf("%w: %T", ErrIncompatibleAgg, agg) - } - value, tm, err := lv.LastValue() - if err != nil { - return nil, err - } - return gaugePoint(r, value, time.Time{}, tm) - - default: - return nil, fmt.Errorf("%w: %T", ErrUnimplementedAgg, agg) - } -} - -func gaugePoint(record export.Record, num number.Number, start, end time.Time) (*metricpb.Metric, error) { - desc := record.Descriptor() - attrs := record.Attributes() - - m := &metricpb.Metric{ - Name: desc.Name(), - Description: desc.Description(), - Unit: string(desc.Unit()), - } - - switch n := desc.NumberKind(); n { - case number.Int64Kind: - m.Data = &metricpb.Metric_Gauge{ - Gauge: &metricpb.Gauge{ - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{ - AsInt: num.CoerceToInt64(n), - }, - Attributes: Iterator(attrs.Iter()), - StartTimeUnixNano: toNanos(start), - TimeUnixNano: toNanos(end), - }, - }, - }, - } - case number.Float64Kind: - m.Data = &metricpb.Metric_Gauge{ - Gauge: &metricpb.Gauge{ - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsDouble{ - AsDouble: num.CoerceToFloat64(n), - }, - Attributes: Iterator(attrs.Iter()), - StartTimeUnixNano: toNanos(start), - TimeUnixNano: toNanos(end), - }, - }, - }, - } - default: - return nil, fmt.Errorf("%w: %v", ErrUnknownValueType, n) - } - - return m, nil -} - -func sdkTemporalityToTemporality(temporality aggregation.Temporality) metricpb.AggregationTemporality { - switch temporality { - case aggregation.DeltaTemporality: - return metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA - case aggregation.CumulativeTemporality: - return metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE - } - return metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED -} - -func sumPoint(record export.Record, num number.Number, start, end time.Time, temporality aggregation.Temporality, monotonic bool) (*metricpb.Metric, error) { - desc := record.Descriptor() - attrs := record.Attributes() - - m := &metricpb.Metric{ - Name: desc.Name(), - Description: desc.Description(), - Unit: string(desc.Unit()), - } - - switch n := desc.NumberKind(); n { - case number.Int64Kind: - m.Data = &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: monotonic, - AggregationTemporality: sdkTemporalityToTemporality(temporality), - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsInt{ - AsInt: num.CoerceToInt64(n), - }, - Attributes: Iterator(attrs.Iter()), - StartTimeUnixNano: toNanos(start), - TimeUnixNano: toNanos(end), - }, - }, - }, - } - case number.Float64Kind: - m.Data = &metricpb.Metric_Sum{ - Sum: &metricpb.Sum{ - IsMonotonic: monotonic, - AggregationTemporality: sdkTemporalityToTemporality(temporality), - DataPoints: []*metricpb.NumberDataPoint{ - { - Value: &metricpb.NumberDataPoint_AsDouble{ - AsDouble: num.CoerceToFloat64(n), - }, - Attributes: Iterator(attrs.Iter()), - StartTimeUnixNano: toNanos(start), - TimeUnixNano: toNanos(end), - }, - }, - }, - } - default: - return nil, fmt.Errorf("%w: %v", ErrUnknownValueType, n) - } - - return m, nil -} - -func histogramValues(a aggregation.Histogram) (boundaries []float64, counts []uint64, err error) { - var buckets aggregation.Buckets - if buckets, err = a.Histogram(); err != nil { - return - } - boundaries, counts = buckets.Boundaries, buckets.Counts - if len(counts) != len(boundaries)+1 { - err = ErrTransforming - return - } - return -} - -// histogram transforms a Histogram Aggregator into an OTLP Metric. -func histogramPoint(record export.Record, temporality aggregation.Temporality, a aggregation.Histogram) (*metricpb.Metric, error) { - desc := record.Descriptor() - attrs := record.Attributes() - boundaries, counts, err := histogramValues(a) - if err != nil { - return nil, err - } - - count, err := a.Count() - if err != nil { - return nil, err - } - - sum, err := a.Sum() - if err != nil { - return nil, err - } - - sumFloat64 := sum.CoerceToFloat64(desc.NumberKind()) - m := &metricpb.Metric{ - Name: desc.Name(), - Description: desc.Description(), - Unit: string(desc.Unit()), - Data: &metricpb.Metric_Histogram{ - Histogram: &metricpb.Histogram{ - AggregationTemporality: sdkTemporalityToTemporality(temporality), - DataPoints: []*metricpb.HistogramDataPoint{ - { - Sum: &sumFloat64, - Attributes: Iterator(attrs.Iter()), - StartTimeUnixNano: toNanos(record.StartTime()), - TimeUnixNano: toNanos(record.EndTime()), - Count: uint64(count), - BucketCounts: counts, - ExplicitBounds: boundaries, - }, - }, - }, - }, - } - return m, nil -} diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go deleted file mode 100644 index 3acf98e0cda..00000000000 --- a/exporters/otlp/otlpmetric/internal/metrictransform/metric_test.go +++ /dev/null @@ -1,314 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictransform - -import ( - "context" - "errors" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -var ( - // Timestamps used in this test: - - intervalStart = time.Now() - intervalEnd = intervalStart.Add(time.Hour) -) - -const ( - otelCumulative = metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE - otelDelta = metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA -) - -func TestStringKeyValues(t *testing.T) { - tests := []struct { - kvs []attribute.KeyValue - expected []*commonpb.KeyValue - }{ - { - nil, - nil, - }, - { - []attribute.KeyValue{}, - nil, - }, - { - []attribute.KeyValue{ - attribute.Bool("true", true), - attribute.Int64("one", 1), - attribute.Int64("two", 2), - attribute.Float64("three", 3), - attribute.Int("four", 4), - attribute.Int("five", 5), - attribute.Float64("six", 6), - attribute.Int("seven", 7), - attribute.Int("eight", 8), - attribute.String("the", "final word"), - }, - []*commonpb.KeyValue{ - {Key: "eight", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 8}}}, - {Key: "five", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 5}}}, - {Key: "four", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 4}}}, - {Key: "one", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 1}}}, - {Key: "seven", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 7}}}, - {Key: "six", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_DoubleValue{DoubleValue: 6.0}}}, - {Key: "the", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "final word"}}}, - {Key: "three", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_DoubleValue{DoubleValue: 3.0}}}, - {Key: "true", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_BoolValue{BoolValue: true}}}, - {Key: "two", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 2}}}, - }, - }, - } - - for _, test := range tests { - attrs := attribute.NewSet(test.kvs...) - assert.Equal(t, test.expected, Iterator(attrs.Iter())) - } -} - -func TestSumIntDataPoints(t *testing.T) { - desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Int64Kind) - attrs := attribute.NewSet(attribute.String("one", "1")) - sums := sum.New(2) - s, ckpt := &sums[0], &sums[1] - - assert.NoError(t, s.Update(context.Background(), number.Number(1), &desc)) - require.NoError(t, s.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) - - value, err := ckpt.Sum() - require.NoError(t, err) - - if m, err := sumPoint(record, value, record.StartTime(), record.EndTime(), aggregation.CumulativeTemporality, true); assert.NoError(t, err) { - assert.Nil(t, m.GetGauge()) - assert.Equal(t, &metricpb.Sum{ - AggregationTemporality: otelCumulative, - IsMonotonic: true, - DataPoints: []*metricpb.NumberDataPoint{{ - StartTimeUnixNano: uint64(intervalStart.UnixNano()), - TimeUnixNano: uint64(intervalEnd.UnixNano()), - Attributes: []*commonpb.KeyValue{ - { - Key: "one", - Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}}, - }, - }, - Value: &metricpb.NumberDataPoint_AsInt{ - AsInt: 1, - }, - }}, - }, m.GetSum()) - assert.Nil(t, m.GetHistogram()) - assert.Nil(t, m.GetSummary()) - } -} - -func TestSumFloatDataPoints(t *testing.T) { - desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Float64Kind) - attrs := attribute.NewSet(attribute.String("one", "1")) - sums := sum.New(2) - s, ckpt := &sums[0], &sums[1] - - assert.NoError(t, s.Update(context.Background(), number.NewFloat64Number(1), &desc)) - require.NoError(t, s.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) - value, err := ckpt.Sum() - require.NoError(t, err) - - if m, err := sumPoint(record, value, record.StartTime(), record.EndTime(), aggregation.DeltaTemporality, false); assert.NoError(t, err) { - assert.Nil(t, m.GetGauge()) - assert.Equal(t, &metricpb.Sum{ - IsMonotonic: false, - AggregationTemporality: otelDelta, - DataPoints: []*metricpb.NumberDataPoint{{ - Value: &metricpb.NumberDataPoint_AsDouble{ - AsDouble: 1.0, - }, - StartTimeUnixNano: uint64(intervalStart.UnixNano()), - TimeUnixNano: uint64(intervalEnd.UnixNano()), - Attributes: []*commonpb.KeyValue{ - { - Key: "one", - Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}}, - }, - }, - }}}, m.GetSum()) - assert.Nil(t, m.GetHistogram()) - assert.Nil(t, m.GetSummary()) - } -} - -func TestLastValueIntDataPoints(t *testing.T) { - desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Int64Kind) - attrs := attribute.NewSet(attribute.String("one", "1")) - lvs := lastvalue.New(2) - lv, ckpt := &lvs[0], &lvs[1] - - assert.NoError(t, lv.Update(context.Background(), number.Number(100), &desc)) - require.NoError(t, lv.SynchronizedMove(ckpt, &desc)) - record := export.NewRecord(&desc, &attrs, ckpt.Aggregation(), intervalStart, intervalEnd) - value, timestamp, err := ckpt.LastValue() - require.NoError(t, err) - - if m, err := gaugePoint(record, value, time.Time{}, timestamp); assert.NoError(t, err) { - assert.Equal(t, []*metricpb.NumberDataPoint{{ - StartTimeUnixNano: 0, - TimeUnixNano: uint64(timestamp.UnixNano()), - Attributes: []*commonpb.KeyValue{ - { - Key: "one", - Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}}, - }, - }, - Value: &metricpb.NumberDataPoint_AsInt{ - AsInt: 100, - }, - }}, m.GetGauge().DataPoints) - assert.Nil(t, m.GetSum()) - assert.Nil(t, m.GetHistogram()) - assert.Nil(t, m.GetSummary()) - } -} - -func TestSumErrUnknownValueType(t *testing.T) { - desc := metrictest.NewDescriptor("", sdkapi.HistogramInstrumentKind, number.Kind(-1)) - attrs := attribute.NewSet() - s := &sum.New(1)[0] - record := export.NewRecord(&desc, &attrs, s, intervalStart, intervalEnd) - value, err := s.Sum() - require.NoError(t, err) - - _, err = sumPoint(record, value, record.StartTime(), record.EndTime(), aggregation.CumulativeTemporality, true) - assert.Error(t, err) - if !errors.Is(err, ErrUnknownValueType) { - t.Errorf("expected ErrUnknownValueType, got %v", err) - } -} - -type testAgg struct { - kind aggregation.Kind - agg aggregation.Aggregation -} - -func (t *testAgg) Kind() aggregation.Kind { - return t.kind -} - -func (t *testAgg) Aggregation() aggregation.Aggregation { - return t.agg -} - -// None of these three are used: - -func (t *testAgg) Update(context.Context, number.Number, *sdkapi.Descriptor) error { - return nil -} -func (t *testAgg) SynchronizedMove(aggregator.Aggregator, *sdkapi.Descriptor) error { - return nil -} -func (t *testAgg) Merge(aggregator.Aggregator, *sdkapi.Descriptor) error { - return nil -} - -type testErrSum struct { - err error -} - -type testErrLastValue struct { - err error -} - -func (te *testErrLastValue) LastValue() (number.Number, time.Time, error) { - return 0, time.Time{}, te.err -} -func (te *testErrLastValue) Kind() aggregation.Kind { - return aggregation.LastValueKind -} - -func (te *testErrSum) Sum() (number.Number, error) { - return 0, te.err -} -func (te *testErrSum) Kind() aggregation.Kind { - return aggregation.SumKind -} - -var _ aggregator.Aggregator = &testAgg{} -var _ aggregation.Aggregation = &testAgg{} -var _ aggregation.Sum = &testErrSum{} -var _ aggregation.LastValue = &testErrLastValue{} - -func TestRecordAggregatorIncompatibleErrors(t *testing.T) { - makeMpb := func(kind aggregation.Kind, agg aggregation.Aggregation) (*metricpb.Metric, error) { - desc := metrictest.NewDescriptor("things", sdkapi.CounterInstrumentKind, number.Int64Kind) - attrs := attribute.NewSet() - test := &testAgg{ - kind: kind, - agg: agg, - } - return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &attrs, test, intervalStart, intervalEnd)) - } - - mpb, err := makeMpb(aggregation.SumKind, &lastvalue.New(1)[0]) - - require.Error(t, err) - require.Nil(t, mpb) - require.True(t, errors.Is(err, ErrIncompatibleAgg)) - - mpb, err = makeMpb(aggregation.LastValueKind, &sum.New(1)[0]) - - require.Error(t, err) - require.Nil(t, mpb) - require.True(t, errors.Is(err, ErrIncompatibleAgg)) -} - -func TestRecordAggregatorUnexpectedErrors(t *testing.T) { - makeMpb := func(kind aggregation.Kind, agg aggregation.Aggregation) (*metricpb.Metric, error) { - desc := metrictest.NewDescriptor("things", sdkapi.CounterInstrumentKind, number.Int64Kind) - attrs := attribute.NewSet() - return Record(aggregation.CumulativeTemporalitySelector(), export.NewRecord(&desc, &attrs, agg, intervalStart, intervalEnd)) - } - - errEx := fmt.Errorf("timeout") - - mpb, err := makeMpb(aggregation.SumKind, &testErrSum{errEx}) - - require.Error(t, err) - require.Nil(t, mpb) - require.True(t, errors.Is(err, errEx)) - - mpb, err = makeMpb(aggregation.LastValueKind, &testErrLastValue{errEx}) - - require.Error(t, err) - require.Nil(t, mpb) - require.True(t, errors.Is(err, errEx)) -} diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/resource_test.go b/exporters/otlp/otlpmetric/internal/metrictransform/resource_test.go deleted file mode 100644 index 016d2f1e019..00000000000 --- a/exporters/otlp/otlpmetric/internal/metrictransform/resource_test.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictransform - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/resource" -) - -func TestNilResource(t *testing.T) { - assert.Empty(t, Resource(nil)) -} - -func TestEmptyResource(t *testing.T) { - assert.Empty(t, Resource(&resource.Resource{})) -} - -/* -* This does not include any testing on the ordering of Resource Attributes. -* They are stored as a map internally to the Resource and their order is not -* guaranteed. - */ - -func TestResourceAttributes(t *testing.T) { - attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} - - got := Resource(resource.NewSchemaless(attrs...)).GetAttributes() - if !assert.Len(t, attrs, 2) { - return - } - assert.ElementsMatch(t, KeyValues(attrs), got) -} diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go similarity index 97% rename from exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go rename to exporters/otlp/otlpmetric/internal/oconf/envconfig.go index 2576a2c75a5..96c6fc1753a 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" import ( "crypto/tls" diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go similarity index 98% rename from exporters/otlp/otlpmetric/internal/otlpconfig/options.go rename to exporters/otlp/otlpmetric/internal/oconf/options.go index f2c8ee5d21a..f5a82d6db17 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" import ( "crypto/tls" diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go similarity index 70% rename from exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go rename to exporters/otlp/otlpmetric/internal/oconf/options_test.go index 7687e3fdbb3..e436eb5b07e 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig_test +package oconf_test import ( "errors" @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" ) const ( @@ -64,25 +64,25 @@ func (f *fileReader) readFile(filename string) ([]byte, error) { } func TestConfigs(t *testing.T) { - tlsCert, err := otlpconfig.CreateTLSConfig([]byte(WeakCertificate)) + tlsCert, err := oconf.CreateTLSConfig([]byte(WeakCertificate)) assert.NoError(t, err) tests := []struct { name string - opts []otlpconfig.GenericOption + opts []oconf.GenericOption env env fileReader fileReader - asserts func(t *testing.T, c *otlpconfig.Config, grpcOption bool) + asserts func(t *testing.T, c *oconf.Config, grpcOption bool) }{ { name: "Test default configs", - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) } else { assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) } - assert.Equal(t, otlpconfig.NoCompression, c.Metrics.Compression) + assert.Equal(t, oconf.NoCompression, c.Metrics.Compression) assert.Equal(t, map[string]string(nil), c.Metrics.Headers) assert.Equal(t, 10*time.Second, c.Metrics.Timeout) }, @@ -91,10 +91,10 @@ func TestConfigs(t *testing.T) { // Endpoint Tests { name: "Test With Endpoint", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithEndpoint("someendpoint"), + opts: []oconf.GenericOption{ + oconf.WithEndpoint("someendpoint"), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "someendpoint", c.Metrics.Endpoint) }, }, @@ -103,7 +103,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.False(t, c.Metrics.Insecure) if grpcOption { assert.Equal(t, "env.endpoint/prefix", c.Metrics.Endpoint) @@ -119,7 +119,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "http://env.metrics.endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.True(t, c.Metrics.Insecure) assert.Equal(t, "env.metrics.endpoint", c.Metrics.Endpoint) if !grpcOption { @@ -129,13 +129,13 @@ func TestConfigs(t *testing.T) { }, { name: "Test Mixed Environment and With Endpoint", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithEndpoint("metrics_endpoint"), + opts: []oconf.GenericOption{ + oconf.WithEndpoint("metrics_endpoint"), }, env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "metrics_endpoint", c.Metrics.Endpoint) }, }, @@ -144,7 +144,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) assert.Equal(t, true, c.Metrics.Insecure) }, @@ -154,7 +154,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) assert.Equal(t, true, c.Metrics.Insecure) }, @@ -164,7 +164,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) assert.Equal(t, false, c.Metrics.Insecure) }, @@ -175,7 +175,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "HtTp://env_metrics_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, "env_metrics_endpoint", c.Metrics.Endpoint) assert.Equal(t, true, c.Metrics.Insecure) }, @@ -184,7 +184,7 @@ func TestConfigs(t *testing.T) { // Certificate tests { name: "Test Default Certificate", - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { @@ -194,10 +194,10 @@ func TestConfigs(t *testing.T) { }, { name: "Test With Certificate", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTLSClientConfig(tlsCert), + opts: []oconf.GenericOption{ + oconf.WithTLSClientConfig(tlsCert), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { //TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Metrics.GRPCCredentials) @@ -215,7 +215,7 @@ func TestConfigs(t *testing.T) { fileReader: fileReader{ "cert_path": []byte(WeakCertificate), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { @@ -234,7 +234,7 @@ func TestConfigs(t *testing.T) { "cert_path": []byte(WeakCertificate), "invalid_cert": []byte("invalid certificate file."), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { @@ -245,14 +245,14 @@ func TestConfigs(t *testing.T) { }, { name: "Test Mixed Environment and With Certificate", - opts: []otlpconfig.GenericOption{}, + opts: []oconf.GenericOption{}, env: map[string]string{ "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", }, fileReader: fileReader{ "cert_path": []byte(WeakCertificate), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Metrics.GRPCCredentials) } else { @@ -265,17 +265,17 @@ func TestConfigs(t *testing.T) { // Headers tests { name: "Test With Headers", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithHeaders(map[string]string{"h1": "v1"}), + opts: []oconf.GenericOption{ + oconf.WithHeaders(map[string]string{"h1": "v1"}), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1"}, c.Metrics.Headers) }, }, { name: "Test Environment Headers", env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) }, }, @@ -285,17 +285,17 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", "OTEL_EXPORTER_OTLP_METRICS_HEADERS": "h1=v1,h2=v2", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) }, }, { name: "Test Mixed Environment and With Headers", env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - opts: []otlpconfig.GenericOption{ - otlpconfig.WithHeaders(map[string]string{"m1": "mv1"}), + opts: []oconf.GenericOption{ + oconf.WithHeaders(map[string]string{"m1": "mv1"}), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, map[string]string{"m1": "mv1"}, c.Metrics.Headers) }, }, @@ -303,11 +303,11 @@ func TestConfigs(t *testing.T) { // Compression Tests { name: "Test With Compression", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithCompression(otlpconfig.GzipCompression), + opts: []oconf.GenericOption{ + oconf.WithCompression(oconf.GzipCompression), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Metrics.Compression) + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) }, }, { @@ -315,8 +315,8 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Metrics.Compression) + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) }, }, { @@ -324,30 +324,30 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Metrics.Compression) + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) }, }, { name: "Test Mixed Environment and With Compression", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithCompression(otlpconfig.NoCompression), + opts: []oconf.GenericOption{ + oconf.WithCompression(oconf.NoCompression), }, env: map[string]string{ "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.NoCompression, c.Metrics.Compression) + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + assert.Equal(t, oconf.NoCompression, c.Metrics.Compression) }, }, // Timeout Tests { name: "Test With Timeout", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTimeout(time.Duration(5 * time.Second)), + opts: []oconf.GenericOption{ + oconf.WithTimeout(time.Duration(5 * time.Second)), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, 5*time.Second, c.Metrics.Timeout) }, }, @@ -356,7 +356,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, c.Metrics.Timeout, 15*time.Second) }, }, @@ -366,7 +366,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, c.Metrics.Timeout, 28*time.Second) }, }, @@ -376,10 +376,10 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", }, - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTimeout(5 * time.Second), + opts: []oconf.GenericOption{ + oconf.WithTimeout(5 * time.Second), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { assert.Equal(t, c.Metrics.Timeout, 5*time.Second) }, }, @@ -387,37 +387,37 @@ func TestConfigs(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - origEOR := otlpconfig.DefaultEnvOptionsReader - otlpconfig.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + origEOR := oconf.DefaultEnvOptionsReader + oconf.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: tt.env.getEnv, ReadFile: tt.fileReader.readFile, Namespace: "OTEL_EXPORTER_OTLP", } - t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) + t.Cleanup(func() { oconf.DefaultEnvOptionsReader = origEOR }) // Tests Generic options as HTTP Options - cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(tt.opts)...) + cfg := oconf.NewHTTPConfig(asHTTPOptions(tt.opts)...) tt.asserts(t, &cfg, false) // Tests Generic options as gRPC Options - cfg = otlpconfig.NewGRPCConfig(asGRPCOptions(tt.opts)...) + cfg = oconf.NewGRPCConfig(asGRPCOptions(tt.opts)...) tt.asserts(t, &cfg, true) }) } } -func asHTTPOptions(opts []otlpconfig.GenericOption) []otlpconfig.HTTPOption { - converted := make([]otlpconfig.HTTPOption, len(opts)) +func asHTTPOptions(opts []oconf.GenericOption) []oconf.HTTPOption { + converted := make([]oconf.HTTPOption, len(opts)) for i, o := range opts { - converted[i] = otlpconfig.NewHTTPOption(o.ApplyHTTPOption) + converted[i] = oconf.NewHTTPOption(o.ApplyHTTPOption) } return converted } -func asGRPCOptions(opts []otlpconfig.GenericOption) []otlpconfig.GRPCOption { - converted := make([]otlpconfig.GRPCOption, len(opts)) +func asGRPCOptions(opts []oconf.GenericOption) []oconf.GRPCOption { + converted := make([]oconf.GRPCOption, len(opts)) for i, o := range opts { - converted[i] = otlpconfig.NewGRPCOption(o.ApplyGRPCOption) + converted[i] = oconf.NewGRPCOption(o.ApplyGRPCOption) } return converted } diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlpmetric/internal/oconf/optiontypes.go similarity index 95% rename from exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go rename to exporters/otlp/otlpmetric/internal/oconf/optiontypes.go index 1d6f83f366d..e878ee74104 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlpmetric/internal/oconf/optiontypes.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" import "time" diff --git a/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go b/exporters/otlp/otlpmetric/internal/oconf/tls.go similarity index 92% rename from exporters/otlp/otlpmetric/internal/otlpconfig/tls.go rename to exporters/otlp/otlpmetric/internal/oconf/tls.go index efbe0f6f428..44bbe326860 100644 --- a/exporters/otlp/otlpmetric/internal/otlpconfig/tls.go +++ b/exporters/otlp/otlpmetric/internal/oconf/tls.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" import ( "crypto/tls" diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go new file mode 100644 index 00000000000..2ade400522d --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -0,0 +1,254 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/metric/unit" + semconv "go.opentelemetry.io/otel/semconv/v1.10.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" +) + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + kvBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + kvSrvName = &cpb.KeyValue{Key: "service.name", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }} + kvSrvVer = &cpb.KeyValue{Key: "service.version", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }} + + min, max, sum = 2.0, 4.0, 90.0 + hdp = []*mpb.HistogramDataPoint{{ + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sum, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + }} + + hist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: hdp, + } + + dPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + dPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + sumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: dPtsInt64, + } + sumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: dPtsFloat64, + } + + gaugeInt64 = &mpb.Gauge{DataPoints: dPtsInt64} + gaugeFloat64 = &mpb.Gauge{DataPoints: dPtsFloat64} + + metrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Sum{Sum: sumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Sum{Sum: sumFloat64}, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Histogram{Histogram: hist}, + }, + } + + scope = &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + } + scopeMetrics = []*mpb.ScopeMetrics{{ + Scope: scope, + Metrics: metrics, + SchemaUrl: semconv.SchemaURL, + }} + + res = &rpb.Resource{ + Attributes: []*cpb.KeyValue{kvSrvName, kvSrvVer}, + } + resourceMetrics = &mpb.ResourceMetrics{ + Resource: res, + ScopeMetrics: scopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +// ClientFactory is a function that when called returns a +// otlpmetric.Client implementation that is connected to also returned +// Collector implementation. The Client is ready to upload metric data to the +// Collector which is ready to store that data. +type ClientFactory func() (otlpmetric.Client, Collector) + +// RunClientTests runs a suite of Client integration tests. For example: +// +// t.Run("Integration", RunClientTests(factory)) +func RunClientTests(f ClientFactory) func(*testing.T) { + return func(t *testing.T) { + t.Run("ClientHonorsContextErrors", func(t *testing.T) { + t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { + c, _ := f() + return c.Shutdown + })) + + t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { + c, _ := f() + return c.ForceFlush + })) + + t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { + c, _ := f() + return func(ctx context.Context) error { + return c.UploadMetrics(ctx, nil) + } + })) + }) + + t.Run("ForceFlushFlushes", func(t *testing.T) { + ctx := context.Background() + client, collector := f() + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + + require.NoError(t, client.ForceFlush(ctx)) + rm := collector.Collect().Dump() + // Data correctness is not important, just it was received. + require.Greater(t, len(rm), 0, "no data uploaded") + + require.NoError(t, client.Shutdown(ctx)) + rm = collector.Collect().Dump() + assert.Len(t, rm, 0, "client did not flush all data") + }) + + t.Run("UploadMetrics", func(t *testing.T) { + ctx := context.Background() + client, coll := f() + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + got := coll.Collect().Dump() + require.Len(t, got, 1, "upload of one ResourceMetrics") + diff := cmp.Diff(got[0], resourceMetrics, cmp.Comparer(proto.Equal)) + if diff != "" { + t.Fatalf("unexpected ResourceMetrics:\n%s", diff) + } + }) + } +} + +func testCtxErrs(factory func() func(context.Context) error) func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + t.Run("DeadlineExceeded", func(t *testing.T) { + innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) + t.Cleanup(innerCancel) + <-innerCtx.Done() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) + }) + + t.Run("Canceled", func(t *testing.T) { + innerCtx, innerCancel := context.WithCancel(ctx) + innerCancel() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.Canceled) + }) + } +} diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go new file mode 100644 index 00000000000..1f4aac5610d --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -0,0 +1,54 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +type client struct { + storage *Storage +} + +func (c *client) Collect() *Storage { + return c.storage +} + +func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) error { + c.storage.Add(&cpb.ExportMetricsServiceRequest{ + ResourceMetrics: []*mpb.ResourceMetrics{rm}, + }) + return ctx.Err() +} + +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } +func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } + +func TestClientTests(t *testing.T) { + factory := func() (otlpmetric.Client, Collector) { + c := &client{storage: NewStorage()} + return c, c + } + + t.Run("Integration", RunClientTests(factory)) +} diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go new file mode 100644 index 00000000000..3302c8cfc2a --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -0,0 +1,428 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/ecdsa" + "crypto/elliptic" + cryptorand "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" // nolint:depguard // This is for testing. + "encoding/pem" + "errors" + "fmt" + "io" + "math/big" + mathrand "math/rand" + "net" + "net/http" + "net/url" + "sync" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +// Collector is the collection target a Client sends metric uploads to. +type Collector interface { + Collect() *Storage +} + +// Storage stores uploaded OTLP metric data in their proto form. +type Storage struct { + dataMu sync.Mutex + data []*mpb.ResourceMetrics +} + +// NewStorage returns a configure storage ready to store received requests. +func NewStorage() *Storage { + return &Storage{} +} + +// Add adds the request to the Storage. +func (s *Storage) Add(request *collpb.ExportMetricsServiceRequest) { + s.dataMu.Lock() + defer s.dataMu.Unlock() + s.data = append(s.data, request.ResourceMetrics...) +} + +// Dump returns all added ResourceMetrics and clears the storage. +func (s *Storage) Dump() []*mpb.ResourceMetrics { + s.dataMu.Lock() + defer s.dataMu.Unlock() + + var data []*mpb.ResourceMetrics + data, s.data = s.data, []*mpb.ResourceMetrics{} + return data +} + +// GRPCCollector is an OTLP gRPC server that collects all requests it receives. +type GRPCCollector struct { + collpb.UnimplementedMetricsServiceServer + + headersMu sync.Mutex + headers metadata.MD + storage *Storage + + errCh <-chan error + listener net.Listener + srv *grpc.Server +} + +// NewGRPCCollector returns a *GRPCCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listeing on +// the localhost interface at an OS chosen port. +// +// If errCh is not nil, the collector will respond to Export calls with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewGRPCCollector(endpoint string, errCh <-chan error) (*GRPCCollector, error) { + if endpoint == "" { + endpoint = "localhost:0" + } + + c := &GRPCCollector{ + storage: NewStorage(), + errCh: errCh, + } + + var err error + c.listener, err = net.Listen("tcp", endpoint) + if err != nil { + return nil, err + } + + c.srv = grpc.NewServer() + collpb.RegisterMetricsServiceServer(c.srv, c) + go func() { _ = c.srv.Serve(c.listener) }() + + return c, nil +} + +// Shutdown shuts down the gRPC server closing all open connections and +// listeners immediately. +func (c *GRPCCollector) Shutdown() { c.srv.Stop() } + +// Addr returns the net.Addr c is listening at. +func (c *GRPCCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *GRPCCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *GRPCCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return metadata.Join(c.headers) +} + +// Export handles the export req. +func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsServiceRequest) (*collpb.ExportMetricsServiceResponse, error) { + c.storage.Add(req) + + if h, ok := metadata.FromIncomingContext(ctx); ok { + c.headersMu.Lock() + c.headers = metadata.Join(c.headers, h) + c.headersMu.Unlock() + } + + var err error + if c.errCh != nil { + err = <-c.errCh + } + return &collpb.ExportMetricsServiceResponse{}, err +} + +var emptyExportMetricsServiceResponse = func() []byte { + body := collpb.ExportMetricsServiceResponse{} + r, err := proto.Marshal(&body) + if err != nil { + panic(err) + } + return r +}() + +type HTTPResponseError struct { + Err error + Status int + Header http.Header +} + +func (e *HTTPResponseError) Error() string { + return fmt.Sprintf("%d: %s", e.Status, e.Err) +} + +func (e *HTTPResponseError) Unwrap() error { return e.Err } + +// HTTPCollector is an OTLP HTTP server that collects all requests it receives. +type HTTPCollector struct { + headersMu sync.Mutex + headers http.Header + storage *Storage + + errCh <-chan error + listener net.Listener + srv *http.Server +} + +// NewHTTPCollector returns a *HTTPCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listeing on +// the localhost interface at an OS chosen port, not use TLS, and listen at the +// default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains +// a prefix of "https" the server will generate weak self-signed TLS +// certificates and use them to server data. If the endpoint contains a path, +// that path will be used instead of the default OTLP metric endpoint path. +// +// If errCh is not nil, the collector will respond to HTTP requests with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewHTTPCollector(endpoint string, errCh <-chan error) (*HTTPCollector, error) { + u, err := url.Parse(endpoint) + if err != nil { + return nil, err + } + if u.Host == "" { + u.Host = "localhost:0" + } + if u.Path == "" { + u.Path = oconf.DefaultMetricsPath + } + + c := &HTTPCollector{ + headers: http.Header{}, + storage: NewStorage(), + errCh: errCh, + } + + c.listener, err = net.Listen("tcp", u.Host) + if err != nil { + return nil, err + } + + mux := http.NewServeMux() + mux.Handle(u.Path, http.HandlerFunc(c.handler)) + c.srv = &http.Server{Handler: mux} + if u.Scheme == "https" { + cert, err := weakCertificate() + if err != nil { + return nil, err + } + c.srv.TLSConfig = &tls.Config{ + Certificates: []tls.Certificate{cert}, + } + go func() { _ = c.srv.ServeTLS(c.listener, "", "") }() + } else { + go func() { _ = c.srv.Serve(c.listener) }() + } + return c, nil +} + +// Shutdown shuts down the HTTP server closing all open connections and +// listeners. +func (c *HTTPCollector) Shutdown(ctx context.Context) error { + return c.srv.Shutdown(ctx) +} + +// Addr returns the net.Addr c is listening at. +func (c *HTTPCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *HTTPCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *HTTPCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return c.headers.Clone() +} + +func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { + c.respond(w, c.record(r)) +} + +func (c *HTTPCollector) record(r *http.Request) error { + // Currently only supports protobuf. + if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { + return fmt.Errorf("content-type not supported: %s", v) + } + + body, err := c.readBody(r) + if err != nil { + return err + } + pbRequest := &collpb.ExportMetricsServiceRequest{} + err = proto.Unmarshal(body, pbRequest) + if err != nil { + return &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + c.storage.Add(pbRequest) + + c.headersMu.Lock() + for k, vals := range r.Header { + for _, v := range vals { + c.headers.Add(k, v) + } + } + c.headersMu.Unlock() + + if c.errCh != nil { + err = <-c.errCh + } + return err +} + +func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { + var reader io.ReadCloser + switch r.Header.Get("Content-Encoding") { + case "gzip": + reader, err = gzip.NewReader(r.Body) + if err != nil { + _ = reader.Close() + return nil, &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + default: + reader = r.Body + } + + defer func() { + cErr := reader.Close() + if err == nil && cErr != nil { + err = &HTTPResponseError{ + Err: cErr, + Status: http.StatusInternalServerError, + } + } + }() + body, err = io.ReadAll(reader) + if err != nil { + err = &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + return body, err +} + +func (c *HTTPCollector) respond(w http.ResponseWriter, err error) { + if err != nil { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.Header().Set("X-Content-Type-Options", "nosniff") + var e *HTTPResponseError + if errors.As(err, &e) { + for k, vals := range e.Header { + for _, v := range vals { + w.Header().Add(k, v) + } + } + w.WriteHeader(e.Status) + fmt.Fprintln(w, e.Error()) + } else { + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintln(w, err.Error()) + } + return + } + + w.Header().Set("Content-Type", "application/x-protobuf") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(emptyExportMetricsServiceResponse) +} + +type mathRandReader struct{} + +func (mathRandReader) Read(p []byte) (n int, err error) { + return mathrand.Read(p) +} + +var randReader mathRandReader + +// Based on https://golang.org/src/crypto/tls/generate_cert.go, +// simplified and weakened. +func weakCertificate() (tls.Certificate, error) { + priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader) + if err != nil { + return tls.Certificate{}, err + } + notBefore := time.Now() + notAfter := notBefore.Add(time.Hour) + max := new(big.Int).Lsh(big.NewInt(1), 128) + sn, err := cryptorand.Int(randReader, max) + if err != nil { + return tls.Certificate{}, err + } + tmpl := x509.Certificate{ + SerialNumber: sn, + Subject: pkix.Name{Organization: []string{"otel-go"}}, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + DNSNames: []string{"localhost"}, + IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, + } + derBytes, err := x509.CreateCertificate(randReader, &tmpl, &tmpl, &priv.PublicKey, priv) + if err != nil { + return tls.Certificate{}, err + } + var certBuf bytes.Buffer + err = pem.Encode(&certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) + if err != nil { + return tls.Certificate{}, err + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + var privBuf bytes.Buffer + err = pem.Encode(&privBuf, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) + if err != nil { + return tls.Certificate{}, err + } + return tls.X509KeyPair(certBuf.Bytes(), privBuf.Bytes()) +} diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/client.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/client.go deleted file mode 100644 index c248521ee14..00000000000 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/client.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrictest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - -import ( - "context" - "errors" - "sync" - "testing" - "time" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -) - -func RunExporterShutdownTest(t *testing.T, factory func() otlpmetric.Client) { - t.Run("testClientStopHonorsTimeout", func(t *testing.T) { - testClientStopHonorsTimeout(t, factory()) - }) - - t.Run("testClientStopHonorsCancel", func(t *testing.T) { - testClientStopHonorsCancel(t, factory()) - }) - - t.Run("testClientStopNoError", func(t *testing.T) { - testClientStopNoError(t, factory()) - }) - - t.Run("testClientStopManyTimes", func(t *testing.T) { - testClientStopManyTimes(t, factory()) - }) -} - -func initializeExporter(t *testing.T, client otlpmetric.Client) *otlpmetric.Exporter { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - e, err := otlpmetric.New(ctx, client) - if err != nil { - t.Fatalf("failed to create exporter") - } - - return e -} - -func testClientStopHonorsTimeout(t *testing.T, client otlpmetric.Client) { - t.Cleanup(func() { - // The test is looking for a failed shut down. Call Stop a second time - // with an un-expired context to give the client a second chance at - // cleaning up. There is not guarantee from the Client interface this - // will succeed, therefore, no need to check the error (just give it a - // best try). - _ = client.Stop(context.Background()) - }) - e := initializeExporter(t, client) - - innerCtx, innerCancel := context.WithTimeout(context.Background(), time.Microsecond) - <-innerCtx.Done() - if err := e.Shutdown(innerCtx); err == nil { - t.Error("expected context DeadlineExceeded error, got nil") - } else if !errors.Is(err, context.DeadlineExceeded) { - t.Errorf("expected context DeadlineExceeded error, got %v", err) - } - innerCancel() -} - -func testClientStopHonorsCancel(t *testing.T, client otlpmetric.Client) { - t.Cleanup(func() { - // The test is looking for a failed shut down. Call Stop a second time - // with an un-expired context to give the client a second chance at - // cleaning up. There is not guarantee from the Client interface this - // will succeed, therefore, no need to check the error (just give it a - // best try). - _ = client.Stop(context.Background()) - }) - e := initializeExporter(t, client) - - ctx, innerCancel := context.WithCancel(context.Background()) - innerCancel() - if err := e.Shutdown(ctx); err == nil { - t.Error("expected context canceled error, got nil") - } else if !errors.Is(err, context.Canceled) { - t.Errorf("expected context canceled error, got %v", err) - } -} - -func testClientStopNoError(t *testing.T, client otlpmetric.Client) { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - e := initializeExporter(t, client) - if err := e.Shutdown(ctx); err != nil { - t.Errorf("shutdown errored: expected nil, got %v", err) - } -} - -func testClientStopManyTimes(t *testing.T, client otlpmetric.Client) { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - e := initializeExporter(t, client) - - ch := make(chan struct{}) - wg := sync.WaitGroup{} - const num int = 20 - wg.Add(num) - errs := make([]error, num) - for i := 0; i < num; i++ { - go func(idx int) { - defer wg.Done() - <-ch - errs[idx] = e.Shutdown(ctx) - }(i) - } - close(ch) - wg.Wait() - for _, err := range errs { - if err != nil { - t.Fatalf("failed to shutdown exporter: %v", err) - } - } -} diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go deleted file mode 100644 index 20915724a53..00000000000 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/collector.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrictest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - -import ( - collectormetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// Collector is an interface that mock collectors should implements, -// so they can be used for the end-to-end testing. -type Collector interface { - Stop() error - GetMetrics() []*metricpb.Metric -} - -// MetricsStorage stores the metrics. Mock collectors could use it to -// store metrics they have received. -type MetricsStorage struct { - metrics []*metricpb.Metric -} - -// NewMetricsStorage creates a new metrics storage. -func NewMetricsStorage() MetricsStorage { - return MetricsStorage{} -} - -// AddMetrics adds metrics to the metrics storage. -func (s *MetricsStorage) AddMetrics(request *collectormetricpb.ExportMetricsServiceRequest) { - for _, rm := range request.GetResourceMetrics() { - // TODO (rghetia) handle multiple resource and library info. - if len(rm.ScopeMetrics) > 0 { - s.metrics = append(s.metrics, rm.ScopeMetrics[0].Metrics...) - } - } -} - -// GetMetrics returns the stored metrics. -func (s *MetricsStorage) GetMetrics() []*metricpb.Metric { - // copy in order to not change. - m := make([]*metricpb.Metric, 0, len(s.metrics)) - return append(m, s.metrics...) -} diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go deleted file mode 100644 index d8d9c03a31e..00000000000 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/data.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrictest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - -import ( - "context" - "fmt" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// OneRecordReader is a Reader that returns just one -// filled record. It may be useful for testing driver's metrics -// export. -func OneRecordReader() export.InstrumentationLibraryReader { - desc := metrictest.NewDescriptor( - "foo", - sdkapi.CounterInstrumentKind, - number.Int64Kind, - ) - agg := sum.New(1) - if err := agg[0].Update(context.Background(), number.NewInt64Number(42), &desc); err != nil { - panic(err) - } - start := time.Date(2020, time.December, 8, 19, 15, 0, 0, time.UTC) - end := time.Date(2020, time.December, 8, 19, 16, 0, 0, time.UTC) - attrs := attribute.NewSet(attribute.String("abc", "def"), attribute.Int64("one", 1)) - rec := export.NewRecord(&desc, &attrs, agg[0].Aggregation(), start, end) - - return processortest.MultiInstrumentationLibraryReader( - map[instrumentation.Library][]export.Record{ - { - Name: "onelib", - }: {rec}, - }) -} - -func EmptyReader() export.InstrumentationLibraryReader { - return processortest.MultiInstrumentationLibraryReader(nil) -} - -// FailReader is a checkpointer that returns an error during -// ForEach. -type FailReader struct{} - -var _ export.InstrumentationLibraryReader = FailReader{} - -// ForEach implements export.Reader. It always fails. -func (FailReader) ForEach(readerFunc func(instrumentation.Library, export.Reader) error) error { - return fmt.Errorf("fail") -} diff --git a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go b/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go deleted file mode 100644 index c12cd5b1b6a..00000000000 --- a/exporters/otlp/otlpmetric/internal/otlpmetrictest/otlptest.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrictest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/metric/instrument" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/metric/selector/simple" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// RunEndToEndTest can be used by protocol driver tests to validate -// themselves. -func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlpmetric.Exporter, mcMetrics Collector) { - selector := simple.NewWithHistogramDistribution() - proc := processor.NewFactory(selector, aggregation.StatelessTemporalitySelector()) - cont := controller.New(proc, controller.WithExporter(exp)) - require.NoError(t, cont.Start(ctx)) - - meter := cont.Meter("test-meter") - attrs := []attribute.KeyValue{attribute.Bool("test", true)} - - type data struct { - iKind sdkapi.InstrumentKind - nKind number.Kind - val int64 - } - instruments := map[string]data{ - "test-int64-counter": {sdkapi.CounterInstrumentKind, number.Int64Kind, 1}, - "test-float64-counter": {sdkapi.CounterInstrumentKind, number.Float64Kind, 1}, - "test-int64-histogram": {sdkapi.HistogramInstrumentKind, number.Int64Kind, 2}, - "test-float64-histogram": {sdkapi.HistogramInstrumentKind, number.Float64Kind, 2}, - "test-int64-gaugeobserver": {sdkapi.GaugeObserverInstrumentKind, number.Int64Kind, 3}, - "test-float64-gaugeobserver": {sdkapi.GaugeObserverInstrumentKind, number.Float64Kind, 3}, - } - for name, data := range instruments { - data := data - switch data.iKind { - case sdkapi.CounterInstrumentKind: - switch data.nKind { - case number.Int64Kind: - c, _ := meter.SyncInt64().Counter(name) - c.Add(ctx, data.val, attrs...) - case number.Float64Kind: - c, _ := meter.SyncFloat64().Counter(name) - c.Add(ctx, float64(data.val), attrs...) - default: - assert.Failf(t, "unsupported number testing kind", data.nKind.String()) - } - case sdkapi.HistogramInstrumentKind: - switch data.nKind { - case number.Int64Kind: - c, _ := meter.SyncInt64().Histogram(name) - c.Record(ctx, data.val, attrs...) - case number.Float64Kind: - c, _ := meter.SyncFloat64().Histogram(name) - c.Record(ctx, float64(data.val), attrs...) - default: - assert.Failf(t, "unsupported number testing kind", data.nKind.String()) - } - case sdkapi.GaugeObserverInstrumentKind: - switch data.nKind { - case number.Int64Kind: - g, _ := meter.AsyncInt64().Gauge(name) - _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { - g.Observe(ctx, data.val, attrs...) - }) - case number.Float64Kind: - g, _ := meter.AsyncFloat64().Gauge(name) - _ = meter.RegisterCallback([]instrument.Asynchronous{g}, func(ctx context.Context) { - g.Observe(ctx, float64(data.val), attrs...) - }) - default: - assert.Failf(t, "unsupported number testing kind", data.nKind.String()) - } - default: - assert.Failf(t, "unsupported metrics testing kind", data.iKind.String()) - } - } - - // Flush and close. - require.NoError(t, cont.Stop(ctx)) - - // Wait >2 cycles. - <-time.After(40 * time.Millisecond) - - // Now shutdown the exporter - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - t.Fatalf("failed to stop the exporter: %v", err) - } - - // Shutdown the collector too so that we can begin - // verification checks of expected data back. - _ = mcMetrics.Stop() - - metrics := mcMetrics.GetMetrics() - assert.Len(t, metrics, len(instruments), "not enough metrics exported") - seen := make(map[string]struct{}, len(instruments)) - for _, m := range metrics { - data, ok := instruments[m.Name] - if !ok { - assert.Failf(t, "unknown metrics", m.Name) - continue - } - seen[m.Name] = struct{}{} - - switch data.iKind { - case sdkapi.CounterInstrumentKind, sdkapi.GaugeObserverInstrumentKind: - var dp []*metricpb.NumberDataPoint - switch data.iKind { - case sdkapi.CounterInstrumentKind: - require.NotNil(t, m.GetSum()) - dp = m.GetSum().GetDataPoints() - case sdkapi.GaugeObserverInstrumentKind: - require.NotNil(t, m.GetGauge()) - dp = m.GetGauge().GetDataPoints() - } - if assert.Len(t, dp, 1) { - switch data.nKind { - case number.Int64Kind: - v := &metricpb.NumberDataPoint_AsInt{AsInt: data.val} - assert.Equal(t, v, dp[0].Value, "invalid value for %q", m.Name) - case number.Float64Kind: - v := &metricpb.NumberDataPoint_AsDouble{AsDouble: float64(data.val)} - assert.Equal(t, v, dp[0].Value, "invalid value for %q", m.Name) - } - } - case sdkapi.HistogramInstrumentKind: - require.NotNil(t, m.GetHistogram()) - if dp := m.GetHistogram().DataPoints; assert.Len(t, dp, 1) { - count := dp[0].Count - assert.Equal(t, uint64(1), count, "invalid count for %q", m.Name) - require.NotNil(t, dp[0].Sum) - assert.Equal(t, float64(data.val*int64(count)), *dp[0].Sum, "invalid sum for %q (value %d)", m.Name, data.val) - } - default: - assert.Failf(t, "invalid metrics kind", data.iKind.String()) - } - } - - for i := range instruments { - if _, ok := seen[i]; !ok { - assert.Fail(t, fmt.Sprintf("no metric(s) exported for %q", i)) - } - } -} diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute.go b/exporters/otlp/otlpmetric/internal/transform/attribute.go new file mode 100644 index 00000000000..504256ee7b2 --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/attribute.go @@ -0,0 +1,155 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// AttrIter transforms an attribute iterator into OTLP key-values. +func AttrIter(iter attribute.Iterator) []*cpb.KeyValue { + l := iter.Len() + if l == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, l) + for iter.Next() { + out = append(out, KeyValue(iter.Attribute())) + } + return out +} + +// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. +func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue { + if len(attrs) == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, len(attrs)) + for _, kv := range attrs { + out = append(out, KeyValue(kv)) + } + return out +} + +// KeyValue transforms an attribute KeyValue into an OTLP key-value. +func KeyValue(kv attribute.KeyValue) *cpb.KeyValue { + return &cpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} +} + +// Value transforms an attribute Value into an OTLP AnyValue. +func Value(v attribute.Value) *cpb.AnyValue { + av := new(cpb.AnyValue) + switch v.Type() { + case attribute.BOOL: + av.Value = &cpb.AnyValue_BoolValue{ + BoolValue: v.AsBool(), + } + case attribute.BOOLSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: boolSliceValues(v.AsBoolSlice()), + }, + } + case attribute.INT64: + av.Value = &cpb.AnyValue_IntValue{ + IntValue: v.AsInt64(), + } + case attribute.INT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: int64SliceValues(v.AsInt64Slice()), + }, + } + case attribute.FLOAT64: + av.Value = &cpb.AnyValue_DoubleValue{ + DoubleValue: v.AsFloat64(), + } + case attribute.FLOAT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: float64SliceValues(v.AsFloat64Slice()), + }, + } + case attribute.STRING: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: v.AsString(), + } + case attribute.STRINGSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: stringSliceValues(v.AsStringSlice()), + }, + } + default: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: "INVALID", + } + } + return av +} + +func boolSliceValues(vals []bool) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_BoolValue{ + BoolValue: v, + }, + } + } + return converted +} + +func int64SliceValues(vals []int64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_IntValue{ + IntValue: v, + }, + } + } + return converted +} + +func float64SliceValues(vals []float64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_DoubleValue{ + DoubleValue: v, + }, + } + } + return converted +} + +func stringSliceValues(vals []string) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{ + StringValue: v, + }, + } + } + return converted +} diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute_test.go b/exporters/otlp/otlpmetric/internal/transform/attribute_test.go new file mode 100644 index 00000000000..6ca20fdbafd --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/attribute_test.go @@ -0,0 +1,197 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +var ( + attrBool = attribute.Bool("bool", true) + attrBoolSlice = attribute.BoolSlice("bool slice", []bool{true, false}) + attrInt = attribute.Int("int", 1) + attrIntSlice = attribute.IntSlice("int slice", []int{-1, 1}) + attrInt64 = attribute.Int64("int64", 1) + attrInt64Slice = attribute.Int64Slice("int64 slice", []int64{-1, 1}) + attrFloat64 = attribute.Float64("float64", 1) + attrFloat64Slice = attribute.Float64Slice("float64 slice", []float64{-1, 1}) + attrString = attribute.String("string", "o") + attrStringSlice = attribute.StringSlice("string slice", []string{"o", "n"}) + attrInvalid = attribute.KeyValue{ + Key: attribute.Key("invalid"), + Value: attribute.Value{}, + } + + valBoolTrue = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: true}} + valBoolFalse = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: false}} + valBoolSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valBoolTrue, valBoolFalse}, + }, + }} + valIntOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: 1}} + valIntNOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: -1}} + valIntSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valIntNOne, valIntOne}, + }, + }} + valDblOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: 1}} + valDblNOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: -1}} + valDblSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valDblNOne, valDblOne}, + }, + }} + valStrO = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "o"}} + valStrN = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "n"}} + valStrSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valStrO, valStrN}, + }, + }} + + kvBool = &cpb.KeyValue{Key: "bool", Value: valBoolTrue} + kvBoolSlice = &cpb.KeyValue{Key: "bool slice", Value: valBoolSlice} + kvInt = &cpb.KeyValue{Key: "int", Value: valIntOne} + kvIntSlice = &cpb.KeyValue{Key: "int slice", Value: valIntSlice} + kvInt64 = &cpb.KeyValue{Key: "int64", Value: valIntOne} + kvInt64Slice = &cpb.KeyValue{Key: "int64 slice", Value: valIntSlice} + kvFloat64 = &cpb.KeyValue{Key: "float64", Value: valDblOne} + kvFloat64Slice = &cpb.KeyValue{Key: "float64 slice", Value: valDblSlice} + kvString = &cpb.KeyValue{Key: "string", Value: valStrO} + kvStringSlice = &cpb.KeyValue{Key: "string slice", Value: valStrSlice} + kvInvalid = &cpb.KeyValue{ + Key: "invalid", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "INVALID"}, + }, + } +) + +type attributeTest struct { + name string + in []attribute.KeyValue + want []*cpb.KeyValue +} + +func TestAttributeTransforms(t *testing.T) { + for _, test := range []attributeTest{ + {"nil", nil, nil}, + {"empty", []attribute.KeyValue{}, nil}, + { + "invalid", + []attribute.KeyValue{attrInvalid}, + []*cpb.KeyValue{kvInvalid}, + }, + { + "bool", + []attribute.KeyValue{attrBool}, + []*cpb.KeyValue{kvBool}, + }, + { + "bool slice", + []attribute.KeyValue{attrBoolSlice}, + []*cpb.KeyValue{kvBoolSlice}, + }, + { + "int", + []attribute.KeyValue{attrInt}, + []*cpb.KeyValue{kvInt}, + }, + { + "int slice", + []attribute.KeyValue{attrIntSlice}, + []*cpb.KeyValue{kvIntSlice}, + }, + { + "int64", + []attribute.KeyValue{attrInt64}, + []*cpb.KeyValue{kvInt64}, + }, + { + "int64 slice", + []attribute.KeyValue{attrInt64Slice}, + []*cpb.KeyValue{kvInt64Slice}, + }, + { + "float64", + []attribute.KeyValue{attrFloat64}, + []*cpb.KeyValue{kvFloat64}, + }, + { + "float64 slice", + []attribute.KeyValue{attrFloat64Slice}, + []*cpb.KeyValue{kvFloat64Slice}, + }, + { + "string", + []attribute.KeyValue{attrString}, + []*cpb.KeyValue{kvString}, + }, + { + "string slice", + []attribute.KeyValue{attrStringSlice}, + []*cpb.KeyValue{kvStringSlice}, + }, + { + "all", + []attribute.KeyValue{ + attrBool, + attrBoolSlice, + attrInt, + attrIntSlice, + attrInt64, + attrInt64Slice, + attrFloat64, + attrFloat64Slice, + attrString, + attrStringSlice, + attrInvalid, + }, + []*cpb.KeyValue{ + kvBool, + kvBoolSlice, + kvInt, + kvIntSlice, + kvInt64, + kvInt64Slice, + kvFloat64, + kvFloat64Slice, + kvString, + kvStringSlice, + kvInvalid, + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + t.Run("KeyValues", func(t *testing.T) { + assert.ElementsMatch(t, test.want, KeyValues(test.in)) + }) + t.Run("AttrIter", func(t *testing.T) { + s := attribute.NewSet(test.in...) + assert.ElementsMatch(t, test.want, AttrIter(s.Iter())) + }) + }) + } +} diff --git a/sdk/metric/atomicfields.go b/exporters/otlp/otlpmetric/internal/transform/doc.go similarity index 64% rename from sdk/metric/atomicfields.go rename to exporters/otlp/otlpmetric/internal/transform/doc.go index 7cea2e54374..7a79f794dd1 100644 --- a/sdk/metric/atomicfields.go +++ b/exporters/otlp/otlpmetric/internal/transform/doc.go @@ -12,14 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric // import "go.opentelemetry.io/otel/sdk/metric" - -import "unsafe" - -// Deprecated: will be removed soon. -func AtomicFieldOffsets() map[string]uintptr { - return map[string]uintptr{ - "record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value), - "record.updateCount": unsafe.Offsetof(record{}.updateCount), - } -} +// Package transform provides transformation functionality from the +// sdk/metric/metricdata data-types into OTLP data-types. +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" diff --git a/exporters/otlp/otlpmetric/internal/transform/error.go b/exporters/otlp/otlpmetric/internal/transform/error.go new file mode 100644 index 00000000000..8a8b49a63a3 --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/error.go @@ -0,0 +1,114 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "errors" + "fmt" + "strings" + + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +var ( + errUnknownAggregation = errors.New("unknown aggregation") + errUnknownTemporality = errors.New("unknown temporality") +) + +type errMetric struct { + m *mpb.Metric + err error +} + +func (e errMetric) Unwrap() error { + return e.err +} + +func (e errMetric) Error() string { + format := "invalid metric (name: %q, description: %q, unit: %q): %s" + return fmt.Sprintf(format, e.m.Name, e.m.Description, e.m.Unit, e.err) +} + +func (e errMetric) Is(target error) bool { + return errors.Is(e.err, target) +} + +// multiErr is used by the data-type transform functions to wrap multiple +// errors into a single return value. The error message will show all errors +// as a list and scope them by the datatype name that is returning them. +type multiErr struct { + datatype string + errs []error +} + +// errOrNil returns nil if e contains no errors, otherwise it returns e. +func (e *multiErr) errOrNil() error { + if len(e.errs) == 0 { + return nil + } + return e +} + +// append adds err to e. If err is a multiErr, its errs are flattened into e. +func (e *multiErr) append(err error) { + // Do not use errors.As here, this should only be flattened one layer. If + // there is a *multiErr several steps down the chain, all the errors above + // it will be discarded if errors.As is used instead. + switch other := err.(type) { + case *multiErr: + // Flatten err errors into e. + e.errs = append(e.errs, other.errs...) + default: + e.errs = append(e.errs, err) + } +} + +func (e *multiErr) Error() string { + es := make([]string, len(e.errs)) + for i, err := range e.errs { + es[i] = fmt.Sprintf("* %s", err) + } + + format := "%d errors occurred transforming %s:\n\t%s" + return fmt.Sprintf(format, len(es), e.datatype, strings.Join(es, "\n\t")) +} + +func (e *multiErr) Unwrap() error { + switch len(e.errs) { + case 0: + return nil + case 1: + return e.errs[0] + } + + // Return a multiErr without the leading error. + cp := &multiErr{ + datatype: e.datatype, + errs: make([]error, len(e.errs)-1), + } + copy(cp.errs, e.errs[1:]) + return cp +} + +func (e *multiErr) Is(target error) bool { + if len(e.errs) == 0 { + return false + } + // Check if the first error is target. + return errors.Is(e.errs[0], target) +} diff --git a/exporters/otlp/otlpmetric/internal/transform/error_test.go b/exporters/otlp/otlpmetric/internal/transform/error_test.go new file mode 100644 index 00000000000..f366fc48724 --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/error_test.go @@ -0,0 +1,91 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + e0 = errMetric{m: pbMetrics[0], err: errUnknownAggregation} + e1 = errMetric{m: pbMetrics[1], err: errUnknownTemporality} +) + +type testingErr struct{} + +func (testingErr) Error() string { return "testing error" } + +// errFunc is a non-comparable error type. +type errFunc func() string + +func (e errFunc) Error() string { + return e() +} + +func TestMultiErr(t *testing.T) { + const name = "TestMultiErr" + me := &multiErr{datatype: name} + + t.Run("ErrOrNil", func(t *testing.T) { + require.Nil(t, me.errOrNil()) + me.errs = []error{e0} + assert.Error(t, me.errOrNil()) + }) + + var testErr testingErr + t.Run("AppendError", func(t *testing.T) { + me.append(testErr) + assert.Equal(t, testErr, me.errs[len(me.errs)-1]) + }) + + t.Run("AppendFlattens", func(t *testing.T) { + other := &multiErr{datatype: "OtherTestMultiErr", errs: []error{e1}} + me.append(other) + assert.Equal(t, e1, me.errs[len(me.errs)-1]) + }) + + t.Run("ErrorMessage", func(t *testing.T) { + // Test the overall structure of the message, but not the exact + // language so this doesn't become a change-indicator. + msg := me.Error() + lines := strings.Split(msg, "\n") + assert.Equalf(t, 4, len(lines), "expected a 4 line error message, got:\n\n%s", msg) + assert.Contains(t, msg, name) + assert.Contains(t, msg, e0.Error()) + assert.Contains(t, msg, testErr.Error()) + assert.Contains(t, msg, e1.Error()) + }) + + t.Run("ErrorIs", func(t *testing.T) { + assert.ErrorIs(t, me, errUnknownAggregation) + assert.ErrorIs(t, me, e0) + assert.ErrorIs(t, me, testErr) + assert.ErrorIs(t, me, errUnknownTemporality) + assert.ErrorIs(t, me, e1) + + errUnknown := errFunc(func() string { return "unknown error" }) + assert.NotErrorIs(t, me, errUnknown) + + var empty multiErr + assert.NotErrorIs(t, &empty, errUnknownTemporality) + }) +} diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go new file mode 100644 index 00000000000..38ad617fd6a --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -0,0 +1,207 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "fmt" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/common/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +// ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm +// contains invalid ScopeMetrics, an error will be returned along with an OTLP +// ResourceMetrics that contains partial OTLP ScopeMetrics. +func ResourceMetrics(rm metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { + sms, err := ScopeMetrics(rm.ScopeMetrics) + return &mpb.ResourceMetrics{ + Resource: &rpb.Resource{ + Attributes: AttrIter(rm.Resource.Iter()), + }, + ScopeMetrics: sms, + SchemaUrl: rm.Resource.SchemaURL(), + }, err +} + +// ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If +// sms contains invalid metric values, an error will be returned along with a +// slice that contains partial OTLP ScopeMetrics. +func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error) { + errs := &multiErr{datatype: "ScopeMetrics"} + out := make([]*mpb.ScopeMetrics, 0, len(sms)) + for _, sm := range sms { + ms, err := Metrics(sm.Metrics) + if err != nil { + errs.append(err) + } + + out = append(out, &mpb.ScopeMetrics{ + Scope: &cpb.InstrumentationScope{ + Name: sm.Scope.Name, + Version: sm.Scope.Version, + }, + Metrics: ms, + SchemaUrl: sm.Scope.SchemaURL, + }) + } + return out, errs.errOrNil() +} + +// Metrics returns a slice of OTLP Metric generated from ms. If ms contains +// invalid metric values, an error will be returned along with a slice that +// contains partial OTLP Metrics. +func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error) { + errs := &multiErr{datatype: "Metrics"} + out := make([]*mpb.Metric, 0, len(ms)) + for _, m := range ms { + o, err := metric(m) + if err != nil { + // Do not include invalid data. Drop the metric, report the error. + errs.append(errMetric{m: o, err: err}) + continue + } + out = append(out, o) + } + return out, errs.errOrNil() +} + +func metric(m metricdata.Metrics) (*mpb.Metric, error) { + var err error + out := &mpb.Metric{ + Name: m.Name, + Description: m.Description, + Unit: string(m.Unit), + } + switch a := m.Data.(type) { + case metricdata.Gauge[int64]: + out.Data = Gauge[int64](a) + case metricdata.Gauge[float64]: + out.Data = Gauge[float64](a) + case metricdata.Sum[int64]: + out.Data, err = Sum[int64](a) + case metricdata.Sum[float64]: + out.Data, err = Sum[float64](a) + case metricdata.Histogram: + out.Data, err = Histogram(a) + default: + return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) + } + return out, err +} + +// Gauge returns an OTLP Metric_Gauge generated from g. +func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { + return &mpb.Metric_Gauge{ + Gauge: &mpb.Gauge{ + DataPoints: DataPoints(g.DataPoints), + }, + } +} + +// Sum returns an OTLP Metric_Sum generated from s. An error is returned with +// a partial Metric_Sum if the temporality of s is unknown. +func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { + t, err := Temporality(s.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Sum{ + Sum: &mpb.Sum{ + AggregationTemporality: t, + IsMonotonic: s.IsMonotonic, + DataPoints: DataPoints(s.DataPoints), + }, + }, nil +} + +// DataPoints returns a slice of OTLP NumberDataPoint generated from dPts. +func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint { + out := make([]*mpb.NumberDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + ndp := &mpb.NumberDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), + TimeUnixNano: uint64(dPt.Time.UnixNano()), + } + switch v := any(dPt.Value).(type) { + case int64: + ndp.Value = &mpb.NumberDataPoint_AsInt{ + AsInt: v, + } + case float64: + ndp.Value = &mpb.NumberDataPoint_AsDouble{ + AsDouble: v, + } + } + out = append(out, ndp) + } + return out +} + +// Histogram returns an OTLP Metric_Histogram generated from h. An error is +// returned with a partial Metric_Histogram if the temporality of h is +// unknown. +func Histogram(h metricdata.Histogram) (*mpb.Metric_Histogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Histogram{ + Histogram: &mpb.Histogram{ + AggregationTemporality: t, + DataPoints: HistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated +// from dPts. +func HistogramDataPoints(dPts []metricdata.HistogramDataPoint) []*mpb.HistogramDataPoint { + out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + out = append(out, &mpb.HistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), + TimeUnixNano: uint64(dPt.Time.UnixNano()), + Count: dPt.Count, + Sum: &dPt.Sum, + BucketCounts: dPt.BucketCounts, + ExplicitBounds: dPt.Bounds, + Min: dPt.Min, + Max: dPt.Max, + }) + } + return out +} + +// Temporality returns an OTLP AggregationTemporality generated from t. If t +// is unknown, an error is returned along with the invalid +// AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. +func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { + switch t { + case metricdata.DeltaTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, nil + case metricdata.CumulativeTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, nil + default: + err := fmt.Errorf("%w: %s", errUnknownTemporality, t) + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err + } +} diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go new file mode 100644 index 00000000000..e9745da7b7f --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -0,0 +1,355 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "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.10.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" +) + +type unknownAggT struct { + metricdata.Aggregation +} + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + alice = attribute.NewSet(attribute.String("user", "alice")) + bob = attribute.NewSet(attribute.String("user", "bob")) + + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + pbBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + + min, max, sum = 2.0, 4.0, 90.0 + otelHDP = []metricdata.HistogramDataPoint{{ + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + Sum: sum, + }} + + pbHDP = []*mpb.HistogramDataPoint{{ + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sum, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + }} + + otelHist = metricdata.Histogram{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDP, + } + invalidTemporality metricdata.Temporality + otelHistInvalid = metricdata.Histogram{ + Temporality: invalidTemporality, + DataPoints: otelHDP, + } + + pbHist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDP, + } + + otelDPtsInt64 = []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1}, + {Attributes: bob, StartTime: start, Time: end, Value: 2}, + } + otelDPtsFloat64 = []metricdata.DataPoint[float64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, + {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + } + + pbDPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + pbDPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + otelSumInt64 = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: otelDPtsInt64, + } + otelSumFloat64 = metricdata.Sum[float64]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + otelSumInvalid = metricdata.Sum[float64]{ + Temporality: invalidTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + + pbSumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: pbDPtsInt64, + } + pbSumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: pbDPtsFloat64, + } + + otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} + otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + + pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} + pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + + unknownAgg unknownAggT + otelMetrics = []metricdata.Metrics{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: unit.Dimensionless, + Data: otelGaugeInt64, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: unit.Dimensionless, + Data: otelGaugeFloat64, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: unit.Dimensionless, + Data: otelSumInt64, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: unit.Dimensionless, + Data: otelSumFloat64, + }, + { + Name: "invalid-sum", + Description: "Sum with invalid temporality", + Unit: unit.Dimensionless, + Data: otelSumInvalid, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: unit.Dimensionless, + Data: otelHist, + }, + { + Name: "invalid-histogram", + Description: "Invalid histogram", + Unit: unit.Dimensionless, + Data: otelHistInvalid, + }, + { + Name: "unknown", + Description: "Unknown aggregation", + Unit: unit.Dimensionless, + Data: unknownAgg, + }, + } + + pbMetrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Sum{Sum: pbSumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: string(unit.Dimensionless), + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + } + + otelScopeMetrics = []metricdata.ScopeMetrics{{ + Scope: instrumentation.Scope{ + Name: "test/code/path", + Version: "v0.1.0", + SchemaURL: semconv.SchemaURL, + }, + Metrics: otelMetrics, + }} + + pbScopeMetrics = []*mpb.ScopeMetrics{{ + Scope: &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + }, + Metrics: pbMetrics, + SchemaUrl: semconv.SchemaURL, + }} + + otelRes = resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("test server"), + semconv.ServiceVersionKey.String("v0.1.0"), + ) + + pbRes = &rpb.Resource{ + Attributes: []*cpb.KeyValue{ + { + Key: "service.name", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }, + }, + { + Key: "service.version", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }, + }, + }, + } + + otelResourceMetrics = metricdata.ResourceMetrics{ + Resource: otelRes, + ScopeMetrics: otelScopeMetrics, + } + + pbResourceMetrics = &mpb.ResourceMetrics{ + Resource: pbRes, + ScopeMetrics: pbScopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +func TestTransformations(t *testing.T) { + // Run tests from the "bottom-up" of the metricdata data-types and halt + // when a failure occurs to ensure the clearest failure message (as + // opposed to the opposite of testing from the top-down which will obscure + // errors deep inside the structs). + + // DataPoint types. + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDP)) + assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) + require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) + + // Aggregations. + h, err := Histogram(otelHist) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, h) + + s, err := Sum[int64](otelSumInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumInt64}, s) + s, err = Sum[float64](otelSumFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumFloat64}, s) + s, err = Sum[float64](otelSumInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, s) + + assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) + require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) + + // Metrics. + m, err := Metrics(otelMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbMetrics, m) + + // Scope Metrics. + sm, err := ScopeMetrics(otelScopeMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbScopeMetrics, sm) + + // Resource Metrics. + rm, err := ResourceMetrics(otelResourceMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbResourceMetrics, rm) +} diff --git a/exporters/otlp/otlpmetric/options.go b/exporters/otlp/otlpmetric/options.go deleted file mode 100644 index bd8706a74d3..00000000000 --- a/exporters/otlp/otlpmetric/options.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - -import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - -// Option are setting options passed to an Exporter on creation. -type Option interface { - apply(config) config -} - -type exporterOptionFunc func(config) config - -func (fn exporterOptionFunc) apply(cfg config) config { - return fn(cfg) -} - -type config struct { - temporalitySelector aggregation.TemporalitySelector -} - -// WithMetricAggregationTemporalitySelector defines the aggregation.TemporalitySelector used -// for selecting aggregation.Temporality (i.e., Cumulative vs. Delta -// aggregation). If not specified otherwise, exporter will use a -// cumulative temporality selector. -func WithMetricAggregationTemporalitySelector(selector aggregation.TemporalitySelector) Option { - return exporterOptionFunc(func(cfg config) config { - cfg.temporalitySelector = selector - return cfg - }) -} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 16cc5322da8..44ad5e2fc0e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" import ( "context" - "errors" - "sync" "time" "google.golang.org/genproto/googleapis/rpc/errdetails" @@ -28,54 +29,49 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) +// New returns an OpenTelemetry metric Exporter. The Exporter can be used with +// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving +// endpoint using gRPC. +// +// If an already established gRPC ClientConn is not passed in options using +// WithGRPCConn, a connection to the OTLP endpoint will be established based +// on options. If a connection cannot be establishes in the lifetime of ctx, +// an error will be returned. +func New(ctx context.Context, options ...Option) (metric.Exporter, error) { + c, err := newClient(ctx, options...) + if err != nil { + return nil, err + } + return otlpmetric.New(c), nil +} + type client struct { - endpoint string - dialOpts []grpc.DialOption metadata metadata.MD exportTimeout time.Duration requestFunc retry.RequestFunc - // stopCtx is used as a parent context for all exports. Therefore, when it - // is canceled with the stopFunc all exports are canceled. - stopCtx context.Context - // stopFunc cancels stopCtx, stopping any active exports. - stopFunc context.CancelFunc - - // ourConn keeps track of where conn was created: true if created here on - // Start, or false if passed with an option. This is important on Shutdown - // as the conn should only be closed if created here on start. Otherwise, + // ourConn keeps track of where conn was created: true if created here in + // NewClient, or false if passed with an option. This is important on + // Shutdown as the conn should only be closed if we created it. Otherwise, // it is up to the processes that passed the conn to close it. ourConn bool conn *grpc.ClientConn - mscMu sync.RWMutex msc colmetricpb.MetricsServiceClient } -// Compile time check *client implements otlpmetric.Client. -var _ otlpmetric.Client = (*client)(nil) - -// NewClient creates a new gRPC metric client. -func NewClient(opts ...Option) otlpmetric.Client { - return newClient(opts...) -} - -func newClient(opts ...Option) *client { - cfg := otlpconfig.NewGRPCConfig(asGRPCOptions(opts)...) - - ctx, cancel := context.WithCancel(context.Background()) +// newClient creates a new gRPC metric client. +func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error) { + cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...) c := &client{ - endpoint: cfg.Metrics.Endpoint, exportTimeout: cfg.Metrics.Timeout, requestFunc: cfg.RetryConfig.RequestFunc(retryable), - dialOpts: cfg.DialOptions, - stopCtx: ctx, - stopFunc: cancel, conn: cfg.GRPCConn, } @@ -83,17 +79,12 @@ func newClient(opts ...Option) *client { c.metadata = metadata.New(cfg.Metrics.Headers) } - return c -} - -// Start establishes a gRPC connection to the collector. -func (c *client) Start(ctx context.Context) error { if c.conn == nil { // If the caller did not provide a ClientConn when the client was // created, create one using the configuration they did provide. - conn, err := grpc.DialContext(ctx, c.endpoint, c.dialOpts...) + conn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...) if err != nil { - return err + return nil, err } // Keep track that we own the lifecycle of this conn and need to close // it on Shutdown. @@ -101,69 +92,30 @@ func (c *client) Start(ctx context.Context) error { c.conn = conn } - // The otlpmetric.Client interface states this method is called just once, - // so no need to check if already started. - c.mscMu.Lock() c.msc = colmetricpb.NewMetricsServiceClient(c.conn) - c.mscMu.Unlock() - return nil + return c, nil } -var errAlreadyStopped = errors.New("the client is already stopped") +// ForceFlush does nothing, the client holds no state. +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } -// Stop shuts down the client. +// Shutdown shuts down the client, freeing all resource. // // Any active connections to a remote endpoint are closed if they were created // by the client. Any gRPC connection passed during creation using // WithGRPCConn will not be closed. It is the caller's responsibility to // handle cleanup of that resource. -// -// This method synchronizes with the UploadMetrics method of the client. It -// will wait for any active calls to that method to complete unimpeded, or it -// will cancel any active calls if ctx expires. If ctx expires, the context -// error will be forwarded as the returned error. All client held resources -// will still be released in this situation. -// -// If the client has already stopped, an error will be returned describing -// this. -func (c *client) Stop(ctx context.Context) error { - // Acquire the c.mscMu lock within the ctx lifetime. - acquired := make(chan struct{}) - go func() { - c.mscMu.Lock() - close(acquired) - }() - var err error - select { - case <-ctx.Done(): - // The Stop timeout is reached. Kill any remaining exports to force - // the clear of the lock and save the timeout error to return and - // signal the shutdown timed out before cleanly stopping. - c.stopFunc() - err = ctx.Err() - - // To ensure the client is not left in a dirty state c.msc needs to be - // set to nil. To avoid the race condition when doing this, ensure - // that all the exports are killed (initiated by c.stopFunc). - <-acquired - case <-acquired: - } - // Hold the mscMu lock for the rest of the function to ensure no new - // exports are started. - defer c.mscMu.Unlock() - - // The otlpmetric.Client interface states this method is called only - // once, but there is no guarantee it is called after Start. Ensure the - // client is started before doing anything and let the called know if they - // made a mistake. - if c.msc == nil { - return errAlreadyStopped - } +func (c *client) Shutdown(ctx context.Context) error { + // The otlpmetric.Exporter synchronizes access to client methods and + // ensures this is called only once. The only thing that needs to be done + // here is to release any computational resources the client holds. - // Clear c.msc to signal the client is stopped. + c.metadata = nil + c.requestFunc = nil c.msc = nil + err := ctx.Err() if c.ourConn { closeErr := c.conn.Close() // A context timeout error takes precedence over this error. @@ -171,25 +123,24 @@ func (c *client) Stop(ctx context.Context) error { err = closeErr } } + c.conn = nil return err } -var errShutdown = errors.New("the client is shutdown") - -// UploadMetrics sends a batch of spans. +// UploadMetrics sends protoMetrics to connected endpoint. // // Retryable errors from the server will be handled according to any // RetryConfig the client was created with. func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { - // Hold a read lock to ensure a shut down initiated after this starts does - // not abandon the export. This read lock acquire has less priority than a - // write lock acquire (i.e. Stop), meaning if the client is shutting down - // this will come after the shut down. - c.mscMu.RLock() - defer c.mscMu.RUnlock() + // The otlpmetric.Exporter synchronizes access to client methods, and + // ensures this is not called after the Exporter is shutdown. Only thing + // to do here is send data. - if c.msc == nil { - return errShutdown + select { + case <-ctx.Done(): + // Do not upload if the context is already expired. + return ctx.Err() + default: } ctx, cancel := c.exportContext(ctx) @@ -209,7 +160,7 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou } // exportContext returns a copy of parent with an appropriate deadline and -// cancellation function. +// cancellation function based on the clients configured export timeout. // // It is the callers responsibility to cancel the returned context once its // use is complete, via the parent or directly with the returned CancelFunc, to @@ -230,23 +181,12 @@ func (c *client) exportContext(parent context.Context) (context.Context, context ctx = metadata.NewOutgoingContext(ctx, c.metadata) } - // Unify the client stopCtx with the parent. - go func() { - select { - case <-ctx.Done(): - case <-c.stopCtx.Done(): - // Cancel the export as the shutdown has timed out. - cancel() - } - }() - return ctx, cancel } // retryable returns if err identifies a request that can be retried and a // duration to wait for if an explicit throttle time is included in err. func retryable(err error) (bool, time.Duration) { - //func retryable(err error) (bool, time.Duration) { s := status.Convert(err) switch s.Code() { case codes.Canceled, diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 1f54bf5c610..e78e91f5396 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -12,320 +12,183 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetricgrpc_test +//go:build go1.18 +// +build go1.18 + +package otlpmetricgrpc import ( "context" - "fmt" - "net" - "strings" "testing" "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "google.golang.org/grpc" + "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc/codes" - "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/durationpb" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -var ( - oneRecord = otlpmetrictest.OneRecordReader() - - testResource = resource.Empty() -) - -func TestNewExporterEndToEnd(t *testing.T) { - tests := []struct { - name string - additionalOpts []otlpmetricgrpc.Option +func TestThrottleDuration(t *testing.T) { + c := codes.ResourceExhausted + testcases := []struct { + status *status.Status + expected time.Duration }{ { - name: "StandardExporter", + status: status.New(c, "NoRetryInfo"), + expected: 0, }, { - name: "WithCompressor", - additionalOpts: []otlpmetricgrpc.Option{ - otlpmetricgrpc.WithCompressor(gzip.Name), - }, + status: func() *status.Status { + s, err := status.New(c, "SingleRetryInfo").WithDetails( + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(15 * time.Millisecond), + }, + ) + require.NoError(t, err) + return s + }(), + expected: 15 * time.Millisecond, }, { - name: "WithServiceConfig", - additionalOpts: []otlpmetricgrpc.Option{ - otlpmetricgrpc.WithServiceConfig("{}"), - }, + status: func() *status.Status { + s, err := status.New(c, "ErrorInfo").WithDetails( + &errdetails.ErrorInfo{Reason: "no throttle detail"}, + ) + require.NoError(t, err) + return s + }(), + expected: 0, + }, + { + status: func() *status.Status { + s, err := status.New(c, "ErrorAndRetryInfo").WithDetails( + &errdetails.ErrorInfo{Reason: "with throttle detail"}, + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(13 * time.Minute), + }, + ) + require.NoError(t, err) + return s + }(), + expected: 13 * time.Minute, }, { - name: "WithDialOptions", - additionalOpts: []otlpmetricgrpc.Option{ - otlpmetricgrpc.WithDialOption(grpc.WithBlock()), - }, + status: func() *status.Status { + s, err := status.New(c, "DoubleRetryInfo").WithDetails( + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(13 * time.Minute), + }, + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(15 * time.Minute), + }, + ) + require.NoError(t, err) + return s + }(), + expected: 13 * time.Minute, }, } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - newExporterEndToEndTest(t, test.additionalOpts) + for _, tc := range testcases { + t.Run(tc.status.Message(), func(t *testing.T) { + require.Equal(t, tc.expected, throttleDelay(tc.status)) }) } } -func newGRPCExporter(t *testing.T, ctx context.Context, endpoint string, additionalOpts ...otlpmetricgrpc.Option) *otlpmetric.Exporter { - opts := []otlpmetricgrpc.Option{ - otlpmetricgrpc.WithInsecure(), - otlpmetricgrpc.WithEndpoint(endpoint), - otlpmetricgrpc.WithReconnectionPeriod(50 * time.Millisecond), +func TestRetryable(t *testing.T) { + retryableCodes := map[codes.Code]bool{ + codes.OK: false, + codes.Canceled: true, + codes.Unknown: false, + codes.InvalidArgument: false, + codes.DeadlineExceeded: true, + codes.NotFound: false, + codes.AlreadyExists: false, + codes.PermissionDenied: false, + codes.ResourceExhausted: true, + codes.FailedPrecondition: false, + codes.Aborted: true, + codes.OutOfRange: true, + codes.Unimplemented: false, + codes.Internal: false, + codes.Unavailable: true, + codes.DataLoss: true, + codes.Unauthenticated: false, } - opts = append(opts, additionalOpts...) - client := otlpmetricgrpc.NewClient(opts...) - exp, err := otlpmetric.New(ctx, client) - if err != nil { - t.Fatalf("failed to create a new collector exporter: %v", err) + for c, want := range retryableCodes { + got, _ := retryable(status.Error(c, "")) + assert.Equalf(t, want, got, "evaluate(%s)", c) } - return exp } -func newExporterEndToEndTest(t *testing.T, additionalOpts []otlpmetricgrpc.Option) { - mc := runMockCollector(t) - - defer func() { - _ = mc.stop() - }() - - <-time.After(5 * time.Millisecond) +func TestClient(t *testing.T) { + factory := func() (otlpmetric.Client, otest.Collector) { + coll, err := otest.NewGRPCCollector("", nil) + require.NoError(t, err) - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint, additionalOpts...) - defer func() { - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - panic(err) - } - }() - - otlpmetrictest.RunEndToEndTest(ctx, t, exp, mc) -} - -func TestExporterShutdown(t *testing.T) { - mc := runMockCollector(t) - defer func() { - _ = mc.Stop() - }() - - <-time.After(5 * time.Millisecond) - - otlpmetrictest.RunExporterShutdownTest(t, func() otlpmetric.Client { - return otlpmetricgrpc.NewClient( - otlpmetricgrpc.WithInsecure(), - otlpmetricgrpc.WithEndpoint(mc.endpoint), - otlpmetricgrpc.WithReconnectionPeriod(50*time.Millisecond), - ) - }) -} - -func TestNewExporterInvokeStartThenStopManyTimes(t *testing.T) { - mc := runMockCollector(t) - defer func() { - _ = mc.stop() - }() - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint) - defer func() { - if err := exp.Shutdown(ctx); err != nil { - panic(err) - } - }() - - // Invoke Start numerous times, should return errAlreadyStarted - for i := 0; i < 10; i++ { - if err := exp.Start(ctx); err == nil || !strings.Contains(err.Error(), "already started") { - t.Fatalf("#%d unexpected Start error: %v", i, err) - } + ctx := context.Background() + addr := coll.Addr().String() + client, err := newClient(ctx, WithEndpoint(addr), WithInsecure()) + require.NoError(t, err) + return client, coll } - if err := exp.Shutdown(ctx); err != nil { - t.Fatalf("failed to Shutdown the exporter: %v", err) - } - // Invoke Shutdown numerous times - for i := 0; i < 10; i++ { - if err := exp.Shutdown(ctx); err != nil { - t.Fatalf(`#%d got error (%v) expected none`, i, err) - } - } -} - -// This test takes a long time to run: to skip it, run tests using: -short. -func TestNewExporterCollectorOnBadConnection(t *testing.T) { - if testing.Short() { - t.Skipf("Skipping this long running test") - } - - ln, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to grab an available port: %v", err) - } - // Firstly close the "collector's" channel: optimistically this endpoint won't get reused ASAP - // However, our goal of closing it is to simulate an unavailable connection - _ = ln.Close() - - _, collectorPortStr, _ := net.SplitHostPort(ln.Addr().String()) - - endpoint := fmt.Sprintf("localhost:%s", collectorPortStr) - ctx := context.Background() - exp := newGRPCExporter(t, ctx, endpoint) - _ = exp.Shutdown(ctx) -} - -func TestNewExporterWithEndpoint(t *testing.T) { - mc := runMockCollector(t) - defer func() { - _ = mc.stop() - }() - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint) - _ = exp.Shutdown(ctx) + t.Run("Integration", otest.RunClientTests(factory)) } -func TestNewExporterWithHeaders(t *testing.T) { - mc := runMockCollector(t) - defer func() { - _ = mc.stop() - }() - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint, - otlpmetricgrpc.WithHeaders(map[string]string{"header1": "value1"})) - require.NoError(t, exp.Export(ctx, testResource, oneRecord)) - - defer func() { - _ = exp.Shutdown(ctx) - }() - - headers := mc.getHeaders() - require.Len(t, headers.Get("header1"), 1) - assert.Equal(t, "value1", headers.Get("header1")[0]) -} - -func TestNewExporterWithTimeout(t *testing.T) { - tts := []struct { - name string - fn func(exp *otlpmetric.Exporter) error - timeout time.Duration - metrics int - spans int - code codes.Code - delay bool - }{ - { - name: "Timeout Metrics", - fn: func(exp *otlpmetric.Exporter) error { - return exp.Export(context.Background(), testResource, oneRecord) - }, - timeout: time.Millisecond * 100, - code: codes.DeadlineExceeded, - delay: true, - }, - - { - name: "No Timeout Metrics", - fn: func(exp *otlpmetric.Exporter) error { - return exp.Export(context.Background(), testResource, oneRecord) - }, - timeout: time.Minute, - metrics: 1, - code: codes.OK, - }, +func TestConfig(t *testing.T) { + factoryFunc := func(errCh <-chan error, o ...Option) (metric.Exporter, *otest.GRPCCollector) { + coll, err := otest.NewGRPCCollector("", errCh) + require.NoError(t, err) + + ctx := context.Background() + opts := append([]Option{ + WithEndpoint(coll.Addr().String()), + WithInsecure(), + }, o...) + exp, err := New(ctx, opts...) + require.NoError(t, err) + return exp, coll } - for _, tt := range tts { - t.Run(tt.name, func(t *testing.T) { - mc := runMockCollector(t) - if tt.delay { - mc.metricSvc.delay = time.Second * 10 - } - defer func() { - _ = mc.stop() - }() - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint, otlpmetricgrpc.WithTimeout(tt.timeout), otlpmetricgrpc.WithRetry(otlpmetricgrpc.RetryConfig{Enabled: false})) - defer func() { - _ = exp.Shutdown(ctx) - }() - - err := tt.fn(exp) - - if tt.code == codes.OK { - require.NoError(t, err) - } else { - require.Error(t, err) - } - - s := status.Convert(err) - require.Equal(t, tt.code, s.Code()) - - require.Len(t, mc.getMetrics(), tt.metrics) - }) - } -} - -func TestStartErrorInvalidAddress(t *testing.T) { - client := otlpmetricgrpc.NewClient( - otlpmetricgrpc.WithInsecure(), - // Validate the connection in Start (which should return the error). - otlpmetricgrpc.WithDialOption( - grpc.WithBlock(), - grpc.FailOnNonTempDialError(true), - ), - otlpmetricgrpc.WithEndpoint("invalid"), - otlpmetricgrpc.WithReconnectionPeriod(time.Hour), - ) - err := client.Start(context.Background()) - assert.EqualError(t, err, `connection error: desc = "transport: error while dialing: dial tcp: address invalid: missing port in address"`) -} - -func TestEmptyData(t *testing.T) { - mc := runMockCollector(t) - - defer func() { - _ = mc.stop() - }() - - <-time.After(5 * time.Millisecond) - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint) - defer func() { - assert.NoError(t, exp.Shutdown(ctx)) - }() - - assert.NoError(t, exp.Export(ctx, testResource, otlpmetrictest.EmptyReader())) -} - -func TestFailedMetricTransform(t *testing.T) { - mc := runMockCollector(t) - - defer func() { - _ = mc.stop() - }() - - <-time.After(5 * time.Millisecond) - - ctx := context.Background() - exp := newGRPCExporter(t, ctx, mc.endpoint) - defer func() { - assert.NoError(t, exp.Shutdown(ctx)) - }() + t.Run("WithHeaders", func(t *testing.T) { + key := "my-custom-header" + headers := map[string]string{key: "custom-value"} + exp, coll := factoryFunc(nil, WithHeaders(headers)) + t.Cleanup(coll.Shutdown) + ctx := context.Background() + require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + // Ensure everything is flushed. + require.NoError(t, exp.Shutdown(ctx)) + + got := coll.Headers() + require.Contains(t, got, key) + assert.Equal(t, got[key], []string{headers[key]}) + }) - assert.Error(t, exp.Export(ctx, testResource, otlpmetrictest.FailReader{})) + t.Run("WithTimeout", func(t *testing.T) { + // Do not send on errCh so the Collector never responds to the client. + errCh := make(chan error) + t.Cleanup(func() { close(errCh) }) + exp, coll := factoryFunc( + errCh, + WithTimeout(time.Millisecond), + WithRetry(RetryConfig{Enabled: false}), + ) + t.Cleanup(coll.Shutdown) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + err := exp.Export(ctx, metricdata.ResourceMetrics{}) + assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) + }) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_unit_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_unit_test.go deleted file mode 100644 index ccd4ade1389..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_unit_test.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetricgrpc - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/genproto/googleapis/rpc/errdetails" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/durationpb" -) - -func TestThrottleDuration(t *testing.T) { - c := codes.ResourceExhausted - testcases := []struct { - status *status.Status - expected time.Duration - }{ - { - status: status.New(c, "no retry info"), - expected: 0, - }, - { - status: func() *status.Status { - s, err := status.New(c, "single retry info").WithDetails( - &errdetails.RetryInfo{ - RetryDelay: durationpb.New(15 * time.Millisecond), - }, - ) - require.NoError(t, err) - return s - }(), - expected: 15 * time.Millisecond, - }, - { - status: func() *status.Status { - s, err := status.New(c, "error info").WithDetails( - &errdetails.ErrorInfo{Reason: "no throttle detail"}, - ) - require.NoError(t, err) - return s - }(), - expected: 0, - }, - { - status: func() *status.Status { - s, err := status.New(c, "error and retry info").WithDetails( - &errdetails.ErrorInfo{Reason: "with throttle detail"}, - &errdetails.RetryInfo{ - RetryDelay: durationpb.New(13 * time.Minute), - }, - ) - require.NoError(t, err) - return s - }(), - expected: 13 * time.Minute, - }, - { - status: func() *status.Status { - s, err := status.New(c, "double retry info").WithDetails( - &errdetails.RetryInfo{ - RetryDelay: durationpb.New(13 * time.Minute), - }, - &errdetails.RetryInfo{ - RetryDelay: durationpb.New(15 * time.Minute), - }, - ) - require.NoError(t, err) - return s - }(), - expected: 13 * time.Minute, - }, - } - - for _, tc := range testcases { - t.Run(tc.status.Message(), func(t *testing.T) { - require.Equal(t, tc.expected, throttleDelay(tc.status)) - }) - } -} - -func TestRetryable(t *testing.T) { - retryableCodes := map[codes.Code]bool{ - codes.OK: false, - codes.Canceled: true, - codes.Unknown: false, - codes.InvalidArgument: false, - codes.DeadlineExceeded: true, - codes.NotFound: false, - codes.AlreadyExists: false, - codes.PermissionDenied: false, - codes.ResourceExhausted: true, - codes.FailedPrecondition: false, - codes.Aborted: true, - codes.OutOfRange: true, - codes.Unimplemented: false, - codes.Internal: false, - codes.Unavailable: true, - codes.DataLoss: true, - codes.Unauthenticated: false, - } - - for c, want := range retryableCodes { - got, _ := retryable(status.Error(c, "")) - assert.Equalf(t, want, got, "evaluate(%s)", c) - } -} - -func TestUnstartedStop(t *testing.T) { - client := NewClient() - assert.ErrorIs(t, client.Stop(context.Background()), errAlreadyStopped) -} - -func TestUnstartedUploadMetric(t *testing.T) { - client := NewClient() - assert.ErrorIs(t, client.UploadMetrics(context.Background(), nil), errShutdown) -} - -func TestExportContextHonorsParentDeadline(t *testing.T) { - now := time.Now() - ctx, cancel := context.WithDeadline(context.Background(), now) - t.Cleanup(cancel) - - // Without a client timeout, the parent deadline should be used. - client := newClient(WithTimeout(0)) - eCtx, eCancel := client.exportContext(ctx) - t.Cleanup(eCancel) - - deadline, ok := eCtx.Deadline() - assert.True(t, ok, "deadline not propagated to child context") - assert.Equal(t, now, deadline) -} - -func TestExportContextHonorsClientTimeout(t *testing.T) { - // Setting a timeout should ensure a deadline is set on the context. - client := newClient(WithTimeout(1 * time.Second)) - ctx, cancel := client.exportContext(context.Background()) - t.Cleanup(cancel) - - _, ok := ctx.Deadline() - assert.True(t, ok, "timeout not set as deadline for child context") -} - -func TestExportContextLinksStopSignal(t *testing.T) { - rootCtx := context.Background() - - client := newClient(WithInsecure()) - t.Cleanup(func() { require.NoError(t, client.Stop(rootCtx)) }) - require.NoError(t, client.Start(rootCtx)) - - ctx, cancel := client.exportContext(rootCtx) - t.Cleanup(cancel) - - require.False(t, func() bool { - select { - case <-ctx.Done(): - return true - default: - } - return false - }(), "context should not be done prior to canceling it") - - // The client.stopFunc cancels the client.stopCtx. This should have been - // setup as a parent of ctx. Therefore, it should cancel ctx as well. - client.stopFunc() - - // Assert this with Eventually to account for goroutine scheduler timing. - assert.Eventually(t, func() bool { - select { - case <-ctx.Done(): - return true - default: - } - return false - }, 10*time.Second, time.Microsecond) -} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go new file mode 100644 index 00000000000..d838420d03f --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -0,0 +1,241 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + +import ( + "fmt" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" +) + +// Option applies a configuration option to the Exporter. +type Option interface { + applyGRPCOption(oconf.Config) oconf.Config +} + +func asGRPCOptions(opts []Option) []oconf.GRPCOption { + converted := make([]oconf.GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = oconf.NewGRPCOption(o.applyGRPCOption) + } + return converted +} + +// RetryConfig defines configuration for retrying the export of metric data +// that failed. +// +// This configuration does not define any network retry strategy. That is +// entirely handled by the gRPC ClientConn. +type RetryConfig retry.Config + +type wrappedOption struct { + oconf.GRPCOption +} + +func (w wrappedOption) applyGRPCOption(cfg oconf.Config) oconf.Config { + return w.ApplyGRPCOption(cfg) +} + +// WithInsecure disables client transport security for the Exporter's gRPC +// connection, just like grpc.WithInsecure() +// (https://pkg.go.dev/google.golang.org/grpc#WithInsecure) does. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used to determine client security. If the endpoint has a +// scheme of "http" or "unix" client security will be disabled. If both are +// set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, client security will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithInsecure() Option { + return wrappedOption{oconf.WithInsecure()} +} + +// WithEndpoint sets the target endpoint the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpoint(endpoint string) Option { + return wrappedOption{oconf.WithEndpoint(endpoint)} +} + +// WithReconnectionPeriod set the minimum amount of time between connection +// attempts to the target endpoint. +// +// This option has no effect if WithGRPCConn is used. +func WithReconnectionPeriod(rp time.Duration) Option { + return wrappedOption{oconf.NewGRPCOption(func(cfg oconf.Config) oconf.Config { + cfg.ReconnectionPeriod = rp + return cfg + })} +} + +func compressorToCompression(compressor string) oconf.Compression { + if compressor == "gzip" { + return oconf.GzipCompression + } + + otel.Handle(fmt.Errorf("invalid compression type: '%s', using no compression as default", compressor)) + return oconf.NoCompression +} + +// WithCompressor sets the compressor the gRPC client uses. +// +// It is the responsibility of the caller to ensure that the compressor set +// has been registered with google.golang.org/grpc/encoding (see +// encoding.RegisterCompressor for more information). For example, to register +// the gzip compressor import the package: +// +// import _ "google.golang.org/grpc/encoding/gzip" +// +// If the OTEL_EXPORTER_OTLP_COMPRESSION or +// OTEL_EXPORTER_OTLP_METRICS_COMPRESSION environment variable is set, and +// this option is not passed, that variable value will be used. That value can +// be either "none" or "gzip". If both are set, +// OTEL_EXPORTER_OTLP_METRICS_COMPRESSION will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no compressor will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithCompressor(compressor string) Option { + return wrappedOption{oconf.WithCompression(compressorToCompression(compressor))} +} + +// WithHeaders will send the provided headers with each gRPC requests. +// +// If the OTEL_EXPORTER_OTLP_HEADERS or OTEL_EXPORTER_OTLP_METRICS_HEADERS +// environment variable is set, and this option is not passed, that variable +// value will be used. The value will be parsed as a list of key value pairs. +// These pairs are expected to be in the W3C Correlation-Context format +// without additional semi-colon delimited metadata (i.e. "k1=v1,k2=v2"). If +// both are set, OTEL_EXPORTER_OTLP_METRICS_HEADERS will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no user headers will be set. +func WithHeaders(headers map[string]string) Option { + return wrappedOption{oconf.WithHeaders(headers)} +} + +// WithTLSCredentials sets the gRPC connection to use creds. +// +// If the OTEL_EXPORTER_OTLP_CERTIFICATE or +// OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE environment variable is set, and +// this option is not passed, that variable value will be used. The value will +// be parsed the filepath of the TLS certificate chain to use. If both are +// set, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no TLS credentials will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithTLSCredentials(creds credentials.TransportCredentials) Option { + return wrappedOption{oconf.NewGRPCOption(func(cfg oconf.Config) oconf.Config { + cfg.Metrics.GRPCCredentials = creds + return cfg + })} +} + +// WithServiceConfig defines the default gRPC service config used. +// +// This option has no effect if WithGRPCConn is used. +func WithServiceConfig(serviceConfig string) Option { + return wrappedOption{oconf.NewGRPCOption(func(cfg oconf.Config) oconf.Config { + cfg.ServiceConfig = serviceConfig + return cfg + })} +} + +// WithDialOption sets explicit grpc.DialOptions to use when establishing a +// gRPC connection. The options here are appended to the internal grpc.DialOptions +// used so they will take precedence over any other internal grpc.DialOptions +// they might conflict with. +// +// This option has no effect if WithGRPCConn is used. +func WithDialOption(opts ...grpc.DialOption) Option { + return wrappedOption{oconf.NewGRPCOption(func(cfg oconf.Config) oconf.Config { + cfg.DialOptions = opts + return cfg + })} +} + +// WithGRPCConn sets conn as the gRPC ClientConn used for all communication. +// +// This option takes precedence over any other option that relates to +// establishing or persisting a gRPC connection to a target endpoint. Any +// other option of those types passed will be ignored. +// +// It is the callers responsibility to close the passed conn. The Exporter +// Shutdown method will not close this connection. +func WithGRPCConn(conn *grpc.ClientConn) Option { + return wrappedOption{oconf.NewGRPCOption(func(cfg oconf.Config) oconf.Config { + cfg.GRPCConn = conn + return cfg + })} +} + +// WithTimeout sets the max amount of time an Exporter will attempt an export. +// +// This takes precedence over any retry settings defined by WithRetry. Once +// this time limit has been reached the export is abandoned and the metric +// data is dropped. +// +// If the OTEL_EXPORTER_OTLP_TIMEOUT or OTEL_EXPORTER_OTLP_METRICS_TIMEOUT +// environment variable is set, and this option is not passed, that variable +// value will be used. The value will be parsed as an integer representing the +// timeout in milliseconds. If both are set, +// OTEL_EXPORTER_OTLP_METRICS_TIMEOUT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, a timeout of 10 seconds will be used. +func WithTimeout(duration time.Duration) Option { + return wrappedOption{oconf.WithTimeout(duration)} +} + +// WithRetry sets the retry policy for transient retryable errors that are +// returned by the target endpoint. +// +// If the target endpoint responds with not only a retryable error, but +// explicitly returns a backoff time in the response, that time will take +// precedence over these settings. +// +// These settings do not define any network retry strategy. That is entirely +// handled by the gRPC ClientConn. +// +// If unset, the default retry policy will be used. It will retry the export +// 5 seconds after receiving a retryable error and increase exponentially +// after each error for no more than a total time of 1 minute. +func WithRetry(settings RetryConfig) Option { + return wrappedOption{oconf.WithRetry(retry.Config(settings))} +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go similarity index 61% rename from exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go rename to exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go index 197059a6a5b..7820619bf60 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go @@ -12,20 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package otlpmetricgrpc provides an otlpmetric.Exporter that communicates +// with an OTLP receiving endpoint using gRPC. package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - -import ( - "context" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -) - -// New constructs a new Exporter and starts it. -func New(ctx context.Context, opts ...Option) (*otlpmetric.Exporter, error) { - return otlpmetric.New(ctx, NewClient(opts...)) -} - -// NewUnstarted constructs a new Exporter and does not start it. -func NewUnstarted(opts ...Option) *otlpmetric.Exporter { - return otlpmetric.NewUnstarted(NewClient(opts...)) -} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index 0b0fbd6967a..8ac22bb2c72 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -12,192 +12,34 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package otlpmetricgrpc_test import ( "context" - "log" - "time" - - "google.golang.org/grpc/credentials" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/selector/simple" + "go.opentelemetry.io/otel/sdk/metric" ) -func Example_insecure() { - ctx := context.Background() - client := otlpmetricgrpc.NewClient(otlpmetricgrpc.WithInsecure()) - exp, err := otlpmetric.New(ctx, client) - if err != nil { - log.Fatalf("Failed to create the collector exporter: %v", err) - } - defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - otel.Handle(err) - } - }() - - pusher := controller.New( - processor.NewFactory( - simple.NewWithHistogramDistribution(), - exp, - ), - controller.WithExporter(exp), - controller.WithCollectPeriod(2*time.Second), - ) - - global.SetMeterProvider(pusher) - - if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controller: %v", err) - } - defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - // pushes any last exports to the receiver - if err := pusher.Stop(ctx); err != nil { - otel.Handle(err) - } - }() - - meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - - // Recorder metric example - - counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) - if err != nil { - log.Fatalf("Failed to create the instrument: %v", err) - } - - for i := 0; i < 10; i++ { - log.Printf("Doing really hard work (%d / 10)\n", i+1) - counter.Add(ctx, 1.0) - } -} - -func Example_withTLS() { - // Please take at look at https://pkg.go.dev/google.golang.org/grpc/credentials#TransportCredentials - // for ways on how to initialize gRPC TransportCredentials. - creds, err := credentials.NewClientTLSFromFile("my-cert.pem", "") - if err != nil { - log.Fatalf("failed to create gRPC client TLS credentials: %v", err) - } - - ctx := context.Background() - client := otlpmetricgrpc.NewClient(otlpmetricgrpc.WithTLSCredentials(creds)) - exp, err := otlpmetric.New(ctx, client) - if err != nil { - log.Fatalf("failed to create the collector exporter: %v", err) - } - defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - otel.Handle(err) - } - }() - - pusher := controller.New( - processor.NewFactory( - simple.NewWithHistogramDistribution(), - exp, - ), - controller.WithExporter(exp), - controller.WithCollectPeriod(2*time.Second), - ) - - global.SetMeterProvider(pusher) - - if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controller: %v", err) - } - - defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - // pushes any last exports to the receiver - if err := pusher.Stop(ctx); err != nil { - otel.Handle(err) - } - }() - - meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - - // Recorder metric example - counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) - if err != nil { - log.Fatalf("Failed to create the instrument: %v", err) - } - - for i := 0; i < 10; i++ { - log.Printf("Doing really hard work (%d / 10)\n", i+1) - counter.Add(ctx, 1.0) - } -} - -func Example_withDifferentSignalCollectors() { - client := otlpmetricgrpc.NewClient( - otlpmetricgrpc.WithInsecure(), - otlpmetricgrpc.WithEndpoint("localhost:30080"), - ) +func Example() { ctx := context.Background() - exp, err := otlpmetric.New(ctx, client) + exp, err := otlpmetricgrpc.New(ctx) if err != nil { - log.Fatalf("failed to create the collector exporter: %v", err) + panic(err) } + meterProvider := metric.NewMeterProvider(metric.WithReader(metric.NewPeriodicReader(exp))) defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - otel.Handle(err) + if err := meterProvider.Shutdown(ctx); err != nil { + panic(err) } }() + global.SetMeterProvider(meterProvider) - pusher := controller.New( - processor.NewFactory( - simple.NewWithHistogramDistribution(), - exp, - ), - controller.WithExporter(exp), - controller.WithCollectPeriod(2*time.Second), - ) - - global.SetMeterProvider(pusher) - - if err := pusher.Start(ctx); err != nil { - log.Fatalf("could not start metric controller: %v", err) - } - defer func() { - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - // pushes any last exports to the receiver - if err := pusher.Stop(ctx); err != nil { - otel.Handle(err) - } - }() - - meter := global.Meter("go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc_test") - - // Recorder metric example - counter, err := meter.SyncFloat64().Counter("an_important_metric", instrument.WithDescription("Measures the cumulative epicness of the app")) - if err != nil { - log.Fatalf("Failed to create the instrument: %v", err) - } - - for i := 0; i < 10; i++ { - log.Printf("Doing really hard work (%d / 10)\n", i+1) - counter.Add(ctx, 1.0) - } - - log.Printf("Done!") + // From here, the meterProvider can be used by instrumentation to collect + // telemetry. } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d0ad331fdea..f4051953143 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 @@ -8,7 +8,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -22,8 +21,10 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 77a03262881..c066ceeecc1 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -35,7 +35,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -114,6 +113,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go deleted file mode 100644 index 96e5303320a..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/mock_collector_test.go +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetricgrpc_test - -import ( - "context" - "fmt" - "net" - "sync" - "testing" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - collectormetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -func makeMockCollector(t *testing.T, mockConfig *mockConfig) *mockCollector { - return &mockCollector{ - t: t, - metricSvc: &mockMetricService{ - storage: otlpmetrictest.NewMetricsStorage(), - errors: mockConfig.errors, - }, - } -} - -type mockMetricService struct { - collectormetricpb.UnimplementedMetricsServiceServer - - requests int - errors []error - - headers metadata.MD - mu sync.RWMutex - storage otlpmetrictest.MetricsStorage - delay time.Duration -} - -func (mms *mockMetricService) getHeaders() metadata.MD { - mms.mu.RLock() - defer mms.mu.RUnlock() - return mms.headers -} - -func (mms *mockMetricService) getMetrics() []*metricpb.Metric { - mms.mu.RLock() - defer mms.mu.RUnlock() - return mms.storage.GetMetrics() -} - -func (mms *mockMetricService) Export(ctx context.Context, exp *collectormetricpb.ExportMetricsServiceRequest) (*collectormetricpb.ExportMetricsServiceResponse, error) { - if mms.delay > 0 { - time.Sleep(mms.delay) - } - - mms.mu.Lock() - defer func() { - mms.requests++ - mms.mu.Unlock() - }() - - reply := &collectormetricpb.ExportMetricsServiceResponse{} - if mms.requests < len(mms.errors) { - idx := mms.requests - return reply, mms.errors[idx] - } - - mms.headers, _ = metadata.FromIncomingContext(ctx) - mms.storage.AddMetrics(exp) - return reply, nil -} - -type mockCollector struct { - t *testing.T - - metricSvc *mockMetricService - - endpoint string - stopFunc func() - stopOnce sync.Once -} - -type mockConfig struct { - errors []error - endpoint string -} - -var _ collectormetricpb.MetricsServiceServer = (*mockMetricService)(nil) - -var errAlreadyStopped = fmt.Errorf("already stopped") - -func (mc *mockCollector) stop() error { - var err = errAlreadyStopped - mc.stopOnce.Do(func() { - err = nil - if mc.stopFunc != nil { - mc.stopFunc() - } - }) - // Give it sometime to shutdown. - <-time.After(160 * time.Millisecond) - - // Wait for services to finish reading/writing. - // Getting the lock ensures the metricSvc is done flushing. - mc.metricSvc.mu.Lock() - defer mc.metricSvc.mu.Unlock() - return err -} - -func (mc *mockCollector) Stop() error { - return mc.stop() -} - -func (mc *mockCollector) getHeaders() metadata.MD { - return mc.metricSvc.getHeaders() -} - -func (mc *mockCollector) getMetrics() []*metricpb.Metric { - return mc.metricSvc.getMetrics() -} - -func (mc *mockCollector) GetMetrics() []*metricpb.Metric { - return mc.getMetrics() -} - -// runMockCollector is a helper function to create a mock Collector. -func runMockCollector(t *testing.T) *mockCollector { - return runMockCollectorAtEndpoint(t, "localhost:0") -} - -func runMockCollectorAtEndpoint(t *testing.T, endpoint string) *mockCollector { - return runMockCollectorWithConfig(t, &mockConfig{endpoint: endpoint}) -} - -func runMockCollectorWithConfig(t *testing.T, mockConfig *mockConfig) *mockCollector { - ln, err := net.Listen("tcp", mockConfig.endpoint) - if err != nil { - t.Fatalf("Failed to get an endpoint: %v", err) - } - - srv := grpc.NewServer() - mc := makeMockCollector(t, mockConfig) - collectormetricpb.RegisterMetricsServiceServer(srv, mc.metricSvc) - go func() { - _ = srv.Serve(ln) - }() - - mc.endpoint = ln.Addr().String() - // srv.Stop calls Close on mc.ln. - mc.stopFunc = srv.Stop - - return mc -} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go deleted file mode 100644 index e733677f00d..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/options.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - -import ( - "fmt" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" -) - -// Option applies an option to the gRPC driver. -type Option interface { - applyGRPCOption(otlpconfig.Config) otlpconfig.Config -} - -func asGRPCOptions(opts []Option) []otlpconfig.GRPCOption { - converted := make([]otlpconfig.GRPCOption, len(opts)) - for i, o := range opts { - converted[i] = otlpconfig.NewGRPCOption(o.applyGRPCOption) - } - return converted -} - -// RetryConfig defines configuration for retrying export of span batches that -// failed to be received by the target endpoint. -// -// This configuration does not define any network retry strategy. That is -// entirely handled by the gRPC ClientConn. -type RetryConfig retry.Config - -type wrappedOption struct { - otlpconfig.GRPCOption -} - -func (w wrappedOption) applyGRPCOption(cfg otlpconfig.Config) otlpconfig.Config { - return w.ApplyGRPCOption(cfg) -} - -// WithInsecure disables client transport security for the exporter's gRPC -// connection just like grpc.WithInsecure() -// (https://pkg.go.dev/google.golang.org/grpc#WithInsecure) does. Note, by -// default, client security is required unless WithInsecure is used. -// -// This option has no effect if WithGRPCConn is used. -func WithInsecure() Option { - return wrappedOption{otlpconfig.WithInsecure()} -} - -// WithEndpoint sets the target endpoint the exporter will connect to. If -// unset, localhost:4317 will be used as a default. -// -// This option has no effect if WithGRPCConn is used. -func WithEndpoint(endpoint string) Option { - return wrappedOption{otlpconfig.WithEndpoint(endpoint)} -} - -// WithReconnectionPeriod set the minimum amount of time between connection -// attempts to the target endpoint. -// -// This option has no effect if WithGRPCConn is used. -func WithReconnectionPeriod(rp time.Duration) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.ReconnectionPeriod = rp - return cfg - })} -} - -func compressorToCompression(compressor string) otlpconfig.Compression { - if compressor == "gzip" { - return otlpconfig.GzipCompression - } - - otel.Handle(fmt.Errorf("invalid compression type: '%s', using no compression as default", compressor)) - return otlpconfig.NoCompression -} - -// WithCompressor sets the compressor for the gRPC client to use when sending -// requests. It is the responsibility of the caller to ensure that the -// compressor set has been registered with google.golang.org/grpc/encoding. -// This can be done by encoding.RegisterCompressor. Some compressors -// auto-register on import, such as gzip, which can be registered by calling -// `import _ "google.golang.org/grpc/encoding/gzip"`. -// -// This option has no effect if WithGRPCConn is used. -func WithCompressor(compressor string) Option { - return wrappedOption{otlpconfig.WithCompression(compressorToCompression(compressor))} -} - -// WithHeaders will send the provided headers with each gRPC requests. -func WithHeaders(headers map[string]string) Option { - return wrappedOption{otlpconfig.WithHeaders(headers)} -} - -// WithTLSCredentials allows the connection to use TLS credentials when -// talking to the server. It takes in grpc.TransportCredentials instead of say -// a Certificate file or a tls.Certificate, because the retrieving of these -// credentials can be done in many ways e.g. plain file, in code tls.Config or -// by certificate rotation, so it is up to the caller to decide what to use. -// -// This option has no effect if WithGRPCConn is used. -func WithTLSCredentials(creds credentials.TransportCredentials) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.Metrics.GRPCCredentials = creds - return cfg - })} -} - -// WithServiceConfig defines the default gRPC service config used. -// -// This option has no effect if WithGRPCConn is used. -func WithServiceConfig(serviceConfig string) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.ServiceConfig = serviceConfig - return cfg - })} -} - -// WithDialOption sets explicit grpc.DialOptions to use when making a -// connection. The options here are appended to the internal grpc.DialOptions -// used so they will take precedence over any other internal grpc.DialOptions -// they might conflict with. -// -// This option has no effect if WithGRPCConn is used. -func WithDialOption(opts ...grpc.DialOption) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.DialOptions = opts - return cfg - })} -} - -// WithGRPCConn sets conn as the gRPC ClientConn used for all communication. -// -// This option takes precedence over any other option that relates to -// establishing or persisting a gRPC connection to a target endpoint. Any -// other option of those types passed will be ignored. -// -// It is the callers responsibility to close the passed conn. The client -// Shutdown method will not close this connection. -func WithGRPCConn(conn *grpc.ClientConn) Option { - return wrappedOption{otlpconfig.NewGRPCOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.GRPCConn = conn - return cfg - })} -} - -// WithTimeout sets the max amount of time a client will attempt to export a -// batch of spans. This takes precedence over any retry settings defined with -// WithRetry, once this time limit has been reached the export is abandoned -// and the batch of spans is dropped. -// -// If unset, the default timeout will be set to 10 seconds. -func WithTimeout(duration time.Duration) Option { - return wrappedOption{otlpconfig.WithTimeout(duration)} -} - -// WithRetry sets the retry policy for transient retryable errors that may be -// returned by the target endpoint when exporting a batch of spans. -// -// If the target endpoint responds with not only a retryable error, but -// explicitly returns a backoff time in the response. That time will take -// precedence over these settings. -// -// These settings do not define any network retry strategy. That is entirely -// handled by the gRPC ClientConn. -// -// If unset, the default retry policy will be used. It will retry the export -// 5 seconds after receiving a retryable error and increase exponentially -// after each error for no more than a total time of 1 minute. -func WithRetry(settings RetryConfig) Option { - return wrappedOption{otlpconfig.WithRetry(retry.Config(settings))} -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/certificate_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/certificate_test.go deleted file mode 100644 index d75547f6e4c..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/certificate_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrichttp_test - -import ( - "bytes" - "crypto/ecdsa" - "crypto/elliptic" - cryptorand "crypto/rand" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "math/big" - mathrand "math/rand" - "net" - "time" -) - -type mathRandReader struct{} - -func (mathRandReader) Read(p []byte) (n int, err error) { - return mathrand.Read(p) -} - -var randReader mathRandReader - -type pemCertificate struct { - Certificate []byte - PrivateKey []byte -} - -// Based on https://golang.org/src/crypto/tls/generate_cert.go, -// simplified and weakened. -func generateWeakCertificate() (*pemCertificate, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader) - if err != nil { - return nil, err - } - keyUsage := x509.KeyUsageDigitalSignature - notBefore := time.Now() - notAfter := notBefore.Add(time.Hour) - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := cryptorand.Int(randReader, serialNumberLimit) - if err != nil { - return nil, err - } - template := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - Organization: []string{"otel-go"}, - }, - NotBefore: notBefore, - NotAfter: notAfter, - KeyUsage: keyUsage, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - DNSNames: []string{"localhost"}, - IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, - } - derBytes, err := x509.CreateCertificate(randReader, &template, &template, &priv.PublicKey, priv) - if err != nil { - return nil, err - } - certificateBuffer := new(bytes.Buffer) - if err := pem.Encode(certificateBuffer, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { - return nil, err - } - privDERBytes, err := x509.MarshalPKCS8PrivateKey(priv) - if err != nil { - return nil, err - } - privBuffer := new(bytes.Buffer) - if err := pem.Encode(privBuffer, &pem.Block{Type: "PRIVATE KEY", Bytes: privDERBytes}); err != nil { - return nil, err - } - return &pemCertificate{ - Certificate: certificateBuffer.Bytes(), - PrivateKey: privBuffer.Bytes(), - }, nil -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 766bcf48744..1bfebc6fbd6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" import ( @@ -31,24 +34,35 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -const contentTypeProto = "application/x-protobuf" +// New returns an OpenTelemetry metric Exporter. The Exporter can be used with +// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving +// endpoint using protobufs over HTTP. +func New(_ context.Context, opts ...Option) (metric.Exporter, error) { + c, err := newClient(opts...) + if err != nil { + return nil, err + } + return otlpmetric.New(c), nil +} -var gzPool = sync.Pool{ - New: func() interface{} { - w := gzip.NewWriter(io.Discard) - return w - }, +type client struct { + // req is cloned for every upload the client makes. + req *http.Request + compression Compression + requestFunc retry.RequestFunc + httpClient *http.Client } // Keep it in sync with golang's DefaultTransport from net/http! We // have our own copy to avoid handling a situation where the // DefaultTransport is overwritten with some different implementation -// of http.RoundTripper or it's modified by other package. +// of http.RoundTripper or it's modified by another package. var ourTransport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ @@ -62,19 +76,9 @@ var ourTransport = &http.Transport{ ExpectContinueTimeout: 1 * time.Second, } -type client struct { - name string - cfg otlpconfig.SignalConfig - generalCfg otlpconfig.Config - requestFunc retry.RequestFunc - client *http.Client - stopCh chan struct{} - stopOnce sync.Once -} - -// NewClient creates a new HTTP metric client. -func NewClient(opts ...Option) otlpmetric.Client { - cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(opts)...) +// newClient creates a new HTTP metric client. +func newClient(opts ...Option) (otlpmetric.Client, error) { + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) httpClient := &http.Client{ Transport: ourTransport, @@ -86,68 +90,79 @@ func NewClient(opts ...Option) otlpmetric.Client { httpClient.Transport = transport } - stopCh := make(chan struct{}) - return &client{ - name: "metrics", - cfg: cfg.Metrics, - generalCfg: cfg, - requestFunc: cfg.RetryConfig.RequestFunc(evaluate), - stopCh: stopCh, - client: httpClient, + u := &url.URL{ + Scheme: "https", + Host: cfg.Metrics.Endpoint, + Path: cfg.Metrics.URLPath, + } + if cfg.Metrics.Insecure { + u.Scheme = "http" + } + // Body is set when this is cloned during upload. + req, err := http.NewRequest(http.MethodPost, u.String(), http.NoBody) + if err != nil { + return nil, err } -} -// Start does nothing in a HTTP client. -func (d *client) Start(ctx context.Context) error { - // nothing to do - select { - case <-ctx.Done(): - return ctx.Err() - default: + if n := len(cfg.Metrics.Headers); n > 0 { + for k, v := range cfg.Metrics.Headers { + req.Header.Set(k, v) + } } - return nil + req.Header.Set("Content-Type", "application/x-protobuf") + + return &client{ + compression: Compression(cfg.Metrics.Compression), + req: req, + requestFunc: cfg.RetryConfig.RequestFunc(evaluate), + httpClient: httpClient, + }, nil } -// Stop shuts down the client and interrupt any in-flight request. -func (d *client) Stop(ctx context.Context) error { - d.stopOnce.Do(func() { - close(d.stopCh) - }) - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - return nil +// ForceFlush does nothing, the client holds no state. +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } + +// Shutdown shuts down the client, freeing all resources. +func (c *client) Shutdown(ctx context.Context) error { + // The otlpmetric.Exporter synchronizes access to client methods and + // ensures this is called only once. The only thing that needs to be done + // here is to release any computational resources the client holds. + + c.requestFunc = nil + c.httpClient = nil + return ctx.Err() } -// UploadMetrics sends a batch of metrics to the collector. -func (d *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { +// UploadMetrics sends protoMetrics to the connected endpoint. +// +// Retryable errors from the server will be handled according to any +// RetryConfig the client was created with. +func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.ResourceMetrics) error { + // The otlpmetric.Exporter synchronizes access to client methods, and + // ensures this is not called after the Exporter is shutdown. Only thing + // to do here is send data. + pbRequest := &colmetricpb.ExportMetricsServiceRequest{ ResourceMetrics: []*metricpb.ResourceMetrics{protoMetrics}, } - rawRequest, err := proto.Marshal(pbRequest) + body, err := proto.Marshal(pbRequest) if err != nil { return err } - - ctx, cancel := d.contextWithStop(ctx) - defer cancel() - - request, err := d.newRequest(rawRequest) + request, err := c.newRequest(ctx, body) if err != nil { return err } - return d.requestFunc(ctx, func(ctx context.Context) error { + return c.requestFunc(ctx, func(iCtx context.Context) error { select { - case <-ctx.Done(): - return ctx.Err() + case <-iCtx.Done(): + return iCtx.Err() default: } - request.reset(ctx) - resp, err := d.client.Do(request.Request) + request.reset(iCtx) + resp, err := c.httpClient.Do(request.Request) if err != nil { return err } @@ -167,7 +182,7 @@ func (d *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou return err } default: - rErr = fmt.Errorf("failed to send %s to %s: %s", d.name, request.URL, resp.Status) + rErr = fmt.Errorf("failed to send metrics to %s: %s", request.URL, resp.Status) } if err := resp.Body.Close(); err != nil { @@ -177,20 +192,18 @@ func (d *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou }) } -func (d *client) newRequest(body []byte) (request, error) { - u := url.URL{Scheme: d.getScheme(), Host: d.cfg.Endpoint, Path: d.cfg.URLPath} - r, err := http.NewRequest(http.MethodPost, u.String(), nil) - if err != nil { - return request{Request: r}, err - } - - for k, v := range d.cfg.Headers { - r.Header.Set(k, v) - } - r.Header.Set("Content-Type", contentTypeProto) +var gzPool = sync.Pool{ + New: func() interface{} { + w := gzip.NewWriter(io.Discard) + return w + }, +} +func (c *client) newRequest(ctx context.Context, body []byte) (request, error) { + r := c.req.Clone(ctx) req := request{Request: r} - switch Compression(d.cfg.Compression) { + + switch c.compression { case NoCompression: r.ContentLength = (int64)(len(body)) req.bodyReader = bodyReader(body) @@ -249,8 +262,8 @@ type retryableError struct { // throttle delay contained in headers. func newResponseError(header http.Header) error { var rErr retryableError - if s, ok := header["Retry-After"]; ok { - if t, err := strconv.ParseInt(s[0], 10, 64); err == nil { + if v := header.Get("Retry-After"); v != "" { + if t, err := strconv.ParseInt(v, 10, 64); err == nil { rErr.throttle = t } } @@ -275,26 +288,3 @@ func evaluate(err error) (bool, time.Duration) { return true, time.Duration(rErr.throttle) } - -func (d *client) getScheme() string { - if d.cfg.Insecure { - return "http" - } - return "https" -} - -func (d *client) contextWithStop(ctx context.Context) (context.Context, context.CancelFunc) { - // Unify the parent context Done signal with the client's stop - // channel. - ctx, cancel := context.WithCancel(ctx) - go func(ctx context.Context, cancel context.CancelFunc) { - select { - case <-ctx.Done(): - // Nothing to do, either cancelled or deadline - // happened. - case <-d.stopCh: - cancel() - } - }(ctx, cancel) - return ctx, cancel -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 5e614da2640..7d6aa912737 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -12,12 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetrichttp_test +//go:build go1.18 +// +build go1.18 + +package otlpmetrichttp import ( "context" + "crypto/tls" + "errors" + "fmt" "net/http" - "os" + "strings" "testing" "time" @@ -25,247 +31,137 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" - "go.opentelemetry.io/otel/sdk/resource" -) - -const ( - relOtherMetricsPath = "post/metrics/here" - otherMetricsPath = "/post/metrics/here" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -var ( - oneRecord = otlpmetrictest.OneRecordReader() - - testResource = resource.Empty() -) - -var ( - testHeaders = map[string]string{ - "Otel-Go-Key-1": "somevalue", - "Otel-Go-Key-2": "someothervalue", - } -) +func TestClient(t *testing.T) { + factory := func() (otlpmetric.Client, otest.Collector) { + coll, err := otest.NewHTTPCollector("", nil) + require.NoError(t, err) -func TestEndToEnd(t *testing.T) { - tests := []struct { - name string - opts []otlpmetrichttp.Option - mcCfg mockCollectorConfig - tls bool - }{ - { - name: "no extra options", - opts: nil, - }, - { - name: "with gzip compression", - opts: []otlpmetrichttp.Option{ - otlpmetrichttp.WithCompression(otlpmetrichttp.GzipCompression), - }, - }, - { - name: "with empty paths (forced to defaults)", - opts: []otlpmetrichttp.Option{ - otlpmetrichttp.WithURLPath(""), - }, - }, - { - name: "with relative paths", - opts: []otlpmetrichttp.Option{ - otlpmetrichttp.WithURLPath(relOtherMetricsPath), - }, - mcCfg: mockCollectorConfig{ - MetricsURLPath: otherMetricsPath, - }, - }, - { - name: "with TLS", - opts: nil, - mcCfg: mockCollectorConfig{ - WithTLS: true, - }, - tls: true, - }, - { - name: "with extra headers", - opts: []otlpmetrichttp.Option{ - otlpmetrichttp.WithHeaders(testHeaders), - }, - mcCfg: mockCollectorConfig{ - ExpectedHeaders: testHeaders, - }, - }, + addr := coll.Addr().String() + client, err := newClient(WithEndpoint(addr), WithInsecure()) + require.NoError(t, err) + return client, coll } - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - mc := runMockCollector(t, tc.mcCfg) - defer mc.MustStop(t) - allOpts := []otlpmetrichttp.Option{ - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - } - if tc.tls { - tlsConfig := mc.ClientTLSConfig() - require.NotNil(t, tlsConfig) - allOpts = append(allOpts, otlpmetrichttp.WithTLSClientConfig(tlsConfig)) - } else { - allOpts = append(allOpts, otlpmetrichttp.WithInsecure()) - } - allOpts = append(allOpts, tc.opts...) - client := otlpmetrichttp.NewClient(allOpts...) - ctx := context.Background() - exporter, err := otlpmetric.New(ctx, client) - if assert.NoError(t, err) { - defer func() { - assert.NoError(t, exporter.Shutdown(ctx)) - }() - otlpmetrictest.RunEndToEndTest(ctx, t, exporter, mc) - } - }) - } + t.Run("Integration", otest.RunClientTests(factory)) } -func TestExporterShutdown(t *testing.T) { - mc := runMockCollector(t, mockCollectorConfig{}) - defer func() { - _ = mc.Stop() - }() +func TestConfig(t *testing.T) { + factoryFunc := func(ePt string, errCh <-chan error, o ...Option) (metric.Exporter, *otest.HTTPCollector) { + coll, err := otest.NewHTTPCollector(ePt, errCh) + require.NoError(t, err) + + opts := []Option{WithEndpoint(coll.Addr().String())} + if !strings.HasPrefix(strings.ToLower(ePt), "https") { + opts = append(opts, WithInsecure()) + } + opts = append(opts, o...) + + ctx := context.Background() + exp, err := New(ctx, opts...) + require.NoError(t, err) + return exp, coll + } - <-time.After(5 * time.Millisecond) + t.Run("WithHeaders", func(t *testing.T) { + key := http.CanonicalHeaderKey("my-custom-header") + headers := map[string]string{key: "custom-value"} + exp, coll := factoryFunc("", nil, WithHeaders(headers)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + // Ensure everything is flushed. + require.NoError(t, exp.Shutdown(ctx)) + + got := coll.Headers() + require.Contains(t, got, key) + assert.Equal(t, got[key], []string{headers[key]}) + }) - otlpmetrictest.RunExporterShutdownTest(t, func() otlpmetric.Client { - return otlpmetrichttp.NewClient( - otlpmetrichttp.WithInsecure(), - otlpmetrichttp.WithEndpoint(mc.endpoint), + t.Run("WithTimeout", func(t *testing.T) { + // Do not send on errCh so the Collector never responds to the client. + errCh := make(chan error) + exp, coll := factoryFunc( + "", + errCh, + WithTimeout(time.Millisecond), + WithRetry(RetryConfig{Enabled: false}), ) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + // Push this after Shutdown so the HTTP server doesn't hang. + t.Cleanup(func() { close(errCh) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + err := exp.Export(ctx, metricdata.ResourceMetrics{}) + assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) }) -} -func TestTimeout(t *testing.T) { - delay := make(chan struct{}) - mcCfg := mockCollectorConfig{Delay: delay} - mc := runMockCollector(t, mcCfg) - defer mc.MustStop(t) - defer func() { close(delay) }() - client := otlpmetrichttp.NewClient( - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - otlpmetrichttp.WithInsecure(), - otlpmetrichttp.WithTimeout(time.Nanosecond), - ) - ctx := context.Background() - exporter, err := otlpmetric.New(ctx, client) - require.NoError(t, err) - defer func() { - assert.NoError(t, exporter.Shutdown(ctx)) - }() - err = exporter.Export(ctx, testResource, oneRecord) - assert.Equalf(t, true, os.IsTimeout(err), "expected timeout error, got: %v", err) -} + t.Run("WithCompressionGZip", func(t *testing.T) { + exp, coll := factoryFunc("", nil, WithCompression(GzipCompression)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) -func TestEmptyData(t *testing.T) { - mcCfg := mockCollectorConfig{} - mc := runMockCollector(t, mcCfg) - defer mc.MustStop(t) - driver := otlpmetrichttp.NewClient( - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - otlpmetrichttp.WithInsecure(), - ) - ctx := context.Background() - exporter, err := otlpmetric.New(ctx, driver) - require.NoError(t, err) - defer func() { - assert.NoError(t, exporter.Shutdown(ctx)) - }() - assert.NoError(t, err) - err = exporter.Export(ctx, testResource, oneRecord) - assert.NoError(t, err) - assert.NotEmpty(t, mc.GetMetrics()) -} + t.Run("WithRetry", func(t *testing.T) { + emptyErr := errors.New("") + errCh := make(chan error, 3) + header := http.Header{http.CanonicalHeaderKey("Retry-After"): {"10"}} + // Both retryable errors. + errCh <- &otest.HTTPResponseError{Status: http.StatusServiceUnavailable, Err: emptyErr, Header: header} + errCh <- &otest.HTTPResponseError{Status: http.StatusTooManyRequests, Err: emptyErr} + errCh <- nil + exp, coll := factoryFunc("", errCh, WithRetry(RetryConfig{ + Enabled: true, + InitialInterval: time.Nanosecond, + MaxInterval: time.Millisecond, + MaxElapsedTime: time.Minute, + })) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + // Push this after Shutdown so the HTTP server doesn't hang. + t.Cleanup(func() { close(errCh) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{}), "failed retry") + assert.Len(t, errCh, 0, "failed HTTP responses did not occur") + }) -func TestCancelledContext(t *testing.T) { - statuses := []int{ - http.StatusBadRequest, - } - mcCfg := mockCollectorConfig{ - InjectHTTPStatus: statuses, - } - mc := runMockCollector(t, mcCfg) - defer mc.MustStop(t) - driver := otlpmetrichttp.NewClient( - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - otlpmetrichttp.WithInsecure(), - ) - ctx, cancel := context.WithCancel(context.Background()) - exporter, err := otlpmetric.New(ctx, driver) - require.NoError(t, err) - defer func() { - assert.NoError(t, exporter.Shutdown(context.Background())) - }() - cancel() - _ = exporter.Export(ctx, testResource, oneRecord) - assert.Empty(t, mc.GetMetrics()) -} + t.Run("WithURLPath", func(t *testing.T) { + path := "/prefix/v2/metrics" + ePt := fmt.Sprintf("http://localhost:0%s", path) + exp, coll := factoryFunc(ePt, nil, WithURLPath(path)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) -func TestDeadlineContext(t *testing.T) { - statuses := make([]int, 0, 5) - for i := 0; i < cap(statuses); i++ { - statuses = append(statuses, http.StatusTooManyRequests) - } - mcCfg := mockCollectorConfig{ - InjectHTTPStatus: statuses, - } - mc := runMockCollector(t, mcCfg) - defer mc.MustStop(t) - driver := otlpmetrichttp.NewClient( - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - otlpmetrichttp.WithInsecure(), - otlpmetrichttp.WithBackoff(time.Minute), - ) - ctx := context.Background() - exporter, err := otlpmetric.New(ctx, driver) - require.NoError(t, err) - defer func() { - assert.NoError(t, exporter.Shutdown(context.Background())) - }() - ctx, cancel := context.WithTimeout(ctx, time.Second) - defer cancel() - err = exporter.Export(ctx, testResource, oneRecord) - assert.Error(t, err) - assert.Empty(t, mc.GetMetrics()) -} + t.Run("WithURLPath", func(t *testing.T) { + path := "/prefix/v2/metrics" + ePt := fmt.Sprintf("http://localhost:0%s", path) + exp, coll := factoryFunc(ePt, nil, WithURLPath(path)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) -func TestStopWhileExporting(t *testing.T) { - statuses := make([]int, 0, 5) - for i := 0; i < cap(statuses); i++ { - statuses = append(statuses, http.StatusTooManyRequests) - } - mcCfg := mockCollectorConfig{ - InjectHTTPStatus: statuses, - } - mc := runMockCollector(t, mcCfg) - defer mc.MustStop(t) - driver := otlpmetrichttp.NewClient( - otlpmetrichttp.WithEndpoint(mc.Endpoint()), - otlpmetrichttp.WithInsecure(), - otlpmetrichttp.WithBackoff(time.Minute), - ) - ctx := context.Background() - exporter, err := otlpmetric.New(ctx, driver) - require.NoError(t, err) - defer func() { - assert.NoError(t, exporter.Shutdown(ctx)) - }() - doneCh := make(chan struct{}) - go func() { - err := exporter.Export(ctx, testResource, oneRecord) - assert.Error(t, err) - assert.Empty(t, mc.GetMetrics()) - close(doneCh) - }() - <-time.After(time.Second) - err = exporter.Shutdown(ctx) - assert.NoError(t, err) - <-doneCh + t.Run("WithTLSClientConfig", func(t *testing.T) { + ePt := "https://localhost:0" + tlsCfg := &tls.Config{InsecureSkipVerify: true} + exp, coll := factoryFunc(ePt, nil, WithTLSClientConfig(tlsCfg)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_unit_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_unit_test.go deleted file mode 100644 index 4ba01c85e5e..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_unit_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrichttp - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestUnreasonableBackoff(t *testing.T) { - cIface := NewClient( - WithEndpoint("http://localhost"), - WithInsecure(), - WithBackoff(-time.Microsecond), - ) - require.IsType(t, &client{}, cIface) - c := cIface.(*client) - assert.True(t, c.generalCfg.RetryConfig.Enabled) - assert.Equal(t, 5*time.Second, c.generalCfg.RetryConfig.InitialInterval) - assert.Equal(t, 300*time.Millisecond, c.generalCfg.RetryConfig.MaxInterval) - assert.Equal(t, time.Minute, c.generalCfg.RetryConfig.MaxElapsedTime) -} - -func TestUnreasonableMaxAttempts(t *testing.T) { - type testcase struct { - name string - maxAttempts int - } - for _, tc := range []testcase{ - { - name: "negative max attempts", - maxAttempts: -3, - }, - { - name: "too large max attempts", - maxAttempts: 10, - }, - } { - t.Run(tc.name, func(t *testing.T) { - cIface := NewClient( - WithEndpoint("http://localhost"), - WithInsecure(), - WithMaxAttempts(tc.maxAttempts), - ) - require.IsType(t, &client{}, cIface) - c := cIface.(*client) - assert.True(t, c.generalCfg.RetryConfig.Enabled) - assert.Equal(t, 5*time.Second, c.generalCfg.RetryConfig.InitialInterval) - assert.Equal(t, 30*time.Second, c.generalCfg.RetryConfig.MaxInterval) - assert.Equal(t, 145*time.Second, c.generalCfg.RetryConfig.MaxElapsedTime) - }) - } -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go new file mode 100644 index 00000000000..6228b1f7fa2 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -0,0 +1,184 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + +import ( + "crypto/tls" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression oconf.Compression + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression = Compression(oconf.NoCompression) + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression = Compression(oconf.GzipCompression) +) + +// Option applies an option to the Exporter. +type Option interface { + applyHTTPOption(oconf.Config) oconf.Config +} + +func asHTTPOptions(opts []Option) []oconf.HTTPOption { + converted := make([]oconf.HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = oconf.NewHTTPOption(o.applyHTTPOption) + } + return converted +} + +// RetryConfig defines configuration for retrying the export of metric data +// that failed. +type RetryConfig retry.Config + +type wrappedOption struct { + oconf.HTTPOption +} + +func (w wrappedOption) applyHTTPOption(cfg oconf.Config) oconf.Config { + return w.ApplyHTTPOption(cfg) +} + +// WithEndpoint sets the target endpoint the Exporter will connect to. This +// endpoint is specified as a host and optional port, no path or scheme should +// be included (see WithInsecure and WithURLPath). +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4318" will be used. +func WithEndpoint(endpoint string) Option { + return wrappedOption{oconf.WithEndpoint(endpoint)} +} + +// WithCompression sets the compression strategy the Exporter will use to +// compress the HTTP body. +// +// If the OTEL_EXPORTER_OTLP_COMPRESSION or +// OTEL_EXPORTER_OTLP_METRICS_COMPRESSION environment variable is set, and +// this option is not passed, that variable value will be used. That value can +// be either "none" or "gzip". If both are set, +// OTEL_EXPORTER_OTLP_METRICS_COMPRESSION will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no compression strategy will be used. +func WithCompression(compression Compression) Option { + return wrappedOption{oconf.WithCompression(oconf.Compression(compression))} +} + +// WithURLPath sets the URL path the Exporter will send requests to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, the path +// contained in that variable value will be used. If both are set, +// OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "/v1/metrics" will be used. +func WithURLPath(urlPath string) Option { + return wrappedOption{oconf.WithURLPath(urlPath)} +} + +// WithTLSClientConfig sets the TLS configuration the Exporter will use for +// HTTP requests. +// +// If the OTEL_EXPORTER_OTLP_CERTIFICATE or +// OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE environment variable is set, and +// this option is not passed, that variable value will be used. The value will +// be parsed the filepath of the TLS certificate chain to use. If both are +// set, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, the system default configuration is used. +func WithTLSClientConfig(tlsCfg *tls.Config) Option { + return wrappedOption{oconf.WithTLSClientConfig(tlsCfg)} +} + +// WithInsecure disables client transport security for the Exporter's HTTP +// connection. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used to determine client security. If the endpoint has a +// scheme of "http" or "unix" client security will be disabled. If both are +// set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, client security will be used. +func WithInsecure() Option { + return wrappedOption{oconf.WithInsecure()} +} + +// WithHeaders will send the provided headers with each HTTP requests. +// +// If the OTEL_EXPORTER_OTLP_HEADERS or OTEL_EXPORTER_OTLP_METRICS_HEADERS +// environment variable is set, and this option is not passed, that variable +// value will be used. The value will be parsed as a list of key value pairs. +// These pairs are expected to be in the W3C Correlation-Context format +// without additional semi-colon delimited metadata (i.e. "k1=v1,k2=v2"). If +// both are set, OTEL_EXPORTER_OTLP_METRICS_HEADERS will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no user headers will be set. +func WithHeaders(headers map[string]string) Option { + return wrappedOption{oconf.WithHeaders(headers)} +} + +// WithTimeout sets the max amount of time an Exporter will attempt an export. +// +// This takes precedence over any retry settings defined by WithRetry. Once +// this time limit has been reached the export is abandoned and the metric +// data is dropped. +// +// If the OTEL_EXPORTER_OTLP_TIMEOUT or OTEL_EXPORTER_OTLP_METRICS_TIMEOUT +// environment variable is set, and this option is not passed, that variable +// value will be used. The value will be parsed as an integer representing the +// timeout in milliseconds. If both are set, +// OTEL_EXPORTER_OTLP_METRICS_TIMEOUT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, a timeout of 10 seconds will be used. +func WithTimeout(duration time.Duration) Option { + return wrappedOption{oconf.WithTimeout(duration)} +} + +// WithRetry sets the retry policy for transient retryable errors that are +// returned by the target endpoint. +// +// If the target endpoint responds with not only a retryable error, but +// explicitly returns a backoff time in the response, that time will take +// precedence over these settings. +// +// If unset, the default retry policy will be used. It will retry the export +// 5 seconds after receiving a retryable error and increase exponentially +// after each error for no more than a total time of 1 minute. +func WithRetry(rc RetryConfig) Option { + return wrappedOption{oconf.WithRetry(retry.Config(rc))} +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go index d096388320d..a49e2465171 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go @@ -12,12 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package otlpmetrichttp provides a client that sends metrics to the collector -using HTTP with binary protobuf payloads. - -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. -*/ +// Package otlpmetrichttp provides an otlpmetric.Exporter that communicates +// with an OTLP receiving endpoint using protobuf encoded metric data over +// HTTP. package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go new file mode 100644 index 00000000000..8cae38d0ef7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go @@ -0,0 +1,45 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package otlpmetrichttp_test + +import ( + "context" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/sdk/metric" +) + +func Example() { + ctx := context.Background() + exp, err := otlpmetrichttp.New(ctx) + if err != nil { + panic(err) + } + + meterProvider := metric.NewMeterProvider(metric.WithReader(metric.NewPeriodicReader(exp))) + defer func() { + if err := meterProvider.Shutdown(ctx); err != nil { + panic(err) + } + }() + global.SetMeterProvider(meterProvider) + + // From here, the meterProvider can be used by instrumentation to collect + // telemetry. +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go deleted file mode 100644 index de09e7cdcaa..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" - -import ( - "context" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -) - -// New constructs a new Exporter and starts it. -func New(ctx context.Context, opts ...Option) (*otlpmetric.Exporter, error) { - return otlpmetric.New(ctx, NewClient(opts...)) -} - -// NewUnstarted constructs a new Exporter and does not start it. -func NewUnstarted(opts ...Option) *otlpmetric.Exporter { - return otlpmetric.NewUnstarted(NewClient(opts...)) -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index fb8da36dc02..463b978feb6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -1,12 +1,13 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/metric v0.31.0 + go.opentelemetry.io/otel/sdk/metric v0.31.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) @@ -17,11 +18,11 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel v1.10.0 // indirect - go.opentelemetry.io/otel/metric v0.31.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.31.0 // indirect + go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 77a03262881..c066ceeecc1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -35,7 +35,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -114,6 +113,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go deleted file mode 100644 index 5776c67a016..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/mock_collector_test.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrichttp_test - -import ( - "bytes" - "compress/gzip" - "context" - "crypto/tls" - "fmt" - "io" - "net" - "net/http" - "sync" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpmetrictest" - collectormetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" - metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -type mockCollector struct { - endpoint string - server *http.Server - - spanLock sync.Mutex - metricsStorage otlpmetrictest.MetricsStorage - - injectHTTPStatus []int - injectContentType string - delay <-chan struct{} - - clientTLSConfig *tls.Config - expectedHeaders map[string]string -} - -func (c *mockCollector) Stop() error { - return c.server.Shutdown(context.Background()) -} - -func (c *mockCollector) MustStop(t *testing.T) { - assert.NoError(t, c.server.Shutdown(context.Background())) -} - -func (c *mockCollector) GetMetrics() []*metricpb.Metric { - c.spanLock.Lock() - defer c.spanLock.Unlock() - return c.metricsStorage.GetMetrics() -} - -func (c *mockCollector) Endpoint() string { - return c.endpoint -} - -func (c *mockCollector) ClientTLSConfig() *tls.Config { - return c.clientTLSConfig -} - -func (c *mockCollector) serveMetrics(w http.ResponseWriter, r *http.Request) { - if c.delay != nil { - select { - case <-c.delay: - case <-r.Context().Done(): - return - } - } - - if !c.checkHeaders(r) { - w.WriteHeader(http.StatusBadRequest) - return - } - response := collectormetricpb.ExportMetricsServiceResponse{} - rawResponse, err := proto.Marshal(&response) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - return - } - if injectedStatus := c.getInjectHTTPStatus(); injectedStatus != 0 { - writeReply(w, rawResponse, injectedStatus, c.injectContentType) - return - } - rawRequest, err := readRequest(r) - if err != nil { - w.WriteHeader(http.StatusInternalServerError) - return - } - - request, err := unmarshalMetricsRequest(rawRequest, r.Header.Get("content-type")) - if err != nil { - w.WriteHeader(http.StatusBadRequest) - return - } - writeReply(w, rawResponse, 0, c.injectContentType) - c.spanLock.Lock() - defer c.spanLock.Unlock() - c.metricsStorage.AddMetrics(request) -} - -func unmarshalMetricsRequest(rawRequest []byte, contentType string) (*collectormetricpb.ExportMetricsServiceRequest, error) { - request := &collectormetricpb.ExportMetricsServiceRequest{} - if contentType != "application/x-protobuf" { - return request, fmt.Errorf("invalid content-type: %s, only application/x-protobuf is supported", contentType) - } - err := proto.Unmarshal(rawRequest, request) - return request, err -} - -func (c *mockCollector) checkHeaders(r *http.Request) bool { - for k, v := range c.expectedHeaders { - got := r.Header.Get(k) - if got != v { - return false - } - } - return true -} - -func (c *mockCollector) getInjectHTTPStatus() int { - if len(c.injectHTTPStatus) == 0 { - return 0 - } - status := c.injectHTTPStatus[0] - c.injectHTTPStatus = c.injectHTTPStatus[1:] - if len(c.injectHTTPStatus) == 0 { - c.injectHTTPStatus = nil - } - return status -} - -func readRequest(r *http.Request) ([]byte, error) { - if r.Header.Get("Content-Encoding") == "gzip" { - return readGzipBody(r.Body) - } - return io.ReadAll(r.Body) -} - -func readGzipBody(body io.Reader) ([]byte, error) { - rawRequest := bytes.Buffer{} - gunzipper, err := gzip.NewReader(body) - if err != nil { - return nil, err - } - defer gunzipper.Close() - _, err = io.Copy(&rawRequest, gunzipper) - if err != nil { - return nil, err - } - return rawRequest.Bytes(), nil -} - -func writeReply(w http.ResponseWriter, rawResponse []byte, injectHTTPStatus int, injectContentType string) { - status := http.StatusOK - if injectHTTPStatus != 0 { - status = injectHTTPStatus - } - contentType := "application/x-protobuf" - if injectContentType != "" { - contentType = injectContentType - } - w.Header().Set("Content-Type", contentType) - w.WriteHeader(status) - _, _ = w.Write(rawResponse) -} - -type mockCollectorConfig struct { - MetricsURLPath string - Port int - InjectHTTPStatus []int - InjectContentType string - Delay <-chan struct{} - WithTLS bool - ExpectedHeaders map[string]string -} - -func (c *mockCollectorConfig) fillInDefaults() { - if c.MetricsURLPath == "" { - c.MetricsURLPath = otlpconfig.DefaultMetricsPath - } -} - -func runMockCollector(t *testing.T, cfg mockCollectorConfig) *mockCollector { - cfg.fillInDefaults() - ln, err := net.Listen("tcp", fmt.Sprintf("localhost:%d", cfg.Port)) - require.NoError(t, err) - _, portStr, err := net.SplitHostPort(ln.Addr().String()) - require.NoError(t, err) - m := &mockCollector{ - endpoint: fmt.Sprintf("localhost:%s", portStr), - metricsStorage: otlpmetrictest.NewMetricsStorage(), - injectHTTPStatus: cfg.InjectHTTPStatus, - injectContentType: cfg.InjectContentType, - delay: cfg.Delay, - expectedHeaders: cfg.ExpectedHeaders, - } - mux := http.NewServeMux() - mux.Handle(cfg.MetricsURLPath, http.HandlerFunc(m.serveMetrics)) - server := &http.Server{ - Handler: mux, - } - if cfg.WithTLS { - pem, err := generateWeakCertificate() - require.NoError(t, err) - tlsCertificate, err := tls.X509KeyPair(pem.Certificate, pem.PrivateKey) - require.NoError(t, err) - server.TLSConfig = &tls.Config{ - Certificates: []tls.Certificate{tlsCertificate}, - } - - m.clientTLSConfig = &tls.Config{ - InsecureSkipVerify: true, - } - } - go func() { - if cfg.WithTLS { - _ = server.ServeTLS(ln, "", "") - } else { - _ = server.Serve(ln) - } - }() - m.server = server - return m -} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/options.go deleted file mode 100644 index 8d12c791954..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/options.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" - -import ( - "crypto/tls" - "time" - - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otlpconfig" -) - -// Compression describes the compression used for payloads sent to the -// collector. -type Compression otlpconfig.Compression - -const ( - // NoCompression tells the driver to send payloads without - // compression. - NoCompression = Compression(otlpconfig.NoCompression) - // GzipCompression tells the driver to send payloads after - // compressing them with gzip. - GzipCompression = Compression(otlpconfig.GzipCompression) -) - -// Option applies an option to the HTTP client. -type Option interface { - applyHTTPOption(otlpconfig.Config) otlpconfig.Config -} - -func asHTTPOptions(opts []Option) []otlpconfig.HTTPOption { - converted := make([]otlpconfig.HTTPOption, len(opts)) - for i, o := range opts { - converted[i] = otlpconfig.NewHTTPOption(o.applyHTTPOption) - } - return converted -} - -// RetryConfig defines configuration for retrying batches in case of export -// failure using an exponential backoff. -type RetryConfig retry.Config - -type wrappedOption struct { - otlpconfig.HTTPOption -} - -func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config { - return w.ApplyHTTPOption(cfg) -} - -// WithEndpoint allows one to set the address of the collector endpoint that -// the driver will use to send metrics. If unset, it will instead try to use -// the default endpoint (localhost:4318). Note that the endpoint must not -// contain any URL path. -func WithEndpoint(endpoint string) Option { - return wrappedOption{otlpconfig.WithEndpoint(endpoint)} -} - -// WithCompression tells the driver to compress the sent data. -func WithCompression(compression Compression) Option { - return wrappedOption{otlpconfig.WithCompression(otlpconfig.Compression(compression))} -} - -// WithURLPath allows one to override the default URL path used -// for sending metrics. If unset, default ("/v1/metrics") will be used. -func WithURLPath(urlPath string) Option { - return wrappedOption{otlpconfig.WithURLPath(urlPath)} -} - -// WithMaxAttempts allows one to override how many times the driver -// will try to send the payload in case of retryable errors. -// The max attempts is limited to at most 5 retries. If unset, -// default (5) will be used. -// -// Deprecated: Use WithRetry instead. -func WithMaxAttempts(maxAttempts int) Option { - if maxAttempts > 5 || maxAttempts < 0 { - maxAttempts = 5 - } - return wrappedOption{ - otlpconfig.NewHTTPOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.RetryConfig.Enabled = true - - var ( - init = cfg.RetryConfig.InitialInterval - maxI = cfg.RetryConfig.MaxInterval - maxE = cfg.RetryConfig.MaxElapsedTime - ) - - if init == 0 { - init = retry.DefaultConfig.InitialInterval - } - if maxI == 0 { - maxI = retry.DefaultConfig.MaxInterval - } - if maxE == 0 { - maxE = retry.DefaultConfig.MaxElapsedTime - } - attempts := int64(maxE+init) / int64(maxI) - - if int64(maxAttempts) == attempts { - return cfg - } - - maxE = time.Duration(int64(maxAttempts)*int64(maxI)) - init - - cfg.RetryConfig.InitialInterval = init - cfg.RetryConfig.MaxInterval = maxI - cfg.RetryConfig.MaxElapsedTime = maxE - - return cfg - }), - } -} - -// WithBackoff tells the driver to use the duration as a base of the -// exponential backoff strategy. If unset, default (300ms) will be -// used. -// -// Deprecated: Use WithRetry instead. -func WithBackoff(duration time.Duration) Option { - if duration < 0 { - duration = 300 * time.Millisecond - } - return wrappedOption{ - otlpconfig.NewHTTPOption(func(cfg otlpconfig.Config) otlpconfig.Config { - cfg.RetryConfig.Enabled = true - cfg.RetryConfig.MaxInterval = duration - if cfg.RetryConfig.InitialInterval == 0 { - cfg.RetryConfig.InitialInterval = retry.DefaultConfig.InitialInterval - } - if cfg.RetryConfig.MaxElapsedTime == 0 { - cfg.RetryConfig.MaxElapsedTime = retry.DefaultConfig.MaxElapsedTime - } - return cfg - }), - } -} - -// WithTLSClientConfig can be used to set up a custom TLS -// configuration for the client used to send payloads to the -// collector. Use it if you want to use a custom certificate. -func WithTLSClientConfig(tlsCfg *tls.Config) Option { - return wrappedOption{otlpconfig.WithTLSClientConfig(tlsCfg)} -} - -// WithInsecure tells the driver to connect to the collector using the -// HTTP scheme, instead of HTTPS. -func WithInsecure() Option { - return wrappedOption{otlpconfig.WithInsecure()} -} - -// WithHeaders allows one to tell the driver to send additional HTTP -// headers with the payloads. Specifying headers like Content-Length, -// Content-Encoding and Content-Type may result in a broken driver. -func WithHeaders(headers map[string]string) Option { - return wrappedOption{otlpconfig.WithHeaders(headers)} -} - -// WithTimeout tells the driver the max waiting time for the backend to process -// each metrics batch. If unset, the default will be 10 seconds. -func WithTimeout(duration time.Duration) Option { - return wrappedOption{otlpconfig.WithTimeout(duration)} -} - -// WithRetry configures the retry policy for transient errors that may occurs -// when exporting traces. An exponential back-off algorithm is used to ensure -// endpoints are not overwhelmed with retries. If unset, the default retry -// policy will retry after 5 seconds and increase exponentially after each -// error for a total of 1 minute. -func WithRetry(rc RetryConfig) Option { - return wrappedOption{otlpconfig.WithRetry(retry.Config(rc))} -} diff --git a/exporters/prometheus/README.md b/exporters/prometheus/README.md deleted file mode 100644 index ccded2f2829..00000000000 --- a/exporters/prometheus/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# OpenTelemetry-Go Prometheus Exporter - -OpenTelemetry Prometheus exporter - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/prometheus -``` diff --git a/sdk/metric/number/doc.go b/exporters/prometheus/doc.go similarity index 59% rename from sdk/metric/number/doc.go rename to exporters/prometheus/doc.go index 6f947400a4b..f212c6146cf 100644 --- a/sdk/metric/number/doc.go +++ b/exporters/prometheus/doc.go @@ -12,12 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package number provides a number abstraction for instruments that -either support int64 or float64 input values. - -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. -*/ -package number // import "go.opentelemetry.io/otel/sdk/metric/number" +// Package prometheus provides a Prometheus Exporter that converts +// OTLP metrics into the Prometheus exposition format and implements +// prometheus.Collector to provide a handler for these metrics. +package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go new file mode 100644 index 00000000000..8527b1b5025 --- /dev/null +++ b/exporters/prometheus/exporter.go @@ -0,0 +1,233 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" + +import ( + "context" + "sort" + "strings" + "unicode" + + "github.com/prometheus/client_golang/prometheus" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Exporter is a Prometheus Exporter that embeds the OTel metric.Reader +// interface for easy instantiation with a MeterProvider. +type Exporter struct { + metric.Reader + Collector prometheus.Collector +} + +// collector is used to implement prometheus.Collector. +type collector struct { + metric.Reader +} + +// config is added here to allow for options expansion in the future. +type config struct{} + +// Option may be used in the future to apply options to a Prometheus Exporter config. +type Option interface { + apply(config) config +} + +// New returns a Prometheus Exporter. +func New(_ ...Option) Exporter { + // this assumes that the default temporality selector will always return cumulative. + // we only support cumulative temporality, so building our own reader enforces this. + reader := metric.NewManualReader() + e := Exporter{ + Reader: reader, + Collector: &collector{ + Reader: reader, + }, + } + return e +} + +// Describe implements prometheus.Collector. +func (c *collector) Describe(ch chan<- *prometheus.Desc) { + metrics, err := c.Reader.Collect(context.TODO()) + if err != nil { + otel.Handle(err) + } + for _, metricData := range getMetricData(metrics) { + ch <- metricData.description + } +} + +// Collect implements prometheus.Collector. +func (c *collector) Collect(ch chan<- prometheus.Metric) { + metrics, err := c.Reader.Collect(context.TODO()) + if err != nil { + otel.Handle(err) + } + + // TODO(#3166): convert otel resource to target_info + // see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#resource-attributes-1 + for _, metricData := range getMetricData(metrics) { + if metricData.valueType == prometheus.UntypedValue { + m, err := prometheus.NewConstHistogram(metricData.description, metricData.histogramCount, metricData.histogramSum, metricData.histogramBuckets, metricData.attributeValues...) + if err != nil { + otel.Handle(err) + } + ch <- m + } else { + m, err := prometheus.NewConstMetric(metricData.description, metricData.valueType, metricData.value, metricData.attributeValues...) + if err != nil { + otel.Handle(err) + } + ch <- m + } + } +} + +// metricData holds the metadata as well as values for individual data points. +type metricData struct { + // name should include the unit as a suffix (before _total on counters) + // see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#metric-metadata-1 + name string + description *prometheus.Desc + attributeValues []string + valueType prometheus.ValueType + value float64 + histogramCount uint64 + histogramSum float64 + histogramBuckets map[float64]uint64 +} + +func getMetricData(metrics metricdata.ResourceMetrics) []*metricData { + allMetrics := make([]*metricData, 0) + for _, scopeMetrics := range metrics.ScopeMetrics { + for _, m := range scopeMetrics.Metrics { + switch v := m.Data.(type) { + case metricdata.Histogram: + allMetrics = append(allMetrics, getHistogramMetricData(v, m)...) + case metricdata.Sum[int64]: + allMetrics = append(allMetrics, getSumMetricData(v, m)...) + case metricdata.Sum[float64]: + allMetrics = append(allMetrics, getSumMetricData(v, m)...) + case metricdata.Gauge[int64]: + allMetrics = append(allMetrics, getGaugeMetricData(v, m)...) + case metricdata.Gauge[float64]: + allMetrics = append(allMetrics, getGaugeMetricData(v, m)...) + } + } + } + + return allMetrics +} + +func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics) []*metricData { + // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars + dataPoints := make([]*metricData, 0, len(histogram.DataPoints)) + for _, dp := range histogram.DataPoints { + keys, values := getAttrs(dp.Attributes) + desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + buckets := make(map[float64]uint64, len(dp.Bounds)) + for i, bound := range dp.Bounds { + buckets[bound] = dp.BucketCounts[i] + } + md := &metricData{ + name: m.Name, + description: desc, + attributeValues: values, + valueType: prometheus.UntypedValue, + histogramCount: dp.Count, + histogramSum: dp.Sum, + histogramBuckets: buckets, + } + dataPoints = append(dataPoints, md) + } + return dataPoints +} + +func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Metrics) []*metricData { + dataPoints := make([]*metricData, 0, len(sum.DataPoints)) + for _, dp := range sum.DataPoints { + keys, values := getAttrs(dp.Attributes) + desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + md := &metricData{ + name: m.Name, + description: desc, + attributeValues: values, + valueType: prometheus.CounterValue, + value: float64(dp.Value), + } + dataPoints = append(dataPoints, md) + } + return dataPoints +} + +func getGaugeMetricData[N int64 | float64](gauge metricdata.Gauge[N], m metricdata.Metrics) []*metricData { + dataPoints := make([]*metricData, 0, len(gauge.DataPoints)) + for _, dp := range gauge.DataPoints { + keys, values := getAttrs(dp.Attributes) + desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + md := &metricData{ + name: m.Name, + description: desc, + attributeValues: values, + valueType: prometheus.GaugeValue, + value: float64(dp.Value), + } + dataPoints = append(dataPoints, md) + } + return dataPoints +} + +// getAttrs parses the attribute.Set to two lists of matching Prometheus-style +// keys and values. It sanitizes invalid characters and handles duplicate keys +// (due to sanitization) by sorting and concatenating the values following the spec. +func getAttrs(attrs attribute.Set) ([]string, []string) { + keysMap := make(map[string][]string) + itr := attrs.Iter() + for itr.Next() { + kv := itr.Attribute() + key := strings.Map(sanitizeRune, string(kv.Key)) + if _, ok := keysMap[key]; !ok { + keysMap[key] = []string{kv.Value.AsString()} + } else { + // if the sanitized key is a duplicate, append to the list of keys + keysMap[key] = append(keysMap[key], kv.Value.AsString()) + } + } + + keys := make([]string, 0, attrs.Len()) + values := make([]string, 0, attrs.Len()) + for key, vals := range keysMap { + keys = append(keys, key) + sort.Slice(vals, func(i, j int) bool { + return i < j + }) + values = append(values, strings.Join(vals, ";")) + } + return keys, values +} + +func sanitizeRune(r rune) rune { + if unicode.IsLetter(r) || unicode.IsDigit(r) || r == ':' || r == '_' { + return r + } + return '_' +} diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go new file mode 100644 index 00000000000..aaf029e2021 --- /dev/null +++ b/exporters/prometheus/exporter_test.go @@ -0,0 +1,130 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package prometheus + +import ( + "context" + "os" + "testing" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/testutil" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + otelmetric "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric" +) + +func TestPrometheusExporter(t *testing.T) { + testCases := []struct { + name string + recordMetrics func(ctx context.Context, meter otelmetric.Meter) + expectedFile string + }{ + { + name: "counter", + expectedFile: "testdata/counter.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, + { + name: "gauge", + expectedFile: "testdata/gauge.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + require.NoError(t, err) + gauge.Add(ctx, 100, attrs...) + gauge.Add(ctx, -25, attrs...) + }, + }, + { + name: "histogram", + expectedFile: "testdata/histogram.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + histogram, err := meter.SyncFloat64().Histogram("baz", instrument.WithDescription("a very nice histogram")) + require.NoError(t, err) + histogram.Record(ctx, 23, attrs...) + histogram.Record(ctx, 7, attrs...) + histogram.Record(ctx, 101, attrs...) + histogram.Record(ctx, 105, attrs...) + }, + }, + { + name: "sanitized attributes to labels", + expectedFile: "testdata/sanitized_labels.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + // exact match, value should be overwritten + attribute.Key("A.B").String("X"), + attribute.Key("A.B").String("Q"), + + // unintended match due to sanitization, values should be concatenated + attribute.Key("C.D").String("Y"), + attribute.Key("C/D").String("Z"), + } + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a sanitary counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() + + exporter := New() + provider := metric.NewMeterProvider(metric.WithReader(exporter)) + meter := provider.Meter("testmeter") + + registry := prometheus.NewRegistry() + err := registry.Register(exporter.Collector) + require.NoError(t, err) + + tc.recordMetrics(ctx, meter) + + file, err := os.Open(tc.expectedFile) + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, file.Close()) }) + + err = testutil.GatherAndCompare(registry, file) + require.NoError(t, err) + }) + } +} diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 6575457676a..c06f9ff10a5 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -1,13 +1,12 @@ module go.opentelemetry.io/otel/exporters/prometheus -go 1.17 +go 1.18 require ( - github.com/prometheus/client_golang v1.12.2 + github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.31.0 ) @@ -21,20 +20,21 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.32.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect + go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect - google.golang.org/protobuf v1.26.0 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) replace go.opentelemetry.io/otel => ../.. -replace go.opentelemetry.io/otel/metric => ../../metric - replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index b2cbcef3b03..51544d68f4f 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -38,7 +38,6 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -65,9 +64,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -167,8 +168,9 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -177,14 +179,16 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -269,12 +273,15 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -319,15 +326,20 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -449,8 +461,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/prometheus/prometheus.go b/exporters/prometheus/prometheus.go deleted file mode 100644 index fb544d004fb..00000000000 --- a/exporters/prometheus/prometheus.go +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" - -// Note that this package does not support a way to export Prometheus -// Summary data points, removed in PR#1412. - -import ( - "context" - "fmt" - "net/http" - "sync" - - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -// Exporter supports Prometheus pulls. It does not implement the -// sdk/export/metric.Exporter interface--instead it creates a pull -// controller and reads the latest checkpointed data on-scrape. -type Exporter struct { - handler http.Handler - - registerer prometheus.Registerer - gatherer prometheus.Gatherer - - // lock protects access to the controller. The controller - // exposes its own lock, but using a dedicated lock in this - // struct allows the exporter to potentially support multiple - // controllers (e.g., with different resources). - lock sync.RWMutex - controller *controller.Controller -} - -// ErrUnsupportedAggregator is returned for unrepresentable aggregator -// types. -var ErrUnsupportedAggregator = fmt.Errorf("unsupported aggregator type") - -var _ http.Handler = &Exporter{} - -// Config is a set of configs for the tally reporter. -type Config struct { - // Registry is the prometheus registry that will be used as the default Registerer and - // Gatherer if these are not specified. - // - // If not set a new empty Registry is created. - Registry *prometheus.Registry - - // Registerer is the prometheus registerer to register - // metrics with. - // - // If not specified the Registry will be used as default. - Registerer prometheus.Registerer - - // Gatherer is the prometheus gatherer to gather - // metrics with. - // - // If not specified the Registry will be used as default. - Gatherer prometheus.Gatherer - - // DefaultHistogramBoundaries defines the default histogram bucket - // boundaries. - DefaultHistogramBoundaries []float64 -} - -// New returns a new Prometheus exporter using the configured metric -// controller. See controller.New(). -func New(config Config, ctrl *controller.Controller) (*Exporter, error) { - if config.Registry == nil { - config.Registry = prometheus.NewRegistry() - } - - if config.Registerer == nil { - config.Registerer = config.Registry - } - - if config.Gatherer == nil { - config.Gatherer = config.Registry - } - - e := &Exporter{ - handler: promhttp.HandlerFor(config.Gatherer, promhttp.HandlerOpts{}), - registerer: config.Registerer, - gatherer: config.Gatherer, - controller: ctrl, - } - - c := &collector{ - exp: e, - } - if err := config.Registerer.Register(c); err != nil { - return nil, fmt.Errorf("cannot register the collector: %w", err) - } - return e, nil -} - -// MeterProvider returns the MeterProvider of this exporter. -func (e *Exporter) MeterProvider() metric.MeterProvider { - return e.controller -} - -// Controller returns the controller object that coordinates collection for the SDK. -func (e *Exporter) Controller() *controller.Controller { - e.lock.RLock() - defer e.lock.RUnlock() - return e.controller -} - -// TemporalityFor implements TemporalitySelector. -func (e *Exporter) TemporalityFor(desc *sdkapi.Descriptor, kind aggregation.Kind) aggregation.Temporality { - return aggregation.CumulativeTemporalitySelector().TemporalityFor(desc, kind) -} - -// ServeHTTP implements http.Handler. -func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request) { - e.handler.ServeHTTP(w, r) -} - -// collector implements prometheus.Collector interface. -type collector struct { - exp *Exporter -} - -var _ prometheus.Collector = (*collector)(nil) - -// Describe implements prometheus.Collector. -func (c *collector) Describe(ch chan<- *prometheus.Desc) { - c.exp.lock.RLock() - defer c.exp.lock.RUnlock() - - _ = c.exp.Controller().ForEach(func(_ instrumentation.Library, reader export.Reader) error { - return reader.ForEach(c.exp, func(record export.Record) error { - var attrKeys []string - mergeAttrs(record, c.exp.controller.Resource(), &attrKeys, nil) - ch <- c.toDesc(record, attrKeys) - return nil - }) - }) -} - -// Collect exports the last calculated Reader state. -// -// Collect is invoked whenever prometheus.Gatherer is also invoked. -// For example, when the HTTP endpoint is invoked by Prometheus. -func (c *collector) Collect(ch chan<- prometheus.Metric) { - c.exp.lock.RLock() - defer c.exp.lock.RUnlock() - - ctrl := c.exp.Controller() - if err := ctrl.Collect(context.Background()); err != nil { - otel.Handle(err) - } - - err := ctrl.ForEach(func(_ instrumentation.Library, reader export.Reader) error { - return reader.ForEach(c.exp, func(record export.Record) error { - agg := record.Aggregation() - numberKind := record.Descriptor().NumberKind() - instrumentKind := record.Descriptor().InstrumentKind() - - var attrKeys, attrs []string - mergeAttrs(record, c.exp.controller.Resource(), &attrKeys, &attrs) - - desc := c.toDesc(record, attrKeys) - - switch v := agg.(type) { - case aggregation.Histogram: - if err := c.exportHistogram(ch, v, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting histogram: %w", err) - } - case aggregation.Sum: - if instrumentKind.Monotonic() { - if err := c.exportMonotonicCounter(ch, v, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting monotonic counter: %w", err) - } - } else { - if err := c.exportNonMonotonicCounter(ch, v, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting non monotonic counter: %w", err) - } - } - case aggregation.LastValue: - if err := c.exportLastValue(ch, v, numberKind, desc, attrs); err != nil { - return fmt.Errorf("exporting last value: %w", err) - } - default: - return fmt.Errorf("%w: %s", ErrUnsupportedAggregator, agg.Kind()) - } - return nil - }) - }) - if err != nil { - otel.Handle(err) - } -} - -func (c *collector) exportLastValue(ch chan<- prometheus.Metric, lvagg aggregation.LastValue, kind number.Kind, desc *prometheus.Desc, attrs []string) error { - lv, _, err := lvagg.LastValue() - if err != nil { - return fmt.Errorf("error retrieving last value: %w", err) - } - - m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, lv.CoerceToFloat64(kind), attrs...) - if err != nil { - return fmt.Errorf("error creating constant metric: %w", err) - } - - ch <- m - return nil -} - -func (c *collector) exportNonMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, attrs []string) error { - v, err := sum.Sum() - if err != nil { - return fmt.Errorf("error retrieving counter: %w", err) - } - - m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, v.CoerceToFloat64(kind), attrs...) - if err != nil { - return fmt.Errorf("error creating constant metric: %w", err) - } - - ch <- m - return nil -} - -func (c *collector) exportMonotonicCounter(ch chan<- prometheus.Metric, sum aggregation.Sum, kind number.Kind, desc *prometheus.Desc, attrs []string) error { - v, err := sum.Sum() - if err != nil { - return fmt.Errorf("error retrieving counter: %w", err) - } - - m, err := prometheus.NewConstMetric(desc, prometheus.CounterValue, v.CoerceToFloat64(kind), attrs...) - if err != nil { - return fmt.Errorf("error creating constant metric: %w", err) - } - - ch <- m - return nil -} - -func (c *collector) exportHistogram(ch chan<- prometheus.Metric, hist aggregation.Histogram, kind number.Kind, desc *prometheus.Desc, attrs []string) error { - buckets, err := hist.Histogram() - if err != nil { - return fmt.Errorf("error retrieving histogram: %w", err) - } - sum, err := hist.Sum() - if err != nil { - return fmt.Errorf("error retrieving sum: %w", err) - } - - var totalCount uint64 - // counts maps from the bucket upper-bound to the cumulative count. - // The bucket with upper-bound +inf is not included. - counts := make(map[float64]uint64, len(buckets.Boundaries)) - for i := range buckets.Boundaries { - boundary := buckets.Boundaries[i] - totalCount += uint64(buckets.Counts[i]) - counts[boundary] = totalCount - } - // Include the +inf bucket in the total count. - totalCount += uint64(buckets.Counts[len(buckets.Counts)-1]) - - m, err := prometheus.NewConstHistogram(desc, totalCount, sum.CoerceToFloat64(kind), counts, attrs...) - if err != nil { - return fmt.Errorf("error creating constant histogram: %w", err) - } - - ch <- m - return nil -} - -func (c *collector) toDesc(record export.Record, attrKeys []string) *prometheus.Desc { - desc := record.Descriptor() - return prometheus.NewDesc(sanitize(desc.Name()), desc.Description(), attrKeys, nil) -} - -// mergeAttrs merges the export.Record's attributes and resources into a -// single set, giving precedence to the record's attributes in case of -// duplicate keys. This outputs one or both of the keys and the values as a -// slice, and either argument may be nil to avoid allocating an unnecessary -// slice. -func mergeAttrs(record export.Record, res *resource.Resource, keys, values *[]string) { - if keys != nil { - *keys = make([]string, 0, record.Attributes().Len()+res.Len()) - } - if values != nil { - *values = make([]string, 0, record.Attributes().Len()+res.Len()) - } - - // Duplicate keys are resolved by taking the record attribute value over - // the resource value. - mi := attribute.NewMergeIterator(record.Attributes(), res.Set()) - for mi.Next() { - attr := mi.Attribute() - if keys != nil { - *keys = append(*keys, sanitize(string(attr.Key))) - } - if values != nil { - *values = append(*values, attr.Value.Emit()) - } - } -} diff --git a/exporters/prometheus/prometheus_test.go b/exporters/prometheus/prometheus_test.go deleted file mode 100644 index 749965ba575..00000000000 --- a/exporters/prometheus/prometheus_test.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package prometheus_test - -import ( - "context" - "fmt" - "net/http/httptest" - "sort" - "strings" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" - "go.opentelemetry.io/otel/sdk/resource" -) - -type expectedMetric struct { - kind string - name string - help string - values []string -} - -func (e *expectedMetric) lines() []string { - ret := []string{ - fmt.Sprintf("# HELP %s %s", e.name, e.help), - fmt.Sprintf("# TYPE %s %s", e.name, e.kind), - } - - ret = append(ret, e.values...) - - return ret -} - -func expectCounterWithHelp(name, help, value string) expectedMetric { - return expectedMetric{ - kind: "counter", - name: name, - help: help, - values: []string{value}, - } -} - -func expectCounter(name, value string) expectedMetric { - return expectCounterWithHelp(name, "", value) -} - -func expectGauge(name, value string) expectedMetric { - return expectedMetric{ - kind: "gauge", - name: name, - values: []string{value}, - } -} - -func expectHistogram(name string, values ...string) expectedMetric { - return expectedMetric{ - kind: "histogram", - name: name, - values: values, - } -} - -func newPipeline(config prometheus.Config, options ...controller.Option) (*prometheus.Exporter, error) { - c := controller.New( - processor.NewFactory( - selector.NewWithHistogramDistribution( - histogram.WithExplicitBoundaries(config.DefaultHistogramBoundaries), - ), - aggregation.CumulativeTemporalitySelector(), - processor.WithMemory(true), - ), - options..., - ) - return prometheus.New(config, c) -} - -func TestPrometheusExporter(t *testing.T) { - exporter, err := newPipeline( - prometheus.Config{ - DefaultHistogramBoundaries: []float64{-0.5, 1}, - }, - controller.WithCollectPeriod(0), - controller.WithResource(resource.NewSchemaless(attribute.String("R", "V"))), - ) - require.NoError(t, err) - - meter := exporter.MeterProvider().Meter("test") - upDownCounter, err := meter.SyncFloat64().UpDownCounter("updowncounter") - require.NoError(t, err) - counter, err := meter.SyncFloat64().Counter("counter") - require.NoError(t, err) - hist, err := meter.SyncFloat64().Histogram("histogram") - require.NoError(t, err) - - attrs := []attribute.KeyValue{ - attribute.Key("A").String("B"), - attribute.Key("C").String("D"), - } - ctx := context.Background() - - var expected []expectedMetric - - counter.Add(ctx, 10, attrs...) - counter.Add(ctx, 5.3, attrs...) - - expected = append(expected, expectCounter("counter", `counter{A="B",C="D",R="V"} 15.3`)) - - gaugeObserver, err := meter.AsyncInt64().Gauge("intgaugeobserver") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{gaugeObserver}, func(ctx context.Context) { - gaugeObserver.Observe(ctx, 1, attrs...) - }) - require.NoError(t, err) - - expected = append(expected, expectGauge("intgaugeobserver", `intgaugeobserver{A="B",C="D",R="V"} 1`)) - - hist.Record(ctx, -0.6, attrs...) - hist.Record(ctx, -0.4, attrs...) - hist.Record(ctx, 0.6, attrs...) - hist.Record(ctx, 20, attrs...) - - expected = append(expected, expectHistogram("histogram", - `histogram_bucket{A="B",C="D",R="V",le="-0.5"} 1`, - `histogram_bucket{A="B",C="D",R="V",le="1"} 3`, - `histogram_bucket{A="B",C="D",R="V",le="+Inf"} 4`, - `histogram_sum{A="B",C="D",R="V"} 19.6`, - `histogram_count{A="B",C="D",R="V"} 4`, - )) - - upDownCounter.Add(ctx, 10, attrs...) - upDownCounter.Add(ctx, -3.2, attrs...) - - expected = append(expected, expectGauge("updowncounter", `updowncounter{A="B",C="D",R="V"} 6.8`)) - - counterObserver, err := meter.AsyncFloat64().Counter("floatcounterobserver") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - counterObserver.Observe(ctx, 7.7, attrs...) - }) - require.NoError(t, err) - - expected = append(expected, expectCounter("floatcounterobserver", `floatcounterobserver{A="B",C="D",R="V"} 7.7`)) - - upDownCounterObserver, err := meter.AsyncFloat64().UpDownCounter("floatupdowncounterobserver") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{upDownCounterObserver}, func(ctx context.Context) { - upDownCounterObserver.Observe(ctx, -7.7, attrs...) - }) - require.NoError(t, err) - - expected = append(expected, expectGauge("floatupdowncounterobserver", `floatupdowncounterobserver{A="B",C="D",R="V"} -7.7`)) - - compareExport(t, exporter, expected) - compareExport(t, exporter, expected) -} - -func compareExport(t *testing.T, exporter *prometheus.Exporter, expected []expectedMetric) { - rec := httptest.NewRecorder() - req := httptest.NewRequest("GET", "/metrics", nil) - exporter.ServeHTTP(rec, req) - - output := rec.Body.String() - lines := strings.Split(output, "\n") - - expectedLines := []string{""} - for _, v := range expected { - expectedLines = append(expectedLines, v.lines()...) - } - - sort.Strings(lines) - sort.Strings(expectedLines) - - require.Equal(t, expectedLines, lines) -} - -func TestPrometheusStatefulness(t *testing.T) { - // Create a meter - exporter, err := newPipeline( - prometheus.Config{}, - controller.WithCollectPeriod(0), - controller.WithResource(resource.Empty()), - ) - require.NoError(t, err) - - meter := exporter.MeterProvider().Meter("test") - - ctx := context.Background() - - counter, err := meter.SyncInt64().Counter("a.counter", instrument.WithDescription("Counts things")) - require.NoError(t, err) - - counter.Add(ctx, 100, attribute.String("key", "value")) - - compareExport(t, exporter, []expectedMetric{ - expectCounterWithHelp("a_counter", "Counts things", `a_counter{key="value"} 100`), - }) - - counter.Add(ctx, 100, attribute.String("key", "value")) - - compareExport(t, exporter, []expectedMetric{ - expectCounterWithHelp("a_counter", "Counts things", `a_counter{key="value"} 200`), - }) -} diff --git a/exporters/prometheus/sanitize.go b/exporters/prometheus/sanitize.go deleted file mode 100644 index b5588435359..00000000000 --- a/exporters/prometheus/sanitize.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" - -import ( - "strings" - "unicode" -) - -// TODO(paivagustavo): we should provide a more uniform and controlled way of sanitizing. -// Letting users define wether we should try or not to sanitize metric names. -// This is a copy of sdk/internal/sanitize.go - -// sanitize returns a string that is truncated to 100 characters if it's too -// long, and replaces non-alphanumeric characters to underscores. -func sanitize(s string) string { - if len(s) == 0 { - return s - } - // TODO(paivagustavo): change this to use a bytes buffer to avoid a large number of string allocations. - s = strings.Map(sanitizeRune, s) - if unicode.IsDigit(rune(s[0])) { - s = "key_" + s - } - if s[0] == '_' { - s = "key" + s - } - return s -} - -// converts anything that is not a letter or digit to an underscore. -func sanitizeRune(r rune) rune { - if unicode.IsLetter(r) || unicode.IsDigit(r) { - return r - } - // Everything else turns into an underscore - return '_' -} diff --git a/exporters/prometheus/sanitize_test.go b/exporters/prometheus/sanitize_test.go deleted file mode 100644 index 7a6b9fd55ee..00000000000 --- a/exporters/prometheus/sanitize_test.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package prometheus - -import ( - "testing" -) - -func TestSanitize(t *testing.T) { - tests := []struct { - name string - input string - want string - }{ - { - name: "replace character", - input: "test/key-1", - want: "test_key_1", - }, - { - name: "add prefix if starting with digit", - input: "0123456789", - want: "key_0123456789", - }, - { - name: "add prefix if starting with _", - input: "_0123456789", - want: "key_0123456789", - }, - { - name: "starts with _ after sanitization", - input: "/0123456789", - want: "key_0123456789", - }, - { - name: "valid input", - input: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789", - want: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789", - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got, want := sanitize(tt.input), tt.want; got != want { - t.Errorf("sanitize() = %q; want %q", got, want) - } - }) - } -} diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt new file mode 100755 index 00000000000..2a61dee1d01 --- /dev/null +++ b/exporters/prometheus/testdata/counter.txt @@ -0,0 +1,3 @@ +# HELP foo a simple counter +# TYPE foo counter +foo{A="B",C="D"} 24.3 diff --git a/exporters/prometheus/testdata/gauge.txt b/exporters/prometheus/testdata/gauge.txt new file mode 100644 index 00000000000..889295d74e1 --- /dev/null +++ b/exporters/prometheus/testdata/gauge.txt @@ -0,0 +1,3 @@ +# HELP bar a fun little gauge +# TYPE bar counter +bar{A="B",C="D"} 75 diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt new file mode 100644 index 00000000000..547599cf6d5 --- /dev/null +++ b/exporters/prometheus/testdata/histogram.txt @@ -0,0 +1,15 @@ +# HELP baz a very nice histogram +# TYPE baz histogram +baz_bucket{A="B",C="D",le="0"} 0 +baz_bucket{A="B",C="D",le="5"} 0 +baz_bucket{A="B",C="D",le="10"} 1 +baz_bucket{A="B",C="D",le="25"} 1 +baz_bucket{A="B",C="D",le="50"} 0 +baz_bucket{A="B",C="D",le="75"} 0 +baz_bucket{A="B",C="D",le="100"} 0 +baz_bucket{A="B",C="D",le="250"} 2 +baz_bucket{A="B",C="D",le="500"} 0 +baz_bucket{A="B",C="D",le="1000"} 0 +baz_bucket{A="B",C="D",le="+Inf"} 4 +baz_sum{A="B",C="D"} 236 +baz_count{A="B",C="D"} 4 diff --git a/exporters/prometheus/testdata/sanitized_labels.txt b/exporters/prometheus/testdata/sanitized_labels.txt new file mode 100755 index 00000000000..cd686cff97e --- /dev/null +++ b/exporters/prometheus/testdata/sanitized_labels.txt @@ -0,0 +1,3 @@ +# HELP foo a sanitary counter +# TYPE foo counter +foo{A_B="Q",C_D="Y;Z"} 24.3 diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 95374aaef1d..63ba9fc592e 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -1,5 +1,4 @@ // Copyright The OpenTelemetry Authors -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -12,106 +11,55 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import ( - "io" + "encoding/json" "os" - - "go.opentelemetry.io/otel/attribute" -) - -var ( - defaultWriter = os.Stdout - defaultPrettyPrint = false - defaultTimestamps = true - defaultAttrEncoder = attribute.DefaultEncoder() ) -// config contains options for the STDOUT exporter. +// config contains options for the exporter. type config struct { - // Writer is the destination. If not set, os.Stdout is used. - Writer io.Writer - - // PrettyPrint will encode the output into readable JSON. Default is - // false. - PrettyPrint bool - - // Timestamps specifies if timestamps should be printed. Default is - // true. - Timestamps bool - - // Encoder encodes the attributes. - Encoder attribute.Encoder + encoder *encoderHolder } -// newConfig creates a validated Config configured with options. -func newConfig(options ...Option) (config, error) { - cfg := config{ - Writer: defaultWriter, - PrettyPrint: defaultPrettyPrint, - Timestamps: defaultTimestamps, - Encoder: defaultAttrEncoder, - } +// newConfig creates a validated config configured with options. +func newConfig(options ...Option) config { + cfg := config{} for _, opt := range options { cfg = opt.apply(cfg) } - return cfg, nil -} - -// Option sets the value of an option for a Config. -type Option interface { - apply(config) config -} - -// WithWriter sets the export stream destination. -func WithWriter(w io.Writer) Option { - return writerOption{w} -} -type writerOption struct { - W io.Writer -} - -func (o writerOption) apply(cfg config) config { - cfg.Writer = o.W - return cfg -} - -// WithPrettyPrint sets the export stream format to use JSON. -func WithPrettyPrint() Option { - return prettyPrintOption(true) -} - -type prettyPrintOption bool + if cfg.encoder == nil { + enc := json.NewEncoder(os.Stdout) + enc.SetIndent("", "\t") + cfg.encoder = &encoderHolder{encoder: enc} + } -func (o prettyPrintOption) apply(cfg config) config { - cfg.PrettyPrint = bool(o) return cfg } -// WithoutTimestamps sets the export stream to not include timestamps. -func WithoutTimestamps() Option { - return timestampsOption(false) -} - -type timestampsOption bool - -func (o timestampsOption) apply(cfg config) config { - cfg.Timestamps = bool(o) - return cfg +// Option sets exporter option values. +type Option interface { + apply(config) config } -// WithAttributeEncoder sets the attribute encoder used in export. -func WithAttributeEncoder(enc attribute.Encoder) Option { - return attrEncoderOption{enc} -} +type optionFunc func(config) config -type attrEncoderOption struct { - encoder attribute.Encoder +func (o optionFunc) apply(c config) config { + return o(c) } -func (o attrEncoderOption) apply(cfg config) config { - cfg.Encoder = o.encoder - return cfg +// WithEncoder sets the exporter to use encoder to encode all the metric +// data-types to an output. +func WithEncoder(encoder Encoder) Option { + return optionFunc(func(c config) config { + if encoder != nil { + c.encoder = &encoderHolder{encoder: encoder} + } + return c + }) } diff --git a/exporters/stdout/stdoutmetric/doc.go b/exporters/stdout/stdoutmetric/doc.go index 0bffd34b9ff..fc766ad0bea 100644 --- a/exporters/stdout/stdoutmetric/doc.go +++ b/exporters/stdout/stdoutmetric/doc.go @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package stdoutmetric contains an OpenTelemetry exporter for metric -// telemetry to be written to an output destination as JSON. +// Package stdoutmetric provides an exporter for OpenTelemetry metric +// telemetry. // -// This package is currently in a pre-GA phase. Backwards incompatible changes -// may be introduced in subsequent minor version releases as we work to track -// the evolving OpenTelemetry specification and user feedback. +// The exporter is intended to be used for testing and debugging, it is not +// meant for production use. Additionally, it does not provide an interchange +// format for OpenTelemetry that is supported with any stability or +// compatibility guarantees. If these are needed features, please use the OTLP +// exporter instead. package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" diff --git a/exporters/stdout/stdoutmetric/encoder.go b/exporters/stdout/stdoutmetric/encoder.go new file mode 100644 index 00000000000..ab5510afcbe --- /dev/null +++ b/exporters/stdout/stdoutmetric/encoder.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + +import "errors" + +// Encoder encodes and outputs OpenTelemetry metric data-types as human +// readable text. +type Encoder interface { + // Encode handles the encoding and writing of OpenTelemetry metric data. + Encode(v any) error +} + +// encoderHolder is the concrete type used to wrap an Encoder so it can be +// used as a atomic.Value type. +type encoderHolder struct { + encoder Encoder +} + +func (e encoderHolder) Encode(v any) error { return e.encoder.Encode(v) } + +// shutdownEncoder is used when the exporter is shutdown. It always returns +// errShutdown when Encode is called. +type shutdownEncoder struct{} + +var errShutdown = errors.New("exporter shutdown") + +func (shutdownEncoder) Encode(any) error { return errShutdown } diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 82723ffa7ce..e8ea9310b46 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -12,100 +12,226 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package stdoutmetric_test import ( "context" - "fmt" - "log" + "encoding/json" + "os" + "time" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument/syncint64" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/selector/simple" -) - -const ( - instrumentationName = "github.com/instrumentron" - instrumentationVersion = "v0.1.0" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "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.10.0" ) var ( - loopCounter syncint64.Counter - paramValue syncint64.Histogram - - nameKey = attribute.Key("function.name") -) - -func add(ctx context.Context, x, y int64) int64 { - nameKV := nameKey.String("add") + // Sat Jan 01 2000 00:00:00 GMT+0000. + now = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) - loopCounter.Add(ctx, 1, nameKV) - paramValue.Record(ctx, x, nameKV) - paramValue.Record(ctx, y, nameKV) - - return x + y -} - -func multiply(ctx context.Context, x, y int64) int64 { - nameKV := nameKey.String("multiply") - - loopCounter.Add(ctx, 1, nameKV) - paramValue.Record(ctx, x, nameKV) - paramValue.Record(ctx, y, nameKV) - - return x * y -} - -func InstallExportPipeline(ctx context.Context) (func(context.Context) error, error) { - exporter, err := stdoutmetric.New(stdoutmetric.WithPrettyPrint()) - if err != nil { - return nil, fmt.Errorf("creating stdoutmetric exporter: %w", err) - } - - pusher := controller.New( - processor.NewFactory( - simple.NewWithInexpensiveDistribution(), - exporter, - ), - controller.WithExporter(exporter), + res = resource.NewSchemaless( + semconv.ServiceNameKey.String("stdoutmetric-example"), ) - if err = pusher.Start(ctx); err != nil { - log.Fatalf("starting push controller: %v", err) - } - global.SetMeterProvider(pusher) - meter := global.Meter(instrumentationName, metric.WithInstrumentationVersion(instrumentationVersion)) - - loopCounter, err = meter.SyncInt64().Counter("function.loops") - if err != nil { - log.Fatalf("creating instrument: %v", err) + mockData = metricdata.ResourceMetrics{ + Resource: res, + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{Name: "example", Version: "v0.0.1"}, + Metrics: []metricdata.Metrics{ + { + Name: "requests", + Description: "Number of requests received", + Unit: unit.Dimensionless, + Data: metricdata.Sum[int64]{ + IsMonotonic: true, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("server", "central")), + StartTime: now, + Time: now.Add(1 * time.Second), + Value: 5, + }, + }, + }, + }, + { + Name: "latency", + Description: "Time spend processing received requests", + Unit: unit.Milliseconds, + Data: metricdata.Histogram{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.NewSet(attribute.String("server", "central")), + StartTime: now, + Time: now.Add(1 * time.Second), + Count: 10, + Bounds: []float64{1, 5, 10}, + BucketCounts: []uint64{1, 3, 6, 0}, + Sum: 57, + }, + }, + }, + }, + { + Name: "temperature", + Description: "CPU global temperature", + Unit: unit.Unit("cel(1 K)"), + Data: metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("server", "central")), + Time: now.Add(1 * time.Second), + Value: 32.4, + }, + }, + }, + }, + }, + }, + }, } - paramValue, err = meter.SyncInt64().Histogram("function.param") - if err != nil { - log.Fatalf("creating instrument: %v", err) - } - - return pusher.Stop, nil -} +) func Example() { - ctx := context.Background() - - // TODO: Registers a meter Provider globally. - shutdown, err := InstallExportPipeline(ctx) + // Print with a JSON encoder that indents with two spaces. + enc := json.NewEncoder(os.Stdout) + enc.SetIndent("", " ") + exp, err := stdoutmetric.New(stdoutmetric.WithEncoder(enc)) if err != nil { - log.Fatal(err) + panic(err) } - defer func() { - if err := shutdown(ctx); err != nil { - log.Fatal(err) - } - }() - log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) + // Register the exporter with an SDK via a periodic reader. + sdk := metric.NewMeterProvider( + metric.WithResource(res), + metric.WithReader(metric.NewPeriodicReader(exp)), + ) + + ctx := context.Background() + // This is where the sdk would be used to create a Meter and from that + // instruments that would make measurments of your code. To simulate that + // behavior, call export directly with mocked data. + _ = exp.Export(ctx, mockData) + + // Ensure the periodic reader is cleaned up by shutting down the sdk. + _ = sdk.Shutdown(ctx) + + // Output: + // { + // "Resource": [ + // { + // "Key": "service.name", + // "Value": { + // "Type": "STRING", + // "Value": "stdoutmetric-example" + // } + // } + // ], + // "ScopeMetrics": [ + // { + // "Scope": { + // "Name": "example", + // "Version": "v0.0.1", + // "SchemaURL": "" + // }, + // "Metrics": [ + // { + // "Name": "requests", + // "Description": "Number of requests received", + // "Unit": "1", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "2000-01-01T00:00:00Z", + // "Time": "2000-01-01T00:00:01Z", + // "Value": 5 + // } + // ], + // "Temporality": "DeltaTemporality", + // "IsMonotonic": true + // } + // }, + // { + // "Name": "latency", + // "Description": "Time spend processing received requests", + // "Unit": "ms", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "2000-01-01T00:00:00Z", + // "Time": "2000-01-01T00:00:01Z", + // "Count": 10, + // "Bounds": [ + // 1, + // 5, + // 10 + // ], + // "BucketCounts": [ + // 1, + // 3, + // 6, + // 0 + // ], + // "Sum": 57 + // } + // ], + // "Temporality": "DeltaTemporality" + // } + // }, + // { + // "Name": "temperature", + // "Description": "CPU global temperature", + // "Unit": "cel(1 K)", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "2000-01-01T00:00:01Z", + // "Value": 32.4 + // } + // ] + // } + // } + // ] + // } + // ] + // } } diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 5f8ff4f7baf..f7976d5993f 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -12,27 +12,60 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build go1.18 +// +build go1.18 + package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" -import "go.opentelemetry.io/otel/sdk/metric/export" +import ( + "context" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// exporter is an OpenTelemetry metric exporter. +type exporter struct { + encVal atomic.Value // encoderHolder -// Exporter is an OpenTelemetry metric exporter that transmits telemetry to -// the local STDOUT. -type Exporter struct { - metricExporter + shutdownOnce sync.Once } -var ( - _ export.Exporter = &Exporter{} -) +// New returns a configured metric exporter. +// +// If no options are passed, the default exporter returned will use a JSON +// encoder with tab indentations that output to STDOUT. +func New(options ...Option) (metric.Exporter, error) { + cfg := newConfig(options...) + exp := &exporter{} + exp.encVal.Store(*cfg.encoder) + return exp, nil +} -// New creates an Exporter with the passed options. -func New(options ...Option) (*Exporter, error) { - cfg, err := newConfig(options...) - if err != nil { - return nil, err +func (e *exporter) Export(ctx context.Context, data metricdata.ResourceMetrics) error { + select { + case <-ctx.Done(): + // Don't do anything if the context has already timed out. + return ctx.Err() + default: + // Context is still valid, continue. } - return &Exporter{ - metricExporter: metricExporter{cfg}, - }, nil + + return e.encVal.Load().(encoderHolder).Encode(data) +} + +func (e *exporter) ForceFlush(ctx context.Context) error { + // exporter holds no state, nothing to flush. + return ctx.Err() +} + +func (e *exporter) Shutdown(ctx context.Context) error { + e.shutdownOnce.Do(func() { + e.encVal.Store(encoderHolder{ + encoder: shutdownEncoder{}, + }) + }) + return ctx.Err() } diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go new file mode 100644 index 00000000000..9e8faa3e8ec --- /dev/null +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -0,0 +1,102 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package stdoutmetric_test // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + +import ( + "context" + "encoding/json" + "io" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func testEncoderOption() stdoutmetric.Option { + // Discard export output for testing. + enc := json.NewEncoder(io.Discard) + return stdoutmetric.WithEncoder(enc) +} + +func testCtxErrHonored(factory func(*testing.T) func(context.Context) error) func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + t.Run("DeadlineExceeded", func(t *testing.T) { + innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) + t.Cleanup(innerCancel) + <-innerCtx.Done() + + f := factory(t) + assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) + }) + + t.Run("Canceled", func(t *testing.T) { + innerCtx, innerCancel := context.WithCancel(ctx) + innerCancel() + + f := factory(t) + assert.ErrorIs(t, f(innerCtx), context.Canceled) + }) + + t.Run("NoError", func(t *testing.T) { + f := factory(t) + assert.NoError(t, f(ctx)) + }) + } +} + +func TestExporterHonorsContextErrors(t *testing.T) { + t.Run("Shutdown", testCtxErrHonored(func(t *testing.T) func(context.Context) error { + exp, err := stdoutmetric.New(testEncoderOption()) + require.NoError(t, err) + return exp.Shutdown + })) + + t.Run("ForceFlush", testCtxErrHonored(func(t *testing.T) func(context.Context) error { + exp, err := stdoutmetric.New(testEncoderOption()) + require.NoError(t, err) + return exp.ForceFlush + })) + + t.Run("Export", testCtxErrHonored(func(t *testing.T) func(context.Context) error { + exp, err := stdoutmetric.New(testEncoderOption()) + require.NoError(t, err) + return func(ctx context.Context) error { + var data metricdata.ResourceMetrics + return exp.Export(ctx, data) + } + })) +} + +func TestShutdownExporterReturnsShutdownErrorOnExport(t *testing.T) { + var ( + data metricdata.ResourceMetrics + ctx = context.Background() + exp, err = stdoutmetric.New(testEncoderOption()) + ) + require.NoError(t, err) + require.NoError(t, exp.Shutdown(ctx)) + assert.EqualError(t, exp.Export(ctx, data), "exporter shutdown") +} diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 8e5752f088b..67edf5fc2ed 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -1,18 +1,13 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric -go 1.17 - -replace ( - go.opentelemetry.io/otel => ../../.. - go.opentelemetry.io/otel/sdk => ../../../sdk -) +go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 ) require ( @@ -27,6 +22,10 @@ require ( replace go.opentelemetry.io/otel/metric => ../../../metric +replace go.opentelemetry.io/otel => ../../.. + replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric replace go.opentelemetry.io/otel/trace => ../../../trace + +replace go.opentelemetry.io/otel/sdk => ../../../sdk diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index bb01dfbad5b..2e2aed63d24 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,4 +1,3 @@ -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= diff --git a/exporters/stdout/stdoutmetric/metric.go b/exporters/stdout/stdoutmetric/metric.go deleted file mode 100644 index 38289d281a7..00000000000 --- a/exporters/stdout/stdoutmetric/metric.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" - -import ( - "context" - "encoding/json" - "fmt" - "strings" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -type metricExporter struct { - config config -} - -var _ export.Exporter = &metricExporter{} - -type line struct { - Name string `json:"Name"` - Sum interface{} `json:"Sum,omitempty"` - Count interface{} `json:"Count,omitempty"` - LastValue interface{} `json:"Last,omitempty"` - - // Note: this is a pointer because omitempty doesn't work when time.IsZero() - Timestamp *time.Time `json:"Timestamp,omitempty"` -} - -func (e *metricExporter) TemporalityFor(desc *sdkapi.Descriptor, kind aggregation.Kind) aggregation.Temporality { - return aggregation.StatelessTemporalitySelector().TemporalityFor(desc, kind) -} - -func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reader export.InstrumentationLibraryReader) error { - var aggError error - var batch []line - aggError = reader.ForEach(func(lib instrumentation.Library, mr export.Reader) error { - var instAttrs []attribute.KeyValue - if name := lib.Name; name != "" { - instAttrs = append(instAttrs, attribute.String("instrumentation.name", name)) - if version := lib.Version; version != "" { - instAttrs = append(instAttrs, attribute.String("instrumentation.version", version)) - } - if schema := lib.SchemaURL; schema != "" { - instAttrs = append(instAttrs, attribute.String("instrumentation.schema_url", schema)) - } - } - instSet := attribute.NewSet(instAttrs...) - encodedInstAttrs := instSet.Encoded(e.config.Encoder) - - return mr.ForEach(e, func(record export.Record) error { - desc := record.Descriptor() - agg := record.Aggregation() - kind := desc.NumberKind() - encodedResource := res.Encoded(e.config.Encoder) - - var expose line - - if sum, ok := agg.(aggregation.Sum); ok { - value, err := sum.Sum() - if err != nil { - return err - } - expose.Sum = value.AsInterface(kind) - } else if lv, ok := agg.(aggregation.LastValue); ok { - value, timestamp, err := lv.LastValue() - if err != nil { - return err - } - expose.LastValue = value.AsInterface(kind) - - if e.config.Timestamps { - expose.Timestamp = ×tamp - } - } - - var encodedAttrs string - iter := record.Attributes().Iter() - if iter.Len() > 0 { - encodedAttrs = record.Attributes().Encoded(e.config.Encoder) - } - - var sb strings.Builder - - _, _ = sb.WriteString(desc.Name()) - - if len(encodedAttrs) > 0 || len(encodedResource) > 0 || len(encodedInstAttrs) > 0 { - _, _ = sb.WriteRune('{') - _, _ = sb.WriteString(encodedResource) - if len(encodedInstAttrs) > 0 && len(encodedResource) > 0 { - _, _ = sb.WriteRune(',') - } - _, _ = sb.WriteString(encodedInstAttrs) - if len(encodedAttrs) > 0 && (len(encodedInstAttrs) > 0 || len(encodedResource) > 0) { - _, _ = sb.WriteRune(',') - } - _, _ = sb.WriteString(encodedAttrs) - _, _ = sb.WriteRune('}') - } - - expose.Name = sb.String() - - batch = append(batch, expose) - return nil - }) - }) - if len(batch) == 0 { - return aggError - } - - data, err := e.marshal(batch) - if err != nil { - return err - } - fmt.Fprintln(e.config.Writer, string(data)) - - return aggError -} - -// marshal v with appropriate indentation. -func (e *metricExporter) marshal(v interface{}) ([]byte, error) { - if e.config.PrettyPrint { - return json.MarshalIndent(v, "", "\t") - } - return json.Marshal(v) -} diff --git a/exporters/stdout/stdoutmetric/metric_test.go b/exporters/stdout/stdoutmetric/metric_test.go deleted file mode 100644 index 40cb6fbb8e5..00000000000 --- a/exporters/stdout/stdoutmetric/metric_test.go +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package stdoutmetric_test - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" - "go.opentelemetry.io/otel/metric" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/resource" -) - -type testFixture struct { - t *testing.T - ctx context.Context - cont *controller.Controller - meter metric.Meter - exporter *stdoutmetric.Exporter - output *bytes.Buffer -} - -var testResource = resource.NewSchemaless(attribute.String("R", "V")) - -func newFixture(t *testing.T, opts ...stdoutmetric.Option) testFixture { - return newFixtureWithResource(t, testResource, opts...) -} - -func newFixtureWithResource(t *testing.T, res *resource.Resource, opts ...stdoutmetric.Option) testFixture { - buf := &bytes.Buffer{} - opts = append(opts, stdoutmetric.WithWriter(buf)) - opts = append(opts, stdoutmetric.WithoutTimestamps()) - exp, err := stdoutmetric.New(opts...) - if err != nil { - t.Fatal("Error building fixture: ", err) - } - aggSel := processortest.AggregatorSelector() - proc := processor.NewFactory(aggSel, aggregation.StatelessTemporalitySelector()) - cont := controller.New(proc, - controller.WithExporter(exp), - controller.WithResource(res), - ) - ctx := context.Background() - require.NoError(t, cont.Start(ctx)) - meter := cont.Meter("test") - - return testFixture{ - t: t, - ctx: ctx, - exporter: exp, - cont: cont, - meter: meter, - output: buf, - } -} - -func (fix testFixture) Output() string { - return strings.TrimSpace(fix.output.String()) -} - -func TestStdoutTimestamp(t *testing.T) { - var buf bytes.Buffer - aggSel := processortest.AggregatorSelector() - proc := processor.NewFactory(aggSel, aggregation.CumulativeTemporalitySelector()) - exporter, err := stdoutmetric.New( - stdoutmetric.WithWriter(&buf), - ) - if err != nil { - t.Fatal("Invalid config: ", err) - } - cont := controller.New(proc, - controller.WithExporter(exporter), - controller.WithResource(testResource), - ) - ctx := context.Background() - - require.NoError(t, cont.Start(ctx)) - meter := cont.Meter("test") - counter, err := meter.SyncInt64().Counter("name.lastvalue") - require.NoError(t, err) - - before := time.Now() - // Ensure the timestamp is after before. - time.Sleep(time.Nanosecond) - - counter.Add(ctx, 1) - - require.NoError(t, cont.Stop(ctx)) - - // Ensure the timestamp is before after. - time.Sleep(time.Nanosecond) - after := time.Now() - - var printed []interface{} - if err := json.Unmarshal(buf.Bytes(), &printed); err != nil { - t.Fatal("JSON parse error: ", err) - } - - require.Len(t, printed, 1) - lastValue, ok := printed[0].(map[string]interface{}) - require.True(t, ok, "last value format") - require.Contains(t, lastValue, "Timestamp") - lastValueTS := lastValue["Timestamp"].(string) - lastValueTimestamp, err := time.Parse(time.RFC3339Nano, lastValueTS) - if err != nil { - t.Fatal("JSON parse error: ", lastValueTS, ": ", err) - } - - assert.True(t, lastValueTimestamp.After(before)) - assert.True(t, lastValueTimestamp.Before(after)) -} - -func TestStdoutCounterFormat(t *testing.T) { - fix := newFixture(t) - - counter, err := fix.meter.SyncInt64().Counter("name.sum") - require.NoError(t, err) - counter.Add(fix.ctx, 123, attribute.String("A", "B"), attribute.String("C", "D")) - - require.NoError(t, fix.cont.Stop(fix.ctx)) - - require.Equal(t, `[{"Name":"name.sum{R=V,instrumentation.name=test,A=B,C=D}","Sum":123}]`, fix.Output()) -} - -func TestStdoutLastValueFormat(t *testing.T) { - fix := newFixture(t) - - counter, err := fix.meter.SyncFloat64().Counter("name.lastvalue") - require.NoError(t, err) - counter.Add(fix.ctx, 123.456, attribute.String("A", "B"), attribute.String("C", "D")) - - require.NoError(t, fix.cont.Stop(fix.ctx)) - - require.Equal(t, `[{"Name":"name.lastvalue{R=V,instrumentation.name=test,A=B,C=D}","Last":123.456}]`, fix.Output()) -} - -func TestStdoutHistogramFormat(t *testing.T) { - fix := newFixture(t, stdoutmetric.WithPrettyPrint()) - - inst, err := fix.meter.SyncFloat64().Histogram("name.histogram") - require.NoError(t, err) - - for i := 0; i < 1000; i++ { - inst.Record(fix.ctx, float64(i)+0.5, attribute.String("A", "B"), attribute.String("C", "D")) - } - require.NoError(t, fix.cont.Stop(fix.ctx)) - - // TODO: Stdout does not export `Count` for histogram, nor the buckets. - require.Equal(t, `[ - { - "Name": "name.histogram{R=V,instrumentation.name=test,A=B,C=D}", - "Sum": 500000 - } -]`, fix.Output()) -} - -func TestStdoutNoData(t *testing.T) { - runTwoAggs := func(aggName string) { - t.Run(aggName, func(t *testing.T) { - t.Parallel() - - fix := newFixture(t) - _, err := fix.meter.SyncFloat64().Counter(fmt.Sprint("name.", aggName)) - require.NoError(t, err) - require.NoError(t, fix.cont.Stop(fix.ctx)) - - require.Equal(t, "", fix.Output()) - }) - } - - runTwoAggs("lastvalue") -} - -func TestStdoutResource(t *testing.T) { - type testCase struct { - name string - expect string - res *resource.Resource - attrs []attribute.KeyValue - } - newCase := func(name, expect string, res *resource.Resource, attrs ...attribute.KeyValue) testCase { - return testCase{ - name: name, - expect: expect, - res: res, - attrs: attrs, - } - } - testCases := []testCase{ - newCase("resource and attribute", - "R1=V1,R2=V2,instrumentation.name=test,A=B,C=D", - resource.NewSchemaless(attribute.String("R1", "V1"), attribute.String("R2", "V2")), - attribute.String("A", "B"), - attribute.String("C", "D")), - newCase("only resource", - "R1=V1,R2=V2,instrumentation.name=test", - resource.NewSchemaless(attribute.String("R1", "V1"), attribute.String("R2", "V2")), - ), - newCase("empty resource", - "instrumentation.name=test,A=B,C=D", - resource.Empty(), - attribute.String("A", "B"), - attribute.String("C", "D"), - ), - newCase("default resource", - fmt.Sprint(resource.Default().Encoded(attribute.DefaultEncoder()), - ",instrumentation.name=test,A=B,C=D"), - resource.Default(), - attribute.String("A", "B"), - attribute.String("C", "D"), - ), - // We explicitly do not de-duplicate between resources - // and metric attributes in this exporter. - newCase("resource deduplication", - "R1=V1,R2=V2,instrumentation.name=test,R1=V3,R2=V4", - resource.NewSchemaless(attribute.String("R1", "V1"), attribute.String("R2", "V2")), - attribute.String("R1", "V3"), - attribute.String("R2", "V4")), - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - ctx := context.Background() - fix := newFixtureWithResource(t, tc.res) - - counter, err := fix.meter.SyncFloat64().Counter("name.lastvalue") - require.NoError(t, err) - counter.Add(ctx, 123.456, tc.attrs...) - - require.NoError(t, fix.cont.Stop(fix.ctx)) - - require.Equal(t, `[{"Name":"name.lastvalue{`+tc.expect+`}","Last":123.456}]`, fix.Output()) - }) - } -} diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go new file mode 100644 index 00000000000..1eb2c348699 --- /dev/null +++ b/sdk/metric/aggregation/aggregation.go @@ -0,0 +1,164 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.17 +// +build go1.17 + +// Package aggregation contains configuration types that define the +// aggregation operation used to summarizes recorded measurements. +package aggregation // import "go.opentelemetry.io/otel/sdk/metric/aggregation" + +import ( + "errors" + "fmt" +) + +// errAgg is wrapped by misconfigured aggregations. +var errAgg = errors.New("aggregation") + +// Aggregation is the aggregation used to summarize recorded measurements. +type Aggregation interface { + // private attempts to ensure no user-defined Aggregation are allowed. The + // OTel specification does not allow user-defined Aggregation currently. + private() + + // Copy returns a deep copy of the Aggregation. + Copy() Aggregation + + // Err returns an error for any misconfigured Aggregation. + Err() error +} + +// Drop is an aggregation that drops all recorded data. +type Drop struct{} // Drop has no parameters. + +var _ Aggregation = Drop{} + +func (Drop) private() {} + +// Copy returns a deep copy of d. +func (d Drop) Copy() Aggregation { return d } + +// Err returns an error for any misconfiguration. A Drop aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (Drop) Err() error { return nil } + +// Default is an aggregation that uses the default instrument kind selection +// mapping to select another aggregation. A metric reader can be configured to +// make an aggregation selection based on instrument kind that differs from +// the default. This aggregation ensures the default is used. +// +// See the "go.opentelemetry.io/otel/sdk/metric".DefaultAggregationSelector +// for information about the default instrument kind selection mapping. +type Default struct{} // Default has no parameters. + +var _ Aggregation = Default{} + +func (Default) private() {} + +// Copy returns a deep copy of d. +func (d Default) Copy() Aggregation { return d } + +// Err returns an error for any misconfiguration. A Default aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (Default) Err() error { return nil } + +// Sum is an aggregation that summarizes a set of measurements as their +// arithmetic sum. +type Sum struct{} // Sum has no parameters. + +var _ Aggregation = Sum{} + +func (Sum) private() {} + +// Copy returns a deep copy of s. +func (s Sum) Copy() Aggregation { return s } + +// Err returns an error for any misconfiguration. A Sum aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (Sum) Err() error { return nil } + +// LastValue is an aggregation that summarizes a set of measurements as the +// last one made. +type LastValue struct{} // LastValue has no parameters. + +var _ Aggregation = LastValue{} + +func (LastValue) private() {} + +// Copy returns a deep copy of l. +func (l LastValue) Copy() Aggregation { return l } + +// Err returns an error for any misconfiguration. A LastValue aggregation has +// no parameters and cannot be misconfigured, therefore this always returns +// nil. +func (LastValue) Err() error { return nil } + +// ExplicitBucketHistogram is an aggregation that summarizes a set of +// measurements as an histogram with explicitly defined buckets. +type ExplicitBucketHistogram struct { + // Boundaries are the increasing bucket boundary values. Boundary values + // define bucket upper bounds. Buckets are exclusive of their lower + // boundary and inclusive of their upper bound (except at positive + // infinity). A measurement is defined to fall into the greatest-numbered + // bucket with a boundary that is greater than or equal to the + // measurement. As an example, boundaries defined as: + // + // []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000} + // + // Will define these buckets: + // + // (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, 25.0], (25.0, 50.0], + // (50.0, 75.0], (75.0, 100.0], (100.0, 250.0], (250.0, 500.0], + // (500.0, 1000.0], (1000.0, +∞) + Boundaries []float64 + // NoMinMax indicates whether to not record the min and max of the + // distribution. By default, these extremes are recorded. + NoMinMax bool +} + +var _ Aggregation = ExplicitBucketHistogram{} + +func (ExplicitBucketHistogram) private() {} + +// errHist is returned by misconfigured ExplicitBucketHistograms. +var errHist = fmt.Errorf("%w: explicit bucket histogram", errAgg) + +// Err returns an error for any misconfiguration. +func (h ExplicitBucketHistogram) Err() error { + if len(h.Boundaries) <= 1 { + return nil + } + + // Check boundaries are monotonic. + i := h.Boundaries[0] + for _, j := range h.Boundaries[1:] { + if i >= j { + return fmt.Errorf("%w: non-monotonic boundaries: %v", errHist, h.Boundaries) + } + i = j + } + + return nil +} + +// Copy returns a deep copy of h. +func (h ExplicitBucketHistogram) Copy() Aggregation { + b := make([]float64, len(h.Boundaries)) + copy(b, h.Boundaries) + return ExplicitBucketHistogram{ + Boundaries: b, + NoMinMax: h.NoMinMax, + } +} diff --git a/sdk/metric/aggregation/aggregation_test.go b/sdk/metric/aggregation/aggregation_test.go new file mode 100644 index 00000000000..772d7ea8fe1 --- /dev/null +++ b/sdk/metric/aggregation/aggregation_test.go @@ -0,0 +1,70 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.17 +// +build go1.17 + +package aggregation + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAggregationErr(t *testing.T) { + t.Run("DropOperation", func(t *testing.T) { + assert.NoError(t, Drop{}.Err()) + }) + + t.Run("SumOperation", func(t *testing.T) { + assert.NoError(t, Sum{}.Err()) + }) + + t.Run("LastValueOperation", func(t *testing.T) { + assert.NoError(t, LastValue{}.Err()) + }) + + t.Run("ExplicitBucketHistogramOperation", func(t *testing.T) { + assert.NoError(t, ExplicitBucketHistogram{}.Err()) + + assert.NoError(t, ExplicitBucketHistogram{ + Boundaries: []float64{0}, + NoMinMax: true, + }.Err()) + + assert.NoError(t, ExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + }.Err()) + }) + + t.Run("NonmonotonicHistogramBoundaries", func(t *testing.T) { + assert.ErrorIs(t, ExplicitBucketHistogram{ + Boundaries: []float64{2, 1}, + }.Err(), errAgg) + + assert.ErrorIs(t, ExplicitBucketHistogram{ + Boundaries: []float64{0, 1, 2, 1, 3, 4}, + }.Err(), errAgg) + }) +} + +func TestExplicitBucketHistogramDeepCopy(t *testing.T) { + const orig = 0.0 + b := []float64{orig} + h := ExplicitBucketHistogram{Boundaries: b} + cpH := h.Copy().(ExplicitBucketHistogram) + b[0] = orig + 1 + assert.Equal(t, orig, cpH.Boundaries[0], "changing the underlying slice data should not affect the copy") +} diff --git a/sdk/metric/aggregator/aggregator.go b/sdk/metric/aggregator/aggregator.go deleted file mode 100644 index 59a2b4ffa68..00000000000 --- a/sdk/metric/aggregator/aggregator.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregator // import "go.opentelemetry.io/otel/sdk/metric/aggregator" - -import ( - "context" - "fmt" - "math" - - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Aggregator implements a specific aggregation behavior, e.g., a -// behavior to track a sequence of updates to an instrument. Counter -// instruments commonly use a simple Sum aggregator, but for the -// distribution instruments (Histogram, GaugeObserver) there are a -// number of possible aggregators with different cost and accuracy -// tradeoffs. -// -// Note that any Aggregator may be attached to any instrument--this is -// the result of the OpenTelemetry API/SDK separation. It is possible -// to attach a Sum aggregator to a Histogram instrument. -type Aggregator interface { - // Aggregation returns an Aggregation interface to access the - // current state of this Aggregator. The caller is - // responsible for synchronization and must not call any the - // other methods in this interface concurrently while using - // the Aggregation. - Aggregation() aggregation.Aggregation - - // Update receives a new measured value and incorporates it - // into the aggregation. Update() calls may be called - // concurrently. - // - // Descriptor.NumberKind() should be consulted to determine - // whether the provided number is an int64 or float64. - // - // The Context argument comes from user-level code and could be - // inspected for a `correlation.Map` or `trace.SpanContext`. - Update(ctx context.Context, n number.Number, descriptor *sdkapi.Descriptor) error - - // SynchronizedMove is called during collection to finish one - // period of aggregation by atomically saving the - // currently-updating state into the argument Aggregator AND - // resetting the current value to the zero state. - // - // SynchronizedMove() is called concurrently with Update(). These - // two methods must be synchronized with respect to each - // other, for correctness. - // - // After saving a synchronized copy, the Aggregator can be converted - // into one or more of the interfaces in the `aggregation` sub-package, - // according to kind of Aggregator that was selected. - // - // This method will return an InconsistentAggregatorError if - // this Aggregator cannot be copied into the destination due - // to an incompatible type. - // - // This call has no Context argument because it is expected to - // perform only computation. - // - // When called with a nil `destination`, this Aggregator is reset - // and the current value is discarded. - SynchronizedMove(destination Aggregator, descriptor *sdkapi.Descriptor) error - - // Merge combines the checkpointed state from the argument - // Aggregator into this Aggregator. Merge is not synchronized - // with respect to Update or SynchronizedMove. - // - // The owner of an Aggregator being merged is responsible for - // synchronization of both Aggregator states. - Merge(aggregator Aggregator, descriptor *sdkapi.Descriptor) error -} - -// NewInconsistentAggregatorError formats an error describing an attempt to -// Checkpoint or Merge different-type aggregators. The result can be unwrapped as -// an ErrInconsistentType. -func NewInconsistentAggregatorError(a1, a2 Aggregator) error { - return fmt.Errorf("%w: %T and %T", aggregation.ErrInconsistentType, a1, a2) -} - -// RangeTest is a common routine for testing for valid input values. -// This rejects NaN values. This rejects negative values when the -// metric instrument does not support negative values, including -// monotonic counter metrics and absolute Histogram metrics. -func RangeTest(num number.Number, descriptor *sdkapi.Descriptor) error { - numberKind := descriptor.NumberKind() - - if numberKind == number.Float64Kind && math.IsNaN(num.AsFloat64()) { - return aggregation.ErrNaNInput - } - - switch descriptor.InstrumentKind() { - case sdkapi.CounterInstrumentKind, sdkapi.CounterObserverInstrumentKind: - if num.IsNegative(numberKind) { - return aggregation.ErrNegativeInput - } - } - return nil -} diff --git a/sdk/metric/aggregator/aggregator_test.go b/sdk/metric/aggregator/aggregator_test.go deleted file mode 100644 index aab8393c932..00000000000 --- a/sdk/metric/aggregator/aggregator_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregator_test // import "go.opentelemetry.io/otel/sdk/metric/aggregator" - -import ( - "errors" - "math" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -func TestInconsistentAggregatorErr(t *testing.T) { - err := aggregator.NewInconsistentAggregatorError(&sum.New(1)[0], &lastvalue.New(1)[0]) - require.Equal( - t, - "inconsistent aggregator types: *sum.Aggregator and *lastvalue.Aggregator", - err.Error(), - ) - require.True(t, errors.Is(err, aggregation.ErrInconsistentType)) -} - -func testRangeNaN(t *testing.T, desc *sdkapi.Descriptor) { - // If the descriptor uses int64 numbers, this won't register as NaN - nan := number.NewFloat64Number(math.NaN()) - err := aggregator.RangeTest(nan, desc) - - if desc.NumberKind() == number.Float64Kind { - require.Equal(t, aggregation.ErrNaNInput, err) - } else { - require.Nil(t, err) - } -} - -func testRangeNegative(t *testing.T, desc *sdkapi.Descriptor) { - var neg, pos number.Number - - if desc.NumberKind() == number.Float64Kind { - pos = number.NewFloat64Number(+1) - neg = number.NewFloat64Number(-1) - } else { - pos = number.NewInt64Number(+1) - neg = number.NewInt64Number(-1) - } - - posErr := aggregator.RangeTest(pos, desc) - negErr := aggregator.RangeTest(neg, desc) - - require.Nil(t, posErr) - require.Equal(t, negErr, aggregation.ErrNegativeInput) -} - -func TestRangeTest(t *testing.T) { - // Only Counters implement a range test. - for _, nkind := range []number.Kind{number.Float64Kind, number.Int64Kind} { - t.Run(nkind.String(), func(t *testing.T) { - desc := metrictest.NewDescriptor( - "name", - sdkapi.CounterInstrumentKind, - nkind, - ) - testRangeNegative(t, &desc) - }) - } -} - -func TestNaNTest(t *testing.T) { - for _, nkind := range []number.Kind{number.Float64Kind, number.Int64Kind} { - t.Run(nkind.String(), func(t *testing.T) { - for _, mkind := range []sdkapi.InstrumentKind{ - sdkapi.CounterInstrumentKind, - sdkapi.HistogramInstrumentKind, - sdkapi.GaugeObserverInstrumentKind, - } { - desc := metrictest.NewDescriptor( - "name", - mkind, - nkind, - ) - testRangeNaN(t, &desc) - } - }) - } -} diff --git a/sdk/metric/aggregator/aggregatortest/test.go b/sdk/metric/aggregator/aggregatortest/test.go deleted file mode 100644 index f4778528b82..00000000000 --- a/sdk/metric/aggregator/aggregatortest/test.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregatortest // import "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - -import ( - "context" - "errors" - "math/rand" - "os" - "sort" - "testing" - "unsafe" - - "github.com/stretchr/testify/require" - - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Magnitude is the upper-bound of random numbers used in profile tests. -const Magnitude = 1000 - -// Profile is an aggregator test profile. -type Profile struct { - NumberKind number.Kind - Random func(sign int) number.Number -} - -// NoopAggregator is an aggregator that performs no operations. -type NoopAggregator struct{} - -// NoopAggregation is an aggregation that performs no operations. -type NoopAggregation struct{} - -var _ aggregator.Aggregator = NoopAggregator{} -var _ aggregation.Aggregation = NoopAggregation{} - -func newProfiles() []Profile { - rnd := rand.New(rand.NewSource(rand.Int63())) - return []Profile{ - { - NumberKind: number.Int64Kind, - Random: func(sign int) number.Number { - return number.NewInt64Number(int64(sign) * int64(rnd.Intn(Magnitude+1))) - }, - }, - { - NumberKind: number.Float64Kind, - Random: func(sign int) number.Number { - return number.NewFloat64Number(float64(sign) * rnd.Float64() * Magnitude) - }, - }, - } -} - -// NewAggregatorTest returns a descriptor for mkind and nkind. -func NewAggregatorTest(mkind sdkapi.InstrumentKind, nkind number.Kind) *sdkapi.Descriptor { - desc := sdkapi.NewDescriptor("test.name", mkind, nkind, "", "") - return &desc -} - -// RunProfiles runs all test profile against the factory function f. -func RunProfiles(t *testing.T, f func(*testing.T, Profile)) { - for _, profile := range newProfiles() { - t.Run(profile.NumberKind.String(), func(t *testing.T) { - f(t, profile) - }) - } -} - -// TestMain ensures local struct alignment prior to running tests. -func TestMain(m *testing.M) { - fields := []ottest.FieldOffset{ - { - Name: "Numbers.numbers", - Offset: unsafe.Offsetof(Numbers{}.numbers), - }, - } - if !ottest.Aligned8Byte(fields, os.Stderr) { - // nolint:revive // this is a main func, allow Exit. - os.Exit(1) - } - - // nolint:revive // this is a main func, allow Exit. - os.Exit(m.Run()) -} - -// Numbers are a collection of measured data point values. -type Numbers struct { - // numbers has to be aligned for 64-bit atomic operations. - numbers []number.Number - kind number.Kind -} - -// NewNumbers returns a new Numbers for the passed kind. -func NewNumbers(kind number.Kind) Numbers { - return Numbers{ - kind: kind, - } -} - -// Append appends v to the numbers n. -func (n *Numbers) Append(v number.Number) { - n.numbers = append(n.numbers, v) -} - -// Sort sorts all the numbers contained in n. -func (n *Numbers) Sort() { - sort.Sort(n) -} - -// Less returns if the number at index i is less than the number at index j. -func (n *Numbers) Less(i, j int) bool { - return n.numbers[i].CompareNumber(n.kind, n.numbers[j]) < 0 -} - -// Len returns number of data points Numbers contains. -func (n *Numbers) Len() int { - return len(n.numbers) -} - -// Swap swaps the location of the numbers at index i and j. -func (n *Numbers) Swap(i, j int) { - n.numbers[i], n.numbers[j] = n.numbers[j], n.numbers[i] -} - -// Sum returns the sum of all data points. -func (n *Numbers) Sum() number.Number { - var sum number.Number - for _, num := range n.numbers { - sum.AddNumber(n.kind, num) - } - return sum -} - -// Count returns the number of data points Numbers contains. -func (n *Numbers) Count() uint64 { - return uint64(len(n.numbers)) -} - -// Min returns the min number. -func (n *Numbers) Min() number.Number { - return n.numbers[0] -} - -// Max returns the max number. -func (n *Numbers) Max() number.Number { - return n.numbers[len(n.numbers)-1] -} - -// Points returns the slice of number for all data points. -func (n *Numbers) Points() []number.Number { - return n.numbers -} - -// CheckedUpdate performs the same range test the SDK does on behalf of the aggregator. -func CheckedUpdate(t *testing.T, agg aggregator.Aggregator, n number.Number, descriptor *sdkapi.Descriptor) { - ctx := context.Background() - - // Note: Aggregator tests are written assuming that the SDK - // has performed the RangeTest. Therefore we skip errors that - // would have been detected by the RangeTest. - err := aggregator.RangeTest(n, descriptor) - if err != nil { - return - } - - if err := agg.Update(ctx, n, descriptor); err != nil { - t.Error("Unexpected Update failure", err) - } -} - -// CheckedMerge verifies aggFrom merges into aggInto with the scope of -// descriptor. -func CheckedMerge(t *testing.T, aggInto, aggFrom aggregator.Aggregator, descriptor *sdkapi.Descriptor) { - if err := aggInto.Merge(aggFrom, descriptor); err != nil { - t.Error("Unexpected Merge failure", err) - } -} - -// Kind returns a Noop aggregation Kind. -func (NoopAggregation) Kind() aggregation.Kind { - return aggregation.Kind("Noop") -} - -// Aggregation returns a NoopAggregation. -func (NoopAggregator) Aggregation() aggregation.Aggregation { - return NoopAggregation{} -} - -// Update performs no operation. -func (NoopAggregator) Update(context.Context, number.Number, *sdkapi.Descriptor) error { - return nil -} - -// SynchronizedMove performs no operation. -func (NoopAggregator) SynchronizedMove(aggregator.Aggregator, *sdkapi.Descriptor) error { - return nil -} - -// Merge performs no operation. -func (NoopAggregator) Merge(aggregator.Aggregator, *sdkapi.Descriptor) error { - return nil -} - -// SynchronizedMoveResetTest tests SynchronizedMove behavior for an aggregator -// during resets. -func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf func(*sdkapi.Descriptor) aggregator.Aggregator) { - t.Run("reset on nil", func(t *testing.T) { - // Ensures that SynchronizedMove(nil, descriptor) discards and - // resets the aggregator. - RunProfiles(t, func(t *testing.T, profile Profile) { - descriptor := NewAggregatorTest( - mkind, - profile.NumberKind, - ) - agg := nf(descriptor) - - for i := 0; i < 10; i++ { - x1 := profile.Random(+1) - CheckedUpdate(t, agg, x1, descriptor) - } - - require.NoError(t, agg.SynchronizedMove(nil, descriptor)) - - if count, ok := agg.(aggregation.Count); ok { - c, err := count.Count() - require.Equal(t, uint64(0), c) - require.NoError(t, err) - } - - if sum, ok := agg.(aggregation.Sum); ok { - s, err := sum.Sum() - require.Equal(t, number.Number(0), s) - require.NoError(t, err) - } - - if lv, ok := agg.(aggregation.LastValue); ok { - v, _, err := lv.LastValue() - require.Equal(t, number.Number(0), v) - require.Error(t, err) - require.True(t, errors.Is(err, aggregation.ErrNoData)) - } - }) - }) - - t.Run("no reset on incorrect type", func(t *testing.T) { - // Ensures that SynchronizedMove(wrong_type, descriptor) does not - // reset the aggregator. - RunProfiles(t, func(t *testing.T, profile Profile) { - descriptor := NewAggregatorTest( - mkind, - profile.NumberKind, - ) - agg := nf(descriptor) - - var input number.Number - const inval = 100 - if profile.NumberKind == number.Int64Kind { - input = number.NewInt64Number(inval) - } else { - input = number.NewFloat64Number(inval) - } - - CheckedUpdate(t, agg, input, descriptor) - - err := agg.SynchronizedMove(NoopAggregator{}, descriptor) - require.Error(t, err) - require.True(t, errors.Is(err, aggregation.ErrInconsistentType)) - - // Test that the aggregator was not reset - - if count, ok := agg.(aggregation.Count); ok { - c, err := count.Count() - require.Equal(t, uint64(1), c) - require.NoError(t, err) - } - - if sum, ok := agg.(aggregation.Sum); ok { - s, err := sum.Sum() - require.Equal(t, input, s) - require.NoError(t, err) - } - - if lv, ok := agg.(aggregation.LastValue); ok { - v, _, err := lv.LastValue() - require.Equal(t, input, v) - require.NoError(t, err) - } - }) - }) -} diff --git a/sdk/metric/aggregator/exponential/README.md b/sdk/metric/aggregator/exponential/README.md deleted file mode 100644 index 490e1147557..00000000000 --- a/sdk/metric/aggregator/exponential/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Base-2 Exponential Histogram - -## Design - -This document is a placeholder for future Aggregator, once seen in [PR -2393](https://github.com/open-telemetry/opentelemetry-go/pull/2393). - -Only the mapping functions have been made available at this time. The -equations tested here are specified in the [data model for Exponential -Histogram data points](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#exponentialhistogram). - -### Mapping function - -There are two mapping functions used, depending on the sign of the -scale. Negative and zero scales use the `mapping/exponent` mapping -function, which computes the bucket index directly from the bits of -the `float64` exponent. This mapping function is used with scale `-10 -<= scale <= 0`. Scales smaller than -10 map the entire normal -`float64` number range into a single bucket, thus are not considered -useful. - -The `mapping/logarithm` mapping function uses `math.Log(value)` times -the scaling factor `math.Ldexp(math.Log2E, scale)`. This mapping -function is used with `0 < scale <= 20`. The maximum scale is -selected because at scale 21, simply, it becomes difficult to test -correctness--at this point `math.MaxFloat64` maps to index -`math.MaxInt32` and the `math/big` logic used in testing breaks down. diff --git a/sdk/metric/aggregator/exponential/benchmark_test.go b/sdk/metric/aggregator/exponential/benchmark_test.go deleted file mode 100644 index fd0ce7e41aa..00000000000 --- a/sdk/metric/aggregator/exponential/benchmark_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package exponential - -import ( - "fmt" - "math/rand" - "testing" - - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/logarithm" -) - -func benchmarkMapping(b *testing.B, name string, mapper mapping.Mapping) { - b.Run(fmt.Sprintf("mapping_%s", name), func(b *testing.B) { - src := rand.New(rand.NewSource(54979)) - for i := 0; i < b.N; i++ { - _ = mapper.MapToIndex(1 + src.Float64()) - } - }) -} - -func benchmarkBoundary(b *testing.B, name string, mapper mapping.Mapping) { - b.Run(fmt.Sprintf("boundary_%s", name), func(b *testing.B) { - src := rand.New(rand.NewSource(54979)) - for i := 0; i < b.N; i++ { - _, _ = mapper.LowerBoundary(int32(src.Int63())) - } - }) -} - -// An earlier draft of this benchmark included a lookup-table based -// implementation: -// https://github.com/open-telemetry/opentelemetry-go-contrib/pull/1353 -// That mapping function uses O(2^scale) extra space and falls -// somewhere between the exponent and logarithm methods compared here. -// In the test, lookuptable was 40% faster than logarithm, which did -// not justify the significant extra complexity. - -// Benchmarks the MapToIndex function. -func BenchmarkMapping(b *testing.B) { - em, _ := exponent.NewMapping(-1) - lm, _ := logarithm.NewMapping(1) - benchmarkMapping(b, "exponent", em) - benchmarkMapping(b, "logarithm", lm) -} - -// Benchmarks the LowerBoundary function. -func BenchmarkReverseMapping(b *testing.B) { - em, _ := exponent.NewMapping(-1) - lm, _ := logarithm.NewMapping(1) - benchmarkBoundary(b, "exponent", em) - benchmarkBoundary(b, "logarithm", lm) -} diff --git a/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go b/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go deleted file mode 100644 index 3daec4b5a18..00000000000 --- a/sdk/metric/aggregator/exponential/mapping/exponent/exponent.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package exponent // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/exponent" - -import ( - "fmt" - "math" - - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" -) - -const ( - // MinScale defines the point at which the exponential mapping - // function becomes useless for float64. With scale -10, ignoring - // subnormal values, bucket indices range from -1 to 1. - MinScale int32 = -10 - - // MaxScale is the largest scale supported in this code. Use - // ../logarithm for larger scales. - MaxScale int32 = 0 -) - -type exponentMapping struct { - shift uint8 // equals negative scale -} - -// exponentMapping is used for negative scales, effectively a -// mapping of the base-2 logarithm of the exponent. -var prebuiltMappings = [-MinScale + 1]exponentMapping{ - {10}, - {9}, - {8}, - {7}, - {6}, - {5}, - {4}, - {3}, - {2}, - {1}, - {0}, -} - -// NewMapping constructs an exponential mapping function, used for scales <= 0. -func NewMapping(scale int32) (mapping.Mapping, error) { - if scale > MaxScale { - return nil, fmt.Errorf("exponent mapping requires scale <= 0") - } - if scale < MinScale { - return nil, fmt.Errorf("scale too low") - } - return &prebuiltMappings[scale-MinScale], nil -} - -// minNormalLowerBoundaryIndex is the largest index such that -// base**index is <= MinValue. A histogram bucket with this index -// covers the range (base**index, base**(index+1)], including -// MinValue. -func (e *exponentMapping) minNormalLowerBoundaryIndex() int32 { - idx := int32(internal.MinNormalExponent) >> e.shift - if e.shift < 2 { - // For scales -1 and 0 the minimum value 2**-1022 - // is a power-of-two multiple, meaning it belongs - // to the index one less. - idx-- - } - return idx -} - -// maxNormalLowerBoundaryIndex is the index such that base**index -// equals the largest representable boundary. A histogram bucket with this -// index covers the range (0x1p+1024/base, 0x1p+1024], which includes -// MaxValue; note that this bucket is incomplete, since the upper -// boundary cannot be represented. One greater than this index -// corresponds with the bucket containing values > 0x1p1024. -func (e *exponentMapping) maxNormalLowerBoundaryIndex() int32 { - return int32(internal.MaxNormalExponent) >> e.shift -} - -// MapToIndex implements mapping.Mapping. -func (e *exponentMapping) MapToIndex(value float64) int32 { - // Note: we can assume not a 0, Inf, or NaN; positive sign bit. - if value < internal.MinValue { - return e.minNormalLowerBoundaryIndex() - } - - // Extract the raw exponent. - rawExp := internal.GetNormalBase2(value) - - // In case the value is an exact power of two, compute a - // correction of -1: - correction := int32((internal.GetSignificand(value) - 1) >> internal.SignificandWidth) - - // Note: bit-shifting does the right thing for negative - // exponents, e.g., -1 >> 1 == -1. - return (rawExp + correction) >> e.shift -} - -// LowerBoundary implements mapping.Mapping. -func (e *exponentMapping) LowerBoundary(index int32) (float64, error) { - if min := e.minNormalLowerBoundaryIndex(); index < min { - return 0, mapping.ErrUnderflow - } - - if max := e.maxNormalLowerBoundaryIndex(); index > max { - return 0, mapping.ErrOverflow - } - - return math.Ldexp(1, int(index<> -scale) - 1 - require.Equal(t, index, int32(maxIndex)) - - // The index maps to a finite boundary. - bound, err := m.LowerBoundary(index) - require.NoError(t, err) - - require.Equal(t, bound, roundedBoundary(scale, maxIndex)) - - // One larger index will overflow. - _, err = m.LowerBoundary(index + 1) - require.Equal(t, err, mapping.ErrOverflow) - } -} - -// TestExponentIndexMin ensures that for every valid scale, the -// smallest normal number and all smaller numbers map to the correct -// index, which is that of the smallest normal number. -// -// Tests that the lower boundary of the smallest bucket is correct, -// even when that number is subnormal. -func TestExponentIndexMin(t *testing.T) { - for scale := MinScale; scale <= MaxScale; scale++ { - m, err := NewMapping(scale) - require.NoError(t, err) - - // Test the smallest normal value. - minIndex := m.MapToIndex(MinValue) - - boundary, err := m.LowerBoundary(minIndex) - require.NoError(t, err) - - // The correct index for MinValue depends on whether - // 2**(-scale) evenly divides -1022. This is true for - // scales -1 and 0. - correctMinIndex := int64(MinNormalExponent) >> -scale - if MinNormalExponent%(int32(1)<<-scale) == 0 { - correctMinIndex-- - } - - require.Greater(t, correctMinIndex, int64(math.MinInt32)) - require.Equal(t, int32(correctMinIndex), minIndex) - - correctBoundary := roundedBoundary(scale, int32(correctMinIndex)) - - require.Equal(t, correctBoundary, boundary) - require.Greater(t, roundedBoundary(scale, int32(correctMinIndex+1)), boundary) - - // Subnormal values map to the min index: - require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/2)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/3)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(MinValue/100)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1050)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1073)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1.1p-1073)) - require.Equal(t, int32(correctMinIndex), m.MapToIndex(0x1p-1074)) - - // One smaller index will underflow. - _, err = m.LowerBoundary(minIndex - 1) - require.Equal(t, err, mapping.ErrUnderflow) - - // Next value above MinValue (not a power of two). - minPlus1Index := m.MapToIndex(math.Nextafter(MinValue, math.Inf(+1))) - - // The following boundary equation always works for - // non-powers of two (same as correctMinIndex before its - // power-of-two correction, above). - correctMinPlus1Index := int64(MinNormalExponent) >> -scale - require.Equal(t, int32(correctMinPlus1Index), minPlus1Index) - } -} diff --git a/sdk/metric/aggregator/exponential/mapping/internal/float64.go b/sdk/metric/aggregator/exponential/mapping/internal/float64.go deleted file mode 100644 index 6bac47fa698..00000000000 --- a/sdk/metric/aggregator/exponential/mapping/internal/float64.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" - -import "math" - -const ( - // SignificandWidth is the size of an IEEE 754 double-precision - // floating-point significand. - SignificandWidth = 52 - // ExponentWidth is the size of an IEEE 754 double-precision - // floating-point exponent. - ExponentWidth = 11 - - // SignificandMask is the mask for the significand of an IEEE 754 - // double-precision floating-point value: 0xFFFFFFFFFFFFF. - SignificandMask = 1<> SignificandWidth - return int32(rawExponent - ExponentBias) -} - -// GetSignificand returns the 52 bit (unsigned) significand as a -// signed value. -func GetSignificand(value float64) int64 { - return int64(math.Float64bits(value)) & SignificandMask -} diff --git a/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go b/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go deleted file mode 100644 index 7c86391744c..00000000000 --- a/sdk/metric/aggregator/exponential/mapping/internal/float64_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -// Tests that GetNormalBase2 returns the base-2 exponent as documented, unlike -// math.Frexp. -func TestGetNormalBase2(t *testing.T) { - require.Equal(t, int32(-1022), MinNormalExponent) - require.Equal(t, int32(+1023), MaxNormalExponent) - - require.Equal(t, MaxNormalExponent, GetNormalBase2(0x1p+1023)) - require.Equal(t, int32(1022), GetNormalBase2(0x1p+1022)) - - require.Equal(t, int32(0), GetNormalBase2(1)) - - require.Equal(t, int32(-1021), GetNormalBase2(0x1p-1021)) - require.Equal(t, int32(-1022), GetNormalBase2(0x1p-1022)) - - // Subnormals below this point - require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1023)) - require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1024)) - require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1025)) - require.Equal(t, int32(-1023), GetNormalBase2(0x1p-1074)) -} - -func TestGetSignificand(t *testing.T) { - // The number 1.5 has a single most-significant bit set, i.e., 1<<51. - require.Equal(t, int64(1)<<(SignificandWidth-1), GetSignificand(1.5)) -} diff --git a/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go b/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go deleted file mode 100644 index 28ab8436e2b..00000000000 --- a/sdk/metric/aggregator/exponential/mapping/logarithm/logarithm.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package logarithm // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/logarithm" - -import ( - "fmt" - "math" - "sync" - - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" - "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/internal" -) - -const ( - // MinScale ensures that the ../exponent mapper is used for - // zero and negative scale values. Do not use the logarithm - // mapper for scales <= 0. - MinScale int32 = 1 - - // MaxScale is selected as the largest scale that is possible - // in current code, considering there are 10 bits of base-2 - // exponent combined with scale-bits of range. At this scale, - // the growth factor is 0.0000661%. - // - // Scales larger than 20 complicate the logic in cmd/prebuild, - // because math/big overflows when exponent is math.MaxInt32 - // (== the index of math.MaxFloat64 at scale=21), - // - // At scale=20, index values are in the interval [-0x3fe00000, - // 0x3fffffff], having 31 bits of information. This is - // sensible given that the OTLP exponential histogram data - // point uses a signed 32 bit integer for indices. - MaxScale int32 = 20 - - // MinValue is the smallest normal number. - MinValue = internal.MinValue - - // MaxValue is the largest normal number. - MaxValue = internal.MaxValue -) - -// logarithmMapping contains the constants used to implement the -// exponential mapping function for a particular scale > 0. -type logarithmMapping struct { - // scale is between MinScale and MaxScale. The exponential - // base is defined as 2**(2**(-scale)). - scale int32 - - // scaleFactor is used and computed as follows: - // index = log(value) / log(base) - // = log(value) / log(2^(2^-scale)) - // = log(value) / (2^-scale * log(2)) - // = log(value) * (1/log(2) * 2^scale) - // = log(value) * scaleFactor - // where: - // scaleFactor = (1/log(2) * 2^scale) - // = math.Log2E * math.Exp2(scale) - // = math.Ldexp(math.Log2E, scale) - // Because multiplication is faster than division, we define scaleFactor as a multiplier. - // This implementation was copied from a Java prototype. See: - // https://github.com/newrelic-experimental/newrelic-sketch-java/blob/1ce245713603d61ba3a4510f6df930a5479cd3f6/src/main/java/com/newrelic/nrsketch/indexer/LogIndexer.java - // for the equations used here. - scaleFactor float64 - - // log(boundary) = index * log(base) - // log(boundary) = index * log(2^(2^-scale)) - // log(boundary) = index * 2^-scale * log(2) - // boundary = exp(index * inverseFactor) - // where: - // inverseFactor = 2^-scale * log(2) - // = math.Ldexp(math.Ln2, -scale) - inverseFactor float64 -} - -var ( - _ mapping.Mapping = &logarithmMapping{} - - prebuiltMappingsLock sync.Mutex - prebuiltMappings = map[int32]*logarithmMapping{} -) - -// NewMapping constructs a logarithm mapping function, used for scales > 0. -func NewMapping(scale int32) (mapping.Mapping, error) { - // An assumption used in this code is that scale is > 0. If - // scale is <= 0 it's better to use the exponent mapping. - if scale < MinScale || scale > MaxScale { - // scale 20 can represent the entire float64 range - // with a 30 bit index, and we don't handle larger - // scales to simplify range tests in this package. - return nil, fmt.Errorf("scale out of bounds") - } - prebuiltMappingsLock.Lock() - defer prebuiltMappingsLock.Unlock() - - if p := prebuiltMappings[scale]; p != nil { - return p, nil - } - l := &logarithmMapping{ - scale: scale, - scaleFactor: math.Ldexp(math.Log2E, int(scale)), - inverseFactor: math.Ldexp(math.Ln2, int(-scale)), - } - prebuiltMappings[scale] = l - return l, nil -} - -// minNormalLowerBoundaryIndex is the index such that base**index equals -// MinValue. A histogram bucket with this index covers the range -// (MinValue, MinValue*base]. One less than this index corresponds -// with the bucket containing values <= MinValue. -func (l *logarithmMapping) minNormalLowerBoundaryIndex() int32 { - return int32(internal.MinNormalExponent << l.scale) -} - -// maxNormalLowerBoundaryIndex is the index such that base**index equals the -// greatest representable lower boundary. A histogram bucket with this -// index covers the range (0x1p+1024/base, 0x1p+1024], which includes -// MaxValue; note that this bucket is incomplete, since the upper -// boundary cannot be represented. One greater than this index -// corresponds with the bucket containing values > 0x1p1024. -func (l *logarithmMapping) maxNormalLowerBoundaryIndex() int32 { - return (int32(internal.MaxNormalExponent+1) << l.scale) - 1 -} - -// MapToIndex implements mapping.Mapping. -func (l *logarithmMapping) MapToIndex(value float64) int32 { - // Note: we can assume not a 0, Inf, or NaN; positive sign bit. - if value <= MinValue { - return l.minNormalLowerBoundaryIndex() - 1 - } - - // Exact power-of-two correctness: an optional special case. - if internal.GetSignificand(value) == 0 { - exp := internal.GetNormalBase2(value) - return (exp << l.scale) - 1 - } - - // Non-power of two cases. Use Floor(x) to round the scaled - // logarithm. We could use Ceil(x)-1 to achieve the same - // result, though Ceil() is typically defined as -Floor(-x) - // and typically not performed in hardware, so this is likely - // less code. - index := int32(math.Floor(math.Log(value) * l.scaleFactor)) - - if max := l.maxNormalLowerBoundaryIndex(); index >= max { - return max - } - return index -} - -// LowerBoundary implements mapping.Mapping. -func (l *logarithmMapping) LowerBoundary(index int32) (float64, error) { - if max := l.maxNormalLowerBoundaryIndex(); index >= max { - if index == max { - // Note that the equation on the last line of this - // function returns +Inf. Use the alternate equation. - return 2 * math.Exp(float64(index-(int32(1)< 0; i-- { - f = (&big.Float{}).Sqrt(f) - } - - result, _ := f.Float64() - return result -} - -// TestLogarithmIndexMax ensures that for every valid scale, MaxFloat -// maps into the correct maximum index. Also tests that the reverse -// lookup does not produce infinity and the following index produces -// an overflow error. -func TestLogarithmIndexMax(t *testing.T) { - for scale := MinScale; scale <= MaxScale; scale++ { - m, err := NewMapping(scale) - require.NoError(t, err) - - index := m.MapToIndex(MaxValue) - - // Correct max index is one less than the first index - // that overflows math.MaxFloat64, i.e., one less than - // the index of +Inf. - maxIndex64 := (int64(MaxNormalExponent+1) << scale) - 1 - require.Less(t, maxIndex64, int64(math.MaxInt32)) - require.Equal(t, index, int32(maxIndex64)) - - // The index maps to a finite boundary near MaxFloat. - bound, err := m.LowerBoundary(index) - require.NoError(t, err) - - base, _ := m.LowerBoundary(1) - - require.Less(t, bound, MaxValue) - - // The expected ratio equals the base factor. - require.InEpsilon(t, (MaxValue-bound)/bound, base-1, 1e-6) - - // One larger index will overflow. - _, err = m.LowerBoundary(index + 1) - require.Equal(t, err, mapping.ErrOverflow) - - // Two larger will overflow. - _, err = m.LowerBoundary(index + 2) - require.Equal(t, err, mapping.ErrOverflow) - } -} - -// TestLogarithmIndexMin ensures that for every valid scale, the -// smallest normal number and all smaller numbers map to the correct -// index. -func TestLogarithmIndexMin(t *testing.T) { - for scale := MinScale; scale <= MaxScale; scale++ { - m, err := NewMapping(scale) - require.NoError(t, err) - - minIndex := m.MapToIndex(MinValue) - - correctMinIndex := (int64(MinNormalExponent) << scale) - 1 - require.Greater(t, correctMinIndex, int64(math.MinInt32)) - require.Equal(t, minIndex, int32(correctMinIndex)) - - correctMapped := roundedBoundary(scale, int32(correctMinIndex)) - require.Less(t, correctMapped, MinValue) - - correctMappedUpper := roundedBoundary(scale, int32(correctMinIndex+1)) - require.Equal(t, correctMappedUpper, MinValue) - - mapped, err := m.LowerBoundary(minIndex + 1) - require.NoError(t, err) - require.InEpsilon(t, mapped, MinValue, 1e-6) - - // Subnormal values map to the min index: - require.Equal(t, m.MapToIndex(MinValue/2), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(MinValue/3), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(MinValue/100), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1050), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1073), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1.1p-1073), int32(correctMinIndex)) - require.Equal(t, m.MapToIndex(0x1p-1074), int32(correctMinIndex)) - - // All subnormal values map and MinValue to the min index: - mappedLower, err := m.LowerBoundary(minIndex) - require.NoError(t, err) - require.InEpsilon(t, correctMapped, mappedLower, 1e-6) - - // One smaller index will underflow. - _, err = m.LowerBoundary(minIndex - 1) - require.Equal(t, err, mapping.ErrUnderflow) - } -} - -// TestExponentIndexMax ensures that for every valid scale, MaxFloat -// maps into the correct maximum index. Also tests that the reverse -// lookup does not produce infinity and the following index produces -// an overflow error. -func TestExponentIndexMax(t *testing.T) { - for scale := MinScale; scale <= MaxScale; scale++ { - m, err := NewMapping(scale) - require.NoError(t, err) - - index := m.MapToIndex(MaxValue) - - // Correct max index is one less than the first index - // that overflows math.MaxFloat64, i.e., one less than - // the index of +Inf. - maxIndex64 := (int64(MaxNormalExponent+1) << scale) - 1 - require.Less(t, maxIndex64, int64(math.MaxInt32)) - require.Equal(t, index, int32(maxIndex64)) - - // The index maps to a finite boundary near MaxFloat. - bound, err := m.LowerBoundary(index) - require.NoError(t, err) - - base, _ := m.LowerBoundary(1) - - require.Less(t, bound, MaxValue) - - // The expected ratio equals the base factor. - require.InEpsilon(t, (MaxValue-bound)/bound, base-1, 1e-6) - - // One larger index will overflow. - _, err = m.LowerBoundary(index + 1) - require.Equal(t, err, mapping.ErrOverflow) - } -} diff --git a/sdk/metric/aggregator/exponential/mapping/mapping.go b/sdk/metric/aggregator/exponential/mapping/mapping.go deleted file mode 100644 index 19bf9df72d1..00000000000 --- a/sdk/metric/aggregator/exponential/mapping/mapping.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mapping // import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping" - -import "fmt" - -// Mapping is the interface of an exponential histogram mapper. -type Mapping interface { - // MapToIndex maps positive floating point values to indexes - // corresponding to Scale(). Implementations are not expected - // to handle zeros, +Inf, NaN, or negative values. - MapToIndex(value float64) int32 - - // LowerBoundary returns the lower boundary of a given bucket - // index. The index is expected to map onto a range that is - // at least partially inside the range of normalized floating - // point values. If the corresponding bucket's upper boundary - // is less than or equal to 0x1p-1022, ErrUnderflow will be - // returned. If the corresponding bucket's lower boundary is - // greater than math.MaxFloat64, ErrOverflow will be returned. - LowerBoundary(index int32) (float64, error) - - // Scale returns the parameter that controls the resolution of - // this mapping. For details see: - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/datamodel.md#exponential-scale - Scale() int32 -} - -var ( - // ErrUnderflow is returned when computing the lower boundary - // of an index that maps into a denormalized floating point value. - ErrUnderflow = fmt.Errorf("underflow") - // ErrOverflow is returned when computing the lower boundary - // of an index that maps into +Inf. - ErrOverflow = fmt.Errorf("overflow") -) diff --git a/sdk/metric/aggregator/histogram/benchmark_test.go b/sdk/metric/aggregator/histogram/benchmark_test.go deleted file mode 100644 index 597af3eb714..00000000000 --- a/sdk/metric/aggregator/histogram/benchmark_test.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package histogram_test - -import ( - "context" - "math/rand" - "testing" - - "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -const inputRange = 1e6 - -func benchmarkHistogramSearchFloat64(b *testing.B, size int) { - boundaries := make([]float64, size) - - for i := range boundaries { - boundaries[i] = rand.Float64() * inputRange - } - - values := make([]float64, b.N) - for i := range values { - values[i] = rand.Float64() * inputRange - } - desc := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, number.Float64Kind) - agg := &histogram.New(1, desc, histogram.WithExplicitBoundaries(boundaries))[0] - ctx := context.Background() - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - _ = agg.Update(ctx, number.NewFloat64Number(values[i]), desc) - } -} - -func BenchmarkHistogramSearchFloat64_1(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 1) -} -func BenchmarkHistogramSearchFloat64_8(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 8) -} -func BenchmarkHistogramSearchFloat64_16(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 16) -} -func BenchmarkHistogramSearchFloat64_32(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 32) -} -func BenchmarkHistogramSearchFloat64_64(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 64) -} -func BenchmarkHistogramSearchFloat64_128(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 128) -} -func BenchmarkHistogramSearchFloat64_256(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 256) -} -func BenchmarkHistogramSearchFloat64_512(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 512) -} -func BenchmarkHistogramSearchFloat64_1024(b *testing.B) { - benchmarkHistogramSearchFloat64(b, 1024) -} - -func benchmarkHistogramSearchInt64(b *testing.B, size int) { - boundaries := make([]float64, size) - - for i := range boundaries { - boundaries[i] = rand.Float64() * inputRange - } - - values := make([]int64, b.N) - for i := range values { - values[i] = int64(rand.Float64() * inputRange) - } - desc := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, number.Int64Kind) - agg := &histogram.New(1, desc, histogram.WithExplicitBoundaries(boundaries))[0] - ctx := context.Background() - - b.ReportAllocs() - b.ResetTimer() - - for i := 0; i < b.N; i++ { - _ = agg.Update(ctx, number.NewInt64Number(values[i]), desc) - } -} - -func BenchmarkHistogramSearchInt64_1(b *testing.B) { - benchmarkHistogramSearchInt64(b, 1) -} -func BenchmarkHistogramSearchInt64_8(b *testing.B) { - benchmarkHistogramSearchInt64(b, 8) -} -func BenchmarkHistogramSearchInt64_16(b *testing.B) { - benchmarkHistogramSearchInt64(b, 16) -} -func BenchmarkHistogramSearchInt64_32(b *testing.B) { - benchmarkHistogramSearchInt64(b, 32) -} -func BenchmarkHistogramSearchInt64_64(b *testing.B) { - benchmarkHistogramSearchInt64(b, 64) -} -func BenchmarkHistogramSearchInt64_128(b *testing.B) { - benchmarkHistogramSearchInt64(b, 128) -} -func BenchmarkHistogramSearchInt64_256(b *testing.B) { - benchmarkHistogramSearchInt64(b, 256) -} -func BenchmarkHistogramSearchInt64_512(b *testing.B) { - benchmarkHistogramSearchInt64(b, 512) -} -func BenchmarkHistogramSearchInt64_1024(b *testing.B) { - benchmarkHistogramSearchInt64(b, 1024) -} diff --git a/sdk/metric/aggregator/histogram/histogram.go b/sdk/metric/aggregator/histogram/histogram.go deleted file mode 100644 index 69722ace113..00000000000 --- a/sdk/metric/aggregator/histogram/histogram.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package histogram // import "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - -import ( - "context" - "sort" - "sync" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Note: This code uses a Mutex to govern access to the exclusive -// aggregator state. This is in contrast to a lock-free approach -// (as in the Go prometheus client) that was reverted here: -// https://github.com/open-telemetry/opentelemetry-go/pull/669 - -type ( - // Aggregator observe events and counts them in pre-determined buckets. - // It also calculates the sum and count of all events. - Aggregator struct { - lock sync.Mutex - boundaries []float64 - kind number.Kind - state *state - } - - // config describes how the histogram is aggregated. - config struct { - // explicitBoundaries support arbitrary bucketing schemes. This - // is the general case. - explicitBoundaries []float64 - } - - // Option configures a histogram config. - Option interface { - // apply sets one or more config fields. - apply(*config) - } - - // state represents the state of a histogram, consisting of - // the sum and counts for all observed values and - // the less than equal bucket count for the pre-determined boundaries. - state struct { - bucketCounts []uint64 - sum number.Number - count uint64 - } -) - -// WithExplicitBoundaries sets the ExplicitBoundaries configuration option of a config. -func WithExplicitBoundaries(explicitBoundaries []float64) Option { - return explicitBoundariesOption{explicitBoundaries} -} - -type explicitBoundariesOption struct { - boundaries []float64 -} - -func (o explicitBoundariesOption) apply(config *config) { - config.explicitBoundaries = o.boundaries -} - -// defaultExplicitBoundaries have been copied from prometheus.DefBuckets. -// -// Note we anticipate the use of a high-precision histogram sketch as -// the standard histogram aggregator for OTLP export. -// (https://github.com/open-telemetry/opentelemetry-specification/issues/982). -var defaultFloat64ExplicitBoundaries = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10} - -// defaultInt64ExplicitBoundaryMultiplier determines the default -// integer histogram boundaries. -const defaultInt64ExplicitBoundaryMultiplier = 1e6 - -// defaultInt64ExplicitBoundaries applies a multiplier to the default -// float64 boundaries: [ 5K, 10K, 25K, ..., 2.5M, 5M, 10M ]. -var defaultInt64ExplicitBoundaries = func(bounds []float64) (asint []float64) { - for _, f := range bounds { - asint = append(asint, defaultInt64ExplicitBoundaryMultiplier*f) - } - return -}(defaultFloat64ExplicitBoundaries) - -var _ aggregator.Aggregator = &Aggregator{} -var _ aggregation.Sum = &Aggregator{} -var _ aggregation.Count = &Aggregator{} -var _ aggregation.Histogram = &Aggregator{} - -// New returns a new aggregator for computing Histograms. -// -// A Histogram observe events and counts them in pre-defined buckets. -// And also provides the total sum and count of all observations. -// -// Note that this aggregator maintains each value using independent -// atomic operations, which introduces the possibility that -// checkpoints are inconsistent. -func New(cnt int, desc *sdkapi.Descriptor, opts ...Option) []Aggregator { - var cfg config - - if desc.NumberKind() == number.Int64Kind { - cfg.explicitBoundaries = defaultInt64ExplicitBoundaries - } else { - cfg.explicitBoundaries = defaultFloat64ExplicitBoundaries - } - - for _, opt := range opts { - opt.apply(&cfg) - } - - aggs := make([]Aggregator, cnt) - - // Boundaries MUST be ordered otherwise the histogram could not - // be properly computed. - sortedBoundaries := make([]float64, len(cfg.explicitBoundaries)) - - copy(sortedBoundaries, cfg.explicitBoundaries) - sort.Float64s(sortedBoundaries) - - for i := range aggs { - aggs[i] = Aggregator{ - kind: desc.NumberKind(), - boundaries: sortedBoundaries, - } - aggs[i].state = aggs[i].newState() - } - return aggs -} - -// Aggregation returns an interface for reading the state of this aggregator. -func (c *Aggregator) Aggregation() aggregation.Aggregation { - return c -} - -// Kind returns aggregation.HistogramKind. -func (c *Aggregator) Kind() aggregation.Kind { - return aggregation.HistogramKind -} - -// Sum returns the sum of all values in the checkpoint. -func (c *Aggregator) Sum() (number.Number, error) { - return c.state.sum, nil -} - -// Count returns the number of values in the checkpoint. -func (c *Aggregator) Count() (uint64, error) { - return c.state.count, nil -} - -// Histogram returns the count of events in pre-determined buckets. -func (c *Aggregator) Histogram() (aggregation.Buckets, error) { - return aggregation.Buckets{ - Boundaries: c.boundaries, - Counts: c.state.bucketCounts, - }, nil -} - -// SynchronizedMove saves the current state into oa and resets the current state to -// the empty set. Since no locks are taken, there is a chance that -// the independent Sum, Count and Bucket Count are not consistent with each -// other. -func (c *Aggregator) SynchronizedMove(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { - o, _ := oa.(*Aggregator) - - if oa != nil && o == nil { - return aggregator.NewInconsistentAggregatorError(c, oa) - } - - if o != nil { - // Swap case: This is the ordinary case for a - // synchronous instrument, where the SDK allocates two - // Aggregators and lock contention is anticipated. - // Reset the target state before swapping it under the - // lock below. - o.clearState() - } - - c.lock.Lock() - if o != nil { - c.state, o.state = o.state, c.state - } else { - // No swap case: This is the ordinary case for an - // asynchronous instrument, where the SDK allocates a - // single Aggregator and there is no anticipated lock - // contention. - c.clearState() - } - c.lock.Unlock() - - return nil -} - -func (c *Aggregator) newState() *state { - return &state{ - bucketCounts: make([]uint64, len(c.boundaries)+1), - } -} - -func (c *Aggregator) clearState() { - for i := range c.state.bucketCounts { - c.state.bucketCounts[i] = 0 - } - c.state.sum = 0 - c.state.count = 0 -} - -// Update adds the recorded measurement to the current data set. -func (c *Aggregator) Update(_ context.Context, n number.Number, desc *sdkapi.Descriptor) error { - kind := desc.NumberKind() - asFloat := n.CoerceToFloat64(kind) - - bucketID := len(c.boundaries) - for i, boundary := range c.boundaries { - if asFloat < boundary { - bucketID = i - break - } - } - // Note: Binary-search was compared using the benchmarks. The following - // code is equivalent to the linear search above: - // - // bucketID := sort.Search(len(c.boundaries), func(i int) bool { - // return asFloat < c.boundaries[i] - // }) - // - // The binary search wins for very large boundary sets, but - // the linear search performs better up through arrays between - // 256 and 512 elements, which is a relatively large histogram, so we - // continue to prefer linear search. - - c.lock.Lock() - defer c.lock.Unlock() - - c.state.count++ - c.state.sum.AddNumber(kind, n) - c.state.bucketCounts[bucketID]++ - - return nil -} - -// Merge combines two histograms that have the same buckets into a single one. -func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { - o, _ := oa.(*Aggregator) - if o == nil { - return aggregator.NewInconsistentAggregatorError(c, oa) - } - - c.state.sum.AddNumber(desc.NumberKind(), o.state.sum) - c.state.count += o.state.count - - for i := 0; i < len(c.state.bucketCounts); i++ { - c.state.bucketCounts[i] += o.state.bucketCounts[i] - } - return nil -} diff --git a/sdk/metric/aggregator/histogram/histogram_test.go b/sdk/metric/aggregator/histogram/histogram_test.go deleted file mode 100644 index d19940ac54f..00000000000 --- a/sdk/metric/aggregator/histogram/histogram_test.go +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package histogram_test - -import ( - "context" - "math" - "math/rand" - "sort" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -const count = 100 - -type policy struct { - name string - absolute bool - sign func() int -} - -var ( - positiveOnly = policy{ - name: "absolute", - absolute: true, - sign: func() int { return +1 }, - } - negativeOnly = policy{ - name: "negative", - absolute: false, - sign: func() int { return -1 }, - } - positiveAndNegative = policy{ - name: "positiveAndNegative", - absolute: false, - sign: func() int { - if rand.Uint32() > math.MaxUint32/2 { - return -1 - } - return 1 - }, - } - - testBoundaries = []float64{500, 250, 750} -) - -func new2(desc *sdkapi.Descriptor, options ...histogram.Option) (_, _ *histogram.Aggregator) { - alloc := histogram.New(2, desc, options...) - return &alloc[0], &alloc[1] -} - -func new4(desc *sdkapi.Descriptor, options ...histogram.Option) (_, _, _, _ *histogram.Aggregator) { - alloc := histogram.New(4, desc, options...) - return &alloc[0], &alloc[1], &alloc[2], &alloc[3] -} - -func checkZero(t *testing.T, agg *histogram.Aggregator, desc *sdkapi.Descriptor) { - asum, err := agg.Sum() - require.Equal(t, number.Number(0), asum, "Empty checkpoint sum = 0") - require.NoError(t, err) - - count, err := agg.Count() - require.Equal(t, uint64(0), count, "Empty checkpoint count = 0") - require.NoError(t, err) - - buckets, err := agg.Histogram() - require.NoError(t, err) - - require.Equal(t, len(buckets.Counts), len(testBoundaries)+1, "There should be b + 1 counts, where b is the number of boundaries") - for i, bCount := range buckets.Counts { - require.Equal(t, uint64(0), uint64(bCount), "Bucket #%d must have 0 observed values", i) - } -} - -func TestHistogramAbsolute(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - testHistogram(t, profile, positiveOnly) - }) -} - -func TestHistogramNegativeOnly(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - testHistogram(t, profile, negativeOnly) - }) -} - -func TestHistogramPositiveAndNegative(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - testHistogram(t, profile, positiveAndNegative) - }) -} - -// Validates count, sum and buckets for a given profile and policy. -func testHistogram(t *testing.T, profile aggregatortest.Profile, policy policy) { - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - agg, ckpt := new2(descriptor, histogram.WithExplicitBoundaries(testBoundaries)) - - // This needs to repeat at least 3 times to uncover a failure to reset - // for the overall sum and count fields, since the third time through - // is the first time a `histogram.state` object is reused. - for repeat := 0; repeat < 3; repeat++ { - all := aggregatortest.NewNumbers(profile.NumberKind) - - for i := 0; i < count; i++ { - x := profile.Random(policy.sign()) - all.Append(x) - aggregatortest.CheckedUpdate(t, agg, x, descriptor) - } - - require.NoError(t, agg.SynchronizedMove(ckpt, descriptor)) - - checkZero(t, agg, descriptor) - - checkHistogram(t, all, profile, ckpt) - } -} - -func TestHistogramInitial(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - agg := &histogram.New(1, descriptor, histogram.WithExplicitBoundaries(testBoundaries))[0] - buckets, err := agg.Histogram() - - require.NoError(t, err) - require.Equal(t, len(buckets.Counts), len(testBoundaries)+1) - require.Equal(t, len(buckets.Boundaries), len(testBoundaries)) - }) -} - -func TestHistogramMerge(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - agg1, agg2, ckpt1, ckpt2 := new4(descriptor, histogram.WithExplicitBoundaries(testBoundaries)) - - all := aggregatortest.NewNumbers(profile.NumberKind) - - for i := 0; i < count; i++ { - x := profile.Random(+1) - all.Append(x) - aggregatortest.CheckedUpdate(t, agg1, x, descriptor) - } - for i := 0; i < count; i++ { - x := profile.Random(+1) - all.Append(x) - aggregatortest.CheckedUpdate(t, agg2, x, descriptor) - } - - require.NoError(t, agg1.SynchronizedMove(ckpt1, descriptor)) - require.NoError(t, agg2.SynchronizedMove(ckpt2, descriptor)) - - aggregatortest.CheckedMerge(t, ckpt1, ckpt2, descriptor) - - checkHistogram(t, all, profile, ckpt1) - }) -} - -func TestHistogramNotSet(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - agg, ckpt := new2(descriptor, histogram.WithExplicitBoundaries(testBoundaries)) - - err := agg.SynchronizedMove(ckpt, descriptor) - require.NoError(t, err) - - checkZero(t, agg, descriptor) - checkZero(t, ckpt, descriptor) - }) -} - -// checkHistogram ensures the correct aggregated state between `all` -// (test aggregator) and `agg` (code under test). -func checkHistogram(t *testing.T, all aggregatortest.Numbers, profile aggregatortest.Profile, agg *histogram.Aggregator) { - all.Sort() - - asum, err := agg.Sum() - require.NoError(t, err) - - sum := all.Sum() - require.InEpsilon(t, - sum.CoerceToFloat64(profile.NumberKind), - asum.CoerceToFloat64(profile.NumberKind), - 0.000000001) - - count, err := agg.Count() - require.NoError(t, err) - require.Equal(t, all.Count(), count) - - buckets, err := agg.Histogram() - require.NoError(t, err) - - require.Equal(t, len(buckets.Counts), len(testBoundaries)+1, - "There should be b + 1 counts, where b is the number of boundaries") - - sortedBoundaries := make([]float64, len(testBoundaries)) - copy(sortedBoundaries, testBoundaries) - - sort.Float64s(sortedBoundaries) - - require.EqualValues(t, sortedBoundaries, buckets.Boundaries) - - counts := make([]uint64, len(sortedBoundaries)+1) - idx := 0 - for _, p := range all.Points() { - for idx < len(sortedBoundaries) && p.CoerceToFloat64(profile.NumberKind) >= sortedBoundaries[idx] { - idx++ - } - counts[idx]++ - } - for i, v := range counts { - bCount := uint64(buckets.Counts[i]) - require.Equal(t, v, bCount, "Wrong bucket #%d count: %v != %v", i, counts, buckets.Counts) - } -} - -func TestSynchronizedMoveReset(t *testing.T) { - aggregatortest.SynchronizedMoveResetTest( - t, - sdkapi.HistogramInstrumentKind, - func(desc *sdkapi.Descriptor) aggregator.Aggregator { - return &histogram.New(1, desc, histogram.WithExplicitBoundaries(testBoundaries))[0] - }, - ) -} - -func TestHistogramDefaultBoundaries(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - ctx := context.Background() - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - agg, ckpt := new2(descriptor) - - bounds := []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10} // len 11 - values := append(bounds, 100) // len 12 - expect := []uint64{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} // len 12 - - for _, value := range values { - var num number.Number - - value -= .001 // Avoid exact boundaries - - if descriptor.NumberKind() == number.Int64Kind { - value *= 1e6 - num = number.NewInt64Number(int64(value)) - } else { - num = number.NewFloat64Number(value) - } - - require.NoError(t, agg.Update(ctx, num, descriptor)) - } - - bucks, err := agg.Histogram() - require.NoError(t, err) - - // Check for proper lengths, 1 count in each bucket. - require.Equal(t, len(values), len(bucks.Counts)) - require.Equal(t, len(bounds), len(bucks.Boundaries)) - require.EqualValues(t, expect, bucks.Counts) - - require.Equal(t, expect, bucks.Counts) - - // Move and repeat the test on `ckpt`. - err = agg.SynchronizedMove(ckpt, descriptor) - require.NoError(t, err) - - bucks, err = ckpt.Histogram() - require.NoError(t, err) - - require.Equal(t, len(values), len(bucks.Counts)) - require.Equal(t, len(bounds), len(bucks.Boundaries)) - require.EqualValues(t, expect, bucks.Counts) - }) -} diff --git a/sdk/metric/aggregator/lastvalue/lastvalue.go b/sdk/metric/aggregator/lastvalue/lastvalue.go deleted file mode 100644 index 17e51faefc1..00000000000 --- a/sdk/metric/aggregator/lastvalue/lastvalue.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package lastvalue // import "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - -import ( - "context" - "sync/atomic" - "time" - "unsafe" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - - // Aggregator aggregates lastValue events. - Aggregator struct { - // value is an atomic pointer to *lastValueData. It is never nil. - value unsafe.Pointer - } - - // lastValueData stores the current value of a lastValue along with - // a sequence number to determine the winner of a race. - lastValueData struct { - // value is the int64- or float64-encoded Set() data - // - // value needs to be aligned for 64-bit atomic operations. - value number.Number - - // timestamp indicates when this record was submitted. This can be - // used to pick a winner when multiple records contain lastValue data - // for the same attributes due to races. - timestamp time.Time - } -) - -var _ aggregator.Aggregator = &Aggregator{} -var _ aggregation.LastValue = &Aggregator{} - -// An unset lastValue has zero timestamp and zero value. -var unsetLastValue = &lastValueData{} - -// New returns a new lastValue aggregator. This aggregator retains the -// last value and timestamp that were recorded. -func New(cnt int) []Aggregator { - aggs := make([]Aggregator, cnt) - for i := range aggs { - aggs[i] = Aggregator{ - value: unsafe.Pointer(unsetLastValue), - } - } - return aggs -} - -// Aggregation returns an interface for reading the state of this aggregator. -func (g *Aggregator) Aggregation() aggregation.Aggregation { - return g -} - -// Kind returns aggregation.LastValueKind. -func (g *Aggregator) Kind() aggregation.Kind { - return aggregation.LastValueKind -} - -// LastValue returns the last-recorded lastValue value and the -// corresponding timestamp. The error value aggregation.ErrNoData -// will be returned if (due to a race condition) the checkpoint was -// computed before the first value was set. -func (g *Aggregator) LastValue() (number.Number, time.Time, error) { - gd := (*lastValueData)(g.value) - if gd == unsetLastValue { - return 0, time.Time{}, aggregation.ErrNoData - } - return gd.value.AsNumber(), gd.timestamp, nil -} - -// SynchronizedMove atomically saves the current value. -func (g *Aggregator) SynchronizedMove(oa aggregator.Aggregator, _ *sdkapi.Descriptor) error { - if oa == nil { - atomic.StorePointer(&g.value, unsafe.Pointer(unsetLastValue)) - return nil - } - o, _ := oa.(*Aggregator) - if o == nil { - return aggregator.NewInconsistentAggregatorError(g, oa) - } - o.value = atomic.SwapPointer(&g.value, unsafe.Pointer(unsetLastValue)) - return nil -} - -// Update atomically sets the current "last" value. -func (g *Aggregator) Update(_ context.Context, n number.Number, desc *sdkapi.Descriptor) error { - ngd := &lastValueData{ - value: n, - timestamp: time.Now(), - } - atomic.StorePointer(&g.value, unsafe.Pointer(ngd)) - return nil -} - -// Merge combines state from two aggregators. The most-recently set -// value is chosen. -func (g *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { - o, _ := oa.(*Aggregator) - if o == nil { - return aggregator.NewInconsistentAggregatorError(g, oa) - } - - ggd := (*lastValueData)(atomic.LoadPointer(&g.value)) - ogd := (*lastValueData)(atomic.LoadPointer(&o.value)) - - if ggd.timestamp.After(ogd.timestamp) { - return nil - } - - g.value = unsafe.Pointer(ogd) - return nil -} diff --git a/sdk/metric/aggregator/lastvalue/lastvalue_test.go b/sdk/metric/aggregator/lastvalue/lastvalue_test.go deleted file mode 100644 index fd47ad8c4a3..00000000000 --- a/sdk/metric/aggregator/lastvalue/lastvalue_test.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package lastvalue - -import ( - "errors" - "math/rand" - "os" - "testing" - "time" - "unsafe" - - "github.com/stretchr/testify/require" - - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -const count = 100 - -var _ aggregator.Aggregator = &Aggregator{} - -// Ensure struct alignment prior to running tests. -func TestMain(m *testing.M) { - fields := []ottest.FieldOffset{ - { - Name: "lastValueData.value", - Offset: unsafe.Offsetof(lastValueData{}.value), - }, - } - if !ottest.Aligned8Byte(fields, os.Stderr) { - os.Exit(1) - } - - os.Exit(m.Run()) -} - -func new2() (_, _ *Aggregator) { - alloc := New(2) - return &alloc[0], &alloc[1] -} - -func new4() (_, _, _, _ *Aggregator) { - alloc := New(4) - return &alloc[0], &alloc[1], &alloc[2], &alloc[3] -} - -func checkZero(t *testing.T, agg *Aggregator) { - lv, ts, err := agg.LastValue() - require.True(t, errors.Is(err, aggregation.ErrNoData)) - require.Equal(t, time.Time{}, ts) - require.Equal(t, number.Number(0), lv) -} - -func TestLastValueUpdate(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - agg, ckpt := new2() - - record := aggregatortest.NewAggregatorTest(sdkapi.GaugeObserverInstrumentKind, profile.NumberKind) - - var last number.Number - for i := 0; i < count; i++ { - x := profile.Random(rand.Intn(2)*2 - 1) - last = x - aggregatortest.CheckedUpdate(t, agg, x, record) - } - - err := agg.SynchronizedMove(ckpt, record) - require.NoError(t, err) - - lv, _, err := ckpt.LastValue() - require.Equal(t, last, lv, "Same last value - non-monotonic") - require.Nil(t, err) - }) -} - -func TestLastValueMerge(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - agg1, agg2, ckpt1, ckpt2 := new4() - - descriptor := aggregatortest.NewAggregatorTest(sdkapi.GaugeObserverInstrumentKind, profile.NumberKind) - - first1 := profile.Random(+1) - first2 := profile.Random(+1) - first1.AddNumber(profile.NumberKind, first2) - - aggregatortest.CheckedUpdate(t, agg1, first1, descriptor) - // Ensure these should not have the same timestamp. - time.Sleep(time.Nanosecond) - aggregatortest.CheckedUpdate(t, agg2, first2, descriptor) - - require.NoError(t, agg1.SynchronizedMove(ckpt1, descriptor)) - require.NoError(t, agg2.SynchronizedMove(ckpt2, descriptor)) - - checkZero(t, agg1) - checkZero(t, agg2) - - _, t1, err := ckpt1.LastValue() - require.Nil(t, err) - _, t2, err := ckpt2.LastValue() - require.Nil(t, err) - require.True(t, t1.Before(t2)) - - aggregatortest.CheckedMerge(t, ckpt1, ckpt2, descriptor) - - lv, ts, err := ckpt1.LastValue() - require.Nil(t, err) - require.Equal(t, t2, ts, "Merged timestamp - non-monotonic") - require.Equal(t, first2, lv, "Merged value - non-monotonic") - }) -} - -func TestLastValueNotSet(t *testing.T) { - descriptor := aggregatortest.NewAggregatorTest(sdkapi.GaugeObserverInstrumentKind, number.Int64Kind) - - g, ckpt := new2() - require.NoError(t, g.SynchronizedMove(ckpt, descriptor)) - - checkZero(t, g) -} - -func TestSynchronizedMoveReset(t *testing.T) { - aggregatortest.SynchronizedMoveResetTest( - t, - sdkapi.GaugeObserverInstrumentKind, - func(desc *sdkapi.Descriptor) aggregator.Aggregator { - return &New(1)[0] - }, - ) -} diff --git a/sdk/metric/aggregator/sum/sum.go b/sdk/metric/aggregator/sum/sum.go deleted file mode 100644 index d5c70e59bdf..00000000000 --- a/sdk/metric/aggregator/sum/sum.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sum // import "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - -import ( - "context" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Aggregator aggregates counter events. -type Aggregator struct { - // current holds current increments to this counter record - // current needs to be aligned for 64-bit atomic operations. - value number.Number -} - -var _ aggregator.Aggregator = &Aggregator{} -var _ aggregation.Sum = &Aggregator{} - -// New returns a new counter aggregator implemented by atomic -// operations. This aggregator implements the aggregation.Sum -// export interface. -func New(cnt int) []Aggregator { - return make([]Aggregator, cnt) -} - -// Aggregation returns an interface for reading the state of this aggregator. -func (c *Aggregator) Aggregation() aggregation.Aggregation { - return c -} - -// Kind returns aggregation.SumKind. -func (c *Aggregator) Kind() aggregation.Kind { - return aggregation.SumKind -} - -// Sum returns the last-checkpointed sum. This will never return an -// error. -func (c *Aggregator) Sum() (number.Number, error) { - return c.value, nil -} - -// SynchronizedMove atomically saves the current value into oa and resets the -// current sum to zero. -func (c *Aggregator) SynchronizedMove(oa aggregator.Aggregator, _ *sdkapi.Descriptor) error { - if oa == nil { - c.value.SetRawAtomic(0) - return nil - } - o, _ := oa.(*Aggregator) - if o == nil { - return aggregator.NewInconsistentAggregatorError(c, oa) - } - o.value = c.value.SwapNumberAtomic(number.Number(0)) - return nil -} - -// Update atomically adds to the current value. -func (c *Aggregator) Update(_ context.Context, num number.Number, desc *sdkapi.Descriptor) error { - c.value.AddNumberAtomic(desc.NumberKind(), num) - return nil -} - -// Merge combines two counters by adding their sums. -func (c *Aggregator) Merge(oa aggregator.Aggregator, desc *sdkapi.Descriptor) error { - o, _ := oa.(*Aggregator) - if o == nil { - return aggregator.NewInconsistentAggregatorError(c, oa) - } - c.value.AddNumber(desc.NumberKind(), o.value) - return nil -} diff --git a/sdk/metric/aggregator/sum/sum_test.go b/sdk/metric/aggregator/sum/sum_test.go deleted file mode 100644 index c92594a460c..00000000000 --- a/sdk/metric/aggregator/sum/sum_test.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sum - -import ( - "os" - "testing" - "unsafe" - - "github.com/stretchr/testify/require" - - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -const count = 100 - -// Ensure struct alignment prior to running tests. -func TestMain(m *testing.M) { - fields := []ottest.FieldOffset{ - { - Name: "Aggregator.value", - Offset: unsafe.Offsetof(Aggregator{}.value), - }, - } - if !ottest.Aligned8Byte(fields, os.Stderr) { - os.Exit(1) - } - - os.Exit(m.Run()) -} - -func new2() (_, _ *Aggregator) { - alloc := New(2) - return &alloc[0], &alloc[1] -} - -func new4() (_, _, _, _ *Aggregator) { - alloc := New(4) - return &alloc[0], &alloc[1], &alloc[2], &alloc[3] -} - -func checkZero(t *testing.T, agg *Aggregator, desc *sdkapi.Descriptor) { - kind := desc.NumberKind() - - sum, err := agg.Sum() - require.NoError(t, err) - require.Equal(t, kind.Zero(), sum) -} - -func TestCounterSum(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - agg, ckpt := new2() - - descriptor := aggregatortest.NewAggregatorTest(sdkapi.CounterInstrumentKind, profile.NumberKind) - - sum := number.Number(0) - for i := 0; i < count; i++ { - x := profile.Random(+1) - sum.AddNumber(profile.NumberKind, x) - aggregatortest.CheckedUpdate(t, agg, x, descriptor) - } - - err := agg.SynchronizedMove(ckpt, descriptor) - require.NoError(t, err) - - checkZero(t, agg, descriptor) - - asum, err := ckpt.Sum() - require.Equal(t, sum, asum, "Same sum - monotonic") - require.Nil(t, err) - }) -} - -func TestHistogramSum(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - agg, ckpt := new2() - - descriptor := aggregatortest.NewAggregatorTest(sdkapi.HistogramInstrumentKind, profile.NumberKind) - - sum := number.Number(0) - - for i := 0; i < count; i++ { - r1 := profile.Random(+1) - r2 := profile.Random(-1) - aggregatortest.CheckedUpdate(t, agg, r1, descriptor) - aggregatortest.CheckedUpdate(t, agg, r2, descriptor) - sum.AddNumber(profile.NumberKind, r1) - sum.AddNumber(profile.NumberKind, r2) - } - - require.NoError(t, agg.SynchronizedMove(ckpt, descriptor)) - checkZero(t, agg, descriptor) - - asum, err := ckpt.Sum() - require.Equal(t, sum, asum, "Same sum - monotonic") - require.Nil(t, err) - }) -} - -func TestCounterMerge(t *testing.T) { - aggregatortest.RunProfiles(t, func(t *testing.T, profile aggregatortest.Profile) { - agg1, agg2, ckpt1, ckpt2 := new4() - - descriptor := aggregatortest.NewAggregatorTest(sdkapi.CounterInstrumentKind, profile.NumberKind) - - sum := number.Number(0) - for i := 0; i < count; i++ { - x := profile.Random(+1) - sum.AddNumber(profile.NumberKind, x) - aggregatortest.CheckedUpdate(t, agg1, x, descriptor) - aggregatortest.CheckedUpdate(t, agg2, x, descriptor) - } - - require.NoError(t, agg1.SynchronizedMove(ckpt1, descriptor)) - require.NoError(t, agg2.SynchronizedMove(ckpt2, descriptor)) - - checkZero(t, agg1, descriptor) - checkZero(t, agg2, descriptor) - - aggregatortest.CheckedMerge(t, ckpt1, ckpt2, descriptor) - - sum.AddNumber(descriptor.NumberKind(), sum) - - asum, err := ckpt1.Sum() - require.Equal(t, sum, asum, "Same sum - monotonic") - require.Nil(t, err) - }) -} - -func TestSynchronizedMoveReset(t *testing.T) { - aggregatortest.SynchronizedMoveResetTest( - t, - sdkapi.CounterObserverInstrumentKind, - func(desc *sdkapi.Descriptor) aggregator.Aggregator { - return &New(1)[0] - }, - ) -} diff --git a/sdk/metric/alignment_test.go b/sdk/metric/alignment_test.go deleted file mode 100644 index e0839aa95ee..00000000000 --- a/sdk/metric/alignment_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric - -import ( - "os" - "testing" - "unsafe" - - ottest "go.opentelemetry.io/otel/internal/internaltest" -) - -// Ensure struct alignment prior to running tests. -func TestMain(m *testing.M) { - offsets := map[string]uintptr{ - "record.refMapped.value": unsafe.Offsetof(record{}.refMapped.value), - "record.updateCount": unsafe.Offsetof(record{}.updateCount), - } - var r []ottest.FieldOffset - for name, offset := range offsets { - r = append(r, ottest.FieldOffset{ - Name: name, - Offset: offset, - }) - } - if !ottest.Aligned8Byte(r, os.Stderr) { - os.Exit(1) - } - - os.Exit(m.Run()) -} diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go deleted file mode 100644 index ff05792b1b1..00000000000 --- a/sdk/metric/benchmark_test.go +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric_test - -import ( - "context" - "fmt" - "math/rand" - "testing" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" - sdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type benchFixture struct { - meter metric.Meter - accumulator *sdk.Accumulator - B *testing.B - export.AggregatorSelector -} - -func newFixture(b *testing.B) *benchFixture { - b.ReportAllocs() - bf := &benchFixture{ - B: b, - AggregatorSelector: processortest.AggregatorSelector(), - } - - bf.accumulator = sdk.NewAccumulator(bf) - bf.meter = sdkapi.WrapMeterImpl(bf.accumulator) - return bf -} - -func (f *benchFixture) Process(export.Accumulation) error { - return nil -} - -func (f *benchFixture) Meter(_ string, _ ...metric.MeterOption) metric.Meter { - return f.meter -} - -func (f *benchFixture) iCounter(name string) syncint64.Counter { - ctr, err := f.meter.SyncInt64().Counter(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func (f *benchFixture) fCounter(name string) syncfloat64.Counter { - ctr, err := f.meter.SyncFloat64().Counter(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func (f *benchFixture) iUpDownCounter(name string) syncint64.UpDownCounter { - ctr, err := f.meter.SyncInt64().UpDownCounter(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func (f *benchFixture) fUpDownCounter(name string) syncfloat64.UpDownCounter { - ctr, err := f.meter.SyncFloat64().UpDownCounter(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func (f *benchFixture) iHistogram(name string) syncint64.Histogram { - ctr, err := f.meter.SyncInt64().Histogram(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func (f *benchFixture) fHistogram(name string) syncfloat64.Histogram { - ctr, err := f.meter.SyncFloat64().Histogram(name) - if err != nil { - f.B.Error(err) - } - return ctr -} - -func makeAttrs(n int) []attribute.KeyValue { - used := map[string]bool{} - l := make([]attribute.KeyValue, n) - for i := 0; i < n; i++ { - var k string - for { - k = fmt.Sprint("k", rand.Intn(1000000000)) - if !used[k] { - used[k] = true - break - } - } - l[i] = attribute.String(k, fmt.Sprint("v", rand.Intn(1000000000))) - } - return l -} - -func benchmarkAttrs(b *testing.B, n int) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(n) - cnt := fix.iCounter("int64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} - -func BenchmarkInt64CounterAddWithAttrs_1(b *testing.B) { - benchmarkAttrs(b, 1) -} - -func BenchmarkInt64CounterAddWithAttrs_2(b *testing.B) { - benchmarkAttrs(b, 2) -} - -func BenchmarkInt64CounterAddWithAttrs_4(b *testing.B) { - benchmarkAttrs(b, 4) -} - -func BenchmarkInt64CounterAddWithAttrs_8(b *testing.B) { - benchmarkAttrs(b, 8) -} - -func BenchmarkInt64CounterAddWithAttrs_16(b *testing.B) { - benchmarkAttrs(b, 16) -} - -// Note: performance does not depend on attribute set size for the benchmarks -// below--all are benchmarked for a single attribute. - -// Iterators - -var benchmarkIteratorVar attribute.KeyValue - -func benchmarkIterator(b *testing.B, n int) { - attrs := attribute.NewSet(makeAttrs(n)...) - b.ResetTimer() - for i := 0; i < b.N; i++ { - iter := attrs.Iter() - for iter.Next() { - benchmarkIteratorVar = iter.Attribute() - } - } -} - -func BenchmarkIterator_0(b *testing.B) { - benchmarkIterator(b, 0) -} - -func BenchmarkIterator_1(b *testing.B) { - benchmarkIterator(b, 1) -} - -func BenchmarkIterator_2(b *testing.B) { - benchmarkIterator(b, 2) -} - -func BenchmarkIterator_4(b *testing.B) { - benchmarkIterator(b, 4) -} - -func BenchmarkIterator_8(b *testing.B) { - benchmarkIterator(b, 8) -} - -func BenchmarkIterator_16(b *testing.B) { - benchmarkIterator(b, 16) -} - -// Counters - -func BenchmarkGlobalInt64CounterAddWithSDK(b *testing.B) { - // Compare with BenchmarkInt64CounterAdd() to see overhead of global - // package. This is in the SDK to avoid the API from depending on the - // SDK. - ctx := context.Background() - fix := newFixture(b) - - global.SetMeterProvider(fix) - - labs := []attribute.KeyValue{attribute.String("A", "B")} - - cnt := fix.iCounter("int64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} - -func BenchmarkInt64CounterAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - cnt := fix.iCounter("int64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} - -func BenchmarkFloat64CounterAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - cnt := fix.fCounter("float64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1.1, labs...) - } -} - -// UpDownCounter - -func BenchmarkInt64UpDownCounterAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - cnt := fix.iUpDownCounter("int64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1, labs...) - } -} - -func BenchmarkFloat64UpDownCounterAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - cnt := fix.fUpDownCounter("float64.sum") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - cnt.Add(ctx, 1.1, labs...) - } -} - -// LastValue - -func BenchmarkInt64LastValueAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - mea := fix.iHistogram("int64.lastvalue") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mea.Record(ctx, int64(i), labs...) - } -} - -func BenchmarkFloat64LastValueAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - mea := fix.fHistogram("float64.lastvalue") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mea.Record(ctx, float64(i), labs...) - } -} - -// Histograms - -func BenchmarkInt64HistogramAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - mea := fix.iHistogram("int64.histogram") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mea.Record(ctx, int64(i), labs...) - } -} - -func BenchmarkFloat64HistogramAdd(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - mea := fix.fHistogram("float64.histogram") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - mea.Record(ctx, float64(i), labs...) - } -} - -// Observers - -func BenchmarkObserverRegistration(b *testing.B) { - fix := newFixture(b) - names := make([]string, 0, b.N) - for i := 0; i < b.N; i++ { - names = append(names, fmt.Sprintf("test.%d.lastvalue", i)) - } - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - ctr, _ := fix.meter.AsyncInt64().Counter(names[i]) - _ = fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(context.Context) {}) - } -} - -func BenchmarkGaugeObserverObservationInt64(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - ctr, _ := fix.meter.AsyncInt64().Counter("test.lastvalue") - err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { - for i := 0; i < b.N; i++ { - ctr.Observe(ctx, (int64)(i), labs...) - } - }) - if err != nil { - b.Errorf("could not register callback: %v", err) - b.FailNow() - } - - b.ResetTimer() - - fix.accumulator.Collect(ctx) -} - -func BenchmarkGaugeObserverObservationFloat64(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(1) - ctr, _ := fix.meter.AsyncFloat64().Counter("test.lastvalue") - err := fix.meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { - for i := 0; i < b.N; i++ { - ctr.Observe(ctx, (float64)(i), labs...) - } - }) - if err != nil { - b.Errorf("could not register callback: %v", err) - b.FailNow() - } - - b.ResetTimer() - - fix.accumulator.Collect(ctx) -} - -// BatchRecord - -func benchmarkBatchRecord8Attrs(b *testing.B, numInst int) { - const numAttrs = 8 - ctx := context.Background() - fix := newFixture(b) - labs := makeAttrs(numAttrs) - var meas []syncint64.Counter - - for i := 0; i < numInst; i++ { - meas = append(meas, fix.iCounter(fmt.Sprintf("int64.%d.sum", i))) - } - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - for _, ctr := range meas { - ctr.Add(ctx, 1, labs...) - } - } -} - -func BenchmarkBatchRecord8Attrs_1Instrument(b *testing.B) { - benchmarkBatchRecord8Attrs(b, 1) -} - -func BenchmarkBatchRecord_8Attrs_2Instruments(b *testing.B) { - benchmarkBatchRecord8Attrs(b, 2) -} - -func BenchmarkBatchRecord_8Attrs_4Instruments(b *testing.B) { - benchmarkBatchRecord8Attrs(b, 4) -} - -func BenchmarkBatchRecord_8Attrs_8Instruments(b *testing.B) { - benchmarkBatchRecord8Attrs(b, 8) -} - -// Record creation - -func BenchmarkRepeatedDirectCalls(b *testing.B) { - ctx := context.Background() - fix := newFixture(b) - - c := fix.iCounter("int64.sum") - k := attribute.String("bench", "true") - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - c.Add(ctx, 1, k) - fix.accumulator.Collect(ctx) - } -} diff --git a/sdk/metric/config.go b/sdk/metric/config.go new file mode 100644 index 00000000000..83ae6565410 --- /dev/null +++ b/sdk/metric/config.go @@ -0,0 +1,139 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "fmt" + "sync" + + "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" +) + +// config contains configuration options for a MeterProvider. +type config struct { + res *resource.Resource + readers map[Reader][]view.View +} + +// readerSignals returns a force-flush and shutdown function for a +// MeterProvider to call in their respective options. All Readers c contains +// will have their force-flush and shutdown methods unified into returned +// single functions. +func (c config) readerSignals() (forceFlush, shutdown func(context.Context) error) { + var fFuncs, sFuncs []func(context.Context) error + for r := range c.readers { + sFuncs = append(sFuncs, r.Shutdown) + fFuncs = append(fFuncs, r.ForceFlush) + } + + return unify(fFuncs), unifyShutdown(sFuncs) +} + +// unify unifies calling all of funcs into a single function call. All errors +// returned from calls to funcs will be unify into a single error return +// value. +func unify(funcs []func(context.Context) error) func(context.Context) error { + return func(ctx context.Context) error { + var errs []error + for _, f := range funcs { + if err := f(ctx); err != nil { + errs = append(errs, err) + } + } + switch len(errs) { + case 0: + return nil + case 1: + return errs[0] + default: + return fmt.Errorf("%v", errs) + } + } +} + +// unifyShutdown unifies calling all of funcs once for a shutdown. If called +// more than once, an ErrReaderShutdown error is returned. +func unifyShutdown(funcs []func(context.Context) error) func(context.Context) error { + f := unify(funcs) + var once sync.Once + return func(ctx context.Context) error { + err := ErrReaderShutdown + once.Do(func() { err = f(ctx) }) + return err + } +} + +// newConfig returns a config configured with options. +func newConfig(options []Option) config { + conf := config{res: resource.Default()} + for _, o := range options { + conf = o.apply(conf) + } + return conf +} + +// Option applies a configuration option value to a MeterProvider. +type Option interface { + apply(config) config +} + +// optionFunc applies a set of options to a config. +type optionFunc func(config) config + +// apply returns a config with option(s) applied. +func (o optionFunc) apply(conf config) config { + return o(conf) +} + +// WithResource associates a Resource with a MeterProvider. This Resource +// represents the entity producing telemetry and is associated with all Meters +// the MeterProvider will create. +// +// By default, if this Option is not used, the default Resource from the +// go.opentelemetry.io/otel/sdk/resource package will be used. +func WithResource(res *resource.Resource) Option { + return optionFunc(func(conf config) config { + conf.res = res + return conf + }) +} + +// WithReader associates a Reader with a MeterProvider. Any passed view config +// will be used to associate a view with the Reader. If no views are passed +// the default view will be use for the Reader. +// +// Passing this option multiple times for the same Reader will overwrite. The +// last option passed will be the one used for that Reader. +// +// By default, if this option is not used, the MeterProvider will perform no +// operations; no data will be exported without a Reader. +func WithReader(r Reader, views ...view.View) Option { + return optionFunc(func(cfg config) config { + if cfg.readers == nil { + cfg.readers = make(map[Reader][]view.View) + } + if len(views) == 0 { + views = []view.View{{}} + } + + cfg.readers[r] = views + return cfg + }) +} diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go new file mode 100644 index 00000000000..be3aa55fb16 --- /dev/null +++ b/sdk/metric/config_test.go @@ -0,0 +1,134 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric + +import ( + "context" + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" +) + +type reader struct { + producer producer + temporalityFunc TemporalitySelector + aggregationFunc AggregationSelector + collectFunc func(context.Context) (metricdata.ResourceMetrics, error) + forceFlushFunc func(context.Context) error + shutdownFunc func(context.Context) error +} + +var _ Reader = (*reader)(nil) + +func (r *reader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. + return r.aggregationFunc(kind) +} + +func (r *reader) register(p producer) { r.producer = p } +func (r *reader) temporality(kind view.InstrumentKind) metricdata.Temporality { + return r.temporalityFunc(kind) +} +func (r *reader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { + return r.collectFunc(ctx) +} +func (r *reader) ForceFlush(ctx context.Context) error { return r.forceFlushFunc(ctx) } +func (r *reader) Shutdown(ctx context.Context) error { return r.shutdownFunc(ctx) } + +func TestConfigReaderSignalsEmpty(t *testing.T) { + f, s := config{}.readerSignals() + + require.NotNil(t, f) + require.NotNil(t, s) + + ctx := context.Background() + assert.Nil(t, f(ctx)) + assert.Nil(t, s(ctx)) + assert.ErrorIs(t, s(ctx), ErrReaderShutdown) +} + +func TestConfigReaderSignalsForwarded(t *testing.T) { + var flush, sdown int + r := &reader{ + forceFlushFunc: func(ctx context.Context) error { + flush++ + return nil + }, + shutdownFunc: func(ctx context.Context) error { + sdown++ + return nil + }, + } + c := newConfig([]Option{WithReader(r)}) + f, s := c.readerSignals() + + require.NotNil(t, f) + require.NotNil(t, s) + + ctx := context.Background() + assert.NoError(t, f(ctx)) + assert.NoError(t, f(ctx)) + assert.NoError(t, s(ctx)) + assert.ErrorIs(t, s(ctx), ErrReaderShutdown) + + assert.Equal(t, 2, flush, "flush not called 2 times") + assert.Equal(t, 1, sdown, "shutdown not called 1 time") +} + +func TestConfigReaderSignalsForwardedErrors(t *testing.T) { + r := &reader{ + forceFlushFunc: func(ctx context.Context) error { return assert.AnError }, + shutdownFunc: func(ctx context.Context) error { return assert.AnError }, + } + c := newConfig([]Option{WithReader(r)}) + f, s := c.readerSignals() + + require.NotNil(t, f) + require.NotNil(t, s) + + ctx := context.Background() + assert.ErrorIs(t, f(ctx), assert.AnError) + assert.ErrorIs(t, s(ctx), assert.AnError) + assert.ErrorIs(t, s(ctx), ErrReaderShutdown) +} + +func TestUnifyMultiError(t *testing.T) { + f := func(context.Context) error { return assert.AnError } + funcs := []func(context.Context) error{f, f, f} + errs := []error{assert.AnError, assert.AnError, assert.AnError} + target := fmt.Errorf("%v", errs) + assert.Equal(t, unify(funcs)(context.Background()), target) +} + +func TestWithResource(t *testing.T) { + res := resource.NewSchemaless() + c := newConfig([]Option{WithResource(res)}) + assert.Same(t, res, c.res) +} + +func TestWithReader(t *testing.T) { + r := &reader{} + c := newConfig([]Option{WithReader(r)}) + assert.Contains(t, c.readers, r) +} diff --git a/sdk/metric/controller/basic/config.go b/sdk/metric/controller/basic/config.go deleted file mode 100644 index f3a9830c6af..00000000000 --- a/sdk/metric/controller/basic/config.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic // import "go.opentelemetry.io/otel/sdk/metric/controller/basic" - -import ( - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/resource" -) - -// config contains configuration for a basic Controller. -type config struct { - // Resource is the OpenTelemetry resource associated with all Meters - // created by the Controller. - Resource *resource.Resource - - // CollectPeriod is the interval between calls to Collect a - // checkpoint. - // - // When pulling metrics and not exporting, this is the minimum - // time between calls to Collect. In a pull-only - // configuration, collection is performed on demand; set - // CollectPeriod to 0 always recompute the export record set. - // - // When exporting metrics, this must be > 0. - // - // Default value is 10s. - CollectPeriod time.Duration - - // CollectTimeout is the timeout of the Context passed to - // Collect() and subsequently to Observer instrument callbacks. - // - // Default value is 10s. If zero, no Collect timeout is applied. - CollectTimeout time.Duration - - // Exporter is used for exporting metric data. - // - // Note: Exporters such as Prometheus that pull data do not implement - // export.Exporter. These will directly call Collect() and ForEach(). - Exporter export.Exporter - - // PushTimeout is the timeout of the Context when a exporter is configured. - // - // Default value is 10s. If zero, no Export timeout is applied. - PushTimeout time.Duration -} - -// Option is the interface that applies the value to a configuration option. -type Option interface { - // apply sets the Option value of a Config. - apply(config) config -} - -// WithResource sets the Resource configuration option of a Config by merging it -// with the Resource configuration in the environment. -func WithResource(r *resource.Resource) Option { - return resourceOption{r} -} - -type resourceOption struct{ *resource.Resource } - -func (o resourceOption) apply(cfg config) config { - res, err := resource.Merge(cfg.Resource, o.Resource) - if err != nil { - otel.Handle(err) - } - cfg.Resource = res - return cfg -} - -// WithCollectPeriod sets the CollectPeriod configuration option of a Config. -func WithCollectPeriod(period time.Duration) Option { - return collectPeriodOption(period) -} - -type collectPeriodOption time.Duration - -func (o collectPeriodOption) apply(cfg config) config { - cfg.CollectPeriod = time.Duration(o) - return cfg -} - -// WithCollectTimeout sets the CollectTimeout configuration option of a Config. -func WithCollectTimeout(timeout time.Duration) Option { - return collectTimeoutOption(timeout) -} - -type collectTimeoutOption time.Duration - -func (o collectTimeoutOption) apply(cfg config) config { - cfg.CollectTimeout = time.Duration(o) - return cfg -} - -// WithExporter sets the exporter configuration option of a Config. -func WithExporter(exporter export.Exporter) Option { - return exporterOption{exporter} -} - -type exporterOption struct{ exporter export.Exporter } - -func (o exporterOption) apply(cfg config) config { - cfg.Exporter = o.exporter - return cfg -} - -// WithPushTimeout sets the PushTimeout configuration option of a Config. -func WithPushTimeout(timeout time.Duration) Option { - return pushTimeoutOption(timeout) -} - -type pushTimeoutOption time.Duration - -func (o pushTimeoutOption) apply(cfg config) config { - cfg.PushTimeout = time.Duration(o) - return cfg -} diff --git a/sdk/metric/controller/basic/config_test.go b/sdk/metric/controller/basic/config_test.go deleted file mode 100644 index 32757b8a966..00000000000 --- a/sdk/metric/controller/basic/config_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/resource" -) - -func TestWithResource(t *testing.T) { - r := resource.NewSchemaless(attribute.String("A", "a")) - - c := config{} - c = WithResource(r).apply(c) - assert.Equal(t, r.Equivalent(), c.Resource.Equivalent()) - - // Ensure overwriting works. - c = config{Resource: &resource.Resource{}} - c = WithResource(r).apply(c) - assert.Equal(t, r.Equivalent(), c.Resource.Equivalent()) -} diff --git a/sdk/metric/controller/basic/controller.go b/sdk/metric/controller/basic/controller.go deleted file mode 100644 index 31ddb0f1509..00000000000 --- a/sdk/metric/controller/basic/controller.go +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic // import "go.opentelemetry.io/otel/sdk/metric/controller/basic" - -import ( - "context" - "fmt" - "sync" - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" - sdk "go.opentelemetry.io/otel/sdk/metric" - controllerTime "go.opentelemetry.io/otel/sdk/metric/controller/time" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/registry" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -// DefaultPeriod is used for: -// -// - the minimum time between calls to Collect() -// - the timeout for Export() -// - the timeout for Collect(). -const DefaultPeriod = 10 * time.Second - -// ErrControllerStarted indicates that a controller was started more -// than once. -var ErrControllerStarted = fmt.Errorf("controller already started") - -// Controller organizes and synchronizes collection of metric data in -// both "pull" and "push" configurations. This supports two distinct -// modes: -// -// - Push and Pull: Start() must be called to begin calling the exporter; -// Collect() is called periodically by a background thread after starting -// the controller. -// - Pull-Only: Start() is optional in this case, to call Collect periodically. -// If Start() is not called, Collect() can be called manually to initiate -// collection -// -// The controller supports mixing push and pull access to metric data -// using the export.Reader RWLock interface. Collection will -// be blocked by a pull request in the basic controller. -type Controller struct { - // lock synchronizes Start() and Stop(). - lock sync.Mutex - scopes sync.Map - checkpointerFactory export.CheckpointerFactory - - resource *resource.Resource - exporter export.Exporter - wg sync.WaitGroup - stopCh chan struct{} - clock controllerTime.Clock - ticker controllerTime.Ticker - - collectPeriod time.Duration - collectTimeout time.Duration - pushTimeout time.Duration - - // collectedTime is used only in configurations with no - // exporter, when ticker != nil. - collectedTime time.Time -} - -var _ export.InstrumentationLibraryReader = &Controller{} -var _ metric.MeterProvider = &Controller{} - -// Meter returns a new Meter defined by instrumentationName and configured -// with opts. -func (c *Controller) Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - cfg := metric.NewMeterConfig(opts...) - scope := instrumentation.Scope{ - Name: instrumentationName, - Version: cfg.InstrumentationVersion(), - SchemaURL: cfg.SchemaURL(), - } - - m, ok := c.scopes.Load(scope) - if !ok { - checkpointer := c.checkpointerFactory.NewCheckpointer() - m, _ = c.scopes.LoadOrStore( - scope, - registry.NewUniqueInstrumentMeterImpl(&accumulatorCheckpointer{ - Accumulator: sdk.NewAccumulator(checkpointer), - checkpointer: checkpointer, - scope: scope, - })) - } - return sdkapi.WrapMeterImpl(m.(*registry.UniqueInstrumentMeterImpl)) -} - -type accumulatorCheckpointer struct { - *sdk.Accumulator - checkpointer export.Checkpointer - scope instrumentation.Scope -} - -var _ sdkapi.MeterImpl = &accumulatorCheckpointer{} - -// New constructs a Controller using the provided checkpointer factory -// and options (including optional exporter) to configure a metric -// export pipeline. -func New(checkpointerFactory export.CheckpointerFactory, opts ...Option) *Controller { - c := config{ - CollectPeriod: DefaultPeriod, - CollectTimeout: DefaultPeriod, - PushTimeout: DefaultPeriod, - } - for _, opt := range opts { - c = opt.apply(c) - } - if c.Resource == nil { - c.Resource = resource.Default() - } else { - var err error - c.Resource, err = resource.Merge(resource.Environment(), c.Resource) - if err != nil { - otel.Handle(err) - } - } - return &Controller{ - checkpointerFactory: checkpointerFactory, - exporter: c.Exporter, - resource: c.Resource, - stopCh: nil, - clock: controllerTime.RealClock{}, - - collectPeriod: c.CollectPeriod, - collectTimeout: c.CollectTimeout, - pushTimeout: c.PushTimeout, - } -} - -// SetClock supports setting a mock clock for testing. This must be -// called before Start(). -func (c *Controller) SetClock(clock controllerTime.Clock) { - c.lock.Lock() - defer c.lock.Unlock() - c.clock = clock -} - -// Resource returns the *resource.Resource associated with this -// controller. -func (c *Controller) Resource() *resource.Resource { - return c.resource -} - -// Start begins a ticker that periodically collects and exports -// metrics with the configured interval. This is required for calling -// a configured Exporter (see WithExporter) and is otherwise optional -// when only pulling metric data. -// -// The passed context is passed to Collect() and subsequently to -// asynchronous instrument callbacks. Returns an error when the -// controller was already started. -// -// Note that it is not necessary to Start a controller when only -// pulling data; use the Collect() and ForEach() methods directly in -// this case. -func (c *Controller) Start(ctx context.Context) error { - c.lock.Lock() - defer c.lock.Unlock() - - if c.stopCh != nil { - return ErrControllerStarted - } - - c.wg.Add(1) - c.stopCh = make(chan struct{}) - c.ticker = c.clock.Ticker(c.collectPeriod) - go c.runTicker(ctx, c.stopCh) - return nil -} - -// Stop waits for the background goroutine to return and then collects -// and exports metrics one last time before returning. The passed -// context is passed to the final Collect() and subsequently to the -// final asynchronous instruments. -// -// Note that Stop() will not cancel an ongoing collection or export. -func (c *Controller) Stop(ctx context.Context) error { - if lastCollection := func() bool { - c.lock.Lock() - defer c.lock.Unlock() - - if c.stopCh == nil { - return false - } - - close(c.stopCh) - c.stopCh = nil - c.wg.Wait() - c.ticker.Stop() - c.ticker = nil - return true - }(); !lastCollection { - return nil - } - return c.collect(ctx) -} - -// runTicker collection on ticker events until the stop channel is closed. -func (c *Controller) runTicker(ctx context.Context, stopCh chan struct{}) { - defer c.wg.Done() - for { - select { - case <-stopCh: - return - case <-c.ticker.C(): - if err := c.collect(ctx); err != nil { - otel.Handle(err) - } - } - } -} - -// collect computes a checkpoint and optionally exports it. -func (c *Controller) collect(ctx context.Context) error { - if err := c.checkpoint(ctx); err != nil { - return err - } - if c.exporter == nil { - return nil - } - - // Note: this is not subject to collectTimeout. This blocks the next - // collection despite collectTimeout because it holds a lock. - return c.export(ctx) -} - -// accumulatorList returns a snapshot of current accumulators -// registered to this controller. This briefly locks the controller. -func (c *Controller) accumulatorList() []*accumulatorCheckpointer { - var r []*accumulatorCheckpointer - c.scopes.Range(func(key, value interface{}) bool { - acc, ok := value.(*registry.UniqueInstrumentMeterImpl).MeterImpl().(*accumulatorCheckpointer) - if ok { - r = append(r, acc) - } - return true - }) - return r -} - -// checkpoint calls the Accumulator and Checkpointer interfaces to -// compute the Reader. This applies the configured collection -// timeout. Note that this does not try to cancel a Collect or Export -// when Stop() is called. -func (c *Controller) checkpoint(ctx context.Context) error { - for _, impl := range c.accumulatorList() { - if err := c.checkpointSingleAccumulator(ctx, impl); err != nil { - return err - } - } - return nil -} - -// checkpointSingleAccumulator checkpoints a single instrumentation -// scope's accumulator, which involves calling -// checkpointer.StartCollection, accumulator.Collect, and -// checkpointer.FinishCollection in sequence. -func (c *Controller) checkpointSingleAccumulator(ctx context.Context, ac *accumulatorCheckpointer) error { - ckpt := ac.checkpointer.Reader() - ckpt.Lock() - defer ckpt.Unlock() - - ac.checkpointer.StartCollection() - - if c.collectTimeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, c.collectTimeout) - defer cancel() - } - - _ = ac.Accumulator.Collect(ctx) - - var err error - select { - case <-ctx.Done(): - err = ctx.Err() - default: - // The context wasn't done, ok. - } - - // Finish the checkpoint whether the accumulator timed out or not. - if cerr := ac.checkpointer.FinishCollection(); cerr != nil { - if err == nil { - err = cerr - } else { - err = fmt.Errorf("%s: %w", cerr.Error(), err) - } - } - - return err -} - -// export calls the exporter with a read lock on the Reader, -// applying the configured export timeout. -func (c *Controller) export(ctx context.Context) error { // nolint:revive // method name shadows import. - if c.pushTimeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, c.pushTimeout) - defer cancel() - } - - return c.exporter.Export(ctx, c.resource, c) -} - -// ForEach implements export.InstrumentationLibraryReader. -func (c *Controller) ForEach(readerFunc func(l instrumentation.Library, r export.Reader) error) error { - for _, acPair := range c.accumulatorList() { - reader := acPair.checkpointer.Reader() - // TODO: We should not fail fast; instead accumulate errors. - if err := func() error { - reader.RLock() - defer reader.RUnlock() - return readerFunc(acPair.scope, reader) - }(); err != nil { - return err - } - } - return nil -} - -// IsRunning returns true if the controller was started via Start(), -// indicating that the current export.Reader is being kept -// up-to-date. -func (c *Controller) IsRunning() bool { - c.lock.Lock() - defer c.lock.Unlock() - return c.ticker != nil -} - -// Collect requests a collection. The collection will be skipped if -// the last collection is aged less than the configured collection -// period. -func (c *Controller) Collect(ctx context.Context) error { - if c.IsRunning() { - // When there's a non-nil ticker, there's a goroutine - // computing checkpoints with the collection period. - return ErrControllerStarted - } - if !c.shouldCollect() { - return nil - } - - return c.checkpoint(ctx) -} - -// shouldCollect returns true if the collector should collect now, -// based on the timestamp, the last collection time, and the -// configured period. -func (c *Controller) shouldCollect() bool { - c.lock.Lock() - defer c.lock.Unlock() - - if c.collectPeriod == 0 { - return true - } - now := c.clock.Now() - if now.Sub(c.collectedTime) < c.collectPeriod { - return false - } - c.collectedTime = now - return true -} diff --git a/sdk/metric/controller/basic/controller_test.go b/sdk/metric/controller/basic/controller_test.go deleted file mode 100644 index 74904d68c49..00000000000 --- a/sdk/metric/controller/basic/controller_test.go +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic_test - -import ( - "context" - "errors" - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - ottest "go.opentelemetry.io/otel/internal/internaltest" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/instrumentation" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -const envVar = "OTEL_RESOURCE_ATTRIBUTES" - -func getMap(t *testing.T, cont *controller.Controller) map[string]float64 { - out := processortest.NewOutput(attribute.DefaultEncoder()) - - require.NoError(t, cont.ForEach( - func(_ instrumentation.Scope, reader export.Reader) error { - return reader.ForEach( - aggregation.CumulativeTemporalitySelector(), - func(record export.Record) error { - return out.AddRecord(record) - }, - ) - })) - return out.Map() -} - -type testContextKey string - -func testContext() context.Context { - ctx := context.Background() - return context.WithValue(ctx, testContextKey("A"), "B") -} - -func checkTestContext(t *testing.T, ctx context.Context) { - require.Equal(t, "B", ctx.Value(testContextKey("A"))) -} - -func TestControllerUsesResource(t *testing.T) { - const envVal = "T=U,key=value" - store, err := ottest.SetEnvVariables(map[string]string{ - envVar: envVal, - }) - - require.NoError(t, err) - defer func() { require.NoError(t, store.Restore()) }() - - cases := []struct { - name string - options []controller.Option - wanted string - }{ - { - name: "explicitly empty resource", - options: []controller.Option{controller.WithResource(resource.Empty())}, - wanted: envVal, - }, - { - name: "uses default if no resource option", - options: nil, - wanted: resource.Default().Encoded(attribute.DefaultEncoder()), - }, - { - name: "explicit resource", - options: []controller.Option{controller.WithResource(resource.NewSchemaless(attribute.String("R", "S")))}, - wanted: "R=S," + envVal, - }, - { - name: "multi resource", - options: []controller.Option{ - controller.WithResource(resource.NewSchemaless(attribute.String("R", "WRONG"))), - controller.WithResource(resource.NewSchemaless(attribute.String("R", "S"))), - controller.WithResource(resource.NewSchemaless(attribute.String("W", "X"))), - controller.WithResource(resource.NewSchemaless(attribute.String("T", "V"))), - }, - wanted: "R=S,T=V,W=X,key=value", - }, - { - name: "user override environment", - options: []controller.Option{ - controller.WithResource(resource.NewSchemaless(attribute.String("T", "V"))), - controller.WithResource(resource.NewSchemaless(attribute.String("key", "I win"))), - }, - wanted: "T=V,key=I win", - }, - } - for _, c := range cases { - t.Run(fmt.Sprintf("case-%s", c.name), func(t *testing.T) { - sel := aggregation.CumulativeTemporalitySelector() - exp := processortest.New(sel, attribute.DefaultEncoder()) - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - exp, - ), - append(c.options, controller.WithExporter(exp))..., - ) - ctx := context.Background() - require.NoError(t, cont.Start(ctx)) - - ctr, _ := cont.Meter("named").SyncFloat64().Counter("calls.sum") - ctr.Add(context.Background(), 1.) - - // Collect once - require.NoError(t, cont.Stop(ctx)) - - expect := map[string]float64{ - "calls.sum//" + c.wanted: 1., - } - require.EqualValues(t, expect, exp.Values()) - }) - } -} - -func TestStartNoExporter(t *testing.T) { - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - ), - controller.WithCollectPeriod(time.Second), - controller.WithResource(resource.Empty()), - ) - mock := controllertest.NewMockClock() - cont.SetClock(mock) - meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#StartNoExporter") - - calls := int64(0) - - counterObserver, err := meter.AsyncInt64().Counter("calls.lastvalue") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - calls++ - checkTestContext(t, ctx) - counterObserver.Observe(ctx, calls, attribute.String("A", "B")) - }) - require.NoError(t, err) - - // Collect() has not been called. The controller is unstarted. - expect := map[string]float64{} - - // The time advances, but doesn't change the result (not collected). - require.EqualValues(t, expect, getMap(t, cont)) - mock.Add(time.Second) - require.EqualValues(t, expect, getMap(t, cont)) - mock.Add(time.Second) - - expect = map[string]float64{ - "calls.lastvalue/A=B/": 1, - } - - // Collect once - ctx := testContext() - - require.NoError(t, cont.Collect(ctx)) - - require.EqualValues(t, expect, getMap(t, cont)) - mock.Add(time.Second) - require.EqualValues(t, expect, getMap(t, cont)) - mock.Add(time.Second) - - // Again - expect = map[string]float64{ - "calls.lastvalue/A=B/": 2, - } - - require.NoError(t, cont.Collect(ctx)) - - require.EqualValues(t, expect, getMap(t, cont)) - mock.Add(time.Second) - require.EqualValues(t, expect, getMap(t, cont)) - - // Start the controller - require.NoError(t, cont.Start(ctx)) - - for i := 1; i <= 3; i++ { - expect = map[string]float64{ - "calls.lastvalue/A=B/": 2 + float64(i), - } - - mock.Add(time.Second) - require.EqualValues(t, expect, getMap(t, cont)) - } -} - -func TestObserverCanceled(t *testing.T) { - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - ), - controller.WithCollectPeriod(0), - controller.WithCollectTimeout(time.Millisecond), - controller.WithResource(resource.Empty()), - ) - meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ObserverCanceled") - - calls := int64(0) - - counterObserver, err := meter.AsyncInt64().Counter("done.lastvalue") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - <-ctx.Done() - calls++ - counterObserver.Observe(ctx, calls) - }) - require.NoError(t, err) - - // This relies on the context timing out - err = cont.Collect(context.Background()) - require.Error(t, err) - require.True(t, errors.Is(err, context.DeadlineExceeded)) - - expect := map[string]float64{ - "done.lastvalue//": 1, - } - - require.EqualValues(t, expect, getMap(t, cont)) -} - -func TestObserverContext(t *testing.T) { - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - ), - controller.WithCollectTimeout(0), - controller.WithResource(resource.Empty()), - ) - meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ObserverContext") - - counterObserver, err := meter.AsyncInt64().Counter("done.lastvalue") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - time.Sleep(10 * time.Millisecond) - checkTestContext(t, ctx) - counterObserver.Observe(ctx, 1) - }) - require.NoError(t, err) - - ctx := testContext() - - require.NoError(t, cont.Collect(ctx)) - - expect := map[string]float64{ - "done.lastvalue//": 1, - } - - require.EqualValues(t, expect, getMap(t, cont)) -} - -type blockingExporter struct { - calls int - exporter *processortest.Exporter -} - -func newBlockingExporter() *blockingExporter { - return &blockingExporter{ - exporter: processortest.New( - aggregation.CumulativeTemporalitySelector(), - attribute.DefaultEncoder(), - ), - } -} - -func (b *blockingExporter) Export(ctx context.Context, res *resource.Resource, output export.InstrumentationLibraryReader) error { - var err error - _ = b.exporter.Export(ctx, res, output) - if b.calls == 0 { - // timeout once - <-ctx.Done() - err = ctx.Err() - } - b.calls++ - return err -} - -func (*blockingExporter) TemporalityFor(*sdkapi.Descriptor, aggregation.Kind) aggregation.Temporality { - return aggregation.CumulativeTemporality -} - -func TestExportTimeout(t *testing.T) { - exporter := newBlockingExporter() - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - ), - controller.WithCollectPeriod(time.Second), - controller.WithPushTimeout(time.Millisecond), - controller.WithExporter(exporter), - controller.WithResource(resource.Empty()), - ) - mock := controllertest.NewMockClock() - cont.SetClock(mock) - meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#ExportTimeout") - - calls := int64(0) - counterObserver, err := meter.AsyncInt64().Counter("one.lastvalue") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - calls++ - counterObserver.Observe(ctx, calls) - }) - require.NoError(t, err) - - require.NoError(t, cont.Start(context.Background())) - - // Initial empty state - expect := map[string]float64{} - require.EqualValues(t, expect, exporter.exporter.Values()) - - // Collect after 1s, timeout - mock.Add(time.Second) - - err = testHandler.Flush() - require.Error(t, err) - require.True(t, errors.Is(err, context.DeadlineExceeded)) - - expect = map[string]float64{ - "one.lastvalue//": 1, - } - require.EqualValues(t, expect, exporter.exporter.Values()) - - // Collect again - mock.Add(time.Second) - expect = map[string]float64{ - "one.lastvalue//": 2, - } - require.EqualValues(t, expect, exporter.exporter.Values()) - - err = testHandler.Flush() - require.NoError(t, err) -} - -func TestCollectAfterStopThenStartAgain(t *testing.T) { - exp := processortest.New( - aggregation.CumulativeTemporalitySelector(), - attribute.DefaultEncoder(), - ) - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - exp, - ), - controller.WithCollectPeriod(time.Second), - controller.WithExporter(exp), - controller.WithResource(resource.Empty()), - ) - mock := controllertest.NewMockClock() - cont.SetClock(mock) - - meter := cont.Meter("go.opentelemetry.io/otel/sdk/metric/controller/basic_test#CollectAfterStopThenStartAgain") - - calls := 0 - counterObserver, err := meter.AsyncInt64().Counter("one.lastvalue") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - calls++ - counterObserver.Observe(ctx, int64(calls)) - }) - require.NoError(t, err) - - // No collections happen (because mock clock does not advance): - require.NoError(t, cont.Start(context.Background())) - require.True(t, cont.IsRunning()) - - // There's one collection run by Stop(): - require.NoError(t, cont.Stop(context.Background())) - - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 1, - }, exp.Values()) - require.NoError(t, testHandler.Flush()) - - // Manual collect after Stop still works, subject to - // CollectPeriod. - require.NoError(t, cont.Collect(context.Background())) - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 2, - }, getMap(t, cont)) - - require.NoError(t, testHandler.Flush()) - require.False(t, cont.IsRunning()) - - // Start again, see that collection proceeds. However, - // explicit collection should still fail. - require.NoError(t, cont.Start(context.Background())) - require.True(t, cont.IsRunning()) - err = cont.Collect(context.Background()) - require.Error(t, err) - require.Equal(t, controller.ErrControllerStarted, err) - - require.NoError(t, cont.Stop(context.Background())) - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 3, - }, exp.Values()) - require.False(t, cont.IsRunning()) - - // Time has not advanced yet. Now let the ticker perform - // collection: - require.NoError(t, cont.Start(context.Background())) - mock.Add(time.Second) - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 4, - }, exp.Values()) - - mock.Add(time.Second) - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 5, - }, exp.Values()) - require.NoError(t, cont.Stop(context.Background())) - require.EqualValues(t, map[string]float64{ - "one.lastvalue//": 6, - }, exp.Values()) -} - -func TestRegistryFunction(t *testing.T) { - exp := processortest.New( - aggregation.CumulativeTemporalitySelector(), - attribute.DefaultEncoder(), - ) - cont := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - exp, - ), - controller.WithCollectPeriod(time.Second), - controller.WithExporter(exp), - controller.WithResource(resource.Empty()), - ) - - m1 := cont.Meter("test") - m2 := cont.Meter("test") - - require.NotNil(t, m1) - require.Equal(t, m1, m2) - - c1, err := m1.SyncInt64().Counter("counter.sum") - require.NoError(t, err) - - c2, err := m1.SyncInt64().Counter("counter.sum") - require.NoError(t, err) - - require.Equal(t, c1, c2) - - ctx := context.Background() - - require.NoError(t, cont.Start(ctx)) - - c1.Add(ctx, 10) - c2.Add(ctx, 10) - - require.NoError(t, cont.Stop(ctx)) - - require.EqualValues(t, map[string]float64{ - "counter.sum//": 20, - }, exp.Values()) -} diff --git a/sdk/metric/controller/basic/pull_test.go b/sdk/metric/controller/basic/pull_test.go deleted file mode 100644 index 98496f6e780..00000000000 --- a/sdk/metric/controller/basic/pull_test.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic_test - -import ( - "context" - "runtime" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/resource" -) - -func TestPullNoCollect(t *testing.T) { - puller := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - processor.WithMemory(true), - ), - controller.WithCollectPeriod(0), - controller.WithResource(resource.Empty()), - ) - - ctx := context.Background() - meter := puller.Meter("nocache") - counter, err := meter.SyncInt64().Counter("counter.sum") - require.NoError(t, err) - - counter.Add(ctx, 10, attribute.String("A", "B")) - - require.NoError(t, puller.Collect(ctx)) - records := processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, controllertest.ReadAll(puller, aggregation.CumulativeTemporalitySelector(), records.AddInstrumentationLibraryRecord)) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=B/": 10, - }, records.Map()) - - counter.Add(ctx, 10, attribute.String("A", "B")) - - require.NoError(t, puller.Collect(ctx)) - records = processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, controllertest.ReadAll(puller, aggregation.CumulativeTemporalitySelector(), records.AddInstrumentationLibraryRecord)) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=B/": 20, - }, records.Map()) -} - -func TestPullWithCollect(t *testing.T) { - puller := controller.New( - processor.NewFactory( - processortest.AggregatorSelector(), - aggregation.CumulativeTemporalitySelector(), - processor.WithMemory(true), - ), - controller.WithCollectPeriod(time.Second), - controller.WithResource(resource.Empty()), - ) - mock := controllertest.NewMockClock() - puller.SetClock(mock) - - ctx := context.Background() - meter := puller.Meter("nocache") - counter, err := meter.SyncInt64().Counter("counter.sum") - require.NoError(t, err) - - counter.Add(ctx, 10, attribute.String("A", "B")) - - require.NoError(t, puller.Collect(ctx)) - records := processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, controllertest.ReadAll(puller, aggregation.CumulativeTemporalitySelector(), records.AddInstrumentationLibraryRecord)) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=B/": 10, - }, records.Map()) - - counter.Add(ctx, 10, attribute.String("A", "B")) - - // Cached value! - require.NoError(t, puller.Collect(ctx)) - records = processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, controllertest.ReadAll(puller, aggregation.CumulativeTemporalitySelector(), records.AddInstrumentationLibraryRecord)) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=B/": 10, - }, records.Map()) - - mock.Add(time.Second) - runtime.Gosched() - - // Re-computed value! - require.NoError(t, puller.Collect(ctx)) - records = processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, controllertest.ReadAll(puller, aggregation.CumulativeTemporalitySelector(), records.AddInstrumentationLibraryRecord)) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=B/": 20, - }, records.Map()) -} diff --git a/sdk/metric/controller/basic/push_test.go b/sdk/metric/controller/basic/push_test.go deleted file mode 100644 index 67bbddfdc84..00000000000 --- a/sdk/metric/controller/basic/push_test.go +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic_test - -import ( - "context" - "errors" - "fmt" - "runtime" - "sync" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/resource" -) - -var testResource = resource.NewSchemaless(attribute.String("R", "V")) - -type handler struct { - sync.Mutex - err error -} - -func (h *handler) Handle(err error) { - h.Lock() - h.err = err - h.Unlock() -} - -func (h *handler) Flush() error { - h.Lock() - err := h.err - h.err = nil - h.Unlock() - return err -} - -var testHandler *handler - -func init() { - testHandler = new(handler) - otel.SetErrorHandler(testHandler) -} - -func newExporter() *processortest.Exporter { - return processortest.New( - aggregation.StatelessTemporalitySelector(), - attribute.DefaultEncoder(), - ) -} - -func newCheckpointerFactory() export.CheckpointerFactory { - return processortest.NewCheckpointerFactory( - processortest.AggregatorSelector(), - attribute.DefaultEncoder(), - ) -} - -func TestPushDoubleStop(t *testing.T) { - ctx := context.Background() - exporter := newExporter() - checkpointer := newCheckpointerFactory() - p := controller.New(checkpointer, controller.WithExporter(exporter)) - require.NoError(t, p.Start(ctx)) - require.NoError(t, p.Stop(ctx)) - require.NoError(t, p.Stop(ctx)) -} - -func TestPushDoubleStart(t *testing.T) { - ctx := context.Background() - exporter := newExporter() - checkpointer := newCheckpointerFactory() - p := controller.New(checkpointer, controller.WithExporter(exporter)) - require.NoError(t, p.Start(ctx)) - err := p.Start(ctx) - require.Error(t, err) - require.True(t, errors.Is(err, controller.ErrControllerStarted)) - require.NoError(t, p.Stop(ctx)) -} - -func TestPushTicker(t *testing.T) { - exporter := newExporter() - checkpointer := newCheckpointerFactory() - p := controller.New( - checkpointer, - controller.WithExporter(exporter), - controller.WithCollectPeriod(time.Second), - controller.WithResource(testResource), - ) - meter := p.Meter("name") - - mock := controllertest.NewMockClock() - p.SetClock(mock) - - ctx := context.Background() - - counter, err := meter.SyncInt64().Counter("counter.sum") - require.NoError(t, err) - - require.NoError(t, p.Start(ctx)) - - counter.Add(ctx, 3) - - require.EqualValues(t, map[string]float64{}, exporter.Values()) - - mock.Add(time.Second) - runtime.Gosched() - - require.EqualValues(t, map[string]float64{ - "counter.sum//R=V": 3, - }, exporter.Values()) - - require.Equal(t, 1, exporter.ExportCount()) - exporter.Reset() - - counter.Add(ctx, 7) - - mock.Add(time.Second) - runtime.Gosched() - - require.EqualValues(t, map[string]float64{ - "counter.sum//R=V": 10, - }, exporter.Values()) - - require.Equal(t, 1, exporter.ExportCount()) - exporter.Reset() - - require.NoError(t, p.Stop(ctx)) -} - -func TestPushExportError(t *testing.T) { - injector := func(name string, e error) func(r export.Record) error { - return func(r export.Record) error { - if r.Descriptor().Name() == name { - return e - } - return nil - } - } - var errAggregator = fmt.Errorf("unexpected error") - var tests = []struct { - name string - injectedError error - expected map[string]float64 - expectedError error - }{ - {"errNone", nil, map[string]float64{ - "counter1.sum/X=Y/R=V": 3, - "counter2.sum//R=V": 5, - }, nil}, - {"errNoData", aggregation.ErrNoData, map[string]float64{ - "counter2.sum//R=V": 5, - }, nil}, - {"errUnexpected", errAggregator, map[string]float64{}, errAggregator}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - exporter := newExporter() - exporter.InjectErr = injector("counter1.sum", tt.injectedError) - - // This test validates the error handling - // behavior of the basic Processor is honored - // by the push processor. - checkpointer := processor.NewFactory(processortest.AggregatorSelector(), exporter) - p := controller.New( - checkpointer, - controller.WithExporter(exporter), - controller.WithCollectPeriod(time.Second), - controller.WithResource(testResource), - ) - - mock := controllertest.NewMockClock() - p.SetClock(mock) - - ctx := context.Background() - - meter := p.Meter("name") - counter1, err := meter.SyncInt64().Counter("counter1.sum") - require.NoError(t, err) - counter2, err := meter.SyncInt64().Counter("counter2.sum") - require.NoError(t, err) - - require.NoError(t, p.Start(ctx)) - runtime.Gosched() - - counter1.Add(ctx, 3, attribute.String("X", "Y")) - counter2.Add(ctx, 5) - - require.Equal(t, 0, exporter.ExportCount()) - require.Nil(t, testHandler.Flush()) - - mock.Add(time.Second) - runtime.Gosched() - - require.Equal(t, 1, exporter.ExportCount()) - if tt.expectedError == nil { - require.EqualValues(t, tt.expected, exporter.Values()) - require.NoError(t, testHandler.Flush()) - } else { - err := testHandler.Flush() - require.Error(t, err) - require.Equal(t, tt.expectedError, err) - } - - require.NoError(t, p.Stop(ctx)) - }) - } -} diff --git a/sdk/metric/controller/controllertest/controller_test.go b/sdk/metric/controller/controllertest/controller_test.go deleted file mode 100644 index 0f85ca37f9c..00000000000 --- a/sdk/metric/controller/controllertest/controller_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package controllertest // import "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - -import ( - "context" - "sync" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/selector/simple" -) - -type errorCatcher struct { - lock sync.Mutex - errors []error -} - -func (e *errorCatcher) Handle(err error) { - e.lock.Lock() - defer e.lock.Unlock() - - e.errors = append(e.errors, err) -} - -func TestEndToEnd(t *testing.T) { - h := &errorCatcher{} - otel.SetErrorHandler(h) - - meter := global.Meter("go.opentelemetry.io/otel/sdk/metric/controller/controllertest_EndToEnd") - gauge, err := meter.AsyncInt64().Gauge("test") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(context.Context) {}) - require.NoError(t, err) - - c := controller.New(basic.NewFactory(simple.NewWithInexpensiveDistribution(), aggregation.CumulativeTemporalitySelector())) - - global.SetMeterProvider(c) - - gauge, err = meter.AsyncInt64().Gauge("test2") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(context.Context) {}) - require.NoError(t, err) - - h.lock.Lock() - require.Len(t, h.errors, 0) -} diff --git a/sdk/metric/controller/controllertest/test.go b/sdk/metric/controller/controllertest/test.go deleted file mode 100644 index 9c1a3421972..00000000000 --- a/sdk/metric/controller/controllertest/test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package controllertest // import "go.opentelemetry.io/otel/sdk/metric/controller/controllertest" - -import ( - "time" - - "github.com/benbjohnson/clock" - - "go.opentelemetry.io/otel/sdk/instrumentation" - controllerTime "go.opentelemetry.io/otel/sdk/metric/controller/time" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" -) - -// MockClock is a Clock used for testing. -type MockClock struct { - mock *clock.Mock -} - -// MockTicker is a Ticker used for testing. -type MockTicker struct { - ticker *clock.Ticker -} - -var _ controllerTime.Clock = MockClock{} -var _ controllerTime.Ticker = MockTicker{} - -// NewMockClock returns a new unset MockClock. -func NewMockClock() MockClock { - return MockClock{clock.NewMock()} -} - -// Now returns the current time. -func (c MockClock) Now() time.Time { - return c.mock.Now() -} - -// Ticker creates a new instance of a Ticker. -func (c MockClock) Ticker(period time.Duration) controllerTime.Ticker { - return MockTicker{c.mock.Ticker(period)} -} - -// Add moves the current time of the MockClock forward by the specified -// duration. -func (c MockClock) Add(d time.Duration) { - c.mock.Add(d) -} - -// Stop turns off the MockTicker. -func (t MockTicker) Stop() { - t.ticker.Stop() -} - -// C returns a channel that receives the current time when MockTicker ticks. -func (t MockTicker) C() <-chan time.Time { - return t.ticker.C -} - -// ReadAll is a helper for tests that want a flat iterator over all -// metrics instead of a two-level iterator (instrumentation library, -// metric). -func ReadAll( - reader export.InstrumentationLibraryReader, - kind aggregation.TemporalitySelector, - apply func(instrumentation.Library, export.Record) error, -) error { - return reader.ForEach(func(library instrumentation.Library, reader export.Reader) error { - return reader.ForEach(kind, func(record export.Record) error { - return apply(library, record) - }) - }) -} diff --git a/sdk/metric/controller/time/time.go b/sdk/metric/controller/time/time.go deleted file mode 100644 index 10b3cd8726f..00000000000 --- a/sdk/metric/controller/time/time.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package time // import "go.opentelemetry.io/otel/sdk/metric/controller/time" - -import ( - "time" -) - -// Several types below are created to match "github.com/benbjohnson/clock" -// so that it remains a test-only dependency. - -// Clock keeps track of time for a metric SDK. -type Clock interface { - Now() time.Time - Ticker(duration time.Duration) Ticker -} - -// Ticker signals time intervals. -type Ticker interface { - Stop() - C() <-chan time.Time -} - -// RealClock wraps the time package and uses the system time to tell time. -type RealClock struct { -} - -// RealTicker wraps the time package and uses system time to tick time -// intervals. -type RealTicker struct { - ticker *time.Ticker -} - -var _ Clock = RealClock{} -var _ Ticker = RealTicker{} - -// Now returns the current time. -func (RealClock) Now() time.Time { - return time.Now() -} - -// Ticker creates a new RealTicker that will tick with period. -func (RealClock) Ticker(period time.Duration) Ticker { - return RealTicker{time.NewTicker(period)} -} - -// Stop turns off the RealTicker. -func (t RealTicker) Stop() { - t.ticker.Stop() -} - -// C returns a channel that receives the current time when RealTicker ticks. -func (t RealTicker) C() <-chan time.Time { - return t.ticker.C -} diff --git a/sdk/metric/correct_test.go b/sdk/metric/correct_test.go deleted file mode 100644 index 944570375ae..00000000000 --- a/sdk/metric/correct_test.go +++ /dev/null @@ -1,572 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric_test - -import ( - "context" - "fmt" - "math" - "sync" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - metricsdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type handler struct { - sync.Mutex - err error -} - -func (h *handler) Handle(err error) { - h.Lock() - h.err = err - h.Unlock() -} - -func (h *handler) Reset() { - h.Lock() - h.err = nil - h.Unlock() -} - -func (h *handler) Flush() error { - h.Lock() - err := h.err - h.err = nil - h.Unlock() - return err -} - -var testHandler *handler - -func init() { - testHandler = new(handler) - otel.SetErrorHandler(testHandler) -} - -type testSelector struct { - selector export.AggregatorSelector - newAggCount int -} - -func (ts *testSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { - ts.newAggCount += len(aggPtrs) - processortest.AggregatorSelector().AggregatorFor(desc, aggPtrs...) -} - -func newSDK(t *testing.T) (metric.Meter, *metricsdk.Accumulator, *testSelector, *processortest.Processor) { - testHandler.Reset() - testSelector := &testSelector{selector: processortest.AggregatorSelector()} - processor := processortest.NewProcessor( - testSelector, - attribute.DefaultEncoder(), - ) - accum := metricsdk.NewAccumulator( - processor, - ) - meter := sdkapi.WrapMeterImpl(accum) - return meter, accum, testSelector, processor -} - -func TestInputRangeCounter(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - counter, err := meter.SyncInt64().Counter("name.sum") - require.NoError(t, err) - - counter.Add(ctx, -1) - require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - - checkpointed := sdk.Collect(ctx) - require.Equal(t, 0, checkpointed) - - processor.Reset() - counter.Add(ctx, 1) - checkpointed = sdk.Collect(ctx) - require.Equal(t, map[string]float64{ - "name.sum//": 1, - }, processor.Values()) - require.Equal(t, 1, checkpointed) - require.Nil(t, testHandler.Flush()) -} - -func TestInputRangeUpDownCounter(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - counter, err := meter.SyncInt64().UpDownCounter("name.sum") - require.NoError(t, err) - - counter.Add(ctx, -1) - counter.Add(ctx, -1) - counter.Add(ctx, 2) - counter.Add(ctx, 1) - - checkpointed := sdk.Collect(ctx) - require.Equal(t, map[string]float64{ - "name.sum//": 1, - }, processor.Values()) - require.Equal(t, 1, checkpointed) - require.Nil(t, testHandler.Flush()) -} - -func TestInputRangeHistogram(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - histogram, err := meter.SyncFloat64().Histogram("name.histogram") - require.NoError(t, err) - - histogram.Record(ctx, math.NaN()) - require.Equal(t, aggregation.ErrNaNInput, testHandler.Flush()) - - checkpointed := sdk.Collect(ctx) - require.Equal(t, 0, checkpointed) - - histogram.Record(ctx, 1) - histogram.Record(ctx, 2) - - processor.Reset() - checkpointed = sdk.Collect(ctx) - - require.Equal(t, map[string]float64{ - "name.histogram//": 3, - }, processor.Values()) - require.Equal(t, 1, checkpointed) - require.Nil(t, testHandler.Flush()) -} - -func TestDisabledInstrument(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - histogram, err := meter.SyncFloat64().Histogram("name.disabled") - require.NoError(t, err) - - histogram.Record(ctx, -1) - checkpointed := sdk.Collect(ctx) - - require.Equal(t, 0, checkpointed) - require.Equal(t, map[string]float64{}, processor.Values()) -} - -func TestRecordNaN(t *testing.T) { - ctx := context.Background() - meter, _, _, _ := newSDK(t) - - c, err := meter.SyncFloat64().Counter("name.sum") - require.NoError(t, err) - - require.Nil(t, testHandler.Flush()) - c.Add(ctx, math.NaN()) - require.Error(t, testHandler.Flush()) -} - -func TestSDKAttrsDeduplication(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - counter, err := meter.SyncInt64().Counter("name.sum") - require.NoError(t, err) - - const ( - maxKeys = 21 - keySets = 2 - repeats = 3 - ) - var keysA []attribute.Key - var keysB []attribute.Key - - for i := 0; i < maxKeys; i++ { - keysA = append(keysA, attribute.Key(fmt.Sprintf("A%03d", i))) - keysB = append(keysB, attribute.Key(fmt.Sprintf("B%03d", i))) - } - - allExpect := map[string]float64{} - for numKeys := 0; numKeys < maxKeys; numKeys++ { - var kvsA []attribute.KeyValue - var kvsB []attribute.KeyValue - for r := 0; r < repeats; r++ { - for i := 0; i < numKeys; i++ { - kvsA = append(kvsA, keysA[i].Int(r)) - kvsB = append(kvsB, keysB[i].Int(r)) - } - } - - var expectA []attribute.KeyValue - var expectB []attribute.KeyValue - for i := 0; i < numKeys; i++ { - expectA = append(expectA, keysA[i].Int(repeats-1)) - expectB = append(expectB, keysB[i].Int(repeats-1)) - } - - counter.Add(ctx, 1, kvsA...) - counter.Add(ctx, 1, kvsA...) - format := func(attrs []attribute.KeyValue) string { - str := attribute.DefaultEncoder().Encode(newSetIter(attrs...)) - return fmt.Sprint("name.sum/", str, "/") - } - allExpect[format(expectA)] += 2 - - if numKeys != 0 { - // In this case A and B sets are the same. - counter.Add(ctx, 1, kvsB...) - counter.Add(ctx, 1, kvsB...) - allExpect[format(expectB)] += 2 - } - } - - sdk.Collect(ctx) - - require.EqualValues(t, allExpect, processor.Values()) -} - -func newSetIter(kvs ...attribute.KeyValue) attribute.Iterator { - attrs := attribute.NewSet(kvs...) - return attrs.Iter() -} - -func TestDefaultAttributeEncoder(t *testing.T) { - encoder := attribute.DefaultEncoder() - - encoded := encoder.Encode(newSetIter(attribute.String("A", "B"), attribute.String("C", "D"))) - require.Equal(t, `A=B,C=D`, encoded) - - encoded = encoder.Encode(newSetIter(attribute.String("A", "B,c=d"), attribute.String(`C\`, "D"))) - require.Equal(t, `A=B\,c\=d,C\\=D`, encoded) - - encoded = encoder.Encode(newSetIter(attribute.String(`\`, `=`), attribute.String(`,`, `\`))) - require.Equal(t, `\,=\\,\\=\=`, encoded) - - // Note: the attr encoder does not sort or de-dup values, - // that is done in Attributes(...). - encoded = encoder.Encode(newSetIter( - attribute.Int("I", 1), - attribute.Int64("I64", 1), - attribute.Float64("F64", 1), - attribute.Float64("F64", 1), - attribute.String("S", "1"), - attribute.Bool("B", true), - )) - require.Equal(t, "B=true,F64=1,I=1,I64=1,S=1", encoded) -} - -func TestObserverCollection(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - mult := 1 - - gaugeF, err := meter.AsyncFloat64().Gauge("float.gauge.lastvalue") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - gaugeF, - }, func(ctx context.Context) { - gaugeF.Observe(ctx, float64(mult), attribute.String("A", "B")) - // last value wins - gaugeF.Observe(ctx, float64(-mult), attribute.String("A", "B")) - gaugeF.Observe(ctx, float64(-mult), attribute.String("C", "D")) - }) - require.NoError(t, err) - - gaugeI, err := meter.AsyncInt64().Gauge("int.gauge.lastvalue") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - gaugeI, - }, func(ctx context.Context) { - gaugeI.Observe(ctx, int64(-mult), attribute.String("A", "B")) - gaugeI.Observe(ctx, int64(mult)) - // last value wins - gaugeI.Observe(ctx, int64(mult), attribute.String("A", "B")) - gaugeI.Observe(ctx, int64(mult)) - }) - require.NoError(t, err) - - counterF, err := meter.AsyncFloat64().Counter("float.counterobserver.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - counterF, - }, func(ctx context.Context) { - counterF.Observe(ctx, float64(mult), attribute.String("A", "B")) - counterF.Observe(ctx, float64(2*mult), attribute.String("A", "B")) - counterF.Observe(ctx, float64(mult), attribute.String("C", "D")) - }) - require.NoError(t, err) - - counterI, err := meter.AsyncInt64().Counter("int.counterobserver.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - counterI, - }, func(ctx context.Context) { - counterI.Observe(ctx, int64(2*mult), attribute.String("A", "B")) - counterI.Observe(ctx, int64(mult)) - // last value wins - counterI.Observe(ctx, int64(mult), attribute.String("A", "B")) - counterI.Observe(ctx, int64(mult)) - }) - require.NoError(t, err) - - updowncounterF, err := meter.AsyncFloat64().UpDownCounter("float.updowncounterobserver.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - updowncounterF, - }, func(ctx context.Context) { - updowncounterF.Observe(ctx, float64(mult), attribute.String("A", "B")) - updowncounterF.Observe(ctx, float64(-2*mult), attribute.String("A", "B")) - updowncounterF.Observe(ctx, float64(mult), attribute.String("C", "D")) - }) - require.NoError(t, err) - - updowncounterI, err := meter.AsyncInt64().UpDownCounter("int.updowncounterobserver.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - updowncounterI, - }, func(ctx context.Context) { - updowncounterI.Observe(ctx, int64(2*mult), attribute.String("A", "B")) - updowncounterI.Observe(ctx, int64(mult)) - // last value wins - updowncounterI.Observe(ctx, int64(mult), attribute.String("A", "B")) - updowncounterI.Observe(ctx, int64(-mult)) - }) - require.NoError(t, err) - - unused, err := meter.AsyncInt64().Gauge("empty.gauge.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ - unused, - }, func(ctx context.Context) { - }) - require.NoError(t, err) - - for mult = 0; mult < 3; mult++ { - processor.Reset() - - collected := sdk.Collect(ctx) - require.Equal(t, collected, len(processor.Values())) - - mult := float64(mult) - require.EqualValues(t, map[string]float64{ - "float.gauge.lastvalue/A=B/": -mult, - "float.gauge.lastvalue/C=D/": -mult, - "int.gauge.lastvalue//": mult, - "int.gauge.lastvalue/A=B/": mult, - - "float.counterobserver.sum/A=B/": 3 * mult, - "float.counterobserver.sum/C=D/": mult, - "int.counterobserver.sum//": 2 * mult, - "int.counterobserver.sum/A=B/": 3 * mult, - - "float.updowncounterobserver.sum/A=B/": -mult, - "float.updowncounterobserver.sum/C=D/": mult, - "int.updowncounterobserver.sum//": 0, - "int.updowncounterobserver.sum/A=B/": 3 * mult, - }, processor.Values()) - } -} - -func TestCounterObserverInputRange(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - // TODO: these tests are testing for negative values, not for _descending values_. Fix. - counterF, _ := meter.AsyncFloat64().Counter("float.counterobserver.sum") - err := meter.RegisterCallback([]instrument.Asynchronous{ - counterF, - }, func(ctx context.Context) { - counterF.Observe(ctx, -2, attribute.String("A", "B")) - require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - counterF.Observe(ctx, -1, attribute.String("C", "D")) - require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - }) - require.NoError(t, err) - counterI, _ := meter.AsyncInt64().Counter("int.counterobserver.sum") - err = meter.RegisterCallback([]instrument.Asynchronous{ - counterI, - }, func(ctx context.Context) { - counterI.Observe(ctx, -1, attribute.String("A", "B")) - require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - counterI.Observe(ctx, -1) - require.Equal(t, aggregation.ErrNegativeInput, testHandler.Flush()) - }) - require.NoError(t, err) - - collected := sdk.Collect(ctx) - - require.Equal(t, 0, collected) - require.EqualValues(t, map[string]float64{}, processor.Values()) - - // check that the error condition was reset - require.NoError(t, testHandler.Flush()) -} - -func TestObserverBatch(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - floatGaugeObs, _ := meter.AsyncFloat64().Gauge("float.gauge.lastvalue") - intGaugeObs, _ := meter.AsyncInt64().Gauge("int.gauge.lastvalue") - floatCounterObs, _ := meter.AsyncFloat64().Counter("float.counterobserver.sum") - intCounterObs, _ := meter.AsyncInt64().Counter("int.counterobserver.sum") - floatUpDownCounterObs, _ := meter.AsyncFloat64().UpDownCounter("float.updowncounterobserver.sum") - intUpDownCounterObs, _ := meter.AsyncInt64().UpDownCounter("int.updowncounterobserver.sum") - - err := meter.RegisterCallback([]instrument.Asynchronous{ - floatGaugeObs, - intGaugeObs, - floatCounterObs, - intCounterObs, - floatUpDownCounterObs, - intUpDownCounterObs, - }, func(ctx context.Context) { - ab := attribute.String("A", "B") - floatGaugeObs.Observe(ctx, 1, ab) - floatGaugeObs.Observe(ctx, -1, ab) - intGaugeObs.Observe(ctx, -1, ab) - intGaugeObs.Observe(ctx, 1, ab) - floatCounterObs.Observe(ctx, 1000, ab) - intCounterObs.Observe(ctx, 100, ab) - floatUpDownCounterObs.Observe(ctx, -1000, ab) - intUpDownCounterObs.Observe(ctx, -100, ab) - - cd := attribute.String("C", "D") - floatGaugeObs.Observe(ctx, -1, cd) - floatCounterObs.Observe(ctx, -1, cd) - floatUpDownCounterObs.Observe(ctx, -1, cd) - - intGaugeObs.Observe(ctx, 1) - intGaugeObs.Observe(ctx, 1) - intCounterObs.Observe(ctx, 10) - floatCounterObs.Observe(ctx, 1.1) - intUpDownCounterObs.Observe(ctx, 10) - }) - require.NoError(t, err) - - collected := sdk.Collect(ctx) - - require.Equal(t, collected, len(processor.Values())) - - require.EqualValues(t, map[string]float64{ - "float.counterobserver.sum//": 1.1, - "float.counterobserver.sum/A=B/": 1000, - "int.counterobserver.sum//": 10, - "int.counterobserver.sum/A=B/": 100, - - "int.updowncounterobserver.sum/A=B/": -100, - "float.updowncounterobserver.sum/A=B/": -1000, - "int.updowncounterobserver.sum//": 10, - "float.updowncounterobserver.sum/C=D/": -1, - - "float.gauge.lastvalue/A=B/": -1, - "float.gauge.lastvalue/C=D/": -1, - "int.gauge.lastvalue//": 1, - "int.gauge.lastvalue/A=B/": 1, - }, processor.Values()) -} - -// TestRecordPersistence ensures that a direct-called instrument that is -// repeatedly used each interval results in a persistent record, so that its -// encoded attribute will be cached across collection intervals. -func TestRecordPersistence(t *testing.T) { - ctx := context.Background() - meter, sdk, selector, _ := newSDK(t) - - c, err := meter.SyncFloat64().Counter("name.sum") - require.NoError(t, err) - - uk := attribute.String("bound", "false") - - for i := 0; i < 100; i++ { - c.Add(ctx, 1, uk) - sdk.Collect(ctx) - } - - require.Equal(t, 2, selector.newAggCount) -} - -func TestIncorrectInstruments(t *testing.T) { - // The Batch observe/record APIs are susceptible to - // uninitialized instruments. - var observer asyncint64.Gauge - - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - // Now try with uninitialized instruments. - err := meter.RegisterCallback([]instrument.Asynchronous{ - observer, - }, func(ctx context.Context) { - observer.Observe(ctx, 1) - }) - require.ErrorIs(t, err, metricsdk.ErrBadInstrument) - - collected := sdk.Collect(ctx) - err = testHandler.Flush() - require.NoError(t, err) - require.Equal(t, 0, collected) - - // Now try with instruments from another SDK. - noopMeter := metric.NewNoopMeter() - observer, _ = noopMeter.AsyncInt64().Gauge("observer") - - err = meter.RegisterCallback( - []instrument.Asynchronous{observer}, - func(ctx context.Context) { - observer.Observe(ctx, 1) - }, - ) - require.ErrorIs(t, err, metricsdk.ErrBadInstrument) - - collected = sdk.Collect(ctx) - require.Equal(t, 0, collected) - require.EqualValues(t, map[string]float64{}, processor.Values()) - - err = testHandler.Flush() - require.NoError(t, err) -} - -func TestSyncInAsync(t *testing.T) { - ctx := context.Background() - meter, sdk, _, processor := newSDK(t) - - counter, _ := meter.SyncFloat64().Counter("counter.sum") - gauge, _ := meter.AsyncInt64().Gauge("observer.lastvalue") - - err := meter.RegisterCallback([]instrument.Asynchronous{ - gauge, - }, func(ctx context.Context) { - gauge.Observe(ctx, 10) - counter.Add(ctx, 100) - }) - require.NoError(t, err) - - sdk.Collect(ctx) - - require.EqualValues(t, map[string]float64{ - "counter.sum//": 100, - "observer.lastvalue//": 10, - }, processor.Values()) -} diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index bcb641ee446..6cbc7fdfc0d 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -12,119 +12,35 @@ // See the License for the specific language governing permissions and // limitations under the License. -/* -Package metric implements the OpenTelemetry metric API. - -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. - -The Accumulator type supports configurable metrics export behavior through a -collection of export interfaces that support various export strategies, -described below. - -The OpenTelemetry metric API consists of methods for constructing synchronous -and asynchronous instruments. There are two constructors per instrument for -the two kinds of number (int64, float64). - -Synchronous instruments are managed by a sync.Map containing a *record -with the current state for each synchronous instrument. A lock-free -algorithm is used to protect against races when adding and removing -items from the sync.Map. - -Asynchronous instruments are managed by an internal -AsyncInstrumentState, which coordinates calling batch and single -instrument callbacks. - -# Internal Structure - -Each observer also has its own kind of record stored in the SDK. This -record contains a set of recorders for every specific attribute set used in -the callback. - -A sync.Map maintains the mapping of current instruments and attribute sets to -internal records. To find a record, the SDK consults the Map to locate an -existing record, otherwise it constructs a new record. The SDK maintains a -count of the number of references to each record, ensuring that records are -not reclaimed from the Map while they are still active from the user's -perspective. - -Metric collection is performed via a single-threaded call to Collect that -sweeps through all records in the SDK, checkpointing their state. When a -record is discovered that has no references and has not been updated since -the prior collection pass, it is removed from the Map. - -Both synchronous and asynchronous instruments have an associated -aggregator, which maintains the current state resulting from all metric -events since its last checkpoint. Aggregators may be lock-free or they may -use locking, but they should expect to be called concurrently. Aggregators -must be capable of merging with another aggregator of the same type. - -# Export Pipeline - -While the SDK serves to maintain a current set of records and -coordinate collection, the behavior of a metrics export pipeline is -configured through the export types in -go.opentelemetry.io/otel/sdk/metric/export. It is important to keep -in mind the context these interfaces are called from. There are two -contexts, instrumentation context, where a user-level goroutine that -enters the SDK resulting in a new record, and collection context, -where a system-level thread performs a collection pass through the -SDK. - -Descriptor is a struct that describes the metric instrument to the -export pipeline, containing the name, units, description, metric kind, -number kind (int64 or float64). A Descriptor accompanies metric data -as it passes through the export pipeline. - -The AggregatorSelector interface supports choosing the method of -aggregation to apply to a particular instrument, by delegating the -construction of an Aggregator to this interface. Given the Descriptor, -the AggregatorFor method returns an implementation of Aggregator. If this -interface returns nil, the metric will be disabled. The aggregator should -be matched to the capabilities of the exporter. Selecting the aggregator -for Adding instruments is relatively straightforward, but many options -are available for aggregating distributions from Grouping instruments. - -Aggregator is an interface which implements a concrete strategy for -aggregating metric updates. Several Aggregator implementations are -provided by the SDK. Aggregators may be lock-free or use locking, -depending on their structure and semantics. Aggregators implement an -Update method, called in instrumentation context, to receive a single -metric event. Aggregators implement a Checkpoint method, called in -collection context, to save a checkpoint of the current state. -Aggregators implement a Merge method, also called in collection -context, that combines state from two aggregators into one. Each SDK -record has an associated aggregator. - -Processor is an interface which sits between the SDK and an exporter. -The Processor embeds an AggregatorSelector, used by the SDK to assign -new Aggregators. The Processor supports a Process() API for submitting -checkpointed aggregators to the processor, and a Reader() API -for producing a complete checkpoint for the exporter. Two default -Processor implementations are provided, the "defaultkeys" Processor groups -aggregate metrics by their recommended Descriptor.Keys(), the -"simple" Processor aggregates metrics at full dimensionality. - -Reader is an interface between the Processor and the Exporter. -After completing a collection pass, the Processor.Reader() method -returns a Reader, which the Exporter uses to iterate over all -the updated metrics. - -Record is a struct containing the state of an individual exported -metric. This is the result of one collection interface for one -instrument and one attribute set. - -Exporter is the final stage of an export pipeline. It is called with -a Reader capable of enumerating all the updated metrics. - -Controller is not an export interface per se, but it orchestrates the -export pipeline. For example, a "push" controller will establish a -periodic timer to regularly collect and export metrics. A "pull" -controller will await a pull request before initiating metric -collection. Either way, the job of the controller is to call the SDK -Collect() method, then read the checkpoint, then invoke the exporter. -Controllers are expected to implement the public metric.MeterProvider -API, meaning they can be installed as the global Meter provider. -*/ +// Package metric provides an implementation of the OpenTelemetry metric SDK. +// +// See https://opentelemetry.io/docs/concepts/signals/metrics/ for information +// about the concept of OpenTelemetry metrics and +// https://opentelemetry.io/docs/concepts/components/ for more information +// about OpenTelemetry SDKs. +// +// The entry point for the metric package is the MeterProvider. It is the +// object that all API calls use to create Meters, instruments, and ultimately +// make metric measurements. Also, it is an object that should be used to +// control the life-cycle (start, flush, and shutdown) of the SDK. +// +// A MeterProvider needs to be configured to export the measured data, this is +// done by configuring it with a Reader implementation (using the WithReader +// MeterProviderOption). Readers take two forms: ones that push to an endpoint +// (NewPeriodicReader), and ones that an endpoint pulls from. See the +// go.opentelemetry.io/otel/exporters package for exporters that can be used as +// or with these Readers. +// +// Each Reader, when registered with the MeterProvider, can be augmented with a +// View. Views allow users that run OpenTelemetry instrumented code to modify +// the generated data of that instrumentation. See the +// go.opentelemetry.io/otel/sdk/metric/view package for more information about +// Views. +// +// The data generated by a MeterProvider needs to include information about its +// origin. A MeterProvider needs to be configured with a Resource, using the +// WithResource MeterProviderOption, to include this information. This Resource +// should be used to describe the unique runtime environment instrumented code +// is being run on. That way when multiple instances of the code are collected +// at a single endpoint their origin is decipherable. package metric // import "go.opentelemetry.io/otel/sdk/metric" diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go new file mode 100644 index 00000000000..eabe781738a --- /dev/null +++ b/sdk/metric/example_test.go @@ -0,0 +1,63 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric_test + +import ( + "context" + "log" + + "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" +) + +func Example() { + // This reader is used as a stand-in for a reader that will actually export + // data. See exporters in the go.opentelemetry.io/otel/exporters package + // for more information. + reader := metric.NewManualReader() + + // See the go.opentelemetry.io/otel/sdk/resource package for more + // information about how to create and use Resources. + res := resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("my-service"), + semconv.ServiceVersionKey.String("v0.1.0"), + ) + + meterProvider := metric.NewMeterProvider( + metric.WithResource(res), + metric.WithReader(reader), + ) + global.SetMeterProvider(meterProvider) + defer func() { + err := meterProvider.Shutdown(context.Background()) + if err != nil { + log.Fatalln(err) + } + }() + // The MeterProvider is configured and registered globally. You can now run + // your code instrumented with the OpenTelemetry API that uses the global + // MeterProvider without having to pass this MeterProvider instance. Or, + // you can pass this instance directly to your instrumented code if it + // accepts a MeterProvider instance. + // + // See the go.opentelemetry.io/otel/metric package for more information + // about the metric API. +} diff --git a/sdk/metric/export/aggregation/aggregation.go b/sdk/metric/export/aggregation/aggregation.go deleted file mode 100644 index c43651c5889..00000000000 --- a/sdk/metric/export/aggregation/aggregation.go +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregation // import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - -import ( - "fmt" - "time" - - "go.opentelemetry.io/otel/sdk/metric/number" -) - -// These interfaces describe the various ways to access state from an -// Aggregation. - -type ( - // Aggregation is an interface returned by the Aggregator - // containing an interval of metric data. - Aggregation interface { - // Kind returns a short identifying string to identify - // the Aggregator that was used to produce the - // Aggregation (e.g., "Sum"). - Kind() Kind - } - - // Sum returns an aggregated sum. - Sum interface { - Aggregation - Sum() (number.Number, error) - } - - // Count returns the number of values that were aggregated. - Count interface { - Aggregation - Count() (uint64, error) - } - - // LastValue returns the latest value that was aggregated. - LastValue interface { - Aggregation - LastValue() (number.Number, time.Time, error) - } - - // Buckets represents histogram buckets boundaries and counts. - // - // For a Histogram with N defined boundaries, e.g, [x, y, z]. - // There are N+1 counts: [-inf, x), [x, y), [y, z), [z, +inf]. - Buckets struct { - // Boundaries are floating point numbers, even when - // aggregating integers. - Boundaries []float64 - - // Counts holds the count in each bucket. - Counts []uint64 - } - - // Histogram returns the count of events in pre-determined buckets. - Histogram interface { - Aggregation - Count() (uint64, error) - Sum() (number.Number, error) - Histogram() (Buckets, error) - } -) - -type ( - // Kind is a short name for the Aggregator that produces an - // Aggregation, used for descriptive purpose only. Kind is a - // string to allow user-defined Aggregators. - // - // When deciding how to handle an Aggregation, Exporters are - // encouraged to decide based on conversion to the above - // interfaces based on strength, not on Kind value, when - // deciding how to expose metric data. This enables - // user-supplied Aggregators to replace builtin Aggregators. - // - // For example, test for a Histogram before testing for a - // Sum, and so on. - Kind string -) - -// Kind description constants. -const ( - SumKind Kind = "Sum" - HistogramKind Kind = "Histogram" - LastValueKind Kind = "Lastvalue" -) - -// Sentinel errors for Aggregation interface. -var ( - ErrNegativeInput = fmt.Errorf("negative value is out of range for this instrument") - ErrNaNInput = fmt.Errorf("invalid input value: NaN") - ErrInconsistentType = fmt.Errorf("inconsistent aggregator types") - - // ErrNoCumulativeToDelta is returned when requesting delta - // export kind for a precomputed sum instrument. - ErrNoCumulativeToDelta = fmt.Errorf("cumulative to delta not implemented") - - // ErrNoData is returned when (due to a race with collection) - // the Aggregator is check-pointed before the first value is set. - // The aggregator should simply be skipped in this case. - ErrNoData = fmt.Errorf("no data collected by this aggregator") -) - -// String returns the string value of Kind. -func (k Kind) String() string { - return string(k) -} diff --git a/sdk/metric/export/aggregation/temporality.go b/sdk/metric/export/aggregation/temporality.go deleted file mode 100644 index 0612fe06af0..00000000000 --- a/sdk/metric/export/aggregation/temporality.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:generate stringer -type=Temporality - -package aggregation // import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - -import ( - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// Temporality indicates the temporal aggregation exported by an exporter. -// These bits may be OR-d together when multiple exporters are in use. -type Temporality uint8 - -const ( - // CumulativeTemporality indicates that an Exporter expects a - // Cumulative Aggregation. - CumulativeTemporality Temporality = 1 - - // DeltaTemporality indicates that an Exporter expects a - // Delta Aggregation. - DeltaTemporality Temporality = 2 -) - -// Includes returns if t includes support for other temporality. -func (t Temporality) Includes(other Temporality) bool { - return t&other != 0 -} - -// MemoryRequired returns whether an exporter of this temporality requires -// memory to export correctly. -func (t Temporality) MemoryRequired(mkind sdkapi.InstrumentKind) bool { - switch mkind { - case sdkapi.HistogramInstrumentKind, sdkapi.GaugeObserverInstrumentKind, - sdkapi.CounterInstrumentKind, sdkapi.UpDownCounterInstrumentKind: - // Delta-oriented instruments: - return t.Includes(CumulativeTemporality) - - case sdkapi.CounterObserverInstrumentKind, sdkapi.UpDownCounterObserverInstrumentKind: - // Cumulative-oriented instruments: - return t.Includes(DeltaTemporality) - } - // Something unexpected is happening--we could panic. This - // will become an error when the exporter tries to access a - // checkpoint, presumably, so let it be. - return false -} - -type ( - constantTemporalitySelector Temporality - statelessTemporalitySelector struct{} -) - -var ( - _ TemporalitySelector = constantTemporalitySelector(0) - _ TemporalitySelector = statelessTemporalitySelector{} -) - -// ConstantTemporalitySelector returns an TemporalitySelector that returns -// a constant Temporality. -func ConstantTemporalitySelector(t Temporality) TemporalitySelector { - return constantTemporalitySelector(t) -} - -// CumulativeTemporalitySelector returns an TemporalitySelector that -// always returns CumulativeTemporality. -func CumulativeTemporalitySelector() TemporalitySelector { - return ConstantTemporalitySelector(CumulativeTemporality) -} - -// DeltaTemporalitySelector returns an TemporalitySelector that -// always returns DeltaTemporality. -func DeltaTemporalitySelector() TemporalitySelector { - return ConstantTemporalitySelector(DeltaTemporality) -} - -// StatelessTemporalitySelector returns an TemporalitySelector that -// always returns the Temporality that avoids long-term memory -// requirements. -func StatelessTemporalitySelector() TemporalitySelector { - return statelessTemporalitySelector{} -} - -// TemporalityFor implements TemporalitySelector. -func (c constantTemporalitySelector) TemporalityFor(_ *sdkapi.Descriptor, _ Kind) Temporality { - return Temporality(c) -} - -// TemporalityFor implements TemporalitySelector. -func (s statelessTemporalitySelector) TemporalityFor(desc *sdkapi.Descriptor, kind Kind) Temporality { - if kind == SumKind && desc.InstrumentKind().PrecomputedSum() { - return CumulativeTemporality - } - return DeltaTemporality -} - -// TemporalitySelector is a sub-interface of Exporter used to indicate -// whether the Processor should compute Delta or Cumulative -// Aggregations. -type TemporalitySelector interface { - // TemporalityFor should return the correct Temporality that - // should be used when exporting data for the given metric - // instrument and Aggregator kind. - TemporalityFor(descriptor *sdkapi.Descriptor, aggregationKind Kind) Temporality -} diff --git a/sdk/metric/export/aggregation/temporality_test.go b/sdk/metric/export/aggregation/temporality_test.go deleted file mode 100644 index ab1682b729d..00000000000 --- a/sdk/metric/export/aggregation/temporality_test.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregation - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -func TestTemporalityIncludes(t *testing.T) { - require.True(t, CumulativeTemporality.Includes(CumulativeTemporality)) - require.True(t, DeltaTemporality.Includes(CumulativeTemporality|DeltaTemporality)) -} - -var deltaMemoryTemporalties = []sdkapi.InstrumentKind{ - sdkapi.CounterObserverInstrumentKind, - sdkapi.UpDownCounterObserverInstrumentKind, -} - -var cumulativeMemoryTemporalties = []sdkapi.InstrumentKind{ - sdkapi.HistogramInstrumentKind, - sdkapi.GaugeObserverInstrumentKind, - sdkapi.CounterInstrumentKind, - sdkapi.UpDownCounterInstrumentKind, -} - -func TestTemporalityMemoryRequired(t *testing.T) { - for _, kind := range deltaMemoryTemporalties { - require.True(t, DeltaTemporality.MemoryRequired(kind)) - require.False(t, CumulativeTemporality.MemoryRequired(kind)) - } - - for _, kind := range cumulativeMemoryTemporalties { - require.True(t, CumulativeTemporality.MemoryRequired(kind)) - require.False(t, DeltaTemporality.MemoryRequired(kind)) - } -} - -func TestTemporalitySelectors(t *testing.T) { - cAggTemp := CumulativeTemporalitySelector() - dAggTemp := DeltaTemporalitySelector() - sAggTemp := StatelessTemporalitySelector() - - for _, ikind := range append(deltaMemoryTemporalties, cumulativeMemoryTemporalties...) { - desc := sdkapi.NewDescriptor("instrument", ikind, number.Int64Kind, "", "") - - var akind Kind - if ikind.Adding() { - akind = SumKind - } else { - akind = HistogramKind - } - require.Equal(t, CumulativeTemporality, cAggTemp.TemporalityFor(&desc, akind)) - require.Equal(t, DeltaTemporality, dAggTemp.TemporalityFor(&desc, akind)) - require.False(t, sAggTemp.TemporalityFor(&desc, akind).MemoryRequired(ikind)) - } -} diff --git a/sdk/metric/export/metric.go b/sdk/metric/export/metric.go deleted file mode 100644 index 6168ca445ba..00000000000 --- a/sdk/metric/export/metric.go +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package export // import "go.opentelemetry.io/otel/sdk/metric/export" - -import ( - "context" - "sync" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -// Processor is responsible for deciding which kind of aggregation to -// use (via AggregatorSelector), gathering exported results from the -// SDK during collection, and deciding over which dimensions to group -// the exported data. -// -// The SDK supports binding only one of these interfaces, as it has -// the sole responsibility of determining which Aggregator to use for -// each record. -// -// The embedded AggregatorSelector interface is called (concurrently) -// in instrumentation context to select the appropriate Aggregator for -// an instrument. -// -// The `Process` method is called during collection in a -// single-threaded context from the SDK, after the aggregator is -// checkpointed, allowing the processor to build the set of metrics -// currently being exported. -type Processor interface { - // AggregatorSelector is responsible for selecting the - // concrete type of Aggregator used for a metric in the SDK. - // - // This may be a static decision based on fields of the - // Descriptor, or it could use an external configuration - // source to customize the treatment of each metric - // instrument. - // - // The result from AggregatorSelector.AggregatorFor should be - // the same type for a given Descriptor or else nil. The same - // type should be returned for a given descriptor, because - // Aggregators only know how to Merge with their own type. If - // the result is nil, the metric instrument will be disabled. - // - // Note that the SDK only calls AggregatorFor when new records - // require an Aggregator. This does not provide a way to - // disable metrics with active records. - AggregatorSelector - - // Process is called by the SDK once per internal record, passing the - // export Accumulation (a Descriptor, the corresponding attributes, and - // the checkpointed Aggregator). This call has no Context argument because - // it is expected to perform only computation. An SDK is not expected to - // call exporters from with Process, use a controller for that (see - // ./controllers/{pull,push}. - Process(accum Accumulation) error -} - -// AggregatorSelector supports selecting the kind of Aggregator to -// use at runtime for a specific metric instrument. -type AggregatorSelector interface { - // AggregatorFor allocates a variable number of aggregators of - // a kind suitable for the requested export. This method - // initializes a `...*Aggregator`, to support making a single - // allocation. - // - // When the call returns without initializing the *Aggregator - // to a non-nil value, the metric instrument is explicitly - // disabled. - // - // This must return a consistent type to avoid confusion in - // later stages of the metrics export process, i.e., when - // Merging or Checkpointing aggregators for a specific - // instrument. - // - // Note: This is context-free because the aggregator should - // not relate to the incoming context. This call should not - // block. - AggregatorFor(descriptor *sdkapi.Descriptor, agg ...*aggregator.Aggregator) -} - -// Checkpointer is the interface used by a Controller to coordinate -// the Processor with Accumulator(s) and Exporter(s). The -// StartCollection() and FinishCollection() methods start and finish a -// collection interval. Controllers call the Accumulator(s) during -// collection to process Accumulations. -type Checkpointer interface { - // Processor processes metric data for export. The Process - // method is bracketed by StartCollection and FinishCollection - // calls. The embedded AggregatorSelector can be called at - // any time. - Processor - - // Reader returns the current data set. This may be - // called before and after collection. The - // implementation is required to return the same value - // throughout its lifetime, since Reader exposes a - // sync.Locker interface. The caller is responsible for - // locking the Reader before initiating collection. - Reader() Reader - - // StartCollection begins a collection interval. - StartCollection() - - // FinishCollection ends a collection interval. - FinishCollection() error -} - -// CheckpointerFactory is an interface for producing configured -// Checkpointer instances. -type CheckpointerFactory interface { - NewCheckpointer() Checkpointer -} - -// Exporter handles presentation of the checkpoint of aggregate -// metrics. This is the final stage of a metrics export pipeline, -// where metric data are formatted for a specific system. -type Exporter interface { - // Export is called immediately after completing a collection - // pass in the SDK. - // - // The Context comes from the controller that initiated - // collection. - // - // The InstrumentationLibraryReader interface refers to the - // Processor that just completed collection. - Export(ctx context.Context, res *resource.Resource, reader InstrumentationLibraryReader) error - - // TemporalitySelector is an interface used by the Processor - // in deciding whether to compute Delta or Cumulative - // Aggregations when passing Records to this Exporter. - aggregation.TemporalitySelector -} - -// InstrumentationLibraryReader is an interface for exporters to iterate -// over one instrumentation library of metric data at a time. -type InstrumentationLibraryReader interface { - // ForEach calls the passed function once per instrumentation library, - // allowing the caller to emit metrics grouped by the library that - // produced them. - ForEach(readerFunc func(instrumentation.Library, Reader) error) error -} - -// Reader allows a controller to access a complete checkpoint of -// aggregated metrics from the Processor for a single library of -// metric data. This is passed to the Exporter which may then use -// ForEach to iterate over the collection of aggregated metrics. -type Reader interface { - // ForEach iterates over aggregated checkpoints for all - // metrics that were updated during the last collection - // period. Each aggregated checkpoint returned by the - // function parameter may return an error. - // - // The TemporalitySelector argument is used to determine - // whether the Record is computed using Delta or Cumulative - // aggregation. - // - // ForEach tolerates ErrNoData silently, as this is - // expected from the Meter implementation. Any other kind - // of error will immediately halt ForEach and return - // the error to the caller. - ForEach(tempSelector aggregation.TemporalitySelector, recordFunc func(Record) error) error - - // Locker supports locking the checkpoint set. Collection - // into the checkpoint set cannot take place (in case of a - // stateful processor) while it is locked. - // - // The Processor attached to the Accumulator MUST be called - // with the lock held. - sync.Locker - - // RLock acquires a read lock corresponding to this Locker. - RLock() - // RUnlock releases a read lock corresponding to this Locker. - RUnlock() -} - -// Metadata contains the common elements for exported metric data that -// are shared by the Accumulator->Processor and Processor->Exporter -// steps. -type Metadata struct { - descriptor *sdkapi.Descriptor - attrs *attribute.Set -} - -// Accumulation contains the exported data for a single metric instrument -// and attribute set, as prepared by an Accumulator for the Processor. -type Accumulation struct { - Metadata - aggregator aggregator.Aggregator -} - -// Record contains the exported data for a single metric instrument -// and attribute set, as prepared by the Processor for the Exporter. -// This includes the effective start and end time for the aggregation. -type Record struct { - Metadata - aggregation aggregation.Aggregation - start time.Time - end time.Time -} - -// Descriptor describes the metric instrument being exported. -func (m Metadata) Descriptor() *sdkapi.Descriptor { - return m.descriptor -} - -// Attributes returns the attribute set associated with the instrument and the -// aggregated data. -func (m Metadata) Attributes() *attribute.Set { - return m.attrs -} - -// NewAccumulation allows Accumulator implementations to construct new -// Accumulations to send to Processors. The Descriptor, attributes, and -// Aggregator represent aggregate metric events received over a single -// collection period. -func NewAccumulation(descriptor *sdkapi.Descriptor, attrs *attribute.Set, agg aggregator.Aggregator) Accumulation { - return Accumulation{ - Metadata: Metadata{ - descriptor: descriptor, - attrs: attrs, - }, - aggregator: agg, - } -} - -// Aggregator returns the checkpointed aggregator. It is safe to -// access the checkpointed state without locking. -func (r Accumulation) Aggregator() aggregator.Aggregator { - return r.aggregator -} - -// NewRecord allows Processor implementations to construct export records. -// The Descriptor, attributes, and Aggregator represent aggregate metric -// events received over a single collection period. -func NewRecord(descriptor *sdkapi.Descriptor, attrs *attribute.Set, agg aggregation.Aggregation, start, end time.Time) Record { - return Record{ - Metadata: Metadata{ - descriptor: descriptor, - attrs: attrs, - }, - aggregation: agg, - start: start, - end: end, - } -} - -// Aggregation returns the aggregation, an interface to the record and -// its aggregator, dependent on the kind of both the input and exporter. -func (r Record) Aggregation() aggregation.Aggregation { - return r.aggregation -} - -// StartTime is the start time of the interval covered by this aggregation. -func (r Record) StartTime() time.Time { - return r.start -} - -// EndTime is the end time of the interval covered by this aggregation. -func (r Record) EndTime() time.Time { - return r.end -} diff --git a/sdk/metric/export/metric_test.go b/sdk/metric/export/metric_test.go deleted file mode 100644 index 4a6b803b0c2..00000000000 --- a/sdk/metric/export/metric_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package export - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" -) - -var testSlice = []attribute.KeyValue{ - attribute.String("bar", "baz"), - attribute.Int("foo", 42), -} - -func newIter(slice []attribute.KeyValue) attribute.Iterator { - attrs := attribute.NewSet(slice...) - return attrs.Iter() -} - -func TestAttributeIterator(t *testing.T) { - iter := newIter(testSlice) - require.Equal(t, 2, iter.Len()) - - require.True(t, iter.Next()) - require.Equal(t, attribute.String("bar", "baz"), iter.Attribute()) - idx, kv := iter.IndexedAttribute() - require.Equal(t, 0, idx) - require.Equal(t, attribute.String("bar", "baz"), kv) - require.Equal(t, 2, iter.Len()) - - require.True(t, iter.Next()) - require.Equal(t, attribute.Int("foo", 42), iter.Attribute()) - idx, kv = iter.IndexedAttribute() - require.Equal(t, 1, idx) - require.Equal(t, attribute.Int("foo", 42), kv) - require.Equal(t, 2, iter.Len()) - - require.False(t, iter.Next()) - require.Equal(t, 2, iter.Len()) -} - -func TestEmptyAttributeIterator(t *testing.T) { - iter := newIter(nil) - require.Equal(t, 0, iter.Len()) - require.False(t, iter.Next()) -} - -func TestIteratorToSlice(t *testing.T) { - iter := newIter(testSlice) - got := iter.ToSlice() - require.Equal(t, testSlice, got) - - iter = newIter(nil) - got = iter.ToSlice() - require.Nil(t, got) -} diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go new file mode 100644 index 00000000000..309381fe8d3 --- /dev/null +++ b/sdk/metric/exporter.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// ErrExporterShutdown is returned if Export or Shutdown are called after an +// Exporter has been Shutdown. +var ErrExporterShutdown = fmt.Errorf("exporter is shutdown") + +// Exporter handles the delivery of metric data to external receivers. This is +// the final component in the metric push pipeline. +type Exporter interface { + // Export serializes and transmits metric data to a receiver. + // + // This is called synchronously, there is no concurrency safety + // requirement. Because of this, it is critical that all timeouts and + // cancellations of the passed context be honored. + // + // All retry logic must be contained in this function. The SDK does not + // implement any retry logic. All errors returned by this function are + // considered unrecoverable and will be reported to a configured error + // Handler. + Export(context.Context, metricdata.ResourceMetrics) error + + // ForceFlush flushes any metric data held by an exporter. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(context.Context) error + + // Shutdown flushes all metric data held by an exporter and releases any + // held computational resources. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // After Shutdown is called, calls to Export will perform no operation and + // instead will return an error indicating the shutdown state. + Shutdown(context.Context) error +} diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 7a5922ae9a9..1c96d819855 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -1,29 +1,28 @@ module go.opentelemetry.io/otel/sdk/metric -go 1.17 - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/sdk => ../ - -replace go.opentelemetry.io/otel/trace => ../../trace +go 1.18 require ( - github.com/benbjohnson/clock v1.3.0 + github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 ) require ( github.com/davecgh/go-spew v1.1.0 // indirect - github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) + +replace go.opentelemetry.io/otel => ../.. + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/sdk => ../ diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 4e67ced5ad4..2e2aed63d24 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -1,5 +1,3 @@ -github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= diff --git a/sdk/metric/histogram_stress_test.go b/sdk/metric/histogram_stress_test.go deleted file mode 100644 index abc8b967c60..00000000000 --- a/sdk/metric/histogram_stress_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric_test - -import ( - "context" - "math/rand" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -func TestStressInt64Histogram(t *testing.T) { - desc := metrictest.NewDescriptor("some_metric", sdkapi.HistogramInstrumentKind, number.Int64Kind) - - alloc := histogram.New(2, &desc, histogram.WithExplicitBoundaries([]float64{25, 50, 75})) - h, ckpt := &alloc[0], &alloc[1] - - ctx, cancelFunc := context.WithCancel(context.Background()) - defer cancelFunc() - go func() { - rnd := rand.New(rand.NewSource(time.Now().Unix())) - for { - select { - case <-ctx.Done(): - return - default: - _ = h.Update(ctx, number.NewInt64Number(rnd.Int63()%100), &desc) - } - } - }() - - startTime := time.Now() - for time.Since(startTime) < time.Second { - require.NoError(t, h.SynchronizedMove(ckpt, &desc)) - - b, _ := ckpt.Histogram() - c, _ := ckpt.Count() - - var realCount uint64 - for _, c := range b.Counts { - realCount += c - } - - if realCount != c { - t.Fail() - } - } -} diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go new file mode 100644 index 00000000000..19f3840887a --- /dev/null +++ b/sdk/metric/instrument.go @@ -0,0 +1,76 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/metric/internal" +) + +type instrumentImpl[N int64 | float64] struct { + instrument.Asynchronous + instrument.Synchronous + + aggregators []internal.Aggregator[N] +} + +var _ asyncfloat64.Counter = &instrumentImpl[float64]{} +var _ asyncfloat64.UpDownCounter = &instrumentImpl[float64]{} +var _ asyncfloat64.Gauge = &instrumentImpl[float64]{} +var _ asyncint64.Counter = &instrumentImpl[int64]{} +var _ asyncint64.UpDownCounter = &instrumentImpl[int64]{} +var _ asyncint64.Gauge = &instrumentImpl[int64]{} +var _ syncfloat64.Counter = &instrumentImpl[float64]{} +var _ syncfloat64.UpDownCounter = &instrumentImpl[float64]{} +var _ syncfloat64.Histogram = &instrumentImpl[float64]{} +var _ syncint64.Counter = &instrumentImpl[int64]{} +var _ syncint64.UpDownCounter = &instrumentImpl[int64]{} +var _ syncint64.Histogram = &instrumentImpl[int64]{} + +func (i *instrumentImpl[N]) Observe(ctx context.Context, val N, attrs ...attribute.KeyValue) { + // Only record a value if this is being called from the MetricProvider. + _, ok := ctx.Value(produceKey).(struct{}) + if !ok { + return + } + i.aggregate(ctx, val, attrs) +} + +func (i *instrumentImpl[N]) Add(ctx context.Context, val N, attrs ...attribute.KeyValue) { + i.aggregate(ctx, val, attrs) +} + +func (i *instrumentImpl[N]) Record(ctx context.Context, val N, attrs ...attribute.KeyValue) { + i.aggregate(ctx, val, attrs) +} + +func (i *instrumentImpl[N]) aggregate(ctx context.Context, val N, attrs []attribute.KeyValue) { + if err := ctx.Err(); err != nil { + return + } + for _, agg := range i.aggregators { + agg.Aggregate(val, attribute.NewSet(attrs...)) + } +} diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go new file mode 100644 index 00000000000..fd79aa74d91 --- /dev/null +++ b/sdk/metric/instrument_provider.go @@ -0,0 +1,275 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "fmt" + + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +type asyncInt64Provider struct { + scope instrumentation.Scope + registry *pipelineRegistry +} + +var _ asyncint64.InstrumentProvider = asyncInt64Provider{} + +// Counter creates an instrument for recording increasing values. +func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncUpDownCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +// Gauge creates an instrument for recording the current value. +func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncGauge, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +type asyncFloat64Provider struct { + scope instrumentation.Scope + registry *pipelineRegistry +} + +var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} + +// Counter creates an instrument for recording increasing values. +func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncUpDownCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} + +// Gauge creates an instrument for recording the current value. +func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.AsyncGauge, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} + +type syncInt64Provider struct { + scope instrumentation.Scope + registry *pipelineRegistry +} + +var _ syncint64.InstrumentProvider = syncInt64Provider{} + +// Counter creates an instrument for recording increasing values. +func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncUpDownCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +// Histogram creates an instrument for recording the current value. +func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[int64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncHistogram, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[int64]{ + aggregators: aggs, + }, err +} + +type syncFloat64Provider struct { + scope instrumentation.Scope + registry *pipelineRegistry +} + +var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} + +// Counter creates an instrument for recording increasing values. +func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} + +// UpDownCounter creates an instrument for recording changes of a value. +func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncUpDownCounter, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} + +// Histogram creates an instrument for recording the current value. +func (p syncFloat64Provider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { + cfg := instrument.NewConfig(opts...) + + aggs, err := createAggregators[float64](p.registry, view.Instrument{ + Scope: p.scope, + Name: name, + Description: cfg.Description(), + Kind: view.SyncHistogram, + }, cfg.Unit()) + if len(aggs) == 0 && err != nil { + err = fmt.Errorf("instrument does not match any view: %w", err) + } + return &instrumentImpl[float64]{ + aggregators: aggs, + }, err +} diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregator.go new file mode 100644 index 00000000000..e9068a4b936 --- /dev/null +++ b/sdk/metric/internal/aggregator.go @@ -0,0 +1,40 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// now is used to return the current local time while allowing tests to +// override the the default time.Now function. +var now = time.Now + +// Aggregator forms an aggregation from a collection of recorded measurements. +type Aggregator[N int64 | float64] interface { + // Aggregate records the measurement, scoped by attr, and aggregates it + // into an aggregation. + Aggregate(measurement N, attr attribute.Set) + + // Aggregation returns an Aggregation, for all the aggregated + // measurements made and ends an aggregation cycle. + Aggregation() metricdata.Aggregation +} diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go new file mode 100644 index 00000000000..dc4a0cd499e --- /dev/null +++ b/sdk/metric/internal/aggregator_example_test.go @@ -0,0 +1,122 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal + +import ( + "context" + "fmt" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +type meter struct { + // When a reader initiates a collection, the meter would collect + // aggregations from each of these functions. + aggregations []metricdata.Aggregation +} + +func (m *meter) SyncInt64() syncint64.InstrumentProvider { + // The same would be done for all the other instrument providers. + return (*syncInt64Provider)(m) +} + +type syncInt64Provider meter + +func (p *syncInt64Provider) Counter(string, ...instrument.Option) (syncint64.Counter, error) { + // This is an example of how a synchronous int64 provider would create an + // aggregator for a new counter. At this point the provider would + // determine the aggregation and temporality to used based on the Reader + // and View configuration. Assume here these are determined to be a + // cumulative sum. + + aggregator := NewCumulativeSum[int64](true) + count := inst{aggregateFunc: aggregator.Aggregate} + + p.aggregations = append(p.aggregations, aggregator.Aggregation()) + + fmt.Printf("using %T aggregator for counter\n", aggregator) + + return count, nil +} + +func (p *syncInt64Provider) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { + // This is an example of how a synchronous int64 provider would create an + // aggregator for a new up-down counter. At this point the provider would + // determine the aggregation and temporality to used based on the Reader + // and View configuration. Assume here these are determined to be a + // last-value aggregation (the temporality does not affect the produced + // aggregations). + + aggregator := NewLastValue[int64]() + upDownCount := inst{aggregateFunc: aggregator.Aggregate} + + p.aggregations = append(p.aggregations, aggregator.Aggregation()) + + fmt.Printf("using %T aggregator for up-down counter\n", aggregator) + + return upDownCount, nil +} + +func (p *syncInt64Provider) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { + // This is an example of how a synchronous int64 provider would create an + // aggregator for a new histogram. At this point the provider would + // determine the aggregation and temporality to used based on the Reader + // and View configuration. Assume here these are determined to be a delta + // explicit-bucket histogram. + + aggregator := NewDeltaHistogram[int64](aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + NoMinMax: false, + }) + hist := inst{aggregateFunc: aggregator.Aggregate} + + p.aggregations = append(p.aggregations, aggregator.Aggregation()) + + fmt.Printf("using %T aggregator for histogram\n", aggregator) + + return hist, nil +} + +// inst is a generalized int64 synchronous counter, up-down counter, and +// histogram used for demonstration purposes only. +type inst struct { + instrument.Synchronous + + aggregateFunc func(int64, attribute.Set) +} + +func (inst) Add(context.Context, int64, ...attribute.KeyValue) {} +func (inst) Record(context.Context, int64, ...attribute.KeyValue) {} + +func Example() { + m := meter{} + provider := m.SyncInt64() + + _, _ = provider.Counter("counter example") + _, _ = provider.UpDownCounter("up-down counter example") + _, _ = provider.Histogram("histogram example") + + // Output: + // using *internal.cumulativeSum[int64] aggregator for counter + // using *internal.lastValue[int64] aggregator for up-down counter + // using *internal.deltaHistogram[int64] aggregator for histogram +} diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregator_test.go new file mode 100644 index 00000000000..e93d643b642 --- /dev/null +++ b/sdk/metric/internal/aggregator_test.go @@ -0,0 +1,155 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "strconv" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +const ( + defaultGoroutines = 5 + defaultMeasurements = 30 + defaultCycles = 3 +) + +var ( + alice = attribute.NewSet(attribute.String("user", "alice"), attribute.Bool("admin", true)) + bob = attribute.NewSet(attribute.String("user", "bob"), attribute.Bool("admin", false)) + carol = attribute.NewSet(attribute.String("user", "carol"), attribute.Bool("admin", false)) + + monoIncr = setMap{alice: 1, bob: 10, carol: 2} + nonMonoIncr = setMap{alice: 1, bob: -1, carol: 2} + + // Sat Jan 01 2000 00:00:00 GMT+0000. + staticTime = time.Unix(946684800, 0) + staticNowFunc = func() time.Time { return staticTime } + // Pass to t.Cleanup to override the now function with staticNowFunc and + // revert once the test completes. E.g. t.Cleanup(mockTime(now)). + mockTime = func(orig func() time.Time) (cleanup func()) { + now = staticNowFunc + return func() { now = orig } + } +) + +// setMap maps attribute sets to a number. +type setMap map[attribute.Set]int + +// expectFunc is a function that returns an Aggregation of expected values for +// a cycle that contains m measurements (total across all goroutines). Each +// call advances the cycle. +type expectFunc func(m int) metricdata.Aggregation + +// aggregatorTester runs an acceptance test on an Aggregator. It will ask an +// Aggregator to aggregate a set of values as if they were real measurements +// made MeasurementN number of times. This will be done in GoroutineN number +// of different goroutines. After the Aggregator has been asked to aggregate +// all these measurements, it is validated using a passed expecterFunc. This +// set of operation is a signle cycle, and the the aggregatorTester will run +// CycleN number of cycles. +type aggregatorTester[N int64 | float64] struct { + // GoroutineN is the number of goroutines aggregatorTester will use to run + // the test with. + GoroutineN int + // MeasurementN is the number of measurements that are made each cycle a + // goroutine runs the test. + MeasurementN int + // CycleN is the number of times a goroutine will make a set of + // measurements. + CycleN int +} + +func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap, eFunc expectFunc) func(*testing.T) { + m := at.MeasurementN * at.GoroutineN + return func(t *testing.T) { + for i := 0; i < at.CycleN; i++ { + var wg sync.WaitGroup + wg.Add(at.GoroutineN) + for i := 0; i < at.GoroutineN; i++ { + go func() { + defer wg.Done() + for j := 0; j < at.MeasurementN; j++ { + for attrs, n := range incr { + a.Aggregate(N(n), attrs) + } + } + }() + } + wg.Wait() + + metricdatatest.AssertAggregationsEqual(t, eFunc(m), a.Aggregation()) + } + } +} + +var bmarkResults metricdata.Aggregation + +func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() Aggregator[N], count int) { + attrs := make([]attribute.Set, count) + for i := range attrs { + attrs[i] = attribute.NewSet(attribute.Int("value", i)) + } + + b.Run("Aggregate", func(b *testing.B) { + agg := factory() + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + for _, attr := range attrs { + agg.Aggregate(1, attr) + } + } + bmarkResults = agg.Aggregation() + }) + + b.Run("Aggregations", func(b *testing.B) { + aggs := make([]Aggregator[N], b.N) + for n := range aggs { + a := factory() + for _, attr := range attrs { + a.Aggregate(1, attr) + } + aggs[n] = a + } + + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + bmarkResults = aggs[n].Aggregation() + } + }) +} + +func benchmarkAggregator[N int64 | float64](factory func() Aggregator[N]) func(*testing.B) { + counts := []int{1, 10, 100} + return func(b *testing.B) { + for _, n := range counts { + b.Run(strconv.Itoa(n), func(b *testing.B) { + benchmarkAggregatorN(b, factory, n) + }) + } + } +} diff --git a/sdk/metric/internal/doc.go b/sdk/metric/internal/doc.go new file mode 100644 index 00000000000..e1aa11ab2e1 --- /dev/null +++ b/sdk/metric/internal/doc.go @@ -0,0 +1,18 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal provides types and functionality used to aggregate and +// cycle the state of metric measurements made by the SDK. These types and +// functionality are meant only for internal SDK use. +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/filter.go new file mode 100644 index 00000000000..2407d016e90 --- /dev/null +++ b/sdk/metric/internal/filter.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// filter is an aggregator that applies attribute filter when Aggregating. filters +// do not have any backing memory, and must be constructed with a backing Aggregator. +type filter[N int64 | float64] struct { + filter func(attribute.Set) attribute.Set + aggregator Aggregator[N] + + sync.Mutex + seen map[attribute.Set]attribute.Set +} + +// NewFilter wraps an Aggregator with an attribute filtering function. +func NewFilter[N int64 | float64](agg Aggregator[N], fn func(attribute.Set) attribute.Set) Aggregator[N] { + if fn == nil { + return agg + } + return &filter[N]{ + filter: fn, + aggregator: agg, + seen: map[attribute.Set]attribute.Set{}, + } +} + +// Aggregate records the measurement, scoped by attr, and aggregates it +// into an aggregation. +func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { + // TODO (#3006): drop stale attributes from seen. + f.Lock() + defer f.Unlock() + fAttr, ok := f.seen[attr] + if !ok { + fAttr = f.filter(attr) + f.seen[attr] = fAttr + } + f.aggregator.Aggregate(measurement, fAttr) +} + +// Aggregation returns an Aggregation, for all the aggregated +// measurements made and ends an aggregation cycle. +func (f *filter[N]) Aggregation() metricdata.Aggregation { + return f.aggregator.Aggregation() +} diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/filter_test.go new file mode 100644 index 00000000000..8ce2747a375 --- /dev/null +++ b/sdk/metric/internal/filter_test.go @@ -0,0 +1,202 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// This is an aggregator that has a stable output, used for testing. It does not +// follow any spec prescribed aggregation. +type testStableAggregator[N int64 | float64] struct { + sync.Mutex + values []metricdata.DataPoint[N] +} + +// Aggregate records the measurement, scoped by attr, and aggregates it +// into an aggregation. +func (a *testStableAggregator[N]) Aggregate(measurement N, attr attribute.Set) { + a.Lock() + defer a.Unlock() + + a.values = append(a.values, metricdata.DataPoint[N]{ + Attributes: attr, + Value: measurement, + }) +} + +// Aggregation returns an Aggregation, for all the aggregated +// measurements made and ends an aggregation cycle. +func (a *testStableAggregator[N]) Aggregation() metricdata.Aggregation { + return metricdata.Gauge[N]{ + DataPoints: a.values, + } +} + +func testNewFilterNoFilter[N int64 | float64](t *testing.T, agg Aggregator[N]) { + filter := NewFilter(agg, nil) + assert.Equal(t, agg, filter) +} + +func testNewFilter[N int64 | float64](t *testing.T, agg Aggregator[N]) { + f := NewFilter(agg, testAttributeFilter) + require.IsType(t, &filter[N]{}, f) + filt := f.(*filter[N]) + assert.Equal(t, agg, filt.aggregator) +} + +func testAttributeFilter(input attribute.Set) attribute.Set { + out, _ := input.Filter(func(kv attribute.KeyValue) bool { + return kv.Key == "power-level" + }) + return out +} + +func TestNewFilter(t *testing.T) { + t.Run("int64", func(t *testing.T) { + agg := &testStableAggregator[int64]{} + testNewFilterNoFilter[int64](t, agg) + testNewFilter[int64](t, agg) + }) + t.Run("float64", func(t *testing.T) { + agg := &testStableAggregator[float64]{} + testNewFilterNoFilter[float64](t, agg) + testNewFilter[float64](t, agg) + }) +} + +func testDataPoint[N int64 | float64](attr attribute.Set) metricdata.DataPoint[N] { + return metricdata.DataPoint[N]{ + Attributes: attr, + Value: 1, + } +} + +func testFilterAggregate[N int64 | float64](t *testing.T) { + testCases := []struct { + name string + inputAttr []attribute.Set + output []metricdata.DataPoint[N] + }{ + { + name: "Will filter all out", + inputAttr: []attribute.Set{ + attribute.NewSet( + attribute.String("foo", "bar"), + attribute.Float64("lifeUniverseEverything", 42.0), + ), + }, + output: []metricdata.DataPoint[N]{ + testDataPoint[N](*attribute.EmptySet()), + }, + }, + { + name: "Will keep appropriate attributes", + inputAttr: []attribute.Set{ + attribute.NewSet( + attribute.String("foo", "bar"), + attribute.Int("power-level", 9001), + attribute.Float64("lifeUniverseEverything", 42.0), + ), + attribute.NewSet( + attribute.String("foo", "bar"), + attribute.Int("power-level", 9001), + ), + }, + output: []metricdata.DataPoint[N]{ + // A real Aggregator will combine these, the testAggregator doesn't for list stability. + testDataPoint[N](attribute.NewSet(attribute.Int("power-level", 9001))), + testDataPoint[N](attribute.NewSet(attribute.Int("power-level", 9001))), + }, + }, + { + name: "Will combine Aggregations", + inputAttr: []attribute.Set{ + attribute.NewSet( + attribute.String("foo", "bar"), + ), + attribute.NewSet( + attribute.Float64("lifeUniverseEverything", 42.0), + ), + }, + output: []metricdata.DataPoint[N]{ + // A real Aggregator will combine these, the testAggregator doesn't for list stability. + testDataPoint[N](*attribute.EmptySet()), + testDataPoint[N](*attribute.EmptySet()), + }, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + f := NewFilter[N](&testStableAggregator[N]{}, testAttributeFilter) + for _, set := range tt.inputAttr { + f.Aggregate(1, set) + } + out := f.Aggregation().(metricdata.Gauge[N]) + assert.Equal(t, tt.output, out.DataPoints) + }) + } +} + +func TestFilterAggregate(t *testing.T) { + t.Run("int64", func(t *testing.T) { + testFilterAggregate[int64](t) + }) + t.Run("float64", func(t *testing.T) { + testFilterAggregate[float64](t) + }) +} + +func testFilterConcurrent[N int64 | float64](t *testing.T) { + f := NewFilter[N](&testStableAggregator[N]{}, testAttributeFilter) + wg := &sync.WaitGroup{} + wg.Add(2) + + go func() { + f.Aggregate(1, attribute.NewSet( + attribute.String("foo", "bar"), + )) + wg.Done() + }() + + go func() { + f.Aggregate(1, attribute.NewSet( + attribute.Int("power-level", 9001), + )) + wg.Done() + }() + + wg.Wait() +} + +func TestFilterConcurrent(t *testing.T) { + t.Run("int64", func(t *testing.T) { + testFilterConcurrent[int64](t) + }) + t.Run("float64", func(t *testing.T) { + testFilterConcurrent[float64](t) + }) +} diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go new file mode 100644 index 00000000000..e5298e22d6f --- /dev/null +++ b/sdk/metric/internal/histogram.go @@ -0,0 +1,243 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sort" + "sync" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +type buckets struct { + counts []uint64 + count uint64 + sum float64 + min, max float64 +} + +// newBuckets returns buckets with n bins. +func newBuckets(n int) *buckets { + return &buckets{counts: make([]uint64, n)} +} + +func (b *buckets) bin(idx int, value float64) { + b.counts[idx]++ + b.count++ + b.sum += value + if value < b.min { + b.min = value + } else if value > b.max { + b.max = value + } +} + +// histValues summarizes a set of measurements as an histValues with +// explicitly defined buckets. +type histValues[N int64 | float64] struct { + bounds []float64 + + values map[attribute.Set]*buckets + valuesMu sync.Mutex +} + +func newHistValues[N int64 | float64](bounds []float64) *histValues[N] { + // The responsibility of keeping all buckets correctly associated with the + // passed boundaries is ultimately this type's responsibility. Make a copy + // here so we can always guarantee this. Or, in the case of failure, have + // complete control over the fix. + b := make([]float64, len(bounds)) + copy(b, bounds) + sort.Float64s(b) + return &histValues[N]{ + bounds: b, + values: make(map[attribute.Set]*buckets), + } +} + +// Aggregate records the measurement value, scoped by attr, and aggregates it +// into a histogram. +func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { + // Accept all types to satisfy the Aggregator interface. However, since + // the Aggregation produced by this Aggregator is only float64, convert + // here to only use this type. + v := float64(value) + + // This search will return an index in the range [0, len(s.bounds)], where + // it will return len(s.bounds) if value is greater than the last element + // of s.bounds. This aligns with the buckets in that the length of buckets + // is len(s.bounds)+1, with the last bucket representing: + // (s.bounds[len(s.bounds)-1], +∞). + idx := sort.SearchFloat64s(s.bounds, v) + + s.valuesMu.Lock() + defer s.valuesMu.Unlock() + + b, ok := s.values[attr] + if !ok { + // N+1 buckets. For example: + // + // bounds = [0, 5, 10] + // + // Then, + // + // buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞) + b = newBuckets(len(s.bounds) + 1) + // Ensure min and max are recorded values (not zero), for new buckets. + b.min, b.max = v, v + s.values[attr] = b + } + b.bin(idx, v) +} + +// NewDeltaHistogram returns an Aggregator that summarizes a set of +// measurements as an histogram. Each histogram is scoped by attributes and +// the aggregation cycle the measurements were made in. +// +// Each aggregation cycle is treated independently. When the returned +// Aggregator's Aggregations method is called it will reset all histogram +// counts to zero. +func NewDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) Aggregator[N] { + return &deltaHistogram[N]{ + histValues: newHistValues[N](cfg.Boundaries), + noMinMax: cfg.NoMinMax, + start: now(), + } +} + +// deltaHistogram summarizes a set of measurements made in a single +// aggregation cycle as an histogram with explicitly defined buckets. +type deltaHistogram[N int64 | float64] struct { + *histValues[N] + + noMinMax bool + start time.Time +} + +func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { + h := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} + + s.valuesMu.Lock() + defer s.valuesMu.Unlock() + + if len(s.values) == 0 { + return h + } + + // Do not allow modification of our copy of bounds. + bounds := make([]float64, len(s.bounds)) + copy(bounds, s.bounds) + t := now() + h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(s.values)) + for a, b := range s.values { + hdp := metricdata.HistogramDataPoint{ + Attributes: a, + StartTime: s.start, + Time: t, + Count: b.count, + Bounds: bounds, + BucketCounts: b.counts, + Sum: b.sum, + } + if !s.noMinMax { + hdp.Min = &b.min + hdp.Max = &b.max + } + h.DataPoints = append(h.DataPoints, hdp) + + // Unused attribute sets do not report. + delete(s.values, a) + } + // The delta collection cycle resets. + s.start = t + return h +} + +// NewCumulativeHistogram returns an Aggregator that summarizes a set of +// measurements as an histogram. Each histogram is scoped by attributes. +// +// Each aggregation cycle builds from the previous, the histogram counts are +// the bucketed counts of all values aggregated since the returned Aggregator +// was created. +func NewCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) Aggregator[N] { + return &cumulativeHistogram[N]{ + histValues: newHistValues[N](cfg.Boundaries), + noMinMax: cfg.NoMinMax, + start: now(), + } +} + +// cumulativeHistogram summarizes a set of measurements made over all +// aggregation cycles as an histogram with explicitly defined buckets. +type cumulativeHistogram[N int64 | float64] struct { + *histValues[N] + + noMinMax bool + start time.Time +} + +func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { + h := metricdata.Histogram{Temporality: metricdata.CumulativeTemporality} + + s.valuesMu.Lock() + defer s.valuesMu.Unlock() + + if len(s.values) == 0 { + return h + } + + // Do not allow modification of our copy of bounds. + bounds := make([]float64, len(s.bounds)) + copy(bounds, s.bounds) + t := now() + h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(s.values)) + for a, b := range s.values { + // The HistogramDataPoint field values returned need to be copies of + // the buckets value as we will keep updating them. + // + // TODO (#3047): Making copies for bounds and counts incurs a large + // memory allocation footprint. Alternatives should be explored. + counts := make([]uint64, len(b.counts)) + copy(counts, b.counts) + + hdp := metricdata.HistogramDataPoint{ + Attributes: a, + StartTime: s.start, + Time: t, + Count: b.count, + Bounds: bounds, + BucketCounts: counts, + Sum: b.sum, + } + if !s.noMinMax { + // Similar to counts, make a copy. + min, max := b.min, b.max + hdp.Min = &min + hdp.Max = &max + } + h.DataPoints = append(h.DataPoints, hdp) + // TODO (#3006): This will use an unbounded amount of memory if there + // are unbounded number of attribute sets being aggregated. Attribute + // sets that become "stale" need to be forgotten so this will not + // overload the system. + } + return h +} diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go new file mode 100644 index 00000000000..edeaf8a6945 --- /dev/null +++ b/sdk/metric/internal/histogram_test.go @@ -0,0 +1,203 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +var ( + bounds = []float64{1, 5} + histConf = aggregation.ExplicitBucketHistogram{ + Boundaries: bounds, + NoMinMax: false, + } +) + +func TestHistogram(t *testing.T) { + t.Cleanup(mockTime(now)) + t.Run("Int64", testHistogram[int64]) + t.Run("Float64", testHistogram[float64]) +} + +func testHistogram[N int64 | float64](t *testing.T) { + tester := &aggregatorTester[N]{ + GoroutineN: defaultGoroutines, + MeasurementN: defaultMeasurements, + CycleN: defaultCycles, + } + + incr := monoIncr + eFunc := deltaHistExpecter(incr) + t.Run("Delta", tester.Run(NewDeltaHistogram[N](histConf), incr, eFunc)) + eFunc = cumuHistExpecter(incr) + t.Run("Cumulative", tester.Run(NewCumulativeHistogram[N](histConf), incr, eFunc)) +} + +func deltaHistExpecter(incr setMap) expectFunc { + h := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} + return func(m int) metricdata.Aggregation { + h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(incr)) + for a, v := range incr { + h.DataPoints = append(h.DataPoints, hPoint(a, float64(v), uint64(m))) + } + return h + } +} + +func cumuHistExpecter(incr setMap) expectFunc { + var cycle int + h := metricdata.Histogram{Temporality: metricdata.CumulativeTemporality} + return func(m int) metricdata.Aggregation { + cycle++ + h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(incr)) + for a, v := range incr { + h.DataPoints = append(h.DataPoints, hPoint(a, float64(v), uint64(cycle*m))) + } + return h + } +} + +// hPoint returns an HistogramDataPoint that started and ended now with multi +// number of measurements values v. It includes a min and max (set to v). +func hPoint(a attribute.Set, v float64, multi uint64) metricdata.HistogramDataPoint { + idx := sort.SearchFloat64s(bounds, v) + counts := make([]uint64, len(bounds)+1) + counts[idx] += multi + return metricdata.HistogramDataPoint{ + Attributes: a, + StartTime: now(), + Time: now(), + Count: multi, + Bounds: bounds, + BucketCounts: counts, + Min: &v, + Max: &v, + Sum: v * float64(multi), + } +} + +func TestBucketsBin(t *testing.T) { + b := newBuckets(3) + assertB := func(counts []uint64, count uint64, sum, min, max float64) { + assert.Equal(t, counts, b.counts) + assert.Equal(t, count, b.count) + assert.Equal(t, sum, b.sum) + assert.Equal(t, min, b.min) + assert.Equal(t, max, b.max) + } + + assertB([]uint64{0, 0, 0}, 0, 0, 0, 0) + b.bin(1, 2) + assertB([]uint64{0, 1, 0}, 1, 2, 0, 2) + b.bin(0, -1) + assertB([]uint64{1, 1, 0}, 2, 1, -1, 2) +} + +func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram) Aggregator[N], getBounds func(Aggregator[N]) []float64) func(t *testing.T) { + b := []float64{0, 1, 2} + cpB := make([]float64, len(b)) + copy(cpB, b) + + a := newA(aggregation.ExplicitBucketHistogram{Boundaries: b}) + return func(t *testing.T) { + require.Equal(t, cpB, getBounds(a)) + + b[0] = 10 + assert.Equal(t, cpB, getBounds(a), "modifying the bounds argument should not change the bounds") + + a.Aggregate(5, alice) + hdp := a.Aggregation().(metricdata.Histogram).DataPoints[0] + hdp.Bounds[1] = 10 + assert.Equal(t, cpB, getBounds(a), "modifying the Aggregation bounds should not change the bounds") + } +} + +func TestHistogramImmutableBounds(t *testing.T) { + t.Run("Delta", testHistImmutableBounds[int64]( + NewDeltaHistogram[int64], + func(a Aggregator[int64]) []float64 { + deltaH := a.(*deltaHistogram[int64]) + return deltaH.bounds + }, + )) + + t.Run("Cumulative", testHistImmutableBounds[int64]( + NewCumulativeHistogram[int64], + func(a Aggregator[int64]) []float64 { + cumuH := a.(*cumulativeHistogram[int64]) + return cumuH.bounds + }, + )) +} + +func TestCumulativeHistogramImutableCounts(t *testing.T) { + a := NewCumulativeHistogram[int64](histConf) + a.Aggregate(5, alice) + hdp := a.Aggregation().(metricdata.Histogram).DataPoints[0] + + cumuH := a.(*cumulativeHistogram[int64]) + require.Equal(t, hdp.BucketCounts, cumuH.values[alice].counts) + + cpCounts := make([]uint64, len(hdp.BucketCounts)) + copy(cpCounts, hdp.BucketCounts) + hdp.BucketCounts[0] = 10 + assert.Equal(t, cpCounts, cumuH.values[alice].counts, "modifying the Aggregator bucket counts should not change the Aggregator") +} + +func TestDeltaHistogramReset(t *testing.T) { + t.Cleanup(mockTime(now)) + + expect := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} + a := NewDeltaHistogram[int64](histConf) + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + a.Aggregate(1, alice) + expect.DataPoints = []metricdata.HistogramDataPoint{hPoint(alice, 1, 1)} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // The attr set should be forgotten once Aggregations is called. + expect.DataPoints = nil + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // Aggregating another set should not affect the original (alice). + a.Aggregate(1, bob) + expect.DataPoints = []metricdata.HistogramDataPoint{hPoint(bob, 1, 1)} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) +} + +func BenchmarkHistogram(b *testing.B) { + b.Run("Int64", benchmarkHistogram[int64]) + b.Run("Float64", benchmarkHistogram[float64]) +} + +func benchmarkHistogram[N int64 | float64](b *testing.B) { + factory := func() Aggregator[N] { return NewDeltaHistogram[N](histConf) } + b.Run("Delta", benchmarkAggregator(factory)) + factory = func() Aggregator[N] { return NewCumulativeHistogram[N](histConf) } + b.Run("Cumulative", benchmarkAggregator(factory)) +} diff --git a/sdk/metric/internal/lastvalue.go b/sdk/metric/internal/lastvalue.go new file mode 100644 index 00000000000..48e1b426c76 --- /dev/null +++ b/sdk/metric/internal/lastvalue.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sync" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// datapoint is timestamped measurement data. +type datapoint[N int64 | float64] struct { + timestamp time.Time + value N +} + +// lastValue summarizes a set of measurements as the last one made. +type lastValue[N int64 | float64] struct { + sync.Mutex + + values map[attribute.Set]datapoint[N] +} + +// NewLastValue returns an Aggregator that summarizes a set of measurements as +// the last one made. +func NewLastValue[N int64 | float64]() Aggregator[N] { + return &lastValue[N]{values: make(map[attribute.Set]datapoint[N])} +} + +func (s *lastValue[N]) Aggregate(value N, attr attribute.Set) { + d := datapoint[N]{timestamp: now(), value: value} + s.Lock() + s.values[attr] = d + s.Unlock() +} + +func (s *lastValue[N]) Aggregation() metricdata.Aggregation { + gauge := metricdata.Gauge[N]{} + + s.Lock() + defer s.Unlock() + + if len(s.values) == 0 { + return gauge + } + + gauge.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + for a, v := range s.values { + gauge.DataPoints = append(gauge.DataPoints, metricdata.DataPoint[N]{ + Attributes: a, + // The event time is the only meaningful timestamp, StartTime is + // ignored. + Time: v.timestamp, + Value: v.value, + }) + // Do not report stale values. + delete(s.values, a) + } + return gauge +} diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/lastvalue_test.go new file mode 100644 index 00000000000..41b75877fe3 --- /dev/null +++ b/sdk/metric/internal/lastvalue_test.go @@ -0,0 +1,91 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "testing" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +func TestLastValue(t *testing.T) { + t.Cleanup(mockTime(now)) + + t.Run("Int64", testLastValue[int64]()) + t.Run("Float64", testLastValue[float64]()) +} + +func testLastValue[N int64 | float64]() func(*testing.T) { + tester := &aggregatorTester[N]{ + GoroutineN: defaultGoroutines, + MeasurementN: defaultMeasurements, + CycleN: defaultCycles, + } + + eFunc := func(increments setMap) expectFunc { + data := make([]metricdata.DataPoint[N], 0, len(increments)) + for a, v := range increments { + point := metricdata.DataPoint[N]{Attributes: a, Time: now(), Value: N(v)} + data = append(data, point) + } + gauge := metricdata.Gauge[N]{DataPoints: data} + return func(int) metricdata.Aggregation { return gauge } + } + incr := monoIncr + return tester.Run(NewLastValue[N](), incr, eFunc(incr)) +} + +func testLastValueReset[N int64 | float64](t *testing.T) { + t.Cleanup(mockTime(now)) + + a := NewLastValue[N]() + expect := metricdata.Gauge[N]{} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + a.Aggregate(1, alice) + expect.DataPoints = []metricdata.DataPoint[N]{{ + Attributes: alice, + Time: now(), + Value: 1, + }} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // The attr set should be forgotten once Aggregations is called. + expect.DataPoints = nil + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // Aggregating another set should not affect the original (alice). + a.Aggregate(1, bob) + expect.DataPoints = []metricdata.DataPoint[N]{{ + Attributes: bob, + Time: now(), + Value: 1, + }} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) +} + +func TestLastValueReset(t *testing.T) { + t.Run("Int64", testLastValueReset[int64]) + t.Run("Float64", testLastValueReset[float64]) +} + +func BenchmarkLastValue(b *testing.B) { + b.Run("Int64", benchmarkAggregator(NewLastValue[int64])) + b.Run("Float64", benchmarkAggregator(NewLastValue[float64])) +} diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go new file mode 100644 index 00000000000..b80dcd9c40b --- /dev/null +++ b/sdk/metric/internal/sum.go @@ -0,0 +1,156 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "sync" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// valueMap is the storage for all sums. +type valueMap[N int64 | float64] struct { + sync.Mutex + values map[attribute.Set]N +} + +func newValueMap[N int64 | float64]() *valueMap[N] { + return &valueMap[N]{values: make(map[attribute.Set]N)} +} + +func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { + s.Lock() + s.values[attr] += value + s.Unlock() +} + +// NewDeltaSum returns an Aggregator that summarizes a set of measurements as +// their arithmetic sum. Each sum is scoped by attributes and the aggregation +// cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// Each aggregation cycle is treated independently. When the returned +// Aggregator's Aggregation method is called it will reset all sums to zero. +func NewDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &deltaSum[N]{ + valueMap: newValueMap[N](), + monotonic: monotonic, + start: now(), + } +} + +// deltaSum summarizes a set of measurements made in a single aggregation +// cycle as their arithmetic sum. +type deltaSum[N int64 | float64] struct { + *valueMap[N] + + monotonic bool + start time.Time +} + +func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { + out := metricdata.Sum[N]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: s.monotonic, + } + + s.Lock() + defer s.Unlock() + + if len(s.values) == 0 { + return out + } + + t := now() + out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + for attr, value := range s.values { + out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ + Attributes: attr, + StartTime: s.start, + Time: t, + Value: value, + }) + // Unused attribute sets do not report. + delete(s.values, attr) + } + // The delta collection cycle resets. + s.start = t + return out +} + +// NewCumulativeSum returns an Aggregator that summarizes a set of +// measurements as their arithmetic sum. Each sum is scoped by attributes and +// the aggregation cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// Each aggregation cycle is treated independently. When the returned +// Aggregator's Aggregation method is called it will reset all sums to zero. +func NewCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &cumulativeSum[N]{ + valueMap: newValueMap[N](), + monotonic: monotonic, + start: now(), + } +} + +// cumulativeSum summarizes a set of measurements made over all aggregation +// cycles as their arithmetic sum. +type cumulativeSum[N int64 | float64] struct { + *valueMap[N] + + monotonic bool + start time.Time +} + +func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { + out := metricdata.Sum[N]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: s.monotonic, + } + + s.Lock() + defer s.Unlock() + + if len(s.values) == 0 { + return out + } + + t := now() + out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + for attr, value := range s.values { + out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ + Attributes: attr, + StartTime: s.start, + Time: t, + Value: value, + }) + // TODO (#3006): This will use an unbounded amount of memory if there + // are unbounded number of attribute sets being aggregated. Attribute + // sets that become "stale" need to be forgotten so this will not + // overload the system. + } + return out +} diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go new file mode 100644 index 00000000000..668afd1a022 --- /dev/null +++ b/sdk/metric/internal/sum_test.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +import ( + "testing" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +func TestSum(t *testing.T) { + t.Cleanup(mockTime(now)) + t.Run("Int64", testSum[int64]) + t.Run("Float64", testSum[float64]) +} + +func testSum[N int64 | float64](t *testing.T) { + tester := &aggregatorTester[N]{ + GoroutineN: defaultGoroutines, + MeasurementN: defaultMeasurements, + CycleN: defaultCycles, + } + + t.Run("Delta", func(t *testing.T) { + incr, mono := monoIncr, true + eFunc := deltaExpecter[N](incr, mono) + t.Run("Monotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) + + incr, mono = nonMonoIncr, false + eFunc = deltaExpecter[N](incr, mono) + t.Run("NonMonotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) + }) + + t.Run("Cumulative", func(t *testing.T) { + incr, mono := monoIncr, true + eFunc := cumuExpecter[N](incr, mono) + t.Run("Monotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) + + incr, mono = nonMonoIncr, false + eFunc = cumuExpecter[N](incr, mono) + t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) + }) +} + +func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { + sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} + return func(m int) metricdata.Aggregation { + sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) + for a, v := range incr { + sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*m))) + } + return sum + } +} + +func cumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { + var cycle int + sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} + return func(m int) metricdata.Aggregation { + cycle++ + sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) + for a, v := range incr { + sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*cycle*m))) + } + return sum + } +} + +// point returns a DataPoint that started and ended now. +func point[N int64 | float64](a attribute.Set, v N) metricdata.DataPoint[N] { + return metricdata.DataPoint[N]{ + Attributes: a, + StartTime: now(), + Time: now(), + Value: N(v), + } +} + +func testDeltaSumReset[N int64 | float64](t *testing.T) { + t.Cleanup(mockTime(now)) + + expect := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality} + a := NewDeltaSum[N](false) + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + a.Aggregate(1, alice) + expect.DataPoints = []metricdata.DataPoint[N]{point[N](alice, 1)} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // The attr set should be forgotten once Aggregations is called. + expect.DataPoints = nil + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + + // Aggregating another set should not affect the original (alice). + a.Aggregate(1, bob) + expect.DataPoints = []metricdata.DataPoint[N]{point[N](bob, 1)} + metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) +} + +func TestDeltaSumReset(t *testing.T) { + t.Run("Int64", testDeltaSumReset[int64]) + t.Run("Float64", testDeltaSumReset[float64]) +} + +func BenchmarkSum(b *testing.B) { + b.Run("Int64", benchmarkSum[int64]) + b.Run("Float64", benchmarkSum[float64]) +} + +func benchmarkSum[N int64 | float64](b *testing.B) { + // The monotonic argument is only used to annotate the Sum returned from + // the Aggregation method. It should not have an effect on operational + // performance, therefore, only monotonic=false is benchmarked here. + factory := func() Aggregator[N] { return NewDeltaSum[N](false) } + b.Run("Delta", benchmarkAggregator(factory)) + factory = func() Aggregator[N] { return NewCumulativeSum[N](false) } + b.Run("Cumulative", benchmarkAggregator(factory)) +} diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go new file mode 100644 index 00000000000..ec985332188 --- /dev/null +++ b/sdk/metric/manual_reader.go @@ -0,0 +1,134 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "fmt" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +// manualReader is a a simple Reader that allows an application to +// read metrics on demand. +type manualReader struct { + producer atomic.Value + shutdownOnce sync.Once + + temporalitySelector TemporalitySelector + aggregationSelector AggregationSelector +} + +// Compile time check the manualReader implements Reader and is comparable. +var _ = map[Reader]struct{}{&manualReader{}: {}} + +// NewManualReader returns a Reader which is directly called to collect metrics. +func NewManualReader(opts ...ManualReaderOption) Reader { + cfg := newManualReaderConfig(opts) + return &manualReader{ + temporalitySelector: cfg.temporalitySelector, + aggregationSelector: cfg.aggregationSelector, + } +} + +// register stores the Producer which enables the caller to read +// metrics on demand. +func (mr *manualReader) register(p producer) { + // Only register once. If producer is already set, do nothing. + if !mr.producer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { + msg := "did not register manual reader" + global.Error(errDuplicateRegister, msg) + } +} + +// temporality reports the Temporality for the instrument kind provided. +func (mr *manualReader) temporality(kind view.InstrumentKind) metricdata.Temporality { + return mr.temporalitySelector(kind) +} + +// aggregation returns what Aggregation to use for kind. +func (mr *manualReader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. + return mr.aggregationSelector(kind) +} + +// ForceFlush is a no-op, it always returns nil. +func (mr *manualReader) ForceFlush(context.Context) error { + return nil +} + +// Shutdown closes any connections and frees any resources used by the reader. +func (mr *manualReader) Shutdown(context.Context) error { + err := ErrReaderShutdown + mr.shutdownOnce.Do(func() { + // Any future call to Collect will now return ErrReaderShutdown. + mr.producer.Store(produceHolder{ + produce: shutdownProducer{}.produce, + }) + err = nil + }) + return err +} + +// Collect gathers all metrics from the SDK, calling any callbacks necessary. +// Collect will return an error if called after shutdown. +func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { + p := mr.producer.Load() + if p == nil { + return metricdata.ResourceMetrics{}, ErrReaderNotRegistered + } + + ph, ok := p.(produceHolder) + if !ok { + // The atomic.Value is entirely in the periodicReader's control so + // this should never happen. In the unforeseen case that this does + // happen, return an error instead of panicking so a users code does + // not halt in the processes. + err := fmt.Errorf("manual reader: invalid producer: %T", p) + return metricdata.ResourceMetrics{}, err + } + + return ph.produce(ctx) +} + +// manualReaderConfig contains configuration options for a ManualReader. +type manualReaderConfig struct { + temporalitySelector TemporalitySelector + aggregationSelector AggregationSelector +} + +// newManualReaderConfig returns a manualReaderConfig configured with options. +func newManualReaderConfig(opts []ManualReaderOption) manualReaderConfig { + cfg := manualReaderConfig{ + temporalitySelector: DefaultTemporalitySelector, + aggregationSelector: DefaultAggregationSelector, + } + for _, opt := range opts { + cfg = opt.applyManual(cfg) + } + return cfg +} + +// ManualReaderOption applies a configuration option value to a ManualReader. +type ManualReaderOption interface { + applyManual(manualReaderConfig) manualReaderConfig +} diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go new file mode 100644 index 00000000000..58b1a85cb1d --- /dev/null +++ b/sdk/metric/manual_reader_test.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +func TestManualReader(t *testing.T) { + suite.Run(t, &readerTestSuite{Factory: func() Reader { return NewManualReader() }}) +} + +func BenchmarkManualReader(b *testing.B) { + b.Run("Collect", benchReaderCollectFunc(NewManualReader())) +} + +var deltaTemporalitySelector = func(view.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } +var cumulativeTemporalitySelector = func(view.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } + +func TestManualReaderTemporality(t *testing.T) { + tests := []struct { + name string + options []ManualReaderOption + // Currently only testing constant temporality. This should be expanded + // if we put more advanced selection in the SDK + wantTemporality metricdata.Temporality + }{ + { + name: "default", + wantTemporality: metricdata.CumulativeTemporality, + }, + { + name: "delta", + options: []ManualReaderOption{ + WithTemporalitySelector(deltaTemporalitySelector), + }, + wantTemporality: metricdata.DeltaTemporality, + }, + { + name: "repeats overwrite", + options: []ManualReaderOption{ + WithTemporalitySelector(deltaTemporalitySelector), + WithTemporalitySelector(cumulativeTemporalitySelector), + }, + wantTemporality: metricdata.CumulativeTemporality, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var undefinedInstrument view.InstrumentKind + rdr := NewManualReader(tt.options...) + assert.Equal(t, tt.wantTemporality, rdr.temporality(undefinedInstrument)) + }) + } +} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go new file mode 100644 index 00000000000..4f51c03308b --- /dev/null +++ b/sdk/metric/meter.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/instrumentation" +) + +// meterRegistry keeps a record of initialized meters for instrumentation +// scopes. A meter is unique to an instrumentation scope and if multiple +// requests for that meter are made a meterRegistry ensure the same instance +// is used. +// +// The zero meterRegistry is empty and ready for use. +// +// A meterRegistry must not be copied after first use. +// +// All methods of a meterRegistry are safe to call concurrently. +type meterRegistry struct { + sync.Mutex + + meters map[instrumentation.Scope]*meter + + registry *pipelineRegistry +} + +// Get returns a registered meter matching the instrumentation scope if it +// exists in the meterRegistry. Otherwise, a new meter configured for the +// instrumentation scope is registered and then returned. +// +// Get is safe to call concurrently. +func (r *meterRegistry) Get(s instrumentation.Scope) *meter { + r.Lock() + defer r.Unlock() + + if r.meters == nil { + m := &meter{ + Scope: s, + registry: r.registry, + } + r.meters = map[instrumentation.Scope]*meter{s: m} + return m + } + + m, ok := r.meters[s] + if ok { + return m + } + + m = &meter{ + Scope: s, + registry: r.registry, + } + r.meters[s] = m + return m +} + +// Range calls f sequentially for each meter present in the meterRegistry. If +// f returns false, the iteration is stopped. +// +// Range is safe to call concurrently. +func (r *meterRegistry) Range(f func(*meter) bool) { + r.Lock() + defer r.Unlock() + + for _, m := range r.meters { + if !f(m) { + return + } + } +} + +// meter handles the creation and coordination of all metric instruments. A +// meter represents a single instrumentation scope; all metric telemetry +// produced by an instrumentation scope will use metric instruments from a +// single meter. +type meter struct { + instrumentation.Scope + + registry *pipelineRegistry +} + +// Compile-time check meter implements metric.Meter. +var _ metric.Meter = (*meter)(nil) + +// AsyncInt64 returns the asynchronous integer instrument provider. +func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { + return asyncInt64Provider{scope: m.Scope, registry: m.registry} +} + +// AsyncFloat64 returns the asynchronous floating-point instrument provider. +func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { + return asyncFloat64Provider{scope: m.Scope, registry: m.registry} +} + +// RegisterCallback registers the function f to be called when any of the +// insts Collect method is called. +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { + m.registry.registerCallback(f) + return nil +} + +// SyncInt64 returns the synchronous integer instrument provider. +func (m *meter) SyncInt64() syncint64.InstrumentProvider { + return syncInt64Provider{scope: m.Scope, registry: m.registry} +} + +// SyncFloat64 returns the synchronous floating-point instrument provider. +func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { + return syncFloat64Provider{scope: m.Scope, registry: m.registry} +} diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go new file mode 100644 index 00000000000..8efcbd6b261 --- /dev/null +++ b/sdk/metric/meter_test.go @@ -0,0 +1,517 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric + +import ( + "context" + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +func TestMeterRegistry(t *testing.T) { + is0 := instrumentation.Scope{Name: "zero"} + is1 := instrumentation.Scope{Name: "one"} + + r := meterRegistry{} + var m0 *meter + t.Run("ZeroValueGetDoesNotPanic", func(t *testing.T) { + assert.NotPanics(t, func() { m0 = r.Get(is0) }) + assert.Equal(t, is0, m0.Scope, "uninitialized meter returned") + }) + + m01 := r.Get(is0) + t.Run("GetSameMeter", func(t *testing.T) { + assert.Samef(t, m0, m01, "returned different meters: %v", is0) + }) + + m1 := r.Get(is1) + t.Run("GetDifferentMeter", func(t *testing.T) { + assert.NotSamef(t, m0, m1, "returned same meters: %v", is1) + }) + + t.Run("RangeComplete", func(t *testing.T) { + var got []*meter + r.Range(func(m *meter) bool { + got = append(got, m) + return true + }) + assert.ElementsMatch(t, []*meter{m0, m1}, got) + }) + + t.Run("RangeStopIteration", func(t *testing.T) { + var i int + r.Range(func(m *meter) bool { + i++ + return false + }) + assert.Equal(t, 1, i, "iteration not stopped after first flase return") + }) +} + +// A meter should be able to make instruments concurrently. +func TestMeterInstrumentConcurrency(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(12) + + m := NewMeterProvider().Meter("inst-concurrency") + + go func() { + _, _ = m.AsyncFloat64().Counter("AFCounter") + wg.Done() + }() + go func() { + _, _ = m.AsyncFloat64().UpDownCounter("AFUpDownCounter") + wg.Done() + }() + go func() { + _, _ = m.AsyncFloat64().Gauge("AFGauge") + wg.Done() + }() + go func() { + _, _ = m.AsyncInt64().Counter("AICounter") + wg.Done() + }() + go func() { + _, _ = m.AsyncInt64().UpDownCounter("AIUpDownCounter") + wg.Done() + }() + go func() { + _, _ = m.AsyncInt64().Gauge("AIGauge") + wg.Done() + }() + go func() { + _, _ = m.SyncFloat64().Counter("SFCounter") + wg.Done() + }() + go func() { + _, _ = m.SyncFloat64().UpDownCounter("SFUpDownCounter") + wg.Done() + }() + go func() { + _, _ = m.SyncFloat64().Histogram("SFHistogram") + wg.Done() + }() + go func() { + _, _ = m.SyncInt64().Counter("SICounter") + wg.Done() + }() + go func() { + _, _ = m.SyncInt64().UpDownCounter("SIUpDownCounter") + wg.Done() + }() + go func() { + _, _ = m.SyncInt64().Histogram("SIHistogram") + wg.Done() + }() + + wg.Wait() +} + +// A Meter Should be able register Callbacks Concurrently. +func TestMeterCallbackCreationConcurrency(t *testing.T) { + wg := &sync.WaitGroup{} + wg.Add(2) + + m := NewMeterProvider().Meter("callback-concurrency") + + go func() { + _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + wg.Done() + }() + go func() { + _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + wg.Done() + }() + wg.Wait() +} + +// Instruments should produce correct ResourceMetrics. +func TestMeterCreatesInstruments(t *testing.T) { + var seven float64 = 7.0 + testCases := []struct { + name string + fn func(*testing.T, metric.Meter) + want metricdata.Metrics + }{ + { + name: "AsyncInt64Count", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.AsyncInt64().Counter("aint") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 3) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + ctr.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "aint", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + {Value: 3}, + }, + }, + }, + }, + { + name: "AsyncInt64UpDownCount", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.AsyncInt64().UpDownCounter("aint") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 11) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + ctr.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "aint", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{ + {Value: 11}, + }, + }, + }, + }, + { + name: "AsyncInt64Gauge", + fn: func(t *testing.T, m metric.Meter) { + gauge, err := m.AsyncInt64().Gauge("agauge") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + gauge.Observe(ctx, 11) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + gauge.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "agauge", + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + {Value: 11}, + }, + }, + }, + }, + { + name: "AsyncFloat64Count", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.AsyncFloat64().Counter("afloat") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 3) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + ctr.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "afloat", + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{ + {Value: 3}, + }, + }, + }, + }, + { + name: "AsyncFloat64UpDownCount", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.AsyncFloat64().UpDownCounter("afloat") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 11) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + ctr.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "afloat", + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[float64]{ + {Value: 11}, + }, + }, + }, + }, + { + name: "AsyncFloat64Gauge", + fn: func(t *testing.T, m metric.Meter) { + gauge, err := m.AsyncFloat64().Gauge("agauge") + assert.NoError(t, err) + err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + gauge.Observe(ctx, 11) + }) + assert.NoError(t, err) + + // Observed outside of a callback, it should be ignored. + gauge.Observe(context.Background(), 19) + }, + want: metricdata.Metrics{ + Name: "agauge", + Data: metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + {Value: 11}, + }, + }, + }, + }, + + { + name: "SyncInt64Count", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.SyncInt64().Counter("sint") + assert.NoError(t, err) + + ctr.Add(context.Background(), 3) + }, + want: metricdata.Metrics{ + Name: "sint", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + {Value: 3}, + }, + }, + }, + }, + { + name: "SyncInt64UpDownCount", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.SyncInt64().UpDownCounter("sint") + assert.NoError(t, err) + + ctr.Add(context.Background(), 11) + }, + want: metricdata.Metrics{ + Name: "sint", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{ + {Value: 11}, + }, + }, + }, + }, + { + name: "SyncInt64Histogram", + fn: func(t *testing.T, m metric.Meter) { + gauge, err := m.SyncInt64().Histogram("histogram") + assert.NoError(t, err) + + gauge.Record(context.Background(), 7) + }, + want: metricdata.Metrics{ + Name: "histogram", + Data: metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.Set{}, + Count: 1, + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + Min: &seven, + Max: &seven, + Sum: 7.0, + }, + }, + }, + }, + }, + { + name: "SyncFloat64Count", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.SyncFloat64().Counter("sfloat") + assert.NoError(t, err) + + ctr.Add(context.Background(), 3) + }, + want: metricdata.Metrics{ + Name: "sfloat", + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{ + {Value: 3}, + }, + }, + }, + }, + { + name: "SyncFloat64UpDownCount", + fn: func(t *testing.T, m metric.Meter) { + ctr, err := m.SyncFloat64().UpDownCounter("sfloat") + assert.NoError(t, err) + + ctr.Add(context.Background(), 11) + }, + want: metricdata.Metrics{ + Name: "sfloat", + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[float64]{ + {Value: 11}, + }, + }, + }, + }, + { + name: "SyncFloat64Histogram", + fn: func(t *testing.T, m metric.Meter) { + gauge, err := m.SyncFloat64().Histogram("histogram") + assert.NoError(t, err) + + gauge.Record(context.Background(), 7) + }, + want: metricdata.Metrics{ + Name: "histogram", + Data: metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.Set{}, + Count: 1, + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + Min: &seven, + Max: &seven, + Sum: 7.0, + }, + }, + }, + }, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + rdr := NewManualReader() + m := NewMeterProvider(WithReader(rdr)).Meter("testInstruments") + + tt.fn(t, m) + + rm, err := rdr.Collect(context.Background()) + assert.NoError(t, err) + + require.Len(t, rm.ScopeMetrics, 1) + sm := rm.ScopeMetrics[0] + require.Len(t, sm.Metrics, 1) + got := sm.Metrics[0] + metricdatatest.AssertEqual(t, tt.want, got, metricdatatest.IgnoreTimestamp()) + }) + } +} + +func TestMetersProvideScope(t *testing.T) { + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr)) + + m1 := mp.Meter("scope1") + ctr1, err := m1.AsyncFloat64().Counter("ctr1") + assert.NoError(t, err) + err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) { + ctr1.Observe(ctx, 5) + }) + assert.NoError(t, err) + + m2 := mp.Meter("scope2") + ctr2, err := m2.AsyncInt64().Counter("ctr2") + assert.NoError(t, err) + err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) { + ctr2.Observe(ctx, 7) + }) + assert.NoError(t, err) + + want := metricdata.ResourceMetrics{ + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "scope1", + }, + Metrics: []metricdata.Metrics{ + { + Name: "ctr1", + Data: metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{ + { + Value: 5, + }, + }, + }, + }, + }, + }, + { + Scope: instrumentation.Scope{ + Name: "scope2", + }, + Metrics: []metricdata.Metrics{ + { + Name: "ctr2", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + { + Value: 7, + }, + }, + }, + }, + }, + }, + }, + } + + got, err := rdr.Collect(context.Background()) + assert.NoError(t, err) + metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) +} diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go new file mode 100644 index 00000000000..effaf71c73a --- /dev/null +++ b/sdk/metric/metricdata/data.go @@ -0,0 +1,133 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" +) + +// ResourceMetrics is a collection of ScopeMetrics and the associated Resource +// that created them. +type ResourceMetrics struct { + // Resource represents the entity that collected the metrics. + Resource *resource.Resource + // ScopeMetrics are the collection of metrics with unique Scopes. + ScopeMetrics []ScopeMetrics +} + +// ScopeMetrics is a collection of Metrics Produces by a Meter. +type ScopeMetrics struct { + // Scope is the Scope that the Meter was created with. + Scope instrumentation.Scope + // Metrics are a list of aggregations created by the Meter. + Metrics []Metrics +} + +// Metrics is a collection of one or more aggregated timeseries from an Instrument. +type Metrics struct { + // Name is the name of the Instrument that created this data. + Name string + // Description is the description of the Instrument, which can be used in documentation. + Description string + // Unit is the unit in which the Instrument reports. + Unit unit.Unit + // Data is the aggregated data from an Instrument. + Data Aggregation +} + +// Aggregation is the store of data reported by an Instrument. +// It will be one of: Gauge, Sum, Histogram. +type Aggregation interface { + privateAggregation() +} + +// Gauge represents a measurement of the current value of an instrument. +type Gauge[N int64 | float64] struct { + // DataPoints reprents individual aggregated measurements with unique Attributes. + DataPoints []DataPoint[N] +} + +func (Gauge[N]) privateAggregation() {} + +// Sum represents the sum of all measurements of values from an instrument. +type Sum[N int64 | float64] struct { + // DataPoints reprents individual aggregated measurements with unique Attributes. + DataPoints []DataPoint[N] + // Temporality describes if the aggregation is reported as the change from the + // last report time, or the cumulative changes since a fixed start time. + Temporality Temporality + // IsMonotonic represents if this aggregation only increases or decreases. + IsMonotonic bool +} + +func (Sum[N]) privateAggregation() {} + +// DataPoint is a single data point in a timeseries. +type DataPoint[N int64 | float64] struct { + // Attributes is the set of key value pairs that uniquely identify the + // timeseries. + Attributes attribute.Set + // StartTime is when the timeseries was started. (optional) + StartTime time.Time `json:",omitempty"` + // Time is the time when the timeseries was recorded. (optional) + Time time.Time `json:",omitempty"` + // Value is the value of this data point. + Value N +} + +// Histogram represents the histogram of all measurements of values from an instrument. +type Histogram struct { + // DataPoints reprents individual aggregated measurements with unique Attributes. + DataPoints []HistogramDataPoint + // Temporality describes if the aggregation is reported as the change from the + // last report time, or the cumulative changes since a fixed start time. + Temporality Temporality +} + +func (Histogram) privateAggregation() {} + +// HistogramDataPoint is a single histogram data point in a timeseries. +type HistogramDataPoint struct { + // Attributes is the set of key value pairs that uniquely identify the + // timeseries. + Attributes attribute.Set + // StartTime is when the timeseries was started. + StartTime time.Time + // Time is the time when the timeseries was recorded. + Time time.Time + + // Count is the number of updates this histogram has been calculated with. + Count uint64 + // Bounds are the upper bounds of the buckets of the histogram. Because the + // last boundary is +infinity this one is implied. + Bounds []float64 + // BucketCounts is the count of each of the buckets. + BucketCounts []uint64 + + // Min is the minimum value recorded. (optional) + Min *float64 `json:",omitempty"` + // Max is the maximum value recorded. (optional) + Max *float64 `json:",omitempty"` + // Sum is the sum of the values recorded. + Sum float64 +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go new file mode 100644 index 00000000000..4c519d15d49 --- /dev/null +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -0,0 +1,134 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +// Package metricdatatest provides testing functionality for use with the +// metricdata package. +package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + +import ( + "fmt" + "testing" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Datatypes are the concrete data-types the metricdata package provides. +type Datatypes interface { + metricdata.DataPoint[float64] | + metricdata.DataPoint[int64] | + metricdata.Gauge[float64] | + metricdata.Gauge[int64] | + metricdata.Histogram | + metricdata.HistogramDataPoint | + metricdata.Metrics | + metricdata.ResourceMetrics | + metricdata.ScopeMetrics | + metricdata.Sum[float64] | + metricdata.Sum[int64] + + // Interface types are not allowed in union types, therefore the + // Aggregation and Value type from metricdata are not included here. +} + +type config struct { + ignoreTimestamp bool +} + +// Option allows for fine grain control over how AssertEqual operates. +type Option interface { + apply(cfg config) config +} + +type fnOption func(cfg config) config + +func (fn fnOption) apply(cfg config) config { + return fn(cfg) +} + +// IgnoreTimestamp disables checking if timestamps are different. +func IgnoreTimestamp() Option { + return fnOption(func(cfg config) config { + cfg.ignoreTimestamp = true + return cfg + }) +} + +// AssertEqual asserts that the two concrete data-types from the metricdata +// package are equal. +func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) bool { + t.Helper() + + cfg := config{} + for _, opt := range opts { + cfg = opt.apply(cfg) + } + + // Generic types cannot be type asserted. Use an interface instead. + aIface := interface{}(actual) + + var r []string + switch e := interface{}(expected).(type) { + case metricdata.DataPoint[int64]: + r = equalDataPoints(e, aIface.(metricdata.DataPoint[int64]), cfg) + case metricdata.DataPoint[float64]: + r = equalDataPoints(e, aIface.(metricdata.DataPoint[float64]), cfg) + case metricdata.Gauge[int64]: + r = equalGauges(e, aIface.(metricdata.Gauge[int64]), cfg) + case metricdata.Gauge[float64]: + r = equalGauges(e, aIface.(metricdata.Gauge[float64]), cfg) + case metricdata.Histogram: + r = equalHistograms(e, aIface.(metricdata.Histogram), cfg) + case metricdata.HistogramDataPoint: + r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint), cfg) + case metricdata.Metrics: + r = equalMetrics(e, aIface.(metricdata.Metrics), cfg) + case metricdata.ResourceMetrics: + r = equalResourceMetrics(e, aIface.(metricdata.ResourceMetrics), cfg) + case metricdata.ScopeMetrics: + r = equalScopeMetrics(e, aIface.(metricdata.ScopeMetrics), cfg) + case metricdata.Sum[int64]: + r = equalSums(e, aIface.(metricdata.Sum[int64]), cfg) + case metricdata.Sum[float64]: + r = equalSums(e, aIface.(metricdata.Sum[float64]), cfg) + default: + // We control all types passed to this, panic to signal developers + // early they changed things in an incompatible way. + panic(fmt.Sprintf("unknown types: %T", expected)) + } + + if len(r) > 0 { + t.Error(r) + return false + } + return true +} + +// AssertAggregationsEqual asserts that two Aggregations are equal. +func AssertAggregationsEqual(t *testing.T, expected, actual metricdata.Aggregation, opts ...Option) bool { + t.Helper() + + cfg := config{} + for _, opt := range opts { + cfg = opt.apply(cfg) + } + + if r := equalAggregations(expected, actual, cfg); len(r) > 0 { + t.Error(r) + return false + } + return true +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go new file mode 100644 index 00000000000..fffbe6421be --- /dev/null +++ b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 && tests_fail +// +build go1.18,tests_fail + +package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + +import ( + "testing" +) + +// These tests are used to develop the failure messages of this package's +// assertions. They can be run with the following. +// +// go test -tags tests_fail ./... + +func testFailDatatype[T Datatypes](a, b T) func(*testing.T) { + return func(t *testing.T) { + AssertEqual(t, a, b) + } +} + +func TestFailAssertEqual(t *testing.T) { + t.Run("ResourceMetrics", testFailDatatype(resourceMetricsA, resourceMetricsB)) + t.Run("ScopeMetrics", testFailDatatype(scopeMetricsA, scopeMetricsB)) + t.Run("Metrics", testFailDatatype(metricsA, metricsB)) + t.Run("Histogram", testFailDatatype(histogramA, histogramB)) + t.Run("SumInt64", testFailDatatype(sumInt64A, sumInt64B)) + t.Run("SumFloat64", testFailDatatype(sumFloat64A, sumFloat64B)) + t.Run("GaugeInt64", testFailDatatype(gaugeInt64A, gaugeInt64B)) + t.Run("GaugeFloat64", testFailDatatype(gaugeFloat64A, gaugeFloat64B)) + t.Run("HistogramDataPoint", testFailDatatype(histogramDataPointA, histogramDataPointB)) + t.Run("DataPointInt64", testFailDatatype(dataPointInt64A, dataPointInt64B)) + t.Run("DataPointFloat64", testFailDatatype(dataPointFloat64A, dataPointFloat64B)) + +} + +func TestFailAssertAggregationsEqual(t *testing.T) { + AssertAggregationsEqual(t, sumInt64A, nil) + AssertAggregationsEqual(t, sumFloat64A, gaugeFloat64A) + AssertAggregationsEqual(t, unknownAggregation{}, unknownAggregation{}) + AssertAggregationsEqual(t, sumInt64A, sumInt64B) + AssertAggregationsEqual(t, sumFloat64A, sumFloat64B) + AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64B) + AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64B) + AssertAggregationsEqual(t, histogramA, histogramB) +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go new file mode 100644 index 00000000000..71331f5a945 --- /dev/null +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -0,0 +1,319 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/resource" +) + +var ( + attrA = attribute.NewSet(attribute.Bool("A", true)) + attrB = attribute.NewSet(attribute.Bool("B", true)) + + startA = time.Now() + startB = startA.Add(time.Millisecond) + endA = startA.Add(time.Second) + endB = startB.Add(time.Second) + + dataPointInt64A = metricdata.DataPoint[int64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Value: -1, + } + dataPointFloat64A = metricdata.DataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Value: -1.0, + } + dataPointInt64B = metricdata.DataPoint[int64]{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Value: 2, + } + dataPointFloat64B = metricdata.DataPoint[float64]{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Value: 2.0, + } + dataPointInt64C = metricdata.DataPoint[int64]{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Value: -1, + } + dataPointFloat64C = metricdata.DataPoint[float64]{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Value: -1.0, + } + + max, min = 99.0, 3. + histogramDataPointA = metricdata.HistogramDataPoint{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 2, + Bounds: []float64{0, 10}, + BucketCounts: []uint64{1, 1}, + Sum: 2, + } + histogramDataPointB = metricdata.HistogramDataPoint{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Count: 3, + Bounds: []float64{0, 10, 100}, + BucketCounts: []uint64{1, 1, 1}, + Max: &max, + Min: &min, + Sum: 3, + } + histogramDataPointC = metricdata.HistogramDataPoint{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Count: 2, + Bounds: []float64{0, 10}, + BucketCounts: []uint64{1, 1}, + Sum: 2, + } + + gaugeInt64A = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, + } + gaugeFloat64A = metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64A}, + } + gaugeInt64B = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64B}, + } + gaugeFloat64B = metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64B}, + } + gaugeInt64C = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64C}, + } + gaugeFloat64C = metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, + } + + sumInt64A = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, + } + sumFloat64A = metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64A}, + } + sumInt64B = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64B}, + } + sumFloat64B = metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64B}, + } + sumInt64C = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64C}, + } + sumFloat64C = metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, + } + + histogramA = metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint{histogramDataPointA}, + } + histogramB = metricdata.Histogram{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint{histogramDataPointB}, + } + histogramC = metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint{histogramDataPointC}, + } + + metricsA = metricdata.Metrics{ + Name: "A", + Description: "A desc", + Unit: unit.Dimensionless, + Data: sumInt64A, + } + metricsB = metricdata.Metrics{ + Name: "B", + Description: "B desc", + Unit: unit.Bytes, + Data: gaugeFloat64B, + } + metricsC = metricdata.Metrics{ + Name: "A", + Description: "A desc", + Unit: unit.Dimensionless, + Data: sumInt64C, + } + + scopeMetricsA = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "A"}, + Metrics: []metricdata.Metrics{metricsA}, + } + scopeMetricsB = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "B"}, + Metrics: []metricdata.Metrics{metricsB}, + } + scopeMetricsC = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "A"}, + Metrics: []metricdata.Metrics{metricsC}, + } + + resourceMetricsA = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("resource", "A")), + ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsA}, + } + resourceMetricsB = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("resource", "B")), + ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsB}, + } + resourceMetricsC = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("resource", "A")), + ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsC}, + } +) + +type equalFunc[T Datatypes] func(T, T, config) []string + +func testDatatype[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { + return func(t *testing.T) { + AssertEqual(t, a, a) + AssertEqual(t, b, b) + + r := f(a, b, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", a, b) + } +} + +func testDatatypeIgnoreTime[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { + return func(t *testing.T) { + AssertEqual(t, a, a) + AssertEqual(t, b, b) + + r := f(a, b, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", a, b) + } +} + +func TestAssertEqual(t *testing.T) { + t.Run("ResourceMetrics", testDatatype(resourceMetricsA, resourceMetricsB, equalResourceMetrics)) + t.Run("ScopeMetrics", testDatatype(scopeMetricsA, scopeMetricsB, equalScopeMetrics)) + t.Run("Metrics", testDatatype(metricsA, metricsB, equalMetrics)) + t.Run("Histogram", testDatatype(histogramA, histogramB, equalHistograms)) + t.Run("SumInt64", testDatatype(sumInt64A, sumInt64B, equalSums[int64])) + t.Run("SumFloat64", testDatatype(sumFloat64A, sumFloat64B, equalSums[float64])) + t.Run("GaugeInt64", testDatatype(gaugeInt64A, gaugeInt64B, equalGauges[int64])) + t.Run("GaugeFloat64", testDatatype(gaugeFloat64A, gaugeFloat64B, equalGauges[float64])) + t.Run("HistogramDataPoint", testDatatype(histogramDataPointA, histogramDataPointB, equalHistogramDataPoints)) + t.Run("DataPointInt64", testDatatype(dataPointInt64A, dataPointInt64B, equalDataPoints[int64])) + t.Run("DataPointFloat64", testDatatype(dataPointFloat64A, dataPointFloat64B, equalDataPoints[float64])) +} + +func TestAssertEqualIgnoreTime(t *testing.T) { + t.Run("ResourceMetrics", testDatatypeIgnoreTime(resourceMetricsA, resourceMetricsC, equalResourceMetrics)) + t.Run("ScopeMetrics", testDatatypeIgnoreTime(scopeMetricsA, scopeMetricsC, equalScopeMetrics)) + t.Run("Metrics", testDatatypeIgnoreTime(metricsA, metricsC, equalMetrics)) + t.Run("Histogram", testDatatypeIgnoreTime(histogramA, histogramC, equalHistograms)) + t.Run("SumInt64", testDatatypeIgnoreTime(sumInt64A, sumInt64C, equalSums[int64])) + t.Run("SumFloat64", testDatatypeIgnoreTime(sumFloat64A, sumFloat64C, equalSums[float64])) + t.Run("GaugeInt64", testDatatypeIgnoreTime(gaugeInt64A, gaugeInt64C, equalGauges[int64])) + t.Run("GaugeFloat64", testDatatypeIgnoreTime(gaugeFloat64A, gaugeFloat64C, equalGauges[float64])) + t.Run("HistogramDataPoint", testDatatypeIgnoreTime(histogramDataPointA, histogramDataPointC, equalHistogramDataPoints)) + t.Run("DataPointInt64", testDatatypeIgnoreTime(dataPointInt64A, dataPointInt64C, equalDataPoints[int64])) + t.Run("DataPointFloat64", testDatatypeIgnoreTime(dataPointFloat64A, dataPointFloat64C, equalDataPoints[float64])) +} + +type unknownAggregation struct { + metricdata.Aggregation +} + +func TestAssertAggregationsEqual(t *testing.T) { + AssertAggregationsEqual(t, nil, nil) + AssertAggregationsEqual(t, sumInt64A, sumInt64A) + AssertAggregationsEqual(t, sumFloat64A, sumFloat64A) + AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64A) + AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64A) + AssertAggregationsEqual(t, histogramA, histogramA) + + r := equalAggregations(sumInt64A, nil, config{}) + assert.Len(t, r, 1, "should return nil comparison mismatch only") + + r = equalAggregations(sumInt64A, gaugeInt64A, config{}) + assert.Len(t, r, 1, "should return with type mismatch only") + + r = equalAggregations(unknownAggregation{}, unknownAggregation{}, config{}) + assert.Len(t, r, 1, "should return with unknown aggregation only") + + r = equalAggregations(sumInt64A, sumInt64B, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", sumInt64A, sumInt64B) + + r = equalAggregations(sumInt64A, sumInt64C, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", sumInt64A, sumInt64C) + + r = equalAggregations(sumFloat64A, sumFloat64B, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", sumFloat64A, sumFloat64B) + + r = equalAggregations(sumFloat64A, sumFloat64C, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", sumFloat64A, sumFloat64C) + + r = equalAggregations(gaugeInt64A, gaugeInt64B, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", gaugeInt64A, gaugeInt64B) + + r = equalAggregations(gaugeInt64A, gaugeInt64C, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", gaugeInt64A, gaugeInt64C) + + r = equalAggregations(gaugeFloat64A, gaugeFloat64B, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", gaugeFloat64A, gaugeFloat64B) + + r = equalAggregations(gaugeFloat64A, gaugeFloat64C, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", gaugeFloat64A, gaugeFloat64C) + + r = equalAggregations(histogramA, histogramB, config{}) + assert.Greaterf(t, len(r), 0, "%v == %v", histogramA, histogramB) + + r = equalAggregations(histogramA, histogramC, config{ignoreTimestamp: true}) + assert.Equalf(t, len(r), 0, "%v == %v", histogramA, histogramC) +} diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go new file mode 100644 index 00000000000..4c40f3bf67d --- /dev/null +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -0,0 +1,363 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + +import ( + "bytes" + "fmt" + "reflect" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// equalResourceMetrics returns reasons ResourceMetrics are not equal. If they +// are equal, the returned reasons will be empty. +// +// The ScopeMetrics each ResourceMetrics contains are compared based on +// containing the same ScopeMetrics, not the order they are stored in. +func equalResourceMetrics(a, b metricdata.ResourceMetrics, cfg config) (reasons []string) { + if !a.Resource.Equal(b.Resource) { + reasons = append(reasons, notEqualStr("Resources", a.Resource, b.Resource)) + } + + r := compareDiff(diffSlices( + a.ScopeMetrics, + b.ScopeMetrics, + func(a, b metricdata.ScopeMetrics) bool { + r := equalScopeMetrics(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("ResourceMetrics ScopeMetrics not equal:\n%s", r)) + } + return reasons +} + +// equalScopeMetrics returns reasons ScopeMetrics are not equal. If they are +// equal, the returned reasons will be empty. +// +// The Metrics each ScopeMetrics contains are compared based on containing the +// same Metrics, not the order they are stored in. +func equalScopeMetrics(a, b metricdata.ScopeMetrics, cfg config) (reasons []string) { + if a.Scope != b.Scope { + reasons = append(reasons, notEqualStr("Scope", a.Scope, b.Scope)) + } + + r := compareDiff(diffSlices( + a.Metrics, + b.Metrics, + func(a, b metricdata.Metrics) bool { + r := equalMetrics(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("ScopeMetrics Metrics not equal:\n%s", r)) + } + return reasons +} + +// equalMetrics returns reasons Metrics are not equal. If they are equal, the +// returned reasons will be empty. +func equalMetrics(a, b metricdata.Metrics, cfg config) (reasons []string) { + if a.Name != b.Name { + reasons = append(reasons, notEqualStr("Name", a.Name, b.Name)) + } + if a.Description != b.Description { + reasons = append(reasons, notEqualStr("Description", a.Description, b.Description)) + } + if a.Unit != b.Unit { + reasons = append(reasons, notEqualStr("Unit", a.Unit, b.Unit)) + } + + r := equalAggregations(a.Data, b.Data, cfg) + if len(r) > 0 { + reasons = append(reasons, "Metrics Data not equal:") + reasons = append(reasons, r...) + } + return reasons +} + +// equalAggregations returns reasons a and b are not equal. If they are equal, +// the returned reasons will be empty. +func equalAggregations(a, b metricdata.Aggregation, cfg config) (reasons []string) { + if a == nil || b == nil { + if a != b { + return []string{notEqualStr("Aggregation", a, b)} + } + return reasons + } + + if reflect.TypeOf(a) != reflect.TypeOf(b) { + return []string{fmt.Sprintf("Aggregation types not equal:\nexpected: %T\nactual: %T", a, b)} + } + + switch v := a.(type) { + case metricdata.Gauge[int64]: + r := equalGauges(v, b.(metricdata.Gauge[int64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "Gauge[int64] not equal:") + reasons = append(reasons, r...) + } + case metricdata.Gauge[float64]: + r := equalGauges(v, b.(metricdata.Gauge[float64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "Gauge[float64] not equal:") + reasons = append(reasons, r...) + } + case metricdata.Sum[int64]: + r := equalSums(v, b.(metricdata.Sum[int64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "Sum[int64] not equal:") + reasons = append(reasons, r...) + } + case metricdata.Sum[float64]: + r := equalSums(v, b.(metricdata.Sum[float64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "Sum[float64] not equal:") + reasons = append(reasons, r...) + } + case metricdata.Histogram: + r := equalHistograms(v, b.(metricdata.Histogram), cfg) + if len(r) > 0 { + reasons = append(reasons, "Histogram not equal:") + reasons = append(reasons, r...) + } + default: + reasons = append(reasons, fmt.Sprintf("Aggregation of unknown types %T", a)) + } + return reasons +} + +// equalGauges returns reasons Gauges are not equal. If they are equal, the +// returned reasons will be empty. +// +// The DataPoints each Gauge contains are compared based on containing the +// same DataPoints, not the order they are stored in. +func equalGauges[N int64 | float64](a, b metricdata.Gauge[N], cfg config) (reasons []string) { + r := compareDiff(diffSlices( + a.DataPoints, + b.DataPoints, + func(a, b metricdata.DataPoint[N]) bool { + r := equalDataPoints(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Gauge DataPoints not equal:\n%s", r)) + } + return reasons +} + +// equalSums returns reasons Sums are not equal. If they are equal, the +// returned reasons will be empty. +// +// The DataPoints each Sum contains are compared based on containing the same +// DataPoints, not the order they are stored in. +func equalSums[N int64 | float64](a, b metricdata.Sum[N], cfg config) (reasons []string) { + if a.Temporality != b.Temporality { + reasons = append(reasons, notEqualStr("Temporality", a.Temporality, b.Temporality)) + } + if a.IsMonotonic != b.IsMonotonic { + reasons = append(reasons, notEqualStr("IsMonotonic", a.IsMonotonic, b.IsMonotonic)) + } + + r := compareDiff(diffSlices( + a.DataPoints, + b.DataPoints, + func(a, b metricdata.DataPoint[N]) bool { + r := equalDataPoints(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Sum DataPoints not equal:\n%s", r)) + } + return reasons +} + +// equalHistograms returns reasons Histograms are not equal. If they are +// equal, the returned reasons will be empty. +// +// The DataPoints each Histogram contains are compared based on containing the +// same HistogramDataPoint, not the order they are stored in. +func equalHistograms(a, b metricdata.Histogram, cfg config) (reasons []string) { + if a.Temporality != b.Temporality { + reasons = append(reasons, notEqualStr("Temporality", a.Temporality, b.Temporality)) + } + + r := compareDiff(diffSlices( + a.DataPoints, + b.DataPoints, + func(a, b metricdata.HistogramDataPoint) bool { + r := equalHistogramDataPoints(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Histogram DataPoints not equal:\n%s", r)) + } + return reasons +} + +// equalDataPoints returns reasons DataPoints are not equal. If they are +// equal, the returned reasons will be empty. +func equalDataPoints[N int64 | float64](a, b metricdata.DataPoint[N], cfg config) (reasons []string) { // nolint: revive // Intentional internal control flag + if !a.Attributes.Equals(&b.Attributes) { + reasons = append(reasons, notEqualStr( + "Attributes", + a.Attributes.Encoded(attribute.DefaultEncoder()), + b.Attributes.Encoded(attribute.DefaultEncoder()), + )) + } + + if !cfg.ignoreTimestamp { + if !a.StartTime.Equal(b.StartTime) { + reasons = append(reasons, notEqualStr("StartTime", a.StartTime.UnixNano(), b.StartTime.UnixNano())) + } + if !a.Time.Equal(b.Time) { + reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) + } + } + + if a.Value != b.Value { + reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + } + return reasons +} + +// equalHistogramDataPoints returns reasons HistogramDataPoints are not equal. +// If they are equal, the returned reasons will be empty. +func equalHistogramDataPoints(a, b metricdata.HistogramDataPoint, cfg config) (reasons []string) { // nolint: revive // Intentional internal control flag + if !a.Attributes.Equals(&b.Attributes) { + reasons = append(reasons, notEqualStr( + "Attributes", + a.Attributes.Encoded(attribute.DefaultEncoder()), + b.Attributes.Encoded(attribute.DefaultEncoder()), + )) + } + if !cfg.ignoreTimestamp { + if !a.StartTime.Equal(b.StartTime) { + reasons = append(reasons, notEqualStr("StartTime", a.StartTime.UnixNano(), b.StartTime.UnixNano())) + } + if !a.Time.Equal(b.Time) { + reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) + } + } + if a.Count != b.Count { + reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) + } + if !equalSlices(a.Bounds, b.Bounds) { + reasons = append(reasons, notEqualStr("Bounds", a.Bounds, b.Bounds)) + } + if !equalSlices(a.BucketCounts, b.BucketCounts) { + reasons = append(reasons, notEqualStr("BucketCounts", a.BucketCounts, b.BucketCounts)) + } + if !equalPtrValues(a.Min, b.Min) { + reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) + } + if !equalPtrValues(a.Max, b.Max) { + reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) + } + if a.Sum != b.Sum { + reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + } + return reasons +} + +func notEqualStr(prefix string, expected, actual interface{}) string { + return fmt.Sprintf("%s not equal:\nexpected: %v\nactual: %v", prefix, expected, actual) +} + +func equalSlices[T comparable](a, b []T) bool { + if len(a) != len(b) { + return false + } + for i, v := range a { + if v != b[i] { + return false + } + } + return true +} + +func equalPtrValues[T comparable](a, b *T) bool { + if a == nil || b == nil { + return a == b + } + + return *a == *b +} + +func diffSlices[T any](a, b []T, equal func(T, T) bool) (extraA, extraB []T) { + visited := make([]bool, len(b)) + for i := 0; i < len(a); i++ { + found := false + for j := 0; j < len(b); j++ { + if visited[j] { + continue + } + if equal(a[i], b[j]) { + visited[j] = true + found = true + break + } + } + if !found { + extraA = append(extraA, a[i]) + } + } + + for j := 0; j < len(b); j++ { + if visited[j] { + continue + } + extraB = append(extraB, b[j]) + } + + return extraA, extraB +} + +func compareDiff[T any](extraExpected, extraActual []T) string { + if len(extraExpected) == 0 && len(extraActual) == 0 { + return "" + } + + formater := func(v T) string { + return fmt.Sprintf("%#v", v) + } + + var msg bytes.Buffer + if len(extraExpected) > 0 { + _, _ = msg.WriteString("missing expected values:\n") + for _, v := range extraExpected { + _, _ = msg.WriteString(formater(v) + "\n") + } + } + + if len(extraActual) > 0 { + _, _ = msg.WriteString("unexpected additional values:\n") + for _, v := range extraActual { + _, _ = msg.WriteString(formater(v) + "\n") + } + } + + return msg.String() +} diff --git a/sdk/metric/metricdata/temporality.go b/sdk/metric/metricdata/temporality.go new file mode 100644 index 00000000000..5cf105b7947 --- /dev/null +++ b/sdk/metric/metricdata/temporality.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:generate stringer -type=Temporality +//go:build go1.17 +// +build go1.17 + +package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" + +// Temporality defines the window that an aggregation was calculated over. +type Temporality uint8 + +const ( + // undefinedTemporality represents an unset Temporality. + //nolint:deadcode,unused,varcheck + undefinedTemporality Temporality = iota + + // CumulativeTemporality defines a measurement interval that continues to + // expand forward in time from a starting point. New measurements are + // added to all previous measurements since a start time. + CumulativeTemporality + + // DeltaTemporality defines a measurement interval that resets each cycle. + // Measurements from one cycle are recorded independently, measurements + // from other cycles do not affect them. + DeltaTemporality +) + +// MarshalText returns the byte encoded of t. +func (t Temporality) MarshalText() ([]byte, error) { + return []byte(t.String()), nil +} diff --git a/sdk/metric/export/aggregation/temporality_string.go b/sdk/metric/metricdata/temporality_string.go similarity index 66% rename from sdk/metric/export/aggregation/temporality_string.go rename to sdk/metric/metricdata/temporality_string.go index 3edbeb4592d..4da833cdce2 100644 --- a/sdk/metric/export/aggregation/temporality_string.go +++ b/sdk/metric/metricdata/temporality_string.go @@ -1,6 +1,6 @@ // Code generated by "stringer -type=Temporality"; DO NOT EDIT. -package aggregation +package metricdata import "strconv" @@ -8,18 +8,18 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} + _ = x[undefinedTemporality-0] _ = x[CumulativeTemporality-1] _ = x[DeltaTemporality-2] } -const _Temporality_name = "CumulativeTemporalityDeltaTemporality" +const _Temporality_name = "undefinedTemporalityCumulativeTemporalityDeltaTemporality" -var _Temporality_index = [...]uint8{0, 21, 37} +var _Temporality_index = [...]uint8{0, 20, 41, 57} func (i Temporality) String() string { - i -= 1 if i >= Temporality(len(_Temporality_index)-1) { - return "Temporality(" + strconv.FormatInt(int64(i+1), 10) + ")" + return "Temporality(" + strconv.FormatInt(int64(i), 10) + ")" } return _Temporality_name[_Temporality_index[i]:_Temporality_index[i+1]] } diff --git a/sdk/metric/metrictest/config.go b/sdk/metric/metrictest/config.go deleted file mode 100644 index 4531b178fdc..00000000000 --- a/sdk/metric/metrictest/config.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" - -import "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - -type config struct { - temporalitySelector aggregation.TemporalitySelector -} - -func newConfig(opts ...Option) config { - cfg := config{ - temporalitySelector: aggregation.CumulativeTemporalitySelector(), - } - for _, opt := range opts { - cfg = opt.apply(cfg) - } - return cfg -} - -// Option allow for control of details of the TestMeterProvider created. -type Option interface { - apply(config) config -} - -type functionOption func(config) config - -func (f functionOption) apply(cfg config) config { - return f(cfg) -} - -// WithTemporalitySelector allows for the use of either cumulative (default) or -// delta metrics. -// -// Warning: the current SDK does not convert async instruments into delta -// temporality. -func WithTemporalitySelector(ts aggregation.TemporalitySelector) Option { - return functionOption(func(cfg config) config { - if ts == nil { - return cfg - } - cfg.temporalitySelector = ts - return cfg - }) -} diff --git a/sdk/metric/metrictest/exporter.go b/sdk/metric/metrictest/exporter.go deleted file mode 100644 index c0926dd7cf6..00000000000 --- a/sdk/metric/metrictest/exporter.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest // import "go.opentelemetry.io/otel/sdk/metric/metrictest" - -import ( - "context" - "fmt" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/instrumentation" - controller "go.opentelemetry.io/otel/sdk/metric/controller/basic" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/number" - processor "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - selector "go.opentelemetry.io/otel/sdk/metric/selector/simple" -) - -// Exporter is a manually collected exporter for testing the SDK. It does not -// satisfy the `export.Exporter` interface because it is not intended to be -// used with the periodic collection of the SDK, instead the test should -// manually call `Collect()` -// -// Exporters are not thread safe, and should only be used for testing. -type Exporter struct { - // Records contains the last metrics collected. - Records []ExportRecord - - controller *controller.Controller - temporalitySelector aggregation.TemporalitySelector -} - -// NewTestMeterProvider creates a MeterProvider and Exporter to be used in tests. -func NewTestMeterProvider(opts ...Option) (metric.MeterProvider, *Exporter) { - cfg := newConfig(opts...) - - c := controller.New( - processor.NewFactory( - selector.NewWithHistogramDistribution(), - cfg.temporalitySelector, - ), - controller.WithCollectPeriod(0), - ) - exp := &Exporter{ - controller: c, - temporalitySelector: cfg.temporalitySelector, - } - - return c, exp -} - -// Deprecated: please use Scope instead. -type Library = Scope - -// Scope is the same as "sdk/instrumentation".Scope but there is -// a package cycle to use it so it is redeclared here. -type Scope struct { - InstrumentationName string - InstrumentationVersion string - SchemaURL string -} - -// ExportRecord represents one collected datapoint from the Exporter. -type ExportRecord struct { - InstrumentName string - InstrumentationLibrary Library - Attributes []attribute.KeyValue - AggregationKind aggregation.Kind - NumberKind number.Kind - Sum number.Number - Count uint64 - Histogram aggregation.Buckets - LastValue number.Number -} - -// Collect triggers the SDK's collect methods and then aggregates the data into -// ExportRecords. This will overwrite any previous collected metrics. -func (e *Exporter) Collect(ctx context.Context) error { - e.Records = []ExportRecord{} - - err := e.controller.Collect(ctx) - if err != nil { - return err - } - - return e.controller.ForEach(func(l instrumentation.Library, r export.Reader) error { - lib := Library{ - InstrumentationName: l.Name, - InstrumentationVersion: l.Version, - SchemaURL: l.SchemaURL, - } - - return r.ForEach(e.temporalitySelector, func(rec export.Record) error { - record := ExportRecord{ - InstrumentName: rec.Descriptor().Name(), - InstrumentationLibrary: lib, - Attributes: rec.Attributes().ToSlice(), - AggregationKind: rec.Aggregation().Kind(), - NumberKind: rec.Descriptor().NumberKind(), - } - - var err error - switch agg := rec.Aggregation().(type) { - case aggregation.Histogram: - record.AggregationKind = aggregation.HistogramKind - record.Histogram, err = agg.Histogram() - if err != nil { - return err - } - record.Sum, err = agg.Sum() - if err != nil { - return err - } - record.Count, err = agg.Count() - if err != nil { - return err - } - case aggregation.Count: - record.Count, err = agg.Count() - if err != nil { - return err - } - case aggregation.LastValue: - record.LastValue, _, err = agg.LastValue() - if err != nil { - return err - } - case aggregation.Sum: - record.Sum, err = agg.Sum() - if err != nil { - return err - } - } - - e.Records = append(e.Records, record) - return nil - }) - }) -} - -// GetRecords returns all Records found by the SDK. -func (e *Exporter) GetRecords() []ExportRecord { - return e.Records -} - -var errNotFound = fmt.Errorf("record not found") - -// GetByName returns the first Record with a matching instrument name. -func (e *Exporter) GetByName(name string) (ExportRecord, error) { - for _, rec := range e.Records { - if rec.InstrumentName == name { - return rec, nil - } - } - return ExportRecord{}, errNotFound -} - -// GetByNameAndAttributes returns the first Record with a matching name and the sub-set of attributes. -func (e *Exporter) GetByNameAndAttributes(name string, attributes []attribute.KeyValue) (ExportRecord, error) { - for _, rec := range e.Records { - if rec.InstrumentName == name && subSet(attributes, rec.Attributes) { - return rec, nil - } - } - return ExportRecord{}, errNotFound -} - -// subSet returns true if attributesA is a subset of attributesB. -func subSet(attributesA, attributesB []attribute.KeyValue) bool { - b := attribute.NewSet(attributesB...) - - for _, kv := range attributesA { - if v, found := b.Value(kv.Key); !found || v != kv.Value { - return false - } - } - return true -} - -// NewDescriptor is a test helper for constructing test metric -// descriptors using standard options. -func NewDescriptor(name string, ikind sdkapi.InstrumentKind, nkind number.Kind, opts ...instrument.Option) sdkapi.Descriptor { - cfg := instrument.NewConfig(opts...) - return sdkapi.NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit()) -} diff --git a/sdk/metric/metrictest/exporter_test.go b/sdk/metric/metrictest/exporter_test.go deleted file mode 100644 index 10f4fb4358c..00000000000 --- a/sdk/metric/metrictest/exporter_test.go +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metrictest_test // import "go.opentelemetry.io/otel/sdk/metric/metrictest" - -import ( - "context" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" -) - -func TestSyncInstruments(t *testing.T) { - ctx := context.Background() - mp, exp := metrictest.NewTestMeterProvider() - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestSyncInstruments") - - t.Run("Float Counter", func(t *testing.T) { - fcnt, err := meter.SyncFloat64().Counter("fCount") - require.NoError(t, err) - - fcnt.Add(ctx, 2) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fCount") - require.NoError(t, err) - assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float UpDownCounter", func(t *testing.T) { - fudcnt, err := meter.SyncFloat64().UpDownCounter("fUDCount") - require.NoError(t, err) - - fudcnt.Add(ctx, 3) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fUDCount") - require.NoError(t, err) - assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float Histogram", func(t *testing.T) { - fhis, err := meter.SyncFloat64().Histogram("fHist") - require.NoError(t, err) - - fhis.Record(ctx, 4) - fhis.Record(ctx, 5) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fHist") - require.NoError(t, err) - assert.InDelta(t, 9.0, out.Sum.AsFloat64(), 0.0001) - assert.EqualValues(t, 2, out.Count) - assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) - }) - - t.Run("Int Counter", func(t *testing.T) { - icnt, err := meter.SyncInt64().Counter("iCount") - require.NoError(t, err) - - icnt.Add(ctx, 22) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iCount") - require.NoError(t, err) - assert.EqualValues(t, 22, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - t.Run("Int UpDownCounter", func(t *testing.T) { - iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") - require.NoError(t, err) - - iudcnt.Add(ctx, 23) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iUDCount") - require.NoError(t, err) - assert.EqualValues(t, 23, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - t.Run("Int Histogram", func(t *testing.T) { - ihis, err := meter.SyncInt64().Histogram("iHist") - require.NoError(t, err) - - ihis.Record(ctx, 24) - ihis.Record(ctx, 25) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iHist") - require.NoError(t, err) - assert.EqualValues(t, 49, out.Sum.AsInt64()) - assert.EqualValues(t, 2, out.Count) - assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) - }) -} - -func TestSyncDeltaInstruments(t *testing.T) { - ctx := context.Background() - mp, exp := metrictest.NewTestMeterProvider(metrictest.WithTemporalitySelector(aggregation.DeltaTemporalitySelector())) - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestSyncDeltaInstruments") - - t.Run("Float Counter", func(t *testing.T) { - fcnt, err := meter.SyncFloat64().Counter("fCount") - require.NoError(t, err) - - fcnt.Add(ctx, 2) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fCount") - require.NoError(t, err) - assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float UpDownCounter", func(t *testing.T) { - fudcnt, err := meter.SyncFloat64().UpDownCounter("fUDCount") - require.NoError(t, err) - - fudcnt.Add(ctx, 3) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fUDCount") - require.NoError(t, err) - assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float Histogram", func(t *testing.T) { - fhis, err := meter.SyncFloat64().Histogram("fHist") - require.NoError(t, err) - - fhis.Record(ctx, 4) - fhis.Record(ctx, 5) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fHist") - require.NoError(t, err) - assert.InDelta(t, 9.0, out.Sum.AsFloat64(), 0.0001) - assert.EqualValues(t, 2, out.Count) - assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) - }) - - t.Run("Int Counter", func(t *testing.T) { - icnt, err := meter.SyncInt64().Counter("iCount") - require.NoError(t, err) - - icnt.Add(ctx, 22) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iCount") - require.NoError(t, err) - assert.EqualValues(t, 22, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - t.Run("Int UpDownCounter", func(t *testing.T) { - iudcnt, err := meter.SyncInt64().UpDownCounter("iUDCount") - require.NoError(t, err) - - iudcnt.Add(ctx, 23) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iUDCount") - require.NoError(t, err) - assert.EqualValues(t, 23, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - t.Run("Int Histogram", func(t *testing.T) { - ihis, err := meter.SyncInt64().Histogram("iHist") - require.NoError(t, err) - - ihis.Record(ctx, 24) - ihis.Record(ctx, 25) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iHist") - require.NoError(t, err) - assert.EqualValues(t, 49, out.Sum.AsInt64()) - assert.EqualValues(t, 2, out.Count) - assert.Equal(t, aggregation.HistogramKind, out.AggregationKind) - }) -} - -func TestAsyncInstruments(t *testing.T) { - ctx := context.Background() - mp, exp := metrictest.NewTestMeterProvider() - - t.Run("Float Counter", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatCounter") - - fcnt, err := meter.AsyncFloat64().Counter("fCount") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - fcnt, - }, func(context.Context) { - fcnt.Observe(ctx, 2) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fCount") - require.NoError(t, err) - assert.InDelta(t, 2.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float UpDownCounter", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatUpDownCounter") - - fudcnt, err := meter.AsyncFloat64().UpDownCounter("fUDCount") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - fudcnt, - }, func(context.Context) { - fudcnt.Observe(ctx, 3) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fUDCount") - require.NoError(t, err) - assert.InDelta(t, 3.0, out.Sum.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Float Gauge", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_FloatGauge") - - fgauge, err := meter.AsyncFloat64().Gauge("fGauge") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - fgauge, - }, func(context.Context) { - fgauge.Observe(ctx, 4) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("fGauge") - require.NoError(t, err) - assert.InDelta(t, 4.0, out.LastValue.AsFloat64(), 0.0001) - assert.Equal(t, aggregation.LastValueKind, out.AggregationKind) - }) - - t.Run("Int Counter", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntCounter") - - icnt, err := meter.AsyncInt64().Counter("iCount") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - icnt, - }, func(context.Context) { - icnt.Observe(ctx, 22) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iCount") - require.NoError(t, err) - assert.EqualValues(t, 22, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - - t.Run("Int UpDownCounter", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntUpDownCounter") - - iudcnt, err := meter.AsyncInt64().UpDownCounter("iUDCount") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - iudcnt, - }, func(context.Context) { - iudcnt.Observe(ctx, 23) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iUDCount") - require.NoError(t, err) - assert.EqualValues(t, 23, out.Sum.AsInt64()) - assert.Equal(t, aggregation.SumKind, out.AggregationKind) - }) - t.Run("Int Gauge", func(t *testing.T) { - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_TestAsyncCounter_IntGauge") - - igauge, err := meter.AsyncInt64().Gauge("iGauge") - require.NoError(t, err) - - err = meter.RegisterCallback( - []instrument.Asynchronous{ - igauge, - }, func(context.Context) { - igauge.Observe(ctx, 25) - }) - require.NoError(t, err) - - err = exp.Collect(context.Background()) - require.NoError(t, err) - - out, err := exp.GetByName("iGauge") - require.NoError(t, err) - assert.EqualValues(t, 25, out.LastValue.AsInt64()) - assert.Equal(t, aggregation.LastValueKind, out.AggregationKind) - }) -} - -func ExampleExporter_GetByName() { - mp, exp := metrictest.NewTestMeterProvider() - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_ExampleExporter_GetByName") - - cnt, err := meter.SyncFloat64().Counter("fCount") - if err != nil { - panic("could not acquire counter") - } - - cnt.Add(context.Background(), 2.5) - - err = exp.Collect(context.Background()) - if err != nil { - panic("collection failed") - } - - out, _ := exp.GetByName("fCount") - - fmt.Println(out.Sum.AsFloat64()) - // Output: 2.5 -} - -func ExampleExporter_GetByNameAndAttributes() { - mp, exp := metrictest.NewTestMeterProvider() - meter := mp.Meter("go.opentelemetry.io/otel/sdk/metric/metrictest/exporter_ExampleExporter_GetByNameAndAttributes") - - cnt, err := meter.SyncFloat64().Counter("fCount") - if err != nil { - panic("could not acquire counter") - } - - cnt.Add(context.Background(), 4, attribute.String("foo", "bar"), attribute.Bool("found", false)) - - err = exp.Collect(context.Background()) - if err != nil { - panic("collection failed") - } - - out, err := exp.GetByNameAndAttributes("fCount", []attribute.KeyValue{attribute.String("foo", "bar")}) - if err != nil { - println(err.Error()) - } - - fmt.Println(out.Sum.AsFloat64()) - // Output: 4 -} diff --git a/sdk/metric/number/kind_string.go b/sdk/metric/number/kind_string.go deleted file mode 100644 index 6288c7ea295..00000000000 --- a/sdk/metric/number/kind_string.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by "stringer -type=Kind"; DO NOT EDIT. - -package number - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[Int64Kind-0] - _ = x[Float64Kind-1] -} - -const _Kind_name = "Int64KindFloat64Kind" - -var _Kind_index = [...]uint8{0, 9, 20} - -func (i Kind) String() string { - if i < 0 || i >= Kind(len(_Kind_index)-1) { - return "Kind(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] -} diff --git a/sdk/metric/number/number.go b/sdk/metric/number/number.go deleted file mode 100644 index 6ba16112fde..00000000000 --- a/sdk/metric/number/number.go +++ /dev/null @@ -1,539 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package number // import "go.opentelemetry.io/otel/sdk/metric/number" - -//go:generate stringer -type=Kind - -import ( - "fmt" - "math" - "sync/atomic" - - "go.opentelemetry.io/otel/internal" -) - -// Kind describes the data type of the Number. -type Kind int8 - -const ( - // Int64Kind means that the Number stores int64. - Int64Kind Kind = iota - // Float64Kind means that the Number stores float64. - Float64Kind -) - -// Zero returns a zero value for a given Kind. -func (k Kind) Zero() Number { - switch k { - case Int64Kind: - return NewInt64Number(0) - case Float64Kind: - return NewFloat64Number(0.) - default: - return Number(0) - } -} - -// Minimum returns the minimum representable value -// for a given Kind. -func (k Kind) Minimum() Number { - switch k { - case Int64Kind: - return NewInt64Number(math.MinInt64) - case Float64Kind: - return NewFloat64Number(-1. * math.MaxFloat64) - default: - return Number(0) - } -} - -// Maximum returns the maximum representable value -// for a given Kind. -func (k Kind) Maximum() Number { - switch k { - case Int64Kind: - return NewInt64Number(math.MaxInt64) - case Float64Kind: - return NewFloat64Number(math.MaxFloat64) - default: - return Number(0) - } -} - -// Number represents either an integral or a floating point value. It -// needs to be accompanied with a source of Kind that describes -// the actual type of the value stored within Number. -type Number uint64 - -// - constructors - -// NewNumberFromRaw creates a new Number from a raw value. -func NewNumberFromRaw(r uint64) Number { - return Number(r) -} - -// NewInt64Number creates an integral Number. -func NewInt64Number(i int64) Number { - return NewNumberFromRaw(internal.Int64ToRaw(i)) -} - -// NewFloat64Number creates a floating point Number. -func NewFloat64Number(f float64) Number { - return NewNumberFromRaw(internal.Float64ToRaw(f)) -} - -// NewNumberSignChange returns a number with the same magnitude and -// the opposite sign. `kind` must describe the kind of number in `nn`. -func NewNumberSignChange(kind Kind, nn Number) Number { - switch kind { - case Int64Kind: - return NewInt64Number(-nn.AsInt64()) - case Float64Kind: - return NewFloat64Number(-nn.AsFloat64()) - } - return nn -} - -// - as x - -// AsNumber gets the Number. -func (n *Number) AsNumber() Number { - return *n -} - -// AsRaw gets the uninterpreted raw value. Might be useful for some -// atomic operations. -func (n *Number) AsRaw() uint64 { - return uint64(*n) -} - -// AsInt64 assumes that the value contains an int64 and returns it as -// such. -func (n *Number) AsInt64() int64 { - return internal.RawToInt64(n.AsRaw()) -} - -// AsFloat64 assumes that the measurement value contains a float64 and -// returns it as such. -func (n *Number) AsFloat64() float64 { - return internal.RawToFloat64(n.AsRaw()) -} - -// - as x atomic - -// AsNumberAtomic gets the Number atomically. -func (n *Number) AsNumberAtomic() Number { - return NewNumberFromRaw(n.AsRawAtomic()) -} - -// AsRawAtomic gets the uninterpreted raw value atomically. Might be -// useful for some atomic operations. -func (n *Number) AsRawAtomic() uint64 { - return atomic.LoadUint64(n.AsRawPtr()) -} - -// AsInt64Atomic assumes that the number contains an int64 and returns -// it as such atomically. -func (n *Number) AsInt64Atomic() int64 { - return atomic.LoadInt64(n.AsInt64Ptr()) -} - -// AsFloat64Atomic assumes that the measurement value contains a -// float64 and returns it as such atomically. -func (n *Number) AsFloat64Atomic() float64 { - return internal.RawToFloat64(n.AsRawAtomic()) -} - -// - as x ptr - -// AsRawPtr gets the pointer to the raw, uninterpreted raw -// value. Might be useful for some atomic operations. -func (n *Number) AsRawPtr() *uint64 { - return (*uint64)(n) -} - -// AsInt64Ptr assumes that the number contains an int64 and returns a -// pointer to it. -func (n *Number) AsInt64Ptr() *int64 { - return internal.RawPtrToInt64Ptr(n.AsRawPtr()) -} - -// AsFloat64Ptr assumes that the number contains a float64 and returns a -// pointer to it. -func (n *Number) AsFloat64Ptr() *float64 { - return internal.RawPtrToFloat64Ptr(n.AsRawPtr()) -} - -// - coerce - -// CoerceToInt64 casts the number to int64. May result in -// data/precision loss. -func (n *Number) CoerceToInt64(kind Kind) int64 { - switch kind { - case Int64Kind: - return n.AsInt64() - case Float64Kind: - return int64(n.AsFloat64()) - default: - // you get what you deserve - return 0 - } -} - -// CoerceToFloat64 casts the number to float64. May result in -// data/precision loss. -func (n *Number) CoerceToFloat64(kind Kind) float64 { - switch kind { - case Int64Kind: - return float64(n.AsInt64()) - case Float64Kind: - return n.AsFloat64() - default: - // you get what you deserve - return 0 - } -} - -// - set - -// SetNumber sets the number to the passed number. Both should be of -// the same kind. -func (n *Number) SetNumber(nn Number) { - *n.AsRawPtr() = nn.AsRaw() -} - -// SetRaw sets the number to the passed raw value. Both number and the -// raw number should represent the same kind. -func (n *Number) SetRaw(r uint64) { - *n.AsRawPtr() = r -} - -// SetInt64 assumes that the number contains an int64 and sets it to -// the passed value. -func (n *Number) SetInt64(i int64) { - *n.AsInt64Ptr() = i -} - -// SetFloat64 assumes that the number contains a float64 and sets it -// to the passed value. -func (n *Number) SetFloat64(f float64) { - *n.AsFloat64Ptr() = f -} - -// - set atomic - -// SetNumberAtomic sets the number to the passed number -// atomically. Both should be of the same kind. -func (n *Number) SetNumberAtomic(nn Number) { - atomic.StoreUint64(n.AsRawPtr(), nn.AsRaw()) -} - -// SetRawAtomic sets the number to the passed raw value -// atomically. Both number and the raw number should represent the -// same kind. -func (n *Number) SetRawAtomic(r uint64) { - atomic.StoreUint64(n.AsRawPtr(), r) -} - -// SetInt64Atomic assumes that the number contains an int64 and sets -// it to the passed value atomically. -func (n *Number) SetInt64Atomic(i int64) { - atomic.StoreInt64(n.AsInt64Ptr(), i) -} - -// SetFloat64Atomic assumes that the number contains a float64 and -// sets it to the passed value atomically. -func (n *Number) SetFloat64Atomic(f float64) { - atomic.StoreUint64(n.AsRawPtr(), internal.Float64ToRaw(f)) -} - -// - swap - -// SwapNumber sets the number to the passed number and returns the old -// number. Both this number and the passed number should be of the -// same kind. -func (n *Number) SwapNumber(nn Number) Number { - old := *n - n.SetNumber(nn) - return old -} - -// SwapRaw sets the number to the passed raw value and returns the old -// raw value. Both number and the raw number should represent the same -// kind. -func (n *Number) SwapRaw(r uint64) uint64 { - old := n.AsRaw() - n.SetRaw(r) - return old -} - -// SwapInt64 assumes that the number contains an int64, sets it to the -// passed value and returns the old int64 value. -func (n *Number) SwapInt64(i int64) int64 { - old := n.AsInt64() - n.SetInt64(i) - return old -} - -// SwapFloat64 assumes that the number contains an float64, sets it to -// the passed value and returns the old float64 value. -func (n *Number) SwapFloat64(f float64) float64 { - old := n.AsFloat64() - n.SetFloat64(f) - return old -} - -// - swap atomic - -// SwapNumberAtomic sets the number to the passed number and returns -// the old number atomically. Both this number and the passed number -// should be of the same kind. -func (n *Number) SwapNumberAtomic(nn Number) Number { - return NewNumberFromRaw(atomic.SwapUint64(n.AsRawPtr(), nn.AsRaw())) -} - -// SwapRawAtomic sets the number to the passed raw value and returns -// the old raw value atomically. Both number and the raw number should -// represent the same kind. -func (n *Number) SwapRawAtomic(r uint64) uint64 { - return atomic.SwapUint64(n.AsRawPtr(), r) -} - -// SwapInt64Atomic assumes that the number contains an int64, sets it -// to the passed value and returns the old int64 value atomically. -func (n *Number) SwapInt64Atomic(i int64) int64 { - return atomic.SwapInt64(n.AsInt64Ptr(), i) -} - -// SwapFloat64Atomic assumes that the number contains an float64, sets -// it to the passed value and returns the old float64 value -// atomically. -func (n *Number) SwapFloat64Atomic(f float64) float64 { - return internal.RawToFloat64(atomic.SwapUint64(n.AsRawPtr(), internal.Float64ToRaw(f))) -} - -// - add - -// AddNumber assumes that this and the passed number are of the passed -// kind and adds the passed number to this number. -func (n *Number) AddNumber(kind Kind, nn Number) { - switch kind { - case Int64Kind: - n.AddInt64(nn.AsInt64()) - case Float64Kind: - n.AddFloat64(nn.AsFloat64()) - } -} - -// AddRaw assumes that this number and the passed raw value are of the -// passed kind and adds the passed raw value to this number. -func (n *Number) AddRaw(kind Kind, r uint64) { - n.AddNumber(kind, NewNumberFromRaw(r)) -} - -// AddInt64 assumes that the number contains an int64 and adds the -// passed int64 to it. -func (n *Number) AddInt64(i int64) { - *n.AsInt64Ptr() += i -} - -// AddFloat64 assumes that the number contains a float64 and adds the -// passed float64 to it. -func (n *Number) AddFloat64(f float64) { - *n.AsFloat64Ptr() += f -} - -// - add atomic - -// AddNumberAtomic assumes that this and the passed number are of the -// passed kind and adds the passed number to this number atomically. -func (n *Number) AddNumberAtomic(kind Kind, nn Number) { - switch kind { - case Int64Kind: - n.AddInt64Atomic(nn.AsInt64()) - case Float64Kind: - n.AddFloat64Atomic(nn.AsFloat64()) - } -} - -// AddRawAtomic assumes that this number and the passed raw value are -// of the passed kind and adds the passed raw value to this number -// atomically. -func (n *Number) AddRawAtomic(kind Kind, r uint64) { - n.AddNumberAtomic(kind, NewNumberFromRaw(r)) -} - -// AddInt64Atomic assumes that the number contains an int64 and adds -// the passed int64 to it atomically. -func (n *Number) AddInt64Atomic(i int64) { - atomic.AddInt64(n.AsInt64Ptr(), i) -} - -// AddFloat64Atomic assumes that the number contains a float64 and -// adds the passed float64 to it atomically. -func (n *Number) AddFloat64Atomic(f float64) { - for { - o := n.AsFloat64Atomic() - if n.CompareAndSwapFloat64(o, o+f) { - break - } - } -} - -// - compare and swap (atomic only) - -// CompareAndSwapNumber does the atomic CAS operation on this -// number. This number and passed old and new numbers should be of the -// same kind. -func (n *Number) CompareAndSwapNumber(on, nn Number) bool { - return atomic.CompareAndSwapUint64(n.AsRawPtr(), on.AsRaw(), nn.AsRaw()) -} - -// CompareAndSwapRaw does the atomic CAS operation on this -// number. This number and passed old and new raw values should be of -// the same kind. -func (n *Number) CompareAndSwapRaw(or, nr uint64) bool { - return atomic.CompareAndSwapUint64(n.AsRawPtr(), or, nr) -} - -// CompareAndSwapInt64 assumes that this number contains an int64 and -// does the atomic CAS operation on it. -func (n *Number) CompareAndSwapInt64(oi, ni int64) bool { - return atomic.CompareAndSwapInt64(n.AsInt64Ptr(), oi, ni) -} - -// CompareAndSwapFloat64 assumes that this number contains a float64 and -// does the atomic CAS operation on it. -func (n *Number) CompareAndSwapFloat64(of, nf float64) bool { - return atomic.CompareAndSwapUint64(n.AsRawPtr(), internal.Float64ToRaw(of), internal.Float64ToRaw(nf)) -} - -// - compare - -// CompareNumber compares two Numbers given their kind. Both numbers -// should have the same kind. This returns: -// -// 0 if the numbers are equal -// -1 if the subject `n` is less than the argument `nn` -// +1 if the subject `n` is greater than the argument `nn` -func (n *Number) CompareNumber(kind Kind, nn Number) int { - switch kind { - case Int64Kind: - return n.CompareInt64(nn.AsInt64()) - case Float64Kind: - return n.CompareFloat64(nn.AsFloat64()) - default: - // you get what you deserve - return 0 - } -} - -// CompareRaw compares two numbers, where one is input as a raw -// uint64, interpreting both values as a `kind` of number. -func (n *Number) CompareRaw(kind Kind, r uint64) int { - return n.CompareNumber(kind, NewNumberFromRaw(r)) -} - -// CompareInt64 assumes that the Number contains an int64 and performs -// a comparison between the value and the other value. It returns the -// typical result of the compare function: -1 if the value is less -// than the other, 0 if both are equal, 1 if the value is greater than -// the other. -func (n *Number) CompareInt64(i int64) int { - this := n.AsInt64() - if this < i { - return -1 - } else if this > i { - return 1 - } - return 0 -} - -// CompareFloat64 assumes that the Number contains a float64 and -// performs a comparison between the value and the other value. It -// returns the typical result of the compare function: -1 if the value -// is less than the other, 0 if both are equal, 1 if the value is -// greater than the other. -// -// Do not compare NaN values. -func (n *Number) CompareFloat64(f float64) int { - this := n.AsFloat64() - if this < f { - return -1 - } else if this > f { - return 1 - } - return 0 -} - -// - relations to zero - -// IsPositive returns true if the actual value is greater than zero. -func (n *Number) IsPositive(kind Kind) bool { - return n.compareWithZero(kind) > 0 -} - -// IsNegative returns true if the actual value is less than zero. -func (n *Number) IsNegative(kind Kind) bool { - return n.compareWithZero(kind) < 0 -} - -// IsZero returns true if the actual value is equal to zero. -func (n *Number) IsZero(kind Kind) bool { - return n.compareWithZero(kind) == 0 -} - -// - misc - -// Emit returns a string representation of the raw value of the -// Number. A %d is used for integral values, %f for floating point -// values. -func (n *Number) Emit(kind Kind) string { - switch kind { - case Int64Kind: - return fmt.Sprintf("%d", n.AsInt64()) - case Float64Kind: - return fmt.Sprintf("%f", n.AsFloat64()) - default: - return "" - } -} - -// AsInterface returns the number as an interface{}, typically used -// for Kind-correct JSON conversion. -func (n *Number) AsInterface(kind Kind) interface{} { - switch kind { - case Int64Kind: - return n.AsInt64() - case Float64Kind: - return n.AsFloat64() - default: - return math.NaN() - } -} - -// - private stuff - -func (n *Number) compareWithZero(kind Kind) int { - switch kind { - case Int64Kind: - return n.CompareInt64(0) - case Float64Kind: - return n.CompareFloat64(0.) - default: - // you get what you deserve - return 0 - } -} diff --git a/sdk/metric/number/number_test.go b/sdk/metric/number/number_test.go deleted file mode 100644 index e8d675c7fc3..00000000000 --- a/sdk/metric/number/number_test.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package number - -import ( - "math" - "testing" - "unsafe" - - "github.com/stretchr/testify/require" -) - -func TestNumber(t *testing.T) { - iNeg := NewInt64Number(-42) - iZero := NewInt64Number(0) - iPos := NewInt64Number(42) - i64Numbers := [3]Number{iNeg, iZero, iPos} - - for idx, i := range []int64{-42, 0, 42} { - n := i64Numbers[idx] - if got := n.AsInt64(); got != i { - t.Errorf("Number %#v (%s) int64 check failed, expected %d, got %d", n, n.Emit(Int64Kind), i, got) - } - } - - for _, n := range i64Numbers { - expected := unsafe.Pointer(&n) - got := unsafe.Pointer(n.AsRawPtr()) - if expected != got { - t.Errorf("Getting raw pointer failed, got %v, expected %v", got, expected) - } - } - - fNeg := NewFloat64Number(-42.) - fZero := NewFloat64Number(0.) - fPos := NewFloat64Number(42.) - f64Numbers := [3]Number{fNeg, fZero, fPos} - - for idx, f := range []float64{-42., 0., 42.} { - n := f64Numbers[idx] - if got := n.AsFloat64(); got != f { - t.Errorf("Number %#v (%s) float64 check failed, expected %f, got %f", n, n.Emit(Int64Kind), f, got) - } - } - - for _, n := range f64Numbers { - expected := unsafe.Pointer(&n) - got := unsafe.Pointer(n.AsRawPtr()) - if expected != got { - t.Errorf("Getting raw pointer failed, got %v, expected %v", got, expected) - } - } - - cmpsForNeg := [3]int{0, -1, -1} - cmpsForZero := [3]int{1, 0, -1} - cmpsForPos := [3]int{1, 1, 0} - - type testcase struct { - // n needs to be aligned for 64-bit atomic operations. - n Number - // nums needs to be aligned for 64-bit atomic operations. - nums [3]Number - kind Kind - pos bool - zero bool - neg bool - cmps [3]int - } - testcases := []testcase{ - { - n: iNeg, - kind: Int64Kind, - pos: false, - zero: false, - neg: true, - nums: i64Numbers, - cmps: cmpsForNeg, - }, - { - n: iZero, - kind: Int64Kind, - pos: false, - zero: true, - neg: false, - nums: i64Numbers, - cmps: cmpsForZero, - }, - { - n: iPos, - kind: Int64Kind, - pos: true, - zero: false, - neg: false, - nums: i64Numbers, - cmps: cmpsForPos, - }, - { - n: fNeg, - kind: Float64Kind, - pos: false, - zero: false, - neg: true, - nums: f64Numbers, - cmps: cmpsForNeg, - }, - { - n: fZero, - kind: Float64Kind, - pos: false, - zero: true, - neg: false, - nums: f64Numbers, - cmps: cmpsForZero, - }, - { - n: fPos, - kind: Float64Kind, - pos: true, - zero: false, - neg: false, - nums: f64Numbers, - cmps: cmpsForPos, - }, - } - for _, tt := range testcases { - if got := tt.n.IsPositive(tt.kind); got != tt.pos { - t.Errorf("Number %#v (%s) positive check failed, expected %v, got %v", tt.n, tt.n.Emit(tt.kind), tt.pos, got) - } - if got := tt.n.IsZero(tt.kind); got != tt.zero { - t.Errorf("Number %#v (%s) zero check failed, expected %v, got %v", tt.n, tt.n.Emit(tt.kind), tt.pos, got) - } - if got := tt.n.IsNegative(tt.kind); got != tt.neg { - t.Errorf("Number %#v (%s) negative check failed, expected %v, got %v", tt.n, tt.n.Emit(tt.kind), tt.pos, got) - } - for i := 0; i < 3; i++ { - if got := tt.n.CompareRaw(tt.kind, tt.nums[i].AsRaw()); got != tt.cmps[i] { - t.Errorf("Number %#v (%s) compare check with %#v (%s) failed, expected %d, got %d", tt.n, tt.n.Emit(tt.kind), tt.nums[i], tt.nums[i].Emit(tt.kind), tt.cmps[i], got) - } - } - } -} - -func TestNumberZero(t *testing.T) { - zero := Number(0) - zerof := NewFloat64Number(0) - zeroi := NewInt64Number(0) - - if zero != zerof || zero != zeroi { - t.Errorf("Invalid zero representations") - } -} - -func TestNumberAsInterface(t *testing.T) { - i64 := NewInt64Number(10) - f64 := NewFloat64Number(11.11) - require.Equal(t, int64(10), (&i64).AsInterface(Int64Kind).(int64)) - require.Equal(t, 11.11, (&f64).AsInterface(Float64Kind).(float64)) -} - -func TestNumberSignChange(t *testing.T) { - t.Run("Int64", func(t *testing.T) { - posInt := NewInt64Number(10) - negInt := NewInt64Number(-10) - - require.Equal(t, posInt, NewNumberSignChange(Int64Kind, negInt)) - require.Equal(t, negInt, NewNumberSignChange(Int64Kind, posInt)) - }) - - t.Run("Float64", func(t *testing.T) { - posFloat := NewFloat64Number(10) - negFloat := NewFloat64Number(-10) - - require.Equal(t, posFloat, NewNumberSignChange(Float64Kind, negFloat)) - require.Equal(t, negFloat, NewNumberSignChange(Float64Kind, posFloat)) - }) - - t.Run("Float64Zero", func(t *testing.T) { - posFloat := NewFloat64Number(0) - negFloat := NewFloat64Number(math.Copysign(0, -1)) - - require.Equal(t, posFloat, NewNumberSignChange(Float64Kind, negFloat)) - require.Equal(t, negFloat, NewNumberSignChange(Float64Kind, posFloat)) - }) - - t.Run("Float64Inf", func(t *testing.T) { - posFloat := NewFloat64Number(math.Inf(+1)) - negFloat := NewFloat64Number(math.Inf(-1)) - - require.Equal(t, posFloat, NewNumberSignChange(Float64Kind, negFloat)) - require.Equal(t, negFloat, NewNumberSignChange(Float64Kind, posFloat)) - }) - - t.Run("Float64NaN", func(t *testing.T) { - posFloat := NewFloat64Number(math.NaN()) - negFloat := NewFloat64Number(math.Copysign(math.NaN(), -1)) - - require.Equal(t, posFloat, NewNumberSignChange(Float64Kind, negFloat)) - require.Equal(t, negFloat, NewNumberSignChange(Float64Kind, posFloat)) - }) -} diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go new file mode 100644 index 00000000000..9c66ac5d552 --- /dev/null +++ b/sdk/metric/periodic_reader.go @@ -0,0 +1,245 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "fmt" + "sync" + "sync/atomic" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +// Default periodic reader timing. +const ( + defaultTimeout = time.Millisecond * 30000 + defaultInterval = time.Millisecond * 60000 +) + +// periodicReaderConfig contains configuration options for a PeriodicReader. +type periodicReaderConfig struct { + interval time.Duration + timeout time.Duration + temporalitySelector TemporalitySelector + aggregationSelector AggregationSelector +} + +// newPeriodicReaderConfig returns a periodicReaderConfig configured with +// options. +func newPeriodicReaderConfig(options []PeriodicReaderOption) periodicReaderConfig { + c := periodicReaderConfig{ + interval: defaultInterval, + timeout: defaultTimeout, + temporalitySelector: DefaultTemporalitySelector, + aggregationSelector: DefaultAggregationSelector, + } + for _, o := range options { + c = o.applyPeriodic(c) + } + return c +} + +// PeriodicReaderOption applies a configuration option value to a PeriodicReader. +type PeriodicReaderOption interface { + applyPeriodic(periodicReaderConfig) periodicReaderConfig +} + +// periodicReaderOptionFunc applies a set of options to a periodicReaderConfig. +type periodicReaderOptionFunc func(periodicReaderConfig) periodicReaderConfig + +// applyPeriodic returns a periodicReaderConfig with option(s) applied. +func (o periodicReaderOptionFunc) applyPeriodic(conf periodicReaderConfig) periodicReaderConfig { + return o(conf) +} + +// WithTimeout configures the time a PeriodicReader waits for an export to +// complete before canceling it. +// +// If this option is not used or d is less than or equal to zero, 30 seconds +// is used as the default. +func WithTimeout(d time.Duration) PeriodicReaderOption { + return periodicReaderOptionFunc(func(conf periodicReaderConfig) periodicReaderConfig { + if d <= 0 { + return conf + } + conf.timeout = d + return conf + }) +} + +// WithInterval configures the intervening time between exports for a +// PeriodicReader. +// +// If this option is not used or d is less than or equal to zero, 60 seconds +// is used as the default. +func WithInterval(d time.Duration) PeriodicReaderOption { + return periodicReaderOptionFunc(func(conf periodicReaderConfig) periodicReaderConfig { + if d <= 0 { + return conf + } + conf.interval = d + return conf + }) +} + +// NewPeriodicReader returns a Reader that collects and exports metric data to +// the exporter at a defined interval. By default, the returned Reader will +// collect and export data every 60 seconds, and will cancel export attempts +// that exceed 30 seconds. The export time is not counted towards the interval +// between attempts. +// +// The Collect method of the returned Reader continues to gather and return +// metric data to the user. It will not automatically send that data to the +// exporter. That is left to the user to accomplish. +func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reader { + conf := newPeriodicReaderConfig(options) + ctx, cancel := context.WithCancel(context.Background()) + r := &periodicReader{ + timeout: conf.timeout, + exporter: exporter, + cancel: cancel, + + temporalitySelector: conf.temporalitySelector, + aggregationSelector: conf.aggregationSelector, + } + + r.wg.Add(1) + go func() { + defer r.wg.Done() + r.run(ctx, conf.interval) + }() + + return r +} + +// periodicReader is a Reader that continuously collects and exports metric +// data at a set interval. +type periodicReader struct { + producer atomic.Value + + timeout time.Duration + exporter Exporter + + temporalitySelector TemporalitySelector + aggregationSelector AggregationSelector + + wg sync.WaitGroup + cancel context.CancelFunc + shutdownOnce sync.Once +} + +// Compile time check the periodicReader implements Reader and is comparable. +var _ = map[Reader]struct{}{&periodicReader{}: {}} + +// newTicker allows testing override. +var newTicker = time.NewTicker + +// run continuously collects and exports metric data at the specified +// interval. This will run until ctx is canceled or times out. +func (r *periodicReader) run(ctx context.Context, interval time.Duration) { + ticker := newTicker(interval) + defer ticker.Stop() + + for { + select { + case <-ticker.C: + m, err := r.Collect(ctx) + if err == nil { + c, cancel := context.WithTimeout(ctx, r.timeout) + err = r.exporter.Export(c, m) + cancel() + } + if err != nil { + otel.Handle(err) + } + case <-ctx.Done(): + return + } + } +} + +// register registers p as the producer of this reader. +func (r *periodicReader) register(p producer) { + // Only register once. If producer is already set, do nothing. + if !r.producer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { + msg := "did not register periodic reader" + global.Error(errDuplicateRegister, msg) + } +} + +// temporality reports the Temporality for the instrument kind provided. +func (r *periodicReader) temporality(kind view.InstrumentKind) metricdata.Temporality { + return r.temporalitySelector(kind) +} + +// aggregation returns what Aggregation to use for kind. +func (r *periodicReader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. + return r.aggregationSelector(kind) +} + +// Collect gathers and returns all metric data related to the Reader from +// the SDK. The returned metric data is not exported to the configured +// exporter, it is left to the caller to handle that if desired. +// +// An error is returned if this is called after Shutdown. +func (r *periodicReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { + p := r.producer.Load() + if p == nil { + return metricdata.ResourceMetrics{}, ErrReaderNotRegistered + } + + ph, ok := p.(produceHolder) + if !ok { + // The atomic.Value is entirely in the periodicReader's control so + // this should never happen. In the unforeseen case that this does + // happen, return an error instead of panicking so a users code does + // not halt in the processes. + err := fmt.Errorf("periodic reader: invalid producer: %T", p) + return metricdata.ResourceMetrics{}, err + } + return ph.produce(ctx) +} + +// ForceFlush flushes the Exporter. +func (r *periodicReader) ForceFlush(ctx context.Context) error { + return r.exporter.ForceFlush(ctx) +} + +// Shutdown stops the export pipeline. +func (r *periodicReader) Shutdown(ctx context.Context) error { + err := ErrReaderShutdown + r.shutdownOnce.Do(func() { + // Stop the run loop. + r.cancel() + r.wg.Wait() + + // Any future call to Collect will now return ErrReaderShutdown. + r.producer.Store(produceHolder{ + produce: shutdownProducer{}.produce, + }) + + err = r.exporter.Shutdown(ctx) + }) + return err +} diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go new file mode 100644 index 00000000000..5689aa11b85 --- /dev/null +++ b/sdk/metric/periodic_reader_test.go @@ -0,0 +1,225 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +const testDur = time.Second * 2 + +func TestWithTimeout(t *testing.T) { + test := func(d time.Duration) time.Duration { + opts := []PeriodicReaderOption{WithTimeout(d)} + return newPeriodicReaderConfig(opts).timeout + } + + assert.Equal(t, testDur, test(testDur)) + assert.Equal(t, defaultTimeout, newPeriodicReaderConfig(nil).timeout) + assert.Equal(t, defaultTimeout, test(time.Duration(0)), "invalid timeout should use default") + assert.Equal(t, defaultTimeout, test(time.Duration(-1)), "invalid timeout should use default") +} + +func TestWithInterval(t *testing.T) { + test := func(d time.Duration) time.Duration { + opts := []PeriodicReaderOption{WithInterval(d)} + return newPeriodicReaderConfig(opts).interval + } + + assert.Equal(t, testDur, test(testDur)) + assert.Equal(t, defaultInterval, newPeriodicReaderConfig(nil).interval) + assert.Equal(t, defaultInterval, test(time.Duration(0)), "invalid interval should use default") + assert.Equal(t, defaultInterval, test(time.Duration(-1)), "invalid interval should use default") +} + +type fnExporter struct { + exportFunc func(context.Context, metricdata.ResourceMetrics) error + flushFunc func(context.Context) error + shutdownFunc func(context.Context) error +} + +var _ Exporter = (*fnExporter)(nil) + +func (e *fnExporter) Export(ctx context.Context, m metricdata.ResourceMetrics) error { + if e.exportFunc != nil { + return e.exportFunc(ctx, m) + } + return nil +} + +func (e *fnExporter) ForceFlush(ctx context.Context) error { + if e.flushFunc != nil { + return e.flushFunc(ctx) + } + return nil +} + +func (e *fnExporter) Shutdown(ctx context.Context) error { + if e.shutdownFunc != nil { + return e.shutdownFunc(ctx) + } + return nil +} + +type periodicReaderTestSuite struct { + *readerTestSuite + + ErrReader Reader +} + +func (ts *periodicReaderTestSuite) SetupTest() { + ts.readerTestSuite.SetupTest() + + e := &fnExporter{ + exportFunc: func(context.Context, metricdata.ResourceMetrics) error { return assert.AnError }, + flushFunc: func(context.Context) error { return assert.AnError }, + shutdownFunc: func(context.Context) error { return assert.AnError }, + } + + ts.ErrReader = NewPeriodicReader(e) +} + +func (ts *periodicReaderTestSuite) TearDownTest() { + ts.readerTestSuite.TearDownTest() + + _ = ts.ErrReader.Shutdown(context.Background()) +} + +func (ts *periodicReaderTestSuite) TestForceFlushPropagated() { + ts.Equal(assert.AnError, ts.ErrReader.ForceFlush(context.Background())) +} + +func (ts *periodicReaderTestSuite) TestShutdownPropagated() { + ts.Equal(assert.AnError, ts.ErrReader.Shutdown(context.Background())) +} + +func TestPeriodicReader(t *testing.T) { + suite.Run(t, &periodicReaderTestSuite{ + readerTestSuite: &readerTestSuite{ + Factory: func() Reader { + return NewPeriodicReader(new(fnExporter)) + }, + }, + }) +} + +type chErrorHandler struct { + Err chan error +} + +func newChErrorHandler() *chErrorHandler { + return &chErrorHandler{ + Err: make(chan error, 1), + } +} + +func (eh chErrorHandler) Handle(err error) { + eh.Err <- err +} + +func TestPeriodicReaderRun(t *testing.T) { + // Override the ticker C chan so tests are not flaky and rely on timing. + defer func(orig func(time.Duration) *time.Ticker) { + newTicker = orig + }(newTicker) + // Keep this at size zero so when triggered with a send it will hang until + // the select case is selected and the collection loop is started. + trigger := make(chan time.Time) + newTicker = func(d time.Duration) *time.Ticker { + ticker := time.NewTicker(d) + ticker.C = trigger + return ticker + } + + // Register an error handler to validate export errors are passed to + // otel.Handle. + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + eh := newChErrorHandler() + otel.SetErrorHandler(eh) + + exp := &fnExporter{ + exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { + // The testProducer produces testMetrics. + assert.Equal(t, testMetrics, m) + return assert.AnError + }, + } + + r := NewPeriodicReader(exp) + r.register(testProducer{}) + trigger <- time.Now() + assert.Equal(t, assert.AnError, <-eh.Err) + + // Ensure Reader is allowed clean up attempt. + _ = r.Shutdown(context.Background()) +} + +func BenchmarkPeriodicReader(b *testing.B) { + b.Run("Collect", benchReaderCollectFunc( + NewPeriodicReader(new(fnExporter)), + )) +} + +func TestPeriodiclReaderTemporality(t *testing.T) { + tests := []struct { + name string + options []PeriodicReaderOption + // Currently only testing constant temporality. This should be expanded + // if we put more advanced selection in the SDK + wantTemporality metricdata.Temporality + }{ + { + name: "default", + wantTemporality: metricdata.CumulativeTemporality, + }, + { + name: "delta", + options: []PeriodicReaderOption{ + WithTemporalitySelector(deltaTemporalitySelector), + }, + wantTemporality: metricdata.DeltaTemporality, + }, + { + name: "repeats overwrite", + options: []PeriodicReaderOption{ + WithTemporalitySelector(deltaTemporalitySelector), + WithTemporalitySelector(cumulativeTemporalitySelector), + }, + wantTemporality: metricdata.CumulativeTemporality, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var undefinedInstrument view.InstrumentKind + rdr := NewPeriodicReader(new(fnExporter), tt.options...) + assert.Equal(t, tt.wantTemporality, rdr.temporality(undefinedInstrument)) + }) + } +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go new file mode 100644 index 00000000000..d4f7d4f8082 --- /dev/null +++ b/sdk/metric/pipeline.go @@ -0,0 +1,349 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "errors" + "fmt" + "strings" + "sync" + + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" +) + +type aggregator interface { + Aggregation() metricdata.Aggregation +} +type instrumentKey struct { + name string + unit unit.Unit +} + +type instrumentValue struct { + description string + aggregator aggregator +} + +func newPipeline(res *resource.Resource) *pipeline { + if res == nil { + res = resource.Empty() + } + return &pipeline{ + resource: res, + aggregations: make(map[instrumentation.Scope]map[instrumentKey]instrumentValue), + } +} + +// pipeline connects all of the instruments created by a meter provider to a Reader. +// This is the object that will be `Reader.register()` when a meter provider is created. +// +// As instruments are created the instrument should be checked if it exists in the +// views of a the Reader, and if so each aggregator should be added to the pipeline. +type pipeline struct { + resource *resource.Resource + + sync.Mutex + aggregations map[instrumentation.Scope]map[instrumentKey]instrumentValue + callbacks []func(context.Context) +} + +var errAlreadyRegistered = errors.New("instrument already registered") + +// addAggregator will stores an aggregator with an instrument description. The aggregator +// is used when `produce()` is called. +func (p *pipeline) addAggregator(scope instrumentation.Scope, name, description string, instUnit unit.Unit, agg aggregator) error { + p.Lock() + defer p.Unlock() + if p.aggregations == nil { + p.aggregations = map[instrumentation.Scope]map[instrumentKey]instrumentValue{} + } + if p.aggregations[scope] == nil { + p.aggregations[scope] = map[instrumentKey]instrumentValue{} + } + inst := instrumentKey{ + name: name, + unit: instUnit, + } + if _, ok := p.aggregations[scope][inst]; ok { + return fmt.Errorf("%w: name %s, scope: %s", errAlreadyRegistered, name, scope) + } + + p.aggregations[scope][inst] = instrumentValue{ + description: description, + aggregator: agg, + } + return nil +} + +// addCallback registers a callback to be run when `produce()` is called. +func (p *pipeline) addCallback(callback func(context.Context)) { + p.Lock() + defer p.Unlock() + p.callbacks = append(p.callbacks, callback) +} + +// callbackKey is a context key type used to identify context that came from the SDK. +type callbackKey int + +// produceKey is the context key to tell if a Observe is called within a callback. +// Its value of zero is arbitrary. If this package defined other context keys, +// they would have different integer values. +const produceKey callbackKey = 0 + +// produce returns aggregated metrics from a single collection. +// +// This method is safe to call concurrently. +func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { + p.Lock() + defer p.Unlock() + + ctx = context.WithValue(ctx, produceKey, struct{}{}) + + for _, callback := range p.callbacks { + // TODO make the callbacks parallel. ( #3034 ) + callback(ctx) + if err := ctx.Err(); err != nil { + // This means the context expired before we finished running callbacks. + return metricdata.ResourceMetrics{}, err + } + } + + sm := make([]metricdata.ScopeMetrics, 0, len(p.aggregations)) + for scope, instruments := range p.aggregations { + metrics := make([]metricdata.Metrics, 0, len(instruments)) + for inst, instValue := range instruments { + data := instValue.aggregator.Aggregation() + if data != nil { + metrics = append(metrics, metricdata.Metrics{ + Name: inst.name, + Description: instValue.description, + Unit: inst.unit, + Data: data, + }) + } + } + if len(metrics) > 0 { + sm = append(sm, metricdata.ScopeMetrics{ + Scope: scope, + Metrics: metrics, + }) + } + } + + return metricdata.ResourceMetrics{ + Resource: p.resource, + ScopeMetrics: sm, + }, nil +} + +// pipelineRegistry manages creating pipelines, and aggregators. Meters retrieve +// new Aggregators from a pipelineRegistry. +type pipelineRegistry struct { + views map[Reader][]view.View + pipelines map[Reader]*pipeline +} + +func newPipelineRegistries(views map[Reader][]view.View) *pipelineRegistry { + pipelines := map[Reader]*pipeline{} + for rdr := range views { + pipe := &pipeline{} + rdr.register(pipe) + pipelines[rdr] = pipe + } + return &pipelineRegistry{ + views: views, + pipelines: pipelines, + } +} + +// TODO (#3053) Only register callbacks if any instrument matches in a view. +func (reg *pipelineRegistry) registerCallback(fn func(context.Context)) { + for _, pipe := range reg.pipelines { + pipe.addCallback(fn) + } +} + +// createAggregators will create all backing aggregators for an instrument. +// It will return an error if an instrument is registered more than once. +// Note: There may be returned aggregators with an error. +func createAggregators[N int64 | float64](reg *pipelineRegistry, inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { + var aggs []internal.Aggregator[N] + + errs := &multierror{} + for rdr, views := range reg.views { + pipe := reg.pipelines[rdr] + rdrAggs, err := createAggregatorsForReader[N](rdr, views, inst) + if err != nil { + errs.append(err) + } + for inst, agg := range rdrAggs { + err := pipe.addAggregator(inst.scope, inst.name, inst.description, instUnit, agg) + if err != nil { + errs.append(err) + } + aggs = append(aggs, agg) + } + } + return aggs, errs.errorOrNil() +} + +type multierror struct { + wrapped error + errors []string +} + +func (m *multierror) errorOrNil() error { + if len(m.errors) == 0 { + return nil + } + return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; ")) +} + +func (m *multierror) append(err error) { + m.errors = append(m.errors, err.Error()) +} + +// instrumentID is used to identify multiple instruments being mapped to the same aggregator. +// e.g. using an exact match view with a name=* view. +// You can't use a view.Instrument here because not all Aggregators are comparable. +type instrumentID struct { + scope instrumentation.Scope + name string + description string +} + +var errCreatingAggregators = errors.New("could not create all aggregators") + +func createAggregatorsForReader[N int64 | float64](rdr Reader, views []view.View, inst view.Instrument) (map[instrumentID]internal.Aggregator[N], error) { + aggs := map[instrumentID]internal.Aggregator[N]{} + errs := &multierror{ + wrapped: errCreatingAggregators, + } + for _, v := range views { + inst, match := v.TransformInstrument(inst) + + ident := instrumentID{ + scope: inst.Scope, + name: inst.Name, + description: inst.Description, + } + + if _, ok := aggs[ident]; ok || !match { + continue + } + + if inst.Aggregation == nil { + inst.Aggregation = rdr.aggregation(inst.Kind) + } else if _, ok := inst.Aggregation.(aggregation.Default); ok { + inst.Aggregation = rdr.aggregation(inst.Kind) + } + + if err := isAggregatorCompatible(inst.Kind, inst.Aggregation); err != nil { + err = fmt.Errorf("creating aggregator with instrumentKind: %d, aggregation %v: %w", inst.Kind, inst.Aggregation, err) + errs.append(err) + continue + } + + agg := createAggregator[N](inst.Aggregation, rdr.temporality(inst.Kind), isMonotonic(inst.Kind)) + if agg != nil { + // TODO (#3011): If filtering is done at the instrument level add here. + // This is where the aggregator and the view are both in scope. + aggs[ident] = agg + } + } + return aggs, errs.errorOrNil() +} + +func isMonotonic(kind view.InstrumentKind) bool { + switch kind { + case view.AsyncCounter, view.SyncCounter, view.SyncHistogram: + return true + } + return false +} + +// createAggregator takes the config (Aggregation and Temporality) and produces a memory backed Aggregator. +// TODO (#3011): If filterting is done by the Aggregator it should be passed here. +func createAggregator[N int64 | float64](agg aggregation.Aggregation, temporality metricdata.Temporality, monotonic bool) internal.Aggregator[N] { + switch agg := agg.(type) { + case aggregation.Drop: + return nil + case aggregation.LastValue: + return internal.NewLastValue[N]() + case aggregation.Sum: + if temporality == metricdata.CumulativeTemporality { + return internal.NewCumulativeSum[N](monotonic) + } + return internal.NewDeltaSum[N](monotonic) + case aggregation.ExplicitBucketHistogram: + if temporality == metricdata.CumulativeTemporality { + return internal.NewCumulativeHistogram[N](agg) + } + return internal.NewDeltaHistogram[N](agg) + } + return nil +} + +// TODO: review need for aggregation check after https://github.com/open-telemetry/opentelemetry-specification/issues/2710 +var errIncompatibleAggregation = errors.New("incompatible aggregation") +var errUnknownAggregation = errors.New("unrecognized aggregation") + +// is aggregatorCompatible checks if the aggregation can be used by the instrument. +// Current compatibility: +// +// | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | +// |----------------------|------|-----------|-----|-----------|-----------------------| +// | Sync Counter | X | | X | X | X | +// | Sync UpDown Counter | X | | X | | | +// | Sync Histogram | X | | X | X | X | +// | Async Counter | X | | X | | | +// | Async UpDown Counter | X | | X | | | +// | Async Gauge | X | X | | | |. +func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregation) error { + switch agg.(type) { + case aggregation.ExplicitBucketHistogram: + if kind == view.SyncCounter || kind == view.SyncHistogram { + return nil + } + return errIncompatibleAggregation + case aggregation.Sum: + switch kind { + case view.AsyncCounter, view.AsyncUpDownCounter, view.SyncCounter, view.SyncHistogram, view.SyncUpDownCounter: + return nil + default: + return errIncompatibleAggregation + } + case aggregation.LastValue: + if kind == view.AsyncGauge { + return nil + } + return errIncompatibleAggregation + case aggregation.Drop: + return nil + default: + // This is used passed checking for default, it should be an error at this point. + return fmt.Errorf("%w: %v", errUnknownAggregation, agg) + } +} diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go new file mode 100644 index 00000000000..d4e47f35eb5 --- /dev/null +++ b/sdk/metric/pipeline_registry_test.go @@ -0,0 +1,587 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +type invalidAggregation struct { + aggregation.Aggregation +} + +func (invalidAggregation) Copy() aggregation.Aggregation { + return invalidAggregation{} +} +func (invalidAggregation) Err() error { + return nil +} + +func testCreateAggregators[N int64 | float64](t *testing.T) { + changeAggView, _ := view.New( + view.MatchInstrumentName("foo"), + view.WithSetAggregation(aggregation.ExplicitBucketHistogram{}), + ) + renameView, _ := view.New( + view.MatchInstrumentName("foo"), + view.WithRename("bar"), + ) + defaultAggView, _ := view.New( + view.MatchInstrumentName("foo"), + view.WithSetAggregation(aggregation.Default{}), + ) + invalidAggView, _ := view.New( + view.MatchInstrumentName("foo"), + view.WithSetAggregation(invalidAggregation{}), + ) + + instruments := []view.Instrument{ + {Name: "foo", Kind: view.InstrumentKind(0)}, //Unknown kind + {Name: "foo", Kind: view.SyncCounter}, + {Name: "foo", Kind: view.SyncUpDownCounter}, + {Name: "foo", Kind: view.SyncHistogram}, + {Name: "foo", Kind: view.AsyncCounter}, + {Name: "foo", Kind: view.AsyncUpDownCounter}, + {Name: "foo", Kind: view.AsyncGauge}, + } + + testcases := []struct { + name string + reader Reader + views []view.View + inst view.Instrument + wantKind internal.Aggregator[N] //Aggregators should match len and types + wantLen int + wantErr error + }{ + { + name: "drop should return 0 aggregators", + reader: NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), + views: []view.View{{}}, + inst: instruments[view.SyncCounter], + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.SyncUpDownCounter], + wantKind: internal.NewDeltaSum[N](false), + wantLen: 1, + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.SyncHistogram], + wantKind: internal.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantLen: 1, + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.AsyncCounter], + wantKind: internal.NewDeltaSum[N](true), + wantLen: 1, + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.AsyncUpDownCounter], + wantKind: internal.NewDeltaSum[N](false), + wantLen: 1, + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.AsyncGauge], + wantKind: internal.NewLastValue[N](), + wantLen: 1, + }, + { + name: "default agg should use reader", + reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), + views: []view.View{defaultAggView}, + inst: instruments[view.SyncCounter], + wantKind: internal.NewDeltaSum[N](true), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.SyncUpDownCounter], + wantKind: internal.NewCumulativeSum[N](false), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.SyncHistogram], + wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.AsyncCounter], + wantKind: internal.NewCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.AsyncUpDownCounter], + wantKind: internal.NewCumulativeSum[N](false), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.AsyncGauge], + wantKind: internal.NewLastValue[N](), + wantLen: 1, + }, + { + name: "reader should set default agg", + reader: NewManualReader(), + views: []view.View{{}}, + inst: instruments[view.SyncCounter], + wantKind: internal.NewCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "view should overwrite reader", + reader: NewManualReader(), + views: []view.View{changeAggView}, + inst: instruments[view.SyncCounter], + wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantLen: 1, + }, + { + name: "multiple views should create multiple aggregators", + reader: NewManualReader(), + views: []view.View{{}, renameView}, + inst: instruments[view.SyncCounter], + wantKind: internal.NewCumulativeSum[N](true), + wantLen: 2, + }, + { + name: "reader with invalid aggregation should error", + reader: NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []view.View{{}}, + inst: instruments[view.SyncCounter], + wantErr: errCreatingAggregators, + }, + { + name: "view with invalid aggregation should error", + reader: NewManualReader(), + views: []view.View{invalidAggView}, + inst: instruments[view.SyncCounter], + wantErr: errCreatingAggregators, + }, + } + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + got, err := createAggregatorsForReader[N](tt.reader, tt.views, tt.inst) + assert.ErrorIs(t, err, tt.wantErr) + require.Len(t, got, tt.wantLen) + for _, agg := range got { + assert.IsType(t, tt.wantKind, agg) + } + }) + } +} + +func testInvalidInstrumentShouldPanic[N int64 | float64]() { + reader := NewManualReader() + views := []view.View{{}} + inst := view.Instrument{ + Name: "foo", + Kind: view.InstrumentKind(255), + } + _, _ = createAggregatorsForReader[N](reader, views, inst) +} + +func TestInvalidInstrumentShouldPanic(t *testing.T) { + assert.Panics(t, testInvalidInstrumentShouldPanic[int64]) + assert.Panics(t, testInvalidInstrumentShouldPanic[float64]) +} + +func TestCreateAggregators(t *testing.T) { + t.Run("Int64", testCreateAggregators[int64]) + t.Run("Float64", testCreateAggregators[float64]) +} + +func TestPipelineRegistryCreateAggregators(t *testing.T) { + renameView, _ := view.New( + view.MatchInstrumentName("foo"), + view.WithRename("bar"), + ) + testRdr := NewManualReader() + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + + testCases := []struct { + name string + views map[Reader][]view.View + inst view.Instrument + wantCount int + }{ + { + name: "No views have no aggregators", + inst: view.Instrument{Name: "foo"}, + }, + { + name: "1 reader 1 view gets 1 aggregator", + inst: view.Instrument{Name: "foo"}, + views: map[Reader][]view.View{ + testRdr: { + {}, + }, + }, + wantCount: 1, + }, + { + name: "1 reader 2 views gets 2 aggregator", + inst: view.Instrument{Name: "foo"}, + views: map[Reader][]view.View{ + testRdr: { + {}, + renameView, + }, + }, + wantCount: 2, + }, + { + name: "2 readers 1 view each gets 2 aggregators", + inst: view.Instrument{Name: "foo"}, + views: map[Reader][]view.View{ + testRdr: { + {}, + }, + testRdrHistogram: { + {}, + }, + }, + wantCount: 2, + }, + { + name: "2 reader 2 views each gets 4 aggregators", + inst: view.Instrument{Name: "foo"}, + views: map[Reader][]view.View{ + testRdr: { + {}, + renameView, + }, + testRdrHistogram: { + {}, + renameView, + }, + }, + wantCount: 4, + }, + { + name: "An instrument is duplicated in two views share the same aggregator", + inst: view.Instrument{Name: "foo"}, + views: map[Reader][]view.View{ + testRdr: { + {}, + {}, + }, + }, + wantCount: 1, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + reg := newPipelineRegistries(tt.views) + testPipelineRegistryCreateIntAggregators(t, reg, tt.wantCount) + reg = newPipelineRegistries(tt.views) + testPipelineRegistryCreateFloatAggregators(t, reg, tt.wantCount) + }) + } +} + +func testPipelineRegistryCreateIntAggregators(t *testing.T, reg *pipelineRegistry, wantCount int) { + inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} + + aggs, err := createAggregators[int64](reg, inst, unit.Dimensionless) + assert.NoError(t, err) + + require.Len(t, aggs, wantCount) +} + +func testPipelineRegistryCreateFloatAggregators(t *testing.T, reg *pipelineRegistry, wantCount int) { + inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} + + aggs, err := createAggregators[float64](reg, inst, unit.Dimensionless) + assert.NoError(t, err) + + require.Len(t, aggs, wantCount) +} + +func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + + views := map[Reader][]view.View{ + testRdrHistogram: { + {}, + }, + } + reg := newPipelineRegistries(views) + inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} + + intAggs, err := createAggregators[int64](reg, inst, unit.Dimensionless) + assert.Error(t, err) + assert.Len(t, intAggs, 0) + + reg = newPipelineRegistries(views) + + floatAggs, err := createAggregators[float64](reg, inst, unit.Dimensionless) + assert.Error(t, err) + assert.Len(t, floatAggs, 0) +} + +func TestPipelineRegistryCreateAggregatorsDuplicateErrors(t *testing.T) { + renameView, _ := view.New( + view.MatchInstrumentName("bar"), + view.WithRename("foo"), + ) + views := map[Reader][]view.View{ + NewManualReader(): { + {}, + renameView, + }, + } + + fooInst := view.Instrument{Name: "foo", Kind: view.SyncCounter} + barInst := view.Instrument{Name: "bar", Kind: view.SyncCounter} + + reg := newPipelineRegistries(views) + + intAggs, err := createAggregators[int64](reg, fooInst, unit.Dimensionless) + assert.NoError(t, err) + assert.Len(t, intAggs, 1) + + // The Rename view should error, because it creates a foo instrument. + intAggs, err = createAggregators[int64](reg, barInst, unit.Dimensionless) + assert.Error(t, err) + assert.Len(t, intAggs, 2) + + // Creating a float foo instrument should error because there is an int foo instrument. + floatAggs, err := createAggregators[float64](reg, fooInst, unit.Dimensionless) + assert.Error(t, err) + assert.Len(t, floatAggs, 1) + + fooInst = view.Instrument{Name: "foo-float", Kind: view.SyncCounter} + + _, err = createAggregators[float64](reg, fooInst, unit.Dimensionless) + assert.NoError(t, err) + + floatAggs, err = createAggregators[float64](reg, barInst, unit.Dimensionless) + assert.Error(t, err) + assert.Len(t, floatAggs, 2) +} + +func TestIsAggregatorCompatible(t *testing.T) { + var undefinedInstrument view.InstrumentKind + + testCases := []struct { + name string + kind view.InstrumentKind + agg aggregation.Aggregation + want error + }{ + { + name: "SyncCounter and Drop", + kind: view.SyncCounter, + agg: aggregation.Drop{}, + }, + { + name: "SyncCounter and LastValue", + kind: view.SyncCounter, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "SyncCounter and Sum", + kind: view.SyncCounter, + agg: aggregation.Sum{}, + }, + { + name: "SyncCounter and ExplicitBucketHistogram", + kind: view.SyncCounter, + agg: aggregation.ExplicitBucketHistogram{}, + }, + { + name: "SyncUpDownCounter and Drop", + kind: view.SyncUpDownCounter, + agg: aggregation.Drop{}, + }, + { + name: "SyncUpDownCounter and LastValue", + kind: view.SyncUpDownCounter, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "SyncUpDownCounter and Sum", + kind: view.SyncUpDownCounter, + agg: aggregation.Sum{}, + }, + { + name: "SyncUpDownCounter and ExplicitBucketHistogram", + kind: view.SyncUpDownCounter, + agg: aggregation.ExplicitBucketHistogram{}, + want: errIncompatibleAggregation, + }, + { + name: "SyncHistogram and Drop", + kind: view.SyncHistogram, + agg: aggregation.Drop{}, + }, + { + name: "SyncHistogram and LastValue", + kind: view.SyncHistogram, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "SyncHistogram and Sum", + kind: view.SyncHistogram, + agg: aggregation.Sum{}, + }, + { + name: "SyncHistogram and ExplicitBucketHistogram", + kind: view.SyncHistogram, + agg: aggregation.ExplicitBucketHistogram{}, + }, + { + name: "AsyncCounter and Drop", + kind: view.AsyncCounter, + agg: aggregation.Drop{}, + }, + { + name: "AsyncCounter and LastValue", + kind: view.AsyncCounter, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "AsyncCounter and Sum", + kind: view.AsyncCounter, + agg: aggregation.Sum{}, + }, + { + name: "AsyncCounter and ExplicitBucketHistogram", + kind: view.AsyncCounter, + agg: aggregation.ExplicitBucketHistogram{}, + want: errIncompatibleAggregation, + }, + { + name: "AsyncUpDownCounter and Drop", + kind: view.AsyncUpDownCounter, + agg: aggregation.Drop{}, + }, + { + name: "AsyncUpDownCounter and LastValue", + kind: view.AsyncUpDownCounter, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "AsyncUpDownCounter and Sum", + kind: view.AsyncUpDownCounter, + agg: aggregation.Sum{}, + }, + { + name: "AsyncUpDownCounter and ExplicitBucketHistogram", + kind: view.AsyncUpDownCounter, + agg: aggregation.ExplicitBucketHistogram{}, + want: errIncompatibleAggregation, + }, + { + name: "AsyncGauge and Drop", + kind: view.AsyncGauge, + agg: aggregation.Drop{}, + }, + { + name: "AsyncGauge and aggregation.LastValue{}", + kind: view.AsyncGauge, + agg: aggregation.LastValue{}, + }, + { + name: "AsyncGauge and Sum", + kind: view.AsyncGauge, + agg: aggregation.Sum{}, + want: errIncompatibleAggregation, + }, + { + name: "AsyncGauge and ExplicitBucketHistogram", + kind: view.AsyncGauge, + agg: aggregation.ExplicitBucketHistogram{}, + want: errIncompatibleAggregation, + }, + { + name: "Default aggregation should error", + kind: view.SyncCounter, + agg: aggregation.Default{}, + want: errUnknownAggregation, + }, + { + name: "unknown kind with Sum should error", + kind: undefinedInstrument, + agg: aggregation.Sum{}, + want: errIncompatibleAggregation, + }, + { + name: "unknown kind with LastValue should error", + kind: undefinedInstrument, + agg: aggregation.LastValue{}, + want: errIncompatibleAggregation, + }, + { + name: "unknown kind with Histogram should error", + kind: undefinedInstrument, + agg: aggregation.ExplicitBucketHistogram{}, + want: errIncompatibleAggregation, + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + err := isAggregatorCompatible(tt.kind, tt.agg) + assert.ErrorIs(t, err, tt.want) + }) + } +} diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go new file mode 100644 index 00000000000..91134fec517 --- /dev/null +++ b/sdk/metric/pipeline_test.go @@ -0,0 +1,216 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "sync" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/resource" +) + +type testSumAggregator struct{} + +func (testSumAggregator) Aggregation() metricdata.Aggregation { + return metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + DataPoints: []metricdata.DataPoint[int64]{}} +} + +func TestEmptyPipeline(t *testing.T) { + pipe := &pipeline{} + + output, err := pipe.produce(context.Background()) + require.NoError(t, err) + assert.Nil(t, output.Resource) + assert.Len(t, output.ScopeMetrics, 0) + + err = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) + assert.NoError(t, err) + + require.NotPanics(t, func() { + pipe.addCallback(func(ctx context.Context) {}) + }) + + output, err = pipe.produce(context.Background()) + require.NoError(t, err) + assert.Nil(t, output.Resource) + require.Len(t, output.ScopeMetrics, 1) + require.Len(t, output.ScopeMetrics[0].Metrics, 1) +} + +func TestNewPipeline(t *testing.T) { + pipe := newPipeline(nil) + + output, err := pipe.produce(context.Background()) + require.NoError(t, err) + assert.Equal(t, resource.Empty(), output.Resource) + assert.Len(t, output.ScopeMetrics, 0) + + err = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) + assert.NoError(t, err) + + require.NotPanics(t, func() { + pipe.addCallback(func(ctx context.Context) {}) + }) + + output, err = pipe.produce(context.Background()) + require.NoError(t, err) + assert.Equal(t, resource.Empty(), output.Resource) + require.Len(t, output.ScopeMetrics, 1) + require.Len(t, output.ScopeMetrics[0].Metrics, 1) +} + +func TestPipelineDuplicateRegistration(t *testing.T) { + type instrumentID struct { + scope instrumentation.Scope + name string + description string + unit unit.Unit + } + testCases := []struct { + name string + secondInst instrumentID + want error + wantScopeLen int + wantMetricsLen int + }{ + { + name: "exact should error", + secondInst: instrumentID{ + scope: instrumentation.Scope{}, + name: "name", + description: "desc", + unit: unit.Dimensionless, + }, + want: errAlreadyRegistered, + wantScopeLen: 1, + wantMetricsLen: 1, + }, + { + name: "description should not be identifying", + secondInst: instrumentID{ + scope: instrumentation.Scope{}, + name: "name", + description: "other desc", + unit: unit.Dimensionless, + }, + want: errAlreadyRegistered, + wantScopeLen: 1, + wantMetricsLen: 1, + }, + { + name: "scope should be identifying", + secondInst: instrumentID{ + scope: instrumentation.Scope{ + Name: "newScope", + }, + name: "name", + description: "desc", + unit: unit.Dimensionless, + }, + wantScopeLen: 2, + wantMetricsLen: 1, + }, + { + name: "name should be identifying", + secondInst: instrumentID{ + scope: instrumentation.Scope{}, + name: "newName", + description: "desc", + unit: unit.Dimensionless, + }, + wantScopeLen: 1, + wantMetricsLen: 2, + }, + { + name: "unit should be identifying", + secondInst: instrumentID{ + scope: instrumentation.Scope{}, + name: "name", + description: "desc", + unit: unit.Bytes, + }, + wantScopeLen: 1, + wantMetricsLen: 2, + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + pipe := newPipeline(nil) + err := pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) + require.NoError(t, err) + + err = pipe.addAggregator(tt.secondInst.scope, tt.secondInst.name, tt.secondInst.description, tt.secondInst.unit, testSumAggregator{}) + assert.ErrorIs(t, err, tt.want) + + if tt.wantScopeLen > 0 { + output, err := pipe.produce(context.Background()) + assert.NoError(t, err) + require.Len(t, output.ScopeMetrics, tt.wantScopeLen) + require.Len(t, output.ScopeMetrics[0].Metrics, tt.wantMetricsLen) + } + }) + } +} + +func TestPipelineUsesResource(t *testing.T) { + res := resource.NewWithAttributes("noSchema", attribute.String("test", "resource")) + pipe := newPipeline(res) + + output, err := pipe.produce(context.Background()) + assert.NoError(t, err) + assert.Equal(t, res, output.Resource) +} + +func TestPipelineConcurrency(t *testing.T) { + pipe := newPipeline(nil) + ctx := context.Background() + + var wg sync.WaitGroup + const threads = 2 + for i := 0; i < threads; i++ { + wg.Add(1) + go func() { + defer wg.Done() + _, _ = pipe.produce(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) + }() + + wg.Add(1) + go func() { + defer wg.Done() + pipe.addCallback(func(ctx context.Context) {}) + }() + } + wg.Wait() +} diff --git a/sdk/metric/processor/basic/basic.go b/sdk/metric/processor/basic/basic.go deleted file mode 100644 index 8ed07484bef..00000000000 --- a/sdk/metric/processor/basic/basic.go +++ /dev/null @@ -1,383 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic // import "go.opentelemetry.io/otel/sdk/metric/processor/basic" - -import ( - "errors" - "fmt" - "sync" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - // Processor is a basic metric processor. - Processor struct { - aggregation.TemporalitySelector - export.AggregatorSelector - - state - } - - stateKey struct { - // TODO: This code is organized to support multiple - // accumulators which could theoretically produce the - // data for the same instrument, and this code has - // logic to combine data properly from multiple - // accumulators. However, the use of - // *sdkapi.Descriptor in the stateKey makes such - // combination impossible, because each accumulator - // allocates its own instruments. This can be fixed - // by using the instrument name and kind instead of - // the descriptor pointer. See - // https://github.com/open-telemetry/opentelemetry-go/issues/862. - descriptor *sdkapi.Descriptor - distinct attribute.Distinct - } - - stateValue struct { - // attrs corresponds to the stateKey.distinct field. - attrs *attribute.Set - - // updated indicates the last sequence number when this value had - // Process() called by an accumulator. - updated int64 - - // stateful indicates that a cumulative aggregation is - // being maintained, taken from the process start time. - stateful bool - - // currentOwned indicates that "current" was allocated - // by the processor in order to merge results from - // multiple Accumulators during a single collection - // round, which may happen either because: - // (1) multiple Accumulators output the same Accumulation. - // (2) one Accumulator is configured with dimensionality reduction. - currentOwned bool - - // current refers to the output from a single Accumulator - // (if !currentOwned) or it refers to an Aggregator - // owned by the processor used to accumulate multiple - // values in a single collection round. - current aggregator.Aggregator - - // cumulative, if non-nil, refers to an Aggregator owned - // by the processor used to store the last cumulative - // value. - cumulative aggregator.Aggregator - } - - state struct { - config config - - // RWMutex implements locking for the `Reader` interface. - sync.RWMutex - values map[stateKey]*stateValue - - processStart time.Time - intervalStart time.Time - intervalEnd time.Time - - // startedCollection and finishedCollection are the - // number of StartCollection() and FinishCollection() - // calls, used to ensure that the sequence of starts - // and finishes are correctly balanced. - - startedCollection int64 - finishedCollection int64 - } -) - -var _ export.Processor = &Processor{} -var _ export.Checkpointer = &Processor{} -var _ export.Reader = &state{} - -// ErrInconsistentState is returned when the sequence of collection's starts and finishes are incorrectly balanced. -var ErrInconsistentState = fmt.Errorf("inconsistent processor state") - -// ErrInvalidTemporality is returned for unknown metric.Temporality. -var ErrInvalidTemporality = fmt.Errorf("invalid aggregation temporality") - -// New returns a basic Processor that is also a Checkpointer using the provided -// AggregatorSelector to select Aggregators. The TemporalitySelector -// is consulted to determine the kind(s) of exporter that will consume -// data, so that this Processor can prepare to compute Cumulative Aggregations -// as needed. -func New(aselector export.AggregatorSelector, tselector aggregation.TemporalitySelector, opts ...Option) *Processor { - return NewFactory(aselector, tselector, opts...).NewCheckpointer().(*Processor) -} - -type factory struct { - aselector export.AggregatorSelector - tselector aggregation.TemporalitySelector - config config -} - -// NewFactory returns a new basic CheckpointerFactory. -func NewFactory(aselector export.AggregatorSelector, tselector aggregation.TemporalitySelector, opts ...Option) export.CheckpointerFactory { - var config config - for _, opt := range opts { - config = opt.applyProcessor(config) - } - return factory{ - aselector: aselector, - tselector: tselector, - config: config, - } -} - -var _ export.CheckpointerFactory = factory{} - -func (f factory) NewCheckpointer() export.Checkpointer { - now := time.Now() - p := &Processor{ - AggregatorSelector: f.aselector, - TemporalitySelector: f.tselector, - state: state{ - values: map[stateKey]*stateValue{}, - processStart: now, - intervalStart: now, - config: f.config, - }, - } - return p -} - -// Process implements export.Processor. -func (b *Processor) Process(accum export.Accumulation) error { - if b.startedCollection != b.finishedCollection+1 { - return ErrInconsistentState - } - desc := accum.Descriptor() - key := stateKey{ - descriptor: desc, - distinct: accum.Attributes().Equivalent(), - } - agg := accum.Aggregator() - - // Check if there is an existing value. - value, ok := b.state.values[key] - if !ok { - stateful := b.TemporalityFor(desc, agg.Aggregation().Kind()).MemoryRequired(desc.InstrumentKind()) - - newValue := &stateValue{ - attrs: accum.Attributes(), - updated: b.state.finishedCollection, - stateful: stateful, - current: agg, - } - if stateful { - if desc.InstrumentKind().PrecomputedSum() { - // To convert precomputed sums to - // deltas requires two aggregators to - // be allocated, one for the prior - // value and one for the output delta. - // This functionality was removed from - // the basic processor in PR #2350. - return aggregation.ErrNoCumulativeToDelta - } - // In this case allocate one aggregator to - // save the current state. - b.AggregatorFor(desc, &newValue.cumulative) - } - b.state.values[key] = newValue - return nil - } - - // Advance the update sequence number. - sameCollection := b.state.finishedCollection == value.updated - value.updated = b.state.finishedCollection - - // At this point in the code, we have located an existing - // value for some stateKey. This can be because: - // - // (a) stateful aggregation is being used, the entry was - // entered during a prior collection, and this is the first - // time processing an accumulation for this stateKey in the - // current collection. Since this is the first time - // processing an accumulation for this stateKey during this - // collection, we don't know yet whether there are multiple - // accumulators at work. If there are multiple accumulators, - // they'll hit case (b) the second time through. - // - // (b) multiple accumulators are being used, whether stateful - // or not. - // - // Case (a) occurs when the instrument and the exporter - // require memory to work correctly, either because the - // instrument reports a PrecomputedSum to a DeltaExporter or - // the reverse, a non-PrecomputedSum instrument with a - // CumulativeExporter. This logic is encapsulated in - // Temporality.MemoryRequired(InstrumentKind). - // - // Case (b) occurs when the variable `sameCollection` is true, - // indicating that the stateKey for Accumulation has already - // been seen in the same collection. When this happens, it - // implies that multiple Accumulators are being used, or that - // a single Accumulator has been configured with a attribute key - // filter. - - if !sameCollection { - if !value.currentOwned { - // This is the first Accumulation we've seen - // for this stateKey during this collection. - // Just keep a reference to the Accumulator's - // Aggregator. All the other cases copy - // Aggregator state. - value.current = agg - return nil - } - return agg.SynchronizedMove(value.current, desc) - } - - // If the current is not owned, take ownership of a copy - // before merging below. - if !value.currentOwned { - tmp := value.current - b.AggregatorSelector.AggregatorFor(desc, &value.current) - value.currentOwned = true - if err := tmp.SynchronizedMove(value.current, desc); err != nil { - return err - } - } - - // Combine this Accumulation with the prior Accumulation. - return value.current.Merge(agg, desc) -} - -// Reader returns the associated Reader. Use the -// Reader Locker interface to synchronize access to this -// object. The Reader.ForEach() method cannot be called -// concurrently with Process(). -func (b *Processor) Reader() export.Reader { - return &b.state -} - -// StartCollection signals to the Processor one or more Accumulators -// will begin calling Process() calls during collection. -func (b *Processor) StartCollection() { - if b.startedCollection != 0 { - b.intervalStart = b.intervalEnd - } - b.startedCollection++ -} - -// FinishCollection signals to the Processor that a complete -// collection has finished and that ForEach will be called to access -// the Reader. -func (b *Processor) FinishCollection() error { - b.intervalEnd = time.Now() - if b.startedCollection != b.finishedCollection+1 { - return ErrInconsistentState - } - defer func() { b.finishedCollection++ }() - - for key, value := range b.values { - mkind := key.descriptor.InstrumentKind() - stale := value.updated != b.finishedCollection - stateless := !value.stateful - - // The following branch updates stateful aggregators. Skip - // these updates if the aggregator is not stateful or if the - // aggregator is stale. - if stale || stateless { - // If this processor does not require memeory, - // stale, stateless entries can be removed. - // This implies that they were not updated - // over the previous full collection interval. - if stale && stateless && !b.config.Memory { - delete(b.values, key) - } - continue - } - - // The only kind of aggregators that are not stateless - // are the ones needing delta to cumulative - // conversion. Merge aggregator state in this case. - if !mkind.PrecomputedSum() { - // This line is equivalent to: - // value.cumulative = value.cumulative + value.current - if err := value.cumulative.Merge(value.current, key.descriptor); err != nil { - return err - } - } - } - return nil -} - -// ForEach iterates through the Reader, passing an -// export.Record with the appropriate Cumulative or Delta aggregation -// to an exporter. -func (b *state) ForEach(exporter aggregation.TemporalitySelector, f func(export.Record) error) error { - if b.startedCollection != b.finishedCollection { - return ErrInconsistentState - } - for key, value := range b.values { - mkind := key.descriptor.InstrumentKind() - - var agg aggregation.Aggregation - var start time.Time - - aggTemp := exporter.TemporalityFor(key.descriptor, value.current.Aggregation().Kind()) - - switch aggTemp { - case aggregation.CumulativeTemporality: - // If stateful, the sum has been computed. If stateless, the - // input was already cumulative. Either way, use the checkpointed - // value: - if value.stateful { - agg = value.cumulative.Aggregation() - } else { - agg = value.current.Aggregation() - } - start = b.processStart - - case aggregation.DeltaTemporality: - // Precomputed sums are a special case. - if mkind.PrecomputedSum() { - // This functionality was removed from - // the basic processor in PR #2350. - return aggregation.ErrNoCumulativeToDelta - } - agg = value.current.Aggregation() - start = b.intervalStart - - default: - return fmt.Errorf("%v: %w", aggTemp, ErrInvalidTemporality) - } - - // If the processor does not have Config.Memory and it was not updated - // in the prior round, do not visit this value. - if !b.config.Memory && value.updated != (b.finishedCollection-1) { - continue - } - - if err := f(export.NewRecord( - key.descriptor, - value.attrs, - agg, - start, - b.intervalEnd, - )); err != nil && !errors.Is(err, aggregation.ErrNoData) { - return err - } - } - return nil -} diff --git a/sdk/metric/processor/basic/basic_test.go b/sdk/metric/processor/basic/basic_test.go deleted file mode 100644 index 21d816b44a0..00000000000 --- a/sdk/metric/processor/basic/basic_test.go +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic_test - -import ( - "context" - "errors" - "fmt" - "strings" - "testing" - "time" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/instrumentation" - sdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/aggregatortest" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -func requireNotAfter(t *testing.T, t1, t2 time.Time) { - require.False(t, t1.After(t2), "expected %v ≤ %v", t1, t2) -} - -// TestProcessor tests all the non-error paths in this package. -func TestProcessor(t *testing.T) { - type exportCase struct { - kind aggregation.Temporality - } - type instrumentCase struct { - kind sdkapi.InstrumentKind - } - type numberCase struct { - kind number.Kind - } - type aggregatorCase struct { - kind aggregation.Kind - } - - for _, tc := range []exportCase{ - {kind: aggregation.CumulativeTemporality}, - {kind: aggregation.DeltaTemporality}, - } { - t.Run(tc.kind.String(), func(t *testing.T) { - for _, ic := range []instrumentCase{ - {kind: sdkapi.CounterInstrumentKind}, - {kind: sdkapi.UpDownCounterInstrumentKind}, - {kind: sdkapi.HistogramInstrumentKind}, - {kind: sdkapi.CounterObserverInstrumentKind}, - {kind: sdkapi.UpDownCounterObserverInstrumentKind}, - {kind: sdkapi.GaugeObserverInstrumentKind}, - } { - t.Run(ic.kind.String(), func(t *testing.T) { - for _, nc := range []numberCase{ - {kind: number.Int64Kind}, - {kind: number.Float64Kind}, - } { - t.Run(nc.kind.String(), func(t *testing.T) { - for _, ac := range []aggregatorCase{ - {kind: aggregation.SumKind}, - {kind: aggregation.HistogramKind}, - {kind: aggregation.LastValueKind}, - } { - t.Run(ac.kind.String(), func(t *testing.T) { - testProcessor( - t, - tc.kind, - ic.kind, - nc.kind, - ac.kind, - ) - }) - } - }) - } - }) - } - }) - } -} - -func asNumber(nkind number.Kind, value int64) number.Number { - if nkind == number.Int64Kind { - return number.NewInt64Number(value) - } - return number.NewFloat64Number(float64(value)) -} - -func updateFor(t *testing.T, desc *sdkapi.Descriptor, selector export.AggregatorSelector, value int64, labs ...attribute.KeyValue) export.Accumulation { - ls := attribute.NewSet(labs...) - var agg aggregator.Aggregator - selector.AggregatorFor(desc, &agg) - require.NoError(t, agg.Update(context.Background(), asNumber(desc.NumberKind(), value), desc)) - - return export.NewAccumulation(desc, &ls, agg) -} - -func testProcessor( - t *testing.T, - aggTemp aggregation.Temporality, - mkind sdkapi.InstrumentKind, - nkind number.Kind, - akind aggregation.Kind, -) { - // This code tests for errors when the export kind is Delta - // and the instrument kind is PrecomputedSum(). - expectConversion := !(aggTemp == aggregation.DeltaTemporality && mkind.PrecomputedSum()) - requireConversion := func(t *testing.T, err error) { - if expectConversion { - require.NoError(t, err) - } else { - require.Equal(t, aggregation.ErrNoCumulativeToDelta, err) - } - } - - // Note: this selector uses the instrument name to dictate - // aggregation kind. - selector := processortest.AggregatorSelector() - - labs1 := []attribute.KeyValue{attribute.String("L1", "V")} - labs2 := []attribute.KeyValue{attribute.String("L2", "V")} - - testBody := func(t *testing.T, hasMemory bool, nAccum, nCheckpoint int) { - processor := basic.New(selector, aggregation.ConstantTemporalitySelector(aggTemp), basic.WithMemory(hasMemory)) - - instSuffix := fmt.Sprint(".", strings.ToLower(akind.String())) - - desc1 := metrictest.NewDescriptor(fmt.Sprint("inst1", instSuffix), mkind, nkind) - desc2 := metrictest.NewDescriptor(fmt.Sprint("inst2", instSuffix), mkind, nkind) - - for nc := 0; nc < nCheckpoint; nc++ { - // The input is 10 per update, scaled by - // the number of checkpoints for - // cumulative instruments: - input := int64(10) - cumulativeMultiplier := int64(nc + 1) - if mkind.PrecomputedSum() { - input *= cumulativeMultiplier - } - - processor.StartCollection() - - for na := 0; na < nAccum; na++ { - requireConversion(t, processor.Process(updateFor(t, &desc1, selector, input, labs1...))) - requireConversion(t, processor.Process(updateFor(t, &desc2, selector, input, labs2...))) - } - - // Note: in case of !expectConversion, we still get no error here - // because the Process() skipped entering state for those records. - require.NoError(t, processor.FinishCollection()) - - if nc < nCheckpoint-1 { - continue - } - - reader := processor.Reader() - - for _, repetitionAfterEmptyInterval := range []bool{false, true} { - if repetitionAfterEmptyInterval { - // We're repeating the test after another - // interval with no updates. - processor.StartCollection() - require.NoError(t, processor.FinishCollection()) - } - - // Test the final checkpoint state. - records1 := processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, reader.ForEach(aggregation.ConstantTemporalitySelector(aggTemp), records1.AddRecord)) - - if !expectConversion { - require.EqualValues(t, map[string]float64{}, records1.Map()) - continue - } - - var multiplier int64 - - if mkind.Asynchronous() { - // Asynchronous tests accumulate results multiply by the - // number of Accumulators, unless LastValue aggregation. - // If a precomputed sum, we expect cumulative inputs. - if mkind.PrecomputedSum() { - require.NotEqual(t, aggTemp, aggregation.DeltaTemporality) - if akind == aggregation.LastValueKind { - multiplier = cumulativeMultiplier - } else { - multiplier = cumulativeMultiplier * int64(nAccum) - } - } else { - if aggTemp == aggregation.CumulativeTemporality && akind != aggregation.LastValueKind { - multiplier = cumulativeMultiplier * int64(nAccum) - } else if akind == aggregation.LastValueKind { - multiplier = 1 - } else { - multiplier = int64(nAccum) - } - } - } else { - // Synchronous accumulate results from multiple accumulators, - // use that number as the baseline multiplier. - multiplier = int64(nAccum) - if aggTemp == aggregation.CumulativeTemporality { - // If a cumulative exporter, include prior checkpoints. - multiplier *= cumulativeMultiplier - } - if akind == aggregation.LastValueKind { - // If a last-value aggregator, set multiplier to 1.0. - multiplier = 1 - } - } - - exp := map[string]float64{} - if hasMemory || !repetitionAfterEmptyInterval { - exp = map[string]float64{ - fmt.Sprintf("inst1%s/L1=V/", instSuffix): float64(multiplier * 10), // attrs1 - fmt.Sprintf("inst2%s/L2=V/", instSuffix): float64(multiplier * 10), // attrs2 - } - } - - require.EqualValues(t, exp, records1.Map(), "with repetition=%v", repetitionAfterEmptyInterval) - } - } - } - - for _, hasMem := range []bool{false, true} { - t.Run(fmt.Sprintf("HasMemory=%v", hasMem), func(t *testing.T) { - // For 1 to 3 checkpoints: - for nAccum := 1; nAccum <= 3; nAccum++ { - t.Run(fmt.Sprintf("NumAccum=%d", nAccum), func(t *testing.T) { - // For 1 to 3 accumulators: - for nCheckpoint := 1; nCheckpoint <= 3; nCheckpoint++ { - t.Run(fmt.Sprintf("NumCkpt=%d", nCheckpoint), func(t *testing.T) { - testBody(t, hasMem, nAccum, nCheckpoint) - }) - } - }) - } - }) - } -} - -type bogusExporter struct{} - -func (bogusExporter) TemporalityFor(*sdkapi.Descriptor, aggregation.Kind) aggregation.Temporality { - return 100 -} - -func (bogusExporter) Export(context.Context, export.Reader) error { - panic("Not called") -} - -func TestBasicInconsistent(t *testing.T) { - // Test double-start - b := basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - - b.StartCollection() - b.StartCollection() - require.Equal(t, basic.ErrInconsistentState, b.FinishCollection()) - - // Test finish without start - b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - - require.Equal(t, basic.ErrInconsistentState, b.FinishCollection()) - - // Test no finish - b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - - b.StartCollection() - require.Equal( - t, - basic.ErrInconsistentState, - b.ForEach( - aggregation.StatelessTemporalitySelector(), - func(export.Record) error { return nil }, - ), - ) - - // Test no start - b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - - desc := metrictest.NewDescriptor("inst", sdkapi.CounterInstrumentKind, number.Int64Kind) - accum := export.NewAccumulation(&desc, attribute.EmptySet(), aggregatortest.NoopAggregator{}) - require.Equal(t, basic.ErrInconsistentState, b.Process(accum)) - - // Test invalid kind: - b = basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - b.StartCollection() - require.NoError(t, b.Process(accum)) - require.NoError(t, b.FinishCollection()) - - err := b.ForEach( - bogusExporter{}, - func(export.Record) error { return nil }, - ) - require.True(t, errors.Is(err, basic.ErrInvalidTemporality)) -} - -func TestBasicTimestamps(t *testing.T) { - beforeNew := time.Now() - time.Sleep(time.Nanosecond) - b := basic.New(processortest.AggregatorSelector(), aggregation.StatelessTemporalitySelector()) - time.Sleep(time.Nanosecond) - afterNew := time.Now() - - desc := metrictest.NewDescriptor("inst", sdkapi.CounterInstrumentKind, number.Int64Kind) - accum := export.NewAccumulation(&desc, attribute.EmptySet(), aggregatortest.NoopAggregator{}) - - b.StartCollection() - _ = b.Process(accum) - require.NoError(t, b.FinishCollection()) - - var start1, end1 time.Time - - require.NoError(t, b.ForEach(aggregation.StatelessTemporalitySelector(), func(rec export.Record) error { - start1 = rec.StartTime() - end1 = rec.EndTime() - return nil - })) - - // The first start time is set in the constructor. - requireNotAfter(t, beforeNew, start1) - requireNotAfter(t, start1, afterNew) - - for i := 0; i < 2; i++ { - b.StartCollection() - require.NoError(t, b.Process(accum)) - require.NoError(t, b.FinishCollection()) - - var start2, end2 time.Time - - require.NoError(t, b.ForEach(aggregation.StatelessTemporalitySelector(), func(rec export.Record) error { - start2 = rec.StartTime() - end2 = rec.EndTime() - return nil - })) - - // Subsequent intervals have their start and end aligned. - require.Equal(t, start2, end1) - requireNotAfter(t, start1, end1) - requireNotAfter(t, start2, end2) - - start1 = start2 - end1 = end2 - } -} - -func TestStatefulNoMemoryCumulative(t *testing.T) { - aggTempSel := aggregation.CumulativeTemporalitySelector() - - desc := metrictest.NewDescriptor("inst.sum", sdkapi.CounterInstrumentKind, number.Int64Kind) - selector := processortest.AggregatorSelector() - - processor := basic.New(selector, aggTempSel, basic.WithMemory(false)) - reader := processor.Reader() - - for i := 1; i < 3; i++ { - // Empty interval - processor.StartCollection() - require.NoError(t, processor.FinishCollection()) - - // Verify zero elements - records := processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) - require.EqualValues(t, map[string]float64{}, records.Map()) - - // Add 10 - processor.StartCollection() - _ = processor.Process(updateFor(t, &desc, selector, 10, attribute.String("A", "B"))) - require.NoError(t, processor.FinishCollection()) - - // Verify one element - records = processortest.NewOutput(attribute.DefaultEncoder()) - require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) - require.EqualValues(t, map[string]float64{ - "inst.sum/A=B/": float64(i * 10), - }, records.Map()) - } -} - -func TestMultiObserverSum(t *testing.T) { - for _, test := range []struct { - name string - aggregation.TemporalitySelector - expectProcessErr error - }{ - {"cumulative", aggregation.CumulativeTemporalitySelector(), nil}, - {"delta", aggregation.DeltaTemporalitySelector(), aggregation.ErrNoCumulativeToDelta}, - } { - t.Run(test.name, func(t *testing.T) { - aggTempSel := test.TemporalitySelector - desc := metrictest.NewDescriptor("observe.sum", sdkapi.CounterObserverInstrumentKind, number.Int64Kind) - selector := processortest.AggregatorSelector() - - processor := basic.New(selector, aggTempSel, basic.WithMemory(false)) - reader := processor.Reader() - - for i := 1; i < 3; i++ { - // Add i*10*3 times - processor.StartCollection() - require.True(t, errors.Is(processor.Process(updateFor(t, &desc, selector, int64(i*10), attribute.String("A", "B"))), test.expectProcessErr)) - require.True(t, errors.Is(processor.Process(updateFor(t, &desc, selector, int64(i*10), attribute.String("A", "B"))), test.expectProcessErr)) - require.True(t, errors.Is(processor.Process(updateFor(t, &desc, selector, int64(i*10), attribute.String("A", "B"))), test.expectProcessErr)) - require.NoError(t, processor.FinishCollection()) - - // Verify one element - records := processortest.NewOutput(attribute.DefaultEncoder()) - if test.expectProcessErr == nil { - require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) - require.EqualValues(t, map[string]float64{ - "observe.sum/A=B/": float64(3 * 10 * i), - }, records.Map()) - } else { - require.NoError(t, reader.ForEach(aggTempSel, records.AddRecord)) - require.EqualValues(t, map[string]float64{}, records.Map()) - } - } - }) - } -} - -func TestCounterObserverEndToEnd(t *testing.T) { - ctx := context.Background() - eselector := aggregation.CumulativeTemporalitySelector() - proc := basic.New( - processortest.AggregatorSelector(), - eselector, - ) - accum := sdk.NewAccumulator(proc) - meter := sdkapi.WrapMeterImpl(accum) - - var calls int64 - ctr, err := meter.AsyncInt64().Counter("observer.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { - calls++ - ctr.Observe(ctx, calls) - }) - require.NoError(t, err) - reader := proc.Reader() - - var startTime [3]time.Time - var endTime [3]time.Time - - for i := range startTime { - data := proc.Reader() - data.Lock() - proc.StartCollection() - accum.Collect(ctx) - require.NoError(t, proc.FinishCollection()) - - exporter := processortest.New(eselector, attribute.DefaultEncoder()) - require.NoError(t, exporter.Export(ctx, resource.Empty(), processortest.OneInstrumentationLibraryReader( - instrumentation.Library{ - Name: "test", - }, reader))) - - require.EqualValues(t, map[string]float64{ - "observer.sum//": float64(i + 1), - }, exporter.Values()) - - var record export.Record - require.NoError(t, data.ForEach(eselector, func(r export.Record) error { - record = r - return nil - })) - - // Try again, but ask for a Delta - require.Equal( - t, - aggregation.ErrNoCumulativeToDelta, - data.ForEach( - aggregation.ConstantTemporalitySelector(aggregation.DeltaTemporality), - func(r export.Record) error { - t.Fail() - return nil - }, - ), - ) - - startTime[i] = record.StartTime() - endTime[i] = record.EndTime() - data.Unlock() - } - - require.Equal(t, startTime[0], startTime[1]) - require.Equal(t, startTime[0], startTime[2]) - requireNotAfter(t, endTime[0], endTime[1]) - requireNotAfter(t, endTime[1], endTime[2]) -} diff --git a/sdk/metric/processor/basic/config.go b/sdk/metric/processor/basic/config.go deleted file mode 100644 index ca8127629dc..00000000000 --- a/sdk/metric/processor/basic/config.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package basic // import "go.opentelemetry.io/otel/sdk/metric/processor/basic" - -// config contains the options for configuring a basic metric processor. -type config struct { - // Memory controls whether the processor remembers metric instruments and - // attribute sets that were previously reported. When Memory is true, - // Reader.ForEach() will visit metrics that were not updated in the most - // recent interval. - Memory bool -} - -// Option configures a basic processor configuration. -type Option interface { - applyProcessor(config) config -} - -// WithMemory sets the memory behavior of a Processor. If this is true, the -// processor will report metric instruments and attribute sets that were -// previously reported but not updated in the most recent interval. -func WithMemory(memory bool) Option { - return memoryOption(memory) -} - -type memoryOption bool - -func (m memoryOption) applyProcessor(cfg config) config { - cfg.Memory = bool(m) - return cfg -} diff --git a/sdk/metric/processor/processortest/test.go b/sdk/metric/processor/processortest/test.go deleted file mode 100644 index ce9318c3532..00000000000 --- a/sdk/metric/processor/processortest/test.go +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package processortest // import "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - -import ( - "context" - "fmt" - "strings" - "sync" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -type ( - // mapKey is the unique key for a metric, consisting of its unique - // descriptor, distinct attributes, and distinct resource attributes. - mapKey struct { - desc *sdkapi.Descriptor - attrs attribute.Distinct - resource attribute.Distinct - } - - // mapValue is value stored in a processor used to produce a - // Reader. - mapValue struct { - attrs *attribute.Set - resource *resource.Resource - aggregator aggregator.Aggregator - } - - // Output implements export.Reader. - Output struct { - m map[mapKey]mapValue - attrEncoder attribute.Encoder - sync.RWMutex - } - - // testAggregatorSelector returns aggregators consistent with - // the test variables below, needed for testing stateful - // processors, which clone Aggregators using AggregatorFor(desc). - testAggregatorSelector struct{} - - // testCheckpointer is a export.Checkpointer. - testCheckpointer struct { - started int - finished int - *Processor - } - - // Processor is a testing implementation of export.Processor that - // assembles its results as a map[string]float64. - Processor struct { - export.AggregatorSelector - output *Output - } - - // Exporter is a testing implementation of export.Exporter that - // assembles its results as a map[string]float64. - Exporter struct { - aggregation.TemporalitySelector - output *Output - exportCount int - - // InjectErr supports returning conditional errors from - // the Export() routine. This must be set before the - // Exporter is first used. - InjectErr func(export.Record) error - } -) - -type testFactory struct { - selector export.AggregatorSelector - encoder attribute.Encoder -} - -// NewCheckpointerFactory returns a new CheckpointerFactory for the selector -// and encoder pair. -func NewCheckpointerFactory(selector export.AggregatorSelector, encoder attribute.Encoder) export.CheckpointerFactory { - return testFactory{ - selector: selector, - encoder: encoder, - } -} - -// NewCheckpointer returns a new Checkpointer for Processor p. -func NewCheckpointer(p *Processor) export.Checkpointer { - return &testCheckpointer{ - Processor: p, - } -} - -func (f testFactory) NewCheckpointer() export.Checkpointer { - return NewCheckpointer(NewProcessor(f.selector, f.encoder)) -} - -// NewProcessor returns a new testing Processor implementation. -// Verify expected outputs using Values(), e.g.: -// -// require.EqualValues(t, map[string]float64{ -// "counter.sum/A=1,B=2/R=V": 100, -// }, processor.Values()) -// -// Where in the example A=1,B=2 is the encoded attributes and R=V is the -// encoded resource value. -func NewProcessor(selector export.AggregatorSelector, encoder attribute.Encoder) *Processor { - return &Processor{ - AggregatorSelector: selector, - output: NewOutput(encoder), - } -} - -// Process implements export.Processor. -func (p *Processor) Process(accum export.Accumulation) error { - return p.output.AddAccumulation(accum) -} - -// Values returns the mapping from attribute set to point values for the -// accumulations that were processed. Point values are chosen as either the -// Sum or the LastValue, whichever is implemented. (All the built-in -// Aggregators implement one of these interfaces.) -func (p *Processor) Values() map[string]float64 { - return p.output.Map() -} - -// Reset clears the state of this test processor. -func (p *Processor) Reset() { - p.output.Reset() -} - -// StartCollection implements export.Checkpointer. -func (c *testCheckpointer) StartCollection() { - if c.started != c.finished { - panic(fmt.Sprintf("collection was already started: %d != %d", c.started, c.finished)) - } - - c.started++ -} - -// FinishCollection implements export.Checkpointer. -func (c *testCheckpointer) FinishCollection() error { - if c.started-1 != c.finished { - return fmt.Errorf("collection was not started: %d != %d", c.started, c.finished) - } - - c.finished++ - return nil -} - -// Reader implements export.Checkpointer. -func (c *testCheckpointer) Reader() export.Reader { - return c.Processor.output -} - -// AggregatorSelector returns a policy that is consistent with the -// test descriptors above. I.e., it returns sum.New() for counter -// instruments and lastvalue.New() for lastValue instruments. -func AggregatorSelector() export.AggregatorSelector { - return testAggregatorSelector{} -} - -// AggregatorFor implements export.AggregatorSelector. -func (testAggregatorSelector) AggregatorFor(desc *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { - switch { - case strings.HasSuffix(desc.Name(), ".disabled"): - for i := range aggPtrs { - *aggPtrs[i] = nil - } - case strings.HasSuffix(desc.Name(), ".sum"): - aggs := sum.New(len(aggPtrs)) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } - case strings.HasSuffix(desc.Name(), ".lastvalue"): - aggs := lastvalue.New(len(aggPtrs)) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } - case strings.HasSuffix(desc.Name(), ".histogram"): - aggs := histogram.New(len(aggPtrs), desc) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } - default: - panic(fmt.Sprint("Invalid instrument name for test AggregatorSelector: ", desc.Name())) - } -} - -// NewOutput is a helper for testing an expected set of Accumulations -// (from an Accumulator) or an expected set of Records (from a -// Processor). If testing with an Accumulator, it may be simpler to -// use the test Processor in this package. -func NewOutput(attrEncoder attribute.Encoder) *Output { - return &Output{ - m: make(map[mapKey]mapValue), - attrEncoder: attrEncoder, - } -} - -// ForEach implements export.Reader. -func (o *Output) ForEach(_ aggregation.TemporalitySelector, ff func(export.Record) error) error { - for key, value := range o.m { - if err := ff(export.NewRecord( - key.desc, - value.attrs, - value.aggregator.Aggregation(), - time.Time{}, - time.Time{}, - )); err != nil { - return err - } - } - return nil -} - -// AddRecord adds a string representation of the exported metric data -// to a map for use in testing. The value taken from the record is -// either the Sum() or the LastValue() of its Aggregation(), whichever -// is defined. Record timestamps are ignored. -func (o *Output) AddRecord(rec export.Record) error { - return o.AddRecordWithResource(rec, resource.Empty()) -} - -// AddRecordWithResource merges rec into this Output. -func (o *Output) AddInstrumentationLibraryRecord(_ instrumentation.Library, rec export.Record) error { - return o.AddRecordWithResource(rec, resource.Empty()) -} - -// AddRecordWithResource merges rec into this Output scoping it with res. -func (o *Output) AddRecordWithResource(rec export.Record, res *resource.Resource) error { - key := mapKey{ - desc: rec.Descriptor(), - attrs: rec.Attributes().Equivalent(), - resource: res.Equivalent(), - } - if _, ok := o.m[key]; !ok { - var agg aggregator.Aggregator - testAggregatorSelector{}.AggregatorFor(rec.Descriptor(), &agg) - o.m[key] = mapValue{ - aggregator: agg, - attrs: rec.Attributes(), - resource: res, - } - } - return o.m[key].aggregator.Merge(rec.Aggregation().(aggregator.Aggregator), rec.Descriptor()) -} - -// Map returns the calculated values for test validation from a set of -// Accumulations or a set of Records. When mapping records or -// accumulations into floating point values, the Sum() or LastValue() -// is chosen, whichever is implemented by the underlying Aggregator. -func (o *Output) Map() map[string]float64 { - r := make(map[string]float64) - err := o.ForEach(aggregation.StatelessTemporalitySelector(), func(record export.Record) error { - for key, entry := range o.m { - encoded := entry.attrs.Encoded(o.attrEncoder) - rencoded := entry.resource.Encoded(o.attrEncoder) - value := 0.0 - if s, ok := entry.aggregator.(aggregation.Sum); ok { - sum, _ := s.Sum() - value = sum.CoerceToFloat64(key.desc.NumberKind()) - } else if l, ok := entry.aggregator.(aggregation.LastValue); ok { - last, _, _ := l.LastValue() - value = last.CoerceToFloat64(key.desc.NumberKind()) - } else { - panic(fmt.Sprintf("Unhandled aggregator type: %T", entry.aggregator)) - } - name := fmt.Sprint(key.desc.Name(), "/", encoded, "/", rencoded) - r[name] = value - } - return nil - }) - if err != nil { - panic(fmt.Sprint("Unexpected processor error: ", err)) - } - return r -} - -// Reset restores the Output to its initial state, with no accumulated -// metric data. -func (o *Output) Reset() { - o.m = map[mapKey]mapValue{} -} - -// AddAccumulation adds a string representation of the exported metric -// data to a map for use in testing. The value taken from the -// accumulation is either the Sum() or the LastValue() of its -// Aggregator().Aggregation(), whichever is defined. -func (o *Output) AddAccumulation(acc export.Accumulation) error { - return o.AddRecord( - export.NewRecord( - acc.Descriptor(), - acc.Attributes(), - acc.Aggregator().Aggregation(), - time.Time{}, - time.Time{}, - ), - ) -} - -// New returns a new testing Exporter implementation. -// Verify exporter outputs using Values(), e.g.,: -// -// require.EqualValues(t, map[string]float64{ -// "counter.sum/A=1,B=2/R=V": 100, -// }, exporter.Values()) -// -// Where in the example A=1,B=2 is the encoded attributes and R=V is the -// encoded resource value. -func New(selector aggregation.TemporalitySelector, encoder attribute.Encoder) *Exporter { - return &Exporter{ - TemporalitySelector: selector, - output: NewOutput(encoder), - } -} - -// Export records all the measurements aggregated in ckpt for res. -func (e *Exporter) Export(_ context.Context, res *resource.Resource, ckpt export.InstrumentationLibraryReader) error { - e.output.Lock() - defer e.output.Unlock() - e.exportCount++ - return ckpt.ForEach(func(library instrumentation.Library, mr export.Reader) error { - return mr.ForEach(e.TemporalitySelector, func(r export.Record) error { - if e.InjectErr != nil { - if err := e.InjectErr(r); err != nil { - return err - } - } - return e.output.AddRecordWithResource(r, res) - }) - }) -} - -// Values returns the mapping from attribute set to point values for the -// accumulations that were processed. Point values are chosen as either the -// Sum or the LastValue, whichever is implemented. (All the built-in -// Aggregators implement one of these interfaces.) -func (e *Exporter) Values() map[string]float64 { - e.output.Lock() - defer e.output.Unlock() - return e.output.Map() -} - -// ExportCount returns the number of times Export() has been called -// since the last Reset(). -func (e *Exporter) ExportCount() int { - e.output.Lock() - defer e.output.Unlock() - return e.exportCount -} - -// Reset sets the exporter's output to the initial, empty state and -// resets the export count to zero. -func (e *Exporter) Reset() { - e.output.Lock() - defer e.output.Unlock() - e.output.Reset() - e.exportCount = 0 -} - -// OneInstrumentationLibraryReader returns an InstrumentationLibraryReader for -// a single instrumentation library. -func OneInstrumentationLibraryReader(l instrumentation.Library, r export.Reader) export.InstrumentationLibraryReader { - return oneLibraryReader{l, r} -} - -type oneLibraryReader struct { - library instrumentation.Library - reader export.Reader -} - -func (o oneLibraryReader) ForEach(readerFunc func(instrumentation.Library, export.Reader) error) error { - return readerFunc(o.library, o.reader) -} - -// MultiInstrumentationLibraryReader returns an InstrumentationLibraryReader -// for a group of records that came from multiple instrumentation libraries. -func MultiInstrumentationLibraryReader(records map[instrumentation.Library][]export.Record) export.InstrumentationLibraryReader { - return instrumentationLibraryReader{records: records} -} - -type instrumentationLibraryReader struct { - records map[instrumentation.Library][]export.Record -} - -var _ export.InstrumentationLibraryReader = instrumentationLibraryReader{} - -func (m instrumentationLibraryReader) ForEach(fn func(instrumentation.Library, export.Reader) error) error { - for library, records := range m.records { - if err := fn(library, &metricReader{records: records}); err != nil { - return err - } - } - return nil -} - -type metricReader struct { - sync.RWMutex - records []export.Record -} - -var _ export.Reader = &metricReader{} - -func (m *metricReader) ForEach(_ aggregation.TemporalitySelector, fn func(export.Record) error) error { - for _, record := range m.records { - if err := fn(record); err != nil && err != aggregation.ErrNoData { - return err - } - } - return nil -} diff --git a/sdk/metric/processor/processortest/test_test.go b/sdk/metric/processor/processortest/test_test.go deleted file mode 100644 index 98c15f2f763..00000000000 --- a/sdk/metric/processor/processortest/test_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package processortest_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/instrumentation" - metricsdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -func generateTestData(t *testing.T, proc export.Processor) { - ctx := context.Background() - accum := metricsdk.NewAccumulator(proc) - meter := sdkapi.WrapMeterImpl(accum) - - counter, err := meter.SyncFloat64().Counter("counter.sum") - require.NoError(t, err) - - counter.Add(ctx, 100, attribute.String("K1", "V1")) - counter.Add(ctx, 101, attribute.String("K1", "V2")) - - counterObserver, err := meter.AsyncInt64().Counter("observer.sum") - require.NoError(t, err) - - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - counterObserver.Observe(ctx, 10, attribute.String("K1", "V1")) - counterObserver.Observe(ctx, 11, attribute.String("K1", "V2")) - }) - require.NoError(t, err) - - accum.Collect(ctx) -} - -func TestProcessorTesting(t *testing.T) { - // Test the Processor test helper using a real Accumulator to - // generate Accumulations. - checkpointer := processortest.NewCheckpointer( - processortest.NewProcessor( - processortest.AggregatorSelector(), - attribute.DefaultEncoder(), - ), - ) - generateTestData(t, checkpointer) - - res := resource.NewSchemaless(attribute.String("R", "V")) - expect := map[string]float64{ - "counter.sum/K1=V1/R=V": 100, - "counter.sum/K1=V2/R=V": 101, - "observer.sum/K1=V1/R=V": 10, - "observer.sum/K1=V2/R=V": 11, - } - - // Export the data and validate it again. - exporter := processortest.New( - aggregation.StatelessTemporalitySelector(), - attribute.DefaultEncoder(), - ) - - err := exporter.Export(context.Background(), res, processortest.OneInstrumentationLibraryReader( - instrumentation.Library{ - Name: "test", - }, - checkpointer.Reader(), - )) - require.NoError(t, err) - require.EqualValues(t, expect, exporter.Values()) -} diff --git a/sdk/metric/processor/reducer/doc.go b/sdk/metric/processor/reducer/doc.go deleted file mode 100644 index e25079c526f..00000000000 --- a/sdk/metric/processor/reducer/doc.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package reducer implements a metrics Processor component to reduce attributes. - -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. - -The metrics Processor component this package implements applies an -attribute.Filter to each processed export.Accumulation to remove attributes -before passing the result to another Processor. This Processor can be used to -reduce inherent dimensionality in the data, as a way to control the cost of -collecting high cardinality metric data. - -For example, to compose a push controller with a reducer and a basic -metric processor: - - type someFilter struct{ - // configuration for this filter - // ... - } - - func (someFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { - return func(attr kv.KeyValue) bool { - // return true to keep this attr, false to drop this attr. - // ... - } - } - - func setupMetrics(exporter export.Exporter) (stop func()) { - basicProcessorFactory := basic.NewFactory( - simple.NewWithHistogramDistribution(), - exporter, - ) - - reducerProcessor := reducer.NewFactory(someFilter{...}, basicProcessorFactory) - - controller := controller.New( - reducerProcessor, - exporter, - opts..., - ) - controller.Start() - global.SetMeterProvider(controller.Provider()) - return controller.Stop -*/ -package reducer // import "go.opentelemetry.io/otel/sdk/metric/processor/reducer" diff --git a/sdk/metric/processor/reducer/reducer.go b/sdk/metric/processor/reducer/reducer.go deleted file mode 100644 index cd6daeb19d4..00000000000 --- a/sdk/metric/processor/reducer/reducer.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package reducer // import "go.opentelemetry.io/otel/sdk/metric/processor/reducer" - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - // Processor implements "dimensionality reduction" by - // filtering keys from export attribute sets. - Processor struct { - export.Checkpointer - filterSelector AttributeFilterSelector - } - - // AttributeFilterSelector selects an attribute filter based on the - // instrument described by the descriptor. - AttributeFilterSelector interface { - AttributeFilterFor(descriptor *sdkapi.Descriptor) attribute.Filter - } -) - -var _ export.Processor = &Processor{} -var _ export.Checkpointer = &Processor{} - -// New returns a dimensionality-reducing Processor that passes data to the -// next stage in an export pipeline. -func New(filterSelector AttributeFilterSelector, ckpter export.Checkpointer) *Processor { - return &Processor{ - Checkpointer: ckpter, - filterSelector: filterSelector, - } -} - -// Process implements export.Processor. -func (p *Processor) Process(accum export.Accumulation) error { - // Note: the removed attributes are returned and ignored here. - // Conceivably these inputs could be useful to a sampler. - reduced, _ := accum.Attributes().Filter( - p.filterSelector.AttributeFilterFor( - accum.Descriptor(), - ), - ) - return p.Checkpointer.Process( - export.NewAccumulation( - accum.Descriptor(), - &reduced, - accum.Aggregator(), - ), - ) -} diff --git a/sdk/metric/processor/reducer/reducer_test.go b/sdk/metric/processor/reducer/reducer_test.go deleted file mode 100644 index 12fbb7f86e0..00000000000 --- a/sdk/metric/processor/reducer/reducer_test.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package reducer_test - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/instrumentation" - metricsdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/export/aggregation" - "go.opentelemetry.io/otel/sdk/metric/processor/basic" - "go.opentelemetry.io/otel/sdk/metric/processor/processortest" - "go.opentelemetry.io/otel/sdk/metric/processor/reducer" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/resource" -) - -var ( - kvs1 = []attribute.KeyValue{ - attribute.Int("A", 1), - attribute.Int("B", 2), - attribute.Int("C", 3), - } - kvs2 = []attribute.KeyValue{ - attribute.Int("A", 1), - attribute.Int("B", 0), - attribute.Int("C", 3), - } -) - -type testFilter struct{} - -func (testFilter) AttributeFilterFor(_ *sdkapi.Descriptor) attribute.Filter { - return func(attr attribute.KeyValue) bool { - return attr.Key == "A" || attr.Key == "C" - } -} - -func generateData(t *testing.T, impl sdkapi.MeterImpl) { - ctx := context.Background() - meter := sdkapi.WrapMeterImpl(impl) - - counter, err := meter.SyncFloat64().Counter("counter.sum") - require.NoError(t, err) - counter.Add(ctx, 100, kvs1...) - counter.Add(ctx, 100, kvs2...) - - counterObserver, err := meter.AsyncInt64().Counter("observer.sum") - require.NoError(t, err) - err = meter.RegisterCallback([]instrument.Asynchronous{counterObserver}, func(ctx context.Context) { - counterObserver.Observe(ctx, 10, kvs1...) - counterObserver.Observe(ctx, 10, kvs2...) - }) - require.NoError(t, err) -} - -func TestFilterProcessor(t *testing.T) { - testProc := processortest.NewProcessor( - processortest.AggregatorSelector(), - attribute.DefaultEncoder(), - ) - accum := metricsdk.NewAccumulator( - reducer.New(testFilter{}, processortest.NewCheckpointer(testProc)), - ) - generateData(t, accum) - - accum.Collect(context.Background()) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=1,C=3/": 200, - "observer.sum/A=1,C=3/": 20, - }, testProc.Values()) -} - -// Test a filter with the ../basic Processor. -func TestFilterBasicProcessor(t *testing.T) { - basicProc := basic.New(processortest.AggregatorSelector(), aggregation.CumulativeTemporalitySelector()) - accum := metricsdk.NewAccumulator( - reducer.New(testFilter{}, basicProc), - ) - exporter := processortest.New(basicProc, attribute.DefaultEncoder()) - - generateData(t, accum) - - basicProc.StartCollection() - accum.Collect(context.Background()) - if err := basicProc.FinishCollection(); err != nil { - t.Error(err) - } - - res := resource.NewSchemaless(attribute.String("R", "V")) - require.NoError(t, exporter.Export(context.Background(), res, processortest.OneInstrumentationLibraryReader(instrumentation.Library{ - Name: "test", - }, basicProc.Reader()))) - - require.EqualValues(t, map[string]float64{ - "counter.sum/A=1,C=3/R=V": 200, - "observer.sum/A=1,C=3/R=V": 20, - }, exporter.Values()) -} diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go new file mode 100644 index 00000000000..7f8f32bf104 --- /dev/null +++ b/sdk/metric/provider.go @@ -0,0 +1,126 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" +) + +// MeterProvider handles the creation and coordination of Meters. All Meters +// created by a MeterProvider will be associated with the same Resource, have +// the same Views applied to them, and have their produced metric telemetry +// passed to the configured Readers. +type MeterProvider struct { + res *resource.Resource + + meters meterRegistry + + forceFlush, shutdown func(context.Context) error +} + +// Compile-time check MeterProvider implements metric.MeterProvider. +var _ metric.MeterProvider = (*MeterProvider)(nil) + +// NewMeterProvider returns a new and configured MeterProvider. +// +// By default, the returned MeterProvider is configured with the default +// Resource and no Readers. Readers cannot be added after a MeterProvider is +// created. This means the returned MeterProvider, one created with no +// Readers, will perform no operations. +func NewMeterProvider(options ...Option) *MeterProvider { + conf := newConfig(options) + + flush, sdown := conf.readerSignals() + + registry := newPipelineRegistries(conf.readers) + + return &MeterProvider{ + res: conf.res, + + meters: meterRegistry{ + registry: registry, + }, + + forceFlush: flush, + shutdown: sdown, + } +} + +// Meter returns a Meter with the given name and configured with options. +// +// The name should be the name of the instrumentation scope creating +// telemetry. This name may be the same as the instrumented code only if that +// code provides built-in instrumentation. +// +// If name is empty, the default (go.opentelemetry.io/otel/sdk/meter) will be +// used. +// +// Calls to the Meter method after Shutdown has been called will return Meters +// that perform no operations. +// +// This method is safe to call concurrently. +func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metric.Meter { + c := metric.NewMeterConfig(options...) + return mp.meters.Get(instrumentation.Scope{ + Name: name, + Version: c.InstrumentationVersion(), + SchemaURL: c.SchemaURL(), + }) +} + +// ForceFlush flushes all pending telemetry. +// +// This method honors the deadline or cancellation of ctx. An appropriate +// error will be returned in these situations. There is no guaranteed that all +// telemetry be flushed or all resources have been released in these +// situations. +// +// This method is safe to call concurrently. +func (mp *MeterProvider) ForceFlush(ctx context.Context) error { + if mp.forceFlush != nil { + return mp.forceFlush(ctx) + } + return nil +} + +// Shutdown shuts down the MeterProvider flushing all pending telemetry and +// releasing any held computational resources. +// +// This call is idempotent. The first call will perform all flush and +// releasing operations. Subsequent calls will perform no action and will +// return an error stating this. +// +// Measurements made by instruments from meters this MeterProvider created +// will not be exported after Shutdown is called. +// +// This method honors the deadline or cancellation of ctx. An appropriate +// error will be returned in these situations. There is no guaranteed that all +// telemetry be flushed or all resources have been released in these +// situations. +// +// This method is safe to call concurrently. +func (mp *MeterProvider) Shutdown(ctx context.Context) error { + if mp.shutdown != nil { + return mp.shutdown(ctx) + } + return nil +} diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go new file mode 100644 index 00000000000..aefb23f8690 --- /dev/null +++ b/sdk/metric/provider_test.go @@ -0,0 +1,79 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMeterConcurrentSafe(t *testing.T) { + const name = "TestMeterConcurrentSafe meter" + mp := NewMeterProvider() + + go func() { + _ = mp.Meter(name) + }() + + _ = mp.Meter(name) +} + +func TestForceFlushConcurrentSafe(t *testing.T) { + mp := NewMeterProvider() + + go func() { + _ = mp.ForceFlush(context.Background()) + }() + + _ = mp.ForceFlush(context.Background()) +} + +func TestShutdownConcurrentSafe(t *testing.T) { + mp := NewMeterProvider() + + go func() { + _ = mp.Shutdown(context.Background()) + }() + + _ = mp.Shutdown(context.Background()) +} + +func TestMeterDoesNotPanicForEmptyMeterProvider(t *testing.T) { + mp := MeterProvider{} + assert.NotPanics(t, func() { _ = mp.Meter("") }) +} + +func TestForceFlushDoesNotPanicForEmptyMeterProvider(t *testing.T) { + mp := MeterProvider{} + assert.NotPanics(t, func() { _ = mp.ForceFlush(context.Background()) }) +} + +func TestShutdownDoesNotPanicForEmptyMeterProvider(t *testing.T) { + mp := MeterProvider{} + assert.NotPanics(t, func() { _ = mp.Shutdown(context.Background()) }) +} + +func TestMeterProviderReturnsSameMeter(t *testing.T) { + mp := MeterProvider{} + mtr := mp.Meter("") + + assert.Same(t, mtr, mp.Meter("")) + assert.NotSame(t, mtr, mp.Meter("diff")) +} diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go new file mode 100644 index 00000000000..ff5f987070d --- /dev/null +++ b/sdk/metric/reader.go @@ -0,0 +1,216 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +// errDuplicateRegister is logged by a Reader when an attempt to registered it +// more than once occurs. +var errDuplicateRegister = fmt.Errorf("duplicate reader registration") + +// ErrReaderNotRegistered is returned if Collect or Shutdown are called before +// the reader is registered with a MeterProvider. +var ErrReaderNotRegistered = fmt.Errorf("reader is not registered") + +// ErrReaderShutdown is returned if Collect or Shutdown are called after a +// reader has been Shutdown once. +var ErrReaderShutdown = fmt.Errorf("reader is shutdown") + +// Reader is the interface used between the SDK and an +// exporter. Control flow is bi-directional through the +// Reader, since the SDK initiates ForceFlush and Shutdown +// while the initiates collection. The Register() method here +// informs the Reader that it can begin reading, signaling the +// start of bi-directional control flow. +// +// Typically, push-based exporters that are periodic will +// implement PeroidicExporter themselves and construct a +// PeriodicReader to satisfy this interface. +// +// Pull-based exporters will typically implement Register +// themselves, since they read on demand. +type Reader interface { + // register registers a Reader with a MeterProvider. + // The producer argument allows the Reader to signal the sdk to collect + // and send aggregated metric measurements. + register(producer) + + // temporality reports the Temporality for the instrument kind provided. + temporality(view.InstrumentKind) metricdata.Temporality + + // aggregation returns what Aggregation to use for an instrument kind. + aggregation(view.InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. + + // Collect gathers and returns all metric data related to the Reader from + // the SDK. An error is returned if this is called after Shutdown. + Collect(context.Context) (metricdata.ResourceMetrics, error) + + // ForceFlush flushes all metric measurements held in an export pipeline. + // + // This deadline or cancellation of the passed context are honored. An appropriate + // error will be returned in these situations. There is no guaranteed that all + // telemetry be flushed or all resources have been released in these + // situations. + ForceFlush(context.Context) error + + // Shutdown flushes all metric measurements held in an export pipeline and releases any + // held computational resources. + // + // This deadline or cancellation of the passed context are honored. An appropriate + // error will be returned in these situations. There is no guaranteed that all + // telemetry be flushed or all resources have been released in these + // situations. + // + // After Shutdown is called, calls to Collect will perform no operation and instead will return + // an error indicating the shutdown state. + Shutdown(context.Context) error +} + +// producer produces metrics for a Reader. +type producer interface { + // produce returns aggregated metrics from a single collection. + // + // This method is safe to call concurrently. + produce(context.Context) (metricdata.ResourceMetrics, error) +} + +// produceHolder is used as an atomic.Value to wrap the non-concrete producer +// type. +type produceHolder struct { + produce func(context.Context) (metricdata.ResourceMetrics, error) +} + +// shutdownProducer produces an ErrReaderShutdown error always. +type shutdownProducer struct{} + +// produce returns an ErrReaderShutdown error. +func (p shutdownProducer) produce(context.Context) (metricdata.ResourceMetrics, error) { + return metricdata.ResourceMetrics{}, ErrReaderShutdown +} + +// ReaderOption applies a configuration option value to either a ManualReader or +// a PeriodicReader. +type ReaderOption interface { + ManualReaderOption + PeriodicReaderOption +} + +// TemporalitySelector selects the temporality to use based on the InstrumentKind. +type TemporalitySelector func(view.InstrumentKind) metricdata.Temporality + +// DefaultTemporalitySelector is the default TemporalitySelector used if +// WithTemporalitySelector is not provided. CumulativeTemporality will be used +// for all instrument kinds if this TemporalitySelector is used. +func DefaultTemporalitySelector(view.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +// WithTemporalitySelector sets the TemporalitySelector a reader will use to +// determine the Temporality of an instrument based on its kind. If this +// option is not used, the reader will use the DefaultTemporalitySelector. +func WithTemporalitySelector(selector TemporalitySelector) ReaderOption { + return temporalitySelectorOption{selector: selector} +} + +type temporalitySelectorOption struct { + selector func(instrument view.InstrumentKind) metricdata.Temporality +} + +// applyManual returns a manualReaderConfig with option applied. +func (t temporalitySelectorOption) applyManual(mrc manualReaderConfig) manualReaderConfig { + mrc.temporalitySelector = t.selector + return mrc +} + +// applyPeriodic returns a periodicReaderConfig with option applied. +func (t temporalitySelectorOption) applyPeriodic(prc periodicReaderConfig) periodicReaderConfig { + prc.temporalitySelector = t.selector + return prc +} + +// AggregationSelector selects the aggregation and the parameters to use for +// that aggregation based on the InstrumentKind. +type AggregationSelector func(view.InstrumentKind) aggregation.Aggregation + +// DefaultAggregationSelector returns the default aggregation and parameters +// that will be used to summarize measurement made from an instrument of +// InstrumentKind. This AggregationSelector using the following selection +// mapping: Counter ⇨ Sum, Asynchronous Counter ⇨ Sum, UpDownCounter ⇨ Sum, +// Asynchronous UpDownCounter ⇨ Sum, Asynchronous Gauge ⇨ LastValue, +// Histogram ⇨ ExplicitBucketHistogram. +func DefaultAggregationSelector(ik view.InstrumentKind) aggregation.Aggregation { + switch ik { + case view.SyncCounter, view.SyncUpDownCounter, view.AsyncCounter, view.AsyncUpDownCounter: + return aggregation.Sum{} + case view.AsyncGauge: + return aggregation.LastValue{} + case view.SyncHistogram: + return aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + NoMinMax: false, + } + } + panic("unknown instrument kind") +} + +// WithAggregationSelector sets the AggregationSelector a reader will use to +// determine the aggregation to use for an instrument based on its kind. If +// this option is not used, the reader will use the DefaultAggregationSelector +// or the aggregation explicitly passed for a view matching an instrument. +func WithAggregationSelector(selector AggregationSelector) ReaderOption { + // Deep copy and validate before using. + wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return aggregationSelectorOption{selector: wrapped} +} + +type aggregationSelectorOption struct { + selector AggregationSelector +} + +// applyManual returns a manualReaderConfig with option applied. +func (t aggregationSelectorOption) applyManual(c manualReaderConfig) manualReaderConfig { + c.aggregationSelector = t.selector + return c +} + +// applyPeriodic returns a periodicReaderConfig with option applied. +func (t aggregationSelectorOption) applyPeriodic(c periodicReaderConfig) periodicReaderConfig { + c.aggregationSelector = t.selector + return c +} diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go new file mode 100644 index 00000000000..630d11a869b --- /dev/null +++ b/sdk/metric/reader_test.go @@ -0,0 +1,241 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/go-logr/logr/testr" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" +) + +type readerTestSuite struct { + suite.Suite + + Factory func() Reader + Reader Reader +} + +func (ts *readerTestSuite) SetupSuite() { + otel.SetLogger(testr.New(ts.T())) +} + +func (ts *readerTestSuite) SetupTest() { + ts.Reader = ts.Factory() +} + +func (ts *readerTestSuite) TearDownTest() { + // Ensure Reader is allowed attempt to clean up. + _ = ts.Reader.Shutdown(context.Background()) +} + +func (ts *readerTestSuite) TestErrorForNotRegistered() { + _, err := ts.Reader.Collect(context.Background()) + ts.ErrorIs(err, ErrReaderNotRegistered) +} + +func (ts *readerTestSuite) TestProducer() { + ts.Reader.register(testProducer{}) + m, err := ts.Reader.Collect(context.Background()) + ts.NoError(err) + ts.Equal(testMetrics, m) +} + +func (ts *readerTestSuite) TestCollectAfterShutdown() { + ctx := context.Background() + ts.Reader.register(testProducer{}) + ts.Require().NoError(ts.Reader.Shutdown(ctx)) + + m, err := ts.Reader.Collect(ctx) + ts.ErrorIs(err, ErrReaderShutdown) + ts.Equal(metricdata.ResourceMetrics{}, m) +} + +func (ts *readerTestSuite) TestShutdownTwice() { + ctx := context.Background() + ts.Reader.register(testProducer{}) + ts.Require().NoError(ts.Reader.Shutdown(ctx)) + ts.ErrorIs(ts.Reader.Shutdown(ctx), ErrReaderShutdown) +} + +func (ts *readerTestSuite) TestMultipleForceFlush() { + ctx := context.Background() + ts.Reader.register(testProducer{}) + ts.Require().NoError(ts.Reader.ForceFlush(ctx)) + ts.NoError(ts.Reader.ForceFlush(ctx)) +} + +func (ts *readerTestSuite) TestMultipleRegister() { + p0 := testProducer{ + produceFunc: func(ctx context.Context) (metricdata.ResourceMetrics, error) { + // Differentiate this producer from the second by returning an + // error. + return testMetrics, assert.AnError + }, + } + p1 := testProducer{} + + ts.Reader.register(p0) + // This should be ignored. + ts.Reader.register(p1) + + _, err := ts.Reader.Collect(context.Background()) + ts.Equal(assert.AnError, err) +} + +func (ts *readerTestSuite) TestMethodConcurrency() { + // Requires the race-detector (a default test option for the project). + + // All reader methods should be concurrent-safe. + ts.Reader.register(testProducer{}) + ctx := context.Background() + + var wg sync.WaitGroup + const threads = 2 + for i := 0; i < threads; i++ { + wg.Add(1) + go func() { + defer wg.Done() + _, _ = ts.Reader.Collect(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = ts.Reader.ForceFlush(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = ts.Reader.Shutdown(ctx) + }() + } + wg.Wait() +} + +func (ts *readerTestSuite) TestShutdownBeforeRegister() { + ctx := context.Background() + ts.Require().NoError(ts.Reader.Shutdown(ctx)) + // Registering after shutdown should not revert the shutdown. + ts.Reader.register(testProducer{}) + + m, err := ts.Reader.Collect(ctx) + ts.ErrorIs(err, ErrReaderShutdown) + ts.Equal(metricdata.ResourceMetrics{}, m) +} + +var testMetrics = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("test", "Reader")), + ScopeMetrics: []metricdata.ScopeMetrics{{ + Scope: instrumentation.Scope{Name: "sdk/metric/test/reader"}, + Metrics: []metricdata.Metrics{{ + Name: "fake data", + Description: "Data used to test a reader", + Unit: unit.Dimensionless, + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{ + Attributes: attribute.NewSet(attribute.String("user", "alice")), + StartTime: time.Now(), + Time: time.Now().Add(time.Second), + Value: -1, + }}, + }, + }}, + }}, +} + +type testProducer struct { + produceFunc func(context.Context) (metricdata.ResourceMetrics, error) +} + +func (p testProducer) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { + if p.produceFunc != nil { + return p.produceFunc(ctx) + } + return testMetrics, nil +} + +func benchReaderCollectFunc(r Reader) func(*testing.B) { + ctx := context.Background() + r.register(testProducer{}) + + // Store bechmark results in a closure to prevent the compiler from + // inlining and skipping the function. + var ( + collectedMetrics metricdata.ResourceMetrics + err error + ) + + return func(b *testing.B) { + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + collectedMetrics, err = r.Collect(ctx) + assert.Equalf(b, testMetrics, collectedMetrics, "unexpected Collect response: (%#v, %v)", collectedMetrics, err) + } + } +} + +func TestDefaultAggregationSelector(t *testing.T) { + var undefinedInstrument view.InstrumentKind + assert.Panics(t, func() { DefaultAggregationSelector(undefinedInstrument) }) + + iKinds := []view.InstrumentKind{ + view.SyncCounter, + view.SyncUpDownCounter, + view.SyncHistogram, + view.AsyncCounter, + view.AsyncUpDownCounter, + view.AsyncGauge, + } + + for _, ik := range iKinds { + assert.NoError(t, DefaultAggregationSelector(ik).Err(), ik) + } +} + +func TestDefaultTemporalitySelector(t *testing.T) { + var undefinedInstrument view.InstrumentKind + for _, ik := range []view.InstrumentKind{ + undefinedInstrument, + view.SyncCounter, + view.SyncUpDownCounter, + view.SyncHistogram, + view.AsyncCounter, + view.AsyncUpDownCounter, + view.AsyncGauge, + } { + assert.Equal(t, metricdata.CumulativeTemporality, DefaultTemporalitySelector(ik)) + } +} diff --git a/sdk/metric/refcount_mapped.go b/sdk/metric/refcount_mapped.go deleted file mode 100644 index d9d2cb701c2..00000000000 --- a/sdk/metric/refcount_mapped.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/sdk/metric" - -import ( - "sync/atomic" -) - -// refcountMapped atomically counts the number of references (usages) of an entry -// while also keeping a state of mapped/unmapped into a different data structure -// (an external map or list for example). -// -// refcountMapped uses an atomic value where the least significant bit is used to -// keep the state of mapping ('1' is used for unmapped and '0' is for mapped) and -// the rest of the bits are used for refcounting. -type refcountMapped struct { - // refcount has to be aligned for 64-bit atomic operations. - value int64 -} - -// ref returns true if the entry is still mapped and increases the -// reference usages, if unmapped returns false. -func (rm *refcountMapped) ref() bool { - // Check if this entry was marked as unmapped between the moment - // we got a reference to it (or will be removed very soon) and here. - return atomic.AddInt64(&rm.value, 2)&1 == 0 -} - -func (rm *refcountMapped) unref() { - atomic.AddInt64(&rm.value, -2) -} - -// tryUnmap flips the mapped bit to "unmapped" state and returns true if both of the -// following conditions are true upon entry to this function: -// - There are no active references; -// - The mapped bit is in "mapped" state. -// -// Otherwise no changes are done to mapped bit and false is returned. -func (rm *refcountMapped) tryUnmap() bool { - if atomic.LoadInt64(&rm.value) != 0 { - return false - } - return atomic.CompareAndSwapInt64( - &rm.value, - 0, - 1, - ) -} diff --git a/sdk/metric/registry/doc.go b/sdk/metric/registry/doc.go deleted file mode 100644 index b401408beef..00000000000 --- a/sdk/metric/registry/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package registry provides a non-standalone implementation of -MeterProvider that adds uniqueness checking for instrument descriptors -on top of other MeterProvider it wraps. - -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. -*/ -package registry // import "go.opentelemetry.io/otel/sdk/metric/registry" diff --git a/sdk/metric/registry/registry.go b/sdk/metric/registry/registry.go deleted file mode 100644 index 4d339ab7d69..00000000000 --- a/sdk/metric/registry/registry.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package registry // import "go.opentelemetry.io/otel/sdk/metric/registry" - -import ( - "context" - "fmt" - "sync" - - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -// UniqueInstrumentMeterImpl implements the metric.MeterImpl interface, adding -// uniqueness checking for instrument descriptors. -type UniqueInstrumentMeterImpl struct { - lock sync.Mutex - impl sdkapi.MeterImpl - state map[string]sdkapi.InstrumentImpl -} - -var _ sdkapi.MeterImpl = (*UniqueInstrumentMeterImpl)(nil) - -// ErrMetricKindMismatch is the standard error for mismatched metric -// instrument definitions. -var ErrMetricKindMismatch = fmt.Errorf( - "a metric was already registered by this name with another kind or number type") - -// NewUniqueInstrumentMeterImpl returns a wrapped metric.MeterImpl -// with the addition of instrument name uniqueness checking. -func NewUniqueInstrumentMeterImpl(impl sdkapi.MeterImpl) *UniqueInstrumentMeterImpl { - return &UniqueInstrumentMeterImpl{ - impl: impl, - state: map[string]sdkapi.InstrumentImpl{}, - } -} - -// MeterImpl gives the caller access to the underlying MeterImpl -// used by this UniqueInstrumentMeterImpl. -func (u *UniqueInstrumentMeterImpl) MeterImpl() sdkapi.MeterImpl { - return u.impl -} - -// NewMetricKindMismatchError formats an error that describes a -// mismatched metric instrument definition. -func NewMetricKindMismatchError(desc sdkapi.Descriptor) error { - return fmt.Errorf("metric %s registered as %s %s: %w", - desc.Name(), - desc.NumberKind(), - desc.InstrumentKind(), - ErrMetricKindMismatch) -} - -// Compatible determines whether two sdkapi.Descriptors are considered -// the same for the purpose of uniqueness checking. -func Compatible(candidate, existing sdkapi.Descriptor) bool { - return candidate.InstrumentKind() == existing.InstrumentKind() && - candidate.NumberKind() == existing.NumberKind() -} - -// checkUniqueness returns an ErrMetricKindMismatch error if there is -// a conflict between a descriptor that was already registered and the -// `descriptor` argument. If there is an existing compatible -// registration, this returns the already-registered instrument. If -// there is no conflict and no prior registration, returns (nil, nil). -func (u *UniqueInstrumentMeterImpl) checkUniqueness(descriptor sdkapi.Descriptor) (sdkapi.InstrumentImpl, error) { - impl, ok := u.state[descriptor.Name()] - if !ok { - return nil, nil - } - - if !Compatible(descriptor, impl.Descriptor()) { - return nil, NewMetricKindMismatchError(impl.Descriptor()) - } - - return impl, nil -} - -// NewSyncInstrument implements sdkapi.MeterImpl. -func (u *UniqueInstrumentMeterImpl) NewSyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - u.lock.Lock() - defer u.lock.Unlock() - - impl, err := u.checkUniqueness(descriptor) - - if err != nil { - return nil, err - } else if impl != nil { - return impl.(sdkapi.SyncImpl), nil - } - - syncInst, err := u.impl.NewSyncInstrument(descriptor) - if err != nil { - return nil, err - } - u.state[descriptor.Name()] = syncInst - return syncInst, nil -} - -// NewAsyncInstrument implements sdkapi.MeterImpl. -func (u *UniqueInstrumentMeterImpl) NewAsyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.AsyncImpl, error) { - u.lock.Lock() - defer u.lock.Unlock() - - impl, err := u.checkUniqueness(descriptor) - - if err != nil { - return nil, err - } else if impl != nil { - return impl.(sdkapi.AsyncImpl), nil - } - - asyncInst, err := u.impl.NewAsyncInstrument(descriptor) - if err != nil { - return nil, err - } - u.state[descriptor.Name()] = asyncInst - return asyncInst, nil -} - -// RegisterCallback registers callback with insts. -func (u *UniqueInstrumentMeterImpl) RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error { - u.lock.Lock() - defer u.lock.Unlock() - - return u.impl.RegisterCallback(insts, callback) -} diff --git a/sdk/metric/registry/registry_test.go b/sdk/metric/registry/registry_test.go deleted file mode 100644 index 3fe8d296045..00000000000 --- a/sdk/metric/registry/registry_test.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package registry_test - -import ( - "errors" - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/metric" - metricsdk "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/registry" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - newFunc func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) -) - -var ( - allNew = map[string]newFunc{ - "counter.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.SyncInt64().Counter(name)) - }, - "counter.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.SyncFloat64().Counter(name)) - }, - "histogram.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.SyncInt64().Histogram(name)) - }, - "histogram.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.SyncFloat64().Histogram(name)) - }, - "gaugeobserver.int64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.AsyncInt64().Gauge(name)) - }, - "gaugeobserver.float64": func(m metric.Meter, name string) (sdkapi.InstrumentImpl, error) { - return unwrap(m.AsyncFloat64().Gauge(name)) - }, - } -) - -func unwrap(impl interface{}, err error) (sdkapi.InstrumentImpl, error) { - if impl == nil { - return nil, err - } - if s, ok := impl.(interface { - SyncImpl() sdkapi.SyncImpl - }); ok { - return s.SyncImpl(), err - } - if a, ok := impl.(interface { - AsyncImpl() sdkapi.AsyncImpl - }); ok { - return a.AsyncImpl(), err - } - return nil, err -} - -// TODO Replace with controller. -func testMeterWithRegistry(name string) metric.Meter { - return sdkapi.WrapMeterImpl( - registry.NewUniqueInstrumentMeterImpl( - metricsdk.NewAccumulator(nil), - ), - ) -} - -func TestRegistrySameInstruments(t *testing.T) { - for _, nf := range allNew { - meter := testMeterWithRegistry("meter") - inst1, err1 := nf(meter, "this") - inst2, err2 := nf(meter, "this") - - require.NoError(t, err1) - require.NoError(t, err2) - require.Equal(t, inst1, inst2) - } -} - -func TestRegistryDiffInstruments(t *testing.T) { - for origName, origf := range allNew { - meter := testMeterWithRegistry("meter") - - _, err := origf(meter, "this") - require.NoError(t, err) - - for newName, nf := range allNew { - if newName == origName { - continue - } - - other, err := nf(meter, "this") - require.Error(t, err) - require.Nil(t, other) - require.True(t, errors.Is(err, registry.ErrMetricKindMismatch)) - } - } -} diff --git a/sdk/metric/sdk.go b/sdk/metric/sdk.go deleted file mode 100644 index a942f86f2d4..00000000000 --- a/sdk/metric/sdk.go +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/sdk/metric" - -import ( - "context" - "fmt" - "runtime" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - // Accumulator implements the OpenTelemetry Meter API. The - // Accumulator is bound to a single export.Processor in - // `NewAccumulator()`. - // - // The Accumulator supports a Collect() API to gather and export - // current data. Collect() should be arranged according to - // the processor model. Push-based processors will setup a - // timer to call Collect() periodically. Pull-based processors - // will call Collect() when a pull request arrives. - Accumulator struct { - // current maps `mapkey` to *record. - current sync.Map - - callbackLock sync.Mutex - callbacks map[*callback]struct{} - - // currentEpoch is the current epoch number. It is - // incremented in `Collect()`. - currentEpoch int64 - - // processor is the configured processor+configuration. - processor export.Processor - - // collectLock prevents simultaneous calls to Collect(). - collectLock sync.Mutex - } - - callback struct { - insts map[*asyncInstrument]struct{} - f func(context.Context) - } - - asyncContextKey struct{} - - asyncInstrument struct { - baseInstrument - instrument.Asynchronous - } - - syncInstrument struct { - baseInstrument - instrument.Synchronous - } - - // mapkey uniquely describes a metric instrument in terms of its - // InstrumentID and the encoded form of its attributes. - mapkey struct { - descriptor *sdkapi.Descriptor - ordered attribute.Distinct - } - - // record maintains the state of one metric instrument. Due - // the use of lock-free algorithms, there may be more than one - // `record` in existence at a time, although at most one can - // be referenced from the `Accumulator.current` map. - record struct { - // refMapped keeps track of refcounts and the mapping state to the - // Accumulator.current map. - refMapped refcountMapped - - // updateCount is incremented on every Update. - updateCount int64 - - // collectedCount is set to updateCount on collection, - // supports checking for no updates during a round. - collectedCount int64 - - // attrs is the stored attribute set for this record, except in cases - // where a attribute set is shared due to batch recording. - attrs attribute.Set - - // sortSlice has a single purpose - as a temporary place for sorting - // during attributes creation to avoid allocation. - sortSlice attribute.Sortable - - // inst is a pointer to the corresponding instrument. - inst *baseInstrument - - // current implements the actual RecordOne() API, - // depending on the type of aggregation. If nil, the - // metric was disabled by the exporter. - current aggregator.Aggregator - checkpoint aggregator.Aggregator - } - - baseInstrument struct { - meter *Accumulator - descriptor sdkapi.Descriptor - } -) - -var ( - _ sdkapi.MeterImpl = &Accumulator{} - - // ErrUninitializedInstrument is returned when an instrument is used when uninitialized. - ErrUninitializedInstrument = fmt.Errorf("use of an uninitialized instrument") - - // ErrBadInstrument is returned when an instrument from another SDK is - // attempted to be registered with this SDK. - ErrBadInstrument = fmt.Errorf("use of a instrument from another SDK") -) - -func (b *baseInstrument) Descriptor() sdkapi.Descriptor { - return b.descriptor -} - -func (a *asyncInstrument) Implementation() interface{} { - return a -} - -func (s *syncInstrument) Implementation() interface{} { - return s -} - -// acquireHandle gets or creates a `*record` corresponding to `kvs`, -// the input attributes. -func (b *baseInstrument) acquireHandle(kvs []attribute.KeyValue) *record { - // This memory allocation may not be used, but it's - // needed for the `sortSlice` field, to avoid an - // allocation while sorting. - rec := &record{} - rec.attrs = attribute.NewSetWithSortable(kvs, &rec.sortSlice) - - // Create lookup key for sync.Map (one allocation, as this - // passes through an interface{}) - mk := mapkey{ - descriptor: &b.descriptor, - ordered: rec.attrs.Equivalent(), - } - - if actual, ok := b.meter.current.Load(mk); ok { - // Existing record case. - existingRec := actual.(*record) - if existingRec.refMapped.ref() { - // At this moment it is guaranteed that the entry is in - // the map and will not be removed. - return existingRec - } - // This entry is no longer mapped, try to add a new entry. - } - - rec.refMapped = refcountMapped{value: 2} - rec.inst = b - - b.meter.processor.AggregatorFor(&b.descriptor, &rec.current, &rec.checkpoint) - - for { - // Load/Store: there's a memory allocation to place `mk` into - // an interface here. - if actual, loaded := b.meter.current.LoadOrStore(mk, rec); loaded { - // Existing record case. Cannot change rec here because if fail - // will try to add rec again to avoid new allocations. - oldRec := actual.(*record) - if oldRec.refMapped.ref() { - // At this moment it is guaranteed that the entry is in - // the map and will not be removed. - return oldRec - } - // This loaded entry is marked as unmapped (so Collect will remove - // it from the map immediately), try again - this is a busy waiting - // strategy to wait until Collect() removes this entry from the map. - // - // This can be improved by having a list of "Unmapped" entries for - // one time only usages, OR we can make this a blocking path and use - // a Mutex that protects the delete operation (delete only if the old - // record is associated with the key). - - // Let collector get work done to remove the entry from the map. - runtime.Gosched() - continue - } - // The new entry was added to the map, good to go. - return rec - } -} - -// RecordOne captures a single synchronous metric event. -// -// The order of the input array `kvs` may be sorted after the function is called. -func (s *syncInstrument) RecordOne(ctx context.Context, num number.Number, kvs []attribute.KeyValue) { - h := s.acquireHandle(kvs) - defer h.unbind() - h.captureOne(ctx, num) -} - -// ObserveOne captures a single asynchronous metric event. - -// The order of the input array `kvs` may be sorted after the function is called. -func (a *asyncInstrument) ObserveOne(ctx context.Context, num number.Number, attrs []attribute.KeyValue) { - h := a.acquireHandle(attrs) - defer h.unbind() - h.captureOne(ctx, num) -} - -// NewAccumulator constructs a new Accumulator for the given -// processor. This Accumulator supports only a single processor. -// -// The Accumulator does not start any background process to collect itself -// periodically, this responsibility lies with the processor, typically, -// depending on the type of export. For example, a pull-based -// processor will call Collect() when it receives a request to scrape -// current metric values. A push-based processor should configure its -// own periodic collection. -func NewAccumulator(processor export.Processor) *Accumulator { - return &Accumulator{ - processor: processor, - callbacks: map[*callback]struct{}{}, - } -} - -var _ sdkapi.MeterImpl = &Accumulator{} - -// NewSyncInstrument implements sdkapi.MetricImpl. -func (m *Accumulator) NewSyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.SyncImpl, error) { - return &syncInstrument{ - baseInstrument: baseInstrument{ - descriptor: descriptor, - meter: m, - }, - }, nil -} - -// NewAsyncInstrument implements sdkapi.MetricImpl. -func (m *Accumulator) NewAsyncInstrument(descriptor sdkapi.Descriptor) (sdkapi.AsyncImpl, error) { - a := &asyncInstrument{ - baseInstrument: baseInstrument{ - descriptor: descriptor, - meter: m, - }, - } - return a, nil -} - -// RegisterCallback registers f to be called for insts. -func (m *Accumulator) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { - cb := &callback{ - insts: map[*asyncInstrument]struct{}{}, - f: f, - } - for _, inst := range insts { - impl, ok := inst.(sdkapi.AsyncImpl) - if !ok { - return ErrBadInstrument - } - - ai, err := m.fromAsync(impl) - if err != nil { - return err - } - cb.insts[ai] = struct{}{} - } - - m.callbackLock.Lock() - defer m.callbackLock.Unlock() - m.callbacks[cb] = struct{}{} - return nil -} - -// Collect traverses the list of active records and observers and -// exports data for each active instrument. Collect() may not be -// called concurrently. -// -// During the collection pass, the export.Processor will receive -// one Export() call per current aggregation. -// -// Returns the number of records that were checkpointed. -func (m *Accumulator) Collect(ctx context.Context) int { - m.collectLock.Lock() - defer m.collectLock.Unlock() - - m.runAsyncCallbacks(ctx) - checkpointed := m.collectInstruments() - m.currentEpoch++ - - return checkpointed -} - -func (m *Accumulator) collectInstruments() int { - checkpointed := 0 - - m.current.Range(func(key interface{}, value interface{}) bool { - // Note: always continue to iterate over the entire - // map by returning `true` in this function. - inuse := value.(*record) - - mods := atomic.LoadInt64(&inuse.updateCount) - coll := inuse.collectedCount - - if mods != coll { - // Updates happened in this interval, - // checkpoint and continue. - checkpointed += m.checkpointRecord(inuse) - inuse.collectedCount = mods - return true - } - - // Having no updates since last collection, try to unmap: - if unmapped := inuse.refMapped.tryUnmap(); !unmapped { - // The record is referenced by a binding, continue. - return true - } - - // If any other goroutines are now trying to re-insert this - // entry in the map, they are busy calling Gosched() awaiting - // this deletion: - m.current.Delete(inuse.mapkey()) - - // There's a potential race between `LoadInt64` and - // `tryUnmap` in this function. Since this is the - // last we'll see of this record, checkpoint - mods = atomic.LoadInt64(&inuse.updateCount) - if mods != coll { - checkpointed += m.checkpointRecord(inuse) - } - return true - }) - - return checkpointed -} - -func (m *Accumulator) runAsyncCallbacks(ctx context.Context) { - m.callbackLock.Lock() - defer m.callbackLock.Unlock() - - ctx = context.WithValue(ctx, asyncContextKey{}, m) - - for cb := range m.callbacks { - cb.f(ctx) - } -} - -func (m *Accumulator) checkpointRecord(r *record) int { - if r.current == nil { - return 0 - } - err := r.current.SynchronizedMove(r.checkpoint, &r.inst.descriptor) - if err != nil { - otel.Handle(err) - return 0 - } - - a := export.NewAccumulation(&r.inst.descriptor, &r.attrs, r.checkpoint) - err = m.processor.Process(a) - if err != nil { - otel.Handle(err) - } - return 1 -} - -func (r *record) captureOne(ctx context.Context, num number.Number) { - if r.current == nil { - // The instrument is disabled according to the AggregatorSelector. - return - } - if err := aggregator.RangeTest(num, &r.inst.descriptor); err != nil { - otel.Handle(err) - return - } - if err := r.current.Update(ctx, num, &r.inst.descriptor); err != nil { - otel.Handle(err) - return - } - // Record was modified, inform the Collect() that things need - // to be collected while the record is still mapped. - atomic.AddInt64(&r.updateCount, 1) -} - -func (r *record) unbind() { - r.refMapped.unref() -} - -func (r *record) mapkey() mapkey { - return mapkey{ - descriptor: &r.inst.descriptor, - ordered: r.attrs.Equivalent(), - } -} - -// fromSync gets an async implementation object, checking for -// uninitialized instruments and instruments created by another SDK. -func (m *Accumulator) fromAsync(async sdkapi.AsyncImpl) (*asyncInstrument, error) { - if async == nil { - return nil, ErrUninitializedInstrument - } - inst, ok := async.Implementation().(*asyncInstrument) - if !ok { - return nil, ErrBadInstrument - } - return inst, nil -} diff --git a/sdk/metric/sdkapi/descriptor.go b/sdk/metric/sdkapi/descriptor.go deleted file mode 100644 index 778e9321eea..00000000000 --- a/sdk/metric/sdkapi/descriptor.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" - -import ( - "go.opentelemetry.io/otel/metric/unit" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -// Descriptor contains all the settings that describe an instrument, -// including its name, metric kind, number kind, and the configurable -// options. -type Descriptor struct { - name string - instrumentKind InstrumentKind - numberKind number.Kind - description string - unit unit.Unit -} - -// NewDescriptor returns a Descriptor with the given contents. -func NewDescriptor(name string, ikind InstrumentKind, nkind number.Kind, description string, u unit.Unit) Descriptor { - return Descriptor{ - name: name, - instrumentKind: ikind, - numberKind: nkind, - description: description, - unit: u, - } -} - -// Name returns the metric instrument's name. -func (d Descriptor) Name() string { - return d.name -} - -// InstrumentKind returns the specific kind of instrument. -func (d Descriptor) InstrumentKind() InstrumentKind { - return d.instrumentKind -} - -// Description provides a human-readable description of the metric -// instrument. -func (d Descriptor) Description() string { - return d.description -} - -// Unit describes the units of the metric instrument. Unitless -// metrics return the empty string. -func (d Descriptor) Unit() unit.Unit { - return d.unit -} - -// NumberKind returns whether this instrument is declared over int64, -// float64, or uint64 values. -func (d Descriptor) NumberKind() number.Kind { - return d.numberKind -} diff --git a/sdk/metric/sdkapi/descriptor_test.go b/sdk/metric/sdkapi/descriptor_test.go deleted file mode 100644 index 1f084472535..00000000000 --- a/sdk/metric/sdkapi/descriptor_test.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/metric/unit" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -func TestDescriptorGetters(t *testing.T) { - d := NewDescriptor("name", HistogramInstrumentKind, number.Int64Kind, "my description", "my unit") - require.Equal(t, "name", d.Name()) - require.Equal(t, HistogramInstrumentKind, d.InstrumentKind()) - require.Equal(t, number.Int64Kind, d.NumberKind()) - require.Equal(t, "my description", d.Description()) - require.Equal(t, unit.Unit("my unit"), d.Unit()) -} diff --git a/sdk/metric/sdkapi/instrumentkind.go b/sdk/metric/sdkapi/instrumentkind.go deleted file mode 100644 index c7406a3e49a..00000000000 --- a/sdk/metric/sdkapi/instrumentkind.go +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:generate stringer -type=InstrumentKind - -package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" - -// InstrumentKind describes the kind of instrument. -type InstrumentKind int8 - -const ( - // HistogramInstrumentKind indicates a Histogram instrument. - HistogramInstrumentKind InstrumentKind = iota - // GaugeObserverInstrumentKind indicates an GaugeObserver instrument. - GaugeObserverInstrumentKind - - // CounterInstrumentKind indicates a Counter instrument. - CounterInstrumentKind - // UpDownCounterInstrumentKind indicates a UpDownCounter instrument. - UpDownCounterInstrumentKind - - // CounterObserverInstrumentKind indicates a CounterObserver instrument. - CounterObserverInstrumentKind - // UpDownCounterObserverInstrumentKind indicates a UpDownCounterObserver - // instrument. - UpDownCounterObserverInstrumentKind -) - -// Synchronous returns whether this is a synchronous kind of instrument. -func (k InstrumentKind) Synchronous() bool { - switch k { - case CounterInstrumentKind, UpDownCounterInstrumentKind, HistogramInstrumentKind: - return true - } - return false -} - -// Asynchronous returns whether this is an asynchronous kind of instrument. -func (k InstrumentKind) Asynchronous() bool { - return !k.Synchronous() -} - -// Adding returns whether this kind of instrument adds its inputs (as opposed to Grouping). -func (k InstrumentKind) Adding() bool { - switch k { - case CounterInstrumentKind, UpDownCounterInstrumentKind, CounterObserverInstrumentKind, UpDownCounterObserverInstrumentKind: - return true - } - return false -} - -// Grouping returns whether this kind of instrument groups its inputs (as opposed to Adding). -func (k InstrumentKind) Grouping() bool { - return !k.Adding() -} - -// Monotonic returns whether this kind of instrument exposes a non-decreasing sum. -func (k InstrumentKind) Monotonic() bool { - switch k { - case CounterInstrumentKind, CounterObserverInstrumentKind: - return true - } - return false -} - -// PrecomputedSum returns whether this kind of instrument receives precomputed sums. -func (k InstrumentKind) PrecomputedSum() bool { - return k.Adding() && k.Asynchronous() -} diff --git a/sdk/metric/sdkapi/instrumentkind_string.go b/sdk/metric/sdkapi/instrumentkind_string.go deleted file mode 100644 index 3a2e79d823e..00000000000 --- a/sdk/metric/sdkapi/instrumentkind_string.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by "stringer -type=InstrumentKind"; DO NOT EDIT. - -package sdkapi - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[HistogramInstrumentKind-0] - _ = x[GaugeObserverInstrumentKind-1] - _ = x[CounterInstrumentKind-2] - _ = x[UpDownCounterInstrumentKind-3] - _ = x[CounterObserverInstrumentKind-4] - _ = x[UpDownCounterObserverInstrumentKind-5] -} - -const _InstrumentKind_name = "HistogramInstrumentKindGaugeObserverInstrumentKindCounterInstrumentKindUpDownCounterInstrumentKindCounterObserverInstrumentKindUpDownCounterObserverInstrumentKind" - -var _InstrumentKind_index = [...]uint8{0, 23, 50, 71, 98, 127, 162} - -func (i InstrumentKind) String() string { - if i < 0 || i >= InstrumentKind(len(_InstrumentKind_index)-1) { - return "InstrumentKind(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _InstrumentKind_name[_InstrumentKind_index[i]:_InstrumentKind_index[i+1]] -} diff --git a/sdk/metric/sdkapi/instrumentkind_test.go b/sdk/metric/sdkapi/instrumentkind_test.go deleted file mode 100644 index cd1db02a898..00000000000 --- a/sdk/metric/sdkapi/instrumentkind_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -func TestInstrumentKinds(t *testing.T) { - require.Equal(t, sdkapi.HistogramInstrumentKind.String(), "HistogramInstrumentKind") - require.Equal(t, sdkapi.GaugeObserverInstrumentKind.String(), "GaugeObserverInstrumentKind") - require.Equal(t, sdkapi.CounterInstrumentKind.String(), "CounterInstrumentKind") - require.Equal(t, sdkapi.UpDownCounterInstrumentKind.String(), "UpDownCounterInstrumentKind") - require.Equal(t, sdkapi.CounterObserverInstrumentKind.String(), "CounterObserverInstrumentKind") - require.Equal(t, sdkapi.UpDownCounterObserverInstrumentKind.String(), "UpDownCounterObserverInstrumentKind") -} diff --git a/sdk/metric/sdkapi/noop.go b/sdk/metric/sdkapi/noop.go deleted file mode 100644 index 64a28d7b35d..00000000000 --- a/sdk/metric/sdkapi/noop.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/number" -) // import ( -// "context" - -// "go.opentelemetry.io/otel/attribute" -// "go.opentelemetry.io/otel/sdk/metric/number" -// ) - -type noopInstrument struct { - descriptor Descriptor -} -type noopSyncInstrument struct { - noopInstrument - - instrument.Synchronous -} -type noopAsyncInstrument struct { - noopInstrument - - instrument.Asynchronous -} - -var _ SyncImpl = noopSyncInstrument{} -var _ AsyncImpl = noopAsyncInstrument{} - -// NewNoopSyncInstrument returns a No-op implementation of the -// synchronous instrument interface. -func NewNoopSyncInstrument() SyncImpl { - return noopSyncInstrument{ - noopInstrument: noopInstrument{ - descriptor: Descriptor{ - instrumentKind: CounterInstrumentKind, - }, - }, - } -} - -// NewNoopAsyncInstrument returns a No-op implementation of the -// asynchronous instrument interface. -func NewNoopAsyncInstrument() AsyncImpl { - return noopAsyncInstrument{ - noopInstrument: noopInstrument{ - descriptor: Descriptor{ - instrumentKind: CounterObserverInstrumentKind, - }, - }, - } -} - -func (noopInstrument) Implementation() interface{} { - return nil -} - -func (n noopInstrument) Descriptor() Descriptor { - return n.descriptor -} - -func (noopSyncInstrument) RecordOne(context.Context, number.Number, []attribute.KeyValue) { -} - -func (noopAsyncInstrument) ObserveOne(context.Context, number.Number, []attribute.KeyValue) { -} diff --git a/sdk/metric/sdkapi/sdkapi.go b/sdk/metric/sdkapi/sdkapi.go deleted file mode 100644 index 86226c456db..00000000000 --- a/sdk/metric/sdkapi/sdkapi.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -// MeterImpl is the interface an SDK must implement to supply a Meter -// implementation. -type MeterImpl interface { - // NewSyncInstrument returns a newly constructed - // synchronous instrument implementation or an error, should - // one occur. - NewSyncInstrument(descriptor Descriptor) (SyncImpl, error) - - // NewAsyncInstrument returns a newly constructed - // asynchronous instrument implementation or an error, should - // one occur. - NewAsyncInstrument(descriptor Descriptor) (AsyncImpl, error) - - // Etc. - RegisterCallback(insts []instrument.Asynchronous, callback func(context.Context)) error -} - -// InstrumentImpl is a common interface for synchronous and -// asynchronous instruments. -type InstrumentImpl interface { - // Implementation returns the underlying implementation of the - // instrument, which allows the implementation to gain access - // to its own representation especially from a `Measurement`. - Implementation() interface{} - - // Descriptor returns a copy of the instrument's Descriptor. - Descriptor() Descriptor -} - -// SyncImpl is the implementation-level interface to a generic -// synchronous instrument (e.g., Histogram and Counter instruments). -type SyncImpl interface { - InstrumentImpl - instrument.Synchronous - - // RecordOne captures a single synchronous metric event. - RecordOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) -} - -// AsyncImpl is an implementation-level interface to an -// asynchronous instrument (e.g., Observer instruments). -type AsyncImpl interface { - InstrumentImpl - instrument.Asynchronous - - // ObserveOne captures a single synchronous metric event. - ObserveOne(ctx context.Context, n number.Number, attrs []attribute.KeyValue) -} - -// AsyncRunner is expected to convert into an AsyncSingleRunner or an -// AsyncBatchRunner. SDKs will encounter an error if the AsyncRunner -// does not satisfy one of these interfaces. -type AsyncRunner interface { - // AnyRunner is a non-exported method with no functional use - // other than to make this a non-empty interface. - AnyRunner() -} - -// AsyncSingleRunner is an interface implemented by single-observer -// callbacks. -type AsyncSingleRunner interface { - // Run accepts a single instrument and function for capturing - // observations of that instrument. Each call to the function - // receives one captured observation. (The function accepts - // multiple observations so the same implementation can be - // used for batch runners.) - Run(ctx context.Context, single AsyncImpl, capture func([]attribute.KeyValue, ...Observation)) - - AsyncRunner -} - -// AsyncBatchRunner is an interface implemented by batch-observer -// callbacks. -type AsyncBatchRunner interface { - // Run accepts a function for capturing observations of - // multiple instruments. - Run(ctx context.Context, capture func([]attribute.KeyValue, ...Observation)) - - AsyncRunner -} - -// NewMeasurement constructs a single observation, a binding between -// an asynchronous instrument and a number. -func NewMeasurement(inst SyncImpl, n number.Number) Measurement { - return Measurement{ - instrument: inst, - number: n, - } -} - -// Measurement is a low-level type used with synchronous instruments -// as a direct interface to the SDK via `RecordBatch`. -type Measurement struct { - // number needs to be aligned for 64-bit atomic operations. - number number.Number - instrument SyncImpl -} - -// SyncImpl returns the instrument that created this measurement. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (m Measurement) SyncImpl() SyncImpl { - return m.instrument -} - -// Number returns a number recorded in this measurement. -func (m Measurement) Number() number.Number { - return m.number -} - -// NewObservation constructs a single observation, a binding between -// an asynchronous instrument and a number. -func NewObservation(inst AsyncImpl, n number.Number) Observation { - return Observation{ - instrument: inst, - number: n, - } -} - -// Observation is a low-level type used with asynchronous instruments -// as a direct interface to the SDK via `BatchObserver`. -type Observation struct { - // number needs to be aligned for 64-bit atomic operations. - number number.Number - instrument AsyncImpl -} - -// AsyncImpl returns the instrument that created this observation. -// This returns an implementation-level object for use by the SDK, -// users should not refer to this. -func (m Observation) AsyncImpl() AsyncImpl { - return m.instrument -} - -// Number returns a number recorded in this observation. -func (m Observation) Number() number.Number { - return m.number -} diff --git a/sdk/metric/sdkapi/sdkapi_test.go b/sdk/metric/sdkapi/sdkapi_test.go deleted file mode 100644 index 69fec0fe692..00000000000 --- a/sdk/metric/sdkapi/sdkapi_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/number" -) - -func TestMeasurementGetters(t *testing.T) { - num := number.NewFloat64Number(1.5) - si := NewNoopSyncInstrument() - meas := NewMeasurement(si, num) - - require.Equal(t, si, meas.SyncImpl()) - require.Equal(t, num, meas.Number()) -} - -func TestObservationGetters(t *testing.T) { - num := number.NewFloat64Number(1.5) - ai := NewNoopAsyncInstrument() - obs := NewObservation(ai, num) - - require.Equal(t, ai, obs.AsyncImpl()) - require.Equal(t, num, obs.Number()) -} diff --git a/sdk/metric/sdkapi/wrap.go b/sdk/metric/sdkapi/wrap.go deleted file mode 100644 index aa6356f7e8f..00000000000 --- a/sdk/metric/sdkapi/wrap.go +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package sdkapi // import "go.opentelemetry.io/otel/sdk/metric/sdkapi" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" - "go.opentelemetry.io/otel/sdk/metric/number" -) - -type ( - meter struct{ MeterImpl } - sfMeter struct{ meter } - siMeter struct{ meter } - afMeter struct{ meter } - aiMeter struct{ meter } - - iAdder struct{ SyncImpl } - fAdder struct{ SyncImpl } - iRecorder struct{ SyncImpl } - fRecorder struct{ SyncImpl } - iObserver struct{ AsyncImpl } - fObserver struct{ AsyncImpl } -) - -// WrapMeterImpl wraps impl to be a full implementation of a Meter. -func WrapMeterImpl(impl MeterImpl) metric.Meter { - return meter{impl} -} - -// UnwrapMeterImpl unwraps the Meter to its bare MeterImpl. -func UnwrapMeterImpl(m metric.Meter) MeterImpl { - mm, ok := m.(meter) - if !ok { - return nil - } - return mm.MeterImpl -} - -func (m meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return afMeter{m} -} - -func (m meter) AsyncInt64() asyncint64.InstrumentProvider { - return aiMeter{m} -} - -func (m meter) SyncFloat64() syncfloat64.InstrumentProvider { - return sfMeter{m} -} - -func (m meter) SyncInt64() syncint64.InstrumentProvider { - return siMeter{m} -} - -func (m meter) RegisterCallback(insts []instrument.Asynchronous, cb func(ctx context.Context)) error { - return m.MeterImpl.RegisterCallback(insts, cb) -} - -func (m meter) newSync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (SyncImpl, error) { - cfg := instrument.NewConfig(opts...) - return m.NewSyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())) -} - -func (m meter) newAsync(name string, ikind InstrumentKind, nkind number.Kind, opts []instrument.Option) (AsyncImpl, error) { - cfg := instrument.NewConfig(opts...) - return m.NewAsyncInstrument(NewDescriptor(name, ikind, nkind, cfg.Description(), cfg.Unit())) -} - -func (m afMeter) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Float64Kind, opts) - return fObserver{inst}, err -} - -func (m afMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Float64Kind, opts) - return fObserver{inst}, err -} - -func (m afMeter) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Float64Kind, opts) - return fObserver{inst}, err -} - -func (m aiMeter) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - inst, err := m.newAsync(name, CounterObserverInstrumentKind, number.Int64Kind, opts) - return iObserver{inst}, err -} - -func (m aiMeter) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - inst, err := m.newAsync(name, UpDownCounterObserverInstrumentKind, number.Int64Kind, opts) - return iObserver{inst}, err -} - -func (m aiMeter) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - inst, err := m.newAsync(name, GaugeObserverInstrumentKind, number.Int64Kind, opts) - return iObserver{inst}, err -} - -func (m sfMeter) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - inst, err := m.newSync(name, CounterInstrumentKind, number.Float64Kind, opts) - return fAdder{inst}, err -} - -func (m sfMeter) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Float64Kind, opts) - return fAdder{inst}, err -} - -func (m sfMeter) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - inst, err := m.newSync(name, HistogramInstrumentKind, number.Float64Kind, opts) - return fRecorder{inst}, err -} - -func (m siMeter) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - inst, err := m.newSync(name, CounterInstrumentKind, number.Int64Kind, opts) - return iAdder{inst}, err -} - -func (m siMeter) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - inst, err := m.newSync(name, UpDownCounterInstrumentKind, number.Int64Kind, opts) - return iAdder{inst}, err -} - -func (m siMeter) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - inst, err := m.newSync(name, HistogramInstrumentKind, number.Int64Kind, opts) - return iRecorder{inst}, err -} - -func (a fAdder) Add(ctx context.Context, value float64, attrs ...attribute.KeyValue) { - if a.SyncImpl != nil { - a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs) - } -} - -func (a iAdder) Add(ctx context.Context, value int64, attrs ...attribute.KeyValue) { - if a.SyncImpl != nil { - a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs) - } -} - -func (a fRecorder) Record(ctx context.Context, value float64, attrs ...attribute.KeyValue) { - if a.SyncImpl != nil { - a.SyncImpl.RecordOne(ctx, number.NewFloat64Number(value), attrs) - } -} - -func (a iRecorder) Record(ctx context.Context, value int64, attrs ...attribute.KeyValue) { - if a.SyncImpl != nil { - a.SyncImpl.RecordOne(ctx, number.NewInt64Number(value), attrs) - } -} - -func (a fObserver) Observe(ctx context.Context, value float64, attrs ...attribute.KeyValue) { - if a.AsyncImpl != nil { - a.AsyncImpl.ObserveOne(ctx, number.NewFloat64Number(value), attrs) - } -} - -func (a iObserver) Observe(ctx context.Context, value int64, attrs ...attribute.KeyValue) { - if a.AsyncImpl != nil { - a.AsyncImpl.ObserveOne(ctx, number.NewInt64Number(value), attrs) - } -} diff --git a/sdk/metric/selector/simple/simple.go b/sdk/metric/selector/simple/simple.go deleted file mode 100644 index 5451072f607..00000000000 --- a/sdk/metric/selector/simple/simple.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package simple // import "go.opentelemetry.io/otel/sdk/metric/selector/simple" - -import ( - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" -) - -type ( - selectorInexpensive struct{} - selectorHistogram struct { - options []histogram.Option - } -) - -var ( - _ export.AggregatorSelector = selectorInexpensive{} - _ export.AggregatorSelector = selectorHistogram{} -) - -// NewWithInexpensiveDistribution returns a simple aggregator selector -// that uses minmaxsumcount aggregators for `Histogram` -// instruments. This selector is faster and uses less memory than the -// others in this package because minmaxsumcount aggregators maintain -// the least information about the distribution among these choices. -func NewWithInexpensiveDistribution() export.AggregatorSelector { - return selectorInexpensive{} -} - -// NewWithHistogramDistribution returns a simple aggregator selector -// that uses histogram aggregators for `Histogram` instruments. -// This selector is a good default choice for most metric exporters. -func NewWithHistogramDistribution(options ...histogram.Option) export.AggregatorSelector { - return selectorHistogram{options: options} -} - -func sumAggs(aggPtrs []*aggregator.Aggregator) { - aggs := sum.New(len(aggPtrs)) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } -} - -func lastValueAggs(aggPtrs []*aggregator.Aggregator) { - aggs := lastvalue.New(len(aggPtrs)) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } -} - -func (selectorInexpensive) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { - switch descriptor.InstrumentKind() { - case sdkapi.GaugeObserverInstrumentKind: - lastValueAggs(aggPtrs) - case sdkapi.HistogramInstrumentKind: - aggs := sum.New(len(aggPtrs)) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } - default: - sumAggs(aggPtrs) - } -} - -func (s selectorHistogram) AggregatorFor(descriptor *sdkapi.Descriptor, aggPtrs ...*aggregator.Aggregator) { - switch descriptor.InstrumentKind() { - case sdkapi.GaugeObserverInstrumentKind: - lastValueAggs(aggPtrs) - case sdkapi.HistogramInstrumentKind: - aggs := histogram.New(len(aggPtrs), descriptor, s.options...) - for i := range aggPtrs { - *aggPtrs[i] = &aggs[i] - } - default: - sumAggs(aggPtrs) - } -} diff --git a/sdk/metric/selector/simple/simple_test.go b/sdk/metric/selector/simple/simple_test.go deleted file mode 100644 index 9e946864e53..00000000000 --- a/sdk/metric/selector/simple/simple_test.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package simple_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric/aggregator" - "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram" - "go.opentelemetry.io/otel/sdk/metric/aggregator/lastvalue" - "go.opentelemetry.io/otel/sdk/metric/aggregator/sum" - "go.opentelemetry.io/otel/sdk/metric/export" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" - "go.opentelemetry.io/otel/sdk/metric/sdkapi" - "go.opentelemetry.io/otel/sdk/metric/selector/simple" -) - -var ( - testCounterDesc = metrictest.NewDescriptor("counter", sdkapi.CounterInstrumentKind, number.Int64Kind) - testUpDownCounterDesc = metrictest.NewDescriptor("updowncounter", sdkapi.UpDownCounterInstrumentKind, number.Int64Kind) - testCounterObserverDesc = metrictest.NewDescriptor("counterobserver", sdkapi.CounterObserverInstrumentKind, number.Int64Kind) - testUpDownCounterObserverDesc = metrictest.NewDescriptor("updowncounterobserver", sdkapi.UpDownCounterObserverInstrumentKind, number.Int64Kind) - testHistogramDesc = metrictest.NewDescriptor("histogram", sdkapi.HistogramInstrumentKind, number.Int64Kind) - testGaugeObserverDesc = metrictest.NewDescriptor("gauge", sdkapi.GaugeObserverInstrumentKind, number.Int64Kind) -) - -func oneAgg(sel export.AggregatorSelector, desc *sdkapi.Descriptor) aggregator.Aggregator { - var agg aggregator.Aggregator - sel.AggregatorFor(desc, &agg) - return agg -} - -func testFixedSelectors(t *testing.T, sel export.AggregatorSelector) { - require.IsType(t, (*lastvalue.Aggregator)(nil), oneAgg(sel, &testGaugeObserverDesc)) - require.IsType(t, (*sum.Aggregator)(nil), oneAgg(sel, &testCounterDesc)) - require.IsType(t, (*sum.Aggregator)(nil), oneAgg(sel, &testUpDownCounterDesc)) - require.IsType(t, (*sum.Aggregator)(nil), oneAgg(sel, &testCounterObserverDesc)) - require.IsType(t, (*sum.Aggregator)(nil), oneAgg(sel, &testUpDownCounterObserverDesc)) -} - -func TestInexpensiveDistribution(t *testing.T) { - inex := simple.NewWithInexpensiveDistribution() - require.IsType(t, (*sum.Aggregator)(nil), oneAgg(inex, &testHistogramDesc)) - testFixedSelectors(t, inex) -} - -func TestHistogramDistribution(t *testing.T) { - hist := simple.NewWithHistogramDistribution() - require.IsType(t, (*histogram.Aggregator)(nil), oneAgg(hist, &testHistogramDesc)) - testFixedSelectors(t, hist) -} diff --git a/sdk/metric/view/doc.go b/sdk/metric/view/doc.go new file mode 100644 index 00000000000..e92e57aed10 --- /dev/null +++ b/sdk/metric/view/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package view provides types and functionality that customize the metric +// telemetry an SDK will produce. The View type is used when a Reader is +// registered with a MeterProvider in the go.opentelemetry.io/otel/sdk/metric +// package. See the WithReader option in that package for more information on +// how this registration takes place. +package view // import "go.opentelemetry.io/otel/sdk/metric/view" diff --git a/sdk/metric/view/example_test.go b/sdk/metric/view/example_test.go new file mode 100644 index 00000000000..bf2480055fc --- /dev/null +++ b/sdk/metric/view/example_test.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package view // import "go.opentelemetry.io/otel/sdk/metric/view" + +import ( + "fmt" + + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +func Example() { + // The "active-users" instrument created by the + // "github.com/super/noisy/instrumentation/package" your project includes + // has a bug, it records a measurment any time a user has any activity. + // This is causing a lot of strain on your program without providing any + // value to you. The next version of + // "github.com/super/noisy/instrumentation/package" corrects the + // instrumentation to only record a value when a user logs in, but it + // isn't out yet. + // + // Use a View to drop these measurments while you wait for the fix to come + // from upstream. + + v, err := New( + MatchInstrumentName("active-users"), + MatchInstrumentationScope(instrumentation.Scope{ + Name: "github.com/super/noisy/instrumentation/package", + Version: "v0.22.0", // Only match the problematic instrumentation version. + }), + WithSetAggregation(aggregation.Drop{}), + ) + if err != nil { + panic(err) + } + + // The SDK this view is registered with calls TransformInstrument when an + // instrument is created. Test that our fix will work as intended. + i, _ := v.TransformInstrument(Instrument{ + Name: "active-users", + Scope: instrumentation.Scope{ + Name: "github.com/super/noisy/instrumentation/package", + Version: "v0.22.0", + }, + Aggregation: aggregation.LastValue{}, + }) + fmt.Printf("Instrument{%q: %s}: %#v\n", i.Name, i.Scope.Version, i.Aggregation) + + // Also, ensure the next version will not be transformed. + _, ok := v.TransformInstrument(Instrument{ + Name: "active-users", + Scope: instrumentation.Scope{ + Name: "github.com/super/noisy/instrumentation/package", + Version: "v0.23.0", + }, + Aggregation: aggregation.LastValue{}, + }) + fmt.Printf("Instrument{\"active-users\": v0.23.0} matched: %t\n", ok) + // Output: + // + // Instrument{"active-users": v0.22.0}: aggregation.Drop{} + // Instrument{"active-users": v0.23.0} matched: false +} + +func ExampleMatchInstrumentName() { + v, err := New(MatchInstrumentName("request-*")) // Wildcard match. + if err != nil { + panic(err) + } + + for _, i := range []Instrument{ + {Name: "request-count"}, + {Name: "request-rate"}, + {Name: "latency"}, + } { + // The SDK calls TransformInstrument when an instrument is created. + _, ok := v.TransformInstrument(i) + fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) + } + // Output: + // Instrument{"request-count"} matched: true + // Instrument{"request-rate"} matched: true + // Instrument{"latency"} matched: false +} + +func ExampleMatchInstrumentKind() { + v, err := New(MatchInstrumentKind(SyncCounter)) + if err != nil { + panic(err) + } + + for _, i := range []Instrument{ + {Name: "synchronous counter", Kind: SyncCounter}, + {Name: "synchronous histogram", Kind: SyncHistogram}, + {Name: "asynchronous counter", Kind: AsyncCounter}, + } { + // The SDK calls TransformInstrument when an instrument is created. + _, ok := v.TransformInstrument(i) + fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) + } + // Output: + // Instrument{"synchronous counter"} matched: true + // Instrument{"synchronous histogram"} matched: false + // Instrument{"asynchronous counter"} matched: false +} + +func ExampleMatchInstrumentationScope() { + v, err := New(MatchInstrumentationScope(instrumentation.Scope{ + Name: "custom/instrumentation/package", + Version: "v0.22.0", // Only match this version of instrumentation. + })) + if err != nil { + panic(err) + } + + for _, i := range []Instrument{ + {Name: "v1.0.0 instrumentation", Scope: instrumentation.Scope{ + Name: "custom/instrumentation/package", + Version: "v1.0.0", + }}, + {Name: "v0.22.0 instrumentation", Scope: instrumentation.Scope{ + Name: "custom/instrumentation/package", + Version: "v0.22.0", + }}, + } { + // The SDK calls TransformInstrument when an instrument is created. + _, ok := v.TransformInstrument(i) + fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) + } + // Output: + // Instrument{"v1.0.0 instrumentation"} matched: false + // Instrument{"v0.22.0 instrumentation"} matched: true +} + +func ExampleWithRename() { + v, err := New(MatchInstrumentName("bad-name"), WithRename("good-name")) + if err != nil { + panic(err) + } + + // The SDK calls TransformInstrument when an instrument is created. + i, _ := v.TransformInstrument(Instrument{Name: "bad-name"}) + fmt.Printf("Instrument{%q}\n", i.Name) + // Output: Instrument{"good-name"} +} + +func ExampleWithSetDescription() { + v, err := New( + MatchInstrumentName("requests"), + WithSetDescription("Number of requests received"), + ) + if err != nil { + panic(err) + } + + // The SDK calls TransformInstrument when an instrument is created. + i, _ := v.TransformInstrument(Instrument{ + Name: "requests", + Description: "incorrect description", + }) + fmt.Printf("Instrument{%q: %s}\n", i.Name, i.Description) + // Output: Instrument{"requests": Number of requests received} +} + +func ExampleWithSetAggregation() { + v, err := New(MatchInstrumentationScope(instrumentation.Scope{ + Name: "super/noisy/instrumentation/package", + }), WithSetAggregation(aggregation.Drop{})) + if err != nil { + panic(err) + } + + // The SDK calls TransformInstrument when an instrument is created. + i, _ := v.TransformInstrument(Instrument{ + Name: "active-users", + Scope: instrumentation.Scope{ + Name: "super/noisy/instrumentation/package", + Version: "v0.5.0", + }, + Aggregation: aggregation.LastValue{}, + }) + fmt.Printf("Instrument{%q}: %#v\n", i.Name, i.Aggregation) + // Output: Instrument{"active-users"}: aggregation.Drop{} +} diff --git a/exporters/otlp/otlpmetric/internal/metrictransform/resource.go b/sdk/metric/view/instrument.go similarity index 59% rename from exporters/otlp/otlpmetric/internal/metrictransform/resource.go rename to sdk/metric/view/instrument.go index dbf0c5e490a..e024b37a6ff 100644 --- a/exporters/otlp/otlpmetric/internal/metrictransform/resource.go +++ b/sdk/metric/view/instrument.go @@ -12,17 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metrictransform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/metrictransform" +//go:build go1.18 +// +build go1.18 + +package view // import "go.opentelemetry.io/otel/sdk/metric/view" import ( - "go.opentelemetry.io/otel/sdk/resource" - resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" ) -// Resource transforms a Resource into an OTLP Resource. -func Resource(r *resource.Resource) *resourcepb.Resource { - if r == nil { - return nil - } - return &resourcepb.Resource{Attributes: ResourceAttributes(r)} +// Instrument uniquely identifies an instrument within a meter. +type Instrument struct { + Scope instrumentation.Scope + + Name string + Description string + Kind InstrumentKind + Aggregation aggregation.Aggregation } diff --git a/sdk/metric/view/instrumentkind.go b/sdk/metric/view/instrumentkind.go new file mode 100644 index 00000000000..d5fc67953f9 --- /dev/null +++ b/sdk/metric/view/instrumentkind.go @@ -0,0 +1,46 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package view // import "go.opentelemetry.io/otel/sdk/metric/view" + +// InstrumentKind describes the kind of instrument a Meter can create. +type InstrumentKind uint8 + +// These are all the instrument kinds supported by the SDK. +const ( + // undefinedInstrument is an uninitialized instrument kind, should not be used. + //nolint:deadcode,varcheck + undefinedInstrument InstrumentKind = iota + // SyncCounter is an instrument kind that records increasing values + // synchronously in application code. + SyncCounter + // SyncUpDownCounter is an instrument kind that records increasing and + // decreasing values synchronously in application code. + SyncUpDownCounter + // SyncHistogram is an instrument kind that records a distribution of + // values synchronously in application code. + SyncHistogram + // AsyncCounter is an instrument kind that records increasing values in an + // asynchronous callback. + AsyncCounter + // AsyncUpDownCounter is an instrument kind that records increasing and + // decreasing values in an asynchronous callback. + AsyncUpDownCounter + // AsyncGauge is an instrument kind that records current values in an + // asynchronous callback. + AsyncGauge +) diff --git a/sdk/metric/view/view.go b/sdk/metric/view/view.go new file mode 100644 index 00000000000..946d7755230 --- /dev/null +++ b/sdk/metric/view/view.go @@ -0,0 +1,235 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package view // import "go.opentelemetry.io/otel/sdk/metric/view" + +import ( + "fmt" + "regexp" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +// View provides users with the flexibility to customize the metrics that are +// output by the SDK. A View can be used to ignore, change the name, +// description, and aggregation of, and customize which attribute(s) are to be +// reported by Instruments. +// +// An empty View will match all instruments, and do no transformations. +type View struct { + instrumentName *regexp.Regexp + hasWildcard bool + scope instrumentation.Scope + instrumentKind InstrumentKind + + filter attribute.Filter + name string + description string + agg aggregation.Aggregation +} + +// New returns a new configured View. If there are any duplicate Options passed, +// the last one passed will take precedence. The unique, de-duplicated, +// Options are all applied to the View. An instrument needs to match all of +// the match Options passed for the View to be applied to it. Similarly, all +// transform operation Options are applied to matched Instruments. +func New(opts ...Option) (View, error) { + v := View{} + + for _, opt := range opts { + v = opt.apply(v) + } + + emptyScope := instrumentation.Scope{} + if v.instrumentName == nil && + v.scope == emptyScope && + v.instrumentKind == undefinedInstrument { + return View{}, fmt.Errorf("must provide at least 1 match option") + } + + if v.hasWildcard && v.name != "" { + return View{}, fmt.Errorf("invalid view: view name specified for multiple instruments") + } + + return v, nil +} + +// TransformInstrument will check if an instrument matches this view +// and will convert it if it does. +func (v View) TransformInstrument(inst Instrument) (transformed Instrument, match bool) { + if !v.match(inst) { + return Instrument{}, false + } + if v.name != "" { + inst.Name = v.name + } + if v.description != "" { + inst.Description = v.description + } + if v.agg != nil { + inst.Aggregation = v.agg + } + return inst, true +} + +// AttributeFilter returns a function that returns only attributes specified by +// WithFilterAttributes. If no filter was provided nil is returned. +func (v View) AttributeFilter() func(attribute.Set) attribute.Set { + if v.filter == nil { + return nil + } + return func(input attribute.Set) attribute.Set { + out, _ := input.Filter(v.filter) + return out + } +} + +func (v View) matchName(name string) bool { + return v.instrumentName == nil || v.instrumentName.MatchString(name) +} + +func (v View) matchScopeName(name string) bool { + return v.scope.Name == "" || name == v.scope.Name +} + +func (v View) matchScopeVersion(version string) bool { + return v.scope.Version == "" || version == v.scope.Version +} + +func (v View) matchScopeSchemaURL(schemaURL string) bool { + return v.scope.SchemaURL == "" || schemaURL == v.scope.SchemaURL +} + +func (v View) matchInstrumentKind(kind InstrumentKind) bool { + return v.instrumentKind == undefinedInstrument || kind == v.instrumentKind +} + +func (v View) match(i Instrument) bool { + return v.matchName(i.Name) && + v.matchScopeName(i.Scope.Name) && + v.matchScopeSchemaURL(i.Scope.SchemaURL) && + v.matchScopeVersion(i.Scope.Version) && + v.matchInstrumentKind(i.Kind) +} + +// Option applies a configuration option value to a View. +type Option interface { + apply(View) View +} + +type optionFunc func(View) View + +func (f optionFunc) apply(v View) View { + return f(v) +} + +// MatchInstrumentName will match an instrument based on the its name. +// This will accept wildcards of * for zero or more characters, and ? for +// exactly one character. A name of "*" (default) will match all instruments. +func MatchInstrumentName(name string) Option { + return optionFunc(func(v View) View { + if strings.ContainsAny(name, "*?") { + v.hasWildcard = true + } + name = regexp.QuoteMeta(name) + name = "^" + name + "$" + name = strings.ReplaceAll(name, "\\?", ".") + name = strings.ReplaceAll(name, "\\*", ".*") + v.instrumentName = regexp.MustCompile(name) + return v + }) +} + +// MatchInstrumentKind with match an instrument based on the instrument's kind. +// The default is to match all instrument kinds. +func MatchInstrumentKind(kind InstrumentKind) Option { + return optionFunc(func(v View) View { + v.instrumentKind = kind + return v + }) +} + +// MatchInstrumentationScope will do an exact match on any +// instrumentation.Scope field that is non-empty (""). The default is to match all +// instrumentation scopes. +func MatchInstrumentationScope(scope instrumentation.Scope) Option { + return optionFunc(func(v View) View { + v.scope = scope + return v + }) +} + +// WithRename will rename the instrument the view matches. If not used or empty the +// instrument name will not be changed. Must be used with a non-wildcard +// instrument name match. The default does not change the instrument name. +func WithRename(name string) Option { + return optionFunc(func(v View) View { + v.name = name + return v + }) +} + +// WithSetDescription will change the description of the instruments the view +// matches to desc. If not used or empty the description will not be changed. +func WithSetDescription(desc string) Option { + return optionFunc(func(v View) View { + v.description = desc + return v + }) +} + +// WithFilterAttributes will select attributes that have a matching key. If not used +// or empty no filter will be applied. +func WithFilterAttributes(keys ...attribute.Key) Option { + return optionFunc(func(v View) View { + if len(keys) == 0 { + return v + } + filterKeys := map[attribute.Key]struct{}{} + for _, key := range keys { + filterKeys[key] = struct{}{} + } + + v.filter = attribute.Filter(func(kv attribute.KeyValue) bool { + _, ok := filterKeys[kv.Key] + return ok + }) + return v + }) +} + +// WithSetAggregation will use the aggregation a for matching instruments. If +// this option is not provided, the reader defined aggregation for the +// instrument will be used. +// +// If a is misconfigured, it will not be used and an error will be logged. +func WithSetAggregation(a aggregation.Aggregation) Option { + cpA := a.Copy() + if err := cpA.Err(); err != nil { + global.Error(err, "not using aggregation with view", "aggregation", a) + return optionFunc(func(v View) View { return v }) + } + + return optionFunc(func(v View) View { + v.agg = cpA + return v + }) +} diff --git a/sdk/metric/view/view_test.go b/sdk/metric/view/view_test.go new file mode 100644 index 00000000000..c461bf14a9b --- /dev/null +++ b/sdk/metric/view/view_test.go @@ -0,0 +1,447 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package view // import "go.opentelemetry.io/otel/sdk/metric/view" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/instrumentation" +) + +var matchInstrument = Instrument{ + Scope: instrumentation.Scope{ + Name: "bar", + Version: "v1.0.0", + SchemaURL: "stuff.test/", + }, + Name: "foo", + Kind: SyncCounter, + Description: "", +} + +var noMatchInstrument = Instrument{ + Scope: instrumentation.Scope{ + Name: "notfoo", + Version: "v0.x.0", + SchemaURL: "notstuff.test/", + }, + Name: "notstuff", + Description: "", + Kind: undefinedInstrument, +} + +var emptyDescription = Instrument{} + +func TestViewTransformInstrument(t *testing.T) { + tests := []struct { + name string + options []Option + match Instrument + notMatch Instrument + }{ + { + name: "instrument name", + options: []Option{ + MatchInstrumentName("foo"), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "Scope name", + options: []Option{ + MatchInstrumentationScope(instrumentation.Scope{ + Name: "bar", + }), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "Scope version", + options: []Option{ + MatchInstrumentationScope(instrumentation.Scope{ + Version: "v1.0.0", + }), + }, + + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "Scope SchemaURL", + options: []Option{ + MatchInstrumentationScope(instrumentation.Scope{ + SchemaURL: "stuff.test/", + }), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, { + name: "instrument kind", + options: []Option{ + MatchInstrumentKind(SyncCounter), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "Expands *", + options: []Option{ + MatchInstrumentName("f*"), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "composite literal name", + options: []Option{ + MatchInstrumentName("foo"), + MatchInstrumentationScope(instrumentation.Scope{ + Name: "bar", + Version: "v1.0.0", + SchemaURL: "stuff.test/", + }), + }, + match: matchInstrument, + notMatch: emptyDescription, + }, + { + name: "rename", + options: []Option{ + MatchInstrumentName("foo"), + WithRename("baz"), + }, + match: Instrument{ + Scope: instrumentation.Scope{ + Name: "bar", + Version: "v1.0.0", + SchemaURL: "stuff.test/", + }, + Name: "baz", + Description: "", + Kind: SyncCounter, + }, + notMatch: emptyDescription, + }, + { + name: "change description", + options: []Option{ + MatchInstrumentName("foo"), + WithSetDescription("descriptive stuff"), + }, + match: Instrument{ + Scope: instrumentation.Scope{ + Name: "bar", + Version: "v1.0.0", + SchemaURL: "stuff.test/", + }, + Name: "foo", + Description: "descriptive stuff", + Kind: SyncCounter, + }, + notMatch: emptyDescription, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v, err := New(tt.options...) + require.NoError(t, err) + + t.Run("match", func(t *testing.T) { + got, match := v.TransformInstrument(matchInstrument) + assert.Equal(t, tt.match, got) + assert.True(t, match) + }) + + t.Run("does not match", func(t *testing.T) { + got, match := v.TransformInstrument(noMatchInstrument) + assert.Equal(t, tt.notMatch, got) + assert.False(t, match) + }) + }) + } +} + +func TestViewMatchName(t *testing.T) { + tests := []struct { + name string + matchName string + matches []string + notMatches []string + hasWildcard bool + }{ + { + name: "exact", + matchName: "foo", + matches: []string{"foo"}, + notMatches: []string{"foobar", "barfoo", "barfoobaz"}, + hasWildcard: false, + }, + { + name: "*", + matchName: "*", + matches: []string{"foo", "foobar", "barfoo", "barfoobaz", ""}, + notMatches: []string{}, + hasWildcard: true, + }, + { + name: "front ?", + matchName: "?foo", + matches: []string{"1foo", "afoo"}, + notMatches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, + hasWildcard: true, + }, + { + name: "back ?", + matchName: "foo?", + matches: []string{"foo1", "fooz"}, + notMatches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, + hasWildcard: true, + }, + { + name: "front *", + matchName: "*foo", + matches: []string{"foo", "barfoo"}, + notMatches: []string{"foobar", "barfoobaz"}, + hasWildcard: true, + }, + { + name: "back *", + matchName: "foo*", + matches: []string{"foo", "foobar"}, + notMatches: []string{"barfoo", "barfoobaz"}, + hasWildcard: true, + }, + { + name: "both *", + matchName: "*foo*", + matches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, + notMatches: []string{"baz"}, + hasWildcard: true, + }, + { + name: "front **", + matchName: "**foo", + matches: []string{"foo", "barfoo", "1foo", "afoo"}, + notMatches: []string{"foobar", "barfoobaz", "baz", "foo1", "fooz"}, + hasWildcard: true, + }, + { + name: "back **", + matchName: "foo**", + matches: []string{"foo", "foobar", "foo1", "fooz"}, + notMatches: []string{"barfoo", "barfoobaz", "baz", "1foo", "afoo"}, + hasWildcard: true, + }, + { + name: "front *?", + matchName: "*?foo", + matches: []string{"barfoo", "1foo", "afoo"}, + notMatches: []string{"foo", "foobar", "barfoobaz", "baz", "foo1", "fooz"}, + hasWildcard: true, + }, + { + name: "front ?*", + matchName: "?*foo", + matches: []string{"barfoo", "1foo", "afoo"}, + notMatches: []string{"foo", "foobar", "barfoobaz", "baz", "foo1", "fooz"}, + hasWildcard: true, + }, + { + name: "back *?", + matchName: "foo*?", + matches: []string{"foobar", "foo1", "fooz"}, + notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo"}, + hasWildcard: true, + }, + { + name: "back ?*", + matchName: "foo?*", + matches: []string{"foobar", "foo1", "fooz"}, + notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo"}, + hasWildcard: true, + }, + { + name: "middle *", + matchName: "foo*bar", + matches: []string{"foobar", "foo1bar", "foomanybar"}, + notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz"}, + hasWildcard: true, + }, + { + name: "middle ?", + matchName: "foo?bar", + matches: []string{"foo1bar", "fooabar"}, + notMatches: []string{"foobar", "foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz", "foomanybar"}, + hasWildcard: true, + }, + { + name: "meta chars", + matchName: ".+()|[]{}^$-_", + matches: []string{".+()|[]{}^$-_"}, // Note this is not a valid name. + notMatches: []string{"foobar", "foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz", "foomanybar", "foo1bar", "fooabar"}, + hasWildcard: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v, err := New(MatchInstrumentName(tt.matchName)) + require.NoError(t, err) + + t.Log(v.instrumentName.String()) + assert.Equal(t, tt.hasWildcard, v.hasWildcard) + for _, name := range tt.matches { + assert.Truef(t, v.matchName(name), "name: %s", name) + } + for _, name := range tt.notMatches { + assert.Falsef(t, v.matchName(name), "name: %s", name) + } + }) + } +} + +func TestViewAttributeFilterNoFilter(t *testing.T) { + v, err := New( + MatchInstrumentName("*"), + ) + require.NoError(t, err) + filter := v.AttributeFilter() + assert.Nil(t, filter) + + v, err = New( + MatchInstrumentName("*"), + WithFilterAttributes(), + ) + require.NoError(t, err) + filter = v.AttributeFilter() + assert.Nil(t, filter) + + v, err = New( + MatchInstrumentName("*"), + WithFilterAttributes([]attribute.Key{}...), + ) + require.NoError(t, err) + filter = v.AttributeFilter() + assert.Nil(t, filter) +} + +func TestViewAttributeFilter(t *testing.T) { + inputSet := attribute.NewSet( + attribute.String("foo", "bar"), + attribute.Int("power-level", 9001), + attribute.Float64("lifeUniverseEverything", 42.0), + ) + + tests := []struct { + name string + filter []attribute.Key + want attribute.Set + }{ + { + name: "Match 1", + filter: []attribute.Key{ + attribute.Key("power-level"), + }, + want: attribute.NewSet( + attribute.Int("power-level", 9001), + ), + }, + { + name: "Match 2", + filter: []attribute.Key{ + attribute.Key("foo"), + attribute.Key("lifeUniverseEverything"), + }, + want: attribute.NewSet( + attribute.Float64("lifeUniverseEverything", 42.0), + attribute.String("foo", "bar"), + ), + }, + { + name: "Don't match", + filter: []attribute.Key{ + attribute.Key("nothing"), + }, + want: attribute.NewSet(), + }, + { + name: "Match some", + filter: []attribute.Key{ + attribute.Key("power-level"), + attribute.Key("nothing"), + }, + want: attribute.NewSet( + attribute.Int("power-level", 9001), + ), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v, err := New( + MatchInstrumentName("*"), + WithFilterAttributes(tt.filter...), + ) + require.NoError(t, err) + filter := v.AttributeFilter() + require.NotNil(t, filter) + + got := filter(inputSet) + assert.Equal(t, got.Equivalent(), tt.want.Equivalent()) + }) + } +} + +func TestNewErrors(t *testing.T) { + tests := []struct { + name string + options []Option + }{ + { + name: "No Match Option", + options: []Option{}, + }, + { + name: "Match * with view name", + options: []Option{ + MatchInstrumentName("*"), + WithRename("newName"), + }, + }, + { + name: "Match expand * with view name", + options: []Option{ + MatchInstrumentName("old*"), + WithRename("newName"), + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := New(tt.options...) + + assert.Equal(t, View{}, got) + assert.Error(t, err) + }) + } +} From 8af1d31c72dd650e768ec278022bcec44bba9657 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 16 Sep 2022 07:48:24 -0700 Subject: [PATCH 231/886] Remove abandoned tooling code (#3171) This function and its use are now hosed in the opentelemetry-go-build-tools project. Co-authored-by: Chester Cheung --- internal/tools/common.go | 124 --------------------------------------- internal/tools/go.mod | 2 +- 2 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 internal/tools/common.go diff --git a/internal/tools/common.go b/internal/tools/common.go deleted file mode 100644 index 0c7389934ca..00000000000 --- a/internal/tools/common.go +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package tools provides helper functions used in scripts within the -// internal/tools module, as well as imports needed for a build with the -// "tools" build tag. -package tools // import "go.opentelemetry.io/otel/internal/tools" - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - "text/tabwriter" - - "golang.org/x/mod/modfile" -) - -// Repo represents a git repository. -type Repo string - -// FindRepoRoot retrieves the root of the repository containing the current -// working directory. Beginning at the current working directory (dir), the -// algorithm checks if joining the ".git" suffix, such as "dir.get", is a -// valid file. Otherwise, it will continue checking the dir's parent directory -// until it reaches the repo root or returns an error if it cannot be found. -func FindRepoRoot() (Repo, error) { - start, err := os.Getwd() - if err != nil { - return "", err - } - - dir := start - for { - _, err := os.Stat(filepath.Join(dir, ".git")) - if errors.Is(err, os.ErrNotExist) { - dir = filepath.Dir(dir) - // From https://golang.org/pkg/path/filepath/#Dir: - // The returned path does not end in a separator unless it is the root directory. - if strings.HasSuffix(dir, string(filepath.Separator)) { - return "", fmt.Errorf("unable to find git repository enclosing working dir %s", start) - } - continue - } - - if err != nil { - return "", err - } - - return Repo(dir), nil - } -} - -// FindModules returns all Go modules contained in Repo r. -func (r Repo) FindModules() ([]*modfile.File, error) { - var results []*modfile.File - err := filepath.Walk(string(r), func(path string, info os.FileInfo, walkErr error) error { - if walkErr != nil { - // Walk failed to walk into this directory. Stop walking and - // signal this error. - return walkErr - } - - if !info.IsDir() { - return nil - } - - goMod := filepath.Join(path, "go.mod") - f, err := os.Open(goMod) - if errors.Is(err, os.ErrNotExist) { - return nil - } - if err != nil { - return err - } - - var b bytes.Buffer - io.Copy(&b, f) - if err = f.Close(); err != nil { - return err - } - - mFile, err := modfile.Parse(goMod, b.Bytes(), nil) - if err != nil { - return err - } - results = append(results, mFile) - return nil - }) - - sort.SliceStable(results, func(i, j int) bool { - return results[i].Syntax.Name < results[j].Syntax.Name - }) - - return results, err -} - -func PrintModFiles(w io.Writer, mFiles []*modfile.File) error { - tw := tabwriter.NewWriter(w, 0, 0, 1, ' ', 0) - if _, err := fmt.Fprintln(tw, "FILE PATH\tIMPORT PATH"); err != nil { - return err - } - for _, m := range mFiles { - if _, err := fmt.Fprintf(tw, "%s\t%s\n", m.Syntax.Name, m.Module.Mod.Path); err != nil { - return err - } - } - return tw.Flush() -} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 1762c2f3db2..621cd99bb11 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,6 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 golang.org/x/tools v0.1.12 ) @@ -182,6 +181,7 @@ require ( go.uber.org/zap v1.21.0 // indirect golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect From e1a1f07e44e9a111b78f6cad01365cbe5813aa15 Mon Sep 17 00:00:00 2001 From: ttd2089 <64158840+ttd2089@users.noreply.github.com> Date: Fri, 16 Sep 2022 12:08:21 -0300 Subject: [PATCH 232/886] docs: grammar (#3167) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- website_docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 5cea707e9f0..e1eb4457fec 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -5,7 +5,7 @@ weight: 2 Welcome to the OpenTelemetry for Go getting started guide! This guide will walk you through the basic steps in installing, instrumenting with, configuring, and exporting data from OpenTelemetry. Before you get started, be sure to have Go 1.16 or newer installed. -Understand how a system is functioning when it is failing or having issues is critical to resolving those issues. One strategy to understand this is with tracing. This guide shows how the OpenTelemetry Go project can be used to trace an example application. You will start with an application that computes Fibonacci numbers for users, and from there you will add instrumentation to produce tracing telemetry with OpenTelemetry Go. +Understanding how a system is functioning when it is failing or having issues is critical to resolving those issues. One strategy to understand this is with tracing. This guide shows how the OpenTelemetry Go project can be used to trace an example application. You will start with an application that computes Fibonacci numbers for users, and from there you will add instrumentation to produce tracing telemetry with OpenTelemetry Go. For reference, a complete example of the code you will build can be found [here](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/fib). From 30fcf786c3d802e39bdc7ede5dc928da1318f3b1 Mon Sep 17 00:00:00 2001 From: Chester Cheung Date: Sun, 18 Sep 2022 03:54:12 +0800 Subject: [PATCH 233/886] bugfix: fix baggage set member failed (#3165) * fix baggage set member failed * add unittest * fix unittest * rewrite unittest code --- baggage/baggage.go | 2 ++ baggage/baggage_test.go | 72 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/baggage/baggage.go b/baggage/baggage.go index eba180e04f8..9869fa84304 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -465,6 +465,7 @@ func (b Baggage) Member(key string) Member { key: key, value: v.Value, properties: fromInternalProperties(v.Properties), + hasData: true, } } @@ -484,6 +485,7 @@ func (b Baggage) Members() []Member { key: k, value: v.Value, properties: fromInternalProperties(v.Properties), + hasData: true, }) } return members diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 609d6d05de9..77b219e8599 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -589,6 +589,74 @@ func TestBaggageSetMember(t *testing.T) { assert.Equal(t, 2, len(b4.list)) } +func TestBaggageSetFalseMember(t *testing.T) { + b0 := Baggage{} + + key := "k" + m := Member{key: key, hasData: false} + b1, err := b0.SetMember(m) + assert.Error(t, err) + assert.NotContains(t, b0.list, key) + assert.Equal(t, baggage.Item{}, b1.list[key]) + assert.Equal(t, 0, len(b0.list)) + assert.Equal(t, 0, len(b1.list)) + + m.value = "v" + b2, err := b1.SetMember(m) + assert.Error(t, err) + assert.Equal(t, baggage.Item{}, b1.list[key]) + assert.Equal(t, baggage.Item{Value: ""}, b2.list[key]) + assert.Equal(t, 0, len(b1.list)) + assert.Equal(t, 0, len(b2.list)) +} + +func TestBaggageSetFalseMembers(t *testing.T) { + b0 := Baggage{} + + key := "k" + m := Member{key: key, hasData: true} + b1, err := b0.SetMember(m) + assert.NoError(t, err) + assert.NotContains(t, b0.list, key) + assert.Equal(t, baggage.Item{}, b1.list[key]) + assert.Equal(t, 0, len(b0.list)) + assert.Equal(t, 1, len(b1.list)) + + m.value = "v" + b2, err := b1.SetMember(m) + assert.NoError(t, err) + assert.Equal(t, baggage.Item{}, b1.list[key]) + assert.Equal(t, baggage.Item{Value: "v"}, b2.list[key]) + assert.Equal(t, 1, len(b1.list)) + assert.Equal(t, 1, len(b2.list)) + + p := properties{{key: "p", hasData: false}} + m.properties = p + b3, err := b2.SetMember(m) + assert.NoError(t, err) + assert.Equal(t, baggage.Item{Value: "v"}, b2.list[key]) + assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) + assert.Equal(t, 1, len(b2.list)) + assert.Equal(t, 1, len(b3.list)) + + // The returned baggage needs to be immutable and should use a copy of the + // properties slice. + p[0] = Property{key: "different", hasData: false} + assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) + // Reset for below. + p[0] = Property{key: "p", hasData: false} + + m = Member{key: "another", hasData: false} + b4, err := b3.SetMember(m) + assert.Error(t, err) + assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) + assert.NotContains(t, b3.list, m.key) + assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b4.list[key]) + assert.Equal(t, baggage.Item{}, b4.list[m.key]) + assert.Equal(t, 1, len(b3.list)) + assert.Equal(t, 1, len(b4.list)) +} + func TestNilBaggageMembers(t *testing.T) { assert.Nil(t, Baggage{}.Members()) } @@ -602,6 +670,7 @@ func TestBaggageMembers(t *testing.T) { {key: "state", value: "on", hasValue: true}, {key: "red"}, }, + hasData: true, }, { key: "bar", @@ -609,6 +678,7 @@ func TestBaggageMembers(t *testing.T) { properties: properties{ {key: "yellow"}, }, + hasData: true, }, } @@ -631,7 +701,7 @@ func TestBaggageMembers(t *testing.T) { func TestBaggageMember(t *testing.T) { bag := Baggage{list: baggage.List{"foo": {Value: "1"}}} - assert.Equal(t, Member{key: "foo", value: "1"}, bag.Member("foo")) + assert.Equal(t, Member{key: "foo", value: "1", hasData: true}, bag.Member("foo")) assert.Equal(t, Member{}, bag.Member("bar")) } From 798b423dfd17f41c9d9ad5cf6711e607b7b1caec Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 18 Sep 2022 07:39:32 -0700 Subject: [PATCH 234/886] Fix prom exporter panic on invalid metric (#3182) Resolves #3180 --- exporters/prometheus/exporter.go | 2 ++ exporters/prometheus/exporter_test.go | 28 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 8527b1b5025..e210728c482 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -90,12 +90,14 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { m, err := prometheus.NewConstHistogram(metricData.description, metricData.histogramCount, metricData.histogramSum, metricData.histogramBuckets, metricData.attributeValues...) if err != nil { otel.Handle(err) + continue } ch <- m } else { m, err := prometheus.NewConstMetric(metricData.description, metricData.valueType, metricData.value, metricData.attributeValues...) if err != nil { otel.Handle(err) + continue } ch <- m } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index aaf029e2021..173df4b98a8 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -103,6 +103,34 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 9, attrs...) }, }, + { + name: "invalid instruments are dropped", + expectedFile: "testdata/gauge.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + // Valid. + gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + require.NoError(t, err) + gauge.Add(ctx, 100, attrs...) + gauge.Add(ctx, -25, attrs...) + + // Invalid, should be dropped. + gauge, err = meter.SyncFloat64().UpDownCounter("invalid.gauge.name") + require.NoError(t, err) + gauge.Add(ctx, 100, attrs...) + + counter, err := meter.SyncFloat64().Counter("invalid.counter.name") + require.NoError(t, err) + counter.Add(ctx, 100, attrs...) + + histogram, err := meter.SyncFloat64().Histogram("invalid.hist.name") + require.NoError(t, err) + histogram.Record(ctx, 23, attrs...) + }, + }, } for _, tc := range testCases { From fae4b90d692bb87b1aab9cb54f03815752afafb3 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Tue, 20 Sep 2022 01:13:21 +0800 Subject: [PATCH 235/886] bugfix: fix prometheus attributes other than string (#3190) --- CHANGELOG.md | 6 +++++- exporters/prometheus/exporter.go | 4 ++-- exporters/prometheus/exporter_test.go | 2 ++ exporters/prometheus/testdata/counter.txt | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 486916d00b4..a986ec4e71b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) - The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) +### Fixed + +- Fix attributes other than string in the Prometheus exporter. (#3190) + ## [1.10.0] - 2022-09-09 ### Added @@ -225,7 +229,7 @@ Code instrumented with the `go.opentelemetry.io/otel/metric` will need to be mod - `OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT` - `OTEL_SPAN_LINK_COUNT_LIMIT` - `OTEL_LINK_ATTRIBUTE_COUNT_LIMIT` - + If the provided environment variables are invalid (negative), the default values would be used. - Rename the `gc` runtime name to `go` (#2560) - Add resource container ID detection. (#2418) diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index e210728c482..a548de3523c 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -208,10 +208,10 @@ func getAttrs(attrs attribute.Set) ([]string, []string) { kv := itr.Attribute() key := strings.Map(sanitizeRune, string(kv.Key)) if _, ok := keysMap[key]; !ok { - keysMap[key] = []string{kv.Value.AsString()} + keysMap[key] = []string{kv.Value.Emit()} } else { // if the sanitized key is a duplicate, append to the list of keys - keysMap[key] = append(keysMap[key], kv.Value.AsString()) + keysMap[key] = append(keysMap[key], kv.Value.Emit()) } } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 173df4b98a8..32733a7a81c 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -45,6 +45,8 @@ func TestPrometheusExporter(t *testing.T) { attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), } counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 2a61dee1d01..93776d2372b 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,3 +1,3 @@ # HELP foo a simple counter # TYPE foo counter -foo{A="B",C="D"} 24.3 +foo{A="B",C="D",E="true",F="42"} 24.3 From f215b8dbe6ebe3371a2ceceac302b5c2217da6af Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 19 Sep 2022 10:28:37 -0700 Subject: [PATCH 236/886] Release v0.32.0 -- Revised Metric SDK (Alpha) (#3184) * Bump experimental-metrics to v0.32.0 * Update opencensus bridge modules in versions.yaml * Prepare experimental-metrics for version v0.32.0 * Add changelog update * Remove changes to unreleased code --- CHANGELOG.md | 9 ++++----- bridge/opencensus/opencensusmetric/go.mod | 4 ++-- example/prometheus/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- sdk/metric/go.mod | 2 +- versions.yaml | 4 ++-- 10 files changed, 24 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a986ec4e71b..75adf614e5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 + ### Changed - The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. @@ -42,10 +44,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `"go.opentelemetry.io/otel/sdk/metric".NewAccumulator` function was removed, see `NewMeterProvider`in the new metric SDK. (#3175) - The deprecated `"go.opentelemetry.io/otel/sdk/metric".AtomicFieldOffsets` function was removed. (#3175) -### Fixed - -- Fix attributes other than string in the Prometheus exporter. (#3190) - ## [1.10.0] - 2022-09-09 ### Added @@ -1945,7 +1943,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.10.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.32.0...HEAD +[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.32.0 [1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 [1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 [1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 diff --git a/bridge/opencensus/opencensusmetric/go.mod b/bridge/opencensus/opencensusmetric/go.mod index 2c98a6e1371..62f0da59ca7 100644 --- a/bridge/opencensus/opencensusmetric/go.mod +++ b/bridge/opencensus/opencensusmetric/go.mod @@ -5,8 +5,8 @@ go 1.18 require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 - go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 441f03e5112..c7e43afffaf 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.31.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/exporters/prometheus v0.32.0 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index b99be852d34..47f1c895a8f 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -7,9 +7,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/metric v0.32.0 go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 - go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk/metric v0.32.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f4051953143..712e728a1ce 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,9 +6,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 463b978feb6..fedbe208566 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index c06f9ff10a5..2760ff550c2 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,8 +6,8 @@ require ( github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.31.0 - go.opentelemetry.io/otel/sdk/metric v0.31.0 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 ) require ( diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 67edf5fc2ed..f1c16c84468 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/metric v0.32.0 go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 - go.opentelemetry.io/otel/sdk/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk/metric v0.32.0 ) require ( diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 1c96d819855..029a1a3fedc 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/metric v0.32.0 go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 ) diff --git a/versions.yaml b/versions.yaml index ec2ca16d270..7321b7ed97c 100644 --- a/versions.yaml +++ b/versions.yaml @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.31.0 + version: v0.32.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric @@ -52,7 +52,7 @@ module-sets: version: v0.31.0 modules: - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/opencensus excluded-modules: - go.opentelemetry.io/otel/internal/tools From baf9f18b00b9218981bb78a20490d03708aec66c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 19 Sep 2022 14:06:35 -0700 Subject: [PATCH 237/886] Fix changelog release v0.32.0 tag link (#3193) --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75adf614e5a..ce65199d742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1943,8 +1943,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v0.32.0...HEAD -[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.32.0 +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.0...HEAD +[0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 [1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 [1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 [1.8.0/0.31.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.8.0 From cce6304fe55a9fb8ae8650ec27e889a5d3374d13 Mon Sep 17 00:00:00 2001 From: Ihor Sychevskyi Date: Tue, 20 Sep 2022 01:26:07 +0300 Subject: [PATCH 238/886] accessibility: add alt tag to image (#3188) --- website_docs/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/_index.md b/website_docs/_index.md index a1ab8723779..536a52dd339 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -1,7 +1,7 @@ --- title: Go description: >- - + Go A language-specific implementation of OpenTelemetry in Go. aliases: [/golang, /golang/metrics, /golang/tracing] cascade: From b6d4335a722570cb882964fafd533210b68e409a Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 19 Sep 2022 19:22:40 -0500 Subject: [PATCH 239/886] Removes go1.17, replaces with go1.18 (#3179) * Removes go1.17, replaces with go1.18 * Update Changelog Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/dependabot.yml | 2 +- CHANGELOG.md | 1 + Makefile | 2 +- README.md | 5 ----- bridge/opencensus/go.mod | 2 +- bridge/opencensus/test/go.mod | 2 +- bridge/opentracing/go.mod | 2 +- example/fib/go.mod | 2 +- example/jaeger/go.mod | 2 +- example/namedtracer/go.mod | 2 +- example/otel-collector/go.mod | 2 +- example/passthrough/go.mod | 2 +- example/zipkin/Dockerfile | 2 +- example/zipkin/go.mod | 2 +- exporters/jaeger/go.mod | 2 +- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/zipkin/go.mod | 2 +- go.mod | 2 +- internal/tools/go.mod | 2 +- metric/go.mod | 2 +- schema/go.mod | 2 +- sdk/go.mod | 2 +- sdk/metric/aggregation/aggregation.go | 3 --- sdk/metric/aggregation/aggregation_test.go | 3 --- sdk/metric/metricdata/temporality.go | 2 -- trace/go.mod | 2 +- 32 files changed, 28 insertions(+), 40 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 06d52b94a50..a9647ded720 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: 1.17 + DEFAULT_GO_VERSION: 1.18 jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d199d8bc131..81a31e32a3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: [1.19, 1.18, 1.17] + go-version: [1.19, 1.18] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 763d0427b00..b0009e2b3d5 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v3 with: - go-version: '^1.17.0' + go-version: '^1.18.0' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: diff --git a/CHANGELOG.md b/CHANGELOG.md index ce65199d742..434aeae8397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. Please see the package documentation for how the new SDK is initialized and configured. (#3175) +- Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) ### Removed diff --git a/Makefile b/Makefile index 18ffaa33a99..07e31965c30 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ go-mod-tidy/%: DIR=$* go-mod-tidy/%: | crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy -compat=1.17 + && $(GO) mod tidy -compat=1.18 .PHONY: lint-modules lint-modules: go-mod-tidy diff --git a/README.md b/README.md index 4aeecb8bfe7..1b2ee21fbf5 100644 --- a/README.md +++ b/README.md @@ -52,19 +52,14 @@ Currently, this project supports the following environments. | ------- | ---------- | ------------ | | Ubuntu | 1.19 | amd64 | | Ubuntu | 1.18 | amd64 | -| Ubuntu | 1.17 | amd64 | | Ubuntu | 1.19 | 386 | | Ubuntu | 1.18 | 386 | -| Ubuntu | 1.17 | 386 | | MacOS | 1.19 | amd64 | | MacOS | 1.18 | amd64 | -| MacOS | 1.17 | amd64 | | Windows | 1.19 | amd64 | | Windows | 1.18 | amd64 | -| Windows | 1.17 | amd64 | | Windows | 1.19 | 386 | | Windows | 1.18 | 386 | -| Windows | 1.17 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4faa85d3607..8e2d09eebc0 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus -go 1.17 +go 1.18 require ( go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 66226d4b6c2..bc7149de473 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus/test -go 1.17 +go 1.18 require ( go.opencensus.io v0.23.0 diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index c49a89f8dd7..f76c025332d 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing -go 1.17 +go 1.18 replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.mod b/example/fib/go.mod index be627a76236..1aab2c16536 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/fib -go 1.17 +go 1.18 require ( go.opentelemetry.io/otel v1.10.0 diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 15ea8347184..e7e756ce178 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/jaeger -go 1.17 +go 1.18 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 41433bff5dd..51eee8be307 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/namedtracer -go 1.17 +go 1.18 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 96b14906a70..5bce9f3a3e6 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/otel-collector -go 1.17 +go 1.18 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 41a68d3bd82..6a53e93e7ad 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/passthrough -go 1.17 +go 1.18 require ( go.opentelemetry.io/otel v1.10.0 diff --git a/example/zipkin/Dockerfile b/example/zipkin/Dockerfile index d7984583006..58046097358 100644 --- a/example/zipkin/Dockerfile +++ b/example/zipkin/Dockerfile @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.17-alpine +FROM golang:1.18-alpine COPY . /go/src/github.com/open-telemetry/opentelemetry-go/ WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/zipkin/ RUN go install ./main.go diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 5650ba002f4..4ff6a660d9b 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/zipkin -go 1.17 +go 1.18 replace ( go.opentelemetry.io/otel => ../.. diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index c16db4e58e4..5ef17770757 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/jaeger -go 1.17 +go 1.18 require ( github.com/google/go-cmp v0.5.8 diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 932a47ef7c6..639de2b6936 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry -go 1.17 +go 1.18 require ( github.com/cenkalti/backoff/v4 v4.1.3 diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 1c89ad3ba5c..66c709bcb55 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace -go 1.17 +go 1.18 require ( github.com/google/go-cmp v0.5.8 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 9e444cbe7e3..34c5e98e761 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 798b246a743..d765af971a5 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index b44e0998199..36b1300622b 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdouttrace -go 1.17 +go 1.18 replace ( go.opentelemetry.io/otel => ../../.. diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index ca6f259a277..d6aefe4ea36 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/zipkin -go 1.17 +go 1.18 require ( github.com/google/go-cmp v0.5.8 diff --git a/go.mod b/go.mod index 76dbbbaec49..df6d6208682 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel -go 1.17 +go 1.18 require ( github.com/go-logr/logr v1.2.3 diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 621cd99bb11..8f5ff68ea1b 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/internal/tools -go 1.17 +go 1.18 require ( github.com/client9/misspell v0.3.4 diff --git a/metric/go.mod b/metric/go.mod index 4ce2adacf77..649e18c2093 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/metric -go 1.17 +go 1.18 require ( github.com/stretchr/testify v1.7.1 diff --git a/schema/go.mod b/schema/go.mod index 9114ff31a8f..f6a0fb338bc 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/schema -go 1.17 +go 1.18 require ( github.com/Masterminds/semver/v3 v3.1.1 diff --git a/sdk/go.mod b/sdk/go.mod index 6a9bfa8212f..1d2a7e828b9 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk -go 1.17 +go 1.18 replace go.opentelemetry.io/otel => ../ diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go index 1eb2c348699..e1da10f53f1 100644 --- a/sdk/metric/aggregation/aggregation.go +++ b/sdk/metric/aggregation/aggregation.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.17 -// +build go1.17 - // Package aggregation contains configuration types that define the // aggregation operation used to summarizes recorded measurements. package aggregation // import "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/sdk/metric/aggregation/aggregation_test.go b/sdk/metric/aggregation/aggregation_test.go index 772d7ea8fe1..0f2846d3a76 100644 --- a/sdk/metric/aggregation/aggregation_test.go +++ b/sdk/metric/aggregation/aggregation_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.17 -// +build go1.17 - package aggregation import ( diff --git a/sdk/metric/metricdata/temporality.go b/sdk/metric/metricdata/temporality.go index 5cf105b7947..9fceb18cba7 100644 --- a/sdk/metric/metricdata/temporality.go +++ b/sdk/metric/metricdata/temporality.go @@ -13,8 +13,6 @@ // limitations under the License. //go:generate stringer -type=Temporality -//go:build go1.17 -// +build go1.17 package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" diff --git a/trace/go.mod b/trace/go.mod index d4b34f0cc64..95fba71a800 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/trace -go 1.17 +go 1.18 replace go.opentelemetry.io/otel => ../ From 038248b8a2c80ecb0a56fe3ea2a20890126bae98 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 20 Sep 2022 15:14:28 -0400 Subject: [PATCH 240/886] Re-add previous metric bridge (#3192) * re-add previous metric bridge * move bridge/opencensus/opencensusmetric to bridge/opencensus/internal/ocmetric/ * add resource and scope to opencensus metric bridge Co-authored-by: Chester Cheung --- .github/dependabot.yml | 9 -- CHANGELOG.md | 4 + bridge/opencensus/go.mod | 14 ++- bridge/opencensus/go.sum | 65 +++++++++--- .../internal => internal/ocmetric}/metric.go | 2 +- .../ocmetric}/metric_test.go | 0 bridge/opencensus/metric.go | 63 ++++++++++++ bridge/opencensus/opencensusmetric/doc.go | 18 ---- bridge/opencensus/opencensusmetric/go.mod | 28 ------ bridge/opencensus/opencensusmetric/go.sum | 98 ------------------- bridge/opencensus/test/go.mod | 6 ++ 11 files changed, 139 insertions(+), 168 deletions(-) rename bridge/opencensus/{opencensusmetric/internal => internal/ocmetric}/metric.go (99%) rename bridge/opencensus/{opencensusmetric/internal => internal/ocmetric}/metric_test.go (100%) create mode 100644 bridge/opencensus/metric.go delete mode 100644 bridge/opencensus/opencensusmetric/doc.go delete mode 100644 bridge/opencensus/opencensusmetric/go.mod delete mode 100644 bridge/opencensus/opencensusmetric/go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d62ae0b70ea..34db1abf1e9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -28,15 +28,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /bridge/opencensus/opencensusmetric - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /bridge/opencensus/test labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index 434aeae8397..40953d25784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) + ## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 ### Changed diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 8e2d09eebc0..de502977519 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,17 +3,27 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.18 require ( - go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f + go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 go.opentelemetry.io/otel/trace v1.10.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 2e90b382eb9..c7ddc1e1307 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -1,29 +1,50 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f h1:IUmbcoP9XyEXW+R9AbrZgDvaYVfTbISN92Y5RIV+Mx4= -go.opencensus.io v0.22.6-0.20201102222123-380f4078db9f/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -32,27 +53,47 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/opencensusmetric/internal/metric.go b/bridge/opencensus/internal/ocmetric/metric.go similarity index 99% rename from bridge/opencensus/opencensusmetric/internal/metric.go rename to bridge/opencensus/internal/ocmetric/metric.go index 8d2e9a53db0..4b76dd0b668 100644 --- a/bridge/opencensus/opencensusmetric/internal/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -15,7 +15,7 @@ //go:build go1.18 // +build go1.18 -package internal // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric/internal" +package internal // import "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" import ( "errors" diff --git a/bridge/opencensus/opencensusmetric/internal/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go similarity index 100% rename from bridge/opencensus/opencensusmetric/internal/metric_test.go rename to bridge/opencensus/internal/ocmetric/metric_test.go diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go new file mode 100644 index 00000000000..d9c44545c65 --- /dev/null +++ b/bridge/opencensus/metric.go @@ -0,0 +1,63 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build go1.18 +// +build go1.18 + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +import ( + "context" + + ocmetricdata "go.opencensus.io/metric/metricdata" + "go.opencensus.io/metric/metricexport" + + internal "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/resource" +) + +// exporter implements the OpenCensus metric Exporter interface using an +// OpenTelemetry base exporter. +type exporter struct { + base metric.Exporter + res *resource.Resource +} + +// NewMetricExporter returns an OpenCensus exporter that exports to an +// OpenTelemetry exporter. +func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { + return &exporter{base: base} +} + +// ExportMetrics implements the OpenCensus metric Exporter interface by sending +// to an OpenTelemetry exporter. +func (e *exporter) ExportMetrics(ctx context.Context, ocmetrics []*ocmetricdata.Metric) error { + otelmetrics, err := internal.ConvertMetrics(ocmetrics) + if err != nil { + return err + } + return e.base.Export(ctx, metricdata.ResourceMetrics{ + Resource: e.res, + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "go.opentelemetry.io/otel/bridge/opencensus", + }, + Metrics: otelmetrics, + }, + }}) +} diff --git a/bridge/opencensus/opencensusmetric/doc.go b/bridge/opencensus/opencensusmetric/doc.go deleted file mode 100644 index a15e8b2aeb4..00000000000 --- a/bridge/opencensus/opencensusmetric/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package opencensusmetric provides a metric bridge from OpenCensus to OpenTelemetry. -*/ -package opencensusmetric // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric" diff --git a/bridge/opencensus/opencensusmetric/go.mod b/bridge/opencensus/opencensusmetric/go.mod deleted file mode 100644 index 62f0da59ca7..00000000000 --- a/bridge/opencensus/opencensusmetric/go.mod +++ /dev/null @@ -1,28 +0,0 @@ -module go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric - -go 1.18 - -require ( - go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 -) - -require ( - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect -) - -replace go.opentelemetry.io/otel => ../../.. - -replace go.opentelemetry.io/otel/sdk => ../../../sdk - -replace go.opentelemetry.io/otel/metric => ../../../metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - -replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/bridge/opencensus/opencensusmetric/go.sum b/bridge/opencensus/opencensusmetric/go.sum deleted file mode 100644 index 099866b7e41..00000000000 --- a/bridge/opencensus/opencensusmetric/go.sum +++ /dev/null @@ -1,98 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index bc7149de473..06c6851a3b1 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -14,6 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + go.opentelemetry.io/otel/metric v0.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.32.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) @@ -24,3 +26,7 @@ replace go.opentelemetry.io/otel/bridge/opencensus => ../ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/trace => ../../../trace + +replace go.opentelemetry.io/otel/metric => ../../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric From f535b1e65fe32c3ee15bf27ca8130875122c52f9 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 21 Sep 2022 10:00:00 -0700 Subject: [PATCH 241/886] Remove unnecessary build restrictions for go1.18 (#3197) Signed-off-by: Bogdan Drutu Signed-off-by: Bogdan Drutu --- bridge/opencensus/internal/ocmetric/metric.go | 3 --- bridge/opencensus/internal/ocmetric/metric_test.go | 3 --- example/prometheus/main.go | 3 --- exporters/otlp/otlpmetric/client.go | 3 --- exporters/otlp/otlpmetric/exporter.go | 3 --- exporters/otlp/otlpmetric/exporter_test.go | 3 --- exporters/otlp/otlpmetric/internal/otest/client.go | 3 --- exporters/otlp/otlpmetric/internal/otest/client_test.go | 3 --- exporters/otlp/otlpmetric/internal/otest/collector.go | 3 --- exporters/otlp/otlpmetric/internal/transform/attribute.go | 3 --- .../otlp/otlpmetric/internal/transform/attribute_test.go | 3 --- exporters/otlp/otlpmetric/internal/transform/error.go | 3 --- exporters/otlp/otlpmetric/internal/transform/error_test.go | 3 --- exporters/otlp/otlpmetric/internal/transform/metricdata.go | 3 --- .../otlp/otlpmetric/internal/transform/metricdata_test.go | 3 --- exporters/otlp/otlpmetric/otlpmetricgrpc/client.go | 3 --- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 3 --- exporters/otlp/otlpmetric/otlpmetricgrpc/config.go | 3 --- exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go | 3 --- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 3 --- exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go | 3 --- exporters/otlp/otlpmetric/otlpmetrichttp/config.go | 3 --- exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go | 3 --- exporters/prometheus/exporter.go | 3 --- exporters/prometheus/exporter_test.go | 3 --- exporters/stdout/stdoutmetric/config.go | 3 --- exporters/stdout/stdoutmetric/encoder.go | 3 --- exporters/stdout/stdoutmetric/example_test.go | 3 --- exporters/stdout/stdoutmetric/exporter.go | 3 --- exporters/stdout/stdoutmetric/exporter_test.go | 3 --- sdk/metric/config.go | 3 --- sdk/metric/config_test.go | 3 --- sdk/metric/example_test.go | 3 --- sdk/metric/exporter.go | 3 --- sdk/metric/instrument.go | 3 --- sdk/metric/instrument_provider.go | 3 --- sdk/metric/internal/aggregator.go | 3 --- sdk/metric/internal/aggregator_example_test.go | 3 --- sdk/metric/internal/aggregator_test.go | 3 --- sdk/metric/internal/filter.go | 3 --- sdk/metric/internal/filter_test.go | 3 --- sdk/metric/internal/histogram.go | 3 --- sdk/metric/internal/histogram_test.go | 3 --- sdk/metric/internal/lastvalue.go | 3 --- sdk/metric/internal/lastvalue_test.go | 3 --- sdk/metric/internal/sum.go | 3 --- sdk/metric/internal/sum_test.go | 3 --- sdk/metric/manual_reader.go | 3 --- sdk/metric/manual_reader_test.go | 3 --- sdk/metric/meter.go | 3 --- sdk/metric/meter_test.go | 3 --- sdk/metric/metricdata/data.go | 3 --- sdk/metric/metricdata/metricdatatest/assertion.go | 3 --- sdk/metric/metricdata/metricdatatest/assertion_fail_test.go | 4 ++-- sdk/metric/metricdata/metricdatatest/assertion_test.go | 3 --- sdk/metric/metricdata/metricdatatest/comparisons.go | 3 --- sdk/metric/periodic_reader.go | 3 --- sdk/metric/periodic_reader_test.go | 3 --- sdk/metric/pipeline.go | 3 --- sdk/metric/pipeline_registry_test.go | 3 --- sdk/metric/pipeline_test.go | 3 --- sdk/metric/provider.go | 3 --- sdk/metric/provider_test.go | 5 +---- sdk/metric/reader.go | 3 --- sdk/metric/reader_test.go | 3 --- sdk/metric/view/example_test.go | 3 --- sdk/metric/view/instrument.go | 3 --- sdk/metric/view/instrumentkind.go | 3 --- sdk/metric/view/view.go | 3 --- sdk/metric/view/view_test.go | 3 --- 70 files changed, 3 insertions(+), 210 deletions(-) diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index 4b76dd0b668..575e99abe75 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" import ( diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index 4088972cc3f..b93bc413088 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric/internal" import ( diff --git a/example/prometheus/main.go b/example/prometheus/main.go index fada742d32b..0517da33c2f 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package main import ( diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/client.go index 48b0fe805e2..9bcbab44f48 100644 --- a/exporters/otlp/otlpmetric/client.go +++ b/exporters/otlp/otlpmetric/client.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 0bd546e5255..2967a5f7b24 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 0b673f50031..fd644140d37 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" import ( diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 2ade400522d..35939664999 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" import ( diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 1f4aac5610d..09f98ee809b 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" import ( diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index 3302c8cfc2a..f49355f9f39 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute.go b/exporters/otlp/otlpmetric/internal/transform/attribute.go index 504256ee7b2..d382fac3576 100644 --- a/exporters/otlp/otlpmetric/internal/transform/attribute.go +++ b/exporters/otlp/otlpmetric/internal/transform/attribute.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute_test.go b/exporters/otlp/otlpmetric/internal/transform/attribute_test.go index 6ca20fdbafd..1dbe674951c 100644 --- a/exporters/otlp/otlpmetric/internal/transform/attribute_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/attribute_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/error.go b/exporters/otlp/otlpmetric/internal/transform/error.go index 8a8b49a63a3..d98f8e082c9 100644 --- a/exporters/otlp/otlpmetric/internal/transform/error.go +++ b/exporters/otlp/otlpmetric/internal/transform/error.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/error_test.go b/exporters/otlp/otlpmetric/internal/transform/error_test.go index f366fc48724..4f407c1b7ab 100644 --- a/exporters/otlp/otlpmetric/internal/transform/error_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/error_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 38ad617fd6a..70c4f025564 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index e9745da7b7f..012aaea52a9 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" import ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 44ad5e2fc0e..4c5beb8f384 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" import ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index e78e91f5396..1cb8cd815e3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetricgrpc import ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go index d838420d03f..5f7a66e559e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" import ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index 8ac22bb2c72..f7630760678 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetricgrpc_test import ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 1bfebc6fbd6..7a8d7e14707 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" import ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 7d6aa912737..22740252b02 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetrichttp import ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go index 6228b1f7fa2..c320c25d406 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" import ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go index 8cae38d0ef7..d3397167c70 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package otlpmetrichttp_test import ( diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index a548de3523c..498b90eb28b 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 32733a7a81c..461b9d7098d 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package prometheus import ( diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 63ba9fc592e..c2f02da1ecf 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -11,9 +11,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import ( diff --git a/exporters/stdout/stdoutmetric/encoder.go b/exporters/stdout/stdoutmetric/encoder.go index ab5510afcbe..bb5c8c3f694 100644 --- a/exporters/stdout/stdoutmetric/encoder.go +++ b/exporters/stdout/stdoutmetric/encoder.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import "errors" diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index e8ea9310b46..5bbf8c6faa0 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package stdoutmetric_test import ( diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index f7976d5993f..fef517fa833 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import ( diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index 9e8faa3e8ec..fa2a05401e8 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package stdoutmetric_test // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import ( diff --git a/sdk/metric/config.go b/sdk/metric/config.go index 83ae6565410..a1253334505 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index be3aa55fb16..ad88d6b9ff5 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric import ( diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index eabe781738a..33a6b27a412 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric_test import ( diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 309381fe8d3..79257db0fc6 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 19f3840887a..5e7b457ab7f 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go index fd79aa74d91..ad215a853b2 100644 --- a/sdk/metric/instrument_provider.go +++ b/sdk/metric/instrument_provider.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregator.go index e9068a4b936..1f70ae7c1ee 100644 --- a/sdk/metric/internal/aggregator.go +++ b/sdk/metric/internal/aggregator.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index dc4a0cd499e..16ca8a44451 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal import ( diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregator_test.go index e93d643b642..200d3da6268 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregator_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/filter.go index 2407d016e90..8acbdc79a02 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/filter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/filter_test.go index 8ce2747a375..14f572a5f8e 100644 --- a/sdk/metric/internal/filter_test.go +++ b/sdk/metric/internal/filter_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go index e5298e22d6f..b04b71baf12 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/histogram.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index edeaf8a6945..5b18d8eee4a 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/lastvalue.go b/sdk/metric/internal/lastvalue.go index 48e1b426c76..d5ee3b009ba 100644 --- a/sdk/metric/internal/lastvalue.go +++ b/sdk/metric/internal/lastvalue.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/lastvalue_test.go index 41b75877fe3..3f84af14304 100644 --- a/sdk/metric/internal/lastvalue_test.go +++ b/sdk/metric/internal/lastvalue_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index b80dcd9c40b..da8bf34de82 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 668afd1a022..8a838d3f23c 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index ec985332188..ad932be793b 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 58b1a85cb1d..7d54be113c1 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" import ( diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 4f51c03308b..c38777b69d5 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 8efcbd6b261..72e67ba021b 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric import ( diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index effaf71c73a..a729879e673 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" import ( diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index 4c519d15d49..1e52cfea107 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - // Package metricdatatest provides testing functionality for use with the // metricdata package. package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" diff --git a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go index fffbe6421be..4c608e4a2c9 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 && tests_fail -// +build go1.18,tests_fail +//go:build tests_fail +// +build tests_fail package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 71331f5a945..3935ed15091 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" import ( diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 4c40f3bf67d..841c03b12e0 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" import ( diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 9c66ac5d552..cd729eff32e 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 5689aa11b85..8ea2f9ffc91 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index d4f7d4f8082..60e147d25e7 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index d4e47f35eb5..3455269fa81 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 91134fec517..52183360fd3 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 7f8f32bf104..481547d7062 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go index aefb23f8690..7aa639f5df2 100644 --- a/sdk/metric/provider_test.go +++ b/sdk/metric/provider_test.go @@ -4,7 +4,7 @@ // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric import ( diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index ff5f987070d..bf596c27887 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 630d11a869b..f005ada472f 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" import ( diff --git a/sdk/metric/view/example_test.go b/sdk/metric/view/example_test.go index bf2480055fc..76d99df6d45 100644 --- a/sdk/metric/view/example_test.go +++ b/sdk/metric/view/example_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package view // import "go.opentelemetry.io/otel/sdk/metric/view" import ( diff --git a/sdk/metric/view/instrument.go b/sdk/metric/view/instrument.go index e024b37a6ff..b9f0b9de708 100644 --- a/sdk/metric/view/instrument.go +++ b/sdk/metric/view/instrument.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package view // import "go.opentelemetry.io/otel/sdk/metric/view" import ( diff --git a/sdk/metric/view/instrumentkind.go b/sdk/metric/view/instrumentkind.go index d5fc67953f9..0ac2acd56bc 100644 --- a/sdk/metric/view/instrumentkind.go +++ b/sdk/metric/view/instrumentkind.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package view // import "go.opentelemetry.io/otel/sdk/metric/view" // InstrumentKind describes the kind of instrument a Meter can create. diff --git a/sdk/metric/view/view.go b/sdk/metric/view/view.go index 946d7755230..c6f2001870e 100644 --- a/sdk/metric/view/view.go +++ b/sdk/metric/view/view.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package view // import "go.opentelemetry.io/otel/sdk/metric/view" import ( diff --git a/sdk/metric/view/view_test.go b/sdk/metric/view/view_test.go index c461bf14a9b..92034345926 100644 --- a/sdk/metric/view/view_test.go +++ b/sdk/metric/view/view_test.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package view // import "go.opentelemetry.io/otel/sdk/metric/view" import ( From 2ae59228485a09eb7e0d0d29e287f736ec985ca4 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 21 Sep 2022 17:45:24 -0400 Subject: [PATCH 242/886] reintroduce opencensus bridge example (#3206) Co-authored-by: Tyler Yahn --- .github/dependabot.yml | 9 +++ CHANGELOG.md | 1 + example/opencensus/go.mod | 38 +++++++++ example/opencensus/go.sum | 99 +++++++++++++++++++++++ example/opencensus/main.go | 155 +++++++++++++++++++++++++++++++++++++ 5 files changed, 302 insertions(+) create mode 100644 example/opencensus/go.mod create mode 100644 example/opencensus/go.sum create mode 100644 example/opencensus/main.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 34db1abf1e9..e1ae982eb5c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -73,6 +73,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /example/opencensus + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/otel-collector labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index 40953d25784..03ea381e10f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) +- The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) ## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod new file mode 100644 index 00000000000..10a5b0b57dc --- /dev/null +++ b/example/opencensus/go.mod @@ -0,0 +1,38 @@ +module go.opentelemetry.io/otel/example/opencensus + +go 1.18 + +replace ( + go.opentelemetry.io/otel => ../.. + go.opentelemetry.io/otel/bridge/opencensus => ../../bridge/opencensus + go.opentelemetry.io/otel/sdk => ../../sdk +) + +require ( + go.opencensus.io v0.23.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/bridge/opencensus v0.31.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/sdk/metric v0.32.0 +) + +require ( + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + go.opentelemetry.io/otel/metric v0.32.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect + golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect +) + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric + +replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric + +replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum new file mode 100644 index 00000000000..c7ddc1e1307 --- /dev/null +++ b/example/opencensus/go.sum @@ -0,0 +1,99 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/opencensus/main.go b/example/opencensus/main.go new file mode 100644 index 00000000000..c35c47cac09 --- /dev/null +++ b/example/opencensus/main.go @@ -0,0 +1,155 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "context" + "fmt" + "log" + "time" + + ocmetric "go.opencensus.io/metric" + "go.opencensus.io/metric/metricdata" + "go.opencensus.io/metric/metricexport" + "go.opencensus.io/metric/metricproducer" + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" + octrace "go.opencensus.io/trace" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/bridge/opencensus" + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" +) + +var ( + // instrumenttype differentiates between our gauge and view metrics. + keyType = tag.MustNewKey("instrumenttype") + // Counts the number of lines read in from standard input. + countMeasure = stats.Int64("test_count", "A count of something", stats.UnitDimensionless) + countView = &view.View{ + Name: "test_count", + Measure: countMeasure, + Description: "A count of something", + Aggregation: view.Count(), + TagKeys: []tag.Key{keyType}, + } +) + +func main() { + log.Println("Using OpenTelemetry stdout exporters.") + traceExporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) + if err != nil { + log.Fatal(fmt.Errorf("error creating trace exporter: %w", err)) + } + metricsExporter, err := stdoutmetric.New() + if err != nil { + log.Fatal(fmt.Errorf("error creating metric exporter: %w", err)) + } + tracing(traceExporter) + if err := monitoring(metricsExporter); err != nil { + log.Fatal(err) + } +} + +// tracing demonstrates overriding the OpenCensus DefaultTracer to send spans +// to the OpenTelemetry exporter by calling OpenCensus APIs. +func tracing(otExporter sdktrace.SpanExporter) { + ctx := context.Background() + + log.Println("Configuring OpenCensus. Not Registering any OpenCensus exporters.") + octrace.ApplyConfig(octrace.Config{DefaultSampler: octrace.AlwaysSample()}) + + tp := sdktrace.NewTracerProvider(sdktrace.WithBatcher(otExporter)) + otel.SetTracerProvider(tp) + + log.Println("Installing the OpenCensus bridge to make OpenCensus libraries write spans using OpenTelemetry.") + tracer := tp.Tracer("simple") + octrace.DefaultTracer = opencensus.NewTracer(tracer) + tp.ForceFlush(ctx) + + log.Println("Creating OpenCensus span, which should be printed out using the OpenTelemetry stdouttrace exporter.\n-- It should have no parent, since it is the first span.") + ctx, outerOCSpan := octrace.StartSpan(ctx, "OpenCensusOuterSpan") + outerOCSpan.End() + tp.ForceFlush(ctx) + + log.Println("Creating OpenTelemetry span\n-- It should have the OpenCensus span as a parent, since the OpenCensus span was written with using OpenTelemetry APIs.") + ctx, otspan := tracer.Start(ctx, "OpenTelemetrySpan") + otspan.End() + tp.ForceFlush(ctx) + + log.Println("Creating OpenCensus span, which should be printed out using the OpenTelemetry stdouttrace exporter.\n-- It should have the OpenTelemetry span as a parent, since it was written using OpenTelemetry APIs") + _, innerOCSpan := octrace.StartSpan(ctx, "OpenCensusInnerSpan") + innerOCSpan.End() + tp.ForceFlush(ctx) +} + +// monitoring demonstrates creating an IntervalReader using the OpenTelemetry +// exporter to send metrics to the exporter by using either an OpenCensus +// registry or an OpenCensus view. +func monitoring(otExporter metric.Exporter) error { + log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.") + ocExporter := opencensus.NewMetricExporter(otExporter, resource.Default()) + intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter) + if err != nil { + return fmt.Errorf("failed to create interval reader: %w", err) + } + intervalReader.ReportingInterval = 10 * time.Second + log.Println("Emitting metrics using OpenCensus APIs. These should be printed out using the OpenTelemetry stdoutmetric exporter.") + err = intervalReader.Start() + if err != nil { + return fmt.Errorf("failed to start interval reader: %w", err) + } + defer intervalReader.Stop() + + log.Println("Registering a gauge metric using an OpenCensus registry.") + r := ocmetric.NewRegistry() + metricproducer.GlobalManager().AddProducer(r) + gauge, err := r.AddInt64Gauge( + "test_gauge", + ocmetric.WithDescription("A gauge for testing"), + ocmetric.WithConstLabel(map[metricdata.LabelKey]metricdata.LabelValue{ + {Key: keyType.Name()}: metricdata.NewLabelValue("gauge"), + }), + ) + if err != nil { + return fmt.Errorf("failed to add gauge: %w", err) + } + entry, err := gauge.GetEntry() + if err != nil { + return fmt.Errorf("failed to get gauge entry: %w", err) + } + + log.Println("Registering a cumulative metric using an OpenCensus view.") + if err := view.Register(countView); err != nil { + return fmt.Errorf("failed to register views: %w", err) + } + ctx, err := tag.New(context.Background(), tag.Insert(keyType, "view")) + if err != nil { + return fmt.Errorf("failed to set tag: %w", err) + } + for i := int64(1); true; i++ { + // update stats for our gauge + entry.Set(i) + // update stats for our view + stats.Record(ctx, countMeasure.M(1)) + time.Sleep(time.Second) + } + return nil +} From bfaff3a097d9bf695e396e499c7bef1757d70a10 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 22 Sep 2022 16:23:16 +0200 Subject: [PATCH 243/886] Sanitize metric names in the prometheus exporter (#3212) * sanitize metric names in the prometheus exporter * add changelog entry * fix now invalid comment * replace sanitizeName algorithm with one based on strings.Map * check that digits as first characters are replaced * Update exporters/prometheus/exporter.go Co-authored-by: Tyler Yahn * add missing utf8 import * add explicit tests for sanitizeName * fix testdata with digit prepend Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 60 ++++++++++++++++++- exporters/prometheus/exporter_test.go | 42 +++++++++++-- .../prometheus/testdata/sanitized_names.txt | 24 ++++++++ 4 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 exporters/prometheus/testdata/sanitized_names.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 03ea381e10f..208d45e11c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. Please see the package documentation for how the new SDK is initialized and configured. (#3175) - Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) +- Instead of dropping metric, the Prometheus exporter will replace any invalid character in metric names with `_`. (#3212) ### Removed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 498b90eb28b..3fe848f1e03 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -19,6 +19,7 @@ import ( "sort" "strings" "unicode" + "unicode/utf8" "github.com/prometheus/client_golang/prometheus" @@ -142,7 +143,7 @@ func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics dataPoints := make([]*metricData, 0, len(histogram.DataPoints)) for _, dp := range histogram.DataPoints { keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) for i, bound := range dp.Bounds { buckets[bound] = dp.BucketCounts[i] @@ -165,7 +166,7 @@ func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Met dataPoints := make([]*metricData, 0, len(sum.DataPoints)) for _, dp := range sum.DataPoints { keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) md := &metricData{ name: m.Name, description: desc, @@ -182,7 +183,7 @@ func getGaugeMetricData[N int64 | float64](gauge metricdata.Gauge[N], m metricda dataPoints := make([]*metricData, 0, len(gauge.DataPoints)) for _, dp := range gauge.DataPoints { keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(m.Name, m.Description, keys, nil) + desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) md := &metricData{ name: m.Name, description: desc, @@ -230,3 +231,56 @@ func sanitizeRune(r rune) rune { } return '_' } + +func sanitizeName(n string) string { + // This algorithm is based on strings.Map from Go 1.19. + const replacement = '_' + + valid := func(i int, r rune) bool { + // Taken from + // https://github.com/prometheus/common/blob/dfbc25bd00225c70aca0d94c3c4bb7744f28ace0/model/metric.go#L92-L102 + if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || r == '_' || r == ':' || (r >= '0' && r <= '9' && i > 0) { + return true + } + return false + } + + // This output buffer b is initialized on demand, the first time a + // character needs to be replaced. + var b strings.Builder + for i, c := range n { + if valid(i, c) { + continue + } + + if i == 0 && c >= '0' && c <= '9' { + // Prefix leading number with replacement character. + b.Grow(len(n) + 1) + b.WriteByte(byte(replacement)) + break + } + b.Grow(len(n)) + b.WriteString(n[:i]) + b.WriteByte(byte(replacement)) + width := utf8.RuneLen(c) + n = n[i+width:] + break + } + + // Fast path for unchanged input. + if b.Cap() == 0 { // b.Grow was not called above. + return n + } + + for _, c := range n { + // Due to inlining, it is more performant to invoke WriteByte rather then + // WriteRune. + if valid(1, c) { // We are guaranteed to not be at the start. + b.WriteByte(byte(c)) + } else { + b.WriteByte(byte(replacement)) + } + } + + return b.String() +} diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 461b9d7098d..6d46c3be0db 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -103,8 +103,8 @@ func TestPrometheusExporter(t *testing.T) { }, }, { - name: "invalid instruments are dropped", - expectedFile: "testdata/gauge.txt", + name: "invalid instruments are renamed", + expectedFile: "testdata/sanitized_names.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), @@ -116,16 +116,16 @@ func TestPrometheusExporter(t *testing.T) { gauge.Add(ctx, 100, attrs...) gauge.Add(ctx, -25, attrs...) - // Invalid, should be dropped. - gauge, err = meter.SyncFloat64().UpDownCounter("invalid.gauge.name") + // Invalid, will be renamed. + gauge, err = meter.SyncFloat64().UpDownCounter("invalid.gauge.name", instrument.WithDescription("a gauge with an invalid name")) require.NoError(t, err) gauge.Add(ctx, 100, attrs...) - counter, err := meter.SyncFloat64().Counter("invalid.counter.name") + counter, err := meter.SyncFloat64().Counter("0invalid.counter.name", instrument.WithDescription("a counter with an invalid name")) require.NoError(t, err) counter.Add(ctx, 100, attrs...) - histogram, err := meter.SyncFloat64().Histogram("invalid.hist.name") + histogram, err := meter.SyncFloat64().Histogram("invalid.hist.name", instrument.WithDescription("a histogram with an invalid name")) require.NoError(t, err) histogram.Record(ctx, 23, attrs...) }, @@ -155,3 +155,33 @@ func TestPrometheusExporter(t *testing.T) { }) } } + +func TestSantitizeName(t *testing.T) { + tests := []struct { + input string + want string + }{ + {"nam€_with_3_width_rune", "nam__with_3_width_rune"}, + {"`", "_"}, + { + `! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWKYZ[]\^_abcdefghijklmnopqrstuvwkyz{|}~`, + `________________0123456789:______ABCDEFGHIJKLMNOPQRSTUVWKYZ_____abcdefghijklmnopqrstuvwkyz____`, + }, + + // Test cases taken from + // https://github.com/prometheus/common/blob/dfbc25bd00225c70aca0d94c3c4bb7744f28ace0/model/metric_test.go#L85-L136 + {"Avalid_23name", "Avalid_23name"}, + {"_Avalid_23name", "_Avalid_23name"}, + {"1valid_23name", "_1valid_23name"}, + {"avalid_23name", "avalid_23name"}, + {"Ava:lid_23name", "Ava:lid_23name"}, + {"a lid_23name", "a_lid_23name"}, + {":leading_colon", ":leading_colon"}, + {"colon:in:the:middle", "colon:in:the:middle"}, + {"", ""}, + } + + for _, test := range tests { + require.Equalf(t, test.want, sanitizeName(test.input), "input: %q", test.input) + } +} diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt new file mode 100644 index 00000000000..5e9516716ae --- /dev/null +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -0,0 +1,24 @@ +# HELP bar a fun little gauge +# TYPE bar counter +bar{A="B",C="D"} 75 +# HELP _0invalid_counter_name a counter with an invalid name +# TYPE _0invalid_counter_name counter +_0invalid_counter_name{A="B",C="D"} 100 +# HELP invalid_gauge_name a gauge with an invalid name +# TYPE invalid_gauge_name counter +invalid_gauge_name{A="B",C="D"} 100 +# HELP invalid_hist_name a histogram with an invalid name +# TYPE invalid_hist_name histogram +invalid_hist_name_bucket{A="B",C="D",le="0"} 0 +invalid_hist_name_bucket{A="B",C="D",le="5"} 0 +invalid_hist_name_bucket{A="B",C="D",le="10"} 0 +invalid_hist_name_bucket{A="B",C="D",le="25"} 1 +invalid_hist_name_bucket{A="B",C="D",le="50"} 0 +invalid_hist_name_bucket{A="B",C="D",le="75"} 0 +invalid_hist_name_bucket{A="B",C="D",le="100"} 0 +invalid_hist_name_bucket{A="B",C="D",le="250"} 0 +invalid_hist_name_bucket{A="B",C="D",le="500"} 0 +invalid_hist_name_bucket{A="B",C="D",le="1000"} 0 +invalid_hist_name_bucket{A="B",C="D",le="+Inf"} 1 +invalid_hist_name_sum{A="B",C="D"} 23 +invalid_hist_name_count{A="B",C="D"} 1 From 35019d32bd408b7b67dd4ad8511392b66efe7059 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 22 Sep 2022 17:02:13 +0200 Subject: [PATCH 244/886] Add prometheus exporter benchmark (#3213) * add prometheus exporter benchmark * Update exporters/prometheus/benchmark_test.go Co-authored-by: Tyler Yahn * Update exporters/prometheus/benchmark_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- exporters/prometheus/benchmark_test.go | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 exporters/prometheus/benchmark_test.go diff --git a/exporters/prometheus/benchmark_test.go b/exporters/prometheus/benchmark_test.go new file mode 100644 index 00000000000..dee0814ed75 --- /dev/null +++ b/exporters/prometheus/benchmark_test.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus + +import ( + "context" + "fmt" + "testing" + + "github.com/prometheus/client_golang/prometheus" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric" +) + +func benchmarkCollect(b *testing.B, n int) { + ctx := context.Background() + exporter := New() + provider := metric.NewMeterProvider(metric.WithReader(exporter)) + meter := provider.Meter("testmeter") + + registry := prometheus.NewRegistry() + err := registry.Register(exporter.Collector) + require.NoError(b, err) + + for i := 0; i < n; i++ { + counter, err := meter.SyncFloat64().Counter(fmt.Sprintf("foo_%d", i)) + require.NoError(b, err) + counter.Add(ctx, float64(i)) + } + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, err := registry.Gather() + require.NoError(b, err) + } +} + +func BenchmarkCollect1(b *testing.B) { benchmarkCollect(b, 1) } +func BenchmarkCollect10(b *testing.B) { benchmarkCollect(b, 10) } +func BenchmarkCollect100(b *testing.B) { benchmarkCollect(b, 100) } +func BenchmarkCollect1000(b *testing.B) { benchmarkCollect(b, 1000) } +func BenchmarkCollect10000(b *testing.B) { benchmarkCollect(b, 10000) } From 4eea5db998d6ec58186bcafa5c1c02f69dcfdcec Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 22 Sep 2022 09:18:18 -0700 Subject: [PATCH 245/886] Set MeterProvider resource for all pipelines (#3218) * Set MeterProvider resource for all pipelines Resolves #3208 * Add change to changelog --- CHANGELOG.md | 4 ++++ sdk/metric/meter_test.go | 2 ++ sdk/metric/pipeline.go | 4 ++-- sdk/metric/pipeline_registry_test.go | 25 ++++++++++++++++++++----- sdk/metric/provider.go | 2 +- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 208d45e11c6..89f7552df4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) - The OpenCensus bridge example (`go.opentelemetry.io/otel/example/opencensus`) has been reintroduced. (#3206) +### Fixed + +- Set the `MeterProvider` resource on all exported metric data. (#3218) + ## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 ### Changed diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 72e67ba021b..004eb12f8a5 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + "go.opentelemetry.io/otel/sdk/resource" ) func TestMeterRegistry(t *testing.T) { @@ -466,6 +467,7 @@ func TestMetersProvideScope(t *testing.T) { assert.NoError(t, err) want := metricdata.ResourceMetrics{ + Resource: resource.Default(), ScopeMetrics: []metricdata.ScopeMetrics{ { Scope: instrumentation.Scope{ diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 60e147d25e7..6783aef5d0f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -162,10 +162,10 @@ type pipelineRegistry struct { pipelines map[Reader]*pipeline } -func newPipelineRegistries(views map[Reader][]view.View) *pipelineRegistry { +func newPipelineRegistries(res *resource.Resource, views map[Reader][]view.View) *pipelineRegistry { pipelines := map[Reader]*pipeline{} for rdr := range views { - pipe := &pipeline{} + pipe := &pipeline{resource: res} rdr.register(pipe) pipelines[rdr] = pipe } diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 3455269fa81..1182eeca06a 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -20,10 +20,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" ) type invalidAggregation struct { @@ -321,9 +323,9 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - reg := newPipelineRegistries(tt.views) + reg := newPipelineRegistries(resource.Empty(), tt.views) testPipelineRegistryCreateIntAggregators(t, reg, tt.wantCount) - reg = newPipelineRegistries(tt.views) + reg = newPipelineRegistries(resource.Empty(), tt.views) testPipelineRegistryCreateFloatAggregators(t, reg, tt.wantCount) }) } @@ -347,6 +349,19 @@ func testPipelineRegistryCreateFloatAggregators(t *testing.T, reg *pipelineRegis require.Len(t, aggs, wantCount) } +func TestPipelineRegistryResource(t *testing.T) { + v, err := view.New(view.MatchInstrumentName("bar"), view.WithRename("foo")) + require.NoError(t, err) + views := map[Reader][]view.View{ + NewManualReader(): {{}, v}, + } + res := resource.NewSchemaless(attribute.String("key", "val")) + reg := newPipelineRegistries(res, views) + for _, p := range reg.pipelines { + assert.True(t, res.Equal(p.resource), "resource not set") + } +} + func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) @@ -355,14 +370,14 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { {}, }, } - reg := newPipelineRegistries(views) + reg := newPipelineRegistries(resource.Empty(), views) inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} intAggs, err := createAggregators[int64](reg, inst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, intAggs, 0) - reg = newPipelineRegistries(views) + reg = newPipelineRegistries(resource.Empty(), views) floatAggs, err := createAggregators[float64](reg, inst, unit.Dimensionless) assert.Error(t, err) @@ -384,7 +399,7 @@ func TestPipelineRegistryCreateAggregatorsDuplicateErrors(t *testing.T) { fooInst := view.Instrument{Name: "foo", Kind: view.SyncCounter} barInst := view.Instrument{Name: "bar", Kind: view.SyncCounter} - reg := newPipelineRegistries(views) + reg := newPipelineRegistries(resource.Empty(), views) intAggs, err := createAggregators[int64](reg, fooInst, unit.Dimensionless) assert.NoError(t, err) diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 481547d7062..d3a940bce58 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -48,7 +48,7 @@ func NewMeterProvider(options ...Option) *MeterProvider { flush, sdown := conf.readerSignals() - registry := newPipelineRegistries(conf.readers) + registry := newPipelineRegistries(conf.res, conf.readers) return &MeterProvider{ res: conf.res, From c979be08e4855bc34e1ed32679476df2cad115d3 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 22 Sep 2022 11:36:24 -0500 Subject: [PATCH 246/886] Update sdk/metric go.mod version to latest (#3216) * update the metric mod version to latest * update additional go.mods * Unify the Fixed section of Unreleased Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/otlp/otlpmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.mod | 2 +- sdk/metric/go.mod | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f7552df4b..4bb27913267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed +- Updated go.mods to point to valid versions of the sdk. (#3216) - Set the `MeterProvider` resource on all exported metric data. (#3218) ## [0.32.0] Revised Metric SDK (Alpha) - 2022-09-18 diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 47f1c895a8f..0aad429d95f 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.32.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.42.0 diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index f1c16c84468..67d690cd8c9 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -6,7 +6,7 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.32.0 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 029a1a3fedc..c26dae69dc2 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -7,7 +7,7 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel/sdk v1.10.0 ) require ( From d7bfe6675fe79b0c01cae3d4c5f06330b2fece73 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:47:08 -0500 Subject: [PATCH 247/886] Prerelease metrics/v0.32.1 (#3228) * Prepare for v0.32.1 release * Prepare experimental-metrics for version v0.32.1 * Update Changelog Co-authored-by: Tyler Yahn --- CHANGELOG.md | 11 +++++++++-- bridge/opencensus/go.mod | 4 ++-- bridge/opencensus/test/go.mod | 6 +++--- example/opencensus/go.mod | 8 ++++---- example/prometheus/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- sdk/metric/go.mod | 2 +- versions.yaml | 11 ++++------- 12 files changed, 38 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb27913267..74a3b9321f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [0.32.1] Metric SDK (Alpha) - 2022-09-22 + +### Changed + +- The Prometheus exporter sanitizes OpenTelemetry instrument names when exporting. + Invalid characters are replaced with `_`. (#3212) + ### Added - The metric portion of the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) has been reintroduced. (#3192) @@ -25,7 +32,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The metric SDK in `go.opentelemetry.io/otel/sdk/metric` is completely refactored to comply with the OpenTelemetry specification. Please see the package documentation for how the new SDK is initialized and configured. (#3175) - Update the minimum supported go version to go1.18. Removes support for go1.17 (#3179) -- Instead of dropping metric, the Prometheus exporter will replace any invalid character in metric names with `_`. (#3212) ### Removed @@ -1955,7 +1961,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.1...HEAD +[0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 [0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 [1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 [1.9.0/0.0.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.9.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index de502977519..b36e8a4a1ef 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.1 go.opentelemetry.io/otel/trace v1.10.0 ) diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 06c6851a3b1..f6e6252a359 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.31.0 + go.opentelemetry.io/otel/bridge/opencensus v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/trace v1.10.0 ) @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.32.0 // indirect + go.opentelemetry.io/otel/metric v0.32.1 // indirect + go.opentelemetry.io/otel/sdk/metric v0.32.1 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 10a5b0b57dc..82bb202b4d6 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -11,18 +11,18 @@ replace ( require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.31.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.31.0 + go.opentelemetry.io/otel/bridge/opencensus v0.32.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.1 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.0 // indirect + go.opentelemetry.io/otel/metric v0.32.1 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index c7e43afffaf..d8fc4431e21 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.0 - go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/exporters/prometheus v0.32.1 + go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.1 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 0aad429d95f..9b27c8f0caa 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -7,9 +7,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 712e728a1ce..be9ee425527 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,9 +6,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.0 - go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index fedbe208566..72fc1487d0d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.0 - go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 2760ff550c2..47e16051640 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,8 +6,8 @@ require ( github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.1 ) require ( diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 67d690cd8c9..0aaa5a1c218 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.0 + go.opentelemetry.io/otel/sdk/metric v0.32.1 ) require ( diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index c26dae69dc2..c4a5bcd8d11 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.0 + go.opentelemetry.io/otel/metric v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 ) diff --git a/versions.yaml b/versions.yaml index 7321b7ed97c..e66baa1268d 100644 --- a/versions.yaml +++ b/versions.yaml @@ -34,8 +34,9 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.32.0 + version: v0.32.1 modules: + - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc @@ -44,15 +45,11 @@ module-sets: - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/metric + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test experimental-schema: version: v0.0.3 modules: - go.opentelemetry.io/otel/schema - bridge: - version: v0.31.0 - modules: - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/opencensusmetric - - go.opentelemetry.io/otel/bridge/opencensus/test excluded-modules: - go.opentelemetry.io/otel/internal/tools From b369e59ba15baa5d6bd0304bf3ea4e7a26f301fe Mon Sep 17 00:00:00 2001 From: wdullaer Date: Fri, 23 Sep 2022 20:39:53 +0200 Subject: [PATCH 248/886] Improve trace status handling (#3214) * Implement specification compliant trace status handling * Update trace/trace.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update CHANGELOG.md Co-authored-by: Anthony Mirabella * chore: Make linter happy Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 +++ sdk/trace/span.go | 7 ++-- sdk/trace/span_test.go | 76 ++++++++++++++++++++++++++++++++++++++++++ trace/trace.go | 5 +-- 4 files changed, 88 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74a3b9321f0..c778b66c493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) + ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 ### Changed diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 449cf6c2552..9760923f702 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -189,15 +189,18 @@ func (s *recordingSpan) SetStatus(code codes.Code, description string) { if !s.IsRecording() { return } + s.mu.Lock() + defer s.mu.Unlock() + if s.status.Code > code { + return + } status := Status{Code: code} if code == codes.Error { status.Description = description } - s.mu.Lock() s.status = status - s.mu.Unlock() } // SetAttributes sets attributes of this span. diff --git a/sdk/trace/span_test.go b/sdk/trace/span_test.go index 2441defae71..20148a78702 100644 --- a/sdk/trace/span_test.go +++ b/sdk/trace/span_test.go @@ -22,8 +22,84 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" ) +func TestSetStatus(t *testing.T) { + tests := []struct { + name string + span recordingSpan + code codes.Code + description string + expected Status + }{ + { + "Error and description should overwrite Unset", + recordingSpan{}, + codes.Error, + "description", + Status{Code: codes.Error, Description: "description"}, + }, + { + "Ok should overwrite Unset and ignore description", + recordingSpan{}, + codes.Ok, + "description", + Status{Code: codes.Ok}, + }, + { + "Error and description should return error and overwrite description", + recordingSpan{status: Status{Code: codes.Error, Description: "d1"}}, + codes.Error, + "d2", + Status{Code: codes.Error, Description: "d2"}, + }, + { + "Ok should overwrite error and remove description", + recordingSpan{status: Status{Code: codes.Error, Description: "d1"}}, + codes.Ok, + "d2", + Status{Code: codes.Ok}, + }, + { + "Error and description should be ignored when already Ok", + recordingSpan{status: Status{Code: codes.Ok}}, + codes.Error, + "d2", + Status{Code: codes.Ok}, + }, + { + "Ok should be noop when already Ok", + recordingSpan{status: Status{Code: codes.Ok}}, + codes.Ok, + "d2", + Status{Code: codes.Ok}, + }, + { + "Unset should be noop when already Ok", + recordingSpan{status: Status{Code: codes.Ok}}, + codes.Unset, + "d2", + Status{Code: codes.Ok}, + }, + { + "Unset should be noop when already Error", + recordingSpan{status: Status{Code: codes.Error, Description: "d1"}}, + codes.Unset, + "d2", + Status{Code: codes.Error, Description: "d1"}, + }, + } + + for i := range tests { + tc := &tests[i] + t.Run(tc.name, func(t *testing.T) { + tc.span.SetStatus(tc.code, tc.description) + assert.Equal(t, tc.expected, tc.span.status) + }) + } +} + func TestTruncateAttr(t *testing.T) { const key = "key" diff --git a/trace/trace.go b/trace/trace.go index 97f3d83855b..4aa94f79f46 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -364,8 +364,9 @@ type Span interface { SpanContext() SpanContext // SetStatus sets the status of the Span in the form of a code and a - // description, overriding previous values set. The description is only - // included in a status when the code is for an error. + // description, provided the status hasn't already been set to a higher + // value before (OK > Error > Unset). The description is only included in a + // status when the code is for an error. SetStatus(code codes.Code, description string) // SetName sets the Span name. From 529049bd03318aeadea3b3ebc433e668cf6f0d3b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 26 Sep 2022 07:33:57 -0700 Subject: [PATCH 249/886] Remove unused meterRegistry Range method (#3230) Co-authored-by: Chester Cheung --- sdk/metric/meter.go | 15 --------------- sdk/metric/meter_test.go | 18 ------------------ 2 files changed, 33 deletions(-) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index c38777b69d5..ff8222cbc7c 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -76,21 +76,6 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { return m } -// Range calls f sequentially for each meter present in the meterRegistry. If -// f returns false, the iteration is stopped. -// -// Range is safe to call concurrently. -func (r *meterRegistry) Range(f func(*meter) bool) { - r.Lock() - defer r.Unlock() - - for _, m := range r.meters { - if !f(m) { - return - } - } -} - // meter handles the creation and coordination of all metric instruments. A // meter represents a single instrumentation scope; all metric telemetry // produced by an instrumentation scope will use metric instruments from a diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 004eb12f8a5..7d6923fdd58 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -51,24 +51,6 @@ func TestMeterRegistry(t *testing.T) { t.Run("GetDifferentMeter", func(t *testing.T) { assert.NotSamef(t, m0, m1, "returned same meters: %v", is1) }) - - t.Run("RangeComplete", func(t *testing.T) { - var got []*meter - r.Range(func(m *meter) bool { - got = append(got, m) - return true - }) - assert.ElementsMatch(t, []*meter{m0, m1}, got) - }) - - t.Run("RangeStopIteration", func(t *testing.T) { - var i int - r.Range(func(m *meter) bool { - i++ - return false - }) - assert.Equal(t, 1, i, "iteration not stopped after first flase return") - }) } // A meter should be able to make instruments concurrently. From 8c6e6c4bac681079ef8a17e9ff4a775cb1eea5bb Mon Sep 17 00:00:00 2001 From: Tony Han Date: Tue, 27 Sep 2022 00:04:09 +0800 Subject: [PATCH 250/886] Add an example of view (#3177) * Add an example of view * Update meter name in view example Co-authored-by: Sam Xie * Update dependabot and versions.yaml * Fix code review and add CHANGELOG Co-authored-by: Sam Xie Co-authored-by: Tyler Yahn --- .github/dependabot.yml | 9 + CHANGELOG.md | 4 + example/view/doc.go | 16 ++ example/view/go.mod | 39 ++++ example/view/go.sum | 485 +++++++++++++++++++++++++++++++++++++++++ example/view/main.go | 112 ++++++++++ versions.yaml | 1 + 7 files changed, 666 insertions(+) create mode 100644 example/view/doc.go create mode 100644 example/view/go.mod create mode 100644 example/view/go.sum create mode 100644 example/view/main.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e1ae982eb5c..a38cf2d16b1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -109,6 +109,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /example/view + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/zipkin labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index c778b66c493..ae74e5575cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Added an example of using metric views to customize instruments. (#3177) + ### Changed - `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) diff --git a/example/view/doc.go b/example/view/doc.go new file mode 100644 index 00000000000..6307e5f20e3 --- /dev/null +++ b/example/view/doc.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main provides a code sample of using metric views to customize instruments. +package main diff --git a/example/view/go.mod b/example/view/go.mod new file mode 100644 index 00000000000..12941f1038a --- /dev/null +++ b/example/view/go.mod @@ -0,0 +1,39 @@ +module go.opentelemetry.io/otel/example/view + +go 1.18 + +require ( + github.com/prometheus/client_golang v1.13.0 + go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel/exporters/prometheus v0.31.0 + go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel/sdk/metric v0.32.1 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect + go.opentelemetry.io/otel/trace v1.10.0 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + google.golang.org/protobuf v1.28.1 // indirect +) + +replace go.opentelemetry.io/otel => ../.. + +replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus + +replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/view/go.sum b/example/view/go.sum new file mode 100644 index 00000000000..f652c33031b --- /dev/null +++ b/example/view/go.sum @@ -0,0 +1,485 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/example/view/main.go b/example/view/main.go new file mode 100644 index 00000000000..872e12dde1f --- /dev/null +++ b/example/view/main.go @@ -0,0 +1,112 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "context" + "fmt" + "log" + "net/http" + "os" + "os/signal" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + + "go.opentelemetry.io/otel/attribute" + otelprom "go.opentelemetry.io/otel/exporters/prometheus" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +const meterName = "github.com/open-telemetry/opentelemetry-go/example/view" + +func main() { + ctx := context.Background() + + // The exporter embeds a default OpenTelemetry Reader, allowing it to be used in WithReader. + exporter := otelprom.New() + + // View to customize histogram buckets and rename a single histogram instrument. + customBucketsView, err := view.New( + // Match* to match instruments + view.MatchInstrumentName("custom_histogram"), + view.MatchInstrumentationScope(instrumentation.Scope{Name: meterName}), + + // With* to modify instruments + view.WithSetAggregation(aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, + }), + view.WithRename("bar"), + ) + if err != nil { + log.Fatal(err) + } + + // Default view to keep all instruments + defaultView, err := view.New(view.MatchInstrumentName("*")) + if err != nil { + log.Fatal(err) + } + + provider := metric.NewMeterProvider(metric.WithReader(exporter, customBucketsView, defaultView)) + meter := provider.Meter(meterName) + + // Start the prometheus HTTP server and pass the exporter Collector to it + go serveMetrics(exporter.Collector) + + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + if err != nil { + log.Fatal(err) + } + counter.Add(ctx, 5, attrs...) + + histogram, err := meter.SyncFloat64().Histogram("custom_histogram", instrument.WithDescription("a histogram with custom buckets and rename")) + if err != nil { + log.Fatal(err) + } + histogram.Record(ctx, 136, attrs...) + histogram.Record(ctx, 64, attrs...) + histogram.Record(ctx, 701, attrs...) + histogram.Record(ctx, 830, attrs...) + + ctx, _ = signal.NotifyContext(ctx, os.Interrupt) + <-ctx.Done() +} + +func serveMetrics(collector prometheus.Collector) { + registry := prometheus.NewRegistry() + err := registry.Register(collector) + if err != nil { + fmt.Printf("error registering collector: %v", err) + return + } + + log.Printf("serving metrics at localhost:2222/metrics") + http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) + err = http.ListenAndServe(":2222", nil) + if err != nil { + fmt.Printf("error serving http: %v", err) + return + } +} diff --git a/versions.yaml b/versions.yaml index e66baa1268d..9c6fb5c4561 100644 --- a/versions.yaml +++ b/versions.yaml @@ -47,6 +47,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test + - go.opentelemetry.io/otel/example/view experimental-schema: version: v0.0.3 modules: From 111a1d7bbd37c0e3ce6376cfbe419c260bc7389f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 27 Sep 2022 08:05:41 -0700 Subject: [PATCH 251/886] Flush pending telemetry when ForceFlush or Shutdown are called on a PeriodicReader (#3220) * Flush pending telemetry when ForceFlush called * Test flush of periodic reader * Flush pending telemetry on Shutdown * Fix things * Rename pHolder to p * Add testing for Shutdown * Fix doc for collect method * Fix collectAndExport doc * Fix collectAndExport English * Remove stdoutmetric example expected output * Add changes to changelog * Revert inadvertent change to golangci conf Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + exporters/stdout/stdoutmetric/example_test.go | 108 ------------------ sdk/metric/periodic_reader.go | 80 ++++++++++--- sdk/metric/periodic_reader_test.go | 53 ++++++++- 4 files changed, 115 insertions(+), 127 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae74e5575cc..25fc8c12371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) +- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 5bbf8c6faa0..a6103c8c607 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -123,112 +123,4 @@ func Example() { // Ensure the periodic reader is cleaned up by shutting down the sdk. _ = sdk.Shutdown(ctx) - - // Output: - // { - // "Resource": [ - // { - // "Key": "service.name", - // "Value": { - // "Type": "STRING", - // "Value": "stdoutmetric-example" - // } - // } - // ], - // "ScopeMetrics": [ - // { - // "Scope": { - // "Name": "example", - // "Version": "v0.0.1", - // "SchemaURL": "" - // }, - // "Metrics": [ - // { - // "Name": "requests", - // "Description": "Number of requests received", - // "Unit": "1", - // "Data": { - // "DataPoints": [ - // { - // "Attributes": [ - // { - // "Key": "server", - // "Value": { - // "Type": "STRING", - // "Value": "central" - // } - // } - // ], - // "StartTime": "2000-01-01T00:00:00Z", - // "Time": "2000-01-01T00:00:01Z", - // "Value": 5 - // } - // ], - // "Temporality": "DeltaTemporality", - // "IsMonotonic": true - // } - // }, - // { - // "Name": "latency", - // "Description": "Time spend processing received requests", - // "Unit": "ms", - // "Data": { - // "DataPoints": [ - // { - // "Attributes": [ - // { - // "Key": "server", - // "Value": { - // "Type": "STRING", - // "Value": "central" - // } - // } - // ], - // "StartTime": "2000-01-01T00:00:00Z", - // "Time": "2000-01-01T00:00:01Z", - // "Count": 10, - // "Bounds": [ - // 1, - // 5, - // 10 - // ], - // "BucketCounts": [ - // 1, - // 3, - // 6, - // 0 - // ], - // "Sum": 57 - // } - // ], - // "Temporality": "DeltaTemporality" - // } - // }, - // { - // "Name": "temperature", - // "Description": "CPU global temperature", - // "Unit": "cel(1 K)", - // "Data": { - // "DataPoints": [ - // { - // "Attributes": [ - // { - // "Key": "server", - // "Value": { - // "Type": "STRING", - // "Value": "central" - // } - // } - // ], - // "StartTime": "0001-01-01T00:00:00Z", - // "Time": "2000-01-01T00:00:01Z", - // "Value": 32.4 - // } - // ] - // } - // } - // ] - // } - // ] - // } } diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index cd729eff32e..3f705086162 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -115,15 +115,16 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade r := &periodicReader{ timeout: conf.timeout, exporter: exporter, + flushCh: make(chan chan error), cancel: cancel, + done: make(chan struct{}), temporalitySelector: conf.temporalitySelector, aggregationSelector: conf.aggregationSelector, } - r.wg.Add(1) go func() { - defer r.wg.Done() + defer func() { close(r.done) }() r.run(ctx, conf.interval) }() @@ -137,11 +138,12 @@ type periodicReader struct { timeout time.Duration exporter Exporter + flushCh chan chan error temporalitySelector TemporalitySelector aggregationSelector AggregationSelector - wg sync.WaitGroup + done chan struct{} cancel context.CancelFunc shutdownOnce sync.Once } @@ -161,15 +163,13 @@ func (r *periodicReader) run(ctx context.Context, interval time.Duration) { for { select { case <-ticker.C: - m, err := r.Collect(ctx) - if err == nil { - c, cancel := context.WithTimeout(ctx, r.timeout) - err = r.exporter.Export(c, m) - cancel() - } + err := r.collectAndExport(ctx) if err != nil { otel.Handle(err) } + case errCh := <-r.flushCh: + errCh <- r.collectAndExport(ctx) + ticker.Reset(interval) case <-ctx.Done(): return } @@ -195,13 +195,27 @@ func (r *periodicReader) aggregation(kind view.InstrumentKind) aggregation.Aggre return r.aggregationSelector(kind) } +// collectAndExport gather all metric data related to the periodicReader r from +// the SDK and exports it with r's exporter. +func (r *periodicReader) collectAndExport(ctx context.Context) error { + m, err := r.Collect(ctx) + if err == nil { + err = r.export(ctx, m) + } + return err +} + // Collect gathers and returns all metric data related to the Reader from // the SDK. The returned metric data is not exported to the configured // exporter, it is left to the caller to handle that if desired. // // An error is returned if this is called after Shutdown. func (r *periodicReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { - p := r.producer.Load() + return r.collect(ctx, r.producer.Load()) +} + +// collect unwraps p as a produceHolder and returns its produce results. +func (r *periodicReader) collect(ctx context.Context, p interface{}) (metricdata.ResourceMetrics, error) { if p == nil { return metricdata.ResourceMetrics{}, ErrReaderNotRegistered } @@ -218,25 +232,61 @@ func (r *periodicReader) Collect(ctx context.Context) (metricdata.ResourceMetric return ph.produce(ctx) } -// ForceFlush flushes the Exporter. +// export exports metric data m using r's exporter. +func (r *periodicReader) export(ctx context.Context, m metricdata.ResourceMetrics) error { + c, cancel := context.WithTimeout(ctx, r.timeout) + defer cancel() + return r.exporter.Export(c, m) +} + +// ForceFlush flushes pending telemetry. func (r *periodicReader) ForceFlush(ctx context.Context) error { + errCh := make(chan error, 1) + select { + case r.flushCh <- errCh: + select { + case err := <-errCh: + if err != nil { + return err + } + close(errCh) + case <-ctx.Done(): + return ctx.Err() + } + case <-r.done: + return ErrReaderShutdown + case <-ctx.Done(): + return ctx.Err() + } return r.exporter.ForceFlush(ctx) } -// Shutdown stops the export pipeline. +// Shutdown flushes pending telemetry and then stops the export pipeline. func (r *periodicReader) Shutdown(ctx context.Context) error { err := ErrReaderShutdown r.shutdownOnce.Do(func() { // Stop the run loop. r.cancel() - r.wg.Wait() + <-r.done // Any future call to Collect will now return ErrReaderShutdown. - r.producer.Store(produceHolder{ + ph := r.producer.Swap(produceHolder{ produce: shutdownProducer{}.produce, }) - err = r.exporter.Shutdown(ctx) + if ph != nil { // Reader was registered. + // Flush pending telemetry. + var m metricdata.ResourceMetrics + m, err = r.collect(ctx, ph) + if err == nil { + err = r.export(ctx, m) + } + } + + sErr := r.exporter.Shutdown(ctx) + if err == nil || err == ErrReaderShutdown { + err = sErr + } }) return err } diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 8ea2f9ffc91..8c3c0599158 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -98,6 +98,7 @@ func (ts *periodicReaderTestSuite) SetupTest() { } ts.ErrReader = NewPeriodicReader(e) + ts.ErrReader.register(testProducer{}) } func (ts *periodicReaderTestSuite) TearDownTest() { @@ -138,11 +139,13 @@ func (eh chErrorHandler) Handle(err error) { eh.Err <- err } -func TestPeriodicReaderRun(t *testing.T) { +func triggerTicker(t *testing.T) chan time.Time { + t.Helper() + // Override the ticker C chan so tests are not flaky and rely on timing. - defer func(orig func(time.Duration) *time.Ticker) { - newTicker = orig - }(newTicker) + orig := newTicker + t.Cleanup(func() { newTicker = orig }) + // Keep this at size zero so when triggered with a send it will hang until // the select case is selected and the collection loop is started. trigger := make(chan time.Time) @@ -151,6 +154,11 @@ func TestPeriodicReaderRun(t *testing.T) { ticker.C = trigger return ticker } + return trigger +} + +func TestPeriodicReaderRun(t *testing.T) { + trigger := triggerTicker(t) // Register an error handler to validate export errors are passed to // otel.Handle. @@ -177,6 +185,43 @@ func TestPeriodicReaderRun(t *testing.T) { _ = r.Shutdown(context.Background()) } +func TestPeriodicReaderFlushesPending(t *testing.T) { + // Override the ticker so tests are not flaky and rely on timing. + trigger := triggerTicker(t) + t.Cleanup(func() { close(trigger) }) + + expFunc := func(t *testing.T) (exp Exporter, called *bool) { + called = new(bool) + return &fnExporter{ + exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { + // The testProducer produces testMetrics. + assert.Equal(t, testMetrics, m) + *called = true + return assert.AnError + }, + }, called + } + + t.Run("ForceFlush", func(t *testing.T) { + exp, called := expFunc(t) + r := NewPeriodicReader(exp) + r.register(testProducer{}) + assert.Equal(t, assert.AnError, r.ForceFlush(context.Background()), "export error not returned") + assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") + + // Ensure Reader is allowed clean up attempt. + _ = r.Shutdown(context.Background()) + }) + + t.Run("Shutdown", func(t *testing.T) { + exp, called := expFunc(t) + r := NewPeriodicReader(exp) + r.register(testProducer{}) + assert.Equal(t, assert.AnError, r.Shutdown(context.Background()), "export error not returned") + assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") + }) +} + func BenchmarkPeriodicReader(b *testing.B) { b.Run("Collect", benchReaderCollectFunc( NewPeriodicReader(new(fnExporter)), From 12e16d41e71b1719f87e8018e702c9fe06ddc5f3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 27 Sep 2022 09:08:34 -0700 Subject: [PATCH 252/886] Bump golang.org/x/sys/unix (#3235) * Bump golang.org/x/sys/unix Fix #3234 Address GO-2022-0493 by upgrading golang.org/x/sys/unix from v0.0.0-20210423185535-09eb48e85fd7 to v0.0.0-20220919091848-fb04ddd9f9c8. * Add changes to changelog --- CHANGELOG.md | 2 ++ bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 3 ++- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 3 ++- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 3 ++- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 3 ++- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 3 ++- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 3 ++- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 3 ++- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 49 files changed, 74 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fc8c12371..cf26a4ff104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) - Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) +- Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. + This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index b36e8a4a1ef..4db9c67cbb8 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index c7ddc1e1307..1eac8058cc6 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -63,8 +63,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index f6e6252a359..4edd18d9b3f 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v0.32.1 // indirect go.opentelemetry.io/otel/sdk/metric v0.32.1 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index c7ddc1e1307..1eac8058cc6 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -63,8 +63,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/fib/go.mod b/example/fib/go.mod index 1aab2c16536..08c50c22927 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index 2af466654a5..a0644dac3bc 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index e7e756ce178..2ebbc286fb0 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/stretchr/objx v0.4.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index ac1d211214a..191a4c66483 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -14,8 +14,8 @@ github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 51eee8be307..616940950d9 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 2af466654a5..a0644dac3bc 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 82bb202b4d6..637eeef3667 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v0.32.1 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index c7ddc1e1307..1eac8058cc6 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -63,8 +63,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 5bce9f3a3e6..7f641a7b179 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect google.golang.org/protobuf v1.28.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index aa7b5fa99e0..4b58624af84 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -268,8 +268,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 6a53e93e7ad..a688e63b372 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 2af466654a5..a0644dac3bc 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index d8fc4431e21..1672cc93961 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index f652c33031b..45bdb136b1f 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -326,8 +326,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/view/go.mod b/example/view/go.mod index 12941f1038a..bf525bc98d1 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index f652c33031b..45bdb136b1f 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -326,8 +326,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 4ff6a660d9b..054156e39d5 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.0 // indirect - golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 88b4d1e9ab0..e38a353213f 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -156,8 +156,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 5ef17770757..566d530d019 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 3b6e32a4a50..198345fe9e0 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -13,8 +13,8 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9b27c8f0caa..857dc047429 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -25,7 +25,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 82bf95645f4..9d432a59d7c 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -266,8 +266,9 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index be9ee425527..11de4c8f12a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index c066ceeecc1..5ba9f1dd475 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -271,8 +271,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 72fc1487d0d..ada9ef43f21 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect google.golang.org/grpc v1.46.2 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index c066ceeecc1..5ba9f1dd475 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -271,8 +271,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 66c709bcb55..9d2ac99a681 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -23,7 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index c066ceeecc1..5ba9f1dd475 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -271,8 +271,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 34c5e98e761..cf56dfd79f1 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -25,7 +25,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index b97b96c7e71..6c9ac94b89b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -276,8 +276,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index d765af971a5..c3cec4f3415 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect google.golang.org/grpc v1.46.2 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index c8a15d98b71..7a8d500d19c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -270,8 +270,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 47e16051640..8d67412d12e 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 51544d68f4f..80517ac594b 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -329,8 +329,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 0aaa5a1c218..a5463ac1dd6 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 2e2aed63d24..46f26da7b9e 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 36b1300622b..382ea1458c4 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 2e2aed63d24..46f26da7b9e 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index d6aefe4ea36..e5c67485e94 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 5e5211c3d8c..6ba32527639 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -160,8 +160,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/sdk/go.mod b/sdk/go.mod index 1d2a7e828b9..182c2bb5332 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/trace v1.10.0 - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index ac3360c6fee..a7edc879c2b 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -12,8 +12,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index c4a5bcd8d11..4326b3ada53 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect - golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 // indirect + golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 2e2aed63d24..46f26da7b9e 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= +golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= From aca054b07588d85cd974b041b4e6688eff918a38 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 28 Sep 2022 08:47:20 -0700 Subject: [PATCH 253/886] Refactor Pipeline (#3233) * Add views field to pipeline Redundant maps tracking readers to views and readers to pipelines exist in the pipelineRegistry. Unify these maps by tracing views in pipelines. * Rename newPipelineRegistries->newPipelineRegistry * Add Reader as field to pipeline * Replace createAggregators with resolver facilitator * Replace create agg funcs with inserter facilitator * Correct documentation * Replace pipelineRegistry with []pipeline type * Rename newPipelineRegistry->newPipelines * Fix pipeline_registry_test * Flatten isMonotonic into only use * Update FIXME into TODO * Rename instrument provider resolver field to resolve * Fix comment English * Fix drop aggregator detection --- sdk/metric/instrument_provider.go | 40 ++-- sdk/metric/meter.go | 22 +-- sdk/metric/pipeline.go | 263 ++++++++++++++++----------- sdk/metric/pipeline_registry_test.go | 54 +++--- sdk/metric/pipeline_test.go | 8 +- sdk/metric/provider.go | 4 +- 6 files changed, 220 insertions(+), 171 deletions(-) diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go index ad215a853b2..8640b58e52e 100644 --- a/sdk/metric/instrument_provider.go +++ b/sdk/metric/instrument_provider.go @@ -27,8 +27,8 @@ import ( ) type asyncInt64Provider struct { - scope instrumentation.Scope - registry *pipelineRegistry + scope instrumentation.Scope + resolve *resolver[int64] } var _ asyncint64.InstrumentProvider = asyncInt64Provider{} @@ -37,7 +37,7 @@ var _ asyncint64.InstrumentProvider = asyncInt64Provider{} func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -56,7 +56,7 @@ func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asy func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -74,7 +74,7 @@ func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -89,8 +89,8 @@ func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (async } type asyncFloat64Provider struct { - scope instrumentation.Scope - registry *pipelineRegistry + scope instrumentation.Scope + resolve *resolver[float64] } var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} @@ -99,7 +99,7 @@ var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -117,7 +117,7 @@ func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (a func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -135,7 +135,7 @@ func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Opti func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -150,8 +150,8 @@ func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asy } type syncInt64Provider struct { - scope instrumentation.Scope - registry *pipelineRegistry + scope instrumentation.Scope + resolve *resolver[int64] } var _ syncint64.InstrumentProvider = syncInt64Provider{} @@ -160,7 +160,7 @@ var _ syncint64.InstrumentProvider = syncInt64Provider{} func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -178,7 +178,7 @@ func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (sync func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -196,7 +196,7 @@ func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[int64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -211,8 +211,8 @@ func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (sy } type syncFloat64Provider struct { - scope instrumentation.Scope - registry *pipelineRegistry + scope instrumentation.Scope + resolve *resolver[float64] } var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} @@ -221,7 +221,7 @@ var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -239,7 +239,7 @@ func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (sy func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), @@ -257,7 +257,7 @@ func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Optio func (p syncFloat64Provider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { cfg := instrument.NewConfig(opts...) - aggs, err := createAggregators[float64](p.registry, view.Instrument{ + aggs, err := p.resolve.Aggregators(view.Instrument{ Scope: p.scope, Name: name, Description: cfg.Description(), diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index ff8222cbc7c..82d5a5269be 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -42,7 +42,7 @@ type meterRegistry struct { meters map[instrumentation.Scope]*meter - registry *pipelineRegistry + pipes pipelines } // Get returns a registered meter matching the instrumentation scope if it @@ -56,8 +56,8 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { if r.meters == nil { m := &meter{ - Scope: s, - registry: r.registry, + Scope: s, + pipes: r.pipes, } r.meters = map[instrumentation.Scope]*meter{s: m} return m @@ -69,8 +69,8 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { } m = &meter{ - Scope: s, - registry: r.registry, + Scope: s, + pipes: r.pipes, } r.meters[s] = m return m @@ -83,7 +83,7 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { type meter struct { instrumentation.Scope - registry *pipelineRegistry + pipes pipelines } // Compile-time check meter implements metric.Meter. @@ -91,27 +91,27 @@ var _ metric.Meter = (*meter)(nil) // AsyncInt64 returns the asynchronous integer instrument provider. func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { - return asyncInt64Provider{scope: m.Scope, registry: m.registry} + return asyncInt64Provider{scope: m.Scope, resolve: newResolver[int64](m.pipes)} } // AsyncFloat64 returns the asynchronous floating-point instrument provider. func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return asyncFloat64Provider{scope: m.Scope, registry: m.registry} + return asyncFloat64Provider{scope: m.Scope, resolve: newResolver[float64](m.pipes)} } // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { - m.registry.registerCallback(f) + m.pipes.registerCallback(f) return nil } // SyncInt64 returns the synchronous integer instrument provider. func (m *meter) SyncInt64() syncint64.InstrumentProvider { - return syncInt64Provider{scope: m.Scope, registry: m.registry} + return syncInt64Provider{scope: m.Scope, resolve: newResolver[int64](m.pipes)} } // SyncFloat64 returns the synchronous floating-point instrument provider. func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - return syncFloat64Provider{scope: m.Scope, registry: m.registry} + return syncFloat64Provider{scope: m.Scope, resolve: newResolver[float64](m.pipes)} } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 6783aef5d0f..0bd52d63023 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -30,9 +30,25 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) +var ( + errCreatingAggregators = errors.New("could not create all aggregators") + errIncompatibleAggregation = errors.New("incompatible aggregation") + errUnknownAggregation = errors.New("unrecognized aggregation") +) + type aggregator interface { Aggregation() metricdata.Aggregation } + +// instrumentID is used to identify multiple instruments being mapped to the +// same aggregator. e.g. using an exact match view with a name=* view. You +// can't use a view.Instrument here because not all Aggregators are comparable. +type instrumentID struct { + scope instrumentation.Scope + name string + description string +} + type instrumentKey struct { name string unit unit.Unit @@ -43,12 +59,14 @@ type instrumentValue struct { aggregator aggregator } -func newPipeline(res *resource.Resource) *pipeline { +func newPipeline(res *resource.Resource, reader Reader, views []view.View) *pipeline { if res == nil { res = resource.Empty() } return &pipeline{ resource: res, + reader: reader, + views: views, aggregations: make(map[instrumentation.Scope]map[instrumentKey]instrumentValue), } } @@ -61,6 +79,9 @@ func newPipeline(res *resource.Resource) *pipeline { type pipeline struct { resource *resource.Resource + reader Reader + views []view.View + sync.Mutex aggregations map[instrumentation.Scope]map[instrumentKey]instrumentValue callbacks []func(context.Context) @@ -155,106 +176,38 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err }, nil } -// pipelineRegistry manages creating pipelines, and aggregators. Meters retrieve -// new Aggregators from a pipelineRegistry. -type pipelineRegistry struct { - views map[Reader][]view.View - pipelines map[Reader]*pipeline -} - -func newPipelineRegistries(res *resource.Resource, views map[Reader][]view.View) *pipelineRegistry { - pipelines := map[Reader]*pipeline{} - for rdr := range views { - pipe := &pipeline{resource: res} - rdr.register(pipe) - pipelines[rdr] = pipe - } - return &pipelineRegistry{ - views: views, - pipelines: pipelines, - } +// inserter facilitates inserting of new instruments into a pipeline. +type inserter[N int64 | float64] struct { + pipeline *pipeline } -// TODO (#3053) Only register callbacks if any instrument matches in a view. -func (reg *pipelineRegistry) registerCallback(fn func(context.Context)) { - for _, pipe := range reg.pipelines { - pipe.addCallback(fn) - } +func newInserter[N int64 | float64](p *pipeline) *inserter[N] { + return &inserter[N]{p} } -// createAggregators will create all backing aggregators for an instrument. -// It will return an error if an instrument is registered more than once. -// Note: There may be returned aggregators with an error. -func createAggregators[N int64 | float64](reg *pipelineRegistry, inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { +// Instrument inserts instrument inst with instUnit returning the Aggregators +// that need to be updated with measurments for that instrument. +func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { + seen := map[instrumentID]struct{}{} var aggs []internal.Aggregator[N] - - errs := &multierror{} - for rdr, views := range reg.views { - pipe := reg.pipelines[rdr] - rdrAggs, err := createAggregatorsForReader[N](rdr, views, inst) - if err != nil { - errs.append(err) - } - for inst, agg := range rdrAggs { - err := pipe.addAggregator(inst.scope, inst.name, inst.description, instUnit, agg) - if err != nil { - errs.append(err) - } - aggs = append(aggs, agg) - } - } - return aggs, errs.errorOrNil() -} - -type multierror struct { - wrapped error - errors []string -} - -func (m *multierror) errorOrNil() error { - if len(m.errors) == 0 { - return nil - } - return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; ")) -} - -func (m *multierror) append(err error) { - m.errors = append(m.errors, err.Error()) -} - -// instrumentID is used to identify multiple instruments being mapped to the same aggregator. -// e.g. using an exact match view with a name=* view. -// You can't use a view.Instrument here because not all Aggregators are comparable. -type instrumentID struct { - scope instrumentation.Scope - name string - description string -} - -var errCreatingAggregators = errors.New("could not create all aggregators") - -func createAggregatorsForReader[N int64 | float64](rdr Reader, views []view.View, inst view.Instrument) (map[instrumentID]internal.Aggregator[N], error) { - aggs := map[instrumentID]internal.Aggregator[N]{} - errs := &multierror{ - wrapped: errCreatingAggregators, - } - for _, v := range views { + errs := &multierror{wrapped: errCreatingAggregators} + for _, v := range i.pipeline.views { inst, match := v.TransformInstrument(inst) - ident := instrumentID{ + id := instrumentID{ scope: inst.Scope, name: inst.Name, description: inst.Description, } - if _, ok := aggs[ident]; ok || !match { + if _, ok := seen[id]; ok || !match { continue } if inst.Aggregation == nil { - inst.Aggregation = rdr.aggregation(inst.Kind) + inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) } else if _, ok := inst.Aggregation.(aggregation.Default); ok { - inst.Aggregation = rdr.aggregation(inst.Kind) + inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) } if err := isAggregatorCompatible(inst.Kind, inst.Aggregation); err != nil { @@ -263,51 +216,63 @@ func createAggregatorsForReader[N int64 | float64](rdr Reader, views []view.View continue } - agg := createAggregator[N](inst.Aggregation, rdr.temporality(inst.Kind), isMonotonic(inst.Kind)) - if agg != nil { - // TODO (#3011): If filtering is done at the instrument level add here. - // This is where the aggregator and the view are both in scope. - aggs[ident] = agg + agg, err := i.aggregator(inst) + if err != nil { + errs.append(err) + continue + } + if agg == nil { // Drop aggregator. + continue + } + // TODO (#3011): If filtering is done at the instrument level add here. + // This is where the aggregator and the view are both in scope. + aggs = append(aggs, agg) + seen[id] = struct{}{} + err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, agg) + if err != nil { + errs.append(err) } } + // TODO(#3224): handle when no views match. Default should be reader + // aggregation returned. return aggs, errs.errorOrNil() } -func isMonotonic(kind view.InstrumentKind) bool { - switch kind { +// aggregator returns the Aggregator for an instrument configuration. If the +// instrument defines an unknown aggregation, an error is returned. +func (i *inserter[N]) aggregator(inst view.Instrument) (internal.Aggregator[N], error) { + // TODO (#3011): If filtering is done by the Aggregator it should be passed + // here. + var ( + temporality = i.pipeline.reader.temporality(inst.Kind) + monotonic bool + ) + + switch inst.Kind { case view.AsyncCounter, view.SyncCounter, view.SyncHistogram: - return true + monotonic = true } - return false -} -// createAggregator takes the config (Aggregation and Temporality) and produces a memory backed Aggregator. -// TODO (#3011): If filterting is done by the Aggregator it should be passed here. -func createAggregator[N int64 | float64](agg aggregation.Aggregation, temporality metricdata.Temporality, monotonic bool) internal.Aggregator[N] { - switch agg := agg.(type) { + switch agg := inst.Aggregation.(type) { case aggregation.Drop: - return nil + return nil, nil case aggregation.LastValue: - return internal.NewLastValue[N]() + return internal.NewLastValue[N](), nil case aggregation.Sum: if temporality == metricdata.CumulativeTemporality { - return internal.NewCumulativeSum[N](monotonic) + return internal.NewCumulativeSum[N](monotonic), nil } - return internal.NewDeltaSum[N](monotonic) + return internal.NewDeltaSum[N](monotonic), nil case aggregation.ExplicitBucketHistogram: if temporality == metricdata.CumulativeTemporality { - return internal.NewCumulativeHistogram[N](agg) + return internal.NewCumulativeHistogram[N](agg), nil } - return internal.NewDeltaHistogram[N](agg) + return internal.NewDeltaHistogram[N](agg), nil } - return nil + return nil, errUnknownAggregation } -// TODO: review need for aggregation check after https://github.com/open-telemetry/opentelemetry-specification/issues/2710 -var errIncompatibleAggregation = errors.New("incompatible aggregation") -var errUnknownAggregation = errors.New("unrecognized aggregation") - -// is aggregatorCompatible checks if the aggregation can be used by the instrument. +// isAggregatorCompatible checks if the aggregation can be used by the instrument. // Current compatibility: // // | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | @@ -324,18 +289,24 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio if kind == view.SyncCounter || kind == view.SyncHistogram { return nil } + // TODO: review need for aggregation check after + // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 return errIncompatibleAggregation case aggregation.Sum: switch kind { case view.AsyncCounter, view.AsyncUpDownCounter, view.SyncCounter, view.SyncHistogram, view.SyncUpDownCounter: return nil default: + // TODO: review need for aggregation check after + // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 return errIncompatibleAggregation } case aggregation.LastValue: if kind == view.AsyncGauge { return nil } + // TODO: review need for aggregation check after + // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 return errIncompatibleAggregation case aggregation.Drop: return nil @@ -344,3 +315,75 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio return fmt.Errorf("%w: %v", errUnknownAggregation, agg) } } + +// pipelines is the group of pipelines connecting Readers with instrument +// measurement. +type pipelines []*pipeline + +func newPipelines(res *resource.Resource, readers map[Reader][]view.View) pipelines { + pipes := make([]*pipeline, 0, len(readers)) + for r, v := range readers { + p := &pipeline{ + resource: res, + reader: r, + views: v, + } + r.register(p) + pipes = append(pipes, p) + } + return pipes +} + +// TODO (#3053) Only register callbacks if any instrument matches in a view. +func (p pipelines) registerCallback(fn func(context.Context)) { + for _, pipe := range p { + pipe.addCallback(fn) + } +} + +// resolver facilitates resolving Aggregators an instrument needs to aggregate +// measurements with while updating all pipelines that need to pull from those +// aggregations. +type resolver[N int64 | float64] struct { + inserters []*inserter[N] +} + +func newResolver[N int64 | float64](p pipelines) *resolver[N] { + in := make([]*inserter[N], len(p)) + for i := range in { + in[i] = newInserter[N](p[i]) + } + return &resolver[N]{in} +} + +// Aggregators returns the Aggregators instrument inst needs to update when it +// makes a measurement. +func (r *resolver[N]) Aggregators(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { + var aggs []internal.Aggregator[N] + + errs := &multierror{} + for _, i := range r.inserters { + a, err := i.Instrument(inst, instUnit) + if err != nil { + errs.append(err) + } + aggs = append(aggs, a...) + } + return aggs, errs.errorOrNil() +} + +type multierror struct { + wrapped error + errors []string +} + +func (m *multierror) errorOrNil() error { + if len(m.errors) == 0 { + return nil + } + return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; ")) +} + +func (m *multierror) append(err error) { + m.errors = append(m.errors, err.Error()) +} diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 1182eeca06a..f89a09360ba 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -211,7 +211,8 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { - got, err := createAggregatorsForReader[N](tt.reader, tt.views, tt.inst) + i := newInserter[N](newPipeline(nil, tt.reader, tt.views)) + got, err := i.Instrument(tt.inst, unit.Dimensionless) assert.ErrorIs(t, err, tt.wantErr) require.Len(t, got, tt.wantLen) for _, agg := range got { @@ -222,13 +223,12 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } func testInvalidInstrumentShouldPanic[N int64 | float64]() { - reader := NewManualReader() - views := []view.View{{}} + i := newInserter[N](newPipeline(nil, NewManualReader(), []view.View{{}})) inst := view.Instrument{ Name: "foo", Kind: view.InstrumentKind(255), } - _, _ = createAggregatorsForReader[N](reader, views, inst) + _, _ = i.Instrument(inst, unit.Dimensionless) } func TestInvalidInstrumentShouldPanic(t *testing.T) { @@ -323,27 +323,29 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - reg := newPipelineRegistries(resource.Empty(), tt.views) - testPipelineRegistryCreateIntAggregators(t, reg, tt.wantCount) - reg = newPipelineRegistries(resource.Empty(), tt.views) - testPipelineRegistryCreateFloatAggregators(t, reg, tt.wantCount) + p := newPipelines(resource.Empty(), tt.views) + testPipelineRegistryResolveIntAggregators(t, p, tt.wantCount) + p = newPipelines(resource.Empty(), tt.views) + testPipelineRegistryResolveFloatAggregators(t, p, tt.wantCount) }) } } -func testPipelineRegistryCreateIntAggregators(t *testing.T, reg *pipelineRegistry, wantCount int) { +func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} - aggs, err := createAggregators[int64](reg, inst, unit.Dimensionless) + r := newResolver[int64](p) + aggs, err := r.Aggregators(inst, unit.Dimensionless) assert.NoError(t, err) require.Len(t, aggs, wantCount) } -func testPipelineRegistryCreateFloatAggregators(t *testing.T, reg *pipelineRegistry, wantCount int) { +func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} - aggs, err := createAggregators[float64](reg, inst, unit.Dimensionless) + r := newResolver[float64](p) + aggs, err := r.Aggregators(inst, unit.Dimensionless) assert.NoError(t, err) require.Len(t, aggs, wantCount) @@ -356,8 +358,8 @@ func TestPipelineRegistryResource(t *testing.T) { NewManualReader(): {{}, v}, } res := resource.NewSchemaless(attribute.String("key", "val")) - reg := newPipelineRegistries(res, views) - for _, p := range reg.pipelines { + pipes := newPipelines(res, views) + for _, p := range pipes { assert.True(t, res.Equal(p.resource), "resource not set") } } @@ -370,16 +372,18 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { {}, }, } - reg := newPipelineRegistries(resource.Empty(), views) + p := newPipelines(resource.Empty(), views) inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} - intAggs, err := createAggregators[int64](reg, inst, unit.Dimensionless) + ri := newResolver[int64](p) + intAggs, err := ri.Aggregators(inst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, intAggs, 0) - reg = newPipelineRegistries(resource.Empty(), views) + p = newPipelines(resource.Empty(), views) - floatAggs, err := createAggregators[float64](reg, inst, unit.Dimensionless) + rf := newResolver[float64](p) + floatAggs, err := rf.Aggregators(inst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, floatAggs, 0) } @@ -399,28 +403,30 @@ func TestPipelineRegistryCreateAggregatorsDuplicateErrors(t *testing.T) { fooInst := view.Instrument{Name: "foo", Kind: view.SyncCounter} barInst := view.Instrument{Name: "bar", Kind: view.SyncCounter} - reg := newPipelineRegistries(resource.Empty(), views) + p := newPipelines(resource.Empty(), views) - intAggs, err := createAggregators[int64](reg, fooInst, unit.Dimensionless) + ri := newResolver[int64](p) + intAggs, err := ri.Aggregators(fooInst, unit.Dimensionless) assert.NoError(t, err) assert.Len(t, intAggs, 1) // The Rename view should error, because it creates a foo instrument. - intAggs, err = createAggregators[int64](reg, barInst, unit.Dimensionless) + intAggs, err = ri.Aggregators(barInst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, intAggs, 2) // Creating a float foo instrument should error because there is an int foo instrument. - floatAggs, err := createAggregators[float64](reg, fooInst, unit.Dimensionless) + rf := newResolver[float64](p) + floatAggs, err := rf.Aggregators(fooInst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, floatAggs, 1) fooInst = view.Instrument{Name: "foo-float", Kind: view.SyncCounter} - _, err = createAggregators[float64](reg, fooInst, unit.Dimensionless) + _, err = rf.Aggregators(fooInst, unit.Dimensionless) assert.NoError(t, err) - floatAggs, err = createAggregators[float64](reg, barInst, unit.Dimensionless) + floatAggs, err = rf.Aggregators(barInst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, floatAggs, 2) } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 52183360fd3..ca83c9c3a9e 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -61,7 +61,7 @@ func TestEmptyPipeline(t *testing.T) { } func TestNewPipeline(t *testing.T) { - pipe := newPipeline(nil) + pipe := newPipeline(nil, nil, nil) output, err := pipe.produce(context.Background()) require.NoError(t, err) @@ -158,7 +158,7 @@ func TestPipelineDuplicateRegistration(t *testing.T) { } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - pipe := newPipeline(nil) + pipe := newPipeline(nil, nil, nil) err := pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) require.NoError(t, err) @@ -177,7 +177,7 @@ func TestPipelineDuplicateRegistration(t *testing.T) { func TestPipelineUsesResource(t *testing.T) { res := resource.NewWithAttributes("noSchema", attribute.String("test", "resource")) - pipe := newPipeline(res) + pipe := newPipeline(res, nil, nil) output, err := pipe.produce(context.Background()) assert.NoError(t, err) @@ -185,7 +185,7 @@ func TestPipelineUsesResource(t *testing.T) { } func TestPipelineConcurrency(t *testing.T) { - pipe := newPipeline(nil) + pipe := newPipeline(nil, nil, nil) ctx := context.Background() var wg sync.WaitGroup diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index d3a940bce58..0b13e67d92b 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -48,13 +48,13 @@ func NewMeterProvider(options ...Option) *MeterProvider { flush, sdown := conf.readerSignals() - registry := newPipelineRegistries(conf.res, conf.readers) + registry := newPipelines(conf.res, conf.readers) return &MeterProvider{ res: conf.res, meters: meterRegistry{ - registry: registry, + pipes: registry, }, forceFlush: flush, From efdbe5aad139bda426cf00146f8d6028fe32c320 Mon Sep 17 00:00:00 2001 From: Kuisong Tong Date: Sun, 2 Oct 2022 08:45:13 -0700 Subject: [PATCH 254/886] pass res to exporter (#3250) --- bridge/opencensus/metric.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index d9c44545c65..82965b1af5b 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -40,7 +40,7 @@ type exporter struct { // NewMetricExporter returns an OpenCensus exporter that exports to an // OpenTelemetry exporter. func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { - return &exporter{base: base} + return &exporter{base: base, res: res} } // ExportMetrics implements the OpenCensus metric Exporter interface by sending From 3675379e73448c28742f6e8c02c8be84c13c2bf9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 3 Oct 2022 09:57:27 -0700 Subject: [PATCH 255/886] Remove the unused Resource field from the MeterProvider (#3253) --- sdk/metric/provider.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 0b13e67d92b..db890d1060b 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -19,7 +19,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/resource" ) // MeterProvider handles the creation and coordination of Meters. All Meters @@ -27,8 +26,6 @@ import ( // the same Views applied to them, and have their produced metric telemetry // passed to the configured Readers. type MeterProvider struct { - res *resource.Resource - meters meterRegistry forceFlush, shutdown func(context.Context) error @@ -51,8 +48,6 @@ func NewMeterProvider(options ...Option) *MeterProvider { registry := newPipelines(conf.res, conf.readers) return &MeterProvider{ - res: conf.res, - meters: meterRegistry{ pipes: registry, }, From 3b657f780142b5e3f58af0f24675b2cf267d9cd2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 4 Oct 2022 13:58:43 -0700 Subject: [PATCH 256/886] Fix otlpmetric pkg name in exporting_data.md (#3259) --- website_docs/exporting_data.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/exporting_data.md b/website_docs/exporting_data.md index 4b409aa574f..a615722a4fe 100644 --- a/website_docs/exporting_data.md +++ b/website_docs/exporting_data.md @@ -64,7 +64,7 @@ resources := resource.New(context.Background(), ## OTLP Exporter -OpenTelemetry Protocol (OTLP) export is available in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetrics` packages. +OpenTelemetry Protocol (OTLP) export is available in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` packages. Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp) From 697d245b9ccf375c1d49e7492d36bceae80acfe4 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 5 Oct 2022 00:41:18 +0200 Subject: [PATCH 257/886] Update bucket default bounds (#3222) * update bucket default bounds to match the specification * add changelog entry * test custom boundaries with valid histogram Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/prometheus/exporter_test.go | 19 ++++++++++-- exporters/prometheus/testdata/histogram.txt | 30 +++++++++---------- .../prometheus/testdata/sanitized_names.txt | 5 ++++ sdk/metric/meter_test.go | 8 ++--- sdk/metric/reader.go | 2 +- 6 files changed, 42 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf26a4ff104..cb99127ad4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) - Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) +- Update histogram default bounds to match the requirements of the latest specification. (#3222) ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 6d46c3be0db..55db838dcd2 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -27,6 +27,8 @@ import ( otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/view" ) func TestPrometheusExporter(t *testing.T) { @@ -74,7 +76,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - histogram, err := meter.SyncFloat64().Histogram("baz", instrument.WithDescription("a very nice histogram")) + histogram, err := meter.SyncFloat64().Histogram("histogram_baz", instrument.WithDescription("a very nice histogram")) require.NoError(t, err) histogram.Record(ctx, 23, attrs...) histogram.Record(ctx, 7, attrs...) @@ -137,11 +139,22 @@ func TestPrometheusExporter(t *testing.T) { ctx := context.Background() exporter := New() - provider := metric.NewMeterProvider(metric.WithReader(exporter)) + + customBucketsView, err := view.New( + view.MatchInstrumentName("histogram_*"), + view.WithSetAggregation(aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + }), + ) + require.NoError(t, err) + defaultView, err := view.New(view.MatchInstrumentName("*")) + require.NoError(t, err) + + provider := metric.NewMeterProvider(metric.WithReader(exporter, customBucketsView, defaultView)) meter := provider.Meter("testmeter") registry := prometheus.NewRegistry() - err := registry.Register(exporter.Collector) + err = registry.Register(exporter.Collector) require.NoError(t, err) tc.recordMetrics(ctx, meter) diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt index 547599cf6d5..3a8422bb573 100644 --- a/exporters/prometheus/testdata/histogram.txt +++ b/exporters/prometheus/testdata/histogram.txt @@ -1,15 +1,15 @@ -# HELP baz a very nice histogram -# TYPE baz histogram -baz_bucket{A="B",C="D",le="0"} 0 -baz_bucket{A="B",C="D",le="5"} 0 -baz_bucket{A="B",C="D",le="10"} 1 -baz_bucket{A="B",C="D",le="25"} 1 -baz_bucket{A="B",C="D",le="50"} 0 -baz_bucket{A="B",C="D",le="75"} 0 -baz_bucket{A="B",C="D",le="100"} 0 -baz_bucket{A="B",C="D",le="250"} 2 -baz_bucket{A="B",C="D",le="500"} 0 -baz_bucket{A="B",C="D",le="1000"} 0 -baz_bucket{A="B",C="D",le="+Inf"} 4 -baz_sum{A="B",C="D"} 236 -baz_count{A="B",C="D"} 4 +# HELP histogram_baz a very nice histogram +# TYPE histogram_baz histogram +histogram_baz_bucket{A="B",C="D",le="0"} 0 +histogram_baz_bucket{A="B",C="D",le="5"} 0 +histogram_baz_bucket{A="B",C="D",le="10"} 1 +histogram_baz_bucket{A="B",C="D",le="25"} 1 +histogram_baz_bucket{A="B",C="D",le="50"} 0 +histogram_baz_bucket{A="B",C="D",le="75"} 0 +histogram_baz_bucket{A="B",C="D",le="100"} 0 +histogram_baz_bucket{A="B",C="D",le="250"} 2 +histogram_baz_bucket{A="B",C="D",le="500"} 0 +histogram_baz_bucket{A="B",C="D",le="1000"} 0 +histogram_baz_bucket{A="B",C="D",le="+Inf"} 4 +histogram_baz_sum{A="B",C="D"} 236 +histogram_baz_count{A="B",C="D"} 4 diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index 5e9516716ae..0158d17aeb6 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -18,7 +18,12 @@ invalid_hist_name_bucket{A="B",C="D",le="75"} 0 invalid_hist_name_bucket{A="B",C="D",le="100"} 0 invalid_hist_name_bucket{A="B",C="D",le="250"} 0 invalid_hist_name_bucket{A="B",C="D",le="500"} 0 +invalid_hist_name_bucket{A="B",C="D",le="750"} 0 invalid_hist_name_bucket{A="B",C="D",le="1000"} 0 +invalid_hist_name_bucket{A="B",C="D",le="2500"} 0 +invalid_hist_name_bucket{A="B",C="D",le="5000"} 0 +invalid_hist_name_bucket{A="B",C="D",le="7500"} 0 +invalid_hist_name_bucket{A="B",C="D",le="10000"} 0 invalid_hist_name_bucket{A="B",C="D",le="+Inf"} 1 invalid_hist_name_sum{A="B",C="D"} 23 invalid_hist_name_count{A="B",C="D"} 1 diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 7d6923fdd58..a67aa507d06 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -333,8 +333,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { Attributes: attribute.Set{}, Count: 1, - Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, - BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Min: &seven, Max: &seven, Sum: 7.0, @@ -397,8 +397,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { Attributes: attribute.Set{}, Count: 1, - Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, - BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0}, + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Min: &seven, Max: &seven, Sum: 7.0, diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index bf596c27887..e5a1282db6b 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -166,7 +166,7 @@ func DefaultAggregationSelector(ik view.InstrumentKind) aggregation.Aggregation return aggregation.LastValue{} case view.SyncHistogram: return aggregation.ExplicitBucketHistogram{ - Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, NoMinMax: false, } } From c5ebbc4d4b3615bea162cc53bf7bd2adb65bc10d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 6 Oct 2022 21:40:54 -0700 Subject: [PATCH 258/886] Use default view if instrument does not match any pipeline view (#3237) * Use default view if inst matches no other Fix #3224 * Test default view applied if no match * Add changes to changelog * Remove unneeded views len check in WithReader * Do not return agg if adding err-ed * Revert "Do not return agg if adding err-ed" This reverts commit b56efb06a763e7da174f8bfd896d37e244754ccc. --- CHANGELOG.md | 4 +++ sdk/metric/config.go | 4 --- sdk/metric/pipeline.go | 52 ++++++++++++++++++++----------- sdk/metric/pipeline_test.go | 61 +++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb99127ad4f..1afd5e7b250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) - Update histogram default bounds to match the requirements of the latest specification. (#3222) +### Fixed + +- Use default view if instrument does not match any registered view of a reader. (#3224, #3237) + ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 ### Changed diff --git a/sdk/metric/config.go b/sdk/metric/config.go index a1253334505..5b7537f63ed 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -126,10 +126,6 @@ func WithReader(r Reader, views ...view.View) Option { if cfg.readers == nil { cfg.readers = make(map[Reader][]view.View) } - if len(views) == 0 { - views = []view.View{{}} - } - cfg.readers[r] = views return cfg }) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 0bd52d63023..9eb86f593ac 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -188,31 +188,23 @@ func newInserter[N int64 | float64](p *pipeline) *inserter[N] { // Instrument inserts instrument inst with instUnit returning the Aggregators // that need to be updated with measurments for that instrument. func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { + var matched bool seen := map[instrumentID]struct{}{} var aggs []internal.Aggregator[N] errs := &multierror{wrapped: errCreatingAggregators} for _, v := range i.pipeline.views { inst, match := v.TransformInstrument(inst) + if !match { + continue + } + matched = true id := instrumentID{ scope: inst.Scope, name: inst.Name, description: inst.Description, } - - if _, ok := seen[id]; ok || !match { - continue - } - - if inst.Aggregation == nil { - inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) - } else if _, ok := inst.Aggregation.(aggregation.Default); ok { - inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) - } - - if err := isAggregatorCompatible(inst.Kind, inst.Aggregation); err != nil { - err = fmt.Errorf("creating aggregator with instrumentKind: %d, aggregation %v: %w", inst.Kind, inst.Aggregation, err) - errs.append(err) + if _, ok := seen[id]; ok { continue } @@ -233,16 +225,40 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in errs.append(err) } } - // TODO(#3224): handle when no views match. Default should be reader - // aggregation returned. + + if !matched { // Apply implicit default view if no explicit matched. + a, err := i.aggregator(inst) + if err != nil { + errs.append(err) + } + if a != nil { + aggs = append(aggs, a) + err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, a) + if err != nil { + errs.append(err) + } + } + } + return aggs, errs.errorOrNil() } // aggregator returns the Aggregator for an instrument configuration. If the // instrument defines an unknown aggregation, an error is returned. func (i *inserter[N]) aggregator(inst view.Instrument) (internal.Aggregator[N], error) { - // TODO (#3011): If filtering is done by the Aggregator it should be passed - // here. + switch inst.Aggregation.(type) { + case nil, aggregation.Default: + // Undefined, nil, means to use the default from the reader. + inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) + } + + if err := isAggregatorCompatible(inst.Kind, inst.Aggregation); err != nil { + return nil, fmt.Errorf( + "creating aggregator with instrumentKind: %d, aggregation %v: %w", + inst.Kind, inst.Aggregation, err, + ) + } + var ( temporality = i.pipeline.reader.temporality(inst.Kind) monotonic bool diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index ca83c9c3a9e..7a3321da0c1 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -25,7 +25,10 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -211,3 +214,61 @@ func TestPipelineConcurrency(t *testing.T) { } wg.Wait() } + +func TestDefaultViewImplicit(t *testing.T) { + t.Run("Int64", testDefaultViewImplicit[int64]()) + t.Run("Float64", testDefaultViewImplicit[float64]()) +} + +func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { + inst := view.Instrument{ + Scope: instrumentation.Scope{Name: "testing/lib"}, + Name: "requests", + Description: "count of requests received", + Kind: view.SyncCounter, + Aggregation: aggregation.Sum{}, + } + return func(t *testing.T) { + reader := NewManualReader() + v, err := view.New(view.MatchInstrumentName("foo"), view.WithRename("bar")) + require.NoError(t, err) + + tests := []struct { + name string + pipe *pipeline + }{ + { + name: "NoView", + pipe: newPipeline(nil, reader, nil), + }, + { + name: "NoMatchingView", + pipe: newPipeline(nil, reader, []view.View{v}), + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + i := newInserter[N](test.pipe) + got, err := i.Instrument(inst, unit.Dimensionless) + require.NoError(t, err) + assert.Len(t, got, 1, "default view not applied") + + out, err := test.pipe.produce(context.Background()) + require.NoError(t, err) + require.Len(t, out.ScopeMetrics, 1, "Aggregator not registered with pipeline") + sm := out.ScopeMetrics[0] + require.Len(t, sm.Metrics, 1, "metrics not produced from default view") + metricdatatest.AssertEqual(t, metricdata.Metrics{ + Name: inst.Name, + Description: inst.Description, + Unit: unit.Dimensionless, + Data: metricdata.Sum[N]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, sm.Metrics[0], metricdatatest.IgnoreTimestamp()) + }) + } + } +} From 4ec2ae60f2d428cc9e60045fc490c196b934fa59 Mon Sep 17 00:00:00 2001 From: copy rogers <40619032+rogerogers@users.noreply.github.com> Date: Tue, 11 Oct 2022 22:55:50 +0800 Subject: [PATCH 259/886] Add User-Agent header to OTLP exporter requests (#3261) * Add User-Agent header to OTLP exporter requests * allow override grpc user-agent Signed-off-by: rogerogers --- CHANGELOG.md | 1 + exporters/otlp/internal/header.go | 24 +++++++++++++++++ exporters/otlp/internal/header_test.go | 26 +++++++++++++++++++ .../otlp/otlpmetric/internal/oconf/options.go | 1 + .../otlpmetric/otlpmetricgrpc/client_test.go | 16 ++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 3 +++ .../otlpmetric/otlpmetrichttp/client_test.go | 16 ++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlptrace/internal/otlpconfig/options.go | 1 + .../otlptrace/otlptracegrpc/client_test.go | 16 ++++++++++++ .../otlp/otlptrace/otlptracehttp/client.go | 2 ++ .../otlptrace/otlptracehttp/client_test.go | 13 ++++++++++ 12 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 exporters/otlp/internal/header.go create mode 100644 exporters/otlp/internal/header_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1afd5e7b250..e1a68c5a3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Added an example of using metric views to customize instruments. (#3177) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc`, `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) ### Changed diff --git a/exporters/otlp/internal/header.go b/exporters/otlp/internal/header.go new file mode 100644 index 00000000000..9aa62ed9e8e --- /dev/null +++ b/exporters/otlp/internal/header.go @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal contains common functionality for all OTLP exporters. +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" + +import "go.opentelemetry.io/otel" + +// GetUserAgentHeader return an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" +// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent +func GetUserAgentHeader() string { + return "OTel OTLP Exporter Go/" + otel.Version() +} diff --git a/exporters/otlp/internal/header_test.go b/exporters/otlp/internal/header_test.go new file mode 100644 index 00000000000..ecca1a9490e --- /dev/null +++ b/exporters/otlp/internal/header_test.go @@ -0,0 +1,26 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package internal contains common functionality for all OTLP exporters. +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetUserAgentHeader(t *testing.T) { + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", GetUserAgentHeader()) +} diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index f5a82d6db17..f7d44071442 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -104,6 +104,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 1cb8cd815e3..64d3b216a2d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/genproto/googleapis/rpc/errdetails" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" @@ -169,6 +170,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) @@ -188,4 +190,18 @@ func TestConfig(t *testing.T) { err := exp.Export(ctx, metricdata.ResourceMetrics{}) assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) }) + + t.Run("WithCustomUserAgent", func(t *testing.T) { + key := "user-agent" + customerUserAgent := "custom-user-agent" + exp, coll := factoryFunc(nil, WithDialOption(grpc.WithUserAgent(customerUserAgent))) + t.Cleanup(coll.Shutdown) + ctx := context.Background() + require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + // Ensure everything is flushed. + require.NoError(t, exp.Shutdown(ctx)) + + got := coll.Headers() + assert.Contains(t, got[key][0], customerUserAgent) + }) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 7a8d7e14707..0840a2c8fa6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -29,6 +29,7 @@ import ( "google.golang.org/protobuf/proto" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" @@ -101,6 +102,8 @@ func newClient(opts ...Option) (otlpmetric.Client, error) { return nil, err } + req.Header.Set("User-Agent", internal.GetUserAgentHeader()) + if n := len(cfg.Metrics.Headers); n > 0 { for k, v := range cfg.Metrics.Headers { req.Header.Set(k, v) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 22740252b02..09a6c15d82c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -75,6 +75,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) @@ -161,4 +162,19 @@ func TestConfig(t *testing.T) { assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) assert.Len(t, coll.Collect().Dump(), 1) }) + + t.Run("WithCustomUserAgent", func(t *testing.T) { + key := http.CanonicalHeaderKey("user-agent") + headers := map[string]string{key: "custom-user-agent"} + exp, coll := factoryFunc("", nil, WithHeaders(headers)) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + // Ensure everything is flushed. + require.NoError(t, exp.Shutdown(ctx)) + + got := coll.Headers() + require.Contains(t, got, key) + assert.Equal(t, got[key], []string{headers[key]}) + }) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index ada9ef43f21..f1f2f64706c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -4,6 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 + go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1 go.opentelemetry.io/otel/metric v0.32.1 @@ -21,7 +22,6 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel v1.10.0 // indirect go.opentelemetry.io/otel/sdk v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 56e83b85334..c48ffd53081 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -97,6 +97,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index d11111ed126..395ccc28bf4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -212,6 +212,7 @@ func TestNewWithHeaders(t *testing.T) { require.NoError(t, exp.ExportSpans(ctx, roSpans)) headers := mc.getHeaders() + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", headers.Get("user-agent")) require.Len(t, headers.Get("header1"), 1) assert.Equal(t, "value1", headers.Get("header1")[0]) } @@ -411,3 +412,18 @@ func TestPartialSuccess(t *testing.T) { require.Contains(t, errors[0].Error(), "partially successful") require.Contains(t, errors[0].Error(), "2 spans rejected") } + +func TestCustomUserAgent(t *testing.T) { + customUserAgent := "custom-user-agent" + mc := runMockCollector(t) + t.Cleanup(func() { require.NoError(t, mc.stop()) }) + + ctx := context.Background() + exp := newGRPCExporter(t, ctx, mc.endpoint, + otlptracegrpc.WithDialOption(grpc.WithUserAgent(customUserAgent))) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + require.NoError(t, exp.ExportSpans(ctx, roSpans)) + + headers := mc.getHeaders() + require.Contains(t, headers.Get("user-agent")[0], customUserAgent) +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 745b6541d42..8f742dfc1bd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -208,6 +208,8 @@ func (d *client) newRequest(body []byte) (request, error) { return request{Request: r}, err } + r.Header.Set("User-Agent", internal.GetUserAgentHeader()) + for k, v := range d.cfg.Headers { r.Header.Set(k, v) } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index bf497bad4be..135b6517622 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -42,6 +42,10 @@ var ( "Otel-Go-Key-1": "somevalue", "Otel-Go-Key-2": "someothervalue", } + + customUserAgentHeader = map[string]string{ + "user-agent": "custome-user-agent", + } ) func TestEndToEnd(t *testing.T) { @@ -142,6 +146,15 @@ func TestEndToEnd(t *testing.T) { ExpectedHeaders: testHeaders, }, }, + { + name: "with custom user agent", + opts: []otlptracehttp.Option{ + otlptracehttp.WithHeaders(customUserAgentHeader), + }, + mcCfg: mockCollectorConfig{ + ExpectedHeaders: customUserAgentHeader, + }, + }, } for _, tc := range tests { From ffa94ca529e91c7ce53c9e5eb7328efba89b8ae4 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 11 Oct 2022 11:50:09 -0400 Subject: [PATCH 260/886] Improve test coverage, and don't send empty batches in OC bridge (#3263) * improve test coverage, and don't send empty batches in OC bridge * Update bridge/opencensus/metric_test.go Co-authored-by: Tyler Yahn * remove 1.18 rule Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + bridge/opencensus/go.mod | 6 ++ bridge/opencensus/go.sum | 11 ++- bridge/opencensus/metric.go | 12 ++- bridge/opencensus/metric_test.go | 157 +++++++++++++++++++++++++++++++ bridge/opencensus/test/go.sum | 2 +- example/opencensus/go.sum | 2 +- 7 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 bridge/opencensus/metric_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a68c5a3e2..1fd689d606f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Use default view if instrument does not match any registered view of a reader. (#3224, #3237) +- The OpenCensus bridge no longer sends empty batches of metrics. (#3263) ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4db9c67cbb8..edc9c9066ae 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,6 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.18 require ( + github.com/stretchr/testify v1.7.1 go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/metric v0.32.1 @@ -12,10 +13,15 @@ require ( ) require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/kr/pretty v0.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 1eac8058cc6..6e7bfe06fbf 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -3,8 +3,9 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -35,12 +36,18 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -93,6 +100,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 82965b1af5b..df22c874ab8 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -23,6 +23,7 @@ import ( ocmetricdata "go.opencensus.io/metric/metricdata" "go.opencensus.io/metric/metricexport" + "go.opentelemetry.io/otel" internal "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" @@ -30,6 +31,8 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) +const scopeName = "go.opentelemetry.io/otel/bridge/opencensus" + // exporter implements the OpenCensus metric Exporter interface using an // OpenTelemetry base exporter. type exporter struct { @@ -38,7 +41,7 @@ type exporter struct { } // NewMetricExporter returns an OpenCensus exporter that exports to an -// OpenTelemetry exporter. +// OpenTelemetry (push) exporter. func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { return &exporter{base: base, res: res} } @@ -48,14 +51,17 @@ func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexpor func (e *exporter) ExportMetrics(ctx context.Context, ocmetrics []*ocmetricdata.Metric) error { otelmetrics, err := internal.ConvertMetrics(ocmetrics) if err != nil { - return err + otel.Handle(err) + } + if len(otelmetrics) == 0 { + return nil } return e.base.Export(ctx, metricdata.ResourceMetrics{ Resource: e.res, ScopeMetrics: []metricdata.ScopeMetrics{ { Scope: instrumentation.Scope{ - Name: "go.opentelemetry.io/otel/bridge/opencensus", + Name: scopeName, }, Metrics: otelmetrics, }, diff --git a/bridge/opencensus/metric_test.go b/bridge/opencensus/metric_test.go new file mode 100644 index 00000000000..57350668362 --- /dev/null +++ b/bridge/opencensus/metric_test.go @@ -0,0 +1,157 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + ocmetricdata "go.opencensus.io/metric/metricdata" + ocresource "go.opencensus.io/resource" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + "go.opentelemetry.io/otel/sdk/resource" +) + +func TestPushMetricsExporter(t *testing.T) { + now := time.Now() + for _, tc := range []struct { + desc string + input []*ocmetricdata.Metric + inputResource *resource.Resource + exportErr error + expected *metricdata.ResourceMetrics + expectErr bool + }{ + { + desc: "empty batch isn't sent", + }, + { + desc: "export error", + exportErr: fmt.Errorf("failed to export"), + input: []*ocmetricdata.Metric{ + { + Resource: &ocresource.Resource{ + Labels: map[string]string{ + "R1": "V1", + "R2": "V2", + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + StartTime: now, + Points: []ocmetricdata.Point{ + {Value: int64(123), Time: now}, + }, + }, + }, + }, + }, + expectErr: true, + }, + { + desc: "success", + input: []*ocmetricdata.Metric{ + { + Resource: &ocresource.Resource{ + Labels: map[string]string{ + "R1": "V1", + "R2": "V2", + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + StartTime: now, + Points: []ocmetricdata.Point{ + {Value: int64(123), Time: now}, + }, + }, + }, + }, + }, + inputResource: resource.NewSchemaless( + attribute.String("R1", "V1"), + attribute.String("R2", "V2"), + ), + expected: &metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless( + attribute.String("R1", "V1"), + attribute.String("R2", "V2"), + ), + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: scopeName, + }, + Metrics: []metricdata.Metrics{ + { + Name: "", + Description: "", + Unit: "", + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(), + StartTime: now, + Time: now, + Value: 123, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + fake := &fakeExporter{err: tc.exportErr} + exporter := NewMetricExporter(fake, tc.inputResource) + err := exporter.ExportMetrics(context.Background(), tc.input) + if tc.expectErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + if tc.expected != nil { + require.NotNil(t, fake.data) + metricdatatest.AssertEqual(t, *tc.expected, *fake.data) + } else { + require.Nil(t, fake.data) + } + }) + } +} + +type fakeExporter struct { + metric.Exporter + data *metricdata.ResourceMetrics + err error +} + +func (f *fakeExporter) Export(ctx context.Context, data metricdata.ResourceMetrics) error { + if f.err == nil { + f.data = &data + } + return f.err +} diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 1eac8058cc6..d06593c620d 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -3,8 +3,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 1eac8058cc6..d06593c620d 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -3,8 +3,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= From b5292b845955d4f99dbd4470728cce809a9384c8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 11 Oct 2022 12:41:47 -0700 Subject: [PATCH 261/886] Handle duplicate Aggregators and log instrument conflicts (#3251) * Add the cache type * Add cache unit tests * Test cache concurrency * Add the instrumentCache * Use the instrumentCache to deduplicate creation * Drop unique check from addAggregator * Fix aggregatorCache* docs * Update cachedAggregator and aggregator method docs * Remove unnecessary type constraint * Remove unused errAlreadyRegistered * Rename to not shadow imports * Add changes to changelog * Fix changelog English * Store resolvers in the meter instead of caches * Test all Aggregator[N] impls are comparable * Fix lint * Add documentation that Aggregators need to be comparable * Update sdk/metric/internal/aggregator.go Co-authored-by: Anthony Mirabella * Update sdk/metric/instrument.go Co-authored-by: Anthony Mirabella * Update sdk/metric/instrument.go Co-authored-by: Anthony Mirabella * Update sdk/metric/internal/aggregator_test.go Co-authored-by: Anthony Mirabella * Fix pipeline_test.go use of newInstrumentCache Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 3 + sdk/metric/cache.go | 110 +++++++++++ sdk/metric/cache_test.go | 76 ++++++++ sdk/metric/instrument.go | 23 +++ sdk/metric/internal/aggregator.go | 3 + sdk/metric/internal/aggregator_test.go | 40 ++-- sdk/metric/meter.go | 43 +++-- sdk/metric/pipeline.go | 257 ++++++++++++++++--------- sdk/metric/pipeline_registry_test.go | 69 +++++-- sdk/metric/pipeline_test.go | 117 ++--------- 10 files changed, 502 insertions(+), 239 deletions(-) create mode 100644 sdk/metric/cache.go create mode 100644 sdk/metric/cache_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd689d606f..80dc9041d85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Use default view if instrument does not match any registered view of a reader. (#3224, #3237) +- Return the same instrument every time a user makes the exact same instrument creation call. (#3229, #3251) +- Return the existing instrument when a view transforms a creation call to match an existing instrument. (#3240, #3251) +- Log a warning when a conflicting instrument (e.g. description, unit, data-type) is created instead of returning an error. (#3251) - The OpenCensus bridge no longer sends empty batches of metrics. (#3263) ## [0.32.1] Metric SDK (Alpha) - 2022-09-22 diff --git a/sdk/metric/cache.go b/sdk/metric/cache.go new file mode 100644 index 00000000000..b75e7ea5402 --- /dev/null +++ b/sdk/metric/cache.go @@ -0,0 +1,110 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "sync" + + "go.opentelemetry.io/otel/sdk/metric/internal" +) + +// cache is a locking storage used to quickly return already computed values. +// +// The zero value of a cache is empty and ready to use. +// +// A cache must not be copied after first use. +// +// All methods of a cache are safe to call concurrently. +type cache[K comparable, V any] struct { + sync.Mutex + data map[K]V +} + +// Lookup returns the value stored in the cache with the accociated key if it +// exists. Otherwise, f is called and its returned value is set in the cache +// for key and returned. +// +// Lookup is safe to call concurrently. It will hold the cache lock, so f +// should not block excessively. +func (c *cache[K, V]) Lookup(key K, f func() V) V { + c.Lock() + defer c.Unlock() + + if c.data == nil { + val := f() + c.data = map[K]V{key: val} + return val + } + if v, ok := c.data[key]; ok { + return v + } + val := f() + c.data[key] = val + return val +} + +// instrumentCache is a cache of instruments. It is scoped at the Meter level +// along with a number type. Meaning all instruments it contains need to belong +// to the same instrumentation.Scope (implicitly) and number type (explicitly). +type instrumentCache[N int64 | float64] struct { + // aggregators is used to ensure duplicate creations of the same instrument + // return the same instance of that instrument's aggregator. + aggregators *cache[instrumentID, aggVal[N]] + // views is used to ensure if instruments with the same name are created, + // but do not have the same identifying properties, a warning is logged. + views *cache[string, instrumentID] +} + +// newInstrumentCache returns a new instrumentCache that uses ac as the +// underlying cache for aggregators and vc as the cache for views. If ac or vc +// are nil, a new empty cache will be used. +func newInstrumentCache[N int64 | float64](ac *cache[instrumentID, aggVal[N]], vc *cache[string, instrumentID]) instrumentCache[N] { + if ac == nil { + ac = &cache[instrumentID, aggVal[N]]{} + } + if vc == nil { + vc = &cache[string, instrumentID]{} + } + return instrumentCache[N]{aggregators: ac, views: vc} +} + +// LookupAggregator returns the Aggregator and error for a cached instrument if +// it exist in the cache. Otherwise, f is called and its returned value is set +// in the cache and returned. +// +// LookupAggregator is safe to call concurrently. +func (c instrumentCache[N]) LookupAggregator(id instrumentID, f func() (internal.Aggregator[N], error)) (agg internal.Aggregator[N], err error) { + v := c.aggregators.Lookup(id, func() aggVal[N] { + a, err := f() + return aggVal[N]{Aggregator: a, Err: err} + }) + return v.Aggregator, v.Err +} + +// aggVal is the cached value of an instrumentCache's aggregators cache. +type aggVal[N int64 | float64] struct { + Aggregator internal.Aggregator[N] + Err error +} + +// Unique returns if id is unique or a duplicate instrument. If an instrument +// with the same name has already been created, that instrumentID will be +// returned along with false. Otherwise, id is returned with true. +// +// Unique is safe to call concurrently. +func (c instrumentCache[N]) Unique(id instrumentID) (instrumentID, bool) { + got := c.views.Lookup(id.Name, func() instrumentID { return id }) + return got, id == got +} diff --git a/sdk/metric/cache_test.go b/sdk/metric/cache_test.go new file mode 100644 index 00000000000..47332a58cbd --- /dev/null +++ b/sdk/metric/cache_test.go @@ -0,0 +1,76 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestCache(t *testing.T) { + k0, k1 := "one", "two" + v0, v1 := 1, 2 + + c := cache[string, int]{} + + var got int + require.NotPanics(t, func() { + got = c.Lookup(k0, func() int { return v0 }) + }, "zero-value cache panics on Lookup") + assert.Equal(t, v0, got, "zero-value cache did not return fallback") + + assert.Equal(t, v0, c.Lookup(k0, func() int { return v1 }), "existing key") + + assert.Equal(t, v1, c.Lookup(k1, func() int { return v1 }), "non-existing key") +} + +func TestCacheConcurrency(t *testing.T) { + const ( + key = "k" + goroutines = 10 + timeoutSec = 5 + ) + + c := cache[string, int]{} + var wg sync.WaitGroup + for n := 0; n < goroutines; n++ { + wg.Add(1) + go func(i int) { + defer wg.Done() + assert.NotPanics(t, func() { + c.Lookup(key, func() int { return i }) + }) + }(n) + } + + done := make(chan struct{}) + go func() { + wg.Wait() + close(done) + }() + + assert.Eventually(t, func() bool { + select { + case <-done: + return true + default: + return false + } + }, timeoutSec*time.Second, 10*time.Millisecond) +} diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 5e7b457ab7f..48440280e42 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -23,9 +23,32 @@ import ( "go.opentelemetry.io/otel/metric/instrument/asyncint64" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +// instrumentID are the identifying properties of an instrument. +type instrumentID struct { + // Name is the name of the instrument. + Name string + // Description is the description of the instrument. + Description string + // Unit is the unit of the instrument. + Unit unit.Unit + // Aggregation is the aggregation data type of the instrument. + Aggregation string + // Monotonic is the monotonicity of an instruments data type. This field is + // not used for all data types, so a zero value needs to be understood in the + // context of Aggregation. + Monotonic bool + // Temporality is the temporality of an instrument's data type. This field + // is not used by some data types. + Temporality metricdata.Temporality + // Number is the number type of the instrument. + Number string +} + type instrumentImpl[N int64 | float64] struct { instrument.Asynchronous instrument.Synchronous diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregator.go index 1f70ae7c1ee..952e9a4a8bd 100644 --- a/sdk/metric/internal/aggregator.go +++ b/sdk/metric/internal/aggregator.go @@ -26,6 +26,9 @@ import ( var now = time.Now // Aggregator forms an aggregation from a collection of recorded measurements. +// +// Aggregators need to be comparable so they can be de-duplicated by the SDK when +// it creates them for multiple views. type Aggregator[N int64 | float64] interface { // Aggregate records the measurement, scoped by attr, and aggregates it // into an aggregation. diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregator_test.go index 200d3da6268..a544a18ca21 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregator_test.go @@ -20,6 +20,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" @@ -80,23 +82,31 @@ type aggregatorTester[N int64 | float64] struct { func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap, eFunc expectFunc) func(*testing.T) { m := at.MeasurementN * at.GoroutineN return func(t *testing.T) { - for i := 0; i < at.CycleN; i++ { - var wg sync.WaitGroup - wg.Add(at.GoroutineN) - for i := 0; i < at.GoroutineN; i++ { - go func() { - defer wg.Done() - for j := 0; j < at.MeasurementN; j++ { - for attrs, n := range incr { - a.Aggregate(N(n), attrs) + t.Run("Comparable", func(t *testing.T) { + assert.NotPanics(t, func() { + _ = map[Aggregator[N]]struct{}{a: {}} + }) + }) + + t.Run("Correctness", func(t *testing.T) { + for i := 0; i < at.CycleN; i++ { + var wg sync.WaitGroup + wg.Add(at.GoroutineN) + for j := 0; j < at.GoroutineN; j++ { + go func() { + defer wg.Done() + for k := 0; k < at.MeasurementN; k++ { + for attrs, n := range incr { + a.Aggregate(N(n), attrs) + } } - } - }() - } - wg.Wait() + }() + } + wg.Wait() - metricdatatest.AssertAggregationsEqual(t, eFunc(m), a.Aggregation()) - } + metricdatatest.AssertAggregationsEqual(t, eFunc(m), a.Aggregation()) + } + }) } } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 82d5a5269be..c6871a06716 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -55,10 +55,7 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { defer r.Unlock() if r.meters == nil { - m := &meter{ - Scope: s, - pipes: r.pipes, - } + m := newMeter(s, r.pipes) r.meters = map[instrumentation.Scope]*meter{s: m} return m } @@ -68,10 +65,7 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { return m } - m = &meter{ - Scope: s, - pipes: r.pipes, - } + m = newMeter(s, r.pipes) r.meters[s] = m return m } @@ -83,20 +77,45 @@ func (r *meterRegistry) Get(s instrumentation.Scope) *meter { type meter struct { instrumentation.Scope + // *Resolvers are used by the provided instrument providers to resolve new + // instruments aggregators and maintain a cache across instruments this + // meter owns. + int64Resolver resolver[int64] + float64Resolver resolver[float64] + pipes pipelines } +func newMeter(s instrumentation.Scope, p pipelines) *meter { + // viewCache ensures instrument conflicts, including number conflicts, this + // meter is asked to create are logged to the user. + var viewCache cache[string, instrumentID] + + // Passing nil as the ac parameter to newInstrumentCache will have each + // create its own aggregator cache. + ic := newInstrumentCache[int64](nil, &viewCache) + fc := newInstrumentCache[float64](nil, &viewCache) + + return &meter{ + Scope: s, + pipes: p, + + int64Resolver: newResolver(p, ic), + float64Resolver: newResolver(p, fc), + } +} + // Compile-time check meter implements metric.Meter. var _ metric.Meter = (*meter)(nil) // AsyncInt64 returns the asynchronous integer instrument provider. func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { - return asyncInt64Provider{scope: m.Scope, resolve: newResolver[int64](m.pipes)} + return asyncInt64Provider{scope: m.Scope, resolve: &m.int64Resolver} } // AsyncFloat64 returns the asynchronous floating-point instrument provider. func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return asyncFloat64Provider{scope: m.Scope, resolve: newResolver[float64](m.pipes)} + return asyncFloat64Provider{scope: m.Scope, resolve: &m.float64Resolver} } // RegisterCallback registers the function f to be called when any of the @@ -108,10 +127,10 @@ func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context // SyncInt64 returns the synchronous integer instrument provider. func (m *meter) SyncInt64() syncint64.InstrumentProvider { - return syncInt64Provider{scope: m.Scope, resolve: newResolver[int64](m.pipes)} + return syncInt64Provider{scope: m.Scope, resolve: &m.int64Resolver} } // SyncFloat64 returns the synchronous floating-point instrument provider. func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - return syncFloat64Provider{scope: m.Scope, resolve: newResolver[float64](m.pipes)} + return syncFloat64Provider{scope: m.Scope, resolve: &m.float64Resolver} } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 9eb86f593ac..83de81ccc61 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -21,6 +21,7 @@ import ( "strings" "sync" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -34,28 +35,19 @@ var ( errCreatingAggregators = errors.New("could not create all aggregators") errIncompatibleAggregation = errors.New("incompatible aggregation") errUnknownAggregation = errors.New("unrecognized aggregation") + errUnknownTemporality = errors.New("unrecognized temporality") ) type aggregator interface { Aggregation() metricdata.Aggregation } -// instrumentID is used to identify multiple instruments being mapped to the -// same aggregator. e.g. using an exact match view with a name=* view. You -// can't use a view.Instrument here because not all Aggregators are comparable. -type instrumentID struct { - scope instrumentation.Scope +// instrumentSync is a synchronization point between a pipeline and an +// instrument's Aggregators. +type instrumentSync struct { name string description string -} - -type instrumentKey struct { - name string - unit unit.Unit -} - -type instrumentValue struct { - description string + unit unit.Unit aggregator aggregator } @@ -67,7 +59,7 @@ func newPipeline(res *resource.Resource, reader Reader, views []view.View) *pipe resource: res, reader: reader, views: views, - aggregations: make(map[instrumentation.Scope]map[instrumentKey]instrumentValue), + aggregations: make(map[instrumentation.Scope][]instrumentSync), } } @@ -83,36 +75,23 @@ type pipeline struct { views []view.View sync.Mutex - aggregations map[instrumentation.Scope]map[instrumentKey]instrumentValue + aggregations map[instrumentation.Scope][]instrumentSync callbacks []func(context.Context) } -var errAlreadyRegistered = errors.New("instrument already registered") - -// addAggregator will stores an aggregator with an instrument description. The aggregator -// is used when `produce()` is called. -func (p *pipeline) addAggregator(scope instrumentation.Scope, name, description string, instUnit unit.Unit, agg aggregator) error { +// addSync adds the instrumentSync to pipeline p with scope. This method is not +// idempotent. Duplicate calls will result in duplicate additions, it is the +// callers responsibility to ensure this is called with unique values. +func (p *pipeline) addSync(scope instrumentation.Scope, iSync instrumentSync) { p.Lock() defer p.Unlock() if p.aggregations == nil { - p.aggregations = map[instrumentation.Scope]map[instrumentKey]instrumentValue{} - } - if p.aggregations[scope] == nil { - p.aggregations[scope] = map[instrumentKey]instrumentValue{} - } - inst := instrumentKey{ - name: name, - unit: instUnit, - } - if _, ok := p.aggregations[scope][inst]; ok { - return fmt.Errorf("%w: name %s, scope: %s", errAlreadyRegistered, name, scope) - } - - p.aggregations[scope][inst] = instrumentValue{ - description: description, - aggregator: agg, + p.aggregations = map[instrumentation.Scope][]instrumentSync{ + scope: {iSync}, + } + return } - return nil + p.aggregations[scope] = append(p.aggregations[scope], iSync) } // addCallback registers a callback to be run when `produce()` is called. @@ -151,12 +130,12 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err sm := make([]metricdata.ScopeMetrics, 0, len(p.aggregations)) for scope, instruments := range p.aggregations { metrics := make([]metricdata.Metrics, 0, len(instruments)) - for inst, instValue := range instruments { - data := instValue.aggregator.Aggregation() + for _, inst := range instruments { + data := inst.aggregator.Aggregation() if data != nil { metrics = append(metrics, metricdata.Metrics{ Name: inst.name, - Description: instValue.description, + Description: inst.description, Unit: inst.unit, Data: data, }) @@ -178,20 +157,45 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err // inserter facilitates inserting of new instruments into a pipeline. type inserter[N int64 | float64] struct { + cache instrumentCache[N] pipeline *pipeline } -func newInserter[N int64 | float64](p *pipeline) *inserter[N] { - return &inserter[N]{p} +func newInserter[N int64 | float64](p *pipeline, c instrumentCache[N]) *inserter[N] { + return &inserter[N]{cache: c, pipeline: p} } -// Instrument inserts instrument inst with instUnit returning the Aggregators -// that need to be updated with measurments for that instrument. +// Instrument inserts the instrument inst with instUnit into a pipeline. All +// views the pipeline contains are matched against, and any matching view that +// creates a unique Aggregator will be inserted into the pipeline and included +// in the returned slice. +// +// The returned Aggregators are ensured to be deduplicated and unique. If +// another view in another pipeline that is cached by this inserter's cache has +// already inserted the same Aggregator for the same instrument, that +// Aggregator instance is returned. +// +// If another instrument has already been inserted by this inserter, or any +// other using the same cache, and it conflicts with the instrument being +// inserted in this call, an Aggregator matching the arguments will still be +// returned but an Info level log message will also be logged to the OTel +// global logger. +// +// If the passed instrument would result in an incompatible Aggregator, an +// error is returned and that Aggregator is not inserted or returned. +// +// If an instrument is determined to use a Drop aggregation, that instrument is +// not inserted nor returned. func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { - var matched bool - seen := map[instrumentID]struct{}{} - var aggs []internal.Aggregator[N] + var ( + matched bool + aggs []internal.Aggregator[N] + ) + errs := &multierror{wrapped: errCreatingAggregators} + // The cache will return the same Aggregator instance. Use this fact to + // compare pointer addresses to deduplicate Aggregators. + seen := make(map[internal.Aggregator[N]]struct{}) for _, v := range i.pipeline.views { inst, match := v.TransformInstrument(inst) if !match { @@ -199,53 +203,51 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in } matched = true - id := instrumentID{ - scope: inst.Scope, - name: inst.Name, - description: inst.Description, - } - if _, ok := seen[id]; ok { - continue - } - - agg, err := i.aggregator(inst) + agg, err := i.cachedAggregator(inst, instUnit) if err != nil { errs.append(err) - continue } if agg == nil { // Drop aggregator. continue } - // TODO (#3011): If filtering is done at the instrument level add here. - // This is where the aggregator and the view are both in scope. - aggs = append(aggs, agg) - seen[id] = struct{}{} - err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, agg) - if err != nil { - errs.append(err) + if _, ok := seen[agg]; ok { + // This aggregator has already been added. + continue } + seen[agg] = struct{}{} + aggs = append(aggs, agg) } - if !matched { // Apply implicit default view if no explicit matched. - a, err := i.aggregator(inst) - if err != nil { - errs.append(err) - } - if a != nil { - aggs = append(aggs, a) - err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, a) - if err != nil { - errs.append(err) - } - } + if matched { + return aggs, errs.errorOrNil() } + // Apply implicit default view if no explicit matched. + agg, err := i.cachedAggregator(inst, instUnit) + if err != nil { + errs.append(err) + } + if agg != nil { + // Ensured to have not seen given matched was false. + aggs = append(aggs, agg) + } return aggs, errs.errorOrNil() } -// aggregator returns the Aggregator for an instrument configuration. If the -// instrument defines an unknown aggregation, an error is returned. -func (i *inserter[N]) aggregator(inst view.Instrument) (internal.Aggregator[N], error) { +// cachedAggregator returns the appropriate Aggregator for an instrument +// configuration. If the exact instrument has been created within the +// inst.Scope, that Aggregator instance will be returned. Otherwise, a new +// computed Aggregator will be cached and returned. +// +// If the instrument configuration conflicts with an instrument that has +// already been created (e.g. description, unit, data type) a warning will be +// logged at the "Info" level with the global OTel logger. A valid new +// Aggregator for the instrument configuration will still be returned without +// an error. +// +// If the instrument defines an unknown or incompatible aggregation, an error +// is returned. +func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit) (internal.Aggregator[N], error) { switch inst.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. @@ -259,31 +261,94 @@ func (i *inserter[N]) aggregator(inst view.Instrument) (internal.Aggregator[N], ) } - var ( - temporality = i.pipeline.reader.temporality(inst.Kind) - monotonic bool + id := i.instrumentID(inst, u) + // If there is a conflict, the specification says the view should + // still be applied and a warning should be logged. + i.logConflict(id) + return i.cache.LookupAggregator(id, func() (internal.Aggregator[N], error) { + agg, err := i.aggregator(inst.Aggregation, id.Temporality, id.Monotonic) + if err != nil { + return nil, err + } + if agg == nil { // Drop aggregator. + return nil, nil + } + i.pipeline.addSync(inst.Scope, instrumentSync{ + name: inst.Name, + description: inst.Description, + unit: u, + aggregator: agg, + }) + return agg, err + }) +} + +// logConflict validates if an instrument with the same name as id has already +// been created. If that instrument conflicts with id, a warning is logged. +func (i *inserter[N]) logConflict(id instrumentID) { + existing, unique := i.cache.Unique(id) + if unique { + return + } + + global.Info( + "duplicate metric stream definitions", + "names", fmt.Sprintf("%q, %q", existing.Name, id.Name), + "descriptions", fmt.Sprintf("%q, %q", existing.Description, id.Description), + "units", fmt.Sprintf("%s, %s", existing.Unit, id.Unit), + "numbers", fmt.Sprintf("%s, %s", existing.Number, id.Number), + "aggregations", fmt.Sprintf("%s, %s", existing.Aggregation, id.Aggregation), + "monotonics", fmt.Sprintf("%t, %t", existing.Monotonic, id.Monotonic), + "temporalities", fmt.Sprintf("%s, %s", existing.Temporality.String(), id.Temporality.String()), ) +} + +func (i *inserter[N]) instrumentID(vi view.Instrument, u unit.Unit) instrumentID { + var zero N + id := instrumentID{ + Name: vi.Name, + Description: vi.Description, + Unit: u, + Aggregation: fmt.Sprintf("%T", vi.Aggregation), + Temporality: i.pipeline.reader.temporality(vi.Kind), + Number: fmt.Sprintf("%T", zero), + } - switch inst.Kind { + switch vi.Kind { case view.AsyncCounter, view.SyncCounter, view.SyncHistogram: - monotonic = true + id.Monotonic = true } - switch agg := inst.Aggregation.(type) { + return id +} + +// aggregator returns a new Aggregator matching agg, temporality, and +// monotonic. If the agg is unknown or temporality is invalid, an error is +// returned. +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { + switch a := agg.(type) { case aggregation.Drop: return nil, nil case aggregation.LastValue: return internal.NewLastValue[N](), nil case aggregation.Sum: - if temporality == metricdata.CumulativeTemporality { + switch temporality { + case metricdata.CumulativeTemporality: return internal.NewCumulativeSum[N](monotonic), nil + case metricdata.DeltaTemporality: + return internal.NewDeltaSum[N](monotonic), nil + default: + return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } - return internal.NewDeltaSum[N](monotonic), nil case aggregation.ExplicitBucketHistogram: - if temporality == metricdata.CumulativeTemporality { - return internal.NewCumulativeHistogram[N](agg), nil + switch temporality { + case metricdata.CumulativeTemporality: + return internal.NewCumulativeHistogram[N](a), nil + case metricdata.DeltaTemporality: + return internal.NewDeltaHistogram[N](a), nil + default: + return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } - return internal.NewDeltaHistogram[N](agg), nil } return nil, errUnknownAggregation } @@ -364,17 +429,17 @@ type resolver[N int64 | float64] struct { inserters []*inserter[N] } -func newResolver[N int64 | float64](p pipelines) *resolver[N] { +func newResolver[N int64 | float64](p pipelines, c instrumentCache[N]) resolver[N] { in := make([]*inserter[N], len(p)) for i := range in { - in[i] = newInserter[N](p[i]) + in[i] = newInserter(p[i], c) } - return &resolver[N]{in} + return resolver[N]{in} } // Aggregators returns the Aggregators instrument inst needs to update when it // makes a measurement. -func (r *resolver[N]) Aggregators(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { +func (r resolver[N]) Aggregators(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { var aggs []internal.Aggregator[N] errs := &multierror{} diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index f89a09360ba..45bc23ccb18 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -15,11 +15,15 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "sync/atomic" "testing" + "github.com/go-logr/logr" + "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -211,7 +215,8 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { - i := newInserter[N](newPipeline(nil, tt.reader, tt.views)) + c := newInstrumentCache[N](nil, nil) + i := newInserter(newPipeline(nil, tt.reader, tt.views), c) got, err := i.Instrument(tt.inst, unit.Dimensionless) assert.ErrorIs(t, err, tt.wantErr) require.Len(t, got, tt.wantLen) @@ -223,7 +228,8 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } func testInvalidInstrumentShouldPanic[N int64 | float64]() { - i := newInserter[N](newPipeline(nil, NewManualReader(), []view.View{{}})) + c := newInstrumentCache[N](nil, nil) + i := newInserter(newPipeline(nil, NewManualReader(), []view.View{{}}), c) inst := view.Instrument{ Name: "foo", Kind: view.InstrumentKind(255), @@ -334,7 +340,8 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} - r := newResolver[int64](p) + c := newInstrumentCache[int64](nil, nil) + r := newResolver(p, c) aggs, err := r.Aggregators(inst, unit.Dimensionless) assert.NoError(t, err) @@ -344,7 +351,8 @@ func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCo func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} - r := newResolver[float64](p) + c := newInstrumentCache[float64](nil, nil) + r := newResolver(p, c) aggs, err := r.Aggregators(inst, unit.Dimensionless) assert.NoError(t, err) @@ -375,20 +383,40 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { p := newPipelines(resource.Empty(), views) inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} - ri := newResolver[int64](p) + vc := cache[string, instrumentID]{} + ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(inst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, intAggs, 0) p = newPipelines(resource.Empty(), views) - rf := newResolver[float64](p) + rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) floatAggs, err := rf.Aggregators(inst, unit.Dimensionless) assert.Error(t, err) assert.Len(t, floatAggs, 0) } -func TestPipelineRegistryCreateAggregatorsDuplicateErrors(t *testing.T) { +type logCounter struct { + logr.LogSink + + infoN uint32 +} + +func (l *logCounter) Info(level int, msg string, keysAndValues ...interface{}) { + atomic.AddUint32(&l.infoN, 1) + l.LogSink.Info(level, msg, keysAndValues...) +} + +func (l *logCounter) InfoN() int { + return int(atomic.SwapUint32(&l.infoN, 0)) +} + +func TestResolveAggregatorsDuplicateErrors(t *testing.T) { + tLog := testr.NewWithOptions(t, testr.Options{Verbosity: 6}) + l := &logCounter{LogSink: tLog.GetSink()} + otel.SetLogger(logr.New(l)) + renameView, _ := view.New( view.MatchInstrumentName("bar"), view.WithRename("foo"), @@ -405,29 +433,40 @@ func TestPipelineRegistryCreateAggregatorsDuplicateErrors(t *testing.T) { p := newPipelines(resource.Empty(), views) - ri := newResolver[int64](p) + vc := cache[string, instrumentID]{} + ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(fooInst, unit.Dimensionless) assert.NoError(t, err) + assert.Equal(t, 0, l.InfoN(), "no info logging should happen") assert.Len(t, intAggs, 1) - // The Rename view should error, because it creates a foo instrument. + // The Rename view should produce the same instrument without an error, the + // default view should also cause a new aggregator to be returned. intAggs, err = ri.Aggregators(barInst, unit.Dimensionless) - assert.Error(t, err) + assert.NoError(t, err) + assert.Equal(t, 0, l.InfoN(), "no info logging should happen") assert.Len(t, intAggs, 2) - // Creating a float foo instrument should error because there is an int foo instrument. - rf := newResolver[float64](p) + // Creating a float foo instrument should log a warning because there is an + // int foo instrument. + rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) floatAggs, err := rf.Aggregators(fooInst, unit.Dimensionless) - assert.Error(t, err) + assert.NoError(t, err) + assert.Equal(t, 1, l.InfoN(), "instrument conflict not logged") assert.Len(t, floatAggs, 1) fooInst = view.Instrument{Name: "foo-float", Kind: view.SyncCounter} - _, err = rf.Aggregators(fooInst, unit.Dimensionless) + floatAggs, err = rf.Aggregators(fooInst, unit.Dimensionless) assert.NoError(t, err) + assert.Equal(t, 0, l.InfoN(), "no info logging should happen") + assert.Len(t, floatAggs, 1) floatAggs, err = rf.Aggregators(barInst, unit.Dimensionless) - assert.Error(t, err) + assert.NoError(t, err) + // Both the rename and default view aggregators created above should now + // conflict. Therefore, 2 warning messages should be logged. + assert.Equal(t, 2, l.InfoN(), "instrument conflicts not logged") assert.Len(t, floatAggs, 2) } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 7a3321da0c1..e47bb6b5f64 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -16,6 +16,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "fmt" "sync" "testing" @@ -49,8 +50,10 @@ func TestEmptyPipeline(t *testing.T) { assert.Nil(t, output.Resource) assert.Len(t, output.ScopeMetrics, 0) - err = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) - assert.NoError(t, err) + iSync := instrumentSync{"name", "desc", unit.Dimensionless, testSumAggregator{}} + assert.NotPanics(t, func() { + pipe.addSync(instrumentation.Scope{}, iSync) + }) require.NotPanics(t, func() { pipe.addCallback(func(ctx context.Context) {}) @@ -71,8 +74,10 @@ func TestNewPipeline(t *testing.T) { assert.Equal(t, resource.Empty(), output.Resource) assert.Len(t, output.ScopeMetrics, 0) - err = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) - assert.NoError(t, err) + iSync := instrumentSync{"name", "desc", unit.Dimensionless, testSumAggregator{}} + assert.NotPanics(t, func() { + pipe.addSync(instrumentation.Scope{}, iSync) + }) require.NotPanics(t, func() { pipe.addCallback(func(ctx context.Context) {}) @@ -85,99 +90,6 @@ func TestNewPipeline(t *testing.T) { require.Len(t, output.ScopeMetrics[0].Metrics, 1) } -func TestPipelineDuplicateRegistration(t *testing.T) { - type instrumentID struct { - scope instrumentation.Scope - name string - description string - unit unit.Unit - } - testCases := []struct { - name string - secondInst instrumentID - want error - wantScopeLen int - wantMetricsLen int - }{ - { - name: "exact should error", - secondInst: instrumentID{ - scope: instrumentation.Scope{}, - name: "name", - description: "desc", - unit: unit.Dimensionless, - }, - want: errAlreadyRegistered, - wantScopeLen: 1, - wantMetricsLen: 1, - }, - { - name: "description should not be identifying", - secondInst: instrumentID{ - scope: instrumentation.Scope{}, - name: "name", - description: "other desc", - unit: unit.Dimensionless, - }, - want: errAlreadyRegistered, - wantScopeLen: 1, - wantMetricsLen: 1, - }, - { - name: "scope should be identifying", - secondInst: instrumentID{ - scope: instrumentation.Scope{ - Name: "newScope", - }, - name: "name", - description: "desc", - unit: unit.Dimensionless, - }, - wantScopeLen: 2, - wantMetricsLen: 1, - }, - { - name: "name should be identifying", - secondInst: instrumentID{ - scope: instrumentation.Scope{}, - name: "newName", - description: "desc", - unit: unit.Dimensionless, - }, - wantScopeLen: 1, - wantMetricsLen: 2, - }, - { - name: "unit should be identifying", - secondInst: instrumentID{ - scope: instrumentation.Scope{}, - name: "name", - description: "desc", - unit: unit.Bytes, - }, - wantScopeLen: 1, - wantMetricsLen: 2, - }, - } - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - pipe := newPipeline(nil, nil, nil) - err := pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) - require.NoError(t, err) - - err = pipe.addAggregator(tt.secondInst.scope, tt.secondInst.name, tt.secondInst.description, tt.secondInst.unit, testSumAggregator{}) - assert.ErrorIs(t, err, tt.want) - - if tt.wantScopeLen > 0 { - output, err := pipe.produce(context.Background()) - assert.NoError(t, err) - require.Len(t, output.ScopeMetrics, tt.wantScopeLen) - require.Len(t, output.ScopeMetrics[0].Metrics, tt.wantMetricsLen) - } - }) - } -} - func TestPipelineUsesResource(t *testing.T) { res := resource.NewWithAttributes("noSchema", attribute.String("test", "resource")) pipe := newPipeline(res, nil, nil) @@ -201,10 +113,12 @@ func TestPipelineConcurrency(t *testing.T) { }() wg.Add(1) - go func() { + go func(n int) { defer wg.Done() - _ = pipe.addAggregator(instrumentation.Scope{}, "name", "desc", unit.Dimensionless, testSumAggregator{}) - }() + name := fmt.Sprintf("name %d", n) + sync := instrumentSync{name, "desc", unit.Dimensionless, testSumAggregator{}} + pipe.addSync(instrumentation.Scope{}, sync) + }(i) wg.Add(1) go func() { @@ -249,7 +163,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - i := newInserter[N](test.pipe) + c := newInstrumentCache[N](nil, nil) + i := newInserter(test.pipe, c) got, err := i.Instrument(inst, unit.Dimensionless) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") From 29511a007866cff7a5325cd1a66e3e550a30c4b6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 11 Oct 2022 14:55:18 -0700 Subject: [PATCH 262/886] Release Metric v0.32.2 (#3270) * Bump experimental-metrics version to v0.32.2 * Prepare experimental-metrics for version v0.32.2 * Update changelog --- CHANGELOG.md | 18 ++++++++++++++---- bridge/opencensus/go.mod | 4 ++-- bridge/opencensus/test/go.mod | 6 +++--- example/opencensus/go.mod | 8 ++++---- example/prometheus/go.mod | 6 +++--- example/view/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/prometheus/go.mod | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 4 ++-- sdk/metric/go.mod | 2 +- versions.yaml | 2 +- 13 files changed, 43 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80dc9041d85..3fb9ca0f0c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,24 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added -- Added an example of using metric views to customize instruments. (#3177) -- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc`, `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) ### Changed - `span.SetStatus` has been updated such that calls that lower the status are now no-ops. (#3214) -- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) - Upgrade `golang.org/x/sys/unix` from `v0.0.0-20210423185535-09eb48e85fd7` to `v0.0.0-20220919091848-fb04ddd9f9c8`. This addresses [GO-2022-0493](https://pkg.go.dev/vuln/GO-2022-0493). (#3235) + +## [0.32.2] Metric SDK (Alpha) - 2022-10-11 + +### Added + +- Added an example of using metric views to customize instruments. (#3177) +- Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlpmetric/otlpmetrichttp`). (#3261) + +### Changed + +- Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) - Update histogram default bounds to match the requirements of the latest specification. (#3222) ### Fixed @@ -1982,7 +1991,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.2...HEAD +[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 [0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 [0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 [1.10.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.10.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index edc9c9066ae..4c555eb8462 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -6,9 +6,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.2 go.opentelemetry.io/otel/trace v1.10.0 ) diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 4edd18d9b3f..900b811f026 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.1 + go.opentelemetry.io/otel/bridge/opencensus v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/trace v1.10.0 ) @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.1 // indirect - go.opentelemetry.io/otel/sdk/metric v0.32.1 // indirect + go.opentelemetry.io/otel/metric v0.32.2 // indirect + go.opentelemetry.io/otel/sdk/metric v0.32.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 637eeef3667..274e0491646 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -11,18 +11,18 @@ replace ( require ( go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.1 + go.opentelemetry.io/otel/bridge/opencensus v0.32.2 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.2 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.1 // indirect + go.opentelemetry.io/otel/metric v0.32.2 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1672cc93961..c949dca4969 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.1 - go.opentelemetry.io/otel/metric v0.32.1 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/exporters/prometheus v0.32.2 + go.opentelemetry.io/otel/metric v0.32.2 + go.opentelemetry.io/otel/sdk/metric v0.32.2 ) require ( diff --git a/example/view/go.mod b/example/view/go.mod index bf525bc98d1..2f3c5a4fa66 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.31.0 - go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/exporters/prometheus v0.32.2 + go.opentelemetry.io/otel/metric v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.2 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 857dc047429..eb2da867bba 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -7,9 +7,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.27.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 11de4c8f12a..261155c02c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,9 +6,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1 - go.opentelemetry.io/otel/metric v0.32.1 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.2 + go.opentelemetry.io/otel/metric v0.32.2 + go.opentelemetry.io/otel/sdk/metric v0.32.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index f1f2f64706c..a803538b03a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,9 +6,9 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.1 - go.opentelemetry.io/otel/metric v0.32.1 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.2 + go.opentelemetry.io/otel/metric v0.32.2 + go.opentelemetry.io/otel/sdk/metric v0.32.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 8d67412d12e..38a74c9e805 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,8 +6,8 @@ require ( github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.1 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.2 + go.opentelemetry.io/otel/sdk/metric v0.32.2 ) require ( diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index a5463ac1dd6..9129a8e4fcd 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.1 + go.opentelemetry.io/otel/sdk/metric v0.32.2 ) require ( diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 4326b3ada53..e5625cff71e 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.2 go.opentelemetry.io/otel/sdk v1.10.0 ) diff --git a/versions.yaml b/versions.yaml index 9c6fb5c4561..827bcbcbe82 100644 --- a/versions.yaml +++ b/versions.yaml @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.32.1 + version: v0.32.2 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From ff1855279160d0cfbdb7f1b7cbcb1f53c9d6dcc0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 12 Oct 2022 10:19:51 -0700 Subject: [PATCH 263/886] Release v1.11.0/v0.32.3 (#3275) * Bump stable-v1 and experimental-metrics vers * Prepare stable-v1 for version v1.11.0 * Prepare experimental-metrics for version v0.32.3 * Update changelog for release * Retract v0.32.2 of otlpmetric{http,grpc} --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 16 +++++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 16 +++++++++------- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 8 ++++---- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 31 files changed, 133 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb9ca0f0c5..93b3a7d745d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.11.0/0.32.3] 2022-10-12 + ### Added - Add default User-Agent header to OTLP exporter requests (`go.opentelemetry.io/otel/exporters/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlptrace/otlptracehttp`). (#3261) @@ -1991,7 +1993,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/sdk/metric/v0.32.2...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.0...HEAD +[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 [0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 [0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 [0.32.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4c555eb8462..71eaff1320b 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.2 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 900b811f026..e23e15ae06f 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/bridge/opencensus v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.2 // indirect - go.opentelemetry.io/otel/sdk/metric v0.32.2 // indirect + go.opentelemetry.io/otel/metric v0.32.3 // indirect + go.opentelemetry.io/otel/sdk/metric v0.32.3 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index f76c025332d..41ede6a7f2f 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.7.2 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index 08c50c22927..adb25a227e7 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 2ebbc286fb0..e910d4afba8 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,9 +9,9 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/jaeger v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/jaeger v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/stretchr/objx v0.4.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 616940950d9..6c8a96b6ce2 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 274e0491646..a4e7ab931d9 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.2 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.9.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/bridge/opencensus v0.32.3 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.3 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/sdk/metric v0.32.3 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.2 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/metric v0.32.3 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7f641a7b179..a0ed60601f1 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 google.golang.org/grpc v1.46.2 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index a688e63b372..cc18b51b767 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index c949dca4969..5433a5872e3 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.2 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/prometheus v0.32.3 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk/metric v0.32.3 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 2f3c5a4fa66..b9388f32bee 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.2 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/prometheus v0.32.3 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/sdk/metric v0.32.3 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 054156e39d5..16621bb8e02 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/zipkin v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/zipkin v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 566d530d019..8543d9291d4 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index eb2da867bba..1af3a516dfe 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.42.0 google.golang.org/protobuf v1.27.1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 261155c02c7..45a6a06f4c5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -2,13 +2,15 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc go 1.18 +retract v0.32.2 // Contains unresolvable dependencies. + require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.2 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.46.2 @@ -24,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index a803538b03a..f4e970586c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -2,13 +2,15 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp go 1.18 +retract v0.32.2 // Contains unresolvable dependencies. + require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.2 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) @@ -22,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 9d2ac99a681..fc224d231a3 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.46.2 google.golang.org/protobuf v1.28.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index cf56dfd79f1..7b3285e09c5 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.1.12 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index c3cec4f3415..c2f5713cc4d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.0 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 38a74c9e805..8ced7d32207 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk/metric v0.32.3 ) require ( @@ -22,8 +22,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 9129a8e4fcd..a4d67c367d0 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/sdk/metric v0.32.2 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/sdk/metric v0.32.3 ) require ( @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 382ea1458c4..d4a747d1159 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index e5c67485e94..0ac0806456c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.8 github.com/openzipkin/zipkin-go v0.4.0 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/sdk v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/go.mod b/go.mod index df6d6208682..04536dc7288 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel/trace v1.11.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 649e18c2093..ed48167bf2c 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel v1.11.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 182c2bb5332..f4bb4b3a739 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/trace v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/trace v1.11.0 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index e5625cff71e..db068f1c206 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 - go.opentelemetry.io/otel/metric v0.32.2 - go.opentelemetry.io/otel/sdk v1.10.0 + go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 ) require ( github.com/davecgh/go-spew v1.1.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.10.0 // indirect + go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 95fba71a800..d90f7a4055a 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.8 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.10.0 + go.opentelemetry.io/otel v1.11.0 ) require ( diff --git a/version.go b/version.go index 806db41c555..cbd042f5bce 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.10.0" + return "1.11.0" } diff --git a/versions.yaml b/versions.yaml index 827bcbcbe82..324f3c6f7d0 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.10.0 + version: v1.11.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.32.2 + version: v0.32.3 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 4a3adaafd4f373d4da74a1856ad4d2d40c066924 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 12 Oct 2022 12:54:51 -0700 Subject: [PATCH 264/886] Replace meterRegistry with cache (#3255) --- sdk/metric/meter.go | 44 ---------------------------------------- sdk/metric/meter_test.go | 22 -------------------- sdk/metric/provider.go | 17 +++++++--------- 3 files changed, 7 insertions(+), 76 deletions(-) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index c6871a06716..80007b1465e 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -16,7 +16,6 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" - "sync" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" @@ -27,49 +26,6 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" ) -// meterRegistry keeps a record of initialized meters for instrumentation -// scopes. A meter is unique to an instrumentation scope and if multiple -// requests for that meter are made a meterRegistry ensure the same instance -// is used. -// -// The zero meterRegistry is empty and ready for use. -// -// A meterRegistry must not be copied after first use. -// -// All methods of a meterRegistry are safe to call concurrently. -type meterRegistry struct { - sync.Mutex - - meters map[instrumentation.Scope]*meter - - pipes pipelines -} - -// Get returns a registered meter matching the instrumentation scope if it -// exists in the meterRegistry. Otherwise, a new meter configured for the -// instrumentation scope is registered and then returned. -// -// Get is safe to call concurrently. -func (r *meterRegistry) Get(s instrumentation.Scope) *meter { - r.Lock() - defer r.Unlock() - - if r.meters == nil { - m := newMeter(s, r.pipes) - r.meters = map[instrumentation.Scope]*meter{s: m} - return m - } - - m, ok := r.meters[s] - if ok { - return m - } - - m = newMeter(s, r.pipes) - r.meters[s] = m - return m -} - // meter handles the creation and coordination of all metric instruments. A // meter represents a single instrumentation scope; all metric telemetry // produced by an instrumentation scope will use metric instruments from a diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index a67aa507d06..8f6448f757e 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -31,28 +31,6 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) -func TestMeterRegistry(t *testing.T) { - is0 := instrumentation.Scope{Name: "zero"} - is1 := instrumentation.Scope{Name: "one"} - - r := meterRegistry{} - var m0 *meter - t.Run("ZeroValueGetDoesNotPanic", func(t *testing.T) { - assert.NotPanics(t, func() { m0 = r.Get(is0) }) - assert.Equal(t, is0, m0.Scope, "uninitialized meter returned") - }) - - m01 := r.Get(is0) - t.Run("GetSameMeter", func(t *testing.T) { - assert.Samef(t, m0, m01, "returned different meters: %v", is0) - }) - - m1 := r.Get(is1) - t.Run("GetDifferentMeter", func(t *testing.T) { - assert.NotSamef(t, m0, m1, "returned same meters: %v", is1) - }) -} - // A meter should be able to make instruments concurrently. func TestMeterInstrumentConcurrency(t *testing.T) { wg := &sync.WaitGroup{} diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index db890d1060b..ce2e5524398 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -26,7 +26,8 @@ import ( // the same Views applied to them, and have their produced metric telemetry // passed to the configured Readers. type MeterProvider struct { - meters meterRegistry + pipes pipelines + meters cache[instrumentation.Scope, *meter] forceFlush, shutdown func(context.Context) error } @@ -42,16 +43,9 @@ var _ metric.MeterProvider = (*MeterProvider)(nil) // Readers, will perform no operations. func NewMeterProvider(options ...Option) *MeterProvider { conf := newConfig(options) - flush, sdown := conf.readerSignals() - - registry := newPipelines(conf.res, conf.readers) - return &MeterProvider{ - meters: meterRegistry{ - pipes: registry, - }, - + pipes: newPipelines(conf.res, conf.readers), forceFlush: flush, shutdown: sdown, } @@ -72,10 +66,13 @@ func NewMeterProvider(options ...Option) *MeterProvider { // This method is safe to call concurrently. func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metric.Meter { c := metric.NewMeterConfig(options...) - return mp.meters.Get(instrumentation.Scope{ + s := instrumentation.Scope{ Name: name, Version: c.InstrumentationVersion(), SchemaURL: c.SchemaURL(), + } + return mp.meters.Lookup(s, func() *meter { + return newMeter(s, mp.pipes) }) } From e4bdfe7b566d7d599988825ae7a67eaf5713db2e Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Wed, 12 Oct 2022 13:44:18 -0700 Subject: [PATCH 265/886] Fix sdktrace.TraceProvider Shutdown/ForceFlush when no processor register (#3268) * Fix sdktrace.TraceProvider Shutdown/ForceFlush when no processor register Signed-off-by: Bogdan Drutu * Update CHANGELOG.md Signed-off-by: Bogdan Drutu Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 +++ sdk/trace/provider.go | 41 +++++++++++++---------------- sdk/trace/provider_test.go | 51 +++++++++++++++++++------------------ sdk/trace/span.go | 15 +++++------ sdk/trace/span_processor.go | 5 ++++ sdk/trace/tracer.go | 2 +- 6 files changed, 60 insertions(+), 58 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93b3a7d745d..d13497c6ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) + ## [1.11.0/0.32.3] 2022-10-12 ### Added diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 292ea5481bc..327b8b41638 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -116,12 +116,13 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { spanLimits: o.spanLimits, resource: o.resource, } - global.Info("TracerProvider created", "config", o) + spss := spanProcessorStates{} for _, sp := range o.processors { - tp.RegisterSpanProcessor(sp) + spss = append(spss, newSpanProcessorState(sp)) } + tp.spanProcessors.Store(spss) return tp } @@ -159,44 +160,38 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T } // RegisterSpanProcessor adds the given SpanProcessor to the list of SpanProcessors. -func (p *TracerProvider) RegisterSpanProcessor(s SpanProcessor) { +func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { p.mu.Lock() defer p.mu.Unlock() newSPS := spanProcessorStates{} - if old, ok := p.spanProcessors.Load().(spanProcessorStates); ok { - newSPS = append(newSPS, old...) - } - newSpanSync := &spanProcessorState{ - sp: s, - state: &sync.Once{}, - } - newSPS = append(newSPS, newSpanSync) + newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...) + newSPS = append(newSPS, newSpanProcessorState(sp)) p.spanProcessors.Store(newSPS) } // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. -func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) { +func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { p.mu.Lock() defer p.mu.Unlock() - spss := spanProcessorStates{} - old, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok || len(old) == 0 { + old := p.spanProcessors.Load().(spanProcessorStates) + if len(old) == 0 { return } + spss := spanProcessorStates{} spss = append(spss, old...) // stop the span processor if it is started and remove it from the list var stopOnce *spanProcessorState var idx int for i, sps := range spss { - if sps.sp == s { + if sps.sp == sp { stopOnce = sps idx = i } } if stopOnce != nil { stopOnce.state.Do(func() { - if err := s.Shutdown(context.Background()); err != nil { + if err := sp.Shutdown(context.Background()); err != nil { otel.Handle(err) } }) @@ -213,10 +208,7 @@ func (p *TracerProvider) UnregisterSpanProcessor(s SpanProcessor) { // ForceFlush immediately exports all spans that have not yet been exported for // all the registered span processors. func (p *TracerProvider) ForceFlush(ctx context.Context) error { - spss, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok { - return fmt.Errorf("failed to load span processors") - } + spss := p.spanProcessors.Load().(spanProcessorStates) if len(spss) == 0 { return nil } @@ -237,10 +229,11 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error { // Shutdown shuts down the span processors in the order they were registered. func (p *TracerProvider) Shutdown(ctx context.Context) error { - spss, ok := p.spanProcessors.Load().(spanProcessorStates) - if !ok { - return fmt.Errorf("failed to load span processors") + spss := p.spanProcessors.Load().(spanProcessorStates) + if len(spss) == 0 { + return nil } + var retErr error for _, sps := range spss { select { diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 6ec3df6794d..2cf19aaa029 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -28,41 +28,45 @@ import ( "go.opentelemetry.io/otel/trace" ) -type basicSpanProcesor struct { - running bool +type basicSpanProcessor struct { + flushed bool + closed bool injectShutdownError error } -func (t *basicSpanProcesor) Shutdown(context.Context) error { - t.running = false +func (t *basicSpanProcessor) Shutdown(context.Context) error { + t.closed = true return t.injectShutdownError } -func (t *basicSpanProcesor) OnStart(context.Context, ReadWriteSpan) {} -func (t *basicSpanProcesor) OnEnd(ReadOnlySpan) {} -func (t *basicSpanProcesor) ForceFlush(context.Context) error { +func (t *basicSpanProcessor) OnStart(context.Context, ReadWriteSpan) {} +func (t *basicSpanProcessor) OnEnd(ReadOnlySpan) {} +func (t *basicSpanProcessor) ForceFlush(context.Context) error { + t.flushed = true return nil } +func TestForceFlushAndShutdownTraceProviderWithoutProcessor(t *testing.T) { + stp := NewTracerProvider() + assert.NoError(t, stp.ForceFlush(context.Background())) + assert.NoError(t, stp.Shutdown(context.Background())) +} + func TestShutdownTraceProvider(t *testing.T) { stp := NewTracerProvider() - sp := &basicSpanProcesor{} + sp := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp) - sp.running = true - - _ = stp.Shutdown(context.Background()) - - if sp.running { - t.Errorf("Error shutdown basicSpanProcesor\n") - } + assert.NoError(t, stp.ForceFlush(context.Background())) + assert.True(t, sp.flushed, "error ForceFlush basicSpanProcessor") + assert.NoError(t, stp.Shutdown(context.Background())) + assert.True(t, sp.closed, "error Shutdown basicSpanProcessor") } func TestFailedProcessorShutdown(t *testing.T) { stp := NewTracerProvider() spErr := errors.New("basic span processor shutdown failure") - sp := &basicSpanProcesor{ - running: true, + sp := &basicSpanProcessor{ injectShutdownError: spErr, } stp.RegisterSpanProcessor(sp) @@ -76,12 +80,10 @@ func TestFailedProcessorsShutdown(t *testing.T) { stp := NewTracerProvider() spErr1 := errors.New("basic span processor shutdown failure1") spErr2 := errors.New("basic span processor shutdown failure2") - sp1 := &basicSpanProcesor{ - running: true, + sp1 := &basicSpanProcessor{ injectShutdownError: spErr1, } - sp2 := &basicSpanProcesor{ - running: true, + sp2 := &basicSpanProcessor{ injectShutdownError: spErr2, } stp.RegisterSpanProcessor(sp1) @@ -90,16 +92,15 @@ func TestFailedProcessorsShutdown(t *testing.T) { err := stp.Shutdown(context.Background()) assert.Error(t, err) assert.EqualError(t, err, "basic span processor shutdown failure1; basic span processor shutdown failure2") - assert.False(t, sp1.running) - assert.False(t, sp2.running) + assert.True(t, sp1.closed) + assert.True(t, sp2.closed) } func TestFailedProcessorShutdownInUnregister(t *testing.T) { handler.Reset() stp := NewTracerProvider() spErr := errors.New("basic span processor shutdown failure") - sp := &basicSpanProcesor{ - running: true, + sp := &basicSpanProcessor{ injectShutdownError: spErr, } stp.RegisterSpanProcessor(sp) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 9760923f702..c7cf8e94ec9 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -423,14 +423,13 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { } s.mu.Unlock() - if sps, ok := s.tracer.provider.spanProcessors.Load().(spanProcessorStates); ok { - if len(sps) == 0 { - return - } - snap := s.snapshot() - for _, sp := range sps { - sp.sp.OnEnd(snap) - } + sps := s.tracer.provider.spanProcessors.Load().(spanProcessorStates) + if len(sps) == 0 { + return + } + snap := s.snapshot() + for _, sp := range sps { + sp.sp.OnEnd(snap) } } diff --git a/sdk/trace/span_processor.go b/sdk/trace/span_processor.go index b649a2ff049..e6ae1935219 100644 --- a/sdk/trace/span_processor.go +++ b/sdk/trace/span_processor.go @@ -64,4 +64,9 @@ type spanProcessorState struct { sp SpanProcessor state *sync.Once } + +func newSpanProcessorState(sp SpanProcessor) *spanProcessorState { + return &spanProcessorState{sp: sp, state: &sync.Once{}} +} + type spanProcessorStates []*spanProcessorState diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index 7b11fc465c6..f17d924b89e 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -51,7 +51,7 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanS s := tr.newSpan(ctx, name, &config) if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() { - sps, _ := tr.provider.spanProcessors.Load().(spanProcessorStates) + sps := tr.provider.spanProcessors.Load().(spanProcessorStates) for _, sp := range sps { sp.sp.OnStart(ctx, rw) } From a8b9ddc7f6e55ff7c3b34d45b6fa3670fee0fcbf Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Thu, 13 Oct 2022 22:34:02 +0800 Subject: [PATCH 266/886] attribute: fix slice related function bug (#3252) * attribute: fix slice related function bug Signed-off-by: Ziqi Zhao Co-authored-by: Tyler Yahn Co-authored-by: Chester Cheung --- CHANGELOG.md | 4 ++ attribute/value.go | 67 ++++++++------------------- attribute/value_test.go | 80 +++++++++++++++++++++++++++++++++ internal/attribute/attribute.go | 45 +++++++++++++++++++ sdk/trace/span.go | 17 +------ 5 files changed, 150 insertions(+), 63 deletions(-) create mode 100644 internal/attribute/attribute.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d13497c6ae0..79760b035bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) +### Fixed + +- Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) + ## [1.11.0/0.32.3] 2022-10-12 ### Added diff --git a/attribute/value.go b/attribute/value.go index 57899f682e7..80a37bd6ff3 100644 --- a/attribute/value.go +++ b/attribute/value.go @@ -17,9 +17,11 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( "encoding/json" "fmt" + "reflect" "strconv" "go.opentelemetry.io/otel/internal" + "go.opentelemetry.io/otel/internal/attribute" ) //go:generate stringer -type=Type @@ -66,12 +68,7 @@ func BoolValue(v bool) Value { // BoolSliceValue creates a BOOLSLICE Value. func BoolSliceValue(v []bool) Value { - cp := make([]bool, len(v)) - copy(cp, v) - return Value{ - vtype: BOOLSLICE, - slice: &cp, - } + return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} } // IntValue creates an INT64 Value. @@ -81,13 +78,14 @@ func IntValue(v int) Value { // IntSliceValue creates an INTSLICE Value. func IntSliceValue(v []int) Value { - cp := make([]int64, 0, len(v)) - for _, i := range v { - cp = append(cp, int64(i)) + var int64Val int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(int64Val))) + for i, val := range v { + cp.Elem().Index(i).SetInt(int64(val)) } return Value{ vtype: INT64SLICE, - slice: &cp, + slice: cp.Elem().Interface(), } } @@ -101,12 +99,7 @@ func Int64Value(v int64) Value { // Int64SliceValue creates an INT64SLICE Value. func Int64SliceValue(v []int64) Value { - cp := make([]int64, len(v)) - copy(cp, v) - return Value{ - vtype: INT64SLICE, - slice: &cp, - } + return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} } // Float64Value creates a FLOAT64 Value. @@ -119,12 +112,7 @@ func Float64Value(v float64) Value { // Float64SliceValue creates a FLOAT64SLICE Value. func Float64SliceValue(v []float64) Value { - cp := make([]float64, len(v)) - copy(cp, v) - return Value{ - vtype: FLOAT64SLICE, - slice: &cp, - } + return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} } // StringValue creates a STRING Value. @@ -137,12 +125,7 @@ func StringValue(v string) Value { // StringSliceValue creates a STRINGSLICE Value. func StringSliceValue(v []string) Value { - cp := make([]string, len(v)) - copy(cp, v) - return Value{ - vtype: STRINGSLICE, - slice: &cp, - } + return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} } // Type returns a type of the Value. @@ -159,10 +142,7 @@ func (v Value) AsBool() bool { // AsBoolSlice returns the []bool value. Make sure that the Value's type is // BOOLSLICE. func (v Value) AsBoolSlice() []bool { - if s, ok := v.slice.(*[]bool); ok { - return *s - } - return nil + return attribute.AsSlice[bool](v.slice) } // AsInt64 returns the int64 value. Make sure that the Value's type is @@ -174,10 +154,7 @@ func (v Value) AsInt64() int64 { // AsInt64Slice returns the []int64 value. Make sure that the Value's type is // INT64SLICE. func (v Value) AsInt64Slice() []int64 { - if s, ok := v.slice.(*[]int64); ok { - return *s - } - return nil + return attribute.AsSlice[int64](v.slice) } // AsFloat64 returns the float64 value. Make sure that the Value's @@ -189,10 +166,7 @@ func (v Value) AsFloat64() float64 { // AsFloat64Slice returns the []float64 value. Make sure that the Value's type is // FLOAT64SLICE. func (v Value) AsFloat64Slice() []float64 { - if s, ok := v.slice.(*[]float64); ok { - return *s - } - return nil + return attribute.AsSlice[float64](v.slice) } // AsString returns the string value. Make sure that the Value's type @@ -204,10 +178,7 @@ func (v Value) AsString() string { // AsStringSlice returns the []string value. Make sure that the Value's type is // STRINGSLICE. func (v Value) AsStringSlice() []string { - if s, ok := v.slice.(*[]string); ok { - return *s - } - return nil + return attribute.AsSlice[string](v.slice) } type unknownValueType struct{} @@ -239,19 +210,19 @@ func (v Value) AsInterface() interface{} { func (v Value) Emit() string { switch v.Type() { case BOOLSLICE: - return fmt.Sprint(*(v.slice.(*[]bool))) + return fmt.Sprint(v.AsBoolSlice()) case BOOL: return strconv.FormatBool(v.AsBool()) case INT64SLICE: - return fmt.Sprint(*(v.slice.(*[]int64))) + return fmt.Sprint(v.AsInt64Slice()) case INT64: return strconv.FormatInt(v.AsInt64(), 10) case FLOAT64SLICE: - return fmt.Sprint(*(v.slice.(*[]float64))) + return fmt.Sprint(v.AsFloat64Slice()) case FLOAT64: return fmt.Sprint(v.AsFloat64()) case STRINGSLICE: - return fmt.Sprint(*(v.slice.(*[]string))) + return fmt.Sprint(v.AsStringSlice()) case STRING: return v.stringly default: diff --git a/attribute/value_test.go b/attribute/value_test.go index c9370880b54..ec79dc62a27 100644 --- a/attribute/value_test.go +++ b/attribute/value_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" ) @@ -104,3 +105,82 @@ func TestValue(t *testing.T) { } } } + +func TestSetComparability(t *testing.T) { + pairs := [][2]attribute.KeyValue{ + { + attribute.Bool("Bool", true), + attribute.Bool("Bool", true), + }, + { + attribute.BoolSlice("BoolSlice", []bool{true, false, true}), + attribute.BoolSlice("BoolSlice", []bool{true, false, true}), + }, + { + attribute.Int("Int", 34), + attribute.Int("Int", 34), + }, + { + attribute.IntSlice("IntSlice", []int{312, 1, -2}), + attribute.IntSlice("IntSlice", []int{312, 1, -2}), + }, + { + attribute.Int64("Int64", 98), + attribute.Int64("Int64", 98), + }, + { + attribute.Int64Slice("Int64Slice", []int64{12, 1298, -219, 2}), + attribute.Int64Slice("Int64Slice", []int64{12, 1298, -219, 2}), + }, + { + attribute.Float64("Float64", 19.09), + attribute.Float64("Float64", 19.09), + }, + { + attribute.Float64Slice("Float64Slice", []float64{12398.1, -37.1713873737, 3}), + attribute.Float64Slice("Float64Slice", []float64{12398.1, -37.1713873737, 3}), + }, + { + attribute.String("String", "string value"), + attribute.String("String", "string value"), + }, + { + attribute.StringSlice("StringSlice", []string{"one", "two", "three"}), + attribute.StringSlice("StringSlice", []string{"one", "two", "three"}), + }, + } + + for _, p := range pairs { + s0, s1 := attribute.NewSet(p[0]), attribute.NewSet(p[1]) + m := map[attribute.Set]struct{}{s0: {}} + _, ok := m[s1] + assert.Truef(t, ok, "%s not comparable", p[0].Value.Type()) + } +} + +func TestAsSlice(t *testing.T) { + bs1 := []bool{true, false, true} + kv := attribute.BoolSlice("BoolSlice", bs1) + bs2 := kv.Value.AsBoolSlice() + assert.Equal(t, bs1, bs2) + + i64s1 := []int64{12, 1298, -219, 2} + kv = attribute.Int64Slice("Int64Slice", i64s1) + i64s2 := kv.Value.AsInt64Slice() + assert.Equal(t, i64s1, i64s2) + + is1 := []int{12, 1298, -219, 2} + kv = attribute.IntSlice("IntSlice", is1) + i64s2 = kv.Value.AsInt64Slice() + assert.Equal(t, i64s1, i64s2) + + fs1 := []float64{12398.1, -37.1713873737, 3} + kv = attribute.Float64Slice("Float64Slice", fs1) + fs2 := kv.Value.AsFloat64Slice() + assert.Equal(t, fs1, fs2) + + ss1 := []string{"one", "two", "three"} + kv = attribute.StringSlice("StringSlice", ss1) + ss2 := kv.Value.AsStringSlice() + assert.Equal(t, ss1, ss2) +} diff --git a/internal/attribute/attribute.go b/internal/attribute/attribute.go new file mode 100644 index 00000000000..22034894473 --- /dev/null +++ b/internal/attribute/attribute.go @@ -0,0 +1,45 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package attribute provide several helper functions for some commonly used +logic of processing attributes. +*/ +package attribute // import "go.opentelemetry.io/otel/internal/attribute" + +import ( + "reflect" +) + +// SliceValue convert a slice into an array with same elements as slice. +func SliceValue[T bool | int64 | float64 | string](v []T) any { + var zero T + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]T), v) + return cp.Elem().Interface() +} + +// AsSlice convert an array into a slice into with same elements as array. +func AsSlice[T bool | int64 | float64 | string](v any) []T { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero T + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]T) +} diff --git a/sdk/trace/span.go b/sdk/trace/span.go index c7cf8e94ec9..b5d6f544176 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -313,26 +313,13 @@ func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { return attr.Key.String(safeTruncate(v, limit)) } case attribute.STRINGSLICE: - // Do no mutate the original, make a copy. - trucated := attr.Key.StringSlice(attr.Value.AsStringSlice()) - // Do not do this. - // - // v := trucated.Value.AsStringSlice() - // cp := make([]string, len(v)) - // /* Copy and truncate values to cp ... */ - // trucated.Value = attribute.StringSliceValue(cp) - // - // Copying the []string and then assigning it back as a new value with - // attribute.StringSliceValue will copy the data twice. Instead, we - // already made a copy above that only this function owns, update the - // underlying slice data of our copy. - v := trucated.Value.AsStringSlice() + v := attr.Value.AsStringSlice() for i := range v { if len(v[i]) > limit { v[i] = safeTruncate(v[i], limit) } } - return trucated + return attr.Key.StringSlice(v) } return attr } From 84e28fd3bdb10b11a15be895f2eda56f2c341384 Mon Sep 17 00:00:00 2001 From: Alan Protasio Date: Thu, 13 Oct 2022 08:44:40 -0700 Subject: [PATCH 267/886] Fix Http Status Code with Otel Bridge (#3265) * Fix Http Status Code with Otel Bridge Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + bridge/opentracing/bridge.go | 8 +++++++ bridge/opentracing/bridge_test.go | 35 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79760b035bc..faeccbc936b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Flush pending measurements with the `PeriodicReader` in the `go.opentelemetry.io/otel/sdk/metric` when `ForceFlush` or `Shutdown` are called. (#3220) - Update histogram default bounds to match the requirements of the latest specification. (#3222) +- Encode the HTTP status code in the OpenTracing bridge (`go.opentelemetry.io/otel/bridge/opentracing`) as an integer. (#3265) ### Fixed diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 967aaa20d4b..39b19276881 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -546,6 +546,14 @@ func otTagToOTelAttr(k string, v interface{}) attribute.KeyValue { return key.String(fmt.Sprintf("%d", val)) case float64: return key.Float64(val) + case int8: + return key.Int64(int64(val)) + case uint8: + return key.Int64(int64(val)) + case int16: + return key.Int64(int64(val)) + case uint16: + return key.Int64(int64(val)) case int32: return key.Int64(int64(val)) case uint32: diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 7286bd77823..6b80da9004d 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -17,7 +17,9 @@ package opentracing import ( "context" "errors" + "fmt" "net/http" + "reflect" "strings" "testing" @@ -26,6 +28,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/bridge/opentracing/internal" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -428,6 +431,38 @@ func TestBridgeTracer_StartSpan(t *testing.T) { } } +func Test_otTagToOTelAttr(t *testing.T) { + key := attribute.Key("test") + testCases := []struct { + value interface{} + expected attribute.KeyValue + }{ + { + value: int8(12), + expected: key.Int64(int64(12)), + }, + { + value: uint8(12), + expected: key.Int64(int64(12)), + }, + { + value: int16(12), + expected: key.Int64(int64(12)), + }, + { + value: uint16(12), + expected: key.Int64(int64(12)), + }, + } + + for _, tc := range testCases { + t.Run(fmt.Sprintf("%s %v", reflect.TypeOf(tc.value), tc.value), func(t *testing.T) { + att := otTagToOTelAttr(string(key), tc.value) + assert.Equal(t, tc.expected, att) + }) + } +} + func Test_otTagsToOTelAttributesKindAndError(t *testing.T) { tracer := internal.NewMockTracer() sc := &bridgeSpanContext{} From 1e72af45a93cfbc03362947c29d86041a64e1430 Mon Sep 17 00:00:00 2001 From: Albert Date: Fri, 14 Oct 2022 10:13:35 -0400 Subject: [PATCH 268/886] promtheus exporter will sum hist buckets (#3281) (#3282) Signed-off-by: albertlockett --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 5 ++++- exporters/prometheus/testdata/histogram.txt | 14 ++++++------ .../prometheus/testdata/sanitized_names.txt | 22 +++++++++---------- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faeccbc936b..54a28deaad2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) +- Prometheus exporter will now cumulatively sum histogram buckets. (#3281) ## [1.11.0/0.32.3] 2022-10-12 diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 3fe848f1e03..8b4c7f56114 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -145,8 +145,11 @@ func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics keys, values := getAttrs(dp.Attributes) desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) + + cumulativeCount := uint64(0) for i, bound := range dp.Bounds { - buckets[bound] = dp.BucketCounts[i] + cumulativeCount += dp.BucketCounts[i] + buckets[bound] = cumulativeCount } md := &metricData{ name: m.Name, diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt index 3a8422bb573..95f202154a4 100644 --- a/exporters/prometheus/testdata/histogram.txt +++ b/exporters/prometheus/testdata/histogram.txt @@ -3,13 +3,13 @@ histogram_baz_bucket{A="B",C="D",le="0"} 0 histogram_baz_bucket{A="B",C="D",le="5"} 0 histogram_baz_bucket{A="B",C="D",le="10"} 1 -histogram_baz_bucket{A="B",C="D",le="25"} 1 -histogram_baz_bucket{A="B",C="D",le="50"} 0 -histogram_baz_bucket{A="B",C="D",le="75"} 0 -histogram_baz_bucket{A="B",C="D",le="100"} 0 -histogram_baz_bucket{A="B",C="D",le="250"} 2 -histogram_baz_bucket{A="B",C="D",le="500"} 0 -histogram_baz_bucket{A="B",C="D",le="1000"} 0 +histogram_baz_bucket{A="B",C="D",le="25"} 2 +histogram_baz_bucket{A="B",C="D",le="50"} 2 +histogram_baz_bucket{A="B",C="D",le="75"} 2 +histogram_baz_bucket{A="B",C="D",le="100"} 2 +histogram_baz_bucket{A="B",C="D",le="250"} 4 +histogram_baz_bucket{A="B",C="D",le="500"} 4 +histogram_baz_bucket{A="B",C="D",le="1000"} 4 histogram_baz_bucket{A="B",C="D",le="+Inf"} 4 histogram_baz_sum{A="B",C="D"} 236 histogram_baz_count{A="B",C="D"} 4 diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index 0158d17aeb6..509055705a3 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -13,17 +13,17 @@ invalid_hist_name_bucket{A="B",C="D",le="0"} 0 invalid_hist_name_bucket{A="B",C="D",le="5"} 0 invalid_hist_name_bucket{A="B",C="D",le="10"} 0 invalid_hist_name_bucket{A="B",C="D",le="25"} 1 -invalid_hist_name_bucket{A="B",C="D",le="50"} 0 -invalid_hist_name_bucket{A="B",C="D",le="75"} 0 -invalid_hist_name_bucket{A="B",C="D",le="100"} 0 -invalid_hist_name_bucket{A="B",C="D",le="250"} 0 -invalid_hist_name_bucket{A="B",C="D",le="500"} 0 -invalid_hist_name_bucket{A="B",C="D",le="750"} 0 -invalid_hist_name_bucket{A="B",C="D",le="1000"} 0 -invalid_hist_name_bucket{A="B",C="D",le="2500"} 0 -invalid_hist_name_bucket{A="B",C="D",le="5000"} 0 -invalid_hist_name_bucket{A="B",C="D",le="7500"} 0 -invalid_hist_name_bucket{A="B",C="D",le="10000"} 0 +invalid_hist_name_bucket{A="B",C="D",le="50"} 1 +invalid_hist_name_bucket{A="B",C="D",le="75"} 1 +invalid_hist_name_bucket{A="B",C="D",le="100"} 1 +invalid_hist_name_bucket{A="B",C="D",le="250"} 1 +invalid_hist_name_bucket{A="B",C="D",le="500"} 1 +invalid_hist_name_bucket{A="B",C="D",le="750"} 1 +invalid_hist_name_bucket{A="B",C="D",le="1000"} 1 +invalid_hist_name_bucket{A="B",C="D",le="2500"} 1 +invalid_hist_name_bucket{A="B",C="D",le="5000"} 1 +invalid_hist_name_bucket{A="B",C="D",le="7500"} 1 +invalid_hist_name_bucket{A="B",C="D",le="10000"} 1 invalid_hist_name_bucket{A="B",C="D",le="+Inf"} 1 invalid_hist_name_sum{A="B",C="D"} 23 invalid_hist_name_count{A="B",C="D"} 1 From b6a22abab751307b4851b3cc51728fa557f907bb Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 14 Oct 2022 09:22:43 -0500 Subject: [PATCH 269/886] Refactor Prometheus exporter (#3239) This change will automatically register a created exporter with a prometheus registerer, if none are provided it will use prometheus' DefaultRegisterer. Co-authored-by: Chester Cheung --- CHANGELOG.md | 5 +++ example/prometheus/main.go | 25 +++++------ example/view/main.go | 21 ++++----- exporters/prometheus/benchmark_test.go | 8 ++-- exporters/prometheus/confg_test.go | 60 ++++++++++++++++++++++++++ exporters/prometheus/config.go | 59 +++++++++++++++++++++++++ exporters/prometheus/exporter.go | 40 +++++++++-------- exporters/prometheus/exporter_test.go | 8 ++-- 8 files changed, 170 insertions(+), 56 deletions(-) create mode 100644 exporters/prometheus/confg_test.go create mode 100644 exporters/prometheus/config.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 54a28deaad2..87d13296190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Prometheus exporter will register with a prometheus registerer on creation, there are options to control this. (#3239) + ### Changed - `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) +- The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) ### Fixed diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 0517da33c2f..e1d87693c22 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -22,11 +22,10 @@ import ( "os" "os/signal" - "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/attribute" - otelprom "go.opentelemetry.io/otel/exporters/prometheus" + "go.opentelemetry.io/otel/exporters/prometheus" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric" ) @@ -37,12 +36,15 @@ func main() { // The exporter embeds a default OpenTelemetry Reader and // implements prometheus.Collector, allowing it to be used as // both a Reader and Collector. - exporter := otelprom.New() + exporter, err := prometheus.New() + if err != nil { + log.Fatal(err) + } provider := metric.NewMeterProvider(metric.WithReader(exporter)) meter := provider.Meter("github.com/open-telemetry/opentelemetry-go/example/prometheus") // Start the prometheus HTTP server and pass the exporter Collector to it - go serveMetrics(exporter.Collector) + go serveMetrics() attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), @@ -77,17 +79,10 @@ func main() { <-ctx.Done() } -func serveMetrics(collector prometheus.Collector) { - registry := prometheus.NewRegistry() - err := registry.Register(collector) - if err != nil { - fmt.Printf("error registering collector: %v", err) - return - } - - log.Printf("serving metrics at localhost:2222/metrics") - http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) - err = http.ListenAndServe(":2222", nil) +func serveMetrics() { + log.Printf("serving metrics at localhost:2223/metrics") + http.Handle("/metrics", promhttp.Handler()) + err := http.ListenAndServe(":2223", nil) if err != nil { fmt.Printf("error serving http: %v", err) return diff --git a/example/view/main.go b/example/view/main.go index 872e12dde1f..c8f1b246590 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -22,7 +22,6 @@ import ( "os" "os/signal" - "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/attribute" @@ -40,7 +39,10 @@ func main() { ctx := context.Background() // The exporter embeds a default OpenTelemetry Reader, allowing it to be used in WithReader. - exporter := otelprom.New() + exporter, err := otelprom.New() + if err != nil { + log.Fatal(err) + } // View to customize histogram buckets and rename a single histogram instrument. customBucketsView, err := view.New( @@ -68,7 +70,7 @@ func main() { meter := provider.Meter(meterName) // Start the prometheus HTTP server and pass the exporter Collector to it - go serveMetrics(exporter.Collector) + go serveMetrics() attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), @@ -94,17 +96,10 @@ func main() { <-ctx.Done() } -func serveMetrics(collector prometheus.Collector) { - registry := prometheus.NewRegistry() - err := registry.Register(collector) - if err != nil { - fmt.Printf("error registering collector: %v", err) - return - } - +func serveMetrics() { log.Printf("serving metrics at localhost:2222/metrics") - http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{})) - err = http.ListenAndServe(":2222", nil) + http.Handle("/metrics", promhttp.Handler()) + err := http.ListenAndServe(":2222", nil) if err != nil { fmt.Printf("error serving http: %v", err) return diff --git a/exporters/prometheus/benchmark_test.go b/exporters/prometheus/benchmark_test.go index dee0814ed75..6c6d67cae76 100644 --- a/exporters/prometheus/benchmark_test.go +++ b/exporters/prometheus/benchmark_test.go @@ -27,13 +27,11 @@ import ( func benchmarkCollect(b *testing.B, n int) { ctx := context.Background() - exporter := New() - provider := metric.NewMeterProvider(metric.WithReader(exporter)) - meter := provider.Meter("testmeter") - registry := prometheus.NewRegistry() - err := registry.Register(exporter.Collector) + exporter, err := New(WithRegisterer(registry)) require.NoError(b, err) + provider := metric.NewMeterProvider(metric.WithReader(exporter)) + meter := provider.Meter("testmeter") for i := 0; i < n; i++ { counter, err := meter.SyncFloat64().Counter(fmt.Sprintf("foo_%d", i)) diff --git a/exporters/prometheus/confg_test.go b/exporters/prometheus/confg_test.go new file mode 100644 index 00000000000..91893d40f3a --- /dev/null +++ b/exporters/prometheus/confg_test.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" + +import ( + "testing" + + "github.com/prometheus/client_golang/prometheus" + "github.com/stretchr/testify/assert" +) + +func TestNewConfig(t *testing.T) { + registry := prometheus.NewRegistry() + + testCases := []struct { + name string + options []Option + wantRegisterer prometheus.Registerer + }{ + { + name: "Default", + options: nil, + wantRegisterer: prometheus.DefaultRegisterer, + }, + + { + name: "WithRegisterer", + options: []Option{ + WithRegisterer(registry), + }, + wantRegisterer: registry, + }, + { + name: "nil options do nothing", + options: []Option{ + WithRegisterer(nil), + }, + wantRegisterer: prometheus.DefaultRegisterer, + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + cfg := newConfig(tt.options...) + + assert.Equal(t, tt.wantRegisterer, cfg.registerer) + }) + } +} diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go new file mode 100644 index 00000000000..6ee84732556 --- /dev/null +++ b/exporters/prometheus/config.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// config contains options for the exporter. +type config struct { + registerer prometheus.Registerer +} + +// newConfig creates a validated config configured with options. +func newConfig(opts ...Option) config { + cfg := config{} + for _, opt := range opts { + cfg = opt.apply(cfg) + } + + if cfg.registerer == nil { + cfg.registerer = prometheus.DefaultRegisterer + } + + return cfg +} + +// Option sets exporter option values. +type Option interface { + apply(config) config +} + +type optionFunc func(config) config + +func (fn optionFunc) apply(cfg config) config { + return fn(cfg) +} + +// WithRegisterer configures which prometheus Registerer the Exporter will +// register with. If no registerer is used the prometheus DefaultRegisterer is +// used. +func WithRegisterer(reg prometheus.Registerer) Option { + return optionFunc(func(cfg config) config { + cfg.registerer = reg + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 8b4c7f56114..007dc2f50d9 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -16,6 +16,7 @@ package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( "context" + "fmt" "sort" "strings" "unicode" @@ -33,39 +34,42 @@ import ( // interface for easy instantiation with a MeterProvider. type Exporter struct { metric.Reader - Collector prometheus.Collector } +var _ metric.Reader = &Exporter{} + // collector is used to implement prometheus.Collector. type collector struct { - metric.Reader -} - -// config is added here to allow for options expansion in the future. -type config struct{} - -// Option may be used in the future to apply options to a Prometheus Exporter config. -type Option interface { - apply(config) config + reader metric.Reader } // New returns a Prometheus Exporter. -func New(_ ...Option) Exporter { +func New(opts ...Option) (*Exporter, error) { + cfg := newConfig(opts...) + // this assumes that the default temporality selector will always return cumulative. // we only support cumulative temporality, so building our own reader enforces this. + // TODO (#3244): Enable some way to configure the reader, but not change temporality. reader := metric.NewManualReader() - e := Exporter{ + + collector := &collector{ + reader: reader, + } + + if err := cfg.registerer.Register(collector); err != nil { + return nil, fmt.Errorf("cannot register the collector: %w", err) + } + + e := &Exporter{ Reader: reader, - Collector: &collector{ - Reader: reader, - }, } - return e + + return e, nil } // Describe implements prometheus.Collector. func (c *collector) Describe(ch chan<- *prometheus.Desc) { - metrics, err := c.Reader.Collect(context.TODO()) + metrics, err := c.reader.Collect(context.TODO()) if err != nil { otel.Handle(err) } @@ -76,7 +80,7 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) { // Collect implements prometheus.Collector. func (c *collector) Collect(ch chan<- prometheus.Metric) { - metrics, err := c.Reader.Collect(context.TODO()) + metrics, err := c.reader.Collect(context.TODO()) if err != nil { otel.Handle(err) } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 55db838dcd2..5a1a65ce58d 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -137,8 +137,10 @@ func TestPrometheusExporter(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { ctx := context.Background() + registry := prometheus.NewRegistry() - exporter := New() + exporter, err := New(WithRegisterer(registry)) + require.NoError(t, err) customBucketsView, err := view.New( view.MatchInstrumentName("histogram_*"), @@ -153,10 +155,6 @@ func TestPrometheusExporter(t *testing.T) { provider := metric.NewMeterProvider(metric.WithReader(exporter, customBucketsView, defaultView)) meter := provider.Meter("testmeter") - registry := prometheus.NewRegistry() - err = registry.Register(exporter.Collector) - require.NoError(t, err) - tc.recordMetrics(ctx, meter) file, err := os.Open(tc.expectedFile) From 9d7779a7d76bb97580e83307084df7304ef62bfe Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 14 Oct 2022 19:18:53 -0400 Subject: [PATCH 270/886] [docs] Add API and Examples to Go sidenav (#3280) Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- website_docs/_index.md | 18 +++--------------- website_docs/api.md | 10 ++++++++++ website_docs/examples.md | 9 +++++++++ 3 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 website_docs/api.md create mode 100644 website_docs/examples.md diff --git a/website_docs/_index.md b/website_docs/_index.md index 536a52dd339..dcd70c74d37 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -13,20 +13,8 @@ spelling: cSpell:ignore godoc weight: 16 --- -This is the OpenTelemetry for Go documentation. OpenTelemetry is an observability framework -- an API, SDK, and tools that are designed to aid in the generation and collection of application telemetry data such as metrics, logs, and traces. This documentation is designed to help you understand how to get started using OpenTelemetry for Go. +{{% lang_instrumentation_index_head "go" /%}} -## Status and Releases +## More -The current status of the major functional components for OpenTelemetry Go is as follows: - -| Traces | Metrics | Logs | -| ------- | ------- | ------- | -| Stable | Alpha | Not Yet Implemented | - -{{% latest_release "go" /%}} - -## Further Reading - -- [godoc](https://pkg.go.dev/go.opentelemetry.io/otel) -- [Examples](https://github.com/open-telemetry/opentelemetry-go/tree/main/example) -- [Contrib Repository](https://github.com/open-telemetry/opentelemetry-go-contrib) +- [Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib) diff --git a/website_docs/api.md b/website_docs/api.md new file mode 100644 index 00000000000..a5c5867f8d0 --- /dev/null +++ b/website_docs/api.md @@ -0,0 +1,10 @@ +--- +title: API reference +linkTitle: API +# Note: this is a placeholder page. Attempting to visit this page will +# redirect to the following URL: +manualLink: https://pkg.go.dev/go.opentelemetry.io/otel +manualLinkTarget: _blank +_build: { render: link } +weight: 50 +--- diff --git a/website_docs/examples.md b/website_docs/examples.md new file mode 100644 index 00000000000..51a92b7d799 --- /dev/null +++ b/website_docs/examples.md @@ -0,0 +1,9 @@ +--- +title: Examples +# Note: this is a placeholder page. Attempting to visit this page will +# redirect to the following URL: +manualLink: https://github.com/open-telemetry/opentelemetry-go/tree/main/example +manualLinkTarget: _blank +_build: { render: link } +weight: 60 +--- From 042d938989bfe4960c96328328f1f324bc72bdf3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Oct 2022 06:13:07 -0700 Subject: [PATCH 271/886] Fix HistogramDataPoints transform in otlpmetric (#3293) * Fix HistogramDataPoints transform in otlpmetric Fixes #3284 The transform uses the same reference a histogram datapoint sum value for all transformed metrics. This results in all transformed metrics being exported with the same sum (see #3284). This changes the transform to correctly reference a unique sum for each datapoint. --- CHANGELOG.md | 1 + .../internal/transform/metricdata.go | 3 +- .../internal/transform/metricdata_test.go | 37 +++++++++++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d13296190..baab4d165f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) - Prometheus exporter will now cumulatively sum histogram buckets. (#3281) +- Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) ## [1.11.0/0.32.3] 2022-10-12 diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 70c4f025564..4d6edc90330 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -173,12 +173,13 @@ func Histogram(h metricdata.Histogram) (*mpb.Metric_Histogram, error) { func HistogramDataPoints(dPts []metricdata.HistogramDataPoint) []*mpb.HistogramDataPoint { out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) for _, dPt := range dPts { + sum := dPt.Sum out = append(out, &mpb.HistogramDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), TimeUnixNano: uint64(dPt.Time.UnixNano()), Count: dPt.Count, - Sum: &dPt.Sum, + Sum: &sum, BucketCounts: dPt.BucketCounts, ExplicitBounds: dPt.Bounds, Min: dPt.Min, diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 012aaea52a9..db102b4f2aa 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -51,17 +51,28 @@ var ( Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, }} - min, max, sum = 2.0, 4.0, 90.0 - otelHDP = []metricdata.HistogramDataPoint{{ + minA, maxA, sumA = 2.0, 4.0, 90.0 + minB, maxB, sumB = 4.0, 150.0, 234.0 + otelHDP = []metricdata.HistogramDataPoint{{ Attributes: alice, StartTime: start, Time: end, Count: 30, Bounds: []float64{1, 5}, BucketCounts: []uint64{0, 30, 0}, - Min: &min, - Max: &max, - Sum: sum, + Min: &minA, + Max: &maxA, + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + Sum: sumB, }} pbHDP = []*mpb.HistogramDataPoint{{ @@ -69,11 +80,21 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Count: 30, - Sum: &sum, + Sum: &sumA, ExplicitBounds: []float64{1, 5}, BucketCounts: []uint64{0, 30, 0}, - Min: &min, - Max: &max, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, }} otelHist = metricdata.Histogram{ From a8596fd9e9669d98b052ca8b3e75750750c841eb Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Mon, 17 Oct 2022 12:15:02 -0400 Subject: [PATCH 272/886] Fix dependabot PR workflow (#3347) Signed-off-by: Anthony J Mirabella Signed-off-by: Anthony J Mirabella --- .github/workflows/create-dependabot-pr.yml | 5 +++++ .github/workflows/scripts/dependabot-pr.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 96b81163127..436e06e6aa9 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -7,6 +7,11 @@ jobs: create-pr: runs-on: ubuntu-latest steps: + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + - uses: actions/checkout@v3 - name: Install zsh diff --git a/.github/workflows/scripts/dependabot-pr.sh b/.github/workflows/scripts/dependabot-pr.sh index e85532eb2aa..8d5bf46c1c3 100755 --- a/.github/workflows/scripts/dependabot-pr.sh +++ b/.github/workflows/scripts/dependabot-pr.sh @@ -21,7 +21,7 @@ PR_NAME=dependabot-prs/`date +'%Y-%m-%dT%H%M%S'` git checkout -b $PR_NAME IFS=$'\n' -requests=($(gh pr list --search "author:app/dependabot" --json number,title --template '{{range .}}{{tablerow .title}}{{end}}')) +requests=($( gh pr list --search "author:app/dependabot" --json title --jq '.[].title' )) message="" dirs=(`find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./'`) From 1cbd4c2b7726ded5e7a9a18997cb25977137a0b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 12:25:56 -0400 Subject: [PATCH 273/886] dependabot updates Mon Oct 17 16:17:28 UTC 2022 (#3348) Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /schema Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/zipkin Bump github.com/openzipkin/zipkin-go from 0.4.0 to 0.4.1 in /exporters/zipkin Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/zipkin Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.27.1 to 1.28.1 in /exporters/otlp/otlpmetric Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlptrace Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.42.0 to 1.50.1 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/prometheus Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump go.uber.org/goleak from 1.1.12 to 1.2.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/jaeger Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /trace Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/jaeger Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /metric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /trace Co-authored-by: Aneurysm9 --- bridge/opencensus/go.mod | 4 +- bridge/opencensus/go.sum | 9 +- bridge/opencensus/test/go.sum | 6 +- bridge/opentracing/go.mod | 4 +- bridge/opentracing/go.sum | 12 +- example/fib/go.sum | 8 +- example/jaeger/go.mod | 2 - example/jaeger/go.sum | 14 +- example/namedtracer/go.sum | 8 +- example/opencensus/go.sum | 6 +- example/otel-collector/go.mod | 4 +- example/otel-collector/go.sum | 23 +- example/passthrough/go.sum | 8 +- example/prometheus/go.sum | 6 +- example/view/go.sum | 6 +- example/zipkin/go.mod | 4 +- example/zipkin/go.sum | 217 +---------------- exporters/jaeger/go.mod | 10 +- exporters/jaeger/go.sum | 16 +- exporters/otlp/internal/retry/go.mod | 6 +- exporters/otlp/internal/retry/go.sum | 10 +- exporters/otlp/otlpmetric/go.mod | 12 +- exporters/otlp/otlpmetric/go.sum | 20 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 27 ++- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 12 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 27 ++- exporters/otlp/otlptrace/go.mod | 12 +- exporters/otlp/otlptrace/go.sum | 27 ++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 33 ++- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 25 +- exporters/prometheus/go.mod | 4 +- exporters/prometheus/go.sum | 9 +- exporters/stdout/stdoutmetric/go.mod | 6 +- exporters/stdout/stdoutmetric/go.sum | 12 +- exporters/stdout/stdouttrace/go.mod | 6 +- exporters/stdout/stdouttrace/go.sum | 12 +- exporters/zipkin/go.mod | 10 +- exporters/zipkin/go.sum | 220 +----------------- go.mod | 8 +- go.sum | 14 +- internal/tools/go.mod | 4 +- internal/tools/go.sum | 7 +- metric/go.mod | 6 +- metric/go.sum | 12 +- schema/go.mod | 6 +- schema/go.sum | 10 +- sdk/go.mod | 8 +- sdk/go.sum | 14 +- sdk/metric/go.mod | 6 +- sdk/metric/go.sum | 12 +- trace/go.mod | 8 +- trace/go.sum | 14 +- 55 files changed, 327 insertions(+), 693 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 71eaff1320b..d8561458e78 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.18 require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 @@ -21,7 +21,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 6e7bfe06fbf..1e8937cc420 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -34,7 +34,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -45,9 +45,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -102,7 +104,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index d06593c620d..69316a9a980 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -33,14 +33,14 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -93,7 +93,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 41ede6a7f2f..be50ff19c04 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,13 +6,13 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.7.2 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 2938fe01d78..7c9b2c7f304 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -1,20 +1,24 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/fib/go.sum b/example/fib/go.sum index a0644dac3bc..5f623871eb7 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,12 +1,12 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index e910d4afba8..a2ec6d941bc 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -15,10 +15,8 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/stretchr/objx v0.4.0 // indirect go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 191a4c66483..ce9a79004f8 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -1,21 +1,13 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index a0644dac3bc..5f623871eb7 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,12 +1,12 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index d06593c620d..69316a9a980 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -33,14 +33,14 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -93,7 +93,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index a0ed60601f1..4486848a24c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 - google.golang.org/grpc v1.46.2 + google.golang.org/grpc v1.50.1 ) require ( @@ -28,7 +28,7 @@ require ( golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 4b58624af84..d874d90e638 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -50,17 +50,15 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,7 +110,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -148,7 +146,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -160,7 +158,7 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -222,7 +220,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -264,9 +261,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -396,8 +391,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -411,15 +406,15 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index a0644dac3bc..5f623871eb7 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,12 +1,12 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 45bdb136b1f..42e3a4fae25 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -115,7 +115,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -196,7 +196,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -472,7 +472,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/view/go.sum b/example/view/go.sum index 45bdb136b1f..42e3a4fae25 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -115,7 +115,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -196,7 +196,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -472,7 +472,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 16621bb8e02..03ff8ec67d6 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -18,8 +18,8 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/openzipkin/zipkin-go v0.4.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + github.com/openzipkin/zipkin-go v0.4.1 // indirect + golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index e38a353213f..73746b61094 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -1,217 +1,14 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= -github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw= -github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= +github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 8543d9291d4..f3a6f886fa2 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -3,21 +3,21 @@ module go.opentelemetry.io/otel/exporters/jaeger go 1.18 require ( - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.1.0 // indirect + github.com/stretchr/objx v0.4.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 198345fe9e0..1bf71aafa65 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -1,21 +1,25 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 639de2b6936..43e063e764b 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/cenkalti/backoff/v4 v4.1.3 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index c7e998fc26a..c2fad1cbfbe 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -1,13 +1,17 @@ github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 1af3a516dfe..493fd1a4fb2 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -3,21 +3,21 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric go 1.18 require ( - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.42.0 - google.golang.org/protobuf v1.27.1 + google.golang.org/grpc v1.50.1 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -28,7 +28,7 @@ require ( golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 9d432a59d7c..4cde6cd7628 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -51,8 +51,9 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -110,8 +111,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -146,11 +147,13 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -393,8 +396,9 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -407,16 +411,18 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 45a6a06f4c5..b23a1253814 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,7 +5,7 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 @@ -13,17 +13,17 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.46.2 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.50.1 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.0 // indirect @@ -31,7 +31,7 @@ require ( golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 5ba9f1dd475..4cde6cd7628 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -50,17 +50,16 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,8 +111,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -148,11 +147,13 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -225,7 +226,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,9 +267,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -399,8 +397,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -414,16 +412,17 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index f4e970586c7..2d70e68c60e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,23 +5,23 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 go.opentelemetry.io/otel/metric v0.32.3 go.opentelemetry.io/otel/sdk/metric v0.32.3 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.28.0 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.0 // indirect @@ -30,8 +30,8 @@ require ( golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.46.2 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + google.golang.org/grpc v1.50.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 5ba9f1dd475..4cde6cd7628 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -50,17 +50,16 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,8 +111,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -148,11 +147,13 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -225,7 +226,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,9 +267,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -399,8 +397,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -414,16 +412,17 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index fc224d231a3..51c34b1457a 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,20 +3,20 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.18 require ( - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.46.2 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.50.1 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -26,7 +26,7 @@ require ( golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 5ba9f1dd475..4cde6cd7628 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -50,17 +50,16 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,8 +111,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -148,11 +147,13 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -225,7 +226,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -267,9 +267,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -399,8 +397,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -414,16 +412,17 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7b3285e09c5..ed498f075d0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,21 +3,21 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.18 require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 - go.uber.org/goleak v1.1.12 + go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.46.2 - google.golang.org/protobuf v1.28.0 + google.golang.org/grpc v1.50.1 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -27,7 +27,7 @@ require ( golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../../../.. diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 6c9ac94b89b..dcf954aa463 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -50,17 +50,16 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,7 +111,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -147,15 +146,16 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -164,8 +164,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= -go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -202,7 +202,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -229,7 +228,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -246,7 +244,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -272,9 +269,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -331,7 +326,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -406,8 +400,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -421,16 +415,17 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index c2f5713cc4d..a590c54de05 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,19 +3,19 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.18 require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.28.0 + google.golang.org/protobuf v1.28.1 ) require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -25,8 +25,8 @@ require ( golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.46.2 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + google.golang.org/grpc v1.50.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 7a8d500d19c..53fc3ea2e74 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -50,17 +50,16 @@ github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XP github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -112,7 +111,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -147,11 +146,13 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -224,7 +225,6 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -266,9 +266,7 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= @@ -398,8 +396,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -413,16 +411,17 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 8ced7d32207..47c71ce24d3 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 go.opentelemetry.io/otel/sdk/metric v0.32.3 @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 80517ac594b..03a59e064e4 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -115,7 +115,7 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -195,11 +195,13 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -476,8 +478,9 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index a4d67c367d0..4f993ef55f4 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric go 1.18 require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 go.opentelemetry.io/otel/sdk v1.11.0 @@ -11,13 +11,13 @@ require ( ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 46f26da7b9e..a3ac11a377c 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,19 +1,23 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index d4a747d1159..539a5b5bd9b 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,19 +8,19 @@ replace ( ) require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 46f26da7b9e..a3ac11a377c 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,19 +1,23 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 0ac0806456c..753600b614c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,9 +3,9 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.18 require ( - github.com/google/go-cmp v0.5.8 - github.com/openzipkin/zipkin-go v0.4.0 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/openzipkin/zipkin-go v0.4.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 @@ -16,8 +16,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 6ba32527639..b047284b72b 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -1,222 +1,26 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= -github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= -github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= -github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/openzipkin/zipkin-go v0.4.0 h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw= -github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= +github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= -github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go.mod b/go.mod index 04536dc7288..853b57824c3 100644 --- a/go.mod +++ b/go.mod @@ -5,15 +5,15 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel/trace v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ./trace diff --git a/go.sum b/go.sum index f6a0b224951..434a9b5ba63 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,22 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 8f5ff68ea1b..542f073fd5d 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -77,7 +77,7 @@ require ( github.com/golangci/misspell v0.3.5 // indirect github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect @@ -186,7 +186,7 @@ require ( golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 0c7c6ee429d..8065f94b6a0 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -308,8 +308,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -1227,8 +1228,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/metric/go.mod b/metric/go.mod index ed48167bf2c..5b61f452d16 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -3,17 +3,17 @@ module go.opentelemetry.io/otel/metric go 1.18 require ( - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../ diff --git a/metric/go.sum b/metric/go.sum index f62b5a35247..8e553d1b103 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,17 +1,21 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/schema/go.mod b/schema/go.mod index f6a0fb338bc..2c27161702f 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,12 +4,12 @@ go 1.18 require ( github.com/Masterminds/semver/v3 v3.1.1 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 gopkg.in/yaml.v2 v2.4.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/schema/go.sum b/schema/go.sum index 05b233a6568..d1dba122e56 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -1,15 +1,19 @@ github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/go.mod b/sdk/go.mod index f4bb4b3a739..fdb8ddf489e 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -6,18 +6,18 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.3 - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/trace v1.11.0 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../trace diff --git a/sdk/go.sum b/sdk/go.sum index a7edc879c2b..b42b5132f09 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,20 +1,24 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index db068f1c206..953ae5cc099 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,19 +4,19 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 - github.com/stretchr/testify v1.7.1 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 go.opentelemetry.io/otel/sdk v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 46f26da7b9e..a3ac11a377c 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -1,19 +1,23 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/trace/go.mod b/trace/go.mod index d90f7a4055a..ca13832eda8 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -5,13 +5,13 @@ go 1.18 replace go.opentelemetry.io/otel => ../ require ( - github.com/google/go-cmp v0.5.8 - github.com/stretchr/testify v1.7.1 + github.com/google/go-cmp v0.5.9 + github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 ) require ( - github.com/davecgh/go-spew v1.1.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.sum b/trace/go.sum index 587f0fcef84..5e92189882c 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,13 +1,17 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 0963f5995523e787134c50152b9234d103d52172 Mon Sep 17 00:00:00 2001 From: ReStartercc Date: Wed, 19 Oct 2022 03:45:04 +0800 Subject: [PATCH 274/886] Fix baggage.NewMember to decode the accepted value (#3226) * Fix baggage.NewMember to decode the accepted value `value` is decoded and stored after validating the input parameters. Corresponding test cases are modified so that we can make sure `value` is properly encoded before creating Member. * fix md lint * add function document to NewMember for value encoding and decoding * remove redundant comments and fix CHANGELOG.md * fix wrong PR number in the changelog * fix wrong PR number * fix md-lint Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + baggage/baggage.go | 16 +++++++++++----- baggage/baggage_test.go | 28 ++++++++++++++++++++++++++++ propagation/baggage_test.go | 4 ++-- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baab4d165f4..c7d998065a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed +- Fix function `baggage.NewMember` to decode the `value` parameter instead of directly use it according to the W3C specification. (#3226) - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) - Prometheus exporter will now cumulatively sum histogram buckets. (#3281) - Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) diff --git a/baggage/baggage.go b/baggage/baggage.go index 9869fa84304..a36db8f8d85 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -250,8 +250,9 @@ type Member struct { hasData bool } -// NewMember returns a new Member from the passed arguments. An error is -// returned if the created Member would be invalid according to the W3C +// NewMember returns a new Member from the passed arguments. The key will be +// used directly while the value will be url decoded after validation. An error +// is returned if the created Member would be invalid according to the W3C // Baggage specification. func NewMember(key, value string, props ...Property) (Member, error) { m := Member{ @@ -263,7 +264,11 @@ func NewMember(key, value string, props ...Property) (Member, error) { if err := m.validate(); err != nil { return newInvalidMember(), err } - + decodedValue, err := url.QueryUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + m.value = decodedValue return m, nil } @@ -328,8 +333,9 @@ func parseMember(member string) (Member, error) { return Member{key: key, value: value, properties: props, hasData: true}, nil } -// validate ensures m conforms to the W3C Baggage specification, returning an -// error otherwise. +// validate ensures m conforms to the W3C Baggage specification. +// A key is just an ASCII string, but a value must be URL encoded UTF-8, +// returning an error otherwise. func (m Member) validate() error { if !m.hasData { return fmt.Errorf("%w: %q", errInvalidMember, m) diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 77b219e8599..46cf7b90ac7 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -768,6 +768,23 @@ func TestNewMember(t *testing.T) { } assert.Equal(t, expected, m) + // wrong value with wrong decoding + val = "%zzzzz" + _, err = NewMember(key, val, p) + assert.ErrorIs(t, err, errInvalidValue) + + // value should be decoded + val = "%3B" + m, err = NewMember(key, val, p) + expected = Member{ + key: key, + value: ";", + properties: properties{{key: "foo", hasData: true}}, + hasData: true, + } + assert.NoError(t, err) + assert.Equal(t, expected, m) + // Ensure new member is immutable. p.key = "bar" assert.Equal(t, expected, m) @@ -784,6 +801,17 @@ func TestPropertiesValidate(t *testing.T) { assert.NoError(t, p.validate()) } +func TestMemberString(t *testing.T) { + // normal key value pair + member, _ := NewMember("key", "value") + memberStr := member.String() + assert.Equal(t, memberStr, "key=value") + // encoded key + member, _ = NewMember("key", "%3B") + memberStr = member.String() + assert.Equal(t, memberStr, "key=%3B") +} + var benchBaggage Baggage func BenchmarkNew(b *testing.B) { diff --git a/propagation/baggage_test.go b/propagation/baggage_test.go index e98230a94ea..359b899f7e4 100644 --- a/propagation/baggage_test.go +++ b/propagation/baggage_test.go @@ -17,6 +17,7 @@ package propagation_test import ( "context" "net/http" + "net/url" "strings" "testing" @@ -46,8 +47,7 @@ func (m member) Member(t *testing.T) baggage.Member { } props = append(props, p) } - - bMember, err := baggage.NewMember(m.Key, m.Value, props...) + bMember, err := baggage.NewMember(m.Key, url.QueryEscape(m.Value), props...) if err != nil { t.Fatal(err) } From 8b25cb2a85cc69cd6ee3e017c74201cbe11c9917 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:02:46 -0500 Subject: [PATCH 275/886] Removes the functionality of the Describe in prometheus exporter. (#3342) * remove prom exporter Describe * Apply suggestions from code review Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 2 ++ exporters/prometheus/exporter.go | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d998065a2..e81ccaf4f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) - The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) +- The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup. + This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) ### Fixed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 007dc2f50d9..e14fa3638c6 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -69,13 +69,11 @@ func New(opts ...Option) (*Exporter, error) { // Describe implements prometheus.Collector. func (c *collector) Describe(ch chan<- *prometheus.Desc) { - metrics, err := c.reader.Collect(context.TODO()) - if err != nil { - otel.Handle(err) - } - for _, metricData := range getMetricData(metrics) { - ch <- metricData.description - } + // The Opentelemetry SDK doesn't have information on which will exist when the collector + // is registered. By returning nothing we are an "unchecked" collector in Prometheus, + // and assume responsibility for consistency of the metrics produced. + // + // See https://pkg.go.dev/github.com/prometheus/client_golang@v1.13.0/prometheus#hdr-Custom_Collectors_and_constant_Metrics } // Collect implements prometheus.Collector. From 99153429d52e6733e08c2273348a02b48cbe230a Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:07:24 -0500 Subject: [PATCH 276/886] Added WithAggregationSelector to prometheus (#3341) * Added WithAggregationSelector to prometheus * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Address PR comments Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/prometheus/confg_test.go | 59 ++++++++++++++++++++++++++++-- exporters/prometheus/config.go | 23 +++++++++++- exporters/prometheus/exporter.go | 2 +- 4 files changed, 79 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e81ccaf4f46..34be9d346ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Prometheus exporter will register with a prometheus registerer on creation, there are options to control this. (#3239) +- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the `AggregationSelector` used. (#3341) ### Changed diff --git a/exporters/prometheus/confg_test.go b/exporters/prometheus/confg_test.go index 91893d40f3a..52bccff2587 100644 --- a/exporters/prometheus/confg_test.go +++ b/exporters/prometheus/confg_test.go @@ -19,22 +19,28 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/view" ) func TestNewConfig(t *testing.T) { registry := prometheus.NewRegistry() + aggregationSelector := func(view.InstrumentKind) aggregation.Aggregation { return nil } + testCases := []struct { - name string - options []Option - wantRegisterer prometheus.Registerer + name string + options []Option + wantRegisterer prometheus.Registerer + wantAggregation metric.AggregationSelector }{ { name: "Default", options: nil, wantRegisterer: prometheus.DefaultRegisterer, }, - { name: "WithRegisterer", options: []Option{ @@ -42,6 +48,23 @@ func TestNewConfig(t *testing.T) { }, wantRegisterer: registry, }, + { + name: "WithAggregationSelector", + options: []Option{ + WithAggregationSelector(aggregationSelector), + }, + wantRegisterer: prometheus.DefaultRegisterer, + wantAggregation: aggregationSelector, + }, + { + name: "With Multiple Options", + options: []Option{ + WithRegisterer(registry), + WithAggregationSelector(aggregationSelector), + }, + wantRegisterer: registry, + wantAggregation: aggregationSelector, + }, { name: "nil options do nothing", options: []Option{ @@ -58,3 +81,31 @@ func TestNewConfig(t *testing.T) { }) } } + +func TestConfigManualReaderOptions(t *testing.T) { + aggregationSelector := func(view.InstrumentKind) aggregation.Aggregation { return nil } + + testCases := []struct { + name string + config config + wantOptionCount int + }{ + { + name: "Default", + config: config{}, + wantOptionCount: 0, + }, + + { + name: "WithAggregationSelector", + config: config{aggregation: aggregationSelector}, + wantOptionCount: 1, + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + opts := tt.config.manualReaderOptions() + assert.Len(t, opts, tt.wantOptionCount) + }) + } +} diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index 6ee84732556..e70dade501d 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -16,11 +16,14 @@ package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( "github.com/prometheus/client_golang/prometheus" + + "go.opentelemetry.io/otel/sdk/metric" ) // config contains options for the exporter. type config struct { - registerer prometheus.Registerer + registerer prometheus.Registerer + aggregation metric.AggregationSelector } // newConfig creates a validated config configured with options. @@ -37,6 +40,14 @@ func newConfig(opts ...Option) config { return cfg } +func (cfg config) manualReaderOptions() []metric.ManualReaderOption { + opts := []metric.ManualReaderOption{} + if cfg.aggregation != nil { + opts = append(opts, metric.WithAggregationSelector(cfg.aggregation)) + } + return opts +} + // Option sets exporter option values. type Option interface { apply(config) config @@ -57,3 +68,13 @@ func WithRegisterer(reg prometheus.Registerer) Option { return cfg }) } + +// WithAggregationSelector configure the Aggregation Selector the exporter will +// use. If no AggregationSelector is provided the DefaultAggregationSelector is +// used. +func WithAggregationSelector(agg metric.AggregationSelector) Option { + return optionFunc(func(cfg config) config { + cfg.aggregation = agg + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index e14fa3638c6..01c555970cc 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -50,7 +50,7 @@ func New(opts ...Option) (*Exporter, error) { // this assumes that the default temporality selector will always return cumulative. // we only support cumulative temporality, so building our own reader enforces this. // TODO (#3244): Enable some way to configure the reader, but not change temporality. - reader := metric.NewManualReader() + reader := metric.NewManualReader(cfg.manualReaderOptions()...) collector := &collector{ reader: reader, From 6605ae8c36f81f86080994b14c5ca55cd65667ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:22:07 -0700 Subject: [PATCH 277/886] Bump benchmark-action/github-action-benchmark from 1.13.0 to 1.14.0 (#3299) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.13.0 to 1.14.0. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.13.0...v1.14.0) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a9647ded720..9ff05595ef0 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,7 +22,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.13.0 + uses: benchmark-action/github-action-benchmark@v1.14.0 with: name: Benchmarks tool: 'go' From a1c25367b0a84dd98db7083f34bf0b77041a4a21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:41:57 -0700 Subject: [PATCH 278/886] Bump codecov/codecov-action from 3.1.0 to 3.1.1 (#3300) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.0...v3.1.1) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81a31e32a3a..0b4ba881df5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v3.1.0 + uses: codecov/codecov-action@v3.1.1 with: file: ./coverage.txt fail_ci_if_error: true From 537660edbbed39f7cc88262c7f0ef24d8ed428e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:48:45 -0700 Subject: [PATCH 279/886] Bump lycheeverse/lychee-action from 1.4.1 to 1.5.1 (#3301) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.4.1 to 1.5.1. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.4.1...v1.5.1) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 86847617c84..0a5bf1921d7 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.4.1 + uses: lycheeverse/lychee-action@v1.5.1 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index d0cffdc0d5c..98747e55efc 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.4.1 + uses: lycheeverse/lychee-action@v1.5.1 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From ad45631b53faa74191fcee37c8f010e520af67e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:54:09 -0700 Subject: [PATCH 280/886] Bump github.com/itchyny/gojq from 0.12.7 to 0.12.9 in /internal/tools (#3303) Bumps [github.com/itchyny/gojq](https://github.com/itchyny/gojq) from 0.12.7 to 0.12.9. - [Release notes](https://github.com/itchyny/gojq/releases) - [Changelog](https://github.com/itchyny/gojq/blob/main/CHANGELOG.md) - [Commits](https://github.com/itchyny/gojq/compare/v0.12.7...v0.12.9) --- updated-dependencies: - dependency-name: github.com/itchyny/gojq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 11 ++++++----- internal/tools/go.sum | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 542f073fd5d..4a22b7b810c 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.48.0 - github.com/itchyny/gojq v0.12.7 + github.com/itchyny/gojq v0.12.9 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c @@ -90,7 +90,7 @@ require ( github.com/hexops/gotextdiff v1.0.3 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/itchyny/timefmt-go v0.1.3 // indirect + github.com/itchyny/timefmt-go v0.1.4 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jgautheron/goconst v1.5.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect @@ -110,8 +110,8 @@ require ( github.com/maratori/testpackage v1.1.0 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.2.1 // indirect @@ -138,6 +138,7 @@ require ( github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/ryancurrah/gomodguard v1.2.4 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect @@ -184,7 +185,7 @@ require ( golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect + golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.66.6 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 8065f94b6a0..207a09c1ed9 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -391,10 +391,10 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ= -github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw= -github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= -github.com/itchyny/timefmt-go v0.1.3/go.mod h1:0osSSCQSASBJMsIZnhAaF1C2fCBTJZXrnj37mG8/c+A= +github.com/itchyny/gojq v0.12.9 h1:biKpbKwMxVYhCU1d6mR7qMr3f0Hn9F5k5YykCVb3gmM= +github.com/itchyny/gojq v0.12.9/go.mod h1:T4Ip7AETUXeGpD+436m+UEl3m3tokRgajd5pRfsR5oE= +github.com/itchyny/timefmt-go v0.1.4 h1:hFEfWVdwsEi+CY8xY2FtgWHGQaBaC3JeHd+cve0ynVM= +github.com/itchyny/timefmt-go v0.1.4/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcchavezs/porto v0.4.0 h1:Zj7RligrxmDdKGo6fBO2xYAHxEgrVBfs1YAja20WbV4= @@ -489,13 +489,15 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -624,6 +626,8 @@ github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1003,14 +1007,14 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY= +golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= From 6c0a7c4dc8b4f11e708e1adf8177337c7be7033f Mon Sep 17 00:00:00 2001 From: Tony_F Date: Wed, 19 Oct 2022 11:55:59 -0400 Subject: [PATCH 281/886] Fix getting-started.md with the correct import packages in main.go (#3354) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix getting-started.md with the correct import packages in main.go * Update CHANGELOG.md Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- website_docs/getting-started.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index e1eb4457fec..79307c7224a 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -280,9 +280,12 @@ import ( "io" "log" "os" + "os/signal" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) From 430f55878bbc9cb11fd4739636bd040501a94ed0 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 19 Oct 2022 12:07:53 -0400 Subject: [PATCH 282/886] Convert UpDownCounters to Prometheus gauges (#3358) * updown counters are now converted to prometheus gauges * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 6 +++++- exporters/prometheus/testdata/gauge.txt | 2 +- exporters/prometheus/testdata/sanitized_names.txt | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34be9d346ae..4656e968b4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) - Prometheus exporter will now cumulatively sum histogram buckets. (#3281) - Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- UpDownCounters are now correctly output as prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) ## [1.11.0/0.32.3] 2022-10-12 diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 01c555970cc..d7db199955f 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -168,6 +168,10 @@ func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics } func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Metrics) []*metricData { + valueType := prometheus.CounterValue + if !sum.IsMonotonic { + valueType = prometheus.GaugeValue + } dataPoints := make([]*metricData, 0, len(sum.DataPoints)) for _, dp := range sum.DataPoints { keys, values := getAttrs(dp.Attributes) @@ -176,7 +180,7 @@ func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Met name: m.Name, description: desc, attributeValues: values, - valueType: prometheus.CounterValue, + valueType: valueType, value: float64(dp.Value), } dataPoints = append(dataPoints, md) diff --git a/exporters/prometheus/testdata/gauge.txt b/exporters/prometheus/testdata/gauge.txt index 889295d74e1..d9db4dc0911 100644 --- a/exporters/prometheus/testdata/gauge.txt +++ b/exporters/prometheus/testdata/gauge.txt @@ -1,3 +1,3 @@ # HELP bar a fun little gauge -# TYPE bar counter +# TYPE bar gauge bar{A="B",C="D"} 75 diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index 509055705a3..7516a771819 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -1,11 +1,11 @@ # HELP bar a fun little gauge -# TYPE bar counter +# TYPE bar gauge bar{A="B",C="D"} 75 # HELP _0invalid_counter_name a counter with an invalid name # TYPE _0invalid_counter_name counter _0invalid_counter_name{A="B",C="D"} 100 # HELP invalid_gauge_name a gauge with an invalid name -# TYPE invalid_gauge_name counter +# TYPE invalid_gauge_name gauge invalid_gauge_name{A="B",C="D"} 100 # HELP invalid_hist_name a histogram with an invalid name # TYPE invalid_hist_name histogram From 05aca23c1941775d1db7fc89243b2c30c970e0a4 Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Wed, 19 Oct 2022 12:13:20 -0400 Subject: [PATCH 283/886] Decode values from OTEL_RESOURCE_ATTRIBUTES (#2963) * Decode values from OTEL_RESOURCE_ATTRIBUTES The W3C spec specifies that values must be percent-encoded so when reading the environment variable `OTEL_RESOURCE_ATTRIBUTES` the SDK should decode them. This is done by the `baggage` package, but its behaviour in case of errors is slightly different from the current implementation of the SDK, more specifically in cases where a key is missing a value. The SDK returns a partial resource while the `bagage` package returns nil. This may be considered a breaking change, so this commit fixes the current implementation instead of using `baggage.Parse`. * Add changelog entry for #2963 * Use otel.Handle on OTEL_RESOURCE_ATTRIBUTES decode error * retain original value when decoding fails * docs: update CHANGELOG Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/resource/env.go | 11 ++++++++++- sdk/resource/env_test.go | 22 +++++++++++++++++++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4656e968b4a..e1da6302645 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Decode urlencoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable. (#2963) - `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) - The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) - The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup. diff --git a/sdk/resource/env.go b/sdk/resource/env.go index eb22d007922..1c349247b0a 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -17,9 +17,11 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "fmt" + "net/url" "os" "strings" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) @@ -88,7 +90,14 @@ func constructOTResources(s string) (*Resource, error) { invalid = append(invalid, p) continue } - k, v := strings.TrimSpace(field[0]), strings.TrimSpace(field[1]) + k := strings.TrimSpace(field[0]) + v, err := url.QueryUnescape(strings.TrimSpace(field[1])) + if err != nil { + // Retain original value if decoding fails, otherwise it will be + // an empty string. + v = field[1] + otel.Handle(err) + } attrs = append(attrs, attribute.String(k, v)) } var err error diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index c50a0031c9b..62de6729e0a 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -43,7 +43,7 @@ func TestDetectOnePair(t *testing.T) { func TestDetectMultiPairs(t *testing.T) { store, err := ottest.SetEnvVariables(map[string]string{ "x": "1", - resourceAttrKey: "key=value, k = v , a= x, a=z", + resourceAttrKey: "key=value, k = v , a= x, a=z, b=c%2Fd", }) require.NoError(t, err) defer func() { require.NoError(t, store.Restore()) }() @@ -51,12 +51,13 @@ func TestDetectMultiPairs(t *testing.T) { detector := &fromEnv{} res, err := detector.Detect(context.Background()) require.NoError(t, err) - assert.Equal(t, res, NewSchemaless( + assert.Equal(t, NewSchemaless( attribute.String("key", "value"), attribute.String("k", "v"), attribute.String("a", "x"), attribute.String("a", "z"), - )) + attribute.String("b", "c/d"), + ), res) } func TestEmpty(t *testing.T) { @@ -102,6 +103,21 @@ func TestMissingKeyError(t *testing.T) { )) } +func TestInvalidPercentDecoding(t *testing.T) { + store, err := ottest.SetEnvVariables(map[string]string{ + resourceAttrKey: "key=%invalid", + }) + require.NoError(t, err) + defer func() { require.NoError(t, store.Restore()) }() + + detector := &fromEnv{} + res, err := detector.Detect(context.Background()) + assert.NoError(t, err) + assert.Equal(t, NewSchemaless( + attribute.String("key", "%invalid"), + ), res) +} + func TestDetectServiceNameFromEnv(t *testing.T) { store, err := ottest.SetEnvVariables(map[string]string{ resourceAttrKey: "key=value,service.name=foo", From 2d02a2f1261f57fb079136545085e080b63a9582 Mon Sep 17 00:00:00 2001 From: Gustavo Paiva Date: Wed, 19 Oct 2022 13:22:46 -0300 Subject: [PATCH 284/886] converts `Resource` into a `target_info` metric on the prometheus exporter (#3285) * converts `Resource` into a `target_info` metric on the prometheus exporter --- CHANGELOG.md | 1 + exporters/prometheus/confg_test.go | 50 +++++++--- exporters/prometheus/config.go | 15 ++- exporters/prometheus/exporter.go | 50 +++++++++- exporters/prometheus/exporter_test.go | 98 ++++++++++++++++++- exporters/prometheus/go.mod | 2 +- exporters/prometheus/testdata/counter.txt | 3 + .../prometheus/testdata/custom_resource.txt | 6 ++ .../prometheus/testdata/empty_resource.txt | 6 ++ exporters/prometheus/testdata/gauge.txt | 3 + exporters/prometheus/testdata/histogram.txt | 3 + .../prometheus/testdata/sanitized_labels.txt | 3 + .../prometheus/testdata/sanitized_names.txt | 3 + .../testdata/without_target_info.txt | 3 + 14 files changed, 218 insertions(+), 28 deletions(-) create mode 100755 exporters/prometheus/testdata/custom_resource.txt create mode 100755 exporters/prometheus/testdata/empty_resource.txt create mode 100755 exporters/prometheus/testdata/without_target_info.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e1da6302645..3b5050e59f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Prometheus exporter will register with a prometheus registerer on creation, there are options to control this. (#3239) - Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the `AggregationSelector` used. (#3341) +- Prometheus exporter will convert metrics `Resource` into a `target_info` metric. (#3285) ### Changed diff --git a/exporters/prometheus/confg_test.go b/exporters/prometheus/confg_test.go index 52bccff2587..84b55f0221b 100644 --- a/exporters/prometheus/confg_test.go +++ b/exporters/prometheus/confg_test.go @@ -20,7 +20,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/view" ) @@ -31,30 +30,34 @@ func TestNewConfig(t *testing.T) { aggregationSelector := func(view.InstrumentKind) aggregation.Aggregation { return nil } testCases := []struct { - name string - options []Option - wantRegisterer prometheus.Registerer - wantAggregation metric.AggregationSelector + name string + options []Option + wantConfig config }{ { - name: "Default", - options: nil, - wantRegisterer: prometheus.DefaultRegisterer, + name: "Default", + options: nil, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + }, }, { name: "WithRegisterer", options: []Option{ WithRegisterer(registry), }, - wantRegisterer: registry, + wantConfig: config{ + registerer: registry, + }, }, { name: "WithAggregationSelector", options: []Option{ WithAggregationSelector(aggregationSelector), }, - wantRegisterer: prometheus.DefaultRegisterer, - wantAggregation: aggregationSelector, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + }, }, { name: "With Multiple Options", @@ -62,22 +65,39 @@ func TestNewConfig(t *testing.T) { WithRegisterer(registry), WithAggregationSelector(aggregationSelector), }, - wantRegisterer: registry, - wantAggregation: aggregationSelector, + + wantConfig: config{ + registerer: registry, + }, }, { name: "nil options do nothing", options: []Option{ WithRegisterer(nil), }, - wantRegisterer: prometheus.DefaultRegisterer, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + }, + }, + { + name: "without target_info metric", + options: []Option{ + WithoutTargetInfo(), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + disableTargetInfo: true, + }, }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { cfg := newConfig(tt.options...) - assert.Equal(t, tt.wantRegisterer, cfg.registerer) + // tested by TestConfigManualReaderOptions + cfg.aggregation = nil + + assert.Equal(t, tt.wantConfig, cfg) }) } } diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index e70dade501d..3079278da33 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -22,8 +22,9 @@ import ( // config contains options for the exporter. type config struct { - registerer prometheus.Registerer - aggregation metric.AggregationSelector + registerer prometheus.Registerer + disableTargetInfo bool + aggregation metric.AggregationSelector } // newConfig creates a validated config configured with options. @@ -78,3 +79,13 @@ func WithAggregationSelector(agg metric.AggregationSelector) Option { return cfg }) } + +// WithoutTargetInfo configures the Exporter to not export the resource target_info metric. +// If not specified, the Exporter will create a target_info metric containing +// the metrics' resource.Resource attributes. +func WithoutTargetInfo() Option { + return optionFunc(func(cfg config) config { + cfg.disableTargetInfo = true + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index d7db199955f..b2c6778af95 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -19,6 +19,7 @@ import ( "fmt" "sort" "strings" + "sync" "unicode" "unicode/utf8" @@ -28,6 +29,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/resource" +) + +const ( + targetInfoMetricName = "target_info" + targetInfoDescription = "Target metadata" ) // Exporter is a Prometheus Exporter that embeds the OTel metric.Reader @@ -41,6 +48,10 @@ var _ metric.Reader = &Exporter{} // collector is used to implement prometheus.Collector. type collector struct { reader metric.Reader + + disableTargetInfo bool + targetInfo *metricData + createTargetInfoOnce sync.Once } // New returns a Prometheus Exporter. @@ -53,7 +64,8 @@ func New(opts ...Option) (*Exporter, error) { reader := metric.NewManualReader(cfg.manualReaderOptions()...) collector := &collector{ - reader: reader, + reader: reader, + disableTargetInfo: cfg.disableTargetInfo, } if err := cfg.registerer.Register(collector); err != nil { @@ -81,11 +93,12 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { metrics, err := c.reader.Collect(context.TODO()) if err != nil { otel.Handle(err) + if err == metric.ErrReaderNotRegistered { + return + } } - // TODO(#3166): convert otel resource to target_info - // see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#resource-attributes-1 - for _, metricData := range getMetricData(metrics) { + for _, metricData := range c.getMetricData(metrics) { if metricData.valueType == prometheus.UntypedValue { m, err := prometheus.NewConstHistogram(metricData.description, metricData.histogramCount, metricData.histogramSum, metricData.histogramBuckets, metricData.attributeValues...) if err != nil { @@ -118,8 +131,18 @@ type metricData struct { histogramBuckets map[float64]uint64 } -func getMetricData(metrics metricdata.ResourceMetrics) []*metricData { +func (c *collector) getMetricData(metrics metricdata.ResourceMetrics) []*metricData { allMetrics := make([]*metricData, 0) + + c.createTargetInfoOnce.Do(func() { + // Resource should be immutable, we don't need to compute again + c.targetInfo = c.createInfoMetricData(targetInfoMetricName, targetInfoDescription, metrics.Resource) + }) + + if c.targetInfo != nil { + allMetrics = append(allMetrics, c.targetInfo) + } + for _, scopeMetrics := range metrics.ScopeMetrics { for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { @@ -234,6 +257,23 @@ func getAttrs(attrs attribute.Set) ([]string, []string) { return keys, values } +func (c *collector) createInfoMetricData(name, description string, res *resource.Resource) *metricData { + if c.disableTargetInfo { + return nil + } + + keys, values := getAttrs(*res.Set()) + + desc := prometheus.NewDesc(name, description, keys, nil) + return &metricData{ + name: name, + description: desc, + attributeValues: values, + valueType: prometheus.GaugeValue, + value: float64(1), + } +} + func sanitizeRune(r rune) rune { if unicode.IsLetter(r) || unicode.IsDigit(r) || r == ':' || r == '_' { return r diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 5a1a65ce58d..4c8594038fc 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -29,13 +29,18 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/view" + "go.opentelemetry.io/otel/sdk/resource" + semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) func TestPrometheusExporter(t *testing.T) { testCases := []struct { - name string - recordMetrics func(ctx context.Context, meter otelmetric.Meter) - expectedFile string + name string + emptyResource bool + customResouceAttrs []attribute.KeyValue + recordMetrics func(ctx context.Context, meter otelmetric.Meter) + withoutTargetInfo bool + expectedFile string }{ { name: "counter", @@ -132,6 +137,63 @@ func TestPrometheusExporter(t *testing.T) { histogram.Record(ctx, 23, attrs...) }, }, + { + name: "empty resource", + emptyResource: true, + expectedFile: "testdata/empty_resource.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + } + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, + { + name: "custom resource", + customResouceAttrs: []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + }, + expectedFile: "testdata/custom_resource.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + } + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, + { + name: "without target_info", + withoutTargetInfo: true, + expectedFile: "testdata/without_target_info.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + } + counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, } for _, tc := range testCases { @@ -139,7 +201,12 @@ func TestPrometheusExporter(t *testing.T) { ctx := context.Background() registry := prometheus.NewRegistry() - exporter, err := New(WithRegisterer(registry)) + opts := []Option{WithRegisterer(registry)} + if tc.withoutTargetInfo { + opts = append(opts, WithoutTargetInfo()) + } + + exporter, err := New(opts...) require.NoError(t, err) customBucketsView, err := view.New( @@ -152,7 +219,28 @@ func TestPrometheusExporter(t *testing.T) { defaultView, err := view.New(view.MatchInstrumentName("*")) require.NoError(t, err) - provider := metric.NewMeterProvider(metric.WithReader(exporter, customBucketsView, defaultView)) + var res *resource.Resource + + if tc.emptyResource { + res = resource.Empty() + } else { + res, err = resource.New(ctx, + // always specify service.name because the default depends on the running OS + resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), + // Overwrite the semconv.TelemetrySDKVersionKey value so we don't need to update every version + resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + resource.WithAttributes(tc.customResouceAttrs...), + ) + require.NoError(t, err) + + res, err = resource.Merge(resource.Default(), res) + require.NoError(t, err) + } + + provider := metric.NewMeterProvider( + metric.WithResource(res), + metric.WithReader(exporter, customBucketsView, defaultView), + ) meter := provider.Meter("testmeter") tc.recordMetrics(ctx, meter) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 47c71ce24d3..c0935ba262a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -7,6 +7,7 @@ require ( github.com/stretchr/testify v1.8.0 go.opentelemetry.io/otel v1.11.0 go.opentelemetry.io/otel/metric v0.32.3 + go.opentelemetry.io/otel/sdk v1.11.0 go.opentelemetry.io/otel/sdk/metric v0.32.3 ) @@ -22,7 +23,6 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.0 // indirect go.opentelemetry.io/otel/trace v1.11.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 93776d2372b..1165eb67cd6 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,3 +1,6 @@ # HELP foo a simple counter # TYPE foo counter foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/custom_resource.txt b/exporters/prometheus/testdata/custom_resource.txt new file mode 100755 index 00000000000..4a394fe9fec --- /dev/null +++ b/exporters/prometheus/testdata/custom_resource.txt @@ -0,0 +1,6 @@ +# HELP foo a simple counter +# TYPE foo counter +foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{A="B",C="D",service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/empty_resource.txt b/exporters/prometheus/testdata/empty_resource.txt new file mode 100755 index 00000000000..ed9d29f3312 --- /dev/null +++ b/exporters/prometheus/testdata/empty_resource.txt @@ -0,0 +1,6 @@ +# HELP foo a simple counter +# TYPE foo counter +foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info 1 diff --git a/exporters/prometheus/testdata/gauge.txt b/exporters/prometheus/testdata/gauge.txt index d9db4dc0911..f13629508ab 100644 --- a/exporters/prometheus/testdata/gauge.txt +++ b/exporters/prometheus/testdata/gauge.txt @@ -1,3 +1,6 @@ # HELP bar a fun little gauge # TYPE bar gauge bar{A="B",C="D"} 75 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt index 95f202154a4..495aa6f5160 100644 --- a/exporters/prometheus/testdata/histogram.txt +++ b/exporters/prometheus/testdata/histogram.txt @@ -13,3 +13,6 @@ histogram_baz_bucket{A="B",C="D",le="1000"} 4 histogram_baz_bucket{A="B",C="D",le="+Inf"} 4 histogram_baz_sum{A="B",C="D"} 236 histogram_baz_count{A="B",C="D"} 4 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/sanitized_labels.txt b/exporters/prometheus/testdata/sanitized_labels.txt index cd686cff97e..176d437e000 100755 --- a/exporters/prometheus/testdata/sanitized_labels.txt +++ b/exporters/prometheus/testdata/sanitized_labels.txt @@ -1,3 +1,6 @@ # HELP foo a sanitary counter # TYPE foo counter foo{A_B="Q",C_D="Y;Z"} 24.3 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index 7516a771819..a599ea26851 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -27,3 +27,6 @@ invalid_hist_name_bucket{A="B",C="D",le="10000"} 1 invalid_hist_name_bucket{A="B",C="D",le="+Inf"} 1 invalid_hist_name_sum{A="B",C="D"} 23 invalid_hist_name_count{A="B",C="D"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/without_target_info.txt b/exporters/prometheus/testdata/without_target_info.txt new file mode 100755 index 00000000000..93776d2372b --- /dev/null +++ b/exporters/prometheus/testdata/without_target_info.txt @@ -0,0 +1,3 @@ +# HELP foo a simple counter +# TYPE foo counter +foo{A="B",C="D",E="true",F="42"} 24.3 From 715631d35fb6b35cfd3cd784ee3e6aef80ce880c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Oct 2022 10:35:13 -0700 Subject: [PATCH 285/886] Fix Asynchronous Counters Recording (#3350) * Update Asynchronous API docs Clarify the Counter and UpDownCounter Observe values are the exact counter value, not increments to the previous measurements. * Add the pre-computed sum Aggregator * Test the PreComputedSum * Use the PrecomputedSum for async counters * Add changes to changelog * Ignore false-positive lint error * Split NewPrecomputedSum into delta/cumulative vers --- CHANGELOG.md | 1 + .../instrument/asyncfloat64/asyncfloat64.go | 8 ++- metric/instrument/asyncint64/asyncint64.go | 8 ++- sdk/metric/internal/sum.go | 58 +++++++++++++++++++ sdk/metric/internal/sum_test.go | 35 ++++++++++- sdk/metric/pipeline.go | 21 ++++++- sdk/metric/pipeline_registry_test.go | 8 +-- 7 files changed, 124 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b5050e59f9..3a9af7a3094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) - Prometheus exporter will now cumulatively sum histogram buckets. (#3281) - Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) - UpDownCounters are now correctly output as prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) ## [1.11.0/0.32.3] 2022-10-12 diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 370715f694c..5c8260ceb6f 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -35,7 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact Counter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -47,7 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact UpDownCounter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -59,7 +61,7 @@ type UpDownCounter interface { // Gauge is an instrument that records independent readings. type Gauge interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 41a561bc4a2..b07409c7931 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -35,7 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact Counter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -47,7 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. The value of x is + // assumed to be the exact UpDownCounter value to record. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -59,7 +61,7 @@ type UpDownCounter interface { // Gauge is an instrument that records independent readings. type Gauge interface { - // Observe records the state of the instrument. + // Observe records the state of the instrument to be x. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index da8bf34de82..61b8d20860e 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -32,6 +32,12 @@ func newValueMap[N int64 | float64]() *valueMap[N] { return &valueMap[N]{values: make(map[attribute.Set]N)} } +func (s *valueMap[N]) set(value N, attr attribute.Set) { // nolint: unused // This is indeed used. + s.Lock() + s.values[attr] = value + s.Unlock() +} + func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { s.Lock() s.values[attr] += value @@ -49,6 +55,10 @@ func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. func NewDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { + return newDeltaSum[N](monotonic) +} + +func newDeltaSum[N int64 | float64](monotonic bool) *deltaSum[N] { return &deltaSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -106,6 +116,10 @@ func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. func NewCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { + return newCumulativeSum[N](monotonic) +} + +func newCumulativeSum[N int64 | float64](monotonic bool) *cumulativeSum[N] { return &cumulativeSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -151,3 +165,47 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { } return out } + +// NewPrecomputedDeltaSum returns an Aggregator that summarizes a set of +// measurements as their pre-computed arithmetic sum. Each sum is scoped by +// attributes and the aggregation cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// The output Aggregation will report recorded values as delta temporality. It +// is up to the caller to ensure this is accurate. +func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &precomputedSum[N]{settableSum: newDeltaSum[N](monotonic)} +} + +// NewPrecomputedCumulativeSum returns an Aggregator that summarizes a set of +// measurements as their pre-computed arithmetic sum. Each sum is scoped by +// attributes and the aggregation cycle the measurements were made in. +// +// The monotonic value is used to communicate the produced Aggregation is +// monotonic or not. The returned Aggregator does not make any guarantees this +// value is accurate. It is up to the caller to ensure it. +// +// The output Aggregation will report recorded values as cumulative +// temporality. It is up to the caller to ensure this is accurate. +func NewPrecomputedCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { + return &precomputedSum[N]{settableSum: newCumulativeSum[N](monotonic)} +} + +type settableSum[N int64 | float64] interface { + set(value N, attr attribute.Set) + Aggregation() metricdata.Aggregation +} + +// precomputedSum summarizes a set of measurements recorded over all +// aggregation cycles directly as an arithmetic sum. +type precomputedSum[N int64 | float64] struct { + settableSum[N] +} + +// Aggregate records value directly as a sum for attr. +func (s *precomputedSum[N]) Aggregate(value N, attr attribute.Set) { + s.set(value, attr) +} diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 8a838d3f23c..eda320070ff 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -54,6 +54,26 @@ func testSum[N int64 | float64](t *testing.T) { eFunc = cumuExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) }) + + t.Run("PreComputedDelta", func(t *testing.T) { + incr, mono, temp := monoIncr, true, metricdata.DeltaTemporality + eFunc := preExpecter[N](incr, mono, temp) + t.Run("Monotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) + + incr, mono = nonMonoIncr, false + eFunc = preExpecter[N](incr, mono, temp) + t.Run("NonMonotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) + }) + + t.Run("PreComputedCumulative", func(t *testing.T) { + incr, mono, temp := monoIncr, true, metricdata.CumulativeTemporality + eFunc := preExpecter[N](incr, mono, temp) + t.Run("Monotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) + + incr, mono = nonMonoIncr, false + eFunc = preExpecter[N](incr, mono, temp) + t.Run("NonMonotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) + }) } func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { @@ -61,7 +81,7 @@ func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { return func(m int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*m))) + sum.DataPoints = append(sum.DataPoints, point(a, N(v*m))) } return sum } @@ -74,7 +94,18 @@ func cumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { cycle++ sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point[N](a, N(v*cycle*m))) + sum.DataPoints = append(sum.DataPoints, point(a, N(v*cycle*m))) + } + return sum + } +} + +func preExpecter[N int64 | float64](incr setMap, mono bool, temp metricdata.Temporality) expectFunc { + sum := metricdata.Sum[N]{Temporality: temp, IsMonotonic: mono} + return func(int) metricdata.Aggregation { + sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) + for a, v := range incr { + sum.DataPoints = append(sum.DataPoints, point(a, N(v))) } return sum } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 83de81ccc61..db70003b1d5 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -266,7 +266,7 @@ func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit) (inter // still be applied and a warning should be logged. i.logConflict(id) return i.cache.LookupAggregator(id, func() (internal.Aggregator[N], error) { - agg, err := i.aggregator(inst.Aggregation, id.Temporality, id.Monotonic) + agg, err := i.aggregator(inst.Aggregation, inst.Kind, id.Temporality, id.Monotonic) if err != nil { return nil, err } @@ -322,16 +322,31 @@ func (i *inserter[N]) instrumentID(vi view.Instrument, u unit.Unit) instrumentID return id } -// aggregator returns a new Aggregator matching agg, temporality, and +// aggregator returns a new Aggregator matching agg, kind, temporality, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregator(agg aggregation.Aggregation, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { switch a := agg.(type) { case aggregation.Drop: return nil, nil case aggregation.LastValue: return internal.NewLastValue[N](), nil case aggregation.Sum: + switch kind { + case view.AsyncCounter, view.AsyncUpDownCounter: + // Asynchronous counters and up-down-counters are defined to record + // the absolute value of the count: + // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation + switch temporality { + case metricdata.CumulativeTemporality: + return internal.NewPrecomputedCumulativeSum[N](monotonic), nil + case metricdata.DeltaTemporality: + return internal.NewPrecomputedDeltaSum[N](monotonic), nil + default: + return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) + } + } + switch temporality { case metricdata.CumulativeTemporality: return internal.NewCumulativeSum[N](monotonic), nil diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 45bc23ccb18..eb27da9824e 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -107,7 +107,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []view.View{defaultAggView}, inst: instruments[view.AsyncCounter], - wantKind: internal.NewDeltaSum[N](true), + wantKind: internal.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, { @@ -115,7 +115,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []view.View{defaultAggView}, inst: instruments[view.AsyncUpDownCounter], - wantKind: internal.NewDeltaSum[N](false), + wantKind: internal.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, { @@ -155,7 +155,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []view.View{{}}, inst: instruments[view.AsyncCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: internal.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -163,7 +163,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []view.View{{}}, inst: instruments[view.AsyncUpDownCounter], - wantKind: internal.NewCumulativeSum[N](false), + wantKind: internal.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, { From 1d9d4b21241b64f10fbfd1de961651d535ab7d57 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 19 Oct 2022 14:23:34 -0400 Subject: [PATCH 286/886] add _total suffixes to prometheus counters (#3360) --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 10 +++++++++- exporters/prometheus/testdata/counter.txt | 6 +++--- exporters/prometheus/testdata/custom_resource.txt | 6 +++--- exporters/prometheus/testdata/empty_resource.txt | 6 +++--- exporters/prometheus/testdata/sanitized_labels.txt | 7 ++++--- exporters/prometheus/testdata/sanitized_names.txt | 6 +++--- exporters/prometheus/testdata/without_target_info.txt | 6 +++--- 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9af7a3094..d56a2f5f579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) - The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup. This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds _total suffixes to counter metrics. (#3360) ### Fixed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index b2c6778af95..8135578e42d 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -54,6 +54,10 @@ type collector struct { createTargetInfoOnce sync.Once } +// prometheus counters MUST have a _total suffix: +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/data-model.md#sums-1 +const counterSuffix = "_total" + // New returns a Prometheus Exporter. func New(opts ...Option) (*Exporter, error) { cfg := newConfig(opts...) @@ -197,8 +201,12 @@ func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Met } dataPoints := make([]*metricData, 0, len(sum.DataPoints)) for _, dp := range sum.DataPoints { + name := sanitizeName(m.Name) + if sum.IsMonotonic { + name += counterSuffix + } keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) + desc := prometheus.NewDesc(name, m.Description, keys, nil) md := &metricData{ name: m.Name, description: desc, diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 1165eb67cd6..7142094afe6 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,6 +1,6 @@ -# HELP foo a simple counter -# TYPE foo counter -foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/custom_resource.txt b/exporters/prometheus/testdata/custom_resource.txt index 4a394fe9fec..581833b56d0 100755 --- a/exporters/prometheus/testdata/custom_resource.txt +++ b/exporters/prometheus/testdata/custom_resource.txt @@ -1,6 +1,6 @@ -# HELP foo a simple counter -# TYPE foo counter -foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{A="B",C="D",service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/empty_resource.txt b/exporters/prometheus/testdata/empty_resource.txt index ed9d29f3312..02c41c6bac6 100755 --- a/exporters/prometheus/testdata/empty_resource.txt +++ b/exporters/prometheus/testdata/empty_resource.txt @@ -1,6 +1,6 @@ -# HELP foo a simple counter -# TYPE foo counter -foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info 1 diff --git a/exporters/prometheus/testdata/sanitized_labels.txt b/exporters/prometheus/testdata/sanitized_labels.txt index 176d437e000..40be2b01aab 100755 --- a/exporters/prometheus/testdata/sanitized_labels.txt +++ b/exporters/prometheus/testdata/sanitized_labels.txt @@ -1,6 +1,7 @@ -# HELP foo a sanitary counter -# TYPE foo counter -foo{A_B="Q",C_D="Y;Z"} 24.3 +# HELP foo_total a sanitary counter +# TYPE foo_total counter +foo_total{A_B="Q",C_D="Y;Z"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 + diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index a599ea26851..0d321b3fae9 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -1,9 +1,9 @@ # HELP bar a fun little gauge # TYPE bar gauge bar{A="B",C="D"} 75 -# HELP _0invalid_counter_name a counter with an invalid name -# TYPE _0invalid_counter_name counter -_0invalid_counter_name{A="B",C="D"} 100 +# HELP _0invalid_counter_name_total a counter with an invalid name +# TYPE _0invalid_counter_name_total counter +_0invalid_counter_name_total{A="B",C="D"} 100 # HELP invalid_gauge_name a gauge with an invalid name # TYPE invalid_gauge_name gauge invalid_gauge_name{A="B",C="D"} 100 diff --git a/exporters/prometheus/testdata/without_target_info.txt b/exporters/prometheus/testdata/without_target_info.txt index 93776d2372b..b434b536fac 100755 --- a/exporters/prometheus/testdata/without_target_info.txt +++ b/exporters/prometheus/testdata/without_target_info.txt @@ -1,3 +1,3 @@ -# HELP foo a simple counter -# TYPE foo counter -foo{A="B",C="D",E="true",F="42"} 24.3 +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42"} 24.3 From 510910e92d5cc8d18c38e4cc88f1bc7c48f6465f Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 19 Oct 2022 15:25:18 -0400 Subject: [PATCH 287/886] Add unit suffixes to prometheus metric names (#3352) * add unit suffixes to prometheus metric names * Update CHANGELOG.md Co-authored-by: Tyler Yahn * remove unneccessary variable Co-authored-by: Tyler Yahn --- CHANGELOG.md | 3 +- exporters/prometheus/confg_test.go | 11 ++++- exporters/prometheus/config.go | 16 +++++++ exporters/prometheus/exporter.go | 43 ++++++++++++++----- exporters/prometheus/exporter_test.go | 47 +++++++++++++-------- exporters/prometheus/testdata/counter.txt | 6 +-- exporters/prometheus/testdata/gauge.txt | 6 +-- exporters/prometheus/testdata/histogram.txt | 30 ++++++------- 8 files changed, 111 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d56a2f5f579..cb9993a6fc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) - The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup. This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) -- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds _total suffixes to counter metrics. (#3360) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. + This can be disabled with the `WithoutUnits()` option. (#3352) ### Fixed diff --git a/exporters/prometheus/confg_test.go b/exporters/prometheus/confg_test.go index 84b55f0221b..0f3278c61df 100644 --- a/exporters/prometheus/confg_test.go +++ b/exporters/prometheus/confg_test.go @@ -89,11 +89,20 @@ func TestNewConfig(t *testing.T) { disableTargetInfo: true, }, }, + { + name: "unit suffixes disabled", + options: []Option{ + WithoutUnits(), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + withoutUnits: true, + }, + }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { cfg := newConfig(tt.options...) - // tested by TestConfigManualReaderOptions cfg.aggregation = nil diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index 3079278da33..31b34ccf426 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -24,6 +24,7 @@ import ( type config struct { registerer prometheus.Registerer disableTargetInfo bool + withoutUnits bool aggregation metric.AggregationSelector } @@ -89,3 +90,18 @@ func WithoutTargetInfo() Option { return cfg }) } + +// WithoutUnits disables exporter's addition of unit suffixes to metric names, +// and will also prevent unit comments from being added in OpenMetrics once +// unit comments are supported. +// +// By default, metric names include a unit suffix to follow Prometheus naming +// conventions. For example, the counter metric request.duration, with unit +// milliseconds would become request_duration_milliseconds_total. +// With this option set, the name would instead be request_duration_total. +func WithoutUnits() Option { + return optionFunc(func(cfg config) config { + cfg.withoutUnits = true + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 8135578e42d..95c7ef93bb8 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -27,6 +27,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -50,6 +51,7 @@ type collector struct { reader metric.Reader disableTargetInfo bool + withoutUnits bool targetInfo *metricData createTargetInfoOnce sync.Once } @@ -70,6 +72,7 @@ func New(opts ...Option) (*Exporter, error) { collector := &collector{ reader: reader, disableTargetInfo: cfg.disableTargetInfo, + withoutUnits: cfg.withoutUnits, } if err := cfg.registerer.Register(collector); err != nil { @@ -151,15 +154,15 @@ func (c *collector) getMetricData(metrics metricdata.ResourceMetrics) []*metricD for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { case metricdata.Histogram: - allMetrics = append(allMetrics, getHistogramMetricData(v, m)...) + allMetrics = append(allMetrics, getHistogramMetricData(v, m, c.getName(m))...) case metricdata.Sum[int64]: - allMetrics = append(allMetrics, getSumMetricData(v, m)...) + allMetrics = append(allMetrics, getSumMetricData(v, m, c.getName(m))...) case metricdata.Sum[float64]: - allMetrics = append(allMetrics, getSumMetricData(v, m)...) + allMetrics = append(allMetrics, getSumMetricData(v, m, c.getName(m))...) case metricdata.Gauge[int64]: - allMetrics = append(allMetrics, getGaugeMetricData(v, m)...) + allMetrics = append(allMetrics, getGaugeMetricData(v, m, c.getName(m))...) case metricdata.Gauge[float64]: - allMetrics = append(allMetrics, getGaugeMetricData(v, m)...) + allMetrics = append(allMetrics, getGaugeMetricData(v, m, c.getName(m))...) } } } @@ -167,12 +170,12 @@ func (c *collector) getMetricData(metrics metricdata.ResourceMetrics) []*metricD return allMetrics } -func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics) []*metricData { +func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics, name string) []*metricData { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars dataPoints := make([]*metricData, 0, len(histogram.DataPoints)) for _, dp := range histogram.DataPoints { keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) + desc := prometheus.NewDesc(name, m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) cumulativeCount := uint64(0) @@ -194,15 +197,15 @@ func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics return dataPoints } -func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Metrics) []*metricData { +func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Metrics, name string) []*metricData { valueType := prometheus.CounterValue if !sum.IsMonotonic { valueType = prometheus.GaugeValue } dataPoints := make([]*metricData, 0, len(sum.DataPoints)) for _, dp := range sum.DataPoints { - name := sanitizeName(m.Name) if sum.IsMonotonic { + // Add _total suffix for counters name += counterSuffix } keys, values := getAttrs(dp.Attributes) @@ -219,11 +222,11 @@ func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Met return dataPoints } -func getGaugeMetricData[N int64 | float64](gauge metricdata.Gauge[N], m metricdata.Metrics) []*metricData { +func getGaugeMetricData[N int64 | float64](gauge metricdata.Gauge[N], m metricdata.Metrics, name string) []*metricData { dataPoints := make([]*metricData, 0, len(gauge.DataPoints)) for _, dp := range gauge.DataPoints { keys, values := getAttrs(dp.Attributes) - desc := prometheus.NewDesc(sanitizeName(m.Name), m.Description, keys, nil) + desc := prometheus.NewDesc(name, m.Description, keys, nil) md := &metricData{ name: m.Name, description: desc, @@ -289,6 +292,24 @@ func sanitizeRune(r rune) rune { return '_' } +var unitSuffixes = map[unit.Unit]string{ + unit.Dimensionless: "_ratio", + unit.Bytes: "_bytes", + unit.Milliseconds: "_milliseconds", +} + +// getName returns the sanitized name, including unit suffix. +func (c *collector) getName(m metricdata.Metrics) string { + name := sanitizeName(m.Name) + if c.withoutUnits { + return name + } + if suffix, ok := unitSuffixes[m.Unit]; ok { + name += suffix + } + return name +} + func sanitizeName(n string) string { // This algorithm is based on strings.Map from Go 1.19. const replacement = '_' diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 4c8594038fc..0aa0b3d34d6 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -26,6 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/view" @@ -39,7 +40,7 @@ func TestPrometheusExporter(t *testing.T) { emptyResource bool customResouceAttrs []attribute.KeyValue recordMetrics func(ctx context.Context, meter otelmetric.Meter) - withoutTargetInfo bool + options []Option expectedFile string }{ { @@ -52,7 +53,11 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.SyncFloat64().Counter( + "foo", + instrument.WithDescription("a simple counter"), + instrument.WithUnit(unit.Milliseconds), + ) require.NoError(t, err) counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) @@ -67,10 +72,14 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.SyncFloat64().UpDownCounter( + "bar", + instrument.WithDescription("a fun little gauge"), + instrument.WithUnit(unit.Dimensionless), + ) require.NoError(t, err) - gauge.Add(ctx, 100, attrs...) - gauge.Add(ctx, -25, attrs...) + gauge.Add(ctx, 1.0, attrs...) + gauge.Add(ctx, -.25, attrs...) }, }, { @@ -81,7 +90,11 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - histogram, err := meter.SyncFloat64().Histogram("histogram_baz", instrument.WithDescription("a very nice histogram")) + histogram, err := meter.SyncFloat64().Histogram( + "histogram_baz", + instrument.WithDescription("a very nice histogram"), + instrument.WithUnit(unit.Bytes), + ) require.NoError(t, err) histogram.Record(ctx, 23, attrs...) histogram.Record(ctx, 7, attrs...) @@ -92,6 +105,7 @@ func TestPrometheusExporter(t *testing.T) { { name: "sanitized attributes to labels", expectedFile: "testdata/sanitized_labels.txt", + options: []Option{WithoutUnits()}, recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { attrs := []attribute.KeyValue{ // exact match, value should be overwritten @@ -102,7 +116,12 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("C.D").String("Y"), attribute.Key("C/D").String("Z"), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a sanitary counter")) + counter, err := meter.SyncFloat64().Counter( + "foo", + instrument.WithDescription("a sanitary counter"), + // This unit is not added to + instrument.WithUnit(unit.Bytes), + ) require.NoError(t, err) counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) @@ -177,9 +196,9 @@ func TestPrometheusExporter(t *testing.T) { }, }, { - name: "without target_info", - withoutTargetInfo: true, - expectedFile: "testdata/without_target_info.txt", + name: "without target_info", + options: []Option{WithoutTargetInfo()}, + expectedFile: "testdata/without_target_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { attrs := []attribute.KeyValue{ attribute.Key("A").String("B"), @@ -200,13 +219,7 @@ func TestPrometheusExporter(t *testing.T) { t.Run(tc.name, func(t *testing.T) { ctx := context.Background() registry := prometheus.NewRegistry() - - opts := []Option{WithRegisterer(registry)} - if tc.withoutTargetInfo { - opts = append(opts, WithoutTargetInfo()) - } - - exporter, err := New(opts...) + exporter, err := New(append(tc.options, WithRegisterer(registry))...) require.NoError(t, err) customBucketsView, err := view.New( diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 7142094afe6..e8d7f654440 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,6 +1,6 @@ -# HELP foo_total a simple counter -# TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42"} 24.3 +# HELP foo_milliseconds_total a simple counter +# TYPE foo_milliseconds_total counter +foo_milliseconds_total{A="B",C="D",E="true",F="42"} 24.3 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/gauge.txt b/exporters/prometheus/testdata/gauge.txt index f13629508ab..cd75e5a6507 100644 --- a/exporters/prometheus/testdata/gauge.txt +++ b/exporters/prometheus/testdata/gauge.txt @@ -1,6 +1,6 @@ -# HELP bar a fun little gauge -# TYPE bar gauge -bar{A="B",C="D"} 75 +# HELP bar_ratio a fun little gauge +# TYPE bar_ratio gauge +bar_ratio{A="B",C="D"} .75 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt index 495aa6f5160..3f4a1366049 100644 --- a/exporters/prometheus/testdata/histogram.txt +++ b/exporters/prometheus/testdata/histogram.txt @@ -1,18 +1,18 @@ -# HELP histogram_baz a very nice histogram -# TYPE histogram_baz histogram -histogram_baz_bucket{A="B",C="D",le="0"} 0 -histogram_baz_bucket{A="B",C="D",le="5"} 0 -histogram_baz_bucket{A="B",C="D",le="10"} 1 -histogram_baz_bucket{A="B",C="D",le="25"} 2 -histogram_baz_bucket{A="B",C="D",le="50"} 2 -histogram_baz_bucket{A="B",C="D",le="75"} 2 -histogram_baz_bucket{A="B",C="D",le="100"} 2 -histogram_baz_bucket{A="B",C="D",le="250"} 4 -histogram_baz_bucket{A="B",C="D",le="500"} 4 -histogram_baz_bucket{A="B",C="D",le="1000"} 4 -histogram_baz_bucket{A="B",C="D",le="+Inf"} 4 -histogram_baz_sum{A="B",C="D"} 236 -histogram_baz_count{A="B",C="D"} 4 +# HELP histogram_baz_bytes a very nice histogram +# TYPE histogram_baz_bytes histogram +histogram_baz_bytes_bucket{A="B",C="D",le="0"} 0 +histogram_baz_bytes_bucket{A="B",C="D",le="5"} 0 +histogram_baz_bytes_bucket{A="B",C="D",le="10"} 1 +histogram_baz_bytes_bucket{A="B",C="D",le="25"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="50"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="75"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="100"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="250"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="500"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="1000"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="+Inf"} 4 +histogram_baz_bytes_sum{A="B",C="D"} 236 +histogram_baz_bytes_count{A="B",C="D"} 4 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From 2fe8861a24e20088c065b116089862caf9e3cd8b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Oct 2022 12:55:44 -0700 Subject: [PATCH 288/886] Release v1.11.1/v0.33.0 (#3367) * Bump module versions * Prepare stable-v1 for version v1.11.1 * Prepare experimental-metrics for version v0.33.0 * Update the changelog * Update CHANGELOG.md --- CHANGELOG.md | 41 +++++++++++-------- bridge/opencensus/go.mod | 10 ++--- bridge/opencensus/test/go.mod | 12 +++--- bridge/opentracing/go.mod | 4 +- example/fib/go.mod | 8 ++-- example/jaeger/go.mod | 8 ++-- example/namedtracer/go.mod | 8 ++-- example/opencensus/go.mod | 16 ++++---- example/otel-collector/go.mod | 12 +++--- example/passthrough/go.mod | 8 ++-- example/prometheus/go.mod | 12 +++--- example/view/go.mod | 12 +++--- example/zipkin/go.mod | 8 ++-- exporters/jaeger/go.mod | 6 +-- exporters/otlp/otlpmetric/go.mod | 12 +++--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++---- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++---- exporters/otlp/otlptrace/go.mod | 8 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 ++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++--- exporters/prometheus/go.mod | 10 ++--- exporters/stdout/stdoutmetric/go.mod | 10 ++--- exporters/stdout/stdouttrace/go.mod | 6 +-- exporters/zipkin/go.mod | 6 +-- go.mod | 2 +- metric/go.mod | 4 +- sdk/go.mod | 4 +- sdk/metric/go.mod | 8 ++-- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 +- 31 files changed, 150 insertions(+), 141 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb9993a6fc2..faae85f292b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,30 +8,38 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.11.1/0.33.0] 2022-10-19 + ### Added -- Prometheus exporter will register with a prometheus registerer on creation, there are options to control this. (#3239) -- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the `AggregationSelector` used. (#3341) -- Prometheus exporter will convert metrics `Resource` into a `target_info` metric. (#3285) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` registers with a Prometheus registerer on creation. + By default, it will register with the default Prometheus registerer. + A non-default registerer can be used by passing the `WithRegisterer` option. (#3239) +- Added the `WithAggregationSelector` option to the `go.opentelemetry.io/otel/exporters/prometheus` package to change the default `AggregationSelector` used. (#3341) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` converts the `Resource` associated with metric exports into a `target_info` metric. (#3285) ### Changed -- Decode urlencoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable. (#2963) -- `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268) -- The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239) -- The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup. - This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) -- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. - This can be disabled with the `WithoutUnits()` option. (#3352) +- The `"go.opentelemetry.io/otel/exporters/prometheus".New` function is updated to return an error. + It will return an error if the exporter fails to register with Prometheus. (#3239) ### Fixed -- Fix function `baggage.NewMember` to decode the `value` parameter instead of directly use it according to the W3C specification. (#3226) -- Slice attributes of `attribute` package are now comparable based on their value, not instance. (#3108 #3252) -- Prometheus exporter will now cumulatively sum histogram buckets. (#3281) -- Export the sum of each histogram datapoint uniquely with the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) +- The URL-encoded values from the `OTEL_RESOURCE_ATTRIBUTES` environment variable are decoded. (#2963) +- The `baggage.NewMember` function decodes the `value` parameter instead of directly using it. + This fixes the implementation to be compliant with the W3C specification. (#3226) +- Slice attributes of the `attribute` package are now comparable based on their value, not instance. (#3108 #3252) +- The `Shutdown` and `ForceFlush` methods of the `"go.opentelemetry.io/otel/sdk/trace".TraceProvider` no longer return an error when no processor is registered. (#3268) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` cumulatively sums histogram buckets. (#3281) +- The sum of each histogram data point is now uniquely exported by the `go.opentelemetry.io/otel/exporters/otlpmetric` exporters. (#3284, #3293) - Recorded values for asynchronous counters (`Counter` and `UpDownCounter`) are interpreted as exact, not incremental, sum values by the metric SDK. (#3350, #3278) -- UpDownCounters are now correctly output as prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) +- `UpDownCounters` are now correctly output as Prometheus gauges in the `go.opentelemetry.io/otel/exporters/prometheus` exporter. (#3358) +- The Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus` no longer describes the metrics it will send to Prometheus on startup. + Instead the exporter is defined as an "unchecked" collector for Prometheus. + This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now correctly adds `_total` suffixes to counter metrics. (#3360) +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter now adds a unit suffix to metric names. + This can be disabled using the `WithoutUnits()` option added to that package. (#3352) ## [1.11.0/0.32.3] 2022-10-12 @@ -2019,7 +2027,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.1...HEAD +[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 [1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 [0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 [0.32.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d8561458e78..bd4cf3f2f39 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.0 go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index e23e15ae06f..4eedcd91327 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/bridge/opencensus v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.3 // indirect - go.opentelemetry.io/otel/sdk/metric v0.32.3 // indirect + go.opentelemetry.io/otel/metric v0.33.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.33.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index be50ff19c04..f7282992cd4 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index adb25a227e7..7043f38b97e 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index a2ec6d941bc..04bf6e88870 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/jaeger v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/jaeger v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 6c8a96b6ce2..0453a4763e4 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index a4e7ab931d9..6041ed2c4ca 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.23.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/bridge/opencensus v0.32.3 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.3 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/bridge/opencensus v0.33.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.33.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.32.3 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/metric v0.33.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 4486848a24c..83b769223b0 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 google.golang.org/grpc v1.50.1 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index cc18b51b767..9fbfce7c2e5 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 5433a5872e3..1459fb67754 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.3 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/prometheus v0.33.0 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk/metric v0.33.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index b9388f32bee..e1757a55a41 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/prometheus v0.32.3 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/prometheus v0.33.0 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 03ff8ec67d6..d26485a807f 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/zipkin v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/zipkin v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f3a6f886fa2..d595fdaec4b 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 493fd1a4fb2..7595918db18 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index b23a1253814..8fb2675e61f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk/metric v0.33.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.50.1 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 2d70e68c60e..fbba45646c3 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.32.3 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk/metric v0.33.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/sdk v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 51c34b1457a..f3c1f81e3aa 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.50.1 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index ed498f075d0..60491675c97 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.3.5 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index a590c54de05..e0064aaa3f0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index c0935ba262a..9daa2429f34 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 4f993ef55f4..1a355a79be0 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/sdk/metric v0.32.3 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/sdk/metric v0.33.0 ) require ( @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 539a5b5bd9b..f95cdc5a8a5 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 753600b614c..542257b8a2b 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/sdk v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/go.mod b/go.mod index 853b57824c3..264395ca01a 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel/trace v1.11.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 5b61f452d16..3cc65ed0bf2 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel v1.11.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index fdb8ddf489e..1b56802baf5 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/trace v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/trace v1.11.1 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 953ae5cc099..611493511ef 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 - go.opentelemetry.io/otel/metric v0.32.3 - go.opentelemetry.io/otel/sdk v1.11.0 + go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel/metric v0.33.0 + go.opentelemetry.io/otel/sdk v1.11.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.0 // indirect + go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index ca13832eda8..70645bbe424 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.0 - go.opentelemetry.io/otel v1.11.0 + go.opentelemetry.io/otel v1.11.1 ) require ( diff --git a/version.go b/version.go index cbd042f5bce..942e484f848 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.11.0" + return "1.11.1" } diff --git a/versions.yaml b/versions.yaml index 324f3c6f7d0..a2905787a55 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.11.0 + version: v1.11.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.32.3 + version: v0.33.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 587437ba5b784c4ca242a8374758d0ac37fa6bd8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Oct 2022 13:45:39 -0700 Subject: [PATCH 289/886] Replace egrep with grep -E in Makefile (#3362) egrep is deprecated and warns about this since version 3.8: https://www.gnu.org/software/grep/manual/grep.html --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 07e31965c30..68cdfef7d96 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ TOOLS_MOD_DIR := ./internal/tools ALL_DOCS := $(shell find . -name '*.md' -type f | sort) ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS)) -ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort) +ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort) GO = go TIMEOUT = 60 From 11339775566920f5caa82866eb0b6b291ede9df9 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 20 Oct 2022 15:11:58 -0400 Subject: [PATCH 290/886] refactor prometheus exporter to slightly improve performance (#3351) --- exporters/prometheus/exporter.go | 129 +++++++++---------------------- 1 file changed, 35 insertions(+), 94 deletions(-) diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 95c7ef93bb8..1af553d8d84 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -52,7 +52,7 @@ type collector struct { disableTargetInfo bool withoutUnits bool - targetInfo *metricData + targetInfo prometheus.Metric createTargetInfoOnce sync.Once } @@ -105,74 +105,39 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } } - for _, metricData := range c.getMetricData(metrics) { - if metricData.valueType == prometheus.UntypedValue { - m, err := prometheus.NewConstHistogram(metricData.description, metricData.histogramCount, metricData.histogramSum, metricData.histogramBuckets, metricData.attributeValues...) - if err != nil { - otel.Handle(err) - continue - } - ch <- m - } else { - m, err := prometheus.NewConstMetric(metricData.description, metricData.valueType, metricData.value, metricData.attributeValues...) - if err != nil { - otel.Handle(err) - continue - } - ch <- m - } - } -} - -// metricData holds the metadata as well as values for individual data points. -type metricData struct { - // name should include the unit as a suffix (before _total on counters) - // see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md#metric-metadata-1 - name string - description *prometheus.Desc - attributeValues []string - valueType prometheus.ValueType - value float64 - histogramCount uint64 - histogramSum float64 - histogramBuckets map[float64]uint64 -} - -func (c *collector) getMetricData(metrics metricdata.ResourceMetrics) []*metricData { - allMetrics := make([]*metricData, 0) - c.createTargetInfoOnce.Do(func() { // Resource should be immutable, we don't need to compute again - c.targetInfo = c.createInfoMetricData(targetInfoMetricName, targetInfoDescription, metrics.Resource) + targetInfo, err := c.createInfoMetric(targetInfoMetricName, targetInfoDescription, metrics.Resource) + if err != nil { + // If the target info metric is invalid, disable sending it. + otel.Handle(err) + c.disableTargetInfo = true + } + c.targetInfo = targetInfo }) - - if c.targetInfo != nil { - allMetrics = append(allMetrics, c.targetInfo) + if !c.disableTargetInfo { + ch <- c.targetInfo } - for _, scopeMetrics := range metrics.ScopeMetrics { for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { case metricdata.Histogram: - allMetrics = append(allMetrics, getHistogramMetricData(v, m, c.getName(m))...) + addHistogramMetric(ch, v, m, c.getName(m)) case metricdata.Sum[int64]: - allMetrics = append(allMetrics, getSumMetricData(v, m, c.getName(m))...) + addSumMetric(ch, v, m, c.getName(m)) case metricdata.Sum[float64]: - allMetrics = append(allMetrics, getSumMetricData(v, m, c.getName(m))...) + addSumMetric(ch, v, m, c.getName(m)) case metricdata.Gauge[int64]: - allMetrics = append(allMetrics, getGaugeMetricData(v, m, c.getName(m))...) + addGaugeMetric(ch, v, m, c.getName(m)) case metricdata.Gauge[float64]: - allMetrics = append(allMetrics, getGaugeMetricData(v, m, c.getName(m))...) + addGaugeMetric(ch, v, m, c.getName(m)) } } } - - return allMetrics } -func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics, name string) []*metricData { +func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, name string) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars - dataPoints := make([]*metricData, 0, len(histogram.DataPoints)) for _, dp := range histogram.DataPoints { keys, values := getAttrs(dp.Attributes) desc := prometheus.NewDesc(name, m.Description, keys, nil) @@ -183,26 +148,20 @@ func getHistogramMetricData(histogram metricdata.Histogram, m metricdata.Metrics cumulativeCount += dp.BucketCounts[i] buckets[bound] = cumulativeCount } - md := &metricData{ - name: m.Name, - description: desc, - attributeValues: values, - valueType: prometheus.UntypedValue, - histogramCount: dp.Count, - histogramSum: dp.Sum, - histogramBuckets: buckets, + m, err := prometheus.NewConstHistogram(desc, dp.Count, dp.Sum, buckets, values...) + if err != nil { + otel.Handle(err) + continue } - dataPoints = append(dataPoints, md) + ch <- m } - return dataPoints } -func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Metrics, name string) []*metricData { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, name string) { valueType := prometheus.CounterValue if !sum.IsMonotonic { valueType = prometheus.GaugeValue } - dataPoints := make([]*metricData, 0, len(sum.DataPoints)) for _, dp := range sum.DataPoints { if sum.IsMonotonic { // Add _total suffix for counters @@ -210,33 +169,26 @@ func getSumMetricData[N int64 | float64](sum metricdata.Sum[N], m metricdata.Met } keys, values := getAttrs(dp.Attributes) desc := prometheus.NewDesc(name, m.Description, keys, nil) - md := &metricData{ - name: m.Name, - description: desc, - attributeValues: values, - valueType: valueType, - value: float64(dp.Value), + m, err := prometheus.NewConstMetric(desc, valueType, float64(dp.Value), values...) + if err != nil { + otel.Handle(err) + continue } - dataPoints = append(dataPoints, md) + ch <- m } - return dataPoints } -func getGaugeMetricData[N int64 | float64](gauge metricdata.Gauge[N], m metricdata.Metrics, name string) []*metricData { - dataPoints := make([]*metricData, 0, len(gauge.DataPoints)) +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, name string) { for _, dp := range gauge.DataPoints { keys, values := getAttrs(dp.Attributes) desc := prometheus.NewDesc(name, m.Description, keys, nil) - md := &metricData{ - name: m.Name, - description: desc, - attributeValues: values, - valueType: prometheus.GaugeValue, - value: float64(dp.Value), + m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(dp.Value), values...) + if err != nil { + otel.Handle(err) + continue } - dataPoints = append(dataPoints, md) + ch <- m } - return dataPoints } // getAttrs parses the attribute.Set to two lists of matching Prometheus-style @@ -268,21 +220,10 @@ func getAttrs(attrs attribute.Set) ([]string, []string) { return keys, values } -func (c *collector) createInfoMetricData(name, description string, res *resource.Resource) *metricData { - if c.disableTargetInfo { - return nil - } - +func (c *collector) createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { keys, values := getAttrs(*res.Set()) - desc := prometheus.NewDesc(name, description, keys, nil) - return &metricData{ - name: name, - description: desc, - attributeValues: values, - valueType: prometheus.GaugeValue, - value: float64(1), - } + return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) } func sanitizeRune(r rune) rune { From ccbc38e66ede23ef04d86f690df5c7c525ecd4f5 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Fri, 21 Oct 2022 23:12:23 +0800 Subject: [PATCH 291/886] Fix prometheus name duplicate _total suffix (#3369) Signed-off-by: Bing Han Signed-off-by: Bing Han --- CHANGELOG.md | 4 ++++ exporters/prometheus/exporter.go | 8 ++++---- exporters/prometheus/exporter_test.go | 8 ++++++++ exporters/prometheus/testdata/counter.txt | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faae85f292b..f8f29e5c979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) + ## [1.11.1/0.33.0] 2022-10-19 ### Added diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 1af553d8d84..e51326aebc6 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -162,11 +162,11 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata if !sum.IsMonotonic { valueType = prometheus.GaugeValue } + if sum.IsMonotonic { + // Add _total suffix for counters + name += counterSuffix + } for _, dp := range sum.DataPoints { - if sum.IsMonotonic { - // Add _total suffix for counters - name += counterSuffix - } keys, values := getAttrs(dp.Attributes) desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, valueType, float64(dp.Value), values...) diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 0aa0b3d34d6..27441e74ea1 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -62,6 +62,14 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) counter.Add(ctx, 9, attrs...) + + attrs2 := []attribute.KeyValue{ + attribute.Key("A").String("D"), + attribute.Key("C").String("B"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + } + counter.Add(ctx, 5, attrs2...) }, }, { diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index e8d7f654440..5da63dd144a 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,6 +1,7 @@ # HELP foo_milliseconds_total a simple counter # TYPE foo_milliseconds_total counter foo_milliseconds_total{A="B",C="D",E="true",F="42"} 24.3 +foo_milliseconds_total{A="D",C="B",E="true",F="42"} 5 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From 40f19009b0413b7c90f3662b749ed7afec9bfa4a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Oct 2022 08:47:27 -0700 Subject: [PATCH 292/886] Calculate delta sums for delta async counter/up-down-counter types (#3398) * Update API docs Update the async instrument docs for the counters types to explain that the value recorded is assumed by implementations to be the cumulative sum. * Refactor precomputed delta sum aggregation Report the delta Aggregation while supporting cumulative Aggregate values. * Add changes to changelog --- CHANGELOG.md | 1 + .../instrument/asyncfloat64/asyncfloat64.go | 8 +- metric/instrument/asyncint64/asyncint64.go | 8 +- sdk/metric/internal/sum.go | 74 ++++++++++++++++--- sdk/metric/internal/sum_test.go | 30 ++++++-- 5 files changed, 95 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8f29e5c979..1a47d2b6451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 5c8260ceb6f..17bda2ceee1 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -35,8 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument to be x. The value of x is - // assumed to be the exact Counter value to record. + // Observe records the state of the instrument to be x. Implementations + // will assume x to be the cumulative sum of the count. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -48,8 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument to be x. The value of x is - // assumed to be the exact UpDownCounter value to record. + // Observe records the state of the instrument to be x. Implementations + // will assume x to be the cumulative sum of the count. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index b07409c7931..1e17988e827 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -35,8 +35,8 @@ type InstrumentProvider interface { // Counter is an instrument that records increasing values. type Counter interface { - // Observe records the state of the instrument to be x. The value of x is - // assumed to be the exact Counter value to record. + // Observe records the state of the instrument to be x. Implementations + // will assume x to be the cumulative sum of the count. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an @@ -48,8 +48,8 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. type UpDownCounter interface { - // Observe records the state of the instrument to be x. The value of x is - // assumed to be the exact UpDownCounter value to record. + // Observe records the state of the instrument to be x. Implementations + // will assume x to be the cumulative sum of the count. // // It is only valid to call this within a callback. If called outside of the // registered callback it should have no effect on the instrument, and an diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index 61b8d20860e..210d2370120 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -177,7 +177,66 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { // The output Aggregation will report recorded values as delta temporality. It // is up to the caller to ensure this is accurate. func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { - return &precomputedSum[N]{settableSum: newDeltaSum[N](monotonic)} + return &precomputedDeltaSum[N]{ + recorded: make(map[attribute.Set]N), + reported: make(map[attribute.Set]N), + monotonic: monotonic, + start: now(), + } +} + +// precomputedDeltaSum summarizes a set of measurements recorded over all +// aggregation cycles as the delta arithmetic sum. +type precomputedDeltaSum[N int64 | float64] struct { + sync.Mutex + recorded map[attribute.Set]N + reported map[attribute.Set]N + + monotonic bool + start time.Time +} + +// Aggregate records value as a cumulative sum for attr. +func (s *precomputedDeltaSum[N]) Aggregate(value N, attr attribute.Set) { + s.Lock() + s.recorded[attr] = value + s.Unlock() +} + +func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { + out := metricdata.Sum[N]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: s.monotonic, + } + + s.Lock() + defer s.Unlock() + + if len(s.recorded) == 0 { + return out + } + + t := now() + out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.recorded)) + for attr, recorded := range s.recorded { + value := recorded - s.reported[attr] + out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ + Attributes: attr, + StartTime: s.start, + Time: t, + Value: value, + }) + if value != 0 { + s.reported[attr] = recorded + } + // TODO (#3006): This will use an unbounded amount of memory if there + // are unbounded number of attribute sets being aggregated. Attribute + // sets that become "stale" need to be forgotten so this will not + // overload the system. + } + // The delta collection cycle resets. + s.start = t + return out } // NewPrecomputedCumulativeSum returns an Aggregator that summarizes a set of @@ -191,21 +250,16 @@ func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { // The output Aggregation will report recorded values as cumulative // temporality. It is up to the caller to ensure this is accurate. func NewPrecomputedCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { - return &precomputedSum[N]{settableSum: newCumulativeSum[N](monotonic)} -} - -type settableSum[N int64 | float64] interface { - set(value N, attr attribute.Set) - Aggregation() metricdata.Aggregation + return &precomputedSum[N]{newCumulativeSum[N](monotonic)} } // precomputedSum summarizes a set of measurements recorded over all -// aggregation cycles directly as an arithmetic sum. +// aggregation cycles directly as the cumulative arithmetic sum. type precomputedSum[N int64 | float64] struct { - settableSum[N] + *cumulativeSum[N] } -// Aggregate records value directly as a sum for attr. +// Aggregate records value as a cumulative sum for attr. func (s *precomputedSum[N]) Aggregate(value N, attr attribute.Set) { s.set(value, attr) } diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index eda320070ff..92e3b394675 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -56,22 +56,22 @@ func testSum[N int64 | float64](t *testing.T) { }) t.Run("PreComputedDelta", func(t *testing.T) { - incr, mono, temp := monoIncr, true, metricdata.DeltaTemporality - eFunc := preExpecter[N](incr, mono, temp) + incr, mono := monoIncr, true + eFunc := preDeltaExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr, false - eFunc = preExpecter[N](incr, mono, temp) + eFunc = preDeltaExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) }) t.Run("PreComputedCumulative", func(t *testing.T) { - incr, mono, temp := monoIncr, true, metricdata.CumulativeTemporality - eFunc := preExpecter[N](incr, mono, temp) + incr, mono := monoIncr, true + eFunc := preCumuExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr, false - eFunc = preExpecter[N](incr, mono, temp) + eFunc = preCumuExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) }) } @@ -100,8 +100,22 @@ func cumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { } } -func preExpecter[N int64 | float64](incr setMap, mono bool, temp metricdata.Temporality) expectFunc { - sum := metricdata.Sum[N]{Temporality: temp, IsMonotonic: mono} +func preDeltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { + sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} + last := make(map[attribute.Set]N) + return func(int) metricdata.Aggregation { + sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) + for a, v := range incr { + l := last[a] + sum.DataPoints = append(sum.DataPoints, point(a, N(v)-l)) + last[a] = N(v) + } + return sum + } +} + +func preCumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { + sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} return func(int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { From b1fd8ce04830c4f121859d0c813a5d47bc8152b3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Oct 2022 12:39:23 -0700 Subject: [PATCH 293/886] Rename confg_test to config_test in prom exp (#3400) --- exporters/prometheus/{confg_test.go => config_test.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename exporters/prometheus/{confg_test.go => config_test.go} (100%) diff --git a/exporters/prometheus/confg_test.go b/exporters/prometheus/config_test.go similarity index 100% rename from exporters/prometheus/confg_test.go rename to exporters/prometheus/config_test.go From 667a2017aea9e2fbba7df6cb8f3a8c108d3272ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:21:32 -0700 Subject: [PATCH 294/886] dependabot updates Thu Oct 27 19:57:51 UTC 2022 (#3404) * dependabot updates Thu Oct 27 19:57:50 UTC 2022 Bump github.com/golangci/golangci-lint from 1.48.0 to 1.50.1 in /internal/tools Bump golang.org/x/tools from 0.1.12 to 0.2.0 in /internal/tools * Ignore errors in Prom exporter's sanitizeName * Omit type from inferred var decl Co-authored-by: MrAlias Co-authored-by: Tyler Yahn --- exporters/prometheus/exporter.go | 10 +- internal/tools/go.mod | 76 +++--- internal/tools/go.sum | 415 +++++++------------------------ sdk/metric/meter_test.go | 2 +- 4 files changed, 139 insertions(+), 364 deletions(-) diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index e51326aebc6..6920d2bb328 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -275,12 +275,12 @@ func sanitizeName(n string) string { if i == 0 && c >= '0' && c <= '9' { // Prefix leading number with replacement character. b.Grow(len(n) + 1) - b.WriteByte(byte(replacement)) + _ = b.WriteByte(byte(replacement)) break } b.Grow(len(n)) - b.WriteString(n[:i]) - b.WriteByte(byte(replacement)) + _, _ = b.WriteString(n[:i]) + _ = b.WriteByte(byte(replacement)) width := utf8.RuneLen(c) n = n[i+width:] break @@ -295,9 +295,9 @@ func sanitizeName(n string) string { // Due to inlining, it is more performant to invoke WriteByte rather then // WriteRune. if valid(1, c) { // We are guaranteed to not be at the start. - b.WriteByte(byte(c)) + _ = b.WriteByte(byte(c)) } else { - b.WriteByte(byte(replacement)) + _ = b.WriteByte(byte(replacement)) } } diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 4a22b7b810c..b9ef8a1ed2c 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.48.0 + github.com/golangci/golangci-lint v1.50.1 github.com/itchyny/gojq v0.12.9 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -13,19 +13,20 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c - golang.org/x/tools v0.1.12 + golang.org/x/tools v0.2.0 ) require ( 4d63.com/gochecknoglobals v0.1.0 // indirect + github.com/Abirdcfly/dupword v0.0.7 // indirect github.com/Antonboom/errname v0.1.7 // indirect github.com/Antonboom/nilnil v0.1.1 // indirect - github.com/BurntSushi/toml v1.2.0 // indirect + github.com/BurntSushi/toml v1.2.1 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.4.16 // indirect - github.com/OpenPeeDeeP/depguard v1.1.0 // indirect + github.com/OpenPeeDeeP/depguard v1.1.1 // indirect github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -41,8 +42,9 @@ require ( github.com/butuzov/ireturn v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/charithe/durationcheck v0.0.9 // indirect - github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 // indirect - github.com/daixiang0/gci v0.6.2 // indirect + github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect + github.com/curioswitch/go-reassign v0.2.0 // indirect + github.com/daixiang0/gci v0.8.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.12.0 // indirect @@ -53,13 +55,13 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.6.3 // indirect + github.com/go-critic/go-critic v0.6.5 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.3.1 // indirect github.com/go-git/go-git/v5 v5.4.2 // indirect github.com/go-toolsmith/astcast v1.0.0 // indirect - github.com/go-toolsmith/astcopy v1.0.0 // indirect - github.com/go-toolsmith/astequal v1.0.1 // indirect + github.com/go-toolsmith/astcopy v1.0.2 // indirect + github.com/go-toolsmith/astequal v1.0.3 // indirect github.com/go-toolsmith/astfmt v1.0.0 // indirect github.com/go-toolsmith/astp v1.0.0 // indirect github.com/go-toolsmith/strparse v1.0.0 // indirect @@ -71,7 +73,7 @@ require ( github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect - github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect + github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect github.com/golangci/misspell v0.3.5 // indirect @@ -89,7 +91,7 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/imdario/mergo v0.3.12 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/itchyny/timefmt-go v0.1.4 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jgautheron/goconst v1.5.1 // indirect @@ -99,6 +101,7 @@ require ( github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect github.com/kisielk/errcheck v1.6.2 // indirect github.com/kisielk/gotool v1.0.0 // indirect + github.com/kkHAIKE/contextcheck v1.1.3 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect github.com/kyoh86/exportloopref v0.1.8 // indirect @@ -107,43 +110,45 @@ require ( github.com/leonklingele/grouper v1.1.0 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.0 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.2.1 // indirect + github.com/mgechev/revive v1.2.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.8.1 // indirect + github.com/nishanths/exhaustive v0.8.3 // indirect github.com/nishanths/predeclared v0.2.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/otiai10/copy v1.7.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.0.0 // indirect + github.com/polyfloyd/go-errorlint v1.0.5 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a // indirect - github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 // indirect + github.com/quasilyte/go-ruleguard v0.3.18 // indirect + github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/ryancurrah/gomodguard v1.2.4 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect - github.com/sashamelentyev/usestdlibvars v1.8.0 // indirect - github.com/securego/gosec/v2 v2.12.0 // indirect + github.com/sashamelentyev/interfacebloat v1.1.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.20.0 // indirect + github.com/securego/gosec/v2 v2.13.1 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.0 // indirect @@ -154,7 +159,7 @@ require ( github.com/sourcegraph/go-diff v0.6.1 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.5.0 // indirect + github.com/spf13/cobra v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.12.0 // indirect @@ -162,13 +167,13 @@ require ( github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.4.0 // indirect github.com/stretchr/testify v1.8.0 // indirect - github.com/subosito/gotenv v1.4.0 // indirect - github.com/sylvia7788/contextcheck v1.0.4 // indirect + github.com/subosito/gotenv v1.4.1 // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect - github.com/tomarrell/wrapcheck/v2 v2.6.2 // indirect - github.com/tommy-muehle/go-mnd/v2 v2.5.0 // indirect + github.com/timonwong/loggercheck v0.9.3 // indirect + github.com/tomarrell/wrapcheck/v2 v2.7.0 // indirect + github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect github.com/uudashr/gocognit v1.0.6 // indirect @@ -180,20 +185,21 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect go.uber.org/zap v1.21.0 // indirect - golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect - golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect - golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect - golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/crypto v0.1.0 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect + golang.org/x/mod v0.6.0 // indirect + golang.org/x/net v0.1.0 // indirect + golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect + golang.org/x/sys v0.1.0 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/protobuf v1.28.1 // indirect - gopkg.in/ini.v1 v1.66.6 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.3.3 // indirect - mvdan.cc/gofumpt v0.3.1 // indirect + mvdan.cc/gofumpt v0.4.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 207a09c1ed9..e86a4390a9a 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1,6 +1,5 @@ 4d63.com/gochecknoglobals v0.1.0 h1:zeZSRqj5yCg28tCkIV/z/lWbwvNm5qnKVS15PI8nhD0= 4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= -bitbucket.org/creachadair/shell v0.0.6/go.mod h1:8Qqi/cYk7vPnsOePHroKXDJYmb5x7ENhtiFtfZq8K+M= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -15,7 +14,6 @@ cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6 cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.60.0/go.mod h1:yw2G51M9IfRboUH61Us8GqCeF1PzPblB823Mn2q2eAU= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= @@ -33,40 +31,34 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.5.0/go.mod h1:ZEwJccE3z93Z2HWvstpri00jOg7oO4UZDtKhwDwqF0w= -cloud.google.com/go/spanner v1.7.0/go.mod h1:sd3K2gZ9Fd0vMPLXzeCrF6fq4i63Q7aTLW/lBIfBkIk= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Abirdcfly/dupword v0.0.7 h1:z14n0yytA3wNO2gpCD/jVtp/acEXPGmYu0esewpBt6Q= +github.com/Abirdcfly/dupword v0.0.7/go.mod h1:K/4M1kj+Zh39d2aotRwypvasonOyAMH1c/IZJzE0dmk= github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= -github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2 h1:DGdS4FlsdM6OkluXOhgkvwx05ZjD3Idm9WqtYnOmSuY= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.2.2/go.mod h1:xj0D2jwLdp6tOKLheyZCsfL0nz8DaicmJxSwj3VcHtY= -github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= -github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= +github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= -github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= -github.com/OpenPeeDeeP/depguard v1.1.0 h1:pjK9nLPS1FwQYGGpPxoMYpe7qACHOhAWQMQzV71i49o= -github.com/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= +github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= +github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= @@ -82,25 +74,18 @@ github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= -github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.36.30/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= @@ -119,8 +104,8 @@ github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cb github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4 h1:tFXjAxje9thrTF4h57Ckik+scJjTWdwAtZqZPtOT48M= -github.com/chavacava/garif v0.0.0-20220316182200-5cad0b5181d4/go.mod h1:W8EnPSQ8Nv4fUjc/v1/8tHFqhuOJXnRub0dTfuAQktU= +github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 h1:E7LT642ysztPWE0dfz43cWOvMiF42DyTRC+eZIaO4yI= +github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xfuwWPNKXlThldNuJvutYM6J95wNuuVmn55To= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -129,33 +114,19 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/daixiang0/gci v0.6.2 h1:TXCP5RqjE/UupXO+p33MEhqdv7QxjKGw5MVkt9ATiMs= -github.com/daixiang0/gci v0.6.2/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= -github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= +github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= +github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= +github.com/daixiang0/gci v0.8.1 h1:T4xpSC+hmsi4CSyuYfIJdMZAr9o7xZmHpQVygMghGZ4= +github.com/daixiang0/gci v0.8.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -163,14 +134,11 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= @@ -179,18 +147,14 @@ github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phm github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3nqZCxaQ2Ze/sM= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/go-critic/go-critic v0.6.3 h1:abibh5XYBTASawfTQ0rA7dVtQT+6KzpGqb/J+DxRDaw= -github.com/go-critic/go-critic v0.6.3/go.mod h1:c6b3ZP1MQ7o6lPR7Rv3lEf7pYQUmAcx8ABHgdZCQt/k= +github.com/go-critic/go-critic v0.6.5 h1:fDaR/5GWURljXwF8Eh31T2GZNz9X4jeboS912mWF8Uo= +github.com/go-critic/go-critic v0.6.5/go.mod h1:ezfP/Lh7MA6dBNn4c6ab5ALv3sKnZVLx37tr00uuaOY= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -209,18 +173,16 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8= -github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= +github.com/go-toolsmith/astcopy v1.0.2 h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0= +github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= -github.com/go-toolsmith/astequal v1.0.1 h1:JbSszi42Jiqu36Gnf363HWS9MTEAz67vTQLponh3Moc= -github.com/go-toolsmith/astequal v1.0.1/go.mod h1:4oGA3EZXTVItV/ipGiOx7NWkY5veFfcsOJVS2YxltLw= +github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= +github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o= +github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= @@ -238,13 +200,9 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -255,7 +213,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -279,10 +236,10 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= -github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.48.0 h1:hRiBNk9iRqdAKMa06ntfEiLyza1/3IE9rHLNJaek4a8= -github.com/golangci/golangci-lint v1.48.0/go.mod h1:5N+oxduCho+7yuccW69upg/O7cxjfR/d+IQeiNxGmKM= +github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= +github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= +github.com/golangci/golangci-lint v1.50.1 h1:C829clMcZXEORakZlwpk7M4iDw2XiwxxKaG504SZ9zY= +github.com/golangci/golangci-lint v1.50.1/go.mod h1:AQjHBopYS//oB8xs0y0M/dtxdKHkdhl0RvmjUct0/4w= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -295,8 +252,6 @@ github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSW github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= -github.com/google/certificate-transparency-go v1.1.1/go.mod h1:FDKqPvSXawb2ecErVRrD+nfy23RCzyl7eqVCEmlT1Zs= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -307,7 +262,6 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -321,30 +275,17 @@ github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200507031123-427632fa3b1c/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/trillian v1.3.11/go.mod h1:0tPraVHrSDkA3BO6vKX67zgLXs6SsOAbHEivX+9mPgw= -github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= -github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= @@ -360,12 +301,6 @@ github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3 github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= -github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= @@ -375,22 +310,17 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo= -github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/itchyny/gojq v0.12.9 h1:biKpbKwMxVYhCU1d6mR7qMr3f0Hn9F5k5YykCVb3gmM= github.com/itchyny/gojq v0.12.9/go.mod h1:T4Ip7AETUXeGpD+436m+UEl3m3tokRgajd5pRfsR5oE= github.com/itchyny/timefmt-go v0.1.4 h1:hFEfWVdwsEi+CY8xY2FtgWHGQaBaC3JeHd+cve0ynVM= @@ -402,42 +332,32 @@ github.com/jcchavezs/porto v0.4.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6 github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= -github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.2 h1:uGQ9xI8/pgc9iOoCe7kWQgRE6SBTrCGmTSf0LrEtY7c= github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= +github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -453,7 +373,6 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M= github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= @@ -462,16 +381,13 @@ github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKi github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= -github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= +github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= @@ -479,22 +395,13 @@ github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859 github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -503,65 +410,34 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= -github.com/mgechev/revive v1.2.1 h1:GjFml7ZsoR0IrQ2E2YIvWFNS5GPDV7xNwvA5GM1HZC4= -github.com/mgechev/revive v1.2.1/go.mod h1:+Ro3wqY4vakcYNtkBWdZC7dBg1xSB6sp054wWwmeFm0= -github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= -github.com/miekg/pkcs11 v1.0.2/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mgechev/revive v1.2.4 h1:+2Hd/S8oO2H0Ikq2+egtNwQsVhAeELHjxjIUFX5ajLI= +github.com/mgechev/revive v1.2.4/go.mod h1:iAWlQishqCuj4yhV24FTnKSXGpbAA+0SckXB8GQMX/Q= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= -github.com/mozilla/scribe v0.0.0-20180711195314-fb71baf557c1/go.mod h1:FIczTrinKo8VaLxe6PWTPEXRXDIHz2QAwiaBaP5/4a8= -github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1:FUqVoUPHSEdDR0MnFM3Dh8AU0pZHLXUD127SAJGER/s= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007/go.mod h1:m2XC9Qq0AlmmVksL6FktJCdTYyLk7V3fKyp0sl1yWQo= -github.com/mwitkow/go-proto-validators v0.2.0/go.mod h1:ZfA1hW+UH/2ZHOWvQ3HnQaU0DtnpXu850MZiy+YUgcc= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.8.1 h1:0QKNascWv9qIHY7zRoZSxeRr6kuk5aAT3YXLTiDmjTo= -github.com/nishanths/exhaustive v0.8.1/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= -github.com/nishanths/predeclared v0.0.0-20190419143655-18a43bb90ffc/go.mod h1:62PewwiQTlm/7Rj+cxVYqZvDIUc+JjZq6GHAC1fsObQ= +github.com/nishanths/exhaustive v0.8.3 h1:pw5O09vwg8ZaditDp/nQRqVnrMczSJDxRDJMowvhsrM= +github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.2/go.mod h1:rSAaSIOAGT9odnlyGlUfAJaoc5w2fSBUmeGDbRWPxyQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= @@ -571,12 +447,10 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI= github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= -github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= -github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= +github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -584,11 +458,10 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.0.0 h1:pDrQG0lrh68e602Wfp68BlUTRFoHn8PZYAjLgt2LFsM= -github.com/polyfloyd/go-errorlint v1.0.0/go.mod h1:KZy4xxPJyy88/gldCe5OdW6OQRtNO3EZE7hXzmnebgA= +github.com/polyfloyd/go-errorlint v1.0.5 h1:AHB5JRCjlmelh9RrLxT9sgzpalIwwq4hqE8EkwIwKdY= +github.com/polyfloyd/go-errorlint v1.0.5/go.mod h1:APVvOesVSAnne5SClsPxPdfvZTVDojXh1/G3qb5wjGI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -611,30 +484,23 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= -github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a h1:sWFavxtIctGrVs5SYZ5Ml1CvrDAs8Kf5kx2PI3C41dA= -github.com/quasilyte/go-ruleguard v0.3.16-0.20220213074421-6aa060fab41a/go.mod h1:VMX+OnnSw4LicdiEGtRSD/1X8kW7GuEscjYNr4cOIT4= +github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE= +github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs= github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.16/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= +github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 h1:PDWGei+Rf2bBiuZIbZmM20J2ftEy9IeUCHA8HbQqed8= -github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= +github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f h1:6Gtn2i04RD0gVyYf2/IUMTIs+qYleBt4zxDqkLTcu4U= +github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.2.4 h1:CpMSDKan0LtNGGhPrvupAoLeObRFjND8/tU1rEOtBp4= github.com/ryancurrah/gomodguard v1.2.4/go.mod h1:+Kem4VjWwvFpUJRJSwa16s1tBJe+vbv02+naTow2f6M= @@ -642,22 +508,22 @@ github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8 github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= -github.com/sashamelentyev/usestdlibvars v1.8.0 h1:QnWP9IOEuRyYKH+IG0LlQIjuJlc0rfdo4K3/Zh3WRMw= -github.com/sashamelentyev/usestdlibvars v1.8.0/go.mod h1:BFt7b5mSVHaaa26ZupiNRV2ODViQBxZZVhtAxAJRrjs= -github.com/securego/gosec/v2 v2.12.0 h1:CQWdW7ATFpvLSohMVsajscfyHJ5rsGmEXmsNcsDNmAg= -github.com/securego/gosec/v2 v2.12.0/go.mod h1:iTpT+eKTw59bSgklBHlSnH5O2tNygHMDxfvMubA4i7I= +github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= +github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= +github.com/sashamelentyev/usestdlibvars v1.20.0 h1:K6CXjqqtSYSsuyRDDC7Sjn6vTMLiSJa4ZmDkiokoqtw= +github.com/sashamelentyev/usestdlibvars v1.20.0/go.mod h1:0GaP+ecfZMXShS0A94CJn6aEuPRILv8h/VuWI9n1ygg= +github.com/securego/gosec/v2 v2.13.1 h1:7mU32qn2dyC81MH9L2kefnQyRMUarfDER3iQyMHcjYM= +github.com/securego/gosec/v2 v2.13.1/go.mod h1:EO1sImBMBWFjOTFzMWfTRrZW6M15gm60ljzrmy/wtHo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= @@ -666,30 +532,21 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.0 h1:d4laZMBK6jpe5PWepxlV9S+LC0yXqvYHiq8E6ceoVVE= github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= +github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= @@ -700,7 +557,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -709,14 +565,11 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs= -github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo= -github.com/sylvia7788/contextcheck v1.0.4 h1:MsiVqROAdr0efZc/fOCt0c235qm9XJqHtWwM+2h2B04= -github.com/sylvia7788/contextcheck v1.0.4/go.mod h1:vuPKJMQ7MQ91ZTqfdyreNKwZjyUg6KO+IebVyQDedZQ= +github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= +github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -727,50 +580,35 @@ github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tomarrell/wrapcheck/v2 v2.6.2 h1:3dI6YNcrJTQ/CJQ6M/DUkc0gnqYSIk6o0rChn9E/D0M= -github.com/tomarrell/wrapcheck/v2 v2.6.2/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= -github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce/go.mod h1:o8v6yHRoik09Xen7gje4m9ERNah1d1PPsVq1VEx9vE4= -github.com/tommy-muehle/go-mnd/v2 v2.5.0 h1:iAj0a8e6+dXSL7Liq0aXPox36FiN1dBbjA6lt9fl65s= -github.com/tommy-muehle/go-mnd/v2 v2.5.0/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= +github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= +github.com/tomarrell/wrapcheck/v2 v2.7.0 h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA= +github.com/tomarrell/wrapcheck/v2 v2.7.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= +github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y= github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= -github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.0.0-20200513171258-e048e166ab9c/go.mod h1:xCI7ZzBfRuGgBXyXO6yfWfDmlWd35khcWpUa4L0xI/k= -go.mozilla.org/mozlog v0.0.0-20170222151521-4bb13139d403/go.mod h1:jHoPAGnDrCy6kaI2tAze5Prf0Nr0w/oNkROt2lw3n3o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -787,41 +625,29 @@ go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c h1:N go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c/go.mod h1:EOBbXCes6aVxWqvSy3v1AJD8vtC4++fW1UH5AB8W4uM= go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c h1:sdRLGv2B9aIRQdLLKlQ6RT/N5MOgsDI+UeYQqNP1g5I= go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c/go.mod h1:5ykZFab0x3jatwG5Rf2idlko5e5Z42XsyJLMg4h35bg= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= -golang.org/x/crypto v0.0.0-20180501155221-613d6eafa307/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -832,9 +658,11 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d h1:+W8Qf4iJtMGKkyAygcKohjxTk4JPsL9DpzApJ22m5Ic= -golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 h1:Ic/qN6TEifvObMGQy72k0n1LlJr7DjWWEi+MOsDOiSk= +golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -848,7 +676,6 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -862,13 +689,12 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -880,9 +706,6 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -890,30 +713,25 @@ golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -928,7 +746,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -936,16 +753,13 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -954,15 +768,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -975,7 +782,6 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -988,7 +794,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1002,23 +807,20 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1026,17 +828,14 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= @@ -1056,17 +855,13 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191010075000-0337d82405ff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1084,7 +879,6 @@ golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWc golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1093,9 +887,6 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200630154851-b2d8b0336632/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200706234117-b22de6825cf7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -1110,7 +901,6 @@ golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1124,8 +914,9 @@ golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlz golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1134,7 +925,6 @@ google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEt google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.10.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= @@ -1154,13 +944,10 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181107211654-5fc9ac540362/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -1168,7 +955,6 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= @@ -1182,14 +968,11 @@ google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200626011028-ee7919e894b5/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200707001353-8e8330bf89df/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1200,19 +983,15 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= @@ -1241,24 +1020,15 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI= -gopkg.in/ini.v1 v1.66.6/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.6/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -1276,8 +1046,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= -mvdan.cc/gofumpt v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8= -mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= +mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= +mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= @@ -1287,4 +1057,3 @@ mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2Yj rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 8f6448f757e..808c946bb40 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -110,7 +110,7 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { - var seven float64 = 7.0 + seven := 7.0 testCases := []struct { name string fn func(*testing.T, metric.Meter) From 94ae231180b0eeac1671967670a431bdb1e82799 Mon Sep 17 00:00:00 2001 From: Kuisong Tong Date: Thu, 27 Oct 2022 14:29:01 -0700 Subject: [PATCH 295/886] Set IsMonotonic to true for opencensus sum (#3389) * Set IsMonotonic to true for opencensus sum fix #3388 * Update metric_test.go * fix test * add changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + bridge/opencensus/internal/ocmetric/metric.go | 2 +- bridge/opencensus/internal/ocmetric/metric_test.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a47d2b6451..da030b9193f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index 575e99abe75..54b6619a1f6 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -92,7 +92,7 @@ func convertGauge[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*oc func convertSum[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Sum[N], error) { points, err := convertNumberDataPoints[N](labelKeys, ts) // OpenCensus sums are always Cumulative - return metricdata.Sum[N]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, err + return metricdata.Sum[N]{DataPoints: points, Temporality: metricdata.CumulativeTemporality, IsMonotonic: true}, err } // convertNumberDataPoints converts OpenCensus TimeSeries to OpenTelemetry DataPoints. diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index b93bc413088..19f74a6a887 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -312,6 +312,7 @@ func TestConvertMetrics(t *testing.T) { Description: "an int testing sum", Unit: unit.Milliseconds, Data: metricdata.Sum[int64]{ + IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.DataPoint[int64]{ { @@ -342,6 +343,7 @@ func TestConvertMetrics(t *testing.T) { Description: "a float testing sum", Unit: unit.Milliseconds, Data: metricdata.Sum[float64]{ + IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.DataPoint[float64]{ { @@ -410,6 +412,7 @@ func TestConvertMetrics(t *testing.T) { Description: "a testing sum", Unit: unit.Dimensionless, Data: metricdata.Sum[float64]{ + IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.DataPoint[float64]{}, }, From 3dd4e816a6b2803da6cfda6812e09803f2c5d324 Mon Sep 17 00:00:00 2001 From: ReStartercc Date: Fri, 28 Oct 2022 12:22:18 +0800 Subject: [PATCH 296/886] fix wrong representation of status value in zipkin exporter (#3340) * export status codes to upper case in zipkin exporter * add test cases for status UNSET and ERROR * Update exporters/zipkin/model.go correct the usage of case-sensitive terms Co-authored-by: Tyler Yahn * change unit test cases to test exact behavior * move this PR to unrelease section in the CHANGELOG.md Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/zipkin/model.go | 5 +- exporters/zipkin/model_test.go | 220 ++++++++++++++++++++++++++++++-- exporters/zipkin/zipkin_test.go | 4 +- 4 files changed, 215 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da030b9193f..a75865c5ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) - Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) +- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 9bec6676a57..88596717f9e 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -20,6 +20,7 @@ import ( "fmt" "net" "strconv" + "strings" zkmodel "github.com/openzipkin/zipkin-go/model" @@ -209,7 +210,9 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { } if data.Status().Code != codes.Unset { - m["otel.status_code"] = data.Status().Code.String() + // Zipkin expect to receive uppercase status values + // rather than default capitalized ones. + m["otel.status_code"] = strings.ToUpper(data.Status().Code.String()) } if data.Status().Code == codes.Error { diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 454d18c495b..7c96712d38d 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -45,7 +45,85 @@ func TestModelConversion(t *testing.T) { ) inputBatch := tracetest.SpanStubs{ - // typical span data + // typical span data with UNSET status + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38}, + }), + SpanKind: trace.SpanKindServer, + Name: "foo", + StartTime: time.Date(2020, time.March, 11, 19, 24, 0, 0, time.UTC), + EndTime: time.Date(2020, time.March, 11, 19, 25, 0, 0, time.UTC), + Attributes: []attribute.KeyValue{ + attribute.Int64("attr1", 42), + attribute.String("attr2", "bar"), + attribute.IntSlice("attr3", []int{0, 1, 2}), + }, + Events: []tracesdk.Event{ + { + Time: time.Date(2020, time.March, 11, 19, 24, 30, 0, time.UTC), + Name: "ev1", + Attributes: []attribute.KeyValue{ + attribute.Int64("eventattr1", 123), + }, + }, + { + Time: time.Date(2020, time.March, 11, 19, 24, 45, 0, time.UTC), + Name: "ev2", + Attributes: nil, + }, + }, + Status: tracesdk.Status{ + Code: codes.Unset, + Description: "", + }, + Resource: res, + }, + // typical span data with OK status + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38}, + }), + SpanKind: trace.SpanKindServer, + Name: "foo", + StartTime: time.Date(2020, time.March, 11, 19, 24, 0, 0, time.UTC), + EndTime: time.Date(2020, time.March, 11, 19, 25, 0, 0, time.UTC), + Attributes: []attribute.KeyValue{ + attribute.Int64("attr1", 42), + attribute.String("attr2", "bar"), + attribute.IntSlice("attr3", []int{0, 1, 2}), + }, + Events: []tracesdk.Event{ + { + Time: time.Date(2020, time.March, 11, 19, 24, 30, 0, time.UTC), + Name: "ev1", + Attributes: []attribute.KeyValue{ + attribute.Int64("eventattr1", 123), + }, + }, + { + Time: time.Date(2020, time.March, 11, 19, 24, 45, 0, time.UTC), + Name: "ev2", + Attributes: nil, + }, + }, + Status: tracesdk.Status{ + Code: codes.Ok, + Description: "", + }, + Resource: res, + }, + // typical span data with ERROR status { SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, @@ -373,7 +451,49 @@ func TestModelConversion(t *testing.T) { }.Snapshots() expectedOutputBatch := []zkmodel.SpanModel{ - // model for typical span data + // model for typical span data with UNSET status + { + SpanContext: zkmodel.SpanContext{ + TraceID: zkmodel.TraceID{ + High: 0x001020304050607, + Low: 0x8090a0b0c0d0e0f, + }, + ID: zkmodel.ID(0xfffefdfcfbfaf9f8), + ParentID: zkmodelIDPtr(0x3f3e3d3c3b3a3938), + Debug: false, + Sampled: nil, + Err: nil, + }, + Name: "foo", + Kind: "SERVER", + Timestamp: time.Date(2020, time.March, 11, 19, 24, 0, 0, time.UTC), + Duration: time.Minute, + Shared: false, + LocalEndpoint: &zkmodel.Endpoint{ + ServiceName: "model-test", + }, + RemoteEndpoint: nil, + Annotations: []zkmodel.Annotation{ + { + Timestamp: time.Date(2020, time.March, 11, 19, 24, 30, 0, time.UTC), + Value: `ev1: {"eventattr1":123}`, + }, + { + Timestamp: time.Date(2020, time.March, 11, 19, 24, 45, 0, time.UTC), + Value: "ev2", + }, + }, + Tags: map[string]string{ + "attr1": "42", + "attr2": "bar", + "attr3": "[0,1,2]", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", + }, + }, + // model for typical span data with OK status { SpanContext: zkmodel.SpanContext{ TraceID: zkmodel.TraceID{ @@ -409,7 +529,50 @@ func TestModelConversion(t *testing.T) { "attr1": "42", "attr2": "bar", "attr3": "[0,1,2]", - "otel.status_code": "Error", + "otel.status_code": "OK", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", + }, + }, + // model for typical span data with ERROR status + { + SpanContext: zkmodel.SpanContext{ + TraceID: zkmodel.TraceID{ + High: 0x001020304050607, + Low: 0x8090a0b0c0d0e0f, + }, + ID: zkmodel.ID(0xfffefdfcfbfaf9f8), + ParentID: zkmodelIDPtr(0x3f3e3d3c3b3a3938), + Debug: false, + Sampled: nil, + Err: nil, + }, + Name: "foo", + Kind: "SERVER", + Timestamp: time.Date(2020, time.March, 11, 19, 24, 0, 0, time.UTC), + Duration: time.Minute, + Shared: false, + LocalEndpoint: &zkmodel.Endpoint{ + ServiceName: "model-test", + }, + RemoteEndpoint: nil, + Annotations: []zkmodel.Annotation{ + { + Timestamp: time.Date(2020, time.March, 11, 19, 24, 30, 0, time.UTC), + Value: `ev1: {"eventattr1":123}`, + }, + { + Timestamp: time.Date(2020, time.March, 11, 19, 24, 45, 0, time.UTC), + Value: "ev2", + }, + }, + Tags: map[string]string{ + "attr1": "42", + "attr2": "bar", + "attr3": "[0,1,2]", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -452,7 +615,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -495,7 +658,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -538,7 +701,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -587,7 +750,7 @@ func TestModelConversion(t *testing.T) { "net.peer.ip": "1.2.3.4", "net.peer.port": "9876", "peer.hostname": "test-peer-hostname", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -630,7 +793,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -673,7 +836,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -707,7 +870,7 @@ func TestModelConversion(t *testing.T) { Tags: map[string]string{ "attr1": "42", "attr2": "bar", - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "model-test", "service.version": "0.1.0", @@ -809,7 +972,40 @@ func TestTagsTransformation(t *testing.T) { want: nil, }, { - name: "statusCode", + name: "statusCode UNSET", + data: tracetest.SpanStub{ + Attributes: []attribute.KeyValue{ + attribute.String("key", keyValue), + }, + Status: tracesdk.Status{ + Code: codes.Unset, + Description: "", + }, + }, + want: map[string]string{ + "key": keyValue, + }, + }, + { + name: "statusCode OK", + data: tracetest.SpanStub{ + Attributes: []attribute.KeyValue{ + attribute.String("key", keyValue), + attribute.Bool("ok", true), + }, + Status: tracesdk.Status{ + Code: codes.Ok, + Description: "", + }, + }, + want: map[string]string{ + "key": keyValue, + "ok": "true", + "otel.status_code": "OK", + }, + }, + { + name: "statusCode ERROR", data: tracetest.SpanStub{ Attributes: []attribute.KeyValue{ attribute.String("key", keyValue), @@ -823,7 +1019,7 @@ func TestTagsTransformation(t *testing.T) { want: map[string]string{ "error": statusMessage, "key": keyValue, - "otel.status_code": codes.Error.String(), + "otel.status_code": "ERROR", }, }, { diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 16fb8bd98da..c5a4a6ac8f9 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -270,7 +270,7 @@ func TestExportSpans(t *testing.T) { RemoteEndpoint: nil, Annotations: nil, Tags: map[string]string{ - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "404, file not found", "service.name": "exporter-test", "service.version": "0.1.0", @@ -300,7 +300,7 @@ func TestExportSpans(t *testing.T) { RemoteEndpoint: nil, Annotations: nil, Tags: map[string]string{ - "otel.status_code": "Error", + "otel.status_code": "ERROR", "error": "403, forbidden", "service.name": "exporter-test", "service.version": "0.1.0", From 797e337676662dfad44f7fefe26a9da00dec3b6c Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 28 Oct 2022 17:13:26 -0400 Subject: [PATCH 297/886] [docs] Support redirect of placeholder-page paths to their targets (#3401) Co-authored-by: Tyler Yahn --- website_docs/api.md | 4 +--- website_docs/examples.md | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/website_docs/api.md b/website_docs/api.md index a5c5867f8d0..dc29c312b93 100644 --- a/website_docs/api.md +++ b/website_docs/api.md @@ -1,9 +1,7 @@ --- title: API reference linkTitle: API -# Note: this is a placeholder page. Attempting to visit this page will -# redirect to the following URL: -manualLink: https://pkg.go.dev/go.opentelemetry.io/otel +redirect: https://pkg.go.dev/go.opentelemetry.io/otel manualLinkTarget: _blank _build: { render: link } weight: 50 diff --git a/website_docs/examples.md b/website_docs/examples.md index 51a92b7d799..ff0ea28b1aa 100644 --- a/website_docs/examples.md +++ b/website_docs/examples.md @@ -1,8 +1,6 @@ --- title: Examples -# Note: this is a placeholder page. Attempting to visit this page will -# redirect to the following URL: -manualLink: https://github.com/open-telemetry/opentelemetry-go/tree/main/example +redirect: https://github.com/open-telemetry/opentelemetry-go/tree/main/example manualLinkTarget: _blank _build: { render: link } weight: 60 From 3b9862a771d2413a0cc787fd0ce219adef8531d1 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Fri, 28 Oct 2022 15:38:32 -0700 Subject: [PATCH 298/886] Clarify nature of Codes values w.r.t. OTLP (#3386) * Clarify nature of Codes values w.r.t. OTLP * Update codes/codes.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * go eff em tee dash ehs Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Tyler Yahn --- codes/codes.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codes/codes.go b/codes/codes.go index 064a9279fd1..587ebae4e30 100644 --- a/codes/codes.go +++ b/codes/codes.go @@ -23,10 +23,20 @@ import ( const ( // Unset is the default status code. Unset Code = 0 + // Error indicates the operation contains an error. + // + // NOTE: The error code in OTLP is 2. + // The value of this enum is only relevant to the internals + // of the Go SDK. Error Code = 1 + // Ok indicates operation has been validated by an Application developers // or Operator to have completed successfully, or contain no error. + // + // NOTE: The Ok code in OTLP is 1. + // The value of this enum is only relevant to the internals + // of the Go SDK. Ok Code = 2 maxCode = 3 From c8a13d63021d2a4bfb0a4872b808f453049cfac3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 31 Oct 2022 06:41:26 -0700 Subject: [PATCH 299/886] Remove deprecated golangci linters (#3409) The "deadcode", "structcheck", and "varcheck" linters are deprecated by golangci-lint. It is recommended by that project to use "unused" instead. The "unused" linter is already enabled, so this just removes the deprecated linters. --- .golangci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 253e3b35b52..9a74543dd58 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,7 +9,6 @@ linters: disable-all: true # Specifically enable linters we want to use. enable: - - deadcode - depguard - errcheck - godot @@ -21,10 +20,8 @@ linters: - misspell - revive - staticcheck - - structcheck - typecheck - unused - - varcheck issues: # Maximum issues count per one linter. From d1aca7b16719792a517f590063aa0ca44aced447 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 31 Oct 2022 07:55:54 -0700 Subject: [PATCH 300/886] Associate views with MeterProvider instead of Reader (#3387) * Split WithView from WithReader * Accept readers and views params in newPipelines * Update MeterProvider pipes init * Fix WithView comment * Fix view example MeterProvider option * Fix With{View,Reader} option in prom exporter test * Test Reader not required to be comparable * Add changes to changelog * Fix changelog option name --- CHANGELOG.md | 12 ++++ example/view/main.go | 5 +- exporters/prometheus/exporter_test.go | 3 +- sdk/metric/config.go | 34 +++++---- sdk/metric/config_test.go | 18 ++++- sdk/metric/pipeline.go | 6 +- sdk/metric/pipeline_registry_test.go | 99 +++++++++------------------ sdk/metric/provider.go | 2 +- sdk/metric/reader_test.go | 12 ++++ 9 files changed, 105 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a75865c5ba5..43c083fba4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,21 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. + This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) + +### Changed + +- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. + Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. + The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) + ### Fixed - The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369) +- Remove comparable requirement for `Reader`s. (#3387) - Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) diff --git a/example/view/main.go b/example/view/main.go index c8f1b246590..bafbe3c8920 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -66,7 +66,10 @@ func main() { log.Fatal(err) } - provider := metric.NewMeterProvider(metric.WithReader(exporter, customBucketsView, defaultView)) + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + metric.WithView(customBucketsView, defaultView), + ) meter := provider.Meter(meterName) // Start the prometheus HTTP server and pass the exporter Collector to it diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 27441e74ea1..a21458158c9 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -260,7 +260,8 @@ func TestPrometheusExporter(t *testing.T) { provider := metric.NewMeterProvider( metric.WithResource(res), - metric.WithReader(exporter, customBucketsView, defaultView), + metric.WithReader(exporter), + metric.WithView(customBucketsView, defaultView), ) meter := provider.Meter("testmeter") diff --git a/sdk/metric/config.go b/sdk/metric/config.go index 5b7537f63ed..ec1e06ab43b 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -26,7 +26,8 @@ import ( // config contains configuration options for a MeterProvider. type config struct { res *resource.Resource - readers map[Reader][]view.View + readers []Reader + views []view.View } // readerSignals returns a force-flush and shutdown function for a @@ -35,7 +36,7 @@ type config struct { // single functions. func (c config) readerSignals() (forceFlush, shutdown func(context.Context) error) { var fFuncs, sFuncs []func(context.Context) error - for r := range c.readers { + for _, r := range c.readers { sFuncs = append(sFuncs, r.Shutdown) fFuncs = append(fFuncs, r.ForceFlush) } @@ -112,21 +113,30 @@ func WithResource(res *resource.Resource) Option { }) } -// WithReader associates a Reader with a MeterProvider. Any passed view config -// will be used to associate a view with the Reader. If no views are passed -// the default view will be use for the Reader. -// -// Passing this option multiple times for the same Reader will overwrite. The -// last option passed will be the one used for that Reader. +// WithReader associates Reader r with a MeterProvider. // // By default, if this option is not used, the MeterProvider will perform no // operations; no data will be exported without a Reader. -func WithReader(r Reader, views ...view.View) Option { +func WithReader(r Reader) Option { return optionFunc(func(cfg config) config { - if cfg.readers == nil { - cfg.readers = make(map[Reader][]view.View) + if r == nil { + return cfg } - cfg.readers[r] = views + cfg.readers = append(cfg.readers, r) + return cfg + }) +} + +// WithView associates views a MeterProvider. +// +// Views are appended to existing ones in a MeterProvider if this option is +// used multiple times. +// +// By default, if this option is not used, the MeterProvider will use the +// default view. +func WithView(views ...view.View) Option { + return optionFunc(func(cfg config) config { + cfg.views = append(cfg.views, views...) return cfg }) } diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index ad88d6b9ff5..3c3659a46e7 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -127,5 +127,21 @@ func TestWithResource(t *testing.T) { func TestWithReader(t *testing.T) { r := &reader{} c := newConfig([]Option{WithReader(r)}) - assert.Contains(t, c.readers, r) + require.Len(t, c.readers, 1) + assert.Same(t, r, c.readers[0]) +} + +func TestWithView(t *testing.T) { + var views []view.View + + v, err := view.New(view.MatchInstrumentKind(view.AsyncCounter), view.WithRename("a")) + require.NoError(t, err) + views = append(views, v) + + v, err = view.New(view.MatchInstrumentKind(view.SyncCounter), view.WithRename("b")) + require.NoError(t, err) + views = append(views, v) + + c := newConfig([]Option{WithView(views...)}) + assert.Equal(t, views, c.views) } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index db70003b1d5..74a6cb713b1 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -416,13 +416,13 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio // measurement. type pipelines []*pipeline -func newPipelines(res *resource.Resource, readers map[Reader][]view.View) pipelines { +func newPipelines(res *resource.Resource, readers []Reader, views []view.View) pipelines { pipes := make([]*pipeline, 0, len(readers)) - for r, v := range readers { + for _, r := range readers { p := &pipeline{ resource: res, reader: r, - views: v, + views: views, } r.register(p) pipes = append(pipes, p) diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index eb27da9824e..a6ad6f81d23 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -257,7 +257,8 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { testCases := []struct { name string - views map[Reader][]view.View + readers []Reader + views []view.View inst view.Instrument wantCount int }{ @@ -266,72 +267,46 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { inst: view.Instrument{Name: "foo"}, }, { - name: "1 reader 1 view gets 1 aggregator", - inst: view.Instrument{Name: "foo"}, - views: map[Reader][]view.View{ - testRdr: { - {}, - }, - }, + name: "1 reader 1 view gets 1 aggregator", + inst: view.Instrument{Name: "foo"}, + readers: []Reader{testRdr}, + views: []view.View{{}}, wantCount: 1, }, { - name: "1 reader 2 views gets 2 aggregator", - inst: view.Instrument{Name: "foo"}, - views: map[Reader][]view.View{ - testRdr: { - {}, - renameView, - }, - }, + name: "1 reader 2 views gets 2 aggregator", + inst: view.Instrument{Name: "foo"}, + readers: []Reader{testRdr}, + views: []view.View{{}, renameView}, wantCount: 2, }, { - name: "2 readers 1 view each gets 2 aggregators", - inst: view.Instrument{Name: "foo"}, - views: map[Reader][]view.View{ - testRdr: { - {}, - }, - testRdrHistogram: { - {}, - }, - }, + name: "2 readers 1 view each gets 2 aggregators", + inst: view.Instrument{Name: "foo"}, + readers: []Reader{testRdr, testRdrHistogram}, + views: []view.View{{}}, wantCount: 2, }, { - name: "2 reader 2 views each gets 4 aggregators", - inst: view.Instrument{Name: "foo"}, - views: map[Reader][]view.View{ - testRdr: { - {}, - renameView, - }, - testRdrHistogram: { - {}, - renameView, - }, - }, + name: "2 reader 2 views each gets 4 aggregators", + inst: view.Instrument{Name: "foo"}, + readers: []Reader{testRdr, testRdrHistogram}, + views: []view.View{{}, renameView}, wantCount: 4, }, { - name: "An instrument is duplicated in two views share the same aggregator", - inst: view.Instrument{Name: "foo"}, - views: map[Reader][]view.View{ - testRdr: { - {}, - {}, - }, - }, + name: "An instrument is duplicated in two views share the same aggregator", + inst: view.Instrument{Name: "foo"}, + readers: []Reader{testRdr}, + views: []view.View{{}, {}}, wantCount: 1, }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - p := newPipelines(resource.Empty(), tt.views) + p := newPipelines(resource.Empty(), tt.readers, tt.views) testPipelineRegistryResolveIntAggregators(t, p, tt.wantCount) - p = newPipelines(resource.Empty(), tt.views) testPipelineRegistryResolveFloatAggregators(t, p, tt.wantCount) }) } @@ -362,11 +337,10 @@ func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, want func TestPipelineRegistryResource(t *testing.T) { v, err := view.New(view.MatchInstrumentName("bar"), view.WithRename("foo")) require.NoError(t, err) - views := map[Reader][]view.View{ - NewManualReader(): {{}, v}, - } + readers := []Reader{NewManualReader()} + views := []view.View{{}, v} res := resource.NewSchemaless(attribute.String("key", "val")) - pipes := newPipelines(res, views) + pipes := newPipelines(res, readers, views) for _, p := range pipes { assert.True(t, res.Equal(p.resource), "resource not set") } @@ -375,12 +349,9 @@ func TestPipelineRegistryResource(t *testing.T) { func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) - views := map[Reader][]view.View{ - testRdrHistogram: { - {}, - }, - } - p := newPipelines(resource.Empty(), views) + readers := []Reader{testRdrHistogram} + views := []view.View{{}} + p := newPipelines(resource.Empty(), readers, views) inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} vc := cache[string, instrumentID]{} @@ -389,8 +360,6 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { assert.Error(t, err) assert.Len(t, intAggs, 0) - p = newPipelines(resource.Empty(), views) - rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) floatAggs, err := rf.Aggregators(inst, unit.Dimensionless) assert.Error(t, err) @@ -421,17 +390,13 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { view.MatchInstrumentName("bar"), view.WithRename("foo"), ) - views := map[Reader][]view.View{ - NewManualReader(): { - {}, - renameView, - }, - } + readers := []Reader{NewManualReader()} + views := []view.View{{}, renameView} fooInst := view.Instrument{Name: "foo", Kind: view.SyncCounter} barInst := view.Instrument{Name: "bar", Kind: view.SyncCounter} - p := newPipelines(resource.Empty(), views) + p := newPipelines(resource.Empty(), readers, views) vc := cache[string, instrumentID]{} ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index ce2e5524398..b90ae4ff445 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -45,7 +45,7 @@ func NewMeterProvider(options ...Option) *MeterProvider { conf := newConfig(options) flush, sdown := conf.readerSignals() return &MeterProvider{ - pipes: newPipelines(conf.res, conf.readers), + pipes: newPipelines(conf.res, conf.readers, conf.views), forceFlush: flush, shutdown: sdown, } diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index f005ada472f..43f923a1564 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -236,3 +236,15 @@ func TestDefaultTemporalitySelector(t *testing.T) { assert.Equal(t, metricdata.CumulativeTemporality, DefaultTemporalitySelector(ik)) } } + +type notComparable [0]func() // nolint:unused // non-comparable type itself is used. + +type noCompareReader struct { + notComparable // nolint:unused // non-comparable type itself is used. + Reader +} + +func TestReadersNotRequiredToBeComparable(t *testing.T) { + r := noCompareReader{Reader: NewManualReader()} + assert.NotPanics(t, func() { _ = NewMeterProvider(WithReader(r)) }) +} From cc1eaec68316f938d6f008c76f96128c2f008b5d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 08:54:41 -0700 Subject: [PATCH 301/886] dependabot updates Mon Oct 31 15:24:02 UTC 2022 (#3433) Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /schema Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/stdout/stdoutmetric Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/prometheus Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/zipkin Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /trace Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/jaeger Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /metric Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /exporters/otlp/otlptrace Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /sdk/metric Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /bridge/opencensus Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 in /sdk Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 Co-authored-by: MrAlias --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +++- bridge/opencensus/test/go.sum | 2 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 +++- example/fib/go.sum | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.sum | 2 +- example/opencensus/go.sum | 2 +- example/otel-collector/go.sum | 2 +- example/passthrough/go.sum | 2 +- example/prometheus/go.sum | 2 +- example/view/go.sum | 2 +- example/zipkin/go.sum | 2 +- exporters/jaeger/go.mod | 4 ++-- exporters/jaeger/go.sum | 6 ++++-- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 +++- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +++- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +++- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +++- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +++- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +++- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +++- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +++- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +++- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +++- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +++- go.mod | 2 +- go.sum | 4 +++- internal/tools/go.mod | 4 ++-- internal/tools/go.sum | 6 ++++-- metric/go.mod | 2 +- metric/go.sum | 4 +++- schema/go.mod | 2 +- schema/go.sum | 4 +++- sdk/go.mod | 2 +- sdk/go.sum | 4 +++- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +++- trace/go.mod | 2 +- trace/go.sum | 4 +++- 52 files changed, 99 insertions(+), 57 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index bd4cf3f2f39..3a65f0988b8 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.18 require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opencensus.io v0.23.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 1e8937cc420..2e53c4be0f8 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -46,10 +46,12 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 69316a9a980..0d11e114d67 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -40,7 +40,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index f7282992cd4..731771df3d2 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 ) diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 7c9b2c7f304..7a028416b02 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -13,10 +13,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/fib/go.sum b/example/fib/go.sum index 5f623871eb7..924770f5797 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index ce9a79004f8..5f94580ae51 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -6,8 +6,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 5f623871eb7..924770f5797 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 69316a9a980..0d11e114d67 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -40,7 +40,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index d874d90e638..56919f794c1 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -146,7 +146,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 5f623871eb7..924770f5797 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 42e3a4fae25..7bb5c997cae 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -196,7 +196,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/view/go.sum b/example/view/go.sum index 42e3a4fae25..7bb5c997cae 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -196,7 +196,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 73746b61094..f0bcd897167 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -8,7 +8,7 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index d595fdaec4b..75359276e80 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.4.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 1bf71aafa65..bb18ca1cda2 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -11,11 +11,13 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 43e063e764b..8306361a9da 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/cenkalti/backoff/v4 v4.1.3 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 ) require ( diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index c2fad1cbfbe..469153569c0 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -7,9 +7,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 7595918db18..8aeb85acdd0 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 4cde6cd7628..bc0259cb876 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -148,12 +148,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 8fb2675e61f..f9e6f24056c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,7 +5,7 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 4cde6cd7628..bc0259cb876 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -148,12 +148,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index fbba45646c3..433ec6ffc28 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,7 +5,7 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 4cde6cd7628..bc0259cb876 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -148,12 +148,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f3c1f81e3aa..304068ea81e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 4cde6cd7628..bc0259cb876 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -148,12 +148,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 60491675c97..1d2169ed2aa 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.18 require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index dcf954aa463..de17ea53294 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -147,12 +147,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index e0064aaa3f0..1afa1d12faa 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.18 require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 53fc3ea2e74..af16c3f1b61 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -147,12 +147,14 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 9daa2429f34..6f8527c0d05 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/prometheus/client_golang v1.13.0 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 03a59e064e4..4d6765d3aee 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -196,12 +196,14 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 1a355a79be0..586d6da2c25 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric go 1.18 require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index a3ac11a377c..c9d4248db68 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -11,9 +11,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index f95cdc5a8a5..4c4defb6ca7 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index a3ac11a377c..c9d4248db68 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -11,9 +11,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 542257b8a2b..9b3a14cf0fa 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index b047284b72b..f22db78c280 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -14,9 +14,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/go.mod b/go.mod index 264395ca01a..6edc52deaf0 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel/trace v1.11.1 ) diff --git a/go.sum b/go.sum index 434a9b5ba63..50d5c27f84b 100644 --- a/go.sum +++ b/go.sum @@ -12,9 +12,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b9ef8a1ed2c..b5c83a33e74 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -165,8 +165,8 @@ require ( github.com/spf13/viper v1.12.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect - github.com/stretchr/objx v0.4.0 // indirect - github.com/stretchr/testify v1.8.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect + github.com/stretchr/testify v1.8.1 // indirect github.com/subosito/gotenv v1.4.1 // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index e86a4390a9a..97e2d44ccea 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -555,8 +555,9 @@ github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -566,8 +567,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= diff --git a/metric/go.mod b/metric/go.mod index 3cc65ed0bf2..12eff7a0de9 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/metric go 1.18 require ( - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 ) diff --git a/metric/go.sum b/metric/go.sum index 8e553d1b103..1685a59f6e2 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -11,9 +11,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/schema/go.mod b/schema/go.mod index 2c27161702f..b57de2292c5 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/Masterminds/semver/v3 v3.1.1 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index d1dba122e56..1db3ecb277d 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -7,9 +7,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sdk/go.mod b/sdk/go.mod index 1b56802baf5..022ad8ce1f2 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 diff --git a/sdk/go.sum b/sdk/go.sum index b42b5132f09..d71e51729eb 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -12,9 +12,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 611493511ef..e5395f84c26 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index a3ac11a377c..c9d4248db68 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -11,9 +11,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/trace/go.mod b/trace/go.mod index 70645bbe424..66d0ec6fe9d 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 ) diff --git a/trace/go.sum b/trace/go.sum index 5e92189882c..64456627351 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -7,9 +7,11 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 8a390acc3490d0095c6f151e13cbcf9a2cb69540 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 31 Oct 2022 18:59:05 -0700 Subject: [PATCH 302/886] Recommend not recording cumulative explicit histogram min/max (#3403) * Recommend not recording cumulative hist min/max * Update sdk/metric/aggregation/aggregation.go Co-authored-by: David Ashpole Co-authored-by: Chester Cheung Co-authored-by: David Ashpole --- sdk/metric/aggregation/aggregation.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go index e1da10f53f1..f1c215069f4 100644 --- a/sdk/metric/aggregation/aggregation.go +++ b/sdk/metric/aggregation/aggregation.go @@ -121,7 +121,12 @@ type ExplicitBucketHistogram struct { // (500.0, 1000.0], (1000.0, +∞) Boundaries []float64 // NoMinMax indicates whether to not record the min and max of the - // distribution. By default, these extremes are recorded. + // distribution. By default, these extrema are recorded. + // + // Recording these extrema for cumulative data is expected to have little + // value, they will represent the entire life of the instrument instead of + // just the current collection cycle. It is recommended to set this to true + // for that type of data to avoid computing the low-value extrema. NoMinMax bool } From 48a05478e238698e02b4025ac95a11ecd6bcc5ad Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 1 Nov 2022 07:56:18 -0700 Subject: [PATCH 303/886] Move Aggregation/Temporality selection to the Exporter interface (#3260) * Add Aggregation/Temporality to Exporter iface * Use Exporter selectors in periodic reader * Move selector opts to just manual reader * Simplify periodic reader ref to Exporter selectors * Fix the periodic reader tests * Add Aggregation/Temporality method to stdoutmetric * Add Temporality/Aggregation to otlpmetric exp * Add Temporality/Aggregation to http/grpc otlp clients * Add oconf tests for selector opts * Add tests to stdoutmetric for opts * Correct comment subject * Add changes to changelog * Fix otest test client --- CHANGELOG.md | 4 ++ exporters/otlp/otlpmetric/client.go | 9 +++ exporters/otlp/otlpmetric/exporter.go | 34 ++++++++- exporters/otlp/otlpmetric/exporter_test.go | 11 +++ .../otlp/otlpmetric/internal/oconf/options.go | 42 +++++++++++ .../otlpmetric/internal/oconf/options_test.go | 43 ++++++++++++ .../otlpmetric/internal/otest/client_test.go | 12 ++++ .../otlp/otlpmetric/otlpmetricgrpc/client.go | 19 +++++ .../otlp/otlpmetric/otlpmetricgrpc/config.go | 18 +++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 19 +++++ .../otlp/otlpmetric/otlpmetrichttp/config.go | 18 +++++ exporters/stdout/stdoutmetric/config.go | 68 +++++++++++++++++- exporters/stdout/stdoutmetric/exporter.go | 18 ++++- .../stdout/stdoutmetric/exporter_test.go | 32 +++++++++ sdk/metric/exporter.go | 8 +++ sdk/metric/manual_reader.go | 50 +++++++++++++ sdk/metric/periodic_reader.go | 22 ++---- sdk/metric/periodic_reader_test.go | 45 +++++++----- sdk/metric/reader.go | 70 ------------------- 19 files changed, 436 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c083fba4d..69e781dc659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`. Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option. The views registered with the `MeterProvider` apply to all `Reader`s. (#3387) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260) +- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) +- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) +- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) ### Fixed diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/client.go index 9bcbab44f48..0e522fa939a 100644 --- a/exporters/otlp/otlpmetric/client.go +++ b/exporters/otlp/otlpmetric/client.go @@ -17,11 +17,20 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "context" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) // Client handles the transmission of OTLP data to an OTLP receiving endpoint. type Client interface { + // Temporality returns the Temporality to use for an instrument kind. + Temporality(view.InstrumentKind) metricdata.Temporality + + // Aggregation returns the Aggregation to use for an instrument kind. + Aggregation(view.InstrumentKind) aggregation.Aggregation + // UploadMetrics transmits metric data to an OTLP receiver. // // All retry logic must be handled by UploadMetrics alone, the Exporter diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 2967a5f7b24..296f500d411 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -21,7 +21,9 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -34,6 +36,20 @@ type exporter struct { shutdownOnce sync.Once } +// Temporality returns the Temporality to use for an instrument kind. +func (e *exporter) Temporality(k view.InstrumentKind) metricdata.Temporality { + e.clientMu.Lock() + defer e.clientMu.Unlock() + return e.client.Temporality(k) +} + +// Aggregation returns the Aggregation to use for an instrument kind. +func (e *exporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + e.clientMu.Lock() + defer e.clientMu.Unlock() + return e.client.Aggregation(k) +} + // Export transforms and transmits metric data to an OTLP receiver. func (e *exporter) Export(ctx context.Context, rm metricdata.ResourceMetrics) error { otlpRm, err := transform.ResourceMetrics(rm) @@ -68,7 +84,10 @@ func (e *exporter) Shutdown(ctx context.Context) error { e.shutdownOnce.Do(func() { e.clientMu.Lock() client := e.client - e.client = shutdownClient{} + e.client = shutdownClient{ + temporalitySelector: client.Temporality, + aggregationSelector: client.Aggregation, + } e.clientMu.Unlock() err = client.Shutdown(ctx) }) @@ -82,7 +101,10 @@ func New(client Client) metric.Exporter { return &exporter{client: client} } -type shutdownClient struct{} +type shutdownClient struct { + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector +} func (c shutdownClient) err(ctx context.Context) error { if err := ctx.Err(); err != nil { @@ -91,6 +113,14 @@ func (c shutdownClient) err(ctx context.Context) error { return errShutdown } +func (c shutdownClient) Temporality(k view.InstrumentKind) metricdata.Temporality { + return c.temporalitySelector(k) +} + +func (c shutdownClient) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return c.aggregationSelector(k) +} + func (c shutdownClient) UploadMetrics(ctx context.Context, _ *mpb.ResourceMetrics) error { return c.err(ctx) } diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index fd644140d37..972d0cbf8fe 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -21,7 +21,10 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -31,6 +34,14 @@ type client struct { n int } +func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { + return metric.DefaultTemporalitySelector(k) +} + +func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return metric.DefaultAggregationSelector(k) +} + func (c *client) UploadMetrics(context.Context, *mpb.ResourceMetrics) error { c.n++ return nil diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index f7d44071442..cf5da7e40f9 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -27,6 +27,10 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/view" ) const ( @@ -57,6 +61,9 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials + + TemporalitySelector metric.TemporalitySelector + AggregationSelector metric.AggregationSelector } Config struct { @@ -82,6 +89,9 @@ func NewHTTPConfig(opts ...HTTPOption) Config { URLPath: DefaultMetricsPath, Compression: NoCompression, Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, } @@ -102,6 +112,9 @@ func NewGRPCConfig(opts ...GRPCOption) Config { URLPath: DefaultMetricsPath, Compression: NoCompression, Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())}, @@ -313,3 +326,32 @@ func WithTimeout(duration time.Duration) GenericOption { return cfg }) } + +func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.TemporalitySelector = selector + return cfg + }) +} + +func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { + // Deep copy and validate before using. + wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = metric.DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.AggregationSelector = wrapped + return cfg + }) +} diff --git a/exporters/otlp/otlpmetric/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go index e436eb5b07e..51dddd09533 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options_test.go @@ -23,6 +23,9 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" ) const ( @@ -383,6 +386,38 @@ func TestConfigs(t *testing.T) { assert.Equal(t, c.Metrics.Timeout, 5*time.Second) }, }, + + // Temporality Selector Tests + { + name: "WithTemporalitySelector", + opts: []oconf.GenericOption{ + oconf.WithTemporalitySelector(deltaSelector), + }, + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a TemporalitySelector here to ensure our "catch + // all" was set. + var undefinedKind view.InstrumentKind + got := c.Metrics.TemporalitySelector + assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) + }, + }, + + // Aggregation Selector Tests + { + name: "WithAggregationSelector", + opts: []oconf.GenericOption{ + oconf.WithAggregationSelector(dropSelector), + }, + asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a AggregationSelector here to ensure our "catch + // all" was set. + var undefinedKind view.InstrumentKind + got := c.Metrics.AggregationSelector + assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + }, + }, } for _, tt := range tests { @@ -406,6 +441,14 @@ func TestConfigs(t *testing.T) { } } +func dropSelector(view.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} +} + +func deltaSelector(view.InstrumentKind) metricdata.Temporality { + return metricdata.DeltaTemporality +} + func asHTTPOptions(opts []oconf.GenericOption) []oconf.HTTPOption { converted := make([]oconf.HTTPOption, len(opts)) for i, o := range opts { diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 09f98ee809b..e701d10b8db 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -19,6 +19,10 @@ import ( "testing" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -27,6 +31,14 @@ type client struct { storage *Storage } +func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { + return metric.DefaultTemporalitySelector(k) +} + +func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return metric.DefaultAggregationSelector(k) +} + func (c *client) Collect() *Storage { return c.storage } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 4c5beb8f384..0f1a0040f61 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -28,6 +28,9 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -53,6 +56,9 @@ type client struct { exportTimeout time.Duration requestFunc retry.RequestFunc + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector + // ourConn keeps track of where conn was created: true if created here in // NewClient, or false if passed with an option. This is important on // Shutdown as the conn should only be closed if we created it. Otherwise, @@ -70,6 +76,9 @@ func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error exportTimeout: cfg.Metrics.Timeout, requestFunc: cfg.RetryConfig.RequestFunc(retryable), conn: cfg.GRPCConn, + + temporalitySelector: cfg.Metrics.TemporalitySelector, + aggregationSelector: cfg.Metrics.AggregationSelector, } if len(cfg.Metrics.Headers) > 0 { @@ -94,6 +103,16 @@ func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error return c, nil } +// Temporality returns the Temporality to use for an instrument kind. +func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { + return c.temporalitySelector(k) +} + +// Aggregation returns the Aggregation to use for an instrument kind. +func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return c.aggregationSelector(k) +} + // ForceFlush does nothing, the client holds no state. func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go index 5f7a66e559e..3b9539c7187 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric" ) // Option applies a configuration option to the Exporter. @@ -236,3 +237,20 @@ func WithTimeout(duration time.Duration) Option { func WithRetry(settings RetryConfig) Option { return wrappedOption{oconf.WithRetry(retry.Config(settings))} } + +// WithTemporalitySelector sets the TemporalitySelector the client will use to +// determine the Temporality of an instrument based on its kind. If this option +// is not used, the client will use the DefaultTemporalitySelector from the +// go.opentelemetry.io/otel/sdk/metric package. +func WithTemporalitySelector(selector metric.TemporalitySelector) Option { + return wrappedOption{oconf.WithTemporalitySelector(selector)} +} + +// WithAggregationSelector sets the AggregationSelector the client will use to +// determine the aggregation to use for an instrument based on its kind. If +// this option is not used, the reader will use the DefaultAggregationSelector +// from the go.opentelemetry.io/otel/sdk/metric package, or the aggregation +// explicitly passed for a view matching an instrument. +func WithAggregationSelector(selector metric.AggregationSelector) Option { + return wrappedOption{oconf.WithAggregationSelector(selector)} +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 0840a2c8fa6..9d1bac13f49 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -34,6 +34,9 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -55,6 +58,9 @@ type client struct { compression Compression requestFunc retry.RequestFunc httpClient *http.Client + + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector } // Keep it in sync with golang's DefaultTransport from net/http! We @@ -116,9 +122,22 @@ func newClient(opts ...Option) (otlpmetric.Client, error) { req: req, requestFunc: cfg.RetryConfig.RequestFunc(evaluate), httpClient: httpClient, + + temporalitySelector: cfg.Metrics.TemporalitySelector, + aggregationSelector: cfg.Metrics.AggregationSelector, }, nil } +// Temporality returns the Temporality to use for an instrument kind. +func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { + return c.temporalitySelector(k) +} + +// Aggregation returns the Aggregation to use for an instrument kind. +func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return c.aggregationSelector(k) +} + // ForceFlush does nothing, the client holds no state. func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go index c320c25d406..e9f7c774642 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric" ) // Compression describes the compression used for payloads sent to the @@ -179,3 +180,20 @@ func WithTimeout(duration time.Duration) Option { func WithRetry(rc RetryConfig) Option { return wrappedOption{oconf.WithRetry(retry.Config(rc))} } + +// WithTemporalitySelector sets the TemporalitySelector the client will use to +// determine the Temporality of an instrument based on its kind. If this option +// is not used, the client will use the DefaultTemporalitySelector from the +// go.opentelemetry.io/otel/sdk/metric package. +func WithTemporalitySelector(selector metric.TemporalitySelector) Option { + return wrappedOption{oconf.WithTemporalitySelector(selector)} +} + +// WithAggregationSelector sets the AggregationSelector the client will use to +// determine the aggregation to use for an instrument based on its kind. If +// this option is not used, the reader will use the DefaultAggregationSelector +// from the go.opentelemetry.io/otel/sdk/metric package, or the aggregation +// explicitly passed for a view matching an instrument. +func WithAggregationSelector(selector metric.AggregationSelector) Option { + return wrappedOption{oconf.WithAggregationSelector(selector)} +} diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index c2f02da1ecf..2b40806c96d 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -16,11 +16,18 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdout import ( "encoding/json" "os" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/view" ) // config contains options for the exporter. type config struct { - encoder *encoderHolder + encoder *encoderHolder + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector } // newConfig creates a validated config configured with options. @@ -36,6 +43,14 @@ func newConfig(options ...Option) config { cfg.encoder = &encoderHolder{encoder: enc} } + if cfg.temporalitySelector == nil { + cfg.temporalitySelector = metric.DefaultTemporalitySelector + } + + if cfg.aggregationSelector == nil { + cfg.aggregationSelector = metric.DefaultAggregationSelector + } + return cfg } @@ -60,3 +75,54 @@ func WithEncoder(encoder Encoder) Option { return c }) } + +// WithTemporalitySelector sets the TemporalitySelector the exporter will use +// to determine the Temporality of an instrument based on its kind. If this +// option is not used, the exporter will use the DefaultTemporalitySelector +// from the go.opentelemetry.io/otel/sdk/metric package. +func WithTemporalitySelector(selector metric.TemporalitySelector) Option { + return temporalitySelectorOption{selector: selector} +} + +type temporalitySelectorOption struct { + selector metric.TemporalitySelector +} + +func (t temporalitySelectorOption) apply(c config) config { + c.temporalitySelector = t.selector + return c +} + +// WithAggregationSelector sets the AggregationSelector the exporter will use +// to determine the aggregation to use for an instrument based on its kind. If +// this option is not used, the exporter will use the +// DefaultAggregationSelector from the go.opentelemetry.io/otel/sdk/metric +// package or the aggregation explicitly passed for a view matching an +// instrument. +func WithAggregationSelector(selector metric.AggregationSelector) Option { + // Deep copy and validate before using. + wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = metric.DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return aggregationSelectorOption{selector: wrapped} +} + +type aggregationSelectorOption struct { + selector metric.AggregationSelector +} + +func (t aggregationSelectorOption) apply(c config) config { + c.aggregationSelector = t.selector + return c +} diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index fef517fa833..8a9d55a4979 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -20,7 +20,9 @@ import ( "sync/atomic" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" ) // exporter is an OpenTelemetry metric exporter. @@ -28,6 +30,9 @@ type exporter struct { encVal atomic.Value // encoderHolder shutdownOnce sync.Once + + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector } // New returns a configured metric exporter. @@ -36,11 +41,22 @@ type exporter struct { // encoder with tab indentations that output to STDOUT. func New(options ...Option) (metric.Exporter, error) { cfg := newConfig(options...) - exp := &exporter{} + exp := &exporter{ + temporalitySelector: cfg.temporalitySelector, + aggregationSelector: cfg.aggregationSelector, + } exp.encVal.Store(*cfg.encoder) return exp, nil } +func (e *exporter) Temporality(k view.InstrumentKind) metricdata.Temporality { + return e.temporalitySelector(k) +} + +func (e *exporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + return e.aggregationSelector(k) +} + func (e *exporter) Export(ctx context.Context, data metricdata.ResourceMetrics) error { select { case <-ctx.Done(): diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index fa2a05401e8..a7c3abb9bd1 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -25,7 +25,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" ) func testEncoderOption() stdoutmetric.Option { @@ -97,3 +99,33 @@ func TestShutdownExporterReturnsShutdownErrorOnExport(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) assert.EqualError(t, exp.Export(ctx, data), "exporter shutdown") } + +func deltaSelector(view.InstrumentKind) metricdata.Temporality { + return metricdata.DeltaTemporality +} + +func TestTemporalitySelector(t *testing.T) { + exp, err := stdoutmetric.New( + testEncoderOption(), + stdoutmetric.WithTemporalitySelector(deltaSelector), + ) + require.NoError(t, err) + + var unknownKind view.InstrumentKind + assert.Equal(t, metricdata.DeltaTemporality, exp.Temporality(unknownKind)) +} + +func dropSelector(view.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} +} + +func TestAggregationSelector(t *testing.T) { + exp, err := stdoutmetric.New( + testEncoderOption(), + stdoutmetric.WithAggregationSelector(dropSelector), + ) + require.NoError(t, err) + + var unknownKind view.InstrumentKind + assert.Equal(t, aggregation.Drop{}, exp.Aggregation(unknownKind)) +} diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 79257db0fc6..687d3eae9a6 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -18,7 +18,9 @@ import ( "context" "fmt" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/view" ) // ErrExporterShutdown is returned if Export or Shutdown are called after an @@ -28,6 +30,12 @@ var ErrExporterShutdown = fmt.Errorf("exporter is shutdown") // Exporter handles the delivery of metric data to external receivers. This is // the final component in the metric push pipeline. type Exporter interface { + // Temporality returns the Temporality to use for an instrument kind. + Temporality(view.InstrumentKind) metricdata.Temporality + + // Aggregation returns the Aggregation to use for an instrument kind. + Aggregation(view.InstrumentKind) aggregation.Aggregation + // Export serializes and transmits metric data to a receiver. // // This is called synchronously, there is no concurrency safety diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index ad932be793b..62ccf0f0535 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -129,3 +129,53 @@ func newManualReaderConfig(opts []ManualReaderOption) manualReaderConfig { type ManualReaderOption interface { applyManual(manualReaderConfig) manualReaderConfig } + +// WithTemporalitySelector sets the TemporalitySelector a reader will use to +// determine the Temporality of an instrument based on its kind. If this +// option is not used, the reader will use the DefaultTemporalitySelector. +func WithTemporalitySelector(selector TemporalitySelector) ManualReaderOption { + return temporalitySelectorOption{selector: selector} +} + +type temporalitySelectorOption struct { + selector func(instrument view.InstrumentKind) metricdata.Temporality +} + +// applyManual returns a manualReaderConfig with option applied. +func (t temporalitySelectorOption) applyManual(mrc manualReaderConfig) manualReaderConfig { + mrc.temporalitySelector = t.selector + return mrc +} + +// WithAggregationSelector sets the AggregationSelector a reader will use to +// determine the aggregation to use for an instrument based on its kind. If +// this option is not used, the reader will use the DefaultAggregationSelector +// or the aggregation explicitly passed for a view matching an instrument. +func WithAggregationSelector(selector AggregationSelector) ManualReaderOption { + // Deep copy and validate before using. + wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return aggregationSelectorOption{selector: wrapped} +} + +type aggregationSelectorOption struct { + selector AggregationSelector +} + +// applyManual returns a manualReaderConfig with option applied. +func (t aggregationSelectorOption) applyManual(c manualReaderConfig) manualReaderConfig { + c.aggregationSelector = t.selector + return c +} diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 3f705086162..3dc7ed2d045 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -36,20 +36,16 @@ const ( // periodicReaderConfig contains configuration options for a PeriodicReader. type periodicReaderConfig struct { - interval time.Duration - timeout time.Duration - temporalitySelector TemporalitySelector - aggregationSelector AggregationSelector + interval time.Duration + timeout time.Duration } // newPeriodicReaderConfig returns a periodicReaderConfig configured with // options. func newPeriodicReaderConfig(options []PeriodicReaderOption) periodicReaderConfig { c := periodicReaderConfig{ - interval: defaultInterval, - timeout: defaultTimeout, - temporalitySelector: DefaultTemporalitySelector, - aggregationSelector: DefaultAggregationSelector, + interval: defaultInterval, + timeout: defaultTimeout, } for _, o := range options { c = o.applyPeriodic(c) @@ -118,9 +114,6 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade flushCh: make(chan chan error), cancel: cancel, done: make(chan struct{}), - - temporalitySelector: conf.temporalitySelector, - aggregationSelector: conf.aggregationSelector, } go func() { @@ -140,9 +133,6 @@ type periodicReader struct { exporter Exporter flushCh chan chan error - temporalitySelector TemporalitySelector - aggregationSelector AggregationSelector - done chan struct{} cancel context.CancelFunc shutdownOnce sync.Once @@ -187,12 +177,12 @@ func (r *periodicReader) register(p producer) { // temporality reports the Temporality for the instrument kind provided. func (r *periodicReader) temporality(kind view.InstrumentKind) metricdata.Temporality { - return r.temporalitySelector(kind) + return r.exporter.Temporality(kind) } // aggregation returns what Aggregation to use for kind. func (r *periodicReader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. - return r.aggregationSelector(kind) + return r.exporter.Aggregation(kind) } // collectAndExport gather all metric data related to the periodicReader r from diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 8c3c0599158..c0bf06a3086 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/suite" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/view" ) @@ -54,13 +55,29 @@ func TestWithInterval(t *testing.T) { } type fnExporter struct { - exportFunc func(context.Context, metricdata.ResourceMetrics) error - flushFunc func(context.Context) error - shutdownFunc func(context.Context) error + temporalityFunc TemporalitySelector + aggregationFunc AggregationSelector + exportFunc func(context.Context, metricdata.ResourceMetrics) error + flushFunc func(context.Context) error + shutdownFunc func(context.Context) error } var _ Exporter = (*fnExporter)(nil) +func (e *fnExporter) Temporality(k view.InstrumentKind) metricdata.Temporality { + if e.temporalityFunc != nil { + return e.temporalityFunc(k) + } + return DefaultTemporalitySelector(k) +} + +func (e *fnExporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { + if e.aggregationFunc != nil { + return e.aggregationFunc(k) + } + return DefaultAggregationSelector(k) +} + func (e *fnExporter) Export(ctx context.Context, m metricdata.ResourceMetrics) error { if e.exportFunc != nil { return e.exportFunc(ctx, m) @@ -230,29 +247,25 @@ func BenchmarkPeriodicReader(b *testing.B) { func TestPeriodiclReaderTemporality(t *testing.T) { tests := []struct { - name string - options []PeriodicReaderOption + name string + exporter *fnExporter // Currently only testing constant temporality. This should be expanded // if we put more advanced selection in the SDK wantTemporality metricdata.Temporality }{ { name: "default", + exporter: new(fnExporter), wantTemporality: metricdata.CumulativeTemporality, }, { - name: "delta", - options: []PeriodicReaderOption{ - WithTemporalitySelector(deltaTemporalitySelector), - }, + name: "delta", + exporter: &fnExporter{temporalityFunc: deltaTemporalitySelector}, wantTemporality: metricdata.DeltaTemporality, }, { - name: "repeats overwrite", - options: []PeriodicReaderOption{ - WithTemporalitySelector(deltaTemporalitySelector), - WithTemporalitySelector(cumulativeTemporalitySelector), - }, + name: "cumulative", + exporter: &fnExporter{temporalityFunc: cumulativeTemporalitySelector}, wantTemporality: metricdata.CumulativeTemporality, }, } @@ -260,8 +273,8 @@ func TestPeriodiclReaderTemporality(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var undefinedInstrument view.InstrumentKind - rdr := NewPeriodicReader(new(fnExporter), tt.options...) - assert.Equal(t, tt.wantTemporality, rdr.temporality(undefinedInstrument)) + rdr := NewPeriodicReader(tt.exporter) + assert.Equal(t, tt.wantTemporality.String(), rdr.temporality(undefinedInstrument).String()) }) } } diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index e5a1282db6b..53c13c4bffe 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -18,7 +18,6 @@ import ( "context" "fmt" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/view" @@ -108,13 +107,6 @@ func (p shutdownProducer) produce(context.Context) (metricdata.ResourceMetrics, return metricdata.ResourceMetrics{}, ErrReaderShutdown } -// ReaderOption applies a configuration option value to either a ManualReader or -// a PeriodicReader. -type ReaderOption interface { - ManualReaderOption - PeriodicReaderOption -} - // TemporalitySelector selects the temporality to use based on the InstrumentKind. type TemporalitySelector func(view.InstrumentKind) metricdata.Temporality @@ -125,29 +117,6 @@ func DefaultTemporalitySelector(view.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } -// WithTemporalitySelector sets the TemporalitySelector a reader will use to -// determine the Temporality of an instrument based on its kind. If this -// option is not used, the reader will use the DefaultTemporalitySelector. -func WithTemporalitySelector(selector TemporalitySelector) ReaderOption { - return temporalitySelectorOption{selector: selector} -} - -type temporalitySelectorOption struct { - selector func(instrument view.InstrumentKind) metricdata.Temporality -} - -// applyManual returns a manualReaderConfig with option applied. -func (t temporalitySelectorOption) applyManual(mrc manualReaderConfig) manualReaderConfig { - mrc.temporalitySelector = t.selector - return mrc -} - -// applyPeriodic returns a periodicReaderConfig with option applied. -func (t temporalitySelectorOption) applyPeriodic(prc periodicReaderConfig) periodicReaderConfig { - prc.temporalitySelector = t.selector - return prc -} - // AggregationSelector selects the aggregation and the parameters to use for // that aggregation based on the InstrumentKind. type AggregationSelector func(view.InstrumentKind) aggregation.Aggregation @@ -172,42 +141,3 @@ func DefaultAggregationSelector(ik view.InstrumentKind) aggregation.Aggregation } panic("unknown instrument kind") } - -// WithAggregationSelector sets the AggregationSelector a reader will use to -// determine the aggregation to use for an instrument based on its kind. If -// this option is not used, the reader will use the DefaultAggregationSelector -// or the aggregation explicitly passed for a view matching an instrument. -func WithAggregationSelector(selector AggregationSelector) ReaderOption { - // Deep copy and validate before using. - wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - - return aggregationSelectorOption{selector: wrapped} -} - -type aggregationSelectorOption struct { - selector AggregationSelector -} - -// applyManual returns a manualReaderConfig with option applied. -func (t aggregationSelectorOption) applyManual(c manualReaderConfig) manualReaderConfig { - c.aggregationSelector = t.selector - return c -} - -// applyPeriodic returns a periodicReaderConfig with option applied. -func (t aggregationSelectorOption) applyPeriodic(c periodicReaderConfig) periodicReaderConfig { - c.aggregationSelector = t.selector - return c -} From 49b62aef665325d78fe23c4ebe791eb0184a4a65 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Tue, 1 Nov 2022 08:50:49 -0700 Subject: [PATCH 304/886] New benchmark derived from otel-launcher-go (#3395) * New benchmark derived from otel-launcher-go * edit * refactoring from PR feedback * refactoring from PR feedback * update for upstream main * revert view change Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- sdk/metric/benchmark_test.go | 105 +++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sdk/metric/benchmark_test.go diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go new file mode 100644 index 00000000000..d26f598f676 --- /dev/null +++ b/sdk/metric/benchmark_test.go @@ -0,0 +1,105 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/sdk/metric/view" +) + +func benchCounter(b *testing.B, views ...view.View) (context.Context, Reader, syncint64.Counter) { + ctx := context.Background() + rdr := NewManualReader() + provider := NewMeterProvider(WithReader(rdr), WithView(views...)) + cntr, _ := provider.Meter("test").SyncInt64().Counter("hello") + b.ResetTimer() + b.ReportAllocs() + return ctx, rdr, cntr +} + +func BenchmarkCounterAddNoAttrs(b *testing.B) { + ctx, _, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1) + } +} + +func BenchmarkCounterAddOneAttr(b *testing.B) { + ctx, _, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.String("K", "V")) + } +} + +func BenchmarkCounterAddOneInvalidAttr(b *testing.B) { + ctx, _, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.String("", "V"), attribute.String("K", "V")) + } +} + +func BenchmarkCounterAddSingleUseAttrs(b *testing.B) { + ctx, _, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.Int("K", i)) + } +} + +func BenchmarkCounterAddSingleUseInvalidAttrs(b *testing.B) { + ctx, _, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.Int("", i), attribute.Int("K", i)) + } +} + +func BenchmarkCounterAddSingleUseFilteredAttrs(b *testing.B) { + vw, _ := view.New(view.WithFilterAttributes(attribute.Key("K"))) + + ctx, _, cntr := benchCounter(b, vw) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.Int("L", i), attribute.Int("K", i)) + } +} + +func BenchmarkCounterCollectOneAttr(b *testing.B) { + ctx, rdr, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + cntr.Add(ctx, 1, attribute.Int("K", 1)) + + _, _ = rdr.Collect(ctx) + } +} + +func BenchmarkCounterCollectTenAttrs(b *testing.B) { + ctx, rdr, cntr := benchCounter(b) + + for i := 0; i < b.N; i++ { + for j := 0; j < 10; j++ { + cntr.Add(ctx, 1, attribute.Int("K", j)) + } + _, _ = rdr.Collect(ctx) + } +} From e8023fab22dc1cf95b47dafcc8ac8110c6e72da1 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Wed, 2 Nov 2022 22:50:37 +0800 Subject: [PATCH 305/886] prometheus exporter convert instrumentation scope to otel_scope_info metric (#3357) * prometheus exporter convert instrumentation scope to otel_scope_info metric Signed-off-by: Ziqi Zhao * fix for commits Signed-off-by: Ziqi Zhao * fix for ci failed Signed-off-by: Ziqi Zhao * add multi scopes test Signed-off-by: Ziqi Zhao * fix ci failed Signed-off-by: Ziqi Zhao Signed-off-by: Ziqi Zhao --- CHANGELOG.md | 2 + exporters/prometheus/config.go | 11 +++ exporters/prometheus/exporter.go | 67 +++++++++++--- exporters/prometheus/exporter_test.go | 89 ++++++++++++++++++- exporters/prometheus/testdata/counter.txt | 7 +- .../prometheus/testdata/custom_resource.txt | 5 +- .../prometheus/testdata/empty_resource.txt | 5 +- exporters/prometheus/testdata/gauge.txt | 5 +- exporters/prometheus/testdata/histogram.txt | 29 +++--- .../prometheus/testdata/multi_scopes.txt | 13 +++ .../prometheus/testdata/sanitized_labels.txt | 5 +- .../prometheus/testdata/sanitized_names.txt | 45 +++++----- .../without_scope_and_target_info.txt | 3 + .../testdata/without_scope_info.txt | 6 ++ .../testdata/without_target_info.txt | 5 +- 15 files changed, 242 insertions(+), 55 deletions(-) create mode 100644 exporters/prometheus/testdata/multi_scopes.txt create mode 100644 exporters/prometheus/testdata/without_scope_and_target_info.txt create mode 100644 exporters/prometheus/testdata/without_scope_info.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 69e781dc659..e6682f1cca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) +- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. + This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) ### Changed diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index 31b34ccf426..5d50564d34a 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -26,6 +26,7 @@ type config struct { disableTargetInfo bool withoutUnits bool aggregation metric.AggregationSelector + disableScopeInfo bool } // newConfig creates a validated config configured with options. @@ -105,3 +106,13 @@ func WithoutUnits() Option { return cfg }) } + +// WithoutScopeInfo configures the Exporter to not export the otel_scope_info metric. +// If not specified, the Exporter will create a otel_scope_info metric containing +// the metrics' Instrumentation Scope, and also add labels about Instrumentation Scope to all metric points. +func WithoutScopeInfo() Option { + return optionFunc(func(cfg config) config { + cfg.disableScopeInfo = true + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 6920d2bb328..2cb23cc19fb 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -36,8 +37,13 @@ import ( const ( targetInfoMetricName = "target_info" targetInfoDescription = "Target metadata" + + scopeInfoMetricName = "otel_scope_info" + scopeInfoDescription = "Instrumentation Scope metadata" ) +var scopeInfoKeys = [2]string{"otel_scope_name", "otel_scope_version"} + // Exporter is a Prometheus Exporter that embeds the OTel metric.Reader // interface for easy instantiation with a MeterProvider. type Exporter struct { @@ -53,7 +59,9 @@ type collector struct { disableTargetInfo bool withoutUnits bool targetInfo prometheus.Metric + disableScopeInfo bool createTargetInfoOnce sync.Once + scopeInfos map[instrumentation.Scope]prometheus.Metric } // prometheus counters MUST have a _total suffix: @@ -73,6 +81,8 @@ func New(opts ...Option) (*Exporter, error) { reader: reader, disableTargetInfo: cfg.disableTargetInfo, withoutUnits: cfg.withoutUnits, + disableScopeInfo: cfg.disableScopeInfo, + scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), } if err := cfg.registerer.Register(collector); err != nil { @@ -118,28 +128,46 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { if !c.disableTargetInfo { ch <- c.targetInfo } + for _, scopeMetrics := range metrics.ScopeMetrics { + var keys, values [2]string + + if !c.disableScopeInfo { + scopeInfo, ok := c.scopeInfos[scopeMetrics.Scope] + if !ok { + scopeInfo, err = createScopeInfoMetric(scopeMetrics.Scope) + if err != nil { + otel.Handle(err) + } + c.scopeInfos[scopeMetrics.Scope] = scopeInfo + } + ch <- scopeInfo + keys = scopeInfoKeys + values = [2]string{scopeMetrics.Scope.Name, scopeMetrics.Scope.Version} + } + for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { case metricdata.Histogram: - addHistogramMetric(ch, v, m, c.getName(m)) + addHistogramMetric(ch, v, m, keys, values, c.getName(m)) case metricdata.Sum[int64]: - addSumMetric(ch, v, m, c.getName(m)) + addSumMetric(ch, v, m, keys, values, c.getName(m)) case metricdata.Sum[float64]: - addSumMetric(ch, v, m, c.getName(m)) + addSumMetric(ch, v, m, keys, values, c.getName(m)) case metricdata.Gauge[int64]: - addGaugeMetric(ch, v, m, c.getName(m)) + addGaugeMetric(ch, v, m, keys, values, c.getName(m)) case metricdata.Gauge[float64]: - addGaugeMetric(ch, v, m, c.getName(m)) + addGaugeMetric(ch, v, m, keys, values, c.getName(m)) } } } } -func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, name string) { +func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, ks, vs [2]string, name string) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars for _, dp := range histogram.DataPoints { - keys, values := getAttrs(dp.Attributes) + keys, values := getAttrs(dp.Attributes, ks, vs) + desc := prometheus.NewDesc(name, m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) @@ -157,7 +185,7 @@ func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histog } } -func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, name string) { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string) { valueType := prometheus.CounterValue if !sum.IsMonotonic { valueType = prometheus.GaugeValue @@ -167,7 +195,8 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata name += counterSuffix } for _, dp := range sum.DataPoints { - keys, values := getAttrs(dp.Attributes) + keys, values := getAttrs(dp.Attributes, ks, vs) + desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, valueType, float64(dp.Value), values...) if err != nil { @@ -178,9 +207,10 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata } } -func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, name string) { +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string) { for _, dp := range gauge.DataPoints { - keys, values := getAttrs(dp.Attributes) + keys, values := getAttrs(dp.Attributes, ks, vs) + desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(dp.Value), values...) if err != nil { @@ -194,7 +224,7 @@ func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metric // getAttrs parses the attribute.Set to two lists of matching Prometheus-style // keys and values. It sanitizes invalid characters and handles duplicate keys // (due to sanitization) by sorting and concatenating the values following the spec. -func getAttrs(attrs attribute.Set) ([]string, []string) { +func getAttrs(attrs attribute.Set, ks, vs [2]string) ([]string, []string) { keysMap := make(map[string][]string) itr := attrs.Iter() for itr.Next() { @@ -217,15 +247,26 @@ func getAttrs(attrs attribute.Set) ([]string, []string) { }) values = append(values, strings.Join(vals, ";")) } + + if ks[0] != "" { + keys = append(keys, ks[:]...) + values = append(values, vs[:]...) + } return keys, values } func (c *collector) createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { - keys, values := getAttrs(*res.Set()) + keys, values := getAttrs(*res.Set(), [2]string{}, [2]string{}) desc := prometheus.NewDesc(name, description, keys, nil) return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) } +func createScopeInfoMetric(scope instrumentation.Scope) (prometheus.Metric, error) { + keys := scopeInfoKeys[:] + desc := prometheus.NewDesc(scopeInfoMetricName, scopeInfoDescription, keys, nil) + return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), scope.Name, scope.Version) +} + func sanitizeRune(r rune) rune { if unicode.IsLetter(r) || unicode.IsDigit(r) || r == ':' || r == '_' { return r diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index a21458158c9..f4769ce4ffd 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -21,6 +21,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" @@ -221,6 +222,44 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 9, attrs...) }, }, + { + name: "without scope_info", + options: []Option{WithoutScopeInfo()}, + expectedFile: "testdata/without_scope_info.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + gauge, err := meter.SyncInt64().UpDownCounter( + "bar", + instrument.WithDescription("a fun little gauge"), + instrument.WithUnit(unit.Dimensionless), + ) + require.NoError(t, err) + gauge.Add(ctx, 2, attrs...) + gauge.Add(ctx, -1, attrs...) + }, + }, + { + name: "without scope_info and target_info", + options: []Option{WithoutScopeInfo(), WithoutTargetInfo()}, + expectedFile: "testdata/without_scope_and_target_info.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + } + counter, err := meter.SyncInt64().Counter( + "bar", + instrument.WithDescription("a fun little counter"), + instrument.WithUnit(unit.Bytes), + ) + require.NoError(t, err) + counter.Add(ctx, 2, attrs...) + counter.Add(ctx, 1, attrs...) + }, + }, } for _, tc := range testCases { @@ -263,7 +302,10 @@ func TestPrometheusExporter(t *testing.T) { metric.WithReader(exporter), metric.WithView(customBucketsView, defaultView), ) - meter := provider.Meter("testmeter") + meter := provider.Meter( + "testmeter", + otelmetric.WithInstrumentationVersion("v0.1.0"), + ) tc.recordMetrics(ctx, meter) @@ -306,3 +348,48 @@ func TestSantitizeName(t *testing.T) { require.Equalf(t, test.want, sanitizeName(test.input), "input: %q", test.input) } } + +func TestMultiScopes(t *testing.T) { + ctx := context.Background() + registry := prometheus.NewRegistry() + exporter, err := New(WithRegisterer(registry)) + require.NoError(t, err) + + res, err := resource.New(ctx, + // always specify service.name because the default depends on the running OS + resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), + // Overwrite the semconv.TelemetrySDKVersionKey value so we don't need to update every version + resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + ) + require.NoError(t, err) + res, err = resource.Merge(resource.Default(), res) + require.NoError(t, err) + + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + metric.WithResource(res), + ) + + fooCounter, err := provider.Meter("meterfoo", otelmetric.WithInstrumentationVersion("v0.1.0")). + SyncInt64().Counter( + "foo", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter foo counter")) + assert.NoError(t, err) + fooCounter.Add(ctx, 100, attribute.String("type", "foo")) + + barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). + SyncInt64().Counter( + "bar", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter bar counter")) + assert.NoError(t, err) + barCounter.Add(ctx, 200, attribute.String("type", "bar")) + + file, err := os.Open("testdata/multi_scopes.txt") + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, file.Close()) }) + + err = testutil.GatherAndCompare(registry, file) + require.NoError(t, err) +} diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 5da63dd144a..79a1e7a5b37 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,7 +1,10 @@ # HELP foo_milliseconds_total a simple counter # TYPE foo_milliseconds_total counter -foo_milliseconds_total{A="B",C="D",E="true",F="42"} 24.3 -foo_milliseconds_total{A="D",C="B",E="true",F="42"} 5 +foo_milliseconds_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +foo_milliseconds_total{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/custom_resource.txt b/exporters/prometheus/testdata/custom_resource.txt index 581833b56d0..9b2a19ad480 100755 --- a/exporters/prometheus/testdata/custom_resource.txt +++ b/exporters/prometheus/testdata/custom_resource.txt @@ -1,6 +1,9 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42"} 24.3 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{A="B",C="D",service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/empty_resource.txt b/exporters/prometheus/testdata/empty_resource.txt index 02c41c6bac6..e313006e34b 100755 --- a/exporters/prometheus/testdata/empty_resource.txt +++ b/exporters/prometheus/testdata/empty_resource.txt @@ -1,6 +1,9 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42"} 24.3 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info 1 diff --git a/exporters/prometheus/testdata/gauge.txt b/exporters/prometheus/testdata/gauge.txt index cd75e5a6507..33d2b218b3f 100644 --- a/exporters/prometheus/testdata/gauge.txt +++ b/exporters/prometheus/testdata/gauge.txt @@ -1,6 +1,9 @@ # HELP bar_ratio a fun little gauge # TYPE bar_ratio gauge -bar_ratio{A="B",C="D"} .75 +bar_ratio{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} .75 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/histogram.txt b/exporters/prometheus/testdata/histogram.txt index 3f4a1366049..f8016f38583 100644 --- a/exporters/prometheus/testdata/histogram.txt +++ b/exporters/prometheus/testdata/histogram.txt @@ -1,18 +1,21 @@ # HELP histogram_baz_bytes a very nice histogram # TYPE histogram_baz_bytes histogram -histogram_baz_bytes_bucket{A="B",C="D",le="0"} 0 -histogram_baz_bytes_bucket{A="B",C="D",le="5"} 0 -histogram_baz_bytes_bucket{A="B",C="D",le="10"} 1 -histogram_baz_bytes_bucket{A="B",C="D",le="25"} 2 -histogram_baz_bytes_bucket{A="B",C="D",le="50"} 2 -histogram_baz_bytes_bucket{A="B",C="D",le="75"} 2 -histogram_baz_bytes_bucket{A="B",C="D",le="100"} 2 -histogram_baz_bytes_bucket{A="B",C="D",le="250"} 4 -histogram_baz_bytes_bucket{A="B",C="D",le="500"} 4 -histogram_baz_bytes_bucket{A="B",C="D",le="1000"} 4 -histogram_baz_bytes_bucket{A="B",C="D",le="+Inf"} 4 -histogram_baz_bytes_sum{A="B",C="D"} 236 -histogram_baz_bytes_count{A="B",C="D"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="0",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0 +histogram_baz_bytes_bucket{A="B",C="D",le="5",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0 +histogram_baz_bytes_bucket{A="B",C="D",le="10",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +histogram_baz_bytes_bucket{A="B",C="D",le="25",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="50",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="75",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="100",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 2 +histogram_baz_bytes_bucket{A="B",C="D",le="250",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="500",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="1000",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 +histogram_baz_bytes_bucket{A="B",C="D",le="+Inf",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 +histogram_baz_bytes_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 236 +histogram_baz_bytes_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 4 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/multi_scopes.txt b/exporters/prometheus/testdata/multi_scopes.txt new file mode 100644 index 00000000000..38d84c79ede --- /dev/null +++ b/exporters/prometheus/testdata/multi_scopes.txt @@ -0,0 +1,13 @@ +# HELP bar_milliseconds_total meter bar counter +# TYPE bar_milliseconds_total counter +bar_milliseconds_total{otel_scope_name="meterbar",otel_scope_version="v0.1.0",type="bar"} 200 +# HELP foo_milliseconds_total meter foo counter +# TYPE foo_milliseconds_total counter +foo_milliseconds_total{otel_scope_name="meterfoo",otel_scope_version="v0.1.0",type="foo"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="meterfoo",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="meterbar",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/sanitized_labels.txt b/exporters/prometheus/testdata/sanitized_labels.txt index 40be2b01aab..06eee59354e 100755 --- a/exporters/prometheus/testdata/sanitized_labels.txt +++ b/exporters/prometheus/testdata/sanitized_labels.txt @@ -1,6 +1,9 @@ # HELP foo_total a sanitary counter # TYPE foo_total counter -foo_total{A_B="Q",C_D="Y;Z"} 24.3 +foo_total{A_B="Q",C_D="Y;Z",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/sanitized_names.txt b/exporters/prometheus/testdata/sanitized_names.txt index 0d321b3fae9..d87e8101ce2 100644 --- a/exporters/prometheus/testdata/sanitized_names.txt +++ b/exporters/prometheus/testdata/sanitized_names.txt @@ -1,32 +1,35 @@ # HELP bar a fun little gauge # TYPE bar gauge -bar{A="B",C="D"} 75 +bar{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 75 # HELP _0invalid_counter_name_total a counter with an invalid name # TYPE _0invalid_counter_name_total counter -_0invalid_counter_name_total{A="B",C="D"} 100 +_0invalid_counter_name_total{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 100 # HELP invalid_gauge_name a gauge with an invalid name # TYPE invalid_gauge_name gauge -invalid_gauge_name{A="B",C="D"} 100 +invalid_gauge_name{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 100 # HELP invalid_hist_name a histogram with an invalid name # TYPE invalid_hist_name histogram -invalid_hist_name_bucket{A="B",C="D",le="0"} 0 -invalid_hist_name_bucket{A="B",C="D",le="5"} 0 -invalid_hist_name_bucket{A="B",C="D",le="10"} 0 -invalid_hist_name_bucket{A="B",C="D",le="25"} 1 -invalid_hist_name_bucket{A="B",C="D",le="50"} 1 -invalid_hist_name_bucket{A="B",C="D",le="75"} 1 -invalid_hist_name_bucket{A="B",C="D",le="100"} 1 -invalid_hist_name_bucket{A="B",C="D",le="250"} 1 -invalid_hist_name_bucket{A="B",C="D",le="500"} 1 -invalid_hist_name_bucket{A="B",C="D",le="750"} 1 -invalid_hist_name_bucket{A="B",C="D",le="1000"} 1 -invalid_hist_name_bucket{A="B",C="D",le="2500"} 1 -invalid_hist_name_bucket{A="B",C="D",le="5000"} 1 -invalid_hist_name_bucket{A="B",C="D",le="7500"} 1 -invalid_hist_name_bucket{A="B",C="D",le="10000"} 1 -invalid_hist_name_bucket{A="B",C="D",le="+Inf"} 1 -invalid_hist_name_sum{A="B",C="D"} 23 -invalid_hist_name_count{A="B",C="D"} 1 +invalid_hist_name_bucket{A="B",C="D",le="0",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0 +invalid_hist_name_bucket{A="B",C="D",le="5",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0 +invalid_hist_name_bucket{A="B",C="D",le="10",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 0 +invalid_hist_name_bucket{A="B",C="D",le="25",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="50",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="75",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="100",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="250",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="500",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="750",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="1000",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="2500",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="5000",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="7500",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="10000",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_bucket{A="B",C="D",le="+Inf",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +invalid_hist_name_sum{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 23 +invalid_hist_name_count{A="B",C="D",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 # HELP target_info Target metadata # TYPE target_info gauge target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/without_scope_and_target_info.txt b/exporters/prometheus/testdata/without_scope_and_target_info.txt new file mode 100644 index 00000000000..9a551fd8ef2 --- /dev/null +++ b/exporters/prometheus/testdata/without_scope_and_target_info.txt @@ -0,0 +1,3 @@ +# HELP bar_bytes_total a fun little counter +# TYPE bar_bytes_total counter +bar_bytes_total{A="B",C="D"} 3 diff --git a/exporters/prometheus/testdata/without_scope_info.txt b/exporters/prometheus/testdata/without_scope_info.txt new file mode 100644 index 00000000000..445743ac9a7 --- /dev/null +++ b/exporters/prometheus/testdata/without_scope_info.txt @@ -0,0 +1,6 @@ +# HELP bar_ratio a fun little gauge +# TYPE bar_ratio gauge +bar_ratio{A="B",C="D"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/without_target_info.txt b/exporters/prometheus/testdata/without_target_info.txt index b434b536fac..69f0e836688 100755 --- a/exporters/prometheus/testdata/without_target_info.txt +++ b/exporters/prometheus/testdata/without_target_info.txt @@ -1,3 +1,6 @@ # HELP foo_total a simple counter # TYPE foo_total counter -foo_total{A="B",C="D",E="true",F="42"} 24.3 +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 From b5b685249cb2d2b8a3da72ed4d9c057ee6d0ba38 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 3 Nov 2022 09:02:39 -0700 Subject: [PATCH 306/886] Do not handle empty partial OTLP successes (#3438) * Do not handle empty partial OTLP successes Fix #3432. The OTLP server will respond with empty partial success responses (i.e. empty messages and 0 count). Treat these as equivalent to it not being set/present like the documentation specifies in the proto: https://github.com/open-telemetry/opentelemetry-proto/blob/724e427879e3d2bae2edc0218fff06e37b9eb46e/opentelemetry/proto/collector/trace/v1/trace_service.proto#L58 * Fix tests * Add changes to changelog --- CHANGELOG.md | 1 + exporters/otlp/internal/partialsuccess.go | 34 ++++++++----------- .../otlp/internal/partialsuccess_test.go | 9 +++-- .../otlp/otlptrace/otlptracegrpc/client.go | 11 +++--- .../otlp/otlptrace/otlptracehttp/client.go | 11 +++--- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6682f1cca3..65c829728c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/exporters/otlp/internal/partialsuccess.go b/exporters/otlp/internal/partialsuccess.go index 7994706ab51..9ab89b37574 100644 --- a/exporters/otlp/internal/partialsuccess.go +++ b/exporters/otlp/internal/partialsuccess.go @@ -16,19 +16,6 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" import "fmt" -// PartialSuccessDropKind indicates the kind of partial success error -// received by an OTLP exporter, which corresponds with the signal -// being exported. -type PartialSuccessDropKind string - -const ( - // TracingPartialSuccess indicates that some spans were rejected. - TracingPartialSuccess PartialSuccessDropKind = "spans" - - // MetricsPartialSuccess indicates that some metric data points were rejected. - MetricsPartialSuccess PartialSuccessDropKind = "metric data points" -) - // PartialSuccess represents the underlying error for all handling // OTLP partial success messages. Use `errors.Is(err, // PartialSuccess{})` to test whether an error passed to the OTel @@ -36,7 +23,7 @@ const ( type PartialSuccess struct { ErrorMessage string RejectedItems int64 - RejectedKind PartialSuccessDropKind + RejectedKind string } var _ error = PartialSuccess{} @@ -56,13 +43,22 @@ func (ps PartialSuccess) Is(err error) bool { return ok } -// PartialSuccessToError produces an error suitable for passing to -// `otel.Handle()` out of the fields in a partial success response, -// independent of which signal produced the outcome. -func PartialSuccessToError(kind PartialSuccessDropKind, itemsRejected int64, errorMessage string) error { +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { return PartialSuccess{ ErrorMessage: errorMessage, RejectedItems: itemsRejected, - RejectedKind: kind, + RejectedKind: "metric data points", } } diff --git a/exporters/otlp/internal/partialsuccess_test.go b/exporters/otlp/internal/partialsuccess_test.go index 3a7b0f0a6ef..9032f244cc4 100644 --- a/exporters/otlp/internal/partialsuccess_test.go +++ b/exporters/otlp/internal/partialsuccess_test.go @@ -36,9 +36,8 @@ func requireErrorString(t *testing.T, expect string, err error) { } func TestPartialSuccessFormat(t *testing.T) { - requireErrorString(t, "empty message (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, "")) - requireErrorString(t, "help help (0 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 0, "help help")) - requireErrorString(t, "what happened (10 metric data points rejected)", PartialSuccessToError(MetricsPartialSuccess, 10, "what happened")) - requireErrorString(t, "what happened (15 spans rejected)", PartialSuccessToError(TracingPartialSuccess, 15, "what happened")) - requireErrorString(t, "empty message (7 log records rejected)", PartialSuccessToError("log records", 7, "")) + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) } diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 9d6e1898b14..fe23f8e3766 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -202,11 +202,12 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ResourceSpans: protoSpans, }) if resp != nil && resp.PartialSuccess != nil { - otel.Handle(internal.PartialSuccessToError( - internal.TracingPartialSuccess, - resp.PartialSuccess.RejectedSpans, - resp.PartialSuccess.ErrorMessage, - )) + msg := resp.PartialSuccess.GetErrorMessage() + n := resp.PartialSuccess.GetRejectedSpans() + if n != 0 || msg != "" { + err := internal.TracePartialSuccessError(n, msg) + otel.Handle(err) + } } // nil is converted to OK. if status.Code(err) == codes.OK { diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 8f742dfc1bd..79b8af73286 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -180,11 +180,12 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc } if respProto.PartialSuccess != nil { - otel.Handle(internal.PartialSuccessToError( - internal.TracingPartialSuccess, - respProto.PartialSuccess.RejectedSpans, - respProto.PartialSuccess.ErrorMessage, - )) + msg := respProto.PartialSuccess.GetErrorMessage() + n := respProto.PartialSuccess.GetRejectedSpans() + if n != 0 || msg != "" { + err := internal.TracePartialSuccessError(n, msg) + otel.Handle(err) + } } } return nil From 6dccc07388c0a736e2ebff15ce5d597f1f39fe5b Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 3 Nov 2022 17:18:45 -0500 Subject: [PATCH 307/886] Disables context-as-argument linter (#3385) This is currently incompatible with viper v1.13.0. Status for the linter found at https://github.com/golangci/golangci-lint/issues/3280 --- .golangci.yml | 3 ++- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9a74543dd58..0f099f57595 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -111,8 +111,9 @@ linters-settings: - name: constant-logical-expr disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument + # TODO (#3372) reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - name: context-as-argument - disabled: false + disabled: true arguments: allowTypesBefore: "*testing.T" # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b5c83a33e74..e64631efd02 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -53,7 +53,7 @@ require ( github.com/fatih/color v1.13.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect - github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.6.5 // indirect github.com/go-git/gcfg v1.5.0 // indirect @@ -157,12 +157,12 @@ require ( github.com/sivchari/tenv v1.7.0 // indirect github.com/sonatard/noctx v0.0.1 // indirect github.com/sourcegraph/go-diff v0.6.1 // indirect - github.com/spf13/afero v1.8.2 // indirect + github.com/spf13/afero v1.9.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.12.0 // indirect + github.com/spf13/viper v1.13.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 97e2d44ccea..123e6d9e2f2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -147,8 +147,8 @@ github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phm github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= @@ -536,8 +536,8 @@ github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= -github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= +github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= @@ -547,8 +547,8 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= -github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= +github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= +github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= @@ -812,12 +812,12 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 7707ce3d4f90b2d97d2ce6f287d74d46a83036ae Mon Sep 17 00:00:00 2001 From: Wisdom Matthew <40186491+wisdommatt@users.noreply.github.com> Date: Sun, 6 Nov 2022 15:59:23 +0100 Subject: [PATCH 308/886] docs(metric): document public interfaces with versioning policy (#3441) * docs(metric): document public interfaces with versioning policy * docs(metric): remove versioning policy warning from interfaces without public method(s) --- metric/instrument/asyncfloat64/asyncfloat64.go | 8 ++++++++ metric/instrument/asyncint64/asyncint64.go | 8 ++++++++ metric/instrument/syncfloat64/syncfloat64.go | 8 ++++++++ metric/instrument/syncint64/syncint64.go | 8 ++++++++ metric/meter.go | 4 ++++ 5 files changed, 36 insertions(+) diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 17bda2ceee1..330a14c2f64 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -22,6 +22,8 @@ import ( ) // InstrumentProvider provides access to individual instruments. +// +// Warning: methods may be added to this interface in minor releases. type InstrumentProvider interface { // Counter creates an instrument for recording increasing values. Counter(name string, opts ...instrument.Option) (Counter, error) @@ -34,6 +36,8 @@ type InstrumentProvider interface { } // Counter is an instrument that records increasing values. +// +// Warning: methods may be added to this interface in minor releases. type Counter interface { // Observe records the state of the instrument to be x. Implementations // will assume x to be the cumulative sum of the count. @@ -47,6 +51,8 @@ type Counter interface { } // UpDownCounter is an instrument that records increasing or decreasing values. +// +// Warning: methods may be added to this interface in minor releases. type UpDownCounter interface { // Observe records the state of the instrument to be x. Implementations // will assume x to be the cumulative sum of the count. @@ -60,6 +66,8 @@ type UpDownCounter interface { } // Gauge is an instrument that records independent readings. +// +// Warning: methods may be added to this interface in minor releases. type Gauge interface { // Observe records the state of the instrument to be x. // diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 1e17988e827..4fce9963c3b 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -22,6 +22,8 @@ import ( ) // InstrumentProvider provides access to individual instruments. +// +// Warning: methods may be added to this interface in minor releases. type InstrumentProvider interface { // Counter creates an instrument for recording increasing values. Counter(name string, opts ...instrument.Option) (Counter, error) @@ -34,6 +36,8 @@ type InstrumentProvider interface { } // Counter is an instrument that records increasing values. +// +// Warning: methods may be added to this interface in minor releases. type Counter interface { // Observe records the state of the instrument to be x. Implementations // will assume x to be the cumulative sum of the count. @@ -47,6 +51,8 @@ type Counter interface { } // UpDownCounter is an instrument that records increasing or decreasing values. +// +// Warning: methods may be added to this interface in minor releases. type UpDownCounter interface { // Observe records the state of the instrument to be x. Implementations // will assume x to be the cumulative sum of the count. @@ -60,6 +66,8 @@ type UpDownCounter interface { } // Gauge is an instrument that records independent readings. +// +// Warning: methods may be added to this interface in minor releases. type Gauge interface { // Observe records the state of the instrument to be x. // diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go index 435db1127bc..2ec192f70d8 100644 --- a/metric/instrument/syncfloat64/syncfloat64.go +++ b/metric/instrument/syncfloat64/syncfloat64.go @@ -22,6 +22,8 @@ import ( ) // InstrumentProvider provides access to individual instruments. +// +// Warning: methods may be added to this interface in minor releases. type InstrumentProvider interface { // Counter creates an instrument for recording increasing values. Counter(name string, opts ...instrument.Option) (Counter, error) @@ -32,6 +34,8 @@ type InstrumentProvider interface { } // Counter is an instrument that records increasing values. +// +// Warning: methods may be added to this interface in minor releases. type Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) @@ -40,6 +44,8 @@ type Counter interface { } // UpDownCounter is an instrument that records increasing or decreasing values. +// +// Warning: methods may be added to this interface in minor releases. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) @@ -48,6 +54,8 @@ type UpDownCounter interface { } // Histogram is an instrument that records a distribution of values. +// +// Warning: methods may be added to this interface in minor releases. type Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go index c77a4672860..03b5d53e636 100644 --- a/metric/instrument/syncint64/syncint64.go +++ b/metric/instrument/syncint64/syncint64.go @@ -22,6 +22,8 @@ import ( ) // InstrumentProvider provides access to individual instruments. +// +// Warning: methods may be added to this interface in minor releases. type InstrumentProvider interface { // Counter creates an instrument for recording increasing values. Counter(name string, opts ...instrument.Option) (Counter, error) @@ -32,6 +34,8 @@ type InstrumentProvider interface { } // Counter is an instrument that records increasing values. +// +// Warning: methods may be added to this interface in minor releases. type Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) @@ -40,6 +44,8 @@ type Counter interface { } // UpDownCounter is an instrument that records increasing or decreasing values. +// +// Warning: methods may be added to this interface in minor releases. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) @@ -48,6 +54,8 @@ type UpDownCounter interface { } // Histogram is an instrument that records a distribution of values. +// +// Warning: methods may be added to this interface in minor releases. type Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) diff --git a/metric/meter.go b/metric/meter.go index 21fc1c499fb..23e6853afbb 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -26,6 +26,8 @@ import ( // MeterProvider provides access to named Meter instances, for instrumenting // an application or library. +// +// Warning: methods may be added to this interface in minor releases. type MeterProvider interface { // Meter creates an instance of a `Meter` interface. The instrumentationName // must be the name of the library providing instrumentation. This name may @@ -36,6 +38,8 @@ type MeterProvider interface { } // Meter provides access to instrument instances for recording metrics. +// +// Warning: methods may be added to this interface in minor releases. type Meter interface { // AsyncInt64 is the namespace for the Asynchronous Integer instruments. // From 29270fb758149e690b24bf0d59a2f8b9801c05b6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 10:47:52 -0800 Subject: [PATCH 309/886] dependabot updates Sun Nov 6 18:37:14 UTC 2022 (#3450) Bump github.com/prometheus/client_golang from 1.13.0 to 1.13.1 in /example/view Bump go.opencensus.io from 0.23.0 to 0.24.0 in /example/opencensus Bump github.com/prometheus/client_golang from 1.13.0 to 1.13.1 in /exporters/prometheus Bump go.opencensus.io from 0.23.0 to 0.24.0 in /bridge/opencensus/test Bump github.com/prometheus/client_golang from 1.13.0 to 1.13.1 in /example/prometheus Bump go.opencensus.io from 0.23.0 to 0.24.0 in /bridge/opencensus Bump lycheeverse/lychee-action from 1.5.1 to 1.5.2 Bump benchmark-action/github-action-benchmark from 1.14.0 to 1.15.0 Co-authored-by: MrAlias --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 5 ++--- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 12 +++++++++--- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 12 +++++++++--- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 15 ++++++++++++--- 14 files changed, 47 insertions(+), 27 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 3a65f0988b8..91b13091c37 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opencensus.io v0.23.0 + go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 2e53c4be0f8..7192f84c13b 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -47,13 +47,12 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 4eedcd91327..c3846724c3e 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus/test go 1.18 require ( - go.opencensus.io v0.23.0 + go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/bridge/opencensus v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 0d11e114d67..ddd27a7e01e 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -5,6 +5,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -39,10 +40,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -95,5 +100,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 6041ed2c4ca..2f639b4b6e2 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -9,7 +9,7 @@ replace ( ) require ( - go.opencensus.io v0.23.0 + go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/bridge/opencensus v0.33.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.33.0 diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 0d11e114d67..ddd27a7e01e 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -5,6 +5,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -39,10 +40,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -95,5 +100,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1459fb67754..b15e7aa81f3 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.18 require ( - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.13.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/prometheus v0.33.0 go.opentelemetry.io/otel/metric v0.33.0 diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 7bb5c997cae..f68f958bee4 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -167,8 +167,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= +github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/example/view/go.mod b/example/view/go.mod index e1757a55a41..885885796c4 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.18 require ( - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.13.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/prometheus v0.33.0 go.opentelemetry.io/otel/metric v0.33.0 diff --git a/example/view/go.sum b/example/view/go.sum index 7bb5c997cae..f68f958bee4 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -167,8 +167,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= +github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 6f8527c0d05..de7901eed78 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.18 require ( - github.com/prometheus/client_golang v1.13.0 + github.com/prometheus/client_golang v1.13.1 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 4d6765d3aee..7ec09e179cf 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -169,8 +169,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= -github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= +github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index e64631efd02..6dc5123c399 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -134,10 +134,10 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.0.5 // indirect - github.com/prometheus/client_golang v1.12.1 // indirect + github.com/prometheus/client_golang v1.13.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.32.1 // indirect - github.com/prometheus/procfs v0.7.3 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect github.com/quasilyte/go-ruleguard v0.3.18 // indirect github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 123e6d9e2f2..07acea821f6 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -170,9 +170,11 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= @@ -466,8 +468,9 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= +github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -476,14 +479,16 @@ github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6T github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE= github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs= @@ -731,6 +736,8 @@ golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5o golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= @@ -744,6 +751,7 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -811,6 +819,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 1850b2c010fda514b9bd3e8c01a8582fa751d400 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 11:03:49 -0800 Subject: [PATCH 310/886] Bump benchmark-action/github-action-benchmark from 1.14.0 to 1.15.0 (#3442) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.14.0 to 1.15.0. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.14.0...v1.15.0) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9ff05595ef0..466c759962d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,7 +22,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.14.0 + uses: benchmark-action/github-action-benchmark@v1.15.0 with: name: Benchmarks tool: 'go' From bdc26f388e8c96b8ad8a96ace1e9d3fa010641a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Nov 2022 11:12:48 -0800 Subject: [PATCH 311/886] Bump lycheeverse/lychee-action from 1.5.1 to 1.5.2 (#3443) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.5.1 to 1.5.2. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.5.1...v1.5.2) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 0a5bf1921d7..fd500163440 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.5.1 + uses: lycheeverse/lychee-action@v1.5.2 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 98747e55efc..24f1fa330e3 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.5.1 + uses: lycheeverse/lychee-action@v1.5.2 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From c21b6b6bb31a2f74edd06e262f1690f3f6ea3d5c Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:45:23 -0600 Subject: [PATCH 312/886] Adds attribute filter logic (#3396) * Adds attribute filter logic * Apply PR feedback * Use updated MP options * Update Changelog and TODO numbers Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + sdk/metric/meter_test.go | 354 +++++++++++++++++++++++++++++++++++++++ sdk/metric/pipeline.go | 11 +- 3 files changed, 363 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65c829728c0..72c4f7cd732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- Reenabled Attribute Filters in the Metric SDK. (#3396) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 808c946bb40..7cc7e307466 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" + "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -474,3 +475,356 @@ func TestMetersProvideScope(t *testing.T) { assert.NoError(t, err) metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) } + +func TestAttributeFilter(t *testing.T) { + one := 1.0 + two := 2.0 + testcases := []struct { + name string + register func(t *testing.T, mtr metric.Meter) error + wantMetric metricdata.Metrics + }{ + { + name: "AsyncFloat64Counter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncFloat64().Counter("afcounter") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "afcounter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 2.0, // TODO (#3439): This should be 3.0. + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + }, + { + name: "AsyncFloat64UpDownCounter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncFloat64().UpDownCounter("afupdowncounter") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "afupdowncounter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 2.0, // TODO (#3439): This should be 3.0. + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + }, + }, + }, + { + name: "AsyncFloat64Gauge", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncFloat64().Gauge("afgauge") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "afgauge", + Data: metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 2.0, + }, + }, + }, + }, + }, + { + name: "AsyncInt64Counter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncInt64().Counter("aicounter") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "aicounter", + Data: metricdata.Sum[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 20, // TODO (#3439): This should be 30. + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + }, + { + name: "AsyncInt64UpDownCounter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncInt64().UpDownCounter("aiupdowncounter") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "aiupdowncounter", + Data: metricdata.Sum[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 20, // TODO (#3439): This should be 30. + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + }, + }, + }, + { + name: "AsyncInt64Gauge", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.AsyncInt64().Gauge("aigauge") + if err != nil { + return err + } + return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + }) + }, + wantMetric: metricdata.Metrics{ + Name: "aigauge", + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 20, + }, + }, + }, + }, + }, + { + name: "SyncFloat64Counter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncFloat64().Counter("sfcounter") + if err != nil { + return err + } + + ctr.Add(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Add(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "sfcounter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 3.0, + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + }, + { + name: "SyncFloat64UpDownCounter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncFloat64().UpDownCounter("sfupdowncounter") + if err != nil { + return err + } + + ctr.Add(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Add(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "sfupdowncounter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 3.0, + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + }, + }, + }, + { + name: "SyncFloat64Histogram", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncFloat64().Histogram("sfhistogram") + if err != nil { + return err + } + + ctr.Record(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Record(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "sfhistogram", + Data: metricdata.Histogram{ + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + Count: 2, + Min: &one, + Max: &two, + Sum: 3.0, + }, + }, + Temporality: metricdata.CumulativeTemporality, + }, + }, + }, + { + name: "SyncInt64Counter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncInt64().Counter("sicounter") + if err != nil { + return err + } + + ctr.Add(context.Background(), 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Add(context.Background(), 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "sicounter", + Data: metricdata.Sum[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 30, + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + }, + { + name: "SyncInt64UpDownCounter", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncInt64().UpDownCounter("siupdowncounter") + if err != nil { + return err + } + + ctr.Add(context.Background(), 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Add(context.Background(), 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "siupdowncounter", + Data: metricdata.Sum[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Value: 30, + }, + }, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: false, + }, + }, + }, + { + name: "SyncInt64Histogram", + register: func(t *testing.T, mtr metric.Meter) error { + ctr, err := mtr.SyncInt64().Histogram("sihistogram") + if err != nil { + return err + } + + ctr.Record(context.Background(), 1, attribute.String("foo", "bar"), attribute.Int("version", 1)) + ctr.Record(context.Background(), 2, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil + }, + wantMetric: metricdata.Metrics{ + Name: "sihistogram", + Data: metricdata.Histogram{ + DataPoints: []metricdata.HistogramDataPoint{ + { + Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + Count: 2, + Min: &one, + Max: &two, + Sum: 3.0, + }, + }, + Temporality: metricdata.CumulativeTemporality, + }, + }, + }, + } + + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + v, err := view.New( + view.MatchInstrumentName("*"), + view.WithFilterAttributes(attribute.Key("foo")), + ) + require.NoError(t, err) + rdr := NewManualReader() + mtr := NewMeterProvider( + WithReader(rdr), + WithView(v), + ).Meter("TestAttributeFilter") + + err = tt.register(t, mtr) + require.NoError(t, err) + + m, err := rdr.Collect(context.Background()) + assert.NoError(t, err) + + require.Len(t, m.ScopeMetrics, 1) + require.Len(t, m.ScopeMetrics[0].Metrics, 1) + + metricdatatest.AssertEqual(t, tt.wantMetric, m.ScopeMetrics[0].Metrics[0], metricdatatest.IgnoreTimestamp()) + }) + } +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 74a6cb713b1..a3a7d069983 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -21,6 +21,7 @@ import ( "strings" "sync" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" @@ -203,7 +204,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in } matched = true - agg, err := i.cachedAggregator(inst, instUnit) + agg, err := i.cachedAggregator(inst, instUnit, v.AttributeFilter()) if err != nil { errs.append(err) } @@ -223,7 +224,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in } // Apply implicit default view if no explicit matched. - agg, err := i.cachedAggregator(inst, instUnit) + agg, err := i.cachedAggregator(inst, instUnit, nil) if err != nil { errs.append(err) } @@ -247,7 +248,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit) (internal.Aggregator[N], error) { +func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit, filter func(attribute.Set) attribute.Set) (internal.Aggregator[N], error) { switch inst.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. @@ -273,6 +274,10 @@ func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit) (inter if agg == nil { // Drop aggregator. return nil, nil } + if filter != nil { + agg = internal.NewFilter(agg, filter) + } + i.pipeline.addSync(inst.Scope, instrumentSync{ name: inst.Name, description: inst.Description, From 2694dbfdba21d4f5496e873d7f69f04ada040af1 Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Tue, 8 Nov 2022 18:53:59 +0000 Subject: [PATCH 313/886] add new env config options for OTLP exporter (#3363) * add new env config options for OTLP exporter * error path * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * Update exporters/otlp/internal/envconfig/envconfig.go Co-authored-by: Tyler Yahn * add error logging * add missing early returns Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 10 ++ .../otlp/internal/envconfig/envconfig.go | 81 ++++++++-- .../otlp/internal/envconfig/envconfig_test.go | 142 ++++++++++++++++-- .../otlpmetric/internal/oconf/envconfig.go | 27 +++- .../internal/otlpconfig/envconfig.go | 27 +++- 5 files changed, 254 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72c4f7cd732..e6d27b6b02d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387) - Add Instrumentation Scope and Version as info metric and label in Prometheus exporter. This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357) +- OTLP exporters now recognize: (#3363) + - `OTEL_EXPORTER_OTLP_INSECURE` + - `OTEL_EXPORTER_OTLP_TRACES_INSECURE` + - `OTEL_EXPORTER_OTLP_METRICS_INSECURE` + - `OTEL_EXPORTER_OTLP_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY` + - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` + - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` ### Changed diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go index 67003c4a2fa..53ff3126b6e 100644 --- a/exporters/otlp/internal/envconfig/envconfig.go +++ b/exporters/otlp/internal/envconfig/envconfig.go @@ -23,6 +23,8 @@ import ( "strconv" "strings" "time" + + "go.opentelemetry.io/otel/internal/global" ) // ConfigFn is the generic function used to set a config. @@ -59,13 +61,26 @@ func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { } } +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + // WithDuration retrieves the specified config and passes it to ConfigFn as a duration. func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if d, err := strconv.Atoi(v); err == nil { - fn(time.Duration(d) * time.Millisecond) + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return } + fn(time.Duration(d) * time.Millisecond) } } } @@ -83,23 +98,59 @@ func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if u, err := url.Parse(v); err == nil { - fn(u) + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return } + fn(u) } } } -// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config. -func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) { +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { return func(e *EnvOptionsReader) { if v, ok := e.GetEnvValue(n); ok { - if b, err := e.ReadFile(v); err == nil { - if c, err := createTLSConfig(b); err == nil { - fn(c) - } + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) } } @@ -117,15 +168,18 @@ func stringToHeader(value string) map[string]string { for _, header := range headersPairs { nameValue := strings.SplitN(header, "=", 2) if len(nameValue) < 2 { + global.Error(errors.New("missing '="), "parse headers", "input", nameValue) continue } name, err := url.QueryUnescape(nameValue[0]) if err != nil { + global.Error(err, "escape header key", "key", nameValue[0]) continue } trimmedName := strings.TrimSpace(name) value, err := url.QueryUnescape(nameValue[1]) if err != nil { + global.Error(err, "escape header value", "value", nameValue[1]) continue } trimmedValue := strings.TrimSpace(value) @@ -136,13 +190,10 @@ func stringToHeader(value string) map[string]string { return headers } -func createTLSConfig(certBytes []byte) (*tls.Config, error) { +func createCertPool(certBytes []byte) (*x509.CertPool, error) { cp := x509.NewCertPool() if ok := cp.AppendCertsFromPEM(certBytes); !ok { return nil, errors.New("failed to append certificate to the cert pool") } - - return &tls.Config{ - RootCAs: cp, - }, nil + return cp, nil } diff --git a/exporters/otlp/internal/envconfig/envconfig_test.go b/exporters/otlp/internal/envconfig/envconfig_test.go index eaf85b1ec7a..eb2ab8a6806 100644 --- a/exporters/otlp/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/internal/envconfig/envconfig_test.go @@ -16,6 +16,8 @@ package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/en import ( "crypto/tls" + "crypto/x509" + "errors" "net/url" "testing" "time" @@ -23,22 +25,31 @@ import ( "github.com/stretchr/testify/assert" ) +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + const WeakCertificate = ` -----BEGIN CERTIFICATE----- -MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ -MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa -MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 -nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z -sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI -KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA -AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ -1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH -Lhnm4N/QDk5rek0= +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS -----END CERTIFICATE----- ` type testOption struct { TestString string + TestBool bool TestDuration time.Duration TestHeaders map[string]string TestURL *url.URL @@ -134,6 +145,56 @@ func TestEnvConfig(t *testing.T) { }, expectedOptions: []testOption{}, }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, { name: "with a duration config", reader: EnvOptionsReader{ @@ -265,7 +326,7 @@ func TestEnvConfig(t *testing.T) { } func TestWithTLSConfig(t *testing.T) { - tlsCert, err := createTLSConfig([]byte(WeakCertificate)) + pool, err := createCertPool([]byte(WeakCertificate)) assert.NoError(t, err) reader := EnvOptionsReader{ @@ -285,12 +346,65 @@ func TestWithTLSConfig(t *testing.T) { var option testOption reader.Apply( - WithTLSConfig("CERTIFICATE", func(v *tls.Config) { - option = testOption{TestTLS: v} - })) + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), option.TestTLS.RootCAs.Subjects()) + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) } func TestStringToHeader(t *testing.T) { diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go index 96c6fc1753a..93b1209388d 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go @@ -16,6 +16,7 @@ package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/inte import ( "crypto/tls" + "crypto/x509" "net/url" "os" "path" @@ -53,6 +54,7 @@ func ApplyHTTPEnvConfigs(cfg Config) Config { func getOptionsFromEnv() []GenericOption { opts := []GenericOption{} + tlsConf := &tls.Config{} DefaultEnvOptionsReader.Apply( envconfig.WithURL("ENDPOINT", func(u *url.URL) { opts = append(opts, withEndpointScheme(u)) @@ -81,8 +83,13 @@ func getOptionsFromEnv() []GenericOption { return cfg }, withEndpointForGRPC(u))) }), - envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), - envconfig.WithTLSConfig("METRICS_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("METRICS_CLIENT_CERTIFICATE", "METRICS_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("METRICS_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), @@ -125,3 +132,19 @@ func withEndpointScheme(u *url.URL) GenericOption { return WithSecure() } } + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index b29f618e3de..62c5029db2a 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -16,6 +16,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" + "crypto/x509" "net/url" "os" "path" @@ -53,6 +54,7 @@ func ApplyHTTPEnvConfigs(cfg Config) Config { func getOptionsFromEnv() []GenericOption { opts := []GenericOption{} + tlsConf := &tls.Config{} DefaultEnvOptionsReader.Apply( envconfig.WithURL("ENDPOINT", func(u *url.URL) { opts = append(opts, withEndpointScheme(u)) @@ -81,8 +83,13 @@ func getOptionsFromEnv() []GenericOption { return cfg }, withEndpointForGRPC(u))) }), - envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), - envconfig.WithTLSConfig("TRACES_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), @@ -125,3 +132,19 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt } } } + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} From 484c8bd8d80bbada679c37bb2ef7f7ccd0a4e57e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 9 Nov 2022 07:44:06 -0800 Subject: [PATCH 314/886] Handle partial success response from OTLP server in otlpmetric exporters (#3440) * Handle partial success resp from OTLP server * Test partial success response handling * Add changes to changelog Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + .../otlp/otlpmetric/internal/otest/client.go | 63 ++++++++++++++-- .../otlpmetric/internal/otest/client_test.go | 18 ++++- .../otlpmetric/internal/otest/collector.go | 73 ++++++++++++------- .../otlp/otlpmetric/otlpmetricgrpc/client.go | 12 ++- .../otlpmetric/otlpmetricgrpc/client_test.go | 16 ++-- .../otlp/otlpmetric/otlpmetrichttp/client.go | 24 ++++++ .../otlpmetric/otlpmetrichttp/client_test.go | 37 ++++++---- 8 files changed, 185 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d27b6b02d..0b81d70ccdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) - Reenabled Attribute Filters in the Metric SDK. (#3396) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) +- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) ## [1.11.1/0.33.0] 2022-10-19 diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 35939664999..39002156a5c 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -16,6 +16,7 @@ package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/inte import ( "context" + "fmt" "testing" "time" @@ -24,9 +25,11 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/metric/unit" semconv "go.opentelemetry.io/otel/semconv/v1.10.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" rpb "go.opentelemetry.io/proto/otlp/resource/v1" @@ -168,7 +171,10 @@ var ( // otlpmetric.Client implementation that is connected to also returned // Collector implementation. The Client is ready to upload metric data to the // Collector which is ready to store that data. -type ClientFactory func() (otlpmetric.Client, Collector) +// +// If resultCh is not nil, the returned Collector needs to use the responses +// from that channel to send back to the client for every export request. +type ClientFactory func(resultCh <-chan ExportResult) (otlpmetric.Client, Collector) // RunClientTests runs a suite of Client integration tests. For example: // @@ -177,17 +183,17 @@ func RunClientTests(f ClientFactory) func(*testing.T) { return func(t *testing.T) { t.Run("ClientHonorsContextErrors", func(t *testing.T) { t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { - c, _ := f() + c, _ := f(nil) return c.Shutdown })) t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { - c, _ := f() + c, _ := f(nil) return c.ForceFlush })) t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { - c, _ := f() + c, _ := f(nil) return func(ctx context.Context) error { return c.UploadMetrics(ctx, nil) } @@ -196,7 +202,7 @@ func RunClientTests(f ClientFactory) func(*testing.T) { t.Run("ForceFlushFlushes", func(t *testing.T) { ctx := context.Background() - client, collector := f() + client, collector := f(nil) require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) require.NoError(t, client.ForceFlush(ctx)) @@ -211,7 +217,7 @@ func RunClientTests(f ClientFactory) func(*testing.T) { t.Run("UploadMetrics", func(t *testing.T) { ctx := context.Background() - client, coll := f() + client, coll := f(nil) require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) require.NoError(t, client.Shutdown(ctx)) @@ -222,6 +228,51 @@ func RunClientTests(f ClientFactory) func(*testing.T) { t.Fatalf("unexpected ResourceMetrics:\n%s", diff) } }) + + t.Run("PartialSuccess", func(t *testing.T) { + const n, msg = 2, "bad data" + rCh := make(chan ExportResult, 3) + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + RejectedDataPoints: n, + ErrorMessage: msg, + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + // Should not be logged. + RejectedDataPoints: 0, + ErrorMessage: "", + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{}, + } + + ctx := context.Background() + client, _ := f(rCh) + + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + + require.Equal(t, 1, len(errs)) + want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) + assert.ErrorContains(t, errs[0], want) + }) } } diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index e701d10b8db..427b68c4e8c 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -18,6 +18,8 @@ import ( "context" "testing" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -28,6 +30,7 @@ import ( ) type client struct { + rCh <-chan ExportResult storage *Storage } @@ -47,6 +50,17 @@ func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) err c.storage.Add(&cpb.ExportMetricsServiceRequest{ ResourceMetrics: []*mpb.ResourceMetrics{rm}, }) + if c.rCh != nil { + r := <-c.rCh + if r.Response != nil && r.Response.GetPartialSuccess() != nil { + msg := r.Response.GetPartialSuccess().GetErrorMessage() + n := r.Response.GetPartialSuccess().GetRejectedDataPoints() + if msg != "" || n > 0 { + otel.Handle(internal.MetricPartialSuccessError(n, msg)) + } + } + return r.Err + } return ctx.Err() } @@ -54,8 +68,8 @@ func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } func TestClientTests(t *testing.T) { - factory := func() (otlpmetric.Client, Collector) { - c := &client{storage: NewStorage()} + factory := func(rCh <-chan ExportResult) (otlpmetric.Client, Collector) { + c := &client{rCh: rCh, storage: NewStorage()} return c, c } diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index f49355f9f39..50ebd8e013a 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -50,6 +50,11 @@ type Collector interface { Collect() *Storage } +type ExportResult struct { + Response *collpb.ExportMetricsServiceResponse + Err error +} + // Storage stores uploaded OTLP metric data in their proto form. type Storage struct { dataMu sync.Mutex @@ -86,7 +91,7 @@ type GRPCCollector struct { headers metadata.MD storage *Storage - errCh <-chan error + resultCh <-chan ExportResult listener net.Listener srv *grpc.Server } @@ -100,14 +105,14 @@ type GRPCCollector struct { // If errCh is not nil, the collector will respond to Export calls with errors // sent on that channel. This means that if errCh is not nil Export calls will // block until an error is received. -func NewGRPCCollector(endpoint string, errCh <-chan error) (*GRPCCollector, error) { +func NewGRPCCollector(endpoint string, resultCh <-chan ExportResult) (*GRPCCollector, error) { if endpoint == "" { endpoint = "localhost:0" } c := &GRPCCollector{ - storage: NewStorage(), - errCh: errCh, + storage: NewStorage(), + resultCh: resultCh, } var err error @@ -155,11 +160,14 @@ func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsSer c.headersMu.Unlock() } - var err error - if c.errCh != nil { - err = <-c.errCh + if c.resultCh != nil { + r := <-c.resultCh + if r.Response == nil { + return &collpb.ExportMetricsServiceResponse{}, r.Err + } + return r.Response, r.Err } - return &collpb.ExportMetricsServiceResponse{}, err + return &collpb.ExportMetricsServiceResponse{}, nil } var emptyExportMetricsServiceResponse = func() []byte { @@ -189,7 +197,7 @@ type HTTPCollector struct { headers http.Header storage *Storage - errCh <-chan error + resultCh <-chan ExportResult listener net.Listener srv *http.Server } @@ -207,7 +215,7 @@ type HTTPCollector struct { // If errCh is not nil, the collector will respond to HTTP requests with errors // sent on that channel. This means that if errCh is not nil Export calls will // block until an error is received. -func NewHTTPCollector(endpoint string, errCh <-chan error) (*HTTPCollector, error) { +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { u, err := url.Parse(endpoint) if err != nil { return nil, err @@ -220,9 +228,9 @@ func NewHTTPCollector(endpoint string, errCh <-chan error) (*HTTPCollector, erro } c := &HTTPCollector{ - headers: http.Header{}, - storage: NewStorage(), - errCh: errCh, + headers: http.Header{}, + storage: NewStorage(), + resultCh: resultCh, } c.listener, err = net.Listen("tcp", u.Host) @@ -276,22 +284,25 @@ func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { c.respond(w, c.record(r)) } -func (c *HTTPCollector) record(r *http.Request) error { +func (c *HTTPCollector) record(r *http.Request) ExportResult { // Currently only supports protobuf. if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { - return fmt.Errorf("content-type not supported: %s", v) + err := fmt.Errorf("content-type not supported: %s", v) + return ExportResult{Err: err} } body, err := c.readBody(r) if err != nil { - return err + return ExportResult{Err: err} } pbRequest := &collpb.ExportMetricsServiceRequest{} err = proto.Unmarshal(body, pbRequest) if err != nil { - return &HTTPResponseError{ - Err: err, - Status: http.StatusInternalServerError, + return ExportResult{ + Err: &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + }, } } c.storage.Add(pbRequest) @@ -304,10 +315,10 @@ func (c *HTTPCollector) record(r *http.Request) error { } c.headersMu.Unlock() - if c.errCh != nil { - err = <-c.errCh + if c.resultCh != nil { + return <-c.resultCh } - return err + return ExportResult{Err: err} } func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { @@ -345,12 +356,12 @@ func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { return body, err } -func (c *HTTPCollector) respond(w http.ResponseWriter, err error) { - if err != nil { +func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { + if resp.Err != nil { w.Header().Set("Content-Type", "text/plain; charset=utf-8") w.Header().Set("X-Content-Type-Options", "nosniff") var e *HTTPResponseError - if errors.As(err, &e) { + if errors.As(resp.Err, &e) { for k, vals := range e.Header { for _, v := range vals { w.Header().Add(k, v) @@ -360,14 +371,22 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, err error) { fmt.Fprintln(w, e.Error()) } else { w.WriteHeader(http.StatusBadRequest) - fmt.Fprintln(w, err.Error()) + fmt.Fprintln(w, resp.Err.Error()) } return } w.Header().Set("Content-Type", "application/x-protobuf") w.WriteHeader(http.StatusOK) - _, _ = w.Write(emptyExportMetricsServiceResponse) + if resp.Response == nil { + _, _ = w.Write(emptyExportMetricsServiceResponse) + } else { + r, err := proto.Marshal(resp.Response) + if err != nil { + panic(err) + } + _, _ = w.Write(r) + } } type mathRandReader struct{} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 0f1a0040f61..c001836c611 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -24,6 +24,8 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" @@ -163,9 +165,17 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou defer cancel() return c.requestFunc(ctx, func(iCtx context.Context) error { - _, err := c.msc.Export(iCtx, &colmetricpb.ExportMetricsServiceRequest{ + resp, err := c.msc.Export(iCtx, &colmetricpb.ExportMetricsServiceRequest{ ResourceMetrics: []*metricpb.ResourceMetrics{protoMetrics}, }) + if resp != nil && resp.PartialSuccess != nil { + msg := resp.PartialSuccess.GetErrorMessage() + n := resp.PartialSuccess.GetRejectedDataPoints() + if n != 0 || msg != "" { + err := internal.MetricPartialSuccessError(n, msg) + otel.Handle(err) + } + } // nil is converted to OK. if status.Code(err) == codes.OK { // Success. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 64d3b216a2d..ec6c27dfc87 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -130,8 +130,8 @@ func TestRetryable(t *testing.T) { } func TestClient(t *testing.T) { - factory := func() (otlpmetric.Client, otest.Collector) { - coll, err := otest.NewGRPCCollector("", nil) + factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + coll, err := otest.NewGRPCCollector("", rCh) require.NoError(t, err) ctx := context.Background() @@ -145,8 +145,8 @@ func TestClient(t *testing.T) { } func TestConfig(t *testing.T) { - factoryFunc := func(errCh <-chan error, o ...Option) (metric.Exporter, *otest.GRPCCollector) { - coll, err := otest.NewGRPCCollector("", errCh) + factoryFunc := func(rCh <-chan otest.ExportResult, o ...Option) (metric.Exporter, *otest.GRPCCollector) { + coll, err := otest.NewGRPCCollector("", rCh) require.NoError(t, err) ctx := context.Background() @@ -176,11 +176,11 @@ func TestConfig(t *testing.T) { }) t.Run("WithTimeout", func(t *testing.T) { - // Do not send on errCh so the Collector never responds to the client. - errCh := make(chan error) - t.Cleanup(func() { close(errCh) }) + // Do not send on rCh so the Collector never responds to the client. + rCh := make(chan otest.ExportResult) + t.Cleanup(func() { close(rCh) }) exp, coll := factoryFunc( - errCh, + rCh, WithTimeout(time.Millisecond), WithRetry(RetryConfig{Enabled: false}), ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 9d1bac13f49..5232ac236a4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -29,6 +29,7 @@ import ( "google.golang.org/protobuf/proto" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" @@ -190,6 +191,29 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou switch resp.StatusCode { case http.StatusOK: // Success, do not retry. + + // Read the partial success message, if any. + var respData bytes.Buffer + if _, err := io.Copy(&respData, resp.Body); err != nil { + return err + } + + if respData.Len() != 0 { + var respProto colmetricpb.ExportMetricsServiceResponse + if err := proto.Unmarshal(respData.Bytes(), &respProto); err != nil { + return err + } + + if respProto.PartialSuccess != nil { + msg := respProto.PartialSuccess.GetErrorMessage() + n := respProto.PartialSuccess.GetRejectedDataPoints() + if n != 0 || msg != "" { + err := internal.MetricPartialSuccessError(n, msg) + otel.Handle(err) + } + } + } + return nil case http.StatusTooManyRequests, http.StatusServiceUnavailable: // Retry-able failure. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 09a6c15d82c..82e5f8ed29f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -34,8 +34,8 @@ import ( ) func TestClient(t *testing.T) { - factory := func() (otlpmetric.Client, otest.Collector) { - coll, err := otest.NewHTTPCollector("", nil) + factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + coll, err := otest.NewHTTPCollector("", rCh) require.NoError(t, err) addr := coll.Addr().String() @@ -48,8 +48,8 @@ func TestClient(t *testing.T) { } func TestConfig(t *testing.T) { - factoryFunc := func(ePt string, errCh <-chan error, o ...Option) (metric.Exporter, *otest.HTTPCollector) { - coll, err := otest.NewHTTPCollector(ePt, errCh) + factoryFunc := func(ePt string, rCh <-chan otest.ExportResult, o ...Option) (metric.Exporter, *otest.HTTPCollector) { + coll, err := otest.NewHTTPCollector(ePt, rCh) require.NoError(t, err) opts := []Option{WithEndpoint(coll.Addr().String())} @@ -81,18 +81,18 @@ func TestConfig(t *testing.T) { }) t.Run("WithTimeout", func(t *testing.T) { - // Do not send on errCh so the Collector never responds to the client. - errCh := make(chan error) + // Do not send on rCh so the Collector never responds to the client. + rCh := make(chan otest.ExportResult) exp, coll := factoryFunc( "", - errCh, + rCh, WithTimeout(time.Millisecond), WithRetry(RetryConfig{Enabled: false}), ) ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) // Push this after Shutdown so the HTTP server doesn't hang. - t.Cleanup(func() { close(errCh) }) + t.Cleanup(func() { close(rCh) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) err := exp.Export(ctx, metricdata.ResourceMetrics{}) assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) @@ -109,13 +109,20 @@ func TestConfig(t *testing.T) { t.Run("WithRetry", func(t *testing.T) { emptyErr := errors.New("") - errCh := make(chan error, 3) + rCh := make(chan otest.ExportResult, 3) header := http.Header{http.CanonicalHeaderKey("Retry-After"): {"10"}} // Both retryable errors. - errCh <- &otest.HTTPResponseError{Status: http.StatusServiceUnavailable, Err: emptyErr, Header: header} - errCh <- &otest.HTTPResponseError{Status: http.StatusTooManyRequests, Err: emptyErr} - errCh <- nil - exp, coll := factoryFunc("", errCh, WithRetry(RetryConfig{ + rCh <- otest.ExportResult{Err: &otest.HTTPResponseError{ + Status: http.StatusServiceUnavailable, + Err: emptyErr, + Header: header, + }} + rCh <- otest.ExportResult{Err: &otest.HTTPResponseError{ + Status: http.StatusTooManyRequests, + Err: emptyErr, + }} + rCh <- otest.ExportResult{} + exp, coll := factoryFunc("", rCh, WithRetry(RetryConfig{ Enabled: true, InitialInterval: time.Nanosecond, MaxInterval: time.Millisecond, @@ -124,10 +131,10 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) // Push this after Shutdown so the HTTP server doesn't hang. - t.Cleanup(func() { close(errCh) }) + t.Cleanup(func() { close(rCh) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{}), "failed retry") - assert.Len(t, errCh, 0, "failed HTTP responses did not occur") + assert.Len(t, rCh, 0, "failed HTTP responses did not occur") }) t.Run("WithURLPath", func(t *testing.T) { From 496c086ece129182662c14d6a023a2b2da09fe30 Mon Sep 17 00:00:00 2001 From: jbtleloup Date: Thu, 10 Nov 2022 15:40:42 -0500 Subject: [PATCH 315/886] Typo in doc (#3458) --- website_docs/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index 1d6a4c9544a..1b5feb9e32f 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -119,7 +119,7 @@ span := trace.SpanFromContext(ctx) // Do something with the current span, optionally calling `span.End()` if you want it to end ``` -This can helpful if you'd like to add information to the current span at a point in time. +This can be helpful if you'd like to add information to the current span at a point in time. ### Create nested spans From acd87773e2e4f7a23a6b5c3168036fc878fe8dab Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 10 Nov 2022 16:04:53 -0800 Subject: [PATCH 316/886] Restructure instrument creation code paths (#3256) * Add BenchmarkInstrumentCreation * Unify instrument provider * Resolve import shadow * Update sdk/metric/pipeline.go Co-authored-by: Anthony Mirabella * Punctuate to fix lint Co-authored-by: Chester Cheung Co-authored-by: Anthony Mirabella --- sdk/metric/instrument_provider.go | 237 +++++++-------------------- sdk/metric/meter.go | 30 ++-- sdk/metric/meter_test.go | 48 ++++++ sdk/metric/pipeline.go | 27 +-- sdk/metric/pipeline_registry_test.go | 64 ++++---- sdk/metric/pipeline_test.go | 11 +- 6 files changed, 179 insertions(+), 238 deletions(-) diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go index 8640b58e52e..89c09b22990 100644 --- a/sdk/metric/instrument_provider.go +++ b/sdk/metric/instrument_provider.go @@ -22,251 +22,140 @@ import ( "go.opentelemetry.io/otel/metric/instrument/asyncint64" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/view" ) -type asyncInt64Provider struct { - scope instrumentation.Scope - resolve *resolver[int64] +// instProviderKey uniquely describes an instrument creation request received +// by an instrument provider. +type instProviderKey struct { + // Name is the name of the instrument. + Name string + // Description is the description of the instrument. + Description string + // Unit is the unit of the instrument. + Unit unit.Unit + // Kind is the instrument Kind provided. + Kind view.InstrumentKind +} + +// viewInst returns the instProviderKey as a view Instrument using scope s. +func (k instProviderKey) viewInst(s instrumentation.Scope) view.Instrument { + return view.Instrument{ + Scope: s, + Name: k.Name, + Description: k.Description, + Kind: k.Kind, + } } -var _ asyncint64.InstrumentProvider = asyncInt64Provider{} +// instProvider provides all OpenTelemetry instruments. +type instProvider[N int64 | float64] struct { + resolve resolver[N] +} -// Counter creates an instrument for recording increasing values. -func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - cfg := instrument.NewConfig(opts...) +func newInstProvider[N int64 | float64](r resolver[N]) *instProvider[N] { + return &instProvider[N]{resolve: r} +} - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, +// lookup returns the resolved instrumentImpl. +func (p *instProvider[N]) lookup(kind view.InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { + cfg := instrument.NewConfig(opts...) + key := instProviderKey{ Name: name, Description: cfg.Description(), - Kind: view.AsyncCounter, - }, cfg.Unit()) + Unit: cfg.Unit(), + Kind: kind, + } + + aggs, err := p.resolve.Aggregators(key) if len(aggs) == 0 && err != nil { err = fmt.Errorf("instrument does not match any view: %w", err) } + return &instrumentImpl[N]{aggregators: aggs}, err +} - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err +type asyncInt64Provider struct { + *instProvider[int64] +} + +var _ asyncint64.InstrumentProvider = asyncInt64Provider{} + +// Counter creates an instrument for recording increasing values. +func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { + return p.lookup(view.AsyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.AsyncUpDownCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err + return p.lookup(view.AsyncUpDownCounter, name, opts) } // Gauge creates an instrument for recording the current value. func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.AsyncGauge, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err + return p.lookup(view.AsyncGauge, name, opts) } type asyncFloat64Provider struct { - scope instrumentation.Scope - resolve *resolver[float64] + *instProvider[float64] } var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} // Counter creates an instrument for recording increasing values. func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.AsyncCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.AsyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.AsyncUpDownCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.AsyncUpDownCounter, name, opts) } // Gauge creates an instrument for recording the current value. func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.AsyncGauge, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.AsyncGauge, name, opts) } type syncInt64Provider struct { - scope instrumentation.Scope - resolve *resolver[int64] + *instProvider[int64] } var _ syncint64.InstrumentProvider = syncInt64Provider{} // Counter creates an instrument for recording increasing values. func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncUpDownCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncUpDownCounter, name, opts) } // Histogram creates an instrument for recording the current value. func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncHistogram, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[int64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncHistogram, name, opts) } type syncFloat64Provider struct { - scope instrumentation.Scope - resolve *resolver[float64] + *instProvider[float64] } var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} // Counter creates an instrument for recording increasing values. func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncUpDownCounter, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncUpDownCounter, name, opts) } // Histogram creates an instrument for recording the current value. func (p syncFloat64Provider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - cfg := instrument.NewConfig(opts...) - - aggs, err := p.resolve.Aggregators(view.Instrument{ - Scope: p.scope, - Name: name, - Description: cfg.Description(), - Kind: view.SyncHistogram, - }, cfg.Unit()) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } - return &instrumentImpl[float64]{ - aggregators: aggs, - }, err + return p.lookup(view.SyncHistogram, name, opts) } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 80007b1465e..670049037d4 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -31,15 +31,10 @@ import ( // produced by an instrumentation scope will use metric instruments from a // single meter. type meter struct { - instrumentation.Scope - - // *Resolvers are used by the provided instrument providers to resolve new - // instruments aggregators and maintain a cache across instruments this - // meter owns. - int64Resolver resolver[int64] - float64Resolver resolver[float64] - pipes pipelines + + instProviderInt64 *instProvider[int64] + instProviderFloat64 *instProvider[float64] } func newMeter(s instrumentation.Scope, p pipelines) *meter { @@ -52,12 +47,13 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { ic := newInstrumentCache[int64](nil, &viewCache) fc := newInstrumentCache[float64](nil, &viewCache) - return &meter{ - Scope: s, - pipes: p, + ir := newResolver(s, p, ic) + fr := newResolver(s, p, fc) - int64Resolver: newResolver(p, ic), - float64Resolver: newResolver(p, fc), + return &meter{ + pipes: p, + instProviderInt64: newInstProvider(ir), + instProviderFloat64: newInstProvider(fr), } } @@ -66,12 +62,12 @@ var _ metric.Meter = (*meter)(nil) // AsyncInt64 returns the asynchronous integer instrument provider. func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { - return asyncInt64Provider{scope: m.Scope, resolve: &m.int64Resolver} + return asyncInt64Provider{m.instProviderInt64} } // AsyncFloat64 returns the asynchronous floating-point instrument provider. func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return asyncFloat64Provider{scope: m.Scope, resolve: &m.float64Resolver} + return asyncFloat64Provider{m.instProviderFloat64} } // RegisterCallback registers the function f to be called when any of the @@ -83,10 +79,10 @@ func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context // SyncInt64 returns the synchronous integer instrument provider. func (m *meter) SyncInt64() syncint64.InstrumentProvider { - return syncInt64Provider{scope: m.Scope, resolve: &m.int64Resolver} + return syncInt64Provider{m.instProviderInt64} } // SyncFloat64 returns the synchronous floating-point instrument provider. func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - return syncFloat64Provider{scope: m.Scope, resolve: &m.float64Resolver} + return syncFloat64Provider{m.instProviderFloat64} } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 7cc7e307466..ff5da4f7e52 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -25,6 +25,10 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" @@ -828,3 +832,47 @@ func TestAttributeFilter(t *testing.T) { }) } } + +var ( + aiCounter asyncint64.Counter + aiUpDownCounter asyncint64.UpDownCounter + aiGauge asyncint64.Gauge + + afCounter asyncfloat64.Counter + afUpDownCounter asyncfloat64.UpDownCounter + afGauge asyncfloat64.Gauge + + siCounter syncint64.Counter + siUpDownCounter syncint64.UpDownCounter + siHistogram syncint64.Histogram + + sfCounter syncfloat64.Counter + sfUpDownCounter syncfloat64.UpDownCounter + sfHistogram syncfloat64.Histogram +) + +func BenchmarkInstrumentCreation(b *testing.B) { + provider := NewMeterProvider(WithReader(NewManualReader())) + meter := provider.Meter("BenchmarkInstrumentCreation") + + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + aiCounter, _ = meter.AsyncInt64().Counter("async.int64.counter") + aiUpDownCounter, _ = meter.AsyncInt64().UpDownCounter("async.int64.up.down.counter") + aiGauge, _ = meter.AsyncInt64().Gauge("async.int64.gauge") + + afCounter, _ = meter.AsyncFloat64().Counter("async.float64.counter") + afUpDownCounter, _ = meter.AsyncFloat64().UpDownCounter("async.float64.up.down.counter") + afGauge, _ = meter.AsyncFloat64().Gauge("async.float64.gauge") + + siCounter, _ = meter.SyncInt64().Counter("sync.int64.counter") + siUpDownCounter, _ = meter.SyncInt64().UpDownCounter("sync.int64.up.down.counter") + siHistogram, _ = meter.SyncInt64().Histogram("sync.int64.histogram") + + sfCounter, _ = meter.SyncFloat64().Counter("sync.float64.counter") + sfUpDownCounter, _ = meter.SyncFloat64().UpDownCounter("sync.float64.up.down.counter") + sfHistogram, _ = meter.SyncFloat64().Histogram("sync.float64.histogram") + } +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index a3a7d069983..fb651355498 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -156,14 +156,16 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err }, nil } -// inserter facilitates inserting of new instruments into a pipeline. +// inserter facilitates inserting of new instruments from a single scope into a +// pipeline. type inserter[N int64 | float64] struct { + scope instrumentation.Scope cache instrumentCache[N] pipeline *pipeline } -func newInserter[N int64 | float64](p *pipeline, c instrumentCache[N]) *inserter[N] { - return &inserter[N]{cache: c, pipeline: p} +func newInserter[N int64 | float64](s instrumentation.Scope, p *pipeline, c instrumentCache[N]) *inserter[N] { + return &inserter[N]{scope: s, cache: c, pipeline: p} } // Instrument inserts the instrument inst with instUnit into a pipeline. All @@ -187,7 +189,7 @@ func newInserter[N int64 | float64](p *pipeline, c instrumentCache[N]) *inserter // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { +func (i *inserter[N]) Instrument(key instProviderKey) ([]internal.Aggregator[N], error) { var ( matched bool aggs []internal.Aggregator[N] @@ -197,6 +199,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in // The cache will return the same Aggregator instance. Use this fact to // compare pointer addresses to deduplicate Aggregators. seen := make(map[internal.Aggregator[N]]struct{}) + inst := key.viewInst(i.scope) for _, v := range i.pipeline.views { inst, match := v.TransformInstrument(inst) if !match { @@ -204,7 +207,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in } matched = true - agg, err := i.cachedAggregator(inst, instUnit, v.AttributeFilter()) + agg, err := i.cachedAggregator(inst, key.Unit, v.AttributeFilter()) if err != nil { errs.append(err) } @@ -224,7 +227,7 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in } // Apply implicit default view if no explicit matched. - agg, err := i.cachedAggregator(inst, instUnit, nil) + agg, err := i.cachedAggregator(inst, key.Unit, nil) if err != nil { errs.append(err) } @@ -449,22 +452,22 @@ type resolver[N int64 | float64] struct { inserters []*inserter[N] } -func newResolver[N int64 | float64](p pipelines, c instrumentCache[N]) resolver[N] { +func newResolver[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) resolver[N] { in := make([]*inserter[N], len(p)) for i := range in { - in[i] = newInserter(p[i], c) + in[i] = newInserter(s, p[i], c) } return resolver[N]{in} } -// Aggregators returns the Aggregators instrument inst needs to update when it -// makes a measurement. -func (r resolver[N]) Aggregators(inst view.Instrument, instUnit unit.Unit) ([]internal.Aggregator[N], error) { +// Aggregators returns the Aggregators that must be updated by the instrument +// defined by key. +func (r resolver[N]) Aggregators(key instProviderKey) ([]internal.Aggregator[N], error) { var aggs []internal.Aggregator[N] errs := &multierror{} for _, i := range r.inserters { - a, err := i.Instrument(inst, instUnit) + a, err := i.Instrument(key) if err != nil { errs.append(err) } diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index a6ad6f81d23..ae3a2173f30 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/view" @@ -61,7 +61,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { view.WithSetAggregation(invalidAggregation{}), ) - instruments := []view.Instrument{ + instruments := []instProviderKey{ {Name: "foo", Kind: view.InstrumentKind(0)}, //Unknown kind {Name: "foo", Kind: view.SyncCounter}, {Name: "foo", Kind: view.SyncUpDownCounter}, @@ -75,7 +75,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name string reader Reader views []view.View - inst view.Instrument + inst instProviderKey wantKind internal.Aggregator[N] //Aggregators should match len and types wantLen int wantErr error @@ -213,11 +213,12 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { wantErr: errCreatingAggregators, }, } + s := instrumentation.Scope{Name: "testCreateAggregators"} for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { c := newInstrumentCache[N](nil, nil) - i := newInserter(newPipeline(nil, tt.reader, tt.views), c) - got, err := i.Instrument(tt.inst, unit.Dimensionless) + i := newInserter(s, newPipeline(nil, tt.reader, tt.views), c) + got, err := i.Instrument(tt.inst) assert.ErrorIs(t, err, tt.wantErr) require.Len(t, got, tt.wantLen) for _, agg := range got { @@ -229,12 +230,13 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { func testInvalidInstrumentShouldPanic[N int64 | float64]() { c := newInstrumentCache[N](nil, nil) - i := newInserter(newPipeline(nil, NewManualReader(), []view.View{{}}), c) - inst := view.Instrument{ + s := instrumentation.Scope{Name: "testInvalidInstrumentShouldPanic"} + i := newInserter(s, newPipeline(nil, NewManualReader(), []view.View{{}}), c) + inst := instProviderKey{ Name: "foo", Kind: view.InstrumentKind(255), } - _, _ = i.Instrument(inst, unit.Dimensionless) + _, _ = i.Instrument(inst) } func TestInvalidInstrumentShouldPanic(t *testing.T) { @@ -313,22 +315,24 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { } func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { - inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} + inst := instProviderKey{Name: "foo", Kind: view.SyncCounter} c := newInstrumentCache[int64](nil, nil) - r := newResolver(p, c) - aggs, err := r.Aggregators(inst, unit.Dimensionless) + s := instrumentation.Scope{Name: "testPipelineRegistryResolveIntAggregators"} + r := newResolver(s, p, c) + aggs, err := r.Aggregators(inst) assert.NoError(t, err) require.Len(t, aggs, wantCount) } func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { - inst := view.Instrument{Name: "foo", Kind: view.SyncCounter} + inst := instProviderKey{Name: "foo", Kind: view.SyncCounter} c := newInstrumentCache[float64](nil, nil) - r := newResolver(p, c) - aggs, err := r.Aggregators(inst, unit.Dimensionless) + s := instrumentation.Scope{Name: "testPipelineRegistryResolveFloatAggregators"} + r := newResolver(s, p, c) + aggs, err := r.Aggregators(inst) assert.NoError(t, err) require.Len(t, aggs, wantCount) @@ -352,16 +356,17 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { readers := []Reader{testRdrHistogram} views := []view.View{{}} p := newPipelines(resource.Empty(), readers, views) - inst := view.Instrument{Name: "foo", Kind: view.AsyncGauge} + inst := instProviderKey{Name: "foo", Kind: view.AsyncGauge} vc := cache[string, instrumentID]{} - ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) - intAggs, err := ri.Aggregators(inst, unit.Dimensionless) + s := instrumentation.Scope{Name: "TestPipelineRegistryCreateAggregatorsIncompatibleInstrument"} + ri := newResolver(s, p, newInstrumentCache[int64](nil, &vc)) + intAggs, err := ri.Aggregators(inst) assert.Error(t, err) assert.Len(t, intAggs, 0) - rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) - floatAggs, err := rf.Aggregators(inst, unit.Dimensionless) + rf := newResolver(s, p, newInstrumentCache[float64](nil, &vc)) + floatAggs, err := rf.Aggregators(inst) assert.Error(t, err) assert.Len(t, floatAggs, 0) } @@ -393,41 +398,42 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { readers := []Reader{NewManualReader()} views := []view.View{{}, renameView} - fooInst := view.Instrument{Name: "foo", Kind: view.SyncCounter} - barInst := view.Instrument{Name: "bar", Kind: view.SyncCounter} + fooInst := instProviderKey{Name: "foo", Kind: view.SyncCounter} + barInst := instProviderKey{Name: "bar", Kind: view.SyncCounter} p := newPipelines(resource.Empty(), readers, views) vc := cache[string, instrumentID]{} - ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) - intAggs, err := ri.Aggregators(fooInst, unit.Dimensionless) + s := instrumentation.Scope{Name: "TestPipelineRegistryCreateAggregatorsDuplicateErrors"} + ri := newResolver(s, p, newInstrumentCache[int64](nil, &vc)) + intAggs, err := ri.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 0, l.InfoN(), "no info logging should happen") assert.Len(t, intAggs, 1) // The Rename view should produce the same instrument without an error, the // default view should also cause a new aggregator to be returned. - intAggs, err = ri.Aggregators(barInst, unit.Dimensionless) + intAggs, err = ri.Aggregators(barInst) assert.NoError(t, err) assert.Equal(t, 0, l.InfoN(), "no info logging should happen") assert.Len(t, intAggs, 2) // Creating a float foo instrument should log a warning because there is an // int foo instrument. - rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) - floatAggs, err := rf.Aggregators(fooInst, unit.Dimensionless) + rf := newResolver(s, p, newInstrumentCache[float64](nil, &vc)) + floatAggs, err := rf.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 1, l.InfoN(), "instrument conflict not logged") assert.Len(t, floatAggs, 1) - fooInst = view.Instrument{Name: "foo-float", Kind: view.SyncCounter} + fooInst = instProviderKey{Name: "foo-float", Kind: view.SyncCounter} - floatAggs, err = rf.Aggregators(fooInst, unit.Dimensionless) + floatAggs, err = rf.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 0, l.InfoN(), "no info logging should happen") assert.Len(t, floatAggs, 1) - floatAggs, err = rf.Aggregators(barInst, unit.Dimensionless) + floatAggs, err = rf.Aggregators(barInst) assert.NoError(t, err) // Both the rename and default view aggregators created above should now // conflict. Therefore, 2 warning messages should be logged. diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index e47bb6b5f64..75cc06d4878 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/metric/view" @@ -135,12 +134,12 @@ func TestDefaultViewImplicit(t *testing.T) { } func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { - inst := view.Instrument{ - Scope: instrumentation.Scope{Name: "testing/lib"}, + scope := instrumentation.Scope{Name: "testing/lib"} + inst := instProviderKey{ Name: "requests", Description: "count of requests received", Kind: view.SyncCounter, - Aggregation: aggregation.Sum{}, + Unit: unit.Dimensionless, } return func(t *testing.T) { reader := NewManualReader() @@ -164,8 +163,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { c := newInstrumentCache[N](nil, nil) - i := newInserter(test.pipe, c) - got, err := i.Instrument(inst, unit.Dimensionless) + i := newInserter(scope, test.pipe, c) + got, err := i.Instrument(inst) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") From d091ba88e456dfd0140368bdb37beb20c7f6ed6f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 11 Nov 2022 07:22:27 -0800 Subject: [PATCH 317/886] Do not export aggregations without any data points (#3436) * Return empty nil aggs if no meas * Update tests with new expected behavior * Add change to changelog * Set PR number in changelog * Run lint * Fix pipeline_test * Scope change in changelog to pkg * Clean up init of agg types --- CHANGELOG.md | 1 + sdk/metric/internal/histogram.go | 22 ++++++++------- sdk/metric/internal/histogram_test.go | 13 ++++++--- sdk/metric/internal/lastvalue.go | 8 +++--- sdk/metric/internal/lastvalue_test.go | 24 +++++++++++------ sdk/metric/internal/sum.go | 39 +++++++++++++-------------- sdk/metric/internal/sum_test.go | 27 ++++++++++++++++--- sdk/metric/pipeline_test.go | 4 +++ 8 files changed, 89 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b81d70ccdc..3c21c4726cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389) - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) +- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) - Reenabled Attribute Filters in the Metric SDK. (#3396) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go index b04b71baf12..058af8419b1 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/histogram.go @@ -130,20 +130,21 @@ type deltaHistogram[N int64 | float64] struct { } func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { - h := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} - s.valuesMu.Lock() defer s.valuesMu.Unlock() if len(s.values) == 0 { - return h + return nil } + t := now() // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - t := now() - h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(s.values)) + h := metricdata.Histogram{ + Temporality: metricdata.DeltaTemporality, + DataPoints: make([]metricdata.HistogramDataPoint, 0, len(s.values)), + } for a, b := range s.values { hdp := metricdata.HistogramDataPoint{ Attributes: a, @@ -192,20 +193,21 @@ type cumulativeHistogram[N int64 | float64] struct { } func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { - h := metricdata.Histogram{Temporality: metricdata.CumulativeTemporality} - s.valuesMu.Lock() defer s.valuesMu.Unlock() if len(s.values) == 0 { - return h + return nil } + t := now() // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - t := now() - h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(s.values)) + h := metricdata.Histogram{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: make([]metricdata.HistogramDataPoint, 0, len(s.values)), + } for a, b := range s.values { // The HistogramDataPoint field values returned need to be copies of // the buckets value as we will keep updating them. diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index 5b18d8eee4a..fb2968fc325 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -169,17 +169,17 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - expect := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} a := NewDeltaHistogram[int64](histConf) - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) + expect := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} expect.DataPoints = []metricdata.HistogramDataPoint{hPoint(alice, 1, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) // The attr set should be forgotten once Aggregations is called. expect.DataPoints = nil - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) // Aggregating another set should not affect the original (alice). a.Aggregate(1, bob) @@ -187,6 +187,13 @@ func TestDeltaHistogramReset(t *testing.T) { metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) } +func TestEmptyHistogramNilAggregation(t *testing.T) { + assert.Nil(t, NewCumulativeHistogram[int64](histConf).Aggregation()) + assert.Nil(t, NewCumulativeHistogram[float64](histConf).Aggregation()) + assert.Nil(t, NewDeltaHistogram[int64](histConf).Aggregation()) + assert.Nil(t, NewDeltaHistogram[float64](histConf).Aggregation()) +} + func BenchmarkHistogram(b *testing.B) { b.Run("Int64", benchmarkHistogram[int64]) b.Run("Float64", benchmarkHistogram[float64]) diff --git a/sdk/metric/internal/lastvalue.go b/sdk/metric/internal/lastvalue.go index d5ee3b009ba..16ee77362c4 100644 --- a/sdk/metric/internal/lastvalue.go +++ b/sdk/metric/internal/lastvalue.go @@ -49,16 +49,16 @@ func (s *lastValue[N]) Aggregate(value N, attr attribute.Set) { } func (s *lastValue[N]) Aggregation() metricdata.Aggregation { - gauge := metricdata.Gauge[N]{} - s.Lock() defer s.Unlock() if len(s.values) == 0 { - return gauge + return nil } - gauge.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + gauge := metricdata.Gauge[N]{ + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), + } for a, v := range s.values { gauge.DataPoints = append(gauge.DataPoints, metricdata.DataPoint[N]{ Attributes: a, diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/lastvalue_test.go index 3f84af14304..4d78373c328 100644 --- a/sdk/metric/internal/lastvalue_test.go +++ b/sdk/metric/internal/lastvalue_test.go @@ -17,6 +17,8 @@ package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( "testing" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) @@ -52,20 +54,21 @@ func testLastValueReset[N int64 | float64](t *testing.T) { t.Cleanup(mockTime(now)) a := NewLastValue[N]() - expect := metricdata.Gauge[N]{} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) - expect.DataPoints = []metricdata.DataPoint[N]{{ - Attributes: alice, - Time: now(), - Value: 1, - }} + expect := metricdata.Gauge[N]{ + DataPoints: []metricdata.DataPoint[N]{{ + Attributes: alice, + Time: now(), + Value: 1, + }}, + } metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) // The attr set should be forgotten once Aggregations is called. expect.DataPoints = nil - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) // Aggregating another set should not affect the original (alice). a.Aggregate(1, bob) @@ -82,6 +85,11 @@ func TestLastValueReset(t *testing.T) { t.Run("Float64", testLastValueReset[float64]) } +func TestEmptyLastValueNilAggregation(t *testing.T) { + assert.Nil(t, NewLastValue[int64]().Aggregation()) + assert.Nil(t, NewLastValue[float64]().Aggregation()) +} + func BenchmarkLastValue(b *testing.B) { b.Run("Int64", benchmarkAggregator(NewLastValue[int64])) b.Run("Float64", benchmarkAggregator(NewLastValue[float64])) diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index 210d2370120..ecf22f44b6d 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -76,20 +76,19 @@ type deltaSum[N int64 | float64] struct { } func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { - out := metricdata.Sum[N]{ - Temporality: metricdata.DeltaTemporality, - IsMonotonic: s.monotonic, - } - s.Lock() defer s.Unlock() if len(s.values) == 0 { - return out + return nil } t := now() - out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + out := metricdata.Sum[N]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: s.monotonic, + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), + } for attr, value := range s.values { out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ Attributes: attr, @@ -137,20 +136,19 @@ type cumulativeSum[N int64 | float64] struct { } func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { - out := metricdata.Sum[N]{ - Temporality: metricdata.CumulativeTemporality, - IsMonotonic: s.monotonic, - } - s.Lock() defer s.Unlock() if len(s.values) == 0 { - return out + return nil } t := now() - out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.values)) + out := metricdata.Sum[N]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: s.monotonic, + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), + } for attr, value := range s.values { out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ Attributes: attr, @@ -204,20 +202,19 @@ func (s *precomputedDeltaSum[N]) Aggregate(value N, attr attribute.Set) { } func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { - out := metricdata.Sum[N]{ - Temporality: metricdata.DeltaTemporality, - IsMonotonic: s.monotonic, - } - s.Lock() defer s.Unlock() if len(s.recorded) == 0 { - return out + return nil } t := now() - out.DataPoints = make([]metricdata.DataPoint[N], 0, len(s.recorded)) + out := metricdata.Sum[N]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: s.monotonic, + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.recorded)), + } for attr, recorded := range s.recorded { value := recorded - s.reported[attr] out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 92e3b394675..359b73aa50a 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -17,6 +17,8 @@ package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( "testing" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" @@ -138,17 +140,17 @@ func point[N int64 | float64](a attribute.Set, v N) metricdata.DataPoint[N] { func testDeltaSumReset[N int64 | float64](t *testing.T) { t.Cleanup(mockTime(now)) - expect := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality} a := NewDeltaSum[N](false) - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) + expect := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality} expect.DataPoints = []metricdata.DataPoint[N]{point[N](alice, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) // The attr set should be forgotten once Aggregations is called. expect.DataPoints = nil - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + assert.Nil(t, a.Aggregation()) // Aggregating another set should not affect the original (alice). a.Aggregate(1, bob) @@ -161,6 +163,25 @@ func TestDeltaSumReset(t *testing.T) { t.Run("Float64", testDeltaSumReset[float64]) } +func TestEmptySumNilAggregation(t *testing.T) { + assert.Nil(t, NewCumulativeSum[int64](true).Aggregation()) + assert.Nil(t, NewCumulativeSum[int64](false).Aggregation()) + assert.Nil(t, NewCumulativeSum[float64](true).Aggregation()) + assert.Nil(t, NewCumulativeSum[float64](false).Aggregation()) + assert.Nil(t, NewDeltaSum[int64](true).Aggregation()) + assert.Nil(t, NewDeltaSum[int64](false).Aggregation()) + assert.Nil(t, NewDeltaSum[float64](true).Aggregation()) + assert.Nil(t, NewDeltaSum[float64](false).Aggregation()) + assert.Nil(t, NewPrecomputedCumulativeSum[int64](true).Aggregation()) + assert.Nil(t, NewPrecomputedCumulativeSum[int64](false).Aggregation()) + assert.Nil(t, NewPrecomputedCumulativeSum[float64](true).Aggregation()) + assert.Nil(t, NewPrecomputedCumulativeSum[float64](false).Aggregation()) + assert.Nil(t, NewPrecomputedDeltaSum[int64](true).Aggregation()) + assert.Nil(t, NewPrecomputedDeltaSum[int64](false).Aggregation()) + assert.Nil(t, NewPrecomputedDeltaSum[float64](true).Aggregation()) + assert.Nil(t, NewPrecomputedDeltaSum[float64](false).Aggregation()) +} + func BenchmarkSum(b *testing.B) { b.Run("Int64", benchmarkSum[int64]) b.Run("Float64", benchmarkSum[float64]) diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 75cc06d4878..678d173c4e6 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -167,6 +167,9 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { got, err := i.Instrument(inst) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") + for _, a := range got { + a.Aggregate(1, *attribute.EmptySet()) + } out, err := test.pipe.produce(context.Background()) require.NoError(t, err) @@ -180,6 +183,7 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { Data: metricdata.Sum[N]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, + DataPoints: []metricdata.DataPoint[N]{{Value: N(1)}}, }, }, sm.Metrics[0], metricdatatest.IgnoreTimestamp()) }) From 308d0362e6c56cbbd23fa0fda14df5dbd70a5f51 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 11 Nov 2022 09:10:59 -0800 Subject: [PATCH 318/886] Only registers callbacks if non-drop aggregation is used (#3408) * Do not return an error for Drop aggs The async instruments currently return an error if and only if there are no aggregators returned from a resolve. Returning no aggregators means the instrument aggregation is drop. Do not include this in the error reporting decision. * Only registers callbacks if non-drop agg is used The instruments passed to RegisterCallback need to have some aggregation defined otherwise it is implied they have a Drop aggregation. Check that at least one instrument passed has an aggregation other than Drop before registering the callback with the pipelines. Also, return an error if the user passed another API implementation of an asynchronous instrument. * Remove unneeded TODO from pipeline * Add changes to changelog * Test callback not called for all drop instruments * Test RegisterCallback returns err for non-SDK inst * Fail gracefully for non-SDK instruments Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + sdk/metric/instrument_provider.go | 5 ---- sdk/metric/meter.go | 25 ++++++++++++++++++ sdk/metric/meter_test.go | 44 +++++++++++++++++++++++++++++++ sdk/metric/pipeline.go | 1 - 5 files changed, 70 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c21c4726cc..c02ec62168f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) - `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) - Reenabled Attribute Filters in the Metric SDK. (#3396) +- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go index 89c09b22990..25aad6cfc20 100644 --- a/sdk/metric/instrument_provider.go +++ b/sdk/metric/instrument_provider.go @@ -15,8 +15,6 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( - "fmt" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" "go.opentelemetry.io/otel/metric/instrument/asyncint64" @@ -70,9 +68,6 @@ func (p *instProvider[N]) lookup(kind view.InstrumentKind, name string, opts []i } aggs, err := p.resolve.Aggregators(key) - if len(aggs) == 0 && err != nil { - err = fmt.Errorf("instrument does not match any view: %w", err) - } return &instrumentImpl[N]{aggregators: aggs}, err } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 670049037d4..3f9f30106eb 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -73,6 +73,31 @@ func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { + for _, inst := range insts { + // Only register if at least one instrument has a non-drop aggregation. + // Otherwise, calling f during collection will be wasted computation. + switch t := inst.(type) { + case *instrumentImpl[int64]: + if len(t.aggregators) > 0 { + return m.registerCallback(f) + } + case *instrumentImpl[float64]: + if len(t.aggregators) > 0 { + return m.registerCallback(f) + } + default: + // Instrument external to the SDK. For example, an instrument from + // the "go.opentelemetry.io/otel/metric/internal/global" package. + // + // Fail gracefully here, assume a valid instrument. + return m.registerCallback(f) + } + } + // All insts use drop aggregation. + return nil +} + +func (m *meter) registerCallback(f func(context.Context)) error { m.pipes.registerCallback(f) return nil } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index ff5da4f7e52..6edc58d17ce 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -30,6 +30,7 @@ import ( "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/metric/view" @@ -480,6 +481,49 @@ func TestMetersProvideScope(t *testing.T) { metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) } +func TestRegisterCallbackDropAggregations(t *testing.T) { + aggFn := func(view.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} + } + r := NewManualReader(WithAggregationSelector(aggFn)) + mp := NewMeterProvider(WithReader(r)) + m := mp.Meter("testRegisterCallbackDropAggregations") + + int64Counter, err := m.AsyncInt64().Counter("int64.counter") + require.NoError(t, err) + + int64UpDownCounter, err := m.AsyncInt64().UpDownCounter("int64.up_down_counter") + require.NoError(t, err) + + int64Gauge, err := m.AsyncInt64().Gauge("int64.gauge") + require.NoError(t, err) + + floag64Counter, err := m.AsyncFloat64().Counter("floag64.counter") + require.NoError(t, err) + + floag64UpDownCounter, err := m.AsyncFloat64().UpDownCounter("floag64.up_down_counter") + require.NoError(t, err) + + floag64Gauge, err := m.AsyncFloat64().Gauge("floag64.gauge") + require.NoError(t, err) + + var called bool + require.NoError(t, m.RegisterCallback([]instrument.Asynchronous{ + int64Counter, + int64UpDownCounter, + int64Gauge, + floag64Counter, + floag64UpDownCounter, + floag64Gauge, + }, func(context.Context) { called = true })) + + data, err := r.Collect(context.Background()) + require.NoError(t, err) + + assert.False(t, called, "callback called for all drop instruments") + assert.Len(t, data.ScopeMetrics, 0, "metrics exported for drop instruments") +} + func TestAttributeFilter(t *testing.T) { one := 1.0 two := 2.0 diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index fb651355498..46ad0806bdf 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -438,7 +438,6 @@ func newPipelines(res *resource.Resource, readers []Reader, views []view.View) p return pipes } -// TODO (#3053) Only register callbacks if any instrument matches in a view. func (p pipelines) registerCallback(fn func(context.Context)) { for _, pipe := range p { pipe.addCallback(fn) From 404f999fd0315a36be322f35c6b9b74746808028 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Nov 2022 08:06:23 -0800 Subject: [PATCH 319/886] dependabot updates Sun Nov 13 15:54:30 UTC 2022 (#3466) Bump golang.org/x/tools from 0.2.0 to 0.3.0 in /internal/tools Bump github.com/prometheus/client_golang from 1.13.1 to 1.14.0 in /example/view Bump lycheeverse/lychee-action from 1.5.2 to 1.5.4 Co-authored-by: MrAlias --- example/prometheus/go.mod | 4 ++-- example/prometheus/go.sum | 7 ++++--- example/view/go.mod | 4 ++-- example/view/go.sum | 7 ++++--- exporters/prometheus/go.mod | 4 ++-- exporters/prometheus/go.sum | 7 ++++--- internal/tools/go.mod | 14 +++++++------- internal/tools/go.sum | 29 +++++++++++++++-------------- 8 files changed, 40 insertions(+), 36 deletions(-) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b15e7aa81f3..c9526f71e4d 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.18 require ( - github.com/prometheus/client_golang v1.13.1 + github.com/prometheus/client_golang v1.14.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/prometheus v0.33.0 go.opentelemetry.io/otel/metric v0.33.0 @@ -17,7 +17,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.11.1 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index f68f958bee4..d7a3b28acfb 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -167,13 +167,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= -github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= diff --git a/example/view/go.mod b/example/view/go.mod index 885885796c4..c4f939eec9c 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.18 require ( - github.com/prometheus/client_golang v1.13.1 + github.com/prometheus/client_golang v1.14.0 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/exporters/prometheus v0.33.0 go.opentelemetry.io/otel/metric v0.33.0 @@ -18,7 +18,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect diff --git a/example/view/go.sum b/example/view/go.sum index f68f958bee4..d7a3b28acfb 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -167,13 +167,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= -github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index de7901eed78..731be2dfd70 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.18 require ( - github.com/prometheus/client_golang v1.13.1 + github.com/prometheus/client_golang v1.14.0 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 @@ -20,7 +20,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 7ec09e179cf..ce806080898 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -169,13 +169,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= -github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 6dc5123c399..cfa45b2bbef 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c - golang.org/x/tools v0.2.0 + golang.org/x/tools v0.3.0 ) require ( @@ -134,8 +134,8 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.0.5 // indirect - github.com/prometheus/client_golang v1.13.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/quasilyte/go-ruleguard v0.3.18 // indirect @@ -188,10 +188,10 @@ require ( golang.org/x/crypto v0.1.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect - golang.org/x/mod v0.6.0 // indirect - golang.org/x/net v0.1.0 // indirect - golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect - golang.org/x/sys v0.1.0 // indirect + golang.org/x/mod v0.7.0 // indirect + golang.org/x/net v0.2.0 // indirect + golang.org/x/sync v0.1.0 // indirect + golang.org/x/sys v0.2.0 // indirect golang.org/x/text v0.4.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 07acea821f6..01ce42ad7e2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -469,13 +469,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.13.1 h1:3gMjIY2+/hzmqhtUC/aQNYldJA6DtH3CgQvwS+02K1c= -github.com/prometheus/client_golang v1.13.1/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -697,8 +698,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -739,8 +740,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -764,8 +765,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= -golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -827,11 +828,11 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= +golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -926,8 +927,8 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= +golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 2e780d8e398e7bb0f41b49077ec5367bd7369f53 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 16 Nov 2022 08:18:02 -0800 Subject: [PATCH 320/886] Add View, NewView, Instrument, Stream, and InstrumentKind to sdk/metric with unit tests (#3459) * Add the InstrumentKind type and vars to sdk/metric * Add the Instrument type to sdk/metric * Add the Stream type to sdk/metric * Add the View type to sdk/metric * Add NewView to create Views matching OTel spec * Add unit tests for NewView * Add changes to changelog * Apply suggestions from code review Co-authored-by: Anthony Mirabella * Update CHANGELOG.md * Update match and mask comments of Instrument * Explain wildcard logic in NewView with comment * Drop views that replace name for multi-inst match * Comment how users are expected to match zero-vals * Remove InstrumentKind and Scope from Stream * Fix redundant word in NewView comment Co-authored-by: Anthony Mirabella Co-authored-by: Chester Cheung --- CHANGELOG.md | 5 + sdk/metric/instrument.go | 123 +++++++ sdk/metric/pipeline_registry_test.go | 10 + sdk/metric/view.go | 124 +++++++ sdk/metric/view_test.go | 471 +++++++++++++++++++++++++++ 5 files changed, 733 insertions(+) create mode 100644 sdk/metric/view.go create mode 100644 sdk/metric/view_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c02ec62168f..ac0bdc06da8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE` - `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE` - `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE` +- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. + These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) +- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) ### Changed diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 48440280e42..8009540e6b2 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -24,10 +24,133 @@ import ( "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +var ( + zeroUnit unit.Unit + zeroInstrumentKind InstrumentKind + zeroScope instrumentation.Scope +) + +// InstrumentKind is the identifier of a group of instruments that all +// performing the same function. +type InstrumentKind uint8 + +const ( + // instrumentKindUndefined is an undefined instrument kind, it should not + // be used by any initialized type. + instrumentKindUndefined InstrumentKind = iota // nolint:deadcode,varcheck,unused + // InstrumentKindSyncCounter identifies a group of instruments that record + // increasing values synchronously with the code path they are measuring. + InstrumentKindSyncCounter + // InstrumentKindSyncUpDownCounter identifies a group of instruments that + // record increasing and decreasing values synchronously with the code path + // they are measuring. + InstrumentKindSyncUpDownCounter + // InstrumentKindSyncHistogram identifies a group of instruments that + // record a distribution of values synchronously with the code path they + // are measuring. + InstrumentKindSyncHistogram + // InstrumentKindAsyncCounter identifies a group of instruments that record + // increasing values in an asynchronous callback. + InstrumentKindAsyncCounter + // InstrumentKindAsyncUpDownCounter identifies a group of instruments that + // record increasing and decreasing values in an asynchronous callback. + InstrumentKindAsyncUpDownCounter + // InstrumentKindAsyncGauge identifies a group of instruments that record + // current values in an asynchronous callback. + InstrumentKindAsyncGauge +) + +type nonComparable [0]func() // nolint: unused // This is indeed used. + +// Instrument describes properties an instrument is created with. +type Instrument struct { + // Name is the human-readable identifier of the instrument. + Name string + // Description describes the purpose of the instrument. + Description string + // Kind defines the functional group of the instrument. + Kind InstrumentKind + // Unit is the unit of measurement recorded by the instrument. + Unit unit.Unit + // Scope identifies the instrumentation that created the instrument. + Scope instrumentation.Scope + + // Ensure forward compatibility if non-comparable fields need to be added. + nonComparable // nolint: unused +} + +// empty returns if all fields of i are their zero-value. +func (i Instrument) empty() bool { + return i.Name == "" && + i.Description == "" && + i.Kind == zeroInstrumentKind && + i.Unit == zeroUnit && + i.Scope == zeroScope +} + +// matches returns whether all the non-zero-value fields of i match the +// corresponding fields of other. If i is empty it will match all other, and +// true will always be returned. +func (i Instrument) matches(other Instrument) bool { + return i.matchesName(other) && + i.matchesDescription(other) && + i.matchesKind(other) && + i.matchesUnit(other) && + i.matchesScope(other) +} + +// matchesName returns true if the Name of i is "" or it equals the Name of +// other, otherwise false. +func (i Instrument) matchesName(other Instrument) bool { + return i.Name == "" || i.Name == other.Name +} + +// matchesDescription returns true if the Description of i is "" or it equals +// the Description of other, otherwise false. +func (i Instrument) matchesDescription(other Instrument) bool { + return i.Description == "" || i.Description == other.Description +} + +// matchesKind returns true if the Kind of i is its zero-value or it equals the +// Kind of other, otherwise false. +func (i Instrument) matchesKind(other Instrument) bool { + return i.Kind == zeroInstrumentKind || i.Kind == other.Kind +} + +// matchesUnit returns true if the Unit of i is its zero-value or it equals the +// Unit of other, otherwise false. +func (i Instrument) matchesUnit(other Instrument) bool { + return i.Unit == zeroUnit || i.Unit == other.Unit +} + +// matchesScope returns true if the Scope of i is its zero-value or it equals +// the Scope of other, otherwise false. +func (i Instrument) matchesScope(other Instrument) bool { + return (i.Scope.Name == "" || i.Scope.Name == other.Scope.Name) && + (i.Scope.Version == "" || i.Scope.Version == other.Scope.Version) && + (i.Scope.SchemaURL == "" || i.Scope.SchemaURL == other.Scope.SchemaURL) +} + +// Stream describes the stream of data an instrument produces. +type Stream struct { + // Name is the human-readable identifier of the stream. + Name string + // Description describes the purpose of the data. + Description string + // Unit is the unit of measurement recorded. + Unit unit.Unit + // Aggregation the stream uses for an instrument. + Aggregation aggregation.Aggregation + // AttributeFilter applied to all attributes recorded for an instrument. + AttributeFilter attribute.Filter +} + // instrumentID are the identifying properties of an instrument. type instrumentID struct { // Name is the name of the instrument. diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index ae3a2173f30..3f73637bf5f 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -374,6 +374,7 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { type logCounter struct { logr.LogSink + errN uint32 infoN uint32 } @@ -386,6 +387,15 @@ func (l *logCounter) InfoN() int { return int(atomic.SwapUint32(&l.infoN, 0)) } +func (l *logCounter) Error(err error, msg string, keysAndValues ...interface{}) { + atomic.AddUint32(&l.errN, 1) + l.LogSink.Error(err, msg, keysAndValues...) +} + +func (l *logCounter) ErrorN() int { + return int(atomic.SwapUint32(&l.errN, 0)) +} + func TestResolveAggregatorsDuplicateErrors(t *testing.T) { tLog := testr.NewWithOptions(t, testr.Options{Verbosity: 6}) l := &logCounter{LogSink: tLog.GetSink()} diff --git a/sdk/metric/view.go b/sdk/metric/view.go new file mode 100644 index 00000000000..b8fc363a0a7 --- /dev/null +++ b/sdk/metric/view.go @@ -0,0 +1,124 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "errors" + "regexp" + "strings" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +var ( + errMultiInst = errors.New("name replacement for multiple instruments") + + emptyView = func(Instrument) (Stream, bool) { return Stream{}, false } +) + +// View is an override to the default behavior of the SDK. It defines how data +// should be collected for certain instruments. It returns true and the exact +// Stream to use for matching Instruments. Otherwise, if the view does not +// match, false is returned. +type View func(Instrument) (Stream, bool) + +// NewView returns a View that applies the Stream mask for all instruments that +// match criteria. The returned View will only apply mask if all non-zero-value +// fields of criteria match the corresponding Instrument passed to the view. If +// no criteria are provided, all field of criteria are their zero-values, a +// view that matches no instruments is returned. If you need to match a +// zero-value field, create a View directly. +// +// The Name field of criteria supports wildcard pattern matching. The wildcard +// "*" is recognized as matching zero or more characters, and "?" is recognized +// as matching exactly one character. For example, a pattern of "*" will match +// all instrument names. +// +// The Stream mask only applies updates for non-zero-value fields. By default, +// the Instrument the View matches against will be use for the Name, +// Description, and Unit of the returned Stream and no Aggregation or +// AttributeFilter are set. All non-zero-value fields of mask are used instead +// of the default. If you need to zero out an Stream field returned from a +// View, create a View directly. +func NewView(criteria Instrument, mask Stream) View { + if criteria.empty() { + return emptyView + } + + var matchFunc func(Instrument) bool + if strings.ContainsAny(criteria.Name, "*?") { + if mask.Name != "" { + global.Error( + errMultiInst, "dropping view", + "criteria", criteria, + "mask", mask, + ) + return emptyView + } + + // Handle branching here in NewView instead of criteria.matches so + // criteria.matches remains inlinable for the simple case. + pattern := regexp.QuoteMeta(criteria.Name) + pattern = "^" + pattern + "$" + pattern = strings.ReplaceAll(pattern, `\?`, ".") + pattern = strings.ReplaceAll(pattern, `\*`, ".*") + re := regexp.MustCompile(pattern) + matchFunc = func(i Instrument) bool { + return re.MatchString(i.Name) && + criteria.matchesDescription(i) && + criteria.matchesKind(i) && + criteria.matchesUnit(i) && + criteria.matchesScope(i) + } + } else { + matchFunc = criteria.matches + } + + var agg aggregation.Aggregation + if mask.Aggregation != nil { + agg = mask.Aggregation.Copy() + if err := agg.Err(); err != nil { + global.Error( + err, "not using aggregation with view", + "criteria", criteria, + "mask", mask, + ) + agg = nil + } + } + + return func(i Instrument) (Stream, bool) { + if matchFunc(i) { + return Stream{ + Name: nonZero(mask.Name, i.Name), + Description: nonZero(mask.Description, i.Description), + Unit: nonZero(mask.Unit, i.Unit), + Aggregation: agg, + AttributeFilter: mask.AttributeFilter, + }, true + } + return Stream{}, false + } +} + +// nonZero returns v if it is non-zero-valued, otherwise alt. +func nonZero[T comparable](v, alt T) T { + var zero T + if v != zero { + return v + } + return alt +} diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go new file mode 100644 index 00000000000..082b0106ebd --- /dev/null +++ b/sdk/metric/view_test.go @@ -0,0 +1,471 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "testing" + + "github.com/go-logr/logr" + "github.com/go-logr/logr/testr" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +var ( + schemaURL = "https://opentelemetry.io/schemas/1.0.0" + completeIP = Instrument{ + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: instrumentation.Scope{ + Name: "TestNewViewMatch", + Version: "v0.1.0", + SchemaURL: schemaURL, + }, + } +) + +func scope(name, ver, url string) instrumentation.Scope { + return instrumentation.Scope{Name: name, Version: ver, SchemaURL: url} +} + +func testNewViewMatchName() func(t *testing.T) { + tests := []struct { + name string + criteria string + match []string + notMatch []string + }{ + { + name: "Exact", + criteria: "foo", + match: []string{"foo"}, + notMatch: []string{"", "bar", "foobar", "barfoo", "ffooo"}, + }, + { + name: "Wildcard/*", + criteria: "*", + match: []string{"", "foo", "foobar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Front?", + criteria: "?oo", + match: []string{"foo", "1oo"}, + notMatch: []string{"", "bar", "foobar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Back?", + criteria: "fo?", + match: []string{"foo", "fo1"}, + notMatch: []string{"", "bar", "foobar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Front*", + criteria: "*foo", + match: []string{"foo", "123foo", "barfoo"}, + notMatch: []string{"", "bar", "foobar", "barfoobaz"}, + }, + { + name: "Wildcard/Back*", + criteria: "foo*", + match: []string{"foo", "foo1", "foobar"}, + notMatch: []string{"", "bar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/FrontBack*", + criteria: "*foo*", + match: []string{"foo", "foo1", "1foo", "1foo1", "foobar", "barfoobaz"}, + notMatch: []string{"", "bar"}, + }, + { + name: "Wildcard/Front**", + criteria: "**foo", + match: []string{"foo", "123foo", "barfoo", "afoo"}, + notMatch: []string{"", "bar", "foobar", "barfoobaz"}, + }, + { + name: "Wildcard/Back**", + criteria: "foo**", + match: []string{"foo", "foo1", "fooa", "foobar"}, + notMatch: []string{"", "bar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Front*?", + criteria: "*?oo", + match: []string{"foo", "123foo", "barfoo", "afoo"}, + notMatch: []string{"", "fo", "bar", "foobar", "barfoobaz"}, + }, + { + name: "Wildcard/Back*?", + criteria: "fo*?", + match: []string{"foo", "foo1", "fooa", "foobar"}, + notMatch: []string{"", "bar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Front?*", + criteria: "?*oo", + match: []string{"foo", "123foo", "barfoo", "afoo"}, + notMatch: []string{"", "oo", "fo", "bar", "foobar", "barfoobaz"}, + }, + { + name: "Wildcard/Back?*", + criteria: "fo?*", + match: []string{"foo", "foo1", "fooa", "foobar"}, + notMatch: []string{"", "fo", "bar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Middle*", + criteria: "f*o", + match: []string{"fo", "foo", "fooo", "fo12baro"}, + notMatch: []string{"", "bar", "barfoo", "barfoobaz"}, + }, + { + name: "Wildcard/Middle?", + criteria: "f?o", + match: []string{"foo", "f1o"}, + notMatch: []string{"", "fo", "fooo", "fo12baro", "bar"}, + }, + { + name: "Wildcard/MetaCharacters", + criteria: "*.+()|[]{}^$-_?", + match: []string{"aa.+()|[]{}^$-_b", ".+()|[]{}^$-_b"}, + notMatch: []string{"", "foo", ".+()|[]{}^$-_"}, + }, + } + + return func(t *testing.T) { + for _, test := range tests { + v := NewView(Instrument{Name: test.criteria}, Stream{}) + t.Run(test.name, func(t *testing.T) { + for _, n := range test.match { + _, matches := v(Instrument{Name: n}) + assert.Truef(t, matches, "%s does not match %s", test.criteria, n) + } + for _, n := range test.notMatch { + _, matches := v(Instrument{Name: n}) + assert.Falsef(t, matches, "%s matches %s", test.criteria, n) + } + }) + } + } +} + +func TestNewViewMatch(t *testing.T) { + // Avoid boilerplate for name match testing. + t.Run("Name", testNewViewMatchName()) + + tests := []struct { + name string + criteria Instrument + matches []Instrument + notMatches []Instrument + }{ + { + name: "Empty", + notMatches: []Instrument{{}, {Name: "foo"}, completeIP}, + }, + { + name: "Description", + criteria: Instrument{Description: "foo desc"}, + matches: []Instrument{{Description: "foo desc"}, completeIP}, + notMatches: []Instrument{{}, {Description: "foo"}, {Description: "desc"}}, + }, + { + name: "Kind", + criteria: Instrument{Kind: InstrumentKindSyncCounter}, + matches: []Instrument{{Kind: InstrumentKindSyncCounter}, completeIP}, + notMatches: []Instrument{ + {}, + {Kind: InstrumentKindSyncUpDownCounter}, + {Kind: InstrumentKindSyncHistogram}, + {Kind: InstrumentKindAsyncCounter}, + {Kind: InstrumentKindAsyncUpDownCounter}, + {Kind: InstrumentKindAsyncGauge}, + }, + }, + { + name: "Unit", + criteria: Instrument{Unit: unit.Bytes}, + matches: []Instrument{{Unit: unit.Bytes}, completeIP}, + notMatches: []Instrument{ + {}, + {Unit: unit.Dimensionless}, + {Unit: unit.Unit("K")}, + }, + }, + { + name: "ScopeName", + criteria: Instrument{Scope: scope("TestNewViewMatch", "", "")}, + matches: []Instrument{ + {Scope: scope("TestNewViewMatch", "", "")}, + completeIP, + }, + notMatches: []Instrument{ + {}, + {Scope: scope("PrefixTestNewViewMatch", "", "")}, + {Scope: scope("TestNewViewMatchSuffix", "", "")}, + {Scope: scope("alt", "", "")}, + }, + }, + { + name: "ScopeVersion", + criteria: Instrument{Scope: scope("", "v0.1.0", "")}, + matches: []Instrument{ + {Scope: scope("", "v0.1.0", "")}, + completeIP, + }, + notMatches: []Instrument{ + {}, + {Scope: scope("", "v0.1.0-RC1", "")}, + {Scope: scope("", "v0.1.1", "")}, + }, + }, + { + name: "ScopeSchemaURL", + criteria: Instrument{Scope: scope("", "", schemaURL)}, + matches: []Instrument{ + {Scope: scope("", "", schemaURL)}, + completeIP, + }, + notMatches: []Instrument{ + {}, + {Scope: scope("", "", schemaURL+"/path")}, + {Scope: scope("", "", "https://go.dev")}, + }, + }, + { + name: "Scope", + criteria: Instrument{Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL)}, + matches: []Instrument{ + {Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL)}, + completeIP, + }, + notMatches: []Instrument{ + {}, + {Scope: scope("CompleteMisMatch", "v0.2.0", "https://go.dev")}, + {Scope: scope("NameMisMatch", "v0.1.0", schemaURL)}, + }, + }, + { + name: "Complete", + criteria: completeIP, + matches: []Instrument{completeIP}, + notMatches: []Instrument{ + {}, + {Name: "foo"}, + { + Name: "Wrong Name", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), + }, + { + Name: "foo", + Description: "Wrong Description", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), + }, + { + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindAsyncUpDownCounter, + Unit: unit.Bytes, + Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), + }, + { + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Dimensionless, + Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), + }, + { + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: scope("Wrong Scope Name", "v0.1.0", schemaURL), + }, + { + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: scope("TestNewViewMatch", "v1.4.3", schemaURL), + }, + { + Name: "foo", + Description: "foo desc", + Kind: InstrumentKindSyncCounter, + Unit: unit.Bytes, + Scope: scope("TestNewViewMatch", "v0.1.0", "https://go.dev"), + }, + }, + }, + } + + for _, test := range tests { + v := NewView(test.criteria, Stream{}) + t.Run(test.name, func(t *testing.T) { + for _, instrument := range test.matches { + _, matches := v(instrument) + assert.Truef(t, matches, "view does not match %#v", instrument) + } + + for _, instrument := range test.notMatches { + _, matches := v(instrument) + assert.Falsef(t, matches, "view matches %#v", instrument) + } + }) + } +} + +func TestNewViewReplace(t *testing.T) { + alt := "alternative value" + tests := []struct { + name string + mask Stream + want func(Instrument) Stream + }{ + { + name: "Nothing", + want: func(i Instrument) Stream { + return Stream{ + Name: i.Name, + Description: i.Description, + Unit: i.Unit, + } + }, + }, + { + name: "Name", + mask: Stream{Name: alt}, + want: func(i Instrument) Stream { + return Stream{ + Name: alt, + Description: i.Description, + Unit: i.Unit, + } + }, + }, + { + name: "Description", + mask: Stream{Description: alt}, + want: func(i Instrument) Stream { + return Stream{ + Name: i.Name, + Description: alt, + Unit: i.Unit, + } + }, + }, + { + name: "Unit", + mask: Stream{Unit: unit.Dimensionless}, + want: func(i Instrument) Stream { + return Stream{ + Name: i.Name, + Description: i.Description, + Unit: unit.Dimensionless, + } + }, + }, + { + name: "Aggregation", + mask: Stream{Aggregation: aggregation.LastValue{}}, + want: func(i Instrument) Stream { + return Stream{ + Name: i.Name, + Description: i.Description, + Unit: i.Unit, + Aggregation: aggregation.LastValue{}, + } + }, + }, + { + name: "Complete", + mask: Stream{ + Name: alt, + Description: alt, + Unit: unit.Dimensionless, + Aggregation: aggregation.LastValue{}, + }, + want: func(i Instrument) Stream { + return Stream{ + Name: alt, + Description: alt, + Unit: unit.Dimensionless, + Aggregation: aggregation.LastValue{}, + } + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + got, match := NewView(completeIP, test.mask)(completeIP) + require.True(t, match, "view did not match exact criteria") + assert.Equal(t, test.want(completeIP), got) + }) + } + + // Go does not allow for the comparison of function values, even their + // addresses. Therefore, the AttributeFilter field needs an alternative + // testing strategy. + t.Run("AttributeFilter", func(t *testing.T) { + allowed := attribute.String("key", "val") + filter := func(kv attribute.KeyValue) bool { + return kv == allowed + } + mask := Stream{AttributeFilter: filter} + got, match := NewView(completeIP, mask)(completeIP) + require.True(t, match, "view did not match exact criteria") + require.NotNil(t, got.AttributeFilter, "AttributeFilter not set") + assert.True(t, got.AttributeFilter(allowed), "wrong AttributeFilter") + other := attribute.String("key", "other val") + assert.False(t, got.AttributeFilter(other), "wrong AttributeFilter") + }) +} + +type badAgg struct { + aggregation.Aggregation + err error +} + +func (a badAgg) Copy() aggregation.Aggregation { return a } + +func (a badAgg) Err() error { return a.err } + +func TestNewViewAggregationErrorLogged(t *testing.T) { + tLog := testr.NewWithOptions(t, testr.Options{Verbosity: 6}) + l := &logCounter{LogSink: tLog.GetSink()} + otel.SetLogger(logr.New(l)) + + agg := badAgg{err: assert.AnError} + mask := Stream{Aggregation: agg} + got, match := NewView(completeIP, mask)(completeIP) + require.True(t, match, "view did not match exact criteria") + assert.Nil(t, got.Aggregation, "erroring aggregation used") + assert.Equal(t, 1, l.ErrorN()) +} From b0618095a4b00d729e1b14872841006166ea0d5f Mon Sep 17 00:00:00 2001 From: darkfeline Date: Wed, 16 Nov 2022 08:40:04 -0800 Subject: [PATCH 321/886] Fix doc comment typo (#3470) Co-authored-by: Tyler Yahn --- trace/doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trace/doc.go b/trace/doc.go index 391417718f5..ab0346f9664 100644 --- a/trace/doc.go +++ b/trace/doc.go @@ -17,7 +17,7 @@ Package trace provides an implementation of the tracing part of the OpenTelemetry API. To participate in distributed traces a Span needs to be created for the -operation being performed as part of a traced workflow. It its simplest form: +operation being performed as part of a traced workflow. In its simplest form: var tracer trace.Tracer From 037719b6469c3b4365452c2ff526213e875f3654 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 19 Nov 2022 09:05:20 -0800 Subject: [PATCH 322/886] Replace view use from sdk/metric/view to sdk/metric (#3461) * Replace view usage in sdk/metric * Replace view use in stdoutmetric * Replace view use in prometheus exporter * Replace view use in otlpmetric exporters * Replace view use in view example --- example/view/main.go | 37 +-- exporters/otlp/otlpmetric/client.go | 6 +- exporters/otlp/otlpmetric/exporter.go | 9 +- exporters/otlp/otlpmetric/exporter_test.go | 5 +- .../otlp/otlpmetric/internal/oconf/options.go | 3 +- .../otlpmetric/internal/oconf/options_test.go | 10 +- .../otlpmetric/internal/otest/client_test.go | 5 +- .../otlp/otlpmetric/otlpmetricgrpc/client.go | 5 +- .../otlp/otlpmetric/otlpmetrichttp/client.go | 5 +- exporters/prometheus/config_test.go | 6 +- exporters/prometheus/exporter_test.go | 19 +- exporters/stdout/stdoutmetric/config.go | 3 +- exporters/stdout/stdoutmetric/exporter.go | 5 +- .../stdout/stdoutmetric/exporter_test.go | 10 +- sdk/metric/benchmark_test.go | 12 +- sdk/metric/config.go | 5 +- sdk/metric/config_test.go | 28 +- sdk/metric/doc.go | 4 +- sdk/metric/exporter.go | 5 +- sdk/metric/instrument_provider.go | 62 ++--- sdk/metric/internal/filter.go | 6 +- sdk/metric/internal/filter_test.go | 7 +- sdk/metric/manual_reader.go | 9 +- sdk/metric/manual_reader_test.go | 7 +- sdk/metric/meter.go | 7 +- sdk/metric/meter_test.go | 19 +- sdk/metric/periodic_reader.go | 5 +- sdk/metric/periodic_reader_test.go | 7 +- sdk/metric/pipeline.go | 89 +++--- sdk/metric/pipeline_registry_test.go | 261 ++++++++---------- sdk/metric/pipeline_test.go | 15 +- sdk/metric/reader.go | 19 +- sdk/metric/reader_test.go | 33 ++- 33 files changed, 320 insertions(+), 408 deletions(-) diff --git a/example/view/main.go b/example/view/main.go index bafbe3c8920..cdced744a30 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/view" ) const meterName = "github.com/open-telemetry/opentelemetry-go/example/view" @@ -44,31 +43,21 @@ func main() { log.Fatal(err) } - // View to customize histogram buckets and rename a single histogram instrument. - customBucketsView, err := view.New( - // Match* to match instruments - view.MatchInstrumentName("custom_histogram"), - view.MatchInstrumentationScope(instrumentation.Scope{Name: meterName}), - - // With* to modify instruments - view.WithSetAggregation(aggregation.ExplicitBucketHistogram{ - Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, - }), - view.WithRename("bar"), - ) - if err != nil { - log.Fatal(err) - } - - // Default view to keep all instruments - defaultView, err := view.New(view.MatchInstrumentName("*")) - if err != nil { - log.Fatal(err) - } - provider := metric.NewMeterProvider( metric.WithReader(exporter), - metric.WithView(customBucketsView, defaultView), + // View to customize histogram buckets and rename a single histogram instrument. + metric.WithView(metric.NewView( + metric.Instrument{ + Name: "custom_histogram", + Scope: instrumentation.Scope{Name: meterName}, + }, + metric.Stream{ + Name: "bar", + Aggregation: aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, + }, + }, + )), ) meter := provider.Meter(meterName) diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/client.go index 0e522fa939a..622b2bdd2a7 100644 --- a/exporters/otlp/otlpmetric/client.go +++ b/exporters/otlp/otlpmetric/client.go @@ -17,19 +17,19 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric import ( "context" + "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) // Client handles the transmission of OTLP data to an OTLP receiving endpoint. type Client interface { // Temporality returns the Temporality to use for an instrument kind. - Temporality(view.InstrumentKind) metricdata.Temporality + Temporality(metric.InstrumentKind) metricdata.Temporality // Aggregation returns the Aggregation to use for an instrument kind. - Aggregation(view.InstrumentKind) aggregation.Aggregation + Aggregation(metric.InstrumentKind) aggregation.Aggregation // UploadMetrics transmits metric data to an OTLP receiver. // diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/exporter.go index 296f500d411..b7e06e51785 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/exporter.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -37,14 +36,14 @@ type exporter struct { } // Temporality returns the Temporality to use for an instrument kind. -func (e *exporter) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (e *exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { e.clientMu.Lock() defer e.clientMu.Unlock() return e.client.Temporality(k) } // Aggregation returns the Aggregation to use for an instrument kind. -func (e *exporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { e.clientMu.Lock() defer e.clientMu.Unlock() return e.client.Aggregation(k) @@ -113,11 +112,11 @@ func (c shutdownClient) err(ctx context.Context) error { return errShutdown } -func (c shutdownClient) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (c shutdownClient) Temporality(k metric.InstrumentKind) metricdata.Temporality { return c.temporalitySelector(k) } -func (c shutdownClient) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (c shutdownClient) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return c.aggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/exporter_test.go index 972d0cbf8fe..dc0ccb9903d 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/exporter_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -34,11 +33,11 @@ type client struct { n int } -func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index cf5da7e40f9..b5ab4e6f315 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/view" ) const ( @@ -336,7 +335,7 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { // Deep copy and validate before using. - wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { a := selector(ik) cpA := a.Copy() if err := cpA.Err(); err != nil { diff --git a/exporters/otlp/otlpmetric/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go index 51dddd09533..d2426af84c3 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options_test.go @@ -23,9 +23,9 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) const ( @@ -397,7 +397,7 @@ func TestConfigs(t *testing.T) { // Function value comparisons are disallowed, test non-default // behavior of a TemporalitySelector here to ensure our "catch // all" was set. - var undefinedKind view.InstrumentKind + var undefinedKind metric.InstrumentKind got := c.Metrics.TemporalitySelector assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) }, @@ -413,7 +413,7 @@ func TestConfigs(t *testing.T) { // Function value comparisons are disallowed, test non-default // behavior of a AggregationSelector here to ensure our "catch // all" was set. - var undefinedKind view.InstrumentKind + var undefinedKind metric.InstrumentKind got := c.Metrics.AggregationSelector assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) }, @@ -441,11 +441,11 @@ func TestConfigs(t *testing.T) { } } -func dropSelector(view.InstrumentKind) aggregation.Aggregation { +func dropSelector(metric.InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} } -func deltaSelector(view.InstrumentKind) metricdata.Temporality { +func deltaSelector(metric.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 427b68c4e8c..1db3cc78ea6 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -34,11 +33,11 @@ type client struct { storage *Storage } -func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index c001836c611..d2f64432d72 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -32,7 +32,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -106,12 +105,12 @@ func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error } // Temporality returns the Temporality to use for an instrument kind. -func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return c.temporalitySelector(k) } // Aggregation returns the Aggregation to use for an instrument kind. -func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return c.aggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 5232ac236a4..ecc170f198a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -37,7 +37,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -130,12 +129,12 @@ func newClient(opts ...Option) (otlpmetric.Client, error) { } // Temporality returns the Temporality to use for an instrument kind. -func (c *client) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return c.temporalitySelector(k) } // Aggregation returns the Aggregation to use for an instrument kind. -func (c *client) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return c.aggregationSelector(k) } diff --git a/exporters/prometheus/config_test.go b/exporters/prometheus/config_test.go index 0f3278c61df..2dd92e7abbc 100644 --- a/exporters/prometheus/config_test.go +++ b/exporters/prometheus/config_test.go @@ -20,14 +20,14 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/view" ) func TestNewConfig(t *testing.T) { registry := prometheus.NewRegistry() - aggregationSelector := func(view.InstrumentKind) aggregation.Aggregation { return nil } + aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil } testCases := []struct { name string @@ -112,7 +112,7 @@ func TestNewConfig(t *testing.T) { } func TestConfigManualReaderOptions(t *testing.T) { - aggregationSelector := func(view.InstrumentKind) aggregation.Aggregation { return nil } + aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil } testCases := []struct { name string diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index f4769ce4ffd..4edf11ba48a 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" ) @@ -269,18 +268,7 @@ func TestPrometheusExporter(t *testing.T) { exporter, err := New(append(tc.options, WithRegisterer(registry))...) require.NoError(t, err) - customBucketsView, err := view.New( - view.MatchInstrumentName("histogram_*"), - view.WithSetAggregation(aggregation.ExplicitBucketHistogram{ - Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, - }), - ) - require.NoError(t, err) - defaultView, err := view.New(view.MatchInstrumentName("*")) - require.NoError(t, err) - var res *resource.Resource - if tc.emptyResource { res = resource.Empty() } else { @@ -300,7 +288,12 @@ func TestPrometheusExporter(t *testing.T) { provider := metric.NewMeterProvider( metric.WithResource(res), metric.WithReader(exporter), - metric.WithView(customBucketsView, defaultView), + metric.WithView(metric.NewView( + metric.Instrument{Name: "histogram_*"}, + metric.Stream{Aggregation: aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + }}, + )), ) meter := provider.Meter( "testmeter", diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 2b40806c96d..60a76a0bbd5 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/view" ) // config contains options for the exporter. @@ -101,7 +100,7 @@ func (t temporalitySelectorOption) apply(c config) config { // instrument. func WithAggregationSelector(selector metric.AggregationSelector) Option { // Deep copy and validate before using. - wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { a := selector(ik) cpA := a.Copy() if err := cpA.Err(); err != nil { diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 8a9d55a4979..77cad9e934e 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) // exporter is an OpenTelemetry metric exporter. @@ -49,11 +48,11 @@ func New(options ...Option) (metric.Exporter, error) { return exp, nil } -func (e *exporter) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (e *exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { return e.temporalitySelector(k) } -func (e *exporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { return e.aggregationSelector(k) } diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index a7c3abb9bd1..a88180502b1 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -25,9 +25,9 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) func testEncoderOption() stdoutmetric.Option { @@ -100,7 +100,7 @@ func TestShutdownExporterReturnsShutdownErrorOnExport(t *testing.T) { assert.EqualError(t, exp.Export(ctx, data), "exporter shutdown") } -func deltaSelector(view.InstrumentKind) metricdata.Temporality { +func deltaSelector(metric.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } @@ -111,11 +111,11 @@ func TestTemporalitySelector(t *testing.T) { ) require.NoError(t, err) - var unknownKind view.InstrumentKind + var unknownKind metric.InstrumentKind assert.Equal(t, metricdata.DeltaTemporality, exp.Temporality(unknownKind)) } -func dropSelector(view.InstrumentKind) aggregation.Aggregation { +func dropSelector(metric.InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} } @@ -126,6 +126,6 @@ func TestAggregationSelector(t *testing.T) { ) require.NoError(t, err) - var unknownKind view.InstrumentKind + var unknownKind metric.InstrumentKind assert.Equal(t, aggregation.Drop{}, exp.Aggregation(unknownKind)) } diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index d26f598f676..9743c90cf87 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -20,10 +20,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument/syncint64" - "go.opentelemetry.io/otel/sdk/metric/view" ) -func benchCounter(b *testing.B, views ...view.View) (context.Context, Reader, syncint64.Counter) { +func benchCounter(b *testing.B, views ...View) (context.Context, Reader, syncint64.Counter) { ctx := context.Background() rdr := NewManualReader() provider := NewMeterProvider(WithReader(rdr), WithView(views...)) @@ -74,9 +73,12 @@ func BenchmarkCounterAddSingleUseInvalidAttrs(b *testing.B) { } func BenchmarkCounterAddSingleUseFilteredAttrs(b *testing.B) { - vw, _ := view.New(view.WithFilterAttributes(attribute.Key("K"))) - - ctx, _, cntr := benchCounter(b, vw) + ctx, _, cntr := benchCounter(b, NewView( + Instrument{Name: "*"}, + Stream{AttributeFilter: func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key("K") + }}, + )) for i := 0; i < b.N; i++ { cntr.Add(ctx, 1, attribute.Int("L", i), attribute.Int("K", i)) diff --git a/sdk/metric/config.go b/sdk/metric/config.go index ec1e06ab43b..c78b0416415 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -19,7 +19,6 @@ import ( "fmt" "sync" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -27,7 +26,7 @@ import ( type config struct { res *resource.Resource readers []Reader - views []view.View + views []View } // readerSignals returns a force-flush and shutdown function for a @@ -134,7 +133,7 @@ func WithReader(r Reader) Option { // // By default, if this option is not used, the MeterProvider will use the // default view. -func WithView(views ...view.View) Option { +func WithView(views ...View) Option { return optionFunc(func(cfg config) config { cfg.views = append(cfg.views, views...) return cfg diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index 3c3659a46e7..a924d879d00 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -39,12 +38,12 @@ type reader struct { var _ Reader = (*reader)(nil) -func (r *reader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (r *reader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. return r.aggregationFunc(kind) } func (r *reader) register(p producer) { r.producer = p } -func (r *reader) temporality(kind view.InstrumentKind) metricdata.Temporality { +func (r *reader) temporality(kind InstrumentKind) metricdata.Temporality { return r.temporalityFunc(kind) } func (r *reader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { @@ -132,16 +131,15 @@ func TestWithReader(t *testing.T) { } func TestWithView(t *testing.T) { - var views []view.View - - v, err := view.New(view.MatchInstrumentKind(view.AsyncCounter), view.WithRename("a")) - require.NoError(t, err) - views = append(views, v) - - v, err = view.New(view.MatchInstrumentKind(view.SyncCounter), view.WithRename("b")) - require.NoError(t, err) - views = append(views, v) - - c := newConfig([]Option{WithView(views...)}) - assert.Equal(t, views, c.views) + c := newConfig([]Option{WithView( + NewView( + Instrument{Kind: InstrumentKindAsyncCounter}, + Stream{Name: "a"}, + ), + NewView( + Instrument{Kind: InstrumentKindSyncCounter}, + Stream{Name: "b"}, + ), + )}) + assert.Len(t, c.views, 2) } diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index 6cbc7fdfc0d..92878ce8bc2 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -33,9 +33,7 @@ // // Each Reader, when registered with the MeterProvider, can be augmented with a // View. Views allow users that run OpenTelemetry instrumented code to modify -// the generated data of that instrumentation. See the -// go.opentelemetry.io/otel/sdk/metric/view package for more information about -// Views. +// the generated data of that instrumentation. // // The data generated by a MeterProvider needs to include information about its // origin. A MeterProvider needs to be configured with a Resource, using the diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 687d3eae9a6..d899b925aa9 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) // ErrExporterShutdown is returned if Export or Shutdown are called after an @@ -31,10 +30,10 @@ var ErrExporterShutdown = fmt.Errorf("exporter is shutdown") // the final component in the metric push pipeline. type Exporter interface { // Temporality returns the Temporality to use for an instrument kind. - Temporality(view.InstrumentKind) metricdata.Temporality + Temporality(InstrumentKind) metricdata.Temporality // Aggregation returns the Aggregation to use for an instrument kind. - Aggregation(view.InstrumentKind) aggregation.Aggregation + Aggregation(InstrumentKind) aggregation.Aggregation // Export serializes and transmits metric data to a receiver. // diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go index 25aad6cfc20..ade1f641521 100644 --- a/sdk/metric/instrument_provider.go +++ b/sdk/metric/instrument_provider.go @@ -20,54 +20,30 @@ import ( "go.opentelemetry.io/otel/metric/instrument/asyncint64" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/view" ) -// instProviderKey uniquely describes an instrument creation request received -// by an instrument provider. -type instProviderKey struct { - // Name is the name of the instrument. - Name string - // Description is the description of the instrument. - Description string - // Unit is the unit of the instrument. - Unit unit.Unit - // Kind is the instrument Kind provided. - Kind view.InstrumentKind -} - -// viewInst returns the instProviderKey as a view Instrument using scope s. -func (k instProviderKey) viewInst(s instrumentation.Scope) view.Instrument { - return view.Instrument{ - Scope: s, - Name: k.Name, - Description: k.Description, - Kind: k.Kind, - } -} - // instProvider provides all OpenTelemetry instruments. type instProvider[N int64 | float64] struct { + scope instrumentation.Scope resolve resolver[N] } -func newInstProvider[N int64 | float64](r resolver[N]) *instProvider[N] { - return &instProvider[N]{resolve: r} +func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) *instProvider[N] { + return &instProvider[N]{scope: s, resolve: newResolver(p, c)} } // lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind view.InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { +func (p *instProvider[N]) lookup(kind InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { cfg := instrument.NewConfig(opts...) - key := instProviderKey{ + i := Instrument{ Name: name, Description: cfg.Description(), Unit: cfg.Unit(), Kind: kind, + Scope: p.scope, } - - aggs, err := p.resolve.Aggregators(key) + aggs, err := p.resolve.Aggregators(i) return &instrumentImpl[N]{aggregators: aggs}, err } @@ -79,17 +55,17 @@ var _ asyncint64.InstrumentProvider = asyncInt64Provider{} // Counter creates an instrument for recording increasing values. func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - return p.lookup(view.AsyncCounter, name, opts) + return p.lookup(InstrumentKindAsyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - return p.lookup(view.AsyncUpDownCounter, name, opts) + return p.lookup(InstrumentKindAsyncUpDownCounter, name, opts) } // Gauge creates an instrument for recording the current value. func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - return p.lookup(view.AsyncGauge, name, opts) + return p.lookup(InstrumentKindAsyncGauge, name, opts) } type asyncFloat64Provider struct { @@ -100,17 +76,17 @@ var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} // Counter creates an instrument for recording increasing values. func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - return p.lookup(view.AsyncCounter, name, opts) + return p.lookup(InstrumentKindAsyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return p.lookup(view.AsyncUpDownCounter, name, opts) + return p.lookup(InstrumentKindAsyncUpDownCounter, name, opts) } // Gauge creates an instrument for recording the current value. func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - return p.lookup(view.AsyncGauge, name, opts) + return p.lookup(InstrumentKindAsyncGauge, name, opts) } type syncInt64Provider struct { @@ -121,17 +97,17 @@ var _ syncint64.InstrumentProvider = syncInt64Provider{} // Counter creates an instrument for recording increasing values. func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - return p.lookup(view.SyncCounter, name, opts) + return p.lookup(InstrumentKindSyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - return p.lookup(view.SyncUpDownCounter, name, opts) + return p.lookup(InstrumentKindSyncUpDownCounter, name, opts) } // Histogram creates an instrument for recording the current value. func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - return p.lookup(view.SyncHistogram, name, opts) + return p.lookup(InstrumentKindSyncHistogram, name, opts) } type syncFloat64Provider struct { @@ -142,15 +118,15 @@ var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} // Counter creates an instrument for recording increasing values. func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - return p.lookup(view.SyncCounter, name, opts) + return p.lookup(InstrumentKindSyncCounter, name, opts) } // UpDownCounter creates an instrument for recording changes of a value. func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return p.lookup(view.SyncUpDownCounter, name, opts) + return p.lookup(InstrumentKindSyncUpDownCounter, name, opts) } // Histogram creates an instrument for recording the current value. func (p syncFloat64Provider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - return p.lookup(view.SyncHistogram, name, opts) + return p.lookup(InstrumentKindSyncHistogram, name, opts) } diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/filter.go index 8acbdc79a02..86e73c866dc 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/filter.go @@ -24,7 +24,7 @@ import ( // filter is an aggregator that applies attribute filter when Aggregating. filters // do not have any backing memory, and must be constructed with a backing Aggregator. type filter[N int64 | float64] struct { - filter func(attribute.Set) attribute.Set + filter attribute.Filter aggregator Aggregator[N] sync.Mutex @@ -32,7 +32,7 @@ type filter[N int64 | float64] struct { } // NewFilter wraps an Aggregator with an attribute filtering function. -func NewFilter[N int64 | float64](agg Aggregator[N], fn func(attribute.Set) attribute.Set) Aggregator[N] { +func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggregator[N] { if fn == nil { return agg } @@ -51,7 +51,7 @@ func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { defer f.Unlock() fAttr, ok := f.seen[attr] if !ok { - fAttr = f.filter(attr) + fAttr, _ = attr.Filter(f.filter) f.seen[attr] = fAttr } f.aggregator.Aggregate(measurement, fAttr) diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/filter_test.go index 14f572a5f8e..e5632156b30 100644 --- a/sdk/metric/internal/filter_test.go +++ b/sdk/metric/internal/filter_test.go @@ -64,11 +64,8 @@ func testNewFilter[N int64 | float64](t *testing.T, agg Aggregator[N]) { assert.Equal(t, agg, filt.aggregator) } -func testAttributeFilter(input attribute.Set) attribute.Set { - out, _ := input.Filter(func(kv attribute.KeyValue) bool { - return kv.Key == "power-level" - }) - return out +var testAttributeFilter = func(kv attribute.KeyValue) bool { + return kv.Key == "power-level" } func TestNewFilter(t *testing.T) { diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 62ccf0f0535..7860a3be2b9 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) // manualReader is a a simple Reader that allows an application to @@ -59,12 +58,12 @@ func (mr *manualReader) register(p producer) { } // temporality reports the Temporality for the instrument kind provided. -func (mr *manualReader) temporality(kind view.InstrumentKind) metricdata.Temporality { +func (mr *manualReader) temporality(kind InstrumentKind) metricdata.Temporality { return mr.temporalitySelector(kind) } // aggregation returns what Aggregation to use for kind. -func (mr *manualReader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (mr *manualReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. return mr.aggregationSelector(kind) } @@ -138,7 +137,7 @@ func WithTemporalitySelector(selector TemporalitySelector) ManualReaderOption { } type temporalitySelectorOption struct { - selector func(instrument view.InstrumentKind) metricdata.Temporality + selector func(instrument InstrumentKind) metricdata.Temporality } // applyManual returns a manualReaderConfig with option applied. @@ -153,7 +152,7 @@ func (t temporalitySelectorOption) applyManual(mrc manualReaderConfig) manualRea // or the aggregation explicitly passed for a view matching an instrument. func WithAggregationSelector(selector AggregationSelector) ManualReaderOption { // Deep copy and validate before using. - wrapped := func(ik view.InstrumentKind) aggregation.Aggregation { + wrapped := func(ik InstrumentKind) aggregation.Aggregation { a := selector(ik) cpA := a.Copy() if err := cpA.Err(); err != nil { diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 7d54be113c1..f20b0bc683c 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/suite" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) func TestManualReader(t *testing.T) { @@ -32,8 +31,8 @@ func BenchmarkManualReader(b *testing.B) { b.Run("Collect", benchReaderCollectFunc(NewManualReader())) } -var deltaTemporalitySelector = func(view.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } -var cumulativeTemporalitySelector = func(view.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } +var deltaTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } +var cumulativeTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } func TestManualReaderTemporality(t *testing.T) { tests := []struct { @@ -66,7 +65,7 @@ func TestManualReaderTemporality(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var undefinedInstrument view.InstrumentKind + var undefinedInstrument InstrumentKind rdr := NewManualReader(tt.options...) assert.Equal(t, tt.wantTemporality, rdr.temporality(undefinedInstrument)) }) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 3f9f30106eb..418827e9672 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -47,13 +47,10 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { ic := newInstrumentCache[int64](nil, &viewCache) fc := newInstrumentCache[float64](nil, &viewCache) - ir := newResolver(s, p, ic) - fr := newResolver(s, p, fc) - return &meter{ pipes: p, - instProviderInt64: newInstProvider(ir), - instProviderFloat64: newInstProvider(fr), + instProviderInt64: newInstProvider(s, p, ic), + instProviderFloat64: newInstProvider(s, p, fc), } } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 6edc58d17ce..013a52e5924 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -33,7 +33,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -482,7 +481,7 @@ func TestMetersProvideScope(t *testing.T) { } func TestRegisterCallbackDropAggregations(t *testing.T) { - aggFn := func(view.InstrumentKind) aggregation.Aggregation { + aggFn := func(InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} } r := NewManualReader(WithAggregationSelector(aggFn)) @@ -852,19 +851,17 @@ func TestAttributeFilter(t *testing.T) { for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { - v, err := view.New( - view.MatchInstrumentName("*"), - view.WithFilterAttributes(attribute.Key("foo")), - ) - require.NoError(t, err) rdr := NewManualReader() mtr := NewMeterProvider( WithReader(rdr), - WithView(v), + WithView(NewView( + Instrument{Name: "*"}, + Stream{AttributeFilter: func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key("foo") + }}, + )), ).Meter("TestAttributeFilter") - - err = tt.register(t, mtr) - require.NoError(t, err) + require.NoError(t, tt.register(t, mtr)) m, err := rdr.Collect(context.Background()) assert.NoError(t, err) diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 3dc7ed2d045..00ba1305595 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) // Default periodic reader timing. @@ -176,12 +175,12 @@ func (r *periodicReader) register(p producer) { } // temporality reports the Temporality for the instrument kind provided. -func (r *periodicReader) temporality(kind view.InstrumentKind) metricdata.Temporality { +func (r *periodicReader) temporality(kind InstrumentKind) metricdata.Temporality { return r.exporter.Temporality(kind) } // aggregation returns what Aggregation to use for kind. -func (r *periodicReader) aggregation(kind view.InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (r *periodicReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. return r.exporter.Aggregation(kind) } diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index c0bf06a3086..d48c1a7de8e 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) const testDur = time.Second * 2 @@ -64,14 +63,14 @@ type fnExporter struct { var _ Exporter = (*fnExporter)(nil) -func (e *fnExporter) Temporality(k view.InstrumentKind) metricdata.Temporality { +func (e *fnExporter) Temporality(k InstrumentKind) metricdata.Temporality { if e.temporalityFunc != nil { return e.temporalityFunc(k) } return DefaultTemporalitySelector(k) } -func (e *fnExporter) Aggregation(k view.InstrumentKind) aggregation.Aggregation { +func (e *fnExporter) Aggregation(k InstrumentKind) aggregation.Aggregation { if e.aggregationFunc != nil { return e.aggregationFunc(k) } @@ -272,7 +271,7 @@ func TestPeriodiclReaderTemporality(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var undefinedInstrument view.InstrumentKind + var undefinedInstrument InstrumentKind rdr := NewPeriodicReader(tt.exporter) assert.Equal(t, tt.wantTemporality.String(), rdr.temporality(undefinedInstrument).String()) }) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 46ad0806bdf..bc6901e5775 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -21,14 +21,12 @@ import ( "strings" "sync" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -52,7 +50,7 @@ type instrumentSync struct { aggregator aggregator } -func newPipeline(res *resource.Resource, reader Reader, views []view.View) *pipeline { +func newPipeline(res *resource.Resource, reader Reader, views []View) *pipeline { if res == nil { res = resource.Empty() } @@ -73,7 +71,7 @@ type pipeline struct { resource *resource.Resource reader Reader - views []view.View + views []View sync.Mutex aggregations map[instrumentation.Scope][]instrumentSync @@ -159,13 +157,12 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err // inserter facilitates inserting of new instruments from a single scope into a // pipeline. type inserter[N int64 | float64] struct { - scope instrumentation.Scope cache instrumentCache[N] pipeline *pipeline } -func newInserter[N int64 | float64](s instrumentation.Scope, p *pipeline, c instrumentCache[N]) *inserter[N] { - return &inserter[N]{scope: s, cache: c, pipeline: p} +func newInserter[N int64 | float64](p *pipeline, c instrumentCache[N]) *inserter[N] { + return &inserter[N]{cache: c, pipeline: p} } // Instrument inserts the instrument inst with instUnit into a pipeline. All @@ -189,7 +186,7 @@ func newInserter[N int64 | float64](s instrumentation.Scope, p *pipeline, c inst // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(key instProviderKey) ([]internal.Aggregator[N], error) { +func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], error) { var ( matched bool aggs []internal.Aggregator[N] @@ -199,15 +196,14 @@ func (i *inserter[N]) Instrument(key instProviderKey) ([]internal.Aggregator[N], // The cache will return the same Aggregator instance. Use this fact to // compare pointer addresses to deduplicate Aggregators. seen := make(map[internal.Aggregator[N]]struct{}) - inst := key.viewInst(i.scope) for _, v := range i.pipeline.views { - inst, match := v.TransformInstrument(inst) + stream, match := v(inst) if !match { continue } matched = true - agg, err := i.cachedAggregator(inst, key.Unit, v.AttributeFilter()) + agg, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) if err != nil { errs.append(err) } @@ -227,7 +223,12 @@ func (i *inserter[N]) Instrument(key instProviderKey) ([]internal.Aggregator[N], } // Apply implicit default view if no explicit matched. - agg, err := i.cachedAggregator(inst, key.Unit, nil) + stream := Stream{ + Name: inst.Name, + Description: inst.Description, + Unit: inst.Unit, + } + agg, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) if err != nil { errs.append(err) } @@ -251,40 +252,40 @@ func (i *inserter[N]) Instrument(key instProviderKey) ([]internal.Aggregator[N], // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(inst view.Instrument, u unit.Unit, filter func(attribute.Set) attribute.Set) (internal.Aggregator[N], error) { - switch inst.Aggregation.(type) { +func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (internal.Aggregator[N], error) { + switch stream.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. - inst.Aggregation = i.pipeline.reader.aggregation(inst.Kind) + stream.Aggregation = i.pipeline.reader.aggregation(kind) } - if err := isAggregatorCompatible(inst.Kind, inst.Aggregation); err != nil { + if err := isAggregatorCompatible(kind, stream.Aggregation); err != nil { return nil, fmt.Errorf( "creating aggregator with instrumentKind: %d, aggregation %v: %w", - inst.Kind, inst.Aggregation, err, + kind, stream.Aggregation, err, ) } - id := i.instrumentID(inst, u) + id := i.instrumentID(kind, stream) // If there is a conflict, the specification says the view should // still be applied and a warning should be logged. i.logConflict(id) return i.cache.LookupAggregator(id, func() (internal.Aggregator[N], error) { - agg, err := i.aggregator(inst.Aggregation, inst.Kind, id.Temporality, id.Monotonic) + agg, err := i.aggregator(stream.Aggregation, kind, id.Temporality, id.Monotonic) if err != nil { return nil, err } if agg == nil { // Drop aggregator. return nil, nil } - if filter != nil { - agg = internal.NewFilter(agg, filter) + if stream.AttributeFilter != nil { + agg = internal.NewFilter(agg, stream.AttributeFilter) } - i.pipeline.addSync(inst.Scope, instrumentSync{ - name: inst.Name, - description: inst.Description, - unit: u, + i.pipeline.addSync(scope, instrumentSync{ + name: stream.Name, + description: stream.Description, + unit: stream.Unit, aggregator: agg, }) return agg, err @@ -311,19 +312,19 @@ func (i *inserter[N]) logConflict(id instrumentID) { ) } -func (i *inserter[N]) instrumentID(vi view.Instrument, u unit.Unit) instrumentID { +func (i *inserter[N]) instrumentID(kind InstrumentKind, stream Stream) instrumentID { var zero N id := instrumentID{ - Name: vi.Name, - Description: vi.Description, - Unit: u, - Aggregation: fmt.Sprintf("%T", vi.Aggregation), - Temporality: i.pipeline.reader.temporality(vi.Kind), + Name: stream.Name, + Description: stream.Description, + Unit: stream.Unit, + Aggregation: fmt.Sprintf("%T", stream.Aggregation), + Temporality: i.pipeline.reader.temporality(kind), Number: fmt.Sprintf("%T", zero), } - switch vi.Kind { - case view.AsyncCounter, view.SyncCounter, view.SyncHistogram: + switch kind { + case InstrumentKindAsyncCounter, InstrumentKindSyncCounter, InstrumentKindSyncHistogram: id.Monotonic = true } @@ -333,7 +334,7 @@ func (i *inserter[N]) instrumentID(vi view.Instrument, u unit.Unit) instrumentID // aggregator returns a new Aggregator matching agg, kind, temporality, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { switch a := agg.(type) { case aggregation.Drop: return nil, nil @@ -341,7 +342,7 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.Instrume return internal.NewLastValue[N](), nil case aggregation.Sum: switch kind { - case view.AsyncCounter, view.AsyncUpDownCounter: + case InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter: // Asynchronous counters and up-down-counters are defined to record // the absolute value of the count: // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation @@ -387,10 +388,10 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind view.Instrume // | Async Counter | X | | X | | | // | Async UpDown Counter | X | | X | | | // | Async Gauge | X | X | | | |. -func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregation) error { +func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { case aggregation.ExplicitBucketHistogram: - if kind == view.SyncCounter || kind == view.SyncHistogram { + if kind == InstrumentKindSyncCounter || kind == InstrumentKindSyncHistogram { return nil } // TODO: review need for aggregation check after @@ -398,7 +399,7 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio return errIncompatibleAggregation case aggregation.Sum: switch kind { - case view.AsyncCounter, view.AsyncUpDownCounter, view.SyncCounter, view.SyncHistogram, view.SyncUpDownCounter: + case InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter, InstrumentKindSyncCounter, InstrumentKindSyncHistogram, InstrumentKindSyncUpDownCounter: return nil default: // TODO: review need for aggregation check after @@ -406,7 +407,7 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio return errIncompatibleAggregation } case aggregation.LastValue: - if kind == view.AsyncGauge { + if kind == InstrumentKindAsyncGauge { return nil } // TODO: review need for aggregation check after @@ -424,7 +425,7 @@ func isAggregatorCompatible(kind view.InstrumentKind, agg aggregation.Aggregatio // measurement. type pipelines []*pipeline -func newPipelines(res *resource.Resource, readers []Reader, views []view.View) pipelines { +func newPipelines(res *resource.Resource, readers []Reader, views []View) pipelines { pipes := make([]*pipeline, 0, len(readers)) for _, r := range readers { p := &pipeline{ @@ -451,22 +452,22 @@ type resolver[N int64 | float64] struct { inserters []*inserter[N] } -func newResolver[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) resolver[N] { +func newResolver[N int64 | float64](p pipelines, c instrumentCache[N]) resolver[N] { in := make([]*inserter[N], len(p)) for i := range in { - in[i] = newInserter(s, p[i], c) + in[i] = newInserter(p[i], c) } return resolver[N]{in} } // Aggregators returns the Aggregators that must be updated by the instrument // defined by key. -func (r resolver[N]) Aggregators(key instProviderKey) ([]internal.Aggregator[N], error) { +func (r resolver[N]) Aggregators(id Instrument) ([]internal.Aggregator[N], error) { var aggs []internal.Aggregator[N] errs := &multierror{} for _, i := range r.inserters { - a, err := i.Instrument(key) + a, err := i.Instrument(id) if err != nil { errs.append(err) } diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 3f73637bf5f..91580242763 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -25,13 +25,13 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) +var defaultView = NewView(Instrument{Name: "*"}, Stream{}) + type invalidAggregation struct { aggregation.Aggregation } @@ -44,180 +44,179 @@ func (invalidAggregation) Err() error { } func testCreateAggregators[N int64 | float64](t *testing.T) { - changeAggView, _ := view.New( - view.MatchInstrumentName("foo"), - view.WithSetAggregation(aggregation.ExplicitBucketHistogram{}), + changeAggView := NewView( + Instrument{Name: "foo"}, + Stream{Aggregation: aggregation.ExplicitBucketHistogram{}}, ) - renameView, _ := view.New( - view.MatchInstrumentName("foo"), - view.WithRename("bar"), + renameView := NewView( + Instrument{Name: "foo"}, + Stream{Name: "bar"}, ) - defaultAggView, _ := view.New( - view.MatchInstrumentName("foo"), - view.WithSetAggregation(aggregation.Default{}), + defaultAggView := NewView( + Instrument{Name: "foo"}, + Stream{Aggregation: aggregation.Default{}}, ) - invalidAggView, _ := view.New( - view.MatchInstrumentName("foo"), - view.WithSetAggregation(invalidAggregation{}), + invalidAggView := NewView( + Instrument{Name: "foo"}, + Stream{Aggregation: invalidAggregation{}}, ) - instruments := []instProviderKey{ - {Name: "foo", Kind: view.InstrumentKind(0)}, //Unknown kind - {Name: "foo", Kind: view.SyncCounter}, - {Name: "foo", Kind: view.SyncUpDownCounter}, - {Name: "foo", Kind: view.SyncHistogram}, - {Name: "foo", Kind: view.AsyncCounter}, - {Name: "foo", Kind: view.AsyncUpDownCounter}, - {Name: "foo", Kind: view.AsyncGauge}, + instruments := []Instrument{ + {Name: "foo", Kind: InstrumentKind(0)}, //Unknown kind + {Name: "foo", Kind: InstrumentKindSyncCounter}, + {Name: "foo", Kind: InstrumentKindSyncUpDownCounter}, + {Name: "foo", Kind: InstrumentKindSyncHistogram}, + {Name: "foo", Kind: InstrumentKindAsyncCounter}, + {Name: "foo", Kind: InstrumentKindAsyncUpDownCounter}, + {Name: "foo", Kind: InstrumentKindAsyncGauge}, } testcases := []struct { name string reader Reader - views []view.View - inst instProviderKey + views []View + inst Instrument wantKind internal.Aggregator[N] //Aggregators should match len and types wantLen int wantErr error }{ { name: "drop should return 0 aggregators", - reader: NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), - views: []view.View{{}}, - inst: instruments[view.SyncCounter], + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindSyncCounter], }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.SyncUpDownCounter], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindSyncUpDownCounter], wantKind: internal.NewDeltaSum[N](false), wantLen: 1, }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.SyncHistogram], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindSyncHistogram], wantKind: internal.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.AsyncCounter], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindAsyncCounter], wantKind: internal.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.AsyncUpDownCounter], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindAsyncUpDownCounter], wantKind: internal.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.AsyncGauge], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindAsyncGauge], wantKind: internal.NewLastValue[N](), wantLen: 1, }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []view.View{defaultAggView}, - inst: instruments[view.SyncCounter], + views: []View{defaultAggView}, + inst: instruments[InstrumentKindSyncCounter], wantKind: internal.NewDeltaSum[N](true), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.SyncUpDownCounter], + views: []View{defaultView}, + inst: instruments[InstrumentKindSyncUpDownCounter], wantKind: internal.NewCumulativeSum[N](false), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.SyncHistogram], + views: []View{defaultView}, + inst: instruments[InstrumentKindSyncHistogram], wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.AsyncCounter], + views: []View{defaultView}, + inst: instruments[InstrumentKindAsyncCounter], wantKind: internal.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.AsyncUpDownCounter], + views: []View{defaultView}, + inst: instruments[InstrumentKindAsyncUpDownCounter], wantKind: internal.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.AsyncGauge], + views: []View{defaultView}, + inst: instruments[InstrumentKindAsyncGauge], wantKind: internal.NewLastValue[N](), wantLen: 1, }, { name: "reader should set default agg", reader: NewManualReader(), - views: []view.View{{}}, - inst: instruments[view.SyncCounter], + views: []View{defaultView}, + inst: instruments[InstrumentKindSyncCounter], wantKind: internal.NewCumulativeSum[N](true), wantLen: 1, }, { name: "view should overwrite reader", reader: NewManualReader(), - views: []view.View{changeAggView}, - inst: instruments[view.SyncCounter], + views: []View{changeAggView}, + inst: instruments[InstrumentKindSyncCounter], wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { name: "multiple views should create multiple aggregators", reader: NewManualReader(), - views: []view.View{{}, renameView}, - inst: instruments[view.SyncCounter], + views: []View{defaultView, renameView}, + inst: instruments[InstrumentKindSyncCounter], wantKind: internal.NewCumulativeSum[N](true), wantLen: 2, }, { name: "reader with invalid aggregation should error", - reader: NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []view.View{{}}, - inst: instruments[view.SyncCounter], + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindSyncCounter], wantErr: errCreatingAggregators, }, { name: "view with invalid aggregation should error", reader: NewManualReader(), - views: []view.View{invalidAggView}, - inst: instruments[view.SyncCounter], + views: []View{invalidAggView}, + inst: instruments[InstrumentKindSyncCounter], wantErr: errCreatingAggregators, }, } - s := instrumentation.Scope{Name: "testCreateAggregators"} for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { c := newInstrumentCache[N](nil, nil) - i := newInserter(s, newPipeline(nil, tt.reader, tt.views), c) + i := newInserter(newPipeline(nil, tt.reader, tt.views), c) got, err := i.Instrument(tt.inst) assert.ErrorIs(t, err, tt.wantErr) require.Len(t, got, tt.wantLen) @@ -230,11 +229,10 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { func testInvalidInstrumentShouldPanic[N int64 | float64]() { c := newInstrumentCache[N](nil, nil) - s := instrumentation.Scope{Name: "testInvalidInstrumentShouldPanic"} - i := newInserter(s, newPipeline(nil, NewManualReader(), []view.View{{}}), c) - inst := instProviderKey{ + i := newInserter(newPipeline(nil, NewManualReader(), []View{defaultView}), c) + inst := Instrument{ Name: "foo", - Kind: view.InstrumentKind(255), + Kind: InstrumentKind(255), } _, _ = i.Instrument(inst) } @@ -250,57 +248,52 @@ func TestCreateAggregators(t *testing.T) { } func TestPipelineRegistryCreateAggregators(t *testing.T) { - renameView, _ := view.New( - view.MatchInstrumentName("foo"), - view.WithRename("bar"), - ) + renameView := NewView(Instrument{Name: "foo"}, Stream{Name: "bar"}) testRdr := NewManualReader() - testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) testCases := []struct { name string readers []Reader - views []view.View - inst view.Instrument + views []View + inst Instrument wantCount int }{ { name: "No views have no aggregators", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, }, { name: "1 reader 1 view gets 1 aggregator", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, readers: []Reader{testRdr}, - views: []view.View{{}}, wantCount: 1, }, { name: "1 reader 2 views gets 2 aggregator", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, readers: []Reader{testRdr}, - views: []view.View{{}, renameView}, + views: []View{defaultView, renameView}, wantCount: 2, }, { name: "2 readers 1 view each gets 2 aggregators", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, readers: []Reader{testRdr, testRdrHistogram}, - views: []view.View{{}}, wantCount: 2, }, { name: "2 reader 2 views each gets 4 aggregators", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, readers: []Reader{testRdr, testRdrHistogram}, - views: []view.View{{}, renameView}, + views: []View{defaultView, renameView}, wantCount: 4, }, { name: "An instrument is duplicated in two views share the same aggregator", - inst: view.Instrument{Name: "foo"}, + inst: Instrument{Name: "foo"}, readers: []Reader{testRdr}, - views: []view.View{{}, {}}, + views: []View{defaultView, defaultView}, wantCount: 1, }, } @@ -315,11 +308,9 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { } func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { - inst := instProviderKey{Name: "foo", Kind: view.SyncCounter} - + inst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} c := newInstrumentCache[int64](nil, nil) - s := instrumentation.Scope{Name: "testPipelineRegistryResolveIntAggregators"} - r := newResolver(s, p, c) + r := newResolver(p, c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -327,11 +318,9 @@ func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCo } func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { - inst := instProviderKey{Name: "foo", Kind: view.SyncCounter} - + inst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} c := newInstrumentCache[float64](nil, nil) - s := instrumentation.Scope{Name: "testPipelineRegistryResolveFloatAggregators"} - r := newResolver(s, p, c) + r := newResolver(p, c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -339,10 +328,9 @@ func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, want } func TestPipelineRegistryResource(t *testing.T) { - v, err := view.New(view.MatchInstrumentName("bar"), view.WithRename("foo")) - require.NoError(t, err) + v := NewView(Instrument{Name: "bar"}, Stream{Name: "foo"}) readers := []Reader{NewManualReader()} - views := []view.View{{}, v} + views := []View{defaultView, v} res := resource.NewSchemaless(attribute.String("key", "val")) pipes := newPipelines(res, readers, views) for _, p := range pipes { @@ -351,21 +339,20 @@ func TestPipelineRegistryResource(t *testing.T) { } func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { - testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik view.InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) readers := []Reader{testRdrHistogram} - views := []view.View{{}} + views := []View{defaultView} p := newPipelines(resource.Empty(), readers, views) - inst := instProviderKey{Name: "foo", Kind: view.AsyncGauge} + inst := Instrument{Name: "foo", Kind: InstrumentKindAsyncGauge} vc := cache[string, instrumentID]{} - s := instrumentation.Scope{Name: "TestPipelineRegistryCreateAggregatorsIncompatibleInstrument"} - ri := newResolver(s, p, newInstrumentCache[int64](nil, &vc)) + ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(inst) assert.Error(t, err) assert.Len(t, intAggs, 0) - rf := newResolver(s, p, newInstrumentCache[float64](nil, &vc)) + rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) floatAggs, err := rf.Aggregators(inst) assert.Error(t, err) assert.Len(t, floatAggs, 0) @@ -401,21 +388,17 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { l := &logCounter{LogSink: tLog.GetSink()} otel.SetLogger(logr.New(l)) - renameView, _ := view.New( - view.MatchInstrumentName("bar"), - view.WithRename("foo"), - ) + renameView := NewView(Instrument{Name: "bar"}, Stream{Name: "foo"}) readers := []Reader{NewManualReader()} - views := []view.View{{}, renameView} + views := []View{defaultView, renameView} - fooInst := instProviderKey{Name: "foo", Kind: view.SyncCounter} - barInst := instProviderKey{Name: "bar", Kind: view.SyncCounter} + fooInst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} + barInst := Instrument{Name: "bar", Kind: InstrumentKindSyncCounter} p := newPipelines(resource.Empty(), readers, views) vc := cache[string, instrumentID]{} - s := instrumentation.Scope{Name: "TestPipelineRegistryCreateAggregatorsDuplicateErrors"} - ri := newResolver(s, p, newInstrumentCache[int64](nil, &vc)) + ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 0, l.InfoN(), "no info logging should happen") @@ -430,13 +413,13 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { // Creating a float foo instrument should log a warning because there is an // int foo instrument. - rf := newResolver(s, p, newInstrumentCache[float64](nil, &vc)) + rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) floatAggs, err := rf.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 1, l.InfoN(), "instrument conflict not logged") assert.Len(t, floatAggs, 1) - fooInst = instProviderKey{Name: "foo-float", Kind: view.SyncCounter} + fooInst = Instrument{Name: "foo-float", Kind: InstrumentKindSyncCounter} floatAggs, err = rf.Aggregators(fooInst) assert.NoError(t, err) @@ -452,147 +435,147 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { } func TestIsAggregatorCompatible(t *testing.T) { - var undefinedInstrument view.InstrumentKind + var undefinedInstrument InstrumentKind testCases := []struct { name string - kind view.InstrumentKind + kind InstrumentKind agg aggregation.Aggregation want error }{ { name: "SyncCounter and Drop", - kind: view.SyncCounter, + kind: InstrumentKindSyncCounter, agg: aggregation.Drop{}, }, { name: "SyncCounter and LastValue", - kind: view.SyncCounter, + kind: InstrumentKindSyncCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncCounter and Sum", - kind: view.SyncCounter, + kind: InstrumentKindSyncCounter, agg: aggregation.Sum{}, }, { name: "SyncCounter and ExplicitBucketHistogram", - kind: view.SyncCounter, + kind: InstrumentKindSyncCounter, agg: aggregation.ExplicitBucketHistogram{}, }, { name: "SyncUpDownCounter and Drop", - kind: view.SyncUpDownCounter, + kind: InstrumentKindSyncUpDownCounter, agg: aggregation.Drop{}, }, { name: "SyncUpDownCounter and LastValue", - kind: view.SyncUpDownCounter, + kind: InstrumentKindSyncUpDownCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncUpDownCounter and Sum", - kind: view.SyncUpDownCounter, + kind: InstrumentKindSyncUpDownCounter, agg: aggregation.Sum{}, }, { name: "SyncUpDownCounter and ExplicitBucketHistogram", - kind: view.SyncUpDownCounter, + kind: InstrumentKindSyncUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "SyncHistogram and Drop", - kind: view.SyncHistogram, + kind: InstrumentKindSyncHistogram, agg: aggregation.Drop{}, }, { name: "SyncHistogram and LastValue", - kind: view.SyncHistogram, + kind: InstrumentKindSyncHistogram, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncHistogram and Sum", - kind: view.SyncHistogram, + kind: InstrumentKindSyncHistogram, agg: aggregation.Sum{}, }, { name: "SyncHistogram and ExplicitBucketHistogram", - kind: view.SyncHistogram, + kind: InstrumentKindSyncHistogram, agg: aggregation.ExplicitBucketHistogram{}, }, { name: "AsyncCounter and Drop", - kind: view.AsyncCounter, + kind: InstrumentKindAsyncCounter, agg: aggregation.Drop{}, }, { name: "AsyncCounter and LastValue", - kind: view.AsyncCounter, + kind: InstrumentKindAsyncCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "AsyncCounter and Sum", - kind: view.AsyncCounter, + kind: InstrumentKindAsyncCounter, agg: aggregation.Sum{}, }, { name: "AsyncCounter and ExplicitBucketHistogram", - kind: view.AsyncCounter, + kind: InstrumentKindAsyncCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "AsyncUpDownCounter and Drop", - kind: view.AsyncUpDownCounter, + kind: InstrumentKindAsyncUpDownCounter, agg: aggregation.Drop{}, }, { name: "AsyncUpDownCounter and LastValue", - kind: view.AsyncUpDownCounter, + kind: InstrumentKindAsyncUpDownCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "AsyncUpDownCounter and Sum", - kind: view.AsyncUpDownCounter, + kind: InstrumentKindAsyncUpDownCounter, agg: aggregation.Sum{}, }, { name: "AsyncUpDownCounter and ExplicitBucketHistogram", - kind: view.AsyncUpDownCounter, + kind: InstrumentKindAsyncUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "AsyncGauge and Drop", - kind: view.AsyncGauge, + kind: InstrumentKindAsyncGauge, agg: aggregation.Drop{}, }, { name: "AsyncGauge and aggregation.LastValue{}", - kind: view.AsyncGauge, + kind: InstrumentKindAsyncGauge, agg: aggregation.LastValue{}, }, { name: "AsyncGauge and Sum", - kind: view.AsyncGauge, + kind: InstrumentKindAsyncGauge, agg: aggregation.Sum{}, want: errIncompatibleAggregation, }, { name: "AsyncGauge and ExplicitBucketHistogram", - kind: view.AsyncGauge, + kind: InstrumentKindAsyncGauge, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "Default aggregation should error", - kind: view.SyncCounter, + kind: InstrumentKindSyncCounter, agg: aggregation.Default{}, want: errUnknownAggregation, }, diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 678d173c4e6..fe702a2d1ab 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -134,18 +133,14 @@ func TestDefaultViewImplicit(t *testing.T) { } func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { - scope := instrumentation.Scope{Name: "testing/lib"} - inst := instProviderKey{ + inst := Instrument{ Name: "requests", Description: "count of requests received", - Kind: view.SyncCounter, + Kind: InstrumentKindSyncCounter, Unit: unit.Dimensionless, } return func(t *testing.T) { reader := NewManualReader() - v, err := view.New(view.MatchInstrumentName("foo"), view.WithRename("bar")) - require.NoError(t, err) - tests := []struct { name string pipe *pipeline @@ -156,14 +151,16 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { }, { name: "NoMatchingView", - pipe: newPipeline(nil, reader, []view.View{v}), + pipe: newPipeline(nil, reader, []View{ + NewView(Instrument{Name: "foo"}, Stream{Name: "bar"}), + }), }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { c := newInstrumentCache[N](nil, nil) - i := newInserter(scope, test.pipe, c) + i := newInserter(test.pipe, c) got, err := i.Instrument(inst) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 53c13c4bffe..aa9d50ef666 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" ) // errDuplicateRegister is logged by a Reader when an attempt to registered it @@ -55,10 +54,10 @@ type Reader interface { register(producer) // temporality reports the Temporality for the instrument kind provided. - temporality(view.InstrumentKind) metricdata.Temporality + temporality(InstrumentKind) metricdata.Temporality // aggregation returns what Aggregation to use for an instrument kind. - aggregation(view.InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. + aggregation(InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. // Collect gathers and returns all metric data related to the Reader from // the SDK. An error is returned if this is called after Shutdown. @@ -108,18 +107,18 @@ func (p shutdownProducer) produce(context.Context) (metricdata.ResourceMetrics, } // TemporalitySelector selects the temporality to use based on the InstrumentKind. -type TemporalitySelector func(view.InstrumentKind) metricdata.Temporality +type TemporalitySelector func(InstrumentKind) metricdata.Temporality // DefaultTemporalitySelector is the default TemporalitySelector used if // WithTemporalitySelector is not provided. CumulativeTemporality will be used // for all instrument kinds if this TemporalitySelector is used. -func DefaultTemporalitySelector(view.InstrumentKind) metricdata.Temporality { +func DefaultTemporalitySelector(InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } // AggregationSelector selects the aggregation and the parameters to use for // that aggregation based on the InstrumentKind. -type AggregationSelector func(view.InstrumentKind) aggregation.Aggregation +type AggregationSelector func(InstrumentKind) aggregation.Aggregation // DefaultAggregationSelector returns the default aggregation and parameters // that will be used to summarize measurement made from an instrument of @@ -127,13 +126,13 @@ type AggregationSelector func(view.InstrumentKind) aggregation.Aggregation // mapping: Counter ⇨ Sum, Asynchronous Counter ⇨ Sum, UpDownCounter ⇨ Sum, // Asynchronous UpDownCounter ⇨ Sum, Asynchronous Gauge ⇨ LastValue, // Histogram ⇨ ExplicitBucketHistogram. -func DefaultAggregationSelector(ik view.InstrumentKind) aggregation.Aggregation { +func DefaultAggregationSelector(ik InstrumentKind) aggregation.Aggregation { switch ik { - case view.SyncCounter, view.SyncUpDownCounter, view.AsyncCounter, view.AsyncUpDownCounter: + case InstrumentKindSyncCounter, InstrumentKindSyncUpDownCounter, InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter: return aggregation.Sum{} - case view.AsyncGauge: + case InstrumentKindAsyncGauge: return aggregation.LastValue{} - case view.SyncHistogram: + case InstrumentKindSyncHistogram: return aggregation.ExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, NoMinMax: false, diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 43f923a1564..28b249bd3e2 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/view" "go.opentelemetry.io/otel/sdk/resource" ) @@ -205,16 +204,16 @@ func benchReaderCollectFunc(r Reader) func(*testing.B) { } func TestDefaultAggregationSelector(t *testing.T) { - var undefinedInstrument view.InstrumentKind + var undefinedInstrument InstrumentKind assert.Panics(t, func() { DefaultAggregationSelector(undefinedInstrument) }) - iKinds := []view.InstrumentKind{ - view.SyncCounter, - view.SyncUpDownCounter, - view.SyncHistogram, - view.AsyncCounter, - view.AsyncUpDownCounter, - view.AsyncGauge, + iKinds := []InstrumentKind{ + InstrumentKindSyncCounter, + InstrumentKindSyncUpDownCounter, + InstrumentKindSyncHistogram, + InstrumentKindAsyncCounter, + InstrumentKindAsyncUpDownCounter, + InstrumentKindAsyncGauge, } for _, ik := range iKinds { @@ -223,15 +222,15 @@ func TestDefaultAggregationSelector(t *testing.T) { } func TestDefaultTemporalitySelector(t *testing.T) { - var undefinedInstrument view.InstrumentKind - for _, ik := range []view.InstrumentKind{ + var undefinedInstrument InstrumentKind + for _, ik := range []InstrumentKind{ undefinedInstrument, - view.SyncCounter, - view.SyncUpDownCounter, - view.SyncHistogram, - view.AsyncCounter, - view.AsyncUpDownCounter, - view.AsyncGauge, + InstrumentKindSyncCounter, + InstrumentKindSyncUpDownCounter, + InstrumentKindSyncHistogram, + InstrumentKindAsyncCounter, + InstrumentKindAsyncUpDownCounter, + InstrumentKindAsyncGauge, } { assert.Equal(t, metricdata.CumulativeTemporality, DefaultTemporalitySelector(ik)) } From 0847081c479db3e2bd8a634a940754df3cf08a70 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Nov 2022 12:40:48 -0800 Subject: [PATCH 323/886] dependabot updates Sun Nov 20 16:06:32 UTC 2022 (#3484) Bump github.com/cenkalti/backoff/v4 from 4.1.3 to 4.2.0 in /exporters/otlp/internal/retry Bump google.golang.org/grpc from 1.50.1 to 1.51.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.50.1 to 1.51.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.50.1 to 1.51.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.50.1 to 1.51.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.50.1 to 1.51.0 in /example/otel-collector Bump lycheeverse/lychee-action from 1.5.2 to 1.5.4 Co-authored-by: MrAlias --- example/otel-collector/go.mod | 8 ++++---- example/otel-collector/go.sum | 14 ++++++++------ exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.sum | 14 ++++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 14 ++++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 14 ++++++++------ exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/go.sum | 14 ++++++++------ exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 16 +++++++++------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.sum | 14 ++++++++------ 16 files changed, 88 insertions(+), 74 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 83b769223b0..646f53e66ed 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,11 +12,11 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -24,9 +24,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 56919f794c1..95ced88c1aa 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -220,8 +220,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -272,8 +273,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -391,8 +393,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 8306361a9da..2cafe3f3532 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry go 1.18 require ( - github.com/cenkalti/backoff/v4 v4.1.3 + github.com/cenkalti/backoff/v4 v4.2.0 github.com/stretchr/testify v1.8.1 ) diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index 469153569c0..977bd849fa0 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -1,5 +1,5 @@ -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 8aeb85acdd0..934741eb86d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,12 +11,12 @@ require ( go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/sdk/metric v0.33.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index bc0259cb876..a389332abcd 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -228,8 +228,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -280,8 +281,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -399,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f9e6f24056c..a27db895774 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,12 +13,12 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.33.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -28,9 +28,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.1 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index bc0259cb876..a389332abcd 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -228,8 +228,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -280,8 +281,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -399,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 433ec6ffc28..b39cebc2d24 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -26,11 +26,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.1 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.50.1 // indirect + google.golang.org/grpc v1.51.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index bc0259cb876..a389332abcd 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -228,8 +228,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -280,8 +281,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -399,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 304068ea81e..57b753017df 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,21 +10,21 @@ require ( go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/trace v1.11.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index bc0259cb876..a389332abcd 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -228,8 +228,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -280,8 +281,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -399,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 1d2169ed2aa..5f61edd7ed6 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,12 +11,12 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.50.1 + google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index de17ea53294..ecc94e43098 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -230,8 +230,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,8 +283,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -327,7 +329,7 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -402,8 +404,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 1afa1d12faa..6e15a4122e9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -14,18 +14,18 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.1.3 // indirect + github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.4.0 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.50.1 // indirect + google.golang.org/grpc v1.51.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index af16c3f1b61..9061b36aafb 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= -github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= +github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -227,8 +227,9 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -279,8 +280,9 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -398,8 +400,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From dbf960c8e1e302e7e4dfe9c835638d46358bfaa8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 21 Nov 2022 07:45:47 -0800 Subject: [PATCH 324/886] Add view example tests (#3460) * Add the InstrumentKind type and vars to sdk/metric * Add the Instrument type to sdk/metric * Add the Stream type to sdk/metric * Add the View type to sdk/metric * Add NewView to create Views matching OTel spec * Add unit tests for NewView * Add changes to changelog * Apply suggestions from code review Co-authored-by: Anthony Mirabella * Update CHANGELOG.md * Update match and mask comments of Instrument * Explain wildcard logic in NewView with comment * Drop views that replace name for multi-inst match * Comment how users are expected to match zero-vals * Remove InstrumentKind and Scope from Stream * Fix redundant word in NewView comment * Add view example tests * Update comments to examples * Fix broken English Co-authored-by: Anthony Mirabella --- sdk/metric/view_test.go | 133 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 082b0106ebd..891de52dc6b 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -15,6 +15,8 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "fmt" + "regexp" "testing" "github.com/go-logr/logr" @@ -469,3 +471,134 @@ func TestNewViewAggregationErrorLogged(t *testing.T) { assert.Nil(t, got.Aggregation, "erroring aggregation used") assert.Equal(t, 1, l.ErrorN()) } + +func ExampleNewView() { + // Create a view that renames the "latency" instrument from the v0.34.0 + // version of the "http" instrumentation library as "request.latency". + view := NewView(Instrument{ + Name: "latency", + Scope: instrumentation.Scope{ + Name: "http", + Version: "v0.34.0", + }, + }, Stream{Name: "request.latency"}) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. Below is an example of how the view will + // function in the SDK for certain instruments. + + stream, _ := view(Instrument{ + Name: "latency", + Description: "request latency", + Unit: unit.Milliseconds, + Kind: InstrumentKindSyncCounter, + Scope: instrumentation.Scope{ + Name: "http", + Version: "v0.34.0", + SchemaURL: "https://opentelemetry.io/schemas/1.0.0", + }, + }) + fmt.Println("name:", stream.Name) + fmt.Println("description:", stream.Description) + fmt.Println("unit:", stream.Unit) + // Output: + // name: request.latency + // description: request latency + // unit: ms +} + +func ExampleNewView_drop() { + // Create a view that sets the drop aggregator for all instrumentation from + // the "db" library, effectively turning-off all instrumentation from that + // library. + view := NewView( + Instrument{Scope: instrumentation.Scope{Name: "db"}}, + Stream{Aggregation: aggregation.Drop{}}, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. Below is an example of how the view will + // function in the SDK for certain instruments. + + stream, _ := view(Instrument{ + Name: "queries", + Kind: InstrumentKindSyncCounter, + Scope: instrumentation.Scope{Name: "db", Version: "v0.4.0"}, + }) + fmt.Println("name:", stream.Name) + fmt.Printf("aggregation: %#v", stream.Aggregation) + // Output: + // name: queries + // aggregation: aggregation.Drop{} +} + +func ExampleNewView_wildcard() { + // Create a view that sets unit to milliseconds for any instrument with a + // name suffix of ".ms". + view := NewView( + Instrument{Name: "*.ms"}, + Stream{Unit: unit.Milliseconds}, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. Below is an example of how the view + // function in the SDK for certain instruments. + + stream, _ := view(Instrument{ + Name: "computation.time.ms", + Unit: unit.Dimensionless, + }) + fmt.Println("name:", stream.Name) + fmt.Println("unit:", stream.Unit) + // Output: + // name: computation.time.ms + // unit: ms +} + +func ExampleView() { + // The NewView function provides convenient creation of common Views + // construction. However, it is limited in what it can create. + // + // When NewView is not able to provide the functionally needed, a custom + // View can be constructed directly. Here a custom View is constructed that + // uses Go's regular expression matching to ensure all data stream names + // have a suffix of the units it uses. + + re := regexp.MustCompile(`[._](ms|byte)$`) + var view View = func(i Instrument) (Stream, bool) { + s := Stream{Name: i.Name, Description: i.Description, Unit: i.Unit} + // Any instrument that does not have a unit suffix defined, but has a + // dimensional unit defined, update the name with a unit suffix. + if re.MatchString(i.Name) { + return s, false + } + switch i.Unit { + case unit.Milliseconds: + s.Name += ".ms" + case unit.Bytes: + s.Name += ".byte" + default: + return s, false + } + return s, true + } + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. Below is an example of how the view will + // function in the SDK for certain instruments. + + stream, _ := view(Instrument{ + Name: "computation.time.ms", + Unit: unit.Milliseconds, + }) + fmt.Println("name:", stream.Name) + + stream, _ = view(Instrument{ + Name: "heap.size", + Unit: unit.Bytes, + }) + fmt.Println("name:", stream.Name) + // Output: + // name: computation.time.ms + // name: heap.size.byte +} From c4333a96875d520325fbcddc80c23be79674f297 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 21 Nov 2022 08:05:07 -0800 Subject: [PATCH 325/886] Deprecate the sdk/metric/view package (#3476) * Deprecate the sdk/metric/view package * Add deprecation to changelog --- CHANGELOG.md | 5 +++++ sdk/metric/view/doc.go | 3 +++ sdk/metric/view/instrument.go | 2 ++ sdk/metric/view/instrumentkind.go | 21 +++++++++++++++++++++ sdk/metric/view/view.go | 4 ++++ 5 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac0bdc06da8..fa6dfc551e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +### Deprecated + +- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. + Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476) + ## [1.11.1/0.33.0] 2022-10-19 ### Added diff --git a/sdk/metric/view/doc.go b/sdk/metric/view/doc.go index e92e57aed10..c757b75bd35 100644 --- a/sdk/metric/view/doc.go +++ b/sdk/metric/view/doc.go @@ -17,4 +17,7 @@ // registered with a MeterProvider in the go.opentelemetry.io/otel/sdk/metric // package. See the WithReader option in that package for more information on // how this registration takes place. +// +// Deprecated: Use Instrument, InstrumentKind, View, and NewView in +// go.opentelemetry.io/otel/sdk/metric instead. package view // import "go.opentelemetry.io/otel/sdk/metric/view" diff --git a/sdk/metric/view/instrument.go b/sdk/metric/view/instrument.go index b9f0b9de708..77536de2114 100644 --- a/sdk/metric/view/instrument.go +++ b/sdk/metric/view/instrument.go @@ -20,6 +20,8 @@ import ( ) // Instrument uniquely identifies an instrument within a meter. +// +// Deprecated: Use Instrument in go.opentelemetry.io/otel/sdk/metric instead. type Instrument struct { Scope instrumentation.Scope diff --git a/sdk/metric/view/instrumentkind.go b/sdk/metric/view/instrumentkind.go index 0ac2acd56bc..357117e334a 100644 --- a/sdk/metric/view/instrumentkind.go +++ b/sdk/metric/view/instrumentkind.go @@ -15,6 +15,9 @@ package view // import "go.opentelemetry.io/otel/sdk/metric/view" // InstrumentKind describes the kind of instrument a Meter can create. +// +// Deprecated: Use InstrumentKind in go.opentelemetry.io/otel/sdk/metric +// instead. type InstrumentKind uint8 // These are all the instrument kinds supported by the SDK. @@ -24,20 +27,38 @@ const ( undefinedInstrument InstrumentKind = iota // SyncCounter is an instrument kind that records increasing values // synchronously in application code. + // + // Deprecated: Use InstrumentKindSyncCounter in + // go.opentelemetry.io/otel/sdk/metric instead. SyncCounter // SyncUpDownCounter is an instrument kind that records increasing and // decreasing values synchronously in application code. + // + // Deprecated: Use InstrumentKindSyncUpDownCounter in + // go.opentelemetry.io/otel/sdk/metric instead. SyncUpDownCounter // SyncHistogram is an instrument kind that records a distribution of // values synchronously in application code. + // + // Deprecated: Use InstrumentKindSyncHistogram in + // go.opentelemetry.io/otel/sdk/metric instead. SyncHistogram // AsyncCounter is an instrument kind that records increasing values in an // asynchronous callback. + // + // Deprecated: Use InstrumentKindAsyncCounter in + // go.opentelemetry.io/otel/sdk/metric instead. AsyncCounter // AsyncUpDownCounter is an instrument kind that records increasing and // decreasing values in an asynchronous callback. + // + // Deprecated: Use InstrumentKindAsyncUpDownCounter in + // go.opentelemetry.io/otel/sdk/metric instead. AsyncUpDownCounter // AsyncGauge is an instrument kind that records current values in an // asynchronous callback. + // + // Deprecated: Use InstrumentKindAsyncGauge in + // go.opentelemetry.io/otel/sdk/metric instead. AsyncGauge ) diff --git a/sdk/metric/view/view.go b/sdk/metric/view/view.go index c6f2001870e..3e432afb3f8 100644 --- a/sdk/metric/view/view.go +++ b/sdk/metric/view/view.go @@ -31,6 +31,8 @@ import ( // reported by Instruments. // // An empty View will match all instruments, and do no transformations. +// +// Deprecated: Use View in go.opentelemetry.io/otel/sdk/metric instead. type View struct { instrumentName *regexp.Regexp hasWildcard bool @@ -48,6 +50,8 @@ type View struct { // Options are all applied to the View. An instrument needs to match all of // the match Options passed for the View to be applied to it. Similarly, all // transform operation Options are applied to matched Instruments. +// +// Deprecated: Use NewView in go.opentelemetry.io/otel/sdk/metric instead. func New(opts ...Option) (View, error) { v := View{} From e36a361b68f49b457e1f10e073f71c5ddd571ab9 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 22 Nov 2022 18:01:53 -0600 Subject: [PATCH 326/886] Move otlpmetrics `Client` to an internal package. (#3486) * Move otlp client to an internal package * update changelog * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update CHANGELOG.md Co-authored-by: Tyler Yahn --- CHANGELOG.md | 5 +++++ exporters/otlp/otlpmetric/{ => internal}/client.go | 2 +- exporters/otlp/otlpmetric/{ => internal}/exporter.go | 2 +- exporters/otlp/otlpmetric/{ => internal}/exporter_test.go | 2 +- exporters/otlp/otlpmetric/internal/otest/client.go | 6 +++--- exporters/otlp/otlpmetric/internal/otest/client_test.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/client.go | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go | 4 ++-- 10 files changed, 23 insertions(+), 18 deletions(-) rename exporters/otlp/otlpmetric/{ => internal}/client.go (96%) rename exporters/otlp/otlpmetric/{ => internal}/exporter.go (97%) rename exporters/otlp/otlpmetric/{ => internal}/exporter_test.go (96%) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6dfc551e2..a08cf2af749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +## Removed + +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) + ### Deprecated - The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated. diff --git a/exporters/otlp/otlpmetric/client.go b/exporters/otlp/otlpmetric/internal/client.go similarity index 96% rename from exporters/otlp/otlpmetric/client.go rename to exporters/otlp/otlpmetric/internal/client.go index 622b2bdd2a7..7950a4170cd 100644 --- a/exporters/otlp/otlpmetric/client.go +++ b/exporters/otlp/otlpmetric/internal/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" diff --git a/exporters/otlp/otlpmetric/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go similarity index 97% rename from exporters/otlp/otlpmetric/exporter.go rename to exporters/otlp/otlpmetric/internal/exporter.go index b7e06e51785..c8db05e114b 100644 --- a/exporters/otlp/otlpmetric/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" diff --git a/exporters/otlp/otlpmetric/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go similarity index 96% rename from exporters/otlp/otlpmetric/exporter_test.go rename to exporters/otlp/otlpmetric/internal/exporter_test.go index dc0ccb9903d..65c8e578c46 100644 --- a/exporters/otlp/otlpmetric/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( "context" diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 39002156a5c..cac7e98ce53 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -26,7 +26,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/metric/unit" semconv "go.opentelemetry.io/otel/semconv/v1.10.0" collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" @@ -168,13 +168,13 @@ var ( ) // ClientFactory is a function that when called returns a -// otlpmetric.Client implementation that is connected to also returned +// internal.Client implementation that is connected to also returned // Collector implementation. The Client is ready to upload metric data to the // Collector which is ready to store that data. // // If resultCh is not nil, the returned Collector needs to use the responses // from that channel to send back to the client for every export request. -type ClientFactory func(resultCh <-chan ExportResult) (otlpmetric.Client, Collector) +type ClientFactory func(resultCh <-chan ExportResult) (internal.Client, Collector) // RunClientTests runs a suite of Client integration tests. For example: // diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 1db3cc78ea6..ff33ea5b73f 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -20,7 +20,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -67,7 +67,7 @@ func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } func TestClientTests(t *testing.T) { - factory := func(rCh <-chan ExportResult) (otlpmetric.Client, Collector) { + factory := func(rCh <-chan ExportResult) (ominternal.Client, Collector) { c := &client{rCh: rCh, storage: NewStorage()} return c, c } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index d2f64432d72..3f41820be1f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -49,7 +49,7 @@ func New(ctx context.Context, options ...Option) (metric.Exporter, error) { if err != nil { return nil, err } - return otlpmetric.New(c), nil + return ominternal.New(c), nil } type client struct { @@ -70,7 +70,7 @@ type client struct { } // newClient creates a new gRPC metric client. -func newClient(ctx context.Context, options ...Option) (otlpmetric.Client, error) { +func newClient(ctx context.Context, options ...Option) (ominternal.Client, error) { cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...) c := &client{ diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index ec6c27dfc87..91637530ada 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -27,7 +27,7 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -130,7 +130,7 @@ func TestRetryable(t *testing.T) { } func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewGRPCCollector("", rCh) require.NoError(t, err) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index ecc170f198a..a362b45087e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -49,7 +49,7 @@ func New(_ context.Context, opts ...Option) (metric.Exporter, error) { if err != nil { return nil, err } - return otlpmetric.New(c), nil + return ominternal.New(c), nil } type client struct { @@ -81,7 +81,7 @@ var ourTransport = &http.Transport{ } // newClient creates a new HTTP metric client. -func newClient(opts ...Option) (otlpmetric.Client, error) { +func newClient(opts ...Option) (ominternal.Client, error) { cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) httpClient := &http.Client{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 82e5f8ed29f..e4c7dacc0f3 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -27,14 +27,14 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (otlpmetric.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewHTTPCollector("", rCh) require.NoError(t, err) From 14efbb3169d27116f1d919e352393cbd65af343d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Nov 2022 16:14:53 -0800 Subject: [PATCH 327/886] Bump lycheeverse/lychee-action from 1.5.2 to 1.5.4 (#3462) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.5.2 to 1.5.4. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.5.2...v1.5.4) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index fd500163440..1952ac6776b 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.5.2 + uses: lycheeverse/lychee-action@v1.5.4 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 24f1fa330e3..425a9837a52 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.5.2 + uses: lycheeverse/lychee-action@v1.5.4 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 1f5e6adbf2ca8fdb394ea07b3370506889a10bfa Mon Sep 17 00:00:00 2001 From: Vasi Vasireddy <41936996+vasireddy99@users.noreply.github.com> Date: Wed, 23 Nov 2022 07:53:48 -0800 Subject: [PATCH 328/886] Update the usage of set-output command in GH actions (#3485) --- .github/workflows/markdown-fail-fast.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/markdown-fail-fast.yml b/.github/workflows/markdown-fail-fast.yml index bcfb0dedaca..1e4a5cd5342 100644 --- a/.github/workflows/markdown-fail-fast.yml +++ b/.github/workflows/markdown-fail-fast.yml @@ -18,7 +18,7 @@ jobs: - name: Get changed files id: changes run: | - echo "::set-output name=md::$(git diff --name-only --diff-filter=ACMRTUXB origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" + echo "md=$(git diff --name-only --diff-filter=ACMRTUXB origin/${{ github.event.pull_request.base.ref }} ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)" >> $GITHUB_OUTPUT lint: name: lint markdown files From d7b31155b5cc03cdadb39e894f11f9b4f2616fed Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 25 Nov 2022 17:27:47 -0600 Subject: [PATCH 329/886] Make the AsType functions not panic (#3489) * Make the AsType functions not panic * Adds changelog Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + attribute/kv_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++ attribute/value.go | 44 ++++++++++++++++++++++++++++++++-------- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a08cf2af749..c2703e18bc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) ## Removed diff --git a/attribute/kv_test.go b/attribute/kv_test.go index e819d404a2f..17815224ad1 100644 --- a/attribute/kv_test.go +++ b/attribute/kv_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" ) @@ -132,3 +133,50 @@ func TestKeyValueValid(t *testing.T) { } } } + +func TestIncorrectCast(t *testing.T) { + testCases := []struct { + name string + val attribute.Value + }{ + { + name: "Float64", + val: attribute.Float64Value(1.0), + }, + { + name: "Int64", + val: attribute.Int64Value(2), + }, + { + name: "String", + val: attribute.BoolValue(true), + }, + { + name: "Float64Slice", + val: attribute.Float64SliceValue([]float64{1.0}), + }, + { + name: "Int64Slice", + val: attribute.Int64SliceValue([]int64{2}), + }, + { + name: "StringSlice", + val: attribute.BoolSliceValue([]bool{true}), + }, + } + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + assert.NotPanics(t, func() { + tt.val.AsBool() + tt.val.AsBoolSlice() + tt.val.AsFloat64() + tt.val.AsFloat64Slice() + tt.val.AsInt64() + tt.val.AsInt64Slice() + tt.val.AsInterface() + tt.val.AsString() + tt.val.AsStringSlice() + }) + }) + } +} diff --git a/attribute/value.go b/attribute/value.go index 80a37bd6ff3..34a4e548dd1 100644 --- a/attribute/value.go +++ b/attribute/value.go @@ -142,6 +142,13 @@ func (v Value) AsBool() bool { // AsBoolSlice returns the []bool value. Make sure that the Value's type is // BOOLSLICE. func (v Value) AsBoolSlice() []bool { + if v.vtype != BOOLSLICE { + return nil + } + return v.asBoolSlice() +} + +func (v Value) asBoolSlice() []bool { return attribute.AsSlice[bool](v.slice) } @@ -154,6 +161,13 @@ func (v Value) AsInt64() int64 { // AsInt64Slice returns the []int64 value. Make sure that the Value's type is // INT64SLICE. func (v Value) AsInt64Slice() []int64 { + if v.vtype != INT64SLICE { + return nil + } + return v.asInt64Slice() +} + +func (v Value) asInt64Slice() []int64 { return attribute.AsSlice[int64](v.slice) } @@ -166,6 +180,13 @@ func (v Value) AsFloat64() float64 { // AsFloat64Slice returns the []float64 value. Make sure that the Value's type is // FLOAT64SLICE. func (v Value) AsFloat64Slice() []float64 { + if v.vtype != FLOAT64SLICE { + return nil + } + return v.asFloat64Slice() +} + +func (v Value) asFloat64Slice() []float64 { return attribute.AsSlice[float64](v.slice) } @@ -178,6 +199,13 @@ func (v Value) AsString() string { // AsStringSlice returns the []string value. Make sure that the Value's type is // STRINGSLICE. func (v Value) AsStringSlice() []string { + if v.vtype != STRINGSLICE { + return nil + } + return v.asStringSlice() +} + +func (v Value) asStringSlice() []string { return attribute.AsSlice[string](v.slice) } @@ -189,19 +217,19 @@ func (v Value) AsInterface() interface{} { case BOOL: return v.AsBool() case BOOLSLICE: - return v.AsBoolSlice() + return v.asBoolSlice() case INT64: return v.AsInt64() case INT64SLICE: - return v.AsInt64Slice() + return v.asInt64Slice() case FLOAT64: return v.AsFloat64() case FLOAT64SLICE: - return v.AsFloat64Slice() + return v.asFloat64Slice() case STRING: return v.stringly case STRINGSLICE: - return v.AsStringSlice() + return v.asStringSlice() } return unknownValueType{} } @@ -210,19 +238,19 @@ func (v Value) AsInterface() interface{} { func (v Value) Emit() string { switch v.Type() { case BOOLSLICE: - return fmt.Sprint(v.AsBoolSlice()) + return fmt.Sprint(v.asBoolSlice()) case BOOL: return strconv.FormatBool(v.AsBool()) case INT64SLICE: - return fmt.Sprint(v.AsInt64Slice()) + return fmt.Sprint(v.asInt64Slice()) case INT64: return strconv.FormatInt(v.AsInt64(), 10) case FLOAT64SLICE: - return fmt.Sprint(v.AsFloat64Slice()) + return fmt.Sprint(v.asFloat64Slice()) case FLOAT64: return fmt.Sprint(v.AsFloat64()) case STRINGSLICE: - return fmt.Sprint(v.AsStringSlice()) + return fmt.Sprint(v.asStringSlice()) case STRING: return v.stringly default: From aa868d506b7e4de2f534f47b168b27b7f8824351 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Mon, 28 Nov 2022 10:22:59 -0500 Subject: [PATCH 330/886] Clarify HTTP/gRPC exporter examples (#3492) Signed-off-by: Yuri Shkuro --- example/otel-collector/main.go | 8 ++++++-- exporters/otlp/otlptrace/README.md | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 507260c8bd5..7f426e6bf3e 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -57,10 +57,14 @@ func initProvider() (func(context.Context) error, error) { // microk8s), it should be accessible through the NodePort service at the // `localhost:30080` endpoint. Otherwise, replace `localhost` with the // endpoint of your cluster. If you run the app inside k8s, then you can - // probably connect directly to the service through dns + // probably connect directly to the service through dns. ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - conn, err := grpc.DialContext(ctx, "localhost:30080", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.DialContext(ctx, "localhost:30080", + // Note the use of insecure transport here. TLS is recommended in production. + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithBlock(), + ) if err != nil { return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err) } diff --git a/exporters/otlp/otlptrace/README.md b/exporters/otlp/otlptrace/README.md index ca91fd4f489..6e9cc0366ba 100644 --- a/exporters/otlp/otlptrace/README.md +++ b/exporters/otlp/otlptrace/README.md @@ -12,8 +12,8 @@ go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace ## Examples -- [Exporter setup and examples](./otlptracehttp/example_test.go) -- [Full example sending telemetry to a local collector](../../../example/otel-collector) +- [HTTP Exporter setup and examples](./otlptracehttp/example_test.go) +- [Full example of gRPC Exporter sending telemetry to a local collector](../../../example/otel-collector) ## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) From 289a612e6a40a7575cd13dbc02ae07f6269e5491 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 29 Nov 2022 14:32:15 -0600 Subject: [PATCH 331/886] Adds an Attribute assertion to metric data test (#3487) * Adds an Attribute assertion to metric data test Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + .../metricdata/metricdatatest/assertion.go | 44 +++++++ .../metricdatatest/assertion_fail_test.go | 19 +++ .../metricdatatest/assertion_test.go | 75 ++++++++++++ .../metricdata/metricdatatest/comparisons.go | 113 ++++++++++++++++++ 5 files changed, 252 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2703e18bc5..daa5584bed7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`. These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) - The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) +- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) ### Changed diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index 1e52cfea107..193be1ff708 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -20,6 +20,7 @@ import ( "fmt" "testing" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -129,3 +130,46 @@ func AssertAggregationsEqual(t *testing.T, expected, actual metricdata.Aggregati } return true } + +// AssertHasAttributes asserts that all Datapoints or HistogramDataPoints have all passed attrs. +func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute.KeyValue) bool { + t.Helper() + + var reasons []string + + switch e := interface{}(actual).(type) { + case metricdata.DataPoint[int64]: + reasons = hasAttributesDataPoints(e, attrs...) + case metricdata.DataPoint[float64]: + reasons = hasAttributesDataPoints(e, attrs...) + case metricdata.Gauge[int64]: + reasons = hasAttributesGauge(e, attrs...) + case metricdata.Gauge[float64]: + reasons = hasAttributesGauge(e, attrs...) + case metricdata.Sum[int64]: + reasons = hasAttributesSum(e, attrs...) + case metricdata.Sum[float64]: + reasons = hasAttributesSum(e, attrs...) + case metricdata.HistogramDataPoint: + reasons = hasAttributesHistogramDataPoints(e, attrs...) + case metricdata.Histogram: + reasons = hasAttributesHistogram(e, attrs...) + case metricdata.Metrics: + reasons = hasAttributesMetrics(e, attrs...) + case metricdata.ScopeMetrics: + reasons = hasAttributesScopeMetrics(e, attrs...) + case metricdata.ResourceMetrics: + reasons = hasAttributesResourceMetrics(e, attrs...) + default: + // We control all types passed to this, panic to signal developers + // early they changed things in an incompatible way. + panic(fmt.Sprintf("unknown types: %T", actual)) + } + + if len(reasons) > 0 { + t.Error(reasons) + return false + } + + return true +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go index 4c608e4a2c9..8d0ce4f3d48 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go @@ -19,6 +19,8 @@ package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata import ( "testing" + + "go.opentelemetry.io/otel/attribute" ) // These tests are used to develop the failure messages of this package's @@ -57,3 +59,20 @@ func TestFailAssertAggregationsEqual(t *testing.T) { AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64B) AssertAggregationsEqual(t, histogramA, histogramB) } + +func TestFailAssertAttribute(t *testing.T) { + AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("B", true)) + AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("B", true)) + AssertHasAttributes(t, sumInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, sumFloat64A, attribute.Bool("B", true)) + AssertHasAttributes(t, histogramDataPointA, attribute.Bool("A", false)) + AssertHasAttributes(t, histogramDataPointA, attribute.Bool("B", true)) + AssertHasAttributes(t, histogramA, attribute.Bool("A", false)) + AssertHasAttributes(t, histogramA, attribute.Bool("B", true)) + AssertHasAttributes(t, metricsA, attribute.Bool("A", false)) + AssertHasAttributes(t, metricsA, attribute.Bool("B", true)) + AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", false)) + AssertHasAttributes(t, resourceMetricsA, attribute.Bool("B", true)) +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 3935ed15091..b7da4344353 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -314,3 +314,78 @@ func TestAssertAggregationsEqual(t *testing.T) { r = equalAggregations(histogramA, histogramC, config{ignoreTimestamp: true}) assert.Equalf(t, len(r), 0, "%v == %v", histogramA, histogramC) } + +func TestAssertAttributes(t *testing.T) { + AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, sumInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, sumFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramDataPointA, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramA, attribute.Bool("A", true)) + AssertHasAttributes(t, metricsA, attribute.Bool("A", true)) + AssertHasAttributes(t, scopeMetricsA, attribute.Bool("A", true)) + AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", true)) + + r := hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "gaugeInt64A has A=True") + r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "gaugeFloat64A has A=True") + r = hasAttributesAggregation(sumInt64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "sumInt64A has A=True") + r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "sumFloat64A has A=True") + r = hasAttributesAggregation(histogramA, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "histogramA has A=True") + + r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "gaugeInt64A does not have A=False") + r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "gaugeFloat64A does not have A=False") + r = hasAttributesAggregation(sumInt64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "sumInt64A does not have A=False") + r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "sumFloat64A does not have A=False") + r = hasAttributesAggregation(histogramA, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "histogramA does not have A=False") + + r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "gaugeInt64A does not have Attribute B") + r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "gaugeFloat64A does not have Attribute B") + r = hasAttributesAggregation(sumInt64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "sumInt64A does not have Attribute B") + r = hasAttributesAggregation(sumFloat64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "sumFloat64A does not have Attribute B") + r = hasAttributesAggregation(histogramA, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "histogramA does not have Attribute B") +} + +func TestAssertAttributesFail(t *testing.T) { + fakeT := &testing.T{} + assert.False(t, AssertHasAttributes(fakeT, dataPointInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, dataPointFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, gaugeInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, gaugeFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, sumInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, sumFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, histogramDataPointA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, histogramDataPointA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, histogramA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, histogramA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("B", true))) + + sum := metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + dataPointInt64A, + dataPointInt64B, + }, + } + assert.False(t, AssertHasAttributes(fakeT, sum, attribute.Bool("A", true))) +} diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 841c03b12e0..9879c96f109 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -358,3 +358,116 @@ func compareDiff[T any](extraExpected, extraActual []T) string { return msg.String() } + +func missingAttrStr(name string) string { + return fmt.Sprintf("missing attribute %s", name) +} + +func hasAttributesDataPoints[T int64 | float64](dp metricdata.DataPoint[T], attrs ...attribute.KeyValue) (reasons []string) { + for _, attr := range attrs { + val, ok := dp.Attributes.Value(attr.Key) + if !ok { + reasons = append(reasons, missingAttrStr(string(attr.Key))) + continue + } + if val != attr.Value { + reasons = append(reasons, notEqualStr(string(attr.Key), attr.Value.Emit(), val.Emit())) + } + } + return reasons +} + +func hasAttributesGauge[T int64 | float64](gauge metricdata.Gauge[T], attrs ...attribute.KeyValue) (reasons []string) { + for n, dp := range gauge.DataPoints { + reas := hasAttributesDataPoints(dp, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("gauge datapoint %d attributes:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} + +func hasAttributesSum[T int64 | float64](sum metricdata.Sum[T], attrs ...attribute.KeyValue) (reasons []string) { + for n, dp := range sum.DataPoints { + reas := hasAttributesDataPoints(dp, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("sum datapoint %d attributes:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} + +func hasAttributesHistogramDataPoints(dp metricdata.HistogramDataPoint, attrs ...attribute.KeyValue) (reasons []string) { + for _, attr := range attrs { + val, ok := dp.Attributes.Value(attr.Key) + if !ok { + reasons = append(reasons, missingAttrStr(string(attr.Key))) + continue + } + if val != attr.Value { + reasons = append(reasons, notEqualStr(string(attr.Key), attr.Value.Emit(), val.Emit())) + } + } + return reasons +} + +func hasAttributesHistogram(histogram metricdata.Histogram, attrs ...attribute.KeyValue) (reasons []string) { + for n, dp := range histogram.DataPoints { + reas := hasAttributesHistogramDataPoints(dp, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("histogram datapoint %d attributes:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} + +func hasAttributesAggregation(agg metricdata.Aggregation, attrs ...attribute.KeyValue) (reasons []string) { + switch agg := agg.(type) { + case metricdata.Gauge[int64]: + reasons = hasAttributesGauge(agg, attrs...) + case metricdata.Gauge[float64]: + reasons = hasAttributesGauge(agg, attrs...) + case metricdata.Sum[int64]: + reasons = hasAttributesSum(agg, attrs...) + case metricdata.Sum[float64]: + reasons = hasAttributesSum(agg, attrs...) + case metricdata.Histogram: + reasons = hasAttributesHistogram(agg, attrs...) + default: + reasons = []string{fmt.Sprintf("unknown aggregation %T", agg)} + } + return reasons +} + +func hasAttributesMetrics(metrics metricdata.Metrics, attrs ...attribute.KeyValue) (reasons []string) { + reas := hasAttributesAggregation(metrics.Data, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("Metric %s:\n", metrics.Name)) + reasons = append(reasons, reas...) + } + return reasons +} + +func hasAttributesScopeMetrics(sm metricdata.ScopeMetrics, attrs ...attribute.KeyValue) (reasons []string) { + for n, metrics := range sm.Metrics { + reas := hasAttributesMetrics(metrics, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("ScopeMetrics %s Metrics %d:\n", sm.Scope.Name, n)) + reasons = append(reasons, reas...) + } + } + return reasons +} +func hasAttributesResourceMetrics(rm metricdata.ResourceMetrics, attrs ...attribute.KeyValue) (reasons []string) { + for n, sm := range rm.ScopeMetrics { + reas := hasAttributesScopeMetrics(sm, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("ResourceMetrics ScopeMetrics %d:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} From 291aaa022158abff8f6381d4a148190f3547c9b2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 30 Nov 2022 12:00:57 -0800 Subject: [PATCH 332/886] Redefine gauge in Prometheus example to be a Gauge (#3498) * Rename gauge var name in Prometheus example Fix #3493 * Switch to actual gauge --- example/prometheus/main.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/example/prometheus/main.go b/example/prometheus/main.go index e1d87693c22..bc15f041486 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -18,9 +18,11 @@ import ( "context" "fmt" "log" + "math/rand" "net/http" "os" "os/signal" + "time" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -30,6 +32,10 @@ import ( "go.opentelemetry.io/otel/sdk/metric" ) +func init() { + rand.Seed(time.Now().UnixNano()) +} + func main() { ctx := context.Background() @@ -58,12 +64,17 @@ func main() { } counter.Add(ctx, 5, attrs...) - gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.AsyncFloat64().Gauge("bar", instrument.WithDescription("a fun little gauge")) + if err != nil { + log.Fatal(err) + } + err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + n := -10. + rand.Float64()*(90.) // [-10, 100) + gauge.Observe(ctx, n, attrs...) + }) if err != nil { log.Fatal(err) } - gauge.Add(ctx, 100, attrs...) - gauge.Add(ctx, -25, attrs...) // This is the equivalent of prometheus.NewHistogramVec histogram, err := meter.SyncFloat64().Histogram("baz", instrument.WithDescription("a very nice histogram")) From 69ad652afb0f9ec181338258123925b17a15ac17 Mon Sep 17 00:00:00 2001 From: Raymond <49190927+onepiece010938@users.noreply.github.com> Date: Fri, 2 Dec 2022 05:53:52 +0800 Subject: [PATCH 333/886] change jaeger tag version in otel-collector (#3495) Co-authored-by: Chester Cheung --- example/otel-collector/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/example/otel-collector/Makefile b/example/otel-collector/Makefile index 47c560b34c8..a5707834b39 100644 --- a/example/otel-collector/Makefile +++ b/example/otel-collector/Makefile @@ -1,9 +1,11 @@ +JAEGER_OPERATOR_VERSION = v1.36.0 + namespace-k8s: kubectl apply -f k8s/namespace.yaml jaeger-operator-k8s: # Create the jaeger operator and necessary artifacts in ns observability - kubectl create -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.31.0/jaeger-operator.yaml + kubectl create -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/$(JAEGER_OPERATOR_VERSION)/jaeger-operator.yaml jaeger-k8s: kubectl apply -f k8s/jaeger.yaml @@ -23,4 +25,4 @@ clean-k8s: - kubectl delete -f k8s/jaeger.yaml - - kubectl delete -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.31.0/jaeger-operator.yaml + - kubectl delete -n observability -f https://github.com/jaegertracing/jaeger-operator/releases/download/$(JAEGER_OPERATOR_VERSION)/jaeger-operator.yaml From a436ae76f70af9a79884a8f95779517af8f0b89b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Dec 2022 09:41:44 -0800 Subject: [PATCH 334/886] Bump github.com/Masterminds/semver/v3 from 3.1.1 to 3.2.0 in /schema (#3511) Bumps [github.com/Masterminds/semver/v3](https://github.com/Masterminds/semver) from 3.1.1 to 3.2.0. - [Release notes](https://github.com/Masterminds/semver/releases) - [Changelog](https://github.com/Masterminds/semver/blob/master/CHANGELOG.md) - [Commits](https://github.com/Masterminds/semver/compare/v3.1.1...v3.2.0) --- updated-dependencies: - dependency-name: github.com/Masterminds/semver/v3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- schema/go.mod | 2 +- schema/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/go.mod b/schema/go.mod index b57de2292c5..fac2c98594d 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/schema go 1.18 require ( - github.com/Masterminds/semver/v3 v3.1.1 + github.com/Masterminds/semver/v3 v3.2.0 github.com/stretchr/testify v1.8.1 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index 1db3ecb277d..c5dd6347af8 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -1,5 +1,5 @@ -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From e97704c1ec872144da633a29b27feaef06fb2867 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 5 Dec 2022 09:56:48 -0600 Subject: [PATCH 335/886] Fix a typo in the manual reader (#3509) Co-authored-by: Tyler Yahn --- sdk/metric/manual_reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 7860a3be2b9..0ebfadf33a3 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -// manualReader is a a simple Reader that allows an application to +// manualReader is a simple Reader that allows an application to // read metrics on demand. type manualReader struct { producer atomic.Value From 22434311ae4783010a04081634ec503d9cbb5e33 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Tue, 6 Dec 2022 00:17:38 +0800 Subject: [PATCH 336/886] Signed-off-by: Ziqi Zhao (#3469) prevent conflict metric info --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 82 +++++- exporters/prometheus/exporter_test.go | 262 ++++++++++++++++++ exporters/prometheus/go.mod | 4 +- .../testdata/conflict_help_two_counters_1.txt | 11 + .../testdata/conflict_help_two_counters_2.txt | 11 + .../conflict_help_two_histograms_1.txt | 45 +++ .../conflict_help_two_histograms_2.txt | 45 +++ .../conflict_help_two_updowncounters_1.txt | 11 + .../conflict_help_two_updowncounters_2.txt | 11 + ...flict_type_counter_and_updowncounter_1.txt | 9 + ...flict_type_counter_and_updowncounter_2.txt | 9 + ...ict_type_histogram_and_updowncounter_1.txt | 9 + ...ict_type_histogram_and_updowncounter_2.txt | 26 ++ .../testdata/conflict_unit_two_counters.txt | 11 + .../testdata/conflict_unit_two_histograms.txt | 45 +++ .../conflict_unit_two_updowncounters.txt | 11 + .../testdata/no_conflict_two_counters.txt | 11 + .../testdata/no_conflict_two_histograms.txt | 45 +++ .../no_conflict_two_updowncounters.txt | 11 + 20 files changed, 660 insertions(+), 10 deletions(-) create mode 100644 exporters/prometheus/testdata/conflict_help_two_counters_1.txt create mode 100644 exporters/prometheus/testdata/conflict_help_two_counters_2.txt create mode 100644 exporters/prometheus/testdata/conflict_help_two_histograms_1.txt create mode 100644 exporters/prometheus/testdata/conflict_help_two_histograms_2.txt create mode 100644 exporters/prometheus/testdata/conflict_help_two_updowncounters_1.txt create mode 100644 exporters/prometheus/testdata/conflict_help_two_updowncounters_2.txt create mode 100644 exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_1.txt create mode 100644 exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_2.txt create mode 100644 exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_1.txt create mode 100644 exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_2.txt create mode 100644 exporters/prometheus/testdata/conflict_unit_two_counters.txt create mode 100644 exporters/prometheus/testdata/conflict_unit_two_histograms.txt create mode 100644 exporters/prometheus/testdata/conflict_unit_two_updowncounters.txt create mode 100644 exporters/prometheus/testdata/no_conflict_two_counters.txt create mode 100644 exporters/prometheus/testdata/no_conflict_two_histograms.txt create mode 100644 exporters/prometheus/testdata/no_conflict_two_updowncounters.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index daa5584bed7..949ea926d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) +- Prevent duplicate Prometheus description, unit, and type. (#3469) - Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) ## Removed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 2cb23cc19fb..734d6315b4c 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -16,6 +16,7 @@ package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( "context" + "errors" "fmt" "sort" "strings" @@ -24,9 +25,12 @@ import ( "unicode/utf8" "github.com/prometheus/client_golang/prometheus" + dto "github.com/prometheus/client_model/go" + "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" @@ -62,6 +66,7 @@ type collector struct { disableScopeInfo bool createTargetInfoOnce sync.Once scopeInfos map[instrumentation.Scope]prometheus.Metric + metricFamilies map[string]*dto.MetricFamily } // prometheus counters MUST have a _total suffix: @@ -83,6 +88,7 @@ func New(opts ...Option) (*Exporter, error) { withoutUnits: cfg.withoutUnits, disableScopeInfo: cfg.disableScopeInfo, scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + metricFamilies: make(map[string]*dto.MetricFamily), } if err := cfg.registerer.Register(collector); err != nil { @@ -149,22 +155,30 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { case metricdata.Histogram: - addHistogramMetric(ch, v, m, keys, values, c.getName(m)) + addHistogramMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) case metricdata.Sum[int64]: - addSumMetric(ch, v, m, keys, values, c.getName(m)) + addSumMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) case metricdata.Sum[float64]: - addSumMetric(ch, v, m, keys, values, c.getName(m)) + addSumMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) case metricdata.Gauge[int64]: - addGaugeMetric(ch, v, m, keys, values, c.getName(m)) + addGaugeMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) case metricdata.Gauge[float64]: - addGaugeMetric(ch, v, m, keys, values, c.getName(m)) + addGaugeMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) } } } } -func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, ks, vs [2]string, name string) { +func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars + drop, help := validateMetrics(name, m.Description, dto.MetricType_HISTOGRAM.Enum(), mfs) + if drop { + return + } + if help != "" { + m.Description = help + } + for _, dp := range histogram.DataPoints { keys, values := getAttrs(dp.Attributes, ks, vs) @@ -185,15 +199,26 @@ func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histog } } -func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string) { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { valueType := prometheus.CounterValue + metricType := dto.MetricType_COUNTER if !sum.IsMonotonic { valueType = prometheus.GaugeValue + metricType = dto.MetricType_GAUGE } if sum.IsMonotonic { // Add _total suffix for counters name += counterSuffix } + + drop, help := validateMetrics(name, m.Description, metricType.Enum(), mfs) + if drop { + return + } + if help != "" { + m.Description = help + } + for _, dp := range sum.DataPoints { keys, values := getAttrs(dp.Attributes, ks, vs) @@ -207,7 +232,15 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata } } -func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string) { +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { + drop, help := validateMetrics(name, m.Description, dto.MetricType_GAUGE.Enum(), mfs) + if drop { + return + } + if help != "" { + m.Description = help + } + for _, dp := range gauge.DataPoints { keys, values := getAttrs(dp.Attributes, ks, vs) @@ -344,3 +377,36 @@ func sanitizeName(n string) string { return b.String() } + +func validateMetrics(name, description string, metricType *dto.MetricType, mfs map[string]*dto.MetricFamily) (drop bool, help string) { + emf, exist := mfs[name] + if !exist { + mfs[name] = &dto.MetricFamily{ + Name: proto.String(name), + Help: proto.String(description), + Type: metricType, + } + return false, "" + } + if emf.GetType() != *metricType { + global.Error( + errors.New("instrument type conflict"), + "Using existing type definition.", + "instrument", name, + "existing", emf.GetType(), + "dropped", *metricType, + ) + return true, "" + } + if emf.GetHelp() != description { + global.Info( + "Instrument description conflict, using existing", + "instrument", name, + "existing", emf.GetHelp(), + "dropped", description, + ) + return false, emf.GetHelp() + } + + return false, "" +} diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 4edf11ba48a..88027fe7fc4 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -386,3 +386,265 @@ func TestMultiScopes(t *testing.T) { err = testutil.GatherAndCompare(registry, file) require.NoError(t, err) } + +func TestDuplicateMetrics(t *testing.T) { + testCases := []struct { + name string + customResouceAttrs []attribute.KeyValue + recordMetrics func(ctx context.Context, meterA, meterB otelmetric.Meter) + options []Option + possibleExpectedFiles []string + }{ + { + name: "no_conflict_two_counters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + fooA, err := meterA.SyncInt64().Counter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter counter foo")) + assert.NoError(t, err) + fooA.Add(ctx, 100, attribute.String("A", "B")) + + fooB, err := meterB.SyncInt64().Counter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter counter foo")) + assert.NoError(t, err) + fooB.Add(ctx, 100, attribute.String("A", "B")) + }, + possibleExpectedFiles: []string{"testdata/no_conflict_two_counters.txt"}, + }, + { + name: "no_conflict_two_updowncounters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + fooA, err := meterA.SyncInt64().UpDownCounter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter gauge foo")) + assert.NoError(t, err) + fooA.Add(ctx, 100, attribute.String("A", "B")) + + fooB, err := meterB.SyncInt64().UpDownCounter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter gauge foo")) + assert.NoError(t, err) + fooB.Add(ctx, 100, attribute.String("A", "B")) + }, + possibleExpectedFiles: []string{"testdata/no_conflict_two_updowncounters.txt"}, + }, + { + name: "no_conflict_two_histograms", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + fooA, err := meterA.SyncInt64().Histogram("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter histogram foo")) + assert.NoError(t, err) + fooA.Record(ctx, 100, attribute.String("A", "B")) + + fooB, err := meterB.SyncInt64().Histogram("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter histogram foo")) + assert.NoError(t, err) + fooB.Record(ctx, 100, attribute.String("A", "B")) + }, + possibleExpectedFiles: []string{"testdata/no_conflict_two_histograms.txt"}, + }, + { + name: "conflict_help_two_counters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + barA, err := meterA.SyncInt64().Counter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter a bar")) + assert.NoError(t, err) + barA.Add(ctx, 100, attribute.String("type", "bar")) + + barB, err := meterB.SyncInt64().Counter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter b bar")) + assert.NoError(t, err) + barB.Add(ctx, 100, attribute.String("type", "bar")) + }, + possibleExpectedFiles: []string{ + "testdata/conflict_help_two_counters_1.txt", + "testdata/conflict_help_two_counters_2.txt", + }, + }, + { + name: "conflict_help_two_updowncounters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + barA, err := meterA.SyncInt64().UpDownCounter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter a bar")) + assert.NoError(t, err) + barA.Add(ctx, 100, attribute.String("type", "bar")) + + barB, err := meterB.SyncInt64().UpDownCounter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter b bar")) + assert.NoError(t, err) + barB.Add(ctx, 100, attribute.String("type", "bar")) + }, + possibleExpectedFiles: []string{ + "testdata/conflict_help_two_updowncounters_1.txt", + "testdata/conflict_help_two_updowncounters_2.txt", + }, + }, + { + name: "conflict_help_two_histograms", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + barA, err := meterA.SyncInt64().Histogram("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter a bar")) + assert.NoError(t, err) + barA.Record(ctx, 100, attribute.String("A", "B")) + + barB, err := meterB.SyncInt64().Histogram("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter b bar")) + assert.NoError(t, err) + barB.Record(ctx, 100, attribute.String("A", "B")) + }, + possibleExpectedFiles: []string{ + "testdata/conflict_help_two_histograms_1.txt", + "testdata/conflict_help_two_histograms_2.txt", + }, + }, + { + name: "conflict_unit_two_counters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + bazA, err := meterA.SyncInt64().Counter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter bar")) + assert.NoError(t, err) + bazA.Add(ctx, 100, attribute.String("type", "bar")) + + bazB, err := meterB.SyncInt64().Counter("bar", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter bar")) + assert.NoError(t, err) + bazB.Add(ctx, 100, attribute.String("type", "bar")) + }, + options: []Option{WithoutUnits()}, + possibleExpectedFiles: []string{"testdata/conflict_unit_two_counters.txt"}, + }, + { + name: "conflict_unit_two_updowncounters", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + barA, err := meterA.SyncInt64().UpDownCounter("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter gauge bar")) + assert.NoError(t, err) + barA.Add(ctx, 100, attribute.String("type", "bar")) + + barB, err := meterB.SyncInt64().UpDownCounter("bar", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter gauge bar")) + assert.NoError(t, err) + barB.Add(ctx, 100, attribute.String("type", "bar")) + }, + options: []Option{WithoutUnits()}, + possibleExpectedFiles: []string{"testdata/conflict_unit_two_updowncounters.txt"}, + }, + { + name: "conflict_unit_two_histograms", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + barA, err := meterA.SyncInt64().Histogram("bar", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter histogram bar")) + assert.NoError(t, err) + barA.Record(ctx, 100, attribute.String("A", "B")) + + barB, err := meterB.SyncInt64().Histogram("bar", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter histogram bar")) + assert.NoError(t, err) + barB.Record(ctx, 100, attribute.String("A", "B")) + }, + options: []Option{WithoutUnits()}, + possibleExpectedFiles: []string{"testdata/conflict_unit_two_histograms.txt"}, + }, + { + name: "conflict_type_counter_and_updowncounter", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + counter, err := meterA.SyncInt64().Counter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter foo")) + assert.NoError(t, err) + counter.Add(ctx, 100, attribute.String("type", "foo")) + + gauge, err := meterA.SyncInt64().UpDownCounter("foo_total", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter foo")) + assert.NoError(t, err) + gauge.Add(ctx, 200, attribute.String("type", "foo")) + }, + options: []Option{WithoutUnits()}, + possibleExpectedFiles: []string{ + "testdata/conflict_type_counter_and_updowncounter_1.txt", + "testdata/conflict_type_counter_and_updowncounter_2.txt", + }, + }, + { + name: "conflict_type_histogram_and_updowncounter", + recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { + fooA, err := meterA.SyncInt64().UpDownCounter("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter gauge foo")) + assert.NoError(t, err) + fooA.Add(ctx, 100, attribute.String("A", "B")) + + fooHistogramA, err := meterA.SyncInt64().Histogram("foo", + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("meter histogram foo")) + assert.NoError(t, err) + fooHistogramA.Record(ctx, 100, attribute.String("A", "B")) + }, + possibleExpectedFiles: []string{ + "testdata/conflict_type_histogram_and_updowncounter_1.txt", + "testdata/conflict_type_histogram_and_updowncounter_2.txt", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + // initialize registry exporter + ctx := context.Background() + registry := prometheus.NewRegistry() + exporter, err := New(append(tc.options, WithRegisterer(registry))...) + require.NoError(t, err) + + // initialize resource + res, err := resource.New(ctx, + resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), + resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + ) + require.NoError(t, err) + res, err = resource.Merge(resource.Default(), res) + require.NoError(t, err) + + // initialize provider + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + metric.WithResource(res), + ) + + // initialize two meter a, b + meterA := provider.Meter("ma", otelmetric.WithInstrumentationVersion("v0.1.0")) + meterB := provider.Meter("mb", otelmetric.WithInstrumentationVersion("v0.1.0")) + + tc.recordMetrics(ctx, meterA, meterB) + + var match = false + for _, filename := range tc.possibleExpectedFiles { + file, ferr := os.Open(filename) + require.NoError(t, ferr) + t.Cleanup(func() { require.NoError(t, file.Close()) }) + + err = testutil.GatherAndCompare(registry, file) + if err == nil { + match = true + break + } + } + require.Truef(t, match, "expected export not produced: %v", err) + }) + } +} diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 731be2dfd70..33743742181 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,11 +4,13 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.1 go.opentelemetry.io/otel/metric v0.33.0 go.opentelemetry.io/otel/sdk v1.11.1 go.opentelemetry.io/otel/sdk/metric v0.33.0 + google.golang.org/protobuf v1.28.1 ) require ( @@ -20,12 +22,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.11.1 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/testdata/conflict_help_two_counters_1.txt b/exporters/prometheus/testdata/conflict_help_two_counters_1.txt new file mode 100644 index 00000000000..103c42bd863 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_counters_1.txt @@ -0,0 +1,11 @@ +# HELP bar_bytes_total meter a bar +# TYPE bar_bytes_total counter +bar_bytes_total{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar_bytes_total{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_help_two_counters_2.txt b/exporters/prometheus/testdata/conflict_help_two_counters_2.txt new file mode 100644 index 00000000000..68405422e99 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_counters_2.txt @@ -0,0 +1,11 @@ +# HELP bar_bytes_total meter b bar +# TYPE bar_bytes_total counter +bar_bytes_total{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar_bytes_total{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_help_two_histograms_1.txt b/exporters/prometheus/testdata/conflict_help_two_histograms_1.txt new file mode 100644 index 00000000000..3bdccfc05a7 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_histograms_1.txt @@ -0,0 +1,45 @@ +# HELP bar_bytes meter a bar +# TYPE bar_bytes histogram +bar_bytes_bucket{A="B",le="0",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="5",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="10",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="25",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="50",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="75",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="100",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="250",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="750",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="1000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="2500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="5000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="7500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="10000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="+Inf",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="0",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="5",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="10",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="25",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="50",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="75",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="100",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="250",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="750",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="1000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="2500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="5000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="7500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="10000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="+Inf",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_help_two_histograms_2.txt b/exporters/prometheus/testdata/conflict_help_two_histograms_2.txt new file mode 100644 index 00000000000..2d9e5c966d9 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_histograms_2.txt @@ -0,0 +1,45 @@ +# HELP bar_bytes meter b bar +# TYPE bar_bytes histogram +bar_bytes_bucket{A="B",le="0",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="5",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="10",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="25",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="50",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="75",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="100",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="250",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="750",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="1000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="2500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="5000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="7500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="10000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="+Inf",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +bar_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="0",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="5",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="10",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="25",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="50",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="75",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bytes_bucket{A="B",le="100",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="250",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="750",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="1000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="2500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="5000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="7500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="10000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_bucket{A="B",le="+Inf",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +bar_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_help_two_updowncounters_1.txt b/exporters/prometheus/testdata/conflict_help_two_updowncounters_1.txt new file mode 100644 index 00000000000..72fd145eab4 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_updowncounters_1.txt @@ -0,0 +1,11 @@ +# HELP bar_bytes meter a bar +# TYPE bar_bytes gauge +bar_bytes{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar_bytes{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_help_two_updowncounters_2.txt b/exporters/prometheus/testdata/conflict_help_two_updowncounters_2.txt new file mode 100644 index 00000000000..2e2cef1004b --- /dev/null +++ b/exporters/prometheus/testdata/conflict_help_two_updowncounters_2.txt @@ -0,0 +1,11 @@ +# HELP bar_bytes meter b bar +# TYPE bar_bytes gauge +bar_bytes{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar_bytes{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_1.txt b/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_1.txt new file mode 100644 index 00000000000..885fb3c7259 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_1.txt @@ -0,0 +1,9 @@ +# HELP foo_total meter foo +# TYPE foo_total counter +foo_total{otel_scope_name="ma",otel_scope_version="v0.1.0",type="foo"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_2.txt b/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_2.txt new file mode 100644 index 00000000000..62275c98260 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_type_counter_and_updowncounter_2.txt @@ -0,0 +1,9 @@ +# HELP foo_total meter foo +# TYPE foo_total gauge +foo_total{otel_scope_name="ma",otel_scope_version="v0.1.0",type="foo"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_1.txt b/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_1.txt new file mode 100644 index 00000000000..91f1ef774f9 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_1.txt @@ -0,0 +1,9 @@ +# HELP foo_bytes meter gauge foo +# TYPE foo_bytes gauge +foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_2.txt b/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_2.txt new file mode 100644 index 00000000000..15e9a9c570a --- /dev/null +++ b/exporters/prometheus/testdata/conflict_type_histogram_and_updowncounter_2.txt @@ -0,0 +1,26 @@ +# HELP foo_bytes meter histogram foo +# TYPE foo_bytes histogram +foo_bytes_bucket{A="B",le="0",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="5",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="10",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="25",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="50",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="75",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="100",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="250",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="750",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="1000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="2500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="5000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="7500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="10000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="+Inf",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_unit_two_counters.txt b/exporters/prometheus/testdata/conflict_unit_two_counters.txt new file mode 100644 index 00000000000..07efc2e5549 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_unit_two_counters.txt @@ -0,0 +1,11 @@ +# HELP bar_total meter bar +# TYPE bar_total counter +bar_total{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar_total{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_unit_two_histograms.txt b/exporters/prometheus/testdata/conflict_unit_two_histograms.txt new file mode 100644 index 00000000000..e41a7812e9a --- /dev/null +++ b/exporters/prometheus/testdata/conflict_unit_two_histograms.txt @@ -0,0 +1,45 @@ +# HELP bar meter histogram bar +# TYPE bar histogram +bar_bucket{A="B",le="0",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="5",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="10",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="25",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="50",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="75",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="100",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="250",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="750",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="1000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="2500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="5000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="7500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="10000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="+Inf",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +bar_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="0",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="5",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="10",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="25",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="50",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="75",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +bar_bucket{A="B",le="100",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="250",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="750",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="1000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="2500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="5000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="7500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="10000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_bucket{A="B",le="+Inf",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +bar_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +bar_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/conflict_unit_two_updowncounters.txt b/exporters/prometheus/testdata/conflict_unit_two_updowncounters.txt new file mode 100644 index 00000000000..54b608484e1 --- /dev/null +++ b/exporters/prometheus/testdata/conflict_unit_two_updowncounters.txt @@ -0,0 +1,11 @@ +# HELP bar meter gauge bar +# TYPE bar gauge +bar{otel_scope_name="ma",otel_scope_version="v0.1.0",type="bar"} 100 +bar{otel_scope_name="mb",otel_scope_version="v0.1.0",type="bar"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/no_conflict_two_counters.txt b/exporters/prometheus/testdata/no_conflict_two_counters.txt new file mode 100644 index 00000000000..4a1a1f5db3c --- /dev/null +++ b/exporters/prometheus/testdata/no_conflict_two_counters.txt @@ -0,0 +1,11 @@ +# HELP foo_bytes_total meter counter foo +# TYPE foo_bytes_total counter +foo_bytes_total{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +foo_bytes_total{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/no_conflict_two_histograms.txt b/exporters/prometheus/testdata/no_conflict_two_histograms.txt new file mode 100644 index 00000000000..10b472032de --- /dev/null +++ b/exporters/prometheus/testdata/no_conflict_two_histograms.txt @@ -0,0 +1,45 @@ +# HELP foo_bytes meter histogram foo +# TYPE foo_bytes histogram +foo_bytes_bucket{A="B",le="0",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="5",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="10",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="25",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="50",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="75",otel_scope_name="ma",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="100",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="250",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="750",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="1000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="2500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="5000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="7500",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="10000",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="+Inf",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_sum{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +foo_bytes_count{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="0",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="5",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="10",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="25",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="50",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="75",otel_scope_name="mb",otel_scope_version="v0.1.0"} 0 +foo_bytes_bucket{A="B",le="100",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="250",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="750",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="1000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="2500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="5000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="7500",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="10000",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_bucket{A="B",le="+Inf",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +foo_bytes_sum{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +foo_bytes_count{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/no_conflict_two_updowncounters.txt b/exporters/prometheus/testdata/no_conflict_two_updowncounters.txt new file mode 100644 index 00000000000..f2531f48b2d --- /dev/null +++ b/exporters/prometheus/testdata/no_conflict_two_updowncounters.txt @@ -0,0 +1,11 @@ +# HELP foo_bytes meter gauge foo +# TYPE foo_bytes gauge +foo_bytes{A="B",otel_scope_name="ma",otel_scope_version="v0.1.0"} 100 +foo_bytes{A="B",otel_scope_name="mb",otel_scope_version="v0.1.0"} 100 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="ma",otel_scope_version="v0.1.0"} 1 +otel_scope_info{otel_scope_name="mb",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From bc5cf7eb26a455be6d5b359dea0b6592c4176412 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:43:20 -0600 Subject: [PATCH 337/886] Release v1.11.2/v0.34.0 (#3512) * Update Versions Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Prepare stable-v1 for version v1.11.2 * Prepare experimental-metrics for version v0.34.0 * Update Changelog Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Update CHANGELOG version.md Co-authored-by: Anthony Mirabella Signed-off-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Anthony Mirabella --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 8 ++++---- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 31 files changed, 129 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 949ea926d7c..9f130b8be10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.11.2/0.34.0] 2022-12-05 + ### Added - The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package. @@ -2085,7 +2087,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.2...HEAD +[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 [1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 [1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 [0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 91b13091c37..e718783ff38 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index c3846724c3e..a00cc156c7f 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/bridge/opencensus v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/bridge/opencensus v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.33.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.33.0 // indirect + go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.34.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 731771df3d2..77d6bafaf2e 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index 7043f38b97e..4b38edb0a1a 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 04bf6e88870..33fc0a881dd 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/jaeger v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/jaeger v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 0453a4763e4..a9bd8db480e 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 2f639b4b6e2..5c8c87d3d4c 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/bridge/opencensus v0.33.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.33.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/bridge/opencensus v0.34.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.33.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 646f53e66ed..51e93789716 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 google.golang.org/grpc v1.51.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 9fbfce7c2e5..0393f783650 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index c9526f71e4d..1afe8ad9488 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/prometheus v0.33.0 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/prometheus v0.34.0 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.1 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index c4f939eec9c..f6597916ce5 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/prometheus v0.33.0 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/prometheus v0.34.0 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index d26485a807f..98920249907 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/zipkin v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/zipkin v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 75359276e80..0ee4a1cb2bc 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 934741eb86d..4a03fa1ed02 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.4.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index a27db895774..6bfcc05c59d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 google.golang.org/grpc v1.51.0 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.1 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.4.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b39cebc2d24..0e2920ac556 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.33.0 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.1 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/sdk v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.4.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 57b753017df..2e1316c0e83 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.51.0 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 5f61edd7ed6..1b729ec9c51 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect golang.org/x/text v0.4.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 6e15a4122e9..30d93b79cc6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 33743742181..4f592e9aed0 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 google.golang.org/protobuf v1.28.1 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 586d6da2c25..3d9fddd6e48 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/sdk/metric v0.33.0 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/sdk/metric v0.34.0 ) require ( @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 4c4defb6ca7..aa854f5909f 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 9b3a14cf0fa..b68d7ff3f1e 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,9 +6,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/sdk v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/go.mod b/go.mod index 6edc52deaf0..767ce13fe78 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel/trace v1.11.2 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 12eff7a0de9..867f4c1b6d4 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel v1.11.2 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 022ad8ce1f2..a0a6068ee9c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/trace v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/trace v1.11.2 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index e5395f84c26..25aede72907 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 - go.opentelemetry.io/otel/metric v0.33.0 - go.opentelemetry.io/otel/sdk v1.11.1 + go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/sdk v1.11.2 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.1 // indirect + go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 66d0ec6fe9d..2befdee4c61 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.1 + go.opentelemetry.io/otel v1.11.2 ) require ( diff --git a/version.go b/version.go index 942e484f848..00b79bcc25c 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.11.1" + return "1.11.2" } diff --git a/versions.yaml b/versions.yaml index a2905787a55..611879def4f 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.11.1 + version: v1.11.2 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.33.0 + version: v0.34.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 4146bd1403be895f9c1b1193e1aa177039c32001 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Dec 2022 07:38:06 -0800 Subject: [PATCH 338/886] Bump github.com/itchyny/gojq from 0.12.9 to 0.12.10 in /internal/tools (#3510) * Bump github.com/itchyny/gojq from 0.12.9 to 0.12.10 in /internal/tools Bumps [github.com/itchyny/gojq](https://github.com/itchyny/gojq) from 0.12.9 to 0.12.10. - [Release notes](https://github.com/itchyny/gojq/releases) - [Changelog](https://github.com/itchyny/gojq/blob/main/CHANGELOG.md) - [Commits](https://github.com/itchyny/gojq/compare/v0.12.9...v0.12.10) --- updated-dependencies: - dependency-name: github.com/itchyny/gojq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Update build-tools * Update golangci-lint * Run dependabot config gen Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- .github/dependabot.yml | 9 +++++ internal/tools/go.mod | 33 +++++++++--------- internal/tools/go.sum | 76 ++++++++++++++++++------------------------ 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a38cf2d16b1..51a3c3eb726 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,6 +10,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: docker + directory: / + labels: + - dependencies + - docker + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: / labels: diff --git a/internal/tools/go.mod b/internal/tools/go.mod index cfa45b2bbef..d9ae24949e3 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,13 +6,13 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.50.1 - github.com/itchyny/gojq v0.12.9 + github.com/itchyny/gojq v0.12.10 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c - go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c - go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c - go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c + go.opentelemetry.io/build-tools/crosslink v0.3.0 + go.opentelemetry.io/build-tools/dbotconf v0.3.0 + go.opentelemetry.io/build-tools/multimod v0.3.0 + go.opentelemetry.io/build-tools/semconvgen v0.3.0 golang.org/x/tools v0.3.0 ) @@ -91,8 +91,8 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect github.com/imdario/mergo v0.3.12 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/itchyny/timefmt-go v0.1.4 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jgautheron/goconst v1.5.1 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect @@ -115,7 +115,7 @@ require ( github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect - github.com/mattn/go-runewidth v0.0.13 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.2.4 // indirect @@ -127,7 +127,6 @@ require ( github.com/nishanths/exhaustive v0.8.3 // indirect github.com/nishanths/predeclared v0.2.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/otiai10/copy v1.7.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect @@ -159,10 +158,10 @@ require ( github.com/sourcegraph/go-diff v0.6.1 // indirect github.com/spf13/afero v1.9.2 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.6.0 // indirect + github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.13.0 // indirect + github.com/spf13/viper v1.14.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect @@ -181,18 +180,18 @@ require ( github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.7.0 // indirect - go.uber.org/zap v1.21.0 // indirect + go.opentelemetry.io/build-tools v0.3.0 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.8.0 // indirect + go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.1.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/net v0.2.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 01ce42ad7e2..4c2f1b835ed 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -81,7 +81,6 @@ github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBF github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -114,7 +113,6 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= @@ -320,13 +318,13 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itchyny/gojq v0.12.9 h1:biKpbKwMxVYhCU1d6mR7qMr3f0Hn9F5k5YykCVb3gmM= -github.com/itchyny/gojq v0.12.9/go.mod h1:T4Ip7AETUXeGpD+436m+UEl3m3tokRgajd5pRfsR5oE= -github.com/itchyny/timefmt-go v0.1.4 h1:hFEfWVdwsEi+CY8xY2FtgWHGQaBaC3JeHd+cve0ynVM= -github.com/itchyny/timefmt-go v0.1.4/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/itchyny/gojq v0.12.10 h1:6TcS0VYWS6wgntpF/4tnrzwdCMjiTxRAxIqZWfDsDQU= +github.com/itchyny/gojq v0.12.10/go.mod h1:o3FT8Gkbg/geT4pLI0tF3hvip5F3Y/uskjRz9OYa38g= +github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= +github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcchavezs/porto v0.4.0 h1:Zj7RligrxmDdKGo6fBO2xYAHxEgrVBfs1YAja20WbV4= @@ -364,7 +362,6 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -405,8 +402,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -441,14 +438,11 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= -github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= +github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI= -github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= @@ -546,15 +540,14 @@ github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= -github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= -github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= -github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= +github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= +github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= @@ -572,7 +565,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -623,26 +615,24 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a h1:yLxbGYl9MXOqD0o3unX/nJn+y+1loFNWZJWkfeguYV8= -go.opentelemetry.io/build-tools v0.0.0-20220321164008-b8e03aff061a/go.mod h1:gkLviEngQuoeD670EP1KA/Oj4i5oNAzb+pjkk+4ecaQ= -go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c h1:29qFnf/xOmEAGv7DwfLLnRejjIcksPdCw+Je0rIlj1Y= -go.opentelemetry.io/build-tools/crosslink v0.0.0-20220706175322-58de0d25b85c/go.mod h1:HI436k8NShByIY1P0z6IIrVByrJQ9//qnJTFocdY2nM= -go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c h1:LCMy1QnOiursbSFlKYCGkfnSZfRiZgqGfypltWuWn/0= -go.opentelemetry.io/build-tools/dbotconf v0.0.0-20220706175322-58de0d25b85c/go.mod h1:IIF9IbxlzOnHM0E21vDeGSKHDYImShTJ4qTvKs4m+G4= -go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c h1:NaZFvE0Vn3yWNnZxQEl5Zu6Fbl6xGxFy5eqOPi865Q8= -go.opentelemetry.io/build-tools/multimod v0.0.0-20220706175322-58de0d25b85c/go.mod h1:EOBbXCes6aVxWqvSy3v1AJD8vtC4++fW1UH5AB8W4uM= -go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c h1:sdRLGv2B9aIRQdLLKlQ6RT/N5MOgsDI+UeYQqNP1g5I= -go.opentelemetry.io/build-tools/semconvgen v0.0.0-20220706175322-58de0d25b85c/go.mod h1:5ykZFab0x3jatwG5Rf2idlko5e5Z42XsyJLMg4h35bg= +go.opentelemetry.io/build-tools v0.3.0 h1:ehCOkLXOy/AryssN74PzCMya6MWoReFhygnyWGddC6Y= +go.opentelemetry.io/build-tools v0.3.0/go.mod h1:WewIEPPmfvHi9CvNXaAqfLHQRdv4bFpy7V5PTyMUQno= +go.opentelemetry.io/build-tools/crosslink v0.3.0 h1:XhhedQvxZTjbGQXAAqO7BNiVGIMArZzS2Lj5S+98w4M= +go.opentelemetry.io/build-tools/crosslink v0.3.0/go.mod h1:e+s2mLk6AI79HkvLrTa4SeM0oQ6ykFFeMyRCfLz0eX8= +go.opentelemetry.io/build-tools/dbotconf v0.3.0 h1:moQZLXl+lqPEkp3pfJxQWdQQ17DOzo4CMnEW0dJQWhc= +go.opentelemetry.io/build-tools/dbotconf v0.3.0/go.mod h1:gIOWVOWTrooqH3IrROAA8Lyv8HwnXfrhE2tbtyOgaHE= +go.opentelemetry.io/build-tools/multimod v0.3.0 h1:eCr6XYpEFA+VZ3aaD+81HEmgotP963sN/TjOAgx7A2k= +go.opentelemetry.io/build-tools/multimod v0.3.0/go.mod h1:I+OYyA29iAxaGhoxLvqgcYkOMQeKJ6R3sEn1YQNddlQ= +go.opentelemetry.io/build-tools/semconvgen v0.3.0 h1:ml4Rsej3E6u46TCtOMjmHDkCWin2fDx0xE9rdkH7Iu0= +go.opentelemetry.io/build-tools/semconvgen v0.3.0/go.mod h1:qsPYyE3sd1+ikaock1R9ftHc9IObqCIvRXTHWcg4Ta8= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= -go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= -go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= -go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8= -go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= +go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -828,8 +818,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= @@ -841,8 +831,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 9c61547163769696926915d8f4bb794608698f2a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 7 Dec 2022 11:38:22 -0800 Subject: [PATCH 339/886] Remove the deprecated view package (#3520) * Remove the deprecated view package * Add change to changelog * Fix changelog header --- CHANGELOG.md | 4 + sdk/metric/view/doc.go | 23 -- sdk/metric/view/example_test.go | 196 ------------- sdk/metric/view/instrument.go | 32 --- sdk/metric/view/instrumentkind.go | 64 ----- sdk/metric/view/view.go | 236 ---------------- sdk/metric/view/view_test.go | 444 ------------------------------ 7 files changed, 4 insertions(+), 995 deletions(-) delete mode 100644 sdk/metric/view/doc.go delete mode 100644 sdk/metric/view/example_test.go delete mode 100644 sdk/metric/view/instrument.go delete mode 100644 sdk/metric/view/instrumentkind.go delete mode 100644 sdk/metric/view/view.go delete mode 100644 sdk/metric/view/view_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f130b8be10..c841901a7b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) + ## [1.11.2/0.34.0] 2022-12-05 ### Added diff --git a/sdk/metric/view/doc.go b/sdk/metric/view/doc.go deleted file mode 100644 index c757b75bd35..00000000000 --- a/sdk/metric/view/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package view provides types and functionality that customize the metric -// telemetry an SDK will produce. The View type is used when a Reader is -// registered with a MeterProvider in the go.opentelemetry.io/otel/sdk/metric -// package. See the WithReader option in that package for more information on -// how this registration takes place. -// -// Deprecated: Use Instrument, InstrumentKind, View, and NewView in -// go.opentelemetry.io/otel/sdk/metric instead. -package view // import "go.opentelemetry.io/otel/sdk/metric/view" diff --git a/sdk/metric/view/example_test.go b/sdk/metric/view/example_test.go deleted file mode 100644 index 76d99df6d45..00000000000 --- a/sdk/metric/view/example_test.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view // import "go.opentelemetry.io/otel/sdk/metric/view" - -import ( - "fmt" - - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" -) - -func Example() { - // The "active-users" instrument created by the - // "github.com/super/noisy/instrumentation/package" your project includes - // has a bug, it records a measurment any time a user has any activity. - // This is causing a lot of strain on your program without providing any - // value to you. The next version of - // "github.com/super/noisy/instrumentation/package" corrects the - // instrumentation to only record a value when a user logs in, but it - // isn't out yet. - // - // Use a View to drop these measurments while you wait for the fix to come - // from upstream. - - v, err := New( - MatchInstrumentName("active-users"), - MatchInstrumentationScope(instrumentation.Scope{ - Name: "github.com/super/noisy/instrumentation/package", - Version: "v0.22.0", // Only match the problematic instrumentation version. - }), - WithSetAggregation(aggregation.Drop{}), - ) - if err != nil { - panic(err) - } - - // The SDK this view is registered with calls TransformInstrument when an - // instrument is created. Test that our fix will work as intended. - i, _ := v.TransformInstrument(Instrument{ - Name: "active-users", - Scope: instrumentation.Scope{ - Name: "github.com/super/noisy/instrumentation/package", - Version: "v0.22.0", - }, - Aggregation: aggregation.LastValue{}, - }) - fmt.Printf("Instrument{%q: %s}: %#v\n", i.Name, i.Scope.Version, i.Aggregation) - - // Also, ensure the next version will not be transformed. - _, ok := v.TransformInstrument(Instrument{ - Name: "active-users", - Scope: instrumentation.Scope{ - Name: "github.com/super/noisy/instrumentation/package", - Version: "v0.23.0", - }, - Aggregation: aggregation.LastValue{}, - }) - fmt.Printf("Instrument{\"active-users\": v0.23.0} matched: %t\n", ok) - // Output: - // - // Instrument{"active-users": v0.22.0}: aggregation.Drop{} - // Instrument{"active-users": v0.23.0} matched: false -} - -func ExampleMatchInstrumentName() { - v, err := New(MatchInstrumentName("request-*")) // Wildcard match. - if err != nil { - panic(err) - } - - for _, i := range []Instrument{ - {Name: "request-count"}, - {Name: "request-rate"}, - {Name: "latency"}, - } { - // The SDK calls TransformInstrument when an instrument is created. - _, ok := v.TransformInstrument(i) - fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) - } - // Output: - // Instrument{"request-count"} matched: true - // Instrument{"request-rate"} matched: true - // Instrument{"latency"} matched: false -} - -func ExampleMatchInstrumentKind() { - v, err := New(MatchInstrumentKind(SyncCounter)) - if err != nil { - panic(err) - } - - for _, i := range []Instrument{ - {Name: "synchronous counter", Kind: SyncCounter}, - {Name: "synchronous histogram", Kind: SyncHistogram}, - {Name: "asynchronous counter", Kind: AsyncCounter}, - } { - // The SDK calls TransformInstrument when an instrument is created. - _, ok := v.TransformInstrument(i) - fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) - } - // Output: - // Instrument{"synchronous counter"} matched: true - // Instrument{"synchronous histogram"} matched: false - // Instrument{"asynchronous counter"} matched: false -} - -func ExampleMatchInstrumentationScope() { - v, err := New(MatchInstrumentationScope(instrumentation.Scope{ - Name: "custom/instrumentation/package", - Version: "v0.22.0", // Only match this version of instrumentation. - })) - if err != nil { - panic(err) - } - - for _, i := range []Instrument{ - {Name: "v1.0.0 instrumentation", Scope: instrumentation.Scope{ - Name: "custom/instrumentation/package", - Version: "v1.0.0", - }}, - {Name: "v0.22.0 instrumentation", Scope: instrumentation.Scope{ - Name: "custom/instrumentation/package", - Version: "v0.22.0", - }}, - } { - // The SDK calls TransformInstrument when an instrument is created. - _, ok := v.TransformInstrument(i) - fmt.Printf("Instrument{%q} matched: %t\n", i.Name, ok) - } - // Output: - // Instrument{"v1.0.0 instrumentation"} matched: false - // Instrument{"v0.22.0 instrumentation"} matched: true -} - -func ExampleWithRename() { - v, err := New(MatchInstrumentName("bad-name"), WithRename("good-name")) - if err != nil { - panic(err) - } - - // The SDK calls TransformInstrument when an instrument is created. - i, _ := v.TransformInstrument(Instrument{Name: "bad-name"}) - fmt.Printf("Instrument{%q}\n", i.Name) - // Output: Instrument{"good-name"} -} - -func ExampleWithSetDescription() { - v, err := New( - MatchInstrumentName("requests"), - WithSetDescription("Number of requests received"), - ) - if err != nil { - panic(err) - } - - // The SDK calls TransformInstrument when an instrument is created. - i, _ := v.TransformInstrument(Instrument{ - Name: "requests", - Description: "incorrect description", - }) - fmt.Printf("Instrument{%q: %s}\n", i.Name, i.Description) - // Output: Instrument{"requests": Number of requests received} -} - -func ExampleWithSetAggregation() { - v, err := New(MatchInstrumentationScope(instrumentation.Scope{ - Name: "super/noisy/instrumentation/package", - }), WithSetAggregation(aggregation.Drop{})) - if err != nil { - panic(err) - } - - // The SDK calls TransformInstrument when an instrument is created. - i, _ := v.TransformInstrument(Instrument{ - Name: "active-users", - Scope: instrumentation.Scope{ - Name: "super/noisy/instrumentation/package", - Version: "v0.5.0", - }, - Aggregation: aggregation.LastValue{}, - }) - fmt.Printf("Instrument{%q}: %#v\n", i.Name, i.Aggregation) - // Output: Instrument{"active-users"}: aggregation.Drop{} -} diff --git a/sdk/metric/view/instrument.go b/sdk/metric/view/instrument.go deleted file mode 100644 index 77536de2114..00000000000 --- a/sdk/metric/view/instrument.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view // import "go.opentelemetry.io/otel/sdk/metric/view" - -import ( - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" -) - -// Instrument uniquely identifies an instrument within a meter. -// -// Deprecated: Use Instrument in go.opentelemetry.io/otel/sdk/metric instead. -type Instrument struct { - Scope instrumentation.Scope - - Name string - Description string - Kind InstrumentKind - Aggregation aggregation.Aggregation -} diff --git a/sdk/metric/view/instrumentkind.go b/sdk/metric/view/instrumentkind.go deleted file mode 100644 index 357117e334a..00000000000 --- a/sdk/metric/view/instrumentkind.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view // import "go.opentelemetry.io/otel/sdk/metric/view" - -// InstrumentKind describes the kind of instrument a Meter can create. -// -// Deprecated: Use InstrumentKind in go.opentelemetry.io/otel/sdk/metric -// instead. -type InstrumentKind uint8 - -// These are all the instrument kinds supported by the SDK. -const ( - // undefinedInstrument is an uninitialized instrument kind, should not be used. - //nolint:deadcode,varcheck - undefinedInstrument InstrumentKind = iota - // SyncCounter is an instrument kind that records increasing values - // synchronously in application code. - // - // Deprecated: Use InstrumentKindSyncCounter in - // go.opentelemetry.io/otel/sdk/metric instead. - SyncCounter - // SyncUpDownCounter is an instrument kind that records increasing and - // decreasing values synchronously in application code. - // - // Deprecated: Use InstrumentKindSyncUpDownCounter in - // go.opentelemetry.io/otel/sdk/metric instead. - SyncUpDownCounter - // SyncHistogram is an instrument kind that records a distribution of - // values synchronously in application code. - // - // Deprecated: Use InstrumentKindSyncHistogram in - // go.opentelemetry.io/otel/sdk/metric instead. - SyncHistogram - // AsyncCounter is an instrument kind that records increasing values in an - // asynchronous callback. - // - // Deprecated: Use InstrumentKindAsyncCounter in - // go.opentelemetry.io/otel/sdk/metric instead. - AsyncCounter - // AsyncUpDownCounter is an instrument kind that records increasing and - // decreasing values in an asynchronous callback. - // - // Deprecated: Use InstrumentKindAsyncUpDownCounter in - // go.opentelemetry.io/otel/sdk/metric instead. - AsyncUpDownCounter - // AsyncGauge is an instrument kind that records current values in an - // asynchronous callback. - // - // Deprecated: Use InstrumentKindAsyncGauge in - // go.opentelemetry.io/otel/sdk/metric instead. - AsyncGauge -) diff --git a/sdk/metric/view/view.go b/sdk/metric/view/view.go deleted file mode 100644 index 3e432afb3f8..00000000000 --- a/sdk/metric/view/view.go +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view // import "go.opentelemetry.io/otel/sdk/metric/view" - -import ( - "fmt" - "regexp" - "strings" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" -) - -// View provides users with the flexibility to customize the metrics that are -// output by the SDK. A View can be used to ignore, change the name, -// description, and aggregation of, and customize which attribute(s) are to be -// reported by Instruments. -// -// An empty View will match all instruments, and do no transformations. -// -// Deprecated: Use View in go.opentelemetry.io/otel/sdk/metric instead. -type View struct { - instrumentName *regexp.Regexp - hasWildcard bool - scope instrumentation.Scope - instrumentKind InstrumentKind - - filter attribute.Filter - name string - description string - agg aggregation.Aggregation -} - -// New returns a new configured View. If there are any duplicate Options passed, -// the last one passed will take precedence. The unique, de-duplicated, -// Options are all applied to the View. An instrument needs to match all of -// the match Options passed for the View to be applied to it. Similarly, all -// transform operation Options are applied to matched Instruments. -// -// Deprecated: Use NewView in go.opentelemetry.io/otel/sdk/metric instead. -func New(opts ...Option) (View, error) { - v := View{} - - for _, opt := range opts { - v = opt.apply(v) - } - - emptyScope := instrumentation.Scope{} - if v.instrumentName == nil && - v.scope == emptyScope && - v.instrumentKind == undefinedInstrument { - return View{}, fmt.Errorf("must provide at least 1 match option") - } - - if v.hasWildcard && v.name != "" { - return View{}, fmt.Errorf("invalid view: view name specified for multiple instruments") - } - - return v, nil -} - -// TransformInstrument will check if an instrument matches this view -// and will convert it if it does. -func (v View) TransformInstrument(inst Instrument) (transformed Instrument, match bool) { - if !v.match(inst) { - return Instrument{}, false - } - if v.name != "" { - inst.Name = v.name - } - if v.description != "" { - inst.Description = v.description - } - if v.agg != nil { - inst.Aggregation = v.agg - } - return inst, true -} - -// AttributeFilter returns a function that returns only attributes specified by -// WithFilterAttributes. If no filter was provided nil is returned. -func (v View) AttributeFilter() func(attribute.Set) attribute.Set { - if v.filter == nil { - return nil - } - return func(input attribute.Set) attribute.Set { - out, _ := input.Filter(v.filter) - return out - } -} - -func (v View) matchName(name string) bool { - return v.instrumentName == nil || v.instrumentName.MatchString(name) -} - -func (v View) matchScopeName(name string) bool { - return v.scope.Name == "" || name == v.scope.Name -} - -func (v View) matchScopeVersion(version string) bool { - return v.scope.Version == "" || version == v.scope.Version -} - -func (v View) matchScopeSchemaURL(schemaURL string) bool { - return v.scope.SchemaURL == "" || schemaURL == v.scope.SchemaURL -} - -func (v View) matchInstrumentKind(kind InstrumentKind) bool { - return v.instrumentKind == undefinedInstrument || kind == v.instrumentKind -} - -func (v View) match(i Instrument) bool { - return v.matchName(i.Name) && - v.matchScopeName(i.Scope.Name) && - v.matchScopeSchemaURL(i.Scope.SchemaURL) && - v.matchScopeVersion(i.Scope.Version) && - v.matchInstrumentKind(i.Kind) -} - -// Option applies a configuration option value to a View. -type Option interface { - apply(View) View -} - -type optionFunc func(View) View - -func (f optionFunc) apply(v View) View { - return f(v) -} - -// MatchInstrumentName will match an instrument based on the its name. -// This will accept wildcards of * for zero or more characters, and ? for -// exactly one character. A name of "*" (default) will match all instruments. -func MatchInstrumentName(name string) Option { - return optionFunc(func(v View) View { - if strings.ContainsAny(name, "*?") { - v.hasWildcard = true - } - name = regexp.QuoteMeta(name) - name = "^" + name + "$" - name = strings.ReplaceAll(name, "\\?", ".") - name = strings.ReplaceAll(name, "\\*", ".*") - v.instrumentName = regexp.MustCompile(name) - return v - }) -} - -// MatchInstrumentKind with match an instrument based on the instrument's kind. -// The default is to match all instrument kinds. -func MatchInstrumentKind(kind InstrumentKind) Option { - return optionFunc(func(v View) View { - v.instrumentKind = kind - return v - }) -} - -// MatchInstrumentationScope will do an exact match on any -// instrumentation.Scope field that is non-empty (""). The default is to match all -// instrumentation scopes. -func MatchInstrumentationScope(scope instrumentation.Scope) Option { - return optionFunc(func(v View) View { - v.scope = scope - return v - }) -} - -// WithRename will rename the instrument the view matches. If not used or empty the -// instrument name will not be changed. Must be used with a non-wildcard -// instrument name match. The default does not change the instrument name. -func WithRename(name string) Option { - return optionFunc(func(v View) View { - v.name = name - return v - }) -} - -// WithSetDescription will change the description of the instruments the view -// matches to desc. If not used or empty the description will not be changed. -func WithSetDescription(desc string) Option { - return optionFunc(func(v View) View { - v.description = desc - return v - }) -} - -// WithFilterAttributes will select attributes that have a matching key. If not used -// or empty no filter will be applied. -func WithFilterAttributes(keys ...attribute.Key) Option { - return optionFunc(func(v View) View { - if len(keys) == 0 { - return v - } - filterKeys := map[attribute.Key]struct{}{} - for _, key := range keys { - filterKeys[key] = struct{}{} - } - - v.filter = attribute.Filter(func(kv attribute.KeyValue) bool { - _, ok := filterKeys[kv.Key] - return ok - }) - return v - }) -} - -// WithSetAggregation will use the aggregation a for matching instruments. If -// this option is not provided, the reader defined aggregation for the -// instrument will be used. -// -// If a is misconfigured, it will not be used and an error will be logged. -func WithSetAggregation(a aggregation.Aggregation) Option { - cpA := a.Copy() - if err := cpA.Err(); err != nil { - global.Error(err, "not using aggregation with view", "aggregation", a) - return optionFunc(func(v View) View { return v }) - } - - return optionFunc(func(v View) View { - v.agg = cpA - return v - }) -} diff --git a/sdk/metric/view/view_test.go b/sdk/metric/view/view_test.go deleted file mode 100644 index 92034345926..00000000000 --- a/sdk/metric/view/view_test.go +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package view // import "go.opentelemetry.io/otel/sdk/metric/view" - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/instrumentation" -) - -var matchInstrument = Instrument{ - Scope: instrumentation.Scope{ - Name: "bar", - Version: "v1.0.0", - SchemaURL: "stuff.test/", - }, - Name: "foo", - Kind: SyncCounter, - Description: "", -} - -var noMatchInstrument = Instrument{ - Scope: instrumentation.Scope{ - Name: "notfoo", - Version: "v0.x.0", - SchemaURL: "notstuff.test/", - }, - Name: "notstuff", - Description: "", - Kind: undefinedInstrument, -} - -var emptyDescription = Instrument{} - -func TestViewTransformInstrument(t *testing.T) { - tests := []struct { - name string - options []Option - match Instrument - notMatch Instrument - }{ - { - name: "instrument name", - options: []Option{ - MatchInstrumentName("foo"), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "Scope name", - options: []Option{ - MatchInstrumentationScope(instrumentation.Scope{ - Name: "bar", - }), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "Scope version", - options: []Option{ - MatchInstrumentationScope(instrumentation.Scope{ - Version: "v1.0.0", - }), - }, - - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "Scope SchemaURL", - options: []Option{ - MatchInstrumentationScope(instrumentation.Scope{ - SchemaURL: "stuff.test/", - }), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, { - name: "instrument kind", - options: []Option{ - MatchInstrumentKind(SyncCounter), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "Expands *", - options: []Option{ - MatchInstrumentName("f*"), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "composite literal name", - options: []Option{ - MatchInstrumentName("foo"), - MatchInstrumentationScope(instrumentation.Scope{ - Name: "bar", - Version: "v1.0.0", - SchemaURL: "stuff.test/", - }), - }, - match: matchInstrument, - notMatch: emptyDescription, - }, - { - name: "rename", - options: []Option{ - MatchInstrumentName("foo"), - WithRename("baz"), - }, - match: Instrument{ - Scope: instrumentation.Scope{ - Name: "bar", - Version: "v1.0.0", - SchemaURL: "stuff.test/", - }, - Name: "baz", - Description: "", - Kind: SyncCounter, - }, - notMatch: emptyDescription, - }, - { - name: "change description", - options: []Option{ - MatchInstrumentName("foo"), - WithSetDescription("descriptive stuff"), - }, - match: Instrument{ - Scope: instrumentation.Scope{ - Name: "bar", - Version: "v1.0.0", - SchemaURL: "stuff.test/", - }, - Name: "foo", - Description: "descriptive stuff", - Kind: SyncCounter, - }, - notMatch: emptyDescription, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - v, err := New(tt.options...) - require.NoError(t, err) - - t.Run("match", func(t *testing.T) { - got, match := v.TransformInstrument(matchInstrument) - assert.Equal(t, tt.match, got) - assert.True(t, match) - }) - - t.Run("does not match", func(t *testing.T) { - got, match := v.TransformInstrument(noMatchInstrument) - assert.Equal(t, tt.notMatch, got) - assert.False(t, match) - }) - }) - } -} - -func TestViewMatchName(t *testing.T) { - tests := []struct { - name string - matchName string - matches []string - notMatches []string - hasWildcard bool - }{ - { - name: "exact", - matchName: "foo", - matches: []string{"foo"}, - notMatches: []string{"foobar", "barfoo", "barfoobaz"}, - hasWildcard: false, - }, - { - name: "*", - matchName: "*", - matches: []string{"foo", "foobar", "barfoo", "barfoobaz", ""}, - notMatches: []string{}, - hasWildcard: true, - }, - { - name: "front ?", - matchName: "?foo", - matches: []string{"1foo", "afoo"}, - notMatches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, - hasWildcard: true, - }, - { - name: "back ?", - matchName: "foo?", - matches: []string{"foo1", "fooz"}, - notMatches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, - hasWildcard: true, - }, - { - name: "front *", - matchName: "*foo", - matches: []string{"foo", "barfoo"}, - notMatches: []string{"foobar", "barfoobaz"}, - hasWildcard: true, - }, - { - name: "back *", - matchName: "foo*", - matches: []string{"foo", "foobar"}, - notMatches: []string{"barfoo", "barfoobaz"}, - hasWildcard: true, - }, - { - name: "both *", - matchName: "*foo*", - matches: []string{"foo", "foobar", "barfoo", "barfoobaz"}, - notMatches: []string{"baz"}, - hasWildcard: true, - }, - { - name: "front **", - matchName: "**foo", - matches: []string{"foo", "barfoo", "1foo", "afoo"}, - notMatches: []string{"foobar", "barfoobaz", "baz", "foo1", "fooz"}, - hasWildcard: true, - }, - { - name: "back **", - matchName: "foo**", - matches: []string{"foo", "foobar", "foo1", "fooz"}, - notMatches: []string{"barfoo", "barfoobaz", "baz", "1foo", "afoo"}, - hasWildcard: true, - }, - { - name: "front *?", - matchName: "*?foo", - matches: []string{"barfoo", "1foo", "afoo"}, - notMatches: []string{"foo", "foobar", "barfoobaz", "baz", "foo1", "fooz"}, - hasWildcard: true, - }, - { - name: "front ?*", - matchName: "?*foo", - matches: []string{"barfoo", "1foo", "afoo"}, - notMatches: []string{"foo", "foobar", "barfoobaz", "baz", "foo1", "fooz"}, - hasWildcard: true, - }, - { - name: "back *?", - matchName: "foo*?", - matches: []string{"foobar", "foo1", "fooz"}, - notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo"}, - hasWildcard: true, - }, - { - name: "back ?*", - matchName: "foo?*", - matches: []string{"foobar", "foo1", "fooz"}, - notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo"}, - hasWildcard: true, - }, - { - name: "middle *", - matchName: "foo*bar", - matches: []string{"foobar", "foo1bar", "foomanybar"}, - notMatches: []string{"foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz"}, - hasWildcard: true, - }, - { - name: "middle ?", - matchName: "foo?bar", - matches: []string{"foo1bar", "fooabar"}, - notMatches: []string{"foobar", "foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz", "foomanybar"}, - hasWildcard: true, - }, - { - name: "meta chars", - matchName: ".+()|[]{}^$-_", - matches: []string{".+()|[]{}^$-_"}, // Note this is not a valid name. - notMatches: []string{"foobar", "foo", "barfoo", "barfoobaz", "baz", "1foo", "afoo", "foo1", "fooz", "foomanybar", "foo1bar", "fooabar"}, - hasWildcard: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - v, err := New(MatchInstrumentName(tt.matchName)) - require.NoError(t, err) - - t.Log(v.instrumentName.String()) - assert.Equal(t, tt.hasWildcard, v.hasWildcard) - for _, name := range tt.matches { - assert.Truef(t, v.matchName(name), "name: %s", name) - } - for _, name := range tt.notMatches { - assert.Falsef(t, v.matchName(name), "name: %s", name) - } - }) - } -} - -func TestViewAttributeFilterNoFilter(t *testing.T) { - v, err := New( - MatchInstrumentName("*"), - ) - require.NoError(t, err) - filter := v.AttributeFilter() - assert.Nil(t, filter) - - v, err = New( - MatchInstrumentName("*"), - WithFilterAttributes(), - ) - require.NoError(t, err) - filter = v.AttributeFilter() - assert.Nil(t, filter) - - v, err = New( - MatchInstrumentName("*"), - WithFilterAttributes([]attribute.Key{}...), - ) - require.NoError(t, err) - filter = v.AttributeFilter() - assert.Nil(t, filter) -} - -func TestViewAttributeFilter(t *testing.T) { - inputSet := attribute.NewSet( - attribute.String("foo", "bar"), - attribute.Int("power-level", 9001), - attribute.Float64("lifeUniverseEverything", 42.0), - ) - - tests := []struct { - name string - filter []attribute.Key - want attribute.Set - }{ - { - name: "Match 1", - filter: []attribute.Key{ - attribute.Key("power-level"), - }, - want: attribute.NewSet( - attribute.Int("power-level", 9001), - ), - }, - { - name: "Match 2", - filter: []attribute.Key{ - attribute.Key("foo"), - attribute.Key("lifeUniverseEverything"), - }, - want: attribute.NewSet( - attribute.Float64("lifeUniverseEverything", 42.0), - attribute.String("foo", "bar"), - ), - }, - { - name: "Don't match", - filter: []attribute.Key{ - attribute.Key("nothing"), - }, - want: attribute.NewSet(), - }, - { - name: "Match some", - filter: []attribute.Key{ - attribute.Key("power-level"), - attribute.Key("nothing"), - }, - want: attribute.NewSet( - attribute.Int("power-level", 9001), - ), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - v, err := New( - MatchInstrumentName("*"), - WithFilterAttributes(tt.filter...), - ) - require.NoError(t, err) - filter := v.AttributeFilter() - require.NotNil(t, filter) - - got := filter(inputSet) - assert.Equal(t, got.Equivalent(), tt.want.Equivalent()) - }) - } -} - -func TestNewErrors(t *testing.T) { - tests := []struct { - name string - options []Option - }{ - { - name: "No Match Option", - options: []Option{}, - }, - { - name: "Match * with view name", - options: []Option{ - MatchInstrumentName("*"), - WithRename("newName"), - }, - }, - { - name: "Match expand * with view name", - options: []Option{ - MatchInstrumentName("old*"), - WithRename("newName"), - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := New(tt.options...) - - assert.Equal(t, View{}, got) - assert.Error(t, err) - }) - } -} From 8644a79dcf1d57115111b457c70942796dfae0d8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 7 Dec 2022 12:41:50 -0800 Subject: [PATCH 340/886] Fix changelog header (#3521) Increment the removed header from previous release. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c841901a7b3..0486e8de8d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Prevent duplicate Prometheus description, unit, and type. (#3469) - Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489) -## Removed +### Removed - The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486) - The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486) From 4e763472eee5ef03b97274694d2d1b07f0b3cd11 Mon Sep 17 00:00:00 2001 From: aniaan Date: Fri, 9 Dec 2022 00:04:43 +0800 Subject: [PATCH 341/886] feat(exporter): Jaeger and Zipkin exporter use `logr` as the logging interface (#3500) * feat(exporter): Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the WithLogr option * fix(exporter): reuse code * fix(exporter): lint * fix(exporter): add comment * fix(changelog): update --- CHANGELOG.md | 1 + exporters/jaeger/agent.go | 5 ++-- exporters/jaeger/agent_test.go | 7 +++--- exporters/jaeger/go.mod | 4 ++-- exporters/jaeger/reconnecting_udp_client.go | 11 +++++---- .../jaeger/reconnecting_udp_client_test.go | 20 ++++++++-------- exporters/jaeger/uploader.go | 12 ++++++++++ exporters/zipkin/go.mod | 4 ++-- exporters/zipkin/zipkin.go | 24 +++++++++++++------ 9 files changed, 56 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0486e8de8d8..6cb2b592746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) - The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) - The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) +- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) ### Fixed diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go index ed002b83f7a..a050020bb47 100644 --- a/exporters/jaeger/agent.go +++ b/exporters/jaeger/agent.go @@ -18,11 +18,12 @@ import ( "context" "fmt" "io" - "log" "net" "strings" "time" + "github.com/go-logr/logr" + genAgent "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/agent" gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" @@ -58,7 +59,7 @@ type agentClientUDPParams struct { Host string Port string MaxPacketSize int - Logger *log.Logger + Logger logr.Logger AttemptReconnecting bool AttemptReconnectInterval time.Duration } diff --git a/exporters/jaeger/agent_test.go b/exporters/jaeger/agent_test.go index fdcd9bb74d6..95070341722 100644 --- a/exporters/jaeger/agent_test.go +++ b/exporters/jaeger/agent_test.go @@ -16,7 +16,6 @@ package jaeger import ( "context" - "log" "net" "testing" @@ -54,7 +53,7 @@ func TestNewAgentClientUDPWithParams(t *testing.T) { assert.Equal(t, 25000, agentClient.maxPacketSize) if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { - assert.Equal(t, (*log.Logger)(nil), agentClient.connUDP.(*reconnectingUDPConn).logger) + assert.Equal(t, emptyLogger, agentClient.connUDP.(*reconnectingUDPConn).logger) } assert.NoError(t, agentClient.Close()) @@ -77,7 +76,7 @@ func TestNewAgentClientUDPWithParamsDefaults(t *testing.T) { assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { - assert.Equal(t, (*log.Logger)(nil), agentClient.connUDP.(*reconnectingUDPConn).logger) + assert.Equal(t, emptyLogger, agentClient.connUDP.(*reconnectingUDPConn).logger) } assert.NoError(t, agentClient.Close()) @@ -93,7 +92,7 @@ func TestNewAgentClientUDPWithParamsReconnectingDisabled(t *testing.T) { agentClient, err := newAgentClientUDP(agentClientUDPParams{ Host: host, Port: port, - Logger: nil, + Logger: emptyLogger, AttemptReconnecting: false, }) assert.NoError(t, err) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 0ee4a1cb2bc..c1d38fabe1f 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -3,6 +3,8 @@ module go.opentelemetry.io/otel/exporters/jaeger go 1.18 require ( + github.com/go-logr/logr v1.2.3 + github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.2 @@ -12,8 +14,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect diff --git a/exporters/jaeger/reconnecting_udp_client.go b/exporters/jaeger/reconnecting_udp_client.go index fa2c68ead42..88055c8a300 100644 --- a/exporters/jaeger/reconnecting_udp_client.go +++ b/exporters/jaeger/reconnecting_udp_client.go @@ -16,11 +16,12 @@ package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" import ( "fmt" - "log" "net" "sync" "sync/atomic" "time" + + "github.com/go-logr/logr" ) // reconnectingUDPConn is an implementation of udpConn that resolves hostPort every resolveTimeout, if the resolved address is @@ -32,7 +33,7 @@ type reconnectingUDPConn struct { hostPort string resolveFunc resolveFunc dialFunc dialFunc - logger *log.Logger + logger logr.Logger connMtx sync.RWMutex conn *net.UDPConn @@ -45,7 +46,7 @@ type dialFunc func(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, err // newReconnectingUDPConn returns a new udpConn that resolves hostPort every resolveTimeout, if the resolved address is // different than the current conn then the new address is dialed and the conn is swapped. -func newReconnectingUDPConn(hostPort string, bufferBytes int, resolveTimeout time.Duration, resolveFunc resolveFunc, dialFunc dialFunc, logger *log.Logger) (*reconnectingUDPConn, error) { +func newReconnectingUDPConn(hostPort string, bufferBytes int, resolveTimeout time.Duration, resolveFunc resolveFunc, dialFunc dialFunc, logger logr.Logger) (*reconnectingUDPConn, error) { conn := &reconnectingUDPConn{ hostPort: hostPort, resolveFunc: resolveFunc, @@ -65,8 +66,8 @@ func newReconnectingUDPConn(hostPort string, bufferBytes int, resolveTimeout tim } func (c *reconnectingUDPConn) logf(format string, args ...interface{}) { - if c.logger != nil { - c.logger.Printf(format, args...) + if c.logger != emptyLogger { + c.logger.Info(format, args...) } } diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go index 43bfe512493..958f6400baf 100644 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ b/exporters/jaeger/reconnecting_udp_client_test.go @@ -88,7 +88,7 @@ func assertConnWritable(t *testing.T, conn udpConn, serverConn net.PacketConn) { _, err := conn.Write([]byte(expectedString)) require.NoError(t, err) - var buf = make([]byte, len(expectedString)) + buf := make([]byte, len(expectedString)) err = serverConn.SetReadDeadline(time.Now().Add(time.Second)) require.NoError(t, err) @@ -145,7 +145,7 @@ func waitForConnCondition(conn *reconnectingUDPConn, condition func(conn *reconn } func newMockUDPAddr(t *testing.T, port int) *net.UDPAddr { - var buf = make([]byte, 4) + buf := make([]byte, 4) // random is not seeded to ensure tests are deterministic (also doesnt matter if ip is valid) _, err := rand.Read(buf) require.NoError(t, err) @@ -177,7 +177,7 @@ func TestNewResolvedUDPConn(t *testing.T) { Return(clientConn, nil). Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -212,7 +212,7 @@ func TestResolvedUDPConnWrites(t *testing.T) { Return(clientConn, nil). Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -249,7 +249,7 @@ func TestResolvedUDPConnEventuallyDials(t *testing.T) { On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). Return(clientConn, nil).Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -300,7 +300,7 @@ func TestResolvedUDPConnNoSwapIfFail(t *testing.T) { On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). Return(clientConn, nil).Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -341,7 +341,7 @@ func TestResolvedUDPConnWriteRetry(t *testing.T) { On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). Return(clientConn, nil).Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -371,7 +371,7 @@ func TestResolvedUDPConnWriteRetryFails(t *testing.T) { dialer := mockDialer{} - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -428,7 +428,7 @@ func TestResolvedUDPConnChanges(t *testing.T) { On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr2). Return(clientConn2, nil).Once() - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) @@ -481,7 +481,7 @@ func TestResolvedUDPConnLoopWithoutChanges(t *testing.T) { Once() resolveTimeout := 500 * time.Millisecond - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, resolveTimeout, resolver.ResolveUDPAddr, dialer.DialUDP, nil) + conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, resolveTimeout, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) assert.NoError(t, err) require.NotNil(t, conn) assert.Equal(t, mockUDPAddr, conn.destAddr) diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go index 1bdb4de4f92..f65e3a6782a 100644 --- a/exporters/jaeger/uploader.go +++ b/exporters/jaeger/uploader.go @@ -23,6 +23,9 @@ import ( "net/http" "time" + "github.com/go-logr/logr" + "github.com/go-logr/stdr" + gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" ) @@ -112,8 +115,17 @@ func WithAgentPort(port string) AgentEndpointOption { }) } +var emptyLogger = logr.Logger{} + // WithLogger sets a logger to be used by agent client. +// WithLogger and WithLogr will overwrite each other. func WithLogger(logger *log.Logger) AgentEndpointOption { + return WithLogr(stdr.New(logger)) +} + +// WithLogr sets a logr.Logger to be used by agent client. +// WithLogr and WithLogger will overwrite each other. +func WithLogr(logger logr.Logger) AgentEndpointOption { return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { o.Logger = logger return o diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index b68d7ff3f1e..3cc8e8aa89c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,6 +3,8 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.18 require ( + github.com/go-logr/logr v1.2.3 + github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.1 @@ -13,8 +15,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 93b027a1557..b21a0190c2d 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -25,6 +25,9 @@ import ( "net/url" "sync" + "github.com/go-logr/logr" + "github.com/go-logr/stdr" + sdktrace "go.opentelemetry.io/otel/sdk/trace" ) @@ -36,20 +39,20 @@ const ( type Exporter struct { url string client *http.Client - logger *log.Logger + logger logr.Logger stoppedMu sync.RWMutex stopped bool } -var ( - _ sdktrace.SpanExporter = &Exporter{} -) +var _ sdktrace.SpanExporter = &Exporter{} + +var emptyLogger = logr.Logger{} // Options contains configuration for the exporter. type config struct { client *http.Client - logger *log.Logger + logger logr.Logger } // Option defines a function that configures the exporter. @@ -64,7 +67,14 @@ func (fn optionFunc) apply(cfg config) config { } // WithLogger configures the exporter to use the passed logger. +// WithLogger and WithLogr will overwrite each other. func WithLogger(logger *log.Logger) Option { + return WithLogr(stdr.New(logger)) +} + +// WithLogr configures the exporter to use the passed logr.Logger. +// WithLogr and WithLogger will overwrite each other. +func WithLogr(logger logr.Logger) Option { return optionFunc(func(cfg config) config { cfg.logger = logger return cfg @@ -170,8 +180,8 @@ func (e *Exporter) Shutdown(ctx context.Context) error { } func (e *Exporter) logf(format string, args ...interface{}) { - if e.logger != nil { - e.logger.Printf(format, args...) + if e.logger != emptyLogger { + e.logger.Info(format, args) } } From 14a17b3ad6d0608e5aff3797807bd135474426c3 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 15 Dec 2022 10:50:45 -0500 Subject: [PATCH 342/886] Add Metric Producer as a new interface, which returns scope metrics (#3524) * add RegisterProducer method and metric.Producer interface * rename testProducer to testSDKProducer * rename testMetrics to testResourceMetrics * add testExternalProducer for testing bridges * add test data for testing external producers * clean up help text * unit tests for external Producer * changelog * improve test coverage * Update CHANGELOG.md Co-authored-by: Tyler Yahn * support partial errors * fix lint * add additional test * unallocate producers on shutdown * don't register Producers after shutdown Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 + sdk/metric/config.go | 21 ++-- sdk/metric/config_test.go | 16 +-- sdk/metric/manual_reader.go | 60 +++++++++--- sdk/metric/periodic_reader.go | 55 +++++++++-- sdk/metric/periodic_reader_test.go | 20 ++-- sdk/metric/reader.go | 19 +++- sdk/metric/reader_test.go | 152 ++++++++++++++++++++++------- 8 files changed, 267 insertions(+), 80 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb2b592746..9f0e0943382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) +### Added + +- Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) + ## [1.11.2/0.34.0] 2022-12-05 ### Added diff --git a/sdk/metric/config.go b/sdk/metric/config.go index c78b0416415..c837df8b76f 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -54,14 +54,19 @@ func unify(funcs []func(context.Context) error) func(context.Context) error { errs = append(errs, err) } } - switch len(errs) { - case 0: - return nil - case 1: - return errs[0] - default: - return fmt.Errorf("%v", errs) - } + return unifyErrors(errs) + } +} + +// unifyErrors combines multiple errors into a single error. +func unifyErrors(errs []error) error { + switch len(errs) { + case 0: + return nil + case 1: + return errs[0] + default: + return fmt.Errorf("%v", errs) } } diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index a924d879d00..dc5eff2eee2 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -28,12 +28,13 @@ import ( ) type reader struct { - producer producer - temporalityFunc TemporalitySelector - aggregationFunc AggregationSelector - collectFunc func(context.Context) (metricdata.ResourceMetrics, error) - forceFlushFunc func(context.Context) error - shutdownFunc func(context.Context) error + producer sdkProducer + externalProducers []Producer + temporalityFunc TemporalitySelector + aggregationFunc AggregationSelector + collectFunc func(context.Context) (metricdata.ResourceMetrics, error) + forceFlushFunc func(context.Context) error + shutdownFunc func(context.Context) error } var _ Reader = (*reader)(nil) @@ -42,7 +43,8 @@ func (r *reader) aggregation(kind InstrumentKind) aggregation.Aggregation { // n return r.aggregationFunc(kind) } -func (r *reader) register(p producer) { r.producer = p } +func (r *reader) register(p sdkProducer) { r.producer = p } +func (r *reader) RegisterProducer(p Producer) { r.externalProducers = append(r.externalProducers, p) } func (r *reader) temporality(kind InstrumentKind) metricdata.Temporality { return r.temporalityFunc(kind) } diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 0ebfadf33a3..48a8b291e77 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -28,9 +28,13 @@ import ( // manualReader is a simple Reader that allows an application to // read metrics on demand. type manualReader struct { - producer atomic.Value + sdkProducer atomic.Value shutdownOnce sync.Once + mu sync.Mutex + isShutdown bool + externalProducers atomic.Value + temporalitySelector TemporalitySelector aggregationSelector AggregationSelector } @@ -41,22 +45,39 @@ var _ = map[Reader]struct{}{&manualReader{}: {}} // NewManualReader returns a Reader which is directly called to collect metrics. func NewManualReader(opts ...ManualReaderOption) Reader { cfg := newManualReaderConfig(opts) - return &manualReader{ + r := &manualReader{ temporalitySelector: cfg.temporalitySelector, aggregationSelector: cfg.aggregationSelector, } + r.externalProducers.Store([]Producer{}) + return r } -// register stores the Producer which enables the caller to read -// metrics on demand. -func (mr *manualReader) register(p producer) { +// register stores the sdkProducer which enables the caller +// to read metrics from the SDK on demand. +func (mr *manualReader) register(p sdkProducer) { // Only register once. If producer is already set, do nothing. - if !mr.producer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { + if !mr.sdkProducer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { msg := "did not register manual reader" global.Error(errDuplicateRegister, msg) } } +// RegisterProducer stores the external Producer which enables the caller +// to read metrics on demand. +func (mr *manualReader) RegisterProducer(p Producer) { + mr.mu.Lock() + defer mr.mu.Unlock() + if mr.isShutdown { + return + } + currentProducers := mr.externalProducers.Load().([]Producer) + newProducers := []Producer{} + newProducers = append(newProducers, currentProducers...) + newProducers = append(newProducers, p) + mr.externalProducers.Store(newProducers) +} + // temporality reports the Temporality for the instrument kind provided. func (mr *manualReader) temporality(kind InstrumentKind) metricdata.Temporality { return mr.temporalitySelector(kind) @@ -77,18 +98,23 @@ func (mr *manualReader) Shutdown(context.Context) error { err := ErrReaderShutdown mr.shutdownOnce.Do(func() { // Any future call to Collect will now return ErrReaderShutdown. - mr.producer.Store(produceHolder{ + mr.sdkProducer.Store(produceHolder{ produce: shutdownProducer{}.produce, }) + mr.mu.Lock() + defer mr.mu.Unlock() + mr.isShutdown = true + // release references to Producer(s) + mr.externalProducers.Store([]Producer{}) err = nil }) return err } -// Collect gathers all metrics from the SDK, calling any callbacks necessary. -// Collect will return an error if called after shutdown. +// Collect gathers all metrics from the SDK and other Producers, calling any +// callbacks necessary. Collect will return an error if called after shutdown. func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { - p := mr.producer.Load() + p := mr.sdkProducer.Load() if p == nil { return metricdata.ResourceMetrics{}, ErrReaderNotRegistered } @@ -103,7 +129,19 @@ func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics return metricdata.ResourceMetrics{}, err } - return ph.produce(ctx) + rm, err := ph.produce(ctx) + if err != nil { + return metricdata.ResourceMetrics{}, err + } + var errs []error + for _, producer := range mr.externalProducers.Load().([]Producer) { + externalMetrics, err := producer.Produce(ctx) + if err != nil { + errs = append(errs, err) + } + rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) + } + return rm, unifyErrors(errs) } // manualReaderConfig contains configuration options for a ManualReader. diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 00ba1305595..8425e42e16a 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -114,6 +114,7 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade cancel: cancel, done: make(chan struct{}), } + r.externalProducers.Store([]Producer{}) go func() { defer func() { close(r.done) }() @@ -126,7 +127,11 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade // periodicReader is a Reader that continuously collects and exports metric // data at a set interval. type periodicReader struct { - producer atomic.Value + sdkProducer atomic.Value + + mu sync.Mutex + isShutdown bool + externalProducers atomic.Value timeout time.Duration exporter Exporter @@ -166,14 +171,28 @@ func (r *periodicReader) run(ctx context.Context, interval time.Duration) { } // register registers p as the producer of this reader. -func (r *periodicReader) register(p producer) { +func (r *periodicReader) register(p sdkProducer) { // Only register once. If producer is already set, do nothing. - if !r.producer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { + if !r.sdkProducer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { msg := "did not register periodic reader" global.Error(errDuplicateRegister, msg) } } +// RegisterProducer registers p as an external Producer of this reader. +func (r *periodicReader) RegisterProducer(p Producer) { + r.mu.Lock() + defer r.mu.Unlock() + if r.isShutdown { + return + } + currentProducers := r.externalProducers.Load().([]Producer) + newProducers := []Producer{} + newProducers = append(newProducers, currentProducers...) + newProducers = append(newProducers, p) + r.externalProducers.Store(newProducers) +} + // temporality reports the Temporality for the instrument kind provided. func (r *periodicReader) temporality(kind InstrumentKind) metricdata.Temporality { return r.exporter.Temporality(kind) @@ -195,12 +214,13 @@ func (r *periodicReader) collectAndExport(ctx context.Context) error { } // Collect gathers and returns all metric data related to the Reader from -// the SDK. The returned metric data is not exported to the configured -// exporter, it is left to the caller to handle that if desired. +// the SDK and other Producers. The returned metric data is not exported +// to the configured exporter, it is left to the caller to handle that if +// desired. // // An error is returned if this is called after Shutdown. func (r *periodicReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { - return r.collect(ctx, r.producer.Load()) + return r.collect(ctx, r.sdkProducer.Load()) } // collect unwraps p as a produceHolder and returns its produce results. @@ -218,7 +238,20 @@ func (r *periodicReader) collect(ctx context.Context, p interface{}) (metricdata err := fmt.Errorf("periodic reader: invalid producer: %T", p) return metricdata.ResourceMetrics{}, err } - return ph.produce(ctx) + + rm, err := ph.produce(ctx) + if err != nil { + return metricdata.ResourceMetrics{}, err + } + var errs []error + for _, producer := range r.externalProducers.Load().([]Producer) { + externalMetrics, err := producer.Produce(ctx) + if err != nil { + errs = append(errs, err) + } + rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) + } + return rm, unifyErrors(errs) } // export exports metric data m using r's exporter. @@ -259,7 +292,7 @@ func (r *periodicReader) Shutdown(ctx context.Context) error { <-r.done // Any future call to Collect will now return ErrReaderShutdown. - ph := r.producer.Swap(produceHolder{ + ph := r.sdkProducer.Swap(produceHolder{ produce: shutdownProducer{}.produce, }) @@ -276,6 +309,12 @@ func (r *periodicReader) Shutdown(ctx context.Context) error { if err == nil || err == ErrReaderShutdown { err = sErr } + + r.mu.Lock() + defer r.mu.Unlock() + r.isShutdown = true + // release references to Producer(s) + r.externalProducers.Store([]Producer{}) }) return err } diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index d48c1a7de8e..138aae48944 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -114,7 +114,8 @@ func (ts *periodicReaderTestSuite) SetupTest() { } ts.ErrReader = NewPeriodicReader(e) - ts.ErrReader.register(testProducer{}) + ts.ErrReader.register(testSDKProducer{}) + ts.ErrReader.RegisterProducer(testExternalProducer{}) } func (ts *periodicReaderTestSuite) TearDownTest() { @@ -186,14 +187,15 @@ func TestPeriodicReaderRun(t *testing.T) { exp := &fnExporter{ exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { - // The testProducer produces testMetrics. - assert.Equal(t, testMetrics, m) + // The testSDKProducer produces testResourceMetricsAB. + assert.Equal(t, testResourceMetricsAB, m) return assert.AnError }, } r := NewPeriodicReader(exp) - r.register(testProducer{}) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{}) trigger <- time.Now() assert.Equal(t, assert.AnError, <-eh.Err) @@ -210,8 +212,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { called = new(bool) return &fnExporter{ exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { - // The testProducer produces testMetrics. - assert.Equal(t, testMetrics, m) + // The testSDKProducer produces testResourceMetricsA. + assert.Equal(t, testResourceMetricsAB, m) *called = true return assert.AnError }, @@ -221,7 +223,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("ForceFlush", func(t *testing.T) { exp, called := expFunc(t) r := NewPeriodicReader(exp) - r.register(testProducer{}) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{}) assert.Equal(t, assert.AnError, r.ForceFlush(context.Background()), "export error not returned") assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") @@ -232,7 +235,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("Shutdown", func(t *testing.T) { exp, called := expFunc(t) r := NewPeriodicReader(exp) - r.register(testProducer{}) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{}) assert.Equal(t, assert.AnError, r.Shutdown(context.Background()), "export error not returned") assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") }) diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index aa9d50ef666..c52cc58dff2 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -51,7 +51,12 @@ type Reader interface { // register registers a Reader with a MeterProvider. // The producer argument allows the Reader to signal the sdk to collect // and send aggregated metric measurements. - register(producer) + register(sdkProducer) + + // RegisterProducer registers a an external Producer with this Reader. + // The Producer is used as a source of aggregated metric data which is + // incorporated into metrics collected from the SDK. + RegisterProducer(Producer) // temporality reports the Temporality for the instrument kind provided. temporality(InstrumentKind) metricdata.Temporality @@ -84,14 +89,22 @@ type Reader interface { Shutdown(context.Context) error } -// producer produces metrics for a Reader. -type producer interface { +// sdkProducer produces metrics for a Reader. +type sdkProducer interface { // produce returns aggregated metrics from a single collection. // // This method is safe to call concurrently. produce(context.Context) (metricdata.ResourceMetrics, error) } +// Producer produces metrics for a Reader from an external source. +type Producer interface { + // Produce returns aggregated metrics from an external source. + // + // This method should be safe to call concurrently. + Produce(context.Context) ([]metricdata.ScopeMetrics, error) +} + // produceHolder is used as an atomic.Value to wrap the non-concrete producer // type. type produceHolder struct { diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 28b249bd3e2..191ab39945b 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -57,16 +57,25 @@ func (ts *readerTestSuite) TestErrorForNotRegistered() { ts.ErrorIs(err, ErrReaderNotRegistered) } -func (ts *readerTestSuite) TestProducer() { - ts.Reader.register(testProducer{}) +func (ts *readerTestSuite) TestSDKProducer() { + ts.Reader.register(testSDKProducer{}) m, err := ts.Reader.Collect(context.Background()) ts.NoError(err) - ts.Equal(testMetrics, m) + ts.Equal(testResourceMetricsA, m) +} + +func (ts *readerTestSuite) TestExternalProducer() { + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) + m, err := ts.Reader.Collect(context.Background()) + ts.NoError(err) + ts.Equal(testResourceMetricsAB, m) } func (ts *readerTestSuite) TestCollectAfterShutdown() { ctx := context.Background() - ts.Reader.register(testProducer{}) + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.Shutdown(ctx)) m, err := ts.Reader.Collect(ctx) @@ -76,27 +85,29 @@ func (ts *readerTestSuite) TestCollectAfterShutdown() { func (ts *readerTestSuite) TestShutdownTwice() { ctx := context.Background() - ts.Reader.register(testProducer{}) + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.Shutdown(ctx)) ts.ErrorIs(ts.Reader.Shutdown(ctx), ErrReaderShutdown) } func (ts *readerTestSuite) TestMultipleForceFlush() { ctx := context.Background() - ts.Reader.register(testProducer{}) + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.ForceFlush(ctx)) ts.NoError(ts.Reader.ForceFlush(ctx)) } func (ts *readerTestSuite) TestMultipleRegister() { - p0 := testProducer{ + p0 := testSDKProducer{ produceFunc: func(ctx context.Context) (metricdata.ResourceMetrics, error) { // Differentiate this producer from the second by returning an // error. - return testMetrics, assert.AnError + return testResourceMetricsA, assert.AnError }, } - p1 := testProducer{} + p1 := testSDKProducer{} ts.Reader.register(p0) // This should be ignored. @@ -106,11 +117,46 @@ func (ts *readerTestSuite) TestMultipleRegister() { ts.Equal(assert.AnError, err) } +func (ts *readerTestSuite) TestExternalProducerPartialSuccess() { + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer( + testExternalProducer{ + produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { + return []metricdata.ScopeMetrics{}, assert.AnError + }, + }, + ) + ts.Reader.RegisterProducer( + testExternalProducer{ + produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { + return []metricdata.ScopeMetrics{testScopeMetricsB}, nil + }, + }, + ) + + m, err := ts.Reader.Collect(context.Background()) + ts.Equal(assert.AnError, err) + ts.Equal(testResourceMetricsAB, m) +} + +func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { + ts.Reader.register(testSDKProducer{ + produceFunc: func(ctx context.Context) (metricdata.ResourceMetrics, error) { + return metricdata.ResourceMetrics{}, assert.AnError + }}) + ts.Reader.RegisterProducer(testExternalProducer{}) + + m, err := ts.Reader.Collect(context.Background()) + ts.Equal(assert.AnError, err) + ts.Equal(metricdata.ResourceMetrics{}, m) +} + func (ts *readerTestSuite) TestMethodConcurrency() { // Requires the race-detector (a default test option for the project). // All reader methods should be concurrent-safe. - ts.Reader.register(testProducer{}) + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) ctx := context.Background() var wg sync.WaitGroup @@ -141,49 +187,85 @@ func (ts *readerTestSuite) TestShutdownBeforeRegister() { ctx := context.Background() ts.Require().NoError(ts.Reader.Shutdown(ctx)) // Registering after shutdown should not revert the shutdown. - ts.Reader.register(testProducer{}) + ts.Reader.register(testSDKProducer{}) + ts.Reader.RegisterProducer(testExternalProducer{}) m, err := ts.Reader.Collect(ctx) ts.ErrorIs(err, ErrReaderShutdown) ts.Equal(metricdata.ResourceMetrics{}, m) } -var testMetrics = metricdata.ResourceMetrics{ - Resource: resource.NewSchemaless(attribute.String("test", "Reader")), - ScopeMetrics: []metricdata.ScopeMetrics{{ - Scope: instrumentation.Scope{Name: "sdk/metric/test/reader"}, - Metrics: []metricdata.Metrics{{ - Name: "fake data", - Description: "Data used to test a reader", - Unit: unit.Dimensionless, - Data: metricdata.Sum[int64]{ - Temporality: metricdata.CumulativeTemporality, - IsMonotonic: true, - DataPoints: []metricdata.DataPoint[int64]{{ - Attributes: attribute.NewSet(attribute.String("user", "alice")), - StartTime: time.Now(), - Time: time.Now().Add(time.Second), - Value: -1, - }}, - }, - }}, +var testScopeMetricsA = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "sdk/metric/test/reader"}, + Metrics: []metricdata.Metrics{{ + Name: "fake data", + Description: "Data used to test a reader", + Unit: unit.Dimensionless, + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{ + Attributes: attribute.NewSet(attribute.String("user", "alice")), + StartTime: time.Now(), + Time: time.Now().Add(time.Second), + Value: -1, + }}, + }, + }}, +} + +var testScopeMetricsB = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "sdk/metric/test/reader/external"}, + Metrics: []metricdata.Metrics{{ + Name: "fake scope data", + Description: "Data used to test a Producer reader", + Unit: unit.Milliseconds, + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{{ + Attributes: attribute.NewSet(attribute.String("user", "ben")), + StartTime: time.Now(), + Time: time.Now().Add(time.Second), + Value: 10, + }}, + }, }}, } -type testProducer struct { +var testResourceMetricsA = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("test", "Reader")), + ScopeMetrics: []metricdata.ScopeMetrics{testScopeMetricsA}, +} + +var testResourceMetricsAB = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("test", "Reader")), + ScopeMetrics: []metricdata.ScopeMetrics{testScopeMetricsA, testScopeMetricsB}, +} + +type testSDKProducer struct { produceFunc func(context.Context) (metricdata.ResourceMetrics, error) } -func (p testProducer) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { +func (p testSDKProducer) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { + if p.produceFunc != nil { + return p.produceFunc(ctx) + } + return testResourceMetricsA, nil +} + +type testExternalProducer struct { + produceFunc func(context.Context) ([]metricdata.ScopeMetrics, error) +} + +func (p testExternalProducer) Produce(ctx context.Context) ([]metricdata.ScopeMetrics, error) { if p.produceFunc != nil { return p.produceFunc(ctx) } - return testMetrics, nil + return []metricdata.ScopeMetrics{testScopeMetricsB}, nil } func benchReaderCollectFunc(r Reader) func(*testing.B) { ctx := context.Background() - r.register(testProducer{}) + r.register(testSDKProducer{}) // Store bechmark results in a closure to prevent the compiler from // inlining and skipping the function. @@ -198,7 +280,7 @@ func benchReaderCollectFunc(r Reader) func(*testing.B) { for n := 0; n < b.N; n++ { collectedMetrics, err = r.Collect(ctx) - assert.Equalf(b, testMetrics, collectedMetrics, "unexpected Collect response: (%#v, %v)", collectedMetrics, err) + assert.Equalf(b, testResourceMetricsA, collectedMetrics, "unexpected Collect response: (%#v, %v)", collectedMetrics, err) } } } From 7a60bc785d669fa6ad26ba70e88151d4df631d90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 12:49:55 -0800 Subject: [PATCH 343/886] Bump golang.org/x/tools from 0.3.0 to 0.4.0 in /internal/tools (#3535) Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.3.0 to 0.4.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.3.0...v0.4.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 4 ++-- internal/tools/go.sum | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index d9ae24949e3..441ab33e3dc 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.3.0 go.opentelemetry.io/build-tools/multimod v0.3.0 go.opentelemetry.io/build-tools/semconvgen v0.3.0 - golang.org/x/tools v0.3.0 + golang.org/x/tools v0.4.0 ) require ( @@ -188,7 +188,7 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.2.0 // indirect + golang.org/x/net v0.3.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4c2f1b835ed..4db947ba629 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -730,8 +730,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -822,7 +822,7 @@ golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= +golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -917,8 +917,8 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From ca4cdfe4c0de07ac63889f8eb38f44e3cdc50a7b Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Fri, 16 Dec 2022 11:38:01 -0800 Subject: [PATCH 344/886] small contingency improvement in global error handler (#3543) Signed-off-by: Bogdan Drutu Signed-off-by: Bogdan Drutu --- CHANGELOG.md | 4 ++++ handler.go | 25 ++++++++++++------------- handler_test.go | 6 +++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0e0943382..40dc1d752ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) +### Changed + +- Global error handler uses an atomic value instead of a mutex. (#3543) + ## [1.11.2/0.34.0] 2022-12-05 ### Added diff --git a/handler.go b/handler.go index 36cf09f7290..ecd363ab516 100644 --- a/handler.go +++ b/handler.go @@ -17,7 +17,8 @@ package otel // import "go.opentelemetry.io/otel" import ( "log" "os" - "sync" + "sync/atomic" + "unsafe" ) var ( @@ -34,28 +35,26 @@ var ( ) type delegator struct { - lock *sync.RWMutex - eh ErrorHandler + delegate unsafe.Pointer } func (d *delegator) Handle(err error) { - d.lock.RLock() - defer d.lock.RUnlock() - d.eh.Handle(err) + d.getDelegate().Handle(err) +} + +func (d *delegator) getDelegate() ErrorHandler { + return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate)) } // setDelegate sets the ErrorHandler delegate. func (d *delegator) setDelegate(eh ErrorHandler) { - d.lock.Lock() - defer d.lock.Unlock() - d.eh = eh + atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh)) } func defaultErrorHandler() *delegator { - return &delegator{ - lock: &sync.RWMutex{}, - eh: &errLogger{l: log.New(os.Stderr, "", log.LstdFlags)}, - } + d := &delegator{} + d.setDelegate(&errLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) + return d } // errLogger logs errors if no delegate is set, otherwise they are delegated. diff --git a/handler_test.go b/handler_test.go index 32906198f8c..b6b9b20cae0 100644 --- a/handler_test.go +++ b/handler_test.go @@ -54,7 +54,7 @@ type HandlerTestSuite struct { func (s *HandlerTestSuite) SetupSuite() { s.errCatcher = new(testErrCatcher) - s.origHandler = globalErrorHandler.eh + s.origHandler = globalErrorHandler.getDelegate() globalErrorHandler.setDelegate(&errLogger{l: log.New(s.errCatcher, "", 0)}) } @@ -111,12 +111,12 @@ func (s *HandlerTestSuite) TestAllowMultipleSets() { secondary := &errLogger{l: log.New(notUsed, "", 0)} SetErrorHandler(secondary) s.Require().Same(GetErrorHandler(), globalErrorHandler, "set changed globalErrorHandler") - s.Require().Same(globalErrorHandler.eh, secondary, "new Handler not set") + s.Require().Same(globalErrorHandler.getDelegate(), secondary, "new Handler not set") tertiary := &errLogger{l: log.New(notUsed, "", 0)} SetErrorHandler(tertiary) s.Require().Same(GetErrorHandler(), globalErrorHandler, "set changed globalErrorHandler") - s.Assert().Same(globalErrorHandler.eh, tertiary, "user Handler not overridden") + s.Assert().Same(globalErrorHandler.getDelegate(), tertiary, "user Handler not overridden") } func TestHandlerTestSuite(t *testing.T) { From 4014204d42d55084fd90b6cb859dcde14f00231f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 16 Dec 2022 12:02:42 -0800 Subject: [PATCH 345/886] Allow multi-instrument callbacks to be unregistered (#3522) * Update Meter RegisterCallback method Return a Registration from the method that can be used by the caller to unregister their callback. Update documentation of the method to better explain expectations of use and implementation. * Update noop impl * Update global impl * Test global Unregister concurrent safe * Use a map to track reg in global impl * Update sdk impl * Use a list for global impl * Fix prom example * Lint metric/meter.go * Fix metric example * Placeholder for changelog * Update PR number in changelog * Update sdk/metric/pipeline.go Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> * Add test unregistered callback is not called Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 10 +- example/prometheus/main.go | 2 +- metric/example_test.go | 4 +- metric/internal/global/meter.go | 63 +++++++-- metric/internal/global/meter_test.go | 84 +++++++++++- metric/internal/global/meter_types_test.go | 21 ++- metric/meter.go | 28 +++- metric/noop.go | 8 +- sdk/metric/meter.go | 15 ++- sdk/metric/meter_test.go | 142 ++++++++++++++++++--- sdk/metric/pipeline.go | 39 ++++-- 11 files changed, 350 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40dc1d752ab..ed5100716f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] -### Removed - -- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) - ### Added +- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. + This `Registration` can be used to unregister callbacks. (#3522) - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) + ### Changed - Global error handler uses an atomic value instead of a mutex. (#3543) diff --git a/example/prometheus/main.go b/example/prometheus/main.go index bc15f041486..39015994517 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -68,7 +68,7 @@ func main() { if err != nil { log.Fatal(err) } - err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { n := -10. + rand.Float64()*(90.) // [-10, 100) gauge.Observe(ctx, n, attrs...) }) diff --git a/metric/example_test.go b/metric/example_test.go index bc94d7572ef..dc22989f627 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -61,7 +61,7 @@ func ExampleMeter_asynchronous_single() { panic(err) } - err = meter.RegisterCallback([]instrument.Asynchronous{memoryUsage}, + _, err = meter.RegisterCallback([]instrument.Asynchronous{memoryUsage}, func(ctx context.Context) { // instrument.WithCallbackFunc(func(ctx context.Context) { //Do Work to get the real memoryUsage @@ -86,7 +86,7 @@ func ExampleMeter_asynchronous_multiple() { gcCount, _ := meter.AsyncInt64().Counter("gcCount") gcPause, _ := meter.SyncFloat64().Histogram("gcPause") - err := meter.RegisterCallback([]instrument.Asynchronous{ + _, err := meter.RegisterCallback([]instrument.Asynchronous{ heapAlloc, gcCount, }, diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 0fa924f397c..e8c83578459 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -15,6 +15,7 @@ package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( + "container/list" "context" "sync" "sync/atomic" @@ -109,7 +110,8 @@ type meter struct { mtx sync.Mutex instruments []delegatedInstrument - callbacks []delegatedCallback + + registry list.List delegate atomic.Value // metric.Meter } @@ -135,12 +137,14 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { inst.setDelegate(meter) } - for _, callback := range m.callbacks { - callback.setDelegate(meter) + for e := m.registry.Front(); e != nil; e = e.Next() { + r := e.Value.(*registration) + r.setDelegate(meter) + m.registry.Remove(e) } m.instruments = nil - m.callbacks = nil + m.registry.Init() } // AsyncInt64 is the namespace for the Asynchronous Integer instruments. @@ -167,20 +171,24 @@ func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) - return del.RegisterCallback(insts, function) + return del.RegisterCallback(insts, f) } m.mtx.Lock() defer m.mtx.Unlock() - m.callbacks = append(m.callbacks, delegatedCallback{ - instruments: insts, - function: function, - }) - return nil + reg := ®istration{instruments: insts, function: f} + e := m.registry.PushBack(reg) + reg.unreg = func() error { + m.mtx.Lock() + _ = m.registry.Remove(e) + m.mtx.Unlock() + return nil + } + return reg, nil } type wrapped interface { @@ -217,17 +225,44 @@ func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { return (*sfInstProvider)(m) } -type delegatedCallback struct { +type registration struct { instruments []instrument.Asynchronous function func(context.Context) + + unreg func() error + unregMu sync.Mutex } -func (c *delegatedCallback) setDelegate(m metric.Meter) { +func (c *registration) setDelegate(m metric.Meter) { insts := unwrapInstruments(c.instruments) - err := m.RegisterCallback(insts, c.function) + + c.unregMu.Lock() + defer c.unregMu.Unlock() + + if c.unreg == nil { + // Unregister already called. + return + } + + reg, err := m.RegisterCallback(insts, c.function) if err != nil { otel.Handle(err) } + + c.unreg = reg.Unregister +} + +func (c *registration) Unregister() error { + c.unregMu.Lock() + defer c.unregMu.Unlock() + if c.unreg == nil { + // Unregister already called. + return nil + } + + var err error + err, c.unreg = c.unreg(), nil + return err } type afInstProvider meter diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 8865f06d57b..15a0bf877af 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -68,7 +68,7 @@ func TestMeterRace(t *testing.T) { _, _ = mtr.SyncInt64().Counter(name) _, _ = mtr.SyncInt64().UpDownCounter(name) _, _ = mtr.SyncInt64().Histogram(name) - _ = mtr.RegisterCallback(nil, func(ctx context.Context) {}) + _, _ = mtr.RegisterCallback(nil, func(ctx context.Context) {}) if !once { wg.Done() once = true @@ -86,6 +86,35 @@ func TestMeterRace(t *testing.T) { close(finish) } +func TestUnregisterRace(t *testing.T) { + mtr := &meter{} + reg, err := mtr.RegisterCallback(nil, func(ctx context.Context) {}) + require.NoError(t, err) + + wg := &sync.WaitGroup{} + wg.Add(1) + finish := make(chan struct{}) + go func() { + for i, once := 0, false; ; i++ { + _ = reg.Unregister() + if !once { + wg.Done() + once = true + } + select { + case <-finish: + return + default: + } + } + }() + _ = reg.Unregister() + + wg.Wait() + mtr.setDelegate(metric.NewNoopMeterProvider()) + close(finish) +} + func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Counter, asyncfloat64.Counter) { afcounter, err := m.AsyncFloat64().Counter("test_Async_Counter") require.NoError(t, err) @@ -101,9 +130,10 @@ func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Coun _, err = m.AsyncInt64().Gauge("test_Async_Gauge") assert.NoError(t, err) - require.NoError(t, m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) { afcounter.Observe(ctx, 3) - })) + }) + require.NoError(t, err) sfcounter, err := m.SyncFloat64().Counter("test_Async_Counter") require.NoError(t, err) @@ -257,3 +287,51 @@ func TestMeterDefersDelegations(t *testing.T) { assert.IsType(t, &afCounter{}, actr) assert.Equal(t, 1, mp.count) } + +func TestRegistrationDelegation(t *testing.T) { + // globalMeterProvider := otel.GetMeterProvider + globalMeterProvider := &meterProvider{} + + m := globalMeterProvider.Meter("go.opentelemetry.io/otel/metric/internal/global/meter_test") + require.IsType(t, &meter{}, m) + mImpl := m.(*meter) + + actr, err := m.AsyncFloat64().Counter("test_Async_Counter") + require.NoError(t, err) + + var called0 bool + reg0, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) { + called0 = true + }) + require.NoError(t, err) + require.Equal(t, 1, mImpl.registry.Len(), "callback not registered") + // This means reg0 should not be delegated. + assert.NoError(t, reg0.Unregister()) + assert.Equal(t, 0, mImpl.registry.Len(), "callback not unregistered") + + var called1 bool + reg1, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) { + called1 = true + }) + require.NoError(t, err) + require.Equal(t, 1, mImpl.registry.Len(), "second callback not registered") + + mp := &testMeterProvider{} + + // otel.SetMeterProvider(mp) + globalMeterProvider.setDelegate(mp) + + testCollect(t, m) // This is a hacky way to emulate a read from an exporter + require.False(t, called0, "pre-delegation unregistered callback called") + require.True(t, called1, "callback not called") + + called1 = false + assert.NoError(t, reg1.Unregister(), "unregister second callback") + + testCollect(t, m) // This is a hacky way to emulate a read from an exporter + assert.False(t, called1, "unregistered callback called") + + assert.NotPanics(t, func() { + assert.NoError(t, reg1.Unregister(), "duplicate unregister calls") + }) +} diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index ac6e93ebe38..53dfbc7528d 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -64,8 +64,21 @@ func (m *testMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *testMeter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error { - m.callbacks = append(m.callbacks, function) +func (m *testMeter) RegisterCallback(i []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { + m.callbacks = append(m.callbacks, f) + return testReg{ + f: func(idx int) func() { + return func() { m.callbacks[idx] = nil } + }(len(m.callbacks) - 1), + }, nil +} + +type testReg struct { + f func() +} + +func (r testReg) Unregister() error { + r.f() return nil } @@ -85,6 +98,10 @@ func (m *testMeter) SyncFloat64() syncfloat64.InstrumentProvider { func (m *testMeter) collect() { ctx := context.Background() for _, f := range m.callbacks { + if f == nil { + // Unregister. + continue + } f(ctx) } } diff --git a/metric/meter.go b/metric/meter.go index 23e6853afbb..3a505264ca0 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -51,14 +51,30 @@ type Meter interface { // To Observe data with instruments it must be registered in a callback. AsyncFloat64() asyncfloat64.InstrumentProvider - // RegisterCallback captures the function that will be called during Collect. - // - // It is only valid to call Observe within the scope of the passed function, - // and only on the instruments that were registered with this call. - RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error - // SyncInt64 is the namespace for the Synchronous Integer instruments SyncInt64() syncint64.InstrumentProvider // SyncFloat64 is the namespace for the Synchronous Float instruments SyncFloat64() syncfloat64.InstrumentProvider + + // RegisterCallback registers f to be called during the collection of a + // measurement cycle. + // + // If Unregister of the returned Registration is called, f needs to be + // unregistered and not called during collection. + // + // The instruments f is registered with are the only instruments that f may + // observe values for. + // + // If no instruments are passed, f should not be registered nor called + // during collection. + RegisterCallback(instruments []instrument.Asynchronous, f func(context.Context)) (Registration, error) +} + +// Registration is an token representing the unique registration of a callback +// for a set of instruments with a Meter. +type Registration interface { + // Unregister removes the callback registration from a Meter. + // + // This method needs to be idempotent and concurrent safe. + Unregister() error } diff --git a/metric/noop.go b/metric/noop.go index e8b9a9a1458..7454a790337 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -64,10 +64,14 @@ func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { } // RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error { - return nil +func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) (Registration, error) { + return noopReg{}, nil } +type noopReg struct{} + +func (noopReg) Unregister() error { return nil } + type nonrecordingAsyncFloat64Instrument struct { instrument.Asynchronous } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 418827e9672..c2c515af35c 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -69,7 +69,7 @@ func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) error { +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { for _, inst := range insts { // Only register if at least one instrument has a non-drop aggregation. // Otherwise, calling f during collection will be wasted computation. @@ -91,14 +91,21 @@ func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context } } // All insts use drop aggregation. - return nil + return noopRegister{}, nil } -func (m *meter) registerCallback(f func(context.Context)) error { - m.pipes.registerCallback(f) +type noopRegister struct{} + +func (noopRegister) Unregister() error { return nil } +type callback func(context.Context) + +func (m *meter) registerCallback(c callback) (metric.Registration, error) { + return m.pipes.registerCallback(c), nil +} + // SyncInt64 returns the synchronous integer instrument provider. func (m *meter) SyncInt64() syncint64.InstrumentProvider { return syncInt64Provider{m.instProviderInt64} diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 013a52e5924..d904b118ad4 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -103,11 +103,63 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { m := NewMeterProvider().Meter("callback-concurrency") go func() { - _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + _, _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) wg.Done() }() go func() { - _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + _, _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + wg.Done() + }() + wg.Wait() +} + +func TestNoopCallbackUnregisterConcurrency(t *testing.T) { + m := NewMeterProvider().Meter("noop-unregister-concurrency") + reg, err := m.RegisterCallback(nil, func(ctx context.Context) {}) + require.NoError(t, err) + + wg := &sync.WaitGroup{} + wg.Add(2) + go func() { + _ = reg.Unregister() + wg.Done() + }() + go func() { + _ = reg.Unregister() + wg.Done() + }() + wg.Wait() +} + +func TestCallbackUnregisterConcurrency(t *testing.T) { + reader := NewManualReader() + provider := NewMeterProvider(WithReader(reader)) + meter := provider.Meter("unregister-concurrency") + + actr, err := meter.AsyncFloat64().Counter("counter") + require.NoError(t, err) + + ag, err := meter.AsyncInt64().Gauge("gauge") + require.NoError(t, err) + + i := []instrument.Asynchronous{actr} + regCtr, err := meter.RegisterCallback(i, func(ctx context.Context) {}) + require.NoError(t, err) + + i = []instrument.Asynchronous{ag} + regG, err := meter.RegisterCallback(i, func(ctx context.Context) {}) + require.NoError(t, err) + + wg := &sync.WaitGroup{} + wg.Add(2) + go func() { + _ = regCtr.Unregister() + _ = regG.Unregister() + wg.Done() + }() + go func() { + _ = regCtr.Unregister() + _ = regG.Unregister() wg.Done() }() wg.Wait() @@ -126,7 +178,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { ctr, err := m.AsyncInt64().Counter("aint") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) }) assert.NoError(t, err) @@ -150,7 +202,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { ctr, err := m.AsyncInt64().UpDownCounter("aint") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) }) assert.NoError(t, err) @@ -174,7 +226,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { gauge, err := m.AsyncInt64().Gauge("agauge") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) }) assert.NoError(t, err) @@ -196,7 +248,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { ctr, err := m.AsyncFloat64().Counter("afloat") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) }) assert.NoError(t, err) @@ -220,7 +272,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { ctr, err := m.AsyncFloat64().UpDownCounter("afloat") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) }) assert.NoError(t, err) @@ -244,7 +296,7 @@ func TestMeterCreatesInstruments(t *testing.T) { fn: func(t *testing.T, m metric.Meter) { gauge, err := m.AsyncFloat64().Gauge("agauge") assert.NoError(t, err) - err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) }) assert.NoError(t, err) @@ -418,7 +470,7 @@ func TestMetersProvideScope(t *testing.T) { m1 := mp.Meter("scope1") ctr1, err := m1.AsyncFloat64().Counter("ctr1") assert.NoError(t, err) - err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) { + _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) { ctr1.Observe(ctx, 5) }) assert.NoError(t, err) @@ -426,7 +478,7 @@ func TestMetersProvideScope(t *testing.T) { m2 := mp.Meter("scope2") ctr2, err := m2.AsyncInt64().Counter("ctr2") assert.NoError(t, err) - err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) { + _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) { ctr2.Observe(ctx, 7) }) assert.NoError(t, err) @@ -480,6 +532,53 @@ func TestMetersProvideScope(t *testing.T) { metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) } +func TestUnregisterUnregisters(t *testing.T) { + r := NewManualReader() + mp := NewMeterProvider(WithReader(r)) + m := mp.Meter("TestUnregisterUnregisters") + + int64Counter, err := m.AsyncInt64().Counter("int64.counter") + require.NoError(t, err) + + int64UpDownCounter, err := m.AsyncInt64().UpDownCounter("int64.up_down_counter") + require.NoError(t, err) + + int64Gauge, err := m.AsyncInt64().Gauge("int64.gauge") + require.NoError(t, err) + + floag64Counter, err := m.AsyncFloat64().Counter("floag64.counter") + require.NoError(t, err) + + floag64UpDownCounter, err := m.AsyncFloat64().UpDownCounter("floag64.up_down_counter") + require.NoError(t, err) + + floag64Gauge, err := m.AsyncFloat64().Gauge("floag64.gauge") + require.NoError(t, err) + + var called bool + reg, err := m.RegisterCallback([]instrument.Asynchronous{ + int64Counter, + int64UpDownCounter, + int64Gauge, + floag64Counter, + floag64UpDownCounter, + floag64Gauge, + }, func(context.Context) { called = true }) + require.NoError(t, err) + + ctx := context.Background() + _, err = r.Collect(ctx) + require.NoError(t, err) + assert.True(t, called, "callback not called for registered callback") + + called = false + require.NoError(t, reg.Unregister(), "unregister") + + _, err = r.Collect(ctx) + require.NoError(t, err) + assert.False(t, called, "callback called for unregistered callback") +} + func TestRegisterCallbackDropAggregations(t *testing.T) { aggFn := func(InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} @@ -507,14 +606,15 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { require.NoError(t, err) var called bool - require.NoError(t, m.RegisterCallback([]instrument.Asynchronous{ + _, err = m.RegisterCallback([]instrument.Asynchronous{ int64Counter, int64UpDownCounter, int64Gauge, floag64Counter, floag64UpDownCounter, floag64Gauge, - }, func(context.Context) { called = true })) + }, func(context.Context) { called = true }) + require.NoError(t, err) data, err := r.Collect(context.Background()) require.NoError(t, err) @@ -538,10 +638,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "afcounter", @@ -564,10 +665,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "afupdowncounter", @@ -590,10 +692,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "afgauge", @@ -614,10 +717,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "aicounter", @@ -640,10 +744,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "aiupdowncounter", @@ -666,10 +771,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - return mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) }) + return err }, wantMetric: metricdata.Metrics{ Name: "aigauge", diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index bc6901e5775..f9938bf617f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -15,6 +15,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "container/list" "context" "errors" "fmt" @@ -22,6 +23,7 @@ import ( "sync" "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -75,7 +77,7 @@ type pipeline struct { sync.Mutex aggregations map[instrumentation.Scope][]instrumentSync - callbacks []func(context.Context) + callbacks list.List } // addSync adds the instrumentSync to pipeline p with scope. This method is not @@ -94,10 +96,15 @@ func (p *pipeline) addSync(scope instrumentation.Scope, iSync instrumentSync) { } // addCallback registers a callback to be run when `produce()` is called. -func (p *pipeline) addCallback(callback func(context.Context)) { +func (p *pipeline) addCallback(c callback) (unregister func()) { p.Lock() defer p.Unlock() - p.callbacks = append(p.callbacks, callback) + e := p.callbacks.PushBack(c) + return func() { + p.Lock() + p.callbacks.Remove(e) + p.Unlock() + } } // callbackKey is a context key type used to identify context that came from the SDK. @@ -112,14 +119,15 @@ const produceKey callbackKey = 0 // // This method is safe to call concurrently. func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { + ctx = context.WithValue(ctx, produceKey, struct{}{}) + p.Lock() defer p.Unlock() - ctx = context.WithValue(ctx, produceKey, struct{}{}) - - for _, callback := range p.callbacks { + for e := p.callbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) - callback(ctx) + f := e.Value.(callback) + f(ctx) if err := ctx.Err(); err != nil { // This means the context expired before we finished running callbacks. return metricdata.ResourceMetrics{}, err @@ -439,10 +447,21 @@ func newPipelines(res *resource.Resource, readers []Reader, views []View) pipeli return pipes } -func (p pipelines) registerCallback(fn func(context.Context)) { - for _, pipe := range p { - pipe.addCallback(fn) +func (p pipelines) registerCallback(c callback) metric.Registration { + unregs := make([]func(), len(p)) + for i, pipe := range p { + unregs[i] = pipe.addCallback(c) + } + return unregisterFuncs(unregs) +} + +type unregisterFuncs []func() + +func (u unregisterFuncs) Unregister() error { + for _, f := range u { + f() } + return nil } // resolver facilitates resolving Aggregators an instrument needs to aggregate From 0617172787699be1d778bad0bc5baa49ad9a2b58 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 19 Dec 2022 07:56:52 -0800 Subject: [PATCH 346/886] Global logger uses an atomic value instead of a mutex. (#3545) Signed-off-by: Bogdan Drutu Signed-off-by: Bogdan Drutu --- CHANGELOG.md | 1 + internal/global/internal_logging.go | 30 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed5100716f0..7369ef331de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Global error handler uses an atomic value instead of a mutex. (#3543) +- Global logger uses an atomic value instead of a mutex. (#3545) ## [1.11.2/0.34.0] 2022-12-05 diff --git a/internal/global/internal_logging.go b/internal/global/internal_logging.go index ccb3258711a..293c08961fb 100644 --- a/internal/global/internal_logging.go +++ b/internal/global/internal_logging.go @@ -17,7 +17,8 @@ package global // import "go.opentelemetry.io/otel/internal/global" import ( "log" "os" - "sync" + "sync/atomic" + "unsafe" "github.com/go-logr/logr" "github.com/go-logr/stdr" @@ -27,37 +28,36 @@ import ( // // The default logger uses stdr which is backed by the standard `log.Logger` // interface. This logger will only show messages at the Error Level. -var globalLogger logr.Logger = stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)) -var globalLoggerLock = &sync.RWMutex{} +var globalLogger unsafe.Pointer + +func init() { + SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) +} // SetLogger overrides the globalLogger with l. // // To see Info messages use a logger with `l.V(1).Enabled() == true` // To see Debug messages use a logger with `l.V(5).Enabled() == true`. func SetLogger(l logr.Logger) { - globalLoggerLock.Lock() - defer globalLoggerLock.Unlock() - globalLogger = l + atomic.StorePointer(&globalLogger, unsafe.Pointer(&l)) +} + +func getLogger() logr.Logger { + return *(*logr.Logger)(atomic.LoadPointer(&globalLogger)) } // Info prints messages about the general state of the API or SDK. // This should usually be less then 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.V(1).Info(msg, keysAndValues...) + getLogger().V(1).Info(msg, keysAndValues...) } // Error prints messages about exceptional states of the API or SDK. func Error(err error, msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.Error(err, msg, keysAndValues...) + getLogger().Error(err, msg, keysAndValues...) } // Debug prints messages about all internal changes in the API or SDK. func Debug(msg string, keysAndValues ...interface{}) { - globalLoggerLock.RLock() - defer globalLoggerLock.RUnlock() - globalLogger.V(5).Info(msg, keysAndValues...) + getLogger().V(5).Info(msg, keysAndValues...) } From a724cf884287e04785eaa91513d26a6ef9699288 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 19 Dec 2022 11:05:46 -0500 Subject: [PATCH 347/886] Update OpenCensus metric bridge to use the metric.Producer interface (#3541) * update OpenCensus metric bridge to use the metric.Producer interface * return nil for empty metrics * fix nits Co-authored-by: Tyler Yahn --- CHANGELOG.md | 6 ++ bridge/opencensus/metric.go | 32 ++++++++ bridge/opencensus/metric_test.go | 129 +++++++++++++++++++++++++++++++ example/opencensus/main.go | 22 ++---- 4 files changed, 173 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7369ef331de..9f310bc2655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,8 +21,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Global error handler uses an atomic value instead of a mutex. (#3543) +- Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) +- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) - Global logger uses an atomic value instead of a mutex. (#3545) +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. Use `NewMetricProducer` instead. (#3541) + ## [1.11.2/0.34.0] 2022-12-05 ### Added diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index df22c874ab8..040dbdfeb8d 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -22,6 +22,7 @@ import ( ocmetricdata "go.opencensus.io/metric/metricdata" "go.opencensus.io/metric/metricexport" + "go.opencensus.io/metric/metricproducer" "go.opentelemetry.io/otel" internal "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" @@ -33,6 +34,36 @@ import ( const scopeName = "go.opentelemetry.io/otel/bridge/opencensus" +type producer struct { + manager *metricproducer.Manager +} + +// NewMetricProducer returns a metric.Producer that fetches metrics from +// OpenCensus. +func NewMetricProducer() metric.Producer { + return &producer{ + manager: metricproducer.GlobalManager(), + } +} + +func (p *producer) Produce(context.Context) ([]metricdata.ScopeMetrics, error) { + producers := p.manager.GetAll() + data := []*ocmetricdata.Metric{} + for _, ocProducer := range producers { + data = append(data, ocProducer.Read()...) + } + otelmetrics, err := internal.ConvertMetrics(data) + if len(otelmetrics) == 0 { + return nil, err + } + return []metricdata.ScopeMetrics{{ + Scope: instrumentation.Scope{ + Name: scopeName, + }, + Metrics: otelmetrics, + }}, err +} + // exporter implements the OpenCensus metric Exporter interface using an // OpenTelemetry base exporter. type exporter struct { @@ -42,6 +73,7 @@ type exporter struct { // NewMetricExporter returns an OpenCensus exporter that exports to an // OpenTelemetry (push) exporter. +// Deprecated: Use NewMetricProducer instead. func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { return &exporter{base: base, res: res} } diff --git a/bridge/opencensus/metric_test.go b/bridge/opencensus/metric_test.go index 57350668362..ed348901f4e 100644 --- a/bridge/opencensus/metric_test.go +++ b/bridge/opencensus/metric_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" ocmetricdata "go.opencensus.io/metric/metricdata" + "go.opencensus.io/metric/metricproducer" ocresource "go.opencensus.io/resource" "go.opentelemetry.io/otel/attribute" @@ -32,6 +33,134 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) +func TestMetricProducer(t *testing.T) { + now := time.Now() + for _, tc := range []struct { + desc string + input []*ocmetricdata.Metric + expected []metricdata.ScopeMetrics + expectErr bool + }{ + { + desc: "empty", + expected: nil, + }, + { + desc: "success", + input: []*ocmetricdata.Metric{ + { + Resource: &ocresource.Resource{ + Labels: map[string]string{ + "R1": "V1", + "R2": "V2", + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + StartTime: now, + Points: []ocmetricdata.Point{ + {Value: int64(123), Time: now}, + }, + }, + }, + }, + }, + expected: []metricdata.ScopeMetrics{{ + Scope: instrumentation.Scope{ + Name: scopeName, + }, + Metrics: []metricdata.Metrics{ + { + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(), + StartTime: now, + Time: now, + Value: 123, + }, + }, + }, + }, + }, + }}, + }, + { + desc: "partial success", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeGaugeDistribution, + }, + }, + { + Resource: &ocresource.Resource{ + Labels: map[string]string{ + "R1": "V1", + "R2": "V2", + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + StartTime: now, + Points: []ocmetricdata.Point{ + {Value: int64(123), Time: now}, + }, + }, + }, + }, + }, + expected: []metricdata.ScopeMetrics{{ + Scope: instrumentation.Scope{ + Name: scopeName, + }, + Metrics: []metricdata.Metrics{ + { + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(), + StartTime: now, + Time: now, + Value: 123, + }, + }, + }, + }, + }, + }}, + expectErr: true, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + fakeProducer := &fakeOCProducer{metrics: tc.input} + metricproducer.GlobalManager().AddProducer(fakeProducer) + defer metricproducer.GlobalManager().DeleteProducer(fakeProducer) + output, err := NewMetricProducer().Produce(context.Background()) + if tc.expectErr { + require.Error(t, err) + } else { + require.Nil(t, err) + } + require.Equal(t, len(output), len(tc.expected)) + for i := range output { + metricdatatest.AssertEqual(t, tc.expected[i], output[i]) + } + }) + } +} + +type fakeOCProducer struct { + metrics []*ocmetricdata.Metric +} + +func (f *fakeOCProducer) Read() []*ocmetricdata.Metric { + return f.metrics +} + func TestPushMetricsExporter(t *testing.T) { now := time.Now() for _, tc := range []struct { diff --git a/example/opencensus/main.go b/example/opencensus/main.go index c35c47cac09..8afbd9e5b9b 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -22,7 +22,6 @@ import ( ocmetric "go.opencensus.io/metric" "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricexport" "go.opencensus.io/metric/metricproducer" "go.opencensus.io/stats" "go.opencensus.io/stats/view" @@ -34,7 +33,6 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" ) @@ -103,20 +101,12 @@ func tracing(otExporter sdktrace.SpanExporter) { // monitoring demonstrates creating an IntervalReader using the OpenTelemetry // exporter to send metrics to the exporter by using either an OpenCensus // registry or an OpenCensus view. -func monitoring(otExporter metric.Exporter) error { - log.Println("Using the OpenTelemetry stdoutmetric exporter to export OpenCensus metrics. This allows routing telemetry from both OpenTelemetry and OpenCensus to a single exporter.") - ocExporter := opencensus.NewMetricExporter(otExporter, resource.Default()) - intervalReader, err := metricexport.NewIntervalReader(&metricexport.Reader{}, ocExporter) - if err != nil { - return fmt.Errorf("failed to create interval reader: %w", err) - } - intervalReader.ReportingInterval = 10 * time.Second - log.Println("Emitting metrics using OpenCensus APIs. These should be printed out using the OpenTelemetry stdoutmetric exporter.") - err = intervalReader.Start() - if err != nil { - return fmt.Errorf("failed to start interval reader: %w", err) - } - defer intervalReader.Stop() +func monitoring(exporter metric.Exporter) error { + log.Println("Adding the OpenCensus metric Producer to an OpenTelemetry Reader to export OpenCensus metrics using the OpenTelemetry stdout exporter.") + reader := metric.NewPeriodicReader(exporter) + // Register the OpenCensus metric Producer to add metrics from OpenCensus to the output. + reader.RegisterProducer(opencensus.NewMetricProducer()) + metric.NewMeterProvider(metric.WithReader(reader)) log.Println("Registering a gauge metric using an OpenCensus registry.") r := ocmetric.NewRegistry() From 69e44a337b82f2ee8b3cb4987393506a4d8121c8 Mon Sep 17 00:00:00 2001 From: darkfeline Date: Sat, 24 Dec 2022 18:16:11 +0000 Subject: [PATCH 348/886] Fix ParentBased comment formatting (#3553) godoc doesn't have an unordered list syntax --- sdk/trace/sampling.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index a6dcf4b307c..ae63c7b6a66 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -163,10 +163,10 @@ func NeverSample() Sampler { // the root(Sampler) is used to make sampling decision. If the span has // a parent, depending on whether the parent is remote and whether it // is sampled, one of the following samplers will apply: -// - remoteParentSampled(Sampler) (default: AlwaysOn) -// - remoteParentNotSampled(Sampler) (default: AlwaysOff) -// - localParentSampled(Sampler) (default: AlwaysOn) -// - localParentNotSampled(Sampler) (default: AlwaysOff) +// - remoteParentSampled(Sampler) (default: AlwaysOn) +// - remoteParentNotSampled(Sampler) (default: AlwaysOff) +// - localParentSampled(Sampler) (default: AlwaysOn) +// - localParentNotSampled(Sampler) (default: AlwaysOff) func ParentBased(root Sampler, samplers ...ParentBasedSamplerOption) Sampler { return parentBased{ root: root, From 9d633d2ed510726d8919b4f36aba56f412b0f991 Mon Sep 17 00:00:00 2001 From: Daniel Metz Date: Fri, 30 Dec 2022 11:06:06 -0800 Subject: [PATCH 349/886] traceIDRatioSampler: use rightmost bits (#3557) * use bottom bits * add changelog entry Co-authored-by: Chester Cheung --- CHANGELOG.md | 3 +++ sdk/trace/sampling.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f310bc2655..ff6d25fbe11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) - Global logger uses an atomic value instead of a mutex. (#3545) +- `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, + fixing random sampling when using ID generators like `xray.IDGenerator` + and increasing parity with other language implementations. (#3557) ### Deprecated diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index ae63c7b6a66..8102cb91eca 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -81,7 +81,7 @@ type traceIDRatioSampler struct { func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult { psc := trace.SpanContextFromContext(p.ParentContext) - x := binary.BigEndian.Uint64(p.TraceID[0:8]) >> 1 + x := binary.BigEndian.Uint64(p.TraceID[8:16]) >> 1 if x < ts.traceIDUpperBound { return SamplingResult{ Decision: RecordAndSample, From ad4d54e0f1a42330c00015fd3a64e24353e8879e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 3 Jan 2023 08:15:07 -0800 Subject: [PATCH 350/886] Warn metric Exporters of ResourceMetrics reuse (#3556) To potentially optimize the collection code path (#3047) ResourceMetrics sent to the Exporter may be reused in the future. Warn users of this. Co-authored-by: Chester Cheung --- sdk/metric/exporter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index d899b925aa9..572662a3fcf 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -45,6 +45,10 @@ type Exporter interface { // implement any retry logic. All errors returned by this function are // considered unrecoverable and will be reported to a configured error // Handler. + // + // The passed ResourceMetrics may be reused when the call completes. If an + // exporter needs to hold this data after it returns, it needs to make a + // copy. Export(context.Context, metricdata.ResourceMetrics) error // ForceFlush flushes any metric data held by an exporter. From c82dbddc3107393287c829677c6ef8dfaf737af5 Mon Sep 17 00:00:00 2001 From: Ziqi Zhao Date: Wed, 4 Jan 2023 01:51:56 +0800 Subject: [PATCH 351/886] TracerProvider shutdown release resources (#3551) * TracerProvider shutdown release resources Signed-off-by: Ziqi Zhao * add changelog Signed-off-by: Ziqi Zhao * Update CHANGELOG.md Co-authored-by: David Ashpole * prevent registered span processors after shutdown Signed-off-by: Ziqi Zhao * Update CHANGELOG.md Signed-off-by: Ziqi Zhao Co-authored-by: David Ashpole Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/provider.go | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff6d25fbe11..e444b1fa17e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) - Global logger uses an atomic value instead of a mutex. (#3545) +- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) - `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, fixing random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 327b8b41638..201c1781700 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -76,6 +76,7 @@ type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Scope]*tracer spanProcessors atomic.Value + isShutdown bool // These fields are not protected by the lock mu. They are assumed to be // immutable after creation of the TracerProvider. @@ -163,6 +164,9 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { p.mu.Lock() defer p.mu.Unlock() + if p.isShutdown { + return + } newSPS := spanProcessorStates{} newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...) newSPS = append(newSPS, newSpanProcessorState(sp)) @@ -173,6 +177,9 @@ func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { p.mu.Lock() defer p.mu.Unlock() + if p.isShutdown { + return + } old := p.spanProcessors.Load().(spanProcessorStates) if len(old) == 0 { return @@ -227,13 +234,18 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error { return nil } -// Shutdown shuts down the span processors in the order they were registered. +// Shutdown shuts down TracerProvider. All registered span processors are shut down +// in the order they were registered and any held computational resources are released. func (p *TracerProvider) Shutdown(ctx context.Context) error { spss := p.spanProcessors.Load().(spanProcessorStates) if len(spss) == 0 { return nil } + p.mu.Lock() + defer p.mu.Unlock() + p.isShutdown = true + var retErr error for _, sps := range spss { select { @@ -255,6 +267,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { } } } + p.spanProcessors.Store(spanProcessorStates{}) return retErr } From aac35a80c46c2991701cdca88fbb7a794acaf85a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 10:12:43 -0800 Subject: [PATCH 352/886] Bump github.com/itchyny/gojq from 0.12.10 to 0.12.11 in /internal/tools (#3558) Bumps [github.com/itchyny/gojq](https://github.com/itchyny/gojq) from 0.12.10 to 0.12.11. - [Release notes](https://github.com/itchyny/gojq/releases) - [Changelog](https://github.com/itchyny/gojq/blob/main/CHANGELOG.md) - [Commits](https://github.com/itchyny/gojq/compare/v0.12.10...v0.12.11) --- updated-dependencies: - dependency-name: github.com/itchyny/gojq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 441ab33e3dc..f64b4124992 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.50.1 - github.com/itchyny/gojq v0.12.10 + github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.3.0 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4db947ba629..2f193d5885b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -321,8 +321,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itchyny/gojq v0.12.10 h1:6TcS0VYWS6wgntpF/4tnrzwdCMjiTxRAxIqZWfDsDQU= -github.com/itchyny/gojq v0.12.10/go.mod h1:o3FT8Gkbg/geT4pLI0tF3hvip5F3Y/uskjRz9OYa38g= +github.com/itchyny/gojq v0.12.11 h1:YhLueoHhHiN4mkfM+3AyJV6EPcCxKZsOnYf+aVSwaQw= +github.com/itchyny/gojq v0.12.11/go.mod h1:o3FT8Gkbg/geT4pLI0tF3hvip5F3Y/uskjRz9OYa38g= github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= From a54167d2c9a46852730b65e50e071426e85c6acb Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 3 Jan 2023 10:34:10 -0800 Subject: [PATCH 353/886] Remove metric instrument provider API (#3530) * Remove all InstrumentProvider APIs * Fix noop impl * Fix metric/example_test.go * Update global impl * Update sdk/metric impl * Fix examples * Fix prometheus exporter * Add changes to changelog Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 28 +- example/prometheus/main.go | 6 +- example/view/main.go | 4 +- exporters/prometheus/benchmark_test.go | 2 +- exporters/prometheus/exporter_test.go | 86 +++--- metric/example_test.go | 10 +- .../instrument/asyncfloat64/asyncfloat64.go | 14 - metric/instrument/asyncint64/asyncint64.go | 14 - metric/instrument/syncfloat64/syncfloat64.go | 12 - metric/instrument/syncint64/syncint64.go | 12 - metric/internal/global/instruments.go | 24 +- metric/internal/global/meter.go | 268 ++++++++---------- metric/internal/global/meter_test.go | 98 ++++--- metric/internal/global/meter_types_test.go | 163 +++++------ metric/meter.go | 65 ++++- metric/noop.go | 80 ++++-- metric/noop_test.go | 24 +- sdk/metric/benchmark_test.go | 2 +- sdk/metric/instrument_provider.go | 132 --------- .../internal/aggregator_example_test.go | 50 ++-- sdk/metric/meter.go | 112 +++++++- sdk/metric/meter_test.go | 128 ++++----- 22 files changed, 645 insertions(+), 689 deletions(-) delete mode 100644 sdk/metric/instrument_provider.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e444b1fa17e..ac597c1092a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,28 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This `Registration` can be used to unregister callbacks. (#3522) - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) -### Removed - -- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) - ### Changed +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64Counter` + - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Int64Histogram` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64Counter` + - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Float64Histogram` - Global error handler uses an atomic value instead of a mutex. (#3543) - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) @@ -33,6 +49,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. Use `NewMetricProducer` instead. (#3541) +### Removed + +- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) + ## [1.11.2/0.34.0] 2022-12-05 ### Added diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 39015994517..6bc9563d77e 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -58,13 +58,13 @@ func main() { } // This is the equivalent of prometheus.NewCounterVec - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } counter.Add(ctx, 5, attrs...) - gauge, err := meter.AsyncFloat64().Gauge("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.Float64ObservableGauge("bar", instrument.WithDescription("a fun little gauge")) if err != nil { log.Fatal(err) } @@ -77,7 +77,7 @@ func main() { } // This is the equivalent of prometheus.NewHistogramVec - histogram, err := meter.SyncFloat64().Histogram("baz", instrument.WithDescription("a very nice histogram")) + histogram, err := meter.Float64Histogram("baz", instrument.WithDescription("a very nice histogram")) if err != nil { log.Fatal(err) } diff --git a/example/view/main.go b/example/view/main.go index cdced744a30..b609e48737d 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -69,13 +69,13 @@ func main() { attribute.Key("C").String("D"), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } counter.Add(ctx, 5, attrs...) - histogram, err := meter.SyncFloat64().Histogram("custom_histogram", instrument.WithDescription("a histogram with custom buckets and rename")) + histogram, err := meter.Float64Histogram("custom_histogram", instrument.WithDescription("a histogram with custom buckets and rename")) if err != nil { log.Fatal(err) } diff --git a/exporters/prometheus/benchmark_test.go b/exporters/prometheus/benchmark_test.go index 6c6d67cae76..1d7139b5cc7 100644 --- a/exporters/prometheus/benchmark_test.go +++ b/exporters/prometheus/benchmark_test.go @@ -34,7 +34,7 @@ func benchmarkCollect(b *testing.B, n int) { meter := provider.Meter("testmeter") for i := 0; i < n; i++ { - counter, err := meter.SyncFloat64().Counter(fmt.Sprintf("foo_%d", i)) + counter, err := meter.Float64Counter(fmt.Sprintf("foo_%d", i)) require.NoError(b, err) counter.Add(ctx, float64(i)) } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 88027fe7fc4..be1cceb6c42 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -53,7 +53,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), } - counter, err := meter.SyncFloat64().Counter( + counter, err := meter.Float64Counter( "foo", instrument.WithDescription("a simple counter"), instrument.WithUnit(unit.Milliseconds), @@ -80,7 +80,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - gauge, err := meter.SyncFloat64().UpDownCounter( + gauge, err := meter.Float64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), instrument.WithUnit(unit.Dimensionless), @@ -98,7 +98,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - histogram, err := meter.SyncFloat64().Histogram( + histogram, err := meter.Float64Histogram( "histogram_baz", instrument.WithDescription("a very nice histogram"), instrument.WithUnit(unit.Bytes), @@ -124,7 +124,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("C.D").String("Y"), attribute.Key("C/D").String("Z"), } - counter, err := meter.SyncFloat64().Counter( + counter, err := meter.Float64Counter( "foo", instrument.WithDescription("a sanitary counter"), // This unit is not added to @@ -145,21 +145,21 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("C").String("D"), } // Valid. - gauge, err := meter.SyncFloat64().UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.Float64UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) require.NoError(t, err) gauge.Add(ctx, 100, attrs...) gauge.Add(ctx, -25, attrs...) // Invalid, will be renamed. - gauge, err = meter.SyncFloat64().UpDownCounter("invalid.gauge.name", instrument.WithDescription("a gauge with an invalid name")) + gauge, err = meter.Float64UpDownCounter("invalid.gauge.name", instrument.WithDescription("a gauge with an invalid name")) require.NoError(t, err) gauge.Add(ctx, 100, attrs...) - counter, err := meter.SyncFloat64().Counter("0invalid.counter.name", instrument.WithDescription("a counter with an invalid name")) + counter, err := meter.Float64Counter("0invalid.counter.name", instrument.WithDescription("a counter with an invalid name")) require.NoError(t, err) counter.Add(ctx, 100, attrs...) - histogram, err := meter.SyncFloat64().Histogram("invalid.hist.name", instrument.WithDescription("a histogram with an invalid name")) + histogram, err := meter.Float64Histogram("invalid.hist.name", instrument.WithDescription("a histogram with an invalid name")) require.NoError(t, err) histogram.Record(ctx, 23, attrs...) }, @@ -175,7 +175,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) @@ -196,7 +196,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) @@ -214,7 +214,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), } - counter, err := meter.SyncFloat64().Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, attrs...) counter.Add(ctx, 10.3, attrs...) @@ -230,7 +230,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - gauge, err := meter.SyncInt64().UpDownCounter( + gauge, err := meter.Int64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), instrument.WithUnit(unit.Dimensionless), @@ -249,7 +249,7 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("A").String("B"), attribute.Key("C").String("D"), } - counter, err := meter.SyncInt64().Counter( + counter, err := meter.Int64Counter( "bar", instrument.WithDescription("a fun little counter"), instrument.WithUnit(unit.Bytes), @@ -364,18 +364,18 @@ func TestMultiScopes(t *testing.T) { ) fooCounter, err := provider.Meter("meterfoo", otelmetric.WithInstrumentationVersion("v0.1.0")). - SyncInt64().Counter( - "foo", - instrument.WithUnit(unit.Milliseconds), - instrument.WithDescription("meter foo counter")) + Int64Counter( + "foo", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter foo counter")) assert.NoError(t, err) fooCounter.Add(ctx, 100, attribute.String("type", "foo")) barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). - SyncInt64().Counter( - "bar", - instrument.WithUnit(unit.Milliseconds), - instrument.WithDescription("meter bar counter")) + Int64Counter( + "bar", + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("meter bar counter")) assert.NoError(t, err) barCounter.Add(ctx, 200, attribute.String("type", "bar")) @@ -398,13 +398,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "no_conflict_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - fooA, err := meterA.SyncInt64().Counter("foo", + fooA, err := meterA.Int64Counter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) - fooB, err := meterB.SyncInt64().Counter("foo", + fooB, err := meterB.Int64Counter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) @@ -415,13 +415,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "no_conflict_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - fooA, err := meterA.SyncInt64().UpDownCounter("foo", + fooA, err := meterA.Int64UpDownCounter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) - fooB, err := meterB.SyncInt64().UpDownCounter("foo", + fooB, err := meterB.Int64UpDownCounter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) @@ -432,13 +432,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "no_conflict_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - fooA, err := meterA.SyncInt64().Histogram("foo", + fooA, err := meterA.Int64Histogram("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) fooA.Record(ctx, 100, attribute.String("A", "B")) - fooB, err := meterB.SyncInt64().Histogram("foo", + fooB, err := meterB.Int64Histogram("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) @@ -449,13 +449,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_help_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - barA, err := meterA.SyncInt64().Counter("bar", + barA, err := meterA.Int64Counter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) - barB, err := meterB.SyncInt64().Counter("bar", + barB, err := meterB.Int64Counter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter b bar")) assert.NoError(t, err) @@ -469,13 +469,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_help_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - barA, err := meterA.SyncInt64().UpDownCounter("bar", + barA, err := meterA.Int64UpDownCounter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) - barB, err := meterB.SyncInt64().UpDownCounter("bar", + barB, err := meterB.Int64UpDownCounter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter b bar")) assert.NoError(t, err) @@ -489,13 +489,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_help_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - barA, err := meterA.SyncInt64().Histogram("bar", + barA, err := meterA.Int64Histogram("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Record(ctx, 100, attribute.String("A", "B")) - barB, err := meterB.SyncInt64().Histogram("bar", + barB, err := meterB.Int64Histogram("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter b bar")) assert.NoError(t, err) @@ -509,13 +509,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_unit_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - bazA, err := meterA.SyncInt64().Counter("bar", + bazA, err := meterA.Int64Counter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter bar")) assert.NoError(t, err) bazA.Add(ctx, 100, attribute.String("type", "bar")) - bazB, err := meterB.SyncInt64().Counter("bar", + bazB, err := meterB.Int64Counter("bar", instrument.WithUnit(unit.Milliseconds), instrument.WithDescription("meter bar")) assert.NoError(t, err) @@ -527,13 +527,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_unit_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - barA, err := meterA.SyncInt64().UpDownCounter("bar", + barA, err := meterA.Int64UpDownCounter("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) - barB, err := meterB.SyncInt64().UpDownCounter("bar", + barB, err := meterB.Int64UpDownCounter("bar", instrument.WithUnit(unit.Milliseconds), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) @@ -545,13 +545,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_unit_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - barA, err := meterA.SyncInt64().Histogram("bar", + barA, err := meterA.Int64Histogram("bar", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) barA.Record(ctx, 100, attribute.String("A", "B")) - barB, err := meterB.SyncInt64().Histogram("bar", + barB, err := meterB.Int64Histogram("bar", instrument.WithUnit(unit.Milliseconds), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) @@ -563,13 +563,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_type_counter_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - counter, err := meterA.SyncInt64().Counter("foo", + counter, err := meterA.Int64Counter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter foo")) assert.NoError(t, err) counter.Add(ctx, 100, attribute.String("type", "foo")) - gauge, err := meterA.SyncInt64().UpDownCounter("foo_total", + gauge, err := meterA.Int64UpDownCounter("foo_total", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter foo")) assert.NoError(t, err) @@ -584,13 +584,13 @@ func TestDuplicateMetrics(t *testing.T) { { name: "conflict_type_histogram_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { - fooA, err := meterA.SyncInt64().UpDownCounter("foo", + fooA, err := meterA.Int64UpDownCounter("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) - fooHistogramA, err := meterA.SyncInt64().Histogram("foo", + fooHistogramA, err := meterA.Int64Histogram("foo", instrument.WithUnit(unit.Bytes), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) diff --git a/metric/example_test.go b/metric/example_test.go index dc22989f627..08741f77d06 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -31,7 +31,7 @@ func ExampleMeter_synchronous() { // In a library or program this would be provided by otel.GetMeterProvider(). meterProvider := metric.NewNoopMeterProvider() - workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").SyncInt64().Histogram( + workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", instrument.WithUnit(unit.Milliseconds)) if err != nil { @@ -52,7 +52,7 @@ func ExampleMeter_asynchronous_single() { meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") - memoryUsage, err := meter.AsyncInt64().Gauge( + memoryUsage, err := meter.Int64ObservableGauge( "MemoryUsage", instrument.WithUnit(unit.Bytes), ) @@ -82,9 +82,9 @@ func ExampleMeter_asynchronous_multiple() { meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats - heapAlloc, _ := meter.AsyncInt64().UpDownCounter("heapAllocs") - gcCount, _ := meter.AsyncInt64().Counter("gcCount") - gcPause, _ := meter.SyncFloat64().Histogram("gcPause") + heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") + gcCount, _ := meter.Int64ObservableCounter("gcCount") + gcPause, _ := meter.Float64Histogram("gcPause") _, err := meter.RegisterCallback([]instrument.Asynchronous{ heapAlloc, diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 330a14c2f64..038e55db0e5 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -21,20 +21,6 @@ import ( "go.opentelemetry.io/otel/metric/instrument" ) -// InstrumentProvider provides access to individual instruments. -// -// Warning: methods may be added to this interface in minor releases. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - - // Gauge creates an instrument for recording the current value. - Gauge(name string, opts ...instrument.Option) (Gauge, error) -} - // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 4fce9963c3b..0d727e08f86 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -21,20 +21,6 @@ import ( "go.opentelemetry.io/otel/metric/instrument" ) -// InstrumentProvider provides access to individual instruments. -// -// Warning: methods may be added to this interface in minor releases. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - - // Gauge creates an instrument for recording the current value. - Gauge(name string, opts ...instrument.Option) (Gauge, error) -} - // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go index 2ec192f70d8..dff6b77b4f9 100644 --- a/metric/instrument/syncfloat64/syncfloat64.go +++ b/metric/instrument/syncfloat64/syncfloat64.go @@ -21,18 +21,6 @@ import ( "go.opentelemetry.io/otel/metric/instrument" ) -// InstrumentProvider provides access to individual instruments. -// -// Warning: methods may be added to this interface in minor releases. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - // Histogram creates an instrument for recording a distribution of values. - Histogram(name string, opts ...instrument.Option) (Histogram, error) -} - // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go index 03b5d53e636..2611c513cff 100644 --- a/metric/instrument/syncint64/syncint64.go +++ b/metric/instrument/syncint64/syncint64.go @@ -21,18 +21,6 @@ import ( "go.opentelemetry.io/otel/metric/instrument" ) -// InstrumentProvider provides access to individual instruments. -// -// Warning: methods may be added to this interface in minor releases. -type InstrumentProvider interface { - // Counter creates an instrument for recording increasing values. - Counter(name string, opts ...instrument.Option) (Counter, error) - // UpDownCounter creates an instrument for recording changes of a value. - UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error) - // Histogram creates an instrument for recording a distribution of values. - Histogram(name string, opts ...instrument.Option) (Histogram, error) -} - // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 7cce2bd15f4..9d28d5884d7 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -38,7 +38,7 @@ type afCounter struct { } func (i *afCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Counter(i.name, i.opts...) + ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -69,7 +69,7 @@ type afUpDownCounter struct { } func (i *afUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().UpDownCounter(i.name, i.opts...) + ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -100,7 +100,7 @@ type afGauge struct { } func (i *afGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncFloat64().Gauge(i.name, i.opts...) + ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -131,7 +131,7 @@ type aiCounter struct { } func (i *aiCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Counter(i.name, i.opts...) + ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -162,7 +162,7 @@ type aiUpDownCounter struct { } func (i *aiUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().UpDownCounter(i.name, i.opts...) + ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -193,7 +193,7 @@ type aiGauge struct { } func (i *aiGauge) setDelegate(m metric.Meter) { - ctr, err := m.AsyncInt64().Gauge(i.name, i.opts...) + ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -225,7 +225,7 @@ type sfCounter struct { } func (i *sfCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().Counter(i.name, i.opts...) + ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -249,7 +249,7 @@ type sfUpDownCounter struct { } func (i *sfUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().UpDownCounter(i.name, i.opts...) + ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -273,7 +273,7 @@ type sfHistogram struct { } func (i *sfHistogram) setDelegate(m metric.Meter) { - ctr, err := m.SyncFloat64().Histogram(i.name, i.opts...) + ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -297,7 +297,7 @@ type siCounter struct { } func (i *siCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Counter(i.name, i.opts...) + ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -321,7 +321,7 @@ type siUpDownCounter struct { } func (i *siUpDownCounter) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().UpDownCounter(i.name, i.opts...) + ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { otel.Handle(err) return @@ -345,7 +345,7 @@ type siHistogram struct { } func (i *siHistogram) setDelegate(m metric.Meter) { - ctr, err := m.SyncInt64().Histogram(i.name, i.opts...) + ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { otel.Handle(err) return diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index e8c83578459..940728cb2ea 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -147,24 +147,136 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { m.registry.Init() } -// AsyncInt64 is the namespace for the Asynchronous Integer instruments. -// -// To Observe data with instruments it must be registered in a callback. -func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { +func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.AsyncInt64() + return del.Int64Counter(name, options...) } - return (*aiInstProvider)(m) + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil } -// AsyncFloat64 is the namespace for the Asynchronous Float instruments. -// -// To Observe data with instruments it must be registered in a callback. -func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &siHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Int64ObservableGauge(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &aiGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Counter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64UpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64Histogram(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &sfHistogram{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + if del, ok := m.delegate.Load().(metric.Meter); ok { + return del.Float64ObservableUpDownCounter(name, options...) + } + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afUpDownCounter{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil +} + +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.AsyncFloat64() + return del.Float64ObservableGauge(name, options...) } - return (*afInstProvider)(m) + m.mtx.Lock() + defer m.mtx.Unlock() + i := &afGauge{name: name, opts: options} + m.instruments = append(m.instruments, i) + return i, nil } // RegisterCallback captures the function that will be called during Collect. @@ -209,22 +321,6 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async return out } -// SyncInt64 is the namespace for the Synchronous Integer instruments. -func (m *meter) SyncInt64() syncint64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.SyncInt64() - } - return (*siInstProvider)(m) -} - -// SyncFloat64 is the namespace for the Synchronous Float instruments. -func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - if del, ok := m.delegate.Load().(metric.Meter); ok { - return del.SyncFloat64() - } - return (*sfInstProvider)(m) -} - type registration struct { instruments []instrument.Asynchronous function func(context.Context) @@ -264,119 +360,3 @@ func (c *registration) Unregister() error { err, c.unreg = c.unreg(), nil return err } - -type afInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *afInstProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *afInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip *afInstProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &afGauge{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type aiInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *aiInstProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *aiInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip *aiInstProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &aiGauge{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type sfInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *sfInstProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *sfInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip *sfInstProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &sfHistogram{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -type siInstProvider meter - -// Counter creates an instrument for recording increasing values. -func (ip *siInstProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip *siInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siUpDownCounter{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip *siInstProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - ip.mtx.Lock() - defer ip.mtx.Unlock() - ctr := &siHistogram{name: name, opts: opts} - ip.instruments = append(ip.instruments, ctr) - return ctr, nil -} diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 15a0bf877af..903ed340a02 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -56,18 +56,18 @@ func TestMeterRace(t *testing.T) { go func() { for i, once := 0, false; ; i++ { name := fmt.Sprintf("a%d", i) - _, _ = mtr.AsyncFloat64().Counter(name) - _, _ = mtr.AsyncFloat64().UpDownCounter(name) - _, _ = mtr.AsyncFloat64().Gauge(name) - _, _ = mtr.AsyncInt64().Counter(name) - _, _ = mtr.AsyncInt64().UpDownCounter(name) - _, _ = mtr.AsyncInt64().Gauge(name) - _, _ = mtr.SyncFloat64().Counter(name) - _, _ = mtr.SyncFloat64().UpDownCounter(name) - _, _ = mtr.SyncFloat64().Histogram(name) - _, _ = mtr.SyncInt64().Counter(name) - _, _ = mtr.SyncInt64().UpDownCounter(name) - _, _ = mtr.SyncInt64().Histogram(name) + _, _ = mtr.Float64ObservableCounter(name) + _, _ = mtr.Float64ObservableUpDownCounter(name) + _, _ = mtr.Float64ObservableGauge(name) + _, _ = mtr.Int64ObservableCounter(name) + _, _ = mtr.Int64ObservableUpDownCounter(name) + _, _ = mtr.Int64ObservableGauge(name) + _, _ = mtr.Float64Counter(name) + _, _ = mtr.Float64UpDownCounter(name) + _, _ = mtr.Float64Histogram(name) + _, _ = mtr.Int64Counter(name) + _, _ = mtr.Int64UpDownCounter(name) + _, _ = mtr.Int64Histogram(name) _, _ = mtr.RegisterCallback(nil, func(ctx context.Context) {}) if !once { wg.Done() @@ -116,18 +116,18 @@ func TestUnregisterRace(t *testing.T) { } func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Counter, asyncfloat64.Counter) { - afcounter, err := m.AsyncFloat64().Counter("test_Async_Counter") + afcounter, err := m.Float64ObservableCounter("test_Async_Counter") require.NoError(t, err) - _, err = m.AsyncFloat64().UpDownCounter("test_Async_UpDownCounter") + _, err = m.Float64ObservableUpDownCounter("test_Async_UpDownCounter") assert.NoError(t, err) - _, err = m.AsyncFloat64().Gauge("test_Async_Gauge") + _, err = m.Float64ObservableGauge("test_Async_Gauge") assert.NoError(t, err) - _, err = m.AsyncInt64().Counter("test_Async_Counter") + _, err = m.Int64ObservableCounter("test_Async_Counter") assert.NoError(t, err) - _, err = m.AsyncInt64().UpDownCounter("test_Async_UpDownCounter") + _, err = m.Int64ObservableUpDownCounter("test_Async_UpDownCounter") assert.NoError(t, err) - _, err = m.AsyncInt64().Gauge("test_Async_Gauge") + _, err = m.Int64ObservableGauge("test_Async_Gauge") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) { @@ -135,18 +135,18 @@ func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Coun }) require.NoError(t, err) - sfcounter, err := m.SyncFloat64().Counter("test_Async_Counter") + sfcounter, err := m.Float64Counter("test_Async_Counter") require.NoError(t, err) - _, err = m.SyncFloat64().UpDownCounter("test_Async_UpDownCounter") + _, err = m.Float64UpDownCounter("test_Async_UpDownCounter") assert.NoError(t, err) - _, err = m.SyncFloat64().Histogram("test_Async_Histogram") + _, err = m.Float64Histogram("test_Async_Histogram") assert.NoError(t, err) - _, err = m.SyncInt64().Counter("test_Async_Counter") + _, err = m.Int64Counter("test_Async_Counter") assert.NoError(t, err) - _, err = m.SyncInt64().UpDownCounter("test_Async_UpDownCounter") + _, err = m.Int64UpDownCounter("test_Async_UpDownCounter") assert.NoError(t, err) - _, err = m.SyncInt64().Histogram("test_Async_Histogram") + _, err = m.Int64Histogram("test_Async_Histogram") assert.NoError(t, err) return sfcounter, afcounter @@ -194,10 +194,18 @@ func TestMeterProviderDelegatesCalls(t *testing.T) { // Calls to Meter() after setDelegate() should be executed by the delegate require.IsType(t, &testMeter{}, meter) tMeter := meter.(*testMeter) - assert.Equal(t, 3, tMeter.afCount) - assert.Equal(t, 3, tMeter.aiCount) - assert.Equal(t, 3, tMeter.sfCount) - assert.Equal(t, 3, tMeter.siCount) + assert.Equal(t, 1, tMeter.afCount) + assert.Equal(t, 1, tMeter.afUDCount) + assert.Equal(t, 1, tMeter.afGauge) + assert.Equal(t, 1, tMeter.aiCount) + assert.Equal(t, 1, tMeter.aiUDCount) + assert.Equal(t, 1, tMeter.aiGauge) + assert.Equal(t, 1, tMeter.sfCount) + assert.Equal(t, 1, tMeter.sfUDCount) + assert.Equal(t, 1, tMeter.sfHist) + assert.Equal(t, 1, tMeter.siCount) + assert.Equal(t, 1, tMeter.siUDCount) + assert.Equal(t, 1, tMeter.siHist) assert.Equal(t, 1, len(tMeter.callbacks)) // Because the Meter was provided by testmeterProvider it should also return our test instrument @@ -236,10 +244,18 @@ func TestMeterDelegatesCalls(t *testing.T) { require.IsType(t, &meter{}, m) tMeter := m.(*meter).delegate.Load().(*testMeter) require.NotNil(t, tMeter) - assert.Equal(t, 3, tMeter.afCount) - assert.Equal(t, 3, tMeter.aiCount) - assert.Equal(t, 3, tMeter.sfCount) - assert.Equal(t, 3, tMeter.siCount) + assert.Equal(t, 1, tMeter.afCount) + assert.Equal(t, 1, tMeter.afUDCount) + assert.Equal(t, 1, tMeter.afGauge) + assert.Equal(t, 1, tMeter.aiCount) + assert.Equal(t, 1, tMeter.aiUDCount) + assert.Equal(t, 1, tMeter.aiGauge) + assert.Equal(t, 1, tMeter.sfCount) + assert.Equal(t, 1, tMeter.sfUDCount) + assert.Equal(t, 1, tMeter.sfHist) + assert.Equal(t, 1, tMeter.siCount) + assert.Equal(t, 1, tMeter.siUDCount) + assert.Equal(t, 1, tMeter.siHist) // Because the Meter was provided by testmeterProvider it should also return our test instrument require.IsType(t, &testCountingFloatInstrument{}, ctr, "the meter did not delegate calls to the meter") @@ -276,10 +292,18 @@ func TestMeterDefersDelegations(t *testing.T) { require.IsType(t, &meter{}, m) tMeter := m.(*meter).delegate.Load().(*testMeter) require.NotNil(t, tMeter) - assert.Equal(t, 3, tMeter.afCount) - assert.Equal(t, 3, tMeter.aiCount) - assert.Equal(t, 3, tMeter.sfCount) - assert.Equal(t, 3, tMeter.siCount) + assert.Equal(t, 1, tMeter.afCount) + assert.Equal(t, 1, tMeter.afUDCount) + assert.Equal(t, 1, tMeter.afGauge) + assert.Equal(t, 1, tMeter.aiCount) + assert.Equal(t, 1, tMeter.aiUDCount) + assert.Equal(t, 1, tMeter.aiGauge) + assert.Equal(t, 1, tMeter.sfCount) + assert.Equal(t, 1, tMeter.sfUDCount) + assert.Equal(t, 1, tMeter.sfHist) + assert.Equal(t, 1, tMeter.siCount) + assert.Equal(t, 1, tMeter.siUDCount) + assert.Equal(t, 1, tMeter.siHist) // Because the Meter was a delegate it should return a delegated instrument @@ -296,7 +320,7 @@ func TestRegistrationDelegation(t *testing.T) { require.IsType(t, &meter{}, m) mImpl := m.(*meter) - actr, err := m.AsyncFloat64().Counter("test_Async_Counter") + actr, err := m.Float64ObservableCounter("test_Async_Counter") require.NoError(t, err) var called0 bool diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 53dfbc7528d..b77f7926840 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -36,28 +36,83 @@ func (p *testMeterProvider) Meter(name string, opts ...metric.MeterOption) metri } type testMeter struct { - afCount int - aiCount int - sfCount int - siCount int + afCount int + afUDCount int + afGauge int + + aiCount int + aiUDCount int + aiGauge int + + sfCount int + sfUDCount int + sfHist int + + siCount int + siUDCount int + siHist int callbacks []func(context.Context) } -// AsyncInt64 is the namespace for the Asynchronous Integer instruments. -// -// To Observe data with instruments it must be registered in a callback. -func (m *testMeter) AsyncInt64() asyncint64.InstrumentProvider { +func (m *testMeter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { + m.siCount++ + return &testCountingIntInstrument{}, nil +} + +func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { + m.siUDCount++ + return &testCountingIntInstrument{}, nil +} + +func (m *testMeter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { + m.siHist++ + return &testCountingIntInstrument{}, nil +} + +func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { m.aiCount++ - return &testAIInstrumentProvider{} + return &testCountingIntInstrument{}, nil } -// AsyncFloat64 is the namespace for the Asynchronous Float instruments -// -// To Observe data with instruments it must be registered in a callback. -func (m *testMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { +func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { + m.aiUDCount++ + return &testCountingIntInstrument{}, nil +} + +func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { + m.aiGauge++ + return &testCountingIntInstrument{}, nil +} + +func (m *testMeter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { + m.sfCount++ + return &testCountingFloatInstrument{}, nil +} + +func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { + m.sfUDCount++ + return &testCountingFloatInstrument{}, nil +} + +func (m *testMeter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { + m.sfHist++ + return &testCountingFloatInstrument{}, nil +} + +func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { m.afCount++ - return &testAFInstrumentProvider{} + return &testCountingFloatInstrument{}, nil +} + +func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + m.afUDCount++ + return &testCountingFloatInstrument{}, nil +} + +func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { + m.afGauge++ + return &testCountingFloatInstrument{}, nil } // RegisterCallback captures the function that will be called during Collect. @@ -82,18 +137,6 @@ func (r testReg) Unregister() error { return nil } -// SyncInt64 is the namespace for the Synchronous Integer instruments. -func (m *testMeter) SyncInt64() syncint64.InstrumentProvider { - m.siCount++ - return &testSIInstrumentProvider{} -} - -// SyncFloat64 is the namespace for the Synchronous Float instruments. -func (m *testMeter) SyncFloat64() syncfloat64.InstrumentProvider { - m.sfCount++ - return &testSFInstrumentProvider{} -} - // This enables async collection. func (m *testMeter) collect() { ctx := context.Background() @@ -105,71 +148,3 @@ func (m *testMeter) collect() { f(ctx) } } - -type testAFInstrumentProvider struct{} - -// Counter creates an instrument for recording increasing values. -func (ip testAFInstrumentProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - return &testCountingFloatInstrument{}, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip testAFInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return &testCountingFloatInstrument{}, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip testAFInstrumentProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - return &testCountingFloatInstrument{}, nil -} - -type testAIInstrumentProvider struct{} - -// Counter creates an instrument for recording increasing values. -func (ip testAIInstrumentProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - return &testCountingIntInstrument{}, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip testAIInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - return &testCountingIntInstrument{}, nil -} - -// Gauge creates an instrument for recording the current value. -func (ip testAIInstrumentProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - return &testCountingIntInstrument{}, nil -} - -type testSFInstrumentProvider struct{} - -// Counter creates an instrument for recording increasing values. -func (ip testSFInstrumentProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - return &testCountingFloatInstrument{}, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip testSFInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return &testCountingFloatInstrument{}, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip testSFInstrumentProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - return &testCountingFloatInstrument{}, nil -} - -type testSIInstrumentProvider struct{} - -// Counter creates an instrument for recording increasing values. -func (ip testSIInstrumentProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - return &testCountingIntInstrument{}, nil -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (ip testSIInstrumentProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - return &testCountingIntInstrument{}, nil -} - -// Histogram creates an instrument for recording a distribution of values. -func (ip testSIInstrumentProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - return &testCountingIntInstrument{}, nil -} diff --git a/metric/meter.go b/metric/meter.go index 3a505264ca0..83f2d6a8189 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -41,20 +41,59 @@ type MeterProvider interface { // // Warning: methods may be added to this interface in minor releases. type Meter interface { - // AsyncInt64 is the namespace for the Asynchronous Integer instruments. - // - // To Observe data with instruments it must be registered in a callback. - AsyncInt64() asyncint64.InstrumentProvider - - // AsyncFloat64 is the namespace for the Asynchronous Float instruments - // - // To Observe data with instruments it must be registered in a callback. - AsyncFloat64() asyncfloat64.InstrumentProvider + // Int64Counter returns a new instrument identified by name and configured + // with options. The instrument is used to synchronously record increasing + // int64 measurements during a computational operation. + Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) + // Int64UpDownCounter returns a new instrument identified by name and + // configured with options. The instrument is used to synchronously record + // int64 measurements during a computational operation. + Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) + // Int64Histogram returns a new instrument identified by name and + // configured with options. The instrument is used to synchronously record + // the distribution of int64 measurements during a computational operation. + Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) + // Int64ObservableCounter returns a new instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // increasing int64 measurements once per a measurement collection cycle. + Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) + // Int64ObservableUpDownCounter returns a new instrument identified by name + // and configured with options. The instrument is used to asynchronously + // record int64 measurements once per a measurement collection cycle. + Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) + // Int64ObservableGauge returns a new instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // instantaneous int64 measurements once per a measurement collection + // cycle. + Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) - // SyncInt64 is the namespace for the Synchronous Integer instruments - SyncInt64() syncint64.InstrumentProvider - // SyncFloat64 is the namespace for the Synchronous Float instruments - SyncFloat64() syncfloat64.InstrumentProvider + // Float64Counter returns a new instrument identified by name and + // configured with options. The instrument is used to synchronously record + // increasing float64 measurements during a computational operation. + Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) + // Float64UpDownCounter returns a new instrument identified by name and + // configured with options. The instrument is used to synchronously record + // float64 measurements during a computational operation. + Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) + // Float64Histogram returns a new instrument identified by name and + // configured with options. The instrument is used to synchronously record + // the distribution of float64 measurements during a computational + // operation. + Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) + // Float64ObservableCounter returns a new instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // increasing float64 measurements once per a measurement collection cycle. + Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) + // Float64ObservableUpDownCounter returns a new instrument identified by + // name and configured with options. The instrument is used to + // asynchronously record float64 measurements once per a measurement + // collection cycle. + Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) + // Float64ObservableGauge returns a new instrument identified by name and + // configured with options. The instrument is used to asynchronously record + // instantaneous float64 measurements once per a measurement collection + // cycle. + Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. diff --git a/metric/noop.go b/metric/noop.go index 7454a790337..568257c0964 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -43,24 +43,52 @@ func NewNoopMeter() Meter { type noopMeter struct{} -// AsyncInt64 creates an instrument that does not record any metrics. -func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider { - return nonrecordingAsyncInt64Instrument{} +func (noopMeter) Int64Counter(string, ...instrument.Option) (syncint64.Counter, error) { + return nonrecordingSyncInt64Instrument{}, nil } -// AsyncFloat64 creates an instrument that does not record any metrics. -func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return nonrecordingAsyncFloat64Instrument{} +func (noopMeter) Int64UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { + return nonrecordingSyncInt64Instrument{}, nil } -// SyncInt64 creates an instrument that does not record any metrics. -func (noopMeter) SyncInt64() syncint64.InstrumentProvider { - return nonrecordingSyncInt64Instrument{} +func (noopMeter) Int64Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { + return nonrecordingSyncInt64Instrument{}, nil } -// SyncFloat64 creates an instrument that does not record any metrics. -func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider { - return nonrecordingSyncFloat64Instrument{} +func (noopMeter) Int64ObservableCounter(string, ...instrument.Option) (asyncint64.Counter, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Int64ObservableGauge(string, ...instrument.Option) (asyncint64.Gauge, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Float64Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableCounter(string, ...instrument.Option) (asyncfloat64.Counter, error) { + return nonrecordingAsyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + return nonrecordingAsyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableGauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) { + return nonrecordingAsyncFloat64Instrument{}, nil } // RegisterCallback creates a register callback that does not record any metrics. @@ -77,10 +105,9 @@ type nonrecordingAsyncFloat64Instrument struct { } var ( - _ asyncfloat64.InstrumentProvider = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{} + _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} ) func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Option) (asyncfloat64.Counter, error) { @@ -104,10 +131,9 @@ type nonrecordingAsyncInt64Instrument struct { } var ( - _ asyncint64.InstrumentProvider = nonrecordingAsyncInt64Instrument{} - _ asyncint64.Counter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} + _ asyncint64.Counter = nonrecordingAsyncInt64Instrument{} + _ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{} + _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} ) func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Option) (asyncint64.Counter, error) { @@ -130,10 +156,9 @@ type nonrecordingSyncFloat64Instrument struct { } var ( - _ syncfloat64.InstrumentProvider = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{} + _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} ) func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { @@ -161,10 +186,9 @@ type nonrecordingSyncInt64Instrument struct { } var ( - _ syncint64.InstrumentProvider = nonrecordingSyncInt64Instrument{} - _ syncint64.Counter = nonrecordingSyncInt64Instrument{} - _ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{} - _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} + _ syncint64.Counter = nonrecordingSyncInt64Instrument{} + _ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{} + _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} ) func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Option) (syncint64.Counter, error) { diff --git a/metric/noop_test.go b/metric/noop_test.go index 4603cfce57b..6c75c0198d1 100644 --- a/metric/noop_test.go +++ b/metric/noop_test.go @@ -34,19 +34,19 @@ func TestNewNoopMeterProvider(t *testing.T) { func TestSyncFloat64(t *testing.T) { meter := NewNoopMeterProvider().Meter("test instrumentation") assert.NotPanics(t, func() { - inst, err := meter.SyncFloat64().Counter("test instrument") + inst, err := meter.Float64Counter("test instrument") require.NoError(t, err) inst.Add(context.Background(), 1.0, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.SyncFloat64().UpDownCounter("test instrument") + inst, err := meter.Float64UpDownCounter("test instrument") require.NoError(t, err) inst.Add(context.Background(), -1.0, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.SyncFloat64().Histogram("test instrument") + inst, err := meter.Float64Histogram("test instrument") require.NoError(t, err) inst.Record(context.Background(), 1.0, attribute.String("key", "value")) }) @@ -55,19 +55,19 @@ func TestSyncFloat64(t *testing.T) { func TestSyncInt64(t *testing.T) { meter := NewNoopMeterProvider().Meter("test instrumentation") assert.NotPanics(t, func() { - inst, err := meter.SyncInt64().Counter("test instrument") + inst, err := meter.Int64Counter("test instrument") require.NoError(t, err) inst.Add(context.Background(), 1, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.SyncInt64().UpDownCounter("test instrument") + inst, err := meter.Int64UpDownCounter("test instrument") require.NoError(t, err) inst.Add(context.Background(), -1, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.SyncInt64().Histogram("test instrument") + inst, err := meter.Int64Histogram("test instrument") require.NoError(t, err) inst.Record(context.Background(), 1, attribute.String("key", "value")) }) @@ -76,19 +76,19 @@ func TestSyncInt64(t *testing.T) { func TestAsyncFloat64(t *testing.T) { meter := NewNoopMeterProvider().Meter("test instrumentation") assert.NotPanics(t, func() { - inst, err := meter.AsyncFloat64().Counter("test instrument") + inst, err := meter.Float64ObservableCounter("test instrument") require.NoError(t, err) inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.AsyncFloat64().UpDownCounter("test instrument") + inst, err := meter.Float64ObservableUpDownCounter("test instrument") require.NoError(t, err) inst.Observe(context.Background(), -1.0, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.AsyncFloat64().Gauge("test instrument") + inst, err := meter.Float64ObservableGauge("test instrument") require.NoError(t, err) inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) }) @@ -97,19 +97,19 @@ func TestAsyncFloat64(t *testing.T) { func TestAsyncInt64(t *testing.T) { meter := NewNoopMeterProvider().Meter("test instrumentation") assert.NotPanics(t, func() { - inst, err := meter.AsyncInt64().Counter("test instrument") + inst, err := meter.Int64ObservableCounter("test instrument") require.NoError(t, err) inst.Observe(context.Background(), 1, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.AsyncInt64().UpDownCounter("test instrument") + inst, err := meter.Int64ObservableUpDownCounter("test instrument") require.NoError(t, err) inst.Observe(context.Background(), -1, attribute.String("key", "value")) }) assert.NotPanics(t, func() { - inst, err := meter.AsyncInt64().Gauge("test instrument") + inst, err := meter.Int64ObservableGauge("test instrument") require.NoError(t, err) inst.Observe(context.Background(), 1, attribute.String("key", "value")) }) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 9743c90cf87..e77bf149e2e 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -26,7 +26,7 @@ func benchCounter(b *testing.B, views ...View) (context.Context, Reader, syncint ctx := context.Background() rdr := NewManualReader() provider := NewMeterProvider(WithReader(rdr), WithView(views...)) - cntr, _ := provider.Meter("test").SyncInt64().Counter("hello") + cntr, _ := provider.Meter("test").Int64Counter("hello") b.ResetTimer() b.ReportAllocs() return ctx, rdr, cntr diff --git a/sdk/metric/instrument_provider.go b/sdk/metric/instrument_provider.go deleted file mode 100644 index ade1f641521..00000000000 --- a/sdk/metric/instrument_provider.go +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/sdk/metric" - -import ( - "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" - "go.opentelemetry.io/otel/sdk/instrumentation" -) - -// instProvider provides all OpenTelemetry instruments. -type instProvider[N int64 | float64] struct { - scope instrumentation.Scope - resolve resolver[N] -} - -func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) *instProvider[N] { - return &instProvider[N]{scope: s, resolve: newResolver(p, c)} -} - -// lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { - cfg := instrument.NewConfig(opts...) - i := Instrument{ - Name: name, - Description: cfg.Description(), - Unit: cfg.Unit(), - Kind: kind, - Scope: p.scope, - } - aggs, err := p.resolve.Aggregators(i) - return &instrumentImpl[N]{aggregators: aggs}, err -} - -type asyncInt64Provider struct { - *instProvider[int64] -} - -var _ asyncint64.InstrumentProvider = asyncInt64Provider{} - -// Counter creates an instrument for recording increasing values. -func (p asyncInt64Provider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) { - return p.lookup(InstrumentKindAsyncCounter, name, opts) -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (p asyncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) { - return p.lookup(InstrumentKindAsyncUpDownCounter, name, opts) -} - -// Gauge creates an instrument for recording the current value. -func (p asyncInt64Provider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) { - return p.lookup(InstrumentKindAsyncGauge, name, opts) -} - -type asyncFloat64Provider struct { - *instProvider[float64] -} - -var _ asyncfloat64.InstrumentProvider = asyncFloat64Provider{} - -// Counter creates an instrument for recording increasing values. -func (p asyncFloat64Provider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) { - return p.lookup(InstrumentKindAsyncCounter, name, opts) -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (p asyncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return p.lookup(InstrumentKindAsyncUpDownCounter, name, opts) -} - -// Gauge creates an instrument for recording the current value. -func (p asyncFloat64Provider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) { - return p.lookup(InstrumentKindAsyncGauge, name, opts) -} - -type syncInt64Provider struct { - *instProvider[int64] -} - -var _ syncint64.InstrumentProvider = syncInt64Provider{} - -// Counter creates an instrument for recording increasing values. -func (p syncInt64Provider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) { - return p.lookup(InstrumentKindSyncCounter, name, opts) -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (p syncInt64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) { - return p.lookup(InstrumentKindSyncUpDownCounter, name, opts) -} - -// Histogram creates an instrument for recording the current value. -func (p syncInt64Provider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) { - return p.lookup(InstrumentKindSyncHistogram, name, opts) -} - -type syncFloat64Provider struct { - *instProvider[float64] -} - -var _ syncfloat64.InstrumentProvider = syncFloat64Provider{} - -// Counter creates an instrument for recording increasing values. -func (p syncFloat64Provider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) { - return p.lookup(InstrumentKindSyncCounter, name, opts) -} - -// UpDownCounter creates an instrument for recording changes of a value. -func (p syncFloat64Provider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return p.lookup(InstrumentKindSyncUpDownCounter, name, opts) -} - -// Histogram creates an instrument for recording the current value. -func (p syncFloat64Provider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) { - return p.lookup(InstrumentKindSyncHistogram, name, opts) -} diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index 16ca8a44451..0f9850cbc84 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -31,19 +31,11 @@ type meter struct { aggregations []metricdata.Aggregation } -func (m *meter) SyncInt64() syncint64.InstrumentProvider { - // The same would be done for all the other instrument providers. - return (*syncInt64Provider)(m) -} - -type syncInt64Provider meter - -func (p *syncInt64Provider) Counter(string, ...instrument.Option) (syncint64.Counter, error) { - // This is an example of how a synchronous int64 provider would create an - // aggregator for a new counter. At this point the provider would - // determine the aggregation and temporality to used based on the Reader - // and View configuration. Assume here these are determined to be a - // cumulative sum. +func (p *meter) Int64Counter(string, ...instrument.Option) (syncint64.Counter, error) { + // This is an example of how a meter would create an aggregator for a new + // counter. At this point the provider would determine the aggregation and + // temporality to used based on the Reader and View configuration. Assume + // here these are determined to be a cumulative sum. aggregator := NewCumulativeSum[int64](true) count := inst{aggregateFunc: aggregator.Aggregate} @@ -55,13 +47,12 @@ func (p *syncInt64Provider) Counter(string, ...instrument.Option) (syncint64.Cou return count, nil } -func (p *syncInt64Provider) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { - // This is an example of how a synchronous int64 provider would create an - // aggregator for a new up-down counter. At this point the provider would - // determine the aggregation and temporality to used based on the Reader - // and View configuration. Assume here these are determined to be a - // last-value aggregation (the temporality does not affect the produced - // aggregations). +func (p *meter) Int64UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { + // This is an example of how a meter would create an aggregator for a new + // up-down counter. At this point the provider would determine the + // aggregation and temporality to used based on the Reader and View + // configuration. Assume here these are determined to be a last-value + // aggregation (the temporality does not affect the produced aggregations). aggregator := NewLastValue[int64]() upDownCount := inst{aggregateFunc: aggregator.Aggregate} @@ -73,12 +64,12 @@ func (p *syncInt64Provider) UpDownCounter(string, ...instrument.Option) (syncint return upDownCount, nil } -func (p *syncInt64Provider) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { - // This is an example of how a synchronous int64 provider would create an - // aggregator for a new histogram. At this point the provider would - // determine the aggregation and temporality to used based on the Reader - // and View configuration. Assume here these are determined to be a delta - // explicit-bucket histogram. +func (p *meter) Int64Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { + // This is an example of how a meter would create an aggregator for a new + // histogram. At this point the provider would determine the aggregation + // and temporality to used based on the Reader and View configuration. + // Assume here these are determined to be a delta explicit-bucket + // histogram. aggregator := NewDeltaHistogram[int64](aggregation.ExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, @@ -106,11 +97,10 @@ func (inst) Record(context.Context, int64, ...attribute.KeyValue) {} func Example() { m := meter{} - provider := m.SyncInt64() - _, _ = provider.Counter("counter example") - _, _ = provider.UpDownCounter("up-down counter example") - _, _ = provider.Histogram("histogram example") + _, _ = m.Int64Counter("counter example") + _, _ = m.Int64UpDownCounter("up-down counter example") + _, _ = m.Int64Histogram("histogram example") // Output: // using *internal.cumulativeSum[int64] aggregator for counter diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index c2c515af35c..e4f17f51b6f 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -57,14 +57,88 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { // Compile-time check meter implements metric.Meter. var _ metric.Meter = (*meter)(nil) -// AsyncInt64 returns the asynchronous integer instrument provider. -func (m *meter) AsyncInt64() asyncint64.InstrumentProvider { - return asyncInt64Provider{m.instProviderInt64} +// Int64Counter returns a new instrument identified by name and configured with +// options. The instrument is used to synchronously record increasing int64 +// measurements during a computational operation. +func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { + return m.instProviderInt64.lookup(InstrumentKindSyncCounter, name, options) } -// AsyncFloat64 returns the asynchronous floating-point instrument provider. -func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider { - return asyncFloat64Provider{m.instProviderFloat64} +// Int64UpDownCounter returns a new instrument identified by name and +// configured with options. The instrument is used to synchronously record +// int64 measurements during a computational operation. +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { + return m.instProviderInt64.lookup(InstrumentKindSyncUpDownCounter, name, options) +} + +// Int64Histogram returns a new instrument identified by name and configured +// with options. The instrument is used to synchronously record the +// distribution of int64 measurements during a computational operation. +func (m *meter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { + return m.instProviderInt64.lookup(InstrumentKindSyncHistogram, name, options) +} + +// Int64ObservableCounter returns a new instrument identified by name and +// configured with options. The instrument is used to asynchronously record +// increasing int64 measurements once per a measurement collection cycle. +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { + return m.instProviderInt64.lookup(InstrumentKindAsyncCounter, name, options) +} + +// Int64ObservableUpDownCounter returns a new instrument identified by name and +// configured with options. The instrument is used to asynchronously record +// int64 measurements once per a measurement collection cycle. +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { + return m.instProviderInt64.lookup(InstrumentKindAsyncUpDownCounter, name, options) +} + +// Int64ObservableGauge returns a new instrument identified by name and +// configured with options. The instrument is used to asynchronously record +// instantaneous int64 measurements once per a measurement collection cycle. +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { + return m.instProviderInt64.lookup(InstrumentKindAsyncGauge, name, options) +} + +// Float64Counter returns a new instrument identified by name and configured +// with options. The instrument is used to synchronously record increasing +// float64 measurements during a computational operation. +func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { + return m.instProviderFloat64.lookup(InstrumentKindSyncCounter, name, options) +} + +// Float64UpDownCounter returns a new instrument identified by name and +// configured with options. The instrument is used to synchronously record +// float64 measurements during a computational operation. +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { + return m.instProviderFloat64.lookup(InstrumentKindSyncUpDownCounter, name, options) +} + +// Float64Histogram returns a new instrument identified by name and configured +// with options. The instrument is used to synchronously record the +// distribution of float64 measurements during a computational operation. +func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { + return m.instProviderFloat64.lookup(InstrumentKindSyncHistogram, name, options) +} + +// Float64ObservableCounter returns a new instrument identified by name and +// configured with options. The instrument is used to asynchronously record +// increasing float64 measurements once per a measurement collection cycle. +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { + return m.instProviderFloat64.lookup(InstrumentKindAsyncCounter, name, options) +} + +// Float64ObservableUpDownCounter returns a new instrument identified by name +// and configured with options. The instrument is used to asynchronously record +// float64 measurements once per a measurement collection cycle. +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { + return m.instProviderFloat64.lookup(InstrumentKindAsyncUpDownCounter, name, options) +} + +// Float64ObservableGauge returns a new instrument identified by name and +// configured with options. The instrument is used to asynchronously record +// instantaneous float64 measurements once per a measurement collection cycle. +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { + return m.instProviderFloat64.lookup(InstrumentKindAsyncGauge, name, options) } // RegisterCallback registers the function f to be called when any of the @@ -106,12 +180,26 @@ func (m *meter) registerCallback(c callback) (metric.Registration, error) { return m.pipes.registerCallback(c), nil } -// SyncInt64 returns the synchronous integer instrument provider. -func (m *meter) SyncInt64() syncint64.InstrumentProvider { - return syncInt64Provider{m.instProviderInt64} +// instProvider provides all OpenTelemetry instruments. +type instProvider[N int64 | float64] struct { + scope instrumentation.Scope + resolve resolver[N] } -// SyncFloat64 returns the synchronous floating-point instrument provider. -func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider { - return syncFloat64Provider{m.instProviderFloat64} +func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) *instProvider[N] { + return &instProvider[N]{scope: s, resolve: newResolver(p, c)} +} + +// lookup returns the resolved instrumentImpl. +func (p *instProvider[N]) lookup(kind InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { + cfg := instrument.NewConfig(opts...) + i := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: kind, + Scope: p.scope, + } + aggs, err := p.resolve.Aggregators(i) + return &instrumentImpl[N]{aggregators: aggs}, err } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index d904b118ad4..e57b4acb77d 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -44,51 +44,51 @@ func TestMeterInstrumentConcurrency(t *testing.T) { m := NewMeterProvider().Meter("inst-concurrency") go func() { - _, _ = m.AsyncFloat64().Counter("AFCounter") + _, _ = m.Float64ObservableCounter("AFCounter") wg.Done() }() go func() { - _, _ = m.AsyncFloat64().UpDownCounter("AFUpDownCounter") + _, _ = m.Float64ObservableUpDownCounter("AFUpDownCounter") wg.Done() }() go func() { - _, _ = m.AsyncFloat64().Gauge("AFGauge") + _, _ = m.Float64ObservableGauge("AFGauge") wg.Done() }() go func() { - _, _ = m.AsyncInt64().Counter("AICounter") + _, _ = m.Int64ObservableCounter("AICounter") wg.Done() }() go func() { - _, _ = m.AsyncInt64().UpDownCounter("AIUpDownCounter") + _, _ = m.Int64ObservableUpDownCounter("AIUpDownCounter") wg.Done() }() go func() { - _, _ = m.AsyncInt64().Gauge("AIGauge") + _, _ = m.Int64ObservableGauge("AIGauge") wg.Done() }() go func() { - _, _ = m.SyncFloat64().Counter("SFCounter") + _, _ = m.Float64Counter("SFCounter") wg.Done() }() go func() { - _, _ = m.SyncFloat64().UpDownCounter("SFUpDownCounter") + _, _ = m.Float64UpDownCounter("SFUpDownCounter") wg.Done() }() go func() { - _, _ = m.SyncFloat64().Histogram("SFHistogram") + _, _ = m.Float64Histogram("SFHistogram") wg.Done() }() go func() { - _, _ = m.SyncInt64().Counter("SICounter") + _, _ = m.Int64Counter("SICounter") wg.Done() }() go func() { - _, _ = m.SyncInt64().UpDownCounter("SIUpDownCounter") + _, _ = m.Int64UpDownCounter("SIUpDownCounter") wg.Done() }() go func() { - _, _ = m.SyncInt64().Histogram("SIHistogram") + _, _ = m.Int64Histogram("SIHistogram") wg.Done() }() @@ -136,10 +136,10 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { provider := NewMeterProvider(WithReader(reader)) meter := provider.Meter("unregister-concurrency") - actr, err := meter.AsyncFloat64().Counter("counter") + actr, err := meter.Float64ObservableCounter("counter") require.NoError(t, err) - ag, err := meter.AsyncInt64().Gauge("gauge") + ag, err := meter.Int64ObservableGauge("gauge") require.NoError(t, err) i := []instrument.Asynchronous{actr} @@ -176,7 +176,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncInt64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.AsyncInt64().Counter("aint") + ctr, err := m.Int64ObservableCounter("aint") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) @@ -200,7 +200,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.AsyncInt64().UpDownCounter("aint") + ctr, err := m.Int64ObservableUpDownCounter("aint") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) @@ -224,7 +224,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncInt64Gauge", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.AsyncInt64().Gauge("agauge") + gauge, err := m.Int64ObservableGauge("agauge") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) @@ -246,7 +246,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncFloat64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.AsyncFloat64().Counter("afloat") + ctr, err := m.Float64ObservableCounter("afloat") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) @@ -270,7 +270,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.AsyncFloat64().UpDownCounter("afloat") + ctr, err := m.Float64ObservableUpDownCounter("afloat") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) @@ -294,7 +294,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "AsyncFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.AsyncFloat64().Gauge("agauge") + gauge, err := m.Float64ObservableGauge("agauge") assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) @@ -317,7 +317,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncInt64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.SyncInt64().Counter("sint") + ctr, err := m.Int64Counter("sint") assert.NoError(t, err) ctr.Add(context.Background(), 3) @@ -336,7 +336,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.SyncInt64().UpDownCounter("sint") + ctr, err := m.Int64UpDownCounter("sint") assert.NoError(t, err) ctr.Add(context.Background(), 11) @@ -355,7 +355,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncInt64Histogram", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.SyncInt64().Histogram("histogram") + gauge, err := m.Int64Histogram("histogram") assert.NoError(t, err) gauge.Record(context.Background(), 7) @@ -381,7 +381,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncFloat64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.SyncFloat64().Counter("sfloat") + ctr, err := m.Float64Counter("sfloat") assert.NoError(t, err) ctr.Add(context.Background(), 3) @@ -400,7 +400,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.SyncFloat64().UpDownCounter("sfloat") + ctr, err := m.Float64UpDownCounter("sfloat") assert.NoError(t, err) ctr.Add(context.Background(), 11) @@ -419,7 +419,7 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "SyncFloat64Histogram", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.SyncFloat64().Histogram("histogram") + gauge, err := m.Float64Histogram("histogram") assert.NoError(t, err) gauge.Record(context.Background(), 7) @@ -468,7 +468,7 @@ func TestMetersProvideScope(t *testing.T) { mp := NewMeterProvider(WithReader(rdr)) m1 := mp.Meter("scope1") - ctr1, err := m1.AsyncFloat64().Counter("ctr1") + ctr1, err := m1.Float64ObservableCounter("ctr1") assert.NoError(t, err) _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) { ctr1.Observe(ctx, 5) @@ -476,7 +476,7 @@ func TestMetersProvideScope(t *testing.T) { assert.NoError(t, err) m2 := mp.Meter("scope2") - ctr2, err := m2.AsyncInt64().Counter("ctr2") + ctr2, err := m2.Int64ObservableCounter("ctr2") assert.NoError(t, err) _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) { ctr2.Observe(ctx, 7) @@ -537,22 +537,22 @@ func TestUnregisterUnregisters(t *testing.T) { mp := NewMeterProvider(WithReader(r)) m := mp.Meter("TestUnregisterUnregisters") - int64Counter, err := m.AsyncInt64().Counter("int64.counter") + int64Counter, err := m.Int64ObservableCounter("int64.counter") require.NoError(t, err) - int64UpDownCounter, err := m.AsyncInt64().UpDownCounter("int64.up_down_counter") + int64UpDownCounter, err := m.Int64ObservableUpDownCounter("int64.up_down_counter") require.NoError(t, err) - int64Gauge, err := m.AsyncInt64().Gauge("int64.gauge") + int64Gauge, err := m.Int64ObservableGauge("int64.gauge") require.NoError(t, err) - floag64Counter, err := m.AsyncFloat64().Counter("floag64.counter") + floag64Counter, err := m.Float64ObservableCounter("floag64.counter") require.NoError(t, err) - floag64UpDownCounter, err := m.AsyncFloat64().UpDownCounter("floag64.up_down_counter") + floag64UpDownCounter, err := m.Float64ObservableUpDownCounter("floag64.up_down_counter") require.NoError(t, err) - floag64Gauge, err := m.AsyncFloat64().Gauge("floag64.gauge") + floag64Gauge, err := m.Float64ObservableGauge("floag64.gauge") require.NoError(t, err) var called bool @@ -587,22 +587,22 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { mp := NewMeterProvider(WithReader(r)) m := mp.Meter("testRegisterCallbackDropAggregations") - int64Counter, err := m.AsyncInt64().Counter("int64.counter") + int64Counter, err := m.Int64ObservableCounter("int64.counter") require.NoError(t, err) - int64UpDownCounter, err := m.AsyncInt64().UpDownCounter("int64.up_down_counter") + int64UpDownCounter, err := m.Int64ObservableUpDownCounter("int64.up_down_counter") require.NoError(t, err) - int64Gauge, err := m.AsyncInt64().Gauge("int64.gauge") + int64Gauge, err := m.Int64ObservableGauge("int64.gauge") require.NoError(t, err) - floag64Counter, err := m.AsyncFloat64().Counter("floag64.counter") + floag64Counter, err := m.Float64ObservableCounter("floag64.counter") require.NoError(t, err) - floag64UpDownCounter, err := m.AsyncFloat64().UpDownCounter("floag64.up_down_counter") + floag64UpDownCounter, err := m.Float64ObservableUpDownCounter("floag64.up_down_counter") require.NoError(t, err) - floag64Gauge, err := m.AsyncFloat64().Gauge("floag64.gauge") + floag64Gauge, err := m.Float64ObservableGauge("floag64.gauge") require.NoError(t, err) var called bool @@ -634,7 +634,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncFloat64Counter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncFloat64().Counter("afcounter") + ctr, err := mtr.Float64ObservableCounter("afcounter") if err != nil { return err } @@ -661,7 +661,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncFloat64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncFloat64().UpDownCounter("afupdowncounter") + ctr, err := mtr.Float64ObservableUpDownCounter("afupdowncounter") if err != nil { return err } @@ -688,7 +688,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncFloat64Gauge", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncFloat64().Gauge("afgauge") + ctr, err := mtr.Float64ObservableGauge("afgauge") if err != nil { return err } @@ -713,7 +713,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncInt64Counter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncInt64().Counter("aicounter") + ctr, err := mtr.Int64ObservableCounter("aicounter") if err != nil { return err } @@ -740,7 +740,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncInt64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncInt64().UpDownCounter("aiupdowncounter") + ctr, err := mtr.Int64ObservableUpDownCounter("aiupdowncounter") if err != nil { return err } @@ -767,7 +767,7 @@ func TestAttributeFilter(t *testing.T) { { name: "AsyncInt64Gauge", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.AsyncInt64().Gauge("aigauge") + ctr, err := mtr.Int64ObservableGauge("aigauge") if err != nil { return err } @@ -792,7 +792,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncFloat64Counter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncFloat64().Counter("sfcounter") + ctr, err := mtr.Float64Counter("sfcounter") if err != nil { return err } @@ -818,7 +818,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncFloat64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncFloat64().UpDownCounter("sfupdowncounter") + ctr, err := mtr.Float64UpDownCounter("sfupdowncounter") if err != nil { return err } @@ -844,7 +844,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncFloat64Histogram", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncFloat64().Histogram("sfhistogram") + ctr, err := mtr.Float64Histogram("sfhistogram") if err != nil { return err } @@ -874,7 +874,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncInt64Counter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncInt64().Counter("sicounter") + ctr, err := mtr.Int64Counter("sicounter") if err != nil { return err } @@ -900,7 +900,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncInt64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncInt64().UpDownCounter("siupdowncounter") + ctr, err := mtr.Int64UpDownCounter("siupdowncounter") if err != nil { return err } @@ -926,7 +926,7 @@ func TestAttributeFilter(t *testing.T) { { name: "SyncInt64Histogram", register: func(t *testing.T, mtr metric.Meter) error { - ctr, err := mtr.SyncInt64().Histogram("sihistogram") + ctr, err := mtr.Int64Histogram("sihistogram") if err != nil { return err } @@ -1006,20 +1006,20 @@ func BenchmarkInstrumentCreation(b *testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { - aiCounter, _ = meter.AsyncInt64().Counter("async.int64.counter") - aiUpDownCounter, _ = meter.AsyncInt64().UpDownCounter("async.int64.up.down.counter") - aiGauge, _ = meter.AsyncInt64().Gauge("async.int64.gauge") + aiCounter, _ = meter.Int64ObservableCounter("async.int64.counter") + aiUpDownCounter, _ = meter.Int64ObservableUpDownCounter("async.int64.up.down.counter") + aiGauge, _ = meter.Int64ObservableGauge("async.int64.gauge") - afCounter, _ = meter.AsyncFloat64().Counter("async.float64.counter") - afUpDownCounter, _ = meter.AsyncFloat64().UpDownCounter("async.float64.up.down.counter") - afGauge, _ = meter.AsyncFloat64().Gauge("async.float64.gauge") + afCounter, _ = meter.Float64ObservableCounter("async.float64.counter") + afUpDownCounter, _ = meter.Float64ObservableUpDownCounter("async.float64.up.down.counter") + afGauge, _ = meter.Float64ObservableGauge("async.float64.gauge") - siCounter, _ = meter.SyncInt64().Counter("sync.int64.counter") - siUpDownCounter, _ = meter.SyncInt64().UpDownCounter("sync.int64.up.down.counter") - siHistogram, _ = meter.SyncInt64().Histogram("sync.int64.histogram") + siCounter, _ = meter.Int64Counter("sync.int64.counter") + siUpDownCounter, _ = meter.Int64UpDownCounter("sync.int64.up.down.counter") + siHistogram, _ = meter.Int64Histogram("sync.int64.histogram") - sfCounter, _ = meter.SyncFloat64().Counter("sync.float64.counter") - sfUpDownCounter, _ = meter.SyncFloat64().UpDownCounter("sync.float64.up.down.counter") - sfHistogram, _ = meter.SyncFloat64().Histogram("sync.float64.histogram") + sfCounter, _ = meter.Float64Counter("sync.float64.counter") + sfUpDownCounter, _ = meter.Float64UpDownCounter("sync.float64.up.down.counter") + sfHistogram, _ = meter.Float64Histogram("sync.float64.histogram") } } From 46075163160ced9424a8ae2bba372e04e34803da Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 4 Jan 2023 12:47:18 -0800 Subject: [PATCH 354/886] Rename metric SDK instrument kind to match API (#3562) * Rename metric SDK instrument kind to match API Follow up to #3530. * Update CHANGELOG Fix trailing spaces and update PR number. --- CHANGELOG.md | 7 ++ sdk/metric/config_test.go | 4 +- sdk/metric/instrument.go | 35 +++---- sdk/metric/meter.go | 24 ++--- sdk/metric/meter_test.go | 36 ++++---- sdk/metric/pipeline.go | 26 +++--- sdk/metric/pipeline_registry_test.go | 132 +++++++++++++-------------- sdk/metric/pipeline_test.go | 2 +- sdk/metric/reader.go | 10 +- sdk/metric/reader_test.go | 24 ++--- sdk/metric/view_test.go | 34 +++---- 11 files changed, 171 insertions(+), 163 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac597c1092a..08745581205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, fixing random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) + - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` + - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` + - `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram` + - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` + - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` + - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` ### Deprecated diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index dc5eff2eee2..d5dd6e4af6a 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -135,11 +135,11 @@ func TestWithReader(t *testing.T) { func TestWithView(t *testing.T) { c := newConfig([]Option{WithView( NewView( - Instrument{Kind: InstrumentKindAsyncCounter}, + Instrument{Kind: InstrumentKindObservableCounter}, Stream{Name: "a"}, ), NewView( - Instrument{Kind: InstrumentKindSyncCounter}, + Instrument{Kind: InstrumentKindCounter}, Stream{Name: "b"}, ), )}) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 8009540e6b2..5454a4736ec 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -44,26 +44,27 @@ const ( // instrumentKindUndefined is an undefined instrument kind, it should not // be used by any initialized type. instrumentKindUndefined InstrumentKind = iota // nolint:deadcode,varcheck,unused - // InstrumentKindSyncCounter identifies a group of instruments that record + // InstrumentKindCounter identifies a group of instruments that record // increasing values synchronously with the code path they are measuring. - InstrumentKindSyncCounter - // InstrumentKindSyncUpDownCounter identifies a group of instruments that + InstrumentKindCounter + // InstrumentKindUpDownCounter identifies a group of instruments that // record increasing and decreasing values synchronously with the code path // they are measuring. - InstrumentKindSyncUpDownCounter - // InstrumentKindSyncHistogram identifies a group of instruments that - // record a distribution of values synchronously with the code path they - // are measuring. - InstrumentKindSyncHistogram - // InstrumentKindAsyncCounter identifies a group of instruments that record - // increasing values in an asynchronous callback. - InstrumentKindAsyncCounter - // InstrumentKindAsyncUpDownCounter identifies a group of instruments that - // record increasing and decreasing values in an asynchronous callback. - InstrumentKindAsyncUpDownCounter - // InstrumentKindAsyncGauge identifies a group of instruments that record - // current values in an asynchronous callback. - InstrumentKindAsyncGauge + InstrumentKindUpDownCounter + // InstrumentKindHistogram identifies a group of instruments that record a + // distribution of values synchronously with the code path they are + // measuring. + InstrumentKindHistogram + // InstrumentKindObservableCounter identifies a group of instruments that + // record increasing values in an asynchronous callback. + InstrumentKindObservableCounter + // InstrumentKindObservableUpDownCounter identifies a group of instruments + // that record increasing and decreasing values in an asynchronous + // callback. + InstrumentKindObservableUpDownCounter + // InstrumentKindObservableGauge identifies a group of instruments that + // record current values in an asynchronous callback. + InstrumentKindObservableGauge ) type nonComparable [0]func() // nolint: unused // This is indeed used. diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index e4f17f51b6f..c82a4fb5f55 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -61,84 +61,84 @@ var _ metric.Meter = (*meter)(nil) // options. The instrument is used to synchronously record increasing int64 // measurements during a computational operation. func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { - return m.instProviderInt64.lookup(InstrumentKindSyncCounter, name, options) + return m.instProviderInt64.lookup(InstrumentKindCounter, name, options) } // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { - return m.instProviderInt64.lookup(InstrumentKindSyncUpDownCounter, name, options) + return m.instProviderInt64.lookup(InstrumentKindUpDownCounter, name, options) } // Int64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of int64 measurements during a computational operation. func (m *meter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { - return m.instProviderInt64.lookup(InstrumentKindSyncHistogram, name, options) + return m.instProviderInt64.lookup(InstrumentKindHistogram, name, options) } // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { - return m.instProviderInt64.lookup(InstrumentKindAsyncCounter, name, options) + return m.instProviderInt64.lookup(InstrumentKindObservableCounter, name, options) } // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // int64 measurements once per a measurement collection cycle. func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { - return m.instProviderInt64.lookup(InstrumentKindAsyncUpDownCounter, name, options) + return m.instProviderInt64.lookup(InstrumentKindObservableUpDownCounter, name, options) } // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { - return m.instProviderInt64.lookup(InstrumentKindAsyncGauge, name, options) + return m.instProviderInt64.lookup(InstrumentKindObservableGauge, name, options) } // Float64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // float64 measurements during a computational operation. func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { - return m.instProviderFloat64.lookup(InstrumentKindSyncCounter, name, options) + return m.instProviderFloat64.lookup(InstrumentKindCounter, name, options) } // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return m.instProviderFloat64.lookup(InstrumentKindSyncUpDownCounter, name, options) + return m.instProviderFloat64.lookup(InstrumentKindUpDownCounter, name, options) } // Float64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of float64 measurements during a computational operation. func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { - return m.instProviderFloat64.lookup(InstrumentKindSyncHistogram, name, options) + return m.instProviderFloat64.lookup(InstrumentKindHistogram, name, options) } // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. func (m *meter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { - return m.instProviderFloat64.lookup(InstrumentKindAsyncCounter, name, options) + return m.instProviderFloat64.lookup(InstrumentKindObservableCounter, name, options) } // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record // float64 measurements once per a measurement collection cycle. func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return m.instProviderFloat64.lookup(InstrumentKindAsyncUpDownCounter, name, options) + return m.instProviderFloat64.lookup(InstrumentKindObservableUpDownCounter, name, options) } // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { - return m.instProviderFloat64.lookup(InstrumentKindAsyncGauge, name, options) + return m.instProviderFloat64.lookup(InstrumentKindObservableGauge, name, options) } // RegisterCallback registers the function f to be called when any of the diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index e57b4acb77d..fee46e93dac 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -174,7 +174,7 @@ func TestMeterCreatesInstruments(t *testing.T) { want metricdata.Metrics }{ { - name: "AsyncInt64Count", + name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { ctr, err := m.Int64ObservableCounter("aint") assert.NoError(t, err) @@ -198,7 +198,7 @@ func TestMeterCreatesInstruments(t *testing.T) { }, }, { - name: "AsyncInt64UpDownCount", + name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter("aint") assert.NoError(t, err) @@ -222,7 +222,7 @@ func TestMeterCreatesInstruments(t *testing.T) { }, }, { - name: "AsyncInt64Gauge", + name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { gauge, err := m.Int64ObservableGauge("agauge") assert.NoError(t, err) @@ -244,7 +244,7 @@ func TestMeterCreatesInstruments(t *testing.T) { }, }, { - name: "AsyncFloat64Count", + name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { ctr, err := m.Float64ObservableCounter("afloat") assert.NoError(t, err) @@ -268,7 +268,7 @@ func TestMeterCreatesInstruments(t *testing.T) { }, }, { - name: "AsyncFloat64UpDownCount", + name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter("afloat") assert.NoError(t, err) @@ -292,7 +292,7 @@ func TestMeterCreatesInstruments(t *testing.T) { }, }, { - name: "AsyncFloat64Gauge", + name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { gauge, err := m.Float64ObservableGauge("agauge") assert.NoError(t, err) @@ -632,7 +632,7 @@ func TestAttributeFilter(t *testing.T) { wantMetric metricdata.Metrics }{ { - name: "AsyncFloat64Counter", + name: "ObservableFloat64Counter", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Float64ObservableCounter("afcounter") if err != nil { @@ -659,7 +659,7 @@ func TestAttributeFilter(t *testing.T) { }, }, { - name: "AsyncFloat64UpDownCounter", + name: "ObservableFloat64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Float64ObservableUpDownCounter("afupdowncounter") if err != nil { @@ -686,7 +686,7 @@ func TestAttributeFilter(t *testing.T) { }, }, { - name: "AsyncFloat64Gauge", + name: "ObservableFloat64Gauge", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Float64ObservableGauge("afgauge") if err != nil { @@ -711,7 +711,7 @@ func TestAttributeFilter(t *testing.T) { }, }, { - name: "AsyncInt64Counter", + name: "ObservableInt64Counter", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Int64ObservableCounter("aicounter") if err != nil { @@ -738,7 +738,7 @@ func TestAttributeFilter(t *testing.T) { }, }, { - name: "AsyncInt64UpDownCounter", + name: "ObservableInt64UpDownCounter", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Int64ObservableUpDownCounter("aiupdowncounter") if err != nil { @@ -765,7 +765,7 @@ func TestAttributeFilter(t *testing.T) { }, }, { - name: "AsyncInt64Gauge", + name: "ObservableInt64Gauge", register: func(t *testing.T, mtr metric.Meter) error { ctr, err := mtr.Int64ObservableGauge("aigauge") if err != nil { @@ -1006,13 +1006,13 @@ func BenchmarkInstrumentCreation(b *testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { - aiCounter, _ = meter.Int64ObservableCounter("async.int64.counter") - aiUpDownCounter, _ = meter.Int64ObservableUpDownCounter("async.int64.up.down.counter") - aiGauge, _ = meter.Int64ObservableGauge("async.int64.gauge") + aiCounter, _ = meter.Int64ObservableCounter("observable.int64.counter") + aiUpDownCounter, _ = meter.Int64ObservableUpDownCounter("observable.int64.up.down.counter") + aiGauge, _ = meter.Int64ObservableGauge("observable.int64.gauge") - afCounter, _ = meter.Float64ObservableCounter("async.float64.counter") - afUpDownCounter, _ = meter.Float64ObservableUpDownCounter("async.float64.up.down.counter") - afGauge, _ = meter.Float64ObservableGauge("async.float64.gauge") + afCounter, _ = meter.Float64ObservableCounter("observable.float64.counter") + afUpDownCounter, _ = meter.Float64ObservableUpDownCounter("observable.float64.up.down.counter") + afGauge, _ = meter.Float64ObservableGauge("observable.float64.gauge") siCounter, _ = meter.Int64Counter("sync.int64.counter") siUpDownCounter, _ = meter.Int64UpDownCounter("sync.int64.up.down.counter") diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index f9938bf617f..17cdadf918c 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -332,7 +332,7 @@ func (i *inserter[N]) instrumentID(kind InstrumentKind, stream Stream) instrumen } switch kind { - case InstrumentKindAsyncCounter, InstrumentKindSyncCounter, InstrumentKindSyncHistogram: + case InstrumentKindObservableCounter, InstrumentKindCounter, InstrumentKindHistogram: id.Monotonic = true } @@ -350,7 +350,7 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin return internal.NewLastValue[N](), nil case aggregation.Sum: switch kind { - case InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter: + case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: // Asynchronous counters and up-down-counters are defined to record // the absolute value of the count: // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation @@ -388,18 +388,18 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin // isAggregatorCompatible checks if the aggregation can be used by the instrument. // Current compatibility: // -// | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | -// |----------------------|------|-----------|-----|-----------|-----------------------| -// | Sync Counter | X | | X | X | X | -// | Sync UpDown Counter | X | | X | | | -// | Sync Histogram | X | | X | X | X | -// | Async Counter | X | | X | | | -// | Async UpDown Counter | X | | X | | | -// | Async Gauge | X | X | | | |. +// | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | +// |--------------------------|------|-----------|-----|-----------|-----------------------| +// | Counter | X | | X | X | X | +// | UpDownCounter | X | | X | | | +// | Histogram | X | | X | X | X | +// | Observable Counter | X | | X | | | +// | Observable UpDownCounter | X | | X | | | +// | Observable Gauge | X | X | | | |. func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { case aggregation.ExplicitBucketHistogram: - if kind == InstrumentKindSyncCounter || kind == InstrumentKindSyncHistogram { + if kind == InstrumentKindCounter || kind == InstrumentKindHistogram { return nil } // TODO: review need for aggregation check after @@ -407,7 +407,7 @@ func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) er return errIncompatibleAggregation case aggregation.Sum: switch kind { - case InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter, InstrumentKindSyncCounter, InstrumentKindSyncHistogram, InstrumentKindSyncUpDownCounter: + case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter, InstrumentKindCounter, InstrumentKindHistogram, InstrumentKindUpDownCounter: return nil default: // TODO: review need for aggregation check after @@ -415,7 +415,7 @@ func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) er return errIncompatibleAggregation } case aggregation.LastValue: - if kind == InstrumentKindAsyncGauge { + if kind == InstrumentKindObservableGauge { return nil } // TODO: review need for aggregation check after diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 91580242763..307900ae3a9 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -63,12 +63,12 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { instruments := []Instrument{ {Name: "foo", Kind: InstrumentKind(0)}, //Unknown kind - {Name: "foo", Kind: InstrumentKindSyncCounter}, - {Name: "foo", Kind: InstrumentKindSyncUpDownCounter}, - {Name: "foo", Kind: InstrumentKindSyncHistogram}, - {Name: "foo", Kind: InstrumentKindAsyncCounter}, - {Name: "foo", Kind: InstrumentKindAsyncUpDownCounter}, - {Name: "foo", Kind: InstrumentKindAsyncGauge}, + {Name: "foo", Kind: InstrumentKindCounter}, + {Name: "foo", Kind: InstrumentKindUpDownCounter}, + {Name: "foo", Kind: InstrumentKindHistogram}, + {Name: "foo", Kind: InstrumentKindObservableCounter}, + {Name: "foo", Kind: InstrumentKindObservableUpDownCounter}, + {Name: "foo", Kind: InstrumentKindObservableGauge}, } testcases := []struct { @@ -84,13 +84,13 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "drop should return 0 aggregators", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), views: []View{defaultView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], }, { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindSyncUpDownCounter], + inst: instruments[InstrumentKindUpDownCounter], wantKind: internal.NewDeltaSum[N](false), wantLen: 1, }, @@ -98,7 +98,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindSyncHistogram], + inst: instruments[InstrumentKindHistogram], wantKind: internal.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, @@ -106,7 +106,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindAsyncCounter], + inst: instruments[InstrumentKindObservableCounter], wantKind: internal.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, @@ -114,7 +114,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindAsyncUpDownCounter], + inst: instruments[InstrumentKindObservableUpDownCounter], wantKind: internal.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, @@ -122,7 +122,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindAsyncGauge], + inst: instruments[InstrumentKindObservableGauge], wantKind: internal.NewLastValue[N](), wantLen: 1, }, @@ -130,7 +130,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "default agg should use reader", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantKind: internal.NewDeltaSum[N](true), wantLen: 1, }, @@ -138,7 +138,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindSyncUpDownCounter], + inst: instruments[InstrumentKindUpDownCounter], wantKind: internal.NewCumulativeSum[N](false), wantLen: 1, }, @@ -146,7 +146,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindSyncHistogram], + inst: instruments[InstrumentKindHistogram], wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, @@ -154,7 +154,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindAsyncCounter], + inst: instruments[InstrumentKindObservableCounter], wantKind: internal.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, @@ -162,7 +162,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindAsyncUpDownCounter], + inst: instruments[InstrumentKindObservableUpDownCounter], wantKind: internal.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, @@ -170,7 +170,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindAsyncGauge], + inst: instruments[InstrumentKindObservableGauge], wantKind: internal.NewLastValue[N](), wantLen: 1, }, @@ -178,7 +178,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader should set default agg", reader: NewManualReader(), views: []View{defaultView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantKind: internal.NewCumulativeSum[N](true), wantLen: 1, }, @@ -186,7 +186,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "view should overwrite reader", reader: NewManualReader(), views: []View{changeAggView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, @@ -194,7 +194,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "multiple views should create multiple aggregators", reader: NewManualReader(), views: []View{defaultView, renameView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantKind: internal.NewCumulativeSum[N](true), wantLen: 2, }, @@ -202,14 +202,14 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { name: "reader with invalid aggregation should error", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantErr: errCreatingAggregators, }, { name: "view with invalid aggregation should error", reader: NewManualReader(), views: []View{invalidAggView}, - inst: instruments[InstrumentKindSyncCounter], + inst: instruments[InstrumentKindCounter], wantErr: errCreatingAggregators, }, } @@ -308,7 +308,7 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { } func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { - inst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} + inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} c := newInstrumentCache[int64](nil, nil) r := newResolver(p, c) aggs, err := r.Aggregators(inst) @@ -318,7 +318,7 @@ func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCo } func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { - inst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} + inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} c := newInstrumentCache[float64](nil, nil) r := newResolver(p, c) aggs, err := r.Aggregators(inst) @@ -344,7 +344,7 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { readers := []Reader{testRdrHistogram} views := []View{defaultView} p := newPipelines(resource.Empty(), readers, views) - inst := Instrument{Name: "foo", Kind: InstrumentKindAsyncGauge} + inst := Instrument{Name: "foo", Kind: InstrumentKindObservableGauge} vc := cache[string, instrumentID]{} ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) @@ -392,8 +392,8 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { readers := []Reader{NewManualReader()} views := []View{defaultView, renameView} - fooInst := Instrument{Name: "foo", Kind: InstrumentKindSyncCounter} - barInst := Instrument{Name: "bar", Kind: InstrumentKindSyncCounter} + fooInst := Instrument{Name: "foo", Kind: InstrumentKindCounter} + barInst := Instrument{Name: "bar", Kind: InstrumentKindCounter} p := newPipelines(resource.Empty(), readers, views) @@ -419,7 +419,7 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { assert.Equal(t, 1, l.InfoN(), "instrument conflict not logged") assert.Len(t, floatAggs, 1) - fooInst = Instrument{Name: "foo-float", Kind: InstrumentKindSyncCounter} + fooInst = Instrument{Name: "foo-float", Kind: InstrumentKindCounter} floatAggs, err = rf.Aggregators(fooInst) assert.NoError(t, err) @@ -445,137 +445,137 @@ func TestIsAggregatorCompatible(t *testing.T) { }{ { name: "SyncCounter and Drop", - kind: InstrumentKindSyncCounter, + kind: InstrumentKindCounter, agg: aggregation.Drop{}, }, { name: "SyncCounter and LastValue", - kind: InstrumentKindSyncCounter, + kind: InstrumentKindCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncCounter and Sum", - kind: InstrumentKindSyncCounter, + kind: InstrumentKindCounter, agg: aggregation.Sum{}, }, { name: "SyncCounter and ExplicitBucketHistogram", - kind: InstrumentKindSyncCounter, + kind: InstrumentKindCounter, agg: aggregation.ExplicitBucketHistogram{}, }, { name: "SyncUpDownCounter and Drop", - kind: InstrumentKindSyncUpDownCounter, + kind: InstrumentKindUpDownCounter, agg: aggregation.Drop{}, }, { name: "SyncUpDownCounter and LastValue", - kind: InstrumentKindSyncUpDownCounter, + kind: InstrumentKindUpDownCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncUpDownCounter and Sum", - kind: InstrumentKindSyncUpDownCounter, + kind: InstrumentKindUpDownCounter, agg: aggregation.Sum{}, }, { name: "SyncUpDownCounter and ExplicitBucketHistogram", - kind: InstrumentKindSyncUpDownCounter, + kind: InstrumentKindUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "SyncHistogram and Drop", - kind: InstrumentKindSyncHistogram, + kind: InstrumentKindHistogram, agg: aggregation.Drop{}, }, { name: "SyncHistogram and LastValue", - kind: InstrumentKindSyncHistogram, + kind: InstrumentKindHistogram, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { name: "SyncHistogram and Sum", - kind: InstrumentKindSyncHistogram, + kind: InstrumentKindHistogram, agg: aggregation.Sum{}, }, { name: "SyncHistogram and ExplicitBucketHistogram", - kind: InstrumentKindSyncHistogram, + kind: InstrumentKindHistogram, agg: aggregation.ExplicitBucketHistogram{}, }, { - name: "AsyncCounter and Drop", - kind: InstrumentKindAsyncCounter, + name: "ObservableCounter and Drop", + kind: InstrumentKindObservableCounter, agg: aggregation.Drop{}, }, { - name: "AsyncCounter and LastValue", - kind: InstrumentKindAsyncCounter, + name: "ObservableCounter and LastValue", + kind: InstrumentKindObservableCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { - name: "AsyncCounter and Sum", - kind: InstrumentKindAsyncCounter, + name: "ObservableCounter and Sum", + kind: InstrumentKindObservableCounter, agg: aggregation.Sum{}, }, { - name: "AsyncCounter and ExplicitBucketHistogram", - kind: InstrumentKindAsyncCounter, + name: "ObservableCounter and ExplicitBucketHistogram", + kind: InstrumentKindObservableCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { - name: "AsyncUpDownCounter and Drop", - kind: InstrumentKindAsyncUpDownCounter, + name: "ObservableUpDownCounter and Drop", + kind: InstrumentKindObservableUpDownCounter, agg: aggregation.Drop{}, }, { - name: "AsyncUpDownCounter and LastValue", - kind: InstrumentKindAsyncUpDownCounter, + name: "ObservableUpDownCounter and LastValue", + kind: InstrumentKindObservableUpDownCounter, agg: aggregation.LastValue{}, want: errIncompatibleAggregation, }, { - name: "AsyncUpDownCounter and Sum", - kind: InstrumentKindAsyncUpDownCounter, + name: "ObservableUpDownCounter and Sum", + kind: InstrumentKindObservableUpDownCounter, agg: aggregation.Sum{}, }, { - name: "AsyncUpDownCounter and ExplicitBucketHistogram", - kind: InstrumentKindAsyncUpDownCounter, + name: "ObservableUpDownCounter and ExplicitBucketHistogram", + kind: InstrumentKindObservableUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { - name: "AsyncGauge and Drop", - kind: InstrumentKindAsyncGauge, + name: "ObservableGauge and Drop", + kind: InstrumentKindObservableGauge, agg: aggregation.Drop{}, }, { - name: "AsyncGauge and aggregation.LastValue{}", - kind: InstrumentKindAsyncGauge, + name: "ObservableGauge and aggregation.LastValue{}", + kind: InstrumentKindObservableGauge, agg: aggregation.LastValue{}, }, { - name: "AsyncGauge and Sum", - kind: InstrumentKindAsyncGauge, + name: "ObservableGauge and Sum", + kind: InstrumentKindObservableGauge, agg: aggregation.Sum{}, want: errIncompatibleAggregation, }, { - name: "AsyncGauge and ExplicitBucketHistogram", - kind: InstrumentKindAsyncGauge, + name: "ObservableGauge and ExplicitBucketHistogram", + kind: InstrumentKindObservableGauge, agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "Default aggregation should error", - kind: InstrumentKindSyncCounter, + kind: InstrumentKindCounter, agg: aggregation.Default{}, want: errUnknownAggregation, }, diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index fe702a2d1ab..2badfe1865e 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -136,7 +136,7 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { inst := Instrument{ Name: "requests", Description: "count of requests received", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Dimensionless, } return func(t *testing.T) { diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index c52cc58dff2..63de3b1bac1 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -136,16 +136,16 @@ type AggregationSelector func(InstrumentKind) aggregation.Aggregation // DefaultAggregationSelector returns the default aggregation and parameters // that will be used to summarize measurement made from an instrument of // InstrumentKind. This AggregationSelector using the following selection -// mapping: Counter ⇨ Sum, Asynchronous Counter ⇨ Sum, UpDownCounter ⇨ Sum, -// Asynchronous UpDownCounter ⇨ Sum, Asynchronous Gauge ⇨ LastValue, +// mapping: Counter ⇨ Sum, Observable Counter ⇨ Sum, UpDownCounter ⇨ Sum, +// Observable UpDownCounter ⇨ Sum, Observable Gauge ⇨ LastValue, // Histogram ⇨ ExplicitBucketHistogram. func DefaultAggregationSelector(ik InstrumentKind) aggregation.Aggregation { switch ik { - case InstrumentKindSyncCounter, InstrumentKindSyncUpDownCounter, InstrumentKindAsyncCounter, InstrumentKindAsyncUpDownCounter: + case InstrumentKindCounter, InstrumentKindUpDownCounter, InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: return aggregation.Sum{} - case InstrumentKindAsyncGauge: + case InstrumentKindObservableGauge: return aggregation.LastValue{} - case InstrumentKindSyncHistogram: + case InstrumentKindHistogram: return aggregation.ExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, NoMinMax: false, diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 191ab39945b..26ac13f5dd7 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -290,12 +290,12 @@ func TestDefaultAggregationSelector(t *testing.T) { assert.Panics(t, func() { DefaultAggregationSelector(undefinedInstrument) }) iKinds := []InstrumentKind{ - InstrumentKindSyncCounter, - InstrumentKindSyncUpDownCounter, - InstrumentKindSyncHistogram, - InstrumentKindAsyncCounter, - InstrumentKindAsyncUpDownCounter, - InstrumentKindAsyncGauge, + InstrumentKindCounter, + InstrumentKindUpDownCounter, + InstrumentKindHistogram, + InstrumentKindObservableCounter, + InstrumentKindObservableUpDownCounter, + InstrumentKindObservableGauge, } for _, ik := range iKinds { @@ -307,12 +307,12 @@ func TestDefaultTemporalitySelector(t *testing.T) { var undefinedInstrument InstrumentKind for _, ik := range []InstrumentKind{ undefinedInstrument, - InstrumentKindSyncCounter, - InstrumentKindSyncUpDownCounter, - InstrumentKindSyncHistogram, - InstrumentKindAsyncCounter, - InstrumentKindAsyncUpDownCounter, - InstrumentKindAsyncGauge, + InstrumentKindCounter, + InstrumentKindUpDownCounter, + InstrumentKindHistogram, + InstrumentKindObservableCounter, + InstrumentKindObservableUpDownCounter, + InstrumentKindObservableGauge, } { assert.Equal(t, metricdata.CumulativeTemporality, DefaultTemporalitySelector(ik)) } diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 891de52dc6b..32b93b74fe4 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -36,7 +36,7 @@ var ( completeIP = Instrument{ Name: "foo", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: instrumentation.Scope{ Name: "TestNewViewMatch", @@ -193,15 +193,15 @@ func TestNewViewMatch(t *testing.T) { }, { name: "Kind", - criteria: Instrument{Kind: InstrumentKindSyncCounter}, - matches: []Instrument{{Kind: InstrumentKindSyncCounter}, completeIP}, + criteria: Instrument{Kind: InstrumentKindCounter}, + matches: []Instrument{{Kind: InstrumentKindCounter}, completeIP}, notMatches: []Instrument{ {}, - {Kind: InstrumentKindSyncUpDownCounter}, - {Kind: InstrumentKindSyncHistogram}, - {Kind: InstrumentKindAsyncCounter}, - {Kind: InstrumentKindAsyncUpDownCounter}, - {Kind: InstrumentKindAsyncGauge}, + {Kind: InstrumentKindUpDownCounter}, + {Kind: InstrumentKindHistogram}, + {Kind: InstrumentKindObservableCounter}, + {Kind: InstrumentKindObservableUpDownCounter}, + {Kind: InstrumentKindObservableGauge}, }, }, { @@ -277,49 +277,49 @@ func TestNewViewMatch(t *testing.T) { { Name: "Wrong Name", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "Wrong Description", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", - Kind: InstrumentKindAsyncUpDownCounter, + Kind: InstrumentKindObservableUpDownCounter, Unit: unit.Bytes, Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Dimensionless, Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: scope("Wrong Scope Name", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: scope("TestNewViewMatch", "v1.4.3", schemaURL), }, { Name: "foo", Description: "foo desc", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Unit: unit.Bytes, Scope: scope("TestNewViewMatch", "v0.1.0", "https://go.dev"), }, @@ -491,7 +491,7 @@ func ExampleNewView() { Name: "latency", Description: "request latency", Unit: unit.Milliseconds, - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Scope: instrumentation.Scope{ Name: "http", Version: "v0.34.0", @@ -522,7 +522,7 @@ func ExampleNewView_drop() { stream, _ := view(Instrument{ Name: "queries", - Kind: InstrumentKindSyncCounter, + Kind: InstrumentKindCounter, Scope: instrumentation.Scope{Name: "db", Version: "v0.4.0"}, }) fmt.Println("name:", stream.Name) From efd8a7df6d8bcfa5972b2ad6d990a22158d1e5f4 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Wed, 4 Jan 2023 12:56:59 -0800 Subject: [PATCH 355/886] OTLP exporter: Let final retry error include last retryable error message (#3514) * Let retry return the first retryable error * examples/otel-collector: use default collector port * use correct port * revert example change * tidy * changelog * lint * Address comments in PR. * Updated Changelog. * Fixes for PR. * merge changelog * remove one error Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + exporters/otlp/internal/retry/retry.go | 7 ++- exporters/otlp/internal/retry/retry_test.go | 49 ++++++++++++++++----- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08745581205..60003ffc014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, fixing random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- The OTLP exporter for traces and metrics will print the final retryable error message when attempts to retry time out. (#3514) - The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` diff --git a/exporters/otlp/internal/retry/retry.go b/exporters/otlp/internal/retry/retry.go index 3d43f7aea97..2d14d248336 100644 --- a/exporters/otlp/internal/retry/retry.go +++ b/exporters/otlp/internal/retry/retry.go @@ -119,8 +119,8 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { delay = throttle } - if err := waitFunc(ctx, delay); err != nil { - return err + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) } } } @@ -129,6 +129,9 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { // Allow override for testing. var waitFunc = wait +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. func wait(ctx context.Context, delay time.Duration) error { timer := time.NewTimer(delay) defer timer.Stop() diff --git a/exporters/otlp/internal/retry/retry_test.go b/exporters/otlp/internal/retry/retry_test.go index 2b2f92e69c9..61f84e8350d 100644 --- a/exporters/otlp/internal/retry/retry_test.go +++ b/exporters/otlp/internal/retry/retry_test.go @@ -32,19 +32,16 @@ func TestWait(t *testing.T) { expected error }{ { - ctx: context.Background(), - delay: time.Duration(0), - expected: nil, + ctx: context.Background(), + delay: time.Duration(0), }, { - ctx: context.Background(), - delay: time.Duration(1), - expected: nil, + ctx: context.Background(), + delay: time.Duration(1), }, { - ctx: context.Background(), - delay: time.Duration(-1), - expected: nil, + ctx: context.Background(), + delay: time.Duration(-1), }, { ctx: func() context.Context { @@ -59,7 +56,12 @@ func TestWait(t *testing.T) { } for _, test := range tests { - assert.Equal(t, test.expected, wait(test.ctx, test.delay)) + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } } } @@ -133,7 +135,7 @@ func TestBackoffRetry(t *testing.T) { origWait := waitFunc var done bool waitFunc = func(_ context.Context, d time.Duration) error { - delta := math.Ceil(float64(delay)*backoff.DefaultRandomizationFactor) - float64(delay) + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) assert.InDelta(t, delay, d, delta, "retry not backoffed") // Try twice to ensure call is attempted again after delay. if done { @@ -150,6 +152,31 @@ func TestBackoffRetry(t *testing.T) { }), assert.AnError) } +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { // Ensure the throttle delay is used by making longer than backoff delay. tDelay, bDelay := time.Hour, time.Nanosecond From e368276257de587c235e11531da66842a2582ae4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 5 Jan 2023 14:22:06 -0800 Subject: [PATCH 356/886] Create metric API Callback type (#3564) * Create metric API Callback type Document the type according the OTel specification requirements. * Update all impls of the metric API with new type * Add changes to changelog * Update PR number in changelog entry --- CHANGELOG.md | 4 ++++ metric/internal/global/meter.go | 2 +- metric/internal/global/meter_types_test.go | 2 +- metric/meter.go | 15 ++++++++++++++- metric/noop.go | 2 +- sdk/metric/meter.go | 8 ++------ sdk/metric/pipeline.go | 6 +++--- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60003ffc014..628f3aba84c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. This `Registration` can be used to unregister callbacks. (#3522) - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) +- Add the `Callback` function type to the `go.opentelemetry.io/otel/metric` package. + This new named function type is registered with a `Meter`. (#3564) ### Changed @@ -52,6 +54,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` +- Update the `RegisterCallback` method of the `Meter` in the `go.opentelemetry.io/otel/sdk/metric` package to accept the added `Callback` type instead of an inline function type definition. + The underlying type of a `Callback` is the same `func(context.Context)` that the method used to accept. (#3564) ### Deprecated diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 940728cb2ea..06de9176983 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -283,7 +283,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) return del.RegisterCallback(insts, f) diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index b77f7926840..6e49ce84f51 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -119,7 +119,7 @@ func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Op // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *testMeter) RegisterCallback(i []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { +func (m *testMeter) RegisterCallback(i []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { m.callbacks = append(m.callbacks, f) return testReg{ f: func(idx int) func() { diff --git a/metric/meter.go b/metric/meter.go index 83f2d6a8189..604254c10ab 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -106,9 +106,22 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. - RegisterCallback(instruments []instrument.Asynchronous, f func(context.Context)) (Registration, error) + RegisterCallback(instruments []instrument.Asynchronous, f Callback) (Registration, error) } +// Callback is a function registered with a Meter that makes observations for +// the set of instruments it is registered with. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Callbacks. Meaning, it should not report measurements for an instrument with +// the same attributes as another Callback will report. +// +// The function needs to be concurrent safe. +type Callback func(context.Context) + // Registration is an token representing the unique registration of a callback // for a set of instruments with a Meter. type Registration interface { diff --git a/metric/noop.go b/metric/noop.go index 568257c0964..0b0a9707d14 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -92,7 +92,7 @@ func (noopMeter) Float64ObservableGauge(string, ...instrument.Option) (asyncfloa } // RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) (Registration, error) { +func (noopMeter) RegisterCallback([]instrument.Asynchronous, Callback) (Registration, error) { return noopReg{}, nil } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index c82a4fb5f55..d28f53f0fdb 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -15,8 +15,6 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( - "context" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" @@ -143,7 +141,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f func(context.Context)) (metric.Registration, error) { +func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { for _, inst := range insts { // Only register if at least one instrument has a non-drop aggregation. // Otherwise, calling f during collection will be wasted computation. @@ -174,9 +172,7 @@ func (noopRegister) Unregister() error { return nil } -type callback func(context.Context) - -func (m *meter) registerCallback(c callback) (metric.Registration, error) { +func (m *meter) registerCallback(c metric.Callback) (metric.Registration, error) { return m.pipes.registerCallback(c), nil } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 17cdadf918c..4ebabc0c1d2 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -96,7 +96,7 @@ func (p *pipeline) addSync(scope instrumentation.Scope, iSync instrumentSync) { } // addCallback registers a callback to be run when `produce()` is called. -func (p *pipeline) addCallback(c callback) (unregister func()) { +func (p *pipeline) addCallback(c metric.Callback) (unregister func()) { p.Lock() defer p.Unlock() e := p.callbacks.PushBack(c) @@ -126,7 +126,7 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err for e := p.callbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) - f := e.Value.(callback) + f := e.Value.(metric.Callback) f(ctx) if err := ctx.Err(); err != nil { // This means the context expired before we finished running callbacks. @@ -447,7 +447,7 @@ func newPipelines(res *resource.Resource, readers []Reader, views []View) pipeli return pipes } -func (p pipelines) registerCallback(c callback) metric.Registration { +func (p pipelines) registerCallback(c metric.Callback) metric.Registration { unregs := make([]func(), len(p)) for i, pipe := range p { unregs[i] = pipe.addCallback(c) From 112fbaaba45749c14b5883c7d85cfc1489e9c161 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 5 Jan 2023 14:58:42 -0800 Subject: [PATCH 357/886] Add v1.13 semantic conventions (#3499) * WIP * Add NetConv unit tests * Add ServerRequest unit tests * Unit test ClientRequest * Remove unneeded * Unit test helper funcs * Add unit tests for remaining funcs * Update exported docs * Fix lint * Add changelog entry * Add Client/Server func to semconv/internal/v2 * Generate Client/Server func for semconv ver * Update RELEASING Add note about compatibility. Update example TAG. * Fix errors * Update changelog --- CHANGELOG.md | 12 + RELEASING.md | 11 +- internal/tools/semconvkit/main.go | 19 +- .../tools/semconvkit/templates/http.go.tmpl | 93 - .../templates/httpconv/http.go.tmpl | 135 ++ .../semconvkit/templates/netconv/net.go.tmpl | 66 + semconv/internal/v2/http.go | 380 ++++ semconv/internal/v2/http_test.go | 445 +++++ semconv/internal/v2/net.go | 324 +++ semconv/internal/v2/net_test.go | 344 ++++ semconv/v1.13.0/doc.go | 20 + semconv/v1.13.0/exception.go | 20 + semconv/v1.13.0/http.go | 21 + semconv/v1.13.0/httpconv/http.go | 135 ++ semconv/v1.13.0/netconv/net.go | 66 + semconv/v1.13.0/resource.go | 1049 ++++++++++ semconv/v1.13.0/schema.go | 20 + semconv/v1.13.0/trace.go | 1772 +++++++++++++++++ 18 files changed, 4832 insertions(+), 100 deletions(-) create mode 100644 internal/tools/semconvkit/templates/httpconv/http.go.tmpl create mode 100644 internal/tools/semconvkit/templates/netconv/net.go.tmpl create mode 100644 semconv/internal/v2/http.go create mode 100644 semconv/internal/v2/http_test.go create mode 100644 semconv/internal/v2/net.go create mode 100644 semconv/internal/v2/net_test.go create mode 100644 semconv/v1.13.0/doc.go create mode 100644 semconv/v1.13.0/exception.go create mode 100644 semconv/v1.13.0/http.go create mode 100644 semconv/v1.13.0/httpconv/http.go create mode 100644 semconv/v1.13.0/netconv/net.go create mode 100644 semconv/v1.13.0/resource.go create mode 100644 semconv/v1.13.0/schema.go create mode 100644 semconv/v1.13.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 628f3aba84c..b8e08ec9007 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) - The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) - The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) +- Add the `go.opentelemetry.io/otel/semconv/v1.13.0` package. + The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) + - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. + - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. ### Changed diff --git a/RELEASING.md b/RELEASING.md index 71e57625479..77d56c93651 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -6,20 +6,25 @@ New versions of the [OpenTelemetry specification] mean new versions of the `semc The `semconv-generate` make target is used for this. 1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag. -2. Run the `make semconv-generate ...` target from this repository. +2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` +3. Run the `make semconv-generate ...` target from this repository. For example, ```sh -export TAG="v1.7.0" # Change to the release version you are generating. +export TAG="v1.13.0" # Change to the release version you are generating. export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" -git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" +git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" -b "$TAG" +docker pull otel/semconvgen:latest make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. ``` This should create a new sub-package of [`semconv`](./semconv). Ensure things look correct before submitting a pull request to include the addition. +**Note**, the generation code was changed to generate versions >= 1.13. +To generate versions prior to this, checkout the old release of this repository (i.e. [2fe8861](https://github.com/open-telemetry/opentelemetry-go/commit/2fe8861a24e20088c065b116089862caf9e3cd8b)). + ## Pre-Release First, decide which module sets will be released and update their versions diff --git a/internal/tools/semconvkit/main.go b/internal/tools/semconvkit/main.go index 913a9ac126f..d3d1c1a2e5f 100644 --- a/internal/tools/semconvkit/main.go +++ b/internal/tools/semconvkit/main.go @@ -21,6 +21,7 @@ package main import ( "embed" "flag" + "fmt" "log" "os" "path/filepath" @@ -32,7 +33,7 @@ var ( out = flag.String("output", "./", "output directory") tag = flag.String("tag", "", "OpenTelemetry tagged version") - //go:embed templates/*.tmpl + //go:embed templates/*.tmpl templates/netconv/*.tmpl templates/httpconv/*.tmpl rootFS embed.FS ) @@ -48,8 +49,8 @@ func (sc SemanticConventions) SemVer() string { } // render renders all templates to the dest directory using the data. -func render(dest string, data *SemanticConventions) error { - tmpls, err := template.ParseFS(rootFS, "templates/*.tmpl") +func render(src, dest string, data *SemanticConventions) error { + tmpls, err := template.ParseFS(rootFS, src) if err != nil { return err } @@ -78,7 +79,17 @@ func main() { sc := &SemanticConventions{TagVer: *tag} - if err := render(*out, sc); err != nil { + if err := render("templates/*.tmpl", *out, sc); err != nil { + log.Fatal(err) + } + + dest := fmt.Sprintf("%s/netconv", *out) + if err := render("templates/netconv/*.tmpl", dest, sc); err != nil { + log.Fatal(err) + } + + dest = fmt.Sprintf("%s/httpconv", *out) + if err := render("templates/httpconv/*.tmpl", dest, sc); err != nil { log.Fatal(err) } } diff --git a/internal/tools/semconvkit/templates/http.go.tmpl b/internal/tools/semconvkit/templates/http.go.tmpl index e1334d501d4..06d08932590 100644 --- a/internal/tools/semconvkit/templates/http.go.tmpl +++ b/internal/tools/semconvkit/templates/http.go.tmpl @@ -14,101 +14,8 @@ package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" -import ( - "net/http" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv/internal" - "go.opentelemetry.io/otel/trace" -) - // HTTP scheme attributes. var ( HTTPSchemeHTTP = HTTPSchemeKey.String("http") HTTPSchemeHTTPS = HTTPSchemeKey.String("https") ) - -var sc = &internal.SemanticConventions{ - EnduserIDKey: EnduserIDKey, - HTTPClientIPKey: HTTPClientIPKey, - HTTPFlavorKey: HTTPFlavorKey, - HTTPHostKey: HTTPHostKey, - HTTPMethodKey: HTTPMethodKey, - HTTPRequestContentLengthKey: HTTPRequestContentLengthKey, - HTTPRouteKey: HTTPRouteKey, - HTTPSchemeHTTP: HTTPSchemeHTTP, - HTTPSchemeHTTPS: HTTPSchemeHTTPS, - HTTPServerNameKey: HTTPServerNameKey, - HTTPStatusCodeKey: HTTPStatusCodeKey, - HTTPTargetKey: HTTPTargetKey, - HTTPURLKey: HTTPURLKey, - HTTPUserAgentKey: HTTPUserAgentKey, - NetHostIPKey: NetHostIPKey, - NetHostNameKey: NetHostNameKey, - NetHostPortKey: NetHostPortKey, - NetPeerIPKey: NetPeerIPKey, - NetPeerNameKey: NetPeerNameKey, - NetPeerPortKey: NetPeerPortKey, - NetTransportIP: NetTransportIP, - NetTransportOther: NetTransportOther, - NetTransportTCP: NetTransportTCP, - NetTransportUDP: NetTransportUDP, - NetTransportUnix: NetTransportUnix, -} - -// NetAttributesFromHTTPRequest generates attributes of the net -// namespace as specified by the OpenTelemetry specification for a -// span. The network parameter is a string that net.Dial function -// from standard library can understand. -func NetAttributesFromHTTPRequest(network string, request *http.Request) []attribute.KeyValue { - return sc.NetAttributesFromHTTPRequest(network, request) -} - -// EndUserAttributesFromHTTPRequest generates attributes of the -// enduser namespace as specified by the OpenTelemetry specification -// for a span. -func EndUserAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - return sc.EndUserAttributesFromHTTPRequest(request) -} - -// HTTPClientAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the client side. -func HTTPClientAttributesFromHTTPRequest(request *http.Request) []attribute.KeyValue { - return sc.HTTPClientAttributesFromHTTPRequest(request) -} - -// HTTPServerMetricAttributesFromHTTPRequest generates low-cardinality attributes -// to be used with server-side HTTP metrics. -func HTTPServerMetricAttributesFromHTTPRequest(serverName string, request *http.Request) []attribute.KeyValue { - return sc.HTTPServerMetricAttributesFromHTTPRequest(serverName, request) -} - -// HTTPServerAttributesFromHTTPRequest generates attributes of the -// http namespace as specified by the OpenTelemetry specification for -// a span on the server side. Currently, only basic authentication is -// supported. -func HTTPServerAttributesFromHTTPRequest(serverName, route string, request *http.Request) []attribute.KeyValue { - return sc.HTTPServerAttributesFromHTTPRequest(serverName, route, request) -} - -// HTTPAttributesFromHTTPStatusCode generates attributes of the http -// namespace as specified by the OpenTelemetry specification for a -// span. -func HTTPAttributesFromHTTPStatusCode(code int) []attribute.KeyValue { - return sc.HTTPAttributesFromHTTPStatusCode(code) -} - -// SpanStatusFromHTTPStatusCode generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -func SpanStatusFromHTTPStatusCode(code int) (codes.Code, string) { - return internal.SpanStatusFromHTTPStatusCode(code) -} - -// SpanStatusFromHTTPStatusCodeAndSpanKind generates a status code and a message -// as specified by the OpenTelemetry specification for a span. -// Exclude 4xx for SERVER to set the appropriate status. -func SpanStatusFromHTTPStatusCodeAndSpanKind(code int, spanKind trace.SpanKind) (codes.Code, string) { - return internal.SpanStatusFromHTTPStatusCodeAndSpanKind(code, spanKind) -} diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl new file mode 100644 index 00000000000..4d9244aa02d --- /dev/null +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/internal/tools/semconvkit/templates/netconv/net.go.tmpl b/internal/tools/semconvkit/templates/netconv/net.go.tmpl new file mode 100644 index 00000000000..02b5f923a19 --- /dev/null +++ b/internal/tools/semconvkit/templates/netconv/net.go.tmpl @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/internal/v2/http.go b/semconv/internal/v2/http.go new file mode 100644 index 00000000000..6989391cfbd --- /dev/null +++ b/semconv/internal/v2/http.go @@ -0,0 +1,380 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v2" + +import ( + "fmt" + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +// HTTPConv are the HTTP semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type HTTPConv struct { + NetConv *NetConv + + EnduserIDKey attribute.Key + HTTPClientIPKey attribute.Key + HTTPFlavorKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPResponseContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + HTTPUserAgentKey attribute.Key +} + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. The following attributes are returned if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func (c *HTTPConv) ClientResponse(resp http.Response) []attribute.KeyValue { + var n int + if resp.StatusCode > 0 { + n++ + } + if resp.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + if resp.StatusCode > 0 { + attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) + } + if resp.ContentLength > 0 { + attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) + } + return attrs +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { + n := 3 // URL, peer name, proto, and method. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.TLS != nil, p) + if port > 0 { + n++ + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + if req.ContentLength > 0 { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.proto(req.Proto)) + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, c.HTTPURLKey.String(u)) + + attrs = append(attrs, c.NetConv.PeerName(peer)) + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + if useragent != "" { + attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) + } + + if l := req.ContentLength; l > 0 { + attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + return attrs +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func (c *HTTPConv) ServerRequest(req *http.Request) []attribute.KeyValue { + n := 5 // Method, scheme, target, proto, and host name. + host, p := splitHostPort(req.Host) + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + peer, peerPort := splitHostPort(req.RemoteAddr) + if peer != "" { + n++ + if peerPort > 0 { + n++ + } + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.proto(req.Proto)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if req.URL != nil { + attrs = append(attrs, c.HTTPTargetKey.String(req.URL.RequestURI())) + } else { + // This should never occur if the request was generated by the net/http + // package. Fail gracefully, if it does though. + attrs = append(attrs, c.HTTPTargetKey.String(req.RequestURI)) + } + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) + if peerPort > 0 { + attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, c.HTTPUserAgentKey.String(useragent)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + if clientIP != "" { + attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) + } + + return attrs +} + +func (c *HTTPConv) method(method string) attribute.KeyValue { + if method == "" { + return c.HTTPMethodKey.String(http.MethodGet) + } + return c.HTTPMethodKey.String(method) +} + +func (c *HTTPConv) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return c.HTTPSchemeHTTPS + } + return c.HTTPSchemeHTTP +} + +func (c *HTTPConv) proto(proto string) attribute.KeyValue { + switch proto { + case "HTTP/1.0": + return c.HTTPFlavorKey.String("1.0") + case "HTTP/1.1": + return c.HTTPFlavorKey.String("1.1") + case "HTTP/2": + return c.HTTPFlavorKey.String("2.0") + case "HTTP/3": + return c.HTTPFlavorKey.String("3.0") + default: + return c.HTTPFlavorKey.String(proto) + } +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +// Return the request host and port from the first non-empty source. +func firstHostPort(source ...string) (host string, port int) { + for _, hostport := range source { + host, port = splitHostPort(hostport) + if host != "" || port > 0 { + break + } + } + return +} + +// RequestHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) RequestHeader(h http.Header) []attribute.KeyValue { + return c.header("http.request.header", h) +} + +// ResponseHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue { + return c.header("http.response.header", h) +} + +func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue { + key := func(k string) attribute.Key { + k = strings.ToLower(k) + k = strings.ReplaceAll(k, "-", "_") + k = fmt.Sprintf("%s.%s", prefix, k) + return attribute.Key(k) + } + + attrs := make([]attribute.KeyValue, 0, len(h)) + for k, v := range h { + attrs = append(attrs, key(k).StringSlice(v)) + } + return attrs +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + return stat, "" +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + + if code/100 == 4 { + return codes.Unset, "" + } + return stat, "" +} + +type codeRange struct { + fromInclusive int + toInclusive int +} + +func (r codeRange) contains(code int) bool { + return r.fromInclusive <= code && code <= r.toInclusive +} + +var validRangesPerCategory = map[int][]codeRange{ + 1: { + {http.StatusContinue, http.StatusEarlyHints}, + }, + 2: { + {http.StatusOK, http.StatusAlreadyReported}, + {http.StatusIMUsed, http.StatusIMUsed}, + }, + 3: { + {http.StatusMultipleChoices, http.StatusUseProxy}, + {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, + }, + 4: { + {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… + {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, + {http.StatusPreconditionRequired, http.StatusTooManyRequests}, + {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, + {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, + }, + 5: { + {http.StatusInternalServerError, http.StatusLoopDetected}, + {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, + }, +} + +// validateHTTPStatusCode validates the HTTP status code and returns +// corresponding span status code. If the `code` is not a valid HTTP status +// code, returns span status Error and false. +func validateHTTPStatusCode(code int) (codes.Code, bool) { + category := code / 100 + ranges, ok := validRangesPerCategory[category] + if !ok { + return codes.Error, false + } + ok = false + for _, crange := range ranges { + ok = crange.contains(code) + if ok { + break + } + } + if !ok { + return codes.Error, false + } + if category > 0 && category < 4 { + return codes.Unset, true + } + return codes.Error, true +} diff --git a/semconv/internal/v2/http_test.go b/semconv/internal/v2/http_test.go new file mode 100644 index 00000000000..edfc7b50f27 --- /dev/null +++ b/semconv/internal/v2/http_test.go @@ -0,0 +1,445 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +var hc = &HTTPConv{ + NetConv: nc, + + EnduserIDKey: attribute.Key("enduser.id"), + HTTPClientIPKey: attribute.Key("http.client_ip"), + HTTPFlavorKey: attribute.Key("http.flavor"), + HTTPMethodKey: attribute.Key("http.method"), + HTTPRequestContentLengthKey: attribute.Key("http.request_content_length"), + HTTPResponseContentLengthKey: attribute.Key("http.response_content_length"), + HTTPRouteKey: attribute.Key("http.route"), + HTTPSchemeHTTP: attribute.String("http.scheme", "http"), + HTTPSchemeHTTPS: attribute.String("http.scheme", "https"), + HTTPStatusCodeKey: attribute.Key("http.status_code"), + HTTPTargetKey: attribute.Key("http.target"), + HTTPURLKey: attribute.Key("http.url"), + HTTPUserAgentKey: attribute.Key("http.user_agent"), +} + +func TestHTTPClientResponse(t *testing.T) { + const stat, n = 201, 397 + resp := http.Response{ + StatusCode: stat, + ContentLength: n, + } + got := hc.ClientResponse(resp) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.Key("http.status_code").Int(stat), + attribute.Key("http.response_content_length").Int(n), + }, got) +} + +func TestHTTPClientRequest(t *testing.T) { + const ( + user = "alice" + n = 128 + agent = "Go-http-client/1.1" + ) + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "http", + Host: "127.0.0.1:8080", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + Header: http.Header{ + "User-Agent": []string{agent}, + }, + ContentLength: n, + } + req.SetBasicAuth(user, "pswrd") + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.url", "http://127.0.0.1:8080/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + attribute.Int("net.peer.port", 8080), + attribute.String("http.user_agent", agent), + attribute.Int("http.request_content_length", n), + attribute.String("enduser.id", user), + }, + hc.ClientRequest(req), + ) +} + +func TestHTTPClientRequestRequired(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ClientRequest(req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", ""), + attribute.String("http.url", ""), + attribute.String("net.peer.name", ""), + } + assert.Equal(t, want, got) +} + +func TestHTTPServerRequest(t *testing.T) { + got := make(chan *http.Request, 1) + handler := func(w http.ResponseWriter, r *http.Request) { + got <- r + w.WriteHeader(http.StatusOK) + } + + srv := httptest.NewServer(http.HandlerFunc(handler)) + defer srv.Close() + + srvURL, err := url.Parse(srv.URL) + require.NoError(t, err) + srvPort, err := strconv.ParseInt(srvURL.Port(), 10, 32) + require.NoError(t, err) + + resp, err := srv.Client().Get(srv.URL) + require.NoError(t, err) + require.NoError(t, resp.Body.Close()) + + req := <-got + peer, peerPort := splitHostPort(req.RemoteAddr) + + const user = "alice" + req.SetBasicAuth(user, "pswrd") + + const clientIP = "127.0.0.5" + req.Header.Add("X-Forwarded-For", clientIP) + + assert.ElementsMatch(t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", "/"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", "1.1"), + attribute.String("net.host.name", srvURL.Hostname()), + attribute.Int("net.host.port", int(srvPort)), + attribute.String("net.sock.peer.addr", peer), + attribute.Int("net.sock.peer.port", peerPort), + attribute.String("http.user_agent", "Go-http-client/1.1"), + attribute.String("enduser.id", user), + attribute.String("http.client_ip", clientIP), + }, + hc.ServerRequest(req)) +} + +func TestHTTPServerRequestFailsGracefully(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ServerRequest(req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.target", ""), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", ""), + attribute.String("net.host.name", ""), + } + assert.ElementsMatch(t, want, got) +} + +func TestMethod(t *testing.T) { + assert.Equal(t, attribute.String("http.method", "POST"), hc.method("POST")) + assert.Equal(t, attribute.String("http.method", "GET"), hc.method("")) + assert.Equal(t, attribute.String("http.method", "garbage"), hc.method("garbage")) +} + +func TestScheme(t *testing.T) { + assert.Equal(t, attribute.String("http.scheme", "http"), hc.scheme(false)) + assert.Equal(t, attribute.String("http.scheme", "https"), hc.scheme(true)) +} + +func TestProto(t *testing.T) { + tests := map[string]string{ + "HTTP/1.0": "1.0", + "HTTP/1.1": "1.1", + "HTTP/2": "2.0", + "HTTP/3": "3.0", + "SPDY": "SPDY", + "QUIC": "QUIC", + "other": "other", + } + + for proto, want := range tests { + expect := attribute.String("http.flavor", want) + assert.Equal(t, expect, hc.proto(proto), proto) + } +} + +func TestServerClientIP(t *testing.T) { + tests := []struct { + xForwardedFor string + want string + }{ + {"", ""}, + {"127.0.0.1", "127.0.0.1"}, + {"127.0.0.1,127.0.0.5", "127.0.0.1"}, + } + for _, test := range tests { + got := serverClientIP(test.xForwardedFor) + assert.Equal(t, test.want, got, test.xForwardedFor) + } +} + +func TestRequiredHTTPPort(t *testing.T) { + tests := []struct { + https bool + port int + want int + }{ + {true, 443, -1}, + {true, 80, 80}, + {true, 8081, 8081}, + {false, 443, 443}, + {false, 80, -1}, + {false, 8080, 8080}, + } + for _, test := range tests { + got := requiredHTTPPort(test.https, test.port) + assert.Equal(t, test.want, got, test.https, test.port) + } +} + +func TestFirstHostPort(t *testing.T) { + host, port := "127.0.0.1", 8080 + hostport := "127.0.0.1:8080" + sources := [][]string{ + {hostport}, + {"", hostport}, + {"", "", hostport}, + {"", "", hostport, ""}, + {"", "", hostport, "127.0.0.3:80"}, + } + + for _, src := range sources { + h, p := firstHostPort(src...) + assert.Equal(t, host, h, src) + assert.Equal(t, port, p, src) + } +} + +func TestRequestHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.RequestHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.request.header.ips", ips), + attribute.StringSlice("http.request.header.user", user), + }, got) +} + +func TestReponseHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.ResponseHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.response.header.ips", ips), + attribute.StringSlice("http.response.header.user", user), + }, got) +} + +func TestClientStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Error, false}, + {http.StatusUnauthorized, codes.Error, false}, + {http.StatusPaymentRequired, codes.Error, false}, + {http.StatusForbidden, codes.Error, false}, + {http.StatusNotFound, codes.Error, false}, + {http.StatusMethodNotAllowed, codes.Error, false}, + {http.StatusNotAcceptable, codes.Error, false}, + {http.StatusProxyAuthRequired, codes.Error, false}, + {http.StatusRequestTimeout, codes.Error, false}, + {http.StatusConflict, codes.Error, false}, + {http.StatusGone, codes.Error, false}, + {http.StatusLengthRequired, codes.Error, false}, + {http.StatusPreconditionFailed, codes.Error, false}, + {http.StatusRequestEntityTooLarge, codes.Error, false}, + {http.StatusRequestURITooLong, codes.Error, false}, + {http.StatusUnsupportedMediaType, codes.Error, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Error, false}, + {http.StatusExpectationFailed, codes.Error, false}, + {http.StatusTeapot, codes.Error, false}, + {http.StatusMisdirectedRequest, codes.Error, false}, + {http.StatusUnprocessableEntity, codes.Error, false}, + {http.StatusLocked, codes.Error, false}, + {http.StatusFailedDependency, codes.Error, false}, + {http.StatusTooEarly, codes.Error, false}, + {http.StatusUpgradeRequired, codes.Error, false}, + {http.StatusPreconditionRequired, codes.Error, false}, + {http.StatusTooManyRequests, codes.Error, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Error, false}, + {http.StatusUnavailableForLegalReasons, codes.Error, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ClientStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} + +func TestServerStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Unset, false}, + {http.StatusUnauthorized, codes.Unset, false}, + {http.StatusPaymentRequired, codes.Unset, false}, + {http.StatusForbidden, codes.Unset, false}, + {http.StatusNotFound, codes.Unset, false}, + {http.StatusMethodNotAllowed, codes.Unset, false}, + {http.StatusNotAcceptable, codes.Unset, false}, + {http.StatusProxyAuthRequired, codes.Unset, false}, + {http.StatusRequestTimeout, codes.Unset, false}, + {http.StatusConflict, codes.Unset, false}, + {http.StatusGone, codes.Unset, false}, + {http.StatusLengthRequired, codes.Unset, false}, + {http.StatusPreconditionFailed, codes.Unset, false}, + {http.StatusRequestEntityTooLarge, codes.Unset, false}, + {http.StatusRequestURITooLong, codes.Unset, false}, + {http.StatusUnsupportedMediaType, codes.Unset, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Unset, false}, + {http.StatusExpectationFailed, codes.Unset, false}, + {http.StatusTeapot, codes.Unset, false}, + {http.StatusMisdirectedRequest, codes.Unset, false}, + {http.StatusUnprocessableEntity, codes.Unset, false}, + {http.StatusLocked, codes.Unset, false}, + {http.StatusFailedDependency, codes.Unset, false}, + {http.StatusTooEarly, codes.Unset, false}, + {http.StatusUpgradeRequired, codes.Unset, false}, + {http.StatusPreconditionRequired, codes.Unset, false}, + {http.StatusTooManyRequests, codes.Unset, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Unset, false}, + {http.StatusUnavailableForLegalReasons, codes.Unset, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ServerStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} diff --git a/semconv/internal/v2/net.go b/semconv/internal/v2/net.go new file mode 100644 index 00000000000..4a711133a02 --- /dev/null +++ b/semconv/internal/v2/net.go @@ -0,0 +1,324 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v2" + +import ( + "net" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" +) + +// NetConv are the network semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type NetConv struct { + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetSockFamilyKey attribute.Key + NetSockPeerAddrKey attribute.Key + NetSockPeerPortKey attribute.Key + NetSockHostAddrKey attribute.Key + NetSockHostPortKey attribute.Key + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportInProc attribute.KeyValue +} + +func (c *NetConv) Transport(network string) attribute.KeyValue { + switch network { + case "tcp", "tcp4", "tcp6": + return c.NetTransportTCP + case "udp", "udp4", "udp6": + return c.NetTransportUDP + case "unix", "unixgram", "unixpacket": + return c.NetTransportInProc + default: + // "ip:*", "ip4:*", and "ip6:*" all are considered other. + return c.NetTransportOther + } +} + +// Host returns attributes for a network host address. +func (c *NetConv) Host(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.HostName(h)) + if p > 0 { + attrs = append(attrs, c.HostPort(int(p))) + } + return attrs +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue { + if ln == nil { + return c.Host(address) + } + + lAddr := ln.Addr() + if lAddr == nil { + return c.Host(address) + } + + hostName, hostPort := splitHostPort(address) + sockHostAddr, sockHostPort := splitHostPort(lAddr.String()) + network := lAddr.Network() + sockFamily := family(network, sockHostAddr) + + n := nonZeroStr(hostName, network, sockHostAddr, sockFamily) + n += positiveInt(hostPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if hostName != "" { + attr = append(attr, c.HostName(hostName)) + if hostPort > 0 { + // Only if net.host.name is set should net.host.port be. + attr = append(attr, c.HostPort(hostPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func (c *NetConv) HostName(name string) attribute.KeyValue { + return c.NetHostNameKey.String(name) +} + +func (c *NetConv) HostPort(port int) attribute.KeyValue { + return c.NetHostPortKey.Int(port) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue { + if conn == nil { + return c.Peer(address) + } + + lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr() + + var network string + switch { + case lAddr != nil: + network = lAddr.Network() + case rAddr != nil: + network = rAddr.Network() + default: + return c.Peer(address) + } + + peerName, peerPort := splitHostPort(address) + var ( + sockFamily string + sockPeerAddr string + sockPeerPort int + sockHostAddr string + sockHostPort int + ) + + if lAddr != nil { + sockHostAddr, sockHostPort = splitHostPort(lAddr.String()) + } + + if rAddr != nil { + sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String()) + } + + switch { + case sockHostAddr != "": + sockFamily = family(network, sockHostAddr) + case sockPeerAddr != "": + sockFamily = family(network, sockPeerAddr) + } + + n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily) + n += positiveInt(peerPort, sockPeerPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if peerName != "" { + attr = append(attr, c.PeerName(peerName)) + if peerPort > 0 { + // Only if net.peer.name is set should net.peer.port be. + attr = append(attr, c.PeerPort(peerPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockPeerAddr != "" { + attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr)) + if sockPeerPort > 0 { + // Only if net.sock.peer.addr is set should net.sock.peer.port be. + attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort)) + } + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func family(network, address string) string { + switch network { + case "unix", "unixgram", "unixpacket": + return "unix" + default: + if ip := net.ParseIP(address); ip != nil { + if ip.To4() == nil { + return "inet6" + } + return "inet" + } + } + return "" +} + +func nonZeroStr(strs ...string) int { + var n int + for _, str := range strs { + if str != "" { + n++ + } + } + return n +} + +func positiveInt(ints ...int) int { + var n int + for _, i := range ints { + if i > 0 { + n++ + } + } + return n +} + +// Peer returns attributes for a network peer address. +func (c *NetConv) Peer(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.PeerName(h)) + if p > 0 { + attrs = append(attrs, c.PeerPort(int(p))) + } + return attrs +} + +func (c *NetConv) PeerName(name string) attribute.KeyValue { + return c.NetPeerNameKey.String(name) +} + +func (c *NetConv) PeerPort(port int) attribute.KeyValue { + return c.NetPeerPortKey.Int(port) +} + +func (c *NetConv) SockPeerAddr(addr string) attribute.KeyValue { + return c.NetSockPeerAddrKey.String(addr) +} + +func (c *NetConv) SockPeerPort(port int) attribute.KeyValue { + return c.NetSockPeerPortKey.Int(port) +} + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} diff --git a/semconv/internal/v2/net_test.go b/semconv/internal/v2/net_test.go new file mode 100644 index 00000000000..e1e32469231 --- /dev/null +++ b/semconv/internal/v2/net_test.go @@ -0,0 +1,344 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" +) + +const ( + addr = "127.0.0.1" + port = 1834 +) + +var nc = &NetConv{ + NetHostNameKey: attribute.Key("net.host.name"), + NetHostPortKey: attribute.Key("net.host.port"), + NetPeerNameKey: attribute.Key("net.peer.name"), + NetPeerPortKey: attribute.Key("net.peer.port"), + NetSockPeerAddrKey: attribute.Key("net.sock.peer.addr"), + NetSockPeerPortKey: attribute.Key("net.sock.peer.port"), + NetTransportOther: attribute.String("net.transport", "other"), + NetTransportTCP: attribute.String("net.transport", "ip_tcp"), + NetTransportUDP: attribute.String("net.transport", "ip_udp"), + NetTransportInProc: attribute.String("net.transport", "inproc"), +} + +func TestNetTransport(t *testing.T) { + transports := map[string]attribute.KeyValue{ + "tcp": attribute.String("net.transport", "ip_tcp"), + "tcp4": attribute.String("net.transport", "ip_tcp"), + "tcp6": attribute.String("net.transport", "ip_tcp"), + "udp": attribute.String("net.transport", "ip_udp"), + "udp4": attribute.String("net.transport", "ip_udp"), + "udp6": attribute.String("net.transport", "ip_udp"), + "unix": attribute.String("net.transport", "inproc"), + "unixgram": attribute.String("net.transport", "inproc"), + "unixpacket": attribute.String("net.transport", "inproc"), + "ip:1": attribute.String("net.transport", "other"), + "ip:icmp": attribute.String("net.transport", "other"), + "ip4:proto": attribute.String("net.transport", "other"), + "ip6:proto": attribute.String("net.transport", "other"), + } + + for network, want := range transports { + assert.Equal(t, want, nc.Transport(network)) + } +} + +func TestNetServerNilListener(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, nil) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type listener struct{ net.Listener } + +func (listener) Addr() net.Addr { return nil } + +func TestNetServerNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, listener{}) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPListener() (net.Listener, error) { + return net.Listen("tcp4", "127.0.0.1:0") +} + +func TestNetServerTCP(t *testing.T) { + ln, err := newTCPListener() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + + host, pStr, err := net.SplitHostPort(ln.Addr().String()) + require.NoError(t, err) + port, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Server("example.com:8080", ln) + expected := []attribute.KeyValue{ + nc.HostName("example.com"), + nc.HostPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockHostAddrKey.String(host), + nc.NetSockHostPortKey.Int(port), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetHost(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + }}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + nc.HostPort(9090), + }}, + }, nc.Host) +} + +func TestNetHostName(t *testing.T) { + expected := attribute.Key("net.host.name").String(addr) + assert.Equal(t, expected, nc.HostName(addr)) +} + +func TestNetHostPort(t *testing.T) { + expected := attribute.Key("net.host.port").Int(port) + assert.Equal(t, expected, nc.HostPort(port)) +} + +func TestNetClientNilConn(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, nil) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type conn struct{ net.Conn } + +func (conn) LocalAddr() net.Addr { return nil } +func (conn) RemoteAddr() net.Addr { return nil } + +func TestNetClientNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, conn{}) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPConn() (net.Conn, net.Listener, error) { + ln, err := newTCPListener() + if err != nil { + return nil, nil, err + } + + conn, err := net.Dial("tcp4", ln.Addr().String()) + if err != nil { + _ = ln.Close() + return nil, nil, err + } + + return conn, ln, nil +} + +func TestNetClientTCP(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + lHost, pStr, err := net.SplitHostPort(conn.LocalAddr().String()) + require.NoError(t, err) + lPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + nc.NetSockHostAddrKey.String(lHost), + nc.NetSockHostPortKey.Int(lPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type remoteOnlyConn struct{ net.Conn } + +func (remoteOnlyConn) LocalAddr() net.Addr { return nil } + +func TestNetClientTCPNilLocal(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + conn = remoteOnlyConn{conn} + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetPeer(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "example.com", expected: []attribute.KeyValue{ + nc.PeerName("example.com"), + }}, + {address: "/tmp/file", expected: []attribute.KeyValue{ + nc.PeerName("/tmp/file"), + }}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + }}, + {address: ":9090", expected: nil}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + nc.PeerPort(9090), + }}, + }, nc.Peer) +} + +func TestNetPeerName(t *testing.T) { + expected := attribute.Key("net.peer.name").String(addr) + assert.Equal(t, expected, nc.PeerName(addr)) +} + +func TestNetPeerPort(t *testing.T) { + expected := attribute.Key("net.peer.port").Int(port) + assert.Equal(t, expected, nc.PeerPort(port)) +} + +func TestNetSockPeerName(t *testing.T) { + expected := attribute.Key("net.sock.peer.addr").String(addr) + assert.Equal(t, expected, nc.SockPeerAddr(addr)) +} + +func TestNetSockPeerPort(t *testing.T) { + expected := attribute.Key("net.sock.peer.port").Int(port) + assert.Equal(t, expected, nc.SockPeerPort(port)) +} + +func TestFamily(t *testing.T) { + tests := []struct { + network string + address string + expect string + }{ + {"", "", ""}, + {"unix", "", "unix"}, + {"unix", "gibberish", "unix"}, + {"unixgram", "", "unix"}, + {"unixgram", "gibberish", "unix"}, + {"unixpacket", "gibberish", "unix"}, + {"tcp", "123.0.2.8", "inet"}, + {"tcp", "gibberish", ""}, + {"", "123.0.2.8", "inet"}, + {"", "gibberish", ""}, + {"tcp", "fe80::1", "inet6"}, + {"", "fe80::1", "inet6"}, + } + + for _, test := range tests { + got := family(test.network, test.address) + assert.Equal(t, test.expect, got, test.network+"/"+test.address) + } +} + +func TestSplitHostPort(t *testing.T) { + tests := []struct { + hostport string + host string + port int + }{ + {"", "", -1}, + {":8080", "", 8080}, + {"127.0.0.1", "127.0.0.1", -1}, + {"www.example.com", "www.example.com", -1}, + {"127.0.0.1%25en0", "127.0.0.1%25en0", -1}, + {"[]", "", -1}, // Ensure this doesn't panic. + {"[fe80::1", "", -1}, + {"[fe80::1]", "fe80::1", -1}, + {"[fe80::1%25en0]", "fe80::1%25en0", -1}, + {"[fe80::1]:8080", "fe80::1", 8080}, + {"[fe80::1]::", "", -1}, // Too many colons. + {"127.0.0.1:", "127.0.0.1", -1}, + {"127.0.0.1:port", "127.0.0.1", -1}, + {"127.0.0.1:8080", "127.0.0.1", 8080}, + {"www.example.com:8080", "www.example.com", 8080}, + {"127.0.0.1%25en0:8080", "127.0.0.1%25en0", 8080}, + } + + for _, test := range tests { + h, p := splitHostPort(test.hostport) + assert.Equal(t, test.host, h, test.hostport) + assert.Equal(t, test.port, p, test.hostport) + } +} + +type addrTest struct { + address string + expected []attribute.KeyValue +} + +func testAddrs(t *testing.T, tests []addrTest, f func(string) []attribute.KeyValue) { + t.Helper() + + for _, test := range tests { + got := f(test.address) + assert.Equal(t, cap(test.expected), cap(got), "slice capacity") + assert.ElementsMatch(t, test.expected, got, test.address) + } +} diff --git a/semconv/v1.13.0/doc.go b/semconv/v1.13.0/doc.go new file mode 100644 index 00000000000..0cb2aabc789 --- /dev/null +++ b/semconv/v1.13.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.13.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" diff --git a/semconv/v1.13.0/exception.go b/semconv/v1.13.0/exception.go new file mode 100644 index 00000000000..9d343368d75 --- /dev/null +++ b/semconv/v1.13.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.13.0/http.go b/semconv/v1.13.0/http.go new file mode 100644 index 00000000000..dcbc5a59b4d --- /dev/null +++ b/semconv/v1.13.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.13.0/httpconv/http.go b/semconv/v1.13.0/httpconv/http.go new file mode 100644 index 00000000000..9ba94c9e1e1 --- /dev/null +++ b/semconv/v1.13.0/httpconv/http.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.13.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.13.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.13.0/netconv/net.go b/semconv/v1.13.0/netconv/net.go new file mode 100644 index 00000000000..6c9c6a500e8 --- /dev/null +++ b/semconv/v1.13.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.13.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.13.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.13.0/resource.go b/semconv/v1.13.0/resource.go new file mode 100644 index 00000000000..9a937fe428d --- /dev/null +++ b/semconv/v1.13.0/resource.go @@ -0,0 +1,1049 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (navigator.userAgentData.brands). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (navigator.userAgentData.platform). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [os.type and os.name attributes](./os.md). However, for consistency, the values + // in the `browser.platform` attribute should capture the exact value that the + // user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // Full user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // Parent Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.13.0/schema.go b/semconv/v1.13.0/schema.go new file mode 100644 index 00000000000..1f4dfb8c65f --- /dev/null +++ b/semconv/v1.13.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.13.0" diff --git a/semconv/v1.13.0/trace.go b/semconv/v1.13.0/trace.go new file mode 100644 index 00000000000..7458337627e --- /dev/null +++ b/semconv/v1.13.0/trace.go @@ -0,0 +1,1772 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.13.0" + +import "go.opentelemetry.io/otel/attribute" + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not explicitly + // disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default database + // (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This document defines the attributes used to report a single exception associated with a span. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + // SHOULD be set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of a span, + // if that span is ended while the exception is still logically "in flight". + // This may be actually "in flight" in some languages (e.g. if the exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most languages. + + // It is usually not possible to determine at the point where an exception is + // thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending the span, + // as done in the [example above](#recording-an-exception). + + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or + // GCP, the region in which a function is hosted is essential to uniquely identify + // the function and also part of its endpoint. Since it's part of the endpoint + // being called, the region is always known to clients. In these cases, + // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the + // client or not required for identifying the invoked function, setting + // `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Application layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + // Version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol used and + // might be different from the protocol client's version. If the HTTP client used + // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should + // be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + // Remote socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from `net.peer.name` + // and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, [etc](https://man7.org/linux/man- + // pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + // Remote socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + // Protocol [address family](https://man7.org/linux/man- + // pages/man7/address_families.7.html) which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of + // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry + // SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + // Logical remote hostname, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Logical local hostname or similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // Logical local port number, preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + // Local socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + // Local socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + // The internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User-Agent](https://www.rfc- + // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Client +const ( + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The ordinal number of request re-sending attempt. + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + HTTPRetryCountKey = attribute.Key("http.retry_count") +) + +// Semantic Convention for HTTP Server +const ( + // The URI scheme identifying the used protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + // The matched route (path template in the format used by the respective server + // framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and the URI + // path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +const ( + // The name of the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + // The type of the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + // The GraphQL document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If the message destination is either a + // `queue` or `topic`.) + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default version + // (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPC received/sent message. +const ( + // Whether this is a received or sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + // MUST be calculated as two different counters starting from `1` one for sent + // messages and one for received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + // Compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + // Uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) From 0851690095ffea99d632c139ee4f106c2fad5673 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 5 Jan 2023 16:50:39 -0800 Subject: [PATCH 358/886] Move the semconv/v1.13.0 add to unreleased sec (#3567) --- CHANGELOG.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e08ec9007..3cc4cfe0817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add the `Callback` function type to the `go.opentelemetry.io/otel/metric` package. This new named function type is registered with a `Meter`. (#3564) +- Add the `go.opentelemetry.io/otel/semconv/v1.13.0` package. + The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) + - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. + - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. + - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. ### Changed @@ -89,18 +101,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459) - The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459) - The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487) -- Add the `go.opentelemetry.io/otel/semconv/v1.13.0` package. - The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) - - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. - - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. ### Changed From 1f9cc3036b877fa81a4ec47d024f35c42bd4c61f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 6 Jan 2023 09:20:49 -0800 Subject: [PATCH 359/886] Add single instrument callback and split metric instrument configuration (#3507) * Split metric inst config Instead of having the same configuration for both the Synchronous and Asynchronous instruments, use specific options for both. * Use Async/Sync opt for appropriate inst * Update noop inst providers * Update internal global impl * Update sdk * Remove unused method for callbackOption * Test instrument configuration * Lint imports * Add changes to changelog * Refactor callbacks and further split opts Define callbacks to return the value observed. Because of the different types returned for different observables, the callbacks and options are move to the sync/async packages. * Update noop impl * Fix example_test.go * Fix internal impl * Update Callbacks Return observations for distinct attr sets. * Refactor common code in sdk/metric inst provider * Update examples and prom exporter * Generalize callback * Update changelog * Add unit tests for callback * Add meter tests for cbacks on creation * Rename Observations to Measurements * Update Callback to accept an Observer * Update SDK impl * Move conf to instrument pkg * Apply suggestions from code review --- CHANGELOG.md | 7 + metric/instrument/asyncfloat64.go | 101 ++++++++++ .../instrument/asyncfloat64/asyncfloat64.go | 57 ++---- metric/instrument/asyncfloat64_test.go | 62 ++++++ metric/instrument/asyncint64.go | 102 ++++++++++ metric/instrument/asyncint64/asyncint64.go | 57 ++---- metric/instrument/asyncint64_test.go | 62 ++++++ metric/instrument/config.go | 69 ------- metric/instrument/instrument.go | 60 ++++++ metric/instrument/syncfloat64.go | 51 +++++ metric/instrument/syncfloat64_test.go | 35 ++++ metric/instrument/syncint64.go | 51 +++++ metric/instrument/syncint64_test.go | 35 ++++ metric/internal/global/instruments.go | 24 +-- metric/internal/global/meter.go | 24 +-- metric/internal/global/meter_types_test.go | 24 +-- metric/meter.go | 24 +-- metric/noop.go | 48 ++--- .../internal/aggregator_example_test.go | 6 +- sdk/metric/meter.go | 179 ++++++++++++++---- sdk/metric/meter_test.go | 43 ++++- sdk/metric/pipeline.go | 46 ++++- sdk/metric/pipeline_test.go | 6 +- 23 files changed, 887 insertions(+), 286 deletions(-) create mode 100644 metric/instrument/asyncfloat64.go create mode 100644 metric/instrument/asyncfloat64_test.go create mode 100644 metric/instrument/asyncint64.go create mode 100644 metric/instrument/asyncint64_test.go delete mode 100644 metric/instrument/config.go create mode 100644 metric/instrument/syncfloat64.go create mode 100644 metric/instrument/syncfloat64_test.go create mode 100644 metric/instrument/syncint64.go create mode 100644 metric/instrument/syncint64_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc4cfe0817..2252e56d8c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- The `WithInt64Callback` option is added to `go.opentelemetry.io/otel/metric/instrument` to configure int64 Observer callbacks during their creation. (#3507) +- The `WithFloat64Callback` option is added to `go.opentelemetry.io/otel/metric/instrument` to configure float64 Observer callbacks during their creation. (#3507) - Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. This `Registration` can be used to unregister callbacks. (#3522) - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) @@ -30,6 +32,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and confguration based on the instrument type. (#3507) + - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. + - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. + - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. + - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. - The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - The `Counter` method is replaced by `Meter.Int64ObservableCounter` diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go new file mode 100644 index 00000000000..9f77afb7d38 --- /dev/null +++ b/metric/instrument/asyncfloat64.go @@ -0,0 +1,101 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" +) + +// Float64Observer is a recorder of float64 measurement values. +// Warning: methods may be added to this interface in minor releases. +type Float64Observer interface { + Asynchronous + + // Observe records the measurement value for a set of attributes. + // + // It is only valid to call this within a callback. If called outside of + // the registered callback it should have no effect on the instrument, and + // an error will be reported via the error handler. + Observe(ctx context.Context, value float64, attributes ...attribute.KeyValue) +} + +// Float64Callback is a function registered with a Meter that makes +// observations for a Float64Observer it is registered with. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Float64Callbacks. Meaning, it should not report measurements with the same +// attributes as another Float64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Float64Callback func(context.Context, Float64Observer) error + +// Float64ObserverConfig contains options for Asynchronous instruments that +// observe float64 values. +type Float64ObserverConfig struct { + description string + unit unit.Unit + callbacks []Float64Callback +} + +// NewFloat64ObserverConfig returns a new Float64ObserverConfig with all opts +// applied. +func NewFloat64ObserverConfig(opts ...Float64ObserverOption) Float64ObserverConfig { + var config Float64ObserverConfig + for _, o := range opts { + config = o.applyFloat64Observer(config) + } + return config +} + +// Description returns the Config description. +func (c Float64ObserverConfig) Description() string { + return c.description +} + +// Unit returns the Config unit. +func (c Float64ObserverConfig) Unit() unit.Unit { + return c.unit +} + +// Callbacks returns the Config callbacks. +func (c Float64ObserverConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObserverOption applies options to float64 Observer instruments. +type Float64ObserverOption interface { + applyFloat64Observer(Float64ObserverConfig) Float64ObserverConfig +} + +type float64ObserverOptionFunc func(Float64ObserverConfig) Float64ObserverConfig + +func (fn float64ObserverOptionFunc) applyFloat64Observer(cfg Float64ObserverConfig) Float64ObserverConfig { + return fn(cfg) +} + +// WithFloat64Callback adds callback to be called for an instrument. +func WithFloat64Callback(callback Float64Callback) Float64ObserverOption { + return float64ObserverOptionFunc(func(cfg Float64ObserverConfig) Float64ObserverConfig { + cfg.callbacks = append(cfg.callbacks, callback) + return cfg + }) +} diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 038e55db0e5..1932d55d225 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -14,53 +14,28 @@ package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" -import ( - "context" +import "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// Counter is an instrument that records increasing values. +// Counter is an instrument used to asynchronously record increasing float64 +// measurements once per a measurement collection cycle. The Observe method is +// used to record the measured state of the instrument when it is called. +// Implementations will assume the observed value to be the cumulative sum of +// the count. // // Warning: methods may be added to this interface in minor releases. -type Counter interface { - // Observe records the state of the instrument to be x. Implementations - // will assume x to be the cumulative sum of the count. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} +type Counter interface{ instrument.Float64Observer } -// UpDownCounter is an instrument that records increasing or decreasing values. +// UpDownCounter is an instrument used to asynchronously record float64 +// measurements once per a measurement collection cycle. The Observe method is +// used to record the measured state of the instrument when it is called. +// Implementations will assume the observed value to be the cumulative sum of +// the count. // // Warning: methods may be added to this interface in minor releases. -type UpDownCounter interface { - // Observe records the state of the instrument to be x. Implementations - // will assume x to be the cumulative sum of the count. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) +type UpDownCounter interface{ instrument.Float64Observer } - instrument.Asynchronous -} - -// Gauge is an instrument that records independent readings. +// Gauge is an instrument used to asynchronously record instantaneous float64 +// measurements once per a measurement collection cycle. // // Warning: methods may be added to this interface in minor releases. -type Gauge interface { - // Observe records the state of the instrument to be x. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} +type Gauge interface{ instrument.Float64Observer } diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go new file mode 100644 index 00000000000..ab7d0fe5e13 --- /dev/null +++ b/metric/instrument/asyncfloat64_test.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" +) + +func TestFloat64ObserverOptions(t *testing.T) { + const ( + token float64 = 43 + desc = "Instrument description." + uBytes = unit.Bytes + ) + + got := NewFloat64ObserverConfig( + WithDescription(desc), + WithUnit(uBytes), + WithFloat64Callback(func(ctx context.Context, o Float64Observer) error { + o.Observe(ctx, token) + return nil + }), + ) + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + + // Functions are not comparable. + cBacks := got.Callbacks() + require.Len(t, cBacks, 1, "callbacks") + o := &float64Observer{} + err := cBacks[0](context.Background(), o) + require.NoError(t, err) + assert.Equal(t, token, o.got, "callback not set") +} + +type float64Observer struct { + Asynchronous + got float64 +} + +func (o *float64Observer) Observe(_ context.Context, v float64, _ ...attribute.KeyValue) { + o.got = v +} diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go new file mode 100644 index 00000000000..296da3e6f94 --- /dev/null +++ b/metric/instrument/asyncint64.go @@ -0,0 +1,102 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" +) + +// Int64Observer is a recorder of int64 measurement values. +// +// Warning: methods may be added to this interface in minor releases. +type Int64Observer interface { + Asynchronous + + // Observe records the measurement value for a set of attributes. + // + // It is only valid to call this within a callback. If called outside of + // the registered callback it should have no effect on the instrument, and + // an error will be reported via the error handler. + Observe(ctx context.Context, value int64, attributes ...attribute.KeyValue) +} + +// Int64Callback is a function registered with a Meter that makes +// observations for an Int64Observer it is registered with. +// +// The function needs to complete in a finite amount of time and the deadline +// of the passed context is expected to be honored. +// +// The function needs to make unique observations across all registered +// Int64Callback. Meaning, it should not report measurements with the same +// attributes as another Int64Callbacks also registered for the same +// instrument. +// +// The function needs to be concurrent safe. +type Int64Callback func(context.Context, Int64Observer) error + +// Int64ObserverConfig contains options for Asynchronous instruments that +// observe int64 values. +type Int64ObserverConfig struct { + description string + unit unit.Unit + callbacks []Int64Callback +} + +// NewInt64ObserverConfig returns a new Int64ObserverConfig with all opts +// applied. +func NewInt64ObserverConfig(opts ...Int64ObserverOption) Int64ObserverConfig { + var config Int64ObserverConfig + for _, o := range opts { + config = o.applyInt64Observer(config) + } + return config +} + +// Description returns the Config description. +func (c Int64ObserverConfig) Description() string { + return c.description +} + +// Unit returns the Config unit. +func (c Int64ObserverConfig) Unit() unit.Unit { + return c.unit +} + +// Callbacks returns the Config callbacks. +func (c Int64ObserverConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObserverOption applies options to int64 Observer instruments. +type Int64ObserverOption interface { + applyInt64Observer(Int64ObserverConfig) Int64ObserverConfig +} + +type int64ObserverOptionFunc func(Int64ObserverConfig) Int64ObserverConfig + +func (fn int64ObserverOptionFunc) applyInt64Observer(cfg Int64ObserverConfig) Int64ObserverConfig { + return fn(cfg) +} + +// WithInt64Callback adds callback to be called for an instrument. +func WithInt64Callback(callback Int64Callback) Int64ObserverOption { + return int64ObserverOptionFunc(func(cfg Int64ObserverConfig) Int64ObserverConfig { + cfg.callbacks = append(cfg.callbacks, callback) + return cfg + }) +} diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 0d727e08f86..8cf970855c8 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -14,53 +14,28 @@ package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64" -import ( - "context" +import "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// Counter is an instrument that records increasing values. +// Counter is an instrument used to asynchronously record increasing int64 +// measurements once per a measurement collection cycle. The Observe method is +// used to record the measured state of the instrument when it is called. +// Implementations will assume the observed value to be the cumulative sum of +// the count. // // Warning: methods may be added to this interface in minor releases. -type Counter interface { - // Observe records the state of the instrument to be x. Implementations - // will assume x to be the cumulative sum of the count. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} +type Counter interface{ instrument.Int64Observer } -// UpDownCounter is an instrument that records increasing or decreasing values. +// UpDownCounter is an instrument used to asynchronously record int64 +// measurements once per a measurement collection cycle. The Observe method is +// used to record the measured state of the instrument when it is called. +// Implementations will assume the observed value to be the cumulative sum of +// the count. // // Warning: methods may be added to this interface in minor releases. -type UpDownCounter interface { - // Observe records the state of the instrument to be x. Implementations - // will assume x to be the cumulative sum of the count. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) +type UpDownCounter interface{ instrument.Int64Observer } - instrument.Asynchronous -} - -// Gauge is an instrument that records independent readings. +// Gauge is an instrument used to asynchronously record instantaneous int64 +// measurements once per a measurement collection cycle. // // Warning: methods may be added to this interface in minor releases. -type Gauge interface { - // Observe records the state of the instrument to be x. - // - // It is only valid to call this within a callback. If called outside of the - // registered callback it should have no effect on the instrument, and an - // error will be reported via the error handler. - Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) - - instrument.Asynchronous -} +type Gauge interface{ instrument.Int64Observer } diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go new file mode 100644 index 00000000000..a9ad527f1ea --- /dev/null +++ b/metric/instrument/asyncint64_test.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/unit" +) + +func TestInt64ObserverOptions(t *testing.T) { + const ( + token int64 = 43 + desc = "Instrument description." + uBytes = unit.Bytes + ) + + got := NewInt64ObserverConfig( + WithDescription(desc), + WithUnit(uBytes), + WithInt64Callback(func(ctx context.Context, o Int64Observer) error { + o.Observe(ctx, token) + return nil + }), + ) + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + + // Functions are not comparable. + cBacks := got.Callbacks() + require.Len(t, cBacks, 1, "callbacks") + o := &int64Observer{} + err := cBacks[0](context.Background(), o) + require.NoError(t, err) + assert.Equal(t, token, o.got, "callback not set") +} + +type int64Observer struct { + Asynchronous + got int64 +} + +func (o *int64Observer) Observe(_ context.Context, v int64, _ ...attribute.KeyValue) { + o.got = v +} diff --git a/metric/instrument/config.go b/metric/instrument/config.go deleted file mode 100644 index 8778bce1619..00000000000 --- a/metric/instrument/config.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package instrument // import "go.opentelemetry.io/otel/metric/instrument" - -import "go.opentelemetry.io/otel/metric/unit" - -// Config contains options for metric instrument descriptors. -type Config struct { - description string - unit unit.Unit -} - -// Description describes the instrument in human-readable terms. -func (cfg Config) Description() string { - return cfg.description -} - -// Unit describes the measurement unit for an instrument. -func (cfg Config) Unit() unit.Unit { - return cfg.unit -} - -// Option is an interface for applying metric instrument options. -type Option interface { - applyInstrument(Config) Config -} - -// NewConfig creates a new Config and applies all the given options. -func NewConfig(opts ...Option) Config { - var config Config - for _, o := range opts { - config = o.applyInstrument(config) - } - return config -} - -type optionFunc func(Config) Config - -func (fn optionFunc) applyInstrument(cfg Config) Config { - return fn(cfg) -} - -// WithDescription applies provided description. -func WithDescription(desc string) Option { - return optionFunc(func(cfg Config) Config { - cfg.description = desc - return cfg - }) -} - -// WithUnit applies provided unit. -func WithUnit(u unit.Unit) Option { - return optionFunc(func(cfg Config) Config { - cfg.unit = u - return cfg - }) -} diff --git a/metric/instrument/instrument.go b/metric/instrument/instrument.go index e1bbb850d76..c583be6fbf1 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument/instrument.go @@ -14,6 +14,8 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" +import "go.opentelemetry.io/otel/metric/unit" + // Asynchronous instruments are instruments that are updated within a Callback. // If an instrument is observed outside of it's callback it should be an error. // @@ -28,3 +30,61 @@ type Asynchronous interface { type Synchronous interface { synchronous() } + +// Option applies options to all instruments. +type Option interface { + Float64ObserverOption + Int64ObserverOption + Float64Option + Int64Option +} + +type descOpt string + +func (o descOpt) applyFloat64(c Float64Config) Float64Config { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64(c Int64Config) Int64Config { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { + c.description = string(o) + return c +} + +// WithDescription sets the instrument description. +func WithDescription(desc string) Option { return descOpt(desc) } + +type unitOpt unit.Unit + +func (o unitOpt) applyFloat64(c Float64Config) Float64Config { + c.unit = unit.Unit(o) + return c +} + +func (o unitOpt) applyInt64(c Int64Config) Int64Config { + c.unit = unit.Unit(o) + return c +} + +func (o unitOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig { + c.unit = unit.Unit(o) + return c +} + +func (o unitOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { + c.unit = unit.Unit(o) + return c +} + +// WithUnit sets the instrument unit. +func WithUnit(u unit.Unit) Option { return unitOpt(u) } diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go new file mode 100644 index 00000000000..b3df2b02f20 --- /dev/null +++ b/metric/instrument/syncfloat64.go @@ -0,0 +1,51 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "go.opentelemetry.io/otel/metric/unit" +) + +// Float64Config contains options for Asynchronous instruments that +// observe float64 values. +type Float64Config struct { + description string + unit unit.Unit +} + +// Float64Config contains options for Synchronous instruments that record +// float64 values. +func NewFloat64Config(opts ...Float64Option) Float64Config { + var config Float64Config + for _, o := range opts { + config = o.applyFloat64(config) + } + return config +} + +// Description returns the Config description. +func (c Float64Config) Description() string { + return c.description +} + +// Unit returns the Config unit. +func (c Float64Config) Unit() unit.Unit { + return c.unit +} + +// Float64Option applies options to synchronous float64 instruments. +type Float64Option interface { + applyFloat64(Float64Config) Float64Config +} diff --git a/metric/instrument/syncfloat64_test.go b/metric/instrument/syncfloat64_test.go new file mode 100644 index 00000000000..8e90e15ddde --- /dev/null +++ b/metric/instrument/syncfloat64_test.go @@ -0,0 +1,35 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric/unit" +) + +func TestFloat64Options(t *testing.T) { + const ( + token float64 = 43 + desc = "Instrument description." + uBytes = unit.Bytes + ) + + got := NewFloat64Config(WithDescription(desc), WithUnit(uBytes)) + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") +} diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go new file mode 100644 index 00000000000..d49aed6c85d --- /dev/null +++ b/metric/instrument/syncint64.go @@ -0,0 +1,51 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "go.opentelemetry.io/otel/metric/unit" +) + +// Int64Config contains options for Synchronous instruments that record int64 +// values. +type Int64Config struct { + description string + unit unit.Unit +} + +// NewInt64Config returns a new Int64Config with all opts +// applied. +func NewInt64Config(opts ...Int64Option) Int64Config { + var config Int64Config + for _, o := range opts { + config = o.applyInt64(config) + } + return config +} + +// Description returns the Config description. +func (c Int64Config) Description() string { + return c.description +} + +// Unit returns the Config unit. +func (c Int64Config) Unit() unit.Unit { + return c.unit +} + +// Int64Option applies options to synchronous int64 instruments. +type Int64Option interface { + applyInt64(Int64Config) Int64Config +} diff --git a/metric/instrument/syncint64_test.go b/metric/instrument/syncint64_test.go new file mode 100644 index 00000000000..3eb39915499 --- /dev/null +++ b/metric/instrument/syncint64_test.go @@ -0,0 +1,35 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric/unit" +) + +func TestInt64Options(t *testing.T) { + const ( + token int64 = 43 + desc = "Instrument description." + uBytes = unit.Bytes + ) + + got := NewInt64Config(WithDescription(desc), WithUnit(uBytes)) + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") +} diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 9d28d5884d7..4b4e77ff988 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -30,7 +30,7 @@ import ( type afCounter struct { name string - opts []instrument.Option + opts []instrument.Float64ObserverOption delegate atomic.Value //asyncfloat64.Counter @@ -61,7 +61,7 @@ func (i *afCounter) unwrap() instrument.Asynchronous { type afUpDownCounter struct { name string - opts []instrument.Option + opts []instrument.Float64ObserverOption delegate atomic.Value //asyncfloat64.UpDownCounter @@ -92,7 +92,7 @@ func (i *afUpDownCounter) unwrap() instrument.Asynchronous { type afGauge struct { name string - opts []instrument.Option + opts []instrument.Float64ObserverOption delegate atomic.Value //asyncfloat64.Gauge @@ -123,7 +123,7 @@ func (i *afGauge) unwrap() instrument.Asynchronous { type aiCounter struct { name string - opts []instrument.Option + opts []instrument.Int64ObserverOption delegate atomic.Value //asyncint64.Counter @@ -154,7 +154,7 @@ func (i *aiCounter) unwrap() instrument.Asynchronous { type aiUpDownCounter struct { name string - opts []instrument.Option + opts []instrument.Int64ObserverOption delegate atomic.Value //asyncint64.UpDownCounter @@ -185,7 +185,7 @@ func (i *aiUpDownCounter) unwrap() instrument.Asynchronous { type aiGauge struct { name string - opts []instrument.Option + opts []instrument.Int64ObserverOption delegate atomic.Value //asyncint64.Gauge @@ -217,7 +217,7 @@ func (i *aiGauge) unwrap() instrument.Asynchronous { // Sync Instruments. type sfCounter struct { name string - opts []instrument.Option + opts []instrument.Float64Option delegate atomic.Value //syncfloat64.Counter @@ -241,7 +241,7 @@ func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.Ke type sfUpDownCounter struct { name string - opts []instrument.Option + opts []instrument.Float64Option delegate atomic.Value //syncfloat64.UpDownCounter @@ -265,7 +265,7 @@ func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attrib type sfHistogram struct { name string - opts []instrument.Option + opts []instrument.Float64Option delegate atomic.Value //syncfloat64.Histogram @@ -289,7 +289,7 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute. type siCounter struct { name string - opts []instrument.Option + opts []instrument.Int64Option delegate atomic.Value //syncint64.Counter @@ -313,7 +313,7 @@ func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValu type siUpDownCounter struct { name string - opts []instrument.Option + opts []instrument.Int64Option delegate atomic.Value //syncint64.UpDownCounter @@ -337,7 +337,7 @@ func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.K type siHistogram struct { name string - opts []instrument.Option + opts []instrument.Int64Option delegate atomic.Value //syncint64.Histogram diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 06de9176983..8d71aa050cf 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -147,7 +147,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { m.registry.Init() } -func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { +func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Counter(name, options...) } @@ -158,7 +158,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint return i, nil } -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64UpDownCounter(name, options...) } @@ -169,7 +169,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (s return i, nil } -func (m *meter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { +func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Histogram(name, options...) } @@ -180,7 +180,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Option) (synci return i, nil } -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableCounter(name, options...) } @@ -191,7 +191,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option return i, nil } -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableUpDownCounter(name, options...) } @@ -202,7 +202,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. return i, nil } -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableGauge(name, options...) } @@ -213,7 +213,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) return i, nil } -func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { +func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Counter(name, options...) } @@ -224,7 +224,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncf return i, nil } -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64UpDownCounter(name, options...) } @@ -235,7 +235,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) return i, nil } -func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { +func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Histogram(name, options...) } @@ -246,7 +246,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syn return i, nil } -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableCounter(name, options...) } @@ -257,7 +257,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Opti return i, nil } -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableUpDownCounter(name, options...) } @@ -268,7 +268,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen return i, nil } -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableGauge(name, options...) } diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 6e49ce84f51..7a2680ee45a 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -55,62 +55,62 @@ type testMeter struct { callbacks []func(context.Context) } -func (m *testMeter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { +func (m *testMeter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { m.siCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { +func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { m.siUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { +func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { m.siHist++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { +func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { m.aiCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { +func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { m.aiUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { +func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { m.aiGauge++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { +func (m *testMeter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { m.sfCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { +func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { m.sfUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { +func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { m.sfHist++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { +func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { m.afCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { +func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { m.afUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { +func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { m.afGauge++ return &testCountingFloatInstrument{}, nil } diff --git a/metric/meter.go b/metric/meter.go index 604254c10ab..7a042113835 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -44,56 +44,56 @@ type Meter interface { // Int64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // int64 measurements during a computational operation. - Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) + Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. - Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) + Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) // Int64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of int64 measurements during a computational operation. - Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) + Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. - Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) + Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) // Int64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously // record int64 measurements once per a measurement collection cycle. - Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) + Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection // cycle. - Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) + Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) // Float64Counter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // increasing float64 measurements during a computational operation. - Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) + Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. - Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) + Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) // Float64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of float64 measurements during a computational // operation. - Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) + Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. - Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) + Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) // Float64ObservableUpDownCounter returns a new instrument identified by // name and configured with options. The instrument is used to // asynchronously record float64 measurements once per a measurement // collection cycle. - Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) + Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection // cycle. - Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) + Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. diff --git a/metric/noop.go b/metric/noop.go index 0b0a9707d14..8c717f2a92a 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -43,51 +43,51 @@ func NewNoopMeter() Meter { type noopMeter struct{} -func (noopMeter) Int64Counter(string, ...instrument.Option) (syncint64.Counter, error) { +func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { +func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { +func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableCounter(string, ...instrument.Option) (asyncint64.Counter, error) { +func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) { +func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableGauge(string, ...instrument.Option) (asyncint64.Gauge, error) { +func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Float64Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { +func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (syncfloat64.Counter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) { +func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) { +func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (syncfloat64.Histogram, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableCounter(string, ...instrument.Option) (asyncfloat64.Counter, error) { +func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) { +func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableGauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) { +func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { return nonrecordingAsyncFloat64Instrument{}, nil } @@ -110,15 +110,15 @@ var ( _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} ) -func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Option) (asyncfloat64.Counter, error) { +func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) { +func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) { +func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { return n, nil } @@ -136,15 +136,15 @@ var ( _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} ) -func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Option) (asyncint64.Counter, error) { +func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) { +func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Option) (asyncint64.Gauge, error) { +func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { return n, nil } @@ -161,15 +161,15 @@ var ( _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} ) -func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Option) (syncfloat64.Counter, error) { +func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Float64Option) (syncfloat64.Counter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) { +func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) { +func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Float64Option) (syncfloat64.Histogram, error) { return n, nil } @@ -191,15 +191,15 @@ var ( _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} ) -func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Option) (syncint64.Counter, error) { +func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { +func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { +func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { return n, nil } diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index 0f9850cbc84..be5d760f317 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -31,7 +31,7 @@ type meter struct { aggregations []metricdata.Aggregation } -func (p *meter) Int64Counter(string, ...instrument.Option) (syncint64.Counter, error) { +func (p *meter) Int64Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { // This is an example of how a meter would create an aggregator for a new // counter. At this point the provider would determine the aggregation and // temporality to used based on the Reader and View configuration. Assume @@ -47,7 +47,7 @@ func (p *meter) Int64Counter(string, ...instrument.Option) (syncint64.Counter, e return count, nil } -func (p *meter) Int64UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) { +func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { // This is an example of how a meter would create an aggregator for a new // up-down counter. At this point the provider would determine the // aggregation and temporality to used based on the Reader and View @@ -64,7 +64,7 @@ func (p *meter) Int64UpDownCounter(string, ...instrument.Option) (syncint64.UpDo return upDownCount, nil } -func (p *meter) Int64Histogram(string, ...instrument.Option) (syncint64.Histogram, error) { +func (p *meter) Int64Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { // This is an example of how a meter would create an aggregator for a new // histogram. At this point the provider would determine the aggregation // and temporality to used based on the Reader and View configuration. diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index d28f53f0fdb..1ebd0cb8018 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -15,12 +15,15 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "context" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" "go.opentelemetry.io/otel/metric/instrument/asyncint64" "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" ) @@ -31,8 +34,8 @@ import ( type meter struct { pipes pipelines - instProviderInt64 *instProvider[int64] - instProviderFloat64 *instProvider[float64] + int64IP *instProvider[int64] + float64IP *instProvider[float64] } func newMeter(s instrumentation.Scope, p pipelines) *meter { @@ -46,9 +49,9 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { fc := newInstrumentCache[float64](nil, &viewCache) return &meter{ - pipes: p, - instProviderInt64: newInstProvider(s, p, ic), - instProviderFloat64: newInstProvider(s, p, fc), + pipes: p, + int64IP: newInstProvider(s, p, ic), + float64IP: newInstProvider(s, p, fc), } } @@ -58,85 +61,145 @@ var _ metric.Meter = (*meter)(nil) // Int64Counter returns a new instrument identified by name and configured with // options. The instrument is used to synchronously record increasing int64 // measurements during a computational operation. -func (m *meter) Int64Counter(name string, options ...instrument.Option) (syncint64.Counter, error) { - return m.instProviderInt64.lookup(InstrumentKindCounter, name, options) +func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { + cfg := instrument.NewInt64Config(options...) + const kind = InstrumentKindCounter + return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Option) (syncint64.UpDownCounter, error) { - return m.instProviderInt64.lookup(InstrumentKindUpDownCounter, name, options) +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { + cfg := instrument.NewInt64Config(options...) + const kind = InstrumentKindUpDownCounter + return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Int64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of int64 measurements during a computational operation. -func (m *meter) Int64Histogram(name string, options ...instrument.Option) (syncint64.Histogram, error) { - return m.instProviderInt64.lookup(InstrumentKindHistogram, name, options) +func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { + cfg := instrument.NewInt64Config(options...) + const kind = InstrumentKindHistogram + return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Option) (asyncint64.Counter, error) { - return m.instProviderInt64.lookup(InstrumentKindObservableCounter, name, options) +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { + cfg := instrument.NewInt64ObserverConfig(options...) + const kind = InstrumentKindObservableCounter + p := int64ObservProvider{m.int64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncint64.UpDownCounter, error) { - return m.instProviderInt64.lookup(InstrumentKindObservableUpDownCounter, name, options) +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { + cfg := instrument.NewInt64ObserverConfig(options...) + const kind = InstrumentKindObservableUpDownCounter + p := int64ObservProvider{m.int64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Option) (asyncint64.Gauge, error) { - return m.instProviderInt64.lookup(InstrumentKindObservableGauge, name, options) +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { + cfg := instrument.NewInt64ObserverConfig(options...) + const kind = InstrumentKindObservableGauge + p := int64ObservProvider{m.int64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // Float64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // float64 measurements during a computational operation. -func (m *meter) Float64Counter(name string, options ...instrument.Option) (syncfloat64.Counter, error) { - return m.instProviderFloat64.lookup(InstrumentKindCounter, name, options) +func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { + cfg := instrument.NewFloat64Config(options...) + const kind = InstrumentKindCounter + return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Option) (syncfloat64.UpDownCounter, error) { - return m.instProviderFloat64.lookup(InstrumentKindUpDownCounter, name, options) +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { + cfg := instrument.NewFloat64Config(options...) + const kind = InstrumentKindUpDownCounter + return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Float64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of float64 measurements during a computational operation. -func (m *meter) Float64Histogram(name string, options ...instrument.Option) (syncfloat64.Histogram, error) { - return m.instProviderFloat64.lookup(InstrumentKindHistogram, name, options) +func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { + cfg := instrument.NewFloat64Config(options...) + const kind = InstrumentKindHistogram + return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Option) (asyncfloat64.Counter, error) { - return m.instProviderFloat64.lookup(InstrumentKindObservableCounter, name, options) +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { + cfg := instrument.NewFloat64ObserverConfig(options...) + const kind = InstrumentKindObservableCounter + p := float64ObservProvider{m.float64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record // float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Option) (asyncfloat64.UpDownCounter, error) { - return m.instProviderFloat64.lookup(InstrumentKindObservableUpDownCounter, name, options) +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { + cfg := instrument.NewFloat64ObserverConfig(options...) + const kind = InstrumentKindObservableUpDownCounter + p := float64ObservProvider{m.float64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Option) (asyncfloat64.Gauge, error) { - return m.instProviderFloat64.lookup(InstrumentKindObservableGauge, name, options) +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { + cfg := instrument.NewFloat64ObserverConfig(options...) + const kind = InstrumentKindObservableGauge + p := float64ObservProvider{m.float64IP} + inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return nil, err + } + p.registerCallbacks(inst, cfg.Callbacks()) + return inst, nil } // RegisterCallback registers the function f to be called when any of the @@ -148,18 +211,18 @@ func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callb switch t := inst.(type) { case *instrumentImpl[int64]: if len(t.aggregators) > 0 { - return m.registerCallback(f) + return m.registerMultiCallback(f) } case *instrumentImpl[float64]: if len(t.aggregators) > 0 { - return m.registerCallback(f) + return m.registerMultiCallback(f) } default: // Instrument external to the SDK. For example, an instrument from // the "go.opentelemetry.io/otel/metric/internal/global" package. // // Fail gracefully here, assume a valid instrument. - return m.registerCallback(f) + return m.registerMultiCallback(f) } } // All insts use drop aggregation. @@ -172,30 +235,64 @@ func (noopRegister) Unregister() error { return nil } -func (m *meter) registerCallback(c metric.Callback) (metric.Registration, error) { - return m.pipes.registerCallback(c), nil +func (m *meter) registerMultiCallback(c metric.Callback) (metric.Registration, error) { + return m.pipes.registerMultiCallback(c), nil } // instProvider provides all OpenTelemetry instruments. type instProvider[N int64 | float64] struct { scope instrumentation.Scope + pipes pipelines resolve resolver[N] } func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) *instProvider[N] { - return &instProvider[N]{scope: s, resolve: newResolver(p, c)} + return &instProvider[N]{scope: s, pipes: p, resolve: newResolver(p, c)} } // lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind InstrumentKind, name string, opts []instrument.Option) (*instrumentImpl[N], error) { - cfg := instrument.NewConfig(opts...) - i := Instrument{ +func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*instrumentImpl[N], error) { + inst := Instrument{ Name: name, - Description: cfg.Description(), - Unit: cfg.Unit(), + Description: desc, + Unit: u, Kind: kind, Scope: p.scope, } - aggs, err := p.resolve.Aggregators(i) + aggs, err := p.resolve.Aggregators(inst) return &instrumentImpl[N]{aggregators: aggs}, err } + +type int64ObservProvider struct{ *instProvider[int64] } + +func (p int64ObservProvider) registerCallbacks(inst *instrumentImpl[int64], cBacks []instrument.Int64Callback) { + if inst == nil { + // Drop aggregator. + return + } + + for _, cBack := range cBacks { + p.pipes.registerCallback(p.callback(inst, cBack)) + } +} + +func (p int64ObservProvider) callback(i *instrumentImpl[int64], f instrument.Int64Callback) func(context.Context) error { + return func(ctx context.Context) error { return f(ctx, i) } +} + +type float64ObservProvider struct{ *instProvider[float64] } + +func (p float64ObservProvider) registerCallbacks(inst *instrumentImpl[float64], cBacks []instrument.Float64Callback) { + if inst == nil { + // Drop aggregator. + return + } + + for _, cBack := range cBacks { + p.pipes.registerCallback(p.callback(inst, cBack)) + } +} + +func (p float64ObservProvider) callback(i *instrumentImpl[float64], f instrument.Float64Callback) func(context.Context) error { + return func(ctx context.Context) error { return f(ctx, i) } +} diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index fee46e93dac..9568ee3311a 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -167,6 +167,7 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { + attrs := []attribute.KeyValue{attribute.String("name", "alice")} seven := 7.0 testCases := []struct { name string @@ -176,7 +177,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.Int64ObservableCounter("aint") + cback := func(ctx context.Context, o instrument.Int64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) @@ -192,6 +197,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 3}, }, }, @@ -200,7 +206,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.Int64ObservableUpDownCounter("aint") + cback := func(ctx context.Context, o instrument.Int64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) @@ -216,6 +226,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 11}, }, }, @@ -224,7 +235,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.Int64ObservableGauge("agauge") + cback := func(ctx context.Context, o instrument.Int64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) @@ -238,6 +253,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 11}, }, }, @@ -246,7 +262,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.Float64ObservableCounter("afloat") + cback := func(ctx context.Context, o instrument.Float64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 3) @@ -262,6 +282,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[float64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 3}, }, }, @@ -270,7 +291,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - ctr, err := m.Float64ObservableUpDownCounter("afloat") + cback := func(ctx context.Context, o instrument.Float64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { ctr.Observe(ctx, 11) @@ -286,6 +311,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[float64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 11}, }, }, @@ -294,7 +320,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { - gauge, err := m.Float64ObservableGauge("agauge") + cback := func(ctx context.Context, o instrument.Float64Observer) error { + o.Observe(ctx, 4, attrs...) + return nil + } + gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { gauge.Observe(ctx, 11) @@ -308,6 +338,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ + {Attributes: attribute.NewSet(attrs...), Value: 4}, {Value: 11}, }, }, diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 4ebabc0c1d2..e305eb8706c 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -76,8 +76,9 @@ type pipeline struct { views []View sync.Mutex - aggregations map[instrumentation.Scope][]instrumentSync - callbacks list.List + aggregations map[instrumentation.Scope][]instrumentSync + callbacks []func(context.Context) error + multiCallbacks list.List } // addSync adds the instrumentSync to pipeline p with scope. This method is not @@ -95,14 +96,23 @@ func (p *pipeline) addSync(scope instrumentation.Scope, iSync instrumentSync) { p.aggregations[scope] = append(p.aggregations[scope], iSync) } -// addCallback registers a callback to be run when `produce()` is called. -func (p *pipeline) addCallback(c metric.Callback) (unregister func()) { +// addCallback registers a single instrument callback to be run when +// `produce()` is called. +func (p *pipeline) addCallback(cback func(context.Context) error) { p.Lock() defer p.Unlock() - e := p.callbacks.PushBack(c) + p.callbacks = append(p.callbacks, cback) +} + +// addMultiCallback registers a multi-instrument callback to be run when +// `produce()` is called. +func (p *pipeline) addMultiCallback(c metric.Callback) (unregister func()) { + p.Lock() + defer p.Unlock() + e := p.multiCallbacks.PushBack(c) return func() { p.Lock() - p.callbacks.Remove(e) + p.multiCallbacks.Remove(e) p.Unlock() } } @@ -124,7 +134,17 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err p.Lock() defer p.Unlock() - for e := p.callbacks.Front(); e != nil; e = e.Next() { + var errs multierror + for _, c := range p.callbacks { + // TODO make the callbacks parallel. ( #3034 ) + if err := c(ctx); err != nil { + errs.append(err) + } + if err := ctx.Err(); err != nil { + return metricdata.ResourceMetrics{}, err + } + } + for e := p.multiCallbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) f := e.Value.(metric.Callback) f(ctx) @@ -159,7 +179,7 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err return metricdata.ResourceMetrics{ Resource: p.resource, ScopeMetrics: sm, - }, nil + }, errs.errorOrNil() } // inserter facilitates inserting of new instruments from a single scope into a @@ -447,10 +467,16 @@ func newPipelines(res *resource.Resource, readers []Reader, views []View) pipeli return pipes } -func (p pipelines) registerCallback(c metric.Callback) metric.Registration { +func (p pipelines) registerCallback(cback func(context.Context) error) { + for _, pipe := range p { + pipe.addCallback(cback) + } +} + +func (p pipelines) registerMultiCallback(c metric.Callback) metric.Registration { unregs := make([]func(), len(p)) for i, pipe := range p { - unregs[i] = pipe.addCallback(c) + unregs[i] = pipe.addMultiCallback(c) } return unregisterFuncs(unregs) } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 2badfe1865e..7fea4c8aba2 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -54,7 +54,7 @@ func TestEmptyPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(func(ctx context.Context) {}) }) output, err = pipe.produce(context.Background()) @@ -78,7 +78,7 @@ func TestNewPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(func(ctx context.Context) {}) }) output, err = pipe.produce(context.Background()) @@ -121,7 +121,7 @@ func TestPipelineConcurrency(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - pipe.addCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(func(ctx context.Context) {}) }() } wg.Wait() From 75a19d1910b2e342446455c57cb8ade4111203a0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 6 Jan 2023 14:30:32 -0800 Subject: [PATCH 360/886] Generate semconv/v1.14.0 (#3566) * Update semconv cmd in Makefile Fixes the template render for new upstream semantic conventions yaml. * Fix semconvkit to ensure dest dir * Generate v1.14.0 semconv package * Add changes to changelog * Update Makefile Co-authored-by: Anthony Mirabella * Revert removal of -p * Update go.opentelemetry.io/build-tools/* Co-authored-by: Anthony Mirabella Co-authored-by: Chester Cheung --- CHANGELOG.md | 2 + Makefile | 10 +- internal/tools/go.mod | 49 +- internal/tools/go.sum | 141 ++- internal/tools/semconvkit/main.go | 8 + semconv/v1.14.0/doc.go | 20 + semconv/v1.14.0/exception.go | 20 + semconv/v1.14.0/http.go | 21 + semconv/v1.14.0/httpconv/http.go | 135 +++ semconv/v1.14.0/netconv/net.go | 66 ++ semconv/v1.14.0/resource.go | 1068 ++++++++++++++++++ semconv/v1.14.0/schema.go | 20 + semconv/v1.14.0/trace.go | 1740 +++++++++++++++++++++++++++++ 13 files changed, 3210 insertions(+), 90 deletions(-) create mode 100644 semconv/v1.14.0/doc.go create mode 100644 semconv/v1.14.0/exception.go create mode 100644 semconv/v1.14.0/http.go create mode 100644 semconv/v1.14.0/httpconv/http.go create mode 100644 semconv/v1.14.0/netconv/net.go create mode 100644 semconv/v1.14.0/resource.go create mode 100644 semconv/v1.14.0/schema.go create mode 100644 semconv/v1.14.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2252e56d8c3..dece07a507b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add the `Callback` function type to the `go.opentelemetry.io/otel/metric` package. This new named function type is registered with a `Meter`. (#3564) +- Add the `go.opentelemetry.io/otel/semconv/v1.14.0` package. + The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) - Add the `go.opentelemetry.io/otel/semconv/v1.13.0` package. The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. diff --git a/Makefile b/Makefile index 68cdfef7d96..befb040a77b 100644 --- a/Makefile +++ b/Makefile @@ -208,11 +208,11 @@ check-clean-work-tree: SEMCONVPKG ?= "semconv/" .PHONY: semconv-generate semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) - @[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) - @[ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) - @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/trace" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - @$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/resource" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - @$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" + [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) + [ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" .PHONY: prerelease prerelease: | $(MULTIMOD) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index f64b4124992..04addb98c14 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,11 +9,11 @@ require ( github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.3.0 - go.opentelemetry.io/build-tools/dbotconf v0.3.0 - go.opentelemetry.io/build-tools/multimod v0.3.0 - go.opentelemetry.io/build-tools/semconvgen v0.3.0 - golang.org/x/tools v0.4.0 + go.opentelemetry.io/build-tools/crosslink v0.4.0 + go.opentelemetry.io/build-tools/dbotconf v0.4.0 + go.opentelemetry.io/build-tools/multimod v0.4.0 + go.opentelemetry.io/build-tools/semconvgen v0.4.0 + golang.org/x/tools v0.5.0 ) require ( @@ -25,9 +25,9 @@ require ( github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/Microsoft/go-winio v0.4.16 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/OpenPeeDeeP/depguard v1.1.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect @@ -43,11 +43,12 @@ require ( github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/charithe/durationcheck v0.0.9 // indirect github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect + github.com/cloudflare/circl v1.3.1 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.8.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect - github.com/emirpasic/gods v1.12.0 // indirect + github.com/emirpasic/gods v1.18.1 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect github.com/fatih/color v1.13.0 // indirect @@ -57,8 +58,8 @@ require ( github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.6.5 // indirect github.com/go-git/gcfg v1.5.0 // indirect - github.com/go-git/go-billy/v5 v5.3.1 // indirect - github.com/go-git/go-git/v5 v5.4.2 // indirect + github.com/go-git/go-billy/v5 v5.4.0 // indirect + github.com/go-git/go-git/v5 v5.5.2 // indirect github.com/go-toolsmith/astcast v1.0.0 // indirect github.com/go-toolsmith/astcopy v1.0.2 // indirect github.com/go-toolsmith/astequal v1.0.3 // indirect @@ -90,7 +91,7 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/imdario/mergo v0.3.12 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -98,7 +99,7 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect - github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.2 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.3 // indirect @@ -109,7 +110,7 @@ require ( github.com/ldez/tagliatelle v0.3.1 // indirect github.com/leonklingele/grouper v1.1.0 // indirect github.com/lufeee/execinquery v1.2.1 // indirect - github.com/magiconair/properties v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.0 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect @@ -128,8 +129,9 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect + github.com/pjbgf/sha1cd v0.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.0.5 // indirect @@ -148,15 +150,16 @@ require ( github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.20.0 // indirect github.com/securego/gosec/v2 v2.13.1 // indirect - github.com/sergi/go-diff v1.1.0 // indirect + github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/sivchari/containedctx v1.0.2 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.0 // indirect + github.com/skeema/knownhosts v1.1.0 // indirect github.com/sonatard/noctx v0.0.1 // indirect github.com/sourcegraph/go-diff v0.6.1 // indirect - github.com/spf13/afero v1.9.2 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -176,22 +179,22 @@ require ( github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect github.com/uudashr/gocognit v1.0.6 // indirect - github.com/xanzy/ssh-agent v0.3.0 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.3.0 // indirect + go.opentelemetry.io/build-tools v0.4.0 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.8.0 // indirect + go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.1.0 // indirect + golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.3.0 // indirect + golang.org/x/net v0.5.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 2f193d5885b..32342aa1bc5 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -54,13 +54,13 @@ github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7I github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= -github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= -github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= -github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= -github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= +github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 h1:ra2OtmuW0AE5csawV4YXMNGNQQXvLRps3z2Z59OPO+I= +github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -72,8 +72,8 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= @@ -97,6 +97,7 @@ github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1x github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= +github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= @@ -110,6 +111,9 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/cloudflare/circl v1.3.1 h1:4OVCZRL62ijwEwxnF6I7hLwxvIYi3VaZt8TflkqtrtA= +github.com/cloudflare/circl v1.3.1/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -125,8 +129,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= -github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -143,25 +147,24 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= -github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= +github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-critic/go-critic v0.6.5 h1:fDaR/5GWURljXwF8Eh31T2GZNz9X4jeboS912mWF8Uo= github.com/go-critic/go-critic v0.6.5/go.mod h1:ezfP/Lh7MA6dBNn4c6ab5ALv3sKnZVLx37tr00uuaOY= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8= -github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= -github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= -github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= +github.com/go-git/go-billy/v5 v5.4.0 h1:Vaw7LaSTRJOUric7pe4vnzBSgyuf2KrLsu2Y4ZpQBDE= +github.com/go-git/go-billy/v5 v5.4.0/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= +github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= +github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= +github.com/go-git/go-git/v5 v5.5.2 h1:v8lgZa5k9ylUw+OR/roJHTxR4QItsNFI5nKtAXFuynw= +github.com/go-git/go-git/v5 v5.5.2/go.mod h1:BE5hUJ5yaV2YMxhmaP4l6RBQ08kMxKSPD4BlxtH7OjI= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -316,8 +319,8 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= -github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -348,8 +351,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= -github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/errcheck v1.6.2 h1:uGQ9xI8/pgc9iOoCe7kWQgRE6SBTrCGmTSf0LrEtY7c= github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= @@ -383,8 +386,8 @@ github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7s github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= -github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= @@ -445,10 +448,12 @@ github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT9 github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= +github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= +github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -514,16 +519,17 @@ github.com/sashamelentyev/usestdlibvars v1.20.0 h1:K6CXjqqtSYSsuyRDDC7Sjn6vTMLiS github.com/sashamelentyev/usestdlibvars v1.20.0/go.mod h1:0GaP+ecfZMXShS0A94CJn6aEuPRILv8h/VuWI9n1ygg= github.com/securego/gosec/v2 v2.13.1 h1:7mU32qn2dyC81MH9L2kefnQyRMUarfDER3iQyMHcjYM= github.com/securego/gosec/v2 v2.13.1/go.mod h1:EO1sImBMBWFjOTFzMWfTRrZW6M15gm60ljzrmy/wtHo= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= @@ -532,12 +538,14 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.0 h1:d4laZMBK6jpe5PWepxlV9S+LC0yXqvYHiq8E6ceoVVE= github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= +github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= @@ -594,8 +602,8 @@ github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842 github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= -github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= -github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= @@ -615,37 +623,38 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.3.0 h1:ehCOkLXOy/AryssN74PzCMya6MWoReFhygnyWGddC6Y= -go.opentelemetry.io/build-tools v0.3.0/go.mod h1:WewIEPPmfvHi9CvNXaAqfLHQRdv4bFpy7V5PTyMUQno= -go.opentelemetry.io/build-tools/crosslink v0.3.0 h1:XhhedQvxZTjbGQXAAqO7BNiVGIMArZzS2Lj5S+98w4M= -go.opentelemetry.io/build-tools/crosslink v0.3.0/go.mod h1:e+s2mLk6AI79HkvLrTa4SeM0oQ6ykFFeMyRCfLz0eX8= -go.opentelemetry.io/build-tools/dbotconf v0.3.0 h1:moQZLXl+lqPEkp3pfJxQWdQQ17DOzo4CMnEW0dJQWhc= -go.opentelemetry.io/build-tools/dbotconf v0.3.0/go.mod h1:gIOWVOWTrooqH3IrROAA8Lyv8HwnXfrhE2tbtyOgaHE= -go.opentelemetry.io/build-tools/multimod v0.3.0 h1:eCr6XYpEFA+VZ3aaD+81HEmgotP963sN/TjOAgx7A2k= -go.opentelemetry.io/build-tools/multimod v0.3.0/go.mod h1:I+OYyA29iAxaGhoxLvqgcYkOMQeKJ6R3sEn1YQNddlQ= -go.opentelemetry.io/build-tools/semconvgen v0.3.0 h1:ml4Rsej3E6u46TCtOMjmHDkCWin2fDx0xE9rdkH7Iu0= -go.opentelemetry.io/build-tools/semconvgen v0.3.0/go.mod h1:qsPYyE3sd1+ikaock1R9ftHc9IObqCIvRXTHWcg4Ta8= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.opentelemetry.io/build-tools v0.4.0 h1:gcu5ArCA4Dkq1FBXcs/AB9Smmyx0aLni0GpavgCv+oQ= +go.opentelemetry.io/build-tools v0.4.0/go.mod h1:csnTV1XNFB7X17EoL0f4gOn/GA6oWI2UK282xLbPcY0= +go.opentelemetry.io/build-tools/crosslink v0.4.0 h1:gnDpIw+y9aTZYEGW4CBcQa6RM6e+Is/rEI8w2YQxAL8= +go.opentelemetry.io/build-tools/crosslink v0.4.0/go.mod h1:9/MPh5zL5QzIjreSEUmrlKB0ykzudT1Tv+6rU76EdOA= +go.opentelemetry.io/build-tools/dbotconf v0.4.0 h1:fiR3KibrrWrzIjo2SJjurpWhR+aj9ili+D9wCsgd134= +go.opentelemetry.io/build-tools/dbotconf v0.4.0/go.mod h1:R1fQ/YXApXzdjS8ZajQa56tbe9mpK/MT2oI3G1uaH+Y= +go.opentelemetry.io/build-tools/multimod v0.4.0 h1:V/sH7r0xBGq0WOxZYYzk7rxF1W0TqQUw3jNbaG2Q9Q8= +go.opentelemetry.io/build-tools/multimod v0.4.0/go.mod h1:S+IF5FLZlhJ1YkrOCPucH4z8ig1hVzDtKtTOATXRQK4= +go.opentelemetry.io/build-tools/semconvgen v0.4.0 h1:/K3NLBIPrX8Y3ryZh85WAtGeF2e2kdTa1qNRxmNG1sM= +go.opentelemetry.io/build-tools/semconvgen v0.4.0/go.mod h1:DKeHF2PWG8YZq77zJq3WT0/gNEFVT5zX9nzwVXxvE8o= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= -go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -723,15 +732,17 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -769,8 +780,8 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -799,15 +810,14 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -816,13 +826,19 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -831,8 +847,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -917,8 +934,8 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= +golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1036,7 +1053,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/tools/semconvkit/main.go b/internal/tools/semconvkit/main.go index d3d1c1a2e5f..52510cbad70 100644 --- a/internal/tools/semconvkit/main.go +++ b/internal/tools/semconvkit/main.go @@ -84,11 +84,19 @@ func main() { } dest := fmt.Sprintf("%s/netconv", *out) + // Ensure the dest dir exists (MkdirAll does nothing if dest is a directory + // and already exists). + if err := os.MkdirAll(dest, os.ModePerm); err != nil { + log.Fatal(err) + } if err := render("templates/netconv/*.tmpl", dest, sc); err != nil { log.Fatal(err) } dest = fmt.Sprintf("%s/httpconv", *out) + if err := os.MkdirAll(dest, os.ModePerm); err != nil { + log.Fatal(err) + } if err := render("templates/httpconv/*.tmpl", dest, sc); err != nil { log.Fatal(err) } diff --git a/semconv/v1.14.0/doc.go b/semconv/v1.14.0/doc.go new file mode 100644 index 00000000000..d40eea824a8 --- /dev/null +++ b/semconv/v1.14.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.14.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" diff --git a/semconv/v1.14.0/exception.go b/semconv/v1.14.0/exception.go new file mode 100644 index 00000000000..f18aa28f2d7 --- /dev/null +++ b/semconv/v1.14.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.14.0/http.go b/semconv/v1.14.0/http.go new file mode 100644 index 00000000000..1fef8ffed03 --- /dev/null +++ b/semconv/v1.14.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.14.0/httpconv/http.go b/semconv/v1.14.0/httpconv/http.go new file mode 100644 index 00000000000..57dca5501b4 --- /dev/null +++ b/semconv/v1.14.0/httpconv/http.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.14.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.14.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.14.0/netconv/net.go b/semconv/v1.14.0/netconv/net.go new file mode 100644 index 00000000000..5612517df19 --- /dev/null +++ b/semconv/v1.14.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.14.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.14.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.14.0/resource.go b/semconv/v1.14.0/resource.go new file mode 100644 index 00000000000..1584d659eee --- /dev/null +++ b/semconv/v1.14.0/resource.go @@ -0,0 +1,1068 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [`os.type` and `os.name` attributes](./os.md). However, for consistency, the + // values in the `browser.platform` attribute should capture the exact value that + // the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // A boolean that is true if the browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + // Full user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + // Preferred language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // Parent Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) diff --git a/semconv/v1.14.0/schema.go b/semconv/v1.14.0/schema.go new file mode 100644 index 00000000000..afd8d9dd5e3 --- /dev/null +++ b/semconv/v1.14.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.14.0" diff --git a/semconv/v1.14.0/trace.go b/semconv/v1.14.0/trace.go new file mode 100644 index 00000000000..60fce279713 --- /dev/null +++ b/semconv/v1.14.0/trace.go @@ -0,0 +1,1740 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.14.0" + +import "go.opentelemetry.io/otel/attribute" + +// This document defines the shared attributes used to report a single exception associated with a span or log. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// This document defines attributes for Events represented using Log Records. +const ( + // The name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + // The domain identifies the context in which an event happened. An event name is + // unique only within a domain. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: An `event.name` is supposed to be unique only in the context of an + // `event.domain`, so this allows for two events in different domains to + // have same `event.name`, yet be unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not explicitly + // disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default database + // (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or + // GCP, the region in which a function is hosted is essential to uniquely identify + // the function and also part of its endpoint. Since it's part of the endpoint + // being called, the region is always known to clients. In these cases, + // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the + // client or not required for identifying the invoked function, setting + // `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Application layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + // Version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol used and + // might be different from the protocol client's version. If the HTTP client used + // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should + // be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + // Remote socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from `net.peer.name` + // and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, [etc](https://man7.org/linux/man- + // pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + // Remote socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + // Protocol [address family](https://man7.org/linux/man- + // pages/man7/address_families.7.html) which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of + // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry + // SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + // Logical remote hostname, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Logical local hostname or similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // Logical local port number, preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + // Local socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + // Local socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + // The internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User-Agent](https://www.rfc- + // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Client +const ( + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The ordinal number of request re-sending attempt. + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + HTTPRetryCountKey = attribute.Key("http.retry_count") +) + +// Semantic Convention for HTTP Server +const ( + // The URI scheme identifying the used protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + // The matched route (path template in the format used by the respective server + // framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and the URI + // path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +const ( + // The name of the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + // The type of the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + // The GraphQL document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If the message destination is either a + // `queue` or `topic`.) + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // Type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default version + // (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) From 82882dfbd3144eb8d5b39ce46b7b535b78573bf3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 8 Jan 2023 07:53:07 -0800 Subject: [PATCH 361/886] Have multi-instrument callback return an error (#3576) * Have multi-inst callback return an error * Update PR number in changelog entry Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + example/prometheus/main.go | 3 +- metric/example_test.go | 6 +- metric/internal/global/meter.go | 3 +- metric/internal/global/meter_test.go | 13 +++-- metric/internal/global/meter_types_test.go | 4 +- metric/meter.go | 2 +- sdk/metric/meter_test.go | 64 +++++++++++++++------- sdk/metric/pipeline.go | 4 +- sdk/metric/pipeline_test.go | 6 +- 10 files changed, 68 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dece07a507b..5ae2073e9a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` - Update the `RegisterCallback` method of the `Meter` in the `go.opentelemetry.io/otel/sdk/metric` package to accept the added `Callback` type instead of an inline function type definition. The underlying type of a `Callback` is the same `func(context.Context)` that the method used to accept. (#3564) +- The callback function registered with a `Meter` from the `go.opentelemetry.io/otel/metric` package is required to return an error now. (#3576) ### Deprecated diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 6bc9563d77e..68be2f8d6cb 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -68,9 +68,10 @@ func main() { if err != nil { log.Fatal(err) } - _, err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { n := -10. + rand.Float64()*(90.) // [-10, 100) gauge.Observe(ctx, n, attrs...) + return nil }) if err != nil { log.Fatal(err) diff --git a/metric/example_test.go b/metric/example_test.go index 08741f77d06..c6beeca7fc3 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -62,13 +62,14 @@ func ExampleMeter_asynchronous_single() { } _, err = meter.RegisterCallback([]instrument.Asynchronous{memoryUsage}, - func(ctx context.Context) { + func(ctx context.Context) error { // instrument.WithCallbackFunc(func(ctx context.Context) { //Do Work to get the real memoryUsage // mem := GatherMemory(ctx) mem := 75000 memoryUsage.Observe(ctx, int64(mem)) + return nil }) if err != nil { fmt.Println("Failed to register callback") @@ -90,7 +91,7 @@ func ExampleMeter_asynchronous_multiple() { heapAlloc, gcCount, }, - func(ctx context.Context) { + func(ctx context.Context) error { memStats := &runtime.MemStats{} // This call does work runtime.ReadMemStats(memStats) @@ -100,6 +101,7 @@ func ExampleMeter_asynchronous_multiple() { // This function synchronously records the pauses computeGCPauses(ctx, gcPause, memStats.PauseNs[:]) + return nil }, ) diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 8d71aa050cf..bdde4e87ea0 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -16,7 +16,6 @@ package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "container/list" - "context" "sync" "sync/atomic" @@ -323,7 +322,7 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async type registration struct { instruments []instrument.Asynchronous - function func(context.Context) + function metric.Callback unreg func() error unregMu sync.Mutex diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 903ed340a02..86d6f3e0ade 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -68,7 +68,7 @@ func TestMeterRace(t *testing.T) { _, _ = mtr.Int64Counter(name) _, _ = mtr.Int64UpDownCounter(name) _, _ = mtr.Int64Histogram(name) - _, _ = mtr.RegisterCallback(nil, func(ctx context.Context) {}) + _, _ = mtr.RegisterCallback(nil, func(ctx context.Context) error { return nil }) if !once { wg.Done() once = true @@ -88,7 +88,7 @@ func TestMeterRace(t *testing.T) { func TestUnregisterRace(t *testing.T) { mtr := &meter{} - reg, err := mtr.RegisterCallback(nil, func(ctx context.Context) {}) + reg, err := mtr.RegisterCallback(nil, func(ctx context.Context) error { return nil }) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -130,8 +130,9 @@ func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Coun _, err = m.Int64ObservableGauge("test_Async_Gauge") assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) error { afcounter.Observe(ctx, 3) + return nil }) require.NoError(t, err) @@ -324,8 +325,9 @@ func TestRegistrationDelegation(t *testing.T) { require.NoError(t, err) var called0 bool - reg0, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) { + reg0, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) error { called0 = true + return nil }) require.NoError(t, err) require.Equal(t, 1, mImpl.registry.Len(), "callback not registered") @@ -334,8 +336,9 @@ func TestRegistrationDelegation(t *testing.T) { assert.Equal(t, 0, mImpl.registry.Len(), "callback not unregistered") var called1 bool - reg1, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) { + reg1, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) error { called1 = true + return nil }) require.NoError(t, err) require.Equal(t, 1, mImpl.registry.Len(), "second callback not registered") diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 7a2680ee45a..31903995a83 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -52,7 +52,7 @@ type testMeter struct { siUDCount int siHist int - callbacks []func(context.Context) + callbacks []metric.Callback } func (m *testMeter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { @@ -145,6 +145,6 @@ func (m *testMeter) collect() { // Unregister. continue } - f(ctx) + _ = f(ctx) } } diff --git a/metric/meter.go b/metric/meter.go index 7a042113835..35ffe0de384 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -120,7 +120,7 @@ type Meter interface { // the same attributes as another Callback will report. // // The function needs to be concurrent safe. -type Callback func(context.Context) +type Callback func(context.Context) error // Registration is an token representing the unique registration of a callback // for a set of instruments with a Meter. diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 9568ee3311a..b394707b0aa 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -95,6 +95,8 @@ func TestMeterInstrumentConcurrency(t *testing.T) { wg.Wait() } +var emptyCallback metric.Callback = func(ctx context.Context) error { return nil } + // A Meter Should be able register Callbacks Concurrently. func TestMeterCallbackCreationConcurrency(t *testing.T) { wg := &sync.WaitGroup{} @@ -103,11 +105,11 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { m := NewMeterProvider().Meter("callback-concurrency") go func() { - _, _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + _, _ = m.RegisterCallback([]instrument.Asynchronous{}, emptyCallback) wg.Done() }() go func() { - _, _ = m.RegisterCallback([]instrument.Asynchronous{}, func(ctx context.Context) {}) + _, _ = m.RegisterCallback([]instrument.Asynchronous{}, emptyCallback) wg.Done() }() wg.Wait() @@ -115,7 +117,7 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { func TestNoopCallbackUnregisterConcurrency(t *testing.T) { m := NewMeterProvider().Meter("noop-unregister-concurrency") - reg, err := m.RegisterCallback(nil, func(ctx context.Context) {}) + reg, err := m.RegisterCallback(nil, emptyCallback) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -143,11 +145,11 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { require.NoError(t, err) i := []instrument.Asynchronous{actr} - regCtr, err := meter.RegisterCallback(i, func(ctx context.Context) {}) + regCtr, err := meter.RegisterCallback(i, emptyCallback) require.NoError(t, err) i = []instrument.Asynchronous{ag} - regG, err := meter.RegisterCallback(i, func(ctx context.Context) {}) + regG, err := meter.RegisterCallback(i, emptyCallback) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -183,8 +185,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 3) + return nil }) assert.NoError(t, err) @@ -212,8 +215,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 11) + return nil }) assert.NoError(t, err) @@ -241,8 +245,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { gauge.Observe(ctx, 11) + return nil }) assert.NoError(t, err) @@ -268,8 +273,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 3) + return nil }) assert.NoError(t, err) @@ -297,8 +303,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 11) + return nil }) assert.NoError(t, err) @@ -326,8 +333,9 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) { + _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { gauge.Observe(ctx, 11) + return nil }) assert.NoError(t, err) @@ -501,16 +509,18 @@ func TestMetersProvideScope(t *testing.T) { m1 := mp.Meter("scope1") ctr1, err := m1.Float64ObservableCounter("ctr1") assert.NoError(t, err) - _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) { + _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) error { ctr1.Observe(ctx, 5) + return nil }) assert.NoError(t, err) m2 := mp.Meter("scope2") ctr2, err := m2.Int64ObservableCounter("ctr2") assert.NoError(t, err) - _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) { + _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) error { ctr2.Observe(ctx, 7) + return nil }) assert.NoError(t, err) @@ -594,7 +604,10 @@ func TestUnregisterUnregisters(t *testing.T) { floag64Counter, floag64UpDownCounter, floag64Gauge, - }, func(context.Context) { called = true }) + }, func(context.Context) error { + called = true + return nil + }) require.NoError(t, err) ctx := context.Background() @@ -644,7 +657,10 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { floag64Counter, floag64UpDownCounter, floag64Gauge, - }, func(context.Context) { called = true }) + }, func(context.Context) error { + called = true + return nil + }) require.NoError(t, err) data, err := r.Collect(context.Background()) @@ -669,9 +685,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, @@ -696,9 +713,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, @@ -723,9 +741,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, @@ -748,9 +767,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, @@ -775,9 +795,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, @@ -802,9 +823,10 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) { + _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + return nil }) return err }, diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index e305eb8706c..32b9125340b 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -147,7 +147,9 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err for e := p.multiCallbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) f := e.Value.(metric.Callback) - f(ctx) + if err := f(ctx); err != nil { + errs.append(err) + } if err := ctx.Err(); err != nil { // This means the context expired before we finished running callbacks. return metricdata.ResourceMetrics{}, err diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 7fea4c8aba2..7b9f89585dc 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -54,7 +54,7 @@ func TestEmptyPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addMultiCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(emptyCallback) }) output, err = pipe.produce(context.Background()) @@ -78,7 +78,7 @@ func TestNewPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addMultiCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(emptyCallback) }) output, err = pipe.produce(context.Background()) @@ -121,7 +121,7 @@ func TestPipelineConcurrency(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - pipe.addMultiCallback(func(ctx context.Context) {}) + pipe.addMultiCallback(emptyCallback) }() } wg.Wait() From b08ebeb18710afea810178a81483846df7628c42 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 8 Jan 2023 08:01:08 -0800 Subject: [PATCH 362/886] Generate semconv/v1.15.0 (#3578) * Add generated semconv/v1.15.0 * Add changelog entry for changes * Update PR number in changelog entry --- CHANGELOG.md | 2 + semconv/v1.15.0/doc.go | 20 + semconv/v1.15.0/exception.go | 20 + semconv/v1.15.0/http.go | 21 + semconv/v1.15.0/httpconv/http.go | 135 +++ semconv/v1.15.0/netconv/net.go | 66 ++ semconv/v1.15.0/resource.go | 1105 ++++++++++++++++++ semconv/v1.15.0/schema.go | 20 + semconv/v1.15.0/trace.go | 1796 ++++++++++++++++++++++++++++++ 9 files changed, 3185 insertions(+) create mode 100644 semconv/v1.15.0/doc.go create mode 100644 semconv/v1.15.0/exception.go create mode 100644 semconv/v1.15.0/http.go create mode 100644 semconv/v1.15.0/httpconv/http.go create mode 100644 semconv/v1.15.0/netconv/net.go create mode 100644 semconv/v1.15.0/resource.go create mode 100644 semconv/v1.15.0/schema.go create mode 100644 semconv/v1.15.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ae2073e9a1..ff0059b0f3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. +- Add the `go.opentelemetry.io/otel/semconv/v1.15.0` package. + The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) ### Changed diff --git a/semconv/v1.15.0/doc.go b/semconv/v1.15.0/doc.go new file mode 100644 index 00000000000..93a5d557d2d --- /dev/null +++ b/semconv/v1.15.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.15.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" diff --git a/semconv/v1.15.0/exception.go b/semconv/v1.15.0/exception.go new file mode 100644 index 00000000000..13c05c37ac7 --- /dev/null +++ b/semconv/v1.15.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.15.0/http.go b/semconv/v1.15.0/http.go new file mode 100644 index 00000000000..919c64aad8d --- /dev/null +++ b/semconv/v1.15.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.15.0/httpconv/http.go b/semconv/v1.15.0/httpconv/http.go new file mode 100644 index 00000000000..1b682db10b6 --- /dev/null +++ b/semconv/v1.15.0/httpconv/http.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.15.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.15.0/netconv/net.go b/semconv/v1.15.0/netconv/net.go new file mode 100644 index 00000000000..49a7fc1c58c --- /dev/null +++ b/semconv/v1.15.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.15.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.15.0/resource.go b/semconv/v1.15.0/resource.go new file mode 100644 index 00000000000..399e840ce86 --- /dev/null +++ b/semconv/v1.15.0/resource.go @@ -0,0 +1,1105 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [`os.type` and `os.name` attributes](./os.md). However, for consistency, the + // values in the `browser.platform` attribute should capture the exact value that + // the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // A boolean that is true if the browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + // Full user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + // Preferred language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // Parent Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelScopeNameKey = attribute.Key("otel.scope.name") + // The version of the instrumentation scope - (`InstrumentationScope.Version` in + // OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OtelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // Deprecated, use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelLibraryNameKey = attribute.Key("otel.library.name") + // Deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OtelLibraryVersionKey = attribute.Key("otel.library.version") +) diff --git a/semconv/v1.15.0/schema.go b/semconv/v1.15.0/schema.go new file mode 100644 index 00000000000..57f518567cc --- /dev/null +++ b/semconv/v1.15.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.15.0" diff --git a/semconv/v1.15.0/trace.go b/semconv/v1.15.0/trace.go new file mode 100644 index 00000000000..f40dabffcd9 --- /dev/null +++ b/semconv/v1.15.0/trace.go @@ -0,0 +1,1796 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.15.0" + +import "go.opentelemetry.io/otel/attribute" + +// This document defines the shared attributes used to report a single exception associated with a span or log. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// This document defines attributes for Events represented using Log Records. +const ( + // The name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + // The domain identifies the context in which an event happened. An event name is + // unique only within a domain. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: An `event.name` is supposed to be unique only in the context of an + // `event.domain`, so this allows for two events in different domains to + // have same `event.name`, yet be unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not explicitly + // disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default database + // (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's concepts. +const ( + // Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OtelStatusCodeKey = attribute.Key("otel.status_code") + // Description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OtelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OtelStatusCodeOk = OtelStatusCodeKey.String("OK") + // The operation contains an error + OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or + // GCP, the region in which a function is hosted is essential to uniquely identify + // the function and also part of its endpoint. Since it's part of the endpoint + // being called, the region is always known to clients. In these cases, + // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the + // client or not required for identifying the invoked function, setting + // `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Application layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + // Version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol used and + // might be different from the protocol client's version. If the HTTP client used + // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should + // be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + // Remote socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from `net.peer.name` + // and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, [etc](https://man7.org/linux/man- + // pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + // Remote socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + // Protocol [address family](https://man7.org/linux/man- + // pages/man7/address_families.7.html) which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of + // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry + // SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + // Logical remote hostname, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Logical local hostname or similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // Logical local port number, preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + // Local socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + // Local socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + // The internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User-Agent](https://www.rfc- + // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Client +const ( + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets resent + // by the client, regardless of what was the cause of the resending (e.g. + // redirection, authorization failure, 503 Server Unavailable, network issues, or + // any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// Semantic Convention for HTTP Server +const ( + // The URI scheme identifying the used protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + // The matched route (path template in the format used by the respective server + // framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and the URI + // path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +const ( + // The name of the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + // The type of the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + // The GraphQL document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If the message destination is either a + // `queue` or `topic`.) + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // The timestamp in milliseconds that the delay message is expected to be + // delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and delay + // time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqDeliveryTimestampKey = attribute.Key("messaging.rocketmq.delivery_timestamp") + // The delay time level for delay message, which determines the message delay + // time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and + // delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqDelayTimeLevelKey = attribute.Key("messaging.rocketmq.delay_time_level") + // It is essential for FIFO message. Messages that belong to the same message + // group are always processed one by one within the same consumer group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message_group") + // Type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default version + // (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) From 479c5c584000e0c85f97194fb76706bc8516d0c6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 8 Jan 2023 08:12:25 -0800 Subject: [PATCH 363/886] Generate semconv/v1.16.0 (#3579) * Generate semconv/v1.16.0 * Add changes to changelog --- CHANGELOG.md | 2 + semconv/v1.16.0/doc.go | 20 + semconv/v1.16.0/exception.go | 20 + semconv/v1.16.0/http.go | 21 + semconv/v1.16.0/httpconv/http.go | 135 +++ semconv/v1.16.0/netconv/net.go | 66 ++ semconv/v1.16.0/resource.go | 1118 +++++++++++++++++++ semconv/v1.16.0/schema.go | 20 + semconv/v1.16.0/trace.go | 1801 ++++++++++++++++++++++++++++++ 9 files changed, 3203 insertions(+) create mode 100644 semconv/v1.16.0/doc.go create mode 100644 semconv/v1.16.0/exception.go create mode 100644 semconv/v1.16.0/http.go create mode 100644 semconv/v1.16.0/httpconv/http.go create mode 100644 semconv/v1.16.0/netconv/net.go create mode 100644 semconv/v1.16.0/resource.go create mode 100644 semconv/v1.16.0/schema.go create mode 100644 semconv/v1.16.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0059b0f3b..314050274d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. - Add the `go.opentelemetry.io/otel/semconv/v1.15.0` package. The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) +- Add the `go.opentelemetry.io/otel/semconv/v1.16.0` package. + The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) ### Changed diff --git a/semconv/v1.16.0/doc.go b/semconv/v1.16.0/doc.go new file mode 100644 index 00000000000..0c17fdd388d --- /dev/null +++ b/semconv/v1.16.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.16.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" diff --git a/semconv/v1.16.0/exception.go b/semconv/v1.16.0/exception.go new file mode 100644 index 00000000000..b7d598f6bb4 --- /dev/null +++ b/semconv/v1.16.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.16.0/http.go b/semconv/v1.16.0/http.go new file mode 100644 index 00000000000..b30fd646027 --- /dev/null +++ b/semconv/v1.16.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.16.0/httpconv/http.go b/semconv/v1.16.0/httpconv/http.go new file mode 100644 index 00000000000..218ac703c2c --- /dev/null +++ b/semconv/v1.16.0/httpconv/http.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.16.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.16.0/netconv/net.go b/semconv/v1.16.0/netconv/net.go new file mode 100644 index 00000000000..9a8a1e94bef --- /dev/null +++ b/semconv/v1.16.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.16.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.16.0/resource.go b/semconv/v1.16.0/resource.go new file mode 100644 index 00000000000..01ed2dafd78 --- /dev/null +++ b/semconv/v1.16.0/resource.go @@ -0,0 +1,1118 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [`os.type` and `os.name` attributes](./os.md). However, for consistency, the + // values in the `browser.platform` attribute should capture the exact value that + // the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // A boolean that is true if the browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + // Full user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + // Preferred language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGoogleCloudOpenshift = CloudPlatformKey.String("google_cloud_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. For non-containerized Linux systems, the `machine-id` located in + // `/etc/machine-id` or `/var/lib/dbus/machine-id` may be used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // Parent Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelScopeNameKey = attribute.Key("otel.scope.name") + // The version of the instrumentation scope - (`InstrumentationScope.Version` in + // OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OtelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // Deprecated, use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelLibraryNameKey = attribute.Key("otel.library.name") + // Deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OtelLibraryVersionKey = attribute.Key("otel.library.version") +) diff --git a/semconv/v1.16.0/schema.go b/semconv/v1.16.0/schema.go new file mode 100644 index 00000000000..ae89b300932 --- /dev/null +++ b/semconv/v1.16.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.16.0" diff --git a/semconv/v1.16.0/trace.go b/semconv/v1.16.0/trace.go new file mode 100644 index 00000000000..210e93de0e5 --- /dev/null +++ b/semconv/v1.16.0/trace.go @@ -0,0 +1,1801 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.16.0" + +import "go.opentelemetry.io/otel/attribute" + +// This document defines the shared attributes used to report a single exception associated with a span or log. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// This document defines attributes for Events represented using Log Records. +const ( + // The name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + // The domain identifies the business context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not explicitly + // disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default database + // (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's concepts. +const ( + // Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OtelStatusCodeKey = attribute.Key("otel.status_code") + // Description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OtelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OtelStatusCodeOk = OtelStatusCodeKey.String("OK") + // The operation contains an error + OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or + // GCP, the region in which a function is hosted is essential to uniquely identify + // the function and also part of its endpoint. Since it's part of the endpoint + // being called, the region is always known to clients. In these cases, + // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the + // client or not required for identifying the invoked function, setting + // `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Application layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + // Version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol used and + // might be different from the protocol client's version. If the HTTP client used + // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should + // be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + // Remote socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from `net.peer.name` + // and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, [etc](https://man7.org/linux/man- + // pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + // Remote socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + // Protocol [address family](https://man7.org/linux/man- + // pages/man7/address_families.7.html) which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of + // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry + // SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + // Logical remote hostname, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Logical local hostname or similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // Logical local port number, preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + // Local socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + // Local socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + // The internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User-Agent](https://www.rfc- + // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Client +const ( + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets resent + // by the client, regardless of what was the cause of the resending (e.g. + // redirection, authorization failure, 503 Server Unavailable, network issues, or + // any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// Semantic Convention for HTTP Server +const ( + // The URI scheme identifying the used protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + // The matched route (path template in the format used by the respective server + // framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and the URI + // path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +const ( + // The name of the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + // The type of the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + // The GraphQL document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// This document defines the attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // The message destination name. This might be equal to the span name but is + // required nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + MessagingDestinationKey = attribute.Key("messaging.destination") + // The kind of message destination + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If the message destination is either a + // `queue` or `topic`.) + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination_kind") + // A boolean that is true if the message destination is temporary. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingTempDestinationKey = attribute.Key("messaging.temp_destination") + // The name of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AMQP', 'MQTT' + MessagingProtocolKey = attribute.Key("messaging.protocol") + // The version of the transport protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.9.1' + MessagingProtocolVersionKey = attribute.Key("messaging.protocol_version") + // Connection string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tibjmsnaming://localhost:7222', + // 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue' + MessagingURLKey = attribute.Key("messaging.url") + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message_id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingConversationIDKey = attribute.Key("messaging.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message_payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message_payload_compressed_size_bytes") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // A string identifying the kind of message consumption as defined in the + // [Operation names](#operation-names) section above. If the operation is "send", + // this attribute MUST NOT be set, since the operation can be inferred from the + // span kind in that case. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingOperationKey = attribute.Key("messaging.operation") + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer_group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer_id") +) + +var ( + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqRoutingKeyKey = attribute.Key("messaging.rabbitmq.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message_id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message_key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer_group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaPartitionKey = attribute.Key("messaging.kafka.partition") + // The offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingKafkaTombstoneKey = attribute.Key("messaging.kafka.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // The timestamp in milliseconds that the delay message is expected to be + // delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and delay + // time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqDeliveryTimestampKey = attribute.Key("messaging.rocketmq.delivery_timestamp") + // The delay time level for delay message, which determines the message delay + // time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and + // delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqDelayTimeLevelKey = attribute.Key("messaging.rocketmq.delay_time_level") + // It is essential for FIFO message. Messages that belong to the same message + // group are always processed one by one within the same consumer group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message_group") + // Type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message_type") + // The secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message_tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message_keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default version + // (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) From 78a55822f87eca1c497f46cbb62b94cf89e8dbd9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 10 Jan 2023 10:57:28 -0800 Subject: [PATCH 364/886] Upgrade all semconv dependencies to v1.16.0 (#3581) * Upgrade all semconv ref to v1.16.0 * Add changes to changelog --- CHANGELOG.md | 3 ++ bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../otlp/otlpmetric/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 20 ++++---- exporters/zipkin/model_test.go | 46 +++++++++---------- exporters/zipkin/zipkin_test.go | 2 +- sdk/metric/example_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/sampling.go | 8 ++-- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- 31 files changed, 66 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 314050274d5..9e07f8e8de1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Update the `RegisterCallback` method of the `Meter` in the `go.opentelemetry.io/otel/sdk/metric` package to accept the added `Callback` type instead of an inline function type definition. The underlying type of a `Callback` is the same `func(context.Context)` that the method used to accept. (#3564) - The callback function registered with a `Meter` from the `go.opentelemetry.io/otel/metric` package is required to return an error now. (#3576) +- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. + This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. + Instead it uses the `net.sock.peer` attributes. (#3581) ### Deprecated diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 3875f5ca23d..6f6e824434e 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index bf70dc2ea91..c7a8fcb17da 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 64756216758..edd0f9cc863 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 7f426e6bf3e..bc812a37aaa 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 27e26ca0a1f..6d34832d4a8 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index e0980401728..d7f118baf09 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index ffc8fe9c3b2..95f6b144b5a 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index cac7e98ce53..6c44bae5541 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/metric/unit" - semconv "go.opentelemetry.io/otel/semconv/v1.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.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" diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index db102b4f2aa..8e010a48f0a 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -26,7 +26,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.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" diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index e2c5deea615..f4cc4d179f2 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 11bdd2ea4b6..3fff8f7b2b1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index be1cceb6c42..8873920fb41 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) func TestPrometheusExporter(t *testing.T) { diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index a6103c8c607..48547580b02 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -27,7 +27,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.10.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) var ( diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 48d053bdcdf..3f118e63d72 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -23,7 +23,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 88596717f9e..ffa07d7c165 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) @@ -238,13 +238,13 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { // Rank determines selection order for remote endpoint. See the specification // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin var remoteEndpointKeyRank = map[attribute.Key]int{ - semconv.PeerServiceKey: 0, - semconv.NetPeerNameKey: 1, - semconv.NetPeerIPKey: 2, - keyPeerHostname: 3, - keyPeerAddress: 4, - semconv.HTTPHostKey: 5, - semconv.DBNameKey: 6, + semconv.PeerServiceKey: 0, + semconv.NetPeerNameKey: 1, + semconv.NetSockPeerNameKey: 2, + semconv.NetSockPeerAddrKey: 3, + keyPeerHostname: 4, + keyPeerAddress: 5, + semconv.DBNameKey: 6, } func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint { @@ -273,7 +273,7 @@ func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint { return nil } - if endpointAttr.Key != semconv.NetPeerIPKey && + if endpointAttr.Key != semconv.NetSockPeerAddrKey && endpointAttr.Value.Type() == attribute.STRING { return &zkmodel.Endpoint{ ServiceName: endpointAttr.Value.AsString(), @@ -300,7 +300,7 @@ func remoteEndpointPeerIPWithPort(peerIP string, attrs []attribute.KeyValue) *zk } for _, kv := range attrs { - if kv.Key == semconv.NetPeerPortKey { + if kv.Key == semconv.NetSockPeerPortKey { port, _ := strconv.ParseUint(kv.Value.Emit(), 10, 16) endpoint.Port = uint16(port) return endpoint diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 7c96712d38d..6f4e4553ed0 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) @@ -291,8 +291,8 @@ func TestModelConversion(t *testing.T) { attribute.Int64("attr1", 42), attribute.String("attr2", "bar"), attribute.String("peer.hostname", "test-peer-hostname"), - attribute.String("net.peer.ip", "1.2.3.4"), - attribute.Int64("net.peer.port", 9876), + attribute.String("net.sock.peer.addr", "1.2.3.4"), + attribute.Int64("net.sock.peer.port", 9876), }, Events: []tracesdk.Event{ { @@ -745,17 +745,17 @@ func TestModelConversion(t *testing.T) { }, }, Tags: map[string]string{ - "attr1": "42", - "attr2": "bar", - "net.peer.ip": "1.2.3.4", - "net.peer.port": "9876", - "peer.hostname": "test-peer-hostname", - "otel.status_code": "ERROR", - "error": "404, file not found", - "service.name": "model-test", - "service.version": "0.1.0", - "resource-attr1": "42", - "resource-attr2": "[0,1,2]", + "attr1": "42", + "attr2": "bar", + "net.sock.peer.addr": "1.2.3.4", + "net.sock.peer.port": "9876", + "peer.hostname": "test-peer-hostname", + "otel.status_code": "ERROR", + "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of producer kind @@ -1097,7 +1097,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { Attributes: []attribute.KeyValue{ semconv.PeerServiceKey.String("peer-service-test"), semconv.NetPeerNameKey.String("peer-name-test"), - semconv.HTTPHostKey.String("http-host-test"), + semconv.NetSockPeerNameKey.String("net-sock-peer-test"), }, }, want: &zkmodel.Endpoint{ @@ -1105,16 +1105,16 @@ func TestRemoteEndpointTransformation(t *testing.T) { }, }, { - name: "http-host-rank", + name: "net-sock-peer-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.HTTPHostKey.String("http-host-test"), + semconv.NetSockPeerNameKey.String("net-sock-peer-test"), semconv.DBNameKey.String("db-name-test"), }, }, want: &zkmodel.Endpoint{ - ServiceName: "http-host-test", + ServiceName: "net-sock-peer-test", }, }, { @@ -1137,7 +1137,6 @@ func TestRemoteEndpointTransformation(t *testing.T) { Attributes: []attribute.KeyValue{ keyPeerHostname.String("peer-hostname-test"), keyPeerAddress.String("peer-address-test"), - semconv.HTTPHostKey.String("http-host-test"), semconv.DBNameKey.String("http-host-test"), }, }, @@ -1151,7 +1150,6 @@ func TestRemoteEndpointTransformation(t *testing.T) { SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ keyPeerAddress.String("peer-address-test"), - semconv.HTTPHostKey.String("http-host-test"), semconv.DBNameKey.String("http-host-test"), }, }, @@ -1164,7 +1162,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetPeerIPKey.String("INVALID"), + semconv.NetSockPeerAddrKey.String("INVALID"), }, }, want: nil, @@ -1174,7 +1172,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetPeerIPKey.String("0:0:1:5ee:bad:c0de:0:0"), + semconv.NetSockPeerAddrKey.String("0:0:1:5ee:bad:c0de:0:0"), }, }, want: &zkmodel.Endpoint{ @@ -1186,8 +1184,8 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetPeerIPKey.String("1.2.3.4"), - semconv.NetPeerPortKey.Int(9876), + semconv.NetSockPeerAddrKey.String("1.2.3.4"), + semconv.NetSockPeerPortKey.Int(9876), }, }, want: &zkmodel.Endpoint{ diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index c5a4a6ac8f9..d595a2b3a43 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 33a6b27a412..6fb9208a324 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) func Example() { diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 87ad4b06045..50bd626dd63 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 7af46c61af0..419feb85545 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 7a897e96977..713e571dec4 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 1c349247b0a..f644651630b 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 62de6729e0a..cc1e3d6a78f 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 3b4d0c14dbd..f58fa074ebd 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 5124eff69c3..7729b994fd4 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index 9a169f663fb..f014ab039f4 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 513e782b077..1a57137a14a 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" ) var ( diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index 8102cb91eca..5ee9715d27b 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -163,10 +163,10 @@ func NeverSample() Sampler { // the root(Sampler) is used to make sampling decision. If the span has // a parent, depending on whether the parent is remote and whether it // is sampled, one of the following samplers will apply: -// - remoteParentSampled(Sampler) (default: AlwaysOn) -// - remoteParentNotSampled(Sampler) (default: AlwaysOff) -// - localParentSampled(Sampler) (default: AlwaysOn) -// - localParentNotSampled(Sampler) (default: AlwaysOff) +// - remoteParentSampled(Sampler) (default: AlwaysOn) +// - remoteParentNotSampled(Sampler) (default: AlwaysOff) +// - localParentSampled(Sampler) (default: AlwaysOn) +// - localParentNotSampled(Sampler) (default: AlwaysOff) func ParentBased(root Sampler, samplers ...ParentBasedSamplerOption) Sampler { return parentBased{ root: root, diff --git a/sdk/trace/span.go b/sdk/trace/span.go index b5d6f544176..dbf85a052d2 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index c6adbb77818..5105c81fd9e 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.16.0" "go.opentelemetry.io/otel/trace" ) From 36904e44635cf9e0e392fc05d84ae681916fca52 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 10 Jan 2023 15:06:24 -0800 Subject: [PATCH 365/886] Deprecate the syncint64/syncfloat64/asyncint64/asyncfloat64 packages (#3575) * Dep async/sync pkgs for new inst in instrument pkg * Replace use of deprecated instruments * Add changelog entry * Update changelog entry PR number --- CHANGELOG.md | 22 ++++++ metric/example_test.go | 3 +- metric/instrument/asyncfloat64.go | 24 ++++++ .../instrument/asyncfloat64/asyncfloat64.go | 14 ++++ metric/instrument/asyncint64.go | 24 ++++++ metric/instrument/asyncint64/asyncint64.go | 14 ++++ metric/instrument/syncfloat64.go | 35 +++++++++ metric/instrument/syncfloat64/syncfloat64.go | 14 ++++ metric/instrument/syncint64.go | 35 +++++++++ metric/instrument/syncint64/syncint64.go | 14 ++++ metric/internal/global/instruments.go | 64 ++++++++-------- metric/internal/global/meter.go | 28 +++---- metric/internal/global/meter_test.go | 4 +- metric/internal/global/meter_types_test.go | 28 +++---- metric/meter.go | 28 +++---- metric/noop.go | 76 +++++++++---------- sdk/metric/benchmark_test.go | 4 +- sdk/metric/instrument.go | 28 +++---- .../internal/aggregator_example_test.go | 7 +- sdk/metric/meter.go | 28 +++---- sdk/metric/meter_test.go | 28 +++---- 21 files changed, 341 insertions(+), 181 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e07f8e8de1..33d3cf58bde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) - Add the `go.opentelemetry.io/otel/semconv/v1.16.0` package. The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) +- Metric instruments were added to `go.opentelemetry.io/otel/metric/instrument`. + These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575) + - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` + - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` + - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` + - `Int64ObservableCounter` replaces the `asyncint64.Counter` + - `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter` + - `Int64ObservableGauge` replaces the `asyncint64.Gauge` + - `Float64Counter` replaces the `syncfloat64.Counter` + - `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter` + - `Float64Histogram` replaces the `syncfloat64.Histogram` + - `Int64Counter` replaces the `syncint64.Counter` + - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` + - `Int64Histogram` replaces the `syncint64.Histogram` ### Changed @@ -89,6 +103,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Deprecated - The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. Use `NewMetricProducer` instead. (#3541) +- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. + Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) ### Removed diff --git a/metric/example_test.go b/metric/example_test.go index c6beeca7fc3..ac72d3e8cba 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" "go.opentelemetry.io/otel/metric/unit" ) @@ -112,4 +111,4 @@ func ExampleMeter_asynchronous_multiple() { } // This is just an example, see the the contrib runtime instrumentation for real implementation. -func computeGCPauses(ctx context.Context, recorder syncfloat64.Histogram, pauseBuff []uint64) {} +func computeGCPauses(ctx context.Context, recorder instrument.Float64Histogram, pauseBuff []uint64) {} diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index 9f77afb7d38..ad58dd0d9e7 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -34,6 +34,30 @@ type Float64Observer interface { Observe(ctx context.Context, value float64, attributes ...attribute.KeyValue) } +// Float64ObservableCounter is an instrument used to asynchronously record +// increasing float64 measurements once per a measurement collection cycle. The +// Observe method is used to record the measured state of the instrument when +// it is called. Implementations will assume the observed value to be the +// cumulative sum of the count. +// +// Warning: methods may be added to this interface in minor releases. +type Float64ObservableCounter interface{ Float64Observer } + +// Float64ObservableUpDownCounter is an instrument used to asynchronously +// record float64 measurements once per a measurement collection cycle. The +// Observe method is used to record the measured state of the instrument when +// it is called. Implementations will assume the observed value to be the +// cumulative sum of the count. +// +// Warning: methods may be added to this interface in minor releases. +type Float64ObservableUpDownCounter interface{ Float64Observer } + +// Float64ObservableGauge is an instrument used to asynchronously record +// instantaneous float64 measurements once per a measurement collection cycle. +// +// Warning: methods may be added to this interface in minor releases. +type Float64ObservableGauge interface{ Float64Observer } + // Float64Callback is a function registered with a Meter that makes // observations for a Float64Observer it is registered with. // diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go index 1932d55d225..7fb43ca363e 100644 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ b/metric/instrument/asyncfloat64/asyncfloat64.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package asyncfloat64 provides asynchronous instruments that accept float64 +// measurments. +// +// Deprecated: Use the instruments provided by +// go.opentelemetry.io/otel/metric/instrument instead. package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" import "go.opentelemetry.io/otel/metric/instrument" @@ -23,6 +28,9 @@ import "go.opentelemetry.io/otel/metric/instrument" // the count. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64ObservableCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type Counter interface{ instrument.Float64Observer } // UpDownCounter is an instrument used to asynchronously record float64 @@ -32,10 +40,16 @@ type Counter interface{ instrument.Float64Observer } // the count. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64ObservableUpDownCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type UpDownCounter interface{ instrument.Float64Observer } // Gauge is an instrument used to asynchronously record instantaneous float64 // measurements once per a measurement collection cycle. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64ObservableGauge in +// go.opentelemetry.io/otel/metric/instrument instead. type Gauge interface{ instrument.Float64Observer } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index 296da3e6f94..debba92f0aa 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -35,6 +35,30 @@ type Int64Observer interface { Observe(ctx context.Context, value int64, attributes ...attribute.KeyValue) } +// Int64ObservableCounter is an instrument used to asynchronously record +// increasing int64 measurements once per a measurement collection cycle. The +// Observe method is used to record the measured state of the instrument when +// it is called. Implementations will assume the observed value to be the +// cumulative sum of the count. +// +// Warning: methods may be added to this interface in minor releases. +type Int64ObservableCounter interface{ Int64Observer } + +// Int64ObservableUpDownCounter is an instrument used to asynchronously record +// int64 measurements once per a measurement collection cycle. The Observe +// method is used to record the measured state of the instrument when it is +// called. Implementations will assume the observed value to be the cumulative +// sum of the count. +// +// Warning: methods may be added to this interface in minor releases. +type Int64ObservableUpDownCounter interface{ Int64Observer } + +// Int64ObservableGauge is an instrument used to asynchronously record +// instantaneous int64 measurements once per a measurement collection cycle. +// +// Warning: methods may be added to this interface in minor releases. +type Int64ObservableGauge interface{ Int64Observer } + // Int64Callback is a function registered with a Meter that makes // observations for an Int64Observer it is registered with. // diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go index 8cf970855c8..1e3be250da8 100644 --- a/metric/instrument/asyncint64/asyncint64.go +++ b/metric/instrument/asyncint64/asyncint64.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package asyncint64 provides asynchronous instruments that accept int64 +// measurments. +// +// Deprecated: Use the instruments provided by +// go.opentelemetry.io/otel/metric/instrument instead. package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64" import "go.opentelemetry.io/otel/metric/instrument" @@ -23,6 +28,9 @@ import "go.opentelemetry.io/otel/metric/instrument" // the count. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64ObservableCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type Counter interface{ instrument.Int64Observer } // UpDownCounter is an instrument used to asynchronously record int64 @@ -32,10 +40,16 @@ type Counter interface{ instrument.Int64Observer } // the count. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64ObservableUpDownCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type UpDownCounter interface{ instrument.Int64Observer } // Gauge is an instrument used to asynchronously record instantaneous int64 // measurements once per a measurement collection cycle. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64ObservableGauge in +// go.opentelemetry.io/otel/metric/instrument instead. type Gauge interface{ instrument.Int64Observer } diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index b3df2b02f20..d8f6ba9f438 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -15,9 +15,44 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( + "context" + + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" ) +// Float64Counter is an instrument that records increasing float64 values. +// +// Warning: methods may be added to this interface in minor releases. +type Float64Counter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + Synchronous +} + +// Float64UpDownCounter is an instrument that records increasing or decreasing +// float64 values. +// +// Warning: methods may be added to this interface in minor releases. +type Float64UpDownCounter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + Synchronous +} + +// Float64Histogram is an instrument that records a distribution of float64 +// values. +// +// Warning: methods may be added to this interface in minor releases. +type Float64Histogram interface { + // Record adds an additional value to the distribution. + Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + + Synchronous +} + // Float64Config contains options for Asynchronous instruments that // observe float64 values. type Float64Config struct { diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go index dff6b77b4f9..bd835ec842d 100644 --- a/metric/instrument/syncfloat64/syncfloat64.go +++ b/metric/instrument/syncfloat64/syncfloat64.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package syncfloat64 provides synchronous instruments that accept float64 +// measurments. +// +// Deprecated: Use the instruments provided by +// go.opentelemetry.io/otel/metric/instrument instead. package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64" import ( @@ -24,6 +29,9 @@ import ( // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64Counter in +// go.opentelemetry.io/otel/metric/instrument instead. type Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) @@ -34,6 +42,9 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64UpDownCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) @@ -44,6 +55,9 @@ type UpDownCounter interface { // Histogram is an instrument that records a distribution of values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Float64Histogram in +// go.opentelemetry.io/otel/metric/instrument instead. type Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index d49aed6c85d..96bf730e4b3 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -15,9 +15,44 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( + "context" + + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/unit" ) +// Int64Counter is an instrument that records increasing int64 values. +// +// Warning: methods may be added to this interface in minor releases. +type Int64Counter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + Synchronous +} + +// Int64UpDownCounter is an instrument that records increasing or decreasing +// int64 values. +// +// Warning: methods may be added to this interface in minor releases. +type Int64UpDownCounter interface { + // Add records a change to the counter. + Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + Synchronous +} + +// Int64Histogram is an instrument that records a distribution of int64 +// values. +// +// Warning: methods may be added to this interface in minor releases. +type Int64Histogram interface { + // Record adds an additional value to the distribution. + Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + + Synchronous +} + // Int64Config contains options for Synchronous instruments that record int64 // values. type Int64Config struct { diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go index 2611c513cff..88408113f71 100644 --- a/metric/instrument/syncint64/syncint64.go +++ b/metric/instrument/syncint64/syncint64.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package syncint64 provides synchronous instruments that accept int64 +// measurments. +// +// Deprecated: Use the instruments provided by +// go.opentelemetry.io/otel/metric/instrument instead. package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64" import ( @@ -24,6 +29,9 @@ import ( // Counter is an instrument that records increasing values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64Counter in +// go.opentelemetry.io/otel/metric/instrument instead. type Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) @@ -34,6 +42,9 @@ type Counter interface { // UpDownCounter is an instrument that records increasing or decreasing values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64UpDownCounter in +// go.opentelemetry.io/otel/metric/instrument instead. type UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) @@ -44,6 +55,9 @@ type UpDownCounter interface { // Histogram is an instrument that records a distribution of values. // // Warning: methods may be added to this interface in minor releases. +// +// Deprecated: Use the Int64Histogram in +// go.opentelemetry.io/otel/metric/instrument instead. type Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 4b4e77ff988..c4b3d1ff5ab 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -22,17 +22,13 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" ) type afCounter struct { name string opts []instrument.Float64ObserverOption - delegate atomic.Value //asyncfloat64.Counter + delegate atomic.Value //instrument.Float64ObservableCounter instrument.Asynchronous } @@ -48,13 +44,13 @@ func (i *afCounter) setDelegate(m metric.Meter) { func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.Counter).Observe(ctx, x, attrs...) + ctr.(instrument.Float64ObservableCounter).Observe(ctx, x, attrs...) } } func (i *afCounter) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.Counter) + return ctr.(instrument.Float64ObservableCounter) } return nil } @@ -63,7 +59,7 @@ type afUpDownCounter struct { name string opts []instrument.Float64ObserverOption - delegate atomic.Value //asyncfloat64.UpDownCounter + delegate atomic.Value //instrument.Float64ObservableUpDownCounter instrument.Asynchronous } @@ -79,13 +75,13 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) { func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.UpDownCounter).Observe(ctx, x, attrs...) + ctr.(instrument.Float64ObservableUpDownCounter).Observe(ctx, x, attrs...) } } func (i *afUpDownCounter) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.UpDownCounter) + return ctr.(instrument.Float64ObservableUpDownCounter) } return nil } @@ -94,7 +90,7 @@ type afGauge struct { name string opts []instrument.Float64ObserverOption - delegate atomic.Value //asyncfloat64.Gauge + delegate atomic.Value //instrument.Float64ObservableGauge instrument.Asynchronous } @@ -110,13 +106,13 @@ func (i *afGauge) setDelegate(m metric.Meter) { func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncfloat64.Gauge).Observe(ctx, x, attrs...) + ctr.(instrument.Float64ObservableGauge).Observe(ctx, x, attrs...) } } func (i *afGauge) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncfloat64.Gauge) + return ctr.(instrument.Float64ObservableGauge) } return nil } @@ -125,7 +121,7 @@ type aiCounter struct { name string opts []instrument.Int64ObserverOption - delegate atomic.Value //asyncint64.Counter + delegate atomic.Value //instrument.Int64ObservableCounter instrument.Asynchronous } @@ -141,13 +137,13 @@ func (i *aiCounter) setDelegate(m metric.Meter) { func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.Counter).Observe(ctx, x, attrs...) + ctr.(instrument.Int64ObservableCounter).Observe(ctx, x, attrs...) } } func (i *aiCounter) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.Counter) + return ctr.(instrument.Int64ObservableCounter) } return nil } @@ -156,7 +152,7 @@ type aiUpDownCounter struct { name string opts []instrument.Int64ObserverOption - delegate atomic.Value //asyncint64.UpDownCounter + delegate atomic.Value //instrument.Int64ObservableUpDownCounter instrument.Asynchronous } @@ -172,13 +168,13 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) { func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.UpDownCounter).Observe(ctx, x, attrs...) + ctr.(instrument.Int64ObservableUpDownCounter).Observe(ctx, x, attrs...) } } func (i *aiUpDownCounter) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.UpDownCounter) + return ctr.(instrument.Int64ObservableUpDownCounter) } return nil } @@ -187,7 +183,7 @@ type aiGauge struct { name string opts []instrument.Int64ObserverOption - delegate atomic.Value //asyncint64.Gauge + delegate atomic.Value //instrument.Int64ObservableGauge instrument.Asynchronous } @@ -203,13 +199,13 @@ func (i *aiGauge) setDelegate(m metric.Meter) { func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(asyncint64.Gauge).Observe(ctx, x, attrs...) + ctr.(instrument.Int64ObservableGauge).Observe(ctx, x, attrs...) } } func (i *aiGauge) unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(asyncint64.Gauge) + return ctr.(instrument.Int64ObservableGauge) } return nil } @@ -219,7 +215,7 @@ type sfCounter struct { name string opts []instrument.Float64Option - delegate atomic.Value //syncfloat64.Counter + delegate atomic.Value //instrument.Float64Counter instrument.Synchronous } @@ -235,7 +231,7 @@ func (i *sfCounter) setDelegate(m metric.Meter) { func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.Counter).Add(ctx, incr, attrs...) + ctr.(instrument.Float64Counter).Add(ctx, incr, attrs...) } } @@ -243,7 +239,7 @@ type sfUpDownCounter struct { name string opts []instrument.Float64Option - delegate atomic.Value //syncfloat64.UpDownCounter + delegate atomic.Value //instrument.Float64UpDownCounter instrument.Synchronous } @@ -259,7 +255,7 @@ func (i *sfUpDownCounter) setDelegate(m metric.Meter) { func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.UpDownCounter).Add(ctx, incr, attrs...) + ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, attrs...) } } @@ -267,7 +263,7 @@ type sfHistogram struct { name string opts []instrument.Float64Option - delegate atomic.Value //syncfloat64.Histogram + delegate atomic.Value //instrument.Float64Histogram instrument.Synchronous } @@ -283,7 +279,7 @@ func (i *sfHistogram) setDelegate(m metric.Meter) { func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncfloat64.Histogram).Record(ctx, x, attrs...) + ctr.(instrument.Float64Histogram).Record(ctx, x, attrs...) } } @@ -291,7 +287,7 @@ type siCounter struct { name string opts []instrument.Int64Option - delegate atomic.Value //syncint64.Counter + delegate atomic.Value //instrument.Int64Counter instrument.Synchronous } @@ -307,7 +303,7 @@ func (i *siCounter) setDelegate(m metric.Meter) { func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.Counter).Add(ctx, x, attrs...) + ctr.(instrument.Int64Counter).Add(ctx, x, attrs...) } } @@ -315,7 +311,7 @@ type siUpDownCounter struct { name string opts []instrument.Int64Option - delegate atomic.Value //syncint64.UpDownCounter + delegate atomic.Value //instrument.Int64UpDownCounter instrument.Synchronous } @@ -331,7 +327,7 @@ func (i *siUpDownCounter) setDelegate(m metric.Meter) { func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.UpDownCounter).Add(ctx, x, attrs...) + ctr.(instrument.Int64UpDownCounter).Add(ctx, x, attrs...) } } @@ -339,7 +335,7 @@ type siHistogram struct { name string opts []instrument.Int64Option - delegate atomic.Value //syncint64.Histogram + delegate atomic.Value //instrument.Int64Histogram instrument.Synchronous } @@ -355,6 +351,6 @@ func (i *siHistogram) setDelegate(m metric.Meter) { func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(syncint64.Histogram).Record(ctx, x, attrs...) + ctr.(instrument.Int64Histogram).Record(ctx, x, attrs...) } } diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index bdde4e87ea0..97ad2735bea 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -22,10 +22,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" ) // meterProvider is a placeholder for a configured SDK MeterProvider. @@ -146,7 +142,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { m.registry.Init() } -func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { +func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Counter(name, options...) } @@ -157,7 +153,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (sy return i, nil } -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64UpDownCounter(name, options...) } @@ -168,7 +164,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio return i, nil } -func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { +func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Histogram(name, options...) } @@ -179,7 +175,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) ( return i, nil } -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableCounter(name, options...) } @@ -190,7 +186,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O return i, nil } -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableUpDownCounter(name, options...) } @@ -201,7 +197,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. return i, nil } -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableGauge(name, options...) } @@ -212,7 +208,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs return i, nil } -func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { +func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Counter(name, options...) } @@ -223,7 +219,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) return i, nil } -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64UpDownCounter(name, options...) } @@ -234,7 +230,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O return i, nil } -func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { +func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Histogram(name, options...) } @@ -245,7 +241,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio return i, nil } -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableCounter(name, options...) } @@ -256,7 +252,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa return i, nil } -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableUpDownCounter(name, options...) } @@ -267,7 +263,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen return i, nil } -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableGauge(name, options...) } diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 86d6f3e0ade..0260a7dedb3 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -25,8 +25,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" ) func TestMeterProviderRace(t *testing.T) { @@ -115,7 +113,7 @@ func TestUnregisterRace(t *testing.T) { close(finish) } -func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (syncfloat64.Counter, asyncfloat64.Counter) { +func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (instrument.Float64Counter, instrument.Float64ObservableCounter) { afcounter, err := m.Float64ObservableCounter("test_Async_Counter") require.NoError(t, err) _, err = m.Float64ObservableUpDownCounter("test_Async_UpDownCounter") diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 31903995a83..57711f29e62 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -19,10 +19,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" ) type testMeterProvider struct { @@ -55,62 +51,62 @@ type testMeter struct { callbacks []metric.Callback } -func (m *testMeter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { +func (m *testMeter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { m.siCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { m.siUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { +func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { m.siHist++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { +func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { m.aiCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { +func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { m.aiUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { +func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { m.aiGauge++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { +func (m *testMeter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { m.sfCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { +func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { m.sfUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { +func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { m.sfHist++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { +func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { m.afCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { +func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { m.afUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { +func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { m.afGauge++ return &testCountingFloatInstrument{}, nil } diff --git a/metric/meter.go b/metric/meter.go index 35ffe0de384..41cbf91f255 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -18,10 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" ) // MeterProvider provides access to named Meter instances, for instrumenting @@ -44,56 +40,56 @@ type Meter interface { // Int64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // int64 measurements during a computational operation. - Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) + Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. - Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) + Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) // Int64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of int64 measurements during a computational operation. - Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) + Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. - Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) + Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) // Int64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously // record int64 measurements once per a measurement collection cycle. - Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) + Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection // cycle. - Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) + Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) // Float64Counter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // increasing float64 measurements during a computational operation. - Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) + Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. - Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) + Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) // Float64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of float64 measurements during a computational // operation. - Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) + Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. - Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) + Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) // Float64ObservableUpDownCounter returns a new instrument identified by // name and configured with options. The instrument is used to // asynchronously record float64 measurements once per a measurement // collection cycle. - Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) + Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection // cycle. - Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) + Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. diff --git a/metric/noop.go b/metric/noop.go index 8c717f2a92a..98652b4fac7 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -19,10 +19,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" ) // NewNoopMeterProvider creates a MeterProvider that does not record any metrics. @@ -43,51 +39,51 @@ func NewNoopMeter() Meter { type noopMeter struct{} -func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { +func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { +func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { +func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { +func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { +func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (syncfloat64.Counter, error) { +func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { +func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (syncfloat64.Histogram, error) { +func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { +func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { +func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { +func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { return nonrecordingAsyncFloat64Instrument{}, nil } @@ -105,20 +101,20 @@ type nonrecordingAsyncFloat64Instrument struct { } var ( - _ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{} - _ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{} + _ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{} + _ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{} + _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{} ) -func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { +func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { +func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { +func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { return n, nil } @@ -131,20 +127,20 @@ type nonrecordingAsyncInt64Instrument struct { } var ( - _ asyncint64.Counter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{} - _ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{} + _ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{} + _ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{} + _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} ) -func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { +func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { +func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { return n, nil } -func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { +func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { return n, nil } @@ -156,20 +152,20 @@ type nonrecordingSyncFloat64Instrument struct { } var ( - _ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{} - _ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{} + _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{} + _ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{} + _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{} ) -func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Float64Option) (syncfloat64.Counter, error) { +func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { +func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Float64Option) (syncfloat64.Histogram, error) { +func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) { return n, nil } @@ -186,20 +182,20 @@ type nonrecordingSyncInt64Instrument struct { } var ( - _ syncint64.Counter = nonrecordingSyncInt64Instrument{} - _ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{} - _ syncint64.Histogram = nonrecordingSyncInt64Instrument{} + _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{} + _ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{} + _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{} ) -func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { +func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { return n, nil } -func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { +func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { return n, nil } diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index e77bf149e2e..c7bf12beb67 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -19,10 +19,10 @@ import ( "testing" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument/syncint64" + "go.opentelemetry.io/otel/metric/instrument" ) -func benchCounter(b *testing.B, views ...View) (context.Context, Reader, syncint64.Counter) { +func benchCounter(b *testing.B, views ...View) (context.Context, Reader, instrument.Int64Counter) { ctx := context.Background() rdr := NewManualReader() provider := NewMeterProvider(WithReader(rdr), WithView(views...)) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 5454a4736ec..5414a8db7e6 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -19,10 +19,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -180,18 +176,18 @@ type instrumentImpl[N int64 | float64] struct { aggregators []internal.Aggregator[N] } -var _ asyncfloat64.Counter = &instrumentImpl[float64]{} -var _ asyncfloat64.UpDownCounter = &instrumentImpl[float64]{} -var _ asyncfloat64.Gauge = &instrumentImpl[float64]{} -var _ asyncint64.Counter = &instrumentImpl[int64]{} -var _ asyncint64.UpDownCounter = &instrumentImpl[int64]{} -var _ asyncint64.Gauge = &instrumentImpl[int64]{} -var _ syncfloat64.Counter = &instrumentImpl[float64]{} -var _ syncfloat64.UpDownCounter = &instrumentImpl[float64]{} -var _ syncfloat64.Histogram = &instrumentImpl[float64]{} -var _ syncint64.Counter = &instrumentImpl[int64]{} -var _ syncint64.UpDownCounter = &instrumentImpl[int64]{} -var _ syncint64.Histogram = &instrumentImpl[int64]{} +var _ instrument.Float64ObservableCounter = &instrumentImpl[float64]{} +var _ instrument.Float64ObservableUpDownCounter = &instrumentImpl[float64]{} +var _ instrument.Float64ObservableGauge = &instrumentImpl[float64]{} +var _ instrument.Int64ObservableCounter = &instrumentImpl[int64]{} +var _ instrument.Int64ObservableUpDownCounter = &instrumentImpl[int64]{} +var _ instrument.Int64ObservableGauge = &instrumentImpl[int64]{} +var _ instrument.Float64Counter = &instrumentImpl[float64]{} +var _ instrument.Float64UpDownCounter = &instrumentImpl[float64]{} +var _ instrument.Float64Histogram = &instrumentImpl[float64]{} +var _ instrument.Int64Counter = &instrumentImpl[int64]{} +var _ instrument.Int64UpDownCounter = &instrumentImpl[int64]{} +var _ instrument.Int64Histogram = &instrumentImpl[int64]{} func (i *instrumentImpl[N]) Observe(ctx context.Context, val N, attrs ...attribute.KeyValue) { // Only record a value if this is being called from the MetricProvider. diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index be5d760f317..b5e58a887e6 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -31,7 +30,7 @@ type meter struct { aggregations []metricdata.Aggregation } -func (p *meter) Int64Counter(string, ...instrument.Int64Option) (syncint64.Counter, error) { +func (p *meter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { // This is an example of how a meter would create an aggregator for a new // counter. At this point the provider would determine the aggregation and // temporality to used based on the Reader and View configuration. Assume @@ -47,7 +46,7 @@ func (p *meter) Int64Counter(string, ...instrument.Int64Option) (syncint64.Count return count, nil } -func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { // This is an example of how a meter would create an aggregator for a new // up-down counter. At this point the provider would determine the // aggregation and temporality to used based on the Reader and View @@ -64,7 +63,7 @@ func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (syncint64 return upDownCount, nil } -func (p *meter) Int64Histogram(string, ...instrument.Int64Option) (syncint64.Histogram, error) { +func (p *meter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { // This is an example of how a meter would create an aggregator for a new // histogram. At this point the provider would determine the aggregation // and temporality to used based on the Reader and View configuration. diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 1ebd0cb8018..7aabb2a999e 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -19,10 +19,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" ) @@ -61,7 +57,7 @@ var _ metric.Meter = (*meter)(nil) // Int64Counter returns a new instrument identified by name and configured with // options. The instrument is used to synchronously record increasing int64 // measurements during a computational operation. -func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (syncint64.Counter, error) { +func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { cfg := instrument.NewInt64Config(options...) const kind = InstrumentKindCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -70,7 +66,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (sy // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (syncint64.UpDownCounter, error) { +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { cfg := instrument.NewInt64Config(options...) const kind = InstrumentKindUpDownCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -79,7 +75,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio // Int64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of int64 measurements during a computational operation. -func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (syncint64.Histogram, error) { +func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { cfg := instrument.NewInt64Config(options...) const kind = InstrumentKindHistogram return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -88,7 +84,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) ( // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.Counter, error) { +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { cfg := instrument.NewInt64ObserverConfig(options...) const kind = InstrumentKindObservableCounter p := int64ObservProvider{m.int64IP} @@ -103,7 +99,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (asyncint64.UpDownCounter, error) { +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { cfg := instrument.NewInt64ObserverConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := int64ObservProvider{m.int64IP} @@ -118,7 +114,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (asyncint64.Gauge, error) { +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { cfg := instrument.NewInt64ObserverConfig(options...) const kind = InstrumentKindObservableGauge p := int64ObservProvider{m.int64IP} @@ -133,7 +129,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs // Float64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // float64 measurements during a computational operation. -func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (syncfloat64.Counter, error) { +func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { cfg := instrument.NewFloat64Config(options...) const kind = InstrumentKindCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -142,7 +138,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (syncfloat64.UpDownCounter, error) { +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { cfg := instrument.NewFloat64Config(options...) const kind = InstrumentKindUpDownCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -151,7 +147,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O // Float64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of float64 measurements during a computational operation. -func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (syncfloat64.Histogram, error) { +func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { cfg := instrument.NewFloat64Config(options...) const kind = InstrumentKindHistogram return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -160,7 +156,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Counter, error) { +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { cfg := instrument.NewFloat64ObserverConfig(options...) const kind = InstrumentKindObservableCounter p := float64ObservProvider{m.float64IP} @@ -175,7 +171,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record // float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.UpDownCounter, error) { +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { cfg := instrument.NewFloat64ObserverConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := float64ObservProvider{m.float64IP} @@ -190,7 +186,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (asyncfloat64.Gauge, error) { +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { cfg := instrument.NewFloat64ObserverConfig(options...) const kind = InstrumentKindObservableGauge p := float64ObservProvider{m.float64IP} diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index b394707b0aa..44209078fa6 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -25,10 +25,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - "go.opentelemetry.io/otel/metric/instrument/asyncint64" - "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -1034,21 +1030,21 @@ func TestAttributeFilter(t *testing.T) { } var ( - aiCounter asyncint64.Counter - aiUpDownCounter asyncint64.UpDownCounter - aiGauge asyncint64.Gauge + aiCounter instrument.Int64ObservableCounter + aiUpDownCounter instrument.Int64ObservableUpDownCounter + aiGauge instrument.Int64ObservableGauge - afCounter asyncfloat64.Counter - afUpDownCounter asyncfloat64.UpDownCounter - afGauge asyncfloat64.Gauge + afCounter instrument.Float64ObservableCounter + afUpDownCounter instrument.Float64ObservableUpDownCounter + afGauge instrument.Float64ObservableGauge - siCounter syncint64.Counter - siUpDownCounter syncint64.UpDownCounter - siHistogram syncint64.Histogram + siCounter instrument.Int64Counter + siUpDownCounter instrument.Int64UpDownCounter + siHistogram instrument.Int64Histogram - sfCounter syncfloat64.Counter - sfUpDownCounter syncfloat64.UpDownCounter - sfHistogram syncfloat64.Histogram + sfCounter instrument.Float64Counter + sfUpDownCounter instrument.Float64UpDownCounter + sfHistogram instrument.Float64Histogram ) func BenchmarkInstrumentCreation(b *testing.B) { From 96d5de11816f8818d68edfde94fffb4241b96f32 Mon Sep 17 00:00:00 2001 From: Martin Evgeniev Date: Wed, 11 Jan 2023 00:22:56 +0100 Subject: [PATCH 366/886] Update manual.md (#3582) Fix typo Missing ',' before newline in argument list Co-authored-by: Tyler Yahn --- website_docs/manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/manual.md b/website_docs/manual.md index 1b5feb9e32f..6a2dcca3f22 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -52,7 +52,7 @@ func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { resource.NewWithAttributes( semconv.SchemaURL, semconv.ServiceNameKey.String("ExampleService"), - ) + ), ) if err != nil { From 89cb6a44621fac52e72de19b11878010e51a8604 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 10 Jan 2023 21:21:58 -0800 Subject: [PATCH 367/886] Update single asynchronous example to use inst opt (#3574) Co-authored-by: Chester Cheung --- metric/example_test.go | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/metric/example_test.go b/metric/example_test.go index ac72d3e8cba..64441c23ace 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -20,6 +20,7 @@ import ( "runtime" "time" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" @@ -51,27 +52,29 @@ func ExampleMeter_asynchronous_single() { meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") - memoryUsage, err := meter.Int64ObservableGauge( - "MemoryUsage", + _, err := meter.Int64ObservableGauge( + "DiskUsage", instrument.WithUnit(unit.Bytes), - ) - if err != nil { - fmt.Println("Failed to register instrument") - panic(err) - } - - _, err = meter.RegisterCallback([]instrument.Asynchronous{memoryUsage}, - func(ctx context.Context) error { - // instrument.WithCallbackFunc(func(ctx context.Context) { - //Do Work to get the real memoryUsage - // mem := GatherMemory(ctx) - mem := 75000 - - memoryUsage.Observe(ctx, int64(mem)) + instrument.WithInt64Callback(func(ctx context.Context, inst instrument.Int64Observer) error { + // Do the real work here to get the real disk usage. For example, + // + // usage, err := GetDiskUsage(diskID) + // if err != nil { + // if retryable(err) { + // // Retry the usage measurement. + // } else { + // return err + // } + // } + // + // For demonstration purpose, a static value is used here. + usage := 75000 + inst.Observe(ctx, int64(usage), attribute.Int("disk.id", 3)) return nil - }) + }), + ) if err != nil { - fmt.Println("Failed to register callback") + fmt.Println("failed to register instrument") panic(err) } } From 640a0cd8bc3844453976c2619c40bee4a1e4a07c Mon Sep 17 00:00:00 2001 From: Robert Lin Date: Wed, 11 Jan 2023 16:59:06 -0800 Subject: [PATCH 368/886] bridge/opentracing: introduce NewTracerProvider that wraps TracerProvider instead of Tracer (#3116) * bridge/opentracing: add NewDynamicWrappedTracerProvider for named tracers * bridge/opentelmeetry: cache created Tracers, add tests * bridge/opentracing: rename constructor to NewTracerProvider * add license header * Update docstring Co-authored-by: Tyler Yahn * fix deprecated docstring * rewrite new lookup TracerProvider as separate type * update docstring * add changelog entries * Update bridge/opentracing/provider.go Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Tyler Yahn Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 2 + bridge/opentracing/provider.go | 71 ++++++++++++++++++++++++ bridge/opentracing/provider_test.go | 85 +++++++++++++++++++++++++++++ bridge/opentracing/wrapper.go | 9 ++- 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 bridge/opentracing/provider.go create mode 100644 bridge/opentracing/provider_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 33d3cf58bde..4bc79e6543d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `Int64Counter` replaces the `syncint64.Counter` - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` - `Int64Histogram` replaces the `syncint64.Histogram` +- Add `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing` to create `WrapperTracer` instances from a `TracerProvider`. (#3316) ### Changed @@ -111,6 +112,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) - The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) +- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. Use `NewTracerProvider` instead. (#3316) ### Removed diff --git a/bridge/opentracing/provider.go b/bridge/opentracing/provider.go new file mode 100644 index 00000000000..941e277baf8 --- /dev/null +++ b/bridge/opentracing/provider.go @@ -0,0 +1,71 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opentracing // import "go.opentelemetry.io/otel/bridge/opentracing" + +import ( + "sync" + + "go.opentelemetry.io/otel/trace" +) + +// TracerProvider is an OpenTelemetry TracerProvider that wraps an OpenTracing +// Tracer. +type TracerProvider struct { + bridge *BridgeTracer + provider trace.TracerProvider + + tracers map[wrappedTracerKey]*WrapperTracer + mtx sync.Mutex +} + +var _ trace.TracerProvider = (*TracerProvider)(nil) + +// NewTracerProvider returns a new TracerProvider that creates new instances of +// WrapperTracer from the given TracerProvider. +func NewTracerProvider(bridge *BridgeTracer, provider trace.TracerProvider) *TracerProvider { + return &TracerProvider{ + bridge: bridge, + provider: provider, + + tracers: make(map[wrappedTracerKey]*WrapperTracer), + } +} + +type wrappedTracerKey struct { + name string + version string +} + +// Tracer creates a WrappedTracer that wraps the OpenTelemetry tracer for each call to +// Tracer(). Repeated calls to Tracer() with the same configuration will look up and +// return an existing instance of WrapperTracer. +func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + p.mtx.Lock() + defer p.mtx.Unlock() + + c := trace.NewTracerConfig(opts...) + key := wrappedTracerKey{ + name: name, + version: c.InstrumentationVersion(), + } + + if t, ok := p.tracers[key]; ok { + return t + } + + wrapper := NewWrapperTracer(p.bridge, p.provider.Tracer(name, opts...)) + p.tracers[key] = wrapper + return wrapper +} diff --git a/bridge/opentracing/provider_test.go b/bridge/opentracing/provider_test.go new file mode 100644 index 00000000000..8af3796e031 --- /dev/null +++ b/bridge/opentracing/provider_test.go @@ -0,0 +1,85 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opentracing + +import ( + "testing" + + "go.opentelemetry.io/otel/bridge/opentracing/internal" + "go.opentelemetry.io/otel/trace" +) + +type namedMockTracer struct { + name string + *internal.MockTracer +} + +type namedMockTracerProvider struct{} + +var _ trace.TracerProvider = (*namedMockTracerProvider)(nil) + +// Tracer returns the WrapperTracer associated with the WrapperTracerProvider. +func (p *namedMockTracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + return &namedMockTracer{ + name: name, + MockTracer: internal.NewMockTracer(), + } +} + +func TestTracerProvider(t *testing.T) { + // assertMockTracerName casts tracer into a named mock tracer provided by + // namedMockTracerProvider, and asserts against its name + assertMockTracerName := func(t *testing.T, tracer trace.Tracer, name string) { + // Unwrap the tracer + wrapped := tracer.(*WrapperTracer) + tracer = wrapped.tracer + + // Cast into the underlying type and assert + if mock, ok := tracer.(*namedMockTracer); ok { + if name != mock.name { + t.Errorf("expected name %q, got %q", name, mock.name) + } + } else if !ok { + t.Errorf("expected *namedMockTracer, got %T", mock) + } + } + + var ( + foobar = "foobar" + bazbar = "bazbar" + provider = NewTracerProvider(nil, &namedMockTracerProvider{}) + ) + + t.Run("Tracers should be created with foobar from provider", func(t *testing.T) { + tracer := provider.Tracer(foobar) + assertMockTracerName(t, tracer, foobar) + }) + + t.Run("Repeated requests to create a tracer should provide the existing tracer", func(t *testing.T) { + tracer1 := provider.Tracer(foobar) + assertMockTracerName(t, tracer1, foobar) + tracer2 := provider.Tracer(foobar) + assertMockTracerName(t, tracer2, foobar) + tracer3 := provider.Tracer(bazbar) + assertMockTracerName(t, tracer3, bazbar) + + if tracer1 != tracer2 { + t.Errorf("expected the same tracer, got different tracers") + } + if tracer1 == tracer3 || tracer2 == tracer3 { + t.Errorf("expected different tracers, got the same tracer") + } + }) +} diff --git a/bridge/opentracing/wrapper.go b/bridge/opentracing/wrapper.go index 8016ea2a87c..3e348c45523 100644 --- a/bridge/opentracing/wrapper.go +++ b/bridge/opentracing/wrapper.go @@ -22,7 +22,9 @@ import ( ) // WrapperTracerProvider is an OpenTelemetry TracerProvider that wraps an -// OpenTracing Tracer. +// OpenTracing Tracer, created by the deprecated NewWrappedTracerProvider. +// +// Deprecated: Use the TracerProvider from NewTracerProvider(...) instead. type WrapperTracerProvider struct { wTracer *WrapperTracer } @@ -35,7 +37,10 @@ func (p *WrapperTracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace. } // NewWrappedTracerProvider creates a new trace provider that creates a single -// instance of WrapperTracer that wraps OpenTelemetry tracer. +// instance of WrapperTracer that wraps OpenTelemetry tracer, and always returns +// it unmodified from Tracer(). +// +// Deprecated: Use NewTracerProvider(...) instead. func NewWrappedTracerProvider(bridge *BridgeTracer, tracer trace.Tracer) *WrapperTracerProvider { return &WrapperTracerProvider{ wTracer: NewWrapperTracer(bridge, tracer), From 42863522e50aa5c3a88043d1b068ccec083264a8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 12 Jan 2023 16:01:51 -0800 Subject: [PATCH 369/886] Update ClientRequest HTTPS determination (#3577) * Update ClientRequest HTTPS determination The ClientRequest function will only report a peer port attribute if that peer port differs from the standard 80 for HTTP and 443 for HTTPS. In determining if the request is for HTTPS use the request URL scheme. This is not perfect. If a user doesn't provide a scheme this will not be correctly detected. However, the current approach of checking if the `TLS` field is non-nil will always be wrong, requests made by client ignore this field and it is always nil. Therefore, switching to using the URL field is the best we can do without having already made the request. * Test HTTPS detection for ClientRequest --- semconv/internal/v2/http.go | 2 +- semconv/internal/v2/http_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/semconv/internal/v2/http.go b/semconv/internal/v2/http.go index 6989391cfbd..0f84a905b04 100644 --- a/semconv/internal/v2/http.go +++ b/semconv/internal/v2/http.go @@ -84,7 +84,7 @@ func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { h = req.URL.Host } peer, p := firstHostPort(h, req.Header.Get("Host")) - port := requiredHTTPPort(req.TLS != nil, p) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) if port > 0 { n++ } diff --git a/semconv/internal/v2/http_test.go b/semconv/internal/v2/http_test.go index edfc7b50f27..73b9aa9b147 100644 --- a/semconv/internal/v2/http_test.go +++ b/semconv/internal/v2/http_test.go @@ -59,6 +59,31 @@ func TestHTTPClientResponse(t *testing.T) { }, got) } +func TestHTTPSClientRequest(t *testing.T) { + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "https", + Host: "127.0.0.1:443", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + } + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.url", "https://127.0.0.1:443/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + }, + hc.ClientRequest(req), + ) +} + func TestHTTPClientRequest(t *testing.T) { const ( user = "alice" From f941b3a8dfbca737c5698f645904abc81a95ecb7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 13 Jan 2023 08:31:14 -0800 Subject: [PATCH 370/886] Restructure RegisterCallback method (#3587) * Restructure RegisterCallback method Instead of accepting instruments to register the callback with as a slice, accept them as variadic arguments. * Add changes to changelog * Add PR number to changes --- CHANGELOG.md | 2 + example/prometheus/main.go | 4 +- metric/example_test.go | 7 +- metric/internal/global/meter.go | 6 +- metric/internal/global/meter_test.go | 16 ++-- metric/internal/global/meter_types_test.go | 2 +- metric/meter.go | 2 +- metric/noop.go | 2 +- sdk/metric/meter.go | 2 +- sdk/metric/meter_test.go | 90 +++++++++++----------- 10 files changed, 67 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc79e6543d..e763a5c706c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. Instead it uses the `net.sock.peer` attributes. (#3581) +- The parameters for the `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/metric` are changed. + The slice of `instrument.Asynchronous` parameter is now passed as a variadic argument. (#3587) ### Deprecated diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 68be2f8d6cb..4e9be3b84da 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -68,11 +68,11 @@ func main() { if err != nil { log.Fatal(err) } - _, err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { + _, err = meter.RegisterCallback(func(ctx context.Context) error { n := -10. + rand.Float64()*(90.) // [-10, 100) gauge.Observe(ctx, n, attrs...) return nil - }) + }, gauge) if err != nil { log.Fatal(err) } diff --git a/metric/example_test.go b/metric/example_test.go index 64441c23ace..4653d612e8c 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -89,10 +89,7 @@ func ExampleMeter_asynchronous_multiple() { gcCount, _ := meter.Int64ObservableCounter("gcCount") gcPause, _ := meter.Float64Histogram("gcPause") - _, err := meter.RegisterCallback([]instrument.Asynchronous{ - heapAlloc, - gcCount, - }, + _, err := meter.RegisterCallback( func(ctx context.Context) error { memStats := &runtime.MemStats{} // This call does work @@ -105,6 +102,8 @@ func ExampleMeter_asynchronous_multiple() { computeGCPauses(ctx, gcPause, memStats.PauseNs[:]) return nil }, + heapAlloc, + gcCount, ) if err != nil { diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 97ad2735bea..92f35e9730b 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -278,10 +278,10 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) - return del.RegisterCallback(insts, f) + return del.RegisterCallback(f, insts...) } m.mtx.Lock() @@ -335,7 +335,7 @@ func (c *registration) setDelegate(m metric.Meter) { return } - reg, err := m.RegisterCallback(insts, c.function) + reg, err := m.RegisterCallback(c.function, insts...) if err != nil { otel.Handle(err) } diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 0260a7dedb3..eeb43689b0e 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -66,7 +66,7 @@ func TestMeterRace(t *testing.T) { _, _ = mtr.Int64Counter(name) _, _ = mtr.Int64UpDownCounter(name) _, _ = mtr.Int64Histogram(name) - _, _ = mtr.RegisterCallback(nil, func(ctx context.Context) error { return nil }) + _, _ = mtr.RegisterCallback(func(ctx context.Context) error { return nil }) if !once { wg.Done() once = true @@ -86,7 +86,7 @@ func TestMeterRace(t *testing.T) { func TestUnregisterRace(t *testing.T) { mtr := &meter{} - reg, err := mtr.RegisterCallback(nil, func(ctx context.Context) error { return nil }) + reg, err := mtr.RegisterCallback(func(ctx context.Context) error { return nil }) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -128,10 +128,10 @@ func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (instrument.Float _, err = m.Int64ObservableGauge("test_Async_Gauge") assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{afcounter}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { afcounter.Observe(ctx, 3) return nil - }) + }, afcounter) require.NoError(t, err) sfcounter, err := m.Float64Counter("test_Async_Counter") @@ -323,10 +323,10 @@ func TestRegistrationDelegation(t *testing.T) { require.NoError(t, err) var called0 bool - reg0, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) error { + reg0, err := m.RegisterCallback(func(context.Context) error { called0 = true return nil - }) + }, actr) require.NoError(t, err) require.Equal(t, 1, mImpl.registry.Len(), "callback not registered") // This means reg0 should not be delegated. @@ -334,10 +334,10 @@ func TestRegistrationDelegation(t *testing.T) { assert.Equal(t, 0, mImpl.registry.Len(), "callback not unregistered") var called1 bool - reg1, err := m.RegisterCallback([]instrument.Asynchronous{actr}, func(context.Context) error { + reg1, err := m.RegisterCallback(func(context.Context) error { called1 = true return nil - }) + }, actr) require.NoError(t, err) require.Equal(t, 1, mImpl.registry.Len(), "second callback not registered") diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 57711f29e62..3dfc74af7b3 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -115,7 +115,7 @@ func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Fl // // It is only valid to call Observe within the scope of the passed function, // and only on the instruments that were registered with this call. -func (m *testMeter) RegisterCallback(i []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { +func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Asynchronous) (metric.Registration, error) { m.callbacks = append(m.callbacks, f) return testReg{ f: func(idx int) func() { diff --git a/metric/meter.go b/metric/meter.go index 41cbf91f255..d384d0df17e 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -102,7 +102,7 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. - RegisterCallback(instruments []instrument.Asynchronous, f Callback) (Registration, error) + RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error) } // Callback is a function registered with a Meter that makes observations for diff --git a/metric/noop.go b/metric/noop.go index 98652b4fac7..409268ecc98 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -88,7 +88,7 @@ func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOpt } // RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback([]instrument.Asynchronous, Callback) (Registration, error) { +func (noopMeter) RegisterCallback(Callback, ...instrument.Asynchronous) (Registration, error) { return noopReg{}, nil } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 7aabb2a999e..ab0128c98b7 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -200,7 +200,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. -func (m *meter) RegisterCallback(insts []instrument.Asynchronous, f metric.Callback) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { for _, inst := range insts { // Only register if at least one instrument has a non-drop aggregation. // Otherwise, calling f during collection will be wasted computation. diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 44209078fa6..0ea3614d03b 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -101,11 +101,11 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { m := NewMeterProvider().Meter("callback-concurrency") go func() { - _, _ = m.RegisterCallback([]instrument.Asynchronous{}, emptyCallback) + _, _ = m.RegisterCallback(emptyCallback) wg.Done() }() go func() { - _, _ = m.RegisterCallback([]instrument.Asynchronous{}, emptyCallback) + _, _ = m.RegisterCallback(emptyCallback) wg.Done() }() wg.Wait() @@ -113,7 +113,7 @@ func TestMeterCallbackCreationConcurrency(t *testing.T) { func TestNoopCallbackUnregisterConcurrency(t *testing.T) { m := NewMeterProvider().Meter("noop-unregister-concurrency") - reg, err := m.RegisterCallback(nil, emptyCallback) + reg, err := m.RegisterCallback(emptyCallback) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -140,12 +140,10 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { ag, err := meter.Int64ObservableGauge("gauge") require.NoError(t, err) - i := []instrument.Asynchronous{actr} - regCtr, err := meter.RegisterCallback(i, emptyCallback) + regCtr, err := meter.RegisterCallback(emptyCallback, actr) require.NoError(t, err) - i = []instrument.Asynchronous{ag} - regG, err := meter.RegisterCallback(i, emptyCallback) + regG, err := meter.RegisterCallback(emptyCallback, ag) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -181,10 +179,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 3) return nil - }) + }, ctr) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -211,10 +209,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 11) return nil - }) + }, ctr) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -241,10 +239,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { gauge.Observe(ctx, 11) return nil - }) + }, gauge) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -269,10 +267,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 3) return nil - }) + }, ctr) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -299,10 +297,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 11) return nil - }) + }, ctr) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -329,10 +327,10 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error { + _, err = m.RegisterCallback(func(ctx context.Context) error { gauge.Observe(ctx, 11) return nil - }) + }, gauge) assert.NoError(t, err) // Observed outside of a callback, it should be ignored. @@ -505,19 +503,19 @@ func TestMetersProvideScope(t *testing.T) { m1 := mp.Meter("scope1") ctr1, err := m1.Float64ObservableCounter("ctr1") assert.NoError(t, err) - _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr1}, func(ctx context.Context) error { + _, err = m1.RegisterCallback(func(ctx context.Context) error { ctr1.Observe(ctx, 5) return nil - }) + }, ctr1) assert.NoError(t, err) m2 := mp.Meter("scope2") ctr2, err := m2.Int64ObservableCounter("ctr2") assert.NoError(t, err) - _, err = m1.RegisterCallback([]instrument.Asynchronous{ctr2}, func(ctx context.Context) error { + _, err = m1.RegisterCallback(func(ctx context.Context) error { ctr2.Observe(ctx, 7) return nil - }) + }, ctr2) assert.NoError(t, err) want := metricdata.ResourceMetrics{ @@ -593,17 +591,18 @@ func TestUnregisterUnregisters(t *testing.T) { require.NoError(t, err) var called bool - reg, err := m.RegisterCallback([]instrument.Asynchronous{ + reg, err := m.RegisterCallback( + func(context.Context) error { + called = true + return nil + }, int64Counter, int64UpDownCounter, int64Gauge, floag64Counter, floag64UpDownCounter, floag64Gauge, - }, func(context.Context) error { - called = true - return nil - }) + ) require.NoError(t, err) ctx := context.Background() @@ -646,17 +645,18 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { require.NoError(t, err) var called bool - _, err = m.RegisterCallback([]instrument.Asynchronous{ + _, err = m.RegisterCallback( + func(context.Context) error { + called = true + return nil + }, int64Counter, int64UpDownCounter, int64Gauge, floag64Counter, floag64UpDownCounter, floag64Gauge, - }, func(context.Context) error { - called = true - return nil - }) + ) require.NoError(t, err) data, err := r.Collect(context.Background()) @@ -681,11 +681,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ @@ -709,11 +709,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ @@ -737,11 +737,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ @@ -763,11 +763,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ @@ -791,11 +791,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ @@ -819,11 +819,11 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback([]instrument.Asynchronous{ctr}, func(ctx context.Context) error { + _, err = mtr.RegisterCallback(func(ctx context.Context) error { ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil - }) + }, ctr) return err }, wantMetric: metricdata.Metrics{ From e8c6e4517819c57978a7eb2e14d24b9cf0eb7a29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 08:14:50 -0800 Subject: [PATCH 371/886] dependabot updates Mon Jan 16 15:58:25 UTC 2023 (#3596) Bump google.golang.org/grpc from 1.51.0 to 1.52.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.51.0 to 1.52.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.51.0 to 1.52.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.51.0 to 1.52.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.51.0 to 1.52.0 in /example/otel-collector Co-authored-by: MrAlias --- example/otel-collector/go.mod | 10 +++++----- example/otel-collector/go.sum | 19 ++++++++++--------- exporters/otlp/otlpmetric/go.mod | 10 +++++----- exporters/otlp/otlpmetric/go.sum | 19 ++++++++++--------- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 19 ++++++++++--------- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 19 ++++++++++--------- exporters/otlp/otlptrace/go.mod | 10 +++++----- exporters/otlp/otlptrace/go.sum | 19 ++++++++++--------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 19 ++++++++++--------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.sum | 19 ++++++++++--------- 14 files changed, 105 insertions(+), 98 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 51e93789716..6eec4d2aac3 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 go.opentelemetry.io/otel/sdk v1.11.2 go.opentelemetry.io/otel/trace v1.11.2 - google.golang.org/grpc v1.51.0 + google.golang.org/grpc v1.52.0 ) require ( @@ -24,10 +24,10 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 95ced88c1aa..109d7019d71 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -221,8 +221,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -274,8 +274,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -375,8 +375,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -393,8 +394,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 4a03fa1ed02..41db57e65cf 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.11.2 go.opentelemetry.io/otel/sdk/metric v0.34.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.51.0 + google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 ) @@ -24,10 +24,10 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index a389332abcd..225699c0054 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -383,8 +383,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 6bfcc05c59d..9094bdc192b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,8 +12,8 @@ require ( go.opentelemetry.io/otel/metric v0.34.0 go.opentelemetry.io/otel/sdk/metric v0.34.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.51.0 + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 + google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 ) @@ -28,9 +28,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.2 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index a389332abcd..225699c0054 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -383,8 +383,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 0e2920ac556..966250f8831 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -26,11 +26,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.11.2 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.51.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + google.golang.org/grpc v1.52.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index a389332abcd..225699c0054 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -383,8 +383,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 2e1316c0e83..cebb01a92a6 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.11.2 go.opentelemetry.io/otel/trace v1.11.2 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.51.0 + google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 ) @@ -22,10 +22,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index a389332abcd..225699c0054 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -383,8 +383,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 1b729ec9c51..bdca462d9a2 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/sdk v1.11.2 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 - google.golang.org/grpc v1.51.0 + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 + google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 ) @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index ecc94e43098..bac5c087ee8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -231,8 +231,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -275,8 +275,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -284,8 +284,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -386,8 +386,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -404,8 +405,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 30d93b79cc6..33a3262c9e7 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,11 +21,11 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect - golang.org/x/text v0.4.0 // indirect - google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - google.golang.org/grpc v1.51.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + google.golang.org/grpc v1.52.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 9061b36aafb..329247dae33 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -228,8 +228,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -272,8 +272,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -281,8 +281,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -382,8 +382,9 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 h1:b9mVrqYfq3P4bCdaLg1qtBnPzUYgglsIdjZkL/fQVOE= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -400,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 69b18e62a776c9c96e7255fbaea769ea85b38e84 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 19 Jan 2023 06:18:26 -0800 Subject: [PATCH 372/886] Redesign RegisterCallback API (#3584) * Update RegisterCallback and Callback declerations RegisterCallback accepts variadic Asynchronous instruments instead of a slice. Callback accepts an observation result recorder to ensure instruments that are observed by a callback. * Update global, noop, SDK implementations * Fix examples * Add changes to changelog * Test RegisterCallback for invalid observers * Test callbacks from foreign sources not collected * Support registering delegating instruments --- CHANGELOG.md | 7 + example/prometheus/main.go | 5 +- metric/example_test.go | 6 +- metric/internal/global/instruments.go | 47 +++- metric/internal/global/meter_test.go | 16 +- metric/internal/global/meter_types_test.go | 16 +- metric/meter.go | 14 +- sdk/metric/instrument.go | 107 ++++++-- sdk/metric/meter.go | 209 ++++++++++++-- sdk/metric/meter_test.go | 303 ++++++++++++++++++--- sdk/metric/pipeline.go | 8 +- sdk/metric/pipeline_test.go | 6 +- 12 files changed, 630 insertions(+), 114 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e763a5c706c..c18496aaf6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,6 +102,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Instead it uses the `net.sock.peer` attributes. (#3581) - The parameters for the `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/metric` are changed. The slice of `instrument.Asynchronous` parameter is now passed as a variadic argument. (#3587) +- The `Callback` in `go.opentelemetry.io/otel/metric` has the added `Observer` parameter added. + This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) + +### Fixed + +- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. + Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) ### Deprecated diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 4e9be3b84da..5c02d01c9b5 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" + api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric" ) @@ -68,9 +69,9 @@ func main() { if err != nil { log.Fatal(err) } - _, err = meter.RegisterCallback(func(ctx context.Context) error { + _, err = meter.RegisterCallback(func(_ context.Context, o api.Observer) error { n := -10. + rand.Float64()*(90.) // [-10, 100) - gauge.Observe(ctx, n, attrs...) + o.ObserveFloat64(gauge, n, attrs...) return nil }, gauge) if err != nil { diff --git a/metric/example_test.go b/metric/example_test.go index 4653d612e8c..9b33c0f9b5f 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -90,13 +90,13 @@ func ExampleMeter_asynchronous_multiple() { gcPause, _ := meter.Float64Histogram("gcPause") _, err := meter.RegisterCallback( - func(ctx context.Context) error { + func(ctx context.Context, o metric.Observer) error { memStats := &runtime.MemStats{} // This call does work runtime.ReadMemStats(memStats) - heapAlloc.Observe(ctx, int64(memStats.HeapAlloc)) - gcCount.Observe(ctx, int64(memStats.NumGC)) + o.ObserveInt64(heapAlloc, int64(memStats.HeapAlloc)) + o.ObserveInt64(gcCount, int64(memStats.NumGC)) // This function synchronously records the pauses computeGCPauses(ctx, gcPause, memStats.PauseNs[:]) diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index c4b3d1ff5ab..1398ada26be 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -24,6 +24,11 @@ import ( "go.opentelemetry.io/otel/metric/instrument" ) +// unwrapper unwraps to return the underlying instrument implementation. +type unwrapper interface { + Unwrap() instrument.Asynchronous +} + type afCounter struct { name string opts []instrument.Float64ObserverOption @@ -33,6 +38,9 @@ type afCounter struct { instrument.Asynchronous } +var _ unwrapper = (*afCounter)(nil) +var _ instrument.Float64ObservableCounter = (*afCounter)(nil) + func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { @@ -48,7 +56,7 @@ func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.K } } -func (i *afCounter) unwrap() instrument.Asynchronous { +func (i *afCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableCounter) } @@ -64,6 +72,9 @@ type afUpDownCounter struct { instrument.Asynchronous } +var _ unwrapper = (*afUpDownCounter)(nil) +var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) + func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { @@ -79,7 +90,7 @@ func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attri } } -func (i *afUpDownCounter) unwrap() instrument.Asynchronous { +func (i *afUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableUpDownCounter) } @@ -104,13 +115,16 @@ func (i *afGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } +var _ unwrapper = (*afGauge)(nil) +var _ instrument.Float64ObservableGauge = (*afGauge)(nil) + func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { if ctr := i.delegate.Load(); ctr != nil { ctr.(instrument.Float64ObservableGauge).Observe(ctx, x, attrs...) } } -func (i *afGauge) unwrap() instrument.Asynchronous { +func (i *afGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableGauge) } @@ -126,6 +140,9 @@ type aiCounter struct { instrument.Asynchronous } +var _ unwrapper = (*aiCounter)(nil) +var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) + func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { @@ -141,7 +158,7 @@ func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.Key } } -func (i *aiCounter) unwrap() instrument.Asynchronous { +func (i *aiCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableCounter) } @@ -157,6 +174,9 @@ type aiUpDownCounter struct { instrument.Asynchronous } +var _ unwrapper = (*aiUpDownCounter)(nil) +var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) + func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { @@ -172,7 +192,7 @@ func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribu } } -func (i *aiUpDownCounter) unwrap() instrument.Asynchronous { +func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableUpDownCounter) } @@ -188,6 +208,9 @@ type aiGauge struct { instrument.Asynchronous } +var _ unwrapper = (*aiGauge)(nil) +var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) + func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { @@ -203,7 +226,7 @@ func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyVa } } -func (i *aiGauge) unwrap() instrument.Asynchronous { +func (i *aiGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableGauge) } @@ -220,6 +243,8 @@ type sfCounter struct { instrument.Synchronous } +var _ instrument.Float64Counter = (*sfCounter)(nil) + func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { @@ -244,6 +269,8 @@ type sfUpDownCounter struct { instrument.Synchronous } +var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) + func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { @@ -268,6 +295,8 @@ type sfHistogram struct { instrument.Synchronous } +var _ instrument.Float64Histogram = (*sfHistogram)(nil) + func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { @@ -292,6 +321,8 @@ type siCounter struct { instrument.Synchronous } +var _ instrument.Int64Counter = (*siCounter)(nil) + func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { @@ -316,6 +347,8 @@ type siUpDownCounter struct { instrument.Synchronous } +var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) + func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { @@ -340,6 +373,8 @@ type siHistogram struct { instrument.Synchronous } +var _ instrument.Int64Histogram = (*siHistogram)(nil) + func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index eeb43689b0e..704c1f95634 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -45,6 +45,10 @@ func TestMeterProviderRace(t *testing.T) { close(finish) } +var zeroCallback metric.Callback = func(ctx context.Context, or metric.Observer) error { + return nil +} + func TestMeterRace(t *testing.T) { mtr := &meter{} @@ -66,7 +70,7 @@ func TestMeterRace(t *testing.T) { _, _ = mtr.Int64Counter(name) _, _ = mtr.Int64UpDownCounter(name) _, _ = mtr.Int64Histogram(name) - _, _ = mtr.RegisterCallback(func(ctx context.Context) error { return nil }) + _, _ = mtr.RegisterCallback(zeroCallback) if !once { wg.Done() once = true @@ -86,7 +90,7 @@ func TestMeterRace(t *testing.T) { func TestUnregisterRace(t *testing.T) { mtr := &meter{} - reg, err := mtr.RegisterCallback(func(ctx context.Context) error { return nil }) + reg, err := mtr.RegisterCallback(zeroCallback) require.NoError(t, err) wg := &sync.WaitGroup{} @@ -128,8 +132,8 @@ func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (instrument.Float _, err = m.Int64ObservableGauge("test_Async_Gauge") assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - afcounter.Observe(ctx, 3) + _, err = m.RegisterCallback(func(ctx context.Context, obs metric.Observer) error { + obs.ObserveFloat64(afcounter, 3) return nil }, afcounter) require.NoError(t, err) @@ -323,7 +327,7 @@ func TestRegistrationDelegation(t *testing.T) { require.NoError(t, err) var called0 bool - reg0, err := m.RegisterCallback(func(context.Context) error { + reg0, err := m.RegisterCallback(func(context.Context, metric.Observer) error { called0 = true return nil }, actr) @@ -334,7 +338,7 @@ func TestRegistrationDelegation(t *testing.T) { assert.Equal(t, 0, mImpl.registry.Len(), "callback not unregistered") var called1 bool - reg1, err := m.RegisterCallback(func(context.Context) error { + reg1, err := m.RegisterCallback(func(context.Context, metric.Observer) error { called1 = true return nil }, actr) diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 3dfc74af7b3..e32fcdc0fb8 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -17,6 +17,7 @@ package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "context" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) @@ -136,11 +137,24 @@ func (r testReg) Unregister() error { // This enables async collection. func (m *testMeter) collect() { ctx := context.Background() + o := observationRecorder{ctx} for _, f := range m.callbacks { if f == nil { // Unregister. continue } - _ = f(ctx) + _ = f(ctx, o) } } + +type observationRecorder struct { + ctx context.Context +} + +func (o observationRecorder) ObserveFloat64(i instrument.Float64Observer, value float64, attr ...attribute.KeyValue) { + i.Observe(o.ctx, value, attr...) +} + +func (o observationRecorder) ObserveInt64(i instrument.Int64Observer, value int64, attr ...attribute.KeyValue) { + i.Observe(o.ctx, value, attr...) +} diff --git a/metric/meter.go b/metric/meter.go index d384d0df17e..fc39f40b3d8 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -17,6 +17,7 @@ package metric // import "go.opentelemetry.io/otel/metric" import ( "context" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" ) @@ -106,7 +107,8 @@ type Meter interface { } // Callback is a function registered with a Meter that makes observations for -// the set of instruments it is registered with. +// the set of instruments it is registered with. The Observer parameter is used +// to record measurment observations for these instruments. // // The function needs to complete in a finite amount of time and the deadline // of the passed context is expected to be honored. @@ -116,7 +118,15 @@ type Meter interface { // the same attributes as another Callback will report. // // The function needs to be concurrent safe. -type Callback func(context.Context) error +type Callback func(context.Context, Observer) error + +// Observer records measurements for multiple instruments in a Callback. +type Observer interface { + // ObserveFloat64 records the float64 value with attributes for obsrv. + ObserveFloat64(obsrv instrument.Float64Observer, value float64, attributes ...attribute.KeyValue) + // ObserveInt64 records the int64 value with attributes for obsrv. + ObserveInt64(obsrv instrument.Int64Observer, value int64, attributes ...attribute.KeyValue) +} // Registration is an token representing the unique registration of a callback // for a set of instruments with a Meter. diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 5414a8db7e6..2b3c2356d3a 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -16,8 +16,11 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "errors" + "fmt" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" @@ -170,33 +173,17 @@ type instrumentID struct { } type instrumentImpl[N int64 | float64] struct { - instrument.Asynchronous instrument.Synchronous aggregators []internal.Aggregator[N] } -var _ instrument.Float64ObservableCounter = &instrumentImpl[float64]{} -var _ instrument.Float64ObservableUpDownCounter = &instrumentImpl[float64]{} -var _ instrument.Float64ObservableGauge = &instrumentImpl[float64]{} -var _ instrument.Int64ObservableCounter = &instrumentImpl[int64]{} -var _ instrument.Int64ObservableUpDownCounter = &instrumentImpl[int64]{} -var _ instrument.Int64ObservableGauge = &instrumentImpl[int64]{} -var _ instrument.Float64Counter = &instrumentImpl[float64]{} -var _ instrument.Float64UpDownCounter = &instrumentImpl[float64]{} -var _ instrument.Float64Histogram = &instrumentImpl[float64]{} -var _ instrument.Int64Counter = &instrumentImpl[int64]{} -var _ instrument.Int64UpDownCounter = &instrumentImpl[int64]{} -var _ instrument.Int64Histogram = &instrumentImpl[int64]{} - -func (i *instrumentImpl[N]) Observe(ctx context.Context, val N, attrs ...attribute.KeyValue) { - // Only record a value if this is being called from the MetricProvider. - _, ok := ctx.Value(produceKey).(struct{}) - if !ok { - return - } - i.aggregate(ctx, val, attrs) -} +var _ instrument.Float64Counter = (*instrumentImpl[float64])(nil) +var _ instrument.Float64UpDownCounter = (*instrumentImpl[float64])(nil) +var _ instrument.Float64Histogram = (*instrumentImpl[float64])(nil) +var _ instrument.Int64Counter = (*instrumentImpl[int64])(nil) +var _ instrument.Int64UpDownCounter = (*instrumentImpl[int64])(nil) +var _ instrument.Int64Histogram = (*instrumentImpl[int64])(nil) func (i *instrumentImpl[N]) Add(ctx context.Context, val N, attrs ...attribute.KeyValue) { i.aggregate(ctx, val, attrs) @@ -214,3 +201,79 @@ func (i *instrumentImpl[N]) aggregate(ctx context.Context, val N, attrs []attrib agg.Aggregate(val, attribute.NewSet(attrs...)) } } + +// observablID is a comparable unique identifier of an observable. +type observablID[N int64 | float64] struct { + name string + description string + kind InstrumentKind + unit unit.Unit + scope instrumentation.Scope +} + +type observable[N int64 | float64] struct { + instrument.Asynchronous + observablID[N] + + aggregators []internal.Aggregator[N] +} + +func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[N]) *observable[N] { + return &observable[N]{ + observablID: observablID[N]{ + name: name, + description: desc, + kind: kind, + unit: u, + scope: scope, + }, + aggregators: agg, + } +} + +var _ instrument.Float64ObservableCounter = (*observable[float64])(nil) +var _ instrument.Float64ObservableUpDownCounter = (*observable[float64])(nil) +var _ instrument.Float64ObservableGauge = (*observable[float64])(nil) +var _ instrument.Int64ObservableCounter = (*observable[int64])(nil) +var _ instrument.Int64ObservableUpDownCounter = (*observable[int64])(nil) +var _ instrument.Int64ObservableGauge = (*observable[int64])(nil) + +// Observe logs an error. +func (o *observable[N]) Observe(ctx context.Context, val N, attrs ...attribute.KeyValue) { + var zero N + err := errors.New("invalid observation") + global.Error(err, "dropping observation made outside a callback", + "name", o.name, + "description", o.description, + "unit", o.unit, + "number", fmt.Sprintf("%T", zero), + ) +} + +// observe records the val for the set of attrs. +func (o *observable[N]) observe(val N, attrs []attribute.KeyValue) { + for _, agg := range o.aggregators { + agg.Aggregate(val, attribute.NewSet(attrs...)) + } +} + +var errEmptyAgg = errors.New("no aggregators for observable instrument") + +// registerable returns an error if the observable o should not be registered, +// and nil if it should. An errEmptyAgg error is returned if o is effecively a +// no-op because it does not have any aggregators. Also, an error is returned +// if scope defines a Meter other than the one o was created by. +func (o *observable[N]) registerable(scope instrumentation.Scope) error { + if len(o.aggregators) == 0 { + return errEmptyAgg + } + if scope != o.scope { + return fmt.Errorf( + "invalid registration: observable %q from Meter %q, registered with Meter %q", + o.name, + o.scope.Name, + scope.Name, + ) + } + return nil +} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index ab0128c98b7..7a4d6f9d377 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -16,11 +16,16 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "errors" + "fmt" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/internal" ) // meter handles the creation and coordination of all metric instruments. A @@ -28,6 +33,7 @@ import ( // produced by an instrumentation scope will use metric instruments from a // single meter. type meter struct { + scope instrumentation.Scope pipes pipelines int64IP *instProvider[int64] @@ -45,6 +51,7 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { fc := newInstrumentCache[float64](nil, &viewCache) return &meter{ + scope: s, pipes: p, int64IP: newInstProvider(s, p, ic), float64IP: newInstProvider(s, p, fc), @@ -201,28 +208,150 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 // RegisterCallback registers the function f to be called when any of the // insts Collect method is called. func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { + if len(insts) == 0 { + // Don't allocate a observer if not needed. + return noopRegister{}, nil + } + + reg := newObserver() + var errs multierror for _, inst := range insts { - // Only register if at least one instrument has a non-drop aggregation. - // Otherwise, calling f during collection will be wasted computation. - switch t := inst.(type) { - case *instrumentImpl[int64]: - if len(t.aggregators) > 0 { - return m.registerMultiCallback(f) + // Unwrap any global. + if u, ok := inst.(interface { + Unwrap() instrument.Asynchronous + }); ok { + inst = u.Unwrap() + } + + switch o := inst.(type) { + case *observable[int64]: + if err := o.registerable(m.scope); err != nil { + if !errors.Is(err, errEmptyAgg) { + errs.append(err) + } + continue } - case *instrumentImpl[float64]: - if len(t.aggregators) > 0 { - return m.registerMultiCallback(f) + reg.registerInt64(o.observablID) + case *observable[float64]: + if err := o.registerable(m.scope); err != nil { + if !errors.Is(err, errEmptyAgg) { + errs.append(err) + } + continue } + reg.registerFloat64(o.observablID) default: - // Instrument external to the SDK. For example, an instrument from - // the "go.opentelemetry.io/otel/metric/internal/global" package. - // - // Fail gracefully here, assume a valid instrument. - return m.registerMultiCallback(f) + // Instrument external to the SDK. + return nil, fmt.Errorf("invalid observable: from different implementation") + } + } + + if err := errs.errorOrNil(); err != nil { + return nil, err + } + + if reg.len() == 0 { + // All insts use drop aggregation. + return noopRegister{}, nil + } + + cback := func(ctx context.Context) error { + return f(ctx, reg) + } + return m.pipes.registerMultiCallback(cback), nil +} + +type observer struct { + float64 map[observablID[float64]]struct{} + int64 map[observablID[int64]]struct{} +} + +func newObserver() observer { + return observer{ + float64: make(map[observablID[float64]]struct{}), + int64: make(map[observablID[int64]]struct{}), + } +} + +func (r observer) len() int { + return len(r.float64) + len(r.int64) +} + +func (r observer) registerFloat64(id observablID[float64]) { + r.float64[id] = struct{}{} +} + +func (r observer) registerInt64(id observablID[int64]) { + r.int64[id] = struct{}{} +} + +var ( + errUnknownObserver = errors.New("unknown observable instrument") + errUnregObserver = errors.New("observable instrument not registered for callback") +) + +func (r observer) ObserveFloat64(o instrument.Float64Observer, v float64, a ...attribute.KeyValue) { + var oImpl *observable[float64] + switch conv := o.(type) { + case *observable[float64]: + oImpl = conv + case interface { + Unwrap() instrument.Asynchronous + }: + // Unwrap any global. + async := conv.Unwrap() + var ok bool + if oImpl, ok = async.(*observable[float64]); !ok { + global.Error(errUnknownObserver, "failed to record asynchronous") + return } + default: + global.Error(errUnknownObserver, "failed to record") + return + } + + if _, registered := r.float64[oImpl.observablID]; !registered { + global.Error(errUnregObserver, "failed to record", + "name", oImpl.name, + "description", oImpl.description, + "unit", oImpl.unit, + "number", fmt.Sprintf("%T", float64(0)), + ) + return + } + oImpl.observe(v, a) +} + +func (r observer) ObserveInt64(o instrument.Int64Observer, v int64, a ...attribute.KeyValue) { + var oImpl *observable[int64] + switch conv := o.(type) { + case *observable[int64]: + oImpl = conv + case interface { + Unwrap() instrument.Asynchronous + }: + // Unwrap any global. + async := conv.Unwrap() + var ok bool + if oImpl, ok = async.(*observable[int64]); !ok { + global.Error(errUnknownObserver, "failed to record asynchronous") + return + } + default: + global.Error(errUnknownObserver, "failed to record") + return } - // All insts use drop aggregation. - return noopRegister{}, nil + + if _, registered := r.int64[oImpl.observablID]; !registered { + global.Error(errUnregObserver, "failed to record", + "name", oImpl.name, + "description", oImpl.description, + "unit", oImpl.unit, + "number", fmt.Sprintf("%T", int64(0)), + ) + return + } + oImpl.observe(v, a) } type noopRegister struct{} @@ -231,10 +360,6 @@ func (noopRegister) Unregister() error { return nil } -func (m *meter) registerMultiCallback(c metric.Callback) (metric.Registration, error) { - return m.pipes.registerMultiCallback(c), nil -} - // instProvider provides all OpenTelemetry instruments. type instProvider[N int64 | float64] struct { scope instrumentation.Scope @@ -246,8 +371,7 @@ func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c return &instProvider[N]{scope: s, pipes: p, resolve: newResolver(p, c)} } -// lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*instrumentImpl[N], error) { +func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc string, u unit.Unit) ([]internal.Aggregator[N], error) { inst := Instrument{ Name: name, Description: desc, @@ -255,13 +379,23 @@ func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit. Kind: kind, Scope: p.scope, } - aggs, err := p.resolve.Aggregators(inst) + return p.resolve.Aggregators(inst) +} + +// lookup returns the resolved instrumentImpl. +func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*instrumentImpl[N], error) { + aggs, err := p.aggs(kind, name, desc, u) return &instrumentImpl[N]{aggregators: aggs}, err } type int64ObservProvider struct{ *instProvider[int64] } -func (p int64ObservProvider) registerCallbacks(inst *instrumentImpl[int64], cBacks []instrument.Int64Callback) { +func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*observable[int64], error) { + aggs, err := p.aggs(kind, name, desc, u) + return newObservable(p.scope, kind, name, desc, u, aggs), err +} + +func (p int64ObservProvider) registerCallbacks(inst *observable[int64], cBacks []instrument.Int64Callback) { if inst == nil { // Drop aggregator. return @@ -272,13 +406,19 @@ func (p int64ObservProvider) registerCallbacks(inst *instrumentImpl[int64], cBac } } -func (p int64ObservProvider) callback(i *instrumentImpl[int64], f instrument.Int64Callback) func(context.Context) error { - return func(ctx context.Context) error { return f(ctx, i) } +func (p int64ObservProvider) callback(i *observable[int64], f instrument.Int64Callback) func(context.Context) error { + inst := callbackObserver[int64]{i} + return func(ctx context.Context) error { return f(ctx, inst) } } type float64ObservProvider struct{ *instProvider[float64] } -func (p float64ObservProvider) registerCallbacks(inst *instrumentImpl[float64], cBacks []instrument.Float64Callback) { +func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*observable[float64], error) { + aggs, err := p.aggs(kind, name, desc, u) + return newObservable(p.scope, kind, name, desc, u, aggs), err +} + +func (p float64ObservProvider) registerCallbacks(inst *observable[float64], cBacks []instrument.Float64Callback) { if inst == nil { // Drop aggregator. return @@ -289,6 +429,17 @@ func (p float64ObservProvider) registerCallbacks(inst *instrumentImpl[float64], } } -func (p float64ObservProvider) callback(i *instrumentImpl[float64], f instrument.Float64Callback) func(context.Context) error { - return func(ctx context.Context) error { return f(ctx, i) } +func (p float64ObservProvider) callback(i *observable[float64], f instrument.Float64Callback) func(context.Context) error { + inst := callbackObserver[float64]{i} + return func(ctx context.Context) error { return f(ctx, inst) } +} + +// callbackObserver is an observer that records values for a wrapped +// observable. +type callbackObserver[N int64 | float64] struct { + *observable[N] +} + +func (o callbackObserver[N]) Observe(_ context.Context, val N, attrs ...attribute.KeyValue) { + o.observe(val, attrs) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 0ea3614d03b..15c86d63156 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -16,14 +16,20 @@ package metric import ( "context" + "fmt" + "strings" "sync" "testing" + "github.com/go-logr/logr" + "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -91,7 +97,7 @@ func TestMeterInstrumentConcurrency(t *testing.T) { wg.Wait() } -var emptyCallback metric.Callback = func(ctx context.Context) error { return nil } +var emptyCallback metric.Callback = func(context.Context, metric.Observer) error { return nil } // A Meter Should be able register Callbacks Concurrently. func TestMeterCallbackCreationConcurrency(t *testing.T) { @@ -179,8 +185,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 3) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr, 3) return nil }, ctr) assert.NoError(t, err) @@ -209,8 +215,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 11) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr, 11) return nil }, ctr) assert.NoError(t, err) @@ -239,8 +245,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - gauge.Observe(ctx, 11) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(gauge, 11) return nil }, gauge) assert.NoError(t, err) @@ -267,8 +273,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 3) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr, 3) return nil }, ctr) assert.NoError(t, err) @@ -297,8 +303,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 11) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr, 11) return nil }, ctr) assert.NoError(t, err) @@ -327,8 +333,8 @@ func TestMeterCreatesInstruments(t *testing.T) { } gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) assert.NoError(t, err) - _, err = m.RegisterCallback(func(ctx context.Context) error { - gauge.Observe(ctx, 11) + _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(gauge, 11) return nil }, gauge) assert.NoError(t, err) @@ -496,6 +502,229 @@ func TestMeterCreatesInstruments(t *testing.T) { } } +func TestRegisterNonSDKObserverErrors(t *testing.T) { + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr)) + meter := mp.Meter("scope") + + type obsrv struct{ instrument.Asynchronous } + o := obsrv{} + + _, err := meter.RegisterCallback( + func(context.Context, metric.Observer) error { return nil }, + o, + ) + assert.ErrorContains( + t, + err, + "invalid observable: from different implementation", + "External instrument registred", + ) +} + +func TestMeterMixingOnRegisterErrors(t *testing.T) { + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr)) + + m1 := mp.Meter("scope1") + m2 := mp.Meter("scope2") + iCtr, err := m2.Int64ObservableCounter("int64 ctr") + require.NoError(t, err) + fCtr, err := m2.Float64ObservableCounter("float64 ctr") + require.NoError(t, err) + _, err = m1.RegisterCallback( + func(context.Context, metric.Observer) error { return nil }, + iCtr, fCtr, + ) + assert.ErrorContains( + t, + err, + `invalid registration: observable "int64 ctr" from Meter "scope2", registered with Meter "scope1"`, + "Instrument registred with non-creation Meter", + ) + assert.ErrorContains( + t, + err, + `invalid registration: observable "float64 ctr" from Meter "scope2", registered with Meter "scope1"`, + "Instrument registred with non-creation Meter", + ) +} + +func TestCallbackObserverNonRegistered(t *testing.T) { + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr)) + + m1 := mp.Meter("scope1") + valid, err := m1.Int64ObservableCounter("ctr") + require.NoError(t, err) + + m2 := mp.Meter("scope2") + iCtr, err := m2.Int64ObservableCounter("int64 ctr") + require.NoError(t, err) + fCtr, err := m2.Float64ObservableCounter("float64 ctr") + require.NoError(t, err) + + // Panics if Observe is called. + type int64Obsrv struct{ instrument.Int64Observer } + int64Foreign := int64Obsrv{} + type float64Obsrv struct{ instrument.Float64Observer } + float64Foreign := float64Obsrv{} + + _, err = m1.RegisterCallback( + func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(valid, 1) + o.ObserveInt64(iCtr, 1) + o.ObserveFloat64(fCtr, 1) + o.ObserveInt64(int64Foreign, 1) + o.ObserveFloat64(float64Foreign, 1) + return nil + }, + valid, + ) + require.NoError(t, err) + + var got metricdata.ResourceMetrics + assert.NotPanics(t, func() { + got, err = rdr.Collect(context.Background()) + }) + + assert.NoError(t, err) + want := metricdata.ResourceMetrics{ + Resource: resource.Default(), + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "scope1", + }, + Metrics: []metricdata.Metrics{ + { + Name: "ctr", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + { + Value: 1, + }, + }, + }, + }, + }, + }, + }, + } + metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) +} + +type logSink struct { + logr.LogSink + + messages []string +} + +func newLogSink(t *testing.T) *logSink { + return &logSink{LogSink: testr.New(t).GetSink()} +} + +func (l *logSink) Info(level int, msg string, keysAndValues ...interface{}) { + l.messages = append(l.messages, msg) + l.LogSink.Info(level, msg, keysAndValues...) +} + +func (l *logSink) Error(err error, msg string, keysAndValues ...interface{}) { + l.messages = append(l.messages, fmt.Sprintf("%s: %s", err, msg)) + l.LogSink.Error(err, msg, keysAndValues...) +} + +func (l *logSink) String() string { + out := make([]string, len(l.messages)) + for i := range l.messages { + out[i] = "\t-" + l.messages[i] + } + return strings.Join(out, "\n") +} + +func TestGlobalInstRegisterCallback(t *testing.T) { + l := newLogSink(t) + otel.SetLogger(logr.New(l)) + + const mtrName = "TestGlobalInstRegisterCallback" + preMtr := global.Meter(mtrName) + preInt64Ctr, err := preMtr.Int64ObservableCounter("pre.int64.counter") + require.NoError(t, err) + preFloat64Ctr, err := preMtr.Float64ObservableCounter("pre.float64.counter") + require.NoError(t, err) + + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr), WithResource(resource.Empty())) + global.SetMeterProvider(mp) + + postMtr := global.Meter(mtrName) + postInt64Ctr, err := postMtr.Int64ObservableCounter("post.int64.counter") + require.NoError(t, err) + postFloat64Ctr, err := postMtr.Float64ObservableCounter("post.float64.counter") + require.NoError(t, err) + + cb := func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(preInt64Ctr, 1) + o.ObserveFloat64(preFloat64Ctr, 2) + o.ObserveInt64(postInt64Ctr, 3) + o.ObserveFloat64(postFloat64Ctr, 4) + return nil + } + + _, err = preMtr.RegisterCallback(cb, preInt64Ctr, preFloat64Ctr, postInt64Ctr, postFloat64Ctr) + assert.NoError(t, err) + + _, err = preMtr.RegisterCallback(cb, preInt64Ctr, preFloat64Ctr, postInt64Ctr, postFloat64Ctr) + assert.NoError(t, err) + + got, err := rdr.Collect(context.Background()) + assert.NoError(t, err) + assert.Lenf(t, l.messages, 0, "Warnings and errors logged:\n%s", l) + metricdatatest.AssertEqual(t, metricdata.ResourceMetrics{ + ScopeMetrics: []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{Name: "TestGlobalInstRegisterCallback"}, + Metrics: []metricdata.Metrics{ + { + Name: "pre.int64.counter", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{Value: 1}}, + }, + }, + { + Name: "pre.float64.counter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{{Value: 2}}, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + { + Name: "post.int64.counter", + Data: metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{{Value: 3}}, + }, + }, + { + Name: "post.float64.counter", + Data: metricdata.Sum[float64]{ + DataPoints: []metricdata.DataPoint[float64]{{Value: 4}}, + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + }, + }, + }, + }, + }, + }, got, metricdatatest.IgnoreTimestamp()) +} + func TestMetersProvideScope(t *testing.T) { rdr := NewManualReader() mp := NewMeterProvider(WithReader(rdr)) @@ -503,8 +732,8 @@ func TestMetersProvideScope(t *testing.T) { m1 := mp.Meter("scope1") ctr1, err := m1.Float64ObservableCounter("ctr1") assert.NoError(t, err) - _, err = m1.RegisterCallback(func(ctx context.Context) error { - ctr1.Observe(ctx, 5) + _, err = m1.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr1, 5) return nil }, ctr1) assert.NoError(t, err) @@ -512,8 +741,8 @@ func TestMetersProvideScope(t *testing.T) { m2 := mp.Meter("scope2") ctr2, err := m2.Int64ObservableCounter("ctr2") assert.NoError(t, err) - _, err = m1.RegisterCallback(func(ctx context.Context) error { - ctr2.Observe(ctx, 7) + _, err = m2.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr2, 7) return nil }, ctr2) assert.NoError(t, err) @@ -592,7 +821,7 @@ func TestUnregisterUnregisters(t *testing.T) { var called bool reg, err := m.RegisterCallback( - func(context.Context) error { + func(context.Context, metric.Observer) error { called = true return nil }, @@ -646,7 +875,7 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { var called bool _, err = m.RegisterCallback( - func(context.Context) error { + func(context.Context, metric.Observer) error { called = true return nil }, @@ -681,9 +910,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -709,9 +938,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -737,9 +966,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -763,9 +992,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -791,9 +1020,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -819,9 +1048,9 @@ func TestAttributeFilter(t *testing.T) { if err != nil { return err } - _, err = mtr.RegisterCallback(func(ctx context.Context) error { - ctr.Observe(ctx, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Observe(ctx, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { + o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) + o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 32b9125340b..666e095c169 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -104,9 +104,11 @@ func (p *pipeline) addCallback(cback func(context.Context) error) { p.callbacks = append(p.callbacks, cback) } +type multiCallback func(context.Context) error + // addMultiCallback registers a multi-instrument callback to be run when // `produce()` is called. -func (p *pipeline) addMultiCallback(c metric.Callback) (unregister func()) { +func (p *pipeline) addMultiCallback(c multiCallback) (unregister func()) { p.Lock() defer p.Unlock() e := p.multiCallbacks.PushBack(c) @@ -146,7 +148,7 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err } for e := p.multiCallbacks.Front(); e != nil; e = e.Next() { // TODO make the callbacks parallel. ( #3034 ) - f := e.Value.(metric.Callback) + f := e.Value.(multiCallback) if err := f(ctx); err != nil { errs.append(err) } @@ -475,7 +477,7 @@ func (p pipelines) registerCallback(cback func(context.Context) error) { } } -func (p pipelines) registerMultiCallback(c metric.Callback) metric.Registration { +func (p pipelines) registerMultiCallback(c multiCallback) metric.Registration { unregs := make([]func(), len(p)) for i, pipe := range p { unregs[i] = pipe.addMultiCallback(c) diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 7b9f89585dc..3c5e19b8b7d 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -54,7 +54,7 @@ func TestEmptyPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addMultiCallback(emptyCallback) + pipe.addMultiCallback(func(context.Context) error { return nil }) }) output, err = pipe.produce(context.Background()) @@ -78,7 +78,7 @@ func TestNewPipeline(t *testing.T) { }) require.NotPanics(t, func() { - pipe.addMultiCallback(emptyCallback) + pipe.addMultiCallback(func(context.Context) error { return nil }) }) output, err = pipe.produce(context.Background()) @@ -121,7 +121,7 @@ func TestPipelineConcurrency(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - pipe.addMultiCallback(emptyCallback) + pipe.addMultiCallback(func(context.Context) error { return nil }) }() } wg.Wait() From b1a8002c4cf565fc7fa79de7239dbc593c3f6ec2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 19 Jan 2023 10:44:37 -0800 Subject: [PATCH 373/886] Remove stale comments from metric global (#3603) The Observe is not used to record measurements following #3584. --- metric/internal/global/meter.go | 3 --- metric/internal/global/meter_types_test.go | 3 --- 2 files changed, 6 deletions(-) diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 92f35e9730b..8acf632863c 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -275,9 +275,6 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 } // RegisterCallback captures the function that will be called during Collect. -// -// It is only valid to call Observe within the scope of the passed function, -// and only on the instruments that were registered with this call. func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index e32fcdc0fb8..84637b286f9 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -113,9 +113,6 @@ func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Fl } // RegisterCallback captures the function that will be called during Collect. -// -// It is only valid to call Observe within the scope of the passed function, -// and only on the instruments that were registered with this call. func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Asynchronous) (metric.Registration, error) { m.callbacks = append(m.callbacks, f) return testReg{ From 88f60003180115b809e88cbefddfaa32689e70eb Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 20 Jan 2023 09:44:25 -0800 Subject: [PATCH 374/886] Remove the unused produceKey and callbackKey (#3602) Following #3584, this value and type are no longer used. --- sdk/metric/pipeline.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 666e095c169..2be2bf7749f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -119,20 +119,10 @@ func (p *pipeline) addMultiCallback(c multiCallback) (unregister func()) { } } -// callbackKey is a context key type used to identify context that came from the SDK. -type callbackKey int - -// produceKey is the context key to tell if a Observe is called within a callback. -// Its value of zero is arbitrary. If this package defined other context keys, -// they would have different integer values. -const produceKey callbackKey = 0 - // produce returns aggregated metrics from a single collection. // // This method is safe to call concurrently. func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { - ctx = context.WithValue(ctx, produceKey, struct{}{}) - p.Lock() defer p.Unlock() From a1ce7e5f0d12484628dafbb685fbb74e800ea2dd Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 20 Jan 2023 09:54:42 -0800 Subject: [PATCH 375/886] Combine precomputed values of filtered attribute sets (#3549) * Combine spatially aggregated precomputed vals Fix #3439 When an attribute filter drops a distinguishing attribute during the aggregation of a precomputed sum add that value to existing, instead of just setting the value as an override (current behavior). * Ignore false positive lint error and test method * Add fix to changelog * Handle edge case of exact set after filter * Fix filter and measure algo for precomp * Add tests for precomp sums * Unify precomputedMap * Adds example from supplimental guide * Fixes for lint * Update sdk/metric/meter_example_test.go * Fix async example test * Reduce duplicate code in TestAsynchronousExample * Clarify naming and documentation * Fix spelling errors * Add a noop filter to default view Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + sdk/metric/internal/aggregator.go | 25 ++- sdk/metric/internal/filter.go | 86 +++++++- sdk/metric/internal/filter_test.go | 89 ++++++++ sdk/metric/internal/sum.go | 186 ++++++++++++---- sdk/metric/internal/sum_test.go | 129 +++++++++++ sdk/metric/meter_test.go | 330 +++++++++++++++++++++++++---- 7 files changed, 753 insertions(+), 93 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c18496aaf6c..8c8566a8fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,6 +107,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed +- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549) - The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter. Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584) diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregator.go index 952e9a4a8bd..42694d87020 100644 --- a/sdk/metric/internal/aggregator.go +++ b/sdk/metric/internal/aggregator.go @@ -22,13 +22,13 @@ import ( ) // now is used to return the current local time while allowing tests to -// override the the default time.Now function. +// override the default time.Now function. var now = time.Now // Aggregator forms an aggregation from a collection of recorded measurements. // -// Aggregators need to be comparable so they can be de-duplicated by the SDK when -// it creates them for multiple views. +// Aggregators need to be comparable so they can be de-duplicated by the SDK +// when it creates them for multiple views. type Aggregator[N int64 | float64] interface { // Aggregate records the measurement, scoped by attr, and aggregates it // into an aggregation. @@ -38,3 +38,22 @@ type Aggregator[N int64 | float64] interface { // measurements made and ends an aggregation cycle. Aggregation() metricdata.Aggregation } + +// precomputeAggregator is an Aggregator that receives values to aggregate that +// have been pre-computed by the caller. +type precomputeAggregator[N int64 | float64] interface { + // The Aggregate method of the embedded Aggregator is used to record + // pre-computed measurements, scoped by attributes that have not been + // filtered by an attribute filter. + Aggregator[N] + + // aggregateFiltered records measurements scoped by attributes that have + // been filtered by an attribute filter. + // + // Pre-computed measurements of filtered attributes need to be recorded + // separate from those that haven't been filtered so they can be added to + // the non-filtered pre-computed measurements in a collection cycle and + // then resets after the cycle (the non-filtered pre-computed measurements + // are not reset). + aggregateFiltered(N, attribute.Set) +} diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/filter.go index 86e73c866dc..4d24b62819a 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/filter.go @@ -21,8 +21,26 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -// filter is an aggregator that applies attribute filter when Aggregating. filters -// do not have any backing memory, and must be constructed with a backing Aggregator. +// NewFilter returns an Aggregator that wraps an agg with an attribute +// filtering function. Both pre-computed non-pre-computed Aggregators can be +// passed for agg. An appropriate Aggregator will be returned for the detected +// type. +func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggregator[N] { + if fn == nil { + return agg + } + if fa, ok := agg.(precomputeAggregator[N]); ok { + return newPrecomputedFilter(fa, fn) + } + return newFilter(agg, fn) +} + +// filter wraps an aggregator with an attribute filter. All recorded +// measurements will have their attributes filtered before they are passed to +// the underlying aggregator's Aggregate method. +// +// This should not be used to wrap a pre-computed Aggregator. Use a +// precomputedFilter instead. type filter[N int64 | float64] struct { filter attribute.Filter aggregator Aggregator[N] @@ -31,15 +49,16 @@ type filter[N int64 | float64] struct { seen map[attribute.Set]attribute.Set } -// NewFilter wraps an Aggregator with an attribute filtering function. -func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggregator[N] { - if fn == nil { - return agg - } +// newFilter returns an filter Aggregator that wraps agg with the attribute +// filter fn. +// +// This should not be used to wrap a pre-computed Aggregator. Use a +// precomputedFilter instead. +func newFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) *filter[N] { return &filter[N]{ filter: fn, aggregator: agg, - seen: map[attribute.Set]attribute.Set{}, + seen: make(map[attribute.Set]attribute.Set), } } @@ -62,3 +81,54 @@ func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { func (f *filter[N]) Aggregation() metricdata.Aggregation { return f.aggregator.Aggregation() } + +// precomputedFilter is an aggregator that applies attribute filter when +// Aggregating for pre-computed Aggregations. The pre-computed Aggregations +// need to operate normally when no attribute filtering is done (for sums this +// means setting the value), but when attribute filtering is done it needs to +// be added to any set value. +type precomputedFilter[N int64 | float64] struct { + filter attribute.Filter + aggregator precomputeAggregator[N] + + sync.Mutex + seen map[attribute.Set]attribute.Set +} + +// newPrecomputedFilter returns a precomputedFilter Aggregator that wraps agg +// with the attribute filter fn. +// +// This should not be used to wrap a non-pre-computed Aggregator. Use a +// precomputedFilter instead. +func newPrecomputedFilter[N int64 | float64](agg precomputeAggregator[N], fn attribute.Filter) *precomputedFilter[N] { + return &precomputedFilter[N]{ + filter: fn, + aggregator: agg, + seen: make(map[attribute.Set]attribute.Set), + } +} + +// Aggregate records the measurement, scoped by attr, and aggregates it +// into an aggregation. +func (f *precomputedFilter[N]) Aggregate(measurement N, attr attribute.Set) { + // TODO (#3006): drop stale attributes from seen. + f.Lock() + defer f.Unlock() + fAttr, ok := f.seen[attr] + if !ok { + fAttr, _ = attr.Filter(f.filter) + f.seen[attr] = fAttr + } + if fAttr.Equals(&attr) { + // No filtering done. + f.aggregator.Aggregate(measurement, fAttr) + } else { + f.aggregator.aggregateFiltered(measurement, fAttr) + } +} + +// Aggregation returns an Aggregation, for all the aggregated +// measurements made and ends an aggregation cycle. +func (f *precomputedFilter[N]) Aggregation() metricdata.Aggregation { + return f.aggregator.Aggregation() +} diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/filter_test.go index e5632156b30..e1333c1d4d1 100644 --- a/sdk/metric/internal/filter_test.go +++ b/sdk/metric/internal/filter_test.go @@ -15,6 +15,8 @@ package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( + "fmt" + "strings" "sync" "testing" @@ -194,3 +196,90 @@ func TestFilterConcurrent(t *testing.T) { testFilterConcurrent[float64](t) }) } + +func TestPrecomputedFilter(t *testing.T) { + t.Run("Int64", testPrecomputedFilter[int64]()) + t.Run("Float64", testPrecomputedFilter[float64]()) +} + +func testPrecomputedFilter[N int64 | float64]() func(t *testing.T) { + return func(t *testing.T) { + agg := newTestFilterAgg[N]() + f := NewFilter[N](agg, testAttributeFilter) + require.IsType(t, &precomputedFilter[N]{}, f) + + var ( + powerLevel = attribute.Int("power-level", 9000) + user = attribute.String("user", "Alice") + admin = attribute.Bool("admin", true) + ) + a := attribute.NewSet(powerLevel) + key := a + f.Aggregate(1, a) + assert.Equal(t, N(1), agg.values[key].measured, str(a)) + assert.Equal(t, N(0), agg.values[key].filtered, str(a)) + + a = attribute.NewSet(powerLevel, user) + f.Aggregate(2, a) + assert.Equal(t, N(1), agg.values[key].measured, str(a)) + assert.Equal(t, N(2), agg.values[key].filtered, str(a)) + + a = attribute.NewSet(powerLevel, user, admin) + f.Aggregate(3, a) + assert.Equal(t, N(1), agg.values[key].measured, str(a)) + assert.Equal(t, N(5), agg.values[key].filtered, str(a)) + + a = attribute.NewSet(powerLevel) + f.Aggregate(2, a) + assert.Equal(t, N(2), agg.values[key].measured, str(a)) + assert.Equal(t, N(5), agg.values[key].filtered, str(a)) + + a = attribute.NewSet(user) + f.Aggregate(3, a) + assert.Equal(t, N(2), agg.values[key].measured, str(a)) + assert.Equal(t, N(5), agg.values[key].filtered, str(a)) + assert.Equal(t, N(3), agg.values[*attribute.EmptySet()].filtered, str(a)) + + _ = f.Aggregation() + assert.Equal(t, 1, agg.aggregationN, "failed to propagate Aggregation") + } +} + +func str(a attribute.Set) string { + iter := a.Iter() + out := make([]string, 0, iter.Len()) + for iter.Next() { + kv := iter.Attribute() + out = append(out, fmt.Sprintf("%s:%#v", kv.Key, kv.Value.AsInterface())) + } + return strings.Join(out, ",") +} + +type testFilterAgg[N int64 | float64] struct { + values map[attribute.Set]precomputedValue[N] + aggregationN int +} + +func newTestFilterAgg[N int64 | float64]() *testFilterAgg[N] { + return &testFilterAgg[N]{ + values: make(map[attribute.Set]precomputedValue[N]), + } +} + +func (a *testFilterAgg[N]) Aggregate(val N, attr attribute.Set) { + v := a.values[attr] + v.measured = val + a.values[attr] = v +} + +// nolint: unused // Used to agg filtered. +func (a *testFilterAgg[N]) aggregateFiltered(val N, attr attribute.Set) { + v := a.values[attr] + v.filtered += val + a.values[attr] = v +} + +func (a *testFilterAgg[N]) Aggregation() metricdata.Aggregation { + a.aggregationN++ + return nil +} diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/sum.go index ecf22f44b6d..7783dc66490 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/sum.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -// valueMap is the storage for all sums. +// valueMap is the storage for sums. type valueMap[N int64 | float64] struct { sync.Mutex values map[attribute.Set]N @@ -32,12 +32,6 @@ func newValueMap[N int64 | float64]() *valueMap[N] { return &valueMap[N]{values: make(map[attribute.Set]N)} } -func (s *valueMap[N]) set(value N, attr attribute.Set) { // nolint: unused // This is indeed used. - s.Lock() - s.values[attr] = value - s.Unlock() -} - func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { s.Lock() s.values[attr] += value @@ -164,48 +158,107 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { return out } +// precomputedValue is the recorded measurement value for a set of attributes. +type precomputedValue[N int64 | float64] struct { + // measured is the last value measured for a set of attributes that were + // not filtered. + measured N + // filtered is the sum of values from measurements that had their + // attributes filtered. + filtered N +} + +// precomputedMap is the storage for precomputed sums. +type precomputedMap[N int64 | float64] struct { + sync.Mutex + values map[attribute.Set]precomputedValue[N] +} + +func newPrecomputedMap[N int64 | float64]() *precomputedMap[N] { + return &precomputedMap[N]{ + values: make(map[attribute.Set]precomputedValue[N]), + } +} + +// Aggregate records value with the unfiltered attributes attr. +// +// If a previous measurement was made for the same attribute set: +// +// - If that measurement's attributes were not filtered, this value overwrite +// that value. +// - If that measurement's attributes were filtered, this value will be +// recorded along side that value. +func (s *precomputedMap[N]) Aggregate(value N, attr attribute.Set) { + s.Lock() + v := s.values[attr] + v.measured = value + s.values[attr] = v + s.Unlock() +} + +// aggregateFiltered records value with the filtered attributes attr. +// +// If a previous measurement was made for the same attribute set: +// +// - If that measurement's attributes were not filtered, this value will be +// recorded along side that value. +// - If that measurement's attributes were filtered, this value will be +// added to it. +// +// This method should not be used if attr have not been reduced by an attribute +// filter. +func (s *precomputedMap[N]) aggregateFiltered(value N, attr attribute.Set) { // nolint: unused // Used to agg filtered. + s.Lock() + v := s.values[attr] + v.filtered += value + s.values[attr] = v + s.Unlock() +} + // NewPrecomputedDeltaSum returns an Aggregator that summarizes a set of -// measurements as their pre-computed arithmetic sum. Each sum is scoped by -// attributes and the aggregation cycle the measurements were made in. +// pre-computed sums. Each sum is scoped by attributes and the aggregation +// cycle the measurements were made in. // // The monotonic value is used to communicate the produced Aggregation is // monotonic or not. The returned Aggregator does not make any guarantees this // value is accurate. It is up to the caller to ensure it. // -// The output Aggregation will report recorded values as delta temporality. It -// is up to the caller to ensure this is accurate. +// The output Aggregation will report recorded values as delta temporality. func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { return &precomputedDeltaSum[N]{ - recorded: make(map[attribute.Set]N), - reported: make(map[attribute.Set]N), - monotonic: monotonic, - start: now(), + precomputedMap: newPrecomputedMap[N](), + reported: make(map[attribute.Set]N), + monotonic: monotonic, + start: now(), } } -// precomputedDeltaSum summarizes a set of measurements recorded over all -// aggregation cycles as the delta arithmetic sum. +// precomputedDeltaSum summarizes a set of pre-computed sums recorded over all +// aggregation cycles as the delta of these sums. type precomputedDeltaSum[N int64 | float64] struct { - sync.Mutex - recorded map[attribute.Set]N + *precomputedMap[N] + reported map[attribute.Set]N monotonic bool start time.Time } -// Aggregate records value as a cumulative sum for attr. -func (s *precomputedDeltaSum[N]) Aggregate(value N, attr attribute.Set) { - s.Lock() - s.recorded[attr] = value - s.Unlock() -} - +// Aggregation returns the recorded pre-computed sums as an Aggregation. The +// sum values are expressed as the delta between what was measured this +// collection cycle and the previous. +// +// All pre-computed sums that were recorded for attributes sets reduced by an +// attribute filter (filtered-sums) are summed together and added to any +// pre-computed sum value recorded directly for the resulting attribute set +// (unfiltered-sum). The filtered-sums are reset to zero for the next +// collection cycle, and the unfiltered-sum is kept for the next collection +// cycle. func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { s.Lock() defer s.Unlock() - if len(s.recorded) == 0 { + if len(s.values) == 0 { return nil } @@ -213,19 +266,22 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { out := metricdata.Sum[N]{ Temporality: metricdata.DeltaTemporality, IsMonotonic: s.monotonic, - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.recorded)), + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), } - for attr, recorded := range s.recorded { - value := recorded - s.reported[attr] + for attr, value := range s.values { + v := value.measured + value.filtered + delta := v - s.reported[attr] out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ Attributes: attr, StartTime: s.start, Time: t, - Value: value, + Value: delta, }) - if value != 0 { - s.reported[attr] = recorded + if delta != 0 { + s.reported[attr] = v } + value.filtered = N(0) + s.values[attr] = value // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute // sets that become "stale" need to be forgotten so this will not @@ -237,26 +293,68 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { } // NewPrecomputedCumulativeSum returns an Aggregator that summarizes a set of -// measurements as their pre-computed arithmetic sum. Each sum is scoped by -// attributes and the aggregation cycle the measurements were made in. +// pre-computed sums. Each sum is scoped by attributes and the aggregation +// cycle the measurements were made in. // // The monotonic value is used to communicate the produced Aggregation is // monotonic or not. The returned Aggregator does not make any guarantees this // value is accurate. It is up to the caller to ensure it. // // The output Aggregation will report recorded values as cumulative -// temporality. It is up to the caller to ensure this is accurate. +// temporality. func NewPrecomputedCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { - return &precomputedSum[N]{newCumulativeSum[N](monotonic)} + return &precomputedCumulativeSum[N]{ + precomputedMap: newPrecomputedMap[N](), + monotonic: monotonic, + start: now(), + } } -// precomputedSum summarizes a set of measurements recorded over all -// aggregation cycles directly as the cumulative arithmetic sum. -type precomputedSum[N int64 | float64] struct { - *cumulativeSum[N] +// precomputedCumulativeSum directly records and reports a set of pre-computed sums. +type precomputedCumulativeSum[N int64 | float64] struct { + *precomputedMap[N] + + monotonic bool + start time.Time } -// Aggregate records value as a cumulative sum for attr. -func (s *precomputedSum[N]) Aggregate(value N, attr attribute.Set) { - s.set(value, attr) +// Aggregation returns the recorded pre-computed sums as an Aggregation. The +// sum values are expressed directly as they are assumed to be recorded as the +// cumulative sum of a some measured phenomena. +// +// All pre-computed sums that were recorded for attributes sets reduced by an +// attribute filter (filtered-sums) are summed together and added to any +// pre-computed sum value recorded directly for the resulting attribute set +// (unfiltered-sum). The filtered-sums are reset to zero for the next +// collection cycle, and the unfiltered-sum is kept for the next collection +// cycle. +func (s *precomputedCumulativeSum[N]) Aggregation() metricdata.Aggregation { + s.Lock() + defer s.Unlock() + + if len(s.values) == 0 { + return nil + } + + t := now() + out := metricdata.Sum[N]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: s.monotonic, + DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), + } + for attr, value := range s.values { + out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ + Attributes: attr, + StartTime: s.start, + Time: t, + Value: value.measured + value.filtered, + }) + value.filtered = N(0) + s.values[attr] = value + // TODO (#3006): This will use an unbounded amount of memory if there + // are unbounded number of attribute sets being aggregated. Attribute + // sets that become "stale" need to be forgotten so this will not + // overload the system. + } + return out } diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index 359b73aa50a..cde79aaa92b 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -18,6 +18,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -163,6 +164,134 @@ func TestDeltaSumReset(t *testing.T) { t.Run("Float64", testDeltaSumReset[float64]) } +func TestPreComputedDeltaSum(t *testing.T) { + var mono bool + agg := NewPrecomputedDeltaSum[int64](mono) + require.Implements(t, (*precomputeAggregator[int64])(nil), agg) + + attrs := attribute.NewSet(attribute.String("key", "val")) + agg.Aggregate(1, attrs) + got := agg.Aggregation() + want := metricdata.Sum[int64]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, + } + opt := metricdatatest.IgnoreTimestamp() + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Delta values should zero. + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 0)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) + got = agg.Aggregation() + // measured(+): 1, previous(-): 1, filtered(+): 1 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Filtered values should not persist. + got = agg.Aggregation() + // measured(+): 1, previous(-): 2, filtered(+): 0 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -1)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + got = agg.Aggregation() + // measured(+): 1, previous(-): 1, filtered(+): 0 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 0)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Override set value. + agg.Aggregate(2, attrs) + agg.Aggregate(5, attrs) + // Filtered should add. + agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) + agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) + got = agg.Aggregation() + // measured(+): 5, previous(-): 1, filtered(+): 13 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 17)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Filtered values should not persist. + agg.Aggregate(5, attrs) + got = agg.Aggregation() + // measured(+): 5, previous(-): 18, filtered(+): 0 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -13)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Order should not affect measure. + // Filtered should add. + agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) + agg.Aggregate(7, attrs) + agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) + got = agg.Aggregation() + // measured(+): 7, previous(-): 5, filtered(+): 13 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 15)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + agg.Aggregate(7, attrs) + got = agg.Aggregation() + // measured(+): 7, previous(-): 20, filtered(+): 0 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -13)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) +} + +func TestPreComputedCumulativeSum(t *testing.T) { + var mono bool + agg := NewPrecomputedCumulativeSum[int64](mono) + require.Implements(t, (*precomputeAggregator[int64])(nil), agg) + + attrs := attribute.NewSet(attribute.String("key", "val")) + agg.Aggregate(1, attrs) + got := agg.Aggregation() + want := metricdata.Sum[int64]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, + } + opt := metricdatatest.IgnoreTimestamp() + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Cumulative values should persist. + got = agg.Aggregation() + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 2)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Filtered values should not persist. + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Override set value. + agg.Aggregate(5, attrs) + // Filtered should add. + agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) + agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 18)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Filtered values should not persist. + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 5)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + + // Order should not affect measure. + // Filtered should add. + agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) + agg.Aggregate(7, attrs) + agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 20)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) + got = agg.Aggregation() + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 7)} + metricdatatest.AssertAggregationsEqual(t, want, got, opt) +} + func TestEmptySumNilAggregation(t *testing.T) { assert.Nil(t, NewCumulativeSum[int64](true).Aggregation()) assert.Nil(t, NewCumulativeSum[int64](false).Aggregation()) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 15c86d63156..190528e3c51 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -896,6 +896,11 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { } func TestAttributeFilter(t *testing.T) { + t.Run("Delta", testAttributeFilter(metricdata.DeltaTemporality)) + t.Run("Cumulative", testAttributeFilter(metricdata.CumulativeTemporality)) +} + +func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { one := 1.0 two := 2.0 testcases := []struct { @@ -912,7 +917,8 @@ func TestAttributeFilter(t *testing.T) { } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar")) + o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -923,10 +929,10 @@ func TestAttributeFilter(t *testing.T) { DataPoints: []metricdata.DataPoint[float64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 2.0, // TODO (#3439): This should be 3.0. + Value: 4.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: true, }, }, @@ -940,7 +946,8 @@ func TestAttributeFilter(t *testing.T) { } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar")) + o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -951,10 +958,10 @@ func TestAttributeFilter(t *testing.T) { DataPoints: []metricdata.DataPoint[float64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 2.0, // TODO (#3439): This should be 3.0. + Value: 4.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: false, }, }, @@ -994,7 +1001,8 @@ func TestAttributeFilter(t *testing.T) { } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveInt64(ctr, 20, attribute.String("foo", "bar")) + o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -1005,10 +1013,10 @@ func TestAttributeFilter(t *testing.T) { DataPoints: []metricdata.DataPoint[int64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 20, // TODO (#3439): This should be 30. + Value: 40, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: true, }, }, @@ -1022,7 +1030,8 @@ func TestAttributeFilter(t *testing.T) { } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveInt64(ctr, 20, attribute.String("foo", "bar")) + o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 2)) return nil }, ctr) return err @@ -1033,10 +1042,10 @@ func TestAttributeFilter(t *testing.T) { DataPoints: []metricdata.DataPoint[int64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 20, // TODO (#3439): This should be 30. + Value: 40, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: false, }, }, @@ -1088,7 +1097,7 @@ func TestAttributeFilter(t *testing.T) { Value: 3.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: true, }, }, @@ -1114,7 +1123,7 @@ func TestAttributeFilter(t *testing.T) { Value: 3.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: false, }, }, @@ -1145,7 +1154,7 @@ func TestAttributeFilter(t *testing.T) { Sum: 3.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, }, }, }, @@ -1170,7 +1179,7 @@ func TestAttributeFilter(t *testing.T) { Value: 30, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: true, }, }, @@ -1196,7 +1205,7 @@ func TestAttributeFilter(t *testing.T) { Value: 30, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, IsMonotonic: false, }, }, @@ -1227,37 +1236,282 @@ func TestAttributeFilter(t *testing.T) { Sum: 3.0, }, }, - Temporality: metricdata.CumulativeTemporality, + Temporality: temporality, }, }, }, } - for _, tt := range testcases { - t.Run(tt.name, func(t *testing.T) { - rdr := NewManualReader() - mtr := NewMeterProvider( - WithReader(rdr), - WithView(NewView( - Instrument{Name: "*"}, - Stream{AttributeFilter: func(kv attribute.KeyValue) bool { - return kv.Key == attribute.Key("foo") - }}, - )), - ).Meter("TestAttributeFilter") - require.NoError(t, tt.register(t, mtr)) - - m, err := rdr.Collect(context.Background()) - assert.NoError(t, err) + return func(t *testing.T) { + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + rdr := NewManualReader(WithTemporalitySelector(func(InstrumentKind) metricdata.Temporality { + return temporality + })) + mtr := NewMeterProvider( + WithReader(rdr), + WithView(NewView( + Instrument{Name: "*"}, + Stream{AttributeFilter: func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key("foo") + }}, + )), + ).Meter("TestAttributeFilter") + require.NoError(t, tt.register(t, mtr)) + + m, err := rdr.Collect(context.Background()) + assert.NoError(t, err) - require.Len(t, m.ScopeMetrics, 1) - require.Len(t, m.ScopeMetrics[0].Metrics, 1) + require.Len(t, m.ScopeMetrics, 1) + require.Len(t, m.ScopeMetrics[0].Metrics, 1) - metricdatatest.AssertEqual(t, tt.wantMetric, m.ScopeMetrics[0].Metrics[0], metricdatatest.IgnoreTimestamp()) - }) + metricdatatest.AssertEqual(t, tt.wantMetric, m.ScopeMetrics[0].Metrics[0], metricdatatest.IgnoreTimestamp()) + }) + } } } +func TestAsynchronousExample(t *testing.T) { + // This example can be found: + // https://github.com/open-telemetry/opentelemetry-specification/blob/8b91585e6175dd52b51e1d60bea105041225e35d/specification/metrics/supplementary-guidelines.md#asynchronous-example + var ( + threadID1 = attribute.Int("tid", 1) + threadID2 = attribute.Int("tid", 2) + threadID3 = attribute.Int("tid", 3) + + processID1001 = attribute.String("pid", "1001") + + thread1 = attribute.NewSet(processID1001, threadID1) + thread2 = attribute.NewSet(processID1001, threadID2) + thread3 = attribute.NewSet(processID1001, threadID3) + + process1001 = attribute.NewSet(processID1001) + ) + + setup := func(t *testing.T, temp metricdata.Temporality) (map[attribute.Set]int64, func(*testing.T), *metricdata.ScopeMetrics, *int64, *int64, *int64) { + t.Helper() + + const ( + instName = "pageFaults" + filteredStream = "filteredPageFaults" + scopeName = "AsynchronousExample" + ) + + selector := func(InstrumentKind) metricdata.Temporality { return temp } + reader := NewManualReader(WithTemporalitySelector(selector)) + + noopFilter := func(kv attribute.KeyValue) bool { return true } + noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName, AttributeFilter: noopFilter}) + + filter := func(kv attribute.KeyValue) bool { return kv.Key != "tid" } + filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AttributeFilter: filter}) + + mp := NewMeterProvider(WithReader(reader), WithView(noFiltered, filtered)) + meter := mp.Meter(scopeName) + + observations := make(map[attribute.Set]int64) + _, err := meter.Int64ObservableCounter(instName, instrument.WithInt64Callback( + func(ctx context.Context, o instrument.Int64Observer) error { + for attrSet, val := range observations { + o.Observe(ctx, val, attrSet.ToSlice()...) + } + return nil + }, + )) + require.NoError(t, err) + + want := &metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: scopeName}, + Metrics: []metricdata.Metrics{ + { + Name: filteredStream, + Data: metricdata.Sum[int64]{ + Temporality: temp, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: process1001}, + }, + }, + }, + { + Name: instName, + Data: metricdata.Sum[int64]{ + Temporality: temp, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: thread1}, + {Attributes: thread2}, + }, + }, + }, + }, + } + wantFiltered := &want.Metrics[0].Data.(metricdata.Sum[int64]).DataPoints[0].Value + wantThread1 := &want.Metrics[1].Data.(metricdata.Sum[int64]).DataPoints[0].Value + wantThread2 := &want.Metrics[1].Data.(metricdata.Sum[int64]).DataPoints[1].Value + + collect := func(t *testing.T) { + t.Helper() + got, err := reader.Collect(context.Background()) + require.NoError(t, err) + require.Len(t, got.ScopeMetrics, 1) + metricdatatest.AssertEqual(t, *want, got.ScopeMetrics[0], metricdatatest.IgnoreTimestamp()) + } + + return observations, collect, want, wantFiltered, wantThread1, wantThread2 + } + + t.Run("Cumulative", func(t *testing.T) { + temporality := metricdata.CumulativeTemporality + observations, verify, want, wantFiltered, wantThread1, wantThread2 := setup(t, temporality) + + // During the time range (T0, T1]: + // pid = 1001, tid = 1, #PF = 50 + // pid = 1001, tid = 2, #PF = 30 + observations[thread1] = 50 + observations[thread2] = 30 + + *wantFiltered = 80 + *wantThread1 = 50 + *wantThread2 = 30 + + verify(t) + + // During the time range (T1, T2]: + // pid = 1001, tid = 1, #PF = 53 + // pid = 1001, tid = 2, #PF = 38 + observations[thread1] = 53 + observations[thread2] = 38 + + *wantFiltered = 91 + *wantThread1 = 53 + *wantThread2 = 38 + + verify(t) + + // During the time range (T2, T3] + // pid = 1001, tid = 1, #PF = 56 + // pid = 1001, tid = 2, #PF = 42 + observations[thread1] = 56 + observations[thread2] = 42 + + *wantFiltered = 98 + *wantThread1 = 56 + *wantThread2 = 42 + + verify(t) + + // During the time range (T3, T4]: + // pid = 1001, tid = 1, #PF = 60 + // pid = 1001, tid = 2, #PF = 47 + observations[thread1] = 60 + observations[thread2] = 47 + + *wantFiltered = 107 + *wantThread1 = 60 + *wantThread2 = 47 + + verify(t) + + // During the time range (T4, T5]: + // thread 1 died, thread 3 started + // pid = 1001, tid = 2, #PF = 53 + // pid = 1001, tid = 3, #PF = 5 + delete(observations, thread1) + observations[thread2] = 53 + observations[thread3] = 5 + + *wantFiltered = 58 + want.Metrics[1].Data = metricdata.Sum[int64]{ + Temporality: temporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + // Thread 1 remains at last measured value. + {Attributes: thread1, Value: 60}, + {Attributes: thread2, Value: 53}, + {Attributes: thread3, Value: 5}, + }, + } + + verify(t) + }) + + t.Run("Delta", func(t *testing.T) { + temporality := metricdata.DeltaTemporality + observations, verify, want, wantFiltered, wantThread1, wantThread2 := setup(t, temporality) + + // During the time range (T0, T1]: + // pid = 1001, tid = 1, #PF = 50 + // pid = 1001, tid = 2, #PF = 30 + observations[thread1] = 50 + observations[thread2] = 30 + + *wantFiltered = 80 + *wantThread1 = 50 + *wantThread2 = 30 + + verify(t) + + // During the time range (T1, T2]: + // pid = 1001, tid = 1, #PF = 53 + // pid = 1001, tid = 2, #PF = 38 + observations[thread1] = 53 + observations[thread2] = 38 + + *wantFiltered = 11 + *wantThread1 = 3 + *wantThread2 = 8 + + verify(t) + + // During the time range (T2, T3] + // pid = 1001, tid = 1, #PF = 56 + // pid = 1001, tid = 2, #PF = 42 + observations[thread1] = 56 + observations[thread2] = 42 + + *wantFiltered = 7 + *wantThread1 = 3 + *wantThread2 = 4 + + verify(t) + + // During the time range (T3, T4]: + // pid = 1001, tid = 1, #PF = 60 + // pid = 1001, tid = 2, #PF = 47 + observations[thread1] = 60 + observations[thread2] = 47 + + *wantFiltered = 9 + *wantThread1 = 4 + *wantThread2 = 5 + + verify(t) + + // During the time range (T4, T5]: + // thread 1 died, thread 3 started + // pid = 1001, tid = 2, #PF = 53 + // pid = 1001, tid = 3, #PF = 5 + delete(observations, thread1) + observations[thread2] = 53 + observations[thread3] = 5 + + *wantFiltered = -49 + want.Metrics[1].Data = metricdata.Sum[int64]{ + Temporality: temporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{ + // Thread 1 remains at last measured value. + {Attributes: thread1, Value: 0}, + {Attributes: thread2, Value: 6}, + {Attributes: thread3, Value: 5}, + }, + } + + verify(t) + }) +} + var ( aiCounter instrument.Int64ObservableCounter aiUpDownCounter instrument.Int64ObservableUpDownCounter From 697bc18d298832384762ac0d8827c6237cf10ee1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 12:44:16 -0500 Subject: [PATCH 376/886] dependabot updates Mon Jan 23 17:28:58 UTC 2023 (#3613) Bump go.opentelemetry.io/build-tools/semconvgen from 0.4.0 to 0.5.0 in /internal/tools Bump go.opentelemetry.io/build-tools/dbotconf from 0.4.0 to 0.5.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.4.0 to 0.5.0 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.4.0 to 0.5.0 in /internal/tools Co-authored-by: MrAlias --- internal/tools/go.mod | 10 +++++----- internal/tools/go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 04addb98c14..2b7a77d2226 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,10 +9,10 @@ require ( github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.4.0 - go.opentelemetry.io/build-tools/dbotconf v0.4.0 - go.opentelemetry.io/build-tools/multimod v0.4.0 - go.opentelemetry.io/build-tools/semconvgen v0.4.0 + go.opentelemetry.io/build-tools/crosslink v0.5.0 + go.opentelemetry.io/build-tools/dbotconf v0.5.0 + go.opentelemetry.io/build-tools/multimod v0.5.0 + go.opentelemetry.io/build-tools/semconvgen v0.5.0 golang.org/x/tools v0.5.0 ) @@ -183,7 +183,7 @@ require ( github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.4.0 // indirect + go.opentelemetry.io/build-tools v0.5.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 32342aa1bc5..6f04d78c8ac 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -623,16 +623,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.4.0 h1:gcu5ArCA4Dkq1FBXcs/AB9Smmyx0aLni0GpavgCv+oQ= -go.opentelemetry.io/build-tools v0.4.0/go.mod h1:csnTV1XNFB7X17EoL0f4gOn/GA6oWI2UK282xLbPcY0= -go.opentelemetry.io/build-tools/crosslink v0.4.0 h1:gnDpIw+y9aTZYEGW4CBcQa6RM6e+Is/rEI8w2YQxAL8= -go.opentelemetry.io/build-tools/crosslink v0.4.0/go.mod h1:9/MPh5zL5QzIjreSEUmrlKB0ykzudT1Tv+6rU76EdOA= -go.opentelemetry.io/build-tools/dbotconf v0.4.0 h1:fiR3KibrrWrzIjo2SJjurpWhR+aj9ili+D9wCsgd134= -go.opentelemetry.io/build-tools/dbotconf v0.4.0/go.mod h1:R1fQ/YXApXzdjS8ZajQa56tbe9mpK/MT2oI3G1uaH+Y= -go.opentelemetry.io/build-tools/multimod v0.4.0 h1:V/sH7r0xBGq0WOxZYYzk7rxF1W0TqQUw3jNbaG2Q9Q8= -go.opentelemetry.io/build-tools/multimod v0.4.0/go.mod h1:S+IF5FLZlhJ1YkrOCPucH4z8ig1hVzDtKtTOATXRQK4= -go.opentelemetry.io/build-tools/semconvgen v0.4.0 h1:/K3NLBIPrX8Y3ryZh85WAtGeF2e2kdTa1qNRxmNG1sM= -go.opentelemetry.io/build-tools/semconvgen v0.4.0/go.mod h1:DKeHF2PWG8YZq77zJq3WT0/gNEFVT5zX9nzwVXxvE8o= +go.opentelemetry.io/build-tools v0.5.0 h1:JIySjVDB/lx/dn6HmPYu7XuGeah7dnaHiKQ0b010Z9w= +go.opentelemetry.io/build-tools v0.5.0/go.mod h1:csnTV1XNFB7X17EoL0f4gOn/GA6oWI2UK282xLbPcY0= +go.opentelemetry.io/build-tools/crosslink v0.5.0 h1:pPYmVcPPIVOImAD/B+L7DJxvgsMl9yGKUOoJAhDKuMQ= +go.opentelemetry.io/build-tools/crosslink v0.5.0/go.mod h1:yFw4oK1CJGd33aHtgN16S6hwa2Ea2q85p7ccNCFASE0= +go.opentelemetry.io/build-tools/dbotconf v0.5.0 h1:/NjV1d/oAh66OKgPWUbNk+g7wL+0MSvd2FYym7enUu0= +go.opentelemetry.io/build-tools/dbotconf v0.5.0/go.mod h1:WoDdnP9n5VbQQhfVvIcy2gs+/W+iyIHnF3hAfugW+ag= +go.opentelemetry.io/build-tools/multimod v0.5.0 h1:rfz1eu2KQ5LxKb1wIb7qxz9u6vQhvKNwbFhqKIWO+gM= +go.opentelemetry.io/build-tools/multimod v0.5.0/go.mod h1:woROlB0sd4i00VYKKDgoa7ro+y2VBwGjk5x2WfgNXqE= +go.opentelemetry.io/build-tools/semconvgen v0.5.0 h1:B2Vt6V+7QS+W1+CoRZeIpaJOp16lIo3XcHDtSL4VFrs= +go.opentelemetry.io/build-tools/semconvgen v0.5.0/go.mod h1:uyEWOiUYoZ42JTzG2JInYtdJVKb51Xp0f3vO6zRPQsk= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= From 828892954b406e19cc34d765a61c23533fc35d2e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 24 Jan 2023 07:56:11 -0800 Subject: [PATCH 377/886] Update the RegisterCallback of the SDK meter (#3604) --- sdk/metric/meter.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 7a4d6f9d377..e6732ff5ff3 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -205,8 +205,16 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 return inst, nil } -// RegisterCallback registers the function f to be called when any of the -// insts Collect method is called. +// RegisterCallback registers f to be called each collection cycle so it will +// make observations for insts during those cycles. +// +// The only instruments f can make observations for are insts. All other +// observations will be dropped and an error will be logged. +// +// Only instruments from this meter can be registered with f, an error is +// returned if other instrument are provided. +// +// The returned Registration can be used to unregister f. func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { if len(insts) == 0 { // Don't allocate a observer if not needed. From c7e26795299ff79f13b162eec7800bed592931e1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 24 Jan 2023 08:10:41 -0800 Subject: [PATCH 378/886] Generate the semconv/v1.17.0 package (#3599) * Generate semconv/v1.17.0 * Update all semconv use to v1.17 * Add changes to changelog --- CHANGELOG.md | 2 + bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- .../otlp/otlpmetric/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- sdk/metric/example_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- semconv/v1.17.0/doc.go | 20 + semconv/v1.17.0/exception.go | 20 + semconv/v1.17.0/http.go | 21 + semconv/v1.17.0/httpconv/http.go | 135 ++ semconv/v1.17.0/netconv/net.go | 66 + semconv/v1.17.0/resource.go | 1118 ++++++++++ semconv/v1.17.0/schema.go | 20 + semconv/v1.17.0/trace.go | 1892 +++++++++++++++++ website_docs/getting-started.md | 2 +- website_docs/manual.md | 2 +- 40 files changed, 3325 insertions(+), 31 deletions(-) create mode 100644 semconv/v1.17.0/doc.go create mode 100644 semconv/v1.17.0/exception.go create mode 100644 semconv/v1.17.0/http.go create mode 100644 semconv/v1.17.0/httpconv/http.go create mode 100644 semconv/v1.17.0/netconv/net.go create mode 100644 semconv/v1.17.0/resource.go create mode 100644 semconv/v1.17.0/schema.go create mode 100644 semconv/v1.17.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8566a8fbc..742c2aaf4a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` - `Int64Histogram` replaces the `syncint64.Histogram` - Add `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing` to create `WrapperTracer` instances from a `TracerProvider`. (#3316) +- Add the `go.opentelemetry.io/otel/semconv/v1.17.0` package. + The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) ### Changed diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 6f6e824434e..75683a899ad 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index c7a8fcb17da..18f38e000e7 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index edd0f9cc863..591d3a47047 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index bc812a37aaa..bdbaf65bab8 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 6d34832d4a8..63809b630a7 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index d7f118baf09..972e2541462 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 95f6b144b5a..066ea8ffe65 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 6c44bae5541..dbefcc8f354 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/metric/unit" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.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" diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 8e010a48f0a..60773a92eaf 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -26,7 +26,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.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" diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index f4cc4d179f2..c01fb1460fe 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 3fff8f7b2b1..0331d283839 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 8873920fb41..25205aed946 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) func TestPrometheusExporter(t *testing.T) { diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 48547580b02..4db2535d334 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -27,7 +27,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) var ( diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 3f118e63d72..a34331f35d5 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -23,7 +23,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index ffa07d7c165..2ee67770212 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 6f4e4553ed0..676c08a1cd8 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index d595a2b3a43..cbec5b8f32a 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -36,7 +36,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.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 6fb9208a324..4e95d3909d2 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) func Example() { diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 50bd626dd63..6296403e36a 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 419feb85545..34a474891a4 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 713e571dec4..6f7fd005b7a 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index f644651630b..deebe363a1d 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index cc1e3d6a78f..43b3a0e257b 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/os.go b/sdk/resource/os.go index f58fa074ebd..ac520dd8673 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 7729b994fd4..5ba33cc6894 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index f014ab039f4..7eaddd34bfd 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 1a57137a14a..630a5da9acc 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index dbf85a052d2..5abb0b274d4 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 5105c81fd9e..280546894fd 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.16.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) diff --git a/semconv/v1.17.0/doc.go b/semconv/v1.17.0/doc.go new file mode 100644 index 00000000000..71a1f7748d5 --- /dev/null +++ b/semconv/v1.17.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.17.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" diff --git a/semconv/v1.17.0/exception.go b/semconv/v1.17.0/exception.go new file mode 100644 index 00000000000..9b8c559de42 --- /dev/null +++ b/semconv/v1.17.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.17.0/http.go b/semconv/v1.17.0/http.go new file mode 100644 index 00000000000..d5c4b5c136a --- /dev/null +++ b/semconv/v1.17.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.17.0/httpconv/http.go b/semconv/v1.17.0/httpconv/http.go new file mode 100644 index 00000000000..7499accfb61 --- /dev/null +++ b/semconv/v1.17.0/httpconv/http.go @@ -0,0 +1,135 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.17.0/netconv/net.go b/semconv/v1.17.0/netconv/net.go new file mode 100644 index 00000000000..d411039584b --- /dev/null +++ b/semconv/v1.17.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.17.0/resource.go b/semconv/v1.17.0/resource.go new file mode 100644 index 00000000000..add7987a22b --- /dev/null +++ b/semconv/v1.17.0/resource.go @@ -0,0 +1,1118 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +const ( + // Array of brand name and version separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + // The platform on which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD + // be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in the + // [`os.type` and `os.name` attributes](./os.md). However, for consistency, the + // values in the `browser.platform` attribute should capture the exact value that + // the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + // A boolean that is true if the browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be + // left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + // Full user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 + // (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do not + // have a mechanism to retrieve brands and platform individually from the User- + // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` + // API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + // Preferred language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // Name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + // The cloud account ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + // The geographical region the resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for example + // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- + // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- + // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- + // us/global-infrastructure/geographies/), [Google Cloud + // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + // Cloud regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + // The cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGoogleCloudOpenshift = CloudPlatformKey.String("google_cloud_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. + // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo + // perguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l + // aunch_types.html) for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates + // t/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us- + // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + // The task definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + // The revision for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // The ARN of an EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// Resources specific to Amazon Web Services. +const ( + // The name(s) of the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like multi-container + // applications, where a single application has sidecar containers, and each write + // to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + // The name(s) of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + // The ARN(s) of the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- + // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- + // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain + // several log streams, so these ARNs necessarily identify both a log group and a + // log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// A container instance. +const ( + // Container name used by container runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + // Container ID. Usually a UUID, as for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container- + // identification). The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + // The container runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + // Name of the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + // Container image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// The software deployment. +const ( + // Name of the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// The device on which the process represented by this resource is running. +const ( + // A unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values outlined + // below. This value is not an advertising identifier and MUST NOT be used as + // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id + // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden + // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the + // Firebase Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on best + // practices and exact implementation details. Caution should be taken when + // storing personal data or anything which can identify a user. GDPR and data + // protection laws may apply, ensure you do your own due diligence. + DeviceIDKey = attribute.Key("device.id") + // The model identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version of the + // model identifier rather than the market or consumer-friendly name of the + // device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + // The marketing name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of the + // device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + // The name of the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// A serverless instance. +const ( + // The name of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- + // general.md#source-code-attributes) + // span attributes). + + // For some cloud providers, the above definition is ambiguous. The following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud providers/products: + + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + // The unique ID of the single function that this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the full ID + // at startup, + // so consider setting `faas.id` as a span attribute instead. + + // The exact value to use for `faas.id` depends on the cloud provider: + + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- + // namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // aliases.html) + // with the resolved function version, as the same runtime instance may be + // invokable with + // multiple different aliases. + // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- + // resource-names) + // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- + // us/rest/api/resources/resources/get-by-id) of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.We + // b/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function app can + // host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + // The immutable version of the function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- + // versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env- + // var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + // The execution environment ID as a string, that will be potentially reused for + // other invocations to the same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + // The amount of memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little memory can + // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, + // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this + // information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// A host is defined as a general computing instance. +const ( + // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud + // provider. For non-containerized Linux systems, the `machine-id` located in + // `/etc/machine-id` or `/var/lib/dbus/machine-id` may be used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + // Name of the host. On Unix systems, it may contain what the hostname command + // returns, or the fully qualified hostname, or another name specified by the + // user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + // Type of host. For Cloud, this must be the machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + // The CPU architecture the host system is running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + // Name of the VM image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + // VM image ID. For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + // The version string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// A Kubernetes Cluster. +const ( + // The name of the cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// A Kubernetes Node object. +const ( + // The name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + // The UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// A Kubernetes Namespace. +const ( + // The name of the namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// A Kubernetes Pod object. +const ( + // The UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + // The name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // The name of the Container from Pod specification, must be unique within a Pod. + // Container runtime usually uses different globally unique name + // (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + // Number of times the container was restarted. This attribute can be used to + // identify a particular container (running or stopped) within a container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// A Kubernetes ReplicaSet object. +const ( + // The UID of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + // The name of the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// A Kubernetes Deployment object. +const ( + // The UID of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + // The name of the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// A Kubernetes StatefulSet object. +const ( + // The UID of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + // The name of the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// A Kubernetes DaemonSet object. +const ( + // The UID of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + // The name of the DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// A Kubernetes Job object. +const ( + // The UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + // The name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// A Kubernetes CronJob object. +const ( + // The UID of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + // The name of the CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// The operating system (OS) on which the process represented by this resource is running. +const ( + // The operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + // Human readable (not intended to be parsed) OS version information, like e.g. + // reported by `ver` or `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + OSDescriptionKey = attribute.Key("os.description") + // Human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + // The version string of the operating system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// An operating system process. +const ( + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + // Parent Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + // The name of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + // The full path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + // The command used to launch the process (i.e. the command name). On Linux based + // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, + // can be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + // The full command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not + // set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + // All the command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited strings + // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be + // the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + // The username of the user that owns the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// The single (language) runtime instance which is monitored. +const ( + // The name of the runtime of this process. For compiled native binaries, this + // SHOULD be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + // The version of the runtime of this process, as returned by the runtime without + // modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + // An additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// A service instance. +const ( + // Logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled services. If + // the value was not specified, SDKs MUST fallback to `unknown_service:` + // concatenated with [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, the + // value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + // A namespace for `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group of + // services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` is + // expected to be unique for all services that have no explicit namespace defined + // (so the empty/unspecified namespace is simply one more valid namespace). Zero- + // length namespace string is assumed equal to unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + // The string ID of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be globally + // unique). The ID helps to distinguish instances of the same service that exist + // at the same time (e.g. instances of a horizontally scaled service). It is + // preferable for the ID to be persistent and stay the same for the lifetime of + // the service instance, however it is acceptable that the ID is ephemeral and + // changes during important lifetime events for the service (e.g. service + // restarts). If the service has no inherent unique ID that can be used as the + // value of this attribute it is recommended to generate a random Version 1 or + // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + // The version string of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// The telemetry SDK used to capture data recorded by the instrumentation libraries. +const ( + // The name of the telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + // The language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + // The version string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + // The version string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +const ( + // The name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + // The version of the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + // Additional description of the web engine (e.g. detailed version and edition + // information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelScopeNameKey = attribute.Key("otel.scope.name") + // The version of the instrumentation scope - (`InstrumentationScope.Version` in + // OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OtelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +const ( + // Deprecated, use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OtelLibraryNameKey = attribute.Key("otel.library.name") + // Deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OtelLibraryVersionKey = attribute.Key("otel.library.version") +) diff --git a/semconv/v1.17.0/schema.go b/semconv/v1.17.0/schema.go new file mode 100644 index 00000000000..42fc525d165 --- /dev/null +++ b/semconv/v1.17.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.17.0" diff --git a/semconv/v1.17.0/trace.go b/semconv/v1.17.0/trace.go new file mode 100644 index 00000000000..01e5f072a21 --- /dev/null +++ b/semconv/v1.17.0/trace.go @@ -0,0 +1,1892 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// This document defines the shared attributes used to report a single exception associated with a span or log. +const ( + // The type of the exception (its fully-qualified class name, if applicable). The + // dynamic type of the exception should be preferred over the static type in + // languages that support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + // The exception message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + // A stacktrace as a string in the natural representation for the language + // runtime. The representation is to be determined and documented by each language + // SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// This document defines attributes for Events represented using Log Records. +const ( + // The name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + // The domain identifies the business context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +const ( + // The full invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +const ( + // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec + // .md#id) uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m + // d#source-1) identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- + // service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + // The [version of the CloudEvents specification](https://github.com/cloudevents/s + // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp + // ec.md#type) contains a value describing the type of event related to the + // originating occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. + // md#subject) of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// This document defines semantic conventions for the OpenTracing Shim +const ( + // Parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// This document defines the attributes used to perform database client calls. +const ( + // An identifier for the database management system (DBMS) product being used. See + // below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + // The connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + // Username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + // The fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver + // used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + // This attribute is used to report the name of the database being accessed. For + // commands that switch the database, this should be set to the target database + // (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called "schema + // name". In case there are multiple layers that could be considered for database + // name (e.g. Oracle instance name and schema name), the database name to be used + // is the more specific layer (e.g. Oracle schema name). + DBNameKey = attribute.Key("db.name") + // The database statement being executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not explicitly + // disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + // The name of the operation being executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to attempt any + // client-side parsing of `db.statement` just to get this property, but it should + // be set if the operation name is provided by the library being instrumented. If + // the SQL statement has an ambiguous operation, or performs more than one + // operation, this value may be omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") +) + +// Connection-level attributes for Microsoft SQL Server +const ( + // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- + // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// Call-level attributes for Cassandra +const ( + // The fetch size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + // The consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra- + // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + // The name of the primary table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra rather + // than sql. It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + // Whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + // The number of times a query was speculatively executed. Not set or `0` if the + // query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + // The ID of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + // The data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// Call-level attributes for Redis +const ( + // The index of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To be used + // instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default database + // (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// Call-level attributes for MongoDB +const ( + // The collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// Call-level attributes for SQL databases +const ( + // The name of the primary table that the operation is acting upon, including the + // database name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting upon an + // anonymous table, or more than one table, this value MUST NOT be set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's concepts. +const ( + // Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OtelStatusCodeKey = attribute.Key("otel.status_code") + // Description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OtelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OtelStatusCodeOk = OtelStatusCodeKey.String("OK") + // The operation contains an error + OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") +) + +// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +const ( + // Type of the trigger which caused this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + // The execution ID of the current function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +const ( + // The name of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos + // DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + // Describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + // A string containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + // The document name/table subjected to the operation. For example, in Cloud + // Storage or S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // A string containing the function invocation time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed + // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + // A string containing the schedule period as [Cron Expression](https://docs.oracl + // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// Contains additional attributes for incoming FaaS spans. +const ( + // A boolean that is true if the serverless function is executed for the first + // time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// Contains additional attributes for outgoing FaaS spans. +const ( + // The name of the invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked + // function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + // The cloud provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked + // function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + // The cloud region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or + // GCP, the region in which a function is hosted is essential to uniquely identify + // the function and also part of its endpoint. Since it's part of the endpoint + // being called, the region is always known to clients. In these cases, + // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the + // client or not required for identifying the invoked function, setting + // `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked + // function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// These attributes may be used for any network related operation. +const ( + // Transport protocol used. See note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + // Application layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + // Version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol used and + // might be different from the protocol client's version. If the HTTP client used + // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should + // be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + // Remote socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from `net.peer.name` + // and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, [etc](https://man7.org/linux/man- + // pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + // Remote socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + // Protocol [address family](https://man7.org/linux/man- + // pages/man7/address_families.7.html) which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of + // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry + // SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + // Logical remote hostname, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra + // DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + // Logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + // Logical local hostname or similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + // Logical local port number, preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + // Local socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + // Local socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + // The internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + // This describes more details regarding the connection.type. It may be the type + // of cell technology connection, but it could be used for describing details + // about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + // The name of the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + // The mobile carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + // The mobile carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// Operations that access some remote service. +const ( + // The [`service.name`](../../resource/semantic_conventions/README.md#service) of + // the remote service. SHOULD be equal to the actual `service.name` resource + // attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// These attributes may be used for any operation with an authenticated and/or authorized enduser. +const ( + // Username or client_id extracted from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the + // inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + // Actual/assumed role the client is making the request under extracted from token + // or application security context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + // Scopes or granted authorities the client currently possesses extracted from + // token or application security context. The value would come from the scope + // associated with an [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value + // in a [SAML 2.0 Assertion](http://docs.oasis- + // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// These attributes may be used for any operation to store information about a thread that started a span. +const ( + // Current "managed" thread ID (as opposed to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + // Current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// These attributes allow to report this unit of code and therefore to provide more context about the span. +const ( + // The method or function name, or equivalent (usually rightmost part of the code + // unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + // The "namespace" within which `code.function` is defined. Usually the qualified + // class or module name, such that `code.namespace` + some separator + + // `code.function` form a unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + // The source code file name that identifies the code unit as uniquely as possible + // (preferably an absolute file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + // The line number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + // The column number in `code.filepath` best representing the operation. It SHOULD + // point within the code unit named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// This document defines semantic conventions for HTTP client and server Spans. +const ( + // HTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + // Kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` + // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + // Value of the [HTTP User-Agent](https://www.rfc- + // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + // The size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + // The size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- + // length) header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// Semantic Convention for HTTP Client +const ( + // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. + // Usually the fragment is not transmitted over HTTP, but if it is known, it + // should be included nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the attribute's + // value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + // The ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets resent + // by the client, regardless of what was the cause of the resending (e.g. + // redirection, authorization failure, 503 Server Unavailable, network issues, or + // any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// Semantic Convention for HTTP Server +const ( + // The URI scheme identifying the used protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + // The full request target as passed in a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + // The matched route (path template in the format used by the respective server + // framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and the URI + // path can NOT substitute it. + HTTPRouteKey = attribute.Key("http.route") + // The IP address of the original client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en- + // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // identify the network-level peer, which may be a proxy. + + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// Attributes that exist for multiple DynamoDB request types. +const ( + // The keys in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + // The JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { + // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, + // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, + // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": + // "string", "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + // The JSON-serialized value of the `ItemCollectionMetrics` response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, + // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : + // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": + // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + // The value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + // The value of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, + // ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + // The value of the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + // The value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + // The value of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + // The value of the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// DynamoDB.CreateTable +const ( + // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request + // field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": + // number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": + // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", + // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], + // "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// DynamoDB.ListTables +const ( + // The value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + // The the number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// DynamoDB.Query +const ( + // The value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// DynamoDB.Scan +const ( + // The value of the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + // The value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + // The value of the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + // The value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// DynamoDB.UpdateTable +const ( + // The JSON-serialized value of each item in the `AttributeDefinitions` request + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": + // number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +const ( + // The name of the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + // The type of the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + // The GraphQL document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// Semantic convention describing per-message attributes populated on messaging spans or links. +const ( + // A value used by the messaging system as an identifier for the message, + // represented as a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + // The [conversation ID](#conversations) identifying the conversation to which the + // message belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + // The (uncompressed) size of the message payload in bytes. Also use this + // attribute if it is unknown whether the compressed or uncompressed payload size + // is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + // The compressed size of the message payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// Semantic convention for attributes that describe messaging destination on broker +const ( + // The message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic or + // other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD uniquely + // identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + // The kind of message destination + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") + // Low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example would + // be a destination name involving a user name or product id. Although the + // destination name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + // A boolean that is true if the message destination is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + // A boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// Semantic convention for attributes that describe messaging source on broker +const ( + // The message source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or other + // entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely identify + // the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + // The kind of message source + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingSourceKindKey = attribute.Key("messaging.source.kind") + // Low cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would be a + // source name involving a user name or product id. Although the source name in + // this case is of high cardinality, the underlying template is of low cardinality + // and can be effectively used for grouping and aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + // A boolean that is true if the message source is temporary and might not exist + // anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + // A boolean that is true if the message source is anonymous (could be unnamed or + // have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +var ( + // A message received from a queue + MessagingSourceKindQueue = MessagingSourceKindKey.String("queue") + // A message received from a topic + MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") +) + +// This document defines general attributes used in messaging systems. +const ( + // A string identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + // A string identifying the kind of messaging operation as defined in the + // [Operation names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + // The number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an operation on + // a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on spans + // that operate with a single message. When a messaging client library supports + // both batch and single-message API for the same operation, instrumentations + // SHOULD use `messaging.batch.message_count` for batching APIs and SHOULD NOT use + // it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// Semantic convention for a consumer of messages received from a messaging system +const ( + // The identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are + // present, or only `messaging.kafka.consumer.group`. For brokers, such as + // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// Attributes for RabbitMQ +const ( + // RabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// Attributes for Apache Kafka +const ( + // Message keys in Kafka are used for grouping alike messages to ensure they're + // processed on the same partition. They differ from `messaging.message.id` in + // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to be + // supplied for the attribute. If the key has no unambiguous, canonical string + // form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + // Name of the Kafka Consumer Group that is handling the message. Only applies to + // consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + // Client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + // Partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + // Partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + // The offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + // A boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the + // value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// Attributes for Apache RocketMQ +const ( + // Namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + // Name of the RocketMQ producer/consumer group that is handling the message. The + // client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + // The unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + // The timestamp in milliseconds that the delay message is expected to be + // delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and delay + // time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + // The delay time level for delay message, which determines the message delay + // time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay and + // delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + // It is essential for FIFO message. Messages that belong to the same message + // group are always processed one by one within the same consumer group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + // Type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + // The secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + // Key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + // Model of message consumption. This only applies to consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// This document defines semantic conventions for remote procedure calls. +const ( + // A string identifying the remoting system. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + // The full (logical) name of the service being called, including its package + // name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing class. + // The `code.namespace` attribute may be used to store the latter (despite the + // attribute name, it may include a class name; e.g., class with method actually + // executing the call on the server side, RPC client stub class on the client + // side). + RPCServiceKey = attribute.Key("rpc.service") + // The name of the (logical) method being called, must be equal to the $method + // part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the latter + // (e.g., method actually executing the call on the server side, RPC client stub + // method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// Tech-specific attributes for gRPC. +const ( + // The [numeric status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC + // request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC + // 1.0 does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default version + // (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + // `id` property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be cast to + // string for simplicity. Use empty string in case of `null` value. Omit entirely + // if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 79307c7224a..a084dcb4690 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -287,7 +287,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) ``` diff --git a/website_docs/manual.md b/website_docs/manual.md index 6a2dcca3f22..4fd2190da62 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -35,7 +35,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.12.0" + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" ) From c0fb8dec4cf2183f852ebd7e663053614e044bf4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 25 Jan 2023 12:58:09 -0800 Subject: [PATCH 379/886] Remove the unneeded Observe method from the async instruments (#3586) * Update RegisterCallback and Callback decls RegisterCallback accept variadic Asynchronous instruments instead of a slice. Callback accept an observation result recorder to ensure instruments that are observed by a callback. * Update global impl * Update noop impl * Update SDK impl * Fix prometheus example * Fix metric API example_test * Remove unused registerabler * Rename ObservationRecorder to MultiObserver * Update Callback documentation about MultiObserver * Remove the Observe method from async inst * Revert to iface for Observers * Fix async inst docs * Update global async delegate race test * Restore removed observe doc * Remove TODO * Remove stale comment * Update changelog --- CHANGELOG.md | 2 +- metric/example_test.go | 4 +- metric/instrument/asyncfloat64.go | 48 +++++++++------- metric/instrument/asyncfloat64_test.go | 6 +- metric/instrument/asyncint64.go | 47 ++++++++------- metric/instrument/asyncint64_test.go | 6 +- metric/internal/global/instruments.go | 66 +++++----------------- metric/internal/global/instruments_test.go | 26 +++++---- metric/internal/global/meter_types_test.go | 14 +++-- metric/meter.go | 4 +- metric/noop.go | 11 +--- metric/noop_test.go | 42 -------------- sdk/metric/instrument.go | 50 +++++++++------- sdk/metric/meter.go | 60 +++++++++++--------- sdk/metric/meter_test.go | 51 ++++++----------- 15 files changed, 186 insertions(+), 251 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 742c2aaf4a6..822d55bd053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the `go.opentelemetry.io/otel/semconv/v1.16.0` package. The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) - Metric instruments were added to `go.opentelemetry.io/otel/metric/instrument`. - These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575) + These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` diff --git a/metric/example_test.go b/metric/example_test.go index 9b33c0f9b5f..579404c7593 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -55,7 +55,7 @@ func ExampleMeter_asynchronous_single() { _, err := meter.Int64ObservableGauge( "DiskUsage", instrument.WithUnit(unit.Bytes), - instrument.WithInt64Callback(func(ctx context.Context, inst instrument.Int64Observer) error { + instrument.WithInt64Callback(func(_ context.Context, obsrv instrument.Int64Observer) error { // Do the real work here to get the real disk usage. For example, // // usage, err := GetDiskUsage(diskID) @@ -69,7 +69,7 @@ func ExampleMeter_asynchronous_single() { // // For demonstration purpose, a static value is used here. usage := 75000 - inst.Observe(ctx, int64(usage), attribute.Int("disk.id", 3)) + obsrv.Observe(int64(usage), attribute.Int("disk.id", 3)) return nil }), ) diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index ad58dd0d9e7..2f624bfe005 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -21,45 +21,51 @@ import ( "go.opentelemetry.io/otel/metric/unit" ) -// Float64Observer is a recorder of float64 measurement values. +// Float64Observable describes a set of instruments used asynchronously to +// record float64 measurements once per collection cycle. Observations of +// these instruments are only made within a callback. +// // Warning: methods may be added to this interface in minor releases. -type Float64Observer interface { +type Float64Observable interface { Asynchronous - // Observe records the measurement value for a set of attributes. - // - // It is only valid to call this within a callback. If called outside of - // the registered callback it should have no effect on the instrument, and - // an error will be reported via the error handler. - Observe(ctx context.Context, value float64, attributes ...attribute.KeyValue) + float64Observable() } // Float64ObservableCounter is an instrument used to asynchronously record -// increasing float64 measurements once per a measurement collection cycle. The -// Observe method is used to record the measured state of the instrument when -// it is called. Implementations will assume the observed value to be the -// cumulative sum of the count. +// increasing float64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. // // Warning: methods may be added to this interface in minor releases. -type Float64ObservableCounter interface{ Float64Observer } +type Float64ObservableCounter interface{ Float64Observable } // Float64ObservableUpDownCounter is an instrument used to asynchronously -// record float64 measurements once per a measurement collection cycle. The -// Observe method is used to record the measured state of the instrument when -// it is called. Implementations will assume the observed value to be the -// cumulative sum of the count. +// record float64 measurements once per collection cycle. Observations are only +// made within a callback for this instrument. The value observed is assumed +// the to be the cumulative sum of the count. // // Warning: methods may be added to this interface in minor releases. -type Float64ObservableUpDownCounter interface{ Float64Observer } +type Float64ObservableUpDownCounter interface{ Float64Observable } // Float64ObservableGauge is an instrument used to asynchronously record -// instantaneous float64 measurements once per a measurement collection cycle. +// instantaneous float64 measurements once per collection cycle. Observations +// are only made within a callback for this instrument. // // Warning: methods may be added to this interface in minor releases. -type Float64ObservableGauge interface{ Float64Observer } +type Float64ObservableGauge interface{ Float64Observable } + +// Float64Observer is a recorder of float64 measurements. +// +// Warning: methods may be added to this interface in minor releases. +type Float64Observer interface { + Observe(value float64, attributes ...attribute.KeyValue) +} // Float64Callback is a function registered with a Meter that makes -// observations for a Float64Observer it is registered with. +// observations for a Float64Observerable instrument it is registered with. +// Calls to the Float64Observer record measurement values for the +// Float64Observable. // // The function needs to complete in a finite amount of time and the deadline // of the passed context is expected to be honored. diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index ab7d0fe5e13..7f315babaad 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -35,8 +35,8 @@ func TestFloat64ObserverOptions(t *testing.T) { got := NewFloat64ObserverConfig( WithDescription(desc), WithUnit(uBytes), - WithFloat64Callback(func(ctx context.Context, o Float64Observer) error { - o.Observe(ctx, token) + WithFloat64Callback(func(ctx context.Context, obsrv Float64Observer) error { + obsrv.Observe(token) return nil }), ) @@ -57,6 +57,6 @@ type float64Observer struct { got float64 } -func (o *float64Observer) Observe(_ context.Context, v float64, _ ...attribute.KeyValue) { +func (o *float64Observer) Observe(v float64, _ ...attribute.KeyValue) { o.got = v } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index debba92f0aa..ac0d09d90cd 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -21,46 +21,51 @@ import ( "go.opentelemetry.io/otel/metric/unit" ) -// Int64Observer is a recorder of int64 measurement values. +// Int64Observable describes a set of instruments used asynchronously to record +// int64 measurements once per collection cycle. Observations of these +// instruments are only made within a callback. // // Warning: methods may be added to this interface in minor releases. -type Int64Observer interface { +type Int64Observable interface { Asynchronous - // Observe records the measurement value for a set of attributes. - // - // It is only valid to call this within a callback. If called outside of - // the registered callback it should have no effect on the instrument, and - // an error will be reported via the error handler. - Observe(ctx context.Context, value int64, attributes ...attribute.KeyValue) + int64Observable() } // Int64ObservableCounter is an instrument used to asynchronously record -// increasing int64 measurements once per a measurement collection cycle. The -// Observe method is used to record the measured state of the instrument when -// it is called. Implementations will assume the observed value to be the -// cumulative sum of the count. +// increasing int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. The value observed is +// assumed the to be the cumulative sum of the count. // // Warning: methods may be added to this interface in minor releases. -type Int64ObservableCounter interface{ Int64Observer } +type Int64ObservableCounter interface{ Int64Observable } // Int64ObservableUpDownCounter is an instrument used to asynchronously record -// int64 measurements once per a measurement collection cycle. The Observe -// method is used to record the measured state of the instrument when it is -// called. Implementations will assume the observed value to be the cumulative -// sum of the count. +// int64 measurements once per collection cycle. Observations are only made +// within a callback for this instrument. The value observed is assumed the to +// be the cumulative sum of the count. // // Warning: methods may be added to this interface in minor releases. -type Int64ObservableUpDownCounter interface{ Int64Observer } +type Int64ObservableUpDownCounter interface{ Int64Observable } // Int64ObservableGauge is an instrument used to asynchronously record -// instantaneous int64 measurements once per a measurement collection cycle. +// instantaneous int64 measurements once per collection cycle. Observations are +// only made within a callback for this instrument. +// +// Warning: methods may be added to this interface in minor releases. +type Int64ObservableGauge interface{ Int64Observable } + +// Int64Observer is a recorder of int64 measurements. // // Warning: methods may be added to this interface in minor releases. -type Int64ObservableGauge interface{ Int64Observer } +type Int64Observer interface { + Observe(value int64, attributes ...attribute.KeyValue) +} // Int64Callback is a function registered with a Meter that makes -// observations for an Int64Observer it is registered with. +// observations for a Int64Observerable instrument it is registered with. +// Calls to the Int64Observer record measurement values for the +// Int64Observable. // // The function needs to complete in a finite amount of time and the deadline // of the passed context is expected to be honored. diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index a9ad527f1ea..bb4309e594a 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -35,8 +35,8 @@ func TestInt64ObserverOptions(t *testing.T) { got := NewInt64ObserverConfig( WithDescription(desc), WithUnit(uBytes), - WithInt64Callback(func(ctx context.Context, o Int64Observer) error { - o.Observe(ctx, token) + WithInt64Callback(func(_ context.Context, obsrv Int64Observer) error { + obsrv.Observe(token) return nil }), ) @@ -57,6 +57,6 @@ type int64Observer struct { got int64 } -func (o *int64Observer) Observe(_ context.Context, v int64, _ ...attribute.KeyValue) { +func (o *int64Observer) Observe(v int64, _ ...attribute.KeyValue) { o.got = v } diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 1398ada26be..d1480fa5f3e 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -30,12 +30,12 @@ type unwrapper interface { } type afCounter struct { + instrument.Float64Observable + name string opts []instrument.Float64ObserverOption delegate atomic.Value //instrument.Float64ObservableCounter - - instrument.Asynchronous } var _ unwrapper = (*afCounter)(nil) @@ -50,12 +50,6 @@ func (i *afCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64ObservableCounter).Observe(ctx, x, attrs...) - } -} - func (i *afCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableCounter) @@ -64,12 +58,12 @@ func (i *afCounter) Unwrap() instrument.Asynchronous { } type afUpDownCounter struct { + instrument.Float64Observable + name string opts []instrument.Float64ObserverOption delegate atomic.Value //instrument.Float64ObservableUpDownCounter - - instrument.Asynchronous } var _ unwrapper = (*afUpDownCounter)(nil) @@ -84,12 +78,6 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64ObservableUpDownCounter).Observe(ctx, x, attrs...) - } -} - func (i *afUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableUpDownCounter) @@ -98,14 +86,17 @@ func (i *afUpDownCounter) Unwrap() instrument.Asynchronous { } type afGauge struct { + instrument.Float64Observable + name string opts []instrument.Float64ObserverOption delegate atomic.Value //instrument.Float64ObservableGauge - - instrument.Asynchronous } +var _ unwrapper = (*afGauge)(nil) +var _ instrument.Float64ObservableGauge = (*afGauge)(nil) + func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { @@ -115,15 +106,6 @@ func (i *afGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -var _ unwrapper = (*afGauge)(nil) -var _ instrument.Float64ObservableGauge = (*afGauge)(nil) - -func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64ObservableGauge).Observe(ctx, x, attrs...) - } -} - func (i *afGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableGauge) @@ -132,12 +114,12 @@ func (i *afGauge) Unwrap() instrument.Asynchronous { } type aiCounter struct { + instrument.Int64Observable + name string opts []instrument.Int64ObserverOption delegate atomic.Value //instrument.Int64ObservableCounter - - instrument.Asynchronous } var _ unwrapper = (*aiCounter)(nil) @@ -152,12 +134,6 @@ func (i *aiCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64ObservableCounter).Observe(ctx, x, attrs...) - } -} - func (i *aiCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableCounter) @@ -166,12 +142,12 @@ func (i *aiCounter) Unwrap() instrument.Asynchronous { } type aiUpDownCounter struct { + instrument.Int64Observable + name string opts []instrument.Int64ObserverOption delegate atomic.Value //instrument.Int64ObservableUpDownCounter - - instrument.Asynchronous } var _ unwrapper = (*aiUpDownCounter)(nil) @@ -186,12 +162,6 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64ObservableUpDownCounter).Observe(ctx, x, attrs...) - } -} - func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableUpDownCounter) @@ -200,12 +170,12 @@ func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous { } type aiGauge struct { + instrument.Int64Observable + name string opts []instrument.Int64ObserverOption delegate atomic.Value //instrument.Int64ObservableGauge - - instrument.Asynchronous } var _ unwrapper = (*aiGauge)(nil) @@ -220,12 +190,6 @@ func (i *aiGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) { - if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64ObservableGauge).Observe(ctx, x, attrs...) - } -} - func (i *aiGauge) Unwrap() instrument.Asynchronous { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableGauge) diff --git a/metric/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go index 24c5eb4322e..18a731c8911 100644 --- a/metric/internal/global/instruments_test.go +++ b/metric/internal/global/instruments_test.go @@ -62,17 +62,20 @@ func TestAsyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Float64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &afCounter{} - testFloat64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testFloat64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &afUpDownCounter{} - testFloat64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testFloat64Race(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &afGauge{} - testFloat64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testFloat64Race(f, delegate.setDelegate) }) }) @@ -81,17 +84,20 @@ func TestAsyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Int64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &aiCounter{} - testInt64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testInt64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &aiUpDownCounter{} - testInt64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testInt64Race(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &aiGauge{} - testInt64Race(delegate.Observe, delegate.setDelegate) + f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + testInt64Race(f, delegate.setDelegate) }) }) } @@ -138,11 +144,11 @@ func TestSyncInstrumentSetDelegateRace(t *testing.T) { type testCountingFloatInstrument struct { count int - instrument.Asynchronous + instrument.Float64Observable instrument.Synchronous } -func (i *testCountingFloatInstrument) Observe(context.Context, float64, ...attribute.KeyValue) { +func (i *testCountingFloatInstrument) observe() { i.count++ } func (i *testCountingFloatInstrument) Add(context.Context, float64, ...attribute.KeyValue) { @@ -155,11 +161,11 @@ func (i *testCountingFloatInstrument) Record(context.Context, float64, ...attrib type testCountingIntInstrument struct { count int - instrument.Asynchronous + instrument.Int64Observable instrument.Synchronous } -func (i *testCountingIntInstrument) Observe(context.Context, int64, ...attribute.KeyValue) { +func (i *testCountingIntInstrument) observe() { i.count++ } func (i *testCountingIntInstrument) Add(context.Context, int64, ...attribute.KeyValue) { diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 84637b286f9..5f172bf8f9e 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -148,10 +148,16 @@ type observationRecorder struct { ctx context.Context } -func (o observationRecorder) ObserveFloat64(i instrument.Float64Observer, value float64, attr ...attribute.KeyValue) { - i.Observe(o.ctx, value, attr...) +func (o observationRecorder) ObserveFloat64(i instrument.Float64Observable, value float64, attr ...attribute.KeyValue) { + iImpl, ok := i.(*testCountingFloatInstrument) + if ok { + iImpl.observe() + } } -func (o observationRecorder) ObserveInt64(i instrument.Int64Observer, value int64, attr ...attribute.KeyValue) { - i.Observe(o.ctx, value, attr...) +func (o observationRecorder) ObserveInt64(i instrument.Int64Observable, value int64, attr ...attribute.KeyValue) { + iImpl, ok := i.(*testCountingIntInstrument) + if ok { + iImpl.observe() + } } diff --git a/metric/meter.go b/metric/meter.go index fc39f40b3d8..f1e917e9329 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -123,9 +123,9 @@ type Callback func(context.Context, Observer) error // Observer records measurements for multiple instruments in a Callback. type Observer interface { // ObserveFloat64 records the float64 value with attributes for obsrv. - ObserveFloat64(obsrv instrument.Float64Observer, value float64, attributes ...attribute.KeyValue) + ObserveFloat64(obsrv instrument.Float64Observable, value float64, attributes ...attribute.KeyValue) // ObserveInt64 records the int64 value with attributes for obsrv. - ObserveInt64(obsrv instrument.Int64Observer, value int64, attributes ...attribute.KeyValue) + ObserveInt64(obsrv instrument.Int64Observable, value int64, attributes ...attribute.KeyValue) } // Registration is an token representing the unique registration of a callback diff --git a/metric/noop.go b/metric/noop.go index 409268ecc98..c586627aef8 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -97,7 +97,7 @@ type noopReg struct{} func (noopReg) Unregister() error { return nil } type nonrecordingAsyncFloat64Instrument struct { - instrument.Asynchronous + instrument.Float64Observable } var ( @@ -118,12 +118,8 @@ func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64O return n, nil } -func (nonrecordingAsyncFloat64Instrument) Observe(context.Context, float64, ...attribute.KeyValue) { - -} - type nonrecordingAsyncInt64Instrument struct { - instrument.Asynchronous + instrument.Int64Observable } var ( @@ -144,9 +140,6 @@ func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64Obser return n, nil } -func (nonrecordingAsyncInt64Instrument) Observe(context.Context, int64, ...attribute.KeyValue) { -} - type nonrecordingSyncFloat64Instrument struct { instrument.Synchronous } diff --git a/metric/noop_test.go b/metric/noop_test.go index 6c75c0198d1..59695ccd5bc 100644 --- a/metric/noop_test.go +++ b/metric/noop_test.go @@ -72,45 +72,3 @@ func TestSyncInt64(t *testing.T) { inst.Record(context.Background(), 1, attribute.String("key", "value")) }) } - -func TestAsyncFloat64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Float64ObservableCounter("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64ObservableUpDownCounter("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), -1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64ObservableGauge("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), 1.0, attribute.String("key", "value")) - }) -} - -func TestAsyncInt64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Int64ObservableCounter("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), 1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64ObservableUpDownCounter("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), -1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64ObservableGauge("test instrument") - require.NoError(t, err) - inst.Observe(context.Background(), 1, attribute.String("key", "value")) - }) -} diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 2b3c2356d3a..8e0a4b5553c 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -20,7 +20,6 @@ import ( "fmt" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" @@ -211,6 +210,36 @@ type observablID[N int64 | float64] struct { scope instrumentation.Scope } +type float64Observable struct { + instrument.Float64Observable + *observable[float64] +} + +var _ instrument.Float64ObservableCounter = float64Observable{} +var _ instrument.Float64ObservableUpDownCounter = float64Observable{} +var _ instrument.Float64ObservableGauge = float64Observable{} + +func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[float64]) float64Observable { + return float64Observable{ + observable: newObservable[float64](scope, kind, name, desc, u, agg), + } +} + +type int64Observable struct { + instrument.Int64Observable + *observable[int64] +} + +var _ instrument.Int64ObservableCounter = int64Observable{} +var _ instrument.Int64ObservableUpDownCounter = int64Observable{} +var _ instrument.Int64ObservableGauge = int64Observable{} + +func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[int64]) int64Observable { + return int64Observable{ + observable: newObservable[int64](scope, kind, name, desc, u, agg), + } +} + type observable[N int64 | float64] struct { instrument.Asynchronous observablID[N] @@ -231,25 +260,6 @@ func newObservable[N int64 | float64](scope instrumentation.Scope, kind Instrume } } -var _ instrument.Float64ObservableCounter = (*observable[float64])(nil) -var _ instrument.Float64ObservableUpDownCounter = (*observable[float64])(nil) -var _ instrument.Float64ObservableGauge = (*observable[float64])(nil) -var _ instrument.Int64ObservableCounter = (*observable[int64])(nil) -var _ instrument.Int64ObservableUpDownCounter = (*observable[int64])(nil) -var _ instrument.Int64ObservableGauge = (*observable[int64])(nil) - -// Observe logs an error. -func (o *observable[N]) Observe(ctx context.Context, val N, attrs ...attribute.KeyValue) { - var zero N - err := errors.New("invalid observation") - global.Error(err, "dropping observation made outside a callback", - "name", o.name, - "description", o.description, - "unit", o.unit, - "number", fmt.Sprintf("%T", zero), - ) -} - // observe records the val for the set of attrs. func (o *observable[N]) observe(val N, attrs []attribute.KeyValue) { for _, agg := range o.aggregators { diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index e6732ff5ff3..01906364d00 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -232,7 +232,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro } switch o := inst.(type) { - case *observable[int64]: + case int64Observable: if err := o.registerable(m.scope); err != nil { if !errors.Is(err, errEmptyAgg) { errs.append(err) @@ -240,7 +240,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro continue } reg.registerInt64(o.observablID) - case *observable[float64]: + case float64Observable: if err := o.registerable(m.scope); err != nil { if !errors.Is(err, errEmptyAgg) { errs.append(err) @@ -298,10 +298,10 @@ var ( errUnregObserver = errors.New("observable instrument not registered for callback") ) -func (r observer) ObserveFloat64(o instrument.Float64Observer, v float64, a ...attribute.KeyValue) { - var oImpl *observable[float64] +func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, a ...attribute.KeyValue) { + var oImpl float64Observable switch conv := o.(type) { - case *observable[float64]: + case float64Observable: oImpl = conv case interface { Unwrap() instrument.Asynchronous @@ -309,7 +309,7 @@ func (r observer) ObserveFloat64(o instrument.Float64Observer, v float64, a ...a // Unwrap any global. async := conv.Unwrap() var ok bool - if oImpl, ok = async.(*observable[float64]); !ok { + if oImpl, ok = async.(float64Observable); !ok { global.Error(errUnknownObserver, "failed to record asynchronous") return } @@ -330,10 +330,10 @@ func (r observer) ObserveFloat64(o instrument.Float64Observer, v float64, a ...a oImpl.observe(v, a) } -func (r observer) ObserveInt64(o instrument.Int64Observer, v int64, a ...attribute.KeyValue) { - var oImpl *observable[int64] +func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, a ...attribute.KeyValue) { + var oImpl int64Observable switch conv := o.(type) { - case *observable[int64]: + case int64Observable: oImpl = conv case interface { Unwrap() instrument.Asynchronous @@ -341,7 +341,7 @@ func (r observer) ObserveInt64(o instrument.Int64Observer, v int64, a ...attribu // Unwrap any global. async := conv.Unwrap() var ok bool - if oImpl, ok = async.(*observable[int64]); !ok { + if oImpl, ok = async.(int64Observable); !ok { global.Error(errUnknownObserver, "failed to record asynchronous") return } @@ -398,13 +398,13 @@ func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit. type int64ObservProvider struct{ *instProvider[int64] } -func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*observable[int64], error) { +func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (int64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) - return newObservable(p.scope, kind, name, desc, u, aggs), err + return newInt64Observable(p.scope, kind, name, desc, u, aggs), err } -func (p int64ObservProvider) registerCallbacks(inst *observable[int64], cBacks []instrument.Int64Callback) { - if inst == nil { +func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []instrument.Int64Callback) { + if inst.observable == nil || len(inst.aggregators) == 0 { // Drop aggregator. return } @@ -414,20 +414,28 @@ func (p int64ObservProvider) registerCallbacks(inst *observable[int64], cBacks [ } } -func (p int64ObservProvider) callback(i *observable[int64], f instrument.Int64Callback) func(context.Context) error { - inst := callbackObserver[int64]{i} +func (p int64ObservProvider) callback(i int64Observable, f instrument.Int64Callback) func(context.Context) error { + inst := int64Observer{i} return func(ctx context.Context) error { return f(ctx, inst) } } +type int64Observer struct { + int64Observable +} + +func (o int64Observer) Observe(val int64, attrs ...attribute.KeyValue) { + o.observe(val, attrs) +} + type float64ObservProvider struct{ *instProvider[float64] } -func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*observable[float64], error) { +func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (float64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) - return newObservable(p.scope, kind, name, desc, u, aggs), err + return newFloat64Observable(p.scope, kind, name, desc, u, aggs), err } -func (p float64ObservProvider) registerCallbacks(inst *observable[float64], cBacks []instrument.Float64Callback) { - if inst == nil { +func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []instrument.Float64Callback) { + if inst.observable == nil || len(inst.aggregators) == 0 { // Drop aggregator. return } @@ -437,17 +445,15 @@ func (p float64ObservProvider) registerCallbacks(inst *observable[float64], cBac } } -func (p float64ObservProvider) callback(i *observable[float64], f instrument.Float64Callback) func(context.Context) error { - inst := callbackObserver[float64]{i} +func (p float64ObservProvider) callback(i float64Observable, f instrument.Float64Callback) func(context.Context) error { + inst := float64Observer{i} return func(ctx context.Context) error { return f(ctx, inst) } } -// callbackObserver is an observer that records values for a wrapped -// observable. -type callbackObserver[N int64 | float64] struct { - *observable[N] +type float64Observer struct { + float64Observable } -func (o callbackObserver[N]) Observe(_ context.Context, val N, attrs ...attribute.KeyValue) { +func (o float64Observer) Observe(val float64, attrs ...attribute.KeyValue) { o.observe(val, attrs) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 190528e3c51..a5248bedfb0 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -179,8 +179,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Int64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Int64Observer) error { + o.Observe(4, attrs...) return nil } ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) @@ -190,9 +190,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, ctr) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - ctr.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "aint", @@ -209,8 +206,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Int64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Int64Observer) error { + o.Observe(4, attrs...) return nil } ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) @@ -220,9 +217,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, ctr) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - ctr.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "aint", @@ -239,8 +233,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Int64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Int64Observer) error { + o.Observe(4, attrs...) return nil } gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) @@ -250,9 +244,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, gauge) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - gauge.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "agauge", @@ -267,8 +258,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Float64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Float64Observer) error { + o.Observe(4, attrs...) return nil } ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) @@ -278,9 +269,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, ctr) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - ctr.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "afloat", @@ -297,8 +285,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Float64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Float64Observer) error { + o.Observe(4, attrs...) return nil } ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) @@ -308,9 +296,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, ctr) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - ctr.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "afloat", @@ -327,8 +312,8 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(ctx context.Context, o instrument.Float64Observer) error { - o.Observe(ctx, 4, attrs...) + cback := func(_ context.Context, o instrument.Float64Observer) error { + o.Observe(4, attrs...) return nil } gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) @@ -338,9 +323,6 @@ func TestMeterCreatesInstruments(t *testing.T) { return nil }, gauge) assert.NoError(t, err) - - // Observed outside of a callback, it should be ignored. - gauge.Observe(context.Background(), 19) }, want: metricdata.Metrics{ Name: "agauge", @@ -564,10 +546,9 @@ func TestCallbackObserverNonRegistered(t *testing.T) { fCtr, err := m2.Float64ObservableCounter("float64 ctr") require.NoError(t, err) - // Panics if Observe is called. - type int64Obsrv struct{ instrument.Int64Observer } + type int64Obsrv struct{ instrument.Int64Observable } int64Foreign := int64Obsrv{} - type float64Obsrv struct{ instrument.Float64Observer } + type float64Obsrv struct{ instrument.Float64Observable } float64Foreign := float64Obsrv{} _, err = m1.RegisterCallback( @@ -1311,9 +1292,9 @@ func TestAsynchronousExample(t *testing.T) { observations := make(map[attribute.Set]int64) _, err := meter.Int64ObservableCounter(instName, instrument.WithInt64Callback( - func(ctx context.Context, o instrument.Int64Observer) error { + func(_ context.Context, o instrument.Int64Observer) error { for attrSet, val := range observations { - o.Observe(ctx, val, attrSet.ToSlice()...) + o.Observe(val, attrSet.ToSlice()...) } return nil }, From 604772dda3b471b095992e22b27bbb3677fbfac6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 26 Jan 2023 09:21:55 -0800 Subject: [PATCH 380/886] Change ClientResponse to accept an *http.Response (#3617) --- internal/tools/semconvkit/templates/httpconv/http.go.tmpl | 2 +- semconv/internal/v2/http.go | 2 +- semconv/internal/v2/http_test.go | 2 +- semconv/v1.13.0/httpconv/http.go | 2 +- semconv/v1.14.0/httpconv/http.go | 2 +- semconv/v1.15.0/httpconv/http.go | 2 +- semconv/v1.16.0/httpconv/http.go | 2 +- semconv/v1.17.0/httpconv/http.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl index 4d9244aa02d..f43ad8c1f3a 100644 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } diff --git a/semconv/internal/v2/http.go b/semconv/internal/v2/http.go index 0f84a905b04..c93d768f4ee 100644 --- a/semconv/internal/v2/http.go +++ b/semconv/internal/v2/http.go @@ -53,7 +53,7 @@ type HTTPConv struct { // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func (c *HTTPConv) ClientResponse(resp http.Response) []attribute.KeyValue { +func (c *HTTPConv) ClientResponse(resp *http.Response) []attribute.KeyValue { var n int if resp.StatusCode > 0 { n++ diff --git a/semconv/internal/v2/http_test.go b/semconv/internal/v2/http_test.go index 73b9aa9b147..5a6686dd70c 100644 --- a/semconv/internal/v2/http_test.go +++ b/semconv/internal/v2/http_test.go @@ -47,7 +47,7 @@ var hc = &HTTPConv{ func TestHTTPClientResponse(t *testing.T) { const stat, n = 201, 397 - resp := http.Response{ + resp := &http.Response{ StatusCode: stat, ContentLength: n, } diff --git a/semconv/v1.13.0/httpconv/http.go b/semconv/v1.13.0/httpconv/http.go index 9ba94c9e1e1..6e5bf4adb50 100644 --- a/semconv/v1.13.0/httpconv/http.go +++ b/semconv/v1.13.0/httpconv/http.go @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } diff --git a/semconv/v1.14.0/httpconv/http.go b/semconv/v1.14.0/httpconv/http.go index 57dca5501b4..1ce725a237c 100644 --- a/semconv/v1.14.0/httpconv/http.go +++ b/semconv/v1.14.0/httpconv/http.go @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } diff --git a/semconv/v1.15.0/httpconv/http.go b/semconv/v1.15.0/httpconv/http.go index 1b682db10b6..3c0d19a7053 100644 --- a/semconv/v1.15.0/httpconv/http.go +++ b/semconv/v1.15.0/httpconv/http.go @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } diff --git a/semconv/v1.16.0/httpconv/http.go b/semconv/v1.16.0/httpconv/http.go index 218ac703c2c..77130fc35b7 100644 --- a/semconv/v1.16.0/httpconv/http.go +++ b/semconv/v1.16.0/httpconv/http.go @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } diff --git a/semconv/v1.17.0/httpconv/http.go b/semconv/v1.17.0/httpconv/http.go index 7499accfb61..f4c6fe6a49a 100644 --- a/semconv/v1.17.0/httpconv/http.go +++ b/semconv/v1.17.0/httpconv/http.go @@ -68,7 +68,7 @@ var ( // request contained in resp. For example: // // append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp http.Response) []attribute.KeyValue { +func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } From 7f4d76ab7a728e406e18734ed032307806a22624 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 26 Jan 2023 10:49:58 -0800 Subject: [PATCH 381/886] Use Extrema type for Histogram min/max (#3550) * Use Extrema type for Histogram min/max * Add case for Extrema in AssertHasAttributes * Add changes to changelog * Add NewExtrema * Add metricdatatest tests * Use getter for Extrema * Fix Extrema doc language * Correct dataset to be one word * Ensure multiple extrema are tested in a dataset --- CHANGELOG.md | 2 ++ .../internal/transform/metricdata.go | 13 ++++++++---- .../internal/transform/metricdata_test.go | 8 +++---- sdk/metric/internal/histogram.go | 10 ++++----- sdk/metric/internal/histogram_test.go | 4 ++-- sdk/metric/meter_test.go | 20 ++++++++---------- sdk/metric/metricdata/data.go | 21 +++++++++++++++++-- .../metricdata/metricdatatest/assertion.go | 5 +++++ .../metricdatatest/assertion_test.go | 14 ++++++++++--- .../metricdata/metricdatatest/comparisons.go | 21 +++++++++++++------ 10 files changed, 80 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 822d55bd053..b7537aa5242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` - `Int64Histogram` replaces the `syncint64.Histogram` - Add `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing` to create `WrapperTracer` instances from a `TracerProvider`. (#3316) +- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata` to represent min/max values and still be able to distinguish unset and zero values. (#3487) - Add the `go.opentelemetry.io/otel/semconv/v1.17.0` package. The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) @@ -106,6 +107,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The slice of `instrument.Asynchronous` parameter is now passed as a variadic argument. (#3587) - The `Callback` in `go.opentelemetry.io/otel/metric` has the added `Observer` parameter added. This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) +- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) ### Fixed diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 4d6edc90330..d952f8b06be 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -174,7 +174,7 @@ func HistogramDataPoints(dPts []metricdata.HistogramDataPoint) []*mpb.HistogramD out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) for _, dPt := range dPts { sum := dPt.Sum - out = append(out, &mpb.HistogramDataPoint{ + hdp := &mpb.HistogramDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), TimeUnixNano: uint64(dPt.Time.UnixNano()), @@ -182,9 +182,14 @@ func HistogramDataPoints(dPts []metricdata.HistogramDataPoint) []*mpb.HistogramD Sum: &sum, BucketCounts: dPt.BucketCounts, ExplicitBounds: dPt.Bounds, - Min: dPt.Min, - Max: dPt.Max, - }) + } + if v, ok := dPt.Min.Value(); ok { + hdp.Min = &v + } + if v, ok := dPt.Max.Value(); ok { + hdp.Max = &v + } + out = append(out, hdp) } return out } diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 60773a92eaf..7241a5cf76c 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -60,8 +60,8 @@ var ( Count: 30, Bounds: []float64{1, 5}, BucketCounts: []uint64{0, 30, 0}, - Min: &minA, - Max: &maxA, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), Sum: sumA, }, { Attributes: bob, @@ -70,8 +70,8 @@ var ( Count: 3, Bounds: []float64{1, 5}, BucketCounts: []uint64{0, 1, 2}, - Min: &minB, - Max: &maxB, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), Sum: sumB, }} diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go index 058af8419b1..fb4f4d47db1 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/histogram.go @@ -156,8 +156,8 @@ func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { Sum: b.sum, } if !s.noMinMax { - hdp.Min = &b.min - hdp.Max = &b.max + hdp.Min = metricdata.NewExtrema(b.min) + hdp.Max = metricdata.NewExtrema(b.max) } h.DataPoints = append(h.DataPoints, hdp) @@ -227,10 +227,8 @@ func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { Sum: b.sum, } if !s.noMinMax { - // Similar to counts, make a copy. - min, max := b.min, b.max - hdp.Min = &min - hdp.Max = &max + hdp.Min = metricdata.NewExtrema(b.min) + hdp.Max = metricdata.NewExtrema(b.max) } h.DataPoints = append(h.DataPoints, hdp) // TODO (#3006): This will use an unbounded amount of memory if there diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index fb2968fc325..57f04560a16 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -92,8 +92,8 @@ func hPoint(a attribute.Set, v float64, multi uint64) metricdata.HistogramDataPo Count: multi, Bounds: bounds, BucketCounts: counts, - Min: &v, - Max: &v, + Min: metricdata.NewExtrema(v), + Max: metricdata.NewExtrema(v), Sum: v * float64(multi), } } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index a5248bedfb0..154ae924fd5 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -169,8 +169,8 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { + extrema := metricdata.NewExtrema(7.) attrs := []attribute.KeyValue{attribute.String("name", "alice")} - seven := 7.0 testCases := []struct { name string fn func(*testing.T, metric.Meter) @@ -391,8 +391,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Count: 1, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - Min: &seven, - Max: &seven, + Min: extrema, + Max: extrema, Sum: 7.0, }, }, @@ -455,8 +455,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Count: 1, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - Min: &seven, - Max: &seven, + Min: extrema, + Max: extrema, Sum: 7.0, }, }, @@ -882,8 +882,6 @@ func TestAttributeFilter(t *testing.T) { } func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { - one := 1.0 - two := 2.0 testcases := []struct { name string register func(t *testing.T, mtr metric.Meter) error @@ -1130,8 +1128,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Count: 2, - Min: &one, - Max: &two, + Min: metricdata.NewExtrema(1.), + Max: metricdata.NewExtrema(2.), Sum: 3.0, }, }, @@ -1212,8 +1210,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Count: 2, - Min: &one, - Max: &two, + Min: metricdata.NewExtrema(1.), + Max: metricdata.NewExtrema(2.), Sum: 3.0, }, }, diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index a729879e673..cd882c0bd2d 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -122,9 +122,26 @@ type HistogramDataPoint struct { BucketCounts []uint64 // Min is the minimum value recorded. (optional) - Min *float64 `json:",omitempty"` + Min Extrema // Max is the maximum value recorded. (optional) - Max *float64 `json:",omitempty"` + Max Extrema // Sum is the sum of the values recorded. Sum float64 } + +// Extrema is the minimum or maximum value of a dataset. +type Extrema struct { + value float64 + valid bool +} + +// NewExtrema returns an Extrema set to v. +func NewExtrema(v float64) Extrema { + return Extrema{value: v, valid: true} +} + +// Value returns the Extrema value and true if the Extrema is defined. +// Otherwise, if the Extrema is its zero-value, defined will be false. +func (e Extrema) Value() (v float64, defined bool) { + return e.value, e.valid +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index 193be1ff708..d1ad1e70195 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -32,6 +32,7 @@ type Datatypes interface { metricdata.Gauge[int64] | metricdata.Histogram | metricdata.HistogramDataPoint | + metricdata.Extrema | metricdata.Metrics | metricdata.ResourceMetrics | metricdata.ScopeMetrics | @@ -92,6 +93,8 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) r = equalHistograms(e, aIface.(metricdata.Histogram), cfg) case metricdata.HistogramDataPoint: r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint), cfg) + case metricdata.Extrema: + r = equalExtrema(e, aIface.(metricdata.Extrema), cfg) case metricdata.Metrics: r = equalMetrics(e, aIface.(metricdata.Metrics), cfg) case metricdata.ResourceMetrics: @@ -152,6 +155,8 @@ func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute reasons = hasAttributesSum(e, attrs...) case metricdata.HistogramDataPoint: reasons = hasAttributesHistogramDataPoints(e, attrs...) + case metricdata.Extrema: + // Nothing to check. case metricdata.Histogram: reasons = hasAttributesHistogram(e, attrs...) case metricdata.Metrics: diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index b7da4344353..7056ee71293 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -73,7 +73,10 @@ var ( Value: -1.0, } - max, min = 99.0, 3. + minA = metricdata.NewExtrema(-1.) + minB, maxB = metricdata.NewExtrema(3.), metricdata.NewExtrema(99.) + minC = metricdata.NewExtrema(-1.) + histogramDataPointA = metricdata.HistogramDataPoint{ Attributes: attrA, StartTime: startA, @@ -81,6 +84,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, + Min: minA, Sum: 2, } histogramDataPointB = metricdata.HistogramDataPoint{ @@ -90,8 +94,8 @@ var ( Count: 3, Bounds: []float64{0, 10, 100}, BucketCounts: []uint64{1, 1, 1}, - Max: &max, - Min: &min, + Max: maxB, + Min: minB, Sum: 3, } histogramDataPointC = metricdata.HistogramDataPoint{ @@ -101,6 +105,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, + Min: minC, Sum: 2, } @@ -247,6 +252,7 @@ func TestAssertEqual(t *testing.T) { t.Run("HistogramDataPoint", testDatatype(histogramDataPointA, histogramDataPointB, equalHistogramDataPoints)) t.Run("DataPointInt64", testDatatype(dataPointInt64A, dataPointInt64B, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatype(dataPointFloat64A, dataPointFloat64B, equalDataPoints[float64])) + t.Run("Extrema", testDatatype(minA, minB, equalExtrema)) } func TestAssertEqualIgnoreTime(t *testing.T) { @@ -261,6 +267,7 @@ func TestAssertEqualIgnoreTime(t *testing.T) { t.Run("HistogramDataPoint", testDatatypeIgnoreTime(histogramDataPointA, histogramDataPointC, equalHistogramDataPoints)) t.Run("DataPointInt64", testDatatypeIgnoreTime(dataPointInt64A, dataPointInt64C, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatypeIgnoreTime(dataPointFloat64A, dataPointFloat64C, equalDataPoints[float64])) + t.Run("Extrema", testDatatypeIgnoreTime(minA, minC, equalExtrema)) } type unknownAggregation struct { @@ -316,6 +323,7 @@ func TestAssertAggregationsEqual(t *testing.T) { } func TestAssertAttributes(t *testing.T) { + AssertHasAttributes(t, minA, attribute.Bool("A", true)) // No-op, always pass. AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", true)) AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("A", true)) AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", true)) diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 9879c96f109..a6bc83f6b7d 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -267,10 +267,10 @@ func equalHistogramDataPoints(a, b metricdata.HistogramDataPoint, cfg config) (r if !equalSlices(a.BucketCounts, b.BucketCounts) { reasons = append(reasons, notEqualStr("BucketCounts", a.BucketCounts, b.BucketCounts)) } - if !equalPtrValues(a.Min, b.Min) { + if !eqExtrema(a.Min, b.Min) { reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) } - if !equalPtrValues(a.Max, b.Max) { + if !eqExtrema(a.Max, b.Max) { reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) } if a.Sum != b.Sum { @@ -295,12 +295,21 @@ func equalSlices[T comparable](a, b []T) bool { return true } -func equalPtrValues[T comparable](a, b *T) bool { - if a == nil || b == nil { - return a == b +func equalExtrema(a, b metricdata.Extrema, _ config) (reasons []string) { + if !eqExtrema(a, b) { + reasons = append(reasons, notEqualStr("Extrema", a, b)) } + return reasons +} - return *a == *b +func eqExtrema(a, b metricdata.Extrema) bool { + aV, aOk := a.Value() + bV, bOk := b.Value() + + if !aOk || !bOk { + return aOk == bOk + } + return aV == bV } func diffSlices[T any](a, b []T, equal func(T, T) bool) (extraA, extraB []T) { From c61d2f01083219b6b5d799d6c46c37a55ea95136 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 26 Jan 2023 11:01:01 -0800 Subject: [PATCH 382/886] Link check ignore GH projects link (#3620) --- .lycheeignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.lycheeignore b/.lycheeignore index 545d634525d..32e4812755e 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -1,3 +1,4 @@ http://localhost http://jaeger-collector https://github.com/open-telemetry/opentelemetry-go/milestone/ +https://github.com/open-telemetry/opentelemetry-go/projects From 7e5d903305cd315def2e350b58cedc1220bf7a68 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 26 Jan 2023 11:16:04 -0800 Subject: [PATCH 383/886] Use opentelemetrybot for dependabot PR action (#3616) --- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/scripts/dependabot-pr.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 436e06e6aa9..26f71c3eb8e 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -20,4 +20,4 @@ jobs: - name: Run dependabot-pr.sh run: ./.github/workflows/scripts/dependabot-pr.sh env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} diff --git a/.github/workflows/scripts/dependabot-pr.sh b/.github/workflows/scripts/dependabot-pr.sh index 8d5bf46c1c3..af20acb2287 100755 --- a/.github/workflows/scripts/dependabot-pr.sh +++ b/.github/workflows/scripts/dependabot-pr.sh @@ -14,8 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -git config user.name $GITHUB_ACTOR -git config user.email $GITHUB_ACTOR@users.noreply.github.com +git config user.name opentelemetrybot +git config user.email 107717825+opentelemetrybot@users.noreply.github.com PR_NAME=dependabot-prs/`date +'%Y-%m-%dT%H%M%S'` git checkout -b $PR_NAME From af3db6e8bed64df441d99cd5c4f06578980b32a4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 26 Jan 2023 11:55:13 -0800 Subject: [PATCH 384/886] Update ServerRequest to accept server name (#3619) * Update ServerRequest to accept server name * Update docs to include Apache and nginx examples * Test the server not containing a port --- .../templates/httpconv/http.go.tmpl | 19 ++++++++++-- semconv/internal/v2/http.go | 29 +++++++++++++++++-- semconv/internal/v2/http_test.go | 25 ++++++++++++++-- semconv/v1.13.0/httpconv/http.go | 19 ++++++++++-- semconv/v1.14.0/httpconv/http.go | 19 ++++++++++-- semconv/v1.15.0/httpconv/http.go | 19 ++++++++++-- semconv/v1.16.0/httpconv/http.go | 19 ++++++++++-- semconv/v1.17.0/httpconv/http.go | 19 ++++++++++-- 8 files changed, 152 insertions(+), 16 deletions(-) diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl index f43ad8c1f3a..e21a387d1c9 100644 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code diff --git a/semconv/internal/v2/http.go b/semconv/internal/v2/http.go index c93d768f4ee..c7c47fa8815 100644 --- a/semconv/internal/v2/http.go +++ b/semconv/internal/v2/http.go @@ -136,14 +136,39 @@ func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func (c *HTTPConv) ServerRequest(req *http.Request) []attribute.KeyValue { +func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { n := 5 // Method, scheme, target, proto, and host name. - host, p := splitHostPort(req.Host) + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } hostPort := requiredHTTPPort(req.TLS != nil, p) if hostPort > 0 { n++ diff --git a/semconv/internal/v2/http_test.go b/semconv/internal/v2/http_test.go index 5a6686dd70c..9f91a2f7b4d 100644 --- a/semconv/internal/v2/http_test.go +++ b/semconv/internal/v2/http_test.go @@ -178,13 +178,34 @@ func TestHTTPServerRequest(t *testing.T) { attribute.String("enduser.id", user), attribute.String("http.client_ip", clientIP), }, - hc.ServerRequest(req)) + hc.ServerRequest("", req)) +} + +func TestHTTPServerName(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + const ( + host = "test.semconv.server" + port = 8080 + ) + portStr := strconv.Itoa(port) + server := host + ":" + portStr + assert.NotPanics(t, func() { got = hc.ServerRequest(server, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) + + req = &http.Request{Host: "alt.host.name:" + portStr} + // The server parameter does not include a port, ServerRequest should use + // the port in the request Host field. + assert.NotPanics(t, func() { got = hc.ServerRequest(host, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) } func TestHTTPServerRequestFailsGracefully(t *testing.T) { req := new(http.Request) var got []attribute.KeyValue - assert.NotPanics(t, func() { got = hc.ServerRequest(req) }) + assert.NotPanics(t, func() { got = hc.ServerRequest("", req) }) want := []attribute.KeyValue{ attribute.String("http.method", "GET"), attribute.String("http.target", ""), diff --git a/semconv/v1.13.0/httpconv/http.go b/semconv/v1.13.0/httpconv/http.go index 6e5bf4adb50..29c29c65b46 100644 --- a/semconv/v1.13.0/httpconv/http.go +++ b/semconv/v1.13.0/httpconv/http.go @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code diff --git a/semconv/v1.14.0/httpconv/http.go b/semconv/v1.14.0/httpconv/http.go index 1ce725a237c..017c7bb23df 100644 --- a/semconv/v1.14.0/httpconv/http.go +++ b/semconv/v1.14.0/httpconv/http.go @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code diff --git a/semconv/v1.15.0/httpconv/http.go b/semconv/v1.15.0/httpconv/http.go index 3c0d19a7053..456b372a96b 100644 --- a/semconv/v1.15.0/httpconv/http.go +++ b/semconv/v1.15.0/httpconv/http.go @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code diff --git a/semconv/v1.16.0/httpconv/http.go b/semconv/v1.16.0/httpconv/http.go index 77130fc35b7..11ff9edc703 100644 --- a/semconv/v1.16.0/httpconv/http.go +++ b/semconv/v1.16.0/httpconv/http.go @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code diff --git a/semconv/v1.17.0/httpconv/http.go b/semconv/v1.17.0/httpconv/http.go index f4c6fe6a49a..c60b2a6bb68 100644 --- a/semconv/v1.17.0/httpconv/http.go +++ b/semconv/v1.17.0/httpconv/http.go @@ -88,13 +88,28 @@ func ClientStatus(code int) (codes.Code, string) { } // ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". -func ServerRequest(req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(req) +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) } // ServerStatus returns a span status code and message for an HTTP status code From ec13377b6b7cea9ba5e6a2233ad934a411459a58 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Fri, 27 Jan 2023 10:42:15 -0800 Subject: [PATCH 385/886] OTLP traces export errors use a consistent error message prefix (#3516) * OTLP traces export errors use a consistent error message prefix * use a wrapped error * update changelog * merge changelog * Update CHANGELOG.md --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 2 + exporters/otlp/internal/wrappederror.go | 61 ++++++++++++++++++ exporters/otlp/internal/wrappederror_test.go | 32 ++++++++++ exporters/otlp/otlptrace/exporter.go | 7 ++- exporters/otlp/otlptrace/exporter_test.go | 63 +++++++++++++++++++ .../otlptrace/otlptracegrpc/client_test.go | 15 +++-- .../otlp/otlptrace/otlptracehttp/client.go | 2 +- .../otlptrace/otlptracehttp/client_test.go | 20 +++--- 8 files changed, 187 insertions(+), 15 deletions(-) create mode 100644 exporters/otlp/internal/wrappederror.go create mode 100644 exporters/otlp/internal/wrappederror_test.go create mode 100644 exporters/otlp/otlptrace/exporter_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index b7537aa5242..9215ad9e217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, fixing random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- OTLP trace exporter errors are wrapped in a type that prefixes the signal name in front of error strings (e.g., "traces export: context canceled" instead of just "context canceled"). + Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) - The OTLP exporter for traces and metrics will print the final retryable error message when attempts to retry time out. (#3514) - The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` diff --git a/exporters/otlp/internal/wrappederror.go b/exporters/otlp/internal/wrappederror.go new file mode 100644 index 00000000000..217751da552 --- /dev/null +++ b/exporters/otlp/internal/wrappederror.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" + +// ErrorKind is used to identify the kind of export error +// being wrapped. +type ErrorKind int + +const ( + // TracesExport indicates the error comes from the OTLP trace exporter. + TracesExport ErrorKind = iota +) + +// prefix returns a prefix for the Error() string. +func (k ErrorKind) prefix() string { + switch k { + case TracesExport: + return "traces export: " + default: + return "unknown: " + } +} + +// wrappedExportError wraps an OTLP exporter error with the kind of +// signal that produced it. +type wrappedExportError struct { + wrap error + kind ErrorKind +} + +// WrapTracesError wraps an error from the OTLP exporter for traces. +func WrapTracesError(err error) error { + return wrappedExportError{ + wrap: err, + kind: TracesExport, + } +} + +var _ error = wrappedExportError{} + +// Error attaches a prefix corresponding to the kind of exporter. +func (t wrappedExportError) Error() string { + return t.kind.prefix() + t.wrap.Error() +} + +// Unwrap returns the wrapped error. +func (t wrappedExportError) Unwrap() error { + return t.wrap +} diff --git a/exporters/otlp/internal/wrappederror_test.go b/exporters/otlp/internal/wrappederror_test.go new file mode 100644 index 00000000000..995358a9f8e --- /dev/null +++ b/exporters/otlp/internal/wrappederror_test.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" + +import ( + "context" + "errors" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestWrappedError(t *testing.T) { + e := WrapTracesError(context.Canceled) + + require.Equal(t, context.Canceled, errors.Unwrap(e)) + require.Equal(t, TracesExport, e.(wrappedExportError).kind) + require.Equal(t, "traces export: context canceled", e.Error()) + require.True(t, errors.Is(e, context.Canceled)) +} diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index c5ee6c098cc..b65802edbbd 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -19,6 +19,7 @@ import ( "errors" "sync" + "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" tracesdk "go.opentelemetry.io/otel/sdk/trace" ) @@ -45,7 +46,11 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan) return nil } - return e.client.UploadTraces(ctx, protoSpans) + err := e.client.UploadTraces(ctx, protoSpans) + if err != nil { + return internal.WrapTracesError(err) + } + return nil } // Start establishes a connection to the receiving endpoint. diff --git a/exporters/otlp/otlptrace/exporter_test.go b/exporters/otlp/otlptrace/exporter_test.go new file mode 100644 index 00000000000..1007d23a7e2 --- /dev/null +++ b/exporters/otlp/otlptrace/exporter_test.go @@ -0,0 +1,63 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptrace_test + +import ( + "context" + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +type client struct { + uploadErr error +} + +var _ otlptrace.Client = &client{} + +func (c *client) Start(ctx context.Context) error { + return nil +} + +func (c *client) Stop(ctx context.Context) error { + return nil +} + +func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.ResourceSpans) error { + return c.uploadErr +} + +func TestExporterClientError(t *testing.T) { + ctx := context.Background() + exp, err := otlptrace.New(ctx, &client{ + uploadErr: context.Canceled, + }) + assert.NoError(t, err) + + spans := tracetest.SpanStubs{{Name: "Span 0"}}.Snapshots() + err = exp.ExportSpans(ctx, spans) + + assert.Error(t, err) + assert.True(t, errors.Is(err, context.Canceled)) + assert.True(t, strings.HasPrefix(err.Error(), "traces export: "), err) + + assert.NoError(t, exp.Shutdown(ctx)) +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 395ccc28bf4..ded71a5a3b4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -16,6 +16,7 @@ package otlptracegrpc_test import ( "context" + "errors" "fmt" "net" "strings" @@ -239,7 +240,9 @@ func TestExportSpansTimeoutHonored(t *testing.T) { // Release the export so everything is cleaned up on shutdown. close(exportBlock) - require.Equal(t, codes.DeadlineExceeded, status.Convert(err).Code()) + unwrapped := errors.Unwrap(err) + require.Equal(t, codes.DeadlineExceeded, status.Convert(unwrapped).Code()) + require.True(t, strings.HasPrefix(err.Error(), "traces export: "), err) } func TestNewWithMultipleAttributeTypes(t *testing.T) { @@ -399,18 +402,18 @@ func TestPartialSuccess(t *testing.T) { }) t.Cleanup(func() { require.NoError(t, mc.stop()) }) - errors := []error{} + errs := []error{} otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { - errors = append(errors, err) + errs = append(errs, err) })) ctx := context.Background() exp := newGRPCExporter(t, ctx, mc.endpoint) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) require.NoError(t, exp.ExportSpans(ctx, roSpans)) - require.Equal(t, 1, len(errors)) - require.Contains(t, errors[0].Error(), "partially successful") - require.Contains(t, errors[0].Error(), "2 spans rejected") + require.Equal(t, 1, len(errs)) + require.Contains(t, errs[0].Error(), "partially successful") + require.Contains(t, errs[0].Error(), "2 spans rejected") } func TestCustomUserAgent(t *testing.T) { diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 79b8af73286..9fbe861717d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -197,7 +197,7 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc } return newResponseError(resp.Header) default: - return fmt.Errorf("failed to send %s to %s: %s", d.name, request.URL, resp.Status) + return fmt.Errorf("failed to send to %s: %s", request.URL, resp.Status) } }) } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 135b6517622..859c48dd38c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -16,9 +16,11 @@ package otlptracehttp_test import ( "context" + "errors" "fmt" "net/http" "os" + "strings" "testing" "time" @@ -219,7 +221,9 @@ func TestTimeout(t *testing.T) { assert.NoError(t, exporter.Shutdown(ctx)) }() err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) - assert.Equalf(t, true, os.IsTimeout(err), "expected timeout error, got: %v", err) + unwrapped := errors.Unwrap(err) + assert.Equalf(t, true, os.IsTimeout(unwrapped), "expected timeout error, got: %v", unwrapped) + assert.True(t, strings.HasPrefix(err.Error(), "traces export: "), err) } func TestNoRetry(t *testing.T) { @@ -246,7 +250,9 @@ func TestNoRetry(t *testing.T) { }() err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) assert.Error(t, err) - assert.Equal(t, fmt.Sprintf("failed to send traces to http://%s/v1/traces: 400 Bad Request", mc.endpoint), err.Error()) + unwrapped := errors.Unwrap(err) + assert.Equal(t, fmt.Sprintf("failed to send to http://%s/v1/traces: 400 Bad Request", mc.endpoint), unwrapped.Error()) + assert.True(t, strings.HasPrefix(err.Error(), "traces export: ")) assert.Empty(t, mc.GetSpans()) } @@ -384,14 +390,14 @@ func TestPartialSuccess(t *testing.T) { assert.NoError(t, exporter.Shutdown(context.Background())) }() - errors := []error{} + errs := []error{} otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { - errors = append(errors, err) + errs = append(errs, err) })) err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) assert.NoError(t, err) - require.Equal(t, 1, len(errors)) - require.Contains(t, errors[0].Error(), "partially successful") - require.Contains(t, errors[0].Error(), "2 spans rejected") + require.Equal(t, 1, len(errs)) + require.Contains(t, errs[0].Error(), "partially successful") + require.Contains(t, errs[0].Error(), "2 spans rejected") } From 6cb5718eaaed5c408c3bf4ad1aecee5c20ccdaa9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 29 Jan 2023 07:41:22 -0800 Subject: [PATCH 386/886] Release v1.12.0/v0.35.0 (#3623) * Update module versions * Prepare stable-v1 for version v1.12.0 * Prepare experimental-metrics for version v0.35.0 * Prepare experimental-schema for version v0.0.4 * Update the CHANGELOG * Undo bump to experimental-schema Revert to original version as nothing has changed. * Fix PR number in changelog * Move change from #3497 into current release --- CHANGELOG.md | 111 ++++++++++-------- bridge/opencensus/go.mod | 10 +- bridge/opencensus/test/go.mod | 12 +- bridge/opentracing/go.mod | 4 +- example/fib/go.mod | 8 +- example/jaeger/go.mod | 8 +- example/namedtracer/go.mod | 8 +- example/opencensus/go.mod | 16 +-- example/otel-collector/go.mod | 12 +- example/passthrough/go.mod | 8 +- example/prometheus/go.mod | 12 +- example/view/go.mod | 12 +- example/zipkin/go.mod | 8 +- exporters/jaeger/go.mod | 6 +- exporters/otlp/otlpmetric/go.mod | 12 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +-- exporters/otlp/otlptrace/go.mod | 8 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +- exporters/prometheus/go.mod | 10 +- exporters/stdout/stdoutmetric/go.mod | 10 +- exporters/stdout/stdouttrace/go.mod | 6 +- exporters/zipkin/go.mod | 6 +- go.mod | 2 +- metric/go.mod | 4 +- sdk/go.mod | 4 +- sdk/metric/go.mod | 8 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 +- 31 files changed, 184 insertions(+), 177 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9215ad9e217..2bfe0a9411b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,18 +8,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.12.0/0.35.0] 2023-01-28 + ### Added -- The `WithInt64Callback` option is added to `go.opentelemetry.io/otel/metric/instrument` to configure int64 Observer callbacks during their creation. (#3507) -- The `WithFloat64Callback` option is added to `go.opentelemetry.io/otel/metric/instrument` to configure float64 Observer callbacks during their creation. (#3507) -- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. - This `Registration` can be used to unregister callbacks. (#3522) -- Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) -- Add the `Callback` function type to the `go.opentelemetry.io/otel/metric` package. +- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `int64` Observer callbacks during their creation. (#3507) +- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`. + This options is used to configure `float64` Observer callbacks during their creation. (#3507) +- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`. + These additions are used to enable external metric Producers. (#3524) +- The `Callback` function type to `go.opentelemetry.io/otel/metric`. This new named function type is registered with a `Meter`. (#3564) -- Add the `go.opentelemetry.io/otel/semconv/v1.14.0` package. - The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) -- Add the `go.opentelemetry.io/otel/semconv/v1.13.0` package. +- The `go.opentelemetry.io/otel/semconv/v1.13.0` package. The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499) - The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. @@ -31,11 +32,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`. - The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`. - The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`. -- Add the `go.opentelemetry.io/otel/semconv/v1.15.0` package. +- The `go.opentelemetry.io/otel/semconv/v1.14.0` package. + The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566) +- The `go.opentelemetry.io/otel/semconv/v1.15.0` package. The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578) -- Add the `go.opentelemetry.io/otel/semconv/v1.16.0` package. +- The `go.opentelemetry.io/otel/semconv/v1.16.0` package. The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) -- Metric instruments were added to `go.opentelemetry.io/otel/metric/instrument`. +- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` @@ -49,49 +52,32 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `Int64Counter` replaces the `syncint64.Counter` - `Int64UpDownCounter` replaces the `syncint64.UpDownCounter` - `Int64Histogram` replaces the `syncint64.Histogram` -- Add `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing` to create `WrapperTracer` instances from a `TracerProvider`. (#3316) -- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata` to represent min/max values and still be able to distinguish unset and zero values. (#3487) -- Add the `go.opentelemetry.io/otel/semconv/v1.17.0` package. +- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`. + This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116) +- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487) +- The `go.opentelemetry.io/otel/semconv/v1.17.0` package. The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599) ### Changed +- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) - Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and confguration based on the instrument type. (#3507) - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. - Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`. -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Int64ObservableCounter` - - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` - - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Float64ObservableCounter` - - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` - - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Int64Counter` - - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` - - The `Histogram` method is replaced by `Meter.Int64Histogram` -- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. - Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) - - The `Counter` method is replaced by `Meter.Float64Counter` - - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` - - The `Histogram` method is replaced by `Meter.Float64Histogram` +- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package. + This `Registration` can be used to unregister callbacks. (#3522) - Global error handler uses an atomic value instead of a mutex. (#3543) -- Add `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric` to enable external metric Producers. (#3524) - Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541) - Global logger uses an atomic value instead of a mutex. (#3545) - The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) -- `traceIDRatioSampler` (given by `TraceIDRatioBased(float64)`) now uses the rightmost bits for sampling decisions, - fixing random sampling when using ID generators like `xray.IDGenerator` - and increasing parity with other language implementations. (#3557) -- OTLP trace exporter errors are wrapped in a type that prefixes the signal name in front of error strings (e.g., "traces export: context canceled" instead of just "context canceled"). +- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. + This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) +- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in erros identifying their signal name. Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) -- The OTLP exporter for traces and metrics will print the final retryable error message when attempts to retry time out. (#3514) +- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) - The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) - `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter` - `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter` @@ -99,16 +85,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter` - `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter` - `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge` -- Update the `RegisterCallback` method of the `Meter` in the `go.opentelemetry.io/otel/sdk/metric` package to accept the added `Callback` type instead of an inline function type definition. - The underlying type of a `Callback` is the same `func(context.Context)` that the method used to accept. (#3564) -- The callback function registered with a `Meter` from the `go.opentelemetry.io/otel/metric` package is required to return an error now. (#3576) +- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed. + - The named `Callback` replaces the inline function parameter. (#3564) + - `Callback` is required to return an error. (#3576) + - `Callback` accepts the added `Observer` parameter added. + This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) + - The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587) - The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions. This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint. Instead it uses the `net.sock.peer` attributes. (#3581) -- The parameters for the `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/metric` are changed. - The slice of `instrument.Asynchronous` parameter is now passed as a variadic argument. (#3587) -- The `Callback` in `go.opentelemetry.io/otel/metric` has the added `Observer` parameter added. - This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584) - The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487) ### Fixed @@ -119,7 +104,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Deprecated -- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. Use `NewMetricProducer` instead. (#3541) +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated. + Use `NewMetricProducer` instead. (#3541) - The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated. Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) - The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated. @@ -128,11 +114,32 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) - The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated. Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575) -- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. Use `NewTracerProvider` instead. (#3316) +- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated. + Use `NewTracerProvider` instead. (#3116) ### Removed - The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520) +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Int64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64ObservableCounter` + - The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter` + - The `Gauge` method is replaced by `Meter.Float64ObservableGauge` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Int64Counter` + - The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Int64Histogram` +- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed. + Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530) + - The `Counter` method is replaced by `Meter.Float64Counter` + - The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter` + - The `Histogram` method is replaced by `Meter.Float64Histogram` ## [1.11.2/0.34.0] 2022-12-05 @@ -168,7 +175,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260) - The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260) - The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260) -- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) ### Fixed @@ -2214,7 +2220,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.11.2...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.12.0...HEAD +[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 [1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 [1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 [1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index e718783ff38..98030acaaf9 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index a00cc156c7f..658866842f3 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/bridge/opencensus v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/bridge/opencensus v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.35.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.35.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 77d6bafaf2e..b391c4e0582 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index 4b38edb0a1a..b3b85ff5b20 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 33fc0a881dd..8b6cdf67673 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/jaeger v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/jaeger v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index a9bd8db480e..d0164e78299 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 5c8c87d3d4c..f1ae21f4a68 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/bridge/opencensus v0.34.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/bridge/opencensus v0.35.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.35.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/metric v0.35.0 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 6eec4d2aac3..f1c31504405 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 google.golang.org/grpc v1.52.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 0393f783650..f39d6ede18f 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1afe8ad9488..b3358f4d70d 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/prometheus v0.34.0 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/prometheus v0.35.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.2 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index f6597916ce5..429bb93e29d 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/prometheus v0.34.0 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/prometheus v0.35.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 98920249907..cdd875484de 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/zipkin v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/zipkin v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index c1d38fabe1f..65dfcf333c1 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,9 +7,9 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 41db57e65cf..34ab23ec702 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 9094bdc192b..1b674c7dff8 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.35.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 google.golang.org/grpc v1.52.0 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.2 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 966250f8831..ad12bc8f386 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.34.0 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.35.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.11.2 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/sdk v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index cebb01a92a6..dc38051a262 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bdca462d9a2..ccc4872e70a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 33a3262c9e7..f1211817442 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 4f592e9aed0..874e5e71c38 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 google.golang.org/protobuf v1.28.1 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 3d9fddd6e48..88717fb73fc 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/sdk/metric v0.35.0 ) require ( @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index aa854f5909f..2e56f0b30b7 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 3cc8e8aa89c..7cec932c27c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,9 +8,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/go.mod b/go.mod index 767ce13fe78..44ef8ab3610 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel/trace v1.12.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 867f4c1b6d4..cc9784f56fa 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.12.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index a0a6068ee9c..2768c831c94 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/trace v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/trace v1.12.0 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 25aede72907..1a2a5784f2a 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 - go.opentelemetry.io/otel/sdk v1.11.2 + go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel/metric v0.35.0 + go.opentelemetry.io/otel/sdk v1.12.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.11.2 // indirect + go.opentelemetry.io/otel/trace v1.12.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 2befdee4c61..b85198bb4ae 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.12.0 ) require ( diff --git a/version.go b/version.go index 00b79bcc25c..bda8f7cbfae 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.11.2" + return "1.12.0" } diff --git a/versions.yaml b/versions.yaml index 611879def4f..66f45622215 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.11.2 + version: v1.12.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.34.0 + version: v0.35.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From cfed99561d50f42d9499e05559ef378d8170d703 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 29 Jan 2023 09:43:47 -0800 Subject: [PATCH 387/886] dependabot updates Sun Jan 29 16:46:30 UTC 2023 (#3629) Bump google.golang.org/grpc from 1.52.0 to 1.52.3 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.52.0 to 1.52.3 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.52.0 to 1.52.3 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.52.0 to 1.52.3 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.52.0 to 1.52.3 in /example/otel-collector --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index f1c31504405..bf49681113c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0 go.opentelemetry.io/otel/sdk v1.12.0 go.opentelemetry.io/otel/trace v1.12.0 - google.golang.org/grpc v1.52.0 + google.golang.org/grpc v1.52.3 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 109d7019d71..3ff98e04569 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -394,8 +394,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 34ab23ec702..ba874883471 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.12.0 go.opentelemetry.io/otel/sdk/metric v0.35.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.52.0 + google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 225699c0054..92ff38f00d5 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 1b674c7dff8..f679965ee1e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.35.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 - google.golang.org/grpc v1.52.0 + google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 225699c0054..92ff38f00d5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index ad12bc8f386..2d663ffe7c0 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -30,7 +30,7 @@ require ( golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect - google.golang.org/grpc v1.52.0 // indirect + google.golang.org/grpc v1.52.3 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 225699c0054..92ff38f00d5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index dc38051a262..be26575ea7a 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.12.0 go.opentelemetry.io/otel/trace v1.12.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.52.0 + google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 225699c0054..92ff38f00d5 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index ccc4872e70a..bdb492385a2 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 - google.golang.org/grpc v1.52.0 + google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index bac5c087ee8..2f2d88c4024 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -405,8 +405,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f1211817442..cf275f4581e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -25,7 +25,7 @@ require ( golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect - google.golang.org/grpc v1.52.0 // indirect + google.golang.org/grpc v1.52.3 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 329247dae33..10bc98b8d2c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -401,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From aa5122490eb4f182320de76a8d2ef1f3208af788 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 31 Jan 2023 08:12:39 -0800 Subject: [PATCH 388/886] Remove the deprecated instrument packages (#3631) * Remove the deprecated instrument packages * Update changelog * Add PR number --- CHANGELOG.md | 7 ++ .../instrument/asyncfloat64/asyncfloat64.go | 55 ---------------- metric/instrument/asyncint64/asyncint64.go | 55 ---------------- metric/instrument/syncfloat64/syncfloat64.go | 66 ------------------- metric/instrument/syncint64/syncint64.go | 66 ------------------- 5 files changed, 7 insertions(+), 242 deletions(-) delete mode 100644 metric/instrument/asyncfloat64/asyncfloat64.go delete mode 100644 metric/instrument/asyncint64/asyncint64.go delete mode 100644 metric/instrument/syncfloat64/syncfloat64.go delete mode 100644 metric/instrument/syncint64/syncint64.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfe0a9411b..4421f129059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is removed. (#3631) +- The deprecated `go.opentelemetry.io/otel/metric/instrument/syncint64` package is removed. (#3631) + ## [1.12.0/0.35.0] 2023-01-28 ### Added diff --git a/metric/instrument/asyncfloat64/asyncfloat64.go b/metric/instrument/asyncfloat64/asyncfloat64.go deleted file mode 100644 index 7fb43ca363e..00000000000 --- a/metric/instrument/asyncfloat64/asyncfloat64.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package asyncfloat64 provides asynchronous instruments that accept float64 -// measurments. -// -// Deprecated: Use the instruments provided by -// go.opentelemetry.io/otel/metric/instrument instead. -package asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" - -import "go.opentelemetry.io/otel/metric/instrument" - -// Counter is an instrument used to asynchronously record increasing float64 -// measurements once per a measurement collection cycle. The Observe method is -// used to record the measured state of the instrument when it is called. -// Implementations will assume the observed value to be the cumulative sum of -// the count. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64ObservableCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type Counter interface{ instrument.Float64Observer } - -// UpDownCounter is an instrument used to asynchronously record float64 -// measurements once per a measurement collection cycle. The Observe method is -// used to record the measured state of the instrument when it is called. -// Implementations will assume the observed value to be the cumulative sum of -// the count. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64ObservableUpDownCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type UpDownCounter interface{ instrument.Float64Observer } - -// Gauge is an instrument used to asynchronously record instantaneous float64 -// measurements once per a measurement collection cycle. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64ObservableGauge in -// go.opentelemetry.io/otel/metric/instrument instead. -type Gauge interface{ instrument.Float64Observer } diff --git a/metric/instrument/asyncint64/asyncint64.go b/metric/instrument/asyncint64/asyncint64.go deleted file mode 100644 index 1e3be250da8..00000000000 --- a/metric/instrument/asyncint64/asyncint64.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package asyncint64 provides asynchronous instruments that accept int64 -// measurments. -// -// Deprecated: Use the instruments provided by -// go.opentelemetry.io/otel/metric/instrument instead. -package asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64" - -import "go.opentelemetry.io/otel/metric/instrument" - -// Counter is an instrument used to asynchronously record increasing int64 -// measurements once per a measurement collection cycle. The Observe method is -// used to record the measured state of the instrument when it is called. -// Implementations will assume the observed value to be the cumulative sum of -// the count. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64ObservableCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type Counter interface{ instrument.Int64Observer } - -// UpDownCounter is an instrument used to asynchronously record int64 -// measurements once per a measurement collection cycle. The Observe method is -// used to record the measured state of the instrument when it is called. -// Implementations will assume the observed value to be the cumulative sum of -// the count. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64ObservableUpDownCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type UpDownCounter interface{ instrument.Int64Observer } - -// Gauge is an instrument used to asynchronously record instantaneous int64 -// measurements once per a measurement collection cycle. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64ObservableGauge in -// go.opentelemetry.io/otel/metric/instrument instead. -type Gauge interface{ instrument.Int64Observer } diff --git a/metric/instrument/syncfloat64/syncfloat64.go b/metric/instrument/syncfloat64/syncfloat64.go deleted file mode 100644 index bd835ec842d..00000000000 --- a/metric/instrument/syncfloat64/syncfloat64.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package syncfloat64 provides synchronous instruments that accept float64 -// measurments. -// -// Deprecated: Use the instruments provided by -// go.opentelemetry.io/otel/metric/instrument instead. -package syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// Counter is an instrument that records increasing values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64Counter in -// go.opentelemetry.io/otel/metric/instrument instead. -type Counter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64UpDownCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type UpDownCounter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// Histogram is an instrument that records a distribution of values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Float64Histogram in -// go.opentelemetry.io/otel/metric/instrument instead. -type Histogram interface { - // Record adds an additional value to the distribution. - Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} diff --git a/metric/instrument/syncint64/syncint64.go b/metric/instrument/syncint64/syncint64.go deleted file mode 100644 index 88408113f71..00000000000 --- a/metric/instrument/syncint64/syncint64.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package syncint64 provides synchronous instruments that accept int64 -// measurments. -// -// Deprecated: Use the instruments provided by -// go.opentelemetry.io/otel/metric/instrument instead. -package syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// Counter is an instrument that records increasing values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64Counter in -// go.opentelemetry.io/otel/metric/instrument instead. -type Counter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// UpDownCounter is an instrument that records increasing or decreasing values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64UpDownCounter in -// go.opentelemetry.io/otel/metric/instrument instead. -type UpDownCounter interface { - // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} - -// Histogram is an instrument that records a distribution of values. -// -// Warning: methods may be added to this interface in minor releases. -// -// Deprecated: Use the Int64Histogram in -// go.opentelemetry.io/otel/metric/instrument instead. -type Histogram interface { - // Record adds an additional value to the distribution. - Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - instrument.Synchronous -} From 5e8eb855bf3c6507715edd12ded5c6a950dd6104 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 2 Feb 2023 12:16:25 -0600 Subject: [PATCH 389/886] Add a benchmark for histogram allocations (#3635) Co-authored-by: Chester Cheung --- sdk/metric/benchmark_test.go | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index c7bf12beb67..0a75079d275 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -16,10 +16,12 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "fmt" "testing" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func benchCounter(b *testing.B, views ...View) (context.Context, Reader, instrument.Int64Counter) { @@ -105,3 +107,43 @@ func BenchmarkCounterCollectTenAttrs(b *testing.B) { _, _ = rdr.Collect(ctx) } } + +func BenchmarkCollectHistograms(b *testing.B) { + b.Run("1", benchCollectHistograms(1)) + b.Run("5", benchCollectHistograms(5)) + b.Run("10", benchCollectHistograms(10)) + b.Run("25", benchCollectHistograms(25)) +} + +func benchCollectHistograms(count int) func(*testing.B) { + ctx := context.Background() + r := NewManualReader() + mtr := NewMeterProvider( + WithReader(r), + ).Meter("sdk/metric/bench/histogram") + + for i := 0; i < count; i++ { + name := fmt.Sprintf("fake data %d", i) + h, _ := mtr.Int64Histogram(name) + + h.Record(ctx, 1) + } + + // Store bechmark results in a closure to prevent the compiler from + // inlining and skipping the function. + var ( + collectedMetrics metricdata.ResourceMetrics + ) + + return func(b *testing.B) { + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + collectedMetrics, _ = r.Collect(ctx) + if len(collectedMetrics.ScopeMetrics[0].Metrics) != count { + b.Fatalf("got %d metrics, want %d", len(collectedMetrics.ScopeMetrics[0].Metrics), count) + } + } + } +} From c9cb53c5b416c116dff55c30a31b3e9f7901cdaf Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 3 Feb 2023 10:48:23 -0500 Subject: [PATCH 390/886] Update libraries.md (#3638) --- website_docs/libraries.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 5e069a26de3..4a90ef7f388 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -86,7 +86,8 @@ Connecting manual instrumentation you write in your app with instrumentation gen ## Available packages -A full list of instrumentation libraries available can be found in the [OpenTelemetry registry](/registry/?language=go&component=instrumentation). +A full list of instrumentation libraries available can be found in the +[OpenTelemetry registry](/ecosystem/registry/?language=go&component=instrumentation). ## Next steps From d3986efdb7740792ff253ecf4795d6ec190d9e33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 5 Feb 2023 07:56:39 -0800 Subject: [PATCH 391/886] Bump github.com/golangci/golangci-lint in /internal/tools (#3676) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.50.1 to 1.51.0. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.50.1...v1.51.0) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 55 ++++++++--------- internal/tools/go.sum | 133 +++++++++++++++++++++++------------------- 2 files changed, 101 insertions(+), 87 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 2b7a77d2226..aad0fa99997 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.50.1 + github.com/golangci/golangci-lint v1.51.0 github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -17,8 +17,9 @@ require ( ) require ( - 4d63.com/gochecknoglobals v0.1.0 // indirect - github.com/Abirdcfly/dupword v0.0.7 // indirect + 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect + 4d63.com/gochecknoglobals v0.2.1 // indirect + github.com/Abirdcfly/dupword v0.0.9 // indirect github.com/Antonboom/errname v0.1.7 // indirect github.com/Antonboom/nilnil v0.1.1 // indirect github.com/BurntSushi/toml v1.2.1 // indirect @@ -42,16 +43,16 @@ require ( github.com/butuzov/ireturn v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/charithe/durationcheck v0.0.9 // indirect - github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect + github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect github.com/cloudflare/circl v1.3.1 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.8.1 // indirect + github.com/daixiang0/gci v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect - github.com/fatih/color v1.13.0 // indirect + github.com/fatih/color v1.14.1 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -67,7 +68,7 @@ require ( github.com/go-toolsmith/astp v1.0.0 // indirect github.com/go-toolsmith/strparse v1.0.0 // indirect github.com/go-toolsmith/typep v1.0.2 // indirect - github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect + github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -77,7 +78,7 @@ require ( github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect - github.com/golangci/misspell v0.3.5 // indirect + github.com/golangci/misspell v0.4.0 // indirect github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect @@ -99,42 +100,43 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect + github.com/junk1tm/musttag v0.4.3 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect - github.com/kisielk/errcheck v1.6.2 // indirect + github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.3 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect - github.com/kyoh86/exportloopref v0.1.8 // indirect + github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect - github.com/ldez/tagliatelle v0.3.1 // indirect - github.com/leonklingele/grouper v1.1.0 // indirect + github.com/ldez/tagliatelle v0.4.0 // indirect + github.com/leonklingele/grouper v1.1.1 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.0 // indirect github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.2.4 // indirect + github.com/mgechev/revive v1.2.5 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.2.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.8.3 // indirect + github.com/nishanths/exhaustive v0.9.5 // indirect github.com/nishanths/predeclared v0.2.2 // indirect + github.com/nunnatsa/ginkgolinter v0.7.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect - github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.0.5 // indirect + github.com/polyfloyd/go-errorlint v1.0.6 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect @@ -144,21 +146,21 @@ require ( github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/ryancurrah/gomodguard v1.2.4 // indirect + github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.20.0 // indirect - github.com/securego/gosec/v2 v2.13.1 // indirect + github.com/sashamelentyev/usestdlibvars v1.21.1 // indirect + github.com/securego/gosec/v2 v2.14.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/sivchari/containedctx v1.0.2 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect - github.com/sivchari/tenv v1.7.0 // indirect + github.com/sivchari/tenv v1.7.1 // indirect github.com/skeema/knownhosts v1.1.0 // indirect github.com/sonatard/noctx v0.0.1 // indirect - github.com/sourcegraph/go-diff v0.6.1 // indirect + github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect @@ -170,9 +172,10 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.1 // indirect github.com/subosito/gotenv v1.4.1 // indirect + github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect - github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 // indirect + github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect github.com/timonwong/loggercheck v0.9.3 // indirect github.com/tomarrell/wrapcheck/v2 v2.7.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect @@ -189,7 +192,7 @@ require ( go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect + golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/sync v0.1.0 // indirect @@ -200,9 +203,9 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.3.3 // indirect + honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720 // indirect mvdan.cc/gofumpt v0.4.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 // indirect + mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 6f04d78c8ac..47e987acfd6 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1,5 +1,7 @@ -4d63.com/gochecknoglobals v0.1.0 h1:zeZSRqj5yCg28tCkIV/z/lWbwvNm5qnKVS15PI8nhD0= -4d63.com/gochecknoglobals v0.1.0/go.mod h1:wfdC5ZjKSPr7CybKEcgJhUOgeAQW1+7WcyK8OvUilfo= +4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= +4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= +4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= +4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -38,8 +40,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Abirdcfly/dupword v0.0.7 h1:z14n0yytA3wNO2gpCD/jVtp/acEXPGmYu0esewpBt6Q= -github.com/Abirdcfly/dupword v0.0.7/go.mod h1:K/4M1kj+Zh39d2aotRwypvasonOyAMH1c/IZJzE0dmk= +github.com/Abirdcfly/dupword v0.0.9 h1:MxprGjKq3yDBICXDgEEsyGirIXfMYXkLNT/agPsE1tk= +github.com/Abirdcfly/dupword v0.0.9/go.mod h1:PzmHVLLZ27MvHSzV7eFmMXSFArWXZPZmfuuziuUrf2g= github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= @@ -104,8 +106,8 @@ github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cb github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 h1:E7LT642ysztPWE0dfz43cWOvMiF42DyTRC+eZIaO4yI= -github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xfuwWPNKXlThldNuJvutYM6J95wNuuVmn55To= +github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 h1:cy5GCEZLUCshCGCRRUjxHrDUqkB4l5cuUt3ShEckQEo= +github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348/go.mod h1:f/miWtG3SSuTxKsNK3o58H1xl+XV6ZIfbC6p7lPPB8U= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -122,8 +124,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.8.1 h1:T4xpSC+hmsi4CSyuYfIJdMZAr9o7xZmHpQVygMghGZ4= -github.com/daixiang0/gci v0.8.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= +github.com/daixiang0/gci v0.9.0 h1:t8XZ0vK6l0pwPoOmoGyqW2NwQlvbpAQNVvu/GRBgykM= +github.com/daixiang0/gci v0.9.0/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -141,8 +143,8 @@ github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStB github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= +github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= @@ -196,8 +198,8 @@ github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUD github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= +github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= +github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= @@ -241,14 +243,14 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.50.1 h1:C829clMcZXEORakZlwpk7M4iDw2XiwxxKaG504SZ9zY= -github.com/golangci/golangci-lint v1.50.1/go.mod h1:AQjHBopYS//oB8xs0y0M/dtxdKHkdhl0RvmjUct0/4w= +github.com/golangci/golangci-lint v1.51.0 h1:M1bpDymgdaPKNzPwQdebCGki/nzvVkr2f/eUfk9C9oU= +github.com/golangci/golangci-lint v1.51.0/go.mod h1:7taIMcmZ5ksCuRruCV/mm8Ir3sE+bIuOHVCvt1B4hi4= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.3.5 h1:pLzmVdl3VxTOncgzHcvLOKirdvcx/TydsClUQXTehjo= -github.com/golangci/misspell v0.3.5/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/misspell v0.4.0 h1:KtVB/hTK4bbL/S6bs64rYyk8adjmh1BygbBiaAiX+a0= +github.com/golangci/misspell v0.4.0/go.mod h1:W6O/bwV6lGDxUCChm2ykw9NQdd5bYd1Xkjo88UcWyJc= github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= @@ -289,7 +291,6 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -351,11 +352,13 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/junk1tm/musttag v0.4.3 h1:I8UHQkDj2u/MClcGU8PbMoYwhykiSQFEbXKKMjixPyk= +github.com/junk1tm/musttag v0.4.3/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/errcheck v1.6.2 h1:uGQ9xI8/pgc9iOoCe7kWQgRE6SBTrCGmTSf0LrEtY7c= -github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= +github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM8= +github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= @@ -375,14 +378,14 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= -github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M= -github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= +github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= +github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKiM= -github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= -github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= -github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= +github.com/ldez/tagliatelle v0.4.0 h1:sylp7d9kh6AdXN2DpVGHBRb5guTVAgOxqNGhbqc4b1c= +github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= +github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= +github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= @@ -397,13 +400,11 @@ github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859 github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -412,8 +413,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.2.4 h1:+2Hd/S8oO2H0Ikq2+egtNwQsVhAeELHjxjIUFX5ajLI= -github.com/mgechev/revive v1.2.4/go.mod h1:iAWlQishqCuj4yhV24FTnKSXGpbAA+0SckXB8GQMX/Q= +github.com/mgechev/revive v1.2.5 h1:UF9AR8pOAuwNmhXj2odp4mxv9Nx2qUIwVz8ZsU+Mbec= +github.com/mgechev/revive v1.2.5/go.mod h1:nFOXent79jMTISAfOAasKfy0Z2Ejq0WX7Qn/KAdYopI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -432,14 +433,16 @@ github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4N github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.8.3 h1:pw5O09vwg8ZaditDp/nQRqVnrMczSJDxRDJMowvhsrM= -github.com/nishanths/exhaustive v0.8.3/go.mod h1:qj+zJJUgJ76tR92+25+03oYUhzF4R7/2Wk7fGTfCHmg= +github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACpzmGME= +github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/nunnatsa/ginkgolinter v0.7.1 h1:j4mzqx1hkE75mXHs3AUlWghZBi59c3GDWXp6zzcI+kE= +github.com/nunnatsa/ginkgolinter v0.7.1/go.mod h1:jTgd60EAdXDmmIPZi+xoMDqAYo/4AakhWNmnPisd7Rc= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= +github.com/onsi/ginkgo/v2 v2.3.1 h1:8SbseP7qM32WcvE6VaN6vfXxv698izmsJ1UQX9ve7T8= +github.com/onsi/gomega v1.22.1 h1:pY8O4lBfsHKZHM/6nrxkhVPUznOlIu3quZcKP/M20KI= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -450,8 +453,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= -github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -461,8 +462,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.0.5 h1:AHB5JRCjlmelh9RrLxT9sgzpalIwwq4hqE8EkwIwKdY= -github.com/polyfloyd/go-errorlint v1.0.5/go.mod h1:APVvOesVSAnne5SClsPxPdfvZTVDojXh1/G3qb5wjGI= +github.com/polyfloyd/go-errorlint v1.0.6 h1:ZevdyEGxDoHAMQUVvdTT06hnYuKULe8TQkOmIYx6s1c= +github.com/polyfloyd/go-errorlint v1.0.6/go.mod h1:NcnNncnm8fVV7vfQWiI4HZrzWFzGp24C262IQutNcMs= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -507,18 +508,18 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryancurrah/gomodguard v1.2.4 h1:CpMSDKan0LtNGGhPrvupAoLeObRFjND8/tU1rEOtBp4= -github.com/ryancurrah/gomodguard v1.2.4/go.mod h1:+Kem4VjWwvFpUJRJSwa16s1tBJe+vbv02+naTow2f6M= +github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= +github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.20.0 h1:K6CXjqqtSYSsuyRDDC7Sjn6vTMLiSJa4ZmDkiokoqtw= -github.com/sashamelentyev/usestdlibvars v1.20.0/go.mod h1:0GaP+ecfZMXShS0A94CJn6aEuPRILv8h/VuWI9n1ygg= -github.com/securego/gosec/v2 v2.13.1 h1:7mU32qn2dyC81MH9L2kefnQyRMUarfDER3iQyMHcjYM= -github.com/securego/gosec/v2 v2.13.1/go.mod h1:EO1sImBMBWFjOTFzMWfTRrZW6M15gm60ljzrmy/wtHo= +github.com/sashamelentyev/usestdlibvars v1.21.1 h1:GQGlReyL9Ek8DdJmwtwhHbhwHnuPfsKaprpjnrPcjxc= +github.com/sashamelentyev/usestdlibvars v1.21.1/go.mod h1:MPI52Qq99iO9sFZZcKJ2y/bx6BNjs+/2bw3PCggIbew= +github.com/securego/gosec/v2 v2.14.0 h1:U1hfs0oBackChXA72plCYVA4cOlQ4gO+209dHiSNZbI= +github.com/securego/gosec/v2 v2.14.0/go.mod h1:Ff03zEi5NwSOfXj9nFpBfhbWTtROCkg9N+9goggrYn4= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -536,14 +537,14 @@ github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYI github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= -github.com/sivchari/tenv v1.7.0 h1:d4laZMBK6jpe5PWepxlV9S+LC0yXqvYHiq8E6ceoVVE= -github.com/sivchari/tenv v1.7.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= +github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= +github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= -github.com/sourcegraph/go-diff v0.6.1 h1:hmA1LzxW0n1c3Q4YbrFgg4P99GSnebYa3x8gr0HZqLQ= -github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= +github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1 h1:FEIBISvqa2IsyC4KQQBQ1Ef2QvweGUgEIjCdE3gz+zs= +github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= @@ -578,6 +579,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= +github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -586,8 +589,8 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= -github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo= +github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= github.com/tomarrell/wrapcheck/v2 v2.7.0 h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA= @@ -652,6 +655,7 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= @@ -668,8 +672,9 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 h1:Ic/qN6TEifvObMGQy72k0n1LlJr7DjWWEi+MOsDOiSk= golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE= +golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -697,6 +702,7 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -740,7 +746,9 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -786,7 +794,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -816,7 +823,6 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -830,6 +836,7 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= @@ -837,8 +844,11 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -848,6 +858,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -863,7 +874,6 @@ golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -903,7 +913,6 @@ golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200622203043-20e05c1c8ffa/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -915,7 +924,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -934,6 +942,9 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1063,16 +1074,16 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.3.3 h1:oDx7VAwstgpYpb3wv0oxiZlxY+foCpRAwY7Vk6XpAgA= -honnef.co/go/tools v0.3.3/go.mod h1:jzwdWgg7Jdq75wlfblQxO4neNaFFSvgc1tD5Wv8U0Yw= +honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720 h1:L3lQbXWMmkBfyGXTvipQVmLXSM5SsT/39qcf+0RBIlQ= +honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720/go.mod h1:lbrxuU0wR28B7d2OiCxa+DVcNWwTjaY3RfXQNu3r10U= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20220706161116-678bad134442 h1:seuXWbRB1qPrS3NQnHmFKLJLtskWyueeIzmLXghMGgk= -mvdan.cc/unparam v0.0.0-20220706161116-678bad134442/go.mod h1:F/Cxw/6mVrNKqrR2YjFf5CaW0Bw4RL8RfbEf4GRggJk= +mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= +mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 0446207a380c3dae0091a1d636187ac7d178e705 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 6 Feb 2023 09:41:41 -0800 Subject: [PATCH 392/886] Add funcs to semconv to create semantic convention KeyValues (#3675) * Add semconv KeyValue funcs * Add changes to changelog * Variadic slice func parameters --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 5 + semconv/template.j2 | 80 +- semconv/v1.17.0/resource.go | 1380 +++++++++++++++++---- semconv/v1.17.0/trace.go | 2291 +++++++++++++++++++++++++++++------ 4 files changed, 3097 insertions(+), 659 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4421f129059..4f9c62f896f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. + These functions ensure semantic convention type correctness. + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) diff --git a/semconv/template.j2 b/semconv/template.j2 index 1d51bddb2bf..8d20a41d50d 100644 --- a/semconv/template.j2 +++ b/semconv/template.j2 @@ -1,16 +1,39 @@ -{%- macro to_go_attr_type(type, val) -%} +{%- macro keyval_method(type) -%} {%- if type == "string" -%} - String("{{val}}") + String + {%- elif type == "string[]" -%} + StringSlice {%- elif type == "int" -%} - Int({{val}}) + Int + {%- elif type == "int[]" -%} + IntSlice + {%- elif type == "double" -%} + Float64 + {%- elif type == "double[]" -%} + Float64Slice + {%- elif type == "boolean" -%} + Bool + {%- elif type == "boolean[]" -%} + BoolSlice {%- endif -%} {%- endmacro -%} +{%- macro to_go_attr_type(type, val) -%} +{{keyval_method(type)}}({% if type == "string" %}"{{val}}"{% else %}{{val}}{% endif %}) +{%- endmacro -%} {%- macro to_go_name(fqn) -%} {{fqn | replace(".", " ") | replace("_", " ") | title | replace(" ", "")}} {%- endmacro -%} -{%- macro godoc(attr) -%} -{{ attr.brief }} -// +{%- macro it_reps(brief) -%} +It represents {% if brief[:2] == "A " or brief[:3] == "An " or brief[:4] == "The " -%} + {{ brief[0]|lower }}{{ brief[1:] }} +{%- else -%} + the {{ brief[0]|lower }}{{ brief[1:] }} +{%- endif -%} +{%- endmacro -%} +{%- macro keydoc(attr) -%} +{{ to_go_name(attr.fqn) }}Key is the attribute Key conforming to the "{{ attr.fqn }}" semantic conventions. {{ it_reps(attr.brief) }} +{%- endmacro -%} +{%- macro keydetails(attr) -%} {%- if attr.attr_type is string %} Type: {{ attr.attr_type }} {%- else %} @@ -38,6 +61,33 @@ Examples: {{ attr.examples | pprint | trim("[]") }} Note: {{ attr.note }} {%- endif %} {%- endmacro -%} +{%- macro fndoc(attr) -%} +// {{ to_go_name(attr.fqn) }} returns an attribute KeyValue conforming to the "{{ attr.fqn }}" semantic conventions. {{ it_reps(attr.brief) }} +{%- endmacro -%} +{%- macro to_go_func(type, name) -%} +{%- if type == "string" -%} +func {{name}}(val string) attribute.KeyValue { +{%- elif type == "string[]" -%} +func {{name}}(val ...string) attribute.KeyValue { +{%- elif type == "int" -%} +func {{name}}(val int) attribute.KeyValue { +{%- elif type == "int[]" -%} +func {{name}}(val ...int) attribute.KeyValue { +{%- elif type == "double" -%} +func {{name}}(val float64) attribute.KeyValue { +{%- elif type == "double[]" -%} +func {{name}}(val ...float64) attribute.KeyValue { +{%- elif type == "boolean" -%} +func {{name}}(val bool) attribute.KeyValue { +{%- elif type == "boolean[]" -%} +func {{name}}(val ...bool) attribute.KeyValue { +{%- endif -%} + return {{name}}Key.{{keyval_method(type)}}(val) +} +{%- endmacro -%} +{%- macro sentence_case(text) -%} + {{ text[0]|upper}}{{text[1:] }} +{%- endmacro -%} // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -60,12 +110,13 @@ import "go.opentelemetry.io/otel/attribute" {% for semconv in semconvs -%} {%- if semconvs[semconv].attributes | rejectattr("ref") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%} -// {{ semconvs[semconv].brief }} +// {{ sentence_case(semconvs[semconv].brief | replace("This document defines ", "")) | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }} const ( -{% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} - // {{ godoc(attr) | wordwrap | indent(3) | replace(" ", "\t// ") | replace("// //", "//") }} - {{to_go_name(attr.fqn)}}Key = attribute.Key("{{attr.fqn}}") -{% endfor %} +{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref %} + // {{ keydoc(attr) | wordwrap(72, break_long_words=false, break_on_hyphens=false, wrapstring="\n\t// ") }} + // {{ keydetails(attr) | wordwrap(72, break_long_words=false, break_on_hyphens=false, wrapstring="\n\t// ") }} + {{to_go_name(attr.fqn)}}Key = attribute.Key("{{attr.fqn}}") +{% endfor -%} ) {%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} {%- if attr.attr_type is not string %} @@ -78,6 +129,13 @@ var ( ) {%- endif -%} {%- endfor %} +{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} +{%- if attr.attr_type is string %} + +{{ fndoc(attr) | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }} +{{to_go_func(attr.attr_type, to_go_name(attr.fqn))}} +{%- endif -%} +{%- endfor %} {% endif %} {% endfor -%} diff --git a/semconv/v1.17.0/resource.go b/semconv/v1.17.0/resource.go index add7987a22b..39a2eab3a6a 100644 --- a/semconv/v1.17.0/resource.go +++ b/semconv/v1.17.0/resource.go @@ -18,9 +18,14 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" import "go.opentelemetry.io/otel/attribute" -// The web browser in which the application represented by the resource is running. The `browser.*` attributes MUST be used only for resources that represent applications running in a web browser (regardless of whether running on a mobile or desktop device). +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). const ( - // Array of brand name and version separated by a space + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space // // Type: string[] // RequirementLevel: Optional @@ -30,7 +35,10 @@ const ( // API](https://wicg.github.io/ua-client-hints/#interface) // (`navigator.userAgentData.brands`). BrowserBrandsKey = attribute.Key("browser.brands") - // The platform on which the browser is running + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running // // Type: string // RequirementLevel: Optional @@ -39,39 +47,49 @@ const ( // Note: This value is intended to be taken from the [UA client hints // API](https://wicg.github.io/ua-client-hints/#interface) // (`navigator.userAgentData.platform`). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD - // be left unset in order for the values to be consistent. - // The list of possible values is defined in the [W3C User-Agent Client Hints + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). - // Note that some (but not all) of these values can overlap with values in the - // [`os.type` and `os.name` attributes](./os.md). However, for consistency, the - // values in the `browser.platform` attribute should capture the exact value that - // the user agent provides. + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. BrowserPlatformKey = attribute.Key("browser.platform") - // A boolean that is true if the browser is running on a mobile device + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device // // Type: boolean // RequirementLevel: Optional // Stability: stable // Note: This value is intended to be taken from the [UA client hints // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be - // left unset. + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. BrowserMobileKey = attribute.Key("browser.mobile") - // Full user-agent string provided by the browser + + // BrowserUserAgentKey is the attribute Key conforming to the + // "browser.user_agent" semantic conventions. It represents the full + // user-agent string provided by the browser // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 - // (KHTML, ' + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) + // AppleWebKit/537.36 (KHTML, ' // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' - // Note: The user-agent value SHOULD be provided only from browsers that do not - // have a mechanism to retrieve brands and platform individually from the User- - // Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` - // API can be used. + // Note: The user-agent value SHOULD be provided only from browsers that do + // not have a mechanism to retrieve brands and platform individually from + // the User-Agent Client Hints API. To retrieve the value, the legacy + // `navigator.userAgent` API can be used. BrowserUserAgentKey = attribute.Key("browser.user_agent") - // Preferred language of the user using the browser + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser // // Type: string // RequirementLevel: Optional @@ -82,46 +100,96 @@ const ( BrowserLanguageKey = attribute.Key("browser.language") ) +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserUserAgent returns an attribute KeyValue conforming to the +// "browser.user_agent" semantic conventions. It represents the full user-agent +// string provided by the browser +func BrowserUserAgent(val string) attribute.KeyValue { + return BrowserUserAgentKey.String(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + // A cloud environment (e.g. GCP, Azure, AWS) const ( - // Name of the cloud provider. + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. // // Type: Enum // RequirementLevel: Optional // Stability: stable CloudProviderKey = attribute.Key("cloud.provider") - // The cloud account ID the resource is assigned to. + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '111111111111', 'opentelemetry' CloudAccountIDKey = attribute.Key("cloud.account.id") - // The geographical region the resource is running. + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'us-central1', 'us-east-1' - // Note: Refer to your provider's docs to see the available regions, for example - // [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc- - // detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global- - // infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en- - // us/global-infrastructure/geographies/), [Google Cloud - // regions](https://cloud.google.com/about/locations), or [Tencent Cloud + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud // regions](https://intl.cloud.tencent.com/document/product/213/6091). CloudRegionKey = attribute.Key("cloud.region") - // Cloud regions often have multiple, isolated locations known as zones to - // increase availability. Availability zone represents the zone where the resource - // is running. + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'us-east-1c' - // Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - // The cloud platform in use. + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. // // Type: Enum // RequirementLevel: Optional @@ -201,49 +269,89 @@ var ( CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") ) +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + // Resources used by AWS Elastic Container Service (ECS). const ( - // The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws. - // amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'arn:aws:ecs:us- - // west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - // The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/develo - // perguide/clusters.html). + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - // The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/l - // aunch_types.html) for an ECS task. + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. // // Type: Enum // RequirementLevel: Optional // Stability: stable AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - // The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/lates - // t/developerguide/task_definitions.html). + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'arn:aws:ecs:us- - // west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - // The task definition family this task definition is a member of. + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'opentelemetry-family' AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - // The revision for this task definition. + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. // // Type: string // RequirementLevel: Optional @@ -259,9 +367,48 @@ var ( AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") ) +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + // Resources used by AWS Elastic Kubernetes Service (EKS). const ( - // The ARN of an EKS cluster. + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. // // Type: string // RequirementLevel: Optional @@ -270,83 +417,142 @@ const ( AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") ) +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + // Resources specific to Amazon Web Services. const ( - // The name(s) of the AWS log group(s) an application is writing to. + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: '/aws/lambda/my-function', 'opentelemetry-service' - // Note: Multiple log groups must be supported for cases like multi-container - // applications, where a single application has sidecar containers, and each write - // to their own log group. + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - // The Amazon Resource Name(s) (ARN) of the AWS log group(s). + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). // // Type: string[] // RequirementLevel: Optional // Stability: stable - // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' // Note: See the [log group ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- - // access-control-overview-cwl.html#CWL_ARN_Format). + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - // The name(s) of the AWS log stream(s) an application is writing to. + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") - // The ARN(s) of the AWS log stream(s). + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). // // Type: string[] // RequirementLevel: Optional // Stability: stable - // Examples: 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log- - // stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' // Note: See the [log stream ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam- - // access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain - // several log streams, so these ARNs necessarily identify both a log group and a - // log stream. + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") ) +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + // A container instance. const ( - // Container name used by container runtime. + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'opentelemetry-autoconf' ContainerNameKey = attribute.Key("container.name") - // Container ID. Usually a UUID, as for example used to [identify Docker - // containers](https://docs.docker.com/engine/reference/run/#container- - // identification). The UUID might be abbreviated. + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'a3bf90e006b2' ContainerIDKey = attribute.Key("container.id") - // The container runtime managing this container. + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'docker', 'containerd', 'rkt' ContainerRuntimeKey = attribute.Key("container.runtime") - // Name of the image the container was built on. + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'gcr.io/opentelemetry/operator' ContainerImageNameKey = attribute.Key("container.image.name") - // Container image tag. + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. // // Type: string // RequirementLevel: Optional @@ -355,9 +561,48 @@ const ( ContainerImageTagKey = attribute.Key("container.image.tag") ) +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + // The software deployment. const ( - // Name of the [deployment + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka // deployment tier). // @@ -368,46 +613,67 @@ const ( DeploymentEnvironmentKey = attribute.Key("deployment.environment") ) +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + // The device on which the process represented by this resource is running. const ( - // A unique identifier representing the device + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' - // Note: The device identifier MUST only be defined using the values outlined - // below. This value is not an advertising identifier and MUST NOT be used as - // such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor id - // entifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-iden - // tifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the - // Firebase Installation ID or a globally unique UUID which is persisted across + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across // sessions in your application. More information can be found - // [here](https://developer.android.com/training/articles/user-data-ids) on best - // practices and exact implementation details. Caution should be taken when - // storing personal data or anything which can identify a user. GDPR and data - // protection laws may apply, ensure you do your own due diligence. + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. DeviceIDKey = attribute.Key("device.id") - // The model identifier for the device + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'iPhone3,4', 'SM-G920F' - // Note: It's recommended this value represents a machine readable version of the - // model identifier rather than the market or consumer-friendly name of the - // device. + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - // The marketing name for the device model + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' - // Note: It's recommended this value represents a human readable version of the - // device model rather than a machine readable alternative. + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. DeviceModelNameKey = attribute.Key("device.model.name") - // The name of the device manufacturer + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer // // Type: string // RequirementLevel: Optional @@ -419,25 +685,57 @@ const ( DeviceManufacturerKey = attribute.Key("device.manufacturer") ) +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + // A serverless instance. const ( - // The name of the single function that this runtime instance executes. + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'my-function', 'myazurefunctionapp/some-function-name' - // Note: This is the name of the function as configured/deployed on the FaaS + // Note: This is the name of the function as configured/deployed on the + // FaaS // platform and is usually different from the name of the callback // function (which may be stored in the - // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span- - // general.md#source-code-attributes) + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) // span attributes). - - // For some cloud providers, the above definition is ambiguous. The following + // + // For some cloud providers, the above definition is ambiguous. The + // following // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud providers/products: - + // (and consequently the span name) for the listed cloud + // providers/products: + // // * **Azure:** The full name `/`, i.e., function app name // followed by a forward slash followed by the function name (this form // can also be seen in the resource JSON for the function). @@ -445,61 +743,67 @@ const ( // app can host multiple functions that would usually share // a TracerProvider (see also the `faas.id` attribute). FaaSNameKey = attribute.Key("faas.name") - // The unique ID of the single function that this runtime instance executes. + + // FaaSIDKey is the attribute Key conforming to the "faas.id" semantic + // conventions. It represents the unique ID of the single function that + // this runtime instance executes. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' - // Note: On some cloud providers, it may not be possible to determine the full ID - // at startup, + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, // so consider setting `faas.id` as a span attribute instead. - + // // The exact value to use for `faas.id` depends on the cloud provider: - + // // * **AWS Lambda:** The function - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and- - // namespaces.html). + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). // Take care not to use the "invoked ARN" directly but replace any - // [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration- - // aliases.html) - // with the resolved function version, as the same runtime instance may be - // invokable with + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with // multiple different aliases. - // * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full- - // resource-names) - // * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en- - // us/rest/api/resources/resources/get-by-id) of the invoked function, + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, // *not* the function app, having the form - // `/subscriptions//resourceGroups//providers/Microsoft.We - // b/sites//functions/`. - // This means that a span attribute MUST be used, as an Azure function app can - // host multiple functions that would usually share + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share // a TracerProvider. FaaSIDKey = attribute.Key("faas.id") - // The immutable version of the function being executed. + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '26', 'pinkfroid-00002' // Note: Depending on the cloud provider and platform, use: - + // // * **AWS Lambda:** The [function - // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration- - // versions.html) + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) // (an integer represented as a decimal string). // * **Google Cloud Run:** The // [revision](https://cloud.google.com/run/docs/managing/revisions) // (i.e., the function name plus the revision suffix). // * **Google Cloud Functions:** The value of the // [`K_REVISION` environment - // variable](https://cloud.google.com/functions/docs/env- - // var#runtime_environment_variables_set_automatically). + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). // * **Azure Functions:** Not applicable. Do not set this attribute. FaaSVersionKey = attribute.Key("faas.version") - // The execution environment ID as a string, that will be potentially reused for - // other invocations to the same function/function version. + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. // // Type: string // RequirementLevel: Optional @@ -507,67 +811,125 @@ const ( // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' // Note: * **AWS Lambda:** Use the (full) log stream name. FaaSInstanceKey = attribute.Key("faas.instance") - // The amount of memory available to the serverless function in MiB. + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function in MiB. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 128 - // Note: It's recommended to set this attribute since e.g. too little memory can - // easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, - // the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this - // information. + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. FaaSMaxMemoryKey = attribute.Key("faas.max_memory") ) +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSID returns an attribute KeyValue conforming to the "faas.id" semantic +// conventions. It represents the unique ID of the single function that this +// runtime instance executes. +func FaaSID(val string) attribute.KeyValue { + return FaaSIDKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function in MiB. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + // A host is defined as a general computing instance. const ( - // Unique host ID. For Cloud, this must be the instance_id assigned by the cloud - // provider. For non-containerized Linux systems, the `machine-id` located in - // `/etc/machine-id` or `/var/lib/dbus/machine-id` may be used. + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // Linux systems, the `machine-id` located in `/etc/machine-id` or + // `/var/lib/dbus/machine-id` may be used. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'fdbf79e8af94cb7f9e8df36789187052' HostIDKey = attribute.Key("host.id") - // Name of the host. On Unix systems, it may contain what the hostname command - // returns, or the fully qualified hostname, or another name specified by the - // user. + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'opentelemetry-test' HostNameKey = attribute.Key("host.name") - // Type of host. For Cloud, this must be the machine type. + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'n1-standard-1' HostTypeKey = attribute.Key("host.type") - // The CPU architecture the host system is running on. + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. // // Type: Enum // RequirementLevel: Optional // Stability: stable HostArchKey = attribute.Key("host.arch") - // Name of the VM image or OS install the host was instantiated from. + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' HostImageNameKey = attribute.Key("host.image.name") - // VM image ID. For Cloud, this value is from the provider. + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'ami-07b06b442921831e5' HostImageIDKey = attribute.Key("host.image.id") - // The version string of the VM image as defined in [Version + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version // Attributes](README.md#version-attributes). // // Type: string @@ -596,9 +958,57 @@ var ( HostArchX86 = HostArchKey.String("x86") ) +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized Linux +// systems, the `machine-id` located in `/etc/machine-id` or +// `/var/lib/dbus/machine-id` may be used. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + // A Kubernetes Cluster. const ( - // The name of the cluster. + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. // // Type: string // RequirementLevel: Optional @@ -607,16 +1017,26 @@ const ( K8SClusterNameKey = attribute.Key("k8s.cluster.name") ) +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + // A Kubernetes Node object. const ( - // The name of the Node. + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'node-1' K8SNodeNameKey = attribute.Key("k8s.node.name") - // The UID of the Node. + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. // // Type: string // RequirementLevel: Optional @@ -625,9 +1045,23 @@ const ( K8SNodeUIDKey = attribute.Key("k8s.node.uid") ) +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + // A Kubernetes Namespace. const ( - // The name of the namespace that the pod is running in. + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. // // Type: string // RequirementLevel: Optional @@ -636,16 +1070,26 @@ const ( K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") ) +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + // A Kubernetes Pod object. const ( - // The UID of the Pod. + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SPodUIDKey = attribute.Key("k8s.pod.uid") - // The name of the Pod. + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. // // Type: string // RequirementLevel: Optional @@ -654,19 +1098,37 @@ const ( K8SPodNameKey = attribute.Key("k8s.pod.name") ) -// A container in a [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). const ( - // The name of the Container from Pod specification, must be unique within a Pod. - // Container runtime usually uses different globally unique name - // (`container.name`). + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'redis' K8SContainerNameKey = attribute.Key("k8s.container.name") - // Number of times the container was restarted. This attribute can be used to - // identify a particular container (running or stopped) within a container spec. + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. // // Type: int // RequirementLevel: Optional @@ -675,16 +1137,37 @@ const ( K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") ) +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + // A Kubernetes ReplicaSet object. const ( - // The UID of the ReplicaSet. + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - // The name of the ReplicaSet. + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. // // Type: string // RequirementLevel: Optional @@ -693,16 +1176,35 @@ const ( K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") ) +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + // A Kubernetes Deployment object. const ( - // The UID of the Deployment. + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - // The name of the Deployment. + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. // // Type: string // RequirementLevel: Optional @@ -711,16 +1213,35 @@ const ( K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") ) +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + // A Kubernetes StatefulSet object. const ( - // The UID of the StatefulSet. + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") - // The name of the StatefulSet. + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. // // Type: string // RequirementLevel: Optional @@ -729,16 +1250,35 @@ const ( K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") ) +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + // A Kubernetes DaemonSet object. const ( - // The UID of the DaemonSet. + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - // The name of the DaemonSet. + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. // // Type: string // RequirementLevel: Optional @@ -747,16 +1287,33 @@ const ( K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") ) +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + // A Kubernetes Job object. const ( - // The UID of the Job. + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SJobUIDKey = attribute.Key("k8s.job.uid") - // The name of the Job. + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. // // Type: string // RequirementLevel: Optional @@ -765,16 +1322,33 @@ const ( K8SJobNameKey = attribute.Key("k8s.job.name") ) +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + // A Kubernetes CronJob object. const ( - // The UID of the CronJob. + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - // The name of the CronJob. + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. // // Type: string // RequirementLevel: Optional @@ -783,30 +1357,55 @@ const ( K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") ) -// The operating system (OS) on which the process represented by this resource is running. +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. const ( - // The operating system type. + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. // // Type: Enum // RequirementLevel: Required // Stability: stable OSTypeKey = attribute.Key("os.type") - // Human readable (not intended to be parsed) OS version information, like e.g. - // reported by `ver` or `lsb_release -a` commands. + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS' + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' OSDescriptionKey = attribute.Key("os.description") - // Human readable operating system name. + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'iOS', 'Android', 'Ubuntu' OSNameKey = attribute.Key("os.name") - // The version string of the operating system as defined in [Version + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version // Attributes](../../resource/semantic_conventions/README.md#version-attributes). // // Type: string @@ -841,71 +1440,120 @@ var ( OSTypeZOS = OSTypeKey.String("z_os") ) +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + // An operating system process. const ( - // Process identifier (PID). + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 1234 ProcessPIDKey = attribute.Key("process.pid") - // Parent Process identifier (PID). + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 111 ProcessParentPIDKey = attribute.Key("process.parent_pid") - // The name of the process executable. On Linux based systems, can be set to the - // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of - // `GetProcessImageFileNameW`. + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. // // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) // Stability: stable // Examples: 'otelcol' ProcessExecutableNameKey = attribute.Key("process.executable.name") - // The full path to the process executable. On Linux based systems, can be set to + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to // the target of `proc/[pid]/exe`. On Windows, can be set to the result of // `GetProcessImageFileNameW`. // // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) // Stability: stable // Examples: '/usr/bin/cmd/otelcol' ProcessExecutablePathKey = attribute.Key("process.executable.path") - // The command used to launch the process (i.e. the command name). On Linux based - // systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, - // can be set to the first parameter extracted from `GetCommandLineW`. + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. // // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) // Stability: stable // Examples: 'cmd/otelcol' ProcessCommandKey = attribute.Key("process.command") - // The full command used to launch the process as a single string representing the - // full command. On Windows, can be set to the result of `GetCommandLineW`. Do not - // set this if you have to assemble it just for monitoring; use + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use // `process.command_args` instead. // // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) // Stability: stable // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' ProcessCommandLineKey = attribute.Key("process.command_line") - // All the command arguments (including the command/executable itself) as received + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received // by the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited strings - // extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be - // the full argv vector passed to `main`. + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. // // Type: string[] - // RequirementLevel: ConditionallyRequired (See alternative attributes below.) + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) // Stability: stable // Examples: 'cmd/otecol', '--config=config.yaml' ProcessCommandArgsKey = attribute.Key("process.command_args") - // The username of the user that owns the process. + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. // // Type: string // RequirementLevel: Optional @@ -914,25 +1562,101 @@ const ( ProcessOwnerKey = attribute.Key("process.owner") ) +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + // The single (language) runtime instance which is monitored. const ( - // The name of the runtime of this process. For compiled native binaries, this - // SHOULD be the name of the compiler. + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'OpenJDK Runtime Environment' ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - // The version of the runtime of this process, as returned by the runtime without - // modification. + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '14.0.2' ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - // An additional description about the runtime of the process, for example a + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a // specific vendor customization of the runtime environment. // // Type: string @@ -942,35 +1666,68 @@ const ( ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") ) +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + // A service instance. const ( - // Logical name of the service. + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'shoppingcart' - // Note: MUST be the same for all instances of horizontally scaled services. If - // the value was not specified, SDKs MUST fallback to `unknown_service:` - // concatenated with [`process.executable.name`](process.md#process), e.g. - // `unknown_service:bash`. If `process.executable.name` is not available, the - // value MUST be set to `unknown_service`. + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. ServiceNameKey = attribute.Key("service.name") - // A namespace for `service.name`. + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'Shop' - // Note: A string value having a meaning that helps to distinguish a group of - // services, for example the team name that owns a group of services. + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` is - // expected to be unique for all services that have no explicit namespace defined - // (so the empty/unspecified namespace is simply one more valid namespace). Zero- - // length namespace string is assumed equal to unspecified namespace. + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. ServiceNamespaceKey = attribute.Key("service.namespace") - // The string ID of the service instance. + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. // // Type: string // RequirementLevel: Optional @@ -978,18 +1735,22 @@ const ( // Examples: '627cc493-f310-47de-96bd-71410b7dec09' // Note: MUST be unique for each instance of the same // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be globally - // unique). The ID helps to distinguish instances of the same service that exist - // at the same time (e.g. instances of a horizontally scaled service). It is - // preferable for the ID to be persistent and stay the same for the lifetime of - // the service instance, however it is acceptable that the ID is ephemeral and - // changes during important lifetime events for the service (e.g. service - // restarts). If the service has no inherent unique ID that can be used as the - // value of this attribute it is recommended to generate a random Version 1 or - // Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use // Version 5, see RFC 4122 for more recommendations). ServiceInstanceIDKey = attribute.Key("service.instance.id") - // The version string of the service API or implementation. + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. // // Type: string // RequirementLevel: Optional @@ -998,29 +1759,69 @@ const ( ServiceVersionKey = attribute.Key("service.version") ) -// The telemetry SDK used to capture data recorded by the instrumentation libraries. +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. const ( - // The name of the telemetry SDK as defined above. + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'opentelemetry' TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - // The language of the telemetry SDK. + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. // // Type: Enum // RequirementLevel: Optional // Stability: stable TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - // The version string of the telemetry SDK. + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '1.2.3' TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") - // The version string of the auto instrumentation agent, if used. + + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. // // Type: string // RequirementLevel: Optional @@ -1054,43 +1855,100 @@ var ( TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") ) -// Resource describing the packaged software running the application code. Web engines are typically executed using process.runtime. +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. const ( - // The name of the web engine. + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'WildFly' WebEngineNameKey = attribute.Key("webengine.name") - // The version of the web engine. + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '21.0.0' WebEngineVersionKey = attribute.Key("webengine.version") - // Additional description of the web engine (e.g. detailed version and edition - // information). + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final' + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' WebEngineDescriptionKey = attribute.Key("webengine.description") ) -// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. const ( - // The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // OtelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'io.opentelemetry.contrib.mongodb' OtelScopeNameKey = attribute.Key("otel.scope.name") - // The version of the instrumentation scope - (`InstrumentationScope.Version` in - // OTLP). + + // OtelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). // // Type: string // RequirementLevel: Optional @@ -1099,16 +1957,36 @@ const ( OtelScopeVersionKey = attribute.Key("otel.scope.version") ) -// Span attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +// OtelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OtelScopeName(val string) attribute.KeyValue { + return OtelScopeNameKey.String(val) +} + +// OtelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OtelScopeVersion(val string) attribute.KeyValue { + return OtelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. const ( - // Deprecated, use the `otel.scope.name` attribute. + // OtelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. // // Type: string // RequirementLevel: Optional // Stability: deprecated // Examples: 'io.opentelemetry.contrib.mongodb' OtelLibraryNameKey = attribute.Key("otel.library.name") - // Deprecated, use the `otel.scope.version` attribute. + + // OtelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. // // Type: string // RequirementLevel: Optional @@ -1116,3 +1994,17 @@ const ( // Examples: '1.0.0' OtelLibraryVersionKey = attribute.Key("otel.library.version") ) + +// OtelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OtelLibraryName(val string) attribute.KeyValue { + return OtelLibraryNameKey.String(val) +} + +// OtelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OtelLibraryVersion(val string) attribute.KeyValue { + return OtelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.17.0/trace.go b/semconv/v1.17.0/trace.go index 01e5f072a21..8c4a7299d27 100644 --- a/semconv/v1.17.0/trace.go +++ b/semconv/v1.17.0/trace.go @@ -18,27 +18,36 @@ package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" import "go.opentelemetry.io/otel/attribute" -// This document defines the shared attributes used to report a single exception associated with a span or log. +// The shared attributes used to report a single exception associated with a +// span or log. const ( - // The type of the exception (its fully-qualified class name, if applicable). The - // dynamic type of the exception should be preferred over the static type in - // languages that support it. + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'java.net.ConnectException', 'OSError' ExceptionTypeKey = attribute.Key("exception.type") - // The exception message. + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'Division by zero', "Can't convert 'int' object to str implicitly" + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" ExceptionMessageKey = attribute.Key("exception.message") - // A stacktrace as a string in the natural representation for the language - // runtime. The representation is to be determined and documented by each language - // SIG. + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. // // Type: string // RequirementLevel: Optional @@ -51,16 +60,44 @@ const ( ExceptionStacktraceKey = attribute.Key("exception.stacktrace") ) -// This document defines attributes for Events represented using Log Records. +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Attributes for Events represented using Log Records. const ( - // The name identifies the event. + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'click', 'exception' EventNameKey = attribute.Key("event.name") - // The domain identifies the business context for the events. + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. // // Type: Enum // RequirementLevel: Required @@ -79,11 +116,20 @@ var ( EventDomainK8S = EventDomainKey.String("k8s") ) -// Span attributes used by AWS Lambda (in addition to general `faas` attributes). +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). const ( - // The full invoked ARN as provided on the `Context` passed to the function - // (`Lambda-Runtime-Invoked-Function-ARN` header on the `/runtime/invocation/next` - // applicable). + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). // // Type: string // RequirementLevel: Optional @@ -93,44 +139,72 @@ const ( AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") ) -// This document defines attributes for CloudEvents. CloudEvents is a specification on how to define event data in a standard way. These attributes can be attached to spans when performing operations with CloudEvents, regardless of the protocol being used. +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. const ( - // The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec - // .md#id) uniquely identifies the event. + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") - // The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.m - // d#source-1) identifies the context in which an event happened. + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. // // Type: string // RequirementLevel: Required // Stability: stable - // Examples: 'https://github.com/cloudevents', '/cloudevents/spec/pull/123', 'my- - // service' + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") - // The [version of the CloudEvents specification](https://github.com/cloudevents/s - // pec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '1.0' CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - // The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/sp - // ec.md#type) contains a value describing the type of event related to the - // originating occurrence. + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'com.github.pull_request.opened', 'com.example.object.deleted.v2' + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") - // The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec. - // md#subject) of the event in the context of the event producer (identified by + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by // source). // // Type: string @@ -140,9 +214,53 @@ const ( CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") ) -// This document defines semantic conventions for the OpenTracing Shim +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim const ( - // Parent-child Reference type + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type // // Type: Enum // RequirementLevel: Optional @@ -158,16 +276,21 @@ var ( OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") ) -// This document defines the attributes used to perform database client calls. +// The attributes used to perform database client calls. const ( - // An identifier for the database management system (DBMS) product being used. See - // below for a list of well-known identifiers. + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. // // Type: Enum // RequirementLevel: Required // Stability: stable DBSystemKey = attribute.Key("db.system") - // The connection string used to connect to the database. It is recommended to + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to // remove embedded credentials. // // Type: string @@ -175,16 +298,21 @@ const ( // Stability: stable // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' DBConnectionStringKey = attribute.Key("db.connection_string") - // Username for accessing the database. + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'readonly_user', 'reporting_user' DBUserKey = attribute.Key("db.user") - // The fully-qualified class name of the [Java Database Connectivity - // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver - // used to connect. + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. // // Type: string // RequirementLevel: Optional @@ -192,41 +320,52 @@ const ( // Examples: 'org.postgresql.Driver', // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") - // This attribute is used to report the name of the database being accessed. For - // commands that switch the database, this should be set to the target database - // (even if the command fails). + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). // // Type: string // RequirementLevel: ConditionallyRequired (If applicable.) // Stability: stable // Examples: 'customers', 'main' - // Note: In some SQL databases, the database name to be used is called "schema - // name". In case there are multiple layers that could be considered for database - // name (e.g. Oracle instance name and schema name), the database name to be used - // is the more specific layer (e.g. Oracle schema name). + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). DBNameKey = attribute.Key("db.name") - // The database statement being executed. + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. // // Type: string - // RequirementLevel: ConditionallyRequired (If applicable and not explicitly - // disabled via instrumentation configuration.) + // RequirementLevel: ConditionallyRequired (If applicable and not + // explicitly disabled via instrumentation configuration.) // Stability: stable // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' // Note: The value may be sanitized to exclude sensitive information. DBStatementKey = attribute.Key("db.statement") - // The name of the operation being executed, e.g. the [MongoDB command + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command // name](https://docs.mongodb.com/manual/reference/command/#database-operations) // such as `findAndModify`, or the SQL keyword. // // Type: string - // RequirementLevel: ConditionallyRequired (If `db.statement` is not applicable.) + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) // Stability: stable // Examples: 'findAndModify', 'HMSET', 'SELECT' - // Note: When setting this to an SQL keyword, it is not recommended to attempt any - // client-side parsing of `db.statement` just to get this property, but it should - // be set if the operation name is provided by the library being instrumented. If - // the SQL statement has an ambiguous operation, or performs more than one - // operation, this value may be omitted. + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. DBOperationKey = attribute.Key("db.operation") ) @@ -331,73 +470,152 @@ var ( DBSystemClickhouse = DBSystemKey.String("clickhouse") ) +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + // Connection-level attributes for Microsoft SQL Server const ( - // The Microsoft SQL Server [instance name](https://docs.microsoft.com/en- - // us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) - // connecting to. This name is used to determine the port of a named instance. + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'MSSQLSERVER' - // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer - // required (but still recommended if non-standard). + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") ) +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + // Call-level attributes for Cassandra const ( - // The fetch size used for paging, i.e. how many rows will be returned at once. + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 5000 DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") - // The consistency level of the query. Based on consistency values from - // [CQL](https://docs.datastax.com/en/cassandra- - // oss/3.0/cassandra/dml/dmlConfigConsistency.html). + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). // // Type: Enum // RequirementLevel: Optional // Stability: stable DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") - // The name of the primary table that the operation is acting upon, including the - // keyspace name (if applicable). + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). // // Type: string // RequirementLevel: Recommended // Stability: stable // Examples: 'mytable' - // Note: This mirrors the db.sql.table attribute but references cassandra rather - // than sql. It is not recommended to attempt any client-side parsing of - // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting upon an - // anonymous table, or more than one table, this value MUST NOT be set. + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. DBCassandraTableKey = attribute.Key("db.cassandra.table") - // Whether or not the query is idempotent. + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. // // Type: boolean // RequirementLevel: Optional // Stability: stable DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") - // The number of times a query was speculatively executed. Not set or `0` if the - // query was not executed speculatively. + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 0, 2 DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") - // The ID of the coordinating node for a query. + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") - // The data center of the coordinating node for a query. + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. // // Type: string // RequirementLevel: Optional @@ -431,23 +649,80 @@ var ( DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") ) +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + // Call-level attributes for Redis const ( - // The index of the database being accessed as used in the [`SELECT` - // command](https://redis.io/commands/select), provided as an integer. To be used - // instead of the generic `db.name` attribute. + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. // // Type: int - // RequirementLevel: ConditionallyRequired (If other than the default database - // (`0`).) + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) // Stability: stable // Examples: 0, 1, 15 DBRedisDBIndexKey = attribute.Key("db.redis.database_index") ) +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + // Call-level attributes for MongoDB const ( - // The collection being accessed within the database stated in `db.name`. + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. // // Type: string // RequirementLevel: Required @@ -456,10 +731,19 @@ const ( DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") ) +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + // Call-level attributes for SQL databases const ( - // The name of the primary table that the operation is acting upon, including the - // database name (if applicable). + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). // // Type: string // RequirementLevel: Recommended @@ -467,21 +751,35 @@ const ( // Examples: 'public.users', 'customers' // Note: It is not recommended to attempt any client-side parsing of // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting upon an - // anonymous table, or more than one table, this value MUST NOT be set. + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. DBSQLTableKey = attribute.Key("db.sql.table") ) -// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's concepts. +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. const ( - // Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is + // OtelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is // UNSET. // // Type: Enum // RequirementLevel: Optional // Stability: stable OtelStatusCodeKey = attribute.Key("otel.status_code") - // Description of the Status if it has a value, otherwise not set. + + // OtelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. // // Type: string // RequirementLevel: Optional @@ -497,16 +795,27 @@ var ( OtelStatusCodeError = OtelStatusCodeKey.String("ERROR") ) -// This semantic convention describes an instance of a function that runs without provisioning or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with spans. +// OtelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OtelStatusDescription(val string) attribute.KeyValue { + return OtelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. const ( - // Type of the trigger which caused this function execution. + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function execution. // // Type: Enum // RequirementLevel: Optional // Stability: stable // Note: For the server/consumer span on the incoming side, // `faas.trigger` MUST be set. - + // // Clients invoking FaaS instances usually cannot set `faas.trigger`, // since they would typically need to look in the payload to determine // the event type. If clients set it, it should be the same as the @@ -514,7 +823,10 @@ const ( // nothing to do with the underlying transport used to make the API // call to invoke the lambda, which is often HTTP). FaaSTriggerKey = attribute.Key("faas.trigger") - // The execution ID of the current function execution. + + // FaaSExecutionKey is the attribute Key conforming to the "faas.execution" + // semantic conventions. It represents the execution ID of the current + // function execution. // // Type: string // RequirementLevel: Optional @@ -536,34 +848,53 @@ var ( FaaSTriggerOther = FaaSTriggerKey.String("other") ) -// Semantic Convention for FaaS triggered as a response to some data source operation such as a database or filesystem read/write. +// FaaSExecution returns an attribute KeyValue conforming to the +// "faas.execution" semantic conventions. It represents the execution ID of the +// current function execution. +func FaaSExecution(val string) attribute.KeyValue { + return FaaSExecutionKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. const ( - // The name of the source on which the triggering operation was performed. For - // example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos - // DB to the database name. + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'myBucketName', 'myDBName' FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - // Describes the type of the operation that was performed on the data. + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. // // Type: Enum // RequirementLevel: Required // Stability: stable FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - // A string containing the time when the data was accessed in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed - // in [UTC](https://www.w3.org/TR/NOTE-datetime). + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '2020-01-23T13:47:06Z' FaaSDocumentTimeKey = attribute.Key("faas.document.time") - // The document name/table subjected to the operation. For example, in Cloud - // Storage or S3 is the name of the file, and in Cosmos DB the table name. + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. // // Type: string // RequirementLevel: Optional @@ -581,19 +912,50 @@ var ( FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") ) +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + // Semantic Convention for FaaS scheduled to be executed regularly. const ( - // A string containing the function invocation time in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed - // in [UTC](https://www.w3.org/TR/NOTE-datetime). + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '2020-01-23T13:47:06Z' FaaSTimeKey = attribute.Key("faas.time") - // A string containing the schedule period as [Cron Expression](https://docs.oracl - // e.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). // // Type: string // RequirementLevel: Optional @@ -602,10 +964,28 @@ const ( FaaSCronKey = attribute.Key("faas.cron") ) +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + // Contains additional attributes for incoming FaaS spans. const ( - // A boolean that is true if the serverless function is executed for the first - // time (aka cold-start). + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). // // Type: boolean // RequirementLevel: Optional @@ -613,39 +993,54 @@ const ( FaaSColdstartKey = attribute.Key("faas.coldstart") ) +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + // Contains additional attributes for outgoing FaaS spans. const ( - // The name of the invoked function. + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'my-function' - // Note: SHOULD be equal to the `faas.name` resource attribute of the invoked - // function. + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - // The cloud provider of the invoked function. + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. // // Type: Enum // RequirementLevel: Required // Stability: stable - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked - // function. + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - // The cloud region of the invoked function. + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. // // Type: string - // RequirementLevel: ConditionallyRequired (For some cloud providers, like AWS or - // GCP, the region in which a function is hosted is essential to uniquely identify - // the function and also part of its endpoint. Since it's part of the endpoint - // being called, the region is always known to clients. In these cases, - // `faas.invoked_region` MUST be set accordingly. If the region is unknown to the - // client or not required for identifying the invoked function, setting - // `faas.invoked_region` is optional.) + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) // Stability: stable // Examples: 'eu-central-1' - // Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked - // function. + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") ) @@ -662,50 +1057,82 @@ var ( FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") ) +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + // These attributes may be used for any network related operation. const ( - // Transport protocol used. See note below. + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. // // Type: Enum // RequirementLevel: Optional // Stability: stable NetTransportKey = attribute.Key("net.transport") - // Application layer protocol used. The value SHOULD be normalized to lowercase. + + // NetAppProtocolNameKey is the attribute Key conforming to the + // "net.app.protocol.name" semantic conventions. It represents the + // application layer protocol used. The value SHOULD be normalized to + // lowercase. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'amqp', 'http', 'mqtt' NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") - // Version of the application layer protocol used. See note below. + + // NetAppProtocolVersionKey is the attribute Key conforming to the + // "net.app.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '3.1.1' - // Note: `net.app.protocol.version` refers to the version of the protocol used and - // might be different from the protocol client's version. If the HTTP client used - // has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should - // be set to `1.1`. + // Note: `net.app.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") - // Remote socket peer name. + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. // // Type: string - // RequirementLevel: Recommended (If available and different from `net.peer.name` - // and if `net.sock.peer.addr` is set.) + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) // Stability: stable // Examples: 'proxy.example.com' NetSockPeerNameKey = attribute.Key("net.sock.peer.name") - // Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local - // communication, [etc](https://man7.org/linux/man- - // pages/man7/address_families.7.html). + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '127.0.0.1', '/tmp/mysql.sock' NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") - // Remote socket peer port. + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. // // Type: int // RequirementLevel: Recommended (If defined for the address family and if @@ -713,56 +1140,77 @@ const ( // Stability: stable // Examples: 16456 NetSockPeerPortKey = attribute.Key("net.sock.peer.port") - // Protocol [address family](https://man7.org/linux/man- - // pages/man7/address_families.7.html) which is used for communication. + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. // // Type: Enum - // RequirementLevel: ConditionallyRequired (If different than `inet` and if any of - // `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers of telemetry - // SHOULD accept both IPv4 and IPv6 formats for the address in + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support // instrumentations that follow previous versions of this document.) // Stability: stable // Examples: 'inet6', 'bluetooth' NetSockFamilyKey = attribute.Key("net.sock.family") - // Logical remote hostname, see note below. + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'example.com' - // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra - // DNS lookup. + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. NetPeerNameKey = attribute.Key("net.peer.name") - // Logical remote port number + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 80, 8080, 443 NetPeerPortKey = attribute.Key("net.peer.port") - // Logical local hostname or similar, see note below. + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'localhost' NetHostNameKey = attribute.Key("net.host.name") - // Logical local port number, preferably the one that the peer used to connect + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 8080 NetHostPortKey = attribute.Key("net.host.port") - // Local socket address. Useful in case of a multi-IP host. + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '192.168.0.1' NetSockHostAddrKey = attribute.Key("net.sock.host.addr") - // Local socket port number. + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. // // Type: int // RequirementLevel: Recommended (If defined for the address family and if @@ -770,44 +1218,62 @@ const ( // Stability: stable // Examples: 35555 NetSockHostPortKey = attribute.Key("net.sock.host.port") - // The internet connection type currently being used by the host. + + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. // // Type: Enum // RequirementLevel: Optional // Stability: stable // Examples: 'wifi' NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") - // This describes more details regarding the connection.type. It may be the type - // of cell technology connection, but it could be used for describing details - // about a wifi connection. + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. // // Type: Enum // RequirementLevel: Optional // Stability: stable // Examples: 'LTE' NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") - // The name of the mobile carrier. + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'sprint' NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") - // The mobile carrier country code. + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '310' NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") - // The mobile carrier network code. + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '001' NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") - // The ISO 3166-1 alpha-2 2-character country code associated with the mobile + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile // carrier network. // // Type: string @@ -897,11 +1363,120 @@ var ( NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") ) +// NetAppProtocolName returns an attribute KeyValue conforming to the +// "net.app.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetAppProtocolName(val string) attribute.KeyValue { + return NetAppProtocolNameKey.String(val) +} + +// NetAppProtocolVersion returns an attribute KeyValue conforming to the +// "net.app.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetAppProtocolVersion(val string) attribute.KeyValue { + return NetAppProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + // Operations that access some remote service. const ( - // The [`service.name`](../../resource/semantic_conventions/README.md#service) of - // the remote service. SHOULD be equal to the actual `service.name` resource - // attribute of the remote service if any. + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. // // Type: string // RequirementLevel: Optional @@ -910,31 +1485,49 @@ const ( PeerServiceKey = attribute.Key("peer.service") ) -// These attributes may be used for any operation with an authenticated and/or authorized enduser. +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. const ( - // Username or client_id extracted from the access token or - // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the - // inbound request from outside the system. + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'username' EnduserIDKey = attribute.Key("enduser.id") - // Actual/assumed role the client is making the request under extracted from token - // or application security context. + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'admin' EnduserRoleKey = attribute.Key("enduser.role") - // Scopes or granted authorities the client currently possesses extracted from - // token or application security context. The value would come from the scope - // associated with an [OAuth 2.0 Access - // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value - // in a [SAML 2.0 Assertion](http://docs.oasis- - // open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). // // Type: string // RequirementLevel: Optional @@ -943,16 +1536,50 @@ const ( EnduserScopeKey = attribute.Key("enduser.scope") ) -// These attributes may be used for any operation to store information about a thread that started a span. +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. const ( - // Current "managed" thread ID (as opposed to OS thread ID). + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 42 ThreadIDKey = attribute.Key("thread.id") - // Current thread name. + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. // // Type: string // RequirementLevel: Optional @@ -961,43 +1588,70 @@ const ( ThreadNameKey = attribute.Key("thread.name") ) -// These attributes allow to report this unit of code and therefore to provide more context about the span. +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. const ( - // The method or function name, or equivalent (usually rightmost part of the code - // unit's name). + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'serveRequest' CodeFunctionKey = attribute.Key("code.function") - // The "namespace" within which `code.function` is defined. Usually the qualified - // class or module name, such that `code.namespace` + some separator + - // `code.function` form a unique identifier for the code unit. + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'com.example.MyHTTPService' CodeNamespaceKey = attribute.Key("code.namespace") - // The source code file name that identifies the code unit as uniquely as possible - // (preferably an absolute file path). + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '/usr/local/MyApplication/content_root/app/index.php' CodeFilepathKey = attribute.Key("code.filepath") - // The line number in `code.filepath` best representing the operation. It SHOULD - // point within the code unit named in `code.function`. + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 42 CodeLineNumberKey = attribute.Key("code.lineno") - // The column number in `code.filepath` best representing the operation. It SHOULD - // point within the code unit named in `code.function`. + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. // // Type: int // RequirementLevel: Optional @@ -1006,42 +1660,98 @@ const ( CodeColumnKey = attribute.Key("code.column") ) -// This document defines semantic conventions for HTTP client and server Spans. +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic conventions for HTTP client and server Spans. const ( - // HTTP request method. + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'GET', 'POST', 'HEAD' HTTPMethodKey = attribute.Key("http.method") - // [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). // // Type: int - // RequirementLevel: ConditionallyRequired (If and only if one was received/sent.) + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) // Stability: stable // Examples: 200 HTTPStatusCodeKey = attribute.Key("http.status_code") - // Kind of HTTP protocol used. + + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. It represents the kind of HTTP protocol used. // // Type: Enum // RequirementLevel: Optional // Stability: stable - // Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` - // except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + // Note: If `net.transport` is not specified, it can be assumed to be + // `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is + // assumed. HTTPFlavorKey = attribute.Key("http.flavor") - // Value of the [HTTP User-Agent](https://www.rfc- - // editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + + // HTTPUserAgentKey is the attribute Key conforming to the + // "http.user_agent" semantic conventions. It represents the value of the + // [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' HTTPUserAgentKey = attribute.Key("http.user_agent") - // The size of the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- - // length) header. For requests using transport encoding, this should be the + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the // compressed size. // // Type: int @@ -1049,10 +1759,14 @@ const ( // Stability: stable // Examples: 3495 HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") - // The size of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content- - // length) header. For requests using transport encoding, this should be the + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the // compressed size. // // Type: int @@ -1077,74 +1791,149 @@ var ( HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") ) +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPUserAgent returns an attribute KeyValue conforming to the +// "http.user_agent" semantic conventions. It represents the value of the [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func HTTPUserAgent(val string) attribute.KeyValue { + return HTTPUserAgentKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + // Semantic Convention for HTTP Client const ( - // Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. - // Usually the fragment is not transmitted over HTTP, but if it is known, it - // should be included nevertheless. + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' // Note: `http.url` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case the attribute's - // value should be `https://www.example.com/`. + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. HTTPURLKey = attribute.Key("http.url") - // The ordinal number of request resending attempt (for any reason, including + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including // redirects). // // Type: int // RequirementLevel: Recommended (if and only if request was retried.) // Stability: stable // Examples: 3 - // Note: The resend count SHOULD be updated each time an HTTP request gets resent - // by the client, regardless of what was the cause of the resending (e.g. - // redirection, authorization failure, 503 Server Unavailable, network issues, or - // any other). + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). HTTPResendCountKey = attribute.Key("http.resend_count") ) +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + // Semantic Convention for HTTP Server const ( - // The URI scheme identifying the used protocol. + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'http', 'https' HTTPSchemeKey = attribute.Key("http.scheme") - // The full request target as passed in a HTTP request line or equivalent. + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: '/path/12314/?q=ddds' HTTPTargetKey = attribute.Key("http.target") - // The matched route (path template in the format used by the respective server - // framework). See note below + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below // // Type: string // RequirementLevel: ConditionallyRequired (If and only if it's available) // Stability: stable // Examples: '/users/:userID?', '{controller}/{action}/{id?}' - // Note: 'http.route' MUST NOT be populated when this is not supported by the HTTP - // server framework as the route attribute should have low-cardinality and the URI - // path can NOT substitute it. + // Note: 'http.route' MUST NOT be populated when this is not supported by + // the HTTP server framework as the route attribute should have + // low-cardinality and the URI path can NOT substitute it. HTTPRouteKey = attribute.Key("http.route") - // The IP address of the original client behind all proxies, if known (e.g. from - // [X-Forwarded-For](https://developer.mozilla.org/en- - // US/docs/Web/HTTP/Headers/X-Forwarded-For)). + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '83.164.160.102' - // Note: This is not necessarily the same as `net.sock.peer.addr`, which would + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would // identify the network-level peer, which may be a proxy. - + // // This attribute should be set when a source of information different - // from the one used for `net.sock.peer.addr`, is available even if that other + // from the one used for `net.sock.peer.addr`, is available even if that + // other // source just confirms the same value as `net.sock.peer.addr`. // Rationale: For `net.sock.peer.addr`, one typically does not know if it // comes from a proxy, reverse proxy, or the actual client. Setting @@ -1154,89 +1943,155 @@ const ( HTTPClientIPKey = attribute.Key("http.client_ip") ) +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + // Attributes that exist for multiple DynamoDB request types. const ( - // The keys in the `RequestItems` object field. + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: 'Users', 'Cats' AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - // The JSON-serialized value of each item in the `ConsumedCapacity` response + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response // field. // // Type: string[] // RequirementLevel: Optional // Stability: stable - // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { "string" : { - // "CapacityUnits": number, "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }, "LocalSecondaryIndexes": { "string" : { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }, - // "ReadCapacityUnits": number, "Table": { "CapacityUnits": number, - // "ReadCapacityUnits": number, "WriteCapacityUnits": number }, "TableName": - // "string", "WriteCapacityUnits": number }' + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - // The JSON-serialized value of the `ItemCollectionMetrics` response field. + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": blob, - // "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { "string" : - // "AttributeValue" }, "N": "string", "NS": [ "string" ], "NULL": boolean, "S": - // "string", "SS": [ "string" ] } }, "SizeEstimateRangeGB": [ number ] } ] }' + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - // The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. // // Type: double // RequirementLevel: Optional // Stability: stable // Examples: 1.0, 2.0 AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - // The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. // // Type: double // RequirementLevel: Optional // Stability: stable // Examples: 1.0, 2.0 AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - // The value of the `ConsistentRead` request parameter. + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. // // Type: boolean // RequirementLevel: Optional // Stability: stable AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - // The value of the `ProjectionExpression` request parameter. + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. // // Type: string // RequirementLevel: Optional // Stability: stable - // Examples: 'Title', 'Title, Price, Color', 'Title, Description, RelatedItems, - // ProductReviews' + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - // The value of the `Limit` request parameter. + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 10 AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - // The value of the `AttributesToGet` request parameter. + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: 'lives', 'id' AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - // The value of the `IndexName` request parameter. + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'name_to_group' AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - // The value of the `Select` request parameter. + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. // // Type: string // RequirementLevel: Optional @@ -1245,42 +2100,148 @@ const ( AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") ) +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + // DynamoDB.CreateTable const ( - // The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request - // field + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field // // Type: string[] // RequirementLevel: Optional // Stability: stable - // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": "string", - // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], - // "ProjectionType": "string" }, "ProvisionedThroughput": { "ReadCapacityUnits": - // number, "WriteCapacityUnits": number } }' + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - // The JSON-serialized value of each item of the `LocalSecondaryIndexes` request - // field. + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. // // Type: string[] // RequirementLevel: Optional // Stability: stable - // Examples: '{ "IndexARN": "string", "IndexName": "string", "IndexSizeBytes": - // number, "ItemCount": number, "KeySchema": [ { "AttributeName": "string", - // "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ "string" ], - // "ProjectionType": "string" } }' + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") ) +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + // DynamoDB.ListTables const ( - // The value of the `ExclusiveStartTableName` request parameter. + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. // // Type: int // RequirementLevel: Optional @@ -1289,9 +2250,25 @@ const ( AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") ) +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + // DynamoDB.Query const ( - // The value of the `ScanIndexForward` request parameter. + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. // // Type: boolean // RequirementLevel: Optional @@ -1299,30 +2276,48 @@ const ( AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") ) +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + // DynamoDB.Scan const ( - // The value of the `Segment` request parameter. + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 10 AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - // The value of the `TotalSegments` request parameter. + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 100 AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") - // The value of the `Count` response parameter. + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 10 AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - // The value of the `ScannedCount` response parameter. + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. // // Type: int // RequirementLevel: Optional @@ -1331,18 +2326,51 @@ const ( AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") ) +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + // DynamoDB.UpdateTable const ( - // The JSON-serialized value of each item in the `AttributeDefinitions` request - // field. + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` - // request field. + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. // // Type: string[] // RequirementLevel: Optional @@ -1350,28 +2378,53 @@ const ( // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { // "AttributeName": "string", "KeyType": "string" } ], "Projection": { // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, "WriteCapacityUnits": - // number } }' + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") ) -// This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL operations to attributes on a Span. +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. const ( - // The name of the operation being executed. + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'findBookByID' GraphqlOperationNameKey = attribute.Key("graphql.operation.name") - // The type of the operation being executed. + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. // // Type: Enum // RequirementLevel: Optional // Stability: stable // Examples: 'query', 'mutation', 'subscription' GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") - // The GraphQL document being executed. + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. // // Type: string // RequirementLevel: Optional @@ -1390,34 +2443,62 @@ var ( GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") ) -// Semantic convention describing per-message attributes populated on messaging spans or links. +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. const ( - // A value used by the messaging system as an identifier for the message, - // represented as a string. + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '452a7c7c7c7048c2f887f61572b18fc2' MessagingMessageIDKey = attribute.Key("messaging.message.id") - // The [conversation ID](#conversations) identifying the conversation to which the - // message belongs, represented as a string. Sometimes called "Correlation ID". + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'MyConversationID' MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - // The (uncompressed) size of the message payload in bytes. Also use this - // attribute if it is unknown whether the compressed or uncompressed payload size - // is reported. + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 2738 MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") - // The compressed size of the message payload in bytes. + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. // // Type: int // RequirementLevel: Optional @@ -1426,44 +2507,94 @@ const ( MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") ) -// Semantic convention for attributes that describe messaging destination on broker +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker const ( - // The message destination name + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'MyQueue', 'MyTopic' - // Note: Destination name SHOULD uniquely identify a specific queue, topic or - // other entity within the broker. If - // the broker does not have such notion, the destination name SHOULD uniquely - // identify the broker. + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - // The kind of message destination + + // MessagingDestinationKindKey is the attribute Key conforming to the + // "messaging.destination.kind" semantic conventions. It represents the + // kind of message destination // // Type: Enum // RequirementLevel: Optional // Stability: stable MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") - // Low cardinality representation of the messaging destination name + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '/customers/{customerID}' - // Note: Destination names could be constructed from templates. An example would - // be a destination name involving a user name or product id. Although the - // destination name in this case is of high cardinality, the underlying template - // is of low cardinality and can be effectively used for grouping and aggregation. + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - // A boolean that is true if the message destination is temporary and might not - // exist anymore after messages are processed. + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. // // Type: boolean // RequirementLevel: Optional // Stability: stable MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - // A boolean that is true if the message destination is anonymous (could be + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be // unnamed or have auto-generated name). // // Type: boolean @@ -1479,45 +2610,90 @@ var ( MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") ) +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + // Semantic convention for attributes that describe messaging source on broker const ( - // The message source name + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'MyQueue', 'MyTopic' - // Note: Source name SHOULD uniquely identify a specific queue, topic, or other - // entity within the broker. If - // the broker does not have such notion, the source name SHOULD uniquely identify - // the broker. + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. MessagingSourceNameKey = attribute.Key("messaging.source.name") - // The kind of message source + + // MessagingSourceKindKey is the attribute Key conforming to the + // "messaging.source.kind" semantic conventions. It represents the kind of + // message source // // Type: Enum // RequirementLevel: Optional // Stability: stable MessagingSourceKindKey = attribute.Key("messaging.source.kind") - // Low cardinality representation of the messaging source name + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '/customers/{customerID}' - // Note: Source names could be constructed from templates. An example would be a - // source name involving a user name or product id. Although the source name in - // this case is of high cardinality, the underlying template is of low cardinality - // and can be effectively used for grouping and aggregation. + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. MessagingSourceTemplateKey = attribute.Key("messaging.source.template") - // A boolean that is true if the message source is temporary and might not exist - // anymore after messages are processed. + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. // // Type: boolean // RequirementLevel: Optional // Stability: stable MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") - // A boolean that is true if the message source is anonymous (could be unnamed or - // have auto-generated name). + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). // // Type: boolean // RequirementLevel: Optional @@ -1532,36 +2708,74 @@ var ( MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") ) -// This document defines general attributes used in messaging systems. +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// General attributes used in messaging systems. const ( - // A string identifying the messaging system. + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' MessagingSystemKey = attribute.Key("messaging.system") - // A string identifying the kind of messaging operation as defined in the - // [Operation names](#operation-names) section above. + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. // // Type: Enum // RequirementLevel: Required // Stability: stable // Note: If a custom value is used, it MUST be of low cardinality. MessagingOperationKey = attribute.Key("messaging.operation") - // The number of messages sent, received, or processed in the scope of the + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the // batching operation. // // Type: int - // RequirementLevel: ConditionallyRequired (If the span describes an operation on - // a batch of messages.) + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) // Stability: stable // Examples: 0, 1, 2 - // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on spans - // that operate with a single message. When a messaging client library supports - // both batch and single-message API for the same operation, instrumentations - // SHOULD use `messaging.batch.message_count` for batching APIs and SHOULD NOT use - // it for single-message APIs. + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") ) @@ -1574,13 +2788,31 @@ var ( MessagingOperationProcess = MessagingOperationKey.String("process") ) -// Semantic convention for a consumer of messages received from a messaging system +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system const ( - // The identifier for the consumer receiving a message. For Kafka, set it to - // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are - // present, or only `messaging.kafka.consumer.group`. For brokers, such as - // RabbitMQ and Artemis, set it to the `client_id` of the client consuming the - // message. + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. // // Type: string // RequirementLevel: Optional @@ -1589,9 +2821,22 @@ const ( MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") ) +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + // Attributes for RabbitMQ const ( - // RabbitMQ message routing key. + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. // // Type: string // RequirementLevel: ConditionallyRequired (If not empty.) @@ -1600,68 +2845,151 @@ const ( MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") ) +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + // Attributes for Apache Kafka const ( - // Message keys in Kafka are used for grouping alike messages to ensure they're - // processed on the same partition. They differ from `messaging.message.id` in - // that they're not unique. If the key is `null`, the attribute MUST NOT be set. + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to be - // supplied for the attribute. If the key has no unambiguous, canonical string - // form, don't include its value. + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - // Name of the Kafka Consumer Group that is handling the message. Only applies to - // consumers, not producers. + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'my-group' MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") - // Client ID for the Consumer or Producer that is handling the message. + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'client-5' MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") - // Partition the message is sent to. + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 2 MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") - // Partition the message is received from. + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 2 MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") - // The offset of a record in the corresponding Kafka partition. + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. // // Type: int // RequirementLevel: Optional // Stability: stable // Examples: 42 MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") - // A boolean that is true if the message is a tombstone. + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. // // Type: boolean - // RequirementLevel: ConditionallyRequired (If value is `true`. When missing, the - // value is assumed to be `false`.) + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) // Stability: stable MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") ) +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + // Attributes for Apache RocketMQ const ( - // Namespace of RocketMQ resources, resources in different namespaces are + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are // individual. // // Type: string @@ -1669,68 +2997,97 @@ const ( // Stability: stable // Examples: 'myNamespace' MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - // Name of the RocketMQ producer/consumer group that is handling the message. The - // client type is identified by the SpanKind. + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'myConsumerGroup' MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - // The unique identifier for each client. + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. // // Type: string // RequirementLevel: Required // Stability: stable // Examples: 'myhost@8742@s8083jm' MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") - // The timestamp in milliseconds that the delay message is expected to be - // delivered to consumer. + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. // // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay and delay - // time level is not specified.) + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) // Stability: stable // Examples: 1665987217045 MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - // The delay time level for delay message, which determines the message delay - // time. + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. // // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay and - // delivery timestamp is not specified.) + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) // Stability: stable // Examples: 3 MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - // It is essential for FIFO message. Messages that belong to the same message - // group are always processed one by one within the same consumer group. + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. // // Type: string // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) // Stability: stable // Examples: 'myMessageGroup' MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - // Type of message. + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. // // Type: Enum // RequirementLevel: Optional // Stability: stable MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - // The secondary classifier of message besides topic. + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: 'tagA' MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - // Key(s) of message, another way to mark message besides message id. + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. // // Type: string[] // RequirementLevel: Optional // Stability: stable // Examples: 'keyA', 'keyB' MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - // Model of message consumption. This only applies to consumer spans. + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. // // Type: Enum // RequirementLevel: Optional @@ -1756,31 +3113,98 @@ var ( MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") ) -// This document defines semantic conventions for remote procedure calls. +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Semantic conventions for remote procedure calls. const ( - // A string identifying the remoting system. See below for a list of well-known - // identifiers. + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. // // Type: Enum // RequirementLevel: Required // Stability: stable RPCSystemKey = attribute.Key("rpc.system") - // The full (logical) name of the service being called, including its package - // name, if applicable. + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. // // Type: string // RequirementLevel: Recommended // Stability: stable // Examples: 'myservice.EchoService' // Note: This is the logical name of the service from the RPC interface - // perspective, which can be different from the name of any implementing class. - // The `code.namespace` attribute may be used to store the latter (despite the - // attribute name, it may include a class name; e.g., class with method actually - // executing the call on the server side, RPC client stub class on the client - // side). + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). RPCServiceKey = attribute.Key("rpc.service") - // The name of the (logical) method being called, must be equal to the $method - // part in the span name. + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. // // Type: string // RequirementLevel: Recommended @@ -1788,9 +3212,9 @@ const ( // Examples: 'exampleMethod' // Note: This is the logical name of the method from the RPC interface // perspective, which can be different from the name of any implementing - // method/function. The `code.function` attribute may be used to store the latter - // (e.g., method actually executing the call on the server side, RPC client stub - // method on the client side). + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). RPCMethodKey = attribute.Key("rpc.method") ) @@ -1805,11 +3229,27 @@ var ( RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") ) +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + // Tech-specific attributes for gRPC. const ( - // The [numeric status - // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC - // request. + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. // // Type: Enum // RequirementLevel: Required @@ -1856,25 +3296,33 @@ var ( // Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). const ( - // Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC - // 1.0 does not specify this, the value can be omitted. + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. // // Type: string - // RequirementLevel: ConditionallyRequired (If other than the default version - // (`1.0`)) + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) // Stability: stable // Examples: '2.0', '1.0' RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") - // `id` property of request or response. Since protocol allows id to be int, - // string, `null` or missing (for notifications), value is expected to be cast to - // string for simplicity. Use empty string in case of `null` value. Omit entirely - // if this is a notification. + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. // // Type: string // RequirementLevel: Optional // Stability: stable // Examples: '10', 'request-7', '' RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the // `error.code` property of response if it is an error response. // // Type: int @@ -1882,6 +3330,9 @@ const ( // Stability: stable // Examples: -32700, 100 RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the // `error.message` property of response if it is an error response. // // Type: string @@ -1890,3 +3341,35 @@ const ( // Examples: 'Parse error', 'User already exists' RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") ) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} From 7b749591320bfcdef2061f4d4f5aa533ab76b47f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 7 Feb 2023 11:12:41 -0800 Subject: [PATCH 393/886] Remove http.target attr from ServerRequest (#3687) * Remove http.target attr from ServerRequest * Update changelog * Remove trailing space in changelog --- CHANGELOG.md | 9 +++++++++ semconv/internal/v2/http.go | 17 ++++++++--------- semconv/internal/v2/http_test.go | 2 -- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9c62f896f..9274472c3f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. These functions ensure semantic convention type correctness. +### Fixed + +- Removed the `http.target` attribute from being added by `ServerRequest` in the following packages. (#3687) + - `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.14.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.15.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.16.0/httpconv` + - `go.opentelemetry.io/otel/semconv/v1.17.0/httpconv` + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is removed. (#3631) diff --git a/semconv/internal/v2/http.go b/semconv/internal/v2/http.go index c7c47fa8815..12d6b520f52 100644 --- a/semconv/internal/v2/http.go +++ b/semconv/internal/v2/http.go @@ -157,7 +157,14 @@ func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { // "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", // "http.client_ip". func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { - n := 5 // Method, scheme, target, proto, and host name. + // TODO: This currently does not add the specification required + // `http.target` attribute. It has too high of a cardinality to safely be + // added. An alternate should be added, or this comment removed, when it is + // addressed by the specification. If it is ultimately decided to continue + // not including the attribute, the HTTPTargetKey field of the HTTPConv + // should be removed as well. + + n := 4 // Method, scheme, proto, and host name. var host string var p int if server == "" { @@ -199,14 +206,6 @@ func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.K attrs = append(attrs, c.proto(req.Proto)) attrs = append(attrs, c.NetConv.HostName(host)) - if req.URL != nil { - attrs = append(attrs, c.HTTPTargetKey.String(req.URL.RequestURI())) - } else { - // This should never occur if the request was generated by the net/http - // package. Fail gracefully, if it does though. - attrs = append(attrs, c.HTTPTargetKey.String(req.RequestURI)) - } - if hostPort > 0 { attrs = append(attrs, c.NetConv.HostPort(hostPort)) } diff --git a/semconv/internal/v2/http_test.go b/semconv/internal/v2/http_test.go index 9f91a2f7b4d..43a20c5febc 100644 --- a/semconv/internal/v2/http_test.go +++ b/semconv/internal/v2/http_test.go @@ -167,7 +167,6 @@ func TestHTTPServerRequest(t *testing.T) { assert.ElementsMatch(t, []attribute.KeyValue{ attribute.String("http.method", "GET"), - attribute.String("http.target", "/"), attribute.String("http.scheme", "http"), attribute.String("http.flavor", "1.1"), attribute.String("net.host.name", srvURL.Hostname()), @@ -208,7 +207,6 @@ func TestHTTPServerRequestFailsGracefully(t *testing.T) { assert.NotPanics(t, func() { got = hc.ServerRequest("", req) }) want := []attribute.KeyValue{ attribute.String("http.method", "GET"), - attribute.String("http.target", ""), attribute.String("http.scheme", "http"), attribute.String("http.flavor", ""), attribute.String("net.host.name", ""), From f2fd476f433128c2494476950ce11600a51bbe35 Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Tue, 7 Feb 2023 14:34:41 -0500 Subject: [PATCH 394/886] Prepare v1.13.0/v0.36.0 release (#3688) * update versions.yaml for release Signed-off-by: Anthony J Mirabella * Prepare stable-v1 for version v1.13.0 * Prepare experimental-metrics for version v0.36.0 * Update CHANGELOG Signed-off-by: Anthony J Mirabella --------- Signed-off-by: Anthony J Mirabella --- CHANGELOG.md | 7 +++++-- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 4 ++-- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 8 ++++---- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 31 files changed, 130 insertions(+), 127 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9274472c3f0..33609fb5106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.13.0/0.36.0] 2023-02-07 + ### Added - Attribute `KeyValue` creations functions to `go.opentelemetry.io/otel/semconv/v1.17.0` for all non-enum semantic conventions. - These functions ensure semantic convention type correctness. + These functions ensure semantic convention type correctness. (#3675) ### Fixed @@ -2241,7 +2243,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.12.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...HEAD +[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 [1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 [1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 [1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 98030acaaf9..b5ec1502717 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 658866842f3..076536bb2f5 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/bridge/opencensus v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/bridge/opencensus v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.35.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.35.0 // indirect + go.opentelemetry.io/otel/metric v0.36.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.36.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index b391c4e0582..3357a1a6aa2 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -7,8 +7,8 @@ replace go.opentelemetry.io/otel => ../.. require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/example/fib/go.mod b/example/fib/go.mod index b3b85ff5b20..94bca795e05 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 8b6cdf67673..45c5beb6cff 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/jaeger v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/jaeger v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index d0164e78299..27544d768d8 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index f1ae21f4a68..c50e526a385 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/bridge/opencensus v0.35.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.35.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/bridge/opencensus v0.36.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.36.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.35.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/metric v0.36.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index bf49681113c..cac5a1144da 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 google.golang.org/grpc v1.52.3 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index f39d6ede18f..1cb7f56f262 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b3358f4d70d..6eda3417020 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/prometheus v0.35.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/prometheus v0.36.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.12.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/sdk v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 429bb93e29d..9cdc4e70afd 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/prometheus v0.35.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/prometheus v0.36.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index cdd875484de..d1286fa1285 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/zipkin v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/zipkin v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 65dfcf333c1..9fce5a8fb96 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,9 +7,9 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index ba874883471..3431b5f69f4 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,11 +5,11 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f679965ee1e..ce590212920 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.35.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 google.golang.org/grpc v1.52.3 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.12.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/sdk v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 2d663ffe7c0..c0ea69d25e6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.35.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.12.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/sdk v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index be26575ea7a..6dd9c5be72f 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.52.3 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bdb492385a2..f946d4f0272 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/net v0.4.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index cf275f4581e..faa071f7e3e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 874e5e71c38..2cb39e5c03e 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 google.golang.org/protobuf v1.28.1 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 88717fb73fc..dc3d8ac407d 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/sdk/metric v0.35.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/sdk/metric v0.36.0 ) require ( @@ -15,7 +15,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 2e56f0b30b7..1c91eb38d9d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 7cec932c27c..f08f6a1c0de 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,9 +8,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/sdk v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/go.mod b/go.mod index 44ef8ab3610..0da4fc72bc7 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel/trace v1.13.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index cc9784f56fa..f2c759659af 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel v1.13.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 2768c831c94..d775aec0301 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/trace v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/trace v1.13.0 golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 1a2a5784f2a..2753dbe7eba 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 - go.opentelemetry.io/otel/metric v0.35.0 - go.opentelemetry.io/otel/sdk v1.12.0 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/metric v0.36.0 + go.opentelemetry.io/otel/sdk v1.13.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.12.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index b85198bb4ae..74f59628903 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.1 - go.opentelemetry.io/otel v1.12.0 + go.opentelemetry.io/otel v1.13.0 ) require ( diff --git a/version.go b/version.go index bda8f7cbfae..d82fbaf550e 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.12.0" + return "1.13.0" } diff --git a/versions.yaml b/versions.yaml index 66f45622215..22df4553c2e 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.12.0 + version: v1.13.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.35.0 + version: v0.36.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From a4f646d05409d21bd0833abff6f86fe3fdb50ae5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 7 Feb 2023 13:23:53 -0800 Subject: [PATCH 395/886] Update dependabot config (#3684) Use the latest dbotconf to correctly identify the directory a Dockerfile is located that needs to be updated by dependabot. --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 51a3c3eb726..2afaca1dd60 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,7 +11,7 @@ updates: interval: weekly day: sunday - package-ecosystem: docker - directory: / + directory: /example/zipkin labels: - dependencies - docker From ddf393886ccddb0e131209228cf9e934f7cb73f0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 7 Feb 2023 13:42:47 -0800 Subject: [PATCH 396/886] Use semconv creation functions (#3683) --- bridge/opentracing/internal/mock.go | 4 +-- example/fib/main.go | 4 +-- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 22 +++++++------- .../internal/transform/metricdata_test.go | 4 +-- .../otlptrace/otlptracehttp/example_test.go | 4 +-- exporters/prometheus/exporter_test.go | 12 ++++---- exporters/stdout/stdoutmetric/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 4 +-- exporters/zipkin/model_test.go | 30 +++++++++---------- exporters/zipkin/zipkin_test.go | 4 +-- sdk/metric/example_test.go | 4 +-- sdk/resource/builtin.go | 6 ++-- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 4 +-- sdk/resource/os.go | 2 +- sdk/resource/process.go | 16 +++++----- sdk/resource/resource_test.go | 4 +-- sdk/trace/span.go | 12 ++++---- sdk/trace/trace_test.go | 12 ++++---- website_docs/getting-started.md | 4 +-- website_docs/manual.md | 2 +- 26 files changed, 84 insertions(+), 84 deletions(-) diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 75683a899ad..99585c7562c 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -267,8 +267,8 @@ func (s *MockSpan) RecordError(err error, opts ...trace.EventOption) { s.SetStatus(codes.Error, "") opts = append(opts, trace.WithAttributes( - semconv.ExceptionTypeKey.String(reflect.TypeOf(err).String()), - semconv.ExceptionMessageKey.String(err.Error()), + semconv.ExceptionType(reflect.TypeOf(err).String()), + semconv.ExceptionMessage(err.Error()), )) s.AddEvent(semconv.ExceptionEventName, opts...) } diff --git a/example/fib/main.go b/example/fib/main.go index 18f38e000e7..6863f7f14f7 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -46,8 +46,8 @@ func newResource() *resource.Resource { resource.Default(), resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("fib"), - semconv.ServiceVersionKey.String("v0.1.0"), + semconv.ServiceName("fib"), + semconv.ServiceVersion("v0.1.0"), attribute.String("environment", "demo"), ), ) diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 591d3a47047..38196ebb59d 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -51,7 +51,7 @@ func tracerProvider(url string) (*tracesdk.TracerProvider, error) { // Record information about this application in a Resource. tracesdk.WithResource(resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String(service), + semconv.ServiceName(service), attribute.String("environment", environment), attribute.Int64("ID", id), )), diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index bdbaf65bab8..bc6643f4963 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -46,7 +46,7 @@ func initProvider() (func(context.Context) error, error) { res, err := resource.New(ctx, resource.WithAttributes( // the service name used to display traces in backends - semconv.ServiceNameKey.String("test-service"), + semconv.ServiceName("test-service"), ), ) if err != nil { diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 63809b630a7..81a16abd4ad 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -55,7 +55,7 @@ func initTracer(url string) (func(context.Context) error, error) { sdktrace.WithSpanProcessor(batcher), sdktrace.WithResource(resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("zipkin-test"), + semconv.ServiceName("zipkin-test"), )), ) otel.SetTracerProvider(tp) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index 972e2541462..ddbd681d00a 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -352,7 +352,7 @@ func process(res *resource.Resource, defaultServiceName string) *gen.Process { // If no service.name is contained in a Span's Resource, // that field MUST be populated from the default Resource. if serviceName.Value.AsString() == "" { - serviceName = semconv.ServiceNameKey.String(defaultServiceName) + serviceName = semconv.ServiceName(defaultServiceName) } process.ServiceName = serviceName.Value.AsString() diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 066ea8ffe65..1b11be79016 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -119,7 +119,7 @@ func TestExporterExportSpan(t *testing.T) { tp := sdktrace.NewTracerProvider( sdktrace.WithBatcher(exp), sdktrace.WithResource(resource.NewSchemaless( - semconv.ServiceNameKey.String(serviceName), + semconv.ServiceName(serviceName), attribute.String(tagKey, tagVal), )), ) @@ -376,7 +376,7 @@ func TestSpanSnapshotToThrift(t *testing.T) { Resource: resource.NewSchemaless( attribute.String("rk1", rv1), attribute.Int64("rk2", rv2), - semconv.ServiceNameKey.String("service name"), + semconv.ServiceName("service name"), ), Status: sdktrace.Status{ Code: codes.Unset, @@ -453,7 +453,7 @@ func TestExporterExportSpansHonorsCancel(t *testing.T) { { Name: "s1", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r1").String("v1"), ), StartTime: now, @@ -462,7 +462,7 @@ func TestExporterExportSpansHonorsCancel(t *testing.T) { { Name: "s2", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r2").String("v2"), ), StartTime: now, @@ -483,7 +483,7 @@ func TestExporterExportSpansHonorsTimeout(t *testing.T) { { Name: "s1", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r1").String("v1"), ), StartTime: now, @@ -492,7 +492,7 @@ func TestExporterExportSpansHonorsTimeout(t *testing.T) { { Name: "s2", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r2").String("v2"), ), StartTime: now, @@ -530,7 +530,7 @@ func TestJaegerBatchList(t *testing.T) { tracetest.SpanStub{ Name: "s1", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r1").String("v1"), ), StartTime: now, @@ -564,7 +564,7 @@ func TestJaegerBatchList(t *testing.T) { { Name: "s1", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r1").String("v1"), ), StartTime: now, @@ -573,7 +573,7 @@ func TestJaegerBatchList(t *testing.T) { { Name: "s2", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r1").String("v1"), ), StartTime: now, @@ -582,7 +582,7 @@ func TestJaegerBatchList(t *testing.T) { { Name: "s3", Resource: resource.NewSchemaless( - semconv.ServiceNameKey.String("name"), + semconv.ServiceName("name"), attribute.Key("r2").String("v2"), ), StartTime: now, @@ -689,7 +689,7 @@ func TestProcess(t *testing.T) { { name: "resources contain service name", res: resource.NewSchemaless( - semconv.ServiceNameKey.String("service name"), + semconv.ServiceName("service name"), attribute.Key("r1").String("v1"), ), defaultServiceName: "default service name", diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 7241a5cf76c..8744d40d4a6 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -288,8 +288,8 @@ var ( otelRes = resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("test server"), - semconv.ServiceVersionKey.String("v0.1.0"), + semconv.ServiceName("test server"), + semconv.ServiceVersion("v0.1.0"), ) pbRes = &rpb.Resource{ diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 0331d283839..8682bbce30f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -60,8 +60,8 @@ func multiply(ctx context.Context, x, y int64) int64 { func newResource() *resource.Resource { return resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("otlptrace-example"), - semconv.ServiceVersionKey.String("0.0.1"), + semconv.ServiceName("otlptrace-example"), + semconv.ServiceVersion("0.0.1"), ) } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 25205aed946..067d1951bdc 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -274,9 +274,9 @@ func TestPrometheusExporter(t *testing.T) { } else { res, err = resource.New(ctx, // always specify service.name because the default depends on the running OS - resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), + resource.WithAttributes(semconv.ServiceName("prometheus_test")), // Overwrite the semconv.TelemetrySDKVersionKey value so we don't need to update every version - resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), resource.WithAttributes(tc.customResouceAttrs...), ) require.NoError(t, err) @@ -350,9 +350,9 @@ func TestMultiScopes(t *testing.T) { res, err := resource.New(ctx, // always specify service.name because the default depends on the running OS - resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), + resource.WithAttributes(semconv.ServiceName("prometheus_test")), // Overwrite the semconv.TelemetrySDKVersionKey value so we don't need to update every version - resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), ) require.NoError(t, err) res, err = resource.Merge(resource.Default(), res) @@ -613,8 +613,8 @@ func TestDuplicateMetrics(t *testing.T) { // initialize resource res, err := resource.New(ctx, - resource.WithAttributes(semconv.ServiceNameKey.String("prometheus_test")), - resource.WithAttributes(semconv.TelemetrySDKVersionKey.String("latest")), + resource.WithAttributes(semconv.ServiceName("prometheus_test")), + resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), ) require.NoError(t, err) res, err = resource.Merge(resource.Default(), res) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 4db2535d334..fdce6951df7 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -35,7 +35,7 @@ var ( now = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) res = resource.NewSchemaless( - semconv.ServiceNameKey.String("stdoutmetric-example"), + semconv.ServiceName("stdoutmetric-example"), ) mockData = metricdata.ResourceMetrics{ diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index a34331f35d5..0864fbadeca 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -59,8 +59,8 @@ func multiply(ctx context.Context, x, y int64) int64 { func Resource() *resource.Resource { return resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("stdout-example"), - semconv.ServiceVersionKey.String("0.0.1"), + semconv.ServiceName("stdout-example"), + semconv.ServiceVersion("0.0.1"), ) } diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 676c08a1cd8..a7ee19a3a72 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -38,8 +38,8 @@ import ( func TestModelConversion(t *testing.T) { res := resource.NewSchemaless( - semconv.ServiceNameKey.String("model-test"), - semconv.ServiceVersionKey.String("0.1.0"), + semconv.ServiceName("model-test"), + semconv.ServiceVersion("0.1.0"), attribute.Int64("resource-attr1", 42), attribute.IntSlice("resource-attr2", []int{0, 1, 2}), ) @@ -1095,9 +1095,9 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.PeerServiceKey.String("peer-service-test"), - semconv.NetPeerNameKey.String("peer-name-test"), - semconv.NetSockPeerNameKey.String("net-sock-peer-test"), + semconv.PeerService("peer-service-test"), + semconv.NetPeerName("peer-name-test"), + semconv.NetSockPeerName("net-sock-peer-test"), }, }, want: &zkmodel.Endpoint{ @@ -1109,8 +1109,8 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerNameKey.String("net-sock-peer-test"), - semconv.DBNameKey.String("db-name-test"), + semconv.NetSockPeerName("net-sock-peer-test"), + semconv.DBName("db-name-test"), }, }, want: &zkmodel.Endpoint{ @@ -1123,7 +1123,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ attribute.String("foo", "bar"), - semconv.DBNameKey.String("db-name-test"), + semconv.DBName("db-name-test"), }, }, want: &zkmodel.Endpoint{ @@ -1137,7 +1137,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { Attributes: []attribute.KeyValue{ keyPeerHostname.String("peer-hostname-test"), keyPeerAddress.String("peer-address-test"), - semconv.DBNameKey.String("http-host-test"), + semconv.DBName("http-host-test"), }, }, want: &zkmodel.Endpoint{ @@ -1150,7 +1150,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ keyPeerAddress.String("peer-address-test"), - semconv.DBNameKey.String("http-host-test"), + semconv.DBName("http-host-test"), }, }, want: &zkmodel.Endpoint{ @@ -1162,7 +1162,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddrKey.String("INVALID"), + semconv.NetSockPeerAddr("INVALID"), }, }, want: nil, @@ -1172,7 +1172,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddrKey.String("0:0:1:5ee:bad:c0de:0:0"), + semconv.NetSockPeerAddr("0:0:1:5ee:bad:c0de:0:0"), }, }, want: &zkmodel.Endpoint{ @@ -1184,8 +1184,8 @@ func TestRemoteEndpointTransformation(t *testing.T) { data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddrKey.String("1.2.3.4"), - semconv.NetSockPeerPortKey.Int(9876), + semconv.NetSockPeerAddr("1.2.3.4"), + semconv.NetSockPeerPort(9876), }, }, want: &zkmodel.Endpoint{ @@ -1211,6 +1211,6 @@ func TestServiceName(t *testing.T) { attrs = append(attrs, attribute.String("test_key", "test_value")) assert.Equal(t, defaultServiceName, getServiceName(attrs)) - attrs = append(attrs, semconv.ServiceNameKey.String("my_service")) + attrs = append(attrs, semconv.ServiceName("my_service")) assert.Equal(t, "my_service", getServiceName(attrs)) } diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index cbec5b8f32a..3bcd431f3de 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -199,8 +199,8 @@ func logStoreLogger(s *logStore) *log.Logger { func TestExportSpans(t *testing.T) { res := resource.NewSchemaless( - semconv.ServiceNameKey.String("exporter-test"), - semconv.ServiceVersionKey.String("0.1.0"), + semconv.ServiceName("exporter-test"), + semconv.ServiceVersion("0.1.0"), ) spans := tracetest.SpanStubs{ diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 4e95d3909d2..c0704509a26 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -34,8 +34,8 @@ func Example() { // information about how to create and use Resources. res := resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("my-service"), - semconv.ServiceVersionKey.String("v0.1.0"), + semconv.ServiceName("my-service"), + semconv.ServiceVersion("v0.1.0"), ) meterProvider := metric.NewMeterProvider( diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 34a474891a4..aa0f942f490 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -60,9 +60,9 @@ var ( func (telemetrySDK) Detect(context.Context) (*Resource, error) { return NewWithAttributes( semconv.SchemaURL, - semconv.TelemetrySDKNameKey.String("opentelemetry"), - semconv.TelemetrySDKLanguageKey.String("go"), - semconv.TelemetrySDKVersionKey.String(otel.Version()), + semconv.TelemetrySDKName("opentelemetry"), + semconv.TelemetrySDKLanguageGo, + semconv.TelemetrySDKVersion(otel.Version()), ), nil } diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 6f7fd005b7a..318dcf82fe2 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -47,7 +47,7 @@ func (cgroupContainerIDDetector) Detect(ctx context.Context) (*Resource, error) if containerID == "" { return Empty(), nil } - return NewWithAttributes(semconv.SchemaURL, semconv.ContainerIDKey.String(containerID)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ContainerID(containerID)), nil } var ( diff --git a/sdk/resource/env.go b/sdk/resource/env.go index deebe363a1d..e32843cad14 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -59,7 +59,7 @@ func (fromEnv) Detect(context.Context) (*Resource, error) { var res *Resource if svcName != "" { - res = NewSchemaless(semconv.ServiceNameKey.String(svcName)) + res = NewSchemaless(semconv.ServiceName(svcName)) } r2, err := constructOTResources(attrs) diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 43b3a0e257b..d8c5a70c86c 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -83,7 +83,7 @@ func TestNoResourceAttributesSet(t *testing.T) { res, err := detector.Detect(context.Background()) require.NoError(t, err) assert.Equal(t, res, NewSchemaless( - semconv.ServiceNameKey.String("bar"), + semconv.ServiceName("bar"), )) } @@ -131,6 +131,6 @@ func TestDetectServiceNameFromEnv(t *testing.T) { require.NoError(t, err) assert.Equal(t, res, NewSchemaless( attribute.String("key", "value"), - semconv.ServiceNameKey.String("bar"), + semconv.ServiceName("bar"), )) } diff --git a/sdk/resource/os.go b/sdk/resource/os.go index ac520dd8673..815fe5c2041 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -63,7 +63,7 @@ func (osDescriptionDetector) Detect(ctx context.Context) (*Resource, error) { return NewWithAttributes( semconv.SchemaURL, - semconv.OSDescriptionKey.String(description), + semconv.OSDescription(description), ), nil } diff --git a/sdk/resource/process.go b/sdk/resource/process.go index 7eaddd34bfd..bdd0e7fe680 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -120,14 +120,14 @@ type processRuntimeDescriptionDetector struct{} // Detect returns a *Resource that describes the process identifier (PID) of the // executing process. func (processPIDDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessPIDKey.Int(pid())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessPID(pid())), nil } // Detect returns a *Resource that describes the name of the process executable. func (processExecutableNameDetector) Detect(ctx context.Context) (*Resource, error) { executableName := filepath.Base(commandArgs()[0]) - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutableNameKey.String(executableName)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutableName(executableName)), nil } // Detect returns a *Resource that describes the full path of the process executable. @@ -137,13 +137,13 @@ func (processExecutablePathDetector) Detect(ctx context.Context) (*Resource, err return nil, err } - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutablePathKey.String(executablePath)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessExecutablePath(executablePath)), nil } // Detect returns a *Resource that describes all the command arguments as received // by the process. func (processCommandArgsDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgsKey.StringSlice(commandArgs())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessCommandArgs(commandArgs()...)), nil } // Detect returns a *Resource that describes the username of the user that owns the @@ -154,18 +154,18 @@ func (processOwnerDetector) Detect(ctx context.Context) (*Resource, error) { return nil, err } - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessOwnerKey.String(owner.Username)), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessOwner(owner.Username)), nil } // Detect returns a *Resource that describes the name of the compiler used to compile // this process image. func (processRuntimeNameDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeNameKey.String(runtimeName())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeName(runtimeName())), nil } // Detect returns a *Resource that describes the version of the runtime of this process. func (processRuntimeVersionDetector) Detect(ctx context.Context) (*Resource, error) { - return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeVersionKey.String(runtimeVersion())), nil + return NewWithAttributes(semconv.SchemaURL, semconv.ProcessRuntimeVersion(runtimeVersion())), nil } // Detect returns a *Resource that describes the runtime of this process. @@ -175,6 +175,6 @@ func (processRuntimeDescriptionDetector) Detect(ctx context.Context) (*Resource, return NewWithAttributes( semconv.SchemaURL, - semconv.ProcessRuntimeDescriptionKey.String(runtimeDescription), + semconv.ProcessRuntimeDescription(runtimeDescription), ), nil } diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 630a5da9acc..608d9e21e89 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -227,8 +227,8 @@ func TestDefault(t *testing.T) { "default service.name should include executable name") require.Contains(t, res.Attributes(), semconv.TelemetrySDKLanguageGo) - require.Contains(t, res.Attributes(), semconv.TelemetrySDKVersionKey.String(otel.Version())) - require.Contains(t, res.Attributes(), semconv.TelemetrySDKNameKey.String("opentelemetry")) + require.Contains(t, res.Attributes(), semconv.TelemetrySDKVersion(otel.Version())) + require.Contains(t, res.Attributes(), semconv.TelemetrySDKName("opentelemetry")) } func TestString(t *testing.T) { diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 5abb0b274d4..9fb483a99fe 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -383,14 +383,14 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { defer panic(recovered) opts := []trace.EventOption{ trace.WithAttributes( - semconv.ExceptionTypeKey.String(typeStr(recovered)), - semconv.ExceptionMessageKey.String(fmt.Sprint(recovered)), + semconv.ExceptionType(typeStr(recovered)), + semconv.ExceptionMessage(fmt.Sprint(recovered)), ), } if config.StackTrace() { opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), + semconv.ExceptionStacktrace(recordStackTrace()), )) } @@ -430,14 +430,14 @@ func (s *recordingSpan) RecordError(err error, opts ...trace.EventOption) { } opts = append(opts, trace.WithAttributes( - semconv.ExceptionTypeKey.String(typeStr(err)), - semconv.ExceptionMessageKey.String(err.Error()), + semconv.ExceptionType(typeStr(err)), + semconv.ExceptionMessage(err.Error()), )) c := trace.NewEventConfig(opts...) if c.StackTrace() { opts = append(opts, trace.WithAttributes( - semconv.ExceptionStacktraceKey.String(recordStackTrace()), + semconv.ExceptionStacktrace(recordStackTrace()), )) } diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 280546894fd..7d5a09fb19a 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1235,8 +1235,8 @@ func TestRecordError(t *testing.T) { Name: semconv.ExceptionEventName, Time: errTime, Attributes: []attribute.KeyValue{ - semconv.ExceptionTypeKey.String(s.typ), - semconv.ExceptionMessageKey.String(s.msg), + semconv.ExceptionType(s.typ), + semconv.ExceptionMessage(s.msg), }, }, }, @@ -1279,8 +1279,8 @@ func TestRecordErrorWithStackTrace(t *testing.T) { Name: semconv.ExceptionEventName, Time: errTime, Attributes: []attribute.KeyValue{ - semconv.ExceptionTypeKey.String(typ), - semconv.ExceptionMessageKey.String(msg), + semconv.ExceptionType(typ), + semconv.ExceptionMessage(msg), }, }, }, @@ -1502,8 +1502,8 @@ func TestSpanCapturesPanic(t *testing.T) { require.Len(t, spans[0].Events(), 1) assert.Equal(t, spans[0].Events()[0].Name, semconv.ExceptionEventName) assert.Equal(t, spans[0].Events()[0].Attributes, []attribute.KeyValue{ - semconv.ExceptionTypeKey.String("*errors.errorString"), - semconv.ExceptionMessageKey.String("error message"), + semconv.ExceptionType("*errors.errorString"), + semconv.ExceptionMessage("error message"), }) } diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index a084dcb4690..e3244866971 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -323,8 +323,8 @@ func newResource() *resource.Resource { resource.Default(), resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("fib"), - semconv.ServiceVersionKey.String("v0.1.0"), + semconv.ServiceName("fib"), + semconv.ServiceVersion("v0.1.0"), attribute.String("environment", "demo"), ), ) diff --git a/website_docs/manual.md b/website_docs/manual.md index 4fd2190da62..21dbcc85927 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -51,7 +51,7 @@ func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { resource.Default(), resource.NewWithAttributes( semconv.SchemaURL, - semconv.ServiceNameKey.String("ExampleService"), + semconv.ServiceName("ExampleService"), ), ) From 01ae3fbb4997a6524dc7ec10426852388da49845 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:27:07 -0800 Subject: [PATCH 397/886] Bump golang from 1.18-alpine to 1.20-alpine in /example/zipkin (#3691) Bumps golang from 1.18-alpine to 1.20-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- example/zipkin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/zipkin/Dockerfile b/example/zipkin/Dockerfile index 58046097358..e9cfb7557a8 100644 --- a/example/zipkin/Dockerfile +++ b/example/zipkin/Dockerfile @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.18-alpine +FROM golang:1.20-alpine COPY . /go/src/github.com/open-telemetry/opentelemetry-go/ WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/zipkin/ RUN go install ./main.go From a7fb378ad95976746d622fcd884beb1ba70f9596 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 8 Feb 2023 14:08:57 -0800 Subject: [PATCH 398/886] Add testing for Go 1.20 (#3693) * Add testing for Go 1.20 * Update PR number in changelog * Quote 1.20 in ci.yml --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 6 ++++++ README.md | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b4ba881df5..9a31064c48a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: [1.19, 1.18] + go-version: ["1.20", 1.19, 1.18] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner diff --git a/CHANGELOG.md b/CHANGELOG.md index 33609fb5106..1c7d222f487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Support [Go 1.20]. (#3693) + ## [1.13.0/0.36.0] 2023-02-07 ### Added @@ -2303,3 +2307,5 @@ It contains api and sdk for trace and meter. [0.1.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.2 [0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 + +[Go 1.20]: https://go.dev/doc/go1.20 diff --git a/README.md b/README.md index 1b2ee21fbf5..878d87e58b9 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,19 @@ Currently, this project supports the following environments. | OS | Go Version | Architecture | | ------- | ---------- | ------------ | +| Ubuntu | 1.20 | amd64 | | Ubuntu | 1.19 | amd64 | | Ubuntu | 1.18 | amd64 | +| Ubuntu | 1.20 | 386 | | Ubuntu | 1.19 | 386 | | Ubuntu | 1.18 | 386 | +| MacOS | 1.20 | amd64 | | MacOS | 1.19 | amd64 | | MacOS | 1.18 | amd64 | +| Windows | 1.20 | amd64 | | Windows | 1.19 | amd64 | | Windows | 1.18 | amd64 | +| Windows | 1.20 | 386 | | Windows | 1.19 | 386 | | Windows | 1.18 | 386 | From fb5c5998332e1f8a379fa812f75613267572c503 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 8 Feb 2023 14:21:16 -0800 Subject: [PATCH 399/886] Bump default Go version to 1.19 (#3694) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a31064c48a..44b052ca964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: # Path to where test results will be saved. TEST_RESULTS: /tmp/test-results # Default minimum version of Go to support. - DEFAULT_GO_VERSION: 1.18 + DEFAULT_GO_VERSION: 1.19 jobs: lint: runs-on: ubuntu-latest From d5fca833d6f6fc75e092c2108e0265aa778b8923 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 14:48:13 -0800 Subject: [PATCH 400/886] Bump github.com/golangci/golangci-lint in /internal/tools (#3690) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.51.0 to 1.51.1. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.51.0...v1.51.1) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 20 ++++++++++---------- internal/tools/go.sum | 44 ++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index aad0fa99997..ad99ccf29be 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.51.0 + github.com/golangci/golangci-lint v1.51.1 github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -62,7 +62,7 @@ require ( github.com/go-git/go-billy/v5 v5.4.0 // indirect github.com/go-git/go-git/v5 v5.5.2 // indirect github.com/go-toolsmith/astcast v1.0.0 // indirect - github.com/go-toolsmith/astcopy v1.0.2 // indirect + github.com/go-toolsmith/astcopy v1.0.3 // indirect github.com/go-toolsmith/astequal v1.0.3 // indirect github.com/go-toolsmith/astfmt v1.0.0 // indirect github.com/go-toolsmith/astp v1.0.0 // indirect @@ -82,7 +82,7 @@ require ( github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 // indirect + github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect @@ -100,7 +100,7 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect - github.com/junk1tm/musttag v0.4.3 // indirect + github.com/junk1tm/musttag v0.4.4 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect @@ -129,7 +129,7 @@ require ( github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.9.5 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.7.1 // indirect + github.com/nunnatsa/ginkgolinter v0.8.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect @@ -147,8 +147,8 @@ require ( github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect - github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect - github.com/sanposhiho/wastedassign/v2 v2.0.6 // indirect + github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect + github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.21.1 // indirect github.com/securego/gosec/v2 v2.14.0 // indirect @@ -160,7 +160,7 @@ require ( github.com/sivchari/tenv v1.7.1 // indirect github.com/skeema/knownhosts v1.1.0 // indirect github.com/sonatard/noctx v0.0.1 // indirect - github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1 // indirect + github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect @@ -177,7 +177,7 @@ require ( github.com/tetafro/godot v1.4.11 // indirect github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect github.com/timonwong/loggercheck v0.9.3 // indirect - github.com/tomarrell/wrapcheck/v2 v2.7.0 // indirect + github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect @@ -203,7 +203,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720 // indirect + honnef.co/go/tools v0.4.0 // indirect mvdan.cc/gofumpt v0.4.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 47e987acfd6..4e75a3dd4d9 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -178,12 +178,12 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.2 h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0= github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= +github.com/go-toolsmith/astcopy v1.0.3 h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0= +github.com/go-toolsmith/astcopy v1.0.3/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o= @@ -243,8 +243,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.51.0 h1:M1bpDymgdaPKNzPwQdebCGki/nzvVkr2f/eUfk9C9oU= -github.com/golangci/golangci-lint v1.51.0/go.mod h1:7taIMcmZ5ksCuRruCV/mm8Ir3sE+bIuOHVCvt1B4hi4= +github.com/golangci/golangci-lint v1.51.1 h1:N5HD/x0ZrhJYsgKWyz7yJxxQ8JKR0Acc+FOP7QtGSAA= +github.com/golangci/golangci-lint v1.51.1/go.mod h1:hnyNNO3fJ2Rjwo6HM+VXvcmLkKDOuBAnR9gVlS1mW1E= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -289,8 +289,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8 h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U= -github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= +github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= @@ -340,7 +340,6 @@ github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjz github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= -github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -352,8 +351,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/junk1tm/musttag v0.4.3 h1:I8UHQkDj2u/MClcGU8PbMoYwhykiSQFEbXKKMjixPyk= -github.com/junk1tm/musttag v0.4.3/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= +github.com/junk1tm/musttag v0.4.4 h1:VK4L7v7lvWAhKDDx0cUJgbb0UBNipYinv8pPeHJzH9Q= +github.com/junk1tm/musttag v0.4.4/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -386,7 +385,6 @@ github.com/ldez/tagliatelle v0.4.0 h1:sylp7d9kh6AdXN2DpVGHBRb5guTVAgOxqNGhbqc4b1 github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= @@ -408,7 +406,6 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= @@ -437,8 +434,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.7.1 h1:j4mzqx1hkE75mXHs3AUlWghZBi59c3GDWXp6zzcI+kE= -github.com/nunnatsa/ginkgolinter v0.7.1/go.mod h1:jTgd60EAdXDmmIPZi+xoMDqAYo/4AakhWNmnPisd7Rc= +github.com/nunnatsa/ginkgolinter v0.8.1 h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuYs02q1c= +github.com/nunnatsa/ginkgolinter v0.8.1/go.mod h1:FYYLtszIdmzCH8XMaMPyxPVXZ7VCaIm55bA+gugx+14= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.3.1 h1:8SbseP7qM32WcvE6VaN6vfXxv698izmsJ1UQX9ve7T8= @@ -510,10 +507,10 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= -github.com/ryanrolds/sqlclosecheck v0.3.0 h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw= -github.com/ryanrolds/sqlclosecheck v0.3.0/go.mod h1:1gREqxyTGR3lVtpngyFo3hZAgk0KCtEdgEkHwDbigdA= -github.com/sanposhiho/wastedassign/v2 v2.0.6 h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA= -github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= +github.com/ryanrolds/sqlclosecheck v0.4.0 h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI= +github.com/ryanrolds/sqlclosecheck v0.4.0/go.mod h1:TBRRjzL31JONc9i4XMinicuo+s+E8yKZ5FN8X3G6CKQ= +github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= +github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.21.1 h1:GQGlReyL9Ek8DdJmwtwhHbhwHnuPfsKaprpjnrPcjxc= @@ -543,8 +540,8 @@ github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ys github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= -github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1 h1:FEIBISvqa2IsyC4KQQBQ1Ef2QvweGUgEIjCdE3gz+zs= -github.com/sourcegraph/go-diff v0.6.2-0.20221031073116-7ef5f68ebea1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= +github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= +github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= @@ -593,8 +590,8 @@ github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByH github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= -github.com/tomarrell/wrapcheck/v2 v2.7.0 h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA= -github.com/tomarrell/wrapcheck/v2 v2.7.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/tomarrell/wrapcheck/v2 v2.8.0 h1:qDzbir0xmoE+aNxGCPrn+rUSxAX+nG6vREgbbXAR81I= +github.com/tomarrell/wrapcheck/v2 v2.8.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= @@ -914,7 +911,6 @@ golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200625211823-6506e20df31f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -1074,8 +1070,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720 h1:L3lQbXWMmkBfyGXTvipQVmLXSM5SsT/39qcf+0RBIlQ= -honnef.co/go/tools v0.4.0-0.dev.0.20221209223220-58c4d7e4b720/go.mod h1:lbrxuU0wR28B7d2OiCxa+DVcNWwTjaY3RfXQNu3r10U= +honnef.co/go/tools v0.4.0 h1:lyXVV1c8wUBJRKqI8JgIpT8TW1VDagfYYaxbKa/HoL8= +honnef.co/go/tools v0.4.0/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= From e9bdda0e68b27ba096826da1a6fa975cda7fba5a Mon Sep 17 00:00:00 2001 From: Mackenzie <63265430+mackjmr@users.noreply.github.com> Date: Thu, 9 Feb 2023 20:03:39 +0100 Subject: [PATCH 401/886] WithContainerID: Document ECS limitation. (#3639) * WithContainerID: Document ECS limitation. WithContainerID is not able to extract the correct container id in an ECS environment. The ECS resource detector should be used instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). See #3633. * fix lint * Update sdk/resource/config.go --------- Co-authored-by: Tyler Yahn --- sdk/resource/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/resource/config.go b/sdk/resource/config.go index 8e212b12182..f9a2a299907 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -194,6 +194,8 @@ func WithContainer() Option { } // WithContainerID adds an attribute with the id of the container to the configured Resource. +// Note: WithContainerID will not extract the correct container ID in an ECS environment. +// Please use the ECS resource detector instead (https://pkg.go.dev/go.opentelemetry.io/contrib/detectors/aws/ecs). func WithContainerID() Option { return WithDetectors(cgroupContainerIDDetector{}) } From 2f3c6df7bbb674cfe32c93f62e1eb7d7f813511a Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Thu, 9 Feb 2023 15:40:15 -0500 Subject: [PATCH 402/886] Add semantic conventions of the `event` type (#3697) * Add semantic conventions of the `event` type Signed-off-by: Anthony J Mirabella * Update CHANGELOG Signed-off-by: Anthony J Mirabella * Update CHANGELOG.md Co-authored-by: Tyler Yahn --------- Signed-off-by: Anthony J Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 2 + Makefile | 5 +- semconv/v1.17.0/event.go | 199 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+), 2 deletions(-) create mode 100644 semconv/v1.17.0/event.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7d222f487..fd6535ce587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- Semantic conventions of the `event` type are now generated. (#3697) +- The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) - Support [Go 1.20]. (#3693) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/Makefile b/Makefile index befb040a77b..0e6ffa284e1 100644 --- a/Makefile +++ b/Makefile @@ -210,8 +210,9 @@ SEMCONVPKG ?= "semconv/" semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) [ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" .PHONY: prerelease diff --git a/semconv/v1.17.0/event.go b/semconv/v1.17.0/event.go new file mode 100644 index 00000000000..679c40c4de4 --- /dev/null +++ b/semconv/v1.17.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} From f5a149772af8d1a4849667f3aaa974e1e73d07d3 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 12 Feb 2023 09:34:31 -0800 Subject: [PATCH 403/886] dependabot updates Sun Feb 12 17:20:31 UTC 2023 (#3718) Bump go.opentelemetry.io/build-tools/multimod from 0.5.0 to 0.6.0 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.5.0 to 0.6.0 in /internal/tools Bump golang.org/x/tools from 0.5.0 to 0.6.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.5.0 to 0.6.0 in /internal/tools Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /exporters/otlp/otlpmetric Bump go.opentelemetry.io/build-tools/dbotconf from 0.5.0 to 0.6.0 in /internal/tools Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /example/otel-collector --- example/otel-collector/go.mod | 10 ++-- example/otel-collector/go.sum | 20 ++++---- exporters/otlp/otlpmetric/go.mod | 10 ++-- exporters/otlp/otlpmetric/go.sum | 20 ++++---- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 20 ++++---- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 10 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 20 ++++---- exporters/otlp/otlptrace/go.mod | 10 ++-- exporters/otlp/otlptrace/go.sum | 20 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 20 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 20 ++++---- internal/tools/go.mod | 26 +++++----- internal/tools/go.sum | 48 ++++++++++--------- 16 files changed, 142 insertions(+), 142 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index cac5a1144da..9004018cb76 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 - google.golang.org/grpc v1.52.3 + google.golang.org/grpc v1.53.0 ) require ( @@ -24,10 +24,10 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 3ff98e04569..15e4c908fc5 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -221,8 +221,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -274,8 +274,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -376,8 +376,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -394,8 +394,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 3431b5f69f4..652eb3a50be 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.52.3 + google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 ) @@ -24,10 +24,10 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 92ff38f00d5..b1a220daa83 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -384,8 +384,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index ce590212920..973ad997106 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,8 +12,8 @@ require ( go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 - google.golang.org/grpc v1.52.3 + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f + google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 ) @@ -28,9 +28,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 92ff38f00d5..b1a220daa83 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -384,8 +384,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index c0ea69d25e6..d380383068d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -26,11 +26,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect - google.golang.org/grpc v1.52.3 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/grpc v1.53.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 92ff38f00d5..b1a220daa83 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -384,8 +384,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 6dd9c5be72f..39b598f39a8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.52.3 + google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 ) @@ -22,10 +22,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 92ff38f00d5..b1a220daa83 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -384,8 +384,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index f946d4f0272..bca43b3790d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.0 - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 - google.golang.org/grpc v1.52.3 + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f + google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 ) @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 2f2d88c4024..ea370d15f7f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -231,8 +231,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -275,8 +275,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -284,8 +284,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -387,8 +387,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -405,8 +405,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index faa071f7e3e..153f32048c1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,11 +21,11 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect - google.golang.org/grpc v1.52.3 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/grpc v1.53.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 10bc98b8d2c..e8f18347f12 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -228,8 +228,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -272,8 +272,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -281,8 +281,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -383,8 +383,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index ad99ccf29be..a34e63328f6 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,11 +9,11 @@ require ( github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.5.0 - go.opentelemetry.io/build-tools/dbotconf v0.5.0 - go.opentelemetry.io/build-tools/multimod v0.5.0 - go.opentelemetry.io/build-tools/semconvgen v0.5.0 - golang.org/x/tools v0.5.0 + go.opentelemetry.io/build-tools/crosslink v0.6.0 + go.opentelemetry.io/build-tools/dbotconf v0.6.0 + go.opentelemetry.io/build-tools/multimod v0.6.0 + go.opentelemetry.io/build-tools/semconvgen v0.6.0 + golang.org/x/tools v0.6.0 ) require ( @@ -131,7 +131,6 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.8.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -166,12 +165,12 @@ require ( github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.14.0 // indirect + github.com/spf13/viper v1.15.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.1 // indirect - github.com/subosito/gotenv v1.4.1 // indirect + github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect github.com/tetafro/godot v1.4.11 // indirect @@ -186,22 +185,21 @@ require ( github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.5.0 // indirect + go.opentelemetry.io/build-tools v0.6.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect - golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.5.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/net v0.6.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.0 // indirect mvdan.cc/gofumpt v0.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4e75a3dd4d9..d742491f3ec 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -446,8 +446,6 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= @@ -552,8 +550,8 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= -github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= @@ -574,8 +572,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= @@ -623,16 +621,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.5.0 h1:JIySjVDB/lx/dn6HmPYu7XuGeah7dnaHiKQ0b010Z9w= -go.opentelemetry.io/build-tools v0.5.0/go.mod h1:csnTV1XNFB7X17EoL0f4gOn/GA6oWI2UK282xLbPcY0= -go.opentelemetry.io/build-tools/crosslink v0.5.0 h1:pPYmVcPPIVOImAD/B+L7DJxvgsMl9yGKUOoJAhDKuMQ= -go.opentelemetry.io/build-tools/crosslink v0.5.0/go.mod h1:yFw4oK1CJGd33aHtgN16S6hwa2Ea2q85p7ccNCFASE0= -go.opentelemetry.io/build-tools/dbotconf v0.5.0 h1:/NjV1d/oAh66OKgPWUbNk+g7wL+0MSvd2FYym7enUu0= -go.opentelemetry.io/build-tools/dbotconf v0.5.0/go.mod h1:WoDdnP9n5VbQQhfVvIcy2gs+/W+iyIHnF3hAfugW+ag= -go.opentelemetry.io/build-tools/multimod v0.5.0 h1:rfz1eu2KQ5LxKb1wIb7qxz9u6vQhvKNwbFhqKIWO+gM= -go.opentelemetry.io/build-tools/multimod v0.5.0/go.mod h1:woROlB0sd4i00VYKKDgoa7ro+y2VBwGjk5x2WfgNXqE= -go.opentelemetry.io/build-tools/semconvgen v0.5.0 h1:B2Vt6V+7QS+W1+CoRZeIpaJOp16lIo3XcHDtSL4VFrs= -go.opentelemetry.io/build-tools/semconvgen v0.5.0/go.mod h1:uyEWOiUYoZ42JTzG2JInYtdJVKb51Xp0f3vO6zRPQsk= +go.opentelemetry.io/build-tools v0.6.0 h1:S30zwByGB8iVbdBbUUUmB3yL5spnRRYgPe7kP0E3SP4= +go.opentelemetry.io/build-tools v0.6.0/go.mod h1:ZdVGZ+VzIj7ZrEEbLeNS+RJthf278wLkRE1x0HiLLOM= +go.opentelemetry.io/build-tools/crosslink v0.6.0 h1:cY2BAAwCawRlupEVqcDTXdOr1tDE1J9WGQPgCV/cT4U= +go.opentelemetry.io/build-tools/crosslink v0.6.0/go.mod h1:kqGm9zUqfSnILBnOApA3P1GZTxa+pOMgfrgIBBTRESY= +go.opentelemetry.io/build-tools/dbotconf v0.6.0 h1:qgzfPBhoxIx0LtwaFODY3idqlTn/GQIlIeHIVlPxQDI= +go.opentelemetry.io/build-tools/dbotconf v0.6.0/go.mod h1:Dc1IUsodFA/wZSHtHnEWCs9tN1WYaoS8x5EgxISDFdA= +go.opentelemetry.io/build-tools/multimod v0.6.0 h1:XAmXNQNsfs4Tq9BtWKTY32OvTBgTBzKVn2Bawskjgac= +go.opentelemetry.io/build-tools/multimod v0.6.0/go.mod h1:YgIvurIda661iJ0yJbQWlE62VHLgP4HQJeqCa3uWsBI= +go.opentelemetry.io/build-tools/semconvgen v0.6.0 h1:n4s8fYTIRzUHh+EnJDBo+SlHdKAN/u1CQ3+s58u/rUk= +go.opentelemetry.io/build-tools/semconvgen v0.6.0/go.mod h1:q412C7OAvO/AjCmJL87sLh/lc/lKVwdwcL8zBVYKGIM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -700,8 +698,9 @@ golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -746,8 +745,9 @@ golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -836,16 +836,17 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -856,8 +857,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -941,8 +943,9 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1057,7 +1060,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 68aa5984fdb0b0a0841d48bdfd98233069a948b6 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 13 Feb 2023 16:28:30 +0100 Subject: [PATCH 404/886] update dmathieu's affiliation (#3721) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9371a481ab1..a6928bfdff8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -508,7 +508,7 @@ Approvers: - [David Ashpole](https://github.com/dashpole), Google - [Robert Pająk](https://github.com/pellared), Splunk - [Chester Cheung](https://github.com/hanyuancheung), Tencent -- [Damien Mathieu](https://github.com/dmathieu), Auth0/Okta +- [Damien Mathieu](https://github.com/dmathieu), Elastic Maintainers: From 441a173514a86cebb79abfe02da73953a6cdbad1 Mon Sep 17 00:00:00 2001 From: Anthony Regeda Date: Mon, 13 Feb 2023 17:07:06 +0100 Subject: [PATCH 405/886] No memory leakage in attributes filter (#3695) The attributes filter collects seen attributes in order to avoid filtration on the same attribute set. However, the `attribute.Set` is not comparable type and new allocations of sets with same attributes will be considered as new sets. Metrics with a high cardinality of attributes consume a lot of memory even if we set a filter to reduce that cardinality. Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- sdk/metric/internal/filter.go | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/filter.go index 4d24b62819a..5c60c5e0d0b 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/filter.go @@ -15,8 +15,6 @@ package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" import ( - "sync" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -44,9 +42,6 @@ func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggreg type filter[N int64 | float64] struct { filter attribute.Filter aggregator Aggregator[N] - - sync.Mutex - seen map[attribute.Set]attribute.Set } // newFilter returns an filter Aggregator that wraps agg with the attribute @@ -58,21 +53,13 @@ func newFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) *filte return &filter[N]{ filter: fn, aggregator: agg, - seen: make(map[attribute.Set]attribute.Set), } } // Aggregate records the measurement, scoped by attr, and aggregates it // into an aggregation. func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { - // TODO (#3006): drop stale attributes from seen. - f.Lock() - defer f.Unlock() - fAttr, ok := f.seen[attr] - if !ok { - fAttr, _ = attr.Filter(f.filter) - f.seen[attr] = fAttr - } + fAttr, _ := attr.Filter(f.filter) f.aggregator.Aggregate(measurement, fAttr) } @@ -90,9 +77,6 @@ func (f *filter[N]) Aggregation() metricdata.Aggregation { type precomputedFilter[N int64 | float64] struct { filter attribute.Filter aggregator precomputeAggregator[N] - - sync.Mutex - seen map[attribute.Set]attribute.Set } // newPrecomputedFilter returns a precomputedFilter Aggregator that wraps agg @@ -104,21 +88,13 @@ func newPrecomputedFilter[N int64 | float64](agg precomputeAggregator[N], fn att return &precomputedFilter[N]{ filter: fn, aggregator: agg, - seen: make(map[attribute.Set]attribute.Set), } } // Aggregate records the measurement, scoped by attr, and aggregates it // into an aggregation. func (f *precomputedFilter[N]) Aggregate(measurement N, attr attribute.Set) { - // TODO (#3006): drop stale attributes from seen. - f.Lock() - defer f.Unlock() - fAttr, ok := f.seen[attr] - if !ok { - fAttr, _ = attr.Filter(f.filter) - f.seen[attr] = fAttr - } + fAttr, _ := attr.Filter(f.filter) if fAttr.Equals(&attr) { // No filtering done. f.aggregator.Aggregate(measurement, fAttr) From f3b4813f2fb813a73f3e9d565ed29d73bc26b3c7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Feb 2023 13:51:11 -0800 Subject: [PATCH 406/886] Add semconv/v1.18.0 (#3719) * Add semconv/v1.18.0 * Add PR number to changelog --- CHANGELOG.md | 17 + semconv/v1.18.0/doc.go | 20 + semconv/v1.18.0/event.go | 199 ++ semconv/v1.18.0/exception.go | 20 + semconv/v1.18.0/http.go | 21 + semconv/v1.18.0/httpconv/http.go | 150 ++ semconv/v1.18.0/netconv/net.go | 66 + semconv/v1.18.0/resource.go | 2010 ++++++++++++++++++ semconv/v1.18.0/schema.go | 20 + semconv/v1.18.0/trace.go | 3381 ++++++++++++++++++++++++++++++ 10 files changed, 5904 insertions(+) create mode 100644 semconv/v1.18.0/doc.go create mode 100644 semconv/v1.18.0/event.go create mode 100644 semconv/v1.18.0/exception.go create mode 100644 semconv/v1.18.0/http.go create mode 100644 semconv/v1.18.0/httpconv/http.go create mode 100644 semconv/v1.18.0/netconv/net.go create mode 100644 semconv/v1.18.0/resource.go create mode 100644 semconv/v1.18.0/schema.go create mode 100644 semconv/v1.18.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index fd6535ce587..a5933037745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,23 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Semantic conventions of the `event` type are now generated. (#3697) - The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) - Support [Go 1.20]. (#3693) +- The `go.opentelemetry.io/otel/semconv/v1.18.0` package. + The package contains semantic conventions from the `v1.18.0` version of the OpenTelemetry specification. (#3719) + - The following `const` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeNameKey` -> `OTelScopeNameKey` + - `OtelScopeVersionKey` -> `OTelScopeVersionKey` + - `OtelLibraryNameKey` -> `OTelLibraryNameKey` + - `OtelLibraryVersionKey` -> `OTelLibraryVersionKey` + - `OtelStatusCodeKey` -> `OTelStatusCodeKey` + - `OtelStatusDescriptionKey` -> `OTelStatusDescriptionKey` + - `OtelStatusCodeOk` -> `OTelStatusCodeOk` + - `OtelStatusCodeError` -> `OTelStatusCodeError` + - The following `func` renames from `go.opentelemetry.io/otel/semconv/v1.17.0` are included: + - `OtelScopeName` -> `OTelScopeName` + - `OtelScopeVersion` -> `OTelScopeVersion` + - `OtelLibraryName` -> `OTelLibraryName` + - `OtelLibraryVersion` -> `OTelLibraryVersion` + - `OtelStatusDescription` -> `OTelStatusDescription` ## [1.13.0/0.36.0] 2023-02-07 diff --git a/semconv/v1.18.0/doc.go b/semconv/v1.18.0/doc.go new file mode 100644 index 00000000000..c04575a99bd --- /dev/null +++ b/semconv/v1.18.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.18.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" diff --git a/semconv/v1.18.0/event.go b/semconv/v1.18.0/event.go new file mode 100644 index 00000000000..69856f47578 --- /dev/null +++ b/semconv/v1.18.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.18.0/exception.go b/semconv/v1.18.0/exception.go new file mode 100644 index 00000000000..37d098790b9 --- /dev/null +++ b/semconv/v1.18.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.18.0/http.go b/semconv/v1.18.0/http.go new file mode 100644 index 00000000000..b55f271f7bc --- /dev/null +++ b/semconv/v1.18.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.18.0/httpconv/http.go b/semconv/v1.18.0/httpconv/http.go new file mode 100644 index 00000000000..98f6e078ed1 --- /dev/null +++ b/semconv/v1.18.0/httpconv/http.go @@ -0,0 +1,150 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry semantic convetions for the net/http +// package from the standard library. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.18.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.18.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + HTTPUserAgentKey: semconv.HTTPUserAgentKey, + } +) + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. It will return the following attributes if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp *http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the http.user_agent attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.18.0/netconv/net.go b/semconv/v1.18.0/netconv/net.go new file mode 100644 index 00000000000..aaa2a5a9bc4 --- /dev/null +++ b/semconv/v1.18.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry semantic convetions for the net +// package from the standard library. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.18.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v2" + semconv "go.opentelemetry.io/otel/semconv/v1.18.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns an attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.18.0/resource.go b/semconv/v1.18.0/resource.go new file mode 100644 index 00000000000..93834db79f3 --- /dev/null +++ b/semconv/v1.18.0/resource.go @@ -0,0 +1,2010 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserUserAgentKey is the attribute Key conforming to the + // "browser.user_agent" semantic conventions. It represents the full + // user-agent string provided by the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) + // AppleWebKit/537.36 (KHTML, ' + // 'like Gecko) Chrome/95.0.4638.54 Safari/537.36' + // Note: The user-agent value SHOULD be provided only from browsers that do + // not have a mechanism to retrieve brands and platform individually from + // the User-Agent Client Hints API. To retrieve the value, the legacy + // `navigator.userAgent` API can be used. + BrowserUserAgentKey = attribute.Key("browser.user_agent") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserUserAgent returns an attribute KeyValue conforming to the +// "browser.user_agent" semantic conventions. It represents the full user-agent +// string provided by the browser +func BrowserUserAgent(val string) attribute.KeyValue { + return BrowserUserAgentKey.String(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://intl.cloud.tencent.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `faas.id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSIDKey is the attribute Key conforming to the "faas.id" semantic + // conventions. It represents the unique ID of the single function that + // this runtime instance executes. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-west-2:123456789012:function:my-function' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so consider setting `faas.id` as a span attribute instead. + // + // The exact value to use for `faas.id` depends on the cloud provider: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + FaaSIDKey = attribute.Key("faas.id") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function in MiB. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 128 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSID returns an attribute KeyValue conforming to the "faas.id" semantic +// conventions. It represents the unique ID of the single function that this +// runtime instance executes. +func FaaSID(val string) attribute.KeyValue { + return FaaSIDKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function in MiB. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a general computing instance. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // Linux systems, the `machine-id` located in `/etc/machine-id` or + // `/var/lib/dbus/machine-id` may be used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized Linux +// systems, the `machine-id` located in `/etc/machine-id` or +// `/var/lib/dbus/machine-id` may be used. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.18.0/schema.go b/semconv/v1.18.0/schema.go new file mode 100644 index 00000000000..d416b1e585f --- /dev/null +++ b/semconv/v1.18.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.18.0" diff --git a/semconv/v1.18.0/trace.go b/semconv/v1.18.0/trace.go new file mode 100644 index 00000000000..e73f3f2d573 --- /dev/null +++ b/semconv/v1.18.0/trace.go @@ -0,0 +1,3381 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.18.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `faas.id` if an alias is involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not + // explicitly disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function execution. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSExecutionKey is the attribute Key conforming to the "faas.execution" + // semantic conventions. It represents the execution ID of the current + // function execution. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSExecutionKey = attribute.Key("faas.execution") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSExecution returns an attribute KeyValue conforming to the +// "faas.execution" semantic conventions. It represents the execution ID of the +// current function execution. +func FaaSExecution(val string) attribute.KeyValue { + return FaaSExecutionKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetAppProtocolNameKey is the attribute Key conforming to the + // "net.app.protocol.name" semantic conventions. It represents the + // application layer protocol used. The value SHOULD be normalized to + // lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + + // NetAppProtocolVersionKey is the attribute Key conforming to the + // "net.app.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.host.port` and if `net.sock.host.addr` is set.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetAppProtocolName returns an attribute KeyValue conforming to the +// "net.app.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetAppProtocolName(val string) attribute.KeyValue { + return NetAppProtocolNameKey.String(val) +} + +// NetAppProtocolVersion returns an attribute KeyValue conforming to the +// "net.app.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetAppProtocolVersion(val string) attribute.KeyValue { + return NetAppProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. It represents the kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: If `net.transport` is not specified, it can be assumed to be + // `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is + // assumed. + HTTPFlavorKey = attribute.Key("http.flavor") + + // HTTPUserAgentKey is the attribute Key conforming to the + // "http.user_agent" semantic conventions. It represents the value of the + // [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + HTTPUserAgentKey = attribute.Key("http.user_agent") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPUserAgent returns an attribute KeyValue conforming to the +// "http.user_agent" semantic conventions. It represents the value of the [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func HTTPUserAgent(val string) attribute.KeyValue { + return HTTPUserAgentKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// Semantic Convention for HTTP Server +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application root](#http-server-definitions) if there + // is one. + HTTPRouteKey = attribute.Key("http.route") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationKindKey is the attribute Key conforming to the + // "messaging.destination.kind" semantic conventions. It represents the + // kind of message destination + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceKindKey is the attribute Key conforming to the + // "messaging.source.kind" semantic conventions. It represents the kind of + // message source + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingSourceKindKey = attribute.Key("messaging.source.kind") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +var ( + // A message received from a queue + MessagingSourceKindQueue = MessagingSourceKindKey.String("queue") + // A message received from a topic + MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} From 68975917e5d8bfec0fe44860dfa2f7b1f1ed442d Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Tue, 14 Feb 2023 11:01:55 -0500 Subject: [PATCH 407/886] [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders (#3679) * [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders Signed-off-by: Yuri Shkuro * changelog * go mod tidy * format * fix deps * delint * simplify * undo * Fix changelog * Move new tests under test/ * go fmt * delint Signed-off-by: Yuri Shkuro --------- Signed-off-by: Yuri Shkuro Co-authored-by: Chester Cheung --- .github/dependabot.yml | 9 ++ CHANGELOG.md | 4 + bridge/opentracing/bridge.go | 40 ++++----- bridge/opentracing/bridge_test.go | 7 ++ bridge/opentracing/go.mod | 4 +- bridge/opentracing/test/bridge_grpc_test.go | 99 +++++++++++++++++++++ bridge/opentracing/test/go.mod | 33 +++++++ bridge/opentracing/test/go.sum | 73 +++++++++++++++ 8 files changed, 247 insertions(+), 22 deletions(-) create mode 100644 bridge/opentracing/test/bridge_grpc_test.go create mode 100644 bridge/opentracing/test/go.mod create mode 100644 bridge/opentracing/test/go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2afaca1dd60..8dcd4f9dd90 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -55,6 +55,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /bridge/opentracing/test + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/fib labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index a5933037745..9e65a0750bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OtelLibraryVersion` -> `OTelLibraryVersion` - `OtelStatusDescription` -> `OTelStatusDescription` +### Changed + +- [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders. (#3679) + ## [1.13.0/0.36.0] 2023-02-07 ### Added diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 39b19276881..4fcb532f04a 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -661,24 +661,24 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int } var textCarrier propagation.TextMapCarrier + var err error switch builtinFormat { case ot.HTTPHeaders: - hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) - if !ok { - return ot.ErrInvalidCarrier + if hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier); ok { + textCarrier = propagation.HeaderCarrier(hhcarrier) + } else { + textCarrier, err = newTextMapWrapperForInject(carrier) } - - textCarrier = propagation.HeaderCarrier(hhcarrier) case ot.TextMap: if textCarrier, ok = carrier.(propagation.TextMapCarrier); !ok { - var err error - if textCarrier, err = newTextMapWrapperForInject(carrier); err != nil { - return err - } + textCarrier, err = newTextMapWrapperForInject(carrier) } default: - return ot.ErrUnsupportedFormat + err = ot.ErrUnsupportedFormat + } + if err != nil { + return err } fs := fakeSpan{ @@ -702,24 +702,24 @@ func (t *BridgeTracer) Extract(format interface{}, carrier interface{}) (ot.Span } var textCarrier propagation.TextMapCarrier + var err error switch builtinFormat { case ot.HTTPHeaders: - hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier) - if !ok { - return nil, ot.ErrInvalidCarrier + if hhcarrier, ok := carrier.(ot.HTTPHeadersCarrier); ok { + textCarrier = propagation.HeaderCarrier(hhcarrier) + } else { + textCarrier, err = newTextMapWrapperForExtract(carrier) } - - textCarrier = propagation.HeaderCarrier(hhcarrier) case ot.TextMap: if textCarrier, ok = carrier.(propagation.TextMapCarrier); !ok { - var err error - if textCarrier, err = newTextMapWrapperForExtract(carrier); err != nil { - return nil, err - } + textCarrier, err = newTextMapWrapperForExtract(carrier) } default: - return nil, ot.ErrUnsupportedFormat + err = ot.ErrUnsupportedFormat + } + if err != nil { + return nil, err } ctx := t.getPropagator().Extract(context.Background(), textCarrier) diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 6b80da9004d..696f406371b 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -26,6 +26,7 @@ import ( ot "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" @@ -200,6 +201,8 @@ type textMapCarrier struct { m map[string]string } +var _ propagation.TextMapCarrier = (*textMapCarrier)(nil) + func newTextCarrier() *textMapCarrier { return &textMapCarrier{m: map[string]string{}} } @@ -358,6 +361,10 @@ func TestBridgeTracer_ExtractAndInject(t *testing.T) { if tc.extractErr == nil { bsc, ok := spanContext.(*bridgeSpanContext) assert.True(t, ok) + require.NotNil(t, bsc) + require.NotNil(t, bsc.otelSpanContext) + require.NotNil(t, bsc.otelSpanContext.SpanID()) + require.NotNil(t, bsc.otelSpanContext.TraceID()) assert.Equal(t, spanID.String(), bsc.otelSpanContext.SpanID().String()) assert.Equal(t, traceID.String(), bsc.otelSpanContext.TraceID().String()) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 3357a1a6aa2..fe2df7fba73 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -4,6 +4,8 @@ go 1.18 replace go.opentelemetry.io/otel => ../.. +replace go.opentelemetry.io/otel/trace => ../../trace + require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.1 @@ -18,5 +20,3 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/bridge/opentracing/test/bridge_grpc_test.go b/bridge/opentracing/test/bridge_grpc_test.go new file mode 100644 index 00000000000..4843cbfd260 --- /dev/null +++ b/bridge/opentracing/test/bridge_grpc_test.go @@ -0,0 +1,99 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package test + +import ( + "context" + "net" + "testing" + "time" + + otgrpc "github.com/opentracing-contrib/go-grpc" + testpb "github.com/opentracing-contrib/go-grpc/test/otgrpc_testing" + ot "github.com/opentracing/opentracing-go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + + ototel "go.opentelemetry.io/otel/bridge/opentracing" + "go.opentelemetry.io/otel/bridge/opentracing/internal" + "go.opentelemetry.io/otel/propagation" +) + +type testGRPCServer struct{} + +func (*testGRPCServer) UnaryCall(ctx context.Context, r *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + return &testpb.SimpleResponse{Payload: r.Payload * 2}, nil +} +func (*testGRPCServer) StreamingOutputCall(*testpb.SimpleRequest, testpb.TestService_StreamingOutputCallServer) error { + return nil +} +func (*testGRPCServer) StreamingInputCall(testpb.TestService_StreamingInputCallServer) error { + return nil +} +func (*testGRPCServer) StreamingBidirectionalCall(testpb.TestService_StreamingBidirectionalCallServer) error { + return nil +} + +func startTestGRPCServer(t *testing.T, tracer ot.Tracer) (*grpc.Server, net.Addr) { + lis, _ := net.Listen("tcp", ":0") + server := grpc.NewServer( + grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)), + ) + testpb.RegisterTestServiceServer(server, &testGRPCServer{}) + + go func() { + err := server.Serve(lis) + require.NoError(t, err) + }() + + return server, lis.Addr() +} + +func TestBridgeTracer_ExtractAndInject_gRPC(t *testing.T) { + tracer := internal.NewMockTracer() + + bridge := ototel.NewBridgeTracer() + bridge.SetOpenTelemetryTracer(tracer) + bridge.SetTextMapPropagator(propagation.TraceContext{}) + + srv, addr := startTestGRPCServer(t, bridge) + defer srv.Stop() + + conn, err := grpc.Dial( + addr.String(), + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithUnaryInterceptor(otgrpc.OpenTracingClientInterceptor(bridge)), + ) + require.NoError(t, err) + cli := testpb.NewTestServiceClient(conn) + + ctx, cx := context.WithTimeout(context.Background(), 10*time.Second) + defer cx() + res, err := cli.UnaryCall(ctx, &testpb.SimpleRequest{Payload: 42}) + require.NoError(t, err) + assert.EqualValues(t, 84, res.Payload) + + checkSpans := func() bool { + return len(tracer.FinishedSpans) == 2 + } + require.Eventuallyf(t, checkSpans, 5*time.Second, 5*time.Millisecond, "expecting two spans") + assert.Equal(t, + tracer.FinishedSpans[0].SpanContext().TraceID(), + tracer.FinishedSpans[1].SpanContext().TraceID(), + "expecting same trace ID", + ) +} diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod new file mode 100644 index 00000000000..9a19f3fb744 --- /dev/null +++ b/bridge/opentracing/test/go.mod @@ -0,0 +1,33 @@ +module go.opentelemetry.io/otel/bridge/opentracing/test + +go 1.18 + +replace go.opentelemetry.io/otel => ../../.. + +replace go.opentelemetry.io/otel/bridge/opentracing => ../ + +replace go.opentelemetry.io/otel/trace => ../../../trace + +require ( + github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e + github.com/opentracing/opentracing-go v1.2.0 + github.com/stretchr/testify v1.8.1 + go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel/bridge/opentracing v0.0.0-00010101000000-000000000000 + google.golang.org/grpc v1.52.3 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.13.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/sys v0.3.0 // indirect + golang.org/x/text v0.5.0 // indirect + google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum new file mode 100644 index 00000000000..08d2d6330bc --- /dev/null +++ b/bridge/opentracing/test/go.sum @@ -0,0 +1,73 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= +github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e h1:4cPxUYdgaGzZIT5/j0IfqOrrXmq6bG8AwvwisMXpdrg= +github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= +google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= +google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 0062bb65ce61e3e2d8966328ecbfab60feb0eee7 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Tue, 14 Feb 2023 08:52:06 -0800 Subject: [PATCH 408/886] dependabot updates Tue Feb 14 16:33:36 UTC 2023 (#3729) Bump go.uber.org/goleak from 1.2.0 to 1.2.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.52.3 to 1.53.0 in /bridge/opentracing/test --- bridge/opentracing/test/go.mod | 10 +++++----- bridge/opentracing/test/go.sum | 20 +++++++++---------- example/otel-collector/go.sum | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 6 ++---- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 9a19f3fb744..9da187e728c 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/bridge/opentracing v0.0.0-00010101000000-000000000000 - google.golang.org/grpc v1.52.3 + google.golang.org/grpc v1.53.0 ) require ( @@ -24,10 +24,10 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.4.0 // indirect - golang.org/x/sys v0.3.0 // indirect - golang.org/x/text v0.5.0 // indirect - google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 08d2d6330bc..829243724fe 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -40,26 +40,26 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 h1:a2S6M0+660BgMNl++4JPlcAO/CjkqYItDEZwkoDQK7c= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 15e4c908fc5..6b683875532 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -158,7 +158,7 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index bca43b3790d..8e1e7b58571 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/proto/otlp v0.19.0 - go.uber.org/goleak v1.2.0 + go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index ea370d15f7f..507919a7103 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -166,8 +166,8 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= +go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -194,7 +194,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -329,7 +328,6 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From d68b05fbeecb0112da0b5614a78b0187a4a0ad7a Mon Sep 17 00:00:00 2001 From: Peter Liu Date: Thu, 16 Feb 2023 02:37:07 +0800 Subject: [PATCH 409/886] Refactor package `internal/attribute` to not use generics. (#3725) * remove generics Signed-off-by: Peter Liu * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * Update internal/attribute/attribute.go Co-authored-by: Damien Mathieu <42@dmathieu.com> * refactor unit test Signed-off-by: Peter Liu * add changelog Signed-off-by: Peter Liu * update changelog Signed-off-by: Peter Liu * Update internal/attribute/attribute.go Co-authored-by: Tyler Yahn * replace interface{} with any Signed-off-by: Peter Liu --------- Signed-off-by: Peter Liu Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++ attribute/value.go | 16 ++--- internal/attribute/attribute.go | 82 ++++++++++++++++++--- internal/attribute/attribute_test.go | 103 +++++++++++++++++++++++++++ 4 files changed, 189 insertions(+), 16 deletions(-) create mode 100644 internal/attribute/attribute_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e65a0750bf..f387a0cb6ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders. (#3679) +### Fixed + +- Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) + ## [1.13.0/0.36.0] 2023-02-07 ### Added diff --git a/attribute/value.go b/attribute/value.go index 34a4e548dd1..cb21dd5c096 100644 --- a/attribute/value.go +++ b/attribute/value.go @@ -68,7 +68,7 @@ func BoolValue(v bool) Value { // BoolSliceValue creates a BOOLSLICE Value. func BoolSliceValue(v []bool) Value { - return Value{vtype: BOOLSLICE, slice: attribute.SliceValue(v)} + return Value{vtype: BOOLSLICE, slice: attribute.BoolSliceValue(v)} } // IntValue creates an INT64 Value. @@ -99,7 +99,7 @@ func Int64Value(v int64) Value { // Int64SliceValue creates an INT64SLICE Value. func Int64SliceValue(v []int64) Value { - return Value{vtype: INT64SLICE, slice: attribute.SliceValue(v)} + return Value{vtype: INT64SLICE, slice: attribute.Int64SliceValue(v)} } // Float64Value creates a FLOAT64 Value. @@ -112,7 +112,7 @@ func Float64Value(v float64) Value { // Float64SliceValue creates a FLOAT64SLICE Value. func Float64SliceValue(v []float64) Value { - return Value{vtype: FLOAT64SLICE, slice: attribute.SliceValue(v)} + return Value{vtype: FLOAT64SLICE, slice: attribute.Float64SliceValue(v)} } // StringValue creates a STRING Value. @@ -125,7 +125,7 @@ func StringValue(v string) Value { // StringSliceValue creates a STRINGSLICE Value. func StringSliceValue(v []string) Value { - return Value{vtype: STRINGSLICE, slice: attribute.SliceValue(v)} + return Value{vtype: STRINGSLICE, slice: attribute.StringSliceValue(v)} } // Type returns a type of the Value. @@ -149,7 +149,7 @@ func (v Value) AsBoolSlice() []bool { } func (v Value) asBoolSlice() []bool { - return attribute.AsSlice[bool](v.slice) + return attribute.AsBoolSlice(v.slice) } // AsInt64 returns the int64 value. Make sure that the Value's type is @@ -168,7 +168,7 @@ func (v Value) AsInt64Slice() []int64 { } func (v Value) asInt64Slice() []int64 { - return attribute.AsSlice[int64](v.slice) + return attribute.AsInt64Slice(v.slice) } // AsFloat64 returns the float64 value. Make sure that the Value's @@ -187,7 +187,7 @@ func (v Value) AsFloat64Slice() []float64 { } func (v Value) asFloat64Slice() []float64 { - return attribute.AsSlice[float64](v.slice) + return attribute.AsFloat64Slice(v.slice) } // AsString returns the string value. Make sure that the Value's type @@ -206,7 +206,7 @@ func (v Value) AsStringSlice() []string { } func (v Value) asStringSlice() []string { - return attribute.AsSlice[string](v.slice) + return attribute.AsStringSlice(v.slice) } type unknownValueType struct{} diff --git a/internal/attribute/attribute.go b/internal/attribute/attribute.go index 22034894473..622c3ee3f27 100644 --- a/internal/attribute/attribute.go +++ b/internal/attribute/attribute.go @@ -22,24 +22,90 @@ import ( "reflect" ) -// SliceValue convert a slice into an array with same elements as slice. -func SliceValue[T bool | int64 | float64 | string](v []T) any { - var zero T +// BoolSliceValue converts a bool slice into an array with same elements as slice. +func BoolSliceValue(v []bool) interface{} { + var zero bool cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) - copy(cp.Elem().Slice(0, len(v)).Interface().([]T), v) + copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v) return cp.Elem().Interface() } -// AsSlice convert an array into a slice into with same elements as array. -func AsSlice[T bool | int64 | float64 | string](v any) []T { +// Int64SliceValue converts an int64 slice into an array with same elements as slice. +func Int64SliceValue(v []int64) interface{} { + var zero int64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v) + return cp.Elem().Interface() +} + +// Float64SliceValue converts a float64 slice into an array with same elements as slice. +func Float64SliceValue(v []float64) interface{} { + var zero float64 + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v) + return cp.Elem().Interface() +} + +// StringSliceValue converts a string slice into an array with same elements as slice. +func StringSliceValue(v []string) interface{} { + var zero string + cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))) + copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v) + return cp.Elem().Interface() +} + +// AsBoolSlice converts a bool array into a slice into with same elements as array. +func AsBoolSlice(v interface{}) []bool { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero bool + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]bool) +} + +// AsInt64Slice converts an int64 array into a slice into with same elements as array. +func AsInt64Slice(v interface{}) []int64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero int64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]int64) +} + +// AsFloat64Slice converts a float64 array into a slice into with same elements as array. +func AsFloat64Slice(v interface{}) []float64 { + rv := reflect.ValueOf(v) + if rv.Type().Kind() != reflect.Array { + return nil + } + var zero float64 + correctLen := rv.Len() + correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) + cpy := reflect.New(correctType) + _ = reflect.Copy(cpy.Elem(), rv) + return cpy.Elem().Slice(0, correctLen).Interface().([]float64) +} + +// AsStringSlice converts a string array into a slice into with same elements as array. +func AsStringSlice(v interface{}) []string { rv := reflect.ValueOf(v) if rv.Type().Kind() != reflect.Array { return nil } - var zero T + var zero string correctLen := rv.Len() correctType := reflect.ArrayOf(correctLen, reflect.TypeOf(zero)) cpy := reflect.New(correctType) _ = reflect.Copy(cpy.Elem(), rv) - return cpy.Elem().Slice(0, correctLen).Interface().([]T) + return cpy.Elem().Slice(0, correctLen).Interface().([]string) } diff --git a/internal/attribute/attribute_test.go b/internal/attribute/attribute_test.go new file mode 100644 index 00000000000..3cba91173de --- /dev/null +++ b/internal/attribute/attribute_test.go @@ -0,0 +1,103 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute + +import ( + "reflect" + "testing" +) + +var wrapFloat64SliceValue = func(v interface{}) interface{} { + if vi, ok := v.([]float64); ok { + return Float64SliceValue(vi) + } + return nil +} + +var wrapInt64SliceValue = func(v interface{}) interface{} { + if vi, ok := v.([]int64); ok { + return Int64SliceValue(vi) + } + return nil +} + +var wrapBoolSliceValue = func(v interface{}) interface{} { + if vi, ok := v.([]bool); ok { + return BoolSliceValue(vi) + } + return nil +} +var wrapStringSliceValue = func(v interface{}) interface{} { + if vi, ok := v.([]string); ok { + return StringSliceValue(vi) + } + return nil +} +var wrapAsBoolSlice = func(v interface{}) interface{} { return AsBoolSlice(v) } +var wrapAsInt64Slice = func(v interface{}) interface{} { return AsInt64Slice(v) } +var wrapAsFloat64Slice = func(v interface{}) interface{} { return AsFloat64Slice(v) } +var wrapAsStringSlice = func(v interface{}) interface{} { return AsStringSlice(v) } + +func TestSliceValue(t *testing.T) { + type args struct { + v interface{} + } + tests := []struct { + name string + args args + want interface{} + fn func(interface{}) interface{} + }{ + { + name: "Float64SliceValue() two items", + args: args{v: []float64{1, 2.3}}, want: [2]float64{1, 2.3}, fn: wrapFloat64SliceValue, + }, + { + name: "Int64SliceValue() two items", + args: args{[]int64{1, 2}}, want: [2]int64{1, 2}, fn: wrapInt64SliceValue, + }, + { + name: "BoolSliceValue() two items", + args: args{v: []bool{true, false}}, want: [2]bool{true, false}, fn: wrapBoolSliceValue, + }, + { + name: "StringSliceValue() two items", + args: args{[]string{"123", "2"}}, want: [2]string{"123", "2"}, fn: wrapStringSliceValue, + }, + { + name: "AsBoolSlice() two items", + args: args{[2]bool{true, false}}, want: []bool{true, false}, fn: wrapAsBoolSlice, + }, + { + name: "AsInt64Slice() two items", + args: args{[2]int64{1, 3}}, want: []int64{1, 3}, fn: wrapAsInt64Slice, + }, + { + name: "AsFloat64Slice() two items", + args: args{[2]float64{1.2, 3.1}}, want: []float64{1.2, 3.1}, fn: wrapAsFloat64Slice, + }, + { + name: "AsStringSlice() two items", + args: args{[2]string{"1234", "12"}}, want: []string{"1234", "12"}, fn: wrapAsStringSlice, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.fn(tt.args.v); !reflect.DeepEqual(got, tt.want) { + t.Errorf("got %v, want %v", got, tt.want) + } + }) + } +} From 80f187fd0d3eec870612c54b93cbf2981991455b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 16 Feb 2023 08:33:12 -0800 Subject: [PATCH 410/886] Bump CI default version of Go to 1.20 (#3733) * Bump CI default version of Go to 1.20 * Use crypto/rand in Jaeger exporter testing * Use crypto/rand Reader in otlp exporters * Remove use of dep rand.Seed in prometheus exporter * Update changelog with public changes * Quote DEFAULT_GO_VERSION value * Update .github/workflows/ci.yml * Update CHANGELOG.md Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> --- .github/workflows/ci.yml | 10 ++++++++-- CHANGELOG.md | 1 + example/prometheus/main.go | 7 ++----- .../jaeger/reconnecting_udp_client_test.go | 2 +- .../otlp/otlpmetric/internal/otest/collector.go | 17 ++++------------- .../otlptrace/otlptracehttp/certificate_test.go | 17 ++++------------- 6 files changed, 20 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44b052ca964..b693d70e2a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,14 @@ on: env: # Path to where test results will be saved. TEST_RESULTS: /tmp/test-results - # Default minimum version of Go to support. - DEFAULT_GO_VERSION: 1.19 + # Default version of Go to use by CI workflows. This should be the latest + # release of Go; developers likely use the latest release in development and + # we want to catch any bugs (e.g. lint errors, race detection) with this + # release before they are merged. The Go compatibility guarantees ensure + # backwards compatibility with the previous two minor releases and we + # explicitly test our code for these versions so keeping this at prior + # versions does not add value. + DEFAULT_GO_VERSION: "1.20" jobs: lint: runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index f387a0cb6ea..55ef3eec7e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) +- Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 5c02d01c9b5..652140d9442 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -33,11 +33,8 @@ import ( "go.opentelemetry.io/otel/sdk/metric" ) -func init() { - rand.Seed(time.Now().UnixNano()) -} - func main() { + rng := rand.New(rand.NewSource(time.Now().UnixNano())) ctx := context.Background() // The exporter embeds a default OpenTelemetry Reader and @@ -70,7 +67,7 @@ func main() { log.Fatal(err) } _, err = meter.RegisterCallback(func(_ context.Context, o api.Observer) error { - n := -10. + rand.Float64()*(90.) // [-10, 100) + n := -10. + rng.Float64()*(90.) // [-10, 100) o.ObserveFloat64(gauge, n, attrs...) return nil }, gauge) diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go index 958f6400baf..d416b0b3ad3 100644 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ b/exporters/jaeger/reconnecting_udp_client_test.go @@ -16,8 +16,8 @@ package jaeger import ( "context" + "crypto/rand" "fmt" - "math/rand" "net" "testing" "time" diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index 50ebd8e013a..e14f486f5bd 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -20,7 +20,7 @@ import ( "context" "crypto/ecdsa" "crypto/elliptic" - cryptorand "crypto/rand" + "crypto/rand" "crypto/tls" "crypto/x509" "crypto/x509/pkix" // nolint:depguard // This is for testing. @@ -29,7 +29,6 @@ import ( "fmt" "io" "math/big" - mathrand "math/rand" "net" "net/http" "net/url" @@ -389,25 +388,17 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { } } -type mathRandReader struct{} - -func (mathRandReader) Read(p []byte) (n int, err error) { - return mathrand.Read(p) -} - -var randReader mathRandReader - // Based on https://golang.org/src/crypto/tls/generate_cert.go, // simplified and weakened. func weakCertificate() (tls.Certificate, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader) + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return tls.Certificate{}, err } notBefore := time.Now() notAfter := notBefore.Add(time.Hour) max := new(big.Int).Lsh(big.NewInt(1), 128) - sn, err := cryptorand.Int(randReader, max) + sn, err := rand.Int(rand.Reader, max) if err != nil { return tls.Certificate{}, err } @@ -422,7 +413,7 @@ func weakCertificate() (tls.Certificate, error) { DNSNames: []string{"localhost"}, IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, } - derBytes, err := x509.CreateCertificate(randReader, &tmpl, &tmpl, &priv.PublicKey, priv) + derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) if err != nil { return tls.Certificate{}, err } diff --git a/exporters/otlp/otlptrace/otlptracehttp/certificate_test.go b/exporters/otlp/otlptrace/otlptracehttp/certificate_test.go index 92f89cc3b29..b164d754381 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/certificate_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/certificate_test.go @@ -18,24 +18,15 @@ import ( "bytes" "crypto/ecdsa" "crypto/elliptic" - cryptorand "crypto/rand" + "crypto/rand" "crypto/x509" "crypto/x509/pkix" "encoding/pem" "math/big" - mathrand "math/rand" "net" "time" ) -type mathRandReader struct{} - -func (mathRandReader) Read(p []byte) (n int, err error) { - return mathrand.Read(p) -} - -var randReader mathRandReader - type pemCertificate struct { Certificate []byte PrivateKey []byte @@ -44,7 +35,7 @@ type pemCertificate struct { // Based on https://golang.org/src/crypto/tls/generate_cert.go, // simplified and weakened. func generateWeakCertificate() (*pemCertificate, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), randReader) + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) if err != nil { return nil, err } @@ -52,7 +43,7 @@ func generateWeakCertificate() (*pemCertificate, error) { notBefore := time.Now() notAfter := notBefore.Add(time.Hour) serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := cryptorand.Int(randReader, serialNumberLimit) + serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) if err != nil { return nil, err } @@ -69,7 +60,7 @@ func generateWeakCertificate() (*pemCertificate, error) { DNSNames: []string{"localhost"}, IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, } - derBytes, err := x509.CreateCertificate(randReader, &template, &template, &priv.PublicKey, priv) + derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) if err != nil { return nil, err } From c1802c213e8debf8388f44ba2ec72aaacd4a19f2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 16 Feb 2023 12:04:19 -0800 Subject: [PATCH 411/886] Rename instrumentationName param of Meter method (#3734) Rename to name to match our trace API and the metric specification. --- metric/meter.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metric/meter.go b/metric/meter.go index f1e917e9329..2f69d2ae54f 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -26,12 +26,12 @@ import ( // // Warning: methods may be added to this interface in minor releases. type MeterProvider interface { - // Meter creates an instance of a `Meter` interface. The instrumentationName - // must be the name of the library providing instrumentation. This name may - // be the same as the instrumented code only if that code provides built-in - // instrumentation. If the instrumentationName is empty, then a - // implementation defined default name will be used instead. - Meter(instrumentationName string, opts ...MeterOption) Meter + // Meter creates an instance of a `Meter` interface. The name must be the + // name of the library providing instrumentation. This name may be the same + // as the instrumented code only if that code provides built-in + // instrumentation. If the name is empty, then a implementation defined + // default name will be used instead. + Meter(name string, opts ...MeterOption) Meter } // Meter provides access to instrument instances for recording metrics. From 02527343096752730990be8d969f5e8bc294ffc9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 16 Feb 2023 13:33:56 -0800 Subject: [PATCH 412/886] Rename instrumentID to streamID in metric SDK (#3735) An instrument is defined by a name, description, unit, and kind. The instrumentID contains more identifying information than these fields. The additional information it contains relate to what the OTel metric data-model calls a stream. Match the terminology and remove using the instrumentID name in case we want to use it for something else (say, when caching instruments). --- sdk/metric/cache.go | 20 ++++++++++---------- sdk/metric/instrument.go | 18 +++++++++--------- sdk/metric/meter.go | 2 +- sdk/metric/pipeline.go | 8 ++++---- sdk/metric/pipeline_registry_test.go | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sdk/metric/cache.go b/sdk/metric/cache.go index b75e7ea5402..70e2937678a 100644 --- a/sdk/metric/cache.go +++ b/sdk/metric/cache.go @@ -61,21 +61,21 @@ func (c *cache[K, V]) Lookup(key K, f func() V) V { type instrumentCache[N int64 | float64] struct { // aggregators is used to ensure duplicate creations of the same instrument // return the same instance of that instrument's aggregator. - aggregators *cache[instrumentID, aggVal[N]] + aggregators *cache[streamID, aggVal[N]] // views is used to ensure if instruments with the same name are created, // but do not have the same identifying properties, a warning is logged. - views *cache[string, instrumentID] + views *cache[string, streamID] } // newInstrumentCache returns a new instrumentCache that uses ac as the // underlying cache for aggregators and vc as the cache for views. If ac or vc // are nil, a new empty cache will be used. -func newInstrumentCache[N int64 | float64](ac *cache[instrumentID, aggVal[N]], vc *cache[string, instrumentID]) instrumentCache[N] { +func newInstrumentCache[N int64 | float64](ac *cache[streamID, aggVal[N]], vc *cache[string, streamID]) instrumentCache[N] { if ac == nil { - ac = &cache[instrumentID, aggVal[N]]{} + ac = &cache[streamID, aggVal[N]]{} } if vc == nil { - vc = &cache[string, instrumentID]{} + vc = &cache[string, streamID]{} } return instrumentCache[N]{aggregators: ac, views: vc} } @@ -85,7 +85,7 @@ func newInstrumentCache[N int64 | float64](ac *cache[instrumentID, aggVal[N]], v // in the cache and returned. // // LookupAggregator is safe to call concurrently. -func (c instrumentCache[N]) LookupAggregator(id instrumentID, f func() (internal.Aggregator[N], error)) (agg internal.Aggregator[N], err error) { +func (c instrumentCache[N]) LookupAggregator(id streamID, f func() (internal.Aggregator[N], error)) (agg internal.Aggregator[N], err error) { v := c.aggregators.Lookup(id, func() aggVal[N] { a, err := f() return aggVal[N]{Aggregator: a, Err: err} @@ -100,11 +100,11 @@ type aggVal[N int64 | float64] struct { } // Unique returns if id is unique or a duplicate instrument. If an instrument -// with the same name has already been created, that instrumentID will be -// returned along with false. Otherwise, id is returned with true. +// with the same name has already been created, that streamID will be returned +// along with false. Otherwise, id is returned with true. // // Unique is safe to call concurrently. -func (c instrumentCache[N]) Unique(id instrumentID) (instrumentID, bool) { - got := c.views.Lookup(id.Name, func() instrumentID { return id }) +func (c instrumentCache[N]) Unique(id streamID) (streamID, bool) { + got := c.views.Lookup(id.Name, func() streamID { return id }) return got, id == got } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 8e0a4b5553c..7b09c58fbfa 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -150,24 +150,24 @@ type Stream struct { AttributeFilter attribute.Filter } -// instrumentID are the identifying properties of an instrument. -type instrumentID struct { - // Name is the name of the instrument. +// streamID are the identifying properties of a stream. +type streamID struct { + // Name is the name of the stream. Name string - // Description is the description of the instrument. + // Description is the description of the stream. Description string - // Unit is the unit of the instrument. + // Unit is the unit of the stream. Unit unit.Unit - // Aggregation is the aggregation data type of the instrument. + // Aggregation is the aggregation data type of the stream. Aggregation string // Monotonic is the monotonicity of an instruments data type. This field is // not used for all data types, so a zero value needs to be understood in the // context of Aggregation. Monotonic bool - // Temporality is the temporality of an instrument's data type. This field - // is not used by some data types. + // Temporality is the temporality of a stream's data type. This field is + // not used by some data types. Temporality metricdata.Temporality - // Number is the number type of the instrument. + // Number is the number type of the stream. Number string } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 01906364d00..2863cff11d6 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -43,7 +43,7 @@ type meter struct { func newMeter(s instrumentation.Scope, p pipelines) *meter { // viewCache ensures instrument conflicts, including number conflicts, this // meter is asked to create are logged to the user. - var viewCache cache[string, instrumentID] + var viewCache cache[string, streamID] // Passing nil as the ac parameter to newInstrumentCache will have each // create its own aggregator cache. diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 2be2bf7749f..ab836b2efd0 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -288,7 +288,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum ) } - id := i.instrumentID(kind, stream) + id := i.streamID(kind, stream) // If there is a conflict, the specification says the view should // still be applied and a warning should be logged. i.logConflict(id) @@ -316,7 +316,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // logConflict validates if an instrument with the same name as id has already // been created. If that instrument conflicts with id, a warning is logged. -func (i *inserter[N]) logConflict(id instrumentID) { +func (i *inserter[N]) logConflict(id streamID) { existing, unique := i.cache.Unique(id) if unique { return @@ -334,9 +334,9 @@ func (i *inserter[N]) logConflict(id instrumentID) { ) } -func (i *inserter[N]) instrumentID(kind InstrumentKind, stream Stream) instrumentID { +func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { var zero N - id := instrumentID{ + id := streamID{ Name: stream.Name, Description: stream.Description, Unit: stream.Unit, diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 307900ae3a9..823ad72d20f 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -346,7 +346,7 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) inst := Instrument{Name: "foo", Kind: InstrumentKindObservableGauge} - vc := cache[string, instrumentID]{} + vc := cache[string, streamID]{} ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(inst) assert.Error(t, err) @@ -397,7 +397,7 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) - vc := cache[string, instrumentID]{} + vc := cache[string, streamID]{} ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) intAggs, err := ri.Aggregators(fooInst) assert.NoError(t, err) From 59daa05b19aa49f90f4b833871a89f3329b40872 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 16 Feb 2023 14:05:26 -0800 Subject: [PATCH 413/886] Remove leftover instrument provider from noop (#3736) --- metric/noop.go | 63 ++++---------------------------------------------- 1 file changed, 4 insertions(+), 59 deletions(-) diff --git a/metric/noop.go b/metric/noop.go index c586627aef8..f38619e39ab 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -106,18 +106,6 @@ var ( _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{} ) -func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { - return n, nil -} - type nonrecordingAsyncInt64Instrument struct { instrument.Int64Observable } @@ -128,18 +116,6 @@ var ( _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} ) -func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { - return n, nil -} - -func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { - return n, nil -} - type nonrecordingSyncFloat64Instrument struct { instrument.Synchronous } @@ -150,25 +126,8 @@ var ( _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{} ) -func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) { - return n, nil -} - -func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) { - return n, nil -} - -func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) { - -} - -func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) { - -} +func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {} +func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {} type nonrecordingSyncInt64Instrument struct { instrument.Synchronous @@ -180,19 +139,5 @@ var ( _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{} ) -func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { - return n, nil -} - -func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { - return n, nil -} - -func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { - return n, nil -} - -func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) { -} -func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) { -} +func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {} +func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {} From c5c3c95077777daa678708b559469a82b5ea7b2d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 17 Feb 2023 10:00:19 -0800 Subject: [PATCH 414/886] Accept scope attributes during Meter creation (#3738) * Accept scope attr during Meter creation * Fix lint * Add changes to changelog * Return a Set from InstrumentationAttributes Likely these attributes will be stored as a Set in the SDK. Don't cause two conversions because we return a slice here. * Add config tests * Fix lint --- CHANGELOG.md | 1 + metric/config.go | 25 ++++++++++++++++++++++++- metric/config_test.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 metric/config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 55ef3eec7e3..472a8fce616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OtelLibraryName` -> `OTelLibraryName` - `OtelLibraryVersion` -> `OTelLibraryVersion` - `OtelStatusDescription` -> `OTelStatusDescription` +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) ### Changed diff --git a/metric/config.go b/metric/config.go index 621e4c5fcb8..778ad2d748b 100644 --- a/metric/config.go +++ b/metric/config.go @@ -14,17 +14,30 @@ package metric // import "go.opentelemetry.io/otel/metric" +import "go.opentelemetry.io/otel/attribute" + // MeterConfig contains options for Meters. type MeterConfig struct { instrumentationVersion string schemaURL string + attrs attribute.Set + + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. } -// InstrumentationVersion is the version of the library providing instrumentation. +// InstrumentationVersion returns the version of the library providing +// instrumentation. func (cfg MeterConfig) InstrumentationVersion() string { return cfg.instrumentationVersion } +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (cfg MeterConfig) InstrumentationAttributes() attribute.Set { + return cfg.attrs +} + // SchemaURL is the schema_url of the library providing instrumentation. func (cfg MeterConfig) SchemaURL() string { return cfg.schemaURL @@ -60,6 +73,16 @@ func WithInstrumentationVersion(version string) MeterOption { }) } +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption { + return meterOptionFunc(func(config MeterConfig) MeterConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + // WithSchemaURL sets the schema URL. func WithSchemaURL(schemaURL string) MeterOption { return meterOptionFunc(func(config MeterConfig) MeterConfig { diff --git a/metric/config_test.go b/metric/config_test.go new file mode 100644 index 00000000000..b529b725948 --- /dev/null +++ b/metric/config_test.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" +) + +func TestConfig(t *testing.T) { + version := "v1.1.1" + schemaURL := "https://opentelemetry.io/schemas/1.0.0" + attr := attribute.NewSet( + attribute.String("user", "alice"), + attribute.Bool("admin", true), + ) + + c := metric.NewMeterConfig( + metric.WithInstrumentationVersion(version), + metric.WithSchemaURL(schemaURL), + metric.WithInstrumentationAttributes(attr.ToSlice()...), + ) + + assert.Equal(t, version, c.InstrumentationVersion(), "instrumentation version") + assert.Equal(t, schemaURL, c.SchemaURL(), "schema URL") + assert.Equal(t, attr, c.InstrumentationAttributes(), "instrumentation attributes") +} From db1b499265a5e4f100de605080ae51a393b84c13 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:42:29 -0800 Subject: [PATCH 415/886] dependabot updates Fri Feb 17 21:31:15 UTC 2023 (#3753) Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlptrace Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlptrace/otlptracehttp Bump golang.org/x/net from 0.5.0 to 0.7.0 in /exporters/otlp/otlpmetric Bump golang.org/x/net from 0.5.0 to 0.7.0 in /example/otel-collector --- bridge/opentracing/test/go.mod | 6 +++--- bridge/opentracing/test/go.sum | 12 ++++++------ example/otel-collector/go.mod | 6 +++--- example/otel-collector/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 12 ++++++------ exporters/otlp/otlptrace/go.mod | 6 +++--- exporters/otlp/otlptrace/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/go.sum | 12 ++++++------ internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 18 files changed, 75 insertions(+), 75 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 9da187e728c..9a263f05218 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -24,9 +24,9 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 829243724fe..e9716d96bd9 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -40,16 +40,16 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 9004018cb76..663d558e8b2 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -24,9 +24,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 6b683875532..a4e6bec564a 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -221,8 +221,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -274,8 +274,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 652eb3a50be..7f9e9fd1caa 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index b1a220daa83..fd54a0b3161 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 973ad997106..68d2e72e854 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -28,9 +28,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index b1a220daa83..fd54a0b3161 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index d380383068d..6fee9f32672 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -26,9 +26,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.53.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index b1a220daa83..fd54a0b3161 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 39b598f39a8..cdd27da4576 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -22,9 +22,9 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index b1a220daa83..fd54a0b3161 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8e1e7b58571..dbf2ac5a173 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -24,9 +24,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 507919a7103..7e843506492 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -230,8 +230,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -274,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -283,8 +283,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 153f32048c1..3640adbf758 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,9 +21,9 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.5.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.53.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index e8f18347f12..3c07acc5bf1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -228,8 +228,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -272,8 +272,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -281,8 +281,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index a34e63328f6..445a20241d8 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -193,7 +193,7 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index d742491f3ec..63bac059d38 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -746,8 +746,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= From ecf0838245b38ab83693c8a89b72f2e60a1a72a1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 17 Feb 2023 16:45:41 -0800 Subject: [PATCH 416/886] Add "[chore]" PR prefix to skip changelog check (#3754) Co-authored-by: Anthony Mirabella --- .github/workflows/changelog.yml | 7 ++++--- .github/workflows/scripts/dependabot-pr.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 10ea8d4bbeb..1472e6f9a81 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,7 @@ # This action requires that any PR targeting the main branch should touch at -# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip -# Changelog" label to disable this action. +# least one CHANGELOG file. If a CHANGELOG entry is not required, or if +# performing maintance on the Changelog, add either \"[chore]\" to the title of +# the pull request or add the \"Skip Changelog\" label to disable this action. name: changelog @@ -12,7 +13,7 @@ on: jobs: changelog: runs-on: ubuntu-latest - if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')" + if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/scripts/dependabot-pr.sh b/.github/workflows/scripts/dependabot-pr.sh index af20acb2287..5904456da8a 100755 --- a/.github/workflows/scripts/dependabot-pr.sh +++ b/.github/workflows/scripts/dependabot-pr.sh @@ -62,4 +62,4 @@ git commit -m "dependabot updates `date` $message" git push origin $PR_NAME -gh pr create --title "dependabot updates `date`" --body "$message" -l "Skip Changelog" +gh pr create --title "[chore] dependabot updates `date`" --body "$message" From cc8bdaaad4b4a788f68ac59da4610d597d75f67b Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 21 Feb 2023 09:04:27 -0600 Subject: [PATCH 417/886] Change the Reader.Collect Signature. (#3732) * Changes the signature of Collect(). This DOES NOT make the SDK reuse memory, but it does enable it to be added. --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 4 +++- sdk/metric/benchmark_test.go | 6 +++--- sdk/metric/config_test.go | 6 +++--- sdk/metric/manual_reader.go | 24 ++++++++++++++++-------- sdk/metric/meter_test.go | 24 +++++++++++++++--------- sdk/metric/periodic_reader.go | 25 +++++++++++++++++-------- sdk/metric/reader.go | 5 +++-- sdk/metric/reader_test.go | 31 +++++++++++++++++++++---------- 9 files changed, 82 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472a8fce616..10ac79452ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders. (#3679) +- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. This change is made to enable memory reuse by SDK users. (#3732) ### Fixed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 734d6315b4c..feb8d0c5acc 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -113,7 +113,9 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) { // Collect implements prometheus.Collector. func (c *collector) Collect(ch chan<- prometheus.Metric) { - metrics, err := c.reader.Collect(context.TODO()) + // TODO (#3047): Use a sync.Pool instead of allocating metrics every Collect. + metrics := metricdata.ResourceMetrics{} + err := c.reader.Collect(context.TODO(), &metrics) if err != nil { otel.Handle(err) if err == metric.ErrReaderNotRegistered { diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 0a75079d275..9a30cd1749d 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -93,7 +93,7 @@ func BenchmarkCounterCollectOneAttr(b *testing.B) { for i := 0; i < b.N; i++ { cntr.Add(ctx, 1, attribute.Int("K", 1)) - _, _ = rdr.Collect(ctx) + _ = rdr.Collect(ctx, nil) } } @@ -104,7 +104,7 @@ func BenchmarkCounterCollectTenAttrs(b *testing.B) { for j := 0; j < 10; j++ { cntr.Add(ctx, 1, attribute.Int("K", j)) } - _, _ = rdr.Collect(ctx) + _ = rdr.Collect(ctx, nil) } } @@ -140,7 +140,7 @@ func benchCollectHistograms(count int) func(*testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { - collectedMetrics, _ = r.Collect(ctx) + _ = r.Collect(ctx, &collectedMetrics) if len(collectedMetrics.ScopeMetrics[0].Metrics) != count { b.Fatalf("got %d metrics, want %d", len(collectedMetrics.ScopeMetrics[0].Metrics), count) } diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index d5dd6e4af6a..6e48a4599ca 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -32,7 +32,7 @@ type reader struct { externalProducers []Producer temporalityFunc TemporalitySelector aggregationFunc AggregationSelector - collectFunc func(context.Context) (metricdata.ResourceMetrics, error) + collectFunc func(context.Context, *metricdata.ResourceMetrics) error forceFlushFunc func(context.Context) error shutdownFunc func(context.Context) error } @@ -48,8 +48,8 @@ func (r *reader) RegisterProducer(p Producer) { r.externalProducers = append(r.e func (r *reader) temporality(kind InstrumentKind) metricdata.Temporality { return r.temporalityFunc(kind) } -func (r *reader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { - return r.collectFunc(ctx) +func (r *reader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { + return r.collectFunc(ctx, rm) } func (r *reader) ForceFlush(ctx context.Context) error { return r.forceFlushFunc(ctx) } func (r *reader) Shutdown(ctx context.Context) error { return r.shutdownFunc(ctx) } diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 48a8b291e77..f9b405915fc 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -16,6 +16,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "errors" "fmt" "sync" "sync/atomic" @@ -112,11 +113,17 @@ func (mr *manualReader) Shutdown(context.Context) error { } // Collect gathers all metrics from the SDK and other Producers, calling any -// callbacks necessary. Collect will return an error if called after shutdown. -func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { +// callbacks necessary and stores the result in rm. +// +// Collect will return an error if called after shutdown. +// Collect will return an error if rm is a nil ResourceMetrics. +func (mr *manualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { + if rm == nil { + return errors.New("manual reader: *metricdata.ResourceMetrics is nil") + } p := mr.sdkProducer.Load() if p == nil { - return metricdata.ResourceMetrics{}, ErrReaderNotRegistered + return ErrReaderNotRegistered } ph, ok := p.(produceHolder) @@ -126,12 +133,13 @@ func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics // happen, return an error instead of panicking so a users code does // not halt in the processes. err := fmt.Errorf("manual reader: invalid producer: %T", p) - return metricdata.ResourceMetrics{}, err + return err } - - rm, err := ph.produce(ctx) + // TODO (#3047): When produce is updated to accept output as param, pass rm. + rmTemp, err := ph.produce(ctx) + *rm = rmTemp if err != nil { - return metricdata.ResourceMetrics{}, err + return err } var errs []error for _, producer := range mr.externalProducers.Load().([]Producer) { @@ -141,7 +149,7 @@ func (mr *manualReader) Collect(ctx context.Context) (metricdata.ResourceMetrics } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } - return rm, unifyErrors(errs) + return unifyErrors(errs) } // manualReaderConfig contains configuration options for a ManualReader. diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 154ae924fd5..d86be80c308 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -472,7 +472,8 @@ func TestMeterCreatesInstruments(t *testing.T) { tt.fn(t, m) - rm, err := rdr.Collect(context.Background()) + rm := metricdata.ResourceMetrics{} + err := rdr.Collect(context.Background(), &rm) assert.NoError(t, err) require.Len(t, rm.ScopeMetrics, 1) @@ -566,7 +567,7 @@ func TestCallbackObserverNonRegistered(t *testing.T) { var got metricdata.ResourceMetrics assert.NotPanics(t, func() { - got, err = rdr.Collect(context.Background()) + err = rdr.Collect(context.Background(), &got) }) assert.NoError(t, err) @@ -660,7 +661,8 @@ func TestGlobalInstRegisterCallback(t *testing.T) { _, err = preMtr.RegisterCallback(cb, preInt64Ctr, preFloat64Ctr, postInt64Ctr, postFloat64Ctr) assert.NoError(t, err) - got, err := rdr.Collect(context.Background()) + got := metricdata.ResourceMetrics{} + err = rdr.Collect(context.Background(), &got) assert.NoError(t, err) assert.Lenf(t, l.messages, 0, "Warnings and errors logged:\n%s", l) metricdatatest.AssertEqual(t, metricdata.ResourceMetrics{ @@ -772,7 +774,8 @@ func TestMetersProvideScope(t *testing.T) { }, } - got, err := rdr.Collect(context.Background()) + got := metricdata.ResourceMetrics{} + err = rdr.Collect(context.Background(), &got) assert.NoError(t, err) metricdatatest.AssertEqual(t, want, got, metricdatatest.IgnoreTimestamp()) } @@ -816,14 +819,14 @@ func TestUnregisterUnregisters(t *testing.T) { require.NoError(t, err) ctx := context.Background() - _, err = r.Collect(ctx) + err = r.Collect(ctx, &metricdata.ResourceMetrics{}) require.NoError(t, err) assert.True(t, called, "callback not called for registered callback") called = false require.NoError(t, reg.Unregister(), "unregister") - _, err = r.Collect(ctx) + err = r.Collect(ctx, &metricdata.ResourceMetrics{}) require.NoError(t, err) assert.False(t, called, "callback called for unregistered callback") } @@ -869,7 +872,8 @@ func TestRegisterCallbackDropAggregations(t *testing.T) { ) require.NoError(t, err) - data, err := r.Collect(context.Background()) + data := metricdata.ResourceMetrics{} + err = r.Collect(context.Background(), &data) require.NoError(t, err) assert.False(t, called, "callback called for all drop instruments") @@ -1238,7 +1242,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { ).Meter("TestAttributeFilter") require.NoError(t, tt.register(t, mtr)) - m, err := rdr.Collect(context.Background()) + m := metricdata.ResourceMetrics{} + err := rdr.Collect(context.Background(), &m) assert.NoError(t, err) require.Len(t, m.ScopeMetrics, 1) @@ -1331,7 +1336,8 @@ func TestAsynchronousExample(t *testing.T) { collect := func(t *testing.T) { t.Helper() - got, err := reader.Collect(context.Background()) + got := metricdata.ResourceMetrics{} + err := reader.Collect(context.Background(), &got) require.NoError(t, err) require.Len(t, got.ScopeMetrics, 1) metricdatatest.AssertEqual(t, *want, got.ScopeMetrics[0], metricdatatest.IgnoreTimestamp()) diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 8425e42e16a..2c1d00bed93 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -16,6 +16,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "errors" "fmt" "sync" "sync/atomic" @@ -206,21 +207,29 @@ func (r *periodicReader) aggregation(kind InstrumentKind) aggregation.Aggregatio // collectAndExport gather all metric data related to the periodicReader r from // the SDK and exports it with r's exporter. func (r *periodicReader) collectAndExport(ctx context.Context) error { - m, err := r.Collect(ctx) + // TODO (#3047): Use a sync.Pool or persistent pointer instead of allocating rm every Collect. + rm := metricdata.ResourceMetrics{} + err := r.Collect(ctx, &rm) if err == nil { - err = r.export(ctx, m) + err = r.export(ctx, rm) } return err } // Collect gathers and returns all metric data related to the Reader from -// the SDK and other Producers. The returned metric data is not exported -// to the configured exporter, it is left to the caller to handle that if -// desired. +// the SDK and other Producers and stores the result in rm. The returned metric +// data is not exported to the configured exporter, it is left to the caller to +// handle that if desired. // -// An error is returned if this is called after Shutdown. -func (r *periodicReader) Collect(ctx context.Context) (metricdata.ResourceMetrics, error) { - return r.collect(ctx, r.sdkProducer.Load()) +// An error is returned if this is called after Shutdown. An error is return if rm is nil. +func (r *periodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { + if rm == nil { + return errors.New("periodic reader: *metricdata.ResourceMetrics is nil") + } + // TODO (#3047): When collect is updated to accept output as param, pass rm. + rmTemp, err := r.collect(ctx, r.sdkProducer.Load()) + *rm = rmTemp + return err } // collect unwraps p as a produceHolder and returns its produce results. diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 63de3b1bac1..9ba6c867d5b 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -65,8 +65,9 @@ type Reader interface { aggregation(InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. // Collect gathers and returns all metric data related to the Reader from - // the SDK. An error is returned if this is called after Shutdown. - Collect(context.Context) (metricdata.ResourceMetrics, error) + // the SDK and stores it in out. An error is returned if this is called + // after Shutdown or if out is nil. + Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error // ForceFlush flushes all metric measurements held in an export pipeline. // diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 26ac13f5dd7..5397fec3b18 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -53,13 +53,14 @@ func (ts *readerTestSuite) TearDownTest() { } func (ts *readerTestSuite) TestErrorForNotRegistered() { - _, err := ts.Reader.Collect(context.Background()) + err := ts.Reader.Collect(context.Background(), &metricdata.ResourceMetrics{}) ts.ErrorIs(err, ErrReaderNotRegistered) } func (ts *readerTestSuite) TestSDKProducer() { ts.Reader.register(testSDKProducer{}) - m, err := ts.Reader.Collect(context.Background()) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(context.Background(), &m) ts.NoError(err) ts.Equal(testResourceMetricsA, m) } @@ -67,7 +68,8 @@ func (ts *readerTestSuite) TestSDKProducer() { func (ts *readerTestSuite) TestExternalProducer() { ts.Reader.register(testSDKProducer{}) ts.Reader.RegisterProducer(testExternalProducer{}) - m, err := ts.Reader.Collect(context.Background()) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(context.Background(), &m) ts.NoError(err) ts.Equal(testResourceMetricsAB, m) } @@ -78,7 +80,8 @@ func (ts *readerTestSuite) TestCollectAfterShutdown() { ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.Shutdown(ctx)) - m, err := ts.Reader.Collect(ctx) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(ctx, &m) ts.ErrorIs(err, ErrReaderShutdown) ts.Equal(metricdata.ResourceMetrics{}, m) } @@ -113,7 +116,7 @@ func (ts *readerTestSuite) TestMultipleRegister() { // This should be ignored. ts.Reader.register(p1) - _, err := ts.Reader.Collect(context.Background()) + err := ts.Reader.Collect(context.Background(), &metricdata.ResourceMetrics{}) ts.Equal(assert.AnError, err) } @@ -134,7 +137,8 @@ func (ts *readerTestSuite) TestExternalProducerPartialSuccess() { }, ) - m, err := ts.Reader.Collect(context.Background()) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(context.Background(), &m) ts.Equal(assert.AnError, err) ts.Equal(testResourceMetricsAB, m) } @@ -146,7 +150,8 @@ func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { }}) ts.Reader.RegisterProducer(testExternalProducer{}) - m, err := ts.Reader.Collect(context.Background()) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(context.Background(), &m) ts.Equal(assert.AnError, err) ts.Equal(metricdata.ResourceMetrics{}, m) } @@ -165,7 +170,7 @@ func (ts *readerTestSuite) TestMethodConcurrency() { wg.Add(1) go func() { defer wg.Done() - _, _ = ts.Reader.Collect(ctx) + _ = ts.Reader.Collect(ctx, nil) }() wg.Add(1) @@ -190,11 +195,17 @@ func (ts *readerTestSuite) TestShutdownBeforeRegister() { ts.Reader.register(testSDKProducer{}) ts.Reader.RegisterProducer(testExternalProducer{}) - m, err := ts.Reader.Collect(ctx) + m := metricdata.ResourceMetrics{} + err := ts.Reader.Collect(ctx, &m) ts.ErrorIs(err, ErrReaderShutdown) ts.Equal(metricdata.ResourceMetrics{}, m) } +func (ts *readerTestSuite) TestCollectNilResourceMetricError() { + ctx := context.Background() + ts.Assert().Error(ts.Reader.Collect(ctx, nil)) +} + var testScopeMetricsA = metricdata.ScopeMetrics{ Scope: instrumentation.Scope{Name: "sdk/metric/test/reader"}, Metrics: []metricdata.Metrics{{ @@ -279,7 +290,7 @@ func benchReaderCollectFunc(r Reader) func(*testing.B) { b.ResetTimer() for n := 0; n < b.N; n++ { - collectedMetrics, err = r.Collect(ctx) + err = r.Collect(ctx, &collectedMetrics) assert.Equalf(b, testResourceMetricsA, collectedMetrics, "unexpected Collect response: (%#v, %v)", collectedMetrics, err) } } From f78f72d66c48fc16a8d42a86e5efd6d11e41a0a3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 21 Feb 2023 08:07:37 -0800 Subject: [PATCH 418/886] Merge instrument cache to inserter (#3724) * Merge instrument cache to inserter The current pipeline resolution path will only add the resolved aggregators to the pipeline when it creates one (cache miss). It will not add it if there is a cache hit. This means (since we cache instruments at the meter level, not the pipeline level) the first reader in a multiple-reader setup is the only one that will collect data for that aggregator. All other readers will have a cache hit and nothing is added to the pipeline. This is causing #3720. This resolves #3720 by moving the instrument caching into the inserter. This means aggregators are cached at the reader level, not the meter. * Rename aggCV to aggVal --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + sdk/metric/cache.go | 56 ---------------------------- sdk/metric/meter.go | 13 ++----- sdk/metric/pipeline.go | 49 ++++++++++++++++++------ sdk/metric/pipeline_registry_test.go | 55 ++++++++++++++++++--------- sdk/metric/pipeline_test.go | 4 +- 6 files changed, 83 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ac79452ce..7bee3f06246 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) +- Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) - Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/sdk/metric/cache.go b/sdk/metric/cache.go index 70e2937678a..110e4900577 100644 --- a/sdk/metric/cache.go +++ b/sdk/metric/cache.go @@ -16,8 +16,6 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "sync" - - "go.opentelemetry.io/otel/sdk/metric/internal" ) // cache is a locking storage used to quickly return already computed values. @@ -54,57 +52,3 @@ func (c *cache[K, V]) Lookup(key K, f func() V) V { c.data[key] = val return val } - -// instrumentCache is a cache of instruments. It is scoped at the Meter level -// along with a number type. Meaning all instruments it contains need to belong -// to the same instrumentation.Scope (implicitly) and number type (explicitly). -type instrumentCache[N int64 | float64] struct { - // aggregators is used to ensure duplicate creations of the same instrument - // return the same instance of that instrument's aggregator. - aggregators *cache[streamID, aggVal[N]] - // views is used to ensure if instruments with the same name are created, - // but do not have the same identifying properties, a warning is logged. - views *cache[string, streamID] -} - -// newInstrumentCache returns a new instrumentCache that uses ac as the -// underlying cache for aggregators and vc as the cache for views. If ac or vc -// are nil, a new empty cache will be used. -func newInstrumentCache[N int64 | float64](ac *cache[streamID, aggVal[N]], vc *cache[string, streamID]) instrumentCache[N] { - if ac == nil { - ac = &cache[streamID, aggVal[N]]{} - } - if vc == nil { - vc = &cache[string, streamID]{} - } - return instrumentCache[N]{aggregators: ac, views: vc} -} - -// LookupAggregator returns the Aggregator and error for a cached instrument if -// it exist in the cache. Otherwise, f is called and its returned value is set -// in the cache and returned. -// -// LookupAggregator is safe to call concurrently. -func (c instrumentCache[N]) LookupAggregator(id streamID, f func() (internal.Aggregator[N], error)) (agg internal.Aggregator[N], err error) { - v := c.aggregators.Lookup(id, func() aggVal[N] { - a, err := f() - return aggVal[N]{Aggregator: a, Err: err} - }) - return v.Aggregator, v.Err -} - -// aggVal is the cached value of an instrumentCache's aggregators cache. -type aggVal[N int64 | float64] struct { - Aggregator internal.Aggregator[N] - Err error -} - -// Unique returns if id is unique or a duplicate instrument. If an instrument -// with the same name has already been created, that streamID will be returned -// along with false. Otherwise, id is returned with true. -// -// Unique is safe to call concurrently. -func (c instrumentCache[N]) Unique(id streamID) (streamID, bool) { - got := c.views.Lookup(id.Name, func() streamID { return id }) - return got, id == got -} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 2863cff11d6..b8d290e7021 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -45,16 +45,11 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { // meter is asked to create are logged to the user. var viewCache cache[string, streamID] - // Passing nil as the ac parameter to newInstrumentCache will have each - // create its own aggregator cache. - ic := newInstrumentCache[int64](nil, &viewCache) - fc := newInstrumentCache[float64](nil, &viewCache) - return &meter{ scope: s, pipes: p, - int64IP: newInstProvider(s, p, ic), - float64IP: newInstProvider(s, p, fc), + int64IP: newInstProvider[int64](s, p, &viewCache), + float64IP: newInstProvider[float64](s, p, &viewCache), } } @@ -375,8 +370,8 @@ type instProvider[N int64 | float64] struct { resolve resolver[N] } -func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c instrumentCache[N]) *instProvider[N] { - return &instProvider[N]{scope: s, pipes: p, resolve: newResolver(p, c)} +func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *instProvider[N] { + return &instProvider[N]{scope: s, pipes: p, resolve: newResolver[N](p, c)} } func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc string, u unit.Unit) ([]internal.Aggregator[N], error) { diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index ab836b2efd0..c58c113e2b3 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -179,12 +179,32 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err // inserter facilitates inserting of new instruments from a single scope into a // pipeline. type inserter[N int64 | float64] struct { - cache instrumentCache[N] + // aggregators is a cache that holds Aggregators inserted into the + // underlying reader pipeline. This cache ensures no duplicate Aggregators + // are inserted into the reader pipeline and if a new request during an + // instrument creation asks for the same Aggregator the same instance is + // returned. + aggregators *cache[streamID, aggVal[N]] + + // views is a cache that holds instrument identifiers for all the + // instruments a Meter has created, it is provided from the Meter that owns + // this inserter. This cache ensures during the creation of instruments + // with the same name but different options (e.g. description, unit) a + // warning message is logged. + views *cache[string, streamID] + pipeline *pipeline } -func newInserter[N int64 | float64](p *pipeline, c instrumentCache[N]) *inserter[N] { - return &inserter[N]{cache: c, pipeline: p} +func newInserter[N int64 | float64](p *pipeline, vc *cache[string, streamID]) *inserter[N] { + if vc == nil { + vc = &cache[string, streamID]{} + } + return &inserter[N]{ + aggregators: &cache[streamID, aggVal[N]]{}, + views: vc, + pipeline: p, + } } // Instrument inserts the instrument inst with instUnit into a pipeline. All @@ -261,6 +281,12 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], err return aggs, errs.errorOrNil() } +// aggVal is the cached value in an aggregators cache. +type aggVal[N int64 | float64] struct { + Aggregator internal.Aggregator[N] + Err error +} + // cachedAggregator returns the appropriate Aggregator for an instrument // configuration. If the exact instrument has been created within the // inst.Scope, that Aggregator instance will be returned. Otherwise, a new @@ -292,13 +318,13 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // If there is a conflict, the specification says the view should // still be applied and a warning should be logged. i.logConflict(id) - return i.cache.LookupAggregator(id, func() (internal.Aggregator[N], error) { + cv := i.aggregators.Lookup(id, func() aggVal[N] { agg, err := i.aggregator(stream.Aggregation, kind, id.Temporality, id.Monotonic) if err != nil { - return nil, err + return aggVal[N]{nil, err} } if agg == nil { // Drop aggregator. - return nil, nil + return aggVal[N]{nil, nil} } if stream.AttributeFilter != nil { agg = internal.NewFilter(agg, stream.AttributeFilter) @@ -310,15 +336,16 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum unit: stream.Unit, aggregator: agg, }) - return agg, err + return aggVal[N]{agg, err} }) + return cv.Aggregator, cv.Err } // logConflict validates if an instrument with the same name as id has already // been created. If that instrument conflicts with id, a warning is logged. func (i *inserter[N]) logConflict(id streamID) { - existing, unique := i.cache.Unique(id) - if unique { + existing := i.views.Lookup(id.Name, func() streamID { return id }) + if id == existing { return } @@ -491,10 +518,10 @@ type resolver[N int64 | float64] struct { inserters []*inserter[N] } -func newResolver[N int64 | float64](p pipelines, c instrumentCache[N]) resolver[N] { +func newResolver[N int64 | float64](p pipelines, vc *cache[string, streamID]) resolver[N] { in := make([]*inserter[N], len(p)) for i := range in { - in[i] = newInserter(p[i], c) + in[i] = newInserter[N](p[i], vc) } return resolver[N]{in} } diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 823ad72d20f..d3e03dca54a 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -215,8 +215,8 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { - c := newInstrumentCache[N](nil, nil) - i := newInserter(newPipeline(nil, tt.reader, tt.views), c) + var c cache[string, streamID] + i := newInserter[N](newPipeline(nil, tt.reader, tt.views), &c) got, err := i.Instrument(tt.inst) assert.ErrorIs(t, err, tt.wantErr) require.Len(t, got, tt.wantLen) @@ -227,9 +227,14 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } } +func TestCreateAggregators(t *testing.T) { + t.Run("Int64", testCreateAggregators[int64]) + t.Run("Float64", testCreateAggregators[float64]) +} + func testInvalidInstrumentShouldPanic[N int64 | float64]() { - c := newInstrumentCache[N](nil, nil) - i := newInserter(newPipeline(nil, NewManualReader(), []View{defaultView}), c) + var c cache[string, streamID] + i := newInserter[N](newPipeline(nil, NewManualReader(), []View{defaultView}), &c) inst := Instrument{ Name: "foo", Kind: InstrumentKind(255), @@ -242,9 +247,25 @@ func TestInvalidInstrumentShouldPanic(t *testing.T) { assert.Panics(t, testInvalidInstrumentShouldPanic[float64]) } -func TestCreateAggregators(t *testing.T) { - t.Run("Int64", testCreateAggregators[int64]) - t.Run("Float64", testCreateAggregators[float64]) +func TestPipelinesAggregatorForEachReader(t *testing.T) { + r0, r1 := NewManualReader(), NewManualReader() + pipes := newPipelines(resource.Empty(), []Reader{r0, r1}, nil) + require.Len(t, pipes, 2, "created pipelines") + + inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} + var c cache[string, streamID] + r := newResolver[int64](pipes, &c) + aggs, err := r.Aggregators(inst) + require.NoError(t, err, "resolved Aggregators error") + require.Len(t, aggs, 2, "instrument aggregators") + + for i, p := range pipes { + var aggN int + for _, is := range p.aggregations { + aggN += len(is) + } + assert.Equalf(t, 1, aggN, "pipeline %d: number of instrumentSync", i) + } } func TestPipelineRegistryCreateAggregators(t *testing.T) { @@ -309,8 +330,8 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} - c := newInstrumentCache[int64](nil, nil) - r := newResolver(p, c) + var c cache[string, streamID] + r := newResolver[int64](p, &c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -319,8 +340,8 @@ func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCo func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} - c := newInstrumentCache[float64](nil, nil) - r := newResolver(p, c) + var c cache[string, streamID] + r := newResolver[float64](p, &c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -346,13 +367,13 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) inst := Instrument{Name: "foo", Kind: InstrumentKindObservableGauge} - vc := cache[string, streamID]{} - ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) + var vc cache[string, streamID] + ri := newResolver[int64](p, &vc) intAggs, err := ri.Aggregators(inst) assert.Error(t, err) assert.Len(t, intAggs, 0) - rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) + rf := newResolver[float64](p, &vc) floatAggs, err := rf.Aggregators(inst) assert.Error(t, err) assert.Len(t, floatAggs, 0) @@ -397,8 +418,8 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) - vc := cache[string, streamID]{} - ri := newResolver(p, newInstrumentCache[int64](nil, &vc)) + var vc cache[string, streamID] + ri := newResolver[int64](p, &vc) intAggs, err := ri.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 0, l.InfoN(), "no info logging should happen") @@ -413,7 +434,7 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { // Creating a float foo instrument should log a warning because there is an // int foo instrument. - rf := newResolver(p, newInstrumentCache[float64](nil, &vc)) + rf := newResolver[float64](p, &vc) floatAggs, err := rf.Aggregators(fooInst) assert.NoError(t, err) assert.Equal(t, 1, l.InfoN(), "instrument conflict not logged") diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 3c5e19b8b7d..ded48ac1622 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -159,8 +159,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - c := newInstrumentCache[N](nil, nil) - i := newInserter(test.pipe, c) + var c cache[string, streamID] + i := newInserter[N](test.pipe, &c) got, err := i.Instrument(inst) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") From de94fafd17c189a3ce5aa21cd8fa4c03823069df Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 21 Feb 2023 08:39:38 -0800 Subject: [PATCH 419/886] Do no silently drop unknown schema data (#3743) * Do no silently drop unknown schema data * Add entry to changelog * Add PR number to changelog --------- Co-authored-by: Chester Cheung Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + schema/v1.1/parser.go | 1 + schema/v1.1/parser_test.go | 10 ++++++++-- schema/v1.1/testdata/unknown-field.yaml | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 schema/v1.1/testdata/unknown-field.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bee3f06246..9e2abc4c8b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Ensure `go.opentelemetry.io/otel` does not use generics. (#3723, #3725) - Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) - Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) +- Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/schema/v1.1/parser.go b/schema/v1.1/parser.go index 7badc1b84fa..1e1ca8db56c 100644 --- a/schema/v1.1/parser.go +++ b/schema/v1.1/parser.go @@ -43,6 +43,7 @@ func ParseFile(schemaFilePath string) (*ast.Schema, error) { func Parse(schemaFileContent io.Reader) (*ast.Schema, error) { var ts ast.Schema d := yaml.NewDecoder(schemaFileContent) + d.SetStrict(true) // Do not silently drop unknown fields. err := d.Decode(&ts) if err != nil { return nil, err diff --git a/schema/v1.1/parser_test.go b/schema/v1.1/parser_test.go index 5f02a52b225..68f6679e9ba 100644 --- a/schema/v1.1/parser_test.go +++ b/schema/v1.1/parser_test.go @@ -167,8 +167,14 @@ func TestParseSchemaFile(t *testing.T) { ) } -func TestFailParseSchemaFile(t *testing.T) { +func TestFailParseFileUnsupportedFileFormat(t *testing.T) { ts, err := ParseFile("testdata/unsupported-file-format.yaml") - assert.Error(t, err) + assert.ErrorContains(t, err, "unsupported schema file format minor version number") + assert.Nil(t, ts) +} + +func TestFailParseFileUnknownField(t *testing.T) { + ts, err := ParseFile("testdata/unknown-field.yaml") + assert.ErrorContains(t, err, "field Resources not found in type ast.VersionDef") assert.Nil(t, ts) } diff --git a/schema/v1.1/testdata/unknown-field.yaml b/schema/v1.1/testdata/unknown-field.yaml new file mode 100644 index 00000000000..4ab535813b0 --- /dev/null +++ b/schema/v1.1/testdata/unknown-field.yaml @@ -0,0 +1,15 @@ +file_format: 1.1.0 +schema_url: https://opentelemetry.io/schemas/1.1.0 + +versions: + 1.1.0: + all: # Valid entry. + changes: + - rename_attributes: + k8s.cluster.name: kubernetes.cluster.name + Resources: # Invalid uppercase. + changes: + - rename_attributes: + attribute_map: + browser.user_agent: user_agent.original + 1.0.0: From 37931d44b94bc5ce3192f51f8a5d8890246be5ae Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Tue, 21 Feb 2023 18:43:24 +0100 Subject: [PATCH 420/886] Allow using OTLP export retrier concurrently (#3756) * allow using OTLP export retrier concurrently --- CHANGELOG.md | 1 + exporters/otlp/internal/retry/retry.go | 28 +++++++++---------- exporters/otlp/internal/retry/retry_test.go | 31 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e2abc4c8b3..f17a2c4ee0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) - Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) - Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) +- Data race issue in OTLP exporter retry mechanism. (#3756) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/exporters/otlp/internal/retry/retry.go b/exporters/otlp/internal/retry/retry.go index 2d14d248336..7e1b0055a7f 100644 --- a/exporters/otlp/internal/retry/retry.go +++ b/exporters/otlp/internal/retry/retry.go @@ -76,21 +76,21 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { } } - // Do not use NewExponentialBackOff since it calls Reset and the code here - // must call Reset after changing the InitialInterval (this saves an - // unnecessary call to Now). - b := &backoff.ExponentialBackOff{ - InitialInterval: c.InitialInterval, - RandomizationFactor: backoff.DefaultRandomizationFactor, - Multiplier: backoff.DefaultMultiplier, - MaxInterval: c.MaxInterval, - MaxElapsedTime: c.MaxElapsedTime, - Stop: backoff.Stop, - Clock: backoff.SystemClock, - } - b.Reset() - return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + for { err := fn(ctx) if err == nil { diff --git a/exporters/otlp/internal/retry/retry_test.go b/exporters/otlp/internal/retry/retry_test.go index 61f84e8350d..ad61bb306d0 100644 --- a/exporters/otlp/internal/retry/retry_test.go +++ b/exporters/otlp/internal/retry/retry_test.go @@ -18,6 +18,7 @@ import ( "context" "errors" "math" + "sync" "testing" "time" @@ -225,3 +226,33 @@ func TestRetryNotEnabled(t *testing.T) { return assert.AnError }), assert.AnError) } + +func TestConcurrentRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} From 867900e519f3d937e34319e6e63f721a46145998 Mon Sep 17 00:00:00 2001 From: Severin Neumann Date: Tue, 21 Feb 2023 20:07:45 +0100 Subject: [PATCH 421/886] Restructure Website documentation (#3585) * Restructure Website documentation Signed-off-by: svrnm * Update website_docs/getting-started.md * Update website_docs/exporters.md Co-authored-by: Patrice Chalin --------- Signed-off-by: svrnm Co-authored-by: Chester Cheung Co-authored-by: Patrice Chalin Co-authored-by: Damien Mathieu --- website_docs/exporters.md | 34 ++++++++++++++ website_docs/exporting_data.md | 81 --------------------------------- website_docs/getting-started.md | 9 ++-- website_docs/libraries.md | 2 +- website_docs/resources.md | 50 ++++++++++++++++++++ website_docs/sampling.md | 35 ++++++++++++++ 6 files changed, 125 insertions(+), 86 deletions(-) create mode 100644 website_docs/exporters.md delete mode 100644 website_docs/exporting_data.md create mode 100644 website_docs/resources.md create mode 100644 website_docs/sampling.md diff --git a/website_docs/exporters.md b/website_docs/exporters.md new file mode 100644 index 00000000000..2724e379896 --- /dev/null +++ b/website_docs/exporters.md @@ -0,0 +1,34 @@ +--- +title: Exporters +aliases: [/docs/instrumentation/go/exporting_data] +weight: 4 +--- + +In order to visualize and analyze your +[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics, you +will need to export them to a backend. + +## OTLP Exporter + +OpenTelemetry Protocol (OTLP) export is available in the +`go.opentelemetry.io/otel/exporters/otlp/otlptrace` and +`go.opentelemetry.io/otel/exporters/otlp/otlpmetric` packages. + +Please find more documentation on +[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp) + +## Jaeger Exporter + +Jaeger export is available in the `go.opentelemetry.io/otel/exporters/jaeger` +package. + +Please find more documentation on +[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger) + +## Prometheus Exporter + +Prometheus export is available in the +`go.opentelemetry.io/otel/exporters/prometheus` package. + +Please find more documentation on +[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) diff --git a/website_docs/exporting_data.md b/website_docs/exporting_data.md deleted file mode 100644 index a615722a4fe..00000000000 --- a/website_docs/exporting_data.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: Processing and Exporting Data -weight: 4 -linkTitle: Exporting data ---- - -Once you've instrumented your code, you need to get the data out in order to do anything useful with it. This page will cover the basics of the process and export pipeline. - -## Sampling - -Sampling is a process that restricts the amount of traces that are generated by a system. The exact sampler you should use depends on your specific needs, but in general you should make a decision at the start of a trace, and allow the sampling decision to propagate to other services. - -A sampler needs to be set on the tracer provider when its configured, as follows: - -```go -provider := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), -) -``` - -`AlwaysSample` and `NeverSample` are fairly self-explanatory. Always means that every trace will be sampled, the converse holds as true for Never. When you're getting started, or in a development environment, you'll almost always want to use `AlwaysSample`. - -Other samplers include: - -* `TraceIDRatioBased`, which will sample a fraction of traces, based on the fraction given to the sampler. Thus, if you set this to .5, half of traces will be sampled. -* `ParentBased`, which behaves differently based on the incoming sampling decision. In general, this will sample spans that have parents that were sampled, and will not sample spans whose parents were _not_ sampled. - -When you're in production, you should consider using the `TraceIDRatioBased` sampler with the `ParentBased` sampler. - -## Resources - -Resources are a special type of attribute that apply to all spans generated by a process. These should be used to represent underlying metadata about a process that's non-ephemeral - for example, the hostname of a process, or its instance ID. - -Resources should be assigned to a tracer provider at its initialization, and are created much like attributes: - -```go -resources := resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceNameKey.String("myService"), - semconv.ServiceVersionKey.String("1.0.0"), - semconv.ServiceInstanceIDKey.String("abcdef12345"), -) - -provider := sdktrace.NewTracerProvider( - ... - sdktrace.WithResource(resources), -) -``` - -Note the use of the `semconv` package to provide conventional names for resource attributes. This helps ensure that consumers of telemetry produced with these semantic conventions can -easily discover relevant attributes and understand their meaning. - -Resources can also be detected automatically through `resource.Detector` implementations. These `Detector`s may discover information about the currently running process, the operating -system it is running on, the cloud provider hosting that operating system instance, or any number of other resource attributes. - -```go -resources := resource.New(context.Background(), - resource.WithFromEnv(), // pull attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables - resource.WithProcess(), // This option configures a set of Detectors that discover process information - resource.WithDetectors(thirdparty.Detector{}), // Bring your own external Detector implementation - resource.WithAttributes(attribute.String("foo", "bar")), // Or specify resource attributes directly -) -``` - -## OTLP Exporter - -OpenTelemetry Protocol (OTLP) export is available in the `go.opentelemetry.io/otel/exporters/otlp/otlptrace` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` packages. - -Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp) - -## Jaeger Exporter - -Jaeger export is available in the `go.opentelemetry.io/otel/exporters/jaeger` package. - -Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger) - -## Prometheus Exporter - -Prometheus export is available in the `go.opentelemetry.io/otel/exporters/prometheus` package. - -Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index e3244866971..1d04c471a2f 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -542,10 +542,11 @@ start adding OpenTelemetry Go to your projects at this point. Go instrument your code! For more information about instrumenting your code and things you can do with -spans, refer to the [Instrumenting]({{< relref "manual" >}}) -documentation. Likewise, advanced topics about processing and exporting -telemetry data can be found in the [Processing and Exporting Data]({{< relref -"exporting_data" >}}) documentation. +spans, refer to the [manual instrumentation](/docs/instrumentation/go/manual/) +documentation. + +You'll also want to configure an appropriate exporter to [export your telemetry +data](/docs/instrumentation/go/exporters) to one or more telemetry backends. [`go.opentelemetry.io/otel/trace`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace [`go.opentelemetry.io/otel/sdk`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 4a90ef7f388..34e5a3a6615 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -76,7 +76,7 @@ func main() { } ``` -Assuming that you have a `Tracer` and [exporter]({{< relref "exporting_data" >}}) configured, this code will: +Assuming that you have a `Tracer` and [exporter]({{< relref "exporters" >}}) configured, this code will: * Start an HTTP server on port `3030` * Automatically generate a span for each inbound HTTP request to `/hello-instrumented` diff --git a/website_docs/resources.md b/website_docs/resources.md new file mode 100644 index 00000000000..2df203744fb --- /dev/null +++ b/website_docs/resources.md @@ -0,0 +1,50 @@ +--- +title: Resources +weight: 6 +--- + +Resources are a special type of attribute that apply to all spans generated by a +process. These should be used to represent underlying metadata about a process +that's non-ephemeral - for example, the hostname of a process, or its instance +ID. + +Resources should be assigned to a tracer provider at its initialization, and are +created much like attributes: + +```go +resources := resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("myService"), + semconv.ServiceVersionKey.String("1.0.0"), + semconv.ServiceInstanceIDKey.String("abcdef12345"), +) + +provider := sdktrace.NewTracerProvider( + ... + sdktrace.WithResource(resources), +) +``` + +Note the use of the `semconv` package to provide +[conventional names](/docs/concepts/semantic-conventions/) for resource +attributes. This helps ensure that consumers of telemetry produced with these +semantic conventions can easily discover relevant attributes and understand +their meaning. + +Resources can also be detected automatically through `resource.Detector` +implementations. These `Detector`s may discover information about the currently +running process, the operating system it is running on, the cloud provider +hosting that operating system instance, or any number of other resource +attributes. + +```go +resources := resource.New(context.Background(), + resource.WithFromEnv(), // pull attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables + resource.WithProcess(), // This option configures a set of Detectors that discover process information + resource.WithOS(), // This option configures a set of Detectors that discover OS information + resource.WithContainer(), // This option configures a set of Detectors that discover container information + resource.WithHost(), // This option configures a set of Detectors that discover host information + resource.WithDetectors(thirdparty.Detector{}), // Bring your own external Detector implementation + resource.WithAttributes(attribute.String("foo", "bar")), // Or specify resource attributes directly +) +``` diff --git a/website_docs/sampling.md b/website_docs/sampling.md new file mode 100644 index 00000000000..fc38cd31567 --- /dev/null +++ b/website_docs/sampling.md @@ -0,0 +1,35 @@ +--- +title: Sampling +weight: 8 +--- + +Sampling is a process that restricts the amount of traces that are generated by +a system. The exact sampler you should use depends on your specific needs, but +in general you should make a decision at the start of a trace, and allow the +sampling decision to propagate to other services. + +A sampler needs to be set on the tracer provider when its configured, as +follows: + +```go +provider := sdktrace.NewTracerProvider( + sdktrace.WithSampler(sdktrace.AlwaysSample()), +) +``` + +`AlwaysSample` and `NeverSample` are fairly self-explanatory. Always means that +every trace will be sampled, the converse holds as true for Never. When you're +getting started, or in a development environment, you'll almost always want to +use `AlwaysSample`. + +Other samplers include: + +- `TraceIDRatioBased`, which will sample a fraction of traces, based on the + fraction given to the sampler. Thus, if you set this to .5, half of traces + will be sampled. +- `ParentBased`, which behaves differently based on the incoming sampling + decision. In general, this will sample spans that have parents that were + sampled, and will not sample spans whose parents were _not_ sampled. + +When you're in production, you should consider using the `TraceIDRatioBased` +sampler with the `ParentBased` sampler. From 1c5aed692cafc559133f714e400ae6f8ea15c45b Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Tue, 21 Feb 2023 14:19:16 -0500 Subject: [PATCH 422/886] [website_docs] Fix link to Go logo (#3758) --- website_docs/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website_docs/_index.md b/website_docs/_index.md index dcd70c74d37..96a9d6a8a0b 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -1,8 +1,8 @@ --- title: Go description: >- - Go - A language-specific implementation of OpenTelemetry in Go. + Go A + language-specific implementation of OpenTelemetry in Go. aliases: [/golang, /golang/metrics, /golang/tracing] cascade: github_repo: &repo https://github.com/open-telemetry/opentelemetry-go From 99ec432679fb72940850bc994c91e683af0c7789 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 21 Feb 2023 11:31:37 -0800 Subject: [PATCH 423/886] Accept scope attributes during Tracer creation (#3739) * Accept scope attributes during Tracer creation The OTel specification requires the instrumentation attributes are accepted by the API for the Tracer. This adds a TracerOption to satisfy that requirement. --- CHANGELOG.md | 1 + trace/config.go | 17 ++++++++++++++ trace/config_test.go | 56 +++++++++++++------------------------------- 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f17a2c4ee0f..1de8428f827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OtelLibraryVersion` -> `OTelLibraryVersion` - `OtelStatusDescription` -> `OTelStatusDescription` - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) +- The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) ### Changed diff --git a/trace/config.go b/trace/config.go index f058cc781e0..cb3efbb9ad8 100644 --- a/trace/config.go +++ b/trace/config.go @@ -25,6 +25,7 @@ type TracerConfig struct { instrumentationVersion string // Schema URL of the telemetry emitted by the Tracer. schemaURL string + attrs attribute.Set } // InstrumentationVersion returns the version of the library providing instrumentation. @@ -32,6 +33,12 @@ func (t *TracerConfig) InstrumentationVersion() string { return t.instrumentationVersion } +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (t *TracerConfig) InstrumentationAttributes() attribute.Set { + return t.attrs +} + // SchemaURL returns the Schema URL of the telemetry emitted by the Tracer. func (t *TracerConfig) SchemaURL() string { return t.schemaURL @@ -307,6 +314,16 @@ func WithInstrumentationVersion(version string) TracerOption { }) } +// WithInstrumentationAttributes sets the instrumentation attributes. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption { + return tracerOptionFunc(func(config TracerConfig) TracerConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + // WithSchemaURL sets the schema URL for the Tracer. func WithSchemaURL(schemaURL string) TracerOption { return tracerOptionFunc(func(cfg TracerConfig) TracerConfig { diff --git a/trace/config_test.go b/trace/config_test.go index a4cafcbcd09..50c071169fa 100644 --- a/trace/config_test.go +++ b/trace/config_test.go @@ -211,46 +211,22 @@ func TestTracerConfig(t *testing.T) { v1 := "semver:0.0.1" v2 := "semver:1.0.0" schemaURL := "https://opentelemetry.io/schemas/1.2.0" - tests := []struct { - options []TracerOption - expected TracerConfig - }{ - { - // No non-zero-values should be set. - []TracerOption{}, - TracerConfig{}, - }, - { - []TracerOption{ - WithInstrumentationVersion(v1), - }, - TracerConfig{ - instrumentationVersion: v1, - }, - }, - { - []TracerOption{ - // Multiple calls should overwrite. - WithInstrumentationVersion(v1), - WithInstrumentationVersion(v2), - }, - TracerConfig{ - instrumentationVersion: v2, - }, - }, - { - []TracerOption{ - WithSchemaURL(schemaURL), - }, - TracerConfig{ - schemaURL: schemaURL, - }, - }, - } - for _, test := range tests { - config := NewTracerConfig(test.options...) - assert.Equal(t, test.expected, config) - } + attrs := attribute.NewSet( + attribute.String("user", "alice"), + attribute.Bool("admin", true), + ) + + c := NewTracerConfig( + // Multiple calls should overwrite. + WithInstrumentationVersion(v1), + WithInstrumentationVersion(v2), + WithSchemaURL(schemaURL), + WithInstrumentationAttributes(attrs.ToSlice()...), + ) + + assert.Equal(t, v2, c.InstrumentationVersion(), "instrumentation version") + assert.Equal(t, schemaURL, c.SchemaURL(), "schema URL") + assert.Equal(t, attrs, c.InstrumentationAttributes(), "instrumentation attributes") } // Save benchmark results to a file level var to avoid the compiler optimizing From 69d09462dbd8497416857dc18542232857d152c1 Mon Sep 17 00:00:00 2001 From: Pijus Navickas Date: Thu, 23 Feb 2023 23:11:48 +0200 Subject: [PATCH 424/886] Implement IsSampled for OpenTelemetry bridgeSpanContext (#3570) * Add IsSampled to OpenTracing bridge * Add entry to CHANGELOG * Add note to the README * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Update bridge/opentracing/README.md Co-authored-by: Tyler Yahn * Add PR ID to changelog note --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + bridge/opentracing/README.md | 19 +++++++++++++++ bridge/opentracing/bridge.go | 4 ++++ bridge/opentracing/bridge_test.go | 36 +++++++++++++++++++++++++++++ bridge/opentracing/internal/mock.go | 3 ++- 5 files changed, 62 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de8428f827..c58eb5fc67f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `OtelLibraryName` -> `OTelLibraryName` - `OtelLibraryVersion` -> `OTelLibraryVersion` - `OtelStatusDescription` -> `OTelStatusDescription` +- Add `bridgetSpanContext.IsSampled` to `go.opentelemetry.io/otel/bridget/opentracing` to expose whether span is sampled or not. (#3570) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) diff --git a/bridge/opentracing/README.md b/bridge/opentracing/README.md index a4477a87306..d6af6b1fbcf 100644 --- a/bridge/opentracing/README.md +++ b/bridge/opentracing/README.md @@ -38,3 +38,22 @@ When you have started an OpenTracing Span, make sure the OpenTelemetry knows abo // Propagate the otSpan to both OpenTracing and OpenTelemetry // instrumentation by using the ctxWithOTAndOTelSpan context. ``` + +## Extended Functionality + +The bridge functionality can be extended beyond the OpenTracing API. + +### `SpanContext.IsSampled` + +Return the underlying OpenTelemetry [`Span.IsSampled`](https://pkg.go.dev/go.opentelemetry.io/otel/trace#SpanContext.IsSampled) value by converting a `bridgeSpanContext`. + +```go +type samplable interface { + IsSampled() bool +} + +var sc opentracing.SpanContext = ... +if s, ok := sc.(samplable); ok && s.IsSampled() { + // Do something with sc knowing it is sampled. +} +``` diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 4fcb532f04a..867a2a8c387 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -72,6 +72,10 @@ func (c *bridgeSpanContext) ForeachBaggageItem(handler func(k, v string) bool) { } } +func (c *bridgeSpanContext) IsSampled() bool { + return c.otelSpanContext.IsSampled() +} + func (c *bridgeSpanContext) setBaggageItem(restrictedKey, value string) { crk := http.CanonicalHeaderKey(restrictedKey) m, err := baggage.NewMember(crk, value) diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 696f406371b..20c21a87565 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -257,6 +257,10 @@ func (t *testTextMapWriter) Set(key, val string) { (*t.m)[key] = val } +type samplable interface { + IsSampled() bool +} + func TestBridgeTracer_ExtractAndInject(t *testing.T) { bridge := NewBridgeTracer() bridge.SetTextMapPropagator(new(testTextMapPropagator)) @@ -510,3 +514,35 @@ func Test_otTagsToOTelAttributesKindAndError(t *testing.T) { }) } } + +func TestBridge_SpanContext_IsSampled(t *testing.T) { + testCases := []struct { + name string + flags trace.TraceFlags + expected bool + }{ + { + name: "not sampled", + flags: 0, + expected: false, + }, + { + name: "sampled", + flags: trace.FlagsSampled, + expected: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + tracer := internal.NewMockTracer() + tracer.TraceFlags = tc.flags + + b, _ := NewTracerPair(tracer) + s := b.StartSpan("abc") + sc := s.Context() + + assert.Equal(t, tc.expected, sc.(samplable).IsSampled()) + }) + } +} diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 99585c7562c..bb44e93d1f3 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -48,6 +48,7 @@ type MockTracer struct { SpareTraceIDs []trace.TraceID SpareSpanIDs []trace.SpanID SpareContextKeyValues []MockContextKeyValue + TraceFlags trace.TraceFlags randLock sync.Mutex rand *rand.Rand @@ -76,7 +77,7 @@ func (t *MockTracer) Start(ctx context.Context, name string, opts ...trace.SpanS spanContext := trace.NewSpanContext(trace.SpanContextConfig{ TraceID: t.getTraceID(ctx, &config), SpanID: t.getSpanID(), - TraceFlags: 0, + TraceFlags: t.TraceFlags, }) span := &MockSpan{ mockTracer: t, From 3d6a643980450146ee5517b3456e0c12ab92c460 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 24 Feb 2023 08:35:24 -0500 Subject: [PATCH 425/886] Run website formatter over website_docs (#3762) * Run website formatter over website_docs * Ignore selected website_docs links --- .lycheeignore | 2 + website_docs/_index.md | 4 +- website_docs/exporters.md | 4 +- website_docs/getting-started.md | 262 ++++++++++++++++++++++++-------- website_docs/libraries.md | 48 ++++-- website_docs/manual.md | 91 +++++++---- website_docs/resources.md | 4 +- 7 files changed, 303 insertions(+), 112 deletions(-) diff --git a/.lycheeignore b/.lycheeignore index 32e4812755e..40d62fa2eb8 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -2,3 +2,5 @@ http://localhost http://jaeger-collector https://github.com/open-telemetry/opentelemetry-go/milestone/ https://github.com/open-telemetry/opentelemetry-go/projects +file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries +file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual diff --git a/website_docs/_index.md b/website_docs/_index.md index 96a9d6a8a0b..9384531e19c 100644 --- a/website_docs/_index.md +++ b/website_docs/_index.md @@ -1,8 +1,8 @@ --- title: Go description: >- - Go A - language-specific implementation of OpenTelemetry in Go. + Go A language-specific implementation of OpenTelemetry in Go. aliases: [/golang, /golang/metrics, /golang/tracing] cascade: github_repo: &repo https://github.com/open-telemetry/opentelemetry-go diff --git a/website_docs/exporters.md b/website_docs/exporters.md index 2724e379896..34353b36724 100644 --- a/website_docs/exporters.md +++ b/website_docs/exporters.md @@ -5,8 +5,8 @@ weight: 4 --- In order to visualize and analyze your -[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics, you -will need to export them to a backend. +[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics, +you will need to export them to a backend. ## OTLP Exporter diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 1d04c471a2f..8c8c567ecb8 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -1,15 +1,26 @@ --- -title: "Getting Started" +title: Getting Started weight: 2 --- -Welcome to the OpenTelemetry for Go getting started guide! This guide will walk you through the basic steps in installing, instrumenting with, configuring, and exporting data from OpenTelemetry. Before you get started, be sure to have Go 1.16 or newer installed. +Welcome to the OpenTelemetry for Go getting started guide! This guide will walk +you through the basic steps in installing, instrumenting with, configuring, and +exporting data from OpenTelemetry. Before you get started, be sure to have Go +1.16 or newer installed. -Understanding how a system is functioning when it is failing or having issues is critical to resolving those issues. One strategy to understand this is with tracing. This guide shows how the OpenTelemetry Go project can be used to trace an example application. You will start with an application that computes Fibonacci numbers for users, and from there you will add instrumentation to produce tracing telemetry with OpenTelemetry Go. +Understanding how a system is functioning when it is failing or having issues is +critical to resolving those issues. One strategy to understand this is with +tracing. This guide shows how the OpenTelemetry Go project can be used to trace +an example application. You will start with an application that computes +Fibonacci numbers for users, and from there you will add instrumentation to +produce tracing telemetry with OpenTelemetry Go. -For reference, a complete example of the code you will build can be found [here](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/fib). +For reference, a complete example of the code you will build can be found +[here](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/fib). -To start building the application, make a new directory named `fib` to house our Fibonacci project. Next, add the following to a new file named `fib.go` in that directory. +To start building the application, make a new directory named `fib` to house our +Fibonacci project. Next, add the following to a new file named `fib.go` in that +directory. ```go package main @@ -29,7 +40,8 @@ func Fibonacci(n uint) (uint64, error) { } ``` -With your core logic added, you can now build your application around it. Add a new `app.go` file with the following application logic. +With your core logic added, you can now build your application around it. Add a +new `app.go` file with the following application logic. ```go package main @@ -84,7 +96,8 @@ func (a *App) Write(ctx context.Context, n uint) { } ``` -With your application fully composed, you need a `main()` function to actually run the application. In a new `main.go` file add the following run logic. +With your application fully composed, you need a `main()` function to actually +run the application. In a new `main.go` file add the following run logic. ```go package main @@ -120,9 +133,13 @@ func main() { } ``` -With the code complete it is almost time to run the application. Before you can do that you need to initialize this directory as a Go module. From your terminal, run the command `go mod init fib` in the `fib` directory. This will create a `go.mod` file, which is used by Go to manage imports. Now you should be able to run the application! +With the code complete it is almost time to run the application. Before you can +do that you need to initialize this directory as a Go module. From your +terminal, run the command `go mod init fib` in the `fib` directory. This will +create a `go.mod` file, which is used by Go to manage imports. Now you should be +able to run the application! -```sh +```console $ go run . What Fibonacci number would you like to know: 42 @@ -132,20 +149,27 @@ What Fibonacci number would you like to know: goodbye ``` -The application can be exited with CTRL+C. You should see a similar output as above, if not make sure to go back and fix any errors. +The application can be exited with Ctrl+C. You should see a similar +output as above, if not make sure to go back and fix any errors. ## Trace Instrumentation -OpenTelemetry is split into two parts: an API to instrument code with, and SDKs that implement the API. To start integrating OpenTelemetry into any project, the API is used to define how telemetry is generated. To generate tracing telemetry in your application you will use the OpenTelemetry Trace API from the [`go.opentelemetry.io/otel/trace`] package. +OpenTelemetry is split into two parts: an API to instrument code with, and SDKs +that implement the API. To start integrating OpenTelemetry into any project, the +API is used to define how telemetry is generated. To generate tracing telemetry +in your application you will use the OpenTelemetry Trace API from the +[`go.opentelemetry.io/otel/trace`] package. -First, you need to install the necessary packages for the Trace API. Run the following command in your working directory. +First, you need to install the necessary packages for the Trace API. Run the +following command in your working directory. ```sh go get go.opentelemetry.io/otel \ go.opentelemetry.io/otel/trace ``` -Now that the packages installed you can start updating your application with imports you will use in the `app.go` file. +Now that the packages installed you can start updating your application with +imports you will use in the `app.go` file. ```go import ( @@ -163,22 +187,41 @@ import ( With the imports added, you can start instrumenting. -The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These [`Tracer`]s are designed to be associated with one instrumentation library. That way telemetry they produce can be understood to come from that part of a code base. To uniquely identify your application to the [`Tracer`] you will use create a constant with the package name in `app.go`. +The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These +[`Tracer`]s are designed to be associated with one instrumentation library. That +way telemetry they produce can be understood to come from that part of a code +base. To uniquely identify your application to the [`Tracer`] you will use +create a constant with the package name in `app.go`. ```go // name is the Tracer name used to identify this instrumentation library. const name = "fib" ``` -Using the full-qualified package name, something that should be unique for Go packages, is the standard way to identify a [`Tracer`]. If your example package name differs, be sure to update the name you use here to match. +Using the full-qualified package name, something that should be unique for Go +packages, is the standard way to identify a [`Tracer`]. If your example package +name differs, be sure to update the name you use here to match. -Everything should be in place now to start tracing your application. But first, what is a trace? And, how exactly should you build them for your application? +Everything should be in place now to start tracing your application. But first, +what is a trace? And, how exactly should you build them for your application? -To back up a bit, a trace is a type of telemetry that represents work being done by a service. A trace is a record of the connection(s) between participants processing a transaction, often through client/server requests processing and other forms of communication. +To back up a bit, a trace is a type of telemetry that represents work being done +by a service. A trace is a record of the connection(s) between participants +processing a transaction, often through client/server requests processing and +other forms of communication. -Each part of the work that a service performs is represented in the trace by a span. Those spans are not just an unordered collection. Like the call stack of our application, those spans are defined with relationships to one another. The "root" span is the only span without a parent, it represents how a service request is started. All other spans have a parent relationship to another span in the same trace. +Each part of the work that a service performs is represented in the trace by a +span. Those spans are not just an unordered collection. Like the call stack of +our application, those spans are defined with relationships to one another. The +"root" span is the only span without a parent, it represents how a service +request is started. All other spans have a parent relationship to another span +in the same trace. -If this last part about span relationships doesn't make complete sense now, don't worry. The most important takeaway is that each part of your code, which does some work, should be represented as a span. You will have a better understanding of these span relationships after you instrument your code, so let's get started. +If this last part about span relationships doesn't make complete sense now, +don't worry. The most important takeaway is that each part of your code, which +does some work, should be represented as a span. You will have a better +understanding of these span relationships after you instrument your code, so +let's get started. Start by instrumenting the `Run` method. @@ -201,7 +244,14 @@ func (a *App) Run(ctx context.Context) error { } ``` -The above code creates a span for every iteration of the for loop. The span is created using a [`Tracer`] from the [global `TracerProvider`](https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). You will learn more about [`TracerProvider`]s and handle the other side of setting up a global [`TracerProvider`] when you install an SDK in a later section. For now, as an instrumentation author, all you need to worry about is that you are using an appropriately named [`Tracer`] from a [`TracerProvider`] when you write `otel.Tracer(name)`. +The above code creates a span for every iteration of the for loop. The span is +created using a [`Tracer`] from the +[global `TracerProvider`](https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). +You will learn more about [`TracerProvider`]s and handle the other side of +setting up a global [`TracerProvider`] when you install an SDK in a later +section. For now, as an instrumentation author, all you need to worry about is +that you are using an appropriately named [`Tracer`] from a [`TracerProvider`] +when you write `otel.Tracer(name)`. Next, instrument the `Poll` method. @@ -224,7 +274,11 @@ func (a *App) Poll(ctx context.Context) (uint, error) { } ``` -Similar to the `Run` method instrumentation, this adds a span to the method to track the computation performed. However, it also adds an attribute to annotate the span. This annotation is something you can add when you think a user of your application will want to see the state or details about the run environment when looking at telemetry. +Similar to the `Run` method instrumentation, this adds a span to the method to +track the computation performed. However, it also adds an attribute to annotate +the span. This annotation is something you can add when you think a user of your +application will want to see the state or details about the run environment when +looking at telemetry. Finally, instrument the `Write` method. @@ -248,9 +302,20 @@ func (a *App) Write(ctx context.Context, n uint) { } ``` -This method is instrumented with two spans. One to track the `Write` method itself, and another to track the call to the core logic with the `Fibonacci` function. Do you see how context is passed through the spans? Do you see how this also defines the relationship between spans? - -In OpenTelemetry Go the span relationships are defined explicitly with a `context.Context`. When a span is created a context is returned alongside the span. That context will contain a reference to the created span. If that context is used when creating another span the two spans will be related. The original span will become the new span's parent, and as a corollary, the new span is said to be a child of the original. This hierarchy gives traces structure, structure that helps show a computation path through a system. Based on what you instrumented above and this understanding of span relationships you should expect a trace for each execution of the run loop to look like this. +This method is instrumented with two spans. One to track the `Write` method +itself, and another to track the call to the core logic with the `Fibonacci` +function. Do you see how context is passed through the spans? Do you see how +this also defines the relationship between spans? + +In OpenTelemetry Go the span relationships are defined explicitly with a +`context.Context`. When a span is created a context is returned alongside the +span. That context will contain a reference to the created span. If that context +is used when creating another span the two spans will be related. The original +span will become the new span's parent, and as a corollary, the new span is said +to be a child of the original. This hierarchy gives traces structure, structure +that helps show a computation path through a system. Based on what you +instrumented above and this understanding of span relationships you should +expect a trace for each execution of the run loop to look like this. ``` Run @@ -259,17 +324,25 @@ Run └── Fibonacci ``` -A `Run` span will be a parent to both a `Poll` and `Write` span, and the `Write` span will be a parent to a `Fibonacci` span. +A `Run` span will be a parent to both a `Poll` and `Write` span, and the `Write` +span will be a parent to a `Fibonacci` span. -Now how do you actually see the produced spans? To do this you will need to configure and install an SDK. +Now how do you actually see the produced spans? To do this you will need to +configure and install an SDK. ## SDK Installation -OpenTelemetry is designed to be modular in its implementation of the OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, [`go.opentelemetry.io/otel/sdk`], that implements this API and adheres to the OpenTelemetry specification. To start using this SDK you will first need to create an exporter, but before anything can happen we need to install some packages. Run the following in the `fib` directory to install the trace STDOUT exporter and the SDK. +OpenTelemetry is designed to be modular in its implementation of the +OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, +[`go.opentelemetry.io/otel/sdk`], that implements this API and adheres to the +OpenTelemetry specification. To start using this SDK you will first need to +create an exporter, but before anything can happen we need to install some +packages. Run the following in the `fib` directory to install the trace STDOUT +exporter and the SDK. ```sh -$ go get go.opentelemetry.io/otel/sdk \ - go.opentelemetry.io/otel/exporters/stdout/stdouttrace +go get go.opentelemetry.io/otel/sdk \ + go.opentelemetry.io/otel/exporters/stdout/stdouttrace ``` Now add the needed imports to `main.go`. @@ -293,9 +366,17 @@ import ( ### Creating a Console Exporter -The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters are packages that allow telemetry data to be emitted somewhere - either to the console (which is what we're doing here), or to a remote system or collector for further analysis and/or enrichment. OpenTelemetry supports a variety of exporters through its ecosystem including popular open source tools like [Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), [Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/zipkin), and [Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). +The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters +are packages that allow telemetry data to be emitted somewhere - either to the +console (which is what we're doing here), or to a remote system or collector for +further analysis and/or enrichment. OpenTelemetry supports a variety of +exporters through its ecosystem including popular open source tools like +[Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), +[Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/zipkin), and +[Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). -To initialize the console exporter, add the following function to the `main.go` file: +To initialize the console exporter, add the following function to the `main.go` +file: ```go // newExporter returns a console exporter. @@ -310,11 +391,17 @@ func newExporter(w io.Writer) (trace.SpanExporter, error) { } ``` -This creates a new console exporter with basic options. You will use this function later when you configure the SDK to send telemetry data to it, but first you need to make sure that data is identifiable. +This creates a new console exporter with basic options. You will use this +function later when you configure the SDK to send telemetry data to it, but +first you need to make sure that data is identifiable. ### Creating a Resource -Telemetry data can be crucial to solving issues with a service. The catch is, you need a way to identify what service, or even what service instance, that data is coming from. OpenTelemetry uses a [`Resource`] to represent the entity producing telemetry. Add the following function to the `main.go` file to create an appropriate [`Resource`] for the application. +Telemetry data can be crucial to solving issues with a service. The catch is, +you need a way to identify what service, or even what service instance, that +data is coming from. OpenTelemetry uses a [`Resource`] to represent the entity +producing telemetry. Add the following function to the `main.go` file to create +an appropriate [`Resource`] for the application. ```go // newResource returns a resource describing this application. @@ -332,13 +419,22 @@ func newResource() *resource.Resource { } ``` -Any information you would like to associate with all telemetry data the SDK handles can be added to the returned [`Resource`]. This is done by registering the [`Resource`] with the [`TracerProvider`]. Something you can now create! +Any information you would like to associate with all telemetry data the SDK +handles can be added to the returned [`Resource`]. This is done by registering +the [`Resource`] with the [`TracerProvider`]. Something you can now create! ### Installing a Tracer Provider -You have your application instrumented to produce telemetry data and you have an exporter to send that data to the console, but how are they connected? This is where the [`TracerProvider`] is used. It is a centralized point where instrumentation will get a [`Tracer`] from and funnels the telemetry data from these [`Tracer`]s to export pipelines. +You have your application instrumented to produce telemetry data and you have an +exporter to send that data to the console, but how are they connected? This is +where the [`TracerProvider`] is used. It is a centralized point where +instrumentation will get a [`Tracer`] from and funnels the telemetry data from +these [`Tracer`]s to export pipelines. -The pipelines that receive and ultimately transmit data to exporters are called [`SpanProcessor`]s. A [`TracerProvider`] can be configured to have multiple span processors, but for this example you will only need to configure only one. Update your `main` function in `main.go` with the following. +The pipelines that receive and ultimately transmit data to exporters are called +[`SpanProcessor`]s. A [`TracerProvider`] can be configured to have multiple span +processors, but for this example you will only need to configure only one. +Update your `main` function in `main.go` with the following. ```go func main() { @@ -371,15 +467,30 @@ func main() { } ``` -There's a fair amount going on here. First you are creating a console exporter that will export to a file. You are then registering the exporter with a new [`TracerProvider`]. This is done with a [`BatchSpanProcessor`] when it is passed to the [`trace.WithBatcher`] option. Batching data is a good practice and will help not overload systems downstream. Finally, with the [`TracerProvider`] created, you are deferring a function to flush and stop it, and registering it as the global OpenTelemetry [`TracerProvider`]. - -Do you remember in the previous instrumentation section when we used the global [`TracerProvider`] to get a [`Tracer`]? This last step, registering the [`TracerProvider`] globally, is what will connect that instrumentation's [`Tracer`] with this [`TracerProvider`]. This pattern, using a global [`TracerProvider`], is convenient, but not always appropriate. [`TracerProvider`]s can be explicitly passed to instrumentation or inferred from a context that contains a span. For this simple example using a global provider makes sense, but for more complex or distributed codebases these other ways of passing [`TracerProvider`]s may make more sense. +There's a fair amount going on here. First you are creating a console exporter +that will export to a file. You are then registering the exporter with a new +[`TracerProvider`]. This is done with a [`BatchSpanProcessor`] when it is passed +to the [`trace.WithBatcher`] option. Batching data is a good practice and will +help not overload systems downstream. Finally, with the [`TracerProvider`] +created, you are deferring a function to flush and stop it, and registering it +as the global OpenTelemetry [`TracerProvider`]. + +Do you remember in the previous instrumentation section when we used the global +[`TracerProvider`] to get a [`Tracer`]? This last step, registering the +[`TracerProvider`] globally, is what will connect that instrumentation's +[`Tracer`] with this [`TracerProvider`]. This pattern, using a global +[`TracerProvider`], is convenient, but not always appropriate. +[`TracerProvider`]s can be explicitly passed to instrumentation or inferred from +a context that contains a span. For this simple example using a global provider +makes sense, but for more complex or distributed codebases these other ways of +passing [`TracerProvider`]s may make more sense. ## Putting It All Together -You should now have a working application that produces trace telemetry data! Give it a try. +You should now have a working application that produces trace telemetry data! +Give it a try. -```sh +```console $ go run . What Fibonacci number would you like to know: 42 @@ -389,13 +500,16 @@ What Fibonacci number would you like to know: goodbye ``` -A new file named `traces.txt` should be created in your working directory. All the traces created from running your application should be in there! +A new file named `traces.txt` should be created in your working directory. All +the traces created from running your application should be in there! ## (Bonus) Errors -At this point you have a working application and it is producing tracing telemetry data. Unfortunately, it was discovered that there is an error in the core functionality of the `fib` module. +At this point you have a working application and it is producing tracing +telemetry data. Unfortunately, it was discovered that there is an error in the +core functionality of the `fib` module. -```sh +```console $ go run . What Fibonacci number would you like to know: 100 @@ -403,7 +517,10 @@ Fibonacci(100) = 3736710778780434371 # … ``` -But the 100-th Fibonacci number is `354224848179261915075`, not `3736710778780434371`! This application is only meant as a demo, but it shouldn't return wrong values. Update the `Fibonacci` function to return an error instead of computing incorrect values. +But the 100-th Fibonacci number is `354224848179261915075`, not +`3736710778780434371`! This application is only meant as a demo, but it +shouldn't return wrong values. Update the `Fibonacci` function to return an +error instead of computing incorrect values. ```go // Fibonacci returns the n-th fibonacci number. An error is returned if the @@ -426,7 +543,9 @@ func Fibonacci(n uint) (uint64, error) { } ``` -Great, you have fixed the code, but it would be ideal to include errors returned to a user in the telemetry data. Luckily, spans can be configured to communicate this information. Update the `Write` method in `app.go` with the following code. +Great, you have fixed the code, but it would be ideal to include errors returned +to a user in the telemetry data. Luckily, spans can be configured to communicate +this information. Update the `Write` method in `app.go` with the following code. ```go // Write writes the n-th Fibonacci number back to the user. @@ -449,9 +568,13 @@ func (a *App) Write(ctx context.Context, n uint) { } ``` -With this change any error returned from the `Fibonacci` function will mark that span as an error and record an event describing the error. +With this change any error returned from the `Fibonacci` function will mark that +span as an error and record an event describing the error. -This is a great start, but it is not the only error returned in from the application. If a user makes a request for a non unsigned integer value the application will fail. Update the `Poll` method with a similar fix to capture this error in the telemetry data. +This is a great start, but it is not the only error returned in from the +application. If a user makes a request for a non unsigned integer value the +application will fail. Update the `Poll` method with a similar fix to capture +this error in the telemetry data. ```go // Poll asks a user for input and returns the request. @@ -477,7 +600,8 @@ func (a *App) Poll(ctx context.Context) (uint, error) { } ``` -All that is left is updating imports for the `app.go` file to include the [`go.opentelemetry.io/otel/codes`] package. +All that is left is updating imports for the `app.go` file to include the +[`go.opentelemetry.io/otel/codes`] package. ```go import ( @@ -496,7 +620,7 @@ import ( With these fixes in place and the instrumentation updated, re-trigger the bug. -```sh +```console $ go run . What Fibonacci number would you like to know: 100 @@ -506,9 +630,11 @@ What Fibonacci number would you like to know: goodbye ``` -Excellent! The application no longer returns wrong values, and looking at the telemetry data in the `traces.txt` file you should see the error captured as an event. +Excellent! The application no longer returns wrong values, and looking at the +telemetry data in the `traces.txt` file you should see the error captured as an +event. -``` +```json "Events": [ { "Name": "exception", @@ -545,15 +671,23 @@ For more information about instrumenting your code and things you can do with spans, refer to the [manual instrumentation](/docs/instrumentation/go/manual/) documentation. -You'll also want to configure an appropriate exporter to [export your telemetry -data](/docs/instrumentation/go/exporters) to one or more telemetry backends. - -[`go.opentelemetry.io/otel/trace`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace -[`go.opentelemetry.io/otel/sdk`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk -[`go.opentelemetry.io/otel/codes`]: https://pkg.go.dev/go.opentelemetry.io/otel/codes -[`Tracer`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#Tracer -[`TracerProvider`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#TracerProvider -[`Resource`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Resource -[`SpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor -[`BatchSpanProcessor`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#NewBatchSpanProcessor -[`trace.WithBatcher`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#WithBatcher +You'll also want to configure an appropriate exporter to +[export your telemetry data](/docs/instrumentation/go/exporters/) to one or more +telemetry backends. + +[`go.opentelemetry.io/otel/trace`]: + https://pkg.go.dev/go.opentelemetry.io/otel/trace +[`go.opentelemetry.io/otel/sdk`]: + https://pkg.go.dev/go.opentelemetry.io/otel/sdk +[`go.opentelemetry.io/otel/codes`]: + https://pkg.go.dev/go.opentelemetry.io/otel/codes +[`tracer`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#Tracer +[`tracerprovider`]: + https://pkg.go.dev/go.opentelemetry.io/otel/trace#TracerProvider +[`resource`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Resource +[`spanprocessor`]: + https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor +[`batchspanprocessor`]: + https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#NewBatchSpanProcessor +[`trace.withbatcher`]: + https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#WithBatcher diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 34e5a3a6615..6c6028456c7 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -1,29 +1,39 @@ --- title: Using instrumentation libraries -weight: 3 linkTitle: Libraries -aliases: [/docs/instrumentation/go/using_instrumentation_libraries, /docs/instrumentation/go/automatic_instrumentation] +aliases: + - /docs/instrumentation/go/using_instrumentation_libraries + - /docs/instrumentation/go/automatic_instrumentation +weight: 3 --- -Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code. +Go does not support truly automatic instrumentation like other languages today. +Instead, you'll need to depend on +[instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library) +that generate telemetry data for a particular instrumented library. For example, +the instrumentation library for `net/http` will automatically create spans that +track inbound and outbound requests once you configure it in your code. ## Setup -Each instrumentation library is a package. In general, this means you need to `go get` the appropriate package: +Each instrumentation library is a package. In general, this means you need to +`go get` the appropriate package: -```console +```sh go get go.opentelemetry.io/contrib/instrumentation/{import-path}/otel{package-name} ``` -And then configure it in your code based on what the library requires to be activated. +And then configure it in your code based on what the library requires to be +activated. ## Example with `net/http` -As an example, here's how you can set up automatic instrumentation for inbound HTTP requests for `net/http`: +As an example, here's how you can set up automatic instrumentation for inbound +HTTP requests for `net/http`: First, get the `net/http` instrumentation library: -```console +```sh go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp ``` @@ -76,13 +86,18 @@ func main() { } ``` -Assuming that you have a `Tracer` and [exporter]({{< relref "exporters" >}}) configured, this code will: +Assuming that you have a `Tracer` and [exporter](../exporters/) configured, this +code will: -* Start an HTTP server on port `3030` -* Automatically generate a span for each inbound HTTP request to `/hello-instrumented` -* Create a child span of the automatically-generated one that tracks the work done in `sleepy` +- Start an HTTP server on port `3030` +- Automatically generate a span for each inbound HTTP request to + `/hello-instrumented` +- Create a child span of the automatically-generated one that tracks the work + done in `sleepy` -Connecting manual instrumentation you write in your app with instrumentation generated from a library is essential to get good observability into your apps and services. +Connecting manual instrumentation you write in your app with instrumentation +generated from a library is essential to get good observability into your apps +and services. ## Available packages @@ -91,6 +106,9 @@ A full list of instrumentation libraries available can be found in the ## Next steps -Instrumentation libraries can do things like generate telemetry data for inbound and outbound HTTP requests, but they don't instrument your actual application. +Instrumentation libraries can do things like generate telemetry data for inbound +and outbound HTTP requests, but they don't instrument your actual application. -To get richer telemetry data, use [manual instrumentation]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application. +To get richer telemetry data, use [manual instrumentation](../manual/) to enrich +your telemetry data from instrumentation libraries with instrumentation from +your running application. diff --git a/website_docs/manual.md b/website_docs/manual.md index 21dbcc85927..dc17bacab92 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -1,11 +1,15 @@ --- title: Manual Instrumentation -weight: 3 linkTitle: Manual -aliases: [/docs/instrumentation/go/instrumentation, /docs/instrumentation/go/manual_instrumentation] +aliases: + - /docs/instrumentation/go/instrumentation + - /docs/instrumentation/go/manual_instrumentation +weight: 3 --- -Instrumentation is the process of adding observability code to your application. There are two general types of instrumentation - automatic, and manual - and you should be familiar with both in order to effectively instrument your software. +Instrumentation is the process of adding observability code to your application. +There are two general types of instrumentation - automatic, and manual - and you +should be familiar with both in order to effectively instrument your software. ## Getting a Tracer @@ -15,7 +19,7 @@ To create spans, you'll need to acquire or initialize a tracer first. Ensure you have the right packages installed: -``` +```sh go get go.opentelemetry.io/otel \ go.opentelemetry.io/otel/trace \ go.opentelemetry.io/otel/sdk \ @@ -54,7 +58,7 @@ func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { semconv.ServiceName("ExampleService"), ), ) - + if err != nil { panic(err) } @@ -90,9 +94,12 @@ You can now access `tracer` to manually instrument your code. ## Creating Spans -Spans are created by tracers. If you don't have one initialized, you'll need to do that. +Spans are created by tracers. If you don't have one initialized, you'll need to +do that. -To create a span with a tracer, you'll also need a handle on a `context.Context` instance. These will typically come from things like a request object and may already contain a parent span from an [instrumentation library][]. +To create a span with a tracer, you'll also need a handle on a `context.Context` +instance. These will typically come from things like a request object and may +already contain a parent span from an [instrumentation library][]. ```go func httpHandler(w http.ResponseWriter, r *http.Request) { @@ -103,13 +110,16 @@ func httpHandler(w http.ResponseWriter, r *http.Request) { } ``` -In Go, the `context` package is used to store the active span. When you start a span, you'll get a handle on not only the span that's created, but the modified context that contains it. +In Go, the `context` package is used to store the active span. When you start a +span, you'll get a handle on not only the span that's created, but the modified +context that contains it. Once a span has completed, it is immutable and can no longer be modified. ### Get the current span -To get the current span, you'll need to pull it out of a `context.Context` you have a handle on: +To get the current span, you'll need to pull it out of a `context.Context` you +have a handle on: ```go // This context needs contain the active span you plan to extract. @@ -119,13 +129,15 @@ span := trace.SpanFromContext(ctx) // Do something with the current span, optionally calling `span.End()` if you want it to end ``` -This can be helpful if you'd like to add information to the current span at a point in time. +This can be helpful if you'd like to add information to the current span at a +point in time. ### Create nested spans You can create a nested span to track work in a nested operation. -If the current `context.Context` you have a handle on already contains a span inside of it, creating a new span makes it a nested span. For example: +If the current `context.Context` you have a handle on already contains a span +inside of it, creating a new span makes it a nested span. For example: ```go func parentFunction(ctx context.Context) { @@ -151,7 +163,10 @@ Once a span has completed, it is immutable and can no longer be modified. ### Span Attributes -Attributes are keys and values that are applied as metadata to your spans and are useful for aggregating, filtering, and grouping traces. Attributes can be added at span creation, or at any other time during the lifecycle of a span before it has completed. +Attributes are keys and values that are applied as metadata to your spans and +are useful for aggregating, filtering, and grouping traces. Attributes can be +added at span creation, or at any other time during the lifecycle of a span +before it has completed. ```go // setting attributes at creation... @@ -169,13 +184,21 @@ span.SetAttributes(myKey.String("a value")) #### Semantic Attributes -Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.12.0` package. +Semantic Attributes are attributes that are defined by the [OpenTelemetry +Specification][] in order to provide a shared set of attribute keys across +multiple languages, frameworks, and runtimes for common concepts like HTTP +methods, status codes, user agents, and more. These attributes are available in +the `go.opentelemetry.io/otel/semconv/v1.12.0` package. For details, see [Trace semantic conventions][]. ### Events -An event is a human-readable message on a span that represents "something happening" during it's lifetime. For example, imagine a function that requires exclusive access to a resource that is under a mutex. An event could be created at two points - once, when we try to gain access to the resource, and another when we acquire the mutex. +An event is a human-readable message on a span that represents "something +happening" during it's lifetime. For example, imagine a function that requires +exclusive access to a resource that is under a mutex. An event could be created +at two points - once, when we try to gain access to the resource, and another +when we acquire the mutex. ```go span.AddEvent("Acquiring lock") @@ -186,7 +209,9 @@ span.AddEvent("Unlocking") mutex.Unlock() ``` -A useful characteristic of events is that their timestamps are displayed as offsets from the beginning of the span, allowing you to easily see how much time elapsed between them. +A useful characteristic of events is that their timestamps are displayed as +offsets from the beginning of the span, allowing you to easily see how much time +elapsed between them. Events can also have attributes of their own - @@ -196,7 +221,8 @@ span.AddEvent("Cancelled wait due to external signal", trace.WithAttributes(attr ### Set span status -A status can be set on a span, typically used to specify that there was an error in the operation a span is tracking - .`Error`. +A status can be set on a span, typically used to specify that there was an error +in the operation a span is tracking - .`Error`. ```go import ( @@ -213,11 +239,13 @@ if err != nil { } ``` -By default, the status for all spans is `Unset`. In rare cases, you may also wish to set the status to `Ok`. This should generally not be necessary, though. +By default, the status for all spans is `Unset`. In rare cases, you may also +wish to set the status to `Ok`. This should generally not be necessary, though. ### Record errors -If you have an operation that failed and you wish to capture the error it produced, you can record that error. +If you have an operation that failed and you wish to capture the error it +produced, you can record that error. ```go import ( @@ -235,8 +263,10 @@ if err != nil { } ``` -It is highly recommended that you also set a span's status to `Error` when using `RecordError`, unless you do not wish to consider the span tracking a failed operation as an error span. -The `RecordError` function does **not** automatically set a span status when called. +It is highly recommended that you also set a span's status to `Error` when using +`RecordError`, unless you do not wish to consider the span tracking a failed +operation as an error span. The `RecordError` function does **not** +automatically set a span status when called. ## Creating Metrics @@ -244,9 +274,11 @@ The metrics API is currently unstable, documentation TBA. ## Propagators and Context -Traces can extend beyond a single process. This requires _context propagation_, a mechanism where identifiers for a trace are sent to remote processes. +Traces can extend beyond a single process. This requires _context propagation_, +a mechanism where identifiers for a trace are sent to remote processes. -In order to propagate trace context over the wire, a propagator must be registered with the OpenTelemetry API. +In order to propagate trace context over the wire, a propagator must be +registered with the OpenTelemetry API. ```go import ( @@ -257,10 +289,15 @@ import ( otel.SetTextMapPropagator(propagation.TraceContext{}) ``` -> OpenTelemetry also supports the B3 header format, for compatibility with existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that do not support the W3C TraceContext standard. +> OpenTelemetry also supports the B3 header format, for compatibility with +> existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that +> do not support the W3C TraceContext standard. -After configuring context propagation, you'll most likely want to use automatic instrumentation to handle the behind-the-scenes work of actually managing serializing the context. +After configuring context propagation, you'll most likely want to use automatic +instrumentation to handle the behind-the-scenes work of actually managing +serializing the context. -[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}} -[Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}} -[instrumentation library]: {{< relref "libraries" >}} +[opentelemetry specification]: /docs/reference/specification/ +[trace semantic conventions]: + /docs/reference/specification/trace/semantic_conventions/ +[instrumentation library]: ../libraries/ diff --git a/website_docs/resources.md b/website_docs/resources.md index 2df203744fb..014cb8ee60e 100644 --- a/website_docs/resources.md +++ b/website_docs/resources.md @@ -5,8 +5,8 @@ weight: 6 Resources are a special type of attribute that apply to all spans generated by a process. These should be used to represent underlying metadata about a process -that's non-ephemeral - for example, the hostname of a process, or its instance -ID. +that's non-ephemeral — for example, the hostname of a process, or its +instance ID. Resources should be assigned to a tracer provider at its initialization, and are created much like attributes: From 1d6704c8fc57b78060405422302c1f00a4a02e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 24 Feb 2023 16:26:47 +0100 Subject: [PATCH 426/886] Support OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT (#3763) * Support OTEL_METRIC_EXPORT_INTERVAL and OTEL_METRIC_EXPORT_TIMEOUT * Fix non-positive duration error log Co-authored-by: Tyler Yahn --- CHANGELOG.md | 3 + sdk/metric/env.go | 50 ++++++++++++++++ sdk/metric/periodic_reader.go | 10 +++- sdk/metric/periodic_reader_test.go | 96 ++++++++++++++++++++++++++++++ sdk/metric/reader.go | 4 ++ 5 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 sdk/metric/env.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c58eb5fc67f..39078e56970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `bridgetSpanContext.IsSampled` to `go.opentelemetry.io/otel/bridget/opentracing` to expose whether span is sampled or not. (#3570) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) +- The following environment variables are supported by the `Reader`s in `go.opentelemetry.io/otel/sdk/metric`. (#3763) + - `OTEL_METRIC_EXPORT_INTERVAL` + - `OTEL_METRIC_EXPORT_TIMEOUT` ### Changed diff --git a/sdk/metric/env.go b/sdk/metric/env.go new file mode 100644 index 00000000000..940ba815942 --- /dev/null +++ b/sdk/metric/env.go @@ -0,0 +1,50 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "os" + "strconv" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// Environment variable names. +const ( + // The time interval (in milliseconds) between the start of two export attempts. + envInterval = "OTEL_METRIC_EXPORT_INTERVAL" + // Maximum allowed time (in milliseconds) to export data. + envTimeout = "OTEL_METRIC_EXPORT_TIMEOUT" +) + +// envDuration returns an environment variable's value as duration in milliseconds if it is exists, +// or the defaultValue if the environment variable is not defined or the value is not valid. +func envDuration(key string, defaultValue time.Duration) time.Duration { + v := os.Getenv(key) + if v == "" { + return defaultValue + } + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "environment variable", key, "value", v) + return defaultValue + } + if d <= 0 { + global.Error(errNonPositiveDuration, "non-positive duration", "environment variable", key, "value", v) + return defaultValue + } + return time.Duration(d) * time.Millisecond +} diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 2c1d00bed93..3ba93293bf7 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -44,8 +44,8 @@ type periodicReaderConfig struct { // options. func newPeriodicReaderConfig(options []PeriodicReaderOption) periodicReaderConfig { c := periodicReaderConfig{ - interval: defaultInterval, - timeout: defaultTimeout, + interval: envDuration(envInterval, defaultInterval), + timeout: envDuration(envTimeout, defaultTimeout), } for _, o := range options { c = o.applyPeriodic(c) @@ -69,6 +69,9 @@ func (o periodicReaderOptionFunc) applyPeriodic(conf periodicReaderConfig) perio // WithTimeout configures the time a PeriodicReader waits for an export to // complete before canceling it. // +// This option overrides any value set for the +// OTEL_METRIC_EXPORT_TIMEOUT environment variable. +// // If this option is not used or d is less than or equal to zero, 30 seconds // is used as the default. func WithTimeout(d time.Duration) PeriodicReaderOption { @@ -84,6 +87,9 @@ func WithTimeout(d time.Duration) PeriodicReaderOption { // WithInterval configures the intervening time between exports for a // PeriodicReader. // +// This option overrides any value set for the +// OTEL_METRIC_EXPORT_INTERVAL environment variable. +// // If this option is not used or d is less than or equal to zero, 60 seconds // is used as the default. func WithInterval(d time.Duration) PeriodicReaderOption { diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 138aae48944..a6b319e8abc 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -41,6 +41,54 @@ func TestWithTimeout(t *testing.T) { assert.Equal(t, defaultTimeout, test(time.Duration(-1)), "invalid timeout should use default") } +func TestTimeoutEnvVar(t *testing.T) { + testCases := []struct { + v string + want time.Duration + }{ + { + // empty value + "", + defaultTimeout, + }, + { + // positive value + "1", + time.Millisecond, + }, + { + // non-positive value + "0", + defaultTimeout, + }, + { + // value with unit (not supported) + "1ms", + defaultTimeout, + }, + { + // NaN + "abc", + defaultTimeout, + }, + } + for _, tc := range testCases { + t.Run(tc.v, func(t *testing.T) { + t.Setenv(envTimeout, tc.v) + got := newPeriodicReaderConfig(nil).timeout + assert.Equal(t, tc.want, got) + }) + } +} + +func TestTimeoutEnvAndOption(t *testing.T) { + want := 5 * time.Millisecond + t.Setenv(envTimeout, "999") + opts := []PeriodicReaderOption{WithTimeout(want)} + got := newPeriodicReaderConfig(opts).timeout + assert.Equal(t, want, got, "option should have precedence over env var") +} + func TestWithInterval(t *testing.T) { test := func(d time.Duration) time.Duration { opts := []PeriodicReaderOption{WithInterval(d)} @@ -53,6 +101,54 @@ func TestWithInterval(t *testing.T) { assert.Equal(t, defaultInterval, test(time.Duration(-1)), "invalid interval should use default") } +func TestIntervalEnvVar(t *testing.T) { + testCases := []struct { + v string + want time.Duration + }{ + { + // empty value + "", + defaultInterval, + }, + { + // positive value + "1", + time.Millisecond, + }, + { + // non-positive value + "0", + defaultInterval, + }, + { + // value with unit (not supported) + "1ms", + defaultInterval, + }, + { + // NaN + "abc", + defaultInterval, + }, + } + for _, tc := range testCases { + t.Run(tc.v, func(t *testing.T) { + t.Setenv(envInterval, tc.v) + got := newPeriodicReaderConfig(nil).interval + assert.Equal(t, tc.want, got) + }) + } +} + +func TestIntervalEnvAndOption(t *testing.T) { + want := 5 * time.Millisecond + t.Setenv(envInterval, "999") + opts := []PeriodicReaderOption{WithInterval(want)} + got := newPeriodicReaderConfig(opts).interval + assert.Equal(t, want, got, "option should have precedence over env var") +} + type fnExporter struct { temporalityFunc TemporalitySelector aggregationFunc AggregationSelector diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 9ba6c867d5b..9d6972b53d8 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -34,6 +34,10 @@ var ErrReaderNotRegistered = fmt.Errorf("reader is not registered") // reader has been Shutdown once. var ErrReaderShutdown = fmt.Errorf("reader is shutdown") +// errNonPositiveDuration is logged when an environmental variable +// has non-positive value. +var errNonPositiveDuration = fmt.Errorf("non-positive duration") + // Reader is the interface used between the SDK and an // exporter. Control flow is bi-directional through the // Reader, since the SDK initiates ForceFlush and Shutdown From 6fa6afba266d68bfeca0ca5ff086c3dcaa8bdb99 Mon Sep 17 00:00:00 2001 From: Kason Braley <59150626+KasonBraley@users.noreply.github.com> Date: Fri, 24 Feb 2023 12:11:52 -0700 Subject: [PATCH 427/886] Fix `global.MeterProvider` documentation (#3774) --- metric/global/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metric/global/global.go b/metric/global/global.go index 05a67c2e999..cb0896d38ac 100644 --- a/metric/global/global.go +++ b/metric/global/global.go @@ -30,7 +30,7 @@ func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter return MeterProvider().Meter(instrumentationName, opts...) } -// MeterProvider returns the registered global trace provider. +// MeterProvider returns the registered global meter provider. // If none is registered then a No-op MeterProvider is returned. func MeterProvider() metric.MeterProvider { return global.MeterProvider() From 0a75c5bd8a38ac1cbb4cb7fbb2c82382e8951b71 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 26 Feb 2023 07:58:24 -0800 Subject: [PATCH 428/886] dependabot updates Sun Feb 26 15:49:13 UTC 2023 (#3804) Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opentracing/test Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /schema Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/prometheus Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /metric Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/jaeger Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/zipkin Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /trace Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /exporters/stdout/stdoutmetric Bump github.com/golangci/golangci-lint from 1.51.1 to 1.51.2 in /internal/tools Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /sdk/metric Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opencensus Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /sdk Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 Bump golang.org/x/sys from 0.0.0-20220919091848-fb04ddd9f9c8 to 0.5.0 in /sdk Bump github.com/stretchr/testify from 1.8.1 to 1.8.2 in /bridge/opentracing Bump lycheeverse/lychee-action from 1.5.4 to 1.6.1 --- bridge/opencensus/go.mod | 4 +- bridge/opencensus/go.sum | 7 +- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 6 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 +- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +- example/fib/go.mod | 2 +- example/fib/go.sum | 6 +- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 6 +- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 6 +- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 6 +- example/otel-collector/go.sum | 2 +- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 6 +- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 6 +- example/view/go.mod | 2 +- example/view/go.sum | 6 +- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 6 +- exporters/jaeger/go.mod | 4 +- exporters/jaeger/go.sum | 8 +- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +- exporters/prometheus/go.mod | 4 +- exporters/prometheus/go.sum | 8 +- exporters/stdout/stdoutmetric/go.mod | 4 +- exporters/stdout/stdoutmetric/go.sum | 8 +- exporters/stdout/stdouttrace/go.mod | 4 +- exporters/stdout/stdouttrace/go.sum | 8 +- exporters/zipkin/go.mod | 4 +- exporters/zipkin/go.sum | 8 +- go.mod | 2 +- go.sum | 4 +- internal/tools/go.mod | 41 ++++---- internal/tools/go.sum | 98 +++++++++---------- metric/go.mod | 2 +- metric/go.sum | 4 +- schema/go.mod | 2 +- schema/go.sum | 4 +- sdk/go.mod | 4 +- sdk/go.sum | 8 +- sdk/metric/go.mod | 4 +- sdk/metric/go.sum | 8 +- trace/go.mod | 2 +- trace/go.sum | 4 +- 63 files changed, 189 insertions(+), 197 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index b5ec1502717..cd65077888c 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.18 require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/metric v0.36.0 @@ -19,7 +19,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 7192f84c13b..ba5db799521 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -49,8 +49,9 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -73,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 076536bb2f5..32928e9b2a5 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v0.36.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.36.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index ddd27a7e01e..eb6df8c78c7 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -44,8 +44,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index fe2df7fba73..730f2164389 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -8,7 +8,7 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 ) diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 7a028416b02..e68eeca1d57 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -17,8 +17,8 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 9a263f05218..d3a5c9222f2 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -11,7 +11,7 @@ replace go.opentelemetry.io/otel/trace => ../../../trace require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/bridge/opentracing v0.0.0-00010101000000-000000000000 google.golang.org/grpc v1.53.0 diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index e9716d96bd9..2e75e353c12 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -34,8 +34,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= diff --git a/example/fib/go.mod b/example/fib/go.mod index 94bca795e05..d420bfa0252 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index 924770f5797..8372cecb731 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 45c5beb6cff..7b3536d09ed 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 5f94580ae51..80109880bba 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -7,7 +7,7 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 27544d768d8..4e1dea64385 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 924770f5797..8372cecb731 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index c50e526a385..c4f8b12df8e 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v0.36.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index ddd27a7e01e..eb6df8c78c7 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -44,8 +44,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index a4e6bec564a..1dc4984d1c6 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -146,7 +146,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 1cb7f56f262..95ebde4eee6 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -12,7 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 924770f5797..8372cecb731 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 6eda3417020..f9cb265dba1 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.13.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index d7a3b28acfb..aa66d5a71bb 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -197,7 +197,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/view/go.mod b/example/view/go.mod index 9cdc4e70afd..325b373e5bf 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index d7a3b28acfb..aa66d5a71bb 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -197,7 +197,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index d1286fa1285..caa400ab652 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect + golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index f0bcd897167..13784086486 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -8,7 +8,7 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 9fce5a8fb96..5faa47f47bd 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 @@ -16,7 +16,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index bb18ca1cda2..06d66ff92b0 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -16,10 +16,10 @@ github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 2cafe3f3532..4a32afad8f9 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/cenkalti/backoff/v4 v4.2.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 ) require ( diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index 977bd849fa0..b664adcb8c2 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -10,8 +10,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 7f9e9fd1caa..47983abf3ed 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/metric v0.36.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index fd54a0b3161..754e82f6680 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -154,8 +154,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 68d2e72e854..b30ca3bc4bf 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,7 +5,7 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index fd54a0b3161..754e82f6680 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -154,8 +154,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 6fee9f32672..9624e9e30e2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,7 +5,7 @@ go 1.18 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index fd54a0b3161..754e82f6680 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -154,8 +154,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index cdd27da4576..badfb76c0a0 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index fd54a0b3161..754e82f6680 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -154,8 +154,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index dbf2ac5a173..19fb9dc8910 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.18 require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 7e843506492..33fa8184a7b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -153,8 +153,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 3640adbf758..a4fcd5f2e9a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.18 require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 3c07acc5bf1..7d59fcedabb 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -153,8 +153,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 2cb39e5c03e..9ec7eab7c6e 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 @@ -25,7 +25,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index ce806080898..4653b262e79 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -203,8 +203,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -334,8 +334,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index dc3d8ac407d..7a658bbddbf 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric go 1.18 require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 @@ -16,7 +16,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index c9d4248db68..5697cd57f57 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -14,10 +14,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 1c91eb38d9d..11be5ebee54 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index c9d4248db68..5697cd57f57 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -14,10 +14,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index f08f6a1c0de..cc23042c682 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index f22db78c280..1e747f2d521 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -17,10 +17,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= -golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go.mod b/go.mod index 0da4fc72bc7..0dbcc740135 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.3 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel/trace v1.13.0 ) diff --git a/go.sum b/go.sum index 50d5c27f84b..6de0c7c3478 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 445a20241d8..f47bb2347e3 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.51.1 + github.com/golangci/golangci-lint v1.51.2 github.com/itchyny/gojq v0.12.11 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -32,12 +32,12 @@ require ( github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/ashanbrown/forbidigo v1.3.0 // indirect + github.com/ashanbrown/forbidigo v1.4.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bkielbasa/cyclop v1.2.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect - github.com/bombsimon/wsl/v3 v3.3.0 // indirect + github.com/bombsimon/wsl/v3 v3.4.0 // indirect github.com/breml/bidichk v0.2.3 // indirect github.com/breml/errchkjson v0.3.0 // indirect github.com/butuzov/ireturn v0.1.1 // indirect @@ -46,7 +46,7 @@ require ( github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect github.com/cloudflare/circl v1.3.1 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.9.0 // indirect + github.com/daixiang0/gci v0.9.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -57,17 +57,17 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.6.5 // indirect + github.com/go-critic/go-critic v0.6.7 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.4.0 // indirect github.com/go-git/go-git/v5 v5.5.2 // indirect - github.com/go-toolsmith/astcast v1.0.0 // indirect + github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.0.3 // indirect - github.com/go-toolsmith/astequal v1.0.3 // indirect - github.com/go-toolsmith/astfmt v1.0.0 // indirect - github.com/go-toolsmith/astp v1.0.0 // indirect - github.com/go-toolsmith/strparse v1.0.0 // indirect - github.com/go-toolsmith/typep v1.0.2 // indirect + github.com/go-toolsmith/astequal v1.1.0 // indirect + github.com/go-toolsmith/astfmt v1.1.0 // indirect + github.com/go-toolsmith/astp v1.1.0 // indirect + github.com/go-toolsmith/strparse v1.1.0 // indirect + github.com/go-toolsmith/typep v1.1.0 // indirect github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect @@ -100,7 +100,7 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect - github.com/junk1tm/musttag v0.4.4 // indirect + github.com/junk1tm/musttag v0.4.5 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect @@ -135,13 +135,13 @@ require ( github.com/pjbgf/sha1cd v0.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.0.6 // indirect + github.com/polyfloyd/go-errorlint v1.1.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - github.com/quasilyte/go-ruleguard v0.3.18 // indirect - github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f // indirect + github.com/quasilyte/go-ruleguard v0.3.19 // indirect + github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -149,8 +149,8 @@ require ( github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.21.1 // indirect - github.com/securego/gosec/v2 v2.14.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect + github.com/securego/gosec/v2 v2.15.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.0 // indirect @@ -169,7 +169,7 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/stretchr/testify v1.8.1 // indirect + github.com/stretchr/testify v1.8.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.1.1 // indirect @@ -191,7 +191,7 @@ require ( go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect + golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.1.0 // indirect @@ -200,8 +200,9 @@ require ( google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.0 // indirect + honnef.co/go/tools v0.4.2 // indirect mvdan.cc/gofumpt v0.4.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 63bac059d38..027e477de6e 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -78,8 +78,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= -github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/ashanbrown/forbidigo v1.4.0 h1:spdPbupaSqtWORq1Q4eHBoPBmHtwVyLKwaedbSLc5Sw= +github.com/ashanbrown/forbidigo v1.4.0/go.mod h1:IvgwB5Y4fzqSAj/WVXKWigoTkB0dzI2FBbpKWuh7ph8= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -91,8 +91,8 @@ github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7 github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= -github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= -github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= +github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= +github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= @@ -121,11 +121,10 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.9.0 h1:t8XZ0vK6l0pwPoOmoGyqW2NwQlvbpAQNVvu/GRBgykM= -github.com/daixiang0/gci v0.9.0/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= +github.com/daixiang0/gci v0.9.1 h1:jBrwBmBZTDsGsXiaCTLIe9diotp1X4X64zodFrh7l+c= +github.com/daixiang0/gci v0.9.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -156,8 +155,8 @@ github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= -github.com/go-critic/go-critic v0.6.5 h1:fDaR/5GWURljXwF8Eh31T2GZNz9X4jeboS912mWF8Uo= -github.com/go-critic/go-critic v0.6.5/go.mod h1:ezfP/Lh7MA6dBNn4c6ab5ALv3sKnZVLx37tr00uuaOY= +github.com/go-critic/go-critic v0.6.7 h1:1evPrElnLQ2LZtJfmNDzlieDhjnq36SLgNzisx06oPM= +github.com/go-critic/go-critic v0.6.7/go.mod h1:fYZUijFdcnxgx6wPjQA2QEjIRaNCT0gO8bhexy6/QmE= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -178,26 +177,26 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= -github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= -github.com/go-toolsmith/astcopy v1.0.2/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= +github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= +github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.0.3 h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0= github.com/go-toolsmith/astcopy v1.0.3/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= -github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= -github.com/go-toolsmith/astequal v1.0.3 h1:+LVdyRatFS+XO78SGV4I3TCEA0AC7fKEGma+fH+674o= github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= -github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= -github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= -github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= -github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= +github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= +github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsOmcco= +github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= +github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= +github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= -github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= -github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= -github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= +github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= +github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUNHus= +github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig= github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U= github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -243,8 +242,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.51.1 h1:N5HD/x0ZrhJYsgKWyz7yJxxQ8JKR0Acc+FOP7QtGSAA= -github.com/golangci/golangci-lint v1.51.1/go.mod h1:hnyNNO3fJ2Rjwo6HM+VXvcmLkKDOuBAnR9gVlS1mW1E= +github.com/golangci/golangci-lint v1.51.2 h1:yIcsT1X9ZYHdSpeWXRT1ORC/FPGSqDHbHsu9uk4FK7M= +github.com/golangci/golangci-lint v1.51.2/go.mod h1:KH9Q7/3glwpYSknxUgUyLlAv46A8fsSKo1hH2wDvkr8= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -351,8 +350,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/junk1tm/musttag v0.4.4 h1:VK4L7v7lvWAhKDDx0cUJgbb0UBNipYinv8pPeHJzH9Q= -github.com/junk1tm/musttag v0.4.4/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= +github.com/junk1tm/musttag v0.4.5 h1:d+mpJ1vn6WFEVKHwkgJiIedis1u/EawKOuUTygAUtCo= +github.com/junk1tm/musttag v0.4.5/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -438,8 +437,8 @@ github.com/nunnatsa/ginkgolinter v0.8.1 h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuY github.com/nunnatsa/ginkgolinter v0.8.1/go.mod h1:FYYLtszIdmzCH8XMaMPyxPVXZ7VCaIm55bA+gugx+14= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.3.1 h1:8SbseP7qM32WcvE6VaN6vfXxv698izmsJ1UQX9ve7T8= -github.com/onsi/gomega v1.22.1 h1:pY8O4lBfsHKZHM/6nrxkhVPUznOlIu3quZcKP/M20KI= +github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -457,8 +456,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.0.6 h1:ZevdyEGxDoHAMQUVvdTT06hnYuKULe8TQkOmIYx6s1c= -github.com/polyfloyd/go-errorlint v1.0.6/go.mod h1:NcnNncnm8fVV7vfQWiI4HZrzWFzGp24C262IQutNcMs= +github.com/polyfloyd/go-errorlint v1.1.0 h1:VKoEFg5yxSgJ2yFPVhxW7oGz+f8/OVcuMeNvcPIi6Eg= +github.com/polyfloyd/go-errorlint v1.1.0/go.mod h1:Uss7Bc/izYG0leCMRx3WVlrpqWedSZk7V/FUQW6VJ6U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -485,15 +484,10 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/quasilyte/go-ruleguard v0.3.1-0.20210203134552-1b5a410e1cc8/go.mod h1:KsAh3x0e7Fkpgs+Q9pNLS5XpFSvYCEVl5gP9Pp1xp30= -github.com/quasilyte/go-ruleguard v0.3.18 h1:sd+abO1PEI9fkYennwzHn9kl3nqP6M5vE7FiOzZ+5CE= -github.com/quasilyte/go-ruleguard v0.3.18/go.mod h1:lOIzcYlgxrQ2sGJ735EHXmf/e9MJ516j16K/Ifcttvs= -github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= -github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= -github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f h1:6Gtn2i04RD0gVyYf2/IUMTIs+qYleBt4zxDqkLTcu4U= -github.com/quasilyte/gogrep v0.0.0-20220828223005-86e4605de09f/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= +github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZyPmD9nVcc= +github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= +github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= +github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= @@ -511,10 +505,10 @@ github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/ github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.21.1 h1:GQGlReyL9Ek8DdJmwtwhHbhwHnuPfsKaprpjnrPcjxc= -github.com/sashamelentyev/usestdlibvars v1.21.1/go.mod h1:MPI52Qq99iO9sFZZcKJ2y/bx6BNjs+/2bw3PCggIbew= -github.com/securego/gosec/v2 v2.14.0 h1:U1hfs0oBackChXA72plCYVA4cOlQ4gO+209dHiSNZbI= -github.com/securego/gosec/v2 v2.14.0/go.mod h1:Ff03zEi5NwSOfXj9nFpBfhbWTtROCkg9N+9goggrYn4= +github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1jbEOPrEhDzGYq0= +github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= +github.com/securego/gosec/v2 v2.15.0 h1:v4Ym7FF58/jlykYmmhZ7mTm7FQvN/setNm++0fgIAtw= +github.com/securego/gosec/v2 v2.15.0/go.mod h1:VOjTrZOkUtSDt2QLSJmQBMWnvwiQPEjg0l+5juIqGk8= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -570,8 +564,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= @@ -667,9 +662,8 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE= -golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 h1:6WHiuFL9FNjg8RljAaT7FNUuKDbvMqS1i5cr2OE2sLQ= +golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -882,7 +876,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190916130336-e45ffcd953cc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -916,7 +909,6 @@ golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= @@ -926,7 +918,6 @@ golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -935,7 +926,6 @@ golang.org/x/tools v0.1.1-0.20210205202024-ef80cdb6ec6d/go.mod h1:9bzcO0MWcOuT0t golang.org/x/tools v0.1.1-0.20210302220138-2ac05c832e1a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9-0.20211228192929-ee1ca4ffc4da/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4= @@ -1058,8 +1048,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -1072,8 +1062,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.0 h1:lyXVV1c8wUBJRKqI8JgIpT8TW1VDagfYYaxbKa/HoL8= -honnef.co/go/tools v0.4.0/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= +honnef.co/go/tools v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc= +honnef.co/go/tools v0.4.2/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= diff --git a/metric/go.mod b/metric/go.mod index f2c759659af..b51092dac01 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/metric go 1.18 require ( - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 ) diff --git a/metric/go.sum b/metric/go.sum index 1685a59f6e2..30515f028a5 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -14,8 +14,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/schema/go.mod b/schema/go.mod index fac2c98594d..6f057a53e03 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/Masterminds/semver/v3 v3.2.0 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index c5dd6347af8..6756672d0f5 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -10,8 +10,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sdk/go.mod b/sdk/go.mod index d775aec0301..af728762629 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,10 +7,10 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/trace v1.13.0 - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 + golang.org/x/sys v0.5.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index d71e51729eb..4a61b1dabd1 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -15,10 +15,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 2753dbe7eba..2a5f2f408ea 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect - golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index c9d4248db68..5697cd57f57 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -14,10 +14,10 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= -golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/trace/go.mod b/trace/go.mod index 74f59628903..352e1d63056 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 ) diff --git a/trace/go.sum b/trace/go.sum index 64456627351..28782004b3d 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -10,8 +10,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 01bbea3285e945d83de4e5092be241f891cfb826 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 26 Feb 2023 08:27:14 -0800 Subject: [PATCH 429/886] Bump lycheeverse/lychee-action from 1.5.4 to 1.6.1 (#3780) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.5.4 to 1.6.1. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.5.4...v1.6.1) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 1952ac6776b..9b4f3f84c3a 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.5.4 + uses: lycheeverse/lychee-action@v1.6.1 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 425a9837a52..21707a9aa35 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.5.4 + uses: lycheeverse/lychee-action@v1.6.1 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 17e5d0f54947864e7fea2c915fd12d69142a61c7 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 27 Feb 2023 09:10:55 -0600 Subject: [PATCH 430/886] Do not wrap error if multierror does not have one. (#3772) --- CHANGELOG.md | 1 + sdk/metric/pipeline.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39078e56970..f074549afb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) - Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) - Data race issue in OTLP exporter retry mechanism. (#3756) +- Fixes wrapping a nil error in some cases (#????) ## [1.13.0/0.36.0] 2023-02-07 diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index c58c113e2b3..91e29aa2f9a 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -551,6 +551,9 @@ func (m *multierror) errorOrNil() error { if len(m.errors) == 0 { return nil } + if m.wrapped == nil { + return errors.New(strings.Join(m.errors, "; ")) + } return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; ")) } From fe6856e804ae20edbd6e6aa367cddff2ead349e2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 27 Feb 2023 08:10:56 -0800 Subject: [PATCH 431/886] Deprecate `metric/unit` and use a `string` for units in the metric API/SDK (#3776) * Replace Unit from metric/unit with string Deprecate the units package. This package will not be included in the metric GA. * Add changes to changelog --- CHANGELOG.md | 9 +++ bridge/opencensus/go.mod | 2 +- bridge/opencensus/internal/ocmetric/metric.go | 16 +---- .../internal/ocmetric/metric_test.go | 49 +++------------ exporters/otlp/otlpmetric/go.mod | 2 +- .../otlp/otlpmetric/internal/otest/client.go | 11 ++-- .../internal/transform/metricdata_test.go | 27 ++++---- exporters/prometheus/exporter.go | 9 ++- exporters/prometheus/exporter_test.go | 61 +++++++++---------- exporters/stdout/stdoutmetric/example_test.go | 7 +-- exporters/stdout/stdoutmetric/go.mod | 2 +- metric/example_test.go | 5 +- metric/instrument/asyncfloat64.go | 5 +- metric/instrument/asyncfloat64_test.go | 3 +- metric/instrument/asyncint64.go | 5 +- metric/instrument/asyncint64_test.go | 3 +- metric/instrument/instrument.go | 14 ++--- metric/instrument/syncfloat64.go | 5 +- metric/instrument/syncfloat64_test.go | 4 +- metric/instrument/syncint64.go | 5 +- metric/instrument/syncint64_test.go | 4 +- metric/unit/doc.go | 5 +- metric/unit/unit.go | 2 + sdk/metric/instrument.go | 20 +++--- sdk/metric/meter.go | 9 ++- sdk/metric/metricdata/data.go | 3 +- .../metricdatatest/assertion_test.go | 7 +-- sdk/metric/pipeline.go | 3 +- sdk/metric/pipeline_test.go | 11 ++-- sdk/metric/reader_test.go | 5 +- sdk/metric/view_test.go | 47 +++++++------- 31 files changed, 148 insertions(+), 212 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f074549afb6..b3313a77312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders. (#3679) - The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. This change is made to enable memory reuse by SDK users. (#3732) +- The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) ### Fixed @@ -51,6 +52,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Data race issue in OTLP exporter retry mechanism. (#3756) - Fixes wrapping a nil error in some cases (#????) +### Deprecated + +- The `go.opentelemetry.io/otel/metric/unit` package is deprecated. + Use the equivalent unit string instead. (#3776) + - Use `"1"` instead of `unit.Dimensionless` + - Use `"By"` instead of `unit.Bytes` + - Use `"ms"` instead of `unit.Milliseconds` + ## [1.13.0/0.36.0] 2023-02-07 ### Added diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index cd65077888c..e6d6bc56f4c 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -6,7 +6,6 @@ require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/otel/trace v1.13.0 @@ -19,6 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.36.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index 54b6619a1f6..40c2e3c361f 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -21,7 +21,6 @@ import ( ocmetricdata "go.opencensus.io/metric/metricdata" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -52,7 +51,7 @@ func ConvertMetrics(ocmetrics []*ocmetricdata.Metric) ([]metricdata.Metrics, err otelMetrics = append(otelMetrics, metricdata.Metrics{ Name: ocm.Descriptor.Name, Description: ocm.Descriptor.Description, - Unit: convertUnit(ocm.Descriptor.Unit), + Unit: string(ocm.Descriptor.Unit), Data: agg, }) } @@ -201,16 +200,3 @@ func convertAttrs(keys []ocmetricdata.LabelKey, values []ocmetricdata.LabelValue } return attribute.NewSet(attrs...), nil } - -// convertUnit converts from the OpenCensus unit to OpenTelemetry unit. -func convertUnit(u ocmetricdata.Unit) unit.Unit { - switch u { - case ocmetricdata.UnitDimensionless: - return unit.Dimensionless - case ocmetricdata.UnitBytes: - return unit.Bytes - case ocmetricdata.UnitMilliseconds: - return unit.Milliseconds - } - return unit.Unit(string(u)) -} diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index 19f74a6a887..7ee312a9f13 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -22,7 +22,6 @@ import ( ocmetricdata "go.opencensus.io/metric/metricdata" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) @@ -214,7 +213,7 @@ func TestConvertMetrics(t *testing.T) { { Name: "foo.com/histogram-a", Description: "a testing histogram", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Histogram{ DataPoints: []metricdata.HistogramDataPoint{ { @@ -252,7 +251,7 @@ func TestConvertMetrics(t *testing.T) { }, { Name: "foo.com/gauge-a", Description: "an int testing gauge", - Unit: unit.Bytes, + Unit: "By", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ { @@ -281,7 +280,7 @@ func TestConvertMetrics(t *testing.T) { }, { Name: "foo.com/gauge-b", Description: "a float testing gauge", - Unit: unit.Bytes, + Unit: "By", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ { @@ -310,7 +309,7 @@ func TestConvertMetrics(t *testing.T) { }, { Name: "foo.com/sum-a", Description: "an int testing sum", - Unit: unit.Milliseconds, + Unit: "ms", Data: metricdata.Sum[int64]{ IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, @@ -341,7 +340,7 @@ func TestConvertMetrics(t *testing.T) { }, { Name: "foo.com/sum-b", Description: "a float testing sum", - Unit: unit.Milliseconds, + Unit: "ms", Data: metricdata.Sum[float64]{ IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, @@ -387,7 +386,7 @@ func TestConvertMetrics(t *testing.T) { { Name: "foo.com/histogram-a", Description: "a testing histogram", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Histogram{ Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint{}, @@ -410,7 +409,7 @@ func TestConvertMetrics(t *testing.T) { { Name: "foo.com/sum-a", Description: "a testing sum", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Sum[float64]{ IsMonotonic: true, Temporality: metricdata.CumulativeTemporality, @@ -434,7 +433,7 @@ func TestConvertMetrics(t *testing.T) { { Name: "foo.com/gauge-a", Description: "a testing gauge", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{}, }, @@ -580,38 +579,6 @@ func TestConvertMetrics(t *testing.T) { } } -func TestConvertUnits(t *testing.T) { - var noUnit unit.Unit - for _, tc := range []struct { - desc string - input ocmetricdata.Unit - expected unit.Unit - }{{ - desc: "unspecified unit", - expected: noUnit, - }, { - desc: "dimensionless", - input: ocmetricdata.UnitDimensionless, - expected: unit.Dimensionless, - }, { - desc: "milliseconds", - input: ocmetricdata.UnitMilliseconds, - expected: unit.Milliseconds, - }, { - desc: "bytes", - input: ocmetricdata.UnitBytes, - expected: unit.Bytes, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - output := convertUnit(tc.input) - if output != tc.expected { - t.Errorf("convertUnit(%v) = %q, want %q", tc.input, output, tc.expected) - } - }) - } -} - func TestConvertAttributes(t *testing.T) { setWithMultipleKeys := attribute.NewSet( attribute.KeyValue{Key: attribute.Key("first"), Value: attribute.StringValue("1")}, diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 47983abf3ed..8ed3a872833 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -7,7 +7,6 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/sdk/metric v0.36.0 go.opentelemetry.io/proto/otlp v0.19.0 @@ -23,6 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.36.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index dbefcc8f354..9da08bceec7 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - "go.opentelemetry.io/otel/metric/unit" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" cpb "go.opentelemetry.io/proto/otlp/common/v1" @@ -118,31 +117,31 @@ var ( { Name: "int64-gauge", Description: "Gauge with int64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, }, { Name: "float64-gauge", Description: "Gauge with float64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, }, { Name: "int64-sum", Description: "Sum with int64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Sum{Sum: sumInt64}, }, { Name: "float64-sum", Description: "Sum with float64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Sum{Sum: sumFloat64}, }, { Name: "histogram", Description: "Histogram", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Histogram{Histogram: hist}, }, } diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 8744d40d4a6..7852d9044cd 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -22,7 +22,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -188,49 +187,49 @@ var ( { Name: "int64-gauge", Description: "Gauge with int64 values", - Unit: unit.Dimensionless, + Unit: "1", Data: otelGaugeInt64, }, { Name: "float64-gauge", Description: "Gauge with float64 values", - Unit: unit.Dimensionless, + Unit: "1", Data: otelGaugeFloat64, }, { Name: "int64-sum", Description: "Sum with int64 values", - Unit: unit.Dimensionless, + Unit: "1", Data: otelSumInt64, }, { Name: "float64-sum", Description: "Sum with float64 values", - Unit: unit.Dimensionless, + Unit: "1", Data: otelSumFloat64, }, { Name: "invalid-sum", Description: "Sum with invalid temporality", - Unit: unit.Dimensionless, + Unit: "1", Data: otelSumInvalid, }, { Name: "histogram", Description: "Histogram", - Unit: unit.Dimensionless, + Unit: "1", Data: otelHist, }, { Name: "invalid-histogram", Description: "Invalid histogram", - Unit: unit.Dimensionless, + Unit: "1", Data: otelHistInvalid, }, { Name: "unknown", Description: "Unknown aggregation", - Unit: unit.Dimensionless, + Unit: "1", Data: unknownAgg, }, } @@ -239,31 +238,31 @@ var ( { Name: "int64-gauge", Description: "Gauge with int64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, }, { Name: "float64-gauge", Description: "Gauge with float64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, }, { Name: "int64-sum", Description: "Sum with int64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Sum{Sum: pbSumInt64}, }, { Name: "float64-sum", Description: "Sum with float64 values", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, }, { Name: "histogram", Description: "Histogram", - Unit: string(unit.Dimensionless), + Unit: "1", Data: &mpb.Metric_Histogram{Histogram: pbHist}, }, } diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index feb8d0c5acc..1539062b501 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -31,7 +31,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -309,10 +308,10 @@ func sanitizeRune(r rune) rune { return '_' } -var unitSuffixes = map[unit.Unit]string{ - unit.Dimensionless: "_ratio", - unit.Bytes: "_bytes", - unit.Milliseconds: "_milliseconds", +var unitSuffixes = map[string]string{ + "1": "_ratio", + "By": "_bytes", + "ms": "_milliseconds", } // getName returns the sanitized name, including unit suffix. diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 067d1951bdc..164dcbd0956 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" @@ -56,7 +55,7 @@ func TestPrometheusExporter(t *testing.T) { counter, err := meter.Float64Counter( "foo", instrument.WithDescription("a simple counter"), - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), ) require.NoError(t, err) counter.Add(ctx, 5, attrs...) @@ -83,7 +82,7 @@ func TestPrometheusExporter(t *testing.T) { gauge, err := meter.Float64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), - instrument.WithUnit(unit.Dimensionless), + instrument.WithUnit("1"), ) require.NoError(t, err) gauge.Add(ctx, 1.0, attrs...) @@ -101,7 +100,7 @@ func TestPrometheusExporter(t *testing.T) { histogram, err := meter.Float64Histogram( "histogram_baz", instrument.WithDescription("a very nice histogram"), - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), ) require.NoError(t, err) histogram.Record(ctx, 23, attrs...) @@ -128,7 +127,7 @@ func TestPrometheusExporter(t *testing.T) { "foo", instrument.WithDescription("a sanitary counter"), // This unit is not added to - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), ) require.NoError(t, err) counter.Add(ctx, 5, attrs...) @@ -233,7 +232,7 @@ func TestPrometheusExporter(t *testing.T) { gauge, err := meter.Int64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), - instrument.WithUnit(unit.Dimensionless), + instrument.WithUnit("1"), ) require.NoError(t, err) gauge.Add(ctx, 2, attrs...) @@ -252,7 +251,7 @@ func TestPrometheusExporter(t *testing.T) { counter, err := meter.Int64Counter( "bar", instrument.WithDescription("a fun little counter"), - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), ) require.NoError(t, err) counter.Add(ctx, 2, attrs...) @@ -366,7 +365,7 @@ func TestMultiScopes(t *testing.T) { fooCounter, err := provider.Meter("meterfoo", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "foo", - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), instrument.WithDescription("meter foo counter")) assert.NoError(t, err) fooCounter.Add(ctx, 100, attribute.String("type", "foo")) @@ -374,7 +373,7 @@ func TestMultiScopes(t *testing.T) { barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "bar", - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), instrument.WithDescription("meter bar counter")) assert.NoError(t, err) barCounter.Add(ctx, 200, attribute.String("type", "bar")) @@ -399,13 +398,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64Counter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) fooB, err := meterB.Int64Counter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) fooB.Add(ctx, 100, attribute.String("A", "B")) @@ -416,13 +415,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64UpDownCounter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) fooB, err := meterB.Int64UpDownCounter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) fooB.Add(ctx, 100, attribute.String("A", "B")) @@ -433,13 +432,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64Histogram("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) fooA.Record(ctx, 100, attribute.String("A", "B")) fooB, err := meterB.Int64Histogram("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) fooB.Record(ctx, 100, attribute.String("A", "B")) @@ -450,13 +449,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Counter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) barB, err := meterB.Int64Counter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) barB.Add(ctx, 100, attribute.String("type", "bar")) @@ -470,13 +469,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64UpDownCounter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) barB, err := meterB.Int64UpDownCounter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) barB.Add(ctx, 100, attribute.String("type", "bar")) @@ -490,13 +489,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Histogram("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) barA.Record(ctx, 100, attribute.String("A", "B")) barB, err := meterB.Int64Histogram("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) barB.Record(ctx, 100, attribute.String("A", "B")) @@ -510,13 +509,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { bazA, err := meterA.Int64Counter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter bar")) assert.NoError(t, err) bazA.Add(ctx, 100, attribute.String("type", "bar")) bazB, err := meterB.Int64Counter("bar", - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), instrument.WithDescription("meter bar")) assert.NoError(t, err) bazB.Add(ctx, 100, attribute.String("type", "bar")) @@ -528,13 +527,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64UpDownCounter("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) barA.Add(ctx, 100, attribute.String("type", "bar")) barB, err := meterB.Int64UpDownCounter("bar", - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) barB.Add(ctx, 100, attribute.String("type", "bar")) @@ -546,13 +545,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Histogram("bar", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) barA.Record(ctx, 100, attribute.String("A", "B")) barB, err := meterB.Int64Histogram("bar", - instrument.WithUnit(unit.Milliseconds), + instrument.WithUnit("ms"), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) barB.Record(ctx, 100, attribute.String("A", "B")) @@ -564,13 +563,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_type_counter_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { counter, err := meterA.Int64Counter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter foo")) assert.NoError(t, err) counter.Add(ctx, 100, attribute.String("type", "foo")) gauge, err := meterA.Int64UpDownCounter("foo_total", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter foo")) assert.NoError(t, err) gauge.Add(ctx, 200, attribute.String("type", "foo")) @@ -585,13 +584,13 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_type_histogram_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64UpDownCounter("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, attribute.String("A", "B")) fooHistogramA, err := meterA.Int64Histogram("foo", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) fooHistogramA.Record(ctx, 100, attribute.String("A", "B")) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index fdce6951df7..3ab5b45ea89 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -47,7 +46,7 @@ var ( { Name: "requests", Description: "Number of requests received", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Sum[int64]{ IsMonotonic: true, Temporality: metricdata.DeltaTemporality, @@ -64,7 +63,7 @@ var ( { Name: "latency", Description: "Time spend processing received requests", - Unit: unit.Milliseconds, + Unit: "ms", Data: metricdata.Histogram{ Temporality: metricdata.DeltaTemporality, DataPoints: []metricdata.HistogramDataPoint{ @@ -83,7 +82,7 @@ var ( { Name: "temperature", Description: "CPU global temperature", - Unit: unit.Unit("cel(1 K)"), + Unit: "cel(1 K)", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ { diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 7a658bbddbf..99efffa4686 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -5,7 +5,6 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/metric v0.36.0 go.opentelemetry.io/otel/sdk v1.13.0 go.opentelemetry.io/otel/sdk/metric v0.36.0 ) @@ -15,6 +14,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.36.0 // indirect go.opentelemetry.io/otel/trace v1.13.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/metric/example_test.go b/metric/example_test.go index 579404c7593..ef7f09019ee 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" ) //nolint:govet // Meter doesn't register for go vet @@ -33,7 +32,7 @@ func ExampleMeter_synchronous() { workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", - instrument.WithUnit(unit.Milliseconds)) + instrument.WithUnit("ms")) if err != nil { fmt.Println("Failed to register instrument") panic(err) @@ -54,7 +53,7 @@ func ExampleMeter_asynchronous_single() { _, err := meter.Int64ObservableGauge( "DiskUsage", - instrument.WithUnit(unit.Bytes), + instrument.WithUnit("By"), instrument.WithInt64Callback(func(_ context.Context, obsrv instrument.Int64Observer) error { // Do the real work here to get the real disk usage. For example, // diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index 2f624bfe005..0b5d5a99c0f 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) // Float64Observable describes a set of instruments used asynchronously to @@ -82,7 +81,7 @@ type Float64Callback func(context.Context, Float64Observer) error // observe float64 values. type Float64ObserverConfig struct { description string - unit unit.Unit + unit string callbacks []Float64Callback } @@ -102,7 +101,7 @@ func (c Float64ObserverConfig) Description() string { } // Unit returns the Config unit. -func (c Float64ObserverConfig) Unit() unit.Unit { +func (c Float64ObserverConfig) Unit() string { return c.unit } diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index 7f315babaad..5333648e095 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -22,14 +22,13 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) func TestFloat64ObserverOptions(t *testing.T) { const ( token float64 = 43 desc = "Instrument description." - uBytes = unit.Bytes + uBytes = "By" ) got := NewFloat64ObserverConfig( diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index ac0d09d90cd..05feeacb053 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) // Int64Observable describes a set of instruments used asynchronously to record @@ -82,7 +81,7 @@ type Int64Callback func(context.Context, Int64Observer) error // observe int64 values. type Int64ObserverConfig struct { description string - unit unit.Unit + unit string callbacks []Int64Callback } @@ -102,7 +101,7 @@ func (c Int64ObserverConfig) Description() string { } // Unit returns the Config unit. -func (c Int64ObserverConfig) Unit() unit.Unit { +func (c Int64ObserverConfig) Unit() string { return c.unit } diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index bb4309e594a..32b7edfa026 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -22,14 +22,13 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) func TestInt64ObserverOptions(t *testing.T) { const ( token int64 = 43 desc = "Instrument description." - uBytes = unit.Bytes + uBytes = "By" ) got := NewInt64ObserverConfig( diff --git a/metric/instrument/instrument.go b/metric/instrument/instrument.go index c583be6fbf1..f6dd9e890f4 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument/instrument.go @@ -14,8 +14,6 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" -import "go.opentelemetry.io/otel/metric/unit" - // Asynchronous instruments are instruments that are updated within a Callback. // If an instrument is observed outside of it's callback it should be an error. // @@ -64,27 +62,27 @@ func (o descOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { // WithDescription sets the instrument description. func WithDescription(desc string) Option { return descOpt(desc) } -type unitOpt unit.Unit +type unitOpt string func (o unitOpt) applyFloat64(c Float64Config) Float64Config { - c.unit = unit.Unit(o) + c.unit = string(o) return c } func (o unitOpt) applyInt64(c Int64Config) Int64Config { - c.unit = unit.Unit(o) + c.unit = string(o) return c } func (o unitOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig { - c.unit = unit.Unit(o) + c.unit = string(o) return c } func (o unitOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { - c.unit = unit.Unit(o) + c.unit = string(o) return c } // WithUnit sets the instrument unit. -func WithUnit(u unit.Unit) Option { return unitOpt(u) } +func WithUnit(u string) Option { return unitOpt(u) } diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index d8f6ba9f438..2cdfeb2691a 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) // Float64Counter is an instrument that records increasing float64 values. @@ -57,7 +56,7 @@ type Float64Histogram interface { // observe float64 values. type Float64Config struct { description string - unit unit.Unit + unit string } // Float64Config contains options for Synchronous instruments that record @@ -76,7 +75,7 @@ func (c Float64Config) Description() string { } // Unit returns the Config unit. -func (c Float64Config) Unit() unit.Unit { +func (c Float64Config) Unit() string { return c.unit } diff --git a/metric/instrument/syncfloat64_test.go b/metric/instrument/syncfloat64_test.go index 8e90e15ddde..8cc0f5978ae 100644 --- a/metric/instrument/syncfloat64_test.go +++ b/metric/instrument/syncfloat64_test.go @@ -18,15 +18,13 @@ import ( "testing" "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/metric/unit" ) func TestFloat64Options(t *testing.T) { const ( token float64 = 43 desc = "Instrument description." - uBytes = unit.Bytes + uBytes = "By" ) got := NewFloat64Config(WithDescription(desc), WithUnit(uBytes)) diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index 96bf730e4b3..e212c6d695f 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" ) // Int64Counter is an instrument that records increasing int64 values. @@ -57,7 +56,7 @@ type Int64Histogram interface { // values. type Int64Config struct { description string - unit unit.Unit + unit string } // NewInt64Config returns a new Int64Config with all opts @@ -76,7 +75,7 @@ func (c Int64Config) Description() string { } // Unit returns the Config unit. -func (c Int64Config) Unit() unit.Unit { +func (c Int64Config) Unit() string { return c.unit } diff --git a/metric/instrument/syncint64_test.go b/metric/instrument/syncint64_test.go index 3eb39915499..d352ee477f2 100644 --- a/metric/instrument/syncint64_test.go +++ b/metric/instrument/syncint64_test.go @@ -18,15 +18,13 @@ import ( "testing" "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/metric/unit" ) func TestInt64Options(t *testing.T) { const ( token int64 = 43 desc = "Instrument description." - uBytes = unit.Bytes + uBytes = "By" ) got := NewInt64Config(WithDescription(desc), WithUnit(uBytes)) diff --git a/metric/unit/doc.go b/metric/unit/doc.go index f8e723593e6..051c2b58b92 100644 --- a/metric/unit/doc.go +++ b/metric/unit/doc.go @@ -14,7 +14,6 @@ // Package unit provides units. // -// This package is currently in a pre-GA phase. Backwards incompatible changes -// may be introduced in subsequent minor version releases as we work to track -// the evolving OpenTelemetry specification and user feedback. +// Deprecated: This package will be removed in the next release. Use the +// equivalent unit string instead. package unit // import "go.opentelemetry.io/otel/metric/unit" diff --git a/metric/unit/unit.go b/metric/unit/unit.go index 647d77302de..6e06474051f 100644 --- a/metric/unit/unit.go +++ b/metric/unit/unit.go @@ -15,6 +15,8 @@ package unit // import "go.opentelemetry.io/otel/metric/unit" // Unit is a determinate standard quantity of measurement. +// +// Deprecated: This will be removed in the next release. type Unit string // Units defined by OpenTelemetry. diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 7b09c58fbfa..e6ab97c9f94 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -21,7 +21,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" @@ -29,7 +28,6 @@ import ( ) var ( - zeroUnit unit.Unit zeroInstrumentKind InstrumentKind zeroScope instrumentation.Scope ) @@ -76,7 +74,7 @@ type Instrument struct { // Kind defines the functional group of the instrument. Kind InstrumentKind // Unit is the unit of measurement recorded by the instrument. - Unit unit.Unit + Unit string // Scope identifies the instrumentation that created the instrument. Scope instrumentation.Scope @@ -89,7 +87,7 @@ func (i Instrument) empty() bool { return i.Name == "" && i.Description == "" && i.Kind == zeroInstrumentKind && - i.Unit == zeroUnit && + i.Unit == "" && i.Scope == zeroScope } @@ -125,7 +123,7 @@ func (i Instrument) matchesKind(other Instrument) bool { // matchesUnit returns true if the Unit of i is its zero-value or it equals the // Unit of other, otherwise false. func (i Instrument) matchesUnit(other Instrument) bool { - return i.Unit == zeroUnit || i.Unit == other.Unit + return i.Unit == "" || i.Unit == other.Unit } // matchesScope returns true if the Scope of i is its zero-value or it equals @@ -143,7 +141,7 @@ type Stream struct { // Description describes the purpose of the data. Description string // Unit is the unit of measurement recorded. - Unit unit.Unit + Unit string // Aggregation the stream uses for an instrument. Aggregation aggregation.Aggregation // AttributeFilter applied to all attributes recorded for an instrument. @@ -157,7 +155,7 @@ type streamID struct { // Description is the description of the stream. Description string // Unit is the unit of the stream. - Unit unit.Unit + Unit string // Aggregation is the aggregation data type of the stream. Aggregation string // Monotonic is the monotonicity of an instruments data type. This field is @@ -206,7 +204,7 @@ type observablID[N int64 | float64] struct { name string description string kind InstrumentKind - unit unit.Unit + unit string scope instrumentation.Scope } @@ -219,7 +217,7 @@ var _ instrument.Float64ObservableCounter = float64Observable{} var _ instrument.Float64ObservableUpDownCounter = float64Observable{} var _ instrument.Float64ObservableGauge = float64Observable{} -func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[float64]) float64Observable { +func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[float64]) float64Observable { return float64Observable{ observable: newObservable[float64](scope, kind, name, desc, u, agg), } @@ -234,7 +232,7 @@ var _ instrument.Int64ObservableCounter = int64Observable{} var _ instrument.Int64ObservableUpDownCounter = int64Observable{} var _ instrument.Int64ObservableGauge = int64Observable{} -func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[int64]) int64Observable { +func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[int64]) int64Observable { return int64Observable{ observable: newObservable[int64](scope, kind, name, desc, u, agg), } @@ -247,7 +245,7 @@ type observable[N int64 | float64] struct { aggregators []internal.Aggregator[N] } -func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc string, u unit.Unit, agg []internal.Aggregator[N]) *observable[N] { +func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[N]) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index b8d290e7021..b283701f23c 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/internal" ) @@ -374,7 +373,7 @@ func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c return &instProvider[N]{scope: s, pipes: p, resolve: newResolver[N](p, c)} } -func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc string, u unit.Unit) ([]internal.Aggregator[N], error) { +func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[N], error) { inst := Instrument{ Name: name, Description: desc, @@ -386,14 +385,14 @@ func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc string, u unit.Un } // lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (*instrumentImpl[N], error) { +func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc, u string) (*instrumentImpl[N], error) { aggs, err := p.aggs(kind, name, desc, u) return &instrumentImpl[N]{aggregators: aggs}, err } type int64ObservProvider struct{ *instProvider[int64] } -func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (int64Observable, error) { +func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) return newInt64Observable(p.scope, kind, name, desc, u, aggs), err } @@ -424,7 +423,7 @@ func (o int64Observer) Observe(val int64, attrs ...attribute.KeyValue) { type float64ObservProvider struct{ *instProvider[float64] } -func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc string, u unit.Unit) (float64Observable, error) { +func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (float64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) return newFloat64Observable(p.scope, kind, name, desc, u, aggs), err } diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index cd882c0bd2d..8847fddcbc7 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -18,7 +18,6 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" ) @@ -47,7 +46,7 @@ type Metrics struct { // Description is the description of the Instrument, which can be used in documentation. Description string // Unit is the unit in which the Instrument reports. - Unit unit.Unit + Unit string // Data is the aggregated data from an Instrument. Data Aggregation } diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 7056ee71293..ffb3627bd42 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -175,19 +174,19 @@ var ( metricsA = metricdata.Metrics{ Name: "A", Description: "A desc", - Unit: unit.Dimensionless, + Unit: "1", Data: sumInt64A, } metricsB = metricdata.Metrics{ Name: "B", Description: "B desc", - Unit: unit.Bytes, + Unit: "By", Data: gaugeFloat64B, } metricsC = metricdata.Metrics{ Name: "A", Description: "A desc", - Unit: unit.Dimensionless, + Unit: "1", Data: sumInt64C, } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 91e29aa2f9a..47a44fda71c 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" @@ -48,7 +47,7 @@ type aggregator interface { type instrumentSync struct { name string description string - unit unit.Unit + unit string aggregator aggregator } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index ded48ac1622..c7e8d31f5ed 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" @@ -48,7 +47,7 @@ func TestEmptyPipeline(t *testing.T) { assert.Nil(t, output.Resource) assert.Len(t, output.ScopeMetrics, 0) - iSync := instrumentSync{"name", "desc", unit.Dimensionless, testSumAggregator{}} + iSync := instrumentSync{"name", "desc", "1", testSumAggregator{}} assert.NotPanics(t, func() { pipe.addSync(instrumentation.Scope{}, iSync) }) @@ -72,7 +71,7 @@ func TestNewPipeline(t *testing.T) { assert.Equal(t, resource.Empty(), output.Resource) assert.Len(t, output.ScopeMetrics, 0) - iSync := instrumentSync{"name", "desc", unit.Dimensionless, testSumAggregator{}} + iSync := instrumentSync{"name", "desc", "1", testSumAggregator{}} assert.NotPanics(t, func() { pipe.addSync(instrumentation.Scope{}, iSync) }) @@ -114,7 +113,7 @@ func TestPipelineConcurrency(t *testing.T) { go func(n int) { defer wg.Done() name := fmt.Sprintf("name %d", n) - sync := instrumentSync{name, "desc", unit.Dimensionless, testSumAggregator{}} + sync := instrumentSync{name, "desc", "1", testSumAggregator{}} pipe.addSync(instrumentation.Scope{}, sync) }(i) @@ -137,7 +136,7 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { Name: "requests", Description: "count of requests received", Kind: InstrumentKindCounter, - Unit: unit.Dimensionless, + Unit: "1", } return func(t *testing.T) { reader := NewManualReader() @@ -176,7 +175,7 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { metricdatatest.AssertEqual(t, metricdata.Metrics{ Name: inst.Name, Description: inst.Description, - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Sum[N]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 5397fec3b18..85ddca62288 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" @@ -211,7 +210,7 @@ var testScopeMetricsA = metricdata.ScopeMetrics{ Metrics: []metricdata.Metrics{{ Name: "fake data", Description: "Data used to test a reader", - Unit: unit.Dimensionless, + Unit: "1", Data: metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, @@ -230,7 +229,7 @@ var testScopeMetricsB = metricdata.ScopeMetrics{ Metrics: []metricdata.Metrics{{ Name: "fake scope data", Description: "Data used to test a Producer reader", - Unit: unit.Milliseconds, + Unit: "ms", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{{ Attributes: attribute.NewSet(attribute.String("user", "ben")), diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 32b93b74fe4..d74d1e5b43a 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" ) @@ -37,7 +36,7 @@ var ( Name: "foo", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: instrumentation.Scope{ Name: "TestNewViewMatch", Version: "v0.1.0", @@ -206,12 +205,12 @@ func TestNewViewMatch(t *testing.T) { }, { name: "Unit", - criteria: Instrument{Unit: unit.Bytes}, - matches: []Instrument{{Unit: unit.Bytes}, completeIP}, + criteria: Instrument{Unit: "By"}, + matches: []Instrument{{Unit: "By"}, completeIP}, notMatches: []Instrument{ {}, - {Unit: unit.Dimensionless}, - {Unit: unit.Unit("K")}, + {Unit: "1"}, + {Unit: "K"}, }, }, { @@ -278,49 +277,49 @@ func TestNewViewMatch(t *testing.T) { Name: "Wrong Name", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "Wrong Description", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", Kind: InstrumentKindObservableUpDownCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Dimensionless, + Unit: "1", Scope: scope("TestNewViewMatch", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("Wrong Scope Name", "v0.1.0", schemaURL), }, { Name: "foo", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("TestNewViewMatch", "v1.4.3", schemaURL), }, { Name: "foo", Description: "foo desc", Kind: InstrumentKindCounter, - Unit: unit.Bytes, + Unit: "By", Scope: scope("TestNewViewMatch", "v0.1.0", "https://go.dev"), }, }, @@ -384,12 +383,12 @@ func TestNewViewReplace(t *testing.T) { }, { name: "Unit", - mask: Stream{Unit: unit.Dimensionless}, + mask: Stream{Unit: "1"}, want: func(i Instrument) Stream { return Stream{ Name: i.Name, Description: i.Description, - Unit: unit.Dimensionless, + Unit: "1", } }, }, @@ -410,14 +409,14 @@ func TestNewViewReplace(t *testing.T) { mask: Stream{ Name: alt, Description: alt, - Unit: unit.Dimensionless, + Unit: "1", Aggregation: aggregation.LastValue{}, }, want: func(i Instrument) Stream { return Stream{ Name: alt, Description: alt, - Unit: unit.Dimensionless, + Unit: "1", Aggregation: aggregation.LastValue{}, } }, @@ -490,7 +489,7 @@ func ExampleNewView() { stream, _ := view(Instrument{ Name: "latency", Description: "request latency", - Unit: unit.Milliseconds, + Unit: "ms", Kind: InstrumentKindCounter, Scope: instrumentation.Scope{ Name: "http", @@ -537,7 +536,7 @@ func ExampleNewView_wildcard() { // name suffix of ".ms". view := NewView( Instrument{Name: "*.ms"}, - Stream{Unit: unit.Milliseconds}, + Stream{Unit: "ms"}, ) // The created view can then be registered with the OpenTelemetry metric @@ -546,7 +545,7 @@ func ExampleNewView_wildcard() { stream, _ := view(Instrument{ Name: "computation.time.ms", - Unit: unit.Dimensionless, + Unit: "1", }) fmt.Println("name:", stream.Name) fmt.Println("unit:", stream.Unit) @@ -573,9 +572,9 @@ func ExampleView() { return s, false } switch i.Unit { - case unit.Milliseconds: + case "ms": s.Name += ".ms" - case unit.Bytes: + case "By": s.Name += ".byte" default: return s, false @@ -589,13 +588,13 @@ func ExampleView() { stream, _ := view(Instrument{ Name: "computation.time.ms", - Unit: unit.Milliseconds, + Unit: "ms", }) fmt.Println("name:", stream.Name) stream, _ = view(Instrument{ Name: "heap.size", - Unit: unit.Bytes, + Unit: "By", }) fmt.Println("name:", stream.Name) // Output: From 071d3173944553bed7d05057ecccb177d307978b Mon Sep 17 00:00:00 2001 From: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com> Date: Mon, 27 Feb 2023 11:38:41 -0500 Subject: [PATCH 432/886] Fix incorrect "all" and "resource" definition for Schema File (#3777) The "all" and "resource" sections had incorrect definitions of "attribute_rename" transform. It was missing the subkey "attribute_map". This is a bug fix and makes the implementation compliant with the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/schemas/file_format_v1.1.0.md#resources-section Related issue: https://github.com/open-telemetry/opentelemetry-specification/issues/3245 Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + schema/v1.0/ast/ast_schema.go | 2 +- schema/v1.0/parser_test.go | 50 +++++++++-------- schema/v1.0/testdata/valid-example.yaml | 54 ++++++++++--------- schema/v1.1/parser_test.go | 50 +++++++++-------- .../testdata/unsupported-file-format.yaml | 3 +- schema/v1.1/testdata/valid-example.yaml | 54 ++++++++++--------- 7 files changed, 114 insertions(+), 100 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3313a77312..f226a2aa0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) - Data race issue in OTLP exporter retry mechanism. (#3756) - Fixes wrapping a nil error in some cases (#????) +- Fix incorrect "all" and "resource" definition for Schema File (#3777) ### Deprecated diff --git a/schema/v1.0/ast/ast_schema.go b/schema/v1.0/ast/ast_schema.go index de9db344aae..2d0cbc7a7e3 100644 --- a/schema/v1.0/ast/ast_schema.go +++ b/schema/v1.0/ast/ast_schema.go @@ -52,5 +52,5 @@ type Attributes struct { // AttributeChange corresponds to a section representing attribute changes. type AttributeChange struct { - RenameAttributes *AttributeMap `yaml:"rename_attributes"` + RenameAttributes *RenameAttributes `yaml:"rename_attributes"` } diff --git a/schema/v1.0/parser_test.go b/schema/v1.0/parser_test.go index 72d20bd1162..ab47452db72 100644 --- a/schema/v1.0/parser_test.go +++ b/schema/v1.0/parser_test.go @@ -39,27 +39,29 @@ func TestParseSchemaFile(t *testing.T) { All: ast.Attributes{ Changes: []ast.AttributeChange{ { - RenameAttributes: &ast.AttributeMap{ - "k8s.cluster.name": "kubernetes.cluster.name", - "k8s.namespace.name": "kubernetes.namespace.name", - "k8s.node.name": "kubernetes.node.name", - "k8s.node.uid": "kubernetes.node.uid", - "k8s.pod.name": "kubernetes.pod.name", - "k8s.pod.uid": "kubernetes.pod.uid", - "k8s.container.name": "kubernetes.container.name", - "k8s.replicaset.name": "kubernetes.replicaset.name", - "k8s.replicaset.uid": "kubernetes.replicaset.uid", - "k8s.cronjob.name": "kubernetes.cronjob.name", - "k8s.cronjob.uid": "kubernetes.cronjob.uid", - "k8s.job.name": "kubernetes.job.name", - "k8s.job.uid": "kubernetes.job.uid", - "k8s.statefulset.name": "kubernetes.statefulset.name", - "k8s.statefulset.uid": "kubernetes.statefulset.uid", - "k8s.daemonset.name": "kubernetes.daemonset.name", - "k8s.daemonset.uid": "kubernetes.daemonset.uid", - "k8s.deployment.name": "kubernetes.deployment.name", - "k8s.deployment.uid": "kubernetes.deployment.uid", - "service.namespace": "service.namespace.name", + RenameAttributes: &ast.RenameAttributes{ + AttributeMap: ast.AttributeMap{ + "k8s.cluster.name": "kubernetes.cluster.name", + "k8s.namespace.name": "kubernetes.namespace.name", + "k8s.node.name": "kubernetes.node.name", + "k8s.node.uid": "kubernetes.node.uid", + "k8s.pod.name": "kubernetes.pod.name", + "k8s.pod.uid": "kubernetes.pod.uid", + "k8s.container.name": "kubernetes.container.name", + "k8s.replicaset.name": "kubernetes.replicaset.name", + "k8s.replicaset.uid": "kubernetes.replicaset.uid", + "k8s.cronjob.name": "kubernetes.cronjob.name", + "k8s.cronjob.uid": "kubernetes.cronjob.uid", + "k8s.job.name": "kubernetes.job.name", + "k8s.job.uid": "kubernetes.job.uid", + "k8s.statefulset.name": "kubernetes.statefulset.name", + "k8s.statefulset.uid": "kubernetes.statefulset.uid", + "k8s.daemonset.name": "kubernetes.daemonset.name", + "k8s.daemonset.uid": "kubernetes.daemonset.uid", + "k8s.deployment.name": "kubernetes.deployment.name", + "k8s.deployment.uid": "kubernetes.deployment.uid", + "service.namespace": "service.namespace.name", + }, }, }, }, @@ -68,8 +70,10 @@ func TestParseSchemaFile(t *testing.T) { Resources: ast.Attributes{ Changes: []ast.AttributeChange{ { - RenameAttributes: &ast.AttributeMap{ - "telemetry.auto.version": "telemetry.auto_instr.version", + RenameAttributes: &ast.RenameAttributes{ + AttributeMap: ast.AttributeMap{ + "telemetry.auto.version": "telemetry.auto_instr.version", + }, }, }, }, diff --git a/schema/v1.0/testdata/valid-example.yaml b/schema/v1.0/testdata/valid-example.yaml index b7759249269..a8dbd2cae71 100644 --- a/schema/v1.0/testdata/valid-example.yaml +++ b/schema/v1.0/testdata/valid-example.yaml @@ -18,31 +18,32 @@ versions: all: changes: - rename_attributes: - # Mapping of attribute names (label names for metrics). The key is the old name - # used prior to this version, the value is the new name starting from this version. + attribute_map: + # Mapping of attribute names (label names for metrics). The key is the old name + # used prior to this version, the value is the new name starting from this version. - # Rename k8s.* to kubernetes.* - k8s.cluster.name: kubernetes.cluster.name - k8s.namespace.name: kubernetes.namespace.name - k8s.node.name: kubernetes.node.name - k8s.node.uid: kubernetes.node.uid - k8s.pod.name: kubernetes.pod.name - k8s.pod.uid: kubernetes.pod.uid - k8s.container.name: kubernetes.container.name - k8s.replicaset.name: kubernetes.replicaset.name - k8s.replicaset.uid: kubernetes.replicaset.uid - k8s.cronjob.name: kubernetes.cronjob.name - k8s.cronjob.uid: kubernetes.cronjob.uid - k8s.job.name: kubernetes.job.name - k8s.job.uid: kubernetes.job.uid - k8s.statefulset.name: kubernetes.statefulset.name - k8s.statefulset.uid: kubernetes.statefulset.uid - k8s.daemonset.name: kubernetes.daemonset.name - k8s.daemonset.uid: kubernetes.daemonset.uid - k8s.deployment.name: kubernetes.deployment.name - k8s.deployment.uid: kubernetes.deployment.uid + # Rename k8s.* to kubernetes.* + k8s.cluster.name: kubernetes.cluster.name + k8s.namespace.name: kubernetes.namespace.name + k8s.node.name: kubernetes.node.name + k8s.node.uid: kubernetes.node.uid + k8s.pod.name: kubernetes.pod.name + k8s.pod.uid: kubernetes.pod.uid + k8s.container.name: kubernetes.container.name + k8s.replicaset.name: kubernetes.replicaset.name + k8s.replicaset.uid: kubernetes.replicaset.uid + k8s.cronjob.name: kubernetes.cronjob.name + k8s.cronjob.uid: kubernetes.cronjob.uid + k8s.job.name: kubernetes.job.name + k8s.job.uid: kubernetes.job.uid + k8s.statefulset.name: kubernetes.statefulset.name + k8s.statefulset.uid: kubernetes.statefulset.uid + k8s.daemonset.name: kubernetes.daemonset.name + k8s.daemonset.uid: kubernetes.daemonset.uid + k8s.deployment.name: kubernetes.deployment.name + k8s.deployment.uid: kubernetes.deployment.uid - service.namespace: service.namespace.name + service.namespace: service.namespace.name # Like "all" the "resources" section may contain only attribute renaming translations. # The only translation possible in this section is renaming of attributes in @@ -50,9 +51,10 @@ versions: resources: changes: - rename_attributes: - # Mapping of attribute names. The key is the old name - # used prior to this version, the value is the new name starting from this version. - telemetry.auto.version: telemetry.auto_instr.version + attribute_map: + # Mapping of attribute names. The key is the old name + # used prior to this version, the value is the new name starting from this version. + telemetry.auto.version: telemetry.auto_instr.version spans: changes: diff --git a/schema/v1.1/parser_test.go b/schema/v1.1/parser_test.go index 68f6679e9ba..c4b35aebb55 100644 --- a/schema/v1.1/parser_test.go +++ b/schema/v1.1/parser_test.go @@ -40,27 +40,29 @@ func TestParseSchemaFile(t *testing.T) { All: ast10.Attributes{ Changes: []ast10.AttributeChange{ { - RenameAttributes: &ast10.AttributeMap{ - "k8s.cluster.name": "kubernetes.cluster.name", - "k8s.namespace.name": "kubernetes.namespace.name", - "k8s.node.name": "kubernetes.node.name", - "k8s.node.uid": "kubernetes.node.uid", - "k8s.pod.name": "kubernetes.pod.name", - "k8s.pod.uid": "kubernetes.pod.uid", - "k8s.container.name": "kubernetes.container.name", - "k8s.replicaset.name": "kubernetes.replicaset.name", - "k8s.replicaset.uid": "kubernetes.replicaset.uid", - "k8s.cronjob.name": "kubernetes.cronjob.name", - "k8s.cronjob.uid": "kubernetes.cronjob.uid", - "k8s.job.name": "kubernetes.job.name", - "k8s.job.uid": "kubernetes.job.uid", - "k8s.statefulset.name": "kubernetes.statefulset.name", - "k8s.statefulset.uid": "kubernetes.statefulset.uid", - "k8s.daemonset.name": "kubernetes.daemonset.name", - "k8s.daemonset.uid": "kubernetes.daemonset.uid", - "k8s.deployment.name": "kubernetes.deployment.name", - "k8s.deployment.uid": "kubernetes.deployment.uid", - "service.namespace": "service.namespace.name", + RenameAttributes: &ast10.RenameAttributes{ + AttributeMap: ast10.AttributeMap{ + "k8s.cluster.name": "kubernetes.cluster.name", + "k8s.namespace.name": "kubernetes.namespace.name", + "k8s.node.name": "kubernetes.node.name", + "k8s.node.uid": "kubernetes.node.uid", + "k8s.pod.name": "kubernetes.pod.name", + "k8s.pod.uid": "kubernetes.pod.uid", + "k8s.container.name": "kubernetes.container.name", + "k8s.replicaset.name": "kubernetes.replicaset.name", + "k8s.replicaset.uid": "kubernetes.replicaset.uid", + "k8s.cronjob.name": "kubernetes.cronjob.name", + "k8s.cronjob.uid": "kubernetes.cronjob.uid", + "k8s.job.name": "kubernetes.job.name", + "k8s.job.uid": "kubernetes.job.uid", + "k8s.statefulset.name": "kubernetes.statefulset.name", + "k8s.statefulset.uid": "kubernetes.statefulset.uid", + "k8s.daemonset.name": "kubernetes.daemonset.name", + "k8s.daemonset.uid": "kubernetes.daemonset.uid", + "k8s.deployment.name": "kubernetes.deployment.name", + "k8s.deployment.uid": "kubernetes.deployment.uid", + "service.namespace": "service.namespace.name", + }, }, }, }, @@ -69,8 +71,10 @@ func TestParseSchemaFile(t *testing.T) { Resources: ast10.Attributes{ Changes: []ast10.AttributeChange{ { - RenameAttributes: &ast10.AttributeMap{ - "telemetry.auto.version": "telemetry.auto_instr.version", + RenameAttributes: &ast10.RenameAttributes{ + AttributeMap: ast10.AttributeMap{ + "telemetry.auto.version": "telemetry.auto_instr.version", + }, }, }, }, diff --git a/schema/v1.1/testdata/unsupported-file-format.yaml b/schema/v1.1/testdata/unsupported-file-format.yaml index 47d30c024fd..af881697c4e 100644 --- a/schema/v1.1/testdata/unsupported-file-format.yaml +++ b/schema/v1.1/testdata/unsupported-file-format.yaml @@ -6,5 +6,6 @@ versions: all: changes: - rename_attributes: - k8s.cluster.name: kubernetes.cluster.name + attribute_map: + k8s.cluster.name: kubernetes.cluster.name 1.0.0: diff --git a/schema/v1.1/testdata/valid-example.yaml b/schema/v1.1/testdata/valid-example.yaml index 138f5628cad..d5144ceb4c8 100644 --- a/schema/v1.1/testdata/valid-example.yaml +++ b/schema/v1.1/testdata/valid-example.yaml @@ -18,31 +18,32 @@ versions: all: changes: - rename_attributes: - # Mapping of attribute names (label names for metrics). The key is the old name - # used prior to this version, the value is the new name starting from this version. + attribute_map: + # Mapping of attribute names (label names for metrics). The key is the old name + # used prior to this version, the value is the new name starting from this version. - # Rename k8s.* to kubernetes.* - k8s.cluster.name: kubernetes.cluster.name - k8s.namespace.name: kubernetes.namespace.name - k8s.node.name: kubernetes.node.name - k8s.node.uid: kubernetes.node.uid - k8s.pod.name: kubernetes.pod.name - k8s.pod.uid: kubernetes.pod.uid - k8s.container.name: kubernetes.container.name - k8s.replicaset.name: kubernetes.replicaset.name - k8s.replicaset.uid: kubernetes.replicaset.uid - k8s.cronjob.name: kubernetes.cronjob.name - k8s.cronjob.uid: kubernetes.cronjob.uid - k8s.job.name: kubernetes.job.name - k8s.job.uid: kubernetes.job.uid - k8s.statefulset.name: kubernetes.statefulset.name - k8s.statefulset.uid: kubernetes.statefulset.uid - k8s.daemonset.name: kubernetes.daemonset.name - k8s.daemonset.uid: kubernetes.daemonset.uid - k8s.deployment.name: kubernetes.deployment.name - k8s.deployment.uid: kubernetes.deployment.uid + # Rename k8s.* to kubernetes.* + k8s.cluster.name: kubernetes.cluster.name + k8s.namespace.name: kubernetes.namespace.name + k8s.node.name: kubernetes.node.name + k8s.node.uid: kubernetes.node.uid + k8s.pod.name: kubernetes.pod.name + k8s.pod.uid: kubernetes.pod.uid + k8s.container.name: kubernetes.container.name + k8s.replicaset.name: kubernetes.replicaset.name + k8s.replicaset.uid: kubernetes.replicaset.uid + k8s.cronjob.name: kubernetes.cronjob.name + k8s.cronjob.uid: kubernetes.cronjob.uid + k8s.job.name: kubernetes.job.name + k8s.job.uid: kubernetes.job.uid + k8s.statefulset.name: kubernetes.statefulset.name + k8s.statefulset.uid: kubernetes.statefulset.uid + k8s.daemonset.name: kubernetes.daemonset.name + k8s.daemonset.uid: kubernetes.daemonset.uid + k8s.deployment.name: kubernetes.deployment.name + k8s.deployment.uid: kubernetes.deployment.uid - service.namespace: service.namespace.name + service.namespace: service.namespace.name # Like "all" the "resources" section may contain only attribute renaming translations. # The only translation possible in this section is renaming of attributes in @@ -50,9 +51,10 @@ versions: resources: changes: - rename_attributes: - # Mapping of attribute names. The key is the old name - # used prior to this version, the value is the new name starting from this version. - telemetry.auto.version: telemetry.auto_instr.version + attribute_map: + # Mapping of attribute names. The key is the old name + # used prior to this version, the value is the new name starting from this version. + telemetry.auto.version: telemetry.auto_instr.version spans: changes: From 2c213bf585b07e28dee346f9096a0b64d3fc46f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinan=20=C3=9Clker?= Date: Mon, 27 Feb 2023 18:20:06 +0100 Subject: [PATCH 433/886] Restructure compatibility testing (#3779) * Restructure compatibility testing * Add PR number into Changelog * Keep the original name for compatibility matrix * Remove changelog entry * Apply suggestions --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b693d70e2a1..95de05ee925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -150,3 +150,12 @@ jobs: env: GOARCH: ${{ matrix.arch }} run: make test-short + + test-compatibility: + runs-on: ubuntu-latest + needs: [compatibility-test] + steps: + - name: Test if compatibility-test passed + run: | + echo ${{ needs.compatibility-test.result }} + test ${{ needs.compatibility-test.result }} == "success" \ No newline at end of file From b177f58e09ca7e470d2971da4deb9dc3eabd81ac Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Mon, 27 Feb 2023 13:02:22 -0500 Subject: [PATCH 434/886] [docs] fix link to traces concept page (#3807) Co-authored-by: Tyler Yahn --- website_docs/exporters.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/website_docs/exporters.md b/website_docs/exporters.md index 34353b36724..d527cd3438c 100644 --- a/website_docs/exporters.md +++ b/website_docs/exporters.md @@ -4,9 +4,8 @@ aliases: [/docs/instrumentation/go/exporting_data] weight: 4 --- -In order to visualize and analyze your -[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics, -you will need to export them to a backend. +In order to visualize and analyze your [traces](/docs/concepts/signals/traces/) +and metrics, you will need to export them to a backend. ## OTLP Exporter From 46d7f8dad3994f3807aed76d139ac884b8991f1d Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:01:34 -0600 Subject: [PATCH 435/886] Add Note about dropping go 1.18 (#3771) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Note about dropping go 1.18 * Fix lint * Apply suggestions from code review Co-authored-by: Robert Pająk --------- Co-authored-by: Damien Mathieu Co-authored-by: Tyler Yahn Co-authored-by: Robert Pająk --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f226a2aa0d5..cd7dfe2a11f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +This release is the last to support Go 1.18. +The next release will require at least Go 1.19. + ### Added - Semantic conventions of the `event` type are now generated. (#3697) From 2e54fbb3fede5b54f316b3a08eab236febd854e0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 27 Feb 2023 13:57:23 -0800 Subject: [PATCH 436/886] Release v1.14.0/v0.37.0/v0.0.4 (#3810) * Bump mod versions * Add bridge/opentracing/test to versions.yaml * Prepare stable-v1 for version v1.14.0 * Prepare experimental-metrics for version v0.37.0 * Prepare experimental-schema for version v0.0.4 * Update changelog --- CHANGELOG.md | 32 +++++++++++-------- bridge/opencensus/go.mod | 10 +++--- bridge/opencensus/test/go.mod | 12 +++---- bridge/opentracing/go.mod | 4 +-- bridge/opentracing/test/go.mod | 6 ++-- example/fib/go.mod | 8 ++--- example/jaeger/go.mod | 8 ++--- example/namedtracer/go.mod | 8 ++--- example/opencensus/go.mod | 16 +++++----- example/otel-collector/go.mod | 12 +++---- example/passthrough/go.mod | 8 ++--- example/prometheus/go.mod | 12 +++---- example/view/go.mod | 12 +++---- example/zipkin/go.mod | 8 ++--- exporters/jaeger/go.mod | 6 ++-- exporters/otlp/otlpmetric/go.mod | 12 +++---- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 ++++---- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 14 ++++---- exporters/otlp/otlptrace/go.mod | 8 ++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++--- exporters/prometheus/go.mod | 10 +++--- exporters/stdout/stdoutmetric/go.mod | 10 +++--- exporters/stdout/stdouttrace/go.mod | 6 ++-- exporters/zipkin/go.mod | 6 ++-- go.mod | 2 +- metric/go.mod | 4 +-- sdk/go.mod | 4 +-- sdk/metric/go.mod | 8 ++--- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 7 ++-- 32 files changed, 149 insertions(+), 142 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd7dfe2a11f..1d9726f60b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] -This release is the last to support Go 1.18. -The next release will require at least Go 1.19. +## [1.14.0/0.37.0/0.0.4] 2023-02-27 + +This release is the last to support [Go 1.18]. +The next release will require at least [Go 1.19]. ### Added -- Semantic conventions of the `event` type are now generated. (#3697) - The `event` type semantic conventions are added to `go.opentelemetry.io/otel/semconv/v1.17.0`. (#3697) - Support [Go 1.20]. (#3693) - The `go.opentelemetry.io/otel/semconv/v1.18.0` package. @@ -33,17 +34,19 @@ The next release will require at least Go 1.19. - `OtelLibraryName` -> `OTelLibraryName` - `OtelLibraryVersion` -> `OTelLibraryVersion` - `OtelStatusDescription` -> `OTelStatusDescription` -- Add `bridgetSpanContext.IsSampled` to `go.opentelemetry.io/otel/bridget/opentracing` to expose whether span is sampled or not. (#3570) +- A `IsSampled` method is added to the `SpanContext` implementation in `go.opentelemetry.io/otel/bridge/opentracing` to expose the span sampled state. + See the [README](./bridge/opentracing/README.md) for more information. (#3570) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/metric`. (#3738) - The `WithInstrumentationAttributes` option to `go.opentelemetry.io/otel/trace`. (#3739) -- The following environment variables are supported by the `Reader`s in `go.opentelemetry.io/otel/sdk/metric`. (#3763) - - `OTEL_METRIC_EXPORT_INTERVAL` - - `OTEL_METRIC_EXPORT_TIMEOUT` +- The following environment variables are supported by the periodic `Reader` in `go.opentelemetry.io/otel/sdk/metric`. (#3763) + - `OTEL_METRIC_EXPORT_INTERVAL` sets the time between collections and exports. + - `OTEL_METRIC_EXPORT_TIMEOUT` sets the timeout an export is attempted. ### Changed -- [bridge/ot] Fall-back to TextMap carrier when it's not ot.HttpHeaders. (#3679) -- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. This change is made to enable memory reuse by SDK users. (#3732) +- Fall-back to `TextMapCarrier` when it's not `HttpHeader`s in `go.opentelemetry.io/otel/bridge/opentracing`. (#3679) +- The `Collect` method of the `"go.opentelemetry.io/otel/sdk/metric".Reader` interface is updated to accept the `metricdata.ResourceMetrics` value the collection will be made into. + This change is made to enable memory reuse by SDK users. (#3732) - The `WithUnit` option in `go.opentelemetry.io/otel/sdk/metric/instrument` is updated to accept a `string` for the unit value. (#3776) ### Fixed @@ -52,9 +55,9 @@ The next release will require at least Go 1.19. - Multi-reader `MeterProvider`s now export metrics for all readers, instead of just the first reader. (#3720, #3724) - Remove use of deprecated `"math/rand".Seed` in `go.opentelemetry.io/otel/example/prometheus`. (#3733) - Do not silently drop unknown schema data with `Parse` in `go.opentelemetry.io/otel/schema/v1.1`. (#3743) -- Data race issue in OTLP exporter retry mechanism. (#3756) -- Fixes wrapping a nil error in some cases (#????) -- Fix incorrect "all" and "resource" definition for Schema File (#3777) +- Data race issue in OTLP exporter retry mechanism. (#3755, #3756) +- Wrapping empty errors when exporting in `go.opentelemetry.io/otel/sdk/metric`. (#3698, #3772) +- Incorrect "all" and "resource" definition for schema files in `go.opentelemetry.io/otel/schema/v1.1`. (#3777) ### Deprecated @@ -2299,7 +2302,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.13.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.14.0...HEAD +[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 [1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 [1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 [1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2 @@ -2361,3 +2365,5 @@ It contains api and sdk for trace and meter. [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 [Go 1.20]: https://go.dev/doc/go1.20 +[Go 1.19]: https://go.dev/doc/go1.19 +[Go 1.18]: https://go.dev/doc/go1.18 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index e6d6bc56f4c..a9512663b01 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.36.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 32928e9b2a5..a9923f58cfe 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/bridge/opencensus v0.36.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/bridge/opencensus v0.37.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.36.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.36.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 730f2164389..eb9887d5a01 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index d3a5c9222f2..2cb63f89916 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/bridge/opentracing v0.0.0-00010101000000-000000000000 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/bridge/opentracing v1.14.0 google.golang.org/grpc v1.53.0 ) @@ -23,7 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index d420bfa0252..5fe869fefea 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 7b3536d09ed..b33cea0614b 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/jaeger v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/jaeger v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 4e1dea64385..467324eb6fb 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index c4f8b12df8e..923ea397dc7 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/bridge/opencensus v0.36.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.36.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/bridge/opencensus v0.37.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.37.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.36.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 663d558e8b2..3573d666da1 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 google.golang.org/grpc v1.53.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 95ebde4eee6..0d78d317afb 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index f9cb265dba1..7a8e980b92c 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/prometheus v0.36.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/prometheus v0.37.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.13.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 325b373e5bf..6fa01733e6d 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/prometheus v0.36.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/prometheus v0.37.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index caa400ab652..a027a189e77 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/zipkin v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/zipkin v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 5faa47f47bd..f5225228db9 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,9 +7,9 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 8ed3a872833..37bd61e454c 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.36.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index b30ca3bc4bf..bfc61ce141a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.13.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9624e9e30e2..b1df2a44f34 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.36.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.13.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index badfb76c0a0..54aa3a03bb5 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 19fb9dc8910..de850c10831 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index a4fcd5f2e9a..76e44c182c4 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.13.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 9ec7eab7c6e..505c4e7a40a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 google.golang.org/protobuf v1.28.1 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 99efffa4686..ef13d99ad85 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/sdk/metric v0.36.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/sdk/metric v0.37.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.36.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 11be5ebee54..43587994dcc 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index cc23042c682..3af17aaf690 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,9 +8,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/sdk v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/go.mod b/go.mod index 0dbcc740135..89fc125f9ff 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel/trace v1.14.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index b51092dac01..12967506e8a 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel v1.14.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index af728762629..38a150da424 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/trace v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/trace v1.14.0 golang.org/x/sys v0.5.0 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 2a5f2f408ea..406358cec30 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 - go.opentelemetry.io/otel/metric v0.36.0 - go.opentelemetry.io/otel/sdk v1.13.0 + go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel/metric v0.37.0 + go.opentelemetry.io/otel/sdk v1.14.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.13.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 352e1d63056..eaaf00035ae 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.13.0 + go.opentelemetry.io/otel v1.14.0 ) require ( diff --git a/version.go b/version.go index d82fbaf550e..0e8e5e02329 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.13.0" + return "1.14.0" } diff --git a/versions.yaml b/versions.yaml index 22df4553c2e..40df1fae417 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,10 +14,11 @@ module-sets: stable-v1: - version: v1.13.0 + version: v1.14.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing + - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/fib - go.opentelemetry.io/otel/example/jaeger - go.opentelemetry.io/otel/example/namedtracer @@ -34,7 +35,7 @@ module-sets: - go.opentelemetry.io/otel/trace - go.opentelemetry.io/otel/sdk experimental-metrics: - version: v0.36.0 + version: v0.37.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus @@ -49,7 +50,7 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/view experimental-schema: - version: v0.0.3 + version: v0.0.4 modules: - go.opentelemetry.io/otel/schema excluded-modules: From d0e4a438ef9ba83a67252cab9c6606b5d7bdd95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 28 Feb 2023 21:43:48 +0100 Subject: [PATCH 437/886] Handle empty env vars as it they were not set (#3764) * Handle empty env vars as it they were not set * Add changelog entry * Add missing unit test --- CHANGELOG.md | 4 ++++ exporters/jaeger/env.go | 2 +- exporters/zipkin/env.go | 2 +- sdk/internal/env/env.go | 10 +++++----- sdk/internal/env/env_test.go | 4 ++++ 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d9726f60b6..75003be609f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- Handle empty environment variable as it they were not set. (#3764) + ## [1.14.0/0.37.0/0.0.4] 2023-02-27 This release is the last to support [Go 1.18]. diff --git a/exporters/jaeger/env.go b/exporters/jaeger/env.go index a7253e48311..460fb5e1352 100644 --- a/exporters/jaeger/env.go +++ b/exporters/jaeger/env.go @@ -37,7 +37,7 @@ const ( // envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { - if v, ok := os.LookupEnv(key); ok && v != "" { + if v := os.Getenv(key); v != "" { return v } return defaultValue diff --git a/exporters/zipkin/env.go b/exporters/zipkin/env.go index 7f1b60fa4f0..f1afd8e8665 100644 --- a/exporters/zipkin/env.go +++ b/exporters/zipkin/env.go @@ -24,7 +24,7 @@ const ( // envOr returns an env variable's value if it is exists or the default if not. func envOr(key, defaultValue string) string { - if v, ok := os.LookupEnv(key); ok && v != "" { + if v := os.Getenv(key); v != "" { return v } return defaultValue diff --git a/sdk/internal/env/env.go b/sdk/internal/env/env.go index 5e94b8ae521..59dcfab2501 100644 --- a/sdk/internal/env/env.go +++ b/sdk/internal/env/env.go @@ -70,8 +70,8 @@ const ( // returned. func firstInt(defaultValue int, keys ...string) int { for _, key := range keys { - value, ok := os.LookupEnv(key) - if !ok { + value := os.Getenv(key) + if value == "" { continue } @@ -88,10 +88,10 @@ func firstInt(defaultValue int, keys ...string) int { } // IntEnvOr returns the int value of the environment variable with name key if -// it exists and the value is an int. Otherwise, defaultValue is returned. +// it exists, it is not empty, and the value is an int. Otherwise, defaultValue is returned. func IntEnvOr(key string, defaultValue int) int { - value, ok := os.LookupEnv(key) - if !ok { + value := os.Getenv(key) + if value == "" { return defaultValue } diff --git a/sdk/internal/env/env_test.go b/sdk/internal/env/env_test.go index f456ae10817..c2b3b743703 100644 --- a/sdk/internal/env/env_test.go +++ b/sdk/internal/env/env_test.go @@ -96,6 +96,7 @@ func TestEnvParse(t *testing.T) { envVal = 2500 envValStr = "2500" invalid = "localhost" + empty = "" ) for _, tc := range testCases { @@ -113,6 +114,9 @@ func TestEnvParse(t *testing.T) { require.NoError(t, os.Setenv(key, invalid)) assert.Equal(t, defVal, tc.f(defVal), "invalid value") + + require.NoError(t, os.Setenv(key, empty)) + assert.Equal(t, defVal, tc.f(defVal), "empty value") }) } }) From 264becee2751862032aad7f9c97207dac23e9009 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 28 Feb 2023 14:14:43 -0800 Subject: [PATCH 438/886] Remove the deprecated metric/unit package (#3814) * Remove the dep metric/unit package * Add PR number --- CHANGELOG.md | 4 ++++ metric/unit/doc.go | 19 ------------------- metric/unit/unit.go | 27 --------------------------- 3 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 metric/unit/doc.go delete mode 100644 metric/unit/unit.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 75003be609f..ac62fb72f2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Handle empty environment variable as it they were not set. (#3764) +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) + ## [1.14.0/0.37.0/0.0.4] 2023-02-27 This release is the last to support [Go 1.18]. diff --git a/metric/unit/doc.go b/metric/unit/doc.go deleted file mode 100644 index 051c2b58b92..00000000000 --- a/metric/unit/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package unit provides units. -// -// Deprecated: This package will be removed in the next release. Use the -// equivalent unit string instead. -package unit // import "go.opentelemetry.io/otel/metric/unit" diff --git a/metric/unit/unit.go b/metric/unit/unit.go deleted file mode 100644 index 6e06474051f..00000000000 --- a/metric/unit/unit.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package unit // import "go.opentelemetry.io/otel/metric/unit" - -// Unit is a determinate standard quantity of measurement. -// -// Deprecated: This will be removed in the next release. -type Unit string - -// Units defined by OpenTelemetry. -const ( - Dimensionless Unit = "1" - Bytes Unit = "By" - Milliseconds Unit = "ms" -) From c39e625cdf0a60cb6652a4010de0012e6ced399e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 1 Mar 2023 09:15:39 -0800 Subject: [PATCH 439/886] Drop compatibility testing for Go 1.18 (#3813) * Drop support for Go 1.18 * Add changes to changelog * Add PR number --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/dependabot.yml | 2 +- CHANGELOG.md | 5 +++++ README.md | 5 ----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 466c759962d..5aabff3f3fb 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: 1.18 + DEFAULT_GO_VERSION: 1.20 jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95de05ee925..8f0c0d01c15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,7 +115,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["1.20", 1.19, 1.18] + go-version: ["1.20", 1.19] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to acomplish this with a self-hosted runner @@ -158,4 +158,4 @@ jobs: - name: Test if compatibility-test passed run: | echo ${{ needs.compatibility-test.result }} - test ${{ needs.compatibility-test.result }} == "success" \ No newline at end of file + test ${{ needs.compatibility-test.result }} == "success" diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index b0009e2b3d5..36bf1f327a1 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v3 with: - go-version: '^1.18.0' + go-version: '^1.20.0' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: diff --git a/CHANGELOG.md b/CHANGELOG.md index ac62fb72f2b..131f932d78d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Dropped compatibility testing for [Go 1.18]. + The project no longer guarantees support for this version of Go. (#3813) + ### Fixed - Handle empty environment variable as it they were not set. (#3764) diff --git a/README.md b/README.md index 878d87e58b9..a585e3790d0 100644 --- a/README.md +++ b/README.md @@ -52,19 +52,14 @@ Currently, this project supports the following environments. | ------- | ---------- | ------------ | | Ubuntu | 1.20 | amd64 | | Ubuntu | 1.19 | amd64 | -| Ubuntu | 1.18 | amd64 | | Ubuntu | 1.20 | 386 | | Ubuntu | 1.19 | 386 | -| Ubuntu | 1.18 | 386 | | MacOS | 1.20 | amd64 | | MacOS | 1.19 | amd64 | -| MacOS | 1.18 | amd64 | | Windows | 1.20 | amd64 | | Windows | 1.19 | amd64 | -| Windows | 1.18 | amd64 | | Windows | 1.20 | 386 | | Windows | 1.19 | 386 | -| Windows | 1.18 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. From 813936187e46d48924b717ed9f63767eef26f55a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 1 Mar 2023 11:16:03 -0800 Subject: [PATCH 440/886] Support a global MeterProvider in `go.opentelemetry.io/otel` (#3818) * Move ErrorHandler impl to internal To avoid the import cycle, the otel/metric package needs to not import otel. To achieve this, the error handling implementation is moved to the otel/internal/global package where both can import the needed functionality. * Add global metric to go.opentelemetry.io/otel * Crosslink and update to global metric in otel * Add changes to changelog * Set PR number in changelog * Add global metric unit tests * Rename MeterProivder() to GetMeterProivder() * Add TODO to remove nolint comments --- CHANGELOG.md | 12 + bridge/opentracing/go.mod | 3 + bridge/opentracing/test/go.mod | 3 + example/fib/go.mod | 3 + example/jaeger/go.mod | 3 + example/namedtracer/go.mod | 3 + example/otel-collector/go.mod | 3 + example/passthrough/go.mod | 3 + example/zipkin/go.mod | 3 + exporters/jaeger/go.mod | 3 + .../otlpmetric/otlpmetricgrpc/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlpmetric/otlpmetrichttp/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 3 + exporters/otlp/otlptrace/otlptracegrpc/go.mod | 3 + exporters/otlp/otlptrace/otlptracehttp/go.mod | 3 + exporters/stdout/stdouttrace/go.mod | 3 + exporters/zipkin/go.mod | 3 + go.mod | 3 + handler.go | 64 +---- handler_test.go | 214 ++--------------- internal/global/handler.go | 103 ++++++++ internal/global/handler_test.go | 226 ++++++++++++++++++ metric.go | 61 +++++ metric/global/global.go | 9 + metric/internal/global/instruments.go | 26 +- metric/internal/global/meter.go | 4 +- metric_test.go | 41 ++++ sdk/go.mod | 3 + sdk/metric/example_test.go | 4 +- sdk/metric/meter_test.go | 7 +- trace/go.mod | 2 + 33 files changed, 551 insertions(+), 282 deletions(-) create mode 100644 internal/global/handler.go create mode 100644 internal/global/handler_test.go create mode 100644 metric.go create mode 100644 metric_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 131f932d78d..c774008a2c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + ### Changed - Dropped compatibility testing for [Go 1.18]. @@ -17,6 +24,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Handle empty environment variable as it they were not set. (#3764) +### Deprecated + +- The `go.opentelemetry.io/otel/metric/global` package is deprecated. + Use `go.opentelemetry.io/otel` instead. (#3818) + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index eb9887d5a01..38f15dcd752 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -18,5 +18,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 2cb63f89916..3edb93674d0 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -23,6 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect @@ -31,3 +32,5 @@ require ( google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/example/fib/go.mod b/example/fib/go.mod index 5fe869fefea..7d6f35a96c8 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -12,6 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect ) @@ -22,3 +23,5 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index b33cea0614b..b99aae53537 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -17,8 +17,11 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 467324eb6fb..8b6a5dc3cd5 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -17,9 +17,12 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 3573d666da1..e5cc970943c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -23,6 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect @@ -38,3 +39,5 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 0d78d317afb..2934867637d 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -12,6 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect ) @@ -22,3 +23,5 @@ replace ( ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index a027a189e77..811e4c700a5 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -19,7 +19,10 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f5225228db9..4d1fd8b3a1c 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -16,6 +16,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -25,3 +26,5 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index f7630760678..8307b51fc69 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -17,8 +17,8 @@ package otlpmetricgrpc_test import ( "context" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index bfc61ce141a..bf30fb30dac 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/otel v1.14.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 - go.opentelemetry.io/otel/metric v0.37.0 go.opentelemetry.io/otel/sdk/metric v0.37.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -26,6 +25,7 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/sdk v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go index d3397167c70..398c834a5f1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go @@ -17,8 +17,8 @@ package otlpmetrichttp_test import ( "context" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b1df2a44f34..3b47c210709 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/otel v1.14.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 - go.opentelemetry.io/otel/metric v0.37.0 go.opentelemetry.io/otel/sdk/metric v0.37.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 @@ -24,6 +23,7 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/sdk v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 54aa3a03bb5..3be0bbf9aea 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -22,6 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect @@ -36,3 +37,5 @@ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/trace => ../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index de850c10831..7099a5e7a5f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -23,6 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect @@ -39,3 +40,5 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 76e44c182c4..0fcbeee6fae 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,6 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect @@ -38,3 +39,5 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 43587994dcc..c83008d96e7 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -19,8 +19,11 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../../trace + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 3af17aaf690..090cb404466 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -16,6 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -25,3 +26,5 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/go.mod b/go.mod index 89fc125f9ff..a4013cf63d6 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 + go.opentelemetry.io/otel/metric v0.37.0 go.opentelemetry.io/otel/trace v1.14.0 ) @@ -17,3 +18,5 @@ require ( ) replace go.opentelemetry.io/otel/trace => ./trace + +replace go.opentelemetry.io/otel/metric => ./metric diff --git a/handler.go b/handler.go index ecd363ab516..4115fe3bbb5 100644 --- a/handler.go +++ b/handler.go @@ -15,58 +15,16 @@ package otel // import "go.opentelemetry.io/otel" import ( - "log" - "os" - "sync/atomic" - "unsafe" + "go.opentelemetry.io/otel/internal/global" ) var ( - // globalErrorHandler provides an ErrorHandler that can be used - // throughout an OpenTelemetry instrumented project. When a user - // specified ErrorHandler is registered (`SetErrorHandler`) all calls to - // `Handle` and will be delegated to the registered ErrorHandler. - globalErrorHandler = defaultErrorHandler() - - // Compile-time check that delegator implements ErrorHandler. - _ ErrorHandler = (*delegator)(nil) - // Compile-time check that errLogger implements ErrorHandler. - _ ErrorHandler = (*errLogger)(nil) + // Compile-time check global.ErrDelegator implements ErrorHandler. + _ ErrorHandler = (*global.ErrDelegator)(nil) + // Compile-time check global.ErrLogger implements ErrorHandler. + _ ErrorHandler = (*global.ErrLogger)(nil) ) -type delegator struct { - delegate unsafe.Pointer -} - -func (d *delegator) Handle(err error) { - d.getDelegate().Handle(err) -} - -func (d *delegator) getDelegate() ErrorHandler { - return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate)) -} - -// setDelegate sets the ErrorHandler delegate. -func (d *delegator) setDelegate(eh ErrorHandler) { - atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh)) -} - -func defaultErrorHandler() *delegator { - d := &delegator{} - d.setDelegate(&errLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) - return d -} - -// errLogger logs errors if no delegate is set, otherwise they are delegated. -type errLogger struct { - l *log.Logger -} - -// Handle logs err if no delegate is set, otherwise it is delegated. -func (h *errLogger) Handle(err error) { - h.l.Print(err) -} - // GetErrorHandler returns the global ErrorHandler instance. // // The default ErrorHandler instance returned will log all errors to STDERR @@ -76,9 +34,7 @@ func (h *errLogger) Handle(err error) { // // Subsequent calls to SetErrorHandler after the first will not forward errors // to the new ErrorHandler for prior returned instances. -func GetErrorHandler() ErrorHandler { - return globalErrorHandler -} +func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() } // SetErrorHandler sets the global ErrorHandler to h. // @@ -86,11 +42,7 @@ func GetErrorHandler() ErrorHandler { // GetErrorHandler will send errors to h instead of the default logging // ErrorHandler. Subsequent calls will set the global ErrorHandler, but not // delegate errors to h. -func SetErrorHandler(h ErrorHandler) { - globalErrorHandler.setDelegate(h) -} +func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) } // Handle is a convenience function for ErrorHandler().Handle(err). -func Handle(err error) { - GetErrorHandler().Handle(err) -} +func Handle(err error) { global.Handle(err) } diff --git a/handler_test.go b/handler_test.go index b6b9b20cae0..c522d61e661 100644 --- a/handler_test.go +++ b/handler_test.go @@ -15,212 +15,28 @@ package otel import ( - "bytes" - "errors" - "io" - "log" - "os" "testing" - "github.com/stretchr/testify/suite" + "github.com/stretchr/testify/assert" ) -type testErrCatcher []string - -func (l *testErrCatcher) Write(p []byte) (int, error) { - msg := bytes.TrimRight(p, "\n") - (*l) = append(*l, string(msg)) - return len(msg), nil -} - -func (l *testErrCatcher) Reset() { - *l = testErrCatcher([]string{}) -} - -func (l *testErrCatcher) Got() []string { - return []string(*l) -} - -func causeErr(text string) { - Handle(errors.New(text)) -} - -type HandlerTestSuite struct { - suite.Suite - - origHandler ErrorHandler - errCatcher *testErrCatcher -} - -func (s *HandlerTestSuite) SetupSuite() { - s.errCatcher = new(testErrCatcher) - s.origHandler = globalErrorHandler.getDelegate() - - globalErrorHandler.setDelegate(&errLogger{l: log.New(s.errCatcher, "", 0)}) -} - -func (s *HandlerTestSuite) TearDownSuite() { - globalErrorHandler.setDelegate(s.origHandler) -} - -func (s *HandlerTestSuite) SetupTest() { - s.errCatcher.Reset() -} - -func (s *HandlerTestSuite) TearDownTest() { - globalErrorHandler.setDelegate(&errLogger{l: log.New(s.errCatcher, "", 0)}) -} - -func (s *HandlerTestSuite) TestGlobalHandler() { - errs := []string{"one", "two"} - GetErrorHandler().Handle(errors.New(errs[0])) - Handle(errors.New(errs[1])) - s.Assert().Equal(errs, s.errCatcher.Got()) -} - -func (s *HandlerTestSuite) TestDelegatedHandler() { - eh := GetErrorHandler() - - newErrLogger := new(testErrCatcher) - SetErrorHandler(&errLogger{l: log.New(newErrLogger, "", 0)}) - - errs := []string{"TestDelegatedHandler"} - eh.Handle(errors.New(errs[0])) - s.Assert().Equal(errs, newErrLogger.Got()) -} - -func (s *HandlerTestSuite) TestNoDropsOnDelegate() { - causeErr("") - s.Require().Len(s.errCatcher.Got(), 1) - - // Change to another Handler. We are testing this is loss-less. - newErrLogger := new(testErrCatcher) - secondary := &errLogger{ - l: log.New(newErrLogger, "", 0), - } - SetErrorHandler(secondary) - - causeErr("") - s.Assert().Len(s.errCatcher.Got(), 1, "original Handler used after delegation") - s.Assert().Len(newErrLogger.Got(), 1, "new Handler not used after delegation") +type testErrHandler struct { + err error } -func (s *HandlerTestSuite) TestAllowMultipleSets() { - notUsed := new(testErrCatcher) - - secondary := &errLogger{l: log.New(notUsed, "", 0)} - SetErrorHandler(secondary) - s.Require().Same(GetErrorHandler(), globalErrorHandler, "set changed globalErrorHandler") - s.Require().Same(globalErrorHandler.getDelegate(), secondary, "new Handler not set") +var _ ErrorHandler = &testErrHandler{} - tertiary := &errLogger{l: log.New(notUsed, "", 0)} - SetErrorHandler(tertiary) - s.Require().Same(GetErrorHandler(), globalErrorHandler, "set changed globalErrorHandler") - s.Assert().Same(globalErrorHandler.getDelegate(), tertiary, "user Handler not overridden") -} +func (eh *testErrHandler) Handle(err error) { eh.err = err } -func TestHandlerTestSuite(t *testing.T) { - suite.Run(t, new(HandlerTestSuite)) -} - -func TestHandlerRace(t *testing.T) { - go SetErrorHandler(&errLogger{log.New(os.Stderr, "", 0)}) - go Handle(errors.New("error")) -} - -func BenchmarkErrorHandler(b *testing.B) { - primary := &errLogger{l: log.New(io.Discard, "", 0)} - secondary := &errLogger{l: log.New(io.Discard, "", 0)} - tertiary := &errLogger{l: log.New(io.Discard, "", 0)} - - globalErrorHandler.setDelegate(primary) - - err := errors.New("benchmark error handler") - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - GetErrorHandler().Handle(err) - Handle(err) - - SetErrorHandler(secondary) - GetErrorHandler().Handle(err) - Handle(err) - - SetErrorHandler(tertiary) - GetErrorHandler().Handle(err) - Handle(err) - - globalErrorHandler.setDelegate(primary) - } - - reset() -} - -var eh ErrorHandler - -func BenchmarkGetDefaultErrorHandler(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - eh = GetErrorHandler() - } -} - -func BenchmarkGetDelegatedErrorHandler(b *testing.B) { - SetErrorHandler(&errLogger{l: log.New(io.Discard, "", 0)}) - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - eh = GetErrorHandler() - } - - reset() -} - -func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { - globalErrorHandler.setDelegate( - &errLogger{l: log.New(io.Discard, "", 0)}, - ) - - eh := GetErrorHandler() - err := errors.New("benchmark default error handler handle") - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - eh.Handle(err) - } - - reset() -} - -func BenchmarkDelegatedErrorHandlerHandle(b *testing.B) { - eh := GetErrorHandler() - SetErrorHandler(&errLogger{l: log.New(io.Discard, "", 0)}) - err := errors.New("benchmark delegated error handler handle") - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - eh.Handle(err) - } - - reset() -} - -func BenchmarkSetErrorHandlerDelegation(b *testing.B) { - alt := &errLogger{l: log.New(io.Discard, "", 0)} - - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - SetErrorHandler(alt) - - reset() - } -} +func TestGlobalErrorHandler(t *testing.T) { + e1 := &testErrHandler{} + SetErrorHandler(e1) + Handle(assert.AnError) + assert.ErrorIs(t, e1.err, assert.AnError) + e1.err = nil -func reset() { - globalErrorHandler = defaultErrorHandler() + e2 := &testErrHandler{} + SetErrorHandler(e2) + GetErrorHandler().Handle(assert.AnError) + assert.ErrorIs(t, e2.err, assert.AnError) } diff --git a/internal/global/handler.go b/internal/global/handler.go new file mode 100644 index 00000000000..3dcd1caae69 --- /dev/null +++ b/internal/global/handler.go @@ -0,0 +1,103 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/internal/global" + +import ( + "log" + "os" + "sync/atomic" + "unsafe" +) + +var ( + // GlobalErrorHandler provides an ErrorHandler that can be used + // throughout an OpenTelemetry instrumented project. When a user + // specified ErrorHandler is registered (`SetErrorHandler`) all calls to + // `Handle` and will be delegated to the registered ErrorHandler. + GlobalErrorHandler = defaultErrorHandler() + + // Compile-time check that delegator implements ErrorHandler. + _ ErrorHandler = (*ErrDelegator)(nil) + // Compile-time check that errLogger implements ErrorHandler. + _ ErrorHandler = (*ErrLogger)(nil) +) + +// ErrorHandler handles irremediable events. +type ErrorHandler interface { + // Handle handles any error deemed irremediable by an OpenTelemetry + // component. + Handle(error) +} + +type ErrDelegator struct { + delegate unsafe.Pointer +} + +func (d *ErrDelegator) Handle(err error) { + d.getDelegate().Handle(err) +} + +func (d *ErrDelegator) getDelegate() ErrorHandler { + return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate)) +} + +// setDelegate sets the ErrorHandler delegate. +func (d *ErrDelegator) setDelegate(eh ErrorHandler) { + atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh)) +} + +func defaultErrorHandler() *ErrDelegator { + d := &ErrDelegator{} + d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)}) + return d +} + +// ErrLogger logs errors if no delegate is set, otherwise they are delegated. +type ErrLogger struct { + l *log.Logger +} + +// Handle logs err if no delegate is set, otherwise it is delegated. +func (h *ErrLogger) Handle(err error) { + h.l.Print(err) +} + +// GetErrorHandler returns the global ErrorHandler instance. +// +// The default ErrorHandler instance returned will log all errors to STDERR +// until an override ErrorHandler is set with SetErrorHandler. All +// ErrorHandler returned prior to this will automatically forward errors to +// the set instance instead of logging. +// +// Subsequent calls to SetErrorHandler after the first will not forward errors +// to the new ErrorHandler for prior returned instances. +func GetErrorHandler() ErrorHandler { + return GlobalErrorHandler +} + +// SetErrorHandler sets the global ErrorHandler to h. +// +// The first time this is called all ErrorHandler previously returned from +// GetErrorHandler will send errors to h instead of the default logging +// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not +// delegate errors to h. +func SetErrorHandler(h ErrorHandler) { + GlobalErrorHandler.setDelegate(h) +} + +// Handle is a convenience function for ErrorHandler().Handle(err). +func Handle(err error) { + GetErrorHandler().Handle(err) +} diff --git a/internal/global/handler_test.go b/internal/global/handler_test.go new file mode 100644 index 00000000000..08074bcc0ff --- /dev/null +++ b/internal/global/handler_test.go @@ -0,0 +1,226 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global + +import ( + "bytes" + "errors" + "io" + "log" + "os" + "testing" + + "github.com/stretchr/testify/suite" +) + +type testErrCatcher []string + +func (l *testErrCatcher) Write(p []byte) (int, error) { + msg := bytes.TrimRight(p, "\n") + (*l) = append(*l, string(msg)) + return len(msg), nil +} + +func (l *testErrCatcher) Reset() { + *l = testErrCatcher([]string{}) +} + +func (l *testErrCatcher) Got() []string { + return []string(*l) +} + +func causeErr(text string) { + Handle(errors.New(text)) +} + +type HandlerTestSuite struct { + suite.Suite + + origHandler ErrorHandler + errCatcher *testErrCatcher +} + +func (s *HandlerTestSuite) SetupSuite() { + s.errCatcher = new(testErrCatcher) + s.origHandler = GlobalErrorHandler.getDelegate() + + GlobalErrorHandler.setDelegate(&ErrLogger{l: log.New(s.errCatcher, "", 0)}) +} + +func (s *HandlerTestSuite) TearDownSuite() { + GlobalErrorHandler.setDelegate(s.origHandler) +} + +func (s *HandlerTestSuite) SetupTest() { + s.errCatcher.Reset() +} + +func (s *HandlerTestSuite) TearDownTest() { + GlobalErrorHandler.setDelegate(&ErrLogger{l: log.New(s.errCatcher, "", 0)}) +} + +func (s *HandlerTestSuite) TestGlobalHandler() { + errs := []string{"one", "two"} + GetErrorHandler().Handle(errors.New(errs[0])) + Handle(errors.New(errs[1])) + s.Assert().Equal(errs, s.errCatcher.Got()) +} + +func (s *HandlerTestSuite) TestDelegatedHandler() { + eh := GetErrorHandler() + + newErrLogger := new(testErrCatcher) + SetErrorHandler(&ErrLogger{l: log.New(newErrLogger, "", 0)}) + + errs := []string{"TestDelegatedHandler"} + eh.Handle(errors.New(errs[0])) + s.Assert().Equal(errs, newErrLogger.Got()) +} + +func (s *HandlerTestSuite) TestNoDropsOnDelegate() { + causeErr("") + s.Require().Len(s.errCatcher.Got(), 1) + + // Change to another Handler. We are testing this is loss-less. + newErrLogger := new(testErrCatcher) + secondary := &ErrLogger{ + l: log.New(newErrLogger, "", 0), + } + SetErrorHandler(secondary) + + causeErr("") + s.Assert().Len(s.errCatcher.Got(), 1, "original Handler used after delegation") + s.Assert().Len(newErrLogger.Got(), 1, "new Handler not used after delegation") +} + +func (s *HandlerTestSuite) TestAllowMultipleSets() { + notUsed := new(testErrCatcher) + + secondary := &ErrLogger{l: log.New(notUsed, "", 0)} + SetErrorHandler(secondary) + s.Require().Same(GetErrorHandler(), GlobalErrorHandler, "set changed globalErrorHandler") + s.Require().Same(GlobalErrorHandler.getDelegate(), secondary, "new Handler not set") + + tertiary := &ErrLogger{l: log.New(notUsed, "", 0)} + SetErrorHandler(tertiary) + s.Require().Same(GetErrorHandler(), GlobalErrorHandler, "set changed globalErrorHandler") + s.Assert().Same(GlobalErrorHandler.getDelegate(), tertiary, "user Handler not overridden") +} + +func TestHandlerTestSuite(t *testing.T) { + suite.Run(t, new(HandlerTestSuite)) +} + +func TestHandlerRace(t *testing.T) { + go SetErrorHandler(&ErrLogger{log.New(os.Stderr, "", 0)}) + go Handle(errors.New("error")) +} + +func BenchmarkErrorHandler(b *testing.B) { + primary := &ErrLogger{l: log.New(io.Discard, "", 0)} + secondary := &ErrLogger{l: log.New(io.Discard, "", 0)} + tertiary := &ErrLogger{l: log.New(io.Discard, "", 0)} + + GlobalErrorHandler.setDelegate(primary) + + err := errors.New("benchmark error handler") + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + GetErrorHandler().Handle(err) + Handle(err) + + SetErrorHandler(secondary) + GetErrorHandler().Handle(err) + Handle(err) + + SetErrorHandler(tertiary) + GetErrorHandler().Handle(err) + Handle(err) + + GlobalErrorHandler.setDelegate(primary) + } + + reset() +} + +var eh ErrorHandler + +func BenchmarkGetDefaultErrorHandler(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + eh = GetErrorHandler() + } +} + +func BenchmarkGetDelegatedErrorHandler(b *testing.B) { + SetErrorHandler(&ErrLogger{l: log.New(io.Discard, "", 0)}) + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + eh = GetErrorHandler() + } + + reset() +} + +func BenchmarkDefaultErrorHandlerHandle(b *testing.B) { + GlobalErrorHandler.setDelegate( + &ErrLogger{l: log.New(io.Discard, "", 0)}, + ) + + eh := GetErrorHandler() + err := errors.New("benchmark default error handler handle") + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + eh.Handle(err) + } + + reset() +} + +func BenchmarkDelegatedErrorHandlerHandle(b *testing.B) { + eh := GetErrorHandler() + SetErrorHandler(&ErrLogger{l: log.New(io.Discard, "", 0)}) + err := errors.New("benchmark delegated error handler handle") + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + eh.Handle(err) + } + + reset() +} + +func BenchmarkSetErrorHandlerDelegation(b *testing.B) { + alt := &ErrLogger{l: log.New(io.Discard, "", 0)} + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + SetErrorHandler(alt) + + reset() + } +} + +func reset() { + GlobalErrorHandler = defaultErrorHandler() +} diff --git a/metric.go b/metric.go new file mode 100644 index 00000000000..dcf7b7931fe --- /dev/null +++ b/metric.go @@ -0,0 +1,61 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "go.opentelemetry.io/otel/metric" + // TODO (#3819): Remove this disablement. + // nolint: staticcheck // Temporary, while metric/global is deprecated. + "go.opentelemetry.io/otel/metric/global" +) + +// Meter returns a Meter from the global MeterProvider. The name must be the +// name of the library providing instrumentation. This name may be the same as +// the instrumented code only if that code provides built-in instrumentation. +// If the name is empty, then a implementation defined default name will be +// used instead. +// +// If this is called before a global MeterProvider is registered the returned +// Meter will be a No-op implementation of a Meter. When a global MeterProvider +// is registered for the first time, the returned Meter, and all the +// instruments it has created or will create, are recreated automatically from +// the new MeterProvider. +// +// This is short for GetMeterProvider().Meter(name). +func Meter(name string, opts ...metric.MeterOption) metric.Meter { + // TODO (#3819): Remove this disablement. + // nolint: staticcheck // Temporary, while metric/global is deprecated. + return GetMeterProvider().Meter(name, opts...) +} + +// GetMeterProvider returns the registered global meter provider. +// +// If no global GetMeterProvider has been registered, a No-op GetMeterProvider +// implementation is returned. When a global GetMeterProvider is registered for +// the first time, the returned GetMeterProvider, and all the Meters it has +// created or will create, are recreated automatically from the new +// GetMeterProvider. +func GetMeterProvider() metric.MeterProvider { + // TODO (#3819): Remove this disablement. + // nolint: staticcheck // Temporary, while metric/global is deprecated. + return global.MeterProvider() +} + +// SetMeterProvider registers mp as the global MeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + // TODO (#3819): Remove this disablement. + // nolint: staticcheck // Temporary, while metric/global is deprecated. + global.SetMeterProvider(mp) +} diff --git a/metric/global/global.go b/metric/global/global.go index cb0896d38ac..09817388e20 100644 --- a/metric/global/global.go +++ b/metric/global/global.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package global provides a global MeterProvider for OpenTelemetry. +// +// Deprecated: Use go.opentelemetry.io/otel instead. package global // import "go.opentelemetry.io/otel/metric/global" import ( @@ -26,17 +29,23 @@ import ( // empty, then a implementation defined default name will be used instead. // // This is short for MeterProvider().Meter(name). +// +// Deprecated: Use Meter from go.opentelemetry.io/otel instead. func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { return MeterProvider().Meter(instrumentationName, opts...) } // MeterProvider returns the registered global meter provider. // If none is registered then a No-op MeterProvider is returned. +// +// Deprecated: Use MeterProvider from go.opentelemetry.io/otel instead. func MeterProvider() metric.MeterProvider { return global.MeterProvider() } // SetMeterProvider registers `mp` as the global meter provider. +// +// Deprecated: Use SetMeterProvider from go.opentelemetry.io/otel instead. func SetMeterProvider(mp metric.MeterProvider) { global.SetMeterProvider(mp) } diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index d1480fa5f3e..edc60033841 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -18,8 +18,8 @@ import ( "context" "sync/atomic" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + oGlob "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) @@ -44,7 +44,7 @@ var _ instrument.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -72,7 +72,7 @@ var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -100,7 +100,7 @@ var _ instrument.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -128,7 +128,7 @@ var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -156,7 +156,7 @@ var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -184,7 +184,7 @@ var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -212,7 +212,7 @@ var _ instrument.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -238,7 +238,7 @@ var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -264,7 +264,7 @@ var _ instrument.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -290,7 +290,7 @@ var _ instrument.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -316,7 +316,7 @@ var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -342,7 +342,7 @@ var _ instrument.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index 8acf632863c..0064ed8fec7 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -19,7 +19,7 @@ import ( "sync" "sync/atomic" - "go.opentelemetry.io/otel" + oGlob "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) @@ -334,7 +334,7 @@ func (c *registration) setDelegate(m metric.Meter) { reg, err := m.RegisterCallback(c.function, insts...) if err != nil { - otel.Handle(err) + oGlob.GetErrorHandler().Handle(err) } c.unreg = reg.Unregister diff --git a/metric_test.go b/metric_test.go new file mode 100644 index 00000000000..646bb108368 --- /dev/null +++ b/metric_test.go @@ -0,0 +1,41 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otel // import "go.opentelemetry.io/otel" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric" +) + +type testMeterProvider struct{} + +var _ metric.MeterProvider = &testMeterProvider{} + +func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter { + return metric.NewNoopMeterProvider().Meter("") +} + +func TestMultipleGlobalMeterProvider(t *testing.T) { + p1 := testMeterProvider{} + p2 := metric.NewNoopMeterProvider() + SetMeterProvider(&p1) + SetMeterProvider(p2) + + got := GetMeterProvider() + assert.Equal(t, p2, got) +} diff --git a/sdk/go.mod b/sdk/go.mod index 38a150da424..81022a6a137 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -17,7 +17,10 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.37.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../trace + +replace go.opentelemetry.io/otel/metric => ../metric diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index c0704509a26..0086dba7687 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -18,7 +18,7 @@ import ( "context" "log" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" @@ -42,7 +42,7 @@ func Example() { metric.WithResource(res), metric.WithReader(reader), ) - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) defer func() { err := meterProvider.Shutdown(context.Background()) if err != nil { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index d86be80c308..31f291c06e2 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -631,7 +630,7 @@ func TestGlobalInstRegisterCallback(t *testing.T) { otel.SetLogger(logr.New(l)) const mtrName = "TestGlobalInstRegisterCallback" - preMtr := global.Meter(mtrName) + preMtr := otel.Meter(mtrName) preInt64Ctr, err := preMtr.Int64ObservableCounter("pre.int64.counter") require.NoError(t, err) preFloat64Ctr, err := preMtr.Float64ObservableCounter("pre.float64.counter") @@ -639,9 +638,9 @@ func TestGlobalInstRegisterCallback(t *testing.T) { rdr := NewManualReader() mp := NewMeterProvider(WithReader(rdr), WithResource(resource.Empty())) - global.SetMeterProvider(mp) + otel.SetMeterProvider(mp) - postMtr := global.Meter(mtrName) + postMtr := otel.Meter(mtrName) postInt64Ctr, err := postMtr.Int64ObservableCounter("post.int64.counter") require.NoError(t, err) postFloat64Ctr, err := postMtr.Float64ObservableCounter("post.float64.counter") diff --git a/trace/go.mod b/trace/go.mod index eaaf00035ae..05af8f6e729 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -15,3 +15,5 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../metric From 34aacd95ff1f52eb77d75c679859fae902917817 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 2 Mar 2023 07:43:27 -0800 Subject: [PATCH 441/886] Release v1.15.0-rc.1 (#3825) * Bump module set versions * Prepare stable-v1 for version v1.15.0-rc.1 * Prepare experimental-metrics for version v0.38.0-rc.1 * Update changelog --- CHANGELOG.md | 11 ++++++++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/jaeger/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 14 +++++++------- example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/jaeger/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlptrace/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 12 ++++++------ exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 12 ++++++------ 32 files changed, 158 insertions(+), 149 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c774008a2c3..903b95b9480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + +This release drops the compatibility guarantee of [Go 1.18]. + ### Added - Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818) @@ -2327,7 +2335,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.14.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0-rc.1...HEAD +[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 [1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 [1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 [1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a9512663b01..0a2a57d10ef 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index a9923f58cfe..b623bde7995 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/bridge/opencensus v0.37.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 38f15dcd752..0c7dcf53332 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 3edb93674d0..2e0a3a78ad5 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/bridge/opentracing v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/bridge/opentracing v1.15.0-rc.1 google.golang.org/grpc v1.53.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 7d6f35a96c8..948ec96bcee 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.18 require ( - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index b99aae53537..2cb42aa3638 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,16 +9,16 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/jaeger v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/jaeger v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 8b6a5dc3cd5..04777e3a78e 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 923ea397dc7..debf4358c4f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/bridge/opencensus v0.37.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.37.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e5cc970943c..fbe47e18714 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 google.golang.org/grpc v1.53.0 ) @@ -21,9 +21,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 2934867637d..f85529aa0f7 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.18 require ( - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 7a8e980b92c..521d1688339 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/prometheus v0.37.0 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.1 + go.opentelemetry.io/otel/metric v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 6fa01733e6d..26186472134 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/prometheus v0.37.0 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.1 + go.opentelemetry.io/otel/metric v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 811e4c700a5..1feabccadb4 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/zipkin v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/zipkin v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect ) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 4d1fd8b3a1c..f54ed91a992 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,16 +7,16 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 37bd61e454c..50f80716bb5 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index bf30fb30dac..cfba1fdf48d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 @@ -25,9 +25,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3b47c210709..e0e85338132 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.37.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -23,9 +23,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 3be0bbf9aea..58a7ee96dbc 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.18 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 @@ -22,7 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7099a5e7a5f..c3fd8d12389 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,8 +23,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0fcbeee6fae..08de093d0ea 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.28.1 ) @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.5.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 505c4e7a40a..a4fd4ed95e6 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/metric v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 google.golang.org/protobuf v1.28.1 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index ef13d99ad85..7bd1cb049be 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/sdk/metric v0.37.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c83008d96e7..77812172188 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 090cb404466..1b629716c61 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/sdk v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index a4013cf63d6..9d20c7fc670 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel/metric v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 12967506e8a..21fc7040426 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 81022a6a137..e54d7406b0e 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/trace v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/trace v1.15.0-rc.1 golang.org/x/sys v0.5.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.37.0 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 406358cec30..5df6d9a2452 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.18 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 - go.opentelemetry.io/otel/metric v0.37.0 - go.opentelemetry.io/otel/sdk v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel/metric v1.15.0-rc.1 + go.opentelemetry.io/otel/sdk v1.15.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 05af8f6e729..e7b52c0a3fe 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.14.0 + go.opentelemetry.io/otel v1.15.0-rc.1 ) require ( diff --git a/version.go b/version.go index 0e8e5e02329..080638e08ea 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.14.0" + return "1.15.0-rc.1" } diff --git a/versions.yaml b/versions.yaml index 40df1fae417..eea6b18289d 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.14.0 + version: v1.15.0-rc.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -26,16 +26,17 @@ module-sets: - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin - go.opentelemetry.io/otel/exporters/jaeger - - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/exporters/otlp/internal/retry - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - - go.opentelemetry.io/otel/exporters/otlp/internal/retry - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - - go.opentelemetry.io/otel/trace + - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk + - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.37.0 + version: v0.38.0-rc.1 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus @@ -44,7 +45,6 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From c869b9171ac19f2321bd685fe32199c3ad668418 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 2 Mar 2023 11:42:46 -0800 Subject: [PATCH 442/886] Document httpconv and netconv packages as trace providing only trace semantic convention (#3823) * Document {http,net}conv pkgs as trace semconv * Fix spelling error --- CHANGELOG.md | 1 + .../templates/httpconv/http.go.tmpl | 18 +++++++------ .../semconvkit/templates/netconv/net.go.tmpl | 26 +++++++++---------- semconv/v1.13.0/httpconv/http.go | 18 +++++++------ semconv/v1.13.0/netconv/net.go | 26 +++++++++---------- semconv/v1.14.0/httpconv/http.go | 18 +++++++------ semconv/v1.14.0/netconv/net.go | 26 +++++++++---------- semconv/v1.15.0/httpconv/http.go | 18 +++++++------ semconv/v1.15.0/netconv/net.go | 26 +++++++++---------- semconv/v1.16.0/httpconv/http.go | 18 +++++++------ semconv/v1.16.0/netconv/net.go | 26 +++++++++---------- semconv/v1.17.0/httpconv/http.go | 18 +++++++------ semconv/v1.17.0/netconv/net.go | 26 +++++++++---------- semconv/v1.18.0/httpconv/http.go | 18 +++++++------ semconv/v1.18.0/netconv/net.go | 26 +++++++++---------- 15 files changed, 162 insertions(+), 147 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 903b95b9480..4e10fa46421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This release drops the compatibility guarantee of [Go 1.18]. ### Fixed - Handle empty environment variable as it they were not set. (#3764) +- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) ### Deprecated diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl index e21a387d1c9..3fd4685429d 100644 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/internal/tools/semconvkit/templates/netconv/net.go.tmpl b/internal/tools/semconvkit/templates/netconv/net.go.tmpl index 02b5f923a19..51be655572b 100644 --- a/internal/tools/semconvkit/templates/netconv/net.go.tmpl +++ b/internal/tools/semconvkit/templates/netconv/net.go.tmpl @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.13.0/httpconv/http.go b/semconv/v1.13.0/httpconv/http.go index 29c29c65b46..3c7e86d61e7 100644 --- a/semconv/v1.13.0/httpconv/http.go +++ b/semconv/v1.13.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.13.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.13.0/netconv/net.go b/semconv/v1.13.0/netconv/net.go index 6c9c6a500e8..4e60e5ab72f 100644 --- a/semconv/v1.13.0/netconv/net.go +++ b/semconv/v1.13.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.13.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.14.0/httpconv/http.go b/semconv/v1.14.0/httpconv/http.go index 017c7bb23df..4df87b24171 100644 --- a/semconv/v1.14.0/httpconv/http.go +++ b/semconv/v1.14.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.14.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.14.0/netconv/net.go b/semconv/v1.14.0/netconv/net.go index 5612517df19..bb16ba5be5b 100644 --- a/semconv/v1.14.0/netconv/net.go +++ b/semconv/v1.14.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.14.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.15.0/httpconv/http.go b/semconv/v1.15.0/httpconv/http.go index 456b372a96b..495174ce7d0 100644 --- a/semconv/v1.15.0/httpconv/http.go +++ b/semconv/v1.15.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.15.0/netconv/net.go b/semconv/v1.15.0/netconv/net.go index 49a7fc1c58c..101cd797080 100644 --- a/semconv/v1.15.0/netconv/net.go +++ b/semconv/v1.15.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.15.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.16.0/httpconv/http.go b/semconv/v1.16.0/httpconv/http.go index 11ff9edc703..6b0ebf2452f 100644 --- a/semconv/v1.16.0/httpconv/http.go +++ b/semconv/v1.16.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.16.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.16.0/netconv/net.go b/semconv/v1.16.0/netconv/net.go index 9a8a1e94bef..cfa667e23ab 100644 --- a/semconv/v1.16.0/netconv/net.go +++ b/semconv/v1.16.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.16.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.17.0/httpconv/http.go b/semconv/v1.17.0/httpconv/http.go index c60b2a6bb68..fc43808fe44 100644 --- a/semconv/v1.17.0/httpconv/http.go +++ b/semconv/v1.17.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.17.0/netconv/net.go b/semconv/v1.17.0/netconv/net.go index d411039584b..0a2c1928799 100644 --- a/semconv/v1.17.0/netconv/net.go +++ b/semconv/v1.17.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } diff --git a/semconv/v1.18.0/httpconv/http.go b/semconv/v1.18.0/httpconv/http.go index 98f6e078ed1..9e3bff8197c 100644 --- a/semconv/v1.18.0/httpconv/http.go +++ b/semconv/v1.18.0/httpconv/http.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package httpconv provides OpenTelemetry semantic convetions for the net/http -// package from the standard library. +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. package httpconv // import "go.opentelemetry.io/otel/semconv/v1.18.0/httpconv" import ( @@ -58,9 +58,10 @@ var ( } ) -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. It will return the following attributes if the related values -// are defined in resp: "http.status.code", "http.response_content_length". +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". // // This does not add all OpenTelemetry required attributes for an HTTP event, // it assumes ClientRequest was used to create the span with a complete set of @@ -72,8 +73,8 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { return hc.ClientResponse(resp) } -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.flavor", +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", // "http.method", "net.peer.name". The following attributes are returned if the // related values are defined in req: "net.peer.port", "http.user_agent", // "http.request_content_length", "enduser.id". @@ -87,7 +88,8 @@ func ClientStatus(code int) (codes.Code, string) { return hc.ClientStatus(code) } -// ServerRequest returns attributes for an HTTP request received by a server. +// ServerRequest returns trace attributes for an HTTP request received by a +// server. // // The server must be the primary server name if it is known. For example this // would be the ServerName directive diff --git a/semconv/v1.18.0/netconv/net.go b/semconv/v1.18.0/netconv/net.go index aaa2a5a9bc4..3ad892deaef 100644 --- a/semconv/v1.18.0/netconv/net.go +++ b/semconv/v1.18.0/netconv/net.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package netconv provides OpenTelemetry semantic convetions for the net -// package from the standard library. +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. package netconv // import "go.opentelemetry.io/otel/semconv/v1.18.0/netconv" import ( @@ -40,27 +40,27 @@ var nc = &internal.NetConv{ NetTransportInProc: semconv.NetTransportInProc, } -// Transport returns an attribute describing the transport protocol of the +// Transport returns a trace attribute describing the transport protocol of the // passed network. See the net.Dial for information about acceptable network // values. func Transport(network string) attribute.KeyValue { return nc.Transport(network) } -// Client returns attributes for a client network connection to address. See -// net.Dial for information about acceptable address values, address should be -// the same as the one used to create conn. If conn is nil, only network peer -// attributes will be returned that describe address. Otherwise, the socket -// level information about conn will also be included. +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. func Client(address string, conn net.Conn) []attribute.KeyValue { return nc.Client(address, conn) } -// Server returns attributes for a network listener listening at address. See -// net.Listen for information about acceptable address values, address should -// be the same as the one used to create ln. If ln is nil, only network host -// attributes will be returned that describe address. Otherwise, the socket -// level information about ln will also be included. +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. func Server(address string, ln net.Listener) []attribute.KeyValue { return nc.Server(address, ln) } From 3df561e6446d5990db4aed37ab9c0a7a1ceadfce Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 6 Mar 2023 07:40:41 -0800 Subject: [PATCH 443/886] dependabot updates Mon Mar 6 15:33:46 UTC 2023 (#3840) Bump github.com/itchyny/gojq from 0.12.11 to 0.12.12 in /internal/tools Bump golang.org/x/sys from 0.5.0 to 0.6.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 11 ++++++----- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 52 files changed, 84 insertions(+), 83 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 0a2a57d10ef..d76fd2f2962 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index ba5db799521..ba8b1f1e710 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index b623bde7995..fa08d2ac53a 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index eb6df8c78c7..90708c7e17c 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 2e0a3a78ad5..e42d733ffd8 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 2e75e353c12..b600339cf86 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -45,8 +45,8 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= diff --git a/example/fib/go.mod b/example/fib/go.mod index 948ec96bcee..f85936833c3 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index 8372cecb731..4e20825039b 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 2cb42aa3638..199ad3b64e6 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 80109880bba..98ab5a86343 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 04777e3a78e..637b0fdd26b 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 8372cecb731..4e20825039b 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index debf4358c4f..a4caac4741d 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index eb6df8c78c7..90708c7e17c 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index fbe47e18714..68dd2f7377d 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 1dc4984d1c6..96ed0f25eab 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index f85529aa0f7..4ef682f2b5b 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 8372cecb731..4e20825039b 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 521d1688339..fe45ea26565 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index aa66d5a71bb..efc191e53c4 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/view/go.mod b/example/view/go.mod index 26186472134..2504829596d 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index aa66d5a71bb..efc191e53c4 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 1feabccadb4..2cedff454ae 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 13784086486..dc3a56e7fa0 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f54ed91a992..f5778fbc28f 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 06d66ff92b0..307ecdbf9da 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 50f80716bb5..8fad320d8c6 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 754e82f6680..84b59c09cf1 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index cfba1fdf48d..3adc9217e0c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 754e82f6680..84b59c09cf1 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index e0e85338132..c5a3fd38411 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.53.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 754e82f6680..84b59c09cf1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 58a7ee96dbc..e67c8958a02 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 754e82f6680..84b59c09cf1 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index c3fd8d12389..a5972805676 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 33fa8184a7b..4eb0e2c27c4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -274,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 08de093d0ea..36c4cc474af 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,7 +23,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.53.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 7d59fcedabb..18aadbd3d04 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -272,8 +272,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index a4fd4ed95e6..3dbac3cccd4 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 4653b262e79..5ea7ae84afa 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -334,8 +334,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 7bd1cb049be..9c6081c1a21 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 5697cd57f57..2a214113b99 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 77812172188..59a37f1c70d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 5697cd57f57..2a214113b99 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 1b629716c61..82098ea9ab5 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 1e747f2d521..bd17a1b6bc9 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -19,8 +19,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index f47bb2347e3..437df0bcb61 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.51.2 - github.com/itchyny/gojq v0.12.11 + github.com/itchyny/gojq v0.12.12 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.6.0 @@ -144,7 +144,7 @@ require ( github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect - github.com/rivo/uniseg v0.2.0 // indirect + github.com/rivo/uniseg v0.4.4 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect @@ -195,7 +195,7 @@ require ( golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 027e477de6e..9a9cbd4cf79 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -324,8 +324,8 @@ github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itchyny/gojq v0.12.11 h1:YhLueoHhHiN4mkfM+3AyJV6EPcCxKZsOnYf+aVSwaQw= -github.com/itchyny/gojq v0.12.11/go.mod h1:o3FT8Gkbg/geT4pLI0tF3hvip5F3Y/uskjRz9OYa38g= +github.com/itchyny/gojq v0.12.12 h1:x+xGI9BXqKoJQZkr95ibpe3cdrTbY8D9lonrK433rcA= +github.com/itchyny/gojq v0.12.12/go.mod h1:j+3sVkjxwd7A7Z5jrbKibgOLn0ZfLWkV+Awxr/pyzJE= github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -492,8 +492,9 @@ github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -831,8 +832,8 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/sdk/go.mod b/sdk/go.mod index e54d7406b0e..ca0e82b8dc3 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.1 go.opentelemetry.io/otel/trace v1.15.0-rc.1 - golang.org/x/sys v0.5.0 + golang.org/x/sys v0.6.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 4a61b1dabd1..c55ea7c42e3 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -17,8 +17,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 5df6d9a2452..15491e08b9e 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect - golang.org/x/sys v0.5.0 // indirect + golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 5697cd57f57..2a214113b99 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 3015c86cfd1e1868b9c57a998d44ebe25acffedc Mon Sep 17 00:00:00 2001 From: Alan Protasio Date: Tue, 7 Mar 2023 05:40:31 -0800 Subject: [PATCH 444/886] Avoid creating new references on `WithDeferredSetup` for every span (#3833) * Avoid creating new references on WithDeferredSetup call --- CHANGELOG.md | 4 ++++ bridge/opentracing/migration/defer.go | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e10fa46421..e1a61f521db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) + ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 This is a release candidate for the v1.15.0/v0.38.0 release. diff --git a/bridge/opentracing/migration/defer.go b/bridge/opentracing/migration/defer.go index f2dd690efef..cbeca54cccc 100644 --- a/bridge/opentracing/migration/defer.go +++ b/bridge/opentracing/migration/defer.go @@ -20,15 +20,20 @@ import ( type doDeferredContextSetupType struct{} +var ( + doDeferredContextSetupTypeKey = doDeferredContextSetupType{} + doDeferredContextSetupTypeValue = doDeferredContextSetupType{} +) + // WithDeferredSetup returns a context that can tell the OpenTelemetry // tracer to skip the context setup in the Start() function. func WithDeferredSetup(ctx context.Context) context.Context { - return context.WithValue(ctx, doDeferredContextSetupType{}, doDeferredContextSetupType{}) + return context.WithValue(ctx, doDeferredContextSetupTypeKey, doDeferredContextSetupTypeValue) } // SkipContextSetup can tell the OpenTelemetry tracer to skip the // context setup during the span creation in the Start() function. func SkipContextSetup(ctx context.Context) bool { - _, ok := ctx.Value(doDeferredContextSetupType{}).(doDeferredContextSetupType) + _, ok := ctx.Value(doDeferredContextSetupTypeKey).(doDeferredContextSetupType) return ok } From 60f7d42d1eedae6381f1d6524374b57a274e1639 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 7 Mar 2023 08:36:19 -0800 Subject: [PATCH 445/886] Remove the deprecated `otel/metric/global` pkg (#3829) * Remove the deprecated `otel/metric/global` pkg * Add changelog entry * Update PR number in changelog * Fix lint --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 4 + .../global/instruments.go | 27 +++--- .../global/instruments_test.go | 0 {metric/internal => internal}/global/meter.go | 10 +-- .../global/meter_test.go | 2 +- .../global/meter_types_test.go | 2 +- internal/global/state.go | 45 +++++++++- internal/global/state_test.go | 57 ++++++++++++ internal/global/util_test.go | 2 + metric.go | 10 +-- metric/global/global.go | 51 ----------- metric/go.mod | 3 - metric/go.sum | 5 -- metric/internal/global/state.go | 68 --------------- metric/internal/global/state_test.go | 86 ------------------- 15 files changed, 124 insertions(+), 248 deletions(-) rename {metric/internal => internal}/global/instruments.go (93%) rename {metric/internal => internal}/global/instruments_test.go (100%) rename {metric/internal => internal}/global/meter.go (97%) rename {metric/internal => internal}/global/meter_test.go (99%) rename {metric/internal => internal}/global/meter_types_test.go (98%) delete mode 100644 metric/global/global.go delete mode 100644 metric/internal/global/state.go delete mode 100644 metric/internal/global/state_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a61f521db..3a27f45b87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) + ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 This is a release candidate for the v1.15.0/v0.38.0 release. diff --git a/metric/internal/global/instruments.go b/internal/global/instruments.go similarity index 93% rename from metric/internal/global/instruments.go rename to internal/global/instruments.go index edc60033841..6234ee29a9f 100644 --- a/metric/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -12,14 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" "sync/atomic" "go.opentelemetry.io/otel/attribute" - oGlob "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) @@ -44,7 +43,7 @@ var _ instrument.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -72,7 +71,7 @@ var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -100,7 +99,7 @@ var _ instrument.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -128,7 +127,7 @@ var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -156,7 +155,7 @@ var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -184,7 +183,7 @@ var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -212,7 +211,7 @@ var _ instrument.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -238,7 +237,7 @@ var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -264,7 +263,7 @@ var _ instrument.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -290,7 +289,7 @@ var _ instrument.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -316,7 +315,7 @@ var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -342,7 +341,7 @@ var _ instrument.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) diff --git a/metric/internal/global/instruments_test.go b/internal/global/instruments_test.go similarity index 100% rename from metric/internal/global/instruments_test.go rename to internal/global/instruments_test.go diff --git a/metric/internal/global/meter.go b/internal/global/meter.go similarity index 97% rename from metric/internal/global/meter.go rename to internal/global/meter.go index 0064ed8fec7..051eac702f8 100644 --- a/metric/internal/global/meter.go +++ b/internal/global/meter.go @@ -12,14 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "container/list" "sync" "sync/atomic" - oGlob "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) @@ -35,11 +34,6 @@ type meterProvider struct { delegate metric.MeterProvider } -type il struct { - name string - version string -} - // setDelegate configures p to delegate all MeterProvider functionality to // provider. // @@ -334,7 +328,7 @@ func (c *registration) setDelegate(m metric.Meter) { reg, err := m.RegisterCallback(c.function, insts...) if err != nil { - oGlob.GetErrorHandler().Handle(err) + GetErrorHandler().Handle(err) } c.unreg = reg.Unregister diff --git a/metric/internal/global/meter_test.go b/internal/global/meter_test.go similarity index 99% rename from metric/internal/global/meter_test.go rename to internal/global/meter_test.go index 704c1f95634..b7b1ea9d8af 100644 --- a/metric/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/metric/internal/global/meter_types_test.go b/internal/global/meter_types_test.go similarity index 98% rename from metric/internal/global/meter_types_test.go rename to internal/global/meter_types_test.go index 5f172bf8f9e..ed7e49d3652 100644 --- a/metric/internal/global/meter_types_test.go +++ b/internal/global/meter_types_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/internal/global/state.go b/internal/global/state.go index 1ad38f828ec..7985005bcb6 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -19,6 +19,7 @@ import ( "sync" "sync/atomic" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -31,14 +32,20 @@ type ( propagatorsHolder struct { tm propagation.TextMapPropagator } + + meterProviderHolder struct { + mp metric.MeterProvider + } ) var ( - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() delegateTraceOnce sync.Once delegateTextMapPropagatorOnce sync.Once + delegateMeterOnce sync.Once ) // TracerProvider is the internal implementation for global.TracerProvider. @@ -102,6 +109,34 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { globalPropagators.Store(propagatorsHolder{tm: p}) } +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + func defaultTracerValue() *atomic.Value { v := &atomic.Value{} v.Store(tracerProviderHolder{tp: &tracerProvider{}}) @@ -113,3 +148,9 @@ func defaultPropagatorsValue() *atomic.Value { v.Store(propagatorsHolder{tm: newTextMapPropagator()}) return v } + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/internal/global/state_test.go b/internal/global/state_test.go index f26f9d8c5a4..1b441660cf5 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -19,6 +19,7 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -29,6 +30,12 @@ type nonComparableTracerProvider struct { nonComparable func() //nolint:structcheck,unused // This is not called. } +type nonComparableMeterProvider struct { + metric.MeterProvider + + nonComparable func() //nolint:structcheck,unused // This is not called. +} + func TestSetTracerProvider(t *testing.T) { t.Run("Set With default is a noop", func(t *testing.T) { ResetForTest(t) @@ -125,3 +132,53 @@ func TestSetTextMapPropagator(t *testing.T) { assert.NotPanics(t, func() { SetTextMapPropagator(prop) }) }) } + +func TestSetMeterProvider(t *testing.T) { + t.Run("Set With default is a noop", func(t *testing.T) { + ResetForTest(t) + + SetMeterProvider(MeterProvider()) + + mp, ok := MeterProvider().(*meterProvider) + if !ok { + t.Fatal("Global MeterProvider should be the default meter provider") + } + + if mp.delegate != nil { + t.Fatal("meter provider should not delegate when setting itself") + } + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + ResetForTest(t) + + SetMeterProvider(metric.NewNoopMeterProvider()) + + _, ok := MeterProvider().(*meterProvider) + if ok { + t.Fatal("Global MeterProvider was not changed") + } + }) + + t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { + ResetForTest(t) + + mp := MeterProvider() + + SetMeterProvider(metric.NewNoopMeterProvider()) + + dmp := mp.(*meterProvider) + + if dmp.delegate == nil { + t.Fatal("The delegated meter providers should have a delegate") + } + }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + ResetForTest(t) + + mp := nonComparableMeterProvider{} + SetMeterProvider(mp) + assert.NotPanics(t, func() { SetMeterProvider(mp) }) + }) +} diff --git a/internal/global/util_test.go b/internal/global/util_test.go index d0bca92f6c6..bc88508184c 100644 --- a/internal/global/util_test.go +++ b/internal/global/util_test.go @@ -25,7 +25,9 @@ func ResetForTest(t testing.TB) { t.Cleanup(func() { globalTracer = defaultTracerValue() globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() delegateTraceOnce = sync.Once{} delegateTextMapPropagatorOnce = sync.Once{} + delegateMeterOnce = sync.Once{} }) } diff --git a/metric.go b/metric.go index dcf7b7931fe..f955171951f 100644 --- a/metric.go +++ b/metric.go @@ -15,10 +15,8 @@ package otel // import "go.opentelemetry.io/otel" import ( + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" - // TODO (#3819): Remove this disablement. - // nolint: staticcheck // Temporary, while metric/global is deprecated. - "go.opentelemetry.io/otel/metric/global" ) // Meter returns a Meter from the global MeterProvider. The name must be the @@ -35,8 +33,6 @@ import ( // // This is short for GetMeterProvider().Meter(name). func Meter(name string, opts ...metric.MeterOption) metric.Meter { - // TODO (#3819): Remove this disablement. - // nolint: staticcheck // Temporary, while metric/global is deprecated. return GetMeterProvider().Meter(name, opts...) } @@ -48,14 +44,10 @@ func Meter(name string, opts ...metric.MeterOption) metric.Meter { // created or will create, are recreated automatically from the new // GetMeterProvider. func GetMeterProvider() metric.MeterProvider { - // TODO (#3819): Remove this disablement. - // nolint: staticcheck // Temporary, while metric/global is deprecated. return global.MeterProvider() } // SetMeterProvider registers mp as the global MeterProvider. func SetMeterProvider(mp metric.MeterProvider) { - // TODO (#3819): Remove this disablement. - // nolint: staticcheck // Temporary, while metric/global is deprecated. global.SetMeterProvider(mp) } diff --git a/metric/global/global.go b/metric/global/global.go deleted file mode 100644 index 09817388e20..00000000000 --- a/metric/global/global.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package global provides a global MeterProvider for OpenTelemetry. -// -// Deprecated: Use go.opentelemetry.io/otel instead. -package global // import "go.opentelemetry.io/otel/metric/global" - -import ( - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/internal/global" -) - -// Meter returns a Meter from the global MeterProvider. The -// instrumentationName must be the name of the library providing -// instrumentation. This name may be the same as the instrumented code only if -// that code provides built-in instrumentation. If the instrumentationName is -// empty, then a implementation defined default name will be used instead. -// -// This is short for MeterProvider().Meter(name). -// -// Deprecated: Use Meter from go.opentelemetry.io/otel instead. -func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - return MeterProvider().Meter(instrumentationName, opts...) -} - -// MeterProvider returns the registered global meter provider. -// If none is registered then a No-op MeterProvider is returned. -// -// Deprecated: Use MeterProvider from go.opentelemetry.io/otel instead. -func MeterProvider() metric.MeterProvider { - return global.MeterProvider() -} - -// SetMeterProvider registers `mp` as the global meter provider. -// -// Deprecated: Use SetMeterProvider from go.opentelemetry.io/otel instead. -func SetMeterProvider(mp metric.MeterProvider) { - global.SetMeterProvider(mp) -} diff --git a/metric/go.mod b/metric/go.mod index 21fc7040426..0f674a3d66e 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,10 +9,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/metric/go.sum b/metric/go.sum index 30515f028a5..ba5717f6a3d 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,11 +1,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go deleted file mode 100644 index 47c0d787d8a..00000000000 --- a/metric/internal/global/state.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// htmp://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "errors" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric" -) - -var ( - globalMeterProvider = defaultMeterProvider() - - delegateMeterOnce sync.Once -) - -type meterProviderHolder struct { - mp metric.MeterProvider -} - -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeterProvider.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - current := MeterProvider() - if _, cOk := current.(*meterProvider); cOk { - if _, mpOk := mp.(*meterProvider); mpOk && current == mp { - // Do not assign the default delegating MeterProvider to delegate - // to itself. - global.Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", - ) - return - } - } - - delegateMeterOnce.Do(func() { - if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeterProvider.Store(meterProviderHolder{mp: mp}) -} - -func defaultMeterProvider() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: &meterProvider{}}) - return v -} diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go deleted file mode 100644 index 9afd23c3cfa..00000000000 --- a/metric/internal/global/state_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "sync" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/metric" -) - -func resetGlobalMeterProvider() { - globalMeterProvider = defaultMeterProvider() - delegateMeterOnce = sync.Once{} -} - -type nonComparableMeterProvider struct { - metric.MeterProvider - - nonComparable func() //nolint:structcheck,unused // This is not called. -} - -func TestSetMeterProvider(t *testing.T) { - t.Cleanup(resetGlobalMeterProvider) - - t.Run("Set With default is a noop", func(t *testing.T) { - resetGlobalMeterProvider() - SetMeterProvider(MeterProvider()) - - mp, ok := MeterProvider().(*meterProvider) - if !ok { - t.Fatal("Global MeterProvider should be the default meter provider") - } - - if mp.delegate != nil { - t.Fatal("meter provider should not delegate when setting itself") - } - }) - - t.Run("First Set() should replace the delegate", func(t *testing.T) { - resetGlobalMeterProvider() - - SetMeterProvider(metric.NewNoopMeterProvider()) - - _, ok := MeterProvider().(*meterProvider) - if ok { - t.Fatal("Global MeterProvider was not changed") - } - }) - - t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { - resetGlobalMeterProvider() - - mp := MeterProvider() - - SetMeterProvider(metric.NewNoopMeterProvider()) - - dmp := mp.(*meterProvider) - - if dmp.delegate == nil { - t.Fatal("The delegated meter providers should have a delegate") - } - }) - - t.Run("non-comparable types should not panic", func(t *testing.T) { - resetGlobalMeterProvider() - - mp := nonComparableMeterProvider{} - SetMeterProvider(mp) - assert.NotPanics(t, func() { SetMeterProvider(mp) }) - }) -} From f993fac2360d481a644821f3c6ee2eeb069b6ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 8 Mar 2023 16:42:38 +0100 Subject: [PATCH 446/886] Update metrics project status to beta (#3843) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a585e3790d0..e138a8a07f4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ It provides a set of APIs to directly measure performance and behavior of your s | Signal | Status | Project | | ------- | ---------- | ------- | | Traces | Stable | N/A | -| Metrics | Alpha | N/A | +| Metrics | Beta | N/A | | Logs | Frozen [1] | N/A | - [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics. From 1626ff746f4f40afe65bc5f8a906fee2f9357626 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 8 Mar 2023 15:15:27 -0800 Subject: [PATCH 447/886] Wrap errors returned from `Detect` and `New` in `sdk/resource` (#3844) * Update Detect and New to wrap errors * Add TestNewWrapedError Test that New returns an error that can be unwrapped. * Add changes to changelog * Clarify and simplify errors --- CHANGELOG.md | 1 + sdk/resource/auto.go | 58 +++++++++++++++++++++++++++++------ sdk/resource/resource.go | 14 ++------- sdk/resource/resource_test.go | 19 ++++++++++++ 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a27f45b87e..0676eecb15d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) +- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) ### Removed diff --git a/sdk/resource/auto.go b/sdk/resource/auto.go index c1d220408ae..324dd4baf24 100644 --- a/sdk/resource/auto.go +++ b/sdk/resource/auto.go @@ -18,6 +18,7 @@ import ( "context" "errors" "fmt" + "strings" ) var ( @@ -45,28 +46,65 @@ type Detector interface { // Detect calls all input detectors sequentially and merges each result with the previous one. // It returns the merged error too. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { - var autoDetectedRes *Resource - var errInfo []string + r := new(Resource) + return r, detect(ctx, r, detectors) +} + +// detect runs all detectors using ctx and merges the result into res. This +// assumes res is allocated and not nil, it will panic otherwise. +func detect(ctx context.Context, res *Resource, detectors []Detector) error { + var ( + r *Resource + errs detectErrs + err error + ) + for _, detector := range detectors { if detector == nil { continue } - res, err := detector.Detect(ctx) + r, err = detector.Detect(ctx) if err != nil { - errInfo = append(errInfo, err.Error()) + errs = append(errs, err) if !errors.Is(err, ErrPartialResource) { continue } } - autoDetectedRes, err = Merge(autoDetectedRes, res) + r, err = Merge(res, r) if err != nil { - errInfo = append(errInfo, err.Error()) + errs = append(errs, err) } + *res = *r } - var aggregatedError error - if len(errInfo) > 0 { - aggregatedError = fmt.Errorf("detecting resources: %s", errInfo) + if len(errs) == 0 { + return nil + } + return errs +} + +type detectErrs []error + +func (e detectErrs) Error() string { + errStr := make([]string, len(e)) + for i, err := range e { + errStr[i] = fmt.Sprintf("* %s", err) } - return autoDetectedRes, aggregatedError + + format := "%d errors occurred detecting resource:\n\t%s" + return fmt.Sprintf(format, len(e), strings.Join(errStr, "\n\t")) +} + +func (e detectErrs) Unwrap() error { + switch len(e) { + case 0: + return nil + case 1: + return e[0] + } + return e[1:] +} + +func (e detectErrs) Is(target error) bool { + return len(e) != 0 && errors.Is(e[0], target) } diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index c425ff05db5..49958a9a60a 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -17,7 +17,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" - "fmt" "sync" "go.opentelemetry.io/otel" @@ -51,17 +50,8 @@ func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg = opt.apply(cfg) } - resource, err := Detect(ctx, cfg.detectors...) - - var err2 error - resource, err2 = Merge(resource, &Resource{schemaURL: cfg.schemaURL}) - if err == nil { - err = err2 - } else if err2 != nil { - err = fmt.Errorf("detecting resources: %s", []string{err.Error(), err2.Error()}) - } - - return resource, err + r := &Resource{schemaURL: cfg.schemaURL} + return r, detect(ctx, r, cfg.detectors) } // NewWithAttributes creates a resource from attrs and associates the resource with a diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 608d9e21e89..29803b143d0 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -452,6 +452,25 @@ func TestNew(t *testing.T) { } } +func TestNewWrapedError(t *testing.T) { + localErr := errors.New("local error") + _, err := resource.New( + context.Background(), + resource.WithDetectors( + resource.StringDetector("", "", func() (string, error) { + return "", localErr + }), + resource.StringDetector("", "", func() (string, error) { + return "", assert.AnError + }), + ), + ) + + assert.ErrorIs(t, err, localErr) + assert.ErrorIs(t, err, assert.AnError) + assert.NotErrorIs(t, err, errors.New("false positive error")) +} + func TestWithOSType(t *testing.T) { mockRuntimeProviders() t.Cleanup(restoreAttributesProviders) From 7dc7b30405d691c1778c9565764f90d0d4df90e4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 9 Mar 2023 07:33:18 -0800 Subject: [PATCH 448/886] Remove unneeded type argument from metric SDK (#3831) Co-authored-by: Chester Cheung --- sdk/metric/instrument.go | 4 ++-- sdk/metric/internal/histogram_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index e6ab97c9f94..33183d22ea9 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -219,7 +219,7 @@ var _ instrument.Float64ObservableGauge = float64Observable{} func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[float64]) float64Observable { return float64Observable{ - observable: newObservable[float64](scope, kind, name, desc, u, agg), + observable: newObservable(scope, kind, name, desc, u, agg), } } @@ -234,7 +234,7 @@ var _ instrument.Int64ObservableGauge = int64Observable{} func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[int64]) int64Observable { return int64Observable{ - observable: newObservable[int64](scope, kind, name, desc, u, agg), + observable: newObservable(scope, kind, name, desc, u, agg), } } diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index 57f04560a16..2a26270eafb 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -135,7 +135,7 @@ func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBu } func TestHistogramImmutableBounds(t *testing.T) { - t.Run("Delta", testHistImmutableBounds[int64]( + t.Run("Delta", testHistImmutableBounds( NewDeltaHistogram[int64], func(a Aggregator[int64]) []float64 { deltaH := a.(*deltaHistogram[int64]) @@ -143,7 +143,7 @@ func TestHistogramImmutableBounds(t *testing.T) { }, )) - t.Run("Cumulative", testHistImmutableBounds[int64]( + t.Run("Cumulative", testHistImmutableBounds( NewCumulativeHistogram[int64], func(a Aggregator[int64]) []float64 { cumuH := a.(*cumulativeHistogram[int64]) From e463505da73524b15f2b10a1904daa19d88eaf3d Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 9 Mar 2023 11:43:16 -0600 Subject: [PATCH 449/886] Reuse memory in metric pipelines (#3760) * Have pipelines reuse memory * truncate Metric slice * Apply suggestions from code review Co-authored-by: Tyler Yahn * Use rm pool on periodic shutdown. * zero out RM on ctx error * Update sdk/metric/pipeline.go Co-authored-by: Tyler Yahn * Apply suggestions from code review Co-authored-by: Peter Liu Co-authored-by: Tyler Yahn * Fix lint --------- Co-authored-by: Tyler Yahn Co-authored-by: Peter Liu Co-authored-by: Tyler Yahn --- sdk/metric/internal/reuse_slice.go | 24 ++++++++++++++++ sdk/metric/manual_reader.go | 5 ++-- sdk/metric/periodic_reader.go | 36 ++++++++++++++---------- sdk/metric/pipeline.go | 45 +++++++++++++++++------------- sdk/metric/pipeline_test.go | 19 ++++++++----- sdk/metric/reader.go | 8 +++--- sdk/metric/reader_test.go | 19 +++++++------ 7 files changed, 99 insertions(+), 57 deletions(-) create mode 100644 sdk/metric/internal/reuse_slice.go diff --git a/sdk/metric/internal/reuse_slice.go b/sdk/metric/internal/reuse_slice.go new file mode 100644 index 00000000000..9695492b0d1 --- /dev/null +++ b/sdk/metric/internal/reuse_slice.go @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" + +// ReuseSlice returns a zeroed view of slice if its capacity is greater than or +// equal to n. Otherwise, it returns a new []T with capacity equal to n. +func ReuseSlice[T any](slice []T, n int) []T { + if cap(slice) >= n { + return slice[:n] + } + return make([]T, n) +} diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index f9b405915fc..cc1072ce7ea 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -135,9 +135,8 @@ func (mr *manualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetr err := fmt.Errorf("manual reader: invalid producer: %T", p) return err } - // TODO (#3047): When produce is updated to accept output as param, pass rm. - rmTemp, err := ph.produce(ctx) - *rm = rmTemp + + err := ph.produce(ctx, rm) if err != nil { return err } diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 3ba93293bf7..5ae185f09e9 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -120,6 +120,10 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade flushCh: make(chan chan error), cancel: cancel, done: make(chan struct{}), + rmPool: sync.Pool{ + New: func() interface{} { + return &metricdata.ResourceMetrics{} + }}, } r.externalProducers.Store([]Producer{}) @@ -147,6 +151,8 @@ type periodicReader struct { done chan struct{} cancel context.CancelFunc shutdownOnce sync.Once + + rmPool sync.Pool } // Compile time check the periodicReader implements Reader and is comparable. @@ -214,11 +220,12 @@ func (r *periodicReader) aggregation(kind InstrumentKind) aggregation.Aggregatio // the SDK and exports it with r's exporter. func (r *periodicReader) collectAndExport(ctx context.Context) error { // TODO (#3047): Use a sync.Pool or persistent pointer instead of allocating rm every Collect. - rm := metricdata.ResourceMetrics{} - err := r.Collect(ctx, &rm) + rm := r.rmPool.Get().(*metricdata.ResourceMetrics) + err := r.Collect(ctx, rm) if err == nil { - err = r.export(ctx, rm) + err = r.export(ctx, *rm) } + r.rmPool.Put(rm) return err } @@ -233,15 +240,13 @@ func (r *periodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMet return errors.New("periodic reader: *metricdata.ResourceMetrics is nil") } // TODO (#3047): When collect is updated to accept output as param, pass rm. - rmTemp, err := r.collect(ctx, r.sdkProducer.Load()) - *rm = rmTemp - return err + return r.collect(ctx, r.sdkProducer.Load(), rm) } // collect unwraps p as a produceHolder and returns its produce results. -func (r *periodicReader) collect(ctx context.Context, p interface{}) (metricdata.ResourceMetrics, error) { +func (r *periodicReader) collect(ctx context.Context, p interface{}, rm *metricdata.ResourceMetrics) error { if p == nil { - return metricdata.ResourceMetrics{}, ErrReaderNotRegistered + return ErrReaderNotRegistered } ph, ok := p.(produceHolder) @@ -251,12 +256,12 @@ func (r *periodicReader) collect(ctx context.Context, p interface{}) (metricdata // happen, return an error instead of panicking so a users code does // not halt in the processes. err := fmt.Errorf("periodic reader: invalid producer: %T", p) - return metricdata.ResourceMetrics{}, err + return err } - rm, err := ph.produce(ctx) + err := ph.produce(ctx, rm) if err != nil { - return metricdata.ResourceMetrics{}, err + return err } var errs []error for _, producer := range r.externalProducers.Load().([]Producer) { @@ -266,7 +271,7 @@ func (r *periodicReader) collect(ctx context.Context, p interface{}) (metricdata } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } - return rm, unifyErrors(errs) + return unifyErrors(errs) } // export exports metric data m using r's exporter. @@ -313,11 +318,12 @@ func (r *periodicReader) Shutdown(ctx context.Context) error { if ph != nil { // Reader was registered. // Flush pending telemetry. - var m metricdata.ResourceMetrics - m, err = r.collect(ctx, ph) + m := r.rmPool.Get().(*metricdata.ResourceMetrics) + err = r.collect(ctx, ph, m) if err == nil { - err = r.export(ctx, m) + err = r.export(ctx, *m) } + r.rmPool.Put(m) } sErr := r.exporter.Shutdown(ctx) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 47a44fda71c..4cad3698dd0 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -121,7 +121,7 @@ func (p *pipeline) addMultiCallback(c multiCallback) (unregister func()) { // produce returns aggregated metrics from a single collection. // // This method is safe to call concurrently. -func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { +func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) error { p.Lock() defer p.Unlock() @@ -132,7 +132,9 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err errs.append(err) } if err := ctx.Err(); err != nil { - return metricdata.ResourceMetrics{}, err + rm.Resource = nil + rm.ScopeMetrics = rm.ScopeMetrics[:0] + return err } } for e := p.multiCallbacks.Front(); e != nil; e = e.Next() { @@ -143,36 +145,39 @@ func (p *pipeline) produce(ctx context.Context) (metricdata.ResourceMetrics, err } if err := ctx.Err(); err != nil { // This means the context expired before we finished running callbacks. - return metricdata.ResourceMetrics{}, err + rm.Resource = nil + rm.ScopeMetrics = rm.ScopeMetrics[:0] + return err } } - sm := make([]metricdata.ScopeMetrics, 0, len(p.aggregations)) + rm.Resource = p.resource + rm.ScopeMetrics = internal.ReuseSlice(rm.ScopeMetrics, len(p.aggregations)) + + i := 0 for scope, instruments := range p.aggregations { - metrics := make([]metricdata.Metrics, 0, len(instruments)) + rm.ScopeMetrics[i].Metrics = internal.ReuseSlice(rm.ScopeMetrics[i].Metrics, len(instruments)) + j := 0 for _, inst := range instruments { data := inst.aggregator.Aggregation() if data != nil { - metrics = append(metrics, metricdata.Metrics{ - Name: inst.name, - Description: inst.description, - Unit: inst.unit, - Data: data, - }) + rm.ScopeMetrics[i].Metrics[j].Name = inst.name + rm.ScopeMetrics[i].Metrics[j].Description = inst.description + rm.ScopeMetrics[i].Metrics[j].Unit = inst.unit + rm.ScopeMetrics[i].Metrics[j].Data = data + j++ } } - if len(metrics) > 0 { - sm = append(sm, metricdata.ScopeMetrics{ - Scope: scope, - Metrics: metrics, - }) + rm.ScopeMetrics[i].Metrics = rm.ScopeMetrics[i].Metrics[:j] + if len(rm.ScopeMetrics[i].Metrics) > 0 { + rm.ScopeMetrics[i].Scope = scope + i++ } } - return metricdata.ResourceMetrics{ - Resource: p.resource, - ScopeMetrics: sm, - }, errs.errorOrNil() + rm.ScopeMetrics = rm.ScopeMetrics[:i] + + return errs.errorOrNil() } // inserter facilitates inserting of new instruments from a single scope into a diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index c7e8d31f5ed..581ab595776 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -42,7 +42,8 @@ func (testSumAggregator) Aggregation() metricdata.Aggregation { func TestEmptyPipeline(t *testing.T) { pipe := &pipeline{} - output, err := pipe.produce(context.Background()) + output := metricdata.ResourceMetrics{} + err := pipe.produce(context.Background(), &output) require.NoError(t, err) assert.Nil(t, output.Resource) assert.Len(t, output.ScopeMetrics, 0) @@ -56,7 +57,7 @@ func TestEmptyPipeline(t *testing.T) { pipe.addMultiCallback(func(context.Context) error { return nil }) }) - output, err = pipe.produce(context.Background()) + err = pipe.produce(context.Background(), &output) require.NoError(t, err) assert.Nil(t, output.Resource) require.Len(t, output.ScopeMetrics, 1) @@ -66,7 +67,8 @@ func TestEmptyPipeline(t *testing.T) { func TestNewPipeline(t *testing.T) { pipe := newPipeline(nil, nil, nil) - output, err := pipe.produce(context.Background()) + output := metricdata.ResourceMetrics{} + err := pipe.produce(context.Background(), &output) require.NoError(t, err) assert.Equal(t, resource.Empty(), output.Resource) assert.Len(t, output.ScopeMetrics, 0) @@ -80,7 +82,7 @@ func TestNewPipeline(t *testing.T) { pipe.addMultiCallback(func(context.Context) error { return nil }) }) - output, err = pipe.produce(context.Background()) + err = pipe.produce(context.Background(), &output) require.NoError(t, err) assert.Equal(t, resource.Empty(), output.Resource) require.Len(t, output.ScopeMetrics, 1) @@ -91,7 +93,8 @@ func TestPipelineUsesResource(t *testing.T) { res := resource.NewWithAttributes("noSchema", attribute.String("test", "resource")) pipe := newPipeline(res, nil, nil) - output, err := pipe.produce(context.Background()) + output := metricdata.ResourceMetrics{} + err := pipe.produce(context.Background(), &output) assert.NoError(t, err) assert.Equal(t, res, output.Resource) } @@ -99,6 +102,7 @@ func TestPipelineUsesResource(t *testing.T) { func TestPipelineConcurrency(t *testing.T) { pipe := newPipeline(nil, nil, nil) ctx := context.Background() + var output metricdata.ResourceMetrics var wg sync.WaitGroup const threads = 2 @@ -106,7 +110,7 @@ func TestPipelineConcurrency(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - _, _ = pipe.produce(ctx) + _ = pipe.produce(ctx, &output) }() wg.Add(1) @@ -167,7 +171,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { a.Aggregate(1, *attribute.EmptySet()) } - out, err := test.pipe.produce(context.Background()) + out := metricdata.ResourceMetrics{} + err = test.pipe.produce(context.Background(), &out) require.NoError(t, err) require.Len(t, out.ScopeMetrics, 1, "Aggregator not registered with pipeline") sm := out.ScopeMetrics[0] diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 9d6972b53d8..3950ea6ecef 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -99,7 +99,7 @@ type sdkProducer interface { // produce returns aggregated metrics from a single collection. // // This method is safe to call concurrently. - produce(context.Context) (metricdata.ResourceMetrics, error) + produce(context.Context, *metricdata.ResourceMetrics) error } // Producer produces metrics for a Reader from an external source. @@ -113,15 +113,15 @@ type Producer interface { // produceHolder is used as an atomic.Value to wrap the non-concrete producer // type. type produceHolder struct { - produce func(context.Context) (metricdata.ResourceMetrics, error) + produce func(context.Context, *metricdata.ResourceMetrics) error } // shutdownProducer produces an ErrReaderShutdown error always. type shutdownProducer struct{} // produce returns an ErrReaderShutdown error. -func (p shutdownProducer) produce(context.Context) (metricdata.ResourceMetrics, error) { - return metricdata.ResourceMetrics{}, ErrReaderShutdown +func (p shutdownProducer) produce(context.Context, *metricdata.ResourceMetrics) error { + return ErrReaderShutdown } // TemporalitySelector selects the temporality to use based on the InstrumentKind. diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 85ddca62288..6c523cdf7a3 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -103,10 +103,11 @@ func (ts *readerTestSuite) TestMultipleForceFlush() { func (ts *readerTestSuite) TestMultipleRegister() { p0 := testSDKProducer{ - produceFunc: func(ctx context.Context) (metricdata.ResourceMetrics, error) { + produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { // Differentiate this producer from the second by returning an // error. - return testResourceMetricsA, assert.AnError + *rm = testResourceMetricsA + return assert.AnError }, } p1 := testSDKProducer{} @@ -144,8 +145,9 @@ func (ts *readerTestSuite) TestExternalProducerPartialSuccess() { func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { ts.Reader.register(testSDKProducer{ - produceFunc: func(ctx context.Context) (metricdata.ResourceMetrics, error) { - return metricdata.ResourceMetrics{}, assert.AnError + produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { + *rm = metricdata.ResourceMetrics{} + return assert.AnError }}) ts.Reader.RegisterProducer(testExternalProducer{}) @@ -252,14 +254,15 @@ var testResourceMetricsAB = metricdata.ResourceMetrics{ } type testSDKProducer struct { - produceFunc func(context.Context) (metricdata.ResourceMetrics, error) + produceFunc func(context.Context, *metricdata.ResourceMetrics) error } -func (p testSDKProducer) produce(ctx context.Context) (metricdata.ResourceMetrics, error) { +func (p testSDKProducer) produce(ctx context.Context, rm *metricdata.ResourceMetrics) error { if p.produceFunc != nil { - return p.produceFunc(ctx) + return p.produceFunc(ctx, rm) } - return testResourceMetricsA, nil + *rm = testResourceMetricsA + return nil } type testExternalProducer struct { From 6a95d5770c347859d7b71dc660361f875f3d44fb Mon Sep 17 00:00:00 2001 From: Peter Liu Date: Fri, 10 Mar 2023 03:41:47 +0800 Subject: [PATCH 450/886] New stdoutmetric encoder with ignore timestamp (#3828) * new stdoutmetric encoder with ignore timestamp Signed-off-by: Peter Liu * refactor to avoid using a dedicated encoder Signed-off-by: Peter Liu * remove useless encoder code Signed-off-by: Peter Liu * dont't change the original data Signed-off-by: Peter Liu * Update exporters/stdout/stdoutmetric/exporter.go Co-authored-by: Tyler Yahn * complete test data and add changelog entry Signed-off-by: Peter Liu * Move changelog entry to unreleased --------- Signed-off-by: Peter Liu Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 + exporters/stdout/stdoutmetric/config.go | 9 + exporters/stdout/stdoutmetric/encoder.go | 4 +- exporters/stdout/stdoutmetric/example_test.go | 209 +++++++++++++++++- exporters/stdout/stdoutmetric/exporter.go | 96 +++++++- 5 files changed, 318 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0676eecb15d..76f533a68e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) + ### Changed - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 60a76a0bbd5..9b62bde5083 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -27,6 +27,7 @@ type config struct { encoder *encoderHolder temporalitySelector metric.TemporalitySelector aggregationSelector metric.AggregationSelector + redactTimestamps bool } // newConfig creates a validated config configured with options. @@ -125,3 +126,11 @@ func (t aggregationSelectorOption) apply(c config) config { c.aggregationSelector = t.selector return c } + +// WithoutTimestamps sets all timestamps to zero in the output stream. +func WithoutTimestamps() Option { + return optionFunc(func(c config) config { + c.redactTimestamps = true + return c + }) +} diff --git a/exporters/stdout/stdoutmetric/encoder.go b/exporters/stdout/stdoutmetric/encoder.go index bb5c8c3f694..28439d74c38 100644 --- a/exporters/stdout/stdoutmetric/encoder.go +++ b/exporters/stdout/stdoutmetric/encoder.go @@ -14,7 +14,9 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" -import "errors" +import ( + "errors" +) // Encoder encodes and outputs OpenTelemetry metric data-types as human // readable text. diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 3ab5b45ea89..4137b6534b9 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -60,6 +60,23 @@ var ( }, }, }, + { + Name: "system.cpu.time", + Description: "Accumulated CPU time spent", + Unit: "s", + Data: metricdata.Sum[float64]{ + IsMonotonic: true, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[float64]{ + { + Attributes: attribute.NewSet(attribute.String("state", "user")), + StartTime: now, + Time: now.Add(1 * time.Second), + Value: 0.5, + }, + }, + }, + }, { Name: "latency", Description: "Time spend processing received requests", @@ -79,6 +96,20 @@ var ( }, }, }, + { + Name: "system.memory.usage", + Description: "Memory usage", + Unit: "By", + Data: metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("state", "used")), + Time: now.Add(1 * time.Second), + Value: 100, + }, + }, + }, + }, { Name: "temperature", Description: "CPU global temperature", @@ -103,7 +134,11 @@ func Example() { // Print with a JSON encoder that indents with two spaces. enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") - exp, err := stdoutmetric.New(stdoutmetric.WithEncoder(enc)) + + exp, err := stdoutmetric.New( + stdoutmetric.WithEncoder(enc), + stdoutmetric.WithoutTimestamps(), + ) if err != nil { panic(err) } @@ -116,10 +151,180 @@ func Example() { ctx := context.Background() // This is where the sdk would be used to create a Meter and from that - // instruments that would make measurments of your code. To simulate that + // instruments that would make measurements of your code. To simulate that // behavior, call export directly with mocked data. _ = exp.Export(ctx, mockData) // Ensure the periodic reader is cleaned up by shutting down the sdk. _ = sdk.Shutdown(ctx) + + //Output: + // { + // "Resource": [ + // { + // "Key": "service.name", + // "Value": { + // "Type": "STRING", + // "Value": "stdoutmetric-example" + // } + // } + // ], + // "ScopeMetrics": [ + // { + // "Scope": { + // "Name": "example", + // "Version": "v0.0.1", + // "SchemaURL": "" + // }, + // "Metrics": [ + // { + // "Name": "requests", + // "Description": "Number of requests received", + // "Unit": "1", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Value": 5 + // } + // ], + // "Temporality": "DeltaTemporality", + // "IsMonotonic": true + // } + // }, + // { + // "Name": "system.cpu.time", + // "Description": "Accumulated CPU time spent", + // "Unit": "s", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "state", + // "Value": { + // "Type": "STRING", + // "Value": "user" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Value": 0.5 + // } + // ], + // "Temporality": "CumulativeTemporality", + // "IsMonotonic": true + // } + // }, + // { + // "Name": "latency", + // "Description": "Time spend processing received requests", + // "Unit": "ms", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Count": 10, + // "Bounds": [ + // 1, + // 5, + // 10 + // ], + // "BucketCounts": [ + // 1, + // 3, + // 6, + // 0 + // ], + // "Min": {}, + // "Max": {}, + // "Sum": 57 + // } + // ], + // "Temporality": "DeltaTemporality" + // } + // }, + // { + // "Name": "system.memory.usage", + // "Description": "Memory usage", + // "Unit": "By", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "state", + // "Value": { + // "Type": "STRING", + // "Value": "used" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Value": 100 + // } + // ] + // } + // }, + // { + // "Name": "temperature", + // "Description": "CPU global temperature", + // "Unit": "cel(1 K)", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Value": 32.4 + // } + // ] + // } + // } + // ] + // } + // ] + // } + // { + // "Resource": [ + // { + // "Key": "service.name", + // "Value": { + // "Type": "STRING", + // "Value": "stdoutmetric-example" + // } + // } + // ], + // "ScopeMetrics": [] + // } } diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 77cad9e934e..e2d9b9a40a0 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -16,9 +16,12 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdout import ( "context" + "errors" + "fmt" "sync" "sync/atomic" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -32,6 +35,8 @@ type exporter struct { temporalitySelector metric.TemporalitySelector aggregationSelector metric.AggregationSelector + + redactTimestamps bool } // New returns a configured metric exporter. @@ -43,6 +48,7 @@ func New(options ...Option) (metric.Exporter, error) { exp := &exporter{ temporalitySelector: cfg.temporalitySelector, aggregationSelector: cfg.aggregationSelector, + redactTimestamps: cfg.redactTimestamps, } exp.encVal.Store(*cfg.encoder) return exp, nil @@ -64,7 +70,9 @@ func (e *exporter) Export(ctx context.Context, data metricdata.ResourceMetrics) default: // Context is still valid, continue. } - + if e.redactTimestamps { + data = redactTimestamps(data) + } return e.encVal.Load().(encoderHolder).Encode(data) } @@ -81,3 +89,89 @@ func (e *exporter) Shutdown(ctx context.Context) error { }) return ctx.Err() } + +func redactTimestamps(orig metricdata.ResourceMetrics) metricdata.ResourceMetrics { + rm := metricdata.ResourceMetrics{ + Resource: orig.Resource, + ScopeMetrics: make([]metricdata.ScopeMetrics, len(orig.ScopeMetrics)), + } + for i, sm := range orig.ScopeMetrics { + rm.ScopeMetrics[i] = metricdata.ScopeMetrics{ + Scope: sm.Scope, + Metrics: make([]metricdata.Metrics, len(sm.Metrics)), + } + for j, m := range sm.Metrics { + rm.ScopeMetrics[i].Metrics[j] = metricdata.Metrics{ + Name: m.Name, + Description: m.Description, + Unit: m.Unit, + Data: redactAggregationTimestamps(m.Data), + } + } + } + return rm +} + +var ( + errUnknownAggType = errors.New("unknown aggregation type") +) + +func redactAggregationTimestamps(orig metricdata.Aggregation) metricdata.Aggregation { + switch a := orig.(type) { + case metricdata.Sum[float64]: + return metricdata.Sum[float64]{ + Temporality: a.Temporality, + DataPoints: redactDataPointTimestamps(a.DataPoints), + IsMonotonic: a.IsMonotonic, + } + case metricdata.Sum[int64]: + return metricdata.Sum[int64]{ + Temporality: a.Temporality, + DataPoints: redactDataPointTimestamps(a.DataPoints), + IsMonotonic: a.IsMonotonic, + } + case metricdata.Gauge[float64]: + return metricdata.Gauge[float64]{ + DataPoints: redactDataPointTimestamps(a.DataPoints), + } + case metricdata.Gauge[int64]: + return metricdata.Gauge[int64]{ + DataPoints: redactDataPointTimestamps(a.DataPoints), + } + case metricdata.Histogram: + return metricdata.Histogram{ + Temporality: a.Temporality, + DataPoints: redactHistogramTimestamps(a.DataPoints), + } + default: + global.Error(errUnknownAggType, fmt.Sprintf("%T", a)) + return orig + } +} + +func redactHistogramTimestamps(hdp []metricdata.HistogramDataPoint) []metricdata.HistogramDataPoint { + out := make([]metricdata.HistogramDataPoint, len(hdp)) + for i, dp := range hdp { + out[i] = metricdata.HistogramDataPoint{ + Attributes: dp.Attributes, + Count: dp.Count, + Sum: dp.Sum, + Bounds: dp.Bounds, + BucketCounts: dp.BucketCounts, + Min: dp.Min, + Max: dp.Max, + } + } + return out +} + +func redactDataPointTimestamps[T int64 | float64](sdp []metricdata.DataPoint[T]) []metricdata.DataPoint[T] { + out := make([]metricdata.DataPoint[T], len(sdp)) + for i, dp := range sdp { + out[i] = metricdata.DataPoint[T]{ + Attributes: dp.Attributes, + Value: dp.Value, + } + } + return out +} From 4af35a97dd9889ee25b6662778b9fc51ffbc9aaa Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 13 Mar 2023 08:15:00 -0700 Subject: [PATCH 451/886] dependabot updates Mon Mar 13 14:52:37 UTC 2023 (#3867) Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlptrace/otlptracehttp Bump golang.org/x/tools from 0.6.0 to 0.7.0 in /internal/tools Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlpmetric Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/prometheus Bump google.golang.org/protobuf from 1.28.1 to 1.29.0 in /exporters/otlp/otlptrace Bump benchmark-action/github-action-benchmark from 1.15.0 to 1.16.2 --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- internal/tools/go.mod | 10 ++++----- internal/tools/go.sum | 22 +++++++++---------- 24 files changed, 49 insertions(+), 49 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index e42d733ffd8..4c4398070ce 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.29.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index b600339cf86..24298684b31 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -62,8 +62,8 @@ google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 68dd2f7377d..dc84dc1ea74 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.29.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 96ed0f25eab..1cc4ce4076a 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -409,8 +409,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index fe45ea26565..5383f3309ab 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -23,7 +23,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.29.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index efc191e53c4..520d4d53f8e 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/example/view/go.mod b/example/view/go.mod index 2504829596d..ccbe495c647 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/protobuf v1.29.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/view/go.sum b/example/view/go.sum index efc191e53c4..520d4d53f8e 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 8fad320d8c6..be954e629fc 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 84b59c09cf1..f0abc27047b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 3adc9217e0c..70d907aac93 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 84b59c09cf1..f0abc27047b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index c5a3fd38411..c6aecdf56e0 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 84b59c09cf1..f0abc27047b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e67c8958a02..c5802628a75 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 84b59c09cf1..f0abc27047b 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a5972805676..93867df3699 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 4eb0e2c27c4..b7ce4c4f1a7 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -418,8 +418,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 36c4cc474af..9b3927dcf55 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 18aadbd3d04..751c114b16b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -416,8 +416,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3dbac3cccd4..abab6e1a536 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 - google.golang.org/protobuf v1.28.1 + google.golang.org/protobuf v1.29.0 ) require ( diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 5ea7ae84afa..17eba6da907 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -467,8 +467,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 437df0bcb61..d0897ddeaf6 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.6.0 go.opentelemetry.io/build-tools/multimod v0.6.0 go.opentelemetry.io/build-tools/semconvgen v0.6.0 - golang.org/x/tools v0.6.0 + golang.org/x/tools v0.7.0 ) require ( @@ -192,12 +192,12 @@ require ( golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect - golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/mod v0.9.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + golang.org/x/text v0.8.0 // indirect + google.golang.org/protobuf v1.29.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 9a9cbd4cf79..4c5d6bc02f8 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -694,8 +694,8 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -741,8 +741,8 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -841,7 +841,7 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -853,8 +853,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -935,8 +935,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= -golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1031,8 +1031,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= +google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From b62eb2ca88dfccbffb729f2213a2146ee76dc34e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Mar 2023 11:19:28 -0700 Subject: [PATCH 452/886] Pool sortables used to create attribute sets (#3832) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Pool sortables used to create attribute sets * Move sync pool to attribute pkg * Add change to changelog * Fix comment * Apply suggestions from code review Co-authored-by: Peter Liu * Update sdk/metric/instrument.go Co-authored-by: Robert Pająk * Update comment based on feedback * Apply feedback --------- Co-authored-by: Peter Liu Co-authored-by: Robert Pająk --- CHANGELOG.md | 2 ++ attribute/set.go | 16 +++++++-- sdk/metric/instrument.go | 12 +++++-- sdk/metric/instrument_test.go | 62 +++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 sdk/metric/instrument_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f533a68e1..ae3747cc0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832) +- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) - The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) diff --git a/attribute/set.go b/attribute/set.go index 26be5983223..f9b6dc3f505 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -18,6 +18,7 @@ import ( "encoding/json" "reflect" "sort" + "sync" ) type ( @@ -62,6 +63,12 @@ var ( iface: [0]KeyValue{}, }, } + + // sortables is a pool of Sortables used to create Sets with a user does + // not provide one. + sortables = sync.Pool{ + New: func() interface{} { return new(Sortable) }, + } ) // EmptySet returns a reference to a Set with no elements. @@ -191,7 +198,9 @@ func NewSet(kvs ...KeyValue) Set { if len(kvs) == 0 { return empty() } - s, _ := NewSetWithSortableFiltered(kvs, new(Sortable), nil) + srt := sortables.Get().(*Sortable) + s, _ := NewSetWithSortableFiltered(kvs, srt, nil) + sortables.Put(srt) return s } @@ -218,7 +227,10 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { if len(kvs) == 0 { return empty(), nil } - return NewSetWithSortableFiltered(kvs, new(Sortable), filter) + srt := sortables.Get().(*Sortable) + s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) + sortables.Put(srt) + return s, filtered } // NewSetWithSortableFiltered returns a new Set. diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 33183d22ea9..92e2e3780ed 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -194,8 +194,12 @@ func (i *instrumentImpl[N]) aggregate(ctx context.Context, val N, attrs []attrib if err := ctx.Err(); err != nil { return } + // Do not use single attribute.Sortable and attribute.NewSetWithSortable, + // this method needs to be concurrent safe. Let the sync.Pool in the + // attribute package handle allocations of the Sortable. + s := attribute.NewSet(attrs...) for _, agg := range i.aggregators { - agg.Aggregate(val, attribute.NewSet(attrs...)) + agg.Aggregate(val, s) } } @@ -260,8 +264,12 @@ func newObservable[N int64 | float64](scope instrumentation.Scope, kind Instrume // observe records the val for the set of attrs. func (o *observable[N]) observe(val N, attrs []attribute.KeyValue) { + // Do not use single attribute.Sortable and attribute.NewSetWithSortable, + // this method needs to be concurrent safe. Let the sync.Pool in the + // attribute package handle allocations of the Sortable. + s := attribute.NewSet(attrs...) for _, agg := range o.aggregators { - agg.Aggregate(val, attribute.NewSet(attrs...)) + agg.Aggregate(val, s) } } diff --git a/sdk/metric/instrument_test.go b/sdk/metric/instrument_test.go new file mode 100644 index 00000000000..4315effbfd0 --- /dev/null +++ b/sdk/metric/instrument_test.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal" +) + +func BenchmarkInstrument(b *testing.B) { + attr := func(id int) []attribute.KeyValue { + return []attribute.KeyValue{ + attribute.String("user", "Alice"), + attribute.Bool("admin", true), + attribute.Int("id", id), + } + } + + b.Run("instrumentImpl/aggregate", func(b *testing.B) { + inst := instrumentImpl[int64]{aggregators: []internal.Aggregator[int64]{ + internal.NewLastValue[int64](), + internal.NewCumulativeSum[int64](true), + internal.NewDeltaSum[int64](true), + }} + ctx := context.Background() + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + inst.aggregate(ctx, int64(i), attr(i)) + } + }) + + b.Run("observable/observe", func(b *testing.B) { + o := observable[int64]{aggregators: []internal.Aggregator[int64]{ + internal.NewLastValue[int64](), + internal.NewCumulativeSum[int64](true), + internal.NewDeltaSum[int64](true), + }} + + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + o.observe(int64(i), attr(i)) + } + }) +} From 01b8f15a722a3eb92e0bb0cf6e7a60fcaa8831ce Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 14 Mar 2023 07:56:18 -0700 Subject: [PATCH 453/886] Add `Exemplar` to metricdata package (#3849) * Add Exemplar to metricdata pkg * Update histogram Aggregator * Update opencensus bridge * Update prometheus exporter * Update OTLP exporter * Update stdoutmetric exporter * Add changes to changelog * Update fail tests * Add tests for IgnoreExemplars * Fix merge --- CHANGELOG.md | 3 + bridge/opencensus/internal/ocmetric/metric.go | 8 +- .../internal/ocmetric/metric_test.go | 8 +- .../internal/transform/metricdata.go | 8 +- .../internal/transform/metricdata_test.go | 61 ++++- exporters/prometheus/exporter.go | 6 +- exporters/stdout/stdoutmetric/example_test.go | 4 +- exporters/stdout/stdoutmetric/exporter.go | 15 +- sdk/metric/internal/histogram.go | 12 +- sdk/metric/internal/histogram_test.go | 34 +-- sdk/metric/meter_test.go | 16 +- sdk/metric/metricdata/data.go | 42 ++- .../metricdata/metricdatatest/assertion.go | 66 +++-- .../metricdatatest/assertion_fail_test.go | 23 +- .../metricdatatest/assertion_test.go | 245 +++++++++++++++--- .../metricdata/metricdatatest/comparisons.go | 142 +++++++++- 16 files changed, 550 insertions(+), 143 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae3747cc0e8..b2a785180dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) +- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. + Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) ### Changed @@ -18,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832) - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) - The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) +- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) ### Removed diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index 40c2e3c361f..3869d318cfb 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -127,8 +127,8 @@ func convertNumberDataPoints[N int64 | float64](labelKeys []ocmetricdata.LabelKe // convertHistogram converts OpenCensus Distribution timeseries to an // OpenTelemetry Histogram aggregation. -func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Histogram, error) { - points := make([]metricdata.HistogramDataPoint, 0, len(ts)) +func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Histogram[float64], error) { + points := make([]metricdata.HistogramDataPoint[float64], 0, len(ts)) var errInfo []string for _, t := range ts { attrs, err := convertAttrs(labelKeys, t.LabelValues) @@ -152,7 +152,7 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time continue } // TODO: handle exemplars - points = append(points, metricdata.HistogramDataPoint{ + points = append(points, metricdata.HistogramDataPoint[float64]{ Attributes: attrs, StartTime: t.StartTime, Time: p.Time, @@ -167,7 +167,7 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time if len(errInfo) > 0 { aggregatedError = fmt.Errorf("%w: %v", errHistogramDataPoint, errInfo) } - return metricdata.Histogram{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, aggregatedError + return metricdata.Histogram[float64]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, aggregatedError } // convertBucketCounts converts from OpenCensus bucket counts to slice of uint64. diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index 7ee312a9f13..0cbb217f293 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -214,8 +214,8 @@ func TestConvertMetrics(t *testing.T) { Name: "foo.com/histogram-a", Description: "a testing histogram", Unit: "1", - Data: metricdata.Histogram{ - DataPoints: []metricdata.HistogramDataPoint{ + Data: metricdata.Histogram[float64]{ + DataPoints: []metricdata.HistogramDataPoint[float64]{ { Attributes: attribute.NewSet(attribute.KeyValue{ Key: attribute.Key("a"), @@ -387,9 +387,9 @@ func TestConvertMetrics(t *testing.T) { Name: "foo.com/histogram-a", Description: "a testing histogram", Unit: "1", - Data: metricdata.Histogram{ + Data: metricdata.Histogram[float64]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.HistogramDataPoint{}, + DataPoints: []metricdata.HistogramDataPoint[float64]{}, }, }, }, diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index d952f8b06be..9f0d049114e 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -95,7 +95,9 @@ func metric(m metricdata.Metrics) (*mpb.Metric, error) { out.Data, err = Sum[int64](a) case metricdata.Sum[float64]: out.Data, err = Sum[float64](a) - case metricdata.Histogram: + case metricdata.Histogram[int64]: + out.Data, err = Histogram(a) + case metricdata.Histogram[float64]: out.Data, err = Histogram(a) default: return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) @@ -155,7 +157,7 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number // Histogram returns an OTLP Metric_Histogram generated from h. An error is // returned with a partial Metric_Histogram if the temporality of h is // unknown. -func Histogram(h metricdata.Histogram) (*mpb.Metric_Histogram, error) { +func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { t, err := Temporality(h.Temporality) if err != nil { return nil, err @@ -170,7 +172,7 @@ func Histogram(h metricdata.Histogram) (*mpb.Metric_Histogram, error) { // HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated // from dPts. -func HistogramDataPoints(dPts []metricdata.HistogramDataPoint) []*mpb.HistogramDataPoint { +func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) for _, dPt := range dPts { sum := dPt.Sum diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 7852d9044cd..9ccc295cba2 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -52,7 +52,28 @@ var ( minA, maxA, sumA = 2.0, 4.0, 90.0 minB, maxB, sumB = 4.0, 150.0, 234.0 - otelHDP = []metricdata.HistogramDataPoint{{ + otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{{ + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }} + otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{{ Attributes: alice, StartTime: start, Time: end, @@ -96,14 +117,18 @@ var ( Max: &maxB, }} - otelHist = metricdata.Histogram{ + otelHistInt64 = metricdata.Histogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPInt64, + } + otelHistFloat64 = metricdata.Histogram[float64]{ Temporality: metricdata.DeltaTemporality, - DataPoints: otelHDP, + DataPoints: otelHDPFloat64, } invalidTemporality metricdata.Temporality - otelHistInvalid = metricdata.Histogram{ + otelHistInvalid = metricdata.Histogram[int64]{ Temporality: invalidTemporality, - DataPoints: otelHDP, + DataPoints: otelHDPInt64, } pbHist = &mpb.Histogram{ @@ -215,10 +240,16 @@ var ( Data: otelSumInvalid, }, { - Name: "histogram", + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistInt64, + }, + { + Name: "float64-histogram", Description: "Histogram", Unit: "1", - Data: otelHist, + Data: otelHistFloat64, }, { Name: "invalid-histogram", @@ -260,7 +291,13 @@ var ( Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, }, { - Name: "histogram", + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "float64-histogram", Description: "Histogram", Unit: "1", Data: &mpb.Metric_Histogram{Histogram: pbHist}, @@ -327,12 +364,16 @@ func TestTransformations(t *testing.T) { // errors deep inside the structs). // DataPoint types. - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDP)) + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) // Aggregations. - h, err := Histogram(otelHist) + h, err := Histogram(otelHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistFloat64) assert.NoError(t, err) assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) h, err = Histogram(otelHistInvalid) diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 1539062b501..21b5c41de62 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -155,7 +155,9 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { for _, m := range scopeMetrics.Metrics { switch v := m.Data.(type) { - case metricdata.Histogram: + case metricdata.Histogram[int64]: + addHistogramMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + case metricdata.Histogram[float64]: addHistogramMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) case metricdata.Sum[int64]: addSumMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) @@ -170,7 +172,7 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } } -func addHistogramMetric(ch chan<- prometheus.Metric, histogram metricdata.Histogram, m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { +func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars drop, help := validateMetrics(name, m.Description, dto.MetricType_HISTOGRAM.Enum(), mfs) if drop { diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 4137b6534b9..f6b41dd63a2 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -81,9 +81,9 @@ var ( Name: "latency", Description: "Time spend processing received requests", Unit: "ms", - Data: metricdata.Histogram{ + Data: metricdata.Histogram[float64]{ Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.HistogramDataPoint{ + DataPoints: []metricdata.HistogramDataPoint[float64]{ { Attributes: attribute.NewSet(attribute.String("server", "central")), StartTime: now, diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index e2d9b9a40a0..7db27e3eb0c 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -138,8 +138,13 @@ func redactAggregationTimestamps(orig metricdata.Aggregation) metricdata.Aggrega return metricdata.Gauge[int64]{ DataPoints: redactDataPointTimestamps(a.DataPoints), } - case metricdata.Histogram: - return metricdata.Histogram{ + case metricdata.Histogram[int64]: + return metricdata.Histogram[int64]{ + Temporality: a.Temporality, + DataPoints: redactHistogramTimestamps(a.DataPoints), + } + case metricdata.Histogram[float64]: + return metricdata.Histogram[float64]{ Temporality: a.Temporality, DataPoints: redactHistogramTimestamps(a.DataPoints), } @@ -149,10 +154,10 @@ func redactAggregationTimestamps(orig metricdata.Aggregation) metricdata.Aggrega } } -func redactHistogramTimestamps(hdp []metricdata.HistogramDataPoint) []metricdata.HistogramDataPoint { - out := make([]metricdata.HistogramDataPoint, len(hdp)) +func redactHistogramTimestamps[T int64 | float64](hdp []metricdata.HistogramDataPoint[T]) []metricdata.HistogramDataPoint[T] { + out := make([]metricdata.HistogramDataPoint[T], len(hdp)) for i, dp := range hdp { - out[i] = metricdata.HistogramDataPoint{ + out[i] = metricdata.HistogramDataPoint[T]{ Attributes: dp.Attributes, Count: dp.Count, Sum: dp.Sum, diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go index fb4f4d47db1..bb4372d64cb 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/histogram.go @@ -141,12 +141,12 @@ func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - h := metricdata.Histogram{ + h := metricdata.Histogram[N]{ Temporality: metricdata.DeltaTemporality, - DataPoints: make([]metricdata.HistogramDataPoint, 0, len(s.values)), + DataPoints: make([]metricdata.HistogramDataPoint[N], 0, len(s.values)), } for a, b := range s.values { - hdp := metricdata.HistogramDataPoint{ + hdp := metricdata.HistogramDataPoint[N]{ Attributes: a, StartTime: s.start, Time: t, @@ -204,9 +204,9 @@ func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - h := metricdata.Histogram{ + h := metricdata.Histogram[N]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: make([]metricdata.HistogramDataPoint, 0, len(s.values)), + DataPoints: make([]metricdata.HistogramDataPoint[N], 0, len(s.values)), } for a, b := range s.values { // The HistogramDataPoint field values returned need to be copies of @@ -217,7 +217,7 @@ func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { counts := make([]uint64, len(b.counts)) copy(counts, b.counts) - hdp := metricdata.HistogramDataPoint{ + hdp := metricdata.HistogramDataPoint[N]{ Attributes: a, StartTime: s.start, Time: t, diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index 2a26270eafb..e030ce5f2cb 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -49,31 +49,31 @@ func testHistogram[N int64 | float64](t *testing.T) { } incr := monoIncr - eFunc := deltaHistExpecter(incr) + eFunc := deltaHistExpecter[N](incr) t.Run("Delta", tester.Run(NewDeltaHistogram[N](histConf), incr, eFunc)) - eFunc = cumuHistExpecter(incr) + eFunc = cumuHistExpecter[N](incr) t.Run("Cumulative", tester.Run(NewCumulativeHistogram[N](histConf), incr, eFunc)) } -func deltaHistExpecter(incr setMap) expectFunc { - h := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} +func deltaHistExpecter[N int64 | float64](incr setMap) expectFunc { + h := metricdata.Histogram[N]{Temporality: metricdata.DeltaTemporality} return func(m int) metricdata.Aggregation { - h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(incr)) + h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint(a, float64(v), uint64(m))) + h.DataPoints = append(h.DataPoints, hPoint[N](a, float64(v), uint64(m))) } return h } } -func cumuHistExpecter(incr setMap) expectFunc { +func cumuHistExpecter[N int64 | float64](incr setMap) expectFunc { var cycle int - h := metricdata.Histogram{Temporality: metricdata.CumulativeTemporality} + h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} return func(m int) metricdata.Aggregation { cycle++ - h.DataPoints = make([]metricdata.HistogramDataPoint, 0, len(incr)) + h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint(a, float64(v), uint64(cycle*m))) + h.DataPoints = append(h.DataPoints, hPoint[N](a, float64(v), uint64(cycle*m))) } return h } @@ -81,11 +81,11 @@ func cumuHistExpecter(incr setMap) expectFunc { // hPoint returns an HistogramDataPoint that started and ended now with multi // number of measurements values v. It includes a min and max (set to v). -func hPoint(a attribute.Set, v float64, multi uint64) metricdata.HistogramDataPoint { +func hPoint[N int64 | float64](a attribute.Set, v float64, multi uint64) metricdata.HistogramDataPoint[N] { idx := sort.SearchFloat64s(bounds, v) counts := make([]uint64, len(bounds)+1) counts[idx] += multi - return metricdata.HistogramDataPoint{ + return metricdata.HistogramDataPoint[N]{ Attributes: a, StartTime: now(), Time: now(), @@ -128,7 +128,7 @@ func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBu assert.Equal(t, cpB, getBounds(a), "modifying the bounds argument should not change the bounds") a.Aggregate(5, alice) - hdp := a.Aggregation().(metricdata.Histogram).DataPoints[0] + hdp := a.Aggregation().(metricdata.Histogram[N]).DataPoints[0] hdp.Bounds[1] = 10 assert.Equal(t, cpB, getBounds(a), "modifying the Aggregation bounds should not change the bounds") } @@ -155,7 +155,7 @@ func TestHistogramImmutableBounds(t *testing.T) { func TestCumulativeHistogramImutableCounts(t *testing.T) { a := NewCumulativeHistogram[int64](histConf) a.Aggregate(5, alice) - hdp := a.Aggregation().(metricdata.Histogram).DataPoints[0] + hdp := a.Aggregation().(metricdata.Histogram[int64]).DataPoints[0] cumuH := a.(*cumulativeHistogram[int64]) require.Equal(t, hdp.BucketCounts, cumuH.values[alice].counts) @@ -173,8 +173,8 @@ func TestDeltaHistogramReset(t *testing.T) { assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) - expect := metricdata.Histogram{Temporality: metricdata.DeltaTemporality} - expect.DataPoints = []metricdata.HistogramDataPoint{hPoint(alice, 1, 1)} + expect := metricdata.Histogram[int64]{Temporality: metricdata.DeltaTemporality} + expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPoint[int64](alice, 1, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) // The attr set should be forgotten once Aggregations is called. @@ -183,7 +183,7 @@ func TestDeltaHistogramReset(t *testing.T) { // Aggregating another set should not affect the original (alice). a.Aggregate(1, bob) - expect.DataPoints = []metricdata.HistogramDataPoint{hPoint(bob, 1, 1)} + expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPoint[int64](bob, 1, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 31f291c06e2..83e8b9090eb 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -382,9 +382,9 @@ func TestMeterCreatesInstruments(t *testing.T) { }, want: metricdata.Metrics{ Name: "histogram", - Data: metricdata.Histogram{ + Data: metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.HistogramDataPoint{ + DataPoints: []metricdata.HistogramDataPoint[int64]{ { Attributes: attribute.Set{}, Count: 1, @@ -446,9 +446,9 @@ func TestMeterCreatesInstruments(t *testing.T) { }, want: metricdata.Metrics{ Name: "histogram", - Data: metricdata.Histogram{ + Data: metricdata.Histogram[float64]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.HistogramDataPoint{ + DataPoints: []metricdata.HistogramDataPoint[float64]{ { Attributes: attribute.Set{}, Count: 1, @@ -1124,8 +1124,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { }, wantMetric: metricdata.Metrics{ Name: "sfhistogram", - Data: metricdata.Histogram{ - DataPoints: []metricdata.HistogramDataPoint{ + Data: metricdata.Histogram[float64]{ + DataPoints: []metricdata.HistogramDataPoint[float64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, @@ -1206,8 +1206,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { }, wantMetric: metricdata.Metrics{ Name: "sihistogram", - Data: metricdata.Histogram{ - DataPoints: []metricdata.HistogramDataPoint{ + Data: metricdata.Histogram[int64]{ + DataPoints: []metricdata.HistogramDataPoint[int64]{ { Attributes: attribute.NewSet(attribute.String("foo", "bar")), Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index 8847fddcbc7..f474a2a617f 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -59,7 +59,8 @@ type Aggregation interface { // Gauge represents a measurement of the current value of an instrument. type Gauge[N int64 | float64] struct { - // DataPoints reprents individual aggregated measurements with unique Attributes. + // DataPoints are the individual aggregated measurements with unique + // Attributes. DataPoints []DataPoint[N] } @@ -67,7 +68,8 @@ func (Gauge[N]) privateAggregation() {} // Sum represents the sum of all measurements of values from an instrument. type Sum[N int64 | float64] struct { - // DataPoints reprents individual aggregated measurements with unique Attributes. + // DataPoints are the individual aggregated measurements with unique + // Attributes. DataPoints []DataPoint[N] // Temporality describes if the aggregation is reported as the change from the // last report time, or the cumulative changes since a fixed start time. @@ -89,21 +91,25 @@ type DataPoint[N int64 | float64] struct { Time time.Time `json:",omitempty"` // Value is the value of this data point. Value N + + // Exemplars is the sampled Exemplars collected during the timeseries. + Exemplars []Exemplar[N] `json:",omitempty"` } // Histogram represents the histogram of all measurements of values from an instrument. -type Histogram struct { - // DataPoints reprents individual aggregated measurements with unique Attributes. - DataPoints []HistogramDataPoint +type Histogram[N int64 | float64] struct { + // DataPoints are the individual aggregated measurements with unique + // Attributes. + DataPoints []HistogramDataPoint[N] // Temporality describes if the aggregation is reported as the change from the // last report time, or the cumulative changes since a fixed start time. Temporality Temporality } -func (Histogram) privateAggregation() {} +func (Histogram[N]) privateAggregation() {} // HistogramDataPoint is a single histogram data point in a timeseries. -type HistogramDataPoint struct { +type HistogramDataPoint[N int64 | float64] struct { // Attributes is the set of key value pairs that uniquely identify the // timeseries. Attributes attribute.Set @@ -126,6 +132,9 @@ type HistogramDataPoint struct { Max Extrema // Sum is the sum of the values recorded. Sum float64 + + // Exemplars is the sampled Exemplars collected during the timeseries. + Exemplars []Exemplar[N] `json:",omitempty"` } // Extrema is the minimum or maximum value of a dataset. @@ -144,3 +153,22 @@ func NewExtrema(v float64) Extrema { func (e Extrema) Value() (v float64, defined bool) { return e.value, e.valid } + +// Exemplar is a measurement sampled from a timeseries providing a typical +// example. +type Exemplar[N int64 | float64] struct { + // FilteredAttributes are the attributes recorded with the measurement but + // filtered out of the timeseries' aggregated data. + FilteredAttributes []attribute.KeyValue + // Time is the time when the measurement was recorded. + Time time.Time + // Value is the measured value. + Value N + // SpanID is the ID of the span that was active during the measurement. If + // no span was active or the span was not sampled this will be empty. + SpanID []byte `json:",omitempty"` + // TraceID is the ID of the trace the active span belonged to during the + // measurement. If no span was active or the span was not sampled this will + // be empty. + TraceID []byte `json:",omitempty"` +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index d1ad1e70195..ed58fdcba75 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -30,14 +30,18 @@ type Datatypes interface { metricdata.DataPoint[int64] | metricdata.Gauge[float64] | metricdata.Gauge[int64] | - metricdata.Histogram | - metricdata.HistogramDataPoint | + metricdata.Histogram[float64] | + metricdata.Histogram[int64] | + metricdata.HistogramDataPoint[float64] | + metricdata.HistogramDataPoint[int64] | metricdata.Extrema | metricdata.Metrics | metricdata.ResourceMetrics | metricdata.ScopeMetrics | metricdata.Sum[float64] | - metricdata.Sum[int64] + metricdata.Sum[int64] | + metricdata.Exemplar[float64] | + metricdata.Exemplar[int64] // Interface types are not allowed in union types, therefore the // Aggregation and Value type from metricdata are not included here. @@ -45,6 +49,15 @@ type Datatypes interface { type config struct { ignoreTimestamp bool + ignoreExemplars bool +} + +func newConfig(opts []Option) config { + var cfg config + for _, opt := range opts { + cfg = opt.apply(cfg) + } + return cfg } // Option allows for fine grain control over how AssertEqual operates. @@ -66,21 +79,30 @@ func IgnoreTimestamp() Option { }) } +// IgnoreExemplars disables checking if Exemplars are different. +func IgnoreExemplars() Option { + return fnOption(func(cfg config) config { + cfg.ignoreExemplars = true + return cfg + }) +} + // AssertEqual asserts that the two concrete data-types from the metricdata // package are equal. func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) bool { t.Helper() - cfg := config{} - for _, opt := range opts { - cfg = opt.apply(cfg) - } + cfg := newConfig(opts) // Generic types cannot be type asserted. Use an interface instead. aIface := interface{}(actual) var r []string switch e := interface{}(expected).(type) { + case metricdata.Exemplar[int64]: + r = equalExemplars(e, aIface.(metricdata.Exemplar[int64]), cfg) + case metricdata.Exemplar[float64]: + r = equalExemplars(e, aIface.(metricdata.Exemplar[float64]), cfg) case metricdata.DataPoint[int64]: r = equalDataPoints(e, aIface.(metricdata.DataPoint[int64]), cfg) case metricdata.DataPoint[float64]: @@ -89,10 +111,14 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) r = equalGauges(e, aIface.(metricdata.Gauge[int64]), cfg) case metricdata.Gauge[float64]: r = equalGauges(e, aIface.(metricdata.Gauge[float64]), cfg) - case metricdata.Histogram: - r = equalHistograms(e, aIface.(metricdata.Histogram), cfg) - case metricdata.HistogramDataPoint: - r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint), cfg) + case metricdata.Histogram[float64]: + r = equalHistograms(e, aIface.(metricdata.Histogram[float64]), cfg) + case metricdata.Histogram[int64]: + r = equalHistograms(e, aIface.(metricdata.Histogram[int64]), cfg) + case metricdata.HistogramDataPoint[float64]: + r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint[float64]), cfg) + case metricdata.HistogramDataPoint[int64]: + r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint[int64]), cfg) case metricdata.Extrema: r = equalExtrema(e, aIface.(metricdata.Extrema), cfg) case metricdata.Metrics: @@ -122,11 +148,7 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) func AssertAggregationsEqual(t *testing.T, expected, actual metricdata.Aggregation, opts ...Option) bool { t.Helper() - cfg := config{} - for _, opt := range opts { - cfg = opt.apply(cfg) - } - + cfg := newConfig(opts) if r := equalAggregations(expected, actual, cfg); len(r) > 0 { t.Error(r) return false @@ -141,6 +163,10 @@ func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute var reasons []string switch e := interface{}(actual).(type) { + case metricdata.Exemplar[int64]: + reasons = hasAttributesExemplars(e, attrs...) + case metricdata.Exemplar[float64]: + reasons = hasAttributesExemplars(e, attrs...) case metricdata.DataPoint[int64]: reasons = hasAttributesDataPoints(e, attrs...) case metricdata.DataPoint[float64]: @@ -153,11 +179,15 @@ func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute reasons = hasAttributesSum(e, attrs...) case metricdata.Sum[float64]: reasons = hasAttributesSum(e, attrs...) - case metricdata.HistogramDataPoint: + case metricdata.HistogramDataPoint[int64]: + reasons = hasAttributesHistogramDataPoints(e, attrs...) + case metricdata.HistogramDataPoint[float64]: reasons = hasAttributesHistogramDataPoints(e, attrs...) case metricdata.Extrema: // Nothing to check. - case metricdata.Histogram: + case metricdata.Histogram[int64]: + reasons = hasAttributesHistogram(e, attrs...) + case metricdata.Histogram[float64]: reasons = hasAttributesHistogram(e, attrs...) case metricdata.Metrics: reasons = hasAttributesMetrics(e, attrs...) diff --git a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go index 8d0ce4f3d48..61e41d72901 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_fail_test.go @@ -38,15 +38,19 @@ func TestFailAssertEqual(t *testing.T) { t.Run("ResourceMetrics", testFailDatatype(resourceMetricsA, resourceMetricsB)) t.Run("ScopeMetrics", testFailDatatype(scopeMetricsA, scopeMetricsB)) t.Run("Metrics", testFailDatatype(metricsA, metricsB)) - t.Run("Histogram", testFailDatatype(histogramA, histogramB)) + t.Run("HistogramInt64", testFailDatatype(histogramInt64A, histogramInt64B)) + t.Run("HistogramFloat64", testFailDatatype(histogramFloat64A, histogramFloat64B)) t.Run("SumInt64", testFailDatatype(sumInt64A, sumInt64B)) t.Run("SumFloat64", testFailDatatype(sumFloat64A, sumFloat64B)) t.Run("GaugeInt64", testFailDatatype(gaugeInt64A, gaugeInt64B)) t.Run("GaugeFloat64", testFailDatatype(gaugeFloat64A, gaugeFloat64B)) - t.Run("HistogramDataPoint", testFailDatatype(histogramDataPointA, histogramDataPointB)) + t.Run("HistogramDataPointInt64", testFailDatatype(histogramDataPointInt64A, histogramDataPointInt64B)) + t.Run("HistogramDataPointFloat64", testFailDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B)) t.Run("DataPointInt64", testFailDatatype(dataPointInt64A, dataPointInt64B)) t.Run("DataPointFloat64", testFailDatatype(dataPointFloat64A, dataPointFloat64B)) - + t.Run("ExemplarInt64", testFailDatatype(exemplarInt64A, exemplarInt64B)) + t.Run("ExemplarFloat64", testFailDatatype(exemplarFloat64A, exemplarFloat64B)) + t.Run("Extrema", testFailDatatype(minA, minB)) } func TestFailAssertAggregationsEqual(t *testing.T) { @@ -57,20 +61,23 @@ func TestFailAssertAggregationsEqual(t *testing.T) { AssertAggregationsEqual(t, sumFloat64A, sumFloat64B) AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64B) AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64B) - AssertAggregationsEqual(t, histogramA, histogramB) + AssertAggregationsEqual(t, histogramInt64A, histogramInt64B) + AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64B) } func TestFailAssertAttribute(t *testing.T) { + AssertHasAttributes(t, exemplarInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("B", true)) AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", false)) AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("B", true)) AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", false)) AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("B", true)) AssertHasAttributes(t, sumInt64A, attribute.Bool("A", false)) AssertHasAttributes(t, sumFloat64A, attribute.Bool("B", true)) - AssertHasAttributes(t, histogramDataPointA, attribute.Bool("A", false)) - AssertHasAttributes(t, histogramDataPointA, attribute.Bool("B", true)) - AssertHasAttributes(t, histogramA, attribute.Bool("A", false)) - AssertHasAttributes(t, histogramA, attribute.Bool("B", true)) + AssertHasAttributes(t, histogramDataPointInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, histogramDataPointFloat64A, attribute.Bool("B", true)) + AssertHasAttributes(t, histogramInt64A, attribute.Bool("A", false)) + AssertHasAttributes(t, histogramFloat64A, attribute.Bool("B", true)) AssertHasAttributes(t, metricsA, attribute.Bool("A", false)) AssertHasAttributes(t, metricsA, attribute.Bool("B", true)) AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", false)) diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index ffb3627bd42..285dec82451 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -30,53 +30,110 @@ var ( attrA = attribute.NewSet(attribute.Bool("A", true)) attrB = attribute.NewSet(attribute.Bool("B", true)) + fltrAttrA = []attribute.KeyValue{attribute.Bool("filter A", true)} + fltrAttrB = []attribute.KeyValue{attribute.Bool("filter B", true)} + startA = time.Now() startB = startA.Add(time.Millisecond) endA = startA.Add(time.Second) endB = startB.Add(time.Second) + spanIDA = []byte{0, 0, 0, 0, 0, 0, 0, 1} + spanIDB = []byte{0, 0, 0, 0, 0, 0, 0, 2} + traceIDA = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + traceIDB = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} + + exemplarInt64A = metricdata.Exemplar[int64]{ + FilteredAttributes: fltrAttrA, + Time: endA, + Value: -10, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64A = metricdata.Exemplar[float64]{ + FilteredAttributes: fltrAttrA, + Time: endA, + Value: -10.0, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarInt64B = metricdata.Exemplar[int64]{ + FilteredAttributes: fltrAttrB, + Time: endB, + Value: 12, + SpanID: spanIDB, + TraceID: traceIDB, + } + exemplarFloat64B = metricdata.Exemplar[float64]{ + FilteredAttributes: fltrAttrB, + Time: endB, + Value: 12.0, + SpanID: spanIDB, + TraceID: traceIDB, + } + exemplarInt64C = metricdata.Exemplar[int64]{ + FilteredAttributes: fltrAttrA, + Time: endB, + Value: -10, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64C = metricdata.Exemplar[float64]{ + FilteredAttributes: fltrAttrA, + Time: endB, + Value: -10.0, + SpanID: spanIDA, + TraceID: traceIDA, + } + dataPointInt64A = metricdata.DataPoint[int64]{ Attributes: attrA, StartTime: startA, Time: endA, Value: -1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, } dataPointFloat64A = metricdata.DataPoint[float64]{ Attributes: attrA, StartTime: startA, Time: endA, Value: -1.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, } dataPointInt64B = metricdata.DataPoint[int64]{ Attributes: attrB, StartTime: startB, Time: endB, Value: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, } dataPointFloat64B = metricdata.DataPoint[float64]{ Attributes: attrB, StartTime: startB, Time: endB, Value: 2.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, } dataPointInt64C = metricdata.DataPoint[int64]{ Attributes: attrA, StartTime: startB, Time: endB, Value: -1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, } dataPointFloat64C = metricdata.DataPoint[float64]{ Attributes: attrA, StartTime: startB, Time: endB, Value: -1.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } minA = metricdata.NewExtrema(-1.) minB, maxB = metricdata.NewExtrema(3.), metricdata.NewExtrema(99.) minC = metricdata.NewExtrema(-1.) - histogramDataPointA = metricdata.HistogramDataPoint{ + histogramDataPointInt64A = metricdata.HistogramDataPoint[int64]{ Attributes: attrA, StartTime: startA, Time: endA, @@ -85,8 +142,32 @@ var ( BucketCounts: []uint64{1, 1}, Min: minA, Sum: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + } + histogramDataPointFloat64A = metricdata.HistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 2, + Bounds: []float64{0, 10}, + BucketCounts: []uint64{1, 1}, + Min: minA, + Sum: 2, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + } + histogramDataPointInt64B = metricdata.HistogramDataPoint[int64]{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Count: 3, + Bounds: []float64{0, 10, 100}, + BucketCounts: []uint64{1, 1, 1}, + Max: maxB, + Min: minB, + Sum: 3, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, } - histogramDataPointB = metricdata.HistogramDataPoint{ + histogramDataPointFloat64B = metricdata.HistogramDataPoint[float64]{ Attributes: attrB, StartTime: startB, Time: endB, @@ -96,8 +177,9 @@ var ( Max: maxB, Min: minB, Sum: 3, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, } - histogramDataPointC = metricdata.HistogramDataPoint{ + histogramDataPointInt64C = metricdata.HistogramDataPoint[int64]{ Attributes: attrA, StartTime: startB, Time: endB, @@ -106,6 +188,18 @@ var ( BucketCounts: []uint64{1, 1}, Min: minC, Sum: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, + } + histogramDataPointFloat64C = metricdata.HistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Count: 2, + Bounds: []float64{0, 10}, + BucketCounts: []uint64{1, 1}, + Min: minC, + Sum: 2, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } gaugeInt64A = metricdata.Gauge[int64]{ @@ -158,17 +252,29 @@ var ( DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, } - histogramA = metricdata.Histogram{ + histogramInt64A = metricdata.Histogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64A}, + } + histogramFloat64A = metricdata.Histogram[float64]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.HistogramDataPoint{histogramDataPointA}, + DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64A}, } - histogramB = metricdata.Histogram{ + histogramInt64B = metricdata.Histogram[int64]{ Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.HistogramDataPoint{histogramDataPointB}, + DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64B}, } - histogramC = metricdata.Histogram{ + histogramFloat64B = metricdata.Histogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64B}, + } + histogramInt64C = metricdata.Histogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64C}, + } + histogramFloat64C = metricdata.Histogram[float64]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.HistogramDataPoint{histogramDataPointC}, + DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64C}, } metricsA = metricdata.Metrics{ @@ -224,7 +330,7 @@ func testDatatype[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { AssertEqual(t, a, a) AssertEqual(t, b, b) - r := f(a, b, config{}) + r := f(a, b, newConfig(nil)) assert.Greaterf(t, len(r), 0, "%v == %v", a, b) } } @@ -234,8 +340,20 @@ func testDatatypeIgnoreTime[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T AssertEqual(t, a, a) AssertEqual(t, b, b) - r := f(a, b, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", a, b) + c := newConfig([]Option{IgnoreTimestamp()}) + r := f(a, b, c) + assert.Len(t, r, 0, "unexpected inequality") + } +} + +func testDatatypeIgnoreExemplars[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { + return func(t *testing.T) { + AssertEqual(t, a, a) + AssertEqual(t, b, b) + + c := newConfig([]Option{IgnoreExemplars()}) + r := f(a, b, c) + assert.Len(t, r, 0, "unexpected inequality") } } @@ -243,30 +361,56 @@ func TestAssertEqual(t *testing.T) { t.Run("ResourceMetrics", testDatatype(resourceMetricsA, resourceMetricsB, equalResourceMetrics)) t.Run("ScopeMetrics", testDatatype(scopeMetricsA, scopeMetricsB, equalScopeMetrics)) t.Run("Metrics", testDatatype(metricsA, metricsB, equalMetrics)) - t.Run("Histogram", testDatatype(histogramA, histogramB, equalHistograms)) + t.Run("HistogramInt64", testDatatype(histogramInt64A, histogramInt64B, equalHistograms[int64])) + t.Run("HistogramFloat64", testDatatype(histogramFloat64A, histogramFloat64B, equalHistograms[float64])) t.Run("SumInt64", testDatatype(sumInt64A, sumInt64B, equalSums[int64])) t.Run("SumFloat64", testDatatype(sumFloat64A, sumFloat64B, equalSums[float64])) t.Run("GaugeInt64", testDatatype(gaugeInt64A, gaugeInt64B, equalGauges[int64])) t.Run("GaugeFloat64", testDatatype(gaugeFloat64A, gaugeFloat64B, equalGauges[float64])) - t.Run("HistogramDataPoint", testDatatype(histogramDataPointA, histogramDataPointB, equalHistogramDataPoints)) + t.Run("HistogramDataPointInt64", testDatatype(histogramDataPointInt64A, histogramDataPointInt64B, equalHistogramDataPoints[int64])) + t.Run("HistogramDataPointFloat64", testDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B, equalHistogramDataPoints[float64])) t.Run("DataPointInt64", testDatatype(dataPointInt64A, dataPointInt64B, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatype(dataPointFloat64A, dataPointFloat64B, equalDataPoints[float64])) t.Run("Extrema", testDatatype(minA, minB, equalExtrema)) + t.Run("ExemplarInt64", testDatatype(exemplarInt64A, exemplarInt64B, equalExemplars[int64])) + t.Run("ExemplarFloat64", testDatatype(exemplarFloat64A, exemplarFloat64B, equalExemplars[float64])) } func TestAssertEqualIgnoreTime(t *testing.T) { t.Run("ResourceMetrics", testDatatypeIgnoreTime(resourceMetricsA, resourceMetricsC, equalResourceMetrics)) t.Run("ScopeMetrics", testDatatypeIgnoreTime(scopeMetricsA, scopeMetricsC, equalScopeMetrics)) t.Run("Metrics", testDatatypeIgnoreTime(metricsA, metricsC, equalMetrics)) - t.Run("Histogram", testDatatypeIgnoreTime(histogramA, histogramC, equalHistograms)) + t.Run("HistogramInt64", testDatatypeIgnoreTime(histogramInt64A, histogramInt64C, equalHistograms[int64])) + t.Run("HistogramFloat64", testDatatypeIgnoreTime(histogramFloat64A, histogramFloat64C, equalHistograms[float64])) t.Run("SumInt64", testDatatypeIgnoreTime(sumInt64A, sumInt64C, equalSums[int64])) t.Run("SumFloat64", testDatatypeIgnoreTime(sumFloat64A, sumFloat64C, equalSums[float64])) t.Run("GaugeInt64", testDatatypeIgnoreTime(gaugeInt64A, gaugeInt64C, equalGauges[int64])) t.Run("GaugeFloat64", testDatatypeIgnoreTime(gaugeFloat64A, gaugeFloat64C, equalGauges[float64])) - t.Run("HistogramDataPoint", testDatatypeIgnoreTime(histogramDataPointA, histogramDataPointC, equalHistogramDataPoints)) + t.Run("HistogramDataPointInt64", testDatatypeIgnoreTime(histogramDataPointInt64A, histogramDataPointInt64C, equalHistogramDataPoints[int64])) + t.Run("HistogramDataPointFloat64", testDatatypeIgnoreTime(histogramDataPointFloat64A, histogramDataPointFloat64C, equalHistogramDataPoints[float64])) t.Run("DataPointInt64", testDatatypeIgnoreTime(dataPointInt64A, dataPointInt64C, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatypeIgnoreTime(dataPointFloat64A, dataPointFloat64C, equalDataPoints[float64])) t.Run("Extrema", testDatatypeIgnoreTime(minA, minC, equalExtrema)) + t.Run("ExemplarInt64", testDatatypeIgnoreTime(exemplarInt64A, exemplarInt64C, equalExemplars[int64])) + t.Run("ExemplarFloat64", testDatatypeIgnoreTime(exemplarFloat64A, exemplarFloat64C, equalExemplars[float64])) +} + +func TestAssertEqualIgnoreExemplars(t *testing.T) { + hdpInt64 := histogramDataPointInt64A + hdpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} + t.Run("HistogramDataPointInt64", testDatatypeIgnoreExemplars(histogramDataPointInt64A, hdpInt64, equalHistogramDataPoints[int64])) + + hdpFloat64 := histogramDataPointFloat64A + hdpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} + t.Run("HistogramDataPointFloat64", testDatatypeIgnoreExemplars(histogramDataPointFloat64A, hdpFloat64, equalHistogramDataPoints[float64])) + + dpInt64 := dataPointInt64A + dpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} + t.Run("DataPointInt64", testDatatypeIgnoreExemplars(dataPointInt64A, dpInt64, equalDataPoints[int64])) + + dpFloat64 := dataPointFloat64A + dpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} + t.Run("DataPointFloat64", testDatatypeIgnoreExemplars(dataPointFloat64A, dpFloat64, equalDataPoints[float64])) } type unknownAggregation struct { @@ -279,7 +423,8 @@ func TestAssertAggregationsEqual(t *testing.T) { AssertAggregationsEqual(t, sumFloat64A, sumFloat64A) AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64A) AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64A) - AssertAggregationsEqual(t, histogramA, histogramA) + AssertAggregationsEqual(t, histogramInt64A, histogramInt64A) + AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64A) r := equalAggregations(sumInt64A, nil, config{}) assert.Len(t, r, 1, "should return nil comparison mismatch only") @@ -291,46 +436,56 @@ func TestAssertAggregationsEqual(t *testing.T) { assert.Len(t, r, 1, "should return with unknown aggregation only") r = equalAggregations(sumInt64A, sumInt64B, config{}) - assert.Greaterf(t, len(r), 0, "%v == %v", sumInt64A, sumInt64B) + assert.Greaterf(t, len(r), 0, "sums should not be equal: %v == %v", sumInt64A, sumInt64B) r = equalAggregations(sumInt64A, sumInt64C, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", sumInt64A, sumInt64C) + assert.Len(t, r, 0, "sums should be equal: %v", r) r = equalAggregations(sumFloat64A, sumFloat64B, config{}) - assert.Greaterf(t, len(r), 0, "%v == %v", sumFloat64A, sumFloat64B) + assert.Greaterf(t, len(r), 0, "sums should not be equal: %v == %v", sumFloat64A, sumFloat64B) r = equalAggregations(sumFloat64A, sumFloat64C, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", sumFloat64A, sumFloat64C) + assert.Len(t, r, 0, "sums should be equal: %v", r) r = equalAggregations(gaugeInt64A, gaugeInt64B, config{}) - assert.Greaterf(t, len(r), 0, "%v == %v", gaugeInt64A, gaugeInt64B) + assert.Greaterf(t, len(r), 0, "gauges should not be equal: %v == %v", gaugeInt64A, gaugeInt64B) r = equalAggregations(gaugeInt64A, gaugeInt64C, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", gaugeInt64A, gaugeInt64C) + assert.Len(t, r, 0, "gauges should be equal: %v", r) r = equalAggregations(gaugeFloat64A, gaugeFloat64B, config{}) - assert.Greaterf(t, len(r), 0, "%v == %v", gaugeFloat64A, gaugeFloat64B) + assert.Greaterf(t, len(r), 0, "gauges should not be equal: %v == %v", gaugeFloat64A, gaugeFloat64B) r = equalAggregations(gaugeFloat64A, gaugeFloat64C, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", gaugeFloat64A, gaugeFloat64C) + assert.Len(t, r, 0, "gauges should be equal: %v", r) + + r = equalAggregations(histogramInt64A, histogramInt64B, config{}) + assert.Greaterf(t, len(r), 0, "histograms should not be equal: %v == %v", histogramInt64A, histogramInt64B) + + r = equalAggregations(histogramInt64A, histogramInt64C, config{ignoreTimestamp: true}) + assert.Len(t, r, 0, "histograms should be equal: %v", r) - r = equalAggregations(histogramA, histogramB, config{}) - assert.Greaterf(t, len(r), 0, "%v == %v", histogramA, histogramB) + r = equalAggregations(histogramFloat64A, histogramFloat64B, config{}) + assert.Greaterf(t, len(r), 0, "histograms should not be equal: %v == %v", histogramFloat64A, histogramFloat64B) - r = equalAggregations(histogramA, histogramC, config{ignoreTimestamp: true}) - assert.Equalf(t, len(r), 0, "%v == %v", histogramA, histogramC) + r = equalAggregations(histogramFloat64A, histogramFloat64C, config{ignoreTimestamp: true}) + assert.Len(t, r, 0, "histograms should be equal: %v", r) } func TestAssertAttributes(t *testing.T) { AssertHasAttributes(t, minA, attribute.Bool("A", true)) // No-op, always pass. + AssertHasAttributes(t, exemplarInt64A, attribute.Bool("filter A", true)) + AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("filter A", true)) AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", true)) AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("A", true)) AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", true)) AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("A", true)) AssertHasAttributes(t, sumInt64A, attribute.Bool("A", true)) AssertHasAttributes(t, sumFloat64A, attribute.Bool("A", true)) - AssertHasAttributes(t, histogramDataPointA, attribute.Bool("A", true)) - AssertHasAttributes(t, histogramA, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramDataPointInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramDataPointFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, histogramFloat64A, attribute.Bool("A", true)) AssertHasAttributes(t, metricsA, attribute.Bool("A", true)) AssertHasAttributes(t, scopeMetricsA, attribute.Bool("A", true)) AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", true)) @@ -343,8 +498,10 @@ func TestAssertAttributes(t *testing.T) { assert.Equal(t, len(r), 0, "sumInt64A has A=True") r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", true)) assert.Equal(t, len(r), 0, "sumFloat64A has A=True") - r = hasAttributesAggregation(histogramA, attribute.Bool("A", true)) - assert.Equal(t, len(r), 0, "histogramA has A=True") + r = hasAttributesAggregation(histogramInt64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "histogramInt64A has A=True") + r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "histogramFloat64A has A=True") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have A=False") @@ -354,8 +511,10 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "sumInt64A does not have A=False") r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "sumFloat64A does not have A=False") - r = hasAttributesAggregation(histogramA, attribute.Bool("A", false)) - assert.Greater(t, len(r), 0, "histogramA does not have A=False") + r = hasAttributesAggregation(histogramInt64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "histogramInt64A does not have A=False") + r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "histogramFloat64A does not have A=False") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have Attribute B") @@ -365,22 +524,26 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "sumInt64A does not have Attribute B") r = hasAttributesAggregation(sumFloat64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "sumFloat64A does not have Attribute B") - r = hasAttributesAggregation(histogramA, attribute.Bool("B", true)) - assert.Greater(t, len(r), 0, "histogramA does not have Attribute B") + r = hasAttributesAggregation(histogramInt64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "histogramIntA does not have Attribute B") + r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "histogramFloatA does not have Attribute B") } func TestAssertAttributesFail(t *testing.T) { fakeT := &testing.T{} assert.False(t, AssertHasAttributes(fakeT, dataPointInt64A, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, dataPointFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, exemplarInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, exemplarFloat64A, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, gaugeInt64A, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, gaugeFloat64A, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, sumInt64A, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, sumFloat64A, attribute.Bool("B", true))) - assert.False(t, AssertHasAttributes(fakeT, histogramDataPointA, attribute.Bool("A", false))) - assert.False(t, AssertHasAttributes(fakeT, histogramDataPointA, attribute.Bool("B", true))) - assert.False(t, AssertHasAttributes(fakeT, histogramA, attribute.Bool("A", false))) - assert.False(t, AssertHasAttributes(fakeT, histogramA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, histogramDataPointInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, histogramDataPointFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, histogramInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, histogramFloat64A, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("A", false))) diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index a6bc83f6b7d..623dc3ae700 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -131,8 +131,14 @@ func equalAggregations(a, b metricdata.Aggregation, cfg config) (reasons []strin reasons = append(reasons, "Sum[float64] not equal:") reasons = append(reasons, r...) } - case metricdata.Histogram: - r := equalHistograms(v, b.(metricdata.Histogram), cfg) + case metricdata.Histogram[int64]: + r := equalHistograms(v, b.(metricdata.Histogram[int64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "Histogram not equal:") + reasons = append(reasons, r...) + } + case metricdata.Histogram[float64]: + r := equalHistograms(v, b.(metricdata.Histogram[float64]), cfg) if len(r) > 0 { reasons = append(reasons, "Histogram not equal:") reasons = append(reasons, r...) @@ -195,7 +201,7 @@ func equalSums[N int64 | float64](a, b metricdata.Sum[N], cfg config) (reasons [ // // The DataPoints each Histogram contains are compared based on containing the // same HistogramDataPoint, not the order they are stored in. -func equalHistograms(a, b metricdata.Histogram, cfg config) (reasons []string) { +func equalHistograms[N int64 | float64](a, b metricdata.Histogram[N], cfg config) (reasons []string) { if a.Temporality != b.Temporality { reasons = append(reasons, notEqualStr("Temporality", a.Temporality, b.Temporality)) } @@ -203,7 +209,7 @@ func equalHistograms(a, b metricdata.Histogram, cfg config) (reasons []string) { r := compareDiff(diffSlices( a.DataPoints, b.DataPoints, - func(a, b metricdata.HistogramDataPoint) bool { + func(a, b metricdata.HistogramDataPoint[N]) bool { r := equalHistogramDataPoints(a, b, cfg) return len(r) == 0 }, @@ -237,12 +243,26 @@ func equalDataPoints[N int64 | float64](a, b metricdata.DataPoint[N], cfg config if a.Value != b.Value { reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) } + + if !cfg.ignoreExemplars { + r := compareDiff(diffSlices( + a.Exemplars, + b.Exemplars, + func(a, b metricdata.Exemplar[N]) bool { + r := equalExemplars(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Exemplars not equal:\n%s", r)) + } + } return reasons } // equalHistogramDataPoints returns reasons HistogramDataPoints are not equal. // If they are equal, the returned reasons will be empty. -func equalHistogramDataPoints(a, b metricdata.HistogramDataPoint, cfg config) (reasons []string) { // nolint: revive // Intentional internal control flag +func equalHistogramDataPoints[N int64 | float64](a, b metricdata.HistogramDataPoint[N], cfg config) (reasons []string) { // nolint: revive // Intentional internal control flag if !a.Attributes.Equals(&b.Attributes) { reasons = append(reasons, notEqualStr( "Attributes", @@ -276,6 +296,19 @@ func equalHistogramDataPoints(a, b metricdata.HistogramDataPoint, cfg config) (r if a.Sum != b.Sum { reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) } + if !cfg.ignoreExemplars { + r := compareDiff(diffSlices( + a.Exemplars, + b.Exemplars, + func(a, b metricdata.Exemplar[N]) bool { + r := equalExemplars(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Exemplars not equal:\n%s", r)) + } + } return reasons } @@ -312,6 +345,82 @@ func eqExtrema(a, b metricdata.Extrema) bool { return aV == bV } +func equalKeyValue(a, b []attribute.KeyValue) bool { + // Comparison of []attribute.KeyValue as a comparable requires Go >= 1.20. + // To support Go < 1.20 use this function instead. + if len(a) != len(b) { + return false + } + for i, v := range a { + if v.Key != b[i].Key { + return false + } + if v.Value.Type() != b[i].Value.Type() { + return false + } + switch v.Value.Type() { + case attribute.BOOL: + if v.Value.AsBool() != b[i].Value.AsBool() { + return false + } + case attribute.INT64: + if v.Value.AsInt64() != b[i].Value.AsInt64() { + return false + } + case attribute.FLOAT64: + if v.Value.AsFloat64() != b[i].Value.AsFloat64() { + return false + } + case attribute.STRING: + if v.Value.AsString() != b[i].Value.AsString() { + return false + } + case attribute.BOOLSLICE: + if ok := equalSlices(v.Value.AsBoolSlice(), b[i].Value.AsBoolSlice()); !ok { + return false + } + case attribute.INT64SLICE: + if ok := equalSlices(v.Value.AsInt64Slice(), b[i].Value.AsInt64Slice()); !ok { + return false + } + case attribute.FLOAT64SLICE: + if ok := equalSlices(v.Value.AsFloat64Slice(), b[i].Value.AsFloat64Slice()); !ok { + return false + } + case attribute.STRINGSLICE: + if ok := equalSlices(v.Value.AsStringSlice(), b[i].Value.AsStringSlice()); !ok { + return false + } + default: + // We control all types passed to this, panic to signal developers + // early they changed things in an incompatible way. + panic(fmt.Sprintf("unknown attribute value type: %s", v.Value.Type())) + } + } + return true +} + +func equalExemplars[N int64 | float64](a, b metricdata.Exemplar[N], cfg config) (reasons []string) { + if !equalKeyValue(a.FilteredAttributes, b.FilteredAttributes) { + reasons = append(reasons, notEqualStr("FilteredAttributes", a.FilteredAttributes, b.FilteredAttributes)) + } + if !cfg.ignoreTimestamp { + if !a.Time.Equal(b.Time) { + reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) + } + } + if a.Value != b.Value { + reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + } + if !equalSlices(a.SpanID, b.SpanID) { + reasons = append(reasons, notEqualStr("SpanID", a.SpanID, b.SpanID)) + } + if !equalSlices(a.TraceID, b.TraceID) { + reasons = append(reasons, notEqualStr("TraceID", a.TraceID, b.TraceID)) + } + return reasons +} + func diffSlices[T any](a, b []T, equal func(T, T) bool) (extraA, extraB []T) { visited := make([]bool, len(b)) for i := 0; i < len(a); i++ { @@ -372,6 +481,21 @@ func missingAttrStr(name string) string { return fmt.Sprintf("missing attribute %s", name) } +func hasAttributesExemplars[T int64 | float64](exemplar metricdata.Exemplar[T], attrs ...attribute.KeyValue) (reasons []string) { + s := attribute.NewSet(exemplar.FilteredAttributes...) + for _, attr := range attrs { + val, ok := s.Value(attr.Key) + if !ok { + reasons = append(reasons, missingAttrStr(string(attr.Key))) + continue + } + if val != attr.Value { + reasons = append(reasons, notEqualStr(string(attr.Key), attr.Value.Emit(), val.Emit())) + } + } + return reasons +} + func hasAttributesDataPoints[T int64 | float64](dp metricdata.DataPoint[T], attrs ...attribute.KeyValue) (reasons []string) { for _, attr := range attrs { val, ok := dp.Attributes.Value(attr.Key) @@ -408,7 +532,7 @@ func hasAttributesSum[T int64 | float64](sum metricdata.Sum[T], attrs ...attribu return reasons } -func hasAttributesHistogramDataPoints(dp metricdata.HistogramDataPoint, attrs ...attribute.KeyValue) (reasons []string) { +func hasAttributesHistogramDataPoints[T int64 | float64](dp metricdata.HistogramDataPoint[T], attrs ...attribute.KeyValue) (reasons []string) { for _, attr := range attrs { val, ok := dp.Attributes.Value(attr.Key) if !ok { @@ -422,7 +546,7 @@ func hasAttributesHistogramDataPoints(dp metricdata.HistogramDataPoint, attrs .. return reasons } -func hasAttributesHistogram(histogram metricdata.Histogram, attrs ...attribute.KeyValue) (reasons []string) { +func hasAttributesHistogram[T int64 | float64](histogram metricdata.Histogram[T], attrs ...attribute.KeyValue) (reasons []string) { for n, dp := range histogram.DataPoints { reas := hasAttributesHistogramDataPoints(dp, attrs...) if len(reas) > 0 { @@ -443,7 +567,9 @@ func hasAttributesAggregation(agg metricdata.Aggregation, attrs ...attribute.Key reasons = hasAttributesSum(agg, attrs...) case metricdata.Sum[float64]: reasons = hasAttributesSum(agg, attrs...) - case metricdata.Histogram: + case metricdata.Histogram[int64]: + reasons = hasAttributesHistogram(agg, attrs...) + case metricdata.Histogram[float64]: reasons = hasAttributesHistogram(agg, attrs...) default: reasons = []string{fmt.Sprintf("unknown aggregation %T", agg)} From 9b398a63d7c8fae2f9ef818e32f1813af057c433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 14 Mar 2023 17:36:13 +0100 Subject: [PATCH 454/886] Update SIG meeting notes URL (#3869) Co-authored-by: Tyler Yahn --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a6928bfdff8..9c276ec0f64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ OpenTelemetry repo for information on this and other language SIGs. See the [public meeting -notes](https://docs.google.com/document/d/1A63zSWX0x2CyCK_LoNhmQC4rqhLpYXJzXbEPDUQ2n6w/edit#heading=h.9tngw7jdwd6b) +notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit) for a summary description of past meetings. To request edit access, join the meeting or get in touch on [Slack](https://cloud-native.slack.com/archives/C01NPAXACKT). From 0694868e556fb4a49acf88a67adda9cf8c8e3b5b Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Wed, 15 Mar 2023 09:11:15 -0700 Subject: [PATCH 455/886] dependabot updates Wed Mar 15 14:54:57 UTC 2023 (#3885) Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/prometheus Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /internal/tools Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlpmetric Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /example/otel-collector Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /example/prometheus Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /example/view Bump google.golang.org/protobuf from 1.29.0 to 1.29.1 in /bridge/opentracing/test Bump benchmark-action/github-action-benchmark from 1.15.0 to 1.16.2 --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 24 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 4c4398070ce..807f748d87f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.29.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 24298684b31..a9c87dbea31 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -62,8 +62,8 @@ google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index dc84dc1ea74..3abfd2aecc1 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.29.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 1cc4ce4076a..be8060546b5 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -409,8 +409,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 5383f3309ab..15f8fb8c5e8 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -23,7 +23,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.29.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 520d4d53f8e..291846e4d7d 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/example/view/go.mod b/example/view/go.mod index ccbe495c647..213ea657f13 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.29.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/view/go.sum b/example/view/go.sum index 520d4d53f8e..291846e4d7d 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index be954e629fc..936a626e43c 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index f0abc27047b..63599b69351 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 70d907aac93..54e0466014e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index f0abc27047b..63599b69351 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index c6aecdf56e0..b4cdc04e2fc 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index f0abc27047b..63599b69351 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index c5802628a75..79f90bc6f91 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index f0abc27047b..63599b69351 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 93867df3699..253bd545eaa 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index b7ce4c4f1a7..428864eca5b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -418,8 +418,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 9b3927dcf55..922d764e86b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 751c114b16b..41d17e3b31c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -416,8 +416,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index abab6e1a536..8d183b81b2c 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 - google.golang.org/protobuf v1.29.0 + google.golang.org/protobuf v1.29.1 ) require ( diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 17eba6da907..2ceb6fdd9c7 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -467,8 +467,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index d0897ddeaf6..3c08c77b59a 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -197,7 +197,7 @@ require ( golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/protobuf v1.29.0 // indirect + google.golang.org/protobuf v1.29.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4c5d6bc02f8..c51ecc9aec2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1031,8 +1031,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.0 h1:44S3JjaKmLEE4YIkjzexaP+NzZsudE3Zin5Njn/pYX0= -google.golang.org/protobuf v1.29.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 3a40e65a38db12d8d1b1a313ff78b27452b2accc Mon Sep 17 00:00:00 2001 From: Mori <190567268@qq.com> Date: Thu, 16 Mar 2023 00:52:04 +0800 Subject: [PATCH 456/886] Update go directive value in go.mod files to 1.19 (#3850) * remove go 1.18 in go.mod, add go 1.19 * revert //+build directives * remove +build directives --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- Makefile | 2 +- bridge/opencensus/go.mod | 2 +- bridge/opencensus/metric.go | 3 --- bridge/opencensus/test/go.mod | 2 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/test/go.mod | 2 +- example/fib/go.mod | 2 +- example/jaeger/go.mod | 2 +- example/namedtracer/go.mod | 2 +- example/opencensus/go.mod | 2 +- example/otel-collector/go.mod | 2 +- example/passthrough/go.mod | 2 +- example/prometheus/go.mod | 2 +- example/view/go.mod | 2 +- example/zipkin/go.mod | 2 +- exporters/jaeger/go.mod | 2 +- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/prometheus/go.mod | 2 +- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/zipkin/go.mod | 2 +- go.mod | 2 +- internal/tools/go.mod | 2 +- metric/go.mod | 2 +- schema/go.mod | 2 +- sdk/go.mod | 2 +- sdk/metric/go.mod | 2 +- trace/go.mod | 2 +- 34 files changed, 33 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 0e6ffa284e1..91ead91b417 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ go-mod-tidy/%: DIR=$* go-mod-tidy/%: | crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy -compat=1.18 + && $(GO) mod tidy -compat=1.19 .PHONY: lint-modules lint-modules: go-mod-tidy diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d76fd2f2962..23afed8717b 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.8.2 diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 040dbdfeb8d..91bd539c97a 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build go1.18 -// +build go1.18 - package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" import ( diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index fa08d2ac53a..3c1f5cecea9 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus/test -go 1.18 +go 1.19 require ( go.opencensus.io v0.24.0 diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 0c7dcf53332..3aae6a5fd64 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing -go 1.18 +go 1.19 replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 807f748d87f..ccd92d85c8f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing/test -go 1.18 +go 1.19 replace go.opentelemetry.io/otel => ../../.. diff --git a/example/fib/go.mod b/example/fib/go.mod index f85936833c3..ebcd41898f9 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/fib -go 1.18 +go 1.19 require ( go.opentelemetry.io/otel v1.15.0-rc.1 diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 199ad3b64e6..e1ce757137b 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/jaeger -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 637b0fdd26b..70c717aac20 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/namedtracer -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index a4caac4741d..15bef4a21f7 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/opencensus -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 3abfd2aecc1..e6c9e0d5aab 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/otel-collector -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 4ef682f2b5b..b79d09fe464 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/passthrough -go 1.18 +go 1.19 require ( go.opentelemetry.io/otel v1.15.0-rc.1 diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 15f8fb8c5e8..9f570847704 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/prometheus -go 1.18 +go 1.19 require ( github.com/prometheus/client_golang v1.14.0 diff --git a/example/view/go.mod b/example/view/go.mod index 213ea657f13..4dd01b52e9b 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/view -go 1.18 +go 1.19 require ( github.com/prometheus/client_golang v1.14.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 2cedff454ae..74075289662 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/zipkin -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../.. diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f5778fbc28f..bb80b66c47a 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/jaeger -go 1.18 +go 1.19 require ( github.com/go-logr/logr v1.2.3 diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 4a32afad8f9..c456132d467 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry -go 1.18 +go 1.19 require ( github.com/cenkalti/backoff/v4 v4.2.0 diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 936a626e43c..45c1f35996a 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric -go 1.18 +go 1.19 require ( github.com/google/go-cmp v0.5.9 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 54e0466014e..60303778980 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc -go 1.18 +go 1.19 retract v0.32.2 // Contains unresolvable dependencies. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b4cdc04e2fc..945303563fe 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp -go 1.18 +go 1.19 retract v0.32.2 // Contains unresolvable dependencies. diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 79f90bc6f91..d8dec5d8475 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace -go 1.18 +go 1.19 require ( github.com/google/go-cmp v0.5.9 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 253bd545eaa..0ea05d31597 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.8.2 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 922d764e86b..2155dd98668 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.8.2 diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 8d183b81b2c..ec6b2ef3351 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/prometheus -go 1.18 +go 1.19 require ( github.com/prometheus/client_golang v1.14.0 diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 9c6081c1a21..195f5126c3b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.8.2 diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 59a37f1c70d..741945fba49 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdouttrace -go 1.18 +go 1.19 replace ( go.opentelemetry.io/otel => ../../.. diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 82098ea9ab5..929c4c7a6d5 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/zipkin -go 1.18 +go 1.19 require ( github.com/go-logr/logr v1.2.3 diff --git a/go.mod b/go.mod index 9d20c7fc670..c04fd406a78 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel -go 1.18 +go 1.19 require ( github.com/go-logr/logr v1.2.3 diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 3c08c77b59a..eb6792c0b79 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/internal/tools -go 1.18 +go 1.19 require ( github.com/client9/misspell v0.3.4 diff --git a/metric/go.mod b/metric/go.mod index 0f674a3d66e..5fa0c60421a 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/metric -go 1.18 +go 1.19 require ( github.com/stretchr/testify v1.8.2 diff --git a/schema/go.mod b/schema/go.mod index 6f057a53e03..7ef42812200 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/schema -go 1.18 +go 1.19 require ( github.com/Masterminds/semver/v3 v3.2.0 diff --git a/sdk/go.mod b/sdk/go.mod index ca0e82b8dc3..770e426aa34 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk -go 1.18 +go 1.19 replace go.opentelemetry.io/otel => ../ diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 15491e08b9e..079bd3b1d92 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk/metric -go 1.18 +go 1.19 require ( github.com/go-logr/logr v1.2.3 diff --git a/trace/go.mod b/trace/go.mod index e7b52c0a3fe..8caad2f14f9 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/trace -go 1.18 +go 1.19 replace go.opentelemetry.io/otel => ../ From 7fc24d2b14d36da30888d00beaa964564528f5b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinan=20=C3=9Clker?= Date: Thu, 16 Mar 2023 18:58:43 +0100 Subject: [PATCH 457/886] Update the metric `Export` interface to accept a `*ResourceMetrics` instead of `ResourceMetrics` (#3853) * Change the signature of Export method * Pass tests for otlp exporter * Pass tests for otlp grpc and http packages * Update opencensus bridge * Refactor and pass tests for stdoutmetric package * Update periodic reader tests * Update changelog * Apply suggestions * Apply suggestions * Update CHANGELOG.md --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + bridge/opencensus/metric.go | 2 +- bridge/opencensus/metric_test.go | 4 +-- .../otlp/otlpmetric/internal/exporter.go | 2 +- .../otlp/otlpmetric/internal/exporter_test.go | 2 +- .../internal/transform/metricdata.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 6 ++--- .../otlpmetric/otlpmetrichttp/client_test.go | 16 ++++++------ exporters/stdout/stdoutmetric/example_test.go | 4 +-- exporters/stdout/stdoutmetric/exporter.go | 26 +++++-------------- .../stdout/stdoutmetric/exporter_test.go | 4 +-- sdk/metric/exporter.go | 2 +- sdk/metric/periodic_reader.go | 6 ++--- sdk/metric/periodic_reader_test.go | 14 +++++----- 15 files changed, 41 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2a785180dd..df905f7b94f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833) - The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) - Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) +- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) ### Removed diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 91bd539c97a..870faa23670 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -85,7 +85,7 @@ func (e *exporter) ExportMetrics(ctx context.Context, ocmetrics []*ocmetricdata. if len(otelmetrics) == 0 { return nil } - return e.base.Export(ctx, metricdata.ResourceMetrics{ + return e.base.Export(ctx, &metricdata.ResourceMetrics{ Resource: e.res, ScopeMetrics: []metricdata.ScopeMetrics{ { diff --git a/bridge/opencensus/metric_test.go b/bridge/opencensus/metric_test.go index ed348901f4e..58c11aadc0a 100644 --- a/bridge/opencensus/metric_test.go +++ b/bridge/opencensus/metric_test.go @@ -278,9 +278,9 @@ type fakeExporter struct { err error } -func (f *fakeExporter) Export(ctx context.Context, data metricdata.ResourceMetrics) error { +func (f *fakeExporter) Export(ctx context.Context, data *metricdata.ResourceMetrics) error { if f.err == nil { - f.data = &data + f.data = data } return f.err } diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index c8db05e114b..828ee83c2bb 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -50,7 +50,7 @@ func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation } // Export transforms and transmits metric data to an OTLP receiver. -func (e *exporter) Export(ctx context.Context, rm metricdata.ResourceMetrics) error { +func (e *exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { otlpRm, err := transform.ResourceMetrics(rm) // Best effort upload of transformable metrics. e.clientMu.Lock() diff --git a/exporters/otlp/otlpmetric/internal/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go index 65c8e578c46..a9f250fbd7c 100644 --- a/exporters/otlp/otlpmetric/internal/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -60,7 +60,7 @@ func TestExporterClientConcurrency(t *testing.T) { const goroutines = 5 exp := New(&client{}) - rm := metricdata.ResourceMetrics{} + rm := new(metricdata.ResourceMetrics) ctx := context.Background() done := make(chan struct{}) diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 9f0d049114e..208e6087831 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -26,7 +26,7 @@ import ( // ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm // contains invalid ScopeMetrics, an error will be returned along with an OTLP // ResourceMetrics that contains partial OTLP ScopeMetrics. -func ResourceMetrics(rm metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { +func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { sms, err := ScopeMetrics(rm.ScopeMetrics) return &mpb.ResourceMetrics{ Resource: &rpb.Resource{ diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 9ccc295cba2..72693335cf4 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -345,7 +345,7 @@ var ( }, } - otelResourceMetrics = metricdata.ResourceMetrics{ + otelResourceMetrics = &metricdata.ResourceMetrics{ Resource: otelRes, ScopeMetrics: otelScopeMetrics, } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 91637530ada..0127811a5eb 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -165,7 +165,7 @@ func TestConfig(t *testing.T) { exp, coll := factoryFunc(nil, WithHeaders(headers)) t.Cleanup(coll.Shutdown) ctx := context.Background() - require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + require.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) // Ensure everything is flushed. require.NoError(t, exp.Shutdown(ctx)) @@ -187,7 +187,7 @@ func TestConfig(t *testing.T) { t.Cleanup(coll.Shutdown) ctx := context.Background() t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - err := exp.Export(ctx, metricdata.ResourceMetrics{}) + err := exp.Export(ctx, &metricdata.ResourceMetrics{}) assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) }) @@ -197,7 +197,7 @@ func TestConfig(t *testing.T) { exp, coll := factoryFunc(nil, WithDialOption(grpc.WithUserAgent(customerUserAgent))) t.Cleanup(coll.Shutdown) ctx := context.Background() - require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + require.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) // Ensure everything is flushed. require.NoError(t, exp.Shutdown(ctx)) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index e4c7dacc0f3..a92801e4c40 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -70,7 +70,7 @@ func TestConfig(t *testing.T) { exp, coll := factoryFunc("", nil, WithHeaders(headers)) ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) - require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + require.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) // Ensure everything is flushed. require.NoError(t, exp.Shutdown(ctx)) @@ -94,7 +94,7 @@ func TestConfig(t *testing.T) { // Push this after Shutdown so the HTTP server doesn't hang. t.Cleanup(func() { close(rCh) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - err := exp.Export(ctx, metricdata.ResourceMetrics{}) + err := exp.Export(ctx, &metricdata.ResourceMetrics{}) assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) }) @@ -103,7 +103,7 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) assert.Len(t, coll.Collect().Dump(), 1) }) @@ -133,7 +133,7 @@ func TestConfig(t *testing.T) { // Push this after Shutdown so the HTTP server doesn't hang. t.Cleanup(func() { close(rCh) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{}), "failed retry") + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{}), "failed retry") assert.Len(t, rCh, 0, "failed HTTP responses did not occur") }) @@ -144,7 +144,7 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) assert.Len(t, coll.Collect().Dump(), 1) }) @@ -155,7 +155,7 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) assert.Len(t, coll.Collect().Dump(), 1) }) @@ -166,7 +166,7 @@ func TestConfig(t *testing.T) { ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) assert.Len(t, coll.Collect().Dump(), 1) }) @@ -176,7 +176,7 @@ func TestConfig(t *testing.T) { exp, coll := factoryFunc("", nil, WithHeaders(headers)) ctx := context.Background() t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) - require.NoError(t, exp.Export(ctx, metricdata.ResourceMetrics{})) + require.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) // Ensure everything is flushed. require.NoError(t, exp.Shutdown(ctx)) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index f6b41dd63a2..0a55dced7d9 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -153,7 +153,7 @@ func Example() { // This is where the sdk would be used to create a Meter and from that // instruments that would make measurements of your code. To simulate that // behavior, call export directly with mocked data. - _ = exp.Export(ctx, mockData) + _ = exp.Export(ctx, &mockData) // Ensure the periodic reader is cleaned up by shutting down the sdk. _ = sdk.Shutdown(ctx) @@ -325,6 +325,6 @@ func Example() { // } // } // ], - // "ScopeMetrics": [] + // "ScopeMetrics": null // } } diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 7db27e3eb0c..06846203597 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -62,7 +62,7 @@ func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation return e.aggregationSelector(k) } -func (e *exporter) Export(ctx context.Context, data metricdata.ResourceMetrics) error { +func (e *exporter) Export(ctx context.Context, data *metricdata.ResourceMetrics) error { select { case <-ctx.Done(): // Don't do anything if the context has already timed out. @@ -71,7 +71,7 @@ func (e *exporter) Export(ctx context.Context, data metricdata.ResourceMetrics) // Context is still valid, continue. } if e.redactTimestamps { - data = redactTimestamps(data) + redactTimestamps(data) } return e.encVal.Load().(encoderHolder).Encode(data) } @@ -90,26 +90,14 @@ func (e *exporter) Shutdown(ctx context.Context) error { return ctx.Err() } -func redactTimestamps(orig metricdata.ResourceMetrics) metricdata.ResourceMetrics { - rm := metricdata.ResourceMetrics{ - Resource: orig.Resource, - ScopeMetrics: make([]metricdata.ScopeMetrics, len(orig.ScopeMetrics)), - } +func redactTimestamps(orig *metricdata.ResourceMetrics) { for i, sm := range orig.ScopeMetrics { - rm.ScopeMetrics[i] = metricdata.ScopeMetrics{ - Scope: sm.Scope, - Metrics: make([]metricdata.Metrics, len(sm.Metrics)), - } - for j, m := range sm.Metrics { - rm.ScopeMetrics[i].Metrics[j] = metricdata.Metrics{ - Name: m.Name, - Description: m.Description, - Unit: m.Unit, - Data: redactAggregationTimestamps(m.Data), - } + metrics := sm.Metrics + for j, m := range metrics { + data := m.Data + orig.ScopeMetrics[i].Metrics[j].Data = redactAggregationTimestamps(data) } } - return rm } var ( diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index a88180502b1..72feb08c2fb 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -83,7 +83,7 @@ func TestExporterHonorsContextErrors(t *testing.T) { exp, err := stdoutmetric.New(testEncoderOption()) require.NoError(t, err) return func(ctx context.Context) error { - var data metricdata.ResourceMetrics + data := new(metricdata.ResourceMetrics) return exp.Export(ctx, data) } })) @@ -91,7 +91,7 @@ func TestExporterHonorsContextErrors(t *testing.T) { func TestShutdownExporterReturnsShutdownErrorOnExport(t *testing.T) { var ( - data metricdata.ResourceMetrics + data = new(metricdata.ResourceMetrics) ctx = context.Background() exp, err = stdoutmetric.New(testEncoderOption()) ) diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 572662a3fcf..1333e5a06bc 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -49,7 +49,7 @@ type Exporter interface { // The passed ResourceMetrics may be reused when the call completes. If an // exporter needs to hold this data after it returns, it needs to make a // copy. - Export(context.Context, metricdata.ResourceMetrics) error + Export(context.Context, *metricdata.ResourceMetrics) error // ForceFlush flushes any metric data held by an exporter. // diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 5ae185f09e9..e32b05a9f6d 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -223,7 +223,7 @@ func (r *periodicReader) collectAndExport(ctx context.Context) error { rm := r.rmPool.Get().(*metricdata.ResourceMetrics) err := r.Collect(ctx, rm) if err == nil { - err = r.export(ctx, *rm) + err = r.export(ctx, rm) } r.rmPool.Put(rm) return err @@ -275,7 +275,7 @@ func (r *periodicReader) collect(ctx context.Context, p interface{}, rm *metricd } // export exports metric data m using r's exporter. -func (r *periodicReader) export(ctx context.Context, m metricdata.ResourceMetrics) error { +func (r *periodicReader) export(ctx context.Context, m *metricdata.ResourceMetrics) error { c, cancel := context.WithTimeout(ctx, r.timeout) defer cancel() return r.exporter.Export(c, m) @@ -321,7 +321,7 @@ func (r *periodicReader) Shutdown(ctx context.Context) error { m := r.rmPool.Get().(*metricdata.ResourceMetrics) err = r.collect(ctx, ph, m) if err == nil { - err = r.export(ctx, *m) + err = r.export(ctx, m) } r.rmPool.Put(m) } diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index a6b319e8abc..43c60bc7a93 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -152,7 +152,7 @@ func TestIntervalEnvAndOption(t *testing.T) { type fnExporter struct { temporalityFunc TemporalitySelector aggregationFunc AggregationSelector - exportFunc func(context.Context, metricdata.ResourceMetrics) error + exportFunc func(context.Context, *metricdata.ResourceMetrics) error flushFunc func(context.Context) error shutdownFunc func(context.Context) error } @@ -173,7 +173,7 @@ func (e *fnExporter) Aggregation(k InstrumentKind) aggregation.Aggregation { return DefaultAggregationSelector(k) } -func (e *fnExporter) Export(ctx context.Context, m metricdata.ResourceMetrics) error { +func (e *fnExporter) Export(ctx context.Context, m *metricdata.ResourceMetrics) error { if e.exportFunc != nil { return e.exportFunc(ctx, m) } @@ -204,7 +204,7 @@ func (ts *periodicReaderTestSuite) SetupTest() { ts.readerTestSuite.SetupTest() e := &fnExporter{ - exportFunc: func(context.Context, metricdata.ResourceMetrics) error { return assert.AnError }, + exportFunc: func(context.Context, *metricdata.ResourceMetrics) error { return assert.AnError }, flushFunc: func(context.Context) error { return assert.AnError }, shutdownFunc: func(context.Context) error { return assert.AnError }, } @@ -282,9 +282,9 @@ func TestPeriodicReaderRun(t *testing.T) { otel.SetErrorHandler(eh) exp := &fnExporter{ - exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { + exportFunc: func(_ context.Context, m *metricdata.ResourceMetrics) error { // The testSDKProducer produces testResourceMetricsAB. - assert.Equal(t, testResourceMetricsAB, m) + assert.Equal(t, testResourceMetricsAB, *m) return assert.AnError }, } @@ -307,9 +307,9 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { expFunc := func(t *testing.T) (exp Exporter, called *bool) { called = new(bool) return &fnExporter{ - exportFunc: func(_ context.Context, m metricdata.ResourceMetrics) error { + exportFunc: func(_ context.Context, m *metricdata.ResourceMetrics) error { // The testSDKProducer produces testResourceMetricsA. - assert.Equal(t, testResourceMetricsAB, m) + assert.Equal(t, testResourceMetricsAB, *m) *called = true return assert.AnError }, From 9215136863f80c18888729c0df3cf1dab36d7392 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 17 Mar 2023 11:40:22 -0700 Subject: [PATCH 458/886] Update "How to Get PRs Merged" section of CONTRIBUTING.md (#3868) * Update "How to Get PRs Merged" sec of CONTRIBUTING * Link to local approvers and maintainers --------- Co-authored-by: Damien Mathieu --- CONTRIBUTING.md | 85 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c276ec0f64..cbfc8f013c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,30 +94,58 @@ request ID to the entry you added to `CHANGELOG.md`. ### How to Get PRs Merged -A PR is considered to be **ready to merge** when: - -* It has received two approvals from Collaborators/Maintainers (at - different companies). This is not enforced through technical means - and a PR may be **ready to merge** with a single approval if the change - and its approach have been discussed and consensus reached. -* Feedback has been addressed. -* Any substantive changes to your PR will require that you clear any prior - Approval reviews, this includes changes resulting from other feedback. Unless - the approver explicitly stated that their approval will persist across - changes it should be assumed that the PR needs their review again. Other - project members (e.g. approvers, maintainers) can help with this if there are - any questions or if you forget to clear reviews. -* It has been open for review for at least one working day. This gives - people reasonable time to review. -* Trivial changes (typo, cosmetic, doc, etc.) do not have to wait for - one day and may be merged with a single Maintainer's approval. -* `CHANGELOG.md` has been updated to reflect what has been - added, changed, removed, or fixed. -* `README.md` has been updated if necessary. -* Urgent fix can take exception as long as it has been actively - communicated. - -Any Maintainer can merge the PR once it is **ready to merge**. +A PR is considered **ready to merge** when: + +* It has received two qualified approvals[^1]. + + This is not enforced through automation, but needs to be validated by the + maintainer merging. + * The qualified approvals need to be from [Approver]s/[Maintainer]s + affiliated with different companies. Two qualified approvals from + [Approver]s or [Maintainer]s affiliated with the same company counts as a + single qualified approval. + * PRs introducing changes that have already been discussed and consensus + reached only need one qualified approval. The discussion and resolution + needs to be linked to the PR. + * Trivial changes[^2] only need one qualified approval. + +* All feedback has been addressed. + * All PR comments and suggestions are resolved. + * All GitHub Pull Request reviews with a status of "Request changes" have + been addressed. Another review by the objecting reviewer with a different + status can be submitted to clear the original review, or the review can be + dismissed by a [Maintainer] when the issues from the original review have + been addressed. + * Any comments or reviews that cannot be resolved between the PR author and + reviewers can be submitted to the community [Approver]s and [Maintainer]s + during the weekly SIG meeting. If consensus is reached among the + [Approver]s and [Maintainer]s during the SIG meeting the objections to the + PR may be dismissed or resolved or the PR closed by a [Maintainer]. + * Any substantive changes to the PR require existing Approval reviews be + cleared unless the approver explicitly states that their approval persists + across changes. This includes changes resulting from other feedback. + [Approver]s and [Maintainer]s can help in clearing reviews and they should + be consulted if there are any questions. + +* The PR branch is up to date with the base branch it is merging into. + * To ensure this does not block the PR, it should be configured to allow + maintainers to update it. + +* It has been open for review for at least one working day. This gives people + reasonable time to review. + * Trivial changes[^2] do not have to wait for one day and may be merged with + a single [Maintainer]'s approval. + +* All required GitHub workflows have succeeded. +* Urgent fix can take exception as long as it has been actively communicated + among [Maintainer]s. + +Any [Maintainer] can merge the PR once the above criteria have been met. + +[^1]: A qualified approval is a GitHub Pull Request review with "Approve" + status from an OpenTelemetry Go [Approver] or [Maintainer]. +[^2]: Trivial changes include: typo corrections, cosmetic non-substantive + changes, documentation corrections or updates, dependency updates, etc. ## Design Choices @@ -500,7 +528,7 @@ interface that defines the specific functionality should be preferred. ## Approvers and Maintainers -Approvers: +### Approvers - [Evan Torrie](https://github.com/evantorrie), Verizon Media - [Josh MacDonald](https://github.com/jmacd), LightStep @@ -510,13 +538,13 @@ Approvers: - [Chester Cheung](https://github.com/hanyuancheung), Tencent - [Damien Mathieu](https://github.com/dmathieu), Elastic -Maintainers: +### Maintainers - [Aaron Clawson](https://github.com/MadVikingGod), LightStep - [Anthony Mirabella](https://github.com/Aneurysm9), AWS - [Tyler Yahn](https://github.com/MrAlias), Splunk -Emeritus: +### Emeritus - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep @@ -524,3 +552,6 @@ Emeritus: See the [community membership document in OpenTelemetry community repo](https://github.com/open-telemetry/community/blob/main/community-membership.md). + +[Approver]: #approvers +[Maintainer]: #maintainers From c276995621d15e2e7a61da2720a46b38114f45fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 Mar 2023 07:47:08 -0700 Subject: [PATCH 459/886] Bump actions/setup-go from 3 to 4 (#3901) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/dependabot.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5aabff3f3fb..1926474795e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Run benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f0c0d01c15..6dda2d66d48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -54,7 +54,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -77,7 +77,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo @@ -129,7 +129,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - name: Checkout code diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 26f71c3eb8e..6506a59f225 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version: 1.19 diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 36bf1f327a1..2de6b06d401 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '^1.20.0' - uses: evantorrie/mott-the-tidier@v1-beta From 4ccd59056982f34c3fcc8faef574f209b70d0f59 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 19 Mar 2023 07:58:22 -0700 Subject: [PATCH 460/886] dependabot updates Sun Mar 19 14:50:15 UTC 2023 (#3910) Bump github.com/golangci/golangci-lint from 1.51.2 to 1.52.0 in /internal/tools Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlpmetric Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 in /exporters/prometheus --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 +- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 +- example/view/go.mod | 2 +- example/view/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +- internal/tools/go.mod | 59 ++++---- internal/tools/go.sum | 134 +++++++++--------- 24 files changed, 128 insertions(+), 131 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index ccd92d85c8f..5534a012011 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index a9c87dbea31..7f0a8c2a444 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -62,8 +62,8 @@ google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e6c9e0d5aab..27d6738bb92 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index be8060546b5..bc61eaad2c4 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -409,8 +409,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 9f570847704..046b7f0420b 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -23,7 +23,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 291846e4d7d..b8f7d6fc360 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/example/view/go.mod b/example/view/go.mod index 4dd01b52e9b..871ed17bf9f 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/view/go.sum b/example/view/go.sum index 291846e4d7d..b8f7d6fc360 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -460,8 +460,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 45c1f35996a..2192fa7c0b5 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 63599b69351..3ad22fa3ef8 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 60303778980..700b48fe444 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 63599b69351..3ad22fa3ef8 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 945303563fe..b4803c6fc20 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 63599b69351..3ad22fa3ef8 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index d8dec5d8475..0f2c9ec0b8e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 63599b69351..3ad22fa3ef8 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -417,8 +417,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 0ea05d31597..e0a9ea52f93 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 428864eca5b..5931cc52587 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -418,8 +418,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 2155dd98668..7685395a4df 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/trace v1.15.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 41d17e3b31c..c15b86e7560 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -416,8 +416,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index ec6b2ef3351..2e5250e8808 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.1 go.opentelemetry.io/otel/sdk v1.15.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 ) require ( diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 2ceb6fdd9c7..a0d5b14a1f9 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -467,8 +467,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index eb6792c0b79..75aec828553 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.51.2 + github.com/golangci/golangci-lint v1.52.0 github.com/itchyny/gojq v0.12.12 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -19,9 +19,9 @@ require ( require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect - github.com/Abirdcfly/dupword v0.0.9 // indirect - github.com/Antonboom/errname v0.1.7 // indirect - github.com/Antonboom/nilnil v0.1.1 // indirect + github.com/Abirdcfly/dupword v0.0.11 // indirect + github.com/Antonboom/errname v0.1.9 // indirect + github.com/Antonboom/nilnil v0.1.3 // indirect github.com/BurntSushi/toml v1.2.1 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect @@ -32,37 +32,37 @@ require ( github.com/acomagu/bufpipe v1.0.3 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/ashanbrown/forbidigo v1.4.0 // indirect + github.com/ashanbrown/forbidigo v1.5.1 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bkielbasa/cyclop v1.2.0 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bombsimon/wsl/v3 v3.4.0 // indirect - github.com/breml/bidichk v0.2.3 // indirect - github.com/breml/errchkjson v0.3.0 // indirect + github.com/breml/bidichk v0.2.4 // indirect + github.com/breml/errchkjson v0.3.1 // indirect github.com/butuzov/ireturn v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/charithe/durationcheck v0.0.9 // indirect - github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect + github.com/charithe/durationcheck v0.0.10 // indirect + github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/cloudflare/circl v1.3.1 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.9.1 // indirect + github.com/daixiang0/gci v0.10.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.18.1 // indirect github.com/esimonov/ifshort v1.0.4 // indirect github.com/ettle/strcase v0.1.1 // indirect - github.com/fatih/color v1.14.1 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/fatih/structtag v1.2.0 // indirect github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.6.7 // indirect + github.com/go-critic/go-critic v0.7.0 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.4.0 // indirect github.com/go-git/go-git/v5 v5.5.2 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect - github.com/go-toolsmith/astcopy v1.0.3 // indirect + github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect github.com/go-toolsmith/astfmt v1.1.0 // indirect github.com/go-toolsmith/astp v1.1.0 // indirect @@ -100,11 +100,11 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect - github.com/junk1tm/musttag v0.4.5 // indirect + github.com/junk1tm/musttag v0.5.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect - github.com/kkHAIKE/contextcheck v1.1.3 // indirect + github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.6 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect @@ -114,35 +114,34 @@ require ( github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect - github.com/maratori/testpackage v1.1.0 // indirect - github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect + github.com/maratori/testpackage v1.1.1 // indirect + github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.2.5 // indirect + github.com/mgechev/revive v1.3.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moricho/tparallel v0.2.1 // indirect + github.com/moricho/tparallel v0.3.0 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.9.5 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.8.1 // indirect + github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.1.0 // indirect + github.com/polyfloyd/go-errorlint v1.4.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect - github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect + github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect @@ -158,7 +157,7 @@ require ( github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect github.com/skeema/knownhosts v1.1.0 // indirect - github.com/sonatard/noctx v0.0.1 // indirect + github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect @@ -172,11 +171,11 @@ require ( github.com/stretchr/testify v1.8.2 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect - github.com/tdakkota/asciicheck v0.1.1 // indirect + github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.11 // indirect github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect - github.com/timonwong/loggercheck v0.9.3 // indirect - github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect + github.com/timonwong/loggercheck v0.9.4 // indirect + github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.0.3 // indirect github.com/ultraware/whitespace v0.0.5 // indirect @@ -191,18 +190,18 @@ require ( go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect + golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.9.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/protobuf v1.29.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.2 // indirect + honnef.co/go/tools v0.4.3 // indirect mvdan.cc/gofumpt v0.4.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index c51ecc9aec2..fa64e7fdbbe 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -40,12 +40,12 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Abirdcfly/dupword v0.0.9 h1:MxprGjKq3yDBICXDgEEsyGirIXfMYXkLNT/agPsE1tk= -github.com/Abirdcfly/dupword v0.0.9/go.mod h1:PzmHVLLZ27MvHSzV7eFmMXSFArWXZPZmfuuziuUrf2g= -github.com/Antonboom/errname v0.1.7 h1:mBBDKvEYwPl4WFFNwec1CZO096G6vzK9vvDQzAwkako= -github.com/Antonboom/errname v0.1.7/go.mod h1:g0ONh16msHIPgJSGsecu1G/dcF2hlYR/0SddnIAGavU= -github.com/Antonboom/nilnil v0.1.1 h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q= -github.com/Antonboom/nilnil v0.1.1/go.mod h1:L1jBqoWM7AOeTD+tSquifKSesRHs4ZdaxvZR+xdJEaI= +github.com/Abirdcfly/dupword v0.0.11 h1:z6v8rMETchZXUIuHxYNmlUAuKuB21PeaSymTed16wgU= +github.com/Abirdcfly/dupword v0.0.11/go.mod h1:wH8mVGuf3CP5fsBTkfWwwwKTjDnVVCxtU8d8rgeVYXA= +github.com/Antonboom/errname v0.1.9 h1:BZDX4r3l4TBZxZ2o2LNrlGxSHran4d1u4veZdoORTT4= +github.com/Antonboom/errname v0.1.9/go.mod h1:nLTcJzevREuAsgTbG85UsuiWpMpAqbKD1HNZ29OzE58= +github.com/Antonboom/nilnil v0.1.3 h1:6RTbx3d2mcEu3Zwq9TowQpQMVpP75zugwOtqY1RTtcE= +github.com/Antonboom/nilnil v0.1.3/go.mod h1:iOov/7gRcXkeEU+EMGpBu2ORih3iyVEiWjeste1SJm8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -78,8 +78,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ashanbrown/forbidigo v1.4.0 h1:spdPbupaSqtWORq1Q4eHBoPBmHtwVyLKwaedbSLc5Sw= -github.com/ashanbrown/forbidigo v1.4.0/go.mod h1:IvgwB5Y4fzqSAj/WVXKWigoTkB0dzI2FBbpKWuh7ph8= +github.com/ashanbrown/forbidigo v1.5.1 h1:WXhzLjOlnuDYPYQo/eFlcFMi8X/kLfvWLYu6CSoebis= +github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -93,10 +93,10 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= -github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= -github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= -github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= -github.com/breml/errchkjson v0.3.0/go.mod h1:9Cogkyv9gcT8HREpzi3TiqBxCqDzo8awa92zSDFcofU= +github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= +github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= +github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= +github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= @@ -104,10 +104,10 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charithe/durationcheck v0.0.9 h1:mPP4ucLrf/rKZiIG/a9IPXHGlh8p4CzgpyTy6EEutYk= -github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6prSM8ap1UCpNKtgg= -github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 h1:cy5GCEZLUCshCGCRRUjxHrDUqkB4l5cuUt3ShEckQEo= -github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348/go.mod h1:f/miWtG3SSuTxKsNK3o58H1xl+XV6ZIfbC6p7lPPB8U= +github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= +github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= +github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= +github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -123,8 +123,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.9.1 h1:jBrwBmBZTDsGsXiaCTLIe9diotp1X4X64zodFrh7l+c= -github.com/daixiang0/gci v0.9.1/go.mod h1:EpVfrztufwVgQRXjnX4zuNinEpLj5OmMjtu/+MB0V0c= +github.com/daixiang0/gci v0.10.1 h1:eheNA3ljF6SxnPD/vE4lCBusVHmV3Rs3dkKvFrJ7MR0= +github.com/daixiang0/gci v0.10.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -142,8 +142,8 @@ github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStB github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= -github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w= -github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= @@ -155,8 +155,8 @@ github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= -github.com/go-critic/go-critic v0.6.7 h1:1evPrElnLQ2LZtJfmNDzlieDhjnq36SLgNzisx06oPM= -github.com/go-critic/go-critic v0.6.7/go.mod h1:fYZUijFdcnxgx6wPjQA2QEjIRaNCT0gO8bhexy6/QmE= +github.com/go-critic/go-critic v0.7.0 h1:tqbKzB8pqi0NsRZ+1pyU4aweAF7A7QN0Pi4Q02+rYnQ= +github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUeclsyBRwMa38v64= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -181,9 +181,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= -github.com/go-toolsmith/astcopy v1.0.3 h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0= -github.com/go-toolsmith/astcopy v1.0.3/go.mod h1:4TcEdbElGc9twQEYpVo/aieIXfHhiuLh4aLAck6dO7Y= -github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= +github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= +github.com/go-toolsmith/astcopy v1.1.0/go.mod h1:hXM6gan18VA1T/daUEHCFcYiW8Ai1tIwIzHY6srfEAw= github.com/go-toolsmith/astequal v1.0.3/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astequal v1.1.0 h1:kHKm1AWqClYn15R0K1KKE4RG614D46n+nqUQ06E1dTw= github.com/go-toolsmith/astequal v1.1.0/go.mod h1:sedf7VIdCL22LD8qIvv7Nn9MuWJruQA/ysswh64lffQ= @@ -191,7 +190,7 @@ github.com/go-toolsmith/astfmt v1.1.0 h1:iJVPDPp6/7AaeLJEruMsBUlOYCmvg0MoCfJprsO github.com/go-toolsmith/astfmt v1.1.0/go.mod h1:OrcLlRwu0CuiIBp/8b5PYF9ktGVZUjlNMV634mhwuQ4= github.com/go-toolsmith/astp v1.1.0 h1:dXPuCl6u2llURjdPLLDxJeZInAeZ0/eZwFJmqZMnpQA= github.com/go-toolsmith/astp v1.1.0/go.mod h1:0T1xFGz9hicKs8Z5MfAqSUitoUYS30pDMsRVIDHs8CA= -github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= +github.com/go-toolsmith/pkgload v1.2.2 h1:0CtmHq/02QhxcF7E9N5LIFcYFsMR5rdovfqTtRKkgIk= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= github.com/go-toolsmith/strparse v1.1.0 h1:GAioeZUK9TGxnLS+qfdqNbA4z0SSm5zVNtCQiyP2Bvw= github.com/go-toolsmith/strparse v1.1.0/go.mod h1:7ksGy58fsaQkGQlY8WVoBFNyEPMGuJin1rfoPS4lBSQ= @@ -242,8 +241,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.51.2 h1:yIcsT1X9ZYHdSpeWXRT1ORC/FPGSqDHbHsu9uk4FK7M= -github.com/golangci/golangci-lint v1.51.2/go.mod h1:KH9Q7/3glwpYSknxUgUyLlAv46A8fsSKo1hH2wDvkr8= +github.com/golangci/golangci-lint v1.52.0 h1:T7w3tuF1goz64qGV+ML4MgysSl/yUfA3UZJK92oE48A= +github.com/golangci/golangci-lint v1.52.0/go.mod h1:wlTh+d/oVlgZC2yCe6nlxrxNAnuhEQC0Zdygoh72Uak= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -266,6 +265,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -290,11 +290,8 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= -github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= -github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= -github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= @@ -350,8 +347,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/junk1tm/musttag v0.4.5 h1:d+mpJ1vn6WFEVKHwkgJiIedis1u/EawKOuUTygAUtCo= -github.com/junk1tm/musttag v0.4.5/go.mod h1:XkcL/9O6RmD88JBXb+I15nYRl9W4ExhgQeCBEhfMC8U= +github.com/junk1tm/musttag v0.5.0 h1:bV1DTdi38Hi4pG4OVWa7Kap0hi0o7EczuK6wQt9zPOM= +github.com/junk1tm/musttag v0.5.0/go.mod h1:PcR7BA+oREQYvHwgjIDmw3exJeds5JzRcvEJTfjrA0M= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -359,8 +356,8 @@ github.com/kisielk/errcheck v1.6.3 h1:dEKh+GLHcWm2oN34nMvDzn1sqI0i0WxPvrgiJA5JuM github.com/kisielk/errcheck v1.6.3/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkHAIKE/contextcheck v1.1.3 h1:l4pNvrb8JSwRd51ojtcOxOeHJzHek+MtOyXbaR0uvmw= -github.com/kkHAIKE/contextcheck v1.1.3/go.mod h1:PG/cwd6c0705/LM0KTr1acO2gORUxkSVWyLJOFW5qoo= +github.com/kkHAIKE/contextcheck v1.1.4 h1:B6zAaLhOEEcjvUgIYEqystmnFk1Oemn8bvJhbt0GMb8= +github.com/kkHAIKE/contextcheck v1.1.4/go.mod h1:1+i/gWqokIa+dm31mqGLZhZJ7Uh44DJGZVmr6QRBNJg= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -390,10 +387,10 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= -github.com/maratori/testpackage v1.1.0 h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q= -github.com/maratori/testpackage v1.1.0/go.mod h1:PeAhzU8qkCwdGEMTEupsHJNlQu2gZopMC6RjbhmHeDc= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 h1:pWxk9e//NbPwfxat7RXkts09K+dEBJWakUWwICVqYbA= -github.com/matoous/godox v0.0.0-20210227103229-6504466cf951/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= +github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= +github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= @@ -409,8 +406,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.2.5 h1:UF9AR8pOAuwNmhXj2odp4mxv9Nx2qUIwVz8ZsU+Mbec= -github.com/mgechev/revive v1.2.5/go.mod h1:nFOXent79jMTISAfOAasKfy0Z2Ejq0WX7Qn/KAdYopI= +github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= +github.com/mgechev/revive v1.3.1/go.mod h1:YlD6TTWl2B8A103R9KWJSPVI9DrEf+oqr15q21Ld+5I= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -420,8 +417,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/moricho/tparallel v0.2.1 h1:95FytivzT6rYzdJLdtfn6m1bfFJylOJK41+lgv/EHf4= -github.com/moricho/tparallel v0.2.1/go.mod h1:fXEIZxG2vdfl0ZF8b42f5a78EhjjD5mX8qUplsoSU4k= +github.com/moricho/tparallel v0.3.0 h1:8dDx3S3e+jA+xiQXC7O3dvfRTe/J+FYlTDDW01Y7z/Q= +github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= @@ -433,8 +430,8 @@ github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACp github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.8.1 h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuYs02q1c= -github.com/nunnatsa/ginkgolinter v0.8.1/go.mod h1:FYYLtszIdmzCH8XMaMPyxPVXZ7VCaIm55bA+gugx+14= +github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= +github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= @@ -456,8 +453,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.1.0 h1:VKoEFg5yxSgJ2yFPVhxW7oGz+f8/OVcuMeNvcPIi6Eg= -github.com/polyfloyd/go-errorlint v1.1.0/go.mod h1:Uss7Bc/izYG0leCMRx3WVlrpqWedSZk7V/FUQW6VJ6U= +github.com/polyfloyd/go-errorlint v1.4.0 h1:b+sQ5HibPIAjEZwtuwU8Wz/u0dMZ7YL+bk+9yWyHVJk= +github.com/polyfloyd/go-errorlint v1.4.0/go.mod h1:qJCkPeBn+0EXkdKTrUCcuFStM2xrDKfxI3MGLXPexUs= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -488,8 +485,8 @@ github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZy github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 h1:L8QM9bvf68pVdQ3bCFZMDmnt9yqcMBro1pC7F+IPYMY= -github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= +github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 h1:M8mH9eK4OUR4lu7Gd+PU1fV2/qnDNfzT635KRSObncs= github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -531,8 +528,8 @@ github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= -github.com/sonatard/noctx v0.0.1 h1:VC1Qhl6Oxx9vvWo3UDgrGXYCeKCe3Wbw7qAWL6FrmTY= -github.com/sonatard/noctx v0.0.1/go.mod h1:9D2D/EoULe8Yy2joDHJj7bv3sZoq9AaSb8B4lqBjiZI= +github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= +github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= @@ -572,8 +569,8 @@ github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8 github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c/go.mod h1:SbErYREK7xXdsRiigaQiQkI9McGRzYMvlKYaP3Nimdk= -github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= -github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= +github.com/tdakkota/asciicheck v0.2.0/go.mod h1:Qb7Y9EgjCLJGup51gDHFzbI08/gbGhL/UVhYIPWG2rg= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= @@ -582,10 +579,10 @@ github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo= github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= -github.com/timonwong/loggercheck v0.9.3 h1:ecACo9fNiHxX4/Bc02rW2+kaJIAMAes7qJ7JKxt0EZI= -github.com/timonwong/loggercheck v0.9.3/go.mod h1:wUqnk9yAOIKtGA39l1KLE9Iz0QiTocu/YZoOf+OzFdw= -github.com/tomarrell/wrapcheck/v2 v2.8.0 h1:qDzbir0xmoE+aNxGCPrn+rUSxAX+nG6vREgbbXAR81I= -github.com/tomarrell/wrapcheck/v2 v2.8.0/go.mod h1:ao7l5p0aOlUNJKI0qVwB4Yjlqutd0IvAB9Rdwyilxvg= +github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= +github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= +github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= +github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= @@ -663,8 +660,9 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 h1:6WHiuFL9FNjg8RljAaT7FNUuKDbvMqS1i5cr2OE2sLQ= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= +golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -694,6 +692,7 @@ golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -741,6 +740,7 @@ golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -832,6 +832,7 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -841,6 +842,7 @@ golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -853,6 +855,7 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -862,9 +865,7 @@ golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190307163923-6a08e3108db3/go.mod h1:25r3+/G6/xytQM8iWZKq3Hn0kr0rgFKPUNVEL/dr3z4= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -887,7 +888,6 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117220505-0cba7a3a9ee9/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -900,19 +900,16 @@ golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200329025819-fd4102a86c65/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200624225443-88f3c62a19ff/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200820010801-b793a1359eac/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -935,6 +932,7 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1031,8 +1029,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1063,8 +1061,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc= -honnef.co/go/tools v0.4.2/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= +honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= +honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= From b7b53bba40cd204c29a8abf6856efe1eec18693a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 20 Mar 2023 13:26:17 -0700 Subject: [PATCH 461/886] Remove Synchronous and rename Asynchronous (#3892) * Remove the Synchronous interface * Rename Asynchronous to Observable * Update PR number --- CHANGELOG.md | 2 ++ internal/global/instruments.go | 26 +++++-------------- internal/global/instruments_test.go | 2 -- internal/global/meter.go | 10 +++---- internal/global/meter_types_test.go | 2 +- metric/instrument/asyncfloat64.go | 4 +-- metric/instrument/asyncfloat64_test.go | 2 +- metric/instrument/asyncint64.go | 4 +-- metric/instrument/asyncint64_test.go | 2 +- metric/instrument/instrument.go | 17 +++--------- metric/instrument/syncfloat64.go | 8 +----- metric/instrument/syncint64.go | 6 ----- metric/meter.go | 2 +- metric/noop.go | 10 +++---- sdk/metric/instrument.go | 4 +-- .../internal/aggregator_example_test.go | 2 -- sdk/metric/meter.go | 8 +++--- sdk/metric/meter_test.go | 6 ++--- sdk/metric/pipeline.go | 2 +- 19 files changed, 39 insertions(+), 80 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df905f7b94f..d3723aca1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,10 +22,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844) - Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) - The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) +- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) ### Removed - The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) +- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 diff --git a/internal/global/instruments.go b/internal/global/instruments.go index 6234ee29a9f..74121562fd3 100644 --- a/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -25,7 +25,7 @@ import ( // unwrapper unwraps to return the underlying instrument implementation. type unwrapper interface { - Unwrap() instrument.Asynchronous + Unwrap() instrument.Observable } type afCounter struct { @@ -49,7 +49,7 @@ func (i *afCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afCounter) Unwrap() instrument.Asynchronous { +func (i *afCounter) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableCounter) } @@ -77,7 +77,7 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afUpDownCounter) Unwrap() instrument.Asynchronous { +func (i *afUpDownCounter) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableUpDownCounter) } @@ -105,7 +105,7 @@ func (i *afGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afGauge) Unwrap() instrument.Asynchronous { +func (i *afGauge) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Float64ObservableGauge) } @@ -133,7 +133,7 @@ func (i *aiCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiCounter) Unwrap() instrument.Asynchronous { +func (i *aiCounter) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableCounter) } @@ -161,7 +161,7 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous { +func (i *aiUpDownCounter) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableUpDownCounter) } @@ -189,7 +189,7 @@ func (i *aiGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiGauge) Unwrap() instrument.Asynchronous { +func (i *aiGauge) Unwrap() instrument.Observable { if ctr := i.delegate.Load(); ctr != nil { return ctr.(instrument.Int64ObservableGauge) } @@ -202,8 +202,6 @@ type sfCounter struct { opts []instrument.Float64Option delegate atomic.Value //instrument.Float64Counter - - instrument.Synchronous } var _ instrument.Float64Counter = (*sfCounter)(nil) @@ -228,8 +226,6 @@ type sfUpDownCounter struct { opts []instrument.Float64Option delegate atomic.Value //instrument.Float64UpDownCounter - - instrument.Synchronous } var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) @@ -254,8 +250,6 @@ type sfHistogram struct { opts []instrument.Float64Option delegate atomic.Value //instrument.Float64Histogram - - instrument.Synchronous } var _ instrument.Float64Histogram = (*sfHistogram)(nil) @@ -280,8 +274,6 @@ type siCounter struct { opts []instrument.Int64Option delegate atomic.Value //instrument.Int64Counter - - instrument.Synchronous } var _ instrument.Int64Counter = (*siCounter)(nil) @@ -306,8 +298,6 @@ type siUpDownCounter struct { opts []instrument.Int64Option delegate atomic.Value //instrument.Int64UpDownCounter - - instrument.Synchronous } var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) @@ -332,8 +322,6 @@ type siHistogram struct { opts []instrument.Int64Option delegate atomic.Value //instrument.Int64Histogram - - instrument.Synchronous } var _ instrument.Int64Histogram = (*siHistogram)(nil) diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index 18a731c8911..c7d5a7414fc 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -145,7 +145,6 @@ type testCountingFloatInstrument struct { count int instrument.Float64Observable - instrument.Synchronous } func (i *testCountingFloatInstrument) observe() { @@ -162,7 +161,6 @@ type testCountingIntInstrument struct { count int instrument.Int64Observable - instrument.Synchronous } func (i *testCountingIntInstrument) observe() { diff --git a/internal/global/meter.go b/internal/global/meter.go index 051eac702f8..6e04a590359 100644 --- a/internal/global/meter.go +++ b/internal/global/meter.go @@ -269,7 +269,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 } // RegisterCallback captures the function that will be called during Collect. -func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observable) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) return del.RegisterCallback(f, insts...) @@ -290,11 +290,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro } type wrapped interface { - unwrap() instrument.Asynchronous + unwrap() instrument.Observable } -func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous { - out := make([]instrument.Asynchronous, 0, len(instruments)) +func unwrapInstruments(instruments []instrument.Observable) []instrument.Observable { + out := make([]instrument.Observable, 0, len(instruments)) for _, inst := range instruments { if in, ok := inst.(wrapped); ok { @@ -308,7 +308,7 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async } type registration struct { - instruments []instrument.Asynchronous + instruments []instrument.Observable function metric.Callback unreg func() error diff --git a/internal/global/meter_types_test.go b/internal/global/meter_types_test.go index ed7e49d3652..c0c427e5385 100644 --- a/internal/global/meter_types_test.go +++ b/internal/global/meter_types_test.go @@ -113,7 +113,7 @@ func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Fl } // RegisterCallback captures the function that will be called during Collect. -func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Asynchronous) (metric.Registration, error) { +func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Observable) (metric.Registration, error) { m.callbacks = append(m.callbacks, f) return testReg{ f: func(idx int) func() { diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index 0b5d5a99c0f..c57ae7e36ea 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -26,7 +26,7 @@ import ( // // Warning: methods may be added to this interface in minor releases. type Float64Observable interface { - Asynchronous + Observable float64Observable() } @@ -77,7 +77,7 @@ type Float64Observer interface { // The function needs to be concurrent safe. type Float64Callback func(context.Context, Float64Observer) error -// Float64ObserverConfig contains options for Asynchronous instruments that +// Float64ObserverConfig contains options for Observable instruments that // observe float64 values. type Float64ObserverConfig struct { description string diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index 5333648e095..ee5cc36a752 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -52,7 +52,7 @@ func TestFloat64ObserverOptions(t *testing.T) { } type float64Observer struct { - Asynchronous + Observable got float64 } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index 05feeacb053..5c52cebce7c 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -26,7 +26,7 @@ import ( // // Warning: methods may be added to this interface in minor releases. type Int64Observable interface { - Asynchronous + Observable int64Observable() } @@ -77,7 +77,7 @@ type Int64Observer interface { // The function needs to be concurrent safe. type Int64Callback func(context.Context, Int64Observer) error -// Int64ObserverConfig contains options for Asynchronous instruments that +// Int64ObserverConfig contains options for Observable instruments that // observe int64 values. type Int64ObserverConfig struct { description string diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index 32b7edfa026..9ccdce100aa 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -52,7 +52,7 @@ func TestInt64ObserverOptions(t *testing.T) { } type int64Observer struct { - Asynchronous + Observable got int64 } diff --git a/metric/instrument/instrument.go b/metric/instrument/instrument.go index f6dd9e890f4..fe7975e2910 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument/instrument.go @@ -14,19 +14,10 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" -// Asynchronous instruments are instruments that are updated within a Callback. -// If an instrument is observed outside of it's callback it should be an error. -// -// This interface is used as a grouping mechanism. -type Asynchronous interface { - asynchronous() -} - -// Synchronous instruments are updated in line with application code. -// -// This interface is used as a grouping mechanism. -type Synchronous interface { - synchronous() +// Observable is used as a grouping mechanism for all instruments that are +// updated within a Callback. +type Observable interface { + observable() } // Option applies options to all instruments. diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index 2cdfeb2691a..7059e6106f1 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -26,8 +26,6 @@ import ( type Float64Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - Synchronous } // Float64UpDownCounter is an instrument that records increasing or decreasing @@ -37,8 +35,6 @@ type Float64Counter interface { type Float64UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - Synchronous } // Float64Histogram is an instrument that records a distribution of float64 @@ -48,11 +44,9 @@ type Float64UpDownCounter interface { type Float64Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) - - Synchronous } -// Float64Config contains options for Asynchronous instruments that +// Float64Config contains options for Observable instruments that // observe float64 values. type Float64Config struct { description string diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index e212c6d695f..ec2eb63f816 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -26,8 +26,6 @@ import ( type Int64Counter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - Synchronous } // Int64UpDownCounter is an instrument that records increasing or decreasing @@ -37,8 +35,6 @@ type Int64Counter interface { type Int64UpDownCounter interface { // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - Synchronous } // Int64Histogram is an instrument that records a distribution of int64 @@ -48,8 +44,6 @@ type Int64UpDownCounter interface { type Int64Histogram interface { // Record adds an additional value to the distribution. Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) - - Synchronous } // Int64Config contains options for Synchronous instruments that record int64 diff --git a/metric/meter.go b/metric/meter.go index 2f69d2ae54f..2cd4d7dc30b 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -103,7 +103,7 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. - RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error) + RegisterCallback(f Callback, instruments ...instrument.Observable) (Registration, error) } // Callback is a function registered with a Meter that makes observations for diff --git a/metric/noop.go b/metric/noop.go index f38619e39ab..449ed16872e 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -88,7 +88,7 @@ func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOpt } // RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback(Callback, ...instrument.Asynchronous) (Registration, error) { +func (noopMeter) RegisterCallback(Callback, ...instrument.Observable) (Registration, error) { return noopReg{}, nil } @@ -116,9 +116,7 @@ var ( _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} ) -type nonrecordingSyncFloat64Instrument struct { - instrument.Synchronous -} +type nonrecordingSyncFloat64Instrument struct{} var ( _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{} @@ -129,9 +127,7 @@ var ( func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {} func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {} -type nonrecordingSyncInt64Instrument struct { - instrument.Synchronous -} +type nonrecordingSyncInt64Instrument struct{} var ( _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{} diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 92e2e3780ed..3ae2f2d7b6c 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -170,8 +170,6 @@ type streamID struct { } type instrumentImpl[N int64 | float64] struct { - instrument.Synchronous - aggregators []internal.Aggregator[N] } @@ -243,7 +241,7 @@ func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, } type observable[N int64 | float64] struct { - instrument.Asynchronous + instrument.Observable observablID[N] aggregators []internal.Aggregator[N] diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index b5e58a887e6..213e3f88d31 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -86,8 +86,6 @@ func (p *meter) Int64Histogram(string, ...instrument.Int64Option) (instrument.In // inst is a generalized int64 synchronous counter, up-down counter, and // histogram used for demonstration purposes only. type inst struct { - instrument.Synchronous - aggregateFunc func(int64, attribute.Set) } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index b283701f23c..1d9383e0a7b 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -209,7 +209,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 // returned if other instrument are provided. // // The returned Registration can be used to unregister f. -func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observable) (metric.Registration, error) { if len(insts) == 0 { // Don't allocate a observer if not needed. return noopRegister{}, nil @@ -220,7 +220,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro for _, inst := range insts { // Unwrap any global. if u, ok := inst.(interface { - Unwrap() instrument.Asynchronous + Unwrap() instrument.Observable }); ok { inst = u.Unwrap() } @@ -298,7 +298,7 @@ func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, a .. case float64Observable: oImpl = conv case interface { - Unwrap() instrument.Asynchronous + Unwrap() instrument.Observable }: // Unwrap any global. async := conv.Unwrap() @@ -330,7 +330,7 @@ func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, a ...attri case int64Observable: oImpl = conv case interface { - Unwrap() instrument.Asynchronous + Unwrap() instrument.Observable }: // Unwrap any global. async := conv.Unwrap() diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 83e8b9090eb..fafa0c79741 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -489,7 +489,7 @@ func TestRegisterNonSDKObserverErrors(t *testing.T) { mp := NewMeterProvider(WithReader(rdr)) meter := mp.Meter("scope") - type obsrv struct{ instrument.Asynchronous } + type obsrv struct{ instrument.Observable } o := obsrv{} _, err := meter.RegisterCallback( @@ -1254,7 +1254,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { } } -func TestAsynchronousExample(t *testing.T) { +func TestObservableExample(t *testing.T) { // This example can be found: // https://github.com/open-telemetry/opentelemetry-specification/blob/8b91585e6175dd52b51e1d60bea105041225e35d/specification/metrics/supplementary-guidelines.md#asynchronous-example var ( @@ -1277,7 +1277,7 @@ func TestAsynchronousExample(t *testing.T) { const ( instName = "pageFaults" filteredStream = "filteredPageFaults" - scopeName = "AsynchronousExample" + scopeName = "ObservableExample" ) selector := func(InstrumentKind) metricdata.Temporality { return temp } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 4cad3698dd0..1d63af01b3f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -396,7 +396,7 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin case aggregation.Sum: switch kind { case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: - // Asynchronous counters and up-down-counters are defined to record + // Observable counters and up-down-counters are defined to record // the absolute value of the count: // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation switch temporality { From 6eb1157b45bde186a2050f680db1a09038f47fb8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 20 Mar 2023 13:35:26 -0700 Subject: [PATCH 462/886] Update metric API documentation (#3896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update metric API documentation Remove the warning on otel/metric not being GA. Document the otel/metric and otel/metric/instrument package for instrumenters. * Remove unrendered links in MeterProvider.Meter doc * Clarify synchronous and asynchronous * Fix misspelling * Update metric/instrument/doc.go Co-authored-by: Robert Pająk * Update metric/instrument/doc.go Co-authored-by: Robert Pająk * Update metric/instrument/doc.go Co-authored-by: Robert Pająk * Update metric/instrument/doc.go Co-authored-by: Robert Pająk * Apply feedback * Apply suggestions from code review Co-authored-by: Anthony Mirabella --------- Co-authored-by: Chester Cheung Co-authored-by: Robert Pająk Co-authored-by: Anthony Mirabella --- metric/doc.go | 22 +++++++++++---- metric/instrument/doc.go | 59 ++++++++++++++++++++++++++++++++++++++++ metric/meter.go | 16 +++++++---- 3 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 metric/instrument/doc.go diff --git a/metric/doc.go b/metric/doc.go index bd6f4343720..33de12035c0 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -13,11 +13,23 @@ // limitations under the License. /* -Package metric provides an implementation of the metrics part of the -OpenTelemetry API. +Package metric provides the OpenTelemetry API used to measure metrics about +source code operation. -This package is currently in a pre-GA phase. Backwards incompatible changes -may be introduced in subsequent minor version releases as we work to track the -evolving OpenTelemetry specification and user feedback. +This API is separate from its implementation so the instrumentation built from +it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official +OpenTelemetry implementation of this API. + +All measurements made with this package are made via instruments. These +instruments are created by a [Meter] which itself is created by a +[MeterProvider]. Applications need to accept a [MeterProvider] implementation +as a starting point when instrumenting. This can be done directly, or by using +the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an +appropriately named [Meter] from the accepted [MeterProvider], instrumentation +can then be built from the [Meter]'s instruments. See +[go.opentelemetry.io/otel/metric/instrument] for documentation on each +instrument and its intended use. + +[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ package metric // import "go.opentelemetry.io/otel/metric" diff --git a/metric/instrument/doc.go b/metric/instrument/doc.go new file mode 100644 index 00000000000..d0c38a89ce4 --- /dev/null +++ b/metric/instrument/doc.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package instrument provides the OpenTelemetry API instruments used to make +measurements. + +Each instrument is designed to make measurements of a particular type. Broadly, +all instruments fall into two overlapping logical categories: asynchronous or +synchronous, and int64 or float64. + +All synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], [Float64Histogram]) +are used to measure the operation and performance of source code during the +source code execution. These instruments only make measurements when the source +code they instrument is run. + +All asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], +[Float64ObservableGauge]) are used to measure metrics outside of the execution +of source code. They are said to make "observations" via a callback function +called once every measurement collection cycle. + +Each instrument is also grouped by the value type it measures. Either int64 or +float64. The value being measured will dictate which instrument in these +categories to use. + +Outside of these two broad categories, instruments are described by the +function they are designed to serve. All Counters ([Int64Counter], +[Float64Counter], [Int64ObservableCounter], [Float64ObservableCounter]) are +designed to measure values that never decrease in value, but instead only +incrementally increase in value. UpDownCounters ([Int64UpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], +[Float64ObservableUpDownCounter]) on the other hand, are designed to measure +values that can increase and decrease. When more information +needs to be conveyed about all the synchronous measurements made during a +collection cycle, a Histogram ([Int64Histogram], [Float64Histogram]) should be +used. Finally, when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge], +[Float64ObservableGauge]) should be used. + +See the [OpenTelemetry documentation] for more information about instruments +and their intended use. + +[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ +*/ +package instrument // import "go.opentelemetry.io/otel/metric/instrument" diff --git a/metric/meter.go b/metric/meter.go index 2cd4d7dc30b..a29a7505f49 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -22,15 +22,19 @@ import ( ) // MeterProvider provides access to named Meter instances, for instrumenting -// an application or library. +// an application or package. // // Warning: methods may be added to this interface in minor releases. type MeterProvider interface { - // Meter creates an instance of a `Meter` interface. The name must be the - // name of the library providing instrumentation. This name may be the same - // as the instrumented code only if that code provides built-in - // instrumentation. If the name is empty, then a implementation defined - // default name will be used instead. + // Meter returns a new Meter with the provided name and configuration. + // + // A Meter should be scoped at most to a single package. The name needs to + // be unique so it does not collide with other names used by + // an application, nor other applications. To achieve this, the import path + // of the instrumentation package is recommended to be used as name. + // + // If the name is empty, then an implementation defined default name will + // be used instead. Meter(name string, opts ...MeterOption) Meter } From 90df52586bfb7c267fbf6a6d3247d8ad66b567ed Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 21 Mar 2023 06:16:57 -0700 Subject: [PATCH 463/886] Split metric configuration down to instrument (#3895) * Split metric configuration down to instrument * Rename *ObserverOptions to *ObservableOption * Update option docs with links --- CHANGELOG.md | 7 + internal/global/instruments.go | 24 +-- internal/global/meter.go | 24 +-- internal/global/meter_types_test.go | 24 +-- metric/instrument/asyncfloat64.go | 179 +++++++++++++---- metric/instrument/asyncfloat64_test.go | 69 +++++-- metric/instrument/asyncint64.go | 187 +++++++++++++----- metric/instrument/asyncint64_test.go | 69 +++++-- metric/instrument/instrument.go | 113 +++++++++-- metric/instrument/syncfloat64.go | 98 +++++++-- metric/instrument/syncfloat64_test.go | 28 ++- metric/instrument/syncint64.go | 96 +++++++-- metric/instrument/syncint64_test.go | 28 ++- metric/meter.go | 24 +-- metric/noop.go | 24 +-- .../internal/aggregator_example_test.go | 6 +- sdk/metric/meter.go | 48 ++--- 17 files changed, 791 insertions(+), 257 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3723aca1b8..0b7c16bc88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) - The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) +- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) ### Changed @@ -23,11 +24,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) - The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) - Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) +- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) ### Removed - The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) - The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892) +- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `float64` instrument configuration instead. (#3895) +- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. + Use the added `int64` instrument configuration instead. (#3895) ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 diff --git a/internal/global/instruments.go b/internal/global/instruments.go index 74121562fd3..ef1ed650b0d 100644 --- a/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -32,7 +32,7 @@ type afCounter struct { instrument.Float64Observable name string - opts []instrument.Float64ObserverOption + opts []instrument.Float64ObservableCounterOption delegate atomic.Value //instrument.Float64ObservableCounter } @@ -60,7 +60,7 @@ type afUpDownCounter struct { instrument.Float64Observable name string - opts []instrument.Float64ObserverOption + opts []instrument.Float64ObservableUpDownCounterOption delegate atomic.Value //instrument.Float64ObservableUpDownCounter } @@ -88,7 +88,7 @@ type afGauge struct { instrument.Float64Observable name string - opts []instrument.Float64ObserverOption + opts []instrument.Float64ObservableGaugeOption delegate atomic.Value //instrument.Float64ObservableGauge } @@ -116,7 +116,7 @@ type aiCounter struct { instrument.Int64Observable name string - opts []instrument.Int64ObserverOption + opts []instrument.Int64ObservableCounterOption delegate atomic.Value //instrument.Int64ObservableCounter } @@ -144,7 +144,7 @@ type aiUpDownCounter struct { instrument.Int64Observable name string - opts []instrument.Int64ObserverOption + opts []instrument.Int64ObservableUpDownCounterOption delegate atomic.Value //instrument.Int64ObservableUpDownCounter } @@ -172,7 +172,7 @@ type aiGauge struct { instrument.Int64Observable name string - opts []instrument.Int64ObserverOption + opts []instrument.Int64ObservableGaugeOption delegate atomic.Value //instrument.Int64ObservableGauge } @@ -199,7 +199,7 @@ func (i *aiGauge) Unwrap() instrument.Observable { // Sync Instruments. type sfCounter struct { name string - opts []instrument.Float64Option + opts []instrument.Float64CounterOption delegate atomic.Value //instrument.Float64Counter } @@ -223,7 +223,7 @@ func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.Ke type sfUpDownCounter struct { name string - opts []instrument.Float64Option + opts []instrument.Float64UpDownCounterOption delegate atomic.Value //instrument.Float64UpDownCounter } @@ -247,7 +247,7 @@ func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attrib type sfHistogram struct { name string - opts []instrument.Float64Option + opts []instrument.Float64HistogramOption delegate atomic.Value //instrument.Float64Histogram } @@ -271,7 +271,7 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute. type siCounter struct { name string - opts []instrument.Int64Option + opts []instrument.Int64CounterOption delegate atomic.Value //instrument.Int64Counter } @@ -295,7 +295,7 @@ func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValu type siUpDownCounter struct { name string - opts []instrument.Int64Option + opts []instrument.Int64UpDownCounterOption delegate atomic.Value //instrument.Int64UpDownCounter } @@ -319,7 +319,7 @@ func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.K type siHistogram struct { name string - opts []instrument.Int64Option + opts []instrument.Int64HistogramOption delegate atomic.Value //instrument.Int64Histogram } diff --git a/internal/global/meter.go b/internal/global/meter.go index 6e04a590359..2c2d4fb4feb 100644 --- a/internal/global/meter.go +++ b/internal/global/meter.go @@ -136,7 +136,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { m.registry.Init() } -func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { +func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Counter(name, options...) } @@ -147,7 +147,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (in return i, nil } -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64UpDownCounter(name, options...) } @@ -158,7 +158,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio return i, nil } -func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { +func (m *meter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Histogram(name, options...) } @@ -169,7 +169,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) ( return i, nil } -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableCounter(name, options...) } @@ -180,7 +180,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O return i, nil } -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableUpDownCounter(name, options...) } @@ -191,7 +191,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. return i, nil } -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableGauge(name, options...) } @@ -202,7 +202,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs return i, nil } -func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { +func (m *meter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Counter(name, options...) } @@ -213,7 +213,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) return i, nil } -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64UpDownCounter(name, options...) } @@ -224,7 +224,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O return i, nil } -func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { +func (m *meter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Histogram(name, options...) } @@ -235,7 +235,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio return i, nil } -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableCounter(name, options...) } @@ -246,7 +246,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa return i, nil } -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableUpDownCounter(name, options...) } @@ -257,7 +257,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen return i, nil } -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableGauge(name, options...) } diff --git a/internal/global/meter_types_test.go b/internal/global/meter_types_test.go index c0c427e5385..038083f274b 100644 --- a/internal/global/meter_types_test.go +++ b/internal/global/meter_types_test.go @@ -52,62 +52,62 @@ type testMeter struct { callbacks []metric.Callback } -func (m *testMeter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { +func (m *testMeter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { m.siCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { +func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { m.siUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { +func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { m.siHist++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { +func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { m.aiCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { +func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { m.aiUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { +func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { m.aiGauge++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { +func (m *testMeter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { m.sfCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { +func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { m.sfUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { +func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { m.sfHist++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { +func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { m.afCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { +func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { m.afUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { +func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { m.afGauge++ return &testCountingFloatInstrument{}, nil } diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index c57ae7e36ea..e9ef2be262c 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -39,6 +39,46 @@ type Float64Observable interface { // Warning: methods may be added to this interface in minor releases. type Float64ObservableCounter interface{ Float64Observable } +// Float64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableCounterConfig returns a new +// [Float64ObservableCounterConfig] with all opts applied. +func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { + var config Float64ObservableCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableCounterOption applies options to a +// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and [Option] +// for other options that can be used as a Float64ObservableCounterOption. +type Float64ObservableCounterOption interface { + applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig +} + // Float64ObservableUpDownCounter is an instrument used to asynchronously // record float64 measurements once per collection cycle. Observations are only // made within a callback for this instrument. The value observed is assumed @@ -47,6 +87,47 @@ type Float64ObservableCounter interface{ Float64Observable } // Warning: methods may be added to this interface in minor releases. type Float64ObservableUpDownCounter interface{ Float64Observable } +// Float64ObservableUpDownCounterConfig contains options for asynchronous +// counter instruments that record int64 values. +type Float64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableUpDownCounterConfig returns a new +// [Float64ObservableUpDownCounterConfig] with all opts applied. +func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { + var config Float64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableUpDownCounterOption applies options to a +// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and +// [Option] for other options that can be used as a +// Float64ObservableUpDownCounterOption. +type Float64ObservableUpDownCounterOption interface { + applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig +} + // Float64ObservableGauge is an instrument used to asynchronously record // instantaneous float64 measurements once per collection cycle. Observations // are only made within a callback for this instrument. @@ -54,6 +135,47 @@ type Float64ObservableUpDownCounter interface{ Float64Observable } // Warning: methods may be added to this interface in minor releases. type Float64ObservableGauge interface{ Float64Observable } +// Float64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Float64ObservableGaugeConfig struct { + description string + unit string + callbacks []Float64Callback +} + +// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig] +// with all opts applied. +func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { + var config Float64ObservableGaugeConfig + for _, o := range opts { + config = o.applyFloat64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Float64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { + return c.callbacks +} + +// Float64ObservableGaugeOption applies options to a +// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and +// [Option] for other options that can be used as a +// Float64ObservableGaugeOption. +type Float64ObservableGaugeOption interface { + applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig +} + // Float64Observer is a recorder of float64 measurements. // // Warning: methods may be added to this interface in minor releases. @@ -77,54 +199,33 @@ type Float64Observer interface { // The function needs to be concurrent safe. type Float64Callback func(context.Context, Float64Observer) error -// Float64ObserverConfig contains options for Observable instruments that -// observe float64 values. -type Float64ObserverConfig struct { - description string - unit string - callbacks []Float64Callback +// Float64ObservableOption applies options to float64 Observer instruments. +type Float64ObservableOption interface { + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption } -// NewFloat64ObserverConfig returns a new Float64ObserverConfig with all opts -// applied. -func NewFloat64ObserverConfig(opts ...Float64ObserverOption) Float64ObserverConfig { - var config Float64ObserverConfig - for _, o := range opts { - config = o.applyFloat64Observer(config) - } - return config +type float64CallbackOpt struct { + cback Float64Callback } -// Description returns the Config description. -func (c Float64ObserverConfig) Description() string { - return c.description +func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } -// Unit returns the Config unit. -func (c Float64ObserverConfig) Unit() string { - return c.unit +func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } -// Callbacks returns the Config callbacks. -func (c Float64ObserverConfig) Callbacks() []Float64Callback { - return c.callbacks -} - -// Float64ObserverOption applies options to float64 Observer instruments. -type Float64ObserverOption interface { - applyFloat64Observer(Float64ObserverConfig) Float64ObserverConfig -} - -type float64ObserverOptionFunc func(Float64ObserverConfig) Float64ObserverConfig - -func (fn float64ObserverOptionFunc) applyFloat64Observer(cfg Float64ObserverConfig) Float64ObserverConfig { - return fn(cfg) +func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } // WithFloat64Callback adds callback to be called for an instrument. -func WithFloat64Callback(callback Float64Callback) Float64ObserverOption { - return float64ObserverOptionFunc(func(cfg Float64ObserverConfig) Float64ObserverConfig { - cfg.callbacks = append(cfg.callbacks, callback) - return cfg - }) +func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { + return float64CallbackOpt{callback} } diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index ee5cc36a752..0613fb863bd 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -24,31 +24,62 @@ import ( "go.opentelemetry.io/otel/attribute" ) -func TestFloat64ObserverOptions(t *testing.T) { +func TestFloat64ObservableConfiguration(t *testing.T) { const ( token float64 = 43 desc = "Instrument description." uBytes = "By" ) - got := NewFloat64ObserverConfig( - WithDescription(desc), - WithUnit(uBytes), - WithFloat64Callback(func(ctx context.Context, obsrv Float64Observer) error { - obsrv.Observe(token) - return nil - }), - ) - assert.Equal(t, desc, got.Description(), "description") - assert.Equal(t, uBytes, got.Unit(), "unit") - - // Functions are not comparable. - cBacks := got.Callbacks() - require.Len(t, cBacks, 1, "callbacks") - o := &float64Observer{} - err := cBacks[0](context.Background(), o) - require.NoError(t, err) - assert.Equal(t, token, o.got, "callback not set") + run := func(got float64ObservableConfig) func(*testing.T) { + return func(t *testing.T) { + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + + // Functions are not comparable. + cBacks := got.Callbacks() + require.Len(t, cBacks, 1, "callbacks") + o := &float64Observer{} + err := cBacks[0](context.Background(), o) + require.NoError(t, err) + assert.Equal(t, token, o.got, "callback not set") + } + } + + cback := func(ctx context.Context, obsrv Float64Observer) error { + obsrv.Observe(token) + return nil + } + + t.Run("Float64ObservableCounter", run( + NewFloat64ObservableCounterConfig( + WithDescription(desc), + WithUnit(uBytes), + WithFloat64Callback(cback), + ), + )) + + t.Run("Float64ObservableUpDownCounter", run( + NewFloat64ObservableUpDownCounterConfig( + WithDescription(desc), + WithUnit(uBytes), + WithFloat64Callback(cback), + ), + )) + + t.Run("Float64ObservableGauge", run( + NewFloat64ObservableGaugeConfig( + WithDescription(desc), + WithUnit(uBytes), + WithFloat64Callback(cback), + ), + )) +} + +type float64ObservableConfig interface { + Description() string + Unit() string + Callbacks() []Float64Callback } type float64Observer struct { diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index 5c52cebce7c..e1f843ee367 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -39,6 +39,46 @@ type Int64Observable interface { // Warning: methods may be added to this interface in minor releases. type Int64ObservableCounter interface{ Int64Observable } +// Int64ObservableCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig] +// with all opts applied. +func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { + var config Int64ObservableCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableCounterOption applies options to a +// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and [Option] for +// other options that can be used as an Int64ObservableCounterOption. +type Int64ObservableCounterOption interface { + applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig +} + // Int64ObservableUpDownCounter is an instrument used to asynchronously record // int64 measurements once per collection cycle. Observations are only made // within a callback for this instrument. The value observed is assumed the to @@ -47,6 +87,47 @@ type Int64ObservableCounter interface{ Int64Observable } // Warning: methods may be added to this interface in minor releases. type Int64ObservableUpDownCounter interface{ Int64Observable } +// Int64ObservableUpDownCounterConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableUpDownCounterConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableUpDownCounterConfig returns a new +// [Int64ObservableUpDownCounterConfig] with all opts applied. +func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { + var config Int64ObservableUpDownCounterConfig + for _, o := range opts { + config = o.applyInt64ObservableUpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableUpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableUpDownCounterConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableUpDownCounterOption applies options to a +// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and +// [Option] for other options that can be used as an +// Int64ObservableUpDownCounterOption. +type Int64ObservableUpDownCounterOption interface { + applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig +} + // Int64ObservableGauge is an instrument used to asynchronously record // instantaneous int64 measurements once per collection cycle. Observations are // only made within a callback for this instrument. @@ -54,6 +135,46 @@ type Int64ObservableUpDownCounter interface{ Int64Observable } // Warning: methods may be added to this interface in minor releases. type Int64ObservableGauge interface{ Int64Observable } +// Int64ObservableGaugeConfig contains options for asynchronous counter +// instruments that record int64 values. +type Int64ObservableGaugeConfig struct { + description string + unit string + callbacks []Int64Callback +} + +// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig] +// with all opts applied. +func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { + var config Int64ObservableGaugeConfig + for _, o := range opts { + config = o.applyInt64ObservableGauge(config) + } + return config +} + +// Description returns the configured description. +func (c Int64ObservableGaugeConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64ObservableGaugeConfig) Unit() string { + return c.unit +} + +// Callbacks returns the configured callbacks. +func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { + return c.callbacks +} + +// Int64ObservableGaugeOption applies options to a +// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and [Option] for +// other options that can be used as an Int64ObservableGaugeOption. +type Int64ObservableGaugeOption interface { + applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig +} + // Int64Observer is a recorder of int64 measurements. // // Warning: methods may be added to this interface in minor releases. @@ -61,70 +182,48 @@ type Int64Observer interface { Observe(value int64, attributes ...attribute.KeyValue) } -// Int64Callback is a function registered with a Meter that makes -// observations for a Int64Observerable instrument it is registered with. -// Calls to the Int64Observer record measurement values for the -// Int64Observable. +// Int64Callback is a function registered with a Meter that makes observations +// for an Int64Observerable instrument it is registered with. Calls to the +// Int64Observer record measurement values for the Int64Observable. // // The function needs to complete in a finite amount of time and the deadline // of the passed context is expected to be honored. // // The function needs to make unique observations across all registered -// Int64Callback. Meaning, it should not report measurements with the same +// Int64Callbacks. Meaning, it should not report measurements with the same // attributes as another Int64Callbacks also registered for the same // instrument. // // The function needs to be concurrent safe. type Int64Callback func(context.Context, Int64Observer) error -// Int64ObserverConfig contains options for Observable instruments that -// observe int64 values. -type Int64ObserverConfig struct { - description string - unit string - callbacks []Int64Callback +// Int64ObservableOption applies options to int64 Observer instruments. +type Int64ObservableOption interface { + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption } -// NewInt64ObserverConfig returns a new Int64ObserverConfig with all opts -// applied. -func NewInt64ObserverConfig(opts ...Int64ObserverOption) Int64ObserverConfig { - var config Int64ObserverConfig - for _, o := range opts { - config = o.applyInt64Observer(config) - } - return config +type int64CallbackOpt struct { + cback Int64Callback } -// Description returns the Config description. -func (c Int64ObserverConfig) Description() string { - return c.description +func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } -// Unit returns the Config unit. -func (c Int64ObserverConfig) Unit() string { - return c.unit +func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } -// Callbacks returns the Config callbacks. -func (c Int64ObserverConfig) Callbacks() []Int64Callback { - return c.callbacks -} - -// Int64ObserverOption applies options to int64 Observer instruments. -type Int64ObserverOption interface { - applyInt64Observer(Int64ObserverConfig) Int64ObserverConfig -} - -type int64ObserverOptionFunc func(Int64ObserverConfig) Int64ObserverConfig - -func (fn int64ObserverOptionFunc) applyInt64Observer(cfg Int64ObserverConfig) Int64ObserverConfig { - return fn(cfg) +func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { + cfg.callbacks = append(cfg.callbacks, o.cback) + return cfg } // WithInt64Callback adds callback to be called for an instrument. -func WithInt64Callback(callback Int64Callback) Int64ObserverOption { - return int64ObserverOptionFunc(func(cfg Int64ObserverConfig) Int64ObserverConfig { - cfg.callbacks = append(cfg.callbacks, callback) - return cfg - }) +func WithInt64Callback(callback Int64Callback) Int64ObservableOption { + return int64CallbackOpt{callback} } diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index 9ccdce100aa..b8e8cba5894 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -24,31 +24,62 @@ import ( "go.opentelemetry.io/otel/attribute" ) -func TestInt64ObserverOptions(t *testing.T) { +func TestInt64ObservableConfiguration(t *testing.T) { const ( token int64 = 43 desc = "Instrument description." uBytes = "By" ) - got := NewInt64ObserverConfig( - WithDescription(desc), - WithUnit(uBytes), - WithInt64Callback(func(_ context.Context, obsrv Int64Observer) error { - obsrv.Observe(token) - return nil - }), - ) - assert.Equal(t, desc, got.Description(), "description") - assert.Equal(t, uBytes, got.Unit(), "unit") - - // Functions are not comparable. - cBacks := got.Callbacks() - require.Len(t, cBacks, 1, "callbacks") - o := &int64Observer{} - err := cBacks[0](context.Background(), o) - require.NoError(t, err) - assert.Equal(t, token, o.got, "callback not set") + run := func(got int64ObservableConfig) func(*testing.T) { + return func(t *testing.T) { + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + + // Functions are not comparable. + cBacks := got.Callbacks() + require.Len(t, cBacks, 1, "callbacks") + o := &int64Observer{} + err := cBacks[0](context.Background(), o) + require.NoError(t, err) + assert.Equal(t, token, o.got, "callback not set") + } + } + + cback := func(ctx context.Context, obsrv Int64Observer) error { + obsrv.Observe(token) + return nil + } + + t.Run("Int64ObservableCounter", run( + NewInt64ObservableCounterConfig( + WithDescription(desc), + WithUnit(uBytes), + WithInt64Callback(cback), + ), + )) + + t.Run("Int64ObservableUpDownCounter", run( + NewInt64ObservableUpDownCounterConfig( + WithDescription(desc), + WithUnit(uBytes), + WithInt64Callback(cback), + ), + )) + + t.Run("Int64ObservableGauge", run( + NewInt64ObservableGaugeConfig( + WithDescription(desc), + WithUnit(uBytes), + WithInt64Callback(cback), + ), + )) +} + +type int64ObservableConfig interface { + Description() string + Unit() string + Callbacks() []Int64Callback } type int64Observer struct { diff --git a/metric/instrument/instrument.go b/metric/instrument/instrument.go index fe7975e2910..3eaeb302767 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument/instrument.go @@ -22,30 +22,79 @@ type Observable interface { // Option applies options to all instruments. type Option interface { - Float64ObserverOption - Int64ObserverOption - Float64Option - Int64Option + Int64CounterOption + Int64UpDownCounterOption + Int64HistogramOption + Int64ObservableCounterOption + Int64ObservableUpDownCounterOption + Int64ObservableGaugeOption + + Float64CounterOption + Float64UpDownCounterOption + Float64HistogramOption + Float64ObservableCounterOption + Float64ObservableUpDownCounterOption + Float64ObservableGaugeOption } type descOpt string -func (o descOpt) applyFloat64(c Float64Config) Float64Config { +func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.description = string(o) + return c +} + +func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { c.description = string(o) return c } -func (o descOpt) applyInt64(c Int64Config) Int64Config { +func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { c.description = string(o) return c } -func (o descOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig { +func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { c.description = string(o) return c } -func (o descOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { +func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { c.description = string(o) return c } @@ -55,22 +104,62 @@ func WithDescription(desc string) Option { return descOpt(desc) } type unitOpt string -func (o unitOpt) applyFloat64(c Float64Config) Float64Config { +func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig { + c.unit = string(o) + return c +} + +func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { c.unit = string(o) return c } -func (o unitOpt) applyInt64(c Int64Config) Int64Config { +func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig { c.unit = string(o) return c } -func (o unitOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig { +func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig { c.unit = string(o) return c } -func (o unitOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig { +func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig { c.unit = string(o) return c } diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index 7059e6106f1..2d55384ab26 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -28,6 +28,39 @@ type Float64Counter interface { Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } +// Float64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Float64CounterConfig struct { + description string + unit string +} + +// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts +// applied. +func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { + var config Float64CounterConfig + for _, o := range opts { + config = o.applyFloat64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64CounterConfig) Unit() string { + return c.unit +} + +// Float64CounterOption applies options to a [Float64CounterConfig]. See +// [Option] for other options that can be used as a Float64CounterOption. +type Float64CounterOption interface { + applyFloat64Counter(Float64CounterConfig) Float64CounterConfig +} + // Float64UpDownCounter is an instrument that records increasing or decreasing // float64 values. // @@ -37,6 +70,40 @@ type Float64UpDownCounter interface { Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } +// Float64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Float64UpDownCounterConfig struct { + description string + unit string +} + +// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig] +// with all opts applied. +func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { + var config Float64UpDownCounterConfig + for _, o := range opts { + config = o.applyFloat64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Float64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Float64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Float64UpDownCounterOption applies options to a +// [Float64UpDownCounterConfig]. See [Option] for other options that can be +// used as a Float64UpDownCounterOption. +type Float64UpDownCounterOption interface { + applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig +} + // Float64Histogram is an instrument that records a distribution of float64 // values. // @@ -46,34 +113,35 @@ type Float64Histogram interface { Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } -// Float64Config contains options for Observable instruments that -// observe float64 values. -type Float64Config struct { +// Float64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Float64HistogramConfig struct { description string unit string } -// Float64Config contains options for Synchronous instruments that record -// float64 values. -func NewFloat64Config(opts ...Float64Option) Float64Config { - var config Float64Config +// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all +// opts applied. +func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { + var config Float64HistogramConfig for _, o := range opts { - config = o.applyFloat64(config) + config = o.applyFloat64Histogram(config) } return config } -// Description returns the Config description. -func (c Float64Config) Description() string { +// Description returns the configured description. +func (c Float64HistogramConfig) Description() string { return c.description } -// Unit returns the Config unit. -func (c Float64Config) Unit() string { +// Unit returns the configured unit. +func (c Float64HistogramConfig) Unit() string { return c.unit } -// Float64Option applies options to synchronous float64 instruments. -type Float64Option interface { - applyFloat64(Float64Config) Float64Config +// Float64HistogramOption applies options to a [Float64HistogramConfig]. See +// [Option] for other options that can be used as a Float64HistogramOption. +type Float64HistogramOption interface { + applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig } diff --git a/metric/instrument/syncfloat64_test.go b/metric/instrument/syncfloat64_test.go index 8cc0f5978ae..96fa56334da 100644 --- a/metric/instrument/syncfloat64_test.go +++ b/metric/instrument/syncfloat64_test.go @@ -20,14 +20,34 @@ import ( "github.com/stretchr/testify/assert" ) -func TestFloat64Options(t *testing.T) { +func TestFloat64Configuration(t *testing.T) { const ( token float64 = 43 desc = "Instrument description." uBytes = "By" ) - got := NewFloat64Config(WithDescription(desc), WithUnit(uBytes)) - assert.Equal(t, desc, got.Description(), "description") - assert.Equal(t, uBytes, got.Unit(), "unit") + run := func(got float64Config) func(*testing.T) { + return func(t *testing.T) { + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + } + } + + t.Run("Float64Counter", run( + NewFloat64CounterConfig(WithDescription(desc), WithUnit(uBytes)), + )) + + t.Run("Float64UpDownCounter", run( + NewFloat64UpDownCounterConfig(WithDescription(desc), WithUnit(uBytes)), + )) + + t.Run("Float64Histogram", run( + NewFloat64HistogramConfig(WithDescription(desc), WithUnit(uBytes)), + )) +} + +type float64Config interface { + Description() string + Unit() string } diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index ec2eb63f816..9b6b3917ffc 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -28,6 +28,39 @@ type Int64Counter interface { Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } +// Int64CounterConfig contains options for synchronous counter instruments that +// record int64 values. +type Int64CounterConfig struct { + description string + unit string +} + +// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts +// applied. +func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { + var config Int64CounterConfig + for _, o := range opts { + config = o.applyInt64Counter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64CounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64CounterConfig) Unit() string { + return c.unit +} + +// Int64CounterOption applies options to a [Int64CounterConfig]. See [Option] +// for other options that can be used as an Int64CounterOption. +type Int64CounterOption interface { + applyInt64Counter(Int64CounterConfig) Int64CounterConfig +} + // Int64UpDownCounter is an instrument that records increasing or decreasing // int64 values. // @@ -37,6 +70,40 @@ type Int64UpDownCounter interface { Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } +// Int64UpDownCounterConfig contains options for synchronous counter +// instruments that record int64 values. +type Int64UpDownCounterConfig struct { + description string + unit string +} + +// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with +// all opts applied. +func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { + var config Int64UpDownCounterConfig + for _, o := range opts { + config = o.applyInt64UpDownCounter(config) + } + return config +} + +// Description returns the configured description. +func (c Int64UpDownCounterConfig) Description() string { + return c.description +} + +// Unit returns the configured unit. +func (c Int64UpDownCounterConfig) Unit() string { + return c.unit +} + +// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. +// See [Option] for other options that can be used as an +// Int64UpDownCounterOption. +type Int64UpDownCounterOption interface { + applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig +} + // Int64Histogram is an instrument that records a distribution of int64 // values. // @@ -46,34 +113,35 @@ type Int64Histogram interface { Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } -// Int64Config contains options for Synchronous instruments that record int64 -// values. -type Int64Config struct { +// Int64HistogramConfig contains options for synchronous counter instruments +// that record int64 values. +type Int64HistogramConfig struct { description string unit string } -// NewInt64Config returns a new Int64Config with all opts +// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts // applied. -func NewInt64Config(opts ...Int64Option) Int64Config { - var config Int64Config +func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { + var config Int64HistogramConfig for _, o := range opts { - config = o.applyInt64(config) + config = o.applyInt64Histogram(config) } return config } -// Description returns the Config description. -func (c Int64Config) Description() string { +// Description returns the configured description. +func (c Int64HistogramConfig) Description() string { return c.description } -// Unit returns the Config unit. -func (c Int64Config) Unit() string { +// Unit returns the configured unit. +func (c Int64HistogramConfig) Unit() string { return c.unit } -// Int64Option applies options to synchronous int64 instruments. -type Int64Option interface { - applyInt64(Int64Config) Int64Config +// Int64HistogramOption applies options to a [Int64HistogramConfig]. See +// [Option] for other options that can be used as an Int64HistogramOption. +type Int64HistogramOption interface { + applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig } diff --git a/metric/instrument/syncint64_test.go b/metric/instrument/syncint64_test.go index d352ee477f2..434fd3c4cc2 100644 --- a/metric/instrument/syncint64_test.go +++ b/metric/instrument/syncint64_test.go @@ -20,14 +20,34 @@ import ( "github.com/stretchr/testify/assert" ) -func TestInt64Options(t *testing.T) { +func TestInt64Configuration(t *testing.T) { const ( token int64 = 43 desc = "Instrument description." uBytes = "By" ) - got := NewInt64Config(WithDescription(desc), WithUnit(uBytes)) - assert.Equal(t, desc, got.Description(), "description") - assert.Equal(t, uBytes, got.Unit(), "unit") + run := func(got int64Config) func(*testing.T) { + return func(t *testing.T) { + assert.Equal(t, desc, got.Description(), "description") + assert.Equal(t, uBytes, got.Unit(), "unit") + } + } + + t.Run("Int64Counter", run( + NewInt64CounterConfig(WithDescription(desc), WithUnit(uBytes)), + )) + + t.Run("Int64UpDownCounter", run( + NewInt64UpDownCounterConfig(WithDescription(desc), WithUnit(uBytes)), + )) + + t.Run("Int64Histogram", run( + NewInt64HistogramConfig(WithDescription(desc), WithUnit(uBytes)), + )) +} + +type int64Config interface { + Description() string + Unit() string } diff --git a/metric/meter.go b/metric/meter.go index a29a7505f49..1cb556b0534 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -45,56 +45,56 @@ type Meter interface { // Int64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // int64 measurements during a computational operation. - Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) + Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. - Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) + Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) // Int64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of int64 measurements during a computational operation. - Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) + Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. - Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) + Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) // Int64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously // record int64 measurements once per a measurement collection cycle. - Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) + Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection // cycle. - Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) + Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) // Float64Counter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // increasing float64 measurements during a computational operation. - Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) + Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. - Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) + Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) // Float64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of float64 measurements during a computational // operation. - Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) + Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. - Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) + Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) // Float64ObservableUpDownCounter returns a new instrument identified by // name and configured with options. The instrument is used to // asynchronously record float64 measurements once per a measurement // collection cycle. - Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) + Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection // cycle. - Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) + Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. diff --git a/metric/noop.go b/metric/noop.go index 449ed16872e..9d1acca84fe 100644 --- a/metric/noop.go +++ b/metric/noop.go @@ -39,51 +39,51 @@ func NewNoopMeter() Meter { type noopMeter struct{} -func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { +func (noopMeter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { +func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { +func (noopMeter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { return nonrecordingSyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { +func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { +func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { +func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { return nonrecordingAsyncInt64Instrument{}, nil } -func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) { +func (noopMeter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { +func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) { +func (noopMeter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { return nonrecordingSyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { +func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { +func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { return nonrecordingAsyncFloat64Instrument{}, nil } -func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { +func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { return nonrecordingAsyncFloat64Instrument{}, nil } diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index 213e3f88d31..fdaf6833677 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -30,7 +30,7 @@ type meter struct { aggregations []metricdata.Aggregation } -func (p *meter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) { +func (p *meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { // This is an example of how a meter would create an aggregator for a new // counter. At this point the provider would determine the aggregation and // temporality to used based on the Reader and View configuration. Assume @@ -46,7 +46,7 @@ func (p *meter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int6 return count, nil } -func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { +func (p *meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { // This is an example of how a meter would create an aggregator for a new // up-down counter. At this point the provider would determine the // aggregation and temporality to used based on the Reader and View @@ -63,7 +63,7 @@ func (p *meter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrumen return upDownCount, nil } -func (p *meter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) { +func (p *meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { // This is an example of how a meter would create an aggregator for a new // histogram. At this point the provider would determine the aggregation // and temporality to used based on the Reader and View configuration. diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 1d9383e0a7b..6af74fadeaa 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -58,8 +58,8 @@ var _ metric.Meter = (*meter)(nil) // Int64Counter returns a new instrument identified by name and configured with // options. The instrument is used to synchronously record increasing int64 // measurements during a computational operation. -func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) { - cfg := instrument.NewInt64Config(options...) +func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { + cfg := instrument.NewInt64CounterConfig(options...) const kind = InstrumentKindCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -67,8 +67,8 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (in // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) { - cfg := instrument.NewInt64Config(options...) +func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { + cfg := instrument.NewInt64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -76,8 +76,8 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio // Int64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of int64 measurements during a computational operation. -func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) { - cfg := instrument.NewInt64Config(options...) +func (m *meter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { + cfg := instrument.NewInt64HistogramConfig(options...) const kind = InstrumentKindHistogram return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -85,8 +85,8 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) ( // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) { - cfg := instrument.NewInt64ObserverConfig(options...) +func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { + cfg := instrument.NewInt64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -100,8 +100,8 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) { - cfg := instrument.NewInt64ObserverConfig(options...) +func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { + cfg := instrument.NewInt64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -115,8 +115,8 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) { - cfg := instrument.NewInt64ObserverConfig(options...) +func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { + cfg := instrument.NewInt64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -130,8 +130,8 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs // Float64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // float64 measurements during a computational operation. -func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) { - cfg := instrument.NewFloat64Config(options...) +func (m *meter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { + cfg := instrument.NewFloat64CounterConfig(options...) const kind = InstrumentKindCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -139,8 +139,8 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) { - cfg := instrument.NewFloat64Config(options...) +func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { + cfg := instrument.NewFloat64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -148,8 +148,8 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O // Float64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of float64 measurements during a computational operation. -func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) { - cfg := instrument.NewFloat64Config(options...) +func (m *meter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { + cfg := instrument.NewFloat64HistogramConfig(options...) const kind = InstrumentKindHistogram return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -157,8 +157,8 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) { - cfg := instrument.NewFloat64ObserverConfig(options...) +func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { + cfg := instrument.NewFloat64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -172,8 +172,8 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record // float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) { - cfg := instrument.NewFloat64ObserverConfig(options...) +func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { + cfg := instrument.NewFloat64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -187,8 +187,8 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) { - cfg := instrument.NewFloat64ObserverConfig(options...) +func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { + cfg := instrument.NewFloat64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) From 571ff65854642b0b0b0b6026324122525d17bcd8 Mon Sep 17 00:00:00 2001 From: Peter Liu Date: Tue, 21 Mar 2023 22:56:25 +0800 Subject: [PATCH 464/886] [doc] replace ` jaeger exporter` with `otlp http exporter` (#3705) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update exporters.md Signed-off-by: Peter Liu * add jaeger version which support otlp exporter Signed-off-by: Peter Liu * add jaeger version which support otlp exporter Signed-off-by: Peter Liu * Update website_docs/exporters.md Co-authored-by: Robert Pająk --------- Signed-off-by: Peter Liu Co-authored-by: Robert Pająk --- website_docs/exporters.md | 52 +++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/website_docs/exporters.md b/website_docs/exporters.md index d527cd3438c..ddd346c40d2 100644 --- a/website_docs/exporters.md +++ b/website_docs/exporters.md @@ -7,27 +7,47 @@ weight: 4 In order to visualize and analyze your [traces](/docs/concepts/signals/traces/) and metrics, you will need to export them to a backend. -## OTLP Exporter +## OTLP endpoint -OpenTelemetry Protocol (OTLP) export is available in the -`go.opentelemetry.io/otel/exporters/otlp/otlptrace` and -`go.opentelemetry.io/otel/exporters/otlp/otlpmetric` packages. +To send trace data to an OTLP endpoint (like the [collector](/docs/collector) or +Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your endpoint. -Please find more documentation on -[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp) +### Using HTTP -## Jaeger Exporter +```go +import ( + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" +) -Jaeger export is available in the `go.opentelemetry.io/otel/exporters/jaeger` -package. +func installExportPipeline(ctx context.Context) (func(context.Context) error, error) { + client := otlptracehttp.NewClient() + exporter, err := otlptrace.New(ctx, client) + if err != nil { + return nil, fmt.Errorf("creating OTLP trace exporter: %w", err) + } + /* … */ +} +``` -Please find more documentation on -[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/jaeger) +To learn more on how to use the OTLP HTTP exporter, try out the [otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector) -## Prometheus Exporter +### Jaeger -Prometheus export is available in the -`go.opentelemetry.io/otel/exporters/prometheus` package. +To try out the OTLP exporter, since v1.35.0 you can run +[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace +visualization in a docker container: -Please find more documentation on -[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) +```shell +docker run -d --name jaeger \ + -e COLLECTOR_OTLP_ENABLED=true \ + -p 16686:16686 \ + -p 4318:4318 \ + jaegertracing/all-in-one:latest +``` + +## Prometheus + +Prometheus export is available in the `go.opentelemetry.io/otel/exporters/prometheus` package. + +Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) From 3c75a44f8453739fb5fac865afe4923680701721 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 21 Mar 2023 12:25:23 -0700 Subject: [PATCH 465/886] Move metric No-Op to `metric/noop` (#3893) * Move metric No-Op to noop pkg * Remove the unneeded embedded ifaces * Update CHANGELOG.md Co-authored-by: Peter Liu --------- Co-authored-by: Peter Liu Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 3 + internal/global/instruments_test.go | 5 +- internal/global/meter_test.go | 7 +- internal/global/state_test.go | 5 +- metric/noop.go | 139 ---------------- metric/{ => noop}/example_test.go | 9 +- metric/noop/noop.go | 246 ++++++++++++++++++++++++++++ metric/noop/noop_test.go | 184 +++++++++++++++++++++ metric/noop_test.go | 74 --------- metric_test.go | 5 +- 10 files changed, 451 insertions(+), 226 deletions(-) delete mode 100644 metric/noop.go rename metric/{ => noop}/example_test.go (94%) create mode 100644 metric/noop/noop.go create mode 100644 metric/noop/noop_test.go delete mode 100644 metric/noop_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b7c16bc88c..116ac45a81d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) - The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) - Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) +- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3893) + - `NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` + - `NewNoopMeter` is replaced with `noop.NewMeterProvider().Meter("")` - Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) - Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index c7d5a7414fc..66fe8499cf0 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -21,6 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/noop" ) func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { @@ -36,7 +37,7 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal } }() - setDelegate(metric.NewNoopMeter()) + setDelegate(noop.NewMeterProvider().Meter("")) close(finish) } @@ -53,7 +54,7 @@ func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), } }() - setDelegate(metric.NewNoopMeter()) + setDelegate(noop.NewMeterProvider().Meter("")) close(finish) } diff --git a/internal/global/meter_test.go b/internal/global/meter_test.go index b7b1ea9d8af..8a9341ab46e 100644 --- a/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -25,6 +25,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/noop" ) func TestMeterProviderRace(t *testing.T) { @@ -41,7 +42,7 @@ func TestMeterProviderRace(t *testing.T) { } }() - mp.setDelegate(metric.NewNoopMeterProvider()) + mp.setDelegate(noop.NewMeterProvider()) close(finish) } @@ -84,7 +85,7 @@ func TestMeterRace(t *testing.T) { }() wg.Wait() - mtr.setDelegate(metric.NewNoopMeterProvider()) + mtr.setDelegate(noop.NewMeterProvider()) close(finish) } @@ -113,7 +114,7 @@ func TestUnregisterRace(t *testing.T) { _ = reg.Unregister() wg.Wait() - mtr.setDelegate(metric.NewNoopMeterProvider()) + mtr.setDelegate(noop.NewMeterProvider()) close(finish) } diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 1b441660cf5..93bf6b8aae2 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -152,7 +153,7 @@ func TestSetMeterProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { ResetForTest(t) - SetMeterProvider(metric.NewNoopMeterProvider()) + SetMeterProvider(noop.NewMeterProvider()) _, ok := MeterProvider().(*meterProvider) if ok { @@ -165,7 +166,7 @@ func TestSetMeterProvider(t *testing.T) { mp := MeterProvider() - SetMeterProvider(metric.NewNoopMeterProvider()) + SetMeterProvider(noop.NewMeterProvider()) dmp := mp.(*meterProvider) diff --git a/metric/noop.go b/metric/noop.go deleted file mode 100644 index 9d1acca84fe..00000000000 --- a/metric/noop.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. -func NewNoopMeterProvider() MeterProvider { - return noopMeterProvider{} -} - -type noopMeterProvider struct{} - -func (noopMeterProvider) Meter(string, ...MeterOption) Meter { - return noopMeter{} -} - -// NewNoopMeter creates a Meter that does not record any metrics. -func NewNoopMeter() Meter { - return noopMeter{} -} - -type noopMeter struct{} - -func (noopMeter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -// RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback(Callback, ...instrument.Observable) (Registration, error) { - return noopReg{}, nil -} - -type noopReg struct{} - -func (noopReg) Unregister() error { return nil } - -type nonrecordingAsyncFloat64Instrument struct { - instrument.Float64Observable -} - -var ( - _ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{} - _ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{} - _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{} -) - -type nonrecordingAsyncInt64Instrument struct { - instrument.Int64Observable -} - -var ( - _ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{} - _ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{} - _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} -) - -type nonrecordingSyncFloat64Instrument struct{} - -var ( - _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{} - _ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{} - _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{} -) - -func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {} -func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {} - -type nonrecordingSyncInt64Instrument struct{} - -var ( - _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{} - _ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{} - _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{} -) - -func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {} -func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {} diff --git a/metric/example_test.go b/metric/noop/example_test.go similarity index 94% rename from metric/example_test.go rename to metric/noop/example_test.go index ef7f09019ee..06bc1fc874d 100644 --- a/metric/example_test.go +++ b/metric/noop/example_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric_test +package noop_test import ( "context" @@ -23,12 +23,13 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/noop" ) //nolint:govet // Meter doesn't register for go vet func ExampleMeter_synchronous() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := metric.NewNoopMeterProvider() + meterProvider := noop.NewMeterProvider() workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", @@ -48,7 +49,7 @@ func ExampleMeter_synchronous() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_single() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := metric.NewNoopMeterProvider() + meterProvider := noop.NewMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") _, err := meter.Int64ObservableGauge( @@ -80,7 +81,7 @@ func ExampleMeter_asynchronous_single() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_multiple() { - meterProvider := metric.NewNoopMeterProvider() + meterProvider := noop.NewMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats diff --git a/metric/noop/noop.go b/metric/noop/noop.go new file mode 100644 index 00000000000..ce35983aaf8 --- /dev/null +++ b/metric/noop/noop.go @@ -0,0 +1,246 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package noop provides an implementation of the OpenTelemetry API that +// produces no telemetry and minimizes used computation resources. +// +// The API implementation can be used to effectively disable OpenTelemetry. It +// can also be used as the embedded structs of other OpenTelemetry +// implementations. These alternate implementation that embed this noop +// implementation will default to no-action instead of panicking when methods +// are added to the OpenTelemetry API interfaces. +package noop // import "go.opentelemetry.io/otel/metric/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ metric.MeterProvider = MeterProvider{} + _ metric.Meter = Meter{} + _ metric.Observer = Observer{} + _ metric.Registration = Registration{} + _ instrument.Int64Counter = Int64Counter{} + _ instrument.Float64Counter = Float64Counter{} + _ instrument.Int64UpDownCounter = Int64UpDownCounter{} + _ instrument.Float64UpDownCounter = Float64UpDownCounter{} + _ instrument.Int64Histogram = Int64Histogram{} + _ instrument.Float64Histogram = Float64Histogram{} + _ instrument.Int64ObservableCounter = Int64ObservableCounter{} + _ instrument.Float64ObservableCounter = Float64ObservableCounter{} + _ instrument.Int64ObservableGauge = Int64ObservableGauge{} + _ instrument.Float64ObservableGauge = Float64ObservableGauge{} + _ instrument.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} + _ instrument.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} + _ instrument.Int64Observer = Int64Observer{} + _ instrument.Float64Observer = Float64Observer{} +) + +// MeterProvider is an OpenTelemetry No-Op MeterProvider. +type MeterProvider struct{} + +// NewMeterProvider returns a MeterProvider that does not record any telemetry. +func NewMeterProvider() MeterProvider { + return MeterProvider{} +} + +// Meter returns an OpenTelemetry Meter that does not record any telemetry. +func (MeterProvider) Meter(string, ...metric.MeterOption) metric.Meter { + return Meter{} +} + +// Meter is an OpenTelemetry No-Op Meter. +type Meter struct{} + +// Int64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { + return Int64Counter{}, nil +} + +// Int64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { + return Int64UpDownCounter{}, nil +} + +// Int64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { + return Int64Histogram{}, nil +} + +// Int64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { + return Int64ObservableCounter{}, nil +} + +// Int64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { + return Int64ObservableUpDownCounter{}, nil +} + +// Int64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { + return Int64ObservableGauge{}, nil +} + +// Float64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { + return Float64Counter{}, nil +} + +// Float64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { + return Float64UpDownCounter{}, nil +} + +// Float64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { + return Float64Histogram{}, nil +} + +// Float64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { + return Float64ObservableCounter{}, nil +} + +// Float64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { + return Float64ObservableUpDownCounter{}, nil +} + +// Float64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { + return Float64ObservableGauge{}, nil +} + +// RegisterCallback performs no operation. +func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric.Registration, error) { + return Registration{}, nil +} + +// Observer acts as a recorder of measurements for multiple instruments in a +// Callback, it performing no operation. +type Observer struct{} + +// ObserveFloat64 performs no operation. +func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...attribute.KeyValue) { +} + +// ObserveInt64 performs no operation. +func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...attribute.KeyValue) { +} + +// Registration is the registration of a Callback with a No-Op Meter. +type Registration struct{} + +// Unregister unregisters the Callback the Registration represents with the +// No-Op Meter. This will always return nil because the No-Op Meter performs no +// operation, including hold any record of registrations. +func (Registration) Unregister() error { return nil } + +// Int64Counter is an OpenTelemetry Counter used to record int64 measurements. +// It produces no telemetry. +type Int64Counter struct{} + +// Add performs no operation. +func (Int64Counter) Add(context.Context, int64, ...attribute.KeyValue) {} + +// Float64Counter is an OpenTelemetry Counter used to record float64 +// measurements. It produces no telemetry. +type Float64Counter struct{} + +// Add performs no operation. +func (Float64Counter) Add(context.Context, float64, ...attribute.KeyValue) {} + +// Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 +// measurements. It produces no telemetry. +type Int64UpDownCounter struct{} + +// Add performs no operation. +func (Int64UpDownCounter) Add(context.Context, int64, ...attribute.KeyValue) {} + +// Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record +// float64 measurements. It produces no telemetry. +type Float64UpDownCounter struct{} + +// Add performs no operation. +func (Float64UpDownCounter) Add(context.Context, float64, ...attribute.KeyValue) {} + +// Int64Histogram is an OpenTelemetry Histogram used to record int64 +// measurements. It produces no telemetry. +type Int64Histogram struct{} + +// Record performs no operation. +func (Int64Histogram) Record(context.Context, int64, ...attribute.KeyValue) {} + +// Float64Histogram is an OpenTelemetry Histogram used to record float64 +// measurements. It produces no telemetry. +type Float64Histogram struct{} + +// Record performs no operation. +func (Float64Histogram) Record(context.Context, float64, ...attribute.KeyValue) {} + +// Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableCounter struct{ instrument.Int64Observable } + +// Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableCounter struct{ instrument.Float64Observable } + +// Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableGauge struct{ instrument.Int64Observable } + +// Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableGauge struct{ instrument.Float64Observable } + +// Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record int64 measurements. It produces no telemetry. +type Int64ObservableUpDownCounter struct{ instrument.Int64Observable } + +// Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record float64 measurements. It produces no telemetry. +type Float64ObservableUpDownCounter struct{ instrument.Float64Observable } + +// Int64Observer is a recorder of int64 measurements that performs no operation. +type Int64Observer struct{} + +// Observe performs no operation. +func (Int64Observer) Observe(int64, ...attribute.KeyValue) {} + +// Float64Observer is a recorder of float64 measurements that performs no +// operation. +type Float64Observer struct{} + +// Observe performs no operation. +func (Float64Observer) Observe(float64, ...attribute.KeyValue) {} diff --git a/metric/noop/noop_test.go b/metric/noop/noop_test.go new file mode 100644 index 00000000000..412ee6d957e --- /dev/null +++ b/metric/noop/noop_test.go @@ -0,0 +1,184 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package noop // import "go.opentelemetry.io/otel/metric/noop" + +import ( + "context" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" +) + +func TestImplementationNoPanics(t *testing.T) { + // Check that if type has an embedded interface and that interface has + // methods added to it than the No-Op implementation implements them. + t.Run("MeterProvider", assertAllExportedMethodNoPanic( + reflect.ValueOf(MeterProvider{}), + reflect.TypeOf((*metric.MeterProvider)(nil)).Elem(), + )) + t.Run("Meter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Meter{}), + reflect.TypeOf((*metric.Meter)(nil)).Elem(), + )) + t.Run("Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Observer{}), + reflect.TypeOf((*metric.Observer)(nil)).Elem(), + )) + t.Run("Registration", assertAllExportedMethodNoPanic( + reflect.ValueOf(Registration{}), + reflect.TypeOf((*metric.Registration)(nil)).Elem(), + )) + t.Run("Int64Counter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Counter{}), + reflect.TypeOf((*instrument.Int64Counter)(nil)).Elem(), + )) + t.Run("Float64Counter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Counter{}), + reflect.TypeOf((*instrument.Float64Counter)(nil)).Elem(), + )) + t.Run("Int64UpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64UpDownCounter{}), + reflect.TypeOf((*instrument.Int64UpDownCounter)(nil)).Elem(), + )) + t.Run("Float64UpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64UpDownCounter{}), + reflect.TypeOf((*instrument.Float64UpDownCounter)(nil)).Elem(), + )) + t.Run("Int64Histogram", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Histogram{}), + reflect.TypeOf((*instrument.Int64Histogram)(nil)).Elem(), + )) + t.Run("Float64Histogram", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Histogram{}), + reflect.TypeOf((*instrument.Float64Histogram)(nil)).Elem(), + )) + t.Run("Int64ObservableCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableCounter{}), + reflect.TypeOf((*instrument.Int64ObservableCounter)(nil)).Elem(), + )) + t.Run("Float64ObservableCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableCounter{}), + reflect.TypeOf((*instrument.Float64ObservableCounter)(nil)).Elem(), + )) + t.Run("Int64ObservableGauge", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableGauge{}), + reflect.TypeOf((*instrument.Int64ObservableGauge)(nil)).Elem(), + )) + t.Run("Float64ObservableGauge", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableGauge{}), + reflect.TypeOf((*instrument.Float64ObservableGauge)(nil)).Elem(), + )) + t.Run("Int64ObservableUpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableUpDownCounter{}), + reflect.TypeOf((*instrument.Int64ObservableUpDownCounter)(nil)).Elem(), + )) + t.Run("Float64ObservableUpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableUpDownCounter{}), + reflect.TypeOf((*instrument.Float64ObservableUpDownCounter)(nil)).Elem(), + )) + t.Run("Int64Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Observer{}), + reflect.TypeOf((*instrument.Int64Observer)(nil)).Elem(), + )) + t.Run("Float64Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Observer{}), + reflect.TypeOf((*instrument.Float64Observer)(nil)).Elem(), + )) +} + +func assertAllExportedMethodNoPanic(rVal reflect.Value, rType reflect.Type) func(*testing.T) { + return func(t *testing.T) { + for n := 0; n < rType.NumMethod(); n++ { + mType := rType.Method(n) + if !mType.IsExported() { + t.Logf("ignoring unexported %s", mType.Name) + continue + } + m := rVal.MethodByName(mType.Name) + if !m.IsValid() { + t.Errorf("unknown method for %s: %s", rVal.Type().Name(), mType.Name) + } + + numIn := mType.Type.NumIn() + if mType.Type.IsVariadic() { + numIn-- + } + args := make([]reflect.Value, numIn) + for i := range args { + aType := mType.Type.In(i) + args[i] = reflect.New(aType).Elem() + } + + assert.NotPanicsf(t, func() { + _ = m.Call(args) + }, "%s.%s", rVal.Type().Name(), mType.Name) + } + } +} + +func TestNewMeterProvider(t *testing.T) { + mp := NewMeterProvider() + assert.Equal(t, mp, MeterProvider{}) + meter := mp.Meter("") + assert.Equal(t, meter, Meter{}) +} + +func TestSyncFloat64(t *testing.T) { + meter := NewMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.Float64Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Float64UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Float64Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1.0, attribute.String("key", "value")) + }) +} + +func TestSyncInt64(t *testing.T) { + meter := NewMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.Int64Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Int64UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Int64Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1, attribute.String("key", "value")) + }) +} diff --git a/metric/noop_test.go b/metric/noop_test.go deleted file mode 100644 index 59695ccd5bc..00000000000 --- a/metric/noop_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" -) - -func TestNewNoopMeterProvider(t *testing.T) { - mp := NewNoopMeterProvider() - assert.Equal(t, mp, noopMeterProvider{}) - meter := mp.Meter("") - assert.Equal(t, meter, noopMeter{}) -} - -func TestSyncFloat64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Float64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1.0, attribute.String("key", "value")) - }) -} - -func TestSyncInt64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Int64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1, attribute.String("key", "value")) - }) -} diff --git a/metric_test.go b/metric_test.go index 646bb108368..cc6f72d76f0 100644 --- a/metric_test.go +++ b/metric_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" ) type testMeterProvider struct{} @@ -27,12 +28,12 @@ type testMeterProvider struct{} var _ metric.MeterProvider = &testMeterProvider{} func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter { - return metric.NewNoopMeterProvider().Meter("") + return noop.NewMeterProvider().Meter("") } func TestMultipleGlobalMeterProvider(t *testing.T) { p1 := testMeterProvider{} - p2 := metric.NewNoopMeterProvider() + p2 := noop.NewMeterProvider() SetMeterProvider(&p1) SetMeterProvider(p2) From 1eab60f71478b80d1976154488d3999dd4862fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sinan=20=C3=9Clker?= Date: Tue, 21 Mar 2023 20:33:37 +0100 Subject: [PATCH 466/886] Enhance internal logging (#3900) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce `Warn` function in global package * Cover log levels with tests --------- Co-authored-by: Robert Pająk Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 2 + internal/global/internal_logging.go | 19 ++++--- internal/global/internal_logging_test.go | 68 ++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 116ac45a81d..659d887bb3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) - Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) +- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) ### Changed @@ -29,6 +30,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `NewNoopMeter` is replaced with `noop.NewMeterProvider().Meter("")` - Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) - Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) +- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) ### Removed diff --git a/internal/global/internal_logging.go b/internal/global/internal_logging.go index 293c08961fb..5951fd06d4c 100644 --- a/internal/global/internal_logging.go +++ b/internal/global/internal_logging.go @@ -24,7 +24,7 @@ import ( "github.com/go-logr/stdr" ) -// globalLogger is the logging interface used within the otel api and sdk provide deatails of the internals. +// globalLogger is the logging interface used within the otel api and sdk provide details of the internals. // // The default logger uses stdr which is backed by the standard `log.Logger` // interface. This logger will only show messages at the Error Level. @@ -36,8 +36,9 @@ func init() { // SetLogger overrides the globalLogger with l. // -// To see Info messages use a logger with `l.V(1).Enabled() == true` -// To see Debug messages use a logger with `l.V(5).Enabled() == true`. +// To see Warn messages use a logger with `l.V(1).Enabled() == true` +// To see Info messages use a logger with `l.V(4).Enabled() == true` +// To see Debug messages use a logger with `l.V(8).Enabled() == true`. func SetLogger(l logr.Logger) { atomic.StorePointer(&globalLogger, unsafe.Pointer(&l)) } @@ -47,9 +48,9 @@ func getLogger() logr.Logger { } // Info prints messages about the general state of the API or SDK. -// This should usually be less then 5 messages a minute. +// This should usually be less than 5 messages a minute. func Info(msg string, keysAndValues ...interface{}) { - getLogger().V(1).Info(msg, keysAndValues...) + getLogger().V(4).Info(msg, keysAndValues...) } // Error prints messages about exceptional states of the API or SDK. @@ -59,5 +60,11 @@ func Error(err error, msg string, keysAndValues ...interface{}) { // Debug prints messages about all internal changes in the API or SDK. func Debug(msg string, keysAndValues ...interface{}) { - getLogger().V(5).Info(msg, keysAndValues...) + getLogger().V(8).Info(msg, keysAndValues...) +} + +// Warn prints messages about warnings in the API or SDK. +// Not an error but is likely more important than an informational event. +func Warn(msg string, keysAndValues ...interface{}) { + getLogger().V(1).Info(msg, keysAndValues...) } diff --git a/internal/global/internal_logging_test.go b/internal/global/internal_logging_test.go index d116486a80a..ae2f2f61781 100644 --- a/internal/global/internal_logging_test.go +++ b/internal/global/internal_logging_test.go @@ -15,10 +15,17 @@ package global import ( + "bytes" + "errors" "log" "os" "testing" + "github.com/go-logr/logr" + + "github.com/stretchr/testify/assert" + + "github.com/go-logr/logr/funcr" "github.com/go-logr/stdr" ) @@ -26,3 +33,64 @@ func TestRace(t *testing.T) { go SetLogger(stdr.New(log.New(os.Stderr, "", 0))) go Info("") } + +func TestLogLevel(t *testing.T) { + tests := []struct { + name string + verbosity int + logF func() + want string + }{ + { + name: "Verbosity 0 should log errors.", + verbosity: 0, + want: `"msg"="foobar" "error"="foobar"`, + logF: func() { + Error(errors.New("foobar"), "foobar") + }, + }, + { + name: "Verbosity 1 should log warnings", + verbosity: 1, + want: `"level"=1 "msg"="foo"`, + logF: func() { + Warn("foo") + }, + }, + { + name: "Verbosity 4 should log info", + verbosity: 4, + want: `"level"=4 "msg"="bar"`, + logF: func() { + Info("bar") + }, + }, + { + name: "Verbosity 8 should log debug", + verbosity: 8, + want: `"level"=8 "msg"="baz"`, + logF: func() { + Debug("baz") + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + var buf bytes.Buffer + SetLogger(newBuffLogger(&buf, test.verbosity)) + + test.logF() + + assert.Equal(t, test.want, buf.String()) + }) + } +} + +func newBuffLogger(buf *bytes.Buffer, verbosity int) logr.Logger { + return funcr.New(func(prefix, args string) { + _, _ = buf.Write([]byte(args)) + }, funcr.Options{ + Verbosity: verbosity, + }) +} From 282a47e3d3d2b7b4d1d79701785e8b8a4537cdb0 Mon Sep 17 00:00:00 2001 From: Matthew Wear Date: Tue, 21 Mar 2023 12:45:30 -0700 Subject: [PATCH 467/886] add host.id to resource auto-detection (#3812) * add platform specific hostIDReaders * add WithHostID option to Resource * add changelog entry * Apply suggestions from code review Co-authored-by: Tyler Yahn * linting * combine platform specific readers and tests This allows us to run tests for the BSD, Darwin, and Linux readers on all platforms. * add todo to use assert.AnError after resource.Detect error handling is updated * move HostID test utilities to host_id_test * return assert.AnError from mockHostIDProviderWithError * use assert.ErrorIs Co-authored-by: Tyler Yahn --------- Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + sdk/resource/config.go | 5 + sdk/resource/host_id.go | 142 +++++++++++++++++ sdk/resource/host_id_bsd.go | 28 ++++ sdk/resource/host_id_darwin.go | 19 +++ sdk/resource/host_id_export_test.go | 37 +++++ sdk/resource/host_id_linux.go | 22 +++ sdk/resource/host_id_test.go | 222 +++++++++++++++++++++++++++ sdk/resource/host_id_unsupported.go | 36 +++++ sdk/resource/host_id_windows.go | 48 ++++++ sdk/resource/host_id_windows_test.go | 32 ++++ sdk/resource/resource_test.go | 30 ++++ 12 files changed, 622 insertions(+) create mode 100644 sdk/resource/host_id.go create mode 100644 sdk/resource/host_id_bsd.go create mode 100644 sdk/resource/host_id_darwin.go create mode 100644 sdk/resource/host_id_export_test.go create mode 100644 sdk/resource/host_id_linux.go create mode 100644 sdk/resource/host_id_test.go create mode 100644 sdk/resource/host_id_unsupported.go create mode 100644 sdk/resource/host_id_windows.go create mode 100644 sdk/resource/host_id_windows_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 659d887bb3d..c3eb300b28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) - The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828) - The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`. Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) diff --git a/sdk/resource/config.go b/sdk/resource/config.go index f9a2a299907..f263919f6ec 100644 --- a/sdk/resource/config.go +++ b/sdk/resource/config.go @@ -71,6 +71,11 @@ func WithHost() Option { return WithDetectors(host{}) } +// WithHostID adds host ID information to the configured resource. +func WithHostID() Option { + return WithDetectors(hostIDDetector{}) +} + // WithTelemetrySDK adds TelemetrySDK version info to the configured resource. func WithTelemetrySDK() Option { return WithDetectors(telemetrySDK{}) diff --git a/sdk/resource/host_id.go b/sdk/resource/host_id.go new file mode 100644 index 00000000000..32a616d0879 --- /dev/null +++ b/sdk/resource/host_id.go @@ -0,0 +1,142 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "context" + "errors" + "os" + "os/exec" + "strings" + + semconv "go.opentelemetry.io/otel/semconv/v1.17.0" +) + +type hostIDProvider func() (string, error) + +var defaultHostIDProvider hostIDProvider = platformHostIDReader.read + +var hostID = defaultHostIDProvider + +type hostIDReader interface { + read() (string, error) +} + +type fileReader func(string) (string, error) + +type commandExecutor func(string, ...string) (string, error) + +func readFile(filename string) (string, error) { + b, err := os.ReadFile(filename) + if err != nil { + return "", nil + } + + return string(b), nil +} + +// nolint: unused // This is used by the hostReaderBSD, gated by build tags. +func execCommand(name string, arg ...string) (string, error) { + cmd := exec.Command(name, arg...) + b, err := cmd.Output() + if err != nil { + return "", err + } + + return string(b), nil +} + +// hostIDReaderBSD implements hostIDReader. +type hostIDReaderBSD struct { + execCommand commandExecutor + readFile fileReader +} + +// read attempts to read the machine-id from /etc/hostid. If not found it will +// execute `kenv -q smbios.system.uuid`. If neither location yields an id an +// error will be returned. +func (r *hostIDReaderBSD) read() (string, error) { + if result, err := r.readFile("/etc/hostid"); err == nil { + return strings.TrimSpace(result), nil + } + + if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil { + return strings.TrimSpace(result), nil + } + + return "", errors.New("host id not found in: /etc/hostid or kenv") +} + +// hostIDReaderDarwin implements hostIDReader. +type hostIDReaderDarwin struct { + execCommand commandExecutor +} + +// read executes `ioreg -rd1 -c "IOPlatformExpertDevice"` and parses host id +// from the IOPlatformUUID line. If the command fails or the uuid cannot be +// parsed an error will be returned. +func (r *hostIDReaderDarwin) read() (string, error) { + result, err := r.execCommand("ioreg", "-rd1", "-c", "IOPlatformExpertDevice") + if err != nil { + return "", err + } + + lines := strings.Split(result, "\n") + for _, line := range lines { + if strings.Contains(line, "IOPlatformUUID") { + parts := strings.Split(line, " = ") + if len(parts) == 2 { + return strings.Trim(parts[1], "\""), nil + } + break + } + } + + return "", errors.New("could not parse IOPlatformUUID") +} + +type hostIDReaderLinux struct { + readFile fileReader +} + +// read attempts to read the machine-id from /etc/machine-id followed by +// /var/lib/dbus/machine-id. If neither location yields an ID an error will +// be returned. +func (r *hostIDReaderLinux) read() (string, error) { + if result, err := r.readFile("/etc/machine-id"); err == nil { + return strings.TrimSpace(result), nil + } + + if result, err := r.readFile("/var/lib/dbus/machine-id"); err == nil { + return strings.TrimSpace(result), nil + } + + return "", errors.New("host id not found in: /etc/machine-id or /var/lib/dbus/machine-id") +} + +type hostIDDetector struct{} + +// Detect returns a *Resource containing the platform specific host id. +func (hostIDDetector) Detect(ctx context.Context) (*Resource, error) { + hostID, err := hostID() + if err != nil { + return nil, err + } + + return NewWithAttributes( + semconv.SchemaURL, + semconv.HostID(hostID), + ), nil +} diff --git a/sdk/resource/host_id_bsd.go b/sdk/resource/host_id_bsd.go new file mode 100644 index 00000000000..0037b65da45 --- /dev/null +++ b/sdk/resource/host_id_bsd.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build dragonfly || freebsd || netbsd || openbsd || solaris +// +build dragonfly freebsd netbsd openbsd solaris + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "errors" + "strings" +) + +var platformHostIDReader hostIDReader = &hostIDReaderBSD{ + execCommand: execCommand, + readFile: readFile, +} diff --git a/sdk/resource/host_id_darwin.go b/sdk/resource/host_id_darwin.go new file mode 100644 index 00000000000..ba41409b23c --- /dev/null +++ b/sdk/resource/host_id_darwin.go @@ -0,0 +1,19 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +var platformHostIDReader hostIDReader = &hostIDReaderDarwin{ + execCommand: execCommand, +} diff --git a/sdk/resource/host_id_export_test.go b/sdk/resource/host_id_export_test.go new file mode 100644 index 00000000000..e74d9a35d8b --- /dev/null +++ b/sdk/resource/host_id_export_test.go @@ -0,0 +1,37 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource_test + +import ( + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/sdk/resource" +) + +func mockHostIDProvider() { + resource.SetHostIDProvider( + func() (string, error) { return "f2c668b579780554f70f72a063dc0864", nil }, + ) +} + +func mockHostIDProviderWithError() { + resource.SetHostIDProvider( + func() (string, error) { return "", assert.AnError }, + ) +} + +func restoreHostIDProvider() { + resource.SetDefaultHostIDProvider() +} diff --git a/sdk/resource/host_id_linux.go b/sdk/resource/host_id_linux.go new file mode 100644 index 00000000000..410579b8fc9 --- /dev/null +++ b/sdk/resource/host_id_linux.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux +// +build linux + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +var platformHostIDReader hostIDReader = &hostIDReaderLinux{ + readFile: readFile, +} diff --git a/sdk/resource/host_id_test.go b/sdk/resource/host_id_test.go new file mode 100644 index 00000000000..b20c2663714 --- /dev/null +++ b/sdk/resource/host_id_test.go @@ -0,0 +1,222 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/require" +) + +var ( + expectedHostID = "f2c668b579780554f70f72a063dc0864" + + readFileNoError = func(filename string) (string, error) { + return expectedHostID + "\n", nil + } + + readFileError = func(filename string) (string, error) { + return "", errors.New("not found") + } + + execCommandNoError = func(string, ...string) (string, error) { + return expectedHostID + "\n", nil + } + + execCommandError = func(string, ...string) (string, error) { + return "", errors.New("not found") + } +) + +func SetDefaultHostIDProvider() { + SetHostIDProvider(defaultHostIDProvider) +} + +func SetHostIDProvider(hostIDProvider hostIDProvider) { + hostID = hostIDProvider +} + +func TestHostIDReaderBSD(t *testing.T) { + tt := []struct { + name string + fileReader fileReader + commandExecutor commandExecutor + expectedHostID string + expectError bool + }{ + { + name: "hostIDReaderBSD valid primary", + fileReader: readFileNoError, + commandExecutor: execCommandError, + expectedHostID: expectedHostID, + expectError: false, + }, + { + name: "hostIDReaderBSD invalid primary", + fileReader: readFileError, + commandExecutor: execCommandNoError, + expectedHostID: expectedHostID, + expectError: false, + }, + { + name: "hostIDReaderBSD invalid primary and secondary", + fileReader: readFileError, + commandExecutor: execCommandError, + expectedHostID: "", + expectError: true, + }, + } + + for _, tc := range tt { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + reader := hostIDReaderBSD{ + readFile: tc.fileReader, + execCommand: tc.commandExecutor, + } + hostID, err := reader.read() + require.Equal(t, tc.expectError, err != nil) + require.Equal(t, tc.expectedHostID, hostID) + }) + } +} + +func TestHostIDReaderLinux(t *testing.T) { + readFilePrimaryError := func(filename string) (string, error) { + if filename == "/var/lib/dbus/machine-id" { + return readFileNoError(filename) + } + return readFileError(filename) + } + + tt := []struct { + name string + fileReader fileReader + expectedHostID string + expectError bool + }{ + { + name: "hostIDReaderLinux valid primary", + fileReader: readFileNoError, + expectedHostID: expectedHostID, + expectError: false, + }, + { + name: "hostIDReaderLinux invalid primary", + fileReader: readFilePrimaryError, + expectedHostID: expectedHostID, + expectError: false, + }, + { + name: "hostIDReaderLinux invalid primary and secondary", + fileReader: readFileError, + expectedHostID: "", + expectError: true, + }, + } + + for _, tc := range tt { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + reader := hostIDReaderLinux{ + readFile: tc.fileReader, + } + hostID, err := reader.read() + require.Equal(t, tc.expectError, err != nil) + require.Equal(t, tc.expectedHostID, hostID) + }) + } +} + +func TestHostIDReaderDarwin(t *testing.T) { + validOutput := `+-o J316sAP +{ + "IOPolledInterface" = "AppleARMWatchdogTimerHibernateHandler is not serializable" + "#address-cells" = <02000000> + "AAPL,phandle" = <01000000> + "serial-number" = <94e1c79ec04cd3f153f600000000000000000000000000000000000000000000> + "IOBusyInterest" = "IOCommand is not serializable" + "target-type" = <"J316s"> + "platform-name" = <7436303030000000000000000000000000000000000000000000000000000000> + "secure-root-prefix" = <"md"> + "name" = <"device-tree"> + "region-info" = <4c4c2f4100000000000000000000000000000000000000000000000000000000> + "manufacturer" = <"Apple Inc."> + "compatible" = <"J316sAP","MacBookPro18,1","AppleARM"> + "config-number" = <00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000> + "IOPlatformSerialNumber" = "HDWLIF2LM7" + "regulatory-model-number" = <4132343835000000000000000000000000000000000000000000000000000000> + "time-stamp" = <"Fri Aug 5 20:25:38 PDT 2022"> + "clock-frequency" = <00366e01> + "model" = <"MacBookPro18,1"> + "mlb-serial-number" = <5c92d268d6cd789e475ffafc0d363fc950000000000000000000000000000000> + "model-number" = <5a31345930303136430000000000000000000000000000000000000000000000> + "IONWInterrupts" = "IONWInterrupts" + "model-config" = <"ICT;MoPED=0x03D053A605C84ED11C455A18D6C643140B41A239"> + "device_type" = <"bootrom"> + "#size-cells" = <02000000> + "IOPlatformUUID" = "81895B8D-9EF9-4EBB-B5DE-B00069CF53F0" +} +` + execCommandValid := func(string, ...string) (string, error) { + return validOutput, nil + } + + execCommandInvalid := func(string, ...string) (string, error) { + return "wasn't expecting this", nil + } + + tt := []struct { + name string + fileReader fileReader + commandExecutor commandExecutor + expectedHostID string + expectError bool + }{ + { + name: "hostIDReaderDarwin valid output", + commandExecutor: execCommandValid, + expectedHostID: "81895B8D-9EF9-4EBB-B5DE-B00069CF53F0", + expectError: false, + }, + { + name: "hostIDReaderDarwin invalid output", + commandExecutor: execCommandInvalid, + expectedHostID: "", + expectError: true, + }, + { + name: "hostIDReaderDarwin error", + commandExecutor: execCommandError, + expectedHostID: "", + expectError: true, + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.name, func(t *testing.T) { + reader := hostIDReaderDarwin{ + execCommand: tc.commandExecutor, + } + hostID, err := reader.read() + require.Equal(t, tc.expectError, err != nil) + require.Equal(t, tc.expectedHostID, hostID) + }) + } +} diff --git a/sdk/resource/host_id_unsupported.go b/sdk/resource/host_id_unsupported.go new file mode 100644 index 00000000000..89df9d6882e --- /dev/null +++ b/sdk/resource/host_id_unsupported.go @@ -0,0 +1,36 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !darwin +// +build !dragonfly +// +build !freebsd +// +build !linux +// +build !netbsd +// +build !openbsd +// +build !solaris +// +build !windows + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +// hostIDReaderUnsupported is a placeholder implementation for operating systems +// for which this project currently doesn't support host.id +// attribute detection. See build tags declaration early on this file +// for a list of unsupported OSes. +type hostIDReaderUnsupported struct{} + +func (*hostIDReaderUnsupported) read() (string, error) { + return "", nil +} + +var platformHostIDReader hostIDReader = &hostIDReaderUnsupported{} diff --git a/sdk/resource/host_id_windows.go b/sdk/resource/host_id_windows.go new file mode 100644 index 00000000000..5b431c6ee6e --- /dev/null +++ b/sdk/resource/host_id_windows.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "golang.org/x/sys/windows/registry" +) + +// implements hostIDReader +type hostIDReaderWindows struct{} + +// read reads MachineGuid from the windows registry key: +// SOFTWARE\Microsoft\Cryptography +func (*hostIDReaderWindows) read() (string, error) { + k, err := registry.OpenKey( + registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`, + registry.QUERY_VALUE|registry.WOW64_64KEY, + ) + + if err != nil { + return "", err + } + defer k.Close() + + guid, _, err := k.GetStringValue("MachineGuid") + if err != nil { + return "", err + } + + return guid, nil +} + +var platformHostIDReader hostIDReader = &hostIDReaderWindows{} diff --git a/sdk/resource/host_id_windows_test.go b/sdk/resource/host_id_windows_test.go new file mode 100644 index 00000000000..656b005c6af --- /dev/null +++ b/sdk/resource/host_id_windows_test.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build windows +// +build windows + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestReader(t *testing.T) { + reader := &hostIDReaderWindows{} + result, err := reader.read() + + require.NoError(t, err) + require.NotEmpty(t, result) +} diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 29803b143d0..4cf346fd172 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -471,6 +471,36 @@ func TestNewWrapedError(t *testing.T) { assert.NotErrorIs(t, err, errors.New("false positive error")) } +func TestWithHostID(t *testing.T) { + mockHostIDProvider() + t.Cleanup(restoreHostIDProvider) + + ctx := context.Background() + + res, err := resource.New(ctx, + resource.WithHostID(), + ) + + require.NoError(t, err) + require.EqualValues(t, map[string]string{ + "host.id": "f2c668b579780554f70f72a063dc0864", + }, toMap(res)) +} + +func TestWithHostIDError(t *testing.T) { + mockHostIDProviderWithError() + t.Cleanup(restoreHostIDProvider) + + ctx := context.Background() + + res, err := resource.New(ctx, + resource.WithHostID(), + ) + + assert.ErrorIs(t, err, assert.AnError) + require.EqualValues(t, map[string]string{}, toMap(res)) +} + func TestWithOSType(t *testing.T) { mockRuntimeProviders() t.Cleanup(restoreAttributesProviders) From e4cc478c02df5729e1065acc4700cb687728f325 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Thu, 23 Mar 2023 03:47:42 +1100 Subject: [PATCH 468/886] TracerProvider doesn't allow to register a SpanProcessor after shutdown (#3845) --- CHANGELOG.md | 4 ++++ sdk/trace/provider.go | 9 ++++----- sdk/trace/provider_test.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3eb300b28c..2bba4d3f40d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) - The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) +### Fixed + +- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845) + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 201c1781700..0636c780736 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -237,14 +237,13 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error { // Shutdown shuts down TracerProvider. All registered span processors are shut down // in the order they were registered and any held computational resources are released. func (p *TracerProvider) Shutdown(ctx context.Context) error { - spss := p.spanProcessors.Load().(spanProcessorStates) - if len(spss) == 0 { - return nil - } - p.mu.Lock() defer p.mu.Unlock() + if p.isShutdown { + return nil + } p.isShutdown = true + spss := p.spanProcessors.Load().(spanProcessorStates) var retErr error for _, sps := range spss { diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 2cf19aaa029..5d984ff3b86 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -50,6 +50,7 @@ func TestForceFlushAndShutdownTraceProviderWithoutProcessor(t *testing.T) { stp := NewTracerProvider() assert.NoError(t, stp.ForceFlush(context.Background())) assert.NoError(t, stp.Shutdown(context.Background())) + assert.True(t, stp.isShutdown) } func TestShutdownTraceProvider(t *testing.T) { @@ -60,6 +61,7 @@ func TestShutdownTraceProvider(t *testing.T) { assert.NoError(t, stp.ForceFlush(context.Background())) assert.True(t, sp.flushed, "error ForceFlush basicSpanProcessor") assert.NoError(t, stp.Shutdown(context.Background())) + assert.True(t, stp.isShutdown) assert.True(t, sp.closed, "error Shutdown basicSpanProcessor") } @@ -74,6 +76,7 @@ func TestFailedProcessorShutdown(t *testing.T) { err := stp.Shutdown(context.Background()) assert.Error(t, err) assert.Equal(t, err, spErr) + assert.True(t, stp.isShutdown) } func TestFailedProcessorsShutdown(t *testing.T) { @@ -94,6 +97,7 @@ func TestFailedProcessorsShutdown(t *testing.T) { assert.EqualError(t, err, "basic span processor shutdown failure1; basic span processor shutdown failure2") assert.True(t, sp1.closed) assert.True(t, sp2.closed) + assert.True(t, stp.isShutdown) } func TestFailedProcessorShutdownInUnregister(t *testing.T) { @@ -110,6 +114,7 @@ func TestFailedProcessorShutdownInUnregister(t *testing.T) { err := stp.Shutdown(context.Background()) assert.NoError(t, err) + assert.True(t, stp.isShutdown) } func TestSchemaURL(t *testing.T) { @@ -122,6 +127,32 @@ func TestSchemaURL(t *testing.T) { assert.EqualValues(t, schemaURL, tracerStruct.instrumentationScope.SchemaURL) } +func TestRegisterAfterShutdownWithoutProcessors(t *testing.T) { + stp := NewTracerProvider() + err := stp.Shutdown(context.Background()) + assert.NoError(t, err) + assert.True(t, stp.isShutdown) + + sp := &basicSpanProcessor{} + stp.RegisterSpanProcessor(sp) // no-op + assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) +} + +func TestRegisterAfterShutdownWithProcessors(t *testing.T) { + stp := NewTracerProvider() + sp1 := &basicSpanProcessor{} + + stp.RegisterSpanProcessor(sp1) + err := stp.Shutdown(context.Background()) + assert.NoError(t, err) + assert.True(t, stp.isShutdown) + assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) + + sp2 := &basicSpanProcessor{} + stp.RegisterSpanProcessor(sp2) // no-op + assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) +} + func TestTracerProviderSamplerConfigFromEnv(t *testing.T) { type testCase struct { sampler string From 795ad971191b0bd7ff0d376a19b00e2e20f3b4b7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 22 Mar 2023 14:41:28 -0700 Subject: [PATCH 469/886] Revert "Move metric No-Op to metric/noop (#3893)" (#3921) * Revert "Move metric No-Op to `metric/noop` (#3893)" This reverts commit 3c75a44f8453739fb5fac865afe4923680701721. * Persist removal of NewNoopMeter --- CHANGELOG.md | 4 +- internal/global/instruments_test.go | 5 +- internal/global/meter_test.go | 7 +- internal/global/state_test.go | 5 +- metric/{noop => }/example_test.go | 9 +- metric/noop.go | 134 +++++++++++++++ metric/noop/noop.go | 246 ---------------------------- metric/noop/noop_test.go | 184 --------------------- metric/noop_test.go | 74 +++++++++ metric_test.go | 5 +- 10 files changed, 222 insertions(+), 451 deletions(-) rename metric/{noop => }/example_test.go (94%) create mode 100644 metric/noop.go delete mode 100644 metric/noop/noop.go delete mode 100644 metric/noop/noop_test.go create mode 100644 metric/noop_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bba4d3f40d..1df78d5f605 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,9 +26,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849) - The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853) - Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892) -- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3893) - - `NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` - - `NewNoopMeter` is replaced with `noop.NewMeterProvider().Meter("")` - Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) - Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895) - The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900) @@ -45,6 +42,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Use the added `float64` instrument configuration instead. (#3895) - The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. Use the added `int64` instrument configuration instead. (#3895) +- Remove `NewNoopMeter` from `go.opentelemetry.io/otel/metric`, use `NewMeterProvider.Meter("")` instead. (#3893) ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index 66fe8499cf0..4bbf23e0afc 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -21,7 +21,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/noop" ) func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { @@ -37,7 +36,7 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal } }() - setDelegate(noop.NewMeterProvider().Meter("")) + setDelegate(metric.NewNoopMeterProvider().Meter("")) close(finish) } @@ -54,7 +53,7 @@ func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), } }() - setDelegate(noop.NewMeterProvider().Meter("")) + setDelegate(metric.NewNoopMeterProvider().Meter("")) close(finish) } diff --git a/internal/global/meter_test.go b/internal/global/meter_test.go index 8a9341ab46e..b7b1ea9d8af 100644 --- a/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/noop" ) func TestMeterProviderRace(t *testing.T) { @@ -42,7 +41,7 @@ func TestMeterProviderRace(t *testing.T) { } }() - mp.setDelegate(noop.NewMeterProvider()) + mp.setDelegate(metric.NewNoopMeterProvider()) close(finish) } @@ -85,7 +84,7 @@ func TestMeterRace(t *testing.T) { }() wg.Wait() - mtr.setDelegate(noop.NewMeterProvider()) + mtr.setDelegate(metric.NewNoopMeterProvider()) close(finish) } @@ -114,7 +113,7 @@ func TestUnregisterRace(t *testing.T) { _ = reg.Unregister() wg.Wait() - mtr.setDelegate(noop.NewMeterProvider()) + mtr.setDelegate(metric.NewNoopMeterProvider()) close(finish) } diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 93bf6b8aae2..1b441660cf5 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -20,7 +20,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -153,7 +152,7 @@ func TestSetMeterProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { ResetForTest(t) - SetMeterProvider(noop.NewMeterProvider()) + SetMeterProvider(metric.NewNoopMeterProvider()) _, ok := MeterProvider().(*meterProvider) if ok { @@ -166,7 +165,7 @@ func TestSetMeterProvider(t *testing.T) { mp := MeterProvider() - SetMeterProvider(noop.NewMeterProvider()) + SetMeterProvider(metric.NewNoopMeterProvider()) dmp := mp.(*meterProvider) diff --git a/metric/noop/example_test.go b/metric/example_test.go similarity index 94% rename from metric/noop/example_test.go rename to metric/example_test.go index 06bc1fc874d..ef7f09019ee 100644 --- a/metric/noop/example_test.go +++ b/metric/example_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package noop_test +package metric_test import ( "context" @@ -23,13 +23,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/noop" ) //nolint:govet // Meter doesn't register for go vet func ExampleMeter_synchronous() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := noop.NewMeterProvider() + meterProvider := metric.NewNoopMeterProvider() workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", @@ -49,7 +48,7 @@ func ExampleMeter_synchronous() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_single() { // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := noop.NewMeterProvider() + meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") _, err := meter.Int64ObservableGauge( @@ -81,7 +80,7 @@ func ExampleMeter_asynchronous_single() { //nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_multiple() { - meterProvider := noop.NewMeterProvider() + meterProvider := metric.NewNoopMeterProvider() meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats diff --git a/metric/noop.go b/metric/noop.go new file mode 100644 index 00000000000..5d1b9d072f5 --- /dev/null +++ b/metric/noop.go @@ -0,0 +1,134 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/metric" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/instrument" +) + +// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. +func NewNoopMeterProvider() MeterProvider { + return noopMeterProvider{} +} + +type noopMeterProvider struct{} + +func (noopMeterProvider) Meter(string, ...MeterOption) Meter { + return noopMeter{} +} + +type noopMeter struct{} + +func (noopMeter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { + return nonrecordingSyncInt64Instrument{}, nil +} + +func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { + return nonrecordingSyncInt64Instrument{}, nil +} + +func (noopMeter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { + return nonrecordingSyncInt64Instrument{}, nil +} + +func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { + return nonrecordingAsyncInt64Instrument{}, nil +} + +func (noopMeter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { + return nonrecordingSyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { + return nonrecordingAsyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { + return nonrecordingAsyncFloat64Instrument{}, nil +} + +func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { + return nonrecordingAsyncFloat64Instrument{}, nil +} + +// RegisterCallback creates a register callback that does not record any metrics. +func (noopMeter) RegisterCallback(Callback, ...instrument.Observable) (Registration, error) { + return noopReg{}, nil +} + +type noopReg struct{} + +func (noopReg) Unregister() error { return nil } + +type nonrecordingAsyncFloat64Instrument struct { + instrument.Float64Observable +} + +var ( + _ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{} + _ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{} + _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{} +) + +type nonrecordingAsyncInt64Instrument struct { + instrument.Int64Observable +} + +var ( + _ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{} + _ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{} + _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} +) + +type nonrecordingSyncFloat64Instrument struct{} + +var ( + _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{} + _ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{} + _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{} +) + +func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {} +func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {} + +type nonrecordingSyncInt64Instrument struct{} + +var ( + _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{} + _ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{} + _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{} +) + +func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {} +func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {} diff --git a/metric/noop/noop.go b/metric/noop/noop.go deleted file mode 100644 index ce35983aaf8..00000000000 --- a/metric/noop/noop.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package noop provides an implementation of the OpenTelemetry API that -// produces no telemetry and minimizes used computation resources. -// -// The API implementation can be used to effectively disable OpenTelemetry. It -// can also be used as the embedded structs of other OpenTelemetry -// implementations. These alternate implementation that embed this noop -// implementation will default to no-action instead of panicking when methods -// are added to the OpenTelemetry API interfaces. -package noop // import "go.opentelemetry.io/otel/metric/noop" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" -) - -var ( - // Compile-time check this implements the OpenTelemetry API. - - _ metric.MeterProvider = MeterProvider{} - _ metric.Meter = Meter{} - _ metric.Observer = Observer{} - _ metric.Registration = Registration{} - _ instrument.Int64Counter = Int64Counter{} - _ instrument.Float64Counter = Float64Counter{} - _ instrument.Int64UpDownCounter = Int64UpDownCounter{} - _ instrument.Float64UpDownCounter = Float64UpDownCounter{} - _ instrument.Int64Histogram = Int64Histogram{} - _ instrument.Float64Histogram = Float64Histogram{} - _ instrument.Int64ObservableCounter = Int64ObservableCounter{} - _ instrument.Float64ObservableCounter = Float64ObservableCounter{} - _ instrument.Int64ObservableGauge = Int64ObservableGauge{} - _ instrument.Float64ObservableGauge = Float64ObservableGauge{} - _ instrument.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} - _ instrument.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} - _ instrument.Int64Observer = Int64Observer{} - _ instrument.Float64Observer = Float64Observer{} -) - -// MeterProvider is an OpenTelemetry No-Op MeterProvider. -type MeterProvider struct{} - -// NewMeterProvider returns a MeterProvider that does not record any telemetry. -func NewMeterProvider() MeterProvider { - return MeterProvider{} -} - -// Meter returns an OpenTelemetry Meter that does not record any telemetry. -func (MeterProvider) Meter(string, ...metric.MeterOption) metric.Meter { - return Meter{} -} - -// Meter is an OpenTelemetry No-Op Meter. -type Meter struct{} - -// Int64Counter returns a Counter used to record int64 measurements that -// produces no telemetry. -func (Meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { - return Int64Counter{}, nil -} - -// Int64UpDownCounter returns an UpDownCounter used to record int64 -// measurements that produces no telemetry. -func (Meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { - return Int64UpDownCounter{}, nil -} - -// Int64Histogram returns a Histogram used to record int64 measurements that -// produces no telemetry. -func (Meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { - return Int64Histogram{}, nil -} - -// Int64ObservableCounter returns an ObservableCounter used to record int64 -// measurements that produces no telemetry. -func (Meter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { - return Int64ObservableCounter{}, nil -} - -// Int64ObservableUpDownCounter returns an ObservableUpDownCounter used to -// record int64 measurements that produces no telemetry. -func (Meter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { - return Int64ObservableUpDownCounter{}, nil -} - -// Int64ObservableGauge returns an ObservableGauge used to record int64 -// measurements that produces no telemetry. -func (Meter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { - return Int64ObservableGauge{}, nil -} - -// Float64Counter returns a Counter used to record int64 measurements that -// produces no telemetry. -func (Meter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { - return Float64Counter{}, nil -} - -// Float64UpDownCounter returns an UpDownCounter used to record int64 -// measurements that produces no telemetry. -func (Meter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { - return Float64UpDownCounter{}, nil -} - -// Float64Histogram returns a Histogram used to record int64 measurements that -// produces no telemetry. -func (Meter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { - return Float64Histogram{}, nil -} - -// Float64ObservableCounter returns an ObservableCounter used to record int64 -// measurements that produces no telemetry. -func (Meter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { - return Float64ObservableCounter{}, nil -} - -// Float64ObservableUpDownCounter returns an ObservableUpDownCounter used to -// record int64 measurements that produces no telemetry. -func (Meter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { - return Float64ObservableUpDownCounter{}, nil -} - -// Float64ObservableGauge returns an ObservableGauge used to record int64 -// measurements that produces no telemetry. -func (Meter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { - return Float64ObservableGauge{}, nil -} - -// RegisterCallback performs no operation. -func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric.Registration, error) { - return Registration{}, nil -} - -// Observer acts as a recorder of measurements for multiple instruments in a -// Callback, it performing no operation. -type Observer struct{} - -// ObserveFloat64 performs no operation. -func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...attribute.KeyValue) { -} - -// ObserveInt64 performs no operation. -func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...attribute.KeyValue) { -} - -// Registration is the registration of a Callback with a No-Op Meter. -type Registration struct{} - -// Unregister unregisters the Callback the Registration represents with the -// No-Op Meter. This will always return nil because the No-Op Meter performs no -// operation, including hold any record of registrations. -func (Registration) Unregister() error { return nil } - -// Int64Counter is an OpenTelemetry Counter used to record int64 measurements. -// It produces no telemetry. -type Int64Counter struct{} - -// Add performs no operation. -func (Int64Counter) Add(context.Context, int64, ...attribute.KeyValue) {} - -// Float64Counter is an OpenTelemetry Counter used to record float64 -// measurements. It produces no telemetry. -type Float64Counter struct{} - -// Add performs no operation. -func (Float64Counter) Add(context.Context, float64, ...attribute.KeyValue) {} - -// Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 -// measurements. It produces no telemetry. -type Int64UpDownCounter struct{} - -// Add performs no operation. -func (Int64UpDownCounter) Add(context.Context, int64, ...attribute.KeyValue) {} - -// Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record -// float64 measurements. It produces no telemetry. -type Float64UpDownCounter struct{} - -// Add performs no operation. -func (Float64UpDownCounter) Add(context.Context, float64, ...attribute.KeyValue) {} - -// Int64Histogram is an OpenTelemetry Histogram used to record int64 -// measurements. It produces no telemetry. -type Int64Histogram struct{} - -// Record performs no operation. -func (Int64Histogram) Record(context.Context, int64, ...attribute.KeyValue) {} - -// Float64Histogram is an OpenTelemetry Histogram used to record float64 -// measurements. It produces no telemetry. -type Float64Histogram struct{} - -// Record performs no operation. -func (Float64Histogram) Record(context.Context, float64, ...attribute.KeyValue) {} - -// Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record -// int64 measurements. It produces no telemetry. -type Int64ObservableCounter struct{ instrument.Int64Observable } - -// Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record -// float64 measurements. It produces no telemetry. -type Float64ObservableCounter struct{ instrument.Float64Observable } - -// Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record -// int64 measurements. It produces no telemetry. -type Int64ObservableGauge struct{ instrument.Int64Observable } - -// Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record -// float64 measurements. It produces no telemetry. -type Float64ObservableGauge struct{ instrument.Float64Observable } - -// Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter -// used to record int64 measurements. It produces no telemetry. -type Int64ObservableUpDownCounter struct{ instrument.Int64Observable } - -// Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter -// used to record float64 measurements. It produces no telemetry. -type Float64ObservableUpDownCounter struct{ instrument.Float64Observable } - -// Int64Observer is a recorder of int64 measurements that performs no operation. -type Int64Observer struct{} - -// Observe performs no operation. -func (Int64Observer) Observe(int64, ...attribute.KeyValue) {} - -// Float64Observer is a recorder of float64 measurements that performs no -// operation. -type Float64Observer struct{} - -// Observe performs no operation. -func (Float64Observer) Observe(float64, ...attribute.KeyValue) {} diff --git a/metric/noop/noop_test.go b/metric/noop/noop_test.go deleted file mode 100644 index 412ee6d957e..00000000000 --- a/metric/noop/noop_test.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package noop // import "go.opentelemetry.io/otel/metric/noop" - -import ( - "context" - "reflect" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" -) - -func TestImplementationNoPanics(t *testing.T) { - // Check that if type has an embedded interface and that interface has - // methods added to it than the No-Op implementation implements them. - t.Run("MeterProvider", assertAllExportedMethodNoPanic( - reflect.ValueOf(MeterProvider{}), - reflect.TypeOf((*metric.MeterProvider)(nil)).Elem(), - )) - t.Run("Meter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Meter{}), - reflect.TypeOf((*metric.Meter)(nil)).Elem(), - )) - t.Run("Observer", assertAllExportedMethodNoPanic( - reflect.ValueOf(Observer{}), - reflect.TypeOf((*metric.Observer)(nil)).Elem(), - )) - t.Run("Registration", assertAllExportedMethodNoPanic( - reflect.ValueOf(Registration{}), - reflect.TypeOf((*metric.Registration)(nil)).Elem(), - )) - t.Run("Int64Counter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64Counter{}), - reflect.TypeOf((*instrument.Int64Counter)(nil)).Elem(), - )) - t.Run("Float64Counter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64Counter{}), - reflect.TypeOf((*instrument.Float64Counter)(nil)).Elem(), - )) - t.Run("Int64UpDownCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64UpDownCounter{}), - reflect.TypeOf((*instrument.Int64UpDownCounter)(nil)).Elem(), - )) - t.Run("Float64UpDownCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64UpDownCounter{}), - reflect.TypeOf((*instrument.Float64UpDownCounter)(nil)).Elem(), - )) - t.Run("Int64Histogram", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64Histogram{}), - reflect.TypeOf((*instrument.Int64Histogram)(nil)).Elem(), - )) - t.Run("Float64Histogram", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64Histogram{}), - reflect.TypeOf((*instrument.Float64Histogram)(nil)).Elem(), - )) - t.Run("Int64ObservableCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64ObservableCounter{}), - reflect.TypeOf((*instrument.Int64ObservableCounter)(nil)).Elem(), - )) - t.Run("Float64ObservableCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64ObservableCounter{}), - reflect.TypeOf((*instrument.Float64ObservableCounter)(nil)).Elem(), - )) - t.Run("Int64ObservableGauge", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64ObservableGauge{}), - reflect.TypeOf((*instrument.Int64ObservableGauge)(nil)).Elem(), - )) - t.Run("Float64ObservableGauge", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64ObservableGauge{}), - reflect.TypeOf((*instrument.Float64ObservableGauge)(nil)).Elem(), - )) - t.Run("Int64ObservableUpDownCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64ObservableUpDownCounter{}), - reflect.TypeOf((*instrument.Int64ObservableUpDownCounter)(nil)).Elem(), - )) - t.Run("Float64ObservableUpDownCounter", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64ObservableUpDownCounter{}), - reflect.TypeOf((*instrument.Float64ObservableUpDownCounter)(nil)).Elem(), - )) - t.Run("Int64Observer", assertAllExportedMethodNoPanic( - reflect.ValueOf(Int64Observer{}), - reflect.TypeOf((*instrument.Int64Observer)(nil)).Elem(), - )) - t.Run("Float64Observer", assertAllExportedMethodNoPanic( - reflect.ValueOf(Float64Observer{}), - reflect.TypeOf((*instrument.Float64Observer)(nil)).Elem(), - )) -} - -func assertAllExportedMethodNoPanic(rVal reflect.Value, rType reflect.Type) func(*testing.T) { - return func(t *testing.T) { - for n := 0; n < rType.NumMethod(); n++ { - mType := rType.Method(n) - if !mType.IsExported() { - t.Logf("ignoring unexported %s", mType.Name) - continue - } - m := rVal.MethodByName(mType.Name) - if !m.IsValid() { - t.Errorf("unknown method for %s: %s", rVal.Type().Name(), mType.Name) - } - - numIn := mType.Type.NumIn() - if mType.Type.IsVariadic() { - numIn-- - } - args := make([]reflect.Value, numIn) - for i := range args { - aType := mType.Type.In(i) - args[i] = reflect.New(aType).Elem() - } - - assert.NotPanicsf(t, func() { - _ = m.Call(args) - }, "%s.%s", rVal.Type().Name(), mType.Name) - } - } -} - -func TestNewMeterProvider(t *testing.T) { - mp := NewMeterProvider() - assert.Equal(t, mp, MeterProvider{}) - meter := mp.Meter("") - assert.Equal(t, meter, Meter{}) -} - -func TestSyncFloat64(t *testing.T) { - meter := NewMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Float64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1.0, attribute.String("key", "value")) - }) -} - -func TestSyncInt64(t *testing.T) { - meter := NewMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Int64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1, attribute.String("key", "value")) - }) -} diff --git a/metric/noop_test.go b/metric/noop_test.go new file mode 100644 index 00000000000..59695ccd5bc --- /dev/null +++ b/metric/noop_test.go @@ -0,0 +1,74 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" +) + +func TestNewNoopMeterProvider(t *testing.T) { + mp := NewNoopMeterProvider() + assert.Equal(t, mp, noopMeterProvider{}) + meter := mp.Meter("") + assert.Equal(t, meter, noopMeter{}) +} + +func TestSyncFloat64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.Float64Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Float64UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1.0, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Float64Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1.0, attribute.String("key", "value")) + }) +} + +func TestSyncInt64(t *testing.T) { + meter := NewNoopMeterProvider().Meter("test instrumentation") + assert.NotPanics(t, func() { + inst, err := meter.Int64Counter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), 1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Int64UpDownCounter("test instrument") + require.NoError(t, err) + inst.Add(context.Background(), -1, attribute.String("key", "value")) + }) + + assert.NotPanics(t, func() { + inst, err := meter.Int64Histogram("test instrument") + require.NoError(t, err) + inst.Record(context.Background(), 1, attribute.String("key", "value")) + }) +} diff --git a/metric_test.go b/metric_test.go index cc6f72d76f0..646bb108368 100644 --- a/metric_test.go +++ b/metric_test.go @@ -20,7 +20,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" ) type testMeterProvider struct{} @@ -28,12 +27,12 @@ type testMeterProvider struct{} var _ metric.MeterProvider = &testMeterProvider{} func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter { - return noop.NewMeterProvider().Meter("") + return metric.NewNoopMeterProvider().Meter("") } func TestMultipleGlobalMeterProvider(t *testing.T) { p1 := testMeterProvider{} - p2 := noop.NewMeterProvider() + p2 := metric.NewNoopMeterProvider() SetMeterProvider(&p1) SetMeterProvider(p2) From 68d66f209665895d62b88ec5449939506ba8d6df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 23 Mar 2023 15:38:12 +0100 Subject: [PATCH 470/886] Add missing doc comments for Observer interfaces (#3928) --- metric/instrument/asyncfloat64.go | 1 + metric/instrument/asyncint64.go | 1 + 2 files changed, 2 insertions(+) diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index e9ef2be262c..cf0008e61f3 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -180,6 +180,7 @@ type Float64ObservableGaugeOption interface { // // Warning: methods may be added to this interface in minor releases. type Float64Observer interface { + // Observe records the float64 value with attributes. Observe(value float64, attributes ...attribute.KeyValue) } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index e1f843ee367..752dcea0a1e 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -179,6 +179,7 @@ type Int64ObservableGaugeOption interface { // // Warning: methods may be added to this interface in minor releases. type Int64Observer interface { + // Observe records the int64 value with attributes. Observe(value int64, attributes ...attribute.KeyValue) } From 7ad0ae4da145ca7c1161e61dce318f7acc2ecabd Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 23 Mar 2023 07:47:46 -0700 Subject: [PATCH 471/886] Release v1.15.0-rc.2/v0.38.0-rc.2 (#3923) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump versions * Prepare stable-v1 for version v1.15.0-rc.2 * Prepare experimental-metrics for version v0.38.0-rc.2 * Update changelog * Update CHANGELOG.md Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 11 +++++++++-- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/jaeger/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 14 +++++++------- example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/jaeger/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlptrace/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 12 ++++++------ exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 2 +- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 32 files changed, 152 insertions(+), 145 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df78d5f605..fd07856f0a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 + +This is a release candidate for the v1.15.0/v0.38.0 release. +That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ### Added - The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812) @@ -42,7 +48,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Use the added `float64` instrument configuration instead. (#3895) - The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`. Use the added `int64` instrument configuration instead. (#3895) -- Remove `NewNoopMeter` from `go.opentelemetry.io/otel/metric`, use `NewMeterProvider.Meter("")` instead. (#3893) +- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893) ## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01 @@ -2372,7 +2378,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0-rc.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0-rc.2...HEAD +[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 [1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 [1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 [1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 23afed8717b..4a1c53649c9 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 3c1f5cecea9..83cd76a5593 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 3aae6a5fd64..f5ea94ba4be 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 5534a012011..e0a1bd84e8b 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/bridge/opentracing v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/bridge/opentracing v1.15.0-rc.2 google.golang.org/grpc v1.53.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index ebcd41898f9..eedfddf00a7 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index e1ce757137b..6e2e1a7a996 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,16 +9,16 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/jaeger v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/jaeger v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 70c717aac20..aa5628f3f86 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 15bef4a21f7..2775976f6e6 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.2 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0-rc.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 27d6738bb92..67a93459bed 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 google.golang.org/grpc v1.53.0 ) @@ -21,9 +21,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index b79d09fe464..d240c0b2e92 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 046b7f0420b..9dc3ea70cc8 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.1 - go.opentelemetry.io/otel/metric v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 871ed17bf9f..4e663229695 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.14.0 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.1 - go.opentelemetry.io/otel/metric v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 74075289662..b443c7feb63 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/zipkin v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/zipkin v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index bb80b66c47a..fb6205757b6 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,16 +7,16 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 2192fa7c0b5..27d04674003 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.30.0 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 700b48fe444..9a72d522d1b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.53.0 @@ -25,9 +25,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b4803c6fc20..594b78858c6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -23,9 +23,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 0f2c9ec0b8e..91ed4562ff2 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.30.0 @@ -22,7 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index e0a9ea52f93..dce2c04af3c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,8 +23,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 7685395a4df..d5df0a373bf 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.7.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.7.0 // indirect diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 2e5250e8808..77b9b139194 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/metric v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 google.golang.org/protobuf v1.30.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 195f5126c3b..77db1ac245b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 741945fba49..52b6eac798d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 929c4c7a6d5..47b8a22af3b 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index c04fd406a78..40317d366b7 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 5fa0c60421a..11e8c47ce31 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 ) require ( diff --git a/sdk/go.mod b/sdk/go.mod index 770e426aa34..8a0c30b7e2d 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.3 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/trace v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0-rc.2 golang.org/x/sys v0.6.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 079bd3b1d92..e797647ece2 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/go-logr/logr v1.2.3 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 - go.opentelemetry.io/otel/metric v1.15.0-rc.1 - go.opentelemetry.io/otel/sdk v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 + go.opentelemetry.io/otel/sdk v1.15.0-rc.2 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/trace/go.mod b/trace/go.mod index 8caad2f14f9..1e9ab759e85 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.1 + go.opentelemetry.io/otel v1.15.0-rc.2 ) require ( diff --git a/version.go b/version.go index 080638e08ea..6ceb10c8d7c 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.15.0-rc.1" + return "1.15.0-rc.2" } diff --git a/versions.yaml b/versions.yaml index eea6b18289d..697e5ea218b 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.15.0-rc.1 + version: v1.15.0-rc.2 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -36,7 +36,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.38.0-rc.1 + version: v0.38.0-rc.2 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 22cfa14850a88fa09eb7cc3eaf5e8a8324c2b190 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Fri, 24 Mar 2023 15:48:10 +0100 Subject: [PATCH 472/886] use go 1.20 as the default version, not 1.2 (#3929) Co-authored-by: Anthony Mirabella --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1926474795e..385f84f5165 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: 1.20 + DEFAULT_GO_VERSION: "1.20" jobs: benchmark: name: Benchmarks From de497def8741f5161d24fab8b307adcf5030582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 24 Mar 2023 16:00:18 +0100 Subject: [PATCH 473/886] metric: Refactor examples to use otel.Meter (#3927) * Refactor examples in go.opentelemetry.io/otel/metric to use otel.Meter * add comment * go mod tidy --------- Co-authored-by: Tyler Yahn --- metric/example_test.go | 18 +++++------------- metric/go.mod | 3 +++ metric/go.sum | 5 +++++ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/metric/example_test.go b/metric/example_test.go index ef7f09019ee..c909410e9e4 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -20,17 +20,15 @@ import ( "runtime" "time" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" ) -//nolint:govet // Meter doesn't register for go vet func ExampleMeter_synchronous() { - // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := metric.NewNoopMeterProvider() - - workDuration, err := meterProvider.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( + // Create a histogram using the global MeterProvider. + workDuration, err := otel.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", instrument.WithUnit("ms")) if err != nil { @@ -45,11 +43,8 @@ func ExampleMeter_synchronous() { workDuration.Record(ctx, time.Since(startTime).Milliseconds()) } -//nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_single() { - // In a library or program this would be provided by otel.GetMeterProvider(). - meterProvider := metric.NewNoopMeterProvider() - meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#AsyncExample") + meter := otel.Meter("go.opentelemetry.io/otel/metric#AsyncExample") _, err := meter.Int64ObservableGauge( "DiskUsage", @@ -78,10 +73,8 @@ func ExampleMeter_asynchronous_single() { } } -//nolint:govet // Meter doesn't register for go vet func ExampleMeter_asynchronous_multiple() { - meterProvider := metric.NewNoopMeterProvider() - meter := meterProvider.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") + meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") @@ -104,7 +97,6 @@ func ExampleMeter_asynchronous_multiple() { heapAlloc, gcCount, ) - if err != nil { fmt.Println("Failed to register callback") panic(err) diff --git a/metric/go.mod b/metric/go.mod index 11e8c47ce31..20ac94f128a 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,7 +9,10 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/metric/go.sum b/metric/go.sum index ba5717f6a3d..30515f028a5 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,6 +1,11 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= From b73a33c48779e918f7217ce9deea8bbd3ba73a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Bonzi=20da=20Concei=C3=A7=C3=A3o?= Date: Fri, 24 Mar 2023 12:29:52 -0300 Subject: [PATCH 474/886] Warn on intitialization of Simple SpanProcessor (#3854) * add warning log about using simpleSpanProcessor in production * add changelog entry * fix changelog * switch to using the new Warn logging function * revert alignment formatting in changelog --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/simple_span_processor.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd07856f0a7..514dbd447ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849) - Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) - The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) +- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) ### Changed diff --git a/sdk/trace/simple_span_processor.go b/sdk/trace/simple_span_processor.go index e8530a95932..c3bb7f9ea9c 100644 --- a/sdk/trace/simple_span_processor.go +++ b/sdk/trace/simple_span_processor.go @@ -19,6 +19,7 @@ import ( "sync" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/internal/global" ) // simpleSpanProcessor is a SpanProcessor that synchronously sends all @@ -43,6 +44,8 @@ func NewSimpleSpanProcessor(exporter SpanExporter) SpanProcessor { ssp := &simpleSpanProcessor{ exporter: exporter, } + global.Warn("SimpleSpanProcessor is not recommended for production use, consider using BatchSpanProcessor instead.") + return ssp } From 42594a1bd0b7616d9ad03fa62fef5b4895b8da54 Mon Sep 17 00:00:00 2001 From: TotomiEcio <63461656+TotomiEcio@users.noreply.github.com> Date: Fri, 24 Mar 2023 13:32:31 -0300 Subject: [PATCH 475/886] Typo in getting-started.md (#3931) Co-authored-by: Tyler Yahn --- website_docs/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index 8c8c567ecb8..c8327f133c9 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -190,7 +190,7 @@ With the imports added, you can start instrumenting. The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These [`Tracer`]s are designed to be associated with one instrumentation library. That way telemetry they produce can be understood to come from that part of a code -base. To uniquely identify your application to the [`Tracer`] you will use +base. To uniquely identify your application to the [`Tracer`] you will create a constant with the package name in `app.go`. ```go From 89e383fa1c9cf03c746e500a914c1e7fee77315e Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:37:39 -0700 Subject: [PATCH 476/886] dependabot updates Sun Mar 26 14:29:19 UTC 2023 (#3939) Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /exporters/otlp/otlptrace Bump github.com/golangci/golangci-lint from 1.52.0 to 1.52.2 in /internal/tools Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.53.0 to 1.54.0 in /example/otel-collector --- bridge/opentracing/test/go.mod | 6 +++--- bridge/opentracing/test/go.sum | 12 ++++++------ example/otel-collector/go.mod | 6 +++--- example/otel-collector/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 12 ++++++------ exporters/otlp/otlptrace/go.mod | 6 +++--- exporters/otlp/otlptrace/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/go.sum | 12 ++++++------ internal/tools/go.mod | 4 ++-- internal/tools/go.sum | 8 ++++---- 18 files changed, 78 insertions(+), 78 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index e0a1bd84e8b..7ba891e13a2 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/bridge/opentracing v1.15.0-rc.2 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 ) require ( @@ -25,9 +25,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 7f0a8c2a444..5e14da80a44 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -40,16 +40,16 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -58,8 +58,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 67a93459bed..26ad708b027 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0-rc.2 go.opentelemetry.io/otel/sdk v1.15.0-rc.2 go.opentelemetry.io/otel/trace v1.15.0-rc.2 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 ) require ( @@ -25,9 +25,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index bc61eaad2c4..98b0e3f6a6d 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -221,8 +221,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -274,8 +274,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -394,8 +394,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 27d04674003..bc15434ca7e 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.2 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 ) @@ -24,9 +24,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 3ad22fa3ef8..99e27b232c5 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 9a72d522d1b..c2fa7ecc4fc 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 ) @@ -28,9 +28,9 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 3ad22fa3ef8..99e27b232c5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 594b78858c6..1199af52e54 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -26,11 +26,11 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.53.0 // indirect + google.golang.org/grpc v1.54.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 3ad22fa3ef8..99e27b232c5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 91ed4562ff2..fdaf056fac8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.2 go.opentelemetry.io/otel/trace v1.15.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 ) @@ -23,9 +23,9 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 3ad22fa3ef8..99e27b232c5 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -229,8 +229,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -282,8 +282,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -402,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index dce2c04af3c..b0260af2000 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f - google.golang.org/grpc v1.53.0 + google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 ) @@ -25,9 +25,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 5931cc52587..88dad9cce31 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -230,8 +230,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -283,8 +283,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -403,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index d5df0a373bf..e3cab45e7bb 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -22,11 +22,11 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/net v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.53.0 // indirect + google.golang.org/grpc v1.54.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index c15b86e7560..845833c2eaf 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -228,8 +228,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -281,8 +281,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -401,8 +401,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 75aec828553..7c441924775 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.52.0 + github.com/golangci/golangci-lint v1.52.2 github.com/itchyny/gojq v0.12.12 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -124,7 +124,7 @@ require ( github.com/mgechev/revive v1.3.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moricho/tparallel v0.3.0 // indirect + github.com/moricho/tparallel v0.3.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.9.5 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index fa64e7fdbbe..186f749565b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -241,8 +241,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.52.0 h1:T7w3tuF1goz64qGV+ML4MgysSl/yUfA3UZJK92oE48A= -github.com/golangci/golangci-lint v1.52.0/go.mod h1:wlTh+d/oVlgZC2yCe6nlxrxNAnuhEQC0Zdygoh72Uak= +github.com/golangci/golangci-lint v1.52.2 h1:FrPElUUI5rrHXg1mQ7KxI1MXPAw5lBVskiz7U7a8a1A= +github.com/golangci/golangci-lint v1.52.2/go.mod h1:S5fhC5sHM5kE22/HcATKd1XLWQxX+y7mHj8B5H91Q/0= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -417,8 +417,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/moricho/tparallel v0.3.0 h1:8dDx3S3e+jA+xiQXC7O3dvfRTe/J+FYlTDDW01Y7z/Q= -github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= +github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= +github.com/moricho/tparallel v0.3.1/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= From ae90c4402e70e52b021265d7a8a7e72706e7e67c Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 27 Mar 2023 18:38:47 +0200 Subject: [PATCH 477/886] switch atomic.Value to atomic.Pointer for spanProcessorStates (#3926) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- sdk/trace/provider.go | 18 +++++++++--------- sdk/trace/provider_test.go | 6 +++--- sdk/trace/span.go | 2 +- sdk/trace/tracer.go | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 0636c780736..e152c63b6ab 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -75,7 +75,7 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} { type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Scope]*tracer - spanProcessors atomic.Value + spanProcessors atomic.Pointer[spanProcessorStates] isShutdown bool // These fields are not protected by the lock mu. They are assumed to be @@ -123,7 +123,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { for _, sp := range o.processors { spss = append(spss, newSpanProcessorState(sp)) } - tp.spanProcessors.Store(spss) + tp.spanProcessors.Store(&spss) return tp } @@ -168,9 +168,9 @@ func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { return } newSPS := spanProcessorStates{} - newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...) + newSPS = append(newSPS, *(p.spanProcessors.Load())...) newSPS = append(newSPS, newSpanProcessorState(sp)) - p.spanProcessors.Store(newSPS) + p.spanProcessors.Store(&newSPS) } // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. @@ -180,7 +180,7 @@ func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { if p.isShutdown { return } - old := p.spanProcessors.Load().(spanProcessorStates) + old := *(p.spanProcessors.Load()) if len(old) == 0 { return } @@ -209,13 +209,13 @@ func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { spss[len(spss)-1] = nil spss = spss[:len(spss)-1] - p.spanProcessors.Store(spss) + p.spanProcessors.Store(&spss) } // ForceFlush immediately exports all spans that have not yet been exported for // all the registered span processors. func (p *TracerProvider) ForceFlush(ctx context.Context) error { - spss := p.spanProcessors.Load().(spanProcessorStates) + spss := *(p.spanProcessors.Load()) if len(spss) == 0 { return nil } @@ -243,7 +243,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { return nil } p.isShutdown = true - spss := p.spanProcessors.Load().(spanProcessorStates) + spss := *(p.spanProcessors.Load()) var retErr error for _, sps := range spss { @@ -266,7 +266,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { } } } - p.spanProcessors.Store(spanProcessorStates{}) + p.spanProcessors.Store(&spanProcessorStates{}) return retErr } diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 5d984ff3b86..327212fc9f7 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -135,7 +135,7 @@ func TestRegisterAfterShutdownWithoutProcessors(t *testing.T) { sp := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp) // no-op - assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) + assert.Empty(t, stp.spanProcessors.Load()) } func TestRegisterAfterShutdownWithProcessors(t *testing.T) { @@ -146,11 +146,11 @@ func TestRegisterAfterShutdownWithProcessors(t *testing.T) { err := stp.Shutdown(context.Background()) assert.NoError(t, err) assert.True(t, stp.isShutdown) - assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) + assert.Empty(t, stp.spanProcessors.Load()) sp2 := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp2) // no-op - assert.Empty(t, stp.spanProcessors.Load().(spanProcessorStates)) + assert.Empty(t, stp.spanProcessors.Load()) } func TestTracerProviderSamplerConfigFromEnv(t *testing.T) { diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 9fb483a99fe..81e89122fa2 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -410,7 +410,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { } s.mu.Unlock() - sps := s.tracer.provider.spanProcessors.Load().(spanProcessorStates) + sps := *(s.tracer.provider.spanProcessors.Load()) if len(sps) == 0 { return } diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index f17d924b89e..16e0108f085 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -51,7 +51,7 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanS s := tr.newSpan(ctx, name, &config) if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() { - sps := tr.provider.spanProcessors.Load().(spanProcessorStates) + sps := *(tr.provider.spanProcessors.Load()) for _, sp := range sps { sp.sp.OnStart(ctx, rw) } From c4940f3b4397f8b250d0c76d6f41a10ec1f17611 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Tue, 28 Mar 2023 11:05:44 +1100 Subject: [PATCH 478/886] TracerProvider allows calling Tracer() while it's shutting down (#3924) --- CHANGELOG.md | 5 +++ sdk/trace/provider.go | 65 +++++++++++++++++++++++++++++--------- sdk/trace/provider_test.go | 41 ++++++++++++++++++++---- 3 files changed, 89 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 514dbd447ad..a7fe4cd3251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- `TracerProvider` allows calling `Tracer()` while it's shutting down. + It used to deadlock. (#3924) + ## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 This is a release candidate for the v1.15.0/v0.38.0 release. diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index e152c63b6ab..324b686f4b8 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -76,7 +76,8 @@ type TracerProvider struct { mu sync.Mutex namedTracer map[instrumentation.Scope]*tracer spanProcessors atomic.Pointer[spanProcessorStates] - isShutdown bool + + isShutdown atomic.Bool // These fields are not protected by the lock mu. They are assumed to be // immutable after creation of the TracerProvider. @@ -136,10 +137,11 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { // // This method is safe to be called concurrently. func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { + // This check happens before the mutex is acquired to avoid deadlocking if Tracer() is called from within Shutdown(). + if p.isShutdown.Load() { + return trace.NewNoopTracerProvider().Tracer(name, opts...) + } c := trace.NewTracerConfig(opts...) - - p.mu.Lock() - defer p.mu.Unlock() if name == "" { name = defaultTracerName } @@ -148,23 +150,46 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T Version: c.InstrumentationVersion(), SchemaURL: c.SchemaURL(), } - t, ok := p.namedTracer[is] - if !ok { - t = &tracer{ - provider: p, - instrumentationScope: is, + + t, ok := func() (trace.Tracer, bool) { + p.mu.Lock() + defer p.mu.Unlock() + // Must check the flag after acquiring the mutex to avoid returning a valid tracer if Shutdown() ran + // after the first check above but before we acquired the mutex. + if p.isShutdown.Load() { + return trace.NewNoopTracerProvider().Tracer(name, opts...), true + } + t, ok := p.namedTracer[is] + if !ok { + t = &tracer{ + provider: p, + instrumentationScope: is, + } + p.namedTracer[is] = t } - p.namedTracer[is] = t - global.Info("Tracer created", "name", name, "version", c.InstrumentationVersion(), "schemaURL", c.SchemaURL()) + return t, ok + }() + if !ok { + // This code is outside the mutex to not hold the lock while calling third party logging code: + // - That code may do slow things like I/O, which would prolong the duration the lock is held, + // slowing down all tracing consumers. + // - Logging code may be instrumented with tracing and deadlock because it could try + // acquiring the same non-reentrant mutex. + global.Info("Tracer created", "name", name, "version", is.Version, "schemaURL", is.SchemaURL) } return t } // RegisterSpanProcessor adds the given SpanProcessor to the list of SpanProcessors. func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { + // This check prevents calls during a shutdown. + if p.isShutdown.Load() { + return + } p.mu.Lock() defer p.mu.Unlock() - if p.isShutdown { + // This check prevents calls after a shutdown. + if p.isShutdown.Load() { return } newSPS := spanProcessorStates{} @@ -175,9 +200,14 @@ func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { // UnregisterSpanProcessor removes the given SpanProcessor from the list of SpanProcessors. func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { + // This check prevents calls during a shutdown. + if p.isShutdown.Load() { + return + } p.mu.Lock() defer p.mu.Unlock() - if p.isShutdown { + // This check prevents calls after a shutdown. + if p.isShutdown.Load() { return } old := *(p.spanProcessors.Load()) @@ -236,13 +266,18 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error { // Shutdown shuts down TracerProvider. All registered span processors are shut down // in the order they were registered and any held computational resources are released. +// After Shutdown is called, all methods are no-ops. func (p *TracerProvider) Shutdown(ctx context.Context) error { + // This check prevents deadlocks in case of recursive shutdown. + if p.isShutdown.Load() { + return nil + } p.mu.Lock() defer p.mu.Unlock() - if p.isShutdown { + // This check prevents calls after a shutdown has already been done concurrently. + if !p.isShutdown.CompareAndSwap(false, true) { // did toggle? return nil } - p.isShutdown = true spss := *(p.spanProcessors.Load()) var retErr error diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 327212fc9f7..282cd16ee67 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -46,11 +46,38 @@ func (t *basicSpanProcessor) ForceFlush(context.Context) error { return nil } +type shutdownSpanProcessor struct { + shutdown func(context.Context) error +} + +func (t *shutdownSpanProcessor) Shutdown(ctx context.Context) error { + return t.shutdown(ctx) +} + +func (t *shutdownSpanProcessor) OnStart(context.Context, ReadWriteSpan) {} +func (t *shutdownSpanProcessor) OnEnd(ReadOnlySpan) {} +func (t *shutdownSpanProcessor) ForceFlush(context.Context) error { + return nil +} + +func TestShutdownCallsTracerMethod(t *testing.T) { + stp := NewTracerProvider() + sp := &shutdownSpanProcessor{ + shutdown: func(ctx context.Context) error { + _ = stp.Tracer("abc") // must not deadlock + return nil + }, + } + stp.RegisterSpanProcessor(sp) + assert.NoError(t, stp.Shutdown(context.Background())) + assert.True(t, stp.isShutdown.Load()) +} + func TestForceFlushAndShutdownTraceProviderWithoutProcessor(t *testing.T) { stp := NewTracerProvider() assert.NoError(t, stp.ForceFlush(context.Background())) assert.NoError(t, stp.Shutdown(context.Background())) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) } func TestShutdownTraceProvider(t *testing.T) { @@ -61,7 +88,7 @@ func TestShutdownTraceProvider(t *testing.T) { assert.NoError(t, stp.ForceFlush(context.Background())) assert.True(t, sp.flushed, "error ForceFlush basicSpanProcessor") assert.NoError(t, stp.Shutdown(context.Background())) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) assert.True(t, sp.closed, "error Shutdown basicSpanProcessor") } @@ -76,7 +103,7 @@ func TestFailedProcessorShutdown(t *testing.T) { err := stp.Shutdown(context.Background()) assert.Error(t, err) assert.Equal(t, err, spErr) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) } func TestFailedProcessorsShutdown(t *testing.T) { @@ -97,7 +124,7 @@ func TestFailedProcessorsShutdown(t *testing.T) { assert.EqualError(t, err, "basic span processor shutdown failure1; basic span processor shutdown failure2") assert.True(t, sp1.closed) assert.True(t, sp2.closed) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) } func TestFailedProcessorShutdownInUnregister(t *testing.T) { @@ -114,7 +141,7 @@ func TestFailedProcessorShutdownInUnregister(t *testing.T) { err := stp.Shutdown(context.Background()) assert.NoError(t, err) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) } func TestSchemaURL(t *testing.T) { @@ -131,7 +158,7 @@ func TestRegisterAfterShutdownWithoutProcessors(t *testing.T) { stp := NewTracerProvider() err := stp.Shutdown(context.Background()) assert.NoError(t, err) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) sp := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp) // no-op @@ -145,7 +172,7 @@ func TestRegisterAfterShutdownWithProcessors(t *testing.T) { stp.RegisterSpanProcessor(sp1) err := stp.Shutdown(context.Background()) assert.NoError(t, err) - assert.True(t, stp.isShutdown) + assert.True(t, stp.isShutdown.Load()) assert.Empty(t, stp.spanProcessors.Load()) sp2 := &basicSpanProcessor{} From 63a0f51c2daf36e046fa216acc652a93a1c44a10 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 29 Mar 2023 08:05:07 -0700 Subject: [PATCH 479/886] Move metric No-Op to `metric/noop` (#3941) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Revert "Move metric No-Op to metric/noop (#3893)" (#3921)" This reverts commit 795ad971191b0bd7ff0d376a19b00e2e20f3b4b7. * Add PR number * Move example_test back to `otel/metric` * Update CHANGELOG.md Co-authored-by: Robert Pająk * Remove redundant panic tests * Update noop pkg docs --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 5 + internal/global/instruments_test.go | 5 +- internal/global/meter_test.go | 7 +- internal/global/state_test.go | 5 +- metric/noop.go | 134 --------------- metric/noop/noop.go | 247 ++++++++++++++++++++++++++++ metric/noop/noop_test.go | 139 ++++++++++++++++ metric/noop_test.go | 74 --------- metric_test.go | 5 +- 9 files changed, 404 insertions(+), 217 deletions(-) delete mode 100644 metric/noop.go create mode 100644 metric/noop/noop.go create mode 100644 metric/noop/noop_test.go delete mode 100644 metric/noop_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a7fe4cd3251..81cb801b078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) + - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` + ### Fixed - `TracerProvider` allows calling `Tracer()` while it's shutting down. diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index 4bbf23e0afc..66fe8499cf0 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -21,6 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/noop" ) func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { @@ -36,7 +37,7 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal } }() - setDelegate(metric.NewNoopMeterProvider().Meter("")) + setDelegate(noop.NewMeterProvider().Meter("")) close(finish) } @@ -53,7 +54,7 @@ func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), } }() - setDelegate(metric.NewNoopMeterProvider().Meter("")) + setDelegate(noop.NewMeterProvider().Meter("")) close(finish) } diff --git a/internal/global/meter_test.go b/internal/global/meter_test.go index b7b1ea9d8af..8a9341ab46e 100644 --- a/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -25,6 +25,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/noop" ) func TestMeterProviderRace(t *testing.T) { @@ -41,7 +42,7 @@ func TestMeterProviderRace(t *testing.T) { } }() - mp.setDelegate(metric.NewNoopMeterProvider()) + mp.setDelegate(noop.NewMeterProvider()) close(finish) } @@ -84,7 +85,7 @@ func TestMeterRace(t *testing.T) { }() wg.Wait() - mtr.setDelegate(metric.NewNoopMeterProvider()) + mtr.setDelegate(noop.NewMeterProvider()) close(finish) } @@ -113,7 +114,7 @@ func TestUnregisterRace(t *testing.T) { _ = reg.Unregister() wg.Wait() - mtr.setDelegate(metric.NewNoopMeterProvider()) + mtr.setDelegate(noop.NewMeterProvider()) close(finish) } diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 1b441660cf5..93bf6b8aae2 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -152,7 +153,7 @@ func TestSetMeterProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { ResetForTest(t) - SetMeterProvider(metric.NewNoopMeterProvider()) + SetMeterProvider(noop.NewMeterProvider()) _, ok := MeterProvider().(*meterProvider) if ok { @@ -165,7 +166,7 @@ func TestSetMeterProvider(t *testing.T) { mp := MeterProvider() - SetMeterProvider(metric.NewNoopMeterProvider()) + SetMeterProvider(noop.NewMeterProvider()) dmp := mp.(*meterProvider) diff --git a/metric/noop.go b/metric/noop.go deleted file mode 100644 index 5d1b9d072f5..00000000000 --- a/metric/noop.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric // import "go.opentelemetry.io/otel/metric" - -import ( - "context" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/instrument" -) - -// NewNoopMeterProvider creates a MeterProvider that does not record any metrics. -func NewNoopMeterProvider() MeterProvider { - return noopMeterProvider{} -} - -type noopMeterProvider struct{} - -func (noopMeterProvider) Meter(string, ...MeterOption) Meter { - return noopMeter{} -} - -type noopMeter struct{} - -func (noopMeter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { - return nonrecordingSyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { - return nonrecordingAsyncInt64Instrument{}, nil -} - -func (noopMeter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { - return nonrecordingSyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { - return nonrecordingAsyncFloat64Instrument{}, nil -} - -// RegisterCallback creates a register callback that does not record any metrics. -func (noopMeter) RegisterCallback(Callback, ...instrument.Observable) (Registration, error) { - return noopReg{}, nil -} - -type noopReg struct{} - -func (noopReg) Unregister() error { return nil } - -type nonrecordingAsyncFloat64Instrument struct { - instrument.Float64Observable -} - -var ( - _ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{} - _ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{} - _ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{} -) - -type nonrecordingAsyncInt64Instrument struct { - instrument.Int64Observable -} - -var ( - _ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{} - _ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{} - _ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{} -) - -type nonrecordingSyncFloat64Instrument struct{} - -var ( - _ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{} - _ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{} - _ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{} -) - -func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {} -func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {} - -type nonrecordingSyncInt64Instrument struct{} - -var ( - _ instrument.Int64Counter = nonrecordingSyncInt64Instrument{} - _ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{} - _ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{} -) - -func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {} -func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {} diff --git a/metric/noop/noop.go b/metric/noop/noop.go new file mode 100644 index 00000000000..0b2905da629 --- /dev/null +++ b/metric/noop/noop.go @@ -0,0 +1,247 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package noop provides an implementation of the OpenTelemetry metric API that +// produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry metric API will +// effectively disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry metric API. Doing so will mean the implementation defaults to +// no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/metric/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ metric.MeterProvider = MeterProvider{} + _ metric.Meter = Meter{} + _ metric.Observer = Observer{} + _ metric.Registration = Registration{} + _ instrument.Int64Counter = Int64Counter{} + _ instrument.Float64Counter = Float64Counter{} + _ instrument.Int64UpDownCounter = Int64UpDownCounter{} + _ instrument.Float64UpDownCounter = Float64UpDownCounter{} + _ instrument.Int64Histogram = Int64Histogram{} + _ instrument.Float64Histogram = Float64Histogram{} + _ instrument.Int64ObservableCounter = Int64ObservableCounter{} + _ instrument.Float64ObservableCounter = Float64ObservableCounter{} + _ instrument.Int64ObservableGauge = Int64ObservableGauge{} + _ instrument.Float64ObservableGauge = Float64ObservableGauge{} + _ instrument.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} + _ instrument.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} + _ instrument.Int64Observer = Int64Observer{} + _ instrument.Float64Observer = Float64Observer{} +) + +// MeterProvider is an OpenTelemetry No-Op MeterProvider. +type MeterProvider struct{} + +// NewMeterProvider returns a MeterProvider that does not record any telemetry. +func NewMeterProvider() MeterProvider { + return MeterProvider{} +} + +// Meter returns an OpenTelemetry Meter that does not record any telemetry. +func (MeterProvider) Meter(string, ...metric.MeterOption) metric.Meter { + return Meter{} +} + +// Meter is an OpenTelemetry No-Op Meter. +type Meter struct{} + +// Int64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { + return Int64Counter{}, nil +} + +// Int64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { + return Int64UpDownCounter{}, nil +} + +// Int64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { + return Int64Histogram{}, nil +} + +// Int64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { + return Int64ObservableCounter{}, nil +} + +// Int64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { + return Int64ObservableUpDownCounter{}, nil +} + +// Int64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { + return Int64ObservableGauge{}, nil +} + +// Float64Counter returns a Counter used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { + return Float64Counter{}, nil +} + +// Float64UpDownCounter returns an UpDownCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { + return Float64UpDownCounter{}, nil +} + +// Float64Histogram returns a Histogram used to record int64 measurements that +// produces no telemetry. +func (Meter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { + return Float64Histogram{}, nil +} + +// Float64ObservableCounter returns an ObservableCounter used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { + return Float64ObservableCounter{}, nil +} + +// Float64ObservableUpDownCounter returns an ObservableUpDownCounter used to +// record int64 measurements that produces no telemetry. +func (Meter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { + return Float64ObservableUpDownCounter{}, nil +} + +// Float64ObservableGauge returns an ObservableGauge used to record int64 +// measurements that produces no telemetry. +func (Meter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { + return Float64ObservableGauge{}, nil +} + +// RegisterCallback performs no operation. +func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric.Registration, error) { + return Registration{}, nil +} + +// Observer acts as a recorder of measurements for multiple instruments in a +// Callback, it performing no operation. +type Observer struct{} + +// ObserveFloat64 performs no operation. +func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...attribute.KeyValue) { +} + +// ObserveInt64 performs no operation. +func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...attribute.KeyValue) { +} + +// Registration is the registration of a Callback with a No-Op Meter. +type Registration struct{} + +// Unregister unregisters the Callback the Registration represents with the +// No-Op Meter. This will always return nil because the No-Op Meter performs no +// operation, including hold any record of registrations. +func (Registration) Unregister() error { return nil } + +// Int64Counter is an OpenTelemetry Counter used to record int64 measurements. +// It produces no telemetry. +type Int64Counter struct{} + +// Add performs no operation. +func (Int64Counter) Add(context.Context, int64, ...attribute.KeyValue) {} + +// Float64Counter is an OpenTelemetry Counter used to record float64 +// measurements. It produces no telemetry. +type Float64Counter struct{} + +// Add performs no operation. +func (Float64Counter) Add(context.Context, float64, ...attribute.KeyValue) {} + +// Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 +// measurements. It produces no telemetry. +type Int64UpDownCounter struct{} + +// Add performs no operation. +func (Int64UpDownCounter) Add(context.Context, int64, ...attribute.KeyValue) {} + +// Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record +// float64 measurements. It produces no telemetry. +type Float64UpDownCounter struct{} + +// Add performs no operation. +func (Float64UpDownCounter) Add(context.Context, float64, ...attribute.KeyValue) {} + +// Int64Histogram is an OpenTelemetry Histogram used to record int64 +// measurements. It produces no telemetry. +type Int64Histogram struct{} + +// Record performs no operation. +func (Int64Histogram) Record(context.Context, int64, ...attribute.KeyValue) {} + +// Float64Histogram is an OpenTelemetry Histogram used to record float64 +// measurements. It produces no telemetry. +type Float64Histogram struct{} + +// Record performs no operation. +func (Float64Histogram) Record(context.Context, float64, ...attribute.KeyValue) {} + +// Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableCounter struct{ instrument.Int64Observable } + +// Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableCounter struct{ instrument.Float64Observable } + +// Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// int64 measurements. It produces no telemetry. +type Int64ObservableGauge struct{ instrument.Int64Observable } + +// Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record +// float64 measurements. It produces no telemetry. +type Float64ObservableGauge struct{ instrument.Float64Observable } + +// Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record int64 measurements. It produces no telemetry. +type Int64ObservableUpDownCounter struct{ instrument.Int64Observable } + +// Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter +// used to record float64 measurements. It produces no telemetry. +type Float64ObservableUpDownCounter struct{ instrument.Float64Observable } + +// Int64Observer is a recorder of int64 measurements that performs no operation. +type Int64Observer struct{} + +// Observe performs no operation. +func (Int64Observer) Observe(int64, ...attribute.KeyValue) {} + +// Float64Observer is a recorder of float64 measurements that performs no +// operation. +type Float64Observer struct{} + +// Observe performs no operation. +func (Float64Observer) Observe(float64, ...attribute.KeyValue) {} diff --git a/metric/noop/noop_test.go b/metric/noop/noop_test.go new file mode 100644 index 00000000000..6ddf50e6214 --- /dev/null +++ b/metric/noop/noop_test.go @@ -0,0 +1,139 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package noop // import "go.opentelemetry.io/otel/metric/noop" + +import ( + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" +) + +func TestImplementationNoPanics(t *testing.T) { + // Check that if type has an embedded interface and that interface has + // methods added to it than the No-Op implementation implements them. + t.Run("MeterProvider", assertAllExportedMethodNoPanic( + reflect.ValueOf(MeterProvider{}), + reflect.TypeOf((*metric.MeterProvider)(nil)).Elem(), + )) + t.Run("Meter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Meter{}), + reflect.TypeOf((*metric.Meter)(nil)).Elem(), + )) + t.Run("Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Observer{}), + reflect.TypeOf((*metric.Observer)(nil)).Elem(), + )) + t.Run("Registration", assertAllExportedMethodNoPanic( + reflect.ValueOf(Registration{}), + reflect.TypeOf((*metric.Registration)(nil)).Elem(), + )) + t.Run("Int64Counter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Counter{}), + reflect.TypeOf((*instrument.Int64Counter)(nil)).Elem(), + )) + t.Run("Float64Counter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Counter{}), + reflect.TypeOf((*instrument.Float64Counter)(nil)).Elem(), + )) + t.Run("Int64UpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64UpDownCounter{}), + reflect.TypeOf((*instrument.Int64UpDownCounter)(nil)).Elem(), + )) + t.Run("Float64UpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64UpDownCounter{}), + reflect.TypeOf((*instrument.Float64UpDownCounter)(nil)).Elem(), + )) + t.Run("Int64Histogram", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Histogram{}), + reflect.TypeOf((*instrument.Int64Histogram)(nil)).Elem(), + )) + t.Run("Float64Histogram", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Histogram{}), + reflect.TypeOf((*instrument.Float64Histogram)(nil)).Elem(), + )) + t.Run("Int64ObservableCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableCounter{}), + reflect.TypeOf((*instrument.Int64ObservableCounter)(nil)).Elem(), + )) + t.Run("Float64ObservableCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableCounter{}), + reflect.TypeOf((*instrument.Float64ObservableCounter)(nil)).Elem(), + )) + t.Run("Int64ObservableGauge", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableGauge{}), + reflect.TypeOf((*instrument.Int64ObservableGauge)(nil)).Elem(), + )) + t.Run("Float64ObservableGauge", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableGauge{}), + reflect.TypeOf((*instrument.Float64ObservableGauge)(nil)).Elem(), + )) + t.Run("Int64ObservableUpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64ObservableUpDownCounter{}), + reflect.TypeOf((*instrument.Int64ObservableUpDownCounter)(nil)).Elem(), + )) + t.Run("Float64ObservableUpDownCounter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64ObservableUpDownCounter{}), + reflect.TypeOf((*instrument.Float64ObservableUpDownCounter)(nil)).Elem(), + )) + t.Run("Int64Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Int64Observer{}), + reflect.TypeOf((*instrument.Int64Observer)(nil)).Elem(), + )) + t.Run("Float64Observer", assertAllExportedMethodNoPanic( + reflect.ValueOf(Float64Observer{}), + reflect.TypeOf((*instrument.Float64Observer)(nil)).Elem(), + )) +} + +func assertAllExportedMethodNoPanic(rVal reflect.Value, rType reflect.Type) func(*testing.T) { + return func(t *testing.T) { + for n := 0; n < rType.NumMethod(); n++ { + mType := rType.Method(n) + if !mType.IsExported() { + t.Logf("ignoring unexported %s", mType.Name) + continue + } + m := rVal.MethodByName(mType.Name) + if !m.IsValid() { + t.Errorf("unknown method for %s: %s", rVal.Type().Name(), mType.Name) + } + + numIn := mType.Type.NumIn() + if mType.Type.IsVariadic() { + numIn-- + } + args := make([]reflect.Value, numIn) + for i := range args { + aType := mType.Type.In(i) + args[i] = reflect.New(aType).Elem() + } + + assert.NotPanicsf(t, func() { + _ = m.Call(args) + }, "%s.%s", rVal.Type().Name(), mType.Name) + } + } +} + +func TestNewMeterProvider(t *testing.T) { + mp := NewMeterProvider() + assert.Equal(t, mp, MeterProvider{}) + meter := mp.Meter("") + assert.Equal(t, meter, Meter{}) +} diff --git a/metric/noop_test.go b/metric/noop_test.go deleted file mode 100644 index 59695ccd5bc..00000000000 --- a/metric/noop_test.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package metric - -import ( - "context" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" -) - -func TestNewNoopMeterProvider(t *testing.T) { - mp := NewNoopMeterProvider() - assert.Equal(t, mp, noopMeterProvider{}) - meter := mp.Meter("") - assert.Equal(t, meter, noopMeter{}) -} - -func TestSyncFloat64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Float64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1.0, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Float64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1.0, attribute.String("key", "value")) - }) -} - -func TestSyncInt64(t *testing.T) { - meter := NewNoopMeterProvider().Meter("test instrumentation") - assert.NotPanics(t, func() { - inst, err := meter.Int64Counter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), 1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64UpDownCounter("test instrument") - require.NoError(t, err) - inst.Add(context.Background(), -1, attribute.String("key", "value")) - }) - - assert.NotPanics(t, func() { - inst, err := meter.Int64Histogram("test instrument") - require.NoError(t, err) - inst.Record(context.Background(), 1, attribute.String("key", "value")) - }) -} diff --git a/metric_test.go b/metric_test.go index 646bb108368..cc6f72d76f0 100644 --- a/metric_test.go +++ b/metric_test.go @@ -20,6 +20,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" ) type testMeterProvider struct{} @@ -27,12 +28,12 @@ type testMeterProvider struct{} var _ metric.MeterProvider = &testMeterProvider{} func (*testMeterProvider) Meter(_ string, _ ...metric.MeterOption) metric.Meter { - return metric.NewNoopMeterProvider().Meter("") + return noop.NewMeterProvider().Meter("") } func TestMultipleGlobalMeterProvider(t *testing.T) { p1 := testMeterProvider{} - p2 := metric.NewNoopMeterProvider() + p2 := noop.NewMeterProvider() SetMeterProvider(&p1) SetMeterProvider(p2) From f4a9d78e7f266046ee44ca997191825afac69eb5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 29 Mar 2023 11:24:25 -0700 Subject: [PATCH 480/886] Update Histogram Extrema and Sum to be generic (#3870) * Update Histogram Extrema and Sum to be generic * Update metric SDK * Update exporters * Add changes to changelog --- CHANGELOG.md | 1 + .../internal/transform/metricdata.go | 8 +-- .../internal/transform/metricdata_test.go | 12 ++--- exporters/prometheus/exporter.go | 2 +- sdk/metric/internal/aggregator_test.go | 15 ++++-- sdk/metric/internal/histogram.go | 29 +++++------ sdk/metric/internal/histogram_test.go | 49 +++++++++++-------- sdk/metric/internal/lastvalue_test.go | 4 +- sdk/metric/internal/sum_test.go | 30 ++++++------ sdk/metric/meter_test.go | 15 +++--- sdk/metric/metricdata/data.go | 16 +++--- .../metricdata/metricdatatest/assertion.go | 11 +++-- .../metricdatatest/assertion_test.go | 33 +++++++------ .../metricdata/metricdatatest/comparisons.go | 4 +- 14 files changed, 123 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81cb801b078..cc30053118d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 208e6087831..2f98115b83d 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -175,7 +175,7 @@ func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histog func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) for _, dPt := range dPts { - sum := dPt.Sum + sum := float64(dPt.Sum) hdp := &mpb.HistogramDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), @@ -186,10 +186,12 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint ExplicitBounds: dPt.Bounds, } if v, ok := dPt.Min.Value(); ok { - hdp.Min = &v + vF64 := float64(v) + hdp.Min = &vF64 } if v, ok := dPt.Max.Value(); ok { - hdp.Max = &v + vF64 := float64(v) + hdp.Max = &vF64 } out = append(out, hdp) } diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 72693335cf4..d9a8ddf6a7c 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -59,9 +59,9 @@ var ( Count: 30, Bounds: []float64{1, 5}, BucketCounts: []uint64{0, 30, 0}, - Min: metricdata.NewExtrema(minA), - Max: metricdata.NewExtrema(maxA), - Sum: sumA, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), }, { Attributes: bob, StartTime: start, @@ -69,9 +69,9 @@ var ( Count: 3, Bounds: []float64{1, 5}, BucketCounts: []uint64{0, 1, 2}, - Min: metricdata.NewExtrema(minB), - Max: metricdata.NewExtrema(maxB), - Sum: sumB, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), }} otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{{ Attributes: alice, diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 21b5c41de62..357be10038c 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -193,7 +193,7 @@ func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogra cumulativeCount += dp.BucketCounts[i] buckets[bound] = cumulativeCount } - m, err := prometheus.NewConstHistogram(desc, dp.Count, dp.Sum, buckets, values...) + m, err := prometheus.NewConstHistogram(desc, dp.Count, float64(dp.Sum), buckets, values...) if err != nil { otel.Handle(err) continue diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregator_test.go index a544a18ca21..03b9a91c3ea 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregator_test.go @@ -38,9 +38,6 @@ var ( bob = attribute.NewSet(attribute.String("user", "bob"), attribute.Bool("admin", false)) carol = attribute.NewSet(attribute.String("user", "carol"), attribute.Bool("admin", false)) - monoIncr = setMap{alice: 1, bob: 10, carol: 2} - nonMonoIncr = setMap{alice: 1, bob: -1, carol: 2} - // Sat Jan 01 2000 00:00:00 GMT+0000. staticTime = time.Unix(946684800, 0) staticNowFunc = func() time.Time { return staticTime } @@ -52,8 +49,16 @@ var ( } ) +func monoIncr[N int64 | float64]() setMap[N] { + return setMap[N]{alice: 1, bob: 10, carol: 2} +} + +func nonMonoIncr[N int64 | float64]() setMap[N] { + return setMap[N]{alice: 1, bob: -1, carol: 2} +} + // setMap maps attribute sets to a number. -type setMap map[attribute.Set]int +type setMap[N int64 | float64] map[attribute.Set]N // expectFunc is a function that returns an Aggregation of expected values for // a cycle that contains m measurements (total across all goroutines). Each @@ -79,7 +84,7 @@ type aggregatorTester[N int64 | float64] struct { CycleN int } -func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap, eFunc expectFunc) func(*testing.T) { +func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap[N], eFunc expectFunc) func(*testing.T) { m := at.MeasurementN * at.GoroutineN return func(t *testing.T) { t.Run("Comparable", func(t *testing.T) { diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/histogram.go index bb4372d64cb..7ad454e96c4 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/histogram.go @@ -24,19 +24,19 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -type buckets struct { +type buckets[N int64 | float64] struct { counts []uint64 count uint64 - sum float64 - min, max float64 + sum N + min, max N } // newBuckets returns buckets with n bins. -func newBuckets(n int) *buckets { - return &buckets{counts: make([]uint64, n)} +func newBuckets[N int64 | float64](n int) *buckets[N] { + return &buckets[N]{counts: make([]uint64, n)} } -func (b *buckets) bin(idx int, value float64) { +func (b *buckets[N]) bin(idx int, value N) { b.counts[idx]++ b.count++ b.sum += value @@ -52,7 +52,7 @@ func (b *buckets) bin(idx int, value float64) { type histValues[N int64 | float64] struct { bounds []float64 - values map[attribute.Set]*buckets + values map[attribute.Set]*buckets[N] valuesMu sync.Mutex } @@ -66,24 +66,19 @@ func newHistValues[N int64 | float64](bounds []float64) *histValues[N] { sort.Float64s(b) return &histValues[N]{ bounds: b, - values: make(map[attribute.Set]*buckets), + values: make(map[attribute.Set]*buckets[N]), } } // Aggregate records the measurement value, scoped by attr, and aggregates it // into a histogram. func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { - // Accept all types to satisfy the Aggregator interface. However, since - // the Aggregation produced by this Aggregator is only float64, convert - // here to only use this type. - v := float64(value) - // This search will return an index in the range [0, len(s.bounds)], where // it will return len(s.bounds) if value is greater than the last element // of s.bounds. This aligns with the buckets in that the length of buckets // is len(s.bounds)+1, with the last bucket representing: // (s.bounds[len(s.bounds)-1], +∞). - idx := sort.SearchFloat64s(s.bounds, v) + idx := sort.SearchFloat64s(s.bounds, float64(value)) s.valuesMu.Lock() defer s.valuesMu.Unlock() @@ -97,12 +92,12 @@ func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { // Then, // // buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞) - b = newBuckets(len(s.bounds) + 1) + b = newBuckets[N](len(s.bounds) + 1) // Ensure min and max are recorded values (not zero), for new buckets. - b.min, b.max = v, v + b.min, b.max = value, value s.values[attr] = b } - b.bin(idx, v) + b.bin(idx, value) } // NewDeltaHistogram returns an Aggregator that summarizes a set of diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/histogram_test.go index e030ce5f2cb..20bd19a4167 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/histogram_test.go @@ -48,32 +48,32 @@ func testHistogram[N int64 | float64](t *testing.T) { CycleN: defaultCycles, } - incr := monoIncr + incr := monoIncr[N]() eFunc := deltaHistExpecter[N](incr) t.Run("Delta", tester.Run(NewDeltaHistogram[N](histConf), incr, eFunc)) eFunc = cumuHistExpecter[N](incr) t.Run("Cumulative", tester.Run(NewCumulativeHistogram[N](histConf), incr, eFunc)) } -func deltaHistExpecter[N int64 | float64](incr setMap) expectFunc { +func deltaHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { h := metricdata.Histogram[N]{Temporality: metricdata.DeltaTemporality} return func(m int) metricdata.Aggregation { h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint[N](a, float64(v), uint64(m))) + h.DataPoints = append(h.DataPoints, hPoint[N](a, v, uint64(m))) } return h } } -func cumuHistExpecter[N int64 | float64](incr setMap) expectFunc { +func cumuHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { var cycle int h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} return func(m int) metricdata.Aggregation { cycle++ h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint[N](a, float64(v), uint64(cycle*m))) + h.DataPoints = append(h.DataPoints, hPoint[N](a, v, uint64(cycle*m))) } return h } @@ -81,8 +81,8 @@ func cumuHistExpecter[N int64 | float64](incr setMap) expectFunc { // hPoint returns an HistogramDataPoint that started and ended now with multi // number of measurements values v. It includes a min and max (set to v). -func hPoint[N int64 | float64](a attribute.Set, v float64, multi uint64) metricdata.HistogramDataPoint[N] { - idx := sort.SearchFloat64s(bounds, v) +func hPoint[N int64 | float64](a attribute.Set, v N, multi uint64) metricdata.HistogramDataPoint[N] { + idx := sort.SearchFloat64s(bounds, float64(v)) counts := make([]uint64, len(bounds)+1) counts[idx] += multi return metricdata.HistogramDataPoint[N]{ @@ -94,25 +94,32 @@ func hPoint[N int64 | float64](a attribute.Set, v float64, multi uint64) metricd BucketCounts: counts, Min: metricdata.NewExtrema(v), Max: metricdata.NewExtrema(v), - Sum: v * float64(multi), + Sum: v * N(multi), } } func TestBucketsBin(t *testing.T) { - b := newBuckets(3) - assertB := func(counts []uint64, count uint64, sum, min, max float64) { - assert.Equal(t, counts, b.counts) - assert.Equal(t, count, b.count) - assert.Equal(t, sum, b.sum) - assert.Equal(t, min, b.min) - assert.Equal(t, max, b.max) - } + t.Run("Int64", testBucketsBin[int64]()) + t.Run("Float64", testBucketsBin[float64]()) +} + +func testBucketsBin[N int64 | float64]() func(t *testing.T) { + return func(t *testing.T) { + b := newBuckets[N](3) + assertB := func(counts []uint64, count uint64, sum, min, max N) { + assert.Equal(t, counts, b.counts) + assert.Equal(t, count, b.count) + assert.Equal(t, sum, b.sum) + assert.Equal(t, min, b.min) + assert.Equal(t, max, b.max) + } - assertB([]uint64{0, 0, 0}, 0, 0, 0, 0) - b.bin(1, 2) - assertB([]uint64{0, 1, 0}, 1, 2, 0, 2) - b.bin(0, -1) - assertB([]uint64{1, 1, 0}, 2, 1, -1, 2) + assertB([]uint64{0, 0, 0}, 0, 0, 0, 0) + b.bin(1, 2) + assertB([]uint64{0, 1, 0}, 1, 2, 0, 2) + b.bin(0, -1) + assertB([]uint64{1, 1, 0}, 2, 1, -1, 2) + } } func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram) Aggregator[N], getBounds func(Aggregator[N]) []float64) func(t *testing.T) { diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/lastvalue_test.go index 4d78373c328..6b17198ae98 100644 --- a/sdk/metric/internal/lastvalue_test.go +++ b/sdk/metric/internal/lastvalue_test.go @@ -37,7 +37,7 @@ func testLastValue[N int64 | float64]() func(*testing.T) { CycleN: defaultCycles, } - eFunc := func(increments setMap) expectFunc { + eFunc := func(increments setMap[N]) expectFunc { data := make([]metricdata.DataPoint[N], 0, len(increments)) for a, v := range increments { point := metricdata.DataPoint[N]{Attributes: a, Time: now(), Value: N(v)} @@ -46,7 +46,7 @@ func testLastValue[N int64 | float64]() func(*testing.T) { gauge := metricdata.Gauge[N]{DataPoints: data} return func(int) metricdata.Aggregation { return gauge } } - incr := monoIncr + incr := monoIncr[N]() return tester.Run(NewLastValue[N](), incr, eFunc(incr)) } diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/sum_test.go index cde79aaa92b..e40089566ed 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/sum_test.go @@ -39,71 +39,71 @@ func testSum[N int64 | float64](t *testing.T) { } t.Run("Delta", func(t *testing.T) { - incr, mono := monoIncr, true + incr, mono := monoIncr[N](), true eFunc := deltaExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) - incr, mono = nonMonoIncr, false + incr, mono = nonMonoIncr[N](), false eFunc = deltaExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) }) t.Run("Cumulative", func(t *testing.T) { - incr, mono := monoIncr, true + incr, mono := monoIncr[N](), true eFunc := cumuExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) - incr, mono = nonMonoIncr, false + incr, mono = nonMonoIncr[N](), false eFunc = cumuExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) }) t.Run("PreComputedDelta", func(t *testing.T) { - incr, mono := monoIncr, true + incr, mono := monoIncr[N](), true eFunc := preDeltaExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) - incr, mono = nonMonoIncr, false + incr, mono = nonMonoIncr[N](), false eFunc = preDeltaExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) }) t.Run("PreComputedCumulative", func(t *testing.T) { - incr, mono := monoIncr, true + incr, mono := monoIncr[N](), true eFunc := preCumuExpecter[N](incr, mono) t.Run("Monotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) - incr, mono = nonMonoIncr, false + incr, mono = nonMonoIncr[N](), false eFunc = preCumuExpecter[N](incr, mono) t.Run("NonMonotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) }) } -func deltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { +func deltaExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} return func(m int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, N(v*m))) + sum.DataPoints = append(sum.DataPoints, point(a, v*N(m))) } return sum } } -func cumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { - var cycle int +func cumuExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { + var cycle N sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} return func(m int) metricdata.Aggregation { cycle++ sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, N(v*cycle*m))) + sum.DataPoints = append(sum.DataPoints, point(a, v*cycle*N(m))) } return sum } } -func preDeltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { +func preDeltaExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} last := make(map[attribute.Set]N) return func(int) metricdata.Aggregation { @@ -117,7 +117,7 @@ func preDeltaExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { } } -func preCumuExpecter[N int64 | float64](incr setMap, mono bool) expectFunc { +func preCumuExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} return func(int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index fafa0c79741..ef8c579d534 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -168,7 +168,6 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { - extrema := metricdata.NewExtrema(7.) attrs := []attribute.KeyValue{attribute.String("name", "alice")} testCases := []struct { name string @@ -390,9 +389,9 @@ func TestMeterCreatesInstruments(t *testing.T) { Count: 1, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - Min: extrema, - Max: extrema, - Sum: 7.0, + Min: metricdata.NewExtrema[int64](7), + Max: metricdata.NewExtrema[int64](7), + Sum: 7, }, }, }, @@ -454,8 +453,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Count: 1, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - Min: extrema, - Max: extrema, + Min: metricdata.NewExtrema[float64](7.), + Max: metricdata.NewExtrema[float64](7.), Sum: 7.0, }, }, @@ -1213,8 +1212,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Count: 2, - Min: metricdata.NewExtrema(1.), - Max: metricdata.NewExtrema(2.), + Min: metricdata.NewExtrema[int64](1), + Max: metricdata.NewExtrema[int64](2), Sum: 3.0, }, }, diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index f474a2a617f..1e32f5eeb02 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -127,30 +127,30 @@ type HistogramDataPoint[N int64 | float64] struct { BucketCounts []uint64 // Min is the minimum value recorded. (optional) - Min Extrema + Min Extrema[N] // Max is the maximum value recorded. (optional) - Max Extrema + Max Extrema[N] // Sum is the sum of the values recorded. - Sum float64 + Sum N // Exemplars is the sampled Exemplars collected during the timeseries. Exemplars []Exemplar[N] `json:",omitempty"` } // Extrema is the minimum or maximum value of a dataset. -type Extrema struct { - value float64 +type Extrema[N int64 | float64] struct { + value N valid bool } // NewExtrema returns an Extrema set to v. -func NewExtrema(v float64) Extrema { - return Extrema{value: v, valid: true} +func NewExtrema[N int64 | float64](v N) Extrema[N] { + return Extrema[N]{value: v, valid: true} } // Value returns the Extrema value and true if the Extrema is defined. // Otherwise, if the Extrema is its zero-value, defined will be false. -func (e Extrema) Value() (v float64, defined bool) { +func (e Extrema[N]) Value() (v N, defined bool) { return e.value, e.valid } diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index ed58fdcba75..08bac5131fe 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -34,7 +34,8 @@ type Datatypes interface { metricdata.Histogram[int64] | metricdata.HistogramDataPoint[float64] | metricdata.HistogramDataPoint[int64] | - metricdata.Extrema | + metricdata.Extrema[int64] | + metricdata.Extrema[float64] | metricdata.Metrics | metricdata.ResourceMetrics | metricdata.ScopeMetrics | @@ -119,8 +120,10 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint[float64]), cfg) case metricdata.HistogramDataPoint[int64]: r = equalHistogramDataPoints(e, aIface.(metricdata.HistogramDataPoint[int64]), cfg) - case metricdata.Extrema: - r = equalExtrema(e, aIface.(metricdata.Extrema), cfg) + case metricdata.Extrema[int64]: + r = equalExtrema(e, aIface.(metricdata.Extrema[int64]), cfg) + case metricdata.Extrema[float64]: + r = equalExtrema(e, aIface.(metricdata.Extrema[float64]), cfg) case metricdata.Metrics: r = equalMetrics(e, aIface.(metricdata.Metrics), cfg) case metricdata.ResourceMetrics: @@ -183,7 +186,7 @@ func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute reasons = hasAttributesHistogramDataPoints(e, attrs...) case metricdata.HistogramDataPoint[float64]: reasons = hasAttributesHistogramDataPoints(e, attrs...) - case metricdata.Extrema: + case metricdata.Extrema[int64], metricdata.Extrema[float64]: // Nothing to check. case metricdata.Histogram[int64]: reasons = hasAttributesHistogram(e, attrs...) diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 285dec82451..6ad40ebf1b2 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -129,9 +129,12 @@ var ( Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } - minA = metricdata.NewExtrema(-1.) - minB, maxB = metricdata.NewExtrema(3.), metricdata.NewExtrema(99.) - minC = metricdata.NewExtrema(-1.) + minFloat64A = metricdata.NewExtrema(-1.) + minInt64A = metricdata.NewExtrema[int64](-1) + minFloat64B, maxFloat64B = metricdata.NewExtrema(3.), metricdata.NewExtrema(99.) + minInt64B, maxInt64B = metricdata.NewExtrema[int64](3), metricdata.NewExtrema[int64](99) + minFloat64C = metricdata.NewExtrema(-1.) + minInt64C = metricdata.NewExtrema[int64](-1) histogramDataPointInt64A = metricdata.HistogramDataPoint[int64]{ Attributes: attrA, @@ -140,7 +143,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, - Min: minA, + Min: minInt64A, Sum: 2, Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, } @@ -151,7 +154,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, - Min: minA, + Min: minFloat64A, Sum: 2, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, } @@ -162,8 +165,8 @@ var ( Count: 3, Bounds: []float64{0, 10, 100}, BucketCounts: []uint64{1, 1, 1}, - Max: maxB, - Min: minB, + Max: maxInt64B, + Min: minInt64B, Sum: 3, Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, } @@ -174,8 +177,8 @@ var ( Count: 3, Bounds: []float64{0, 10, 100}, BucketCounts: []uint64{1, 1, 1}, - Max: maxB, - Min: minB, + Max: maxFloat64B, + Min: minFloat64B, Sum: 3, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, } @@ -186,7 +189,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, - Min: minC, + Min: minInt64C, Sum: 2, Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, } @@ -197,7 +200,7 @@ var ( Count: 2, Bounds: []float64{0, 10}, BucketCounts: []uint64{1, 1}, - Min: minC, + Min: minFloat64C, Sum: 2, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } @@ -371,7 +374,8 @@ func TestAssertEqual(t *testing.T) { t.Run("HistogramDataPointFloat64", testDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B, equalHistogramDataPoints[float64])) t.Run("DataPointInt64", testDatatype(dataPointInt64A, dataPointInt64B, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatype(dataPointFloat64A, dataPointFloat64B, equalDataPoints[float64])) - t.Run("Extrema", testDatatype(minA, minB, equalExtrema)) + t.Run("ExtremaInt64", testDatatype(minInt64A, minInt64B, equalExtrema[int64])) + t.Run("ExtremaFloat64", testDatatype(minFloat64A, minFloat64B, equalExtrema[float64])) t.Run("ExemplarInt64", testDatatype(exemplarInt64A, exemplarInt64B, equalExemplars[int64])) t.Run("ExemplarFloat64", testDatatype(exemplarFloat64A, exemplarFloat64B, equalExemplars[float64])) } @@ -390,7 +394,8 @@ func TestAssertEqualIgnoreTime(t *testing.T) { t.Run("HistogramDataPointFloat64", testDatatypeIgnoreTime(histogramDataPointFloat64A, histogramDataPointFloat64C, equalHistogramDataPoints[float64])) t.Run("DataPointInt64", testDatatypeIgnoreTime(dataPointInt64A, dataPointInt64C, equalDataPoints[int64])) t.Run("DataPointFloat64", testDatatypeIgnoreTime(dataPointFloat64A, dataPointFloat64C, equalDataPoints[float64])) - t.Run("Extrema", testDatatypeIgnoreTime(minA, minC, equalExtrema)) + t.Run("ExtremaInt64", testDatatypeIgnoreTime(minInt64A, minInt64C, equalExtrema[int64])) + t.Run("ExtremaFloat64", testDatatypeIgnoreTime(minFloat64A, minFloat64C, equalExtrema[float64])) t.Run("ExemplarInt64", testDatatypeIgnoreTime(exemplarInt64A, exemplarInt64C, equalExemplars[int64])) t.Run("ExemplarFloat64", testDatatypeIgnoreTime(exemplarFloat64A, exemplarFloat64C, equalExemplars[float64])) } @@ -473,7 +478,7 @@ func TestAssertAggregationsEqual(t *testing.T) { } func TestAssertAttributes(t *testing.T) { - AssertHasAttributes(t, minA, attribute.Bool("A", true)) // No-op, always pass. + AssertHasAttributes(t, minFloat64A, attribute.Bool("A", true)) // No-op, always pass. AssertHasAttributes(t, exemplarInt64A, attribute.Bool("filter A", true)) AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("filter A", true)) AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", true)) diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 623dc3ae700..1187ac1986c 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -328,14 +328,14 @@ func equalSlices[T comparable](a, b []T) bool { return true } -func equalExtrema(a, b metricdata.Extrema, _ config) (reasons []string) { +func equalExtrema[N int64 | float64](a, b metricdata.Extrema[N], _ config) (reasons []string) { if !eqExtrema(a, b) { reasons = append(reasons, notEqualStr("Extrema", a, b)) } return reasons } -func eqExtrema(a, b metricdata.Extrema) bool { +func eqExtrema[N int64 | float64](a, b metricdata.Extrema[N]) bool { aV, aOk := a.Value() bV, bOk := b.Value() From 271df1dc01410a14129ce9bc62d10ef581f75d4f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 30 Mar 2023 12:49:39 -0700 Subject: [PATCH 481/886] Add Version func to otel/sdk (#3949) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Version func to otel/sdk * Update sdk/resource to use sdk version * Remove unused UserAgent from sdk/internal * Add changes to changelog * Update CHANGELOG.md Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 5 +++++ sdk/internal/internal.go | 11 +---------- sdk/resource/builtin.go | 4 ++-- sdk/resource/resource_test.go | 6 +++--- sdk/version.go | 20 ++++++++++++++++++++ sdk/version_test.go | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 sdk/version.go create mode 100644 sdk/version_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index cc30053118d..9877807a3c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) + ### Changed - The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) @@ -18,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `TracerProvider` allows calling `Tracer()` while it's shutting down. It used to deadlock. (#3924) +- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) ## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 diff --git a/sdk/internal/internal.go b/sdk/internal/internal.go index 84a02306e64..dfeaaa8ca04 100644 --- a/sdk/internal/internal.go +++ b/sdk/internal/internal.go @@ -14,16 +14,7 @@ package internal // import "go.opentelemetry.io/otel/sdk/internal" -import ( - "fmt" - "time" - - "go.opentelemetry.io/otel" -) - -// UserAgent is the user agent to be added to the outgoing -// requests from the exporters. -var UserAgent = fmt.Sprintf("opentelemetry-go/%s", otel.Version()) +import "time" // MonotonicEndTime returns the end time at present // but offset from start, monotonically. diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index aa0f942f490..72320ca51f9 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -20,8 +20,8 @@ import ( "os" "path/filepath" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) @@ -62,7 +62,7 @@ func (telemetrySDK) Detect(context.Context) (*Resource, error) { semconv.SchemaURL, semconv.TelemetrySDKName("opentelemetry"), semconv.TelemetrySDKLanguageGo, - semconv.TelemetrySDKVersion(otel.Version()), + semconv.TelemetrySDKVersion(sdk.Version()), ), nil } diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 4cf346fd172..7cdd358caaa 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -27,9 +27,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" + "go.opentelemetry.io/otel/sdk" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" ) @@ -227,7 +227,7 @@ func TestDefault(t *testing.T) { "default service.name should include executable name") require.Contains(t, res.Attributes(), semconv.TelemetrySDKLanguageGo) - require.Contains(t, res.Attributes(), semconv.TelemetrySDKVersion(otel.Version())) + require.Contains(t, res.Attributes(), semconv.TelemetrySDKVersion(sdk.Version())) require.Contains(t, res.Attributes(), semconv.TelemetrySDKName("opentelemetry")) } @@ -370,7 +370,7 @@ func TestNew(t *testing.T) { resourceValues: map[string]string{ "telemetry.sdk.name": "opentelemetry", "telemetry.sdk.language": "go", - "telemetry.sdk.version": otel.Version(), + "telemetry.sdk.version": sdk.Version(), }, schemaURL: semconv.SchemaURL, }, diff --git a/sdk/version.go b/sdk/version.go new file mode 100644 index 00000000000..54a7170d984 --- /dev/null +++ b/sdk/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdk // import "go.opentelemetry.io/otel/sdk" + +// Version is the current release version of the OpenTelemetry SDK in use. +func Version() string { + return "1.15.0-rc.2" +} diff --git a/sdk/version_test.go b/sdk/version_test.go new file mode 100644 index 00000000000..e4c80838880 --- /dev/null +++ b/sdk/version_test.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdk_test + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := otel.Version() + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +} From 22fd10447d2f67f68902aff40b0421f2a84757ca Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Sun, 2 Apr 2023 01:57:35 +1100 Subject: [PATCH 482/886] Unify TracerProvider span processor lookups (#3942) * Pre-allocate spanProcessorStates slice * Make sync.Once a non-pointer It doesn't need to be a pointer, can be part of the struct to avoid allocating a separate object for it * getSpanProcessors() helper * Add tests for UnregisterSpanProcessor() --- sdk/trace/provider.go | 23 +++++++++------ sdk/trace/provider_test.go | 57 +++++++++++++++++++++++++++++++++++-- sdk/trace/span.go | 2 +- sdk/trace/span_processor.go | 4 +-- sdk/trace/tracer.go | 2 +- 5 files changed, 72 insertions(+), 16 deletions(-) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 324b686f4b8..0a018c14ded 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -120,7 +120,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { } global.Info("TracerProvider created", "config", o) - spss := spanProcessorStates{} + spss := make(spanProcessorStates, 0, len(o.processors)) for _, sp := range o.processors { spss = append(spss, newSpanProcessorState(sp)) } @@ -192,8 +192,10 @@ func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) { if p.isShutdown.Load() { return } - newSPS := spanProcessorStates{} - newSPS = append(newSPS, *(p.spanProcessors.Load())...) + + current := p.getSpanProcessors() + newSPS := make(spanProcessorStates, 0, len(current)+1) + newSPS = append(newSPS, current...) newSPS = append(newSPS, newSpanProcessorState(sp)) p.spanProcessors.Store(&newSPS) } @@ -210,12 +212,12 @@ func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { if p.isShutdown.Load() { return } - old := *(p.spanProcessors.Load()) + old := p.getSpanProcessors() if len(old) == 0 { return } - spss := spanProcessorStates{} - spss = append(spss, old...) + spss := make(spanProcessorStates, len(old)) + copy(spss, old) // stop the span processor if it is started and remove it from the list var stopOnce *spanProcessorState @@ -245,7 +247,7 @@ func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) { // ForceFlush immediately exports all spans that have not yet been exported for // all the registered span processors. func (p *TracerProvider) ForceFlush(ctx context.Context) error { - spss := *(p.spanProcessors.Load()) + spss := p.getSpanProcessors() if len(spss) == 0 { return nil } @@ -278,10 +280,9 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { if !p.isShutdown.CompareAndSwap(false, true) { // did toggle? return nil } - spss := *(p.spanProcessors.Load()) var retErr error - for _, sps := range spss { + for _, sps := range p.getSpanProcessors() { select { case <-ctx.Done(): return ctx.Err() @@ -305,6 +306,10 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error { return retErr } +func (p *TracerProvider) getSpanProcessors() spanProcessorStates { + return *(p.spanProcessors.Load()) +} + // TracerProviderOption configures a TracerProvider. type TracerProviderOption interface { apply(tracerProviderConfig) tracerProviderConfig diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 282cd16ee67..8df3f1a4bd7 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -80,6 +80,57 @@ func TestForceFlushAndShutdownTraceProviderWithoutProcessor(t *testing.T) { assert.True(t, stp.isShutdown.Load()) } +func TestUnregisterFirst(t *testing.T) { + stp := NewTracerProvider() + sp1 := &basicSpanProcessor{} + sp2 := &basicSpanProcessor{} + sp3 := &basicSpanProcessor{} + stp.RegisterSpanProcessor(sp1) + stp.RegisterSpanProcessor(sp2) + stp.RegisterSpanProcessor(sp3) + + stp.UnregisterSpanProcessor(sp1) + + sps := stp.getSpanProcessors() + require.Len(t, sps, 2) + assert.Same(t, sp2, sps[0].sp) + assert.Same(t, sp3, sps[1].sp) +} + +func TestUnregisterMiddle(t *testing.T) { + stp := NewTracerProvider() + sp1 := &basicSpanProcessor{} + sp2 := &basicSpanProcessor{} + sp3 := &basicSpanProcessor{} + stp.RegisterSpanProcessor(sp1) + stp.RegisterSpanProcessor(sp2) + stp.RegisterSpanProcessor(sp3) + + stp.UnregisterSpanProcessor(sp2) + + sps := stp.getSpanProcessors() + require.Len(t, sps, 2) + assert.Same(t, sp1, sps[0].sp) + assert.Same(t, sp3, sps[1].sp) +} + +func TestUnregisterLast(t *testing.T) { + stp := NewTracerProvider() + sp1 := &basicSpanProcessor{} + sp2 := &basicSpanProcessor{} + sp3 := &basicSpanProcessor{} + stp.RegisterSpanProcessor(sp1) + stp.RegisterSpanProcessor(sp2) + stp.RegisterSpanProcessor(sp3) + + stp.UnregisterSpanProcessor(sp3) + + sps := stp.getSpanProcessors() + require.Len(t, sps, 2) + assert.Same(t, sp1, sps[0].sp) + assert.Same(t, sp2, sps[1].sp) +} + func TestShutdownTraceProvider(t *testing.T) { stp := NewTracerProvider() sp := &basicSpanProcessor{} @@ -162,7 +213,7 @@ func TestRegisterAfterShutdownWithoutProcessors(t *testing.T) { sp := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp) // no-op - assert.Empty(t, stp.spanProcessors.Load()) + assert.Empty(t, stp.getSpanProcessors()) } func TestRegisterAfterShutdownWithProcessors(t *testing.T) { @@ -173,11 +224,11 @@ func TestRegisterAfterShutdownWithProcessors(t *testing.T) { err := stp.Shutdown(context.Background()) assert.NoError(t, err) assert.True(t, stp.isShutdown.Load()) - assert.Empty(t, stp.spanProcessors.Load()) + assert.Empty(t, stp.getSpanProcessors()) sp2 := &basicSpanProcessor{} stp.RegisterSpanProcessor(sp2) // no-op - assert.Empty(t, stp.spanProcessors.Load()) + assert.Empty(t, stp.getSpanProcessors()) } func TestTracerProviderSamplerConfigFromEnv(t *testing.T) { diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 81e89122fa2..8ec7da7f744 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -410,7 +410,7 @@ func (s *recordingSpan) End(options ...trace.SpanEndOption) { } s.mu.Unlock() - sps := *(s.tracer.provider.spanProcessors.Load()) + sps := s.tracer.provider.getSpanProcessors() if len(sps) == 0 { return } diff --git a/sdk/trace/span_processor.go b/sdk/trace/span_processor.go index e6ae1935219..9c53657a719 100644 --- a/sdk/trace/span_processor.go +++ b/sdk/trace/span_processor.go @@ -62,11 +62,11 @@ type SpanProcessor interface { type spanProcessorState struct { sp SpanProcessor - state *sync.Once + state sync.Once } func newSpanProcessorState(sp SpanProcessor) *spanProcessorState { - return &spanProcessorState{sp: sp, state: &sync.Once{}} + return &spanProcessorState{sp: sp} } type spanProcessorStates []*spanProcessorState diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index 16e0108f085..85a71227f3f 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -51,7 +51,7 @@ func (tr *tracer) Start(ctx context.Context, name string, options ...trace.SpanS s := tr.newSpan(ctx, name, &config) if rw, ok := s.(ReadWriteSpan); ok && s.IsRecording() { - sps := *(tr.provider.spanProcessors.Load()) + sps := tr.provider.getSpanProcessors() for _, sp := range sps { sp.sp.OnStart(ctx, rw) } From 5f13db5ca65b7c41b1498fcad3ee6eeb8784c9ea Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 2 Apr 2023 13:10:19 -0300 Subject: [PATCH 483/886] dependabot updates Sun Apr 2 15:32:08 UTC 2023 (#3963) Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /exporters/zipkin Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /exporters/jaeger Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /sdk/metric Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 in /sdk Bump github.com/go-logr/logr from 1.2.3 to 1.2.4 --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- metric/go.mod | 2 +- metric/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 56 files changed, 84 insertions(+), 84 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4a1c53649c9..3bc77fe0327 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index ba8b1f1e710..7d0cb35d80a 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 83cd76a5593..d748bfa9312 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 90708c7e17c..07f38aee283 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index f5ea94ba4be..d8ed7bb9eee 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index e68eeca1d57..aec34af96d5 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 7ba891e13a2..96e6a2cbdc5 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 5e14da80a44..077df872b06 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/fib/go.mod b/example/fib/go.mod index eedfddf00a7..a34a67413cf 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -10,7 +10,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/example/fib/go.sum b/example/fib/go.sum index 4e20825039b..ae80a63c253 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 6e2e1a7a996..26f470a69e3 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -15,7 +15,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 98ab5a86343..d62f7e6d3ad 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index aa5628f3f86..aae67ab467c 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect ) diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 4e20825039b..ae80a63c253 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 2775976f6e6..8768d2eabb7 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -19,7 +19,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 90708c7e17c..07f38aee283 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 26ad708b027..cf39de5003a 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 98b0e3f6a6d..0954787f89a 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -65,8 +65,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index d240c0b2e92..0338c94bcb2 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -10,7 +10,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 4e20825039b..ae80a63c253 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 9dc3ea70cc8..a0a59b923eb 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index b8f7d6fc360..e6f1f19fd74 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -70,8 +70,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= diff --git a/example/view/go.mod b/example/view/go.mod index 4e663229695..e4c6e2fc168 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect diff --git a/example/view/go.sum b/example/view/go.sum index b8f7d6fc360..e6f1f19fd74 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -70,8 +70,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index b443c7feb63..c053458cbf3 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index dc3a56e7fa0..509c054261f 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index fb6205757b6..391b50a8618 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/jaeger go 1.19 require ( - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 307ecdbf9da..8720ec40c27 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index bc15434ca7e..02462c2bd2e 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 99e27b232c5..29a9eab1ebb 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index c2fa7ecc4fc..2d6aceacb4d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.9 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 99e27b232c5..29a9eab1ebb 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 1199af52e54..d6f82a98655 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.9 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 99e27b232c5..29a9eab1ebb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index fdaf056fac8..31359a73317 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 99e27b232c5..29a9eab1ebb 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index b0260af2000..765c6e7e55c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 88dad9cce31..4f732505f58 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index e3cab45e7bb..8bba886dc95 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 845833c2eaf..2f07fb8db65 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -66,8 +66,8 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 77b9b139194..04d7b3e2823 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -17,7 +17,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index a0d5b14a1f9..3dfe25c0f90 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -70,8 +70,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 77db1ac245b..57e9f917516 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -11,7 +11,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 2a214113b99..290d7478ffa 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 52b6eac798d..4be49f4f9a9 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 2a214113b99..290d7478ffa 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 47b8a22af3b..75ed402c73a 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.19 require ( - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index bd17a1b6bc9..40c7a36bb19 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/go.mod b/go.mod index 40317d366b7..c6789904e0c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel go 1.19 require ( - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 diff --git a/go.sum b/go.sum index 6de0c7c3478..602e7803d8e 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/metric/go.mod b/metric/go.mod index 20ac94f128a..3dfe0e69125 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,7 +9,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect diff --git a/metric/go.sum b/metric/go.sum index 30515f028a5..ac91c216e0d 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/sdk/go.mod b/sdk/go.mod index 8a0c30b7e2d..767b3c72f21 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,7 +5,7 @@ go 1.19 replace go.opentelemetry.io/otel => ../ require ( - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.2 diff --git a/sdk/go.sum b/sdk/go.sum index c55ea7c42e3..ada651da2d2 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index e797647ece2..c0a9693b881 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/sdk/metric go 1.19 require ( - github.com/go-logr/logr v1.2.3 + github.com/go-logr/logr v1.2.4 github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/metric v1.15.0-rc.2 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 2a214113b99..290d7478ffa 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= From 65ebe5e50f1c4d5aeb01d9693551bc4aab888149 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 3 Apr 2023 07:33:19 -0700 Subject: [PATCH 484/886] Add embedded private method interfaces in metric API (#3916) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PoC of embedded private method ifaces * Rename embed to embedded * Add an embedded iface for all instruments * Fix metric/instrument tests * Fix global and otel * Fix SDK * Comment the embedded pkg types * Update the embedded pkg docs * Update otel/metric docs about impls * Update otel/metric type docs on impl * Update docs in otel/metric/instrument on default * Add changes to changelog * Apply suggestions from code review Co-authored-by: Robert Pająk * Apply feedback on URLs * Reword based on feedback * Make it clear we only recommended embedding noop * Ignore links with godot linter --------- Co-authored-by: Robert Pająk --- .golangci.yml | 2 + CHANGELOG.md | 3 + internal/global/instruments.go | 19 ++ internal/global/instruments_test.go | 13 + internal/global/meter.go | 7 + internal/global/meter_types_test.go | 11 +- metric/doc.go | 63 +++++ metric/embedded/embedded.go | 233 ++++++++++++++++++ metric/instrument/asyncfloat64.go | 43 +++- metric/instrument/asyncfloat64_test.go | 2 + metric/instrument/asyncint64.go | 43 +++- metric/instrument/asyncint64_test.go | 2 + metric/instrument/syncfloat64.go | 22 +- metric/instrument/syncint64.go | 22 +- metric/meter.go | 25 +- metric/noop/noop.go | 55 +++-- metric_test.go | 3 +- sdk/metric/instrument.go | 16 ++ .../internal/aggregator_example_test.go | 5 + sdk/metric/meter.go | 13 +- sdk/metric/pipeline.go | 10 +- sdk/metric/provider.go | 3 + 22 files changed, 565 insertions(+), 50 deletions(-) create mode 100644 metric/embedded/embedded.go diff --git a/.golangci.yml b/.golangci.yml index 0f099f57595..e28904f6ac7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -85,6 +85,8 @@ linters-settings: - "**/internal/matchers/*.go" godot: exclude: + # Exclude links. + - '^ *\[[^]]+\]:' # Exclude sentence fragments for lists. - '^[ ]*[-•]' # Exclude sentences prefixing a list. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9877807a3c3..201c03b2a67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added +- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) - The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) ### Changed - The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870) +- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`. + This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` diff --git a/internal/global/instruments.go b/internal/global/instruments.go index ef1ed650b0d..8a185187829 100644 --- a/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) @@ -29,6 +30,7 @@ type unwrapper interface { } type afCounter struct { + embedded.Float64ObservableCounter instrument.Float64Observable name string @@ -57,6 +59,7 @@ func (i *afCounter) Unwrap() instrument.Observable { } type afUpDownCounter struct { + embedded.Float64ObservableUpDownCounter instrument.Float64Observable name string @@ -85,6 +88,7 @@ func (i *afUpDownCounter) Unwrap() instrument.Observable { } type afGauge struct { + embedded.Float64ObservableGauge instrument.Float64Observable name string @@ -113,6 +117,7 @@ func (i *afGauge) Unwrap() instrument.Observable { } type aiCounter struct { + embedded.Int64ObservableCounter instrument.Int64Observable name string @@ -141,6 +146,7 @@ func (i *aiCounter) Unwrap() instrument.Observable { } type aiUpDownCounter struct { + embedded.Int64ObservableUpDownCounter instrument.Int64Observable name string @@ -169,6 +175,7 @@ func (i *aiUpDownCounter) Unwrap() instrument.Observable { } type aiGauge struct { + embedded.Int64ObservableGauge instrument.Int64Observable name string @@ -198,6 +205,8 @@ func (i *aiGauge) Unwrap() instrument.Observable { // Sync Instruments. type sfCounter struct { + embedded.Float64Counter + name string opts []instrument.Float64CounterOption @@ -222,6 +231,8 @@ func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.Ke } type sfUpDownCounter struct { + embedded.Float64UpDownCounter + name string opts []instrument.Float64UpDownCounterOption @@ -246,6 +257,8 @@ func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attrib } type sfHistogram struct { + embedded.Float64Histogram + name string opts []instrument.Float64HistogramOption @@ -270,6 +283,8 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute. } type siCounter struct { + embedded.Int64Counter + name string opts []instrument.Int64CounterOption @@ -294,6 +309,8 @@ func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValu } type siUpDownCounter struct { + embedded.Int64UpDownCounter + name string opts []instrument.Int64UpDownCounterOption @@ -318,6 +335,8 @@ func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.K } type siHistogram struct { + embedded.Int64Histogram + name string opts []instrument.Int64HistogramOption diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index 66fe8499cf0..6b5af6715ea 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/noop" ) @@ -146,6 +147,12 @@ type testCountingFloatInstrument struct { count int instrument.Float64Observable + embedded.Float64Counter + embedded.Float64UpDownCounter + embedded.Float64Histogram + embedded.Float64ObservableCounter + embedded.Float64ObservableUpDownCounter + embedded.Float64ObservableGauge } func (i *testCountingFloatInstrument) observe() { @@ -162,6 +169,12 @@ type testCountingIntInstrument struct { count int instrument.Int64Observable + embedded.Int64Counter + embedded.Int64UpDownCounter + embedded.Int64Histogram + embedded.Int64ObservableCounter + embedded.Int64ObservableUpDownCounter + embedded.Int64ObservableGauge } func (i *testCountingIntInstrument) observe() { diff --git a/internal/global/meter.go b/internal/global/meter.go index 2c2d4fb4feb..9449ba3eeaf 100644 --- a/internal/global/meter.go +++ b/internal/global/meter.go @@ -20,6 +20,7 @@ import ( "sync/atomic" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) @@ -28,6 +29,8 @@ import ( // All MeterProvider functionality is forwarded to a delegate once // configured. type meterProvider struct { + embedded.MeterProvider + mtx sync.Mutex meters map[il]*meter @@ -94,6 +97,8 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me // All Meter functionality is forwarded to a delegate once configured. // Otherwise, all functionality is forwarded to a NoopMeter. type meter struct { + embedded.Meter + name string opts []metric.MeterOption @@ -308,6 +313,8 @@ func unwrapInstruments(instruments []instrument.Observable) []instrument.Observa } type registration struct { + embedded.Registration + instruments []instrument.Observable function metric.Callback diff --git a/internal/global/meter_types_test.go b/internal/global/meter_types_test.go index 038083f274b..3529d92db8c 100644 --- a/internal/global/meter_types_test.go +++ b/internal/global/meter_types_test.go @@ -19,10 +19,13 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) type testMeterProvider struct { + embedded.MeterProvider + count int } @@ -33,6 +36,8 @@ func (p *testMeterProvider) Meter(name string, opts ...metric.MeterOption) metri } type testMeter struct { + embedded.Meter + afCount int afUDCount int afGauge int @@ -123,6 +128,8 @@ func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Observab } type testReg struct { + embedded.Registration + f func() } @@ -134,7 +141,7 @@ func (r testReg) Unregister() error { // This enables async collection. func (m *testMeter) collect() { ctx := context.Background() - o := observationRecorder{ctx} + o := observationRecorder{ctx: ctx} for _, f := range m.callbacks { if f == nil { // Unregister. @@ -145,6 +152,8 @@ func (m *testMeter) collect() { } type observationRecorder struct { + embedded.Observer + ctx context.Context } diff --git a/metric/doc.go b/metric/doc.go index 33de12035c0..b24a9efdc88 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -30,6 +30,69 @@ can then be built from the [Meter]'s instruments. See [go.opentelemetry.io/otel/metric/instrument] for documentation on each instrument and its intended use. +# API Implementations + +This package does not conform to the standard Go versioning policy, all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/metric/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/metric/embedded" + + type MeterProvider struct { + embedded.MeterProvider + // ... + } + +If an author wants the default behavior of their implementations to a panic, +they need to embed the API interface directly. + + import "go.opentelemetry.io/otel/metric" + + type MeterProvider struct { + metric.MeterProvider + // ... + } + +This is not a recommended behavior as it could lead to publishing packages that +contain runtime panics when users update other package that use newer versions +of [go.opentelemetry.io/otel/metric]. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who want to default to silently dropping the call can use +[go.opentelemetry.io/otel/metric/noop]: + + import "go.opentelemetry.io/otel/metric/noop" + + type MeterProvider struct { + noop.MeterProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. + [GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ package metric // import "go.opentelemetry.io/otel/metric" diff --git a/metric/embedded/embedded.go b/metric/embedded/embedded.go new file mode 100644 index 00000000000..a4f2bdfe456 --- /dev/null +++ b/metric/embedded/embedded.go @@ -0,0 +1,233 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// metric API]. +// +// Implementers of the [OpenTelemetry metric API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry metric API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry metric API]: go.opentelemetry.io/otel/metric +package embedded // import "go.opentelemetry.io/otel/metric/embedded" + +// MeterProvider is embedded in the OpenTelemetry metric API [MeterProvider]. +// +// Embed this interface in your implementation of the [MeterProvider] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [MeterProvider] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [MeterProvider]: go.opentelemetry.io/otel/metric.MeterProvider +type MeterProvider interface{ meterProvider() } + +// Meter is embedded in the OpenTelemetry metric API [Meter]. +// +// Embed this interface in your implementation of the [Meter] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the [Meter] interface is extended (which is +// something that can happen without a major version bump of the API package). +// +// [Meter]: go.opentelemetry.io/otel/metric.Meter +type Meter interface{ meter() } + +// Float64Observer is embedded in the OpenTelemetry metric API +// [Float64Observer]. +// +// Embed this interface in your implementation of the [Float64Observer] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Float64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Float64Observer]: go.opentelemetry.io/otel/metric.Float64Observer +type Float64Observer interface{ float64Observer() } + +// Int64Observer is embedded in the OpenTelemetry metric API [Int64Observer]. +// +// Embed this interface in your implementation of the [Int64Observer] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Int64Observer] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Int64Observer]: go.opentelemetry.io/otel/metric.Int64Observer +type Int64Observer interface{ int64Observer() } + +// Observer is embedded in the OpenTelemetry metric API [Observer]. +// +// Embed this interface in your implementation of the [Observer] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the [Observer] interface is extended (which +// is something that can happen without a major version bump of the API +// package). +// +// [Observer]: go.opentelemetry.io/otel/metric.Observer +type Observer interface{ observer() } + +// Registration is embedded in the OpenTelemetry metric API [Registration]. +// +// Embed this interface in your implementation of the [Registration] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Registration] interface is extended +// (which is something that can happen without a major version bump of the API +// package). +// +// [Registration]: go.opentelemetry.io/otel/metric.Registration +type Registration interface{ registration() } + +// Float64Counter is embedded in the OpenTelemetry metric API [Float64Counter]. +// +// Embed this interface in your implementation of the [Float64Counter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Float64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Float64Counter]: go.opentelemetry.io/otel/metric.Float64Counter +type Float64Counter interface{ float64Counter() } + +// Float64Histogram is embedded in the OpenTelemetry metric API +// [Float64Histogram]. +// +// Embed this interface in your implementation of the [Float64Histogram] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Float64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Float64Histogram]: go.opentelemetry.io/otel/metric.Float64Histogram +type Float64Histogram interface{ float64Histogram() } + +// Float64ObservableCounter is embedded in the OpenTelemetry metric API +// [Float64ObservableCounter]. +// +// Embed this interface in your implementation of the +// [Float64ObservableCounter] if you want users to experience a compilation +// error, signaling they need to update to your latest implementation, when the +// [Float64ObservableCounter] interface is extended (which is something that +// can happen without a major version bump of the API package). +// +// [Float64ObservableCounter]: go.opentelemetry.io/otel/metric.Float64ObservableCounter +type Float64ObservableCounter interface{ float64ObservableCounter() } + +// Float64ObservableGauge is embedded in the OpenTelemetry metric API +// [Float64ObservableGauge]. +// +// Embed this interface in your implementation of the [Float64ObservableGauge] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Float64ObservableGauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Float64ObservableGauge]: go.opentelemetry.io/otel/metric.Float64ObservableGauge +type Float64ObservableGauge interface{ float64ObservableGauge() } + +// Float64ObservableUpDownCounter is embedded in the OpenTelemetry metric API +// [Float64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [Float64ObservableUpDownCounter] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [Float64ObservableUpDownCounter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Float64ObservableUpDownCounter]: go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter +type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } + +// Float64UpDownCounter is embedded in the OpenTelemetry metric API +// [Float64UpDownCounter]. +// +// Embed this interface in your implementation of the [Float64UpDownCounter] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Float64UpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Float64UpDownCounter]: go.opentelemetry.io/otel/metric.Float64UpDownCounter +type Float64UpDownCounter interface{ float64UpDownCounter() } + +// Int64Counter is embedded in the OpenTelemetry metric API [Int64Counter]. +// +// Embed this interface in your implementation of the [Int64Counter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Int64Counter] interface is extended +// (which is something that can happen without a major version bump of the API +// package). +// +// [Int64Counter]: go.opentelemetry.io/otel/metric.Int64Counter +type Int64Counter interface{ int64Counter() } + +// Int64Histogram is embedded in the OpenTelemetry metric API [Int64Histogram]. +// +// Embed this interface in your implementation of the [Int64Histogram] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the [Int64Histogram] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [Int64Histogram]: go.opentelemetry.io/otel/metric.Int64Histogram +type Int64Histogram interface{ int64Histogram() } + +// Int64ObservableCounter is embedded in the OpenTelemetry metric API +// [Int64ObservableCounter]. +// +// Embed this interface in your implementation of the [Int64ObservableCounter] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Int64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Int64ObservableCounter]: go.opentelemetry.io/otel/metric.Int64ObservableCounter +type Int64ObservableCounter interface{ int64ObservableCounter() } + +// Int64ObservableGauge is embedded in the OpenTelemetry metric API +// [Int64ObservableGauge]. +// +// Embed this interface in your implementation of the [Int64ObservableGauge] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Int64ObservableGauge] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Int64ObservableGauge]: go.opentelemetry.io/otel/metric.Int64ObservableGauge +type Int64ObservableGauge interface{ int64ObservableGauge() } + +// Int64ObservableUpDownCounter is embedded in the OpenTelemetry metric API +// [Int64ObservableUpDownCounter]. +// +// Embed this interface in your implementation of the +// [Int64ObservableUpDownCounter] if you want users to experience a compilation +// error, signaling they need to update to your latest implementation, when the +// [Int64ObservableUpDownCounter] interface is extended (which is something +// that can happen without a major version bump of the API package). +// +// [Int64ObservableUpDownCounter]: go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter +type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } + +// Int64UpDownCounter is embedded in the OpenTelemetry metric API +// [Int64UpDownCounter]. +// +// Embed this interface in your implementation of the [Int64UpDownCounter] if +// you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Int64UpDownCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Int64UpDownCounter]: go.opentelemetry.io/otel/metric.Int64UpDownCounter +type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index cf0008e61f3..356c969b6b1 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -18,13 +18,14 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) // Float64Observable describes a set of instruments used asynchronously to // record float64 measurements once per collection cycle. Observations of // these instruments are only made within a callback. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. type Float64Observable interface { Observable @@ -36,8 +37,15 @@ type Float64Observable interface { // only made within a callback for this instrument. The value observed is // assumed the to be the cumulative sum of the count. // -// Warning: methods may be added to this interface in minor releases. -type Float64ObservableCounter interface{ Float64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Float64ObservableCounter interface { + embedded.Float64ObservableCounter + + Float64Observable +} // Float64ObservableCounterConfig contains options for asynchronous counter // instruments that record int64 values. @@ -84,8 +92,15 @@ type Float64ObservableCounterOption interface { // made within a callback for this instrument. The value observed is assumed // the to be the cumulative sum of the count. // -// Warning: methods may be added to this interface in minor releases. -type Float64ObservableUpDownCounter interface{ Float64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Float64ObservableUpDownCounter interface { + embedded.Float64ObservableUpDownCounter + + Float64Observable +} // Float64ObservableUpDownCounterConfig contains options for asynchronous // counter instruments that record int64 values. @@ -132,8 +147,15 @@ type Float64ObservableUpDownCounterOption interface { // instantaneous float64 measurements once per collection cycle. Observations // are only made within a callback for this instrument. // -// Warning: methods may be added to this interface in minor releases. -type Float64ObservableGauge interface{ Float64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Float64ObservableGauge interface { + embedded.Float64ObservableGauge + + Float64Observable +} // Float64ObservableGaugeConfig contains options for asynchronous counter // instruments that record int64 values. @@ -178,8 +200,13 @@ type Float64ObservableGaugeOption interface { // Float64Observer is a recorder of float64 measurements. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Float64Observer interface { + embedded.Float64Observer + // Observe records the float64 value with attributes. Observe(value float64, attributes ...attribute.KeyValue) } diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index 0613fb863bd..5a23c2845f7 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) func TestFloat64ObservableConfiguration(t *testing.T) { @@ -83,6 +84,7 @@ type float64ObservableConfig interface { } type float64Observer struct { + embedded.Float64Observer Observable got float64 } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index 752dcea0a1e..05bfc8dbe0f 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -18,13 +18,14 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) // Int64Observable describes a set of instruments used asynchronously to record // int64 measurements once per collection cycle. Observations of these // instruments are only made within a callback. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. type Int64Observable interface { Observable @@ -36,8 +37,15 @@ type Int64Observable interface { // only made within a callback for this instrument. The value observed is // assumed the to be the cumulative sum of the count. // -// Warning: methods may be added to this interface in minor releases. -type Int64ObservableCounter interface{ Int64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Int64ObservableCounter interface { + embedded.Int64ObservableCounter + + Int64Observable +} // Int64ObservableCounterConfig contains options for asynchronous counter // instruments that record int64 values. @@ -84,8 +92,15 @@ type Int64ObservableCounterOption interface { // within a callback for this instrument. The value observed is assumed the to // be the cumulative sum of the count. // -// Warning: methods may be added to this interface in minor releases. -type Int64ObservableUpDownCounter interface{ Int64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Int64ObservableUpDownCounter interface { + embedded.Int64ObservableUpDownCounter + + Int64Observable +} // Int64ObservableUpDownCounterConfig contains options for asynchronous counter // instruments that record int64 values. @@ -132,8 +147,15 @@ type Int64ObservableUpDownCounterOption interface { // instantaneous int64 measurements once per collection cycle. Observations are // only made within a callback for this instrument. // -// Warning: methods may be added to this interface in minor releases. -type Int64ObservableGauge interface{ Int64Observable } +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. +type Int64ObservableGauge interface { + embedded.Int64ObservableGauge + + Int64Observable +} // Int64ObservableGaugeConfig contains options for asynchronous counter // instruments that record int64 values. @@ -177,8 +199,13 @@ type Int64ObservableGaugeOption interface { // Int64Observer is a recorder of int64 measurements. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Int64Observer interface { + embedded.Int64Observer + // Observe records the int64 value with attributes. Observe(value int64, attributes ...attribute.KeyValue) } diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index b8e8cba5894..b52f0730d5d 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) func TestInt64ObservableConfiguration(t *testing.T) { @@ -83,6 +84,7 @@ type int64ObservableConfig interface { } type int64Observer struct { + embedded.Int64Observer Observable got int64 } diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index 2d55384ab26..03b3bf6ac2d 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -18,12 +18,18 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) // Float64Counter is an instrument that records increasing float64 values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Float64Counter interface { + embedded.Float64Counter + // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } @@ -64,8 +70,13 @@ type Float64CounterOption interface { // Float64UpDownCounter is an instrument that records increasing or decreasing // float64 values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Float64UpDownCounter interface { + embedded.Float64UpDownCounter + // Add records a change to the counter. Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } @@ -107,8 +118,13 @@ type Float64UpDownCounterOption interface { // Float64Histogram is an instrument that records a distribution of float64 // values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Float64Histogram interface { + embedded.Float64Histogram + // Record adds an additional value to the distribution. Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) } diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index 9b6b3917ffc..22d0718c87c 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -18,12 +18,18 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" ) // Int64Counter is an instrument that records increasing int64 values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Int64Counter interface { + embedded.Int64Counter + // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } @@ -64,8 +70,13 @@ type Int64CounterOption interface { // Int64UpDownCounter is an instrument that records increasing or decreasing // int64 values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Int64UpDownCounter interface { + embedded.Int64UpDownCounter + // Add records a change to the counter. Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } @@ -107,8 +118,13 @@ type Int64UpDownCounterOption interface { // Int64Histogram is an instrument that records a distribution of int64 // values. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// [go.opentelemetry.io/otel/metric] package documentation on API +// implementation for information on how to set default behavior for +// unimplemented methods. type Int64Histogram interface { + embedded.Int64Histogram + // Record adds an additional value to the distribution. Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) } diff --git a/metric/meter.go b/metric/meter.go index 1cb556b0534..5e7ca5bea5e 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -18,14 +18,19 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) // MeterProvider provides access to named Meter instances, for instrumenting // an application or package. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type MeterProvider interface { + embedded.MeterProvider + // Meter returns a new Meter with the provided name and configuration. // // A Meter should be scoped at most to a single package. The name needs to @@ -40,8 +45,12 @@ type MeterProvider interface { // Meter provides access to instrument instances for recording metrics. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Meter interface { + embedded.Meter + // Int64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // int64 measurements during a computational operation. @@ -125,7 +134,13 @@ type Meter interface { type Callback func(context.Context, Observer) error // Observer records measurements for multiple instruments in a Callback. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Observer interface { + embedded.Observer + // ObserveFloat64 records the float64 value with attributes for obsrv. ObserveFloat64(obsrv instrument.Float64Observable, value float64, attributes ...attribute.KeyValue) // ObserveInt64 records the int64 value with attributes for obsrv. @@ -134,7 +149,13 @@ type Observer interface { // Registration is an token representing the unique registration of a callback // for a set of instruments with a Meter. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Registration interface { + embedded.Registration + // Unregister removes the callback registration from a Meter. // // This method needs to be idempotent and concurrent safe. diff --git a/metric/noop/noop.go b/metric/noop/noop.go index 0b2905da629..b4eaf4d6406 100644 --- a/metric/noop/noop.go +++ b/metric/noop/noop.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) @@ -55,7 +56,7 @@ var ( ) // MeterProvider is an OpenTelemetry No-Op MeterProvider. -type MeterProvider struct{} +type MeterProvider struct{ embedded.MeterProvider } // NewMeterProvider returns a MeterProvider that does not record any telemetry. func NewMeterProvider() MeterProvider { @@ -68,7 +69,7 @@ func (MeterProvider) Meter(string, ...metric.MeterOption) metric.Meter { } // Meter is an OpenTelemetry No-Op Meter. -type Meter struct{} +type Meter struct{ embedded.Meter } // Int64Counter returns a Counter used to record int64 measurements that // produces no telemetry. @@ -149,7 +150,7 @@ func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric // Observer acts as a recorder of measurements for multiple instruments in a // Callback, it performing no operation. -type Observer struct{} +type Observer struct{ embedded.Observer } // ObserveFloat64 performs no operation. func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...attribute.KeyValue) { @@ -160,7 +161,7 @@ func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...attribute.Key } // Registration is the registration of a Callback with a No-Op Meter. -type Registration struct{} +type Registration struct{ embedded.Registration } // Unregister unregisters the Callback the Registration represents with the // No-Op Meter. This will always return nil because the No-Op Meter performs no @@ -169,79 +170,97 @@ func (Registration) Unregister() error { return nil } // Int64Counter is an OpenTelemetry Counter used to record int64 measurements. // It produces no telemetry. -type Int64Counter struct{} +type Int64Counter struct{ embedded.Int64Counter } // Add performs no operation. func (Int64Counter) Add(context.Context, int64, ...attribute.KeyValue) {} // Float64Counter is an OpenTelemetry Counter used to record float64 // measurements. It produces no telemetry. -type Float64Counter struct{} +type Float64Counter struct{ embedded.Float64Counter } // Add performs no operation. func (Float64Counter) Add(context.Context, float64, ...attribute.KeyValue) {} // Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 // measurements. It produces no telemetry. -type Int64UpDownCounter struct{} +type Int64UpDownCounter struct{ embedded.Int64UpDownCounter } // Add performs no operation. func (Int64UpDownCounter) Add(context.Context, int64, ...attribute.KeyValue) {} // Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record // float64 measurements. It produces no telemetry. -type Float64UpDownCounter struct{} +type Float64UpDownCounter struct{ embedded.Float64UpDownCounter } // Add performs no operation. func (Float64UpDownCounter) Add(context.Context, float64, ...attribute.KeyValue) {} // Int64Histogram is an OpenTelemetry Histogram used to record int64 // measurements. It produces no telemetry. -type Int64Histogram struct{} +type Int64Histogram struct{ embedded.Int64Histogram } // Record performs no operation. func (Int64Histogram) Record(context.Context, int64, ...attribute.KeyValue) {} // Float64Histogram is an OpenTelemetry Histogram used to record float64 // measurements. It produces no telemetry. -type Float64Histogram struct{} +type Float64Histogram struct{ embedded.Float64Histogram } // Record performs no operation. func (Float64Histogram) Record(context.Context, float64, ...attribute.KeyValue) {} // Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record // int64 measurements. It produces no telemetry. -type Int64ObservableCounter struct{ instrument.Int64Observable } +type Int64ObservableCounter struct { + instrument.Int64Observable + embedded.Int64ObservableCounter +} // Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record // float64 measurements. It produces no telemetry. -type Float64ObservableCounter struct{ instrument.Float64Observable } +type Float64ObservableCounter struct { + instrument.Float64Observable + embedded.Float64ObservableCounter +} // Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record // int64 measurements. It produces no telemetry. -type Int64ObservableGauge struct{ instrument.Int64Observable } +type Int64ObservableGauge struct { + instrument.Int64Observable + embedded.Int64ObservableGauge +} // Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record // float64 measurements. It produces no telemetry. -type Float64ObservableGauge struct{ instrument.Float64Observable } +type Float64ObservableGauge struct { + instrument.Float64Observable + embedded.Float64ObservableGauge +} // Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter // used to record int64 measurements. It produces no telemetry. -type Int64ObservableUpDownCounter struct{ instrument.Int64Observable } +type Int64ObservableUpDownCounter struct { + instrument.Int64Observable + embedded.Int64ObservableUpDownCounter +} // Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter // used to record float64 measurements. It produces no telemetry. -type Float64ObservableUpDownCounter struct{ instrument.Float64Observable } +type Float64ObservableUpDownCounter struct { + instrument.Float64Observable + embedded.Float64ObservableUpDownCounter +} // Int64Observer is a recorder of int64 measurements that performs no operation. -type Int64Observer struct{} +type Int64Observer struct{ embedded.Int64Observer } // Observe performs no operation. func (Int64Observer) Observe(int64, ...attribute.KeyValue) {} // Float64Observer is a recorder of float64 measurements that performs no // operation. -type Float64Observer struct{} +type Float64Observer struct{ embedded.Float64Observer } // Observe performs no operation. func (Float64Observer) Observe(float64, ...attribute.KeyValue) {} diff --git a/metric_test.go b/metric_test.go index cc6f72d76f0..5e6e48fb8a0 100644 --- a/metric_test.go +++ b/metric_test.go @@ -20,10 +20,11 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/noop" ) -type testMeterProvider struct{} +type testMeterProvider struct{ embedded.MeterProvider } var _ metric.MeterProvider = &testMeterProvider{} diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 3ae2f2d7b6c..9e8de50cffe 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -20,6 +20,7 @@ import ( "fmt" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -171,6 +172,13 @@ type streamID struct { type instrumentImpl[N int64 | float64] struct { aggregators []internal.Aggregator[N] + + embedded.Float64Counter + embedded.Float64UpDownCounter + embedded.Float64Histogram + embedded.Int64Counter + embedded.Int64UpDownCounter + embedded.Int64Histogram } var _ instrument.Float64Counter = (*instrumentImpl[float64])(nil) @@ -213,6 +221,10 @@ type observablID[N int64 | float64] struct { type float64Observable struct { instrument.Float64Observable *observable[float64] + + embedded.Float64ObservableCounter + embedded.Float64ObservableUpDownCounter + embedded.Float64ObservableGauge } var _ instrument.Float64ObservableCounter = float64Observable{} @@ -228,6 +240,10 @@ func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name type int64Observable struct { instrument.Int64Observable *observable[int64] + + embedded.Int64ObservableCounter + embedded.Int64ObservableUpDownCounter + embedded.Int64ObservableGauge } var _ instrument.Int64ObservableCounter = int64Observable{} diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index fdaf6833677..297d0f5118e 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -19,6 +19,7 @@ import ( "fmt" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -87,6 +88,10 @@ func (p *meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (inst // histogram used for demonstration purposes only. type inst struct { aggregateFunc func(int64, attribute.Set) + + embedded.Int64Counter + embedded.Int64UpDownCounter + embedded.Int64Histogram } func (inst) Add(context.Context, int64, ...attribute.KeyValue) {} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 6af74fadeaa..72b37ea6634 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/internal" @@ -32,6 +33,8 @@ import ( // produced by an instrumentation scope will use metric instruments from a // single meter. type meter struct { + embedded.Meter + scope instrumentation.Scope pipes pipelines @@ -264,6 +267,8 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observab } type observer struct { + embedded.Observer + float64 map[observablID[float64]]struct{} int64 map[observablID[int64]]struct{} } @@ -356,7 +361,7 @@ func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, a ...attri oImpl.observe(v, a) } -type noopRegister struct{} +type noopRegister struct{ embedded.Registration } func (noopRegister) Unregister() error { return nil @@ -409,11 +414,12 @@ func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []in } func (p int64ObservProvider) callback(i int64Observable, f instrument.Int64Callback) func(context.Context) error { - inst := int64Observer{i} + inst := int64Observer{int64Observable: i} return func(ctx context.Context) error { return f(ctx, inst) } } type int64Observer struct { + embedded.Int64Observer int64Observable } @@ -440,11 +446,12 @@ func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks } func (p float64ObservProvider) callback(i float64Observable, f instrument.Float64Callback) func(context.Context) error { - inst := float64Observer{i} + inst := float64Observer{float64Observable: i} return func(ctx context.Context) error { return f(ctx, inst) } } type float64Observer struct { + embedded.Float64Observer float64Observable } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 1d63af01b3f..e94cfcb149f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -24,6 +24,7 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" @@ -503,13 +504,16 @@ func (p pipelines) registerMultiCallback(c multiCallback) metric.Registration { for i, pipe := range p { unregs[i] = pipe.addMultiCallback(c) } - return unregisterFuncs(unregs) + return unregisterFuncs{f: unregs} } -type unregisterFuncs []func() +type unregisterFuncs struct { + embedded.Registration + f []func() +} func (u unregisterFuncs) Unregister() error { - for _, f := range u { + for _, f := range u.f { f() } return nil diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index b90ae4ff445..33daabb50fb 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -18,6 +18,7 @@ import ( "context" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" ) @@ -26,6 +27,8 @@ import ( // the same Views applied to them, and have their produced metric telemetry // passed to the configured Readers. type MeterProvider struct { + embedded.MeterProvider + pipes pipelines meters cache[instrumentation.Scope, *meter] From a25f4fe7efddc017e1b557ba94088159c6da4174 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 4 Apr 2023 08:06:10 -0700 Subject: [PATCH 485/886] Guard zero value Set methods (#3957) Co-authored-by: Chester Cheung --- attribute/set.go | 4 ++-- attribute/set_test.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/attribute/set.go b/attribute/set.go index f9b6dc3f505..b976367e46d 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -98,7 +98,7 @@ func (l *Set) Len() int { // Get returns the KeyValue at ordered position idx in this set. func (l *Set) Get(idx int) (KeyValue, bool) { - if l == nil { + if l == nil || !l.equivalent.Valid() { return KeyValue{}, false } value := l.equivalent.reflectValue() @@ -114,7 +114,7 @@ func (l *Set) Get(idx int) (KeyValue, bool) { // Value returns the value of a specified key in this set. func (l *Set) Value(k Key) (Value, bool) { - if l == nil { + if l == nil || !l.equivalent.Valid() { return Value{}, false } rValue := l.equivalent.reflectValue() diff --git a/attribute/set_test.go b/attribute/set_test.go index 0dd3bf12124..4fb47752e5f 100644 --- a/attribute/set_test.go +++ b/attribute/set_test.go @@ -15,9 +15,11 @@ package attribute_test import ( + "reflect" "regexp" "testing" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" @@ -188,3 +190,38 @@ func TestLookup(t *testing.T) { _, has = set.Value("D") require.False(t, has) } + +func TestZeroSetExportedMethodsNoPanic(t *testing.T) { + rType := reflect.TypeOf((*attribute.Set)(nil)) + rVal := reflect.ValueOf(&attribute.Set{}) + for n := 0; n < rType.NumMethod(); n++ { + mType := rType.Method(n) + if !mType.IsExported() { + t.Logf("ignoring unexported %s", mType.Name) + continue + } + t.Run(mType.Name, func(t *testing.T) { + m := rVal.MethodByName(mType.Name) + if !m.IsValid() { + t.Errorf("unknown method: %s", mType.Name) + } + assert.NotPanics(t, func() { _ = m.Call(args(mType)) }) + }) + } +} + +func args(m reflect.Method) []reflect.Value { + numIn := m.Type.NumIn() - 1 // Do not include the receiver arg. + if numIn <= 0 { + return nil + } + if m.Type.IsVariadic() { + numIn-- + } + out := make([]reflect.Value, numIn) + for i := range out { + aType := m.Type.In(i + 1) // Skip receiver arg. + out[i] = reflect.New(aType).Elem() + } + return out +} From 6b7e207953ce0a13d38da628a6aa48ad56058d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 4 Apr 2023 19:13:43 +0200 Subject: [PATCH 486/886] Add go.work to .gitignore (#3965) Co-authored-by: Tyler Yahn --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0b605b3d67d..a2fe3ff1176 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Thumbs.db *.iml *.so coverage.* +go.work gen/ From 02fa1e2a8de2c3af311c3ba04dbda3077ae2ba73 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Wed, 5 Apr 2023 16:44:48 +0200 Subject: [PATCH 487/886] Fix aggregation.Default to properly return the default one (#3967) * fix aggregation.Default to properly return the default one * add changelog entry * default aggregation does not error anymore * test all instrument kinds --- CHANGELOG.md | 1 + sdk/metric/pipeline.go | 4 ++ sdk/metric/pipeline_registry_test.go | 57 ++++++++++++++++++++++------ 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 201c03b2a67..fde4c6d6620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `TracerProvider` allows calling `Tracer()` while it's shutting down. It used to deadlock. (#3924) - Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) +- Automatically figure out the default aggregation with `aggregation.Default`. (#3967) ## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index e94cfcb149f..efa79ba9ec6 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -390,6 +390,8 @@ func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { // returned. func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { switch a := agg.(type) { + case aggregation.Default: + return i.aggregator(DefaultAggregationSelector(kind), kind, temporality, monotonic) case aggregation.Drop: return nil, nil case aggregation.LastValue: @@ -444,6 +446,8 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin // | Observable Gauge | X | X | | | |. func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { + case aggregation.Default: + return nil case aggregation.ExplicitBucketHistogram: if kind == InstrumentKindCounter || kind == InstrumentKindHistogram { return nil diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index d3e03dca54a..642e65e6cc0 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -199,11 +199,52 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { wantLen: 2, }, { - name: "reader with invalid aggregation should error", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, - inst: instruments[InstrumentKindCounter], - wantErr: errCreatingAggregators, + name: "reader with default aggregation should figure out a Counter", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindCounter], + wantKind: internal.NewCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "reader with default aggregation should figure out an UpDownCounter", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindUpDownCounter], + wantKind: internal.NewCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "reader with default aggregation should figure out an Histogram", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindHistogram], + wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantLen: 1, + }, + { + name: "reader with default aggregation should figure out an ObservableCounter", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindObservableCounter], + wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "reader with default aggregation should figure out an ObservableUpDownCounter", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindObservableUpDownCounter], + wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantLen: 1, + }, + { + name: "reader with default aggregation should figure out an ObservableGauge", + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + views: []View{defaultView}, + inst: instruments[InstrumentKindObservableGauge], + wantKind: internal.NewLastValue[N](), + wantLen: 1, }, { name: "view with invalid aggregation should error", @@ -594,12 +635,6 @@ func TestIsAggregatorCompatible(t *testing.T) { agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, - { - name: "Default aggregation should error", - kind: InstrumentKindCounter, - agg: aggregation.Default{}, - want: errUnknownAggregation, - }, { name: "unknown kind with Sum should error", kind: undefinedInstrument, From 1c05d9c0b7cebbaf8839a84772fa3d897b1c0c42 Mon Sep 17 00:00:00 2001 From: Gustavo Paiva Date: Thu, 6 Apr 2023 15:44:13 -0300 Subject: [PATCH 488/886] prometheus: add WithNamespace option to prefix metrics (#3970) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * prometheus: add WithNamespace option to prefix metrics * sanitize namespace, add config test * Update CHANGELOG.md Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + exporters/prometheus/config.go | 20 +++++++++++++ exporters/prometheus/config_test.go | 30 +++++++++++++++++++ exporters/prometheus/exporter.go | 7 ++++- exporters/prometheus/exporter_test.go | 20 +++++++++++++ .../prometheus/testdata/with_namespace.txt | 9 ++++++ 6 files changed, 86 insertions(+), 1 deletion(-) create mode 100755 exporters/prometheus/testdata/with_namespace.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index fde4c6d6620..bb1c21ed872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) - The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) +- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) ### Changed diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index 5d50564d34a..fbca80092e7 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -15,6 +15,8 @@ package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( + "strings" + "github.com/prometheus/client_golang/prometheus" "go.opentelemetry.io/otel/sdk/metric" @@ -27,6 +29,7 @@ type config struct { withoutUnits bool aggregation metric.AggregationSelector disableScopeInfo bool + namespace string } // newConfig creates a validated config configured with options. @@ -116,3 +119,20 @@ func WithoutScopeInfo() Option { return cfg }) } + +// WithNamespace configures the Exporter to prefix metric with the given namespace. +// Metadata metrics such as target_info and otel_scope_info are not prefixed since these +// have special behavior based on their name. +func WithNamespace(ns string) Option { + return optionFunc(func(cfg config) config { + ns = sanitizeName(ns) + if !strings.HasSuffix(ns, "_") { + // namespace and metric names should be separated with an underscore, + // adds a trailing underscore if there is not one already. + ns = ns + "_" + } + + cfg.namespace = ns + return cfg + }) +} diff --git a/exporters/prometheus/config_test.go b/exporters/prometheus/config_test.go index 2dd92e7abbc..8fc88819b94 100644 --- a/exporters/prometheus/config_test.go +++ b/exporters/prometheus/config_test.go @@ -99,6 +99,36 @@ func TestNewConfig(t *testing.T) { withoutUnits: true, }, }, + { + name: "with namespace", + options: []Option{ + WithNamespace("test"), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + namespace: "test_", + }, + }, + { + name: "with namespace with trailing underscore", + options: []Option{ + WithNamespace("test_"), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + namespace: "test_", + }, + }, + { + name: "with unsanitized namespace", + options: []Option{ + WithNamespace("test/"), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + namespace: "test_", + }, + }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 357be10038c..4d383fe3144 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -66,6 +66,7 @@ type collector struct { createTargetInfoOnce sync.Once scopeInfos map[instrumentation.Scope]prometheus.Metric metricFamilies map[string]*dto.MetricFamily + namespace string } // prometheus counters MUST have a _total suffix: @@ -88,6 +89,7 @@ func New(opts ...Option) (*Exporter, error) { disableScopeInfo: cfg.disableScopeInfo, scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), metricFamilies: make(map[string]*dto.MetricFamily), + namespace: cfg.namespace, } if err := cfg.registerer.Register(collector); err != nil { @@ -316,9 +318,12 @@ var unitSuffixes = map[string]string{ "ms": "_milliseconds", } -// getName returns the sanitized name, including unit suffix. +// getName returns the sanitized name, prefixed with the namespace and suffixed with unit. func (c *collector) getName(m metricdata.Metrics) string { name := sanitizeName(m.Name) + if c.namespace != "" { + name = c.namespace + name + } if c.withoutUnits { return name } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 164dcbd0956..a790b783bd8 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -258,6 +258,26 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 1, attrs...) }, }, + { + name: "with namespace", + expectedFile: "testdata/with_namespace.txt", + options: []Option{ + WithNamespace("test"), + }, + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + attrs := []attribute.KeyValue{ + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + } + counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 10.3, attrs...) + counter.Add(ctx, 9, attrs...) + }, + }, } for _, tc := range testCases { diff --git a/exporters/prometheus/testdata/with_namespace.txt b/exporters/prometheus/testdata/with_namespace.txt new file mode 100755 index 00000000000..b41329afe95 --- /dev/null +++ b/exporters/prometheus/testdata/with_namespace.txt @@ -0,0 +1,9 @@ +# HELP test_foo_total a simple counter +# TYPE test_foo_total counter +test_foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From 38e1b499c3da3107694ad2660b3888eee9c8b896 Mon Sep 17 00:00:00 2001 From: Remy Chantenay Date: Sat, 8 Apr 2023 17:10:29 +0200 Subject: [PATCH 489/886] Add go.work.sum to .gitignore file (#3975) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a2fe3ff1176..cf29d10a7ca 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ Thumbs.db *.so coverage.* go.work +go.work.sum gen/ From a261a0f869a74a4496fae95208f2ba643d4bd1bd Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 9 Apr 2023 07:43:00 -0700 Subject: [PATCH 490/886] dependabot updates Sun Apr 9 14:31:33 UTC 2023 (#3979) Bump golang.org/x/tools from 0.7.0 to 0.8.0 in /internal/tools Bump golang.org/x/sys from 0.6.0 to 0.7.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 10 ++++----- internal/tools/go.sum | 22 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 52 files changed, 91 insertions(+), 91 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 3bc77fe0327..8eeab3e4c46 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 7d0cb35d80a..43297387fa9 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index d748bfa9312..a00ad612f97 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 07f38aee283..6e60ec60b53 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 96e6a2cbdc5..94ca9540e5a 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 077df872b06..f31f01ef6cd 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -45,8 +45,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= diff --git a/example/fib/go.mod b/example/fib/go.mod index a34a67413cf..8230a9bc7bd 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index ae80a63c253..ef90f36df25 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 26f470a69e3..13cb9afa830 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index d62f7e6d3ad..d9547e9c4cc 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index aae67ab467c..b6055885efc 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index ae80a63c253..ef90f36df25 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 8768d2eabb7..be51c2b1931 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 07f38aee283..6e60ec60b53 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index cf39de5003a..9c03228e383 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 0954787f89a..49eea4d4fa7 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -265,8 +265,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 0338c94bcb2..383135e133c 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index ae80a63c253..ef90f36df25 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index a0a59b923eb..02bbd763da3 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index e6f1f19fd74..d2e87862410 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/view/go.mod b/example/view/go.mod index e4c6e2fc168..98c5fe06510 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index e6f1f19fd74..d2e87862410 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -327,8 +327,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index c053458cbf3..26375679393 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 509c054261f..e2d6fee8563 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 391b50a8618..f06b8059b28 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 8720ec40c27..ea0c55a6d8c 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 02462c2bd2e..75cf6da148d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 29a9eab1ebb..1be0edf3865 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2d6aceacb4d..5db9dc39c76 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 29a9eab1ebb..1be0edf3865 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index d6f82a98655..8a7c0ac0bed 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.54.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 29a9eab1ebb..1be0edf3865 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 31359a73317..a7ece0804a5 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 29a9eab1ebb..1be0edf3865 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -273,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 765c6e7e55c..765150a0374 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 4f732505f58..cb72a176b95 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -274,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 8bba886dc95..98054591faf 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,7 +23,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.54.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 2f07fb8db65..334e1ddccb5 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -272,8 +272,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 04d7b3e2823..7a615708092 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 3dfe25c0f90..5a10d6244bc 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -334,8 +334,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 57e9f917516..8fb1aa0bf6a 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 290d7478ffa..da3f6e62698 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 4be49f4f9a9..88e3a74fd96 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 290d7478ffa..da3f6e62698 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 75ed402c73a..103d73f5d32 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 40c7a36bb19..875a8a082d3 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -19,8 +19,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7c441924775..62f19383dc7 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.6.0 go.opentelemetry.io/build-tools/multimod v0.6.0 go.opentelemetry.io/build-tools/semconvgen v0.6.0 - golang.org/x/tools v0.7.0 + golang.org/x/tools v0.8.0 ) require ( @@ -191,11 +191,11 @@ require ( golang.org/x/crypto v0.5.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.9.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/mod v0.10.0 // indirect + golang.org/x/net v0.9.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.6.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 186f749565b..646a400a8ad 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -693,8 +693,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -741,8 +741,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -833,8 +833,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -843,7 +843,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -856,8 +856,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -933,8 +933,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index 767b3c72f21..c9f4a41d5d6 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/trace v1.15.0-rc.2 - golang.org/x/sys v0.6.0 + golang.org/x/sys v0.7.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index ada651da2d2..817a633da6e 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -17,8 +17,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index c0a9693b881..3313a773433 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect - golang.org/x/sys v0.6.0 // indirect + golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 290d7478ffa..da3f6e62698 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 1bc9b56a1755f1885be62a0032e7804b60557bb2 Mon Sep 17 00:00:00 2001 From: Luke Stoward Date: Mon, 10 Apr 2023 15:29:01 +0100 Subject: [PATCH 491/886] [exporters/otlp/otlpmetric] Wrap upload metrics error to provide additional context (#3974) * Wrap upload metrics error to provide additional context * Add PR number to CHANGELOG * Update CHANGELOG.md Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + exporters/otlp/otlpmetric/internal/exporter.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb1c21ed872..5a75215263e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` +- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) ### Fixed diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index 828ee83c2bb..e1d912dabdd 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -58,7 +58,7 @@ func (e *exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e e.clientMu.Unlock() if upErr != nil { if err == nil { - return upErr + return fmt.Errorf("failed to upload metrics: %w", upErr) } // Merge the two errors. return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr) From 1b97d78324434bb65a44c9340b6a124821b9be6f Mon Sep 17 00:00:00 2001 From: Remy Chantenay Date: Mon, 10 Apr 2023 23:19:49 +0200 Subject: [PATCH 492/886] Add Version func to otlpmetric and otlptrace (#3956) * Add Version func to otel/exporters/otlp/otlpmetric * Add Version func to otel/exporters/otlp/otlptrace * Remove Version func from otel/exporters/otlp/internal * Update CHANGELOG.md * Add nolint rule to hostid readFile * Move GetUserAgentHeader to internal packages * Update exporters/otlp/otlpmetric/version.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlptrace/version.go Co-authored-by: Tyler Yahn --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 2 ++ .../otlp/{ => otlpmetric}/internal/header.go | 11 +++--- .../{ => otlpmetric}/internal/header_test.go | 3 +- .../otlp/otlpmetric/internal/oconf/options.go | 3 +- .../otlp/otlpmetric/otlpmetrichttp/client.go | 2 +- exporters/otlp/otlpmetric/version.go | 20 +++++++++++ exporters/otlp/otlpmetric/version_test.go | 34 +++++++++++++++++++ exporters/otlp/otlptrace/internal/header.go | 25 ++++++++++++++ .../otlp/otlptrace/internal/header_test.go | 25 ++++++++++++++ .../otlptrace/internal/otlpconfig/options.go | 3 +- .../otlp/otlptrace/otlptracehttp/client.go | 3 +- exporters/otlp/otlptrace/version.go | 20 +++++++++++ exporters/otlp/otlptrace/version_test.go | 34 +++++++++++++++++++ sdk/resource/host_id.go | 1 + 14 files changed, 175 insertions(+), 11 deletions(-) rename exporters/otlp/{ => otlpmetric}/internal/header.go (75%) rename exporters/otlp/{ => otlpmetric}/internal/header_test.go (83%) create mode 100644 exporters/otlp/otlpmetric/version.go create mode 100644 exporters/otlp/otlpmetric/version_test.go create mode 100644 exporters/otlp/otlptrace/internal/header.go create mode 100644 exporters/otlp/otlptrace/internal/header_test.go create mode 100644 exporters/otlp/otlptrace/version.go create mode 100644 exporters/otlp/otlptrace/version_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a75215263e..bfcba5231a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) - The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) - Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) +- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) ### Changed diff --git a/exporters/otlp/internal/header.go b/exporters/otlp/otlpmetric/internal/header.go similarity index 75% rename from exporters/otlp/internal/header.go rename to exporters/otlp/otlpmetric/internal/header.go index 9aa62ed9e8e..dde06fa8537 100644 --- a/exporters/otlp/internal/header.go +++ b/exporters/otlp/otlpmetric/internal/header.go @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package internal contains common functionality for all OTLP exporters. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" -import "go.opentelemetry.io/otel" +import ( + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +) -// GetUserAgentHeader return an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" +// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent func GetUserAgentHeader() string { - return "OTel OTLP Exporter Go/" + otel.Version() + return "OTel OTLP Exporter Go/" + otlpmetric.Version() } diff --git a/exporters/otlp/internal/header_test.go b/exporters/otlp/otlpmetric/internal/header_test.go similarity index 83% rename from exporters/otlp/internal/header_test.go rename to exporters/otlp/otlpmetric/internal/header_test.go index ecca1a9490e..d93340fc0d6 100644 --- a/exporters/otlp/internal/header_test.go +++ b/exporters/otlp/otlpmetric/internal/header_test.go @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package internal contains common functionality for all OTLP exporters. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" +package internal import ( "testing" diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index b5ab4e6f315..e696a0f78ba 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -27,6 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -116,7 +117,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())}, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(ominternal.GetUserAgentHeader())}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index a362b45087e..8b90a090b87 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -108,7 +108,7 @@ func newClient(opts ...Option) (ominternal.Client, error) { return nil, err } - req.Header.Set("User-Agent", internal.GetUserAgentHeader()) + req.Header.Set("User-Agent", ominternal.GetUserAgentHeader()) if n := len(cfg.Metrics.Headers); n > 0 { for k, v := range cfg.Metrics.Headers { diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go new file mode 100644 index 00000000000..952e6c02226 --- /dev/null +++ b/exporters/otlp/otlpmetric/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + +// Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. +func Version() string { + return "1.15.0-rc.2" +} diff --git a/exporters/otlp/otlpmetric/version_test.go b/exporters/otlp/otlpmetric/version_test.go new file mode 100644 index 00000000000..e0f3a3ef3b5 --- /dev/null +++ b/exporters/otlp/otlpmetric/version_test.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetric_test + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := otlpmetric.Version() + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +} diff --git a/exporters/otlp/otlptrace/internal/header.go b/exporters/otlp/otlptrace/internal/header.go new file mode 100644 index 00000000000..7fcd89a40fb --- /dev/null +++ b/exporters/otlp/otlptrace/internal/header.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + +import ( + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" +// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent +func GetUserAgentHeader() string { + return "OTel OTLP Exporter Go/" + otlptrace.Version() +} diff --git a/exporters/otlp/otlptrace/internal/header_test.go b/exporters/otlp/otlptrace/internal/header_test.go new file mode 100644 index 00000000000..d93340fc0d6 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/header_test.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetUserAgentHeader(t *testing.T) { + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", GetUserAgentHeader()) +} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index c48ffd53081..1a6bb423b30 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -27,6 +27,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" ) const ( @@ -97,7 +98,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())}, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(otinternal.GetUserAgentHeader())}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 9fbe861717d..be21724212b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -33,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" @@ -209,7 +210,7 @@ func (d *client) newRequest(body []byte) (request, error) { return request{Request: r}, err } - r.Header.Set("User-Agent", internal.GetUserAgentHeader()) + r.Header.Set("User-Agent", otinternal.GetUserAgentHeader()) for k, v := range d.cfg.Headers { r.Header.Set(k, v) diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go new file mode 100644 index 00000000000..1a1977e975c --- /dev/null +++ b/exporters/otlp/otlptrace/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + +// Version is the current release version of the OpenTelemetry OTLP trace exporter in use. +func Version() string { + return "1.15.0-rc.2" +} diff --git a/exporters/otlp/otlptrace/version_test.go b/exporters/otlp/otlptrace/version_test.go new file mode 100644 index 00000000000..62558d99751 --- /dev/null +++ b/exporters/otlp/otlptrace/version_test.go @@ -0,0 +1,34 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptrace_test + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := otlptrace.Version() + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +} diff --git a/sdk/resource/host_id.go b/sdk/resource/host_id.go index 32a616d0879..39e35f4f2bf 100644 --- a/sdk/resource/host_id.go +++ b/sdk/resource/host_id.go @@ -38,6 +38,7 @@ type fileReader func(string) (string, error) type commandExecutor func(string, ...string) (string, error) +// nolint: unused // This is used by the hostReaderBSD, gated by build tags. func readFile(filename string) (string, error) { b, err := os.ReadFile(filename) if err != nil { From 2b2817c4f442e62414cbc649ee0ed74988f845b3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 11 Apr 2023 16:57:38 -0700 Subject: [PATCH 493/886] Fix embedded documentation links (#3982) --- metric/embedded/embedded.go | 275 ++++++++++++++++++------------------ 1 file changed, 138 insertions(+), 137 deletions(-) diff --git a/metric/embedded/embedded.go b/metric/embedded/embedded.go index a4f2bdfe456..641cd29dfb8 100644 --- a/metric/embedded/embedded.go +++ b/metric/embedded/embedded.go @@ -21,213 +21,214 @@ // extended (which is something that can happen without a major version bump of // the API package). // -// [OpenTelemetry metric API]: go.opentelemetry.io/otel/metric +// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric package embedded // import "go.opentelemetry.io/otel/metric/embedded" -// MeterProvider is embedded in the OpenTelemetry metric API [MeterProvider]. +// MeterProvider is embedded in +// [go.opentelemetry.io/otel/metric.MeterProvider]. // -// Embed this interface in your implementation of the [MeterProvider] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [MeterProvider] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -// -// [MeterProvider]: go.opentelemetry.io/otel/metric.MeterProvider +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). type MeterProvider interface{ meterProvider() } -// Meter is embedded in the OpenTelemetry metric API [Meter]. -// -// Embed this interface in your implementation of the [Meter] if you want users -// to experience a compilation error, signaling they need to update to your -// latest implementation, when the [Meter] interface is extended (which is -// something that can happen without a major version bump of the API package). +// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter]. // -// [Meter]: go.opentelemetry.io/otel/metric.Meter +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). type Meter interface{ meter() } -// Float64Observer is embedded in the OpenTelemetry metric API -// [Float64Observer]. +// Float64Observer is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64Observer]. // -// Embed this interface in your implementation of the [Float64Observer] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Float64Observer] interface is +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Float64Observer] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64Observer] interface is // extended (which is something that can happen without a major version bump of // the API package). -// -// [Float64Observer]: go.opentelemetry.io/otel/metric.Float64Observer type Float64Observer interface{ float64Observer() } -// Int64Observer is embedded in the OpenTelemetry metric API [Int64Observer]. +// Int64Observer is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64Observer]. // -// Embed this interface in your implementation of the [Int64Observer] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Int64Observer] interface is +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64Observer] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64Observer] interface is // extended (which is something that can happen without a major version bump of // the API package). -// -// [Int64Observer]: go.opentelemetry.io/otel/metric.Int64Observer type Int64Observer interface{ int64Observer() } -// Observer is embedded in the OpenTelemetry metric API [Observer]. -// -// Embed this interface in your implementation of the [Observer] if you want -// users to experience a compilation error, signaling they need to update to -// your latest implementation, when the [Observer] interface is extended (which -// is something that can happen without a major version bump of the API -// package). +// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer]. // -// [Observer]: go.opentelemetry.io/otel/metric.Observer +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Observer] +// interface is extended (which is something that can happen without a major +// version bump of the API package). type Observer interface{ observer() } -// Registration is embedded in the OpenTelemetry metric API [Registration]. -// -// Embed this interface in your implementation of the [Registration] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Registration] interface is extended -// (which is something that can happen without a major version bump of the API -// package). +// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration]. // -// [Registration]: go.opentelemetry.io/otel/metric.Registration +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric.Registration] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/metric.Registration] +// interface is extended (which is something that can happen without a major +// version bump of the API package). type Registration interface{ registration() } -// Float64Counter is embedded in the OpenTelemetry metric API [Float64Counter]. +// Float64Counter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64Counter]. // -// Embed this interface in your implementation of the [Float64Counter] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Float64Counter] interface is +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Float64Counter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64Counter] interface is // extended (which is something that can happen without a major version bump of // the API package). -// -// [Float64Counter]: go.opentelemetry.io/otel/metric.Float64Counter type Float64Counter interface{ float64Counter() } -// Float64Histogram is embedded in the OpenTelemetry metric API -// [Float64Histogram]. +// Float64Histogram is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram]. // -// Embed this interface in your implementation of the [Float64Histogram] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Float64Histogram] interface is +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram] interface is // extended (which is something that can happen without a major version bump of // the API package). -// -// [Float64Histogram]: go.opentelemetry.io/otel/metric.Float64Histogram type Float64Histogram interface{ float64Histogram() } -// Float64ObservableCounter is embedded in the OpenTelemetry metric API -// [Float64ObservableCounter]. +// Float64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter]. // // Embed this interface in your implementation of the -// [Float64ObservableCounter] if you want users to experience a compilation -// error, signaling they need to update to your latest implementation, when the -// [Float64ObservableCounter] interface is extended (which is something that -// can happen without a major version bump of the API package). -// -// [Float64ObservableCounter]: go.opentelemetry.io/otel/metric.Float64ObservableCounter +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter] +// interface is extended (which is something that can happen without a major +// version bump of the API package). type Float64ObservableCounter interface{ float64ObservableCounter() } -// Float64ObservableGauge is embedded in the OpenTelemetry metric API -// [Float64ObservableGauge]. +// Float64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge]. // -// Embed this interface in your implementation of the [Float64ObservableGauge] -// if you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the [Float64ObservableGauge] +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge] // interface is extended (which is something that can happen without a major // version bump of the API package). -// -// [Float64ObservableGauge]: go.opentelemetry.io/otel/metric.Float64ObservableGauge type Float64ObservableGauge interface{ float64ObservableGauge() } -// Float64ObservableUpDownCounter is embedded in the OpenTelemetry metric API -// [Float64ObservableUpDownCounter]. +// Float64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter]. // // Embed this interface in your implementation of the -// [Float64ObservableUpDownCounter] if you want users to experience a -// compilation error, signaling they need to update to your latest -// implementation, when the [Float64ObservableUpDownCounter] interface is -// extended (which is something that can happen without a major version bump of -// the API package). -// -// [Float64ObservableUpDownCounter]: go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter -type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } - -// Float64UpDownCounter is embedded in the OpenTelemetry metric API -// [Float64UpDownCounter]. -// -// Embed this interface in your implementation of the [Float64UpDownCounter] if -// you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the [Float64UpDownCounter] +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). -// -// [Float64UpDownCounter]: go.opentelemetry.io/otel/metric.Float64UpDownCounter -type Float64UpDownCounter interface{ float64UpDownCounter() } +type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } -// Int64Counter is embedded in the OpenTelemetry metric API [Int64Counter]. +// Float64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter]. // -// Embed this interface in your implementation of the [Int64Counter] if you +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter] if you // want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Int64Counter] interface is extended -// (which is something that can happen without a major version bump of the API -// package). +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Float64UpDownCounter interface{ float64UpDownCounter() } + +// Int64Counter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64Counter]. // -// [Int64Counter]: go.opentelemetry.io/otel/metric.Int64Counter +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64Counter] if you want users +// to experience a compilation error, signaling they need to update to your +// latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64Counter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). type Int64Counter interface{ int64Counter() } -// Int64Histogram is embedded in the OpenTelemetry metric API [Int64Histogram]. +// Int64Histogram is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram]. // -// Embed this interface in your implementation of the [Int64Histogram] if you -// want users to experience a compilation error, signaling they need to update -// to your latest implementation, when the [Int64Histogram] interface is +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram] interface is // extended (which is something that can happen without a major version bump of // the API package). -// -// [Int64Histogram]: go.opentelemetry.io/otel/metric.Int64Histogram type Int64Histogram interface{ int64Histogram() } -// Int64ObservableCounter is embedded in the OpenTelemetry metric API -// [Int64ObservableCounter]. +// Int64ObservableCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter]. // -// Embed this interface in your implementation of the [Int64ObservableCounter] -// if you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the [Int64ObservableCounter] +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). -// -// [Int64ObservableCounter]: go.opentelemetry.io/otel/metric.Int64ObservableCounter type Int64ObservableCounter interface{ int64ObservableCounter() } -// Int64ObservableGauge is embedded in the OpenTelemetry metric API -// [Int64ObservableGauge]. +// Int64ObservableGauge is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge]. // -// Embed this interface in your implementation of the [Int64ObservableGauge] if -// you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the [Int64ObservableGauge] -// interface is extended (which is something that can happen without a major -// version bump of the API package). -// -// [Int64ObservableGauge]: go.opentelemetry.io/otel/metric.Int64ObservableGauge +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge] if you +// want users to experience a compilation error, signaling they need to update +// to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge] interface +// is extended (which is something that can happen without a major version bump +// of the API package). type Int64ObservableGauge interface{ int64ObservableGauge() } -// Int64ObservableUpDownCounter is embedded in the OpenTelemetry metric API -// [Int64ObservableUpDownCounter]. +// Int64ObservableUpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter]. // // Embed this interface in your implementation of the -// [Int64ObservableUpDownCounter] if you want users to experience a compilation -// error, signaling they need to update to your latest implementation, when the -// [Int64ObservableUpDownCounter] interface is extended (which is something -// that can happen without a major version bump of the API package). -// -// [Int64ObservableUpDownCounter]: go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter -type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } - -// Int64UpDownCounter is embedded in the OpenTelemetry metric API -// [Int64UpDownCounter]. -// -// Embed this interface in your implementation of the [Int64UpDownCounter] if +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter] if // you want users to experience a compilation error, signaling they need to -// update to your latest implementation, when the [Int64UpDownCounter] +// update to your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). +type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } + +// Int64UpDownCounter is embedded in +// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter]. // -// [Int64UpDownCounter]: go.opentelemetry.io/otel/metric.Int64UpDownCounter +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter] if you want +// users to experience a compilation error, signaling they need to update to +// your latest implementation, when the +// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter] interface is +// extended (which is something that can happen without a major version bump of +// the API package). type Int64UpDownCounter interface{ int64UpDownCounter() } From 1b55281859bfaf4b03b7968a059c5239cf8c7a20 Mon Sep 17 00:00:00 2001 From: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:28:13 -0700 Subject: [PATCH 494/886] docs(typos): Run codespell to fix typos (#3980) * docs(typos): Run codespell to fix typos There were a lot of typos through the repository, so I ran [codespell][], a tool for automatically fixing typos, to fix them. ```console make codespell ``` There's already a tool called [misspell][] that's supposed to take care of this, but misspell hasn't been updated for 6 years, and it doesn't seem to be catching any of the typos that codespell can. [codespell]: https://github.com/codespell-project/codespell [misspell]: https://github.com/client9/misspell * Revert and ignore spelling for Consequentially * Add GH workflow for codespell * Revert GH Workflow and Makefile for codespell Per @pellared, since there's no instructions for setting up codespell, it was suggested that the changes for setting up a workflow and section in Makefile include instructions for setting up codespell as well. * Revert spelling on consequently --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/changelog.yml | 2 +- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 14 +++++++------- CONTRIBUTING.md | 8 ++++---- .../internal/oc2otel/span_context_test.go | 2 +- .../internal/otel2oc/span_context_test.go | 2 +- bridge/opencensus/internal/span.go | 2 +- bridge/opencensus/test/bridge_test.go | 12 ++++++------ bridge/opentracing/util.go | 2 +- .../third_party/thrift/lib/go/thrift/exception.go | 2 +- .../third_party/thrift/lib/go/thrift/transport.go | 2 +- .../third_party/thrift/lib/go/thrift/type.go | 2 +- exporters/jaeger/reconnecting_udp_client_test.go | 2 +- .../otlp/otlpmetric/internal/otest/collector.go | 4 ++-- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdouttrace/trace.go | 2 +- metric/meter.go | 2 +- propagation/trace_context_test.go | 2 +- sdk/metric/benchmark_test.go | 2 +- sdk/metric/cache.go | 2 +- sdk/metric/instrument.go | 2 +- sdk/metric/internal/aggregator_test.go | 2 +- sdk/metric/meter_test.go | 6 +++--- .../metricdata/metricdatatest/comparisons.go | 6 +++--- sdk/metric/reader_test.go | 2 +- sdk/trace/batch_span_processor.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/span_exporter.go | 2 +- sdk/trace/trace_test.go | 4 ++-- trace/config_test.go | 2 +- trace/noop.go | 4 ++-- 31 files changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 1472e6f9a81..a1bae7d71ce 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,6 @@ # This action requires that any PR targeting the main branch should touch at # least one CHANGELOG file. If a CHANGELOG entry is not required, or if -# performing maintance on the Changelog, add either \"[chore]\" to the title of +# performing maintenance on the Changelog, add either \"[chore]\" to the title of # the pull request or add the \"Skip Changelog\" label to disable this action. name: changelog diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dda2d66d48..48c9ab70ad6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: go-version: ["1.20", 1.19] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default - # runners. It is possible to acomplish this with a self-hosted runner + # runners. It is possible to accomplish this with a self-hosted runner # if we want to add this in the future: # https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow arch: ["386", amd64] diff --git a/CHANGELOG.md b/CHANGELOG.md index bfcba5231a5..84258be83be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -222,7 +222,7 @@ The next release will require at least [Go 1.19]. - The `go.opentelemetry.io/otel/semconv/v1.16.0` package. The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579) - Metric instruments to `go.opentelemetry.io/otel/metric/instrument`. - These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) + These instruments are use as replacements of the deprecated `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586) - `Float64ObservableCounter` replaces the `asyncfloat64.Counter` - `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter` - `Float64ObservableGauge` replaces the `asyncfloat64.Gauge` @@ -245,7 +245,7 @@ The next release will require at least [Go 1.19]. ### Changed - Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500) -- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and confguration based on the instrument type. (#3507) +- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration based on the instrument type. (#3507) - Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`. - Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`. - Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`. @@ -258,7 +258,7 @@ The next release will require at least [Go 1.19]. - The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551) - The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions. This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557) -- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in erros identifying their signal name. +- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors identifying their signal name. Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516) - Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514) - The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562) @@ -367,7 +367,7 @@ The next release will require at least [Go 1.19]. - Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398) - Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340) - `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436) -- Reenabled Attribute Filters in the Metric SDK. (#3396) +- Re-enabled Attribute Filters in the Metric SDK. (#3396) - Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408) - Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432) - Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440) @@ -948,7 +948,7 @@ This release includes an API and SDK for the tracing signal that will comply wit - Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140) - The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169) - Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120) -- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly ommit timestamps. (#2195) +- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195) - Fixed typos in resources.go. (#2201) ## [1.0.0-RC2] - 2021-07-26 @@ -1394,7 +1394,7 @@ with major version 0. - `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369) - Added documentation about the project's versioning policy. (#1388) - Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418) -- Added codeql worfklow to GitHub Actions (#1428) +- Added codeql workflow to GitHub Actions (#1428) - Added Gosec workflow to GitHub Actions (#1429) - Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420) - Add an OpenCensus exporter bridge. (#1444) @@ -2237,7 +2237,7 @@ There is still a possibility of breaking changes. ### Fixed -- Use stateful batcher on Prometheus exporter fixing regresion introduced in #395. (#428) +- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428) ## [0.2.1] - 2020-01-08 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cbfc8f013c6..d9b264d30a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -244,7 +244,7 @@ Meaning a `config` from one package should not be directly used by another. The one exception is the API packages. The configs from the base API, eg. `go.opentelemetry.io/otel/trace.TracerConfig` and `go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed -by the SDK therefor it is expected that these are exported. +by the SDK therefore it is expected that these are exported. When a config is exported we want to maintain forward and backward compatibility, to achieve this no fields should be exported but should @@ -262,12 +262,12 @@ func newConfig(options ...Option) config { for _, option := range options { config = option.apply(config) } - // Preform any validation here. + // Perform any validation here. return config } ``` -If validation of the `config` options is also preformed this can return an +If validation of the `config` options is also performed this can return an error as well that is expected to be handled by the instantiation function or propagated to the user. @@ -466,7 +466,7 @@ their parameters appropriately named. #### Interface Stability All exported stable interfaces that include the following warning in their -doumentation are allowed to be extended with additional methods. +documentation are allowed to be extended with additional methods. > Warning: methods may be added to this interface in minor releases. diff --git a/bridge/opencensus/internal/oc2otel/span_context_test.go b/bridge/opencensus/internal/oc2otel/span_context_test.go index ba0f1d0bfcc..b45d5fd3931 100644 --- a/bridge/opencensus/internal/oc2otel/span_context_test.go +++ b/bridge/opencensus/internal/oc2otel/span_context_test.go @@ -73,7 +73,7 @@ func TestSpanContextConversion(t *testing.T) { t.Run(tc.description, func(t *testing.T) { output := SpanContext(tc.input) if !output.Equal(tc.expected) { - t.Fatalf("Got %+v spancontext, exepected %+v.", output, tc.expected) + t.Fatalf("Got %+v spancontext, expected %+v.", output, tc.expected) } }) } diff --git a/bridge/opencensus/internal/otel2oc/span_context_test.go b/bridge/opencensus/internal/otel2oc/span_context_test.go index 236aa89689a..2660009827d 100644 --- a/bridge/opencensus/internal/otel2oc/span_context_test.go +++ b/bridge/opencensus/internal/otel2oc/span_context_test.go @@ -60,7 +60,7 @@ func TestSpanContextConversion(t *testing.T) { t.Run(tc.description, func(t *testing.T) { output := SpanContext(tc.input) if output != tc.expected { - t.Fatalf("Got %+v spancontext, exepected %+v.", output, tc.expected) + t.Fatalf("Got %+v spancontext, expected %+v.", output, tc.expected) } }) } diff --git a/bridge/opencensus/internal/span.go b/bridge/opencensus/internal/span.go index 21449aa3d3a..0cf38117194 100644 --- a/bridge/opencensus/internal/span.go +++ b/bridge/opencensus/internal/span.go @@ -55,7 +55,7 @@ func (s *Span) IsRecordingEvents() bool { return s.otelSpan.IsRecording() } -// End ends thi span. +// End ends this span. func (s *Span) End() { s.otelSpan.End() } diff --git a/bridge/opencensus/test/bridge_test.go b/bridge/opencensus/test/bridge_test.go index fb8647bd204..5a278be0dfe 100644 --- a/bridge/opencensus/test/bridge_test.go +++ b/bridge/opencensus/test/bridge_test.go @@ -60,7 +60,7 @@ func TestMixedAPIs(t *testing.T) { for _, span := range spans { t.Logf("Span: %s", span.Name()) } - t.Fatalf("Got %d spans, exepected %d.", len(spans), 4) + t.Fatalf("Got %d spans, expected %d.", len(spans), 4) } var parent trace.SpanContext @@ -86,11 +86,11 @@ func TestStartOptions(t *testing.T) { spans := sr.Ended() if len(spans) != 1 { - t.Fatalf("Got %d spans, exepected %d", len(spans), 1) + t.Fatalf("Got %d spans, expected %d", len(spans), 1) } if spans[0].SpanKind() != trace.SpanKindClient { - t.Errorf("Got span kind %v, exepected %d", spans[0].SpanKind(), trace.SpanKindClient) + t.Errorf("Got span kind %v, expected %d", spans[0].SpanKind(), trace.SpanKindClient) } } @@ -109,7 +109,7 @@ func TestStartSpanWithRemoteParent(t *testing.T) { spans := sr.Ended() if len(spans) != 1 { - t.Fatalf("Got %d spans, exepected %d", len(spans), 1) + t.Fatalf("Got %d spans, expected %d", len(spans), 1) } if psid := spans[0].Parent().SpanID(); psid != parent.SpanContext().SpanID() { @@ -142,7 +142,7 @@ func TestToFromContext(t *testing.T) { spans := sr.Ended() if len(spans) != 2 { - t.Fatalf("Got %d spans, exepected %d.", len(spans), 2) + t.Fatalf("Got %d spans, expected %d.", len(spans), 2) } var parent trace.SpanContext @@ -209,7 +209,7 @@ func TestSetThings(t *testing.T) { spans := sr.Ended() if len(spans) != 1 { - t.Fatalf("Got %d spans, exepected %d.", len(spans), 1) + t.Fatalf("Got %d spans, expected %d.", len(spans), 1) } s := spans[0] diff --git a/bridge/opentracing/util.go b/bridge/opentracing/util.go index d770bacec42..725777c7adb 100644 --- a/bridge/opentracing/util.go +++ b/bridge/opentracing/util.go @@ -33,7 +33,7 @@ func NewTracerPair(tracer trace.Tracer) (*BridgeTracer, *WrapperTracerProvider) return bridgeTracer, wrapperProvider } -// NewTracerPairWithContext is a convience function. It calls NewTracerPair +// NewTracerPairWithContext is a convenience function. It calls NewTracerPair // and returns a hooked version of ctx with the created BridgeTracer along // with the BridgeTracer and WrapperTracerProvider. func NewTracerPairWithContext(ctx context.Context, tracer trace.Tracer) (context.Context, *BridgeTracer, *WrapperTracerProvider) { diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go index 53bf862ea5b..630b938f004 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go @@ -77,7 +77,7 @@ const ( // WrapTException wraps an error into TException. // // If err is nil or already TException, it's returned as-is. -// Otherwise it will be wraped into TException with TExceptionType() returning +// Otherwise it will be wrapped into TException with TExceptionType() returning // TExceptionTypeUnknown, and Unwrap() returning the original error. func WrapTException(err error) TException { if err == nil { diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go index ba2738a8df1..d68d0b3179c 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go @@ -56,7 +56,7 @@ type stringWriter interface { WriteString(s string) (n int, err error) } -// This is "enchanced" transport with extra capabilities. You need to use one of these +// This is "enhanced" transport with extra capabilities. You need to use one of these // to construct protocol. // Notably, TSocket does not implement this interface, and it is always a mistake to use // TSocket directly in protocol. diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go index 4292ffcadb1..b24f1b05c45 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go @@ -40,7 +40,7 @@ const ( LIST = 15 UTF8 = 16 UTF16 = 17 - //BINARY = 18 wrong and unusued + //BINARY = 18 wrong and unused ) var typeNames = map[int]string{ diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go index d416b0b3ad3..8d29eaf5eb4 100644 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ b/exporters/jaeger/reconnecting_udp_client_test.go @@ -146,7 +146,7 @@ func waitForConnCondition(conn *reconnectingUDPConn, condition func(conn *reconn func newMockUDPAddr(t *testing.T, port int) *net.UDPAddr { buf := make([]byte, 4) - // random is not seeded to ensure tests are deterministic (also doesnt matter if ip is valid) + // random is not seeded to ensure tests are deterministic (also does not matter if ip is valid) _, err := rand.Read(buf) require.NoError(t, err) diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index e14f486f5bd..95e757daef1 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -98,7 +98,7 @@ type GRPCCollector struct { // NewGRPCCollector returns a *GRPCCollector that is listening at the provided // endpoint. // -// If endpoint is an empty string, the returned collector will be listeing on +// If endpoint is an empty string, the returned collector will be listening on // the localhost interface at an OS chosen port. // // If errCh is not nil, the collector will respond to Export calls with errors @@ -204,7 +204,7 @@ type HTTPCollector struct { // NewHTTPCollector returns a *HTTPCollector that is listening at the provided // endpoint. // -// If endpoint is an empty string, the returned collector will be listeing on +// If endpoint is an empty string, the returned collector will be listening on // the localhost interface at an OS chosen port, not use TLS, and listen at the // default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains // a prefix of "https" the server will generate weak self-signed TLS diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index a790b783bd8..d80d8899c5d 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -336,7 +336,7 @@ func TestSantitizeName(t *testing.T) { input string want string }{ - {"nam€_with_3_width_rune", "nam__with_3_width_rune"}, + {"name€_with_4_width_rune", "name__with_4_width_rune"}, {"`", "_"}, { `! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWKYZ[]\^_abcdefghijklmnopqrstuvwkyz{|}~`, diff --git a/exporters/stdout/stdouttrace/trace.go b/exporters/stdout/stdouttrace/trace.go index c1da03c9365..21658151075 100644 --- a/exporters/stdout/stdouttrace/trace.go +++ b/exporters/stdout/stdouttrace/trace.go @@ -93,7 +93,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) return nil } -// Shutdown is called to stop the exporter, it preforms no action. +// Shutdown is called to stop the exporter, it performs no action. func (e *Exporter) Shutdown(ctx context.Context) error { e.stoppedMu.Lock() e.stopped = true diff --git a/metric/meter.go b/metric/meter.go index 5e7ca5bea5e..f09feca83aa 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -121,7 +121,7 @@ type Meter interface { // Callback is a function registered with a Meter that makes observations for // the set of instruments it is registered with. The Observer parameter is used -// to record measurment observations for these instruments. +// to record measurement observations for these instruments. // // The function needs to complete in a finite amount of time and the deadline // of the passed context is expected to be honored. diff --git a/propagation/trace_context_test.go b/propagation/trace_context_test.go index ccc8f2ef03a..3d575e1b418 100644 --- a/propagation/trace_context_test.go +++ b/propagation/trace_context_test.go @@ -82,7 +82,7 @@ func TestExtractValidTraceContext(t *testing.T) { }), }, { - name: "invalid tracestate perserves traceparent", + name: "invalid tracestate preserves traceparent", header: http.Header{ traceparent: []string{"00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00"}, tracestate: []string{"invalid$@#=invalid"}, diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 9a30cd1749d..67e856b2ab8 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -129,7 +129,7 @@ func benchCollectHistograms(count int) func(*testing.B) { h.Record(ctx, 1) } - // Store bechmark results in a closure to prevent the compiler from + // Store benchmark results in a closure to prevent the compiler from // inlining and skipping the function. var ( collectedMetrics metricdata.ResourceMetrics diff --git a/sdk/metric/cache.go b/sdk/metric/cache.go index 110e4900577..de9d6f0019d 100644 --- a/sdk/metric/cache.go +++ b/sdk/metric/cache.go @@ -30,7 +30,7 @@ type cache[K comparable, V any] struct { data map[K]V } -// Lookup returns the value stored in the cache with the accociated key if it +// Lookup returns the value stored in the cache with the associated key if it // exists. Otherwise, f is called and its returned value is set in the cache // for key and returned. // diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 9e8de50cffe..e75e373d46c 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -290,7 +290,7 @@ func (o *observable[N]) observe(val N, attrs []attribute.KeyValue) { var errEmptyAgg = errors.New("no aggregators for observable instrument") // registerable returns an error if the observable o should not be registered, -// and nil if it should. An errEmptyAgg error is returned if o is effecively a +// and nil if it should. An errEmptyAgg error is returned if o is effectively a // no-op because it does not have any aggregators. Also, an error is returned // if scope defines a Meter other than the one o was created by. func (o *observable[N]) registerable(scope instrumentation.Scope) error { diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregator_test.go index 03b9a91c3ea..6f5f32b1dc7 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregator_test.go @@ -70,7 +70,7 @@ type expectFunc func(m int) metricdata.Aggregation // made MeasurementN number of times. This will be done in GoroutineN number // of different goroutines. After the Aggregator has been asked to aggregate // all these measurements, it is validated using a passed expecterFunc. This -// set of operation is a signle cycle, and the the aggregatorTester will run +// set of operation is a single cycle, and the the aggregatorTester will run // CycleN number of cycles. type aggregatorTester[N int64 | float64] struct { // GoroutineN is the number of goroutines aggregatorTester will use to run diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index ef8c579d534..30e30903e31 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -499,7 +499,7 @@ func TestRegisterNonSDKObserverErrors(t *testing.T) { t, err, "invalid observable: from different implementation", - "External instrument registred", + "External instrument registered", ) } @@ -521,13 +521,13 @@ func TestMeterMixingOnRegisterErrors(t *testing.T) { t, err, `invalid registration: observable "int64 ctr" from Meter "scope2", registered with Meter "scope1"`, - "Instrument registred with non-creation Meter", + "Instrument registered with non-creation Meter", ) assert.ErrorContains( t, err, `invalid registration: observable "float64 ctr" from Meter "scope2", registered with Meter "scope1"`, - "Instrument registred with non-creation Meter", + "Instrument registered with non-creation Meter", ) } diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 1187ac1986c..b3ec710e933 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -455,7 +455,7 @@ func compareDiff[T any](extraExpected, extraActual []T) string { return "" } - formater := func(v T) string { + formatter := func(v T) string { return fmt.Sprintf("%#v", v) } @@ -463,14 +463,14 @@ func compareDiff[T any](extraExpected, extraActual []T) string { if len(extraExpected) > 0 { _, _ = msg.WriteString("missing expected values:\n") for _, v := range extraExpected { - _, _ = msg.WriteString(formater(v) + "\n") + _, _ = msg.WriteString(formatter(v) + "\n") } } if len(extraActual) > 0 { _, _ = msg.WriteString("unexpected additional values:\n") for _, v := range extraActual { - _, _ = msg.WriteString(formater(v) + "\n") + _, _ = msg.WriteString(formatter(v) + "\n") } } diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 6c523cdf7a3..3c024bbc5e5 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -280,7 +280,7 @@ func benchReaderCollectFunc(r Reader) func(*testing.B) { ctx := context.Background() r.register(testSDKProducer{}) - // Store bechmark results in a closure to prevent the compiler from + // Store benchmark results in a closure to prevent the compiler from // inlining and skipping the function. var ( collectedMetrics metricdata.ResourceMetrics diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index a2d7db49001..43d5b042303 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -91,7 +91,7 @@ var _ SpanProcessor = (*batchSpanProcessor)(nil) // NewBatchSpanProcessor creates a new SpanProcessor that will send completed // span batches to the exporter with the supplied options. // -// If the exporter is nil, the span processor will preform no action. +// If the exporter is nil, the span processor will perform no action. func NewBatchSpanProcessor(exporter SpanExporter, options ...BatchSpanProcessorOption) SpanProcessor { maxQueueSize := env.BatchSpanProcessorMaxQueueSize(DefaultMaxQueueSize) maxExportBatchSize := env.BatchSpanProcessorMaxExportBatchSize(DefaultMaxExportBatchSize) diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 8ec7da7f744..4fcca26e088 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -302,7 +302,7 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // most a length of limit. Each string slice value is truncated in this fashion // (the slice length itself is unaffected). // -// No truncation is perfromed for a negative limit. +// No truncation is performed for a negative limit. func truncateAttr(limit int, attr attribute.KeyValue) attribute.KeyValue { if limit < 0 { return attr diff --git a/sdk/trace/span_exporter.go b/sdk/trace/span_exporter.go index 9fb3d6eac3b..c9bd52f7ad4 100644 --- a/sdk/trace/span_exporter.go +++ b/sdk/trace/span_exporter.go @@ -38,7 +38,7 @@ type SpanExporter interface { // must never be done outside of a new major release. // Shutdown notifies the exporter of a pending halt to operations. The - // exporter is expected to preform any cleanup or synchronization it + // exporter is expected to perform any cleanup or synchronization it // requires while honoring all timeouts and cancellations contained in // the passed context. Shutdown(ctx context.Context) error diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 7d5a09fb19a..912a44751da 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -627,14 +627,14 @@ func TestSpanSetAttributes(t *testing.T) { roSpan := span.(ReadOnlySpan) // Ensure the span itself is valid. - assert.ElementsMatch(t, test.wantAttrs, roSpan.Attributes(), "exected attributes") + assert.ElementsMatch(t, test.wantAttrs, roSpan.Attributes(), "expected attributes") assert.Equal(t, test.wantDropped, roSpan.DroppedAttributes(), "dropped attributes") snap, ok := te.GetSpan(spanName) require.Truef(t, ok, "span %s not exported", spanName) // Ensure the exported span snapshot is valid. - assert.ElementsMatch(t, test.wantAttrs, snap.Attributes(), "exected attributes") + assert.ElementsMatch(t, test.wantAttrs, snap.Attributes(), "expected attributes") assert.Equal(t, test.wantDropped, snap.DroppedAttributes(), "dropped attributes") }) } diff --git a/trace/config_test.go b/trace/config_test.go index 50c071169fa..b9618e143cf 100644 --- a/trace/config_test.go +++ b/trace/config_test.go @@ -239,7 +239,7 @@ var ( func BenchmarkNewTracerConfig(b *testing.B) { opts := []TracerOption{ - WithInstrumentationVersion("testing verion"), + WithInstrumentationVersion("testing version"), WithSchemaURL("testing URL"), } diff --git a/trace/noop.go b/trace/noop.go index 73950f20778..7cf6c7f3ef9 100644 --- a/trace/noop.go +++ b/trace/noop.go @@ -37,7 +37,7 @@ func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer { return noopTracer{} } -// noopTracer is an implementation of Tracer that preforms no operations. +// noopTracer is an implementation of Tracer that performs no operations. type noopTracer struct{} var _ Tracer = noopTracer{} @@ -53,7 +53,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption return ContextWithSpan(ctx, span), span } -// noopSpan is an implementation of Span that preforms no operations. +// noopSpan is an implementation of Span that performs no operations. type noopSpan struct{} var _ Span = noopSpan{} From 51345570a0e851efc4fd6425f310bf19e78531ab Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 13 Apr 2023 07:14:20 -0700 Subject: [PATCH 495/886] Move the metric API back to experimental-metrics (#3987) --- versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.yaml b/versions.yaml index 697e5ea218b..762be8b6d33 100644 --- a/versions.yaml +++ b/versions.yaml @@ -32,7 +32,6 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - go.opentelemetry.io/otel/exporters/zipkin - - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: @@ -45,6 +44,7 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric + - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 8dba38e02f16d29a315d2e6890d21f763677831a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 13 Apr 2023 07:39:39 -0700 Subject: [PATCH 496/886] Move global metric back to `otel/metric/global` for minor release (#3986) * Revert "Remove the deprecated `otel/metric/global` pkg (#3829)" This reverts commit 60f7d42d1eedae6381f1d6524374b57a274e1639. * Revert "Support a global MeterProvider in `go.opentelemetry.io/otel` (#3818)" This reverts commit 813936187e46d48924b717ed9f63767eef26f55a. * Remove top level metric global * Add change to changelog --- CHANGELOG.md | 1 + bridge/opentracing/go.mod | 3 - bridge/opentracing/test/go.mod | 3 - example/fib/go.mod | 3 - example/jaeger/go.mod | 3 - example/namedtracer/go.mod | 3 - example/otel-collector/go.mod | 3 - example/passthrough/go.mod | 3 - example/zipkin/go.mod | 3 - exporters/jaeger/go.mod | 3 - .../otlpmetric/otlpmetricgrpc/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlpmetric/otlpmetrichttp/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 3 - exporters/otlp/otlptrace/otlptracegrpc/go.mod | 3 - exporters/otlp/otlptrace/otlptracehttp/go.mod | 3 - exporters/stdout/stdouttrace/go.mod | 3 - exporters/zipkin/go.mod | 3 - go.mod | 3 - internal/global/state.go | 45 +--------- internal/global/state_test.go | 58 ------------- internal/global/util_test.go | 2 - metric/example_test.go | 8 +- metric.go => metric/global/metric.go | 18 ++-- .../global/metric_test.go | 4 +- .../internal}/global/instruments.go | 27 +++--- .../internal}/global/instruments_test.go | 0 {internal => metric/internal}/global/meter.go | 10 ++- .../internal}/global/meter_test.go | 2 +- .../internal}/global/meter_types_test.go | 2 +- metric/internal/global/state.go | 68 +++++++++++++++ metric/internal/global/state_test.go | 87 +++++++++++++++++++ sdk/go.mod | 3 - sdk/metric/example_test.go | 4 +- sdk/metric/meter_test.go | 7 +- trace/go.mod | 2 - 37 files changed, 207 insertions(+), 198 deletions(-) rename metric.go => metric/global/metric.go (69%) rename metric_test.go => metric/global/metric_test.go (93%) rename {internal => metric/internal}/global/instruments.go (94%) rename {internal => metric/internal}/global/instruments_test.go (100%) rename {internal => metric/internal}/global/meter.go (98%) rename {internal => metric/internal}/global/meter_test.go (99%) rename {internal => metric/internal}/global/meter_types_test.go (98%) create mode 100644 metric/internal/global/state.go create mode 100644 metric/internal/global/state_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 84258be83be..952beab76c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` - Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) +- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) ### Fixed diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index d8ed7bb9eee..9d58070e2a3 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -18,8 +18,5 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 94ca9540e5a..219bbc595fe 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -23,7 +23,6 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -32,5 +31,3 @@ require ( google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/example/fib/go.mod b/example/fib/go.mod index 8230a9bc7bd..22860c0bb19 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -12,7 +12,6 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect ) @@ -23,5 +22,3 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 13cb9afa830..2414fb2745c 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -17,11 +17,8 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index b6055885efc..1c1a5d97d28 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -17,12 +17,9 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 9c03228e383..7a3181b056c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -23,7 +23,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -39,5 +38,3 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 383135e133c..5cf3eaf6340 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -12,7 +12,6 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect ) @@ -23,5 +22,3 @@ replace ( ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 26375679393..1eb3aaf8375 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -19,10 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index f06b8059b28..ebaa2c93ca8 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -16,7 +16,6 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -26,5 +25,3 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index 8307b51fc69..f7630760678 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -17,8 +17,8 @@ package otlpmetricgrpc_test import ( "context" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - otel.SetMeterProvider(meterProvider) + global.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 5db9dc39c76..f71387792b2 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -9,6 +9,7 @@ require ( go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -25,7 +26,6 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go index 398c834a5f1..d3397167c70 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go @@ -17,8 +17,8 @@ package otlpmetrichttp_test import ( "context" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - otel.SetMeterProvider(meterProvider) + global.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 8a7c0ac0bed..a922875963c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -9,6 +9,7 @@ require ( go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 + go.opentelemetry.io/otel/metric v1.15.0-rc.2 go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 @@ -23,7 +24,6 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index a7ece0804a5..f276c7f4703 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -22,7 +22,6 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect @@ -37,5 +36,3 @@ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/trace => ../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry - -replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 765150a0374..28fd5bbdbd2 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -23,7 +23,6 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -40,5 +39,3 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry - -replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 98054591faf..34bde609e9f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,7 +21,6 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect @@ -39,5 +38,3 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry - -replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 88e3a74fd96..8a86717b180 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -19,11 +19,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../../trace - -replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 103d73f5d32..59d1776381f 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -16,7 +16,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -26,5 +25,3 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/go.mod b/go.mod index c6789904e0c..12df1ac968b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 go.opentelemetry.io/otel/trace v1.15.0-rc.2 ) @@ -18,5 +17,3 @@ require ( ) replace go.opentelemetry.io/otel/trace => ./trace - -replace go.opentelemetry.io/otel/metric => ./metric diff --git a/internal/global/state.go b/internal/global/state.go index 7985005bcb6..1ad38f828ec 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -19,7 +19,6 @@ import ( "sync" "sync/atomic" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -32,20 +31,14 @@ type ( propagatorsHolder struct { tm propagation.TextMapPropagator } - - meterProviderHolder struct { - mp metric.MeterProvider - } ) var ( - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() - globalMeterProvider = defaultMeterProvider() + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() delegateTraceOnce sync.Once delegateTextMapPropagatorOnce sync.Once - delegateMeterOnce sync.Once ) // TracerProvider is the internal implementation for global.TracerProvider. @@ -109,34 +102,6 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { globalPropagators.Store(propagatorsHolder{tm: p}) } -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeterProvider.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - current := MeterProvider() - if _, cOk := current.(*meterProvider); cOk { - if _, mpOk := mp.(*meterProvider); mpOk && current == mp { - // Do not assign the default delegating MeterProvider to delegate - // to itself. - Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", - ) - return - } - } - - delegateMeterOnce.Do(func() { - if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeterProvider.Store(meterProviderHolder{mp: mp}) -} - func defaultTracerValue() *atomic.Value { v := &atomic.Value{} v.Store(tracerProviderHolder{tp: &tracerProvider{}}) @@ -148,9 +113,3 @@ func defaultPropagatorsValue() *atomic.Value { v.Store(propagatorsHolder{tm: newTextMapPropagator()}) return v } - -func defaultMeterProvider() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: &meterProvider{}}) - return v -} diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 93bf6b8aae2..f26f9d8c5a4 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -19,8 +19,6 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -31,12 +29,6 @@ type nonComparableTracerProvider struct { nonComparable func() //nolint:structcheck,unused // This is not called. } -type nonComparableMeterProvider struct { - metric.MeterProvider - - nonComparable func() //nolint:structcheck,unused // This is not called. -} - func TestSetTracerProvider(t *testing.T) { t.Run("Set With default is a noop", func(t *testing.T) { ResetForTest(t) @@ -133,53 +125,3 @@ func TestSetTextMapPropagator(t *testing.T) { assert.NotPanics(t, func() { SetTextMapPropagator(prop) }) }) } - -func TestSetMeterProvider(t *testing.T) { - t.Run("Set With default is a noop", func(t *testing.T) { - ResetForTest(t) - - SetMeterProvider(MeterProvider()) - - mp, ok := MeterProvider().(*meterProvider) - if !ok { - t.Fatal("Global MeterProvider should be the default meter provider") - } - - if mp.delegate != nil { - t.Fatal("meter provider should not delegate when setting itself") - } - }) - - t.Run("First Set() should replace the delegate", func(t *testing.T) { - ResetForTest(t) - - SetMeterProvider(noop.NewMeterProvider()) - - _, ok := MeterProvider().(*meterProvider) - if ok { - t.Fatal("Global MeterProvider was not changed") - } - }) - - t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { - ResetForTest(t) - - mp := MeterProvider() - - SetMeterProvider(noop.NewMeterProvider()) - - dmp := mp.(*meterProvider) - - if dmp.delegate == nil { - t.Fatal("The delegated meter providers should have a delegate") - } - }) - - t.Run("non-comparable types should not panic", func(t *testing.T) { - ResetForTest(t) - - mp := nonComparableMeterProvider{} - SetMeterProvider(mp) - assert.NotPanics(t, func() { SetMeterProvider(mp) }) - }) -} diff --git a/internal/global/util_test.go b/internal/global/util_test.go index bc88508184c..d0bca92f6c6 100644 --- a/internal/global/util_test.go +++ b/internal/global/util_test.go @@ -25,9 +25,7 @@ func ResetForTest(t testing.TB) { t.Cleanup(func() { globalTracer = defaultTracerValue() globalPropagators = defaultPropagatorsValue() - globalMeterProvider = defaultMeterProvider() delegateTraceOnce = sync.Once{} delegateTextMapPropagatorOnce = sync.Once{} - delegateMeterOnce = sync.Once{} }) } diff --git a/metric/example_test.go b/metric/example_test.go index c909410e9e4..fbaefcd123f 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -20,15 +20,15 @@ import ( "runtime" "time" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" ) func ExampleMeter_synchronous() { // Create a histogram using the global MeterProvider. - workDuration, err := otel.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( + workDuration, err := global.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", instrument.WithUnit("ms")) if err != nil { @@ -44,7 +44,7 @@ func ExampleMeter_synchronous() { } func ExampleMeter_asynchronous_single() { - meter := otel.Meter("go.opentelemetry.io/otel/metric#AsyncExample") + meter := global.Meter("go.opentelemetry.io/otel/metric#AsyncExample") _, err := meter.Int64ObservableGauge( "DiskUsage", @@ -74,7 +74,7 @@ func ExampleMeter_asynchronous_single() { } func ExampleMeter_asynchronous_multiple() { - meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") + meter := global.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") diff --git a/metric.go b/metric/global/metric.go similarity index 69% rename from metric.go rename to metric/global/metric.go index f955171951f..2723df2925f 100644 --- a/metric.go +++ b/metric/global/metric.go @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otel // import "go.opentelemetry.io/otel" +package global // import "go.opentelemetry.io/otel/metric/global" import ( - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/internal/global" ) // Meter returns a Meter from the global MeterProvider. The name must be the @@ -32,18 +32,14 @@ import ( // the new MeterProvider. // // This is short for GetMeterProvider().Meter(name). -func Meter(name string, opts ...metric.MeterOption) metric.Meter { - return GetMeterProvider().Meter(name, opts...) +func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { + return MeterProvider().Meter(instrumentationName, opts...) } -// GetMeterProvider returns the registered global meter provider. +// MeterProvider returns the registered global meter provider. // -// If no global GetMeterProvider has been registered, a No-op GetMeterProvider -// implementation is returned. When a global GetMeterProvider is registered for -// the first time, the returned GetMeterProvider, and all the Meters it has -// created or will create, are recreated automatically from the new -// GetMeterProvider. -func GetMeterProvider() metric.MeterProvider { +// If no global MeterProvider has been registered, a No-op MeterProvider implementation is returned. When a global MeterProvider is registered for the first time, the returned MeterProvider, and all the Meters it has created or will create, are recreated automatically from the new MeterProvider. +func MeterProvider() metric.MeterProvider { return global.MeterProvider() } diff --git a/metric_test.go b/metric/global/metric_test.go similarity index 93% rename from metric_test.go rename to metric/global/metric_test.go index 5e6e48fb8a0..d319a0c2da4 100644 --- a/metric_test.go +++ b/metric/global/metric_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otel // import "go.opentelemetry.io/otel" +package global // import "go.opentelemetry.io/otel/metric/global" import ( "testing" @@ -38,6 +38,6 @@ func TestMultipleGlobalMeterProvider(t *testing.T) { SetMeterProvider(&p1) SetMeterProvider(p2) - got := GetMeterProvider() + got := MeterProvider() assert.Equal(t, p2, got) } diff --git a/internal/global/instruments.go b/metric/internal/global/instruments.go similarity index 94% rename from internal/global/instruments.go rename to metric/internal/global/instruments.go index 8a185187829..a825b4acadf 100644 --- a/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/internal/global" +package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "context" "sync/atomic" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" @@ -45,7 +46,7 @@ var _ instrument.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -74,7 +75,7 @@ var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -103,7 +104,7 @@ var _ instrument.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -132,7 +133,7 @@ var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -161,7 +162,7 @@ var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -190,7 +191,7 @@ var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -218,7 +219,7 @@ var _ instrument.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -244,7 +245,7 @@ var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -270,7 +271,7 @@ var _ instrument.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -296,7 +297,7 @@ var _ instrument.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -322,7 +323,7 @@ var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) @@ -348,7 +349,7 @@ var _ instrument.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) return } i.delegate.Store(ctr) diff --git a/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go similarity index 100% rename from internal/global/instruments_test.go rename to metric/internal/global/instruments_test.go diff --git a/internal/global/meter.go b/metric/internal/global/meter.go similarity index 98% rename from internal/global/meter.go rename to metric/internal/global/meter.go index 9449ba3eeaf..db6e780b615 100644 --- a/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/internal/global" +package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "container/list" "sync" "sync/atomic" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" @@ -37,6 +38,11 @@ type meterProvider struct { delegate metric.MeterProvider } +type il struct { + name string + version string +} + // setDelegate configures p to delegate all MeterProvider functionality to // provider. // @@ -335,7 +341,7 @@ func (c *registration) setDelegate(m metric.Meter) { reg, err := m.RegisterCallback(c.function, insts...) if err != nil { - GetErrorHandler().Handle(err) + otel.Handle(err) } c.unreg = reg.Unregister diff --git a/internal/global/meter_test.go b/metric/internal/global/meter_test.go similarity index 99% rename from internal/global/meter_test.go rename to metric/internal/global/meter_test.go index 8a9341ab46e..57a2e3b2084 100644 --- a/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/internal/global" +package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "context" diff --git a/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go similarity index 98% rename from internal/global/meter_types_test.go rename to metric/internal/global/meter_types_test.go index 3529d92db8c..76827e72eb1 100644 --- a/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/internal/global" +package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "context" diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go new file mode 100644 index 00000000000..47c0d787d8a --- /dev/null +++ b/metric/internal/global/state.go @@ -0,0 +1,68 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// htmp://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "errors" + "sync" + "sync/atomic" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" +) + +var ( + globalMeterProvider = defaultMeterProvider() + + delegateMeterOnce sync.Once +) + +type meterProviderHolder struct { + mp metric.MeterProvider +} + +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + global.Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go new file mode 100644 index 00000000000..d714c60f4e6 --- /dev/null +++ b/metric/internal/global/state_test.go @@ -0,0 +1,87 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package global // import "go.opentelemetry.io/otel/metric/internal/global" + +import ( + "sync" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +func resetGlobalMeterProvider() { + globalMeterProvider = defaultMeterProvider() + delegateMeterOnce = sync.Once{} +} + +type nonComparableMeterProvider struct { + metric.MeterProvider + + nonComparable func() //nolint:structcheck,unused // This is not called. +} + +func TestSetMeterProvider(t *testing.T) { + t.Cleanup(resetGlobalMeterProvider) + + t.Run("Set With default is a noop", func(t *testing.T) { + resetGlobalMeterProvider() + SetMeterProvider(MeterProvider()) + + mp, ok := MeterProvider().(*meterProvider) + if !ok { + t.Fatal("Global MeterProvider should be the default meter provider") + } + + if mp.delegate != nil { + t.Fatal("meter provider should not delegate when setting itself") + } + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + resetGlobalMeterProvider() + + SetMeterProvider(noop.NewMeterProvider()) + + _, ok := MeterProvider().(*meterProvider) + if ok { + t.Fatal("Global MeterProvider was not changed") + } + }) + + t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { + resetGlobalMeterProvider() + + mp := MeterProvider() + + SetMeterProvider(noop.NewMeterProvider()) + + dmp := mp.(*meterProvider) + + if dmp.delegate == nil { + t.Fatal("The delegated meter providers should have a delegate") + } + }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + resetGlobalMeterProvider() + + mp := nonComparableMeterProvider{} + SetMeterProvider(mp) + assert.NotPanics(t, func() { SetMeterProvider(mp) }) + }) +} diff --git a/sdk/go.mod b/sdk/go.mod index c9f4a41d5d6..3db48023419 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -17,10 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../trace - -replace go.opentelemetry.io/otel/metric => ../metric diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 0086dba7687..c0704509a26 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -18,7 +18,7 @@ import ( "context" "log" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" @@ -42,7 +42,7 @@ func Example() { metric.WithResource(res), metric.WithReader(reader), ) - otel.SetMeterProvider(meterProvider) + global.SetMeterProvider(meterProvider) defer func() { err := meterProvider.Shutdown(context.Background()) if err != nil { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 30e30903e31..53abd91e661 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -29,6 +29,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -629,7 +630,7 @@ func TestGlobalInstRegisterCallback(t *testing.T) { otel.SetLogger(logr.New(l)) const mtrName = "TestGlobalInstRegisterCallback" - preMtr := otel.Meter(mtrName) + preMtr := global.Meter(mtrName) preInt64Ctr, err := preMtr.Int64ObservableCounter("pre.int64.counter") require.NoError(t, err) preFloat64Ctr, err := preMtr.Float64ObservableCounter("pre.float64.counter") @@ -637,9 +638,9 @@ func TestGlobalInstRegisterCallback(t *testing.T) { rdr := NewManualReader() mp := NewMeterProvider(WithReader(rdr), WithResource(resource.Empty())) - otel.SetMeterProvider(mp) + global.SetMeterProvider(mp) - postMtr := otel.Meter(mtrName) + postMtr := global.Meter(mtrName) postInt64Ctr, err := postMtr.Int64ObservableCounter("post.int64.counter") require.NoError(t, err) postFloat64Ctr, err := postMtr.Float64ObservableCounter("post.float64.counter") diff --git a/trace/go.mod b/trace/go.mod index 1e9ab759e85..66c156ebe53 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -15,5 +15,3 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/otel/metric => ../metric From b24bcc1fc8085f8e903b2f506a89b2d6239ece84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 13 Apr 2023 16:46:50 +0200 Subject: [PATCH 497/886] otlptracehttp: Fix start/stop sync in mockCollector (#3989) Co-authored-by: Tyler Yahn --- .../otlptrace/otlptracegrpc/client_test.go | 6 ----- .../otlptracegrpc/mock_collector_test.go | 24 +++++++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index ded71a5a3b4..42e75f52972 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -116,8 +116,6 @@ func newGRPCExporter(t *testing.T, ctx context.Context, endpoint string, additio func newExporterEndToEndTest(t *testing.T, additionalOpts []otlptracegrpc.Option) { mc := runMockCollector(t) - <-time.After(5 * time.Millisecond) - ctx := context.Background() exp := newGRPCExporter(t, ctx, mc.endpoint, additionalOpts...) t.Cleanup(func() { @@ -248,8 +246,6 @@ func TestExportSpansTimeoutHonored(t *testing.T) { func TestNewWithMultipleAttributeTypes(t *testing.T) { mc := runMockCollector(t) - <-time.After(5 * time.Millisecond) - ctx, cancel := contextWithTimeout(context.Background(), t, 10*time.Second) t.Cleanup(cancel) @@ -384,8 +380,6 @@ func TestEmptyData(t *testing.T) { mc := runMockCollector(t) t.Cleanup(func() { require.NoError(t, mc.stop()) }) - <-time.After(5 * time.Millisecond) - ctx := context.Background() exp := newGRPCExporter(t, ctx, mc.endpoint) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go index 56b65a5d67b..8c1ad9c9100 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go @@ -20,9 +20,10 @@ import ( "net" "sync" "testing" - "time" + "github.com/stretchr/testify/require" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" @@ -38,6 +39,7 @@ func makeMockCollector(t *testing.T, mockConfig *mockConfig) *mockCollector { errors: mockConfig.errors, partial: mockConfig.partial, }, + stopped: make(chan struct{}), } } @@ -105,6 +107,7 @@ type mockCollector struct { endpoint string stopFunc func() stopOnce sync.Once + stopped chan struct{} } type mockConfig struct { @@ -118,15 +121,15 @@ var _ collectortracepb.TraceServiceServer = (*mockTraceService)(nil) var errAlreadyStopped = fmt.Errorf("already stopped") func (mc *mockCollector) stop() error { - var err = errAlreadyStopped + err := errAlreadyStopped mc.stopOnce.Do(func() { err = nil if mc.stopFunc != nil { mc.stopFunc() } }) - // Give it sometime to shutdown. - <-time.After(160 * time.Millisecond) + // Wait until gRPC server is down. + <-mc.stopped // Getting the lock ensures the traceSvc is done flushing. mc.traceSvc.mu.Lock() @@ -157,28 +160,35 @@ func (mc *mockCollector) getHeaders() metadata.MD { // runMockCollector is a helper function to create a mock Collector. func runMockCollector(t *testing.T) *mockCollector { + t.Helper() return runMockCollectorAtEndpoint(t, "localhost:0") } func runMockCollectorAtEndpoint(t *testing.T, endpoint string) *mockCollector { + t.Helper() return runMockCollectorWithConfig(t, &mockConfig{endpoint: endpoint}) } func runMockCollectorWithConfig(t *testing.T, mockConfig *mockConfig) *mockCollector { + t.Helper() ln, err := net.Listen("tcp", mockConfig.endpoint) - if err != nil { - t.Fatalf("Failed to get an endpoint: %v", err) - } + require.NoError(t, err, "net.Listen") srv := grpc.NewServer() mc := makeMockCollector(t, mockConfig) collectortracepb.RegisterTraceServiceServer(srv, mc.traceSvc) go func() { _ = srv.Serve(ln) + close(mc.stopped) }() mc.endpoint = ln.Addr().String() mc.stopFunc = srv.Stop + // Wait until gRPC server is up. + conn, err := grpc.Dial(mc.endpoint, grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials())) + require.NoError(t, err, "grpc.Dial") + require.NoError(t, conn.Close(), "conn.Close") + return mc } From eb2b89f3356cdf162b9aeaff39210a4f3d49f06c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 13 Apr 2023 16:55:24 +0200 Subject: [PATCH 498/886] otlptracegrpc: Shutdown returns context error (#3990) Co-authored-by: Tyler Yahn --- exporters/otlp/otlptrace/otlptracegrpc/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index fe23f8e3766..2ab2a6e1484 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -130,13 +130,16 @@ var errAlreadyStopped = errors.New("the client is already stopped") // If the client has already stopped, an error will be returned describing // this. func (c *client) Stop(ctx context.Context) error { + // Make sure to return context error if the context is done when calling this method. + err := ctx.Err() + // Acquire the c.tscMu lock within the ctx lifetime. acquired := make(chan struct{}) go func() { c.tscMu.Lock() close(acquired) }() - var err error + select { case <-ctx.Done(): // The Stop timeout is reached. Kill any remaining exports to force From 37388599eb3602000025f64ab6c0cca18c848582 Mon Sep 17 00:00:00 2001 From: Kaushal Shah Date: Fri, 14 Apr 2023 19:53:47 +0530 Subject: [PATCH 499/886] Fixed race condition in OnEnd and added a unit test (#3951) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed race condition in OnEnd and added a test * fixed code review comments * fixed lint * Update CHANGELOG.md Co-authored-by: Robert Pająk * Update sdk/trace/simple_span_processor_test.go Co-authored-by: Tyler Yahn * Update sdk/trace/simple_span_processor_test.go Co-authored-by: Tyler Yahn * Update sdk/trace/simple_span_processor_test.go Co-authored-by: Tyler Yahn * fixed panic check --------- Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/trace/simple_span_processor.go | 6 ++--- sdk/trace/simple_span_processor_test.go | 29 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 952beab76c2..8e42aeedf4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `TracerProvider` allows calling `Tracer()` while it's shutting down. It used to deadlock. (#3924) - Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949) +- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) - Automatically figure out the default aggregation with `aggregation.Default`. (#3967) ## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 diff --git a/sdk/trace/simple_span_processor.go b/sdk/trace/simple_span_processor.go index c3bb7f9ea9c..f8770fff79b 100644 --- a/sdk/trace/simple_span_processor.go +++ b/sdk/trace/simple_span_processor.go @@ -25,7 +25,7 @@ import ( // simpleSpanProcessor is a SpanProcessor that synchronously sends all // completed Spans to a trace.Exporter immediately. type simpleSpanProcessor struct { - exporterMu sync.RWMutex + exporterMu sync.Mutex exporter SpanExporter stopOnce sync.Once } @@ -54,8 +54,8 @@ func (ssp *simpleSpanProcessor) OnStart(context.Context, ReadWriteSpan) {} // OnEnd immediately exports a ReadOnlySpan. func (ssp *simpleSpanProcessor) OnEnd(s ReadOnlySpan) { - ssp.exporterMu.RLock() - defer ssp.exporterMu.RUnlock() + ssp.exporterMu.Lock() + defer ssp.exporterMu.Unlock() if ssp.exporter != nil && s.SpanContext().TraceFlags().IsSampled() { if err := ssp.exporter.ExportSpans(context.Background(), []ReadOnlySpan{s}); err != nil { diff --git a/sdk/trace/simple_span_processor_test.go b/sdk/trace/simple_span_processor_test.go index ea0f8de49de..fc038978314 100644 --- a/sdk/trace/simple_span_processor_test.go +++ b/sdk/trace/simple_span_processor_test.go @@ -17,9 +17,12 @@ package trace_test import ( "context" "errors" + "sync" "testing" "time" + "github.com/stretchr/testify/assert" + sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" ) @@ -150,6 +153,32 @@ func TestSimpleSpanProcessorShutdownOnEndConcurrency(t *testing.T) { <-done } +func TestSimpleSpanProcessorShutdownOnEndRace(t *testing.T) { + exporter := &testExporter{} + ssp := sdktrace.NewSimpleSpanProcessor(exporter) + tp := basicTracerProvider(t) + tp.RegisterSpanProcessor(ssp) + + var wg sync.WaitGroup + wg.Add(2) + + span := func(spanName string) { + assert.NotPanics(t, func() { + defer wg.Done() + _, span := tp.Tracer("test").Start(context.Background(), spanName) + span.End() + }) + } + + go span("test-span-1") + go span("test-span-2") + + wg.Wait() + + assert.NoError(t, ssp.Shutdown(context.Background())) + assert.True(t, exporter.shutdown, "exporter shutdown") +} + func TestSimpleSpanProcessorShutdownHonorsContextDeadline(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) defer cancel() From cf8367f711b3058db2a703844cc02b57819266ca Mon Sep 17 00:00:00 2001 From: Remy Chantenay Date: Fri, 14 Apr 2023 16:41:27 +0200 Subject: [PATCH 500/886] Fix Version test in otel/sdk (#3994) Co-authored-by: Tyler Yahn --- sdk/version_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/version_test.go b/sdk/version_test.go index e4c80838880..f1daf13cbd6 100644 --- a/sdk/version_test.go +++ b/sdk/version_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/sdk" ) // regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 @@ -29,6 +29,6 @@ var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) func TestVersionSemver(t *testing.T) { - v := otel.Version() + v := sdk.Version() assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) } From 4b5abe06d208204ad3a9688d8562f89836dfcb80 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 14 Apr 2023 07:51:10 -0700 Subject: [PATCH 501/886] Refactor the metric SDK benchmarks (#3992) Benchmark all instruments, not just an int64 counter. Include benchmarks for all synchronous measurement methods. Include benchmarks for all collections. --- sdk/metric/benchmark_test.go | 391 +++++++++++++++++++++++++++-------- 1 file changed, 305 insertions(+), 86 deletions(-) diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 67e856b2ab8..e1dbba593b6 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -16,134 +16,353 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" - "fmt" + "strconv" "testing" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -func benchCounter(b *testing.B, views ...View) (context.Context, Reader, instrument.Int64Counter) { +var viewBenchmarks = []struct { + Name string + Views []View +}{ + {"NoView", []View{}}, + { + "DropView", + []View{NewView( + Instrument{Name: "*"}, + Stream{Aggregation: aggregation.Drop{}}, + )}, + }, + { + "AttrFilterView", + []View{NewView( + Instrument{Name: "*"}, + Stream{AttributeFilter: func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key("K") + }}, + )}, + }, +} + +func BenchmarkSyncMeasure(b *testing.B) { + for _, bc := range viewBenchmarks { + b.Run(bc.Name, benchSyncViews(bc.Views...)) + } +} + +func benchSyncViews(views ...View) func(*testing.B) { ctx := context.Background() rdr := NewManualReader() provider := NewMeterProvider(WithReader(rdr), WithView(views...)) - cntr, _ := provider.Meter("test").Int64Counter("hello") - b.ResetTimer() - b.ReportAllocs() - return ctx, rdr, cntr -} + meter := provider.Meter("benchSyncViews") + return func(b *testing.B) { + iCtr, err := meter.Int64Counter("int64-counter") + assert.NoError(b, err) + b.Run("Int64Counter", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { iCtr.Add(ctx, 1, attr...) } + } + }())) -func BenchmarkCounterAddNoAttrs(b *testing.B) { - ctx, _, cntr := benchCounter(b) + fCtr, err := meter.Float64Counter("float64-counter") + assert.NoError(b, err) + b.Run("Float64Counter", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { fCtr.Add(ctx, 1, attr...) } + } + }())) - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1) - } -} + iUDCtr, err := meter.Int64UpDownCounter("int64-up-down-counter") + assert.NoError(b, err) + b.Run("Int64UpDownCounter", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { iUDCtr.Add(ctx, 1, attr...) } + } + }())) -func BenchmarkCounterAddOneAttr(b *testing.B) { - ctx, _, cntr := benchCounter(b) + fUDCtr, err := meter.Float64UpDownCounter("float64-up-down-counter") + assert.NoError(b, err) + b.Run("Float64UpDownCounter", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { fUDCtr.Add(ctx, 1, attr...) } + } + }())) + + iHist, err := meter.Int64Histogram("int64-histogram") + assert.NoError(b, err) + b.Run("Int64Histogram", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { iHist.Record(ctx, 1, attr...) } + } + }())) - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.String("K", "V")) + fHist, err := meter.Float64Histogram("float64-histogram") + assert.NoError(b, err) + b.Run("Float64Histogram", benchMeasAttrs(func() measF { + return func(attr []attribute.KeyValue) func() { + return func() { fHist.Record(ctx, 1, attr...) } + } + }())) } } -func BenchmarkCounterAddOneInvalidAttr(b *testing.B) { - ctx, _, cntr := benchCounter(b) +type measF func(attr []attribute.KeyValue) func() - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.String("", "V"), attribute.String("K", "V")) +func benchMeasAttrs(meas measF) func(*testing.B) { + return func(b *testing.B) { + b.Run("Attributes/0", func(b *testing.B) { + f := meas(nil) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + f() + } + }) + b.Run("Attributes/1", func(b *testing.B) { + attrs := []attribute.KeyValue{attribute.Bool("K", true)} + f := meas(attrs) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + f() + } + }) + b.Run("Attributes/10", func(b *testing.B) { + n := 10 + attrs := make([]attribute.KeyValue, 0) + attrs = append(attrs, attribute.Bool("K", true)) + for i := 2; i < n; i++ { + attrs = append(attrs, attribute.Int(strconv.Itoa(i), i)) + } + f := meas(attrs) + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + f() + } + }) } } -func BenchmarkCounterAddSingleUseAttrs(b *testing.B) { - ctx, _, cntr := benchCounter(b) - - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.Int("K", i)) +func BenchmarkCollect(b *testing.B) { + for _, bc := range viewBenchmarks { + b.Run(bc.Name, benchCollectViews(bc.Views...)) } } -func BenchmarkCounterAddSingleUseInvalidAttrs(b *testing.B) { - ctx, _, cntr := benchCounter(b) - - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.Int("", i), attribute.Int("K", i)) +func benchCollectViews(views ...View) func(*testing.B) { + setup := func(name string) (metric.Meter, Reader) { + r := NewManualReader() + mp := NewMeterProvider(WithReader(r), WithView(views...)) + return mp.Meter(name), r } -} + ctx := context.Background() + return func(b *testing.B) { + b.Run("Int64Counter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64Counter") + i, err := m.Int64Counter("int64-counter") + assert.NoError(b, err) + i.Add(ctx, 1, attr...) + return r + })) + b.Run("Int64Counter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64Counter") + i, err := m.Int64Counter("int64-counter") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Add(ctx, 1, attr...) + } + return r + })) -func BenchmarkCounterAddSingleUseFilteredAttrs(b *testing.B) { - ctx, _, cntr := benchCounter(b, NewView( - Instrument{Name: "*"}, - Stream{AttributeFilter: func(kv attribute.KeyValue) bool { - return kv.Key == attribute.Key("K") - }}, - )) + b.Run("Float64Counter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64Counter") + i, err := m.Float64Counter("float64-counter") + assert.NoError(b, err) + i.Add(ctx, 1, attr...) + return r + })) + b.Run("Float64Counter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64Counter") + i, err := m.Float64Counter("float64-counter") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Add(ctx, 1, attr...) + } + return r + })) - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.Int("L", i), attribute.Int("K", i)) - } -} + b.Run("Int64UpDownCounter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64UpDownCounter") + i, err := m.Int64UpDownCounter("int64-up-down-counter") + assert.NoError(b, err) + i.Add(ctx, 1, attr...) + return r + })) + b.Run("Int64UpDownCounter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64UpDownCounter") + i, err := m.Int64UpDownCounter("int64-up-down-counter") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Add(ctx, 1, attr...) + } + return r + })) + + b.Run("Float64UpDownCounter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64UpDownCounter") + i, err := m.Float64UpDownCounter("float64-up-down-counter") + assert.NoError(b, err) + i.Add(ctx, 1, attr...) + return r + })) + b.Run("Float64UpDownCounter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64UpDownCounter") + i, err := m.Float64UpDownCounter("float64-up-down-counter") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Add(ctx, 1, attr...) + } + return r + })) + + b.Run("Int64Histogram/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64Histogram") + i, err := m.Int64Histogram("int64-histogram") + assert.NoError(b, err) + i.Record(ctx, 1, attr...) + return r + })) + b.Run("Int64Histogram/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64Histogram") + i, err := m.Int64Histogram("int64-histogram") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Record(ctx, 1, attr...) + } + return r + })) + + b.Run("Float64Histogram/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64Histogram") + i, err := m.Float64Histogram("float64-histogram") + assert.NoError(b, err) + i.Record(ctx, 1, attr...) + return r + })) + b.Run("Float64Histogram/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64Histogram") + i, err := m.Float64Histogram("float64-histogram") + assert.NoError(b, err) + for n := 0; n < 10; n++ { + i.Record(ctx, 1, attr...) + } + return r + })) + + b.Run("Int64ObservableCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64ObservableCounter") + _, err := m.Int64ObservableCounter( + "int64-observable-counter", + instrument.WithInt64Callback(int64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) -func BenchmarkCounterCollectOneAttr(b *testing.B) { - ctx, rdr, cntr := benchCounter(b) + b.Run("Float64ObservableCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64ObservableCounter") + _, err := m.Float64ObservableCounter( + "float64-observable-counter", + instrument.WithFloat64Callback(float64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) - for i := 0; i < b.N; i++ { - cntr.Add(ctx, 1, attribute.Int("K", 1)) + b.Run("Int64ObservableUpDownCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64ObservableUpDownCounter") + _, err := m.Int64ObservableUpDownCounter( + "int64-observable-up-down-counter", + instrument.WithInt64Callback(int64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) - _ = rdr.Collect(ctx, nil) + b.Run("Float64ObservableUpDownCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64ObservableUpDownCounter") + _, err := m.Float64ObservableUpDownCounter( + "float64-observable-up-down-counter", + instrument.WithFloat64Callback(float64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) + + b.Run("Int64ObservableGauge", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Int64ObservableGauge") + _, err := m.Int64ObservableGauge( + "int64-observable-gauge", + instrument.WithInt64Callback(int64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) + + b.Run("Float64ObservableGauge", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + m, r := setup("benchCollectViews/Float64ObservableGauge") + _, err := m.Float64ObservableGauge( + "float64-observable-gauge", + instrument.WithFloat64Callback(float64Cback(attr)), + ) + assert.NoError(b, err) + return r + })) } } -func BenchmarkCounterCollectTenAttrs(b *testing.B) { - ctx, rdr, cntr := benchCounter(b) - - for i := 0; i < b.N; i++ { - for j := 0; j < 10; j++ { - cntr.Add(ctx, 1, attribute.Int("K", j)) - } - _ = rdr.Collect(ctx, nil) +func int64Cback(attr []attribute.KeyValue) instrument.Int64Callback { + return func(_ context.Context, o instrument.Int64Observer) error { + o.Observe(1, attr...) + return nil } } -func BenchmarkCollectHistograms(b *testing.B) { - b.Run("1", benchCollectHistograms(1)) - b.Run("5", benchCollectHistograms(5)) - b.Run("10", benchCollectHistograms(10)) - b.Run("25", benchCollectHistograms(25)) +func float64Cback(attr []attribute.KeyValue) instrument.Float64Callback { + return func(_ context.Context, o instrument.Float64Observer) error { + o.Observe(1, attr...) + return nil + } } -func benchCollectHistograms(count int) func(*testing.B) { +func benchCollectAttrs(setup func([]attribute.KeyValue) Reader) func(*testing.B) { ctx := context.Background() - r := NewManualReader() - mtr := NewMeterProvider( - WithReader(r), - ).Meter("sdk/metric/bench/histogram") - - for i := 0; i < count; i++ { - name := fmt.Sprintf("fake data %d", i) - h, _ := mtr.Int64Histogram(name) - - h.Record(ctx, 1) + out := new(metricdata.ResourceMetrics) + run := func(reader Reader) func(b *testing.B) { + return func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + _ = reader.Collect(ctx, out) + } + } } - - // Store benchmark results in a closure to prevent the compiler from - // inlining and skipping the function. - var ( - collectedMetrics metricdata.ResourceMetrics - ) - return func(b *testing.B) { - b.ReportAllocs() - b.ResetTimer() + b.Run("Attributes/0", run(setup(nil))) - for n := 0; n < b.N; n++ { - _ = r.Collect(ctx, &collectedMetrics) - if len(collectedMetrics.ScopeMetrics[0].Metrics) != count { - b.Fatalf("got %d metrics, want %d", len(collectedMetrics.ScopeMetrics[0].Metrics), count) - } + attrs := []attribute.KeyValue{attribute.Bool("K", true)} + b.Run("Attributes/1", run(setup(attrs))) + + for i := 2; i < 10; i++ { + attrs = append(attrs, attribute.Int(strconv.Itoa(i), i)) } + b.Run("Attributes/10", run(setup(attrs))) } } From d1959c9239ae1559e828e54cfd05c7bd4adb9c56 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 16 Apr 2023 07:35:37 -0700 Subject: [PATCH 502/886] dependabot updates Sun Apr 16 14:23:12 UTC 2023 (#4014) Bump github.com/prometheus/client_golang from 1.14.0 to 1.15.0 in /example/view Bump go.opentelemetry.io/build-tools/dbotconf from 0.6.0 to 0.7.0 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.6.0 to 0.7.0 in /internal/tools Bump github.com/prometheus/client_golang from 1.14.0 to 1.15.0 in /example/prometheus Bump go.opentelemetry.io/build-tools/semconvgen from 0.6.0 to 0.7.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.6.0 to 0.7.0 in /internal/tools Bump github.com/prometheus/client_golang from 1.14.0 to 1.15.0 in /exporters/prometheus Bump github.com/Masterminds/semver/v3 from 3.2.0 to 3.2.1 in /schema Bump codecov/codecov-action from 3.1.1 to 3.1.2 --- example/prometheus/go.mod | 12 +- example/prometheus/go.sum | 472 +---------------------------------- example/view/go.mod | 12 +- example/view/go.sum | 472 +---------------------------------- exporters/prometheus/go.mod | 14 +- exporters/prometheus/go.sum | 477 ++---------------------------------- internal/tools/go.mod | 38 +-- internal/tools/go.sum | 89 ++++--- schema/go.mod | 2 +- schema/go.sum | 4 +- 10 files changed, 129 insertions(+), 1463 deletions(-) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 02bbd763da3..85213c76b0c 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.15.0 go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 go.opentelemetry.io/otel/metric v1.15.0-rc.2 @@ -12,14 +12,14 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index d2e87862410..b1568fde6da 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -1,486 +1,38 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/example/view/go.mod b/example/view/go.mod index 98c5fe06510..3a4ce929503 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.19 require ( - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.15.0 go.opentelemetry.io/otel v1.15.0-rc.2 go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 go.opentelemetry.io/otel/metric v1.15.0-rc.2 @@ -13,14 +13,14 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/example/view/go.sum b/example/view/go.sum index d2e87862410..b1568fde6da 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -1,486 +1,38 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 7a615708092..4ea8a07170a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.14.0 + github.com/prometheus/client_golang v1.15.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.15.0-rc.2 @@ -15,15 +15,17 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 5a10d6244bc..fbc0231b601 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -1,496 +1,57 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 62f19383dc7..900b5d1f942 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,10 +9,10 @@ require ( github.com/itchyny/gojq v0.12.12 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.6.0 - go.opentelemetry.io/build-tools/dbotconf v0.6.0 - go.opentelemetry.io/build-tools/multimod v0.6.0 - go.opentelemetry.io/build-tools/semconvgen v0.6.0 + go.opentelemetry.io/build-tools/crosslink v0.7.0 + go.opentelemetry.io/build-tools/dbotconf v0.7.0 + go.opentelemetry.io/build-tools/multimod v0.7.0 + go.opentelemetry.io/build-tools/semconvgen v0.7.0 golang.org/x/tools v0.8.0 ) @@ -28,8 +28,8 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/OpenPeeDeeP/depguard v1.1.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect - github.com/acomagu/bufpipe v1.0.3 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect + github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.5.1 // indirect @@ -41,7 +41,7 @@ require ( github.com/breml/bidichk v0.2.4 // indirect github.com/breml/errchkjson v0.3.1 // indirect github.com/butuzov/ireturn v0.1.1 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/cloudflare/circl v1.3.1 // indirect @@ -59,8 +59,8 @@ require ( github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.7.0 // indirect github.com/go-git/gcfg v1.5.0 // indirect - github.com/go-git/go-billy/v5 v5.4.0 // indirect - github.com/go-git/go-git/v5 v5.5.2 // indirect + github.com/go-git/go-billy/v5 v5.4.1 // indirect + github.com/go-git/go-git/v5 v5.6.1 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -71,7 +71,7 @@ require ( github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -119,7 +119,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -132,13 +132,13 @@ require ( github.com/nunnatsa/ginkgolinter v0.9.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect - github.com/pjbgf/sha1cd v0.2.3 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.0 // indirect - github.com/prometheus/client_golang v1.14.0 // indirect + github.com/prometheus/client_golang v1.15.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.37.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect @@ -161,7 +161,7 @@ require ( github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.6.1 // indirect + github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.15.0 // indirect @@ -184,11 +184,11 @@ require ( github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.6.0 // indirect + go.opentelemetry.io/build-tools v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect + go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.5.0 // indirect + golang.org/x/crypto v0.6.0 // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 646a400a8ad..1f2885ba602 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -61,10 +61,10 @@ github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2y github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= -github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 h1:ra2OtmuW0AE5csawV4YXMNGNQQXvLRps3z2Z59OPO+I= -github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= -github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= -github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= +github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= +github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -102,8 +102,9 @@ github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacM github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= @@ -160,23 +161,21 @@ github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUecls github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= -github.com/go-git/go-billy/v5 v5.4.0 h1:Vaw7LaSTRJOUric7pe4vnzBSgyuf2KrLsu2Y4ZpQBDE= -github.com/go-git/go-billy/v5 v5.4.0/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= +github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= +github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.5.2 h1:v8lgZa5k9ylUw+OR/roJHTxR4QItsNFI5nKtAXFuynw= -github.com/go-git/go-git/v5 v5.5.2/go.mod h1:BE5hUJ5yaV2YMxhmaP4l6RBQ08kMxKSPD4BlxtH7OjI= +github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= +github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= @@ -231,8 +230,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -318,7 +318,6 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/itchyny/gojq v0.12.12 h1:x+xGI9BXqKoJQZkr95ibpe3cdrTbY8D9lonrK433rcA= @@ -364,7 +363,7 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -402,8 +401,9 @@ github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= @@ -412,6 +412,7 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -437,15 +438,15 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.9.0 h1:7KFNiCgZ91Ru4qW4CWPf/7jqtxLagGRmIxWldPP9VY4= +github.com/otiai10/copy v1.10.0 h1:znyI7l134wNg/wDktoVQPxPkgvhDfGCYUasey+h0rDQ= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= -github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI= -github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -460,8 +461,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= -github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -472,15 +473,15 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= -github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZyPmD9nVcc= github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -536,8 +537,8 @@ github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -614,23 +615,24 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.6.0 h1:S30zwByGB8iVbdBbUUUmB3yL5spnRRYgPe7kP0E3SP4= -go.opentelemetry.io/build-tools v0.6.0/go.mod h1:ZdVGZ+VzIj7ZrEEbLeNS+RJthf278wLkRE1x0HiLLOM= -go.opentelemetry.io/build-tools/crosslink v0.6.0 h1:cY2BAAwCawRlupEVqcDTXdOr1tDE1J9WGQPgCV/cT4U= -go.opentelemetry.io/build-tools/crosslink v0.6.0/go.mod h1:kqGm9zUqfSnILBnOApA3P1GZTxa+pOMgfrgIBBTRESY= -go.opentelemetry.io/build-tools/dbotconf v0.6.0 h1:qgzfPBhoxIx0LtwaFODY3idqlTn/GQIlIeHIVlPxQDI= -go.opentelemetry.io/build-tools/dbotconf v0.6.0/go.mod h1:Dc1IUsodFA/wZSHtHnEWCs9tN1WYaoS8x5EgxISDFdA= -go.opentelemetry.io/build-tools/multimod v0.6.0 h1:XAmXNQNsfs4Tq9BtWKTY32OvTBgTBzKVn2Bawskjgac= -go.opentelemetry.io/build-tools/multimod v0.6.0/go.mod h1:YgIvurIda661iJ0yJbQWlE62VHLgP4HQJeqCa3uWsBI= -go.opentelemetry.io/build-tools/semconvgen v0.6.0 h1:n4s8fYTIRzUHh+EnJDBo+SlHdKAN/u1CQ3+s58u/rUk= -go.opentelemetry.io/build-tools/semconvgen v0.6.0/go.mod h1:q412C7OAvO/AjCmJL87sLh/lc/lKVwdwcL8zBVYKGIM= +go.opentelemetry.io/build-tools v0.7.0 h1:46znGJz1mhkfzbno/O6bDk0VNgjaRdqF48GbAtkCiBg= +go.opentelemetry.io/build-tools v0.7.0/go.mod h1:l38udQkILnLAzs9ucfDT24AAWJ7otdP6wtQXcyw/TeM= +go.opentelemetry.io/build-tools/crosslink v0.7.0 h1:N7Cue57OJ+MtmBxN9HxJhy6L3xsMpBpXo/I+l76UpwY= +go.opentelemetry.io/build-tools/crosslink v0.7.0/go.mod h1:4b21YR5+5/qwGmzOwIeTKoQayCX5tlnQKDal2POYZR8= +go.opentelemetry.io/build-tools/dbotconf v0.7.0 h1:6EV61QuJGB5Xz0YyPC7V3yO+0ZGB3SLQPBq3fb1Y1mU= +go.opentelemetry.io/build-tools/dbotconf v0.7.0/go.mod h1:7HqRvzmX+8wt8xy3zwSCSWufeT8gJiWhICpzNxn93yk= +go.opentelemetry.io/build-tools/multimod v0.7.0 h1:Af1wVNaJRMVqRkiiRjeMrAfKJDejvpsLoBF9H5UrjSo= +go.opentelemetry.io/build-tools/multimod v0.7.0/go.mod h1:WAwBtJC42JbRDzfi3erCYQ9M1RnyoIcqI/H8eqBBPQo= +go.opentelemetry.io/build-tools/semconvgen v0.7.0 h1:/M2qRnBQLN1rZmZ4F220EZh1CPil9Ji+XI2REudGRII= +go.opentelemetry.io/build-tools/semconvgen v0.7.0/go.mod h1:5g2MEDQeJlvSRuleejMTkSSWUqxIjYhwOKJnDzl/cdM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -644,9 +646,8 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -732,8 +733,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= @@ -741,6 +740,7 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -753,7 +753,6 @@ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -818,7 +817,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1072,5 +1070,6 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jC mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/schema/go.mod b/schema/go.mod index 7ef42812200..c344d05c415 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/schema go 1.19 require ( - github.com/Masterminds/semver/v3 v3.2.0 + github.com/Masterminds/semver/v3 v3.2.1 github.com/stretchr/testify v1.8.2 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index 6756672d0f5..2877eb69b1b 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -1,5 +1,5 @@ -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= -github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= +github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From f8fcfda8726f3cb29d2929135182b939d6c9cb63 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 18 Apr 2023 07:16:06 -0700 Subject: [PATCH 503/886] Add options to measurement methods (#3971) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add options to measurement methods * Update noop * Update global impl * Update SDK impl * Fix metric API example * Update prometheus exporter tests * Update examples * WithAttributes and WithAttributeSet * Add changes to changelog * Accept slice instead of variadic to new conf funcs * Clarify WithAttributes performance in docs * Address feedback about WithAttributes comment * Add changelog entry for WithAttribute{s,Set} * Remove number scope from measure opts * Update changelog * Remove left-over test cases --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 24 +++ example/prometheus/main.go | 16 +- example/view/main.go | 14 +- exporters/prometheus/exporter_test.go | 170 +++++++++--------- metric/example_test.go | 2 +- metric/instrument/asyncfloat64.go | 5 +- metric/instrument/asyncfloat64_test.go | 3 +- metric/instrument/asyncint64.go | 5 +- metric/instrument/asyncint64_test.go | 3 +- metric/instrument/instrument.go | 164 +++++++++++++++++ metric/instrument/instrument_test.go | 152 ++++++++++++++++ metric/instrument/syncfloat64.go | 7 +- metric/instrument/syncint64.go | 7 +- metric/internal/global/instruments.go | 25 ++- metric/internal/global/instruments_test.go | 47 ++--- metric/internal/global/meter_types_test.go | 5 +- metric/meter.go | 9 +- metric/noop/noop.go | 21 ++- sdk/metric/benchmark_test.go | 129 ++++++------- sdk/metric/instrument.go | 69 ++++--- sdk/metric/instrument_test.go | 8 +- .../internal/aggregator_example_test.go | 4 +- sdk/metric/meter.go | 77 +++++--- sdk/metric/meter_test.go | 140 +++++++-------- 24 files changed, 742 insertions(+), 364 deletions(-) create mode 100644 metric/instrument/instrument_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e42aeedf4c..0ddf1ebc4b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) - The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949) - Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970) +- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971) + - The `AddConfig` used to hold configuration for addition measurements + - `NewAddConfig` used to create a new `AddConfig` + - `AddOption` used to configure an `AddConfig` + - The `RecordConfig` used to hold configuration for recorded measurements + - `NewRecordConfig` used to create a new `RecordConfig` + - `RecordOption` used to configure a `RecordConfig` + - The `ObserveConfig` used to hold configuration for observed measurements + - `NewObserveConfig` used to create a new `ObserveConfig` + - `ObserveOption` used to configure an `ObserveConfig` +- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`. + They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971) - The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956) - The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956) @@ -24,6 +36,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` - Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) +- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Int64Counter.Add` method now accepts `...AddOption` + - The `Float64Counter.Add` method now accepts `...AddOption` + - The `Int64UpDownCounter.Add` method now accepts `...AddOption` + - The `Float64UpDownCounter.Add` method now accepts `...AddOption` + - The `Int64Histogram.Record` method now accepts `...RecordOption` + - The `Float64Histogram.Record` method now accepts `...RecordOption` + - The `Int64Observer.Observe` method now accepts `...ObserveOption` + - The `Float64Observer.Observe` method now accepts `...ObserveOption` +- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) + - The `Observer.ObserveInt64` method now accepts `...ObserveOption` + - The `Observer.ObserveFloat64` method now accepts `...ObserveOption` - Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986) ### Fixed diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 652140d9442..c716aa1e447 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -50,17 +50,17 @@ func main() { // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) // This is the equivalent of prometheus.NewCounterVec counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } - counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 5, opt) gauge, err := meter.Float64ObservableGauge("bar", instrument.WithDescription("a fun little gauge")) if err != nil { @@ -68,7 +68,7 @@ func main() { } _, err = meter.RegisterCallback(func(_ context.Context, o api.Observer) error { n := -10. + rng.Float64()*(90.) // [-10, 100) - o.ObserveFloat64(gauge, n, attrs...) + o.ObserveFloat64(gauge, n, opt) return nil }, gauge) if err != nil { @@ -80,10 +80,10 @@ func main() { if err != nil { log.Fatal(err) } - histogram.Record(ctx, 23, attrs...) - histogram.Record(ctx, 7, attrs...) - histogram.Record(ctx, 101, attrs...) - histogram.Record(ctx, 105, attrs...) + histogram.Record(ctx, 23, opt) + histogram.Record(ctx, 7, opt) + histogram.Record(ctx, 101, opt) + histogram.Record(ctx, 105, opt) ctx, _ = signal.NotifyContext(ctx, os.Interrupt) <-ctx.Done() diff --git a/example/view/main.go b/example/view/main.go index b609e48737d..1fc6d9cd636 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -64,25 +64,25 @@ func main() { // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } - counter.Add(ctx, 5, attrs...) + counter.Add(ctx, 5, opt) histogram, err := meter.Float64Histogram("custom_histogram", instrument.WithDescription("a histogram with custom buckets and rename")) if err != nil { log.Fatal(err) } - histogram.Record(ctx, 136, attrs...) - histogram.Record(ctx, 64, attrs...) - histogram.Record(ctx, 701, attrs...) - histogram.Record(ctx, 830, attrs...) + histogram.Record(ctx, 136, opt) + histogram.Record(ctx, 64, opt) + histogram.Record(ctx, 701, opt) + histogram.Record(ctx, 830, opt) ctx, _ = signal.NotifyContext(ctx, os.Interrupt) <-ctx.Done() diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index d80d8899c5d..868e575319b 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -46,67 +46,67 @@ func TestPrometheusExporter(t *testing.T) { name: "counter", expectedFile: "testdata/counter.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } + ) counter, err := meter.Float64Counter( "foo", instrument.WithDescription("a simple counter"), instrument.WithUnit("ms"), ) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) - attrs2 := []attribute.KeyValue{ + attrs2 := attribute.NewSet( attribute.Key("A").String("D"), attribute.Key("C").String("B"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } - counter.Add(ctx, 5, attrs2...) + ) + counter.Add(ctx, 5, instrument.WithAttributeSet(attrs2)) }, }, { name: "gauge", expectedFile: "testdata/gauge.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) gauge, err := meter.Float64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), instrument.WithUnit("1"), ) require.NoError(t, err) - gauge.Add(ctx, 1.0, attrs...) - gauge.Add(ctx, -.25, attrs...) + gauge.Add(ctx, 1.0, opt) + gauge.Add(ctx, -.25, opt) }, }, { name: "histogram", expectedFile: "testdata/histogram.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) histogram, err := meter.Float64Histogram( "histogram_baz", instrument.WithDescription("a very nice histogram"), instrument.WithUnit("By"), ) require.NoError(t, err) - histogram.Record(ctx, 23, attrs...) - histogram.Record(ctx, 7, attrs...) - histogram.Record(ctx, 101, attrs...) - histogram.Record(ctx, 105, attrs...) + histogram.Record(ctx, 23, opt) + histogram.Record(ctx, 7, opt) + histogram.Record(ctx, 101, opt) + histogram.Record(ctx, 105, opt) }, }, { @@ -114,7 +114,7 @@ func TestPrometheusExporter(t *testing.T) { expectedFile: "testdata/sanitized_labels.txt", options: []Option{WithoutUnits()}, recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( // exact match, value should be overwritten attribute.Key("A.B").String("X"), attribute.Key("A.B").String("Q"), @@ -122,7 +122,7 @@ func TestPrometheusExporter(t *testing.T) { // unintended match due to sanitization, values should be concatenated attribute.Key("C.D").String("Y"), attribute.Key("C/D").String("Z"), - } + ) counter, err := meter.Float64Counter( "foo", instrument.WithDescription("a sanitary counter"), @@ -130,37 +130,37 @@ func TestPrometheusExporter(t *testing.T) { instrument.WithUnit("By"), ) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) }, }, { name: "invalid instruments are renamed", expectedFile: "testdata/sanitized_names.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) // Valid. gauge, err := meter.Float64UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) require.NoError(t, err) - gauge.Add(ctx, 100, attrs...) - gauge.Add(ctx, -25, attrs...) + gauge.Add(ctx, 100, opt) + gauge.Add(ctx, -25, opt) // Invalid, will be renamed. gauge, err = meter.Float64UpDownCounter("invalid.gauge.name", instrument.WithDescription("a gauge with an invalid name")) require.NoError(t, err) - gauge.Add(ctx, 100, attrs...) + gauge.Add(ctx, 100, opt) counter, err := meter.Float64Counter("0invalid.counter.name", instrument.WithDescription("a counter with an invalid name")) require.NoError(t, err) - counter.Add(ctx, 100, attrs...) + counter.Add(ctx, 100, opt) histogram, err := meter.Float64Histogram("invalid.hist.name", instrument.WithDescription("a histogram with an invalid name")) require.NoError(t, err) - histogram.Record(ctx, 23, attrs...) + histogram.Record(ctx, 23, opt) }, }, { @@ -168,17 +168,17 @@ func TestPrometheusExporter(t *testing.T) { emptyResource: true, expectedFile: "testdata/empty_resource.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } + ) counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) }, }, { @@ -189,17 +189,17 @@ func TestPrometheusExporter(t *testing.T) { }, expectedFile: "testdata/custom_resource.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } + ) counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) }, }, { @@ -207,17 +207,17 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutTargetInfo()}, expectedFile: "testdata/without_target_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } + ) counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) }, }, { @@ -225,18 +225,18 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutScopeInfo()}, expectedFile: "testdata/without_scope_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) gauge, err := meter.Int64UpDownCounter( "bar", instrument.WithDescription("a fun little gauge"), instrument.WithUnit("1"), ) require.NoError(t, err) - gauge.Add(ctx, 2, attrs...) - gauge.Add(ctx, -1, attrs...) + gauge.Add(ctx, 2, opt) + gauge.Add(ctx, -1, opt) }, }, { @@ -244,18 +244,18 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutScopeInfo(), WithoutTargetInfo()}, expectedFile: "testdata/without_scope_and_target_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), - } + ) counter, err := meter.Int64Counter( "bar", instrument.WithDescription("a fun little counter"), instrument.WithUnit("By"), ) require.NoError(t, err) - counter.Add(ctx, 2, attrs...) - counter.Add(ctx, 1, attrs...) + counter.Add(ctx, 2, opt) + counter.Add(ctx, 1, opt) }, }, { @@ -265,17 +265,17 @@ func TestPrometheusExporter(t *testing.T) { WithNamespace("test"), }, recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - attrs := []attribute.KeyValue{ + opt := instrument.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), - } + ) counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) require.NoError(t, err) - counter.Add(ctx, 5, attrs...) - counter.Add(ctx, 10.3, attrs...) - counter.Add(ctx, 9, attrs...) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) }, }, } @@ -388,7 +388,7 @@ func TestMultiScopes(t *testing.T) { instrument.WithUnit("ms"), instrument.WithDescription("meter foo counter")) assert.NoError(t, err) - fooCounter.Add(ctx, 100, attribute.String("type", "foo")) + fooCounter.Add(ctx, 100, instrument.WithAttributes(attribute.String("type", "foo"))) barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( @@ -396,7 +396,7 @@ func TestMultiScopes(t *testing.T) { instrument.WithUnit("ms"), instrument.WithDescription("meter bar counter")) assert.NoError(t, err) - barCounter.Add(ctx, 200, attribute.String("type", "bar")) + barCounter.Add(ctx, 200, instrument.WithAttributes(attribute.String("type", "bar"))) file, err := os.Open("testdata/multi_scopes.txt") require.NoError(t, err) @@ -407,6 +407,12 @@ func TestMultiScopes(t *testing.T) { } func TestDuplicateMetrics(t *testing.T) { + ab := attribute.NewSet(attribute.String("A", "B")) + withAB := instrument.WithAttributeSet(ab) + typeBar := attribute.NewSet(attribute.String("type", "bar")) + withTypeBar := instrument.WithAttributeSet(typeBar) + typeFoo := attribute.NewSet(attribute.String("type", "foo")) + withTypeFoo := instrument.WithAttributeSet(typeFoo) testCases := []struct { name string customResouceAttrs []attribute.KeyValue @@ -421,13 +427,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) - fooA.Add(ctx, 100, attribute.String("A", "B")) + fooA.Add(ctx, 100, withAB) fooB, err := meterB.Int64Counter("foo", instrument.WithUnit("By"), instrument.WithDescription("meter counter foo")) assert.NoError(t, err) - fooB.Add(ctx, 100, attribute.String("A", "B")) + fooB.Add(ctx, 100, withAB) }, possibleExpectedFiles: []string{"testdata/no_conflict_two_counters.txt"}, }, @@ -438,13 +444,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) - fooA.Add(ctx, 100, attribute.String("A", "B")) + fooA.Add(ctx, 100, withAB) fooB, err := meterB.Int64UpDownCounter("foo", instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) - fooB.Add(ctx, 100, attribute.String("A", "B")) + fooB.Add(ctx, 100, withAB) }, possibleExpectedFiles: []string{"testdata/no_conflict_two_updowncounters.txt"}, }, @@ -455,13 +461,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) - fooA.Record(ctx, 100, attribute.String("A", "B")) + fooA.Record(ctx, 100, withAB) fooB, err := meterB.Int64Histogram("foo", instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) - fooB.Record(ctx, 100, attribute.String("A", "B")) + fooB.Record(ctx, 100, withAB) }, possibleExpectedFiles: []string{"testdata/no_conflict_two_histograms.txt"}, }, @@ -472,13 +478,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) - barA.Add(ctx, 100, attribute.String("type", "bar")) + barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64Counter("bar", instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) - barB.Add(ctx, 100, attribute.String("type", "bar")) + barB.Add(ctx, 100, withTypeBar) }, possibleExpectedFiles: []string{ "testdata/conflict_help_two_counters_1.txt", @@ -492,13 +498,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) - barA.Add(ctx, 100, attribute.String("type", "bar")) + barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64UpDownCounter("bar", instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) - barB.Add(ctx, 100, attribute.String("type", "bar")) + barB.Add(ctx, 100, withTypeBar) }, possibleExpectedFiles: []string{ "testdata/conflict_help_two_updowncounters_1.txt", @@ -512,13 +518,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter a bar")) assert.NoError(t, err) - barA.Record(ctx, 100, attribute.String("A", "B")) + barA.Record(ctx, 100, withAB) barB, err := meterB.Int64Histogram("bar", instrument.WithUnit("By"), instrument.WithDescription("meter b bar")) assert.NoError(t, err) - barB.Record(ctx, 100, attribute.String("A", "B")) + barB.Record(ctx, 100, withAB) }, possibleExpectedFiles: []string{ "testdata/conflict_help_two_histograms_1.txt", @@ -532,13 +538,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter bar")) assert.NoError(t, err) - bazA.Add(ctx, 100, attribute.String("type", "bar")) + bazA.Add(ctx, 100, withTypeBar) bazB, err := meterB.Int64Counter("bar", instrument.WithUnit("ms"), instrument.WithDescription("meter bar")) assert.NoError(t, err) - bazB.Add(ctx, 100, attribute.String("type", "bar")) + bazB.Add(ctx, 100, withTypeBar) }, options: []Option{WithoutUnits()}, possibleExpectedFiles: []string{"testdata/conflict_unit_two_counters.txt"}, @@ -550,13 +556,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) - barA.Add(ctx, 100, attribute.String("type", "bar")) + barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64UpDownCounter("bar", instrument.WithUnit("ms"), instrument.WithDescription("meter gauge bar")) assert.NoError(t, err) - barB.Add(ctx, 100, attribute.String("type", "bar")) + barB.Add(ctx, 100, withTypeBar) }, options: []Option{WithoutUnits()}, possibleExpectedFiles: []string{"testdata/conflict_unit_two_updowncounters.txt"}, @@ -568,13 +574,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) - barA.Record(ctx, 100, attribute.String("A", "B")) + barA.Record(ctx, 100, withAB) barB, err := meterB.Int64Histogram("bar", instrument.WithUnit("ms"), instrument.WithDescription("meter histogram bar")) assert.NoError(t, err) - barB.Record(ctx, 100, attribute.String("A", "B")) + barB.Record(ctx, 100, withAB) }, options: []Option{WithoutUnits()}, possibleExpectedFiles: []string{"testdata/conflict_unit_two_histograms.txt"}, @@ -586,13 +592,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter foo")) assert.NoError(t, err) - counter.Add(ctx, 100, attribute.String("type", "foo")) + counter.Add(ctx, 100, withTypeFoo) gauge, err := meterA.Int64UpDownCounter("foo_total", instrument.WithUnit("By"), instrument.WithDescription("meter foo")) assert.NoError(t, err) - gauge.Add(ctx, 200, attribute.String("type", "foo")) + gauge.Add(ctx, 200, withTypeFoo) }, options: []Option{WithoutUnits()}, possibleExpectedFiles: []string{ @@ -607,13 +613,13 @@ func TestDuplicateMetrics(t *testing.T) { instrument.WithUnit("By"), instrument.WithDescription("meter gauge foo")) assert.NoError(t, err) - fooA.Add(ctx, 100, attribute.String("A", "B")) + fooA.Add(ctx, 100, withAB) fooHistogramA, err := meterA.Int64Histogram("foo", instrument.WithUnit("By"), instrument.WithDescription("meter histogram foo")) assert.NoError(t, err) - fooHistogramA.Record(ctx, 100, attribute.String("A", "B")) + fooHistogramA.Record(ctx, 100, withAB) }, possibleExpectedFiles: []string{ "testdata/conflict_type_histogram_and_updowncounter_1.txt", diff --git a/metric/example_test.go b/metric/example_test.go index fbaefcd123f..1782e79097f 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -63,7 +63,7 @@ func ExampleMeter_asynchronous_single() { // // For demonstration purpose, a static value is used here. usage := 75000 - obsrv.Observe(int64(usage), attribute.Int("disk.id", 3)) + obsrv.Observe(int64(usage), instrument.WithAttributes(attribute.Int("disk.id", 3))) return nil }), ) diff --git a/metric/instrument/asyncfloat64.go b/metric/instrument/asyncfloat64.go index 356c969b6b1..5aaac43a7aa 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/instrument/asyncfloat64.go @@ -17,7 +17,6 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -207,8 +206,8 @@ type Float64ObservableGaugeOption interface { type Float64Observer interface { embedded.Float64Observer - // Observe records the float64 value with attributes. - Observe(value float64, attributes ...attribute.KeyValue) + // Observe records the float64 value. + Observe(value float64, opts ...ObserveOption) } // Float64Callback is a function registered with a Meter that makes diff --git a/metric/instrument/asyncfloat64_test.go b/metric/instrument/asyncfloat64_test.go index 5a23c2845f7..73be71d1dc9 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/instrument/asyncfloat64_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -89,6 +88,6 @@ type float64Observer struct { got float64 } -func (o *float64Observer) Observe(v float64, _ ...attribute.KeyValue) { +func (o *float64Observer) Observe(v float64, _ ...ObserveOption) { o.got = v } diff --git a/metric/instrument/asyncint64.go b/metric/instrument/asyncint64.go index 05bfc8dbe0f..e9027b4b480 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/instrument/asyncint64.go @@ -17,7 +17,6 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -206,8 +205,8 @@ type Int64ObservableGaugeOption interface { type Int64Observer interface { embedded.Int64Observer - // Observe records the int64 value with attributes. - Observe(value int64, attributes ...attribute.KeyValue) + // Observe records the int64 value. + Observe(value int64, opts ...ObserveOption) } // Int64Callback is a function registered with a Meter that makes observations diff --git a/metric/instrument/asyncint64_test.go b/metric/instrument/asyncint64_test.go index b52f0730d5d..2b7bc91c003 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/instrument/asyncint64_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -89,6 +88,6 @@ type int64Observer struct { got int64 } -func (o *int64Observer) Observe(v int64, _ ...attribute.KeyValue) { +func (o *int64Observer) Observe(v int64, _ ...ObserveOption) { o.got = v } diff --git a/metric/instrument/instrument.go b/metric/instrument/instrument.go index 3eaeb302767..cb0373c16e5 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument/instrument.go @@ -14,6 +14,8 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" +import "go.opentelemetry.io/otel/attribute" + // Observable is used as a grouping mechanism for all instruments that are // updated within a Callback. type Observable interface { @@ -166,3 +168,165 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob // WithUnit sets the instrument unit. func WithUnit(u string) Option { return unitOpt(u) } + +// AddOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a AddOption. +type AddOption interface { + applyAdd(AddConfig) AddConfig +} + +// AddConfig contains options for an addition measurement. +type AddConfig struct { + attrs attribute.Set +} + +// NewAddConfig returns a new [AddConfig] with all opts applied. +func NewAddConfig(opts []AddOption) AddConfig { + config := AddConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyAdd(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c AddConfig) Attributes() attribute.Set { + return c.attrs +} + +// RecordOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a RecordOption. +type RecordOption interface { + applyRecord(RecordConfig) RecordConfig +} + +// RecordConfig contains options for a recorded measurement. +type RecordConfig struct { + attrs attribute.Set +} + +// NewRecordConfig returns a new [RecordConfig] with all opts applied. +func NewRecordConfig(opts []RecordOption) RecordConfig { + config := RecordConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyRecord(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c RecordConfig) Attributes() attribute.Set { + return c.attrs +} + +// ObserveOption applies options to an addition measurement. See +// [MeasurementOption] for other options that can be used as a ObserveOption. +type ObserveOption interface { + applyObserve(ObserveConfig) ObserveConfig +} + +// ObserveConfig contains options for an observed measurement. +type ObserveConfig struct { + attrs attribute.Set +} + +// NewObserveConfig returns a new [ObserveConfig] with all opts applied. +func NewObserveConfig(opts []ObserveOption) ObserveConfig { + config := ObserveConfig{attrs: *attribute.EmptySet()} + for _, o := range opts { + config = o.applyObserve(config) + } + return config +} + +// Attributes returns the configured attribute set. +func (c ObserveConfig) Attributes() attribute.Set { + return c.attrs +} + +// MeasurementOption applies options to all instrument measurement. +type MeasurementOption interface { + AddOption + RecordOption + ObserveOption +} + +type attrOpt struct { + set attribute.Set +} + +// mergeSets returns the union of keys between a and b. Any duplicate keys will +// use the value associated with b. +func mergeSets(a, b attribute.Set) attribute.Set { + // NewMergeIterator uses the first value for any duplicates. + iter := attribute.NewMergeIterator(&b, &a) + merged := make([]attribute.KeyValue, 0, a.Len()+b.Len()) + for iter.Next() { + merged = append(merged, iter.Attribute()) + } + return attribute.NewSet(merged...) +} + +func (o attrOpt) applyAdd(c AddConfig) AddConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyRecord(c RecordConfig) RecordConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig { + switch { + case o.set.Len() == 0: + case c.attrs.Len() == 0: + c.attrs = o.set + default: + c.attrs = mergeSets(c.attrs, o.set) + } + return c +} + +// WithAttributeSet sets the attribute Set associated with a measurement is +// made with. +// +// If multiple WithAttributeSet or WithAttributes options are passed the +// attributes will be merged together in the order they are passed. Attributes +// with duplicate keys will use the last value passed. +func WithAttributeSet(attributes attribute.Set) MeasurementOption { + return attrOpt{set: attributes} +} + +// WithAttributes converts attributes into an attribute Set and sets the Set to +// be associated with a measurement. This is shorthand for: +// +// cp := make([]attribute.KeyValue, len(attributes)) +// copy(cp, attributes) +// WithAttributes(attribute.NewSet(cp...)) +// +// [attribute.NewSet] may modify the passed attributes so this will make a copy +// of attributes before creating a set in order to ensure this function is +// concurrent safe. This makes this option function less optimized in +// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be +// preferred for performance sensitive code. +// +// See [WithAttributeSet] for information about how multiple WithAttributes are +// merged. +func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption { + cp := make([]attribute.KeyValue, len(attributes)) + copy(cp, attributes) + return attrOpt{set: attribute.NewSet(cp...)} +} diff --git a/metric/instrument/instrument_test.go b/metric/instrument/instrument_test.go new file mode 100644 index 00000000000..23f2bdab215 --- /dev/null +++ b/metric/instrument/instrument_test.go @@ -0,0 +1,152 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "sync" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" +) + +type attrConf interface { + Attributes() attribute.Set +} + +func TestConfigAttrs(t *testing.T) { + t.Run("AddConfig", testConfAttr(func(mo ...MeasurementOption) attrConf { + opts := make([]AddOption, len(mo)) + for i := range mo { + opts[i] = mo[i].(AddOption) + } + return NewAddConfig(opts) + })) + + t.Run("RecordConfig", testConfAttr(func(mo ...MeasurementOption) attrConf { + opts := make([]RecordOption, len(mo)) + for i := range mo { + opts[i] = mo[i].(RecordOption) + } + return NewRecordConfig(opts) + })) + + t.Run("ObserveConfig", testConfAttr(func(mo ...MeasurementOption) attrConf { + opts := make([]ObserveOption, len(mo)) + for i := range mo { + opts[i] = mo[i].(ObserveOption) + } + return NewObserveConfig(opts) + })) +} + +func testConfAttr(newConf func(...MeasurementOption) attrConf) func(t *testing.T) { + return func(t *testing.T) { + t.Run("ZeroConfigEmpty", func(t *testing.T) { + c := newConf() + assert.Equal(t, *attribute.EmptySet(), c.Attributes()) + }) + + t.Run("EmptySet", func(t *testing.T) { + c := newConf(WithAttributeSet(*attribute.EmptySet())) + assert.Equal(t, *attribute.EmptySet(), c.Attributes()) + }) + + aliceAttr := attribute.String("user", "Alice") + alice := attribute.NewSet(aliceAttr) + t.Run("SingleWithAttributeSet", func(t *testing.T) { + c := newConf(WithAttributeSet(alice)) + assert.Equal(t, alice, c.Attributes()) + }) + + t.Run("SingleWithAttributes", func(t *testing.T) { + c := newConf(WithAttributes(aliceAttr)) + assert.Equal(t, alice, c.Attributes()) + }) + + bobAttr := attribute.String("user", "Bob") + bob := attribute.NewSet(bobAttr) + t.Run("MultiWithAttributeSet", func(t *testing.T) { + c := newConf(WithAttributeSet(alice), WithAttributeSet(bob)) + assert.Equal(t, bob, c.Attributes()) + }) + + t.Run("MergedWithAttributes", func(t *testing.T) { + c := newConf(WithAttributes(aliceAttr, bobAttr)) + assert.Equal(t, bob, c.Attributes()) + }) + + t.Run("MultiWithAttributeSet", func(t *testing.T) { + c := newConf(WithAttributes(aliceAttr), WithAttributes(bobAttr)) + assert.Equal(t, bob, c.Attributes()) + }) + + t.Run("MergedEmpty", func(t *testing.T) { + c := newConf(WithAttributeSet(alice), WithAttributeSet(*attribute.EmptySet())) + assert.Equal(t, alice, c.Attributes()) + }) + } +} + +func TestWithAttributesRace(t *testing.T) { + attrs := []attribute.KeyValue{ + attribute.String("user", "Alice"), + attribute.Bool("admin", true), + attribute.String("user", "Bob"), + } + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + opt := []AddOption{WithAttributes(attrs...)} + _ = NewAddConfig(opt) + }() + wg.Add(1) + go func() { + defer wg.Done() + opt := []AddOption{WithAttributes(attrs...)} + _ = NewAddConfig(opt) + }() + + wg.Add(1) + go func() { + defer wg.Done() + opt := []RecordOption{WithAttributes(attrs...)} + _ = NewRecordConfig(opt) + }() + wg.Add(1) + go func() { + defer wg.Done() + opt := []RecordOption{WithAttributes(attrs...)} + _ = NewRecordConfig(opt) + }() + + wg.Add(1) + go func() { + defer wg.Done() + opt := []ObserveOption{WithAttributes(attrs...)} + _ = NewObserveConfig(opt) + }() + wg.Add(1) + go func() { + defer wg.Done() + opt := []ObserveOption{WithAttributes(attrs...)} + _ = NewObserveConfig(opt) + }() + + wg.Wait() +} diff --git a/metric/instrument/syncfloat64.go b/metric/instrument/syncfloat64.go index 03b3bf6ac2d..2399f83637e 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/instrument/syncfloat64.go @@ -17,7 +17,6 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -31,7 +30,7 @@ type Float64Counter interface { embedded.Float64Counter // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + Add(ctx context.Context, incr float64, opts ...AddOption) } // Float64CounterConfig contains options for synchronous counter instruments that @@ -78,7 +77,7 @@ type Float64UpDownCounter interface { embedded.Float64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + Add(ctx context.Context, incr float64, opts ...AddOption) } // Float64UpDownCounterConfig contains options for synchronous counter @@ -126,7 +125,7 @@ type Float64Histogram interface { embedded.Float64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue) + Record(ctx context.Context, incr float64, opts ...RecordOption) } // Float64HistogramConfig contains options for synchronous counter instruments diff --git a/metric/instrument/syncint64.go b/metric/instrument/syncint64.go index 22d0718c87c..53d1c5b6c0a 100644 --- a/metric/instrument/syncint64.go +++ b/metric/instrument/syncint64.go @@ -17,7 +17,6 @@ package instrument // import "go.opentelemetry.io/otel/metric/instrument" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" ) @@ -31,7 +30,7 @@ type Int64Counter interface { embedded.Int64Counter // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + Add(ctx context.Context, incr int64, opts ...AddOption) } // Int64CounterConfig contains options for synchronous counter instruments that @@ -78,7 +77,7 @@ type Int64UpDownCounter interface { embedded.Int64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + Add(ctx context.Context, incr int64, opts ...AddOption) } // Int64UpDownCounterConfig contains options for synchronous counter @@ -126,7 +125,7 @@ type Int64Histogram interface { embedded.Int64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue) + Record(ctx context.Context, incr int64, opts ...RecordOption) } // Int64HistogramConfig contains options for synchronous counter instruments diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index a825b4acadf..79dd446630a 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -19,7 +19,6 @@ import ( "sync/atomic" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" @@ -225,9 +224,9 @@ func (i *sfCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { +func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...instrument.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64Counter).Add(ctx, incr, attrs...) + ctr.(instrument.Float64Counter).Add(ctx, incr, opts...) } } @@ -251,9 +250,9 @@ func (i *sfUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) { +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...instrument.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, attrs...) + ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, opts...) } } @@ -277,9 +276,9 @@ func (i *sfHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) { +func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...instrument.RecordOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64Histogram).Record(ctx, x, attrs...) + ctr.(instrument.Float64Histogram).Record(ctx, x, opts...) } } @@ -303,9 +302,9 @@ func (i *siCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { +func (i *siCounter) Add(ctx context.Context, x int64, opts ...instrument.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64Counter).Add(ctx, x, attrs...) + ctr.(instrument.Int64Counter).Add(ctx, x, opts...) } } @@ -329,9 +328,9 @@ func (i *siUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) { +func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...instrument.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64UpDownCounter).Add(ctx, x, attrs...) + ctr.(instrument.Int64UpDownCounter).Add(ctx, x, opts...) } } @@ -355,8 +354,8 @@ func (i *siHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) { +func (i *siHistogram) Record(ctx context.Context, x int64, opts ...instrument.RecordOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64Histogram).Record(ctx, x, attrs...) + ctr.(instrument.Int64Histogram).Record(ctx, x, opts...) } } diff --git a/metric/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go index 6b5af6715ea..ce78cfb1252 100644 --- a/metric/internal/global/instruments_test.go +++ b/metric/internal/global/instruments_test.go @@ -18,18 +18,17 @@ import ( "context" "testing" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/noop" ) -func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { +func testFloat64Race(interact func(float64), setDelegate func(metric.Meter)) { finish := make(chan struct{}) go func() { for { - interact(context.Background(), 1) + interact(1) select { case <-finish: return @@ -42,11 +41,11 @@ func testFloat64Race(interact func(context.Context, float64, ...attribute.KeyVal close(finish) } -func testInt64Race(interact func(context.Context, int64, ...attribute.KeyValue), setDelegate func(metric.Meter)) { +func testInt64Race(interact func(int64), setDelegate func(metric.Meter)) { finish := make(chan struct{}) go func() { for { - interact(context.Background(), 1) + interact(1) select { case <-finish: return @@ -64,19 +63,19 @@ func TestAsyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Float64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &afCounter{} - f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(float64) { _ = delegate.Unwrap() } testFloat64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &afUpDownCounter{} - f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(float64) { _ = delegate.Unwrap() } testFloat64Race(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &afGauge{} - f := func(context.Context, float64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(float64) { _ = delegate.Unwrap() } testFloat64Race(f, delegate.setDelegate) }) }) @@ -86,19 +85,19 @@ func TestAsyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Int64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &aiCounter{} - f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(int64) { _ = delegate.Unwrap() } testInt64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &aiUpDownCounter{} - f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(int64) { _ = delegate.Unwrap() } testInt64Race(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &aiGauge{} - f := func(context.Context, int64, ...attribute.KeyValue) { _ = delegate.Unwrap() } + f := func(int64) { _ = delegate.Unwrap() } testInt64Race(f, delegate.setDelegate) }) }) @@ -109,17 +108,20 @@ func TestSyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Float64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &sfCounter{} - testFloat64Race(delegate.Add, delegate.setDelegate) + f := func(v float64) { delegate.Add(context.Background(), v) } + testFloat64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &sfUpDownCounter{} - testFloat64Race(delegate.Add, delegate.setDelegate) + f := func(v float64) { delegate.Add(context.Background(), v) } + testFloat64Race(f, delegate.setDelegate) }) t.Run("Histogram", func(t *testing.T) { delegate := &sfHistogram{} - testFloat64Race(delegate.Record, delegate.setDelegate) + f := func(v float64) { delegate.Record(context.Background(), v) } + testFloat64Race(f, delegate.setDelegate) }) }) @@ -128,17 +130,20 @@ func TestSyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Int64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &siCounter{} - testInt64Race(delegate.Add, delegate.setDelegate) + f := func(v int64) { delegate.Add(context.Background(), v) } + testInt64Race(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &siUpDownCounter{} - testInt64Race(delegate.Add, delegate.setDelegate) + f := func(v int64) { delegate.Add(context.Background(), v) } + testInt64Race(f, delegate.setDelegate) }) t.Run("Histogram", func(t *testing.T) { delegate := &siHistogram{} - testInt64Race(delegate.Record, delegate.setDelegate) + f := func(v int64) { delegate.Record(context.Background(), v) } + testInt64Race(f, delegate.setDelegate) }) }) } @@ -158,10 +163,10 @@ type testCountingFloatInstrument struct { func (i *testCountingFloatInstrument) observe() { i.count++ } -func (i *testCountingFloatInstrument) Add(context.Context, float64, ...attribute.KeyValue) { +func (i *testCountingFloatInstrument) Add(context.Context, float64, ...instrument.AddOption) { i.count++ } -func (i *testCountingFloatInstrument) Record(context.Context, float64, ...attribute.KeyValue) { +func (i *testCountingFloatInstrument) Record(context.Context, float64, ...instrument.RecordOption) { i.count++ } @@ -180,9 +185,9 @@ type testCountingIntInstrument struct { func (i *testCountingIntInstrument) observe() { i.count++ } -func (i *testCountingIntInstrument) Add(context.Context, int64, ...attribute.KeyValue) { +func (i *testCountingIntInstrument) Add(context.Context, int64, ...instrument.AddOption) { i.count++ } -func (i *testCountingIntInstrument) Record(context.Context, int64, ...attribute.KeyValue) { +func (i *testCountingIntInstrument) Record(context.Context, int64, ...instrument.RecordOption) { i.count++ } diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 76827e72eb1..45de7ca4dbb 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -17,7 +17,6 @@ package global // import "go.opentelemetry.io/otel/metric/internal/global" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" @@ -157,14 +156,14 @@ type observationRecorder struct { ctx context.Context } -func (o observationRecorder) ObserveFloat64(i instrument.Float64Observable, value float64, attr ...attribute.KeyValue) { +func (o observationRecorder) ObserveFloat64(i instrument.Float64Observable, value float64, _ ...instrument.ObserveOption) { iImpl, ok := i.(*testCountingFloatInstrument) if ok { iImpl.observe() } } -func (o observationRecorder) ObserveInt64(i instrument.Int64Observable, value int64, attr ...attribute.KeyValue) { +func (o observationRecorder) ObserveInt64(i instrument.Int64Observable, value int64, _ ...instrument.ObserveOption) { iImpl, ok := i.(*testCountingIntInstrument) if ok { iImpl.observe() diff --git a/metric/meter.go b/metric/meter.go index f09feca83aa..0f77cde8d7e 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -17,7 +17,6 @@ package metric // import "go.opentelemetry.io/otel/metric" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" ) @@ -141,10 +140,10 @@ type Callback func(context.Context, Observer) error type Observer interface { embedded.Observer - // ObserveFloat64 records the float64 value with attributes for obsrv. - ObserveFloat64(obsrv instrument.Float64Observable, value float64, attributes ...attribute.KeyValue) - // ObserveInt64 records the int64 value with attributes for obsrv. - ObserveInt64(obsrv instrument.Int64Observable, value int64, attributes ...attribute.KeyValue) + // ObserveFloat64 records the float64 value for obsrv. + ObserveFloat64(obsrv instrument.Float64Observable, value float64, opts ...instrument.ObserveOption) + // ObserveInt64 records the int64 value for obsrv. + ObserveInt64(obsrv instrument.Int64Observable, value int64, opts ...instrument.ObserveOption) } // Registration is an token representing the unique registration of a callback diff --git a/metric/noop/noop.go b/metric/noop/noop.go index b4eaf4d6406..683f3e1c84c 100644 --- a/metric/noop/noop.go +++ b/metric/noop/noop.go @@ -26,7 +26,6 @@ package noop // import "go.opentelemetry.io/otel/metric/noop" import ( "context" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/metric/instrument" @@ -153,11 +152,11 @@ func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric type Observer struct{ embedded.Observer } // ObserveFloat64 performs no operation. -func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...attribute.KeyValue) { +func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...instrument.ObserveOption) { } // ObserveInt64 performs no operation. -func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...attribute.KeyValue) { +func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...instrument.ObserveOption) { } // Registration is the registration of a Callback with a No-Op Meter. @@ -173,42 +172,42 @@ func (Registration) Unregister() error { return nil } type Int64Counter struct{ embedded.Int64Counter } // Add performs no operation. -func (Int64Counter) Add(context.Context, int64, ...attribute.KeyValue) {} +func (Int64Counter) Add(context.Context, int64, ...instrument.AddOption) {} // Float64Counter is an OpenTelemetry Counter used to record float64 // measurements. It produces no telemetry. type Float64Counter struct{ embedded.Float64Counter } // Add performs no operation. -func (Float64Counter) Add(context.Context, float64, ...attribute.KeyValue) {} +func (Float64Counter) Add(context.Context, float64, ...instrument.AddOption) {} // Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 // measurements. It produces no telemetry. type Int64UpDownCounter struct{ embedded.Int64UpDownCounter } // Add performs no operation. -func (Int64UpDownCounter) Add(context.Context, int64, ...attribute.KeyValue) {} +func (Int64UpDownCounter) Add(context.Context, int64, ...instrument.AddOption) {} // Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record // float64 measurements. It produces no telemetry. type Float64UpDownCounter struct{ embedded.Float64UpDownCounter } // Add performs no operation. -func (Float64UpDownCounter) Add(context.Context, float64, ...attribute.KeyValue) {} +func (Float64UpDownCounter) Add(context.Context, float64, ...instrument.AddOption) {} // Int64Histogram is an OpenTelemetry Histogram used to record int64 // measurements. It produces no telemetry. type Int64Histogram struct{ embedded.Int64Histogram } // Record performs no operation. -func (Int64Histogram) Record(context.Context, int64, ...attribute.KeyValue) {} +func (Int64Histogram) Record(context.Context, int64, ...instrument.RecordOption) {} // Float64Histogram is an OpenTelemetry Histogram used to record float64 // measurements. It produces no telemetry. type Float64Histogram struct{ embedded.Float64Histogram } // Record performs no operation. -func (Float64Histogram) Record(context.Context, float64, ...attribute.KeyValue) {} +func (Float64Histogram) Record(context.Context, float64, ...instrument.RecordOption) {} // Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record // int64 measurements. It produces no telemetry. @@ -256,11 +255,11 @@ type Float64ObservableUpDownCounter struct { type Int64Observer struct{ embedded.Int64Observer } // Observe performs no operation. -func (Int64Observer) Observe(int64, ...attribute.KeyValue) {} +func (Int64Observer) Observe(int64, ...instrument.ObserveOption) {} // Float64Observer is a recorder of float64 measurements that performs no // operation. type Float64Observer struct{ embedded.Float64Observer } // Observe performs no operation. -func (Float64Observer) Observe(float64, ...attribute.KeyValue) {} +func (Float64Observer) Observe(float64, ...instrument.ObserveOption) {} diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index e1dbba593b6..8ac57a67e3c 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -66,59 +66,65 @@ func benchSyncViews(views ...View) func(*testing.B) { iCtr, err := meter.Int64Counter("int64-counter") assert.NoError(b, err) b.Run("Int64Counter", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { iCtr.Add(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.AddOption{instrument.WithAttributeSet(s)} + return func() { iCtr.Add(ctx, 1, o...) } } }())) fCtr, err := meter.Float64Counter("float64-counter") assert.NoError(b, err) b.Run("Float64Counter", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { fCtr.Add(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.AddOption{instrument.WithAttributeSet(s)} + return func() { fCtr.Add(ctx, 1, o...) } } }())) iUDCtr, err := meter.Int64UpDownCounter("int64-up-down-counter") assert.NoError(b, err) b.Run("Int64UpDownCounter", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { iUDCtr.Add(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.AddOption{instrument.WithAttributeSet(s)} + return func() { iUDCtr.Add(ctx, 1, o...) } } }())) fUDCtr, err := meter.Float64UpDownCounter("float64-up-down-counter") assert.NoError(b, err) b.Run("Float64UpDownCounter", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { fUDCtr.Add(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.AddOption{instrument.WithAttributeSet(s)} + return func() { fUDCtr.Add(ctx, 1, o...) } } }())) iHist, err := meter.Int64Histogram("int64-histogram") assert.NoError(b, err) b.Run("Int64Histogram", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { iHist.Record(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.RecordOption{instrument.WithAttributeSet(s)} + return func() { iHist.Record(ctx, 1, o...) } } }())) fHist, err := meter.Float64Histogram("float64-histogram") assert.NoError(b, err) b.Run("Float64Histogram", benchMeasAttrs(func() measF { - return func(attr []attribute.KeyValue) func() { - return func() { fHist.Record(ctx, 1, attr...) } + return func(s attribute.Set) func() { + o := []instrument.RecordOption{instrument.WithAttributeSet(s)} + return func() { fHist.Record(ctx, 1, o...) } } }())) } } -type measF func(attr []attribute.KeyValue) func() +type measF func(s attribute.Set) func() func benchMeasAttrs(meas measF) func(*testing.B) { return func(b *testing.B) { b.Run("Attributes/0", func(b *testing.B) { - f := meas(nil) + f := meas(*attribute.EmptySet()) b.ReportAllocs() b.ResetTimer() for n := 0; n < b.N; n++ { @@ -126,8 +132,7 @@ func benchMeasAttrs(meas measF) func(*testing.B) { } }) b.Run("Attributes/1", func(b *testing.B) { - attrs := []attribute.KeyValue{attribute.Bool("K", true)} - f := meas(attrs) + f := meas(attribute.NewSet(attribute.Bool("K", true))) b.ReportAllocs() b.ResetTimer() for n := 0; n < b.N; n++ { @@ -141,7 +146,7 @@ func benchMeasAttrs(meas measF) func(*testing.B) { for i := 2; i < n; i++ { attrs = append(attrs, attribute.Int(strconv.Itoa(i), i)) } - f := meas(attrs) + f := meas(attribute.NewSet(attrs...)) b.ReportAllocs() b.ResetTimer() for n := 0; n < b.N; n++ { @@ -165,163 +170,163 @@ func benchCollectViews(views ...View) func(*testing.B) { } ctx := context.Background() return func(b *testing.B) { - b.Run("Int64Counter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64Counter/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64Counter") i, err := m.Int64Counter("int64-counter") assert.NoError(b, err) - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Int64Counter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64Counter/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64Counter") i, err := m.Int64Counter("int64-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Float64Counter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64Counter/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64Counter") i, err := m.Float64Counter("float64-counter") assert.NoError(b, err) - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Float64Counter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64Counter/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64Counter") i, err := m.Float64Counter("float64-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Int64UpDownCounter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64UpDownCounter/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64UpDownCounter") i, err := m.Int64UpDownCounter("int64-up-down-counter") assert.NoError(b, err) - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Int64UpDownCounter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64UpDownCounter/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64UpDownCounter") i, err := m.Int64UpDownCounter("int64-up-down-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Float64UpDownCounter/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64UpDownCounter/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64UpDownCounter") i, err := m.Float64UpDownCounter("float64-up-down-counter") assert.NoError(b, err) - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Float64UpDownCounter/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64UpDownCounter/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64UpDownCounter") i, err := m.Float64UpDownCounter("float64-up-down-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, attr...) + i.Add(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Int64Histogram/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64Histogram/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64Histogram") i, err := m.Int64Histogram("int64-histogram") assert.NoError(b, err) - i.Record(ctx, 1, attr...) + i.Record(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Int64Histogram/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64Histogram/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64Histogram") i, err := m.Int64Histogram("int64-histogram") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Record(ctx, 1, attr...) + i.Record(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Float64Histogram/1", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64Histogram/1", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64Histogram") i, err := m.Float64Histogram("float64-histogram") assert.NoError(b, err) - i.Record(ctx, 1, attr...) + i.Record(ctx, 1, instrument.WithAttributeSet(s)) return r })) - b.Run("Float64Histogram/10", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64Histogram/10", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64Histogram") i, err := m.Float64Histogram("float64-histogram") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Record(ctx, 1, attr...) + i.Record(ctx, 1, instrument.WithAttributeSet(s)) } return r })) - b.Run("Int64ObservableCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64ObservableCounter", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64ObservableCounter") _, err := m.Int64ObservableCounter( "int64-observable-counter", - instrument.WithInt64Callback(int64Cback(attr)), + instrument.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r })) - b.Run("Float64ObservableCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64ObservableCounter", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64ObservableCounter") _, err := m.Float64ObservableCounter( "float64-observable-counter", - instrument.WithFloat64Callback(float64Cback(attr)), + instrument.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r })) - b.Run("Int64ObservableUpDownCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64ObservableUpDownCounter", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64ObservableUpDownCounter") _, err := m.Int64ObservableUpDownCounter( "int64-observable-up-down-counter", - instrument.WithInt64Callback(int64Cback(attr)), + instrument.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r })) - b.Run("Float64ObservableUpDownCounter", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64ObservableUpDownCounter", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64ObservableUpDownCounter") _, err := m.Float64ObservableUpDownCounter( "float64-observable-up-down-counter", - instrument.WithFloat64Callback(float64Cback(attr)), + instrument.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r })) - b.Run("Int64ObservableGauge", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Int64ObservableGauge", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Int64ObservableGauge") _, err := m.Int64ObservableGauge( "int64-observable-gauge", - instrument.WithInt64Callback(int64Cback(attr)), + instrument.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r })) - b.Run("Float64ObservableGauge", benchCollectAttrs(func(attr []attribute.KeyValue) Reader { + b.Run("Float64ObservableGauge", benchCollectAttrs(func(s attribute.Set) Reader { m, r := setup("benchCollectViews/Float64ObservableGauge") _, err := m.Float64ObservableGauge( "float64-observable-gauge", - instrument.WithFloat64Callback(float64Cback(attr)), + instrument.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r @@ -329,21 +334,23 @@ func benchCollectViews(views ...View) func(*testing.B) { } } -func int64Cback(attr []attribute.KeyValue) instrument.Int64Callback { +func int64Cback(s attribute.Set) instrument.Int64Callback { + opt := []instrument.ObserveOption{instrument.WithAttributeSet(s)} return func(_ context.Context, o instrument.Int64Observer) error { - o.Observe(1, attr...) + o.Observe(1, opt...) return nil } } -func float64Cback(attr []attribute.KeyValue) instrument.Float64Callback { +func float64Cback(s attribute.Set) instrument.Float64Callback { + opt := []instrument.ObserveOption{instrument.WithAttributeSet(s)} return func(_ context.Context, o instrument.Float64Observer) error { - o.Observe(1, attr...) + o.Observe(1, opt...) return nil } } -func benchCollectAttrs(setup func([]attribute.KeyValue) Reader) func(*testing.B) { +func benchCollectAttrs(setup func(attribute.Set) Reader) func(*testing.B) { ctx := context.Background() out := new(metricdata.ResourceMetrics) run := func(reader Reader) func(b *testing.B) { @@ -355,14 +362,14 @@ func benchCollectAttrs(setup func([]attribute.KeyValue) Reader) func(*testing.B) } } return func(b *testing.B) { - b.Run("Attributes/0", run(setup(nil))) + b.Run("Attributes/0", run(setup(*attribute.EmptySet()))) attrs := []attribute.KeyValue{attribute.Bool("K", true)} - b.Run("Attributes/1", run(setup(attrs))) + b.Run("Attributes/1", run(setup(attribute.NewSet(attrs...)))) for i := 2; i < 10; i++ { attrs = append(attrs, attribute.Int(strconv.Itoa(i), i)) } - b.Run("Attributes/10", run(setup(attrs))) + b.Run("Attributes/10", run(setup(attribute.NewSet(attrs...)))) } } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index e75e373d46c..b4eb05a1606 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -170,40 +170,63 @@ type streamID struct { Number string } -type instrumentImpl[N int64 | float64] struct { - aggregators []internal.Aggregator[N] +type int64Inst struct { + aggregators []internal.Aggregator[int64] - embedded.Float64Counter - embedded.Float64UpDownCounter - embedded.Float64Histogram embedded.Int64Counter embedded.Int64UpDownCounter embedded.Int64Histogram } -var _ instrument.Float64Counter = (*instrumentImpl[float64])(nil) -var _ instrument.Float64UpDownCounter = (*instrumentImpl[float64])(nil) -var _ instrument.Float64Histogram = (*instrumentImpl[float64])(nil) -var _ instrument.Int64Counter = (*instrumentImpl[int64])(nil) -var _ instrument.Int64UpDownCounter = (*instrumentImpl[int64])(nil) -var _ instrument.Int64Histogram = (*instrumentImpl[int64])(nil) +var _ instrument.Int64Counter = (*int64Inst)(nil) +var _ instrument.Int64UpDownCounter = (*int64Inst)(nil) +var _ instrument.Int64Histogram = (*int64Inst)(nil) + +func (i *int64Inst) Add(ctx context.Context, val int64, opts ...instrument.AddOption) { + c := instrument.NewAddConfig(opts) + i.aggregate(ctx, val, c.Attributes()) +} + +func (i *int64Inst) Record(ctx context.Context, val int64, opts ...instrument.RecordOption) { + c := instrument.NewRecordConfig(opts) + i.aggregate(ctx, val, c.Attributes()) +} + +func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { + if err := ctx.Err(); err != nil { + return + } + for _, agg := range i.aggregators { + agg.Aggregate(val, s) + } +} + +type float64Inst struct { + aggregators []internal.Aggregator[float64] + + embedded.Float64Counter + embedded.Float64UpDownCounter + embedded.Float64Histogram +} + +var _ instrument.Float64Counter = (*float64Inst)(nil) +var _ instrument.Float64UpDownCounter = (*float64Inst)(nil) +var _ instrument.Float64Histogram = (*float64Inst)(nil) -func (i *instrumentImpl[N]) Add(ctx context.Context, val N, attrs ...attribute.KeyValue) { - i.aggregate(ctx, val, attrs) +func (i *float64Inst) Add(ctx context.Context, val float64, opts ...instrument.AddOption) { + c := instrument.NewAddConfig(opts) + i.aggregate(ctx, val, c.Attributes()) } -func (i *instrumentImpl[N]) Record(ctx context.Context, val N, attrs ...attribute.KeyValue) { - i.aggregate(ctx, val, attrs) +func (i *float64Inst) Record(ctx context.Context, val float64, opts ...instrument.RecordOption) { + c := instrument.NewRecordConfig(opts) + i.aggregate(ctx, val, c.Attributes()) } -func (i *instrumentImpl[N]) aggregate(ctx context.Context, val N, attrs []attribute.KeyValue) { +func (i *float64Inst) aggregate(ctx context.Context, val float64, s attribute.Set) { if err := ctx.Err(); err != nil { return } - // Do not use single attribute.Sortable and attribute.NewSetWithSortable, - // this method needs to be concurrent safe. Let the sync.Pool in the - // attribute package handle allocations of the Sortable. - s := attribute.NewSet(attrs...) for _, agg := range i.aggregators { agg.Aggregate(val, s) } @@ -277,11 +300,7 @@ func newObservable[N int64 | float64](scope instrumentation.Scope, kind Instrume } // observe records the val for the set of attrs. -func (o *observable[N]) observe(val N, attrs []attribute.KeyValue) { - // Do not use single attribute.Sortable and attribute.NewSetWithSortable, - // this method needs to be concurrent safe. Let the sync.Pool in the - // attribute package handle allocations of the Sortable. - s := attribute.NewSet(attrs...) +func (o *observable[N]) observe(val N, s attribute.Set) { for _, agg := range o.aggregators { agg.Aggregate(val, s) } diff --git a/sdk/metric/instrument_test.go b/sdk/metric/instrument_test.go index 4315effbfd0..0a8f5924473 100644 --- a/sdk/metric/instrument_test.go +++ b/sdk/metric/instrument_test.go @@ -23,16 +23,16 @@ import ( ) func BenchmarkInstrument(b *testing.B) { - attr := func(id int) []attribute.KeyValue { - return []attribute.KeyValue{ + attr := func(id int) attribute.Set { + return attribute.NewSet( attribute.String("user", "Alice"), attribute.Bool("admin", true), attribute.Int("id", id), - } + ) } b.Run("instrumentImpl/aggregate", func(b *testing.B) { - inst := instrumentImpl[int64]{aggregators: []internal.Aggregator[int64]{ + inst := int64Inst{aggregators: []internal.Aggregator[int64]{ internal.NewLastValue[int64](), internal.NewCumulativeSum[int64](true), internal.NewDeltaSum[int64](true), diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index 297d0f5118e..f36d8262c5e 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -94,8 +94,8 @@ type inst struct { embedded.Int64Histogram } -func (inst) Add(context.Context, int64, ...attribute.KeyValue) {} -func (inst) Record(context.Context, int64, ...attribute.KeyValue) {} +func (inst) Add(context.Context, int64, ...instrument.AddOption) {} +func (inst) Record(context.Context, int64, ...instrument.RecordOption) {} func Example() { m := meter{} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 72b37ea6634..fe74a73de70 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -19,7 +19,6 @@ import ( "errors" "fmt" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" @@ -38,8 +37,8 @@ type meter struct { scope instrumentation.Scope pipes pipelines - int64IP *instProvider[int64] - float64IP *instProvider[float64] + int64IP *int64InstProvider + float64IP *float64InstProvider } func newMeter(s instrumentation.Scope, p pipelines) *meter { @@ -50,8 +49,8 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { return &meter{ scope: s, pipes: p, - int64IP: newInstProvider[int64](s, p, &viewCache), - float64IP: newInstProvider[float64](s, p, &viewCache), + int64IP: newInt64InstProvider(s, p, &viewCache), + float64IP: newFloat64InstProvider(s, p, &viewCache), } } @@ -297,7 +296,7 @@ var ( errUnregObserver = errors.New("observable instrument not registered for callback") ) -func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, a ...attribute.KeyValue) { +func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, opts ...instrument.ObserveOption) { var oImpl float64Observable switch conv := o.(type) { case float64Observable: @@ -326,10 +325,11 @@ func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, a .. ) return } - oImpl.observe(v, a) + c := instrument.NewObserveConfig(opts) + oImpl.observe(v, c.Attributes()) } -func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, a ...attribute.KeyValue) { +func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, opts ...instrument.ObserveOption) { var oImpl int64Observable switch conv := o.(type) { case int64Observable: @@ -358,7 +358,8 @@ func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, a ...attri ) return } - oImpl.observe(v, a) + c := instrument.NewObserveConfig(opts) + oImpl.observe(v, c.Attributes()) } type noopRegister struct{ embedded.Registration } @@ -367,18 +368,18 @@ func (noopRegister) Unregister() error { return nil } -// instProvider provides all OpenTelemetry instruments. -type instProvider[N int64 | float64] struct { +// int64InstProvider provides int64 OpenTelemetry instruments. +type int64InstProvider struct { scope instrumentation.Scope pipes pipelines - resolve resolver[N] + resolve resolver[int64] } -func newInstProvider[N int64 | float64](s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *instProvider[N] { - return &instProvider[N]{scope: s, pipes: p, resolve: newResolver[N](p, c)} +func newInt64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *int64InstProvider { + return &int64InstProvider{scope: s, pipes: p, resolve: newResolver[int64](p, c)} } -func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[N], error) { +func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[int64], error) { inst := Instrument{ Name: name, Description: desc, @@ -390,12 +391,40 @@ func (p *instProvider[N]) aggs(kind InstrumentKind, name, desc, u string) ([]int } // lookup returns the resolved instrumentImpl. -func (p *instProvider[N]) lookup(kind InstrumentKind, name, desc, u string) (*instrumentImpl[N], error) { +func (p *int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) - return &instrumentImpl[N]{aggregators: aggs}, err + return &int64Inst{aggregators: aggs}, err } -type int64ObservProvider struct{ *instProvider[int64] } +// float64InstProvider provides float64 OpenTelemetry instruments. +type float64InstProvider struct { + scope instrumentation.Scope + pipes pipelines + resolve resolver[float64] +} + +func newFloat64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *float64InstProvider { + return &float64InstProvider{scope: s, pipes: p, resolve: newResolver[float64](p, c)} +} + +func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[float64], error) { + inst := Instrument{ + Name: name, + Description: desc, + Unit: u, + Kind: kind, + Scope: p.scope, + } + return p.resolve.Aggregators(inst) +} + +// lookup returns the resolved instrumentImpl. +func (p *float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { + aggs, err := p.aggs(kind, name, desc, u) + return &float64Inst{aggregators: aggs}, err +} + +type int64ObservProvider struct{ *int64InstProvider } func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) @@ -423,11 +452,12 @@ type int64Observer struct { int64Observable } -func (o int64Observer) Observe(val int64, attrs ...attribute.KeyValue) { - o.observe(val, attrs) +func (o int64Observer) Observe(val int64, opts ...instrument.ObserveOption) { + c := instrument.NewObserveConfig(opts) + o.observe(val, c.Attributes()) } -type float64ObservProvider struct{ *instProvider[float64] } +type float64ObservProvider struct{ *float64InstProvider } func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (float64Observable, error) { aggs, err := p.aggs(kind, name, desc, u) @@ -455,6 +485,7 @@ type float64Observer struct { float64Observable } -func (o float64Observer) Observe(val float64, attrs ...attribute.KeyValue) { - o.observe(val, attrs) +func (o float64Observer) Observe(val float64, opts ...instrument.ObserveOption) { + c := instrument.NewObserveConfig(opts) + o.observe(val, c.Attributes()) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 53abd91e661..5276f1ae04c 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -169,7 +169,8 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { - attrs := []attribute.KeyValue{attribute.String("name", "alice")} + attrs := attribute.NewSet(attribute.String("name", "alice")) + opt := instrument.WithAttributeSet(attrs) testCases := []struct { name string fn func(*testing.T, metric.Meter) @@ -179,7 +180,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Int64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) @@ -196,7 +197,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 3}, }, }, @@ -206,7 +207,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Int64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) @@ -223,7 +224,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 11}, }, }, @@ -233,7 +234,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Int64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) @@ -248,7 +249,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 11}, }, }, @@ -258,7 +259,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Float64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) @@ -275,7 +276,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 3}, }, }, @@ -285,7 +286,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Float64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) @@ -302,7 +303,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 11}, }, }, @@ -312,7 +313,7 @@ func TestMeterCreatesInstruments(t *testing.T) { name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { cback := func(_ context.Context, o instrument.Float64Observer) error { - o.Observe(4, attrs...) + o.Observe(4, opt) return nil } gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) @@ -327,7 +328,7 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attribute.NewSet(attrs...), Value: 4}, + {Attributes: attrs, Value: 4}, {Value: 11}, }, }, @@ -885,6 +886,12 @@ func TestAttributeFilter(t *testing.T) { } func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { + fooBar := attribute.NewSet(attribute.String("foo", "bar")) + withFooBar := instrument.WithAttributeSet(fooBar) + v1 := attribute.NewSet(attribute.String("foo", "bar"), attribute.Int("version", 1)) + withV1 := instrument.WithAttributeSet(v1) + v2 := attribute.NewSet(attribute.String("foo", "bar"), attribute.Int("version", 2)) + withV2 := instrument.WithAttributeSet(v2) testcases := []struct { name string register func(t *testing.T, mtr metric.Meter) error @@ -898,9 +905,9 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar")) - o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveFloat64(ctr, 1.0, withV1) + o.ObserveFloat64(ctr, 2.0, withFooBar) + o.ObserveFloat64(ctr, 1.0, withV2) return nil }, ctr) return err @@ -909,10 +916,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Name: "afcounter", Data: metricdata.Sum[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 4.0, - }, + {Attributes: fooBar, Value: 4.0}, }, Temporality: temporality, IsMonotonic: true, @@ -927,9 +931,9 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar")) - o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveFloat64(ctr, 1.0, withV1) + o.ObserveFloat64(ctr, 2.0, withFooBar) + o.ObserveFloat64(ctr, 1.0, withV2) return nil }, ctr) return err @@ -956,8 +960,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveFloat64(ctr, 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveFloat64(ctr, 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveFloat64(ctr, 1.0, withV1) + o.ObserveFloat64(ctr, 2.0, withV2) return nil }, ctr) return err @@ -966,10 +970,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Name: "afgauge", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 2.0, - }, + {Attributes: fooBar, Value: 2.0}, }, }, }, @@ -982,9 +983,9 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveInt64(ctr, 20, attribute.String("foo", "bar")) - o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveInt64(ctr, 10, withV1) + o.ObserveInt64(ctr, 20, withFooBar) + o.ObserveInt64(ctr, 10, withV2) return nil }, ctr) return err @@ -993,10 +994,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Name: "aicounter", Data: metricdata.Sum[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 40, - }, + {Attributes: fooBar, Value: 40}, }, Temporality: temporality, IsMonotonic: true, @@ -1011,9 +1009,9 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveInt64(ctr, 20, attribute.String("foo", "bar")) - o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveInt64(ctr, 10, withV1) + o.ObserveInt64(ctr, 20, withFooBar) + o.ObserveInt64(ctr, 10, withV2) return nil }, ctr) return err @@ -1022,10 +1020,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Name: "aiupdowncounter", Data: metricdata.Sum[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 40, - }, + {Attributes: fooBar, Value: 40}, }, Temporality: temporality, IsMonotonic: false, @@ -1040,8 +1035,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } _, err = mtr.RegisterCallback(func(_ context.Context, o metric.Observer) error { - o.ObserveInt64(ctr, 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - o.ObserveInt64(ctr, 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + o.ObserveInt64(ctr, 10, withV1) + o.ObserveInt64(ctr, 20, withV2) return nil }, ctr) return err @@ -1050,10 +1045,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Name: "aigauge", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 20, - }, + {Attributes: fooBar, Value: 20}, }, }, }, @@ -1066,18 +1058,15 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Add(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Add(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Add(context.Background(), 1.0, withV1) + ctr.Add(context.Background(), 2.0, withV2) return nil }, wantMetric: metricdata.Metrics{ Name: "sfcounter", Data: metricdata.Sum[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 3.0, - }, + {Attributes: fooBar, Value: 3.0}, }, Temporality: temporality, IsMonotonic: true, @@ -1092,18 +1081,15 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Add(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Add(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Add(context.Background(), 1.0, withV1) + ctr.Add(context.Background(), 2.0, withV2) return nil }, wantMetric: metricdata.Metrics{ Name: "sfupdowncounter", Data: metricdata.Sum[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 3.0, - }, + {Attributes: fooBar, Value: 3.0}, }, Temporality: temporality, IsMonotonic: false, @@ -1118,8 +1104,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Record(context.Background(), 1.0, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Record(context.Background(), 2.0, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Record(context.Background(), 1.0, withV1) + ctr.Record(context.Background(), 2.0, withV2) return nil }, wantMetric: metricdata.Metrics{ @@ -1127,7 +1113,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Data: metricdata.Histogram[float64]{ DataPoints: []metricdata.HistogramDataPoint[float64]{ { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Attributes: fooBar, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Count: 2, @@ -1148,18 +1134,15 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Add(context.Background(), 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Add(context.Background(), 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Add(context.Background(), 10, withV1) + ctr.Add(context.Background(), 20, withV2) return nil }, wantMetric: metricdata.Metrics{ Name: "sicounter", Data: metricdata.Sum[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 30, - }, + {Attributes: fooBar, Value: 30}, }, Temporality: temporality, IsMonotonic: true, @@ -1174,18 +1157,15 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Add(context.Background(), 10, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Add(context.Background(), 20, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Add(context.Background(), 10, withV1) + ctr.Add(context.Background(), 20, withV2) return nil }, wantMetric: metricdata.Metrics{ Name: "siupdowncounter", Data: metricdata.Sum[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), - Value: 30, - }, + {Attributes: fooBar, Value: 30}, }, Temporality: temporality, IsMonotonic: false, @@ -1200,8 +1180,8 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { return err } - ctr.Record(context.Background(), 1, attribute.String("foo", "bar"), attribute.Int("version", 1)) - ctr.Record(context.Background(), 2, attribute.String("foo", "bar"), attribute.Int("version", 2)) + ctr.Record(context.Background(), 1, withV1) + ctr.Record(context.Background(), 2, withV2) return nil }, wantMetric: metricdata.Metrics{ @@ -1209,7 +1189,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { Data: metricdata.Histogram[int64]{ DataPoints: []metricdata.HistogramDataPoint[int64]{ { - Attributes: attribute.NewSet(attribute.String("foo", "bar")), + Attributes: fooBar, Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, BucketCounts: []uint64{0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Count: 2, @@ -1296,7 +1276,7 @@ func TestObservableExample(t *testing.T) { _, err := meter.Int64ObservableCounter(instName, instrument.WithInt64Callback( func(_ context.Context, o instrument.Int64Observer) error { for attrSet, val := range observations { - o.Observe(val, attrSet.ToSlice()...) + o.Observe(val, instrument.WithAttributeSet(attrSet)) } return nil }, From c5e2799a632d57c7c923ed429cc4e52b5cecaff2 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Thu, 20 Apr 2023 10:04:27 -0700 Subject: [PATCH 504/886] move jmacd to emeritus (#4024) * move jmacd to emeritus * Remove @jmacd from CODEOWNERS --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CODEOWNERS | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index c4012ed6ca1..f6f6a313b5b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -12,6 +12,6 @@ # https://help.github.com/en/articles/about-code-owners # -* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu +* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9b264d30a1..f521d65431b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -531,7 +531,6 @@ interface that defines the specific functionality should be preferred. ### Approvers - [Evan Torrie](https://github.com/evantorrie), Verizon Media -- [Josh MacDonald](https://github.com/jmacd), LightStep - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [David Ashpole](https://github.com/dashpole), Google - [Robert Pająk](https://github.com/pellared), Splunk @@ -547,6 +546,7 @@ interface that defines the specific functionality should be preferred. ### Emeritus - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep +- [Josh MacDonald](https://github.com/jmacd), LightStep ### Become an Approver or a Maintainer From 002444a2e74339e4192b15c5ebdefb423a6e9656 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 20 Apr 2023 16:14:39 -0700 Subject: [PATCH 505/886] Remove the sync inst from async example (#4019) Simplify the ExampleMeter_asynchronous_multiple example test to only include asynchronous instruments. Remove the synchronous histogram. --- metric/example_test.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/metric/example_test.go b/metric/example_test.go index 1782e79097f..b7efeebb009 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -79,10 +79,9 @@ func ExampleMeter_asynchronous_multiple() { // This is just a sample of memory stats to record from the Memstats heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") gcCount, _ := meter.Int64ObservableCounter("gcCount") - gcPause, _ := meter.Float64Histogram("gcPause") _, err := meter.RegisterCallback( - func(ctx context.Context, o metric.Observer) error { + func(_ context.Context, o metric.Observer) error { memStats := &runtime.MemStats{} // This call does work runtime.ReadMemStats(memStats) @@ -90,8 +89,6 @@ func ExampleMeter_asynchronous_multiple() { o.ObserveInt64(heapAlloc, int64(memStats.HeapAlloc)) o.ObserveInt64(gcCount, int64(memStats.NumGC)) - // This function synchronously records the pauses - computeGCPauses(ctx, gcPause, memStats.PauseNs[:]) return nil }, heapAlloc, @@ -102,6 +99,3 @@ func ExampleMeter_asynchronous_multiple() { panic(err) } } - -// This is just an example, see the the contrib runtime instrumentation for real implementation. -func computeGCPauses(ctx context.Context, recorder instrument.Float64Histogram, pauseBuff []uint64) {} From 4986b7ed55a3abe7f9cfe7195ebe658c09fdd83d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 23 Apr 2023 07:44:55 -0700 Subject: [PATCH 506/886] Bump codecov/codecov-action from 3.1.1 to 3.1.3 (#4029) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.1 to 3.1.3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.1...v3.1.3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48c9ab70ad6..be31d85a724 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v3.1.1 + uses: codecov/codecov-action@v3.1.3 with: file: ./coverage.txt fail_ci_if_error: true From 6acade86c511cfd72d2cbbe8d4e5f9f600548f0a Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 23 Apr 2023 07:59:24 -0700 Subject: [PATCH 507/886] [chore] dependabot updates Sun Apr 23 14:49:00 UTC 2023 (#4031) * Bump lycheeverse/lychee-action from 1.6.1 to 1.7.0 Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.6.1 to 1.7.0. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.6.1...v1.7.0) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * dependabot updates Sun Apr 23 14:48:59 UTC 2023 Bump github.com/cenkalti/backoff/v4 from 4.2.0 to 4.2.1 in /exporters/otlp/internal/retry Bump lycheeverse/lychee-action from 1.6.1 to 1.7.0 --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 9b4f3f84c3a..5290542bbaa 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.6.1 + uses: lycheeverse/lychee-action@v1.7.0 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 21707a9aa35..8e1b659c264 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.6.1 + uses: lycheeverse/lychee-action@v1.7.0 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7a3181b056c..3518da6e2b1 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 49eea4d4fa7..da716af61c7 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index c456132d467..81ea419df85 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/internal/retry go 1.19 require ( - github.com/cenkalti/backoff/v4 v4.2.0 + github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.2 ) diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index b664adcb8c2..3ad47a69a73 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -1,5 +1,5 @@ -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 75cf6da148d..1c4717e5a2d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -15,7 +15,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 1be0edf3865..87df091445b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f71387792b2..803752437b8 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -18,7 +18,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 1be0edf3865..87df091445b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index a922875963c..9fbc9f381fe 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 1be0edf3865..87df091445b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f276c7f4703..e2161ccba84 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -15,7 +15,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 1be0edf3865..87df091445b 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 28fd5bbdbd2..0e76a374d9e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index cb72a176b95..205b17d7322 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 34bde609e9f..21971b35253 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -14,7 +14,7 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 334e1ddccb5..03c28285eeb 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -35,8 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= From 86f325839ca329997672fbae8b054e7b6181b4d2 Mon Sep 17 00:00:00 2001 From: Kaushal Shah Date: Tue, 25 Apr 2023 22:41:03 +0530 Subject: [PATCH 508/886] Added methods for SpanID and TraceID on bridgeSpanContext (#3966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added methods for SpanID and TraceID on bridgeSpanContext * changed test name * Added entry in changelog, updated readme, added comments on methods and fixed test case * updated CHANGELOG.md * promoted all methods from SpanContext to bridgeSpanContext * fixed readme and removed redudant IsSampled() from bridgeContext * fixed readme lint * Apply suggestions from code review Co-authored-by: Robert Pająk * addressed code review comment --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + bridge/opentracing/README.md | 17 ++++++++----- bridge/opentracing/bridge.go | 26 +++++++++----------- bridge/opentracing/bridge_test.go | 40 +++++++++++++++++++++++++++---- 4 files changed, 58 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ddf1ebc4b8..45e9fbda617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916) - Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941) - `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider` +- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966) - Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974) - The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971) - The `Int64Counter.Add` method now accepts `...AddOption` diff --git a/bridge/opentracing/README.md b/bridge/opentracing/README.md index d6af6b1fbcf..f1ee6846b12 100644 --- a/bridge/opentracing/README.md +++ b/bridge/opentracing/README.md @@ -43,17 +43,22 @@ When you have started an OpenTracing Span, make sure the OpenTelemetry knows abo The bridge functionality can be extended beyond the OpenTracing API. -### `SpanContext.IsSampled` - -Return the underlying OpenTelemetry [`Span.IsSampled`](https://pkg.go.dev/go.opentelemetry.io/otel/trace#SpanContext.IsSampled) value by converting a `bridgeSpanContext`. +Any [`trace.SpanContext`](https://pkg.go.dev/go.opentelemetry.io/otel/trace#SpanContext) method can be accessed as following: ```go -type samplable interface { +type spanContextProvider interface { IsSampled() bool + TraceID() trace.TraceID + SpanID() trace.SpanID + TraceFlags() trace.TraceFlags + ... // any other available method can be added here to access it } var sc opentracing.SpanContext = ... -if s, ok := sc.(samplable); ok && s.IsSampled() { - // Do something with sc knowing it is sampled. +if s, ok := sc.(spanContextProvider); ok { + // Use TraceID by s.TraceID() + // Use SpanID by s.SpanID() + // Use TraceFlags by s.TraceFlags() + ... } ``` diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 867a2a8c387..50ff21a191a 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -44,16 +44,16 @@ var ( ) type bridgeSpanContext struct { - bag baggage.Baggage - otelSpanContext trace.SpanContext + bag baggage.Baggage + trace.SpanContext } var _ ot.SpanContext = &bridgeSpanContext{} func newBridgeSpanContext(otelSpanContext trace.SpanContext, parentOtSpanContext ot.SpanContext) *bridgeSpanContext { bCtx := &bridgeSpanContext{ - bag: baggage.Baggage{}, - otelSpanContext: otelSpanContext, + bag: baggage.Baggage{}, + SpanContext: otelSpanContext, } if parentOtSpanContext != nil { parentOtSpanContext.ForeachBaggageItem(func(key, value string) bool { @@ -72,10 +72,6 @@ func (c *bridgeSpanContext) ForeachBaggageItem(handler func(k, v string) bool) { } } -func (c *bridgeSpanContext) IsSampled() bool { - return c.otelSpanContext.IsSampled() -} - func (c *bridgeSpanContext) setBaggageItem(restrictedKey, value string) { crk := http.CanonicalHeaderKey(restrictedKey) m, err := baggage.NewMember(crk, value) @@ -429,7 +425,7 @@ func (t *BridgeTracer) StartSpan(operationName string, opts ...ot.StartSpanOptio attributes, kind, hadTrueErrorTag := otTagsToOTelAttributesKindAndError(sso.Tags) checkCtx := migration.WithDeferredSetup(context.Background()) if parentBridgeSC != nil { - checkCtx = trace.ContextWithRemoteSpanContext(checkCtx, parentBridgeSC.otelSpanContext) + checkCtx = trace.ContextWithRemoteSpanContext(checkCtx, parentBridgeSC.SpanContext) } checkCtx2, otelSpan := t.setTracer.tracer().Start( checkCtx, @@ -610,7 +606,7 @@ func otSpanReferencesToParentAndLinks(references []ot.SpanReference) (*bridgeSpa func otSpanReferenceToOTelLink(bridgeSC *bridgeSpanContext, refType ot.SpanReferenceType) trace.Link { return trace.Link{ - SpanContext: bridgeSC.otelSpanContext, + SpanContext: bridgeSC.SpanContext, Attributes: otSpanReferenceTypeToOTelLinkAttributes(refType), } } @@ -655,7 +651,7 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int if !ok { return ot.ErrInvalidSpanContext } - if !bridgeSC.otelSpanContext.IsValid() { + if !bridgeSC.IsValid() { return ot.ErrInvalidSpanContext } @@ -687,7 +683,7 @@ func (t *BridgeTracer) Inject(sm ot.SpanContext, format interface{}, carrier int fs := fakeSpan{ Span: noopSpan, - sc: bridgeSC.otelSpanContext, + sc: bridgeSC.SpanContext, } ctx := trace.ContextWithSpan(context.Background(), fs) ctx = baggage.ContextWithBaggage(ctx, bridgeSC.bag) @@ -729,10 +725,10 @@ func (t *BridgeTracer) Extract(format interface{}, carrier interface{}) (ot.Span ctx := t.getPropagator().Extract(context.Background(), textCarrier) bag := baggage.FromContext(ctx) bridgeSC := &bridgeSpanContext{ - bag: bag, - otelSpanContext: trace.SpanContextFromContext(ctx), + bag: bag, + SpanContext: trace.SpanContextFromContext(ctx), } - if !bridgeSC.otelSpanContext.IsValid() { + if !bridgeSC.IsValid() { return nil, ot.ErrSpanContextNotFound } return bridgeSC, nil diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 20c21a87565..47d26916a53 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -366,12 +366,12 @@ func TestBridgeTracer_ExtractAndInject(t *testing.T) { bsc, ok := spanContext.(*bridgeSpanContext) assert.True(t, ok) require.NotNil(t, bsc) - require.NotNil(t, bsc.otelSpanContext) - require.NotNil(t, bsc.otelSpanContext.SpanID()) - require.NotNil(t, bsc.otelSpanContext.TraceID()) + require.NotNil(t, bsc.SpanContext) + require.NotNil(t, bsc.SpanID()) + require.NotNil(t, bsc.TraceID()) - assert.Equal(t, spanID.String(), bsc.otelSpanContext.SpanID().String()) - assert.Equal(t, traceID.String(), bsc.otelSpanContext.TraceID().String()) + assert.Equal(t, spanID.String(), bsc.SpanID().String()) + assert.Equal(t, traceID.String(), bsc.TraceID().String()) } } }) @@ -546,3 +546,33 @@ func TestBridge_SpanContext_IsSampled(t *testing.T) { }) } } + +func TestBridgeSpanContextPromotedMethods(t *testing.T) { + bridge := NewBridgeTracer() + bridge.SetTextMapPropagator(new(testTextMapPropagator)) + + tmc := newTextCarrier() + + type spanContextProvider interface { + HasTraceID() bool + TraceID() trace.TraceID + HasSpanID() bool + SpanID() trace.SpanID + } + + err := bridge.Inject(newBridgeSpanContext(trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: [16]byte{byte(1)}, + SpanID: [8]byte{byte(2)}, + }), nil), ot.TextMap, tmc) + assert.NoError(t, err) + + spanContext, err := bridge.Extract(ot.TextMap, tmc) + assert.NoError(t, err) + + assert.NotPanics(t, func() { + assert.Equal(t, spanID.String(), spanContext.(spanContextProvider).SpanID().String()) + assert.Equal(t, traceID.String(), spanContext.(spanContextProvider).TraceID().String()) + assert.True(t, spanContext.(spanContextProvider).HasSpanID()) + assert.True(t, spanContext.(spanContextProvider).HasTraceID()) + }) +} From 94f6c4fc00562fd6779e5807ed95aabcc1ee1858 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Apr 2023 11:15:50 -0700 Subject: [PATCH 509/886] Fix broken link (#4034) --- exporters/jaeger/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/jaeger/README.md b/exporters/jaeger/README.md index 598c569a519..9b9d370dd3a 100644 --- a/exporters/jaeger/README.md +++ b/exporters/jaeger/README.md @@ -47,4 +47,4 @@ When re-generating Thrift code in the future, please adapt import paths as neces - [Jaeger](https://www.jaegertracing.io/) - [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md) -- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md) +- [OpenTelemetry Environment Variable Specification](https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/#general-sdk-configuration) From 15d6ba29216246e336a675eff20819afe49fd0e1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Apr 2023 11:25:48 -0700 Subject: [PATCH 510/886] Unify metric API into the one `otel/metric` package (#4018) * Move instrument into metric * Update metric docs to include instrument * Update package names * Update all imports of sdk/metric/instrument * Rename Option to InstrumentOption * Deprecate otel/metric/instrument * Add changelog entry --- CHANGELOG.md | 5 + example/prometheus/main.go | 9 +- example/view/main.go | 8 +- exporters/prometheus/exporter_test.go | 171 ++++--- metric/{instrument => }/asyncfloat64.go | 2 +- metric/{instrument => }/asyncfloat64_test.go | 2 +- metric/{instrument => }/asyncint64.go | 2 +- metric/{instrument => }/asyncint64_test.go | 2 +- metric/doc.go | 45 +- metric/embedded/embedded.go | 84 ++-- metric/example_test.go | 9 +- metric/{instrument => }/instrument.go | 10 +- metric/instrument/deprecation.go | 452 ++++++++++++++++++ metric/instrument/doc.go | 59 --- metric/{instrument => }/instrument_test.go | 2 +- metric/internal/global/instruments.go | 135 +++--- metric/internal/global/instruments_test.go | 13 +- metric/internal/global/meter.go | 35 +- metric/internal/global/meter_test.go | 3 +- metric/internal/global/meter_types_test.go | 31 +- metric/meter.go | 31 +- metric/noop/noop.go | 95 ++-- metric/noop/noop_test.go | 29 +- metric/{instrument => }/syncfloat64.go | 2 +- metric/{instrument => }/syncfloat64_test.go | 2 +- metric/{instrument => }/syncint64.go | 2 +- metric/{instrument => }/syncint64_test.go | 2 +- sdk/metric/benchmark_test.go | 61 ++- sdk/metric/instrument.go | 48 +- .../internal/aggregator_example_test.go | 12 +- sdk/metric/meter.go | 81 ++-- sdk/metric/meter_test.go | 69 ++- 32 files changed, 968 insertions(+), 545 deletions(-) rename metric/{instrument => }/asyncfloat64.go (99%) rename metric/{instrument => }/asyncfloat64_test.go (96%) rename metric/{instrument => }/asyncint64.go (99%) rename metric/{instrument => }/asyncint64_test.go (96%) rename metric/{instrument => }/instrument.go (96%) create mode 100644 metric/instrument/deprecation.go delete mode 100644 metric/instrument/doc.go rename metric/{instrument => }/instrument_test.go (98%) rename metric/{instrument => }/syncfloat64.go (98%) rename metric/{instrument => }/syncfloat64_test.go (94%) rename metric/{instrument => }/syncint64.go (98%) rename metric/{instrument => }/syncint64_test.go (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45e9fbda617..866c005274b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951) - Automatically figure out the default aggregation with `aggregation.Default`. (#3967) +### Deprecated + +- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated. + Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018) + ## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23 This is a release candidate for the v1.15.0/v0.38.0 release. diff --git a/example/prometheus/main.go b/example/prometheus/main.go index c716aa1e447..3c7e4db7976 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" api "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric" ) @@ -50,19 +49,19 @@ func main() { // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() - opt := instrument.WithAttributes( + opt := api.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) // This is the equivalent of prometheus.NewCounterVec - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", api.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } counter.Add(ctx, 5, opt) - gauge, err := meter.Float64ObservableGauge("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.Float64ObservableGauge("bar", api.WithDescription("a fun little gauge")) if err != nil { log.Fatal(err) } @@ -76,7 +75,7 @@ func main() { } // This is the equivalent of prometheus.NewHistogramVec - histogram, err := meter.Float64Histogram("baz", instrument.WithDescription("a very nice histogram")) + histogram, err := meter.Float64Histogram("baz", api.WithDescription("a very nice histogram")) if err != nil { log.Fatal(err) } diff --git a/example/view/main.go b/example/view/main.go index 1fc6d9cd636..0e0175aa5ee 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" otelprom "go.opentelemetry.io/otel/exporters/prometheus" - "go.opentelemetry.io/otel/metric/instrument" + api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -64,18 +64,18 @@ func main() { // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() - opt := instrument.WithAttributes( + opt := api.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", api.WithDescription("a simple counter")) if err != nil { log.Fatal(err) } counter.Add(ctx, 5, opt) - histogram, err := meter.Float64Histogram("custom_histogram", instrument.WithDescription("a histogram with custom buckets and rename")) + histogram, err := meter.Float64Histogram("custom_histogram", api.WithDescription("a histogram with custom buckets and rename")) if err != nil { log.Fatal(err) } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 868e575319b..db438de9d40 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" @@ -46,7 +45,7 @@ func TestPrometheusExporter(t *testing.T) { name: "counter", expectedFile: "testdata/counter.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), @@ -54,8 +53,8 @@ func TestPrometheusExporter(t *testing.T) { ) counter, err := meter.Float64Counter( "foo", - instrument.WithDescription("a simple counter"), - instrument.WithUnit("ms"), + otelmetric.WithDescription("a simple counter"), + otelmetric.WithUnit("ms"), ) require.NoError(t, err) counter.Add(ctx, 5, opt) @@ -68,21 +67,21 @@ func TestPrometheusExporter(t *testing.T) { attribute.Key("E").Bool(true), attribute.Key("F").Int(42), ) - counter.Add(ctx, 5, instrument.WithAttributeSet(attrs2)) + counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) }, }, { name: "gauge", expectedFile: "testdata/gauge.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) gauge, err := meter.Float64UpDownCounter( "bar", - instrument.WithDescription("a fun little gauge"), - instrument.WithUnit("1"), + otelmetric.WithDescription("a fun little gauge"), + otelmetric.WithUnit("1"), ) require.NoError(t, err) gauge.Add(ctx, 1.0, opt) @@ -93,14 +92,14 @@ func TestPrometheusExporter(t *testing.T) { name: "histogram", expectedFile: "testdata/histogram.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) histogram, err := meter.Float64Histogram( "histogram_baz", - instrument.WithDescription("a very nice histogram"), - instrument.WithUnit("By"), + otelmetric.WithDescription("a very nice histogram"), + otelmetric.WithUnit("By"), ) require.NoError(t, err) histogram.Record(ctx, 23, opt) @@ -114,7 +113,7 @@ func TestPrometheusExporter(t *testing.T) { expectedFile: "testdata/sanitized_labels.txt", options: []Option{WithoutUnits()}, recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( // exact match, value should be overwritten attribute.Key("A.B").String("X"), attribute.Key("A.B").String("Q"), @@ -125,9 +124,9 @@ func TestPrometheusExporter(t *testing.T) { ) counter, err := meter.Float64Counter( "foo", - instrument.WithDescription("a sanitary counter"), + otelmetric.WithDescription("a sanitary counter"), // This unit is not added to - instrument.WithUnit("By"), + otelmetric.WithUnit("By"), ) require.NoError(t, err) counter.Add(ctx, 5, opt) @@ -139,26 +138,26 @@ func TestPrometheusExporter(t *testing.T) { name: "invalid instruments are renamed", expectedFile: "testdata/sanitized_names.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) // Valid. - gauge, err := meter.Float64UpDownCounter("bar", instrument.WithDescription("a fun little gauge")) + gauge, err := meter.Float64UpDownCounter("bar", otelmetric.WithDescription("a fun little gauge")) require.NoError(t, err) gauge.Add(ctx, 100, opt) gauge.Add(ctx, -25, opt) // Invalid, will be renamed. - gauge, err = meter.Float64UpDownCounter("invalid.gauge.name", instrument.WithDescription("a gauge with an invalid name")) + gauge, err = meter.Float64UpDownCounter("invalid.gauge.name", otelmetric.WithDescription("a gauge with an invalid name")) require.NoError(t, err) gauge.Add(ctx, 100, opt) - counter, err := meter.Float64Counter("0invalid.counter.name", instrument.WithDescription("a counter with an invalid name")) + counter, err := meter.Float64Counter("0invalid.counter.name", otelmetric.WithDescription("a counter with an invalid name")) require.NoError(t, err) counter.Add(ctx, 100, opt) - histogram, err := meter.Float64Histogram("invalid.hist.name", instrument.WithDescription("a histogram with an invalid name")) + histogram, err := meter.Float64Histogram("invalid.hist.name", otelmetric.WithDescription("a histogram with an invalid name")) require.NoError(t, err) histogram.Record(ctx, 23, opt) }, @@ -168,13 +167,13 @@ func TestPrometheusExporter(t *testing.T) { emptyResource: true, expectedFile: "testdata/empty_resource.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), ) - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, opt) counter.Add(ctx, 10.3, opt) @@ -189,13 +188,13 @@ func TestPrometheusExporter(t *testing.T) { }, expectedFile: "testdata/custom_resource.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), ) - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, opt) counter.Add(ctx, 10.3, opt) @@ -207,13 +206,13 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutTargetInfo()}, expectedFile: "testdata/without_target_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), ) - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, opt) counter.Add(ctx, 10.3, opt) @@ -225,14 +224,14 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutScopeInfo()}, expectedFile: "testdata/without_scope_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) gauge, err := meter.Int64UpDownCounter( "bar", - instrument.WithDescription("a fun little gauge"), - instrument.WithUnit("1"), + otelmetric.WithDescription("a fun little gauge"), + otelmetric.WithUnit("1"), ) require.NoError(t, err) gauge.Add(ctx, 2, opt) @@ -244,14 +243,14 @@ func TestPrometheusExporter(t *testing.T) { options: []Option{WithoutScopeInfo(), WithoutTargetInfo()}, expectedFile: "testdata/without_scope_and_target_info.txt", recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), ) counter, err := meter.Int64Counter( "bar", - instrument.WithDescription("a fun little counter"), - instrument.WithUnit("By"), + otelmetric.WithDescription("a fun little counter"), + otelmetric.WithUnit("By"), ) require.NoError(t, err) counter.Add(ctx, 2, opt) @@ -265,13 +264,13 @@ func TestPrometheusExporter(t *testing.T) { WithNamespace("test"), }, recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { - opt := instrument.WithAttributes( + opt := otelmetric.WithAttributes( attribute.Key("A").String("B"), attribute.Key("C").String("D"), attribute.Key("E").Bool(true), attribute.Key("F").Int(42), ) - counter, err := meter.Float64Counter("foo", instrument.WithDescription("a simple counter")) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) require.NoError(t, err) counter.Add(ctx, 5, opt) counter.Add(ctx, 10.3, opt) @@ -385,18 +384,18 @@ func TestMultiScopes(t *testing.T) { fooCounter, err := provider.Meter("meterfoo", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "foo", - instrument.WithUnit("ms"), - instrument.WithDescription("meter foo counter")) + otelmetric.WithUnit("ms"), + otelmetric.WithDescription("meter foo counter")) assert.NoError(t, err) - fooCounter.Add(ctx, 100, instrument.WithAttributes(attribute.String("type", "foo"))) + fooCounter.Add(ctx, 100, otelmetric.WithAttributes(attribute.String("type", "foo"))) barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "bar", - instrument.WithUnit("ms"), - instrument.WithDescription("meter bar counter")) + otelmetric.WithUnit("ms"), + otelmetric.WithDescription("meter bar counter")) assert.NoError(t, err) - barCounter.Add(ctx, 200, instrument.WithAttributes(attribute.String("type", "bar"))) + barCounter.Add(ctx, 200, otelmetric.WithAttributes(attribute.String("type", "bar"))) file, err := os.Open("testdata/multi_scopes.txt") require.NoError(t, err) @@ -408,11 +407,11 @@ func TestMultiScopes(t *testing.T) { func TestDuplicateMetrics(t *testing.T) { ab := attribute.NewSet(attribute.String("A", "B")) - withAB := instrument.WithAttributeSet(ab) + withAB := otelmetric.WithAttributeSet(ab) typeBar := attribute.NewSet(attribute.String("type", "bar")) - withTypeBar := instrument.WithAttributeSet(typeBar) + withTypeBar := otelmetric.WithAttributeSet(typeBar) typeFoo := attribute.NewSet(attribute.String("type", "foo")) - withTypeFoo := instrument.WithAttributeSet(typeFoo) + withTypeFoo := otelmetric.WithAttributeSet(typeFoo) testCases := []struct { name string customResouceAttrs []attribute.KeyValue @@ -424,14 +423,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64Counter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter counter foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter counter foo")) assert.NoError(t, err) fooA.Add(ctx, 100, withAB) fooB, err := meterB.Int64Counter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter counter foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter counter foo")) assert.NoError(t, err) fooB.Add(ctx, 100, withAB) }, @@ -441,14 +440,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64UpDownCounter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter gauge foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, withAB) fooB, err := meterB.Int64UpDownCounter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter gauge foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter gauge foo")) assert.NoError(t, err) fooB.Add(ctx, 100, withAB) }, @@ -458,14 +457,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "no_conflict_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64Histogram("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter histogram foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter histogram foo")) assert.NoError(t, err) fooA.Record(ctx, 100, withAB) fooB, err := meterB.Int64Histogram("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter histogram foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter histogram foo")) assert.NoError(t, err) fooB.Record(ctx, 100, withAB) }, @@ -475,14 +474,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Counter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter a bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64Counter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter b bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter b bar")) assert.NoError(t, err) barB.Add(ctx, 100, withTypeBar) }, @@ -495,14 +494,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64UpDownCounter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter a bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter a bar")) assert.NoError(t, err) barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64UpDownCounter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter b bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter b bar")) assert.NoError(t, err) barB.Add(ctx, 100, withTypeBar) }, @@ -515,14 +514,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_help_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Histogram("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter a bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter a bar")) assert.NoError(t, err) barA.Record(ctx, 100, withAB) barB, err := meterB.Int64Histogram("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter b bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter b bar")) assert.NoError(t, err) barB.Record(ctx, 100, withAB) }, @@ -535,14 +534,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_counters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { bazA, err := meterA.Int64Counter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter bar")) assert.NoError(t, err) bazA.Add(ctx, 100, withTypeBar) bazB, err := meterB.Int64Counter("bar", - instrument.WithUnit("ms"), - instrument.WithDescription("meter bar")) + otelmetric.WithUnit("ms"), + otelmetric.WithDescription("meter bar")) assert.NoError(t, err) bazB.Add(ctx, 100, withTypeBar) }, @@ -553,14 +552,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_updowncounters", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64UpDownCounter("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter gauge bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter gauge bar")) assert.NoError(t, err) barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64UpDownCounter("bar", - instrument.WithUnit("ms"), - instrument.WithDescription("meter gauge bar")) + otelmetric.WithUnit("ms"), + otelmetric.WithDescription("meter gauge bar")) assert.NoError(t, err) barB.Add(ctx, 100, withTypeBar) }, @@ -571,14 +570,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_unit_two_histograms", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { barA, err := meterA.Int64Histogram("bar", - instrument.WithUnit("By"), - instrument.WithDescription("meter histogram bar")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter histogram bar")) assert.NoError(t, err) barA.Record(ctx, 100, withAB) barB, err := meterB.Int64Histogram("bar", - instrument.WithUnit("ms"), - instrument.WithDescription("meter histogram bar")) + otelmetric.WithUnit("ms"), + otelmetric.WithDescription("meter histogram bar")) assert.NoError(t, err) barB.Record(ctx, 100, withAB) }, @@ -589,14 +588,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_type_counter_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { counter, err := meterA.Int64Counter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter foo")) assert.NoError(t, err) counter.Add(ctx, 100, withTypeFoo) gauge, err := meterA.Int64UpDownCounter("foo_total", - instrument.WithUnit("By"), - instrument.WithDescription("meter foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter foo")) assert.NoError(t, err) gauge.Add(ctx, 200, withTypeFoo) }, @@ -610,14 +609,14 @@ func TestDuplicateMetrics(t *testing.T) { name: "conflict_type_histogram_and_updowncounter", recordMetrics: func(ctx context.Context, meterA, meterB otelmetric.Meter) { fooA, err := meterA.Int64UpDownCounter("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter gauge foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter gauge foo")) assert.NoError(t, err) fooA.Add(ctx, 100, withAB) fooHistogramA, err := meterA.Int64Histogram("foo", - instrument.WithUnit("By"), - instrument.WithDescription("meter histogram foo")) + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter histogram foo")) assert.NoError(t, err) fooHistogramA.Record(ctx, 100, withAB) }, diff --git a/metric/instrument/asyncfloat64.go b/metric/asyncfloat64.go similarity index 99% rename from metric/instrument/asyncfloat64.go rename to metric/asyncfloat64.go index 5aaac43a7aa..e2ffb673859 100644 --- a/metric/instrument/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/instrument/asyncfloat64_test.go b/metric/asyncfloat64_test.go similarity index 96% rename from metric/instrument/asyncfloat64_test.go rename to metric/asyncfloat64_test.go index 73be71d1dc9..845d63d3e8e 100644 --- a/metric/instrument/asyncfloat64_test.go +++ b/metric/asyncfloat64_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/instrument/asyncint64.go b/metric/asyncint64.go similarity index 99% rename from metric/instrument/asyncint64.go rename to metric/asyncint64.go index e9027b4b480..a56b3d7a65c 100644 --- a/metric/instrument/asyncint64.go +++ b/metric/asyncint64.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/instrument/asyncint64_test.go b/metric/asyncint64_test.go similarity index 96% rename from metric/instrument/asyncint64_test.go rename to metric/asyncint64_test.go index 2b7bc91c003..5b1bdb75124 100644 --- a/metric/instrument/asyncint64_test.go +++ b/metric/asyncint64_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/doc.go b/metric/doc.go index b24a9efdc88..bda14e10aa6 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -26,9 +26,47 @@ instruments are created by a [Meter] which itself is created by a as a starting point when instrumenting. This can be done directly, or by using the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an appropriately named [Meter] from the accepted [MeterProvider], instrumentation -can then be built from the [Meter]'s instruments. See -[go.opentelemetry.io/otel/metric/instrument] for documentation on each -instrument and its intended use. +can then be built from the [Meter]'s instruments. + +# Instruments + +Each instrument is designed to make measurements of a particular type. Broadly, +all instruments fall into two overlapping logical categories: asynchronous or +synchronous, and int64 or float64. + +All synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], [Float64Histogram]) +are used to measure the operation and performance of source code during the +source code execution. These instruments only make measurements when the source +code they instrument is run. + +All asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], +[Float64ObservableGauge]) are used to measure metrics outside of the execution +of source code. They are said to make "observations" via a callback function +called once every measurement collection cycle. + +Each instrument is also grouped by the value type it measures. Either int64 or +float64. The value being measured will dictate which instrument in these +categories to use. + +Outside of these two broad categories, instruments are described by the +function they are designed to serve. All Counters ([Int64Counter], +[Float64Counter], [Int64ObservableCounter], [Float64ObservableCounter]) are +designed to measure values that never decrease in value, but instead only +incrementally increase in value. UpDownCounters ([Int64UpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], +[Float64ObservableUpDownCounter]) on the other hand, are designed to measure +values that can increase and decrease. When more information +needs to be conveyed about all the synchronous measurements made during a +collection cycle, a Histogram ([Int64Histogram], [Float64Histogram]) should be +used. Finally, when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge], +[Float64ObservableGauge]) should be used. + +See the [OpenTelemetry documentation] for more information about instruments +and their intended use. # API Implementations @@ -93,6 +131,7 @@ It is strongly recommended that authors only embed That implementation is the only one OpenTelemetry authors can guarantee will fully implement all the API interfaces when a user updates their API. +[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ [GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider */ package metric // import "go.opentelemetry.io/otel/metric" diff --git a/metric/embedded/embedded.go b/metric/embedded/embedded.go index 641cd29dfb8..ae0bdbd2e64 100644 --- a/metric/embedded/embedded.go +++ b/metric/embedded/embedded.go @@ -46,25 +46,25 @@ type MeterProvider interface{ meterProvider() } type Meter interface{ meter() } // Float64Observer is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64Observer]. +// [go.opentelemetry.io/otel/metric.Float64Observer]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64Observer] if you want +// [go.opentelemetry.io/otel/metric.Float64Observer] if you want // users to experience a compilation error, signaling they need to update to // your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64Observer] interface is +// [go.opentelemetry.io/otel/metric.Float64Observer] interface is // extended (which is something that can happen without a major version bump of // the API package). type Float64Observer interface{ float64Observer() } // Int64Observer is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64Observer]. +// [go.opentelemetry.io/otel/metric.Int64Observer]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64Observer] if you want users +// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users // to experience a compilation error, signaling they need to update to your // latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64Observer] interface is +// [go.opentelemetry.io/otel/metric.Int64Observer] interface is // extended (which is something that can happen without a major version bump of // the API package). type Int64Observer interface{ int64Observer() } @@ -90,145 +90,145 @@ type Observer interface{ observer() } type Registration interface{ registration() } // Float64Counter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64Counter]. +// [go.opentelemetry.io/otel/metric.Float64Counter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64Counter] if you want +// [go.opentelemetry.io/otel/metric.Float64Counter] if you want // users to experience a compilation error, signaling they need to update to // your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64Counter] interface is +// [go.opentelemetry.io/otel/metric.Float64Counter] interface is // extended (which is something that can happen without a major version bump of // the API package). type Float64Counter interface{ float64Counter() } // Float64Histogram is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram]. +// [go.opentelemetry.io/otel/metric.Float64Histogram]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram] if you want +// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want // users to experience a compilation error, signaling they need to update to // your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64Histogram] interface is +// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is // extended (which is something that can happen without a major version bump of // the API package). type Float64Histogram interface{ float64Histogram() } // Float64ObservableCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter]. +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter] if you +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you // want users to experience a compilation error, signaling they need to update // to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableCounter] +// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). type Float64ObservableCounter interface{ float64ObservableCounter() } // Float64ObservableGauge is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge]. +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge] if you +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you // want users to experience a compilation error, signaling they need to update // to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableGauge] +// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] // interface is extended (which is something that can happen without a major // version bump of the API package). type Float64ObservableGauge interface{ float64ObservableGauge() } // Float64ObservableUpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter]. +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter] +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] // if you want users to experience a compilation error, signaling they need to // update to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64ObservableUpDownCounter] +// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() } // Float64UpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter]. +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter] if you +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you // want users to experience a compilation error, signaling they need to update // to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Float64UpDownCounter] interface +// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface // is extended (which is something that can happen without a major version bump // of the API package). type Float64UpDownCounter interface{ float64UpDownCounter() } // Int64Counter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64Counter]. +// [go.opentelemetry.io/otel/metric.Int64Counter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64Counter] if you want users +// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users // to experience a compilation error, signaling they need to update to your // latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64Counter] interface is +// [go.opentelemetry.io/otel/metric.Int64Counter] interface is // extended (which is something that can happen without a major version bump of // the API package). type Int64Counter interface{ int64Counter() } // Int64Histogram is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram]. +// [go.opentelemetry.io/otel/metric.Int64Histogram]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram] if you want +// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want // users to experience a compilation error, signaling they need to update to // your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64Histogram] interface is +// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is // extended (which is something that can happen without a major version bump of // the API package). type Int64Histogram interface{ int64Histogram() } // Int64ObservableCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter]. +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter] if you +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you // want users to experience a compilation error, signaling they need to update // to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableCounter] +// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). type Int64ObservableCounter interface{ int64ObservableCounter() } // Int64ObservableGauge is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge]. +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge] if you +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you // want users to experience a compilation error, signaling they need to update // to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableGauge] interface +// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface // is extended (which is something that can happen without a major version bump // of the API package). type Int64ObservableGauge interface{ int64ObservableGauge() } // Int64ObservableUpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter]. +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter] if +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if // you want users to experience a compilation error, signaling they need to // update to your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64ObservableUpDownCounter] +// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] // interface is extended (which is something that can happen without a major // version bump of the API package). type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() } // Int64UpDownCounter is embedded in -// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter]. +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter]. // // Embed this interface in your implementation of the -// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter] if you want +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want // users to experience a compilation error, signaling they need to update to // your latest implementation, when the -// [go.opentelemetry.io/otel/metric/instrument.Int64UpDownCounter] interface is +// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is // extended (which is something that can happen without a major version bump of // the API package). type Int64UpDownCounter interface{ int64UpDownCounter() } diff --git a/metric/example_test.go b/metric/example_test.go index b7efeebb009..13cd22d48d8 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -23,14 +23,13 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" ) func ExampleMeter_synchronous() { // Create a histogram using the global MeterProvider. workDuration, err := global.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", - instrument.WithUnit("ms")) + metric.WithUnit("ms")) if err != nil { fmt.Println("Failed to register instrument") panic(err) @@ -48,8 +47,8 @@ func ExampleMeter_asynchronous_single() { _, err := meter.Int64ObservableGauge( "DiskUsage", - instrument.WithUnit("By"), - instrument.WithInt64Callback(func(_ context.Context, obsrv instrument.Int64Observer) error { + metric.WithUnit("By"), + metric.WithInt64Callback(func(_ context.Context, obsrv metric.Int64Observer) error { // Do the real work here to get the real disk usage. For example, // // usage, err := GetDiskUsage(diskID) @@ -63,7 +62,7 @@ func ExampleMeter_asynchronous_single() { // // For demonstration purpose, a static value is used here. usage := 75000 - obsrv.Observe(int64(usage), instrument.WithAttributes(attribute.Int("disk.id", 3))) + obsrv.Observe(int64(usage), metric.WithAttributes(attribute.Int("disk.id", 3))) return nil }), ) diff --git a/metric/instrument/instrument.go b/metric/instrument.go similarity index 96% rename from metric/instrument/instrument.go rename to metric/instrument.go index cb0373c16e5..268b2f15595 100644 --- a/metric/instrument/instrument.go +++ b/metric/instrument.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import "go.opentelemetry.io/otel/attribute" @@ -22,8 +22,8 @@ type Observable interface { observable() } -// Option applies options to all instruments. -type Option interface { +// InstrumentOption applies options to all instruments. +type InstrumentOption interface { Int64CounterOption Int64UpDownCounterOption Int64HistogramOption @@ -102,7 +102,7 @@ func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob } // WithDescription sets the instrument description. -func WithDescription(desc string) Option { return descOpt(desc) } +func WithDescription(desc string) InstrumentOption { return descOpt(desc) } type unitOpt string @@ -167,7 +167,7 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob } // WithUnit sets the instrument unit. -func WithUnit(u string) Option { return unitOpt(u) } +func WithUnit(u string) InstrumentOption { return unitOpt(u) } // AddOption applies options to an addition measurement. See // [MeasurementOption] for other options that can be used as a AddOption. diff --git a/metric/instrument/deprecation.go b/metric/instrument/deprecation.go new file mode 100644 index 00000000000..a2e4b31e16a --- /dev/null +++ b/metric/instrument/deprecation.go @@ -0,0 +1,452 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package instrument provides the OpenTelemetry API instruments used to make +// measurements. +// +// Deprecated: Use go.opentelemetry.io/otel/metric instead. +package instrument // import "go.opentelemetry.io/otel/metric/instrument" + +import ( + "go.opentelemetry.io/otel/metric" +) + +// Float64Observable is an alias for [metric.Float64Observable]. +// +// Deprecated: Use [metric.Float64Observable] instead. +type Float64Observable metric.Float64Observable + +// Float64ObservableCounter is an alias for [metric.Float64ObservableCounter]. +// +// Deprecated: Use [metric.Float64ObservableCounter] instead. +type Float64ObservableCounter metric.Float64ObservableCounter + +// Float64ObservableCounterConfig is an alias for +// [metric.Float64ObservableCounterConfig]. +// +// Deprecated: Use [metric.Float64ObservableCounterConfig] instead. +type Float64ObservableCounterConfig metric.Float64ObservableCounterConfig + +// NewFloat64ObservableCounterConfig wraps +// [metric.NewFloat64ObservableCounterConfig]. +// +// Deprecated: Use [metric.NewFloat64ObservableCounterConfig] instead. +func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { + o := make([]metric.Float64ObservableCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Float64ObservableCounterOption(opts[i]) + } + c := metric.NewFloat64ObservableCounterConfig(o...) + return Float64ObservableCounterConfig(c) +} + +// Float64ObservableCounterOption is an alias for +// [metric.Float64ObservableCounterOption]. +// +// Deprecated: Use [metric.Float64ObservableCounterOption] instead. +type Float64ObservableCounterOption metric.Float64ObservableCounterOption + +// Float64ObservableUpDownCounter is an alias for +// [metric.Float64ObservableUpDownCounter]. +// +// Deprecated: Use [metric.Float64ObservableUpDownCounter] instead. +type Float64ObservableUpDownCounter metric.Float64ObservableUpDownCounter + +// Float64ObservableUpDownCounterConfig is an alias for +// [metric.Float64ObservableUpDownCounterConfig]. +// +// Deprecated: Use [metric.Float64ObservableUpDownCounterConfig] instead. +type Float64ObservableUpDownCounterConfig metric.Float64ObservableUpDownCounterConfig + +// NewFloat64ObservableUpDownCounterConfig wraps +// [metric.NewFloat64ObservableUpDownCounterConfig]. +// +// Deprecated: Use [metric.NewFloat64ObservableUpDownCounterConfig] instead. +func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { + o := make([]metric.Float64ObservableUpDownCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Float64ObservableUpDownCounterOption(opts[i]) + } + c := metric.NewFloat64ObservableUpDownCounterConfig(o...) + return Float64ObservableUpDownCounterConfig(c) +} + +// Float64ObservableUpDownCounterOption is an alias for +// [metric.Float64ObservableUpDownCounterOption]. +// +// Deprecated: Use [metric.Float64ObservableUpDownCounterOption] instead. +type Float64ObservableUpDownCounterOption metric.Float64ObservableUpDownCounterOption + +// Float64ObservableGauge is an alias for [metric.Float64ObservableGauge]. +// +// Deprecated: Use [metric.Float64ObservableGauge] instead. +type Float64ObservableGauge metric.Float64ObservableGauge + +// Float64ObservableGaugeConfig is an alias for +// [metric.Float64ObservableGaugeConfig]. +// +// Deprecated: Use [metric.Float64ObservableGaugeConfig] instead. +type Float64ObservableGaugeConfig metric.Float64ObservableGaugeConfig + +// NewFloat64ObservableGaugeConfig wraps +// [metric.NewFloat64ObservableGaugeConfig]. +// +// Deprecated: Use [metric.NewFloat64ObservableGaugeConfig] instead. +func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { + o := make([]metric.Float64ObservableGaugeOption, len(opts)) + for i := range opts { + o[i] = metric.Float64ObservableGaugeOption(opts[i]) + } + c := metric.NewFloat64ObservableGaugeConfig(o...) + return Float64ObservableGaugeConfig(c) +} + +// Float64ObservableGaugeOption is an alias for +// [metric.Float64ObservableGaugeOption]. +// +// Deprecated: Use [metric.Float64ObservableGaugeOption] instead. +type Float64ObservableGaugeOption metric.Float64ObservableGaugeOption + +// Float64Observer is an alias for [metric.Float64Observer]. +// +// Deprecated: Use [metric.Float64Observer] instead. +type Float64Observer metric.Float64Observer + +// Float64Callback is an alias for [metric.Float64Callback]. +// +// Deprecated: Use [metric.Float64Callback] instead. +type Float64Callback metric.Float64Callback + +// Float64ObservableOption is an alias for [metric.Float64ObservableOption]. +// +// Deprecated: Use [metric.Float64ObservableOption] instead. +type Float64ObservableOption metric.Float64ObservableOption + +// WithFloat64Callback wraps [metric.WithFloat64Callback]. +// +// Deprecated: Use [metric.WithFloat64Callback] instead. +func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { + cback := metric.Float64Callback(callback) + opt := metric.WithFloat64Callback(cback) + return Float64ObservableOption(opt) +} + +// Int64Observable is an alias for [metric.Int64Observable]. +// +// Deprecated: Use [metric.Int64Observable] instead. +type Int64Observable metric.Int64Observable + +// Int64ObservableCounter is an alias for [metric.Int64ObservableCounter]. +// +// Deprecated: Use [metric.Int64ObservableCounter] instead. +type Int64ObservableCounter metric.Int64ObservableCounter + +// Int64ObservableCounterConfig is an alias for +// [metric.Int64ObservableCounterConfig]. +// +// Deprecated: Use [metric.Int64ObservableCounterConfig] instead. +type Int64ObservableCounterConfig metric.Int64ObservableCounterConfig + +// NewInt64ObservableCounterConfig wraps +// [metric.NewInt64ObservableCounterConfig]. +// +// Deprecated: Use [metric.NewInt64ObservableCounterConfig] instead. +func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { + o := make([]metric.Int64ObservableCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Int64ObservableCounterOption(opts[i]) + } + c := metric.NewInt64ObservableCounterConfig(o...) + return Int64ObservableCounterConfig(c) +} + +// Int64ObservableCounterOption is an alias for +// [metric.Int64ObservableCounterOption]. +// +// Deprecated: Use [metric.Int64ObservableCounterOption] instead. +type Int64ObservableCounterOption metric.Int64ObservableCounterOption + +// Int64ObservableUpDownCounter is an alias for +// [metric.Int64ObservableUpDownCounter]. +// +// Deprecated: Use [metric.Int64ObservableUpDownCounter] instead. +type Int64ObservableUpDownCounter metric.Int64ObservableUpDownCounter + +// Int64ObservableUpDownCounterConfig is an alias for +// [metric.Int64ObservableUpDownCounterConfig]. +// +// Deprecated: Use [metric.Int64ObservableUpDownCounterConfig] instead. +type Int64ObservableUpDownCounterConfig metric.Int64ObservableUpDownCounterConfig + +// NewInt64ObservableUpDownCounterConfig wraps +// [metric.NewInt64ObservableUpDownCounterConfig]. +// +// Deprecated: Use [metric.NewInt64ObservableUpDownCounterConfig] instead. +func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { + o := make([]metric.Int64ObservableUpDownCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Int64ObservableUpDownCounterOption(opts[i]) + } + c := metric.NewInt64ObservableUpDownCounterConfig(o...) + return Int64ObservableUpDownCounterConfig(c) +} + +// Int64ObservableUpDownCounterOption is an alias for +// [metric.Int64ObservableUpDownCounterOption]. +// +// Deprecated: Use [metric.Int64ObservableUpDownCounterOption] instead. +type Int64ObservableUpDownCounterOption metric.Int64ObservableUpDownCounterOption + +// Int64ObservableGauge is an alias for [metric.Int64ObservableGauge]. +// +// Deprecated: Use [metric.Int64ObservableGauge] instead. +type Int64ObservableGauge metric.Int64ObservableGauge + +// Int64ObservableGaugeConfig is an alias for +// [metric.Int64ObservableGaugeConfig]. +// +// Deprecated: Use [metric.Int64ObservableGaugeConfig] instead. +type Int64ObservableGaugeConfig metric.Int64ObservableGaugeConfig + +// NewInt64ObservableGaugeConfig wraps [metric.NewInt64ObservableGaugeConfig]. +// +// Deprecated: Use [metric.NewInt64ObservableGaugeConfig] instead. +func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { + o := make([]metric.Int64ObservableGaugeOption, len(opts)) + for i := range opts { + o[i] = metric.Int64ObservableGaugeOption(opts[i]) + } + c := metric.NewInt64ObservableGaugeConfig(o...) + return Int64ObservableGaugeConfig(c) +} + +// Int64ObservableGaugeOption is an alias for +// [metric.Int64ObservableGaugeOption]. +// +// Deprecated: Use [metric.Int64ObservableGaugeOption] instead. +type Int64ObservableGaugeOption metric.Int64ObservableGaugeOption + +// Int64Observer is an alias for [metric.Int64Observer]. +// +// Deprecated: Use [metric.Int64Observer] instead. +type Int64Observer metric.Int64Observer + +// Int64Callback is an alias for [metric.Int64Callback]. +// +// Deprecated: Use [metric.Int64Callback] instead. +type Int64Callback metric.Int64Callback + +// Int64ObservableOption is an alias for [metric.Int64ObservableOption]. +// +// Deprecated: Use [metric.Int64ObservableOption] instead. +type Int64ObservableOption metric.Int64ObservableOption + +// WithInt64Callback wraps [metric.WithInt64Callback]. +// +// Deprecated: Use [metric.WithInt64Callback] instead. +func WithInt64Callback(callback Int64Callback) Int64ObservableOption { + cback := metric.Int64Callback(callback) + opt := metric.WithInt64Callback(cback) + return Int64ObservableOption(opt) +} + +// Float64Counter is an alias for [metric.Float64Counter]. +// +// Deprecated: Use [metric.Float64Counter] instead. +type Float64Counter metric.Float64Counter + +// Float64CounterConfig is an alias for [metric.Float64CounterConfig]. +// +// Deprecated: Use [metric.Float64CounterConfig] instead. +type Float64CounterConfig metric.Float64CounterConfig + +// NewFloat64CounterConfig wraps [metric.NewFloat64CounterConfig]. +// +// Deprecated: Use [metric.NewFloat64CounterConfig] instead. +func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { + o := make([]metric.Float64CounterOption, len(opts)) + for i := range opts { + o[i] = metric.Float64CounterOption(opts[i]) + } + c := metric.NewFloat64CounterConfig(o...) + return Float64CounterConfig(c) +} + +// Float64CounterOption is an alias for [metric.Float64CounterOption]. +// +// Deprecated: Use [metric.Float64CounterOption] instead. +type Float64CounterOption metric.Float64CounterOption + +// Float64UpDownCounter is an alias for [metric.Float64UpDownCounter]. +// +// Deprecated: Use [metric.Float64UpDownCounter] instead. +type Float64UpDownCounter metric.Float64UpDownCounter + +// Float64UpDownCounterConfig is an alias for +// [metric.Float64UpDownCounterConfig]. +// +// Deprecated: Use [metric.Float64UpDownCounterConfig] instead. +type Float64UpDownCounterConfig metric.Float64UpDownCounterConfig + +// NewFloat64UpDownCounterConfig wraps [metric.NewFloat64UpDownCounterConfig]. +// +// Deprecated: Use [metric.NewFloat64UpDownCounterConfig] instead. +func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { + o := make([]metric.Float64UpDownCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Float64UpDownCounterOption(opts[i]) + } + c := metric.NewFloat64UpDownCounterConfig(o...) + return Float64UpDownCounterConfig(c) +} + +// Float64UpDownCounterOption is an alias for +// [metric.Float64UpDownCounterOption]. +// +// Deprecated: Use [metric.Float64UpDownCounterOption] instead. +type Float64UpDownCounterOption metric.Float64UpDownCounterOption + +// Float64Histogram is an alias for [metric.Float64Histogram]. +// +// Deprecated: Use [metric.Float64Histogram] instead. +type Float64Histogram metric.Float64Histogram + +// Float64HistogramConfig is an alias for [metric.Float64HistogramConfig]. +// +// Deprecated: Use [metric.Float64HistogramConfig] instead. +type Float64HistogramConfig metric.Float64HistogramConfig + +// NewFloat64HistogramConfig wraps [metric.NewFloat64HistogramConfig]. +// +// Deprecated: Use [metric.NewFloat64HistogramConfig] instead. +func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { + o := make([]metric.Float64HistogramOption, len(opts)) + for i := range opts { + o[i] = metric.Float64HistogramOption(opts[i]) + } + c := metric.NewFloat64HistogramConfig(o...) + return Float64HistogramConfig(c) +} + +// Float64HistogramOption is an alias for [metric.Float64HistogramOption]. +// +// Deprecated: Use [metric.Float64HistogramOption] instead. +type Float64HistogramOption metric.Float64HistogramOption + +// Int64Counter is an alias for [metric.Int64Counter]. +// +// Deprecated: Use [metric.Int64Counter] instead. +type Int64Counter metric.Int64Counter + +// Int64CounterConfig is an alias for [metric.Int64CounterConfig]. +// +// Deprecated: Use [metric.Int64CounterConfig] instead. +type Int64CounterConfig metric.Int64CounterConfig + +// NewInt64CounterConfig wraps [metric.NewInt64CounterConfig]. +// +// Deprecated: Use [metric.NewInt64CounterConfig] instead. +func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { + o := make([]metric.Int64CounterOption, len(opts)) + for i := range opts { + o[i] = metric.Int64CounterOption(opts[i]) + } + c := metric.NewInt64CounterConfig(o...) + return Int64CounterConfig(c) +} + +// Int64CounterOption is an alias for [metric.Int64CounterOption]. +// +// Deprecated: Use [metric.Int64CounterOption] instead. +type Int64CounterOption metric.Int64CounterOption + +// Int64UpDownCounter is an alias for [metric.Int64UpDownCounter]. +// +// Deprecated: Use [metric.Int64UpDownCounter] instead. +type Int64UpDownCounter metric.Int64UpDownCounter + +// Int64UpDownCounterConfig is an alias for [metric.Int64UpDownCounterConfig]. +// +// Deprecated: Use [metric.Int64UpDownCounterConfig] instead. +type Int64UpDownCounterConfig metric.Int64UpDownCounterConfig + +// NewInt64UpDownCounterConfig wraps [metric.NewInt64UpDownCounterConfig]. +// +// Deprecated: Use [metric.NewInt64UpDownCounterConfig] instead. +func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { + o := make([]metric.Int64UpDownCounterOption, len(opts)) + for i := range opts { + o[i] = metric.Int64UpDownCounterOption(opts[i]) + } + c := metric.NewInt64UpDownCounterConfig(o...) + return Int64UpDownCounterConfig(c) +} + +// Int64UpDownCounterOption is an alias for [metric.Int64UpDownCounterOption]. +// +// Deprecated: Use [metric.Int64UpDownCounterOption] instead. +type Int64UpDownCounterOption metric.Int64UpDownCounterOption + +// Int64Histogram is an alias for [metric.Int64Histogram]. +// +// Deprecated: Use [metric.Int64Histogram] instead. +type Int64Histogram metric.Int64Histogram + +// Int64HistogramConfig is an alias for [metric.Int64HistogramConfig]. +// +// Deprecated: Use [metric.Int64HistogramConfig] instead. +type Int64HistogramConfig metric.Int64HistogramConfig + +// NewInt64HistogramConfig wraps [metric.NewInt64HistogramConfig]. +// +// Deprecated: Use [metric.NewInt64HistogramConfig] instead. +func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { + o := make([]metric.Int64HistogramOption, len(opts)) + for i := range opts { + o[i] = metric.Int64HistogramOption(opts[i]) + } + c := metric.NewInt64HistogramConfig(o...) + return Int64HistogramConfig(c) +} + +// Int64HistogramOption is an alias for [metric.Int64HistogramOption]. +// +// Deprecated: Use [metric.Int64HistogramOption] instead. +type Int64HistogramOption metric.Int64HistogramOption + +// Observable is an alias for [metric.Observable]. +// +// Deprecated: Use [metric.Observable] instead. +type Observable metric.Observable + +// Option is an alias for [metric.InstrumentOption]. +// +// Deprecated: Use [metric.InstrumentOption] instead. +type Option metric.InstrumentOption + +// WithDescription is an alias for [metric.WithDescription]. +// +// Deprecated: Use [metric.WithDescription] instead. +func WithDescription(desc string) Option { + o := metric.WithDescription(desc) + return Option(o) +} + +// WithUnit is an alias for [metric.WithUnit]. +// +// Deprecated: Use [metric.WithUnit] instead. +func WithUnit(u string) Option { + o := metric.WithUnit(u) + return Option(o) +} diff --git a/metric/instrument/doc.go b/metric/instrument/doc.go deleted file mode 100644 index d0c38a89ce4..00000000000 --- a/metric/instrument/doc.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* -Package instrument provides the OpenTelemetry API instruments used to make -measurements. - -Each instrument is designed to make measurements of a particular type. Broadly, -all instruments fall into two overlapping logical categories: asynchronous or -synchronous, and int64 or float64. - -All synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Float64Counter], [Float64UpDownCounter], [Float64Histogram]) -are used to measure the operation and performance of source code during the -source code execution. These instruments only make measurements when the source -code they instrument is run. - -All asynchronous instruments ([Int64ObservableCounter], -[Int64ObservableUpDownCounter], [Int64ObservableGauge], -[Float64ObservableCounter], [Float64ObservableUpDownCounter], -[Float64ObservableGauge]) are used to measure metrics outside of the execution -of source code. They are said to make "observations" via a callback function -called once every measurement collection cycle. - -Each instrument is also grouped by the value type it measures. Either int64 or -float64. The value being measured will dictate which instrument in these -categories to use. - -Outside of these two broad categories, instruments are described by the -function they are designed to serve. All Counters ([Int64Counter], -[Float64Counter], [Int64ObservableCounter], [Float64ObservableCounter]) are -designed to measure values that never decrease in value, but instead only -incrementally increase in value. UpDownCounters ([Int64UpDownCounter], -[Float64UpDownCounter], [Int64ObservableUpDownCounter], -[Float64ObservableUpDownCounter]) on the other hand, are designed to measure -values that can increase and decrease. When more information -needs to be conveyed about all the synchronous measurements made during a -collection cycle, a Histogram ([Int64Histogram], [Float64Histogram]) should be -used. Finally, when just the most recent measurement needs to be conveyed about an -asynchronous measurement, a Gauge ([Int64ObservableGauge], -[Float64ObservableGauge]) should be used. - -See the [OpenTelemetry documentation] for more information about instruments -and their intended use. - -[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/ -*/ -package instrument // import "go.opentelemetry.io/otel/metric/instrument" diff --git a/metric/instrument/instrument_test.go b/metric/instrument_test.go similarity index 98% rename from metric/instrument/instrument_test.go rename to metric/instrument_test.go index 23f2bdab215..4574160839c 100644 --- a/metric/instrument/instrument_test.go +++ b/metric/instrument_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "sync" diff --git a/metric/internal/global/instruments.go b/metric/internal/global/instruments.go index 79dd446630a..a3b898bfd5b 100644 --- a/metric/internal/global/instruments.go +++ b/metric/internal/global/instruments.go @@ -21,26 +21,25 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" ) // unwrapper unwraps to return the underlying instrument implementation. type unwrapper interface { - Unwrap() instrument.Observable + Unwrap() metric.Observable } type afCounter struct { embedded.Float64ObservableCounter - instrument.Float64Observable + metric.Float64Observable name string - opts []instrument.Float64ObservableCounterOption + opts []metric.Float64ObservableCounterOption - delegate atomic.Value //instrument.Float64ObservableCounter + delegate atomic.Value //metric.Float64ObservableCounter } var _ unwrapper = (*afCounter)(nil) -var _ instrument.Float64ObservableCounter = (*afCounter)(nil) +var _ metric.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) @@ -51,25 +50,25 @@ func (i *afCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afCounter) Unwrap() instrument.Observable { +func (i *afCounter) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Float64ObservableCounter) + return ctr.(metric.Float64ObservableCounter) } return nil } type afUpDownCounter struct { embedded.Float64ObservableUpDownCounter - instrument.Float64Observable + metric.Float64Observable name string - opts []instrument.Float64ObservableUpDownCounterOption + opts []metric.Float64ObservableUpDownCounterOption - delegate atomic.Value //instrument.Float64ObservableUpDownCounter + delegate atomic.Value //metric.Float64ObservableUpDownCounter } var _ unwrapper = (*afUpDownCounter)(nil) -var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) @@ -80,25 +79,25 @@ func (i *afUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afUpDownCounter) Unwrap() instrument.Observable { +func (i *afUpDownCounter) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Float64ObservableUpDownCounter) + return ctr.(metric.Float64ObservableUpDownCounter) } return nil } type afGauge struct { embedded.Float64ObservableGauge - instrument.Float64Observable + metric.Float64Observable name string - opts []instrument.Float64ObservableGaugeOption + opts []metric.Float64ObservableGaugeOption - delegate atomic.Value //instrument.Float64ObservableGauge + delegate atomic.Value //metric.Float64ObservableGauge } var _ unwrapper = (*afGauge)(nil) -var _ instrument.Float64ObservableGauge = (*afGauge)(nil) +var _ metric.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) @@ -109,25 +108,25 @@ func (i *afGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *afGauge) Unwrap() instrument.Observable { +func (i *afGauge) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Float64ObservableGauge) + return ctr.(metric.Float64ObservableGauge) } return nil } type aiCounter struct { embedded.Int64ObservableCounter - instrument.Int64Observable + metric.Int64Observable name string - opts []instrument.Int64ObservableCounterOption + opts []metric.Int64ObservableCounterOption - delegate atomic.Value //instrument.Int64ObservableCounter + delegate atomic.Value //metric.Int64ObservableCounter } var _ unwrapper = (*aiCounter)(nil) -var _ instrument.Int64ObservableCounter = (*aiCounter)(nil) +var _ metric.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) @@ -138,25 +137,25 @@ func (i *aiCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiCounter) Unwrap() instrument.Observable { +func (i *aiCounter) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Int64ObservableCounter) + return ctr.(metric.Int64ObservableCounter) } return nil } type aiUpDownCounter struct { embedded.Int64ObservableUpDownCounter - instrument.Int64Observable + metric.Int64Observable name string - opts []instrument.Int64ObservableUpDownCounterOption + opts []metric.Int64ObservableUpDownCounterOption - delegate atomic.Value //instrument.Int64ObservableUpDownCounter + delegate atomic.Value //metric.Int64ObservableUpDownCounter } var _ unwrapper = (*aiUpDownCounter)(nil) -var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) @@ -167,25 +166,25 @@ func (i *aiUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiUpDownCounter) Unwrap() instrument.Observable { +func (i *aiUpDownCounter) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Int64ObservableUpDownCounter) + return ctr.(metric.Int64ObservableUpDownCounter) } return nil } type aiGauge struct { embedded.Int64ObservableGauge - instrument.Int64Observable + metric.Int64Observable name string - opts []instrument.Int64ObservableGaugeOption + opts []metric.Int64ObservableGaugeOption - delegate atomic.Value //instrument.Int64ObservableGauge + delegate atomic.Value //metric.Int64ObservableGauge } var _ unwrapper = (*aiGauge)(nil) -var _ instrument.Int64ObservableGauge = (*aiGauge)(nil) +var _ metric.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) @@ -196,9 +195,9 @@ func (i *aiGauge) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *aiGauge) Unwrap() instrument.Observable { +func (i *aiGauge) Unwrap() metric.Observable { if ctr := i.delegate.Load(); ctr != nil { - return ctr.(instrument.Int64ObservableGauge) + return ctr.(metric.Int64ObservableGauge) } return nil } @@ -208,12 +207,12 @@ type sfCounter struct { embedded.Float64Counter name string - opts []instrument.Float64CounterOption + opts []metric.Float64CounterOption - delegate atomic.Value //instrument.Float64Counter + delegate atomic.Value //metric.Float64Counter } -var _ instrument.Float64Counter = (*sfCounter)(nil) +var _ metric.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) @@ -224,9 +223,9 @@ func (i *sfCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...instrument.AddOption) { +func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64Counter).Add(ctx, incr, opts...) + ctr.(metric.Float64Counter).Add(ctx, incr, opts...) } } @@ -234,12 +233,12 @@ type sfUpDownCounter struct { embedded.Float64UpDownCounter name string - opts []instrument.Float64UpDownCounterOption + opts []metric.Float64UpDownCounterOption - delegate atomic.Value //instrument.Float64UpDownCounter + delegate atomic.Value //metric.Float64UpDownCounter } -var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil) +var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) @@ -250,9 +249,9 @@ func (i *sfUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...instrument.AddOption) { +func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64UpDownCounter).Add(ctx, incr, opts...) + ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...) } } @@ -260,12 +259,12 @@ type sfHistogram struct { embedded.Float64Histogram name string - opts []instrument.Float64HistogramOption + opts []metric.Float64HistogramOption - delegate atomic.Value //instrument.Float64Histogram + delegate atomic.Value //metric.Float64Histogram } -var _ instrument.Float64Histogram = (*sfHistogram)(nil) +var _ metric.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) @@ -276,9 +275,9 @@ func (i *sfHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...instrument.RecordOption) { +func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Float64Histogram).Record(ctx, x, opts...) + ctr.(metric.Float64Histogram).Record(ctx, x, opts...) } } @@ -286,12 +285,12 @@ type siCounter struct { embedded.Int64Counter name string - opts []instrument.Int64CounterOption + opts []metric.Int64CounterOption - delegate atomic.Value //instrument.Int64Counter + delegate atomic.Value //metric.Int64Counter } -var _ instrument.Int64Counter = (*siCounter)(nil) +var _ metric.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) @@ -302,9 +301,9 @@ func (i *siCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siCounter) Add(ctx context.Context, x int64, opts ...instrument.AddOption) { +func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64Counter).Add(ctx, x, opts...) + ctr.(metric.Int64Counter).Add(ctx, x, opts...) } } @@ -312,12 +311,12 @@ type siUpDownCounter struct { embedded.Int64UpDownCounter name string - opts []instrument.Int64UpDownCounterOption + opts []metric.Int64UpDownCounterOption - delegate atomic.Value //instrument.Int64UpDownCounter + delegate atomic.Value //metric.Int64UpDownCounter } -var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil) +var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) @@ -328,9 +327,9 @@ func (i *siUpDownCounter) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...instrument.AddOption) { +func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64UpDownCounter).Add(ctx, x, opts...) + ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...) } } @@ -338,12 +337,12 @@ type siHistogram struct { embedded.Int64Histogram name string - opts []instrument.Int64HistogramOption + opts []metric.Int64HistogramOption - delegate atomic.Value //instrument.Int64Histogram + delegate atomic.Value //metric.Int64Histogram } -var _ instrument.Int64Histogram = (*siHistogram)(nil) +var _ metric.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) @@ -354,8 +353,8 @@ func (i *siHistogram) setDelegate(m metric.Meter) { i.delegate.Store(ctr) } -func (i *siHistogram) Record(ctx context.Context, x int64, opts ...instrument.RecordOption) { +func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) { if ctr := i.delegate.Load(); ctr != nil { - ctr.(instrument.Int64Histogram).Record(ctx, x, opts...) + ctr.(metric.Int64Histogram).Record(ctx, x, opts...) } } diff --git a/metric/internal/global/instruments_test.go b/metric/internal/global/instruments_test.go index ce78cfb1252..7003e04b1f2 100644 --- a/metric/internal/global/instruments_test.go +++ b/metric/internal/global/instruments_test.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/noop" ) @@ -151,7 +150,7 @@ func TestSyncInstrumentSetDelegateRace(t *testing.T) { type testCountingFloatInstrument struct { count int - instrument.Float64Observable + metric.Float64Observable embedded.Float64Counter embedded.Float64UpDownCounter embedded.Float64Histogram @@ -163,17 +162,17 @@ type testCountingFloatInstrument struct { func (i *testCountingFloatInstrument) observe() { i.count++ } -func (i *testCountingFloatInstrument) Add(context.Context, float64, ...instrument.AddOption) { +func (i *testCountingFloatInstrument) Add(context.Context, float64, ...metric.AddOption) { i.count++ } -func (i *testCountingFloatInstrument) Record(context.Context, float64, ...instrument.RecordOption) { +func (i *testCountingFloatInstrument) Record(context.Context, float64, ...metric.RecordOption) { i.count++ } type testCountingIntInstrument struct { count int - instrument.Int64Observable + metric.Int64Observable embedded.Int64Counter embedded.Int64UpDownCounter embedded.Int64Histogram @@ -185,9 +184,9 @@ type testCountingIntInstrument struct { func (i *testCountingIntInstrument) observe() { i.count++ } -func (i *testCountingIntInstrument) Add(context.Context, int64, ...instrument.AddOption) { +func (i *testCountingIntInstrument) Add(context.Context, int64, ...metric.AddOption) { i.count++ } -func (i *testCountingIntInstrument) Record(context.Context, int64, ...instrument.RecordOption) { +func (i *testCountingIntInstrument) Record(context.Context, int64, ...metric.RecordOption) { i.count++ } diff --git a/metric/internal/global/meter.go b/metric/internal/global/meter.go index db6e780b615..a00b99085c4 100644 --- a/metric/internal/global/meter.go +++ b/metric/internal/global/meter.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" ) // meterProvider is a placeholder for a configured SDK MeterProvider. @@ -147,7 +146,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { m.registry.Init() } -func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { +func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Counter(name, options...) } @@ -158,7 +157,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOpti return i, nil } -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { +func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64UpDownCounter(name, options...) } @@ -169,7 +168,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDow return i, nil } -func (m *meter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { +func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64Histogram(name, options...) } @@ -180,7 +179,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Histogram return i, nil } -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { +func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableCounter(name, options...) } @@ -191,7 +190,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O return i, nil } -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { +func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableUpDownCounter(name, options...) } @@ -202,7 +201,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. return i, nil } -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { +func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Int64ObservableGauge(name, options...) } @@ -213,7 +212,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs return i, nil } -func (m *meter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { +func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Counter(name, options...) } @@ -224,7 +223,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Counter return i, nil } -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { +func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64UpDownCounter(name, options...) } @@ -235,7 +234,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64U return i, nil } -func (m *meter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { +func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64Histogram(name, options...) } @@ -246,7 +245,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Histo return i, nil } -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { +func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableCounter(name, options...) } @@ -257,7 +256,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa return i, nil } -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { +func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableUpDownCounter(name, options...) } @@ -268,7 +267,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen return i, nil } -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { +func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { return del.Float64ObservableGauge(name, options...) } @@ -280,7 +279,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 } // RegisterCallback captures the function that will be called during Collect. -func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observable) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { if del, ok := m.delegate.Load().(metric.Meter); ok { insts = unwrapInstruments(insts) return del.RegisterCallback(f, insts...) @@ -301,11 +300,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observab } type wrapped interface { - unwrap() instrument.Observable + unwrap() metric.Observable } -func unwrapInstruments(instruments []instrument.Observable) []instrument.Observable { - out := make([]instrument.Observable, 0, len(instruments)) +func unwrapInstruments(instruments []metric.Observable) []metric.Observable { + out := make([]metric.Observable, 0, len(instruments)) for _, inst := range instruments { if in, ok := inst.(wrapped); ok { @@ -321,7 +320,7 @@ func unwrapInstruments(instruments []instrument.Observable) []instrument.Observa type registration struct { embedded.Registration - instruments []instrument.Observable + instruments []metric.Observable function metric.Callback unreg func() error diff --git a/metric/internal/global/meter_test.go b/metric/internal/global/meter_test.go index 57a2e3b2084..5bae7acc453 100644 --- a/metric/internal/global/meter_test.go +++ b/metric/internal/global/meter_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/metric/noop" ) @@ -118,7 +117,7 @@ func TestUnregisterRace(t *testing.T) { close(finish) } -func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (instrument.Float64Counter, instrument.Float64ObservableCounter) { +func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (metric.Float64Counter, metric.Float64ObservableCounter) { afcounter, err := m.Float64ObservableCounter("test_Async_Counter") require.NoError(t, err) _, err = m.Float64ObservableUpDownCounter("test_Async_UpDownCounter") diff --git a/metric/internal/global/meter_types_test.go b/metric/internal/global/meter_types_test.go index 45de7ca4dbb..a91a26a4915 100644 --- a/metric/internal/global/meter_types_test.go +++ b/metric/internal/global/meter_types_test.go @@ -19,7 +19,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" ) type testMeterProvider struct { @@ -56,68 +55,68 @@ type testMeter struct { callbacks []metric.Callback } -func (m *testMeter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { +func (m *testMeter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { m.siCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { +func (m *testMeter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { m.siUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { +func (m *testMeter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { m.siHist++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { +func (m *testMeter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { m.aiCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { +func (m *testMeter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { m.aiUDCount++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { +func (m *testMeter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { m.aiGauge++ return &testCountingIntInstrument{}, nil } -func (m *testMeter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { +func (m *testMeter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { m.sfCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { +func (m *testMeter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { m.sfUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { +func (m *testMeter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { m.sfHist++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { +func (m *testMeter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { m.afCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { +func (m *testMeter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { m.afUDCount++ return &testCountingFloatInstrument{}, nil } -func (m *testMeter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { +func (m *testMeter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { m.afGauge++ return &testCountingFloatInstrument{}, nil } // RegisterCallback captures the function that will be called during Collect. -func (m *testMeter) RegisterCallback(f metric.Callback, i ...instrument.Observable) (metric.Registration, error) { +func (m *testMeter) RegisterCallback(f metric.Callback, i ...metric.Observable) (metric.Registration, error) { m.callbacks = append(m.callbacks, f) return testReg{ f: func(idx int) func() { @@ -156,14 +155,14 @@ type observationRecorder struct { ctx context.Context } -func (o observationRecorder) ObserveFloat64(i instrument.Float64Observable, value float64, _ ...instrument.ObserveOption) { +func (o observationRecorder) ObserveFloat64(i metric.Float64Observable, value float64, _ ...metric.ObserveOption) { iImpl, ok := i.(*testCountingFloatInstrument) if ok { iImpl.observe() } } -func (o observationRecorder) ObserveInt64(i instrument.Int64Observable, value int64, _ ...instrument.ObserveOption) { +func (o observationRecorder) ObserveInt64(i metric.Int64Observable, value int64, _ ...metric.ObserveOption) { iImpl, ok := i.(*testCountingIntInstrument) if ok { iImpl.observe() diff --git a/metric/meter.go b/metric/meter.go index 0f77cde8d7e..1d60cf57a4d 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" ) // MeterProvider provides access to named Meter instances, for instrumenting @@ -53,56 +52,56 @@ type Meter interface { // Int64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // int64 measurements during a computational operation. - Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) + Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. - Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) + Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) // Int64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of int64 measurements during a computational operation. - Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) + Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. - Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) + Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) // Int64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously // record int64 measurements once per a measurement collection cycle. - Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) + Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection // cycle. - Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) + Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) // Float64Counter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // increasing float64 measurements during a computational operation. - Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) + Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. - Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) + Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) // Float64Histogram returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // the distribution of float64 measurements during a computational // operation. - Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) + Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. - Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) + Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) // Float64ObservableUpDownCounter returns a new instrument identified by // name and configured with options. The instrument is used to // asynchronously record float64 measurements once per a measurement // collection cycle. - Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) + Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection // cycle. - Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) + Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a // measurement cycle. @@ -115,7 +114,7 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. - RegisterCallback(f Callback, instruments ...instrument.Observable) (Registration, error) + RegisterCallback(f Callback, instruments ...Observable) (Registration, error) } // Callback is a function registered with a Meter that makes observations for @@ -141,9 +140,9 @@ type Observer interface { embedded.Observer // ObserveFloat64 records the float64 value for obsrv. - ObserveFloat64(obsrv instrument.Float64Observable, value float64, opts ...instrument.ObserveOption) + ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption) // ObserveInt64 records the int64 value for obsrv. - ObserveInt64(obsrv instrument.Int64Observable, value int64, opts ...instrument.ObserveOption) + ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption) } // Registration is an token representing the unique registration of a callback diff --git a/metric/noop/noop.go b/metric/noop/noop.go index 683f3e1c84c..acc9a670b22 100644 --- a/metric/noop/noop.go +++ b/metric/noop/noop.go @@ -28,30 +28,29 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" ) var ( // Compile-time check this implements the OpenTelemetry API. - _ metric.MeterProvider = MeterProvider{} - _ metric.Meter = Meter{} - _ metric.Observer = Observer{} - _ metric.Registration = Registration{} - _ instrument.Int64Counter = Int64Counter{} - _ instrument.Float64Counter = Float64Counter{} - _ instrument.Int64UpDownCounter = Int64UpDownCounter{} - _ instrument.Float64UpDownCounter = Float64UpDownCounter{} - _ instrument.Int64Histogram = Int64Histogram{} - _ instrument.Float64Histogram = Float64Histogram{} - _ instrument.Int64ObservableCounter = Int64ObservableCounter{} - _ instrument.Float64ObservableCounter = Float64ObservableCounter{} - _ instrument.Int64ObservableGauge = Int64ObservableGauge{} - _ instrument.Float64ObservableGauge = Float64ObservableGauge{} - _ instrument.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} - _ instrument.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} - _ instrument.Int64Observer = Int64Observer{} - _ instrument.Float64Observer = Float64Observer{} + _ metric.MeterProvider = MeterProvider{} + _ metric.Meter = Meter{} + _ metric.Observer = Observer{} + _ metric.Registration = Registration{} + _ metric.Int64Counter = Int64Counter{} + _ metric.Float64Counter = Float64Counter{} + _ metric.Int64UpDownCounter = Int64UpDownCounter{} + _ metric.Float64UpDownCounter = Float64UpDownCounter{} + _ metric.Int64Histogram = Int64Histogram{} + _ metric.Float64Histogram = Float64Histogram{} + _ metric.Int64ObservableCounter = Int64ObservableCounter{} + _ metric.Float64ObservableCounter = Float64ObservableCounter{} + _ metric.Int64ObservableGauge = Int64ObservableGauge{} + _ metric.Float64ObservableGauge = Float64ObservableGauge{} + _ metric.Int64ObservableUpDownCounter = Int64ObservableUpDownCounter{} + _ metric.Float64ObservableUpDownCounter = Float64ObservableUpDownCounter{} + _ metric.Int64Observer = Int64Observer{} + _ metric.Float64Observer = Float64Observer{} ) // MeterProvider is an OpenTelemetry No-Op MeterProvider. @@ -72,78 +71,78 @@ type Meter struct{ embedded.Meter } // Int64Counter returns a Counter used to record int64 measurements that // produces no telemetry. -func (Meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { +func (Meter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error) { return Int64Counter{}, nil } // Int64UpDownCounter returns an UpDownCounter used to record int64 // measurements that produces no telemetry. -func (Meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { +func (Meter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { return Int64UpDownCounter{}, nil } // Int64Histogram returns a Histogram used to record int64 measurements that // produces no telemetry. -func (Meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { +func (Meter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { return Int64Histogram{}, nil } // Int64ObservableCounter returns an ObservableCounter used to record int64 // measurements that produces no telemetry. -func (Meter) Int64ObservableCounter(string, ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { +func (Meter) Int64ObservableCounter(string, ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { return Int64ObservableCounter{}, nil } // Int64ObservableUpDownCounter returns an ObservableUpDownCounter used to // record int64 measurements that produces no telemetry. -func (Meter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { +func (Meter) Int64ObservableUpDownCounter(string, ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { return Int64ObservableUpDownCounter{}, nil } // Int64ObservableGauge returns an ObservableGauge used to record int64 // measurements that produces no telemetry. -func (Meter) Int64ObservableGauge(string, ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { +func (Meter) Int64ObservableGauge(string, ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { return Int64ObservableGauge{}, nil } // Float64Counter returns a Counter used to record int64 measurements that // produces no telemetry. -func (Meter) Float64Counter(string, ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { +func (Meter) Float64Counter(string, ...metric.Float64CounterOption) (metric.Float64Counter, error) { return Float64Counter{}, nil } // Float64UpDownCounter returns an UpDownCounter used to record int64 // measurements that produces no telemetry. -func (Meter) Float64UpDownCounter(string, ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { +func (Meter) Float64UpDownCounter(string, ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { return Float64UpDownCounter{}, nil } // Float64Histogram returns a Histogram used to record int64 measurements that // produces no telemetry. -func (Meter) Float64Histogram(string, ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { +func (Meter) Float64Histogram(string, ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { return Float64Histogram{}, nil } // Float64ObservableCounter returns an ObservableCounter used to record int64 // measurements that produces no telemetry. -func (Meter) Float64ObservableCounter(string, ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { +func (Meter) Float64ObservableCounter(string, ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { return Float64ObservableCounter{}, nil } // Float64ObservableUpDownCounter returns an ObservableUpDownCounter used to // record int64 measurements that produces no telemetry. -func (Meter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { +func (Meter) Float64ObservableUpDownCounter(string, ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { return Float64ObservableUpDownCounter{}, nil } // Float64ObservableGauge returns an ObservableGauge used to record int64 // measurements that produces no telemetry. -func (Meter) Float64ObservableGauge(string, ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { +func (Meter) Float64ObservableGauge(string, ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { return Float64ObservableGauge{}, nil } // RegisterCallback performs no operation. -func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric.Registration, error) { +func (Meter) RegisterCallback(metric.Callback, ...metric.Observable) (metric.Registration, error) { return Registration{}, nil } @@ -152,11 +151,11 @@ func (Meter) RegisterCallback(metric.Callback, ...instrument.Observable) (metric type Observer struct{ embedded.Observer } // ObserveFloat64 performs no operation. -func (Observer) ObserveFloat64(instrument.Float64Observable, float64, ...instrument.ObserveOption) { +func (Observer) ObserveFloat64(metric.Float64Observable, float64, ...metric.ObserveOption) { } // ObserveInt64 performs no operation. -func (Observer) ObserveInt64(instrument.Int64Observable, int64, ...instrument.ObserveOption) { +func (Observer) ObserveInt64(metric.Int64Observable, int64, ...metric.ObserveOption) { } // Registration is the registration of a Callback with a No-Op Meter. @@ -172,82 +171,82 @@ func (Registration) Unregister() error { return nil } type Int64Counter struct{ embedded.Int64Counter } // Add performs no operation. -func (Int64Counter) Add(context.Context, int64, ...instrument.AddOption) {} +func (Int64Counter) Add(context.Context, int64, ...metric.AddOption) {} // Float64Counter is an OpenTelemetry Counter used to record float64 // measurements. It produces no telemetry. type Float64Counter struct{ embedded.Float64Counter } // Add performs no operation. -func (Float64Counter) Add(context.Context, float64, ...instrument.AddOption) {} +func (Float64Counter) Add(context.Context, float64, ...metric.AddOption) {} // Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64 // measurements. It produces no telemetry. type Int64UpDownCounter struct{ embedded.Int64UpDownCounter } // Add performs no operation. -func (Int64UpDownCounter) Add(context.Context, int64, ...instrument.AddOption) {} +func (Int64UpDownCounter) Add(context.Context, int64, ...metric.AddOption) {} // Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record // float64 measurements. It produces no telemetry. type Float64UpDownCounter struct{ embedded.Float64UpDownCounter } // Add performs no operation. -func (Float64UpDownCounter) Add(context.Context, float64, ...instrument.AddOption) {} +func (Float64UpDownCounter) Add(context.Context, float64, ...metric.AddOption) {} // Int64Histogram is an OpenTelemetry Histogram used to record int64 // measurements. It produces no telemetry. type Int64Histogram struct{ embedded.Int64Histogram } // Record performs no operation. -func (Int64Histogram) Record(context.Context, int64, ...instrument.RecordOption) {} +func (Int64Histogram) Record(context.Context, int64, ...metric.RecordOption) {} // Float64Histogram is an OpenTelemetry Histogram used to record float64 // measurements. It produces no telemetry. type Float64Histogram struct{ embedded.Float64Histogram } // Record performs no operation. -func (Float64Histogram) Record(context.Context, float64, ...instrument.RecordOption) {} +func (Float64Histogram) Record(context.Context, float64, ...metric.RecordOption) {} // Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record // int64 measurements. It produces no telemetry. type Int64ObservableCounter struct { - instrument.Int64Observable + metric.Int64Observable embedded.Int64ObservableCounter } // Float64ObservableCounter is an OpenTelemetry ObservableCounter used to record // float64 measurements. It produces no telemetry. type Float64ObservableCounter struct { - instrument.Float64Observable + metric.Float64Observable embedded.Float64ObservableCounter } // Int64ObservableGauge is an OpenTelemetry ObservableGauge used to record // int64 measurements. It produces no telemetry. type Int64ObservableGauge struct { - instrument.Int64Observable + metric.Int64Observable embedded.Int64ObservableGauge } // Float64ObservableGauge is an OpenTelemetry ObservableGauge used to record // float64 measurements. It produces no telemetry. type Float64ObservableGauge struct { - instrument.Float64Observable + metric.Float64Observable embedded.Float64ObservableGauge } // Int64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter // used to record int64 measurements. It produces no telemetry. type Int64ObservableUpDownCounter struct { - instrument.Int64Observable + metric.Int64Observable embedded.Int64ObservableUpDownCounter } // Float64ObservableUpDownCounter is an OpenTelemetry ObservableUpDownCounter // used to record float64 measurements. It produces no telemetry. type Float64ObservableUpDownCounter struct { - instrument.Float64Observable + metric.Float64Observable embedded.Float64ObservableUpDownCounter } @@ -255,11 +254,11 @@ type Float64ObservableUpDownCounter struct { type Int64Observer struct{ embedded.Int64Observer } // Observe performs no operation. -func (Int64Observer) Observe(int64, ...instrument.ObserveOption) {} +func (Int64Observer) Observe(int64, ...metric.ObserveOption) {} // Float64Observer is a recorder of float64 measurements that performs no // operation. type Float64Observer struct{ embedded.Float64Observer } // Observe performs no operation. -func (Float64Observer) Observe(float64, ...instrument.ObserveOption) {} +func (Float64Observer) Observe(float64, ...metric.ObserveOption) {} diff --git a/metric/noop/noop_test.go b/metric/noop/noop_test.go index 6ddf50e6214..b4acae1847b 100644 --- a/metric/noop/noop_test.go +++ b/metric/noop/noop_test.go @@ -21,7 +21,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" ) func TestImplementationNoPanics(t *testing.T) { @@ -45,59 +44,59 @@ func TestImplementationNoPanics(t *testing.T) { )) t.Run("Int64Counter", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64Counter{}), - reflect.TypeOf((*instrument.Int64Counter)(nil)).Elem(), + reflect.TypeOf((*metric.Int64Counter)(nil)).Elem(), )) t.Run("Float64Counter", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64Counter{}), - reflect.TypeOf((*instrument.Float64Counter)(nil)).Elem(), + reflect.TypeOf((*metric.Float64Counter)(nil)).Elem(), )) t.Run("Int64UpDownCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64UpDownCounter{}), - reflect.TypeOf((*instrument.Int64UpDownCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Int64UpDownCounter)(nil)).Elem(), )) t.Run("Float64UpDownCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64UpDownCounter{}), - reflect.TypeOf((*instrument.Float64UpDownCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Float64UpDownCounter)(nil)).Elem(), )) t.Run("Int64Histogram", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64Histogram{}), - reflect.TypeOf((*instrument.Int64Histogram)(nil)).Elem(), + reflect.TypeOf((*metric.Int64Histogram)(nil)).Elem(), )) t.Run("Float64Histogram", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64Histogram{}), - reflect.TypeOf((*instrument.Float64Histogram)(nil)).Elem(), + reflect.TypeOf((*metric.Float64Histogram)(nil)).Elem(), )) t.Run("Int64ObservableCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64ObservableCounter{}), - reflect.TypeOf((*instrument.Int64ObservableCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Int64ObservableCounter)(nil)).Elem(), )) t.Run("Float64ObservableCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64ObservableCounter{}), - reflect.TypeOf((*instrument.Float64ObservableCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Float64ObservableCounter)(nil)).Elem(), )) t.Run("Int64ObservableGauge", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64ObservableGauge{}), - reflect.TypeOf((*instrument.Int64ObservableGauge)(nil)).Elem(), + reflect.TypeOf((*metric.Int64ObservableGauge)(nil)).Elem(), )) t.Run("Float64ObservableGauge", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64ObservableGauge{}), - reflect.TypeOf((*instrument.Float64ObservableGauge)(nil)).Elem(), + reflect.TypeOf((*metric.Float64ObservableGauge)(nil)).Elem(), )) t.Run("Int64ObservableUpDownCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64ObservableUpDownCounter{}), - reflect.TypeOf((*instrument.Int64ObservableUpDownCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Int64ObservableUpDownCounter)(nil)).Elem(), )) t.Run("Float64ObservableUpDownCounter", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64ObservableUpDownCounter{}), - reflect.TypeOf((*instrument.Float64ObservableUpDownCounter)(nil)).Elem(), + reflect.TypeOf((*metric.Float64ObservableUpDownCounter)(nil)).Elem(), )) t.Run("Int64Observer", assertAllExportedMethodNoPanic( reflect.ValueOf(Int64Observer{}), - reflect.TypeOf((*instrument.Int64Observer)(nil)).Elem(), + reflect.TypeOf((*metric.Int64Observer)(nil)).Elem(), )) t.Run("Float64Observer", assertAllExportedMethodNoPanic( reflect.ValueOf(Float64Observer{}), - reflect.TypeOf((*instrument.Float64Observer)(nil)).Elem(), + reflect.TypeOf((*metric.Float64Observer)(nil)).Elem(), )) } diff --git a/metric/instrument/syncfloat64.go b/metric/syncfloat64.go similarity index 98% rename from metric/instrument/syncfloat64.go rename to metric/syncfloat64.go index 2399f83637e..0b2023c35ad 100644 --- a/metric/instrument/syncfloat64.go +++ b/metric/syncfloat64.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/instrument/syncfloat64_test.go b/metric/syncfloat64_test.go similarity index 94% rename from metric/instrument/syncfloat64_test.go rename to metric/syncfloat64_test.go index 96fa56334da..7132680b131 100644 --- a/metric/instrument/syncfloat64_test.go +++ b/metric/syncfloat64_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "testing" diff --git a/metric/instrument/syncint64.go b/metric/syncint64.go similarity index 98% rename from metric/instrument/syncint64.go rename to metric/syncint64.go index 53d1c5b6c0a..9a1a9dba85d 100644 --- a/metric/instrument/syncint64.go +++ b/metric/syncint64.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "context" diff --git a/metric/instrument/syncint64_test.go b/metric/syncint64_test.go similarity index 94% rename from metric/instrument/syncint64_test.go rename to metric/syncint64_test.go index 434fd3c4cc2..51c02f5e041 100644 --- a/metric/instrument/syncint64_test.go +++ b/metric/syncint64_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" +package metric // import "go.opentelemetry.io/otel/metric" import ( "testing" diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 8ac57a67e3c..d7f8798ba46 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -67,7 +66,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Int64Counter", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.AddOption{instrument.WithAttributeSet(s)} + o := []metric.AddOption{metric.WithAttributeSet(s)} return func() { iCtr.Add(ctx, 1, o...) } } }())) @@ -76,7 +75,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Float64Counter", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.AddOption{instrument.WithAttributeSet(s)} + o := []metric.AddOption{metric.WithAttributeSet(s)} return func() { fCtr.Add(ctx, 1, o...) } } }())) @@ -85,7 +84,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Int64UpDownCounter", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.AddOption{instrument.WithAttributeSet(s)} + o := []metric.AddOption{metric.WithAttributeSet(s)} return func() { iUDCtr.Add(ctx, 1, o...) } } }())) @@ -94,7 +93,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Float64UpDownCounter", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.AddOption{instrument.WithAttributeSet(s)} + o := []metric.AddOption{metric.WithAttributeSet(s)} return func() { fUDCtr.Add(ctx, 1, o...) } } }())) @@ -103,7 +102,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Int64Histogram", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.RecordOption{instrument.WithAttributeSet(s)} + o := []metric.RecordOption{metric.WithAttributeSet(s)} return func() { iHist.Record(ctx, 1, o...) } } }())) @@ -112,7 +111,7 @@ func benchSyncViews(views ...View) func(*testing.B) { assert.NoError(b, err) b.Run("Float64Histogram", benchMeasAttrs(func() measF { return func(s attribute.Set) func() { - o := []instrument.RecordOption{instrument.WithAttributeSet(s)} + o := []metric.RecordOption{metric.WithAttributeSet(s)} return func() { fHist.Record(ctx, 1, o...) } } }())) @@ -174,7 +173,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64Counter") i, err := m.Int64Counter("int64-counter") assert.NoError(b, err) - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Int64Counter/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -182,7 +181,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Int64Counter("int64-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -191,7 +190,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64Counter") i, err := m.Float64Counter("float64-counter") assert.NoError(b, err) - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Float64Counter/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -199,7 +198,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Float64Counter("float64-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -208,7 +207,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64UpDownCounter") i, err := m.Int64UpDownCounter("int64-up-down-counter") assert.NoError(b, err) - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Int64UpDownCounter/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -216,7 +215,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Int64UpDownCounter("int64-up-down-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -225,7 +224,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64UpDownCounter") i, err := m.Float64UpDownCounter("float64-up-down-counter") assert.NoError(b, err) - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Float64UpDownCounter/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -233,7 +232,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Float64UpDownCounter("float64-up-down-counter") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Add(ctx, 1, instrument.WithAttributeSet(s)) + i.Add(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -242,7 +241,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64Histogram") i, err := m.Int64Histogram("int64-histogram") assert.NoError(b, err) - i.Record(ctx, 1, instrument.WithAttributeSet(s)) + i.Record(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Int64Histogram/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -250,7 +249,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Int64Histogram("int64-histogram") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Record(ctx, 1, instrument.WithAttributeSet(s)) + i.Record(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -259,7 +258,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64Histogram") i, err := m.Float64Histogram("float64-histogram") assert.NoError(b, err) - i.Record(ctx, 1, instrument.WithAttributeSet(s)) + i.Record(ctx, 1, metric.WithAttributeSet(s)) return r })) b.Run("Float64Histogram/10", benchCollectAttrs(func(s attribute.Set) Reader { @@ -267,7 +266,7 @@ func benchCollectViews(views ...View) func(*testing.B) { i, err := m.Float64Histogram("float64-histogram") assert.NoError(b, err) for n := 0; n < 10; n++ { - i.Record(ctx, 1, instrument.WithAttributeSet(s)) + i.Record(ctx, 1, metric.WithAttributeSet(s)) } return r })) @@ -276,7 +275,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64ObservableCounter") _, err := m.Int64ObservableCounter( "int64-observable-counter", - instrument.WithInt64Callback(int64Cback(s)), + metric.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r @@ -286,7 +285,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64ObservableCounter") _, err := m.Float64ObservableCounter( "float64-observable-counter", - instrument.WithFloat64Callback(float64Cback(s)), + metric.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r @@ -296,7 +295,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64ObservableUpDownCounter") _, err := m.Int64ObservableUpDownCounter( "int64-observable-up-down-counter", - instrument.WithInt64Callback(int64Cback(s)), + metric.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r @@ -306,7 +305,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64ObservableUpDownCounter") _, err := m.Float64ObservableUpDownCounter( "float64-observable-up-down-counter", - instrument.WithFloat64Callback(float64Cback(s)), + metric.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r @@ -316,7 +315,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Int64ObservableGauge") _, err := m.Int64ObservableGauge( "int64-observable-gauge", - instrument.WithInt64Callback(int64Cback(s)), + metric.WithInt64Callback(int64Cback(s)), ) assert.NoError(b, err) return r @@ -326,7 +325,7 @@ func benchCollectViews(views ...View) func(*testing.B) { m, r := setup("benchCollectViews/Float64ObservableGauge") _, err := m.Float64ObservableGauge( "float64-observable-gauge", - instrument.WithFloat64Callback(float64Cback(s)), + metric.WithFloat64Callback(float64Cback(s)), ) assert.NoError(b, err) return r @@ -334,17 +333,17 @@ func benchCollectViews(views ...View) func(*testing.B) { } } -func int64Cback(s attribute.Set) instrument.Int64Callback { - opt := []instrument.ObserveOption{instrument.WithAttributeSet(s)} - return func(_ context.Context, o instrument.Int64Observer) error { +func int64Cback(s attribute.Set) metric.Int64Callback { + opt := []metric.ObserveOption{metric.WithAttributeSet(s)} + return func(_ context.Context, o metric.Int64Observer) error { o.Observe(1, opt...) return nil } } -func float64Cback(s attribute.Set) instrument.Float64Callback { - opt := []instrument.ObserveOption{instrument.WithAttributeSet(s)} - return func(_ context.Context, o instrument.Float64Observer) error { +func float64Cback(s attribute.Set) metric.Float64Callback { + opt := []metric.ObserveOption{metric.WithAttributeSet(s)} + return func(_ context.Context, o metric.Float64Observer) error { o.Observe(1, opt...) return nil } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index b4eb05a1606..ffaf0917cb6 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -20,8 +20,8 @@ import ( "fmt" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" @@ -178,17 +178,17 @@ type int64Inst struct { embedded.Int64Histogram } -var _ instrument.Int64Counter = (*int64Inst)(nil) -var _ instrument.Int64UpDownCounter = (*int64Inst)(nil) -var _ instrument.Int64Histogram = (*int64Inst)(nil) +var _ metric.Int64Counter = (*int64Inst)(nil) +var _ metric.Int64UpDownCounter = (*int64Inst)(nil) +var _ metric.Int64Histogram = (*int64Inst)(nil) -func (i *int64Inst) Add(ctx context.Context, val int64, opts ...instrument.AddOption) { - c := instrument.NewAddConfig(opts) +func (i *int64Inst) Add(ctx context.Context, val int64, opts ...metric.AddOption) { + c := metric.NewAddConfig(opts) i.aggregate(ctx, val, c.Attributes()) } -func (i *int64Inst) Record(ctx context.Context, val int64, opts ...instrument.RecordOption) { - c := instrument.NewRecordConfig(opts) +func (i *int64Inst) Record(ctx context.Context, val int64, opts ...metric.RecordOption) { + c := metric.NewRecordConfig(opts) i.aggregate(ctx, val, c.Attributes()) } @@ -209,17 +209,17 @@ type float64Inst struct { embedded.Float64Histogram } -var _ instrument.Float64Counter = (*float64Inst)(nil) -var _ instrument.Float64UpDownCounter = (*float64Inst)(nil) -var _ instrument.Float64Histogram = (*float64Inst)(nil) +var _ metric.Float64Counter = (*float64Inst)(nil) +var _ metric.Float64UpDownCounter = (*float64Inst)(nil) +var _ metric.Float64Histogram = (*float64Inst)(nil) -func (i *float64Inst) Add(ctx context.Context, val float64, opts ...instrument.AddOption) { - c := instrument.NewAddConfig(opts) +func (i *float64Inst) Add(ctx context.Context, val float64, opts ...metric.AddOption) { + c := metric.NewAddConfig(opts) i.aggregate(ctx, val, c.Attributes()) } -func (i *float64Inst) Record(ctx context.Context, val float64, opts ...instrument.RecordOption) { - c := instrument.NewRecordConfig(opts) +func (i *float64Inst) Record(ctx context.Context, val float64, opts ...metric.RecordOption) { + c := metric.NewRecordConfig(opts) i.aggregate(ctx, val, c.Attributes()) } @@ -242,7 +242,7 @@ type observablID[N int64 | float64] struct { } type float64Observable struct { - instrument.Float64Observable + metric.Float64Observable *observable[float64] embedded.Float64ObservableCounter @@ -250,9 +250,9 @@ type float64Observable struct { embedded.Float64ObservableGauge } -var _ instrument.Float64ObservableCounter = float64Observable{} -var _ instrument.Float64ObservableUpDownCounter = float64Observable{} -var _ instrument.Float64ObservableGauge = float64Observable{} +var _ metric.Float64ObservableCounter = float64Observable{} +var _ metric.Float64ObservableUpDownCounter = float64Observable{} +var _ metric.Float64ObservableGauge = float64Observable{} func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[float64]) float64Observable { return float64Observable{ @@ -261,7 +261,7 @@ func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name } type int64Observable struct { - instrument.Int64Observable + metric.Int64Observable *observable[int64] embedded.Int64ObservableCounter @@ -269,9 +269,9 @@ type int64Observable struct { embedded.Int64ObservableGauge } -var _ instrument.Int64ObservableCounter = int64Observable{} -var _ instrument.Int64ObservableUpDownCounter = int64Observable{} -var _ instrument.Int64ObservableGauge = int64Observable{} +var _ metric.Int64ObservableCounter = int64Observable{} +var _ metric.Int64ObservableUpDownCounter = int64Observable{} +var _ metric.Int64ObservableGauge = int64Observable{} func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[int64]) int64Observable { return int64Observable{ @@ -280,7 +280,7 @@ func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, } type observable[N int64 | float64] struct { - instrument.Observable + metric.Observable observablID[N] aggregators []internal.Aggregator[N] diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregator_example_test.go index f36d8262c5e..fdbb19650ff 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregator_example_test.go @@ -19,8 +19,8 @@ import ( "fmt" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -31,7 +31,7 @@ type meter struct { aggregations []metricdata.Aggregation } -func (p *meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { +func (p *meter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error) { // This is an example of how a meter would create an aggregator for a new // counter. At this point the provider would determine the aggregation and // temporality to used based on the Reader and View configuration. Assume @@ -47,7 +47,7 @@ func (p *meter) Int64Counter(string, ...instrument.Int64CounterOption) (instrume return count, nil } -func (p *meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { +func (p *meter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { // This is an example of how a meter would create an aggregator for a new // up-down counter. At this point the provider would determine the // aggregation and temporality to used based on the Reader and View @@ -64,7 +64,7 @@ func (p *meter) Int64UpDownCounter(string, ...instrument.Int64UpDownCounterOptio return upDownCount, nil } -func (p *meter) Int64Histogram(string, ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { +func (p *meter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { // This is an example of how a meter would create an aggregator for a new // histogram. At this point the provider would determine the aggregation // and temporality to used based on the Reader and View configuration. @@ -94,8 +94,8 @@ type inst struct { embedded.Int64Histogram } -func (inst) Add(context.Context, int64, ...instrument.AddOption) {} -func (inst) Record(context.Context, int64, ...instrument.RecordOption) {} +func (inst) Add(context.Context, int64, ...metric.AddOption) {} +func (inst) Record(context.Context, int64, ...metric.RecordOption) {} func Example() { m := meter{} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index fe74a73de70..d833bab40e8 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/internal" ) @@ -60,8 +59,8 @@ var _ metric.Meter = (*meter)(nil) // Int64Counter returns a new instrument identified by name and configured with // options. The instrument is used to synchronously record increasing int64 // measurements during a computational operation. -func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOption) (instrument.Int64Counter, error) { - cfg := instrument.NewInt64CounterConfig(options...) +func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { + cfg := metric.NewInt64CounterConfig(options...) const kind = InstrumentKindCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -69,8 +68,8 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64CounterOpti // Int64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // int64 measurements during a computational operation. -func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDownCounterOption) (instrument.Int64UpDownCounter, error) { - cfg := instrument.NewInt64UpDownCounterConfig(options...) +func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { + cfg := metric.NewInt64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -78,8 +77,8 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64UpDow // Int64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of int64 measurements during a computational operation. -func (m *meter) Int64Histogram(name string, options ...instrument.Int64HistogramOption) (instrument.Int64Histogram, error) { - cfg := instrument.NewInt64HistogramConfig(options...) +func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { + cfg := metric.NewInt64HistogramConfig(options...) const kind = InstrumentKindHistogram return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -87,8 +86,8 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Histogram // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObservableCounterOption) (instrument.Int64ObservableCounter, error) { - cfg := instrument.NewInt64ObservableCounterConfig(options...) +func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { + cfg := metric.NewInt64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -102,8 +101,8 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObservableUpDownCounterOption) (instrument.Int64ObservableUpDownCounter, error) { - cfg := instrument.NewInt64ObservableUpDownCounterConfig(options...) +func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { + cfg := metric.NewInt64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -117,8 +116,8 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument. // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. -func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObservableGaugeOption) (instrument.Int64ObservableGauge, error) { - cfg := instrument.NewInt64ObservableGaugeConfig(options...) +func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { + cfg := metric.NewInt64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge p := int64ObservProvider{m.int64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -132,8 +131,8 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs // Float64Counter returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record increasing // float64 measurements during a computational operation. -func (m *meter) Float64Counter(name string, options ...instrument.Float64CounterOption) (instrument.Float64Counter, error) { - cfg := instrument.NewFloat64CounterConfig(options...) +func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { + cfg := metric.NewFloat64CounterConfig(options...) const kind = InstrumentKindCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -141,8 +140,8 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Counter // Float64UpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to synchronously record // float64 measurements during a computational operation. -func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64UpDownCounterOption) (instrument.Float64UpDownCounter, error) { - cfg := instrument.NewFloat64UpDownCounterConfig(options...) +func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { + cfg := metric.NewFloat64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -150,8 +149,8 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64U // Float64Histogram returns a new instrument identified by name and configured // with options. The instrument is used to synchronously record the // distribution of float64 measurements during a computational operation. -func (m *meter) Float64Histogram(name string, options ...instrument.Float64HistogramOption) (instrument.Float64Histogram, error) { - cfg := instrument.NewFloat64HistogramConfig(options...) +func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { + cfg := metric.NewFloat64HistogramConfig(options...) const kind = InstrumentKindHistogram return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) } @@ -159,8 +158,8 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Histo // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObservableCounterOption) (instrument.Float64ObservableCounter, error) { - cfg := instrument.NewFloat64ObservableCounterConfig(options...) +func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { + cfg := metric.NewFloat64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -174,8 +173,8 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record // float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObservableUpDownCounterOption) (instrument.Float64ObservableUpDownCounter, error) { - cfg := instrument.NewFloat64ObservableUpDownCounterConfig(options...) +func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { + cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -189,8 +188,8 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. -func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObservableGaugeOption) (instrument.Float64ObservableGauge, error) { - cfg := instrument.NewFloat64ObservableGaugeConfig(options...) +func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { + cfg := metric.NewFloat64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge p := float64ObservProvider{m.float64IP} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) @@ -211,7 +210,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6 // returned if other instrument are provided. // // The returned Registration can be used to unregister f. -func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observable) (metric.Registration, error) { +func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { if len(insts) == 0 { // Don't allocate a observer if not needed. return noopRegister{}, nil @@ -222,7 +221,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Observab for _, inst := range insts { // Unwrap any global. if u, ok := inst.(interface { - Unwrap() instrument.Observable + Unwrap() metric.Observable }); ok { inst = u.Unwrap() } @@ -296,13 +295,13 @@ var ( errUnregObserver = errors.New("observable instrument not registered for callback") ) -func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, opts ...instrument.ObserveOption) { +func (r observer) ObserveFloat64(o metric.Float64Observable, v float64, opts ...metric.ObserveOption) { var oImpl float64Observable switch conv := o.(type) { case float64Observable: oImpl = conv case interface { - Unwrap() instrument.Observable + Unwrap() metric.Observable }: // Unwrap any global. async := conv.Unwrap() @@ -325,17 +324,17 @@ func (r observer) ObserveFloat64(o instrument.Float64Observable, v float64, opts ) return } - c := instrument.NewObserveConfig(opts) + c := metric.NewObserveConfig(opts) oImpl.observe(v, c.Attributes()) } -func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, opts ...instrument.ObserveOption) { +func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric.ObserveOption) { var oImpl int64Observable switch conv := o.(type) { case int64Observable: oImpl = conv case interface { - Unwrap() instrument.Observable + Unwrap() metric.Observable }: // Unwrap any global. async := conv.Unwrap() @@ -358,7 +357,7 @@ func (r observer) ObserveInt64(o instrument.Int64Observable, v int64, opts ...in ) return } - c := instrument.NewObserveConfig(opts) + c := metric.NewObserveConfig(opts) oImpl.observe(v, c.Attributes()) } @@ -431,7 +430,7 @@ func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) ( return newInt64Observable(p.scope, kind, name, desc, u, aggs), err } -func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []instrument.Int64Callback) { +func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []metric.Int64Callback) { if inst.observable == nil || len(inst.aggregators) == 0 { // Drop aggregator. return @@ -442,7 +441,7 @@ func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []in } } -func (p int64ObservProvider) callback(i int64Observable, f instrument.Int64Callback) func(context.Context) error { +func (p int64ObservProvider) callback(i int64Observable, f metric.Int64Callback) func(context.Context) error { inst := int64Observer{int64Observable: i} return func(ctx context.Context) error { return f(ctx, inst) } } @@ -452,8 +451,8 @@ type int64Observer struct { int64Observable } -func (o int64Observer) Observe(val int64, opts ...instrument.ObserveOption) { - c := instrument.NewObserveConfig(opts) +func (o int64Observer) Observe(val int64, opts ...metric.ObserveOption) { + c := metric.NewObserveConfig(opts) o.observe(val, c.Attributes()) } @@ -464,7 +463,7 @@ func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) return newFloat64Observable(p.scope, kind, name, desc, u, aggs), err } -func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []instrument.Float64Callback) { +func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []metric.Float64Callback) { if inst.observable == nil || len(inst.aggregators) == 0 { // Drop aggregator. return @@ -475,7 +474,7 @@ func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks } } -func (p float64ObservProvider) callback(i float64Observable, f instrument.Float64Callback) func(context.Context) error { +func (p float64ObservProvider) callback(i float64Observable, f metric.Float64Callback) func(context.Context) error { inst := float64Observer{float64Observable: i} return func(ctx context.Context) error { return f(ctx, inst) } } @@ -485,7 +484,7 @@ type float64Observer struct { float64Observable } -func (o float64Observer) Observe(val float64, opts ...instrument.ObserveOption) { - c := instrument.NewObserveConfig(opts) +func (o float64Observer) Observe(val float64, opts ...metric.ObserveOption) { + c := metric.NewObserveConfig(opts) o.observe(val, c.Attributes()) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 5276f1ae04c..f68f345103e 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -170,7 +169,7 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { attrs := attribute.NewSet(attribute.String("name", "alice")) - opt := instrument.WithAttributeSet(attrs) + opt := metric.WithAttributeSet(attrs) testCases := []struct { name string fn func(*testing.T, metric.Meter) @@ -179,11 +178,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Int64Observer) error { + cback := func(_ context.Context, o metric.Int64Observer) error { o.Observe(4, opt) return nil } - ctr, err := m.Int64ObservableCounter("aint", instrument.WithInt64Callback(cback)) + ctr, err := m.Int64ObservableCounter("aint", metric.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 3) @@ -206,11 +205,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Int64Observer) error { + cback := func(_ context.Context, o metric.Int64Observer) error { o.Observe(4, opt) return nil } - ctr, err := m.Int64ObservableUpDownCounter("aint", instrument.WithInt64Callback(cback)) + ctr, err := m.Int64ObservableUpDownCounter("aint", metric.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 11) @@ -233,11 +232,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Int64Observer) error { + cback := func(_ context.Context, o metric.Int64Observer) error { o.Observe(4, opt) return nil } - gauge, err := m.Int64ObservableGauge("agauge", instrument.WithInt64Callback(cback)) + gauge, err := m.Int64ObservableGauge("agauge", metric.WithInt64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(gauge, 11) @@ -258,11 +257,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Float64Observer) error { + cback := func(_ context.Context, o metric.Float64Observer) error { o.Observe(4, opt) return nil } - ctr, err := m.Float64ObservableCounter("afloat", instrument.WithFloat64Callback(cback)) + ctr, err := m.Float64ObservableCounter("afloat", metric.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 3) @@ -285,11 +284,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Float64Observer) error { + cback := func(_ context.Context, o metric.Float64Observer) error { o.Observe(4, opt) return nil } - ctr, err := m.Float64ObservableUpDownCounter("afloat", instrument.WithFloat64Callback(cback)) + ctr, err := m.Float64ObservableUpDownCounter("afloat", metric.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 11) @@ -312,11 +311,11 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o instrument.Float64Observer) error { + cback := func(_ context.Context, o metric.Float64Observer) error { o.Observe(4, opt) return nil } - gauge, err := m.Float64ObservableGauge("agauge", instrument.WithFloat64Callback(cback)) + gauge, err := m.Float64ObservableGauge("agauge", metric.WithFloat64Callback(cback)) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(gauge, 11) @@ -490,7 +489,7 @@ func TestRegisterNonSDKObserverErrors(t *testing.T) { mp := NewMeterProvider(WithReader(rdr)) meter := mp.Meter("scope") - type obsrv struct{ instrument.Observable } + type obsrv struct{ metric.Observable } o := obsrv{} _, err := meter.RegisterCallback( @@ -547,9 +546,9 @@ func TestCallbackObserverNonRegistered(t *testing.T) { fCtr, err := m2.Float64ObservableCounter("float64 ctr") require.NoError(t, err) - type int64Obsrv struct{ instrument.Int64Observable } + type int64Obsrv struct{ metric.Int64Observable } int64Foreign := int64Obsrv{} - type float64Obsrv struct{ instrument.Float64Observable } + type float64Obsrv struct{ metric.Float64Observable } float64Foreign := float64Obsrv{} _, err = m1.RegisterCallback( @@ -887,11 +886,11 @@ func TestAttributeFilter(t *testing.T) { func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { fooBar := attribute.NewSet(attribute.String("foo", "bar")) - withFooBar := instrument.WithAttributeSet(fooBar) + withFooBar := metric.WithAttributeSet(fooBar) v1 := attribute.NewSet(attribute.String("foo", "bar"), attribute.Int("version", 1)) - withV1 := instrument.WithAttributeSet(v1) + withV1 := metric.WithAttributeSet(v1) v2 := attribute.NewSet(attribute.String("foo", "bar"), attribute.Int("version", 2)) - withV2 := instrument.WithAttributeSet(v2) + withV2 := metric.WithAttributeSet(v2) testcases := []struct { name string register func(t *testing.T, mtr metric.Meter) error @@ -1273,10 +1272,10 @@ func TestObservableExample(t *testing.T) { meter := mp.Meter(scopeName) observations := make(map[attribute.Set]int64) - _, err := meter.Int64ObservableCounter(instName, instrument.WithInt64Callback( - func(_ context.Context, o instrument.Int64Observer) error { + _, err := meter.Int64ObservableCounter(instName, metric.WithInt64Callback( + func(_ context.Context, o metric.Int64Observer) error { for attrSet, val := range observations { - o.Observe(val, instrument.WithAttributeSet(attrSet)) + o.Observe(val, metric.WithAttributeSet(attrSet)) } return nil }, @@ -1477,21 +1476,21 @@ func TestObservableExample(t *testing.T) { } var ( - aiCounter instrument.Int64ObservableCounter - aiUpDownCounter instrument.Int64ObservableUpDownCounter - aiGauge instrument.Int64ObservableGauge + aiCounter metric.Int64ObservableCounter + aiUpDownCounter metric.Int64ObservableUpDownCounter + aiGauge metric.Int64ObservableGauge - afCounter instrument.Float64ObservableCounter - afUpDownCounter instrument.Float64ObservableUpDownCounter - afGauge instrument.Float64ObservableGauge + afCounter metric.Float64ObservableCounter + afUpDownCounter metric.Float64ObservableUpDownCounter + afGauge metric.Float64ObservableGauge - siCounter instrument.Int64Counter - siUpDownCounter instrument.Int64UpDownCounter - siHistogram instrument.Int64Histogram + siCounter metric.Int64Counter + siUpDownCounter metric.Int64UpDownCounter + siHistogram metric.Int64Histogram - sfCounter instrument.Float64Counter - sfUpDownCounter instrument.Float64UpDownCounter - sfHistogram instrument.Float64Histogram + sfCounter metric.Float64Counter + sfUpDownCounter metric.Float64UpDownCounter + sfHistogram metric.Float64Histogram ) func BenchmarkInstrumentCreation(b *testing.B) { From 180b35513ad6d79019230020e26549d790996bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 27 Apr 2023 20:39:09 +0200 Subject: [PATCH 511/886] Move readFile and execCommand to seperate files (#4015) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- sdk/resource/host_id.go | 23 ----------------------- sdk/resource/host_id_exec.go | 29 +++++++++++++++++++++++++++++ sdk/resource/host_id_readfile.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 sdk/resource/host_id_exec.go create mode 100644 sdk/resource/host_id_readfile.go diff --git a/sdk/resource/host_id.go b/sdk/resource/host_id.go index 39e35f4f2bf..b8e934d4f8a 100644 --- a/sdk/resource/host_id.go +++ b/sdk/resource/host_id.go @@ -17,8 +17,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" - "os" - "os/exec" "strings" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" @@ -38,27 +36,6 @@ type fileReader func(string) (string, error) type commandExecutor func(string, ...string) (string, error) -// nolint: unused // This is used by the hostReaderBSD, gated by build tags. -func readFile(filename string) (string, error) { - b, err := os.ReadFile(filename) - if err != nil { - return "", nil - } - - return string(b), nil -} - -// nolint: unused // This is used by the hostReaderBSD, gated by build tags. -func execCommand(name string, arg ...string) (string, error) { - cmd := exec.Command(name, arg...) - b, err := cmd.Output() - if err != nil { - return "", err - } - - return string(b), nil -} - // hostIDReaderBSD implements hostIDReader. type hostIDReaderBSD struct { execCommand commandExecutor diff --git a/sdk/resource/host_id_exec.go b/sdk/resource/host_id_exec.go new file mode 100644 index 00000000000..0080fc6b692 --- /dev/null +++ b/sdk/resource/host_id_exec.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build bsd || darwin + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import "os/exec" + +func execCommand(name string, arg ...string) (string, error) { + cmd := exec.Command(name, arg...) + b, err := cmd.Output() + if err != nil { + return "", err + } + + return string(b), nil +} diff --git a/sdk/resource/host_id_readfile.go b/sdk/resource/host_id_readfile.go new file mode 100644 index 00000000000..df4dc92c195 --- /dev/null +++ b/sdk/resource/host_id_readfile.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build bsd || linux + +package resource // import "go.opentelemetry.io/otel/sdk/resource" + +import "os" + +func readFile(filename string) (string, error) { + b, err := os.ReadFile(filename) + if err != nil { + return "", nil + } + + return string(b), nil +} From 8e76ab23b495ce2411d936b497fb8f1a9b35f974 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 28 Apr 2023 07:48:08 -0700 Subject: [PATCH 512/886] Release v1.15.0/v0.38.0 (#4035) * Bump versions * Prepare stable-v1 for version v1.15.0 * Prepare experimental-metrics for version v0.38.0 * Fix otlpmetric tests Check pre 1.0 as well * Update the chagelog --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 4 ++-- bridge/opentracing/test/go.mod | 6 +++--- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ .../otlp/otlpmetric/internal/header_test.go | 2 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- .../otlpmetric/otlpmetrichttp/client_test.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 8 ++++---- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 38 files changed, 138 insertions(+), 135 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 866c005274b..6a617aba787 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.15.0/0.38.0] 2023-04-27 + ### Added - The `go.opentelemetry.io/otel/metric/embedded` package. (#3916) @@ -2435,7 +2437,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0-rc.2...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0...HEAD +[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 [1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 [1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 [1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 8eeab3e4c46..a07781255dc 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v0.38.0 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index a00ad612f97..bede491b574 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v0.38.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.38.0 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 9d58070e2a3..51c2fd48fde 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 219bbc595fe..017fded5e71 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/bridge/opentracing v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/bridge/opentracing v1.15.0 google.golang.org/grpc v1.54.0 ) @@ -23,7 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 22860c0bb19..6642e901981 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 2414fb2745c..1ac9d6382f4 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/jaeger v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/jaeger v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 1c1a5d97d28..c21dc4ed79c 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index be51c2b1931..1b3aef0114f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0-rc.2 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0-rc.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/bridge/opencensus v0.38.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v0.38.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 3518da6e2b1..d2111728dc6 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 google.golang.org/grpc v1.54.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 5cf3eaf6340..631f029b260 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 85213c76b0c..0c51fc53afe 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 3a4ce929503..fdbd5efc024 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/prometheus v0.38.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 1eb3aaf8375..ea20b4d0b83 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/zipkin v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/zipkin v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index ebaa2c93ca8..088632c7b6e 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,9 +7,9 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 1c4717e5a2d..1b6224f03a2 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v0.38.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/internal/header_test.go b/exporters/otlp/otlpmetric/internal/header_test.go index d93340fc0d6..32fc4952970 100644 --- a/exporters/otlp/otlpmetric/internal/header_test.go +++ b/exporters/otlp/otlpmetric/internal/header_test.go @@ -21,5 +21,5 @@ import ( ) func TestGetUserAgentHeader(t *testing.T) { - require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", GetUserAgentHeader()) + require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", GetUserAgentHeader()) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 0127811a5eb..06e5fee15e9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -170,7 +170,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() - require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", got) + require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 803752437b8..81e604e3e5e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.54.0 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index a92801e4c40..ec6bdd75916 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -75,7 +75,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() - require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", got) + require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9fbc9f381fe..2c8ed354f50 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/sdk v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index 952e6c02226..bb5b91bfd1e 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "1.15.0-rc.2" + return "0.38.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e2161ccba84..13a3f7a3668 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 0e76a374d9e..0336fae4e11 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 21971b35253..67b5e925dee 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0-rc.2 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 1a1977e975c..f9d7d0ae41e 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.15.0-rc.2" + return "1.15.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 4ea8a07170a..b5fbe70bc6b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.15.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 8fb1aa0bf6a..44a63e570ea 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk/metric v0.38.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/sdk/metric v0.38.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.15.0-rc.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/metric v0.38.0 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 8a86717b180..a19ea2d158e 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 59d1776381f..b03e1258daf 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,9 +8,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/go.mod b/go.mod index 12df1ac968b..e7bbd551ad8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel/trace v1.15.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 3dfe0e69125..5a310362937 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 3db48023419..5c5a7d88716 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/trace v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/trace v1.15.0 golang.org/x/sys v0.7.0 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 3313a773433..15bef8d1f21 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 - go.opentelemetry.io/otel/metric v1.15.0-rc.2 - go.opentelemetry.io/otel/sdk v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel/metric v0.38.0 + go.opentelemetry.io/otel/sdk v1.15.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0-rc.2 // indirect + go.opentelemetry.io/otel/trace v1.15.0 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/version.go b/sdk/version.go index 54a7170d984..d96ccf9cd58 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.15.0-rc.2" + return "1.15.0" } diff --git a/trace/go.mod b/trace/go.mod index 66c156ebe53..55e3b102ce4 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0-rc.2 + go.opentelemetry.io/otel v1.15.0 ) require ( diff --git a/version.go b/version.go index 6ceb10c8d7c..c8748b5deaa 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.15.0-rc.2" + return "1.15.0" } diff --git a/versions.yaml b/versions.yaml index 762be8b6d33..66fc74dd933 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.15.0-rc.2 + version: v1.15.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -35,7 +35,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.38.0-rc.2 + version: v0.38.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 7c552505a9cb0462d6859cec18bfe9cbac6e38c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 30 Apr 2023 06:44:06 -0700 Subject: [PATCH 513/886] Bump benchmark-action/github-action-benchmark from 1.15.0 to 1.17.0 (#4042) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.15.0 to 1.17.0. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.15.0...v1.17.0) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 385f84f5165..705b17f7d14 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,7 +22,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.15.0 + uses: benchmark-action/github-action-benchmark@v1.17.0 with: name: Benchmarks tool: 'go' From dde1930477d26bb9ce5207666f599c4e528c0bca Mon Sep 17 00:00:00 2001 From: Ashvitha Date: Mon, 1 May 2023 11:07:05 -0400 Subject: [PATCH 514/886] Remove unused imports in host_id_bsd.go (#4041) * remove unused imports in host_id_bsd.go * Add changelog entry --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 4 ++++ sdk/resource/host_id_bsd.go | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a617aba787..d4a0ae58374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) + ## [1.15.0/0.38.0] 2023-04-27 ### Added diff --git a/sdk/resource/host_id_bsd.go b/sdk/resource/host_id_bsd.go index 0037b65da45..1778bbacf05 100644 --- a/sdk/resource/host_id_bsd.go +++ b/sdk/resource/host_id_bsd.go @@ -17,11 +17,6 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" -import ( - "errors" - "strings" -) - var platformHostIDReader hostIDReader = &hostIDReaderBSD{ execCommand: execCommand, readFile: readFile, From fc96138629cecdcc04dd5cb65559ead9e485d927 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 2 May 2023 10:18:20 -0700 Subject: [PATCH 515/886] Release v1.15.1/v0.38.1 (#4046) * Bump versions * Prepare stable-v1 for version v1.15.1 * Prepare experimental-metrics for version v0.38.1 * Update changelog --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 4 ++-- bridge/opentracing/test/go.mod | 6 +++--- example/fib/go.mod | 8 ++++---- example/jaeger/go.mod | 8 ++++---- example/namedtracer/go.mod | 8 ++++---- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 8 ++++---- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 8 ++++---- exporters/jaeger/go.mod | 6 +++--- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 6 +++--- exporters/zipkin/go.mod | 6 +++--- go.mod | 2 +- metric/go.mod | 4 ++-- sdk/go.mod | 4 ++-- sdk/metric/go.mod | 8 ++++---- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 35 files changed, 135 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a0ae58374..7630a4f33ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.15.1/0.38.1] 2023-05-02 + ### Fixed - Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041) @@ -2441,7 +2443,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.1...HEAD +[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 [1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 [1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 [1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a07781255dc..519ca7d8ada 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index bede491b574..ff6c4d4ae81 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/bridge/opencensus v0.38.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.38.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.38.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/sdk/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 51c2fd48fde..74034deeeb6 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 017fded5e71..978bba3be78 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/bridge/opentracing v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/bridge/opentracing v1.15.1 google.golang.org/grpc v1.54.0 ) @@ -23,7 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 6642e901981..bb6a3cc8add 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 1ac9d6382f4..1715c2742f9 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,15 +9,15 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/jaeger v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/jaeger v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index c21dc4ed79c..ad6b00abd2d 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,10 +9,10 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 1b3aef0114f..70ae268c60b 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/bridge/opencensus v0.38.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/bridge/opencensus v0.38.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.38.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d2111728dc6..3b2643148d3 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 google.golang.org/grpc v1.54.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 631f029b260..9f55560dc07 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 0c51fc53afe..b1e21e4289e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/prometheus v0.38.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/sdk v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index fdbd5efc024..d6f4ff45d47 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/prometheus v0.38.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/prometheus v0.38.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index ea20b4d0b83..17706bb03dc 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,10 +9,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/zipkin v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/zipkin v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 088632c7b6e..936c7c28177 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,9 +7,9 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 1b6224f03a2..26259ef8b9f 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 81e604e3e5e..0b504d1f698 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.54.0 @@ -26,8 +26,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/sdk v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 2c8ed354f50..7668ea6dc95 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,11 +6,11 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -24,8 +24,8 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/sdk v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index bb5b91bfd1e..1e77f309b3a 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.38.0" + return "0.38.1" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 13a3f7a3668..a9ddff0ecda 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 0336fae4e11..7d6d881f445 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 67b5e925dee..33803beedfa 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index f9d7d0ae41e..851e8d1b062 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.15.0" + return "1.15.1" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index b5fbe70bc6b..69d9c0696e5 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.15.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 44a63e570ea..b92a804317c 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/sdk/metric v0.38.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/sdk/metric v0.38.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index a19ea2d158e..6abcb2da833 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index b03e1258daf..53892667f87 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,9 +8,9 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/sdk v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/go.mod b/go.mod index e7bbd551ad8..af21177ff74 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel/trace v1.15.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 5a310362937..d89a7d706f6 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel v1.15.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 5c5a7d88716..ddef1c9c42d 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/trace v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/trace v1.15.1 golang.org/x/sys v0.7.0 ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 15bef8d1f21..0c5c31be963 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 - go.opentelemetry.io/otel/metric v0.38.0 - go.opentelemetry.io/otel/sdk v1.15.0 + go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel/metric v0.38.1 + go.opentelemetry.io/otel/sdk v1.15.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.0 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/version.go b/sdk/version.go index d96ccf9cd58..2adddad8601 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.15.0" + return "1.15.1" } diff --git a/trace/go.mod b/trace/go.mod index 55e3b102ce4..090c2a71295 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.0 + go.opentelemetry.io/otel v1.15.1 ) require ( diff --git a/version.go b/version.go index c8748b5deaa..6c7fe114bb9 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.15.0" + return "1.15.1" } diff --git a/versions.yaml b/versions.yaml index 66fc74dd933..b49ec10296b 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.15.0 + version: v1.15.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -35,7 +35,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.38.0 + version: v0.38.1 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 5814858e4e1e052a387652b74986ca477807f309 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 2 May 2023 11:00:42 -0700 Subject: [PATCH 516/886] Revert "Move the metric API back to experimental-metrics (#3987)" (#4038) * Revert "Move the metric API back to experimental-metrics (#3987)" This reverts commit 51345570a0e851efc4fd6425f310bf19e78531ab. * Add change to changelog --- CHANGELOG.md | 5 +++++ versions.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7630a4f33ad..a1ea65e9ab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. + This stages the metric API to be released as a stable module. (#4038) + ## [1.15.1/0.38.1] 2023-05-02 ### Fixed diff --git a/versions.yaml b/versions.yaml index b49ec10296b..6af54af5eeb 100644 --- a/versions.yaml +++ b/versions.yaml @@ -32,6 +32,7 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - go.opentelemetry.io/otel/exporters/zipkin + - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: @@ -44,7 +45,6 @@ module-sets: - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 17903bcdb6639836804ce0c1364814b59ddc5359 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 2 May 2023 11:15:39 -0700 Subject: [PATCH 517/886] Revert "Move global metric back to otel/metric/global for minor release (#3986)" (#4039) * Revert "Move global metric back to `otel/metric/global` for minor release (#3986)" This reverts commit 8dba38e02f16d29a315d2e6890d21f763677831a. * Add changes to changelog * Fix versions and go mod tidy * Run go-mod-tidy --- CHANGELOG.md | 12 +++ bridge/opentracing/go.mod | 3 + bridge/opentracing/test/go.mod | 3 + example/fib/go.mod | 3 + example/jaeger/go.mod | 3 + example/namedtracer/go.mod | 3 + example/otel-collector/go.mod | 3 + example/passthrough/go.mod | 3 + example/zipkin/go.mod | 3 + exporters/jaeger/go.mod | 3 + .../otlpmetric/otlpmetricgrpc/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlpmetric/otlpmetrichttp/example_test.go | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 3 + exporters/otlp/otlptrace/otlptracegrpc/go.mod | 3 + exporters/otlp/otlptrace/otlptracehttp/go.mod | 3 + exporters/stdout/stdouttrace/go.mod | 3 + exporters/zipkin/go.mod | 3 + go.mod | 3 + .../global/instruments.go | 27 +++--- .../global/instruments_test.go | 0 {metric/internal => internal}/global/meter.go | 10 +-- .../global/meter_test.go | 2 +- .../global/meter_types_test.go | 2 +- internal/global/state.go | 45 +++++++++- internal/global/state_test.go | 58 +++++++++++++ internal/global/util_test.go | 2 + metric/global/metric.go => metric.go | 18 ++-- metric/example_test.go | 8 +- metric/internal/global/state.go | 68 --------------- metric/internal/global/state_test.go | 87 ------------------- .../global/metric_test.go => metric_test.go | 4 +- sdk/go.mod | 3 + sdk/metric/example_test.go | 4 +- sdk/metric/meter_test.go | 7 +- trace/go.mod | 2 + 37 files changed, 210 insertions(+), 206 deletions(-) rename {metric/internal => internal}/global/instruments.go (94%) rename {metric/internal => internal}/global/instruments_test.go (100%) rename {metric/internal => internal}/global/meter.go (98%) rename {metric/internal => internal}/global/meter_test.go (99%) rename {metric/internal => internal}/global/meter_types_test.go (98%) rename metric/global/metric.go => metric.go (69%) delete mode 100644 metric/internal/global/state.go delete mode 100644 metric/internal/global/state_test.go rename metric/global/metric_test.go => metric_test.go (93%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1ea65e9ab4..40fb958cd33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,23 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) + - Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`. + - Use `GetMeterProivder` for a global `metric.MeterProvider`. + - Use `SetMeterProivder` to set the global `metric.MeterProvider`. + ### Changed - Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set. This stages the metric API to be released as a stable module. (#4038) +### Removed + +- The `go.opentelemetry.io/otel/metric/global` package is removed. + Use `go.opentelemetry.io/otel` instead. (#4039) + ## [1.15.1/0.38.1] 2023-05-02 ### Fixed diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 74034deeeb6..702d1494036 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -18,5 +18,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 978bba3be78..a333b58894c 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -23,6 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -31,3 +32,5 @@ require ( google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/example/fib/go.mod b/example/fib/go.mod index bb6a3cc8add..0b3b6be5e76 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -12,6 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect ) @@ -22,3 +23,5 @@ replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters replace go.opentelemetry.io/otel/sdk => ../../sdk replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 1715c2742f9..02f7f9b92c9 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -17,8 +17,11 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index ad6b00abd2d..39307d9a832 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -17,9 +17,12 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 3b2643148d3..e6eaa803177 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -23,6 +23,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -38,3 +39,5 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 9f55560dc07..2532acd779a 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -12,6 +12,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect ) @@ -22,3 +23,5 @@ replace ( ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 17706bb03dc..065691c0248 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -19,7 +19,10 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 936c7c28177..e7a9c677c29 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -16,6 +16,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -25,3 +26,5 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go index f7630760678..8307b51fc69 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/example_test.go @@ -17,8 +17,8 @@ package otlpmetricgrpc_test import ( "context" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 0b504d1f698..d9e5f17dbf5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/otel v1.15.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 - go.opentelemetry.io/otel/metric v0.38.1 go.opentelemetry.io/otel/sdk/metric v0.38.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -26,6 +25,7 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/otel/sdk v1.15.1 // indirect go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go index d3397167c70..398c834a5f1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/example_test.go @@ -17,8 +17,8 @@ package otlpmetrichttp_test import ( "context" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -35,7 +35,7 @@ func Example() { panic(err) } }() - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) // From here, the meterProvider can be used by instrumentation to collect // telemetry. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7668ea6dc95..b7301f20bdb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/otel v1.15.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 - go.opentelemetry.io/otel/metric v0.38.1 go.opentelemetry.io/otel/sdk/metric v0.38.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 @@ -24,6 +23,7 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/otel/sdk v1.15.1 // indirect go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index a9ddff0ecda..659f4a03007 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -22,6 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect @@ -36,3 +37,5 @@ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/trace => ../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7d6d881f445..a29a11772b9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -23,6 +23,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect @@ -39,3 +40,5 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 33803beedfa..28f82125ead 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -21,6 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect @@ -38,3 +39,5 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/trace => ../../../../trace replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry + +replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 6abcb2da833..5af8e60d1eb 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -19,8 +19,11 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../../../trace + +replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 53892667f87..ead81625513 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -16,6 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) @@ -25,3 +26,5 @@ replace go.opentelemetry.io/otel/trace => ../../trace replace go.opentelemetry.io/otel => ../.. replace go.opentelemetry.io/otel/sdk => ../../sdk + +replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/go.mod b/go.mod index af21177ff74..d2731a9ff1c 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 + go.opentelemetry.io/otel/metric v0.38.1 go.opentelemetry.io/otel/trace v1.15.1 ) @@ -17,3 +18,5 @@ require ( ) replace go.opentelemetry.io/otel/trace => ./trace + +replace go.opentelemetry.io/otel/metric => ./metric diff --git a/metric/internal/global/instruments.go b/internal/global/instruments.go similarity index 94% rename from metric/internal/global/instruments.go rename to internal/global/instruments.go index a3b898bfd5b..a33eded872a 100644 --- a/metric/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -12,13 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" "sync/atomic" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" ) @@ -44,7 +43,7 @@ var _ metric.Float64ObservableCounter = (*afCounter)(nil) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -73,7 +72,7 @@ var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -102,7 +101,7 @@ var _ metric.Float64ObservableGauge = (*afGauge)(nil) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -131,7 +130,7 @@ var _ metric.Int64ObservableCounter = (*aiCounter)(nil) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -160,7 +159,7 @@ var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -189,7 +188,7 @@ var _ metric.Int64ObservableGauge = (*aiGauge)(nil) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -217,7 +216,7 @@ var _ metric.Float64Counter = (*sfCounter)(nil) func (i *sfCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64Counter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -243,7 +242,7 @@ var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) func (i *sfUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64UpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -269,7 +268,7 @@ var _ metric.Float64Histogram = (*sfHistogram)(nil) func (i *sfHistogram) setDelegate(m metric.Meter) { ctr, err := m.Float64Histogram(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -295,7 +294,7 @@ var _ metric.Int64Counter = (*siCounter)(nil) func (i *siCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64Counter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -321,7 +320,7 @@ var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) func (i *siUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64UpDownCounter(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) @@ -347,7 +346,7 @@ var _ metric.Int64Histogram = (*siHistogram)(nil) func (i *siHistogram) setDelegate(m metric.Meter) { ctr, err := m.Int64Histogram(i.name, i.opts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) return } i.delegate.Store(ctr) diff --git a/metric/internal/global/instruments_test.go b/internal/global/instruments_test.go similarity index 100% rename from metric/internal/global/instruments_test.go rename to internal/global/instruments_test.go diff --git a/metric/internal/global/meter.go b/internal/global/meter.go similarity index 98% rename from metric/internal/global/meter.go rename to internal/global/meter.go index a00b99085c4..0097db478c6 100644 --- a/metric/internal/global/meter.go +++ b/internal/global/meter.go @@ -12,14 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "container/list" "sync" "sync/atomic" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" ) @@ -37,11 +36,6 @@ type meterProvider struct { delegate metric.MeterProvider } -type il struct { - name string - version string -} - // setDelegate configures p to delegate all MeterProvider functionality to // provider. // @@ -340,7 +334,7 @@ func (c *registration) setDelegate(m metric.Meter) { reg, err := m.RegisterCallback(c.function, insts...) if err != nil { - otel.Handle(err) + GetErrorHandler().Handle(err) } c.unreg = reg.Unregister diff --git a/metric/internal/global/meter_test.go b/internal/global/meter_test.go similarity index 99% rename from metric/internal/global/meter_test.go rename to internal/global/meter_test.go index 5bae7acc453..b91f4fd57c8 100644 --- a/metric/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/metric/internal/global/meter_types_test.go b/internal/global/meter_types_test.go similarity index 98% rename from metric/internal/global/meter_types_test.go rename to internal/global/meter_types_test.go index a91a26a4915..9929e12353d 100644 --- a/metric/internal/global/meter_types_test.go +++ b/internal/global/meter_types_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/internal/global" +package global // import "go.opentelemetry.io/otel/internal/global" import ( "context" diff --git a/internal/global/state.go b/internal/global/state.go index 1ad38f828ec..7985005bcb6 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -19,6 +19,7 @@ import ( "sync" "sync/atomic" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -31,14 +32,20 @@ type ( propagatorsHolder struct { tm propagation.TextMapPropagator } + + meterProviderHolder struct { + mp metric.MeterProvider + } ) var ( - globalTracer = defaultTracerValue() - globalPropagators = defaultPropagatorsValue() + globalTracer = defaultTracerValue() + globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() delegateTraceOnce sync.Once delegateTextMapPropagatorOnce sync.Once + delegateMeterOnce sync.Once ) // TracerProvider is the internal implementation for global.TracerProvider. @@ -102,6 +109,34 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { globalPropagators.Store(propagatorsHolder{tm: p}) } +// MeterProvider is the internal implementation for global.MeterProvider. +func MeterProvider() metric.MeterProvider { + return globalMeterProvider.Load().(meterProviderHolder).mp +} + +// SetMeterProvider is the internal implementation for global.SetMeterProvider. +func SetMeterProvider(mp metric.MeterProvider) { + current := MeterProvider() + if _, cOk := current.(*meterProvider); cOk { + if _, mpOk := mp.(*meterProvider); mpOk && current == mp { + // Do not assign the default delegating MeterProvider to delegate + // to itself. + Error( + errors.New("no delegate configured in meter provider"), + "Setting meter provider to it's current value. No delegate will be configured", + ) + return + } + } + + delegateMeterOnce.Do(func() { + if def, ok := current.(*meterProvider); ok { + def.setDelegate(mp) + } + }) + globalMeterProvider.Store(meterProviderHolder{mp: mp}) +} + func defaultTracerValue() *atomic.Value { v := &atomic.Value{} v.Store(tracerProviderHolder{tp: &tracerProvider{}}) @@ -113,3 +148,9 @@ func defaultPropagatorsValue() *atomic.Value { v.Store(propagatorsHolder{tm: newTextMapPropagator()}) return v } + +func defaultMeterProvider() *atomic.Value { + v := &atomic.Value{} + v.Store(meterProviderHolder{mp: &meterProvider{}}) + return v +} diff --git a/internal/global/state_test.go b/internal/global/state_test.go index f26f9d8c5a4..93bf6b8aae2 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -19,6 +19,8 @@ import ( "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" ) @@ -29,6 +31,12 @@ type nonComparableTracerProvider struct { nonComparable func() //nolint:structcheck,unused // This is not called. } +type nonComparableMeterProvider struct { + metric.MeterProvider + + nonComparable func() //nolint:structcheck,unused // This is not called. +} + func TestSetTracerProvider(t *testing.T) { t.Run("Set With default is a noop", func(t *testing.T) { ResetForTest(t) @@ -125,3 +133,53 @@ func TestSetTextMapPropagator(t *testing.T) { assert.NotPanics(t, func() { SetTextMapPropagator(prop) }) }) } + +func TestSetMeterProvider(t *testing.T) { + t.Run("Set With default is a noop", func(t *testing.T) { + ResetForTest(t) + + SetMeterProvider(MeterProvider()) + + mp, ok := MeterProvider().(*meterProvider) + if !ok { + t.Fatal("Global MeterProvider should be the default meter provider") + } + + if mp.delegate != nil { + t.Fatal("meter provider should not delegate when setting itself") + } + }) + + t.Run("First Set() should replace the delegate", func(t *testing.T) { + ResetForTest(t) + + SetMeterProvider(noop.NewMeterProvider()) + + _, ok := MeterProvider().(*meterProvider) + if ok { + t.Fatal("Global MeterProvider was not changed") + } + }) + + t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { + ResetForTest(t) + + mp := MeterProvider() + + SetMeterProvider(noop.NewMeterProvider()) + + dmp := mp.(*meterProvider) + + if dmp.delegate == nil { + t.Fatal("The delegated meter providers should have a delegate") + } + }) + + t.Run("non-comparable types should not panic", func(t *testing.T) { + ResetForTest(t) + + mp := nonComparableMeterProvider{} + SetMeterProvider(mp) + assert.NotPanics(t, func() { SetMeterProvider(mp) }) + }) +} diff --git a/internal/global/util_test.go b/internal/global/util_test.go index d0bca92f6c6..bc88508184c 100644 --- a/internal/global/util_test.go +++ b/internal/global/util_test.go @@ -25,7 +25,9 @@ func ResetForTest(t testing.TB) { t.Cleanup(func() { globalTracer = defaultTracerValue() globalPropagators = defaultPropagatorsValue() + globalMeterProvider = defaultMeterProvider() delegateTraceOnce = sync.Once{} delegateTextMapPropagatorOnce = sync.Once{} + delegateMeterOnce = sync.Once{} }) } diff --git a/metric/global/metric.go b/metric.go similarity index 69% rename from metric/global/metric.go rename to metric.go index 2723df2925f..f955171951f 100644 --- a/metric/global/metric.go +++ b/metric.go @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/global" +package otel // import "go.opentelemetry.io/otel" import ( + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/internal/global" ) // Meter returns a Meter from the global MeterProvider. The name must be the @@ -32,14 +32,18 @@ import ( // the new MeterProvider. // // This is short for GetMeterProvider().Meter(name). -func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter { - return MeterProvider().Meter(instrumentationName, opts...) +func Meter(name string, opts ...metric.MeterOption) metric.Meter { + return GetMeterProvider().Meter(name, opts...) } -// MeterProvider returns the registered global meter provider. +// GetMeterProvider returns the registered global meter provider. // -// If no global MeterProvider has been registered, a No-op MeterProvider implementation is returned. When a global MeterProvider is registered for the first time, the returned MeterProvider, and all the Meters it has created or will create, are recreated automatically from the new MeterProvider. -func MeterProvider() metric.MeterProvider { +// If no global GetMeterProvider has been registered, a No-op GetMeterProvider +// implementation is returned. When a global GetMeterProvider is registered for +// the first time, the returned GetMeterProvider, and all the Meters it has +// created or will create, are recreated automatically from the new +// GetMeterProvider. +func GetMeterProvider() metric.MeterProvider { return global.MeterProvider() } diff --git a/metric/example_test.go b/metric/example_test.go index 13cd22d48d8..c1f67a1af18 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -20,14 +20,14 @@ import ( "runtime" "time" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" ) func ExampleMeter_synchronous() { // Create a histogram using the global MeterProvider. - workDuration, err := global.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( + workDuration, err := otel.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( "workDuration", metric.WithUnit("ms")) if err != nil { @@ -43,7 +43,7 @@ func ExampleMeter_synchronous() { } func ExampleMeter_asynchronous_single() { - meter := global.Meter("go.opentelemetry.io/otel/metric#AsyncExample") + meter := otel.Meter("go.opentelemetry.io/otel/metric#AsyncExample") _, err := meter.Int64ObservableGauge( "DiskUsage", @@ -73,7 +73,7 @@ func ExampleMeter_asynchronous_single() { } func ExampleMeter_asynchronous_multiple() { - meter := global.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") + meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") diff --git a/metric/internal/global/state.go b/metric/internal/global/state.go deleted file mode 100644 index 47c0d787d8a..00000000000 --- a/metric/internal/global/state.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// htmp://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "errors" - "sync" - "sync/atomic" - - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/metric" -) - -var ( - globalMeterProvider = defaultMeterProvider() - - delegateMeterOnce sync.Once -) - -type meterProviderHolder struct { - mp metric.MeterProvider -} - -// MeterProvider is the internal implementation for global.MeterProvider. -func MeterProvider() metric.MeterProvider { - return globalMeterProvider.Load().(meterProviderHolder).mp -} - -// SetMeterProvider is the internal implementation for global.SetMeterProvider. -func SetMeterProvider(mp metric.MeterProvider) { - current := MeterProvider() - if _, cOk := current.(*meterProvider); cOk { - if _, mpOk := mp.(*meterProvider); mpOk && current == mp { - // Do not assign the default delegating MeterProvider to delegate - // to itself. - global.Error( - errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", - ) - return - } - } - - delegateMeterOnce.Do(func() { - if def, ok := current.(*meterProvider); ok { - def.setDelegate(mp) - } - }) - globalMeterProvider.Store(meterProviderHolder{mp: mp}) -} - -func defaultMeterProvider() *atomic.Value { - v := &atomic.Value{} - v.Store(meterProviderHolder{mp: &meterProvider{}}) - return v -} diff --git a/metric/internal/global/state_test.go b/metric/internal/global/state_test.go deleted file mode 100644 index d714c60f4e6..00000000000 --- a/metric/internal/global/state_test.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package global // import "go.opentelemetry.io/otel/metric/internal/global" - -import ( - "sync" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" -) - -func resetGlobalMeterProvider() { - globalMeterProvider = defaultMeterProvider() - delegateMeterOnce = sync.Once{} -} - -type nonComparableMeterProvider struct { - metric.MeterProvider - - nonComparable func() //nolint:structcheck,unused // This is not called. -} - -func TestSetMeterProvider(t *testing.T) { - t.Cleanup(resetGlobalMeterProvider) - - t.Run("Set With default is a noop", func(t *testing.T) { - resetGlobalMeterProvider() - SetMeterProvider(MeterProvider()) - - mp, ok := MeterProvider().(*meterProvider) - if !ok { - t.Fatal("Global MeterProvider should be the default meter provider") - } - - if mp.delegate != nil { - t.Fatal("meter provider should not delegate when setting itself") - } - }) - - t.Run("First Set() should replace the delegate", func(t *testing.T) { - resetGlobalMeterProvider() - - SetMeterProvider(noop.NewMeterProvider()) - - _, ok := MeterProvider().(*meterProvider) - if ok { - t.Fatal("Global MeterProvider was not changed") - } - }) - - t.Run("Set() should delegate existing Meter Providers", func(t *testing.T) { - resetGlobalMeterProvider() - - mp := MeterProvider() - - SetMeterProvider(noop.NewMeterProvider()) - - dmp := mp.(*meterProvider) - - if dmp.delegate == nil { - t.Fatal("The delegated meter providers should have a delegate") - } - }) - - t.Run("non-comparable types should not panic", func(t *testing.T) { - resetGlobalMeterProvider() - - mp := nonComparableMeterProvider{} - SetMeterProvider(mp) - assert.NotPanics(t, func() { SetMeterProvider(mp) }) - }) -} diff --git a/metric/global/metric_test.go b/metric_test.go similarity index 93% rename from metric/global/metric_test.go rename to metric_test.go index d319a0c2da4..5e6e48fb8a0 100644 --- a/metric/global/metric_test.go +++ b/metric_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package global // import "go.opentelemetry.io/otel/metric/global" +package otel // import "go.opentelemetry.io/otel" import ( "testing" @@ -38,6 +38,6 @@ func TestMultipleGlobalMeterProvider(t *testing.T) { SetMeterProvider(&p1) SetMeterProvider(p2) - got := MeterProvider() + got := GetMeterProvider() assert.Equal(t, p2, got) } diff --git a/sdk/go.mod b/sdk/go.mod index ddef1c9c42d..f44f104ed17 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -17,7 +17,10 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v0.38.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/trace => ../trace + +replace go.opentelemetry.io/otel/metric => ../metric diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index c0704509a26..0086dba7687 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -18,7 +18,7 @@ import ( "context" "log" - "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" @@ -42,7 +42,7 @@ func Example() { metric.WithResource(res), metric.WithReader(reader), ) - global.SetMeterProvider(meterProvider) + otel.SetMeterProvider(meterProvider) defer func() { err := meterProvider.Shutdown(context.Background()) if err != nil { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index f68f345103e..723e5bffbd2 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -630,7 +629,7 @@ func TestGlobalInstRegisterCallback(t *testing.T) { otel.SetLogger(logr.New(l)) const mtrName = "TestGlobalInstRegisterCallback" - preMtr := global.Meter(mtrName) + preMtr := otel.Meter(mtrName) preInt64Ctr, err := preMtr.Int64ObservableCounter("pre.int64.counter") require.NoError(t, err) preFloat64Ctr, err := preMtr.Float64ObservableCounter("pre.float64.counter") @@ -638,9 +637,9 @@ func TestGlobalInstRegisterCallback(t *testing.T) { rdr := NewManualReader() mp := NewMeterProvider(WithReader(rdr), WithResource(resource.Empty())) - global.SetMeterProvider(mp) + otel.SetMeterProvider(mp) - postMtr := global.Meter(mtrName) + postMtr := otel.Meter(mtrName) postInt64Ctr, err := postMtr.Int64ObservableCounter("post.int64.counter") require.NoError(t, err) postFloat64Ctr, err := postMtr.Float64ObservableCounter("post.float64.counter") diff --git a/trace/go.mod b/trace/go.mod index 090c2a71295..555a3494fab 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -15,3 +15,5 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace go.opentelemetry.io/otel/metric => ../metric From e6839571d26cfc6458050da275f79618fbfd4d9d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 3 May 2023 19:39:01 -0700 Subject: [PATCH 518/886] Release v1.16.0-rc.1/v0.39.0-rc.1 (#4048) * Bump versions * Prepare stable-v1 for version v1.16.0-rc.1 * Prepare experimental-metrics for version v0.39.0-rc.1 * Update changelog * Update CHANGELOG.md --- CHANGELOG.md | 9 ++++++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/jaeger/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 14 +++++++------- example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/jaeger/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 12 ++++++------ exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 35 files changed, 155 insertions(+), 148 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40fb958cd33..97787f40956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 + +This is a release candidate for the v1.16.0/v0.39.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ### Added - Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039) @@ -2460,7 +2466,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.15.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0-rc.1...HEAD +[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 [1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 [1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 [1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 519ca7d8ada..99d8409f706 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index ff6c4d4ae81..c3760f52c05 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/bridge/opencensus v0.38.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.39.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/sdk/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 702d1494036..23ba29960ff 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index a333b58894c..3555f8eb0f8 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/bridge/opentracing v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/bridge/opentracing v1.16.0-rc.1 google.golang.org/grpc v1.54.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 0b3b6be5e76..535bf6b08cd 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 02f7f9b92c9..1ed5132c276 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,16 +9,16 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/jaeger v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/jaeger v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 39307d9a832..8ab1a7c405a 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 70ae268c60b..a0e1369b55d 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/bridge/opencensus v0.38.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.38.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.39.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e6eaa803177..2a8779c8549 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 google.golang.org/grpc v1.54.0 ) @@ -21,9 +21,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 2532acd779a..f35afc02478 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b1e21e4289e..89e1931b3cd 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/prometheus v0.38.1 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 + go.opentelemetry.io/otel/metric v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.15.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index d6f4ff45d47..24a05103bab 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.0 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/prometheus v0.38.1 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 + go.opentelemetry.io/otel/metric v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 065691c0248..166fbd08cfc 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/zipkin v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/zipkin v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect ) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index e7a9c677c29..c465b6727cd 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,16 +7,16 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 26259ef8b9f..6e99d182a78 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d9e5f17dbf5..5ca62fc42c9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f google.golang.org/grpc v1.54.0 @@ -25,9 +25,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/sdk v1.15.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b7301f20bdb..37590b3428b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.38.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -23,9 +23,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/sdk v1.15.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index 1e77f309b3a..06461981b2c 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.38.1" + return "0.39.0-rc.1" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 659f4a03007..a9474dfbaa6 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 @@ -22,7 +22,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a29a11772b9..97b615e85a8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f @@ -23,8 +23,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 28f82125ead..5986a061dde 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 851e8d1b062..d628cf3beac 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.15.1" + return "1.16.0-rc.1" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 69d9c0696e5..5cd5e5bca1b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.15.0 github.com/prometheus/client_model v0.3.0 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/metric v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index b92a804317c..7fb320c49c4 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/sdk/metric v0.38.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 5af8e60d1eb..e42c67b5166 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index ead81625513..cc0fe8b8baf 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/sdk v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index d2731a9ff1c..916b7b4a9ba 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel/metric v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index d89a7d706f6..9d17ce1e3c6 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index f44f104ed17..bb46647f13e 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/trace v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/trace v1.16.0-rc.1 golang.org/x/sys v0.7.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.38.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 0c5c31be963..505cb9422d9 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 - go.opentelemetry.io/otel/metric v0.38.1 - go.opentelemetry.io/otel/sdk v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel/metric v1.16.0-rc.1 + go.opentelemetry.io/otel/sdk v1.16.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/sys v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/version.go b/sdk/version.go index 2adddad8601..c1c68a0a4c9 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.15.1" + return "1.16.0-rc.1" } diff --git a/trace/go.mod b/trace/go.mod index 555a3494fab..c4d721d7dfa 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.2 - go.opentelemetry.io/otel v1.15.1 + go.opentelemetry.io/otel v1.16.0-rc.1 ) require ( diff --git a/version.go b/version.go index 6c7fe114bb9..2edc5cde4e8 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.15.1" + return "1.16.0-rc.1" } diff --git a/versions.yaml b/versions.yaml index 6af54af5eeb..fa01f4b6851 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.15.1 + version: v1.16.0-rc.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -36,7 +36,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.38.1 + version: v0.39.0-rc.1 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 1b04bbc681f769b5ac6b7189e25b2790a8363c83 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 7 May 2023 08:11:23 -0700 Subject: [PATCH 519/886] dependabot updates Sun May 7 14:59:33 UTC 2023 (#4072) Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /bridge/opentracing/test Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /example/view Bump github.com/prometheus/client_model from 0.3.0 to 0.4.0 in /exporters/prometheus Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /exporters/prometheus Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.54.0 to 1.55.0 in /example/otel-collector Bump github.com/prometheus/client_golang from 1.15.0 to 1.15.1 in /example/prometheus Bump golang.org/x/sys from 0.7.0 to 0.8.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 8 ++++---- bridge/opentracing/test/go.sum | 16 ++++++++-------- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 8 ++++---- example/otel-collector/go.sum | 17 +++++++++-------- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 6 +++--- example/prometheus/go.sum | 13 ++++++------- example/view/go.mod | 6 +++--- example/view/go.sum | 13 ++++++------- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.sum | 17 +++++++++-------- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 17 +++++++++-------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 17 +++++++++-------- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/go.sum | 17 +++++++++-------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 17 +++++++++-------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.sum | 17 +++++++++-------- exporters/prometheus/go.mod | 6 +++--- exporters/prometheus/go.sum | 13 ++++++------- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 12 ++++++------ sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 52 files changed, 181 insertions(+), 177 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 99d8409f706..c255f8cf88c 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 43297387fa9..4544d1127a2 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index c3760f52c05..3c600923d61 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 6e60ec60b53..81bef8755b0 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 3555f8eb0f8..46008057e7f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,21 +14,21 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/bridge/opentracing v1.16.0-rc.1 - google.golang.org/grpc v1.54.0 + google.golang.org/grpc v1.55.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index f31f01ef6cd..99ac1868002 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -14,8 +14,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -45,8 +45,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -55,11 +55,11 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/example/fib/go.mod b/example/fib/go.mod index 535bf6b08cd..eecf01f3144 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index ef90f36df25..25c43018ecb 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 1ed5132c276..b1df0e0ff9f 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index d9547e9c4cc..d6655565857 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 8ab1a7c405a..2e94b38ca92 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index ef90f36df25..25c43018ecb 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index a0e1369b55d..743fdf43924 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 6e60ec60b53..81bef8755b0 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 2a8779c8549..d1e782dfa77 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,23 +12,23 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 - google.golang.org/grpc v1.54.0 + google.golang.org/grpc v1.55.0 ) require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index da716af61c7..8595452decc 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -70,8 +70,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -97,8 +97,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -265,8 +266,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -376,8 +377,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -394,8 +395,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index f35afc02478..ca8bbba9daa 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index ef90f36df25..25c43018ecb 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 89e1931b3cd..f78ebfafe57 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.15.0 + github.com/prometheus/client_golang v1.15.1 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 go.opentelemetry.io/otel/metric v1.16.0-rc.1 @@ -17,12 +17,12 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index b1568fde6da..94bfb87e982 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -9,7 +9,6 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -18,18 +17,18 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index 24a05103bab..8b7ac811f65 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.19 require ( - github.com/prometheus/client_golang v1.15.0 + github.com/prometheus/client_golang v1.15.1 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 go.opentelemetry.io/otel/metric v1.16.0-rc.1 @@ -18,11 +18,11 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index b1568fde6da..94bfb87e982 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -9,7 +9,6 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -18,18 +17,18 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 166fbd08cfc..6a57f4ad693 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index e2d6fee8563..71bf9252770 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index c465b6727cd..eec938aabd8 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index ea0c55a6d8c..8a5892217ed 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 6e99d182a78..4439eb5d67d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.54.0 + google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -19,15 +19,15 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 87df091445b..6a495502376 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -273,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -384,8 +385,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 5ca62fc42c9..b434cbed9f6 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -11,8 +11,8 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f - google.golang.org/grpc v1.54.0 + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -21,7 +21,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 87df091445b..6a495502376 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -273,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -384,8 +385,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 37590b3428b..3ddf45257e8 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -19,7 +19,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -27,10 +27,10 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.54.0 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 87df091445b..6a495502376 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -273,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -384,8 +385,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index a9474dfbaa6..64b2954cb86 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/grpc v1.54.0 + google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -19,14 +19,14 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 87df091445b..6a495502376 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -273,8 +274,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -384,8 +385,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -402,8 +403,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 97b615e85a8..faa60a0277b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f - google.golang.org/grpc v1.54.0 + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -20,13 +20,13 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 205b17d7322..0bb867eda71 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -274,8 +275,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -385,8 +386,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -403,8 +404,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 5986a061dde..5655fdc8093 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -18,15 +18,15 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect - google.golang.org/grpc v1.54.0 // indirect + google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 03c28285eeb..92ae90f7c15 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -71,8 +71,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -98,8 +98,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -272,8 +273,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -383,8 +384,8 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= +google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -401,8 +402,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 5cd5e5bca1b..a8f5f919c96 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,8 +3,8 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.15.0 - github.com/prometheus/client_model v0.3.0 + github.com/prometheus/client_golang v1.15.1 + github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/metric v1.16.0-rc.1 @@ -27,7 +27,7 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index fbc0231b601..9dbe92885e8 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -12,7 +12,6 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -25,10 +24,10 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= @@ -43,8 +42,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 7fb320c49c4..a4ec96bfcbb 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index da3f6e62698..bbae3d88131 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index e42c67b5166..119ba12d1b4 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index da3f6e62698..bbae3d88131 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index cc0fe8b8baf..7cdcce5bcb6 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 875a8a082d3..cf18113a123 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -19,8 +19,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 900b5d1f942..3df1aaced14 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -135,8 +135,8 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.0 // indirect - github.com/prometheus/client_golang v1.15.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect @@ -194,7 +194,7 @@ require ( golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.9.0 // indirect golang.org/x/sync v0.1.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 1f2885ba602..87b0a4c21e2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -461,14 +461,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= -github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= +github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -831,8 +831,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/sdk/go.mod b/sdk/go.mod index bb46647f13e..47fa9dcc5f7 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.2 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 - golang.org/x/sys v0.7.0 + golang.org/x/sys v0.8.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 817a633da6e..56df527c54c 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -17,8 +17,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 505cb9422d9..95af059261b 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index da3f6e62698..bbae3d88131 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 4f4edec5e237534768505b532b59946f26cc17e8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 07:39:50 -0700 Subject: [PATCH 520/886] Remove the deprecated `metric/instrument` package (#4055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove deprecated `metric/instrument` * Apply suggestions from code review --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 5 + metric/instrument/deprecation.go | 452 ------------------------------- 2 files changed, 5 insertions(+), 452 deletions(-) delete mode 100644 metric/instrument/deprecation.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 97787f40956..d96941e2eee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. + Use `go.opentelemetry.io/otel/metric` instead. (#4055) + ## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 This is a release candidate for the v1.16.0/v0.39.0 release. diff --git a/metric/instrument/deprecation.go b/metric/instrument/deprecation.go deleted file mode 100644 index a2e4b31e16a..00000000000 --- a/metric/instrument/deprecation.go +++ /dev/null @@ -1,452 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package instrument provides the OpenTelemetry API instruments used to make -// measurements. -// -// Deprecated: Use go.opentelemetry.io/otel/metric instead. -package instrument // import "go.opentelemetry.io/otel/metric/instrument" - -import ( - "go.opentelemetry.io/otel/metric" -) - -// Float64Observable is an alias for [metric.Float64Observable]. -// -// Deprecated: Use [metric.Float64Observable] instead. -type Float64Observable metric.Float64Observable - -// Float64ObservableCounter is an alias for [metric.Float64ObservableCounter]. -// -// Deprecated: Use [metric.Float64ObservableCounter] instead. -type Float64ObservableCounter metric.Float64ObservableCounter - -// Float64ObservableCounterConfig is an alias for -// [metric.Float64ObservableCounterConfig]. -// -// Deprecated: Use [metric.Float64ObservableCounterConfig] instead. -type Float64ObservableCounterConfig metric.Float64ObservableCounterConfig - -// NewFloat64ObservableCounterConfig wraps -// [metric.NewFloat64ObservableCounterConfig]. -// -// Deprecated: Use [metric.NewFloat64ObservableCounterConfig] instead. -func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig { - o := make([]metric.Float64ObservableCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Float64ObservableCounterOption(opts[i]) - } - c := metric.NewFloat64ObservableCounterConfig(o...) - return Float64ObservableCounterConfig(c) -} - -// Float64ObservableCounterOption is an alias for -// [metric.Float64ObservableCounterOption]. -// -// Deprecated: Use [metric.Float64ObservableCounterOption] instead. -type Float64ObservableCounterOption metric.Float64ObservableCounterOption - -// Float64ObservableUpDownCounter is an alias for -// [metric.Float64ObservableUpDownCounter]. -// -// Deprecated: Use [metric.Float64ObservableUpDownCounter] instead. -type Float64ObservableUpDownCounter metric.Float64ObservableUpDownCounter - -// Float64ObservableUpDownCounterConfig is an alias for -// [metric.Float64ObservableUpDownCounterConfig]. -// -// Deprecated: Use [metric.Float64ObservableUpDownCounterConfig] instead. -type Float64ObservableUpDownCounterConfig metric.Float64ObservableUpDownCounterConfig - -// NewFloat64ObservableUpDownCounterConfig wraps -// [metric.NewFloat64ObservableUpDownCounterConfig]. -// -// Deprecated: Use [metric.NewFloat64ObservableUpDownCounterConfig] instead. -func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig { - o := make([]metric.Float64ObservableUpDownCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Float64ObservableUpDownCounterOption(opts[i]) - } - c := metric.NewFloat64ObservableUpDownCounterConfig(o...) - return Float64ObservableUpDownCounterConfig(c) -} - -// Float64ObservableUpDownCounterOption is an alias for -// [metric.Float64ObservableUpDownCounterOption]. -// -// Deprecated: Use [metric.Float64ObservableUpDownCounterOption] instead. -type Float64ObservableUpDownCounterOption metric.Float64ObservableUpDownCounterOption - -// Float64ObservableGauge is an alias for [metric.Float64ObservableGauge]. -// -// Deprecated: Use [metric.Float64ObservableGauge] instead. -type Float64ObservableGauge metric.Float64ObservableGauge - -// Float64ObservableGaugeConfig is an alias for -// [metric.Float64ObservableGaugeConfig]. -// -// Deprecated: Use [metric.Float64ObservableGaugeConfig] instead. -type Float64ObservableGaugeConfig metric.Float64ObservableGaugeConfig - -// NewFloat64ObservableGaugeConfig wraps -// [metric.NewFloat64ObservableGaugeConfig]. -// -// Deprecated: Use [metric.NewFloat64ObservableGaugeConfig] instead. -func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig { - o := make([]metric.Float64ObservableGaugeOption, len(opts)) - for i := range opts { - o[i] = metric.Float64ObservableGaugeOption(opts[i]) - } - c := metric.NewFloat64ObservableGaugeConfig(o...) - return Float64ObservableGaugeConfig(c) -} - -// Float64ObservableGaugeOption is an alias for -// [metric.Float64ObservableGaugeOption]. -// -// Deprecated: Use [metric.Float64ObservableGaugeOption] instead. -type Float64ObservableGaugeOption metric.Float64ObservableGaugeOption - -// Float64Observer is an alias for [metric.Float64Observer]. -// -// Deprecated: Use [metric.Float64Observer] instead. -type Float64Observer metric.Float64Observer - -// Float64Callback is an alias for [metric.Float64Callback]. -// -// Deprecated: Use [metric.Float64Callback] instead. -type Float64Callback metric.Float64Callback - -// Float64ObservableOption is an alias for [metric.Float64ObservableOption]. -// -// Deprecated: Use [metric.Float64ObservableOption] instead. -type Float64ObservableOption metric.Float64ObservableOption - -// WithFloat64Callback wraps [metric.WithFloat64Callback]. -// -// Deprecated: Use [metric.WithFloat64Callback] instead. -func WithFloat64Callback(callback Float64Callback) Float64ObservableOption { - cback := metric.Float64Callback(callback) - opt := metric.WithFloat64Callback(cback) - return Float64ObservableOption(opt) -} - -// Int64Observable is an alias for [metric.Int64Observable]. -// -// Deprecated: Use [metric.Int64Observable] instead. -type Int64Observable metric.Int64Observable - -// Int64ObservableCounter is an alias for [metric.Int64ObservableCounter]. -// -// Deprecated: Use [metric.Int64ObservableCounter] instead. -type Int64ObservableCounter metric.Int64ObservableCounter - -// Int64ObservableCounterConfig is an alias for -// [metric.Int64ObservableCounterConfig]. -// -// Deprecated: Use [metric.Int64ObservableCounterConfig] instead. -type Int64ObservableCounterConfig metric.Int64ObservableCounterConfig - -// NewInt64ObservableCounterConfig wraps -// [metric.NewInt64ObservableCounterConfig]. -// -// Deprecated: Use [metric.NewInt64ObservableCounterConfig] instead. -func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig { - o := make([]metric.Int64ObservableCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Int64ObservableCounterOption(opts[i]) - } - c := metric.NewInt64ObservableCounterConfig(o...) - return Int64ObservableCounterConfig(c) -} - -// Int64ObservableCounterOption is an alias for -// [metric.Int64ObservableCounterOption]. -// -// Deprecated: Use [metric.Int64ObservableCounterOption] instead. -type Int64ObservableCounterOption metric.Int64ObservableCounterOption - -// Int64ObservableUpDownCounter is an alias for -// [metric.Int64ObservableUpDownCounter]. -// -// Deprecated: Use [metric.Int64ObservableUpDownCounter] instead. -type Int64ObservableUpDownCounter metric.Int64ObservableUpDownCounter - -// Int64ObservableUpDownCounterConfig is an alias for -// [metric.Int64ObservableUpDownCounterConfig]. -// -// Deprecated: Use [metric.Int64ObservableUpDownCounterConfig] instead. -type Int64ObservableUpDownCounterConfig metric.Int64ObservableUpDownCounterConfig - -// NewInt64ObservableUpDownCounterConfig wraps -// [metric.NewInt64ObservableUpDownCounterConfig]. -// -// Deprecated: Use [metric.NewInt64ObservableUpDownCounterConfig] instead. -func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig { - o := make([]metric.Int64ObservableUpDownCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Int64ObservableUpDownCounterOption(opts[i]) - } - c := metric.NewInt64ObservableUpDownCounterConfig(o...) - return Int64ObservableUpDownCounterConfig(c) -} - -// Int64ObservableUpDownCounterOption is an alias for -// [metric.Int64ObservableUpDownCounterOption]. -// -// Deprecated: Use [metric.Int64ObservableUpDownCounterOption] instead. -type Int64ObservableUpDownCounterOption metric.Int64ObservableUpDownCounterOption - -// Int64ObservableGauge is an alias for [metric.Int64ObservableGauge]. -// -// Deprecated: Use [metric.Int64ObservableGauge] instead. -type Int64ObservableGauge metric.Int64ObservableGauge - -// Int64ObservableGaugeConfig is an alias for -// [metric.Int64ObservableGaugeConfig]. -// -// Deprecated: Use [metric.Int64ObservableGaugeConfig] instead. -type Int64ObservableGaugeConfig metric.Int64ObservableGaugeConfig - -// NewInt64ObservableGaugeConfig wraps [metric.NewInt64ObservableGaugeConfig]. -// -// Deprecated: Use [metric.NewInt64ObservableGaugeConfig] instead. -func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig { - o := make([]metric.Int64ObservableGaugeOption, len(opts)) - for i := range opts { - o[i] = metric.Int64ObservableGaugeOption(opts[i]) - } - c := metric.NewInt64ObservableGaugeConfig(o...) - return Int64ObservableGaugeConfig(c) -} - -// Int64ObservableGaugeOption is an alias for -// [metric.Int64ObservableGaugeOption]. -// -// Deprecated: Use [metric.Int64ObservableGaugeOption] instead. -type Int64ObservableGaugeOption metric.Int64ObservableGaugeOption - -// Int64Observer is an alias for [metric.Int64Observer]. -// -// Deprecated: Use [metric.Int64Observer] instead. -type Int64Observer metric.Int64Observer - -// Int64Callback is an alias for [metric.Int64Callback]. -// -// Deprecated: Use [metric.Int64Callback] instead. -type Int64Callback metric.Int64Callback - -// Int64ObservableOption is an alias for [metric.Int64ObservableOption]. -// -// Deprecated: Use [metric.Int64ObservableOption] instead. -type Int64ObservableOption metric.Int64ObservableOption - -// WithInt64Callback wraps [metric.WithInt64Callback]. -// -// Deprecated: Use [metric.WithInt64Callback] instead. -func WithInt64Callback(callback Int64Callback) Int64ObservableOption { - cback := metric.Int64Callback(callback) - opt := metric.WithInt64Callback(cback) - return Int64ObservableOption(opt) -} - -// Float64Counter is an alias for [metric.Float64Counter]. -// -// Deprecated: Use [metric.Float64Counter] instead. -type Float64Counter metric.Float64Counter - -// Float64CounterConfig is an alias for [metric.Float64CounterConfig]. -// -// Deprecated: Use [metric.Float64CounterConfig] instead. -type Float64CounterConfig metric.Float64CounterConfig - -// NewFloat64CounterConfig wraps [metric.NewFloat64CounterConfig]. -// -// Deprecated: Use [metric.NewFloat64CounterConfig] instead. -func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig { - o := make([]metric.Float64CounterOption, len(opts)) - for i := range opts { - o[i] = metric.Float64CounterOption(opts[i]) - } - c := metric.NewFloat64CounterConfig(o...) - return Float64CounterConfig(c) -} - -// Float64CounterOption is an alias for [metric.Float64CounterOption]. -// -// Deprecated: Use [metric.Float64CounterOption] instead. -type Float64CounterOption metric.Float64CounterOption - -// Float64UpDownCounter is an alias for [metric.Float64UpDownCounter]. -// -// Deprecated: Use [metric.Float64UpDownCounter] instead. -type Float64UpDownCounter metric.Float64UpDownCounter - -// Float64UpDownCounterConfig is an alias for -// [metric.Float64UpDownCounterConfig]. -// -// Deprecated: Use [metric.Float64UpDownCounterConfig] instead. -type Float64UpDownCounterConfig metric.Float64UpDownCounterConfig - -// NewFloat64UpDownCounterConfig wraps [metric.NewFloat64UpDownCounterConfig]. -// -// Deprecated: Use [metric.NewFloat64UpDownCounterConfig] instead. -func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig { - o := make([]metric.Float64UpDownCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Float64UpDownCounterOption(opts[i]) - } - c := metric.NewFloat64UpDownCounterConfig(o...) - return Float64UpDownCounterConfig(c) -} - -// Float64UpDownCounterOption is an alias for -// [metric.Float64UpDownCounterOption]. -// -// Deprecated: Use [metric.Float64UpDownCounterOption] instead. -type Float64UpDownCounterOption metric.Float64UpDownCounterOption - -// Float64Histogram is an alias for [metric.Float64Histogram]. -// -// Deprecated: Use [metric.Float64Histogram] instead. -type Float64Histogram metric.Float64Histogram - -// Float64HistogramConfig is an alias for [metric.Float64HistogramConfig]. -// -// Deprecated: Use [metric.Float64HistogramConfig] instead. -type Float64HistogramConfig metric.Float64HistogramConfig - -// NewFloat64HistogramConfig wraps [metric.NewFloat64HistogramConfig]. -// -// Deprecated: Use [metric.NewFloat64HistogramConfig] instead. -func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig { - o := make([]metric.Float64HistogramOption, len(opts)) - for i := range opts { - o[i] = metric.Float64HistogramOption(opts[i]) - } - c := metric.NewFloat64HistogramConfig(o...) - return Float64HistogramConfig(c) -} - -// Float64HistogramOption is an alias for [metric.Float64HistogramOption]. -// -// Deprecated: Use [metric.Float64HistogramOption] instead. -type Float64HistogramOption metric.Float64HistogramOption - -// Int64Counter is an alias for [metric.Int64Counter]. -// -// Deprecated: Use [metric.Int64Counter] instead. -type Int64Counter metric.Int64Counter - -// Int64CounterConfig is an alias for [metric.Int64CounterConfig]. -// -// Deprecated: Use [metric.Int64CounterConfig] instead. -type Int64CounterConfig metric.Int64CounterConfig - -// NewInt64CounterConfig wraps [metric.NewInt64CounterConfig]. -// -// Deprecated: Use [metric.NewInt64CounterConfig] instead. -func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig { - o := make([]metric.Int64CounterOption, len(opts)) - for i := range opts { - o[i] = metric.Int64CounterOption(opts[i]) - } - c := metric.NewInt64CounterConfig(o...) - return Int64CounterConfig(c) -} - -// Int64CounterOption is an alias for [metric.Int64CounterOption]. -// -// Deprecated: Use [metric.Int64CounterOption] instead. -type Int64CounterOption metric.Int64CounterOption - -// Int64UpDownCounter is an alias for [metric.Int64UpDownCounter]. -// -// Deprecated: Use [metric.Int64UpDownCounter] instead. -type Int64UpDownCounter metric.Int64UpDownCounter - -// Int64UpDownCounterConfig is an alias for [metric.Int64UpDownCounterConfig]. -// -// Deprecated: Use [metric.Int64UpDownCounterConfig] instead. -type Int64UpDownCounterConfig metric.Int64UpDownCounterConfig - -// NewInt64UpDownCounterConfig wraps [metric.NewInt64UpDownCounterConfig]. -// -// Deprecated: Use [metric.NewInt64UpDownCounterConfig] instead. -func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig { - o := make([]metric.Int64UpDownCounterOption, len(opts)) - for i := range opts { - o[i] = metric.Int64UpDownCounterOption(opts[i]) - } - c := metric.NewInt64UpDownCounterConfig(o...) - return Int64UpDownCounterConfig(c) -} - -// Int64UpDownCounterOption is an alias for [metric.Int64UpDownCounterOption]. -// -// Deprecated: Use [metric.Int64UpDownCounterOption] instead. -type Int64UpDownCounterOption metric.Int64UpDownCounterOption - -// Int64Histogram is an alias for [metric.Int64Histogram]. -// -// Deprecated: Use [metric.Int64Histogram] instead. -type Int64Histogram metric.Int64Histogram - -// Int64HistogramConfig is an alias for [metric.Int64HistogramConfig]. -// -// Deprecated: Use [metric.Int64HistogramConfig] instead. -type Int64HistogramConfig metric.Int64HistogramConfig - -// NewInt64HistogramConfig wraps [metric.NewInt64HistogramConfig]. -// -// Deprecated: Use [metric.NewInt64HistogramConfig] instead. -func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig { - o := make([]metric.Int64HistogramOption, len(opts)) - for i := range opts { - o[i] = metric.Int64HistogramOption(opts[i]) - } - c := metric.NewInt64HistogramConfig(o...) - return Int64HistogramConfig(c) -} - -// Int64HistogramOption is an alias for [metric.Int64HistogramOption]. -// -// Deprecated: Use [metric.Int64HistogramOption] instead. -type Int64HistogramOption metric.Int64HistogramOption - -// Observable is an alias for [metric.Observable]. -// -// Deprecated: Use [metric.Observable] instead. -type Observable metric.Observable - -// Option is an alias for [metric.InstrumentOption]. -// -// Deprecated: Use [metric.InstrumentOption] instead. -type Option metric.InstrumentOption - -// WithDescription is an alias for [metric.WithDescription]. -// -// Deprecated: Use [metric.WithDescription] instead. -func WithDescription(desc string) Option { - o := metric.WithDescription(desc) - return Option(o) -} - -// WithUnit is an alias for [metric.WithUnit]. -// -// Deprecated: Use [metric.WithUnit] instead. -func WithUnit(u string) Option { - o := metric.WithUnit(u) - return Option(o) -} From 2aadf656e241406af7fe9913ebcf444ed71bb149 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 07:56:53 -0700 Subject: [PATCH 521/886] Update metric iface warnings (#4056) Remove self-reference to the package in the expandable interfaces. --- metric/asyncfloat64.go | 19 ++++++++----------- metric/asyncint64.go | 20 ++++++++------------ metric/syncfloat64.go | 15 ++++++--------- metric/syncint64.go | 15 ++++++--------- 4 files changed, 28 insertions(+), 41 deletions(-) diff --git a/metric/asyncfloat64.go b/metric/asyncfloat64.go index e2ffb673859..be1c5e8b5cd 100644 --- a/metric/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -37,8 +37,8 @@ type Float64Observable interface { // assumed the to be the cumulative sum of the count. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for +// package documentation on API implementation for information on how to set +// default behavior for // unimplemented methods. type Float64ObservableCounter interface { embedded.Float64ObservableCounter @@ -92,9 +92,8 @@ type Float64ObservableCounterOption interface { // the to be the cumulative sum of the count. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64ObservableUpDownCounter interface { embedded.Float64ObservableUpDownCounter @@ -147,9 +146,8 @@ type Float64ObservableUpDownCounterOption interface { // are only made within a callback for this instrument. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64ObservableGauge interface { embedded.Float64ObservableGauge @@ -200,9 +198,8 @@ type Float64ObservableGaugeOption interface { // Float64Observer is a recorder of float64 measurements. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64Observer interface { embedded.Float64Observer diff --git a/metric/asyncint64.go b/metric/asyncint64.go index a56b3d7a65c..4f9efd830bd 100644 --- a/metric/asyncint64.go +++ b/metric/asyncint64.go @@ -37,9 +37,8 @@ type Int64Observable interface { // assumed the to be the cumulative sum of the count. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64ObservableCounter interface { embedded.Int64ObservableCounter @@ -92,9 +91,8 @@ type Int64ObservableCounterOption interface { // be the cumulative sum of the count. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64ObservableUpDownCounter interface { embedded.Int64ObservableUpDownCounter @@ -147,9 +145,8 @@ type Int64ObservableUpDownCounterOption interface { // only made within a callback for this instrument. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64ObservableGauge interface { embedded.Int64ObservableGauge @@ -199,9 +196,8 @@ type Int64ObservableGaugeOption interface { // Int64Observer is a recorder of int64 measurements. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64Observer interface { embedded.Int64Observer diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index 0b2023c35ad..06cd50b2d03 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -23,9 +23,8 @@ import ( // Float64Counter is an instrument that records increasing float64 values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64Counter interface { embedded.Float64Counter @@ -70,9 +69,8 @@ type Float64CounterOption interface { // float64 values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64UpDownCounter interface { embedded.Float64UpDownCounter @@ -118,9 +116,8 @@ type Float64UpDownCounterOption interface { // values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Float64Histogram interface { embedded.Float64Histogram diff --git a/metric/syncint64.go b/metric/syncint64.go index 9a1a9dba85d..3ee34fed43c 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -23,9 +23,8 @@ import ( // Int64Counter is an instrument that records increasing int64 values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64Counter interface { embedded.Int64Counter @@ -70,9 +69,8 @@ type Int64CounterOption interface { // int64 values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64UpDownCounter interface { embedded.Int64UpDownCounter @@ -118,9 +116,8 @@ type Int64UpDownCounterOption interface { // values. // // Warning: Methods may be added to this interface in minor releases. See -// [go.opentelemetry.io/otel/metric] package documentation on API -// implementation for information on how to set default behavior for -// unimplemented methods. +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Int64Histogram interface { embedded.Int64Histogram From 07bf5913a1eacce0d4d1bc2d79d5896bdf41487c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 08:05:08 -0700 Subject: [PATCH 522/886] Add comment on all uses of embedded types (#4059) --- metric/asyncfloat64.go | 12 ++++++++++++ metric/asyncint64.go | 12 ++++++++++++ metric/meter.go | 12 ++++++++++++ metric/syncfloat64.go | 9 +++++++++ metric/syncint64.go | 9 +++++++++ 5 files changed, 54 insertions(+) diff --git a/metric/asyncfloat64.go b/metric/asyncfloat64.go index be1c5e8b5cd..ff8c202d33d 100644 --- a/metric/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -41,6 +41,9 @@ type Float64Observable interface { // default behavior for // unimplemented methods. type Float64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64ObservableCounter Float64Observable @@ -95,6 +98,9 @@ type Float64ObservableCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64ObservableUpDownCounter Float64Observable @@ -149,6 +155,9 @@ type Float64ObservableUpDownCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64ObservableGauge Float64Observable @@ -201,6 +210,9 @@ type Float64ObservableGaugeOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64Observer // Observe records the float64 value. diff --git a/metric/asyncint64.go b/metric/asyncint64.go index 4f9efd830bd..ecf02e00583 100644 --- a/metric/asyncint64.go +++ b/metric/asyncint64.go @@ -40,6 +40,9 @@ type Int64Observable interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64ObservableCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64ObservableCounter Int64Observable @@ -94,6 +97,9 @@ type Int64ObservableCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64ObservableUpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64ObservableUpDownCounter Int64Observable @@ -148,6 +154,9 @@ type Int64ObservableUpDownCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64ObservableGauge interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64ObservableGauge Int64Observable @@ -199,6 +208,9 @@ type Int64ObservableGaugeOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64Observer // Observe records the int64 value. diff --git a/metric/meter.go b/metric/meter.go index 1d60cf57a4d..c55d2defa6f 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -27,6 +27,9 @@ import ( // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type MeterProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.MeterProvider // Meter returns a new Meter with the provided name and configuration. @@ -47,6 +50,9 @@ type MeterProvider interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Meter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Meter // Int64Counter returns a new instrument identified by name and configured @@ -137,6 +143,9 @@ type Callback func(context.Context, Observer) error // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Observer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Observer // ObserveFloat64 records the float64 value for obsrv. @@ -152,6 +161,9 @@ type Observer interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Registration interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Registration // Unregister removes the callback registration from a Meter. diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index 06cd50b2d03..66052b48897 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -26,6 +26,9 @@ import ( // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64Counter // Add records a change to the counter. @@ -72,6 +75,9 @@ type Float64CounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64UpDownCounter // Add records a change to the counter. @@ -119,6 +125,9 @@ type Float64UpDownCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Float64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Float64Histogram // Record adds an additional value to the distribution. diff --git a/metric/syncint64.go b/metric/syncint64.go index 3ee34fed43c..1887061a315 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -26,6 +26,9 @@ import ( // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64Counter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64Counter // Add records a change to the counter. @@ -72,6 +75,9 @@ type Int64CounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64UpDownCounter interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64UpDownCounter // Add records a change to the counter. @@ -119,6 +125,9 @@ type Int64UpDownCounterOption interface { // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Int64Histogram interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. embedded.Int64Histogram // Record adds an additional value to the distribution. From 476d00aa2c067297f1951f04ff939204ebee73fd Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 08:16:34 -0700 Subject: [PATCH 523/886] Fix the broken [Option] link in metric docs (#4057) The `Option` type was replaced with `InstrumentOption` when the `metric/instrument` package was moved to `metric`. --- metric/asyncfloat64.go | 9 +++++---- metric/asyncint64.go | 12 +++++++----- metric/syncfloat64.go | 10 ++++++---- metric/syncint64.go | 10 ++++++---- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/metric/asyncfloat64.go b/metric/asyncfloat64.go index ff8c202d33d..0af3afb1131 100644 --- a/metric/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -83,8 +83,9 @@ func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback { } // Float64ObservableCounterOption applies options to a -// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and [Option] -// for other options that can be used as a Float64ObservableCounterOption. +// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and +// [InstrumentOption] for other options that can be used as a +// Float64ObservableCounterOption. type Float64ObservableCounterOption interface { applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig } @@ -141,7 +142,7 @@ func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback { // Float64ObservableUpDownCounterOption applies options to a // [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and -// [Option] for other options that can be used as a +// [InstrumentOption] for other options that can be used as a // Float64ObservableUpDownCounterOption. type Float64ObservableUpDownCounterOption interface { applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig @@ -198,7 +199,7 @@ func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback { // Float64ObservableGaugeOption applies options to a // [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and -// [Option] for other options that can be used as a +// [InstrumentOption] for other options that can be used as a // Float64ObservableGaugeOption. type Float64ObservableGaugeOption interface { applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig diff --git a/metric/asyncint64.go b/metric/asyncint64.go index ecf02e00583..bd194e2f6da 100644 --- a/metric/asyncint64.go +++ b/metric/asyncint64.go @@ -82,8 +82,9 @@ func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback { } // Int64ObservableCounterOption applies options to a -// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and [Option] for -// other options that can be used as an Int64ObservableCounterOption. +// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableCounterOption. type Int64ObservableCounterOption interface { applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig } @@ -140,7 +141,7 @@ func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback { // Int64ObservableUpDownCounterOption applies options to a // [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and -// [Option] for other options that can be used as an +// [InstrumentOption] for other options that can be used as an // Int64ObservableUpDownCounterOption. type Int64ObservableUpDownCounterOption interface { applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig @@ -196,8 +197,9 @@ func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback { } // Int64ObservableGaugeOption applies options to a -// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and [Option] for -// other options that can be used as an Int64ObservableGaugeOption. +// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and +// [InstrumentOption] for other options that can be used as an +// Int64ObservableGaugeOption. type Int64ObservableGaugeOption interface { applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig } diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index 66052b48897..1130887cef1 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -63,7 +63,8 @@ func (c Float64CounterConfig) Unit() string { } // Float64CounterOption applies options to a [Float64CounterConfig]. See -// [Option] for other options that can be used as a Float64CounterOption. +// [InstrumentOption] for other options that can be used as a +// Float64CounterOption. type Float64CounterOption interface { applyFloat64Counter(Float64CounterConfig) Float64CounterConfig } @@ -112,8 +113,8 @@ func (c Float64UpDownCounterConfig) Unit() string { } // Float64UpDownCounterOption applies options to a -// [Float64UpDownCounterConfig]. See [Option] for other options that can be -// used as a Float64UpDownCounterOption. +// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that +// can be used as a Float64UpDownCounterOption. type Float64UpDownCounterOption interface { applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig } @@ -162,7 +163,8 @@ func (c Float64HistogramConfig) Unit() string { } // Float64HistogramOption applies options to a [Float64HistogramConfig]. See -// [Option] for other options that can be used as a Float64HistogramOption. +// [InstrumentOption] for other options that can be used as a +// Float64HistogramOption. type Float64HistogramOption interface { applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig } diff --git a/metric/syncint64.go b/metric/syncint64.go index 1887061a315..f141695de1e 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -62,8 +62,9 @@ func (c Int64CounterConfig) Unit() string { return c.unit } -// Int64CounterOption applies options to a [Int64CounterConfig]. See [Option] -// for other options that can be used as an Int64CounterOption. +// Int64CounterOption applies options to a [Int64CounterConfig]. See +// [InstrumentOption] for other options that can be used as an +// Int64CounterOption. type Int64CounterOption interface { applyInt64Counter(Int64CounterConfig) Int64CounterConfig } @@ -112,7 +113,7 @@ func (c Int64UpDownCounterConfig) Unit() string { } // Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig]. -// See [Option] for other options that can be used as an +// See [InstrumentOption] for other options that can be used as an // Int64UpDownCounterOption. type Int64UpDownCounterOption interface { applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig @@ -162,7 +163,8 @@ func (c Int64HistogramConfig) Unit() string { } // Int64HistogramOption applies options to a [Int64HistogramConfig]. See -// [Option] for other options that can be used as an Int64HistogramOption. +// [InstrumentOption] for other options that can be used as an +// Int64HistogramOption. type Int64HistogramOption interface { applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig } From b243b6e819e6faa5753a211b20f6e3b0d85f965b Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Mon, 8 May 2023 10:02:10 -0600 Subject: [PATCH 524/886] Add semconv/v1.19.0 (#3848) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add semconv/v1.19.0 Includes adding semconv/internal/v3/ to support the move of the semantic convention HTTPUserAgentKey to the new key UserAgentOriginalKey * Update CHANGELOG.md Co-authored-by: Robert Pająk * format http.go.tmpl using tabs instead of spaces * update http.go.tmpl to use v3 of semconv/internal * Generate attribute_group.go --------- Co-authored-by: Robert Pająk Co-authored-by: Anthony Mirabella Co-authored-by: Tyler Yahn --- CHANGELOG.md | 3 + Makefile | 1 + .../templates/httpconv/http.go.tmpl | 10 +- .../semconvkit/templates/netconv/net.go.tmpl | 2 +- semconv/internal/v3/http.go | 404 +++ semconv/internal/v3/http_test.go | 489 ++++ semconv/internal/v3/net.go | 324 +++ semconv/internal/v3/net_test.go | 344 +++ semconv/v1.19.0/attribute_group.go | 1262 ++++++++++ semconv/v1.19.0/doc.go | 20 + semconv/v1.19.0/event.go | 199 ++ semconv/v1.19.0/exception.go | 20 + semconv/v1.19.0/http.go | 21 + semconv/v1.19.0/httpconv/http.go | 152 ++ semconv/v1.19.0/netconv/net.go | 66 + semconv/v1.19.0/resource.go | 2063 ++++++++++++++++ semconv/v1.19.0/schema.go | 20 + semconv/v1.19.0/trace.go | 2199 +++++++++++++++++ 18 files changed, 7593 insertions(+), 6 deletions(-) create mode 100644 semconv/internal/v3/http.go create mode 100644 semconv/internal/v3/http_test.go create mode 100644 semconv/internal/v3/net.go create mode 100644 semconv/internal/v3/net_test.go create mode 100644 semconv/v1.19.0/attribute_group.go create mode 100644 semconv/v1.19.0/doc.go create mode 100644 semconv/v1.19.0/event.go create mode 100644 semconv/v1.19.0/exception.go create mode 100644 semconv/v1.19.0/http.go create mode 100644 semconv/v1.19.0/httpconv/http.go create mode 100644 semconv/v1.19.0/netconv/net.go create mode 100644 semconv/v1.19.0/resource.go create mode 100644 semconv/v1.19.0/schema.go create mode 100644 semconv/v1.19.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d96941e2eee..4559541576e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,9 @@ See our [versioning policy](VERSIONING.md) for more information about these stab - Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) - The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) - Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) +- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. The package contains +semantic conventions from the `v1.19.0` version of the OpenTelemetry +specification. (#3846) ### Changed diff --git a/Makefile b/Makefile index 91ead91b417..955f3fc1f0f 100644 --- a/Makefile +++ b/Makefile @@ -211,6 +211,7 @@ semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) [ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl index 3fd4685429d..7d2b0a5519d 100644 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv/internal/v2" + "go.opentelemetry.io/otel/semconv/internal/v3" semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" ) @@ -54,7 +54,7 @@ var ( HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, HTTPTargetKey: semconv.HTTPTargetKey, HTTPURLKey: semconv.HTTPURLKey, - HTTPUserAgentKey: semconv.HTTPUserAgentKey, + UserAgentOriginalKey: semconv.UserAgentOriginalKey, } ) @@ -108,7 +108,7 @@ func ClientStatus(code int) (codes.Code, string) { // The following attributes are always returned: "http.method", "http.scheme", // "http.flavor", "http.target", "net.host.name". The following attributes are // returned if they related values are defined in req: "net.host.port", -// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "net.sock.peer.addr", "net.sock.peer.port", "user_agent.original", "enduser.id", // "http.client_ip". func ServerRequest(server string, req *http.Request) []attribute.KeyValue { return hc.ServerRequest(server, req) @@ -128,7 +128,7 @@ func ServerStatus(code int) (codes.Code, string) { // security risk - explicit configuration helps avoid leaking sensitive // information. // -// The User-Agent header is already captured in the http.user_agent attribute +// The User-Agent header is already captured in the user_agent.original attribute // from ClientRequest and ServerRequest. Instrumentation may provide an option // to capture that header here even though it is not recommended. Otherwise, // instrumentation should filter that out of what is passed. @@ -143,7 +143,7 @@ func RequestHeader(h http.Header) []attribute.KeyValue { // security risk - explicit configuration helps avoid leaking sensitive // information. // -// The User-Agent header is already captured in the http.user_agent attribute +// The User-Agent header is already captured in the user_agent.original attribute // from ClientRequest and ServerRequest. Instrumentation may provide an option // to capture that header here even though it is not recommended. Otherwise, // instrumentation should filter that out of what is passed. diff --git a/internal/tools/semconvkit/templates/netconv/net.go.tmpl b/internal/tools/semconvkit/templates/netconv/net.go.tmpl index 51be655572b..627deba0dd7 100644 --- a/internal/tools/semconvkit/templates/netconv/net.go.tmpl +++ b/internal/tools/semconvkit/templates/netconv/net.go.tmpl @@ -20,7 +20,7 @@ import ( "net" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/semconv/internal/v2" + "go.opentelemetry.io/otel/semconv/internal/v3" semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" ) diff --git a/semconv/internal/v3/http.go b/semconv/internal/v3/http.go new file mode 100644 index 00000000000..b864c24de27 --- /dev/null +++ b/semconv/internal/v3/http.go @@ -0,0 +1,404 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v3" + +import ( + "fmt" + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +// HTTPConv are the HTTP semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type HTTPConv struct { + NetConv *NetConv + + EnduserIDKey attribute.Key + HTTPClientIPKey attribute.Key + HTTPFlavorKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPResponseContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + UserAgentOriginalKey attribute.Key +} + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. The following attributes are returned if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func (c *HTTPConv) ClientResponse(resp *http.Response) []attribute.KeyValue { + var n int + if resp.StatusCode > 0 { + n++ + } + if resp.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + if resp.StatusCode > 0 { + attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) + } + if resp.ContentLength > 0 { + attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) + } + return attrs +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { + n := 3 // URL, peer name, proto, and method. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + if req.ContentLength > 0 { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.proto(req.Proto)) + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, c.HTTPURLKey.String(u)) + + attrs = append(attrs, c.NetConv.PeerName(peer)) + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if l := req.ContentLength; l > 0 { + attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + return attrs +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { + // TODO: This currently does not add the specification required + // `http.target` attribute. It has too high of a cardinality to safely be + // added. An alternate should be added, or this comment removed, when it is + // addressed by the specification. If it is ultimately decided to continue + // not including the attribute, the HTTPTargetKey field of the HTTPConv + // should be removed as well. + + n := 4 // Method, scheme, proto, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + peer, peerPort := splitHostPort(req.RemoteAddr) + if peer != "" { + n++ + if peerPort > 0 { + n++ + } + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.proto(req.Proto)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) + if peerPort > 0 { + attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + if clientIP != "" { + attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) + } + + return attrs +} + +func (c *HTTPConv) method(method string) attribute.KeyValue { + if method == "" { + return c.HTTPMethodKey.String(http.MethodGet) + } + return c.HTTPMethodKey.String(method) +} + +func (c *HTTPConv) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return c.HTTPSchemeHTTPS + } + return c.HTTPSchemeHTTP +} + +func (c *HTTPConv) proto(proto string) attribute.KeyValue { + switch proto { + case "HTTP/1.0": + return c.HTTPFlavorKey.String("1.0") + case "HTTP/1.1": + return c.HTTPFlavorKey.String("1.1") + case "HTTP/2": + return c.HTTPFlavorKey.String("2.0") + case "HTTP/3": + return c.HTTPFlavorKey.String("3.0") + default: + return c.HTTPFlavorKey.String(proto) + } +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +// Return the request host and port from the first non-empty source. +func firstHostPort(source ...string) (host string, port int) { + for _, hostport := range source { + host, port = splitHostPort(hostport) + if host != "" || port > 0 { + break + } + } + return +} + +// RequestHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) RequestHeader(h http.Header) []attribute.KeyValue { + return c.header("http.request.header", h) +} + +// ResponseHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue { + return c.header("http.response.header", h) +} + +func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue { + key := func(k string) attribute.Key { + k = strings.ToLower(k) + k = strings.ReplaceAll(k, "-", "_") + k = fmt.Sprintf("%s.%s", prefix, k) + return attribute.Key(k) + } + + attrs := make([]attribute.KeyValue, 0, len(h)) + for k, v := range h { + attrs = append(attrs, key(k).StringSlice(v)) + } + return attrs +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + return stat, "" +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + + if code/100 == 4 { + return codes.Unset, "" + } + return stat, "" +} + +type codeRange struct { + fromInclusive int + toInclusive int +} + +func (r codeRange) contains(code int) bool { + return r.fromInclusive <= code && code <= r.toInclusive +} + +var validRangesPerCategory = map[int][]codeRange{ + 1: { + {http.StatusContinue, http.StatusEarlyHints}, + }, + 2: { + {http.StatusOK, http.StatusAlreadyReported}, + {http.StatusIMUsed, http.StatusIMUsed}, + }, + 3: { + {http.StatusMultipleChoices, http.StatusUseProxy}, + {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, + }, + 4: { + {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… + {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, + {http.StatusPreconditionRequired, http.StatusTooManyRequests}, + {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, + {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, + }, + 5: { + {http.StatusInternalServerError, http.StatusLoopDetected}, + {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, + }, +} + +// validateHTTPStatusCode validates the HTTP status code and returns +// corresponding span status code. If the `code` is not a valid HTTP status +// code, returns span status Error and false. +func validateHTTPStatusCode(code int) (codes.Code, bool) { + category := code / 100 + ranges, ok := validRangesPerCategory[category] + if !ok { + return codes.Error, false + } + ok = false + for _, crange := range ranges { + ok = crange.contains(code) + if ok { + break + } + } + if !ok { + return codes.Error, false + } + if category > 0 && category < 4 { + return codes.Unset, true + } + return codes.Error, true +} diff --git a/semconv/internal/v3/http_test.go b/semconv/internal/v3/http_test.go new file mode 100644 index 00000000000..02e7d64f124 --- /dev/null +++ b/semconv/internal/v3/http_test.go @@ -0,0 +1,489 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +var hc = &HTTPConv{ + NetConv: nc, + + EnduserIDKey: attribute.Key("enduser.id"), + HTTPClientIPKey: attribute.Key("http.client_ip"), + HTTPFlavorKey: attribute.Key("http.flavor"), + HTTPMethodKey: attribute.Key("http.method"), + HTTPRequestContentLengthKey: attribute.Key("http.request_content_length"), + HTTPResponseContentLengthKey: attribute.Key("http.response_content_length"), + HTTPRouteKey: attribute.Key("http.route"), + HTTPSchemeHTTP: attribute.String("http.scheme", "http"), + HTTPSchemeHTTPS: attribute.String("http.scheme", "https"), + HTTPStatusCodeKey: attribute.Key("http.status_code"), + HTTPTargetKey: attribute.Key("http.target"), + HTTPURLKey: attribute.Key("http.url"), + UserAgentOriginalKey: attribute.Key("user_agent.original"), +} + +func TestHTTPClientResponse(t *testing.T) { + const stat, n = 201, 397 + resp := &http.Response{ + StatusCode: stat, + ContentLength: n, + } + got := hc.ClientResponse(resp) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.Key("http.status_code").Int(stat), + attribute.Key("http.response_content_length").Int(n), + }, got) +} + +func TestHTTPSClientRequest(t *testing.T) { + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "https", + Host: "127.0.0.1:443", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + } + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.url", "https://127.0.0.1:443/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + }, + hc.ClientRequest(req), + ) +} + +func TestHTTPClientRequest(t *testing.T) { + const ( + user = "alice" + n = 128 + agent = "Go-http-client/1.1" + ) + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "http", + Host: "127.0.0.1:8080", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + Header: http.Header{ + "User-Agent": []string{agent}, + }, + ContentLength: n, + } + req.SetBasicAuth(user, "pswrd") + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", "1.0"), + attribute.String("http.url", "http://127.0.0.1:8080/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + attribute.Int("net.peer.port", 8080), + attribute.String("user_agent.original", agent), + attribute.Int("http.request_content_length", n), + attribute.String("enduser.id", user), + }, + hc.ClientRequest(req), + ) +} + +func TestHTTPClientRequestRequired(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ClientRequest(req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.flavor", ""), + attribute.String("http.url", ""), + attribute.String("net.peer.name", ""), + } + assert.Equal(t, want, got) +} + +func TestHTTPServerRequest(t *testing.T) { + got := make(chan *http.Request, 1) + handler := func(w http.ResponseWriter, r *http.Request) { + got <- r + w.WriteHeader(http.StatusOK) + } + + srv := httptest.NewServer(http.HandlerFunc(handler)) + defer srv.Close() + + srvURL, err := url.Parse(srv.URL) + require.NoError(t, err) + srvPort, err := strconv.ParseInt(srvURL.Port(), 10, 32) + require.NoError(t, err) + + resp, err := srv.Client().Get(srv.URL) + require.NoError(t, err) + require.NoError(t, resp.Body.Close()) + + req := <-got + peer, peerPort := splitHostPort(req.RemoteAddr) + + const user = "alice" + req.SetBasicAuth(user, "pswrd") + + const clientIP = "127.0.0.5" + req.Header.Add("X-Forwarded-For", clientIP) + + assert.ElementsMatch(t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", "1.1"), + attribute.String("net.host.name", srvURL.Hostname()), + attribute.Int("net.host.port", int(srvPort)), + attribute.String("net.sock.peer.addr", peer), + attribute.Int("net.sock.peer.port", peerPort), + attribute.String("user_agent.original", "Go-http-client/1.1"), + attribute.String("enduser.id", user), + attribute.String("http.client_ip", clientIP), + }, + hc.ServerRequest("", req)) +} + +func TestHTTPServerName(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + const ( + host = "test.semconv.server" + port = 8080 + ) + portStr := strconv.Itoa(port) + server := host + ":" + portStr + assert.NotPanics(t, func() { got = hc.ServerRequest(server, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) + + req = &http.Request{Host: "alt.host.name:" + portStr} + // The server parameter does not include a port, ServerRequest should use + // the port in the request Host field. + assert.NotPanics(t, func() { got = hc.ServerRequest(host, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) +} + +func TestHTTPServerRequestFailsGracefully(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ServerRequest("", req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("http.flavor", ""), + attribute.String("net.host.name", ""), + } + assert.ElementsMatch(t, want, got) +} + +func TestMethod(t *testing.T) { + assert.Equal(t, attribute.String("http.method", "POST"), hc.method("POST")) + assert.Equal(t, attribute.String("http.method", "GET"), hc.method("")) + assert.Equal(t, attribute.String("http.method", "garbage"), hc.method("garbage")) +} + +func TestScheme(t *testing.T) { + assert.Equal(t, attribute.String("http.scheme", "http"), hc.scheme(false)) + assert.Equal(t, attribute.String("http.scheme", "https"), hc.scheme(true)) +} + +func TestProto(t *testing.T) { + tests := map[string]string{ + "HTTP/1.0": "1.0", + "HTTP/1.1": "1.1", + "HTTP/2": "2.0", + "HTTP/3": "3.0", + "SPDY": "SPDY", + "QUIC": "QUIC", + "other": "other", + } + + for proto, want := range tests { + expect := attribute.String("http.flavor", want) + assert.Equal(t, expect, hc.proto(proto), proto) + } +} + +func TestServerClientIP(t *testing.T) { + tests := []struct { + xForwardedFor string + want string + }{ + {"", ""}, + {"127.0.0.1", "127.0.0.1"}, + {"127.0.0.1,127.0.0.5", "127.0.0.1"}, + } + for _, test := range tests { + got := serverClientIP(test.xForwardedFor) + assert.Equal(t, test.want, got, test.xForwardedFor) + } +} + +func TestRequiredHTTPPort(t *testing.T) { + tests := []struct { + https bool + port int + want int + }{ + {true, 443, -1}, + {true, 80, 80}, + {true, 8081, 8081}, + {false, 443, 443}, + {false, 80, -1}, + {false, 8080, 8080}, + } + for _, test := range tests { + got := requiredHTTPPort(test.https, test.port) + assert.Equal(t, test.want, got, test.https, test.port) + } +} + +func TestFirstHostPort(t *testing.T) { + host, port := "127.0.0.1", 8080 + hostport := "127.0.0.1:8080" + sources := [][]string{ + {hostport}, + {"", hostport}, + {"", "", hostport}, + {"", "", hostport, ""}, + {"", "", hostport, "127.0.0.3:80"}, + } + + for _, src := range sources { + h, p := firstHostPort(src...) + assert.Equal(t, host, h, src) + assert.Equal(t, port, p, src) + } +} + +func TestRequestHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.RequestHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.request.header.ips", ips), + attribute.StringSlice("http.request.header.user", user), + }, got) +} + +func TestReponseHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.ResponseHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.response.header.ips", ips), + attribute.StringSlice("http.response.header.user", user), + }, got) +} + +func TestClientStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Error, false}, + {http.StatusUnauthorized, codes.Error, false}, + {http.StatusPaymentRequired, codes.Error, false}, + {http.StatusForbidden, codes.Error, false}, + {http.StatusNotFound, codes.Error, false}, + {http.StatusMethodNotAllowed, codes.Error, false}, + {http.StatusNotAcceptable, codes.Error, false}, + {http.StatusProxyAuthRequired, codes.Error, false}, + {http.StatusRequestTimeout, codes.Error, false}, + {http.StatusConflict, codes.Error, false}, + {http.StatusGone, codes.Error, false}, + {http.StatusLengthRequired, codes.Error, false}, + {http.StatusPreconditionFailed, codes.Error, false}, + {http.StatusRequestEntityTooLarge, codes.Error, false}, + {http.StatusRequestURITooLong, codes.Error, false}, + {http.StatusUnsupportedMediaType, codes.Error, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Error, false}, + {http.StatusExpectationFailed, codes.Error, false}, + {http.StatusTeapot, codes.Error, false}, + {http.StatusMisdirectedRequest, codes.Error, false}, + {http.StatusUnprocessableEntity, codes.Error, false}, + {http.StatusLocked, codes.Error, false}, + {http.StatusFailedDependency, codes.Error, false}, + {http.StatusTooEarly, codes.Error, false}, + {http.StatusUpgradeRequired, codes.Error, false}, + {http.StatusPreconditionRequired, codes.Error, false}, + {http.StatusTooManyRequests, codes.Error, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Error, false}, + {http.StatusUnavailableForLegalReasons, codes.Error, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ClientStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} + +func TestServerStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Unset, false}, + {http.StatusUnauthorized, codes.Unset, false}, + {http.StatusPaymentRequired, codes.Unset, false}, + {http.StatusForbidden, codes.Unset, false}, + {http.StatusNotFound, codes.Unset, false}, + {http.StatusMethodNotAllowed, codes.Unset, false}, + {http.StatusNotAcceptable, codes.Unset, false}, + {http.StatusProxyAuthRequired, codes.Unset, false}, + {http.StatusRequestTimeout, codes.Unset, false}, + {http.StatusConflict, codes.Unset, false}, + {http.StatusGone, codes.Unset, false}, + {http.StatusLengthRequired, codes.Unset, false}, + {http.StatusPreconditionFailed, codes.Unset, false}, + {http.StatusRequestEntityTooLarge, codes.Unset, false}, + {http.StatusRequestURITooLong, codes.Unset, false}, + {http.StatusUnsupportedMediaType, codes.Unset, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Unset, false}, + {http.StatusExpectationFailed, codes.Unset, false}, + {http.StatusTeapot, codes.Unset, false}, + {http.StatusMisdirectedRequest, codes.Unset, false}, + {http.StatusUnprocessableEntity, codes.Unset, false}, + {http.StatusLocked, codes.Unset, false}, + {http.StatusFailedDependency, codes.Unset, false}, + {http.StatusTooEarly, codes.Unset, false}, + {http.StatusUpgradeRequired, codes.Unset, false}, + {http.StatusPreconditionRequired, codes.Unset, false}, + {http.StatusTooManyRequests, codes.Unset, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Unset, false}, + {http.StatusUnavailableForLegalReasons, codes.Unset, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ServerStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} diff --git a/semconv/internal/v3/net.go b/semconv/internal/v3/net.go new file mode 100644 index 00000000000..d8717954dfd --- /dev/null +++ b/semconv/internal/v3/net.go @@ -0,0 +1,324 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v3" + +import ( + "net" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" +) + +// NetConv are the network semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type NetConv struct { + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetSockFamilyKey attribute.Key + NetSockPeerAddrKey attribute.Key + NetSockPeerPortKey attribute.Key + NetSockHostAddrKey attribute.Key + NetSockHostPortKey attribute.Key + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportInProc attribute.KeyValue +} + +func (c *NetConv) Transport(network string) attribute.KeyValue { + switch network { + case "tcp", "tcp4", "tcp6": + return c.NetTransportTCP + case "udp", "udp4", "udp6": + return c.NetTransportUDP + case "unix", "unixgram", "unixpacket": + return c.NetTransportInProc + default: + // "ip:*", "ip4:*", and "ip6:*" all are considered other. + return c.NetTransportOther + } +} + +// Host returns attributes for a network host address. +func (c *NetConv) Host(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.HostName(h)) + if p > 0 { + attrs = append(attrs, c.HostPort(int(p))) + } + return attrs +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue { + if ln == nil { + return c.Host(address) + } + + lAddr := ln.Addr() + if lAddr == nil { + return c.Host(address) + } + + hostName, hostPort := splitHostPort(address) + sockHostAddr, sockHostPort := splitHostPort(lAddr.String()) + network := lAddr.Network() + sockFamily := family(network, sockHostAddr) + + n := nonZeroStr(hostName, network, sockHostAddr, sockFamily) + n += positiveInt(hostPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if hostName != "" { + attr = append(attr, c.HostName(hostName)) + if hostPort > 0 { + // Only if net.host.name is set should net.host.port be. + attr = append(attr, c.HostPort(hostPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func (c *NetConv) HostName(name string) attribute.KeyValue { + return c.NetHostNameKey.String(name) +} + +func (c *NetConv) HostPort(port int) attribute.KeyValue { + return c.NetHostPortKey.Int(port) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue { + if conn == nil { + return c.Peer(address) + } + + lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr() + + var network string + switch { + case lAddr != nil: + network = lAddr.Network() + case rAddr != nil: + network = rAddr.Network() + default: + return c.Peer(address) + } + + peerName, peerPort := splitHostPort(address) + var ( + sockFamily string + sockPeerAddr string + sockPeerPort int + sockHostAddr string + sockHostPort int + ) + + if lAddr != nil { + sockHostAddr, sockHostPort = splitHostPort(lAddr.String()) + } + + if rAddr != nil { + sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String()) + } + + switch { + case sockHostAddr != "": + sockFamily = family(network, sockHostAddr) + case sockPeerAddr != "": + sockFamily = family(network, sockPeerAddr) + } + + n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily) + n += positiveInt(peerPort, sockPeerPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if peerName != "" { + attr = append(attr, c.PeerName(peerName)) + if peerPort > 0 { + // Only if net.peer.name is set should net.peer.port be. + attr = append(attr, c.PeerPort(peerPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockPeerAddr != "" { + attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr)) + if sockPeerPort > 0 { + // Only if net.sock.peer.addr is set should net.sock.peer.port be. + attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort)) + } + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func family(network, address string) string { + switch network { + case "unix", "unixgram", "unixpacket": + return "unix" + default: + if ip := net.ParseIP(address); ip != nil { + if ip.To4() == nil { + return "inet6" + } + return "inet" + } + } + return "" +} + +func nonZeroStr(strs ...string) int { + var n int + for _, str := range strs { + if str != "" { + n++ + } + } + return n +} + +func positiveInt(ints ...int) int { + var n int + for _, i := range ints { + if i > 0 { + n++ + } + } + return n +} + +// Peer returns attributes for a network peer address. +func (c *NetConv) Peer(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.PeerName(h)) + if p > 0 { + attrs = append(attrs, c.PeerPort(int(p))) + } + return attrs +} + +func (c *NetConv) PeerName(name string) attribute.KeyValue { + return c.NetPeerNameKey.String(name) +} + +func (c *NetConv) PeerPort(port int) attribute.KeyValue { + return c.NetPeerPortKey.Int(port) +} + +func (c *NetConv) SockPeerAddr(addr string) attribute.KeyValue { + return c.NetSockPeerAddrKey.String(addr) +} + +func (c *NetConv) SockPeerPort(port int) attribute.KeyValue { + return c.NetSockPeerPortKey.Int(port) +} + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} diff --git a/semconv/internal/v3/net_test.go b/semconv/internal/v3/net_test.go new file mode 100644 index 00000000000..e1e32469231 --- /dev/null +++ b/semconv/internal/v3/net_test.go @@ -0,0 +1,344 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" +) + +const ( + addr = "127.0.0.1" + port = 1834 +) + +var nc = &NetConv{ + NetHostNameKey: attribute.Key("net.host.name"), + NetHostPortKey: attribute.Key("net.host.port"), + NetPeerNameKey: attribute.Key("net.peer.name"), + NetPeerPortKey: attribute.Key("net.peer.port"), + NetSockPeerAddrKey: attribute.Key("net.sock.peer.addr"), + NetSockPeerPortKey: attribute.Key("net.sock.peer.port"), + NetTransportOther: attribute.String("net.transport", "other"), + NetTransportTCP: attribute.String("net.transport", "ip_tcp"), + NetTransportUDP: attribute.String("net.transport", "ip_udp"), + NetTransportInProc: attribute.String("net.transport", "inproc"), +} + +func TestNetTransport(t *testing.T) { + transports := map[string]attribute.KeyValue{ + "tcp": attribute.String("net.transport", "ip_tcp"), + "tcp4": attribute.String("net.transport", "ip_tcp"), + "tcp6": attribute.String("net.transport", "ip_tcp"), + "udp": attribute.String("net.transport", "ip_udp"), + "udp4": attribute.String("net.transport", "ip_udp"), + "udp6": attribute.String("net.transport", "ip_udp"), + "unix": attribute.String("net.transport", "inproc"), + "unixgram": attribute.String("net.transport", "inproc"), + "unixpacket": attribute.String("net.transport", "inproc"), + "ip:1": attribute.String("net.transport", "other"), + "ip:icmp": attribute.String("net.transport", "other"), + "ip4:proto": attribute.String("net.transport", "other"), + "ip6:proto": attribute.String("net.transport", "other"), + } + + for network, want := range transports { + assert.Equal(t, want, nc.Transport(network)) + } +} + +func TestNetServerNilListener(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, nil) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type listener struct{ net.Listener } + +func (listener) Addr() net.Addr { return nil } + +func TestNetServerNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, listener{}) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPListener() (net.Listener, error) { + return net.Listen("tcp4", "127.0.0.1:0") +} + +func TestNetServerTCP(t *testing.T) { + ln, err := newTCPListener() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + + host, pStr, err := net.SplitHostPort(ln.Addr().String()) + require.NoError(t, err) + port, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Server("example.com:8080", ln) + expected := []attribute.KeyValue{ + nc.HostName("example.com"), + nc.HostPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockHostAddrKey.String(host), + nc.NetSockHostPortKey.Int(port), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetHost(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + }}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + nc.HostPort(9090), + }}, + }, nc.Host) +} + +func TestNetHostName(t *testing.T) { + expected := attribute.Key("net.host.name").String(addr) + assert.Equal(t, expected, nc.HostName(addr)) +} + +func TestNetHostPort(t *testing.T) { + expected := attribute.Key("net.host.port").Int(port) + assert.Equal(t, expected, nc.HostPort(port)) +} + +func TestNetClientNilConn(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, nil) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type conn struct{ net.Conn } + +func (conn) LocalAddr() net.Addr { return nil } +func (conn) RemoteAddr() net.Addr { return nil } + +func TestNetClientNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, conn{}) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPConn() (net.Conn, net.Listener, error) { + ln, err := newTCPListener() + if err != nil { + return nil, nil, err + } + + conn, err := net.Dial("tcp4", ln.Addr().String()) + if err != nil { + _ = ln.Close() + return nil, nil, err + } + + return conn, ln, nil +} + +func TestNetClientTCP(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + lHost, pStr, err := net.SplitHostPort(conn.LocalAddr().String()) + require.NoError(t, err) + lPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + nc.NetSockHostAddrKey.String(lHost), + nc.NetSockHostPortKey.Int(lPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type remoteOnlyConn struct{ net.Conn } + +func (remoteOnlyConn) LocalAddr() net.Addr { return nil } + +func TestNetClientTCPNilLocal(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + conn = remoteOnlyConn{conn} + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetPeer(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "example.com", expected: []attribute.KeyValue{ + nc.PeerName("example.com"), + }}, + {address: "/tmp/file", expected: []attribute.KeyValue{ + nc.PeerName("/tmp/file"), + }}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + }}, + {address: ":9090", expected: nil}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + nc.PeerPort(9090), + }}, + }, nc.Peer) +} + +func TestNetPeerName(t *testing.T) { + expected := attribute.Key("net.peer.name").String(addr) + assert.Equal(t, expected, nc.PeerName(addr)) +} + +func TestNetPeerPort(t *testing.T) { + expected := attribute.Key("net.peer.port").Int(port) + assert.Equal(t, expected, nc.PeerPort(port)) +} + +func TestNetSockPeerName(t *testing.T) { + expected := attribute.Key("net.sock.peer.addr").String(addr) + assert.Equal(t, expected, nc.SockPeerAddr(addr)) +} + +func TestNetSockPeerPort(t *testing.T) { + expected := attribute.Key("net.sock.peer.port").Int(port) + assert.Equal(t, expected, nc.SockPeerPort(port)) +} + +func TestFamily(t *testing.T) { + tests := []struct { + network string + address string + expect string + }{ + {"", "", ""}, + {"unix", "", "unix"}, + {"unix", "gibberish", "unix"}, + {"unixgram", "", "unix"}, + {"unixgram", "gibberish", "unix"}, + {"unixpacket", "gibberish", "unix"}, + {"tcp", "123.0.2.8", "inet"}, + {"tcp", "gibberish", ""}, + {"", "123.0.2.8", "inet"}, + {"", "gibberish", ""}, + {"tcp", "fe80::1", "inet6"}, + {"", "fe80::1", "inet6"}, + } + + for _, test := range tests { + got := family(test.network, test.address) + assert.Equal(t, test.expect, got, test.network+"/"+test.address) + } +} + +func TestSplitHostPort(t *testing.T) { + tests := []struct { + hostport string + host string + port int + }{ + {"", "", -1}, + {":8080", "", 8080}, + {"127.0.0.1", "127.0.0.1", -1}, + {"www.example.com", "www.example.com", -1}, + {"127.0.0.1%25en0", "127.0.0.1%25en0", -1}, + {"[]", "", -1}, // Ensure this doesn't panic. + {"[fe80::1", "", -1}, + {"[fe80::1]", "fe80::1", -1}, + {"[fe80::1%25en0]", "fe80::1%25en0", -1}, + {"[fe80::1]:8080", "fe80::1", 8080}, + {"[fe80::1]::", "", -1}, // Too many colons. + {"127.0.0.1:", "127.0.0.1", -1}, + {"127.0.0.1:port", "127.0.0.1", -1}, + {"127.0.0.1:8080", "127.0.0.1", 8080}, + {"www.example.com:8080", "www.example.com", 8080}, + {"127.0.0.1%25en0:8080", "127.0.0.1%25en0", 8080}, + } + + for _, test := range tests { + h, p := splitHostPort(test.hostport) + assert.Equal(t, test.host, h, test.hostport) + assert.Equal(t, test.port, p, test.hostport) + } +} + +type addrTest struct { + address string + expected []attribute.KeyValue +} + +func testAddrs(t *testing.T, tests []addrTest, f func(string) []attribute.KeyValue) { + t.Helper() + + for _, test := range tests { + got := f(test.address) + assert.Equal(t, cap(test.expected), cap(got), "slice capacity") + assert.ElementsMatch(t, test.expected, got, test.address) + } +} diff --git a/semconv/v1.19.0/attribute_group.go b/semconv/v1.19.0/attribute_group.go new file mode 100644 index 00000000000..bb29da303a4 --- /dev/null +++ b/semconv/v1.19.0/attribute_group.go @@ -0,0 +1,1262 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. It represents the kind of HTTP protocol used. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HTTPFlavorKey = attribute.Key("http.flavor") +) + +var ( + // HTTP/1.0 + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTP Server spans attributes +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/specification/trace/semantic_conventions/http.md#http-server-definitions) + // if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetAppProtocolNameKey is the attribute Key conforming to the + // "net.app.protocol.name" semantic conventions. It represents the + // application layer protocol used. The value SHOULD be normalized to + // lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetAppProtocolNameKey = attribute.Key("net.app.protocol.name") + + // NetAppProtocolVersionKey is the attribute Key conforming to the + // "net.app.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.app.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetAppProtocolVersionKey = attribute.Key("net.app.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If defined for the address + // family and if different than `net.host.port` and if `net.sock.host.addr` + // is set. In other cases, it is still recommended to set this.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetAppProtocolName returns an attribute KeyValue conforming to the +// "net.app.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetAppProtocolName(val string) attribute.KeyValue { + return NetAppProtocolNameKey.String(val) +} + +// NetAppProtocolVersion returns an attribute KeyValue conforming to the +// "net.app.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetAppProtocolVersion(val string) attribute.KeyValue { + return NetAppProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationKindKey is the attribute Key conforming to the + // "messaging.destination.kind" semantic conventions. It represents the + // kind of message destination + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationKindKey = attribute.Key("messaging.destination.kind") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +var ( + // A message sent to a queue + MessagingDestinationKindQueue = MessagingDestinationKindKey.String("queue") + // A message sent to a topic + MessagingDestinationKindTopic = MessagingDestinationKindKey.String("topic") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceKindKey is the attribute Key conforming to the + // "messaging.source.kind" semantic conventions. It represents the kind of + // message source + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingSourceKindKey = attribute.Key("messaging.source.kind") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +var ( + // A message received from a queue + MessagingSourceKindQueue = MessagingSourceKindKey.String("queue") + // A message received from a topic + MessagingSourceKindTopic = MessagingSourceKindKey.String("topic") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/semconv/v1.19.0/doc.go b/semconv/v1.19.0/doc.go new file mode 100644 index 00000000000..e30d1c68683 --- /dev/null +++ b/semconv/v1.19.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.19.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" diff --git a/semconv/v1.19.0/event.go b/semconv/v1.19.0/event.go new file mode 100644 index 00000000000..dab9098c000 --- /dev/null +++ b/semconv/v1.19.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.19.0/exception.go b/semconv/v1.19.0/exception.go new file mode 100644 index 00000000000..119de92651c --- /dev/null +++ b/semconv/v1.19.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.19.0/http.go b/semconv/v1.19.0/http.go new file mode 100644 index 00000000000..e5ae79131cf --- /dev/null +++ b/semconv/v1.19.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.19.0/httpconv/http.go b/semconv/v1.19.0/httpconv/http.go new file mode 100644 index 00000000000..5a3578857a3 --- /dev/null +++ b/semconv/v1.19.0/httpconv/http.go @@ -0,0 +1,152 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.19.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v3" + semconv "go.opentelemetry.io/otel/semconv/v1.19.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + HTTPFlavorKey: semconv.HTTPFlavorKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + UserAgentOriginalKey: semconv.UserAgentOriginalKey, + } +) + +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp *http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "user_agent.original", "enduser.id", +// "http.client_ip". +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the user_agent.original attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the user_agent.original attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.19.0/netconv/net.go b/semconv/v1.19.0/netconv/net.go new file mode 100644 index 00000000000..1f3fddcb193 --- /dev/null +++ b/semconv/v1.19.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.19.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v3" + semconv "go.opentelemetry.io/otel/semconv/v1.19.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns a trace attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.19.0/resource.go b/semconv/v1.19.0/resource.go new file mode 100644 index 00000000000..5f1cfaf149f --- /dev/null +++ b/semconv/v1.19.0/resource.go @@ -0,0 +1,2063 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// Heroku dyno metadata +const ( + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") +) + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a general computing instance. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") + + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.19.0/schema.go b/semconv/v1.19.0/schema.go new file mode 100644 index 00000000000..6043f5bc38b --- /dev/null +++ b/semconv/v1.19.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.19.0" diff --git a/semconv/v1.19.0/trace.go b/semconv/v1.19.0/trace.go new file mode 100644 index 00000000000..5117e60a616 --- /dev/null +++ b/semconv/v1.19.0/trace.go @@ -0,0 +1,2199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.19.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable and not + // explicitly disabled via instrumentation configuration.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + // Note: The value may be sanitized to exclude sensitive information. + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// Semantic Convention for HTTP Server +const ( + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/path/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: stable + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) From 6f045478c926dc83ac0e35e53f68346deb2a7ffe Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 May 2023 13:00:27 -0700 Subject: [PATCH 525/886] Fix article in metric API docs (#4054) --- metric/instrument.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metric/instrument.go b/metric/instrument.go index 268b2f15595..0033c1e12d5 100644 --- a/metric/instrument.go +++ b/metric/instrument.go @@ -170,7 +170,7 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob func WithUnit(u string) InstrumentOption { return unitOpt(u) } // AddOption applies options to an addition measurement. See -// [MeasurementOption] for other options that can be used as a AddOption. +// [MeasurementOption] for other options that can be used as an AddOption. type AddOption interface { applyAdd(AddConfig) AddConfig } From 02c000130772af9078f8ae88825549cb1a8140a5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 9 May 2023 08:07:39 -0700 Subject: [PATCH 526/886] Document how to pass attributes for all record methods (#4058) * Document how to pass attributes for all record methods * Update based on feedback --- metric/asyncfloat64.go | 5 ++++- metric/asyncint64.go | 5 ++++- metric/syncfloat64.go | 15 ++++++++++++--- metric/syncint64.go | 15 ++++++++++++--- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/metric/asyncfloat64.go b/metric/asyncfloat64.go index 0af3afb1131..072baa8e8d0 100644 --- a/metric/asyncfloat64.go +++ b/metric/asyncfloat64.go @@ -217,7 +217,10 @@ type Float64Observer interface { embedded.Float64Observer // Observe records the float64 value. - Observe(value float64, opts ...ObserveOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value float64, options ...ObserveOption) } // Float64Callback is a function registered with a Meter that makes diff --git a/metric/asyncint64.go b/metric/asyncint64.go index bd194e2f6da..9bd6ebf0205 100644 --- a/metric/asyncint64.go +++ b/metric/asyncint64.go @@ -216,7 +216,10 @@ type Int64Observer interface { embedded.Int64Observer // Observe records the int64 value. - Observe(value int64, opts ...ObserveOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Observe(value int64, options ...ObserveOption) } // Int64Callback is a function registered with a Meter that makes observations diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index 1130887cef1..f0b063721d8 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -32,7 +32,10 @@ type Float64Counter interface { embedded.Float64Counter // Add records a change to the counter. - Add(ctx context.Context, incr float64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) } // Float64CounterConfig contains options for synchronous counter instruments that @@ -82,7 +85,10 @@ type Float64UpDownCounter interface { embedded.Float64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr float64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr float64, options ...AddOption) } // Float64UpDownCounterConfig contains options for synchronous counter @@ -132,7 +138,10 @@ type Float64Histogram interface { embedded.Float64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr float64, opts ...RecordOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr float64, options ...RecordOption) } // Float64HistogramConfig contains options for synchronous counter instruments diff --git a/metric/syncint64.go b/metric/syncint64.go index f141695de1e..6f508eb66d4 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -32,7 +32,10 @@ type Int64Counter interface { embedded.Int64Counter // Add records a change to the counter. - Add(ctx context.Context, incr int64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) } // Int64CounterConfig contains options for synchronous counter instruments that @@ -82,7 +85,10 @@ type Int64UpDownCounter interface { embedded.Int64UpDownCounter // Add records a change to the counter. - Add(ctx context.Context, incr int64, opts ...AddOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Add(ctx context.Context, incr int64, options ...AddOption) } // Int64UpDownCounterConfig contains options for synchronous counter @@ -132,7 +138,10 @@ type Int64Histogram interface { embedded.Int64Histogram // Record adds an additional value to the distribution. - Record(ctx context.Context, incr int64, opts ...RecordOption) + // + // Use the WithAttributeSet (or, if performance is not a concern, + // the WithAttributes) option to include measurement attributes. + Record(ctx context.Context, incr int64, options ...RecordOption) } // Int64HistogramConfig contains options for synchronous counter instruments From 7971a1230843b6b740faf7e7197ccf21d60b50ba Mon Sep 17 00:00:00 2001 From: Tijmen Stor <23655598+Tijmen34@users.noreply.github.com> Date: Tue, 9 May 2023 17:20:49 +0200 Subject: [PATCH 527/886] feat(gh-workflows): Use cache-dependency-path in actions/setup-go for ci workflow (#4074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using cache-dependency-path (which is now a built-in functionality in actions/setup-go), the speed of runs on MacOS can be improved. Refs: #3911 Co-authored-by: Robert Pająk Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/ci.yml | 56 ++++++++++++---------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be31d85a724..eba0038ad80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,23 +19,17 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v3 - env: - cache-name: go-mod-cache + - name: Install Go + uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + go-version: ${{ env.DEFAULT_GO_VERSION }} + cache-dependency-path: "**/go.sum" - name: Tools cache uses: actions/cache@v3 env: @@ -53,46 +47,34 @@ jobs: test-race: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v3 - env: - cache-name: go-mod-cache + - name: Install Go + uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + go-version: ${{ env.DEFAULT_GO_VERSION }} + cache-dependency-path: "**/go.sum" - name: Run tests with race detector run: make test-race test-coverage: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - - name: Module cache - uses: actions/cache@v3 - env: - cache-name: go-mod-cache + - name: Install Go + uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + go-version: ${{ env.DEFAULT_GO_VERSION }} + cache-dependency-path: "**/go.sum" - name: Run coverage tests run: | make test-coverage @@ -128,10 +110,6 @@ jobs: arch: "386" runs-on: ${{ matrix.os }} steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v3 - name: Setup Environment @@ -139,13 +117,11 @@ jobs: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH shell: bash - - name: Module cache - uses: actions/cache@v3 - env: - cache-name: go-mod-cache + - name: Install Go + uses: actions/setup-go@v4 with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/go.sum') }} + go-version: ${{ matrix.go-version }} + cache-dependency-path: "**/go.sum" - name: Run tests env: GOARCH: ${{ matrix.arch }} From c338d8eb8a30e2b782cd7745aaba4737e2fd55d5 Mon Sep 17 00:00:00 2001 From: Rakshit Parashar <34675136+ChillOrb@users.noreply.github.com> Date: Tue, 9 May 2023 08:29:19 -0700 Subject: [PATCH 528/886] added version.go and test file for issue 2143 (#3677) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added version.go and test file for issue 2143 * added license in metric versiont_test * goimport file linting * update trace version to v.1.13.0 and metric to 0.36.0 * Update sdk/metric/version.go Co-authored-by: Robert Pająk * using asser.Regxp * changing regex string as per recommendations Signed-off-by: ChillOrb * changing regex string as per recommendations Signed-off-by: ChillOrb * reverting go mod and go sum changes Signed-off-by: ChillOrb * trace and metric version bump up Signed-off-by: ChillOrb * version update in sdk/metric , sdk/trace Signed-off-by: ChillOrb * doc typo fix Signed-off-by: ChillOrb * Apply suggestions from code review --------- Signed-off-by: ChillOrb Co-authored-by: Chester Cheung Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- sdk/metric/version.go | 20 ++++++++++++++++++++ sdk/metric/version_test.go | 33 +++++++++++++++++++++++++++++++++ sdk/trace/version.go | 20 ++++++++++++++++++++ sdk/trace/version_test.go | 32 ++++++++++++++++++++++++++++++++ version_test.go | 9 +++++---- 5 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 sdk/metric/version.go create mode 100644 sdk/metric/version_test.go create mode 100644 sdk/trace/version.go create mode 100644 sdk/trace/version_test.go diff --git a/sdk/metric/version.go b/sdk/metric/version.go new file mode 100644 index 00000000000..3a7c86dd023 --- /dev/null +++ b/sdk/metric/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +// version is the current release version of the metric SDK in use. +func version() string { + return "1.16.0-rc.1" +} diff --git a/sdk/metric/version_test.go b/sdk/metric/version_test.go new file mode 100644 index 00000000000..34e00201e32 --- /dev/null +++ b/sdk/metric/version_test.go @@ -0,0 +1,33 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` + + `(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` + + `(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` + + `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := version() + assert.Regexp(t, versionRegex, v) +} diff --git a/sdk/trace/version.go b/sdk/trace/version.go new file mode 100644 index 00000000000..d3457ed1355 --- /dev/null +++ b/sdk/trace/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace // import "go.opentelemetry.io/otel/sdk/trace" + +// version is the current release version of the metric SDK in use. +func version() string { + return "1.16.0-rc.1" +} diff --git a/sdk/trace/version_test.go b/sdk/trace/version_test.go new file mode 100644 index 00000000000..a973d4b6993 --- /dev/null +++ b/sdk/trace/version_test.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` + + `(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` + + `(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` + + `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := version() + assert.Regexp(t, versionRegex, v) +} diff --git a/version_test.go b/version_test.go index ce598d1f4b6..2ac1746094f 100644 --- a/version_test.go +++ b/version_test.go @@ -23,10 +23,11 @@ import ( "go.opentelemetry.io/otel" ) -// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 -var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) +// regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string +var versionRegex = regexp.MustCompile(`^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)` + + `(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)` + + `(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?` + + `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$`) func TestVersionSemver(t *testing.T) { v := otel.Version() From 4d473d105a5f59a58d153e7c492a4ea0ee027871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 9 May 2023 17:45:39 +0200 Subject: [PATCH 529/886] [chore] Pin otel-specification hyperlinks (#4033) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CONTRIBUTING.md | 4 ++-- RELEASING.md | 6 +++--- codes/doc.go | 2 +- exporters/jaeger/README.md | 6 +++--- exporters/otlp/otlpmetric/internal/header.go | 2 +- exporters/otlp/otlptrace/README.md | 4 ++-- exporters/otlp/otlptrace/internal/header.go | 2 +- exporters/prometheus/exporter.go | 2 +- exporters/zipkin/model.go | 2 +- sdk/metric/meter_test.go | 2 +- sdk/metric/pipeline.go | 2 +- sdk/resource/resource.go | 4 ++-- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f521d65431b..21642f2f301 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,10 +150,10 @@ Any [Maintainer] can merge the PR once the above criteria have been met. ## Design Choices As with other OpenTelemetry clients, opentelemetry-go follows the -[opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification). +[OpenTelemetry Specification](https://opentelemetry.io/docs/reference/specification). It's especially valuable to read through the [library -guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/library-guidelines.md). +guidelines](https://opentelemetry.io/docs/reference/specification/library-guidelines). ### Focus on Capabilities, Not Structure Compliance diff --git a/RELEASING.md b/RELEASING.md index 77d56c93651..7dc4907162a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,10 +2,10 @@ ## Semantic Convention Generation -New versions of the [OpenTelemetry specification] mean new versions of the `semconv` package need to be generated. +New versions of the [OpenTelemetry Specification] mean new versions of the `semconv` package need to be generated. The `semconv-generate` make target is used for this. -1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag. +1. Checkout a local copy of the [OpenTelemetry Specification] to the desired release tag. 2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` 3. Run the `make semconv-generate ...` target from this repository. @@ -124,4 +124,4 @@ Once verified be sure to [make a release for the `contrib` repository](https://g Update [the documentation](./website_docs) for [the OpenTelemetry website](https://opentelemetry.io/docs/go/). Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. -[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification +[OpenTelemetry Specification]: https://github.com/open-telemetry/opentelemetry-specification diff --git a/codes/doc.go b/codes/doc.go index df3e0f1b621..4e328fbb4b3 100644 --- a/codes/doc.go +++ b/codes/doc.go @@ -16,6 +16,6 @@ Package codes defines the canonical error codes used by OpenTelemetry. It conforms to [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#statuscanonicalcode). +specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status). */ package codes // import "go.opentelemetry.io/otel/codes" diff --git a/exporters/jaeger/README.md b/exporters/jaeger/README.md index 9b9d370dd3a..19060ba4fd2 100644 --- a/exporters/jaeger/README.md +++ b/exporters/jaeger/README.md @@ -2,7 +2,7 @@ [![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/jaeger.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger) -[OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md) implementation. +[OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) implementation. ## Installation @@ -46,5 +46,5 @@ When re-generating Thrift code in the future, please adapt import paths as neces ## References - [Jaeger](https://www.jaegertracing.io/) -- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md) -- [OpenTelemetry Environment Variable Specification](https://opentelemetry.io/docs/reference/specification/sdk-environment-variables/#general-sdk-configuration) +- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) +- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/sdk-environment-variables.md#jaeger-exporter) diff --git a/exporters/otlp/otlpmetric/internal/header.go b/exporters/otlp/otlpmetric/internal/header.go index dde06fa8537..f07837ea7b6 100644 --- a/exporters/otlp/otlpmetric/internal/header.go +++ b/exporters/otlp/otlpmetric/internal/header.go @@ -19,7 +19,7 @@ import ( ) // GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" -// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent func GetUserAgentHeader() string { return "OTel OTLP Exporter Go/" + otlpmetric.Version() } diff --git a/exporters/otlp/otlptrace/README.md b/exporters/otlp/otlptrace/README.md index 6e9cc0366ba..50295223182 100644 --- a/exporters/otlp/otlptrace/README.md +++ b/exporters/otlp/otlptrace/README.md @@ -2,7 +2,7 @@ [![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/protocol/exporter.md) implementation. +[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation. ## Installation @@ -36,7 +36,7 @@ The `otlptracehttp` package implements a client for the span exporter that sends The following environment variables can be used (instead of options objects) to override the default configuration. For more information about how each of these environment variables is interpreted, see [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md). +specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md). | Environment variable | Option | Default value | | ------------------------------------------------------------------------ |------------------------------ | -------------------------------------------------------- | diff --git a/exporters/otlp/otlptrace/internal/header.go b/exporters/otlp/otlptrace/internal/header.go index 7fcd89a40fb..36d3ca8e1c2 100644 --- a/exporters/otlp/otlptrace/internal/header.go +++ b/exporters/otlp/otlptrace/internal/header.go @@ -19,7 +19,7 @@ import ( ) // GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" -// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent func GetUserAgentHeader() string { return "OTel OTLP Exporter Go/" + otlptrace.Version() } diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 4d383fe3144..653d8c38136 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -70,7 +70,7 @@ type collector struct { } // prometheus counters MUST have a _total suffix: -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.14.0/specification/metrics/data-model.md#sums-1 +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/compatibility/prometheus_and_openmetrics.md const counterSuffix = "_total" // New returns a Prometheus Exporter. diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 2ee67770212..b1beeb70a3a 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -236,7 +236,7 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { } // Rank determines selection order for remote endpoint. See the specification -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin var remoteEndpointKeyRank = map[attribute.Key]int{ semconv.PeerServiceKey: 0, semconv.NetPeerNameKey: 1, diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 723e5bffbd2..56ee1fa64d6 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1234,7 +1234,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { func TestObservableExample(t *testing.T) { // This example can be found: - // https://github.com/open-telemetry/opentelemetry-specification/blob/8b91585e6175dd52b51e1d60bea105041225e35d/specification/metrics/supplementary-guidelines.md#asynchronous-example + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/supplementary-guidelines.md#asynchronous-example var ( threadID1 = attribute.Int("tid", 1) threadID2 = attribute.Int("tid", 2) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index efa79ba9ec6..22341c61046 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -401,7 +401,7 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: // Observable counters and up-down-counters are defined to record // the absolute value of the count: - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#asynchronous-counter-creation + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/api.md#asynchronous-counter-creation switch temporality { case metricdata.CumulativeTemporality: return internal.NewPrecomputedCumulativeSum[N](monotonic), nil diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 49958a9a60a..139dc7e8f92 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -74,7 +74,7 @@ func NewSchemaless(attrs ...attribute.KeyValue) *Resource { } // Ensure attributes comply with the specification: - // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.0.1/specification/common/common.md#attributes + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/common/README.md#attribute s, _ := attribute.NewSetWithFiltered(attrs, func(kv attribute.KeyValue) bool { return kv.Valid() }) @@ -154,7 +154,7 @@ func (r *Resource) Equal(eq *Resource) bool { // if resource b's value is empty. // // The SchemaURL of the resources will be merged according to the spec rules: -// https://github.com/open-telemetry/opentelemetry-specification/blob/bad49c714a62da5493f2d1d9bafd7ebe8c8ce7eb/specification/resource/sdk.md#merge +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge // If the resources have different non-empty schemaURL an empty resource and an error // will be returned. func Merge(a, b *Resource) (*Resource, error) { From 0b6164155cc74050075ca85ac06cf732b04c1b95 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 10 May 2023 06:43:37 -0700 Subject: [PATCH 530/886] Add measurement docs to metric API (#4053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add measurement docs to metric API Based on user feedback, how measurements are made with observable instruments is not immediately clear to new users. This adds documentation intended to help guide these users. * Apply feedback * Apply feedback * Remove backticks * Apply suggestions from code review Co-authored-by: Robert Pająk * Update metric/meter.go Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk Co-authored-by: Chester Cheung --- metric/doc.go | 57 ++++++++++++++++++----- metric/meter.go | 117 +++++++++++++++++++++++++++++++----------------- 2 files changed, 122 insertions(+), 52 deletions(-) diff --git a/metric/doc.go b/metric/doc.go index bda14e10aa6..ae24e448d91 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -35,14 +35,14 @@ all instruments fall into two overlapping logical categories: asynchronous or synchronous, and int64 or float64. All synchronous instruments ([Int64Counter], [Int64UpDownCounter], -[Int64Histogram], [Float64Counter], [Float64UpDownCounter], [Float64Histogram]) -are used to measure the operation and performance of source code during the -source code execution. These instruments only make measurements when the source -code they instrument is run. +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are used to measure the operation and performance of source +code during the source code execution. These instruments only make measurements +when the source code they instrument is run. All asynchronous instruments ([Int64ObservableCounter], [Int64ObservableUpDownCounter], [Int64ObservableGauge], -[Float64ObservableCounter], [Float64ObservableUpDownCounter], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and [Float64ObservableGauge]) are used to measure metrics outside of the execution of source code. They are said to make "observations" via a callback function called once every measurement collection cycle. @@ -53,21 +53,54 @@ categories to use. Outside of these two broad categories, instruments are described by the function they are designed to serve. All Counters ([Int64Counter], -[Float64Counter], [Int64ObservableCounter], [Float64ObservableCounter]) are +[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are designed to measure values that never decrease in value, but instead only incrementally increase in value. UpDownCounters ([Int64UpDownCounter], -[Float64UpDownCounter], [Int64ObservableUpDownCounter], +[Float64UpDownCounter], [Int64ObservableUpDownCounter], and [Float64ObservableUpDownCounter]) on the other hand, are designed to measure -values that can increase and decrease. When more information -needs to be conveyed about all the synchronous measurements made during a -collection cycle, a Histogram ([Int64Histogram], [Float64Histogram]) should be -used. Finally, when just the most recent measurement needs to be conveyed about an -asynchronous measurement, a Gauge ([Int64ObservableGauge], +values that can increase and decrease. When more information needs to be +conveyed about all the synchronous measurements made during a collection cycle, +a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally, +when just the most recent measurement needs to be conveyed about an +asynchronous measurement, a Gauge ([Int64ObservableGauge] and [Float64ObservableGauge]) should be used. See the [OpenTelemetry documentation] for more information about instruments and their intended use. +# Measurements + +Measurements are made by recording values and information about the values with +an instrument. How these measurements are recorded depends on the instrument. + +Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter], +[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and +[Float64Histogram]) are recorded using the instrument methods directly. All +counter instruments have an Add method that is used to measure an increment +value, and all histogram instruments have a Record method to measure a data +point. + +Asynchronous instruments ([Int64ObservableCounter], +[Int64ObservableUpDownCounter], [Int64ObservableGauge], +[Float64ObservableCounter], [Float64ObservableUpDownCounter], and +[Float64ObservableGauge]) record measurements within a callback function. The +callback is registered with the Meter which ensures the callback is called once +per collection cycle. A callback can be registered two ways: during the +instrument's creation using an option, or later using the RegisterCallback +method of the [Meter] that created the instrument. + +If the following criteria are met, an option ([WithInt64Callback] or +[WithFloat64Callback]) can be used during the asynchronous instrument's +creation to register a callback ([Int64Callback] or [Float64Callback], +respectively): + + - The measurement process is known when the instrument is created + - Only that instrument will make a measurement within the callback + - The callback never needs to be unregistered + +If the criteria are not met, use the RegisterCallback method of the [Meter] that +created the instrument to register a [Callback]. + # API Implementations This package does not conform to the standard Go versioning policy, all of its diff --git a/metric/meter.go b/metric/meter.go index c55d2defa6f..8e1917c3214 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -55,58 +55,95 @@ type Meter interface { // section of the package documentation for more information. embedded.Meter - // Int64Counter returns a new instrument identified by name and configured - // with options. The instrument is used to synchronously record increasing - // int64 measurements during a computational operation. + // Int64Counter returns a new Int64Counter instrument identified by name + // and configured with options. The instrument is used to synchronously + // record increasing int64 measurements during a computational operation. Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error) - // Int64UpDownCounter returns a new instrument identified by name and - // configured with options. The instrument is used to synchronously record - // int64 measurements during a computational operation. + // Int64UpDownCounter returns a new Int64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record int64 measurements during a computational + // operation. Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error) - // Int64Histogram returns a new instrument identified by name and - // configured with options. The instrument is used to synchronously record - // the distribution of int64 measurements during a computational operation. + // Int64Histogram returns a new Int64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of int64 measurements during a + // computational operation. Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error) - // Int64ObservableCounter returns a new instrument identified by name and - // configured with options. The instrument is used to asynchronously record - // increasing int64 measurements once per a measurement collection cycle. + // Int64ObservableCounter returns a new Int64ObservableCounter identified + // by name and configured with options. The instrument is used to + // asynchronously record increasing int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error) - // Int64ObservableUpDownCounter returns a new instrument identified by name - // and configured with options. The instrument is used to asynchronously - // record int64 measurements once per a measurement collection cycle. + // Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record int64 measurements once per + // a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error) - // Int64ObservableGauge returns a new instrument identified by name and - // configured with options. The instrument is used to asynchronously record - // instantaneous int64 measurements once per a measurement collection - // cycle. + // Int64ObservableGauge returns a new Int64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous int64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithInt64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error) - // Float64Counter returns a new instrument identified by name and - // configured with options. The instrument is used to synchronously record - // increasing float64 measurements during a computational operation. + // Float64Counter returns a new Float64Counter instrument identified by + // name and configured with options. The instrument is used to + // synchronously record increasing float64 measurements during a + // computational operation. Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error) - // Float64UpDownCounter returns a new instrument identified by name and - // configured with options. The instrument is used to synchronously record - // float64 measurements during a computational operation. - Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) - // Float64Histogram returns a new instrument identified by name and - // configured with options. The instrument is used to synchronously record - // the distribution of float64 measurements during a computational + // Float64UpDownCounter returns a new Float64UpDownCounter instrument + // identified by name and configured with options. The instrument is used + // to synchronously record float64 measurements during a computational // operation. + Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error) + // Float64Histogram returns a new Float64Histogram instrument identified by + // name and configured with options. The instrument is used to + // synchronously record the distribution of float64 measurements during a + // computational operation. Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error) - // Float64ObservableCounter returns a new instrument identified by name and - // configured with options. The instrument is used to asynchronously record - // increasing float64 measurements once per a measurement collection cycle. + // Float64ObservableCounter returns a new Float64ObservableCounter + // instrument identified by name and configured with options. The + // instrument is used to asynchronously record increasing float64 + // measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error) - // Float64ObservableUpDownCounter returns a new instrument identified by - // name and configured with options. The instrument is used to - // asynchronously record float64 measurements once per a measurement - // collection cycle. - Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) - // Float64ObservableGauge returns a new instrument identified by name and + // Float64ObservableUpDownCounter returns a new + // Float64ObservableUpDownCounter instrument identified by name and // configured with options. The instrument is used to asynchronously record - // instantaneous float64 measurements once per a measurement collection - // cycle. + // float64 measurements once per a measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. + Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error) + // Float64ObservableGauge returns a new Float64ObservableGauge instrument + // identified by name and configured with options. The instrument is used + // to asynchronously record instantaneous float64 measurements once per a + // measurement collection cycle. + // + // Measurements for the returned instrument are made via a callback. Use + // the WithFloat64Callback option to register the callback here, or use the + // RegisterCallback method of this Meter to register one later. See the + // Measurements section of the package documentation for more information. Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error) // RegisterCallback registers f to be called during the collection of a From 7dea2225a218872e86d2f580e82c089b321617b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 10 May 2023 16:47:41 +0200 Subject: [PATCH 531/886] sdk/resource: Fix build for BSD OSes (#4077) * sdk/resource: Fix build for BSD OSes * Add changelog * Update header in changelog --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ sdk/resource/host_id_exec.go | 2 +- sdk/resource/host_id_readfile.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4559541576e..7dd491d2891 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. Use `go.opentelemetry.io/otel/metric` instead. (#4055) +### Fixed + +- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077) + ## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03 This is a release candidate for the v1.16.0/v0.39.0 release. diff --git a/sdk/resource/host_id_exec.go b/sdk/resource/host_id_exec.go index 0080fc6b692..207acb0ed3a 100644 --- a/sdk/resource/host_id_exec.go +++ b/sdk/resource/host_id_exec.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build bsd || darwin +//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris package resource // import "go.opentelemetry.io/otel/sdk/resource" diff --git a/sdk/resource/host_id_readfile.go b/sdk/resource/host_id_readfile.go index df4dc92c195..f92c6dad0f9 100644 --- a/sdk/resource/host_id_readfile.go +++ b/sdk/resource/host_id_readfile.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build bsd || linux +//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris package resource // import "go.opentelemetry.io/otel/sdk/resource" From 24e8d2e5749d22fcd2266eb3e4d35bbe9d42259f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 11 May 2023 16:25:32 +0200 Subject: [PATCH 532/886] sdk/resource: Add Telemetry Stability label (#4080) * Add Telemetry Stability label * Update sdk/resource/doc.go * Update doc.go --------- Co-authored-by: Chester Cheung --- sdk/resource/doc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/resource/doc.go b/sdk/resource/doc.go index 9aab3d83934..d55a50b0dc2 100644 --- a/sdk/resource/doc.go +++ b/sdk/resource/doc.go @@ -25,4 +25,7 @@ // OTEL_RESOURCE_ATTRIBUTES the FromEnv Detector can be used. It will interpret // the value as a list of comma delimited key/value pairs // (e.g. `=,=,...`). +// +// While this package provides a stable API, +// the attributes added by resource detectors may change. package resource // import "go.opentelemetry.io/otel/sdk/resource" From 0297809181a8a472fc89a6ea5ca42b370c264b19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 14 May 2023 07:35:27 -0700 Subject: [PATCH 533/886] Bump golang.org/x/tools from 0.8.0 to 0.9.1 in /internal/tools (#4087) Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.8.0 to 0.9.1. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.8.0...v0.9.1) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 3df1aaced14..7be1829cbea 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.7.0 go.opentelemetry.io/build-tools/multimod v0.7.0 go.opentelemetry.io/build-tools/semconvgen v0.7.0 - golang.org/x/tools v0.8.0 + golang.org/x/tools v0.9.1 ) require ( @@ -192,8 +192,8 @@ require ( golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect - golang.org/x/sync v0.1.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/protobuf v1.30.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 87b0a4c21e2..c5b96ed8541 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -741,8 +741,8 @@ golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -765,8 +765,9 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -841,7 +842,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= +golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -931,8 +932,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= +golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From c04c04c94393c72173adfe0cee0b183db685b205 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 14 May 2023 07:48:45 -0700 Subject: [PATCH 534/886] dependabot updates Sun May 14 14:40:44 UTC 2023 (#4089) Bump github.com/cloudflare/circl from 1.3.1 to 1.3.3 in /internal/tools --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7be1829cbea..0fbdc955d75 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -44,7 +44,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect - github.com/cloudflare/circl v1.3.1 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/daixiang0/gci v0.10.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index c5b96ed8541..fece622fcb6 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -115,8 +115,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.1 h1:4OVCZRL62ijwEwxnF6I7hLwxvIYi3VaZt8TflkqtrtA= -github.com/cloudflare/circl v1.3.1/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= From 1dff818526e06c28f96816dbfb1a8f2fae87924e Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Mon, 15 May 2023 09:55:29 -0400 Subject: [PATCH 535/886] [website_docs] Update path to spec, run formatter (#4084) Co-authored-by: Chester Cheung --- CONTRIBUTING.md | 4 ++-- website_docs/exporters.md | 14 +++++++++----- website_docs/getting-started.md | 4 ++-- website_docs/libraries.md | 2 +- website_docs/manual.md | 5 ++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21642f2f301..949a275616b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,10 +150,10 @@ Any [Maintainer] can merge the PR once the above criteria have been met. ## Design Choices As with other OpenTelemetry clients, opentelemetry-go follows the -[OpenTelemetry Specification](https://opentelemetry.io/docs/reference/specification). +[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel). It's especially valuable to read through the [library -guidelines](https://opentelemetry.io/docs/reference/specification/library-guidelines). +guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines). ### Focus on Capabilities, Not Structure Compliance diff --git a/website_docs/exporters.md b/website_docs/exporters.md index ddd346c40d2..40659f91b71 100644 --- a/website_docs/exporters.md +++ b/website_docs/exporters.md @@ -10,7 +10,8 @@ and metrics, you will need to export them to a backend. ## OTLP endpoint To send trace data to an OTLP endpoint (like the [collector](/docs/collector) or -Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your endpoint. +Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your +endpoint. ### Using HTTP @@ -30,12 +31,13 @@ func installExportPipeline(ctx context.Context) (func(context.Context) error, er } ``` -To learn more on how to use the OTLP HTTP exporter, try out the [otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector) +To learn more on how to use the OTLP HTTP exporter, try out the +[otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector) ### Jaeger To try out the OTLP exporter, since v1.35.0 you can run -[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace +[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace visualization in a docker container: ```shell @@ -48,6 +50,8 @@ docker run -d --name jaeger \ ## Prometheus -Prometheus export is available in the `go.opentelemetry.io/otel/exporters/prometheus` package. +Prometheus export is available in the +`go.opentelemetry.io/otel/exporters/prometheus` package. -Please find more documentation on [GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) +Please find more documentation on +[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index c8327f133c9..e415380b866 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -190,8 +190,8 @@ With the imports added, you can start instrumenting. The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These [`Tracer`]s are designed to be associated with one instrumentation library. That way telemetry they produce can be understood to come from that part of a code -base. To uniquely identify your application to the [`Tracer`] you will -create a constant with the package name in `app.go`. +base. To uniquely identify your application to the [`Tracer`] you will create a +constant with the package name in `app.go`. ```go // name is the Tracer name used to identify this instrumentation library. diff --git a/website_docs/libraries.md b/website_docs/libraries.md index 6c6028456c7..a441bf51b7a 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -9,7 +9,7 @@ weight: 3 Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on -[instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library) +[instrumentation libraries](/docs/specs/otel/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code. diff --git a/website_docs/manual.md b/website_docs/manual.md index dc17bacab92..ec77577430c 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -297,7 +297,6 @@ After configuring context propagation, you'll most likely want to use automatic instrumentation to handle the behind-the-scenes work of actually managing serializing the context. -[opentelemetry specification]: /docs/reference/specification/ -[trace semantic conventions]: - /docs/reference/specification/trace/semantic_conventions/ +[opentelemetry specification]: /docs/specs/otel/ +[trace semantic conventions]: /docs/specs/otel/trace/semantic_conventions/ [instrumentation library]: ../libraries/ From fadd3d6a63fe622bc3d5f08fba090e9abeb8db2e Mon Sep 17 00:00:00 2001 From: Chen Xu Date: Mon, 15 May 2023 07:18:43 -0700 Subject: [PATCH 536/886] [SDK][Trace] Add tests for default id generator (#4043) Signed-off-by: Chen Xu Co-authored-by: Tyler Yahn --- sdk/trace/id_generator_test.go | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sdk/trace/id_generator_test.go diff --git a/sdk/trace/id_generator_test.go b/sdk/trace/id_generator_test.go new file mode 100644 index 00000000000..ddb0d062112 --- /dev/null +++ b/sdk/trace/id_generator_test.go @@ -0,0 +1,52 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/trace" +) + +func TestNewIDs(t *testing.T) { + gen := defaultIDGenerator() + n := 1000 + + for i := 0; i < n; i++ { + traceID, spanID := gen.NewIDs(context.Background()) + assert.Truef(t, traceID.IsValid(), "trace id: %s", traceID.String()) + assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String()) + } +} + +func TestNewSpanID(t *testing.T) { + gen := defaultIDGenerator() + testTraceID := [16]byte{123, 123} + n := 1000 + + for i := 0; i < n; i++ { + spanID := gen.NewSpanID(context.Background(), testTraceID) + assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String()) + } +} + +func TestNewSpanIDWithInvalidTraceID(t *testing.T) { + gen := defaultIDGenerator() + spanID := gen.NewSpanID(context.Background(), trace.TraceID{}) + assert.Truef(t, spanID.IsValid(), "span id: %s", spanID.String()) +} From 8445f2130554fae70dc97906c5d5eb46ef1a82c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 16 May 2023 20:17:28 +0200 Subject: [PATCH 537/886] Add semconv/v1.20.0 (#4078) * Add semconv/v1.20.0 * Update changelog * Change http.flavor to net.protocol.(name|version) * Update comments in httpconv * Fix vanity import * Update CHANGELOG.md Co-authored-by: Tyler Yahn --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 5 + RELEASING.md | 1 - .../templates/httpconv/http.go.tmpl | 22 +- .../semconvkit/templates/netconv/net.go.tmpl | 2 +- semconv/internal/v4/http.go | 405 +++ semconv/internal/v4/http_test.go | 515 ++++ semconv/internal/v4/net.go | 324 ++ semconv/internal/v4/net_test.go | 344 +++ semconv/v1.20.0/attribute_group.go | 1209 ++++++++ semconv/v1.20.0/doc.go | 20 + semconv/v1.20.0/event.go | 199 ++ semconv/v1.20.0/exception.go | 20 + semconv/v1.20.0/http.go | 21 + semconv/v1.20.0/httpconv/http.go | 154 + semconv/v1.20.0/netconv/net.go | 66 + semconv/v1.20.0/resource.go | 2071 +++++++++++++ semconv/v1.20.0/schema.go | 20 + semconv/v1.20.0/trace.go | 2610 +++++++++++++++++ 18 files changed, 7996 insertions(+), 12 deletions(-) create mode 100644 semconv/internal/v4/http.go create mode 100644 semconv/internal/v4/http_test.go create mode 100644 semconv/internal/v4/net.go create mode 100644 semconv/internal/v4/net_test.go create mode 100644 semconv/v1.20.0/attribute_group.go create mode 100644 semconv/v1.20.0/doc.go create mode 100644 semconv/v1.20.0/event.go create mode 100644 semconv/v1.20.0/exception.go create mode 100644 semconv/v1.20.0/http.go create mode 100644 semconv/v1.20.0/httpconv/http.go create mode 100644 semconv/v1.20.0/netconv/net.go create mode 100644 semconv/v1.20.0/resource.go create mode 100644 semconv/v1.20.0/schema.go create mode 100644 semconv/v1.20.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd491d2891..f8da7403482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.20.0` package. + The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. diff --git a/RELEASING.md b/RELEASING.md index 7dc4907162a..5e6daf6c48e 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -14,7 +14,6 @@ For example, ```sh export TAG="v1.13.0" # Change to the release version you are generating. export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" -git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" -b "$TAG" docker pull otel/semconvgen:latest make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. ``` diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl index 7d2b0a5519d..31eccc1608e 100644 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv/internal/v3" + "go.opentelemetry.io/otel/semconv/internal/v4" semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" ) @@ -44,7 +44,8 @@ var ( EnduserIDKey: semconv.EnduserIDKey, HTTPClientIPKey: semconv.HTTPClientIPKey, - HTTPFlavorKey: semconv.HTTPFlavorKey, + NetProtocolNameKey: semconv.NetProtocolNameKey, + NetProtocolVersionKey: semconv.NetProtocolVersionKey, HTTPMethodKey: semconv.HTTPMethodKey, HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, @@ -74,10 +75,11 @@ func ClientResponse(resp *http.Response) []attribute.KeyValue { } // ClientRequest returns trace attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.url", "http.flavor", -// "http.method", "net.peer.name". The following attributes are returned if the -// related values are defined in req: "net.peer.port", "http.user_agent", -// "http.request_content_length", "enduser.id". +// The following attributes are always returned: "http.url", +// "net.protocol.(name|version)", "http.method", "net.peer.name". +// The following attributes are returned if the related values are defined +// in req: "net.peer.port", "http.user_agent", "http.request_content_length", +// "enduser.id". func ClientRequest(req *http.Request) []attribute.KeyValue { return hc.ClientRequest(req) } @@ -106,10 +108,10 @@ func ClientStatus(code int) (codes.Code, string) { // The req Host will be used to determine the server instead. // // The following attributes are always returned: "http.method", "http.scheme", -// "http.flavor", "http.target", "net.host.name". The following attributes are -// returned if they related values are defined in req: "net.host.port", -// "net.sock.peer.addr", "net.sock.peer.port", "user_agent.original", "enduser.id", -// "http.client_ip". +// ""net.protocol.(name|version)", "http.target", "net.host.name". +// The following attributes are returned if they related values are defined +// in req: "net.host.port", "net.sock.peer.addr", "net.sock.peer.port", +// "user_agent.original", "enduser.id", "http.client_ip". func ServerRequest(server string, req *http.Request) []attribute.KeyValue { return hc.ServerRequest(server, req) } diff --git a/internal/tools/semconvkit/templates/netconv/net.go.tmpl b/internal/tools/semconvkit/templates/netconv/net.go.tmpl index 627deba0dd7..a855c45c767 100644 --- a/internal/tools/semconvkit/templates/netconv/net.go.tmpl +++ b/internal/tools/semconvkit/templates/netconv/net.go.tmpl @@ -20,7 +20,7 @@ import ( "net" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/semconv/internal/v3" + "go.opentelemetry.io/otel/semconv/internal/v4" semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" ) diff --git a/semconv/internal/v4/http.go b/semconv/internal/v4/http.go new file mode 100644 index 00000000000..e09adffffed --- /dev/null +++ b/semconv/internal/v4/http.go @@ -0,0 +1,405 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v4" + +import ( + "fmt" + "net/http" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +// HTTPConv are the HTTP semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type HTTPConv struct { + NetConv *NetConv + + EnduserIDKey attribute.Key + HTTPClientIPKey attribute.Key + NetProtocolNameKey attribute.Key + NetProtocolVersionKey attribute.Key + HTTPMethodKey attribute.Key + HTTPRequestContentLengthKey attribute.Key + HTTPResponseContentLengthKey attribute.Key + HTTPRouteKey attribute.Key + HTTPSchemeHTTP attribute.KeyValue + HTTPSchemeHTTPS attribute.KeyValue + HTTPStatusCodeKey attribute.Key + HTTPTargetKey attribute.Key + HTTPURLKey attribute.Key + UserAgentOriginalKey attribute.Key +} + +// ClientResponse returns attributes for an HTTP response received by a client +// from a server. The following attributes are returned if the related values +// are defined in resp: "http.status.code", "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func (c *HTTPConv) ClientResponse(resp *http.Response) []attribute.KeyValue { + var n int + if resp.StatusCode > 0 { + n++ + } + if resp.ContentLength > 0 { + n++ + } + + attrs := make([]attribute.KeyValue, 0, n) + if resp.StatusCode > 0 { + attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) + } + if resp.ContentLength > 0 { + attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) + } + return attrs +} + +// ClientRequest returns attributes for an HTTP request made by a client. The +// following attributes are always returned: "http.url", "http.flavor", +// "http.method", "net.peer.name". The following attributes are returned if the +// related values are defined in req: "net.peer.port", "http.user_agent", +// "http.request_content_length", "enduser.id". +func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue { + n := 3 // URL, peer name, proto, and method. + var h string + if req.URL != nil { + h = req.URL.Host + } + peer, p := firstHostPort(h, req.Header.Get("Host")) + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) + if port > 0 { + n++ + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + if req.ContentLength > 0 { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.proto(req.Proto)) + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, c.HTTPURLKey.String(u)) + + attrs = append(attrs, c.NetConv.PeerName(peer)) + if port > 0 { + attrs = append(attrs, c.NetConv.PeerPort(port)) + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if l := req.ContentLength; l > 0 { + attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + return attrs +} + +// ServerRequest returns attributes for an HTTP request received by a server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// "http.flavor", "http.target", "net.host.name". The following attributes are +// returned if they related values are defined in req: "net.host.port", +// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id", +// "http.client_ip". +func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue { + // TODO: This currently does not add the specification required + // `http.target` attribute. It has too high of a cardinality to safely be + // added. An alternate should be added, or this comment removed, when it is + // addressed by the specification. If it is ultimately decided to continue + // not including the attribute, the HTTPTargetKey field of the HTTPConv + // should be removed as well. + + n := 4 // Method, scheme, proto, and host name. + var host string + var p int + if server == "" { + host, p = splitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = splitHostPort(server) + if p < 0 { + _, p = splitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + n++ + } + peer, peerPort := splitHostPort(req.RemoteAddr) + if peer != "" { + n++ + if peerPort > 0 { + n++ + } + } + useragent := req.UserAgent() + if useragent != "" { + n++ + } + userID, _, hasUserID := req.BasicAuth() + if hasUserID { + n++ + } + clientIP := serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP != "" { + n++ + } + attrs := make([]attribute.KeyValue, 0, n) + + attrs = append(attrs, c.method(req.Method)) + attrs = append(attrs, c.scheme(req.TLS != nil)) + attrs = append(attrs, c.proto(req.Proto)) + attrs = append(attrs, c.NetConv.HostName(host)) + + if hostPort > 0 { + attrs = append(attrs, c.NetConv.HostPort(hostPort)) + } + + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) + if peerPort > 0 { + attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) + } + + if hasUserID { + attrs = append(attrs, c.EnduserIDKey.String(userID)) + } + + if clientIP != "" { + attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) + } + + return attrs +} + +func (c *HTTPConv) method(method string) attribute.KeyValue { + if method == "" { + return c.HTTPMethodKey.String(http.MethodGet) + } + return c.HTTPMethodKey.String(method) +} + +func (c *HTTPConv) scheme(https bool) attribute.KeyValue { // nolint:revive + if https { + return c.HTTPSchemeHTTPS + } + return c.HTTPSchemeHTTP +} + +func (c *HTTPConv) proto(proto string) attribute.KeyValue { + switch proto { + case "HTTP/1.0": + return c.NetProtocolVersionKey.String("1.0") + case "HTTP/1.1": + return c.NetProtocolVersionKey.String("1.1") + case "HTTP/2": + return c.NetProtocolVersionKey.String("2.0") + case "HTTP/3": + return c.NetProtocolVersionKey.String("3.0") + default: + return c.NetProtocolNameKey.String(proto) + } +} + +func serverClientIP(xForwardedFor string) string { + if idx := strings.Index(xForwardedFor, ","); idx >= 0 { + xForwardedFor = xForwardedFor[:idx] + } + return xForwardedFor +} + +func requiredHTTPPort(https bool, port int) int { // nolint:revive + if https { + if port > 0 && port != 443 { + return port + } + } else { + if port > 0 && port != 80 { + return port + } + } + return -1 +} + +// Return the request host and port from the first non-empty source. +func firstHostPort(source ...string) (host string, port int) { + for _, hostport := range source { + host, port = splitHostPort(hostport) + if host != "" || port > 0 { + break + } + } + return +} + +// RequestHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) RequestHeader(h http.Header) []attribute.KeyValue { + return c.header("http.request.header", h) +} + +// ResponseHeader returns the contents of h as OpenTelemetry attributes. +func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue { + return c.header("http.response.header", h) +} + +func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue { + key := func(k string) attribute.Key { + k = strings.ToLower(k) + k = strings.ReplaceAll(k, "-", "_") + k = fmt.Sprintf("%s.%s", prefix, k) + return attribute.Key(k) + } + + attrs := make([]attribute.KeyValue, 0, len(h)) + for k, v := range h { + attrs = append(attrs, key(k).StringSlice(v)) + } + return attrs +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + return stat, "" +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) { + stat, valid := validateHTTPStatusCode(code) + if !valid { + return stat, fmt.Sprintf("Invalid HTTP status code %d", code) + } + + if code/100 == 4 { + return codes.Unset, "" + } + return stat, "" +} + +type codeRange struct { + fromInclusive int + toInclusive int +} + +func (r codeRange) contains(code int) bool { + return r.fromInclusive <= code && code <= r.toInclusive +} + +var validRangesPerCategory = map[int][]codeRange{ + 1: { + {http.StatusContinue, http.StatusEarlyHints}, + }, + 2: { + {http.StatusOK, http.StatusAlreadyReported}, + {http.StatusIMUsed, http.StatusIMUsed}, + }, + 3: { + {http.StatusMultipleChoices, http.StatusUseProxy}, + {http.StatusTemporaryRedirect, http.StatusPermanentRedirect}, + }, + 4: { + {http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful… + {http.StatusMisdirectedRequest, http.StatusUpgradeRequired}, + {http.StatusPreconditionRequired, http.StatusTooManyRequests}, + {http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge}, + {http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons}, + }, + 5: { + {http.StatusInternalServerError, http.StatusLoopDetected}, + {http.StatusNotExtended, http.StatusNetworkAuthenticationRequired}, + }, +} + +// validateHTTPStatusCode validates the HTTP status code and returns +// corresponding span status code. If the `code` is not a valid HTTP status +// code, returns span status Error and false. +func validateHTTPStatusCode(code int) (codes.Code, bool) { + category := code / 100 + ranges, ok := validRangesPerCategory[category] + if !ok { + return codes.Error, false + } + ok = false + for _, crange := range ranges { + ok = crange.contains(code) + if ok { + break + } + } + if !ok { + return codes.Error, false + } + if category > 0 && category < 4 { + return codes.Unset, true + } + return codes.Error, true +} diff --git a/semconv/internal/v4/http_test.go b/semconv/internal/v4/http_test.go new file mode 100644 index 00000000000..e8d83ea3140 --- /dev/null +++ b/semconv/internal/v4/http_test.go @@ -0,0 +1,515 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net/http" + "net/http/httptest" + "net/url" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" +) + +var hc = &HTTPConv{ + NetConv: nc, + + EnduserIDKey: attribute.Key("enduser.id"), + HTTPClientIPKey: attribute.Key("http.client_ip"), + NetProtocolNameKey: attribute.Key("net.protocol.name"), + NetProtocolVersionKey: attribute.Key("net.protocol.version"), + HTTPMethodKey: attribute.Key("http.method"), + HTTPRequestContentLengthKey: attribute.Key("http.request_content_length"), + HTTPResponseContentLengthKey: attribute.Key("http.response_content_length"), + HTTPRouteKey: attribute.Key("http.route"), + HTTPSchemeHTTP: attribute.String("http.scheme", "http"), + HTTPSchemeHTTPS: attribute.String("http.scheme", "https"), + HTTPStatusCodeKey: attribute.Key("http.status_code"), + HTTPTargetKey: attribute.Key("http.target"), + HTTPURLKey: attribute.Key("http.url"), + UserAgentOriginalKey: attribute.Key("user_agent.original"), +} + +func TestHTTPClientResponse(t *testing.T) { + const stat, n = 201, 397 + resp := &http.Response{ + StatusCode: stat, + ContentLength: n, + } + got := hc.ClientResponse(resp) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.Key("http.status_code").Int(stat), + attribute.Key("http.response_content_length").Int(n), + }, got) +} + +func TestHTTPSClientRequest(t *testing.T) { + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "https", + Host: "127.0.0.1:443", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + } + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("net.protocol.version", "1.0"), + attribute.String("http.url", "https://127.0.0.1:443/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + }, + hc.ClientRequest(req), + ) +} + +func TestHTTPClientRequest(t *testing.T) { + const ( + user = "alice" + n = 128 + agent = "Go-http-client/1.1" + ) + req := &http.Request{ + Method: http.MethodGet, + URL: &url.URL{ + Scheme: "http", + Host: "127.0.0.1:8080", + Path: "/resource", + }, + Proto: "HTTP/1.0", + ProtoMajor: 1, + ProtoMinor: 0, + Header: http.Header{ + "User-Agent": []string{agent}, + }, + ContentLength: n, + } + req.SetBasicAuth(user, "pswrd") + + assert.Equal( + t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("net.protocol.version", "1.0"), + attribute.String("http.url", "http://127.0.0.1:8080/resource"), + attribute.String("net.peer.name", "127.0.0.1"), + attribute.Int("net.peer.port", 8080), + attribute.String("user_agent.original", agent), + attribute.Int("http.request_content_length", n), + attribute.String("enduser.id", user), + }, + hc.ClientRequest(req), + ) +} + +func TestHTTPClientRequestRequired(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ClientRequest(req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("net.protocol.name", ""), + attribute.String("http.url", ""), + attribute.String("net.peer.name", ""), + } + assert.Equal(t, want, got) +} + +func TestHTTPServerRequest(t *testing.T) { + got := make(chan *http.Request, 1) + handler := func(w http.ResponseWriter, r *http.Request) { + got <- r + w.WriteHeader(http.StatusOK) + } + + srv := httptest.NewServer(http.HandlerFunc(handler)) + defer srv.Close() + + srvURL, err := url.Parse(srv.URL) + require.NoError(t, err) + srvPort, err := strconv.ParseInt(srvURL.Port(), 10, 32) + require.NoError(t, err) + + resp, err := srv.Client().Get(srv.URL) + require.NoError(t, err) + require.NoError(t, resp.Body.Close()) + + req := <-got + peer, peerPort := splitHostPort(req.RemoteAddr) + + const user = "alice" + req.SetBasicAuth(user, "pswrd") + + const clientIP = "127.0.0.5" + req.Header.Add("X-Forwarded-For", clientIP) + + assert.ElementsMatch(t, + []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("net.protocol.version", "1.1"), + attribute.String("net.host.name", srvURL.Hostname()), + attribute.Int("net.host.port", int(srvPort)), + attribute.String("net.sock.peer.addr", peer), + attribute.Int("net.sock.peer.port", peerPort), + attribute.String("user_agent.original", "Go-http-client/1.1"), + attribute.String("enduser.id", user), + attribute.String("http.client_ip", clientIP), + }, + hc.ServerRequest("", req)) +} + +func TestHTTPServerName(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + const ( + host = "test.semconv.server" + port = 8080 + ) + portStr := strconv.Itoa(port) + server := host + ":" + portStr + assert.NotPanics(t, func() { got = hc.ServerRequest(server, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) + + req = &http.Request{Host: "alt.host.name:" + portStr} + // The server parameter does not include a port, ServerRequest should use + // the port in the request Host field. + assert.NotPanics(t, func() { got = hc.ServerRequest(host, req) }) + assert.Contains(t, got, attribute.String("net.host.name", host)) + assert.Contains(t, got, attribute.Int("net.host.port", port)) +} + +func TestHTTPServerRequestFailsGracefully(t *testing.T) { + req := new(http.Request) + var got []attribute.KeyValue + assert.NotPanics(t, func() { got = hc.ServerRequest("", req) }) + want := []attribute.KeyValue{ + attribute.String("http.method", "GET"), + attribute.String("http.scheme", "http"), + attribute.String("net.protocol.name", ""), + attribute.String("net.host.name", ""), + } + assert.ElementsMatch(t, want, got) +} + +func TestMethod(t *testing.T) { + assert.Equal(t, attribute.String("http.method", "POST"), hc.method("POST")) + assert.Equal(t, attribute.String("http.method", "GET"), hc.method("")) + assert.Equal(t, attribute.String("http.method", "garbage"), hc.method("garbage")) +} + +func TestScheme(t *testing.T) { + assert.Equal(t, attribute.String("http.scheme", "http"), hc.scheme(false)) + assert.Equal(t, attribute.String("http.scheme", "https"), hc.scheme(true)) +} + +func TestProto(t *testing.T) { + testCases := []struct { + in string + want attribute.KeyValue + }{ + { + in: "HTTP/1.0", + want: attribute.String("net.protocol.version", "1.0"), + }, + { + in: "HTTP/1.1", + want: attribute.String("net.protocol.version", "1.1"), + }, + { + in: "HTTP/2", + want: attribute.String("net.protocol.version", "2.0"), + }, + { + in: "HTTP/3", + want: attribute.String("net.protocol.version", "3.0"), + }, + { + in: "SPDY", + want: attribute.String("net.protocol.name", "SPDY"), + }, + { + in: "QUIC", + want: attribute.String("net.protocol.name", "QUIC"), + }, + { + in: "other", + want: attribute.String("net.protocol.name", "other"), + }, + } + for _, tc := range testCases { + t.Run(tc.in, func(t *testing.T) { + got := hc.proto(tc.in) + assert.Equal(t, tc.want, got) + }) + } +} + +func TestServerClientIP(t *testing.T) { + tests := []struct { + xForwardedFor string + want string + }{ + {"", ""}, + {"127.0.0.1", "127.0.0.1"}, + {"127.0.0.1,127.0.0.5", "127.0.0.1"}, + } + for _, test := range tests { + got := serverClientIP(test.xForwardedFor) + assert.Equal(t, test.want, got, test.xForwardedFor) + } +} + +func TestRequiredHTTPPort(t *testing.T) { + tests := []struct { + https bool + port int + want int + }{ + {true, 443, -1}, + {true, 80, 80}, + {true, 8081, 8081}, + {false, 443, 443}, + {false, 80, -1}, + {false, 8080, 8080}, + } + for _, test := range tests { + got := requiredHTTPPort(test.https, test.port) + assert.Equal(t, test.want, got, test.https, test.port) + } +} + +func TestFirstHostPort(t *testing.T) { + host, port := "127.0.0.1", 8080 + hostport := "127.0.0.1:8080" + sources := [][]string{ + {hostport}, + {"", hostport}, + {"", "", hostport}, + {"", "", hostport, ""}, + {"", "", hostport, "127.0.0.3:80"}, + } + + for _, src := range sources { + h, p := firstHostPort(src...) + assert.Equal(t, host, h, src) + assert.Equal(t, port, p, src) + } +} + +func TestRequestHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.RequestHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.request.header.ips", ips), + attribute.StringSlice("http.request.header.user", user), + }, got) +} + +func TestReponseHeader(t *testing.T) { + ips := []string{"127.0.0.5", "127.0.0.9"} + user := []string{"alice"} + h := http.Header{"ips": ips, "user": user} + + got := hc.ResponseHeader(h) + assert.Equal(t, 2, cap(got), "slice capacity") + assert.ElementsMatch(t, []attribute.KeyValue{ + attribute.StringSlice("http.response.header.ips", ips), + attribute.StringSlice("http.response.header.user", user), + }, got) +} + +func TestClientStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Error, false}, + {http.StatusUnauthorized, codes.Error, false}, + {http.StatusPaymentRequired, codes.Error, false}, + {http.StatusForbidden, codes.Error, false}, + {http.StatusNotFound, codes.Error, false}, + {http.StatusMethodNotAllowed, codes.Error, false}, + {http.StatusNotAcceptable, codes.Error, false}, + {http.StatusProxyAuthRequired, codes.Error, false}, + {http.StatusRequestTimeout, codes.Error, false}, + {http.StatusConflict, codes.Error, false}, + {http.StatusGone, codes.Error, false}, + {http.StatusLengthRequired, codes.Error, false}, + {http.StatusPreconditionFailed, codes.Error, false}, + {http.StatusRequestEntityTooLarge, codes.Error, false}, + {http.StatusRequestURITooLong, codes.Error, false}, + {http.StatusUnsupportedMediaType, codes.Error, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Error, false}, + {http.StatusExpectationFailed, codes.Error, false}, + {http.StatusTeapot, codes.Error, false}, + {http.StatusMisdirectedRequest, codes.Error, false}, + {http.StatusUnprocessableEntity, codes.Error, false}, + {http.StatusLocked, codes.Error, false}, + {http.StatusFailedDependency, codes.Error, false}, + {http.StatusTooEarly, codes.Error, false}, + {http.StatusUpgradeRequired, codes.Error, false}, + {http.StatusPreconditionRequired, codes.Error, false}, + {http.StatusTooManyRequests, codes.Error, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Error, false}, + {http.StatusUnavailableForLegalReasons, codes.Error, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ClientStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} + +func TestServerStatus(t *testing.T) { + tests := []struct { + code int + stat codes.Code + msg bool + }{ + {0, codes.Error, true}, + {http.StatusContinue, codes.Unset, false}, + {http.StatusSwitchingProtocols, codes.Unset, false}, + {http.StatusProcessing, codes.Unset, false}, + {http.StatusEarlyHints, codes.Unset, false}, + {http.StatusOK, codes.Unset, false}, + {http.StatusCreated, codes.Unset, false}, + {http.StatusAccepted, codes.Unset, false}, + {http.StatusNonAuthoritativeInfo, codes.Unset, false}, + {http.StatusNoContent, codes.Unset, false}, + {http.StatusResetContent, codes.Unset, false}, + {http.StatusPartialContent, codes.Unset, false}, + {http.StatusMultiStatus, codes.Unset, false}, + {http.StatusAlreadyReported, codes.Unset, false}, + {http.StatusIMUsed, codes.Unset, false}, + {http.StatusMultipleChoices, codes.Unset, false}, + {http.StatusMovedPermanently, codes.Unset, false}, + {http.StatusFound, codes.Unset, false}, + {http.StatusSeeOther, codes.Unset, false}, + {http.StatusNotModified, codes.Unset, false}, + {http.StatusUseProxy, codes.Unset, false}, + {306, codes.Error, true}, + {http.StatusTemporaryRedirect, codes.Unset, false}, + {http.StatusPermanentRedirect, codes.Unset, false}, + {http.StatusBadRequest, codes.Unset, false}, + {http.StatusUnauthorized, codes.Unset, false}, + {http.StatusPaymentRequired, codes.Unset, false}, + {http.StatusForbidden, codes.Unset, false}, + {http.StatusNotFound, codes.Unset, false}, + {http.StatusMethodNotAllowed, codes.Unset, false}, + {http.StatusNotAcceptable, codes.Unset, false}, + {http.StatusProxyAuthRequired, codes.Unset, false}, + {http.StatusRequestTimeout, codes.Unset, false}, + {http.StatusConflict, codes.Unset, false}, + {http.StatusGone, codes.Unset, false}, + {http.StatusLengthRequired, codes.Unset, false}, + {http.StatusPreconditionFailed, codes.Unset, false}, + {http.StatusRequestEntityTooLarge, codes.Unset, false}, + {http.StatusRequestURITooLong, codes.Unset, false}, + {http.StatusUnsupportedMediaType, codes.Unset, false}, + {http.StatusRequestedRangeNotSatisfiable, codes.Unset, false}, + {http.StatusExpectationFailed, codes.Unset, false}, + {http.StatusTeapot, codes.Unset, false}, + {http.StatusMisdirectedRequest, codes.Unset, false}, + {http.StatusUnprocessableEntity, codes.Unset, false}, + {http.StatusLocked, codes.Unset, false}, + {http.StatusFailedDependency, codes.Unset, false}, + {http.StatusTooEarly, codes.Unset, false}, + {http.StatusUpgradeRequired, codes.Unset, false}, + {http.StatusPreconditionRequired, codes.Unset, false}, + {http.StatusTooManyRequests, codes.Unset, false}, + {http.StatusRequestHeaderFieldsTooLarge, codes.Unset, false}, + {http.StatusUnavailableForLegalReasons, codes.Unset, false}, + {http.StatusInternalServerError, codes.Error, false}, + {http.StatusNotImplemented, codes.Error, false}, + {http.StatusBadGateway, codes.Error, false}, + {http.StatusServiceUnavailable, codes.Error, false}, + {http.StatusGatewayTimeout, codes.Error, false}, + {http.StatusHTTPVersionNotSupported, codes.Error, false}, + {http.StatusVariantAlsoNegotiates, codes.Error, false}, + {http.StatusInsufficientStorage, codes.Error, false}, + {http.StatusLoopDetected, codes.Error, false}, + {http.StatusNotExtended, codes.Error, false}, + {http.StatusNetworkAuthenticationRequired, codes.Error, false}, + {600, codes.Error, true}, + } + + for _, test := range tests { + c, msg := hc.ServerStatus(test.code) + assert.Equal(t, test.stat, c) + if test.msg && msg == "" { + t.Errorf("expected non-empty message for %d", test.code) + } else if !test.msg && msg != "" { + t.Errorf("expected empty message for %d, got: %s", test.code, msg) + } + } +} diff --git a/semconv/internal/v4/net.go b/semconv/internal/v4/net.go new file mode 100644 index 00000000000..751b2d74fd2 --- /dev/null +++ b/semconv/internal/v4/net.go @@ -0,0 +1,324 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/semconv/internal/v4" + +import ( + "net" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" +) + +// NetConv are the network semantic convention attributes defined for a version +// of the OpenTelemetry specification. +type NetConv struct { + NetHostNameKey attribute.Key + NetHostPortKey attribute.Key + NetPeerNameKey attribute.Key + NetPeerPortKey attribute.Key + NetSockFamilyKey attribute.Key + NetSockPeerAddrKey attribute.Key + NetSockPeerPortKey attribute.Key + NetSockHostAddrKey attribute.Key + NetSockHostPortKey attribute.Key + NetTransportOther attribute.KeyValue + NetTransportTCP attribute.KeyValue + NetTransportUDP attribute.KeyValue + NetTransportInProc attribute.KeyValue +} + +func (c *NetConv) Transport(network string) attribute.KeyValue { + switch network { + case "tcp", "tcp4", "tcp6": + return c.NetTransportTCP + case "udp", "udp4", "udp6": + return c.NetTransportUDP + case "unix", "unixgram", "unixpacket": + return c.NetTransportInProc + default: + // "ip:*", "ip4:*", and "ip6:*" all are considered other. + return c.NetTransportOther + } +} + +// Host returns attributes for a network host address. +func (c *NetConv) Host(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.HostName(h)) + if p > 0 { + attrs = append(attrs, c.HostPort(int(p))) + } + return attrs +} + +// Server returns attributes for a network listener listening at address. See +// net.Listen for information about acceptable address values, address should +// be the same as the one used to create ln. If ln is nil, only network host +// attributes will be returned that describe address. Otherwise, the socket +// level information about ln will also be included. +func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue { + if ln == nil { + return c.Host(address) + } + + lAddr := ln.Addr() + if lAddr == nil { + return c.Host(address) + } + + hostName, hostPort := splitHostPort(address) + sockHostAddr, sockHostPort := splitHostPort(lAddr.String()) + network := lAddr.Network() + sockFamily := family(network, sockHostAddr) + + n := nonZeroStr(hostName, network, sockHostAddr, sockFamily) + n += positiveInt(hostPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if hostName != "" { + attr = append(attr, c.HostName(hostName)) + if hostPort > 0 { + // Only if net.host.name is set should net.host.port be. + attr = append(attr, c.HostPort(hostPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func (c *NetConv) HostName(name string) attribute.KeyValue { + return c.NetHostNameKey.String(name) +} + +func (c *NetConv) HostPort(port int) attribute.KeyValue { + return c.NetHostPortKey.Int(port) +} + +// Client returns attributes for a client network connection to address. See +// net.Dial for information about acceptable address values, address should be +// the same as the one used to create conn. If conn is nil, only network peer +// attributes will be returned that describe address. Otherwise, the socket +// level information about conn will also be included. +func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue { + if conn == nil { + return c.Peer(address) + } + + lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr() + + var network string + switch { + case lAddr != nil: + network = lAddr.Network() + case rAddr != nil: + network = rAddr.Network() + default: + return c.Peer(address) + } + + peerName, peerPort := splitHostPort(address) + var ( + sockFamily string + sockPeerAddr string + sockPeerPort int + sockHostAddr string + sockHostPort int + ) + + if lAddr != nil { + sockHostAddr, sockHostPort = splitHostPort(lAddr.String()) + } + + if rAddr != nil { + sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String()) + } + + switch { + case sockHostAddr != "": + sockFamily = family(network, sockHostAddr) + case sockPeerAddr != "": + sockFamily = family(network, sockPeerAddr) + } + + n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily) + n += positiveInt(peerPort, sockPeerPort, sockHostPort) + attr := make([]attribute.KeyValue, 0, n) + if peerName != "" { + attr = append(attr, c.PeerName(peerName)) + if peerPort > 0 { + // Only if net.peer.name is set should net.peer.port be. + attr = append(attr, c.PeerPort(peerPort)) + } + } + if network != "" { + attr = append(attr, c.Transport(network)) + } + if sockFamily != "" { + attr = append(attr, c.NetSockFamilyKey.String(sockFamily)) + } + if sockPeerAddr != "" { + attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr)) + if sockPeerPort > 0 { + // Only if net.sock.peer.addr is set should net.sock.peer.port be. + attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort)) + } + } + if sockHostAddr != "" { + attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr)) + if sockHostPort > 0 { + // Only if net.sock.host.addr is set should net.sock.host.port be. + attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort)) + } + } + return attr +} + +func family(network, address string) string { + switch network { + case "unix", "unixgram", "unixpacket": + return "unix" + default: + if ip := net.ParseIP(address); ip != nil { + if ip.To4() == nil { + return "inet6" + } + return "inet" + } + } + return "" +} + +func nonZeroStr(strs ...string) int { + var n int + for _, str := range strs { + if str != "" { + n++ + } + } + return n +} + +func positiveInt(ints ...int) int { + var n int + for _, i := range ints { + if i > 0 { + n++ + } + } + return n +} + +// Peer returns attributes for a network peer address. +func (c *NetConv) Peer(address string) []attribute.KeyValue { + h, p := splitHostPort(address) + var n int + if h != "" { + n++ + if p > 0 { + n++ + } + } + + if n == 0 { + return nil + } + + attrs := make([]attribute.KeyValue, 0, n) + attrs = append(attrs, c.PeerName(h)) + if p > 0 { + attrs = append(attrs, c.PeerPort(int(p))) + } + return attrs +} + +func (c *NetConv) PeerName(name string) attribute.KeyValue { + return c.NetPeerNameKey.String(name) +} + +func (c *NetConv) PeerPort(port int) attribute.KeyValue { + return c.NetPeerPortKey.Int(port) +} + +func (c *NetConv) SockPeerAddr(addr string) attribute.KeyValue { + return c.NetSockPeerAddrKey.String(addr) +} + +func (c *NetConv) SockPeerPort(port int) attribute.KeyValue { + return c.NetSockPeerPortKey.Int(port) +} + +// splitHostPort splits a network address hostport of the form "host", +// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", +// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and +// port. +// +// An empty host is returned if it is not provided or unparsable. A negative +// port is returned if it is not provided or unparsable. +func splitHostPort(hostport string) (host string, port int) { + port = -1 + + if strings.HasPrefix(hostport, "[") { + addrEnd := strings.LastIndex(hostport, "]") + if addrEnd < 0 { + // Invalid hostport. + return + } + if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { + host = hostport[1:addrEnd] + return + } + } else { + if i := strings.LastIndex(hostport, ":"); i < 0 { + host = hostport + return + } + } + + host, pStr, err := net.SplitHostPort(hostport) + if err != nil { + return + } + + p, err := strconv.ParseUint(pStr, 10, 16) + if err != nil { + return + } + return host, int(p) +} diff --git a/semconv/internal/v4/net_test.go b/semconv/internal/v4/net_test.go new file mode 100644 index 00000000000..e1e32469231 --- /dev/null +++ b/semconv/internal/v4/net_test.go @@ -0,0 +1,344 @@ +// Copyright The OpenTelemetry Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "net" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" +) + +const ( + addr = "127.0.0.1" + port = 1834 +) + +var nc = &NetConv{ + NetHostNameKey: attribute.Key("net.host.name"), + NetHostPortKey: attribute.Key("net.host.port"), + NetPeerNameKey: attribute.Key("net.peer.name"), + NetPeerPortKey: attribute.Key("net.peer.port"), + NetSockPeerAddrKey: attribute.Key("net.sock.peer.addr"), + NetSockPeerPortKey: attribute.Key("net.sock.peer.port"), + NetTransportOther: attribute.String("net.transport", "other"), + NetTransportTCP: attribute.String("net.transport", "ip_tcp"), + NetTransportUDP: attribute.String("net.transport", "ip_udp"), + NetTransportInProc: attribute.String("net.transport", "inproc"), +} + +func TestNetTransport(t *testing.T) { + transports := map[string]attribute.KeyValue{ + "tcp": attribute.String("net.transport", "ip_tcp"), + "tcp4": attribute.String("net.transport", "ip_tcp"), + "tcp6": attribute.String("net.transport", "ip_tcp"), + "udp": attribute.String("net.transport", "ip_udp"), + "udp4": attribute.String("net.transport", "ip_udp"), + "udp6": attribute.String("net.transport", "ip_udp"), + "unix": attribute.String("net.transport", "inproc"), + "unixgram": attribute.String("net.transport", "inproc"), + "unixpacket": attribute.String("net.transport", "inproc"), + "ip:1": attribute.String("net.transport", "other"), + "ip:icmp": attribute.String("net.transport", "other"), + "ip4:proto": attribute.String("net.transport", "other"), + "ip6:proto": attribute.String("net.transport", "other"), + } + + for network, want := range transports { + assert.Equal(t, want, nc.Transport(network)) + } +} + +func TestNetServerNilListener(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, nil) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type listener struct{ net.Listener } + +func (listener) Addr() net.Addr { return nil } + +func TestNetServerNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Server(addr, listener{}) + expected := nc.Host(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPListener() (net.Listener, error) { + return net.Listen("tcp4", "127.0.0.1:0") +} + +func TestNetServerTCP(t *testing.T) { + ln, err := newTCPListener() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + + host, pStr, err := net.SplitHostPort(ln.Addr().String()) + require.NoError(t, err) + port, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Server("example.com:8080", ln) + expected := []attribute.KeyValue{ + nc.HostName("example.com"), + nc.HostPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockHostAddrKey.String(host), + nc.NetSockHostPortKey.Int(port), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetHost(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + }}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.HostName("192.0.0.1"), + nc.HostPort(9090), + }}, + }, nc.Host) +} + +func TestNetHostName(t *testing.T) { + expected := attribute.Key("net.host.name").String(addr) + assert.Equal(t, expected, nc.HostName(addr)) +} + +func TestNetHostPort(t *testing.T) { + expected := attribute.Key("net.host.port").Int(port) + assert.Equal(t, expected, nc.HostPort(port)) +} + +func TestNetClientNilConn(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, nil) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type conn struct{ net.Conn } + +func (conn) LocalAddr() net.Addr { return nil } +func (conn) RemoteAddr() net.Addr { return nil } + +func TestNetClientNilAddr(t *testing.T) { + const addr = "127.0.0.1:8080" + got := nc.Client(addr, conn{}) + expected := nc.Peer(addr) + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func newTCPConn() (net.Conn, net.Listener, error) { + ln, err := newTCPListener() + if err != nil { + return nil, nil, err + } + + conn, err := net.Dial("tcp4", ln.Addr().String()) + if err != nil { + _ = ln.Close() + return nil, nil, err + } + + return conn, ln, nil +} + +func TestNetClientTCP(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + lHost, pStr, err := net.SplitHostPort(conn.LocalAddr().String()) + require.NoError(t, err) + lPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + nc.NetSockHostAddrKey.String(lHost), + nc.NetSockHostPortKey.Int(lPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +type remoteOnlyConn struct{ net.Conn } + +func (remoteOnlyConn) LocalAddr() net.Addr { return nil } + +func TestNetClientTCPNilLocal(t *testing.T) { + conn, ln, err := newTCPConn() + require.NoError(t, err) + defer func() { require.NoError(t, ln.Close()) }() + defer func() { require.NoError(t, conn.Close()) }() + + conn = remoteOnlyConn{conn} + + rHost, pStr, err := net.SplitHostPort(conn.RemoteAddr().String()) + require.NoError(t, err) + rPort, err := strconv.Atoi(pStr) + require.NoError(t, err) + + got := nc.Client("example.com:8080", conn) + expected := []attribute.KeyValue{ + nc.PeerName("example.com"), + nc.PeerPort(8080), + nc.NetTransportTCP, + nc.NetSockFamilyKey.String("inet"), + nc.NetSockPeerAddrKey.String(rHost), + nc.NetSockPeerPortKey.Int(rPort), + } + assert.Equal(t, cap(expected), cap(got), "slice capacity") + assert.ElementsMatch(t, expected, got) +} + +func TestNetPeer(t *testing.T) { + testAddrs(t, []addrTest{ + {address: "", expected: nil}, + {address: "example.com", expected: []attribute.KeyValue{ + nc.PeerName("example.com"), + }}, + {address: "/tmp/file", expected: []attribute.KeyValue{ + nc.PeerName("/tmp/file"), + }}, + {address: "192.0.0.1", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + }}, + {address: ":9090", expected: nil}, + {address: "192.0.0.1:9090", expected: []attribute.KeyValue{ + nc.PeerName("192.0.0.1"), + nc.PeerPort(9090), + }}, + }, nc.Peer) +} + +func TestNetPeerName(t *testing.T) { + expected := attribute.Key("net.peer.name").String(addr) + assert.Equal(t, expected, nc.PeerName(addr)) +} + +func TestNetPeerPort(t *testing.T) { + expected := attribute.Key("net.peer.port").Int(port) + assert.Equal(t, expected, nc.PeerPort(port)) +} + +func TestNetSockPeerName(t *testing.T) { + expected := attribute.Key("net.sock.peer.addr").String(addr) + assert.Equal(t, expected, nc.SockPeerAddr(addr)) +} + +func TestNetSockPeerPort(t *testing.T) { + expected := attribute.Key("net.sock.peer.port").Int(port) + assert.Equal(t, expected, nc.SockPeerPort(port)) +} + +func TestFamily(t *testing.T) { + tests := []struct { + network string + address string + expect string + }{ + {"", "", ""}, + {"unix", "", "unix"}, + {"unix", "gibberish", "unix"}, + {"unixgram", "", "unix"}, + {"unixgram", "gibberish", "unix"}, + {"unixpacket", "gibberish", "unix"}, + {"tcp", "123.0.2.8", "inet"}, + {"tcp", "gibberish", ""}, + {"", "123.0.2.8", "inet"}, + {"", "gibberish", ""}, + {"tcp", "fe80::1", "inet6"}, + {"", "fe80::1", "inet6"}, + } + + for _, test := range tests { + got := family(test.network, test.address) + assert.Equal(t, test.expect, got, test.network+"/"+test.address) + } +} + +func TestSplitHostPort(t *testing.T) { + tests := []struct { + hostport string + host string + port int + }{ + {"", "", -1}, + {":8080", "", 8080}, + {"127.0.0.1", "127.0.0.1", -1}, + {"www.example.com", "www.example.com", -1}, + {"127.0.0.1%25en0", "127.0.0.1%25en0", -1}, + {"[]", "", -1}, // Ensure this doesn't panic. + {"[fe80::1", "", -1}, + {"[fe80::1]", "fe80::1", -1}, + {"[fe80::1%25en0]", "fe80::1%25en0", -1}, + {"[fe80::1]:8080", "fe80::1", 8080}, + {"[fe80::1]::", "", -1}, // Too many colons. + {"127.0.0.1:", "127.0.0.1", -1}, + {"127.0.0.1:port", "127.0.0.1", -1}, + {"127.0.0.1:8080", "127.0.0.1", 8080}, + {"www.example.com:8080", "www.example.com", 8080}, + {"127.0.0.1%25en0:8080", "127.0.0.1%25en0", 8080}, + } + + for _, test := range tests { + h, p := splitHostPort(test.hostport) + assert.Equal(t, test.host, h, test.hostport) + assert.Equal(t, test.port, p, test.hostport) + } +} + +type addrTest struct { + address string + expected []attribute.KeyValue +} + +func testAddrs(t *testing.T, tests []addrTest, f func(string) []attribute.KeyValue) { + t.Helper() + + for _, test := range tests { + got := f(test.address) + assert.Equal(t, cap(test.expected), cap(got), "slice capacity") + assert.ElementsMatch(t, test.expected, got, test.address) + } +} diff --git a/semconv/v1.20.0/attribute_group.go b/semconv/v1.20.0/attribute_group.go new file mode 100644 index 00000000000..67d1d4c44d7 --- /dev/null +++ b/semconv/v1.20.0/attribute_group.go @@ -0,0 +1,1209 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the hTTP request method. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the [HTTP + // response status code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the hTTP request method. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the [HTTP response +// status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTP Server spans attributes +const ( + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the URI scheme identifying the used + // protocol. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/specification/trace/semantic_conventions/http.md#http-server-definitions) + // if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the URI scheme identifying the used +// protocol. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the transport protocol used. See + // note below. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + NetTransportKey = attribute.Key("net.transport") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. It represents the application + // layer protocol used. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. It represents the version + // of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `net.protocol.version` refers to the version of the protocol used + // and might be different from the protocol client's version. If the HTTP + // client used has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the remote + // socket peer name. + // + // Type: string + // RequirementLevel: Recommended (If available and different from + // `net.peer.name` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 'proxy.example.com' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the remote + // socket peer address: IPv4 or IPv6 for internet protocols, path for local + // communication, + // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '127.0.0.1', '/tmp/mysql.sock' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the remote + // socket peer port. + // + // Type: int + // RequirementLevel: Recommended (If defined for the address family and if + // different than `net.peer.port` and if `net.sock.peer.addr` is set.) + // Stability: stable + // Examples: 16456 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the protocol + // [address + // family](https://man7.org/linux/man-pages/man7/address_families.7.html) + // which is used for communication. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If different than `inet` and if + // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers + // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in + // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support + // instrumentations that follow previous versions of this document.) + // Stability: stable + // Examples: 'inet6', 'bluetooth' + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the logical remote hostname, see + // note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an + // extra DNS lookup. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the logical remote port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the logical local hostname or + // similar, see note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'localhost' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the logical local port number, + // preferably the one that the peer used to connect + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the local + // socket address. Useful in case of a multi-IP host. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '192.168.0.1' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the local + // socket port number. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If defined for the address + // family and if different than `net.host.port` and if `net.sock.host.addr` + // is set. In other cases, it is still recommended to set this.) + // Stability: stable + // Examples: 35555 + NetSockHostPortKey = attribute.Key("net.sock.host.port") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe. See note below + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. It represents the application +// layer protocol used. The value SHOULD be normalized to lowercase. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. It represents the version of +// the application layer protocol used. See note below. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the remote socket +// peer name. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the remote socket +// peer address: IPv4 or IPv6 for internet protocols, path for local +// communication, +// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the remote socket +// peer port. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the logical remote +// hostname, see note below. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the logical remote port +// number +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the logical local +// hostname or similar, see note below. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the logical local port +// number, preferably the one that the peer used to connect +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the local socket +// address. Useful in case of a multi-IP host. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the local socket +// port number. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostConnectionTypeKey is the attribute Key conforming to the + // "net.host.connection.type" semantic conventions. It represents the + // internet connection type currently being used by the host. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") + + // NetHostConnectionSubtypeKey is the attribute Key conforming to the + // "net.host.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") + + // NetHostCarrierNameKey is the attribute Key conforming to the + // "net.host.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") + + // NetHostCarrierMccKey is the attribute Key conforming to the + // "net.host.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") + + // NetHostCarrierMncKey is the attribute Key conforming to the + // "net.host.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") + + // NetHostCarrierIccKey is the attribute Key conforming to the + // "net.host.carrier.icc" semantic conventions. It represents the ISO + // 3166-1 alpha-2 2-character country code associated with the mobile + // carrier network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") +) + +var ( + // wifi + NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") + // wired + NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") + // cell + NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") + // unavailable + NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") + // unknown + NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") + // EDGE + NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") + // UMTS + NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") + // CDMA + NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") + // HSPA + NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") + // IDEN + NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") + // LTE + NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") + // EHRPD + NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") + // GSM + NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") +) + +// NetHostCarrierName returns an attribute KeyValue conforming to the +// "net.host.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetHostCarrierName(val string) attribute.KeyValue { + return NetHostCarrierNameKey.String(val) +} + +// NetHostCarrierMcc returns an attribute KeyValue conforming to the +// "net.host.carrier.mcc" semantic conventions. It represents the mobile +// carrier country code. +func NetHostCarrierMcc(val string) attribute.KeyValue { + return NetHostCarrierMccKey.String(val) +} + +// NetHostCarrierMnc returns an attribute KeyValue conforming to the +// "net.host.carrier.mnc" semantic conventions. It represents the mobile +// carrier network code. +func NetHostCarrierMnc(val string) attribute.KeyValue { + return NetHostCarrierMncKey.String(val) +} + +// NetHostCarrierIcc returns an attribute KeyValue conforming to the +// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetHostCarrierIcc(val string) attribute.KeyValue { + return NetHostCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // size of the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // size of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the size +// of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the size +// of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Semantic convention for attributes that describe messaging source on broker +const ( + // MessagingSourceNameKey is the attribute Key conforming to the + // "messaging.source.name" semantic conventions. It represents the message + // source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Source name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the source name SHOULD uniquely + // identify the broker. + MessagingSourceNameKey = attribute.Key("messaging.source.name") + + // MessagingSourceTemplateKey is the attribute Key conforming to the + // "messaging.source.template" semantic conventions. It represents the low + // cardinality representation of the messaging source name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Source names could be constructed from templates. An example would + // be a source name involving a user name or product id. Although the + // source name in this case is of high cardinality, the underlying template + // is of low cardinality and can be effectively used for grouping and + // aggregation. + MessagingSourceTemplateKey = attribute.Key("messaging.source.template") + + // MessagingSourceTemporaryKey is the attribute Key conforming to the + // "messaging.source.temporary" semantic conventions. It represents a + // boolean that is true if the message source is temporary and might not + // exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") + + // MessagingSourceAnonymousKey is the attribute Key conforming to the + // "messaging.source.anonymous" semantic conventions. It represents a + // boolean that is true if the message source is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") +) + +// MessagingSourceName returns an attribute KeyValue conforming to the +// "messaging.source.name" semantic conventions. It represents the message +// source name +func MessagingSourceName(val string) attribute.KeyValue { + return MessagingSourceNameKey.String(val) +} + +// MessagingSourceTemplate returns an attribute KeyValue conforming to the +// "messaging.source.template" semantic conventions. It represents the low +// cardinality representation of the messaging source name +func MessagingSourceTemplate(val string) attribute.KeyValue { + return MessagingSourceTemplateKey.String(val) +} + +// MessagingSourceTemporary returns an attribute KeyValue conforming to the +// "messaging.source.temporary" semantic conventions. It represents a boolean +// that is true if the message source is temporary and might not exist anymore +// after messages are processed. +func MessagingSourceTemporary(val bool) attribute.KeyValue { + return MessagingSourceTemporaryKey.Bool(val) +} + +// MessagingSourceAnonymous returns an attribute KeyValue conforming to the +// "messaging.source.anonymous" semantic conventions. It represents a boolean +// that is true if the message source is anonymous (could be unnamed or have +// auto-generated name). +func MessagingSourceAnonymous(val bool) attribute.KeyValue { + return MessagingSourceAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaClientIDKey is the attribute Key conforming to the + // "messaging.kafka.client_id" semantic conventions. It represents the + // client ID for the Consumer or Producer that is handling the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client-5' + MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the + // "messaging.kafka.source.partition" semantic conventions. It represents + // the partition the message is received from. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaClientID returns an attribute KeyValue conforming to the +// "messaging.kafka.client_id" semantic conventions. It represents the client +// ID for the Consumer or Producer that is handling the message. +func MessagingKafkaClientID(val string) attribute.KeyValue { + return MessagingKafkaClientIDKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to +// the "messaging.kafka.source.partition" semantic conventions. It represents +// the partition the message is received from. +func MessagingKafkaSourcePartition(val int) attribute.KeyValue { + return MessagingKafkaSourcePartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqClientIDKey is the attribute Key conforming to the + // "messaging.rocketmq.client_id" semantic conventions. It represents the + // unique identifier for each client. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myhost@8742@s8083jm' + MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqClientID returns an attribute KeyValue conforming to the +// "messaging.rocketmq.client_id" semantic conventions. It represents the +// unique identifier for each client. +func MessagingRocketmqClientID(val string) attribute.KeyValue { + return MessagingRocketmqClientIDKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/semconv/v1.20.0/doc.go b/semconv/v1.20.0/doc.go new file mode 100644 index 00000000000..359c5a69624 --- /dev/null +++ b/semconv/v1.20.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.20.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" diff --git a/semconv/v1.20.0/event.go b/semconv/v1.20.0/event.go new file mode 100644 index 00000000000..8ac9350d2b2 --- /dev/null +++ b/semconv/v1.20.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.20.0/exception.go b/semconv/v1.20.0/exception.go new file mode 100644 index 00000000000..09ff4dfdbf7 --- /dev/null +++ b/semconv/v1.20.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.20.0/http.go b/semconv/v1.20.0/http.go new file mode 100644 index 00000000000..342aede95f1 --- /dev/null +++ b/semconv/v1.20.0/http.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// HTTP scheme attributes. +var ( + HTTPSchemeHTTP = HTTPSchemeKey.String("http") + HTTPSchemeHTTPS = HTTPSchemeKey.String("https") +) diff --git a/semconv/v1.20.0/httpconv/http.go b/semconv/v1.20.0/httpconv/http.go new file mode 100644 index 00000000000..9e53e2b5663 --- /dev/null +++ b/semconv/v1.20.0/httpconv/http.go @@ -0,0 +1,154 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package httpconv provides OpenTelemetry HTTP semantic conventions for +// tracing telemetry. +package httpconv // import "go.opentelemetry.io/otel/semconv/v1.20.0/httpconv" + +import ( + "net/http" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/semconv/internal/v4" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +var ( + nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, + } + + hc = &internal.HTTPConv{ + NetConv: nc, + + EnduserIDKey: semconv.EnduserIDKey, + HTTPClientIPKey: semconv.HTTPClientIPKey, + NetProtocolNameKey: semconv.NetProtocolNameKey, + NetProtocolVersionKey: semconv.NetProtocolVersionKey, + HTTPMethodKey: semconv.HTTPMethodKey, + HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, + HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, + HTTPRouteKey: semconv.HTTPRouteKey, + HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, + HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, + HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, + HTTPTargetKey: semconv.HTTPTargetKey, + HTTPURLKey: semconv.HTTPURLKey, + UserAgentOriginalKey: semconv.UserAgentOriginalKey, + } +) + +// ClientResponse returns trace attributes for an HTTP response received by a +// client from a server. It will return the following attributes if the related +// values are defined in resp: "http.status.code", +// "http.response_content_length". +// +// This does not add all OpenTelemetry required attributes for an HTTP event, +// it assumes ClientRequest was used to create the span with a complete set of +// attributes. If a complete set of attributes can be generated using the +// request contained in resp. For example: +// +// append(ClientResponse(resp), ClientRequest(resp.Request)...) +func ClientResponse(resp *http.Response) []attribute.KeyValue { + return hc.ClientResponse(resp) +} + +// ClientRequest returns trace attributes for an HTTP request made by a client. +// The following attributes are always returned: "http.url", +// "net.protocol.(name|version)", "http.method", "net.peer.name". +// The following attributes are returned if the related values are defined +// in req: "net.peer.port", "http.user_agent", "http.request_content_length", +// "enduser.id". +func ClientRequest(req *http.Request) []attribute.KeyValue { + return hc.ClientRequest(req) +} + +// ClientStatus returns a span status code and message for an HTTP status code +// value received by a client. +func ClientStatus(code int) (codes.Code, string) { + return hc.ClientStatus(code) +} + +// ServerRequest returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +// +// The following attributes are always returned: "http.method", "http.scheme", +// ""net.protocol.(name|version)", "http.target", "net.host.name". +// The following attributes are returned if they related values are defined +// in req: "net.host.port", "net.sock.peer.addr", "net.sock.peer.port", +// "user_agent.original", "enduser.id", "http.client_ip". +func ServerRequest(server string, req *http.Request) []attribute.KeyValue { + return hc.ServerRequest(server, req) +} + +// ServerStatus returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func ServerStatus(code int) (codes.Code, string) { + return hc.ServerStatus(code) +} + +// RequestHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the user_agent.original attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func RequestHeader(h http.Header) []attribute.KeyValue { + return hc.RequestHeader(h) +} + +// ResponseHeader returns the contents of h as attributes. +// +// Instrumentation should require an explicit configuration of which headers to +// captured and then prune what they pass here. Including all headers can be a +// security risk - explicit configuration helps avoid leaking sensitive +// information. +// +// The User-Agent header is already captured in the user_agent.original attribute +// from ClientRequest and ServerRequest. Instrumentation may provide an option +// to capture that header here even though it is not recommended. Otherwise, +// instrumentation should filter that out of what is passed. +func ResponseHeader(h http.Header) []attribute.KeyValue { + return hc.ResponseHeader(h) +} diff --git a/semconv/v1.20.0/netconv/net.go b/semconv/v1.20.0/netconv/net.go new file mode 100644 index 00000000000..eaacac5b76c --- /dev/null +++ b/semconv/v1.20.0/netconv/net.go @@ -0,0 +1,66 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package netconv provides OpenTelemetry network semantic conventions for +// tracing telemetry. +package netconv // import "go.opentelemetry.io/otel/semconv/v1.20.0/netconv" + +import ( + "net" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/semconv/internal/v3" + semconv "go.opentelemetry.io/otel/semconv/v1.20.0" +) + +var nc = &internal.NetConv{ + NetHostNameKey: semconv.NetHostNameKey, + NetHostPortKey: semconv.NetHostPortKey, + NetPeerNameKey: semconv.NetPeerNameKey, + NetPeerPortKey: semconv.NetPeerPortKey, + NetSockFamilyKey: semconv.NetSockFamilyKey, + NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, + NetSockPeerPortKey: semconv.NetSockPeerPortKey, + NetSockHostAddrKey: semconv.NetSockHostAddrKey, + NetSockHostPortKey: semconv.NetSockHostPortKey, + NetTransportOther: semconv.NetTransportOther, + NetTransportTCP: semconv.NetTransportTCP, + NetTransportUDP: semconv.NetTransportUDP, + NetTransportInProc: semconv.NetTransportInProc, +} + +// Transport returns a trace attribute describing the transport protocol of the +// passed network. See the net.Dial for information about acceptable network +// values. +func Transport(network string) attribute.KeyValue { + return nc.Transport(network) +} + +// Client returns trace attributes for a client network connection to address. +// See net.Dial for information about acceptable address values, address should +// be the same as the one used to create conn. If conn is nil, only network +// peer attributes will be returned that describe address. Otherwise, the +// socket level information about conn will also be included. +func Client(address string, conn net.Conn) []attribute.KeyValue { + return nc.Client(address, conn) +} + +// Server returns trace attributes for a network listener listening at address. +// See net.Listen for information about acceptable address values, address +// should be the same as the one used to create ln. If ln is nil, only network +// host attributes will be returned that describe address. Otherwise, the +// socket level information about ln will also be included. +func Server(address string, ln net.Listener) []attribute.KeyValue { + return nc.Server(address, ln) +} diff --git a/semconv/v1.20.0/resource.go b/semconv/v1.20.0/resource.go new file mode 100644 index 00000000000..a2b906742a8 --- /dev/null +++ b/semconv/v1.20.0/resource.go @@ -0,0 +1,2071 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// Heroku dyno metadata +const ( + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") +) + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run:** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a general computing instance. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID. For Cloud, this + // value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID. For +// Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](../../resource/semantic_conventions/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](../../resource/semantic_conventions/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// A service instance. +const ( + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'opentelemetry' + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.20.0/schema.go b/semconv/v1.20.0/schema.go new file mode 100644 index 00000000000..e449e5c3b9f --- /dev/null +++ b/semconv/v1.20.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.20.0" diff --git a/semconv/v1.20.0/trace.go b/semconv/v1.20.0/trace.go new file mode 100644 index 00000000000..8517741485c --- /dev/null +++ b/semconv/v1.20.0/trace.go @@ -0,0 +1,2610 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no + // longer required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: stable + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: stable + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: stable + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: stable + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: stable + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: stable + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](../../resource/semantic_conventions/README.md#service) + // of the remote service. SHOULD be equal to the actual `service.name` + // resource attribute of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](../../resource/semantic_conventions/README.md#service) of +// the remote service. SHOULD be equal to the actual `service.name` resource +// attribute of the remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the full HTTP request URL in the form + // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is + // not transmitted over HTTP, but if it is known, it should be included + // nevertheless. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Note: `http.url` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case the + // attribute's value should be `https://www.example.com/`. + HTTPURLKey = attribute.Key("http.url") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the full HTTP request URL in the form +// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not +// transmitted over HTTP, but if it is known, it should be included +// nevertheless. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// Semantic Convention for HTTP Server +const ( + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the full request target as passed in + // a HTTP request line or equivalent. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '/users/12314/?q=ddds' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" + // semantic conventions. It represents the IP address of the original + // client behind all proxies, if known (e.g. from + // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '83.164.160.102' + // Note: This is not necessarily the same as `net.sock.peer.addr`, which + // would + // identify the network-level peer, which may be a proxy. + // + // This attribute should be set when a source of information different + // from the one used for `net.sock.peer.addr`, is available even if that + // other + // source just confirms the same value as `net.sock.peer.addr`. + // Rationale: For `net.sock.peer.addr`, one typically does not know if it + // comes from a proxy, reverse proxy, or the actual client. Setting + // `http.client_ip` when it's the same as `net.sock.peer.addr` means that + // one is at least somewhat confident that the address is not that of + // the closest proxy. + HTTPClientIPKey = attribute.Key("http.client_ip") +) + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the full request target as passed in a +// HTTP request line or equivalent. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPClientIP returns an attribute KeyValue conforming to the +// "http.client_ip" semantic conventions. It represents the IP address of the +// original client behind all proxies, if known (e.g. from +// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +func HTTPClientIP(val string) attribute.KeyValue { + return HTTPClientIPKey.String(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// Semantic convention for a consumer of messages received from a messaging +// system +const ( + // MessagingConsumerIDKey is the attribute Key conforming to the + // "messaging.consumer.id" semantic conventions. It represents the + // identifier for the consumer receiving a message. For Kafka, set it to + // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if + // both are present, or only `messaging.kafka.consumer.group`. For brokers, + // such as RabbitMQ and Artemis, set it to the `client_id` of the client + // consuming the message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mygroup - client-6' + MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") +) + +// MessagingConsumerID returns an attribute KeyValue conforming to the +// "messaging.consumer.id" semantic conventions. It represents the identifier +// for the consumer receiving a message. For Kafka, set it to +// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both +// are present, or only `messaging.kafka.consumer.group`. For brokers, such as +// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the +// message. +func MessagingConsumerID(val string) attribute.KeyValue { + return MessagingConsumerIDKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: stable + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) From f95bee22b92fb323eef80a3a3c74bbbf80fd2937 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Thu, 18 May 2023 02:28:44 +1000 Subject: [PATCH 538/886] Use strings.Cut() instead of string.SplitN() (#4049) strings.Cut() generates less garbage as it does not allocate the slice to hold parts. --- CHANGELOG.md | 4 ++ baggage/baggage.go | 56 ++++++++----------- .../lib/go/thrift/multiplexed_protocol.go | 24 ++++---- .../otlp/internal/envconfig/envconfig.go | 14 ++--- internal/internaltest/text_map_propagator.go | 6 +- sdk/resource/env.go | 14 ++--- sdk/resource/os_release_unix.go | 8 +-- semconv/internal/http.go | 8 ++- 8 files changed, 65 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8da7403482..9c277bb9a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/semconv/v1.20.0` package. The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) +### Changed + +- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) + ### Removed - The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed. diff --git a/baggage/baggage.go b/baggage/baggage.go index a36db8f8d85..46e523a80e4 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -289,45 +289,37 @@ func parseMember(member string) (Member, error) { props properties ) - parts := strings.SplitN(member, propertyDelimiter, 2) - switch len(parts) { - case 2: + keyValue, properties, found := strings.Cut(member, propertyDelimiter) + if found { // Parse the member properties. - for _, pStr := range strings.Split(parts[1], propertyDelimiter) { + for _, pStr := range strings.Split(properties, propertyDelimiter) { p, err := parseProperty(pStr) if err != nil { return newInvalidMember(), err } props = append(props, p) } - fallthrough - case 1: - // Parse the member key/value pair. - - // Take into account a value can contain equal signs (=). - kv := strings.SplitN(parts[0], keyValueDelimiter, 2) - if len(kv) != 2 { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) - } - // "Leading and trailing whitespaces are allowed but MUST be trimmed - // when converting the header into a data structure." - key = strings.TrimSpace(kv[0]) - var err error - value, err = url.QueryUnescape(strings.TrimSpace(kv[1])) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", err, value) - } - if !keyRe.MatchString(key) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) - } - if !valueRe.MatchString(value) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - default: - // This should never happen unless a developer has changed the string - // splitting somehow. Panic instead of failing silently and allowing - // the bug to slip past the CI checks. - panic("failed to parse baggage member") + } + // Parse the member key/value pair. + + // Take into account a value can contain equal signs (=). + k, v, found := strings.Cut(keyValue, keyValueDelimiter) + if !found { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member) + } + // "Leading and trailing whitespaces are allowed but MUST be trimmed + // when converting the header into a data structure." + key = strings.TrimSpace(k) + var err error + value, err = url.QueryUnescape(strings.TrimSpace(v)) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", err, value) + } + if !keyRe.MatchString(key) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) + } + if !valueRe.MatchString(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } return Member{key: key, value: value, properties: props, hasData: true}, nil diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go index cacbf6bef3e..d542b23a998 100644 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go +++ b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go @@ -160,15 +160,13 @@ func (t *TMultiplexedProcessor) ProcessorMap() map[string]TProcessorFunction { // the given ProcessorName or if all that is given is the FunctionName and there // is no DefaultProcessor set. func (t *TMultiplexedProcessor) AddToProcessorMap(name string, processorFunc TProcessorFunction) { - components := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2) - if len(components) != 2 { - if t.DefaultProcessor != nil && len(components) == 1 { - t.DefaultProcessor.AddToProcessorMap(components[0], processorFunc) + processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR) + if !found { + if t.DefaultProcessor != nil { + t.DefaultProcessor.AddToProcessorMap(processorName, processorFunc) } return } - processorName := components[0] - funcName := components[1] if processor, ok := t.serviceProcessorMap[processorName]; ok { processor.AddToProcessorMap(funcName, processorFunc) } @@ -197,9 +195,9 @@ func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol) if typeId != CALL && typeId != ONEWAY { return false, NewTProtocolException(fmt.Errorf("Unexpected message type %v", typeId)) } - //extract the service name - v := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2) - if len(v) != 2 { + // extract the service name + processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR) + if !found { if t.DefaultProcessor != nil { smb := NewStoredMessageProtocol(in, name, typeId, seqid) return t.DefaultProcessor.Process(ctx, smb, out) @@ -209,18 +207,18 @@ func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol) name, )) } - actualProcessor, ok := t.serviceProcessorMap[v[0]] + actualProcessor, ok := t.serviceProcessorMap[processorName] if !ok { return false, NewTProtocolException(fmt.Errorf( "Service name not found: %s. Did you forget to call registerProcessor()?", - v[0], + processorName, )) } - smb := NewStoredMessageProtocol(in, v[1], typeId, seqid) + smb := NewStoredMessageProtocol(in, funcName, typeId, seqid) return actualProcessor.Process(ctx, smb, out) } -//Protocol that use stored message for ReadMessageBegin +// Protocol that use stored message for ReadMessageBegin type storedMessageProtocol struct { TProtocol name string diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go index 53ff3126b6e..444eefbb388 100644 --- a/exporters/otlp/internal/envconfig/envconfig.go +++ b/exporters/otlp/internal/envconfig/envconfig.go @@ -166,20 +166,20 @@ func stringToHeader(value string) map[string]string { headers := make(map[string]string) for _, header := range headersPairs { - nameValue := strings.SplitN(header, "=", 2) - if len(nameValue) < 2 { - global.Error(errors.New("missing '="), "parse headers", "input", nameValue) + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(nameValue[0]) + name, err := url.QueryUnescape(n) if err != nil { - global.Error(err, "escape header key", "key", nameValue[0]) + global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(nameValue[1]) + value, err := url.QueryUnescape(v) if err != nil { - global.Error(err, "escape header value", "value", nameValue[1]) + global.Error(err, "escape header value", "value", v) continue } trimmedValue := strings.TrimSpace(value) diff --git a/internal/internaltest/text_map_propagator.go b/internal/internaltest/text_map_propagator.go index 4873e330d02..4a4743cad9e 100644 --- a/internal/internaltest/text_map_propagator.go +++ b/internal/internaltest/text_map_propagator.go @@ -35,9 +35,9 @@ func newState(encoded string) state { if encoded == "" { return state{} } - split := strings.SplitN(encoded, ",", 2) - injects, _ := strconv.ParseUint(split[0], 10, 64) - extracts, _ := strconv.ParseUint(split[1], 10, 64) + s0, s1, _ := strings.Cut(encoded, ",") + injects, _ := strconv.ParseUint(s0, 10, 64) + extracts, _ := strconv.ParseUint(s1, 10, 64) return state{ Injections: injects, Extractions: extracts, diff --git a/sdk/resource/env.go b/sdk/resource/env.go index e32843cad14..f09a7819067 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -82,23 +82,23 @@ func constructOTResources(s string) (*Resource, error) { return Empty(), nil } pairs := strings.Split(s, ",") - attrs := []attribute.KeyValue{} + var attrs []attribute.KeyValue var invalid []string for _, p := range pairs { - field := strings.SplitN(p, "=", 2) - if len(field) != 2 { + k, v, found := strings.Cut(p, "=") + if !found { invalid = append(invalid, p) continue } - k := strings.TrimSpace(field[0]) - v, err := url.QueryUnescape(strings.TrimSpace(field[1])) + key := strings.TrimSpace(k) + val, err := url.QueryUnescape(strings.TrimSpace(v)) if err != nil { // Retain original value if decoding fails, otherwise it will be // an empty string. - v = field[1] + val = v otel.Handle(err) } - attrs = append(attrs, attribute.String(k, v)) + attrs = append(attrs, attribute.String(key, val)) } var err error if len(invalid) > 0 { diff --git a/sdk/resource/os_release_unix.go b/sdk/resource/os_release_unix.go index fba6790e445..c771942deec 100644 --- a/sdk/resource/os_release_unix.go +++ b/sdk/resource/os_release_unix.go @@ -85,14 +85,14 @@ func skip(line string) bool { // parse attempts to split the provided line on the first '=' character, and then // sanitize each side of the split before returning them as a key-value pair. func parse(line string) (string, string, bool) { - parts := strings.SplitN(line, "=", 2) + k, v, found := strings.Cut(line, "=") - if len(parts) != 2 || len(parts[0]) == 0 { + if !found || len(k) == 0 { return "", "", false } - key := strings.TrimSpace(parts[0]) - value := unescape(unquote(strings.TrimSpace(parts[1]))) + key := strings.TrimSpace(k) + value := unescape(unquote(strings.TrimSpace(v))) return key, value, true } diff --git a/semconv/internal/http.go b/semconv/internal/http.go index b580eedeff7..19c394c69b6 100644 --- a/semconv/internal/http.go +++ b/semconv/internal/http.go @@ -232,10 +232,12 @@ func (sc *SemanticConventions) HTTPServerAttributesFromHTTPRequest(serverName, r if route != "" { attrs = append(attrs, sc.HTTPRouteKey.String(route)) } - if values, ok := request.Header["X-Forwarded-For"]; ok && len(values) > 0 { - if addresses := strings.SplitN(values[0], ",", 2); len(addresses) > 0 { - attrs = append(attrs, sc.HTTPClientIPKey.String(addresses[0])) + if values := request.Header["X-Forwarded-For"]; len(values) > 0 { + addr := values[0] + if i := strings.Index(addr, ","); i > 0 { + addr = addr[:i] } + attrs = append(attrs, sc.HTTPClientIPKey.String(addr)) } return append(attrs, sc.httpCommonAttributesFromHTTPRequest(request)...) From c3b48e2c1e645bc62fe7f1a6f12e13172ecee044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 18 May 2023 16:16:29 +0200 Subject: [PATCH 539/886] [chore] Run generate before lint (#4093) --- .github/workflows/ci.yml | 2 ++ Makefile | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eba0038ad80..f1595337bb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,8 @@ jobs: with: path: ~/.tools key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} + - name: Run go generate + run: make generate - name: Run linters run: make dependabot-check license-check lint vanity-import-check - name: Build diff --git a/Makefile b/Makefile index 955f3fc1f0f..d78c53e5134 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,8 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default -ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage +precommit: generate dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default +ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -74,9 +74,9 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) -# Build +# Generate -.PHONY: generate build +.PHONY: generate generate: $(OTEL_GO_MOD_DIRS:%=generate/%) generate/%: DIR=$* @@ -85,7 +85,11 @@ generate/%: | $(STRINGER) $(PORTO) && cd $(DIR) \ && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w . -build: generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) +# Build + +.PHONY: build + +build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%) build/%: DIR=$* build/%: @echo "$(GO) build $(DIR)/..." \ From 8dcabc3ef9b451e14c014a5e11b38b02f20c12ca Mon Sep 17 00:00:00 2001 From: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> Date: Thu, 18 May 2023 09:06:27 -0700 Subject: [PATCH 540/886] feat(ci): Add codespell to Makefile and GitHub Actions (#3996) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ci): Add codespell to Makefile and GitHub Actions This is a followup from https://github.com/open-telemetry/opentelemetry-go/pull/3980 to add the automation for checking for code spelling errors to a different PR. [Codespell][] makes use of the `.codespellrc` file automatically as a config file for convenience. The configuration file specifies directories and flags to pass to `codespell`. Codespell also makes use of the `.codespellignore` file to ignore certain word spellings. There is a new section in `Makefile` for installing python tooling. It is similar to how the go tools are installed. It sets up a virtualenv in `venv `and installs python tooling there if it hasn't been installed yet. The new [codespell workflow][] will run in pull requests to annotate misspelled words. It is set up to only warn the user with annotations in the pull request if there are typos, but we can fail the pull request as well if we want to by deleting the [warn_only][] key. [codespell]: https://github.com/codespell-project/codespell [codespell workflow]: https://github.com/codespell-project/actions-codespell [warn_only]: https://github.com/codespell-project/actions-codespell#parameter-only_warn * Use docker to run python and codespell Since this is a Go project, having a dependency on python seemed disconcerting. So, docker is used to create a virtual environment with a python image and also run the tools that were installed. * Remove wording on requirement for python * Apply suggestions from code review Co-authored-by: Damien Mathieu <42@dmathieu.com> * Pin versions into requirements.txt * Pin version in requirements.txt * Fix typo in license * Revert typo fix on deleted file * Update .github/workflows/codespell.yaml Co-authored-by: Robert Pająk * Update codespell.yaml * Update codespell.yaml --------- Co-authored-by: Chester Cheung Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- .codespellignore | 5 +++++ .codespellrc | 10 +++++++++ .github/workflows/codespell.yaml | 14 ++++++++++++ .gitignore | 1 + .golangci.yml | 2 +- CONTRIBUTING.md | 5 +++++ Makefile | 37 ++++++++++++++++++++++++++++++++ requirements.txt | 1 + 8 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .codespellignore create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yaml create mode 100644 requirements.txt diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 00000000000..ae6a3bcf12c --- /dev/null +++ b/.codespellignore @@ -0,0 +1,5 @@ +ot +fo +te +collison +consequentially diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..4afbb1fb3bd --- /dev/null +++ b/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,go.mod,go.sum,semconv,venv,.tools +uri-ignore-words-list = * +write = diff --git a/.github/workflows/codespell.yaml b/.github/workflows/codespell.yaml new file mode 100644 index 00000000000..83b68e1fd41 --- /dev/null +++ b/.github/workflows/codespell.yaml @@ -0,0 +1,14 @@ +name: codespell +on: + push: + branches: + - main + pull_request: +jobs: + codespell: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + - name: Codespell + run: make codespell diff --git a/.gitignore b/.gitignore index cf29d10a7ca..aa699376225 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ Thumbs.db .tools/ +venv/ .idea/ .vscode/ *.iml diff --git a/.golangci.yml b/.golangci.yml index e28904f6ac7..dbb6670b397 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -113,7 +113,7 @@ linters-settings: - name: constant-logical-expr disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument - # TODO (#3372) reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 + # TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280 - name: context-as-argument disabled: true arguments: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 949a275616b..b2df5de34a6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,6 +28,11 @@ precommit` - the `precommit` target is the default). The `precommit` target also fixes the formatting of the code and checks the status of the go module files. +Additionally, there is a `codespell` target that checks for common +typos in the code. It is not run by default, but you can run it +manually with `make codespell`. It will set up a virtual environment +in `venv` and install `codespell` there. + If after running `make precommit` the output of `git status` contains `nothing to commit, working tree clean` then it means that everything is up-to-date and properly formatted. diff --git a/Makefile b/Makefile index d78c53e5134..26e4bed226f 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,39 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq .PHONY: tools tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) +# Virtualized python tools via docker + +# The directory where the virtual environment is created. +VENVDIR := venv + +# The directory where the python tools are installed. +PYTOOLS := $(VENVDIR)/bin + +# The pip executable in the virtual environment. +PIP := $(PYTOOLS)/pip + +# The directory in the docker image where the current directory is mounted. +WORKDIR := /workdir + +# The python image to use for the virtual environment. +PYTHONIMAGE := python:3.11.3-slim-bullseye + +# Run the python image with the current directory mounted. +DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) + +# Create a virtual environment for Python tools. +$(PYTOOLS): +# The `--upgrade` flag is needed to ensure that the virtual environment is +# created with the latest pip version. + @$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" + +# Install python packages into the virtual environment. +$(PYTOOLS)/%: | $(PYTOOLS) + @$(DOCKERPY) $(PIP) install -r requirements.txt + +CODESPELL = $(PYTOOLS)/codespell +$(CODESPELL): PACKAGE=codespell + # Generate .PHONY: generate @@ -180,6 +213,10 @@ vanity-import-fix: | $(PORTO) misspell: | $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) +.PHONY: codespell +codespell: | $(CODESPELL) + @$(DOCKERPY) $(CODESPELL) + .PHONY: license-check license-check: @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000000..407f17489c6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +codespell==2.2.4 From 987422d55f94aee545e5b67a4df1f1a39be2d2a9 Mon Sep 17 00:00:00 2001 From: Andrew Womeldorf Date: Fri, 19 May 2023 11:25:11 -0500 Subject: [PATCH 541/886] sdk/metric: Fix import comments (#4086) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Resolve inconsistent import comments in sdk/metric * update changelog * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update CHANGELOG.md --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn Co-authored-by: Robert Pająk --- sdk/metric/manual_reader_test.go | 2 +- sdk/metric/reader_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index f20b0bc683c..8d71aeb18b7 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" +package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "testing" diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 3c024bbc5e5..ca10da77340 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package metric // import "go.opentelemetry.io/otel/sdk/metric/reader" +package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" From 39cf62beea00469edcb52464fbb622122b6b1048 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 21 May 2023 08:17:31 -0700 Subject: [PATCH 542/886] Bump lycheeverse/lychee-action from 1.7.0 to 1.8.0 (#4104) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.7.0 to 1.8.0. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.7.0...v1.8.0) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 5290542bbaa..70a2ab0cc2d 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v3 - name: Link Checker - uses: lycheeverse/lychee-action@v1.7.0 + uses: lycheeverse/lychee-action@v1.8.0 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 8e1b659c264..50184ce597a 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.7.0 + uses: lycheeverse/lychee-action@v1.8.0 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 3fca55af7a61ae6be7433e76457d8366f24516aa Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 21 May 2023 08:45:32 -0700 Subject: [PATCH 543/886] dependabot updates Sun May 21 15:20:04 UTC 2023 (#4126) Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/zipkin Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opentracing/test Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /schema Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/prometheus Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/stdout/stdoutmetric Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /metric Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /trace Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /exporters/jaeger Bump codecov/codecov-action from 3.1.3 to 3.1.4 Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /sdk/metric Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opencensus Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /bridge/opentracing Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 in /sdk Bump github.com/stretchr/testify from 1.8.2 to 1.8.3 --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.sum | 2 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 9 ++------- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 9 ++------- example/fib/go.sum | 2 +- example/jaeger/go.sum | 2 +- example/namedtracer/go.sum | 2 +- example/opencensus/go.sum | 2 +- example/otel-collector/go.sum | 2 +- example/passthrough/go.sum | 2 +- example/prometheus/go.sum | 2 +- example/view/go.sum | 2 +- example/zipkin/go.sum | 2 +- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 ++-- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 11 ++--------- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 8 ++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 8 ++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 8 ++------ exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 8 ++------ exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 8 ++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 8 ++------ exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 11 ++--------- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 11 ++--------- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 11 ++--------- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 11 ++--------- go.mod | 2 +- go.sum | 11 ++--------- internal/tools/go.mod | 2 +- internal/tools/go.sum | 3 ++- metric/go.mod | 2 +- metric/go.sum | 11 ++--------- schema/go.mod | 2 +- schema/go.sum | 11 ++--------- sdk/go.mod | 2 +- sdk/go.sum | 11 ++--------- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 11 ++--------- trace/go.mod | 2 +- trace/go.sum | 11 ++--------- 54 files changed, 76 insertions(+), 186 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index c255f8cf88c..ea0f6f86fdf 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.19 require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 4544d1127a2..baf4c128417 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -50,8 +50,8 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 81bef8755b0..4bade740996 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -45,7 +45,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 23ba29960ff..ce4a03682b7 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -8,7 +8,7 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index aec34af96d5..dccf4cafd0f 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -12,15 +12,10 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 46008057e7f..55769a276a1 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -11,7 +11,7 @@ replace go.opentelemetry.io/otel/trace => ../../../trace require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/bridge/opentracing v1.16.0-rc.1 google.golang.org/grpc v1.55.0 diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 99ac1868002..9c44b9ed205 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -28,14 +28,10 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -67,7 +63,6 @@ google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/example/fib/go.sum b/example/fib/go.sum index 25c43018ecb..0b11f463640 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index d6655565857..6d5cd2d59e0 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -7,7 +7,7 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 25c43018ecb..0b11f463640 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 81bef8755b0..4bade740996 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -45,7 +45,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 8595452decc..540866487ad 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -147,7 +147,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 25c43018ecb..0b11f463640 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 94bfb87e982..6551c033b71 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -25,7 +25,7 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/example/view/go.sum b/example/view/go.sum index 94bfb87e982..6551c033b71 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -25,7 +25,7 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 71bf9252770..395be7a7c95 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -8,7 +8,7 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index eec938aabd8..3062499b403 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 8a5892217ed..3de7ddbdd0b 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 81ea419df85..308fb9aefc7 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 ) require ( diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index 3ad47a69a73..ef627c8cbd8 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -1,19 +1,12 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 4439eb5d67d..b1ae8dcc922 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 6a495502376..428bcc3c99c 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -148,15 +148,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index b434cbed9f6..f3ea13959dd 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,7 +5,7 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 6a495502376..428bcc3c99c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -148,15 +148,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3ddf45257e8..e0b184fdc88 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,7 +5,7 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 6a495502376..428bcc3c99c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -148,15 +148,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 64b2954cb86..d248d2cb55d 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 6a495502376..428bcc3c99c 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -148,15 +148,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index faa60a0277b..1a647a75bfe 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.19 require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 0bb867eda71..6d5b5b2981d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -147,15 +147,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 5655fdc8093..fdbcd80e108 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.19 require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 92ae90f7c15..b983d4ff5e2 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -147,15 +147,11 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index a8f5f919c96..fe01a51f9dc 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.1 github.com/prometheus/client_model v0.4.0 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/metric v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 9dbe92885e8..d985ed44d75 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -3,7 +3,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -34,13 +33,8 @@ github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJf github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -51,6 +45,5 @@ google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cn google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index a4ec96bfcbb..4a25026323b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric go 1.19 require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index bbae3d88131..ceeaa87194d 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -9,17 +8,11 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 119ba12d1b4..1dfe2c975be 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index bbae3d88131..ceeaa87194d 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -9,17 +8,11 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 7cdcce5bcb6..64df4524b69 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index cf18113a123..508c49157bc 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -12,17 +11,11 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go.mod b/go.mod index 916b7b4a9ba..c87a04eb8b7 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel/metric v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 ) diff --git a/go.sum b/go.sum index 602e7803d8e..6c95d5c31d5 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -10,15 +9,9 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 0fbdc955d75..4dd6b00a2b5 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -168,7 +168,7 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/stretchr/testify v1.8.2 // indirect + github.com/stretchr/testify v1.8.3 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index fece622fcb6..fc709c3482e 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -564,8 +564,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= diff --git a/metric/go.mod b/metric/go.mod index 9d17ce1e3c6..dcb2c8d7509 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/metric go 1.19 require ( - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 ) diff --git a/metric/go.sum b/metric/go.sum index ac91c216e0d..927e0a54c64 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -9,15 +8,9 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/schema/go.mod b/schema/go.mod index c344d05c415..c581b8a6195 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/Masterminds/semver/v3 v3.2.1 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index 2877eb69b1b..1fbc93560a2 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -1,21 +1,14 @@ github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/go.mod b/sdk/go.mod index 47fa9dcc5f7..d5814c8ba3a 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/trace v1.16.0-rc.1 golang.org/x/sys v0.8.0 diff --git a/sdk/go.sum b/sdk/go.sum index 56df527c54c..a59b49ccf87 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -10,17 +9,11 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 95af059261b..7f0608781b0 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 go.opentelemetry.io/otel/metric v1.16.0-rc.1 go.opentelemetry.io/otel/sdk v1.16.0-rc.1 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index bbae3d88131..ceeaa87194d 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -1,4 +1,3 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -9,17 +8,11 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/trace/go.mod b/trace/go.mod index c4d721d7dfa..2a8dfe6a9b4 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.8.3 go.opentelemetry.io/otel v1.16.0-rc.1 ) diff --git a/trace/go.sum b/trace/go.sum index 28782004b3d..e94bb32ad91 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,19 +1,12 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From e0852d609c4a4205d550e2de45afdbf80d43557b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 22 May 2023 12:06:21 -0700 Subject: [PATCH 544/886] Release v1.16.0/v0.39.0 -- Stable Metric API (#4100) * Update versions * Prepare stable-v1 for version v1.16.0 * Prepare experimental-metrics for version v0.39.0 * Update changelog --- CHANGELOG.md | 16 ++++++++++++---- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/jaeger/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 14 +++++++------- example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/jaeger/go.mod | 8 ++++---- exporters/otlp/otlpmetric/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 14 +++++++------- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 12 ++++++------ exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 36 files changed, 160 insertions(+), 152 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c277bb9a02..d9f145f86d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.16.0/0.39.0] 2023-05-18 + +This release contains the first stable release of the OpenTelemetry Go [metric API]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ### Added +- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. + The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) - The `go.opentelemetry.io/otel/semconv/v1.20.0` package. The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) @@ -128,9 +136,6 @@ See our [versioning policy](VERSIONING.md) for more information about these stab - Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895) - The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900) - Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854) -- The `go.opentelemetry.io/otel/semconv/v1.19.0` package. The package contains -semantic conventions from the `v1.19.0` version of the OpenTelemetry -specification. (#3846) ### Changed @@ -2487,7 +2492,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0-rc.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0...HEAD +[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 [1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 [1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 [1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0 @@ -2557,3 +2563,5 @@ It contains api and sdk for trace and meter. [Go 1.20]: https://go.dev/doc/go1.20 [Go 1.19]: https://go.dev/doc/go1.19 [Go 1.18]: https://go.dev/doc/go1.18 + +[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index ea0f6f86fdf..2cb6d283423 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.3 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 3c600923d61..0660d1515d7 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.39.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/bridge/opencensus v0.39.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index ce4a03682b7..cf9e1ff3fa0 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 55769a276a1..3ac41b63633 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/bridge/opentracing v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/bridge/opentracing v1.16.0 google.golang.org/grpc v1.55.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index eecf01f3144..65d18138411 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index b1df0e0ff9f..160c28944fd 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -9,16 +9,16 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/jaeger v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/jaeger v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 2e94b38ca92..a9e9d837368 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 743fdf43924..12ff697ec4a 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.39.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/bridge/opencensus v0.39.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d1e782dfa77..5482940da15 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 google.golang.org/grpc v1.55.0 ) @@ -21,9 +21,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index ca8bbba9daa..3e8427f2dd9 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index f78ebfafe57..3ffa7e669b5 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.1 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 - go.opentelemetry.io/otel/metric v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/prometheus v0.39.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 8b7ac811f65..717ccfe6907 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.1 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.39.0-rc.1 - go.opentelemetry.io/otel/metric v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/prometheus v0.39.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 6a57f4ad693..1f38165af08 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/zipkin v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/zipkin v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect ) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 3062499b403..05e5b0ec8df 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -7,16 +7,16 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index b1ae8dcc922..31cd1ef827a 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 @@ -22,8 +22,8 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f3ea13959dd..1d8b08b6b21 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 google.golang.org/grpc v1.55.0 @@ -25,9 +25,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index e0b184fdc88..1d86cde0b9f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,10 +6,10 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -23,9 +23,9 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index 06461981b2c..caec1c40886 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.39.0-rc.1" + return "0.39.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index d248d2cb55d..e356ee2d8ab 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 @@ -22,7 +22,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 1a647a75bfe..8b40031f2dc 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/proto/otlp v0.19.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 @@ -23,8 +23,8 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index fdbcd80e108..e8c4b3b9ca5 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.19.0 google.golang.org/protobuf v1.30.0 ) @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index d628cf3beac..db70dc53143 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.16.0-rc.1" + return "1.16.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index fe01a51f9dc..eb01b2c706f 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.15.1 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/metric v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 4a25026323b..49fede661db 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v0.39.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/sdk/metric v0.39.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 1dfe2c975be..07aecd63288 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 64df4524b69..2a88b49ee5c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index c87a04eb8b7..fc584b1ce12 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel/metric v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index dcb2c8d7509..b19b81e8149 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index d5814c8ba3a..062b9a53aa0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/trace v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 golang.org/x/sys v0.8.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 7f0608781b0..cb56b130a49 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 - go.opentelemetry.io/otel/metric v1.16.0-rc.1 - go.opentelemetry.io/otel/sdk v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel/metric v1.16.0 + go.opentelemetry.io/otel/sdk v1.16.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.8.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 3a7c86dd023..cd4666b3223 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.16.0-rc.1" + return "0.39.0" } diff --git a/sdk/version.go b/sdk/version.go index c1c68a0a4c9..dbef90b0df1 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.16.0-rc.1" + return "1.16.0" } diff --git a/trace/go.mod b/trace/go.mod index 2a8dfe6a9b4..acd3b31f864 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.3 - go.opentelemetry.io/otel v1.16.0-rc.1 + go.opentelemetry.io/otel v1.16.0 ) require ( diff --git a/version.go b/version.go index 2edc5cde4e8..c2217a28d68 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.16.0-rc.1" + return "1.16.0" } diff --git a/versions.yaml b/versions.yaml index fa01f4b6851..9dc47532bc2 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.16.0-rc.1 + version: v1.16.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -36,7 +36,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.39.0-rc.1 + version: v0.39.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus From 2df12eb23d5e0e957d274df1a39a06b6ec6e0882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 23 May 2023 16:30:49 +0200 Subject: [PATCH 545/886] [chore] Refine generate Make target (#4097) * [chore] Refine generate Make target * Do not run porto in go-generate * Update Makefile --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- .github/workflows/ci.yml | 2 +- Makefile | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1595337bb3..f1db75bbd04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: with: path: ~/.tools key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} - - name: Run go generate + - name: Generate run: make generate - name: Run linters run: make dependabot-check license-check lint vanity-import-check diff --git a/Makefile b/Makefile index 26e4bed226f..4486274a1b5 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ TIMEOUT = 60 .DEFAULT_GOAL := precommit .PHONY: precommit ci -precommit: generate dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default +precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage # Tools @@ -110,13 +110,19 @@ $(CODESPELL): PACKAGE=codespell # Generate .PHONY: generate +generate: go-generate vanity-import-fix -generate: $(OTEL_GO_MOD_DIRS:%=generate/%) -generate/%: DIR=$* -generate/%: | $(STRINGER) $(PORTO) +.PHONY: go-generate +go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) +go-generate/%: DIR=$* +go-generate/%: | $(STRINGER) @echo "$(GO) generate $(DIR)/..." \ && cd $(DIR) \ - && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w . + && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... + +.PHONY: vanity-import-fix +vanity-import-fix: | $(PORTO) + @$(PORTO) --include-internal -w . # Build @@ -205,10 +211,6 @@ lint: misspell lint-modules golangci-lint vanity-import-check: | $(PORTO) @$(PORTO) --include-internal -l . || echo "(run: make vanity-import-fix)" -.PHONY: vanity-import-fix -vanity-import-fix: | $(PORTO) - @$(PORTO) --include-internal -w . - .PHONY: misspell misspell: | $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) From 46f2ce5ca6adaa264c37cdbba251c9184a06ed7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serdar=20Kalayc=C4=B1?= Date: Tue, 23 May 2023 23:08:30 +0200 Subject: [PATCH 546/886] Marked Metrics as stable (#4129) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e138a8a07f4..4fb892ad32b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ It provides a set of APIs to directly measure performance and behavior of your s | Signal | Status | Project | | ------- | ---------- | ------- | | Traces | Stable | N/A | -| Metrics | Beta | N/A | +| Metrics | Stable | N/A | | Logs | Frozen [1] | N/A | - [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics. From ff9fa334c91983bf58e5abbe17e1aec7f5c5089e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 25 May 2023 17:24:46 +0200 Subject: [PATCH 547/886] [chore] Update documentation guidelines (#4136) * Simplify documentation guidelines * Add info how to localy run pkg.go.dev --- CONTRIBUTING.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b2df5de34a6..c00a22e1e89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -179,23 +179,23 @@ For a deeper discussion, see ## Documentation -Each non-example Go Module should have its own `README.md` containing: - -- A pkg.go.dev badge which can be generated [here](https://pkg.go.dev/badge/). -- Brief description. -- Installation instructions (and requirements if applicable). -- Hyperlink to an example. Depending on the component the example can be: - - An `example_test.go` like [here](exporters/stdout/stdouttrace/example_test.go). - - A sample Go application with its own `README.md`, like [here](example/zipkin). -- Additional documentation sections such us: - - Configuration, - - Contributing, - - References. - -[Here](exporters/jaeger/README.md) is an example of a concise `README.md`. - -Moreover, it should be possible to navigate to any `README.md` from the -root `README.md`. +Each package must be documented using +[Go Doc Comments](https://go.dev/doc/comment), +preferably in a `doc.go` file. + +Prefer using [Examples](https://pkg.go.dev/testing#hdr-Examples) +instead of putting code snippets in Go doc comments. +In some cases, you can even create [Testable Examples](https://go.dev/blog/examples). + +You can install and run a "local Go Doc site" in the following way: + + ```sh + go install golang.org/x/pkgsite/cmd/pkgsite@latest + pkgsite + ``` + +[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric) +is an example of a very well-documented package. ## Style Guide From bcc2af02f4f1e25405528c8936b048dec79aea27 Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Fri, 26 May 2023 10:49:44 -0400 Subject: [PATCH 548/886] Add @pellared as maintainer (#4138) * Add @pellared as maintainer Signed-off-by: Anthony J Mirabella * Add @pellared as maintainer in CODEOWNERS --------- Signed-off-by: Anthony J Mirabella Co-authored-by: Tyler Yahn --- CODEOWNERS | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index f6f6a313b5b..7276165ab67 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,4 +14,4 @@ * @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod +CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod @pellared diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c00a22e1e89..645f84d5296 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -538,7 +538,6 @@ interface that defines the specific functionality should be preferred. - [Evan Torrie](https://github.com/evantorrie), Verizon Media - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics - [David Ashpole](https://github.com/dashpole), Google -- [Robert Pająk](https://github.com/pellared), Splunk - [Chester Cheung](https://github.com/hanyuancheung), Tencent - [Damien Mathieu](https://github.com/dmathieu), Elastic @@ -546,6 +545,7 @@ interface that defines the specific functionality should be preferred. - [Aaron Clawson](https://github.com/MadVikingGod), LightStep - [Anthony Mirabella](https://github.com/Aneurysm9), AWS +- [Robert Pająk](https://github.com/pellared), Splunk - [Tyler Yahn](https://github.com/MrAlias), Splunk ### Emeritus From 0cdd5cecd90ed0c745ca6a5cc3b768c48efcc57a Mon Sep 17 00:00:00 2001 From: Anthony Mirabella Date: Fri, 26 May 2023 11:13:37 -0400 Subject: [PATCH 549/886] Move @Aneurysm9 to approver (#4137) * Move @Aneurysm9 to approver Signed-off-by: Anthony J Mirabella * Remove @Aneurysm9 from CODEOWNERS --------- Signed-off-by: Anthony J Mirabella Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- CODEOWNERS | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 7276165ab67..623740007d4 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,4 +14,4 @@ * @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod @pellared +CODEOWNERS @MrAlias @MadVikingGod @pellared \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 645f84d5296..3a705c79537 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -540,11 +540,11 @@ interface that defines the specific functionality should be preferred. - [David Ashpole](https://github.com/dashpole), Google - [Chester Cheung](https://github.com/hanyuancheung), Tencent - [Damien Mathieu](https://github.com/dmathieu), Elastic +- [Anthony Mirabella](https://github.com/Aneurysm9), AWS ### Maintainers - [Aaron Clawson](https://github.com/MadVikingGod), LightStep -- [Anthony Mirabella](https://github.com/Aneurysm9), AWS - [Robert Pająk](https://github.com/pellared), Splunk - [Tyler Yahn](https://github.com/MrAlias), Splunk From b2246d58650bc6db04459353843250ee3bba77fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 26 May 2023 17:23:50 +0200 Subject: [PATCH 550/886] [chore] Clarify that internal and test packages do not need docs (#4140) Co-authored-by: Tyler Yahn --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a705c79537..2099575bd76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -179,7 +179,7 @@ For a deeper discussion, see ## Documentation -Each package must be documented using +Each (non-internal, non-test) package must be documented using [Go Doc Comments](https://go.dev/doc/comment), preferably in a `doc.go` file. From e2f8ecae74aba268326d2fbf52c6ccce21e56698 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 18:31:29 +0200 Subject: [PATCH 551/886] Bump codecov/codecov-action from 3.1.3 to 3.1.4 (#4108) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.3 to 3.1.4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.3...v3.1.4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1db75bbd04..cc6290a5e72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v3.1.3 + uses: codecov/codecov-action@v3.1.4 with: file: ./coverage.txt fail_ci_if_error: true From f9565872df23bf15026bca11b3888ad49f2cc809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 1 Jun 2023 09:28:29 +0200 Subject: [PATCH 552/886] sdk/metrics: Fix MeterProvider.Meter Go doc (#4152) --- sdk/metric/provider.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 33daabb50fb..488ea026299 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -60,9 +60,6 @@ func NewMeterProvider(options ...Option) *MeterProvider { // telemetry. This name may be the same as the instrumented code only if that // code provides built-in instrumentation. // -// If name is empty, the default (go.opentelemetry.io/otel/sdk/meter) will be -// used. -// // Calls to the Meter method after Shutdown has been called will return Meters // that perform no operations. // From 8cddf8cf1f9b17b1feb1b300d8dd25be4f078daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 1 Jun 2023 09:56:17 +0200 Subject: [PATCH 553/886] sdk/metric: Log empty meter name (#4153) * sdk/metric: Log empty meter name * Avoid magic numbers * Lint * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update log message * Apply suggestion --------- Co-authored-by: Tyler Yahn --- sdk/metric/provider.go | 5 +++++ sdk/metric/provider_test.go | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 488ea026299..716e92220d4 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -17,6 +17,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" @@ -65,6 +66,10 @@ func NewMeterProvider(options ...Option) *MeterProvider { // // This method is safe to call concurrently. func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metric.Meter { + if name == "" { + global.Warn("Invalid Meter name.", "name", name) + } + c := metric.NewMeterConfig(options...) s := instrumentation.Scope{ Name: name, diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go index 7aa639f5df2..a8d7434b275 100644 --- a/sdk/metric/provider_test.go +++ b/sdk/metric/provider_test.go @@ -16,9 +16,14 @@ package metric import ( "context" + "fmt" + "strings" "testing" + "github.com/go-logr/logr/funcr" "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel" ) func TestMeterConcurrentSafe(t *testing.T) { @@ -74,3 +79,17 @@ func TestMeterProviderReturnsSameMeter(t *testing.T) { assert.Same(t, mtr, mp.Meter("")) assert.NotSame(t, mtr, mp.Meter("diff")) } + +func TestEmptyMeterName(t *testing.T) { + var buf strings.Builder + warnLevel := 1 + l := funcr.New(func(prefix, args string) { + _, _ = buf.WriteString(fmt.Sprint(prefix, args)) + }, funcr.Options{Verbosity: warnLevel}) + otel.SetLogger(l) + mp := NewMeterProvider() + + mp.Meter("") + + assert.Contains(t, buf.String(), `"level"=1 "msg"="Invalid Meter name." "name"=""`) +} From b9079960aed5cf98a8c80e832cfa9e065bcd3fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 1 Jun 2023 16:30:39 +0200 Subject: [PATCH 554/886] [chore] Update Project Status and README formatting (#4146) * [chore] Update Project Status * Fornat table * Update README.md Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> Co-authored-by: Tyler Yahn --- README.md | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4fb892ad32b..c02ab206522 100644 --- a/README.md +++ b/README.md @@ -11,22 +11,25 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | Project | -| ------- | ---------- | ------- | -| Traces | Stable | N/A | -| Metrics | Stable | N/A | -| Logs | Frozen [1] | N/A | +| Signal | Status | Project | +|---------|------------|-----------------------| +| Traces | Stable | N/A | +| Metrics | Mixed [1] | [Go: Metric SDK (GA)] | +| Logs | Frozen [2] | N/A | -- [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics. +[Go: Metric SDK (GA)]: https://github.com/orgs/open-telemetry/projects/34 + +- [1]: [Metrics API](https://pkg.go.dev/go.opentelemetry.io/otel/metric) is Stable. [Metrics SDK](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric) is Beta. +- [2]: The Logs signal development is halted for this project while we stablize the Metrics SDK. No Logs Pull Requests are currently being accepted. -Progress and status specific to this repository is tracked in our local +Progress and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) and [milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). Project versioning information and stability guarantees can be found in the -[versioning documentation](./VERSIONING.md). +[versioning documentation](VERSIONING.md). ### Compatibility @@ -49,7 +52,7 @@ stop ensuring compatibility with these versions in the following manner: Currently, this project supports the following environments. | OS | Go Version | Architecture | -| ------- | ---------- | ------------ | +|---------|------------|--------------| | Ubuntu | 1.20 | amd64 | | Ubuntu | 1.19 | amd64 | | Ubuntu | 1.20 | 386 | @@ -97,12 +100,12 @@ export pipeline to send that telemetry to an observability platform. All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters). | Exporter | Metrics | Traces | -| :-----------------------------------: | :-----: | :----: | -| [Jaeger](./exporters/jaeger/) | | ✓ | -| [OTLP](./exporters/otlp/) | ✓ | ✓ | -| [Prometheus](./exporters/prometheus/) | ✓ | | -| [stdout](./exporters/stdout/) | ✓ | ✓ | -| [Zipkin](./exporters/zipkin/) | | ✓ | +|---------------------------------------|:-------:|:------:| +| [Jaeger](./exporters/jaeger/) | | ✓ | +| [OTLP](./exporters/otlp/) | ✓ | ✓ | +| [Prometheus](./exporters/prometheus/) | ✓ | | +| [stdout](./exporters/stdout/) | ✓ | ✓ | +| [Zipkin](./exporters/zipkin/) | | ✓ | ## Contributing From bb867e6a4ed4d8f9bb29110417e73e42056ee87f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Jun 2023 07:54:38 -0700 Subject: [PATCH 555/886] Bump github.com/golangci/golangci-lint from 1.52.2 to 1.53.2 in /internal/tools (#4177) * Bump github.com/golangci/golangci-lint in /internal/tools Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.52.2 to 1.53.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.52.2...v1.53.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update golangci lint configuration --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .golangci.yml | 34 +++++-------- internal/tools/go.mod | 51 ++++++++++--------- internal/tools/go.sum | 115 +++++++++++++++++++++++------------------- 3 files changed, 104 insertions(+), 96 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index dbb6670b397..c0e4b95b23d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,28 +61,18 @@ issues: linters-settings: depguard: - # Check the list against standard lib. - # Default: false - include-go-root: true - # A list of packages for the list type specified. - # Default: [] - packages: - - "crypto/md5" - - "crypto/sha1" - - "crypto/**/pkix" - ignore-file-rules: - - "**/*_test.go" - additional-guards: - # Do not allow testing packages in non-test files. - - list-type: denylist - include-go-root: true - packages: - - testing - - github.com/stretchr/testify - ignore-file-rules: - - "**/*_test.go" - - "**/*test/*.go" - - "**/internal/matchers/*.go" + rules: + non-tests: + files: + - "!$test" + - "!**/*test/*.go" + - "!**/internal/matchers/*.go" + deny: + - pkg: "testing" + - pkg: "github.com/stretchr/testify" + - pkg: "crypto/md5" + - pkg: "crypto/sha1" + - pkg: "crypto/**/pkix" godot: exclude: # Exclude links. diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 4dd6b00a2b5..3f798432a91 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.52.2 + github.com/golangci/golangci-lint v1.53.2 github.com/itchyny/gojq v0.12.12 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -13,23 +13,25 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.7.0 go.opentelemetry.io/build-tools/multimod v0.7.0 go.opentelemetry.io/build-tools/semconvgen v0.7.0 - golang.org/x/tools v0.9.1 + golang.org/x/tools v0.9.3 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect + github.com/4meepo/tagalign v1.2.2 // indirect github.com/Abirdcfly/dupword v0.0.11 // indirect - github.com/Antonboom/errname v0.1.9 // indirect - github.com/Antonboom/nilnil v0.1.3 // indirect - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Antonboom/errname v0.1.10 // indirect + github.com/Antonboom/nilnil v0.1.5 // indirect + github.com/BurntSushi/toml v1.3.0 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect - github.com/OpenPeeDeeP/depguard v1.1.1 // indirect + github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect + github.com/alexkohler/nakedret/v2 v2.0.1 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect github.com/ashanbrown/forbidigo v1.5.1 // indirect @@ -40,7 +42,8 @@ require ( github.com/bombsimon/wsl/v3 v3.4.0 // indirect github.com/breml/bidichk v0.2.4 // indirect github.com/breml/errchkjson v0.3.1 // indirect - github.com/butuzov/ireturn v0.1.1 // indirect + github.com/butuzov/ireturn v0.2.0 // indirect + github.com/butuzov/mirror v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect @@ -57,7 +60,7 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.7.0 // indirect + github.com/go-critic/go-critic v0.8.1 // indirect github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect github.com/go-git/go-git/v5 v5.6.1 // indirect @@ -100,16 +103,15 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect - github.com/junk1tm/musttag v0.5.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/kulti/thelper v0.6.3 // indirect - github.com/kunwardeep/paralleltest v1.0.6 // indirect + github.com/kunwardeep/paralleltest v1.0.7 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect - github.com/ldez/tagliatelle v0.4.0 // indirect + github.com/ldez/tagliatelle v0.5.0 // indirect github.com/leonklingele/grouper v1.1.1 // indirect github.com/lufeee/execinquery v1.2.1 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -121,20 +123,20 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.3.1 // indirect + github.com/mgechev/revive v1.3.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.9.5 // indirect + github.com/nishanths/exhaustive v0.10.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.9.0 // indirect + github.com/nunnatsa/ginkgolinter v0.12.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.4.0 // indirect + github.com/polyfloyd/go-errorlint v1.4.2 // indirect github.com/prometheus/client_golang v1.15.1 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect @@ -149,11 +151,11 @@ require ( github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect - github.com/securego/gosec/v2 v2.15.0 // indirect + github.com/securego/gosec/v2 v2.16.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/sirupsen/logrus v1.9.0 // indirect - github.com/sivchari/containedctx v1.0.2 // indirect + github.com/sirupsen/logrus v1.9.2 // indirect + github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect github.com/skeema/knownhosts v1.1.0 // indirect @@ -168,12 +170,12 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect - github.com/stretchr/testify v1.8.3 // indirect + github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.11 // indirect - github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect + github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect @@ -181,15 +183,18 @@ require ( github.com/ultraware/whitespace v0.0.5 // indirect github.com/uudashr/gocognit v1.0.6 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect + github.com/xen0n/gosmopolitan v1.2.1 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect + github.com/ykadowak/zerologlint v0.1.1 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect go.opentelemetry.io/build-tools v0.7.0 // indirect + go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/crypto v0.9.0 // indirect + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.10.0 // indirect @@ -202,7 +207,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect honnef.co/go/tools v0.4.3 // indirect - mvdan.cc/gofumpt v0.4.0 // indirect + mvdan.cc/gofumpt v0.5.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index fc709c3482e..4cd9c37ab5d 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -40,15 +40,17 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/4meepo/tagalign v1.2.2 h1:kQeUTkFTaBRtd/7jm8OKJl9iHk0gAO+TDFPHGSna0aw= +github.com/4meepo/tagalign v1.2.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= github.com/Abirdcfly/dupword v0.0.11 h1:z6v8rMETchZXUIuHxYNmlUAuKuB21PeaSymTed16wgU= github.com/Abirdcfly/dupword v0.0.11/go.mod h1:wH8mVGuf3CP5fsBTkfWwwwKTjDnVVCxtU8d8rgeVYXA= -github.com/Antonboom/errname v0.1.9 h1:BZDX4r3l4TBZxZ2o2LNrlGxSHran4d1u4veZdoORTT4= -github.com/Antonboom/errname v0.1.9/go.mod h1:nLTcJzevREuAsgTbG85UsuiWpMpAqbKD1HNZ29OzE58= -github.com/Antonboom/nilnil v0.1.3 h1:6RTbx3d2mcEu3Zwq9TowQpQMVpP75zugwOtqY1RTtcE= -github.com/Antonboom/nilnil v0.1.3/go.mod h1:iOov/7gRcXkeEU+EMGpBu2ORih3iyVEiWjeste1SJm8= +github.com/Antonboom/errname v0.1.10 h1:RZ7cYo/GuZqjr1nuJLNe8ZH+a+Jd9DaZzttWzak9Bls= +github.com/Antonboom/errname v0.1.10/go.mod h1:xLeiCIrvVNpUtsN0wxAh05bNIZpqE22/qDMnTBTttiA= +github.com/Antonboom/nilnil v0.1.5 h1:X2JAdEVcbPaOom2TUa1FxZ3uyuUlex0XMLGYMemu6l0= +github.com/Antonboom/nilnil v0.1.5/go.mod h1:I24toVuBKhfP5teihGWctrRiPbRKHwZIFOvc6v3HZXk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= +github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= @@ -59,8 +61,8 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0 github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= -github.com/OpenPeeDeeP/depguard v1.1.1 h1:TSUznLjvp/4IUP+OQ0t/4jF4QUyxIcVX8YnghZdunyA= -github.com/OpenPeeDeeP/depguard v1.1.1/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= +github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= +github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= @@ -70,6 +72,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alexkohler/nakedret/v2 v2.0.1 h1:DLFVWaHbEntNHBYGhPX+AhCM1gCErTs35IFWPh6Bnn0= +github.com/alexkohler/nakedret/v2 v2.0.1/go.mod h1:2b8Gkk0GsOrqQv/gPWjNLDSKwG8I5moSXG1K4VIBcTQ= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= @@ -97,8 +101,10 @@ github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= -github.com/butuzov/ireturn v0.1.1 h1:QvrO2QF2+/Cx1WA/vETCIYBKtRjc30vesdoPUNo1EbY= -github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= +github.com/butuzov/ireturn v0.2.0 h1:kCHi+YzC150GE98WFuZQu9yrTn6GEydO2AuPLbTgnO4= +github.com/butuzov/ireturn v0.2.0/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= +github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= +github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -149,15 +155,15 @@ github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/firefart/nonamedreturns v1.0.4 h1:abzI1p7mAEPYuR4A+VLKn4eNDOycjYo2phmY9sfv40Y= github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= -github.com/go-critic/go-critic v0.7.0 h1:tqbKzB8pqi0NsRZ+1pyU4aweAF7A7QN0Pi4Q02+rYnQ= -github.com/go-critic/go-critic v0.7.0/go.mod h1:moYzd7GdVXE2C2hYTwd7h0CPcqlUeclsyBRwMa38v64= +github.com/go-critic/go-critic v0.8.1 h1:16omCF1gN3gTzt4j4J6fKI/HnRojhEp+Eks6EuKw3vw= +github.com/go-critic/go-critic v0.8.1/go.mod h1:kpzXl09SIJX1cr9TB/g/sAG+eFEl7ZS9f9cqvZtyNl0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -176,8 +182,9 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-toolsmith/astcast v1.1.0 h1:+JN9xZV1A+Re+95pgnMgDboWNVnIMMQXwfBwLRPgSC8= github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU= github.com/go-toolsmith/astcopy v1.1.0 h1:YGwBN0WM+ekI/6SS6+52zLDEf8Yvp3n2seZITCUBt5s= @@ -241,8 +248,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.52.2 h1:FrPElUUI5rrHXg1mQ7KxI1MXPAw5lBVskiz7U7a8a1A= -github.com/golangci/golangci-lint v1.52.2/go.mod h1:S5fhC5sHM5kE22/HcATKd1XLWQxX+y7mHj8B5H91Q/0= +github.com/golangci/golangci-lint v1.53.2 h1:52pgJKXiAuyfcOa8HJPIrZk1oMgpyXeN8TUxpcteweM= +github.com/golangci/golangci-lint v1.53.2/go.mod h1:fz9DDC9UABJ7SFHTz0XnkiYzb4su7YpuB9ucsgdUfCk= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -283,6 +290,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -346,8 +354,6 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= -github.com/junk1tm/musttag v0.5.0 h1:bV1DTdi38Hi4pG4OVWa7Kap0hi0o7EczuK6wQt9zPOM= -github.com/junk1tm/musttag v0.5.0/go.mod h1:PcR7BA+oREQYvHwgjIDmw3exJeds5JzRcvEJTfjrA0M= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -370,14 +376,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoaGS+Ugg8g= -github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= +github.com/kunwardeep/paralleltest v1.0.7 h1:2uCk94js0+nVNQoHZNLBkAR1DQJrVzw6T0RMzJn55dQ= +github.com/kunwardeep/paralleltest v1.0.7/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= -github.com/ldez/tagliatelle v0.4.0 h1:sylp7d9kh6AdXN2DpVGHBRb5guTVAgOxqNGhbqc4b1c= -github.com/ldez/tagliatelle v0.4.0/go.mod h1:mNtTfrHy2haaBAw+VT7IBV6VXBThS7TCreYWbBcJ87I= +github.com/ldez/tagliatelle v0.5.0 h1:epgfuYt9v0CG3fms0pEgIMNPuFf/LpPIfjk4kyqSioo= +github.com/ldez/tagliatelle v0.5.0/go.mod h1:rj1HmWiL1MiKQuOONhd09iySTEkUuE/8+5jtPYz9xa4= github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt8ivzU= github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= @@ -406,8 +412,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.3.1 h1:OlQkcH40IB2cGuprTPcjB0iIUddgVZgGmDX3IAMR8D4= -github.com/mgechev/revive v1.3.1/go.mod h1:YlD6TTWl2B8A103R9KWJSPVI9DrEf+oqr15q21Ld+5I= +github.com/mgechev/revive v1.3.2 h1:Wb8NQKBaALBJ3xrrj4zpwJwqwNA6nDpyJSEQWcCka6U= +github.com/mgechev/revive v1.3.2/go.mod h1:UCLtc7o5vg5aXCwdUTU1kEBQ1v+YXPAkYDIDXbrs5I0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -427,16 +433,16 @@ github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4N github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.9.5 h1:TzssWan6orBiLYVqewCG8faud9qlFntJE30ACpzmGME= -github.com/nishanths/exhaustive v0.9.5/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= +github.com/nishanths/exhaustive v0.10.0 h1:BMznKAcVa9WOoLq/kTGp4NJOJSMwEpcpjFNAVRfPlSo= +github.com/nishanths/exhaustive v0.10.0/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.9.0 h1:Sm0zX5QfjJzkeCjEp+t6d3Ha0jwvoDjleP9XCsrEzOA= -github.com/nunnatsa/ginkgolinter v0.9.0/go.mod h1:FHaMLURXP7qImeH6bvxWJUpyH+2tuqe5j4rW1gxJRmI= +github.com/nunnatsa/ginkgolinter v0.12.0 h1:seZo112n+lt0gdLJ/Jh70mzvrqbABWFpXd1bZTLTByM= +github.com/nunnatsa/ginkgolinter v0.12.0/go.mod h1:dJIGXYXbkBswqa/pIzG0QlVTTDSBMxDoCFwhsl4Uras= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI= -github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.10.0 h1:znyI7l134wNg/wDktoVQPxPkgvhDfGCYUasey+h0rDQ= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -454,8 +460,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.4.0 h1:b+sQ5HibPIAjEZwtuwU8Wz/u0dMZ7YL+bk+9yWyHVJk= -github.com/polyfloyd/go-errorlint v1.4.0/go.mod h1:qJCkPeBn+0EXkdKTrUCcuFStM2xrDKfxI3MGLXPexUs= +github.com/polyfloyd/go-errorlint v1.4.2 h1:CU+O4181IxFDdPH6t/HT7IiDj1I7zxNi1RIUxYwn8d0= +github.com/polyfloyd/go-errorlint v1.4.2/go.mod h1:k6fU/+fQe38ednoZS51T7gSIGQW1y94d6TkSr35OzH8= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -494,7 +500,7 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= @@ -506,8 +512,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1jbEOPrEhDzGYq0= github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= -github.com/securego/gosec/v2 v2.15.0 h1:v4Ym7FF58/jlykYmmhZ7mTm7FQvN/setNm++0fgIAtw= -github.com/securego/gosec/v2 v2.15.0/go.mod h1:VOjTrZOkUtSDt2QLSJmQBMWnvwiQPEjg0l+5juIqGk8= +github.com/securego/gosec/v2 v2.16.0 h1:Pi0JKoasQQ3NnoRao/ww/N/XdynIB9NRYYZT5CyOs5U= +github.com/securego/gosec/v2 v2.16.0/go.mod h1:xvLcVZqUfo4aAQu56TNv7/Ltz6emAOQAEsrZrt7uGlI= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -519,10 +525,10 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/sivchari/containedctx v1.0.2 h1:0hLQKpgC53OVF1VT7CeoFHk9YKstur1XOgfYIc1yrHI= -github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= +github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= +github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= +github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= @@ -565,8 +571,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c h1:+aPplBwWcHBo6q9xrfWdMrT9o4kltkmmvpemgIjep/8= @@ -579,8 +585,8 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= -github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e h1:MV6KaVu/hzByHP0UvJ4HcMGE/8a6A4Rggc/0wx2AvJo= -github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= +github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= github.com/timonwong/loggercheck v0.9.4/go.mod h1:caz4zlPcgvpEkXgVnAJGowHAMW2NwHaNlpS8xDbVhTg= github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQpIXDJRhQ= @@ -597,10 +603,14 @@ github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtc github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/xen0n/gosmopolitan v1.2.1 h1:3pttnTuFumELBRSh+KQs1zcz4fN6Zy7aB0xlnQSn1Iw= +github.com/xen0n/gosmopolitan v1.2.1/go.mod h1:JsHq/Brs1o050OOdmzHeOr0N7OtlnKRAGAsElF8xBQA= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= +github.com/ykadowak/zerologlint v0.1.1 h1:CA1+RsGS1DbBn3jJP2jpWfiMJipWdeqJfSY0GpNgqaY= +github.com/ykadowak/zerologlint v0.1.1/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -610,6 +620,7 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= +go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -626,6 +637,8 @@ go.opentelemetry.io/build-tools/multimod v0.7.0 h1:Af1wVNaJRMVqRkiiRjeMrAfKJDejv go.opentelemetry.io/build-tools/multimod v0.7.0/go.mod h1:WAwBtJC42JbRDzfi3erCYQ9M1RnyoIcqI/H8eqBBPQo= go.opentelemetry.io/build-tools/semconvgen v0.7.0 h1:/M2qRnBQLN1rZmZ4F220EZh1CPil9Ji+XI2REudGRII= go.opentelemetry.io/build-tools/semconvgen v0.7.0/go.mod h1:5g2MEDQeJlvSRuleejMTkSSWUqxIjYhwOKJnDzl/cdM= +go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= +go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -647,8 +660,9 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -659,8 +673,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4= +golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= @@ -861,7 +875,6 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -933,8 +946,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1063,8 +1076,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= -mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM= -mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= +mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= +mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= From b4faa3dfdbe03296c9442e812e9f70edd6754a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 5 Jun 2023 09:33:03 +0200 Subject: [PATCH 556/886] semconv: Stop generating httpconv.go, netconv.go, http.go (#4145) --- CHANGELOG.md | 4 + .../tools/semconvkit/templates/http.go.tmpl | 21 --- .../templates/httpconv/http.go.tmpl | 154 ------------------ .../semconvkit/templates/netconv/net.go.tmpl | 66 -------- 4 files changed, 4 insertions(+), 241 deletions(-) delete mode 100644 internal/tools/semconvkit/templates/http.go.tmpl delete mode 100644 internal/tools/semconvkit/templates/httpconv/http.go.tmpl delete mode 100644 internal/tools/semconvkit/templates/netconv/net.go.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index d9f145f86d7..da29d06d8e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) + ## [1.16.0/0.39.0] 2023-05-18 This release contains the first stable release of the OpenTelemetry Go [metric API]. diff --git a/internal/tools/semconvkit/templates/http.go.tmpl b/internal/tools/semconvkit/templates/http.go.tmpl deleted file mode 100644 index 06d08932590..00000000000 --- a/internal/tools/semconvkit/templates/http.go.tmpl +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" - -// HTTP scheme attributes. -var ( - HTTPSchemeHTTP = HTTPSchemeKey.String("http") - HTTPSchemeHTTPS = HTTPSchemeKey.String("https") -) diff --git a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl b/internal/tools/semconvkit/templates/httpconv/http.go.tmpl deleted file mode 100644 index 31eccc1608e..00000000000 --- a/internal/tools/semconvkit/templates/httpconv/http.go.tmpl +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package httpconv provides OpenTelemetry HTTP semantic conventions for -// tracing telemetry. -package httpconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/httpconv" - -import ( - "net/http" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/semconv/internal/v4" - semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" -) - -var ( - nc = &internal.NetConv{ - NetHostNameKey: semconv.NetHostNameKey, - NetHostPortKey: semconv.NetHostPortKey, - NetPeerNameKey: semconv.NetPeerNameKey, - NetPeerPortKey: semconv.NetPeerPortKey, - NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, - NetSockPeerPortKey: semconv.NetSockPeerPortKey, - NetTransportOther: semconv.NetTransportOther, - NetTransportTCP: semconv.NetTransportTCP, - NetTransportUDP: semconv.NetTransportUDP, - NetTransportInProc: semconv.NetTransportInProc, - } - - hc = &internal.HTTPConv{ - NetConv: nc, - - EnduserIDKey: semconv.EnduserIDKey, - HTTPClientIPKey: semconv.HTTPClientIPKey, - NetProtocolNameKey: semconv.NetProtocolNameKey, - NetProtocolVersionKey: semconv.NetProtocolVersionKey, - HTTPMethodKey: semconv.HTTPMethodKey, - HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, - HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, - HTTPRouteKey: semconv.HTTPRouteKey, - HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, - HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, - HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, - HTTPTargetKey: semconv.HTTPTargetKey, - HTTPURLKey: semconv.HTTPURLKey, - UserAgentOriginalKey: semconv.UserAgentOriginalKey, - } -) - -// ClientResponse returns trace attributes for an HTTP response received by a -// client from a server. It will return the following attributes if the related -// values are defined in resp: "http.status.code", -// "http.response_content_length". -// -// This does not add all OpenTelemetry required attributes for an HTTP event, -// it assumes ClientRequest was used to create the span with a complete set of -// attributes. If a complete set of attributes can be generated using the -// request contained in resp. For example: -// -// append(ClientResponse(resp), ClientRequest(resp.Request)...) -func ClientResponse(resp *http.Response) []attribute.KeyValue { - return hc.ClientResponse(resp) -} - -// ClientRequest returns trace attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.url", -// "net.protocol.(name|version)", "http.method", "net.peer.name". -// The following attributes are returned if the related values are defined -// in req: "net.peer.port", "http.user_agent", "http.request_content_length", -// "enduser.id". -func ClientRequest(req *http.Request) []attribute.KeyValue { - return hc.ClientRequest(req) -} - -// ClientStatus returns a span status code and message for an HTTP status code -// value received by a client. -func ClientStatus(code int) (codes.Code, string) { - return hc.ClientStatus(code) -} - -// ServerRequest returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// ""net.protocol.(name|version)", "http.target", "net.host.name". -// The following attributes are returned if they related values are defined -// in req: "net.host.port", "net.sock.peer.addr", "net.sock.peer.port", -// "user_agent.original", "enduser.id", "http.client_ip". -func ServerRequest(server string, req *http.Request) []attribute.KeyValue { - return hc.ServerRequest(server, req) -} - -// ServerStatus returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func ServerStatus(code int) (codes.Code, string) { - return hc.ServerStatus(code) -} - -// RequestHeader returns the contents of h as attributes. -// -// Instrumentation should require an explicit configuration of which headers to -// captured and then prune what they pass here. Including all headers can be a -// security risk - explicit configuration helps avoid leaking sensitive -// information. -// -// The User-Agent header is already captured in the user_agent.original attribute -// from ClientRequest and ServerRequest. Instrumentation may provide an option -// to capture that header here even though it is not recommended. Otherwise, -// instrumentation should filter that out of what is passed. -func RequestHeader(h http.Header) []attribute.KeyValue { - return hc.RequestHeader(h) -} - -// ResponseHeader returns the contents of h as attributes. -// -// Instrumentation should require an explicit configuration of which headers to -// captured and then prune what they pass here. Including all headers can be a -// security risk - explicit configuration helps avoid leaking sensitive -// information. -// -// The User-Agent header is already captured in the user_agent.original attribute -// from ClientRequest and ServerRequest. Instrumentation may provide an option -// to capture that header here even though it is not recommended. Otherwise, -// instrumentation should filter that out of what is passed. -func ResponseHeader(h http.Header) []attribute.KeyValue { - return hc.ResponseHeader(h) -} diff --git a/internal/tools/semconvkit/templates/netconv/net.go.tmpl b/internal/tools/semconvkit/templates/netconv/net.go.tmpl deleted file mode 100644 index a855c45c767..00000000000 --- a/internal/tools/semconvkit/templates/netconv/net.go.tmpl +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package netconv provides OpenTelemetry network semantic conventions for -// tracing telemetry. -package netconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}/netconv" - -import ( - "net" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/semconv/internal/v4" - semconv "go.opentelemetry.io/otel/semconv/{{.TagVer}}" -) - -var nc = &internal.NetConv{ - NetHostNameKey: semconv.NetHostNameKey, - NetHostPortKey: semconv.NetHostPortKey, - NetPeerNameKey: semconv.NetPeerNameKey, - NetPeerPortKey: semconv.NetPeerPortKey, - NetSockFamilyKey: semconv.NetSockFamilyKey, - NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, - NetSockPeerPortKey: semconv.NetSockPeerPortKey, - NetSockHostAddrKey: semconv.NetSockHostAddrKey, - NetSockHostPortKey: semconv.NetSockHostPortKey, - NetTransportOther: semconv.NetTransportOther, - NetTransportTCP: semconv.NetTransportTCP, - NetTransportUDP: semconv.NetTransportUDP, - NetTransportInProc: semconv.NetTransportInProc, -} - -// Transport returns a trace attribute describing the transport protocol of the -// passed network. See the net.Dial for information about acceptable network -// values. -func Transport(network string) attribute.KeyValue { - return nc.Transport(network) -} - -// Client returns trace attributes for a client network connection to address. -// See net.Dial for information about acceptable address values, address should -// be the same as the one used to create conn. If conn is nil, only network -// peer attributes will be returned that describe address. Otherwise, the -// socket level information about conn will also be included. -func Client(address string, conn net.Conn) []attribute.KeyValue { - return nc.Client(address, conn) -} - -// Server returns trace attributes for a network listener listening at address. -// See net.Listen for information about acceptable address values, address -// should be the same as the one used to create ln. If ln is nil, only network -// host attributes will be returned that describe address. Otherwise, the -// socket level information about ln will also be included. -func Server(address string, ln net.Listener) []attribute.KeyValue { - return nc.Server(address, ln) -} From be82610b44518e2a2cd3ac734893a008a46cb40b Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 5 Jun 2023 09:51:21 +0200 Subject: [PATCH 557/886] Return noop meters once the provider has been shutdown (#4154) --- CHANGELOG.md | 1 + sdk/metric/provider.go | 16 ++++++++++++++++ sdk/metric/provider_test.go | 27 +++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da29d06d8e6..9107238356b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab ### Changed - Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049) +- `MeterProvider` returns noop meters once it has been shutdown. (#4154) ### Removed diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 716e92220d4..7063901607c 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -16,10 +16,12 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "sync/atomic" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" + "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/sdk/instrumentation" ) @@ -34,6 +36,7 @@ type MeterProvider struct { meters cache[instrumentation.Scope, *meter] forceFlush, shutdown func(context.Context) error + stopped atomic.Bool } // Compile-time check MeterProvider implements metric.MeterProvider. @@ -70,6 +73,10 @@ func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metri global.Warn("Invalid Meter name.", "name", name) } + if mp.stopped.Load() { + return noop.Meter{} + } + c := metric.NewMeterConfig(options...) s := instrumentation.Scope{ Name: name, @@ -113,6 +120,15 @@ func (mp *MeterProvider) ForceFlush(ctx context.Context) error { // // This method is safe to call concurrently. func (mp *MeterProvider) Shutdown(ctx context.Context) error { + // Even though it may seem like there is a synchronization issue between the + // call to `Store` and checking `shutdown`, the Go concurrency model ensures + // that is not the case, as all the atomic operations executed in a program + // behave as though executed in some sequentially consistent order. This + // definition provides the same semantics as C++'s sequentially consistent + // atomics and Java's volatile variables. + // See https://go.dev/ref/mem#atomic and https://pkg.go.dev/sync/atomic. + + mp.stopped.Store(true) if mp.shutdown != nil { return mp.shutdown(ctx) } diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go index a8d7434b275..5f02b130570 100644 --- a/sdk/metric/provider_test.go +++ b/sdk/metric/provider_test.go @@ -22,8 +22,10 @@ import ( "github.com/go-logr/logr/funcr" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric/noop" ) func TestMeterConcurrentSafe(t *testing.T) { @@ -57,6 +59,17 @@ func TestShutdownConcurrentSafe(t *testing.T) { _ = mp.Shutdown(context.Background()) } +func TestMeterAndShutdownConcurrentSafe(t *testing.T) { + const name = "TestMeterAndShutdownConcurrentSafe meter" + mp := NewMeterProvider() + + go func() { + _ = mp.Shutdown(context.Background()) + }() + + _ = mp.Meter(name) +} + func TestMeterDoesNotPanicForEmptyMeterProvider(t *testing.T) { mp := MeterProvider{} assert.NotPanics(t, func() { _ = mp.Meter("") }) @@ -93,3 +106,17 @@ func TestEmptyMeterName(t *testing.T) { assert.Contains(t, buf.String(), `"level"=1 "msg"="Invalid Meter name." "name"=""`) } + +func TestMeterProviderReturnsNoopMeterAfterShutdown(t *testing.T) { + mp := NewMeterProvider() + + m := mp.Meter("") + _, ok := m.(noop.Meter) + assert.False(t, ok, "Meter from running MeterProvider is NoOp") + + require.NoError(t, mp.Shutdown(context.Background())) + + m = mp.Meter("") + _, ok = m.(noop.Meter) + assert.Truef(t, ok, "Meter from shutdown MeterProvider is not NoOp: %T", m) +} From a6a916ecc612d78fe706aacdea3da27ee517da5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 5 Jun 2023 11:30:19 +0200 Subject: [PATCH 558/886] [chore] Update dependabot-pr branch name (#4191) --- .github/workflows/scripts/dependabot-pr.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scripts/dependabot-pr.sh b/.github/workflows/scripts/dependabot-pr.sh index 5904456da8a..c39b794dc26 100755 --- a/.github/workflows/scripts/dependabot-pr.sh +++ b/.github/workflows/scripts/dependabot-pr.sh @@ -17,8 +17,8 @@ git config user.name opentelemetrybot git config user.email 107717825+opentelemetrybot@users.noreply.github.com -PR_NAME=dependabot-prs/`date +'%Y-%m-%dT%H%M%S'` -git checkout -b $PR_NAME +BRANCH=dependabot/dependabot-prs/`date +'%Y-%m-%dT%H%M%S'` +git checkout -b $BRANCH IFS=$'\n' requests=($( gh pr list --search "author:app/dependabot" --json title --jq '.[].title' )) @@ -60,6 +60,6 @@ git add go.sum go.mod git add "**/go.sum" "**/go.mod" git commit -m "dependabot updates `date` $message" -git push origin $PR_NAME +git push origin $BRANCH gh pr create --title "[chore] dependabot updates `date`" --body "$message" From 135c64f2897000780febb0945d1d9db195faecc6 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 5 Jun 2023 02:41:23 -0700 Subject: [PATCH 559/886] dependabot updates Mon Jun 5 09:32:52 UTC 2023 (#4198) Bump go.opentelemetry.io/build-tools/crosslink from 0.7.0 to 0.8.0 in /internal/tools Bump go.opentelemetry.io/build-tools/dbotconf from 0.7.0 to 0.8.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.7.0 to 0.8.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.7.0 to 0.8.0 in /internal/tools Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/zipkin Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opentracing/test Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/jaeger Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/stdout/stdoutmetric Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /schema Bump github.com/itchyny/gojq from 0.12.12 to 0.12.13 in /internal/tools Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /metric Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /trace Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/prometheus Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opencensus Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /sdk/metric Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /bridge/opentracing Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 Bump github.com/stretchr/testify from 1.8.3 to 1.8.4 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +- bridge/opencensus/test/go.sum | 2 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 +- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +- example/fib/go.sum | 2 +- example/jaeger/go.sum | 2 +- example/namedtracer/go.sum | 2 +- example/opencensus/go.sum | 2 +- example/otel-collector/go.sum | 2 +- example/passthrough/go.sum | 2 +- example/prometheus/go.sum | 2 +- example/view/go.sum | 2 +- example/zipkin/go.sum | 2 +- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 +- exporters/otlp/internal/retry/go.mod | 2 +- exporters/otlp/internal/retry/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +- go.mod | 2 +- go.sum | 4 +- internal/tools/go.mod | 33 +++--- internal/tools/go.sum | 101 ++++++++---------- metric/go.mod | 2 +- metric/go.sum | 4 +- schema/go.mod | 2 +- schema/go.sum | 4 +- sdk/go.mod | 2 +- sdk/go.sum | 4 +- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +- trace/go.mod | 2 +- trace/go.sum | 4 +- 54 files changed, 134 insertions(+), 146 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 2cb6d283423..4cd3eb2c621 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/bridge/opencensus go 1.19 require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index baf4c128417..bb22501f742 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -50,8 +50,8 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 4bade740996..3e227c72a45 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -45,7 +45,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index cf9e1ff3fa0..8772e6f4ac6 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -8,7 +8,7 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 ) diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index dccf4cafd0f..a075e034330 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 3ac41b63633..b487b59fe29 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -11,7 +11,7 @@ replace go.opentelemetry.io/otel/trace => ../../../trace require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/bridge/opentracing v1.16.0 google.golang.org/grpc v1.55.0 diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 9c44b9ed205..3ff77eddd3a 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -30,8 +30,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= diff --git a/example/fib/go.sum b/example/fib/go.sum index 0b11f463640..3578f060ba4 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 6d5cd2d59e0..42e631ae371 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -7,7 +7,7 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 0b11f463640..3578f060ba4 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 4bade740996..3e227c72a45 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -45,7 +45,7 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 540866487ad..9a12b8b1099 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -147,7 +147,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 0b11f463640..3578f060ba4 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 6551c033b71..733882637ee 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -25,7 +25,7 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/example/view/go.sum b/example/view/go.sum index 6551c033b71..733882637ee 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -25,7 +25,7 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 395be7a7c95..b18c6fc5432 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -8,7 +8,7 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 05e5b0ec8df..a2e1ece810b 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 3de7ddbdd0b..76713a55844 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -16,8 +16,8 @@ github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index 308fb9aefc7..b69a6b0ed97 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 ) require ( diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum index ef627c8cbd8..987eed906b6 100644 --- a/exporters/otlp/internal/retry/go.sum +++ b/exporters/otlp/internal/retry/go.sum @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 31cd1ef827a..98a9ae0ec45 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 428bcc3c99c..780f83c6d8d 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -151,8 +151,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 1d8b08b6b21..e2e53e81dde 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,7 +5,7 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 428bcc3c99c..780f83c6d8d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -151,8 +151,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 1d86cde0b9f..b6fed6086c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,7 +5,7 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 428bcc3c99c..780f83c6d8d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -151,8 +151,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e356ee2d8ab..e1911751105 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 428bcc3c99c..780f83c6d8d 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -151,8 +151,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8b40031f2dc..3018ac9c6c0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.19 require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 6d5b5b2981d..cff02c1f0c8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -150,8 +150,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index e8c4b3b9ca5..975e53ee11c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.19 require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index b983d4ff5e2..aaf93f6ec4a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -150,8 +150,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index eb01b2c706f..38377fbfc5a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/prometheus/client_golang v1.15.1 github.com/prometheus/client_model v0.4.0 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index d985ed44d75..955f79d2e96 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -33,8 +33,8 @@ github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJf github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 49fede661db..9bf72c86601 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric go 1.19 require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index ceeaa87194d..ccd6b833b89 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -8,8 +8,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 07aecd63288..88978a2c29b 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index ceeaa87194d..ccd6b833b89 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -8,8 +8,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 2a88b49ee5c..608de1a890d 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -7,7 +7,7 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.1 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 508c49157bc..c68a987718d 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -11,8 +11,8 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/go.mod b/go.mod index fc584b1ce12..d6483834b99 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 ) diff --git a/go.sum b/go.sum index 6c95d5c31d5..d58b1a3b04c 100644 --- a/go.sum +++ b/go.sum @@ -9,8 +9,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 3f798432a91..9c058319dd7 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,13 +6,13 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.53.2 - github.com/itchyny/gojq v0.12.12 + github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.7.0 - go.opentelemetry.io/build-tools/dbotconf v0.7.0 - go.opentelemetry.io/build-tools/multimod v0.7.0 - go.opentelemetry.io/build-tools/semconvgen v0.7.0 + go.opentelemetry.io/build-tools/crosslink v0.8.0 + go.opentelemetry.io/build-tools/dbotconf v0.8.0 + go.opentelemetry.io/build-tools/multimod v0.8.0 + go.opentelemetry.io/build-tools/semconvgen v0.8.0 golang.org/x/tools v0.9.3 ) @@ -29,7 +29,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alexkohler/nakedret/v2 v2.0.1 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -61,9 +61,9 @@ require ( github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.8.1 // indirect - github.com/go-git/gcfg v1.5.0 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.6.1 // indirect + github.com/go-git/go-git/v5 v5.7.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -74,6 +74,7 @@ require ( github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect @@ -95,7 +96,7 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/imdario/mergo v0.3.13 // indirect + github.com/imdario/mergo v0.3.15 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -119,7 +120,7 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect @@ -133,7 +134,7 @@ require ( github.com/nishanths/predeclared v0.2.2 // indirect github.com/nunnatsa/ginkgolinter v0.12.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.2 // indirect @@ -158,15 +159,15 @@ require ( github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect - github.com/skeema/knownhosts v1.1.0 // indirect + github.com/skeema/knownhosts v1.1.1 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.9.3 // indirect - github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/afero v1.9.5 // indirect + github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.15.0 // indirect + github.com/spf13/viper v1.16.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.0 // indirect @@ -188,7 +189,7 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.1 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.7.0 // indirect + go.opentelemetry.io/build-tools v0.8.0 // indirect go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4cd9c37ab5d..13674e4c183 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -63,8 +63,8 @@ github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2y github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= +github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2nVAQTx5S5jQvMeDqWtD1By5mOoyY/xJek= +github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -79,9 +79,7 @@ github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cv github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= -github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/ashanbrown/forbidigo v1.5.1 h1:WXhzLjOlnuDYPYQo/eFlcFMi8X/kLfvWLYu6CSoebis= github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= @@ -137,6 +135,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= +github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -161,18 +160,15 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= -github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-critic/go-critic v0.8.1 h1:16omCF1gN3gTzt4j4J6fKI/HnRojhEp+Eks6EuKw3vw= github.com/go-critic/go-critic v0.8.1/go.mod h1:kpzXl09SIJX1cr9TB/g/sAG+eFEl7ZS9f9cqvZtyNl0= -github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= -github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= -github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= -github.com/go-git/go-git-fixtures/v4 v4.3.1 h1:y5z6dd3qi8Hl+stezc8p3JxDkoTRqMAlKnXHuzrfjTQ= -github.com/go-git/go-git-fixtures/v4 v4.3.1/go.mod h1:8LHG1a3SRW71ettAD/jW13h8c6AqjVSeL11RAdgaqpo= -github.com/go-git/go-git/v5 v5.6.1 h1:q4ZRqQl4pR/ZJHc1L5CFjGA1a10u76aV1iC+nh+bHsk= -github.com/go-git/go-git/v5 v5.6.1/go.mod h1:mvyoL6Unz0PiTQrGQfSfiLFhBH1c1e84ylC2MDs4ee8= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= +github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE= +github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -215,6 +211,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -324,19 +322,18 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= -github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itchyny/gojq v0.12.12 h1:x+xGI9BXqKoJQZkr95ibpe3cdrTbY8D9lonrK433rcA= -github.com/itchyny/gojq v0.12.12/go.mod h1:j+3sVkjxwd7A7Z5jrbKibgOLn0ZfLWkV+Awxr/pyzJE= +github.com/itchyny/gojq v0.12.13 h1:IxyYlHYIlspQHHTE0f3cJF0NKDMfajxViuhBLnHd/QU= +github.com/itchyny/gojq v0.12.13/go.mod h1:JzwzAqenfhrPUuwbmEz3nu3JQmFLlQTQMUcOdnu/Sf4= github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcchavezs/porto v0.4.0 h1:Zj7RligrxmDdKGo6fBO2xYAHxEgrVBfs1YAja20WbV4= github.com/jcchavezs/porto v0.4.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= -github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= @@ -402,8 +399,8 @@ github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwM github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= @@ -418,7 +415,6 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -444,13 +440,13 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.10.0 h1:znyI7l134wNg/wDktoVQPxPkgvhDfGCYUasey+h0rDQ= +github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= -github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -514,7 +510,6 @@ github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1 github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= github.com/securego/gosec/v2 v2.16.0 h1:Pi0JKoasQQ3NnoRao/ww/N/XdynIB9NRYYZT5CyOs5U= github.com/securego/gosec/v2 v2.16.0/go.mod h1:xvLcVZqUfo4aAQu56TNv7/Ltz6emAOQAEsrZrt7uGlI= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -533,24 +528,24 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/skeema/knownhosts v1.1.0 h1:Wvr9V0MxhjRbl3f9nMnKnFfiWTJmtECJ9Njkea3ysW0= -github.com/skeema/knownhosts v1.1.0/go.mod h1:sKFq3RD6/TKZkSWn8boUbDC7Qkgcv+8XXijpFO6roag= +github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE= +github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= -github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= +github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= +github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc= @@ -569,8 +564,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= @@ -627,16 +622,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.7.0 h1:46znGJz1mhkfzbno/O6bDk0VNgjaRdqF48GbAtkCiBg= -go.opentelemetry.io/build-tools v0.7.0/go.mod h1:l38udQkILnLAzs9ucfDT24AAWJ7otdP6wtQXcyw/TeM= -go.opentelemetry.io/build-tools/crosslink v0.7.0 h1:N7Cue57OJ+MtmBxN9HxJhy6L3xsMpBpXo/I+l76UpwY= -go.opentelemetry.io/build-tools/crosslink v0.7.0/go.mod h1:4b21YR5+5/qwGmzOwIeTKoQayCX5tlnQKDal2POYZR8= -go.opentelemetry.io/build-tools/dbotconf v0.7.0 h1:6EV61QuJGB5Xz0YyPC7V3yO+0ZGB3SLQPBq3fb1Y1mU= -go.opentelemetry.io/build-tools/dbotconf v0.7.0/go.mod h1:7HqRvzmX+8wt8xy3zwSCSWufeT8gJiWhICpzNxn93yk= -go.opentelemetry.io/build-tools/multimod v0.7.0 h1:Af1wVNaJRMVqRkiiRjeMrAfKJDejvpsLoBF9H5UrjSo= -go.opentelemetry.io/build-tools/multimod v0.7.0/go.mod h1:WAwBtJC42JbRDzfi3erCYQ9M1RnyoIcqI/H8eqBBPQo= -go.opentelemetry.io/build-tools/semconvgen v0.7.0 h1:/M2qRnBQLN1rZmZ4F220EZh1CPil9Ji+XI2REudGRII= -go.opentelemetry.io/build-tools/semconvgen v0.7.0/go.mod h1:5g2MEDQeJlvSRuleejMTkSSWUqxIjYhwOKJnDzl/cdM= +go.opentelemetry.io/build-tools v0.8.0 h1:1CrmKOX/LEFwFOEyb0rBMQZchlKhoq3hveYrcA0Z87U= +go.opentelemetry.io/build-tools v0.8.0/go.mod h1:7NXCadpOTmjE97sdxQehCtGtwrmd4HFR6HNq5YJfYjw= +go.opentelemetry.io/build-tools/crosslink v0.8.0 h1:rYpcYwNX4//WbSvwHCiCPCczh9u+lYHLezrl9865nFA= +go.opentelemetry.io/build-tools/crosslink v0.8.0/go.mod h1:rWAN3EQ4rJn5ewknqw/0CkfkU4t7toCAtkl5q7VZP/M= +go.opentelemetry.io/build-tools/dbotconf v0.8.0 h1:akIDE+IpOhyNz3ycrmULwDepst8IVvi6U8tBEXz4mCQ= +go.opentelemetry.io/build-tools/dbotconf v0.8.0/go.mod h1:/97WQXoQFjQT5QjSeLksWshqjqMeKsGHn8o3+KvF0jE= +go.opentelemetry.io/build-tools/multimod v0.8.0 h1:6MARVCyZa5Tdn8KvRbSZzS7ypxB1gTrvLdeimCiBZSo= +go.opentelemetry.io/build-tools/multimod v0.8.0/go.mod h1:aPgW8qbcE6IoLge1LUKO5yo4XmnxsPIA+cdFjn93QrI= +go.opentelemetry.io/build-tools/semconvgen v0.8.0 h1:vRAmN8CxZk9gQuzftkfmud1qLdWoCfeX0JG7zAc/LzI= +go.opentelemetry.io/build-tools/semconvgen v0.8.0/go.mod h1:h0FPWeTZw4sfjNhfFdN3mMdbJfzI0XCaD+wTWe1r0xc= go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= @@ -646,7 +641,6 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -655,12 +649,10 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -749,13 +741,12 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -823,7 +814,6 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -838,25 +828,24 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -870,6 +859,7 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1048,7 +1038,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1064,7 +1053,6 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1085,6 +1073,5 @@ mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jC mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/metric/go.mod b/metric/go.mod index b19b81e8149..cf27a3f4dfa 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/metric go 1.19 require ( - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 ) diff --git a/metric/go.sum b/metric/go.sum index 927e0a54c64..cc053d286a4 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -8,8 +8,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/schema/go.mod b/schema/go.mod index c581b8a6195..674b0067f47 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/Masterminds/semver/v3 v3.2.1 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/schema/go.sum b/schema/go.sum index 1fbc93560a2..f9c91c9cccd 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -4,8 +4,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/sdk/go.mod b/sdk/go.mod index 062b9a53aa0..722872bb45f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 golang.org/x/sys v0.8.0 diff --git a/sdk/go.sum b/sdk/go.sum index a59b49ccf87..cf7c2a533c7 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -9,8 +9,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index cb56b130a49..56e6f9285e2 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index ceeaa87194d..ccd6b833b89 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -8,8 +8,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/trace/go.mod b/trace/go.mod index acd3b31f864..9b6953dcb8f 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 ) diff --git a/trace/go.sum b/trace/go.sum index e94bb32ad91..6b8b46ca828 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -4,8 +4,8 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From ce46eb5f85cddb5ace600b339f16a7949899b321 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 6 Jun 2023 15:22:34 -0700 Subject: [PATCH 560/886] Warn instead of Info log instrument conflict (#4202) * Warn instead of Info log instrument conflict * Add change to changelog --- CHANGELOG.md | 1 + sdk/metric/pipeline.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9107238356b..e4a64611c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) +- Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 22341c61046..4190f1496ee 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -354,7 +354,7 @@ func (i *inserter[N]) logConflict(id streamID) { return } - global.Info( + global.Warn( "duplicate metric stream definitions", "names", fmt.Sprintf("%q, %q", existing.Name, id.Name), "descriptions", fmt.Sprintf("%q, %q", existing.Description, id.Description), From 93a5ba131b95ebeb56cbf766958ee7281baaa9a2 Mon Sep 17 00:00:00 2001 From: Severin Neumann Date: Wed, 7 Jun 2023 16:14:32 +0200 Subject: [PATCH 561/886] Common weights for go pages (#4211) --- website_docs/api.md | 2 +- website_docs/examples.md | 2 +- website_docs/exporters.md | 2 +- website_docs/getting-started.md | 2 +- website_docs/libraries.md | 2 +- website_docs/manual.md | 2 +- website_docs/resources.md | 2 +- website_docs/sampling.md | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/website_docs/api.md b/website_docs/api.md index dc29c312b93..9bdbc6b534e 100644 --- a/website_docs/api.md +++ b/website_docs/api.md @@ -4,5 +4,5 @@ linkTitle: API redirect: https://pkg.go.dev/go.opentelemetry.io/otel manualLinkTarget: _blank _build: { render: link } -weight: 50 +weight: 210 --- diff --git a/website_docs/examples.md b/website_docs/examples.md index ff0ea28b1aa..05db2e28319 100644 --- a/website_docs/examples.md +++ b/website_docs/examples.md @@ -3,5 +3,5 @@ title: Examples redirect: https://github.com/open-telemetry/opentelemetry-go/tree/main/example manualLinkTarget: _blank _build: { render: link } -weight: 60 +weight: 220 --- diff --git a/website_docs/exporters.md b/website_docs/exporters.md index 40659f91b71..64df5d03423 100644 --- a/website_docs/exporters.md +++ b/website_docs/exporters.md @@ -1,7 +1,7 @@ --- title: Exporters aliases: [/docs/instrumentation/go/exporting_data] -weight: 4 +weight: 50 --- In order to visualize and analyze your [traces](/docs/concepts/signals/traces/) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md index e415380b866..6cf5c28e4d9 100644 --- a/website_docs/getting-started.md +++ b/website_docs/getting-started.md @@ -1,6 +1,6 @@ --- title: Getting Started -weight: 2 +weight: 10 --- Welcome to the OpenTelemetry for Go getting started guide! This guide will walk diff --git a/website_docs/libraries.md b/website_docs/libraries.md index a441bf51b7a..8a3ff012956 100644 --- a/website_docs/libraries.md +++ b/website_docs/libraries.md @@ -4,7 +4,7 @@ linkTitle: Libraries aliases: - /docs/instrumentation/go/using_instrumentation_libraries - /docs/instrumentation/go/automatic_instrumentation -weight: 3 +weight: 40 --- Go does not support truly automatic instrumentation like other languages today. diff --git a/website_docs/manual.md b/website_docs/manual.md index ec77577430c..c88ad68bc45 100644 --- a/website_docs/manual.md +++ b/website_docs/manual.md @@ -4,7 +4,7 @@ linkTitle: Manual aliases: - /docs/instrumentation/go/instrumentation - /docs/instrumentation/go/manual_instrumentation -weight: 3 +weight: 30 --- Instrumentation is the process of adding observability code to your application. diff --git a/website_docs/resources.md b/website_docs/resources.md index 014cb8ee60e..5e830fdb30b 100644 --- a/website_docs/resources.md +++ b/website_docs/resources.md @@ -1,6 +1,6 @@ --- title: Resources -weight: 6 +weight: 70 --- Resources are a special type of attribute that apply to all spans generated by a diff --git a/website_docs/sampling.md b/website_docs/sampling.md index fc38cd31567..296ea25f8fc 100644 --- a/website_docs/sampling.md +++ b/website_docs/sampling.md @@ -1,6 +1,6 @@ --- title: Sampling -weight: 8 +weight: 80 --- Sampling is a process that restricts the amount of traces that are generated by From e7ff6a36dcad42a0e9fd7858ff7c98711b96831b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 8 Jun 2023 08:57:18 -0700 Subject: [PATCH 562/886] Upgrade go.opentelemetry.io/proto/otlp to v0.20.0 (#4213) --- example/otel-collector/go.mod | 11 +- example/otel-collector/go.sum | 417 +---------------- exporters/otlp/otlpmetric/go.mod | 13 +- exporters/otlp/otlpmetric/go.sum | 425 +----------------- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 11 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 422 +---------------- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 11 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 422 +---------------- exporters/otlp/otlptrace/go.mod | 13 +- exporters/otlp/otlptrace/go.sum | 425 +----------------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 11 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 422 +---------------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 11 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 422 +---------------- 14 files changed, 167 insertions(+), 2869 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 5482940da15..6d2c7f8178b 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -20,15 +20,16 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/proto/otlp v0.19.0 // indirect - golang.org/x/net v0.8.0 // indirect + go.opentelemetry.io/proto/otlp v0.20.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 9a12b8b1099..4bbd4f41745 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -1,431 +1,40 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 98a9ae0ec45..67b0b07c442 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.19.0 + go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -20,14 +20,17 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 780f83c6d8d..c17142f7bc4 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -1,437 +1,52 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e2e53e81dde..472bfec01a0 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.19.0 - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + go.opentelemetry.io/proto/otlp v0.20.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -23,14 +23,15 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 780f83c6d8d..9d9f8d006ad 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -1,437 +1,49 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b6fed6086c7..67c85a4c534 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.19.0 + go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/protobuf v1.30.0 ) @@ -21,15 +21,16 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 780f83c6d8d..9d9f8d006ad 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -1,437 +1,49 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e1911751105..cff15ed48a7 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - go.opentelemetry.io/proto/otlp v0.19.0 + go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -20,13 +20,16 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 780f83c6d8d..c17142f7bc4 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -1,437 +1,52 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 3018ac9c6c0..4c103ec873e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,9 +8,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/proto/otlp v0.19.0 + go.opentelemetry.io/proto/otlp v0.20.0 go.uber.org/goleak v1.2.1 - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.55.0 google.golang.org/protobuf v1.30.0 ) @@ -21,13 +21,14 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index cff02c1f0c8..a95e465743d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -1,438 +1,50 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 975e53ee11c..c9e78e8d2df 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - go.opentelemetry.io/proto/otlp v0.19.0 + go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/protobuf v1.30.0 ) @@ -19,13 +19,14 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/grpc v1.55.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index aaf93f6ec4a..56e002b6b0e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -1,436 +1,48 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= +go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 4f4815406aff7889cee8b93396ac373e9240fe55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 8 Jun 2023 21:29:39 +0200 Subject: [PATCH 563/886] [chore] Add go-work Make target (#4199) Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 4486274a1b5..dc22bb77cb5 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,11 @@ go-generate/%: | $(STRINGER) vanity-import-fix: | $(PORTO) @$(PORTO) --include-internal -w . +# Generate go.work file for local development. +.PHONY: go-work +go-work: | $(CROSSLINK) + $(CROSSLINK) work --root=$(shell pwd) + # Build .PHONY: build From 844b107e980ab1bd00ec2958ef735c4370a0c263 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Fri, 9 Jun 2023 17:32:56 +0200 Subject: [PATCH 564/886] Validate instrument names when creating them (#4210) * validate instrument names when creating them * add changelog entry * remove now invalid instrument name from prometheus test * fix invalid names in meter_test * keep returning the instrument even if its name is invalid * make invalid instrument name a known error * bring back prometheus invalid instrument name test * remove warning * fix lint * move name validation into the lookup method * fix lint again * Revert "move name validation into the lookup method" This reverts commit ec8ccc5fa00b84f24b63e48714672a8ee8e3e5d2. * rename ErrInvalidInstrumentName to ErrInstrumentName * switch to explicit validations, instead of a regexp * Update CHANGELOG.md Co-authored-by: Tyler Yahn * remove double check for empty name * test validation shortcut with a single character --------- Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + exporters/prometheus/exporter_test.go | 2 +- sdk/metric/meter.go | 87 ++++++- sdk/metric/meter_test.go | 316 +++++++++++++++++++++++++- 4 files changed, 387 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4a64611c0b..798af635a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) - Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) +- Return an error on the creation of new instruments if their name doesn't pass regexp validation. (#4210) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index db438de9d40..3f014971dc1 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -154,7 +154,7 @@ func TestPrometheusExporter(t *testing.T) { gauge.Add(ctx, 100, opt) counter, err := meter.Float64Counter("0invalid.counter.name", otelmetric.WithDescription("a counter with an invalid name")) - require.NoError(t, err) + require.ErrorIs(t, err, metric.ErrInstrumentName) counter.Add(ctx, 100, opt) histogram, err := meter.Float64Histogram("invalid.hist.name", otelmetric.WithDescription("a histogram with an invalid name")) diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index d833bab40e8..81f0b2f0bd7 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -26,6 +26,12 @@ import ( "go.opentelemetry.io/otel/sdk/metric/internal" ) +var ( + // ErrInstrumentName indicates the created instrument has an invalid name. + // Valid names must consist of 63 or fewer characters including alphanumeric, _, ., -, and start with a letter. + ErrInstrumentName = errors.New("invalid instrument name") +) + // meter handles the creation and coordination of all metric instruments. A // meter represents a single instrumentation scope; all metric telemetry // produced by an instrumentation scope will use metric instruments from a @@ -62,7 +68,12 @@ var _ metric.Meter = (*meter)(nil) func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { cfg := metric.NewInt64CounterConfig(options...) const kind = InstrumentKindCounter - return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Int64UpDownCounter returns a new instrument identified by name and @@ -71,7 +82,12 @@ func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { cfg := metric.NewInt64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter - return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Int64Histogram returns a new instrument identified by name and configured @@ -80,7 +96,12 @@ func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCou func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { cfg := metric.NewInt64HistogramConfig(options...) const kind = InstrumentKindHistogram - return m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Int64ObservableCounter returns a new instrument identified by name and @@ -95,7 +116,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64Obser return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) } // Int64ObservableUpDownCounter returns a new instrument identified by name and @@ -110,7 +131,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int6 return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) } // Int64ObservableGauge returns a new instrument identified by name and @@ -125,7 +146,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64Observa return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) } // Float64Counter returns a new instrument identified by name and configured @@ -134,7 +155,12 @@ func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64Observa func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { cfg := metric.NewFloat64CounterConfig(options...) const kind = InstrumentKindCounter - return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Float64UpDownCounter returns a new instrument identified by name and @@ -143,7 +169,12 @@ func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOpti func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { cfg := metric.NewFloat64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter - return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Float64Histogram returns a new instrument identified by name and configured @@ -152,7 +183,12 @@ func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDow func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { cfg := metric.NewFloat64HistogramConfig(options...) const kind = InstrumentKindHistogram - return m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + if err != nil { + return i, err + } + + return i, validateInstrumentName(name) } // Float64ObservableCounter returns a new instrument identified by name and @@ -167,7 +203,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64O return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) } // Float64ObservableUpDownCounter returns a new instrument identified by name @@ -182,7 +218,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Fl return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) } // Float64ObservableGauge returns a new instrument identified by name and @@ -197,7 +233,34 @@ func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64Obs return nil, err } p.registerCallbacks(inst, cfg.Callbacks()) - return inst, nil + return inst, validateInstrumentName(name) +} + +func validateInstrumentName(name string) error { + if len(name) == 0 { + return fmt.Errorf("%w: %s: is empty", ErrInstrumentName, name) + } + if len(name) > 63 { + return fmt.Errorf("%w: %s: longer than 63 characters", ErrInstrumentName, name) + } + if !isAlpha([]rune(name)[0]) { + return fmt.Errorf("%w: %s: must start with a letter", ErrInstrumentName, name) + } + if len(name) == 1 { + return nil + } + for _, c := range name[1:] { + if !isAlphanumeric(c) && c != '_' && c != '.' && c != '-' { + return fmt.Errorf("%w: %s: must only contain [A-Za-z0-9_.-]", ErrInstrumentName, name) + } + } + return nil +} +func isAlpha(c rune) bool { + return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') +} +func isAlphanumeric(c rune) bool { + return isAlpha(c) || ('0' <= c && c <= '9') } // RegisterCallback registers f to be called each collection cycle so it will diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 56ee1fa64d6..4fea8fccf90 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -483,6 +483,310 @@ func TestMeterCreatesInstruments(t *testing.T) { } } +func TestMeterCreatesInstrumentsValidations(t *testing.T) { + testCases := []struct { + name string + fn func(*testing.T, metric.Meter) error + + wantErr error + }{ + { + name: "Int64Counter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64Counter("counter") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64Counter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64Counter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Int64UpDownCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64UpDownCounter("upDownCounter") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64UpDownCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64UpDownCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Int64Histogram with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64Histogram("histogram") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64Histogram with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64Histogram("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Int64ObservableCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableCounter("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64ObservableCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Int64ObservableUpDownCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableUpDownCounter("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64ObservableUpDownCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableUpDownCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Int64ObservableGauge with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableGauge("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Int64ObservableGauge with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableGauge("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64Counter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64Counter("counter") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64Counter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64Counter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64UpDownCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64UpDownCounter("upDownCounter") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64UpDownCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64UpDownCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64Histogram with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64Histogram("histogram") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64Histogram with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64Histogram("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64ObservableCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64ObservableCounter("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64ObservableCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64ObservableCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64ObservableUpDownCounter with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64ObservableUpDownCounter("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64ObservableUpDownCounter with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64ObservableUpDownCounter("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + { + name: "Float64ObservableGauge with no validation issues", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64ObservableGauge("aint") + assert.NotNil(t, i) + return err + }, + }, + { + name: "Float64ObservableGauge with an invalid name", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64ObservableGauge("_") + assert.NotNil(t, i) + return err + }, + + wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + m := NewMeterProvider().Meter("testInstruments") + err := tt.fn(t, m) + assert.Equal(t, err, tt.wantErr) + }) + } +} + +func TestValidateInstrumentName(t *testing.T) { + testCases := []struct { + name string + + wantErr error + }{ + { + name: "", + wantErr: fmt.Errorf("%w: : is empty", ErrInstrumentName), + }, + { + name: "1", + wantErr: fmt.Errorf("%w: 1: must start with a letter", ErrInstrumentName), + }, + { + name: "a", + }, + { + name: "n4me", + }, + { + name: "n-me", + }, + { + name: "na_e", + }, + { + name: "nam.", + }, + { + name: "name!", + wantErr: fmt.Errorf("%w: name!: must only contain [A-Za-z0-9_.-]", ErrInstrumentName), + }, + { + name: "someverylongnamewhichisover63charactersbutallofwhichmatchtheregexp", + wantErr: fmt.Errorf("%w: someverylongnamewhichisover63charactersbutallofwhichmatchtheregexp: longer than 63 characters", ErrInstrumentName), + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.wantErr, validateInstrumentName(tt.name)) + }) + } +} + func TestRegisterNonSDKObserverErrors(t *testing.T) { rdr := NewManualReader() mp := NewMeterProvider(WithReader(rdr)) @@ -509,9 +813,9 @@ func TestMeterMixingOnRegisterErrors(t *testing.T) { m1 := mp.Meter("scope1") m2 := mp.Meter("scope2") - iCtr, err := m2.Int64ObservableCounter("int64 ctr") + iCtr, err := m2.Int64ObservableCounter("int64ctr") require.NoError(t, err) - fCtr, err := m2.Float64ObservableCounter("float64 ctr") + fCtr, err := m2.Float64ObservableCounter("float64ctr") require.NoError(t, err) _, err = m1.RegisterCallback( func(context.Context, metric.Observer) error { return nil }, @@ -520,13 +824,13 @@ func TestMeterMixingOnRegisterErrors(t *testing.T) { assert.ErrorContains( t, err, - `invalid registration: observable "int64 ctr" from Meter "scope2", registered with Meter "scope1"`, + `invalid registration: observable "int64ctr" from Meter "scope2", registered with Meter "scope1"`, "Instrument registered with non-creation Meter", ) assert.ErrorContains( t, err, - `invalid registration: observable "float64 ctr" from Meter "scope2", registered with Meter "scope1"`, + `invalid registration: observable "float64ctr" from Meter "scope2", registered with Meter "scope1"`, "Instrument registered with non-creation Meter", ) } @@ -540,9 +844,9 @@ func TestCallbackObserverNonRegistered(t *testing.T) { require.NoError(t, err) m2 := mp.Meter("scope2") - iCtr, err := m2.Int64ObservableCounter("int64 ctr") + iCtr, err := m2.Int64ObservableCounter("int64ctr") require.NoError(t, err) - fCtr, err := m2.Float64ObservableCounter("float64 ctr") + fCtr, err := m2.Float64ObservableCounter("float64ctr") require.NoError(t, err) type int64Obsrv struct{ metric.Int64Observable } From b757c7083baeece1be36caa4b1c102a3ddcdfa4b Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 14 Jun 2023 09:36:13 -0500 Subject: [PATCH 565/886] Exponential Histogram Datatypes (#4165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds the Exponential histogram data type. * Changelog * Updated comments * Apply suggestions from code review Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn * Split Exponential Buckets into it's own type --------- Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/metric/metricdata/data.go | 68 +++++++ .../metricdata/metricdatatest/assertion.go | 27 ++- .../metricdatatest/assertion_test.go | 174 ++++++++++++++++++ .../metricdata/metricdatatest/comparisons.go | 138 ++++++++++++++ 5 files changed, 407 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 798af635a9e..e68d9fc0534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848) - The `go.opentelemetry.io/otel/semconv/v1.20.0` package. The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) +- The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) ### Changed diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index 1e32f5eeb02..49bbc0414a2 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -137,6 +137,74 @@ type HistogramDataPoint[N int64 | float64] struct { Exemplars []Exemplar[N] `json:",omitempty"` } +// ExponentialHistogram represents the histogram of all measurements of values from an instrument. +type ExponentialHistogram[N int64 | float64] struct { + // DataPoints are the individual aggregated measurements with unique + // attributes. + DataPoints []ExponentialHistogramDataPoint[N] + // Temporality describes if the aggregation is reported as the change from the + // last report time, or the cumulative changes since a fixed start time. + Temporality Temporality +} + +func (ExponentialHistogram[N]) privateAggregation() {} + +// ExponentialHistogramDataPoint is a single exponential histogram data point in a timeseries. +type ExponentialHistogramDataPoint[N int64 | float64] struct { + // Attributes is the set of key value pairs that uniquely identify the + // timeseries. + Attributes attribute.Set + // StartTime is when the timeseries was started. + StartTime time.Time + // Time is the time when the timeseries was recorded. + Time time.Time + + // Count is the number of updates this histogram has been calculated with. + Count uint64 + // Min is the minimum value recorded. (optional) + Min Extrema[N] + // Max is the maximum value recorded. (optional) + Max Extrema[N] + // Sum is the sum of the values recorded. + Sum N + + // Scale describes the resolution of the histogram. Boundaries are + // located at powers of the base, where: + // + // base = 2 ^ (2 ^ -Scale) + Scale int32 + // ZeroCount is the number of values whose absolute value + // is less than or equal to [ZeroThreshold]. + // When ZeroThreshold is 0, this is the number of values that + // cannot be expressed using the standard exponential formula + // as well as values that have been rounded to zero. + // ZeroCount represents the special zero count bucket. + ZeroCount uint64 + + // PositiveBucket is range of positive value bucket counts. + PositiveBucket ExponentialBucket + // NegativeBucket is range of negative value bucket counts. + NegativeBucket ExponentialBucket + + // ZeroThreshold is the width of the zero region. Where the zero region is + // defined as the closed interval [-ZeroThreshold, ZeroThreshold]. + ZeroThreshold float64 + + // Exemplars is the sampled Exemplars collected during the timeseries. + Exemplars []Exemplar[N] `json:",omitempty"` +} + +// ExponentialBucket are a set of bucket counts, encoded in a contiguous array +// of counts. +type ExponentialBucket struct { + // Offset is the bucket index of the first entry in the Counts slice. + Offset int32 + // Counts is an slice where Counts[i] carries the count of the bucket at + // index (Offset+i). Counts[i] is the count of values greater than + // base^(Offset+i) and less than or equal to base^(Offset+i+1). + Counts []uint64 +} + // Extrema is the minimum or maximum value of a dataset. type Extrema[N int64 | float64] struct { value N diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index 08bac5131fe..f559a6432e8 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -42,7 +42,12 @@ type Datatypes interface { metricdata.Sum[float64] | metricdata.Sum[int64] | metricdata.Exemplar[float64] | - metricdata.Exemplar[int64] + metricdata.Exemplar[int64] | + metricdata.ExponentialHistogram[float64] | + metricdata.ExponentialHistogram[int64] | + metricdata.ExponentialHistogramDataPoint[float64] | + metricdata.ExponentialHistogramDataPoint[int64] | + metricdata.ExponentialBucket // Interface types are not allowed in union types, therefore the // Aggregation and Value type from metricdata are not included here. @@ -134,6 +139,16 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) r = equalSums(e, aIface.(metricdata.Sum[int64]), cfg) case metricdata.Sum[float64]: r = equalSums(e, aIface.(metricdata.Sum[float64]), cfg) + case metricdata.ExponentialHistogram[float64]: + r = equalExponentialHistograms(e, aIface.(metricdata.ExponentialHistogram[float64]), cfg) + case metricdata.ExponentialHistogram[int64]: + r = equalExponentialHistograms(e, aIface.(metricdata.ExponentialHistogram[int64]), cfg) + case metricdata.ExponentialHistogramDataPoint[float64]: + r = equalExponentialHistogramDataPoints(e, aIface.(metricdata.ExponentialHistogramDataPoint[float64]), cfg) + case metricdata.ExponentialHistogramDataPoint[int64]: + r = equalExponentialHistogramDataPoints(e, aIface.(metricdata.ExponentialHistogramDataPoint[int64]), cfg) + case metricdata.ExponentialBucket: + r = equalExponentialBuckets(e, aIface.(metricdata.ExponentialBucket), cfg) default: // We control all types passed to this, panic to signal developers // early they changed things in an incompatible way. @@ -198,6 +213,16 @@ func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute reasons = hasAttributesScopeMetrics(e, attrs...) case metricdata.ResourceMetrics: reasons = hasAttributesResourceMetrics(e, attrs...) + case metricdata.ExponentialHistogram[int64]: + reasons = hasAttributesExponentialHistogram(e, attrs...) + case metricdata.ExponentialHistogram[float64]: + reasons = hasAttributesExponentialHistogram(e, attrs...) + case metricdata.ExponentialHistogramDataPoint[int64]: + reasons = hasAttributesExponentialHistogramDataPoints(e, attrs...) + case metricdata.ExponentialHistogramDataPoint[float64]: + reasons = hasAttributesExponentialHistogramDataPoints(e, attrs...) + case metricdata.ExponentialBucket: + // Nothing to check. default: // We control all types passed to this, panic to signal developers // early they changed things in an incompatible way. diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 6ad40ebf1b2..3b9d8d6daa1 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -205,6 +205,103 @@ var ( Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } + exponentialBucket2 = metricdata.ExponentialBucket{ + Offset: 2, + Counts: []uint64{1, 1}, + } + exponentialBucket3 = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{1, 1}, + } + exponentialBucket4 = metricdata.ExponentialBucket{ + Offset: 4, + Counts: []uint64{1, 1, 1}, + } + exponentialBucket5 = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{1, 1, 1}, + } + exponentialHistogramDataPointInt64A = metricdata.ExponentialHistogramDataPoint[int64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 5, + Min: minInt64A, + Sum: 2, + Scale: 1, + ZeroCount: 1, + PositiveBucket: exponentialBucket3, + NegativeBucket: exponentialBucket2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + } + exponentialHistogramDataPointFloat64A = metricdata.ExponentialHistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 5, + Min: minFloat64A, + Sum: 2, + Scale: 1, + ZeroCount: 1, + PositiveBucket: exponentialBucket3, + NegativeBucket: exponentialBucket2, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + } + exponentialHistogramDataPointInt64B = metricdata.ExponentialHistogramDataPoint[int64]{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Count: 6, + Min: minInt64B, + Max: maxInt64B, + Sum: 3, + Scale: 2, + ZeroCount: 3, + PositiveBucket: exponentialBucket4, + NegativeBucket: exponentialBucket5, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, + } + exponentialHistogramDataPointFloat64B = metricdata.ExponentialHistogramDataPoint[float64]{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Count: 6, + Min: minFloat64B, + Max: maxFloat64B, + Sum: 3, + Scale: 2, + ZeroCount: 3, + PositiveBucket: exponentialBucket4, + NegativeBucket: exponentialBucket5, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + } + exponentialHistogramDataPointInt64C = metricdata.ExponentialHistogramDataPoint[int64]{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Count: 5, + Min: minInt64C, + Sum: 2, + Scale: 1, + ZeroCount: 1, + PositiveBucket: exponentialBucket3, + NegativeBucket: exponentialBucket2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, + } + exponentialHistogramDataPointFloat64C = metricdata.ExponentialHistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Count: 5, + Min: minFloat64A, + Sum: 2, + Scale: 1, + ZeroCount: 1, + PositiveBucket: exponentialBucket3, + NegativeBucket: exponentialBucket2, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, + } + gaugeInt64A = metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, } @@ -280,6 +377,31 @@ var ( DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64C}, } + exponentialHistogramInt64A = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64A}, + } + exponentialHistogramFloat64A = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64A}, + } + exponentialHistogramInt64B = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64B}, + } + exponentialHistogramFloat64B = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64B}, + } + exponentialHistogramInt64C = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64C}, + } + exponentialHistogramFloat64C = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64C}, + } + metricsA = metricdata.Metrics{ Name: "A", Description: "A desc", @@ -378,6 +500,11 @@ func TestAssertEqual(t *testing.T) { t.Run("ExtremaFloat64", testDatatype(minFloat64A, minFloat64B, equalExtrema[float64])) t.Run("ExemplarInt64", testDatatype(exemplarInt64A, exemplarInt64B, equalExemplars[int64])) t.Run("ExemplarFloat64", testDatatype(exemplarFloat64A, exemplarFloat64B, equalExemplars[float64])) + t.Run("ExponentialHistogramInt64", testDatatype(exponentialHistogramInt64A, exponentialHistogramInt64B, equalExponentialHistograms[int64])) + t.Run("ExponentialHistogramFloat64", testDatatype(exponentialHistogramFloat64A, exponentialHistogramFloat64B, equalExponentialHistograms[float64])) + t.Run("ExponentialHistogramDataPointInt64", testDatatype(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64B, equalExponentialHistogramDataPoints[int64])) + t.Run("ExponentialHistogramDataPointFloat64", testDatatype(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64B, equalExponentialHistogramDataPoints[float64])) + t.Run("ExponentialBuckets", testDatatype(exponentialBucket2, exponentialBucket3, equalExponentialBuckets)) } func TestAssertEqualIgnoreTime(t *testing.T) { @@ -398,6 +525,10 @@ func TestAssertEqualIgnoreTime(t *testing.T) { t.Run("ExtremaFloat64", testDatatypeIgnoreTime(minFloat64A, minFloat64C, equalExtrema[float64])) t.Run("ExemplarInt64", testDatatypeIgnoreTime(exemplarInt64A, exemplarInt64C, equalExemplars[int64])) t.Run("ExemplarFloat64", testDatatypeIgnoreTime(exemplarFloat64A, exemplarFloat64C, equalExemplars[float64])) + t.Run("ExponentialHistogramInt64", testDatatypeIgnoreTime(exponentialHistogramInt64A, exponentialHistogramInt64C, equalExponentialHistograms[int64])) + t.Run("ExponentialHistogramFloat64", testDatatypeIgnoreTime(exponentialHistogramFloat64A, exponentialHistogramFloat64C, equalExponentialHistograms[float64])) + t.Run("ExponentialHistogramDataPointInt64", testDatatypeIgnoreTime(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64C, equalExponentialHistogramDataPoints[int64])) + t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreTime(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64C, equalExponentialHistogramDataPoints[float64])) } func TestAssertEqualIgnoreExemplars(t *testing.T) { @@ -416,6 +547,14 @@ func TestAssertEqualIgnoreExemplars(t *testing.T) { dpFloat64 := dataPointFloat64A dpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} t.Run("DataPointFloat64", testDatatypeIgnoreExemplars(dataPointFloat64A, dpFloat64, equalDataPoints[float64])) + + ehdpInt64 := exponentialHistogramDataPointInt64A + ehdpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} + t.Run("ExponentialHistogramDataPointInt64", testDatatypeIgnoreExemplars(exponentialHistogramDataPointInt64A, ehdpInt64, equalExponentialHistogramDataPoints[int64])) + + ehdpFloat64 := exponentialHistogramDataPointFloat64A + ehdpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} + t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreExemplars(exponentialHistogramDataPointFloat64A, ehdpFloat64, equalExponentialHistogramDataPoints[float64])) } type unknownAggregation struct { @@ -430,6 +569,8 @@ func TestAssertAggregationsEqual(t *testing.T) { AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64A) AssertAggregationsEqual(t, histogramInt64A, histogramInt64A) AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64A) + AssertAggregationsEqual(t, exponentialHistogramInt64A, exponentialHistogramInt64A) + AssertAggregationsEqual(t, exponentialHistogramFloat64A, exponentialHistogramFloat64A) r := equalAggregations(sumInt64A, nil, config{}) assert.Len(t, r, 1, "should return nil comparison mismatch only") @@ -475,6 +616,18 @@ func TestAssertAggregationsEqual(t *testing.T) { r = equalAggregations(histogramFloat64A, histogramFloat64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "histograms should be equal: %v", r) + + r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64B, config{}) + assert.Greaterf(t, len(r), 0, "exponential histograms should not be equal: %v == %v", exponentialHistogramInt64A, exponentialHistogramInt64B) + + r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64C, config{ignoreTimestamp: true}) + assert.Len(t, r, 0, "exponential histograms should be equal: %v", r) + + r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64B, config{}) + assert.Greaterf(t, len(r), 0, "exponential histograms should not be equal: %v == %v", exponentialHistogramFloat64A, exponentialHistogramFloat64B) + + r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64C, config{ignoreTimestamp: true}) + assert.Len(t, r, 0, "exponential histograms should be equal: %v", r) } func TestAssertAttributes(t *testing.T) { @@ -494,6 +647,11 @@ func TestAssertAttributes(t *testing.T) { AssertHasAttributes(t, metricsA, attribute.Bool("A", true)) AssertHasAttributes(t, scopeMetricsA, attribute.Bool("A", true)) AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", true)) + AssertHasAttributes(t, exponentialHistogramDataPointInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, exponentialHistogramDataPointFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, exponentialHistogramInt64A, attribute.Bool("A", true)) + AssertHasAttributes(t, exponentialHistogramFloat64A, attribute.Bool("A", true)) + AssertHasAttributes(t, exponentialBucket2, attribute.Bool("A", true)) // No-op, always pass. r := hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", true)) assert.Equal(t, len(r), 0, "gaugeInt64A has A=True") @@ -507,6 +665,10 @@ func TestAssertAttributes(t *testing.T) { assert.Equal(t, len(r), 0, "histogramInt64A has A=True") r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", true)) assert.Equal(t, len(r), 0, "histogramFloat64A has A=True") + r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "exponentialHistogramInt64A has A=True") + r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "exponentialHistogramFloat64A has A=True") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have A=False") @@ -520,6 +682,10 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "histogramInt64A does not have A=False") r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "histogramFloat64A does not have A=False") + r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "exponentialHistogramInt64A does not have A=False") + r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "exponentialHistogramFloat64A does not have A=False") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have Attribute B") @@ -533,6 +699,10 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "histogramIntA does not have Attribute B") r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "histogramFloatA does not have Attribute B") + r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "exponentialHistogramIntA does not have Attribute B") + r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "exponentialHistogramFloatA does not have Attribute B") } func TestAssertAttributesFail(t *testing.T) { @@ -553,6 +723,10 @@ func TestAssertAttributesFail(t *testing.T) { assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramDataPointInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramDataPointFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramInt64A, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramFloat64A, attribute.Bool("B", true))) sum := metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index b3ec710e933..4bb3b19fb0b 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -143,6 +143,18 @@ func equalAggregations(a, b metricdata.Aggregation, cfg config) (reasons []strin reasons = append(reasons, "Histogram not equal:") reasons = append(reasons, r...) } + case metricdata.ExponentialHistogram[int64]: + r := equalExponentialHistograms(v, b.(metricdata.ExponentialHistogram[int64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "ExponentialHistogram not equal:") + reasons = append(reasons, r...) + } + case metricdata.ExponentialHistogram[float64]: + r := equalExponentialHistograms(v, b.(metricdata.ExponentialHistogram[float64]), cfg) + if len(r) > 0 { + reasons = append(reasons, "ExponentialHistogram not equal:") + reasons = append(reasons, r...) + } default: reasons = append(reasons, fmt.Sprintf("Aggregation of unknown types %T", a)) } @@ -312,6 +324,103 @@ func equalHistogramDataPoints[N int64 | float64](a, b metricdata.HistogramDataPo return reasons } +// equalExponentialHistograms returns reasons exponential Histograms are not equal. If they are +// equal, the returned reasons will be empty. +// +// The DataPoints each Histogram contains are compared based on containing the +// same HistogramDataPoint, not the order they are stored in. +func equalExponentialHistograms[N int64 | float64](a, b metricdata.ExponentialHistogram[N], cfg config) (reasons []string) { + if a.Temporality != b.Temporality { + reasons = append(reasons, notEqualStr("Temporality", a.Temporality, b.Temporality)) + } + + r := compareDiff(diffSlices( + a.DataPoints, + b.DataPoints, + func(a, b metricdata.ExponentialHistogramDataPoint[N]) bool { + r := equalExponentialHistogramDataPoints(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Histogram DataPoints not equal:\n%s", r)) + } + return reasons +} + +// equalExponentialHistogramDataPoints returns reasons HistogramDataPoints are not equal. +// If they are equal, the returned reasons will be empty. +func equalExponentialHistogramDataPoints[N int64 | float64](a, b metricdata.ExponentialHistogramDataPoint[N], cfg config) (reasons []string) { // nolint: revive // Intentional internal control flag + if !a.Attributes.Equals(&b.Attributes) { + reasons = append(reasons, notEqualStr( + "Attributes", + a.Attributes.Encoded(attribute.DefaultEncoder()), + b.Attributes.Encoded(attribute.DefaultEncoder()), + )) + } + if !cfg.ignoreTimestamp { + if !a.StartTime.Equal(b.StartTime) { + reasons = append(reasons, notEqualStr("StartTime", a.StartTime.UnixNano(), b.StartTime.UnixNano())) + } + if !a.Time.Equal(b.Time) { + reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) + } + } + if a.Count != b.Count { + reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) + } + if !eqExtrema(a.Min, b.Min) { + reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) + } + if !eqExtrema(a.Max, b.Max) { + reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) + } + if a.Sum != b.Sum { + reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + } + + if a.Scale != b.Scale { + reasons = append(reasons, notEqualStr("Scale", a.Scale, b.Scale)) + } + if a.ZeroCount != b.ZeroCount { + reasons = append(reasons, notEqualStr("ZeroCount", a.ZeroCount, b.ZeroCount)) + } + + r := equalExponentialBuckets(a.PositiveBucket, b.PositiveBucket, cfg) + if len(r) > 0 { + reasons = append(reasons, r...) + } + r = equalExponentialBuckets(a.NegativeBucket, b.NegativeBucket, cfg) + if len(r) > 0 { + reasons = append(reasons, r...) + } + + if !cfg.ignoreExemplars { + r := compareDiff(diffSlices( + a.Exemplars, + b.Exemplars, + func(a, b metricdata.Exemplar[N]) bool { + r := equalExemplars(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Exemplars not equal:\n%s", r)) + } + } + return reasons +} + +func equalExponentialBuckets(a, b metricdata.ExponentialBucket, _ config) (reasons []string) { + if a.Offset != b.Offset { + reasons = append(reasons, notEqualStr("Offset", a.Offset, b.Offset)) + } + if !equalSlices(a.Counts, b.Counts) { + reasons = append(reasons, notEqualStr("Counts", a.Counts, b.Counts)) + } + return reasons +} + func notEqualStr(prefix string, expected, actual interface{}) string { return fmt.Sprintf("%s not equal:\nexpected: %v\nactual: %v", prefix, expected, actual) } @@ -557,6 +666,31 @@ func hasAttributesHistogram[T int64 | float64](histogram metricdata.Histogram[T] return reasons } +func hasAttributesExponentialHistogramDataPoints[T int64 | float64](dp metricdata.ExponentialHistogramDataPoint[T], attrs ...attribute.KeyValue) (reasons []string) { + for _, attr := range attrs { + val, ok := dp.Attributes.Value(attr.Key) + if !ok { + reasons = append(reasons, missingAttrStr(string(attr.Key))) + continue + } + if val != attr.Value { + reasons = append(reasons, notEqualStr(string(attr.Key), attr.Value.Emit(), val.Emit())) + } + } + return reasons +} + +func hasAttributesExponentialHistogram[T int64 | float64](histogram metricdata.ExponentialHistogram[T], attrs ...attribute.KeyValue) (reasons []string) { + for n, dp := range histogram.DataPoints { + reas := hasAttributesExponentialHistogramDataPoints(dp, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("histogram datapoint %d attributes:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} + func hasAttributesAggregation(agg metricdata.Aggregation, attrs ...attribute.KeyValue) (reasons []string) { switch agg := agg.(type) { case metricdata.Gauge[int64]: @@ -571,6 +705,10 @@ func hasAttributesAggregation(agg metricdata.Aggregation, attrs ...attribute.Key reasons = hasAttributesHistogram(agg, attrs...) case metricdata.Histogram[float64]: reasons = hasAttributesHistogram(agg, attrs...) + case metricdata.ExponentialHistogram[int64]: + reasons = hasAttributesExponentialHistogram(agg, attrs...) + case metricdata.ExponentialHistogram[float64]: + reasons = hasAttributesExponentialHistogram(agg, attrs...) default: reasons = []string{fmt.Sprintf("unknown aggregation %T", agg)} } From e3f547fedde93719a1a4f63eab7fd8e9b6d8c775 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Tue, 20 Jun 2023 02:38:28 -0700 Subject: [PATCH 566/886] dependabot updates Tue Jun 20 09:20:10 UTC 2023 (#4240) Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /bridge/opentracing/test Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /example/view Bump github.com/golangci/golangci-lint from 1.53.2 to 1.53.3 in /internal/tools Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /exporters/prometheus Bump golang.org/x/tools from 0.9.3 to 0.10.0 in /internal/tools Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /exporters/otlp/otlptrace Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 in /example/prometheus Bump google.golang.org/grpc from 1.55.0 to 1.56.0 in /example/otel-collector Bump golang.org/x/sys from 0.8.0 to 0.9.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +- bridge/opentracing/test/go.mod | 10 +-- bridge/opentracing/test/go.sum | 20 ++--- example/fib/go.mod | 2 +- example/fib/go.sum | 4 +- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 +- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +- example/otel-collector/go.mod | 4 +- example/otel-collector/go.sum | 8 +- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +- example/prometheus/go.mod | 6 +- example/prometheus/go.sum | 12 +-- example/view/go.mod | 6 +- example/view/go.sum | 12 +-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 4 +- exporters/otlp/otlpmetric/go.sum | 8 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 8 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 8 +- exporters/otlp/otlptrace/go.mod | 4 +- exporters/otlp/otlptrace/go.sum | 8 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 8 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 8 +- exporters/prometheus/go.mod | 6 +- exporters/prometheus/go.sum | 12 +-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +- internal/tools/go.mod | 38 ++++----- internal/tools/go.sum | 82 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +- 52 files changed, 184 insertions(+), 188 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4cd3eb2c621..d05767361e9 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index bb22501f742..864fa7f8605 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 0660d1515d7..86a679d3c6a 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 3e227c72a45..28e7cefa6f4 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index b487b59fe29..5f128e0dbe1 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/bridge/opentracing v1.16.0 - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 ) require ( @@ -25,10 +25,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.9.0 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 3ff77eddd3a..8075ad67ca8 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -36,26 +36,26 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/example/fib/go.mod b/example/fib/go.mod index 65d18138411..bcc4efc6017 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index 3578f060ba4..dbd8bfec953 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 160c28944fd..6bc9bdb7882 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 42e631ae371..b6bd2da015b 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index a9e9d837368..7587371d208 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 3578f060ba4..dbd8bfec953 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 12ff697ec4a..16b1a6dc3ba 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 3e227c72a45..28e7cefa6f4 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 6d2c7f8178b..171124fc74a 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 ) require ( @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/proto/otlp v0.20.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 4bbd4f41745..ccf0bc3b559 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 3e8427f2dd9..66089198291 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 3578f060ba4..dbd8bfec953 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 3ffa7e669b5..1a70b897ed3 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.15.1 + github.com/prometheus/client_golang v1.16.0 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/prometheus v0.39.0 go.opentelemetry.io/otel/metric v1.16.0 @@ -19,10 +19,10 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 733882637ee..960ff14d4ef 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -17,18 +17,18 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index 717ccfe6907..49ae7245f6b 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.19 require ( - github.com/prometheus/client_golang v1.15.1 + github.com/prometheus/client_golang v1.16.0 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/prometheus v0.39.0 go.opentelemetry.io/otel/metric v1.16.0 @@ -20,9 +20,9 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect google.golang.org/protobuf v1.30.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index 733882637ee..960ff14d4ef 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -17,18 +17,18 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 1f38165af08..4cc0fef58b5 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index b18c6fc5432..036429de63d 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index a2e1ece810b..317d1722873 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 76713a55844..09c01acc8e1 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 67b0b07c442..9f4b88d85e9 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 google.golang.org/protobuf v1.30.0 ) @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index c17142f7bc4..38b6d4ff428 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 472bfec01a0..7995117797e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 google.golang.org/protobuf v1.30.0 ) @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 9d9f8d006ad..2cff2148efb 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 67c85a4c534..81d27622e37 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,11 +27,11 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.55.0 // indirect + google.golang.org/grpc v1.56.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 9d9f8d006ad..2cff2148efb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index cff15ed48a7..8560515f986 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index c17142f7bc4..38b6d4ff428 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 4c103ec873e..a462ac8c848 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.20.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.55.0 + google.golang.org/grpc v1.56.0 google.golang.org/protobuf v1.30.0 ) @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index a95e465743d..f708a065977 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -28,8 +28,8 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index c9e78e8d2df..9f3a8ebcd44 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,11 +23,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.55.0 // indirect + google.golang.org/grpc v1.56.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 56e002b6b0e..97b5a25f9f4 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -26,8 +26,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -36,8 +36,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= +google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 38377fbfc5a..6438cd53a87 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.19 require ( - github.com/prometheus/client_golang v1.15.1 + github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 @@ -24,10 +24,10 @@ require ( github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 955f79d2e96..e438920960e 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -23,21 +23,21 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 9bf72c86601..ddd3155e80f 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index ccd6b833b89..0a08152889e 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 88978a2c29b..828f22b669d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index ccd6b833b89..0a08152889e 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 608de1a890d..436b2059af3 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index c68a987718d..f652b455b4f 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 9c058319dd7..614a8121b1e 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.53.2 + github.com/golangci/golangci-lint v1.53.3 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.8.0 go.opentelemetry.io/build-tools/multimod v0.8.0 go.opentelemetry.io/build-tools/semconvgen v0.8.0 - golang.org/x/tools v0.9.3 + golang.org/x/tools v0.10.0 ) require ( @@ -23,7 +23,7 @@ require ( github.com/Abirdcfly/dupword v0.0.11 // indirect github.com/Antonboom/errname v0.1.10 // indirect github.com/Antonboom/nilnil v0.1.5 // indirect - github.com/BurntSushi/toml v1.3.0 // indirect + github.com/BurntSushi/toml v1.3.2 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect @@ -31,13 +31,13 @@ require ( github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect - github.com/alexkohler/nakedret/v2 v2.0.1 // indirect + github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/ashanbrown/forbidigo v1.5.1 // indirect + github.com/ashanbrown/forbidigo v1.5.3 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bkielbasa/cyclop v1.2.0 // indirect + github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bombsimon/wsl/v3 v3.4.0 // indirect github.com/breml/bidichk v0.2.4 // indirect @@ -86,7 +86,7 @@ require ( github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect - github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect + github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect @@ -130,18 +130,18 @@ require ( github.com/moricho/tparallel v0.3.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect - github.com/nishanths/exhaustive v0.10.0 // indirect + github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.12.0 // indirect + github.com/nunnatsa/ginkgolinter v0.12.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.2 // indirect - github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.9.0 // indirect + github.com/prometheus/procfs v0.10.1 // indirect github.com/quasilyte/go-ruleguard v0.3.19 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect @@ -155,7 +155,7 @@ require ( github.com/securego/gosec/v2 v2.16.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect - github.com/sirupsen/logrus v1.9.2 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect @@ -187,21 +187,21 @@ require ( github.com/xen0n/gosmopolitan v1.2.1 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect - github.com/ykadowak/zerologlint v0.1.1 // indirect + github.com/ykadowak/zerologlint v0.1.2 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect go.opentelemetry.io/build-tools v0.8.0 // indirect go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.9.0 // indirect + golang.org/x/crypto v0.10.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sync v0.2.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/mod v0.11.0 // indirect + golang.org/x/net v0.11.0 // indirect + golang.org/x/sync v0.3.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.10.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 13674e4c183..ebc35ed166e 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -49,8 +49,8 @@ github.com/Antonboom/errname v0.1.10/go.mod h1:xLeiCIrvVNpUtsN0wxAh05bNIZpqE22/q github.com/Antonboom/nilnil v0.1.5 h1:X2JAdEVcbPaOom2TUa1FxZ3uyuUlex0XMLGYMemu6l0= github.com/Antonboom/nilnil v0.1.5/go.mod h1:I24toVuBKhfP5teihGWctrRiPbRKHwZIFOvc6v3HZXk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= -github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= @@ -72,16 +72,16 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alexkohler/nakedret/v2 v2.0.1 h1:DLFVWaHbEntNHBYGhPX+AhCM1gCErTs35IFWPh6Bnn0= -github.com/alexkohler/nakedret/v2 v2.0.1/go.mod h1:2b8Gkk0GsOrqQv/gPWjNLDSKwG8I5moSXG1K4VIBcTQ= +github.com/alexkohler/nakedret/v2 v2.0.2 h1:qnXuZNvv3/AxkAb22q/sEsEpcA99YxLFACDtEw9TPxE= +github.com/alexkohler/nakedret/v2 v2.0.2/go.mod h1:2b8Gkk0GsOrqQv/gPWjNLDSKwG8I5moSXG1K4VIBcTQ= github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pOcUuw= github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/ashanbrown/forbidigo v1.5.1 h1:WXhzLjOlnuDYPYQo/eFlcFMi8X/kLfvWLYu6CSoebis= -github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= +github.com/ashanbrown/forbidigo v1.5.3 h1:jfg+fkm/snMx+V9FBwsl1d340BV/99kZGv5jN9hBoXk= +github.com/ashanbrown/forbidigo v1.5.3/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -89,8 +89,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bkielbasa/cyclop v1.2.0 h1:7Jmnh0yL2DjKfw28p86YTd/B4lRGcNuu12sKE35sM7A= -github.com/bkielbasa/cyclop v1.2.0/go.mod h1:qOI0yy6A7dYC4Zgsa72Ppm9kONl0RoIlPbzot9mhmeI= +github.com/bkielbasa/cyclop v1.2.1 h1:AeF71HZDob1P2/pRm1so9cd1alZnrpyc4q2uP2l0gJY= +github.com/bkielbasa/cyclop v1.2.1/go.mod h1:K/dT/M0FPAiYjBgQGau7tz+3TMh4FWAEqlMhzFWCrgM= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= @@ -246,8 +246,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.53.2 h1:52pgJKXiAuyfcOa8HJPIrZk1oMgpyXeN8TUxpcteweM= -github.com/golangci/golangci-lint v1.53.2/go.mod h1:fz9DDC9UABJ7SFHTz0XnkiYzb4su7YpuB9ucsgdUfCk= +github.com/golangci/golangci-lint v1.53.3 h1:CUcRafczT4t1F+mvdkUm6KuOpxUZTl0yWN/rSU6sSMo= +github.com/golangci/golangci-lint v1.53.3/go.mod h1:W4Gg3ONq6p3Jl+0s/h9Gr0j7yEgHJWWZO2bHl2tBUXM= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -294,8 +294,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U= -github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= +github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 h1:mrEEilTAUmaAORhssPPkxj84TsHrPMLBGW2Z4SoTxm8= +github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= @@ -429,12 +429,12 @@ github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4N github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.10.0 h1:BMznKAcVa9WOoLq/kTGp4NJOJSMwEpcpjFNAVRfPlSo= -github.com/nishanths/exhaustive v0.10.0/go.mod h1:IbwrGdVMizvDcIxPYGVdQn5BqWJaOwpCvg4RGb8r/TA= +github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= +github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.12.0 h1:seZo112n+lt0gdLJ/Jh70mzvrqbABWFpXd1bZTLTByM= -github.com/nunnatsa/ginkgolinter v0.12.0/go.mod h1:dJIGXYXbkBswqa/pIzG0QlVTTDSBMxDoCFwhsl4Uras= +github.com/nunnatsa/ginkgolinter v0.12.1 h1:vwOqb5Nu05OikTXqhvLdHCGcx5uthIYIl0t79UVrERQ= +github.com/nunnatsa/ginkgolinter v0.12.1/go.mod h1:AK8Ab1PypVrcGUusuKD8RDcl2KgsIwvNaaxAlyHSzso= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= @@ -463,8 +463,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= -github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= +github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= +github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -482,8 +482,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= -github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= +github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= +github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZyPmD9nVcc= github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= @@ -520,8 +520,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= -github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.3 h1:x+etemjbsh2fB5ewm5FeLNi5bUjK0V8n0RB+Wwfd0XE= github.com/sivchari/containedctx v1.0.3/go.mod h1:c1RDvCbnJLtH4lLcYD/GqwiBSSf4F5Qk0xld2rBqzJ4= github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt95do8= @@ -604,8 +604,8 @@ github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= -github.com/ykadowak/zerologlint v0.1.1 h1:CA1+RsGS1DbBn3jJP2jpWfiMJipWdeqJfSY0GpNgqaY= -github.com/ykadowak/zerologlint v0.1.1/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= +github.com/ykadowak/zerologlint v0.1.2 h1:Um4P5RMmelfjQqQJKtE8ZW+dLZrXrENeIzWWKw800U4= +github.com/ykadowak/zerologlint v0.1.2/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -653,8 +653,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -701,8 +701,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -743,12 +743,11 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -772,8 +771,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -836,17 +835,16 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= +golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -856,12 +854,11 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -933,11 +930,10 @@ golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4 golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index 722872bb45f..a6f2224ff92 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - golang.org/x/sys v0.8.0 + golang.org/x/sys v0.9.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index cf7c2a533c7..ef092cc040b 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 56e6f9285e2..d919afce098 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.8.0 // indirect + golang.org/x/sys v0.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index ccd6b833b89..0a08152889e 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From cda2d6c7b5358618ed6f29def41ddb1d0df15efc Mon Sep 17 00:00:00 2001 From: Jorropo Date: Tue, 20 Jun 2023 12:14:45 +0200 Subject: [PATCH 567/886] Replace uses unsafe with atomic with the generic atomic.Pointer (#4226) Line numbers debug symbols aside this code will produce the exact same machine code. It removes a non needed use of unsafe and replace it with compile time type checked generics. Will help keep code cleaner in case any of this ever gets refactored in the future. --- internal/global/handler.go | 7 +++---- internal/global/internal_logging.go | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/global/handler.go b/internal/global/handler.go index 3dcd1caae69..5e9b8304792 100644 --- a/internal/global/handler.go +++ b/internal/global/handler.go @@ -18,7 +18,6 @@ import ( "log" "os" "sync/atomic" - "unsafe" ) var ( @@ -42,7 +41,7 @@ type ErrorHandler interface { } type ErrDelegator struct { - delegate unsafe.Pointer + delegate atomic.Pointer[ErrorHandler] } func (d *ErrDelegator) Handle(err error) { @@ -50,12 +49,12 @@ func (d *ErrDelegator) Handle(err error) { } func (d *ErrDelegator) getDelegate() ErrorHandler { - return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate)) + return *d.delegate.Load() } // setDelegate sets the ErrorHandler delegate. func (d *ErrDelegator) setDelegate(eh ErrorHandler) { - atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh)) + d.delegate.Store(&eh) } func defaultErrorHandler() *ErrDelegator { diff --git a/internal/global/internal_logging.go b/internal/global/internal_logging.go index 5951fd06d4c..c6f305a2b76 100644 --- a/internal/global/internal_logging.go +++ b/internal/global/internal_logging.go @@ -18,7 +18,6 @@ import ( "log" "os" "sync/atomic" - "unsafe" "github.com/go-logr/logr" "github.com/go-logr/stdr" @@ -28,7 +27,7 @@ import ( // // The default logger uses stdr which is backed by the standard `log.Logger` // interface. This logger will only show messages at the Error Level. -var globalLogger unsafe.Pointer +var globalLogger atomic.Pointer[logr.Logger] func init() { SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) @@ -40,11 +39,11 @@ func init() { // To see Info messages use a logger with `l.V(4).Enabled() == true` // To see Debug messages use a logger with `l.V(8).Enabled() == true`. func SetLogger(l logr.Logger) { - atomic.StorePointer(&globalLogger, unsafe.Pointer(&l)) + globalLogger.Store(&l) } func getLogger() logr.Logger { - return *(*logr.Logger)(atomic.LoadPointer(&globalLogger)) + return *globalLogger.Load() } // Info prints messages about the general state of the API or SDK. From be7539e30d0589c86a680d5c50589647136eb21b Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Tue, 20 Jun 2023 21:24:25 +0900 Subject: [PATCH 568/886] exporters/otlp/otlptrace/otlptracegrpc: remove unnecessary comment (#4224) Signed-off-by: Koichi Shiraishi --- exporters/otlp/otlptrace/otlptracegrpc/client.go | 1 - 1 file changed, 1 deletion(-) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 2ab2a6e1484..5b30fe03cbb 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -259,7 +259,6 @@ func (c *client) exportContext(parent context.Context) (context.Context, context // retryable returns if err identifies a request that can be retried and a // duration to wait for if an explicit throttle time is included in err. func retryable(err error) (bool, time.Duration) { - //func retryable(err error) (bool, time.Duration) { s := status.Convert(err) switch s.Code() { case codes.Canceled, From fc88a6a25b9ccd8cb370947dd913898e9c37f838 Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Tue, 20 Jun 2023 08:38:22 -0400 Subject: [PATCH 569/886] Drop website_docs since it has moved to OTel website (#4219) --- RELEASING.md | 4 +- website_docs/_index.md | 20 - website_docs/api.md | 8 - website_docs/examples.md | 7 - website_docs/exporters.md | 57 --- website_docs/getting-started.md | 693 -------------------------------- website_docs/libraries.md | 114 ------ website_docs/manual.md | 302 -------------- website_docs/resources.md | 50 --- website_docs/sampling.md | 35 -- 10 files changed, 3 insertions(+), 1287 deletions(-) delete mode 100644 website_docs/_index.md delete mode 100644 website_docs/api.md delete mode 100644 website_docs/examples.md delete mode 100644 website_docs/exporters.md delete mode 100644 website_docs/getting-started.md delete mode 100644 website_docs/libraries.md delete mode 100644 website_docs/manual.md delete mode 100644 website_docs/resources.md delete mode 100644 website_docs/sampling.md diff --git a/RELEASING.md b/RELEASING.md index 5e6daf6c48e..f8ad277f59c 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -120,7 +120,9 @@ Once verified be sure to [make a release for the `contrib` repository](https://g ### Website Documentation -Update [the documentation](./website_docs) for [the OpenTelemetry website](https://opentelemetry.io/docs/go/). +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go]. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. [OpenTelemetry Specification]: https://github.com/open-telemetry/opentelemetry-specification +[Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ +[content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go diff --git a/website_docs/_index.md b/website_docs/_index.md deleted file mode 100644 index 9384531e19c..00000000000 --- a/website_docs/_index.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Go -description: >- - Go A language-specific implementation of OpenTelemetry in Go. -aliases: [/golang, /golang/metrics, /golang/tracing] -cascade: - github_repo: &repo https://github.com/open-telemetry/opentelemetry-go - github_subdir: website_docs - path_base_for_github_subdir: content/en/docs/instrumentation/go/ - github_project_repo: *repo -spelling: cSpell:ignore godoc -weight: 16 ---- - -{{% lang_instrumentation_index_head "go" /%}} - -## More - -- [Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib) diff --git a/website_docs/api.md b/website_docs/api.md deleted file mode 100644 index 9bdbc6b534e..00000000000 --- a/website_docs/api.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: API reference -linkTitle: API -redirect: https://pkg.go.dev/go.opentelemetry.io/otel -manualLinkTarget: _blank -_build: { render: link } -weight: 210 ---- diff --git a/website_docs/examples.md b/website_docs/examples.md deleted file mode 100644 index 05db2e28319..00000000000 --- a/website_docs/examples.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Examples -redirect: https://github.com/open-telemetry/opentelemetry-go/tree/main/example -manualLinkTarget: _blank -_build: { render: link } -weight: 220 ---- diff --git a/website_docs/exporters.md b/website_docs/exporters.md deleted file mode 100644 index 64df5d03423..00000000000 --- a/website_docs/exporters.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Exporters -aliases: [/docs/instrumentation/go/exporting_data] -weight: 50 ---- - -In order to visualize and analyze your [traces](/docs/concepts/signals/traces/) -and metrics, you will need to export them to a backend. - -## OTLP endpoint - -To send trace data to an OTLP endpoint (like the [collector](/docs/collector) or -Jaeger >= v1.35.0) you'll want to configure an OTLP exporter that sends to your -endpoint. - -### Using HTTP - -```go -import ( - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" -) - -func installExportPipeline(ctx context.Context) (func(context.Context) error, error) { - client := otlptracehttp.NewClient() - exporter, err := otlptrace.New(ctx, client) - if err != nil { - return nil, fmt.Errorf("creating OTLP trace exporter: %w", err) - } - /* … */ -} -``` - -To learn more on how to use the OTLP HTTP exporter, try out the -[otel-collector](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/otel-collector) - -### Jaeger - -To try out the OTLP exporter, since v1.35.0 you can run -[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace -visualization in a docker container: - -```shell -docker run -d --name jaeger \ - -e COLLECTOR_OTLP_ENABLED=true \ - -p 16686:16686 \ - -p 4318:4318 \ - jaegertracing/all-in-one:latest -``` - -## Prometheus - -Prometheus export is available in the -`go.opentelemetry.io/otel/exporters/prometheus` package. - -Please find more documentation on -[GitHub](https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/prometheus) diff --git a/website_docs/getting-started.md b/website_docs/getting-started.md deleted file mode 100644 index 6cf5c28e4d9..00000000000 --- a/website_docs/getting-started.md +++ /dev/null @@ -1,693 +0,0 @@ ---- -title: Getting Started -weight: 10 ---- - -Welcome to the OpenTelemetry for Go getting started guide! This guide will walk -you through the basic steps in installing, instrumenting with, configuring, and -exporting data from OpenTelemetry. Before you get started, be sure to have Go -1.16 or newer installed. - -Understanding how a system is functioning when it is failing or having issues is -critical to resolving those issues. One strategy to understand this is with -tracing. This guide shows how the OpenTelemetry Go project can be used to trace -an example application. You will start with an application that computes -Fibonacci numbers for users, and from there you will add instrumentation to -produce tracing telemetry with OpenTelemetry Go. - -For reference, a complete example of the code you will build can be found -[here](https://github.com/open-telemetry/opentelemetry-go/tree/main/example/fib). - -To start building the application, make a new directory named `fib` to house our -Fibonacci project. Next, add the following to a new file named `fib.go` in that -directory. - -```go -package main - -// Fibonacci returns the n-th fibonacci number. -func Fibonacci(n uint) (uint64, error) { - if n <= 1 { - return uint64(n), nil - } - - var n2, n1 uint64 = 0, 1 - for i := uint(2); i < n; i++ { - n2, n1 = n1, n1+n2 - } - - return n2 + n1, nil -} -``` - -With your core logic added, you can now build your application around it. Add a -new `app.go` file with the following application logic. - -```go -package main - -import ( - "context" - "fmt" - "io" - "log" -) - -// App is a Fibonacci computation application. -type App struct { - r io.Reader - l *log.Logger -} - -// NewApp returns a new App. -func NewApp(r io.Reader, l *log.Logger) *App { - return &App{r: r, l: l} -} - -// Run starts polling users for Fibonacci number requests and writes results. -func (a *App) Run(ctx context.Context) error { - for { - n, err := a.Poll(ctx) - if err != nil { - return err - } - - a.Write(ctx, n) - } -} - -// Poll asks a user for input and returns the request. -func (a *App) Poll(ctx context.Context) (uint, error) { - a.l.Print("What Fibonacci number would you like to know: ") - - var n uint - _, err := fmt.Fscanf(a.r, "%d\n", &n) - return n, err -} - -// Write writes the n-th Fibonacci number back to the user. -func (a *App) Write(ctx context.Context, n uint) { - f, err := Fibonacci(n) - if err != nil { - a.l.Printf("Fibonacci(%d): %v\n", n, err) - } else { - a.l.Printf("Fibonacci(%d) = %d\n", n, f) - } -} -``` - -With your application fully composed, you need a `main()` function to actually -run the application. In a new `main.go` file add the following run logic. - -```go -package main - -import ( - "context" - "log" - "os" - "os/signal" -) - -func main() { - l := log.New(os.Stdout, "", 0) - - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, os.Interrupt) - - errCh := make(chan error) - app := NewApp(os.Stdin, l) - go func() { - errCh <- app.Run(context.Background()) - }() - - select { - case <-sigCh: - l.Println("\ngoodbye") - return - case err := <-errCh: - if err != nil { - l.Fatal(err) - } - } -} -``` - -With the code complete it is almost time to run the application. Before you can -do that you need to initialize this directory as a Go module. From your -terminal, run the command `go mod init fib` in the `fib` directory. This will -create a `go.mod` file, which is used by Go to manage imports. Now you should be -able to run the application! - -```console -$ go run . -What Fibonacci number would you like to know: -42 -Fibonacci(42) = 267914296 -What Fibonacci number would you like to know: -^C -goodbye -``` - -The application can be exited with Ctrl+C. You should see a similar -output as above, if not make sure to go back and fix any errors. - -## Trace Instrumentation - -OpenTelemetry is split into two parts: an API to instrument code with, and SDKs -that implement the API. To start integrating OpenTelemetry into any project, the -API is used to define how telemetry is generated. To generate tracing telemetry -in your application you will use the OpenTelemetry Trace API from the -[`go.opentelemetry.io/otel/trace`] package. - -First, you need to install the necessary packages for the Trace API. Run the -following command in your working directory. - -```sh -go get go.opentelemetry.io/otel \ - go.opentelemetry.io/otel/trace -``` - -Now that the packages installed you can start updating your application with -imports you will use in the `app.go` file. - -```go -import ( - "context" - "fmt" - "io" - "log" - "strconv" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" -) -``` - -With the imports added, you can start instrumenting. - -The OpenTelemetry Tracing API provides a [`Tracer`] to create traces. These -[`Tracer`]s are designed to be associated with one instrumentation library. That -way telemetry they produce can be understood to come from that part of a code -base. To uniquely identify your application to the [`Tracer`] you will create a -constant with the package name in `app.go`. - -```go -// name is the Tracer name used to identify this instrumentation library. -const name = "fib" -``` - -Using the full-qualified package name, something that should be unique for Go -packages, is the standard way to identify a [`Tracer`]. If your example package -name differs, be sure to update the name you use here to match. - -Everything should be in place now to start tracing your application. But first, -what is a trace? And, how exactly should you build them for your application? - -To back up a bit, a trace is a type of telemetry that represents work being done -by a service. A trace is a record of the connection(s) between participants -processing a transaction, often through client/server requests processing and -other forms of communication. - -Each part of the work that a service performs is represented in the trace by a -span. Those spans are not just an unordered collection. Like the call stack of -our application, those spans are defined with relationships to one another. The -"root" span is the only span without a parent, it represents how a service -request is started. All other spans have a parent relationship to another span -in the same trace. - -If this last part about span relationships doesn't make complete sense now, -don't worry. The most important takeaway is that each part of your code, which -does some work, should be represented as a span. You will have a better -understanding of these span relationships after you instrument your code, so -let's get started. - -Start by instrumenting the `Run` method. - -```go -// Run starts polling users for Fibonacci number requests and writes results. -func (a *App) Run(ctx context.Context) error { - for { - // Each execution of the run loop, we should get a new "root" span and context. - newCtx, span := otel.Tracer(name).Start(ctx, "Run") - - n, err := a.Poll(newCtx) - if err != nil { - span.End() - return err - } - - a.Write(newCtx, n) - span.End() - } -} -``` - -The above code creates a span for every iteration of the for loop. The span is -created using a [`Tracer`] from the -[global `TracerProvider`](https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). -You will learn more about [`TracerProvider`]s and handle the other side of -setting up a global [`TracerProvider`] when you install an SDK in a later -section. For now, as an instrumentation author, all you need to worry about is -that you are using an appropriately named [`Tracer`] from a [`TracerProvider`] -when you write `otel.Tracer(name)`. - -Next, instrument the `Poll` method. - -```go -// Poll asks a user for input and returns the request. -func (a *App) Poll(ctx context.Context) (uint, error) { - _, span := otel.Tracer(name).Start(ctx, "Poll") - defer span.End() - - a.l.Print("What Fibonacci number would you like to know: ") - - var n uint - _, err := fmt.Fscanf(a.r, "%d\n", &n) - - // Store n as a string to not overflow an int64. - nStr := strconv.FormatUint(uint64(n), 10) - span.SetAttributes(attribute.String("request.n", nStr)) - - return n, err -} -``` - -Similar to the `Run` method instrumentation, this adds a span to the method to -track the computation performed. However, it also adds an attribute to annotate -the span. This annotation is something you can add when you think a user of your -application will want to see the state or details about the run environment when -looking at telemetry. - -Finally, instrument the `Write` method. - -```go -// Write writes the n-th Fibonacci number back to the user. -func (a *App) Write(ctx context.Context, n uint) { - var span trace.Span - ctx, span = otel.Tracer(name).Start(ctx, "Write") - defer span.End() - - f, err := func(ctx context.Context) (uint64, error) { - _, span := otel.Tracer(name).Start(ctx, "Fibonacci") - defer span.End() - return Fibonacci(n) - }(ctx) - if err != nil { - a.l.Printf("Fibonacci(%d): %v\n", n, err) - } else { - a.l.Printf("Fibonacci(%d) = %d\n", n, f) - } -} -``` - -This method is instrumented with two spans. One to track the `Write` method -itself, and another to track the call to the core logic with the `Fibonacci` -function. Do you see how context is passed through the spans? Do you see how -this also defines the relationship between spans? - -In OpenTelemetry Go the span relationships are defined explicitly with a -`context.Context`. When a span is created a context is returned alongside the -span. That context will contain a reference to the created span. If that context -is used when creating another span the two spans will be related. The original -span will become the new span's parent, and as a corollary, the new span is said -to be a child of the original. This hierarchy gives traces structure, structure -that helps show a computation path through a system. Based on what you -instrumented above and this understanding of span relationships you should -expect a trace for each execution of the run loop to look like this. - -``` -Run -├── Poll -└── Write - └── Fibonacci -``` - -A `Run` span will be a parent to both a `Poll` and `Write` span, and the `Write` -span will be a parent to a `Fibonacci` span. - -Now how do you actually see the produced spans? To do this you will need to -configure and install an SDK. - -## SDK Installation - -OpenTelemetry is designed to be modular in its implementation of the -OpenTelemetry API. The OpenTelemetry Go project offers an SDK package, -[`go.opentelemetry.io/otel/sdk`], that implements this API and adheres to the -OpenTelemetry specification. To start using this SDK you will first need to -create an exporter, but before anything can happen we need to install some -packages. Run the following in the `fib` directory to install the trace STDOUT -exporter and the SDK. - -```sh -go get go.opentelemetry.io/otel/sdk \ - go.opentelemetry.io/otel/exporters/stdout/stdouttrace -``` - -Now add the needed imports to `main.go`. - -```go -import ( - "context" - "io" - "log" - "os" - "os/signal" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/sdk/resource" - "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" -) -``` - -### Creating a Console Exporter - -The SDK connects telemetry from the OpenTelemetry API to exporters. Exporters -are packages that allow telemetry data to be emitted somewhere - either to the -console (which is what we're doing here), or to a remote system or collector for -further analysis and/or enrichment. OpenTelemetry supports a variety of -exporters through its ecosystem including popular open source tools like -[Jaeger](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger), -[Zipkin](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/zipkin), and -[Prometheus](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/prometheus). - -To initialize the console exporter, add the following function to the `main.go` -file: - -```go -// newExporter returns a console exporter. -func newExporter(w io.Writer) (trace.SpanExporter, error) { - return stdouttrace.New( - stdouttrace.WithWriter(w), - // Use human-readable output. - stdouttrace.WithPrettyPrint(), - // Do not print timestamps for the demo. - stdouttrace.WithoutTimestamps(), - ) -} -``` - -This creates a new console exporter with basic options. You will use this -function later when you configure the SDK to send telemetry data to it, but -first you need to make sure that data is identifiable. - -### Creating a Resource - -Telemetry data can be crucial to solving issues with a service. The catch is, -you need a way to identify what service, or even what service instance, that -data is coming from. OpenTelemetry uses a [`Resource`] to represent the entity -producing telemetry. Add the following function to the `main.go` file to create -an appropriate [`Resource`] for the application. - -```go -// newResource returns a resource describing this application. -func newResource() *resource.Resource { - r, _ := resource.Merge( - resource.Default(), - resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("fib"), - semconv.ServiceVersion("v0.1.0"), - attribute.String("environment", "demo"), - ), - ) - return r -} -``` - -Any information you would like to associate with all telemetry data the SDK -handles can be added to the returned [`Resource`]. This is done by registering -the [`Resource`] with the [`TracerProvider`]. Something you can now create! - -### Installing a Tracer Provider - -You have your application instrumented to produce telemetry data and you have an -exporter to send that data to the console, but how are they connected? This is -where the [`TracerProvider`] is used. It is a centralized point where -instrumentation will get a [`Tracer`] from and funnels the telemetry data from -these [`Tracer`]s to export pipelines. - -The pipelines that receive and ultimately transmit data to exporters are called -[`SpanProcessor`]s. A [`TracerProvider`] can be configured to have multiple span -processors, but for this example you will only need to configure only one. -Update your `main` function in `main.go` with the following. - -```go -func main() { - l := log.New(os.Stdout, "", 0) - - // Write telemetry data to a file. - f, err := os.Create("traces.txt") - if err != nil { - l.Fatal(err) - } - defer f.Close() - - exp, err := newExporter(f) - if err != nil { - l.Fatal(err) - } - - tp := trace.NewTracerProvider( - trace.WithBatcher(exp), - trace.WithResource(newResource()), - ) - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - l.Fatal(err) - } - }() - otel.SetTracerProvider(tp) - - /* … */ -} -``` - -There's a fair amount going on here. First you are creating a console exporter -that will export to a file. You are then registering the exporter with a new -[`TracerProvider`]. This is done with a [`BatchSpanProcessor`] when it is passed -to the [`trace.WithBatcher`] option. Batching data is a good practice and will -help not overload systems downstream. Finally, with the [`TracerProvider`] -created, you are deferring a function to flush and stop it, and registering it -as the global OpenTelemetry [`TracerProvider`]. - -Do you remember in the previous instrumentation section when we used the global -[`TracerProvider`] to get a [`Tracer`]? This last step, registering the -[`TracerProvider`] globally, is what will connect that instrumentation's -[`Tracer`] with this [`TracerProvider`]. This pattern, using a global -[`TracerProvider`], is convenient, but not always appropriate. -[`TracerProvider`]s can be explicitly passed to instrumentation or inferred from -a context that contains a span. For this simple example using a global provider -makes sense, but for more complex or distributed codebases these other ways of -passing [`TracerProvider`]s may make more sense. - -## Putting It All Together - -You should now have a working application that produces trace telemetry data! -Give it a try. - -```console -$ go run . -What Fibonacci number would you like to know: -42 -Fibonacci(42) = 267914296 -What Fibonacci number would you like to know: -^C -goodbye -``` - -A new file named `traces.txt` should be created in your working directory. All -the traces created from running your application should be in there! - -## (Bonus) Errors - -At this point you have a working application and it is producing tracing -telemetry data. Unfortunately, it was discovered that there is an error in the -core functionality of the `fib` module. - -```console -$ go run . -What Fibonacci number would you like to know: -100 -Fibonacci(100) = 3736710778780434371 -# … -``` - -But the 100-th Fibonacci number is `354224848179261915075`, not -`3736710778780434371`! This application is only meant as a demo, but it -shouldn't return wrong values. Update the `Fibonacci` function to return an -error instead of computing incorrect values. - -```go -// Fibonacci returns the n-th fibonacci number. An error is returned if the -// fibonacci number cannot be represented as a uint64. -func Fibonacci(n uint) (uint64, error) { - if n <= 1 { - return uint64(n), nil - } - - if n > 93 { - return 0, fmt.Errorf("unsupported fibonacci number %d: too large", n) - } - - var n2, n1 uint64 = 0, 1 - for i := uint(2); i < n; i++ { - n2, n1 = n1, n1+n2 - } - - return n2 + n1, nil -} -``` - -Great, you have fixed the code, but it would be ideal to include errors returned -to a user in the telemetry data. Luckily, spans can be configured to communicate -this information. Update the `Write` method in `app.go` with the following code. - -```go -// Write writes the n-th Fibonacci number back to the user. -func (a *App) Write(ctx context.Context, n uint) { - var span trace.Span - ctx, span = otel.Tracer(name).Start(ctx, "Write") - defer span.End() - - f, err := func(ctx context.Context) (uint64, error) { - _, span := otel.Tracer(name).Start(ctx, "Fibonacci") - defer span.End() - f, err := Fibonacci(n) - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - } - return f, err - }(ctx) - /* … */ -} -``` - -With this change any error returned from the `Fibonacci` function will mark that -span as an error and record an event describing the error. - -This is a great start, but it is not the only error returned in from the -application. If a user makes a request for a non unsigned integer value the -application will fail. Update the `Poll` method with a similar fix to capture -this error in the telemetry data. - -```go -// Poll asks a user for input and returns the request. -func (a *App) Poll(ctx context.Context) (uint, error) { - _, span := otel.Tracer(name).Start(ctx, "Poll") - defer span.End() - - a.l.Print("What Fibonacci number would you like to know: ") - - var n uint - _, err := fmt.Fscanf(a.r, "%d\n", &n) - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - return 0, err - } - - // Store n as a string to not overflow an int64. - nStr := strconv.FormatUint(uint64(n), 10) - span.SetAttributes(attribute.String("request.n", nStr)) - - return n, nil -} -``` - -All that is left is updating imports for the `app.go` file to include the -[`go.opentelemetry.io/otel/codes`] package. - -```go -import ( - "context" - "fmt" - "io" - "log" - "strconv" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" -) -``` - -With these fixes in place and the instrumentation updated, re-trigger the bug. - -```console -$ go run . -What Fibonacci number would you like to know: -100 -Fibonacci(100): unsupported fibonacci number 100: too large -What Fibonacci number would you like to know: -^C -goodbye -``` - -Excellent! The application no longer returns wrong values, and looking at the -telemetry data in the `traces.txt` file you should see the error captured as an -event. - -```json -"Events": [ - { - "Name": "exception", - "Attributes": [ - { - "Key": "exception.type", - "Value": { - "Type": "STRING", - "Value": "*errors.errorString" - } - }, - { - "Key": "exception.message", - "Value": { - "Type": "STRING", - "Value": "unsupported fibonacci number 100: too large" - } - } - ], - ... - } -] -``` - -## What's Next - -This guide has walked you through adding tracing instrumentation to an -application and using a console exporter to send telemetry data to a file. There -are many other topics to cover in OpenTelemetry, but you should be ready to -start adding OpenTelemetry Go to your projects at this point. Go instrument your -code! - -For more information about instrumenting your code and things you can do with -spans, refer to the [manual instrumentation](/docs/instrumentation/go/manual/) -documentation. - -You'll also want to configure an appropriate exporter to -[export your telemetry data](/docs/instrumentation/go/exporters/) to one or more -telemetry backends. - -[`go.opentelemetry.io/otel/trace`]: - https://pkg.go.dev/go.opentelemetry.io/otel/trace -[`go.opentelemetry.io/otel/sdk`]: - https://pkg.go.dev/go.opentelemetry.io/otel/sdk -[`go.opentelemetry.io/otel/codes`]: - https://pkg.go.dev/go.opentelemetry.io/otel/codes -[`tracer`]: https://pkg.go.dev/go.opentelemetry.io/otel/trace#Tracer -[`tracerprovider`]: - https://pkg.go.dev/go.opentelemetry.io/otel/trace#TracerProvider -[`resource`]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Resource -[`spanprocessor`]: - https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#SpanProcessor -[`batchspanprocessor`]: - https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#NewBatchSpanProcessor -[`trace.withbatcher`]: - https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace#WithBatcher diff --git a/website_docs/libraries.md b/website_docs/libraries.md deleted file mode 100644 index 8a3ff012956..00000000000 --- a/website_docs/libraries.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: Using instrumentation libraries -linkTitle: Libraries -aliases: - - /docs/instrumentation/go/using_instrumentation_libraries - - /docs/instrumentation/go/automatic_instrumentation -weight: 40 ---- - -Go does not support truly automatic instrumentation like other languages today. -Instead, you'll need to depend on -[instrumentation libraries](/docs/specs/otel/glossary/#instrumentation-library) -that generate telemetry data for a particular instrumented library. For example, -the instrumentation library for `net/http` will automatically create spans that -track inbound and outbound requests once you configure it in your code. - -## Setup - -Each instrumentation library is a package. In general, this means you need to -`go get` the appropriate package: - -```sh -go get go.opentelemetry.io/contrib/instrumentation/{import-path}/otel{package-name} -``` - -And then configure it in your code based on what the library requires to be -activated. - -## Example with `net/http` - -As an example, here's how you can set up automatic instrumentation for inbound -HTTP requests for `net/http`: - -First, get the `net/http` instrumentation library: - -```sh -go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp -``` - -Next, use the library to wrap an HTTP handler in your code: - -```go -package main - -import ( - "context" - "fmt" - "log" - "net/http" - "time" - - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" -) - -// Package-level tracer. -// This should be configured in your code setup instead of here. -var tracer = otel.Tracer("github.com/full/path/to/mypkg") - -// sleepy mocks work that your application does. -func sleepy(ctx context.Context) { - _, span := tracer.Start(ctx, "sleep") - defer span.End() - - sleepTime := 1 * time.Second - time.Sleep(sleepTime) - span.SetAttributes(attribute.Int("sleep.duration", int(sleepTime))) -} - -// httpHandler is an HTTP handler function that is going to be instrumented. -func httpHandler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello, World! I am instrumented automatically!") - ctx := r.Context() - sleepy(ctx) -} - -func main() { - // Wrap your httpHandler function. - handler := http.HandlerFunc(httpHandler) - wrappedHandler := otelhttp.NewHandler(handler, "hello-instrumented") - http.Handle("/hello-instrumented", wrappedHandler) - - // And start the HTTP serve. - log.Fatal(http.ListenAndServe(":3030", nil)) -} -``` - -Assuming that you have a `Tracer` and [exporter](../exporters/) configured, this -code will: - -- Start an HTTP server on port `3030` -- Automatically generate a span for each inbound HTTP request to - `/hello-instrumented` -- Create a child span of the automatically-generated one that tracks the work - done in `sleepy` - -Connecting manual instrumentation you write in your app with instrumentation -generated from a library is essential to get good observability into your apps -and services. - -## Available packages - -A full list of instrumentation libraries available can be found in the -[OpenTelemetry registry](/ecosystem/registry/?language=go&component=instrumentation). - -## Next steps - -Instrumentation libraries can do things like generate telemetry data for inbound -and outbound HTTP requests, but they don't instrument your actual application. - -To get richer telemetry data, use [manual instrumentation](../manual/) to enrich -your telemetry data from instrumentation libraries with instrumentation from -your running application. diff --git a/website_docs/manual.md b/website_docs/manual.md deleted file mode 100644 index c88ad68bc45..00000000000 --- a/website_docs/manual.md +++ /dev/null @@ -1,302 +0,0 @@ ---- -title: Manual Instrumentation -linkTitle: Manual -aliases: - - /docs/instrumentation/go/instrumentation - - /docs/instrumentation/go/manual_instrumentation -weight: 30 ---- - -Instrumentation is the process of adding observability code to your application. -There are two general types of instrumentation - automatic, and manual - and you -should be familiar with both in order to effectively instrument your software. - -## Getting a Tracer - -To create spans, you'll need to acquire or initialize a tracer first. - -### Initializing a new tracer - -Ensure you have the right packages installed: - -```sh -go get go.opentelemetry.io/otel \ - go.opentelemetry.io/otel/trace \ - go.opentelemetry.io/otel/sdk \ -``` - -Then initialize an exporter, resources, tracer provider, and finally a tracer. - -```go -package app - -import ( - "context" - "fmt" - "log" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -var tracer trace.Tracer - -func newExporter(ctx context.Context) /* (someExporter.Exporter, error) */ { - // Your preferred exporter: console, jaeger, zipkin, OTLP, etc. -} - -func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider { - // Ensure default SDK resources and the required service name are set. - r, err := resource.Merge( - resource.Default(), - resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("ExampleService"), - ), - ) - - if err != nil { - panic(err) - } - - return sdktrace.NewTracerProvider( - sdktrace.WithBatcher(exp), - sdktrace.WithResource(r), - ) -} - -func main() { - ctx := context.Background() - - exp, err := newExporter(ctx) - if err != nil { - log.Fatalf("failed to initialize exporter: %v", err) - } - - // Create a new tracer provider with a batch span processor and the given exporter. - tp := newTraceProvider(exp) - - // Handle shutdown properly so nothing leaks. - defer func() { _ = tp.Shutdown(ctx) }() - - otel.SetTracerProvider(tp) - - // Finally, set the tracer that can be used for this package. - tracer = tp.Tracer("ExampleService") -} -``` - -You can now access `tracer` to manually instrument your code. - -## Creating Spans - -Spans are created by tracers. If you don't have one initialized, you'll need to -do that. - -To create a span with a tracer, you'll also need a handle on a `context.Context` -instance. These will typically come from things like a request object and may -already contain a parent span from an [instrumentation library][]. - -```go -func httpHandler(w http.ResponseWriter, r *http.Request) { - ctx, span := tracer.Start(r.Context(), "hello-span") - defer span.End() - - // do some work to track with hello-span -} -``` - -In Go, the `context` package is used to store the active span. When you start a -span, you'll get a handle on not only the span that's created, but the modified -context that contains it. - -Once a span has completed, it is immutable and can no longer be modified. - -### Get the current span - -To get the current span, you'll need to pull it out of a `context.Context` you -have a handle on: - -```go -// This context needs contain the active span you plan to extract. -ctx := context.TODO() -span := trace.SpanFromContext(ctx) - -// Do something with the current span, optionally calling `span.End()` if you want it to end -``` - -This can be helpful if you'd like to add information to the current span at a -point in time. - -### Create nested spans - -You can create a nested span to track work in a nested operation. - -If the current `context.Context` you have a handle on already contains a span -inside of it, creating a new span makes it a nested span. For example: - -```go -func parentFunction(ctx context.Context) { - ctx, parentSpan := tracer.Start(ctx, "parent") - defer parentSpan.End() - - // call the child function and start a nested span in there - childFunction(ctx) - - // do more work - when this function ends, parentSpan will complete. -} - -func childFunction(ctx context.Context) { - // Create a span to track `childFunction()` - this is a nested span whose parent is `parentSpan` - ctx, childSpan := tracer.Start(ctx, "child") - defer childSpan.End() - - // do work here, when this function returns, childSpan will complete. -} -``` - -Once a span has completed, it is immutable and can no longer be modified. - -### Span Attributes - -Attributes are keys and values that are applied as metadata to your spans and -are useful for aggregating, filtering, and grouping traces. Attributes can be -added at span creation, or at any other time during the lifecycle of a span -before it has completed. - -```go -// setting attributes at creation... -ctx, span = tracer.Start(ctx, "attributesAtCreation", trace.WithAttributes(attribute.String("hello", "world"))) -// ... and after creation -span.SetAttributes(attribute.Bool("isTrue", true), attribute.String("stringAttr", "hi!")) -``` - -Attribute keys can be precomputed, as well: - -```go -var myKey = attribute.Key("myCoolAttribute") -span.SetAttributes(myKey.String("a value")) -``` - -#### Semantic Attributes - -Semantic Attributes are attributes that are defined by the [OpenTelemetry -Specification][] in order to provide a shared set of attribute keys across -multiple languages, frameworks, and runtimes for common concepts like HTTP -methods, status codes, user agents, and more. These attributes are available in -the `go.opentelemetry.io/otel/semconv/v1.12.0` package. - -For details, see [Trace semantic conventions][]. - -### Events - -An event is a human-readable message on a span that represents "something -happening" during it's lifetime. For example, imagine a function that requires -exclusive access to a resource that is under a mutex. An event could be created -at two points - once, when we try to gain access to the resource, and another -when we acquire the mutex. - -```go -span.AddEvent("Acquiring lock") -mutex.Lock() -span.AddEvent("Got lock, doing work...") -// do stuff -span.AddEvent("Unlocking") -mutex.Unlock() -``` - -A useful characteristic of events is that their timestamps are displayed as -offsets from the beginning of the span, allowing you to easily see how much time -elapsed between them. - -Events can also have attributes of their own - - -```go -span.AddEvent("Cancelled wait due to external signal", trace.WithAttributes(attribute.Int("pid", 4328), attribute.String("signal", "SIGHUP"))) -``` - -### Set span status - -A status can be set on a span, typically used to specify that there was an error -in the operation a span is tracking - .`Error`. - -```go -import ( - // ... - "go.opentelemetry.io/otel/codes" - // ... -) - -// ... - -result, err := operationThatCouldFail() -if err != nil { - span.SetStatus(codes.Error, "operationThatCouldFail failed") -} -``` - -By default, the status for all spans is `Unset`. In rare cases, you may also -wish to set the status to `Ok`. This should generally not be necessary, though. - -### Record errors - -If you have an operation that failed and you wish to capture the error it -produced, you can record that error. - -```go -import ( - // ... - "go.opentelemetry.io/otel/codes" - // ... -) - -// ... - -result, err := operationThatCouldFail() -if err != nil { - span.SetStatus(codes.Error, "operationThatCouldFail failed") - span.RecordError(err) -} -``` - -It is highly recommended that you also set a span's status to `Error` when using -`RecordError`, unless you do not wish to consider the span tracking a failed -operation as an error span. The `RecordError` function does **not** -automatically set a span status when called. - -## Creating Metrics - -The metrics API is currently unstable, documentation TBA. - -## Propagators and Context - -Traces can extend beyond a single process. This requires _context propagation_, -a mechanism where identifiers for a trace are sent to remote processes. - -In order to propagate trace context over the wire, a propagator must be -registered with the OpenTelemetry API. - -```go -import ( - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/propagation" -) -... -otel.SetTextMapPropagator(propagation.TraceContext{}) -``` - -> OpenTelemetry also supports the B3 header format, for compatibility with -> existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that -> do not support the W3C TraceContext standard. - -After configuring context propagation, you'll most likely want to use automatic -instrumentation to handle the behind-the-scenes work of actually managing -serializing the context. - -[opentelemetry specification]: /docs/specs/otel/ -[trace semantic conventions]: /docs/specs/otel/trace/semantic_conventions/ -[instrumentation library]: ../libraries/ diff --git a/website_docs/resources.md b/website_docs/resources.md deleted file mode 100644 index 5e830fdb30b..00000000000 --- a/website_docs/resources.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Resources -weight: 70 ---- - -Resources are a special type of attribute that apply to all spans generated by a -process. These should be used to represent underlying metadata about a process -that's non-ephemeral — for example, the hostname of a process, or its -instance ID. - -Resources should be assigned to a tracer provider at its initialization, and are -created much like attributes: - -```go -resources := resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceNameKey.String("myService"), - semconv.ServiceVersionKey.String("1.0.0"), - semconv.ServiceInstanceIDKey.String("abcdef12345"), -) - -provider := sdktrace.NewTracerProvider( - ... - sdktrace.WithResource(resources), -) -``` - -Note the use of the `semconv` package to provide -[conventional names](/docs/concepts/semantic-conventions/) for resource -attributes. This helps ensure that consumers of telemetry produced with these -semantic conventions can easily discover relevant attributes and understand -their meaning. - -Resources can also be detected automatically through `resource.Detector` -implementations. These `Detector`s may discover information about the currently -running process, the operating system it is running on, the cloud provider -hosting that operating system instance, or any number of other resource -attributes. - -```go -resources := resource.New(context.Background(), - resource.WithFromEnv(), // pull attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables - resource.WithProcess(), // This option configures a set of Detectors that discover process information - resource.WithOS(), // This option configures a set of Detectors that discover OS information - resource.WithContainer(), // This option configures a set of Detectors that discover container information - resource.WithHost(), // This option configures a set of Detectors that discover host information - resource.WithDetectors(thirdparty.Detector{}), // Bring your own external Detector implementation - resource.WithAttributes(attribute.String("foo", "bar")), // Or specify resource attributes directly -) -``` diff --git a/website_docs/sampling.md b/website_docs/sampling.md deleted file mode 100644 index 296ea25f8fc..00000000000 --- a/website_docs/sampling.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Sampling -weight: 80 ---- - -Sampling is a process that restricts the amount of traces that are generated by -a system. The exact sampler you should use depends on your specific needs, but -in general you should make a decision at the start of a trace, and allow the -sampling decision to propagate to other services. - -A sampler needs to be set on the tracer provider when its configured, as -follows: - -```go -provider := sdktrace.NewTracerProvider( - sdktrace.WithSampler(sdktrace.AlwaysSample()), -) -``` - -`AlwaysSample` and `NeverSample` are fairly self-explanatory. Always means that -every trace will be sampled, the converse holds as true for Never. When you're -getting started, or in a development environment, you'll almost always want to -use `AlwaysSample`. - -Other samplers include: - -- `TraceIDRatioBased`, which will sample a fraction of traces, based on the - fraction given to the sampler. Thus, if you set this to .5, half of traces - will be sampled. -- `ParentBased`, which behaves differently based on the incoming sampling - decision. In general, this will sample spans that have parents that were - sampled, and will not sample spans whose parents were _not_ sampled. - -When you're in production, you should consider using the `TraceIDRatioBased` -sampler with the `ParentBased` sampler. From 9c61b5633847a196f839f6ffa5c6a4759305d6e1 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 21 Jun 2023 11:15:03 -0500 Subject: [PATCH 570/886] Add decision about v2 API (#3968) --- CONTRIBUTING.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2099575bd76..72c1b9eb13c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -475,8 +475,33 @@ documentation are allowed to be extended with additional methods. > Warning: methods may be added to this interface in minor releases. +These interfaces are defined by the OpenTelemetry specification and will be +updated as the specification evolves. + Otherwise, stable interfaces MUST NOT be modified. +#### How to Change Specification Interfaces + +When an API change must be made, we will update the SDK with the new method one +release before the API change. This will allow the SDK one version before the +API change to work seamlessly with the new API. + +If an incompatible version of the SDK is used with the new API the application +will fail to compile. + +#### How Not to Change Specification Interfaces + +We have explored using a v2 of the API to change interfaces and found that there +was no way to introduce a v2 and have it work seamlessly with the v1 of the API. +Problems happened with libraries that upgraded to v2 when an application did not, +and would not produce any telemetry. + +More detail of the approaches considered and their limitations can be found in +the [Use a V2 API to evolve interfaces](https://github.com/open-telemetry/opentelemetry-go/issues/3920) +issue. + +#### How to Change Other Interfaces + If new functionality is needed for an interface that cannot be changed it MUST be added by including an additional interface. That added interface can be a simple interface for the specific functionality that you want to add or it can From 12138c9444b72d563380fbddcfbe3aaee5452a5f Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 21 Jun 2023 13:57:49 -0500 Subject: [PATCH 571/886] Add Exponetial Histograms to otlp transforms (#4222) --- CHANGELOG.md | 1 + .../internal/transform/metricdata.go | 59 ++++++ .../internal/transform/metricdata_test.go | 176 ++++++++++++++++++ 3 files changed, 236 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e68d9fc0534..62697c64423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab - The `go.opentelemetry.io/otel/semconv/v1.20.0` package. The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) - The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) +- OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) ### Changed diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 2f98115b83d..9157de6bdf0 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -99,6 +99,10 @@ func metric(m metricdata.Metrics) (*mpb.Metric, error) { out.Data, err = Histogram(a) case metricdata.Histogram[float64]: out.Data, err = Histogram(a) + case metricdata.ExponentialHistogram[int64]: + out.Data, err = ExponentialHistogram(a) + case metricdata.ExponentialHistogram[float64]: + out.Data, err = ExponentialHistogram(a) default: return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) } @@ -198,6 +202,61 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint return out } +// ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is +// returned if the temporality of h is unknown. +func ExponentialHistogram[N int64 | float64](h metricdata.ExponentialHistogram[N]) (*mpb.Metric_ExponentialHistogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_ExponentialHistogram{ + ExponentialHistogram: &mpb.ExponentialHistogram{ + AggregationTemporality: t, + DataPoints: ExponentialHistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated +// from dPts. +func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint { + out := make([]*mpb.ExponentialHistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + ehdp := &mpb.ExponentialHistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), + TimeUnixNano: uint64(dPt.Time.UnixNano()), + Count: dPt.Count, + Sum: &sum, + Scale: dPt.Scale, + ZeroCount: dPt.ZeroCount, + + Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), + Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + ehdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + ehdp.Max = &vF64 + } + out = append(out, ehdp) + } + return out +} + +// ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated +// from bucket. +func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets { + return &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: bucket.Offset, + BucketCounts: bucket.Counts, + } +} + // Temporality returns an OTLP AggregationTemporality generated from t. If t // is unknown, an error is returned along with the invalid // AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index d9a8ddf6a7c..d6ffa7c2c06 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -95,6 +95,78 @@ var ( Sum: sumB, }} + otelEBucketA = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketB = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketsC = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 1}, + } + otelEBucketsD = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 1}, + } + + otelEHDPInt64 = []metricdata.ExponentialHistogramDataPoint[int64]{{ + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }} + otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{{ + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }} + pbHDP = []*mpb.HistogramDataPoint{{ Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -117,6 +189,49 @@ var ( Max: &maxB, }} + pbEHDPBA = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBB = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBC = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 1}, + } + pbEHDPBD = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 1}, + } + + pbEHDP = []*mpb.ExponentialHistogramDataPoint{{ + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + }} + otelHistInt64 = metricdata.Histogram[int64]{ Temporality: metricdata.DeltaTemporality, DataPoints: otelHDPInt64, @@ -131,11 +246,29 @@ var ( DataPoints: otelHDPInt64, } + otelExpoHistInt64 = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPInt64, + } + otelExpoHistFloat64 = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPFloat64, + } + otelExpoHistInvalid = metricdata.ExponentialHistogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelEHDPInt64, + } + pbHist = &mpb.Histogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, DataPoints: pbHDP, } + pbExpoHist = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDP, + } + otelDPtsInt64 = []metricdata.DataPoint[int64]{ {Attributes: alice, StartTime: start, Time: end, Value: 1}, {Attributes: bob, StartTime: start, Time: end, Value: 2}, @@ -263,6 +396,24 @@ var ( Unit: "1", Data: unknownAgg, }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistInt64, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistFloat64, + }, + { + Name: "invalid-ExponentialHistogram", + Description: "Invalid Exponential Histogram", + Unit: "1", + Data: otelExpoHistInvalid, + }, } pbMetrics = []*mpb.Metric{ @@ -302,6 +453,18 @@ var ( Unit: "1", Data: &mpb.Metric_Histogram{Histogram: pbHist}, }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, } otelScopeMetrics = []metricdata.ScopeMetrics{{ @@ -368,6 +531,9 @@ func TestTransformations(t *testing.T) { assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) // Aggregations. h, err := Histogram(otelHistInt64) @@ -393,6 +559,16 @@ func TestTransformations(t *testing.T) { assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) + e, err := ExponentialHistogram(otelExpoHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, e) + // Metrics. m, err := Metrics(otelMetrics) assert.ErrorIs(t, err, errUnknownTemporality) From ca2aa8307c96c0c8b7046d4e956b049cccda6d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 22 Jun 2023 08:12:43 +0200 Subject: [PATCH 572/886] [chore] Fix Go doc comments in internal transform package (#4242) --- exporters/otlp/otlpmetric/internal/transform/metricdata.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 9157de6bdf0..809ddbdf570 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -118,8 +118,8 @@ func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { } } -// Sum returns an OTLP Metric_Sum generated from s. An error is returned with -// a partial Metric_Sum if the temporality of s is unknown. +// Sum returns an OTLP Metric_Sum generated from s. An error is returned +// if the temporality of s is unknown. func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { t, err := Temporality(s.Temporality) if err != nil { @@ -159,8 +159,7 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number } // Histogram returns an OTLP Metric_Histogram generated from h. An error is -// returned with a partial Metric_Histogram if the temporality of h is -// unknown. +// returned if the temporality of h is unknown. func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { t, err := Temporality(h.Temporality) if err != nil { From 6b262b44ac70a432891d041cd146231a7b731216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 22 Jun 2023 09:09:00 +0200 Subject: [PATCH 573/886] sdk/metric: Reader factories return structs (#4244) --- CHANGELOG.md | 7 +++++++ sdk/metric/manual_reader.go | 24 ++++++++++++------------ sdk/metric/periodic_reader.go | 32 ++++++++++++++++---------------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62697c64423..162bf639470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) + ### Changed - Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) - Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) - Return an error on the creation of new instruments if their name doesn't pass regexp validation. (#4210) +- `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) +- `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index cc1072ce7ea..4d2955e6be7 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -26,9 +26,9 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -// manualReader is a simple Reader that allows an application to +// ManualReader is a simple Reader that allows an application to // read metrics on demand. -type manualReader struct { +type ManualReader struct { sdkProducer atomic.Value shutdownOnce sync.Once @@ -41,12 +41,12 @@ type manualReader struct { } // Compile time check the manualReader implements Reader and is comparable. -var _ = map[Reader]struct{}{&manualReader{}: {}} +var _ = map[Reader]struct{}{&ManualReader{}: {}} // NewManualReader returns a Reader which is directly called to collect metrics. -func NewManualReader(opts ...ManualReaderOption) Reader { +func NewManualReader(opts ...ManualReaderOption) *ManualReader { cfg := newManualReaderConfig(opts) - r := &manualReader{ + r := &ManualReader{ temporalitySelector: cfg.temporalitySelector, aggregationSelector: cfg.aggregationSelector, } @@ -56,7 +56,7 @@ func NewManualReader(opts ...ManualReaderOption) Reader { // register stores the sdkProducer which enables the caller // to read metrics from the SDK on demand. -func (mr *manualReader) register(p sdkProducer) { +func (mr *ManualReader) register(p sdkProducer) { // Only register once. If producer is already set, do nothing. if !mr.sdkProducer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { msg := "did not register manual reader" @@ -66,7 +66,7 @@ func (mr *manualReader) register(p sdkProducer) { // RegisterProducer stores the external Producer which enables the caller // to read metrics on demand. -func (mr *manualReader) RegisterProducer(p Producer) { +func (mr *ManualReader) RegisterProducer(p Producer) { mr.mu.Lock() defer mr.mu.Unlock() if mr.isShutdown { @@ -80,22 +80,22 @@ func (mr *manualReader) RegisterProducer(p Producer) { } // temporality reports the Temporality for the instrument kind provided. -func (mr *manualReader) temporality(kind InstrumentKind) metricdata.Temporality { +func (mr *ManualReader) temporality(kind InstrumentKind) metricdata.Temporality { return mr.temporalitySelector(kind) } // aggregation returns what Aggregation to use for kind. -func (mr *manualReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (mr *ManualReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. return mr.aggregationSelector(kind) } // ForceFlush is a no-op, it always returns nil. -func (mr *manualReader) ForceFlush(context.Context) error { +func (mr *ManualReader) ForceFlush(context.Context) error { return nil } // Shutdown closes any connections and frees any resources used by the reader. -func (mr *manualReader) Shutdown(context.Context) error { +func (mr *ManualReader) Shutdown(context.Context) error { err := ErrReaderShutdown mr.shutdownOnce.Do(func() { // Any future call to Collect will now return ErrReaderShutdown. @@ -117,7 +117,7 @@ func (mr *manualReader) Shutdown(context.Context) error { // // Collect will return an error if called after shutdown. // Collect will return an error if rm is a nil ResourceMetrics. -func (mr *manualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { +func (mr *ManualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { return errors.New("manual reader: *metricdata.ResourceMetrics is nil") } diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index e32b05a9f6d..8f1ff2a4c79 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -111,10 +111,10 @@ func WithInterval(d time.Duration) PeriodicReaderOption { // The Collect method of the returned Reader continues to gather and return // metric data to the user. It will not automatically send that data to the // exporter. That is left to the user to accomplish. -func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reader { +func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) *PeriodicReader { conf := newPeriodicReaderConfig(options) ctx, cancel := context.WithCancel(context.Background()) - r := &periodicReader{ + r := &PeriodicReader{ timeout: conf.timeout, exporter: exporter, flushCh: make(chan chan error), @@ -135,9 +135,9 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) Reade return r } -// periodicReader is a Reader that continuously collects and exports metric +// PeriodicReader is a Reader that continuously collects and exports metric // data at a set interval. -type periodicReader struct { +type PeriodicReader struct { sdkProducer atomic.Value mu sync.Mutex @@ -156,14 +156,14 @@ type periodicReader struct { } // Compile time check the periodicReader implements Reader and is comparable. -var _ = map[Reader]struct{}{&periodicReader{}: {}} +var _ = map[Reader]struct{}{&PeriodicReader{}: {}} // newTicker allows testing override. var newTicker = time.NewTicker // run continuously collects and exports metric data at the specified // interval. This will run until ctx is canceled or times out. -func (r *periodicReader) run(ctx context.Context, interval time.Duration) { +func (r *PeriodicReader) run(ctx context.Context, interval time.Duration) { ticker := newTicker(interval) defer ticker.Stop() @@ -184,7 +184,7 @@ func (r *periodicReader) run(ctx context.Context, interval time.Duration) { } // register registers p as the producer of this reader. -func (r *periodicReader) register(p sdkProducer) { +func (r *PeriodicReader) register(p sdkProducer) { // Only register once. If producer is already set, do nothing. if !r.sdkProducer.CompareAndSwap(nil, produceHolder{produce: p.produce}) { msg := "did not register periodic reader" @@ -193,7 +193,7 @@ func (r *periodicReader) register(p sdkProducer) { } // RegisterProducer registers p as an external Producer of this reader. -func (r *periodicReader) RegisterProducer(p Producer) { +func (r *PeriodicReader) RegisterProducer(p Producer) { r.mu.Lock() defer r.mu.Unlock() if r.isShutdown { @@ -207,18 +207,18 @@ func (r *periodicReader) RegisterProducer(p Producer) { } // temporality reports the Temporality for the instrument kind provided. -func (r *periodicReader) temporality(kind InstrumentKind) metricdata.Temporality { +func (r *PeriodicReader) temporality(kind InstrumentKind) metricdata.Temporality { return r.exporter.Temporality(kind) } // aggregation returns what Aggregation to use for kind. -func (r *periodicReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (r *PeriodicReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. return r.exporter.Aggregation(kind) } // collectAndExport gather all metric data related to the periodicReader r from // the SDK and exports it with r's exporter. -func (r *periodicReader) collectAndExport(ctx context.Context) error { +func (r *PeriodicReader) collectAndExport(ctx context.Context) error { // TODO (#3047): Use a sync.Pool or persistent pointer instead of allocating rm every Collect. rm := r.rmPool.Get().(*metricdata.ResourceMetrics) err := r.Collect(ctx, rm) @@ -235,7 +235,7 @@ func (r *periodicReader) collectAndExport(ctx context.Context) error { // handle that if desired. // // An error is returned if this is called after Shutdown. An error is return if rm is nil. -func (r *periodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { +func (r *PeriodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { return errors.New("periodic reader: *metricdata.ResourceMetrics is nil") } @@ -244,7 +244,7 @@ func (r *periodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMet } // collect unwraps p as a produceHolder and returns its produce results. -func (r *periodicReader) collect(ctx context.Context, p interface{}, rm *metricdata.ResourceMetrics) error { +func (r *PeriodicReader) collect(ctx context.Context, p interface{}, rm *metricdata.ResourceMetrics) error { if p == nil { return ErrReaderNotRegistered } @@ -275,14 +275,14 @@ func (r *periodicReader) collect(ctx context.Context, p interface{}, rm *metricd } // export exports metric data m using r's exporter. -func (r *periodicReader) export(ctx context.Context, m *metricdata.ResourceMetrics) error { +func (r *PeriodicReader) export(ctx context.Context, m *metricdata.ResourceMetrics) error { c, cancel := context.WithTimeout(ctx, r.timeout) defer cancel() return r.exporter.Export(c, m) } // ForceFlush flushes pending telemetry. -func (r *periodicReader) ForceFlush(ctx context.Context) error { +func (r *PeriodicReader) ForceFlush(ctx context.Context) error { errCh := make(chan error, 1) select { case r.flushCh <- errCh: @@ -304,7 +304,7 @@ func (r *periodicReader) ForceFlush(ctx context.Context) error { } // Shutdown flushes pending telemetry and then stops the export pipeline. -func (r *periodicReader) Shutdown(ctx context.Context) error { +func (r *PeriodicReader) Shutdown(ctx context.Context) error { err := ErrReaderShutdown r.shutdownOnce.Do(func() { // Stop the run loop. From 0396b9b7ac2dc75785106b1d0208aa22725e73ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 23 Jun 2023 16:25:54 +0200 Subject: [PATCH 574/886] sdk/metric: Document concurrent safety (#4252) --- sdk/metric/exporter.go | 4 ++++ sdk/metric/manual_reader.go | 8 ++++++++ sdk/metric/periodic_reader.go | 8 ++++++++ sdk/metric/reader.go | 8 ++++++++ 4 files changed, 28 insertions(+) diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 1333e5a06bc..b4f7c7b72f9 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -55,6 +55,8 @@ type Exporter interface { // // The deadline or cancellation of the passed context must be honored. An // appropriate error should be returned in these situations. + // + // This method needs to be concurrent safe. ForceFlush(context.Context) error // Shutdown flushes all metric data held by an exporter and releases any @@ -65,5 +67,7 @@ type Exporter interface { // // After Shutdown is called, calls to Export will perform no operation and // instead will return an error indicating the shutdown state. + // + // This method needs to be concurrent safe. Shutdown(context.Context) error } diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 4d2955e6be7..4069517f9bf 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -66,6 +66,8 @@ func (mr *ManualReader) register(p sdkProducer) { // RegisterProducer stores the external Producer which enables the caller // to read metrics on demand. +// +// This method is safe to call concurrently. func (mr *ManualReader) RegisterProducer(p Producer) { mr.mu.Lock() defer mr.mu.Unlock() @@ -90,11 +92,15 @@ func (mr *ManualReader) aggregation(kind InstrumentKind) aggregation.Aggregation } // ForceFlush is a no-op, it always returns nil. +// +// This method is safe to call concurrently. func (mr *ManualReader) ForceFlush(context.Context) error { return nil } // Shutdown closes any connections and frees any resources used by the reader. +// +// This method is safe to call concurrently. func (mr *ManualReader) Shutdown(context.Context) error { err := ErrReaderShutdown mr.shutdownOnce.Do(func() { @@ -117,6 +123,8 @@ func (mr *ManualReader) Shutdown(context.Context) error { // // Collect will return an error if called after shutdown. // Collect will return an error if rm is a nil ResourceMetrics. +// +// This method is safe to call concurrently. func (mr *ManualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { return errors.New("manual reader: *metricdata.ResourceMetrics is nil") diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 8f1ff2a4c79..1d54aa18535 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -193,6 +193,8 @@ func (r *PeriodicReader) register(p sdkProducer) { } // RegisterProducer registers p as an external Producer of this reader. +// +// This method is safe to call concurrently. func (r *PeriodicReader) RegisterProducer(p Producer) { r.mu.Lock() defer r.mu.Unlock() @@ -235,6 +237,8 @@ func (r *PeriodicReader) collectAndExport(ctx context.Context) error { // handle that if desired. // // An error is returned if this is called after Shutdown. An error is return if rm is nil. +// +// This method is safe to call concurrently. func (r *PeriodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { return errors.New("periodic reader: *metricdata.ResourceMetrics is nil") @@ -282,6 +286,8 @@ func (r *PeriodicReader) export(ctx context.Context, m *metricdata.ResourceMetri } // ForceFlush flushes pending telemetry. +// +// This method is safe to call concurrently. func (r *PeriodicReader) ForceFlush(ctx context.Context) error { errCh := make(chan error, 1) select { @@ -304,6 +310,8 @@ func (r *PeriodicReader) ForceFlush(ctx context.Context) error { } // Shutdown flushes pending telemetry and then stops the export pipeline. +// +// This method is safe to call concurrently. func (r *PeriodicReader) Shutdown(ctx context.Context) error { err := ErrReaderShutdown r.shutdownOnce.Do(func() { diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 3950ea6ecef..acf121e1ff3 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -60,6 +60,8 @@ type Reader interface { // RegisterProducer registers a an external Producer with this Reader. // The Producer is used as a source of aggregated metric data which is // incorporated into metrics collected from the SDK. + // + // This method needs to be concurrent safe. RegisterProducer(Producer) // temporality reports the Temporality for the instrument kind provided. @@ -71,6 +73,8 @@ type Reader interface { // Collect gathers and returns all metric data related to the Reader from // the SDK and stores it in out. An error is returned if this is called // after Shutdown or if out is nil. + // + // This method needs to be concurrent safe. Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error // ForceFlush flushes all metric measurements held in an export pipeline. @@ -79,6 +83,8 @@ type Reader interface { // error will be returned in these situations. There is no guaranteed that all // telemetry be flushed or all resources have been released in these // situations. + // + // This method needs to be concurrent safe. ForceFlush(context.Context) error // Shutdown flushes all metric measurements held in an export pipeline and releases any @@ -91,6 +97,8 @@ type Reader interface { // // After Shutdown is called, calls to Collect will perform no operation and instead will return // an error indicating the shutdown state. + // + // This method needs to be concurrent safe. Shutdown(context.Context) error } From dc187e74af528ce081811c4eae17a7930be1232b Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 25 Jun 2023 09:01:15 -0700 Subject: [PATCH 575/886] dependabot updates Sun Jun 25 15:17:37 UTC 2023 (#4263) Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.56.0 to 1.56.1 in /example/otel-collector --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 5f128e0dbe1..fa281e0a0f0 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/bridge/opentracing v1.16.0 - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 ) require ( diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 8075ad67ca8..b0714a2ddd4 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 171124fc74a..c470b9761f7 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index ccf0bc3b559..64f3036a152 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 9f4b88d85e9..ac1f23829ca 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 38b6d4ff428..94d94285c22 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 7995117797e..611377bbb6f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 2cff2148efb..f0927e9dad6 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 81d27622e37..5284661403a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -31,7 +31,7 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.0 // indirect + google.golang.org/grpc v1.56.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 2cff2148efb..f0927e9dad6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 8560515f986..bdb27e49701 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 38b6d4ff428..94d94285c22 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a462ac8c848..189b024e49a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.20.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.0 + google.golang.org/grpc v1.56.1 google.golang.org/protobuf v1.30.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index f708a065977..032c39111be 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 9f3a8ebcd44..658f517a55d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -27,7 +27,7 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.0 // indirect + google.golang.org/grpc v1.56.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 97b5a25f9f4..b92783208f5 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -36,8 +36,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.0 h1:+y7Bs8rtMd07LeXmL3NxcTLn7mUkbKZqEpPhMNkwJEE= -google.golang.org/grpc v1.56.0/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= From 3b124b39d1f72dae111d6925ed24f4a0c346b33e Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 26 Jun 2023 08:47:39 +0200 Subject: [PATCH 576/886] Count the Collect duration towards the PeriodicReader timeout, and document the behavior (#4221) --- CHANGELOG.md | 1 + sdk/metric/periodic_reader.go | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 162bf639470..9295a0a1f0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Return an error on the creation of new instruments if their name doesn't pass regexp validation. (#4210) - `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) - `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) +- Count the Collect time in the PeriodicReader timeout. (#4221) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 1d54aa18535..4c517bd8cf0 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -104,9 +104,9 @@ func WithInterval(d time.Duration) PeriodicReaderOption { // NewPeriodicReader returns a Reader that collects and exports metric data to // the exporter at a defined interval. By default, the returned Reader will -// collect and export data every 60 seconds, and will cancel export attempts -// that exceed 30 seconds. The export time is not counted towards the interval -// between attempts. +// collect and export data every 60 seconds, and will cancel any attempts that +// exceed 30 seconds, collect and export combined. The collect and export time +// are not counted towards the interval between attempts. // // The Collect method of the returned Reader continues to gather and return // metric data to the user. It will not automatically send that data to the @@ -221,6 +221,9 @@ func (r *PeriodicReader) aggregation(kind InstrumentKind) aggregation.Aggregatio // collectAndExport gather all metric data related to the periodicReader r from // the SDK and exports it with r's exporter. func (r *PeriodicReader) collectAndExport(ctx context.Context) error { + ctx, cancel := context.WithTimeout(ctx, r.timeout) + defer cancel() + // TODO (#3047): Use a sync.Pool or persistent pointer instead of allocating rm every Collect. rm := r.rmPool.Get().(*metricdata.ResourceMetrics) err := r.Collect(ctx, rm) @@ -236,8 +239,8 @@ func (r *PeriodicReader) collectAndExport(ctx context.Context) error { // data is not exported to the configured exporter, it is left to the caller to // handle that if desired. // -// An error is returned if this is called after Shutdown. An error is return if rm is nil. -// +// An error is returned if this is called after Shutdown, if rm is nil or if +// the duration of the collect and export exceeded the timeout. // This method is safe to call concurrently. func (r *PeriodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { @@ -280,9 +283,7 @@ func (r *PeriodicReader) collect(ctx context.Context, p interface{}, rm *metricd // export exports metric data m using r's exporter. func (r *PeriodicReader) export(ctx context.Context, m *metricdata.ResourceMetrics) error { - c, cancel := context.WithTimeout(ctx, r.timeout) - defer cancel() - return r.exporter.Export(c, m) + return r.exporter.Export(ctx, m) } // ForceFlush flushes pending telemetry. From 5e69812435457784b2d6425467ca035c2bf0be3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 26 Jun 2023 16:51:12 +0200 Subject: [PATCH 577/886] Update OTel Demo during release (#4256) --- RELEASING.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASING.md b/RELEASING.md index f8ad277f59c..43bfecd3308 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -126,3 +126,11 @@ Importantly, bump any package versions referenced to be the latest one you just [OpenTelemetry Specification]: https://github.com/open-telemetry/opentelemetry-specification [Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ [content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go + +### Demo Repository + +Bump the dependencies in the following Go services: + +- [`accountingservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accountingservice) +- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkoutservice) +- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/productcatalogservice) From 1b02c9122dadecd52e94dfbe3d456593da884e84 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 26 Jun 2023 09:54:35 -0700 Subject: [PATCH 578/886] Format log message before logging with logr (#4143) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Format log message before logging with logr Fixes #4141 The logr calling convention does not support fmt semantics for message formatting. Format the message before it is sent to logr for logging. * Add change to changelog * Fix lint Don't shadow the log pkg. * Replace buflogr with funcr * Run make * Update exporters/zipkin/zipkin_test.go Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 4 ++++ exporters/zipkin/zipkin.go | 2 +- exporters/zipkin/zipkin_test.go | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9295a0a1f0c..94604fe6870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) - Count the Collect time in the PeriodicReader timeout. (#4221) +### Fixed + +- Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) + ## [1.16.0/0.39.0] 2023-05-18 This release contains the first stable release of the OpenTelemetry Go [metric API]. diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index b21a0190c2d..751e9e3191a 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -181,7 +181,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error { func (e *Exporter) logf(format string, args ...interface{}) { if e.logger != emptyLogger { - e.logger.Info(format, args) + e.logger.Info(fmt.Sprintf(format, args...)) } } diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 3bcd431f3de..9fbe5fe0a4f 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -15,6 +15,7 @@ package zipkin import ( + "bytes" "context" "encoding/json" "fmt" @@ -28,6 +29,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" + "github.com/go-logr/logr/funcr" zkmodel "github.com/openzipkin/zipkin-go/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -364,3 +366,21 @@ func TestErrorOnExportShutdownExporter(t *testing.T) { assert.NoError(t, exp.Shutdown(context.Background())) assert.NoError(t, exp.ExportSpans(context.Background(), nil)) } + +func TestLogrFormatting(t *testing.T) { + format := "string %q, int %d" + args := []interface{}{"s", 1} + + var buf bytes.Buffer + l := funcr.New(func(prefix, args string) { + _, _ = buf.WriteString(fmt.Sprint(prefix, args)) + }, funcr.Options{}) + exp, err := New("", WithLogr(l)) + require.NoError(t, err) + + exp.logf(format, args...) + + want := "\"level\"=0 \"msg\"=\"string \\\"s\\\", int 1\"" + got := buf.String() + assert.Equal(t, want, got) +} From 8e25817dd1475eb298d9e7b332ade7515464bfc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 27 Jun 2023 23:27:18 +0200 Subject: [PATCH 579/886] Document f in RegisterCallback needs to be concurrent safe (#4251) * Document f in RegisterCallback needs to be concurrent safe * Update metric/meter.go Co-authored-by: Tyler Yahn --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- metric/meter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metric/meter.go b/metric/meter.go index 8e1917c3214..2520bc74af1 100644 --- a/metric/meter.go +++ b/metric/meter.go @@ -157,6 +157,8 @@ type Meter interface { // // If no instruments are passed, f should not be registered nor called // during collection. + // + // The function f needs to be concurrent safe. RegisterCallback(f Callback, instruments ...Observable) (Registration, error) } From 64e76f8be45c9f4df85344249fad0fb72cff1230 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Thu, 29 Jun 2023 13:20:47 +0200 Subject: [PATCH 580/886] Document and test honoring context in metric readers Collect (#4267) --- sdk/metric/manual_reader.go | 1 + sdk/metric/manual_reader_test.go | 50 ++++++++++++++++++++++++++++++ sdk/metric/periodic_reader.go | 6 ++-- sdk/metric/periodic_reader_test.go | 48 ++++++++++++++++++++++++++++ sdk/metric/reader.go | 3 +- 5 files changed, 105 insertions(+), 3 deletions(-) diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 4069517f9bf..3864e2f0694 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -123,6 +123,7 @@ func (mr *ManualReader) Shutdown(context.Context) error { // // Collect will return an error if called after shutdown. // Collect will return an error if rm is a nil ResourceMetrics. +// Collect will return an error if the context's Done channel is closed. // // This method is safe to call concurrently. func (mr *ManualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 8d71aeb18b7..485c1b6eaf0 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -15,11 +15,14 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "context" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -71,3 +74,50 @@ func TestManualReaderTemporality(t *testing.T) { }) } } + +func TestManualReaderCollect(t *testing.T) { + expiredCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-1)) + defer cancel() + + tests := []struct { + name string + + ctx context.Context + resourceMetrics *metricdata.ResourceMetrics + + expectedErr error + }{ + { + name: "with a valid context", + + ctx: context.Background(), + resourceMetrics: &metricdata.ResourceMetrics{}, + }, + { + name: "with an expired context", + + ctx: expiredCtx, + resourceMetrics: &metricdata.ResourceMetrics{}, + + expectedErr: context.DeadlineExceeded, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + rdr := NewManualReader() + mp := NewMeterProvider(WithReader(rdr)) + meter := mp.Meter("test") + + // Ensure the pipeline has a callback setup + testM, err := meter.Int64ObservableCounter("test") + assert.NoError(t, err) + _, err = meter.RegisterCallback(func(_ context.Context, o metric.Observer) error { + return nil + }, testM) + assert.NoError(t, err) + + assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, tt.resourceMetrics)) + }) + } +} diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 4c517bd8cf0..17cb1be1104 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -239,8 +239,10 @@ func (r *PeriodicReader) collectAndExport(ctx context.Context) error { // data is not exported to the configured exporter, it is left to the caller to // handle that if desired. // -// An error is returned if this is called after Shutdown, if rm is nil or if -// the duration of the collect and export exceeded the timeout. +// Collect will return an error if called after shutdown. +// Collect will return an error if rm is a nil ResourceMetrics. +// Collect will return an error if the context's Done channel is closed. +// // This method is safe to call concurrently. func (r *PeriodicReader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { if rm == nil { diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 43c60bc7a93..e5d8fd2ef30 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/suite" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -377,3 +378,50 @@ func TestPeriodiclReaderTemporality(t *testing.T) { }) } } + +func TestPeriodicReaderCollect(t *testing.T) { + expiredCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-1)) + defer cancel() + + tests := []struct { + name string + + ctx context.Context + resourceMetrics *metricdata.ResourceMetrics + + expectedErr error + }{ + { + name: "with a valid context", + + ctx: context.Background(), + resourceMetrics: &metricdata.ResourceMetrics{}, + }, + { + name: "with an expired context", + + ctx: expiredCtx, + resourceMetrics: &metricdata.ResourceMetrics{}, + + expectedErr: context.DeadlineExceeded, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + rdr := NewPeriodicReader(new(fnExporter)) + mp := NewMeterProvider(WithReader(rdr)) + meter := mp.Meter("test") + + // Ensure the pipeline has a callback setup + testM, err := meter.Int64ObservableCounter("test") + assert.NoError(t, err) + _, err = meter.RegisterCallback(func(_ context.Context, o metric.Observer) error { + return nil + }, testM) + assert.NoError(t, err) + + assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, tt.resourceMetrics)) + }) + } +} diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index acf121e1ff3..95d8f0d2231 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -74,7 +74,8 @@ type Reader interface { // the SDK and stores it in out. An error is returned if this is called // after Shutdown or if out is nil. // - // This method needs to be concurrent safe. + // This method needs to be concurrent safe, and the cancelation of the + // passed context is expected to be honored. Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error // ForceFlush flushes all metric measurements held in an export pipeline. From 457029232db58984067d66f5c48d3ed461b153ac Mon Sep 17 00:00:00 2001 From: Max Chechel Date: Thu, 29 Jun 2023 15:31:20 +0400 Subject: [PATCH 581/886] Prometheus exporter: concurrent collect bugfix (#3899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Concurrent collect bugfix * Used sync.Mutex and code cleanup * Revert "Concurrent collect bugfix" This reverts commit 1a30f233b67c329c04c85652c6d397be0440a2f1. * Used sync.Mutex and re-grouped protected members * Added test and updated changelog * Updated changelog * Take care of potential panic in otel.Handle * Extracted critical section in a separate method and fixed nil scope info * Lock the whole scope of the func * Moved otel.Handle out of the critical section * Fixed calling createScopeInfoMetric twice and updated changelog * Fixed markdown linter errors * Added test for nil scopeinfo * Fix merge artifacts * Fixed linter errors * Protect the whole validateMetrics method wity mutex * Update CHANGELOG.md * Update exporters/prometheus/exporter.go Co-authored-by: Robert Pająk * Update CHANGELOG.md * Document that Collect is concurrent-safe * Update exporter_test.go * Update exporters/prometheus/exporter_test.go * Update exporters/prometheus/exporter.go Co-authored-by: David Ashpole --------- Co-authored-by: Robert Pająk Co-authored-by: David Ashpole --- CHANGELOG.md | 2 + exporters/prometheus/exporter.go | 175 ++++++++++++++++---------- exporters/prometheus/exporter_test.go | 165 ++++++++++++++++++++++++ 3 files changed, 275 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94604fe6870..3e75102b2d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -209,6 +209,8 @@ This release drops the compatibility guarantee of [Go 1.18]. - Handle empty environment variable as it they were not set. (#3764) - Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823) +- Fix race conditions in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic. (#3899) +- Fix sending nil `scopeInfo` to metrics channel in `go.opentelemetry.io/otel/exporters/metric/prometheus` that could cause a panic in `github.com/prometheus/client_golang/prometheus`. (#3899) ### Deprecated diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 653d8c38136..4fdbcfa174f 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -59,14 +59,15 @@ var _ metric.Reader = &Exporter{} type collector struct { reader metric.Reader - disableTargetInfo bool - withoutUnits bool - targetInfo prometheus.Metric - disableScopeInfo bool - createTargetInfoOnce sync.Once - scopeInfos map[instrumentation.Scope]prometheus.Metric - metricFamilies map[string]*dto.MetricFamily - namespace string + withoutUnits bool + disableScopeInfo bool + namespace string + + mu sync.Mutex // mu protects all members below from the concurrent access. + disableTargetInfo bool + targetInfo prometheus.Metric + scopeInfos map[instrumentation.Scope]prometheus.Metric + metricFamilies map[string]*dto.MetricFamily } // prometheus counters MUST have a _total suffix: @@ -113,6 +114,8 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) { } // Collect implements prometheus.Collector. +// +// This method is safe to call concurrently. func (c *collector) Collect(ch chan<- prometheus.Metric) { // TODO (#3047): Use a sync.Pool instead of allocating metrics every Collect. metrics := metricdata.ResourceMetrics{} @@ -124,16 +127,24 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } } - c.createTargetInfoOnce.Do(func() { - // Resource should be immutable, we don't need to compute again - targetInfo, err := c.createInfoMetric(targetInfoMetricName, targetInfoDescription, metrics.Resource) - if err != nil { - // If the target info metric is invalid, disable sending it. - otel.Handle(err) - c.disableTargetInfo = true + // Initialize (once) targetInfo and disableTargetInfo. + func() { + c.mu.Lock() + defer c.mu.Unlock() + + if c.targetInfo == nil && !c.disableTargetInfo { + targetInfo, err := createInfoMetric(targetInfoMetricName, targetInfoDescription, metrics.Resource) + if err != nil { + // If the target info metric is invalid, disable sending it. + c.disableTargetInfo = true + otel.Handle(err) + return + } + + c.targetInfo = targetInfo } - c.targetInfo = targetInfo - }) + }() + if !c.disableTargetInfo { ch <- c.targetInfo } @@ -142,48 +153,53 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { var keys, values [2]string if !c.disableScopeInfo { - scopeInfo, ok := c.scopeInfos[scopeMetrics.Scope] - if !ok { - scopeInfo, err = createScopeInfoMetric(scopeMetrics.Scope) - if err != nil { - otel.Handle(err) - } - c.scopeInfos[scopeMetrics.Scope] = scopeInfo + scopeInfo, err := c.scopeInfo(scopeMetrics.Scope) + if err != nil { + otel.Handle(err) + continue } + ch <- scopeInfo + keys = scopeInfoKeys values = [2]string{scopeMetrics.Scope.Name, scopeMetrics.Scope.Version} } for _, m := range scopeMetrics.Metrics { + typ, name := c.metricTypeAndName(m) + if typ == nil { + continue + } + + drop, help := c.validateMetrics(name, m.Description, typ) + if drop { + continue + } + + if help != "" { + m.Description = help + } + switch v := m.Data.(type) { case metricdata.Histogram[int64]: - addHistogramMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addHistogramMetric(ch, v, m, keys, values, name) case metricdata.Histogram[float64]: - addHistogramMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addHistogramMetric(ch, v, m, keys, values, name) case metricdata.Sum[int64]: - addSumMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addSumMetric(ch, v, m, keys, values, name) case metricdata.Sum[float64]: - addSumMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addSumMetric(ch, v, m, keys, values, name) case metricdata.Gauge[int64]: - addGaugeMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addGaugeMetric(ch, v, m, keys, values, name) case metricdata.Gauge[float64]: - addGaugeMetric(ch, v, m, keys, values, c.getName(m), c.metricFamilies) + addGaugeMetric(ch, v, m, keys, values, name) } } } } -func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { +func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars - drop, help := validateMetrics(name, m.Description, dto.MetricType_HISTOGRAM.Enum(), mfs) - if drop { - return - } - if help != "" { - m.Description = help - } - for _, dp := range histogram.DataPoints { keys, values := getAttrs(dp.Attributes, ks, vs) @@ -204,24 +220,10 @@ func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogra } } -func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string) { valueType := prometheus.CounterValue - metricType := dto.MetricType_COUNTER if !sum.IsMonotonic { valueType = prometheus.GaugeValue - metricType = dto.MetricType_GAUGE - } - if sum.IsMonotonic { - // Add _total suffix for counters - name += counterSuffix - } - - drop, help := validateMetrics(name, m.Description, metricType.Enum(), mfs) - if drop { - return - } - if help != "" { - m.Description = help } for _, dp := range sum.DataPoints { @@ -237,15 +239,7 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata } } -func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string, mfs map[string]*dto.MetricFamily) { - drop, help := validateMetrics(name, m.Description, dto.MetricType_GAUGE.Enum(), mfs) - if drop { - return - } - if help != "" { - m.Description = help - } - +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string) { for _, dp := range gauge.DataPoints { keys, values := getAttrs(dp.Attributes, ks, vs) @@ -293,7 +287,7 @@ func getAttrs(attrs attribute.Set, ks, vs [2]string) ([]string, []string) { return keys, values } -func (c *collector) createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { +func createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { keys, values := getAttrs(*res.Set(), [2]string{}, [2]string{}) desc := prometheus.NewDesc(name, description, keys, nil) return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) @@ -386,16 +380,63 @@ func sanitizeName(n string) string { return b.String() } -func validateMetrics(name, description string, metricType *dto.MetricType, mfs map[string]*dto.MetricFamily) (drop bool, help string) { - emf, exist := mfs[name] +func (c *collector) metricTypeAndName(m metricdata.Metrics) (*dto.MetricType, string) { + name := c.getName(m) + + switch v := m.Data.(type) { + case metricdata.Histogram[int64], metricdata.Histogram[float64]: + return dto.MetricType_HISTOGRAM.Enum(), name + case metricdata.Sum[float64]: + if v.IsMonotonic { + return dto.MetricType_COUNTER.Enum(), name + counterSuffix + } + return dto.MetricType_GAUGE.Enum(), name + case metricdata.Sum[int64]: + if v.IsMonotonic { + return dto.MetricType_COUNTER.Enum(), name + counterSuffix + } + return dto.MetricType_GAUGE.Enum(), name + case metricdata.Gauge[int64], metricdata.Gauge[float64]: + return dto.MetricType_GAUGE.Enum(), name + } + + return nil, "" +} + +func (c *collector) scopeInfo(scope instrumentation.Scope) (prometheus.Metric, error) { + c.mu.Lock() + defer c.mu.Unlock() + + scopeInfo, ok := c.scopeInfos[scope] + if ok { + return scopeInfo, nil + } + + scopeInfo, err := createScopeInfoMetric(scope) + if err != nil { + return nil, fmt.Errorf("cannot create scope info metric: %w", err) + } + + c.scopeInfos[scope] = scopeInfo + + return scopeInfo, nil +} + +func (c *collector) validateMetrics(name, description string, metricType *dto.MetricType) (drop bool, help string) { + c.mu.Lock() + defer c.mu.Unlock() + + emf, exist := c.metricFamilies[name] + if !exist { - mfs[name] = &dto.MetricFamily{ + c.metricFamilies[name] = &dto.MetricFamily{ Name: proto.String(name), Help: proto.String(description), Type: metricType, } return false, "" } + if emf.GetType() != *metricType { global.Error( errors.New("instrument type conflict"), diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 3f014971dc1..2af7d71ba8a 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -17,15 +17,19 @@ package prometheus import ( "context" "os" + "strings" "testing" + "time" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" + dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" @@ -672,3 +676,164 @@ func TestDuplicateMetrics(t *testing.T) { }) } } + +func TestCollectConcurrentSafe(t *testing.T) { + registry := prometheus.NewRegistry() + cfg := newConfig(WithRegisterer(registry)) + + reader := metric.NewManualReader(cfg.manualReaderOptions()...) + + collector := &collector{ + reader: reader, + disableTargetInfo: false, + withoutUnits: true, + disableScopeInfo: cfg.disableScopeInfo, + scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + metricFamilies: make(map[string]*dto.MetricFamily), + } + + err := cfg.registerer.Register(collector) + require.NoError(t, err) + + ctx := context.Background() + + // initialize resource + res, err := resource.New(ctx, + resource.WithAttributes(semconv.ServiceName("prometheus_test")), + resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), + ) + require.NoError(t, err) + res, err = resource.Merge(resource.Default(), res) + require.NoError(t, err) + + exporter := &Exporter{Reader: reader} + + // initialize provider + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + metric.WithResource(res), + ) + + // initialize two meter a, b + meterA := provider.Meter("ma", otelmetric.WithInstrumentationVersion("v0.1.0")) + meterB := provider.Meter("mb", otelmetric.WithInstrumentationVersion("v0.1.0")) + + fooA, err := meterA.Int64Counter("foo", + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter counter foo")) + assert.NoError(t, err) + + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + ) + + fooA.Add(ctx, 100, opt) + + fooB, err := meterB.Int64Counter("foo", + otelmetric.WithUnit("By"), + otelmetric.WithDescription("meter counter foo")) + assert.NoError(t, err) + fooB.Add(ctx, 100, opt) + + concurrencyLevel := 100 + ch := make(chan prometheus.Metric, concurrencyLevel) + + for i := 0; i < concurrencyLevel; i++ { + go func() { + collector.Collect(ch) + }() + } + + for ; concurrencyLevel > 0; concurrencyLevel-- { + select { + case <-ch: + concurrencyLevel-- + if concurrencyLevel == 0 { + return + } + case <-time.After(time.Second): + t.Fatal("timeout") + } + } +} + +func TesInvalidInsrtrumentForPrometheusIsIgnored(t *testing.T) { + registry := prometheus.NewRegistry() + cfg := newConfig(WithRegisterer(registry)) + + reader := metric.NewManualReader(cfg.manualReaderOptions()...) + + collector := &collector{ + reader: reader, + disableTargetInfo: false, + withoutUnits: true, + disableScopeInfo: false, + scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + metricFamilies: make(map[string]*dto.MetricFamily), + } + + err := cfg.registerer.Register(collector) + require.NoError(t, err) + + ctx := context.Background() + + // initialize resource + res, err := resource.New(ctx, + resource.WithAttributes(semconv.ServiceName("prometheus_test")), + resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), + ) + require.NoError(t, err) + res, err = resource.Merge(resource.Default(), res) + require.NoError(t, err) + + exporter := &Exporter{Reader: reader} + + // initialize provider + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + metric.WithResource(res), + ) + + // invalid label or metric name leads to error returned from + // createScopeInfoMetric + invalidName := string([]byte{0xff, 0xfe, 0xfd}) + validName := "validName" + + meterA := provider.Meter(invalidName, otelmetric.WithInstrumentationVersion("v0.1.0")) + + counterA, err := meterA.Int64Counter("with-invalid-description", + otelmetric.WithUnit("By"), + otelmetric.WithDescription(invalidName)) + assert.NoError(t, err) + + counterA.Add(ctx, 100, otelmetric.WithAttributes( + attribute.Key(invalidName).String(invalidName), + )) + + meterB := provider.Meter(validName, otelmetric.WithInstrumentationVersion("v0.1.0")) + counterB, err := meterB.Int64Counter(validName, + otelmetric.WithUnit("By"), + otelmetric.WithDescription(validName)) + assert.NoError(t, err) + + counterB.Add(ctx, 100, otelmetric.WithAttributes( + attribute.Key(validName).String(validName), + )) + + ch := make(chan prometheus.Metric) + + go collector.Collect(ch) + + for { + select { + case m := <-ch: + require.NotNil(t, m) + + if strings.Contains(m.Desc().String(), validName) { + return + } + case <-time.After(time.Second): + t.Fatalf("timeout") + } + } +} From d57569379f48f5d6f499dabd734a0ba0aaa37cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 30 Jun 2023 09:19:59 +0200 Subject: [PATCH 582/886] otlpmetric: Fix serialization of time.Time zero values (#4271) --- CHANGELOG.md | 1 + .../internal/transform/metricdata.go | 27 +++++++++++++---- .../internal/transform/metricdata_test.go | 29 ++++++++++++++++--- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e75102b2d7..4dae896c6e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078) - The Exponential Histogram data types in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#4165) - OTLP metrics exporter now supports the Exponential Histogram Data Type. (#4222) +- Fix serialization of `time.Time` zero values in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` packages. (#4271) ### Changed diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go index 809ddbdf570..4ca2f958fa8 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata.go @@ -16,6 +16,7 @@ package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/ import ( "fmt" + "time" "go.opentelemetry.io/otel/sdk/metric/metricdata" cpb "go.opentelemetry.io/proto/otlp/common/v1" @@ -140,8 +141,8 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number for _, dPt := range dPts { ndp := &mpb.NumberDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), - TimeUnixNano: uint64(dPt.Time.UnixNano()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), } switch v := any(dPt.Value).(type) { case int64: @@ -181,8 +182,8 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint sum := float64(dPt.Sum) hdp := &mpb.HistogramDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), - TimeUnixNano: uint64(dPt.Time.UnixNano()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), Count: dPt.Count, Sum: &sum, BucketCounts: dPt.BucketCounts, @@ -224,8 +225,8 @@ func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.Exponen sum := float64(dPt.Sum) ehdp := &mpb.ExponentialHistogramDataPoint{ Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: uint64(dPt.StartTime.UnixNano()), - TimeUnixNano: uint64(dPt.Time.UnixNano()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), Count: dPt.Count, Sum: &sum, Scale: dPt.Scale, @@ -270,3 +271,17 @@ func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err } } + +// timeUnixNano returns t as a Unix time, the number of nanoseconds elapsed +// since January 1, 1970 UTC as uint64. +// The result is undefined if the Unix time +// in nanoseconds cannot be represented by an int64 +// (a date before the year 1678 or after 2262). +// timeUnixNano on the zero Time returns 0. +// The result does not depend on the location associated with t. +func timeUnixNano(t time.Time) uint64 { + if t.IsZero() { + return 0 + } + return uint64(t.UnixNano()) +} diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index d6ffa7c2c06..8110f0868fb 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -334,11 +334,20 @@ var ( DataPoints: pbDPtsFloat64, } - otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} - otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} + otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + otelGaugeZeroStartTime = metricdata.Gauge[int64]{DataPoints: []metricdata.DataPoint[int64]{{Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}}} - pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} - pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} + pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + pbGaugeZeroStartTime = &mpb.Gauge{DataPoints: []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: 0, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + }} unknownAgg unknownAggT otelMetrics = []metricdata.Metrics{ @@ -414,6 +423,12 @@ var ( Unit: "1", Data: otelExpoHistInvalid, }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: otelGaugeZeroStartTime, + }, } pbMetrics = []*mpb.Metric{ @@ -465,6 +480,12 @@ var ( Unit: "1", Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeZeroStartTime}, + }, } otelScopeMetrics = []metricdata.ScopeMetrics{{ From 41cd6a136f95b3350f5ae895532cc58c943d1a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 30 Jun 2023 13:05:35 +0200 Subject: [PATCH 583/886] Fix dependabot-check and vanity-import-check targets (#4273) --- .github/dependabot.yml | 9 +++++++++ Makefile | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8dcd4f9dd90..08b13a0543f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -307,3 +307,12 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: pip + directory: / + labels: + - dependencies + - python + - Skip Changelog + schedule: + interval: weekly + day: sunday diff --git a/Makefile b/Makefile index dc22bb77cb5..87b9211dbd0 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ lint: misspell lint-modules golangci-lint .PHONY: vanity-import-check vanity-import-check: | $(PORTO) - @$(PORTO) --include-internal -l . || echo "(run: make vanity-import-fix)" + @$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 ) .PHONY: misspell misspell: | $(MISSPELL) @@ -237,7 +237,7 @@ license-check: DEPENDABOT_CONFIG = .github/dependabot.yml .PHONY: dependabot-check dependabot-check: | $(DBOTCONF) - @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || echo "(run: make dependabot-generate)" + @$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 ) .PHONY: dependabot-generate dependabot-generate: | $(DBOTCONF) From 56609f8da96d828ac8faaae8a1270d44e450b2fe Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:15:19 -0700 Subject: [PATCH 584/886] dependabot updates Fri Jun 30 12:35:32 UTC 2023 (#4282) Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlpmetric Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/prometheus Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 in /exporters/otlp/otlptrace/otlptracegrpc --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 24 files changed, 36 insertions(+), 36 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index fa281e0a0f0..fc7beadd2eb 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index b0714a2ddd4..9fa39fe3611 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -58,8 +58,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index c470b9761f7..75c01d38cdf 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -30,7 +30,7 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 64f3036a152..6f8f193f14f 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -35,6 +35,6 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1a70b897ed3..95af4577044 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -23,7 +23,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.9.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 960ff14d4ef..cf3b2fe680d 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -32,6 +32,6 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/view/go.mod b/example/view/go.mod index 49ae7245f6b..b4a7e9a0a7e 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.9.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/view/go.sum b/example/view/go.sum index 960ff14d4ef..cf3b2fe680d 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -32,6 +32,6 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index ac1f23829ca..38ef6330f2d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 94d94285c22..ccb38f776c0 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -44,8 +44,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 611377bbb6f..f3f01252bff 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index f0927e9dad6..a0fac3b3bfb 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -41,8 +41,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 5284661403a..40d51a666d1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index f0927e9dad6..a0fac3b3bfb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -41,8 +41,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index bdb27e49701..c5d36d26cad 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 94d94285c22..ccb38f776c0 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -44,8 +44,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 189b024e49a..e60e9f4841f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.56.1 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 032c39111be..3e7499f83e8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -42,8 +42,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 658f517a55d..8ae0a5f4951 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index b92783208f5..6b7e79e88cd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -40,8 +40,8 @@ google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 6438cd53a87..a38a878ebe5 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index e438920960e..2789eb41529 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -41,8 +41,8 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 614a8121b1e..3ddf82a7296 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -202,7 +202,7 @@ require ( golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.9.0 // indirect golang.org/x/text v0.10.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ebc35ed166e..fa9d8810084 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1028,8 +1028,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 7ebfa8abf98e9b7781bc6bf68534ddcbb79a3426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Sat, 1 Jul 2023 16:20:35 +0200 Subject: [PATCH 585/886] Add otlpmetricgrpc.Expoter and otlpmetrichttp.Exporter (#4272) * Add otlpmetricgrpc.Expoter and otlpmetrichttp.Exporter * Update changelog --- CHANGELOG.md | 4 + .../otlp/otlpmetric/internal/exporter.go | 18 ++-- .../otlp/otlpmetric/otlpmetricgrpc/client.go | 16 ---- .../otlpmetric/otlpmetricgrpc/exporter.go | 85 +++++++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 11 --- .../otlpmetric/otlpmetrichttp/exporter.go | 80 +++++++++++++++++ 6 files changed, 178 insertions(+), 36 deletions(-) create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dae896c6e7..258c09bda9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) +- Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) ### Changed @@ -21,6 +23,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) - `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) - Count the Collect time in the PeriodicReader timeout. (#4221) +- `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) ### Fixed diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index e1d912dabdd..fe4b4a7868b 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -26,8 +26,8 @@ import ( mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -// exporter exports metrics data as OTLP. -type exporter struct { +// Exporter exports metrics data as OTLP. +type Exporter struct { // Ensure synchronous access to the client across all functionality. clientMu sync.Mutex client Client @@ -36,21 +36,21 @@ type exporter struct { } // Temporality returns the Temporality to use for an instrument kind. -func (e *exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { +func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { e.clientMu.Lock() defer e.clientMu.Unlock() return e.client.Temporality(k) } // Aggregation returns the Aggregation to use for an instrument kind. -func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { e.clientMu.Lock() defer e.clientMu.Unlock() return e.client.Aggregation(k) } // Export transforms and transmits metric data to an OTLP receiver. -func (e *exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { +func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { otlpRm, err := transform.ResourceMetrics(rm) // Best effort upload of transformable metrics. e.clientMu.Lock() @@ -67,7 +67,7 @@ func (e *exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e } // ForceFlush flushes any metric data held by an exporter. -func (e *exporter) ForceFlush(ctx context.Context) error { +func (e *Exporter) ForceFlush(ctx context.Context) error { // The Exporter does not hold data, forward the command to the client. e.clientMu.Lock() defer e.clientMu.Unlock() @@ -78,7 +78,7 @@ var errShutdown = fmt.Errorf("exporter is shutdown") // Shutdown flushes all metric data held by an exporter and releases any held // computational resources. -func (e *exporter) Shutdown(ctx context.Context) error { +func (e *Exporter) Shutdown(ctx context.Context) error { err := errShutdown e.shutdownOnce.Do(func() { e.clientMu.Lock() @@ -96,8 +96,8 @@ func (e *exporter) Shutdown(ctx context.Context) error { // New return an Exporter that uses client to transmits the OTLP data it // produces. The client is assumed to be fully started and able to communicate // with its OTLP receiving endpoint. -func New(client Client) metric.Exporter { - return &exporter{client: client} +func New(client Client) *Exporter { + return &Exporter{client: client} } type shutdownClient struct { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 3f41820be1f..34522669f47 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -36,22 +36,6 @@ import ( metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -// New returns an OpenTelemetry metric Exporter. The Exporter can be used with -// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving -// endpoint using gRPC. -// -// If an already established gRPC ClientConn is not passed in options using -// WithGRPCConn, a connection to the OTLP endpoint will be established based -// on options. If a connection cannot be establishes in the lifetime of ctx, -// an error will be returned. -func New(ctx context.Context, options ...Option) (metric.Exporter, error) { - c, err := newClient(ctx, options...) - if err != nil { - return nil, err - } - return ominternal.New(c), nil -} - type client struct { metadata metadata.MD exportTimeout time.Duration diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go new file mode 100644 index 00000000000..3b29613a7b4 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go @@ -0,0 +1,85 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + +import ( + "context" + + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Exporter is a OpenTelemetry metric Exporter using gRPC. +type Exporter struct { + wrapped *ominternal.Exporter +} + +// Temporality returns the Temporality to use for an instrument kind. +func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { + return e.wrapped.Temporality(k) +} + +// Aggregation returns the Aggregation to use for an instrument kind. +func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { + return e.wrapped.Aggregation(k) +} + +// Export transforms and transmits metric data to an OTLP receiver. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { + return e.wrapped.Export(ctx, rm) +} + +// ForceFlush flushes any metric data held by an exporter. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +// +// This method is safe to call concurrently. +func (e *Exporter) ForceFlush(ctx context.Context) error { + return e.wrapped.ForceFlush(ctx) +} + +// Shutdown flushes all metric data held by an exporter and releases any held +// computational resources. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +// +// This method is safe to call concurrently. +func (e *Exporter) Shutdown(ctx context.Context) error { + return e.wrapped.Shutdown(ctx) +} + +// New returns an OpenTelemetry metric Exporter. The Exporter can be used with +// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving +// endpoint using gRPC. +// +// If an already established gRPC ClientConn is not passed in options using +// WithGRPCConn, a connection to the OTLP endpoint will be established based +// on options. If a connection cannot be establishes in the lifetime of ctx, +// an error will be returned. +func New(ctx context.Context, options ...Option) (*Exporter, error) { + c, err := newClient(ctx, options...) + if err != nil { + return nil, err + } + exp := ominternal.New(c) + return &Exporter{exp}, nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 8b90a090b87..81d84995aeb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -41,17 +41,6 @@ import ( metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) -// New returns an OpenTelemetry metric Exporter. The Exporter can be used with -// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving -// endpoint using protobufs over HTTP. -func New(_ context.Context, opts ...Option) (metric.Exporter, error) { - c, err := newClient(opts...) - if err != nil { - return nil, err - } - return ominternal.New(c), nil -} - type client struct { // req is cloned for every upload the client makes. req *http.Request diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go new file mode 100644 index 00000000000..b84ffc34f18 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go @@ -0,0 +1,80 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + +import ( + "context" + + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Exporter is a OpenTelemetry metric Exporter using protobufs over HTTP. +type Exporter struct { + wrapped *ominternal.Exporter +} + +// Temporality returns the Temporality to use for an instrument kind. +func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { + return e.wrapped.Temporality(k) +} + +// Aggregation returns the Aggregation to use for an instrument kind. +func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { + return e.wrapped.Aggregation(k) +} + +// Export transforms and transmits metric data to an OTLP receiver. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { + return e.wrapped.Export(ctx, rm) +} + +// ForceFlush flushes any metric data held by an exporter. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +// +// This method is safe to call concurrently. +func (e *Exporter) ForceFlush(ctx context.Context) error { + return e.wrapped.ForceFlush(ctx) +} + +// Shutdown flushes all metric data held by an exporter and releases any held +// computational resources. +// +// This method returns an error if called after Shutdown. +// This method returns an error if the method is canceled by the passed context. +// +// This method is safe to call concurrently. +func (e *Exporter) Shutdown(ctx context.Context) error { + return e.wrapped.Shutdown(ctx) +} + +// New returns an OpenTelemetry metric Exporter. The Exporter can be used with +// a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving +// endpoint using protobufs over HTTP. +func New(_ context.Context, opts ...Option) (*Exporter, error) { + c, err := newClient(opts...) + if err != nil { + return nil, err + } + exp := ominternal.New(c) + return &Exporter{exp}, nil +} From 97273da7c94e680352460bc5bfded94317c273bf Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 2 Jul 2023 07:17:46 -0700 Subject: [PATCH 586/886] Use newPipeline instead of direct construction (#4285) * Use newPipeline instead of direct construction The newPipeline function exists to create a new pipeline, but it is not currently used. This switches to using that as the default creation method and removes the test for construction of a pipeline directly. * Update sdk/metric/pipeline.go --- sdk/metric/pipeline.go | 14 +++++--------- sdk/metric/pipeline_test.go | 25 ------------------------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 4190f1496ee..52044a5ddd6 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -57,10 +57,10 @@ func newPipeline(res *resource.Resource, reader Reader, views []View) *pipeline res = resource.Empty() } return &pipeline{ - resource: res, - reader: reader, - views: views, - aggregations: make(map[instrumentation.Scope][]instrumentSync), + resource: res, + reader: reader, + views: views, + // aggregations is lazy allocated when needed. } } @@ -486,11 +486,7 @@ type pipelines []*pipeline func newPipelines(res *resource.Resource, readers []Reader, views []View) pipelines { pipes := make([]*pipeline, 0, len(readers)) for _, r := range readers { - p := &pipeline{ - resource: res, - reader: r, - views: views, - } + p := newPipeline(res, r, views) r.register(p) pipes = append(pipes, p) } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 581ab595776..f51ad292970 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -39,31 +39,6 @@ func (testSumAggregator) Aggregation() metricdata.Aggregation { DataPoints: []metricdata.DataPoint[int64]{}} } -func TestEmptyPipeline(t *testing.T) { - pipe := &pipeline{} - - output := metricdata.ResourceMetrics{} - err := pipe.produce(context.Background(), &output) - require.NoError(t, err) - assert.Nil(t, output.Resource) - assert.Len(t, output.ScopeMetrics, 0) - - iSync := instrumentSync{"name", "desc", "1", testSumAggregator{}} - assert.NotPanics(t, func() { - pipe.addSync(instrumentation.Scope{}, iSync) - }) - - require.NotPanics(t, func() { - pipe.addMultiCallback(func(context.Context) error { return nil }) - }) - - err = pipe.produce(context.Background(), &output) - require.NoError(t, err) - assert.Nil(t, output.Resource) - require.Len(t, output.ScopeMetrics, 1) - require.Len(t, output.ScopeMetrics[0].Metrics, 1) -} - func TestNewPipeline(t *testing.T) { pipe := newPipeline(nil, nil, nil) From 10c3445543b61bef40037f4c341269fb70b985c8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 3 Jul 2023 01:53:00 -0700 Subject: [PATCH 587/886] Move aggs to internal/aggregate (#4283) --- sdk/metric/instrument.go | 16 +++---- sdk/metric/instrument_test.go | 18 ++++---- .../internal/{ => aggregate}/aggregator.go | 2 +- .../aggregator_example_test.go | 8 ++-- .../{ => aggregate}/aggregator_test.go | 2 +- sdk/metric/internal/{ => aggregate}/doc.go | 4 +- sdk/metric/internal/{ => aggregate}/filter.go | 2 +- .../internal/{ => aggregate}/filter_test.go | 2 +- .../internal/{ => aggregate}/histogram.go | 2 +- .../{ => aggregate}/histogram_test.go | 2 +- .../internal/{ => aggregate}/lastvalue.go | 2 +- .../{ => aggregate}/lastvalue_test.go | 2 +- sdk/metric/internal/{ => aggregate}/sum.go | 2 +- .../internal/{ => aggregate}/sum_test.go | 2 +- sdk/metric/meter.go | 6 +-- sdk/metric/pipeline.go | 33 +++++++------- sdk/metric/pipeline_registry_test.go | 44 +++++++++---------- 17 files changed, 75 insertions(+), 74 deletions(-) rename sdk/metric/internal/{ => aggregate}/aggregator.go (96%) rename sdk/metric/internal/{ => aggregate}/aggregator_example_test.go (94%) rename sdk/metric/internal/{ => aggregate}/aggregator_test.go (98%) rename sdk/metric/internal/{ => aggregate}/doc.go (81%) rename sdk/metric/internal/{ => aggregate}/filter.go (97%) rename sdk/metric/internal/{ => aggregate}/filter_test.go (98%) rename sdk/metric/internal/{ => aggregate}/histogram.go (98%) rename sdk/metric/internal/{ => aggregate}/histogram_test.go (98%) rename sdk/metric/internal/{ => aggregate}/lastvalue.go (95%) rename sdk/metric/internal/{ => aggregate}/lastvalue_test.go (97%) rename sdk/metric/internal/{ => aggregate}/sum.go (99%) rename sdk/metric/internal/{ => aggregate}/sum_test.go (99%) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index ffaf0917cb6..e18313c96b1 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -171,7 +171,7 @@ type streamID struct { } type int64Inst struct { - aggregators []internal.Aggregator[int64] + aggregators []aggregate.Aggregator[int64] embedded.Int64Counter embedded.Int64UpDownCounter @@ -192,7 +192,7 @@ func (i *int64Inst) Record(ctx context.Context, val int64, opts ...metric.Record i.aggregate(ctx, val, c.Attributes()) } -func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { +func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { // nolint:revive // okay to shadow pkg with method. if err := ctx.Err(); err != nil { return } @@ -202,7 +202,7 @@ func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { } type float64Inst struct { - aggregators []internal.Aggregator[float64] + aggregators []aggregate.Aggregator[float64] embedded.Float64Counter embedded.Float64UpDownCounter @@ -254,7 +254,7 @@ var _ metric.Float64ObservableCounter = float64Observable{} var _ metric.Float64ObservableUpDownCounter = float64Observable{} var _ metric.Float64ObservableGauge = float64Observable{} -func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[float64]) float64Observable { +func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[float64]) float64Observable { return float64Observable{ observable: newObservable(scope, kind, name, desc, u, agg), } @@ -273,7 +273,7 @@ var _ metric.Int64ObservableCounter = int64Observable{} var _ metric.Int64ObservableUpDownCounter = int64Observable{} var _ metric.Int64ObservableGauge = int64Observable{} -func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[int64]) int64Observable { +func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[int64]) int64Observable { return int64Observable{ observable: newObservable(scope, kind, name, desc, u, agg), } @@ -283,10 +283,10 @@ type observable[N int64 | float64] struct { metric.Observable observablID[N] - aggregators []internal.Aggregator[N] + aggregators []aggregate.Aggregator[N] } -func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []internal.Aggregator[N]) *observable[N] { +func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[N]) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, diff --git a/sdk/metric/instrument_test.go b/sdk/metric/instrument_test.go index 0a8f5924473..7aed2838348 100644 --- a/sdk/metric/instrument_test.go +++ b/sdk/metric/instrument_test.go @@ -19,7 +19,7 @@ import ( "testing" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) func BenchmarkInstrument(b *testing.B) { @@ -32,10 +32,10 @@ func BenchmarkInstrument(b *testing.B) { } b.Run("instrumentImpl/aggregate", func(b *testing.B) { - inst := int64Inst{aggregators: []internal.Aggregator[int64]{ - internal.NewLastValue[int64](), - internal.NewCumulativeSum[int64](true), - internal.NewDeltaSum[int64](true), + inst := int64Inst{aggregators: []aggregate.Aggregator[int64]{ + aggregate.NewLastValue[int64](), + aggregate.NewCumulativeSum[int64](true), + aggregate.NewDeltaSum[int64](true), }} ctx := context.Background() @@ -47,10 +47,10 @@ func BenchmarkInstrument(b *testing.B) { }) b.Run("observable/observe", func(b *testing.B) { - o := observable[int64]{aggregators: []internal.Aggregator[int64]{ - internal.NewLastValue[int64](), - internal.NewCumulativeSum[int64](true), - internal.NewDeltaSum[int64](true), + o := observable[int64]{aggregators: []aggregate.Aggregator[int64]{ + aggregate.NewLastValue[int64](), + aggregate.NewCumulativeSum[int64](true), + aggregate.NewDeltaSum[int64](true), }} b.ReportAllocs() diff --git a/sdk/metric/internal/aggregator.go b/sdk/metric/internal/aggregate/aggregator.go similarity index 96% rename from sdk/metric/internal/aggregator.go rename to sdk/metric/internal/aggregate/aggregator.go index 42694d87020..1c8c2428a4b 100644 --- a/sdk/metric/internal/aggregator.go +++ b/sdk/metric/internal/aggregate/aggregator.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "time" diff --git a/sdk/metric/internal/aggregator_example_test.go b/sdk/metric/internal/aggregate/aggregator_example_test.go similarity index 94% rename from sdk/metric/internal/aggregator_example_test.go rename to sdk/metric/internal/aggregate/aggregator_example_test.go index fdbb19650ff..2376f5ea10a 100644 --- a/sdk/metric/internal/aggregator_example_test.go +++ b/sdk/metric/internal/aggregate/aggregator_example_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal +package aggregate import ( "context" @@ -105,7 +105,7 @@ func Example() { _, _ = m.Int64Histogram("histogram example") // Output: - // using *internal.cumulativeSum[int64] aggregator for counter - // using *internal.lastValue[int64] aggregator for up-down counter - // using *internal.deltaHistogram[int64] aggregator for histogram + // using *aggregate.cumulativeSum[int64] aggregator for counter + // using *aggregate.lastValue[int64] aggregator for up-down counter + // using *aggregate.deltaHistogram[int64] aggregator for histogram } diff --git a/sdk/metric/internal/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go similarity index 98% rename from sdk/metric/internal/aggregator_test.go rename to sdk/metric/internal/aggregate/aggregator_test.go index 6f5f32b1dc7..d0569fb1ca7 100644 --- a/sdk/metric/internal/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "strconv" diff --git a/sdk/metric/internal/doc.go b/sdk/metric/internal/aggregate/doc.go similarity index 81% rename from sdk/metric/internal/doc.go rename to sdk/metric/internal/aggregate/doc.go index e1aa11ab2e1..e83a2693faf 100644 --- a/sdk/metric/internal/doc.go +++ b/sdk/metric/internal/aggregate/doc.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package internal provides types and functionality used to aggregate and +// Package aggregate provides aggregate types used compute aggregations and // cycle the state of metric measurements made by the SDK. These types and // functionality are meant only for internal SDK use. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" diff --git a/sdk/metric/internal/filter.go b/sdk/metric/internal/aggregate/filter.go similarity index 97% rename from sdk/metric/internal/filter.go rename to sdk/metric/internal/aggregate/filter.go index 5c60c5e0d0b..241936a6ea7 100644 --- a/sdk/metric/internal/filter.go +++ b/sdk/metric/internal/aggregate/filter.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "go.opentelemetry.io/otel/attribute" diff --git a/sdk/metric/internal/filter_test.go b/sdk/metric/internal/aggregate/filter_test.go similarity index 98% rename from sdk/metric/internal/filter_test.go rename to sdk/metric/internal/aggregate/filter_test.go index e1333c1d4d1..a540c3a453f 100644 --- a/sdk/metric/internal/filter_test.go +++ b/sdk/metric/internal/aggregate/filter_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "fmt" diff --git a/sdk/metric/internal/histogram.go b/sdk/metric/internal/aggregate/histogram.go similarity index 98% rename from sdk/metric/internal/histogram.go rename to sdk/metric/internal/aggregate/histogram.go index 7ad454e96c4..8268c42bc75 100644 --- a/sdk/metric/internal/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sort" diff --git a/sdk/metric/internal/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go similarity index 98% rename from sdk/metric/internal/histogram_test.go rename to sdk/metric/internal/aggregate/histogram_test.go index 20bd19a4167..5bf4117d36c 100644 --- a/sdk/metric/internal/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sort" diff --git a/sdk/metric/internal/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go similarity index 95% rename from sdk/metric/internal/lastvalue.go rename to sdk/metric/internal/aggregate/lastvalue.go index 16ee77362c4..2f2f63a3320 100644 --- a/sdk/metric/internal/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sync" diff --git a/sdk/metric/internal/lastvalue_test.go b/sdk/metric/internal/aggregate/lastvalue_test.go similarity index 97% rename from sdk/metric/internal/lastvalue_test.go rename to sdk/metric/internal/aggregate/lastvalue_test.go index 6b17198ae98..3d5d92b3a75 100644 --- a/sdk/metric/internal/lastvalue_test.go +++ b/sdk/metric/internal/aggregate/lastvalue_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "testing" diff --git a/sdk/metric/internal/sum.go b/sdk/metric/internal/aggregate/sum.go similarity index 99% rename from sdk/metric/internal/sum.go rename to sdk/metric/internal/aggregate/sum.go index 7783dc66490..50a59697e16 100644 --- a/sdk/metric/internal/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "sync" diff --git a/sdk/metric/internal/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go similarity index 99% rename from sdk/metric/internal/sum_test.go rename to sdk/metric/internal/aggregate/sum_test.go index e40089566ed..3d206df5412 100644 --- a/sdk/metric/internal/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package internal // import "go.opentelemetry.io/otel/sdk/metric/internal" +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( "testing" diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 81f0b2f0bd7..50ea34e100d 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) var ( @@ -441,7 +441,7 @@ func newInt64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, return &int64InstProvider{scope: s, pipes: p, resolve: newResolver[int64](p, c)} } -func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[int64], error) { +func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[int64], error) { inst := Instrument{ Name: name, Description: desc, @@ -469,7 +469,7 @@ func newFloat64InstProvider(s instrumentation.Scope, p pipelines, c *cache[strin return &float64InstProvider{scope: s, pipes: p, resolve: newResolver[float64](p, c)} } -func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]internal.Aggregator[float64], error) { +func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[float64], error) { inst := Instrument{ Name: name, Description: desc, diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 52044a5ddd6..b6b15e1cf05 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" ) @@ -233,16 +234,16 @@ func newInserter[N int64 | float64](p *pipeline, vc *cache[string, streamID]) *i // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], error) { +func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Aggregator[N], error) { var ( matched bool - aggs []internal.Aggregator[N] + aggs []aggregate.Aggregator[N] ) errs := &multierror{wrapped: errCreatingAggregators} // The cache will return the same Aggregator instance. Use this fact to // compare pointer addresses to deduplicate Aggregators. - seen := make(map[internal.Aggregator[N]]struct{}) + seen := make(map[aggregate.Aggregator[N]]struct{}) for _, v := range i.pipeline.views { stream, match := v(inst) if !match { @@ -288,7 +289,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]internal.Aggregator[N], err // aggVal is the cached value in an aggregators cache. type aggVal[N int64 | float64] struct { - Aggregator internal.Aggregator[N] + Aggregator aggregate.Aggregator[N] Err error } @@ -305,7 +306,7 @@ type aggVal[N int64 | float64] struct { // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (internal.Aggregator[N], error) { +func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (aggregate.Aggregator[N], error) { switch stream.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. @@ -332,7 +333,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum return aggVal[N]{nil, nil} } if stream.AttributeFilter != nil { - agg = internal.NewFilter(agg, stream.AttributeFilter) + agg = aggregate.NewFilter(agg, stream.AttributeFilter) } i.pipeline.addSync(scope, instrumentSync{ @@ -388,14 +389,14 @@ func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { // aggregator returns a new Aggregator matching agg, kind, temporality, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (internal.Aggregator[N], error) { +func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (aggregate.Aggregator[N], error) { switch a := agg.(type) { case aggregation.Default: return i.aggregator(DefaultAggregationSelector(kind), kind, temporality, monotonic) case aggregation.Drop: return nil, nil case aggregation.LastValue: - return internal.NewLastValue[N](), nil + return aggregate.NewLastValue[N](), nil case aggregation.Sum: switch kind { case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: @@ -404,9 +405,9 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/api.md#asynchronous-counter-creation switch temporality { case metricdata.CumulativeTemporality: - return internal.NewPrecomputedCumulativeSum[N](monotonic), nil + return aggregate.NewPrecomputedCumulativeSum[N](monotonic), nil case metricdata.DeltaTemporality: - return internal.NewPrecomputedDeltaSum[N](monotonic), nil + return aggregate.NewPrecomputedDeltaSum[N](monotonic), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } @@ -414,18 +415,18 @@ func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKin switch temporality { case metricdata.CumulativeTemporality: - return internal.NewCumulativeSum[N](monotonic), nil + return aggregate.NewCumulativeSum[N](monotonic), nil case metricdata.DeltaTemporality: - return internal.NewDeltaSum[N](monotonic), nil + return aggregate.NewDeltaSum[N](monotonic), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } case aggregation.ExplicitBucketHistogram: switch temporality { case metricdata.CumulativeTemporality: - return internal.NewCumulativeHistogram[N](a), nil + return aggregate.NewCumulativeHistogram[N](a), nil case metricdata.DeltaTemporality: - return internal.NewDeltaHistogram[N](a), nil + return aggregate.NewDeltaHistogram[N](a), nil default: return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) } @@ -536,8 +537,8 @@ func newResolver[N int64 | float64](p pipelines, vc *cache[string, streamID]) re // Aggregators returns the Aggregators that must be updated by the instrument // defined by key. -func (r resolver[N]) Aggregators(id Instrument) ([]internal.Aggregator[N], error) { - var aggs []internal.Aggregator[N] +func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Aggregator[N], error) { + var aggs []aggregate.Aggregator[N] errs := &multierror{} for _, i := range r.inserters { diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 642e65e6cc0..69675b5d304 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/internal" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/resource" ) @@ -76,7 +76,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader Reader views []View inst Instrument - wantKind internal.Aggregator[N] //Aggregators should match len and types + wantKind aggregate.Aggregator[N] //Aggregators should match len and types wantLen int wantErr error }{ @@ -91,7 +91,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewDeltaSum[N](false), + wantKind: aggregate.NewDeltaSum[N](false), wantLen: 1, }, { @@ -99,7 +99,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -107,7 +107,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedDeltaSum[N](true), + wantKind: aggregate.NewPrecomputedDeltaSum[N](true), wantLen: 1, }, { @@ -115,7 +115,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedDeltaSum[N](false), + wantKind: aggregate.NewPrecomputedDeltaSum[N](false), wantLen: 1, }, { @@ -123,7 +123,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, { @@ -131,7 +131,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), views: []View{defaultAggView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewDeltaSum[N](true), + wantKind: aggregate.NewDeltaSum[N](true), wantLen: 1, }, { @@ -139,7 +139,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewCumulativeSum[N](false), + wantKind: aggregate.NewCumulativeSum[N](false), wantLen: 1, }, { @@ -147,7 +147,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -155,7 +155,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -163,7 +163,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](false), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](false), wantLen: 1, }, { @@ -171,7 +171,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, { @@ -179,7 +179,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -187,7 +187,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{changeAggView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -195,7 +195,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(), views: []View{defaultView, renameView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 2, }, { @@ -203,7 +203,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -211,7 +211,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: internal.NewCumulativeSum[N](true), + wantKind: aggregate.NewCumulativeSum[N](true), wantLen: 1, }, { @@ -219,7 +219,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: internal.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), + wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), wantLen: 1, }, { @@ -227,7 +227,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -235,7 +235,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: internal.NewPrecomputedCumulativeSum[N](true), + wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), wantLen: 1, }, { @@ -243,7 +243,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: internal.NewLastValue[N](), + wantKind: aggregate.NewLastValue[N](), wantLen: 1, }, { From c404a30b96f6117ac677c5e15119a4d724e2ab3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 4 Jul 2023 14:58:38 +0200 Subject: [PATCH 588/886] Rewrite Prometheus exporter tests (#4274) * Remove TesInvalidInsrtrumentForPrometheusIsIgnored * Reimplement ConcurrentSafe test * Add TestIncompatibleMeterName --- exporters/prometheus/exporter_test.go | 182 ++++-------------- .../testdata/TestIncompatibleMeterName.txt | 3 + 2 files changed, 40 insertions(+), 145 deletions(-) create mode 100755 exporters/prometheus/testdata/TestIncompatibleMeterName.txt diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 2af7d71ba8a..be3914d3e38 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -17,19 +17,16 @@ package prometheus import ( "context" "os" - "strings" + "sync" "testing" - "time" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" - dto "github.com/prometheus/client_model/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" @@ -677,163 +674,58 @@ func TestDuplicateMetrics(t *testing.T) { } } -func TestCollectConcurrentSafe(t *testing.T) { - registry := prometheus.NewRegistry() - cfg := newConfig(WithRegisterer(registry)) - - reader := metric.NewManualReader(cfg.manualReaderOptions()...) - - collector := &collector{ - reader: reader, - disableTargetInfo: false, - withoutUnits: true, - disableScopeInfo: cfg.disableScopeInfo, - scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), - metricFamilies: make(map[string]*dto.MetricFamily), - } - - err := cfg.registerer.Register(collector) - require.NoError(t, err) - +func TestCollectorConcurrentSafe(t *testing.T) { + // This tests makes sure that the implemented + // https://pkg.go.dev/github.com/prometheus/client_golang/prometheus#Collector + // is concurrent safe. ctx := context.Background() - - // initialize resource - res, err := resource.New(ctx, - resource.WithAttributes(semconv.ServiceName("prometheus_test")), - resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), - ) + registry := prometheus.NewRegistry() + exporter, err := New(WithRegisterer(registry)) require.NoError(t, err) - res, err = resource.Merge(resource.Default(), res) + provider := metric.NewMeterProvider(metric.WithReader(exporter)) + meter := provider.Meter("testmeter") + cnt, err := meter.Int64Counter("foo") require.NoError(t, err) + cnt.Add(ctx, 100) - exporter := &Exporter{Reader: reader} - - // initialize provider - provider := metric.NewMeterProvider( - metric.WithReader(exporter), - metric.WithResource(res), - ) - - // initialize two meter a, b - meterA := provider.Meter("ma", otelmetric.WithInstrumentationVersion("v0.1.0")) - meterB := provider.Meter("mb", otelmetric.WithInstrumentationVersion("v0.1.0")) - - fooA, err := meterA.Int64Counter("foo", - otelmetric.WithUnit("By"), - otelmetric.WithDescription("meter counter foo")) - assert.NoError(t, err) - - opt := otelmetric.WithAttributes( - attribute.Key("A").String("B"), - ) - - fooA.Add(ctx, 100, opt) - - fooB, err := meterB.Int64Counter("foo", - otelmetric.WithUnit("By"), - otelmetric.WithDescription("meter counter foo")) - assert.NoError(t, err) - fooB.Add(ctx, 100, opt) - - concurrencyLevel := 100 - ch := make(chan prometheus.Metric, concurrencyLevel) - + var wg sync.WaitGroup + concurrencyLevel := 10 for i := 0; i < concurrencyLevel; i++ { + wg.Add(1) go func() { - collector.Collect(ch) + defer wg.Done() + _, err := registry.Gather() // this calls collector.Collect + assert.NoError(t, err) }() } - for ; concurrencyLevel > 0; concurrencyLevel-- { - select { - case <-ch: - concurrencyLevel-- - if concurrencyLevel == 0 { - return - } - case <-time.After(time.Second): - t.Fatal("timeout") - } - } + wg.Wait() } -func TesInvalidInsrtrumentForPrometheusIsIgnored(t *testing.T) { - registry := prometheus.NewRegistry() - cfg := newConfig(WithRegisterer(registry)) - - reader := metric.NewManualReader(cfg.manualReaderOptions()...) - - collector := &collector{ - reader: reader, - disableTargetInfo: false, - withoutUnits: true, - disableScopeInfo: false, - scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), - metricFamilies: make(map[string]*dto.MetricFamily), - } +func TestIncompatibleMeterName(t *testing.T) { + // This test checks that Prometheus exporter ignores + // when it encounters incompatible meter name. - err := cfg.registerer.Register(collector) - require.NoError(t, err) + // Invalid label or metric name leads to error returned from + // createScopeInfoMetric. + invalidName := string([]byte{0xff, 0xfe, 0xfd}) ctx := context.Background() - - // initialize resource - res, err := resource.New(ctx, - resource.WithAttributes(semconv.ServiceName("prometheus_test")), - resource.WithAttributes(semconv.TelemetrySDKVersion("latest")), - ) - require.NoError(t, err) - res, err = resource.Merge(resource.Default(), res) + registry := prometheus.NewRegistry() + exporter, err := New(WithRegisterer(registry)) require.NoError(t, err) - - exporter := &Exporter{Reader: reader} - - // initialize provider provider := metric.NewMeterProvider( - metric.WithReader(exporter), - metric.WithResource(res), - ) - - // invalid label or metric name leads to error returned from - // createScopeInfoMetric - invalidName := string([]byte{0xff, 0xfe, 0xfd}) - validName := "validName" - - meterA := provider.Meter(invalidName, otelmetric.WithInstrumentationVersion("v0.1.0")) - - counterA, err := meterA.Int64Counter("with-invalid-description", - otelmetric.WithUnit("By"), - otelmetric.WithDescription(invalidName)) - assert.NoError(t, err) - - counterA.Add(ctx, 100, otelmetric.WithAttributes( - attribute.Key(invalidName).String(invalidName), - )) - - meterB := provider.Meter(validName, otelmetric.WithInstrumentationVersion("v0.1.0")) - counterB, err := meterB.Int64Counter(validName, - otelmetric.WithUnit("By"), - otelmetric.WithDescription(validName)) - assert.NoError(t, err) - - counterB.Add(ctx, 100, otelmetric.WithAttributes( - attribute.Key(validName).String(validName), - )) - - ch := make(chan prometheus.Metric) - - go collector.Collect(ch) + metric.WithResource(resource.Empty()), + metric.WithReader(exporter)) + meter := provider.Meter(invalidName) + cnt, err := meter.Int64Counter("foo") + require.NoError(t, err) + cnt.Add(ctx, 100) - for { - select { - case m := <-ch: - require.NotNil(t, m) + file, err := os.Open("testdata/TestIncompatibleMeterName.txt") + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, file.Close()) }) - if strings.Contains(m.Desc().String(), validName) { - return - } - case <-time.After(time.Second): - t.Fatalf("timeout") - } - } + err = testutil.GatherAndCompare(registry, file) + require.NoError(t, err) } diff --git a/exporters/prometheus/testdata/TestIncompatibleMeterName.txt b/exporters/prometheus/testdata/TestIncompatibleMeterName.txt new file mode 100755 index 00000000000..b2c52c73188 --- /dev/null +++ b/exporters/prometheus/testdata/TestIncompatibleMeterName.txt @@ -0,0 +1,3 @@ +# HELP target_info Target metadata +# TYPE target_info gauge +target_info 1 From 1633c74aea5f5b9f05083d255d3c37e2b1412e79 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 8 Jul 2023 08:01:47 -0700 Subject: [PATCH 589/886] Replace `Stream.AttributeFilter` with `AllowAttributeKeys` (#4288) * Replace Stream AttributeFilter with AttributeKeys * Rename Stream field AttributeKeys to AllowAttributeKeys Ensure forward compatibility if a deny-list of attribute keys is ever added. * Add change to changelog * Update PR number in changelog * Update CHANGELOG.md Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 3 +++ sdk/metric/benchmark_test.go | 4 +--- sdk/metric/instrument.go | 27 +++++++++++++++++++++++++-- sdk/metric/meter_test.go | 11 +++-------- sdk/metric/pipeline.go | 4 ++-- sdk/metric/view.go | 10 +++++----- sdk/metric/view_test.go | 29 ++++++++++++----------------- 7 files changed, 51 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 258c09bda9f..27a44e96f77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Count the Collect time in the PeriodicReader timeout. (#4221) - `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) - `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- ⚠️ Metrics SDK Breaking ⚠️ : the `AttributeFilter` fields of the `Stream` from `go.opentelemetry.io/otel/sdk/metric` is replaced by the `AttributeKeys` field. + The `AttributeKeys` fields allows users to specify an allow-list of attributes allowed to be recorded for a view. + This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) ### Fixed diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index d7f8798ba46..a243738cfb7 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -43,9 +43,7 @@ var viewBenchmarks = []struct { "AttrFilterView", []View{NewView( Instrument{Name: "*"}, - Stream{AttributeFilter: func(kv attribute.KeyValue) bool { - return kv.Key == attribute.Key("K") - }}, + Stream{AllowAttributeKeys: []attribute.Key{"K"}}, )}, }, } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index e18313c96b1..6de8fe86904 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -145,8 +145,31 @@ type Stream struct { Unit string // Aggregation the stream uses for an instrument. Aggregation aggregation.Aggregation - // AttributeFilter applied to all attributes recorded for an instrument. - AttributeFilter attribute.Filter + // AllowAttributeKeys are an allow-list of attribute keys that will be + // preserved for the stream. Any attribute recorded for the stream with a + // key not in this slice will be dropped. + // + // If this slice is empty, all attributes will be kept. + AllowAttributeKeys []attribute.Key +} + +// attributeFilter returns an attribute.Filter that only allows attributes +// with keys in s.AttributeKeys. +// +// If s.AttributeKeys is empty an accept-all filter is returned. +func (s Stream) attributeFilter() attribute.Filter { + if len(s.AllowAttributeKeys) <= 0 { + return func(kv attribute.KeyValue) bool { return true } + } + + allowed := make(map[attribute.Key]struct{}) + for _, k := range s.AllowAttributeKeys { + allowed[k] = struct{}{} + } + return func(kv attribute.KeyValue) bool { + _, ok := allowed[kv.Key] + return ok + } } // streamID are the identifying properties of a stream. diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 4fea8fccf90..7a3d5c0b8dd 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1516,9 +1516,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { WithReader(rdr), WithView(NewView( Instrument{Name: "*"}, - Stream{AttributeFilter: func(kv attribute.KeyValue) bool { - return kv.Key == attribute.Key("foo") - }}, + Stream{AllowAttributeKeys: []attribute.Key{"foo"}}, )), ).Meter("TestAttributeFilter") require.NoError(t, tt.register(t, mtr)) @@ -1565,11 +1563,8 @@ func TestObservableExample(t *testing.T) { selector := func(InstrumentKind) metricdata.Temporality { return temp } reader := NewManualReader(WithTemporalitySelector(selector)) - noopFilter := func(kv attribute.KeyValue) bool { return true } - noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName, AttributeFilter: noopFilter}) - - filter := func(kv attribute.KeyValue) bool { return kv.Key != "tid" } - filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AttributeFilter: filter}) + noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName}) + filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AllowAttributeKeys: []attribute.Key{"pid"}}) mp := NewMeterProvider(WithReader(reader), WithView(noFiltered, filtered)) meter := mp.Meter(scopeName) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index b6b15e1cf05..3fa3960b825 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -332,8 +332,8 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum if agg == nil { // Drop aggregator. return aggVal[N]{nil, nil} } - if stream.AttributeFilter != nil { - agg = aggregate.NewFilter(agg, stream.AttributeFilter) + if len(stream.AllowAttributeKeys) > 0 { + agg = aggregate.NewFilter(agg, stream.attributeFilter()) } i.pipeline.addSync(scope, instrumentSync{ diff --git a/sdk/metric/view.go b/sdk/metric/view.go index b8fc363a0a7..9dab839f003 100644 --- a/sdk/metric/view.go +++ b/sdk/metric/view.go @@ -103,11 +103,11 @@ func NewView(criteria Instrument, mask Stream) View { return func(i Instrument) (Stream, bool) { if matchFunc(i) { return Stream{ - Name: nonZero(mask.Name, i.Name), - Description: nonZero(mask.Description, i.Description), - Unit: nonZero(mask.Unit, i.Unit), - Aggregation: agg, - AttributeFilter: mask.AttributeFilter, + Name: nonZero(mask.Name, i.Name), + Description: nonZero(mask.Description, i.Description), + Unit: nonZero(mask.Unit, i.Unit), + Aggregation: agg, + AllowAttributeKeys: mask.AllowAttributeKeys, }, true } return Stream{}, false diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index d74d1e5b43a..03ae5e7e7eb 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -404,6 +404,18 @@ func TestNewViewReplace(t *testing.T) { } }, }, + { + name: "AttributeKeys", + mask: Stream{AllowAttributeKeys: []attribute.Key{"test"}}, + want: func(i Instrument) Stream { + return Stream{ + Name: i.Name, + Description: i.Description, + Unit: i.Unit, + AllowAttributeKeys: []attribute.Key{"test"}, + } + }, + }, { name: "Complete", mask: Stream{ @@ -430,23 +442,6 @@ func TestNewViewReplace(t *testing.T) { assert.Equal(t, test.want(completeIP), got) }) } - - // Go does not allow for the comparison of function values, even their - // addresses. Therefore, the AttributeFilter field needs an alternative - // testing strategy. - t.Run("AttributeFilter", func(t *testing.T) { - allowed := attribute.String("key", "val") - filter := func(kv attribute.KeyValue) bool { - return kv == allowed - } - mask := Stream{AttributeFilter: filter} - got, match := NewView(completeIP, mask)(completeIP) - require.True(t, match, "view did not match exact criteria") - require.NotNil(t, got.AttributeFilter, "AttributeFilter not set") - assert.True(t, got.AttributeFilter(allowed), "wrong AttributeFilter") - other := attribute.String("key", "other val") - assert.False(t, got.AttributeFilter(other), "wrong AttributeFilter") - }) } type badAgg struct { From 8b7bffc8b9c3a74570cd7c9d12c2d10d74d5f540 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 9 Jul 2023 11:25:46 -0700 Subject: [PATCH 590/886] dependabot updates Sun Jul 9 14:40:56 UTC 2023 (#4301) Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlptrace/otlptracegrpc Bump golang.org/x/tools from 0.10.0 to 0.11.0 in /internal/tools Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlptrace Bump benchmark-action/github-action-benchmark from 1.17.0 to 1.18.0 Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /example/otel-collector Bump google.golang.org/grpc from 1.56.1 to 1.56.2 in /exporters/otlp/otlpmetric Bump golang.org/x/sys from 0.9.0 to 0.10.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +-- bridge/opentracing/test/go.mod | 4 +-- bridge/opentracing/test/go.sum | 8 +++--- example/fib/go.mod | 2 +- example/fib/go.sum | 4 +-- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 +-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +-- example/otel-collector/go.mod | 4 +-- example/otel-collector/go.sum | 8 +++--- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 +-- example/view/go.mod | 2 +- example/view/go.sum | 4 +-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +-- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 +-- exporters/otlp/otlpmetric/go.mod | 4 +-- exporters/otlp/otlpmetric/go.sum | 8 +++--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 8 +++--- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 4 +-- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 8 +++--- exporters/otlp/otlptrace/go.mod | 4 +-- exporters/otlp/otlptrace/go.sum | 8 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 +-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 8 +++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 4 +-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 8 +++--- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +-- internal/tools/go.mod | 12 ++++----- internal/tools/go.sum | 26 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +-- 52 files changed, 118 insertions(+), 118 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d05767361e9..d27858af41a 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 864fa7f8605..9425632f817 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 86a679d3c6a..36fc8c54df9 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 28e7cefa6f4..0d9fbab0bcc 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index fc7beadd2eb..a6890d96be2 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/bridge/opentracing v1.16.0 - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 ) require ( @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 9fa39fe3611..4ef826058b5 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/fib/go.mod b/example/fib/go.mod index bcc4efc6017..cb30440baf1 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index dbd8bfec953..bf8971bdd56 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 6bc9bdb7882..64df89132f0 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index b6bd2da015b..20f114998ca 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 7587371d208..7fc426bac9e 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index dbd8bfec953..bf8971bdd56 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 16b1a6dc3ba..cda7d767a1b 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 28e7cefa6f4..0d9fbab0bcc 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 75c01d38cdf..84a438d281c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 ) require ( @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/proto/otlp v0.20.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 6f8f193f14f..0eef7b20b50 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 66089198291..51f1c4b1303 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index dbd8bfec953..bf8971bdd56 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 95af4577044..2334616ec41 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index cf3b2fe680d..96e81432bd2 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index b4a7e9a0a7e..0e5729ad412 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index cf3b2fe680d..96e81432bd2 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 4cc0fef58b5..9abfad0627d 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 036429de63d..e5f2d016dd3 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 317d1722873..9875273468e 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 09c01acc8e1..127eea04a06 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 38ef6330f2d..7a633de34e6 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index ccb38f776c0..b2efa6ef70b 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f3f01252bff..41a05c43d8d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v0.20.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index a0fac3b3bfb..13616a5229c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 40d51a666d1..43a2dcc8d00 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,11 +27,11 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.1 // indirect + google.golang.org/grpc v1.56.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index a0fac3b3bfb..13616a5229c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index c5d36d26cad..bb0bfd4bb2c 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v0.20.0 - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index ccb38f776c0..b2efa6ef70b 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index e60e9f4841f..2d1778b3dff 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v0.20.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.1 + google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 3e7499f83e8..e9263158313 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -28,8 +28,8 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 8ae0a5f4951..30186364388 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,11 +23,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.1 // indirect + google.golang.org/grpc v1.56.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 6b7e79e88cd..63c5d4eafe2 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -26,8 +26,8 @@ go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1Su go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -36,8 +36,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index a38a878ebe5..e3d8b81dab3 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -27,7 +27,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 2789eb41529..c29d69a73b3 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -36,8 +36,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index ddd3155e80f..38b4ff97d6b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 0a08152889e..c670b77daed 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 828f22b669d..f803eacd8c3 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 0a08152889e..c670b77daed 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 436b2059af3..eb351115fef 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index f652b455b4f..dbf611add62 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 3ddf82a7296..b4a7d285da0 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/build-tools/dbotconf v0.8.0 go.opentelemetry.io/build-tools/multimod v0.8.0 go.opentelemetry.io/build-tools/semconvgen v0.8.0 - golang.org/x/tools v0.10.0 + golang.org/x/tools v0.11.0 ) require ( @@ -194,14 +194,14 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.10.0 // indirect + golang.org/x/crypto v0.11.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.11.0 // indirect - golang.org/x/net v0.11.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.10.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index fa9d8810084..9dbcc204664 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -653,8 +653,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -701,8 +701,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -746,8 +746,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -835,8 +835,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -844,7 +844,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28= +golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -857,8 +857,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -932,8 +932,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= +golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= +golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index a6f2224ff92..ac19b7080c7 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - golang.org/x/sys v0.9.0 + golang.org/x/sys v0.10.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index ef092cc040b..287e8127d87 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index d919afce098..ebec07c04d0 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.9.0 // indirect + golang.org/x/sys v0.10.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 0a08152889e..c670b77daed 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From de26aaa52ed15e4367587fc0a903e946cb84f02f Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 11 Jul 2023 10:19:38 -0400 Subject: [PATCH 591/886] Metric SDK: Do not export non-observed attribute sets for async instruments (#4290) * drop non-observed attribute sets * fix test comment * add documentation for async callbacks dropping unobserved attributes --- CHANGELOG.md | 1 + sdk/metric/internal/aggregate/sum.go | 24 +++++++---------- sdk/metric/internal/aggregate/sum_test.go | 33 ++++++++--------------- sdk/metric/meter.go | 14 ++++++++-- sdk/metric/meter_test.go | 6 ++--- 5 files changed, 35 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27a44e96f77..2f69a0ddfd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - ⚠️ Metrics SDK Breaking ⚠️ : the `AttributeFilter` fields of the `Stream` from `go.opentelemetry.io/otel/sdk/metric` is replaced by the `AttributeKeys` field. The `AttributeKeys` fields allows users to specify an allow-list of attributes allowed to be recorded for a view. This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) +- If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) ### Fixed diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index 50a59697e16..1d1a7b0320c 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -255,10 +255,12 @@ type precomputedDeltaSum[N int64 | float64] struct { // collection cycle, and the unfiltered-sum is kept for the next collection // cycle. func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { + newReported := make(map[attribute.Set]N) s.Lock() defer s.Unlock() if len(s.values) == 0 { + s.reported = newReported return nil } @@ -277,16 +279,12 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { Time: t, Value: delta, }) - if delta != 0 { - s.reported[attr] = v - } - value.filtered = N(0) - s.values[attr] = value - // TODO (#3006): This will use an unbounded amount of memory if there - // are unbounded number of attribute sets being aggregated. Attribute - // sets that become "stale" need to be forgotten so this will not - // overload the system. + newReported[attr] = v + // Unused attribute sets do not report. + delete(s.values, attr) } + // Unused attribute sets are forgotten. + s.reported = newReported // The delta collection cycle resets. s.start = t return out @@ -349,12 +347,8 @@ func (s *precomputedCumulativeSum[N]) Aggregation() metricdata.Aggregation { Time: t, Value: value.measured + value.filtered, }) - value.filtered = N(0) - s.values[attr] = value - // TODO (#3006): This will use an unbounded amount of memory if there - // are unbounded number of attribute sets being aggregated. Attribute - // sets that become "stale" need to be forgotten so this will not - // overload the system. + // Unused attribute sets do not report. + delete(s.values, attr) } return out } diff --git a/sdk/metric/internal/aggregate/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go index 3d206df5412..4fff11b4128 100644 --- a/sdk/metric/internal/aggregate/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -180,10 +180,9 @@ func TestPreComputedDeltaSum(t *testing.T) { opt := metricdatatest.IgnoreTimestamp() metricdatatest.AssertAggregationsEqual(t, want, got, opt) - // Delta values should zero. + // No observation means no metric data got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 0)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, nil, got, opt) agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) got = agg.Aggregation() @@ -193,13 +192,8 @@ func TestPreComputedDeltaSum(t *testing.T) { // Filtered values should not persist. got = agg.Aggregation() - // measured(+): 1, previous(-): 2, filtered(+): 0 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -1)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - got = agg.Aggregation() - // measured(+): 1, previous(-): 1, filtered(+): 0 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 0)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + // No observation means no metric data + metricdatatest.AssertAggregationsEqual(t, nil, got, opt) // Override set value. agg.Aggregate(2, attrs) @@ -208,8 +202,8 @@ func TestPreComputedDeltaSum(t *testing.T) { agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) got = agg.Aggregation() - // measured(+): 5, previous(-): 1, filtered(+): 13 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 17)} + // measured(+): 5, previous(-): 0, filtered(+): 13 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 18)} metricdatatest.AssertAggregationsEqual(t, want, got, opt) // Filtered values should not persist. @@ -251,19 +245,18 @@ func TestPreComputedCumulativeSum(t *testing.T) { opt := metricdatatest.IgnoreTimestamp() metricdatatest.AssertAggregationsEqual(t, want, got, opt) - // Cumulative values should persist. + // Cumulative values should not persist. got = agg.Aggregation() - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, nil, got, opt) agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 2)} + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} metricdatatest.AssertAggregationsEqual(t, want, got, opt) // Filtered values should not persist. got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, nil, got, opt) // Override set value. agg.Aggregate(5, attrs) @@ -276,8 +269,7 @@ func TestPreComputedCumulativeSum(t *testing.T) { // Filtered values should not persist. got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 5)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, nil, got, opt) // Order should not affect measure. // Filtered should add. @@ -287,9 +279,6 @@ func TestPreComputedCumulativeSum(t *testing.T) { got = agg.Aggregation() want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 20)} metricdatatest.AssertAggregationsEqual(t, want, got, opt) - got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 7)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) } func TestEmptySumNilAggregation(t *testing.T) { diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 50ea34e100d..64ff1d9e705 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -107,6 +107,7 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. +// Only the measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { cfg := metric.NewInt64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter @@ -121,7 +122,8 @@ func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64Obser // Int64ObservableUpDownCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record -// int64 measurements once per a measurement collection cycle. +// int64 measurements once per a measurement collection cycle. Only the +// measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { cfg := metric.NewInt64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter @@ -137,6 +139,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int6 // Int64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous int64 measurements once per a measurement collection cycle. +// Only the measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { cfg := metric.NewInt64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge @@ -194,6 +197,7 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. +// Only the measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { cfg := metric.NewFloat64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter @@ -208,7 +212,8 @@ func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64O // Float64ObservableUpDownCounter returns a new instrument identified by name // and configured with options. The instrument is used to asynchronously record -// float64 measurements once per a measurement collection cycle. +// float64 measurements once per a measurement collection cycle. Only the +// measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter @@ -224,6 +229,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Fl // Float64ObservableGauge returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // instantaneous float64 measurements once per a measurement collection cycle. +// Only the measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { cfg := metric.NewFloat64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge @@ -272,6 +278,10 @@ func isAlphanumeric(c rune) bool { // Only instruments from this meter can be registered with f, an error is // returned if other instrument are provided. // +// Only observations made in the callback will be exported. Unlike synchronous +// instruments, asynchronous callbacks can "forget" attribute sets that are no +// longer relevant by omitting the observation during the callback. +// // The returned Registration can be used to unregister f. func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) { if len(insts) == 0 { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 7a3d5c0b8dd..185095e4f8d 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1687,8 +1687,7 @@ func TestObservableExample(t *testing.T) { Temporality: temporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[int64]{ - // Thread 1 remains at last measured value. - {Attributes: thread1, Value: 60}, + // Thread 1 is no longer exported. {Attributes: thread2, Value: 53}, {Attributes: thread3, Value: 5}, }, @@ -1762,8 +1761,7 @@ func TestObservableExample(t *testing.T) { Temporality: temporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[int64]{ - // Thread 1 remains at last measured value. - {Attributes: thread1, Value: 0}, + // Thread 1 is no longer exported. {Attributes: thread2, Value: 6}, {Attributes: thread3, Value: 5}, }, From 35636fc1ab89ad96de26a9f3e4e6f9d18c7659f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 08:00:04 -0700 Subject: [PATCH 592/886] Bump benchmark-action/github-action-benchmark from 1.17.0 to 1.18.0 (#4296) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.17.0 to 1.18.0. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 705b17f7d14..18c29605c96 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,7 +22,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.17.0 + uses: benchmark-action/github-action-benchmark@v1.18.0 with: name: Benchmarks tool: 'go' From fcc67096b563b4ddfa5761f409a169a9b5f6cbf3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 12 Jul 2023 15:01:14 -0700 Subject: [PATCH 593/886] Add test for multi-inst view error (#4308) --- sdk/metric/view_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 03ae5e7e7eb..439e7819c2d 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -466,6 +467,20 @@ func TestNewViewAggregationErrorLogged(t *testing.T) { assert.Equal(t, 1, l.ErrorN()) } +func TestNewViewMultiInstMatchErrorLogged(t *testing.T) { + var got string + otel.SetLogger(funcr.New(func(_, args string) { + got = args + }, funcr.Options{Verbosity: 6})) + + _ = NewView(Instrument{ + Name: "*", // Wildcard match name (multiple instruments). + }, Stream{ + Name: "non-empty", + }) + assert.Contains(t, got, errMultiInst.Error()) +} + func ExampleNewView() { // Create a view that renames the "latency" instrument from the v0.34.0 // version of the "http" instrumentation library as "request.latency". From 55fb2bb57b47133d0b966e4d55151fba47aae057 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 12 Jul 2023 15:10:40 -0700 Subject: [PATCH 594/886] Log an error for an empty view criteria (#4307) * Log an error for an empty view Resolves #4149 * Add changelog entry --- CHANGELOG.md | 1 + sdk/metric/view.go | 5 +++++ sdk/metric/view_test.go | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f69a0ddfd6..8759f726a18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) +- Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/view.go b/sdk/metric/view.go index 9dab839f003..f1df24466bc 100644 --- a/sdk/metric/view.go +++ b/sdk/metric/view.go @@ -25,6 +25,7 @@ import ( var ( errMultiInst = errors.New("name replacement for multiple instruments") + errEmptyView = errors.New("no criteria provided for view") emptyView = func(Instrument) (Stream, bool) { return Stream{}, false } ) @@ -55,6 +56,10 @@ type View func(Instrument) (Stream, bool) // View, create a View directly. func NewView(criteria Instrument, mask Stream) View { if criteria.empty() { + global.Error( + errEmptyView, "dropping view", + "mask", mask, + ) return emptyView } diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 439e7819c2d..b8f6c921468 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -467,6 +467,16 @@ func TestNewViewAggregationErrorLogged(t *testing.T) { assert.Equal(t, 1, l.ErrorN()) } +func TestNewViewEmptyViewErrorLogged(t *testing.T) { + var got string + otel.SetLogger(funcr.New(func(_, args string) { + got = args + }, funcr.Options{Verbosity: 6})) + + _ = NewView(Instrument{}, Stream{}) + assert.Contains(t, got, errEmptyView.Error()) +} + func TestNewViewMultiInstMatchErrorLogged(t *testing.T) { var got string otel.SetLogger(funcr.New(func(_, args string) { From 03b8c47770f2a3e11bd65a558f6cc579f553c691 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 14 Jul 2023 11:52:35 -0400 Subject: [PATCH 595/886] Add WithoutCounterSuffixes option in go.opentelemetry.io/otel/exporters/prometheus to disable addition of _total suffixes (#4306) --- CHANGELOG.md | 1 + exporters/prometheus/config.go | 26 ++++++++++++---- exporters/prometheus/exporter.go | 28 +++++++++-------- exporters/prometheus/exporter_test.go | 30 +++++++++++++++++++ .../testdata/counter_disabled_suffix.txt | 10 +++++++ 5 files changed, 76 insertions(+), 19 deletions(-) create mode 100755 exporters/prometheus/testdata/counter_disabled_suffix.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 8759f726a18..37b8e75bbd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#TODO) ### Changed diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index fbca80092e7..dcaba515900 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -24,12 +24,13 @@ import ( // config contains options for the exporter. type config struct { - registerer prometheus.Registerer - disableTargetInfo bool - withoutUnits bool - aggregation metric.AggregationSelector - disableScopeInfo bool - namespace string + registerer prometheus.Registerer + disableTargetInfo bool + withoutUnits bool + withoutCounterSuffixes bool + aggregation metric.AggregationSelector + disableScopeInfo bool + namespace string } // newConfig creates a validated config configured with options. @@ -110,6 +111,19 @@ func WithoutUnits() Option { }) } +// WithoutUnits disables exporter's addition _total suffixes on counters. +// +// By default, metric names include a _total suffix to follow Prometheus naming +// conventions. For example, the counter metric happy.people would become +// happy_people_total. With this option set, the name would instead be +// happy_people. +func WithoutCounterSuffixes() Option { + return optionFunc(func(cfg config) config { + cfg.withoutCounterSuffixes = true + return cfg + }) +} + // WithoutScopeInfo configures the Exporter to not export the otel_scope_info metric. // If not specified, the Exporter will create a otel_scope_info metric containing // the metrics' Instrumentation Scope, and also add labels about Instrumentation Scope to all metric points. diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 4fdbcfa174f..98949d8ca87 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -59,9 +59,10 @@ var _ metric.Reader = &Exporter{} type collector struct { reader metric.Reader - withoutUnits bool - disableScopeInfo bool - namespace string + withoutUnits bool + withoutCounterSuffixes bool + disableScopeInfo bool + namespace string mu sync.Mutex // mu protects all members below from the concurrent access. disableTargetInfo bool @@ -70,7 +71,7 @@ type collector struct { metricFamilies map[string]*dto.MetricFamily } -// prometheus counters MUST have a _total suffix: +// prometheus counters MUST have a _total suffix by default: // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/compatibility/prometheus_and_openmetrics.md const counterSuffix = "_total" @@ -84,13 +85,14 @@ func New(opts ...Option) (*Exporter, error) { reader := metric.NewManualReader(cfg.manualReaderOptions()...) collector := &collector{ - reader: reader, - disableTargetInfo: cfg.disableTargetInfo, - withoutUnits: cfg.withoutUnits, - disableScopeInfo: cfg.disableScopeInfo, - scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), - metricFamilies: make(map[string]*dto.MetricFamily), - namespace: cfg.namespace, + reader: reader, + disableTargetInfo: cfg.disableTargetInfo, + withoutUnits: cfg.withoutUnits, + withoutCounterSuffixes: cfg.withoutCounterSuffixes, + disableScopeInfo: cfg.disableScopeInfo, + scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + metricFamilies: make(map[string]*dto.MetricFamily), + namespace: cfg.namespace, } if err := cfg.registerer.Register(collector); err != nil { @@ -387,12 +389,12 @@ func (c *collector) metricTypeAndName(m metricdata.Metrics) (*dto.MetricType, st case metricdata.Histogram[int64], metricdata.Histogram[float64]: return dto.MetricType_HISTOGRAM.Enum(), name case metricdata.Sum[float64]: - if v.IsMonotonic { + if v.IsMonotonic && !c.withoutCounterSuffixes { return dto.MetricType_COUNTER.Enum(), name + counterSuffix } return dto.MetricType_GAUGE.Enum(), name case metricdata.Sum[int64]: - if v.IsMonotonic { + if v.IsMonotonic && !c.withoutCounterSuffixes { return dto.MetricType_COUNTER.Enum(), name + counterSuffix } return dto.MetricType_GAUGE.Enum(), name diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index be3914d3e38..fb234aa1f26 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -71,6 +71,36 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) }, }, + { + name: "counter with suffixes disabled", + expectedFile: "testdata/counter_disabled_suffix.txt", + options: []Option{WithoutCounterSuffixes()}, + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter, err := meter.Float64Counter( + "foo", + otelmetric.WithDescription("a simple counter without a total suffix"), + otelmetric.WithUnit("ms"), + ) + require.NoError(t, err) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) + + attrs2 := attribute.NewSet( + attribute.Key("A").String("D"), + attribute.Key("C").String("B"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) + }, + }, { name: "gauge", expectedFile: "testdata/gauge.txt", diff --git a/exporters/prometheus/testdata/counter_disabled_suffix.txt b/exporters/prometheus/testdata/counter_disabled_suffix.txt new file mode 100755 index 00000000000..2e203b434a7 --- /dev/null +++ b/exporters/prometheus/testdata/counter_disabled_suffix.txt @@ -0,0 +1,10 @@ +# HELP foo_milliseconds a simple counter without a total suffix +# TYPE foo_milliseconds counter +foo_milliseconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +foo_milliseconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From 3e203acae364a6b7156596af2bc2e4e1696f2cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 14 Jul 2023 21:13:51 +0200 Subject: [PATCH 596/886] Fix changelog entry number for #4306 (#4314) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37b8e75bbd0..c653ff02a7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) -- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#TODO) +- Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) ### Changed From fdbcb9ac28e58f1673413d02b22f00921b1d73a9 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 16 Jul 2023 08:08:50 -0700 Subject: [PATCH 597/886] dependabot updates Sun Jul 16 15:03:07 UTC 2023 (#4329) Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump go.opentelemetry.io/build-tools/dbotconf from 0.8.0 to 0.9.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.8.0 to 0.9.0 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.8.0 to 0.9.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.8.0 to 0.9.0 in /internal/tools Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlptrace/otlptracehttp Bump go.opentelemetry.io/proto/otlp from 0.20.0 to 1.0.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc --- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- internal/tools/go.mod | 10 ++++----- internal/tools/go.sum | 22 +++++++++---------- 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 84a438d281c..c853a5090bd 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -24,7 +24,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/proto/otlp v0.20.0 // indirect + go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 0eef7b20b50..e6c8f8ae224 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -16,8 +16,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 7a633de34e6..e6de4a05d04 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index b2efa6ef70b..5e842f2732d 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -26,8 +26,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 41a05c43d8d..e58dc4b5212 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 13616a5229c..f50cfdefa80 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -23,8 +23,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 43a2dcc8d00..7c81578bfd6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 13616a5229c..f50cfdefa80 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -23,8 +23,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index bb0bfd4bb2c..f14b3aca25e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.56.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index b2efa6ef70b..5e842f2732d 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -26,8 +26,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 2d1778b3dff..f2f6d624c2e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.56.2 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index e9263158313..36b9e0b392a 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -22,8 +22,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 30186364388..e1701a39210 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - go.opentelemetry.io/proto/otlp v0.20.0 + go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 63c5d4eafe2..af8b14941b7 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -22,8 +22,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v0.20.0 h1:BLOA1cZBAGSbRiNuGCCKiFrCdYB7deeHDeD1SueyOfA= -go.opentelemetry.io/proto/otlp v0.20.0/go.mod h1:3QgjzPALBIv9pcknj2EXGPXjYPFdUh/RQfF8Lz3+Vnw= +go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= +go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b4a7d285da0..30e82b2be69 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,10 +9,10 @@ require ( github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.8.0 - go.opentelemetry.io/build-tools/dbotconf v0.8.0 - go.opentelemetry.io/build-tools/multimod v0.8.0 - go.opentelemetry.io/build-tools/semconvgen v0.8.0 + go.opentelemetry.io/build-tools/crosslink v0.9.0 + go.opentelemetry.io/build-tools/dbotconf v0.9.0 + go.opentelemetry.io/build-tools/multimod v0.9.0 + go.opentelemetry.io/build-tools/semconvgen v0.9.0 golang.org/x/tools v0.11.0 ) @@ -189,7 +189,7 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.2 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.8.0 // indirect + go.opentelemetry.io/build-tools v0.9.0 // indirect go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 9dbcc204664..ece4c286518 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -440,7 +440,7 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6 github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= -github.com/otiai10/copy v1.11.0 h1:OKBD80J/mLBrwnzXqGtFCzprFSGioo30JcmR4APsNwc= +github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= @@ -622,16 +622,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.8.0 h1:1CrmKOX/LEFwFOEyb0rBMQZchlKhoq3hveYrcA0Z87U= -go.opentelemetry.io/build-tools v0.8.0/go.mod h1:7NXCadpOTmjE97sdxQehCtGtwrmd4HFR6HNq5YJfYjw= -go.opentelemetry.io/build-tools/crosslink v0.8.0 h1:rYpcYwNX4//WbSvwHCiCPCczh9u+lYHLezrl9865nFA= -go.opentelemetry.io/build-tools/crosslink v0.8.0/go.mod h1:rWAN3EQ4rJn5ewknqw/0CkfkU4t7toCAtkl5q7VZP/M= -go.opentelemetry.io/build-tools/dbotconf v0.8.0 h1:akIDE+IpOhyNz3ycrmULwDepst8IVvi6U8tBEXz4mCQ= -go.opentelemetry.io/build-tools/dbotconf v0.8.0/go.mod h1:/97WQXoQFjQT5QjSeLksWshqjqMeKsGHn8o3+KvF0jE= -go.opentelemetry.io/build-tools/multimod v0.8.0 h1:6MARVCyZa5Tdn8KvRbSZzS7ypxB1gTrvLdeimCiBZSo= -go.opentelemetry.io/build-tools/multimod v0.8.0/go.mod h1:aPgW8qbcE6IoLge1LUKO5yo4XmnxsPIA+cdFjn93QrI= -go.opentelemetry.io/build-tools/semconvgen v0.8.0 h1:vRAmN8CxZk9gQuzftkfmud1qLdWoCfeX0JG7zAc/LzI= -go.opentelemetry.io/build-tools/semconvgen v0.8.0/go.mod h1:h0FPWeTZw4sfjNhfFdN3mMdbJfzI0XCaD+wTWe1r0xc= +go.opentelemetry.io/build-tools v0.9.0 h1:P6WstNx1gmj3bMFJFrJThuxFQlKztxOSCPR/2hBgkUg= +go.opentelemetry.io/build-tools v0.9.0/go.mod h1:ZoM+TLPhEhTi09/nI9YKPlU563ocHoWrQXD994N5dMc= +go.opentelemetry.io/build-tools/crosslink v0.9.0 h1:LOeJzMxsxBG2qMKeO22fRs91QvDfY+BA5pF1skTjbx0= +go.opentelemetry.io/build-tools/crosslink v0.9.0/go.mod h1:VaSi2ahs+r+v//m6OpqTkD5siSFVta9eTHhKqPsfH/Q= +go.opentelemetry.io/build-tools/dbotconf v0.9.0 h1:lEIVW6aJYgVOt/Ifyiwf0gSQvENZSvO1Mfq+hMFLeek= +go.opentelemetry.io/build-tools/dbotconf v0.9.0/go.mod h1:z+oKEld1zmGI/thdGcF6eOB8Mj5Ahde01gyLhVzgss8= +go.opentelemetry.io/build-tools/multimod v0.9.0 h1:Im9PCGhfmKQC2XR0aTYzADNiOZLk9QEQgibDhadH+i0= +go.opentelemetry.io/build-tools/multimod v0.9.0/go.mod h1:9KdBtlVebuj00X4bIt6DX1zagilSzIQmkJo8XzQ9OTQ= +go.opentelemetry.io/build-tools/semconvgen v0.9.0 h1:Tsqd5KAVI2onoX+3Bjg7rD4kA8JdBxmxTUHcAZddYKw= +go.opentelemetry.io/build-tools/semconvgen v0.9.0/go.mod h1:2kP8f7p2ecJfxuC3z+bqg5bVWRVWVuDpxkzKIAvl+wA= go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= From d18f20179ecd7c858d07d697dd29421214a48f8d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Jul 2023 07:15:50 -0700 Subject: [PATCH 598/886] Replace internal aggregate Aggregator with Measure/ComputeAggregation and a Builder (#4304) --- sdk/metric/instrument.go | 32 +- sdk/metric/instrument_test.go | 41 ++- sdk/metric/internal/aggregate/aggregate.go | 127 +++++++ sdk/metric/internal/aggregate/aggregator.go | 6 +- .../aggregate/aggregator_example_test.go | 6 +- .../internal/aggregate/aggregator_test.go | 10 +- sdk/metric/internal/aggregate/filter.go | 23 +- sdk/metric/internal/aggregate/filter_test.go | 14 +- sdk/metric/internal/aggregate/histogram.go | 8 +- .../internal/aggregate/histogram_test.go | 30 +- sdk/metric/internal/aggregate/lastvalue.go | 4 +- .../internal/aggregate/lastvalue_test.go | 12 +- sdk/metric/internal/aggregate/sum.go | 24 +- sdk/metric/internal/aggregate/sum_test.go | 58 ++-- sdk/metric/meter.go | 12 +- sdk/metric/pipeline.go | 202 ++++++----- sdk/metric/pipeline_registry_test.go | 313 ++++++++++++------ sdk/metric/pipeline_test.go | 18 +- 18 files changed, 577 insertions(+), 363 deletions(-) create mode 100644 sdk/metric/internal/aggregate/aggregate.go diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 6de8fe86904..b4d6fa8b35c 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -194,7 +194,7 @@ type streamID struct { } type int64Inst struct { - aggregators []aggregate.Aggregator[int64] + measures []aggregate.Measure[int64] embedded.Int64Counter embedded.Int64UpDownCounter @@ -219,13 +219,13 @@ func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { if err := ctx.Err(); err != nil { return } - for _, agg := range i.aggregators { - agg.Aggregate(val, s) + for _, in := range i.measures { + in(ctx, val, s) } } type float64Inst struct { - aggregators []aggregate.Aggregator[float64] + measures []aggregate.Measure[float64] embedded.Float64Counter embedded.Float64UpDownCounter @@ -250,8 +250,8 @@ func (i *float64Inst) aggregate(ctx context.Context, val float64, s attribute.Se if err := ctx.Err(); err != nil { return } - for _, agg := range i.aggregators { - agg.Aggregate(val, s) + for _, in := range i.measures { + in(ctx, val, s) } } @@ -277,9 +277,9 @@ var _ metric.Float64ObservableCounter = float64Observable{} var _ metric.Float64ObservableUpDownCounter = float64Observable{} var _ metric.Float64ObservableGauge = float64Observable{} -func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[float64]) float64Observable { +func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable { return float64Observable{ - observable: newObservable(scope, kind, name, desc, u, agg), + observable: newObservable(scope, kind, name, desc, u, meas), } } @@ -296,9 +296,9 @@ var _ metric.Int64ObservableCounter = int64Observable{} var _ metric.Int64ObservableUpDownCounter = int64Observable{} var _ metric.Int64ObservableGauge = int64Observable{} -func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[int64]) int64Observable { +func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable { return int64Observable{ - observable: newObservable(scope, kind, name, desc, u, agg), + observable: newObservable(scope, kind, name, desc, u, meas), } } @@ -306,10 +306,10 @@ type observable[N int64 | float64] struct { metric.Observable observablID[N] - aggregators []aggregate.Aggregator[N] + measures []aggregate.Measure[N] } -func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, agg []aggregate.Aggregator[N]) *observable[N] { +func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[N]) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, @@ -318,14 +318,14 @@ func newObservable[N int64 | float64](scope instrumentation.Scope, kind Instrume unit: u, scope: scope, }, - aggregators: agg, + measures: meas, } } // observe records the val for the set of attrs. func (o *observable[N]) observe(val N, s attribute.Set) { - for _, agg := range o.aggregators { - agg.Aggregate(val, s) + for _, in := range o.measures { + in(context.Background(), val, s) } } @@ -336,7 +336,7 @@ var errEmptyAgg = errors.New("no aggregators for observable instrument") // no-op because it does not have any aggregators. Also, an error is returned // if scope defines a Meter other than the one o was created by. func (o *observable[N]) registerable(scope instrumentation.Scope) error { - if len(o.aggregators) == 0 { + if len(o.measures) == 0 { return errEmptyAgg } if scope != o.scope { diff --git a/sdk/metric/instrument_test.go b/sdk/metric/instrument_test.go index 7aed2838348..29c2857c886 100644 --- a/sdk/metric/instrument_test.go +++ b/sdk/metric/instrument_test.go @@ -20,6 +20,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func BenchmarkInstrument(b *testing.B) { @@ -32,11 +33,21 @@ func BenchmarkInstrument(b *testing.B) { } b.Run("instrumentImpl/aggregate", func(b *testing.B) { - inst := int64Inst{aggregators: []aggregate.Aggregator[int64]{ - aggregate.NewLastValue[int64](), - aggregate.NewCumulativeSum[int64](true), - aggregate.NewDeltaSum[int64](true), - }} + build := aggregate.Builder[int64]{} + var meas []aggregate.Measure[int64] + + in, _ := build.LastValue() + meas = append(meas, in) + + build.Temporality = metricdata.CumulativeTemporality + in, _ = build.Sum(true) + meas = append(meas, in) + + build.Temporality = metricdata.DeltaTemporality + in, _ = build.Sum(true) + meas = append(meas, in) + + inst := int64Inst{measures: meas} ctx := context.Background() b.ReportAllocs() @@ -47,11 +58,21 @@ func BenchmarkInstrument(b *testing.B) { }) b.Run("observable/observe", func(b *testing.B) { - o := observable[int64]{aggregators: []aggregate.Aggregator[int64]{ - aggregate.NewLastValue[int64](), - aggregate.NewCumulativeSum[int64](true), - aggregate.NewDeltaSum[int64](true), - }} + build := aggregate.Builder[int64]{} + var meas []aggregate.Measure[int64] + + in, _ := build.LastValue() + meas = append(meas, in) + + build.Temporality = metricdata.CumulativeTemporality + in, _ = build.Sum(true) + meas = append(meas, in) + + build.Temporality = metricdata.DeltaTemporality + in, _ = build.Sum(true) + meas = append(meas, in) + + o := observable[int64]{measures: meas} b.ReportAllocs() b.ResetTimer() diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go new file mode 100644 index 00000000000..f386c337135 --- /dev/null +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -0,0 +1,127 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Measure receives measurements to be aggregated. +type Measure[N int64 | float64] func(context.Context, N, attribute.Set) + +// ComputeAggregation stores the aggregate of measurements into dest and +// returns the number of aggregate data-points output. +type ComputeAggregation func(dest *metricdata.Aggregation) int + +// Builder builds an aggregate function. +type Builder[N int64 | float64] struct { + // Temporality is the temporality used for the returned aggregate function. + // + // If this is not provided a default of cumulative will be used (except for + // the last-value aggregate function where delta is the only appropriate + // temporality). + Temporality metricdata.Temporality + // Filter is the attribute filter the aggregate function will use on the + // input of measurements. + Filter attribute.Filter +} + +func (b Builder[N]) input(agg aggregator[N]) Measure[N] { + if b.Filter != nil { + agg = newFilter[N](agg, b.Filter) + } + return func(_ context.Context, n N, a attribute.Set) { + agg.Aggregate(n, a) + } +} + +// LastValue returns a last-value aggregate function input and output. +// +// The Builder.Temporality is ignored and delta is use always. +func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { + // Delta temporality is the only temporality that makes semantic sense for + // a last-value aggregate. + lv := newLastValue[N]() + + return b.input(lv), func(dest *metricdata.Aggregation) int { + // TODO (#4220): optimize memory reuse here. + *dest = lv.Aggregation() + + gData, _ := (*dest).(metricdata.Gauge[N]) + return len(gData.DataPoints) + } +} + +// PrecomputedSum returns a sum aggregate function input and output. The +// arguments passed to the input are expected to be the precomputed sum values. +func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation) { + var s aggregator[N] + switch b.Temporality { + case metricdata.DeltaTemporality: + s = newPrecomputedDeltaSum[N](monotonic) + default: + s = newPrecomputedCumulativeSum[N](monotonic) + } + + return b.input(s), func(dest *metricdata.Aggregation) int { + // TODO (#4220): optimize memory reuse here. + *dest = s.Aggregation() + + sData, _ := (*dest).(metricdata.Sum[N]) + return len(sData.DataPoints) + } +} + +// Sum returns a sum aggregate function input and output. +func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { + var s aggregator[N] + switch b.Temporality { + case metricdata.DeltaTemporality: + s = newDeltaSum[N](monotonic) + default: + s = newCumulativeSum[N](monotonic) + } + + return b.input(s), func(dest *metricdata.Aggregation) int { + // TODO (#4220): optimize memory reuse here. + *dest = s.Aggregation() + + sData, _ := (*dest).(metricdata.Sum[N]) + return len(sData.DataPoints) + } +} + +// ExplicitBucketHistogram returns a histogram aggregate function input and +// output. +func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistogram) (Measure[N], ComputeAggregation) { + var h aggregator[N] + switch b.Temporality { + case metricdata.DeltaTemporality: + h = newDeltaHistogram[N](cfg) + default: + h = newCumulativeHistogram[N](cfg) + } + return b.input(h), func(dest *metricdata.Aggregation) int { + // TODO (#4220): optimize memory reuse here. + *dest = h.Aggregation() + + hData, _ := (*dest).(metricdata.Histogram[N]) + return len(hData.DataPoints) + } +} diff --git a/sdk/metric/internal/aggregate/aggregator.go b/sdk/metric/internal/aggregate/aggregator.go index 1c8c2428a4b..03d814d9b4a 100644 --- a/sdk/metric/internal/aggregate/aggregator.go +++ b/sdk/metric/internal/aggregate/aggregator.go @@ -25,11 +25,11 @@ import ( // override the default time.Now function. var now = time.Now -// Aggregator forms an aggregation from a collection of recorded measurements. +// aggregator forms an aggregation from a collection of recorded measurements. // // Aggregators need to be comparable so they can be de-duplicated by the SDK // when it creates them for multiple views. -type Aggregator[N int64 | float64] interface { +type aggregator[N int64 | float64] interface { // Aggregate records the measurement, scoped by attr, and aggregates it // into an aggregation. Aggregate(measurement N, attr attribute.Set) @@ -45,7 +45,7 @@ type precomputeAggregator[N int64 | float64] interface { // The Aggregate method of the embedded Aggregator is used to record // pre-computed measurements, scoped by attributes that have not been // filtered by an attribute filter. - Aggregator[N] + aggregator[N] // aggregateFiltered records measurements scoped by attributes that have // been filtered by an attribute filter. diff --git a/sdk/metric/internal/aggregate/aggregator_example_test.go b/sdk/metric/internal/aggregate/aggregator_example_test.go index 2376f5ea10a..7b566b957d9 100644 --- a/sdk/metric/internal/aggregate/aggregator_example_test.go +++ b/sdk/metric/internal/aggregate/aggregator_example_test.go @@ -37,7 +37,7 @@ func (p *meter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64 // temporality to used based on the Reader and View configuration. Assume // here these are determined to be a cumulative sum. - aggregator := NewCumulativeSum[int64](true) + aggregator := newCumulativeSum[int64](true) count := inst{aggregateFunc: aggregator.Aggregate} p.aggregations = append(p.aggregations, aggregator.Aggregation()) @@ -54,7 +54,7 @@ func (p *meter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) ( // configuration. Assume here these are determined to be a last-value // aggregation (the temporality does not affect the produced aggregations). - aggregator := NewLastValue[int64]() + aggregator := newLastValue[int64]() upDownCount := inst{aggregateFunc: aggregator.Aggregate} p.aggregations = append(p.aggregations, aggregator.Aggregation()) @@ -71,7 +71,7 @@ func (p *meter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.I // Assume here these are determined to be a delta explicit-bucket // histogram. - aggregator := NewDeltaHistogram[int64](aggregation.ExplicitBucketHistogram{ + aggregator := newDeltaHistogram[int64](aggregation.ExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, NoMinMax: false, }) diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go index d0569fb1ca7..3efc3a0ecba 100644 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -84,12 +84,12 @@ type aggregatorTester[N int64 | float64] struct { CycleN int } -func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap[N], eFunc expectFunc) func(*testing.T) { +func (at *aggregatorTester[N]) Run(a aggregator[N], incr setMap[N], eFunc expectFunc) func(*testing.T) { m := at.MeasurementN * at.GoroutineN return func(t *testing.T) { t.Run("Comparable", func(t *testing.T) { assert.NotPanics(t, func() { - _ = map[Aggregator[N]]struct{}{a: {}} + _ = map[aggregator[N]]struct{}{a: {}} }) }) @@ -117,7 +117,7 @@ func (at *aggregatorTester[N]) Run(a Aggregator[N], incr setMap[N], eFunc expect var bmarkResults metricdata.Aggregation -func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() Aggregator[N], count int) { +func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() aggregator[N], count int) { attrs := make([]attribute.Set, count) for i := range attrs { attrs[i] = attribute.NewSet(attribute.Int("value", i)) @@ -137,7 +137,7 @@ func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() Aggreg }) b.Run("Aggregations", func(b *testing.B) { - aggs := make([]Aggregator[N], b.N) + aggs := make([]aggregator[N], b.N) for n := range aggs { a := factory() for _, attr := range attrs { @@ -155,7 +155,7 @@ func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() Aggreg }) } -func benchmarkAggregator[N int64 | float64](factory func() Aggregator[N]) func(*testing.B) { +func benchmarkAggregator[N int64 | float64](factory func() aggregator[N]) func(*testing.B) { counts := []int{1, 10, 100} return func(b *testing.B) { for _, n := range counts { diff --git a/sdk/metric/internal/aggregate/filter.go b/sdk/metric/internal/aggregate/filter.go index 241936a6ea7..782c28a85df 100644 --- a/sdk/metric/internal/aggregate/filter.go +++ b/sdk/metric/internal/aggregate/filter.go @@ -19,18 +19,21 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -// NewFilter returns an Aggregator that wraps an agg with an attribute +// newFilter returns an Aggregator that wraps an agg with an attribute // filtering function. Both pre-computed non-pre-computed Aggregators can be // passed for agg. An appropriate Aggregator will be returned for the detected // type. -func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggregator[N] { +func newFilter[N int64 | float64](agg aggregator[N], fn attribute.Filter) aggregator[N] { if fn == nil { return agg } if fa, ok := agg.(precomputeAggregator[N]); ok { return newPrecomputedFilter(fa, fn) } - return newFilter(agg, fn) + return &filter[N]{ + filter: fn, + aggregator: agg, + } } // filter wraps an aggregator with an attribute filter. All recorded @@ -41,19 +44,7 @@ func NewFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) Aggreg // precomputedFilter instead. type filter[N int64 | float64] struct { filter attribute.Filter - aggregator Aggregator[N] -} - -// newFilter returns an filter Aggregator that wraps agg with the attribute -// filter fn. -// -// This should not be used to wrap a pre-computed Aggregator. Use a -// precomputedFilter instead. -func newFilter[N int64 | float64](agg Aggregator[N], fn attribute.Filter) *filter[N] { - return &filter[N]{ - filter: fn, - aggregator: agg, - } + aggregator aggregator[N] } // Aggregate records the measurement, scoped by attr, and aggregates it diff --git a/sdk/metric/internal/aggregate/filter_test.go b/sdk/metric/internal/aggregate/filter_test.go index a540c3a453f..e348e7582ea 100644 --- a/sdk/metric/internal/aggregate/filter_test.go +++ b/sdk/metric/internal/aggregate/filter_test.go @@ -54,13 +54,13 @@ func (a *testStableAggregator[N]) Aggregation() metricdata.Aggregation { } } -func testNewFilterNoFilter[N int64 | float64](t *testing.T, agg Aggregator[N]) { - filter := NewFilter(agg, nil) +func testNewFilterNoFilter[N int64 | float64](t *testing.T, agg aggregator[N]) { + filter := newFilter(agg, nil) assert.Equal(t, agg, filter) } -func testNewFilter[N int64 | float64](t *testing.T, agg Aggregator[N]) { - f := NewFilter(agg, testAttributeFilter) +func testNewFilter[N int64 | float64](t *testing.T, agg aggregator[N]) { + f := newFilter(agg, testAttributeFilter) require.IsType(t, &filter[N]{}, f) filt := f.(*filter[N]) assert.Equal(t, agg, filt.aggregator) @@ -147,7 +147,7 @@ func testFilterAggregate[N int64 | float64](t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - f := NewFilter[N](&testStableAggregator[N]{}, testAttributeFilter) + f := newFilter[N](&testStableAggregator[N]{}, testAttributeFilter) for _, set := range tt.inputAttr { f.Aggregate(1, set) } @@ -167,7 +167,7 @@ func TestFilterAggregate(t *testing.T) { } func testFilterConcurrent[N int64 | float64](t *testing.T) { - f := NewFilter[N](&testStableAggregator[N]{}, testAttributeFilter) + f := newFilter[N](&testStableAggregator[N]{}, testAttributeFilter) wg := &sync.WaitGroup{} wg.Add(2) @@ -205,7 +205,7 @@ func TestPrecomputedFilter(t *testing.T) { func testPrecomputedFilter[N int64 | float64]() func(t *testing.T) { return func(t *testing.T) { agg := newTestFilterAgg[N]() - f := NewFilter[N](agg, testAttributeFilter) + f := newFilter[N](agg, testAttributeFilter) require.IsType(t, &precomputedFilter[N]{}, f) var ( diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index 8268c42bc75..a7a7780c307 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -100,14 +100,14 @@ func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { b.bin(idx, value) } -// NewDeltaHistogram returns an Aggregator that summarizes a set of +// newDeltaHistogram returns an Aggregator that summarizes a set of // measurements as an histogram. Each histogram is scoped by attributes and // the aggregation cycle the measurements were made in. // // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregations method is called it will reset all histogram // counts to zero. -func NewDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) Aggregator[N] { +func newDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) aggregator[N] { return &deltaHistogram[N]{ histValues: newHistValues[N](cfg.Boundaries), noMinMax: cfg.NoMinMax, @@ -164,13 +164,13 @@ func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { return h } -// NewCumulativeHistogram returns an Aggregator that summarizes a set of +// newCumulativeHistogram returns an Aggregator that summarizes a set of // measurements as an histogram. Each histogram is scoped by attributes. // // Each aggregation cycle builds from the previous, the histogram counts are // the bucketed counts of all values aggregated since the returned Aggregator // was created. -func NewCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) Aggregator[N] { +func newCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) aggregator[N] { return &cumulativeHistogram[N]{ histValues: newHistValues[N](cfg.Boundaries), noMinMax: cfg.NoMinMax, diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index 5bf4117d36c..3656be9e988 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -50,9 +50,9 @@ func testHistogram[N int64 | float64](t *testing.T) { incr := monoIncr[N]() eFunc := deltaHistExpecter[N](incr) - t.Run("Delta", tester.Run(NewDeltaHistogram[N](histConf), incr, eFunc)) + t.Run("Delta", tester.Run(newDeltaHistogram[N](histConf), incr, eFunc)) eFunc = cumuHistExpecter[N](incr) - t.Run("Cumulative", tester.Run(NewCumulativeHistogram[N](histConf), incr, eFunc)) + t.Run("Cumulative", tester.Run(newCumulativeHistogram[N](histConf), incr, eFunc)) } func deltaHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { @@ -122,7 +122,7 @@ func testBucketsBin[N int64 | float64]() func(t *testing.T) { } } -func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram) Aggregator[N], getBounds func(Aggregator[N]) []float64) func(t *testing.T) { +func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram) aggregator[N], getBounds func(aggregator[N]) []float64) func(t *testing.T) { b := []float64{0, 1, 2} cpB := make([]float64, len(b)) copy(cpB, b) @@ -143,16 +143,16 @@ func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBu func TestHistogramImmutableBounds(t *testing.T) { t.Run("Delta", testHistImmutableBounds( - NewDeltaHistogram[int64], - func(a Aggregator[int64]) []float64 { + newDeltaHistogram[int64], + func(a aggregator[int64]) []float64 { deltaH := a.(*deltaHistogram[int64]) return deltaH.bounds }, )) t.Run("Cumulative", testHistImmutableBounds( - NewCumulativeHistogram[int64], - func(a Aggregator[int64]) []float64 { + newCumulativeHistogram[int64], + func(a aggregator[int64]) []float64 { cumuH := a.(*cumulativeHistogram[int64]) return cumuH.bounds }, @@ -160,7 +160,7 @@ func TestHistogramImmutableBounds(t *testing.T) { } func TestCumulativeHistogramImutableCounts(t *testing.T) { - a := NewCumulativeHistogram[int64](histConf) + a := newCumulativeHistogram[int64](histConf) a.Aggregate(5, alice) hdp := a.Aggregation().(metricdata.Histogram[int64]).DataPoints[0] @@ -176,7 +176,7 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - a := NewDeltaHistogram[int64](histConf) + a := newDeltaHistogram[int64](histConf) assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) @@ -195,10 +195,10 @@ func TestDeltaHistogramReset(t *testing.T) { } func TestEmptyHistogramNilAggregation(t *testing.T) { - assert.Nil(t, NewCumulativeHistogram[int64](histConf).Aggregation()) - assert.Nil(t, NewCumulativeHistogram[float64](histConf).Aggregation()) - assert.Nil(t, NewDeltaHistogram[int64](histConf).Aggregation()) - assert.Nil(t, NewDeltaHistogram[float64](histConf).Aggregation()) + assert.Nil(t, newCumulativeHistogram[int64](histConf).Aggregation()) + assert.Nil(t, newCumulativeHistogram[float64](histConf).Aggregation()) + assert.Nil(t, newDeltaHistogram[int64](histConf).Aggregation()) + assert.Nil(t, newDeltaHistogram[float64](histConf).Aggregation()) } func BenchmarkHistogram(b *testing.B) { @@ -207,8 +207,8 @@ func BenchmarkHistogram(b *testing.B) { } func benchmarkHistogram[N int64 | float64](b *testing.B) { - factory := func() Aggregator[N] { return NewDeltaHistogram[N](histConf) } + factory := func() aggregator[N] { return newDeltaHistogram[N](histConf) } b.Run("Delta", benchmarkAggregator(factory)) - factory = func() Aggregator[N] { return NewCumulativeHistogram[N](histConf) } + factory = func() aggregator[N] { return newCumulativeHistogram[N](histConf) } b.Run("Cumulative", benchmarkAggregator(factory)) } diff --git a/sdk/metric/internal/aggregate/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go index 2f2f63a3320..7a8e7d3b956 100644 --- a/sdk/metric/internal/aggregate/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -35,9 +35,9 @@ type lastValue[N int64 | float64] struct { values map[attribute.Set]datapoint[N] } -// NewLastValue returns an Aggregator that summarizes a set of measurements as +// newLastValue returns an Aggregator that summarizes a set of measurements as // the last one made. -func NewLastValue[N int64 | float64]() Aggregator[N] { +func newLastValue[N int64 | float64]() aggregator[N] { return &lastValue[N]{values: make(map[attribute.Set]datapoint[N])} } diff --git a/sdk/metric/internal/aggregate/lastvalue_test.go b/sdk/metric/internal/aggregate/lastvalue_test.go index 3d5d92b3a75..caf0735ba26 100644 --- a/sdk/metric/internal/aggregate/lastvalue_test.go +++ b/sdk/metric/internal/aggregate/lastvalue_test.go @@ -47,13 +47,13 @@ func testLastValue[N int64 | float64]() func(*testing.T) { return func(int) metricdata.Aggregation { return gauge } } incr := monoIncr[N]() - return tester.Run(NewLastValue[N](), incr, eFunc(incr)) + return tester.Run(newLastValue[N](), incr, eFunc(incr)) } func testLastValueReset[N int64 | float64](t *testing.T) { t.Cleanup(mockTime(now)) - a := NewLastValue[N]() + a := newLastValue[N]() assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) @@ -86,11 +86,11 @@ func TestLastValueReset(t *testing.T) { } func TestEmptyLastValueNilAggregation(t *testing.T) { - assert.Nil(t, NewLastValue[int64]().Aggregation()) - assert.Nil(t, NewLastValue[float64]().Aggregation()) + assert.Nil(t, newLastValue[int64]().Aggregation()) + assert.Nil(t, newLastValue[float64]().Aggregation()) } func BenchmarkLastValue(b *testing.B) { - b.Run("Int64", benchmarkAggregator(NewLastValue[int64])) - b.Run("Float64", benchmarkAggregator(NewLastValue[float64])) + b.Run("Int64", benchmarkAggregator(newLastValue[int64])) + b.Run("Float64", benchmarkAggregator(newLastValue[float64])) } diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index 1d1a7b0320c..14af6273cbd 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -38,7 +38,7 @@ func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { s.Unlock() } -// NewDeltaSum returns an Aggregator that summarizes a set of measurements as +// newDeltaSum returns an Aggregator that summarizes a set of measurements as // their arithmetic sum. Each sum is scoped by attributes and the aggregation // cycle the measurements were made in. // @@ -48,11 +48,7 @@ func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { // // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. -func NewDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { - return newDeltaSum[N](monotonic) -} - -func newDeltaSum[N int64 | float64](monotonic bool) *deltaSum[N] { +func newDeltaSum[N int64 | float64](monotonic bool) aggregator[N] { return &deltaSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -98,7 +94,7 @@ func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { return out } -// NewCumulativeSum returns an Aggregator that summarizes a set of +// newCumulativeSum returns an Aggregator that summarizes a set of // measurements as their arithmetic sum. Each sum is scoped by attributes and // the aggregation cycle the measurements were made in. // @@ -108,11 +104,7 @@ func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { // // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregation method is called it will reset all sums to zero. -func NewCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { - return newCumulativeSum[N](monotonic) -} - -func newCumulativeSum[N int64 | float64](monotonic bool) *cumulativeSum[N] { +func newCumulativeSum[N int64 | float64](monotonic bool) aggregator[N] { return &cumulativeSum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, @@ -215,7 +207,7 @@ func (s *precomputedMap[N]) aggregateFiltered(value N, attr attribute.Set) { // s.Unlock() } -// NewPrecomputedDeltaSum returns an Aggregator that summarizes a set of +// newPrecomputedDeltaSum returns an Aggregator that summarizes a set of // pre-computed sums. Each sum is scoped by attributes and the aggregation // cycle the measurements were made in. // @@ -224,7 +216,7 @@ func (s *precomputedMap[N]) aggregateFiltered(value N, attr attribute.Set) { // // value is accurate. It is up to the caller to ensure it. // // The output Aggregation will report recorded values as delta temporality. -func NewPrecomputedDeltaSum[N int64 | float64](monotonic bool) Aggregator[N] { +func newPrecomputedDeltaSum[N int64 | float64](monotonic bool) aggregator[N] { return &precomputedDeltaSum[N]{ precomputedMap: newPrecomputedMap[N](), reported: make(map[attribute.Set]N), @@ -290,7 +282,7 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { return out } -// NewPrecomputedCumulativeSum returns an Aggregator that summarizes a set of +// newPrecomputedCumulativeSum returns an Aggregator that summarizes a set of // pre-computed sums. Each sum is scoped by attributes and the aggregation // cycle the measurements were made in. // @@ -300,7 +292,7 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { // // The output Aggregation will report recorded values as cumulative // temporality. -func NewPrecomputedCumulativeSum[N int64 | float64](monotonic bool) Aggregator[N] { +func newPrecomputedCumulativeSum[N int64 | float64](monotonic bool) aggregator[N] { return &precomputedCumulativeSum[N]{ precomputedMap: newPrecomputedMap[N](), monotonic: monotonic, diff --git a/sdk/metric/internal/aggregate/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go index 4fff11b4128..e128459b1d0 100644 --- a/sdk/metric/internal/aggregate/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -41,41 +41,41 @@ func testSum[N int64 | float64](t *testing.T) { t.Run("Delta", func(t *testing.T) { incr, mono := monoIncr[N](), true eFunc := deltaExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) + t.Run("Monotonic", tester.Run(newDeltaSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false eFunc = deltaExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(NewDeltaSum[N](mono), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(newDeltaSum[N](mono), incr, eFunc)) }) t.Run("Cumulative", func(t *testing.T) { incr, mono := monoIncr[N](), true eFunc := cumuExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) + t.Run("Monotonic", tester.Run(newCumulativeSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false eFunc = cumuExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(NewCumulativeSum[N](mono), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(newCumulativeSum[N](mono), incr, eFunc)) }) t.Run("PreComputedDelta", func(t *testing.T) { incr, mono := monoIncr[N](), true eFunc := preDeltaExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) + t.Run("Monotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false eFunc = preDeltaExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(NewPrecomputedDeltaSum[N](mono), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) }) t.Run("PreComputedCumulative", func(t *testing.T) { incr, mono := monoIncr[N](), true eFunc := preCumuExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) + t.Run("Monotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false eFunc = preCumuExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(NewPrecomputedCumulativeSum[N](mono), incr, eFunc)) + t.Run("NonMonotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) }) } @@ -141,7 +141,7 @@ func point[N int64 | float64](a attribute.Set, v N) metricdata.DataPoint[N] { func testDeltaSumReset[N int64 | float64](t *testing.T) { t.Cleanup(mockTime(now)) - a := NewDeltaSum[N](false) + a := newDeltaSum[N](false) assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) @@ -166,7 +166,7 @@ func TestDeltaSumReset(t *testing.T) { func TestPreComputedDeltaSum(t *testing.T) { var mono bool - agg := NewPrecomputedDeltaSum[int64](mono) + agg := newPrecomputedDeltaSum[int64](mono) require.Implements(t, (*precomputeAggregator[int64])(nil), agg) attrs := attribute.NewSet(attribute.String("key", "val")) @@ -231,7 +231,7 @@ func TestPreComputedDeltaSum(t *testing.T) { func TestPreComputedCumulativeSum(t *testing.T) { var mono bool - agg := NewPrecomputedCumulativeSum[int64](mono) + agg := newPrecomputedCumulativeSum[int64](mono) require.Implements(t, (*precomputeAggregator[int64])(nil), agg) attrs := attribute.NewSet(attribute.String("key", "val")) @@ -282,22 +282,22 @@ func TestPreComputedCumulativeSum(t *testing.T) { } func TestEmptySumNilAggregation(t *testing.T) { - assert.Nil(t, NewCumulativeSum[int64](true).Aggregation()) - assert.Nil(t, NewCumulativeSum[int64](false).Aggregation()) - assert.Nil(t, NewCumulativeSum[float64](true).Aggregation()) - assert.Nil(t, NewCumulativeSum[float64](false).Aggregation()) - assert.Nil(t, NewDeltaSum[int64](true).Aggregation()) - assert.Nil(t, NewDeltaSum[int64](false).Aggregation()) - assert.Nil(t, NewDeltaSum[float64](true).Aggregation()) - assert.Nil(t, NewDeltaSum[float64](false).Aggregation()) - assert.Nil(t, NewPrecomputedCumulativeSum[int64](true).Aggregation()) - assert.Nil(t, NewPrecomputedCumulativeSum[int64](false).Aggregation()) - assert.Nil(t, NewPrecomputedCumulativeSum[float64](true).Aggregation()) - assert.Nil(t, NewPrecomputedCumulativeSum[float64](false).Aggregation()) - assert.Nil(t, NewPrecomputedDeltaSum[int64](true).Aggregation()) - assert.Nil(t, NewPrecomputedDeltaSum[int64](false).Aggregation()) - assert.Nil(t, NewPrecomputedDeltaSum[float64](true).Aggregation()) - assert.Nil(t, NewPrecomputedDeltaSum[float64](false).Aggregation()) + assert.Nil(t, newCumulativeSum[int64](true).Aggregation()) + assert.Nil(t, newCumulativeSum[int64](false).Aggregation()) + assert.Nil(t, newCumulativeSum[float64](true).Aggregation()) + assert.Nil(t, newCumulativeSum[float64](false).Aggregation()) + assert.Nil(t, newDeltaSum[int64](true).Aggregation()) + assert.Nil(t, newDeltaSum[int64](false).Aggregation()) + assert.Nil(t, newDeltaSum[float64](true).Aggregation()) + assert.Nil(t, newDeltaSum[float64](false).Aggregation()) + assert.Nil(t, newPrecomputedCumulativeSum[int64](true).Aggregation()) + assert.Nil(t, newPrecomputedCumulativeSum[int64](false).Aggregation()) + assert.Nil(t, newPrecomputedCumulativeSum[float64](true).Aggregation()) + assert.Nil(t, newPrecomputedCumulativeSum[float64](false).Aggregation()) + assert.Nil(t, newPrecomputedDeltaSum[int64](true).Aggregation()) + assert.Nil(t, newPrecomputedDeltaSum[int64](false).Aggregation()) + assert.Nil(t, newPrecomputedDeltaSum[float64](true).Aggregation()) + assert.Nil(t, newPrecomputedDeltaSum[float64](false).Aggregation()) } func BenchmarkSum(b *testing.B) { @@ -309,8 +309,8 @@ func benchmarkSum[N int64 | float64](b *testing.B) { // The monotonic argument is only used to annotate the Sum returned from // the Aggregation method. It should not have an effect on operational // performance, therefore, only monotonic=false is benchmarked here. - factory := func() Aggregator[N] { return NewDeltaSum[N](false) } + factory := func() aggregator[N] { return newDeltaSum[N](false) } b.Run("Delta", benchmarkAggregator(factory)) - factory = func() Aggregator[N] { return NewCumulativeSum[N](false) } + factory = func() aggregator[N] { return newCumulativeSum[N](false) } b.Run("Cumulative", benchmarkAggregator(factory)) } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 64ff1d9e705..7e1d32be249 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -451,7 +451,7 @@ func newInt64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, return &int64InstProvider{scope: s, pipes: p, resolve: newResolver[int64](p, c)} } -func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[int64], error) { +func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[int64], error) { inst := Instrument{ Name: name, Description: desc, @@ -465,7 +465,7 @@ func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]a // lookup returns the resolved instrumentImpl. func (p *int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) - return &int64Inst{aggregators: aggs}, err + return &int64Inst{measures: aggs}, err } // float64InstProvider provides float64 OpenTelemetry instruments. @@ -479,7 +479,7 @@ func newFloat64InstProvider(s instrumentation.Scope, p pipelines, c *cache[strin return &float64InstProvider{scope: s, pipes: p, resolve: newResolver[float64](p, c)} } -func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Aggregator[float64], error) { +func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[float64], error) { inst := Instrument{ Name: name, Description: desc, @@ -493,7 +493,7 @@ func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([ // lookup returns the resolved instrumentImpl. func (p *float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) - return &float64Inst{aggregators: aggs}, err + return &float64Inst{measures: aggs}, err } type int64ObservProvider struct{ *int64InstProvider } @@ -504,7 +504,7 @@ func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) ( } func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []metric.Int64Callback) { - if inst.observable == nil || len(inst.aggregators) == 0 { + if inst.observable == nil || len(inst.measures) == 0 { // Drop aggregator. return } @@ -537,7 +537,7 @@ func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) } func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []metric.Float64Callback) { - if inst.observable == nil || len(inst.aggregators) == 0 { + if inst.observable == nil || len(inst.measures) == 0 { // Drop aggregator. return } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 3fa3960b825..a6a6c8ca44c 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -21,6 +21,7 @@ import ( "fmt" "strings" "sync" + "sync/atomic" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" @@ -37,20 +38,15 @@ var ( errCreatingAggregators = errors.New("could not create all aggregators") errIncompatibleAggregation = errors.New("incompatible aggregation") errUnknownAggregation = errors.New("unrecognized aggregation") - errUnknownTemporality = errors.New("unrecognized temporality") ) -type aggregator interface { - Aggregation() metricdata.Aggregation -} - // instrumentSync is a synchronization point between a pipeline and an -// instrument's Aggregators. +// instrument's aggregate function. type instrumentSync struct { name string description string unit string - aggregator aggregator + compAgg aggregate.ComputeAggregation } func newPipeline(res *resource.Resource, reader Reader, views []View) *pipeline { @@ -68,8 +64,9 @@ func newPipeline(res *resource.Resource, reader Reader, views []View) *pipeline // pipeline connects all of the instruments created by a meter provider to a Reader. // This is the object that will be `Reader.register()` when a meter provider is created. // -// As instruments are created the instrument should be checked if it exists in the -// views of a the Reader, and if so each aggregator should be added to the pipeline. +// As instruments are created the instrument should be checked if it exists in +// the views of a the Reader, and if so each aggregate function should be added +// to the pipeline. type pipeline struct { resource *resource.Resource @@ -161,8 +158,8 @@ func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) rm.ScopeMetrics[i].Metrics = internal.ReuseSlice(rm.ScopeMetrics[i].Metrics, len(instruments)) j := 0 for _, inst := range instruments { - data := inst.aggregator.Aggregation() - if data != nil { + data := rm.ScopeMetrics[i].Metrics[j].Data + if n := inst.compAgg(&data); n > 0 { rm.ScopeMetrics[i].Metrics[j].Name = inst.name rm.ScopeMetrics[i].Metrics[j].Description = inst.description rm.ScopeMetrics[i].Metrics[j].Unit = inst.unit @@ -185,11 +182,11 @@ func (p *pipeline) produce(ctx context.Context, rm *metricdata.ResourceMetrics) // inserter facilitates inserting of new instruments from a single scope into a // pipeline. type inserter[N int64 | float64] struct { - // aggregators is a cache that holds Aggregators inserted into the - // underlying reader pipeline. This cache ensures no duplicate Aggregators - // are inserted into the reader pipeline and if a new request during an - // instrument creation asks for the same Aggregator the same instance is - // returned. + // aggregators is a cache that holds aggregate function inputs whose + // outputs have been inserted into the underlying reader pipeline. This + // cache ensures no duplicate aggregate functions are inserted into the + // reader pipeline and if a new request during an instrument creation asks + // for the same aggregate function input the same instance is returned. aggregators *cache[streamID, aggVal[N]] // views is a cache that holds instrument identifiers for all the @@ -215,35 +212,34 @@ func newInserter[N int64 | float64](p *pipeline, vc *cache[string, streamID]) *i // Instrument inserts the instrument inst with instUnit into a pipeline. All // views the pipeline contains are matched against, and any matching view that -// creates a unique Aggregator will be inserted into the pipeline and included -// in the returned slice. +// creates a unique aggregate function will have its output inserted into the +// pipeline and its input included in the returned slice. // -// The returned Aggregators are ensured to be deduplicated and unique. If -// another view in another pipeline that is cached by this inserter's cache has -// already inserted the same Aggregator for the same instrument, that -// Aggregator instance is returned. +// The returned aggregate function inputs are ensured to be deduplicated and +// unique. If another view in another pipeline that is cached by this +// inserter's cache has already inserted the same aggregate function for the +// same instrument, that functions input instance is returned. // // If another instrument has already been inserted by this inserter, or any // other using the same cache, and it conflicts with the instrument being -// inserted in this call, an Aggregator matching the arguments will still be -// returned but an Info level log message will also be logged to the OTel -// global logger. +// inserted in this call, an aggregate function input matching the arguments +// will still be returned but an Info level log message will also be logged to +// the OTel global logger. // -// If the passed instrument would result in an incompatible Aggregator, an -// error is returned and that Aggregator is not inserted or returned. +// If the passed instrument would result in an incompatible aggregate function, +// an error is returned and that aggregate function output is not inserted nor +// is its input returned. // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Aggregator[N], error) { +func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error) { var ( - matched bool - aggs []aggregate.Aggregator[N] + matched bool + measures []aggregate.Measure[N] ) errs := &multierror{wrapped: errCreatingAggregators} - // The cache will return the same Aggregator instance. Use this fact to - // compare pointer addresses to deduplicate Aggregators. - seen := make(map[aggregate.Aggregator[N]]struct{}) + seen := make(map[uint64]struct{}) for _, v := range i.pipeline.views { stream, match := v(inst) if !match { @@ -251,23 +247,23 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Aggregator[N], er } matched = true - agg, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) + in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) if err != nil { errs.append(err) } - if agg == nil { // Drop aggregator. + if in == nil { // Drop aggregation. continue } - if _, ok := seen[agg]; ok { - // This aggregator has already been added. + if _, ok := seen[id]; ok { + // This aggregate function has already been added. continue } - seen[agg] = struct{}{} - aggs = append(aggs, agg) + seen[id] = struct{}{} + measures = append(measures, in) } if matched { - return aggs, errs.errorOrNil() + return measures, errs.errorOrNil() } // Apply implicit default view if no explicit matched. @@ -276,37 +272,41 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Aggregator[N], er Description: inst.Description, Unit: inst.Unit, } - agg, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) + in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) if err != nil { errs.append(err) } - if agg != nil { + if in != nil { // Ensured to have not seen given matched was false. - aggs = append(aggs, agg) + measures = append(measures, in) } - return aggs, errs.errorOrNil() + return measures, errs.errorOrNil() } +var aggIDCount uint64 + // aggVal is the cached value in an aggregators cache. type aggVal[N int64 | float64] struct { - Aggregator aggregate.Aggregator[N] - Err error + ID uint64 + Measure aggregate.Measure[N] + Err error } -// cachedAggregator returns the appropriate Aggregator for an instrument -// configuration. If the exact instrument has been created within the -// inst.Scope, that Aggregator instance will be returned. Otherwise, a new -// computed Aggregator will be cached and returned. +// cachedAggregator returns the appropriate aggregate input and output +// functions for an instrument configuration. If the exact instrument has been +// created within the inst.Scope, those aggregate function instances will be +// returned. Otherwise, new computed aggregate functions will be cached and +// returned. // // If the instrument configuration conflicts with an instrument that has // already been created (e.g. description, unit, data type) a warning will be -// logged at the "Info" level with the global OTel logger. A valid new -// Aggregator for the instrument configuration will still be returned without -// an error. +// logged at the "Info" level with the global OTel logger. Valid new aggregate +// functions for the instrument configuration will still be returned without an +// error. // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (aggregate.Aggregator[N], error) { +func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (meas aggregate.Measure[N], aggID uint64, err error) { switch stream.Aggregation.(type) { case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. @@ -314,7 +314,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum } if err := isAggregatorCompatible(kind, stream.Aggregation); err != nil { - return nil, fmt.Errorf( + return nil, 0, fmt.Errorf( "creating aggregator with instrumentKind: %d, aggregation %v: %w", kind, stream.Aggregation, err, ) @@ -325,26 +325,27 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // still be applied and a warning should be logged. i.logConflict(id) cv := i.aggregators.Lookup(id, func() aggVal[N] { - agg, err := i.aggregator(stream.Aggregation, kind, id.Temporality, id.Monotonic) - if err != nil { - return aggVal[N]{nil, err} + b := aggregate.Builder[N]{Temporality: id.Temporality} + if len(stream.AllowAttributeKeys) > 0 { + b.Filter = stream.attributeFilter() } - if agg == nil { // Drop aggregator. - return aggVal[N]{nil, nil} + in, out, err := i.aggregateFunc(b, stream.Aggregation, kind) + if err != nil { + return aggVal[N]{0, nil, err} } - if len(stream.AllowAttributeKeys) > 0 { - agg = aggregate.NewFilter(agg, stream.attributeFilter()) + if in == nil { // Drop aggregator. + return aggVal[N]{0, nil, nil} } - i.pipeline.addSync(scope, instrumentSync{ name: stream.Name, description: stream.Description, unit: stream.Unit, - aggregator: agg, + compAgg: out, }) - return aggVal[N]{agg, err} + id := atomic.AddUint64(&aggIDCount, 1) + return aggVal[N]{id, in, err} }) - return cv.Aggregator, cv.Err + return cv.Measure, cv.ID, cv.Err } // logConflict validates if an instrument with the same name as id has already @@ -386,52 +387,37 @@ func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { return id } -// aggregator returns a new Aggregator matching agg, kind, temporality, and +// aggregateFunc returns new aggregate functions matching agg, kind, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregator(agg aggregation.Aggregation, kind InstrumentKind, temporality metricdata.Temporality, monotonic bool) (aggregate.Aggregator[N], error) { +func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggregation, kind InstrumentKind) (meas aggregate.Measure[N], comp aggregate.ComputeAggregation, err error) { switch a := agg.(type) { case aggregation.Default: - return i.aggregator(DefaultAggregationSelector(kind), kind, temporality, monotonic) + return i.aggregateFunc(b, DefaultAggregationSelector(kind), kind) case aggregation.Drop: - return nil, nil + // Return nil in and out to signify the drop aggregator. case aggregation.LastValue: - return aggregate.NewLastValue[N](), nil + meas, comp = b.LastValue() case aggregation.Sum: switch kind { - case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: - // Observable counters and up-down-counters are defined to record - // the absolute value of the count: - // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/api.md#asynchronous-counter-creation - switch temporality { - case metricdata.CumulativeTemporality: - return aggregate.NewPrecomputedCumulativeSum[N](monotonic), nil - case metricdata.DeltaTemporality: - return aggregate.NewPrecomputedDeltaSum[N](monotonic), nil - default: - return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) - } - } - - switch temporality { - case metricdata.CumulativeTemporality: - return aggregate.NewCumulativeSum[N](monotonic), nil - case metricdata.DeltaTemporality: - return aggregate.NewDeltaSum[N](monotonic), nil + case InstrumentKindObservableCounter: + meas, comp = b.PrecomputedSum(true) + case InstrumentKindObservableUpDownCounter: + meas, comp = b.PrecomputedSum(false) + case InstrumentKindCounter, InstrumentKindHistogram: + meas, comp = b.Sum(true) default: - return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) + // InstrumentKindUpDownCounter, InstrumentKindObservableGauge, and + // instrumentKindUndefined or other invalid instrument kinds. + meas, comp = b.Sum(false) } case aggregation.ExplicitBucketHistogram: - switch temporality { - case metricdata.CumulativeTemporality: - return aggregate.NewCumulativeHistogram[N](a), nil - case metricdata.DeltaTemporality: - return aggregate.NewDeltaHistogram[N](a), nil - default: - return nil, fmt.Errorf("%w: %s(%d)", errUnknownTemporality, temporality.String(), temporality) - } + meas, comp = b.ExplicitBucketHistogram(a) + default: + err = errUnknownAggregation } - return nil, errUnknownAggregation + + return meas, comp, err } // isAggregatorCompatible checks if the aggregation can be used by the instrument. @@ -520,9 +506,9 @@ func (u unregisterFuncs) Unregister() error { return nil } -// resolver facilitates resolving Aggregators an instrument needs to aggregate -// measurements with while updating all pipelines that need to pull from those -// aggregations. +// resolver facilitates resolving aggregate functions an instrument calls to +// aggregate measurements with while updating all pipelines that need to pull +// from those aggregations. type resolver[N int64 | float64] struct { inserters []*inserter[N] } @@ -537,18 +523,18 @@ func newResolver[N int64 | float64](p pipelines, vc *cache[string, streamID]) re // Aggregators returns the Aggregators that must be updated by the instrument // defined by key. -func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Aggregator[N], error) { - var aggs []aggregate.Aggregator[N] +func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Measure[N], error) { + var measures []aggregate.Measure[N] errs := &multierror{} for _, i := range r.inserters { - a, err := i.Instrument(id) + in, err := i.Instrument(id) if err != nil { errs.append(err) } - aggs = append(aggs, a...) + measures = append(measures, in...) } - return aggs, errs.errorOrNil() + return measures, errs.errorOrNil() } type multierror struct { diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 69675b5d304..3e1c86dc654 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -15,6 +15,7 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( + "context" "sync/atomic" "testing" @@ -27,6 +28,8 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/resource" ) @@ -43,19 +46,112 @@ func (invalidAggregation) Err() error { return nil } +func requireN[N int64 | float64](t *testing.T, n int, m []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + assert.NoError(t, err) + require.Len(t, m, n) + require.Len(t, comps, n) +} + +func assertSum[N int64 | float64](n int, temp metricdata.Temporality, mono bool, v [2]N) func(*testing.T, []aggregate.Measure[N], []aggregate.ComputeAggregation, error) { + return func(t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + requireN[N](t, n, meas, comps, err) + + for m := 0; m < n; m++ { + t.Logf("input/output number: %d", m) + in, out := meas[m], comps[m] + in(context.Background(), 1, *attribute.EmptySet()) + + var got metricdata.Aggregation + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Sum[N]{ + Temporality: temp, + IsMonotonic: mono, + DataPoints: []metricdata.DataPoint[N]{{Value: v[0]}}, + }, got, metricdatatest.IgnoreTimestamp()) + + in(context.Background(), 3, *attribute.EmptySet()) + + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Sum[N]{ + Temporality: temp, + IsMonotonic: mono, + DataPoints: []metricdata.DataPoint[N]{{Value: v[1]}}, + }, got, metricdatatest.IgnoreTimestamp()) + } + } +} + +func assertHist[N int64 | float64](temp metricdata.Temporality) func(*testing.T, []aggregate.Measure[N], []aggregate.ComputeAggregation, error) { + return func(t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + requireN[N](t, 1, meas, comps, err) + + in, out := meas[0], comps[0] + in(context.Background(), 1, *attribute.EmptySet()) + + var got metricdata.Aggregation + assert.Equal(t, 1, out(&got), "1 data-point expected") + buckets := []uint64{0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} + n := 1 + metricdatatest.AssertAggregationsEqual(t, metricdata.Histogram[N]{ + Temporality: temp, + DataPoints: []metricdata.HistogramDataPoint[N]{{ + Count: uint64(n), + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: buckets, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](1), + Sum: N(n), + }}, + }, got, metricdatatest.IgnoreTimestamp()) + + in(context.Background(), 1, *attribute.EmptySet()) + + if temp == metricdata.CumulativeTemporality { + buckets[1] = 2 + n = 2 + } + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Histogram[N]{ + Temporality: temp, + DataPoints: []metricdata.HistogramDataPoint[N]{{ + Count: uint64(n), + Bounds: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, + BucketCounts: buckets, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](1), + Sum: N(n), + }}, + }, got, metricdatatest.IgnoreTimestamp()) + } +} + +func assertLastValue[N int64 | float64](t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + requireN[N](t, 1, meas, comps, err) + + in, out := meas[0], comps[0] + in(context.Background(), 10, *attribute.EmptySet()) + in(context.Background(), 1, *attribute.EmptySet()) + + var got metricdata.Aggregation + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Gauge[N]{ + DataPoints: []metricdata.DataPoint[N]{{Value: 1}}, + }, got, metricdatatest.IgnoreTimestamp()) +} + func testCreateAggregators[N int64 | float64](t *testing.T) { changeAggView := NewView( Instrument{Name: "foo"}, - Stream{Aggregation: aggregation.ExplicitBucketHistogram{}}, - ) - renameView := NewView( - Instrument{Name: "foo"}, - Stream{Name: "bar"}, - ) - defaultAggView := NewView( - Instrument{Name: "foo"}, - Stream{Aggregation: aggregation.Default{}}, + Stream{Aggregation: aggregation.ExplicitBucketHistogram{ + Boundaries: []float64{0, 100}, + NoMinMax: true, + }}, ) + renameView := NewView(Instrument{Name: "foo"}, Stream{Name: "bar"}) invalidAggView := NewView( Instrument{Name: "foo"}, Stream{Aggregation: invalidAggregation{}}, @@ -76,194 +172,195 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { reader Reader views []View inst Instrument - wantKind aggregate.Aggregator[N] //Aggregators should match len and types - wantLen int - wantErr error + validate func(*testing.T, []aggregate.Measure[N], []aggregate.ComputeAggregation, error) }{ { - name: "drop should return 0 aggregators", + name: "Default/Drop", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindCounter], + validate: func(t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + assert.NoError(t, err) + assert.Len(t, meas, 0) + assert.Len(t, comps, 0) + }, }, { - name: "default agg should use reader", + name: "Default/Delta/Sum/NonMonotonic", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: aggregate.NewDeltaSum[N](false), - wantLen: 1, + validate: assertSum[N](1, metricdata.DeltaTemporality, false, [2]N{1, 3}), }, { - name: "default agg should use reader", + name: "Default/Delta/ExplicitBucketHistogram", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindHistogram], - wantKind: aggregate.NewDeltaHistogram[N](aggregation.ExplicitBucketHistogram{}), - wantLen: 1, + validate: assertHist[N](metricdata.DeltaTemporality), }, { - name: "default agg should use reader", + name: "Default/Delta/PrecomputedSum/Monotonic", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: aggregate.NewPrecomputedDeltaSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.DeltaTemporality, true, [2]N{1, 2}), }, { - name: "default agg should use reader", + name: "Default/Delta/PrecomputedSum/NonMonotonic", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: aggregate.NewPrecomputedDeltaSum[N](false), - wantLen: 1, + validate: assertSum[N](1, metricdata.DeltaTemporality, false, [2]N{1, 2}), }, { - name: "default agg should use reader", + name: "Default/Delta/Gauge", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: aggregate.NewLastValue[N](), - wantLen: 1, + validate: assertLastValue[N], }, { - name: "default agg should use reader", + name: "Default/Delta/Sum/Monotonic", reader: NewManualReader(WithTemporalitySelector(deltaTemporalitySelector)), - views: []View{defaultAggView}, inst: instruments[InstrumentKindCounter], - wantKind: aggregate.NewDeltaSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.DeltaTemporality, true, [2]N{1, 3}), }, { - name: "reader should set default agg", + name: "Default/Cumulative/Sum/NonMonotonic", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: aggregate.NewCumulativeSum[N](false), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 4}), }, { - name: "reader should set default agg", + name: "Default/Cumulative/ExplicitBucketHistogram", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), - wantLen: 1, + validate: assertHist[N](metricdata.CumulativeTemporality), }, { - name: "reader should set default agg", + name: "Default/Cumulative/PrecomputedSum/Monotonic", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 3}), }, { - name: "reader should set default agg", + name: "Default/Cumulative/PrecomputedSum/NonMonotonic", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: aggregate.NewPrecomputedCumulativeSum[N](false), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 3}), }, { - name: "reader should set default agg", + name: "Default/Cumulative/Gauge", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: aggregate.NewLastValue[N](), - wantLen: 1, + validate: assertLastValue[N], }, { - name: "reader should set default agg", + name: "Default/Cumulative/Sum/Monotonic", reader: NewManualReader(), - views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: aggregate.NewCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 4}), }, { - name: "view should overwrite reader", - reader: NewManualReader(), - views: []View{changeAggView}, - inst: instruments[InstrumentKindCounter], - wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), - wantLen: 1, - }, - { - name: "multiple views should create multiple aggregators", + name: "ViewHasPrecedence", + reader: NewManualReader(), + views: []View{changeAggView}, + inst: instruments[InstrumentKindCounter], + validate: func(t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { + t.Helper() + requireN[N](t, 1, meas, comps, err) + + in, out := meas[0], comps[0] + in(context.Background(), 1, *attribute.EmptySet()) + + var got metricdata.Aggregation + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{{ + Count: 1, + Bounds: []float64{0, 100}, + BucketCounts: []uint64{0, 1, 0}, + Sum: 1, + }}, + }, got, metricdatatest.IgnoreTimestamp()) + + in(context.Background(), 1, *attribute.EmptySet()) + + assert.Equal(t, 1, out(&got), "1 data-point expected") + metricdatatest.AssertAggregationsEqual(t, metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{{ + Count: 2, + Bounds: []float64{0, 100}, + BucketCounts: []uint64{0, 2, 0}, + Sum: 2, + }}, + }, got, metricdatatest.IgnoreTimestamp()) + }, + }, + { + name: "MultipleViews", reader: NewManualReader(), views: []View{defaultView, renameView}, inst: instruments[InstrumentKindCounter], - wantKind: aggregate.NewCumulativeSum[N](true), - wantLen: 2, + validate: assertSum[N](2, metricdata.CumulativeTemporality, true, [2]N{1, 4}), }, { - name: "reader with default aggregation should figure out a Counter", + name: "Reader/Default/Cumulative/Sum/Monotonic", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindCounter], - wantKind: aggregate.NewCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 4}), }, { - name: "reader with default aggregation should figure out an UpDownCounter", + name: "Reader/Default/Cumulative/Sum/NonMonotonic", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindUpDownCounter], - wantKind: aggregate.NewCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 4}), }, { - name: "reader with default aggregation should figure out an Histogram", + name: "Reader/Default/Cumulative/ExplicitBucketHistogram", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindHistogram], - wantKind: aggregate.NewCumulativeHistogram[N](aggregation.ExplicitBucketHistogram{}), - wantLen: 1, + validate: assertHist[N](metricdata.CumulativeTemporality), }, { - name: "reader with default aggregation should figure out an ObservableCounter", + name: "Reader/Default/Cumulative/PrecomputedSum/Monotonic", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableCounter], - wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 3}), }, { - name: "reader with default aggregation should figure out an ObservableUpDownCounter", + name: "Reader/Default/Cumulative/PrecomputedSum/NonMonotonic", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableUpDownCounter], - wantKind: aggregate.NewPrecomputedCumulativeSum[N](true), - wantLen: 1, + validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 3}), }, { - name: "reader with default aggregation should figure out an ObservableGauge", + name: "Reader/Default/Gauge", reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), - views: []View{defaultView}, inst: instruments[InstrumentKindObservableGauge], - wantKind: aggregate.NewLastValue[N](), - wantLen: 1, + validate: assertLastValue[N], }, { - name: "view with invalid aggregation should error", - reader: NewManualReader(), - views: []View{invalidAggView}, - inst: instruments[InstrumentKindCounter], - wantErr: errCreatingAggregators, + name: "InvalidAggregation", + reader: NewManualReader(), + views: []View{invalidAggView}, + inst: instruments[InstrumentKindCounter], + validate: func(t *testing.T, _ []aggregate.Measure[N], _ []aggregate.ComputeAggregation, err error) { + assert.ErrorIs(t, err, errCreatingAggregators) + }, }, } for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { var c cache[string, streamID] - i := newInserter[N](newPipeline(nil, tt.reader, tt.views), &c) - got, err := i.Instrument(tt.inst) - assert.ErrorIs(t, err, tt.wantErr) - require.Len(t, got, tt.wantLen) - for _, agg := range got { - assert.IsType(t, tt.wantKind, agg) + p := newPipeline(nil, tt.reader, tt.views) + i := newInserter[N](p, &c) + input, err := i.Instrument(tt.inst) + var comps []aggregate.ComputeAggregation + for _, instSyncs := range p.aggregations { + for _, i := range instSyncs { + comps = append(comps, i.compAgg) + } } + tt.validate(t, input, comps, err) }) } } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index f51ad292970..f9056275c47 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -30,13 +30,13 @@ import ( "go.opentelemetry.io/otel/sdk/resource" ) -type testSumAggregator struct{} - -func (testSumAggregator) Aggregation() metricdata.Aggregation { - return metricdata.Sum[int64]{ +func testSumAggregateOutput(dest *metricdata.Aggregation) int { + *dest = metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, - DataPoints: []metricdata.DataPoint[int64]{}} + DataPoints: []metricdata.DataPoint[int64]{{Value: 1}}, + } + return 1 } func TestNewPipeline(t *testing.T) { @@ -48,7 +48,7 @@ func TestNewPipeline(t *testing.T) { assert.Equal(t, resource.Empty(), output.Resource) assert.Len(t, output.ScopeMetrics, 0) - iSync := instrumentSync{"name", "desc", "1", testSumAggregator{}} + iSync := instrumentSync{"name", "desc", "1", testSumAggregateOutput} assert.NotPanics(t, func() { pipe.addSync(instrumentation.Scope{}, iSync) }) @@ -92,7 +92,7 @@ func TestPipelineConcurrency(t *testing.T) { go func(n int) { defer wg.Done() name := fmt.Sprintf("name %d", n) - sync := instrumentSync{name, "desc", "1", testSumAggregator{}} + sync := instrumentSync{name, "desc", "1", testSumAggregateOutput} pipe.addSync(instrumentation.Scope{}, sync) }(i) @@ -142,8 +142,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { got, err := i.Instrument(inst) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") - for _, a := range got { - a.Aggregate(1, *attribute.EmptySet()) + for _, in := range got { + in(context.Background(), 1, *attribute.EmptySet()) } out := metricdata.ResourceMetrics{} From 7467923a5117778f0155a8b452ba8e759dfcd7d0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Jul 2023 07:57:01 -0700 Subject: [PATCH 599/886] Add info/debug logging to the metric SDK (#4315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add debug logging to the metric SDK Resolves #3722 * Log MeterProvider and Meter setup at info level * Add changelog entry --------- Co-authored-by: Chester Cheung Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + .../otlpmetric/otlpmetricgrpc/exporter.go | 10 ++++++- .../otlpmetric/otlpmetrichttp/exporter.go | 10 ++++++- exporters/prometheus/exporter.go | 21 +++++++++++++++ exporters/stdout/stdoutmetric/exporter.go | 7 +++++ sdk/metric/manual_reader.go | 19 +++++++++++++ sdk/metric/periodic_reader.go | 27 +++++++++++++++++++ sdk/metric/provider.go | 17 +++++++++++- 8 files changed, 109 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c653ff02a7e..770c6250764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) - Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) +- Add info and debug logging to the metric SDK. (#4315) ### Changed diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go index 3b29613a7b4..1f28bfd6a59 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go @@ -18,6 +18,7 @@ import ( "context" ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -43,7 +44,9 @@ func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation // This method returns an error if called after Shutdown. // This method returns an error if the method is canceled by the passed context. func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { - return e.wrapped.Export(ctx, rm) + err := e.wrapped.Export(ctx, rm) + global.Debug("OTLP/gRPC exporter export", "Data", rm) + return err } // ForceFlush flushes any metric data held by an exporter. @@ -67,6 +70,11 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return e.wrapped.Shutdown(ctx) } +// MarshalLog returns logging data about the Exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct{ Type string }{Type: "OTLP/gRPC"} +} + // New returns an OpenTelemetry metric Exporter. The Exporter can be used with // a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving // endpoint using gRPC. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go index b84ffc34f18..47d3c469825 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go @@ -18,6 +18,7 @@ import ( "context" ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -43,7 +44,9 @@ func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation // This method returns an error if called after Shutdown. // This method returns an error if the method is canceled by the passed context. func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { - return e.wrapped.Export(ctx, rm) + err := e.wrapped.Export(ctx, rm) + global.Debug("OTLP/HTTP exporter export", "Data", rm) + return err } // ForceFlush flushes any metric data held by an exporter. @@ -67,6 +70,11 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return e.wrapped.Shutdown(ctx) } +// MarshalLog returns logging data about the Exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct{ Type string }{Type: "OTLP/HTTP"} +} + // New returns an OpenTelemetry metric Exporter. The Exporter can be used with // a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving // endpoint using protobufs over HTTP. diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 98949d8ca87..04f26e7cb4a 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -53,6 +53,25 @@ type Exporter struct { metric.Reader } +// MarshalLog returns logging data about the Exporter. +func (e *Exporter) MarshalLog() interface{} { + const t = "Prometheus exporter" + + if r, ok := e.Reader.(*metric.ManualReader); ok { + under := r.MarshalLog() + if data, ok := under.(struct { + Type string + Registered bool + Shutdown bool + }); ok { + data.Type = t + return data + } + } + + return struct{ Type string }{Type: t} +} + var _ metric.Reader = &Exporter{} // collector is used to implement prometheus.Collector. @@ -129,6 +148,8 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } } + global.Debug("Prometheus exporter export", "Data", metrics) + // Initialize (once) targetInfo and disableTargetInfo. func() { c.mu.Lock() diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index 06846203597..e3d867e00dc 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -73,6 +73,9 @@ func (e *exporter) Export(ctx context.Context, data *metricdata.ResourceMetrics) if e.redactTimestamps { redactTimestamps(data) } + + global.Debug("STDOUT exporter export", "Data", data) + return e.encVal.Load().(encoderHolder).Encode(data) } @@ -90,6 +93,10 @@ func (e *exporter) Shutdown(ctx context.Context) error { return ctx.Err() } +func (e *exporter) MarshalLog() interface{} { + return struct{ Type string }{Type: "STDOUT"} +} + func redactTimestamps(orig *metricdata.ResourceMetrics) { for i, sm := range orig.ScopeMetrics { metrics := sm.Metrics diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 3864e2f0694..5677003550b 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -157,9 +157,28 @@ func (mr *ManualReader) Collect(ctx context.Context, rm *metricdata.ResourceMetr } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } + + global.Debug("ManualReader collection", "Data", rm) + return unifyErrors(errs) } +// MarshalLog returns logging data about the ManualReader. +func (r *ManualReader) MarshalLog() interface{} { + r.mu.Lock() + down := r.isShutdown + r.mu.Unlock() + return struct { + Type string + Registered bool + Shutdown bool + }{ + Type: "ManualReader", + Registered: r.sdkProducer.Load() != nil, + Shutdown: down, + } +} + // manualReaderConfig contains configuration options for a ManualReader. type manualReaderConfig struct { temporalitySelector TemporalitySelector diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 17cb1be1104..3ea2c2f0fb2 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -115,6 +115,7 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) *Peri conf := newPeriodicReaderConfig(options) ctx, cancel := context.WithCancel(context.Background()) r := &PeriodicReader{ + interval: conf.interval, timeout: conf.timeout, exporter: exporter, flushCh: make(chan chan error), @@ -144,6 +145,7 @@ type PeriodicReader struct { isShutdown bool externalProducers atomic.Value + interval time.Duration timeout time.Duration exporter Exporter flushCh chan chan error @@ -280,6 +282,9 @@ func (r *PeriodicReader) collect(ctx context.Context, p interface{}, rm *metricd } rm.ScopeMetrics = append(rm.ScopeMetrics, externalMetrics...) } + + global.Debug("PeriodicReader collection", "Data", rm) + return unifyErrors(errs) } @@ -350,3 +355,25 @@ func (r *PeriodicReader) Shutdown(ctx context.Context) error { }) return err } + +// MarshalLog returns logging data about the PeriodicReader. +func (r *PeriodicReader) MarshalLog() interface{} { + r.mu.Lock() + down := r.isShutdown + r.mu.Unlock() + return struct { + Type string + Exporter Exporter + Registered bool + Shutdown bool + Interval time.Duration + Timeout time.Duration + }{ + Type: "PeriodicReader", + Exporter: r.exporter, + Registered: r.sdkProducer.Load() != nil, + Shutdown: down, + Interval: r.interval, + Timeout: r.timeout, + } +} diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 7063901607c..49dd071c9d3 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -51,11 +51,19 @@ var _ metric.MeterProvider = (*MeterProvider)(nil) func NewMeterProvider(options ...Option) *MeterProvider { conf := newConfig(options) flush, sdown := conf.readerSignals() - return &MeterProvider{ + + mp := &MeterProvider{ pipes: newPipelines(conf.res, conf.readers, conf.views), forceFlush: flush, shutdown: sdown, } + // Log after creation so all readers show correctly they are registered. + global.Info("MeterProvider created", + "Resource", conf.res, + "Readers", conf.readers, + "Views", len(conf.views), + ) + return mp } // Meter returns a Meter with the given name and configured with options. @@ -83,6 +91,13 @@ func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metri Version: c.InstrumentationVersion(), SchemaURL: c.SchemaURL(), } + + global.Info("Meter created", + "Name", s.Name, + "Version", s.Version, + "SchemaURL", s.SchemaURL, + ) + return mp.meters.Lookup(s, func() *meter { return newMeter(s, mp.pipes) }) From 63dfc4c2f152389d71d0ffff43af795bb1fb6bd3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 17 Jul 2023 11:17:35 -0700 Subject: [PATCH 600/886] Update the instrument agg comp table (#4330) Use a check mark to indicate compatible instead of an "X" which can be misinterpreted as incompatible. --- sdk/metric/pipeline.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index a6a6c8ca44c..05fe29ce4f9 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -425,12 +425,12 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // // | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | // |--------------------------|------|-----------|-----|-----------|-----------------------| -// | Counter | X | | X | X | X | -// | UpDownCounter | X | | X | | | -// | Histogram | X | | X | X | X | -// | Observable Counter | X | | X | | | -// | Observable UpDownCounter | X | | X | | | -// | Observable Gauge | X | X | | | |. +// | Counter | ✓ | | ✓ | ✓ | ✓ | +// | UpDownCounter | ✓ | | ✓ | | | +// | Histogram | ✓ | | ✓ | ✓ | ✓ | +// | Observable Counter | ✓ | | ✓ | | | +// | Observable UpDownCounter | ✓ | | ✓ | | | +// | Observable Gauge | ✓ | ✓ | | | |. func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { case aggregation.Default: From f6a658c6c2f2909e93f064b2962aa9d3114b3e27 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 18 Jul 2023 03:10:34 -0500 Subject: [PATCH 601/886] Remove out of date example of internal usage. (#4334) --- .../aggregate/aggregator_example_test.go | 111 ------------------ 1 file changed, 111 deletions(-) delete mode 100644 sdk/metric/internal/aggregate/aggregator_example_test.go diff --git a/sdk/metric/internal/aggregate/aggregator_example_test.go b/sdk/metric/internal/aggregate/aggregator_example_test.go deleted file mode 100644 index 7b566b957d9..00000000000 --- a/sdk/metric/internal/aggregate/aggregator_example_test.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate - -import ( - "context" - "fmt" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/embedded" - "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -type meter struct { - // When a reader initiates a collection, the meter would collect - // aggregations from each of these functions. - aggregations []metricdata.Aggregation -} - -func (p *meter) Int64Counter(string, ...metric.Int64CounterOption) (metric.Int64Counter, error) { - // This is an example of how a meter would create an aggregator for a new - // counter. At this point the provider would determine the aggregation and - // temporality to used based on the Reader and View configuration. Assume - // here these are determined to be a cumulative sum. - - aggregator := newCumulativeSum[int64](true) - count := inst{aggregateFunc: aggregator.Aggregate} - - p.aggregations = append(p.aggregations, aggregator.Aggregation()) - - fmt.Printf("using %T aggregator for counter\n", aggregator) - - return count, nil -} - -func (p *meter) Int64UpDownCounter(string, ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { - // This is an example of how a meter would create an aggregator for a new - // up-down counter. At this point the provider would determine the - // aggregation and temporality to used based on the Reader and View - // configuration. Assume here these are determined to be a last-value - // aggregation (the temporality does not affect the produced aggregations). - - aggregator := newLastValue[int64]() - upDownCount := inst{aggregateFunc: aggregator.Aggregate} - - p.aggregations = append(p.aggregations, aggregator.Aggregation()) - - fmt.Printf("using %T aggregator for up-down counter\n", aggregator) - - return upDownCount, nil -} - -func (p *meter) Int64Histogram(string, ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { - // This is an example of how a meter would create an aggregator for a new - // histogram. At this point the provider would determine the aggregation - // and temporality to used based on the Reader and View configuration. - // Assume here these are determined to be a delta explicit-bucket - // histogram. - - aggregator := newDeltaHistogram[int64](aggregation.ExplicitBucketHistogram{ - Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, - NoMinMax: false, - }) - hist := inst{aggregateFunc: aggregator.Aggregate} - - p.aggregations = append(p.aggregations, aggregator.Aggregation()) - - fmt.Printf("using %T aggregator for histogram\n", aggregator) - - return hist, nil -} - -// inst is a generalized int64 synchronous counter, up-down counter, and -// histogram used for demonstration purposes only. -type inst struct { - aggregateFunc func(int64, attribute.Set) - - embedded.Int64Counter - embedded.Int64UpDownCounter - embedded.Int64Histogram -} - -func (inst) Add(context.Context, int64, ...metric.AddOption) {} -func (inst) Record(context.Context, int64, ...metric.RecordOption) {} - -func Example() { - m := meter{} - - _, _ = m.Int64Counter("counter example") - _, _ = m.Int64UpDownCounter("up-down counter example") - _, _ = m.Int64Histogram("histogram example") - - // Output: - // using *aggregate.cumulativeSum[int64] aggregator for counter - // using *aggregate.lastValue[int64] aggregator for up-down counter - // using *aggregate.deltaHistogram[int64] aggregator for histogram -} From 9b0c4d2caf7a5fb88714e4c64fe61d5fbf1c0b8a Mon Sep 17 00:00:00 2001 From: Matthew Wear Date: Tue, 18 Jul 2023 08:37:20 -0700 Subject: [PATCH 602/886] Fix empty host.id (#4317) --- CHANGELOG.md | 1 + sdk/resource/host_id_readfile.go | 2 +- sdk/resource/host_id_readfile_test.go | 53 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 sdk/resource/host_id_readfile_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 770c6250764..15731d8c22b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) - Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) +- Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/resource/host_id_readfile.go b/sdk/resource/host_id_readfile.go index f92c6dad0f9..721e3ca6e7d 100644 --- a/sdk/resource/host_id_readfile.go +++ b/sdk/resource/host_id_readfile.go @@ -21,7 +21,7 @@ import "os" func readFile(filename string) (string, error) { b, err := os.ReadFile(filename) if err != nil { - return "", nil + return "", err } return string(b), nil diff --git a/sdk/resource/host_id_readfile_test.go b/sdk/resource/host_id_readfile_test.go new file mode 100644 index 00000000000..f071a05cc0c --- /dev/null +++ b/sdk/resource/host_id_readfile_test.go @@ -0,0 +1,53 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris + +package resource + +import ( + "os" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestReadFileExistent(t *testing.T) { + fileContents := "foo" + + f, err := os.CreateTemp("", "readfile_") + require.NoError(t, err) + + defer os.Remove(f.Name()) + + _, err = f.WriteString(fileContents) + require.NoError(t, err) + require.NoError(t, f.Close()) + + result, err := readFile(f.Name()) + require.NoError(t, err) + require.Equal(t, result, fileContents) +} + +func TestReadFileNonExistent(t *testing.T) { + // create unique filename + f, err := os.CreateTemp("", "readfile_") + require.NoError(t, err) + + // make file non-existent + require.NoError(t, os.Remove(f.Name())) + + _, err = readFile(f.Name()) + require.ErrorIs(t, err, os.ErrNotExist) +} From f194fb0c6c0596cb95325bb66070c2fdec0357fa Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Jul 2023 07:12:00 -0700 Subject: [PATCH 603/886] Allow histogram for all instruments (#4332) * Allow histogram for all instruments Any instrument that can record negative values, do not include a sum in the produced aggregation (like the specification recommends). Resolves #4161 * Add changes to changelog * Fix TestBucketsSum --- CHANGELOG.md | 1 + sdk/metric/internal/aggregate/aggregate.go | 6 +- sdk/metric/internal/aggregate/histogram.go | 28 +++-- .../internal/aggregate/histogram_test.go | 110 ++++++++++++++---- sdk/metric/pipeline.go | 31 +++-- sdk/metric/pipeline_registry_test.go | 6 +- 6 files changed, 135 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15731d8c22b..64d34115a39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The `AttributeKeys` fields allows users to specify an allow-list of attributes allowed to be recorded for a view. This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) - If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) +- Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) ### Fixed diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index f386c337135..2c501f45f13 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -109,13 +109,13 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. -func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistogram) (Measure[N], ComputeAggregation) { +func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistogram, noSum bool) (Measure[N], ComputeAggregation) { var h aggregator[N] switch b.Temporality { case metricdata.DeltaTemporality: - h = newDeltaHistogram[N](cfg) + h = newDeltaHistogram[N](cfg, noSum) default: - h = newCumulativeHistogram[N](cfg) + h = newCumulativeHistogram[N](cfg, noSum) } return b.input(h), func(dest *metricdata.Aggregation) int { // TODO (#4220): optimize memory reuse here. diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index a7a7780c307..0683ff2eb23 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -27,7 +27,7 @@ import ( type buckets[N int64 | float64] struct { counts []uint64 count uint64 - sum N + total N min, max N } @@ -36,10 +36,11 @@ func newBuckets[N int64 | float64](n int) *buckets[N] { return &buckets[N]{counts: make([]uint64, n)} } +func (b *buckets[N]) sum(value N) { b.total += value } + func (b *buckets[N]) bin(idx int, value N) { b.counts[idx]++ b.count++ - b.sum += value if value < b.min { b.min = value } else if value > b.max { @@ -50,13 +51,14 @@ func (b *buckets[N]) bin(idx int, value N) { // histValues summarizes a set of measurements as an histValues with // explicitly defined buckets. type histValues[N int64 | float64] struct { + noSum bool bounds []float64 values map[attribute.Set]*buckets[N] valuesMu sync.Mutex } -func newHistValues[N int64 | float64](bounds []float64) *histValues[N] { +func newHistValues[N int64 | float64](bounds []float64, noSum bool) *histValues[N] { // The responsibility of keeping all buckets correctly associated with the // passed boundaries is ultimately this type's responsibility. Make a copy // here so we can always guarantee this. Or, in the case of failure, have @@ -65,6 +67,7 @@ func newHistValues[N int64 | float64](bounds []float64) *histValues[N] { copy(b, bounds) sort.Float64s(b) return &histValues[N]{ + noSum: noSum, bounds: b, values: make(map[attribute.Set]*buckets[N]), } @@ -98,6 +101,9 @@ func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { s.values[attr] = b } b.bin(idx, value) + if !s.noSum { + b.sum(value) + } } // newDeltaHistogram returns an Aggregator that summarizes a set of @@ -107,9 +113,9 @@ func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { // Each aggregation cycle is treated independently. When the returned // Aggregator's Aggregations method is called it will reset all histogram // counts to zero. -func newDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) aggregator[N] { +func newDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) aggregator[N] { return &deltaHistogram[N]{ - histValues: newHistValues[N](cfg.Boundaries), + histValues: newHistValues[N](cfg.Boundaries, noSum), noMinMax: cfg.NoMinMax, start: now(), } @@ -148,7 +154,9 @@ func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { Count: b.count, Bounds: bounds, BucketCounts: b.counts, - Sum: b.sum, + } + if !s.noSum { + hdp.Sum = b.total } if !s.noMinMax { hdp.Min = metricdata.NewExtrema(b.min) @@ -170,9 +178,9 @@ func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { // Each aggregation cycle builds from the previous, the histogram counts are // the bucketed counts of all values aggregated since the returned Aggregator // was created. -func newCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram) aggregator[N] { +func newCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) aggregator[N] { return &cumulativeHistogram[N]{ - histValues: newHistValues[N](cfg.Boundaries), + histValues: newHistValues[N](cfg.Boundaries, noSum), noMinMax: cfg.NoMinMax, start: now(), } @@ -219,7 +227,9 @@ func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { Count: b.count, Bounds: bounds, BucketCounts: counts, - Sum: b.sum, + } + if !s.noSum { + hdp.Sum = b.total } if !s.noMinMax { hdp.Min = metricdata.NewExtrema(b.min) diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index 3656be9e988..8c75562198d 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -49,10 +49,25 @@ func testHistogram[N int64 | float64](t *testing.T) { } incr := monoIncr[N]() - eFunc := deltaHistExpecter[N](incr) - t.Run("Delta", tester.Run(newDeltaHistogram[N](histConf), incr, eFunc)) + eFunc := deltaHistSummedExpecter[N](incr) + t.Run("Delta/Summed", tester.Run(newDeltaHistogram[N](histConf, false), incr, eFunc)) + eFunc = deltaHistExpecter[N](incr) + t.Run("Delta/NoSum", tester.Run(newDeltaHistogram[N](histConf, true), incr, eFunc)) + eFunc = cumuHistSummedExpecter[N](incr) + t.Run("Cumulative/Summed", tester.Run(newCumulativeHistogram[N](histConf, false), incr, eFunc)) eFunc = cumuHistExpecter[N](incr) - t.Run("Cumulative", tester.Run(newCumulativeHistogram[N](histConf), incr, eFunc)) + t.Run("Cumulative/NoSum", tester.Run(newCumulativeHistogram[N](histConf, true), incr, eFunc)) +} + +func deltaHistSummedExpecter[N int64 | float64](incr setMap[N]) expectFunc { + h := metricdata.Histogram[N]{Temporality: metricdata.DeltaTemporality} + return func(m int) metricdata.Aggregation { + h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) + for a, v := range incr { + h.DataPoints = append(h.DataPoints, hPointSummed[N](a, v, uint64(m))) + } + return h + } } func deltaHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { @@ -66,6 +81,19 @@ func deltaHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { } } +func cumuHistSummedExpecter[N int64 | float64](incr setMap[N]) expectFunc { + var cycle int + h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} + return func(m int) metricdata.Aggregation { + cycle++ + h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) + for a, v := range incr { + h.DataPoints = append(h.DataPoints, hPointSummed[N](a, v, uint64(cycle*m))) + } + return h + } +} + func cumuHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { var cycle int h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} @@ -79,6 +107,25 @@ func cumuHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { } } +// hPointSummed returns an HistogramDataPoint that started and ended now with +// multi number of measurements values v. It includes a min and max (set to v). +func hPointSummed[N int64 | float64](a attribute.Set, v N, multi uint64) metricdata.HistogramDataPoint[N] { + idx := sort.SearchFloat64s(bounds, float64(v)) + counts := make([]uint64, len(bounds)+1) + counts[idx] += multi + return metricdata.HistogramDataPoint[N]{ + Attributes: a, + StartTime: now(), + Time: now(), + Count: multi, + Bounds: bounds, + BucketCounts: counts, + Min: metricdata.NewExtrema(v), + Max: metricdata.NewExtrema(v), + Sum: v * N(multi), + } +} + // hPoint returns an HistogramDataPoint that started and ended now with multi // number of measurements values v. It includes a min and max (set to v). func hPoint[N int64 | float64](a attribute.Set, v N, multi uint64) metricdata.HistogramDataPoint[N] { @@ -94,7 +141,6 @@ func hPoint[N int64 | float64](a attribute.Set, v N, multi uint64) metricdata.Hi BucketCounts: counts, Min: metricdata.NewExtrema(v), Max: metricdata.NewExtrema(v), - Sum: v * N(multi), } } @@ -106,28 +152,50 @@ func TestBucketsBin(t *testing.T) { func testBucketsBin[N int64 | float64]() func(t *testing.T) { return func(t *testing.T) { b := newBuckets[N](3) - assertB := func(counts []uint64, count uint64, sum, min, max N) { + assertB := func(counts []uint64, count uint64, min, max N) { + t.Helper() assert.Equal(t, counts, b.counts) assert.Equal(t, count, b.count) - assert.Equal(t, sum, b.sum) assert.Equal(t, min, b.min) assert.Equal(t, max, b.max) } - assertB([]uint64{0, 0, 0}, 0, 0, 0, 0) + assertB([]uint64{0, 0, 0}, 0, 0, 0) b.bin(1, 2) - assertB([]uint64{0, 1, 0}, 1, 2, 0, 2) + assertB([]uint64{0, 1, 0}, 1, 0, 2) b.bin(0, -1) - assertB([]uint64{1, 1, 0}, 2, 1, -1, 2) + assertB([]uint64{1, 1, 0}, 2, -1, 2) + } +} + +func TestBucketsSum(t *testing.T) { + t.Run("Int64", testBucketsSum[int64]()) + t.Run("Float64", testBucketsSum[float64]()) +} + +func testBucketsSum[N int64 | float64]() func(t *testing.T) { + return func(t *testing.T) { + b := newBuckets[N](3) + + var want N + assert.Equal(t, want, b.total) + + b.sum(2) + want = 2 + assert.Equal(t, want, b.total) + + b.sum(-1) + want = 1 + assert.Equal(t, want, b.total) } } -func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram) aggregator[N], getBounds func(aggregator[N]) []float64) func(t *testing.T) { +func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram, bool) aggregator[N], getBounds func(aggregator[N]) []float64) func(t *testing.T) { b := []float64{0, 1, 2} cpB := make([]float64, len(b)) copy(cpB, b) - a := newA(aggregation.ExplicitBucketHistogram{Boundaries: b}) + a := newA(aggregation.ExplicitBucketHistogram{Boundaries: b}, false) return func(t *testing.T) { require.Equal(t, cpB, getBounds(a)) @@ -160,7 +228,7 @@ func TestHistogramImmutableBounds(t *testing.T) { } func TestCumulativeHistogramImutableCounts(t *testing.T) { - a := newCumulativeHistogram[int64](histConf) + a := newCumulativeHistogram[int64](histConf, false) a.Aggregate(5, alice) hdp := a.Aggregation().(metricdata.Histogram[int64]).DataPoints[0] @@ -176,12 +244,12 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - a := newDeltaHistogram[int64](histConf) + a := newDeltaHistogram[int64](histConf, false) assert.Nil(t, a.Aggregation()) a.Aggregate(1, alice) expect := metricdata.Histogram[int64]{Temporality: metricdata.DeltaTemporality} - expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPoint[int64](alice, 1, 1)} + expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](alice, 1, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) // The attr set should be forgotten once Aggregations is called. @@ -190,15 +258,15 @@ func TestDeltaHistogramReset(t *testing.T) { // Aggregating another set should not affect the original (alice). a.Aggregate(1, bob) - expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPoint[int64](bob, 1, 1)} + expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](bob, 1, 1)} metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) } func TestEmptyHistogramNilAggregation(t *testing.T) { - assert.Nil(t, newCumulativeHistogram[int64](histConf).Aggregation()) - assert.Nil(t, newCumulativeHistogram[float64](histConf).Aggregation()) - assert.Nil(t, newDeltaHistogram[int64](histConf).Aggregation()) - assert.Nil(t, newDeltaHistogram[float64](histConf).Aggregation()) + assert.Nil(t, newCumulativeHistogram[int64](histConf, false).Aggregation()) + assert.Nil(t, newCumulativeHistogram[float64](histConf, false).Aggregation()) + assert.Nil(t, newDeltaHistogram[int64](histConf, false).Aggregation()) + assert.Nil(t, newDeltaHistogram[float64](histConf, false).Aggregation()) } func BenchmarkHistogram(b *testing.B) { @@ -207,8 +275,8 @@ func BenchmarkHistogram(b *testing.B) { } func benchmarkHistogram[N int64 | float64](b *testing.B) { - factory := func() aggregator[N] { return newDeltaHistogram[N](histConf) } + factory := func() aggregator[N] { return newDeltaHistogram[N](histConf, false) } b.Run("Delta", benchmarkAggregator(factory)) - factory = func() aggregator[N] { return newCumulativeHistogram[N](histConf) } + factory = func() aggregator[N] { return newCumulativeHistogram[N](histConf, false) } b.Run("Cumulative", benchmarkAggregator(factory)) } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 05fe29ce4f9..5989e0c9575 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -412,7 +412,15 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr meas, comp = b.Sum(false) } case aggregation.ExplicitBucketHistogram: - meas, comp = b.ExplicitBucketHistogram(a) + var noSum bool + switch kind { + case InstrumentKindUpDownCounter, InstrumentKindObservableUpDownCounter, InstrumentKindObservableGauge: + // The sum should not be collected for any instrument that can make + // negative measurements: + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/sdk.md#histogram-aggregations + noSum = true + } + meas, comp = b.ExplicitBucketHistogram(a, noSum) default: err = errUnknownAggregation } @@ -426,22 +434,27 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | // |--------------------------|------|-----------|-----|-----------|-----------------------| // | Counter | ✓ | | ✓ | ✓ | ✓ | -// | UpDownCounter | ✓ | | ✓ | | | +// | UpDownCounter | ✓ | | ✓ | ✓ | | // | Histogram | ✓ | | ✓ | ✓ | ✓ | -// | Observable Counter | ✓ | | ✓ | | | -// | Observable UpDownCounter | ✓ | | ✓ | | | -// | Observable Gauge | ✓ | ✓ | | | |. +// | Observable Counter | ✓ | | ✓ | ✓ | | +// | Observable UpDownCounter | ✓ | | ✓ | ✓ | | +// | Observable Gauge | ✓ | ✓ | | ✓ | |. func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { case aggregation.Default: return nil case aggregation.ExplicitBucketHistogram: - if kind == InstrumentKindCounter || kind == InstrumentKindHistogram { + switch kind { + case InstrumentKindCounter, + InstrumentKindUpDownCounter, + InstrumentKindHistogram, + InstrumentKindObservableCounter, + InstrumentKindObservableUpDownCounter, + InstrumentKindObservableGauge: return nil + default: + return errIncompatibleAggregation } - // TODO: review need for aggregation check after - // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 - return errIncompatibleAggregation case aggregation.Sum: switch kind { case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter, InstrumentKindCounter, InstrumentKindHistogram, InstrumentKindUpDownCounter: diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 3e1c86dc654..c10bbc36803 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -498,7 +498,7 @@ func TestPipelineRegistryResource(t *testing.T) { } func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { - testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Sum{} })) readers := []Reader{testRdrHistogram} views := []View{defaultView} @@ -643,7 +643,6 @@ func TestIsAggregatorCompatible(t *testing.T) { name: "SyncUpDownCounter and ExplicitBucketHistogram", kind: InstrumentKindUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, - want: errIncompatibleAggregation, }, { name: "SyncHistogram and Drop", @@ -686,7 +685,6 @@ func TestIsAggregatorCompatible(t *testing.T) { name: "ObservableCounter and ExplicitBucketHistogram", kind: InstrumentKindObservableCounter, agg: aggregation.ExplicitBucketHistogram{}, - want: errIncompatibleAggregation, }, { name: "ObservableUpDownCounter and Drop", @@ -708,7 +706,6 @@ func TestIsAggregatorCompatible(t *testing.T) { name: "ObservableUpDownCounter and ExplicitBucketHistogram", kind: InstrumentKindObservableUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, - want: errIncompatibleAggregation, }, { name: "ObservableGauge and Drop", @@ -730,7 +727,6 @@ func TestIsAggregatorCompatible(t *testing.T) { name: "ObservableGauge and ExplicitBucketHistogram", kind: InstrumentKindObservableGauge, agg: aggregation.ExplicitBucketHistogram{}, - want: errIncompatibleAggregation, }, { name: "unknown kind with Sum should error", From f2a9f2f2beaefa7c5e0b22026a2b0ea77e4da7af Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Jul 2023 07:31:11 -0700 Subject: [PATCH 604/886] Restrict Meters to only register and collect instruments it created (#4333) * Add acceptance test * Update Meter Register and collect only inst from itself * Add change to changelog * Fix spelling error * Update changelog entry wording * Simplify the partial success code path --- CHANGELOG.md | 1 + sdk/metric/instrument.go | 20 ++++--- sdk/metric/meter.go | 106 ++++++++++++++++-------------------- sdk/metric/provider_test.go | 51 +++++++++++++++++ 4 files changed, 109 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d34115a39..75d463e4eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) - If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) +- Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) ### Fixed diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index b4d6fa8b35c..83652c6e97f 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -277,9 +277,9 @@ var _ metric.Float64ObservableCounter = float64Observable{} var _ metric.Float64ObservableUpDownCounter = float64Observable{} var _ metric.Float64ObservableGauge = float64Observable{} -func newFloat64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable { +func newFloat64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable { return float64Observable{ - observable: newObservable(scope, kind, name, desc, u, meas), + observable: newObservable(m, kind, name, desc, u, meas), } } @@ -296,9 +296,9 @@ var _ metric.Int64ObservableCounter = int64Observable{} var _ metric.Int64ObservableUpDownCounter = int64Observable{} var _ metric.Int64ObservableGauge = int64Observable{} -func newInt64Observable(scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable { +func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable { return int64Observable{ - observable: newObservable(scope, kind, name, desc, u, meas), + observable: newObservable(m, kind, name, desc, u, meas), } } @@ -306,18 +306,20 @@ type observable[N int64 | float64] struct { metric.Observable observablID[N] + meter *meter measures []aggregate.Measure[N] } -func newObservable[N int64 | float64](scope instrumentation.Scope, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[N]) *observable[N] { +func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[N]) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, description: desc, kind: kind, unit: u, - scope: scope, + scope: m.scope, }, + meter: m, measures: meas, } } @@ -335,16 +337,16 @@ var errEmptyAgg = errors.New("no aggregators for observable instrument") // and nil if it should. An errEmptyAgg error is returned if o is effectively a // no-op because it does not have any aggregators. Also, an error is returned // if scope defines a Meter other than the one o was created by. -func (o *observable[N]) registerable(scope instrumentation.Scope) error { +func (o *observable[N]) registerable(m *meter) error { if len(o.measures) == 0 { return errEmptyAgg } - if scope != o.scope { + if m != o.meter { return fmt.Errorf( "invalid registration: observable %q from Meter %q, registered with Meter %q", o.name, o.scope.Name, - scope.Name, + m.scope.Name, ) } return nil diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 7e1d32be249..f76d5190413 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -42,8 +42,8 @@ type meter struct { scope instrumentation.Scope pipes pipelines - int64IP *int64InstProvider - float64IP *float64InstProvider + int64Resolver resolver[int64] + float64Resolver resolver[float64] } func newMeter(s instrumentation.Scope, p pipelines) *meter { @@ -52,10 +52,10 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { var viewCache cache[string, streamID] return &meter{ - scope: s, - pipes: p, - int64IP: newInt64InstProvider(s, p, &viewCache), - float64IP: newFloat64InstProvider(s, p, &viewCache), + scope: s, + pipes: p, + int64Resolver: newResolver[int64](p, &viewCache), + float64Resolver: newResolver[float64](p, &viewCache), } } @@ -68,7 +68,8 @@ var _ metric.Meter = (*meter)(nil) func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) { cfg := metric.NewInt64CounterConfig(options...) const kind = InstrumentKindCounter - i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := int64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -82,7 +83,8 @@ func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) { cfg := metric.NewInt64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter - i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := int64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -96,7 +98,8 @@ func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCou func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { cfg := metric.NewInt64HistogramConfig(options...) const kind = InstrumentKindHistogram - i, err := m.int64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := int64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -111,7 +114,7 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { cfg := metric.NewInt64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter - p := int64ObservProvider{m.int64IP} + p := int64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -127,7 +130,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64Obser func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { cfg := metric.NewInt64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter - p := int64ObservProvider{m.int64IP} + p := int64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -143,7 +146,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int6 func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { cfg := metric.NewInt64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge - p := int64ObservProvider{m.int64IP} + p := int64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -158,7 +161,8 @@ func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64Observa func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) { cfg := metric.NewFloat64CounterConfig(options...) const kind = InstrumentKindCounter - i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := float64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -172,7 +176,8 @@ func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOpti func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) { cfg := metric.NewFloat64UpDownCounterConfig(options...) const kind = InstrumentKindUpDownCounter - i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := float64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -186,7 +191,8 @@ func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDow func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { cfg := metric.NewFloat64HistogramConfig(options...) const kind = InstrumentKindHistogram - i, err := m.float64IP.lookup(kind, name, cfg.Description(), cfg.Unit()) + p := float64InstProvider{m} + i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return i, err } @@ -201,7 +207,7 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { cfg := metric.NewFloat64ObservableCounterConfig(options...) const kind = InstrumentKindObservableCounter - p := float64ObservProvider{m.float64IP} + p := float64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -217,7 +223,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64O func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...) const kind = InstrumentKindObservableUpDownCounter - p := float64ObservProvider{m.float64IP} + p := float64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -233,7 +239,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Fl func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { cfg := metric.NewFloat64ObservableGaugeConfig(options...) const kind = InstrumentKindObservableGauge - p := float64ObservProvider{m.float64IP} + p := float64ObservProvider{m} inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) if err != nil { return nil, err @@ -301,7 +307,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) switch o := inst.(type) { case int64Observable: - if err := o.registerable(m.scope); err != nil { + if err := o.registerable(m); err != nil { if !errors.Is(err, errEmptyAgg) { errs.append(err) } @@ -309,7 +315,7 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) } reg.registerInt64(o.observablID) case float64Observable: - if err := o.registerable(m.scope); err != nil { + if err := o.registerable(m); err != nil { if !errors.Is(err, errEmptyAgg) { errs.append(err) } @@ -322,19 +328,15 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) } } - if err := errs.errorOrNil(); err != nil { - return nil, err - } - + err := errs.errorOrNil() if reg.len() == 0 { - // All insts use drop aggregation. - return noopRegister{}, nil + // All insts use drop aggregation or are invalid. + return noopRegister{}, err } - cback := func(ctx context.Context) error { - return f(ctx, reg) - } - return m.pipes.registerMultiCallback(cback), nil + // Some or all instruments were valid. + cback := func(ctx context.Context) error { return f(ctx, reg) } + return m.pipes.registerMultiCallback(cback), err } type observer struct { @@ -441,17 +443,9 @@ func (noopRegister) Unregister() error { } // int64InstProvider provides int64 OpenTelemetry instruments. -type int64InstProvider struct { - scope instrumentation.Scope - pipes pipelines - resolve resolver[int64] -} +type int64InstProvider struct{ *meter } -func newInt64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *int64InstProvider { - return &int64InstProvider{scope: s, pipes: p, resolve: newResolver[int64](p, c)} -} - -func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[int64], error) { +func (p int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[int64], error) { inst := Instrument{ Name: name, Description: desc, @@ -459,27 +453,19 @@ func (p *int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]a Kind: kind, Scope: p.scope, } - return p.resolve.Aggregators(inst) + return p.int64Resolver.Aggregators(inst) } // lookup returns the resolved instrumentImpl. -func (p *int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { +func (p int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) return &int64Inst{measures: aggs}, err } // float64InstProvider provides float64 OpenTelemetry instruments. -type float64InstProvider struct { - scope instrumentation.Scope - pipes pipelines - resolve resolver[float64] -} - -func newFloat64InstProvider(s instrumentation.Scope, p pipelines, c *cache[string, streamID]) *float64InstProvider { - return &float64InstProvider{scope: s, pipes: p, resolve: newResolver[float64](p, c)} -} +type float64InstProvider struct{ *meter } -func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[float64], error) { +func (p float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]aggregate.Measure[float64], error) { inst := Instrument{ Name: name, Description: desc, @@ -487,20 +473,20 @@ func (p *float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([ Kind: kind, Scope: p.scope, } - return p.resolve.Aggregators(inst) + return p.float64Resolver.Aggregators(inst) } // lookup returns the resolved instrumentImpl. -func (p *float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { +func (p float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) return &float64Inst{measures: aggs}, err } -type int64ObservProvider struct{ *int64InstProvider } +type int64ObservProvider struct{ *meter } func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) { - aggs, err := p.aggs(kind, name, desc, u) - return newInt64Observable(p.scope, kind, name, desc, u, aggs), err + aggs, err := (int64InstProvider)(p).aggs(kind, name, desc, u) + return newInt64Observable(p.meter, kind, name, desc, u, aggs), err } func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []metric.Int64Callback) { @@ -529,11 +515,11 @@ func (o int64Observer) Observe(val int64, opts ...metric.ObserveOption) { o.observe(val, c.Attributes()) } -type float64ObservProvider struct{ *float64InstProvider } +type float64ObservProvider struct{ *meter } func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (float64Observable, error) { - aggs, err := p.aggs(kind, name, desc, u) - return newFloat64Observable(p.scope, kind, name, desc, u, aggs), err + aggs, err := (float64InstProvider)(p).aggs(kind, name, desc, u) + return newFloat64Observable(p.meter, kind, name, desc, u, aggs), err } func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []metric.Float64Callback) { diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go index 5f02b130570..774e026ad87 100644 --- a/sdk/metric/provider_test.go +++ b/sdk/metric/provider_test.go @@ -21,11 +21,14 @@ import ( "testing" "github.com/go-logr/logr/funcr" + "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.opentelemetry.io/otel" + api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func TestMeterConcurrentSafe(t *testing.T) { @@ -120,3 +123,51 @@ func TestMeterProviderReturnsNoopMeterAfterShutdown(t *testing.T) { _, ok = m.(noop.Meter) assert.Truef(t, ok, "Meter from shutdown MeterProvider is not NoOp: %T", m) } + +func TestMeterProviderMixingOnRegisterErrors(t *testing.T) { + otel.SetLogger(testr.New(t)) + + rdr0 := NewManualReader() + mp0 := NewMeterProvider(WithReader(rdr0)) + + rdr1 := NewManualReader() + mp1 := NewMeterProvider(WithReader(rdr1)) + + // Meters with the same scope but different MeterProviders. + m0 := mp0.Meter("TestMeterProviderMixingOnRegisterErrors") + m1 := mp1.Meter("TestMeterProviderMixingOnRegisterErrors") + + m0Gauge, err := m0.Float64ObservableGauge("float64Gauge") + require.NoError(t, err) + + m1Gauge, err := m1.Int64ObservableGauge("int64Gauge") + require.NoError(t, err) + + _, err = m0.RegisterCallback( + func(_ context.Context, o api.Observer) error { + o.ObserveFloat64(m0Gauge, 2) + // Observe an instrument from a different MeterProvider. + o.ObserveInt64(m1Gauge, 1) + + return nil + }, + m0Gauge, m1Gauge, + ) + assert.Error( + t, + err, + "Instrument registered with Meter from different MeterProvider", + ) + + var data metricdata.ResourceMetrics + _ = rdr0.Collect(context.Background(), &data) + // Only the metrics from mp0 should be produced. + assert.Len(t, data.ScopeMetrics, 1) + + err = rdr1.Collect(context.Background(), &data) + assert.NoError(t, err, "Errored when collect should be a noop") + assert.Len( + t, data.ScopeMetrics, 0, + "Metrics produced for instrument collected by different MeterProvider", + ) +} From c197fe93057875323a2e4f07af6d5707de52f1fd Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 19 Jul 2023 11:52:11 -0400 Subject: [PATCH 605/886] Metric SDK: Sum duplicate async observations regardless of filtering (#4289) * Metric SDK: Remove the distinction between filtered and unfiltered attributes. --- CHANGELOG.md | 1 + sdk/metric/internal/aggregate/aggregator.go | 19 --- sdk/metric/internal/aggregate/filter.go | 43 ------- sdk/metric/internal/aggregate/filter_test.go | 89 -------------- sdk/metric/internal/aggregate/sum.go | 82 ++----------- sdk/metric/internal/aggregate/sum_test.go | 116 +++++-------------- sdk/metric/meter_test.go | 3 - 7 files changed, 45 insertions(+), 308 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75d463e4eb4..fd2e673fb42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The `AttributeKeys` fields allows users to specify an allow-list of attributes allowed to be recorded for a view. This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) - If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) +- If an attribute set is Observed multiple times in an async callback, the values will be summed instead of the last observation winning. (#4289) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) diff --git a/sdk/metric/internal/aggregate/aggregator.go b/sdk/metric/internal/aggregate/aggregator.go index 03d814d9b4a..fac0dfd901a 100644 --- a/sdk/metric/internal/aggregate/aggregator.go +++ b/sdk/metric/internal/aggregate/aggregator.go @@ -38,22 +38,3 @@ type aggregator[N int64 | float64] interface { // measurements made and ends an aggregation cycle. Aggregation() metricdata.Aggregation } - -// precomputeAggregator is an Aggregator that receives values to aggregate that -// have been pre-computed by the caller. -type precomputeAggregator[N int64 | float64] interface { - // The Aggregate method of the embedded Aggregator is used to record - // pre-computed measurements, scoped by attributes that have not been - // filtered by an attribute filter. - aggregator[N] - - // aggregateFiltered records measurements scoped by attributes that have - // been filtered by an attribute filter. - // - // Pre-computed measurements of filtered attributes need to be recorded - // separate from those that haven't been filtered so they can be added to - // the non-filtered pre-computed measurements in a collection cycle and - // then resets after the cycle (the non-filtered pre-computed measurements - // are not reset). - aggregateFiltered(N, attribute.Set) -} diff --git a/sdk/metric/internal/aggregate/filter.go b/sdk/metric/internal/aggregate/filter.go index 782c28a85df..ea471149e75 100644 --- a/sdk/metric/internal/aggregate/filter.go +++ b/sdk/metric/internal/aggregate/filter.go @@ -27,9 +27,6 @@ func newFilter[N int64 | float64](agg aggregator[N], fn attribute.Filter) aggreg if fn == nil { return agg } - if fa, ok := agg.(precomputeAggregator[N]); ok { - return newPrecomputedFilter(fa, fn) - } return &filter[N]{ filter: fn, aggregator: agg, @@ -59,43 +56,3 @@ func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { func (f *filter[N]) Aggregation() metricdata.Aggregation { return f.aggregator.Aggregation() } - -// precomputedFilter is an aggregator that applies attribute filter when -// Aggregating for pre-computed Aggregations. The pre-computed Aggregations -// need to operate normally when no attribute filtering is done (for sums this -// means setting the value), but when attribute filtering is done it needs to -// be added to any set value. -type precomputedFilter[N int64 | float64] struct { - filter attribute.Filter - aggregator precomputeAggregator[N] -} - -// newPrecomputedFilter returns a precomputedFilter Aggregator that wraps agg -// with the attribute filter fn. -// -// This should not be used to wrap a non-pre-computed Aggregator. Use a -// precomputedFilter instead. -func newPrecomputedFilter[N int64 | float64](agg precomputeAggregator[N], fn attribute.Filter) *precomputedFilter[N] { - return &precomputedFilter[N]{ - filter: fn, - aggregator: agg, - } -} - -// Aggregate records the measurement, scoped by attr, and aggregates it -// into an aggregation. -func (f *precomputedFilter[N]) Aggregate(measurement N, attr attribute.Set) { - fAttr, _ := attr.Filter(f.filter) - if fAttr.Equals(&attr) { - // No filtering done. - f.aggregator.Aggregate(measurement, fAttr) - } else { - f.aggregator.aggregateFiltered(measurement, fAttr) - } -} - -// Aggregation returns an Aggregation, for all the aggregated -// measurements made and ends an aggregation cycle. -func (f *precomputedFilter[N]) Aggregation() metricdata.Aggregation { - return f.aggregator.Aggregation() -} diff --git a/sdk/metric/internal/aggregate/filter_test.go b/sdk/metric/internal/aggregate/filter_test.go index e348e7582ea..b6544e3706b 100644 --- a/sdk/metric/internal/aggregate/filter_test.go +++ b/sdk/metric/internal/aggregate/filter_test.go @@ -15,8 +15,6 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( - "fmt" - "strings" "sync" "testing" @@ -196,90 +194,3 @@ func TestFilterConcurrent(t *testing.T) { testFilterConcurrent[float64](t) }) } - -func TestPrecomputedFilter(t *testing.T) { - t.Run("Int64", testPrecomputedFilter[int64]()) - t.Run("Float64", testPrecomputedFilter[float64]()) -} - -func testPrecomputedFilter[N int64 | float64]() func(t *testing.T) { - return func(t *testing.T) { - agg := newTestFilterAgg[N]() - f := newFilter[N](agg, testAttributeFilter) - require.IsType(t, &precomputedFilter[N]{}, f) - - var ( - powerLevel = attribute.Int("power-level", 9000) - user = attribute.String("user", "Alice") - admin = attribute.Bool("admin", true) - ) - a := attribute.NewSet(powerLevel) - key := a - f.Aggregate(1, a) - assert.Equal(t, N(1), agg.values[key].measured, str(a)) - assert.Equal(t, N(0), agg.values[key].filtered, str(a)) - - a = attribute.NewSet(powerLevel, user) - f.Aggregate(2, a) - assert.Equal(t, N(1), agg.values[key].measured, str(a)) - assert.Equal(t, N(2), agg.values[key].filtered, str(a)) - - a = attribute.NewSet(powerLevel, user, admin) - f.Aggregate(3, a) - assert.Equal(t, N(1), agg.values[key].measured, str(a)) - assert.Equal(t, N(5), agg.values[key].filtered, str(a)) - - a = attribute.NewSet(powerLevel) - f.Aggregate(2, a) - assert.Equal(t, N(2), agg.values[key].measured, str(a)) - assert.Equal(t, N(5), agg.values[key].filtered, str(a)) - - a = attribute.NewSet(user) - f.Aggregate(3, a) - assert.Equal(t, N(2), agg.values[key].measured, str(a)) - assert.Equal(t, N(5), agg.values[key].filtered, str(a)) - assert.Equal(t, N(3), agg.values[*attribute.EmptySet()].filtered, str(a)) - - _ = f.Aggregation() - assert.Equal(t, 1, agg.aggregationN, "failed to propagate Aggregation") - } -} - -func str(a attribute.Set) string { - iter := a.Iter() - out := make([]string, 0, iter.Len()) - for iter.Next() { - kv := iter.Attribute() - out = append(out, fmt.Sprintf("%s:%#v", kv.Key, kv.Value.AsInterface())) - } - return strings.Join(out, ",") -} - -type testFilterAgg[N int64 | float64] struct { - values map[attribute.Set]precomputedValue[N] - aggregationN int -} - -func newTestFilterAgg[N int64 | float64]() *testFilterAgg[N] { - return &testFilterAgg[N]{ - values: make(map[attribute.Set]precomputedValue[N]), - } -} - -func (a *testFilterAgg[N]) Aggregate(val N, attr attribute.Set) { - v := a.values[attr] - v.measured = val - a.values[attr] = v -} - -// nolint: unused // Used to agg filtered. -func (a *testFilterAgg[N]) aggregateFiltered(val N, attr attribute.Set) { - v := a.values[attr] - v.filtered += val - a.values[attr] = v -} - -func (a *testFilterAgg[N]) Aggregation() metricdata.Aggregation { - a.aggregationN++ - return nil -} diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index 14af6273cbd..594068c4354 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -150,63 +150,6 @@ func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { return out } -// precomputedValue is the recorded measurement value for a set of attributes. -type precomputedValue[N int64 | float64] struct { - // measured is the last value measured for a set of attributes that were - // not filtered. - measured N - // filtered is the sum of values from measurements that had their - // attributes filtered. - filtered N -} - -// precomputedMap is the storage for precomputed sums. -type precomputedMap[N int64 | float64] struct { - sync.Mutex - values map[attribute.Set]precomputedValue[N] -} - -func newPrecomputedMap[N int64 | float64]() *precomputedMap[N] { - return &precomputedMap[N]{ - values: make(map[attribute.Set]precomputedValue[N]), - } -} - -// Aggregate records value with the unfiltered attributes attr. -// -// If a previous measurement was made for the same attribute set: -// -// - If that measurement's attributes were not filtered, this value overwrite -// that value. -// - If that measurement's attributes were filtered, this value will be -// recorded along side that value. -func (s *precomputedMap[N]) Aggregate(value N, attr attribute.Set) { - s.Lock() - v := s.values[attr] - v.measured = value - s.values[attr] = v - s.Unlock() -} - -// aggregateFiltered records value with the filtered attributes attr. -// -// If a previous measurement was made for the same attribute set: -// -// - If that measurement's attributes were not filtered, this value will be -// recorded along side that value. -// - If that measurement's attributes were filtered, this value will be -// added to it. -// -// This method should not be used if attr have not been reduced by an attribute -// filter. -func (s *precomputedMap[N]) aggregateFiltered(value N, attr attribute.Set) { // nolint: unused // Used to agg filtered. - s.Lock() - v := s.values[attr] - v.filtered += value - s.values[attr] = v - s.Unlock() -} - // newPrecomputedDeltaSum returns an Aggregator that summarizes a set of // pre-computed sums. Each sum is scoped by attributes and the aggregation // cycle the measurements were made in. @@ -218,17 +161,17 @@ func (s *precomputedMap[N]) aggregateFiltered(value N, attr attribute.Set) { // // The output Aggregation will report recorded values as delta temporality. func newPrecomputedDeltaSum[N int64 | float64](monotonic bool) aggregator[N] { return &precomputedDeltaSum[N]{ - precomputedMap: newPrecomputedMap[N](), - reported: make(map[attribute.Set]N), - monotonic: monotonic, - start: now(), + valueMap: newValueMap[N](), + reported: make(map[attribute.Set]N), + monotonic: monotonic, + start: now(), } } // precomputedDeltaSum summarizes a set of pre-computed sums recorded over all // aggregation cycles as the delta of these sums. type precomputedDeltaSum[N int64 | float64] struct { - *precomputedMap[N] + *valueMap[N] reported map[attribute.Set]N @@ -263,15 +206,14 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), } for attr, value := range s.values { - v := value.measured + value.filtered - delta := v - s.reported[attr] + delta := value - s.reported[attr] out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ Attributes: attr, StartTime: s.start, Time: t, Value: delta, }) - newReported[attr] = v + newReported[attr] = value // Unused attribute sets do not report. delete(s.values, attr) } @@ -294,15 +236,15 @@ func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { // temporality. func newPrecomputedCumulativeSum[N int64 | float64](monotonic bool) aggregator[N] { return &precomputedCumulativeSum[N]{ - precomputedMap: newPrecomputedMap[N](), - monotonic: monotonic, - start: now(), + valueMap: newValueMap[N](), + monotonic: monotonic, + start: now(), } } // precomputedCumulativeSum directly records and reports a set of pre-computed sums. type precomputedCumulativeSum[N int64 | float64] struct { - *precomputedMap[N] + *valueMap[N] monotonic bool start time.Time @@ -337,7 +279,7 @@ func (s *precomputedCumulativeSum[N]) Aggregation() metricdata.Aggregation { Attributes: attr, StartTime: s.start, Time: t, - Value: value.measured + value.filtered, + Value: value, }) // Unused attribute sets do not report. delete(s.values, attr) diff --git a/sdk/metric/internal/aggregate/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go index e128459b1d0..0843bcf8429 100644 --- a/sdk/metric/internal/aggregate/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -37,6 +37,7 @@ func testSum[N int64 | float64](t *testing.T) { MeasurementN: defaultMeasurements, CycleN: defaultCycles, } + totalMeasurements := defaultGoroutines * defaultMeasurements t.Run("Delta", func(t *testing.T) { incr, mono := monoIncr[N](), true @@ -60,21 +61,21 @@ func testSum[N int64 | float64](t *testing.T) { t.Run("PreComputedDelta", func(t *testing.T) { incr, mono := monoIncr[N](), true - eFunc := preDeltaExpecter[N](incr, mono) + eFunc := preDeltaExpecter[N](incr, mono, N(totalMeasurements)) t.Run("Monotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false - eFunc = preDeltaExpecter[N](incr, mono) + eFunc = preDeltaExpecter[N](incr, mono, N(totalMeasurements)) t.Run("NonMonotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) }) t.Run("PreComputedCumulative", func(t *testing.T) { incr, mono := monoIncr[N](), true - eFunc := preCumuExpecter[N](incr, mono) + eFunc := preCumuExpecter[N](incr, mono, N(totalMeasurements)) t.Run("Monotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) incr, mono = nonMonoIncr[N](), false - eFunc = preCumuExpecter[N](incr, mono) + eFunc = preCumuExpecter[N](incr, mono, N(totalMeasurements)) t.Run("NonMonotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) }) } @@ -103,26 +104,26 @@ func cumuExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { } } -func preDeltaExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { +func preDeltaExpecter[N int64 | float64](incr setMap[N], mono bool, totalMeasurements N) expectFunc { sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} last := make(map[attribute.Set]N) return func(int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { l := last[a] - sum.DataPoints = append(sum.DataPoints, point(a, N(v)-l)) + sum.DataPoints = append(sum.DataPoints, point(a, totalMeasurements*(N(v)-l))) last[a] = N(v) } return sum } } -func preCumuExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { +func preCumuExpecter[N int64 | float64](incr setMap[N], mono bool, totalMeasurements N) expectFunc { sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} return func(int) metricdata.Aggregation { sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, N(v))) + sum.DataPoints = append(sum.DataPoints, point(a, totalMeasurements*N(v))) } return sum } @@ -167,118 +168,65 @@ func TestDeltaSumReset(t *testing.T) { func TestPreComputedDeltaSum(t *testing.T) { var mono bool agg := newPrecomputedDeltaSum[int64](mono) - require.Implements(t, (*precomputeAggregator[int64])(nil), agg) + require.Implements(t, (*aggregator[int64])(nil), agg) attrs := attribute.NewSet(attribute.String("key", "val")) agg.Aggregate(1, attrs) - got := agg.Aggregation() want := metricdata.Sum[int64]{ IsMonotonic: mono, Temporality: metricdata.DeltaTemporality, DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, } opt := metricdatatest.IgnoreTimestamp() - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - // No observation means no metric data - got = agg.Aggregation() - metricdatatest.AssertAggregationsEqual(t, nil, got, opt) + // No observation results in an empty aggregation, and causes previous + // observations to be forgotten. + metricdatatest.AssertAggregationsEqual(t, nil, agg.Aggregation(), opt) - agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) - got = agg.Aggregation() - // measured(+): 1, previous(-): 1, filtered(+): 1 + agg.Aggregate(1, attrs) + // measured(+): 1, previous(-): 0 want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - - // Filtered values should not persist. - got = agg.Aggregation() - // No observation means no metric data - metricdatatest.AssertAggregationsEqual(t, nil, got, opt) + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - // Override set value. + // Duplicate observations add agg.Aggregate(2, attrs) agg.Aggregate(5, attrs) - // Filtered should add. - agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) - agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) - got = agg.Aggregation() - // measured(+): 5, previous(-): 0, filtered(+): 13 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 18)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - - // Filtered values should not persist. - agg.Aggregate(5, attrs) - got = agg.Aggregation() - // measured(+): 5, previous(-): 18, filtered(+): 0 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -13)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - - // Order should not affect measure. - // Filtered should add. - agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) - agg.Aggregate(7, attrs) - agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) - got = agg.Aggregation() - // measured(+): 7, previous(-): 5, filtered(+): 13 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 15)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - agg.Aggregate(7, attrs) - got = agg.Aggregation() - // measured(+): 7, previous(-): 20, filtered(+): 0 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, -13)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + agg.Aggregate(3, attrs) + agg.Aggregate(10, attrs) + // measured(+): 20, previous(-): 1 + want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 19)} + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) } func TestPreComputedCumulativeSum(t *testing.T) { var mono bool agg := newPrecomputedCumulativeSum[int64](mono) - require.Implements(t, (*precomputeAggregator[int64])(nil), agg) + require.Implements(t, (*aggregator[int64])(nil), agg) attrs := attribute.NewSet(attribute.String("key", "val")) agg.Aggregate(1, attrs) - got := agg.Aggregation() want := metricdata.Sum[int64]{ IsMonotonic: mono, Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, } opt := metricdatatest.IgnoreTimestamp() - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) // Cumulative values should not persist. - got = agg.Aggregation() - metricdatatest.AssertAggregationsEqual(t, nil, got, opt) + metricdatatest.AssertAggregationsEqual(t, nil, agg.Aggregation(), opt) - agg.(precomputeAggregator[int64]).aggregateFiltered(1, attrs) - got = agg.Aggregation() + agg.Aggregate(1, attrs) want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - - // Filtered values should not persist. - got = agg.Aggregation() - metricdatatest.AssertAggregationsEqual(t, nil, got, opt) + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - // Override set value. + // Duplicate measurements add agg.Aggregate(5, attrs) - // Filtered should add. - agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) - agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) - got = agg.Aggregation() + agg.Aggregate(3, attrs) + agg.Aggregate(10, attrs) want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 18)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) - - // Filtered values should not persist. - got = agg.Aggregation() - metricdatatest.AssertAggregationsEqual(t, nil, got, opt) - - // Order should not affect measure. - // Filtered should add. - agg.(precomputeAggregator[int64]).aggregateFiltered(3, attrs) - agg.Aggregate(7, attrs) - agg.(precomputeAggregator[int64]).aggregateFiltered(10, attrs) - got = agg.Aggregation() - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 20)} - metricdatatest.AssertAggregationsEqual(t, want, got, opt) + metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) } func TestEmptySumNilAggregation(t *testing.T) { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 185095e4f8d..8657ccc7135 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -960,9 +960,6 @@ func TestGlobalInstRegisterCallback(t *testing.T) { _, err = preMtr.RegisterCallback(cb, preInt64Ctr, preFloat64Ctr, postInt64Ctr, postFloat64Ctr) assert.NoError(t, err) - _, err = preMtr.RegisterCallback(cb, preInt64Ctr, preFloat64Ctr, postInt64Ctr, postFloat64Ctr) - assert.NoError(t, err) - got := metricdata.ResourceMetrics{} err = rdr.Collect(context.Background(), &got) assert.NoError(t, err) From 84b2e5467131a1f1faf41f788677e5ee66a9b8de Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Jul 2023 09:59:07 -0700 Subject: [PATCH 606/886] Use inst ID for agg cache key (#4337) * Use inst ID for agg cache key Resolve #4201 The specification requires the duplicate instrument conflicts to be identified based on the instrument identifying fields: - name - instrument kind - unit - description - language-level features such as the number type (int64 and float64) Currently, the conflict detection and aggregation caching are done based on the stream IDs which include an aggregation name, monotonicity, and temporality instead of the instrument kind. This changes the conflict detection and aggregation caching to use the OpenTelemetry specified fields. This is effectively a no-op given there is a 1-to-1 mapping of aggregation-name/monotonicity/temporality to instrument kind (they are all resolved based on the instrument kind). Additionally, this adds a stringer representation of the `InstrumentKind`. This is needed for the logging of duplicate instrument conflicts. * Add changes to changelog --- CHANGELOG.md | 1 + sdk/metric/instrument.go | 18 +++++-------- sdk/metric/instrumentkind_string.go | 29 ++++++++++++++++++++ sdk/metric/meter.go | 2 +- sdk/metric/pipeline.go | 40 +++++++++++----------------- sdk/metric/pipeline_registry_test.go | 14 +++++----- sdk/metric/pipeline_test.go | 2 +- 7 files changed, 61 insertions(+), 45 deletions(-) create mode 100644 sdk/metric/instrumentkind_string.go diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2e673fb42..d3f8170b023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) - Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) - Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) +- Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 83652c6e97f..eff2f179a51 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:generate stringer -type=InstrumentKind -trimprefix=InstrumentKind + package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( @@ -25,7 +27,6 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - "go.opentelemetry.io/otel/sdk/metric/metricdata" ) var ( @@ -172,23 +173,16 @@ func (s Stream) attributeFilter() attribute.Filter { } } -// streamID are the identifying properties of a stream. -type streamID struct { +// instID are the identifying properties of a instrument. +type instID struct { // Name is the name of the stream. Name string // Description is the description of the stream. Description string + // Kind defines the functional group of the instrument. + Kind InstrumentKind // Unit is the unit of the stream. Unit string - // Aggregation is the aggregation data type of the stream. - Aggregation string - // Monotonic is the monotonicity of an instruments data type. This field is - // not used for all data types, so a zero value needs to be understood in the - // context of Aggregation. - Monotonic bool - // Temporality is the temporality of a stream's data type. This field is - // not used by some data types. - Temporality metricdata.Temporality // Number is the number type of the stream. Number string } diff --git a/sdk/metric/instrumentkind_string.go b/sdk/metric/instrumentkind_string.go new file mode 100644 index 00000000000..d5f9e982c2b --- /dev/null +++ b/sdk/metric/instrumentkind_string.go @@ -0,0 +1,29 @@ +// Code generated by "stringer -type=InstrumentKind -trimprefix=InstrumentKind"; DO NOT EDIT. + +package metric + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[instrumentKindUndefined-0] + _ = x[InstrumentKindCounter-1] + _ = x[InstrumentKindUpDownCounter-2] + _ = x[InstrumentKindHistogram-3] + _ = x[InstrumentKindObservableCounter-4] + _ = x[InstrumentKindObservableUpDownCounter-5] + _ = x[InstrumentKindObservableGauge-6] +} + +const _InstrumentKind_name = "instrumentKindUndefinedCounterUpDownCounterHistogramObservableCounterObservableUpDownCounterObservableGauge" + +var _InstrumentKind_index = [...]uint8{0, 23, 30, 43, 52, 69, 92, 107} + +func (i InstrumentKind) String() string { + if i >= InstrumentKind(len(_InstrumentKind_index)-1) { + return "InstrumentKind(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _InstrumentKind_name[_InstrumentKind_index[i]:_InstrumentKind_index[i+1]] +} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index f76d5190413..caed7387c0a 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -49,7 +49,7 @@ type meter struct { func newMeter(s instrumentation.Scope, p pipelines) *meter { // viewCache ensures instrument conflicts, including number conflicts, this // meter is asked to create are logged to the user. - var viewCache cache[string, streamID] + var viewCache cache[string, instID] return &meter{ scope: s, diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 5989e0c9575..d6af04c6e27 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -187,24 +187,24 @@ type inserter[N int64 | float64] struct { // cache ensures no duplicate aggregate functions are inserted into the // reader pipeline and if a new request during an instrument creation asks // for the same aggregate function input the same instance is returned. - aggregators *cache[streamID, aggVal[N]] + aggregators *cache[instID, aggVal[N]] // views is a cache that holds instrument identifiers for all the // instruments a Meter has created, it is provided from the Meter that owns // this inserter. This cache ensures during the creation of instruments // with the same name but different options (e.g. description, unit) a // warning message is logged. - views *cache[string, streamID] + views *cache[string, instID] pipeline *pipeline } -func newInserter[N int64 | float64](p *pipeline, vc *cache[string, streamID]) *inserter[N] { +func newInserter[N int64 | float64](p *pipeline, vc *cache[string, instID]) *inserter[N] { if vc == nil { - vc = &cache[string, streamID]{} + vc = &cache[string, instID]{} } return &inserter[N]{ - aggregators: &cache[streamID, aggVal[N]]{}, + aggregators: &cache[instID, aggVal[N]]{}, views: vc, pipeline: p, } @@ -320,12 +320,14 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum ) } - id := i.streamID(kind, stream) + id := i.instID(kind, stream) // If there is a conflict, the specification says the view should // still be applied and a warning should be logged. i.logConflict(id) cv := i.aggregators.Lookup(id, func() aggVal[N] { - b := aggregate.Builder[N]{Temporality: id.Temporality} + b := aggregate.Builder[N]{ + Temporality: i.pipeline.reader.temporality(kind), + } if len(stream.AllowAttributeKeys) > 0 { b.Filter = stream.attributeFilter() } @@ -350,8 +352,8 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // logConflict validates if an instrument with the same name as id has already // been created. If that instrument conflicts with id, a warning is logged. -func (i *inserter[N]) logConflict(id streamID) { - existing := i.views.Lookup(id.Name, func() streamID { return id }) +func (i *inserter[N]) logConflict(id instID) { + existing := i.views.Lookup(id.Name, func() instID { return id }) if id == existing { return } @@ -360,31 +362,21 @@ func (i *inserter[N]) logConflict(id streamID) { "duplicate metric stream definitions", "names", fmt.Sprintf("%q, %q", existing.Name, id.Name), "descriptions", fmt.Sprintf("%q, %q", existing.Description, id.Description), + "kinds", fmt.Sprintf("%s, %s", existing.Kind, id.Kind), "units", fmt.Sprintf("%s, %s", existing.Unit, id.Unit), "numbers", fmt.Sprintf("%s, %s", existing.Number, id.Number), - "aggregations", fmt.Sprintf("%s, %s", existing.Aggregation, id.Aggregation), - "monotonics", fmt.Sprintf("%t, %t", existing.Monotonic, id.Monotonic), - "temporalities", fmt.Sprintf("%s, %s", existing.Temporality.String(), id.Temporality.String()), ) } -func (i *inserter[N]) streamID(kind InstrumentKind, stream Stream) streamID { +func (i *inserter[N]) instID(kind InstrumentKind, stream Stream) instID { var zero N - id := streamID{ + return instID{ Name: stream.Name, Description: stream.Description, Unit: stream.Unit, - Aggregation: fmt.Sprintf("%T", stream.Aggregation), - Temporality: i.pipeline.reader.temporality(kind), + Kind: kind, Number: fmt.Sprintf("%T", zero), } - - switch kind { - case InstrumentKindObservableCounter, InstrumentKindCounter, InstrumentKindHistogram: - id.Monotonic = true - } - - return id } // aggregateFunc returns new aggregate functions matching agg, kind, and @@ -526,7 +518,7 @@ type resolver[N int64 | float64] struct { inserters []*inserter[N] } -func newResolver[N int64 | float64](p pipelines, vc *cache[string, streamID]) resolver[N] { +func newResolver[N int64 | float64](p pipelines, vc *cache[string, instID]) resolver[N] { in := make([]*inserter[N], len(p)) for i := range in { in[i] = newInserter[N](p[i], vc) diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index c10bbc36803..5969392c6cb 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -350,7 +350,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { } for _, tt := range testcases { t.Run(tt.name, func(t *testing.T) { - var c cache[string, streamID] + var c cache[string, instID] p := newPipeline(nil, tt.reader, tt.views) i := newInserter[N](p, &c) input, err := i.Instrument(tt.inst) @@ -371,7 +371,7 @@ func TestCreateAggregators(t *testing.T) { } func testInvalidInstrumentShouldPanic[N int64 | float64]() { - var c cache[string, streamID] + var c cache[string, instID] i := newInserter[N](newPipeline(nil, NewManualReader(), []View{defaultView}), &c) inst := Instrument{ Name: "foo", @@ -391,7 +391,7 @@ func TestPipelinesAggregatorForEachReader(t *testing.T) { require.Len(t, pipes, 2, "created pipelines") inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} - var c cache[string, streamID] + var c cache[string, instID] r := newResolver[int64](pipes, &c) aggs, err := r.Aggregators(inst) require.NoError(t, err, "resolved Aggregators error") @@ -468,7 +468,7 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCount int) { inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} - var c cache[string, streamID] + var c cache[string, instID] r := newResolver[int64](p, &c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -478,7 +478,7 @@ func testPipelineRegistryResolveIntAggregators(t *testing.T, p pipelines, wantCo func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, wantCount int) { inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} - var c cache[string, streamID] + var c cache[string, instID] r := newResolver[float64](p, &c) aggs, err := r.Aggregators(inst) assert.NoError(t, err) @@ -505,7 +505,7 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) inst := Instrument{Name: "foo", Kind: InstrumentKindObservableGauge} - var vc cache[string, streamID] + var vc cache[string, instID] ri := newResolver[int64](p, &vc) intAggs, err := ri.Aggregators(inst) assert.Error(t, err) @@ -556,7 +556,7 @@ func TestResolveAggregatorsDuplicateErrors(t *testing.T) { p := newPipelines(resource.Empty(), readers, views) - var vc cache[string, streamID] + var vc cache[string, instID] ri := newResolver[int64](p, &vc) intAggs, err := ri.Aggregators(fooInst) assert.NoError(t, err) diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index f9056275c47..dd30a35e065 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -137,7 +137,7 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - var c cache[string, streamID] + var c cache[string, instID] i := newInserter[N](test.pipe, &c) got, err := i.Instrument(inst) require.NoError(t, err) From e08359f30c881d6174bb8f750f3526b3774d4539 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 19 Jul 2023 10:17:38 -0700 Subject: [PATCH 607/886] Detect duplicate instruments for case-insensitive names (#4338) * Detect dup inst for case-insensitive names Resolve #3835 Detect duplicate instrument registrations for instruments that have the same case-insensitive names. Continue to return the instruments with different names, but log a warning. This is the solution proposed in https://github.com/open-telemetry/opentelemetry-specification/pull/3606. * Add changes to changelog * Reset global logger after test --- CHANGELOG.md | 1 + sdk/metric/go.mod | 2 +- sdk/metric/pipeline.go | 5 ++- sdk/metric/pipeline_test.go | 77 +++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3f8170b023..85f1ec63320 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) - Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) - Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) +- Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index ebec07c04d0..fcdfdfa5b74 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -4,6 +4,7 @@ go 1.19 require ( github.com/go-logr/logr v1.2.4 + github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/metric v1.16.0 @@ -12,7 +13,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/sys v0.10.0 // indirect diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index d6af04c6e27..ad52aedfe68 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -353,7 +353,10 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // logConflict validates if an instrument with the same name as id has already // been created. If that instrument conflicts with id, a warning is logged. func (i *inserter[N]) logConflict(id instID) { - existing := i.views.Lookup(id.Name, func() instID { return id }) + // The API specification defines names as case-insensitive. If there is a + // different casing of a name it needs to be a conflict. + name := strings.ToLower(id.Name) + existing := i.views.Lookup(name, func() instID { return id }) if id == existing { return } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index dd30a35e065..58916079429 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -17,12 +17,19 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" "fmt" + "log" + "os" + "strings" "sync" "testing" + "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" + "github.com/go-logr/stdr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -166,3 +173,73 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { } } } + +func TestLogConflictName(t *testing.T) { + testcases := []struct { + existing, name string + conflict bool + }{ + { + existing: "requestCount", + name: "requestCount", + conflict: false, + }, + { + existing: "requestCount", + name: "requestDuration", + conflict: false, + }, + { + existing: "requestCount", + name: "requestcount", + conflict: true, + }, + { + existing: "requestCount", + name: "REQUESTCOUNT", + conflict: true, + }, + { + existing: "requestCount", + name: "rEqUeStCoUnT", + conflict: true, + }, + } + + var msg string + t.Cleanup(func(orig logr.Logger) func() { + otel.SetLogger(funcr.New(func(_, args string) { + msg = args + }, funcr.Options{Verbosity: 20})) + return func() { otel.SetLogger(orig) } + }(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))) + + for _, tc := range testcases { + var vc cache[string, instID] + + name := strings.ToLower(tc.existing) + _ = vc.Lookup(name, func() instID { + return instID{Name: tc.existing} + }) + + i := newInserter[int64](newPipeline(nil, nil, nil), &vc) + i.logConflict(instID{Name: tc.name}) + + if tc.conflict { + assert.Containsf( + t, msg, "duplicate metric stream definitions", + "warning not logged for conflicting names: %s, %s", + tc.existing, tc.name, + ) + } else { + assert.Equalf( + t, msg, "", + "warning logged for non-conflicting names: %s, %s", + tc.existing, tc.name, + ) + } + + // Reset. + msg = "" + } +} From a5c82bf26e2cd70201a360fb8557dff40567d5dc Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 20 Jul 2023 10:50:12 -0500 Subject: [PATCH 608/886] Add otlpmetric Temporality Preference env var (#4287) * Add otlp metrics env vars --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + .../otlpmetric/internal/oconf/envconfig.go | 43 ++++++++ .../internal/oconf/envconfig_test.go | 103 ++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 85f1ec63320..b0924627aff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- OTLP Metrics Exporter now supports the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) - Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) - Add info and debug logging to the metric SDK. (#4315) diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go index 93b1209388d..a8cbdb8eb2a 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go @@ -24,6 +24,9 @@ import ( "time" "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) // DefaultEnvOptionsReader is the default environments reader. @@ -96,6 +99,7 @@ func getOptionsFromEnv() []GenericOption { WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), ) return opts @@ -148,3 +152,42 @@ func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOpt } } } + +func withEnvTemporalityPreference(n string, fn func(metric.TemporalitySelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "cumulative": + fn(cumulativeTemporality) + case "delta": + fn(deltaTemporality) + case "lowmemory": + fn(lowMemory) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to an invalid value, ignoring.", "value", s) + } + } + } +} + +func cumulativeTemporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func deltaTemporality(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram, metric.InstrumentKindObservableCounter: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go new file mode 100644 index 00000000000..0c54c78e29a --- /dev/null +++ b/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go @@ -0,0 +1,103 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestWithEnvTemporalityPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]metricdata.Temporality + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "cumulative", + envValue: "cumulative", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindHistogram: metricdata.CumulativeTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "delta", + envValue: "delta", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.DeltaTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "lowmemory", + envValue: "lowmemory", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.TemporalitySelector) + return + } + + require.NotNil(t, cfg.Metrics.TemporalitySelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.TemporalitySelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} From a37cb0504a319904c33085c454f34491e81bf0f5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 20 Jul 2023 13:53:50 -0700 Subject: [PATCH 609/886] Replace filter aggregator with direct filter on measure (#4342) * Replace filter aggregator with direct filter on measure Part of #4220 Instead of using an aggregator to filter measured attributes, directly filter the attributes in the constructed Measure function the Builder creates. Include unit and integration testing of new filtering. * Update sdk/metric/internal/aggregate/aggregate.go Co-authored-by: David Ashpole --------- Co-authored-by: David Ashpole --- sdk/metric/internal/aggregate/aggregate.go | 6 +- .../internal/aggregate/aggregate_test.go | 75 +++++++ .../internal/aggregate/aggregator_test.go | 5 +- sdk/metric/internal/aggregate/filter.go | 58 ------ sdk/metric/internal/aggregate/filter_test.go | 196 ------------------ 5 files changed, 82 insertions(+), 258 deletions(-) create mode 100644 sdk/metric/internal/aggregate/aggregate_test.go delete mode 100644 sdk/metric/internal/aggregate/filter.go delete mode 100644 sdk/metric/internal/aggregate/filter_test.go diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index 2c501f45f13..82a8571e88d 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -44,7 +44,11 @@ type Builder[N int64 | float64] struct { func (b Builder[N]) input(agg aggregator[N]) Measure[N] { if b.Filter != nil { - agg = newFilter[N](agg, b.Filter) + fltr := b.Filter // Copy to make it immutable after assignment. + return func(_ context.Context, n N, a attribute.Set) { + fAttr, _ := a.Filter(fltr) + agg.Aggregate(n, fAttr) + } } return func(_ context.Context, n N, a attribute.Set) { agg.Aggregate(n, a) diff --git a/sdk/metric/internal/aggregate/aggregate_test.go b/sdk/metric/internal/aggregate/aggregate_test.go new file mode 100644 index 00000000000..09c92ab9a28 --- /dev/null +++ b/sdk/metric/internal/aggregate/aggregate_test.go @@ -0,0 +1,75 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" +) + +var ( + keyUser = "user" + userAlice = attribute.String(keyUser, "Alice") + adminTrue = attribute.Bool("admin", true) + + alice = attribute.NewSet(userAlice, adminTrue) + + // Filtered. + attrFltr = func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key(keyUser) + } + fltrAlice = attribute.NewSet(userAlice) +) + +type inputTester[N int64 | float64] struct { + aggregator[N] + + value N + attr attribute.Set +} + +func (it *inputTester[N]) Aggregate(v N, a attribute.Set) { it.value, it.attr = v, a } + +func TestBuilderInput(t *testing.T) { + t.Run("Int64", testBuilderInput[int64]()) + t.Run("Float64", testBuilderInput[float64]()) +} + +func testBuilderInput[N int64 | float64]() func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + + value, attr := N(1), alice + run := func(b Builder[N], wantA attribute.Set) func(*testing.T) { + return func(t *testing.T) { + t.Helper() + + it := &inputTester[N]{} + meas := b.input(it) + meas(context.Background(), value, attr) + + assert.Equal(t, value, it.value, "measured incorrect value") + assert.Equal(t, wantA, it.attr, "measured incorrect attributes") + } + } + + t.Run("NoFilter", run(Builder[N]{}, attr)) + t.Run("Filter", run(Builder[N]{Filter: attrFltr}, fltrAlice)) + } +} diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go index 3efc3a0ecba..4f322694729 100644 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -34,9 +34,8 @@ const ( ) var ( - alice = attribute.NewSet(attribute.String("user", "alice"), attribute.Bool("admin", true)) - bob = attribute.NewSet(attribute.String("user", "bob"), attribute.Bool("admin", false)) - carol = attribute.NewSet(attribute.String("user", "carol"), attribute.Bool("admin", false)) + bob = attribute.NewSet(attribute.String(keyUser, "bob"), attribute.Bool("admin", false)) + carol = attribute.NewSet(attribute.String(keyUser, "carol"), attribute.Bool("admin", false)) // Sat Jan 01 2000 00:00:00 GMT+0000. staticTime = time.Unix(946684800, 0) diff --git a/sdk/metric/internal/aggregate/filter.go b/sdk/metric/internal/aggregate/filter.go deleted file mode 100644 index ea471149e75..00000000000 --- a/sdk/metric/internal/aggregate/filter.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -// newFilter returns an Aggregator that wraps an agg with an attribute -// filtering function. Both pre-computed non-pre-computed Aggregators can be -// passed for agg. An appropriate Aggregator will be returned for the detected -// type. -func newFilter[N int64 | float64](agg aggregator[N], fn attribute.Filter) aggregator[N] { - if fn == nil { - return agg - } - return &filter[N]{ - filter: fn, - aggregator: agg, - } -} - -// filter wraps an aggregator with an attribute filter. All recorded -// measurements will have their attributes filtered before they are passed to -// the underlying aggregator's Aggregate method. -// -// This should not be used to wrap a pre-computed Aggregator. Use a -// precomputedFilter instead. -type filter[N int64 | float64] struct { - filter attribute.Filter - aggregator aggregator[N] -} - -// Aggregate records the measurement, scoped by attr, and aggregates it -// into an aggregation. -func (f *filter[N]) Aggregate(measurement N, attr attribute.Set) { - fAttr, _ := attr.Filter(f.filter) - f.aggregator.Aggregate(measurement, fAttr) -} - -// Aggregation returns an Aggregation, for all the aggregated -// measurements made and ends an aggregation cycle. -func (f *filter[N]) Aggregation() metricdata.Aggregation { - return f.aggregator.Aggregation() -} diff --git a/sdk/metric/internal/aggregate/filter_test.go b/sdk/metric/internal/aggregate/filter_test.go deleted file mode 100644 index b6544e3706b..00000000000 --- a/sdk/metric/internal/aggregate/filter_test.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - -import ( - "sync" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -// This is an aggregator that has a stable output, used for testing. It does not -// follow any spec prescribed aggregation. -type testStableAggregator[N int64 | float64] struct { - sync.Mutex - values []metricdata.DataPoint[N] -} - -// Aggregate records the measurement, scoped by attr, and aggregates it -// into an aggregation. -func (a *testStableAggregator[N]) Aggregate(measurement N, attr attribute.Set) { - a.Lock() - defer a.Unlock() - - a.values = append(a.values, metricdata.DataPoint[N]{ - Attributes: attr, - Value: measurement, - }) -} - -// Aggregation returns an Aggregation, for all the aggregated -// measurements made and ends an aggregation cycle. -func (a *testStableAggregator[N]) Aggregation() metricdata.Aggregation { - return metricdata.Gauge[N]{ - DataPoints: a.values, - } -} - -func testNewFilterNoFilter[N int64 | float64](t *testing.T, agg aggregator[N]) { - filter := newFilter(agg, nil) - assert.Equal(t, agg, filter) -} - -func testNewFilter[N int64 | float64](t *testing.T, agg aggregator[N]) { - f := newFilter(agg, testAttributeFilter) - require.IsType(t, &filter[N]{}, f) - filt := f.(*filter[N]) - assert.Equal(t, agg, filt.aggregator) -} - -var testAttributeFilter = func(kv attribute.KeyValue) bool { - return kv.Key == "power-level" -} - -func TestNewFilter(t *testing.T) { - t.Run("int64", func(t *testing.T) { - agg := &testStableAggregator[int64]{} - testNewFilterNoFilter[int64](t, agg) - testNewFilter[int64](t, agg) - }) - t.Run("float64", func(t *testing.T) { - agg := &testStableAggregator[float64]{} - testNewFilterNoFilter[float64](t, agg) - testNewFilter[float64](t, agg) - }) -} - -func testDataPoint[N int64 | float64](attr attribute.Set) metricdata.DataPoint[N] { - return metricdata.DataPoint[N]{ - Attributes: attr, - Value: 1, - } -} - -func testFilterAggregate[N int64 | float64](t *testing.T) { - testCases := []struct { - name string - inputAttr []attribute.Set - output []metricdata.DataPoint[N] - }{ - { - name: "Will filter all out", - inputAttr: []attribute.Set{ - attribute.NewSet( - attribute.String("foo", "bar"), - attribute.Float64("lifeUniverseEverything", 42.0), - ), - }, - output: []metricdata.DataPoint[N]{ - testDataPoint[N](*attribute.EmptySet()), - }, - }, - { - name: "Will keep appropriate attributes", - inputAttr: []attribute.Set{ - attribute.NewSet( - attribute.String("foo", "bar"), - attribute.Int("power-level", 9001), - attribute.Float64("lifeUniverseEverything", 42.0), - ), - attribute.NewSet( - attribute.String("foo", "bar"), - attribute.Int("power-level", 9001), - ), - }, - output: []metricdata.DataPoint[N]{ - // A real Aggregator will combine these, the testAggregator doesn't for list stability. - testDataPoint[N](attribute.NewSet(attribute.Int("power-level", 9001))), - testDataPoint[N](attribute.NewSet(attribute.Int("power-level", 9001))), - }, - }, - { - name: "Will combine Aggregations", - inputAttr: []attribute.Set{ - attribute.NewSet( - attribute.String("foo", "bar"), - ), - attribute.NewSet( - attribute.Float64("lifeUniverseEverything", 42.0), - ), - }, - output: []metricdata.DataPoint[N]{ - // A real Aggregator will combine these, the testAggregator doesn't for list stability. - testDataPoint[N](*attribute.EmptySet()), - testDataPoint[N](*attribute.EmptySet()), - }, - }, - } - - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - f := newFilter[N](&testStableAggregator[N]{}, testAttributeFilter) - for _, set := range tt.inputAttr { - f.Aggregate(1, set) - } - out := f.Aggregation().(metricdata.Gauge[N]) - assert.Equal(t, tt.output, out.DataPoints) - }) - } -} - -func TestFilterAggregate(t *testing.T) { - t.Run("int64", func(t *testing.T) { - testFilterAggregate[int64](t) - }) - t.Run("float64", func(t *testing.T) { - testFilterAggregate[float64](t) - }) -} - -func testFilterConcurrent[N int64 | float64](t *testing.T) { - f := newFilter[N](&testStableAggregator[N]{}, testAttributeFilter) - wg := &sync.WaitGroup{} - wg.Add(2) - - go func() { - f.Aggregate(1, attribute.NewSet( - attribute.String("foo", "bar"), - )) - wg.Done() - }() - - go func() { - f.Aggregate(1, attribute.NewSet( - attribute.Int("power-level", 9001), - )) - wg.Done() - }() - - wg.Wait() -} - -func TestFilterConcurrent(t *testing.T) { - t.Run("int64", func(t *testing.T) { - testFilterConcurrent[int64](t) - }) - t.Run("float64", func(t *testing.T) { - testFilterConcurrent[float64](t) - }) -} From cbc5890d9cba29c57a0c39dd27ed204e29d5370a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 20 Jul 2023 23:30:11 -0700 Subject: [PATCH 610/886] Simplify the last-value aggregate (#4343) Instead of treating the returned *lastValue as an aggregator from newLastValue, just use the type directly to construct the Measure and ComputeAggregation functions returned from the Builder. Accept a destination type for the underlying computeAggregation. This allows memory reuse for collections which adds a considerable optimization. Simplify the integration testing of the last-value aggregate. Update benchmarking. --- sdk/metric/internal/aggregate/aggregate.go | 30 ++++- .../internal/aggregate/aggregate_test.go | 113 +++++++++++++++- .../internal/aggregate/aggregator_test.go | 16 +-- sdk/metric/internal/aggregate/lastvalue.go | 38 +++--- .../internal/aggregate/lastvalue_test.go | 125 +++++++++--------- 5 files changed, 216 insertions(+), 106 deletions(-) diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index 82a8571e88d..ac9dda5cbad 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -42,6 +42,17 @@ type Builder[N int64 | float64] struct { Filter attribute.Filter } +func (b Builder[N]) filter(f Measure[N]) Measure[N] { + if b.Filter != nil { + fltr := b.Filter // Copy to make it immutable after assignment. + return func(ctx context.Context, n N, a attribute.Set) { + fAttr, _ := a.Filter(fltr) + f(ctx, n, fAttr) + } + } + return f +} + func (b Builder[N]) input(agg aggregator[N]) Measure[N] { if b.Filter != nil { fltr := b.Filter // Copy to make it immutable after assignment. @@ -63,11 +74,13 @@ func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // a last-value aggregate. lv := newLastValue[N]() - return b.input(lv), func(dest *metricdata.Aggregation) int { - // TODO (#4220): optimize memory reuse here. - *dest = lv.Aggregation() - + return b.filter(lv.measure), func(dest *metricdata.Aggregation) int { + // Ignore if dest is not a metricdata.Gauge. The chance for memory + // reuse of the DataPoints is missed (better luck next time). gData, _ := (*dest).(metricdata.Gauge[N]) + lv.computeAggregation(&gData.DataPoints) + *dest = gData + return len(gData.DataPoints) } } @@ -129,3 +142,12 @@ func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistog return len(hData.DataPoints) } } + +// reset ensures s has capacity and sets it length. If the capacity of s too +// small, a new slice is returned with the specified capacity and length. +func reset[T any](s []T, length, capacity int) []T { + if cap(s) < capacity { + return make([]T, length, capacity) + } + return s[:length] +} diff --git a/sdk/metric/internal/aggregate/aggregate_test.go b/sdk/metric/internal/aggregate/aggregate_test.go index 09c92ab9a28..76ba3a26eaf 100644 --- a/sdk/metric/internal/aggregate/aggregate_test.go +++ b/sdk/metric/internal/aggregate/aggregate_test.go @@ -16,25 +16,43 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggreg import ( "context" + "strconv" "testing" + "time" "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) var ( - keyUser = "user" - userAlice = attribute.String(keyUser, "Alice") - adminTrue = attribute.Bool("admin", true) + keyUser = "user" + userAlice = attribute.String(keyUser, "Alice") + userBob = attribute.String(keyUser, "Bob") + adminTrue = attribute.Bool("admin", true) + adminFalse = attribute.Bool("admin", false) alice = attribute.NewSet(userAlice, adminTrue) + bob = attribute.NewSet(userBob, adminFalse) // Filtered. attrFltr = func(kv attribute.KeyValue) bool { return kv.Key == attribute.Key(keyUser) } fltrAlice = attribute.NewSet(userAlice) + fltrBob = attribute.NewSet(userBob) + + // Sat Jan 01 2000 00:00:00 GMT+0000. + staticTime = time.Unix(946684800, 0) + staticNowFunc = func() time.Time { return staticTime } + // Pass to t.Cleanup to override the now function with staticNowFunc and + // revert once the test completes. E.g. t.Cleanup(mockTime(now)). + mockTime = func(orig func() time.Time) (cleanup func()) { + now = staticNowFunc + return func() { now = orig } + } ) type inputTester[N int64 | float64] struct { @@ -73,3 +91,92 @@ func testBuilderInput[N int64 | float64]() func(t *testing.T) { t.Run("Filter", run(Builder[N]{Filter: attrFltr}, fltrAlice)) } } + +type arg[N int64 | float64] struct { + ctx context.Context + + value N + attr attribute.Set +} + +type output struct { + n int + agg metricdata.Aggregation +} + +type teststep[N int64 | float64] struct { + input []arg[N] + expect output +} + +func test[N int64 | float64](meas Measure[N], comp ComputeAggregation, steps []teststep[N]) func(*testing.T) { + return func(t *testing.T) { + t.Helper() + + got := new(metricdata.Aggregation) + for i, step := range steps { + for _, args := range step.input { + meas(args.ctx, args.value, args.attr) + } + + t.Logf("step: %d", i) + assert.Equal(t, step.expect.n, comp(got), "incorrect data size") + metricdatatest.AssertAggregationsEqual(t, step.expect.agg, *got) + } + } +} + +func benchmarkAggregate[N int64 | float64](factory func() (Measure[N], ComputeAggregation)) func(*testing.B) { + counts := []int{1, 10, 100} + return func(b *testing.B) { + for _, n := range counts { + b.Run(strconv.Itoa(n), func(b *testing.B) { + benchmarkAggregateN(b, factory, n) + }) + } + } +} + +var bmarkRes metricdata.Aggregation + +func benchmarkAggregateN[N int64 | float64](b *testing.B, factory func() (Measure[N], ComputeAggregation), count int) { + ctx := context.Background() + attrs := make([]attribute.Set, count) + for i := range attrs { + attrs[i] = attribute.NewSet(attribute.Int("value", i)) + } + + b.Run("Measure", func(b *testing.B) { + got := &bmarkRes + meas, comp := factory() + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + for _, attr := range attrs { + meas(ctx, 1, attr) + } + } + + comp(got) + }) + + b.Run("ComputeAggregation", func(b *testing.B) { + comps := make([]ComputeAggregation, b.N) + for n := range comps { + meas, comp := factory() + for _, attr := range attrs { + meas(ctx, 1, attr) + } + comps[n] = comp + } + + got := &bmarkRes + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + comps[n](got) + } + }) +} diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go index 4f322694729..80882c7d641 100644 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -18,7 +18,6 @@ import ( "strconv" "sync" "testing" - "time" "github.com/stretchr/testify/assert" @@ -33,20 +32,7 @@ const ( defaultCycles = 3 ) -var ( - bob = attribute.NewSet(attribute.String(keyUser, "bob"), attribute.Bool("admin", false)) - carol = attribute.NewSet(attribute.String(keyUser, "carol"), attribute.Bool("admin", false)) - - // Sat Jan 01 2000 00:00:00 GMT+0000. - staticTime = time.Unix(946684800, 0) - staticNowFunc = func() time.Time { return staticTime } - // Pass to t.Cleanup to override the now function with staticNowFunc and - // revert once the test completes. E.g. t.Cleanup(mockTime(now)). - mockTime = func(orig func() time.Time) (cleanup func()) { - now = staticNowFunc - return func() { now = orig } - } -) +var carol = attribute.NewSet(attribute.String("user", "carol"), attribute.Bool("admin", false)) func monoIncr[N int64 | float64]() setMap[N] { return setMap[N]{alice: 1, bob: 10, carol: 2} diff --git a/sdk/metric/internal/aggregate/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go index 7a8e7d3b956..6af2d606141 100644 --- a/sdk/metric/internal/aggregate/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -15,6 +15,7 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "sync" "time" @@ -28,6 +29,10 @@ type datapoint[N int64 | float64] struct { value N } +func newLastValue[N int64 | float64]() *lastValue[N] { + return &lastValue[N]{values: make(map[attribute.Set]datapoint[N])} +} + // lastValue summarizes a set of measurements as the last one made. type lastValue[N int64 | float64] struct { sync.Mutex @@ -35,40 +40,29 @@ type lastValue[N int64 | float64] struct { values map[attribute.Set]datapoint[N] } -// newLastValue returns an Aggregator that summarizes a set of measurements as -// the last one made. -func newLastValue[N int64 | float64]() aggregator[N] { - return &lastValue[N]{values: make(map[attribute.Set]datapoint[N])} -} - -func (s *lastValue[N]) Aggregate(value N, attr attribute.Set) { +func (s *lastValue[N]) measure(ctx context.Context, value N, attr attribute.Set) { d := datapoint[N]{timestamp: now(), value: value} s.Lock() s.values[attr] = d s.Unlock() } -func (s *lastValue[N]) Aggregation() metricdata.Aggregation { +func (s *lastValue[N]) computeAggregation(dest *[]metricdata.DataPoint[N]) { s.Lock() defer s.Unlock() - if len(s.values) == 0 { - return nil - } + n := len(s.values) + *dest = reset(*dest, n, n) - gauge := metricdata.Gauge[N]{ - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), - } + var i int for a, v := range s.values { - gauge.DataPoints = append(gauge.DataPoints, metricdata.DataPoint[N]{ - Attributes: a, - // The event time is the only meaningful timestamp, StartTime is - // ignored. - Time: v.timestamp, - Value: v.value, - }) + (*dest)[i].Attributes = a + // The event time is the only meaningful timestamp, StartTime is + // ignored. + (*dest)[i].Time = v.timestamp + (*dest)[i].Value = v.value // Do not report stale values. delete(s.values, a) + i++ } - return gauge } diff --git a/sdk/metric/internal/aggregate/lastvalue_test.go b/sdk/metric/internal/aggregate/lastvalue_test.go index caf0735ba26..c758eb370c7 100644 --- a/sdk/metric/internal/aggregate/lastvalue_test.go +++ b/sdk/metric/internal/aggregate/lastvalue_test.go @@ -15,12 +15,10 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "testing" - "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) func TestLastValue(t *testing.T) { @@ -31,66 +29,69 @@ func TestLastValue(t *testing.T) { } func testLastValue[N int64 | float64]() func(*testing.T) { - tester := &aggregatorTester[N]{ - GoroutineN: defaultGoroutines, - MeasurementN: defaultMeasurements, - CycleN: defaultCycles, - } - - eFunc := func(increments setMap[N]) expectFunc { - data := make([]metricdata.DataPoint[N], 0, len(increments)) - for a, v := range increments { - point := metricdata.DataPoint[N]{Attributes: a, Time: now(), Value: N(v)} - data = append(data, point) - } - gauge := metricdata.Gauge[N]{DataPoints: data} - return func(int) metricdata.Aggregation { return gauge } - } - incr := monoIncr[N]() - return tester.Run(newLastValue[N](), incr, eFunc(incr)) -} - -func testLastValueReset[N int64 | float64](t *testing.T) { - t.Cleanup(mockTime(now)) - - a := newLastValue[N]() - assert.Nil(t, a.Aggregation()) - - a.Aggregate(1, alice) - expect := metricdata.Gauge[N]{ - DataPoints: []metricdata.DataPoint[N]{{ - Attributes: alice, - Time: now(), - Value: 1, - }}, - } - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) - - // The attr set should be forgotten once Aggregations is called. - expect.DataPoints = nil - assert.Nil(t, a.Aggregation()) - - // Aggregating another set should not affect the original (alice). - a.Aggregate(1, bob) - expect.DataPoints = []metricdata.DataPoint[N]{{ - Attributes: bob, - Time: now(), - Value: 1, - }} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) -} - -func TestLastValueReset(t *testing.T) { - t.Run("Int64", testLastValueReset[int64]) - t.Run("Float64", testLastValueReset[float64]) -} - -func TestEmptyLastValueNilAggregation(t *testing.T) { - assert.Nil(t, newLastValue[int64]().Aggregation()) - assert.Nil(t, newLastValue[float64]().Aggregation()) + in, out := Builder[N]{Filter: attrFltr}.LastValue() + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + // Empty output if nothing is measured. + input: []arg[N]{}, + expect: output{n: 0, agg: metricdata.Gauge[N]{}}, + }, { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, fltrAlice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Gauge[N]{ + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + Time: staticTime, + Value: 2, + }, + { + Attributes: fltrBob, + Time: staticTime, + Value: -10, + }, + }, + }, + }, + }, { + // Everything resets, do not report old measurements. + input: []arg[N]{}, + expect: output{n: 0, agg: metricdata.Gauge[N]{}}, + }, { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Gauge[N]{ + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + Time: staticTime, + Value: 10, + }, + { + Attributes: fltrBob, + Time: staticTime, + Value: 3, + }, + }, + }, + }, + }, + }) } func BenchmarkLastValue(b *testing.B) { - b.Run("Int64", benchmarkAggregator(newLastValue[int64])) - b.Run("Float64", benchmarkAggregator(newLastValue[float64])) + b.Run("Int64", benchmarkAggregate(Builder[int64]{}.LastValue)) + b.Run("Float64", benchmarkAggregate(Builder[float64]{}.LastValue)) } From fd5284f75cfc69d07a61024793e0ed09a8dc9c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 24 Jul 2023 09:35:06 +0200 Subject: [PATCH 611/886] styleguide: tests goroutine leaks and naming (#4348) * internal/global: Fix goroutine leaks in tests --- CONTRIBUTING.md | 7 ++++ exporters/otlp/internal/retry/retry_test.go | 2 +- .../otlp/otlpmetric/internal/exporter_test.go | 2 +- .../otlptrace/otlptracehttp/client_test.go | 2 +- internal/global/handler_test.go | 23 +++++++++-- internal/global/instruments_test.go | 38 +++++++++++-------- internal/global/internal_logging_test.go | 21 ++++++++-- internal/global/meter_test.go | 15 ++++++-- metric/instrument_test.go | 2 +- sdk/metric/cache_test.go | 2 +- .../internal/aggregate/aggregator_test.go | 2 +- sdk/metric/meter_test.go | 2 +- sdk/metric/pipeline_test.go | 2 +- sdk/metric/reader_test.go | 2 +- sdk/trace/simple_span_processor_test.go | 4 +- sdk/trace/tracetest/recorder_test.go | 4 +- 16 files changed, 90 insertions(+), 40 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72c1b9eb13c..03bcad6db20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -556,6 +556,13 @@ functionality should be added, each one will need their own super-set interfaces and will duplicate the pattern. For this reason, the simple targeted interface that defines the specific functionality should be preferred. +### Testing + +The tests should never leak goroutines. + +Use the term `ConcurrentSafe` in the test name when it aims to verify the +absence of race conditions. + ## Approvers and Maintainers ### Approvers diff --git a/exporters/otlp/internal/retry/retry_test.go b/exporters/otlp/internal/retry/retry_test.go index ad61bb306d0..de574a73579 100644 --- a/exporters/otlp/internal/retry/retry_test.go +++ b/exporters/otlp/internal/retry/retry_test.go @@ -227,7 +227,7 @@ func TestRetryNotEnabled(t *testing.T) { }), assert.AnError) } -func TestConcurrentRetry(t *testing.T) { +func TestRetryConcurrentSafe(t *testing.T) { ev := func(error) (bool, time.Duration) { return true, 0 } reqFunc := Config{ Enabled: true, diff --git a/exporters/otlp/otlpmetric/internal/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go index a9f250fbd7c..9f071032f7b 100644 --- a/exporters/otlp/otlpmetric/internal/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -56,7 +56,7 @@ func (c *client) Shutdown(context.Context) error { return nil } -func TestExporterClientConcurrency(t *testing.T) { +func TestExporterClientConcurrentSafe(t *testing.T) { const goroutines = 5 exp := New(&client{}) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 859c48dd38c..9c6a150d28a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -330,7 +330,7 @@ func TestDeadlineContext(t *testing.T) { assert.Empty(t, mc.GetSpans()) } -func TestStopWhileExporting(t *testing.T) { +func TestStopWhileExportingConcurrentSafe(t *testing.T) { statuses := make([]int, 0, 5) for i := 0; i < cap(statuses); i++ { statuses = append(statuses, http.StatusTooManyRequests) diff --git a/internal/global/handler_test.go b/internal/global/handler_test.go index 08074bcc0ff..6ddae2f4cce 100644 --- a/internal/global/handler_test.go +++ b/internal/global/handler_test.go @@ -19,7 +19,7 @@ import ( "errors" "io" "log" - "os" + "sync" "testing" "github.com/stretchr/testify/suite" @@ -123,9 +123,24 @@ func TestHandlerTestSuite(t *testing.T) { suite.Run(t, new(HandlerTestSuite)) } -func TestHandlerRace(t *testing.T) { - go SetErrorHandler(&ErrLogger{log.New(os.Stderr, "", 0)}) - go Handle(errors.New("error")) +func TestHandlerConcurrentSafe(t *testing.T) { + // In order not to pollute the test output. + SetErrorHandler(&ErrLogger{log.New(io.Discard, "", 0)}) + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + SetErrorHandler(&ErrLogger{log.New(io.Discard, "", 0)}) + }() + wg.Add(1) + go func() { + defer wg.Done() + Handle(errors.New("error")) + }() + + wg.Wait() + reset() } func BenchmarkErrorHandler(b *testing.B) { diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index 7003e04b1f2..c0ab914b6c2 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -23,9 +23,11 @@ import ( "go.opentelemetry.io/otel/metric/noop" ) -func testFloat64Race(interact func(float64), setDelegate func(metric.Meter)) { +func testFloat64ConcurrentSafe(interact func(float64), setDelegate func(metric.Meter)) { + done := make(chan struct{}) finish := make(chan struct{}) go func() { + defer close(done) for { interact(1) select { @@ -38,11 +40,14 @@ func testFloat64Race(interact func(float64), setDelegate func(metric.Meter)) { setDelegate(noop.NewMeterProvider().Meter("")) close(finish) + <-done } -func testInt64Race(interact func(int64), setDelegate func(metric.Meter)) { +func testInt64ConcurrentSafe(interact func(int64), setDelegate func(metric.Meter)) { + done := make(chan struct{}) finish := make(chan struct{}) go func() { + defer close(done) for { interact(1) select { @@ -55,27 +60,28 @@ func testInt64Race(interact func(int64), setDelegate func(metric.Meter)) { setDelegate(noop.NewMeterProvider().Meter("")) close(finish) + <-done } -func TestAsyncInstrumentSetDelegateRace(t *testing.T) { +func TestAsyncInstrumentSetDelegateConcurrentSafe(t *testing.T) { // Float64 Instruments t.Run("Float64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &afCounter{} f := func(float64) { _ = delegate.Unwrap() } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &afUpDownCounter{} f := func(float64) { _ = delegate.Unwrap() } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &afGauge{} f := func(float64) { _ = delegate.Unwrap() } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) }) @@ -85,42 +91,42 @@ func TestAsyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &aiCounter{} f := func(int64) { _ = delegate.Unwrap() } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &aiUpDownCounter{} f := func(int64) { _ = delegate.Unwrap() } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("Gauge", func(t *testing.T) { delegate := &aiGauge{} f := func(int64) { _ = delegate.Unwrap() } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) }) } -func TestSyncInstrumentSetDelegateRace(t *testing.T) { +func TestSyncInstrumentSetDelegateConcurrentSafe(t *testing.T) { // Float64 Instruments t.Run("Float64", func(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &sfCounter{} f := func(v float64) { delegate.Add(context.Background(), v) } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &sfUpDownCounter{} f := func(v float64) { delegate.Add(context.Background(), v) } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("Histogram", func(t *testing.T) { delegate := &sfHistogram{} f := func(v float64) { delegate.Record(context.Background(), v) } - testFloat64Race(f, delegate.setDelegate) + testFloat64ConcurrentSafe(f, delegate.setDelegate) }) }) @@ -130,19 +136,19 @@ func TestSyncInstrumentSetDelegateRace(t *testing.T) { t.Run("Counter", func(t *testing.T) { delegate := &siCounter{} f := func(v int64) { delegate.Add(context.Background(), v) } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("UpDownCounter", func(t *testing.T) { delegate := &siUpDownCounter{} f := func(v int64) { delegate.Add(context.Background(), v) } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) t.Run("Histogram", func(t *testing.T) { delegate := &siHistogram{} f := func(v int64) { delegate.Record(context.Background(), v) } - testInt64Race(f, delegate.setDelegate) + testInt64ConcurrentSafe(f, delegate.setDelegate) }) }) } diff --git a/internal/global/internal_logging_test.go b/internal/global/internal_logging_test.go index ae2f2f61781..b51333b4dd5 100644 --- a/internal/global/internal_logging_test.go +++ b/internal/global/internal_logging_test.go @@ -17,8 +17,9 @@ package global import ( "bytes" "errors" + "io" "log" - "os" + "sync" "testing" "github.com/go-logr/logr" @@ -29,9 +30,21 @@ import ( "github.com/go-logr/stdr" ) -func TestRace(t *testing.T) { - go SetLogger(stdr.New(log.New(os.Stderr, "", 0))) - go Info("") +func TestLoggerConcurrentSafe(t *testing.T) { + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + SetLogger(stdr.New(log.New(io.Discard, "", 0))) + }() + wg.Add(1) + go func() { + defer wg.Done() + Info("") + }() + + wg.Wait() + reset() } func TestLogLevel(t *testing.T) { diff --git a/internal/global/meter_test.go b/internal/global/meter_test.go index b91f4fd57c8..9ad8d4f5ee7 100644 --- a/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -27,10 +27,12 @@ import ( "go.opentelemetry.io/otel/metric/noop" ) -func TestMeterProviderRace(t *testing.T) { +func TestMeterProviderConcurrentSafe(t *testing.T) { mp := &meterProvider{} + done := make(chan struct{}) finish := make(chan struct{}) go func() { + defer close(done) for i := 0; ; i++ { mp.Meter(fmt.Sprintf("a%d", i)) select { @@ -43,19 +45,22 @@ func TestMeterProviderRace(t *testing.T) { mp.setDelegate(noop.NewMeterProvider()) close(finish) + <-done } var zeroCallback metric.Callback = func(ctx context.Context, or metric.Observer) error { return nil } -func TestMeterRace(t *testing.T) { +func TestMeterConcurrentSafe(t *testing.T) { mtr := &meter{} wg := &sync.WaitGroup{} wg.Add(1) + done := make(chan struct{}) finish := make(chan struct{}) go func() { + defer close(done) for i, once := 0, false; ; i++ { name := fmt.Sprintf("a%d", i) _, _ = mtr.Float64ObservableCounter(name) @@ -86,17 +91,20 @@ func TestMeterRace(t *testing.T) { wg.Wait() mtr.setDelegate(noop.NewMeterProvider()) close(finish) + <-done } -func TestUnregisterRace(t *testing.T) { +func TestUnregisterConcurrentSafe(t *testing.T) { mtr := &meter{} reg, err := mtr.RegisterCallback(zeroCallback) require.NoError(t, err) wg := &sync.WaitGroup{} wg.Add(1) + done := make(chan struct{}) finish := make(chan struct{}) go func() { + defer close(done) for i, once := 0, false; ; i++ { _ = reg.Unregister() if !once { @@ -115,6 +123,7 @@ func TestUnregisterRace(t *testing.T) { wg.Wait() mtr.setDelegate(noop.NewMeterProvider()) close(finish) + <-done } func testSetupAllInstrumentTypes(t *testing.T, m metric.Meter) (metric.Float64Counter, metric.Float64ObservableCounter) { diff --git a/metric/instrument_test.go b/metric/instrument_test.go index 4574160839c..0d2d1b067fc 100644 --- a/metric/instrument_test.go +++ b/metric/instrument_test.go @@ -101,7 +101,7 @@ func testConfAttr(newConf func(...MeasurementOption) attrConf) func(t *testing.T } } -func TestWithAttributesRace(t *testing.T) { +func TestWithAttributesConcurrentSafe(t *testing.T) { attrs := []attribute.KeyValue{ attribute.String("user", "Alice"), attribute.Bool("admin", true), diff --git a/sdk/metric/cache_test.go b/sdk/metric/cache_test.go index 47332a58cbd..d70b3b9e2cb 100644 --- a/sdk/metric/cache_test.go +++ b/sdk/metric/cache_test.go @@ -40,7 +40,7 @@ func TestCache(t *testing.T) { assert.Equal(t, v1, c.Lookup(k1, func() int { return v1 }), "non-existing key") } -func TestCacheConcurrency(t *testing.T) { +func TestCacheConcurrentSafe(t *testing.T) { const ( key = "k" goroutines = 10 diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go index 80882c7d641..0bca6b01b4b 100644 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -78,7 +78,7 @@ func (at *aggregatorTester[N]) Run(a aggregator[N], incr setMap[N], eFunc expect }) }) - t.Run("Correctness", func(t *testing.T) { + t.Run("CorrectnessConcurrentSafe", func(t *testing.T) { for i := 0; i < at.CycleN; i++ { var wg sync.WaitGroup wg.Add(at.GoroutineN) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 8657ccc7135..bfa1879120b 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -37,7 +37,7 @@ import ( ) // A meter should be able to make instruments concurrently. -func TestMeterInstrumentConcurrency(t *testing.T) { +func TestMeterInstrumentConcurrentSafe(t *testing.T) { wg := &sync.WaitGroup{} wg.Add(12) diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 58916079429..fdeb4fe1f7b 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -81,7 +81,7 @@ func TestPipelineUsesResource(t *testing.T) { assert.Equal(t, res, output.Resource) } -func TestPipelineConcurrency(t *testing.T) { +func TestPipelineConcurrentSafe(t *testing.T) { pipe := newPipeline(nil, nil, nil) ctx := context.Background() var output metricdata.ResourceMetrics diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index ca10da77340..d375a1b4f6c 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -157,7 +157,7 @@ func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { ts.Equal(metricdata.ResourceMetrics{}, m) } -func (ts *readerTestSuite) TestMethodConcurrency() { +func (ts *readerTestSuite) TestMethodConcurrentSafe() { // Requires the race-detector (a default test option for the project). // All reader methods should be concurrent-safe. diff --git a/sdk/trace/simple_span_processor_test.go b/sdk/trace/simple_span_processor_test.go index fc038978314..38a44e08fb2 100644 --- a/sdk/trace/simple_span_processor_test.go +++ b/sdk/trace/simple_span_processor_test.go @@ -120,7 +120,7 @@ func TestSimpleSpanProcessorShutdown(t *testing.T) { } } -func TestSimpleSpanProcessorShutdownOnEndConcurrency(t *testing.T) { +func TestSimpleSpanProcessorShutdownOnEndConcurrentSafe(t *testing.T) { exporter := &testExporter{} ssp := sdktrace.NewSimpleSpanProcessor(exporter) tp := basicTracerProvider(t) @@ -153,7 +153,7 @@ func TestSimpleSpanProcessorShutdownOnEndConcurrency(t *testing.T) { <-done } -func TestSimpleSpanProcessorShutdownOnEndRace(t *testing.T) { +func TestSimpleSpanProcessorShutdownOnEndConcurrentSafe2(t *testing.T) { exporter := &testExporter{} ssp := sdktrace.NewSimpleSpanProcessor(exporter) tp := basicTracerProvider(t) diff --git a/sdk/trace/tracetest/recorder_test.go b/sdk/trace/tracetest/recorder_test.go index ef292a981ce..de7eead160c 100644 --- a/sdk/trace/tracetest/recorder_test.go +++ b/sdk/trace/tracetest/recorder_test.go @@ -99,7 +99,7 @@ func runConcurrently(funcs ...func()) { wg.Wait() } -func TestEndingConcurrency(t *testing.T) { +func TestEndingConcurrentSafe(t *testing.T) { sr := NewSpanRecorder() runConcurrently( @@ -111,7 +111,7 @@ func TestEndingConcurrency(t *testing.T) { assert.Len(t, sr.Ended(), 2) } -func TestStartingConcurrency(t *testing.T) { +func TestStartingConcurrentSafe(t *testing.T) { sr := NewSpanRecorder() ctx := context.Background() From ab61991465d957db46e4f8a78b1dcf84546bdef8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 24 Jul 2023 07:47:56 -0700 Subject: [PATCH 612/886] Log a view suggestion for duplicate instrument conflicts (#4349) * Log a view suggestion for duplicate instrument conflicts * Add change to changelog * Update changelog entry --- CHANGELOG.md | 1 + sdk/metric/internal/aggregate/new.txt | 486 ++++++++++++++++++ sdk/metric/internal/aggregate/old.txt | 486 ++++++++++++++++++ .../internal/aggregate/sum_test.go.bkup | 439 ++++++++++++++++ sdk/metric/pipeline.go | 29 +- sdk/metric/pipeline_test.go | 115 +++++ 6 files changed, 1554 insertions(+), 2 deletions(-) create mode 100644 sdk/metric/internal/aggregate/new.txt create mode 100644 sdk/metric/internal/aggregate/old.txt create mode 100644 sdk/metric/internal/aggregate/sum_test.go.bkup diff --git a/CHANGELOG.md b/CHANGELOG.md index b0924627aff..3516e388dcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) - Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) - Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) +- Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/metric/internal/aggregate/new.txt b/sdk/metric/internal/aggregate/new.txt new file mode 100644 index 00000000000..9539627b09a --- /dev/null +++ b/sdk/metric/internal/aggregate/new.txt @@ -0,0 +1,486 @@ +goos: linux +goarch: amd64 +pkg: go.opentelemetry.io/otel/sdk/metric/internal/aggregate +cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz +BenchmarkSum/Int64/Cumulative/1/Measure-8 12832801 84.19 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13738166 84.33 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14909516 84.81 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14371771 84.26 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14037006 87.30 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14160303 84.69 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14000491 84.83 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14017932 86.88 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 14086557 85.51 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13918137 84.29 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5236875 198.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5373666 233.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5249028 203.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4997298 208.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5309054 206.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5225592 213.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5210971 272.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4688874 241.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4455781 243.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4731162 245.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1199733 1043 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1011 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1216923 1028 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1066 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1058 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1198212 991.0 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1063 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1015 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1204028 1035 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1043 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3269596 347.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3237217 365.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3309460 342.9 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3181944 354.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3136028 357.8 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3345159 348.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3345584 351.1 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3097239 350.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3257766 373.1 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3198373 354.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 116356 10723 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 111188 11146 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 109912 10565 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 112994 10761 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 122049 10268 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 121502 10341 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 119794 11044 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 117589 10230 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 123240 10678 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 122952 11023 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 559370 1974 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 591718 1987 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 596125 2061 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 601368 1987 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 602349 2152 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 557488 2047 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 600099 2087 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 592650 2036 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 566413 2146 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 576310 2127 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13567838 101.0 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12627882 96.37 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13880398 98.05 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13438856 91.80 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13551433 92.05 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12615459 98.22 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12291924 94.78 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13374356 92.66 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13105550 91.96 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 13308955 91.51 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3140188 393.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2963001 352.8 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3707602 408.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3196657 387.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3252639 396.0 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3148338 393.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3130227 395.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3203203 405.8 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3069350 406.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2998692 397.1 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1086 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1102 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1177 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1200 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1145 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1134 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1142 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1174 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1148 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 847432 1619 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 841924 1561 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 766815 1663 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 803617 1611 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 837134 1583 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 839544 1675 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 838986 1580 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 839352 1617 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 836071 1569 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 829735 1728 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 119364 10702 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 116712 11295 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 120844 11580 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 116643 10542 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 102613 10862 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 107965 10792 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 109129 11361 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 116842 10459 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 118702 11221 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 109262 11172 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 87906 13428 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 84370 13726 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83199 13387 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83788 14235 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 89572 14089 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90222 13411 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83817 13824 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90033 14293 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90631 13483 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 89948 13451 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 13048044 100.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 11987622 97.05 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12525115 100.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 13802107 94.21 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12701176 96.28 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 13829084 99.60 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 13854591 95.88 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12327361 99.59 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12124970 94.60 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 13713087 95.66 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4489012 260.0 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 6131644 235.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4632294 266.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4628036 250.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4807899 227.8 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4751396 266.9 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4661839 277.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4715024 265.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4595482 257.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4679578 267.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 987913 1165 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1093 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1095 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1153 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1139 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1085 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1099 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1152 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1159 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2905521 380.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3015876 376.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2984940 377.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2803021 379.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3029174 384.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3032427 376.1 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3127575 371.0 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2893978 376.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3120540 393.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3036336 373.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 113311 10637 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 101358 10624 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 119534 10586 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 120386 10504 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 112252 10711 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 117482 11275 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 106592 10528 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 113810 11263 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 114720 11215 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 114590 10463 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 509122 2274 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 575350 2251 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 519496 2260 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 557757 2195 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 560943 2226 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 536691 2229 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 534720 2230 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 572613 2222 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 537004 2255 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 560804 2219 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12123902 95.92 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12743845 94.11 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12899218 93.47 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12742275 93.21 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12949663 93.67 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 13187468 93.66 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 13722506 94.85 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12600060 95.15 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 13934244 98.40 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 13383878 94.83 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3353437 359.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3255859 410.8 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2982471 408.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3210732 382.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3182137 379.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3026965 390.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3081061 426.0 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3116241 406.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3114680 422.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2998998 426.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1104 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1043538 1140 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1151 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1108 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1107 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1078 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1122 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1097 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1073 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 823614 1612 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 827082 1627 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 802323 1591 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 813440 1643 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 806421 1597 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 827452 1604 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 663091 1570 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 829683 1643 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 792718 1584 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 815619 1605 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 116443 10993 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 108036 10998 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 120033 11305 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 115340 11346 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 118672 10674 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 116216 10694 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 111798 10779 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 109923 10593 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 114754 10681 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 114912 10909 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 88519 14457 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86623 14008 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86084 14138 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86601 13681 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 83034 14503 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86284 13641 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 78396 13685 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 85956 13672 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 88202 14091 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 85731 13683 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12929575 99.68 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12970344 96.44 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12567553 94.42 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13391112 95.71 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12609759 95.80 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12320703 92.85 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12926551 95.39 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12309518 95.53 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13622700 98.77 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12700446 98.64 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2442945 479.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2445420 485.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2502744 490.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2522775 495.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2524832 509.9 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2545576 498.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2486281 498.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2405265 506.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2516514 514.6 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2503906 495.2 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1087 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1103 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1156 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1098 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1100 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1073 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1063 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1072 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1075 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 472300 2712 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 490501 2734 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491756 2728 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 485811 2749 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491367 2759 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 487554 2770 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491612 2706 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 487945 2723 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 429498 2658 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 488772 2837 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 112986 10563 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 113221 10624 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 110900 10806 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 118372 10695 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 118755 11367 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116772 11173 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 121702 11167 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116296 10388 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116600 10970 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 111428 10504 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 48642 24719 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49490 25686 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49890 25524 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49735 25526 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46292 24561 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49718 25686 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 48542 24065 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46929 24133 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49874 24255 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46832 24831 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13248100 97.78 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12405955 100.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12678439 96.10 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13830669 95.34 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13798387 95.20 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12309202 93.12 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13552324 93.64 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13670754 92.60 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12825702 95.77 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12655892 94.10 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1521536 721.2 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1598995 720.0 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1617141 754.0 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1607065 768.6 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1562186 742.6 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1613356 777.7 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1639628 771.1 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1555226 731.8 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1658127 715.9 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1614914 757.9 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 988795 1073 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1117 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1107 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1086 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1082 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1083 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1140 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1131 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 293400 4540 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 301167 4414 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297818 4459 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297556 4424 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 282568 4622 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 302499 4486 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 299958 4524 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 299124 4472 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 293887 4492 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297294 4715 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110485 11164 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 117867 11288 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 106924 10537 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 118573 10583 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 118592 10620 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 115219 10778 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109425 11335 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 121026 11256 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 108481 10511 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 116545 10521 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27654 42813 ns/op 8136 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28246 44570 ns/op 8136 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28418 45490 ns/op 8135 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28266 44224 ns/op 8138 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27304 43016 ns/op 8138 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28228 43445 ns/op 8137 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27792 44841 ns/op 8133 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27578 42586 ns/op 8138 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 26276 44125 ns/op 8139 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28119 44032 ns/op 8136 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13618124 94.36 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12826450 96.65 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13422610 99.26 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13131544 93.85 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12920649 94.14 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13475362 94.47 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13235325 94.00 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13127564 96.69 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12410412 95.26 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13232055 95.24 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2700405 486.1 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2349177 504.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2474370 495.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2493882 523.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2497772 496.7 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2456824 526.5 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2420324 495.0 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2491203 532.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2505288 514.3 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2475458 480.4 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 962577 1049 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1051 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1096 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1121991 1129 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1095 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1097 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1077 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1080 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1056 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 444800 2785 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 492310 2822 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 485503 2756 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 474487 2751 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 491212 2816 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 482865 2835 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 452144 2846 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 488284 2760 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 490476 2729 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 474738 2754 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 120754 10610 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118480 10584 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 113307 11254 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118498 11315 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 119580 10667 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 117463 10575 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118851 10699 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 112174 10852 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 109742 10718 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 112036 11161 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49584 25136 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49569 24420 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49729 24166 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 46579 25681 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 48506 24368 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 47953 24111 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49260 25882 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 44846 25201 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49846 25080 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49388 24732 ns/op 64 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13381588 94.70 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13026745 99.29 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13712457 94.52 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13100166 94.25 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13191348 93.32 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13322320 95.68 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13942035 95.90 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13685756 94.36 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13041921 94.12 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12858501 93.18 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1604078 733.0 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1547712 730.2 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1550877 729.7 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1649734 749.0 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1659384 754.9 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1655444 735.9 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1645508 786.8 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1578471 764.5 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1651297 740.9 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1543788 784.0 ns/op 320 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1088 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1078 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1072 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1128 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 994906 1119 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1041 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1060 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1123647 1073 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 266772 4557 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 288816 4659 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 240044 4577 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 302907 4622 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 304759 4573 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 296655 4547 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 292946 4578 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 306622 4725 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 301369 4477 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 263808 4650 ns/op 740 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115377 11395 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 120253 11330 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 119737 10735 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 118880 10720 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115844 10651 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 117028 10553 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115076 10766 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 118269 11016 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 110619 10935 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 119504 10941 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28315 44824 ns/op 8138 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28339 42944 ns/op 8140 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26726 43716 ns/op 8135 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28408 45537 ns/op 8136 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 27817 44962 ns/op 8138 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28106 43484 ns/op 8139 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28996 43488 ns/op 8135 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 29072 45200 ns/op 8136 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28354 43150 ns/op 8137 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28444 45076 ns/op 8137 B/op 11 allocs/op +PASS +ok go.opentelemetry.io/otel/sdk/metric/internal/aggregate 1519.546s diff --git a/sdk/metric/internal/aggregate/old.txt b/sdk/metric/internal/aggregate/old.txt new file mode 100644 index 00000000000..76316eb3359 --- /dev/null +++ b/sdk/metric/internal/aggregate/old.txt @@ -0,0 +1,486 @@ +goos: linux +goarch: amd64 +pkg: go.opentelemetry.io/otel/sdk/metric/internal/aggregate +cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz +BenchmarkSum/Int64/Cumulative/1/Measure-8 12132796 93.97 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 12833452 98.52 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13292923 97.89 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 12242515 92.63 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 12898480 92.66 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 12946058 101.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13837212 93.17 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13387345 101.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13520461 96.91 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/Measure-8 13553054 101.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4352331 266.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4209757 285.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4626202 259.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4487704 254.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4352427 260.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4386769 279.9 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4363788 292.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4401888 255.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4217253 274.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4400745 274.5 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1253 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1245 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1145 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1128 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1126 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1164 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1177 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 979124 1217 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1298989 894.0 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1373443 849.0 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1356570 901.1 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1356979 890.5 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1333526 911.2 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1395523 923.8 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1403545 892.4 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1310388 868.4 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1369364 888.6 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1345185 916.0 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 94935 12383 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 107889 11759 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 111279 11960 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 112885 12519 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 107937 11202 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 110437 11870 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 100900 12567 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 111282 11760 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 113372 11739 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/Measure-8 114145 12336 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 245482 5285 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 271778 4906 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 260509 5743 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 267429 4674 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 302884 4892 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 268592 4879 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 266072 4822 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 270511 4864 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 274407 4815 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 271594 4929 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 11385399 101.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12100845 107.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12826288 98.62 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12628515 100.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 11870608 108.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12326151 99.07 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12655506 101.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 10499667 103.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12974182 97.65 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/Measure-8 12771733 99.15 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2884323 428.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2979914 441.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2989824 466.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2992849 445.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3000021 440.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2961950 472.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2979852 435.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2999700 439.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2830801 419.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2793336 437.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1164 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1179 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1148 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1149 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 915872 1243 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 927121 1148 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1165 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1233 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1118 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 599412 2121 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 654458 2183 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 650170 2074 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 652510 2133 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 651919 2049 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 594951 2136 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 610920 2032 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 644576 2192 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 613749 2111 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 620232 2128 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 104808 11285 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 104690 12494 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 112671 12503 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 112759 11156 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 101668 11244 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 108952 11321 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 105589 12447 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 99166 11547 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 101821 11564 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/Measure-8 113941 11583 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 71049 17286 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 78675 17062 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73201 17110 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 74734 17271 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 70824 17682 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73806 18246 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 76288 17917 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73734 17663 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 71109 18042 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 76170 17803 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12238096 113.0 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12818384 109.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12864472 99.78 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 11823811 103.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 11600403 99.13 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12240856 100.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12507694 100.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 11993076 99.78 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 12453760 100.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/Measure-8 11975506 108.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4181683 292.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4493882 250.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4455595 270.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4379696 244.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4286300 271.3 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4433268 240.3 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4278093 264.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4840934 241.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4353639 262.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 3996886 259.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 943964 1235 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1014638 1180 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 885234 1265 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 932336 1207 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1173 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1275 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1271 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1220 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/Measure-8 995424 1170 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1319526 876.5 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1310713 878.1 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1322535 903.1 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1340648 937.2 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1326606 881.4 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1320040 936.7 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1352618 911.7 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1290936 894.3 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1300735 916.0 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1000000 1033 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 91390 13717 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 92311 11566 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 101764 12257 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 110319 12129 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 98139 11888 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 107817 11988 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 108433 12594 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 104708 11713 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 107071 11839 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/Measure-8 106276 12501 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 202286 5498 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 274892 5137 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 253311 5372 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 297381 4873 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 275394 5185 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277260 4922 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 272193 4987 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277756 4980 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 267218 5189 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277479 5222 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 11135397 100.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12037850 103.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12822570 103.2 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12846072 107.7 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12350216 98.40 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12719412 99.27 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12680097 99.29 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12092605 98.53 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12589422 108.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/Measure-8 12316093 98.96 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2719732 430.3 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2927137 457.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3019056 472.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2966490 436.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2957634 437.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3018825 440.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2900271 452.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2904802 459.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2958345 480.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2920442 450.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 960747 1179 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1220 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1203 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1147 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1195 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1149 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1186 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 589666 2126 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 629466 2087 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 641794 2206 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 615694 2107 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 640011 2202 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 633723 2210 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 615567 2071 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 636790 2133 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 596880 2095 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 521450 2152 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 106014 12437 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 107220 11444 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 110198 12084 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 108632 11878 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 113619 11452 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 103714 11544 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 109160 11999 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 107444 11783 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 110697 11577 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/Measure-8 100470 11327 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 67630 18081 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 74475 18281 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 73075 17521 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75033 17910 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 72811 17152 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75253 17294 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 71371 17835 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 74364 17779 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75793 17424 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 77242 17452 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12044708 101.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12695270 103.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12472215 117.4 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12332293 98.09 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12231560 106.7 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13039504 106.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12992034 99.06 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12204920 97.84 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 10985733 98.50 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12620592 99.26 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2650395 448.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2801888 409.5 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2800879 409.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2982458 452.3 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2807269 473.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2936845 417.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2744233 456.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2871415 422.0 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2710190 419.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2789616 424.5 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 855709 1198 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1206 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1213 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1156 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1212 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1233 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1152 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1231 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 952506 1259 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 586099 2163 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 635233 2134 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 650406 2101 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 635630 2151 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 649213 2202 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 605356 2121 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 584236 2086 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 630939 2194 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 639346 2154 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 617145 2096 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 99892 11989 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109909 11623 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 110326 11374 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 101619 12306 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 97573 11394 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109374 12459 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 108112 11316 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109008 12294 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 114326 11830 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 111889 11242 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 65185 17100 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76615 18320 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76699 18363 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 75769 17187 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76983 17594 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 74116 17828 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 71347 17646 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 73558 17289 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 79120 17675 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 72420 17480 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12203563 108.7 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12928636 99.99 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 11935758 103.0 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12733026 108.8 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12975754 100.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12688108 99.30 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 11445204 99.11 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12690217 98.50 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12130473 99.50 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12727153 106.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1481895 804.1 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1418360 820.6 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1469851 830.7 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1372838 817.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1473903 812.5 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1464301 800.0 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1464412 808.2 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1315578 844.9 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1545694 896.7 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1477633 810.8 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 938478 1284 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 867409 1162 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1196 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 997111 1148 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1158 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1172 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1188 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1142 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1252 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1185 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 265386 5196 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 270930 5238 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 250849 5025 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 275574 5360 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 258640 4940 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 261912 4932 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 256972 5144 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 237580 4939 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 269960 5129 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 270619 5074 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109788 12537 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 96858 11769 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 111024 11478 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109216 11653 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109728 12223 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 111604 11215 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110402 11186 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109782 11583 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110266 11518 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 102924 11361 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24588 48021 ns/op 17835 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24475 47760 ns/op 17833 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24408 47402 ns/op 17829 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25519 49174 ns/op 17833 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25016 48972 ns/op 17831 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25372 47715 ns/op 17834 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25330 47517 ns/op 17833 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24987 48731 ns/op 17832 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25210 48968 ns/op 17835 B/op 11 allocs/op +BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25381 48751 ns/op 17833 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12139208 101.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12006981 101.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12429097 108.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12896118 108.8 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12207513 106.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11504076 109.6 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11115306 103.0 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11586703 103.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11529789 99.02 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12136512 103.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2738594 457.2 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2552132 456.8 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2719819 432.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2934489 474.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2866374 474.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2856028 439.7 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2836177 444.1 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2941646 471.6 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2960328 445.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2935668 421.4 ns/op 128 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1284 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1289 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1229 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 998823 1277 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1271 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 873640 1166 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1155 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1150 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1189 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 592096 2117 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 633663 2099 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 520358 2197 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 652964 2227 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 647844 2156 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 618900 2176 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 621746 2204 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 612691 2116 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 640472 2153 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 602290 2171 ns/op 1056 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 103718 11839 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 105822 12696 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 95018 11518 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 104266 11562 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102006 11614 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 108907 11767 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 100404 11276 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 104193 11842 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102886 11723 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102980 11387 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 71738 17751 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 70867 17629 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 73340 17439 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 71540 18330 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 74822 17790 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 74070 17434 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 68047 17990 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 75068 18216 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 77110 18101 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 70659 17908 ns/op 9760 B/op 2 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11324088 110.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12072033 104.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11522050 104.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12858453 99.34 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12012278 100.1 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11945469 107.5 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11716684 103.9 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11375492 103.8 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13037928 103.3 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11579456 98.73 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1445625 802.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1307059 819.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1300875 870.8 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1407885 805.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1419325 838.7 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1362357 879.5 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1355449 805.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1334148 902.3 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1452020 881.4 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1600748 868.2 ns/op 384 B/op 4 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 981523 1203 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1179 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1181 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1174 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1163 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1028017 1178 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1175 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 867897 1267 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1254 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 951024 1149 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 231246 4972 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 269583 4982 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 276840 5103 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 264648 5176 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 267468 5138 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 281400 4950 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 276787 4984 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 263457 5090 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 260110 5151 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 270080 5163 ns/op 1732 B/op 5 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106506 12718 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106209 11611 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 107492 12524 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 112300 12123 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 110745 11931 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 111355 11645 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 109742 12077 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 98926 11925 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 111117 12451 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106148 11396 ns/op 0 B/op 0 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 24028 50337 ns/op 17835 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25474 47170 ns/op 17831 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26391 48678 ns/op 17831 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26454 46843 ns/op 17834 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25750 48428 ns/op 17833 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25200 48526 ns/op 17834 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26354 48487 ns/op 17836 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25105 51246 ns/op 17831 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26138 47990 ns/op 17834 B/op 11 allocs/op +BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 24668 49563 ns/op 17834 B/op 11 allocs/op +PASS +ok go.opentelemetry.io/otel/sdk/metric/internal/aggregate 1323.595s diff --git a/sdk/metric/internal/aggregate/sum_test.go.bkup b/sdk/metric/internal/aggregate/sum_test.go.bkup new file mode 100644 index 00000000000..3ac675a096b --- /dev/null +++ b/sdk/metric/internal/aggregate/sum_test.go.bkup @@ -0,0 +1,439 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestSum(t *testing.T) { + t.Cleanup(mockTime(now)) + + t.Run("Int64/DeltaSum", testDeltaSum[int64]()) + t.Run("Float64/DeltaSum", testDeltaSum[float64]()) + + t.Run("Int64/CumulativeSum", testCumulativeSum[int64]()) + t.Run("Float64/CumulativeSum", testCumulativeSum[float64]()) + + t.Run("Int64/DeltaPrecomputedSum", testDeltaPrecomputedSum[int64]()) + t.Run("Float64/DeltaPrecomputedSum", testDeltaPrecomputedSum[float64]()) + + t.Run("Int64/CumulativePrecomputedSum", testCumulativePrecomputedSum[int64]()) + t.Run("Float64/CumulativePrecomputedSum", testCumulativePrecomputedSum[float64]()) +} + +func testDeltaSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + }.Sum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, alice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 10, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 3, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Delta sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) +} + +func testCumulativeSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + }.Sum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, alice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 14, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -8, + }, + }, + }, + }, + }, + }) +} + +func testDeltaPrecomputedSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + }.PrecomputedSum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, fltrAlice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, fltrAlice}, + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 7, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 14, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Precomputed sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) +} + +func testCumulativePrecomputedSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + }.PrecomputedSum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, fltrAlice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, fltrAlice}, + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 11, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 3, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Precomputed sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) +} + +func BenchmarkSum(b *testing.B) { + // The monotonic argument is only used to annotate the Sum returned from + // the Aggregation method. It should not have an effect on operational + // performance, therefore, only monotonic=false is benchmarked here. + b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.Sum(false) + })) + b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.Sum(false) + })) + b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.Sum(false) + })) + b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.Sum(false) + })) + + b.Run("Precomputed/Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.PrecomputedSum(false) + })) +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index ad52aedfe68..0d9a363a29b 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -361,14 +361,39 @@ func (i *inserter[N]) logConflict(id instID) { return } - global.Warn( - "duplicate metric stream definitions", + const msg = "duplicate metric stream definitions" + args := []interface{}{ "names", fmt.Sprintf("%q, %q", existing.Name, id.Name), "descriptions", fmt.Sprintf("%q, %q", existing.Description, id.Description), "kinds", fmt.Sprintf("%s, %s", existing.Kind, id.Kind), "units", fmt.Sprintf("%s, %s", existing.Unit, id.Unit), "numbers", fmt.Sprintf("%s, %s", existing.Number, id.Number), + } + + // The specification recommends logging a suggested view to resolve + // conflicts if possible. + // + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/sdk.md#duplicate-instrument-registration + if id.Unit != existing.Unit || id.Number != existing.Number { + // There is no view resolution for these, don't make a suggestion. + global.Warn(msg, args...) + return + } + + var stream string + if id.Name != existing.Name || id.Kind != existing.Kind { + stream = `Stream{Name: "{{NEW_NAME}}"}` + } else if id.Description != existing.Description { + stream = fmt.Sprintf("Stream{Description: %q}", existing.Description) + } + + inst := fmt.Sprintf( + "Instrument{Name: %q, Description: %q, Kind: %q, Unit: %q}", + id.Name, id.Description, "InstrumentKind"+id.Kind.String(), id.Unit, ) + args = append(args, "suggested.view", fmt.Sprintf("NewView(%s, %s)", inst, stream)) + + global.Warn(msg, args...) } func (i *inserter[N]) instID(kind InstrumentKind, stream Stream) instID { diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index fdeb4fe1f7b..32c1d0358c4 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -243,3 +243,118 @@ func TestLogConflictName(t *testing.T) { msg = "" } } + +func TestLogConflictSuggestView(t *testing.T) { + var msg string + t.Cleanup(func(orig logr.Logger) func() { + otel.SetLogger(funcr.New(func(_, args string) { + msg = args + }, funcr.Options{Verbosity: 20})) + return func() { otel.SetLogger(orig) } + }(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))) + + orig := instID{ + Name: "requestCount", + Description: "number of requests", + Kind: InstrumentKindCounter, + Unit: "1", + Number: "int64", + } + + var vc cache[string, instID] + name := strings.ToLower(orig.Name) + _ = vc.Lookup(name, func() instID { return orig }) + i := newInserter[int64](newPipeline(nil, nil, nil), &vc) + + viewSuggestion := func(inst instID, stream string) string { + return `"NewView(Instrument{` + + `Name: \"` + inst.Name + + `\", Description: \"` + inst.Description + + `\", Kind: \"InstrumentKind` + inst.Kind.String() + + `\", Unit: \"` + inst.Unit + + `\"}, ` + + stream + + `)"` + } + + t.Run("Name", func(t *testing.T) { + inst := instID{ + Name: "requestcount", + Description: orig.Description, + Kind: orig.Kind, + Unit: orig.Unit, + Number: orig.Number, + } + i.logConflict(inst) + assert.Containsf(t, msg, viewSuggestion( + inst, `Stream{Name: \"{{NEW_NAME}}\"}`, + ), "no suggestion logged: %v", inst) + + // Reset. + msg = "" + }) + + t.Run("Description", func(t *testing.T) { + inst := instID{ + Name: orig.Name, + Description: "alt", + Kind: orig.Kind, + Unit: orig.Unit, + Number: orig.Number, + } + i.logConflict(inst) + assert.Containsf(t, msg, viewSuggestion( + inst, `Stream{Description: \"`+orig.Description+`\"}`, + ), "no suggestion logged: %v", inst) + + // Reset. + msg = "" + }) + + t.Run("Kind", func(t *testing.T) { + inst := instID{ + Name: orig.Name, + Description: orig.Description, + Kind: InstrumentKindHistogram, + Unit: orig.Unit, + Number: orig.Number, + } + i.logConflict(inst) + assert.Containsf(t, msg, viewSuggestion( + inst, `Stream{Name: \"{{NEW_NAME}}\"}`, + ), "no suggestion logged: %v", inst) + + // Reset. + msg = "" + }) + + t.Run("Unit", func(t *testing.T) { + inst := instID{ + Name: orig.Name, + Description: orig.Description, + Kind: orig.Kind, + Unit: "ms", + Number: orig.Number, + } + i.logConflict(inst) + assert.NotContains(t, msg, "NewView", "suggestion logged: %v", inst) + + // Reset. + msg = "" + }) + + t.Run("Number", func(t *testing.T) { + inst := instID{ + Name: orig.Name, + Description: orig.Description, + Kind: orig.Kind, + Unit: orig.Unit, + Number: "float64", + } + i.logConflict(inst) + assert.NotContains(t, msg, "NewView", "suggestion logged: %v", inst) + + // Reset. + msg = "" + }) +} From e26d8bd8f893a7631af714091e58b1d686ed79a7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 24 Jul 2023 11:03:09 -0700 Subject: [PATCH 613/886] Remove benchmark dev files mistakenly added in #4349 (#4358) --- sdk/metric/internal/aggregate/new.txt | 486 ------------------ sdk/metric/internal/aggregate/old.txt | 486 ------------------ .../internal/aggregate/sum_test.go.bkup | 439 ---------------- 3 files changed, 1411 deletions(-) delete mode 100644 sdk/metric/internal/aggregate/new.txt delete mode 100644 sdk/metric/internal/aggregate/old.txt delete mode 100644 sdk/metric/internal/aggregate/sum_test.go.bkup diff --git a/sdk/metric/internal/aggregate/new.txt b/sdk/metric/internal/aggregate/new.txt deleted file mode 100644 index 9539627b09a..00000000000 --- a/sdk/metric/internal/aggregate/new.txt +++ /dev/null @@ -1,486 +0,0 @@ -goos: linux -goarch: amd64 -pkg: go.opentelemetry.io/otel/sdk/metric/internal/aggregate -cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz -BenchmarkSum/Int64/Cumulative/1/Measure-8 12832801 84.19 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13738166 84.33 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14909516 84.81 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14371771 84.26 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14037006 87.30 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14160303 84.69 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14000491 84.83 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14017932 86.88 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 14086557 85.51 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13918137 84.29 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5236875 198.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5373666 233.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5249028 203.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4997298 208.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5309054 206.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5225592 213.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 5210971 272.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4688874 241.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4455781 243.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4731162 245.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1199733 1043 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1011 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1216923 1028 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1066 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1058 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1198212 991.0 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1063 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1015 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1204028 1035 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1043 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3269596 347.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3237217 365.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3309460 342.9 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3181944 354.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3136028 357.8 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3345159 348.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3345584 351.1 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3097239 350.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3257766 373.1 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 3198373 354.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 116356 10723 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 111188 11146 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 109912 10565 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 112994 10761 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 122049 10268 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 121502 10341 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 119794 11044 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 117589 10230 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 123240 10678 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 122952 11023 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 559370 1974 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 591718 1987 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 596125 2061 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 601368 1987 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 602349 2152 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 557488 2047 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 600099 2087 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 592650 2036 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 566413 2146 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 576310 2127 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13567838 101.0 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12627882 96.37 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13880398 98.05 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13438856 91.80 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13551433 92.05 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12615459 98.22 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12291924 94.78 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13374356 92.66 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13105550 91.96 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 13308955 91.51 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3140188 393.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2963001 352.8 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3707602 408.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3196657 387.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3252639 396.0 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3148338 393.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3130227 395.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3203203 405.8 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3069350 406.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2998692 397.1 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1086 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1102 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1177 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1200 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1145 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1134 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1142 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1174 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1148 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 847432 1619 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 841924 1561 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 766815 1663 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 803617 1611 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 837134 1583 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 839544 1675 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 838986 1580 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 839352 1617 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 836071 1569 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 829735 1728 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 119364 10702 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 116712 11295 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 120844 11580 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 116643 10542 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 102613 10862 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 107965 10792 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 109129 11361 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 116842 10459 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 118702 11221 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 109262 11172 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 87906 13428 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 84370 13726 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83199 13387 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83788 14235 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 89572 14089 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90222 13411 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 83817 13824 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90033 14293 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 90631 13483 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 89948 13451 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 13048044 100.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 11987622 97.05 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12525115 100.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 13802107 94.21 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12701176 96.28 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 13829084 99.60 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 13854591 95.88 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12327361 99.59 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12124970 94.60 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 13713087 95.66 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4489012 260.0 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 6131644 235.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4632294 266.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4628036 250.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4807899 227.8 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4751396 266.9 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4661839 277.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4715024 265.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4595482 257.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4679578 267.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 987913 1165 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1093 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1095 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1153 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1139 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1085 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1099 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1152 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1159 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2905521 380.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3015876 376.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2984940 377.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2803021 379.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3029174 384.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3032427 376.1 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3127575 371.0 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 2893978 376.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3120540 393.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 3036336 373.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 113311 10637 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 101358 10624 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 119534 10586 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 120386 10504 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 112252 10711 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 117482 11275 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 106592 10528 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 113810 11263 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 114720 11215 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 114590 10463 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 509122 2274 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 575350 2251 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 519496 2260 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 557757 2195 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 560943 2226 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 536691 2229 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 534720 2230 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 572613 2222 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 537004 2255 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 560804 2219 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12123902 95.92 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12743845 94.11 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12899218 93.47 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12742275 93.21 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12949663 93.67 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 13187468 93.66 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 13722506 94.85 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12600060 95.15 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 13934244 98.40 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 13383878 94.83 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3353437 359.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3255859 410.8 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2982471 408.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3210732 382.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3182137 379.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3026965 390.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3081061 426.0 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3116241 406.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3114680 422.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2998998 426.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1104 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1043538 1140 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1151 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1108 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1107 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1078 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1122 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1097 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1073 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 823614 1612 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 827082 1627 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 802323 1591 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 813440 1643 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 806421 1597 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 827452 1604 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 663091 1570 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 829683 1643 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 792718 1584 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 815619 1605 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 116443 10993 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 108036 10998 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 120033 11305 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 115340 11346 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 118672 10674 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 116216 10694 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 111798 10779 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 109923 10593 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 114754 10681 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 114912 10909 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 88519 14457 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86623 14008 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86084 14138 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86601 13681 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 83034 14503 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 86284 13641 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 78396 13685 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 85956 13672 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 88202 14091 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 85731 13683 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12929575 99.68 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12970344 96.44 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12567553 94.42 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13391112 95.71 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12609759 95.80 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12320703 92.85 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12926551 95.39 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12309518 95.53 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13622700 98.77 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12700446 98.64 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2442945 479.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2445420 485.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2502744 490.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2522775 495.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2524832 509.9 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2545576 498.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2486281 498.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2405265 506.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2516514 514.6 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2503906 495.2 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1087 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1103 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1156 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1098 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1100 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1073 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1063 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1072 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1075 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 472300 2712 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 490501 2734 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491756 2728 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 485811 2749 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491367 2759 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 487554 2770 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 491612 2706 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 487945 2723 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 429498 2658 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 488772 2837 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 112986 10563 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 113221 10624 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 110900 10806 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 118372 10695 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 118755 11367 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116772 11173 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 121702 11167 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116296 10388 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 116600 10970 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 111428 10504 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 48642 24719 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49490 25686 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49890 25524 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49735 25526 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46292 24561 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49718 25686 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 48542 24065 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46929 24133 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 49874 24255 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 46832 24831 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13248100 97.78 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12405955 100.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12678439 96.10 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13830669 95.34 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13798387 95.20 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12309202 93.12 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13552324 93.64 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 13670754 92.60 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12825702 95.77 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12655892 94.10 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1521536 721.2 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1598995 720.0 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1617141 754.0 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1607065 768.6 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1562186 742.6 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1613356 777.7 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1639628 771.1 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1555226 731.8 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1658127 715.9 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1614914 757.9 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 988795 1073 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1117 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1107 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1086 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1082 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1083 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1140 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1131 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 293400 4540 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 301167 4414 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297818 4459 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297556 4424 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 282568 4622 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 302499 4486 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 299958 4524 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 299124 4472 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 293887 4492 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 297294 4715 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110485 11164 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 117867 11288 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 106924 10537 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 118573 10583 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 118592 10620 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 115219 10778 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109425 11335 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 121026 11256 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 108481 10511 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 116545 10521 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27654 42813 ns/op 8136 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28246 44570 ns/op 8136 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28418 45490 ns/op 8135 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28266 44224 ns/op 8138 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27304 43016 ns/op 8138 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28228 43445 ns/op 8137 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27792 44841 ns/op 8133 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 27578 42586 ns/op 8138 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 26276 44125 ns/op 8139 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 28119 44032 ns/op 8136 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13618124 94.36 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12826450 96.65 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13422610 99.26 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13131544 93.85 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12920649 94.14 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13475362 94.47 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13235325 94.00 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13127564 96.69 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12410412 95.26 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 13232055 95.24 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2700405 486.1 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2349177 504.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2474370 495.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2493882 523.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2497772 496.7 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2456824 526.5 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2420324 495.0 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2491203 532.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2505288 514.3 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2475458 480.4 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 962577 1049 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1051 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1096 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1121991 1129 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1095 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1097 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1077 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1080 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1056 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 444800 2785 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 492310 2822 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 485503 2756 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 474487 2751 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 491212 2816 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 482865 2835 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 452144 2846 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 488284 2760 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 490476 2729 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 474738 2754 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 120754 10610 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118480 10584 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 113307 11254 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118498 11315 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 119580 10667 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 117463 10575 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 118851 10699 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 112174 10852 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 109742 10718 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 112036 11161 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49584 25136 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49569 24420 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49729 24166 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 46579 25681 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 48506 24368 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 47953 24111 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49260 25882 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 44846 25201 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49846 25080 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 49388 24732 ns/op 64 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13381588 94.70 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13026745 99.29 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13712457 94.52 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13100166 94.25 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13191348 93.32 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13322320 95.68 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13942035 95.90 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13685756 94.36 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13041921 94.12 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12858501 93.18 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1604078 733.0 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1547712 730.2 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1550877 729.7 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1649734 749.0 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1659384 754.9 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1655444 735.9 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1645508 786.8 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1578471 764.5 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1651297 740.9 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1543788 784.0 ns/op 320 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1088 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1078 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1079 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1072 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1105 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1128 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 994906 1119 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1041 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1060 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1123647 1073 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 266772 4557 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 288816 4659 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 240044 4577 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 302907 4622 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 304759 4573 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 296655 4547 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 292946 4578 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 306622 4725 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 301369 4477 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 263808 4650 ns/op 740 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115377 11395 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 120253 11330 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 119737 10735 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 118880 10720 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115844 10651 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 117028 10553 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 115076 10766 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 118269 11016 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 110619 10935 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 119504 10941 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28315 44824 ns/op 8138 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28339 42944 ns/op 8140 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26726 43716 ns/op 8135 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28408 45537 ns/op 8136 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 27817 44962 ns/op 8138 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28106 43484 ns/op 8139 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28996 43488 ns/op 8135 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 29072 45200 ns/op 8136 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28354 43150 ns/op 8137 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 28444 45076 ns/op 8137 B/op 11 allocs/op -PASS -ok go.opentelemetry.io/otel/sdk/metric/internal/aggregate 1519.546s diff --git a/sdk/metric/internal/aggregate/old.txt b/sdk/metric/internal/aggregate/old.txt deleted file mode 100644 index 76316eb3359..00000000000 --- a/sdk/metric/internal/aggregate/old.txt +++ /dev/null @@ -1,486 +0,0 @@ -goos: linux -goarch: amd64 -pkg: go.opentelemetry.io/otel/sdk/metric/internal/aggregate -cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz -BenchmarkSum/Int64/Cumulative/1/Measure-8 12132796 93.97 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 12833452 98.52 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13292923 97.89 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 12242515 92.63 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 12898480 92.66 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 12946058 101.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13837212 93.17 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13387345 101.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13520461 96.91 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/Measure-8 13553054 101.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4352331 266.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4209757 285.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4626202 259.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4487704 254.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4352427 260.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4386769 279.9 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4363788 292.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4401888 255.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4217253 274.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/1/ComputeAggregation-8 4400745 274.5 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1253 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1245 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1127 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1145 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1128 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1126 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1164 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1177 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 979124 1217 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1298989 894.0 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1373443 849.0 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1356570 901.1 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1356979 890.5 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1333526 911.2 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1395523 923.8 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1403545 892.4 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1310388 868.4 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1369364 888.6 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/10/ComputeAggregation-8 1345185 916.0 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 94935 12383 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 107889 11759 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 111279 11960 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 112885 12519 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 107937 11202 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 110437 11870 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 100900 12567 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 111282 11760 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 113372 11739 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/Measure-8 114145 12336 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 245482 5285 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 271778 4906 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 260509 5743 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 267429 4674 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 302884 4892 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 268592 4879 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 266072 4822 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 270511 4864 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 274407 4815 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Cumulative/100/ComputeAggregation-8 271594 4929 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 11385399 101.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12100845 107.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12826288 98.62 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12628515 100.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 11870608 108.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12326151 99.07 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12655506 101.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 10499667 103.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12974182 97.65 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/Measure-8 12771733 99.15 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2884323 428.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2979914 441.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2989824 466.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2992849 445.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 3000021 440.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2961950 472.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2979852 435.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2999700 439.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2830801 419.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/1/ComputeAggregation-8 2793336 437.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1164 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1179 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1148 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1149 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 915872 1243 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 927121 1148 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1165 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1233 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/Measure-8 1000000 1118 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 599412 2121 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 654458 2183 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 650170 2074 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 652510 2133 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 651919 2049 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 594951 2136 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 610920 2032 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 644576 2192 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 613749 2111 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/10/ComputeAggregation-8 620232 2128 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 104808 11285 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 104690 12494 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 112671 12503 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 112759 11156 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 101668 11244 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 108952 11321 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 105589 12447 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 99166 11547 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 101821 11564 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/Measure-8 113941 11583 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 71049 17286 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 78675 17062 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73201 17110 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 74734 17271 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 70824 17682 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73806 18246 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 76288 17917 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 73734 17663 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 71109 18042 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Int64/Delta/100/ComputeAggregation-8 76170 17803 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12238096 113.0 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12818384 109.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12864472 99.78 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 11823811 103.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 11600403 99.13 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12240856 100.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12507694 100.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 11993076 99.78 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 12453760 100.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/Measure-8 11975506 108.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4181683 292.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4493882 250.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4455595 270.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4379696 244.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4286300 271.3 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4433268 240.3 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4278093 264.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4840934 241.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 4353639 262.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/1/ComputeAggregation-8 3996886 259.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 943964 1235 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1014638 1180 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 885234 1265 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 932336 1207 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1173 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1275 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1271 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 1000000 1220 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/Measure-8 995424 1170 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1319526 876.5 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1310713 878.1 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1322535 903.1 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1340648 937.2 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1326606 881.4 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1320040 936.7 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1352618 911.7 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1290936 894.3 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1300735 916.0 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/10/ComputeAggregation-8 1000000 1033 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 91390 13717 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 92311 11566 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 101764 12257 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 110319 12129 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 98139 11888 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 107817 11988 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 108433 12594 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 104708 11713 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 107071 11839 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/Measure-8 106276 12501 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 202286 5498 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 274892 5137 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 253311 5372 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 297381 4873 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 275394 5185 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277260 4922 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 272193 4987 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277756 4980 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 267218 5189 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Cumulative/100/ComputeAggregation-8 277479 5222 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 11135397 100.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12037850 103.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12822570 103.2 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12846072 107.7 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12350216 98.40 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12719412 99.27 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12680097 99.29 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12092605 98.53 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12589422 108.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/Measure-8 12316093 98.96 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2719732 430.3 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2927137 457.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3019056 472.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2966490 436.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2957634 437.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 3018825 440.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2900271 452.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2904802 459.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2958345 480.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/1/ComputeAggregation-8 2920442 450.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 960747 1179 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1220 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1203 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1144 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1147 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1195 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1149 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/Measure-8 1000000 1186 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 589666 2126 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 629466 2087 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 641794 2206 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 615694 2107 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 640011 2202 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 633723 2210 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 615567 2071 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 636790 2133 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 596880 2095 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/10/ComputeAggregation-8 521450 2152 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 106014 12437 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 107220 11444 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 110198 12084 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 108632 11878 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 113619 11452 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 103714 11544 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 109160 11999 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 107444 11783 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 110697 11577 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/Measure-8 100470 11327 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 67630 18081 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 74475 18281 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 73075 17521 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75033 17910 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 72811 17152 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75253 17294 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 71371 17835 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 74364 17779 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 75793 17424 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Float64/Delta/100/ComputeAggregation-8 77242 17452 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12044708 101.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12695270 103.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12472215 117.4 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12332293 98.09 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12231560 106.7 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 13039504 106.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12992034 99.06 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12204920 97.84 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 10985733 98.50 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/Measure-8 12620592 99.26 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2650395 448.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2801888 409.5 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2800879 409.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2982458 452.3 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2807269 473.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2936845 417.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2744233 456.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2871415 422.0 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2710190 419.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/1/ComputeAggregation-8 2789616 424.5 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 855709 1198 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1191 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1206 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1213 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1156 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1212 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1233 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1152 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 1000000 1231 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/Measure-8 952506 1259 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 586099 2163 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 635233 2134 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 650406 2101 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 635630 2151 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 649213 2202 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 605356 2121 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 584236 2086 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 630939 2194 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 639346 2154 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/10/ComputeAggregation-8 617145 2096 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 99892 11989 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109909 11623 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 110326 11374 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 101619 12306 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 97573 11394 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109374 12459 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 108112 11316 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 109008 12294 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 114326 11830 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/Measure-8 111889 11242 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 65185 17100 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76615 18320 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76699 18363 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 75769 17187 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 76983 17594 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 74116 17828 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 71347 17646 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 73558 17289 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 79120 17675 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Cumulative/100/ComputeAggregation-8 72420 17480 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12203563 108.7 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12928636 99.99 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 11935758 103.0 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12733026 108.8 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12975754 100.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12688108 99.30 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 11445204 99.11 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12690217 98.50 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12130473 99.50 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/Measure-8 12727153 106.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1481895 804.1 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1418360 820.6 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1469851 830.7 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1372838 817.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1473903 812.5 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1464301 800.0 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1464412 808.2 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1315578 844.9 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1545694 896.7 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/1/ComputeAggregation-8 1477633 810.8 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 938478 1284 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 867409 1162 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1196 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 997111 1148 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1158 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1172 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1188 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1142 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1252 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/Measure-8 1000000 1185 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 265386 5196 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 270930 5238 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 250849 5025 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 275574 5360 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 258640 4940 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 261912 4932 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 256972 5144 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 237580 4939 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 269960 5129 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/10/ComputeAggregation-8 270619 5074 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109788 12537 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 96858 11769 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 111024 11478 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109216 11653 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109728 12223 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 111604 11215 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110402 11186 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 109782 11583 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 110266 11518 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/Measure-8 102924 11361 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24588 48021 ns/op 17835 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24475 47760 ns/op 17833 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24408 47402 ns/op 17829 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25519 49174 ns/op 17833 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25016 48972 ns/op 17831 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25372 47715 ns/op 17834 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25330 47517 ns/op 17833 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 24987 48731 ns/op 17832 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25210 48968 ns/op 17835 B/op 11 allocs/op -BenchmarkSum/Precomputed/Int64/Delta/100/ComputeAggregation-8 25381 48751 ns/op 17833 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12139208 101.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12006981 101.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12429097 108.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12896118 108.8 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12207513 106.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11504076 109.6 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11115306 103.0 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11586703 103.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 11529789 99.02 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/Measure-8 12136512 103.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2738594 457.2 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2552132 456.8 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2719819 432.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2934489 474.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2866374 474.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2856028 439.7 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2836177 444.1 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2941646 471.6 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2960328 445.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/1/ComputeAggregation-8 2935668 421.4 ns/op 128 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1284 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1289 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1229 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 998823 1277 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1271 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 873640 1166 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1155 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1169 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1150 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/Measure-8 1000000 1189 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 592096 2117 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 633663 2099 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 520358 2197 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 652964 2227 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 647844 2156 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 618900 2176 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 621746 2204 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 612691 2116 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 640472 2153 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/10/ComputeAggregation-8 602290 2171 ns/op 1056 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 103718 11839 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 105822 12696 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 95018 11518 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 104266 11562 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102006 11614 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 108907 11767 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 100404 11276 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 104193 11842 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102886 11723 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/Measure-8 102980 11387 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 71738 17751 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 70867 17629 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 73340 17439 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 71540 18330 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 74822 17790 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 74070 17434 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 68047 17990 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 75068 18216 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 77110 18101 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Cumulative/100/ComputeAggregation-8 70659 17908 ns/op 9760 B/op 2 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11324088 110.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12072033 104.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11522050 104.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12858453 99.34 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 12012278 100.1 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11945469 107.5 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11716684 103.9 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11375492 103.8 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 13037928 103.3 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/Measure-8 11579456 98.73 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1445625 802.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1307059 819.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1300875 870.8 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1407885 805.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1419325 838.7 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1362357 879.5 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1355449 805.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1334148 902.3 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1452020 881.4 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/1/ComputeAggregation-8 1600748 868.2 ns/op 384 B/op 4 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 981523 1203 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1179 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1181 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1174 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1163 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1028017 1178 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1175 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 867897 1267 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 1000000 1254 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/Measure-8 951024 1149 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 231246 4972 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 269583 4982 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 276840 5103 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 264648 5176 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 267468 5138 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 281400 4950 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 276787 4984 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 263457 5090 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 260110 5151 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/10/ComputeAggregation-8 270080 5163 ns/op 1732 B/op 5 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106506 12718 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106209 11611 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 107492 12524 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 112300 12123 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 110745 11931 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 111355 11645 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 109742 12077 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 98926 11925 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 111117 12451 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/Measure-8 106148 11396 ns/op 0 B/op 0 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 24028 50337 ns/op 17835 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25474 47170 ns/op 17831 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26391 48678 ns/op 17831 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26454 46843 ns/op 17834 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25750 48428 ns/op 17833 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25200 48526 ns/op 17834 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26354 48487 ns/op 17836 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 25105 51246 ns/op 17831 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 26138 47990 ns/op 17834 B/op 11 allocs/op -BenchmarkSum/Precomputed/Float64/Delta/100/ComputeAggregation-8 24668 49563 ns/op 17834 B/op 11 allocs/op -PASS -ok go.opentelemetry.io/otel/sdk/metric/internal/aggregate 1323.595s diff --git a/sdk/metric/internal/aggregate/sum_test.go.bkup b/sdk/metric/internal/aggregate/sum_test.go.bkup deleted file mode 100644 index 3ac675a096b..00000000000 --- a/sdk/metric/internal/aggregate/sum_test.go.bkup +++ /dev/null @@ -1,439 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - -import ( - "context" - "testing" - - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -func TestSum(t *testing.T) { - t.Cleanup(mockTime(now)) - - t.Run("Int64/DeltaSum", testDeltaSum[int64]()) - t.Run("Float64/DeltaSum", testDeltaSum[float64]()) - - t.Run("Int64/CumulativeSum", testCumulativeSum[int64]()) - t.Run("Float64/CumulativeSum", testCumulativeSum[float64]()) - - t.Run("Int64/DeltaPrecomputedSum", testDeltaPrecomputedSum[int64]()) - t.Run("Float64/DeltaPrecomputedSum", testDeltaPrecomputedSum[float64]()) - - t.Run("Int64/CumulativePrecomputedSum", testCumulativePrecomputedSum[int64]()) - t.Run("Float64/CumulativePrecomputedSum", testCumulativePrecomputedSum[float64]()) -} - -func testDeltaSum[N int64 | float64]() func(t *testing.T) { - mono := false - in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, - }.Sum(mono) - ctx := context.Background() - return test[N](in, out, []teststep[N]{ - { - input: []arg[N]{}, - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, alice}, - {ctx, -1, bob}, - {ctx, 1, alice}, - {ctx, 2, alice}, - {ctx, -10, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 4, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: -11, - }, - }, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 10, alice}, - {ctx, 3, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 10, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: 3, - }, - }, - }, - }, - }, - { - input: []arg[N]{}, - // Delta sums are expected to reset. - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - }) -} - -func testCumulativeSum[N int64 | float64]() func(t *testing.T) { - mono := false - in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, - }.Sum(mono) - ctx := context.Background() - return test[N](in, out, []teststep[N]{ - { - input: []arg[N]{}, - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, alice}, - {ctx, -1, bob}, - {ctx, 1, alice}, - {ctx, 2, alice}, - {ctx, -10, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 4, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: -11, - }, - }, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 10, alice}, - {ctx, 3, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 14, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: -8, - }, - }, - }, - }, - }, - }) -} - -func testDeltaPrecomputedSum[N int64 | float64]() func(t *testing.T) { - mono := false - in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, - }.PrecomputedSum(mono) - ctx := context.Background() - return test[N](in, out, []teststep[N]{ - { - input: []arg[N]{}, - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, alice}, - {ctx, -1, bob}, - {ctx, 1, fltrAlice}, - {ctx, 2, alice}, - {ctx, -10, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 4, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: -11, - }, - }, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, fltrAlice}, - {ctx, 10, alice}, - {ctx, 3, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 7, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: 14, - }, - }, - }, - }, - }, - { - input: []arg[N]{}, - // Precomputed sums are expected to reset. - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - }) -} - -func testCumulativePrecomputedSum[N int64 | float64]() func(t *testing.T) { - mono := false - in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, - }.PrecomputedSum(mono) - ctx := context.Background() - return test[N](in, out, []teststep[N]{ - { - input: []arg[N]{}, - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, alice}, - {ctx, -1, bob}, - {ctx, 1, fltrAlice}, - {ctx, 2, alice}, - {ctx, -10, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 4, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: -11, - }, - }, - }, - }, - }, - { - input: []arg[N]{ - {ctx, 1, fltrAlice}, - {ctx, 10, alice}, - {ctx, 3, bob}, - }, - expect: output{ - n: 2, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{ - { - Attributes: fltrAlice, - StartTime: staticTime, - Time: staticTime, - Value: 11, - }, - { - Attributes: fltrBob, - StartTime: staticTime, - Time: staticTime, - Value: 3, - }, - }, - }, - }, - }, - { - input: []arg[N]{}, - // Precomputed sums are expected to reset. - expect: output{ - n: 0, - agg: metricdata.Sum[N]{ - IsMonotonic: mono, - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[N]{}, - }, - }, - }, - }) -} - -func BenchmarkSum(b *testing.B) { - // The monotonic argument is only used to annotate the Sum returned from - // the Aggregation method. It should not have an effect on operational - // performance, therefore, only monotonic=false is benchmarked here. - b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { - return Builder[int64]{ - Temporality: metricdata.CumulativeTemporality, - }.Sum(false) - })) - b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { - return Builder[int64]{ - Temporality: metricdata.DeltaTemporality, - }.Sum(false) - })) - b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { - return Builder[float64]{ - Temporality: metricdata.CumulativeTemporality, - }.Sum(false) - })) - b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { - return Builder[float64]{ - Temporality: metricdata.DeltaTemporality, - }.Sum(false) - })) - - b.Run("Precomputed/Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { - return Builder[int64]{ - Temporality: metricdata.CumulativeTemporality, - }.PrecomputedSum(false) - })) - b.Run("Precomputed/Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { - return Builder[int64]{ - Temporality: metricdata.DeltaTemporality, - }.PrecomputedSum(false) - })) - b.Run("Precomputed/Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { - return Builder[float64]{ - Temporality: metricdata.CumulativeTemporality, - }.PrecomputedSum(false) - })) - b.Run("Precomputed/Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { - return Builder[float64]{ - Temporality: metricdata.DeltaTemporality, - }.PrecomputedSum(false) - })) -} From 088ac8e179bd30ee39c81278010f8d3b45ba45be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 25 Jul 2023 10:13:45 +0200 Subject: [PATCH 614/886] Fix panic, deadlock and race in BatchSpanProcessor (#4353) --- CHANGELOG.md | 1 + sdk/trace/batch_span_processor.go | 63 ++++++++++---------------- sdk/trace/batch_span_processor_test.go | 43 ++++++++++++++++++ 3 files changed, 67 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3516e388dcb..82c4288d7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) - Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) +- Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 43d5b042303..5922048fe62 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -16,7 +16,6 @@ package trace // import "go.opentelemetry.io/otel/sdk/trace" import ( "context" - "runtime" "sync" "sync/atomic" "time" @@ -84,6 +83,7 @@ type batchSpanProcessor struct { stopWait sync.WaitGroup stopOnce sync.Once stopCh chan struct{} + stopped atomic.Bool } var _ SpanProcessor = (*batchSpanProcessor)(nil) @@ -137,6 +137,11 @@ func (bsp *batchSpanProcessor) OnStart(parent context.Context, s ReadWriteSpan) // OnEnd method enqueues a ReadOnlySpan for later processing. func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) { + // Do not enqueue spans after Shutdown. + if bsp.stopped.Load() { + return + } + // Do not enqueue spans if we are just going to drop them. if bsp.e == nil { return @@ -149,6 +154,7 @@ func (bsp *batchSpanProcessor) OnEnd(s ReadOnlySpan) { func (bsp *batchSpanProcessor) Shutdown(ctx context.Context) error { var err error bsp.stopOnce.Do(func() { + bsp.stopped.Store(true) wait := make(chan struct{}) go func() { close(bsp.stopCh) @@ -181,11 +187,19 @@ func (f forceFlushSpan) SpanContext() trace.SpanContext { // ForceFlush exports all ended spans that have not yet been exported. func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { + // Do nothing after Shutdown. + if bsp.stopped.Load() { + return nil + } + var err error if bsp.e != nil { flushCh := make(chan struct{}) if bsp.enqueueBlockOnQueueFull(ctx, forceFlushSpan{flushed: flushCh}) { select { + case <-bsp.stopCh: + // The batchSpanProcessor is Shutdown. + return nil case <-flushCh: // Processed any items in queue prior to ForceFlush being called case <-ctx.Done(): @@ -326,11 +340,9 @@ func (bsp *batchSpanProcessor) drainQueue() { for { select { case sd := <-bsp.queue: - if sd == nil { - if err := bsp.exportSpans(ctx); err != nil { - otel.Handle(err) - } - return + if _, ok := sd.(forceFlushSpan); ok { + // Ignore flush requests as they are not valid spans. + continue } bsp.batchMutex.Lock() @@ -344,7 +356,11 @@ func (bsp *batchSpanProcessor) drainQueue() { } } default: - close(bsp.queue) + // There are no more enqueued spans. Make final export. + if err := bsp.exportSpans(ctx); err != nil { + otel.Handle(err) + } + return } } } @@ -358,34 +374,11 @@ func (bsp *batchSpanProcessor) enqueue(sd ReadOnlySpan) { } } -func recoverSendOnClosedChan() { - x := recover() - switch err := x.(type) { - case nil: - return - case runtime.Error: - if err.Error() == "send on closed channel" { - return - } - } - panic(x) -} - func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } - // This ensures the bsp.queue<- below does not panic as the - // processor shuts down. - defer recoverSendOnClosedChan() - - select { - case <-bsp.stopCh: - return false - default: - } - select { case bsp.queue <- sd: return true @@ -399,16 +392,6 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) return false } - // This ensures the bsp.queue<- below does not panic as the - // processor shuts down. - defer recoverSendOnClosedChan() - - select { - case <-bsp.stopCh: - return false - default: - } - select { case bsp.queue <- sd: return true diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index a033b6a0082..a7430335fbc 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -594,6 +594,49 @@ func TestBatchSpanProcessorForceFlushQueuedSpans(t *testing.T) { } } +func TestBatchSpanProcessorConcurrentSafe(t *testing.T) { + ctx := context.Background() + var bp testBatchExporter + bsp := sdktrace.NewBatchSpanProcessor(&bp) + tp := basicTracerProvider(t) + tp.RegisterSpanProcessor(bsp) + tr := tp.Tracer(t.Name()) + + var wg sync.WaitGroup + + wg.Add(1) + go func() { + defer wg.Done() + generateSpan(t, tr, testOption{genNumSpans: 1}) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = bsp.ForceFlush(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = bsp.Shutdown(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = tp.ForceFlush(ctx) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = tp.Shutdown(ctx) + }() + + wg.Wait() +} + func BenchmarkSpanProcessor(b *testing.B) { tp := sdktrace.NewTracerProvider( sdktrace.WithBatcher( From d8d3502efc4b989c003c0c5c3a7c050a3de346ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 25 Jul 2023 10:54:08 +0200 Subject: [PATCH 615/886] sdk/metric: Fix goroutine leaks in tests (#4352) --- sdk/metric/cache_test.go | 14 +++++--------- sdk/metric/provider_test.go | 12 ++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/sdk/metric/cache_test.go b/sdk/metric/cache_test.go index d70b3b9e2cb..01ce2389d9e 100644 --- a/sdk/metric/cache_test.go +++ b/sdk/metric/cache_test.go @@ -44,7 +44,6 @@ func TestCacheConcurrentSafe(t *testing.T) { const ( key = "k" goroutines = 10 - timeoutSec = 5 ) c := cache[string, int]{} @@ -65,12 +64,9 @@ func TestCacheConcurrentSafe(t *testing.T) { close(done) }() - assert.Eventually(t, func() bool { - select { - case <-done: - return true - default: - return false - } - }, timeoutSec*time.Second, 10*time.Millisecond) + select { + case <-done: + case <-time.After(5 * time.Second): + assert.Fail(t, "timeout") + } } diff --git a/sdk/metric/provider_test.go b/sdk/metric/provider_test.go index 774e026ad87..ba0b1ac769f 100644 --- a/sdk/metric/provider_test.go +++ b/sdk/metric/provider_test.go @@ -35,42 +35,54 @@ func TestMeterConcurrentSafe(t *testing.T) { const name = "TestMeterConcurrentSafe meter" mp := NewMeterProvider() + done := make(chan struct{}) go func() { + defer close(done) _ = mp.Meter(name) }() _ = mp.Meter(name) + <-done } func TestForceFlushConcurrentSafe(t *testing.T) { mp := NewMeterProvider() + done := make(chan struct{}) go func() { + defer close(done) _ = mp.ForceFlush(context.Background()) }() _ = mp.ForceFlush(context.Background()) + <-done } func TestShutdownConcurrentSafe(t *testing.T) { mp := NewMeterProvider() + done := make(chan struct{}) go func() { + defer close(done) _ = mp.Shutdown(context.Background()) }() _ = mp.Shutdown(context.Background()) + <-done } func TestMeterAndShutdownConcurrentSafe(t *testing.T) { const name = "TestMeterAndShutdownConcurrentSafe meter" mp := NewMeterProvider() + done := make(chan struct{}) go func() { + defer close(done) _ = mp.Shutdown(context.Background()) }() _ = mp.Meter(name) + <-done } func TestMeterDoesNotPanicForEmptyMeterProvider(t *testing.T) { From c1a644a10c1a8a4aad18370255623b253700ac73 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 25 Jul 2023 05:00:16 -0400 Subject: [PATCH 616/886] PeriodicReader.Shutdown now applies the periodic reader's timeout by default (#4356) --- CHANGELOG.md | 1 + sdk/metric/periodic_reader.go | 5 +++- sdk/metric/periodic_reader_test.go | 40 ++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c4288d7f8..7ffccf17b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - If an attribute set is Observed multiple times in an async callback, the values will be summed instead of the last observation winning. (#4289) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) +- `PeriodicReader.Shutdown` in `go.opentelemetry.io/otel/sdk/metric` now applies the periodic reader's timeout by default. (#4356) ### Fixed diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 3ea2c2f0fb2..48bbdffd82f 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -67,7 +67,8 @@ func (o periodicReaderOptionFunc) applyPeriodic(conf periodicReaderConfig) perio } // WithTimeout configures the time a PeriodicReader waits for an export to -// complete before canceling it. +// complete before canceling it. This includes an export which occurs as part +// of Shutdown. // // This option overrides any value set for the // OTEL_METRIC_EXPORT_TIMEOUT environment variable. @@ -323,6 +324,8 @@ func (r *PeriodicReader) ForceFlush(ctx context.Context) error { func (r *PeriodicReader) Shutdown(ctx context.Context) error { err := ErrReaderShutdown r.shutdownOnce.Do(func() { + ctx, cancel := context.WithTimeout(ctx, r.timeout) + defer cancel() // Stop the run loop. r.cancel() <-r.done diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index e5d8fd2ef30..ad8b5598756 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -337,6 +337,46 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { assert.Equal(t, assert.AnError, r.Shutdown(context.Background()), "export error not returned") assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") }) + + t.Run("Shutdown timeout on producer", func(t *testing.T) { + exp, called := expFunc(t) + timeout := time.Millisecond + r := NewPeriodicReader(exp, WithTimeout(timeout)) + r.register(testSDKProducer{ + produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { + select { + case <-time.After(timeout + time.Second): + *rm = testResourceMetricsA + case <-ctx.Done(): + // we timed out before we could collect metrics + return ctx.Err() + } + return nil + }}) + r.RegisterProducer(testExternalProducer{}) + assert.Equal(t, context.DeadlineExceeded, r.Shutdown(context.Background()), "timeout error not returned") + assert.False(t, *called, "exporter Export method called when it should have failed before export") + }) + + t.Run("Shutdown timeout on external producer", func(t *testing.T) { + exp, called := expFunc(t) + timeout := time.Millisecond + r := NewPeriodicReader(exp, WithTimeout(timeout)) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{ + produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { + select { + case <-time.After(timeout + time.Second): + case <-ctx.Done(): + // we timed out before we could collect metrics + return nil, ctx.Err() + } + return []metricdata.ScopeMetrics{testScopeMetricsA}, nil + }, + }) + assert.Equal(t, context.DeadlineExceeded, r.Shutdown(context.Background()), "timeout error not returned") + assert.False(t, *called, "exporter Export method called when it should have failed before export") + }) } func BenchmarkPeriodicReader(b *testing.B) { From d423bd4cf28f65bdcbd1b1d83d0f59c4388f37b0 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Tue, 25 Jul 2023 04:25:38 -0500 Subject: [PATCH 617/886] Add tests for malformed selectors in readers (#4350) --- CHANGELOG.md | 2 + sdk/metric/manual_reader.go | 3 + sdk/metric/meter_test.go | 146 ++++++++++++++++++++++++++++++++++++ sdk/metric/pipeline.go | 5 ++ sdk/metric/reader.go | 3 + 5 files changed, 159 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ffccf17b8d..ff05ad60c55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) - Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) - Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) +- The `ManualReader` will not panic if `AggregationSelector` returns `nil`. (#4350) +- If a Reader's AggregationSelector return nil or DefaultAggregation the pipeline will use the default aggregation. (#4350) - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 5677003550b..b8dcf1fccda 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -227,6 +227,9 @@ func WithAggregationSelector(selector AggregationSelector) ManualReaderOption { // Deep copy and validate before using. wrapped := func(ik InstrumentKind) aggregation.Aggregation { a := selector(ik) + if a == nil { + return nil + } cpA := a.Copy() if err := cpA.Err(); err != nil { cpA = DefaultAggregationSelector(ik) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index bfa1879120b..65f5acfa6c8 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -28,6 +28,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/aggregation" @@ -1811,3 +1812,148 @@ func BenchmarkInstrumentCreation(b *testing.B) { sfHistogram, _ = meter.Float64Histogram("sync.float64.histogram") } } + +func testNilAggregationSelector(InstrumentKind) aggregation.Aggregation { + return nil +} +func testDefaultAggregationSelector(InstrumentKind) aggregation.Aggregation { + return aggregation.Default{} +} +func testUndefinedTemporalitySelector(InstrumentKind) metricdata.Temporality { + return metricdata.Temporality(0) +} +func testInvalidTemporalitySelector(InstrumentKind) metricdata.Temporality { + return metricdata.Temporality(255) +} + +type noErrorHandler struct { + t *testing.T +} + +func (h noErrorHandler) Handle(err error) { + assert.NoError(h.t, err) +} + +func TestMalformedSelectors(t *testing.T) { + type testCase struct { + name string + reader Reader + } + testCases := []testCase{ + { + name: "nil aggregation selector", + reader: NewManualReader(WithAggregationSelector(testNilAggregationSelector)), + }, + { + name: "nil aggregation selector periodic", + reader: NewPeriodicReader(&fnExporter{aggregationFunc: testNilAggregationSelector}), + }, + { + name: "default aggregation selector", + reader: NewManualReader(WithAggregationSelector(testDefaultAggregationSelector)), + }, + { + name: "default aggregation selector periodic", + reader: NewPeriodicReader(&fnExporter{aggregationFunc: testDefaultAggregationSelector}), + }, + { + name: "undefined temporality selector", + reader: NewManualReader(WithTemporalitySelector(testUndefinedTemporalitySelector)), + }, + { + name: "undefined temporality selector periodic", + reader: NewPeriodicReader(&fnExporter{temporalityFunc: testUndefinedTemporalitySelector}), + }, + { + name: "invalid temporality selector", + reader: NewManualReader(WithTemporalitySelector(testInvalidTemporalitySelector)), + }, + { + name: "invalid temporality selector periodic", + reader: NewPeriodicReader(&fnExporter{temporalityFunc: testInvalidTemporalitySelector}), + }, + { + name: "both aggregation and temporality selector", + reader: NewManualReader( + WithAggregationSelector(testNilAggregationSelector), + WithTemporalitySelector(testUndefinedTemporalitySelector), + ), + }, + { + name: "both aggregation and temporality selector periodic", + reader: NewPeriodicReader(&fnExporter{ + aggregationFunc: testNilAggregationSelector, + temporalityFunc: testUndefinedTemporalitySelector, + }), + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + origErrorHandler := global.GetErrorHandler() + defer global.SetErrorHandler(origErrorHandler) + global.SetErrorHandler(noErrorHandler{t}) + + defer func() { + _ = tt.reader.Shutdown(context.Background()) + }() + + meter := NewMeterProvider(WithReader(tt.reader)).Meter("TestNilAggregationSelector") + + // Create All instruments, they should not error + aiCounter, err := meter.Int64ObservableCounter("observable.int64.counter") + require.NoError(t, err) + aiUpDownCounter, err := meter.Int64ObservableUpDownCounter("observable.int64.up.down.counter") + require.NoError(t, err) + aiGauge, err := meter.Int64ObservableGauge("observable.int64.gauge") + require.NoError(t, err) + + afCounter, err := meter.Float64ObservableCounter("observable.float64.counter") + require.NoError(t, err) + afUpDownCounter, err := meter.Float64ObservableUpDownCounter("observable.float64.up.down.counter") + require.NoError(t, err) + afGauge, err := meter.Float64ObservableGauge("observable.float64.gauge") + require.NoError(t, err) + + siCounter, err := meter.Int64Counter("sync.int64.counter") + require.NoError(t, err) + siUpDownCounter, err := meter.Int64UpDownCounter("sync.int64.up.down.counter") + require.NoError(t, err) + siHistogram, err := meter.Int64Histogram("sync.int64.histogram") + require.NoError(t, err) + + sfCounter, err := meter.Float64Counter("sync.float64.counter") + require.NoError(t, err) + sfUpDownCounter, err := meter.Float64UpDownCounter("sync.float64.up.down.counter") + require.NoError(t, err) + sfHistogram, err := meter.Float64Histogram("sync.float64.histogram") + require.NoError(t, err) + + callback := func(ctx context.Context, obs metric.Observer) error { + obs.ObserveInt64(aiCounter, 1) + obs.ObserveInt64(aiUpDownCounter, 1) + obs.ObserveInt64(aiGauge, 1) + obs.ObserveFloat64(afCounter, 1) + obs.ObserveFloat64(afUpDownCounter, 1) + obs.ObserveFloat64(afGauge, 1) + return nil + } + _, err = meter.RegisterCallback(callback, aiCounter, aiUpDownCounter, aiGauge, afCounter, afUpDownCounter, afGauge) + require.NoError(t, err) + + siCounter.Add(context.Background(), 1) + siUpDownCounter.Add(context.Background(), 1) + siHistogram.Record(context.Background(), 1) + sfCounter.Add(context.Background(), 1) + sfUpDownCounter.Add(context.Background(), 1) + sfHistogram.Record(context.Background(), 1) + + var rm metricdata.ResourceMetrics + err = tt.reader.Collect(context.Background(), &rm) + require.NoError(t, err) + + require.Len(t, rm.ScopeMetrics, 1) + require.Len(t, rm.ScopeMetrics[0].Metrics, 12) + }) + } +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 0d9a363a29b..9b9483fad89 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -311,6 +311,11 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum case nil, aggregation.Default: // Undefined, nil, means to use the default from the reader. stream.Aggregation = i.pipeline.reader.aggregation(kind) + switch stream.Aggregation.(type) { + case nil, aggregation.Default: + // If the reader returns default or nil use the default selector. + stream.Aggregation = DefaultAggregationSelector(kind) + } } if err := isAggregatorCompatible(kind, stream.Aggregation); err != nil { diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 95d8f0d2231..a281104bd08 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -145,6 +145,9 @@ func DefaultTemporalitySelector(InstrumentKind) metricdata.Temporality { // AggregationSelector selects the aggregation and the parameters to use for // that aggregation based on the InstrumentKind. +// +// If the Aggregation returned is nil or DefaultAggregation, the selection from +// DefaultAggregationSelector will be used. type AggregationSelector func(InstrumentKind) aggregation.Aggregation // DefaultAggregationSelector returns the default aggregation and parameters From e557e74cc235a3f948ee8419807b936201d6e52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 26 Jul 2023 12:14:44 +0200 Subject: [PATCH 618/886] Improve readers Collect docs (#4361) --- sdk/metric/manual_reader.go | 4 ++-- sdk/metric/manual_reader_test.go | 24 +++++++++--------------- sdk/metric/periodic_reader.go | 4 ++-- sdk/metric/periodic_reader_test.go | 24 +++++++++--------------- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index b8dcf1fccda..898af86edc0 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -118,8 +118,8 @@ func (mr *ManualReader) Shutdown(context.Context) error { return err } -// Collect gathers all metrics from the SDK and other Producers, calling any -// callbacks necessary and stores the result in rm. +// Collect gathers all metric data related to the Reader from +// the SDK and other Producers and stores the result in rm. // // Collect will return an error if called after shutdown. // Collect will return an error if rm is a nil ResourceMetrics. diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 485c1b6eaf0..1c2f63cf504 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -80,25 +80,18 @@ func TestManualReaderCollect(t *testing.T) { defer cancel() tests := []struct { - name string - - ctx context.Context - resourceMetrics *metricdata.ResourceMetrics - + name string + ctx context.Context expectedErr error }{ { - name: "with a valid context", - - ctx: context.Background(), - resourceMetrics: &metricdata.ResourceMetrics{}, + name: "with a valid context", + ctx: context.Background(), + expectedErr: nil, }, { - name: "with an expired context", - - ctx: expiredCtx, - resourceMetrics: &metricdata.ResourceMetrics{}, - + name: "with an expired context", + ctx: expiredCtx, expectedErr: context.DeadlineExceeded, }, } @@ -117,7 +110,8 @@ func TestManualReaderCollect(t *testing.T) { }, testM) assert.NoError(t, err) - assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, tt.resourceMetrics)) + rm := &metricdata.ResourceMetrics{} + assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, rm)) }) } } diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 48bbdffd82f..e04c1edbe18 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -237,8 +237,8 @@ func (r *PeriodicReader) collectAndExport(ctx context.Context) error { return err } -// Collect gathers and returns all metric data related to the Reader from -// the SDK and other Producers and stores the result in rm. The returned metric +// Collect gathers all metric data related to the Reader from +// the SDK and other Producers and stores the result in rm. The metric // data is not exported to the configured exporter, it is left to the caller to // handle that if desired. // diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index ad8b5598756..e5b279ec238 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -424,25 +424,18 @@ func TestPeriodicReaderCollect(t *testing.T) { defer cancel() tests := []struct { - name string - - ctx context.Context - resourceMetrics *metricdata.ResourceMetrics - + name string + ctx context.Context expectedErr error }{ { - name: "with a valid context", - - ctx: context.Background(), - resourceMetrics: &metricdata.ResourceMetrics{}, + name: "with a valid context", + ctx: context.Background(), + expectedErr: nil, }, { - name: "with an expired context", - - ctx: expiredCtx, - resourceMetrics: &metricdata.ResourceMetrics{}, - + name: "with an expired context", + ctx: expiredCtx, expectedErr: context.DeadlineExceeded, }, } @@ -461,7 +454,8 @@ func TestPeriodicReaderCollect(t *testing.T) { }, testM) assert.NoError(t, err) - assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, tt.resourceMetrics)) + rm := &metricdata.ResourceMetrics{} + assert.Equal(t, tt.expectedErr, rdr.Collect(tt.ctx, rm)) }) } } From 85afa3d8fe578b46accf898657cdf95736d6efc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 26 Jul 2023 13:34:15 +0200 Subject: [PATCH 619/886] Fix typo in README.md (#4366) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c02ab206522..370513054de 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ It provides a set of APIs to directly measure performance and behavior of your s [Go: Metric SDK (GA)]: https://github.com/orgs/open-telemetry/projects/34 - [1]: [Metrics API](https://pkg.go.dev/go.opentelemetry.io/otel/metric) is Stable. [Metrics SDK](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric) is Beta. -- [2]: The Logs signal development is halted for this project while we stablize the Metrics SDK. +- [2]: The Logs signal development is halted for this project while we stabilize the Metrics SDK. No Logs Pull Requests are currently being accepted. Progress and status specific to this repository is tracked in our From d5d631852a9e565bc6c9dd0f577115e6879df82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 26 Jul 2023 13:51:21 +0200 Subject: [PATCH 620/886] Remove redundant TestBatchSpanProcessorForceFlushCancellation (#4367) --- sdk/trace/batch_span_processor_test.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index a7430335fbc..d4a5c2976a5 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -549,18 +549,6 @@ func (indefiniteExporter) ExportSpans(ctx context.Context, _ []sdktrace.ReadOnly return ctx.Err() } -func TestBatchSpanProcessorForceFlushTimeout(t *testing.T) { - // Add timeout to context to test deadline - ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) - defer cancel() - <-ctx.Done() - - bsp := sdktrace.NewBatchSpanProcessor(indefiniteExporter{}) - if got, want := bsp.ForceFlush(ctx), context.DeadlineExceeded; !errors.Is(got, want) { - t.Errorf("expected %q error, got %v", want, got) - } -} - func TestBatchSpanProcessorForceFlushCancellation(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) // Cancel the context From 830fae8d707b9181942fbae304fd1972db4e6fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 26 Jul 2023 17:09:04 +0200 Subject: [PATCH 621/886] Add semconv/v1.21.0 (#4362) * Update tooling to point to new repository * Update changelog * Remove leftovers * generate semconv/v1.21.0 --- CHANGELOG.md | 2 + Makefile | 12 +- RELEASING.md | 15 +- internal/tools/semconvkit/main.go | 21 +- semconv/v1.21.0/attribute_group.go | 1877 +++++++++++++++++++++ semconv/v1.21.0/doc.go | 20 + semconv/v1.21.0/event.go | 199 +++ semconv/v1.21.0/exception.go | 20 + semconv/v1.21.0/resource.go | 2310 +++++++++++++++++++++++++ semconv/v1.21.0/schema.go | 20 + semconv/v1.21.0/trace.go | 2495 ++++++++++++++++++++++++++++ 11 files changed, 6956 insertions(+), 35 deletions(-) create mode 100644 semconv/v1.21.0/attribute_group.go create mode 100644 semconv/v1.21.0/doc.go create mode 100644 semconv/v1.21.0/event.go create mode 100644 semconv/v1.21.0/exception.go create mode 100644 semconv/v1.21.0/resource.go create mode 100644 semconv/v1.21.0/schema.go create mode 100644 semconv/v1.21.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index ff05ad60c55..691ed9e8c4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - OTLP Metrics Exporter now supports the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) - Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) - Add info and debug logging to the metric SDK. (#4315) +- The `go.opentelemetry.io/otel/semconv/v1.21.0` package. + The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) ### Changed diff --git a/Makefile b/Makefile index 87b9211dbd0..d690e1cd32a 100644 --- a/Makefile +++ b/Makefile @@ -256,12 +256,12 @@ check-clean-work-tree: SEMCONVPKG ?= "semconv/" .PHONY: semconv-generate semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) - [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 ) - [ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 ) - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" - $(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + [ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 ) + [ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 ) + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" + $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" .PHONY: prerelease diff --git a/RELEASING.md b/RELEASING.md index 43bfecd3308..9bf31f17e73 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -2,28 +2,25 @@ ## Semantic Convention Generation -New versions of the [OpenTelemetry Specification] mean new versions of the `semconv` package need to be generated. +New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. The `semconv-generate` make target is used for this. -1. Checkout a local copy of the [OpenTelemetry Specification] to the desired release tag. +1. Checkout a local copy of the [OpenTelemetry Semantic Conventions] to the desired release tag. 2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest` 3. Run the `make semconv-generate ...` target from this repository. For example, ```sh -export TAG="v1.13.0" # Change to the release version you are generating. -export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification" +export TAG="v1.21.0" # Change to the release version you are generating. +export OTEL_SEMCONV_REPO="/absolute/path/to/opentelemetry/semantic-conventions" docker pull otel/semconvgen:latest -make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO. +make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO. ``` This should create a new sub-package of [`semconv`](./semconv). Ensure things look correct before submitting a pull request to include the addition. -**Note**, the generation code was changed to generate versions >= 1.13. -To generate versions prior to this, checkout the old release of this repository (i.e. [2fe8861](https://github.com/open-telemetry/opentelemetry-go/commit/2fe8861a24e20088c065b116089862caf9e3cd8b)). - ## Pre-Release First, decide which module sets will be released and update their versions @@ -123,7 +120,7 @@ Once verified be sure to [make a release for the `contrib` repository](https://g Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go]. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. -[OpenTelemetry Specification]: https://github.com/open-telemetry/opentelemetry-specification +[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions [Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ [content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go diff --git a/internal/tools/semconvkit/main.go b/internal/tools/semconvkit/main.go index 52510cbad70..ce8e9168cc9 100644 --- a/internal/tools/semconvkit/main.go +++ b/internal/tools/semconvkit/main.go @@ -21,7 +21,6 @@ package main import ( "embed" "flag" - "fmt" "log" "os" "path/filepath" @@ -33,7 +32,7 @@ var ( out = flag.String("output", "./", "output directory") tag = flag.String("tag", "", "OpenTelemetry tagged version") - //go:embed templates/*.tmpl templates/netconv/*.tmpl templates/httpconv/*.tmpl + //go:embed templates/*.tmpl rootFS embed.FS ) @@ -82,22 +81,4 @@ func main() { if err := render("templates/*.tmpl", *out, sc); err != nil { log.Fatal(err) } - - dest := fmt.Sprintf("%s/netconv", *out) - // Ensure the dest dir exists (MkdirAll does nothing if dest is a directory - // and already exists). - if err := os.MkdirAll(dest, os.ModePerm); err != nil { - log.Fatal(err) - } - if err := render("templates/netconv/*.tmpl", dest, sc); err != nil { - log.Fatal(err) - } - - dest = fmt.Sprintf("%s/httpconv", *out) - if err := os.MkdirAll(dest, os.ModePerm); err != nil { - log.Fatal(err) - } - if err := render("templates/httpconv/*.tmpl", dest, sc); err != nil { - log.Fatal(err) - } } diff --git a/semconv/v1.21.0/attribute_group.go b/semconv/v1.21.0/attribute_group.go new file mode 100644 index 00000000000..e6cf8951053 --- /dev/null +++ b/semconv/v1.21.0/attribute_group.go @@ -0,0 +1,1877 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - unix domain + // socket name, IPv4 or IPv6 address. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/tmp/my.sock', '10.1.2.80' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent client address behind + // any intermediaries (e.g. proxies) if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent client port behind any + // intermediaries (e.g. proxies) if it's available. + ClientPortKey = attribute.Key("client.port") + + // ClientSocketAddressKey is the attribute Key conforming to the + // "client.socket.address" semantic conventions. It represents the + // immediate client peer address - unix domain socket name, IPv4 or IPv6 + // address. + // + // Type: string + // RequirementLevel: Recommended (If different than `client.address`.) + // Stability: stable + // Examples: '/tmp/my.sock', '127.0.0.1' + ClientSocketAddressKey = attribute.Key("client.socket.address") + + // ClientSocketPortKey is the attribute Key conforming to the + // "client.socket.port" semantic conventions. It represents the immediate + // client peer port number + // + // Type: int + // RequirementLevel: Recommended (If different than `client.port`.) + // Stability: stable + // Examples: 35555 + ClientSocketPortKey = attribute.Key("client.socket.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// unix domain socket name, IPv4 or IPv6 address. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// ClientSocketAddress returns an attribute KeyValue conforming to the +// "client.socket.address" semantic conventions. It represents the immediate +// client peer address - unix domain socket name, IPv4 or IPv6 address. +func ClientSocketAddress(val string) attribute.KeyValue { + return ClientSocketAddressKey.String(val) +} + +// ClientSocketPort returns an attribute KeyValue conforming to the +// "client.socket.port" semantic conventions. It represents the immediate +// client peer port number +func ClientSocketPort(val int) attribute.KeyValue { + return ClientSocketPortKey.Int(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. It represents the deprecated, use + // `http.request.method` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + HTTPMethodKey = attribute.Key("http.method") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. It represents the deprecated, + // use `http.response.status_code` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. It represents the deprecated, use `url.scheme` + // instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. It represents the deprecated, use `url.full` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + HTTPURLKey = attribute.Key("http.url") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. It represents the deprecated, use `url.path` and + // `url.query` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + HTTPTargetKey = attribute.Key("http.target") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. It represents the + // deprecated, use `http.request.body.size` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. It represents the + // deprecated, use `http.response.body.size` instead. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. It represents the deprecated, use +// `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. It represents the deprecated, use +// `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. It represents the deprecated, use `url.scheme` +// instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. It represents the deprecated, use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. It represents the deprecated, use `url.path` and +// `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. It represents the +// deprecated, use `http.request.body.size` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. It represents the +// deprecated, use `http.response.body.size` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. It represents the deprecated, + // use `server.socket.domain` on client spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. It represents the deprecated, + // use `server.socket.address` on client spans and `client.socket.address` + // on server spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. It represents the deprecated, + // use `server.socket.port` on client spans and `client.socket.port` on + // server spans. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. It represents the deprecated, use `server.address` + // on client spans and `client.address` on server spans. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. It represents the deprecated, use `server.port` on + // client spans and `client.port` on server spans. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. It represents the deprecated, use + // `server.address`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. It represents the deprecated, use `server.port`. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetHostPortKey = attribute.Key("net.host.port") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. It represents the deprecated, + // use `server.socket.address`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. It represents the deprecated, + // use `server.socket.port`. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. It represents the deprecated, use + // `network.transport`. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + NetTransportKey = attribute.Key("net.transport") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. It represents the deprecated, + // use `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. It represents the + // deprecated, use `network.protocol.version`. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. It represents the deprecated, + // use `network.transport` and `network.type`. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + NetSockFamilyKey = attribute.Key("net.sock.family") +) + +var ( + // ip_tcp + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + NetTransportOther = NetTransportKey.String("other") +) + +var ( + // IPv4 address + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. It represents the deprecated, use +// `server.socket.domain` on client spans. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. It represents the deprecated, use +// `server.socket.address` on client spans and `client.socket.address` on +// server spans. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. It represents the deprecated, use +// `server.socket.port` on client spans and `client.socket.port` on server +// spans. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. It represents the deprecated, use +// `server.address` on client spans and `client.address` on server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. It represents the deprecated, use +// `server.port` on client spans and `client.port` on server spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. It represents the deprecated, use +// `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. It represents the deprecated, use +// `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. It represents the deprecated, use +// `server.socket.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. It represents the deprecated, use +// `server.socket.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. It represents the deprecated, use +// `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. It represents the deprecated, +// use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // DestinationDomainKey is the attribute Key conforming to the + // "destination.domain" semantic conventions. It represents the domain name + // of the destination system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'foo.example.com' + // Note: This value may be a host name, a fully qualified domain name, or + // another host naming format. + DestinationDomainKey = attribute.Key("destination.domain") + + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the peer + // address, for example IP address or UNIX socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.5.3.2' + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the peer port + // number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationDomain returns an attribute KeyValue conforming to the +// "destination.domain" semantic conventions. It represents the domain name of +// the destination system. +func DestinationDomain(val string) attribute.KeyValue { + return DestinationDomainKey.String(val) +} + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the peer address, +// for example IP address or UNIX socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the peer port number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// Describes HTTP attributes. +const ( + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER` and, except if reporting + // a metric, MUST + // set the exact method received in the request line as value of the + // `http.request.method_original` attribute. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: ConditionallyRequired (If and only if one was + // received/sent.) + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTP Server attributes +const ( + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's available) + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") + + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // TypeKey is the attribute Key conforming to the "type" semantic + // conventions. It represents the type of memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'heap', 'non_heap' + TypeKey = attribute.Key("type") + + // PoolKey is the attribute Key conforming to the "pool" semantic + // conventions. It represents the name of the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + PoolKey = attribute.Key("pool") +) + +var ( + // Heap memory + TypeHeap = TypeKey.String("heap") + // Non-heap memory + TypeNonHeap = TypeKey.String("non_heap") +) + +// Pool returns an attribute KeyValue conforming to the "pool" semantic +// conventions. It represents the name of the memory pool. +func Pool(val string) attribute.KeyValue { + return PoolKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the logical server hostname, matches + // server FQDN if available, and IP or socket address if FQDN is not known. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com' + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the logical server port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + ServerPortKey = attribute.Key("server.port") + + // ServerSocketDomainKey is the attribute Key conforming to the + // "server.socket.domain" semantic conventions. It represents the domain + // name of an immediate peer. + // + // Type: string + // RequirementLevel: Recommended (If different than `server.address`.) + // Stability: stable + // Examples: 'proxy.example.com' + // Note: Typically observed from the client side, and represents a proxy or + // other intermediary domain name. + ServerSocketDomainKey = attribute.Key("server.socket.domain") + + // ServerSocketAddressKey is the attribute Key conforming to the + // "server.socket.address" semantic conventions. It represents the physical + // server IP address or Unix socket address. If set from the client, should + // simply use the socket's peer address, and not attempt to find any actual + // server IP (i.e., if set from client, this may represent some proxy + // server instead of the logical server). + // + // Type: string + // RequirementLevel: Recommended (If different than `server.address`.) + // Stability: stable + // Examples: '10.5.3.2' + ServerSocketAddressKey = attribute.Key("server.socket.address") + + // ServerSocketPortKey is the attribute Key conforming to the + // "server.socket.port" semantic conventions. It represents the physical + // server port. + // + // Type: int + // RequirementLevel: Recommended (If different than `server.port`.) + // Stability: stable + // Examples: 16456 + ServerSocketPortKey = attribute.Key("server.socket.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the logical server +// hostname, matches server FQDN if available, and IP or socket address if FQDN +// is not known. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the logical server port number +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// ServerSocketDomain returns an attribute KeyValue conforming to the +// "server.socket.domain" semantic conventions. It represents the domain name +// of an immediate peer. +func ServerSocketDomain(val string) attribute.KeyValue { + return ServerSocketDomainKey.String(val) +} + +// ServerSocketAddress returns an attribute KeyValue conforming to the +// "server.socket.address" semantic conventions. It represents the physical +// server IP address or Unix socket address. If set from the client, should +// simply use the socket's peer address, and not attempt to find any actual +// server IP (i.e., if set from client, this may represent some proxy server +// instead of the logical server). +func ServerSocketAddress(val string) attribute.KeyValue { + return ServerSocketAddressKey.String(val) +} + +// ServerSocketPort returns an attribute KeyValue conforming to the +// "server.socket.port" semantic conventions. It represents the physical server +// port. +func ServerSocketPort(val int) attribute.KeyValue { + return ServerSocketPortKey.Int(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // SourceDomainKey is the attribute Key conforming to the "source.domain" + // semantic conventions. It represents the domain name of the source + // system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'foo.example.com' + // Note: This value may be a host name, a fully qualified domain name, or + // another host naming format. + SourceDomainKey = attribute.Key("source.domain") + + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address, for example IP + // address or Unix socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.5.3.2' + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceDomain returns an attribute KeyValue conforming to the +// "source.domain" semantic conventions. It represents the domain name of the +// source system. +func SourceDomain(val string) attribute.KeyValue { + return SourceDomainKey.String(val) +} + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address, for +// example IP address or Unix socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // Transport Layer](https://osi-model.com/transport-layer/) or + // [Inter-process Communication + // method](https://en.wikipedia.org/wiki/Inter-process_communication). The + // value SHOULD be normalized to lowercase. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI Network + // Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The + // value SHOULD be normalized to lowercase. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + NetworkTypeKey = attribute.Key("network.type") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // Application Layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. The value SHOULD be normalized to lowercase. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the application layer protocol used. See note below. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe. See note below + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// Application Layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. The value SHOULD be normalized to lowercase. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the application layer protocol used. See note below. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// Semantic conventions for HTTP client and server Spans. +const ( + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If and only if it's different + // than `http.request.method`.) + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") +) + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to + // the "messaging.message.payload_size_bytes" semantic conventions. It + // represents the (uncompressed) size of the message payload in bytes. Also + // use this attribute if it is unknown whether the compressed or + // uncompressed payload size is reported. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2738 + MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") + + // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key + // conforming to the "messaging.message.payload_compressed_size_bytes" + // semantic conventions. It represents the compressed size of the message + // payload in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2048 + MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") +) + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming +// to the "messaging.message.payload_size_bytes" semantic conventions. It +// represents the (uncompressed) size of the message payload in bytes. Also use +// this attribute if it is unknown whether the compressed or uncompressed +// payload size is reported. +func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadSizeBytesKey.Int(val) +} + +// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue +// conforming to the "messaging.message.payload_compressed_size_bytes" semantic +// conventions. It represents the compressed size of the message payload in +// bytes. +func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { + return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") +) + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: stable + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: stable + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: stable + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: stable + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: stable + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// Attributes describing URL. +const ( + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it should be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password should be redacted and attribute's value should be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + // Note: When missing, the value is assumed to be `/` + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") +) + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/semconv/v1.21.0/doc.go b/semconv/v1.21.0/doc.go new file mode 100644 index 00000000000..7cf424855e9 --- /dev/null +++ b/semconv/v1.21.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the conventions +// as of the v1.21.0 version of the OpenTelemetry specification. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" diff --git a/semconv/v1.21.0/event.go b/semconv/v1.21.0/event.go new file mode 100644 index 00000000000..30ae34fe478 --- /dev/null +++ b/semconv/v1.21.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + MessageTypeKey = attribute.Key("message.type") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.21.0/exception.go b/semconv/v1.21.0/exception.go new file mode 100644 index 00000000000..93d3c1760c9 --- /dev/null +++ b/semconv/v1.21.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.21.0/resource.go b/semconv/v1.21.0/resource.go new file mode 100644 index 00000000000..b6d8935cf97 --- /dev/null +++ b/semconv/v1.21.0/resource.go @@ -0,0 +1,2310 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") +) + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") + + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") +) + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") +) + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// A container instance. +const ( + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageTagKey is the attribute Key conforming to the + // "container.image.tag" semantic conventions. It represents the container + // image tag. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + ContainerImageTagKey = attribute.Key("container.image.tag") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // OCI defines a digest of manifest. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") +) + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageTag returns an attribute KeyValue conforming to the +// "container.image.tag" semantic conventions. It represents the container +// image tag. +func ContainerImageTag(val string) attribute.KeyValue { + return ContainerImageTagKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// A serverless instance. +const ( + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/general-attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") + + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") +) + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") + + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + HostArchKey = attribute.Key("host.arch") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S does not have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") +) + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") +) + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") +) + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") +) + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") +) + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") +) + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") +) + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + OSTypeKey = attribute.Key("os.type") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: stable + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") +) + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") +) + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") + + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") +) + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryAutoVersionKey is the attribute Key conforming to the + // "telemetry.auto.version" semantic conventions. It represents the version + // string of the auto instrumentation agent, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.2.3' + TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") +) + +// TelemetryAutoVersion returns an attribute KeyValue conforming to the +// "telemetry.auto.version" semantic conventions. It represents the version +// string of the auto instrumentation agent, if used. +func TelemetryAutoVersion(val string) attribute.KeyValue { + return TelemetryAutoVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") + + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") +) + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. It represents the deprecated, + // use the `otel.scope.name` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. It represents the + // deprecated, use the `otel.scope.version` attribute. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. It represents the deprecated, use +// the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. It represents the deprecated, +// use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.21.0/schema.go b/semconv/v1.21.0/schema.go new file mode 100644 index 00000000000..66ffd5989f3 --- /dev/null +++ b/semconv/v1.21.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.21.0" diff --git a/semconv/v1.21.0/trace.go b/semconv/v1.21.0/trace.go new file mode 100644 index 00000000000..b5a91450d42 --- /dev/null +++ b/semconv/v1.21.0/trace.go @@ -0,0 +1,2495 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") +) + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + DBSystemKey = attribute.Key("db.system") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: stable + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: stable + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: stable + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: stable + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: stable + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: stable + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: stable + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: stable + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: stable + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: stable + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Note: For the server/consumer span on the incoming side, + // `faas.trigger` MUST be set. + // + // Clients invoking FaaS instances usually cannot set `faas.trigger`, + // since they would typically need to look in the payload to determine + // the event type. If clients set it, it should be the same as the + // trigger that corresponding incoming would have (i.e., this has + // nothing to do with the underlying transport used to make the API + // call to invoke the lambda, which is often HTTP). + FaaSTriggerKey = attribute.Key("faas.trigger") + + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") + + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") +) + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// Contains additional attributes for outgoing FaaS spans. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: stable + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") +) + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// Semantic Convention for HTTP Client +const ( + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Recommended (if and only if request was retried.) + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") +) + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: stable + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") +) + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: stable + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") + + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") +) + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: stable + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") + + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: stable + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: stable + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Recommended (If a client id is available) + // Stability: stable + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCSystemKey = attribute.Key("rpc.system") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: stable + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: stable + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: stable + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") +) + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: stable + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) From b4264c53bc17d37573b26bd7f5ff29f96ac69863 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 26 Jul 2023 13:32:45 -0700 Subject: [PATCH 622/886] Simplify the sum aggregators (#4357) * Simplify the sum aggregators * Comment how memory reuse misses are handled --- sdk/metric/internal/aggregate/aggregate.go | 28 +- .../internal/aggregate/aggregator_test.go | 4 - sdk/metric/internal/aggregate/sum.go | 274 +++----- sdk/metric/internal/aggregate/sum_test.go | 613 +++++++++++------- 4 files changed, 504 insertions(+), 415 deletions(-) diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index ac9dda5cbad..76ea3636a27 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -88,39 +88,23 @@ func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // PrecomputedSum returns a sum aggregate function input and output. The // arguments passed to the input are expected to be the precomputed sum values. func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation) { - var s aggregator[N] + s := newPrecomputedSum[N](monotonic) switch b.Temporality { case metricdata.DeltaTemporality: - s = newPrecomputedDeltaSum[N](monotonic) + return b.filter(s.measure), s.delta default: - s = newPrecomputedCumulativeSum[N](monotonic) - } - - return b.input(s), func(dest *metricdata.Aggregation) int { - // TODO (#4220): optimize memory reuse here. - *dest = s.Aggregation() - - sData, _ := (*dest).(metricdata.Sum[N]) - return len(sData.DataPoints) + return b.filter(s.measure), s.cumulative } } // Sum returns a sum aggregate function input and output. func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { - var s aggregator[N] + s := newSum[N](monotonic) switch b.Temporality { case metricdata.DeltaTemporality: - s = newDeltaSum[N](monotonic) + return b.filter(s.measure), s.delta default: - s = newCumulativeSum[N](monotonic) - } - - return b.input(s), func(dest *metricdata.Aggregation) int { - // TODO (#4220): optimize memory reuse here. - *dest = s.Aggregation() - - sData, _ := (*dest).(metricdata.Sum[N]) - return len(sData.DataPoints) + return b.filter(s.measure), s.cumulative } } diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go index 0bca6b01b4b..4e16175159b 100644 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ b/sdk/metric/internal/aggregate/aggregator_test.go @@ -38,10 +38,6 @@ func monoIncr[N int64 | float64]() setMap[N] { return setMap[N]{alice: 1, bob: 10, carol: 2} } -func nonMonoIncr[N int64 | float64]() setMap[N] { - return setMap[N]{alice: 1, bob: -1, carol: 2} -} - // setMap maps attribute sets to a number. type setMap[N int64 | float64] map[attribute.Set]N diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index 594068c4354..1e52ff0d1e5 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -15,6 +15,7 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "sync" "time" @@ -32,257 +33,190 @@ func newValueMap[N int64 | float64]() *valueMap[N] { return &valueMap[N]{values: make(map[attribute.Set]N)} } -func (s *valueMap[N]) Aggregate(value N, attr attribute.Set) { +func (s *valueMap[N]) measure(_ context.Context, value N, attr attribute.Set) { s.Lock() s.values[attr] += value s.Unlock() } -// newDeltaSum returns an Aggregator that summarizes a set of measurements as -// their arithmetic sum. Each sum is scoped by attributes and the aggregation -// cycle the measurements were made in. -// -// The monotonic value is used to communicate the produced Aggregation is -// monotonic or not. The returned Aggregator does not make any guarantees this -// value is accurate. It is up to the caller to ensure it. -// -// Each aggregation cycle is treated independently. When the returned -// Aggregator's Aggregation method is called it will reset all sums to zero. -func newDeltaSum[N int64 | float64](monotonic bool) aggregator[N] { - return &deltaSum[N]{ +// newSum returns an aggregator that summarizes a set of measurements as their +// arithmetic sum. Each sum is scoped by attributes and the aggregation cycle +// the measurements were made in. +func newSum[N int64 | float64](monotonic bool) *sum[N] { + return &sum[N]{ valueMap: newValueMap[N](), monotonic: monotonic, start: now(), } } -// deltaSum summarizes a set of measurements made in a single aggregation -// cycle as their arithmetic sum. -type deltaSum[N int64 | float64] struct { +// sum summarizes a set of measurements made as their arithmetic sum. +type sum[N int64 | float64] struct { *valueMap[N] monotonic bool start time.Time } -func (s *deltaSum[N]) Aggregation() metricdata.Aggregation { +func (s *sum[N]) delta(dest *metricdata.Aggregation) int { + t := now() + + // If *dest is not a metricdata.Sum, memory reuse is missed. In that case, + // use the zero-value sData and hope for better alignment next cycle. + sData, _ := (*dest).(metricdata.Sum[N]) + sData.Temporality = metricdata.DeltaTemporality + sData.IsMonotonic = s.monotonic + s.Lock() defer s.Unlock() - if len(s.values) == 0 { - return nil - } + n := len(s.values) + dPts := reset(sData.DataPoints, n, n) - t := now() - out := metricdata.Sum[N]{ - Temporality: metricdata.DeltaTemporality, - IsMonotonic: s.monotonic, - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), - } + var i int for attr, value := range s.values { - out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ - Attributes: attr, - StartTime: s.start, - Time: t, - Value: value, - }) - // Unused attribute sets do not report. + dPts[i].Attributes = attr + dPts[i].StartTime = s.start + dPts[i].Time = t + dPts[i].Value = value + // Do not report stale values. delete(s.values, attr) + i++ } // The delta collection cycle resets. s.start = t - return out -} -// newCumulativeSum returns an Aggregator that summarizes a set of -// measurements as their arithmetic sum. Each sum is scoped by attributes and -// the aggregation cycle the measurements were made in. -// -// The monotonic value is used to communicate the produced Aggregation is -// monotonic or not. The returned Aggregator does not make any guarantees this -// value is accurate. It is up to the caller to ensure it. -// -// Each aggregation cycle is treated independently. When the returned -// Aggregator's Aggregation method is called it will reset all sums to zero. -func newCumulativeSum[N int64 | float64](monotonic bool) aggregator[N] { - return &cumulativeSum[N]{ - valueMap: newValueMap[N](), - monotonic: monotonic, - start: now(), - } + sData.DataPoints = dPts + *dest = sData + + return n } -// cumulativeSum summarizes a set of measurements made over all aggregation -// cycles as their arithmetic sum. -type cumulativeSum[N int64 | float64] struct { - *valueMap[N] +func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { + t := now() - monotonic bool - start time.Time -} + // If *dest is not a metricdata.Sum, memory reuse is missed. In that case, + // use the zero-value sData and hope for better alignment next cycle. + sData, _ := (*dest).(metricdata.Sum[N]) + sData.Temporality = metricdata.CumulativeTemporality + sData.IsMonotonic = s.monotonic -func (s *cumulativeSum[N]) Aggregation() metricdata.Aggregation { s.Lock() defer s.Unlock() - if len(s.values) == 0 { - return nil - } + n := len(s.values) + dPts := reset(sData.DataPoints, n, n) - t := now() - out := metricdata.Sum[N]{ - Temporality: metricdata.CumulativeTemporality, - IsMonotonic: s.monotonic, - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), - } + var i int for attr, value := range s.values { - out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ - Attributes: attr, - StartTime: s.start, - Time: t, - Value: value, - }) + dPts[i].Attributes = attr + dPts[i].StartTime = s.start + dPts[i].Time = t + dPts[i].Value = value // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute // sets that become "stale" need to be forgotten so this will not // overload the system. + i++ } - return out + + sData.DataPoints = dPts + *dest = sData + + return n } -// newPrecomputedDeltaSum returns an Aggregator that summarizes a set of -// pre-computed sums. Each sum is scoped by attributes and the aggregation -// cycle the measurements were made in. -// -// The monotonic value is used to communicate the produced Aggregation is -// monotonic or not. The returned Aggregator does not make any guarantees this -// value is accurate. It is up to the caller to ensure it. -// -// The output Aggregation will report recorded values as delta temporality. -func newPrecomputedDeltaSum[N int64 | float64](monotonic bool) aggregator[N] { - return &precomputedDeltaSum[N]{ +// newPrecomputedSum returns an aggregator that summarizes a set of +// observatrions as their arithmetic sum. Each sum is scoped by attributes and +// the aggregation cycle the measurements were made in. +func newPrecomputedSum[N int64 | float64](monotonic bool) *precomputedSum[N] { + return &precomputedSum[N]{ valueMap: newValueMap[N](), - reported: make(map[attribute.Set]N), monotonic: monotonic, start: now(), } } -// precomputedDeltaSum summarizes a set of pre-computed sums recorded over all -// aggregation cycles as the delta of these sums. -type precomputedDeltaSum[N int64 | float64] struct { +// precomputedSum summarizes a set of observatrions as their arithmetic sum. +type precomputedSum[N int64 | float64] struct { *valueMap[N] - reported map[attribute.Set]N - monotonic bool start time.Time + + reported map[attribute.Set]N } -// Aggregation returns the recorded pre-computed sums as an Aggregation. The -// sum values are expressed as the delta between what was measured this -// collection cycle and the previous. -// -// All pre-computed sums that were recorded for attributes sets reduced by an -// attribute filter (filtered-sums) are summed together and added to any -// pre-computed sum value recorded directly for the resulting attribute set -// (unfiltered-sum). The filtered-sums are reset to zero for the next -// collection cycle, and the unfiltered-sum is kept for the next collection -// cycle. -func (s *precomputedDeltaSum[N]) Aggregation() metricdata.Aggregation { +func (s *precomputedSum[N]) delta(dest *metricdata.Aggregation) int { + t := now() newReported := make(map[attribute.Set]N) + + // If *dest is not a metricdata.Sum, memory reuse is missed. In that case, + // use the zero-value sData and hope for better alignment next cycle. + sData, _ := (*dest).(metricdata.Sum[N]) + sData.Temporality = metricdata.DeltaTemporality + sData.IsMonotonic = s.monotonic + s.Lock() defer s.Unlock() - if len(s.values) == 0 { - s.reported = newReported - return nil - } + n := len(s.values) + dPts := reset(sData.DataPoints, n, n) - t := now() - out := metricdata.Sum[N]{ - Temporality: metricdata.DeltaTemporality, - IsMonotonic: s.monotonic, - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), - } + var i int for attr, value := range s.values { delta := value - s.reported[attr] - out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ - Attributes: attr, - StartTime: s.start, - Time: t, - Value: delta, - }) + + dPts[i].Attributes = attr + dPts[i].StartTime = s.start + dPts[i].Time = t + dPts[i].Value = delta + newReported[attr] = value // Unused attribute sets do not report. delete(s.values, attr) + i++ } // Unused attribute sets are forgotten. s.reported = newReported // The delta collection cycle resets. s.start = t - return out -} -// newPrecomputedCumulativeSum returns an Aggregator that summarizes a set of -// pre-computed sums. Each sum is scoped by attributes and the aggregation -// cycle the measurements were made in. -// -// The monotonic value is used to communicate the produced Aggregation is -// monotonic or not. The returned Aggregator does not make any guarantees this -// value is accurate. It is up to the caller to ensure it. -// -// The output Aggregation will report recorded values as cumulative -// temporality. -func newPrecomputedCumulativeSum[N int64 | float64](monotonic bool) aggregator[N] { - return &precomputedCumulativeSum[N]{ - valueMap: newValueMap[N](), - monotonic: monotonic, - start: now(), - } + sData.DataPoints = dPts + *dest = sData + + return n } -// precomputedCumulativeSum directly records and reports a set of pre-computed sums. -type precomputedCumulativeSum[N int64 | float64] struct { - *valueMap[N] +func (s *precomputedSum[N]) cumulative(dest *metricdata.Aggregation) int { + t := now() - monotonic bool - start time.Time -} + // If *dest is not a metricdata.Sum, memory reuse is missed. In that case, + // use the zero-value sData and hope for better alignment next cycle. + sData, _ := (*dest).(metricdata.Sum[N]) + sData.Temporality = metricdata.CumulativeTemporality + sData.IsMonotonic = s.monotonic -// Aggregation returns the recorded pre-computed sums as an Aggregation. The -// sum values are expressed directly as they are assumed to be recorded as the -// cumulative sum of a some measured phenomena. -// -// All pre-computed sums that were recorded for attributes sets reduced by an -// attribute filter (filtered-sums) are summed together and added to any -// pre-computed sum value recorded directly for the resulting attribute set -// (unfiltered-sum). The filtered-sums are reset to zero for the next -// collection cycle, and the unfiltered-sum is kept for the next collection -// cycle. -func (s *precomputedCumulativeSum[N]) Aggregation() metricdata.Aggregation { s.Lock() defer s.Unlock() - if len(s.values) == 0 { - return nil - } + n := len(s.values) + dPts := reset(sData.DataPoints, n, n) - t := now() - out := metricdata.Sum[N]{ - Temporality: metricdata.CumulativeTemporality, - IsMonotonic: s.monotonic, - DataPoints: make([]metricdata.DataPoint[N], 0, len(s.values)), - } + var i int for attr, value := range s.values { - out.DataPoints = append(out.DataPoints, metricdata.DataPoint[N]{ - Attributes: attr, - StartTime: s.start, - Time: t, - Value: value, - }) + dPts[i].Attributes = attr + dPts[i].StartTime = s.start + dPts[i].Time = t + dPts[i].Value = value + // Unused attribute sets do not report. delete(s.values, attr) + i++ } - return out + + sData.DataPoints = dPts + *dest = sData + + return n } diff --git a/sdk/metric/internal/aggregate/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go index 0843bcf8429..3ac675a096b 100644 --- a/sdk/metric/internal/aggregate/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -15,250 +15,425 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) func TestSum(t *testing.T) { t.Cleanup(mockTime(now)) - t.Run("Int64", testSum[int64]) - t.Run("Float64", testSum[float64]) -} - -func testSum[N int64 | float64](t *testing.T) { - tester := &aggregatorTester[N]{ - GoroutineN: defaultGoroutines, - MeasurementN: defaultMeasurements, - CycleN: defaultCycles, - } - totalMeasurements := defaultGoroutines * defaultMeasurements - - t.Run("Delta", func(t *testing.T) { - incr, mono := monoIncr[N](), true - eFunc := deltaExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(newDeltaSum[N](mono), incr, eFunc)) - - incr, mono = nonMonoIncr[N](), false - eFunc = deltaExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(newDeltaSum[N](mono), incr, eFunc)) - }) - - t.Run("Cumulative", func(t *testing.T) { - incr, mono := monoIncr[N](), true - eFunc := cumuExpecter[N](incr, mono) - t.Run("Monotonic", tester.Run(newCumulativeSum[N](mono), incr, eFunc)) - - incr, mono = nonMonoIncr[N](), false - eFunc = cumuExpecter[N](incr, mono) - t.Run("NonMonotonic", tester.Run(newCumulativeSum[N](mono), incr, eFunc)) - }) - - t.Run("PreComputedDelta", func(t *testing.T) { - incr, mono := monoIncr[N](), true - eFunc := preDeltaExpecter[N](incr, mono, N(totalMeasurements)) - t.Run("Monotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) - - incr, mono = nonMonoIncr[N](), false - eFunc = preDeltaExpecter[N](incr, mono, N(totalMeasurements)) - t.Run("NonMonotonic", tester.Run(newPrecomputedDeltaSum[N](mono), incr, eFunc)) - }) - - t.Run("PreComputedCumulative", func(t *testing.T) { - incr, mono := monoIncr[N](), true - eFunc := preCumuExpecter[N](incr, mono, N(totalMeasurements)) - t.Run("Monotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) - incr, mono = nonMonoIncr[N](), false - eFunc = preCumuExpecter[N](incr, mono, N(totalMeasurements)) - t.Run("NonMonotonic", tester.Run(newPrecomputedCumulativeSum[N](mono), incr, eFunc)) - }) -} + t.Run("Int64/DeltaSum", testDeltaSum[int64]()) + t.Run("Float64/DeltaSum", testDeltaSum[float64]()) -func deltaExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { - sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} - return func(m int) metricdata.Aggregation { - sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) - for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, v*N(m))) - } - return sum - } -} + t.Run("Int64/CumulativeSum", testCumulativeSum[int64]()) + t.Run("Float64/CumulativeSum", testCumulativeSum[float64]()) -func cumuExpecter[N int64 | float64](incr setMap[N], mono bool) expectFunc { - var cycle N - sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} - return func(m int) metricdata.Aggregation { - cycle++ - sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) - for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, v*cycle*N(m))) - } - return sum - } -} + t.Run("Int64/DeltaPrecomputedSum", testDeltaPrecomputedSum[int64]()) + t.Run("Float64/DeltaPrecomputedSum", testDeltaPrecomputedSum[float64]()) -func preDeltaExpecter[N int64 | float64](incr setMap[N], mono bool, totalMeasurements N) expectFunc { - sum := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality, IsMonotonic: mono} - last := make(map[attribute.Set]N) - return func(int) metricdata.Aggregation { - sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) - for a, v := range incr { - l := last[a] - sum.DataPoints = append(sum.DataPoints, point(a, totalMeasurements*(N(v)-l))) - last[a] = N(v) - } - return sum - } + t.Run("Int64/CumulativePrecomputedSum", testCumulativePrecomputedSum[int64]()) + t.Run("Float64/CumulativePrecomputedSum", testCumulativePrecomputedSum[float64]()) } -func preCumuExpecter[N int64 | float64](incr setMap[N], mono bool, totalMeasurements N) expectFunc { - sum := metricdata.Sum[N]{Temporality: metricdata.CumulativeTemporality, IsMonotonic: mono} - return func(int) metricdata.Aggregation { - sum.DataPoints = make([]metricdata.DataPoint[N], 0, len(incr)) - for a, v := range incr { - sum.DataPoints = append(sum.DataPoints, point(a, totalMeasurements*N(v))) - } - return sum - } -} - -// point returns a DataPoint that started and ended now. -func point[N int64 | float64](a attribute.Set, v N) metricdata.DataPoint[N] { - return metricdata.DataPoint[N]{ - Attributes: a, - StartTime: now(), - Time: now(), - Value: N(v), - } -} - -func testDeltaSumReset[N int64 | float64](t *testing.T) { - t.Cleanup(mockTime(now)) - - a := newDeltaSum[N](false) - assert.Nil(t, a.Aggregation()) - - a.Aggregate(1, alice) - expect := metricdata.Sum[N]{Temporality: metricdata.DeltaTemporality} - expect.DataPoints = []metricdata.DataPoint[N]{point[N](alice, 1)} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) - - // The attr set should be forgotten once Aggregations is called. - expect.DataPoints = nil - assert.Nil(t, a.Aggregation()) - - // Aggregating another set should not affect the original (alice). - a.Aggregate(1, bob) - expect.DataPoints = []metricdata.DataPoint[N]{point[N](bob, 1)} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) +func testDeltaSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + }.Sum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, alice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 10, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 3, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Delta sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) } -func TestDeltaSumReset(t *testing.T) { - t.Run("Int64", testDeltaSumReset[int64]) - t.Run("Float64", testDeltaSumReset[float64]) +func testCumulativeSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + }.Sum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, alice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 14, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -8, + }, + }, + }, + }, + }, + }) } -func TestPreComputedDeltaSum(t *testing.T) { - var mono bool - agg := newPrecomputedDeltaSum[int64](mono) - require.Implements(t, (*aggregator[int64])(nil), agg) - - attrs := attribute.NewSet(attribute.String("key", "val")) - agg.Aggregate(1, attrs) - want := metricdata.Sum[int64]{ - IsMonotonic: mono, +func testDeltaPrecomputedSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, - } - opt := metricdatatest.IgnoreTimestamp() - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - - // No observation results in an empty aggregation, and causes previous - // observations to be forgotten. - metricdatatest.AssertAggregationsEqual(t, nil, agg.Aggregation(), opt) - - agg.Aggregate(1, attrs) - // measured(+): 1, previous(-): 0 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - - // Duplicate observations add - agg.Aggregate(2, attrs) - agg.Aggregate(5, attrs) - agg.Aggregate(3, attrs) - agg.Aggregate(10, attrs) - // measured(+): 20, previous(-): 1 - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 19)} - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) + Filter: attrFltr, + }.PrecomputedSum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, fltrAlice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, fltrAlice}, + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 7, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 14, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Precomputed sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) } -func TestPreComputedCumulativeSum(t *testing.T) { - var mono bool - agg := newPrecomputedCumulativeSum[int64](mono) - require.Implements(t, (*aggregator[int64])(nil), agg) - - attrs := attribute.NewSet(attribute.String("key", "val")) - agg.Aggregate(1, attrs) - want := metricdata.Sum[int64]{ - IsMonotonic: mono, +func testCumulativePrecomputedSum[N int64 | float64]() func(t *testing.T) { + mono := false + in, out := Builder[N]{ Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.DataPoint[int64]{point[int64](attrs, 1)}, - } - opt := metricdatatest.IgnoreTimestamp() - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - - // Cumulative values should not persist. - metricdatatest.AssertAggregationsEqual(t, nil, agg.Aggregation(), opt) - - agg.Aggregate(1, attrs) - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 1)} - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) - - // Duplicate measurements add - agg.Aggregate(5, attrs) - agg.Aggregate(3, attrs) - agg.Aggregate(10, attrs) - want.DataPoints = []metricdata.DataPoint[int64]{point[int64](attrs, 18)} - metricdatatest.AssertAggregationsEqual(t, want, agg.Aggregation(), opt) -} - -func TestEmptySumNilAggregation(t *testing.T) { - assert.Nil(t, newCumulativeSum[int64](true).Aggregation()) - assert.Nil(t, newCumulativeSum[int64](false).Aggregation()) - assert.Nil(t, newCumulativeSum[float64](true).Aggregation()) - assert.Nil(t, newCumulativeSum[float64](false).Aggregation()) - assert.Nil(t, newDeltaSum[int64](true).Aggregation()) - assert.Nil(t, newDeltaSum[int64](false).Aggregation()) - assert.Nil(t, newDeltaSum[float64](true).Aggregation()) - assert.Nil(t, newDeltaSum[float64](false).Aggregation()) - assert.Nil(t, newPrecomputedCumulativeSum[int64](true).Aggregation()) - assert.Nil(t, newPrecomputedCumulativeSum[int64](false).Aggregation()) - assert.Nil(t, newPrecomputedCumulativeSum[float64](true).Aggregation()) - assert.Nil(t, newPrecomputedCumulativeSum[float64](false).Aggregation()) - assert.Nil(t, newPrecomputedDeltaSum[int64](true).Aggregation()) - assert.Nil(t, newPrecomputedDeltaSum[int64](false).Aggregation()) - assert.Nil(t, newPrecomputedDeltaSum[float64](true).Aggregation()) - assert.Nil(t, newPrecomputedDeltaSum[float64](false).Aggregation()) + Filter: attrFltr, + }.PrecomputedSum(mono) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, -1, bob}, + {ctx, 1, fltrAlice}, + {ctx, 2, alice}, + {ctx, -10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 4, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -11, + }, + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 1, fltrAlice}, + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 11, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 3, + }, + }, + }, + }, + }, + { + input: []arg[N]{}, + // Precomputed sums are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{}, + }, + }, + }, + }) } func BenchmarkSum(b *testing.B) { - b.Run("Int64", benchmarkSum[int64]) - b.Run("Float64", benchmarkSum[float64]) -} - -func benchmarkSum[N int64 | float64](b *testing.B) { // The monotonic argument is only used to annotate the Sum returned from // the Aggregation method. It should not have an effect on operational // performance, therefore, only monotonic=false is benchmarked here. - factory := func() aggregator[N] { return newDeltaSum[N](false) } - b.Run("Delta", benchmarkAggregator(factory)) - factory = func() aggregator[N] { return newCumulativeSum[N](false) } - b.Run("Cumulative", benchmarkAggregator(factory)) + b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.Sum(false) + })) + b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.Sum(false) + })) + b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.Sum(false) + })) + b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.Sum(false) + })) + + b.Run("Precomputed/Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.PrecomputedSum(false) + })) + b.Run("Precomputed/Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.PrecomputedSum(false) + })) } From 4f0d73cbc2a95f6c452e7a26dc5484559267f8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 27 Jul 2023 10:05:52 +0200 Subject: [PATCH 623/886] sdk/trace: Refine context cancellation in batchSpanProcessor.ForceFlush (#4369) --- CHANGELOG.md | 1 + sdk/trace/batch_span_processor.go | 5 +++++ sdk/trace/batch_span_processor_test.go | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 691ed9e8c4f..e07b19348af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - If a Reader's AggregationSelector return nil or DefaultAggregation the pipeline will use the default aggregation. (#4350) - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) +- Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index 5922048fe62..c9c7effbf38 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -187,6 +187,11 @@ func (f forceFlushSpan) SpanContext() trace.SpanContext { // ForceFlush exports all ended spans that have not yet been exported. func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error { + // Interrupt if context is already canceled. + if err := ctx.Err(); err != nil { + return err + } + // Do nothing after Shutdown. if bsp.stopped.Load() { return nil diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index d4a5c2976a5..b8706ce463e 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -560,6 +560,18 @@ func TestBatchSpanProcessorForceFlushCancellation(t *testing.T) { } } +func TestBatchSpanProcessorForceFlushTimeout(t *testing.T) { + // Add timeout to context to test deadline + ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) + defer cancel() + <-ctx.Done() + + bsp := sdktrace.NewBatchSpanProcessor(indefiniteExporter{}) + if got, want := bsp.ForceFlush(ctx), context.DeadlineExceeded; !errors.Is(got, want) { + t.Errorf("expected %q error, got %v", want, got) + } +} + func TestBatchSpanProcessorForceFlushQueuedSpans(t *testing.T) { ctx := context.Background() From 859a87098c3e5e6329c4ddeb9ec6a6458aad4d21 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 27 Jul 2023 14:06:22 -0700 Subject: [PATCH 624/886] Simplify the histogram implementation (#4370) --- sdk/metric/internal/aggregate/aggregate.go | 31 +- .../internal/aggregate/aggregate_test.go | 26 +- sdk/metric/internal/aggregate/aggregator.go | 40 --- .../internal/aggregate/aggregator_test.go | 148 --------- sdk/metric/internal/aggregate/histogram.go | 145 ++++---- .../internal/aggregate/histogram_test.go | 312 +++++++++++------- 6 files changed, 277 insertions(+), 425 deletions(-) delete mode 100644 sdk/metric/internal/aggregate/aggregator.go delete mode 100644 sdk/metric/internal/aggregate/aggregator_test.go diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index 76ea3636a27..a6cceb2c253 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -16,12 +16,17 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggreg import ( "context" + "time" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +// now is used to return the current local time while allowing tests to +// override the default time.Now function. +var now = time.Now + // Measure receives measurements to be aggregated. type Measure[N int64 | float64] func(context.Context, N, attribute.Set) @@ -53,19 +58,6 @@ func (b Builder[N]) filter(f Measure[N]) Measure[N] { return f } -func (b Builder[N]) input(agg aggregator[N]) Measure[N] { - if b.Filter != nil { - fltr := b.Filter // Copy to make it immutable after assignment. - return func(_ context.Context, n N, a attribute.Set) { - fAttr, _ := a.Filter(fltr) - agg.Aggregate(n, fAttr) - } - } - return func(_ context.Context, n N, a attribute.Set) { - agg.Aggregate(n, a) - } -} - // LastValue returns a last-value aggregate function input and output. // // The Builder.Temporality is ignored and delta is use always. @@ -111,19 +103,12 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistogram, noSum bool) (Measure[N], ComputeAggregation) { - var h aggregator[N] + h := newHistogram[N](cfg, noSum) switch b.Temporality { case metricdata.DeltaTemporality: - h = newDeltaHistogram[N](cfg, noSum) + return b.filter(h.measure), h.delta default: - h = newCumulativeHistogram[N](cfg, noSum) - } - return b.input(h), func(dest *metricdata.Aggregation) int { - // TODO (#4220): optimize memory reuse here. - *dest = h.Aggregation() - - hData, _ := (*dest).(metricdata.Histogram[N]) - return len(hData.DataPoints) + return b.filter(h.measure), h.cumulative } } diff --git a/sdk/metric/internal/aggregate/aggregate_test.go b/sdk/metric/internal/aggregate/aggregate_test.go index 76ba3a26eaf..79031b40218 100644 --- a/sdk/metric/internal/aggregate/aggregate_test.go +++ b/sdk/metric/internal/aggregate/aggregate_test.go @@ -55,21 +55,12 @@ var ( } ) -type inputTester[N int64 | float64] struct { - aggregator[N] - - value N - attr attribute.Set +func TestBuilderFilter(t *testing.T) { + t.Run("Int64", testBuilderFilter[int64]()) + t.Run("Float64", testBuilderFilter[float64]()) } -func (it *inputTester[N]) Aggregate(v N, a attribute.Set) { it.value, it.attr = v, a } - -func TestBuilderInput(t *testing.T) { - t.Run("Int64", testBuilderInput[int64]()) - t.Run("Float64", testBuilderInput[float64]()) -} - -func testBuilderInput[N int64 | float64]() func(t *testing.T) { +func testBuilderFilter[N int64 | float64]() func(t *testing.T) { return func(t *testing.T) { t.Helper() @@ -78,12 +69,11 @@ func testBuilderInput[N int64 | float64]() func(t *testing.T) { return func(t *testing.T) { t.Helper() - it := &inputTester[N]{} - meas := b.input(it) + meas := b.filter(func(_ context.Context, v N, a attribute.Set) { + assert.Equal(t, value, v, "measured incorrect value") + assert.Equal(t, wantA, a, "measured incorrect attributes") + }) meas(context.Background(), value, attr) - - assert.Equal(t, value, it.value, "measured incorrect value") - assert.Equal(t, wantA, it.attr, "measured incorrect attributes") } } diff --git a/sdk/metric/internal/aggregate/aggregator.go b/sdk/metric/internal/aggregate/aggregator.go deleted file mode 100644 index fac0dfd901a..00000000000 --- a/sdk/metric/internal/aggregate/aggregator.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - -import ( - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -// now is used to return the current local time while allowing tests to -// override the default time.Now function. -var now = time.Now - -// aggregator forms an aggregation from a collection of recorded measurements. -// -// Aggregators need to be comparable so they can be de-duplicated by the SDK -// when it creates them for multiple views. -type aggregator[N int64 | float64] interface { - // Aggregate records the measurement, scoped by attr, and aggregates it - // into an aggregation. - Aggregate(measurement N, attr attribute.Set) - - // Aggregation returns an Aggregation, for all the aggregated - // measurements made and ends an aggregation cycle. - Aggregation() metricdata.Aggregation -} diff --git a/sdk/metric/internal/aggregate/aggregator_test.go b/sdk/metric/internal/aggregate/aggregator_test.go deleted file mode 100644 index 4e16175159b..00000000000 --- a/sdk/metric/internal/aggregate/aggregator_test.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" - -import ( - "strconv" - "sync" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" -) - -const ( - defaultGoroutines = 5 - defaultMeasurements = 30 - defaultCycles = 3 -) - -var carol = attribute.NewSet(attribute.String("user", "carol"), attribute.Bool("admin", false)) - -func monoIncr[N int64 | float64]() setMap[N] { - return setMap[N]{alice: 1, bob: 10, carol: 2} -} - -// setMap maps attribute sets to a number. -type setMap[N int64 | float64] map[attribute.Set]N - -// expectFunc is a function that returns an Aggregation of expected values for -// a cycle that contains m measurements (total across all goroutines). Each -// call advances the cycle. -type expectFunc func(m int) metricdata.Aggregation - -// aggregatorTester runs an acceptance test on an Aggregator. It will ask an -// Aggregator to aggregate a set of values as if they were real measurements -// made MeasurementN number of times. This will be done in GoroutineN number -// of different goroutines. After the Aggregator has been asked to aggregate -// all these measurements, it is validated using a passed expecterFunc. This -// set of operation is a single cycle, and the the aggregatorTester will run -// CycleN number of cycles. -type aggregatorTester[N int64 | float64] struct { - // GoroutineN is the number of goroutines aggregatorTester will use to run - // the test with. - GoroutineN int - // MeasurementN is the number of measurements that are made each cycle a - // goroutine runs the test. - MeasurementN int - // CycleN is the number of times a goroutine will make a set of - // measurements. - CycleN int -} - -func (at *aggregatorTester[N]) Run(a aggregator[N], incr setMap[N], eFunc expectFunc) func(*testing.T) { - m := at.MeasurementN * at.GoroutineN - return func(t *testing.T) { - t.Run("Comparable", func(t *testing.T) { - assert.NotPanics(t, func() { - _ = map[aggregator[N]]struct{}{a: {}} - }) - }) - - t.Run("CorrectnessConcurrentSafe", func(t *testing.T) { - for i := 0; i < at.CycleN; i++ { - var wg sync.WaitGroup - wg.Add(at.GoroutineN) - for j := 0; j < at.GoroutineN; j++ { - go func() { - defer wg.Done() - for k := 0; k < at.MeasurementN; k++ { - for attrs, n := range incr { - a.Aggregate(N(n), attrs) - } - } - }() - } - wg.Wait() - - metricdatatest.AssertAggregationsEqual(t, eFunc(m), a.Aggregation()) - } - }) - } -} - -var bmarkResults metricdata.Aggregation - -func benchmarkAggregatorN[N int64 | float64](b *testing.B, factory func() aggregator[N], count int) { - attrs := make([]attribute.Set, count) - for i := range attrs { - attrs[i] = attribute.NewSet(attribute.Int("value", i)) - } - - b.Run("Aggregate", func(b *testing.B) { - agg := factory() - b.ReportAllocs() - b.ResetTimer() - - for n := 0; n < b.N; n++ { - for _, attr := range attrs { - agg.Aggregate(1, attr) - } - } - bmarkResults = agg.Aggregation() - }) - - b.Run("Aggregations", func(b *testing.B) { - aggs := make([]aggregator[N], b.N) - for n := range aggs { - a := factory() - for _, attr := range attrs { - a.Aggregate(1, attr) - } - aggs[n] = a - } - - b.ReportAllocs() - b.ResetTimer() - - for n := 0; n < b.N; n++ { - bmarkResults = aggs[n].Aggregation() - } - }) -} - -func benchmarkAggregator[N int64 | float64](factory func() aggregator[N]) func(*testing.B) { - counts := []int{1, 10, 100} - return func(b *testing.B) { - for _, n := range counts { - b.Run(strconv.Itoa(n), func(b *testing.B) { - benchmarkAggregatorN(b, factory, n) - }) - } - } -} diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index 0683ff2eb23..cd030076fdc 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -15,6 +15,7 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "sort" "sync" "time" @@ -75,7 +76,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool) *histValues[ // Aggregate records the measurement value, scoped by attr, and aggregates it // into a histogram. -func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { +func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) { // This search will return an index in the range [0, len(s.bounds)], where // it will return len(s.bounds) if value is greater than the last element // of s.bounds. This aligns with the buckets in that the length of buckets @@ -106,111 +107,93 @@ func (s *histValues[N]) Aggregate(value N, attr attribute.Set) { } } -// newDeltaHistogram returns an Aggregator that summarizes a set of -// measurements as an histogram. Each histogram is scoped by attributes and -// the aggregation cycle the measurements were made in. -// -// Each aggregation cycle is treated independently. When the returned -// Aggregator's Aggregations method is called it will reset all histogram -// counts to zero. -func newDeltaHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) aggregator[N] { - return &deltaHistogram[N]{ +// newHistogram returns an Aggregator that summarizes a set of measurements as +// an histogram. +func newHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) *histogram[N] { + return &histogram[N]{ histValues: newHistValues[N](cfg.Boundaries, noSum), noMinMax: cfg.NoMinMax, start: now(), } } -// deltaHistogram summarizes a set of measurements made in a single -// aggregation cycle as an histogram with explicitly defined buckets. -type deltaHistogram[N int64 | float64] struct { +// histogram summarizes a set of measurements as an histogram with explicitly +// defined buckets. +type histogram[N int64 | float64] struct { *histValues[N] noMinMax bool start time.Time } -func (s *deltaHistogram[N]) Aggregation() metricdata.Aggregation { +func (s *histogram[N]) delta(dest *metricdata.Aggregation) int { + t := now() + + // If *dest is not a metricdata.Histogram, memory reuse is missed. In that + // case, use the zero-value h and hope for better alignment next cycle. + h, _ := (*dest).(metricdata.Histogram[N]) + h.Temporality = metricdata.DeltaTemporality + s.valuesMu.Lock() defer s.valuesMu.Unlock() - if len(s.values) == 0 { - return nil - } - - t := now() // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - h := metricdata.Histogram[N]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: make([]metricdata.HistogramDataPoint[N], 0, len(s.values)), - } + + n := len(s.values) + hDPts := reset(h.DataPoints, n, n) + + var i int for a, b := range s.values { - hdp := metricdata.HistogramDataPoint[N]{ - Attributes: a, - StartTime: s.start, - Time: t, - Count: b.count, - Bounds: bounds, - BucketCounts: b.counts, - } + hDPts[i].Attributes = a + hDPts[i].StartTime = s.start + hDPts[i].Time = t + hDPts[i].Count = b.count + hDPts[i].Bounds = bounds + hDPts[i].BucketCounts = b.counts + if !s.noSum { - hdp.Sum = b.total + hDPts[i].Sum = b.total } + if !s.noMinMax { - hdp.Min = metricdata.NewExtrema(b.min) - hdp.Max = metricdata.NewExtrema(b.max) + hDPts[i].Min = metricdata.NewExtrema(b.min) + hDPts[i].Max = metricdata.NewExtrema(b.max) } - h.DataPoints = append(h.DataPoints, hdp) // Unused attribute sets do not report. delete(s.values, a) + i++ } // The delta collection cycle resets. s.start = t - return h -} -// newCumulativeHistogram returns an Aggregator that summarizes a set of -// measurements as an histogram. Each histogram is scoped by attributes. -// -// Each aggregation cycle builds from the previous, the histogram counts are -// the bucketed counts of all values aggregated since the returned Aggregator -// was created. -func newCumulativeHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) aggregator[N] { - return &cumulativeHistogram[N]{ - histValues: newHistValues[N](cfg.Boundaries, noSum), - noMinMax: cfg.NoMinMax, - start: now(), - } + h.DataPoints = hDPts + *dest = h + + return n } -// cumulativeHistogram summarizes a set of measurements made over all -// aggregation cycles as an histogram with explicitly defined buckets. -type cumulativeHistogram[N int64 | float64] struct { - *histValues[N] +func (s *histogram[N]) cumulative(dest *metricdata.Aggregation) int { + t := now() - noMinMax bool - start time.Time -} + // If *dest is not a metricdata.Histogram, memory reuse is missed. In that + // case, use the zero-value h and hope for better alignment next cycle. + h, _ := (*dest).(metricdata.Histogram[N]) + h.Temporality = metricdata.CumulativeTemporality -func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { s.valuesMu.Lock() defer s.valuesMu.Unlock() - if len(s.values) == 0 { - return nil - } - - t := now() // Do not allow modification of our copy of bounds. bounds := make([]float64, len(s.bounds)) copy(bounds, s.bounds) - h := metricdata.Histogram[N]{ - Temporality: metricdata.CumulativeTemporality, - DataPoints: make([]metricdata.HistogramDataPoint[N], 0, len(s.values)), - } + + n := len(s.values) + hDPts := reset(h.DataPoints, n, n) + + var i int for a, b := range s.values { // The HistogramDataPoint field values returned need to be copies of // the buckets value as we will keep updating them. @@ -220,26 +203,30 @@ func (s *cumulativeHistogram[N]) Aggregation() metricdata.Aggregation { counts := make([]uint64, len(b.counts)) copy(counts, b.counts) - hdp := metricdata.HistogramDataPoint[N]{ - Attributes: a, - StartTime: s.start, - Time: t, - Count: b.count, - Bounds: bounds, - BucketCounts: counts, - } + hDPts[i].Attributes = a + hDPts[i].StartTime = s.start + hDPts[i].Time = t + hDPts[i].Count = b.count + hDPts[i].Bounds = bounds + hDPts[i].BucketCounts = counts + if !s.noSum { - hdp.Sum = b.total + hDPts[i].Sum = b.total } + if !s.noMinMax { - hdp.Min = metricdata.NewExtrema(b.min) - hdp.Max = metricdata.NewExtrema(b.max) + hDPts[i].Min = metricdata.NewExtrema(b.min) + hDPts[i].Max = metricdata.NewExtrema(b.max) } - h.DataPoints = append(h.DataPoints, hdp) + i++ // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute // sets that become "stale" need to be forgotten so this will not // overload the system. } - return h + + h.DataPoints = hDPts + *dest = h + + return n } diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index 8c75562198d..68a00f2a90f 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -15,6 +15,7 @@ package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" import ( + "context" "sort" "testing" @@ -37,74 +38,155 @@ var ( func TestHistogram(t *testing.T) { t.Cleanup(mockTime(now)) - t.Run("Int64", testHistogram[int64]) - t.Run("Float64", testHistogram[float64]) -} -func testHistogram[N int64 | float64](t *testing.T) { - tester := &aggregatorTester[N]{ - GoroutineN: defaultGoroutines, - MeasurementN: defaultMeasurements, - CycleN: defaultCycles, - } + t.Run("Int64/Delta/Sum", testDeltaHist[int64](conf[int64]{hPt: hPointSummed[int64]})) + t.Run("Int64/Delta/NoSum", testDeltaHist[int64](conf[int64]{noSum: true, hPt: hPoint[int64]})) + t.Run("Float64/Delta/Sum", testDeltaHist[float64](conf[float64]{hPt: hPointSummed[float64]})) + t.Run("Float64/Delta/NoSum", testDeltaHist[float64](conf[float64]{noSum: true, hPt: hPoint[float64]})) - incr := monoIncr[N]() - eFunc := deltaHistSummedExpecter[N](incr) - t.Run("Delta/Summed", tester.Run(newDeltaHistogram[N](histConf, false), incr, eFunc)) - eFunc = deltaHistExpecter[N](incr) - t.Run("Delta/NoSum", tester.Run(newDeltaHistogram[N](histConf, true), incr, eFunc)) - eFunc = cumuHistSummedExpecter[N](incr) - t.Run("Cumulative/Summed", tester.Run(newCumulativeHistogram[N](histConf, false), incr, eFunc)) - eFunc = cumuHistExpecter[N](incr) - t.Run("Cumulative/NoSum", tester.Run(newCumulativeHistogram[N](histConf, true), incr, eFunc)) + t.Run("Int64/Cumulative/Sum", testCumulativeHist[int64](conf[int64]{hPt: hPointSummed[int64]})) + t.Run("Int64/Cumulative/NoSum", testCumulativeHist[int64](conf[int64]{noSum: true, hPt: hPoint[int64]})) + t.Run("Float64/Cumulative/Sum", testCumulativeHist[float64](conf[float64]{hPt: hPointSummed[float64]})) + t.Run("Float64/Cumulative/NoSum", testCumulativeHist[float64](conf[float64]{noSum: true, hPt: hPoint[float64]})) } -func deltaHistSummedExpecter[N int64 | float64](incr setMap[N]) expectFunc { - h := metricdata.Histogram[N]{Temporality: metricdata.DeltaTemporality} - return func(m int) metricdata.Aggregation { - h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) - for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPointSummed[N](a, v, uint64(m))) - } - return h - } +type conf[N int64 | float64] struct { + noSum bool + hPt func(attribute.Set, N, uint64) metricdata.HistogramDataPoint[N] } -func deltaHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { - h := metricdata.Histogram[N]{Temporality: metricdata.DeltaTemporality} - return func(m int) metricdata.Aggregation { - h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) - for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint[N](a, v, uint64(m))) - } - return h - } -} - -func cumuHistSummedExpecter[N int64 | float64](incr setMap[N]) expectFunc { - var cycle int - h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} - return func(m int) metricdata.Aggregation { - cycle++ - h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) - for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPointSummed[N](a, v, uint64(cycle*m))) - } - return h - } +func testDeltaHist[N int64 | float64](c conf[N]) func(t *testing.T) { + in, out := Builder[N]{ + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + }.ExplicitBucketHistogram(histConf, c.noSum) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 2, alice}, + {ctx, 10, bob}, + {ctx, 2, alice}, + {ctx, 2, alice}, + {ctx, 10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 2, 3), + c.hPt(fltrBob, 10, 2), + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 10, alice}, + {ctx, 3, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 10, 1), + c.hPt(fltrBob, 3, 1), + }, + }, + }, + }, + { + input: []arg[N]{}, + // Delta histograms are expected to reset. + expect: output{ + n: 0, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{}, + }, + }, + }, + }) } -func cumuHistExpecter[N int64 | float64](incr setMap[N]) expectFunc { - var cycle int - h := metricdata.Histogram[N]{Temporality: metricdata.CumulativeTemporality} - return func(m int) metricdata.Aggregation { - cycle++ - h.DataPoints = make([]metricdata.HistogramDataPoint[N], 0, len(incr)) - for a, v := range incr { - h.DataPoints = append(h.DataPoints, hPoint[N](a, v, uint64(cycle*m))) - } - return h - } +func testCumulativeHist[N int64 | float64](c conf[N]) func(t *testing.T) { + in, out := Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + }.ExplicitBucketHistogram(histConf, c.noSum) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 2, alice}, + {ctx, 10, bob}, + {ctx, 2, alice}, + {ctx, 2, alice}, + {ctx, 10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 2, 3), + c.hPt(fltrBob, 10, 2), + }, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 2, alice}, + {ctx, 10, bob}, + }, + expect: output{ + n: 2, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 2, 4), + c.hPt(fltrBob, 10, 3), + }, + }, + }, + }, + { + input: []arg[N]{}, + expect: output{ + n: 2, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 2, 4), + c.hPt(fltrBob, 10, 3), + }, + }, + }, + }, + }) } // hPointSummed returns an HistogramDataPoint that started and ended now with @@ -190,93 +272,89 @@ func testBucketsSum[N int64 | float64]() func(t *testing.T) { } } -func testHistImmutableBounds[N int64 | float64](newA func(aggregation.ExplicitBucketHistogram, bool) aggregator[N], getBounds func(aggregator[N]) []float64) func(t *testing.T) { +func TestHistogramImmutableBounds(t *testing.T) { b := []float64{0, 1, 2} cpB := make([]float64, len(b)) copy(cpB, b) - a := newA(aggregation.ExplicitBucketHistogram{Boundaries: b}, false) - return func(t *testing.T) { - require.Equal(t, cpB, getBounds(a)) + h := newHistogram[int64](aggregation.ExplicitBucketHistogram{Boundaries: b}, false) + require.Equal(t, cpB, h.bounds) - b[0] = 10 - assert.Equal(t, cpB, getBounds(a), "modifying the bounds argument should not change the bounds") + b[0] = 10 + assert.Equal(t, cpB, h.bounds, "modifying the bounds argument should not change the bounds") - a.Aggregate(5, alice) - hdp := a.Aggregation().(metricdata.Histogram[N]).DataPoints[0] - hdp.Bounds[1] = 10 - assert.Equal(t, cpB, getBounds(a), "modifying the Aggregation bounds should not change the bounds") - } -} - -func TestHistogramImmutableBounds(t *testing.T) { - t.Run("Delta", testHistImmutableBounds( - newDeltaHistogram[int64], - func(a aggregator[int64]) []float64 { - deltaH := a.(*deltaHistogram[int64]) - return deltaH.bounds - }, - )) + h.measure(context.Background(), 5, alice) - t.Run("Cumulative", testHistImmutableBounds( - newCumulativeHistogram[int64], - func(a aggregator[int64]) []float64 { - cumuH := a.(*cumulativeHistogram[int64]) - return cumuH.bounds - }, - )) + var data metricdata.Aggregation = metricdata.Histogram[int64]{} + h.cumulative(&data) + hdp := data.(metricdata.Histogram[int64]).DataPoints[0] + hdp.Bounds[1] = 10 + assert.Equal(t, cpB, h.bounds, "modifying the Aggregation bounds should not change the bounds") } func TestCumulativeHistogramImutableCounts(t *testing.T) { - a := newCumulativeHistogram[int64](histConf, false) - a.Aggregate(5, alice) - hdp := a.Aggregation().(metricdata.Histogram[int64]).DataPoints[0] + h := newHistogram[int64](histConf, false) + h.measure(context.Background(), 5, alice) + + var data metricdata.Aggregation = metricdata.Histogram[int64]{} + h.cumulative(&data) + hdp := data.(metricdata.Histogram[int64]).DataPoints[0] - cumuH := a.(*cumulativeHistogram[int64]) - require.Equal(t, hdp.BucketCounts, cumuH.values[alice].counts) + require.Equal(t, hdp.BucketCounts, h.values[alice].counts) cpCounts := make([]uint64, len(hdp.BucketCounts)) copy(cpCounts, hdp.BucketCounts) hdp.BucketCounts[0] = 10 - assert.Equal(t, cpCounts, cumuH.values[alice].counts, "modifying the Aggregator bucket counts should not change the Aggregator") + assert.Equal(t, cpCounts, h.values[alice].counts, "modifying the Aggregator bucket counts should not change the Aggregator") } func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - a := newDeltaHistogram[int64](histConf, false) - assert.Nil(t, a.Aggregation()) + h := newHistogram[int64](histConf, false) + + var data metricdata.Aggregation = metricdata.Histogram[int64]{} + require.Equal(t, 0, h.delta(&data)) + require.Len(t, data.(metricdata.Histogram[int64]).DataPoints, 0) + + h.measure(context.Background(), 1, alice) - a.Aggregate(1, alice) expect := metricdata.Histogram[int64]{Temporality: metricdata.DeltaTemporality} expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](alice, 1, 1)} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) + h.delta(&data) + metricdatatest.AssertAggregationsEqual(t, expect, data) // The attr set should be forgotten once Aggregations is called. expect.DataPoints = nil - assert.Nil(t, a.Aggregation()) + assert.Equal(t, 0, h.delta(&data)) + assert.Len(t, data.(metricdata.Histogram[int64]).DataPoints, 0) // Aggregating another set should not affect the original (alice). - a.Aggregate(1, bob) + h.measure(context.Background(), 1, bob) expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](bob, 1, 1)} - metricdatatest.AssertAggregationsEqual(t, expect, a.Aggregation()) -} - -func TestEmptyHistogramNilAggregation(t *testing.T) { - assert.Nil(t, newCumulativeHistogram[int64](histConf, false).Aggregation()) - assert.Nil(t, newCumulativeHistogram[float64](histConf, false).Aggregation()) - assert.Nil(t, newDeltaHistogram[int64](histConf, false).Aggregation()) - assert.Nil(t, newDeltaHistogram[float64](histConf, false).Aggregation()) + h.delta(&data) + metricdatatest.AssertAggregationsEqual(t, expect, data) } func BenchmarkHistogram(b *testing.B) { - b.Run("Int64", benchmarkHistogram[int64]) - b.Run("Float64", benchmarkHistogram[float64]) -} - -func benchmarkHistogram[N int64 | float64](b *testing.B) { - factory := func() aggregator[N] { return newDeltaHistogram[N](histConf, false) } - b.Run("Delta", benchmarkAggregator(factory)) - factory = func() aggregator[N] { return newCumulativeHistogram[N](histConf, false) } - b.Run("Cumulative", benchmarkAggregator(factory)) + b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.ExplicitBucketHistogram(histConf, false) + })) + b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.ExplicitBucketHistogram(histConf, false) + })) + b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.ExplicitBucketHistogram(histConf, false) + })) + b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.ExplicitBucketHistogram(histConf, false) + })) } From 9418aca877581edaa5836aac316583ae23edaa12 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 29 Jul 2023 07:33:48 -0700 Subject: [PATCH 625/886] Use PeriodicReader timeout for ForceFlush (#4377) * Use PeriodicReader timeout for ForceFlush Prioritize the user passed context deadline if it has one. * Update changelog --- CHANGELOG.md | 2 +- sdk/metric/periodic_reader.go | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e07b19348af..83f78535ee6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - If an attribute set is Observed multiple times in an async callback, the values will be summed instead of the last observation winning. (#4289) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) -- `PeriodicReader.Shutdown` in `go.opentelemetry.io/otel/sdk/metric` now applies the periodic reader's timeout by default. (#4356) +- `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) ### Fixed diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index e04c1edbe18..f62a2ae41e3 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -68,7 +68,9 @@ func (o periodicReaderOptionFunc) applyPeriodic(conf periodicReaderConfig) perio // WithTimeout configures the time a PeriodicReader waits for an export to // complete before canceling it. This includes an export which occurs as part -// of Shutdown. +// of Shutdown or ForceFlush if the user passed context does not have a +// deadline. If the user passed context does have a deadline, it will be used +// instead. // // This option overrides any value set for the // OTEL_METRIC_EXPORT_TIMEOUT environment variable. @@ -298,6 +300,13 @@ func (r *PeriodicReader) export(ctx context.Context, m *metricdata.ResourceMetri // // This method is safe to call concurrently. func (r *PeriodicReader) ForceFlush(ctx context.Context) error { + // Prioritize the ctx timeout if it is set. + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, r.timeout) + defer cancel() + } + errCh := make(chan error, 1) select { case r.flushCh <- errCh: @@ -324,8 +333,13 @@ func (r *PeriodicReader) ForceFlush(ctx context.Context) error { func (r *PeriodicReader) Shutdown(ctx context.Context) error { err := ErrReaderShutdown r.shutdownOnce.Do(func() { - ctx, cancel := context.WithTimeout(ctx, r.timeout) - defer cancel() + // Prioritize the ctx timeout if it is set. + if _, ok := ctx.Deadline(); !ok { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, r.timeout) + defer cancel() + } + // Stop the run loop. r.cancel() <-r.done From bf29fc6f680621ba9afc1f44c460113dca4db48d Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 30 Jul 2023 07:40:04 -0700 Subject: [PATCH 626/886] dependabot updates Sun Jul 30 14:33:02 UTC 2023 (#4393) Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /example/otel-collector Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.56.2 to 1.57.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump go.opentelemetry.io/build-tools/crosslink from 0.9.0 to 0.10.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.9.0 to 0.10.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.9.0 to 0.10.0 in /internal/tools Bump go.opentelemetry.io/build-tools/dbotconf from 0.9.0 to 0.10.0 in /internal/tools --- bridge/opentracing/test/go.mod | 4 ++-- bridge/opentracing/test/go.sum | 8 +++---- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- internal/tools/go.mod | 12 +++++----- internal/tools/go.sum | 24 +++++++++---------- 18 files changed, 45 insertions(+), 45 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index a6890d96be2..5fae281e791 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/bridge/opentracing v1.16.0 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 ) require ( @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.9.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 4ef826058b5..84b6433927a 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -51,11 +51,11 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index c853a5090bd..a1e3e94e74e 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index e6c8f8ae224..5b599066e70 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index e6de4a05d04..dc15ccb98e4 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index 5e842f2732d..e64a9be9ae2 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e58dc4b5212..9da7b62bb1b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index f50cfdefa80..395c2e0f273 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7c81578bfd6..93ad274ed7a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -31,7 +31,7 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.57.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index f50cfdefa80..395c2e0f273 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f14b3aca25e..0fb0bdc2eeb 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 5e842f2732d..e64a9be9ae2 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index f2f6d624c2e..d34741ad73b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.56.2 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 36b9e0b392a..0ec71e1edc1 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index e1701a39210..a681ca5632b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -27,7 +27,7 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.57.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index af8b14941b7..a361fa6f5a8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -36,8 +36,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1: google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 30e82b2be69..97b3643eae4 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,10 +9,10 @@ require ( github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.9.0 - go.opentelemetry.io/build-tools/dbotconf v0.9.0 - go.opentelemetry.io/build-tools/multimod v0.9.0 - go.opentelemetry.io/build-tools/semconvgen v0.9.0 + go.opentelemetry.io/build-tools/crosslink v0.10.0 + go.opentelemetry.io/build-tools/dbotconf v0.10.0 + go.opentelemetry.io/build-tools/multimod v0.10.0 + go.opentelemetry.io/build-tools/semconvgen v0.10.0 golang.org/x/tools v0.11.0 ) @@ -63,7 +63,7 @@ require ( github.com/go-critic/go-critic v0.8.1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.7.0 // indirect + github.com/go-git/go-git/v5 v5.8.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -189,7 +189,7 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.2 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.9.0 // indirect + go.opentelemetry.io/build-tools v0.10.0 // indirect go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ece4c286518..efbe9f1b15b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -167,8 +167,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE= -github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= +github.com/go-git/go-git/v5 v5.8.0 h1:Rc543s6Tyq+YcyPwZRvU4jzZGM8rB/wWu94TnTIYALQ= +github.com/go-git/go-git/v5 v5.8.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -622,16 +622,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.9.0 h1:P6WstNx1gmj3bMFJFrJThuxFQlKztxOSCPR/2hBgkUg= -go.opentelemetry.io/build-tools v0.9.0/go.mod h1:ZoM+TLPhEhTi09/nI9YKPlU563ocHoWrQXD994N5dMc= -go.opentelemetry.io/build-tools/crosslink v0.9.0 h1:LOeJzMxsxBG2qMKeO22fRs91QvDfY+BA5pF1skTjbx0= -go.opentelemetry.io/build-tools/crosslink v0.9.0/go.mod h1:VaSi2ahs+r+v//m6OpqTkD5siSFVta9eTHhKqPsfH/Q= -go.opentelemetry.io/build-tools/dbotconf v0.9.0 h1:lEIVW6aJYgVOt/Ifyiwf0gSQvENZSvO1Mfq+hMFLeek= -go.opentelemetry.io/build-tools/dbotconf v0.9.0/go.mod h1:z+oKEld1zmGI/thdGcF6eOB8Mj5Ahde01gyLhVzgss8= -go.opentelemetry.io/build-tools/multimod v0.9.0 h1:Im9PCGhfmKQC2XR0aTYzADNiOZLk9QEQgibDhadH+i0= -go.opentelemetry.io/build-tools/multimod v0.9.0/go.mod h1:9KdBtlVebuj00X4bIt6DX1zagilSzIQmkJo8XzQ9OTQ= -go.opentelemetry.io/build-tools/semconvgen v0.9.0 h1:Tsqd5KAVI2onoX+3Bjg7rD4kA8JdBxmxTUHcAZddYKw= -go.opentelemetry.io/build-tools/semconvgen v0.9.0/go.mod h1:2kP8f7p2ecJfxuC3z+bqg5bVWRVWVuDpxkzKIAvl+wA= +go.opentelemetry.io/build-tools v0.10.0 h1:5asgwud1lI/pMYQM9P/vwEgOjyv6G3nhYnwo0znqAvA= +go.opentelemetry.io/build-tools v0.10.0/go.mod h1:GFpz8YD/DG5shfY1J2f3uuK88zr61U5rVRGOhKMDE9M= +go.opentelemetry.io/build-tools/crosslink v0.10.0 h1:lyXOJP2z3G/o+e0w00q3vkzFZw48Av1yzPOV6JJXVMY= +go.opentelemetry.io/build-tools/crosslink v0.10.0/go.mod h1:B//a0+OAU8kjgLLJnxjDNnlGv8CJt9pF/BaGc0nChvU= +go.opentelemetry.io/build-tools/dbotconf v0.10.0 h1:BKk+Q2BoHqcA9lbrbVqYeQVHPJJb+jHePoO4TIyCy3Y= +go.opentelemetry.io/build-tools/dbotconf v0.10.0/go.mod h1:SOyfUbctj4X9QakCfGy/eTlYlFo/HTNtyjJs7hHP9gE= +go.opentelemetry.io/build-tools/multimod v0.10.0 h1:jYlpTXAJCZqjzYZdEdwdDIX90qnqQvZkgaPkMt9r6BA= +go.opentelemetry.io/build-tools/multimod v0.10.0/go.mod h1:jn2a5TTq9wSR9ragaruZ2ilqOV+VerkNtNPTqwtIMyM= +go.opentelemetry.io/build-tools/semconvgen v0.10.0 h1:enthiZ2ucgEh6GdSf2FjPJh+tW7lWTKzLPS+oxxWqDY= +go.opentelemetry.io/build-tools/semconvgen v0.10.0/go.mod h1:2vdk73CHKwYfwTWMR/hthGn/5Wbsk8jNiNTI/RthNt0= go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= From 2899fcfdcaf0d5499d2659b93cee7e609da8c65d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 30 Jul 2023 13:26:17 -0700 Subject: [PATCH 627/886] Document the Reader and Exporter concurrent safe requirements (#4381) --- CHANGELOG.md | 1 + sdk/metric/exporter.go | 6 ++++++ sdk/metric/reader.go | 6 ++++++ sdk/metric/reader_test.go | 12 ++++++++++++ 4 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83f78535ee6..f73501f88d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add info and debug logging to the metric SDK. (#4315) - The `go.opentelemetry.io/otel/semconv/v1.21.0` package. The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) +- Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) ### Changed diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index b4f7c7b72f9..7efb8bf2fbe 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -30,9 +30,15 @@ var ErrExporterShutdown = fmt.Errorf("exporter is shutdown") // the final component in the metric push pipeline. type Exporter interface { // Temporality returns the Temporality to use for an instrument kind. + // + // This method needs to be concurrent safe with itself and all the other + // Exporter methods. Temporality(InstrumentKind) metricdata.Temporality // Aggregation returns the Aggregation to use for an instrument kind. + // + // This method needs to be concurrent safe with itself and all the other + // Exporter methods. Aggregation(InstrumentKind) aggregation.Aggregation // Export serializes and transmits metric data to a receiver. diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index a281104bd08..da68ef33686 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -65,9 +65,15 @@ type Reader interface { RegisterProducer(Producer) // temporality reports the Temporality for the instrument kind provided. + // + // This method needs to be concurrent safe with itself and all the other + // Reader methods. temporality(InstrumentKind) metricdata.Temporality // aggregation returns what Aggregation to use for an instrument kind. + // + // This method needs to be concurrent safe with itself and all the other + // Reader methods. aggregation(InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. // Collect gathers and returns all metric data related to the Reader from diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index d375a1b4f6c..8904d68ee40 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -168,6 +168,18 @@ func (ts *readerTestSuite) TestMethodConcurrentSafe() { var wg sync.WaitGroup const threads = 2 for i := 0; i < threads; i++ { + wg.Add(1) + go func() { + defer wg.Done() + _ = ts.Reader.temporality(InstrumentKindCounter) + }() + + wg.Add(1) + go func() { + defer wg.Done() + _ = ts.Reader.aggregation(InstrumentKindCounter) + }() + wg.Add(1) go func() { defer wg.Done() From 528a0cb34f4ca37fbdcf03a4fad91cf4d0b37832 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 2 Aug 2023 02:34:28 -0400 Subject: [PATCH 628/886] Expand the set of units supported by the prometheus exporter (#4374) --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 38 ++++++++++++++-- exporters/prometheus/exporter_test.go | 43 ++++++++++++++++--- exporters/prometheus/testdata/counter.txt | 8 ++-- .../testdata/counter_disabled_suffix.txt | 8 ++-- .../prometheus/testdata/multi_scopes.txt | 12 +++--- 6 files changed, 85 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f73501f88d8..2390da03225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/semconv/v1.21.0` package. The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) - Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) +- Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) ### Changed diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 04f26e7cb4a..4007f8915b2 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -330,9 +330,39 @@ func sanitizeRune(r rune) rune { } var unitSuffixes = map[string]string{ - "1": "_ratio", - "By": "_bytes", - "ms": "_milliseconds", + // Time + "d": "_days", + "h": "_hours", + "min": "_minutes", + "s": "_seconds", + "ms": "_milliseconds", + "us": "_microseconds", + "ns": "_nanoseconds", + + // Bytes + "By": "_bytes", + "KiBy": "_kibibytes", + "MiBy": "_mebibytes", + "GiBy": "_gibibytes", + "TiBy": "_tibibytes", + "KBy": "_kilobytes", + "MBy": "_megabytes", + "GBy": "_gigabytes", + "TBy": "_terabytes", + + // SI + "m": "_meters", + "V": "_volts", + "A": "_amperes", + "J": "_joules", + "W": "_watts", + "g": "_grams", + + // Misc + "Cel": "_celsius", + "Hz": "_hertz", + "1": "_ratio", + "%": "_percent", } // getName returns the sanitized name, prefixed with the namespace and suffixed with unit. @@ -344,7 +374,7 @@ func (c *collector) getName(m metricdata.Metrics) string { if c.withoutUnits { return name } - if suffix, ok := unitSuffixes[m.Unit]; ok { + if suffix, ok := unitSuffixes[m.Unit]; ok && !strings.HasSuffix(name, suffix) { name += suffix } return name diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index fb234aa1f26..49e4adc754b 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -55,7 +55,36 @@ func TestPrometheusExporter(t *testing.T) { counter, err := meter.Float64Counter( "foo", otelmetric.WithDescription("a simple counter"), - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), + ) + require.NoError(t, err) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) + + attrs2 := attribute.NewSet( + attribute.Key("A").String("D"), + attribute.Key("C").String("B"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) + }, + }, + { + name: "counter that already has the unit suffix", + expectedFile: "testdata/counter.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter, err := meter.Float64Counter( + "foo.seconds", + otelmetric.WithDescription("a simple counter"), + otelmetric.WithUnit("s"), ) require.NoError(t, err) counter.Add(ctx, 5, opt) @@ -85,7 +114,7 @@ func TestPrometheusExporter(t *testing.T) { counter, err := meter.Float64Counter( "foo", otelmetric.WithDescription("a simple counter without a total suffix"), - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), ) require.NoError(t, err) counter.Add(ctx, 5, opt) @@ -415,7 +444,7 @@ func TestMultiScopes(t *testing.T) { fooCounter, err := provider.Meter("meterfoo", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "foo", - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), otelmetric.WithDescription("meter foo counter")) assert.NoError(t, err) fooCounter.Add(ctx, 100, otelmetric.WithAttributes(attribute.String("type", "foo"))) @@ -423,7 +452,7 @@ func TestMultiScopes(t *testing.T) { barCounter, err := provider.Meter("meterbar", otelmetric.WithInstrumentationVersion("v0.1.0")). Int64Counter( "bar", - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), otelmetric.WithDescription("meter bar counter")) assert.NoError(t, err) barCounter.Add(ctx, 200, otelmetric.WithAttributes(attribute.String("type", "bar"))) @@ -571,7 +600,7 @@ func TestDuplicateMetrics(t *testing.T) { bazA.Add(ctx, 100, withTypeBar) bazB, err := meterB.Int64Counter("bar", - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), otelmetric.WithDescription("meter bar")) assert.NoError(t, err) bazB.Add(ctx, 100, withTypeBar) @@ -589,7 +618,7 @@ func TestDuplicateMetrics(t *testing.T) { barA.Add(ctx, 100, withTypeBar) barB, err := meterB.Int64UpDownCounter("bar", - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), otelmetric.WithDescription("meter gauge bar")) assert.NoError(t, err) barB.Add(ctx, 100, withTypeBar) @@ -607,7 +636,7 @@ func TestDuplicateMetrics(t *testing.T) { barA.Record(ctx, 100, withAB) barB, err := meterB.Int64Histogram("bar", - otelmetric.WithUnit("ms"), + otelmetric.WithUnit("s"), otelmetric.WithDescription("meter histogram bar")) assert.NoError(t, err) barB.Record(ctx, 100, withAB) diff --git a/exporters/prometheus/testdata/counter.txt b/exporters/prometheus/testdata/counter.txt index 79a1e7a5b37..4eb32991a64 100755 --- a/exporters/prometheus/testdata/counter.txt +++ b/exporters/prometheus/testdata/counter.txt @@ -1,7 +1,7 @@ -# HELP foo_milliseconds_total a simple counter -# TYPE foo_milliseconds_total counter -foo_milliseconds_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -foo_milliseconds_total{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 +# HELP foo_seconds_total a simple counter +# TYPE foo_seconds_total counter +foo_seconds_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +foo_seconds_total{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 # HELP otel_scope_info Instrumentation Scope metadata # TYPE otel_scope_info gauge otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 diff --git a/exporters/prometheus/testdata/counter_disabled_suffix.txt b/exporters/prometheus/testdata/counter_disabled_suffix.txt index 2e203b434a7..ca6f8967dfb 100755 --- a/exporters/prometheus/testdata/counter_disabled_suffix.txt +++ b/exporters/prometheus/testdata/counter_disabled_suffix.txt @@ -1,7 +1,7 @@ -# HELP foo_milliseconds a simple counter without a total suffix -# TYPE foo_milliseconds counter -foo_milliseconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 -foo_milliseconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 +# HELP foo_seconds a simple counter without a total suffix +# TYPE foo_seconds counter +foo_seconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 24.3 +foo_seconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 # HELP otel_scope_info Instrumentation Scope metadata # TYPE otel_scope_info gauge otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 diff --git a/exporters/prometheus/testdata/multi_scopes.txt b/exporters/prometheus/testdata/multi_scopes.txt index 38d84c79ede..674e1ac814c 100644 --- a/exporters/prometheus/testdata/multi_scopes.txt +++ b/exporters/prometheus/testdata/multi_scopes.txt @@ -1,9 +1,9 @@ -# HELP bar_milliseconds_total meter bar counter -# TYPE bar_milliseconds_total counter -bar_milliseconds_total{otel_scope_name="meterbar",otel_scope_version="v0.1.0",type="bar"} 200 -# HELP foo_milliseconds_total meter foo counter -# TYPE foo_milliseconds_total counter -foo_milliseconds_total{otel_scope_name="meterfoo",otel_scope_version="v0.1.0",type="foo"} 100 +# HELP bar_seconds_total meter bar counter +# TYPE bar_seconds_total counter +bar_seconds_total{otel_scope_name="meterbar",otel_scope_version="v0.1.0",type="bar"} 200 +# HELP foo_seconds_total meter foo counter +# TYPE foo_seconds_total counter +foo_seconds_total{otel_scope_name="meterfoo",otel_scope_version="v0.1.0",type="foo"} 100 # HELP otel_scope_info Instrumentation Scope metadata # TYPE otel_scope_info gauge otel_scope_info{otel_scope_name="meterfoo",otel_scope_version="v0.1.0"} 1 From 378e51e3654d9e418348c3286383771ab57f8265 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 2 Aug 2023 07:38:04 -0700 Subject: [PATCH 629/886] Do not block Temporality/Aggregation on OTLP metric export (#4395) * otlpmetricgrpc - no block temp/agg selection with export * otlpmetrichttp - no block temp/agg selection with export * Add test Export doesn't block Temporality or Aggregation * Deprecate internal New and Exporter * Add changes to changelog * Apply suggestions from code review --- CHANGELOG.md | 1 + .../otlp/otlpmetric/internal/exporter.go | 10 ++ .../otlp/otlpmetric/otlpmetricgrpc/client.go | 27 +--- .../otlpmetric/otlpmetricgrpc/client_test.go | 22 +++- .../otlpmetric/otlpmetricgrpc/exporter.go | 97 ++++++++++++-- .../otlpmetricgrpc/exporter_test.go | 124 ++++++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 26 +--- .../otlpmetric/otlpmetrichttp/client_test.go | 22 +++- .../otlpmetric/otlpmetrichttp/exporter.go | 97 ++++++++++++-- .../otlpmetrichttp/exporter_test.go | 124 ++++++++++++++++++ 10 files changed, 473 insertions(+), 77 deletions(-) create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 2390da03225..5379b63e499 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index fe4b4a7868b..f4428ac556f 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -27,6 +27,11 @@ import ( ) // Exporter exports metrics data as OTLP. +// +// Deprecated: Exporter exists for historical compatibility, it should not be +// used. Do not remove Exporter unless the whole +// "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" module is +// removed. type Exporter struct { // Ensure synchronous access to the client across all functionality. clientMu sync.Mutex @@ -96,6 +101,11 @@ func (e *Exporter) Shutdown(ctx context.Context) error { // New return an Exporter that uses client to transmits the OTLP data it // produces. The client is assumed to be fully started and able to communicate // with its OTLP receiving endpoint. +// +// Deprecated: New exists for historical compatibility, it should not be used. +// Do not remove New unless the whole +// "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" module is +// removed. func New(client Client) *Exporter { return &Exporter{client: client} } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index 34522669f47..e4e97acb750 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -27,11 +27,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metricdata" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -41,9 +37,6 @@ type client struct { exportTimeout time.Duration requestFunc retry.RequestFunc - temporalitySelector metric.TemporalitySelector - aggregationSelector metric.AggregationSelector - // ourConn keeps track of where conn was created: true if created here in // NewClient, or false if passed with an option. This is important on // Shutdown as the conn should only be closed if we created it. Otherwise, @@ -54,16 +47,11 @@ type client struct { } // newClient creates a new gRPC metric client. -func newClient(ctx context.Context, options ...Option) (ominternal.Client, error) { - cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...) - +func newClient(ctx context.Context, cfg oconf.Config) (*client, error) { c := &client{ exportTimeout: cfg.Metrics.Timeout, requestFunc: cfg.RetryConfig.RequestFunc(retryable), conn: cfg.GRPCConn, - - temporalitySelector: cfg.Metrics.TemporalitySelector, - aggregationSelector: cfg.Metrics.AggregationSelector, } if len(cfg.Metrics.Headers) > 0 { @@ -88,19 +76,6 @@ func newClient(ctx context.Context, options ...Option) (ominternal.Client, error return c, nil } -// Temporality returns the Temporality to use for an instrument kind. -func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return c.temporalitySelector(k) -} - -// Aggregation returns the Aggregation to use for an instrument kind. -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { - return c.aggregationSelector(k) -} - -// ForceFlush does nothing, the client holds no state. -func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } - // Shutdown shuts down the client, freeing all resource. // // Any active connections to a remote endpoint are closed if they were created diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 06e5fee15e9..02f87fb088a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -28,8 +28,10 @@ import ( "google.golang.org/protobuf/types/known/durationpb" ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -129,6 +131,20 @@ func TestRetryable(t *testing.T) { } } +type clientShim struct { + *client +} + +func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} +func (clientShim) Aggregation(metric.InstrumentKind) aggregation.Aggregation { + return nil +} +func (clientShim) ForceFlush(ctx context.Context) error { + return ctx.Err() +} + func TestClient(t *testing.T) { factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewGRPCCollector("", rCh) @@ -136,9 +152,11 @@ func TestClient(t *testing.T) { ctx := context.Background() addr := coll.Addr().String() - client, err := newClient(ctx, WithEndpoint(addr), WithInsecure()) + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewGRPCConfig(asGRPCOptions(opts)...) + client, err := newClient(ctx, cfg) require.NoError(t, err) - return client, coll + return clientShim{client}, coll } t.Run("Integration", otest.RunClientTests(factory)) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go index 1f28bfd6a59..8b228cc5a90 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go @@ -16,27 +16,62 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme import ( "context" + "fmt" + "sync" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) // Exporter is a OpenTelemetry metric Exporter using gRPC. type Exporter struct { - wrapped *ominternal.Exporter + // Ensure synchronous access to the client across all functionality. + clientMu sync.Mutex + client interface { + UploadMetrics(context.Context, *metricpb.ResourceMetrics) error + Shutdown(context.Context) error + } + + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector + + shutdownOnce sync.Once +} + +func newExporter(c *client, cfg oconf.Config) (*Exporter, error) { + ts := cfg.Metrics.TemporalitySelector + if ts == nil { + ts = func(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality + } + } + + as := cfg.Metrics.AggregationSelector + if as == nil { + as = metric.DefaultAggregationSelector + } + + return &Exporter{ + client: c, + + temporalitySelector: ts, + aggregationSelector: as, + }, nil } // Temporality returns the Temporality to use for an instrument kind. func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return e.wrapped.Temporality(k) + return e.temporalitySelector(k) } // Aggregation returns the Aggregation to use for an instrument kind. func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { - return e.wrapped.Aggregation(k) + return e.aggregationSelector(k) } // Export transforms and transmits metric data to an OTLP receiver. @@ -44,8 +79,20 @@ func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation // This method returns an error if called after Shutdown. // This method returns an error if the method is canceled by the passed context. func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { - err := e.wrapped.Export(ctx, rm) - global.Debug("OTLP/gRPC exporter export", "Data", rm) + defer global.Debug("OTLP/gRPC exporter export", "Data", rm) + + otlpRm, err := transform.ResourceMetrics(rm) + // Best effort upload of transformable metrics. + e.clientMu.Lock() + upErr := e.client.UploadMetrics(ctx, otlpRm) + e.clientMu.Unlock() + if upErr != nil { + if err == nil { + return fmt.Errorf("failed to upload metrics: %w", upErr) + } + // Merge the two errors. + return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr) + } return err } @@ -56,7 +103,8 @@ func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e // // This method is safe to call concurrently. func (e *Exporter) ForceFlush(ctx context.Context) error { - return e.wrapped.ForceFlush(ctx) + // The exporter and client hold no state, nothing to flush. + return ctx.Err() } // Shutdown flushes all metric data held by an exporter and releases any held @@ -67,7 +115,34 @@ func (e *Exporter) ForceFlush(ctx context.Context) error { // // This method is safe to call concurrently. func (e *Exporter) Shutdown(ctx context.Context) error { - return e.wrapped.Shutdown(ctx) + err := errShutdown + e.shutdownOnce.Do(func() { + e.clientMu.Lock() + client := e.client + e.client = shutdownClient{} + e.clientMu.Unlock() + err = client.Shutdown(ctx) + }) + return err +} + +var errShutdown = fmt.Errorf("gRPC exporter is shutdown") + +type shutdownClient struct{} + +func (c shutdownClient) err(ctx context.Context) error { + if err := ctx.Err(); err != nil { + return err + } + return errShutdown +} + +func (c shutdownClient) UploadMetrics(ctx context.Context, _ *metricpb.ResourceMetrics) error { + return c.err(ctx) +} + +func (c shutdownClient) Shutdown(ctx context.Context) error { + return c.err(ctx) } // MarshalLog returns logging data about the Exporter. @@ -84,10 +159,10 @@ func (e *Exporter) MarshalLog() interface{} { // on options. If a connection cannot be establishes in the lifetime of ctx, // an error will be returned. func New(ctx context.Context, options ...Option) (*Exporter, error) { - c, err := newClient(ctx, options...) + cfg := oconf.NewGRPCConfig(asGRPCOptions(options)...) + c, err := newClient(ctx, cfg) if err != nil { return nil, err } - exp := ominternal.New(c) - return &Exporter{exp}, nil + return newExporter(c, cfg) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go new file mode 100644 index 00000000000..299b5e33c8b --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go @@ -0,0 +1,124 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestExporterClientConcurrentSafe(t *testing.T) { + const goroutines = 5 + + coll, err := otest.NewGRPCCollector("", nil) + require.NoError(t, err) + + ctx := context.Background() + addr := coll.Addr().String() + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewGRPCConfig(asGRPCOptions(opts)...) + client, err := newClient(ctx, cfg) + require.NoError(t, err) + + exp, err := newExporter(client, oconf.Config{}) + require.NoError(t, err) + rm := new(metricdata.ResourceMetrics) + + done := make(chan struct{}) + first := make(chan struct{}, goroutines) + var wg sync.WaitGroup + for i := 0; i < goroutines; i++ { + wg.Add(1) + go func() { + defer wg.Done() + assert.NoError(t, exp.Export(ctx, rm)) + assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. + first <- struct{}{} + + for { + _ = exp.Export(ctx, rm) + _ = exp.ForceFlush(ctx) + + select { + case <-done: + return + default: + } + } + }() + } + + for i := 0; i < goroutines; i++ { + <-first + } + close(first) + assert.NoError(t, exp.Shutdown(ctx)) + assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) + + close(done) + wg.Wait() +} + +func TestExporterDoesNotBlockTemporalityAndAggregation(t *testing.T) { + rCh := make(chan otest.ExportResult, 1) + coll, err := otest.NewGRPCCollector("", rCh) + require.NoError(t, err) + + ctx := context.Background() + addr := coll.Addr().String() + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewGRPCConfig(asGRPCOptions(opts)...) + client, err := newClient(ctx, cfg) + require.NoError(t, err) + + exp, err := newExporter(client, oconf.Config{}) + require.NoError(t, err) + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + rm := new(metricdata.ResourceMetrics) + t.Log("starting export") + require.NoError(t, exp.Export(ctx, rm)) + t.Log("export complete") + }() + + assert.Eventually(t, func() bool { + const inst = metric.InstrumentKindCounter + // These should not be blocked. + t.Log("getting temporality") + _ = exp.Temporality(inst) + t.Log("getting aggregation") + _ = exp.Aggregation(inst) + return true + }, time.Second, 10*time.Millisecond) + + // Clear the export. + rCh <- otest.ExportResult{} + close(rCh) + wg.Wait() +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 81d84995aeb..01b7575eeba 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -34,9 +34,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/retry" ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" - "go.opentelemetry.io/otel/sdk/metric/metricdata" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -47,9 +44,6 @@ type client struct { compression Compression requestFunc retry.RequestFunc httpClient *http.Client - - temporalitySelector metric.TemporalitySelector - aggregationSelector metric.AggregationSelector } // Keep it in sync with golang's DefaultTransport from net/http! We @@ -70,9 +64,7 @@ var ourTransport = &http.Transport{ } // newClient creates a new HTTP metric client. -func newClient(opts ...Option) (ominternal.Client, error) { - cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) - +func newClient(cfg oconf.Config) (*client, error) { httpClient := &http.Client{ Transport: ourTransport, Timeout: cfg.Metrics.Timeout, @@ -111,25 +103,9 @@ func newClient(opts ...Option) (ominternal.Client, error) { req: req, requestFunc: cfg.RetryConfig.RequestFunc(evaluate), httpClient: httpClient, - - temporalitySelector: cfg.Metrics.TemporalitySelector, - aggregationSelector: cfg.Metrics.AggregationSelector, }, nil } -// Temporality returns the Temporality to use for an instrument kind. -func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return c.temporalitySelector(k) -} - -// Aggregation returns the Aggregation to use for an instrument kind. -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { - return c.aggregationSelector(k) -} - -// ForceFlush does nothing, the client holds no state. -func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } - // Shutdown shuts down the client, freeing all resources. func (c *client) Shutdown(ctx context.Context) error { // The otlpmetric.Exporter synchronizes access to client methods and diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index ec6bdd75916..ab89bd27a9a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -28,20 +28,38 @@ import ( "github.com/stretchr/testify/require" ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +type clientShim struct { + *client +} + +func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} +func (clientShim) Aggregation(metric.InstrumentKind) aggregation.Aggregation { + return nil +} +func (clientShim) ForceFlush(ctx context.Context) error { + return ctx.Err() +} + func TestClient(t *testing.T) { factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { coll, err := otest.NewHTTPCollector("", rCh) require.NoError(t, err) addr := coll.Addr().String() - client, err := newClient(WithEndpoint(addr), WithInsecure()) + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) + client, err := newClient(cfg) require.NoError(t, err) - return client, coll + return clientShim{client}, coll } t.Run("Integration", otest.RunClientTests(factory)) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go index 47d3c469825..be21d6b004e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go @@ -16,27 +16,62 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme import ( "context" + "fmt" + "sync" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" + metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) // Exporter is a OpenTelemetry metric Exporter using protobufs over HTTP. type Exporter struct { - wrapped *ominternal.Exporter + // Ensure synchronous access to the client across all functionality. + clientMu sync.Mutex + client interface { + UploadMetrics(context.Context, *metricpb.ResourceMetrics) error + Shutdown(context.Context) error + } + + temporalitySelector metric.TemporalitySelector + aggregationSelector metric.AggregationSelector + + shutdownOnce sync.Once +} + +func newExporter(c *client, cfg oconf.Config) (*Exporter, error) { + ts := cfg.Metrics.TemporalitySelector + if ts == nil { + ts = func(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality + } + } + + as := cfg.Metrics.AggregationSelector + if as == nil { + as = metric.DefaultAggregationSelector + } + + return &Exporter{ + client: c, + + temporalitySelector: ts, + aggregationSelector: as, + }, nil } // Temporality returns the Temporality to use for an instrument kind. func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return e.wrapped.Temporality(k) + return e.temporalitySelector(k) } // Aggregation returns the Aggregation to use for an instrument kind. func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { - return e.wrapped.Aggregation(k) + return e.aggregationSelector(k) } // Export transforms and transmits metric data to an OTLP receiver. @@ -44,8 +79,20 @@ func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation // This method returns an error if called after Shutdown. // This method returns an error if the method is canceled by the passed context. func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { - err := e.wrapped.Export(ctx, rm) - global.Debug("OTLP/HTTP exporter export", "Data", rm) + defer global.Debug("OTLP/HTTP exporter export", "Data", rm) + + otlpRm, err := transform.ResourceMetrics(rm) + // Best effort upload of transformable metrics. + e.clientMu.Lock() + upErr := e.client.UploadMetrics(ctx, otlpRm) + e.clientMu.Unlock() + if upErr != nil { + if err == nil { + return fmt.Errorf("failed to upload metrics: %w", upErr) + } + // Merge the two errors. + return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr) + } return err } @@ -56,7 +103,8 @@ func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) e // // This method is safe to call concurrently. func (e *Exporter) ForceFlush(ctx context.Context) error { - return e.wrapped.ForceFlush(ctx) + // The exporter and client hold no state, nothing to flush. + return ctx.Err() } // Shutdown flushes all metric data held by an exporter and releases any held @@ -67,7 +115,34 @@ func (e *Exporter) ForceFlush(ctx context.Context) error { // // This method is safe to call concurrently. func (e *Exporter) Shutdown(ctx context.Context) error { - return e.wrapped.Shutdown(ctx) + err := errShutdown + e.shutdownOnce.Do(func() { + e.clientMu.Lock() + client := e.client + e.client = shutdownClient{} + e.clientMu.Unlock() + err = client.Shutdown(ctx) + }) + return err +} + +var errShutdown = fmt.Errorf("HTTP exporter is shutdown") + +type shutdownClient struct{} + +func (c shutdownClient) err(ctx context.Context) error { + if err := ctx.Err(); err != nil { + return err + } + return errShutdown +} + +func (c shutdownClient) UploadMetrics(ctx context.Context, _ *metricpb.ResourceMetrics) error { + return c.err(ctx) +} + +func (c shutdownClient) Shutdown(ctx context.Context) error { + return c.err(ctx) } // MarshalLog returns logging data about the Exporter. @@ -79,10 +154,10 @@ func (e *Exporter) MarshalLog() interface{} { // a PeriodicReader to export OpenTelemetry metric data to an OTLP receiving // endpoint using protobufs over HTTP. func New(_ context.Context, opts ...Option) (*Exporter, error) { - c, err := newClient(opts...) + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) + c, err := newClient(cfg) if err != nil { return nil, err } - exp := ominternal.New(c) - return &Exporter{exp}, nil + return newExporter(c, cfg) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go new file mode 100644 index 00000000000..faf34ba1d8c --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go @@ -0,0 +1,124 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + +import ( + "context" + "sync" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestExporterClientConcurrentSafe(t *testing.T) { + const goroutines = 5 + + coll, err := otest.NewHTTPCollector("", nil) + require.NoError(t, err) + + ctx := context.Background() + addr := coll.Addr().String() + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) + client, err := newClient(cfg) + require.NoError(t, err) + + exp, err := newExporter(client, oconf.Config{}) + require.NoError(t, err) + rm := new(metricdata.ResourceMetrics) + + done := make(chan struct{}) + first := make(chan struct{}, goroutines) + var wg sync.WaitGroup + for i := 0; i < goroutines; i++ { + wg.Add(1) + go func() { + defer wg.Done() + assert.NoError(t, exp.Export(ctx, rm)) + assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. + first <- struct{}{} + + for { + _ = exp.Export(ctx, rm) + _ = exp.ForceFlush(ctx) + + select { + case <-done: + return + default: + } + } + }() + } + + for i := 0; i < goroutines; i++ { + <-first + } + close(first) + assert.NoError(t, exp.Shutdown(ctx)) + assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) + + close(done) + wg.Wait() +} + +func TestExporterDoesNotBlockTemporalityAndAggregation(t *testing.T) { + rCh := make(chan otest.ExportResult, 1) + coll, err := otest.NewHTTPCollector("", rCh) + require.NoError(t, err) + + ctx := context.Background() + addr := coll.Addr().String() + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) + client, err := newClient(cfg) + require.NoError(t, err) + + exp, err := newExporter(client, oconf.Config{}) + require.NoError(t, err) + + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + rm := new(metricdata.ResourceMetrics) + t.Log("starting export") + require.NoError(t, exp.Export(ctx, rm)) + t.Log("export complete") + }() + + assert.Eventually(t, func() bool { + const inst = metric.InstrumentKindCounter + // These should not be blocked. + t.Log("getting temporality") + _ = exp.Temporality(inst) + t.Log("getting aggregation") + _ = exp.Aggregation(inst) + return true + }, time.Second, 10*time.Millisecond) + + // Clear the export. + rCh <- otest.ExportResult{} + close(rCh) + wg.Wait() +} From c4d2d7c9b8263c76ebeb334541b821d2fa758579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 2 Aug 2023 16:52:04 +0200 Subject: [PATCH 630/886] sdk/metric: Add unit tests for Shutdown WithTimeout (#4379) * sdk/metric: Improve WithTimeout doc * Add tests --- sdk/metric/periodic_reader_test.go | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index e5b279ec238..6ac527a37ea 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -329,6 +329,52 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { _ = r.Shutdown(context.Background()) }) + t.Run("ForceFlush timeout on producer", func(t *testing.T) { + exp, called := expFunc(t) + timeout := time.Millisecond + r := NewPeriodicReader(exp, WithTimeout(timeout)) + r.register(testSDKProducer{ + produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { + select { + case <-time.After(timeout + time.Second): + *rm = testResourceMetricsA + case <-ctx.Done(): + // we timed out before we could collect metrics + return ctx.Err() + } + return nil + }}) + r.RegisterProducer(testExternalProducer{}) + assert.Equal(t, context.DeadlineExceeded, r.ForceFlush(context.Background()), "timeout error not returned") + assert.False(t, *called, "exporter Export method called when it should have failed before export") + + // Ensure Reader is allowed clean up attempt. + _ = r.Shutdown(context.Background()) + }) + + t.Run("ForceFlush timeout on external producer", func(t *testing.T) { + exp, called := expFunc(t) + timeout := time.Millisecond + r := NewPeriodicReader(exp, WithTimeout(timeout)) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{ + produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { + select { + case <-time.After(timeout + time.Second): + case <-ctx.Done(): + // we timed out before we could collect metrics + return nil, ctx.Err() + } + return []metricdata.ScopeMetrics{testScopeMetricsA}, nil + }, + }) + assert.Equal(t, context.DeadlineExceeded, r.ForceFlush(context.Background()), "timeout error not returned") + assert.False(t, *called, "exporter Export method called when it should have failed before export") + + // Ensure Reader is allowed clean up attempt. + _ = r.Shutdown(context.Background()) + }) + t.Run("Shutdown", func(t *testing.T) { exp, called := expFunc(t) r := NewPeriodicReader(exp) From 4928282877dbcb28109990a7b1e1c147ce3c6ab7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 2 Aug 2023 12:28:35 -0700 Subject: [PATCH 631/886] Decouple `otlp/otlptrace/internal` from `otlp/internal` using gotmpl (#4397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add gotmpl * Add shared retry pkg * Use template retry pkg in otlpconfig * Update license-check to look at first 4 lines * Template out all otlptrace internal * Add envconfig pkg to otlptrace/internal * Generate otlptrace/internal/otlpconfig * Revert templatizing otlptracegrpc * Add changes to changelog * Fix lint --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + Makefile | 9 +- example/otel-collector/go.mod | 3 - exporters/otlp/otlptrace/go.mod | 5 +- .../otlptrace/internal/envconfig/envconfig.go | 202 ++++++++ .../internal/envconfig/envconfig_test.go | 464 +++++++++++++++++ exporters/otlp/otlptrace/internal/gen.go | 43 ++ exporters/otlp/otlptrace/internal/header.go | 5 +- .../otlp/otlptrace/internal/header_test.go | 3 + .../internal/otlpconfig/envconfig.go | 5 +- .../otlptrace/internal/otlpconfig/options.go | 29 +- .../internal/otlpconfig/options_test.go | 200 ++++--- .../internal/otlpconfig/optiontypes.go | 3 + .../otlp/otlptrace/internal/otlpconfig/tls.go | 3 + .../internal/otlptracetest/client.go | 3 + .../internal/otlptracetest/collector.go | 3 + .../otlptrace/internal/otlptracetest/data.go | 3 + .../internal/otlptracetest/otlptest.go | 3 + .../otlp/otlptrace/internal/retry/retry.go | 156 ++++++ .../otlptrace/internal/retry/retry_test.go | 261 ++++++++++ .../internal/tracetransform/attribute.go | 3 + .../internal/tracetransform/attribute_test.go | 3 + .../tracetransform/instrumentation.go | 3 + .../internal/tracetransform/resource.go | 3 + .../internal/tracetransform/resource_test.go | 3 + .../otlptrace/internal/tracetransform/span.go | 3 + .../internal/tracetransform/span_test.go | 13 +- .../otlp/otlptrace/otlptracegrpc/client.go | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 3 - .../otlp/otlptrace/otlptracegrpc/options.go | 2 +- .../otlp/otlptrace/otlptracehttp/client.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 3 - .../otlp/otlptrace/otlptracehttp/options.go | 2 +- internal/shared/README.md | 3 + .../shared/otlp/envconfig/envconfig.go.tmpl | 202 ++++++++ .../otlp/envconfig/envconfig_test.go.tmpl | 464 +++++++++++++++++ internal/shared/otlp/otlptrace/header.go.tmpl | 28 + .../shared/otlp/otlptrace/header_test.go.tmpl | 28 + .../otlptrace/otlpconfig/envconfig.go.tmpl | 153 ++++++ .../otlp/otlptrace/otlpconfig/options.go.tmpl | 328 ++++++++++++ .../otlptrace/otlpconfig/options_test.go.tmpl | 489 ++++++++++++++++++ .../otlptrace/otlpconfig/optiontypes.go.tmpl | 51 ++ .../otlp/otlptrace/otlpconfig/tls.go.tmpl | 37 ++ .../otlptrace/otlptracetest/client.go.tmpl | 136 +++++ .../otlptrace/otlptracetest/collector.go.tmpl | 106 ++++ .../otlp/otlptrace/otlptracetest/data.go.tmpl | 66 +++ .../otlptrace/otlptracetest/otlptest.go.tmpl | 128 +++++ .../tracetransform/attribute.go.tmpl | 161 ++++++ .../tracetransform/attribute_test.go.tmpl | 261 ++++++++++ .../tracetransform/instrumentation.go.tmpl | 33 ++ .../otlptrace/tracetransform/resource.go.tmpl | 31 ++ .../tracetransform/resource_test.go.tmpl | 51 ++ .../otlptrace/tracetransform/span.go.tmpl | 208 ++++++++ .../tracetransform/span_test.go.tmpl | 336 ++++++++++++ internal/shared/otlp/retry/retry.go.tmpl | 156 ++++++ internal/shared/otlp/retry/retry_test.go.tmpl | 261 ++++++++++ internal/tools/go.mod | 1 + internal/tools/go.sum | 2 + internal/tools/tools.go | 1 + 59 files changed, 5075 insertions(+), 95 deletions(-) create mode 100644 exporters/otlp/otlptrace/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go create mode 100644 exporters/otlp/otlptrace/internal/gen.go create mode 100644 exporters/otlp/otlptrace/internal/retry/retry.go create mode 100644 exporters/otlp/otlptrace/internal/retry/retry_test.go create mode 100644 internal/shared/README.md create mode 100644 internal/shared/otlp/envconfig/envconfig.go.tmpl create mode 100644 internal/shared/otlp/envconfig/envconfig_test.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/header.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/header_test.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl create mode 100644 internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl create mode 100644 internal/shared/otlp/retry/retry.go.tmpl create mode 100644 internal/shared/otlp/retry/retry_test.go.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index 5379b63e499..096e580d736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/Makefile b/Makefile index d690e1cd32a..55b3a1df7db 100644 --- a/Makefile +++ b/Makefile @@ -71,8 +71,11 @@ $(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto GOJQ = $(TOOLS)/gojq $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq +GOTMPL = $(TOOLS)/gotmpl +$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl + .PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) # Virtualized python tools via docker @@ -115,7 +118,7 @@ generate: go-generate vanity-import-fix .PHONY: go-generate go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%) go-generate/%: DIR=$* -go-generate/%: | $(STRINGER) +go-generate/%: | $(STRINGER) $(GOTMPL) @echo "$(GO) generate $(DIR)/..." \ && cd $(DIR) \ && PATH="$(TOOLS):$${PATH}" $(GO) generate ./... @@ -227,7 +230,7 @@ codespell: | $(CODESPELL) .PHONY: license-check license-check: @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \ - awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \ + awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=4 { found=1; next } END { if (!found) print FILENAME }' $$f; \ done); \ if [ -n "$${licRes}" ]; then \ echo "license header checking failed:"; echo "$${licRes}"; \ diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index a1e3e94e74e..571485f66ce 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -21,7 +21,6 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect @@ -39,6 +38,4 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../exporters/otlp/internal/retry - replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 0fb0bdc2eeb..4aaab7c63bc 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,10 +3,10 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.19 require ( + github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v1.0.0 @@ -15,7 +15,6 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -39,6 +38,4 @@ replace go.opentelemetry.io/otel/sdk => ../../../sdk replace go.opentelemetry.io/otel/trace => ../../../trace -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry - replace go.opentelemetry.io/otel/metric => ../../../metric diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..b1db08f29c4 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/envconfig/envconfig.go @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlptrace/internal/gen.go b/exporters/otlp/otlptrace/internal/gen.go new file mode 100644 index 00000000000..7b9684c2679 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/gen.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/header.go.tmpl "--data={}" --out=header.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/header_test.go.tmpl "--data={}" --out=header_test.go + +//go:generate gotmpl --body=../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig\"}" --out=otlpconfig/envconfig.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry\"}" --out=otlpconfig/options.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig\"}" --out=otlpconfig/options_test.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl "--data={}" --out=otlpconfig/optiontypes.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl "--data={}" --out=otlpconfig/tls.go + +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl "--data={}" --out=otlptracetest/client.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go + +//go:generate gotmpl --body=../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl "--data={}" --out=tracetransform/attribute.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl "--data={}" --out=tracetransform/attribute_test.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl "--data={}" --out=tracetransform/instrumentation.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl "--data={}" --out=tracetransform/resource.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl "--data={}" --out=tracetransform/resource_test.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl "--data={}" --out=tracetransform/span.go +//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl "--data={}" --out=tracetransform/span_test.go diff --git a/exporters/otlp/otlptrace/internal/header.go b/exporters/otlp/otlptrace/internal/header.go index 36d3ca8e1c2..44cea4cbd9f 100644 --- a/exporters/otlp/otlptrace/internal/header.go +++ b/exporters/otlp/otlptrace/internal/header.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/header.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,7 +21,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" ) -// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" +// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{ .Version }" // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent func GetUserAgentHeader() string { return "OTel OTLP Exporter Go/" + otlptrace.Version() diff --git a/exporters/otlp/otlptrace/internal/header_test.go b/exporters/otlp/otlptrace/internal/header_test.go index d93340fc0d6..4c80b9c28f8 100644 --- a/exporters/otlp/otlptrace/internal/header_test.go +++ b/exporters/otlp/otlptrace/internal/header_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/header_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 62c5029db2a..6e85501dc1d 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +26,7 @@ import ( "strings" "time" - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" ) // DefaultEnvOptionsReader is the default environments reader. diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index 1a6bb423b30..e5f396e6fe8 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +20,8 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "path" + "strings" "time" "google.golang.org/grpc" @@ -25,9 +30,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" ) const ( @@ -83,13 +87,28 @@ func NewHTTPConfig(opts ...HTTPOption) Config { for _, opt := range opts { cfg = opt.ApplyHTTPOption(cfg) } - cfg.Traces.URLPath = internal.CleanPath(cfg.Traces.URLPath, DefaultTracesPath) + cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) return cfg } +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() cfg := Config{ Traces: SignalConfig{ Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), @@ -98,7 +117,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config { Timeout: DefaultTimeout, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(otinternal.GetUserAgentHeader())}, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index adbdc932f53..34b04d36f11 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package otlpconfig_test +package otlpconfig import ( "errors" @@ -21,8 +24,7 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" ) const ( @@ -64,25 +66,25 @@ func (f *fileReader) readFile(filename string) ([]byte, error) { } func TestConfigs(t *testing.T) { - tlsCert, err := otlpconfig.CreateTLSConfig([]byte(WeakCertificate)) + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) assert.NoError(t, err) tests := []struct { name string - opts []otlpconfig.GenericOption + opts []GenericOption env env fileReader fileReader - asserts func(t *testing.T, c *otlpconfig.Config, grpcOption bool) + asserts func(t *testing.T, c *Config, grpcOption bool) }{ { name: "Test default configs", - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { assert.Equal(t, "localhost:4317", c.Traces.Endpoint) } else { assert.Equal(t, "localhost:4318", c.Traces.Endpoint) } - assert.Equal(t, otlpconfig.NoCompression, c.Traces.Compression) + assert.Equal(t, NoCompression, c.Traces.Compression) assert.Equal(t, map[string]string(nil), c.Traces.Headers) assert.Equal(t, 10*time.Second, c.Traces.Timeout) }, @@ -91,10 +93,10 @@ func TestConfigs(t *testing.T) { // Endpoint Tests { name: "Test With Endpoint", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithEndpoint("someendpoint"), + opts: []GenericOption{ + WithEndpoint("someendpoint"), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "someendpoint", c.Traces.Endpoint) }, }, @@ -103,7 +105,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.False(t, c.Traces.Insecure) if grpcOption { assert.Equal(t, "env.endpoint/prefix", c.Traces.Endpoint) @@ -119,7 +121,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://env.traces.endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.True(t, c.Traces.Insecure) assert.Equal(t, "env.traces.endpoint", c.Traces.Endpoint) if !grpcOption { @@ -129,13 +131,13 @@ func TestConfigs(t *testing.T) { }, { name: "Test Mixed Environment and With Endpoint", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithEndpoint("traces_endpoint"), + opts: []GenericOption{ + WithEndpoint("traces_endpoint"), }, env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "traces_endpoint", c.Traces.Endpoint) }, }, @@ -144,7 +146,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Traces.Endpoint) assert.Equal(t, true, c.Traces.Insecure) }, @@ -154,7 +156,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Traces.Endpoint) assert.Equal(t, true, c.Traces.Insecure) }, @@ -164,7 +166,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "env_endpoint", c.Traces.Endpoint) assert.Equal(t, false, c.Traces.Insecure) }, @@ -175,7 +177,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "HtTp://env_traces_endpoint", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, "env_traces_endpoint", c.Traces.Endpoint) assert.Equal(t, true, c.Traces.Insecure) }, @@ -184,7 +186,7 @@ func TestConfigs(t *testing.T) { // Certificate tests { name: "Test Default Certificate", - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { @@ -194,10 +196,10 @@ func TestConfigs(t *testing.T) { }, { name: "Test With Certificate", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTLSClientConfig(tlsCert), + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { //TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Traces.GRPCCredentials) @@ -215,7 +217,7 @@ func TestConfigs(t *testing.T) { fileReader: fileReader{ "cert_path": []byte(WeakCertificate), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { @@ -234,7 +236,7 @@ func TestConfigs(t *testing.T) { "cert_path": []byte(WeakCertificate), "invalid_cert": []byte("invalid certificate file."), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { @@ -245,14 +247,14 @@ func TestConfigs(t *testing.T) { }, { name: "Test Mixed Environment and With Certificate", - opts: []otlpconfig.GenericOption{}, + opts: []GenericOption{}, env: map[string]string{ "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", }, fileReader: fileReader{ "cert_path": []byte(WeakCertificate), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { assert.NotNil(t, c.Traces.GRPCCredentials) } else { @@ -265,17 +267,17 @@ func TestConfigs(t *testing.T) { // Headers tests { name: "Test With Headers", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithHeaders(map[string]string{"h1": "v1"}), + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1"}, c.Traces.Headers) }, }, { name: "Test Environment Headers", env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) }, }, @@ -285,15 +287,15 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", "OTEL_EXPORTER_OTLP_TRACES_HEADERS": "h1=v1,h2=v2", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) }, }, { name: "Test Mixed Environment and With Headers", env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - opts: []otlpconfig.GenericOption{}, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) }, }, @@ -301,11 +303,11 @@ func TestConfigs(t *testing.T) { // Compression Tests { name: "Test With Compression", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithCompression(otlpconfig.GzipCompression), + opts: []GenericOption{ + WithCompression(GzipCompression), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Traces.Compression) + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) }, }, { @@ -313,8 +315,8 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Traces.Compression) + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) }, }, { @@ -322,30 +324,30 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.GzipCompression, c.Traces.Compression) + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) }, }, { name: "Test Mixed Environment and With Compression", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithCompression(otlpconfig.NoCompression), + opts: []GenericOption{ + WithCompression(NoCompression), }, env: map[string]string{ "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { - assert.Equal(t, otlpconfig.NoCompression, c.Traces.Compression) + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Traces.Compression) }, }, // Timeout Tests { name: "Test With Timeout", - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTimeout(time.Duration(5 * time.Second)), + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, 5*time.Second, c.Traces.Timeout) }, }, @@ -354,7 +356,7 @@ func TestConfigs(t *testing.T) { env: map[string]string{ "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, c.Traces.Timeout, 15*time.Second) }, }, @@ -364,7 +366,7 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, c.Traces.Timeout, 27*time.Second) }, }, @@ -374,10 +376,10 @@ func TestConfigs(t *testing.T) { "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", }, - opts: []otlpconfig.GenericOption{ - otlpconfig.WithTimeout(5 * time.Second), + opts: []GenericOption{ + WithTimeout(5 * time.Second), }, - asserts: func(t *testing.T, c *otlpconfig.Config, grpcOption bool) { + asserts: func(t *testing.T, c *Config, grpcOption bool) { assert.Equal(t, c.Traces.Timeout, 5*time.Second) }, }, @@ -385,37 +387,103 @@ func TestConfigs(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - origEOR := otlpconfig.DefaultEnvOptionsReader - otlpconfig.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ GetEnv: tt.env.getEnv, ReadFile: tt.fileReader.readFile, Namespace: "OTEL_EXPORTER_OTLP", } - t.Cleanup(func() { otlpconfig.DefaultEnvOptionsReader = origEOR }) + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) // Tests Generic options as HTTP Options - cfg := otlpconfig.NewHTTPConfig(asHTTPOptions(tt.opts)...) + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) tt.asserts(t, &cfg, false) // Tests Generic options as gRPC Options - cfg = otlpconfig.NewGRPCConfig(asGRPCOptions(tt.opts)...) + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) tt.asserts(t, &cfg, true) }) } } -func asHTTPOptions(opts []otlpconfig.GenericOption) []otlpconfig.HTTPOption { - converted := make([]otlpconfig.HTTPOption, len(opts)) +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) for i, o := range opts { - converted[i] = otlpconfig.NewHTTPOption(o.ApplyHTTPOption) + converted[i] = NewHTTPOption(o.ApplyHTTPOption) } return converted } -func asGRPCOptions(opts []otlpconfig.GenericOption) []otlpconfig.GRPCOption { - converted := make([]otlpconfig.GRPCOption, len(opts)) +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) for i, o := range opts { - converted[i] = otlpconfig.NewGRPCOption(o.ApplyGRPCOption) + converted[i] = NewGRPCOption(o.ApplyGRPCOption) } return converted } + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go index c2d6c036152..1d276083d85 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go b/exporters/otlp/otlptrace/internal/otlpconfig/tls.go index 7287cf6cfeb..ac7b9a4cc12 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/tls.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/internal/otlptracetest/client.go index aedb8f4a9d2..69ec2bbd8ea 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/client.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/client.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go index 865fabba27d..d60e56829a0 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/data.go b/exporters/otlp/otlptrace/internal/otlptracetest/data.go index d039105cb29..1da7ad7fc2c 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/data.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/data.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go index 91c098d1539..09e8f75d728 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/retry/retry.go b/exporters/otlp/otlptrace/internal/retry/retry.go new file mode 100644 index 00000000000..a8abb55ab2e --- /dev/null +++ b/exporters/otlp/otlptrace/internal/retry/retry.go @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/exporters/otlp/otlptrace/internal/retry/retry_test.go b/exporters/otlp/otlptrace/internal/retry/retry_test.go new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/exporters/otlp/otlptrace/internal/retry/retry_test.go @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index ec74f1aad75..ff5e1016ee9 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go index 3f335f12392..bdba00a833d 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 7aaec38d22a..9bc6faa2f3e 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/resource.go b/exporters/otlp/otlptrace/internal/tracetransform/resource.go index 05a1f78adbc..7414e2ba93f 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/resource.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/resource.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go b/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go index f214cd6f891..13628d63b2d 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index b83cbd72478..02ce59e3eab 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index c01fb1460fe..df26af006ee 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -311,7 +314,9 @@ func TestSpanData(t *testing.T) { // Empty parent span ID should be treated as root span. func TestRootSpanData(t *testing.T) { - sd := Spans(tracetest.SpanStubs{{}}.Snapshots()) + sd := Spans(tracetest.SpanStubs{ + {}, + }.Snapshots()) require.Len(t, sd, 1) rs := sd[0] scopeSpans := rs.GetScopeSpans() @@ -323,5 +328,9 @@ func TestRootSpanData(t *testing.T) { } func TestSpanDataNilResource(t *testing.T) { - assert.NotPanics(t, func() { Spans(tracetest.SpanStubs{{}}.Snapshots()) }) + assert.NotPanics(t, func() { + Spans(tracetest.SpanStubs{ + {}, + }.Snapshots()) + }) } diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 5b30fe03cbb..4aa430b0d71 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -28,9 +28,9 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index d34741ad73b..02765d26f24 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,7 +5,6 @@ go 1.19 require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/proto/otlp v1.0.0 @@ -40,6 +39,4 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../ replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry - replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 3d09ce590d0..566bf30e673 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -22,8 +22,8 @@ import ( "google.golang.org/grpc/credentials" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" ) // Option applies an option to the gRPC driver. diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index be21724212b..96e10d4f15c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -31,10 +31,10 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index a681ca5632b..f15ae340b43 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,7 +5,6 @@ go 1.19 require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 @@ -39,6 +38,4 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/trace => ../../../../trace -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry - replace go.opentelemetry.io/otel/metric => ../../../../metric diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index 4257ce3473f..c9d58984b16 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -18,8 +18,8 @@ import ( "crypto/tls" "time" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" ) // Compression describes the compression used for payloads sent to the diff --git a/internal/shared/README.md b/internal/shared/README.md new file mode 100644 index 00000000000..3829811c558 --- /dev/null +++ b/internal/shared/README.md @@ -0,0 +1,3 @@ +# Shared + +Code under this directory contains reusable internal code which is distributed across packages using `//go:generate gotmpl` in `gen.go` files. diff --git a/internal/shared/otlp/envconfig/envconfig.go.tmpl b/internal/shared/otlp/envconfig/envconfig.go.tmpl new file mode 100644 index 00000000000..480f5f3cfd0 --- /dev/null +++ b/internal/shared/otlp/envconfig/envconfig.go.tmpl @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/internal/shared/otlp/envconfig/envconfig_test.go.tmpl b/internal/shared/otlp/envconfig/envconfig_test.go.tmpl new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/internal/shared/otlp/envconfig/envconfig_test.go.tmpl @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/internal/shared/otlp/otlptrace/header.go.tmpl b/internal/shared/otlp/otlptrace/header.go.tmpl new file mode 100644 index 00000000000..c8ad7a00efb --- /dev/null +++ b/internal/shared/otlp/otlptrace/header.go.tmpl @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/header.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{ .Version }" +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent +func GetUserAgentHeader() string { + return "OTel OTLP Exporter Go/" + otlptrace.Version() +} diff --git a/internal/shared/otlp/otlptrace/header_test.go.tmpl b/internal/shared/otlp/otlptrace/header_test.go.tmpl new file mode 100644 index 00000000000..4c80b9c28f8 --- /dev/null +++ b/internal/shared/otlp/otlptrace/header_test.go.tmpl @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/header_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetUserAgentHeader(t *testing.T) { + require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", GetUserAgentHeader()) +} diff --git a/internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl new file mode 100644 index 00000000000..6b9e1b27e49 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl @@ -0,0 +1,153 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "{{ .envconfigImportPath }}" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("TRACES_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Traces.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("TRACES_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("TRACES_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + ) + + return opts +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl new file mode 100644 index 00000000000..99d9e4804e9 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl @@ -0,0 +1,328 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "{{ .retryImportPath }}" +) + +const ( + // DefaultTracesPath is a default URL path for endpoint that + // receives spans. + DefaultTracesPath string = "/v1/traces" + // DefaultTimeout is a default max waiting time for the backend to process + // each span batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + } + + Config struct { + // Signal specific configurations + Traces SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Traces.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials)) + } else if cfg.Traces.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Traces.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Traces.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Traces.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Traces.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Timeout = duration + return cfg + }) +} diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl new file mode 100644 index 00000000000..fcf99f0ad42 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl @@ -0,0 +1,489 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "{{ .envconfigImportPath }}" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, NoCompression, c.Traces.Compression) + assert.Equal(t, map[string]string(nil), c.Traces.Headers) + assert.Equal(t, 10*time.Second, c.Traces.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Traces.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Traces.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Traces.Endpoint) + assert.Equal(t, "/prefix/v1/traces", c.Traces.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://env.traces.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Traces.Insecure) + assert.Equal(t, "env.traces.endpoint", c.Traces.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Traces.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("traces_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "traces_endpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "HtTp://env_traces_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_traces_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + assert.Nil(t, c.Traces.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Traces.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Traces.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 27*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 5*time.Second) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl new file mode 100644 index 00000000000..6edfa85e181 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl @@ -0,0 +1,51 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// Marshaler describes the kind of message format sent to the collector. +type Marshaler int + +const ( + // MarshalProto tells the driver to send using the protobuf binary format. + MarshalProto Marshaler = iota + // MarshalJSON tells the driver to send using json format. + MarshalJSON +) diff --git a/internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl new file mode 100644 index 00000000000..767ae5d52d4 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl @@ -0,0 +1,37 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" +) + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl b/internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl new file mode 100644 index 00000000000..598d594069b --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl @@ -0,0 +1,136 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +func RunExporterShutdownTest(t *testing.T, factory func() otlptrace.Client) { + t.Run("testClientStopHonorsTimeout", func(t *testing.T) { + testClientStopHonorsTimeout(t, factory()) + }) + + t.Run("testClientStopHonorsCancel", func(t *testing.T) { + testClientStopHonorsCancel(t, factory()) + }) + + t.Run("testClientStopNoError", func(t *testing.T) { + testClientStopNoError(t, factory()) + }) + + t.Run("testClientStopManyTimes", func(t *testing.T) { + testClientStopManyTimes(t, factory()) + }) +} + +func initializeExporter(t *testing.T, client otlptrace.Client) *otlptrace.Exporter { + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + e, err := otlptrace.New(ctx, client) + if err != nil { + t.Fatalf("failed to create exporter") + } + + return e +} + +func testClientStopHonorsTimeout(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) + defer cancel() + <-ctx.Done() + + if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { + t.Errorf("expected context DeadlineExceeded error, got %v", err) + } +} + +func testClientStopHonorsCancel(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) { + t.Errorf("expected context canceled error, got %v", err) + } +} + +func testClientStopNoError(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + if err := e.Shutdown(ctx); err != nil { + t.Errorf("shutdown errored: expected nil, got %v", err) + } +} + +func testClientStopManyTimes(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + ch := make(chan struct{}) + wg := sync.WaitGroup{} + const num int = 20 + wg.Add(num) + errs := make([]error, num) + for i := 0; i < num; i++ { + go func(idx int) { + defer wg.Done() + <-ch + errs[idx] = e.Shutdown(ctx) + }(i) + } + close(ch) + wg.Wait() + for _, err := range errs { + if err != nil { + t.Errorf("failed to shutdown exporter: %v", err) + return + } + } +} diff --git a/internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl b/internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl new file mode 100644 index 00000000000..f5075d4f287 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest + +import ( + "sort" + + collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" + resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +// TracesCollector mocks a collector for the end-to-end testing. +type TracesCollector interface { + Stop() error + GetResourceSpans() []*tracepb.ResourceSpans +} + +// SpansStorage stores the spans. Mock collectors can use it to +// store spans they have received. +type SpansStorage struct { + rsm map[string]*tracepb.ResourceSpans + spanCount int +} + +// NewSpansStorage creates a new spans storage. +func NewSpansStorage() SpansStorage { + return SpansStorage{ + rsm: make(map[string]*tracepb.ResourceSpans), + } +} + +// AddSpans adds spans to the spans storage. +func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequest) { + for _, rs := range request.GetResourceSpans() { + rstr := resourceString(rs.Resource) + if existingRs, ok := s.rsm[rstr]; !ok { + s.rsm[rstr] = rs + // TODO (rghetia): Add support for library Info. + if len(rs.ScopeSpans) == 0 { + rs.ScopeSpans = []*tracepb.ScopeSpans{ + { + Spans: []*tracepb.Span{}, + }, + } + } + s.spanCount += len(rs.ScopeSpans[0].Spans) + } else { + if len(rs.ScopeSpans) > 0 { + newSpans := rs.ScopeSpans[0].GetSpans() + existingRs.ScopeSpans[0].Spans = append(existingRs.ScopeSpans[0].Spans, newSpans...) + s.spanCount += len(newSpans) + } + } + } +} + +// GetSpans returns the stored spans. +func (s *SpansStorage) GetSpans() []*tracepb.Span { + spans := make([]*tracepb.Span, 0, s.spanCount) + for _, rs := range s.rsm { + spans = append(spans, rs.ScopeSpans[0].Spans...) + } + return spans +} + +// GetResourceSpans returns the stored resource spans. +func (s *SpansStorage) GetResourceSpans() []*tracepb.ResourceSpans { + rss := make([]*tracepb.ResourceSpans, 0, len(s.rsm)) + for _, rs := range s.rsm { + rss = append(rss, rs) + } + return rss +} + +func resourceString(res *resourcepb.Resource) string { + sAttrs := sortedAttributes(res.GetAttributes()) + rstr := "" + for _, attr := range sAttrs { + rstr = rstr + attr.String() + } + return rstr +} + +func sortedAttributes(attrs []*commonpb.KeyValue) []*commonpb.KeyValue { + sort.Slice(attrs[:], func(i, j int) bool { + return attrs[i].Key < attrs[j].Key + }) + return attrs +} diff --git a/internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl b/internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl new file mode 100644 index 00000000000..bbdfe2e71b2 --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl @@ -0,0 +1,66 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" + tracesdk "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" + "go.opentelemetry.io/otel/trace" +) + +// SingleReadOnlySpan returns a one-element slice with a read-only span. It +// may be useful for testing driver's trace export. +func SingleReadOnlySpan() []tracesdk.ReadOnlySpan { + return tracetest.SpanStubs{ + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{3, 4, 5, 6, 7, 8, 9, 0}, + TraceFlags: trace.FlagsSampled, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{1, 2, 3, 4, 5, 6, 7, 8}, + TraceFlags: trace.FlagsSampled, + }), + SpanKind: trace.SpanKindInternal, + Name: "foo", + StartTime: time.Date(2020, time.December, 8, 20, 23, 0, 0, time.UTC), + EndTime: time.Date(2020, time.December, 0, 20, 24, 0, 0, time.UTC), + Attributes: []attribute.KeyValue{}, + Events: []tracesdk.Event{}, + Links: []tracesdk.Link{}, + Status: tracesdk.Status{Code: codes.Ok}, + DroppedAttributes: 0, + DroppedEvents: 0, + DroppedLinks: 0, + ChildSpanCount: 0, + Resource: resource.NewSchemaless(attribute.String("a", "b")), + InstrumentationLibrary: instrumentation.Library{ + Name: "bar", + Version: "0.0.0", + }, + }, + }.Snapshots() +} diff --git a/internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl b/internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl new file mode 100644 index 00000000000..00e6ff9569b --- /dev/null +++ b/internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl @@ -0,0 +1,128 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest + +import ( + "context" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// RunEndToEndTest can be used by otlptrace.Client tests to validate +// themselves. +func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, tracesCollector TracesCollector) { + pOpts := []sdktrace.TracerProviderOption{ + sdktrace.WithSampler(sdktrace.AlwaysSample()), + sdktrace.WithBatcher( + exp, + // add following two options to ensure flush + sdktrace.WithBatchTimeout(5*time.Second), + sdktrace.WithMaxExportBatchSize(10), + ), + } + tp1 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv11)"), + attribute.Int64("rk2", 5), + )))...) + + tp2 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv12)"), + attribute.Float64("rk3", 6.5), + )))...) + + tr1 := tp1.Tracer("test-tracer1") + tr2 := tp2.Tracer("test-tracer2") + // Now create few spans + m := 4 + for i := 0; i < m; i++ { + _, span := tr1.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + + _, span = tr2.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + } + + func() { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := tp1.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 1: %v", err) + } + if err := tp2.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 2: %v", err) + } + }() + + // Wait >2 cycles. + <-time.After(40 * time.Millisecond) + + // Now shutdown the exporter + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := exp.Shutdown(ctx); err != nil { + t.Fatalf("failed to stop the exporter: %v", err) + } + + // Shutdown the collector too so that we can begin + // verification checks of expected data back. + if err := tracesCollector.Stop(); err != nil { + t.Fatalf("failed to stop the mock collector: %v", err) + } + + // Now verify that we only got two resources + rss := tracesCollector.GetResourceSpans() + if got, want := len(rss), 2; got != want { + t.Fatalf("resource span count: got %d, want %d\n", got, want) + } + + // Now verify spans and attributes for each resource span. + for _, rs := range rss { + if len(rs.ScopeSpans) == 0 { + t.Fatalf("zero ScopeSpans") + } + if got, want := len(rs.ScopeSpans[0].Spans), m; got != want { + t.Fatalf("span counts: got %d, want %d", got, want) + } + attrMap := map[int64]bool{} + for _, s := range rs.ScopeSpans[0].Spans { + if gotName, want := s.Name, "AlwaysSample"; gotName != want { + t.Fatalf("span name: got %s, want %s", gotName, want) + } + attrMap[s.Attributes[0].Value.Value.(*commonpb.AnyValue_IntValue).IntValue] = true + } + if got, want := len(attrMap), m; got != want { + t.Fatalf("span attribute unique values: got %d want %d", got, want) + } + for i := 0; i < m; i++ { + _, ok := attrMap[int64(i)] + if !ok { + t.Fatalf("span with attribute %d missing", i) + } + } + } +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl new file mode 100644 index 00000000000..507e520d679 --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl @@ -0,0 +1,161 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/resource" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. +func KeyValues(attrs []attribute.KeyValue) []*commonpb.KeyValue { + if len(attrs) == 0 { + return nil + } + + out := make([]*commonpb.KeyValue, 0, len(attrs)) + for _, kv := range attrs { + out = append(out, KeyValue(kv)) + } + return out +} + +// Iterator transforms an attribute iterator into OTLP key-values. +func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { + l := iter.Len() + if l == 0 { + return nil + } + + out := make([]*commonpb.KeyValue, 0, l) + for iter.Next() { + out = append(out, KeyValue(iter.Attribute())) + } + return out +} + +// ResourceAttributes transforms a Resource OTLP key-values. +func ResourceAttributes(res *resource.Resource) []*commonpb.KeyValue { + return Iterator(res.Iter()) +} + +// KeyValue transforms an attribute KeyValue into an OTLP key-value. +func KeyValue(kv attribute.KeyValue) *commonpb.KeyValue { + return &commonpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} +} + +// Value transforms an attribute Value into an OTLP AnyValue. +func Value(v attribute.Value) *commonpb.AnyValue { + av := new(commonpb.AnyValue) + switch v.Type() { + case attribute.BOOL: + av.Value = &commonpb.AnyValue_BoolValue{ + BoolValue: v.AsBool(), + } + case attribute.BOOLSLICE: + av.Value = &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: boolSliceValues(v.AsBoolSlice()), + }, + } + case attribute.INT64: + av.Value = &commonpb.AnyValue_IntValue{ + IntValue: v.AsInt64(), + } + case attribute.INT64SLICE: + av.Value = &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: int64SliceValues(v.AsInt64Slice()), + }, + } + case attribute.FLOAT64: + av.Value = &commonpb.AnyValue_DoubleValue{ + DoubleValue: v.AsFloat64(), + } + case attribute.FLOAT64SLICE: + av.Value = &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: float64SliceValues(v.AsFloat64Slice()), + }, + } + case attribute.STRING: + av.Value = &commonpb.AnyValue_StringValue{ + StringValue: v.AsString(), + } + case attribute.STRINGSLICE: + av.Value = &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: stringSliceValues(v.AsStringSlice()), + }, + } + default: + av.Value = &commonpb.AnyValue_StringValue{ + StringValue: "INVALID", + } + } + return av +} + +func boolSliceValues(vals []bool) []*commonpb.AnyValue { + converted := make([]*commonpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &commonpb.AnyValue{ + Value: &commonpb.AnyValue_BoolValue{ + BoolValue: v, + }, + } + } + return converted +} + +func int64SliceValues(vals []int64) []*commonpb.AnyValue { + converted := make([]*commonpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: v, + }, + } + } + return converted +} + +func float64SliceValues(vals []float64) []*commonpb.AnyValue { + converted := make([]*commonpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &commonpb.AnyValue{ + Value: &commonpb.AnyValue_DoubleValue{ + DoubleValue: v, + }, + } + } + return converted +} + +func stringSliceValues(vals []string) []*commonpb.AnyValue { + converted := make([]*commonpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &commonpb.AnyValue{ + Value: &commonpb.AnyValue_StringValue{ + StringValue: v, + }, + } + } + return converted +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl new file mode 100644 index 00000000000..bdba00a833d --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +type attributeTest struct { + attrs []attribute.KeyValue + expected []*commonpb.KeyValue +} + +func TestAttributes(t *testing.T) { + for _, test := range []attributeTest{ + {nil, nil}, + { + []attribute.KeyValue{ + attribute.Int("int to int", 123), + attribute.Int64("int64 to int64", 1234567), + attribute.Float64("float64 to double", 1.61), + attribute.String("string to string", "string"), + attribute.Bool("bool to bool", true), + }, + []*commonpb.KeyValue{ + { + Key: "int to int", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: 123, + }, + }, + }, + { + Key: "int64 to int64", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: 1234567, + }, + }, + }, + { + Key: "float64 to double", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_DoubleValue{ + DoubleValue: 1.61, + }, + }, + }, + { + Key: "string to string", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_StringValue{ + StringValue: "string", + }, + }, + }, + { + Key: "bool to bool", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_BoolValue{ + BoolValue: true, + }, + }, + }, + }, + }, + } { + got := KeyValues(test.attrs) + if !assert.Len(t, got, len(test.expected)) { + continue + } + for i, actual := range got { + if a, ok := actual.Value.Value.(*commonpb.AnyValue_DoubleValue); ok { + e, ok := test.expected[i].Value.Value.(*commonpb.AnyValue_DoubleValue) + if !ok { + t.Errorf("expected AnyValue_DoubleValue, got %T", test.expected[i].Value.Value) + continue + } + if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { + continue + } + e.DoubleValue = a.DoubleValue + } + assert.Equal(t, test.expected[i], actual) + } + } +} + +func TestArrayAttributes(t *testing.T) { + // Array KeyValue supports only arrays of primitive types: + // "bool", "int", "int64", + // "float64", "string", + for _, test := range []attributeTest{ + {nil, nil}, + { + []attribute.KeyValue{ + { + Key: attribute.Key("invalid"), + Value: attribute.Value{}, + }, + }, + []*commonpb.KeyValue{ + { + Key: "invalid", + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_StringValue{ + StringValue: "INVALID", + }, + }, + }, + }, + }, + { + []attribute.KeyValue{ + attribute.BoolSlice("bool slice to bool array", []bool{true, false}), + attribute.IntSlice("int slice to int64 array", []int{1, 2, 3}), + attribute.Int64Slice("int64 slice to int64 array", []int64{1, 2, 3}), + attribute.Float64Slice("float64 slice to double array", []float64{1.11, 2.22, 3.33}), + attribute.StringSlice("string slice to string array", []string{"foo", "bar", "baz"}), + }, + []*commonpb.KeyValue{ + newOTelBoolArray("bool slice to bool array", []bool{true, false}), + newOTelIntArray("int slice to int64 array", []int64{1, 2, 3}), + newOTelIntArray("int64 slice to int64 array", []int64{1, 2, 3}), + newOTelDoubleArray("float64 slice to double array", []float64{1.11, 2.22, 3.33}), + newOTelStringArray("string slice to string array", []string{"foo", "bar", "baz"}), + }, + }, + } { + actualArrayAttributes := KeyValues(test.attrs) + expectedArrayAttributes := test.expected + if !assert.Len(t, actualArrayAttributes, len(expectedArrayAttributes)) { + continue + } + + for i, actualArrayAttr := range actualArrayAttributes { + expectedArrayAttr := expectedArrayAttributes[i] + expectedKey, actualKey := expectedArrayAttr.Key, actualArrayAttr.Key + if !assert.Equal(t, expectedKey, actualKey) { + continue + } + + expected := expectedArrayAttr.Value.GetArrayValue() + actual := actualArrayAttr.Value.GetArrayValue() + if expected == nil { + assert.Nil(t, actual) + continue + } + if assert.NotNil(t, actual, "expected not nil for %s", actualKey) { + assertExpectedArrayValues(t, expected.Values, actual.Values) + } + } + } +} + +func assertExpectedArrayValues(t *testing.T, expectedValues, actualValues []*commonpb.AnyValue) { + for i, actual := range actualValues { + expected := expectedValues[i] + if a, ok := actual.Value.(*commonpb.AnyValue_DoubleValue); ok { + e, ok := expected.Value.(*commonpb.AnyValue_DoubleValue) + if !ok { + t.Errorf("expected AnyValue_DoubleValue, got %T", expected.Value) + continue + } + if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { + continue + } + e.DoubleValue = a.DoubleValue + } + assert.Equal(t, expected, actual) + } +} + +func newOTelBoolArray(key string, values []bool) *commonpb.KeyValue { + arrayValues := []*commonpb.AnyValue{} + for _, b := range values { + arrayValues = append(arrayValues, &commonpb.AnyValue{ + Value: &commonpb.AnyValue_BoolValue{ + BoolValue: b, + }, + }) + } + + return newOTelArray(key, arrayValues) +} + +func newOTelIntArray(key string, values []int64) *commonpb.KeyValue { + arrayValues := []*commonpb.AnyValue{} + + for _, i := range values { + arrayValues = append(arrayValues, &commonpb.AnyValue{ + Value: &commonpb.AnyValue_IntValue{ + IntValue: i, + }, + }) + } + + return newOTelArray(key, arrayValues) +} + +func newOTelDoubleArray(key string, values []float64) *commonpb.KeyValue { + arrayValues := []*commonpb.AnyValue{} + + for _, d := range values { + arrayValues = append(arrayValues, &commonpb.AnyValue{ + Value: &commonpb.AnyValue_DoubleValue{ + DoubleValue: d, + }, + }) + } + + return newOTelArray(key, arrayValues) +} + +func newOTelStringArray(key string, values []string) *commonpb.KeyValue { + arrayValues := []*commonpb.AnyValue{} + + for _, s := range values { + arrayValues = append(arrayValues, &commonpb.AnyValue{ + Value: &commonpb.AnyValue_StringValue{ + StringValue: s, + }, + }) + } + + return newOTelArray(key, arrayValues) +} + +func newOTelArray(key string, arrayValues []*commonpb.AnyValue) *commonpb.KeyValue { + return &commonpb.KeyValue{ + Key: key, + Value: &commonpb.AnyValue{ + Value: &commonpb.AnyValue_ArrayValue{ + ArrayValue: &commonpb.ArrayValue{ + Values: arrayValues, + }, + }, + }, + } +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl new file mode 100644 index 00000000000..3e43a81474e --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl @@ -0,0 +1,33 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "go.opentelemetry.io/otel/sdk/instrumentation" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationScope { + if il == (instrumentation.Scope{}) { + return nil + } + return &commonpb.InstrumentationScope{ + Name: il.Name, + Version: il.Version, + } +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl new file mode 100644 index 00000000000..1d2d26ed88a --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl @@ -0,0 +1,31 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "go.opentelemetry.io/otel/sdk/resource" + resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +// Resource transforms a Resource into an OTLP Resource. +func Resource(r *resource.Resource) *resourcepb.Resource { + if r == nil { + return nil + } + return &resourcepb.Resource{Attributes: ResourceAttributes(r)} +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl new file mode 100644 index 00000000000..13628d63b2d --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl @@ -0,0 +1,51 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/resource" +) + +func TestNilResource(t *testing.T) { + assert.Empty(t, Resource(nil)) +} + +func TestEmptyResource(t *testing.T) { + assert.Empty(t, Resource(&resource.Resource{})) +} + +/* +* This does not include any testing on the ordering of Resource Attributes. +* They are stored as a map internally to the Resource and their order is not +* guaranteed. + */ + +func TestResourceAttributes(t *testing.T) { + attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} + + got := Resource(resource.NewSchemaless(attrs...)).GetAttributes() + if !assert.Len(t, attrs, 2) { + return + } + assert.ElementsMatch(t, KeyValues(attrs), got) +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl new file mode 100644 index 00000000000..4204b11a59a --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl @@ -0,0 +1,208 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/sdk/instrumentation" + tracesdk "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/trace" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +// Spans transforms a slice of OpenTelemetry spans into a slice of OTLP +// ResourceSpans. +func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { + if len(sdl) == 0 { + return nil + } + + rsm := make(map[attribute.Distinct]*tracepb.ResourceSpans) + + type key struct { + r attribute.Distinct + is instrumentation.Scope + } + ssm := make(map[key]*tracepb.ScopeSpans) + + var resources int + for _, sd := range sdl { + if sd == nil { + continue + } + + rKey := sd.Resource().Equivalent() + k := key{ + r: rKey, + is: sd.InstrumentationScope(), + } + scopeSpan, iOk := ssm[k] + if !iOk { + // Either the resource or instrumentation scope were unknown. + scopeSpan = &tracepb.ScopeSpans{ + Scope: InstrumentationScope(sd.InstrumentationScope()), + Spans: []*tracepb.Span{}, + SchemaUrl: sd.InstrumentationScope().SchemaURL, + } + } + scopeSpan.Spans = append(scopeSpan.Spans, span(sd)) + ssm[k] = scopeSpan + + rs, rOk := rsm[rKey] + if !rOk { + resources++ + // The resource was unknown. + rs = &tracepb.ResourceSpans{ + Resource: Resource(sd.Resource()), + ScopeSpans: []*tracepb.ScopeSpans{scopeSpan}, + SchemaUrl: sd.Resource().SchemaURL(), + } + rsm[rKey] = rs + continue + } + + // The resource has been seen before. Check if the instrumentation + // library lookup was unknown because if so we need to add it to the + // ResourceSpans. Otherwise, the instrumentation library has already + // been seen and the append we did above will be included it in the + // ScopeSpans reference. + if !iOk { + rs.ScopeSpans = append(rs.ScopeSpans, scopeSpan) + } + } + + // Transform the categorized map into a slice + rss := make([]*tracepb.ResourceSpans, 0, resources) + for _, rs := range rsm { + rss = append(rss, rs) + } + return rss +} + +// span transforms a Span into an OTLP span. +func span(sd tracesdk.ReadOnlySpan) *tracepb.Span { + if sd == nil { + return nil + } + + tid := sd.SpanContext().TraceID() + sid := sd.SpanContext().SpanID() + + s := &tracepb.Span{ + TraceId: tid[:], + SpanId: sid[:], + TraceState: sd.SpanContext().TraceState().String(), + Status: status(sd.Status().Code, sd.Status().Description), + StartTimeUnixNano: uint64(sd.StartTime().UnixNano()), + EndTimeUnixNano: uint64(sd.EndTime().UnixNano()), + Links: links(sd.Links()), + Kind: spanKind(sd.SpanKind()), + Name: sd.Name(), + Attributes: KeyValues(sd.Attributes()), + Events: spanEvents(sd.Events()), + DroppedAttributesCount: uint32(sd.DroppedAttributes()), + DroppedEventsCount: uint32(sd.DroppedEvents()), + DroppedLinksCount: uint32(sd.DroppedLinks()), + } + + if psid := sd.Parent().SpanID(); psid.IsValid() { + s.ParentSpanId = psid[:] + } + + return s +} + +// status transform a span code and message into an OTLP span status. +func status(status codes.Code, message string) *tracepb.Status { + var c tracepb.Status_StatusCode + switch status { + case codes.Ok: + c = tracepb.Status_STATUS_CODE_OK + case codes.Error: + c = tracepb.Status_STATUS_CODE_ERROR + default: + c = tracepb.Status_STATUS_CODE_UNSET + } + return &tracepb.Status{ + Code: c, + Message: message, + } +} + +// links transforms span Links to OTLP span links. +func links(links []tracesdk.Link) []*tracepb.Span_Link { + if len(links) == 0 { + return nil + } + + sl := make([]*tracepb.Span_Link, 0, len(links)) + for _, otLink := range links { + // This redefinition is necessary to prevent otLink.*ID[:] copies + // being reused -- in short we need a new otLink per iteration. + otLink := otLink + + tid := otLink.SpanContext.TraceID() + sid := otLink.SpanContext.SpanID() + + sl = append(sl, &tracepb.Span_Link{ + TraceId: tid[:], + SpanId: sid[:], + Attributes: KeyValues(otLink.Attributes), + DroppedAttributesCount: uint32(otLink.DroppedAttributeCount), + }) + } + return sl +} + +// spanEvents transforms span Events to an OTLP span events. +func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { + if len(es) == 0 { + return nil + } + + events := make([]*tracepb.Span_Event, len(es)) + // Transform message events + for i := 0; i < len(es); i++ { + events[i] = &tracepb.Span_Event{ + Name: es[i].Name, + TimeUnixNano: uint64(es[i].Time.UnixNano()), + Attributes: KeyValues(es[i].Attributes), + DroppedAttributesCount: uint32(es[i].DroppedAttributeCount), + } + } + return events +} + +// spanKind transforms a SpanKind to an OTLP span kind. +func spanKind(kind trace.SpanKind) tracepb.Span_SpanKind { + switch kind { + case trace.SpanKindInternal: + return tracepb.Span_SPAN_KIND_INTERNAL + case trace.SpanKindClient: + return tracepb.Span_SPAN_KIND_CLIENT + case trace.SpanKindServer: + return tracepb.Span_SPAN_KIND_SERVER + case trace.SpanKindProducer: + return tracepb.Span_SPAN_KIND_PRODUCER + case trace.SpanKindConsumer: + return tracepb.Span_SPAN_KIND_CONSUMER + default: + return tracepb.Span_SPAN_KIND_UNSPECIFIED + } +} diff --git a/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl new file mode 100644 index 00000000000..df26af006ee --- /dev/null +++ b/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl @@ -0,0 +1,336 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package tracetransform + +import ( + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/sdk/instrumentation" + "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.17.0" + "go.opentelemetry.io/otel/trace" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +func TestSpanKind(t *testing.T) { + for _, test := range []struct { + kind trace.SpanKind + expected tracepb.Span_SpanKind + }{ + { + trace.SpanKindInternal, + tracepb.Span_SPAN_KIND_INTERNAL, + }, + { + trace.SpanKindClient, + tracepb.Span_SPAN_KIND_CLIENT, + }, + { + trace.SpanKindServer, + tracepb.Span_SPAN_KIND_SERVER, + }, + { + trace.SpanKindProducer, + tracepb.Span_SPAN_KIND_PRODUCER, + }, + { + trace.SpanKindConsumer, + tracepb.Span_SPAN_KIND_CONSUMER, + }, + { + trace.SpanKind(-1), + tracepb.Span_SPAN_KIND_UNSPECIFIED, + }, + } { + assert.Equal(t, test.expected, spanKind(test.kind)) + } +} + +func TestNilSpanEvent(t *testing.T) { + assert.Nil(t, spanEvents(nil)) +} + +func TestEmptySpanEvent(t *testing.T) { + assert.Nil(t, spanEvents([]tracesdk.Event{})) +} + +func TestSpanEvent(t *testing.T) { + attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} + eventTime := time.Date(2020, 5, 20, 0, 0, 0, 0, time.UTC) + got := spanEvents([]tracesdk.Event{ + { + Name: "test 1", + Attributes: []attribute.KeyValue{}, + Time: eventTime, + }, + { + Name: "test 2", + Attributes: attrs, + Time: eventTime, + DroppedAttributeCount: 2, + }, + }) + if !assert.Len(t, got, 2) { + return + } + eventTimestamp := uint64(1589932800 * 1e9) + assert.Equal(t, &tracepb.Span_Event{Name: "test 1", Attributes: nil, TimeUnixNano: eventTimestamp}, got[0]) + // Do not test Attributes directly, just that the return value goes to the correct field. + assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp, DroppedAttributesCount: 2}, got[1]) +} + +func TestNilLinks(t *testing.T) { + assert.Nil(t, links(nil)) +} + +func TestEmptyLinks(t *testing.T) { + assert.Nil(t, links([]tracesdk.Link{})) +} + +func TestLinks(t *testing.T) { + attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} + l := []tracesdk.Link{ + { + DroppedAttributeCount: 3, + }, + { + SpanContext: trace.SpanContext{}, + Attributes: attrs, + DroppedAttributeCount: 3, + }, + } + got := links(l) + + // Make sure we get the same number back first. + if !assert.Len(t, got, 2) { + return + } + + // Empty should be empty. + expected := &tracepb.Span_Link{ + TraceId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + SpanId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, + DroppedAttributesCount: 3, + } + assert.Equal(t, expected, got[0]) + + // Do not test Attributes directly, just that the return value goes to the correct field. + expected.Attributes = KeyValues(attrs) + assert.Equal(t, expected, got[1]) + + // Changes to our links should not change the produced links. + l[1].SpanContext = l[1].SpanContext.WithTraceID(trace.TraceID{}) + assert.Equal(t, expected, got[1]) + assert.Equal(t, l[1].DroppedAttributeCount, int(got[1].DroppedAttributesCount)) +} + +func TestStatus(t *testing.T) { + for _, test := range []struct { + code codes.Code + message string + otlpStatus tracepb.Status_StatusCode + }{ + { + codes.Ok, + "test Ok", + tracepb.Status_STATUS_CODE_OK, + }, + { + codes.Unset, + "test Unset", + tracepb.Status_STATUS_CODE_UNSET, + }, + { + message: "default code is unset", + otlpStatus: tracepb.Status_STATUS_CODE_UNSET, + }, + { + codes.Error, + "test Error", + tracepb.Status_STATUS_CODE_ERROR, + }, + } { + expected := &tracepb.Status{Code: test.otlpStatus, Message: test.message} + assert.Equal(t, expected, status(test.code, test.message)) + } +} + +func TestNilSpan(t *testing.T) { + assert.Nil(t, span(nil)) +} + +func TestNilSpanData(t *testing.T) { + assert.Nil(t, Spans(nil)) +} + +func TestEmptySpanData(t *testing.T) { + assert.Nil(t, Spans(nil)) +} + +func TestSpanData(t *testing.T) { + // Full test of span data + + // March 31, 2020 5:01:26 1234nanos (UTC) + startTime := time.Unix(1585674086, 1234) + endTime := startTime.Add(10 * time.Second) + traceState, _ := trace.ParseTraceState("key1=val1,key2=val2") + spanData := tracetest.SpanStub{ + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, + TraceState: traceState, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanID: trace.SpanID{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8}, + TraceState: traceState, + Remote: true, + }), + SpanKind: trace.SpanKindServer, + Name: "span data to span data", + StartTime: startTime, + EndTime: endTime, + Events: []tracesdk.Event{ + {Time: startTime, + Attributes: []attribute.KeyValue{ + attribute.Int64("CompressedByteSize", 512), + }, + }, + {Time: endTime, + Attributes: []attribute.KeyValue{ + attribute.String("EventType", "Recv"), + }, + }, + }, + Links: []tracesdk.Link{ + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF}, + SpanID: trace.SpanID{0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7}, + TraceFlags: 0, + }), + Attributes: []attribute.KeyValue{ + attribute.String("LinkType", "Parent"), + }, + DroppedAttributeCount: 0, + }, + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF}, + SpanID: trace.SpanID{0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7}, + TraceFlags: 0, + }), + Attributes: []attribute.KeyValue{ + attribute.String("LinkType", "Child"), + }, + DroppedAttributeCount: 0, + }, + }, + Status: tracesdk.Status{ + Code: codes.Error, + Description: "utterly unrecognized", + }, + Attributes: []attribute.KeyValue{ + attribute.Int64("timeout_ns", 12e9), + }, + DroppedAttributes: 1, + DroppedEvents: 2, + DroppedLinks: 3, + Resource: resource.NewWithAttributes( + "http://example.com/custom-resource-schema", + attribute.String("rk1", "rv1"), + attribute.Int64("rk2", 5), + attribute.StringSlice("rk3", []string{"sv1", "sv2"}), + ), + InstrumentationLibrary: instrumentation.Scope{ + Name: "go.opentelemetry.io/test/otel", + Version: "v0.0.1", + SchemaURL: semconv.SchemaURL, + }, + } + + // Not checking resource as the underlying map of our Resource makes + // ordering impossible to guarantee on the output. The Resource + // transform function has unit tests that should suffice. + expectedSpan := &tracepb.Span{ + TraceId: []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, + SpanId: []byte{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, + ParentSpanId: []byte{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8}, + TraceState: "key1=val1,key2=val2", + Name: spanData.Name, + Kind: tracepb.Span_SPAN_KIND_SERVER, + StartTimeUnixNano: uint64(startTime.UnixNano()), + EndTimeUnixNano: uint64(endTime.UnixNano()), + Status: status(spanData.Status.Code, spanData.Status.Description), + Events: spanEvents(spanData.Events), + Links: links(spanData.Links), + Attributes: KeyValues(spanData.Attributes), + DroppedAttributesCount: 1, + DroppedEventsCount: 2, + DroppedLinksCount: 3, + } + + got := Spans(tracetest.SpanStubs{spanData}.Snapshots()) + require.Len(t, got, 1) + + assert.Equal(t, got[0].GetResource(), Resource(spanData.Resource)) + assert.Equal(t, got[0].SchemaUrl, spanData.Resource.SchemaURL()) + scopeSpans := got[0].GetScopeSpans() + require.Len(t, scopeSpans, 1) + assert.Equal(t, scopeSpans[0].SchemaUrl, spanData.InstrumentationLibrary.SchemaURL) + assert.Equal(t, scopeSpans[0].GetScope(), InstrumentationScope(spanData.InstrumentationLibrary)) + require.Len(t, scopeSpans[0].Spans, 1) + actualSpan := scopeSpans[0].Spans[0] + + if diff := cmp.Diff(expectedSpan, actualSpan, cmp.Comparer(proto.Equal)); diff != "" { + t.Fatalf("transformed span differs %v\n", diff) + } +} + +// Empty parent span ID should be treated as root span. +func TestRootSpanData(t *testing.T) { + sd := Spans(tracetest.SpanStubs{ + {}, + }.Snapshots()) + require.Len(t, sd, 1) + rs := sd[0] + scopeSpans := rs.GetScopeSpans() + require.Len(t, scopeSpans, 1) + got := scopeSpans[0].GetSpans()[0].GetParentSpanId() + + // Empty means root span. + assert.Nil(t, got, "incorrect transform of root parent span ID") +} + +func TestSpanDataNilResource(t *testing.T) { + assert.NotPanics(t, func() { + Spans(tracetest.SpanStubs{ + {}, + }.Snapshots()) + }) +} diff --git a/internal/shared/otlp/retry/retry.go.tmpl b/internal/shared/otlp/retry/retry.go.tmpl new file mode 100644 index 00000000000..7618ef30102 --- /dev/null +++ b/internal/shared/otlp/retry/retry.go.tmpl @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/internal/shared/otlp/retry/retry_test.go.tmpl b/internal/shared/otlp/retry/retry_test.go.tmpl new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/internal/shared/otlp/retry/retry_test.go.tmpl @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 97b3643eae4..f921bb6f4ba 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -11,6 +11,7 @@ require ( github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.10.0 go.opentelemetry.io/build-tools/dbotconf v0.10.0 + go.opentelemetry.io/build-tools/gotmpl v0.10.0 go.opentelemetry.io/build-tools/multimod v0.10.0 go.opentelemetry.io/build-tools/semconvgen v0.10.0 golang.org/x/tools v0.11.0 diff --git a/internal/tools/go.sum b/internal/tools/go.sum index efbe9f1b15b..da55244578c 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -628,6 +628,8 @@ go.opentelemetry.io/build-tools/crosslink v0.10.0 h1:lyXOJP2z3G/o+e0w00q3vkzFZw4 go.opentelemetry.io/build-tools/crosslink v0.10.0/go.mod h1:B//a0+OAU8kjgLLJnxjDNnlGv8CJt9pF/BaGc0nChvU= go.opentelemetry.io/build-tools/dbotconf v0.10.0 h1:BKk+Q2BoHqcA9lbrbVqYeQVHPJJb+jHePoO4TIyCy3Y= go.opentelemetry.io/build-tools/dbotconf v0.10.0/go.mod h1:SOyfUbctj4X9QakCfGy/eTlYlFo/HTNtyjJs7hHP9gE= +go.opentelemetry.io/build-tools/gotmpl v0.10.0 h1:pytcJ20iHs87Y/gMEb3pDgQuZ9g+wBgYYlexzUSJLV4= +go.opentelemetry.io/build-tools/gotmpl v0.10.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= go.opentelemetry.io/build-tools/multimod v0.10.0 h1:jYlpTXAJCZqjzYZdEdwdDIX90qnqQvZkgaPkMt9r6BA= go.opentelemetry.io/build-tools/multimod v0.10.0/go.mod h1:jn2a5TTq9wSR9ragaruZ2ilqOV+VerkNtNPTqwtIMyM= go.opentelemetry.io/build-tools/semconvgen v0.10.0 h1:enthiZ2ucgEh6GdSf2FjPJh+tW7lWTKzLPS+oxxWqDY= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 463d26a493f..6980285a315 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -26,6 +26,7 @@ import ( _ "github.com/wadey/gocovmerge" _ "go.opentelemetry.io/build-tools/crosslink" _ "go.opentelemetry.io/build-tools/dbotconf" + _ "go.opentelemetry.io/build-tools/gotmpl" _ "go.opentelemetry.io/build-tools/multimod" _ "go.opentelemetry.io/build-tools/semconvgen" _ "golang.org/x/tools/cmd/stringer" From 9ec9cead50ef66a3688842f107ccc24e737893e3 Mon Sep 17 00:00:00 2001 From: George Kontridze Date: Wed, 2 Aug 2023 13:53:35 -0700 Subject: [PATCH 632/886] Fix typo in exporters/README.md (#4402) --- exporters/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/README.md b/exporters/README.md index 0a8c16a07f0..a43f2b8341b 100644 --- a/exporters/README.md +++ b/exporters/README.md @@ -17,6 +17,6 @@ The following exporter packages are provided with the following OpenTelemetry si | [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](./stdout/stdouttrace) | | ✓ | | [go.opentelemetry.io/otel/exporters/zipkin](./zipkin) | | ✓ | -See the [OpenTelemetry registry] for 3rd-part exporters compatible with this project. +See the [OpenTelemetry registry] for 3rd-party exporters compatible with this project. [OpenTelemetry registry]: https://opentelemetry.io/registry/?language=go&component=exporter From 58c9cf65d649ebb9b88bc554ebf02899e8b52fde Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 3 Aug 2023 13:34:48 -0700 Subject: [PATCH 633/886] Decouple `otlp/otlptrace/otlptracehttp` from `otlp/internal` and `otlp/otlptrace/internal` using gotmpl (#4401) * Use template retry pkg in otlpconfig * Template out all otlptrace internal * Add envconfig pkg to otlptrace/internal * Generate otlptrace/internal/otlpconfig * Revert templatizing otlptracegrpc * Add changes to changelog * Fix lint * Add partialsuccess to internal shared * Use gotmpl to generate otlptracehttp/internal * Add change to changelog --- CHANGELOG.md | 1 + .../otlp/otlptrace/otlptracehttp/client.go | 10 +- .../otlptrace/otlptracehttp/client_test.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 4 +- .../internal/envconfig/envconfig.go | 202 ++++++++ .../internal/envconfig/envconfig_test.go | 464 +++++++++++++++++ .../otlptrace/otlptracehttp/internal/gen.go | 35 ++ .../internal/otlpconfig/envconfig.go | 153 ++++++ .../internal/otlpconfig/options.go | 328 ++++++++++++ .../internal/otlpconfig/options_test.go | 489 ++++++++++++++++++ .../internal/otlpconfig/optiontypes.go | 51 ++ .../otlptracehttp/internal/otlpconfig/tls.go | 37 ++ .../internal/otlptracetest/client.go | 136 +++++ .../internal/otlptracetest/collector.go | 106 ++++ .../internal/otlptracetest/data.go | 66 +++ .../internal/otlptracetest/otlptest.go | 128 +++++ .../otlptracehttp/internal/partialsuccess.go | 67 +++ .../internal/partialsuccess_test.go | 46 ++ .../otlptracehttp/internal/retry/retry.go | 156 ++++++ .../internal/retry/retry_test.go | 261 ++++++++++ .../otlptracehttp/mock_collector_test.go | 4 +- .../otlp/otlptrace/otlptracehttp/options.go | 4 +- internal/shared/otlp/partialsuccess.go.tmpl | 67 +++ .../shared/otlp/partialsuccess_test.go.tmpl | 46 ++ 24 files changed, 2851 insertions(+), 12 deletions(-) create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/gen.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/envconfig.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/optiontypes.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/tls.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/client.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/collector.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/data.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/otlptest.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess_test.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry.go create mode 100644 exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go create mode 100644 internal/shared/otlp/partialsuccess.go.tmpl create mode 100644 internal/shared/otlp/partialsuccess_test.go.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index 096e580d736..adbbbd46928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 96e10d4f15c..fe8afc240c1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -30,11 +30,10 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) @@ -210,7 +209,8 @@ func (d *client) newRequest(body []byte) (request, error) { return request{Request: r}, err } - r.Header.Set("User-Agent", otinternal.GetUserAgentHeader()) + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() + r.Header.Set("User-Agent", userAgent) for k, v := range d.cfg.Headers { r.Header.Set(k, v) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 9c6a150d28a..279d8ada339 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -29,8 +29,8 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f15ae340b43..e91e97ccecf 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -3,17 +3,18 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp go 1.19 require ( + github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v1.0.0 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -26,7 +27,6 @@ require ( golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.57.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..5e9e8185d15 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/gen.go b/exporters/otlp/otlptrace/otlptracehttp/internal/gen.go new file mode 100644 index 00000000000..01347d8c651 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/gen.go @@ -0,0 +1,35 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal" + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess_test.go.tmpl "--data={}" --out=partialsuccess_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig\"}" --out=otlpconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry\"}" --out=otlpconfig/options.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig\"}" --out=otlpconfig/options_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl "--data={}" --out=otlpconfig/optiontypes.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl "--data={}" --out=otlpconfig/tls.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl "--data={}" --out=otlptracetest/client.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/envconfig.go new file mode 100644 index 00000000000..45f137a7872 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/envconfig.go @@ -0,0 +1,153 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("TRACES_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Traces.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("TRACES_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("TRACES_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + ) + + return opts +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go new file mode 100644 index 00000000000..9a595c36a62 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go @@ -0,0 +1,328 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" +) + +const ( + // DefaultTracesPath is a default URL path for endpoint that + // receives spans. + DefaultTracesPath string = "/v1/traces" + // DefaultTimeout is a default max waiting time for the backend to process + // each span batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + } + + Config struct { + // Signal specific configurations + Traces SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Traces.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials)) + } else if cfg.Traces.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Traces.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Traces.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Traces.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Traces.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Timeout = duration + return cfg + }) +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go new file mode 100644 index 00000000000..5fbda6d460d --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go @@ -0,0 +1,489 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, NoCompression, c.Traces.Compression) + assert.Equal(t, map[string]string(nil), c.Traces.Headers) + assert.Equal(t, 10*time.Second, c.Traces.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Traces.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Traces.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Traces.Endpoint) + assert.Equal(t, "/prefix/v1/traces", c.Traces.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://env.traces.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Traces.Insecure) + assert.Equal(t, "env.traces.endpoint", c.Traces.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Traces.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("traces_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "traces_endpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "HtTp://env_traces_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_traces_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + assert.Nil(t, c.Traces.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Traces.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Traces.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 27*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 5*time.Second) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/optiontypes.go new file mode 100644 index 00000000000..8625674855d --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/optiontypes.go @@ -0,0 +1,51 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// Marshaler describes the kind of message format sent to the collector. +type Marshaler int + +const ( + // MarshalProto tells the driver to send using the protobuf binary format. + MarshalProto Marshaler = iota + // MarshalJSON tells the driver to send using json format. + MarshalJSON +) diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/tls.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/tls.go new file mode 100644 index 00000000000..c342f7d6831 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/tls.go @@ -0,0 +1,37 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" +) + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/client.go new file mode 100644 index 00000000000..3f9680064ec --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/client.go @@ -0,0 +1,136 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +func RunExporterShutdownTest(t *testing.T, factory func() otlptrace.Client) { + t.Run("testClientStopHonorsTimeout", func(t *testing.T) { + testClientStopHonorsTimeout(t, factory()) + }) + + t.Run("testClientStopHonorsCancel", func(t *testing.T) { + testClientStopHonorsCancel(t, factory()) + }) + + t.Run("testClientStopNoError", func(t *testing.T) { + testClientStopNoError(t, factory()) + }) + + t.Run("testClientStopManyTimes", func(t *testing.T) { + testClientStopManyTimes(t, factory()) + }) +} + +func initializeExporter(t *testing.T, client otlptrace.Client) *otlptrace.Exporter { + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + e, err := otlptrace.New(ctx, client) + if err != nil { + t.Fatalf("failed to create exporter") + } + + return e +} + +func testClientStopHonorsTimeout(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) + defer cancel() + <-ctx.Done() + + if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { + t.Errorf("expected context DeadlineExceeded error, got %v", err) + } +} + +func testClientStopHonorsCancel(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) { + t.Errorf("expected context canceled error, got %v", err) + } +} + +func testClientStopNoError(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + if err := e.Shutdown(ctx); err != nil { + t.Errorf("shutdown errored: expected nil, got %v", err) + } +} + +func testClientStopManyTimes(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + ch := make(chan struct{}) + wg := sync.WaitGroup{} + const num int = 20 + wg.Add(num) + errs := make([]error, num) + for i := 0; i < num; i++ { + go func(idx int) { + defer wg.Done() + <-ch + errs[idx] = e.Shutdown(ctx) + }(i) + } + close(ch) + wg.Wait() + for _, err := range errs { + if err != nil { + t.Errorf("failed to shutdown exporter: %v", err) + return + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/collector.go new file mode 100644 index 00000000000..4392c56314a --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/collector.go @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" + +import ( + "sort" + + collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" + resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +// TracesCollector mocks a collector for the end-to-end testing. +type TracesCollector interface { + Stop() error + GetResourceSpans() []*tracepb.ResourceSpans +} + +// SpansStorage stores the spans. Mock collectors can use it to +// store spans they have received. +type SpansStorage struct { + rsm map[string]*tracepb.ResourceSpans + spanCount int +} + +// NewSpansStorage creates a new spans storage. +func NewSpansStorage() SpansStorage { + return SpansStorage{ + rsm: make(map[string]*tracepb.ResourceSpans), + } +} + +// AddSpans adds spans to the spans storage. +func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequest) { + for _, rs := range request.GetResourceSpans() { + rstr := resourceString(rs.Resource) + if existingRs, ok := s.rsm[rstr]; !ok { + s.rsm[rstr] = rs + // TODO (rghetia): Add support for library Info. + if len(rs.ScopeSpans) == 0 { + rs.ScopeSpans = []*tracepb.ScopeSpans{ + { + Spans: []*tracepb.Span{}, + }, + } + } + s.spanCount += len(rs.ScopeSpans[0].Spans) + } else { + if len(rs.ScopeSpans) > 0 { + newSpans := rs.ScopeSpans[0].GetSpans() + existingRs.ScopeSpans[0].Spans = append(existingRs.ScopeSpans[0].Spans, newSpans...) + s.spanCount += len(newSpans) + } + } + } +} + +// GetSpans returns the stored spans. +func (s *SpansStorage) GetSpans() []*tracepb.Span { + spans := make([]*tracepb.Span, 0, s.spanCount) + for _, rs := range s.rsm { + spans = append(spans, rs.ScopeSpans[0].Spans...) + } + return spans +} + +// GetResourceSpans returns the stored resource spans. +func (s *SpansStorage) GetResourceSpans() []*tracepb.ResourceSpans { + rss := make([]*tracepb.ResourceSpans, 0, len(s.rsm)) + for _, rs := range s.rsm { + rss = append(rss, rs) + } + return rss +} + +func resourceString(res *resourcepb.Resource) string { + sAttrs := sortedAttributes(res.GetAttributes()) + rstr := "" + for _, attr := range sAttrs { + rstr = rstr + attr.String() + } + return rstr +} + +func sortedAttributes(attrs []*commonpb.KeyValue) []*commonpb.KeyValue { + sort.Slice(attrs[:], func(i, j int) bool { + return attrs[i].Key < attrs[j].Key + }) + return attrs +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/data.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/data.go new file mode 100644 index 00000000000..3db4640ca90 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/data.go @@ -0,0 +1,66 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" + tracesdk "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" + "go.opentelemetry.io/otel/trace" +) + +// SingleReadOnlySpan returns a one-element slice with a read-only span. It +// may be useful for testing driver's trace export. +func SingleReadOnlySpan() []tracesdk.ReadOnlySpan { + return tracetest.SpanStubs{ + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{3, 4, 5, 6, 7, 8, 9, 0}, + TraceFlags: trace.FlagsSampled, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{1, 2, 3, 4, 5, 6, 7, 8}, + TraceFlags: trace.FlagsSampled, + }), + SpanKind: trace.SpanKindInternal, + Name: "foo", + StartTime: time.Date(2020, time.December, 8, 20, 23, 0, 0, time.UTC), + EndTime: time.Date(2020, time.December, 0, 20, 24, 0, 0, time.UTC), + Attributes: []attribute.KeyValue{}, + Events: []tracesdk.Event{}, + Links: []tracesdk.Link{}, + Status: tracesdk.Status{Code: codes.Ok}, + DroppedAttributes: 0, + DroppedEvents: 0, + DroppedLinks: 0, + ChildSpanCount: 0, + Resource: resource.NewSchemaless(attribute.String("a", "b")), + InstrumentationLibrary: instrumentation.Library{ + Name: "bar", + Version: "0.0.0", + }, + }, + }.Snapshots() +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/otlptest.go new file mode 100644 index 00000000000..c2887674c6a --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest/otlptest.go @@ -0,0 +1,128 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" + +import ( + "context" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// RunEndToEndTest can be used by otlptrace.Client tests to validate +// themselves. +func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, tracesCollector TracesCollector) { + pOpts := []sdktrace.TracerProviderOption{ + sdktrace.WithSampler(sdktrace.AlwaysSample()), + sdktrace.WithBatcher( + exp, + // add following two options to ensure flush + sdktrace.WithBatchTimeout(5*time.Second), + sdktrace.WithMaxExportBatchSize(10), + ), + } + tp1 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv11)"), + attribute.Int64("rk2", 5), + )))...) + + tp2 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv12)"), + attribute.Float64("rk3", 6.5), + )))...) + + tr1 := tp1.Tracer("test-tracer1") + tr2 := tp2.Tracer("test-tracer2") + // Now create few spans + m := 4 + for i := 0; i < m; i++ { + _, span := tr1.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + + _, span = tr2.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + } + + func() { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := tp1.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 1: %v", err) + } + if err := tp2.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 2: %v", err) + } + }() + + // Wait >2 cycles. + <-time.After(40 * time.Millisecond) + + // Now shutdown the exporter + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := exp.Shutdown(ctx); err != nil { + t.Fatalf("failed to stop the exporter: %v", err) + } + + // Shutdown the collector too so that we can begin + // verification checks of expected data back. + if err := tracesCollector.Stop(); err != nil { + t.Fatalf("failed to stop the mock collector: %v", err) + } + + // Now verify that we only got two resources + rss := tracesCollector.GetResourceSpans() + if got, want := len(rss), 2; got != want { + t.Fatalf("resource span count: got %d, want %d\n", got, want) + } + + // Now verify spans and attributes for each resource span. + for _, rs := range rss { + if len(rs.ScopeSpans) == 0 { + t.Fatalf("zero ScopeSpans") + } + if got, want := len(rs.ScopeSpans[0].Spans), m; got != want { + t.Fatalf("span counts: got %d, want %d", got, want) + } + attrMap := map[int64]bool{} + for _, s := range rs.ScopeSpans[0].Spans { + if gotName, want := s.Name, "AlwaysSample"; gotName != want { + t.Fatalf("span name: got %s, want %s", gotName, want) + } + attrMap[s.Attributes[0].Value.Value.(*commonpb.AnyValue_IntValue).IntValue] = true + } + if got, want := len(attrMap), m; got != want { + t.Fatalf("span attribute unique values: got %d want %d", got, want) + } + for i := 0; i < m; i++ { + _, ok := attrMap[int64(i)] + if !ok { + t.Fatalf("span with attribute %d missing", i) + } + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess.go b/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess.go new file mode 100644 index 00000000000..f051ad5d95c --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess.go @@ -0,0 +1,67 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal" + +import "fmt" + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind string +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "metric data points", + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess_test.go new file mode 100644 index 00000000000..c385c4d428e --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/partialsuccess_test.go @@ -0,0 +1,46 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess_test.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry.go b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry.go new file mode 100644 index 00000000000..44974ff49bd --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry.go @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/retry/retry_test.go @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go index d999c1c8952..919a15fa4df 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go @@ -30,8 +30,8 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/protobuf/proto" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlptracetest" collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index c9d58984b16..e3ed6494c5d 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -18,8 +18,8 @@ import ( "crypto/tls" "time" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" ) // Compression describes the compression used for payloads sent to the diff --git a/internal/shared/otlp/partialsuccess.go.tmpl b/internal/shared/otlp/partialsuccess.go.tmpl new file mode 100644 index 00000000000..b556540a691 --- /dev/null +++ b/internal/shared/otlp/partialsuccess.go.tmpl @@ -0,0 +1,67 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import "fmt" + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind string +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "metric data points", + } +} diff --git a/internal/shared/otlp/partialsuccess_test.go.tmpl b/internal/shared/otlp/partialsuccess_test.go.tmpl new file mode 100644 index 00000000000..c385c4d428e --- /dev/null +++ b/internal/shared/otlp/partialsuccess_test.go.tmpl @@ -0,0 +1,46 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess_test.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) +} From 2e6ca0af0cab6d96b90b9624dd6fbd6031ced6c4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 3 Aug 2023 13:51:45 -0700 Subject: [PATCH 634/886] Decouple `otlp/otlptrace/otlptracegrpc` from `otlp/internal` and `otlp/otlptrace/internal` using gotmpl (#4400) * Use template retry pkg in otlpconfig * Template out all otlptrace internal * Add envconfig pkg to otlptrace/internal * Generate otlptrace/internal/otlpconfig * Revert templatizing otlptracegrpc * Add changes to changelog * Add partialsuccess to internal shared * Use gotmpl to generate otlptracegrpc/internal * Add changes to changelog --- CHANGELOG.md | 1 + .../otlp/otlptrace/otlptracegrpc/client.go | 6 +- .../otlptrace/otlptracegrpc/client_test.go | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 +- .../internal/envconfig/envconfig.go | 202 ++++++++ .../internal/envconfig/envconfig_test.go | 464 +++++++++++++++++ .../otlptrace/otlptracegrpc/internal/gen.go | 35 ++ .../internal/otlpconfig/envconfig.go | 153 ++++++ .../internal/otlpconfig/options.go | 328 ++++++++++++ .../internal/otlpconfig/options_test.go | 489 ++++++++++++++++++ .../internal/otlpconfig/optiontypes.go | 51 ++ .../otlptracegrpc/internal/otlpconfig/tls.go | 37 ++ .../internal/otlptracetest/client.go | 136 +++++ .../internal/otlptracetest/collector.go | 106 ++++ .../internal/otlptracetest/data.go | 66 +++ .../internal/otlptracetest/otlptest.go | 128 +++++ .../otlptracegrpc/internal/partialsuccess.go | 67 +++ .../internal/partialsuccess_test.go | 46 ++ .../otlptracegrpc/internal/retry/retry.go | 156 ++++++ .../internal/retry/retry_test.go | 261 ++++++++++ .../otlptracegrpc/mock_collector_test.go | 2 +- .../otlp/otlptrace/otlptracegrpc/options.go | 4 +- 22 files changed, 2735 insertions(+), 9 deletions(-) create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/client.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/collector.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/data.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/otlptest.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess_test.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index adbbbd46928..97a2020f7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 4aa430b0d71..86fb61a0dec 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -27,10 +27,10 @@ import ( "google.golang.org/grpc/status" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 42e75f52972..b25606d232d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -34,8 +34,8 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 02765d26f24..83cf695502c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -3,10 +3,12 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go 1.19 require ( + github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel/trace v1.16.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc @@ -15,7 +17,6 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect @@ -23,7 +24,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..becb1f0fbbe --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go new file mode 100644 index 00000000000..1fb29061894 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go @@ -0,0 +1,35 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess_test.go.tmpl "--data={}" --out=partialsuccess_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig\"}" --out=otlpconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry\"}" --out=otlpconfig/options.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig\"}" --out=otlpconfig/options_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl "--data={}" --out=otlpconfig/optiontypes.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl "--data={}" --out=otlpconfig/tls.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl "--data={}" --out=otlptracetest/client.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go new file mode 100644 index 00000000000..32f6dddb4f6 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go @@ -0,0 +1,153 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("TRACES_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Traces.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Traces.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("TRACES_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("TRACES_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + ) + + return opts +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Traces.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go new file mode 100644 index 00000000000..19b8434d4d2 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -0,0 +1,328 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" +) + +const ( + // DefaultTracesPath is a default URL path for endpoint that + // receives spans. + DefaultTracesPath string = "/v1/traces" + // DefaultTimeout is a default max waiting time for the backend to process + // each span batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + } + + Config struct { + // Signal specific configurations + Traces SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() + cfg := Config{ + Traces: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultTracesPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Traces.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials)) + } else if cfg.Traces.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Traces.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Traces.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Traces.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Traces.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Timeout = duration + return cfg + }) +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go new file mode 100644 index 00000000000..e947cdcb86e --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go @@ -0,0 +1,489 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, NoCompression, c.Traces.Compression) + assert.Equal(t, map[string]string(nil), c.Traces.Headers) + assert.Equal(t, 10*time.Second, c.Traces.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Traces.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Traces.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Traces.Endpoint) + assert.Equal(t, "/prefix/v1/traces", c.Traces.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://env.traces.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Traces.Insecure) + assert.Equal(t, "env.traces.endpoint", c.Traces.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Traces.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("traces_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "traces_endpoint", c.Traces.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Traces.Endpoint) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "HtTp://env_traces_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_traces_endpoint", c.Traces.Endpoint) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + assert.Nil(t, c.Traces.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Traces.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_TRACES_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Traces.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Traces.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Traces.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 27*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Traces.Timeout, 5*time.Second) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go new file mode 100644 index 00000000000..d9dcdc96e7d --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go @@ -0,0 +1,51 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// Marshaler describes the kind of message format sent to the collector. +type Marshaler int + +const ( + // MarshalProto tells the driver to send using the protobuf binary format. + MarshalProto Marshaler = iota + // MarshalJSON tells the driver to send using json format. + MarshalJSON +) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go new file mode 100644 index 00000000000..19b6d4b21f9 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go @@ -0,0 +1,37 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" +) + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/client.go new file mode 100644 index 00000000000..ac85d0d52d0 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/client.go @@ -0,0 +1,136 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" + +import ( + "context" + "errors" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" +) + +func RunExporterShutdownTest(t *testing.T, factory func() otlptrace.Client) { + t.Run("testClientStopHonorsTimeout", func(t *testing.T) { + testClientStopHonorsTimeout(t, factory()) + }) + + t.Run("testClientStopHonorsCancel", func(t *testing.T) { + testClientStopHonorsCancel(t, factory()) + }) + + t.Run("testClientStopNoError", func(t *testing.T) { + testClientStopNoError(t, factory()) + }) + + t.Run("testClientStopManyTimes", func(t *testing.T) { + testClientStopManyTimes(t, factory()) + }) +} + +func initializeExporter(t *testing.T, client otlptrace.Client) *otlptrace.Exporter { + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + e, err := otlptrace.New(ctx, client) + if err != nil { + t.Fatalf("failed to create exporter") + } + + return e +} + +func testClientStopHonorsTimeout(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) + defer cancel() + <-ctx.Done() + + if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { + t.Errorf("expected context DeadlineExceeded error, got %v", err) + } +} + +func testClientStopHonorsCancel(t *testing.T, client otlptrace.Client) { + t.Cleanup(func() { + // The test is looking for a failed shut down. Call Stop a second time + // with an un-expired context to give the client a second chance at + // cleaning up. There is not guarantee from the Client interface this + // will succeed, therefore, no need to check the error (just give it a + // best try). + _ = client.Stop(context.Background()) + }) + e := initializeExporter(t, client) + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + + if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) { + t.Errorf("expected context canceled error, got %v", err) + } +} + +func testClientStopNoError(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + if err := e.Shutdown(ctx); err != nil { + t.Errorf("shutdown errored: expected nil, got %v", err) + } +} + +func testClientStopManyTimes(t *testing.T, client otlptrace.Client) { + e := initializeExporter(t, client) + + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) + defer cancel() + + ch := make(chan struct{}) + wg := sync.WaitGroup{} + const num int = 20 + wg.Add(num) + errs := make([]error, num) + for i := 0; i < num; i++ { + go func(idx int) { + defer wg.Done() + <-ch + errs[idx] = e.Shutdown(ctx) + }(i) + } + close(ch) + wg.Wait() + for _, err := range errs { + if err != nil { + t.Errorf("failed to shutdown exporter: %v", err) + return + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/collector.go new file mode 100644 index 00000000000..a18618a05d7 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/collector.go @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" + +import ( + "sort" + + collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" + resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" +) + +// TracesCollector mocks a collector for the end-to-end testing. +type TracesCollector interface { + Stop() error + GetResourceSpans() []*tracepb.ResourceSpans +} + +// SpansStorage stores the spans. Mock collectors can use it to +// store spans they have received. +type SpansStorage struct { + rsm map[string]*tracepb.ResourceSpans + spanCount int +} + +// NewSpansStorage creates a new spans storage. +func NewSpansStorage() SpansStorage { + return SpansStorage{ + rsm: make(map[string]*tracepb.ResourceSpans), + } +} + +// AddSpans adds spans to the spans storage. +func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequest) { + for _, rs := range request.GetResourceSpans() { + rstr := resourceString(rs.Resource) + if existingRs, ok := s.rsm[rstr]; !ok { + s.rsm[rstr] = rs + // TODO (rghetia): Add support for library Info. + if len(rs.ScopeSpans) == 0 { + rs.ScopeSpans = []*tracepb.ScopeSpans{ + { + Spans: []*tracepb.Span{}, + }, + } + } + s.spanCount += len(rs.ScopeSpans[0].Spans) + } else { + if len(rs.ScopeSpans) > 0 { + newSpans := rs.ScopeSpans[0].GetSpans() + existingRs.ScopeSpans[0].Spans = append(existingRs.ScopeSpans[0].Spans, newSpans...) + s.spanCount += len(newSpans) + } + } + } +} + +// GetSpans returns the stored spans. +func (s *SpansStorage) GetSpans() []*tracepb.Span { + spans := make([]*tracepb.Span, 0, s.spanCount) + for _, rs := range s.rsm { + spans = append(spans, rs.ScopeSpans[0].Spans...) + } + return spans +} + +// GetResourceSpans returns the stored resource spans. +func (s *SpansStorage) GetResourceSpans() []*tracepb.ResourceSpans { + rss := make([]*tracepb.ResourceSpans, 0, len(s.rsm)) + for _, rs := range s.rsm { + rss = append(rss, rs) + } + return rss +} + +func resourceString(res *resourcepb.Resource) string { + sAttrs := sortedAttributes(res.GetAttributes()) + rstr := "" + for _, attr := range sAttrs { + rstr = rstr + attr.String() + } + return rstr +} + +func sortedAttributes(attrs []*commonpb.KeyValue) []*commonpb.KeyValue { + sort.Slice(attrs[:], func(i, j int) bool { + return attrs[i].Key < attrs[j].Key + }) + return attrs +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/data.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/data.go new file mode 100644 index 00000000000..d9cb6ff5327 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/data.go @@ -0,0 +1,66 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" + +import ( + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" + tracesdk "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" + "go.opentelemetry.io/otel/trace" +) + +// SingleReadOnlySpan returns a one-element slice with a read-only span. It +// may be useful for testing driver's trace export. +func SingleReadOnlySpan() []tracesdk.ReadOnlySpan { + return tracetest.SpanStubs{ + { + SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{3, 4, 5, 6, 7, 8, 9, 0}, + TraceFlags: trace.FlagsSampled, + }), + Parent: trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, + SpanID: trace.SpanID{1, 2, 3, 4, 5, 6, 7, 8}, + TraceFlags: trace.FlagsSampled, + }), + SpanKind: trace.SpanKindInternal, + Name: "foo", + StartTime: time.Date(2020, time.December, 8, 20, 23, 0, 0, time.UTC), + EndTime: time.Date(2020, time.December, 0, 20, 24, 0, 0, time.UTC), + Attributes: []attribute.KeyValue{}, + Events: []tracesdk.Event{}, + Links: []tracesdk.Link{}, + Status: tracesdk.Status{Code: codes.Ok}, + DroppedAttributes: 0, + DroppedEvents: 0, + DroppedLinks: 0, + ChildSpanCount: 0, + Resource: resource.NewSchemaless(attribute.String("a", "b")), + InstrumentationLibrary: instrumentation.Library{ + Name: "bar", + Version: "0.0.0", + }, + }, + }.Snapshots() +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/otlptest.go new file mode 100644 index 00000000000..b27b147b9e9 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest/otlptest.go @@ -0,0 +1,128 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" + +import ( + "context" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + commonpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// RunEndToEndTest can be used by otlptrace.Client tests to validate +// themselves. +func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, tracesCollector TracesCollector) { + pOpts := []sdktrace.TracerProviderOption{ + sdktrace.WithSampler(sdktrace.AlwaysSample()), + sdktrace.WithBatcher( + exp, + // add following two options to ensure flush + sdktrace.WithBatchTimeout(5*time.Second), + sdktrace.WithMaxExportBatchSize(10), + ), + } + tp1 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv11)"), + attribute.Int64("rk2", 5), + )))...) + + tp2 := sdktrace.NewTracerProvider(append(pOpts, + sdktrace.WithResource(resource.NewSchemaless( + attribute.String("rk1", "rv12)"), + attribute.Float64("rk3", 6.5), + )))...) + + tr1 := tp1.Tracer("test-tracer1") + tr2 := tp2.Tracer("test-tracer2") + // Now create few spans + m := 4 + for i := 0; i < m; i++ { + _, span := tr1.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + + _, span = tr2.Start(ctx, "AlwaysSample") + span.SetAttributes(attribute.Int64("i", int64(i))) + span.End() + } + + func() { + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := tp1.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 1: %v", err) + } + if err := tp2.Shutdown(ctx); err != nil { + t.Fatalf("failed to shut down a tracer provider 2: %v", err) + } + }() + + // Wait >2 cycles. + <-time.After(40 * time.Millisecond) + + // Now shutdown the exporter + ctx, cancel := context.WithTimeout(ctx, 10*time.Second) + defer cancel() + if err := exp.Shutdown(ctx); err != nil { + t.Fatalf("failed to stop the exporter: %v", err) + } + + // Shutdown the collector too so that we can begin + // verification checks of expected data back. + if err := tracesCollector.Stop(); err != nil { + t.Fatalf("failed to stop the mock collector: %v", err) + } + + // Now verify that we only got two resources + rss := tracesCollector.GetResourceSpans() + if got, want := len(rss), 2; got != want { + t.Fatalf("resource span count: got %d, want %d\n", got, want) + } + + // Now verify spans and attributes for each resource span. + for _, rs := range rss { + if len(rs.ScopeSpans) == 0 { + t.Fatalf("zero ScopeSpans") + } + if got, want := len(rs.ScopeSpans[0].Spans), m; got != want { + t.Fatalf("span counts: got %d, want %d", got, want) + } + attrMap := map[int64]bool{} + for _, s := range rs.ScopeSpans[0].Spans { + if gotName, want := s.Name, "AlwaysSample"; gotName != want { + t.Fatalf("span name: got %s, want %s", gotName, want) + } + attrMap[s.Attributes[0].Value.Value.(*commonpb.AnyValue_IntValue).IntValue] = true + } + if got, want := len(attrMap), m; got != want { + t.Fatalf("span attribute unique values: got %d want %d", got, want) + } + for i := 0; i < m; i++ { + _, ok := attrMap[int64(i)] + if !ok { + t.Fatalf("span with attribute %d missing", i) + } + } + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go new file mode 100644 index 00000000000..076905e54bf --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go @@ -0,0 +1,67 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + +import "fmt" + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind string +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "metric data points", + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess_test.go new file mode 100644 index 00000000000..c385c4d428e --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess_test.go @@ -0,0 +1,46 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess_test.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go new file mode 100644 index 00000000000..3ce7d6632b8 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry_test.go @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go index 8c1ad9c9100..ffd14ab6b9d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/mock_collector_test.go @@ -26,7 +26,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/metadata" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlptracetest" collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 566bf30e673..78ce9ad8f0b 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -22,8 +22,8 @@ import ( "google.golang.org/grpc/credentials" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" ) // Option applies an option to the gRPC driver. From f67ecb35dc20c37300d520864fcc36a3d7c94718 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 3 Aug 2023 17:08:49 -0700 Subject: [PATCH 635/886] Decouple `otlp/otlpmetric/otlpmetricgrpc` from `otlp/internal` and `otlp/otlpmetric/internal` using gotmp (#4404) * Add shared otlpmetric templates * Generate otlpmetricgrpc/internal with gotmpl * Use local internal in otlpmetricgrpc * Add decoupling change to changelog --- CHANGELOG.md | 1 + .../otlp/otlpmetric/otlpmetricgrpc/client.go | 6 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 7 +- .../otlp/otlpmetric/otlpmetricgrpc/config.go | 4 +- .../otlpmetric/otlpmetricgrpc/exporter.go | 4 +- .../otlpmetricgrpc/exporter_test.go | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 7 +- .../internal/envconfig/envconfig.go | 202 ++++++ .../internal/envconfig/envconfig_test.go | 464 +++++++++++++ .../otlpmetric/otlpmetricgrpc/internal/gen.go | 42 ++ .../internal/oconf/envconfig.go | 196 ++++++ .../internal/oconf/envconfig_test.go.tmpl | 106 +++ .../otlpmetricgrpc/internal/oconf/options.go | 376 +++++++++++ .../internal/oconf/options_test.go | 534 +++++++++++++++ .../internal/oconf/optiontypes.go | 58 ++ .../otlpmetricgrpc/internal/oconf/tls.go | 49 ++ .../otlpmetricgrpc/internal/otest/client.go | 313 +++++++++ .../internal/otest/client_test.go | 78 +++ .../internal/otest/collector.go | 438 ++++++++++++ .../otlpmetricgrpc/internal/partialsuccess.go | 67 ++ .../internal/partialsuccess_test.go | 46 ++ .../otlpmetricgrpc/internal/retry/retry.go | 156 +++++ .../internal/retry/retry_test.go | 261 ++++++++ .../internal/transform/attribute.go | 155 +++++ .../internal/transform/attribute_test.go | 197 ++++++ .../internal/transform/error.go | 114 ++++ .../internal/transform/error_test.go | 91 +++ .../internal/transform/metricdata.go | 292 ++++++++ .../internal/transform/metricdata_test.go | 633 ++++++++++++++++++ .../otlp/otlpmetric/oconf/envconfig.go.tmpl | 196 ++++++ .../otlpmetric/oconf/envconfig_test.go.tmpl | 106 +++ .../otlp/otlpmetric/oconf/options.go.tmpl | 376 +++++++++++ .../otlpmetric/oconf/options_test.go.tmpl | 534 +++++++++++++++ .../otlp/otlpmetric/oconf/optiontypes.go.tmpl | 58 ++ .../shared/otlp/otlpmetric/oconf/tls.go.tmpl | 49 ++ .../otlp/otlpmetric/otest/client.go.tmpl | 313 +++++++++ .../otlp/otlpmetric/otest/client_test.go.tmpl | 78 +++ .../otlp/otlpmetric/otest/collector.go.tmpl | 438 ++++++++++++ .../otlpmetric/transform/attribute.go.tmpl | 155 +++++ .../transform/attribute_test.go.tmpl | 197 ++++++ .../otlp/otlpmetric/transform/error.go.tmpl | 114 ++++ .../otlpmetric/transform/error_test.go.tmpl | 91 +++ .../otlpmetric/transform/metricdata.go.tmpl | 292 ++++++++ .../transform/metricdata_test.go.tmpl | 633 ++++++++++++++++++ 44 files changed, 8514 insertions(+), 17 deletions(-) create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/optiontypes.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/tls.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go create mode 100644 internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/oconf/options.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/otest/client.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/otest/collector.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/error.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl create mode 100644 internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a2020f7e9..d777414afce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index e4e97acb750..ff0647deec3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -25,9 +25,9 @@ import ( "google.golang.org/grpc/status" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 02f87fb088a..9908b61a379 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -27,9 +27,8 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/durationpb" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -146,7 +145,7 @@ func (clientShim) ForceFlush(ctx context.Context) error { } func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (otest.Client, otest.Collector) { coll, err := otest.NewGRPCCollector("", rCh) require.NoError(t, err) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go index 3b9539c7187..6ba3600b1c1 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -22,8 +22,8 @@ import ( "google.golang.org/grpc/credentials" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" "go.opentelemetry.io/otel/sdk/metric" ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go index 8b228cc5a90..f5d8b7f9148 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go @@ -19,8 +19,8 @@ import ( "fmt" "sync" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go index 299b5e33c8b..fb3e9fe0243 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 9da7b62bb1b..bfb82eb3f6b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -5,10 +5,12 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( + github.com/cenkalti/backoff/v4 v4.2.1 + github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 + go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc @@ -17,16 +19,13 @@ require ( ) require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.10.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..1d571294695 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go new file mode 100644 index 00000000000..01da106579f --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal" + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess_test.go.tmpl "--data={}" --out=partialsuccess_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl "--data={}" --out=oconf/envconfig_test.go.tmpl +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry\"}" --out=oconf/options.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/options_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl "--data={}" --out=oconf/optiontypes.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl "--data={}" --out=oconf/tls.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client.go.tmpl "--data={}" --out=otest/client.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl "--data={\"internalImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal\"}" --out=otest/client_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/collector.go.tmpl "--data={\"oconfImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf\"}" --out=otest/collector.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl "--data={}" --out=transform/attribute.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl "--data={}" --out=transform/attribute_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error.go.tmpl "--data={}" --out=transform/error.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl "--data={}" --out=transform/error_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl "--data={}" --out=transform/metricdata.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl "--data={}" --out=transform/metricdata_test.go diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go new file mode 100644 index 00000000000..a133a60e402 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go @@ -0,0 +1,196 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Metrics.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("METRICS_CLIENT_CERTIFICATE", "METRICS_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("METRICS_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + ) + + return opts +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} + +func withEnvTemporalityPreference(n string, fn func(metric.TemporalitySelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "cumulative": + fn(cumulativeTemporality) + case "delta": + fn(deltaTemporality) + case "lowmemory": + fn(lowMemory) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to an invalid value, ignoring.", "value", s) + } + } + } +} + +func cumulativeTemporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func deltaTemporality(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram, metric.InstrumentKindObservableCounter: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl new file mode 100644 index 00000000000..d497c8e4b6c --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestWithEnvTemporalityPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]metricdata.Temporality + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "cumulative", + envValue: "cumulative", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindHistogram: metricdata.CumulativeTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "delta", + envValue: "delta", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.DeltaTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "lowmemory", + envValue: "lowmemory", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.TemporalitySelector) + return + } + + require.NotNil(t, cfg.Metrics.TemporalitySelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.TemporalitySelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go new file mode 100644 index 00000000000..36d03a5b398 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -0,0 +1,376 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +const ( + // DefaultMaxAttempts describes how many times the driver + // should retry the sending of the payload in case of a + // retryable error. + DefaultMaxAttempts int = 5 + // DefaultMetricsPath is a default URL path for endpoint that + // receives metrics. + DefaultMetricsPath string = "/v1/metrics" + // DefaultBackoff is a default base backoff time used in the + // exponential backoff strategy. + DefaultBackoff time.Duration = 300 * time.Millisecond + // DefaultTimeout is a default max waiting time for the backend to process + // each span or metrics batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + + TemporalitySelector metric.TemporalitySelector + AggregationSelector metric.AggregationSelector + } + + Config struct { + // Signal specific configurations + Metrics SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Metrics.URLPath = cleanPath(cfg.Metrics.URLPath, DefaultMetricsPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Metrics.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials)) + } else if cfg.Metrics.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Metrics.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Metrics.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Metrics.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Metrics.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Timeout = duration + return cfg + }) +} + +func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.TemporalitySelector = selector + return cfg + }) +} + +func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { + // Deep copy and validate before using. + wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = metric.DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.AggregationSelector = wrapped + return cfg + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go new file mode 100644 index 00000000000..1b5c32e5f94 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go @@ -0,0 +1,534 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, NoCompression, c.Metrics.Compression) + assert.Equal(t, map[string]string(nil), c.Metrics.Headers) + assert.Equal(t, 10*time.Second, c.Metrics.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Metrics.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Metrics.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Metrics.Endpoint) + assert.Equal(t, "/prefix/v1/metrics", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "http://env.metrics.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Metrics.Insecure) + assert.Equal(t, "env.metrics.endpoint", c.Metrics.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("metrics_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "metrics_endpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "HtTp://env_metrics_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_metrics_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + assert.Nil(t, c.Metrics.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, 1, len(c.Metrics.TLSCfg.RootCAs.Subjects())) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{ + WithHeaders(map[string]string{"m1": "mv1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"m1": "mv1"}, c.Metrics.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Metrics.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Metrics.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 28*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 5*time.Second) + }, + }, + + // Temporality Selector Tests + { + name: "WithTemporalitySelector", + opts: []GenericOption{ + WithTemporalitySelector(deltaSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a TemporalitySelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.TemporalitySelector + assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) + }, + }, + + // Aggregation Selector Tests + { + name: "WithAggregationSelector", + opts: []GenericOption{ + WithAggregationSelector(dropSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a AggregationSelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.AggregationSelector + assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func dropSelector(metric.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} +} + +func deltaSelector(metric.InstrumentKind) metricdata.Temporality { + return metricdata.DeltaTemporality +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/optiontypes.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/optiontypes.go new file mode 100644 index 00000000000..8a3c8422e1b --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/optiontypes.go @@ -0,0 +1,58 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + +import "time" + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// RetrySettings defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type RetrySettings struct { + // Enabled indicates whether to not retry sending batches in case of export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between + // consecutive retries will always be `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch. + // Once this value is reached, the data is discarded. + MaxElapsedTime time.Duration +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/tls.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/tls.go new file mode 100644 index 00000000000..2e36e0b6f25 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/tls.go @@ -0,0 +1,49 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "os" +) + +// ReadTLSConfigFromFile reads a PEM certificate file and creates +// a tls.Config that will use this certifate to verify a server certificate. +func ReadTLSConfigFromFile(path string) (*tls.Config, error) { + b, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + return CreateTLSConfig(b) +} + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go new file mode 100644 index 00000000000..e5ae9a660c4 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go @@ -0,0 +1,313 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest" + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel" + semconv "go.opentelemetry.io/otel/semconv/v1.17.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" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + kvBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + kvSrvName = &cpb.KeyValue{Key: "service.name", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }} + kvSrvVer = &cpb.KeyValue{Key: "service.version", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }} + + min, max, sum = 2.0, 4.0, 90.0 + hdp = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sum, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + }, + } + + hist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: hdp, + } + + dPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + dPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + sumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: dPtsInt64, + } + sumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: dPtsFloat64, + } + + gaugeInt64 = &mpb.Gauge{DataPoints: dPtsInt64} + gaugeFloat64 = &mpb.Gauge{DataPoints: dPtsFloat64} + + metrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumFloat64}, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: hist}, + }, + } + + scope = &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + } + scopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: scope, + Metrics: metrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + res = &rpb.Resource{ + Attributes: []*cpb.KeyValue{kvSrvName, kvSrvVer}, + } + resourceMetrics = &mpb.ResourceMetrics{ + Resource: res, + ScopeMetrics: scopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +type Client interface { + UploadMetrics(context.Context, *mpb.ResourceMetrics) error + ForceFlush(context.Context) error + Shutdown(context.Context) error +} + +// ClientFactory is a function that when called returns a +// Client implementation that is connected to also returned +// Collector implementation. The Client is ready to upload metric data to the +// Collector which is ready to store that data. +// +// If resultCh is not nil, the returned Collector needs to use the responses +// from that channel to send back to the client for every export request. +type ClientFactory func(resultCh <-chan ExportResult) (Client, Collector) + +// RunClientTests runs a suite of Client integration tests. For example: +// +// t.Run("Integration", RunClientTests(factory)) +func RunClientTests(f ClientFactory) func(*testing.T) { + return func(t *testing.T) { + t.Run("ClientHonorsContextErrors", func(t *testing.T) { + t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.Shutdown + })) + + t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.ForceFlush + })) + + t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return func(ctx context.Context) error { + return c.UploadMetrics(ctx, nil) + } + })) + }) + + t.Run("ForceFlushFlushes", func(t *testing.T) { + ctx := context.Background() + client, collector := f(nil) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + + require.NoError(t, client.ForceFlush(ctx)) + rm := collector.Collect().Dump() + // Data correctness is not important, just it was received. + require.Greater(t, len(rm), 0, "no data uploaded") + + require.NoError(t, client.Shutdown(ctx)) + rm = collector.Collect().Dump() + assert.Len(t, rm, 0, "client did not flush all data") + }) + + t.Run("UploadMetrics", func(t *testing.T) { + ctx := context.Background() + client, coll := f(nil) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + got := coll.Collect().Dump() + require.Len(t, got, 1, "upload of one ResourceMetrics") + diff := cmp.Diff(got[0], resourceMetrics, cmp.Comparer(proto.Equal)) + if diff != "" { + t.Fatalf("unexpected ResourceMetrics:\n%s", diff) + } + }) + + t.Run("PartialSuccess", func(t *testing.T) { + const n, msg = 2, "bad data" + rCh := make(chan ExportResult, 3) + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + RejectedDataPoints: n, + ErrorMessage: msg, + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + // Should not be logged. + RejectedDataPoints: 0, + ErrorMessage: "", + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{}, + } + + ctx := context.Background() + client, _ := f(rCh) + + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + + require.Equal(t, 1, len(errs)) + want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) + assert.ErrorContains(t, errs[0], want) + }) + } +} + +func testCtxErrs(factory func() func(context.Context) error) func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + t.Run("DeadlineExceeded", func(t *testing.T) { + innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) + t.Cleanup(innerCancel) + <-innerCtx.Done() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) + }) + + t.Run("Canceled", func(t *testing.T) { + innerCtx, innerCancel := context.WithCancel(ctx) + innerCancel() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.Canceled) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go new file mode 100644 index 00000000000..9a6f8fe61f0 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go @@ -0,0 +1,78 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +type client struct { + rCh <-chan ExportResult + storage *Storage +} + +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { + return metric.DefaultTemporalitySelector(k) +} + +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { + return metric.DefaultAggregationSelector(k) +} + +func (c *client) Collect() *Storage { + return c.storage +} + +func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) error { + c.storage.Add(&cpb.ExportMetricsServiceRequest{ + ResourceMetrics: []*mpb.ResourceMetrics{rm}, + }) + if c.rCh != nil { + r := <-c.rCh + if r.Response != nil && r.Response.GetPartialSuccess() != nil { + msg := r.Response.GetPartialSuccess().GetErrorMessage() + n := r.Response.GetPartialSuccess().GetRejectedDataPoints() + if msg != "" || n > 0 { + otel.Handle(internal.MetricPartialSuccessError(n, msg)) + } + } + return r.Err + } + return ctx.Err() +} + +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } +func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } + +func TestClientTests(t *testing.T) { + factory := func(rCh <-chan ExportResult) (Client, Collector) { + c := &client{rCh: rCh, storage: NewStorage()} + return c, c + } + + t.Run("Integration", RunClientTests(factory)) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go new file mode 100644 index 00000000000..f5eb0a4af9c --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go @@ -0,0 +1,438 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest" + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" // nolint:depguard // This is for testing. + "encoding/pem" + "errors" + "fmt" + "io" + "math/big" + "net" + "net/http" + "net/url" + "sync" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" + collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +// Collector is the collection target a Client sends metric uploads to. +type Collector interface { + Collect() *Storage +} + +type ExportResult struct { + Response *collpb.ExportMetricsServiceResponse + Err error +} + +// Storage stores uploaded OTLP metric data in their proto form. +type Storage struct { + dataMu sync.Mutex + data []*mpb.ResourceMetrics +} + +// NewStorage returns a configure storage ready to store received requests. +func NewStorage() *Storage { + return &Storage{} +} + +// Add adds the request to the Storage. +func (s *Storage) Add(request *collpb.ExportMetricsServiceRequest) { + s.dataMu.Lock() + defer s.dataMu.Unlock() + s.data = append(s.data, request.ResourceMetrics...) +} + +// Dump returns all added ResourceMetrics and clears the storage. +func (s *Storage) Dump() []*mpb.ResourceMetrics { + s.dataMu.Lock() + defer s.dataMu.Unlock() + + var data []*mpb.ResourceMetrics + data, s.data = s.data, []*mpb.ResourceMetrics{} + return data +} + +// GRPCCollector is an OTLP gRPC server that collects all requests it receives. +type GRPCCollector struct { + collpb.UnimplementedMetricsServiceServer + + headersMu sync.Mutex + headers metadata.MD + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *grpc.Server +} + +// NewGRPCCollector returns a *GRPCCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port. +// +// If errCh is not nil, the collector will respond to Export calls with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewGRPCCollector(endpoint string, resultCh <-chan ExportResult) (*GRPCCollector, error) { + if endpoint == "" { + endpoint = "localhost:0" + } + + c := &GRPCCollector{ + storage: NewStorage(), + resultCh: resultCh, + } + + var err error + c.listener, err = net.Listen("tcp", endpoint) + if err != nil { + return nil, err + } + + c.srv = grpc.NewServer() + collpb.RegisterMetricsServiceServer(c.srv, c) + go func() { _ = c.srv.Serve(c.listener) }() + + return c, nil +} + +// Shutdown shuts down the gRPC server closing all open connections and +// listeners immediately. +func (c *GRPCCollector) Shutdown() { c.srv.Stop() } + +// Addr returns the net.Addr c is listening at. +func (c *GRPCCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *GRPCCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *GRPCCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return metadata.Join(c.headers) +} + +// Export handles the export req. +func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsServiceRequest) (*collpb.ExportMetricsServiceResponse, error) { + c.storage.Add(req) + + if h, ok := metadata.FromIncomingContext(ctx); ok { + c.headersMu.Lock() + c.headers = metadata.Join(c.headers, h) + c.headersMu.Unlock() + } + + if c.resultCh != nil { + r := <-c.resultCh + if r.Response == nil { + return &collpb.ExportMetricsServiceResponse{}, r.Err + } + return r.Response, r.Err + } + return &collpb.ExportMetricsServiceResponse{}, nil +} + +var emptyExportMetricsServiceResponse = func() []byte { + body := collpb.ExportMetricsServiceResponse{} + r, err := proto.Marshal(&body) + if err != nil { + panic(err) + } + return r +}() + +type HTTPResponseError struct { + Err error + Status int + Header http.Header +} + +func (e *HTTPResponseError) Error() string { + return fmt.Sprintf("%d: %s", e.Status, e.Err) +} + +func (e *HTTPResponseError) Unwrap() error { return e.Err } + +// HTTPCollector is an OTLP HTTP server that collects all requests it receives. +type HTTPCollector struct { + headersMu sync.Mutex + headers http.Header + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *http.Server +} + +// NewHTTPCollector returns a *HTTPCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port, not use TLS, and listen at the +// default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains +// a prefix of "https" the server will generate weak self-signed TLS +// certificates and use them to server data. If the endpoint contains a path, +// that path will be used instead of the default OTLP metric endpoint path. +// +// If errCh is not nil, the collector will respond to HTTP requests with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { + u, err := url.Parse(endpoint) + if err != nil { + return nil, err + } + if u.Host == "" { + u.Host = "localhost:0" + } + if u.Path == "" { + u.Path = oconf.DefaultMetricsPath + } + + c := &HTTPCollector{ + headers: http.Header{}, + storage: NewStorage(), + resultCh: resultCh, + } + + c.listener, err = net.Listen("tcp", u.Host) + if err != nil { + return nil, err + } + + mux := http.NewServeMux() + mux.Handle(u.Path, http.HandlerFunc(c.handler)) + c.srv = &http.Server{Handler: mux} + if u.Scheme == "https" { + cert, err := weakCertificate() + if err != nil { + return nil, err + } + c.srv.TLSConfig = &tls.Config{ + Certificates: []tls.Certificate{cert}, + } + go func() { _ = c.srv.ServeTLS(c.listener, "", "") }() + } else { + go func() { _ = c.srv.Serve(c.listener) }() + } + return c, nil +} + +// Shutdown shuts down the HTTP server closing all open connections and +// listeners. +func (c *HTTPCollector) Shutdown(ctx context.Context) error { + return c.srv.Shutdown(ctx) +} + +// Addr returns the net.Addr c is listening at. +func (c *HTTPCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *HTTPCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *HTTPCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return c.headers.Clone() +} + +func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { + c.respond(w, c.record(r)) +} + +func (c *HTTPCollector) record(r *http.Request) ExportResult { + // Currently only supports protobuf. + if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { + err := fmt.Errorf("content-type not supported: %s", v) + return ExportResult{Err: err} + } + + body, err := c.readBody(r) + if err != nil { + return ExportResult{Err: err} + } + pbRequest := &collpb.ExportMetricsServiceRequest{} + err = proto.Unmarshal(body, pbRequest) + if err != nil { + return ExportResult{ + Err: &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + }, + } + } + c.storage.Add(pbRequest) + + c.headersMu.Lock() + for k, vals := range r.Header { + for _, v := range vals { + c.headers.Add(k, v) + } + } + c.headersMu.Unlock() + + if c.resultCh != nil { + return <-c.resultCh + } + return ExportResult{Err: err} +} + +func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { + var reader io.ReadCloser + switch r.Header.Get("Content-Encoding") { + case "gzip": + reader, err = gzip.NewReader(r.Body) + if err != nil { + _ = reader.Close() + return nil, &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + default: + reader = r.Body + } + + defer func() { + cErr := reader.Close() + if err == nil && cErr != nil { + err = &HTTPResponseError{ + Err: cErr, + Status: http.StatusInternalServerError, + } + } + }() + body, err = io.ReadAll(reader) + if err != nil { + err = &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + return body, err +} + +func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { + if resp.Err != nil { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.Header().Set("X-Content-Type-Options", "nosniff") + var e *HTTPResponseError + if errors.As(resp.Err, &e) { + for k, vals := range e.Header { + for _, v := range vals { + w.Header().Add(k, v) + } + } + w.WriteHeader(e.Status) + fmt.Fprintln(w, e.Error()) + } else { + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintln(w, resp.Err.Error()) + } + return + } + + w.Header().Set("Content-Type", "application/x-protobuf") + w.WriteHeader(http.StatusOK) + if resp.Response == nil { + _, _ = w.Write(emptyExportMetricsServiceResponse) + } else { + r, err := proto.Marshal(resp.Response) + if err != nil { + panic(err) + } + _, _ = w.Write(r) + } +} + +// Based on https://golang.org/src/crypto/tls/generate_cert.go, +// simplified and weakened. +func weakCertificate() (tls.Certificate, error) { + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return tls.Certificate{}, err + } + notBefore := time.Now() + notAfter := notBefore.Add(time.Hour) + max := new(big.Int).Lsh(big.NewInt(1), 128) + sn, err := rand.Int(rand.Reader, max) + if err != nil { + return tls.Certificate{}, err + } + tmpl := x509.Certificate{ + SerialNumber: sn, + Subject: pkix.Name{Organization: []string{"otel-go"}}, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + DNSNames: []string{"localhost"}, + IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, + } + derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) + if err != nil { + return tls.Certificate{}, err + } + var certBuf bytes.Buffer + err = pem.Encode(&certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) + if err != nil { + return tls.Certificate{}, err + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + var privBuf bytes.Buffer + err = pem.Encode(&privBuf, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) + if err != nil { + return tls.Certificate{}, err + } + return tls.X509KeyPair(certBuf.Bytes(), privBuf.Bytes()) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess.go new file mode 100644 index 00000000000..f4d48198251 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess.go @@ -0,0 +1,67 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal" + +import "fmt" + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind string +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "metric data points", + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess_test.go new file mode 100644 index 00000000000..c385c4d428e --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/partialsuccess_test.go @@ -0,0 +1,46 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess_test.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry.go new file mode 100644 index 00000000000..689779c3604 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry.go @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry/retry_test.go @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute.go new file mode 100644 index 00000000000..e80798eebde --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute.go @@ -0,0 +1,155 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform" + +import ( + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// AttrIter transforms an attribute iterator into OTLP key-values. +func AttrIter(iter attribute.Iterator) []*cpb.KeyValue { + l := iter.Len() + if l == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, l) + for iter.Next() { + out = append(out, KeyValue(iter.Attribute())) + } + return out +} + +// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. +func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue { + if len(attrs) == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, len(attrs)) + for _, kv := range attrs { + out = append(out, KeyValue(kv)) + } + return out +} + +// KeyValue transforms an attribute KeyValue into an OTLP key-value. +func KeyValue(kv attribute.KeyValue) *cpb.KeyValue { + return &cpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} +} + +// Value transforms an attribute Value into an OTLP AnyValue. +func Value(v attribute.Value) *cpb.AnyValue { + av := new(cpb.AnyValue) + switch v.Type() { + case attribute.BOOL: + av.Value = &cpb.AnyValue_BoolValue{ + BoolValue: v.AsBool(), + } + case attribute.BOOLSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: boolSliceValues(v.AsBoolSlice()), + }, + } + case attribute.INT64: + av.Value = &cpb.AnyValue_IntValue{ + IntValue: v.AsInt64(), + } + case attribute.INT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: int64SliceValues(v.AsInt64Slice()), + }, + } + case attribute.FLOAT64: + av.Value = &cpb.AnyValue_DoubleValue{ + DoubleValue: v.AsFloat64(), + } + case attribute.FLOAT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: float64SliceValues(v.AsFloat64Slice()), + }, + } + case attribute.STRING: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: v.AsString(), + } + case attribute.STRINGSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: stringSliceValues(v.AsStringSlice()), + }, + } + default: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: "INVALID", + } + } + return av +} + +func boolSliceValues(vals []bool) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_BoolValue{ + BoolValue: v, + }, + } + } + return converted +} + +func int64SliceValues(vals []int64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_IntValue{ + IntValue: v, + }, + } + } + return converted +} + +func float64SliceValues(vals []float64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_DoubleValue{ + DoubleValue: v, + }, + } + } + return converted +} + +func stringSliceValues(vals []string) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{ + StringValue: v, + }, + } + } + return converted +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute_test.go new file mode 100644 index 00000000000..57db7ab797b --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/attribute_test.go @@ -0,0 +1,197 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +var ( + attrBool = attribute.Bool("bool", true) + attrBoolSlice = attribute.BoolSlice("bool slice", []bool{true, false}) + attrInt = attribute.Int("int", 1) + attrIntSlice = attribute.IntSlice("int slice", []int{-1, 1}) + attrInt64 = attribute.Int64("int64", 1) + attrInt64Slice = attribute.Int64Slice("int64 slice", []int64{-1, 1}) + attrFloat64 = attribute.Float64("float64", 1) + attrFloat64Slice = attribute.Float64Slice("float64 slice", []float64{-1, 1}) + attrString = attribute.String("string", "o") + attrStringSlice = attribute.StringSlice("string slice", []string{"o", "n"}) + attrInvalid = attribute.KeyValue{ + Key: attribute.Key("invalid"), + Value: attribute.Value{}, + } + + valBoolTrue = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: true}} + valBoolFalse = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: false}} + valBoolSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valBoolTrue, valBoolFalse}, + }, + }} + valIntOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: 1}} + valIntNOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: -1}} + valIntSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valIntNOne, valIntOne}, + }, + }} + valDblOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: 1}} + valDblNOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: -1}} + valDblSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valDblNOne, valDblOne}, + }, + }} + valStrO = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "o"}} + valStrN = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "n"}} + valStrSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valStrO, valStrN}, + }, + }} + + kvBool = &cpb.KeyValue{Key: "bool", Value: valBoolTrue} + kvBoolSlice = &cpb.KeyValue{Key: "bool slice", Value: valBoolSlice} + kvInt = &cpb.KeyValue{Key: "int", Value: valIntOne} + kvIntSlice = &cpb.KeyValue{Key: "int slice", Value: valIntSlice} + kvInt64 = &cpb.KeyValue{Key: "int64", Value: valIntOne} + kvInt64Slice = &cpb.KeyValue{Key: "int64 slice", Value: valIntSlice} + kvFloat64 = &cpb.KeyValue{Key: "float64", Value: valDblOne} + kvFloat64Slice = &cpb.KeyValue{Key: "float64 slice", Value: valDblSlice} + kvString = &cpb.KeyValue{Key: "string", Value: valStrO} + kvStringSlice = &cpb.KeyValue{Key: "string slice", Value: valStrSlice} + kvInvalid = &cpb.KeyValue{ + Key: "invalid", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "INVALID"}, + }, + } +) + +type attributeTest struct { + name string + in []attribute.KeyValue + want []*cpb.KeyValue +} + +func TestAttributeTransforms(t *testing.T) { + for _, test := range []attributeTest{ + {"nil", nil, nil}, + {"empty", []attribute.KeyValue{}, nil}, + { + "invalid", + []attribute.KeyValue{attrInvalid}, + []*cpb.KeyValue{kvInvalid}, + }, + { + "bool", + []attribute.KeyValue{attrBool}, + []*cpb.KeyValue{kvBool}, + }, + { + "bool slice", + []attribute.KeyValue{attrBoolSlice}, + []*cpb.KeyValue{kvBoolSlice}, + }, + { + "int", + []attribute.KeyValue{attrInt}, + []*cpb.KeyValue{kvInt}, + }, + { + "int slice", + []attribute.KeyValue{attrIntSlice}, + []*cpb.KeyValue{kvIntSlice}, + }, + { + "int64", + []attribute.KeyValue{attrInt64}, + []*cpb.KeyValue{kvInt64}, + }, + { + "int64 slice", + []attribute.KeyValue{attrInt64Slice}, + []*cpb.KeyValue{kvInt64Slice}, + }, + { + "float64", + []attribute.KeyValue{attrFloat64}, + []*cpb.KeyValue{kvFloat64}, + }, + { + "float64 slice", + []attribute.KeyValue{attrFloat64Slice}, + []*cpb.KeyValue{kvFloat64Slice}, + }, + { + "string", + []attribute.KeyValue{attrString}, + []*cpb.KeyValue{kvString}, + }, + { + "string slice", + []attribute.KeyValue{attrStringSlice}, + []*cpb.KeyValue{kvStringSlice}, + }, + { + "all", + []attribute.KeyValue{ + attrBool, + attrBoolSlice, + attrInt, + attrIntSlice, + attrInt64, + attrInt64Slice, + attrFloat64, + attrFloat64Slice, + attrString, + attrStringSlice, + attrInvalid, + }, + []*cpb.KeyValue{ + kvBool, + kvBoolSlice, + kvInt, + kvIntSlice, + kvInt64, + kvInt64Slice, + kvFloat64, + kvFloat64Slice, + kvString, + kvStringSlice, + kvInvalid, + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + t.Run("KeyValues", func(t *testing.T) { + assert.ElementsMatch(t, test.want, KeyValues(test.in)) + }) + t.Run("AttrIter", func(t *testing.T) { + s := attribute.NewSet(test.in...) + assert.ElementsMatch(t, test.want, AttrIter(s.Iter())) + }) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error.go new file mode 100644 index 00000000000..d5d2fdcb7ea --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error.go @@ -0,0 +1,114 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform" + +import ( + "errors" + "fmt" + "strings" + + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +var ( + errUnknownAggregation = errors.New("unknown aggregation") + errUnknownTemporality = errors.New("unknown temporality") +) + +type errMetric struct { + m *mpb.Metric + err error +} + +func (e errMetric) Unwrap() error { + return e.err +} + +func (e errMetric) Error() string { + format := "invalid metric (name: %q, description: %q, unit: %q): %s" + return fmt.Sprintf(format, e.m.Name, e.m.Description, e.m.Unit, e.err) +} + +func (e errMetric) Is(target error) bool { + return errors.Is(e.err, target) +} + +// multiErr is used by the data-type transform functions to wrap multiple +// errors into a single return value. The error message will show all errors +// as a list and scope them by the datatype name that is returning them. +type multiErr struct { + datatype string + errs []error +} + +// errOrNil returns nil if e contains no errors, otherwise it returns e. +func (e *multiErr) errOrNil() error { + if len(e.errs) == 0 { + return nil + } + return e +} + +// append adds err to e. If err is a multiErr, its errs are flattened into e. +func (e *multiErr) append(err error) { + // Do not use errors.As here, this should only be flattened one layer. If + // there is a *multiErr several steps down the chain, all the errors above + // it will be discarded if errors.As is used instead. + switch other := err.(type) { + case *multiErr: + // Flatten err errors into e. + e.errs = append(e.errs, other.errs...) + default: + e.errs = append(e.errs, err) + } +} + +func (e *multiErr) Error() string { + es := make([]string, len(e.errs)) + for i, err := range e.errs { + es[i] = fmt.Sprintf("* %s", err) + } + + format := "%d errors occurred transforming %s:\n\t%s" + return fmt.Sprintf(format, len(es), e.datatype, strings.Join(es, "\n\t")) +} + +func (e *multiErr) Unwrap() error { + switch len(e.errs) { + case 0: + return nil + case 1: + return e.errs[0] + } + + // Return a multiErr without the leading error. + cp := &multiErr{ + datatype: e.datatype, + errs: make([]error, len(e.errs)-1), + } + copy(cp.errs, e.errs[1:]) + return cp +} + +func (e *multiErr) Is(target error) bool { + if len(e.errs) == 0 { + return false + } + // Check if the first error is target. + return errors.Is(e.errs[0], target) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error_test.go new file mode 100644 index 00000000000..03e16ef8f14 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/error_test.go @@ -0,0 +1,91 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + e0 = errMetric{m: pbMetrics[0], err: errUnknownAggregation} + e1 = errMetric{m: pbMetrics[1], err: errUnknownTemporality} +) + +type testingErr struct{} + +func (testingErr) Error() string { return "testing error" } + +// errFunc is a non-comparable error type. +type errFunc func() string + +func (e errFunc) Error() string { + return e() +} + +func TestMultiErr(t *testing.T) { + const name = "TestMultiErr" + me := &multiErr{datatype: name} + + t.Run("ErrOrNil", func(t *testing.T) { + require.Nil(t, me.errOrNil()) + me.errs = []error{e0} + assert.Error(t, me.errOrNil()) + }) + + var testErr testingErr + t.Run("AppendError", func(t *testing.T) { + me.append(testErr) + assert.Equal(t, testErr, me.errs[len(me.errs)-1]) + }) + + t.Run("AppendFlattens", func(t *testing.T) { + other := &multiErr{datatype: "OtherTestMultiErr", errs: []error{e1}} + me.append(other) + assert.Equal(t, e1, me.errs[len(me.errs)-1]) + }) + + t.Run("ErrorMessage", func(t *testing.T) { + // Test the overall structure of the message, but not the exact + // language so this doesn't become a change-indicator. + msg := me.Error() + lines := strings.Split(msg, "\n") + assert.Equalf(t, 4, len(lines), "expected a 4 line error message, got:\n\n%s", msg) + assert.Contains(t, msg, name) + assert.Contains(t, msg, e0.Error()) + assert.Contains(t, msg, testErr.Error()) + assert.Contains(t, msg, e1.Error()) + }) + + t.Run("ErrorIs", func(t *testing.T) { + assert.ErrorIs(t, me, errUnknownAggregation) + assert.ErrorIs(t, me, e0) + assert.ErrorIs(t, me, testErr) + assert.ErrorIs(t, me, errUnknownTemporality) + assert.ErrorIs(t, me, e1) + + errUnknown := errFunc(func() string { return "unknown error" }) + assert.NotErrorIs(t, me, errUnknown) + + var empty multiErr + assert.NotErrorIs(t, &empty, errUnknownTemporality) + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go new file mode 100644 index 00000000000..00d5c74ad90 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go @@ -0,0 +1,292 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package transform provides transformation functionality from the +// sdk/metric/metricdata data-types into OTLP data-types. +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform" + +import ( + "fmt" + "time" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/common/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +// ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm +// contains invalid ScopeMetrics, an error will be returned along with an OTLP +// ResourceMetrics that contains partial OTLP ScopeMetrics. +func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { + sms, err := ScopeMetrics(rm.ScopeMetrics) + return &mpb.ResourceMetrics{ + Resource: &rpb.Resource{ + Attributes: AttrIter(rm.Resource.Iter()), + }, + ScopeMetrics: sms, + SchemaUrl: rm.Resource.SchemaURL(), + }, err +} + +// ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If +// sms contains invalid metric values, an error will be returned along with a +// slice that contains partial OTLP ScopeMetrics. +func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error) { + errs := &multiErr{datatype: "ScopeMetrics"} + out := make([]*mpb.ScopeMetrics, 0, len(sms)) + for _, sm := range sms { + ms, err := Metrics(sm.Metrics) + if err != nil { + errs.append(err) + } + + out = append(out, &mpb.ScopeMetrics{ + Scope: &cpb.InstrumentationScope{ + Name: sm.Scope.Name, + Version: sm.Scope.Version, + }, + Metrics: ms, + SchemaUrl: sm.Scope.SchemaURL, + }) + } + return out, errs.errOrNil() +} + +// Metrics returns a slice of OTLP Metric generated from ms. If ms contains +// invalid metric values, an error will be returned along with a slice that +// contains partial OTLP Metrics. +func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error) { + errs := &multiErr{datatype: "Metrics"} + out := make([]*mpb.Metric, 0, len(ms)) + for _, m := range ms { + o, err := metric(m) + if err != nil { + // Do not include invalid data. Drop the metric, report the error. + errs.append(errMetric{m: o, err: err}) + continue + } + out = append(out, o) + } + return out, errs.errOrNil() +} + +func metric(m metricdata.Metrics) (*mpb.Metric, error) { + var err error + out := &mpb.Metric{ + Name: m.Name, + Description: m.Description, + Unit: string(m.Unit), + } + switch a := m.Data.(type) { + case metricdata.Gauge[int64]: + out.Data = Gauge[int64](a) + case metricdata.Gauge[float64]: + out.Data = Gauge[float64](a) + case metricdata.Sum[int64]: + out.Data, err = Sum[int64](a) + case metricdata.Sum[float64]: + out.Data, err = Sum[float64](a) + case metricdata.Histogram[int64]: + out.Data, err = Histogram(a) + case metricdata.Histogram[float64]: + out.Data, err = Histogram(a) + case metricdata.ExponentialHistogram[int64]: + out.Data, err = ExponentialHistogram(a) + case metricdata.ExponentialHistogram[float64]: + out.Data, err = ExponentialHistogram(a) + default: + return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) + } + return out, err +} + +// Gauge returns an OTLP Metric_Gauge generated from g. +func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { + return &mpb.Metric_Gauge{ + Gauge: &mpb.Gauge{ + DataPoints: DataPoints(g.DataPoints), + }, + } +} + +// Sum returns an OTLP Metric_Sum generated from s. An error is returned +// if the temporality of s is unknown. +func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { + t, err := Temporality(s.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Sum{ + Sum: &mpb.Sum{ + AggregationTemporality: t, + IsMonotonic: s.IsMonotonic, + DataPoints: DataPoints(s.DataPoints), + }, + }, nil +} + +// DataPoints returns a slice of OTLP NumberDataPoint generated from dPts. +func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint { + out := make([]*mpb.NumberDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + ndp := &mpb.NumberDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + } + switch v := any(dPt.Value).(type) { + case int64: + ndp.Value = &mpb.NumberDataPoint_AsInt{ + AsInt: v, + } + case float64: + ndp.Value = &mpb.NumberDataPoint_AsDouble{ + AsDouble: v, + } + } + out = append(out, ndp) + } + return out +} + +// Histogram returns an OTLP Metric_Histogram generated from h. An error is +// returned if the temporality of h is unknown. +func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Histogram{ + Histogram: &mpb.Histogram{ + AggregationTemporality: t, + DataPoints: HistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated +// from dPts. +func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { + out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + hdp := &mpb.HistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + BucketCounts: dPt.BucketCounts, + ExplicitBounds: dPt.Bounds, + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + hdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + hdp.Max = &vF64 + } + out = append(out, hdp) + } + return out +} + +// ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is +// returned if the temporality of h is unknown. +func ExponentialHistogram[N int64 | float64](h metricdata.ExponentialHistogram[N]) (*mpb.Metric_ExponentialHistogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_ExponentialHistogram{ + ExponentialHistogram: &mpb.ExponentialHistogram{ + AggregationTemporality: t, + DataPoints: ExponentialHistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated +// from dPts. +func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint { + out := make([]*mpb.ExponentialHistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + ehdp := &mpb.ExponentialHistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + Scale: dPt.Scale, + ZeroCount: dPt.ZeroCount, + + Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), + Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + ehdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + ehdp.Max = &vF64 + } + out = append(out, ehdp) + } + return out +} + +// ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated +// from bucket. +func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets { + return &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: bucket.Offset, + BucketCounts: bucket.Counts, + } +} + +// Temporality returns an OTLP AggregationTemporality generated from t. If t +// is unknown, an error is returned along with the invalid +// AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. +func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { + switch t { + case metricdata.DeltaTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, nil + case metricdata.CumulativeTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, nil + default: + err := fmt.Errorf("%w: %s", errUnknownTemporality, t) + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err + } +} + +// timeUnixNano returns t as a Unix time, the number of nanoseconds elapsed +// since January 1, 1970 UTC as uint64. +// The result is undefined if the Unix time +// in nanoseconds cannot be represented by an int64 +// (a date before the year 1678 or after 2262). +// timeUnixNano on the zero Time returns 0. +// The result does not depend on the location associated with t. +func timeUnixNano(t time.Time) uint64 { + if t.IsZero() { + return 0 + } + return uint64(t.UnixNano()) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go new file mode 100644 index 00000000000..95dca158be7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go @@ -0,0 +1,633 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "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.17.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" +) + +type unknownAggT struct { + metricdata.Aggregation +} + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + alice = attribute.NewSet(attribute.String("user", "alice")) + bob = attribute.NewSet(attribute.String("user", "bob")) + + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + pbBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + + minA, maxA, sumA = 2.0, 4.0, 90.0 + minB, maxB, sumB = 4.0, 150.0, 234.0 + otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + otelEBucketA = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketB = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketsC = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 1}, + } + otelEBucketsD = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 1}, + } + + otelEHDPInt64 = []metricdata.ExponentialHistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + pbHDP = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + }, + } + + pbEHDPBA = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBB = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBC = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 1}, + } + pbEHDPBD = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 1}, + } + + pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + }, + } + + otelHistInt64 = metricdata.Histogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPInt64, + } + otelHistFloat64 = metricdata.Histogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPFloat64, + } + invalidTemporality metricdata.Temporality + otelHistInvalid = metricdata.Histogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelHDPInt64, + } + + otelExpoHistInt64 = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPInt64, + } + otelExpoHistFloat64 = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPFloat64, + } + otelExpoHistInvalid = metricdata.ExponentialHistogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelEHDPInt64, + } + + pbHist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDP, + } + + pbExpoHist = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDP, + } + + otelDPtsInt64 = []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1}, + {Attributes: bob, StartTime: start, Time: end, Value: 2}, + } + otelDPtsFloat64 = []metricdata.DataPoint[float64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, + {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + } + + pbDPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + pbDPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + otelSumInt64 = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: otelDPtsInt64, + } + otelSumFloat64 = metricdata.Sum[float64]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + otelSumInvalid = metricdata.Sum[float64]{ + Temporality: invalidTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + + pbSumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: pbDPtsInt64, + } + pbSumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: pbDPtsFloat64, + } + + otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} + otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + otelGaugeZeroStartTime = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + }, + } + + pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} + pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + pbGaugeZeroStartTime = &mpb.Gauge{DataPoints: []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: 0, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + }} + + unknownAgg unknownAggT + otelMetrics = []metricdata.Metrics{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: otelGaugeInt64, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: otelGaugeFloat64, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: otelSumInt64, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: otelSumFloat64, + }, + { + Name: "invalid-sum", + Description: "Sum with invalid temporality", + Unit: "1", + Data: otelSumInvalid, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistInt64, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistFloat64, + }, + { + Name: "invalid-histogram", + Description: "Invalid histogram", + Unit: "1", + Data: otelHistInvalid, + }, + { + Name: "unknown", + Description: "Unknown aggregation", + Unit: "1", + Data: unknownAgg, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistInt64, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistFloat64, + }, + { + Name: "invalid-ExponentialHistogram", + Description: "Invalid Exponential Histogram", + Unit: "1", + Data: otelExpoHistInvalid, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: otelGaugeZeroStartTime, + }, + } + + pbMetrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeZeroStartTime}, + }, + } + + otelScopeMetrics = []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "test/code/path", + Version: "v0.1.0", + SchemaURL: semconv.SchemaURL, + }, + Metrics: otelMetrics, + }, + } + + pbScopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + }, + Metrics: pbMetrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + otelRes = resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceName("test server"), + semconv.ServiceVersion("v0.1.0"), + ) + + pbRes = &rpb.Resource{ + Attributes: []*cpb.KeyValue{ + { + Key: "service.name", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }, + }, + { + Key: "service.version", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }, + }, + }, + } + + otelResourceMetrics = &metricdata.ResourceMetrics{ + Resource: otelRes, + ScopeMetrics: otelScopeMetrics, + } + + pbResourceMetrics = &mpb.ResourceMetrics{ + Resource: pbRes, + ScopeMetrics: pbScopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +func TestTransformations(t *testing.T) { + // Run tests from the "bottom-up" of the metricdata data-types and halt + // when a failure occurs to ensure the clearest failure message (as + // opposed to the opposite of testing from the top-down which will obscure + // errors deep inside the structs). + + // DataPoint types. + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) + require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) + + // Aggregations. + h, err := Histogram(otelHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, h) + + s, err := Sum[int64](otelSumInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumInt64}, s) + s, err = Sum[float64](otelSumFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumFloat64}, s) + s, err = Sum[float64](otelSumInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, s) + + assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) + require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) + + e, err := ExponentialHistogram(otelExpoHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, e) + + // Metrics. + m, err := Metrics(otelMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbMetrics, m) + + // Scope Metrics. + sm, err := ScopeMetrics(otelScopeMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbScopeMetrics, sm) + + // Resource Metrics. + rm, err := ResourceMetrics(otelResourceMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbResourceMetrics, rm) +} diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl new file mode 100644 index 00000000000..33e97069ce5 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl @@ -0,0 +1,196 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "{{ .envconfigImportPath }}" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Metrics.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("METRICS_CLIENT_CERTIFICATE", "METRICS_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("METRICS_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + ) + + return opts +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} + +func withEnvTemporalityPreference(n string, fn func(metric.TemporalitySelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "cumulative": + fn(cumulativeTemporality) + case "delta": + fn(deltaTemporality) + case "lowmemory": + fn(lowMemory) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to an invalid value, ignoring.", "value", s) + } + } + } +} + +func cumulativeTemporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func deltaTemporality(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram, metric.InstrumentKindObservableCounter: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl new file mode 100644 index 00000000000..d497c8e4b6c --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestWithEnvTemporalityPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]metricdata.Temporality + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "cumulative", + envValue: "cumulative", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindHistogram: metricdata.CumulativeTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "delta", + envValue: "delta", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.DeltaTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "lowmemory", + envValue: "lowmemory", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.TemporalitySelector) + return + } + + require.NotNil(t, cfg.Metrics.TemporalitySelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.TemporalitySelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl new file mode 100644 index 00000000000..fb373a634bf --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -0,0 +1,376 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "{{ .retryImportPath }}" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +const ( + // DefaultMaxAttempts describes how many times the driver + // should retry the sending of the payload in case of a + // retryable error. + DefaultMaxAttempts int = 5 + // DefaultMetricsPath is a default URL path for endpoint that + // receives metrics. + DefaultMetricsPath string = "/v1/metrics" + // DefaultBackoff is a default base backoff time used in the + // exponential backoff strategy. + DefaultBackoff time.Duration = 300 * time.Millisecond + // DefaultTimeout is a default max waiting time for the backend to process + // each span or metrics batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + + TemporalitySelector metric.TemporalitySelector + AggregationSelector metric.AggregationSelector + } + + Config struct { + // Signal specific configurations + Metrics SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Metrics.URLPath = cleanPath(cfg.Metrics.URLPath, DefaultMetricsPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Metrics.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials)) + } else if cfg.Metrics.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Metrics.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Metrics.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Metrics.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Metrics.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Timeout = duration + return cfg + }) +} + +func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.TemporalitySelector = selector + return cfg + }) +} + +func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { + // Deep copy and validate before using. + wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = metric.DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.AggregationSelector = wrapped + return cfg + }) +} diff --git a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl new file mode 100644 index 00000000000..3b0a4f1f0c8 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl @@ -0,0 +1,534 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "{{ .envconfigImportPath }}" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, NoCompression, c.Metrics.Compression) + assert.Equal(t, map[string]string(nil), c.Metrics.Headers) + assert.Equal(t, 10*time.Second, c.Metrics.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Metrics.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Metrics.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Metrics.Endpoint) + assert.Equal(t, "/prefix/v1/metrics", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "http://env.metrics.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Metrics.Insecure) + assert.Equal(t, "env.metrics.endpoint", c.Metrics.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("metrics_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "metrics_endpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "HtTp://env_metrics_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_metrics_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + assert.Nil(t, c.Metrics.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, 1, len(c.Metrics.TLSCfg.RootCAs.Subjects())) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{ + WithHeaders(map[string]string{"m1": "mv1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"m1": "mv1"}, c.Metrics.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Metrics.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Metrics.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 28*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 5*time.Second) + }, + }, + + // Temporality Selector Tests + { + name: "WithTemporalitySelector", + opts: []GenericOption{ + WithTemporalitySelector(deltaSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a TemporalitySelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.TemporalitySelector + assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) + }, + }, + + // Aggregation Selector Tests + { + name: "WithAggregationSelector", + opts: []GenericOption{ + WithAggregationSelector(dropSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a AggregationSelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.AggregationSelector + assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func dropSelector(metric.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} +} + +func deltaSelector(metric.InstrumentKind) metricdata.Temporality { + return metricdata.DeltaTemporality +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl new file mode 100644 index 00000000000..6ec4125228e --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl @@ -0,0 +1,58 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import "time" + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// RetrySettings defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type RetrySettings struct { + // Enabled indicates whether to not retry sending batches in case of export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between + // consecutive retries will always be `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch. + // Once this value is reached, the data is discarded. + MaxElapsedTime time.Duration +} diff --git a/internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl new file mode 100644 index 00000000000..6adcb4f3b53 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl @@ -0,0 +1,49 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "os" +) + +// ReadTLSConfigFromFile reads a PEM certificate file and creates +// a tls.Config that will use this certifate to verify a server certificate. +func ReadTLSConfigFromFile(path string) (*tls.Config, error) { + b, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + return CreateTLSConfig(b) +} + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl new file mode 100644 index 00000000000..4934c529e89 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl @@ -0,0 +1,313 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel" + semconv "go.opentelemetry.io/otel/semconv/v1.17.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" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + kvBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + kvSrvName = &cpb.KeyValue{Key: "service.name", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }} + kvSrvVer = &cpb.KeyValue{Key: "service.version", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }} + + min, max, sum = 2.0, 4.0, 90.0 + hdp = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sum, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + }, + } + + hist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: hdp, + } + + dPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + dPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + sumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: dPtsInt64, + } + sumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: dPtsFloat64, + } + + gaugeInt64 = &mpb.Gauge{DataPoints: dPtsInt64} + gaugeFloat64 = &mpb.Gauge{DataPoints: dPtsFloat64} + + metrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumFloat64}, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: hist}, + }, + } + + scope = &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + } + scopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: scope, + Metrics: metrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + res = &rpb.Resource{ + Attributes: []*cpb.KeyValue{kvSrvName, kvSrvVer}, + } + resourceMetrics = &mpb.ResourceMetrics{ + Resource: res, + ScopeMetrics: scopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +type Client interface { + UploadMetrics(context.Context, *mpb.ResourceMetrics) error + ForceFlush(context.Context) error + Shutdown(context.Context) error +} + +// ClientFactory is a function that when called returns a +// Client implementation that is connected to also returned +// Collector implementation. The Client is ready to upload metric data to the +// Collector which is ready to store that data. +// +// If resultCh is not nil, the returned Collector needs to use the responses +// from that channel to send back to the client for every export request. +type ClientFactory func(resultCh <-chan ExportResult) (Client, Collector) + +// RunClientTests runs a suite of Client integration tests. For example: +// +// t.Run("Integration", RunClientTests(factory)) +func RunClientTests(f ClientFactory) func(*testing.T) { + return func(t *testing.T) { + t.Run("ClientHonorsContextErrors", func(t *testing.T) { + t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.Shutdown + })) + + t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.ForceFlush + })) + + t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return func(ctx context.Context) error { + return c.UploadMetrics(ctx, nil) + } + })) + }) + + t.Run("ForceFlushFlushes", func(t *testing.T) { + ctx := context.Background() + client, collector := f(nil) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + + require.NoError(t, client.ForceFlush(ctx)) + rm := collector.Collect().Dump() + // Data correctness is not important, just it was received. + require.Greater(t, len(rm), 0, "no data uploaded") + + require.NoError(t, client.Shutdown(ctx)) + rm = collector.Collect().Dump() + assert.Len(t, rm, 0, "client did not flush all data") + }) + + t.Run("UploadMetrics", func(t *testing.T) { + ctx := context.Background() + client, coll := f(nil) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + got := coll.Collect().Dump() + require.Len(t, got, 1, "upload of one ResourceMetrics") + diff := cmp.Diff(got[0], resourceMetrics, cmp.Comparer(proto.Equal)) + if diff != "" { + t.Fatalf("unexpected ResourceMetrics:\n%s", diff) + } + }) + + t.Run("PartialSuccess", func(t *testing.T) { + const n, msg = 2, "bad data" + rCh := make(chan ExportResult, 3) + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + RejectedDataPoints: n, + ErrorMessage: msg, + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + // Should not be logged. + RejectedDataPoints: 0, + ErrorMessage: "", + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{}, + } + + ctx := context.Background() + client, _ := f(rCh) + + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + + require.Equal(t, 1, len(errs)) + want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) + assert.ErrorContains(t, errs[0], want) + }) + } +} + +func testCtxErrs(factory func() func(context.Context) error) func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + t.Run("DeadlineExceeded", func(t *testing.T) { + innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) + t.Cleanup(innerCancel) + <-innerCtx.Done() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) + }) + + t.Run("Canceled", func(t *testing.T) { + innerCtx, innerCancel := context.WithCancel(ctx) + innerCancel() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.Canceled) + }) + } +} diff --git a/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl new file mode 100644 index 00000000000..f02512e966c --- /dev/null +++ b/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl @@ -0,0 +1,78 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel" + "{{ .internalImportPath }}" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +type client struct { + rCh <-chan ExportResult + storage *Storage +} + +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { + return metric.DefaultTemporalitySelector(k) +} + +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { + return metric.DefaultAggregationSelector(k) +} + +func (c *client) Collect() *Storage { + return c.storage +} + +func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) error { + c.storage.Add(&cpb.ExportMetricsServiceRequest{ + ResourceMetrics: []*mpb.ResourceMetrics{rm}, + }) + if c.rCh != nil { + r := <-c.rCh + if r.Response != nil && r.Response.GetPartialSuccess() != nil { + msg := r.Response.GetPartialSuccess().GetErrorMessage() + n := r.Response.GetPartialSuccess().GetRejectedDataPoints() + if msg != "" || n > 0 { + otel.Handle(internal.MetricPartialSuccessError(n, msg)) + } + } + return r.Err + } + return ctx.Err() +} + +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } +func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } + +func TestClientTests(t *testing.T) { + factory := func(rCh <-chan ExportResult) (Client, Collector) { + c := &client{rCh: rCh, storage: NewStorage()} + return c, c + } + + t.Run("Integration", RunClientTests(factory)) +} diff --git a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl new file mode 100644 index 00000000000..31fc32224b9 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl @@ -0,0 +1,438 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" // nolint:depguard // This is for testing. + "encoding/pem" + "errors" + "fmt" + "io" + "math/big" + "net" + "net/http" + "net/url" + "sync" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" + + "{{ .oconfImportPath }}" + collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +// Collector is the collection target a Client sends metric uploads to. +type Collector interface { + Collect() *Storage +} + +type ExportResult struct { + Response *collpb.ExportMetricsServiceResponse + Err error +} + +// Storage stores uploaded OTLP metric data in their proto form. +type Storage struct { + dataMu sync.Mutex + data []*mpb.ResourceMetrics +} + +// NewStorage returns a configure storage ready to store received requests. +func NewStorage() *Storage { + return &Storage{} +} + +// Add adds the request to the Storage. +func (s *Storage) Add(request *collpb.ExportMetricsServiceRequest) { + s.dataMu.Lock() + defer s.dataMu.Unlock() + s.data = append(s.data, request.ResourceMetrics...) +} + +// Dump returns all added ResourceMetrics and clears the storage. +func (s *Storage) Dump() []*mpb.ResourceMetrics { + s.dataMu.Lock() + defer s.dataMu.Unlock() + + var data []*mpb.ResourceMetrics + data, s.data = s.data, []*mpb.ResourceMetrics{} + return data +} + +// GRPCCollector is an OTLP gRPC server that collects all requests it receives. +type GRPCCollector struct { + collpb.UnimplementedMetricsServiceServer + + headersMu sync.Mutex + headers metadata.MD + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *grpc.Server +} + +// NewGRPCCollector returns a *GRPCCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port. +// +// If errCh is not nil, the collector will respond to Export calls with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewGRPCCollector(endpoint string, resultCh <-chan ExportResult) (*GRPCCollector, error) { + if endpoint == "" { + endpoint = "localhost:0" + } + + c := &GRPCCollector{ + storage: NewStorage(), + resultCh: resultCh, + } + + var err error + c.listener, err = net.Listen("tcp", endpoint) + if err != nil { + return nil, err + } + + c.srv = grpc.NewServer() + collpb.RegisterMetricsServiceServer(c.srv, c) + go func() { _ = c.srv.Serve(c.listener) }() + + return c, nil +} + +// Shutdown shuts down the gRPC server closing all open connections and +// listeners immediately. +func (c *GRPCCollector) Shutdown() { c.srv.Stop() } + +// Addr returns the net.Addr c is listening at. +func (c *GRPCCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *GRPCCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *GRPCCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return metadata.Join(c.headers) +} + +// Export handles the export req. +func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsServiceRequest) (*collpb.ExportMetricsServiceResponse, error) { + c.storage.Add(req) + + if h, ok := metadata.FromIncomingContext(ctx); ok { + c.headersMu.Lock() + c.headers = metadata.Join(c.headers, h) + c.headersMu.Unlock() + } + + if c.resultCh != nil { + r := <-c.resultCh + if r.Response == nil { + return &collpb.ExportMetricsServiceResponse{}, r.Err + } + return r.Response, r.Err + } + return &collpb.ExportMetricsServiceResponse{}, nil +} + +var emptyExportMetricsServiceResponse = func() []byte { + body := collpb.ExportMetricsServiceResponse{} + r, err := proto.Marshal(&body) + if err != nil { + panic(err) + } + return r +}() + +type HTTPResponseError struct { + Err error + Status int + Header http.Header +} + +func (e *HTTPResponseError) Error() string { + return fmt.Sprintf("%d: %s", e.Status, e.Err) +} + +func (e *HTTPResponseError) Unwrap() error { return e.Err } + +// HTTPCollector is an OTLP HTTP server that collects all requests it receives. +type HTTPCollector struct { + headersMu sync.Mutex + headers http.Header + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *http.Server +} + +// NewHTTPCollector returns a *HTTPCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port, not use TLS, and listen at the +// default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains +// a prefix of "https" the server will generate weak self-signed TLS +// certificates and use them to server data. If the endpoint contains a path, +// that path will be used instead of the default OTLP metric endpoint path. +// +// If errCh is not nil, the collector will respond to HTTP requests with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { + u, err := url.Parse(endpoint) + if err != nil { + return nil, err + } + if u.Host == "" { + u.Host = "localhost:0" + } + if u.Path == "" { + u.Path = oconf.DefaultMetricsPath + } + + c := &HTTPCollector{ + headers: http.Header{}, + storage: NewStorage(), + resultCh: resultCh, + } + + c.listener, err = net.Listen("tcp", u.Host) + if err != nil { + return nil, err + } + + mux := http.NewServeMux() + mux.Handle(u.Path, http.HandlerFunc(c.handler)) + c.srv = &http.Server{Handler: mux} + if u.Scheme == "https" { + cert, err := weakCertificate() + if err != nil { + return nil, err + } + c.srv.TLSConfig = &tls.Config{ + Certificates: []tls.Certificate{cert}, + } + go func() { _ = c.srv.ServeTLS(c.listener, "", "") }() + } else { + go func() { _ = c.srv.Serve(c.listener) }() + } + return c, nil +} + +// Shutdown shuts down the HTTP server closing all open connections and +// listeners. +func (c *HTTPCollector) Shutdown(ctx context.Context) error { + return c.srv.Shutdown(ctx) +} + +// Addr returns the net.Addr c is listening at. +func (c *HTTPCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *HTTPCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *HTTPCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return c.headers.Clone() +} + +func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { + c.respond(w, c.record(r)) +} + +func (c *HTTPCollector) record(r *http.Request) ExportResult { + // Currently only supports protobuf. + if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { + err := fmt.Errorf("content-type not supported: %s", v) + return ExportResult{Err: err} + } + + body, err := c.readBody(r) + if err != nil { + return ExportResult{Err: err} + } + pbRequest := &collpb.ExportMetricsServiceRequest{} + err = proto.Unmarshal(body, pbRequest) + if err != nil { + return ExportResult{ + Err: &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + }, + } + } + c.storage.Add(pbRequest) + + c.headersMu.Lock() + for k, vals := range r.Header { + for _, v := range vals { + c.headers.Add(k, v) + } + } + c.headersMu.Unlock() + + if c.resultCh != nil { + return <-c.resultCh + } + return ExportResult{Err: err} +} + +func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { + var reader io.ReadCloser + switch r.Header.Get("Content-Encoding") { + case "gzip": + reader, err = gzip.NewReader(r.Body) + if err != nil { + _ = reader.Close() + return nil, &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + default: + reader = r.Body + } + + defer func() { + cErr := reader.Close() + if err == nil && cErr != nil { + err = &HTTPResponseError{ + Err: cErr, + Status: http.StatusInternalServerError, + } + } + }() + body, err = io.ReadAll(reader) + if err != nil { + err = &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + return body, err +} + +func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { + if resp.Err != nil { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.Header().Set("X-Content-Type-Options", "nosniff") + var e *HTTPResponseError + if errors.As(resp.Err, &e) { + for k, vals := range e.Header { + for _, v := range vals { + w.Header().Add(k, v) + } + } + w.WriteHeader(e.Status) + fmt.Fprintln(w, e.Error()) + } else { + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintln(w, resp.Err.Error()) + } + return + } + + w.Header().Set("Content-Type", "application/x-protobuf") + w.WriteHeader(http.StatusOK) + if resp.Response == nil { + _, _ = w.Write(emptyExportMetricsServiceResponse) + } else { + r, err := proto.Marshal(resp.Response) + if err != nil { + panic(err) + } + _, _ = w.Write(r) + } +} + +// Based on https://golang.org/src/crypto/tls/generate_cert.go, +// simplified and weakened. +func weakCertificate() (tls.Certificate, error) { + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return tls.Certificate{}, err + } + notBefore := time.Now() + notAfter := notBefore.Add(time.Hour) + max := new(big.Int).Lsh(big.NewInt(1), 128) + sn, err := rand.Int(rand.Reader, max) + if err != nil { + return tls.Certificate{}, err + } + tmpl := x509.Certificate{ + SerialNumber: sn, + Subject: pkix.Name{Organization: []string{"otel-go"}}, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + DNSNames: []string{"localhost"}, + IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, + } + derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) + if err != nil { + return tls.Certificate{}, err + } + var certBuf bytes.Buffer + err = pem.Encode(&certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) + if err != nil { + return tls.Certificate{}, err + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + var privBuf bytes.Buffer + err = pem.Encode(&privBuf, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) + if err != nil { + return tls.Certificate{}, err + } + return tls.X509KeyPair(certBuf.Bytes(), privBuf.Bytes()) +} diff --git a/internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl b/internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl new file mode 100644 index 00000000000..60a23a6ed78 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl @@ -0,0 +1,155 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// AttrIter transforms an attribute iterator into OTLP key-values. +func AttrIter(iter attribute.Iterator) []*cpb.KeyValue { + l := iter.Len() + if l == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, l) + for iter.Next() { + out = append(out, KeyValue(iter.Attribute())) + } + return out +} + +// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. +func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue { + if len(attrs) == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, len(attrs)) + for _, kv := range attrs { + out = append(out, KeyValue(kv)) + } + return out +} + +// KeyValue transforms an attribute KeyValue into an OTLP key-value. +func KeyValue(kv attribute.KeyValue) *cpb.KeyValue { + return &cpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} +} + +// Value transforms an attribute Value into an OTLP AnyValue. +func Value(v attribute.Value) *cpb.AnyValue { + av := new(cpb.AnyValue) + switch v.Type() { + case attribute.BOOL: + av.Value = &cpb.AnyValue_BoolValue{ + BoolValue: v.AsBool(), + } + case attribute.BOOLSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: boolSliceValues(v.AsBoolSlice()), + }, + } + case attribute.INT64: + av.Value = &cpb.AnyValue_IntValue{ + IntValue: v.AsInt64(), + } + case attribute.INT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: int64SliceValues(v.AsInt64Slice()), + }, + } + case attribute.FLOAT64: + av.Value = &cpb.AnyValue_DoubleValue{ + DoubleValue: v.AsFloat64(), + } + case attribute.FLOAT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: float64SliceValues(v.AsFloat64Slice()), + }, + } + case attribute.STRING: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: v.AsString(), + } + case attribute.STRINGSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: stringSliceValues(v.AsStringSlice()), + }, + } + default: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: "INVALID", + } + } + return av +} + +func boolSliceValues(vals []bool) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_BoolValue{ + BoolValue: v, + }, + } + } + return converted +} + +func int64SliceValues(vals []int64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_IntValue{ + IntValue: v, + }, + } + } + return converted +} + +func float64SliceValues(vals []float64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_DoubleValue{ + DoubleValue: v, + }, + } + } + return converted +} + +func stringSliceValues(vals []string) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{ + StringValue: v, + }, + } + } + return converted +} diff --git a/internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl new file mode 100644 index 00000000000..57db7ab797b --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl @@ -0,0 +1,197 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +var ( + attrBool = attribute.Bool("bool", true) + attrBoolSlice = attribute.BoolSlice("bool slice", []bool{true, false}) + attrInt = attribute.Int("int", 1) + attrIntSlice = attribute.IntSlice("int slice", []int{-1, 1}) + attrInt64 = attribute.Int64("int64", 1) + attrInt64Slice = attribute.Int64Slice("int64 slice", []int64{-1, 1}) + attrFloat64 = attribute.Float64("float64", 1) + attrFloat64Slice = attribute.Float64Slice("float64 slice", []float64{-1, 1}) + attrString = attribute.String("string", "o") + attrStringSlice = attribute.StringSlice("string slice", []string{"o", "n"}) + attrInvalid = attribute.KeyValue{ + Key: attribute.Key("invalid"), + Value: attribute.Value{}, + } + + valBoolTrue = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: true}} + valBoolFalse = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: false}} + valBoolSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valBoolTrue, valBoolFalse}, + }, + }} + valIntOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: 1}} + valIntNOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: -1}} + valIntSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valIntNOne, valIntOne}, + }, + }} + valDblOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: 1}} + valDblNOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: -1}} + valDblSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valDblNOne, valDblOne}, + }, + }} + valStrO = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "o"}} + valStrN = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "n"}} + valStrSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valStrO, valStrN}, + }, + }} + + kvBool = &cpb.KeyValue{Key: "bool", Value: valBoolTrue} + kvBoolSlice = &cpb.KeyValue{Key: "bool slice", Value: valBoolSlice} + kvInt = &cpb.KeyValue{Key: "int", Value: valIntOne} + kvIntSlice = &cpb.KeyValue{Key: "int slice", Value: valIntSlice} + kvInt64 = &cpb.KeyValue{Key: "int64", Value: valIntOne} + kvInt64Slice = &cpb.KeyValue{Key: "int64 slice", Value: valIntSlice} + kvFloat64 = &cpb.KeyValue{Key: "float64", Value: valDblOne} + kvFloat64Slice = &cpb.KeyValue{Key: "float64 slice", Value: valDblSlice} + kvString = &cpb.KeyValue{Key: "string", Value: valStrO} + kvStringSlice = &cpb.KeyValue{Key: "string slice", Value: valStrSlice} + kvInvalid = &cpb.KeyValue{ + Key: "invalid", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "INVALID"}, + }, + } +) + +type attributeTest struct { + name string + in []attribute.KeyValue + want []*cpb.KeyValue +} + +func TestAttributeTransforms(t *testing.T) { + for _, test := range []attributeTest{ + {"nil", nil, nil}, + {"empty", []attribute.KeyValue{}, nil}, + { + "invalid", + []attribute.KeyValue{attrInvalid}, + []*cpb.KeyValue{kvInvalid}, + }, + { + "bool", + []attribute.KeyValue{attrBool}, + []*cpb.KeyValue{kvBool}, + }, + { + "bool slice", + []attribute.KeyValue{attrBoolSlice}, + []*cpb.KeyValue{kvBoolSlice}, + }, + { + "int", + []attribute.KeyValue{attrInt}, + []*cpb.KeyValue{kvInt}, + }, + { + "int slice", + []attribute.KeyValue{attrIntSlice}, + []*cpb.KeyValue{kvIntSlice}, + }, + { + "int64", + []attribute.KeyValue{attrInt64}, + []*cpb.KeyValue{kvInt64}, + }, + { + "int64 slice", + []attribute.KeyValue{attrInt64Slice}, + []*cpb.KeyValue{kvInt64Slice}, + }, + { + "float64", + []attribute.KeyValue{attrFloat64}, + []*cpb.KeyValue{kvFloat64}, + }, + { + "float64 slice", + []attribute.KeyValue{attrFloat64Slice}, + []*cpb.KeyValue{kvFloat64Slice}, + }, + { + "string", + []attribute.KeyValue{attrString}, + []*cpb.KeyValue{kvString}, + }, + { + "string slice", + []attribute.KeyValue{attrStringSlice}, + []*cpb.KeyValue{kvStringSlice}, + }, + { + "all", + []attribute.KeyValue{ + attrBool, + attrBoolSlice, + attrInt, + attrIntSlice, + attrInt64, + attrInt64Slice, + attrFloat64, + attrFloat64Slice, + attrString, + attrStringSlice, + attrInvalid, + }, + []*cpb.KeyValue{ + kvBool, + kvBoolSlice, + kvInt, + kvIntSlice, + kvInt64, + kvInt64Slice, + kvFloat64, + kvFloat64Slice, + kvString, + kvStringSlice, + kvInvalid, + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + t.Run("KeyValues", func(t *testing.T) { + assert.ElementsMatch(t, test.want, KeyValues(test.in)) + }) + t.Run("AttrIter", func(t *testing.T) { + s := attribute.NewSet(test.in...) + assert.ElementsMatch(t, test.want, AttrIter(s.Iter())) + }) + }) + } +} diff --git a/internal/shared/otlp/otlpmetric/transform/error.go.tmpl b/internal/shared/otlp/otlpmetric/transform/error.go.tmpl new file mode 100644 index 00000000000..5f9476af6f8 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/error.go.tmpl @@ -0,0 +1,114 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "errors" + "fmt" + "strings" + + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +var ( + errUnknownAggregation = errors.New("unknown aggregation") + errUnknownTemporality = errors.New("unknown temporality") +) + +type errMetric struct { + m *mpb.Metric + err error +} + +func (e errMetric) Unwrap() error { + return e.err +} + +func (e errMetric) Error() string { + format := "invalid metric (name: %q, description: %q, unit: %q): %s" + return fmt.Sprintf(format, e.m.Name, e.m.Description, e.m.Unit, e.err) +} + +func (e errMetric) Is(target error) bool { + return errors.Is(e.err, target) +} + +// multiErr is used by the data-type transform functions to wrap multiple +// errors into a single return value. The error message will show all errors +// as a list and scope them by the datatype name that is returning them. +type multiErr struct { + datatype string + errs []error +} + +// errOrNil returns nil if e contains no errors, otherwise it returns e. +func (e *multiErr) errOrNil() error { + if len(e.errs) == 0 { + return nil + } + return e +} + +// append adds err to e. If err is a multiErr, its errs are flattened into e. +func (e *multiErr) append(err error) { + // Do not use errors.As here, this should only be flattened one layer. If + // there is a *multiErr several steps down the chain, all the errors above + // it will be discarded if errors.As is used instead. + switch other := err.(type) { + case *multiErr: + // Flatten err errors into e. + e.errs = append(e.errs, other.errs...) + default: + e.errs = append(e.errs, err) + } +} + +func (e *multiErr) Error() string { + es := make([]string, len(e.errs)) + for i, err := range e.errs { + es[i] = fmt.Sprintf("* %s", err) + } + + format := "%d errors occurred transforming %s:\n\t%s" + return fmt.Sprintf(format, len(es), e.datatype, strings.Join(es, "\n\t")) +} + +func (e *multiErr) Unwrap() error { + switch len(e.errs) { + case 0: + return nil + case 1: + return e.errs[0] + } + + // Return a multiErr without the leading error. + cp := &multiErr{ + datatype: e.datatype, + errs: make([]error, len(e.errs)-1), + } + copy(cp.errs, e.errs[1:]) + return cp +} + +func (e *multiErr) Is(target error) bool { + if len(e.errs) == 0 { + return false + } + // Check if the first error is target. + return errors.Is(e.errs[0], target) +} diff --git a/internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl new file mode 100644 index 00000000000..03e16ef8f14 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl @@ -0,0 +1,91 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + e0 = errMetric{m: pbMetrics[0], err: errUnknownAggregation} + e1 = errMetric{m: pbMetrics[1], err: errUnknownTemporality} +) + +type testingErr struct{} + +func (testingErr) Error() string { return "testing error" } + +// errFunc is a non-comparable error type. +type errFunc func() string + +func (e errFunc) Error() string { + return e() +} + +func TestMultiErr(t *testing.T) { + const name = "TestMultiErr" + me := &multiErr{datatype: name} + + t.Run("ErrOrNil", func(t *testing.T) { + require.Nil(t, me.errOrNil()) + me.errs = []error{e0} + assert.Error(t, me.errOrNil()) + }) + + var testErr testingErr + t.Run("AppendError", func(t *testing.T) { + me.append(testErr) + assert.Equal(t, testErr, me.errs[len(me.errs)-1]) + }) + + t.Run("AppendFlattens", func(t *testing.T) { + other := &multiErr{datatype: "OtherTestMultiErr", errs: []error{e1}} + me.append(other) + assert.Equal(t, e1, me.errs[len(me.errs)-1]) + }) + + t.Run("ErrorMessage", func(t *testing.T) { + // Test the overall structure of the message, but not the exact + // language so this doesn't become a change-indicator. + msg := me.Error() + lines := strings.Split(msg, "\n") + assert.Equalf(t, 4, len(lines), "expected a 4 line error message, got:\n\n%s", msg) + assert.Contains(t, msg, name) + assert.Contains(t, msg, e0.Error()) + assert.Contains(t, msg, testErr.Error()) + assert.Contains(t, msg, e1.Error()) + }) + + t.Run("ErrorIs", func(t *testing.T) { + assert.ErrorIs(t, me, errUnknownAggregation) + assert.ErrorIs(t, me, e0) + assert.ErrorIs(t, me, testErr) + assert.ErrorIs(t, me, errUnknownTemporality) + assert.ErrorIs(t, me, e1) + + errUnknown := errFunc(func() string { return "unknown error" }) + assert.NotErrorIs(t, me, errUnknown) + + var empty multiErr + assert.NotErrorIs(t, &empty, errUnknownTemporality) + }) +} diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl new file mode 100644 index 00000000000..2a4aeedcdfc --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl @@ -0,0 +1,292 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package transform provides transformation functionality from the +// sdk/metric/metricdata data-types into OTLP data-types. +package transform + +import ( + "fmt" + "time" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/common/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +// ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm +// contains invalid ScopeMetrics, an error will be returned along with an OTLP +// ResourceMetrics that contains partial OTLP ScopeMetrics. +func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { + sms, err := ScopeMetrics(rm.ScopeMetrics) + return &mpb.ResourceMetrics{ + Resource: &rpb.Resource{ + Attributes: AttrIter(rm.Resource.Iter()), + }, + ScopeMetrics: sms, + SchemaUrl: rm.Resource.SchemaURL(), + }, err +} + +// ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If +// sms contains invalid metric values, an error will be returned along with a +// slice that contains partial OTLP ScopeMetrics. +func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error) { + errs := &multiErr{datatype: "ScopeMetrics"} + out := make([]*mpb.ScopeMetrics, 0, len(sms)) + for _, sm := range sms { + ms, err := Metrics(sm.Metrics) + if err != nil { + errs.append(err) + } + + out = append(out, &mpb.ScopeMetrics{ + Scope: &cpb.InstrumentationScope{ + Name: sm.Scope.Name, + Version: sm.Scope.Version, + }, + Metrics: ms, + SchemaUrl: sm.Scope.SchemaURL, + }) + } + return out, errs.errOrNil() +} + +// Metrics returns a slice of OTLP Metric generated from ms. If ms contains +// invalid metric values, an error will be returned along with a slice that +// contains partial OTLP Metrics. +func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error) { + errs := &multiErr{datatype: "Metrics"} + out := make([]*mpb.Metric, 0, len(ms)) + for _, m := range ms { + o, err := metric(m) + if err != nil { + // Do not include invalid data. Drop the metric, report the error. + errs.append(errMetric{m: o, err: err}) + continue + } + out = append(out, o) + } + return out, errs.errOrNil() +} + +func metric(m metricdata.Metrics) (*mpb.Metric, error) { + var err error + out := &mpb.Metric{ + Name: m.Name, + Description: m.Description, + Unit: string(m.Unit), + } + switch a := m.Data.(type) { + case metricdata.Gauge[int64]: + out.Data = Gauge[int64](a) + case metricdata.Gauge[float64]: + out.Data = Gauge[float64](a) + case metricdata.Sum[int64]: + out.Data, err = Sum[int64](a) + case metricdata.Sum[float64]: + out.Data, err = Sum[float64](a) + case metricdata.Histogram[int64]: + out.Data, err = Histogram(a) + case metricdata.Histogram[float64]: + out.Data, err = Histogram(a) + case metricdata.ExponentialHistogram[int64]: + out.Data, err = ExponentialHistogram(a) + case metricdata.ExponentialHistogram[float64]: + out.Data, err = ExponentialHistogram(a) + default: + return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) + } + return out, err +} + +// Gauge returns an OTLP Metric_Gauge generated from g. +func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { + return &mpb.Metric_Gauge{ + Gauge: &mpb.Gauge{ + DataPoints: DataPoints(g.DataPoints), + }, + } +} + +// Sum returns an OTLP Metric_Sum generated from s. An error is returned +// if the temporality of s is unknown. +func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { + t, err := Temporality(s.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Sum{ + Sum: &mpb.Sum{ + AggregationTemporality: t, + IsMonotonic: s.IsMonotonic, + DataPoints: DataPoints(s.DataPoints), + }, + }, nil +} + +// DataPoints returns a slice of OTLP NumberDataPoint generated from dPts. +func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint { + out := make([]*mpb.NumberDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + ndp := &mpb.NumberDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + } + switch v := any(dPt.Value).(type) { + case int64: + ndp.Value = &mpb.NumberDataPoint_AsInt{ + AsInt: v, + } + case float64: + ndp.Value = &mpb.NumberDataPoint_AsDouble{ + AsDouble: v, + } + } + out = append(out, ndp) + } + return out +} + +// Histogram returns an OTLP Metric_Histogram generated from h. An error is +// returned if the temporality of h is unknown. +func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Histogram{ + Histogram: &mpb.Histogram{ + AggregationTemporality: t, + DataPoints: HistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated +// from dPts. +func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { + out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + hdp := &mpb.HistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + BucketCounts: dPt.BucketCounts, + ExplicitBounds: dPt.Bounds, + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + hdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + hdp.Max = &vF64 + } + out = append(out, hdp) + } + return out +} + +// ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is +// returned if the temporality of h is unknown. +func ExponentialHistogram[N int64 | float64](h metricdata.ExponentialHistogram[N]) (*mpb.Metric_ExponentialHistogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_ExponentialHistogram{ + ExponentialHistogram: &mpb.ExponentialHistogram{ + AggregationTemporality: t, + DataPoints: ExponentialHistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated +// from dPts. +func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint { + out := make([]*mpb.ExponentialHistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + ehdp := &mpb.ExponentialHistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + Scale: dPt.Scale, + ZeroCount: dPt.ZeroCount, + + Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), + Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + ehdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + ehdp.Max = &vF64 + } + out = append(out, ehdp) + } + return out +} + +// ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated +// from bucket. +func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets { + return &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: bucket.Offset, + BucketCounts: bucket.Counts, + } +} + +// Temporality returns an OTLP AggregationTemporality generated from t. If t +// is unknown, an error is returned along with the invalid +// AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. +func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { + switch t { + case metricdata.DeltaTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, nil + case metricdata.CumulativeTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, nil + default: + err := fmt.Errorf("%w: %s", errUnknownTemporality, t) + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err + } +} + +// timeUnixNano returns t as a Unix time, the number of nanoseconds elapsed +// since January 1, 1970 UTC as uint64. +// The result is undefined if the Unix time +// in nanoseconds cannot be represented by an int64 +// (a date before the year 1678 or after 2262). +// timeUnixNano on the zero Time returns 0. +// The result does not depend on the location associated with t. +func timeUnixNano(t time.Time) uint64 { + if t.IsZero() { + return 0 + } + return uint64(t.UnixNano()) +} diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl new file mode 100644 index 00000000000..95dca158be7 --- /dev/null +++ b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl @@ -0,0 +1,633 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "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.17.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" +) + +type unknownAggT struct { + metricdata.Aggregation +} + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + alice = attribute.NewSet(attribute.String("user", "alice")) + bob = attribute.NewSet(attribute.String("user", "bob")) + + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + pbBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + + minA, maxA, sumA = 2.0, 4.0, 90.0 + minB, maxB, sumB = 4.0, 150.0, 234.0 + otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + otelEBucketA = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketB = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketsC = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 1}, + } + otelEBucketsD = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 1}, + } + + otelEHDPInt64 = []metricdata.ExponentialHistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + pbHDP = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + }, + } + + pbEHDPBA = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBB = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBC = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 1}, + } + pbEHDPBD = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 1}, + } + + pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + }, + } + + otelHistInt64 = metricdata.Histogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPInt64, + } + otelHistFloat64 = metricdata.Histogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPFloat64, + } + invalidTemporality metricdata.Temporality + otelHistInvalid = metricdata.Histogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelHDPInt64, + } + + otelExpoHistInt64 = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPInt64, + } + otelExpoHistFloat64 = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPFloat64, + } + otelExpoHistInvalid = metricdata.ExponentialHistogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelEHDPInt64, + } + + pbHist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDP, + } + + pbExpoHist = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDP, + } + + otelDPtsInt64 = []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1}, + {Attributes: bob, StartTime: start, Time: end, Value: 2}, + } + otelDPtsFloat64 = []metricdata.DataPoint[float64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, + {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + } + + pbDPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + pbDPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + otelSumInt64 = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: otelDPtsInt64, + } + otelSumFloat64 = metricdata.Sum[float64]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + otelSumInvalid = metricdata.Sum[float64]{ + Temporality: invalidTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + + pbSumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: pbDPtsInt64, + } + pbSumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: pbDPtsFloat64, + } + + otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} + otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + otelGaugeZeroStartTime = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + }, + } + + pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} + pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + pbGaugeZeroStartTime = &mpb.Gauge{DataPoints: []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: 0, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + }} + + unknownAgg unknownAggT + otelMetrics = []metricdata.Metrics{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: otelGaugeInt64, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: otelGaugeFloat64, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: otelSumInt64, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: otelSumFloat64, + }, + { + Name: "invalid-sum", + Description: "Sum with invalid temporality", + Unit: "1", + Data: otelSumInvalid, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistInt64, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistFloat64, + }, + { + Name: "invalid-histogram", + Description: "Invalid histogram", + Unit: "1", + Data: otelHistInvalid, + }, + { + Name: "unknown", + Description: "Unknown aggregation", + Unit: "1", + Data: unknownAgg, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistInt64, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistFloat64, + }, + { + Name: "invalid-ExponentialHistogram", + Description: "Invalid Exponential Histogram", + Unit: "1", + Data: otelExpoHistInvalid, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: otelGaugeZeroStartTime, + }, + } + + pbMetrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeZeroStartTime}, + }, + } + + otelScopeMetrics = []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "test/code/path", + Version: "v0.1.0", + SchemaURL: semconv.SchemaURL, + }, + Metrics: otelMetrics, + }, + } + + pbScopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + }, + Metrics: pbMetrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + otelRes = resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceName("test server"), + semconv.ServiceVersion("v0.1.0"), + ) + + pbRes = &rpb.Resource{ + Attributes: []*cpb.KeyValue{ + { + Key: "service.name", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }, + }, + { + Key: "service.version", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }, + }, + }, + } + + otelResourceMetrics = &metricdata.ResourceMetrics{ + Resource: otelRes, + ScopeMetrics: otelScopeMetrics, + } + + pbResourceMetrics = &mpb.ResourceMetrics{ + Resource: pbRes, + ScopeMetrics: pbScopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +func TestTransformations(t *testing.T) { + // Run tests from the "bottom-up" of the metricdata data-types and halt + // when a failure occurs to ensure the clearest failure message (as + // opposed to the opposite of testing from the top-down which will obscure + // errors deep inside the structs). + + // DataPoint types. + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) + require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) + + // Aggregations. + h, err := Histogram(otelHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, h) + + s, err := Sum[int64](otelSumInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumInt64}, s) + s, err = Sum[float64](otelSumFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumFloat64}, s) + s, err = Sum[float64](otelSumInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, s) + + assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) + require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) + + e, err := ExponentialHistogram(otelExpoHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, e) + + // Metrics. + m, err := Metrics(otelMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbMetrics, m) + + // Scope Metrics. + sm, err := ScopeMetrics(otelScopeMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbScopeMetrics, sm) + + // Resource Metrics. + rm, err := ResourceMetrics(otelResourceMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbResourceMetrics, rm) +} From 248413d6544479f8576a4b68107cb9c78c40f1df Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:57:44 -0500 Subject: [PATCH 636/886] Add the Exponential Histogram Aggregator. (#4245) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds Exponential Histograms aggregator * Added aggregation to the pipeline. Adjust to new bucket * Add no allocation if cap is available. * Expand tests * Fix lint * Fix 64 bit math on 386 platform. * Fix tests to work in go 1.19. Fix spelling error * fix codespell * Add example * Update sdk/metric/aggregation/aggregation.go Co-authored-by: Robert Pająk * Update sdk/metric/aggregation/aggregation.go * Update sdk/metric/aggregation/aggregation.go * Changelog * Fix move * Address feedback from the PR. * Update expo histo to new aggregator format. * Fix lint * Remove Zero Threshold from config of expo histograms * Remove DefaultExponentialHistogram() * Refactor GetBin, and address PR Feedback * Address PR feedback * Fix comment in wrong location * Fix misapplied PR feedback * Fix codespell --------- Co-authored-by: Robert Pająk Co-authored-by: Chester Cheung --- CHANGELOG.md | 2 + sdk/metric/aggregation/aggregation.go | 55 ++ sdk/metric/aggregation/aggregation_test.go | 28 + sdk/metric/internal/aggregate/aggregate.go | 12 + .../aggregate/exponential_histogram.go | 497 ++++++++++ .../aggregate/exponential_histogram_test.go | 905 ++++++++++++++++++ sdk/metric/pipeline.go | 21 +- sdk/metric/pipeline_registry_test.go | 36 + 8 files changed, 1551 insertions(+), 5 deletions(-) create mode 100644 sdk/metric/internal/aggregate/exponential_histogram.go create mode 100644 sdk/metric/internal/aggregate/exponential_histogram_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d777414afce..f2044274f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Add support for exponential histogram aggregations. + A histogram can be configured as an exponential histogram using a view with `go.opentelemetry.io/otel/sdk/metric/aggregation.ExponentialHistogram` as the aggregation. (#4245) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) - Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) - OTLP Metrics Exporter now supports the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go index f1c215069f4..850e309ea37 100644 --- a/sdk/metric/aggregation/aggregation.go +++ b/sdk/metric/aggregation/aggregation.go @@ -164,3 +164,58 @@ func (h ExplicitBucketHistogram) Copy() Aggregation { NoMinMax: h.NoMinMax, } } + +// Base2ExponentialHistogram is an aggregation that summarizes a set of +// measurements as an histogram with bucket widths that grow exponentially. +type Base2ExponentialHistogram struct { + // MaxSize is the maximum number of buckets to use for the histogram. + MaxSize int32 + // MaxScale is the maximum resolution scale to use for the histogram. + // + // MaxScale has a maximum value of 20. Using a value of 20 means the + // maximum number of buckets that can fit within the range of a + // signed 32-bit integer index could be used. + // + // MaxScale has a minimum value of -10. Using a value of -10 means only + // two buckets will be use. + MaxScale int32 + + // NoMinMax indicates whether to not record the min and max of the + // distribution. By default, these extrema are recorded. + // + // Recording these extrema for cumulative data is expected to have little + // value, they will represent the entire life of the instrument instead of + // just the current collection cycle. It is recommended to set this to true + // for that type of data to avoid computing the low-value extrema. + NoMinMax bool +} + +var _ Aggregation = Base2ExponentialHistogram{} + +// private attempts to ensure no user-defined Aggregation is allowed. The +// OTel specification does not allow user-defined Aggregation currently. +func (e Base2ExponentialHistogram) private() {} + +// Copy returns a deep copy of the Aggregation. +func (e Base2ExponentialHistogram) Copy() Aggregation { + return e +} + +const ( + expoMaxScale = 20 + expoMinScale = -10 +) + +// errExpoHist is returned by misconfigured Base2ExponentialBucketHistograms. +var errExpoHist = fmt.Errorf("%w: exponential histogram", errAgg) + +// Err returns an error for any misconfigured Aggregation. +func (e Base2ExponentialHistogram) Err() error { + if e.MaxScale > expoMaxScale { + return fmt.Errorf("%w: max size %d is greater than maximum scale %d", errExpoHist, e.MaxSize, expoMaxScale) + } + if e.MaxSize <= 0 { + return fmt.Errorf("%w: max size %d is less than or equal to zero", errExpoHist, e.MaxSize) + } + return nil +} diff --git a/sdk/metric/aggregation/aggregation_test.go b/sdk/metric/aggregation/aggregation_test.go index 0f2846d3a76..15bc37f2500 100644 --- a/sdk/metric/aggregation/aggregation_test.go +++ b/sdk/metric/aggregation/aggregation_test.go @@ -55,6 +55,34 @@ func TestAggregationErr(t *testing.T) { Boundaries: []float64{0, 1, 2, 1, 3, 4}, }.Err(), errAgg) }) + + t.Run("ExponentialHistogramOperation", func(t *testing.T) { + assert.NoError(t, Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + }.Err()) + + assert.NoError(t, Base2ExponentialHistogram{ + MaxSize: 1, + NoMinMax: true, + }.Err()) + + assert.NoError(t, Base2ExponentialHistogram{ + MaxSize: 1024, + MaxScale: -3, + }.Err()) + }) + + t.Run("InvalidExponentialHistogramOperation", func(t *testing.T) { + // MazSize must be greater than 0 + assert.ErrorIs(t, Base2ExponentialHistogram{}.Err(), errAgg) + + // MaxScale Must be <=20 + assert.ErrorIs(t, Base2ExponentialHistogram{ + MaxSize: 1, + MaxScale: 30, + }.Err(), errAgg) + }) } func TestExplicitBucketHistogramDeepCopy(t *testing.T) { diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index a6cceb2c253..6dd531d1cbb 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -112,6 +112,18 @@ func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistog } } +// ExponentialBucketHistogram returns a histogram aggregate function input and +// output. +func (b Builder[N]) ExponentialBucketHistogram(cfg aggregation.Base2ExponentialHistogram, noSum bool) (Measure[N], ComputeAggregation) { + h := newExponentialHistogram[N](cfg, noSum) + switch b.Temporality { + case metricdata.DeltaTemporality: + return b.filter(h.measure), h.delta + default: + return b.filter(h.measure), h.cumulative + } +} + // reset ensures s has capacity and sets it length. If the capacity of s too // small, a new slice is returned with the specified capacity and length. func reset[T any](s []T, length, capacity int) []T { diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go new file mode 100644 index 00000000000..8434500f0df --- /dev/null +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -0,0 +1,497 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import ( + "context" + "errors" + "math" + "sync" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +const ( + expoMaxScale = 20 + expoMinScale = -10 + + smallestNonZeroNormalFloat64 = 0x1p-1022 + + // These redefine the Math constants with a type, so the compiler won't coerce + // them into an int on 32 bit platforms. + maxInt64 int64 = math.MaxInt64 + minInt64 int64 = math.MinInt64 +) + +// expoHistogramValues summarizes a set of measurements as expoHistogramDataPoints using +// dynamically scaled buckets. +type expoHistogramValues[N int64 | float64] struct { + noSum bool + noMinMax bool + maxSize int + maxScale int + + values map[attribute.Set]*expoHistogramDataPoint[N] + valuesMu sync.Mutex +} + +func newExpoHistValues[N int64 | float64](maxSize, maxScale int, noMinMax, noSum bool) *expoHistogramValues[N] { + return &expoHistogramValues[N]{ + noSum: noSum, + noMinMax: noMinMax, + maxSize: maxSize, + maxScale: maxScale, + + values: make(map[attribute.Set]*expoHistogramDataPoint[N]), + } +} + +// Aggregate records the measurement, scoped by attr, and aggregates it +// into an aggregation. +func (e *expoHistogramValues[N]) measure(_ context.Context, value N, attr attribute.Set) { + e.valuesMu.Lock() + defer e.valuesMu.Unlock() + + v, ok := e.values[attr] + if !ok { + v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) + e.values[attr] = v + } + v.record(value) +} + +// expoHistogramDataPoint is a single data point in an exponential histogram. +type expoHistogramDataPoint[N int64 | float64] struct { + count uint64 + min N + max N + sum N + + maxSize int + noMinMax bool + noSum bool + + scale int + + posBuckets expoBuckets + negBuckets expoBuckets + zeroCount uint64 +} + +func newExpoHistogramDataPoint[N int64 | float64](maxSize, maxScale int, noMinMax, noSum bool) *expoHistogramDataPoint[N] { + f := math.MaxFloat64 + max := N(f) // if N is int64, max will overflow to -9223372036854775808 + min := N(-f) + if N(maxInt64) > N(f) { + max = N(maxInt64) + min = N(minInt64) + } + return &expoHistogramDataPoint[N]{ + min: max, + max: min, + maxSize: maxSize, + noMinMax: noMinMax, + noSum: noSum, + scale: maxScale, + } +} + +// record adds a new measurement to the histogram. It will rescale the buckets if needed. +func (p *expoHistogramDataPoint[N]) record(v N) { + p.count++ + + if !p.noMinMax { + if v < p.min { + p.min = v + } + if v > p.max { + p.max = v + } + } + if !p.noSum { + p.sum += v + } + + absV := math.Abs(float64(v)) + + if float64(absV) == 0.0 { + p.zeroCount++ + return + } + + bin := getBin(absV, p.scale) + + bucket := &p.posBuckets + if v < 0 { + bucket = &p.negBuckets + } + + // If the new bin would make the counts larger than maxScale, we need to + // downscale current measurements. + if scaleDelta := scaleChange(bin, bucket.startBin, len(bucket.counts), p.maxSize); scaleDelta > 0 { + if p.scale-scaleDelta < expoMinScale { + // With a scale of -10 there is only two buckets for the whole range of float64 values. + // This can only happen if there is a max size of 1. + otel.Handle(errors.New("exponential histogram scale underflow")) + return + } + //Downscale + p.scale -= scaleDelta + p.posBuckets.downscale(scaleDelta) + p.negBuckets.downscale(scaleDelta) + + bin = getBin(absV, p.scale) + } + + bucket.record(bin) +} + +// getBin returns the bin of the bucket that the value v should be recorded +// into at the given scale. +func getBin(v float64, scale int) int { + frac, exp := math.Frexp(v) + if scale <= 0 { + // Because of the choice of fraction is always 1 power of two higher than we want. + correction := 1 + if frac == .5 { + // If v is an exact power of two the frac will be .5 and the exp + // will be one higher than we want. + correction = 2 + } + return (exp - correction) >> (-scale) + } + return exp<= bin { + low = bin + high = startBin + length - 1 + } + + count := 0 + for high-low >= maxSize { + low = low >> 1 + high = high >> 1 + count++ + if count > expoMaxScale-expoMinScale { + return count + } + } + return count +} + +// expoBuckets is a set of buckets in an exponential histogram. +type expoBuckets struct { + startBin int + counts []uint64 +} + +// record increments the count for the given bin, and expands the buckets if needed. +// Size changes must be done before calling this function. +func (b *expoBuckets) record(bin int) { + if len(b.counts) == 0 { + b.counts = []uint64{1} + b.startBin = bin + return + } + + endBin := b.startBin + len(b.counts) - 1 + + // if the new bin is inside the current range + if bin >= b.startBin && bin <= endBin { + b.counts[bin-b.startBin]++ + return + } + // if the new bin is before the current start add spaces to the counts + if bin < b.startBin { + origLen := len(b.counts) + newLength := endBin - bin + 1 + shift := b.startBin - bin + + if newLength > cap(b.counts) { + b.counts = append(b.counts, make([]uint64, newLength-len(b.counts))...) + } + + copy(b.counts[shift:origLen+shift], b.counts[:]) + b.counts = b.counts[:newLength] + for i := 1; i < shift; i++ { + b.counts[i] = 0 + } + b.startBin = bin + b.counts[0] = 1 + return + } + // if the new is after the end add spaces to the end + if bin > endBin { + if bin-b.startBin < cap(b.counts) { + b.counts = b.counts[:bin-b.startBin+1] + for i := endBin + 1 - b.startBin; i < len(b.counts); i++ { + b.counts[i] = 0 + } + b.counts[bin-b.startBin] = 1 + return + } + + end := make([]uint64, bin-b.startBin-len(b.counts)+1) + b.counts = append(b.counts, end...) + b.counts[bin-b.startBin] = 1 + } +} + +// downscale shrinks a bucket by a factor of 2*s. It will sum counts into the +// correct lower resolution bucket. +func (b *expoBuckets) downscale(delta int) { + // Example + // delta = 2 + // Original offset: -6 + // Counts: [ 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + // bins: -6 -5, -4, -3, -2, -1, 0, 1, 2, 3, 4 + // new bins:-2, -2, -1, -1, -1, -1, 0, 0, 0, 0, 1 + // new Offset: -2 + // new Counts: [4, 14, 30, 10] + + if len(b.counts) <= 1 || delta < 1 { + b.startBin = b.startBin >> delta + return + } + + steps := 1 << delta + offset := b.startBin % steps + offset = (offset + steps) % steps // to make offset positive + for i := 1; i < len(b.counts); i++ { + idx := i + offset + if idx%steps == 0 { + b.counts[idx/steps] = b.counts[i] + continue + } + b.counts[idx/steps] += b.counts[i] + } + + lastIdx := (len(b.counts) - 1 + offset) / steps + b.counts = b.counts[:lastIdx+1] + b.startBin = b.startBin >> delta +} + +// newExponentialHistogram returns an Aggregator that summarizes a set of +// measurements as an exponential histogram. Each histogram is scoped by attributes +// and the aggregation cycle the measurements were made in. +func newExponentialHistogram[N int64 | float64](cfg aggregation.Base2ExponentialHistogram, noSum bool) *expoHistogram[N] { + return &expoHistogram[N]{ + expoHistogramValues: newExpoHistValues[N]( + int(cfg.MaxSize), + int(cfg.MaxScale), + cfg.NoMinMax, + noSum, + ), + start: now(), + } +} + +// expoHistogram summarizes a set of measurements as an histogram with exponentially +// defined buckets. +type expoHistogram[N int64 | float64] struct { + *expoHistogramValues[N] + + start time.Time +} + +func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { + t := now() + + // If *dest is not a metricdata.ExponentialHistogram, memory reuse is missed. + // In that case, use the zero-value h and hope for better alignment next cycle. + h, _ := (*dest).(metricdata.ExponentialHistogram[N]) + h.Temporality = metricdata.DeltaTemporality + + e.valuesMu.Lock() + defer e.valuesMu.Unlock() + + n := len(e.values) + hDPts := reset(h.DataPoints, n, n) + + var i int + for a, b := range e.values { + hDPts[i].Attributes = a + hDPts[i].StartTime = e.start + hDPts[i].Time = t + hDPts[i].Count = b.count + hDPts[i].Scale = int32(b.scale) + hDPts[i].ZeroCount = b.zeroCount + hDPts[i].ZeroThreshold = 0.0 + + hDPts[i].PositiveBucket.Offset = int32(b.posBuckets.startBin) + hDPts[i].PositiveBucket.Counts = reset(hDPts[i].PositiveBucket.Counts, len(b.posBuckets.counts), len(b.posBuckets.counts)) + copy(hDPts[i].PositiveBucket.Counts, b.posBuckets.counts) + + hDPts[i].NegativeBucket.Offset = int32(b.negBuckets.startBin) + hDPts[i].NegativeBucket.Counts = reset(hDPts[i].NegativeBucket.Counts, len(b.negBuckets.counts), len(b.negBuckets.counts)) + + if !e.noSum { + hDPts[i].Sum = b.sum + } + if !e.noMinMax { + hDPts[i].Min = metricdata.NewExtrema(b.min) + hDPts[i].Max = metricdata.NewExtrema(b.max) + } + + delete(e.values, a) + i++ + } + e.start = t + h.DataPoints = hDPts + *dest = h + return n +} +func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { + t := now() + + // If *dest is not a metricdata.ExponentialHistogram, memory reuse is missed. + // In that case, use the zero-value h and hope for better alignment next cycle. + h, _ := (*dest).(metricdata.ExponentialHistogram[N]) + h.Temporality = metricdata.CumulativeTemporality + + e.valuesMu.Lock() + defer e.valuesMu.Unlock() + + n := len(e.values) + hDPts := reset(h.DataPoints, n, n) + + var i int + for a, b := range e.values { + hDPts[i].Attributes = a + hDPts[i].StartTime = e.start + hDPts[i].Time = t + hDPts[i].Count = b.count + hDPts[i].Scale = int32(b.scale) + hDPts[i].ZeroCount = b.zeroCount + hDPts[i].ZeroThreshold = 0.0 + + hDPts[i].PositiveBucket.Offset = int32(b.posBuckets.startBin) + hDPts[i].PositiveBucket.Counts = reset(hDPts[i].PositiveBucket.Counts, len(b.posBuckets.counts), len(b.posBuckets.counts)) + copy(hDPts[i].PositiveBucket.Counts, b.posBuckets.counts) + + hDPts[i].NegativeBucket.Offset = int32(b.negBuckets.startBin) + hDPts[i].NegativeBucket.Counts = reset(hDPts[i].NegativeBucket.Counts, len(b.negBuckets.counts), len(b.negBuckets.counts)) + + if !e.noSum { + hDPts[i].Sum = b.sum + } + if !e.noMinMax { + hDPts[i].Min = metricdata.NewExtrema(b.min) + hDPts[i].Max = metricdata.NewExtrema(b.max) + } + + i++ + // TODO (#3006): This will use an unbounded amount of memory if there + // are unbounded number of attribute sets being aggregated. Attribute + // sets that become "stale" need to be forgotten so this will not + // overload the system. + } + + h.DataPoints = hDPts + *dest = h + return n +} + +// Aggregate records the measurement, scoped by attr, and aggregates it +// into an aggregation. +// func (e *cumulativeExponentialHistogram[N]) Aggregation() metricdata.Aggregation { +// e.valuesMu.Lock() +// defer e.valuesMu.Unlock() + +// if len(e.values) == 0 { +// return nil +// } +// t := now() +// h := metricdata.ExponentialHistogram[N]{ +// Temporality: metricdata.CumulativeTemporality, +// DataPoints: make([]metricdata.ExponentialHistogramDataPoint[N], 0, len(e.values)), +// } +// for a, b := range e.values { +// ehdp := metricdata.ExponentialHistogramDataPoint[N]{ +// Attributes: a, +// StartTime: e.start, +// Time: t, +// Count: b.count, +// Scale: int32(b.scale), +// ZeroCount: b.zeroCount, +// ZeroThreshold: 0.0, +// PositiveBucket: metricdata.ExponentialBucket{ +// Offset: int32(b.posBuckets.startBin), +// Counts: make([]uint64, len(b.posBuckets.counts)), +// }, +// NegativeBucket: metricdata.ExponentialBucket{ +// Offset: int32(b.negBuckets.startBin), +// Counts: make([]uint64, len(b.negBuckets.counts)), +// }, +// } +// copy(ehdp.PositiveBucket.Counts, b.posBuckets.counts) +// copy(ehdp.NegativeBucket.Counts, b.negBuckets.counts) + +// if !e.noMinMax { +// ehdp.Min = metricdata.NewExtrema(b.min) +// ehdp.Max = metricdata.NewExtrema(b.max) +// } +// if !e.noSum { +// ehdp.Sum = b.sum +// } +// h.DataPoints = append(h.DataPoints, ehdp) +// // TODO (#3006): This will use an unbounded amount of memory if there +// // are unbounded number of attribute sets being aggregated. Attribute +// // sets that become "stale" need to be forgotten so this will not +// // overload the system. +// } + +// return h +// } diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go new file mode 100644 index 00000000000..de949359ffd --- /dev/null +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -0,0 +1,905 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate + +import ( + "context" + "fmt" + "math" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" +) + +type noErrorHandler struct{ t *testing.T } + +func (h *noErrorHandler) Handle(e error) { + require.NoError(h.t, e) +} + +func withHandler(t *testing.T) func() { + t.Helper() + h := &noErrorHandler{t: t} + original := global.GetErrorHandler() + global.SetErrorHandler(h) + return func() { global.SetErrorHandler(original) } +} + +func TestExpoHistogramDataPointRecord(t *testing.T) { + t.Run("float64", testExpoHistogramDataPointRecord[float64]) + t.Run("float64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSum[float64]) + t.Run("float64-2", testExpoHistogramDataPointRecordFloat64) + t.Run("int64", testExpoHistogramDataPointRecord[int64]) + t.Run("int64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSum[int64]) +} + +// TODO: This can be defined in the test after we drop support for go1.19. +type expoHistogramDataPointRecordTestCase[N int64 | float64] struct { + maxSize int + values []N + expectedBuckets expoBuckets + expectedScale int +} + +func testExpoHistogramDataPointRecord[N int64 | float64](t *testing.T) { + testCases := []expoHistogramDataPointRecordTestCase[N]{ + { + maxSize: 4, + values: []N{2, 4, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 1, 1}, + }, + expectedScale: 0, + }, + { + maxSize: 4, + values: []N{4, 4, 4, 2, 16, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{1, 4, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{1, 2, 4}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{1, 4, 2}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{2, 4, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{2, 1, 4}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{4, 1, 2}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []N{4, 2, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + + counts: []uint64{1, 2}, + }, + expectedScale: -1, + }, + } + for _, tt := range testCases { + t.Run(fmt.Sprint(tt.values), func(t *testing.T) { + restore := withHandler(t) + defer restore() + + dp := newExpoHistogramDataPoint[N](tt.maxSize, 20, false, false) + for _, v := range tt.values { + dp.record(v) + dp.record(-v) + } + + assert.Equal(t, tt.expectedBuckets, dp.posBuckets, "positive buckets") + assert.Equal(t, tt.expectedBuckets, dp.negBuckets, "negative buckets") + assert.Equal(t, tt.expectedScale, dp.scale, "scale") + }) + } +} + +// TODO: This can be defined in the test after we drop support for go1.19. +type expectedMinMaxSum[N int64 | float64] struct { + min N + max N + sum N + count uint +} +type expoHistogramDataPointRecordMinMaxSumTestCase[N int64 | float64] struct { + values []N + expected expectedMinMaxSum[N] +} + +func testExpoHistogramDataPointRecordMinMaxSum[N int64 | float64](t *testing.T) { + testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[N]{ + { + values: []N{2, 4, 1}, + expected: expectedMinMaxSum[N]{1, 4, 7, 3}, + }, + { + values: []N{4, 4, 4, 2, 16, 1}, + expected: expectedMinMaxSum[N]{1, 16, 31, 6}, + }, + } + + for _, tt := range testCases { + t.Run(fmt.Sprint(tt.values), func(t *testing.T) { + restore := withHandler(t) + defer restore() + + dp := newExpoHistogramDataPoint[N](4, 20, false, false) + for _, v := range tt.values { + dp.record(v) + } + + assert.Equal(t, tt.expected.max, dp.max) + assert.Equal(t, tt.expected.min, dp.min) + assert.Equal(t, tt.expected.sum, dp.sum) + }) + } +} + +func testExpoHistogramDataPointRecordFloat64(t *testing.T) { + type TestCase struct { + maxSize int + values []float64 + expectedBuckets expoBuckets + expectedScale int + } + + testCases := []TestCase{ + { + maxSize: 4, + values: []float64{2, 2, 2, 1, 8, 0.5}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 3, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{1, 0.5, 2}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{1, 2, 0.5}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{2, 0.5, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{2, 1, 0.5}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{0.5, 1, 2}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + { + maxSize: 2, + values: []float64{0.5, 2, 1}, + expectedBuckets: expoBuckets{ + startBin: -1, + counts: []uint64{2, 1}, + }, + expectedScale: -1, + }, + } + for _, tt := range testCases { + t.Run(fmt.Sprint(tt.values), func(t *testing.T) { + restore := withHandler(t) + defer restore() + + dp := newExpoHistogramDataPoint[float64](tt.maxSize, 20, false, false) + for _, v := range tt.values { + dp.record(v) + dp.record(-v) + } + + assert.Equal(t, tt.expectedBuckets, dp.posBuckets) + assert.Equal(t, tt.expectedBuckets, dp.negBuckets) + assert.Equal(t, tt.expectedScale, dp.scale) + }) + } +} + +func TestExponentialHistogramDataPointRecordLimits(t *testing.T) { + // These bins are calculated from the following formula: + // floor( log2( value) * 2^20 ) using an arbitrary precision calculator. + + fdp := newExpoHistogramDataPoint[float64](4, 20, false, false) + fdp.record(math.MaxFloat64) + + if fdp.posBuckets.startBin != 1073741823 { + t.Errorf("Expected startBin to be 1073741823, got %d", fdp.posBuckets.startBin) + } + + fdp = newExpoHistogramDataPoint[float64](4, 20, false, false) + fdp.record(math.SmallestNonzeroFloat64) + + if fdp.posBuckets.startBin != -1126170625 { + t.Errorf("Expected startBin to be -1126170625, got %d", fdp.posBuckets.startBin) + } + + idp := newExpoHistogramDataPoint[int64](4, 20, false, false) + idp.record(math.MaxInt64) + + if idp.posBuckets.startBin != 66060287 { + t.Errorf("Expected startBin to be 66060287, got %d", idp.posBuckets.startBin) + } +} + +func TestExpoBucketDownscale(t *testing.T) { + tests := []struct { + name string + bucket *expoBuckets + scale int + want *expoBuckets + }{ + { + name: "Empty bucket", + bucket: &expoBuckets{}, + scale: 3, + want: &expoBuckets{}, + }, + { + name: "1 size bucket", + bucket: &expoBuckets{ + startBin: 50, + counts: []uint64{7}, + }, + scale: 4, + want: &expoBuckets{ + startBin: 3, + counts: []uint64{7}, + }, + }, + { + name: "zero scale", + bucket: &expoBuckets{ + startBin: 50, + counts: []uint64{7, 5}, + }, + scale: 0, + want: &expoBuckets{ + startBin: 50, + counts: []uint64{7, 5}, + }, + }, + { + name: "aligned bucket scale 1", + bucket: &expoBuckets{ + startBin: 0, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + scale: 1, + want: &expoBuckets{ + startBin: 0, + counts: []uint64{3, 7, 11}, + }, + }, + { + name: "aligned bucket scale 2", + bucket: &expoBuckets{ + startBin: 0, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + scale: 2, + want: &expoBuckets{ + startBin: 0, + counts: []uint64{10, 11}, + }, + }, + { + name: "aligned bucket scale 3", + bucket: &expoBuckets{ + startBin: 0, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + scale: 3, + want: &expoBuckets{ + startBin: 0, + counts: []uint64{21}, + }, + }, + { + name: "unaligned bucket scale 1", + bucket: &expoBuckets{ + startBin: 5, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, // This is equivalent to [0,0,0,0,0,1,2,3,4,5,6] + scale: 1, + want: &expoBuckets{ + startBin: 2, + counts: []uint64{1, 5, 9, 6}, + }, // This is equivalent to [0,0,1,5,9,6] + }, + { + name: "unaligned bucket scale 2", + bucket: &expoBuckets{ + startBin: 7, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, // This is equivalent to [0,0,0,0,0,0,0,1,2,3,4,5,6] + scale: 2, + want: &expoBuckets{ + startBin: 1, + counts: []uint64{1, 14, 6}, + }, // This is equivalent to [0,1,14,6] + }, + { + name: "unaligned bucket scale 3", + bucket: &expoBuckets{ + startBin: 3, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, // This is equivalent to [0,0,0,1,2,3,4,5,6] + scale: 3, + want: &expoBuckets{ + startBin: 0, + counts: []uint64{15, 6}, + }, // This is equivalent to [0,15,6] + }, + { + name: "unaligned bucket scale 1", + bucket: &expoBuckets{ + startBin: 1, + counts: []uint64{1, 0, 1}, + }, + scale: 1, + want: &expoBuckets{ + startBin: 0, + counts: []uint64{1, 1}, + }, + }, + { + name: "negative startBin", + bucket: &expoBuckets{ + startBin: -1, + counts: []uint64{1, 0, 3}, + }, + scale: 1, + want: &expoBuckets{ + startBin: -1, + counts: []uint64{1, 3}, + }, + }, + { + name: "negative startBin 2", + bucket: &expoBuckets{ + startBin: -4, + counts: []uint64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, + }, + scale: 1, + want: &expoBuckets{ + startBin: -2, + counts: []uint64{3, 7, 11, 15, 19}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.bucket.downscale(tt.scale) + + assert.Equal(t, tt.want, tt.bucket) + }) + } +} + +func TestExpoBucketRecord(t *testing.T) { + tests := []struct { + name string + bucket *expoBuckets + bin int + want *expoBuckets + }{ + { + name: "Empty Bucket creates first count", + bucket: &expoBuckets{}, + bin: -5, + want: &expoBuckets{ + startBin: -5, + counts: []uint64{1}, + }, + }, + { + name: "Bin is in the bucket", + bucket: &expoBuckets{ + startBin: 3, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + bin: 5, + want: &expoBuckets{ + startBin: 3, + counts: []uint64{1, 2, 4, 4, 5, 6}, + }, + }, + { + name: "Bin is before the start of the bucket", + bucket: &expoBuckets{ + startBin: 1, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + bin: -2, + want: &expoBuckets{ + startBin: -2, + counts: []uint64{1, 0, 0, 1, 2, 3, 4, 5, 6}, + }, + }, + { + name: "Bin is after the end of the bucket", + bucket: &expoBuckets{ + startBin: -2, + counts: []uint64{1, 2, 3, 4, 5, 6}, + }, + bin: 4, + want: &expoBuckets{ + startBin: -2, + counts: []uint64{1, 2, 3, 4, 5, 6, 1}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.bucket.record(tt.bin) + + assert.Equal(t, tt.want, tt.bucket) + }) + } +} + +func TestScaleChange(t *testing.T) { + type args struct { + bin int + startBin int + length int + maxSize int + } + tests := []struct { + name string + args args + want int + }{ + { + name: "if length is 0, no rescale is needed", + // [] -> [5] Length 1 + args: args{ + bin: 5, + startBin: 0, + length: 0, + maxSize: 4, + }, + want: 0, + }, + { + name: "if bin is between start, and the end, no rescale needed", + // [-1, ..., 8] Length 10 -> [-1, ..., 5, ..., 8] Length 10 + args: args{ + bin: 5, + startBin: -1, + length: 10, + maxSize: 20, + }, + want: 0, + }, + { + name: "if len([bin,... end]) > maxSize, rescale needed", + // [8,9,10] Length 3 -> [5, ..., 10] Length 6 + args: args{ + bin: 5, + startBin: 8, + length: 3, + maxSize: 5, + }, + want: 1, + }, + { + name: "if len([start, ..., bin]) > maxSize, rescale needed", + // [2,3,4] Length 3 -> [2, ..., 7] Length 6 + args: args{ + bin: 7, + startBin: 2, + length: 3, + maxSize: 5, + }, + want: 1, + }, + { + name: "if len([start, ..., bin]) > maxSize, rescale needed", + // [2,3,4] Length 3 -> [2, ..., 7] Length 12 + args: args{ + bin: 13, + startBin: 2, + length: 3, + maxSize: 5, + }, + want: 2, + }, + { + name: "It should not hang if it will never be able to rescale", + args: args{ + bin: 1, + startBin: -1, + length: 1, + maxSize: 1, + }, + want: 31, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := scaleChange(tt.args.bin, tt.args.startBin, tt.args.length, tt.args.maxSize) + if got != tt.want { + t.Errorf("scaleChange() = %v, want %v", got, tt.want) + } + }) + } +} + +func BenchmarkPrepend(b *testing.B) { + for i := 0; i < b.N; i++ { + agg := newExpoHistogramDataPoint[float64](1024, 20, false, false) + n := math.MaxFloat64 + for j := 0; j < 1024; j++ { + agg.record(n) + n = n / 2 + } + } +} + +func BenchmarkAppend(b *testing.B) { + for i := 0; i < b.N; i++ { + agg := newExpoHistogramDataPoint[float64](1024, 200, false, false) + n := smallestNonZeroNormalFloat64 + for j := 0; j < 1024; j++ { + agg.record(n) + n = n * 2 + } + } +} + +var expoHistConf = aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, +} + +func BenchmarkExponentialHistogram(b *testing.B) { + b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.CumulativeTemporality, + }.ExponentialBucketHistogram(expoHistConf, false) + })) + b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { + return Builder[int64]{ + Temporality: metricdata.DeltaTemporality, + }.ExponentialBucketHistogram(expoHistConf, false) + })) + b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.CumulativeTemporality, + }.ExponentialBucketHistogram(expoHistConf, false) + })) + b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { + return Builder[float64]{ + Temporality: metricdata.DeltaTemporality, + }.ExponentialBucketHistogram(expoHistConf, false) + })) +} + +func TestSubNormal(t *testing.T) { + want := &expoHistogramDataPoint[float64]{ + maxSize: 4, + count: 3, + min: math.SmallestNonzeroFloat64, + max: math.SmallestNonzeroFloat64, + sum: 3 * math.SmallestNonzeroFloat64, + + scale: 20, + posBuckets: expoBuckets{ + startBin: -1126170625, + counts: []uint64{3}, + }, + } + + ehdp := newExpoHistogramDataPoint[float64](4, 20, false, false) + ehdp.record(math.SmallestNonzeroFloat64) + ehdp.record(math.SmallestNonzeroFloat64) + ehdp.record(math.SmallestNonzeroFloat64) + + assert.Equal(t, want, ehdp) +} + +func TestExponentialHistogramAggregation(t *testing.T) { + t.Run("Int64", testExponentialHistogramAggregation[int64]) + t.Run("Float64", testExponentialHistogramAggregation[float64]) +} + +// TODO: This can be defined in the test after we drop support for go1.19. +type exponentialHistogramAggregationTestCase[N int64 | float64] struct { + name string + build func() (Measure[N], ComputeAggregation) + input [][]N + want metricdata.ExponentialHistogram[N] + wantCount int +} + +func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { + cfg := aggregation.Base2ExponentialHistogram{ + MaxSize: 4, + MaxScale: 20, + } + + tests := []exponentialHistogramAggregationTestCase[N]{ + { + name: "Delta Single", + build: func() (Measure[N], ComputeAggregation) { + return Builder[N]{ + Temporality: metricdata.DeltaTemporality, + }.ExponentialBucketHistogram(cfg, false) + }, + input: [][]N{ + {4, 4, 4, 2, 16, 1}, + }, + want: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + }, + }, + wantCount: 1, + }, + { + name: "Cumulative Single", + build: func() (Measure[N], ComputeAggregation) { + return Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + }.ExponentialBucketHistogram(cfg, false) + }, + input: [][]N{ + {4, 4, 4, 2, 16, 1}, + }, + want: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + }, + }, + wantCount: 1, + }, + { + name: "Delta Multiple", + build: func() (Measure[N], ComputeAggregation) { + return Builder[N]{ + Temporality: metricdata.DeltaTemporality, + }.ExponentialBucketHistogram(cfg, false) + }, + input: [][]N{ + {2, 3, 8}, + {4, 4, 4, 2, 16, 1}, + }, + want: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + }, + }, + wantCount: 1, + }, + { + name: "Cumulative Multiple ", + build: func() (Measure[N], ComputeAggregation) { + return Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + }.ExponentialBucketHistogram(cfg, false) + }, + input: [][]N{ + {2, 3, 8}, + {4, 4, 4, 2, 16, 1}, + }, + want: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Count: 9, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 44, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 6, 2}, + }, + }, + }, + }, + wantCount: 1, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + restore := withHandler(t) + defer restore() + in, out := tt.build() + ctx := context.Background() + + var got metricdata.Aggregation + var count int + for _, n := range tt.input { + for _, v := range n { + in(ctx, v, *attribute.EmptySet()) + } + count = out(&got) + } + + metricdatatest.AssertAggregationsEqual(t, tt.want, got, metricdatatest.IgnoreTimestamp()) + assert.Equal(t, tt.wantCount, count) + }) + } +} + +func FuzzGetBin(f *testing.F) { + values := []float64{ + 2.0, + 0x1p35, + 0x1.0000000000001p35, + 0x1.fffffffffffffp34, + 0x1p300, + 0x1.0000000000001p300, + 0x1.fffffffffffffp299, + } + scales := []int{0, 15, -5} + + for _, s := range scales { + for _, v := range values { + f.Add(v, s) + } + } + + f.Fuzz(func(t *testing.T, v float64, scale int) { + // GetBin only works on positive values. + if math.Signbit(v) { + v = v * -1 + } + // GetBin Doesn't work on zero. + if v == 0.0 { + t.Skip("skipping test for zero") + } + + // GetBin is only used with a range of -10 to 20. + scale = (scale%31+31)%31 - 10 + + got := getBin(v, scale) + if v <= lowerBound(got, scale) { + t.Errorf("v=%x scale =%d had bin %d, but was below lower bound %x", v, scale, got, lowerBound(got, scale)) + } + if v > lowerBound(got+1, scale) { + t.Errorf("v=%x scale =%d had bin %d, but was above upper bound %x", v, scale, got, lowerBound(got+1, scale)) + } + }) +} + +func lowerBound(index int, scale int) float64 { + // The lowerBound of the index of Math.SmallestNonzeroFloat64 at any scale + // is always rounded down to 0.0. + // For example lowerBound(getBin(Math.SmallestNonzeroFloat64, 7), 7) == 0.0 + // 2 ^ (index * 2 ^ (-scale)) + return math.Exp2(math.Ldexp(float64(index), -scale)) +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 9b9483fad89..fd28a4afc15 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -446,6 +446,17 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr noSum = true } meas, comp = b.ExplicitBucketHistogram(a, noSum) + case aggregation.Base2ExponentialHistogram: + var noSum bool + switch kind { + case InstrumentKindUpDownCounter, InstrumentKindObservableUpDownCounter, InstrumentKindObservableGauge: + // The sum should not be collected for any instrument that can make + // negative measurements: + // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/sdk.md#histogram-aggregations + noSum = true + } + meas, comp = b.ExponentialBucketHistogram(a, noSum) + default: err = errUnknownAggregation } @@ -459,16 +470,16 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // | Instrument Kind | Drop | LastValue | Sum | Histogram | Exponential Histogram | // |--------------------------|------|-----------|-----|-----------|-----------------------| // | Counter | ✓ | | ✓ | ✓ | ✓ | -// | UpDownCounter | ✓ | | ✓ | ✓ | | +// | UpDownCounter | ✓ | | ✓ | ✓ | ✓ | // | Histogram | ✓ | | ✓ | ✓ | ✓ | -// | Observable Counter | ✓ | | ✓ | ✓ | | -// | Observable UpDownCounter | ✓ | | ✓ | ✓ | | -// | Observable Gauge | ✓ | ✓ | | ✓ | |. +// | Observable Counter | ✓ | | ✓ | ✓ | ✓ | +// | Observable UpDownCounter | ✓ | | ✓ | ✓ | ✓ | +// | Observable Gauge | ✓ | ✓ | | ✓ | ✓ |. func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { switch agg.(type) { case aggregation.Default: return nil - case aggregation.ExplicitBucketHistogram: + case aggregation.ExplicitBucketHistogram, aggregation.Base2ExponentialHistogram: switch kind { case InstrumentKindCounter, InstrumentKindUpDownCounter, diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 5969392c6cb..52fedd12471 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -623,6 +623,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindCounter, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "SyncCounter and ExponentialHistogram", + kind: InstrumentKindCounter, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "SyncUpDownCounter and Drop", kind: InstrumentKindUpDownCounter, @@ -644,6 +649,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "SyncUpDownCounter and ExponentialHistogram", + kind: InstrumentKindUpDownCounter, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "SyncHistogram and Drop", kind: InstrumentKindHistogram, @@ -665,6 +675,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindHistogram, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "SyncHistogram and ExponentialHistogram", + kind: InstrumentKindHistogram, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "ObservableCounter and Drop", kind: InstrumentKindObservableCounter, @@ -686,6 +701,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindObservableCounter, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "ObservableCounter and ExponentialHistogram", + kind: InstrumentKindObservableCounter, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "ObservableUpDownCounter and Drop", kind: InstrumentKindObservableUpDownCounter, @@ -707,6 +727,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindObservableUpDownCounter, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "ObservableUpDownCounter and ExponentialHistogram", + kind: InstrumentKindObservableUpDownCounter, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "ObservableGauge and Drop", kind: InstrumentKindObservableGauge, @@ -728,6 +753,11 @@ func TestIsAggregatorCompatible(t *testing.T) { kind: InstrumentKindObservableGauge, agg: aggregation.ExplicitBucketHistogram{}, }, + { + name: "ObservableGauge and ExponentialHistogram", + kind: InstrumentKindObservableGauge, + agg: aggregation.Base2ExponentialHistogram{}, + }, { name: "unknown kind with Sum should error", kind: undefinedInstrument, @@ -746,6 +776,12 @@ func TestIsAggregatorCompatible(t *testing.T) { agg: aggregation.ExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, + { + name: "unknown kind with Histogram should error", + kind: undefinedInstrument, + agg: aggregation.Base2ExponentialHistogram{}, + want: errIncompatibleAggregation, + }, } for _, tt := range testCases { From ac6cd49ae25861119138947049f8d0ad93371c74 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 6 Aug 2023 02:37:32 -0700 Subject: [PATCH 637/886] dependabot updates Sun Aug 6 09:27:21 UTC 2023 (#4416) Bump golang.org/x/sys from 0.10.0 to 0.11.0 in /sdk Bump golang.org/x/tools from 0.11.0 to 0.11.1 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.10.0 to 0.11.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.10.0 to 0.11.0 in /internal/tools Bump go.opentelemetry.io/build-tools/dbotconf from 0.10.0 to 0.11.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.10.0 to 0.11.0 in /internal/tools --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +- example/fib/go.mod | 2 +- example/fib/go.sum | 4 +- example/jaeger/go.mod | 2 +- example/jaeger/go.sum | 4 +- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 +- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 +- example/view/go.mod | 2 +- example/view/go.sum | 4 +- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +- exporters/jaeger/go.mod | 2 +- exporters/jaeger/go.sum | 4 +- exporters/otlp/otlpmetric/go.mod | 2 +- exporters/otlp/otlpmetric/go.sum | 4 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +- internal/tools/go.mod | 24 ++++----- internal/tools/go.sum | 53 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +- 52 files changed, 113 insertions(+), 114 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d27858af41a..b650a2ac01a 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 9425632f817..04674f850c3 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 36fc8c54df9..1290cee67be 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 0d9fbab0bcc..8661ceb6298 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 5fae281e791..4d0c5393327 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 84b6433927a..83ef51deb84 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= diff --git a/example/fib/go.mod b/example/fib/go.mod index cb30440baf1..bfa54170291 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index bf8971bdd56..bfe2cc3f315 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index 64df89132f0..ce0267c891e 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -19,7 +19,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum index 20f114998ca..8089b278d80 100644 --- a/example/jaeger/go.sum +++ b/example/jaeger/go.sum @@ -8,6 +8,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 7fc426bac9e..40a4ca0d780 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index bf8971bdd56..bfe2cc3f315 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index cda7d767a1b..5807ecfd1f2 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 0d9fbab0bcc..8661ceb6298 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 571485f66ce..c2d967bda81 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 5b599066e70..9d85029550d 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 51f1c4b1303..4d1ead190fb 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index bf8971bdd56..bfe2cc3f315 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 2334616ec41..510392cdfce 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 96e81432bd2..e5afa2cf689 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index 0e5729ad412..bfac7cea8dd 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index 96e81432bd2..e5afa2cf689 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 9abfad0627d..19fe587bf1e 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.1 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index e5f2d016dd3..7c667d325f2 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfP github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 9875273468e..6e716a24da0 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -17,7 +17,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum index 127eea04a06..e874ee50e97 100644 --- a/exporters/jaeger/go.sum +++ b/exporters/jaeger/go.sum @@ -18,8 +18,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index dc15ccb98e4..0f36b495e9e 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index e64a9be9ae2..f6d29fdda91 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index bfb82eb3f6b..4b865521994 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 395c2e0f273..9397989cf3d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 93ad274ed7a..e5a3a390634 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,7 +27,7 @@ require ( go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 395c2e0f273..9397989cf3d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 4aaab7c63bc..9b9d3815751 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -25,7 +25,7 @@ require ( github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index e64a9be9ae2..f6d29fdda91 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 83cf695502c..8e54df641bc 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -25,7 +25,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 0ec71e1edc1..7daf373b691 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -28,8 +28,8 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index e91e97ccecf..f891821c536 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,7 +23,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index a361fa6f5a8..0bace07286a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -26,8 +26,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index e3d8b81dab3..8c412831e9b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -27,7 +27,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index c29d69a73b3..78b97014e2c 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -36,8 +36,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 38b4ff97d6b..2d269fbd80b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index c670b77daed..594aa686923 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index f803eacd8c3..edfdded4033 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index c670b77daed..594aa686923 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index eb351115fef..d1798c7e81e 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index dbf611add62..f36441265f8 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index f921bb6f4ba..0d20b2312f0 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,17 +9,18 @@ require ( github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.10.0 - go.opentelemetry.io/build-tools/dbotconf v0.10.0 + go.opentelemetry.io/build-tools/crosslink v0.11.0 + go.opentelemetry.io/build-tools/dbotconf v0.11.0 go.opentelemetry.io/build-tools/gotmpl v0.10.0 - go.opentelemetry.io/build-tools/multimod v0.10.0 - go.opentelemetry.io/build-tools/semconvgen v0.10.0 - golang.org/x/tools v0.11.0 + go.opentelemetry.io/build-tools/multimod v0.11.0 + go.opentelemetry.io/build-tools/semconvgen v0.11.0 + golang.org/x/tools v0.11.1 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect + dario.cat/mergo v1.0.0 // indirect github.com/4meepo/tagalign v1.2.2 // indirect github.com/Abirdcfly/dupword v0.0.11 // indirect github.com/Antonboom/errname v0.1.10 // indirect @@ -28,9 +29,9 @@ require ( github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect - github.com/Microsoft/go-winio v0.6.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -64,7 +65,7 @@ require ( github.com/go-critic/go-critic v0.8.1 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.8.0 // indirect + github.com/go-git/go-git/v5 v5.8.1 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -97,7 +98,6 @@ require ( github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hexops/gotextdiff v1.0.3 // indirect - github.com/imdario/mergo v0.3.15 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -160,7 +160,7 @@ require ( github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect - github.com/skeema/knownhosts v1.1.1 // indirect + github.com/skeema/knownhosts v1.2.0 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.5 // indirect @@ -190,7 +190,7 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.2 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect - go.opentelemetry.io/build-tools v0.10.0 // indirect + go.opentelemetry.io/build-tools v0.11.0 // indirect go.tmz.dev/musttag v0.7.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -201,7 +201,7 @@ require ( golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index da55244578c..4c022fd8c32 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -39,6 +39,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/4meepo/tagalign v1.2.2 h1:kQeUTkFTaBRtd/7jm8OKJl9iHk0gAO+TDFPHGSna0aw= github.com/4meepo/tagalign v1.2.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= @@ -59,12 +61,12 @@ github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmc github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2nVAQTx5S5jQvMeDqWtD1By5mOoyY/xJek= -github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -103,7 +105,7 @@ github.com/butuzov/ireturn v0.2.0 h1:kCHi+YzC150GE98WFuZQu9yrTn6GEydO2AuPLbTgnO4 github.com/butuzov/ireturn v0.2.0/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -118,7 +120,6 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -167,8 +168,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.8.0 h1:Rc543s6Tyq+YcyPwZRvU4jzZGM8rB/wWu94TnTIYALQ= -github.com/go-git/go-git/v5 v5.8.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= +github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= +github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -322,8 +323,6 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/itchyny/gojq v0.12.13 h1:IxyYlHYIlspQHHTE0f3cJF0NKDMfajxViuhBLnHd/QU= @@ -528,8 +527,8 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/skeema/knownhosts v1.1.1 h1:MTk78x9FPgDFVFkDLTrsnnfCJl7g1C/nnKvePgrIngE= -github.com/skeema/knownhosts v1.1.1/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= +github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= @@ -622,18 +621,18 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.10.0 h1:5asgwud1lI/pMYQM9P/vwEgOjyv6G3nhYnwo0znqAvA= -go.opentelemetry.io/build-tools v0.10.0/go.mod h1:GFpz8YD/DG5shfY1J2f3uuK88zr61U5rVRGOhKMDE9M= -go.opentelemetry.io/build-tools/crosslink v0.10.0 h1:lyXOJP2z3G/o+e0w00q3vkzFZw48Av1yzPOV6JJXVMY= -go.opentelemetry.io/build-tools/crosslink v0.10.0/go.mod h1:B//a0+OAU8kjgLLJnxjDNnlGv8CJt9pF/BaGc0nChvU= -go.opentelemetry.io/build-tools/dbotconf v0.10.0 h1:BKk+Q2BoHqcA9lbrbVqYeQVHPJJb+jHePoO4TIyCy3Y= -go.opentelemetry.io/build-tools/dbotconf v0.10.0/go.mod h1:SOyfUbctj4X9QakCfGy/eTlYlFo/HTNtyjJs7hHP9gE= +go.opentelemetry.io/build-tools v0.11.0 h1:yXTgCJM/vxWZEB8FbgVhKOAFnRlacG2Z3eoTQZ0/gYE= +go.opentelemetry.io/build-tools v0.11.0/go.mod h1:GFpz8YD/DG5shfY1J2f3uuK88zr61U5rVRGOhKMDE9M= +go.opentelemetry.io/build-tools/crosslink v0.11.0 h1:K0eJY/AT6SiIaoJSrQyiVquGErcJEHsx4oHkhxvpj9k= +go.opentelemetry.io/build-tools/crosslink v0.11.0/go.mod h1:h5oxbHx+O50aO0/M7mFejZmd7cMONdsmmC+IOmgWoWw= +go.opentelemetry.io/build-tools/dbotconf v0.11.0 h1:hG0Zyln9Vv+kwNC+ip/EUcLnd9osTZ8dOYOxe/lHZy4= +go.opentelemetry.io/build-tools/dbotconf v0.11.0/go.mod h1:BxYX1iAki4EWzIVXeEPFM75ZWr9e9koqT7pTU5xzad4= go.opentelemetry.io/build-tools/gotmpl v0.10.0 h1:pytcJ20iHs87Y/gMEb3pDgQuZ9g+wBgYYlexzUSJLV4= go.opentelemetry.io/build-tools/gotmpl v0.10.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= -go.opentelemetry.io/build-tools/multimod v0.10.0 h1:jYlpTXAJCZqjzYZdEdwdDIX90qnqQvZkgaPkMt9r6BA= -go.opentelemetry.io/build-tools/multimod v0.10.0/go.mod h1:jn2a5TTq9wSR9ragaruZ2ilqOV+VerkNtNPTqwtIMyM= -go.opentelemetry.io/build-tools/semconvgen v0.10.0 h1:enthiZ2ucgEh6GdSf2FjPJh+tW7lWTKzLPS+oxxWqDY= -go.opentelemetry.io/build-tools/semconvgen v0.10.0/go.mod h1:2vdk73CHKwYfwTWMR/hthGn/5Wbsk8jNiNTI/RthNt0= +go.opentelemetry.io/build-tools/multimod v0.11.0 h1:QMo2Y4BlsTsWUR0LXV4gmiv5yEiX2iPLn2qAdAcCE6k= +go.opentelemetry.io/build-tools/multimod v0.11.0/go.mod h1:EID7sjEGyk1FWzRdsV6rlWp43IIn8iHXGE5pM4TytyQ= +go.opentelemetry.io/build-tools/semconvgen v0.11.0 h1:gQsNzy49l9JjNozybaRUl+vy0EMxYasV8w6aK+IWquc= +go.opentelemetry.io/build-tools/semconvgen v0.11.0/go.mod h1:Zy04Bw3w3lT7mORe23V2BwjfJYpoza6Xz1XSMIrLTCg= go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= @@ -654,6 +653,7 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= @@ -821,7 +821,6 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -837,8 +836,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -934,8 +933,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc= +golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index ac19b7080c7..82fd372ede4 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/trace v1.16.0 - golang.org/x/sys v0.10.0 + golang.org/x/sys v0.11.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 287e8127d87..7729e42a72e 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index fcdfdfa5b74..f7f92f4ecc2 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/sys v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index c670b77daed..594aa686923 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From d1f33f19b45fc24c2d4049ecd7180367560848c1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 7 Aug 2023 08:50:30 -0700 Subject: [PATCH 638/886] Decouple `otlp/otlpmetric/otlpmetrichttp` from `otlp/internal` and `otlp/otlpmetric/internal` using gotmp (#4407) * Generate otlpmetrichttp/internal with gotmpl * Use local internal pkg for otlpmetrichttp * Add changes to changelog * Fix rendered envconfig_test.go file name --- CHANGELOG.md | 1 + .../otlp/otlpmetric/otlpmetrichttp/client.go | 11 +- .../otlpmetric/otlpmetrichttp/client_test.go | 7 +- .../otlp/otlpmetric/otlpmetrichttp/config.go | 4 +- .../otlpmetric/otlpmetrichttp/exporter.go | 4 +- .../otlpmetrichttp/exporter_test.go | 4 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 9 +- .../internal/envconfig/envconfig.go | 202 ++++++ .../internal/envconfig/envconfig_test.go | 464 +++++++++++++ .../otlpmetric/otlpmetrichttp/internal/gen.go | 42 ++ .../internal/oconf/envconfig.go | 196 ++++++ .../internal/oconf/envconfig_test.go | 106 +++ .../otlpmetrichttp/internal/oconf/options.go | 376 +++++++++++ .../internal/oconf/options_test.go | 534 +++++++++++++++ .../internal/oconf/optiontypes.go | 58 ++ .../otlpmetrichttp/internal/oconf/tls.go | 49 ++ .../otlpmetrichttp/internal/otest/client.go | 313 +++++++++ .../internal/otest/client_test.go | 78 +++ .../internal/otest/collector.go | 438 ++++++++++++ .../otlpmetrichttp/internal/partialsuccess.go | 67 ++ .../internal/partialsuccess_test.go | 46 ++ .../otlpmetrichttp/internal/retry/retry.go | 156 +++++ .../internal/retry/retry_test.go | 261 ++++++++ .../internal/transform/attribute.go | 155 +++++ .../internal/transform/attribute_test.go | 197 ++++++ .../internal/transform/error.go | 114 ++++ .../internal/transform/error_test.go | 91 +++ .../internal/transform/metricdata.go | 292 ++++++++ .../internal/transform/metricdata_test.go | 633 ++++++++++++++++++ 29 files changed, 4888 insertions(+), 20 deletions(-) create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/gen.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/optiontypes.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/tls.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f2044274f5e..69adae40ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) +- Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 01b7575eeba..ac7023c7ae6 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -30,10 +30,10 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" colmetricpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -89,7 +89,8 @@ func newClient(cfg oconf.Config) (*client, error) { return nil, err } - req.Header.Set("User-Agent", ominternal.GetUserAgentHeader()) + userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() + req.Header.Set("User-Agent", userAgent) if n := len(cfg.Metrics.Headers); n > 0 { for k, v := range cfg.Metrics.Headers { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index ab89bd27a9a..b5af1d61ba1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -27,9 +27,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -50,7 +49,7 @@ func (clientShim) ForceFlush(ctx context.Context) error { } func TestClient(t *testing.T) { - factory := func(rCh <-chan otest.ExportResult) (ominternal.Client, otest.Collector) { + factory := func(rCh <-chan otest.ExportResult) (otest.Client, otest.Collector) { coll, err := otest.NewHTTPCollector("", rCh) require.NoError(t, err) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go index e9f7c774642..6eae3e1bbda 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -18,8 +18,8 @@ import ( "crypto/tls" "time" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" "go.opentelemetry.io/otel/sdk/metric" ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go index be21d6b004e..dd6f80b82ed 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go @@ -19,8 +19,8 @@ import ( "fmt" "sync" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go index faf34ba1d8c..9154d62768b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index e5a3a390634..9c6c5c1e784 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -5,33 +5,32 @@ go 1.19 retract v0.32.2 // Contains unresolvable dependencies. require ( + github.com/cenkalti/backoff/v4 v4.2.1 + github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 + go.opentelemetry.io/otel/sdk v1.16.0 go.opentelemetry.io/otel/sdk/metric v0.39.0 go.opentelemetry.io/proto/otlp v1.0.0 + google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/grpc v1.57.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go new file mode 100644 index 00000000000..38859fb9342 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go @@ -0,0 +1,202 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "go.opentelemetry.io/otel/internal/global" +) + +// ConfigFn is the generic function used to set a config. +type ConfigFn func(*EnvOptionsReader) + +// EnvOptionsReader reads the required environment variables. +type EnvOptionsReader struct { + GetEnv func(string) string + ReadFile func(string) ([]byte, error) + Namespace string +} + +// Apply runs every ConfigFn. +func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { + for _, o := range opts { + o(e) + } +} + +// GetEnvValue gets an OTLP environment variable value of the specified key +// using the GetEnv function. +// This function prepends the OTLP specified namespace to all key lookups. +func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { + v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) + return v, v != "" +} + +// WithString retrieves the specified config and passes it to ConfigFn as a string. +func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(v) + } + } +} + +// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. +func WithBool(n string, fn func(bool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b := strings.ToLower(v) == "true" + fn(b) + } + } +} + +// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. +func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + d, err := strconv.Atoi(v) + if err != nil { + global.Error(err, "parse duration", "input", v) + return + } + fn(time.Duration(d) * time.Millisecond) + } + } +} + +// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. +func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + fn(stringToHeader(v)) + } + } +} + +// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. +func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "parse url", "input", v) + return + } + fn(u) + } + } +} + +// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. +func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { + return func(e *EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + b, err := e.ReadFile(v) + if err != nil { + global.Error(err, "read tls ca cert file", "file", v) + return + } + c, err := createCertPool(b) + if err != nil { + global.Error(err, "create tls cert pool") + return + } + fn(c) + } + } +} + +// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. +func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { + return func(e *EnvOptionsReader) { + vc, okc := e.GetEnvValue(nc) + vk, okk := e.GetEnvValue(nk) + if !okc || !okk { + return + } + cert, err := e.ReadFile(vc) + if err != nil { + global.Error(err, "read tls client cert", "file", vc) + return + } + key, err := e.ReadFile(vk) + if err != nil { + global.Error(err, "read tls client key", "file", vk) + return + } + crt, err := tls.X509KeyPair(cert, key) + if err != nil { + global.Error(err, "create tls client key pair") + return + } + fn(crt) + } +} + +func keyWithNamespace(ns, key string) string { + if ns == "" { + return key + } + return fmt.Sprintf("%s_%s", ns, key) +} + +func stringToHeader(value string) map[string]string { + headersPairs := strings.Split(value, ",") + headers := make(map[string]string) + + for _, header := range headersPairs { + n, v, found := strings.Cut(header, "=") + if !found { + global.Error(errors.New("missing '="), "parse headers", "input", header) + continue + } + name, err := url.QueryUnescape(n) + if err != nil { + global.Error(err, "escape header key", "key", n) + continue + } + trimmedName := strings.TrimSpace(name) + value, err := url.QueryUnescape(v) + if err != nil { + global.Error(err, "escape header value", "value", v) + continue + } + trimmedValue := strings.TrimSpace(value) + + headers[trimmedName] = trimmedValue + } + + return headers +} + +func createCertPool(certBytes []byte) (*x509.CertPool, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + return cp, nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go new file mode 100644 index 00000000000..cec506208d5 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go @@ -0,0 +1,464 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package envconfig + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "net/url" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +const WeakKey = ` +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 +AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB +2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== +-----END EC PRIVATE KEY----- +` + +const WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw +EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 +MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC +AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy +Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK +SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ +BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg +Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu +jVcIxYQqhId5L8p/mAv2PWZS +-----END CERTIFICATE----- +` + +type testOption struct { + TestString string + TestBool bool + TestDuration time.Duration + TestHeaders map[string]string + TestURL *url.URL + TestTLS *tls.Config +} + +func TestEnvConfig(t *testing.T) { + parsedURL, err := url.Parse("https://example.com") + assert.NoError(t, err) + + options := []testOption{} + for _, testcase := range []struct { + name string + reader EnvOptionsReader + configs []ConfigFn + expectedOptions []testOption + }{ + { + name: "with no namespace and a matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HOLA", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a namespace and a matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "MY_NAMESPACE_HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{ + { + TestString: "world", + }, + }, + }, + { + name: "with no namespace and a non-matching key", + reader: EnvOptionsReader{ + Namespace: "MY_NAMESPACE", + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithString("HELLO", func(v string) { + options = append(options, testOption{TestString: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with a bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "true" + } else if n == "WORLD" { + return "false" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + WithBool("WORLD", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: true, + }, + { + TestBool: false, + }, + }, + }, + { + name: "with an invalid bool config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithBool("HELLO", func(b bool) { + options = append(options, testOption{TestBool: b}) + }), + }, + expectedOptions: []testOption{ + { + TestBool: false, + }, + }, + }, + { + name: "with a duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "60" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{ + { + TestDuration: 60_000_000, // 60 milliseconds + }, + }, + }, + { + name: "with an invalid duration config", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithDuration("HELLO", func(v time.Duration) { + options = append(options, testOption{TestDuration: v}) + }), + }, + expectedOptions: []testOption{}, + }, + { + name: "with headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "userId=42,userName=alice" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{ + "userId": "42", + "userName": "alice", + }, + }, + }, + }, + { + name: "with invalid headers", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "world" + } + return "" + }, + }, + configs: []ConfigFn{ + WithHeaders("HELLO", func(v map[string]string) { + options = append(options, testOption{TestHeaders: v}) + }), + }, + expectedOptions: []testOption{ + { + TestHeaders: map[string]string{}, + }, + }, + }, + { + name: "with URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "https://example.com" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{ + { + TestURL: parsedURL, + }, + }, + }, + { + name: "with invalid URL", + reader: EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "HELLO" { + return "i nvalid://url" + } + return "" + }, + }, + configs: []ConfigFn{ + WithURL("HELLO", func(v *url.URL) { + options = append(options, testOption{TestURL: v}) + }), + }, + expectedOptions: []testOption{}, + }, + } { + t.Run(testcase.name, func(t *testing.T) { + testcase.reader.Apply(testcase.configs...) + assert.Equal(t, testcase.expectedOptions, options) + options = []testOption{} + }) + } +} + +func TestWithTLSConfig(t *testing.T) { + pool, err := createCertPool([]byte(WeakCertificate)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + if n == "CERTIFICATE" { + return "/path/cert.pem" + } + return "" + }, + ReadFile: func(p string) ([]byte, error) { + if p == "/path/cert.pem" { + return []byte(WeakCertificate), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { + option = testOption{TestTLS: &tls.Config{RootCAs: cp}} + }), + ) + + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) +} + +func TestWithClientCert(t *testing.T) { + cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) + assert.NoError(t, err) + + reader := EnvOptionsReader{ + GetEnv: func(n string) string { + switch n { + case "CLIENT_CERTIFICATE": + return "/path/tls.crt" + case "CLIENT_KEY": + return "/path/tls.key" + } + return "" + }, + ReadFile: func(n string) ([]byte, error) { + switch n { + case "/path/tls.crt": + return []byte(WeakCertificate), nil + case "/path/tls.key": + return []byte(WeakKey), nil + } + return []byte{}, nil + }, + } + + var option testOption + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Equal(t, cert, option.TestTLS.Certificates[0]) + + reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) + + reader.GetEnv = func(s string) string { return "" } + option.TestTLS = nil + reader.Apply( + WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { + option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} + }), + ) + assert.Nil(t, option.TestTLS) +} + +func TestStringToHeader(t *testing.T) { + tests := []struct { + name string + value string + want map[string]string + }{ + { + name: "simple test", + value: "userId=alice", + want: map[string]string{"userId": "alice"}, + }, + { + name: "simple test with spaces", + value: " userId = alice ", + want: map[string]string{"userId": "alice"}, + }, + { + name: "multiples headers encoded", + value: "userId=alice,serverNode=DF%3A28,isProduction=false", + want: map[string]string{ + "userId": "alice", + "serverNode": "DF:28", + "isProduction": "false", + }, + }, + { + name: "invalid headers format", + value: "userId:alice", + want: map[string]string{}, + }, + { + name: "invalid key", + value: "%XX=missing,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + { + name: "invalid value", + value: "missing=%XX,userId=alice", + want: map[string]string{ + "userId": "alice", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, stringToHeader(tt.value)) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/gen.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/gen.go new file mode 100644 index 00000000000..002c8b36b2e --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/gen.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess_test.go.tmpl "--data={}" --out=partialsuccess_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig\"}" --out=oconf/envconfig.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl "--data={}" --out=oconf/envconfig_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry\"}" --out=oconf/options.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig\"}" --out=oconf/options_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl "--data={}" --out=oconf/optiontypes.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl "--data={}" --out=oconf/tls.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client.go.tmpl "--data={}" --out=otest/client.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl "--data={\"internalImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal\"}" --out=otest/client_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/otest/collector.go.tmpl "--data={\"oconfImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf\"}" --out=otest/collector.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl "--data={}" --out=transform/attribute.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl "--data={}" --out=transform/attribute_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error.go.tmpl "--data={}" --out=transform/error.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl "--data={}" --out=transform/error_test.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl "--data={}" --out=transform/metricdata.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl "--data={}" --out=transform/metricdata_test.go diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go new file mode 100644 index 00000000000..0b8e033ace3 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go @@ -0,0 +1,196 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + +import ( + "crypto/tls" + "crypto/x509" + "net/url" + "os" + "path" + "strings" + "time" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// DefaultEnvOptionsReader is the default environments reader. +var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: os.Getenv, + ReadFile: os.ReadFile, + Namespace: "OTEL_EXPORTER_OTLP", +} + +// ApplyGRPCEnvConfigs applies the env configurations for gRPC. +func ApplyGRPCEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + return cfg +} + +// ApplyHTTPEnvConfigs applies the env configurations for HTTP. +func ApplyHTTPEnvConfigs(cfg Config) Config { + opts := getOptionsFromEnv() + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + return cfg +} + +func getOptionsFromEnv() []GenericOption { + opts := []GenericOption{} + + tlsConf := &tls.Config{} + DefaultEnvOptionsReader.Apply( + envconfig.WithURL("ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For OTLP/HTTP endpoint URLs without a per-signal + // configuration, the passed endpoint is used as a base URL + // and the signals are sent to these paths relative to that. + cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) { + opts = append(opts, withEndpointScheme(u)) + opts = append(opts, newSplitOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = u.Host + // For endpoint URLs for OTLP/HTTP per-signal variables, the + // URL MUST be used as-is without any modification. The only + // exception is that if an URL contains no path part, the root + // path / MUST be used. + path := u.Path + if path == "" { + path = "/" + } + cfg.Metrics.URLPath = path + return cfg + }, withEndpointForGRPC(u))) + }), + envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), + envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert("METRICS_CLIENT_CERTIFICATE", "METRICS_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + envconfig.WithBool("METRICS_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), + withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), + envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), + WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), + envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), + withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + ) + + return opts +} + +func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { + return func(cfg Config) Config { + // For OTLP/gRPC endpoints, this is the target to which the + // exporter is going to send telemetry. + cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) + return cfg + } +} + +// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. +func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if v, ok := e.GetEnvValue(n); ok { + cp := NoCompression + if v == "gzip" { + cp = GzipCompression + } + + fn(cp) + } + } +} + +func withEndpointScheme(u *url.URL) GenericOption { + switch strings.ToLower(u.Scheme) { + case "http", "unix": + return WithInsecure() + default: + return WithSecure() + } +} + +// revive:disable-next-line:flag-parameter +func withInsecure(b bool) GenericOption { + if b { + return WithInsecure() + } + return WithSecure() +} + +func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if c.RootCAs != nil || len(c.Certificates) > 0 { + fn(c) + } + } +} + +func withEnvTemporalityPreference(n string, fn func(metric.TemporalitySelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "cumulative": + fn(cumulativeTemporality) + case "delta": + fn(deltaTemporality) + case "lowmemory": + fn(lowMemory) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to an invalid value, ignoring.", "value", s) + } + } + } +} + +func cumulativeTemporality(metric.InstrumentKind) metricdata.Temporality { + return metricdata.CumulativeTemporality +} + +func deltaTemporality(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram, metric.InstrumentKindObservableCounter: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} + +func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { + switch ik { + case metric.InstrumentKindCounter, metric.InstrumentKindHistogram: + return metricdata.DeltaTemporality + default: + return metricdata.CumulativeTemporality + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go new file mode 100644 index 00000000000..d497c8e4b6c --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go @@ -0,0 +1,106 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +func TestWithEnvTemporalityPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]metricdata.Temporality + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "cumulative", + envValue: "cumulative", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindHistogram: metricdata.CumulativeTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "delta", + envValue: "delta", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.DeltaTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + { + name: "lowmemory", + envValue: "lowmemory", + want: map[metric.InstrumentKind]metricdata.Temporality{ + metric.InstrumentKindCounter: metricdata.DeltaTemporality, + metric.InstrumentKindHistogram: metricdata.DeltaTemporality, + metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, + metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.TemporalitySelector) + return + } + + require.NotNil(t, cfg.Metrics.TemporalitySelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.TemporalitySelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go new file mode 100644 index 00000000000..de0916313d7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -0,0 +1,376 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + +import ( + "crypto/tls" + "fmt" + "path" + "strings" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/encoding/gzip" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" +) + +const ( + // DefaultMaxAttempts describes how many times the driver + // should retry the sending of the payload in case of a + // retryable error. + DefaultMaxAttempts int = 5 + // DefaultMetricsPath is a default URL path for endpoint that + // receives metrics. + DefaultMetricsPath string = "/v1/metrics" + // DefaultBackoff is a default base backoff time used in the + // exponential backoff strategy. + DefaultBackoff time.Duration = 300 * time.Millisecond + // DefaultTimeout is a default max waiting time for the backend to process + // each span or metrics batch. + DefaultTimeout time.Duration = 10 * time.Second +) + +type ( + SignalConfig struct { + Endpoint string + Insecure bool + TLSCfg *tls.Config + Headers map[string]string + Compression Compression + Timeout time.Duration + URLPath string + + // gRPC configurations + GRPCCredentials credentials.TransportCredentials + + TemporalitySelector metric.TemporalitySelector + AggregationSelector metric.AggregationSelector + } + + Config struct { + // Signal specific configurations + Metrics SignalConfig + + RetryConfig retry.Config + + // gRPC configurations + ReconnectionPeriod time.Duration + ServiceConfig string + DialOptions []grpc.DialOption + GRPCConn *grpc.ClientConn + } +) + +// NewHTTPConfig returns a new Config with all settings applied from opts and +// any unset setting using the default HTTP config values. +func NewHTTPConfig(opts ...HTTPOption) Config { + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + } + cfg = ApplyHTTPEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyHTTPOption(cfg) + } + cfg.Metrics.URLPath = cleanPath(cfg.Metrics.URLPath, DefaultMetricsPath) + return cfg +} + +// cleanPath returns a path with all spaces trimmed and all redundancies +// removed. If urlPath is empty or cleaning it results in an empty string, +// defaultPath is returned instead. +func cleanPath(urlPath string, defaultPath string) string { + tmp := path.Clean(strings.TrimSpace(urlPath)) + if tmp == "." { + return defaultPath + } + if !path.IsAbs(tmp) { + tmp = fmt.Sprintf("/%s", tmp) + } + return tmp +} + +// NewGRPCConfig returns a new Config with all settings applied from opts and +// any unset setting using the default gRPC config values. +func NewGRPCConfig(opts ...GRPCOption) Config { + userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() + cfg := Config{ + Metrics: SignalConfig{ + Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), + URLPath: DefaultMetricsPath, + Compression: NoCompression, + Timeout: DefaultTimeout, + + TemporalitySelector: metric.DefaultTemporalitySelector, + AggregationSelector: metric.DefaultAggregationSelector, + }, + RetryConfig: retry.DefaultConfig, + DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, + } + cfg = ApplyGRPCEnvConfigs(cfg) + for _, opt := range opts { + cfg = opt.ApplyGRPCOption(cfg) + } + + if cfg.ServiceConfig != "" { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) + } + // Priroritize GRPCCredentials over Insecure (passing both is an error). + if cfg.Metrics.GRPCCredentials != nil { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials)) + } else if cfg.Metrics.Insecure { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) + } else { + // Default to using the host's root CA. + creds := credentials.NewTLS(nil) + cfg.Metrics.GRPCCredentials = creds + cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) + } + if cfg.Metrics.Compression == GzipCompression { + cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) + } + if len(cfg.DialOptions) != 0 { + cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) + } + if cfg.ReconnectionPeriod != 0 { + p := grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: cfg.ReconnectionPeriod, + } + cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) + } + + return cfg +} + +type ( + // GenericOption applies an option to the HTTP or gRPC driver. + GenericOption interface { + ApplyHTTPOption(Config) Config + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // HTTPOption applies an option to the HTTP driver. + HTTPOption interface { + ApplyHTTPOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } + + // GRPCOption applies an option to the gRPC driver. + GRPCOption interface { + ApplyGRPCOption(Config) Config + + // A private method to prevent users implementing the + // interface and so future additions to it will not + // violate compatibility. + private() + } +) + +// genericOption is an option that applies the same logic +// for both gRPC and HTTP. +type genericOption struct { + fn func(Config) Config +} + +func (g *genericOption) ApplyGRPCOption(cfg Config) Config { + return g.fn(cfg) +} + +func (g *genericOption) ApplyHTTPOption(cfg Config) Config { + return g.fn(cfg) +} + +func (genericOption) private() {} + +func newGenericOption(fn func(cfg Config) Config) GenericOption { + return &genericOption{fn: fn} +} + +// splitOption is an option that applies different logics +// for gRPC and HTTP. +type splitOption struct { + httpFn func(Config) Config + grpcFn func(Config) Config +} + +func (g *splitOption) ApplyGRPCOption(cfg Config) Config { + return g.grpcFn(cfg) +} + +func (g *splitOption) ApplyHTTPOption(cfg Config) Config { + return g.httpFn(cfg) +} + +func (splitOption) private() {} + +func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { + return &splitOption{httpFn: httpFn, grpcFn: grpcFn} +} + +// httpOption is an option that is only applied to the HTTP driver. +type httpOption struct { + fn func(Config) Config +} + +func (h *httpOption) ApplyHTTPOption(cfg Config) Config { + return h.fn(cfg) +} + +func (httpOption) private() {} + +func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { + return &httpOption{fn: fn} +} + +// grpcOption is an option that is only applied to the gRPC driver. +type grpcOption struct { + fn func(Config) Config +} + +func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { + return h.fn(cfg) +} + +func (grpcOption) private() {} + +func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { + return &grpcOption{fn: fn} +} + +// Generic Options + +func WithEndpoint(endpoint string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Endpoint = endpoint + return cfg + }) +} + +func WithCompression(compression Compression) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Compression = compression + return cfg + }) +} + +func WithURLPath(urlPath string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.URLPath = urlPath + return cfg + }) +} + +func WithRetry(rc retry.Config) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.RetryConfig = rc + return cfg + }) +} + +func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { + return newSplitOption(func(cfg Config) Config { + cfg.Metrics.TLSCfg = tlsCfg.Clone() + return cfg + }, func(cfg Config) Config { + cfg.Metrics.GRPCCredentials = credentials.NewTLS(tlsCfg) + return cfg + }) +} + +func WithInsecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = true + return cfg + }) +} + +func WithSecure() GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Insecure = false + return cfg + }) +} + +func WithHeaders(headers map[string]string) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Headers = headers + return cfg + }) +} + +func WithTimeout(duration time.Duration) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Timeout = duration + return cfg + }) +} + +func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.TemporalitySelector = selector + return cfg + }) +} + +func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { + // Deep copy and validate before using. + wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { + a := selector(ik) + cpA := a.Copy() + if err := cpA.Err(); err != nil { + cpA = metric.DefaultAggregationSelector(ik) + global.Error( + err, "using default aggregation instead", + "aggregation", a, + "replacement", cpA, + ) + } + return cpA + } + + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.AggregationSelector = wrapped + return cfg + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go new file mode 100644 index 00000000000..5b4ee0358b7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go @@ -0,0 +1,534 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf + +import ( + "errors" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +const ( + WeakCertificate = ` +-----BEGIN CERTIFICATE----- +MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ +MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa +MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 +nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z +sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI +KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA +AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ +1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH +Lhnm4N/QDk5rek0= +-----END CERTIFICATE----- +` + WeakPrivateKey = ` +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK +SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf +kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV +-----END PRIVATE KEY----- +` +) + +type env map[string]string + +func (e *env) getEnv(env string) string { + return (*e)[env] +} + +type fileReader map[string][]byte + +func (f *fileReader) readFile(filename string) ([]byte, error) { + if b, ok := (*f)[filename]; ok { + return b, nil + } + return nil, errors.New("file not found") +} + +func TestConfigs(t *testing.T) { + tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) + assert.NoError(t, err) + + tests := []struct { + name string + opts []GenericOption + env env + fileReader fileReader + asserts func(t *testing.T, c *Config, grpcOption bool) + }{ + { + name: "Test default configs", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, NoCompression, c.Metrics.Compression) + assert.Equal(t, map[string]string(nil), c.Metrics.Headers) + assert.Equal(t, 10*time.Second, c.Metrics.Timeout) + }, + }, + + // Endpoint Tests + { + name: "Test With Endpoint", + opts: []GenericOption{ + WithEndpoint("someendpoint"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.False(t, c.Metrics.Insecure) + if grpcOption { + assert.Equal(t, "env.endpoint/prefix", c.Metrics.Endpoint) + } else { + assert.Equal(t, "env.endpoint", c.Metrics.Endpoint) + assert.Equal(t, "/prefix/v1/metrics", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Environment Signal Specific Endpoint", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "http://env.metrics.endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.True(t, c.Metrics.Insecure) + assert.Equal(t, "env.metrics.endpoint", c.Metrics.Endpoint) + if !grpcOption { + assert.Equal(t, "/", c.Metrics.URLPath) + } + }, + }, + { + name: "Test Mixed Environment and With Endpoint", + opts: []GenericOption{ + WithEndpoint("metrics_endpoint"), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "metrics_endpoint", c.Metrics.Endpoint) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Endpoint with HTTPS scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test Environment Signal Specific Endpoint with uppercase scheme", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "HtTp://env_metrics_endpoint", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "env_metrics_endpoint", c.Metrics.Endpoint) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + + // Certificate tests + { + name: "Test Default Certificate", + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + assert.Nil(t, c.Metrics.TLSCfg) + } + }, + }, + { + name: "Test With Certificate", + opts: []GenericOption{ + WithTLSClientConfig(tlsCert), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + //TODO: make sure gRPC's credentials actually works + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Environment Signal Specific Certificate", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + "invalid_cert": []byte("invalid certificate file."), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) + } + }, + }, + { + name: "Test Mixed Environment and With Certificate", + opts: []GenericOption{}, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", + }, + fileReader: fileReader{ + "cert_path": []byte(WeakCertificate), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.NotNil(t, c.Metrics.GRPCCredentials) + } else { + // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. + assert.Equal(t, 1, len(c.Metrics.TLSCfg.RootCAs.Subjects())) + } + }, + }, + + // Headers tests + { + name: "Test With Headers", + opts: []GenericOption{ + WithHeaders(map[string]string{"h1": "v1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Environment Signal Specific Headers", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", + "OTEL_EXPORTER_OTLP_METRICS_HEADERS": "h1=v1,h2=v2", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) + }, + }, + { + name: "Test Mixed Environment and With Headers", + env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, + opts: []GenericOption{ + WithHeaders(map[string]string{"m1": "mv1"}), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, map[string]string{"m1": "mv1"}, c.Metrics.Headers) + }, + }, + + // Compression Tests + { + name: "Test With Compression", + opts: []GenericOption{ + WithCompression(GzipCompression), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Environment Signal Specific Compression", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, GzipCompression, c.Metrics.Compression) + }, + }, + { + name: "Test Mixed Environment and With Compression", + opts: []GenericOption{ + WithCompression(NoCompression), + }, + env: map[string]string{ + "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, NoCompression, c.Metrics.Compression) + }, + }, + + // Timeout Tests + { + name: "Test With Timeout", + opts: []GenericOption{ + WithTimeout(time.Duration(5 * time.Second)), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, 5*time.Second, c.Metrics.Timeout) + }, + }, + { + name: "Test Environment Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 15*time.Second) + }, + }, + { + name: "Test Environment Signal Specific Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 28*time.Second) + }, + }, + { + name: "Test Mixed Environment and With Timeout", + env: map[string]string{ + "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", + "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", + }, + opts: []GenericOption{ + WithTimeout(5 * time.Second), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, c.Metrics.Timeout, 5*time.Second) + }, + }, + + // Temporality Selector Tests + { + name: "WithTemporalitySelector", + opts: []GenericOption{ + WithTemporalitySelector(deltaSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a TemporalitySelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.TemporalitySelector + assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) + }, + }, + + // Aggregation Selector Tests + { + name: "WithAggregationSelector", + opts: []GenericOption{ + WithAggregationSelector(dropSelector), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + // Function value comparisons are disallowed, test non-default + // behavior of a AggregationSelector here to ensure our "catch + // all" was set. + var undefinedKind metric.InstrumentKind + got := c.Metrics.AggregationSelector + assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + origEOR := DefaultEnvOptionsReader + DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ + GetEnv: tt.env.getEnv, + ReadFile: tt.fileReader.readFile, + Namespace: "OTEL_EXPORTER_OTLP", + } + t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) + + // Tests Generic options as HTTP Options + cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) + tt.asserts(t, &cfg, false) + + // Tests Generic options as gRPC Options + cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) + tt.asserts(t, &cfg, true) + }) + } +} + +func dropSelector(metric.InstrumentKind) aggregation.Aggregation { + return aggregation.Drop{} +} + +func deltaSelector(metric.InstrumentKind) metricdata.Temporality { + return metricdata.DeltaTemporality +} + +func asHTTPOptions(opts []GenericOption) []HTTPOption { + converted := make([]HTTPOption, len(opts)) + for i, o := range opts { + converted[i] = NewHTTPOption(o.ApplyHTTPOption) + } + return converted +} + +func asGRPCOptions(opts []GenericOption) []GRPCOption { + converted := make([]GRPCOption, len(opts)) + for i, o := range opts { + converted[i] = NewGRPCOption(o.ApplyGRPCOption) + } + return converted +} + +func TestCleanPath(t *testing.T) { + type args struct { + urlPath string + defaultPath string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "clean empty path", + args: args{ + urlPath: "", + defaultPath: "DefaultPath", + }, + want: "DefaultPath", + }, + { + name: "clean metrics path", + args: args{ + urlPath: "/prefix/v1/metrics", + defaultPath: "DefaultMetricsPath", + }, + want: "/prefix/v1/metrics", + }, + { + name: "clean traces path", + args: args{ + urlPath: "https://env_endpoint", + defaultPath: "DefaultTracesPath", + }, + want: "/https:/env_endpoint", + }, + { + name: "spaces trimmed", + args: args{ + urlPath: " /dir", + }, + want: "/dir", + }, + { + name: "clean path empty", + args: args{ + urlPath: "dir/..", + defaultPath: "DefaultTracesPath", + }, + want: "DefaultTracesPath", + }, + { + name: "make absolute", + args: args{ + urlPath: "dir/a", + }, + want: "/dir/a", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { + t.Errorf("CleanPath() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/optiontypes.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/optiontypes.go new file mode 100644 index 00000000000..f8805e31d62 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/optiontypes.go @@ -0,0 +1,58 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + +import "time" + +const ( + // DefaultCollectorGRPCPort is the default gRPC port of the collector. + DefaultCollectorGRPCPort uint16 = 4317 + // DefaultCollectorHTTPPort is the default HTTP port of the collector. + DefaultCollectorHTTPPort uint16 = 4318 + // DefaultCollectorHost is the host address the Exporter will attempt + // connect to if no collector address is provided. + DefaultCollectorHost string = "localhost" +) + +// Compression describes the compression used for payloads sent to the +// collector. +type Compression int + +const ( + // NoCompression tells the driver to send payloads without + // compression. + NoCompression Compression = iota + // GzipCompression tells the driver to send payloads after + // compressing them with gzip. + GzipCompression +) + +// RetrySettings defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type RetrySettings struct { + // Enabled indicates whether to not retry sending batches in case of export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between + // consecutive retries will always be `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch. + // Once this value is reached, the data is discarded. + MaxElapsedTime time.Duration +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/tls.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/tls.go new file mode 100644 index 00000000000..15cbec25850 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/tls.go @@ -0,0 +1,49 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/oconf/tls.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + +import ( + "crypto/tls" + "crypto/x509" + "errors" + "os" +) + +// ReadTLSConfigFromFile reads a PEM certificate file and creates +// a tls.Config that will use this certifate to verify a server certificate. +func ReadTLSConfigFromFile(path string) (*tls.Config, error) { + b, err := os.ReadFile(path) + if err != nil { + return nil, err + } + + return CreateTLSConfig(b) +} + +// CreateTLSConfig creates a tls.Config from a raw certificate bytes +// to verify a server certificate. +func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { + cp := x509.NewCertPool() + if ok := cp.AppendCertsFromPEM(certBytes); !ok { + return nil, errors.New("failed to append certificate to the cert pool") + } + + return &tls.Config{ + RootCAs: cp, + }, nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go new file mode 100644 index 00000000000..1f71abecac9 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go @@ -0,0 +1,313 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" + +import ( + "context" + "fmt" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel" + semconv "go.opentelemetry.io/otel/semconv/v1.17.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" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + kvBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + kvSrvName = &cpb.KeyValue{Key: "service.name", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }} + kvSrvVer = &cpb.KeyValue{Key: "service.version", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }} + + min, max, sum = 2.0, 4.0, 90.0 + hdp = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sum, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &min, + Max: &max, + }, + } + + hist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: hdp, + } + + dPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + dPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{kvAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{kvBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + sumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: dPtsInt64, + } + sumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: dPtsFloat64, + } + + gaugeInt64 = &mpb.Gauge{DataPoints: dPtsInt64} + gaugeFloat64 = &mpb.Gauge{DataPoints: dPtsFloat64} + + metrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: sumFloat64}, + }, + { + Name: "histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: hist}, + }, + } + + scope = &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + } + scopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: scope, + Metrics: metrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + res = &rpb.Resource{ + Attributes: []*cpb.KeyValue{kvSrvName, kvSrvVer}, + } + resourceMetrics = &mpb.ResourceMetrics{ + Resource: res, + ScopeMetrics: scopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +type Client interface { + UploadMetrics(context.Context, *mpb.ResourceMetrics) error + ForceFlush(context.Context) error + Shutdown(context.Context) error +} + +// ClientFactory is a function that when called returns a +// Client implementation that is connected to also returned +// Collector implementation. The Client is ready to upload metric data to the +// Collector which is ready to store that data. +// +// If resultCh is not nil, the returned Collector needs to use the responses +// from that channel to send back to the client for every export request. +type ClientFactory func(resultCh <-chan ExportResult) (Client, Collector) + +// RunClientTests runs a suite of Client integration tests. For example: +// +// t.Run("Integration", RunClientTests(factory)) +func RunClientTests(f ClientFactory) func(*testing.T) { + return func(t *testing.T) { + t.Run("ClientHonorsContextErrors", func(t *testing.T) { + t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.Shutdown + })) + + t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return c.ForceFlush + })) + + t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { + c, _ := f(nil) + return func(ctx context.Context) error { + return c.UploadMetrics(ctx, nil) + } + })) + }) + + t.Run("ForceFlushFlushes", func(t *testing.T) { + ctx := context.Background() + client, collector := f(nil) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + + require.NoError(t, client.ForceFlush(ctx)) + rm := collector.Collect().Dump() + // Data correctness is not important, just it was received. + require.Greater(t, len(rm), 0, "no data uploaded") + + require.NoError(t, client.Shutdown(ctx)) + rm = collector.Collect().Dump() + assert.Len(t, rm, 0, "client did not flush all data") + }) + + t.Run("UploadMetrics", func(t *testing.T) { + ctx := context.Background() + client, coll := f(nil) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + got := coll.Collect().Dump() + require.Len(t, got, 1, "upload of one ResourceMetrics") + diff := cmp.Diff(got[0], resourceMetrics, cmp.Comparer(proto.Equal)) + if diff != "" { + t.Fatalf("unexpected ResourceMetrics:\n%s", diff) + } + }) + + t.Run("PartialSuccess", func(t *testing.T) { + const n, msg = 2, "bad data" + rCh := make(chan ExportResult, 3) + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + RejectedDataPoints: n, + ErrorMessage: msg, + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{ + PartialSuccess: &collpb.ExportMetricsPartialSuccess{ + // Should not be logged. + RejectedDataPoints: 0, + ErrorMessage: "", + }, + }, + } + rCh <- ExportResult{ + Response: &collpb.ExportMetricsServiceResponse{}, + } + + ctx := context.Background() + client, _ := f(rCh) + + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) + require.NoError(t, client.Shutdown(ctx)) + + require.Equal(t, 1, len(errs)) + want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) + assert.ErrorContains(t, errs[0], want) + }) + } +} + +func testCtxErrs(factory func() func(context.Context) error) func(t *testing.T) { + return func(t *testing.T) { + t.Helper() + ctx, cancel := context.WithCancel(context.Background()) + t.Cleanup(cancel) + + t.Run("DeadlineExceeded", func(t *testing.T) { + innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) + t.Cleanup(innerCancel) + <-innerCtx.Done() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) + }) + + t.Run("Canceled", func(t *testing.T) { + innerCtx, innerCancel := context.WithCancel(ctx) + innerCancel() + + f := factory() + assert.ErrorIs(t, f(innerCtx), context.Canceled) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go new file mode 100644 index 00000000000..e51c6dfd0fb --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go @@ -0,0 +1,78 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest + +import ( + "context" + "testing" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +type client struct { + rCh <-chan ExportResult + storage *Storage +} + +func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { + return metric.DefaultTemporalitySelector(k) +} + +func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { + return metric.DefaultAggregationSelector(k) +} + +func (c *client) Collect() *Storage { + return c.storage +} + +func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) error { + c.storage.Add(&cpb.ExportMetricsServiceRequest{ + ResourceMetrics: []*mpb.ResourceMetrics{rm}, + }) + if c.rCh != nil { + r := <-c.rCh + if r.Response != nil && r.Response.GetPartialSuccess() != nil { + msg := r.Response.GetPartialSuccess().GetErrorMessage() + n := r.Response.GetPartialSuccess().GetRejectedDataPoints() + if msg != "" || n > 0 { + otel.Handle(internal.MetricPartialSuccessError(n, msg)) + } + } + return r.Err + } + return ctx.Err() +} + +func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } +func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } + +func TestClientTests(t *testing.T) { + factory := func(rCh <-chan ExportResult) (Client, Collector) { + c := &client{rCh: rCh, storage: NewStorage()} + return c, c + } + + t.Run("Integration", RunClientTests(factory)) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go new file mode 100644 index 00000000000..0b6b9387167 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go @@ -0,0 +1,438 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/otest/collector.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/rand" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" // nolint:depguard // This is for testing. + "encoding/pem" + "errors" + "fmt" + "io" + "math/big" + "net" + "net/http" + "net/url" + "sync" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + "google.golang.org/protobuf/proto" + + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" + collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +// Collector is the collection target a Client sends metric uploads to. +type Collector interface { + Collect() *Storage +} + +type ExportResult struct { + Response *collpb.ExportMetricsServiceResponse + Err error +} + +// Storage stores uploaded OTLP metric data in their proto form. +type Storage struct { + dataMu sync.Mutex + data []*mpb.ResourceMetrics +} + +// NewStorage returns a configure storage ready to store received requests. +func NewStorage() *Storage { + return &Storage{} +} + +// Add adds the request to the Storage. +func (s *Storage) Add(request *collpb.ExportMetricsServiceRequest) { + s.dataMu.Lock() + defer s.dataMu.Unlock() + s.data = append(s.data, request.ResourceMetrics...) +} + +// Dump returns all added ResourceMetrics and clears the storage. +func (s *Storage) Dump() []*mpb.ResourceMetrics { + s.dataMu.Lock() + defer s.dataMu.Unlock() + + var data []*mpb.ResourceMetrics + data, s.data = s.data, []*mpb.ResourceMetrics{} + return data +} + +// GRPCCollector is an OTLP gRPC server that collects all requests it receives. +type GRPCCollector struct { + collpb.UnimplementedMetricsServiceServer + + headersMu sync.Mutex + headers metadata.MD + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *grpc.Server +} + +// NewGRPCCollector returns a *GRPCCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port. +// +// If errCh is not nil, the collector will respond to Export calls with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewGRPCCollector(endpoint string, resultCh <-chan ExportResult) (*GRPCCollector, error) { + if endpoint == "" { + endpoint = "localhost:0" + } + + c := &GRPCCollector{ + storage: NewStorage(), + resultCh: resultCh, + } + + var err error + c.listener, err = net.Listen("tcp", endpoint) + if err != nil { + return nil, err + } + + c.srv = grpc.NewServer() + collpb.RegisterMetricsServiceServer(c.srv, c) + go func() { _ = c.srv.Serve(c.listener) }() + + return c, nil +} + +// Shutdown shuts down the gRPC server closing all open connections and +// listeners immediately. +func (c *GRPCCollector) Shutdown() { c.srv.Stop() } + +// Addr returns the net.Addr c is listening at. +func (c *GRPCCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *GRPCCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *GRPCCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return metadata.Join(c.headers) +} + +// Export handles the export req. +func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsServiceRequest) (*collpb.ExportMetricsServiceResponse, error) { + c.storage.Add(req) + + if h, ok := metadata.FromIncomingContext(ctx); ok { + c.headersMu.Lock() + c.headers = metadata.Join(c.headers, h) + c.headersMu.Unlock() + } + + if c.resultCh != nil { + r := <-c.resultCh + if r.Response == nil { + return &collpb.ExportMetricsServiceResponse{}, r.Err + } + return r.Response, r.Err + } + return &collpb.ExportMetricsServiceResponse{}, nil +} + +var emptyExportMetricsServiceResponse = func() []byte { + body := collpb.ExportMetricsServiceResponse{} + r, err := proto.Marshal(&body) + if err != nil { + panic(err) + } + return r +}() + +type HTTPResponseError struct { + Err error + Status int + Header http.Header +} + +func (e *HTTPResponseError) Error() string { + return fmt.Sprintf("%d: %s", e.Status, e.Err) +} + +func (e *HTTPResponseError) Unwrap() error { return e.Err } + +// HTTPCollector is an OTLP HTTP server that collects all requests it receives. +type HTTPCollector struct { + headersMu sync.Mutex + headers http.Header + storage *Storage + + resultCh <-chan ExportResult + listener net.Listener + srv *http.Server +} + +// NewHTTPCollector returns a *HTTPCollector that is listening at the provided +// endpoint. +// +// If endpoint is an empty string, the returned collector will be listening on +// the localhost interface at an OS chosen port, not use TLS, and listen at the +// default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains +// a prefix of "https" the server will generate weak self-signed TLS +// certificates and use them to server data. If the endpoint contains a path, +// that path will be used instead of the default OTLP metric endpoint path. +// +// If errCh is not nil, the collector will respond to HTTP requests with errors +// sent on that channel. This means that if errCh is not nil Export calls will +// block until an error is received. +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { + u, err := url.Parse(endpoint) + if err != nil { + return nil, err + } + if u.Host == "" { + u.Host = "localhost:0" + } + if u.Path == "" { + u.Path = oconf.DefaultMetricsPath + } + + c := &HTTPCollector{ + headers: http.Header{}, + storage: NewStorage(), + resultCh: resultCh, + } + + c.listener, err = net.Listen("tcp", u.Host) + if err != nil { + return nil, err + } + + mux := http.NewServeMux() + mux.Handle(u.Path, http.HandlerFunc(c.handler)) + c.srv = &http.Server{Handler: mux} + if u.Scheme == "https" { + cert, err := weakCertificate() + if err != nil { + return nil, err + } + c.srv.TLSConfig = &tls.Config{ + Certificates: []tls.Certificate{cert}, + } + go func() { _ = c.srv.ServeTLS(c.listener, "", "") }() + } else { + go func() { _ = c.srv.Serve(c.listener) }() + } + return c, nil +} + +// Shutdown shuts down the HTTP server closing all open connections and +// listeners. +func (c *HTTPCollector) Shutdown(ctx context.Context) error { + return c.srv.Shutdown(ctx) +} + +// Addr returns the net.Addr c is listening at. +func (c *HTTPCollector) Addr() net.Addr { + return c.listener.Addr() +} + +// Collect returns the Storage holding all collected requests. +func (c *HTTPCollector) Collect() *Storage { + return c.storage +} + +// Headers returns the headers received for all requests. +func (c *HTTPCollector) Headers() map[string][]string { + // Makes a copy. + c.headersMu.Lock() + defer c.headersMu.Unlock() + return c.headers.Clone() +} + +func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { + c.respond(w, c.record(r)) +} + +func (c *HTTPCollector) record(r *http.Request) ExportResult { + // Currently only supports protobuf. + if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { + err := fmt.Errorf("content-type not supported: %s", v) + return ExportResult{Err: err} + } + + body, err := c.readBody(r) + if err != nil { + return ExportResult{Err: err} + } + pbRequest := &collpb.ExportMetricsServiceRequest{} + err = proto.Unmarshal(body, pbRequest) + if err != nil { + return ExportResult{ + Err: &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + }, + } + } + c.storage.Add(pbRequest) + + c.headersMu.Lock() + for k, vals := range r.Header { + for _, v := range vals { + c.headers.Add(k, v) + } + } + c.headersMu.Unlock() + + if c.resultCh != nil { + return <-c.resultCh + } + return ExportResult{Err: err} +} + +func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { + var reader io.ReadCloser + switch r.Header.Get("Content-Encoding") { + case "gzip": + reader, err = gzip.NewReader(r.Body) + if err != nil { + _ = reader.Close() + return nil, &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + default: + reader = r.Body + } + + defer func() { + cErr := reader.Close() + if err == nil && cErr != nil { + err = &HTTPResponseError{ + Err: cErr, + Status: http.StatusInternalServerError, + } + } + }() + body, err = io.ReadAll(reader) + if err != nil { + err = &HTTPResponseError{ + Err: err, + Status: http.StatusInternalServerError, + } + } + return body, err +} + +func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { + if resp.Err != nil { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.Header().Set("X-Content-Type-Options", "nosniff") + var e *HTTPResponseError + if errors.As(resp.Err, &e) { + for k, vals := range e.Header { + for _, v := range vals { + w.Header().Add(k, v) + } + } + w.WriteHeader(e.Status) + fmt.Fprintln(w, e.Error()) + } else { + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintln(w, resp.Err.Error()) + } + return + } + + w.Header().Set("Content-Type", "application/x-protobuf") + w.WriteHeader(http.StatusOK) + if resp.Response == nil { + _, _ = w.Write(emptyExportMetricsServiceResponse) + } else { + r, err := proto.Marshal(resp.Response) + if err != nil { + panic(err) + } + _, _ = w.Write(r) + } +} + +// Based on https://golang.org/src/crypto/tls/generate_cert.go, +// simplified and weakened. +func weakCertificate() (tls.Certificate, error) { + priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) + if err != nil { + return tls.Certificate{}, err + } + notBefore := time.Now() + notAfter := notBefore.Add(time.Hour) + max := new(big.Int).Lsh(big.NewInt(1), 128) + sn, err := rand.Int(rand.Reader, max) + if err != nil { + return tls.Certificate{}, err + } + tmpl := x509.Certificate{ + SerialNumber: sn, + Subject: pkix.Name{Organization: []string{"otel-go"}}, + NotBefore: notBefore, + NotAfter: notAfter, + KeyUsage: x509.KeyUsageDigitalSignature, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + BasicConstraintsValid: true, + DNSNames: []string{"localhost"}, + IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, + } + derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) + if err != nil { + return tls.Certificate{}, err + } + var certBuf bytes.Buffer + err = pem.Encode(&certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) + if err != nil { + return tls.Certificate{}, err + } + privBytes, err := x509.MarshalPKCS8PrivateKey(priv) + if err != nil { + return tls.Certificate{}, err + } + var privBuf bytes.Buffer + err = pem.Encode(&privBuf, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) + if err != nil { + return tls.Certificate{}, err + } + return tls.X509KeyPair(certBuf.Bytes(), privBuf.Bytes()) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess.go new file mode 100644 index 00000000000..584785778ac --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess.go @@ -0,0 +1,67 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" + +import "fmt" + +// PartialSuccess represents the underlying error for all handling +// OTLP partial success messages. Use `errors.Is(err, +// PartialSuccess{})` to test whether an error passed to the OTel +// error handler belongs to this category. +type PartialSuccess struct { + ErrorMessage string + RejectedItems int64 + RejectedKind string +} + +var _ error = PartialSuccess{} + +// Error implements the error interface. +func (ps PartialSuccess) Error() string { + msg := ps.ErrorMessage + if msg == "" { + msg = "empty message" + } + return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) +} + +// Is supports the errors.Is() interface. +func (ps PartialSuccess) Is(err error) bool { + _, ok := err.(PartialSuccess) + return ok +} + +// TracePartialSuccessError returns an error describing a partial success +// response for the trace signal. +func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "spans", + } +} + +// MetricPartialSuccessError returns an error describing a partial success +// response for the metric signal. +func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { + return PartialSuccess{ + ErrorMessage: errorMessage, + RejectedItems: itemsRejected, + RejectedKind: "metric data points", + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess_test.go new file mode 100644 index 00000000000..c385c4d428e --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/partialsuccess_test.go @@ -0,0 +1,46 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/partialsuccess_test.go + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal + +import ( + "errors" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func requireErrorString(t *testing.T, expect string, err error) { + t.Helper() + require.NotNil(t, err) + require.Error(t, err) + require.True(t, errors.Is(err, PartialSuccess{})) + + const pfx = "OTLP partial success: " + + msg := err.Error() + require.True(t, strings.HasPrefix(msg, pfx)) + require.Equal(t, expect, msg[len(pfx):]) +} + +func TestPartialSuccessFormat(t *testing.T) { + requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) + requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) + requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) + requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry.go new file mode 100644 index 00000000000..c8d2a6ddfc7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry.go @@ -0,0 +1,156 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package retry provides request retry functionality that can perform +// configurable exponential backoff for transient errors and honor any +// explicit throttle responses received. +package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" +) + +// DefaultConfig are the recommended defaults to use. +var DefaultConfig = Config{ + Enabled: true, + InitialInterval: 5 * time.Second, + MaxInterval: 30 * time.Second, + MaxElapsedTime: time.Minute, +} + +// Config defines configuration for retrying batches in case of export failure +// using an exponential backoff. +type Config struct { + // Enabled indicates whether to not retry sending batches in case of + // export failure. + Enabled bool + // InitialInterval the time to wait after the first failure before + // retrying. + InitialInterval time.Duration + // MaxInterval is the upper bound on backoff interval. Once this value is + // reached the delay between consecutive retries will always be + // `MaxInterval`. + MaxInterval time.Duration + // MaxElapsedTime is the maximum amount of time (including retries) spent + // trying to send a request/batch. Once this value is reached, the data + // is discarded. + MaxElapsedTime time.Duration +} + +// RequestFunc wraps a request with retry logic. +type RequestFunc func(context.Context, func(context.Context) error) error + +// EvaluateFunc returns if an error is retry-able and if an explicit throttle +// duration should be honored that was included in the error. +// +// The function must return true if the error argument is retry-able, +// otherwise it must return false for the first return parameter. +// +// The function must return a non-zero time.Duration if the error contains +// explicit throttle duration that should be honored, otherwise it must return +// a zero valued time.Duration. +type EvaluateFunc func(error) (bool, time.Duration) + +// RequestFunc returns a RequestFunc using the evaluate function to determine +// if requests can be retried and based on the exponential backoff +// configuration of c. +func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { + if !c.Enabled { + return func(ctx context.Context, fn func(context.Context) error) error { + return fn(ctx) + } + } + + return func(ctx context.Context, fn func(context.Context) error) error { + // Do not use NewExponentialBackOff since it calls Reset and the code here + // must call Reset after changing the InitialInterval (this saves an + // unnecessary call to Now). + b := &backoff.ExponentialBackOff{ + InitialInterval: c.InitialInterval, + RandomizationFactor: backoff.DefaultRandomizationFactor, + Multiplier: backoff.DefaultMultiplier, + MaxInterval: c.MaxInterval, + MaxElapsedTime: c.MaxElapsedTime, + Stop: backoff.Stop, + Clock: backoff.SystemClock, + } + b.Reset() + + for { + err := fn(ctx) + if err == nil { + return nil + } + + retryable, throttle := evaluate(err) + if !retryable { + return err + } + + bOff := b.NextBackOff() + if bOff == backoff.Stop { + return fmt.Errorf("max retry time elapsed: %w", err) + } + + // Wait for the greater of the backoff or throttle delay. + var delay time.Duration + if bOff > throttle { + delay = bOff + } else { + elapsed := b.GetElapsedTime() + if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) + } + delay = throttle + } + + if ctxErr := waitFunc(ctx, delay); ctxErr != nil { + return fmt.Errorf("%w: %s", ctxErr, err) + } + } + } +} + +// Allow override for testing. +var waitFunc = wait + +// wait takes the caller's context, and the amount of time to wait. It will +// return nil if the timer fires before or at the same time as the context's +// deadline. This indicates that the call can be retried. +func wait(ctx context.Context, delay time.Duration) error { + timer := time.NewTimer(delay) + defer timer.Stop() + + select { + case <-ctx.Done(): + // Handle the case where the timer and context deadline end + // simultaneously by prioritizing the timer expiration nil value + // response. + select { + case <-timer.C: + default: + return ctx.Err() + } + case <-timer.C: + } + + return nil +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go new file mode 100644 index 00000000000..9279c7c00ff --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry/retry_test.go @@ -0,0 +1,261 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/retry/retry_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package retry + +import ( + "context" + "errors" + "math" + "sync" + "testing" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/stretchr/testify/assert" +) + +func TestWait(t *testing.T) { + tests := []struct { + ctx context.Context + delay time.Duration + expected error + }{ + { + ctx: context.Background(), + delay: time.Duration(0), + }, + { + ctx: context.Background(), + delay: time.Duration(1), + }, + { + ctx: context.Background(), + delay: time.Duration(-1), + }, + { + ctx: func() context.Context { + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return ctx + }(), + // Ensure the timer and context do not end simultaneously. + delay: 1 * time.Hour, + expected: context.Canceled, + }, + } + + for _, test := range tests { + err := wait(test.ctx, test.delay) + if test.expected == nil { + assert.NoError(t, err) + } else { + assert.ErrorIs(t, err, test.expected) + } + } +} + +func TestNonRetryableError(t *testing.T) { + ev := func(error) (bool, time.Duration) { return false, 0 } + + reqFunc := Config{ + Enabled: true, + InitialInterval: 1 * time.Nanosecond, + MaxInterval: 1 * time.Nanosecond, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestThrottledRetry(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + throttleDelay, backoffDelay := time.Second, time.Nanosecond + + ev := func(error) (bool, time.Duration) { + // Retry everything with a throttle delay. + return true, throttleDelay + } + + reqFunc := Config{ + Enabled: true, + InitialInterval: backoffDelay, + MaxInterval: backoffDelay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, delay time.Duration) error { + assert.Equal(t, throttleDelay, delay, "retry not throttled") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + defer func() { waitFunc = origWait }() + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetry(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 0, + }.RequestFunc(ev) + + origWait := waitFunc + var done bool + waitFunc = func(_ context.Context, d time.Duration) error { + delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) + assert.InDelta(t, delay, d, delta, "retry not backoffed") + // Try twice to ensure call is attempted again after delay. + if done { + return assert.AnError + } + done = true + return nil + } + t.Cleanup(func() { waitFunc = origWait }) + + ctx := context.Background() + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return errors.New("not this error") + }), assert.AnError) +} + +func TestBackoffRetryCanceledContext(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + + delay := time.Millisecond + reqFunc := Config{ + Enabled: true, + InitialInterval: delay, + MaxInterval: delay, + // Never stop retrying. + MaxElapsedTime: 10 * time.Millisecond, + }.RequestFunc(ev) + + ctx, cancel := context.WithCancel(context.Background()) + count := 0 + cancel() + err := reqFunc(ctx, func(context.Context) error { + count++ + return assert.AnError + }) + + assert.ErrorIs(t, err, context.Canceled) + assert.Contains(t, err.Error(), assert.AnError.Error()) + assert.Equal(t, 1, count) +} + +func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { + // Ensure the throttle delay is used by making longer than backoff delay. + tDelay, bDelay := time.Hour, time.Nanosecond + ev := func(error) (bool, time.Duration) { return true, tDelay } + reqFunc := Config{ + Enabled: true, + InitialInterval: bDelay, + MaxInterval: bDelay, + MaxElapsedTime: tDelay - (time.Nanosecond), + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time would elapse: ") +} + +func TestMaxElapsedTime(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + delay := time.Nanosecond + reqFunc := Config{ + Enabled: true, + // InitialInterval > MaxElapsedTime means immediate return. + InitialInterval: 2 * delay, + MaxElapsedTime: delay, + }.RequestFunc(ev) + + ctx := context.Background() + assert.Contains(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }).Error(), "max retry time elapsed: ") +} + +func TestRetryNotEnabled(t *testing.T) { + ev := func(error) (bool, time.Duration) { + t.Error("evaluated retry when not enabled") + return false, 0 + } + + reqFunc := Config{}.RequestFunc(ev) + ctx := context.Background() + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + return nil + })) + assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { + return assert.AnError + }), assert.AnError) +} + +func TestRetryConcurrentSafe(t *testing.T) { + ev := func(error) (bool, time.Duration) { return true, 0 } + reqFunc := Config{ + Enabled: true, + }.RequestFunc(ev) + + var wg sync.WaitGroup + ctx := context.Background() + + for i := 1; i < 5; i++ { + wg.Add(1) + + go func() { + defer wg.Done() + + var done bool + assert.NoError(t, reqFunc(ctx, func(context.Context) error { + if !done { + done = true + return assert.AnError + } + + return nil + })) + }() + } + + wg.Wait() +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute.go new file mode 100644 index 00000000000..7fcc144c1cd --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute.go @@ -0,0 +1,155 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform" + +import ( + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +// AttrIter transforms an attribute iterator into OTLP key-values. +func AttrIter(iter attribute.Iterator) []*cpb.KeyValue { + l := iter.Len() + if l == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, l) + for iter.Next() { + out = append(out, KeyValue(iter.Attribute())) + } + return out +} + +// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. +func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue { + if len(attrs) == 0 { + return nil + } + + out := make([]*cpb.KeyValue, 0, len(attrs)) + for _, kv := range attrs { + out = append(out, KeyValue(kv)) + } + return out +} + +// KeyValue transforms an attribute KeyValue into an OTLP key-value. +func KeyValue(kv attribute.KeyValue) *cpb.KeyValue { + return &cpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} +} + +// Value transforms an attribute Value into an OTLP AnyValue. +func Value(v attribute.Value) *cpb.AnyValue { + av := new(cpb.AnyValue) + switch v.Type() { + case attribute.BOOL: + av.Value = &cpb.AnyValue_BoolValue{ + BoolValue: v.AsBool(), + } + case attribute.BOOLSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: boolSliceValues(v.AsBoolSlice()), + }, + } + case attribute.INT64: + av.Value = &cpb.AnyValue_IntValue{ + IntValue: v.AsInt64(), + } + case attribute.INT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: int64SliceValues(v.AsInt64Slice()), + }, + } + case attribute.FLOAT64: + av.Value = &cpb.AnyValue_DoubleValue{ + DoubleValue: v.AsFloat64(), + } + case attribute.FLOAT64SLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: float64SliceValues(v.AsFloat64Slice()), + }, + } + case attribute.STRING: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: v.AsString(), + } + case attribute.STRINGSLICE: + av.Value = &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: stringSliceValues(v.AsStringSlice()), + }, + } + default: + av.Value = &cpb.AnyValue_StringValue{ + StringValue: "INVALID", + } + } + return av +} + +func boolSliceValues(vals []bool) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_BoolValue{ + BoolValue: v, + }, + } + } + return converted +} + +func int64SliceValues(vals []int64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_IntValue{ + IntValue: v, + }, + } + } + return converted +} + +func float64SliceValues(vals []float64) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_DoubleValue{ + DoubleValue: v, + }, + } + } + return converted +} + +func stringSliceValues(vals []string) []*cpb.AnyValue { + converted := make([]*cpb.AnyValue, len(vals)) + for i, v := range vals { + converted[i] = &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{ + StringValue: v, + }, + } + } + return converted +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute_test.go new file mode 100644 index 00000000000..57db7ab797b --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/attribute_test.go @@ -0,0 +1,197 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/attribute_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + cpb "go.opentelemetry.io/proto/otlp/common/v1" +) + +var ( + attrBool = attribute.Bool("bool", true) + attrBoolSlice = attribute.BoolSlice("bool slice", []bool{true, false}) + attrInt = attribute.Int("int", 1) + attrIntSlice = attribute.IntSlice("int slice", []int{-1, 1}) + attrInt64 = attribute.Int64("int64", 1) + attrInt64Slice = attribute.Int64Slice("int64 slice", []int64{-1, 1}) + attrFloat64 = attribute.Float64("float64", 1) + attrFloat64Slice = attribute.Float64Slice("float64 slice", []float64{-1, 1}) + attrString = attribute.String("string", "o") + attrStringSlice = attribute.StringSlice("string slice", []string{"o", "n"}) + attrInvalid = attribute.KeyValue{ + Key: attribute.Key("invalid"), + Value: attribute.Value{}, + } + + valBoolTrue = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: true}} + valBoolFalse = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: false}} + valBoolSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valBoolTrue, valBoolFalse}, + }, + }} + valIntOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: 1}} + valIntNOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: -1}} + valIntSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valIntNOne, valIntOne}, + }, + }} + valDblOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: 1}} + valDblNOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: -1}} + valDblSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valDblNOne, valDblOne}, + }, + }} + valStrO = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "o"}} + valStrN = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "n"}} + valStrSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ + ArrayValue: &cpb.ArrayValue{ + Values: []*cpb.AnyValue{valStrO, valStrN}, + }, + }} + + kvBool = &cpb.KeyValue{Key: "bool", Value: valBoolTrue} + kvBoolSlice = &cpb.KeyValue{Key: "bool slice", Value: valBoolSlice} + kvInt = &cpb.KeyValue{Key: "int", Value: valIntOne} + kvIntSlice = &cpb.KeyValue{Key: "int slice", Value: valIntSlice} + kvInt64 = &cpb.KeyValue{Key: "int64", Value: valIntOne} + kvInt64Slice = &cpb.KeyValue{Key: "int64 slice", Value: valIntSlice} + kvFloat64 = &cpb.KeyValue{Key: "float64", Value: valDblOne} + kvFloat64Slice = &cpb.KeyValue{Key: "float64 slice", Value: valDblSlice} + kvString = &cpb.KeyValue{Key: "string", Value: valStrO} + kvStringSlice = &cpb.KeyValue{Key: "string slice", Value: valStrSlice} + kvInvalid = &cpb.KeyValue{ + Key: "invalid", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "INVALID"}, + }, + } +) + +type attributeTest struct { + name string + in []attribute.KeyValue + want []*cpb.KeyValue +} + +func TestAttributeTransforms(t *testing.T) { + for _, test := range []attributeTest{ + {"nil", nil, nil}, + {"empty", []attribute.KeyValue{}, nil}, + { + "invalid", + []attribute.KeyValue{attrInvalid}, + []*cpb.KeyValue{kvInvalid}, + }, + { + "bool", + []attribute.KeyValue{attrBool}, + []*cpb.KeyValue{kvBool}, + }, + { + "bool slice", + []attribute.KeyValue{attrBoolSlice}, + []*cpb.KeyValue{kvBoolSlice}, + }, + { + "int", + []attribute.KeyValue{attrInt}, + []*cpb.KeyValue{kvInt}, + }, + { + "int slice", + []attribute.KeyValue{attrIntSlice}, + []*cpb.KeyValue{kvIntSlice}, + }, + { + "int64", + []attribute.KeyValue{attrInt64}, + []*cpb.KeyValue{kvInt64}, + }, + { + "int64 slice", + []attribute.KeyValue{attrInt64Slice}, + []*cpb.KeyValue{kvInt64Slice}, + }, + { + "float64", + []attribute.KeyValue{attrFloat64}, + []*cpb.KeyValue{kvFloat64}, + }, + { + "float64 slice", + []attribute.KeyValue{attrFloat64Slice}, + []*cpb.KeyValue{kvFloat64Slice}, + }, + { + "string", + []attribute.KeyValue{attrString}, + []*cpb.KeyValue{kvString}, + }, + { + "string slice", + []attribute.KeyValue{attrStringSlice}, + []*cpb.KeyValue{kvStringSlice}, + }, + { + "all", + []attribute.KeyValue{ + attrBool, + attrBoolSlice, + attrInt, + attrIntSlice, + attrInt64, + attrInt64Slice, + attrFloat64, + attrFloat64Slice, + attrString, + attrStringSlice, + attrInvalid, + }, + []*cpb.KeyValue{ + kvBool, + kvBoolSlice, + kvInt, + kvIntSlice, + kvInt64, + kvInt64Slice, + kvFloat64, + kvFloat64Slice, + kvString, + kvStringSlice, + kvInvalid, + }, + }, + } { + t.Run(test.name, func(t *testing.T) { + t.Run("KeyValues", func(t *testing.T) { + assert.ElementsMatch(t, test.want, KeyValues(test.in)) + }) + t.Run("AttrIter", func(t *testing.T) { + s := attribute.NewSet(test.in...) + assert.ElementsMatch(t, test.want, AttrIter(s.Iter())) + }) + }) + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error.go new file mode 100644 index 00000000000..0b5446e4d07 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error.go @@ -0,0 +1,114 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform" + +import ( + "errors" + "fmt" + "strings" + + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" +) + +var ( + errUnknownAggregation = errors.New("unknown aggregation") + errUnknownTemporality = errors.New("unknown temporality") +) + +type errMetric struct { + m *mpb.Metric + err error +} + +func (e errMetric) Unwrap() error { + return e.err +} + +func (e errMetric) Error() string { + format := "invalid metric (name: %q, description: %q, unit: %q): %s" + return fmt.Sprintf(format, e.m.Name, e.m.Description, e.m.Unit, e.err) +} + +func (e errMetric) Is(target error) bool { + return errors.Is(e.err, target) +} + +// multiErr is used by the data-type transform functions to wrap multiple +// errors into a single return value. The error message will show all errors +// as a list and scope them by the datatype name that is returning them. +type multiErr struct { + datatype string + errs []error +} + +// errOrNil returns nil if e contains no errors, otherwise it returns e. +func (e *multiErr) errOrNil() error { + if len(e.errs) == 0 { + return nil + } + return e +} + +// append adds err to e. If err is a multiErr, its errs are flattened into e. +func (e *multiErr) append(err error) { + // Do not use errors.As here, this should only be flattened one layer. If + // there is a *multiErr several steps down the chain, all the errors above + // it will be discarded if errors.As is used instead. + switch other := err.(type) { + case *multiErr: + // Flatten err errors into e. + e.errs = append(e.errs, other.errs...) + default: + e.errs = append(e.errs, err) + } +} + +func (e *multiErr) Error() string { + es := make([]string, len(e.errs)) + for i, err := range e.errs { + es[i] = fmt.Sprintf("* %s", err) + } + + format := "%d errors occurred transforming %s:\n\t%s" + return fmt.Sprintf(format, len(es), e.datatype, strings.Join(es, "\n\t")) +} + +func (e *multiErr) Unwrap() error { + switch len(e.errs) { + case 0: + return nil + case 1: + return e.errs[0] + } + + // Return a multiErr without the leading error. + cp := &multiErr{ + datatype: e.datatype, + errs: make([]error, len(e.errs)-1), + } + copy(cp.errs, e.errs[1:]) + return cp +} + +func (e *multiErr) Is(target error) bool { + if len(e.errs) == 0 { + return false + } + // Check if the first error is target. + return errors.Is(e.errs[0], target) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error_test.go new file mode 100644 index 00000000000..03e16ef8f14 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/error_test.go @@ -0,0 +1,91 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/error_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var ( + e0 = errMetric{m: pbMetrics[0], err: errUnknownAggregation} + e1 = errMetric{m: pbMetrics[1], err: errUnknownTemporality} +) + +type testingErr struct{} + +func (testingErr) Error() string { return "testing error" } + +// errFunc is a non-comparable error type. +type errFunc func() string + +func (e errFunc) Error() string { + return e() +} + +func TestMultiErr(t *testing.T) { + const name = "TestMultiErr" + me := &multiErr{datatype: name} + + t.Run("ErrOrNil", func(t *testing.T) { + require.Nil(t, me.errOrNil()) + me.errs = []error{e0} + assert.Error(t, me.errOrNil()) + }) + + var testErr testingErr + t.Run("AppendError", func(t *testing.T) { + me.append(testErr) + assert.Equal(t, testErr, me.errs[len(me.errs)-1]) + }) + + t.Run("AppendFlattens", func(t *testing.T) { + other := &multiErr{datatype: "OtherTestMultiErr", errs: []error{e1}} + me.append(other) + assert.Equal(t, e1, me.errs[len(me.errs)-1]) + }) + + t.Run("ErrorMessage", func(t *testing.T) { + // Test the overall structure of the message, but not the exact + // language so this doesn't become a change-indicator. + msg := me.Error() + lines := strings.Split(msg, "\n") + assert.Equalf(t, 4, len(lines), "expected a 4 line error message, got:\n\n%s", msg) + assert.Contains(t, msg, name) + assert.Contains(t, msg, e0.Error()) + assert.Contains(t, msg, testErr.Error()) + assert.Contains(t, msg, e1.Error()) + }) + + t.Run("ErrorIs", func(t *testing.T) { + assert.ErrorIs(t, me, errUnknownAggregation) + assert.ErrorIs(t, me, e0) + assert.ErrorIs(t, me, testErr) + assert.ErrorIs(t, me, errUnknownTemporality) + assert.ErrorIs(t, me, e1) + + errUnknown := errFunc(func() string { return "unknown error" }) + assert.NotErrorIs(t, me, errUnknown) + + var empty multiErr + assert.NotErrorIs(t, &empty, errUnknownTemporality) + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go new file mode 100644 index 00000000000..985fcfc6437 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go @@ -0,0 +1,292 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package transform provides transformation functionality from the +// sdk/metric/metricdata data-types into OTLP data-types. +package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform" + +import ( + "fmt" + "time" + + "go.opentelemetry.io/otel/sdk/metric/metricdata" + cpb "go.opentelemetry.io/proto/otlp/common/v1" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" + rpb "go.opentelemetry.io/proto/otlp/resource/v1" +) + +// ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm +// contains invalid ScopeMetrics, an error will be returned along with an OTLP +// ResourceMetrics that contains partial OTLP ScopeMetrics. +func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { + sms, err := ScopeMetrics(rm.ScopeMetrics) + return &mpb.ResourceMetrics{ + Resource: &rpb.Resource{ + Attributes: AttrIter(rm.Resource.Iter()), + }, + ScopeMetrics: sms, + SchemaUrl: rm.Resource.SchemaURL(), + }, err +} + +// ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If +// sms contains invalid metric values, an error will be returned along with a +// slice that contains partial OTLP ScopeMetrics. +func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error) { + errs := &multiErr{datatype: "ScopeMetrics"} + out := make([]*mpb.ScopeMetrics, 0, len(sms)) + for _, sm := range sms { + ms, err := Metrics(sm.Metrics) + if err != nil { + errs.append(err) + } + + out = append(out, &mpb.ScopeMetrics{ + Scope: &cpb.InstrumentationScope{ + Name: sm.Scope.Name, + Version: sm.Scope.Version, + }, + Metrics: ms, + SchemaUrl: sm.Scope.SchemaURL, + }) + } + return out, errs.errOrNil() +} + +// Metrics returns a slice of OTLP Metric generated from ms. If ms contains +// invalid metric values, an error will be returned along with a slice that +// contains partial OTLP Metrics. +func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error) { + errs := &multiErr{datatype: "Metrics"} + out := make([]*mpb.Metric, 0, len(ms)) + for _, m := range ms { + o, err := metric(m) + if err != nil { + // Do not include invalid data. Drop the metric, report the error. + errs.append(errMetric{m: o, err: err}) + continue + } + out = append(out, o) + } + return out, errs.errOrNil() +} + +func metric(m metricdata.Metrics) (*mpb.Metric, error) { + var err error + out := &mpb.Metric{ + Name: m.Name, + Description: m.Description, + Unit: string(m.Unit), + } + switch a := m.Data.(type) { + case metricdata.Gauge[int64]: + out.Data = Gauge[int64](a) + case metricdata.Gauge[float64]: + out.Data = Gauge[float64](a) + case metricdata.Sum[int64]: + out.Data, err = Sum[int64](a) + case metricdata.Sum[float64]: + out.Data, err = Sum[float64](a) + case metricdata.Histogram[int64]: + out.Data, err = Histogram(a) + case metricdata.Histogram[float64]: + out.Data, err = Histogram(a) + case metricdata.ExponentialHistogram[int64]: + out.Data, err = ExponentialHistogram(a) + case metricdata.ExponentialHistogram[float64]: + out.Data, err = ExponentialHistogram(a) + default: + return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) + } + return out, err +} + +// Gauge returns an OTLP Metric_Gauge generated from g. +func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { + return &mpb.Metric_Gauge{ + Gauge: &mpb.Gauge{ + DataPoints: DataPoints(g.DataPoints), + }, + } +} + +// Sum returns an OTLP Metric_Sum generated from s. An error is returned +// if the temporality of s is unknown. +func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { + t, err := Temporality(s.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Sum{ + Sum: &mpb.Sum{ + AggregationTemporality: t, + IsMonotonic: s.IsMonotonic, + DataPoints: DataPoints(s.DataPoints), + }, + }, nil +} + +// DataPoints returns a slice of OTLP NumberDataPoint generated from dPts. +func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint { + out := make([]*mpb.NumberDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + ndp := &mpb.NumberDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + } + switch v := any(dPt.Value).(type) { + case int64: + ndp.Value = &mpb.NumberDataPoint_AsInt{ + AsInt: v, + } + case float64: + ndp.Value = &mpb.NumberDataPoint_AsDouble{ + AsDouble: v, + } + } + out = append(out, ndp) + } + return out +} + +// Histogram returns an OTLP Metric_Histogram generated from h. An error is +// returned if the temporality of h is unknown. +func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_Histogram{ + Histogram: &mpb.Histogram{ + AggregationTemporality: t, + DataPoints: HistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated +// from dPts. +func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { + out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + hdp := &mpb.HistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + BucketCounts: dPt.BucketCounts, + ExplicitBounds: dPt.Bounds, + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + hdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + hdp.Max = &vF64 + } + out = append(out, hdp) + } + return out +} + +// ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is +// returned if the temporality of h is unknown. +func ExponentialHistogram[N int64 | float64](h metricdata.ExponentialHistogram[N]) (*mpb.Metric_ExponentialHistogram, error) { + t, err := Temporality(h.Temporality) + if err != nil { + return nil, err + } + return &mpb.Metric_ExponentialHistogram{ + ExponentialHistogram: &mpb.ExponentialHistogram{ + AggregationTemporality: t, + DataPoints: ExponentialHistogramDataPoints(h.DataPoints), + }, + }, nil +} + +// ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated +// from dPts. +func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint { + out := make([]*mpb.ExponentialHistogramDataPoint, 0, len(dPts)) + for _, dPt := range dPts { + sum := float64(dPt.Sum) + ehdp := &mpb.ExponentialHistogramDataPoint{ + Attributes: AttrIter(dPt.Attributes.Iter()), + StartTimeUnixNano: timeUnixNano(dPt.StartTime), + TimeUnixNano: timeUnixNano(dPt.Time), + Count: dPt.Count, + Sum: &sum, + Scale: dPt.Scale, + ZeroCount: dPt.ZeroCount, + + Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), + Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), + } + if v, ok := dPt.Min.Value(); ok { + vF64 := float64(v) + ehdp.Min = &vF64 + } + if v, ok := dPt.Max.Value(); ok { + vF64 := float64(v) + ehdp.Max = &vF64 + } + out = append(out, ehdp) + } + return out +} + +// ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated +// from bucket. +func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets { + return &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: bucket.Offset, + BucketCounts: bucket.Counts, + } +} + +// Temporality returns an OTLP AggregationTemporality generated from t. If t +// is unknown, an error is returned along with the invalid +// AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. +func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { + switch t { + case metricdata.DeltaTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, nil + case metricdata.CumulativeTemporality: + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, nil + default: + err := fmt.Errorf("%w: %s", errUnknownTemporality, t) + return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err + } +} + +// timeUnixNano returns t as a Unix time, the number of nanoseconds elapsed +// since January 1, 1970 UTC as uint64. +// The result is undefined if the Unix time +// in nanoseconds cannot be represented by an int64 +// (a date before the year 1678 or after 2262). +// timeUnixNano on the zero Time returns 0. +// The result does not depend on the location associated with t. +func timeUnixNano(t time.Time) uint64 { + if t.IsZero() { + return 0 + } + return uint64(t.UnixNano()) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go new file mode 100644 index 00000000000..95dca158be7 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go @@ -0,0 +1,633 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package transform + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "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.17.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" +) + +type unknownAggT struct { + metricdata.Aggregation +} + +var ( + // Sat Jan 01 2000 00:00:00 GMT+0000. + start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + end = start.Add(30 * time.Second) + + alice = attribute.NewSet(attribute.String("user", "alice")) + bob = attribute.NewSet(attribute.String("user", "bob")) + + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, + }} + pbBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, + }} + + minA, maxA, sumA = 2.0, 4.0, 90.0 + minB, maxB, sumB = 4.0, 150.0, 234.0 + otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Bounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + otelEBucketA = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketB = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 5, 0, 5}, + } + otelEBucketsC = metricdata.ExponentialBucket{ + Offset: 5, + Counts: []uint64{0, 1}, + } + otelEBucketsD = metricdata.ExponentialBucket{ + Offset: 3, + Counts: []uint64{0, 1}, + } + + otelEHDPInt64 = []metricdata.ExponentialHistogramDataPoint[int64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(int64(minA)), + Max: metricdata.NewExtrema(int64(maxA)), + Sum: int64(sumA), + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(int64(minB)), + Max: metricdata.NewExtrema(int64(maxB)), + Sum: int64(sumB), + }, + } + otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ + { + Attributes: alice, + StartTime: start, + Time: end, + Count: 30, + Scale: 2, + ZeroCount: 10, + PositiveBucket: otelEBucketA, + NegativeBucket: otelEBucketB, + ZeroThreshold: .01, + Min: metricdata.NewExtrema(minA), + Max: metricdata.NewExtrema(maxA), + Sum: sumA, + }, { + Attributes: bob, + StartTime: start, + Time: end, + Count: 3, + Scale: 4, + ZeroCount: 1, + PositiveBucket: otelEBucketsC, + NegativeBucket: otelEBucketsD, + ZeroThreshold: .02, + Min: metricdata.NewExtrema(minB), + Max: metricdata.NewExtrema(maxB), + Sum: sumB, + }, + } + + pbHDP = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + }, + } + + pbEHDPBA = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBB = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 5, 0, 5}, + } + pbEHDPBC = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 5, + BucketCounts: []uint64{0, 1}, + } + pbEHDPBD = &mpb.ExponentialHistogramDataPoint_Buckets{ + Offset: 3, + BucketCounts: []uint64{0, 1}, + } + + pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + }, + } + + otelHistInt64 = metricdata.Histogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPInt64, + } + otelHistFloat64 = metricdata.Histogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelHDPFloat64, + } + invalidTemporality metricdata.Temporality + otelHistInvalid = metricdata.Histogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelHDPInt64, + } + + otelExpoHistInt64 = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPInt64, + } + otelExpoHistFloat64 = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: otelEHDPFloat64, + } + otelExpoHistInvalid = metricdata.ExponentialHistogram[int64]{ + Temporality: invalidTemporality, + DataPoints: otelEHDPInt64, + } + + pbHist = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDP, + } + + pbExpoHist = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDP, + } + + otelDPtsInt64 = []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1}, + {Attributes: bob, StartTime: start, Time: end, Value: 2}, + } + otelDPtsFloat64 = []metricdata.DataPoint[float64]{ + {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, + {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + } + + pbDPtsInt64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + }, + } + pbDPtsFloat64 = []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + }, + { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + }, + } + + otelSumInt64 = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: otelDPtsInt64, + } + otelSumFloat64 = metricdata.Sum[float64]{ + Temporality: metricdata.DeltaTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + otelSumInvalid = metricdata.Sum[float64]{ + Temporality: invalidTemporality, + IsMonotonic: false, + DataPoints: otelDPtsFloat64, + } + + pbSumInt64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, + IsMonotonic: true, + DataPoints: pbDPtsInt64, + } + pbSumFloat64 = &mpb.Sum{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + IsMonotonic: false, + DataPoints: pbDPtsFloat64, + } + + otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} + otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} + otelGaugeZeroStartTime = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + }, + } + + pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} + pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} + pbGaugeZeroStartTime = &mpb.Gauge{DataPoints: []*mpb.NumberDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: 0, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + }, + }} + + unknownAgg unknownAggT + otelMetrics = []metricdata.Metrics{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: otelGaugeInt64, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: otelGaugeFloat64, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: otelSumInt64, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: otelSumFloat64, + }, + { + Name: "invalid-sum", + Description: "Sum with invalid temporality", + Unit: "1", + Data: otelSumInvalid, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistInt64, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: otelHistFloat64, + }, + { + Name: "invalid-histogram", + Description: "Invalid histogram", + Unit: "1", + Data: otelHistInvalid, + }, + { + Name: "unknown", + Description: "Unknown aggregation", + Unit: "1", + Data: unknownAgg, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistInt64, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: otelExpoHistFloat64, + }, + { + Name: "invalid-ExponentialHistogram", + Description: "Invalid Exponential Histogram", + Unit: "1", + Data: otelExpoHistInvalid, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: otelGaugeZeroStartTime, + }, + } + + pbMetrics = []*mpb.Metric{ + { + Name: "int64-gauge", + Description: "Gauge with int64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, + }, + { + Name: "float64-gauge", + Description: "Gauge with float64 values", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, + }, + { + Name: "int64-sum", + Description: "Sum with int64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumInt64}, + }, + { + Name: "float64-sum", + Description: "Sum with float64 values", + Unit: "1", + Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, + }, + { + Name: "int64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "float64-histogram", + Description: "Histogram", + Unit: "1", + Data: &mpb.Metric_Histogram{Histogram: pbHist}, + }, + { + Name: "int64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "float64-ExponentialHistogram", + Description: "Exponential Histogram", + Unit: "1", + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + }, + { + Name: "zero-time", + Description: "Gauge with 0 StartTime", + Unit: "1", + Data: &mpb.Metric_Gauge{Gauge: pbGaugeZeroStartTime}, + }, + } + + otelScopeMetrics = []metricdata.ScopeMetrics{ + { + Scope: instrumentation.Scope{ + Name: "test/code/path", + Version: "v0.1.0", + SchemaURL: semconv.SchemaURL, + }, + Metrics: otelMetrics, + }, + } + + pbScopeMetrics = []*mpb.ScopeMetrics{ + { + Scope: &cpb.InstrumentationScope{ + Name: "test/code/path", + Version: "v0.1.0", + }, + Metrics: pbMetrics, + SchemaUrl: semconv.SchemaURL, + }, + } + + otelRes = resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceName("test server"), + semconv.ServiceVersion("v0.1.0"), + ) + + pbRes = &rpb.Resource{ + Attributes: []*cpb.KeyValue{ + { + Key: "service.name", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, + }, + }, + { + Key: "service.version", + Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, + }, + }, + }, + } + + otelResourceMetrics = &metricdata.ResourceMetrics{ + Resource: otelRes, + ScopeMetrics: otelScopeMetrics, + } + + pbResourceMetrics = &mpb.ResourceMetrics{ + Resource: pbRes, + ScopeMetrics: pbScopeMetrics, + SchemaUrl: semconv.SchemaURL, + } +) + +func TestTransformations(t *testing.T) { + // Run tests from the "bottom-up" of the metricdata data-types and halt + // when a failure occurs to ensure the clearest failure message (as + // opposed to the opposite of testing from the top-down which will obscure + // errors deep inside the structs). + + // DataPoint types. + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) + require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) + + // Aggregations. + h, err := Histogram(otelHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + h, err = Histogram(otelHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, h) + + s, err := Sum[int64](otelSumInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumInt64}, s) + s, err = Sum[float64](otelSumFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumFloat64}, s) + s, err = Sum[float64](otelSumInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, s) + + assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) + require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) + + e, err := ExponentialHistogram(otelExpoHistInt64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistFloat64) + assert.NoError(t, err) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + e, err = ExponentialHistogram(otelExpoHistInvalid) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.Nil(t, e) + + // Metrics. + m, err := Metrics(otelMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbMetrics, m) + + // Scope Metrics. + sm, err := ScopeMetrics(otelScopeMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbScopeMetrics, sm) + + // Resource Metrics. + rm, err := ResourceMetrics(otelResourceMetrics) + assert.ErrorIs(t, err, errUnknownTemporality) + assert.ErrorIs(t, err, errUnknownAggregation) + require.Equal(t, pbResourceMetrics, rm) +} From 196c1f0a83df0607b0973c5b844c948549758459 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 7 Aug 2023 08:58:27 -0700 Subject: [PATCH 639/886] Fix rendered envconfig_test.go file name in otlpmetricgrpc (#4419) --- exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go | 2 +- .../oconf/{envconfig_test.go.tmpl => envconfig_test.go} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/{envconfig_test.go.tmpl => envconfig_test.go} (100%) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go index 01da106579f..06718efa898 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/gen.go @@ -24,7 +24,7 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/o //go:generate gotmpl --body=../../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/envconfig.go -//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl "--data={}" --out=oconf/envconfig_test.go.tmpl +//go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl "--data={}" --out=oconf/envconfig_test.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry\"}" --out=oconf/options.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig\"}" --out=oconf/options_test.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlpmetric/oconf/optiontypes.go.tmpl "--data={}" --out=oconf/optiontypes.go diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go similarity index 100% rename from exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go.tmpl rename to exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go From 9452b9301295edc00b884d0c0c0e7a749b2b7784 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 7 Aug 2023 09:30:40 -0700 Subject: [PATCH 640/886] Upgrade all use of semconv to v1.21.0 (#4408) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Upgrade all use of semconv to v1.21.0 * Add change to changelog * Add AIX and ZOS OS support * Upgrade semconv for merged changes --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + bridge/opentracing/internal/mock.go | 2 +- example/fib/main.go | 2 +- example/jaeger/main.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- exporters/jaeger/jaeger.go | 2 +- exporters/jaeger/jaeger_test.go | 2 +- exporters/otlp/otlpmetric/internal/otest/client.go | 2 +- .../otlp/otlpmetric/internal/transform/metricdata_test.go | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go | 2 +- .../otlpmetricgrpc/internal/transform/metricdata_test.go | 2 +- .../otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go | 2 +- .../otlpmetrichttp/internal/transform/metricdata_test.go | 2 +- exporters/otlp/otlptrace/internal/tracetransform/span_test.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/example_test.go | 2 +- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 2 +- exporters/zipkin/model_test.go | 2 +- exporters/zipkin/zipkin_test.go | 2 +- internal/shared/otlp/otlpmetric/otest/client.go.tmpl | 2 +- .../shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl | 2 +- .../shared/otlp/otlptrace/tracetransform/span_test.go.tmpl | 2 +- sdk/metric/example_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/host_id.go | 2 +- sdk/resource/os.go | 4 +++- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- 38 files changed, 40 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69adae40ccb..e1a59392bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) - `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) ### Fixed diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index bb44e93d1f3..64e95604278 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/fib/main.go b/example/fib/main.go index 6863f7f14f7..7e23b8eda73 100644 --- a/example/fib/main.go +++ b/example/fib/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) // newExporter returns a console exporter. diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 38196ebb59d..58b7e8b510e 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/exporters/jaeger" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) const ( diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index bc6643f4963..21b68d8122e 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 81a16abd4ad..14ec07b58a7 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index ddbd681d00a..9b4a54afc66 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -26,7 +26,7 @@ import ( gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 1b11be79016..6a503b55779 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -35,7 +35,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index 9da08bceec7..f58aa99aeff 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -27,7 +27,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go index 8110f0868fb..e733e7846e0 100644 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go @@ -25,7 +25,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go index e5ae9a660c4..3bb415e441f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go index 95dca158be7..b94c48dae8d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go @@ -28,7 +28,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go index 1f71abecac9..4169c9d964d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go index 95dca158be7..b94c48dae8d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go @@ -28,7 +28,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index df26af006ee..227711a9e34 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -32,7 +32,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 8682bbce30f..56f78af67ef 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 49e4adc754b..05e03fd9621 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestPrometheusExporter(t *testing.T) { diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 0a55dced7d9..a3e7377914f 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -26,7 +26,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) var ( diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 0864fbadeca..5e3a5064568 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -23,7 +23,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index b1beeb70a3a..1ac80c1cb3f 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index a7ee19a3a72..82c812a49d0 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index 9fbe5fe0a4f..eff980b0489 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -38,7 +38,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl index 4934c529e89..6c8be4982e5 100644 --- a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl index 95dca158be7..b94c48dae8d 100644 --- a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl @@ -28,7 +28,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.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" diff --git a/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl index df26af006ee..227711a9e34 100644 --- a/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl +++ b/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl @@ -32,7 +32,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.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 0086dba7687..cf8728deb0f 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func Example() { diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 6296403e36a..4cc1977f986 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index 72320ca51f9..c63a0dd1f8c 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 318dcf82fe2..3d536228283 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index f09a7819067..a847c50622e 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index d8c5a70c86c..85bf9a82f95 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/host_id.go b/sdk/resource/host_id.go index b8e934d4f8a..fb1ebf2cab2 100644 --- a/sdk/resource/host_id.go +++ b/sdk/resource/host_id.go @@ -19,7 +19,7 @@ import ( "errors" "strings" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type hostIDProvider func() (string, error) diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 815fe5c2041..84e1c585605 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type osDescriptionProvider func() (string, error) @@ -75,6 +75,7 @@ func mapRuntimeOSToSemconvOSType(osType string) attribute.KeyValue { // the elements in this map are the intersection between // available GOOS values and defined semconv OS types osTypeAttributeMap := map[string]attribute.KeyValue{ + "aix": semconv.OSTypeAIX, "darwin": semconv.OSTypeDarwin, "dragonfly": semconv.OSTypeDragonflyBSD, "freebsd": semconv.OSTypeFreeBSD, @@ -83,6 +84,7 @@ func mapRuntimeOSToSemconvOSType(osType string) attribute.KeyValue { "openbsd": semconv.OSTypeOpenBSD, "solaris": semconv.OSTypeSolaris, "windows": semconv.OSTypeWindows, + "zos": semconv.OSTypeZOS, } var osTypeAttribute attribute.KeyValue diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 5ba33cc6894..8c42fb6e9e3 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index bdd0e7fe680..e67ff29e26d 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) type pidProvider func() int diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 7cdd358caaa..b59b093422b 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -31,7 +31,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 4fcca26e088..37cdd4a694a 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 912a44751da..d693d5c238c 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) From e1e6b96647203dbc2626829d418846d46ca027ed Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 7 Aug 2023 13:12:57 -0400 Subject: [PATCH 641/886] do not append _total if the metric already ends in _total (#4373) --- CHANGELOG.md | 1 + exporters/prometheus/exporter.go | 42 +++++++++++++++------------ exporters/prometheus/exporter_test.go | 29 ++++++++++++++++++ 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a59392bcf..ccb9399c7e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) +- Do not append _total if the counter already ends in total `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 4007f8915b2..81b12254f85 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -189,10 +189,11 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { } for _, m := range scopeMetrics.Metrics { - typ, name := c.metricTypeAndName(m) + typ := c.metricType(m) if typ == nil { continue } + name := c.getName(m, typ) drop, help := c.validateMetrics(name, m.Description, typ) if drop { @@ -366,17 +367,23 @@ var unitSuffixes = map[string]string{ } // getName returns the sanitized name, prefixed with the namespace and suffixed with unit. -func (c *collector) getName(m metricdata.Metrics) string { +func (c *collector) getName(m metricdata.Metrics, typ *dto.MetricType) string { name := sanitizeName(m.Name) + addCounterSuffix := !c.withoutCounterSuffixes && *typ == dto.MetricType_COUNTER + if addCounterSuffix { + // Remove the _total suffix here, as we will re-add the total suffix + // later, and it needs to come after the unit suffix. + name = strings.TrimSuffix(name, counterSuffix) + } if c.namespace != "" { name = c.namespace + name } - if c.withoutUnits { - return name - } - if suffix, ok := unitSuffixes[m.Unit]; ok && !strings.HasSuffix(name, suffix) { + if suffix, ok := unitSuffixes[m.Unit]; ok && !c.withoutUnits && !strings.HasSuffix(name, suffix) { name += suffix } + if addCounterSuffix { + name += counterSuffix + } return name } @@ -433,27 +440,24 @@ func sanitizeName(n string) string { return b.String() } -func (c *collector) metricTypeAndName(m metricdata.Metrics) (*dto.MetricType, string) { - name := c.getName(m) - +func (c *collector) metricType(m metricdata.Metrics) *dto.MetricType { switch v := m.Data.(type) { case metricdata.Histogram[int64], metricdata.Histogram[float64]: - return dto.MetricType_HISTOGRAM.Enum(), name + return dto.MetricType_HISTOGRAM.Enum() case metricdata.Sum[float64]: - if v.IsMonotonic && !c.withoutCounterSuffixes { - return dto.MetricType_COUNTER.Enum(), name + counterSuffix + if v.IsMonotonic { + return dto.MetricType_COUNTER.Enum() } - return dto.MetricType_GAUGE.Enum(), name + return dto.MetricType_GAUGE.Enum() case metricdata.Sum[int64]: - if v.IsMonotonic && !c.withoutCounterSuffixes { - return dto.MetricType_COUNTER.Enum(), name + counterSuffix + if v.IsMonotonic { + return dto.MetricType_COUNTER.Enum() } - return dto.MetricType_GAUGE.Enum(), name + return dto.MetricType_GAUGE.Enum() case metricdata.Gauge[int64], metricdata.Gauge[float64]: - return dto.MetricType_GAUGE.Enum(), name + return dto.MetricType_GAUGE.Enum() } - - return nil, "" + return nil } func (c *collector) scopeInfo(scope instrumentation.Scope) (prometheus.Metric, error) { diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 05e03fd9621..3c96983a918 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -100,6 +100,35 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) }, }, + { + name: "counter that already has a total suffix", + expectedFile: "testdata/counter.txt", + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter, err := meter.Float64Counter( + "foo.total", + otelmetric.WithDescription("a simple counter"), + otelmetric.WithUnit("s"), + ) + require.NoError(t, err) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.3, opt) + counter.Add(ctx, 9, opt) + + attrs2 := attribute.NewSet( + attribute.Key("A").String("D"), + attribute.Key("C").String("B"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter.Add(ctx, 5, otelmetric.WithAttributeSet(attrs2)) + }, + }, { name: "counter with suffixes disabled", expectedFile: "testdata/counter_disabled_suffix.txt", From b221025a4cf87778f28ea0879ef5bcf29a3c849d Mon Sep 17 00:00:00 2001 From: Jared Jenkins Date: Mon, 7 Aug 2023 12:22:48 -0500 Subject: [PATCH 642/886] sdk/resource: Fix data race with emptyAttributes (#4409) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix ASAN bug with emptyAttributes. If mutliple instantiations of a Resources struct are happening in parallel, they can end up modifying the same underlying resource. * Capture literal * add test * remove unwanted change * Update sdk/resource/resource_test.go Co-authored-by: Robert Pająk * Update sdk/resource/resource_test.go Co-authored-by: Robert Pająk * Update sdk/resource/resource_test.go Co-authored-by: Robert Pająk * Update sdk/resource/resource_test.go Co-authored-by: Robert Pająk * Add changelog. * Update CHANGELOG.md Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/resource/resource.go | 9 ++++----- sdk/resource/resource_test.go | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb9399c7e5..5194b363501 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) - Do not append _total if the counter already ends in total `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) +- Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 139dc7e8f92..176ff106668 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -36,7 +36,6 @@ type Resource struct { } var ( - emptyResource Resource defaultResource *Resource defaultResourceOnce sync.Once ) @@ -70,7 +69,7 @@ func NewWithAttributes(schemaURL string, attrs ...attribute.KeyValue) *Resource // of the attrs is known use NewWithAttributes instead. func NewSchemaless(attrs ...attribute.KeyValue) *Resource { if len(attrs) == 0 { - return &emptyResource + return &Resource{} } // Ensure attributes comply with the specification: @@ -81,7 +80,7 @@ func NewSchemaless(attrs ...attribute.KeyValue) *Resource { // If attrs only contains invalid entries do not allocate a new resource. if s.Len() == 0 { - return &emptyResource + return &Resource{} } return &Resource{attrs: s} //nolint @@ -195,7 +194,7 @@ func Merge(a, b *Resource) (*Resource, error) { // Empty returns an instance of Resource with no attributes. It is // equivalent to a `nil` Resource. func Empty() *Resource { - return &emptyResource + return &Resource{} } // Default returns an instance of Resource with a default @@ -214,7 +213,7 @@ func Default() *Resource { } // If Detect did not return a valid resource, fall back to emptyResource. if defaultResource == nil { - defaultResource = &emptyResource + defaultResource = &Resource{} } }) return defaultResource diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index b59b093422b..34d45b99c0f 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -21,6 +21,7 @@ import ( "fmt" "os" "strings" + "sync" "testing" "github.com/google/go-cmp/cmp" @@ -769,3 +770,29 @@ func TestWithContainer(t *testing.T) { string(semconv.ContainerIDKey): fakeContainerID, }, toMap(res)) } + +func TestResourceConcurrentSafe(t *testing.T) { + // Creating Resources should also be free of any data races, + // because Resources are immutable. + var wg sync.WaitGroup + for i := 0; i < 2; i++ { + wg.Add(1) + go func() { + defer wg.Done() + d := &fakeDetector{} + _, err := resource.Detect(context.Background(), d) + assert.NoError(t, err) + }() + } + wg.Wait() +} + +type fakeDetector struct{} + +func (f fakeDetector) Detect(_ context.Context) (*resource.Resource, error) { + // A bit pedantic, but resource.NewWithAttributes returns an empty Resource when + // no attributes specified. We want to make sure that this is concurrent-safe. + return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0"), nil +} + +var _ resource.Detector = &fakeDetector{} From 10099bb87626c0e91c210b944a553455c20f6f08 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 7 Aug 2023 19:32:44 +0200 Subject: [PATCH 643/886] Handle 2xx as success for OTLP HTTP trace and metric exporters (#4365) * handle no content responses for otlpmetric exporter * handle no content responses for otlptraces http exporter * add changelog entry * add a ResponseStatus attribute rather than using error * accept any status code between 200 and 299 * rename i to code * switch require to assert * shutdown the client in defer --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + .../otlp/otlpmetric/internal/otest/client.go | 28 +++++++++++++++++ .../otlpmetric/internal/otest/collector.go | 11 +++++-- .../otlp/otlpmetric/otlpmetrichttp/client.go | 7 ++--- .../otlp/otlptrace/otlptracehttp/client.go | 6 ++-- .../otlptrace/otlptracehttp/client_test.go | 31 +++++++++++++++++++ 6 files changed, 74 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5194b363501..4bf29bc4b0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add info and debug logging to the metric SDK. (#4315) - The `go.opentelemetry.io/otel/semconv/v1.21.0` package. The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) +- Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) - Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) - Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index f58aa99aeff..a315869c17d 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -272,6 +272,34 @@ func RunClientTests(f ClientFactory) func(*testing.T) { want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) assert.ErrorContains(t, errs[0], want) }) + + t.Run("Other HTTP success", func(t *testing.T) { + for code := 201; code <= 299; code++ { + t.Run(fmt.Sprintf("status_%d", code), func(t *testing.T) { + rCh := make(chan ExportResult, 1) + rCh <- ExportResult{ + ResponseStatus: code, + } + + ctx := context.Background() + client, _ := f(rCh) + defer func() { + assert.NoError(t, client.Shutdown(ctx)) + }() + + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + + assert.NoError(t, client.UploadMetrics(ctx, nil)) + assert.Equal(t, 0, len(errs)) + }) + } + }) } } diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index 95e757daef1..34756f4ccf5 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -50,8 +50,9 @@ type Collector interface { } type ExportResult struct { - Response *collpb.ExportMetricsServiceResponse - Err error + Response *collpb.ExportMetricsServiceResponse + ResponseStatus int + Err error } // Storage stores uploaded OTLP metric data in their proto form. @@ -376,7 +377,11 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { } w.Header().Set("Content-Type", "application/x-protobuf") - w.WriteHeader(http.StatusOK) + if resp.ResponseStatus != 0 { + w.WriteHeader(resp.ResponseStatus) + } else { + w.WriteHeader(http.StatusOK) + } if resp.Response == nil { _, _ = w.Write(emptyExportMetricsServiceResponse) } else { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index ac7023c7ae6..33f5474c1aa 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -153,8 +153,8 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou } var rErr error - switch resp.StatusCode { - case http.StatusOK: + switch sc := resp.StatusCode; { + case sc >= 200 && sc <= 299: // Success, do not retry. // Read the partial success message, if any. @@ -179,8 +179,7 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou } } return nil - case http.StatusTooManyRequests, - http.StatusServiceUnavailable: + case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable: // Retry-able failure. rErr = newResponseError(resp.Header) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index fe8afc240c1..3a3cfec0cde 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -164,8 +164,8 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc }() } - switch resp.StatusCode { - case http.StatusOK: + switch sc := resp.StatusCode; { + case sc >= 200 && sc <= 299: // Success, do not retry. // Read the partial success message, if any. var respData bytes.Buffer @@ -190,7 +190,7 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc } return nil - case http.StatusTooManyRequests, http.StatusServiceUnavailable: + case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable: // Retry-able failures. Drain the body to reuse the connection. if _, err := io.Copy(io.Discard, resp.Body); err != nil { otel.Handle(err) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 279d8ada339..2020b15058b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -401,3 +401,34 @@ func TestPartialSuccess(t *testing.T) { require.Contains(t, errs[0].Error(), "partially successful") require.Contains(t, errs[0].Error(), "2 spans rejected") } + +func TestOtherHTTPSuccess(t *testing.T) { + for code := 201; code <= 299; code++ { + t.Run(fmt.Sprintf("status_%d", code), func(t *testing.T) { + mcCfg := mockCollectorConfig{ + InjectHTTPStatus: []int{code}, + } + mc := runMockCollector(t, mcCfg) + defer mc.MustStop(t) + driver := otlptracehttp.NewClient( + otlptracehttp.WithEndpoint(mc.Endpoint()), + otlptracehttp.WithInsecure(), + ) + ctx := context.Background() + exporter, err := otlptrace.New(ctx, driver) + require.NoError(t, err) + defer func() { + assert.NoError(t, exporter.Shutdown(context.Background())) + }() + + errs := []error{} + otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { + errs = append(errs, err) + })) + err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) + assert.NoError(t, err) + + assert.Equal(t, 0, len(errs)) + }) + } +} From b8e8e5eb8be3a93b8e6750182ee1395c95d29523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 8 Aug 2023 14:16:58 +0200 Subject: [PATCH 644/886] metric: Recommend defining units in UCUM (#4418) * metric: Recommend defining units in UCUM * Update metric/instrument.go Co-authored-by: Tyler Yahn --------- Co-authored-by: Tyler Yahn --- metric/instrument.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metric/instrument.go b/metric/instrument.go index 0033c1e12d5..cdca00058c6 100644 --- a/metric/instrument.go +++ b/metric/instrument.go @@ -167,6 +167,8 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob } // WithUnit sets the instrument unit. +// +// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. func WithUnit(u string) InstrumentOption { return unitOpt(u) } // AddOption applies options to an addition measurement. See From 663151966ddf4693f4a25e63f05fcef87c3c991e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 8 Aug 2023 14:26:44 +0200 Subject: [PATCH 645/886] Minor refactoring (#4417) --- exporters/otlp/otlpmetric/internal/exporter_test.go | 12 +++++------- .../otlp/otlpmetric/otlpmetricgrpc/exporter_test.go | 12 +++++------- .../otlp/otlpmetric/otlpmetrichttp/exporter_test.go | 12 +++++------- sdk/metric/periodic_reader_test.go | 8 ++++---- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/exporters/otlp/otlpmetric/internal/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go index 9f071032f7b..bdbe3513840 100644 --- a/exporters/otlp/otlpmetric/internal/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -64,16 +64,17 @@ func TestExporterClientConcurrentSafe(t *testing.T) { ctx := context.Background() done := make(chan struct{}) - first := make(chan struct{}, goroutines) - var wg sync.WaitGroup + var wg, someWork sync.WaitGroup for i := 0; i < goroutines; i++ { wg.Add(1) + someWork.Add(1) go func() { defer wg.Done() assert.NoError(t, exp.Export(ctx, rm)) assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. - first <- struct{}{} + someWork.Done() for { _ = exp.Export(ctx, rm) @@ -88,10 +89,7 @@ func TestExporterClientConcurrentSafe(t *testing.T) { }() } - for i := 0; i < goroutines; i++ { - <-first - } - close(first) + someWork.Wait() assert.NoError(t, exp.Shutdown(ctx)) assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go index fb3e9fe0243..6bb91b6ca09 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter_test.go @@ -47,16 +47,17 @@ func TestExporterClientConcurrentSafe(t *testing.T) { rm := new(metricdata.ResourceMetrics) done := make(chan struct{}) - first := make(chan struct{}, goroutines) - var wg sync.WaitGroup + var wg, someWork sync.WaitGroup for i := 0; i < goroutines; i++ { wg.Add(1) + someWork.Add(1) go func() { defer wg.Done() assert.NoError(t, exp.Export(ctx, rm)) assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. - first <- struct{}{} + someWork.Done() for { _ = exp.Export(ctx, rm) @@ -71,10 +72,7 @@ func TestExporterClientConcurrentSafe(t *testing.T) { }() } - for i := 0; i < goroutines; i++ { - <-first - } - close(first) + someWork.Wait() assert.NoError(t, exp.Shutdown(ctx)) assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go index 9154d62768b..4af2ab43375 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter_test.go @@ -47,16 +47,17 @@ func TestExporterClientConcurrentSafe(t *testing.T) { rm := new(metricdata.ResourceMetrics) done := make(chan struct{}) - first := make(chan struct{}, goroutines) - var wg sync.WaitGroup + var wg, someWork sync.WaitGroup for i := 0; i < goroutines; i++ { wg.Add(1) + someWork.Add(1) go func() { defer wg.Done() assert.NoError(t, exp.Export(ctx, rm)) assert.NoError(t, exp.ForceFlush(ctx)) + // Ensure some work is done before shutting down. - first <- struct{}{} + someWork.Done() for { _ = exp.Export(ctx, rm) @@ -71,10 +72,7 @@ func TestExporterClientConcurrentSafe(t *testing.T) { }() } - for i := 0; i < goroutines; i++ { - <-first - } - close(first) + someWork.Wait() assert.NoError(t, exp.Shutdown(ctx)) assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 6ac527a37ea..0a34b7e9951 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -345,7 +345,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return nil }}) r.RegisterProducer(testExternalProducer{}) - assert.Equal(t, context.DeadlineExceeded, r.ForceFlush(context.Background()), "timeout error not returned") + assert.ErrorIs(t, r.ForceFlush(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") // Ensure Reader is allowed clean up attempt. @@ -368,7 +368,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return []metricdata.ScopeMetrics{testScopeMetricsA}, nil }, }) - assert.Equal(t, context.DeadlineExceeded, r.ForceFlush(context.Background()), "timeout error not returned") + assert.ErrorIs(t, r.ForceFlush(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") // Ensure Reader is allowed clean up attempt. @@ -400,7 +400,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return nil }}) r.RegisterProducer(testExternalProducer{}) - assert.Equal(t, context.DeadlineExceeded, r.Shutdown(context.Background()), "timeout error not returned") + assert.ErrorIs(t, r.Shutdown(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") }) @@ -420,7 +420,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return []metricdata.ScopeMetrics{testScopeMetricsA}, nil }, }) - assert.Equal(t, context.DeadlineExceeded, r.Shutdown(context.Background()), "timeout error not returned") + assert.ErrorIs(t, r.Shutdown(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") }) } From 25a6f15348f937db9ead89cd3d1715ecdc3f020a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 8 Aug 2023 07:45:53 -0700 Subject: [PATCH 646/886] Deprecate the otlp/internal package and all sub-packages (#4421) * Deprecate the otlp/internal package and all sub-packages * Add deprecation to changelog * No lint deprecated pkg use in otlpmetric * Remove the unused header*.go files from otlptrace * Use template wrappederror in otlptrace * Add back removed header.go * Replace use of WrapTracesError with fmt.Errorf * Revert otlptrace/internal to main * Deprecate retry module --- CHANGELOG.md | 6 ++++++ exporters/otlp/internal/config.go | 3 +++ exporters/otlp/internal/envconfig/doc.go | 20 +++++++++++++++++++ exporters/otlp/internal/retry/go.mod | 2 ++ exporters/otlp/internal/retry/retry.go | 3 +++ .../otlpmetric/internal/oconf/envconfig.go | 2 +- .../otlp/otlpmetric/internal/oconf/options.go | 4 ++-- .../otlpmetric/internal/oconf/options_test.go | 2 +- .../otlpmetric/internal/otest/client_test.go | 2 +- exporters/otlp/otlptrace/exporter.go | 4 ++-- 10 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 exporters/otlp/internal/envconfig/doc.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bf29bc4b0c..a6679c4b3b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not append _total if the counter already ends in total `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) - Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) +### Deprecated + +- The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) + ## [1.16.0/0.39.0] 2023-05-18 This release contains the first stable release of the OpenTelemetry Go [metric API]. diff --git a/exporters/otlp/internal/config.go b/exporters/otlp/internal/config.go index b3fd45d9d31..d0998fb1d04 100644 --- a/exporters/otlp/internal/config.go +++ b/exporters/otlp/internal/config.go @@ -13,6 +13,9 @@ // limitations under the License. // Package internal contains common functionality for all OTLP exporters. +// +// Deprecated: package internal exists for historical compatibility, it should +// not be used. package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" import ( diff --git a/exporters/otlp/internal/envconfig/doc.go b/exporters/otlp/internal/envconfig/doc.go new file mode 100644 index 00000000000..327794a5bea --- /dev/null +++ b/exporters/otlp/internal/envconfig/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package envconfig contains common functionality for all OTLP exporter +// configuration. +// +// Deprecated: package envconfig exists for historical compatibility, it should +// not be used. +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod index b69a6b0ed97..1f9fec184df 100644 --- a/exporters/otlp/internal/retry/go.mod +++ b/exporters/otlp/internal/retry/go.mod @@ -1,3 +1,5 @@ +// Deprecated: package retry exists for historical compatibility, it should not +// be used. module go.opentelemetry.io/otel/exporters/otlp/internal/retry go 1.19 diff --git a/exporters/otlp/internal/retry/retry.go b/exporters/otlp/internal/retry/retry.go index 7e1b0055a7f..94c4af0e562 100644 --- a/exporters/otlp/internal/retry/retry.go +++ b/exporters/otlp/internal/retry/retry.go @@ -15,6 +15,9 @@ // Package retry provides request retry functionality that can perform // configurable exponential backoff for transient errors and honor any // explicit throttle responses received. +// +// Deprecated: package retry exists for historical compatibility, it should not +// be used. package retry // import "go.opentelemetry.io/otel/exporters/otlp/internal/retry" import ( diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go index a8cbdb8eb2a..540165de933 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go @@ -23,7 +23,7 @@ import ( "strings" "time" - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" // nolint: staticcheck // Synchronous deprecation. "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index e696a0f78ba..8aa282ad8a1 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -25,8 +25,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/internal" - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. + "go.opentelemetry.io/otel/exporters/otlp/internal/retry" // nolint: staticcheck // Synchronous deprecation. ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" diff --git a/exporters/otlp/otlpmetric/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go index d2426af84c3..77cd9b09e07 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" // nolint: staticcheck // Synchronous deprecation. "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index ff33ea5b73f..a0d9bd5eec3 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -19,7 +19,7 @@ import ( "testing" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" + "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index b65802edbbd..0dbe15555b3 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -17,9 +17,9 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" import ( "context" "errors" + "fmt" "sync" - "go.opentelemetry.io/otel/exporters/otlp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" tracesdk "go.opentelemetry.io/otel/sdk/trace" ) @@ -48,7 +48,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan) err := e.client.UploadTraces(ctx, protoSpans) if err != nil { - return internal.WrapTracesError(err) + return fmt.Errorf("traces export: %w", err) } return nil } From e3ed198611123c91cb8133244ebda5537eb21ef8 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 8 Aug 2023 09:19:17 -0700 Subject: [PATCH 647/886] Deprecate the otlpmetric/internal package and sub-packages (#4420) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Deprecate the otlpmetric/internal package and sub-packages * Add stub to changelog * Add PR number to changelog stubs --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 4 ++++ exporters/otlp/otlpmetric/internal/exporter.go | 16 +++++----------- .../otlp/otlpmetric/internal/oconf/options.go | 11 ++++++++--- .../otlp/otlpmetric/internal/otest/client.go | 7 ++++++- .../otlpmetric/internal/otest/client_test.go | 4 ++-- .../otlp/otlpmetric/internal/otest/collector.go | 2 +- .../otlp/otlpmetric/internal/transform/doc.go | 3 +++ 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6679c4b3b4..f5b9d37f2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Deprecated +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) +- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform` package is deprecated. (#4420) - The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) - The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) - The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index f4428ac556f..73c51320ec2 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -12,6 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package internal provides common utilities for all otlpmetric exporters. +// +// Deprecated: package internal exists for historical compatibility, it should +// not be used. package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" import ( @@ -19,7 +23,7 @@ import ( "fmt" "sync" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" // nolint: staticcheck // Atomic deprecation. "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -27,11 +31,6 @@ import ( ) // Exporter exports metrics data as OTLP. -// -// Deprecated: Exporter exists for historical compatibility, it should not be -// used. Do not remove Exporter unless the whole -// "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" module is -// removed. type Exporter struct { // Ensure synchronous access to the client across all functionality. clientMu sync.Mutex @@ -101,11 +100,6 @@ func (e *Exporter) Shutdown(ctx context.Context) error { // New return an Exporter that uses client to transmits the OTLP data it // produces. The client is assumed to be fully started and able to communicate // with its OTLP receiving endpoint. -// -// Deprecated: New exists for historical compatibility, it should not be used. -// Do not remove New unless the whole -// "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" module is -// removed. func New(client Client) *Exporter { return &Exporter{client: client} } diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index 8aa282ad8a1..a5e71a86cfb 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package oconf provides common metric configuration types and functionality +// for all otlpmetric exporters. +// +// Deprecated: package oconf exists for historical compatibility, it should not +// be used. package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" import ( @@ -25,9 +30,9 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" // nolint: staticcheck // Synchronous deprecation. - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. + "go.opentelemetry.io/otel/exporters/otlp/internal/retry" // nolint: staticcheck // Synchronous deprecation. + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go index a315869c17d..2200413e49c 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/internal/otest/client.go @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Package otest provides common testing utilities for all otlpmetric +// exporters. +// +// Deprecated: package otest exists for historical compatibility, it should not +// be used. package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" import ( @@ -26,7 +31,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. semconv "go.opentelemetry.io/otel/semconv/v1.21.0" collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" cpb "go.opentelemetry.io/proto/otlp/common/v1" diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index a0d9bd5eec3..2c2ddcc9c01 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -19,8 +19,8 @@ import ( "testing" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. + ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go index 34756f4ccf5..b31e308c965 100644 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/internal/otest/collector.go @@ -39,7 +39,7 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/protobuf/proto" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" // nolint: staticcheck // Atomic deprecation. collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) diff --git a/exporters/otlp/otlpmetric/internal/transform/doc.go b/exporters/otlp/otlpmetric/internal/transform/doc.go index 7a79f794dd1..59c4951e211 100644 --- a/exporters/otlp/otlpmetric/internal/transform/doc.go +++ b/exporters/otlp/otlpmetric/internal/transform/doc.go @@ -14,4 +14,7 @@ // Package transform provides transformation functionality from the // sdk/metric/metricdata data-types into OTLP data-types. +// +// Deprecated: package transform exists for historical compatibility, it should +// not be used. package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" From b7f634a4fe675001b12d29db89d1a4ec77e92bbc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 9 Aug 2023 00:15:47 -0700 Subject: [PATCH 648/886] Decouple use of `otel/internal/internaltest` (#4424) * Add internaltest templates * Generate internaltest using gotmpl * Generate the sdk/internal/internaltest pkg * Use sdk/internal/internaltest in sdk module * Generate exporters/jaeger/internal/internaltest pkg * Use exporters/jaeger/internal/internaltest in jaeger exporter * Generate the exporters/zipkin/internal/internaltest pkg * Use local internaltest in zipkin exporter * Fix import path name in trace test --- exporters/jaeger/env_test.go | 2 +- .../jaeger/internal/internaltest/alignment.go | 74 ++++ exporters/jaeger/internal/internaltest/env.go | 101 +++++ .../jaeger/internal/internaltest/env_test.go | 237 ++++++++++++ .../jaeger/internal/internaltest/errors.go | 30 ++ exporters/jaeger/internal/internaltest/gen.go | 25 ++ .../jaeger/internal/internaltest/harness.go | 344 ++++++++++++++++++ .../internal/internaltest/text_map_carrier.go | 144 ++++++++ .../internaltest/text_map_carrier_test.go | 86 +++++ .../internaltest/text_map_propagator.go | 115 ++++++ .../internaltest/text_map_propagator_test.go | 72 ++++ exporters/jaeger/jaeger_test.go | 2 +- exporters/zipkin/env_test.go | 2 +- .../zipkin/internal/internaltest/alignment.go | 74 ++++ exporters/zipkin/internal/internaltest/env.go | 101 +++++ .../zipkin/internal/internaltest/env_test.go | 237 ++++++++++++ .../zipkin/internal/internaltest/errors.go | 30 ++ exporters/zipkin/internal/internaltest/gen.go | 25 ++ .../zipkin/internal/internaltest/harness.go | 344 ++++++++++++++++++ .../internal/internaltest/text_map_carrier.go | 144 ++++++++ .../internaltest/text_map_carrier_test.go | 86 +++++ .../internaltest/text_map_propagator.go | 115 ++++++ .../internaltest/text_map_propagator_test.go | 72 ++++ exporters/zipkin/zipkin_test.go | 2 +- internal/internaltest/alignment.go | 3 + internal/internaltest/env.go | 3 + internal/internaltest/env_test.go | 3 + internal/internaltest/errors.go | 3 + internal/internaltest/gen.go | 25 ++ internal/internaltest/harness.go | 3 + internal/internaltest/text_map_carrier.go | 3 + .../internaltest/text_map_carrier_test.go | 3 + internal/internaltest/text_map_propagator.go | 3 + .../internaltest/text_map_propagator_test.go | 3 + .../shared/internaltest/alignment.go.tmpl | 74 ++++ internal/shared/internaltest/env.go.tmpl | 101 +++++ internal/shared/internaltest/env_test.go.tmpl | 237 ++++++++++++ internal/shared/internaltest/errors.go.tmpl | 30 ++ internal/shared/internaltest/harness.go.tmpl | 344 ++++++++++++++++++ .../internaltest/text_map_carrier.go.tmpl | 144 ++++++++ .../text_map_carrier_test.go.tmpl | 86 +++++ .../internaltest/text_map_propagator.go.tmpl | 115 ++++++ .../text_map_propagator_test.go.tmpl | 72 ++++ sdk/internal/env/env_test.go | 2 +- sdk/internal/internaltest/alignment.go | 74 ++++ sdk/internal/internaltest/env.go | 101 +++++ sdk/internal/internaltest/env_test.go | 237 ++++++++++++ sdk/internal/internaltest/errors.go | 30 ++ sdk/internal/internaltest/gen.go | 25 ++ sdk/internal/internaltest/harness.go | 344 ++++++++++++++++++ sdk/internal/internaltest/text_map_carrier.go | 144 ++++++++ .../internaltest/text_map_carrier_test.go | 86 +++++ .../internaltest/text_map_propagator.go | 115 ++++++ .../internaltest/text_map_propagator_test.go | 72 ++++ sdk/resource/env_test.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/batch_span_processor_test.go | 2 +- sdk/trace/provider_test.go | 2 +- sdk/trace/span_limits_test.go | 2 +- sdk/trace/trace_test.go | 6 +- 60 files changed, 4952 insertions(+), 13 deletions(-) create mode 100644 exporters/jaeger/internal/internaltest/alignment.go create mode 100644 exporters/jaeger/internal/internaltest/env.go create mode 100644 exporters/jaeger/internal/internaltest/env_test.go create mode 100644 exporters/jaeger/internal/internaltest/errors.go create mode 100644 exporters/jaeger/internal/internaltest/gen.go create mode 100644 exporters/jaeger/internal/internaltest/harness.go create mode 100644 exporters/jaeger/internal/internaltest/text_map_carrier.go create mode 100644 exporters/jaeger/internal/internaltest/text_map_carrier_test.go create mode 100644 exporters/jaeger/internal/internaltest/text_map_propagator.go create mode 100644 exporters/jaeger/internal/internaltest/text_map_propagator_test.go create mode 100644 exporters/zipkin/internal/internaltest/alignment.go create mode 100644 exporters/zipkin/internal/internaltest/env.go create mode 100644 exporters/zipkin/internal/internaltest/env_test.go create mode 100644 exporters/zipkin/internal/internaltest/errors.go create mode 100644 exporters/zipkin/internal/internaltest/gen.go create mode 100644 exporters/zipkin/internal/internaltest/harness.go create mode 100644 exporters/zipkin/internal/internaltest/text_map_carrier.go create mode 100644 exporters/zipkin/internal/internaltest/text_map_carrier_test.go create mode 100644 exporters/zipkin/internal/internaltest/text_map_propagator.go create mode 100644 exporters/zipkin/internal/internaltest/text_map_propagator_test.go create mode 100644 internal/internaltest/gen.go create mode 100644 internal/shared/internaltest/alignment.go.tmpl create mode 100644 internal/shared/internaltest/env.go.tmpl create mode 100644 internal/shared/internaltest/env_test.go.tmpl create mode 100644 internal/shared/internaltest/errors.go.tmpl create mode 100644 internal/shared/internaltest/harness.go.tmpl create mode 100644 internal/shared/internaltest/text_map_carrier.go.tmpl create mode 100644 internal/shared/internaltest/text_map_carrier_test.go.tmpl create mode 100644 internal/shared/internaltest/text_map_propagator.go.tmpl create mode 100644 internal/shared/internaltest/text_map_propagator_test.go.tmpl create mode 100644 sdk/internal/internaltest/alignment.go create mode 100644 sdk/internal/internaltest/env.go create mode 100644 sdk/internal/internaltest/env_test.go create mode 100644 sdk/internal/internaltest/errors.go create mode 100644 sdk/internal/internaltest/gen.go create mode 100644 sdk/internal/internaltest/harness.go create mode 100644 sdk/internal/internaltest/text_map_carrier.go create mode 100644 sdk/internal/internaltest/text_map_carrier_test.go create mode 100644 sdk/internal/internaltest/text_map_propagator.go create mode 100644 sdk/internal/internaltest/text_map_propagator_test.go diff --git a/exporters/jaeger/env_test.go b/exporters/jaeger/env_test.go index 0a9ee1900ba..f9219d28b84 100644 --- a/exporters/jaeger/env_test.go +++ b/exporters/jaeger/env_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" ) func TestNewRawExporterWithDefault(t *testing.T) { diff --git a/exporters/jaeger/internal/internaltest/alignment.go b/exporters/jaeger/internal/internaltest/alignment.go new file mode 100644 index 00000000000..6885811cccc --- /dev/null +++ b/exporters/jaeger/internal/internaltest/alignment.go @@ -0,0 +1,74 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/alignment.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +/* +This file contains common utilities and objects to validate memory alignment +of Go types. The primary use of this functionality is intended to ensure +`struct` fields that need to be 64-bit aligned so they can be passed as +arguments to 64-bit atomic operations. + +The common workflow is to define a slice of `FieldOffset` and pass them to the +`Aligned8Byte` function from within a `TestMain` function from a package's +tests. It is important to make this call from the `TestMain` function prior +to running the rest of the test suit as it can provide useful diagnostics +about field alignment instead of ambiguous nil pointer dereference and runtime +panic. + +For more information: +https://github.com/open-telemetry/opentelemetry-go/issues/341 +*/ + +import ( + "fmt" + "io" +) + +// FieldOffset is a preprocessor representation of a struct field alignment. +type FieldOffset struct { + // Name of the field. + Name string + + // Offset of the field in bytes. + // + // To compute this at compile time use unsafe.Offsetof. + Offset uintptr +} + +// Aligned8Byte returns if all fields are aligned modulo 8-bytes. +// +// Error messaging is printed to out for any field determined misaligned. +func Aligned8Byte(fields []FieldOffset, out io.Writer) bool { + misaligned := make([]FieldOffset, 0) + for _, f := range fields { + if f.Offset%8 != 0 { + misaligned = append(misaligned, f) + } + } + + if len(misaligned) == 0 { + return true + } + + fmt.Fprintln(out, "struct fields not aligned for 64-bit atomic operations:") + for _, f := range misaligned { + fmt.Fprintf(out, " %s: %d-byte offset\n", f.Name, f.Offset) + } + + return false +} diff --git a/exporters/jaeger/internal/internaltest/env.go b/exporters/jaeger/internal/internaltest/env.go new file mode 100644 index 00000000000..8f05ef4961d --- /dev/null +++ b/exporters/jaeger/internal/internaltest/env.go @@ -0,0 +1,101 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +import ( + "os" +) + +type Env struct { + Name string + Value string + Exists bool +} + +// EnvStore stores and recovers environment variables. +type EnvStore interface { + // Records the environment variable into the store. + Record(key string) + + // Restore recovers the environment variables in the store. + Restore() error +} + +var _ EnvStore = (*envStore)(nil) + +type envStore struct { + store map[string]Env +} + +func (s *envStore) add(env Env) { + s.store[env.Name] = env +} + +func (s *envStore) Restore() error { + var err error + for _, v := range s.store { + if v.Exists { + err = os.Setenv(v.Name, v.Value) + } else { + err = os.Unsetenv(v.Name) + } + if err != nil { + return err + } + } + return nil +} + +func (s *envStore) setEnv(key, value string) error { + s.Record(key) + + err := os.Setenv(key, value) + if err != nil { + return err + } + return nil +} + +func (s *envStore) Record(key string) { + originValue, exists := os.LookupEnv(key) + s.add(Env{ + Name: key, + Value: originValue, + Exists: exists, + }) +} + +func NewEnvStore() EnvStore { + return newEnvStore() +} + +func newEnvStore() *envStore { + return &envStore{store: make(map[string]Env)} +} + +func SetEnvVariables(env map[string]string) (EnvStore, error) { + envStore := newEnvStore() + + for k, v := range env { + err := envStore.setEnv(k, v) + if err != nil { + return nil, err + } + } + return envStore, nil +} diff --git a/exporters/jaeger/internal/internaltest/env_test.go b/exporters/jaeger/internal/internaltest/env_test.go new file mode 100644 index 00000000000..dc4dcea8e30 --- /dev/null +++ b/exporters/jaeger/internal/internaltest/env_test.go @@ -0,0 +1,237 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type EnvStoreTestSuite struct { + suite.Suite +} + +func (s *EnvStoreTestSuite) Test_add() { + envStore := newEnvStore() + + e := Env{ + Name: "name", + Value: "value", + Exists: true, + } + envStore.add(e) + envStore.add(e) + + s.Assert().Len(envStore.store, 1) +} + +func (s *EnvStoreTestSuite) TestRecord() { + testCases := []struct { + name string + env Env + expectedEnvStore *envStore + }{ + { + name: "record exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "value", + Exists: true, + }, + }}, + }, + { + name: "record exists env, but its value is empty", + env: Env{ + Name: "name", + Value: "", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "", + Exists: true, + }, + }}, + }, + { + name: "record not exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Exists: false, + }, + }}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if tc.env.Exists { + s.Assert().NoError(os.Setenv(tc.env.Name, tc.env.Value)) + } + + envStore := newEnvStore() + envStore.Record(tc.env.Name) + + s.Assert().Equal(tc.expectedEnvStore, envStore) + + if tc.env.Exists { + s.Assert().NoError(os.Unsetenv(tc.env.Name)) + } + }) + } +} + +func (s *EnvStoreTestSuite) TestRestore() { + testCases := []struct { + name string + env Env + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + { + name: "no exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvExists: false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + envStore.add(tc.env) + + // Backup + backup := newEnvStore() + backup.Record(tc.env.Name) + + s.Require().NoError(os.Unsetenv(tc.env.Name)) + + s.Assert().NoError(envStore.Restore()) + v, exists := os.LookupEnv(tc.env.Name) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func (s *EnvStoreTestSuite) Test_setEnv() { + testCases := []struct { + name string + key string + value string + expectedEnvStore *envStore + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "normal", + key: "name", + value: "value", + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "other value", + Exists: true, + }, + }}, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + + // Backup + backup := newEnvStore() + backup.Record(tc.key) + + s.Require().NoError(os.Setenv(tc.key, "other value")) + + s.Assert().NoError(envStore.setEnv(tc.key, tc.value)) + s.Assert().Equal(tc.expectedEnvStore, envStore) + v, exists := os.LookupEnv(tc.key) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func TestEnvStoreTestSuite(t *testing.T) { + suite.Run(t, new(EnvStoreTestSuite)) +} + +func TestSetEnvVariables(t *testing.T) { + envs := map[string]string{ + "name1": "value1", + "name2": "value2", + } + + // Backup + backup := newEnvStore() + for k := range envs { + backup.Record(k) + } + defer func() { + require.NoError(t, backup.Restore()) + }() + + store, err := SetEnvVariables(envs) + assert.NoError(t, err) + require.IsType(t, &envStore{}, store) + concreteStore := store.(*envStore) + assert.Len(t, concreteStore.store, 2) + assert.Equal(t, backup, concreteStore) +} diff --git a/exporters/jaeger/internal/internaltest/errors.go b/exporters/jaeger/internal/internaltest/errors.go new file mode 100644 index 00000000000..71d48fdf6e8 --- /dev/null +++ b/exporters/jaeger/internal/internaltest/errors.go @@ -0,0 +1,30 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/errors.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +type TestError string + +var _ error = TestError("") + +func NewTestError(s string) error { + return TestError(s) +} + +func (e TestError) Error() string { + return string(e) +} diff --git a/exporters/jaeger/internal/internaltest/gen.go b/exporters/jaeger/internal/internaltest/gen.go new file mode 100644 index 00000000000..3ee9f78234a --- /dev/null +++ b/exporters/jaeger/internal/internaltest/gen.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +//go:generate gotmpl --body=../../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/exporters/jaeger/internal/internaltest/harness.go b/exporters/jaeger/internal/internaltest/harness.go new file mode 100644 index 00000000000..3922726c72d --- /dev/null +++ b/exporters/jaeger/internal/internaltest/harness.go @@ -0,0 +1,344 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/harness.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/trace" +) + +// Harness is a testing harness used to test implementations of the +// OpenTelemetry API. +type Harness struct { + t *testing.T +} + +// NewHarness returns an instantiated *Harness using t. +func NewHarness(t *testing.T) *Harness { + return &Harness{ + t: t, + } +} + +// TestTracerProvider runs validation tests for an implementation of the OpenTelemetry +// TracerProvider API. +func (h *Harness) TestTracerProvider(subjectFactory func() trace.TracerProvider) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("allow creating an arbitrary number of TracerProvider instances", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + + tp1 := subjectFactory() + tp2 := subjectFactory() + + e.Expect(tp1).NotToEqual(tp2) + }) + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + runner := func(tp trace.TracerProvider) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.TracerProvider) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name, version string) { + _ = tp.Tracer(name, trace.WithInstrumentationVersion(version)) + wg.Done() + }(fmt.Sprintf("tracer %d", i%5), fmt.Sprintf("%d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + matchers.NewExpecter(t).Expect(func() { + // Run with multiple TracerProvider to ensure they encapsulate + // their own Tracers. + tp1 := subjectFactory() + tp2 := subjectFactory() + + done1 := runner(tp1) + done2 := runner(tp2) + + <-done1 + <-done2 + }).NotToPanic() + }) + }) +} + +// TestTracer runs validation tests for an implementation of the OpenTelemetry +// Tracer API. +func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("propagates the original context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctxKey := testCtxKey{} + ctxValue := "ctx value" + ctx := context.WithValue(context.Background(), ctxKey, ctxValue) + + ctx, _ = subject.Start(ctx, "test") + + e.Expect(ctx.Value(ctxKey)).ToEqual(ctxValue) + }) + + t.Run("returns a span containing the expected properties", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + + e.Expect(span.SpanContext().IsValid()).ToBeTrue() + }) + + t.Run("stores the span on the provided context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + e.Expect(span.SpanContext()).NotToEqual(trace.SpanContext{}) + e.Expect(trace.SpanFromContext(ctx)).ToEqual(span) + }) + + t.Run("starts spans with unique trace and span IDs", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span1 := subject.Start(context.Background(), "span1") + _, span2 := subject.Start(context.Background(), "span2") + + sc1 := span1.SpanContext() + sc2 := span2.SpanContext() + + e.Expect(sc1.TraceID()).NotToEqual(sc2.TraceID()) + e.Expect(sc1.SpanID()).NotToEqual(sc2.SpanID()) + }) + + t.Run("propagates a parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child") + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child", trace.WithNewRoot()) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("propagates remote parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child") + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores remote parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child", trace.WithNewRoot()) + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + tracer := subjectFactory() + + ctx, parent := tracer.Start(context.Background(), "span") + + runner := func(tp trace.Tracer) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.Tracer) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name string) { + defer wg.Done() + _, child := tp.Start(ctx, name) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }(fmt.Sprintf("span %d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + e.Expect(func() { + done := runner(tracer) + + <-done + }).NotToPanic() + }) + }) + + h.testSpan(subjectFactory) +} + +func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { + var methods = map[string]func(span trace.Span){ + "#End": func(span trace.Span) { + span.End() + }, + "#AddEvent": func(span trace.Span) { + span.AddEvent("test event") + }, + "#AddEventWithTimestamp": func(span trace.Span) { + span.AddEvent("test event", trace.WithTimestamp(time.Now().Add(1*time.Second))) + }, + "#SetStatus": func(span trace.Span) { + span.SetStatus(codes.Error, "internal") + }, + "#SetName": func(span trace.Span) { + span.SetName("new name") + }, + "#SetAttributes": func(span trace.Span) { + span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) + }, + } + var mechanisms = map[string]func() trace.Span{ + "Span created via Tracer#Start": func() trace.Span { + tracer := tracerFactory() + _, subject := tracer.Start(context.Background(), "test") + + return subject + }, + "Span created via span.TracerProvider()": func() trace.Span { + ctx, spanA := tracerFactory().Start(context.Background(), "span1") + + _, spanB := spanA.TracerProvider().Tracer("second").Start(ctx, "span2") + return spanB + }, + } + + for mechanismName, mechanism := range mechanisms { + h.t.Run(mechanismName, func(t *testing.T) { + for methodName, method := range methods { + t.Run(methodName, func(t *testing.T) { + t.Run("is thread-safe", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + wg := &sync.WaitGroup{} + wg.Add(2) + + go func() { + defer wg.Done() + + method(span) + }() + + go func() { + defer wg.Done() + + method(span) + }() + + wg.Wait() + }) + }) + } + + t.Run("#End", func(t *testing.T) { + t.Run("can be called multiple times", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + span.End() + span.End() + }) + }) + }) + } +} + +type testCtxKey struct{} diff --git a/exporters/jaeger/internal/internaltest/text_map_carrier.go b/exporters/jaeger/internal/internaltest/text_map_carrier.go new file mode 100644 index 00000000000..5c70e789765 --- /dev/null +++ b/exporters/jaeger/internal/internaltest/text_map_carrier.go @@ -0,0 +1,144 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +import ( + "sync" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +// TextMapCarrier is a storage medium for a TextMapPropagator used in testing. +// The methods of a TextMapCarrier are concurrent safe. +type TextMapCarrier struct { + mtx sync.Mutex + + gets []string + sets [][2]string + data map[string]string +} + +var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil) + +// NewTextMapCarrier returns a new *TextMapCarrier populated with data. +func NewTextMapCarrier(data map[string]string) *TextMapCarrier { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + return &TextMapCarrier{data: copied} +} + +// Keys returns the keys for which this carrier has a value. +func (c *TextMapCarrier) Keys() []string { + c.mtx.Lock() + defer c.mtx.Unlock() + + result := make([]string, 0, len(c.data)) + for k := range c.data { + result = append(result, k) + } + return result +} + +// Get returns the value associated with the passed key. +func (c *TextMapCarrier) Get(key string) string { + c.mtx.Lock() + defer c.mtx.Unlock() + c.gets = append(c.gets, key) + return c.data[key] +} + +// GotKey tests if c.Get has been called for key. +func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + for _, k := range c.gets { + if k == key { + return true + } + } + t.Errorf("TextMapCarrier.Get(%q) has not been called", key) + return false +} + +// GotN tests if n calls to c.Get have been made. +func (c *TextMapCarrier) GotN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.gets) != n { + t.Errorf("TextMapCarrier.Get was called %d times, not %d", len(c.gets), n) + return false + } + return true +} + +// Set stores the key-value pair. +func (c *TextMapCarrier) Set(key, value string) { + c.mtx.Lock() + defer c.mtx.Unlock() + c.sets = append(c.sets, [2]string{key, value}) + c.data[key] = value +} + +// SetKeyValue tests if c.Set has been called for the key-value pair. +func (c *TextMapCarrier) SetKeyValue(t *testing.T, key, value string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + var vals []string + for _, pair := range c.sets { + if key == pair[0] { + if value == pair[1] { + return true + } + vals = append(vals, pair[1]) + } + } + if len(vals) > 0 { + t.Errorf("TextMapCarrier.Set called with %q and %v values, but not %s", key, vals, value) + } + t.Errorf("TextMapCarrier.Set(%q,%q) has not been called", key, value) + return false +} + +// SetN tests if n calls to c.Set have been made. +func (c *TextMapCarrier) SetN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.sets) != n { + t.Errorf("TextMapCarrier.Set was called %d times, not %d", len(c.sets), n) + return false + } + return true +} + +// Reset zeros out the recording state and sets the carried values to data. +func (c *TextMapCarrier) Reset(data map[string]string) { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + + c.mtx.Lock() + defer c.mtx.Unlock() + + c.gets = nil + c.sets = nil + c.data = copied +} diff --git a/exporters/jaeger/internal/internaltest/text_map_carrier_test.go b/exporters/jaeger/internal/internaltest/text_map_carrier_test.go new file mode 100644 index 00000000000..faf713cc2d0 --- /dev/null +++ b/exporters/jaeger/internal/internaltest/text_map_carrier_test.go @@ -0,0 +1,86 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "reflect" + "testing" +) + +var ( + key, value = "test", "true" +) + +func TestTextMapCarrierKeys(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + expected, actual := []string{key}, tmc.Keys() + if !reflect.DeepEqual(actual, expected) { + t.Errorf("expected tmc.Keys() to be %v but it was %v", expected, actual) + } +} + +func TestTextMapCarrierGet(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + if got := tmc.Get("empty"); got != "" { + t.Errorf("TextMapCarrier.Get returned %q for an empty key", got) + } + tmc.GotKey(t, "empty") + tmc.GotN(t, 1) + if got := tmc.Get(key); got != value { + t.Errorf("TextMapCarrier.Get(%q) returned %q, want %q", key, got, value) + } + tmc.GotKey(t, key) + tmc.GotN(t, 2) +} + +func TestTextMapCarrierSet(t *testing.T) { + tmc := NewTextMapCarrier(nil) + tmc.SetN(t, 0) + tmc.Set(key, value) + if got, ok := tmc.data[key]; !ok { + t.Errorf("TextMapCarrier.Set(%q,%q) failed to store pair", key, value) + } else if got != value { + t.Errorf("TextMapCarrier.Set(%q,%q) stored (%q,%q), not (%q,%q)", key, value, key, got, key, value) + } + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) +} + +func TestTextMapCarrierReset(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear initial data") + } + tmc.GotN(t, 1) + tmc.GotKey(t, key) + tmc.Set(key, value) + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear data") + } +} diff --git a/exporters/jaeger/internal/internaltest/text_map_propagator.go b/exporters/jaeger/internal/internaltest/text_map_propagator.go new file mode 100644 index 00000000000..c1c22117a06 --- /dev/null +++ b/exporters/jaeger/internal/internaltest/text_map_propagator.go @@ -0,0 +1,115 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" + +import ( + "context" + "fmt" + "strconv" + "strings" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +type ctxKeyType string + +type state struct { + Injections uint64 + Extractions uint64 +} + +func newState(encoded string) state { + if encoded == "" { + return state{} + } + s0, s1, _ := strings.Cut(encoded, ",") + injects, _ := strconv.ParseUint(s0, 10, 64) + extracts, _ := strconv.ParseUint(s1, 10, 64) + return state{ + Injections: injects, + Extractions: extracts, + } +} + +func (s state) String() string { + return fmt.Sprintf("%d,%d", s.Injections, s.Extractions) +} + +// TextMapPropagator is a propagation.TextMapPropagator used for testing. +type TextMapPropagator struct { + name string + ctxKey ctxKeyType +} + +var _ propagation.TextMapPropagator = (*TextMapPropagator)(nil) + +// NewTextMapPropagator returns a new TextMapPropagator for testing. It will +// use name as the key it injects into a TextMapCarrier when Inject is called. +func NewTextMapPropagator(name string) *TextMapPropagator { + return &TextMapPropagator{name: name, ctxKey: ctxKeyType(name)} +} + +func (p *TextMapPropagator) stateFromContext(ctx context.Context) state { + if v := ctx.Value(p.ctxKey); v != nil { + if s, ok := v.(state); ok { + return s + } + } + return state{} +} + +func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state { + return newState(carrier.Get(p.name)) +} + +// Inject sets cross-cutting concerns for p from ctx into carrier. +func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + s := p.stateFromContext(ctx) + s.Injections++ + carrier.Set(p.name, s.String()) +} + +// InjectedN tests if p has made n injections to carrier. +func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n int) bool { + if actual := p.stateFromCarrier(carrier).Injections; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} injected %d times, not %d", p.name, actual, n) + return false + } + return true +} + +// Extract reads cross-cutting concerns for p from carrier into ctx. +func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + s := p.stateFromCarrier(carrier) + s.Extractions++ + return context.WithValue(ctx, p.ctxKey, s) +} + +// ExtractedN tests if p has made n extractions from the lineage of ctx. +// nolint (context is not first arg) +func (p *TextMapPropagator) ExtractedN(t *testing.T, ctx context.Context, n int) bool { + if actual := p.stateFromContext(ctx).Extractions; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} extracted %d time, not %d", p.name, actual, n) + return false + } + return true +} + +// Fields returns the name of p as the key who's value is set with Inject. +func (p *TextMapPropagator) Fields() []string { return []string{p.name} } diff --git a/exporters/jaeger/internal/internaltest/text_map_propagator_test.go b/exporters/jaeger/internal/internaltest/text_map_propagator_test.go new file mode 100644 index 00000000000..babcc95fc1b --- /dev/null +++ b/exporters/jaeger/internal/internaltest/text_map_propagator_test.go @@ -0,0 +1,72 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "testing" +) + +func TestTextMapPropagatorInjectExtract(t *testing.T) { + name := "testing" + ctx := context.Background() + carrier := NewTextMapCarrier(map[string]string{name: value}) + propagator := NewTextMapPropagator(name) + + propagator.Inject(ctx, carrier) + // Carrier value overridden with state. + if carrier.SetKeyValue(t, name, "1,0") { + // Ensure nothing has been extracted yet. + propagator.ExtractedN(t, ctx, 0) + // Test the injection was counted. + propagator.InjectedN(t, carrier, 1) + } + + ctx = propagator.Extract(ctx, carrier) + v := ctx.Value(ctxKeyType(name)) + if v == nil { + t.Error("TextMapPropagator.Extract failed to extract state") + } + if s, ok := v.(state); !ok { + t.Error("TextMapPropagator.Extract did not extract proper state") + } else if s.Extractions != 1 { + t.Error("TextMapPropagator.Extract did not increment state.Extractions") + } + if carrier.GotKey(t, name) { + // Test the extraction was counted. + propagator.ExtractedN(t, ctx, 1) + // Ensure no additional injection was recorded. + propagator.InjectedN(t, carrier, 1) + } +} + +func TestTextMapPropagatorFields(t *testing.T) { + name := "testing" + propagator := NewTextMapPropagator(name) + if got := propagator.Fields(); len(got) != 1 { + t.Errorf("TextMapPropagator.Fields returned %d fields, want 1", len(got)) + } else if got[0] != name { + t.Errorf("TextMapPropagator.Fields returned %q, want %q", got[0], name) + } +} + +func TestNewStateEmpty(t *testing.T) { + if want, got := (state{}), newState(""); got != want { + t.Errorf("newState(\"\") returned %v, want %v", got, want) + } +} diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go index 6a503b55779..312a7fc5ea1 100644 --- a/exporters/jaeger/jaeger_test.go +++ b/exporters/jaeger/jaeger_test.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" diff --git a/exporters/zipkin/env_test.go b/exporters/zipkin/env_test.go index b06fc785650..0ac9d5a9d0d 100644 --- a/exporters/zipkin/env_test.go +++ b/exporters/zipkin/env_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" ) func TestEnvOrWithCollectorEndpointOptionsFromEnv(t *testing.T) { diff --git a/exporters/zipkin/internal/internaltest/alignment.go b/exporters/zipkin/internal/internaltest/alignment.go new file mode 100644 index 00000000000..14bf46c37a1 --- /dev/null +++ b/exporters/zipkin/internal/internaltest/alignment.go @@ -0,0 +1,74 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/alignment.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +/* +This file contains common utilities and objects to validate memory alignment +of Go types. The primary use of this functionality is intended to ensure +`struct` fields that need to be 64-bit aligned so they can be passed as +arguments to 64-bit atomic operations. + +The common workflow is to define a slice of `FieldOffset` and pass them to the +`Aligned8Byte` function from within a `TestMain` function from a package's +tests. It is important to make this call from the `TestMain` function prior +to running the rest of the test suit as it can provide useful diagnostics +about field alignment instead of ambiguous nil pointer dereference and runtime +panic. + +For more information: +https://github.com/open-telemetry/opentelemetry-go/issues/341 +*/ + +import ( + "fmt" + "io" +) + +// FieldOffset is a preprocessor representation of a struct field alignment. +type FieldOffset struct { + // Name of the field. + Name string + + // Offset of the field in bytes. + // + // To compute this at compile time use unsafe.Offsetof. + Offset uintptr +} + +// Aligned8Byte returns if all fields are aligned modulo 8-bytes. +// +// Error messaging is printed to out for any field determined misaligned. +func Aligned8Byte(fields []FieldOffset, out io.Writer) bool { + misaligned := make([]FieldOffset, 0) + for _, f := range fields { + if f.Offset%8 != 0 { + misaligned = append(misaligned, f) + } + } + + if len(misaligned) == 0 { + return true + } + + fmt.Fprintln(out, "struct fields not aligned for 64-bit atomic operations:") + for _, f := range misaligned { + fmt.Fprintf(out, " %s: %d-byte offset\n", f.Name, f.Offset) + } + + return false +} diff --git a/exporters/zipkin/internal/internaltest/env.go b/exporters/zipkin/internal/internaltest/env.go new file mode 100644 index 00000000000..e13a1fc6593 --- /dev/null +++ b/exporters/zipkin/internal/internaltest/env.go @@ -0,0 +1,101 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +import ( + "os" +) + +type Env struct { + Name string + Value string + Exists bool +} + +// EnvStore stores and recovers environment variables. +type EnvStore interface { + // Records the environment variable into the store. + Record(key string) + + // Restore recovers the environment variables in the store. + Restore() error +} + +var _ EnvStore = (*envStore)(nil) + +type envStore struct { + store map[string]Env +} + +func (s *envStore) add(env Env) { + s.store[env.Name] = env +} + +func (s *envStore) Restore() error { + var err error + for _, v := range s.store { + if v.Exists { + err = os.Setenv(v.Name, v.Value) + } else { + err = os.Unsetenv(v.Name) + } + if err != nil { + return err + } + } + return nil +} + +func (s *envStore) setEnv(key, value string) error { + s.Record(key) + + err := os.Setenv(key, value) + if err != nil { + return err + } + return nil +} + +func (s *envStore) Record(key string) { + originValue, exists := os.LookupEnv(key) + s.add(Env{ + Name: key, + Value: originValue, + Exists: exists, + }) +} + +func NewEnvStore() EnvStore { + return newEnvStore() +} + +func newEnvStore() *envStore { + return &envStore{store: make(map[string]Env)} +} + +func SetEnvVariables(env map[string]string) (EnvStore, error) { + envStore := newEnvStore() + + for k, v := range env { + err := envStore.setEnv(k, v) + if err != nil { + return nil, err + } + } + return envStore, nil +} diff --git a/exporters/zipkin/internal/internaltest/env_test.go b/exporters/zipkin/internal/internaltest/env_test.go new file mode 100644 index 00000000000..dc4dcea8e30 --- /dev/null +++ b/exporters/zipkin/internal/internaltest/env_test.go @@ -0,0 +1,237 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type EnvStoreTestSuite struct { + suite.Suite +} + +func (s *EnvStoreTestSuite) Test_add() { + envStore := newEnvStore() + + e := Env{ + Name: "name", + Value: "value", + Exists: true, + } + envStore.add(e) + envStore.add(e) + + s.Assert().Len(envStore.store, 1) +} + +func (s *EnvStoreTestSuite) TestRecord() { + testCases := []struct { + name string + env Env + expectedEnvStore *envStore + }{ + { + name: "record exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "value", + Exists: true, + }, + }}, + }, + { + name: "record exists env, but its value is empty", + env: Env{ + Name: "name", + Value: "", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "", + Exists: true, + }, + }}, + }, + { + name: "record not exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Exists: false, + }, + }}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if tc.env.Exists { + s.Assert().NoError(os.Setenv(tc.env.Name, tc.env.Value)) + } + + envStore := newEnvStore() + envStore.Record(tc.env.Name) + + s.Assert().Equal(tc.expectedEnvStore, envStore) + + if tc.env.Exists { + s.Assert().NoError(os.Unsetenv(tc.env.Name)) + } + }) + } +} + +func (s *EnvStoreTestSuite) TestRestore() { + testCases := []struct { + name string + env Env + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + { + name: "no exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvExists: false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + envStore.add(tc.env) + + // Backup + backup := newEnvStore() + backup.Record(tc.env.Name) + + s.Require().NoError(os.Unsetenv(tc.env.Name)) + + s.Assert().NoError(envStore.Restore()) + v, exists := os.LookupEnv(tc.env.Name) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func (s *EnvStoreTestSuite) Test_setEnv() { + testCases := []struct { + name string + key string + value string + expectedEnvStore *envStore + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "normal", + key: "name", + value: "value", + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "other value", + Exists: true, + }, + }}, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + + // Backup + backup := newEnvStore() + backup.Record(tc.key) + + s.Require().NoError(os.Setenv(tc.key, "other value")) + + s.Assert().NoError(envStore.setEnv(tc.key, tc.value)) + s.Assert().Equal(tc.expectedEnvStore, envStore) + v, exists := os.LookupEnv(tc.key) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func TestEnvStoreTestSuite(t *testing.T) { + suite.Run(t, new(EnvStoreTestSuite)) +} + +func TestSetEnvVariables(t *testing.T) { + envs := map[string]string{ + "name1": "value1", + "name2": "value2", + } + + // Backup + backup := newEnvStore() + for k := range envs { + backup.Record(k) + } + defer func() { + require.NoError(t, backup.Restore()) + }() + + store, err := SetEnvVariables(envs) + assert.NoError(t, err) + require.IsType(t, &envStore{}, store) + concreteStore := store.(*envStore) + assert.Len(t, concreteStore.store, 2) + assert.Equal(t, backup, concreteStore) +} diff --git a/exporters/zipkin/internal/internaltest/errors.go b/exporters/zipkin/internal/internaltest/errors.go new file mode 100644 index 00000000000..11641c82c70 --- /dev/null +++ b/exporters/zipkin/internal/internaltest/errors.go @@ -0,0 +1,30 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/errors.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +type TestError string + +var _ error = TestError("") + +func NewTestError(s string) error { + return TestError(s) +} + +func (e TestError) Error() string { + return string(e) +} diff --git a/exporters/zipkin/internal/internaltest/gen.go b/exporters/zipkin/internal/internaltest/gen.go new file mode 100644 index 00000000000..c176d366b5f --- /dev/null +++ b/exporters/zipkin/internal/internaltest/gen.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +//go:generate gotmpl --body=../../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go +//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/exporters/zipkin/internal/internaltest/harness.go b/exporters/zipkin/internal/internaltest/harness.go new file mode 100644 index 00000000000..33b4f82307d --- /dev/null +++ b/exporters/zipkin/internal/internaltest/harness.go @@ -0,0 +1,344 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/harness.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/trace" +) + +// Harness is a testing harness used to test implementations of the +// OpenTelemetry API. +type Harness struct { + t *testing.T +} + +// NewHarness returns an instantiated *Harness using t. +func NewHarness(t *testing.T) *Harness { + return &Harness{ + t: t, + } +} + +// TestTracerProvider runs validation tests for an implementation of the OpenTelemetry +// TracerProvider API. +func (h *Harness) TestTracerProvider(subjectFactory func() trace.TracerProvider) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("allow creating an arbitrary number of TracerProvider instances", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + + tp1 := subjectFactory() + tp2 := subjectFactory() + + e.Expect(tp1).NotToEqual(tp2) + }) + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + runner := func(tp trace.TracerProvider) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.TracerProvider) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name, version string) { + _ = tp.Tracer(name, trace.WithInstrumentationVersion(version)) + wg.Done() + }(fmt.Sprintf("tracer %d", i%5), fmt.Sprintf("%d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + matchers.NewExpecter(t).Expect(func() { + // Run with multiple TracerProvider to ensure they encapsulate + // their own Tracers. + tp1 := subjectFactory() + tp2 := subjectFactory() + + done1 := runner(tp1) + done2 := runner(tp2) + + <-done1 + <-done2 + }).NotToPanic() + }) + }) +} + +// TestTracer runs validation tests for an implementation of the OpenTelemetry +// Tracer API. +func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("propagates the original context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctxKey := testCtxKey{} + ctxValue := "ctx value" + ctx := context.WithValue(context.Background(), ctxKey, ctxValue) + + ctx, _ = subject.Start(ctx, "test") + + e.Expect(ctx.Value(ctxKey)).ToEqual(ctxValue) + }) + + t.Run("returns a span containing the expected properties", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + + e.Expect(span.SpanContext().IsValid()).ToBeTrue() + }) + + t.Run("stores the span on the provided context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + e.Expect(span.SpanContext()).NotToEqual(trace.SpanContext{}) + e.Expect(trace.SpanFromContext(ctx)).ToEqual(span) + }) + + t.Run("starts spans with unique trace and span IDs", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span1 := subject.Start(context.Background(), "span1") + _, span2 := subject.Start(context.Background(), "span2") + + sc1 := span1.SpanContext() + sc2 := span2.SpanContext() + + e.Expect(sc1.TraceID()).NotToEqual(sc2.TraceID()) + e.Expect(sc1.SpanID()).NotToEqual(sc2.SpanID()) + }) + + t.Run("propagates a parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child") + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child", trace.WithNewRoot()) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("propagates remote parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child") + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores remote parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child", trace.WithNewRoot()) + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + tracer := subjectFactory() + + ctx, parent := tracer.Start(context.Background(), "span") + + runner := func(tp trace.Tracer) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.Tracer) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name string) { + defer wg.Done() + _, child := tp.Start(ctx, name) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }(fmt.Sprintf("span %d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + e.Expect(func() { + done := runner(tracer) + + <-done + }).NotToPanic() + }) + }) + + h.testSpan(subjectFactory) +} + +func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { + var methods = map[string]func(span trace.Span){ + "#End": func(span trace.Span) { + span.End() + }, + "#AddEvent": func(span trace.Span) { + span.AddEvent("test event") + }, + "#AddEventWithTimestamp": func(span trace.Span) { + span.AddEvent("test event", trace.WithTimestamp(time.Now().Add(1*time.Second))) + }, + "#SetStatus": func(span trace.Span) { + span.SetStatus(codes.Error, "internal") + }, + "#SetName": func(span trace.Span) { + span.SetName("new name") + }, + "#SetAttributes": func(span trace.Span) { + span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) + }, + } + var mechanisms = map[string]func() trace.Span{ + "Span created via Tracer#Start": func() trace.Span { + tracer := tracerFactory() + _, subject := tracer.Start(context.Background(), "test") + + return subject + }, + "Span created via span.TracerProvider()": func() trace.Span { + ctx, spanA := tracerFactory().Start(context.Background(), "span1") + + _, spanB := spanA.TracerProvider().Tracer("second").Start(ctx, "span2") + return spanB + }, + } + + for mechanismName, mechanism := range mechanisms { + h.t.Run(mechanismName, func(t *testing.T) { + for methodName, method := range methods { + t.Run(methodName, func(t *testing.T) { + t.Run("is thread-safe", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + wg := &sync.WaitGroup{} + wg.Add(2) + + go func() { + defer wg.Done() + + method(span) + }() + + go func() { + defer wg.Done() + + method(span) + }() + + wg.Wait() + }) + }) + } + + t.Run("#End", func(t *testing.T) { + t.Run("can be called multiple times", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + span.End() + span.End() + }) + }) + }) + } +} + +type testCtxKey struct{} diff --git a/exporters/zipkin/internal/internaltest/text_map_carrier.go b/exporters/zipkin/internal/internaltest/text_map_carrier.go new file mode 100644 index 00000000000..ac70986fffa --- /dev/null +++ b/exporters/zipkin/internal/internaltest/text_map_carrier.go @@ -0,0 +1,144 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +import ( + "sync" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +// TextMapCarrier is a storage medium for a TextMapPropagator used in testing. +// The methods of a TextMapCarrier are concurrent safe. +type TextMapCarrier struct { + mtx sync.Mutex + + gets []string + sets [][2]string + data map[string]string +} + +var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil) + +// NewTextMapCarrier returns a new *TextMapCarrier populated with data. +func NewTextMapCarrier(data map[string]string) *TextMapCarrier { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + return &TextMapCarrier{data: copied} +} + +// Keys returns the keys for which this carrier has a value. +func (c *TextMapCarrier) Keys() []string { + c.mtx.Lock() + defer c.mtx.Unlock() + + result := make([]string, 0, len(c.data)) + for k := range c.data { + result = append(result, k) + } + return result +} + +// Get returns the value associated with the passed key. +func (c *TextMapCarrier) Get(key string) string { + c.mtx.Lock() + defer c.mtx.Unlock() + c.gets = append(c.gets, key) + return c.data[key] +} + +// GotKey tests if c.Get has been called for key. +func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + for _, k := range c.gets { + if k == key { + return true + } + } + t.Errorf("TextMapCarrier.Get(%q) has not been called", key) + return false +} + +// GotN tests if n calls to c.Get have been made. +func (c *TextMapCarrier) GotN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.gets) != n { + t.Errorf("TextMapCarrier.Get was called %d times, not %d", len(c.gets), n) + return false + } + return true +} + +// Set stores the key-value pair. +func (c *TextMapCarrier) Set(key, value string) { + c.mtx.Lock() + defer c.mtx.Unlock() + c.sets = append(c.sets, [2]string{key, value}) + c.data[key] = value +} + +// SetKeyValue tests if c.Set has been called for the key-value pair. +func (c *TextMapCarrier) SetKeyValue(t *testing.T, key, value string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + var vals []string + for _, pair := range c.sets { + if key == pair[0] { + if value == pair[1] { + return true + } + vals = append(vals, pair[1]) + } + } + if len(vals) > 0 { + t.Errorf("TextMapCarrier.Set called with %q and %v values, but not %s", key, vals, value) + } + t.Errorf("TextMapCarrier.Set(%q,%q) has not been called", key, value) + return false +} + +// SetN tests if n calls to c.Set have been made. +func (c *TextMapCarrier) SetN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.sets) != n { + t.Errorf("TextMapCarrier.Set was called %d times, not %d", len(c.sets), n) + return false + } + return true +} + +// Reset zeros out the recording state and sets the carried values to data. +func (c *TextMapCarrier) Reset(data map[string]string) { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + + c.mtx.Lock() + defer c.mtx.Unlock() + + c.gets = nil + c.sets = nil + c.data = copied +} diff --git a/exporters/zipkin/internal/internaltest/text_map_carrier_test.go b/exporters/zipkin/internal/internaltest/text_map_carrier_test.go new file mode 100644 index 00000000000..faf713cc2d0 --- /dev/null +++ b/exporters/zipkin/internal/internaltest/text_map_carrier_test.go @@ -0,0 +1,86 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "reflect" + "testing" +) + +var ( + key, value = "test", "true" +) + +func TestTextMapCarrierKeys(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + expected, actual := []string{key}, tmc.Keys() + if !reflect.DeepEqual(actual, expected) { + t.Errorf("expected tmc.Keys() to be %v but it was %v", expected, actual) + } +} + +func TestTextMapCarrierGet(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + if got := tmc.Get("empty"); got != "" { + t.Errorf("TextMapCarrier.Get returned %q for an empty key", got) + } + tmc.GotKey(t, "empty") + tmc.GotN(t, 1) + if got := tmc.Get(key); got != value { + t.Errorf("TextMapCarrier.Get(%q) returned %q, want %q", key, got, value) + } + tmc.GotKey(t, key) + tmc.GotN(t, 2) +} + +func TestTextMapCarrierSet(t *testing.T) { + tmc := NewTextMapCarrier(nil) + tmc.SetN(t, 0) + tmc.Set(key, value) + if got, ok := tmc.data[key]; !ok { + t.Errorf("TextMapCarrier.Set(%q,%q) failed to store pair", key, value) + } else if got != value { + t.Errorf("TextMapCarrier.Set(%q,%q) stored (%q,%q), not (%q,%q)", key, value, key, got, key, value) + } + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) +} + +func TestTextMapCarrierReset(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear initial data") + } + tmc.GotN(t, 1) + tmc.GotKey(t, key) + tmc.Set(key, value) + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear data") + } +} diff --git a/exporters/zipkin/internal/internaltest/text_map_propagator.go b/exporters/zipkin/internal/internaltest/text_map_propagator.go new file mode 100644 index 00000000000..f22e7ffaa3c --- /dev/null +++ b/exporters/zipkin/internal/internaltest/text_map_propagator.go @@ -0,0 +1,115 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" + +import ( + "context" + "fmt" + "strconv" + "strings" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +type ctxKeyType string + +type state struct { + Injections uint64 + Extractions uint64 +} + +func newState(encoded string) state { + if encoded == "" { + return state{} + } + s0, s1, _ := strings.Cut(encoded, ",") + injects, _ := strconv.ParseUint(s0, 10, 64) + extracts, _ := strconv.ParseUint(s1, 10, 64) + return state{ + Injections: injects, + Extractions: extracts, + } +} + +func (s state) String() string { + return fmt.Sprintf("%d,%d", s.Injections, s.Extractions) +} + +// TextMapPropagator is a propagation.TextMapPropagator used for testing. +type TextMapPropagator struct { + name string + ctxKey ctxKeyType +} + +var _ propagation.TextMapPropagator = (*TextMapPropagator)(nil) + +// NewTextMapPropagator returns a new TextMapPropagator for testing. It will +// use name as the key it injects into a TextMapCarrier when Inject is called. +func NewTextMapPropagator(name string) *TextMapPropagator { + return &TextMapPropagator{name: name, ctxKey: ctxKeyType(name)} +} + +func (p *TextMapPropagator) stateFromContext(ctx context.Context) state { + if v := ctx.Value(p.ctxKey); v != nil { + if s, ok := v.(state); ok { + return s + } + } + return state{} +} + +func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state { + return newState(carrier.Get(p.name)) +} + +// Inject sets cross-cutting concerns for p from ctx into carrier. +func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + s := p.stateFromContext(ctx) + s.Injections++ + carrier.Set(p.name, s.String()) +} + +// InjectedN tests if p has made n injections to carrier. +func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n int) bool { + if actual := p.stateFromCarrier(carrier).Injections; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} injected %d times, not %d", p.name, actual, n) + return false + } + return true +} + +// Extract reads cross-cutting concerns for p from carrier into ctx. +func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + s := p.stateFromCarrier(carrier) + s.Extractions++ + return context.WithValue(ctx, p.ctxKey, s) +} + +// ExtractedN tests if p has made n extractions from the lineage of ctx. +// nolint (context is not first arg) +func (p *TextMapPropagator) ExtractedN(t *testing.T, ctx context.Context, n int) bool { + if actual := p.stateFromContext(ctx).Extractions; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} extracted %d time, not %d", p.name, actual, n) + return false + } + return true +} + +// Fields returns the name of p as the key who's value is set with Inject. +func (p *TextMapPropagator) Fields() []string { return []string{p.name} } diff --git a/exporters/zipkin/internal/internaltest/text_map_propagator_test.go b/exporters/zipkin/internal/internaltest/text_map_propagator_test.go new file mode 100644 index 00000000000..babcc95fc1b --- /dev/null +++ b/exporters/zipkin/internal/internaltest/text_map_propagator_test.go @@ -0,0 +1,72 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "testing" +) + +func TestTextMapPropagatorInjectExtract(t *testing.T) { + name := "testing" + ctx := context.Background() + carrier := NewTextMapCarrier(map[string]string{name: value}) + propagator := NewTextMapPropagator(name) + + propagator.Inject(ctx, carrier) + // Carrier value overridden with state. + if carrier.SetKeyValue(t, name, "1,0") { + // Ensure nothing has been extracted yet. + propagator.ExtractedN(t, ctx, 0) + // Test the injection was counted. + propagator.InjectedN(t, carrier, 1) + } + + ctx = propagator.Extract(ctx, carrier) + v := ctx.Value(ctxKeyType(name)) + if v == nil { + t.Error("TextMapPropagator.Extract failed to extract state") + } + if s, ok := v.(state); !ok { + t.Error("TextMapPropagator.Extract did not extract proper state") + } else if s.Extractions != 1 { + t.Error("TextMapPropagator.Extract did not increment state.Extractions") + } + if carrier.GotKey(t, name) { + // Test the extraction was counted. + propagator.ExtractedN(t, ctx, 1) + // Ensure no additional injection was recorded. + propagator.InjectedN(t, carrier, 1) + } +} + +func TestTextMapPropagatorFields(t *testing.T) { + name := "testing" + propagator := NewTextMapPropagator(name) + if got := propagator.Fields(); len(got) != 1 { + t.Errorf("TextMapPropagator.Fields returned %d fields, want 1", len(got)) + } else if got[0] != name { + t.Errorf("TextMapPropagator.Fields returned %q, want %q", got[0], name) + } +} + +func TestNewStateEmpty(t *testing.T) { + if want, got := (state{}), newState(""); got != want { + t.Errorf("newState(\"\") returned %v, want %v", got, want) + } +} diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index eff980b0489..cc90b5f789d 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -27,7 +27,7 @@ import ( "testing" "time" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" "github.com/go-logr/logr/funcr" zkmodel "github.com/openzipkin/zipkin-go/model" diff --git a/internal/internaltest/alignment.go b/internal/internaltest/alignment.go index f14208eff96..165fc443aff 100644 --- a/internal/internaltest/alignment.go +++ b/internal/internaltest/alignment.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/alignment.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/env.go b/internal/internaltest/env.go index 6304d06df92..d30eeb123c7 100644 --- a/internal/internaltest/env.go +++ b/internal/internaltest/env.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/env_test.go b/internal/internaltest/env_test.go index 74b15abc476..dc4dcea8e30 100644 --- a/internal/internaltest/env_test.go +++ b/internal/internaltest/env_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/errors.go b/internal/internaltest/errors.go index 462d0f99d8f..30ea672e440 100644 --- a/internal/internaltest/errors.go +++ b/internal/internaltest/errors.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/errors.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/gen.go b/internal/internaltest/gen.go new file mode 100644 index 00000000000..252143b5bee --- /dev/null +++ b/internal/internaltest/gen.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/internal/internaltest" + +//go:generate gotmpl --body=../shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go +//go:generate gotmpl --body=../shared/internaltest/env.go.tmpl "--data={}" --out=env.go +//go:generate gotmpl --body=../shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go +//go:generate gotmpl --body=../shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go +//go:generate gotmpl --body=../shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go +//go:generate gotmpl --body=../shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go +//go:generate gotmpl --body=../shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go +//go:generate gotmpl --body=../shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go +//go:generate gotmpl --body=../shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/internal/internaltest/harness.go b/internal/internaltest/harness.go index 88306803244..e84eed9e719 100644 --- a/internal/internaltest/harness.go +++ b/internal/internaltest/harness.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/harness.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/text_map_carrier.go b/internal/internaltest/text_map_carrier.go index 6aa47d9bb1b..9ca585df7ef 100644 --- a/internal/internaltest/text_map_carrier.go +++ b/internal/internaltest/text_map_carrier.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/text_map_carrier_test.go b/internal/internaltest/text_map_carrier_test.go index 9f8832869b6..faf713cc2d0 100644 --- a/internal/internaltest/text_map_carrier_test.go +++ b/internal/internaltest/text_map_carrier_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/text_map_propagator.go b/internal/internaltest/text_map_propagator.go index 4a4743cad9e..6c7bc464d9f 100644 --- a/internal/internaltest/text_map_propagator.go +++ b/internal/internaltest/text_map_propagator.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/internaltest/text_map_propagator_test.go b/internal/internaltest/text_map_propagator_test.go index 7332787f62e..babcc95fc1b 100644 --- a/internal/internaltest/text_map_propagator_test.go +++ b/internal/internaltest/text_map_propagator_test.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/shared/internaltest/alignment.go.tmpl b/internal/shared/internaltest/alignment.go.tmpl new file mode 100644 index 00000000000..9ce5d2d14e3 --- /dev/null +++ b/internal/shared/internaltest/alignment.go.tmpl @@ -0,0 +1,74 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/alignment.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +/* +This file contains common utilities and objects to validate memory alignment +of Go types. The primary use of this functionality is intended to ensure +`struct` fields that need to be 64-bit aligned so they can be passed as +arguments to 64-bit atomic operations. + +The common workflow is to define a slice of `FieldOffset` and pass them to the +`Aligned8Byte` function from within a `TestMain` function from a package's +tests. It is important to make this call from the `TestMain` function prior +to running the rest of the test suit as it can provide useful diagnostics +about field alignment instead of ambiguous nil pointer dereference and runtime +panic. + +For more information: +https://github.com/open-telemetry/opentelemetry-go/issues/341 +*/ + +import ( + "fmt" + "io" +) + +// FieldOffset is a preprocessor representation of a struct field alignment. +type FieldOffset struct { + // Name of the field. + Name string + + // Offset of the field in bytes. + // + // To compute this at compile time use unsafe.Offsetof. + Offset uintptr +} + +// Aligned8Byte returns if all fields are aligned modulo 8-bytes. +// +// Error messaging is printed to out for any field determined misaligned. +func Aligned8Byte(fields []FieldOffset, out io.Writer) bool { + misaligned := make([]FieldOffset, 0) + for _, f := range fields { + if f.Offset%8 != 0 { + misaligned = append(misaligned, f) + } + } + + if len(misaligned) == 0 { + return true + } + + fmt.Fprintln(out, "struct fields not aligned for 64-bit atomic operations:") + for _, f := range misaligned { + fmt.Fprintf(out, " %s: %d-byte offset\n", f.Name, f.Offset) + } + + return false +} diff --git a/internal/shared/internaltest/env.go.tmpl b/internal/shared/internaltest/env.go.tmpl new file mode 100644 index 00000000000..e4583451b7d --- /dev/null +++ b/internal/shared/internaltest/env.go.tmpl @@ -0,0 +1,101 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "os" +) + +type Env struct { + Name string + Value string + Exists bool +} + +// EnvStore stores and recovers environment variables. +type EnvStore interface { + // Records the environment variable into the store. + Record(key string) + + // Restore recovers the environment variables in the store. + Restore() error +} + +var _ EnvStore = (*envStore)(nil) + +type envStore struct { + store map[string]Env +} + +func (s *envStore) add(env Env) { + s.store[env.Name] = env +} + +func (s *envStore) Restore() error { + var err error + for _, v := range s.store { + if v.Exists { + err = os.Setenv(v.Name, v.Value) + } else { + err = os.Unsetenv(v.Name) + } + if err != nil { + return err + } + } + return nil +} + +func (s *envStore) setEnv(key, value string) error { + s.Record(key) + + err := os.Setenv(key, value) + if err != nil { + return err + } + return nil +} + +func (s *envStore) Record(key string) { + originValue, exists := os.LookupEnv(key) + s.add(Env{ + Name: key, + Value: originValue, + Exists: exists, + }) +} + +func NewEnvStore() EnvStore { + return newEnvStore() +} + +func newEnvStore() *envStore { + return &envStore{store: make(map[string]Env)} +} + +func SetEnvVariables(env map[string]string) (EnvStore, error) { + envStore := newEnvStore() + + for k, v := range env { + err := envStore.setEnv(k, v) + if err != nil { + return nil, err + } + } + return envStore, nil +} diff --git a/internal/shared/internaltest/env_test.go.tmpl b/internal/shared/internaltest/env_test.go.tmpl new file mode 100644 index 00000000000..dc4dcea8e30 --- /dev/null +++ b/internal/shared/internaltest/env_test.go.tmpl @@ -0,0 +1,237 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type EnvStoreTestSuite struct { + suite.Suite +} + +func (s *EnvStoreTestSuite) Test_add() { + envStore := newEnvStore() + + e := Env{ + Name: "name", + Value: "value", + Exists: true, + } + envStore.add(e) + envStore.add(e) + + s.Assert().Len(envStore.store, 1) +} + +func (s *EnvStoreTestSuite) TestRecord() { + testCases := []struct { + name string + env Env + expectedEnvStore *envStore + }{ + { + name: "record exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "value", + Exists: true, + }, + }}, + }, + { + name: "record exists env, but its value is empty", + env: Env{ + Name: "name", + Value: "", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "", + Exists: true, + }, + }}, + }, + { + name: "record not exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Exists: false, + }, + }}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if tc.env.Exists { + s.Assert().NoError(os.Setenv(tc.env.Name, tc.env.Value)) + } + + envStore := newEnvStore() + envStore.Record(tc.env.Name) + + s.Assert().Equal(tc.expectedEnvStore, envStore) + + if tc.env.Exists { + s.Assert().NoError(os.Unsetenv(tc.env.Name)) + } + }) + } +} + +func (s *EnvStoreTestSuite) TestRestore() { + testCases := []struct { + name string + env Env + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + { + name: "no exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvExists: false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + envStore.add(tc.env) + + // Backup + backup := newEnvStore() + backup.Record(tc.env.Name) + + s.Require().NoError(os.Unsetenv(tc.env.Name)) + + s.Assert().NoError(envStore.Restore()) + v, exists := os.LookupEnv(tc.env.Name) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func (s *EnvStoreTestSuite) Test_setEnv() { + testCases := []struct { + name string + key string + value string + expectedEnvStore *envStore + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "normal", + key: "name", + value: "value", + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "other value", + Exists: true, + }, + }}, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + + // Backup + backup := newEnvStore() + backup.Record(tc.key) + + s.Require().NoError(os.Setenv(tc.key, "other value")) + + s.Assert().NoError(envStore.setEnv(tc.key, tc.value)) + s.Assert().Equal(tc.expectedEnvStore, envStore) + v, exists := os.LookupEnv(tc.key) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func TestEnvStoreTestSuite(t *testing.T) { + suite.Run(t, new(EnvStoreTestSuite)) +} + +func TestSetEnvVariables(t *testing.T) { + envs := map[string]string{ + "name1": "value1", + "name2": "value2", + } + + // Backup + backup := newEnvStore() + for k := range envs { + backup.Record(k) + } + defer func() { + require.NoError(t, backup.Restore()) + }() + + store, err := SetEnvVariables(envs) + assert.NoError(t, err) + require.IsType(t, &envStore{}, store) + concreteStore := store.(*envStore) + assert.Len(t, concreteStore.store, 2) + assert.Equal(t, backup, concreteStore) +} diff --git a/internal/shared/internaltest/errors.go.tmpl b/internal/shared/internaltest/errors.go.tmpl new file mode 100644 index 00000000000..bfaf86d51ea --- /dev/null +++ b/internal/shared/internaltest/errors.go.tmpl @@ -0,0 +1,30 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/errors.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +type TestError string + +var _ error = TestError("") + +func NewTestError(s string) error { + return TestError(s) +} + +func (e TestError) Error() string { + return string(e) +} diff --git a/internal/shared/internaltest/harness.go.tmpl b/internal/shared/internaltest/harness.go.tmpl new file mode 100644 index 00000000000..ced44588894 --- /dev/null +++ b/internal/shared/internaltest/harness.go.tmpl @@ -0,0 +1,344 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/harness.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/trace" +) + +// Harness is a testing harness used to test implementations of the +// OpenTelemetry API. +type Harness struct { + t *testing.T +} + +// NewHarness returns an instantiated *Harness using t. +func NewHarness(t *testing.T) *Harness { + return &Harness{ + t: t, + } +} + +// TestTracerProvider runs validation tests for an implementation of the OpenTelemetry +// TracerProvider API. +func (h *Harness) TestTracerProvider(subjectFactory func() trace.TracerProvider) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("allow creating an arbitrary number of TracerProvider instances", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + + tp1 := subjectFactory() + tp2 := subjectFactory() + + e.Expect(tp1).NotToEqual(tp2) + }) + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + runner := func(tp trace.TracerProvider) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.TracerProvider) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name, version string) { + _ = tp.Tracer(name, trace.WithInstrumentationVersion(version)) + wg.Done() + }(fmt.Sprintf("tracer %d", i%5), fmt.Sprintf("%d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + matchers.NewExpecter(t).Expect(func() { + // Run with multiple TracerProvider to ensure they encapsulate + // their own Tracers. + tp1 := subjectFactory() + tp2 := subjectFactory() + + done1 := runner(tp1) + done2 := runner(tp2) + + <-done1 + <-done2 + }).NotToPanic() + }) + }) +} + +// TestTracer runs validation tests for an implementation of the OpenTelemetry +// Tracer API. +func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("propagates the original context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctxKey := testCtxKey{} + ctxValue := "ctx value" + ctx := context.WithValue(context.Background(), ctxKey, ctxValue) + + ctx, _ = subject.Start(ctx, "test") + + e.Expect(ctx.Value(ctxKey)).ToEqual(ctxValue) + }) + + t.Run("returns a span containing the expected properties", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + + e.Expect(span.SpanContext().IsValid()).ToBeTrue() + }) + + t.Run("stores the span on the provided context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + e.Expect(span.SpanContext()).NotToEqual(trace.SpanContext{}) + e.Expect(trace.SpanFromContext(ctx)).ToEqual(span) + }) + + t.Run("starts spans with unique trace and span IDs", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span1 := subject.Start(context.Background(), "span1") + _, span2 := subject.Start(context.Background(), "span2") + + sc1 := span1.SpanContext() + sc2 := span2.SpanContext() + + e.Expect(sc1.TraceID()).NotToEqual(sc2.TraceID()) + e.Expect(sc1.SpanID()).NotToEqual(sc2.SpanID()) + }) + + t.Run("propagates a parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child") + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child", trace.WithNewRoot()) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("propagates remote parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child") + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores remote parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child", trace.WithNewRoot()) + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + tracer := subjectFactory() + + ctx, parent := tracer.Start(context.Background(), "span") + + runner := func(tp trace.Tracer) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.Tracer) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name string) { + defer wg.Done() + _, child := tp.Start(ctx, name) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }(fmt.Sprintf("span %d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + e.Expect(func() { + done := runner(tracer) + + <-done + }).NotToPanic() + }) + }) + + h.testSpan(subjectFactory) +} + +func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { + var methods = map[string]func(span trace.Span){ + "#End": func(span trace.Span) { + span.End() + }, + "#AddEvent": func(span trace.Span) { + span.AddEvent("test event") + }, + "#AddEventWithTimestamp": func(span trace.Span) { + span.AddEvent("test event", trace.WithTimestamp(time.Now().Add(1*time.Second))) + }, + "#SetStatus": func(span trace.Span) { + span.SetStatus(codes.Error, "internal") + }, + "#SetName": func(span trace.Span) { + span.SetName("new name") + }, + "#SetAttributes": func(span trace.Span) { + span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) + }, + } + var mechanisms = map[string]func() trace.Span{ + "Span created via Tracer#Start": func() trace.Span { + tracer := tracerFactory() + _, subject := tracer.Start(context.Background(), "test") + + return subject + }, + "Span created via span.TracerProvider()": func() trace.Span { + ctx, spanA := tracerFactory().Start(context.Background(), "span1") + + _, spanB := spanA.TracerProvider().Tracer("second").Start(ctx, "span2") + return spanB + }, + } + + for mechanismName, mechanism := range mechanisms { + h.t.Run(mechanismName, func(t *testing.T) { + for methodName, method := range methods { + t.Run(methodName, func(t *testing.T) { + t.Run("is thread-safe", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + wg := &sync.WaitGroup{} + wg.Add(2) + + go func() { + defer wg.Done() + + method(span) + }() + + go func() { + defer wg.Done() + + method(span) + }() + + wg.Wait() + }) + }) + } + + t.Run("#End", func(t *testing.T) { + t.Run("can be called multiple times", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + span.End() + span.End() + }) + }) + }) + } +} + +type testCtxKey struct{} diff --git a/internal/shared/internaltest/text_map_carrier.go.tmpl b/internal/shared/internaltest/text_map_carrier.go.tmpl new file mode 100644 index 00000000000..f80d4e2c767 --- /dev/null +++ b/internal/shared/internaltest/text_map_carrier.go.tmpl @@ -0,0 +1,144 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "sync" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +// TextMapCarrier is a storage medium for a TextMapPropagator used in testing. +// The methods of a TextMapCarrier are concurrent safe. +type TextMapCarrier struct { + mtx sync.Mutex + + gets []string + sets [][2]string + data map[string]string +} + +var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil) + +// NewTextMapCarrier returns a new *TextMapCarrier populated with data. +func NewTextMapCarrier(data map[string]string) *TextMapCarrier { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + return &TextMapCarrier{data: copied} +} + +// Keys returns the keys for which this carrier has a value. +func (c *TextMapCarrier) Keys() []string { + c.mtx.Lock() + defer c.mtx.Unlock() + + result := make([]string, 0, len(c.data)) + for k := range c.data { + result = append(result, k) + } + return result +} + +// Get returns the value associated with the passed key. +func (c *TextMapCarrier) Get(key string) string { + c.mtx.Lock() + defer c.mtx.Unlock() + c.gets = append(c.gets, key) + return c.data[key] +} + +// GotKey tests if c.Get has been called for key. +func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + for _, k := range c.gets { + if k == key { + return true + } + } + t.Errorf("TextMapCarrier.Get(%q) has not been called", key) + return false +} + +// GotN tests if n calls to c.Get have been made. +func (c *TextMapCarrier) GotN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.gets) != n { + t.Errorf("TextMapCarrier.Get was called %d times, not %d", len(c.gets), n) + return false + } + return true +} + +// Set stores the key-value pair. +func (c *TextMapCarrier) Set(key, value string) { + c.mtx.Lock() + defer c.mtx.Unlock() + c.sets = append(c.sets, [2]string{key, value}) + c.data[key] = value +} + +// SetKeyValue tests if c.Set has been called for the key-value pair. +func (c *TextMapCarrier) SetKeyValue(t *testing.T, key, value string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + var vals []string + for _, pair := range c.sets { + if key == pair[0] { + if value == pair[1] { + return true + } + vals = append(vals, pair[1]) + } + } + if len(vals) > 0 { + t.Errorf("TextMapCarrier.Set called with %q and %v values, but not %s", key, vals, value) + } + t.Errorf("TextMapCarrier.Set(%q,%q) has not been called", key, value) + return false +} + +// SetN tests if n calls to c.Set have been made. +func (c *TextMapCarrier) SetN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.sets) != n { + t.Errorf("TextMapCarrier.Set was called %d times, not %d", len(c.sets), n) + return false + } + return true +} + +// Reset zeros out the recording state and sets the carried values to data. +func (c *TextMapCarrier) Reset(data map[string]string) { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + + c.mtx.Lock() + defer c.mtx.Unlock() + + c.gets = nil + c.sets = nil + c.data = copied +} diff --git a/internal/shared/internaltest/text_map_carrier_test.go.tmpl b/internal/shared/internaltest/text_map_carrier_test.go.tmpl new file mode 100644 index 00000000000..faf713cc2d0 --- /dev/null +++ b/internal/shared/internaltest/text_map_carrier_test.go.tmpl @@ -0,0 +1,86 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "reflect" + "testing" +) + +var ( + key, value = "test", "true" +) + +func TestTextMapCarrierKeys(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + expected, actual := []string{key}, tmc.Keys() + if !reflect.DeepEqual(actual, expected) { + t.Errorf("expected tmc.Keys() to be %v but it was %v", expected, actual) + } +} + +func TestTextMapCarrierGet(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + if got := tmc.Get("empty"); got != "" { + t.Errorf("TextMapCarrier.Get returned %q for an empty key", got) + } + tmc.GotKey(t, "empty") + tmc.GotN(t, 1) + if got := tmc.Get(key); got != value { + t.Errorf("TextMapCarrier.Get(%q) returned %q, want %q", key, got, value) + } + tmc.GotKey(t, key) + tmc.GotN(t, 2) +} + +func TestTextMapCarrierSet(t *testing.T) { + tmc := NewTextMapCarrier(nil) + tmc.SetN(t, 0) + tmc.Set(key, value) + if got, ok := tmc.data[key]; !ok { + t.Errorf("TextMapCarrier.Set(%q,%q) failed to store pair", key, value) + } else if got != value { + t.Errorf("TextMapCarrier.Set(%q,%q) stored (%q,%q), not (%q,%q)", key, value, key, got, key, value) + } + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) +} + +func TestTextMapCarrierReset(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear initial data") + } + tmc.GotN(t, 1) + tmc.GotKey(t, key) + tmc.Set(key, value) + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear data") + } +} diff --git a/internal/shared/internaltest/text_map_propagator.go.tmpl b/internal/shared/internaltest/text_map_propagator.go.tmpl new file mode 100644 index 00000000000..0c3a33cb1d7 --- /dev/null +++ b/internal/shared/internaltest/text_map_propagator.go.tmpl @@ -0,0 +1,115 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "fmt" + "strconv" + "strings" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +type ctxKeyType string + +type state struct { + Injections uint64 + Extractions uint64 +} + +func newState(encoded string) state { + if encoded == "" { + return state{} + } + s0, s1, _ := strings.Cut(encoded, ",") + injects, _ := strconv.ParseUint(s0, 10, 64) + extracts, _ := strconv.ParseUint(s1, 10, 64) + return state{ + Injections: injects, + Extractions: extracts, + } +} + +func (s state) String() string { + return fmt.Sprintf("%d,%d", s.Injections, s.Extractions) +} + +// TextMapPropagator is a propagation.TextMapPropagator used for testing. +type TextMapPropagator struct { + name string + ctxKey ctxKeyType +} + +var _ propagation.TextMapPropagator = (*TextMapPropagator)(nil) + +// NewTextMapPropagator returns a new TextMapPropagator for testing. It will +// use name as the key it injects into a TextMapCarrier when Inject is called. +func NewTextMapPropagator(name string) *TextMapPropagator { + return &TextMapPropagator{name: name, ctxKey: ctxKeyType(name)} +} + +func (p *TextMapPropagator) stateFromContext(ctx context.Context) state { + if v := ctx.Value(p.ctxKey); v != nil { + if s, ok := v.(state); ok { + return s + } + } + return state{} +} + +func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state { + return newState(carrier.Get(p.name)) +} + +// Inject sets cross-cutting concerns for p from ctx into carrier. +func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + s := p.stateFromContext(ctx) + s.Injections++ + carrier.Set(p.name, s.String()) +} + +// InjectedN tests if p has made n injections to carrier. +func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n int) bool { + if actual := p.stateFromCarrier(carrier).Injections; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} injected %d times, not %d", p.name, actual, n) + return false + } + return true +} + +// Extract reads cross-cutting concerns for p from carrier into ctx. +func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + s := p.stateFromCarrier(carrier) + s.Extractions++ + return context.WithValue(ctx, p.ctxKey, s) +} + +// ExtractedN tests if p has made n extractions from the lineage of ctx. +// nolint (context is not first arg) +func (p *TextMapPropagator) ExtractedN(t *testing.T, ctx context.Context, n int) bool { + if actual := p.stateFromContext(ctx).Extractions; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} extracted %d time, not %d", p.name, actual, n) + return false + } + return true +} + +// Fields returns the name of p as the key who's value is set with Inject. +func (p *TextMapPropagator) Fields() []string { return []string{p.name} } diff --git a/internal/shared/internaltest/text_map_propagator_test.go.tmpl b/internal/shared/internaltest/text_map_propagator_test.go.tmpl new file mode 100644 index 00000000000..babcc95fc1b --- /dev/null +++ b/internal/shared/internaltest/text_map_propagator_test.go.tmpl @@ -0,0 +1,72 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "testing" +) + +func TestTextMapPropagatorInjectExtract(t *testing.T) { + name := "testing" + ctx := context.Background() + carrier := NewTextMapCarrier(map[string]string{name: value}) + propagator := NewTextMapPropagator(name) + + propagator.Inject(ctx, carrier) + // Carrier value overridden with state. + if carrier.SetKeyValue(t, name, "1,0") { + // Ensure nothing has been extracted yet. + propagator.ExtractedN(t, ctx, 0) + // Test the injection was counted. + propagator.InjectedN(t, carrier, 1) + } + + ctx = propagator.Extract(ctx, carrier) + v := ctx.Value(ctxKeyType(name)) + if v == nil { + t.Error("TextMapPropagator.Extract failed to extract state") + } + if s, ok := v.(state); !ok { + t.Error("TextMapPropagator.Extract did not extract proper state") + } else if s.Extractions != 1 { + t.Error("TextMapPropagator.Extract did not increment state.Extractions") + } + if carrier.GotKey(t, name) { + // Test the extraction was counted. + propagator.ExtractedN(t, ctx, 1) + // Ensure no additional injection was recorded. + propagator.InjectedN(t, carrier, 1) + } +} + +func TestTextMapPropagatorFields(t *testing.T) { + name := "testing" + propagator := NewTextMapPropagator(name) + if got := propagator.Fields(); len(got) != 1 { + t.Errorf("TextMapPropagator.Fields returned %d fields, want 1", len(got)) + } else if got[0] != name { + t.Errorf("TextMapPropagator.Fields returned %q, want %q", got[0], name) + } +} + +func TestNewStateEmpty(t *testing.T) { + if want, got := (state{}), newState(""); got != want { + t.Errorf("newState(\"\") returned %v, want %v", got, want) + } +} diff --git a/sdk/internal/env/env_test.go b/sdk/internal/env/env_test.go index c2b3b743703..06da1f5a9e1 100644 --- a/sdk/internal/env/env_test.go +++ b/sdk/internal/env/env_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" ) func TestEnvParse(t *testing.T) { diff --git a/sdk/internal/internaltest/alignment.go b/sdk/internal/internaltest/alignment.go new file mode 100644 index 00000000000..b75e19b2042 --- /dev/null +++ b/sdk/internal/internaltest/alignment.go @@ -0,0 +1,74 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/alignment.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +/* +This file contains common utilities and objects to validate memory alignment +of Go types. The primary use of this functionality is intended to ensure +`struct` fields that need to be 64-bit aligned so they can be passed as +arguments to 64-bit atomic operations. + +The common workflow is to define a slice of `FieldOffset` and pass them to the +`Aligned8Byte` function from within a `TestMain` function from a package's +tests. It is important to make this call from the `TestMain` function prior +to running the rest of the test suit as it can provide useful diagnostics +about field alignment instead of ambiguous nil pointer dereference and runtime +panic. + +For more information: +https://github.com/open-telemetry/opentelemetry-go/issues/341 +*/ + +import ( + "fmt" + "io" +) + +// FieldOffset is a preprocessor representation of a struct field alignment. +type FieldOffset struct { + // Name of the field. + Name string + + // Offset of the field in bytes. + // + // To compute this at compile time use unsafe.Offsetof. + Offset uintptr +} + +// Aligned8Byte returns if all fields are aligned modulo 8-bytes. +// +// Error messaging is printed to out for any field determined misaligned. +func Aligned8Byte(fields []FieldOffset, out io.Writer) bool { + misaligned := make([]FieldOffset, 0) + for _, f := range fields { + if f.Offset%8 != 0 { + misaligned = append(misaligned, f) + } + } + + if len(misaligned) == 0 { + return true + } + + fmt.Fprintln(out, "struct fields not aligned for 64-bit atomic operations:") + for _, f := range misaligned { + fmt.Fprintf(out, " %s: %d-byte offset\n", f.Name, f.Offset) + } + + return false +} diff --git a/sdk/internal/internaltest/env.go b/sdk/internal/internaltest/env.go new file mode 100644 index 00000000000..3bdbef110b3 --- /dev/null +++ b/sdk/internal/internaltest/env.go @@ -0,0 +1,101 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +import ( + "os" +) + +type Env struct { + Name string + Value string + Exists bool +} + +// EnvStore stores and recovers environment variables. +type EnvStore interface { + // Records the environment variable into the store. + Record(key string) + + // Restore recovers the environment variables in the store. + Restore() error +} + +var _ EnvStore = (*envStore)(nil) + +type envStore struct { + store map[string]Env +} + +func (s *envStore) add(env Env) { + s.store[env.Name] = env +} + +func (s *envStore) Restore() error { + var err error + for _, v := range s.store { + if v.Exists { + err = os.Setenv(v.Name, v.Value) + } else { + err = os.Unsetenv(v.Name) + } + if err != nil { + return err + } + } + return nil +} + +func (s *envStore) setEnv(key, value string) error { + s.Record(key) + + err := os.Setenv(key, value) + if err != nil { + return err + } + return nil +} + +func (s *envStore) Record(key string) { + originValue, exists := os.LookupEnv(key) + s.add(Env{ + Name: key, + Value: originValue, + Exists: exists, + }) +} + +func NewEnvStore() EnvStore { + return newEnvStore() +} + +func newEnvStore() *envStore { + return &envStore{store: make(map[string]Env)} +} + +func SetEnvVariables(env map[string]string) (EnvStore, error) { + envStore := newEnvStore() + + for k, v := range env { + err := envStore.setEnv(k, v) + if err != nil { + return nil, err + } + } + return envStore, nil +} diff --git a/sdk/internal/internaltest/env_test.go b/sdk/internal/internaltest/env_test.go new file mode 100644 index 00000000000..dc4dcea8e30 --- /dev/null +++ b/sdk/internal/internaltest/env_test.go @@ -0,0 +1,237 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/env_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "os" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" +) + +type EnvStoreTestSuite struct { + suite.Suite +} + +func (s *EnvStoreTestSuite) Test_add() { + envStore := newEnvStore() + + e := Env{ + Name: "name", + Value: "value", + Exists: true, + } + envStore.add(e) + envStore.add(e) + + s.Assert().Len(envStore.store, 1) +} + +func (s *EnvStoreTestSuite) TestRecord() { + testCases := []struct { + name string + env Env + expectedEnvStore *envStore + }{ + { + name: "record exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "value", + Exists: true, + }, + }}, + }, + { + name: "record exists env, but its value is empty", + env: Env{ + Name: "name", + Value: "", + Exists: true, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "", + Exists: true, + }, + }}, + }, + { + name: "record not exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Exists: false, + }, + }}, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + if tc.env.Exists { + s.Assert().NoError(os.Setenv(tc.env.Name, tc.env.Value)) + } + + envStore := newEnvStore() + envStore.Record(tc.env.Name) + + s.Assert().Equal(tc.expectedEnvStore, envStore) + + if tc.env.Exists { + s.Assert().NoError(os.Unsetenv(tc.env.Name)) + } + }) + } +} + +func (s *EnvStoreTestSuite) TestRestore() { + testCases := []struct { + name string + env Env + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "exists env", + env: Env{ + Name: "name", + Value: "value", + Exists: true, + }, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + { + name: "no exists env", + env: Env{ + Name: "name", + Exists: false, + }, + expectedEnvExists: false, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + envStore.add(tc.env) + + // Backup + backup := newEnvStore() + backup.Record(tc.env.Name) + + s.Require().NoError(os.Unsetenv(tc.env.Name)) + + s.Assert().NoError(envStore.Restore()) + v, exists := os.LookupEnv(tc.env.Name) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func (s *EnvStoreTestSuite) Test_setEnv() { + testCases := []struct { + name string + key string + value string + expectedEnvStore *envStore + expectedEnvValue string + expectedEnvExists bool + }{ + { + name: "normal", + key: "name", + value: "value", + expectedEnvStore: &envStore{store: map[string]Env{ + "name": { + Name: "name", + Value: "other value", + Exists: true, + }, + }}, + expectedEnvValue: "value", + expectedEnvExists: true, + }, + } + + for _, tc := range testCases { + s.Run(tc.name, func() { + envStore := newEnvStore() + + // Backup + backup := newEnvStore() + backup.Record(tc.key) + + s.Require().NoError(os.Setenv(tc.key, "other value")) + + s.Assert().NoError(envStore.setEnv(tc.key, tc.value)) + s.Assert().Equal(tc.expectedEnvStore, envStore) + v, exists := os.LookupEnv(tc.key) + s.Assert().Equal(tc.expectedEnvValue, v) + s.Assert().Equal(tc.expectedEnvExists, exists) + + // Restore + s.Require().NoError(backup.Restore()) + }) + } +} + +func TestEnvStoreTestSuite(t *testing.T) { + suite.Run(t, new(EnvStoreTestSuite)) +} + +func TestSetEnvVariables(t *testing.T) { + envs := map[string]string{ + "name1": "value1", + "name2": "value2", + } + + // Backup + backup := newEnvStore() + for k := range envs { + backup.Record(k) + } + defer func() { + require.NoError(t, backup.Restore()) + }() + + store, err := SetEnvVariables(envs) + assert.NoError(t, err) + require.IsType(t, &envStore{}, store) + concreteStore := store.(*envStore) + assert.Len(t, concreteStore.store, 2) + assert.Equal(t, backup, concreteStore) +} diff --git a/sdk/internal/internaltest/errors.go b/sdk/internal/internaltest/errors.go new file mode 100644 index 00000000000..4ed3b33252a --- /dev/null +++ b/sdk/internal/internaltest/errors.go @@ -0,0 +1,30 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/errors.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +type TestError string + +var _ error = TestError("") + +func NewTestError(s string) error { + return TestError(s) +} + +func (e TestError) Error() string { + return string(e) +} diff --git a/sdk/internal/internaltest/gen.go b/sdk/internal/internaltest/gen.go new file mode 100644 index 00000000000..a518c232c0d --- /dev/null +++ b/sdk/internal/internaltest/gen.go @@ -0,0 +1,25 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +//go:generate gotmpl --body=../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/sdk/internal/internaltest/harness.go b/sdk/internal/internaltest/harness.go new file mode 100644 index 00000000000..cd0207ca198 --- /dev/null +++ b/sdk/internal/internaltest/harness.go @@ -0,0 +1,344 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/harness.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +import ( + "context" + "fmt" + "sync" + "testing" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/trace" +) + +// Harness is a testing harness used to test implementations of the +// OpenTelemetry API. +type Harness struct { + t *testing.T +} + +// NewHarness returns an instantiated *Harness using t. +func NewHarness(t *testing.T) *Harness { + return &Harness{ + t: t, + } +} + +// TestTracerProvider runs validation tests for an implementation of the OpenTelemetry +// TracerProvider API. +func (h *Harness) TestTracerProvider(subjectFactory func() trace.TracerProvider) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("allow creating an arbitrary number of TracerProvider instances", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + + tp1 := subjectFactory() + tp2 := subjectFactory() + + e.Expect(tp1).NotToEqual(tp2) + }) + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + runner := func(tp trace.TracerProvider) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.TracerProvider) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name, version string) { + _ = tp.Tracer(name, trace.WithInstrumentationVersion(version)) + wg.Done() + }(fmt.Sprintf("tracer %d", i%5), fmt.Sprintf("%d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + matchers.NewExpecter(t).Expect(func() { + // Run with multiple TracerProvider to ensure they encapsulate + // their own Tracers. + tp1 := subjectFactory() + tp2 := subjectFactory() + + done1 := runner(tp1) + done2 := runner(tp2) + + <-done1 + <-done2 + }).NotToPanic() + }) + }) +} + +// TestTracer runs validation tests for an implementation of the OpenTelemetry +// Tracer API. +func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { + h.t.Run("#Start", func(t *testing.T) { + t.Run("propagates the original context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctxKey := testCtxKey{} + ctxValue := "ctx value" + ctx := context.WithValue(context.Background(), ctxKey, ctxValue) + + ctx, _ = subject.Start(ctx, "test") + + e.Expect(ctx.Value(ctxKey)).ToEqual(ctxValue) + }) + + t.Run("returns a span containing the expected properties", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + + e.Expect(span.SpanContext().IsValid()).ToBeTrue() + }) + + t.Run("stores the span on the provided context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, span := subject.Start(context.Background(), "test") + + e.Expect(span).NotToBeNil() + e.Expect(span.SpanContext()).NotToEqual(trace.SpanContext{}) + e.Expect(trace.SpanFromContext(ctx)).ToEqual(span) + }) + + t.Run("starts spans with unique trace and span IDs", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, span1 := subject.Start(context.Background(), "span1") + _, span2 := subject.Start(context.Background(), "span2") + + sc1 := span1.SpanContext() + sc2 := span2.SpanContext() + + e.Expect(sc1.TraceID()).NotToEqual(sc2.TraceID()) + e.Expect(sc1.SpanID()).NotToEqual(sc2.SpanID()) + }) + + t.Run("propagates a parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child") + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + ctx, parent := subject.Start(context.Background(), "parent") + _, child := subject.Start(ctx, "child", trace.WithNewRoot()) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("propagates remote parent's trace ID through the context", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child") + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("ignores remote parent's trace ID when new root is requested", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + subject := subjectFactory() + + _, remoteParent := subject.Start(context.Background(), "remote parent") + parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) + _, child := subject.Start(parentCtx, "child", trace.WithNewRoot()) + + psc := remoteParent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }) + + t.Run("all methods are safe to be called concurrently", func(t *testing.T) { + t.Parallel() + + e := matchers.NewExpecter(t) + tracer := subjectFactory() + + ctx, parent := tracer.Start(context.Background(), "span") + + runner := func(tp trace.Tracer) <-chan struct{} { + done := make(chan struct{}) + go func(tp trace.Tracer) { + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go func(name string) { + defer wg.Done() + _, child := tp.Start(ctx, name) + + psc := parent.SpanContext() + csc := child.SpanContext() + + e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) + e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) + }(fmt.Sprintf("span %d", i)) + } + wg.Wait() + done <- struct{}{} + }(tp) + return done + } + + e.Expect(func() { + done := runner(tracer) + + <-done + }).NotToPanic() + }) + }) + + h.testSpan(subjectFactory) +} + +func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { + var methods = map[string]func(span trace.Span){ + "#End": func(span trace.Span) { + span.End() + }, + "#AddEvent": func(span trace.Span) { + span.AddEvent("test event") + }, + "#AddEventWithTimestamp": func(span trace.Span) { + span.AddEvent("test event", trace.WithTimestamp(time.Now().Add(1*time.Second))) + }, + "#SetStatus": func(span trace.Span) { + span.SetStatus(codes.Error, "internal") + }, + "#SetName": func(span trace.Span) { + span.SetName("new name") + }, + "#SetAttributes": func(span trace.Span) { + span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) + }, + } + var mechanisms = map[string]func() trace.Span{ + "Span created via Tracer#Start": func() trace.Span { + tracer := tracerFactory() + _, subject := tracer.Start(context.Background(), "test") + + return subject + }, + "Span created via span.TracerProvider()": func() trace.Span { + ctx, spanA := tracerFactory().Start(context.Background(), "span1") + + _, spanB := spanA.TracerProvider().Tracer("second").Start(ctx, "span2") + return spanB + }, + } + + for mechanismName, mechanism := range mechanisms { + h.t.Run(mechanismName, func(t *testing.T) { + for methodName, method := range methods { + t.Run(methodName, func(t *testing.T) { + t.Run("is thread-safe", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + wg := &sync.WaitGroup{} + wg.Add(2) + + go func() { + defer wg.Done() + + method(span) + }() + + go func() { + defer wg.Done() + + method(span) + }() + + wg.Wait() + }) + }) + } + + t.Run("#End", func(t *testing.T) { + t.Run("can be called multiple times", func(t *testing.T) { + t.Parallel() + + span := mechanism() + + span.End() + span.End() + }) + }) + }) + } +} + +type testCtxKey struct{} diff --git a/sdk/internal/internaltest/text_map_carrier.go b/sdk/internal/internaltest/text_map_carrier.go new file mode 100644 index 00000000000..4ca36454bb0 --- /dev/null +++ b/sdk/internal/internaltest/text_map_carrier.go @@ -0,0 +1,144 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +import ( + "sync" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +// TextMapCarrier is a storage medium for a TextMapPropagator used in testing. +// The methods of a TextMapCarrier are concurrent safe. +type TextMapCarrier struct { + mtx sync.Mutex + + gets []string + sets [][2]string + data map[string]string +} + +var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil) + +// NewTextMapCarrier returns a new *TextMapCarrier populated with data. +func NewTextMapCarrier(data map[string]string) *TextMapCarrier { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + return &TextMapCarrier{data: copied} +} + +// Keys returns the keys for which this carrier has a value. +func (c *TextMapCarrier) Keys() []string { + c.mtx.Lock() + defer c.mtx.Unlock() + + result := make([]string, 0, len(c.data)) + for k := range c.data { + result = append(result, k) + } + return result +} + +// Get returns the value associated with the passed key. +func (c *TextMapCarrier) Get(key string) string { + c.mtx.Lock() + defer c.mtx.Unlock() + c.gets = append(c.gets, key) + return c.data[key] +} + +// GotKey tests if c.Get has been called for key. +func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + for _, k := range c.gets { + if k == key { + return true + } + } + t.Errorf("TextMapCarrier.Get(%q) has not been called", key) + return false +} + +// GotN tests if n calls to c.Get have been made. +func (c *TextMapCarrier) GotN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.gets) != n { + t.Errorf("TextMapCarrier.Get was called %d times, not %d", len(c.gets), n) + return false + } + return true +} + +// Set stores the key-value pair. +func (c *TextMapCarrier) Set(key, value string) { + c.mtx.Lock() + defer c.mtx.Unlock() + c.sets = append(c.sets, [2]string{key, value}) + c.data[key] = value +} + +// SetKeyValue tests if c.Set has been called for the key-value pair. +func (c *TextMapCarrier) SetKeyValue(t *testing.T, key, value string) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + var vals []string + for _, pair := range c.sets { + if key == pair[0] { + if value == pair[1] { + return true + } + vals = append(vals, pair[1]) + } + } + if len(vals) > 0 { + t.Errorf("TextMapCarrier.Set called with %q and %v values, but not %s", key, vals, value) + } + t.Errorf("TextMapCarrier.Set(%q,%q) has not been called", key, value) + return false +} + +// SetN tests if n calls to c.Set have been made. +func (c *TextMapCarrier) SetN(t *testing.T, n int) bool { + c.mtx.Lock() + defer c.mtx.Unlock() + if len(c.sets) != n { + t.Errorf("TextMapCarrier.Set was called %d times, not %d", len(c.sets), n) + return false + } + return true +} + +// Reset zeros out the recording state and sets the carried values to data. +func (c *TextMapCarrier) Reset(data map[string]string) { + copied := make(map[string]string, len(data)) + for k, v := range data { + copied[k] = v + } + + c.mtx.Lock() + defer c.mtx.Unlock() + + c.gets = nil + c.sets = nil + c.data = copied +} diff --git a/sdk/internal/internaltest/text_map_carrier_test.go b/sdk/internal/internaltest/text_map_carrier_test.go new file mode 100644 index 00000000000..faf713cc2d0 --- /dev/null +++ b/sdk/internal/internaltest/text_map_carrier_test.go @@ -0,0 +1,86 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "reflect" + "testing" +) + +var ( + key, value = "test", "true" +) + +func TestTextMapCarrierKeys(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + expected, actual := []string{key}, tmc.Keys() + if !reflect.DeepEqual(actual, expected) { + t.Errorf("expected tmc.Keys() to be %v but it was %v", expected, actual) + } +} + +func TestTextMapCarrierGet(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + if got := tmc.Get("empty"); got != "" { + t.Errorf("TextMapCarrier.Get returned %q for an empty key", got) + } + tmc.GotKey(t, "empty") + tmc.GotN(t, 1) + if got := tmc.Get(key); got != value { + t.Errorf("TextMapCarrier.Get(%q) returned %q, want %q", key, got, value) + } + tmc.GotKey(t, key) + tmc.GotN(t, 2) +} + +func TestTextMapCarrierSet(t *testing.T) { + tmc := NewTextMapCarrier(nil) + tmc.SetN(t, 0) + tmc.Set(key, value) + if got, ok := tmc.data[key]; !ok { + t.Errorf("TextMapCarrier.Set(%q,%q) failed to store pair", key, value) + } else if got != value { + t.Errorf("TextMapCarrier.Set(%q,%q) stored (%q,%q), not (%q,%q)", key, value, key, got, key, value) + } + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) +} + +func TestTextMapCarrierReset(t *testing.T) { + tmc := NewTextMapCarrier(map[string]string{key: value}) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear initial data") + } + tmc.GotN(t, 1) + tmc.GotKey(t, key) + tmc.Set(key, value) + tmc.SetKeyValue(t, key, value) + tmc.SetN(t, 1) + tmc.Reset(nil) + tmc.GotN(t, 0) + tmc.SetN(t, 0) + if got := tmc.Get(key); got != "" { + t.Error("TextMapCarrier.Reset() failed to clear data") + } +} diff --git a/sdk/internal/internaltest/text_map_propagator.go b/sdk/internal/internaltest/text_map_propagator.go new file mode 100644 index 00000000000..344075c3698 --- /dev/null +++ b/sdk/internal/internaltest/text_map_propagator.go @@ -0,0 +1,115 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" + +import ( + "context" + "fmt" + "strconv" + "strings" + "testing" + + "go.opentelemetry.io/otel/propagation" +) + +type ctxKeyType string + +type state struct { + Injections uint64 + Extractions uint64 +} + +func newState(encoded string) state { + if encoded == "" { + return state{} + } + s0, s1, _ := strings.Cut(encoded, ",") + injects, _ := strconv.ParseUint(s0, 10, 64) + extracts, _ := strconv.ParseUint(s1, 10, 64) + return state{ + Injections: injects, + Extractions: extracts, + } +} + +func (s state) String() string { + return fmt.Sprintf("%d,%d", s.Injections, s.Extractions) +} + +// TextMapPropagator is a propagation.TextMapPropagator used for testing. +type TextMapPropagator struct { + name string + ctxKey ctxKeyType +} + +var _ propagation.TextMapPropagator = (*TextMapPropagator)(nil) + +// NewTextMapPropagator returns a new TextMapPropagator for testing. It will +// use name as the key it injects into a TextMapCarrier when Inject is called. +func NewTextMapPropagator(name string) *TextMapPropagator { + return &TextMapPropagator{name: name, ctxKey: ctxKeyType(name)} +} + +func (p *TextMapPropagator) stateFromContext(ctx context.Context) state { + if v := ctx.Value(p.ctxKey); v != nil { + if s, ok := v.(state); ok { + return s + } + } + return state{} +} + +func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state { + return newState(carrier.Get(p.name)) +} + +// Inject sets cross-cutting concerns for p from ctx into carrier. +func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { + s := p.stateFromContext(ctx) + s.Injections++ + carrier.Set(p.name, s.String()) +} + +// InjectedN tests if p has made n injections to carrier. +func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n int) bool { + if actual := p.stateFromCarrier(carrier).Injections; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} injected %d times, not %d", p.name, actual, n) + return false + } + return true +} + +// Extract reads cross-cutting concerns for p from carrier into ctx. +func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { + s := p.stateFromCarrier(carrier) + s.Extractions++ + return context.WithValue(ctx, p.ctxKey, s) +} + +// ExtractedN tests if p has made n extractions from the lineage of ctx. +// nolint (context is not first arg) +func (p *TextMapPropagator) ExtractedN(t *testing.T, ctx context.Context, n int) bool { + if actual := p.stateFromContext(ctx).Extractions; actual != uint64(n) { + t.Errorf("TextMapPropagator{%q} extracted %d time, not %d", p.name, actual, n) + return false + } + return true +} + +// Fields returns the name of p as the key who's value is set with Inject. +func (p *TextMapPropagator) Fields() []string { return []string{p.name} } diff --git a/sdk/internal/internaltest/text_map_propagator_test.go b/sdk/internal/internaltest/text_map_propagator_test.go new file mode 100644 index 00000000000..babcc95fc1b --- /dev/null +++ b/sdk/internal/internaltest/text_map_propagator_test.go @@ -0,0 +1,72 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internaltest + +import ( + "context" + "testing" +) + +func TestTextMapPropagatorInjectExtract(t *testing.T) { + name := "testing" + ctx := context.Background() + carrier := NewTextMapCarrier(map[string]string{name: value}) + propagator := NewTextMapPropagator(name) + + propagator.Inject(ctx, carrier) + // Carrier value overridden with state. + if carrier.SetKeyValue(t, name, "1,0") { + // Ensure nothing has been extracted yet. + propagator.ExtractedN(t, ctx, 0) + // Test the injection was counted. + propagator.InjectedN(t, carrier, 1) + } + + ctx = propagator.Extract(ctx, carrier) + v := ctx.Value(ctxKeyType(name)) + if v == nil { + t.Error("TextMapPropagator.Extract failed to extract state") + } + if s, ok := v.(state); !ok { + t.Error("TextMapPropagator.Extract did not extract proper state") + } else if s.Extractions != 1 { + t.Error("TextMapPropagator.Extract did not increment state.Extractions") + } + if carrier.GotKey(t, name) { + // Test the extraction was counted. + propagator.ExtractedN(t, ctx, 1) + // Ensure no additional injection was recorded. + propagator.InjectedN(t, carrier, 1) + } +} + +func TestTextMapPropagatorFields(t *testing.T) { + name := "testing" + propagator := NewTextMapPropagator(name) + if got := propagator.Fields(); len(got) != 1 { + t.Errorf("TextMapPropagator.Fields returned %d fields, want 1", len(got)) + } else if got[0] != name { + t.Errorf("TextMapPropagator.Fields returned %q, want %q", got[0], name) + } +} + +func TestNewStateEmpty(t *testing.T) { + if want, got := (state{}), newState(""); got != want { + t.Errorf("newState(\"\") returned %v, want %v", got, want) + } +} diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index 85bf9a82f95..e47aaa5babd 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 34d45b99c0f..958a0f745b8 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -29,8 +29,8 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) diff --git a/sdk/trace/batch_span_processor_test.go b/sdk/trace/batch_span_processor_test.go index b8706ce463e..8fded5527fe 100644 --- a/sdk/trace/batch_span_processor_test.go +++ b/sdk/trace/batch_span_processor_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "github.com/go-logr/logr/funcr" "github.com/stretchr/testify/assert" diff --git a/sdk/trace/provider_test.go b/sdk/trace/provider_test.go index 8df3f1a4bd7..4b8629559cc 100644 --- a/sdk/trace/provider_test.go +++ b/sdk/trace/provider_test.go @@ -24,7 +24,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - ottest "go.opentelemetry.io/otel/internal/internaltest" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/span_limits_test.go b/sdk/trace/span_limits_test.go index 5e88770ae0f..043215be0d9 100644 --- a/sdk/trace/span_limits_test.go +++ b/sdk/trace/span_limits_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/internal/env" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index d693d5c238c..56f53d4d2d0 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -33,8 +33,8 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - ottest "go.opentelemetry.io/otel/internal/internaltest" "go.opentelemetry.io/otel/sdk/instrumentation" + ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" @@ -1198,7 +1198,7 @@ func TestRecordError(t *testing.T) { }{ { err: ottest.NewTestError("test error"), - typ: "go.opentelemetry.io/otel/internal/internaltest.TestError", + typ: "go.opentelemetry.io/otel/sdk/internal/internaltest.TestError", msg: "test error", }, { @@ -1250,7 +1250,7 @@ func TestRecordError(t *testing.T) { func TestRecordErrorWithStackTrace(t *testing.T) { err := ottest.NewTestError("test error") - typ := "go.opentelemetry.io/otel/internal/internaltest.TestError" + typ := "go.opentelemetry.io/otel/sdk/internal/internaltest.TestError" msg := "test error" te := NewTestExporter() From d9afe946d40d2db25cc0cdc2a0cf8b79fe2693dc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 9 Aug 2023 15:12:17 -0700 Subject: [PATCH 649/886] Document cross-module internal package rule (#4427) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Pająk --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03bcad6db20..a00dbca7b08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -563,6 +563,30 @@ The tests should never leak goroutines. Use the term `ConcurrentSafe` in the test name when it aims to verify the absence of race conditions. +### Internal packages + +The use of internal packages should be scoped to a single module. A sub-module +should never import from a parent internal package. This creates a coupling +between the two modules where a user can upgrade the parent without the child +and if the internal package API has changed it will fail to upgrade[^3]. + +There are two known exceptions to this rule: + +- `go.opentelemetry.io/otel/internal/global` + - This package manages global state for all of opentelemetry-go. It needs to + be a single package in order to ensure the uniqueness of the global state. +- `go.opentelemetry.io/otel/internal/baggage` + - This package provides values in a `context.Context` that need to be + recognized by `go.opentelemetry.io/otel/baggage` and + `go.opentelemetry.io/otel/bridge/opentracing` but remain private. + +If you have duplicate code in multiple modules, make that code into a Go +template stored in `go.opentelemetry.io/otel/internal/shared` and use [gotmpl] +to render the templates in the desired locations. See [#4404] for an example of +this. + +[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 + ## Approvers and Maintainers ### Approvers @@ -592,3 +616,5 @@ repo](https://github.com/open-telemetry/community/blob/main/community-membership [Approver]: #approvers [Maintainer]: #maintainers +[gotmpl]: https://pkg.go.dev/go.opentelemetry.io/build-tools/gotmpl +[#4404]: https://github.com/open-telemetry/opentelemetry-go/pull/4404 From b44a2bbc3661fef4eb20bf8d568b28fd71473ea3 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 10 Aug 2023 00:23:25 -0700 Subject: [PATCH 650/886] Remove commented out method in exponential_histogram.go (#4429) --- .../aggregate/exponential_histogram.go | 53 +------------------ 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index 8434500f0df..c684c87e600 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -393,6 +393,7 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { *dest = h return n } + func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { t := now() @@ -443,55 +444,3 @@ func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { *dest = h return n } - -// Aggregate records the measurement, scoped by attr, and aggregates it -// into an aggregation. -// func (e *cumulativeExponentialHistogram[N]) Aggregation() metricdata.Aggregation { -// e.valuesMu.Lock() -// defer e.valuesMu.Unlock() - -// if len(e.values) == 0 { -// return nil -// } -// t := now() -// h := metricdata.ExponentialHistogram[N]{ -// Temporality: metricdata.CumulativeTemporality, -// DataPoints: make([]metricdata.ExponentialHistogramDataPoint[N], 0, len(e.values)), -// } -// for a, b := range e.values { -// ehdp := metricdata.ExponentialHistogramDataPoint[N]{ -// Attributes: a, -// StartTime: e.start, -// Time: t, -// Count: b.count, -// Scale: int32(b.scale), -// ZeroCount: b.zeroCount, -// ZeroThreshold: 0.0, -// PositiveBucket: metricdata.ExponentialBucket{ -// Offset: int32(b.posBuckets.startBin), -// Counts: make([]uint64, len(b.posBuckets.counts)), -// }, -// NegativeBucket: metricdata.ExponentialBucket{ -// Offset: int32(b.negBuckets.startBin), -// Counts: make([]uint64, len(b.negBuckets.counts)), -// }, -// } -// copy(ehdp.PositiveBucket.Counts, b.posBuckets.counts) -// copy(ehdp.NegativeBucket.Counts, b.negBuckets.counts) - -// if !e.noMinMax { -// ehdp.Min = metricdata.NewExtrema(b.min) -// ehdp.Max = metricdata.NewExtrema(b.max) -// } -// if !e.noSum { -// ehdp.Sum = b.sum -// } -// h.DataPoints = append(h.DataPoints, ehdp) -// // TODO (#3006): This will use an unbounded amount of memory if there -// // are unbounded number of attribute sets being aggregated. Attribute -// // sets that become "stale" need to be forgotten so this will not -// // overload the system. -// } - -// return h -// } From 10d9038059c237fe1805c1439fde04aa39113d45 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 10 Aug 2023 09:58:30 -0700 Subject: [PATCH 651/886] Use first-seen instrument name for name conflicts (#4428) * Add acceptance test * Return the first-seen for instrument name conflicts * Add changes to changelog --- CHANGELOG.md | 1 + sdk/metric/instrument.go | 11 +++++++++++ sdk/metric/pipeline.go | 16 ++++++++++++---- sdk/metric/pipeline_test.go | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5b9d37f2f4..690bc7bdc33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) - Do not append _total if the counter already ends in total `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) - Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) +- Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) ### Deprecated diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index eff2f179a51..67300d489f6 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -20,6 +20,7 @@ import ( "context" "errors" "fmt" + "strings" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" @@ -187,6 +188,16 @@ type instID struct { Number string } +// Returns a normalized copy of the instID i. +// +// Instrument names are considered case-insensitive. Standardize the instrument +// name to always be lowercase for the returned instID so it can be compared +// without the name casing affecting the comparison. +func (i instID) normalize() instID { + i.Name = strings.ToLower(i.Name) + return i +} + type int64Inst struct { measures []aggregate.Measure[int64] diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index fd28a4afc15..6d1934a76fc 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -329,7 +329,12 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum // If there is a conflict, the specification says the view should // still be applied and a warning should be logged. i.logConflict(id) - cv := i.aggregators.Lookup(id, func() aggVal[N] { + + // If there are requests for the same instrument with different name + // casing, the first-seen needs to be returned. Use a normalize ID for the + // cache lookup to ensure the correct comparison. + normID := id.normalize() + cv := i.aggregators.Lookup(normID, func() aggVal[N] { b := aggregate.Builder[N]{ Temporality: i.pipeline.reader.temporality(kind), } @@ -344,6 +349,8 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum return aggVal[N]{0, nil, nil} } i.pipeline.addSync(scope, instrumentSync{ + // Use the first-seen name casing for this and all subsequent + // requests of this instrument. name: stream.Name, description: stream.Description, unit: stream.Unit, @@ -355,12 +362,13 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum return cv.Measure, cv.ID, cv.Err } -// logConflict validates if an instrument with the same name as id has already -// been created. If that instrument conflicts with id, a warning is logged. +// logConflict validates if an instrument with the same case-insensitive name +// as id has already been created. If that instrument conflicts with id, a +// warning is logged. func (i *inserter[N]) logConflict(id instID) { // The API specification defines names as case-insensitive. If there is a // different casing of a name it needs to be a conflict. - name := strings.ToLower(id.Name) + name := id.normalize().Name existing := i.views.Lookup(name, func() instID { return id }) if id == existing { return diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 32c1d0358c4..d30d0015c06 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -32,6 +32,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/resource" @@ -358,3 +359,37 @@ func TestLogConflictSuggestView(t *testing.T) { msg = "" }) } + +func TestInserterCachedAggregatorNameConflict(t *testing.T) { + const name = "requestCount" + scope := instrumentation.Scope{Name: "pipeline_test"} + kind := InstrumentKindCounter + stream := Stream{ + Name: name, + Aggregation: aggregation.Sum{}, + } + + var vc cache[string, instID] + pipe := newPipeline(nil, NewManualReader(), nil) + i := newInserter[int64](pipe, &vc) + + _, origID, err := i.cachedAggregator(scope, kind, stream) + require.NoError(t, err) + + require.Len(t, pipe.aggregations, 1) + require.Contains(t, pipe.aggregations, scope) + iSync := pipe.aggregations[scope] + require.Len(t, iSync, 1) + require.Equal(t, name, iSync[0].name) + + stream.Name = "RequestCount" + _, id, err := i.cachedAggregator(scope, kind, stream) + require.NoError(t, err) + assert.Equal(t, origID, id, "multiple aggregators for equivalent name") + + assert.Len(t, pipe.aggregations, 1, "additional scope added") + require.Contains(t, pipe.aggregations, scope, "original scope removed") + iSync = pipe.aggregations[scope] + require.Len(t, iSync, 1, "registered instrumentSync changed") + assert.Equal(t, name, iSync[0].name, "stream name changed") +} From 319cb3a3be8a5804343d1bc6f11000f26f1bebee Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 10 Aug 2023 14:25:53 -0700 Subject: [PATCH 652/886] Deprecate the `otlptrace/internal` packages (#4425) * Stop generating otlptrace/internal and deprecate * Remove the tracetransform templates They are no longer used. * Add change stub to changelog * Add PR number to changelog --- CHANGELOG.md | 5 + .../otlp/otlptrace/internal/doc.go | 22 +- .../otlp/otlptrace/internal/envconfig/doc.go | 25 +- .../otlptrace/internal/envconfig/envconfig.go | 3 - .../internal/envconfig/envconfig_test.go | 3 - exporters/otlp/otlptrace/internal/gen.go | 43 --- exporters/otlp/otlptrace/internal/header.go | 3 - .../otlp/otlptrace/internal/header_test.go | 3 - .../otlp/otlptrace/internal/otlpconfig/doc.go | 20 ++ .../internal/otlpconfig/envconfig.go | 5 +- .../otlptrace/internal/otlpconfig/options.go | 5 +- .../internal/otlpconfig/options_test.go | 5 +- .../internal/otlpconfig/optiontypes.go | 3 - .../otlp/otlptrace/internal/otlpconfig/tls.go | 3 - .../internal/otlptracetest/client.go | 3 - .../internal/otlptracetest/collector.go | 3 - .../otlptrace/internal/otlptracetest/data.go | 3 - .../otlptrace/internal/otlptracetest/doc.go | 20 ++ .../internal/otlptracetest/otlptest.go | 3 - .../otlp/otlptrace/internal/retry/retry.go | 6 +- .../otlptrace/internal/retry/retry_test.go | 3 - .../internal/tracetransform/attribute.go | 3 - .../internal/tracetransform/attribute_test.go | 3 - .../tracetransform/instrumentation.go | 3 - .../internal/tracetransform/resource.go | 3 - .../internal/tracetransform/resource_test.go | 3 - .../otlptrace/internal/tracetransform/span.go | 3 - .../internal/tracetransform/span_test.go | 3 - .../tracetransform/attribute.go.tmpl | 161 --------- .../tracetransform/attribute_test.go.tmpl | 261 -------------- .../tracetransform/resource_test.go.tmpl | 51 --- .../otlptrace/tracetransform/span.go.tmpl | 208 ----------- .../tracetransform/span_test.go.tmpl | 336 ------------------ 33 files changed, 62 insertions(+), 1165 deletions(-) rename internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl => exporters/otlp/otlptrace/internal/doc.go (56%) rename internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl => exporters/otlp/otlptrace/internal/envconfig/doc.go (55%) delete mode 100644 exporters/otlp/otlptrace/internal/gen.go create mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/doc.go create mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/doc.go delete mode 100644 internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl delete mode 100644 internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl delete mode 100644 internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl delete mode 100644 internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl delete mode 100644 internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl diff --git a/CHANGELOG.md b/CHANGELOG.md index 690bc7bdc33..a262e1c86b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/exporters/otlp/internal` package is deprecated. (#4421) - The `go.opentelemetry.io/otel/exporters/otlp/internal/envconfig` package is deprecated. (#4421) - The `go.opentelemetry.io/otel/exporters/otlp/internal/retry` package is deprecated. (#4421) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl b/exporters/otlp/otlptrace/internal/doc.go similarity index 56% rename from internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl rename to exporters/otlp/otlptrace/internal/doc.go index 1d2d26ed88a..d1c019d8bb2 100644 --- a/internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl +++ b/exporters/otlp/otlptrace/internal/doc.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,17 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -package tracetransform - -import ( - "go.opentelemetry.io/otel/sdk/resource" - resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" -) - -// Resource transforms a Resource into an OTLP Resource. -func Resource(r *resource.Resource) *resourcepb.Resource { - if r == nil { - return nil - } - return &resourcepb.Resource{Attributes: ResourceAttributes(r)} -} +// Package internal contains common functionality for all OTLP trace exporters. +// +// Deprecated: package internal exists for historical compatibility, it should +// not be used. +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" diff --git a/internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl b/exporters/otlp/otlptrace/internal/envconfig/doc.go similarity index 55% rename from internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl rename to exporters/otlp/otlptrace/internal/envconfig/doc.go index 3e43a81474e..f2887ee8ffb 100644 --- a/internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl +++ b/exporters/otlp/otlptrace/internal/envconfig/doc.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,19 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -package tracetransform - -import ( - "go.opentelemetry.io/otel/sdk/instrumentation" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationScope { - if il == (instrumentation.Scope{}) { - return nil - } - return &commonpb.InstrumentationScope{ - Name: il.Name, - Version: il.Version, - } -} +// Package envconfig contains common functionality for all OTLP trace exporters +// to handle environment variable configuration. +// +// Deprecated: package envconfig exists for historical compatibility, it should +// not be used. +package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig.go index b1db08f29c4..04d87af9e59 100644 --- a/exporters/otlp/otlptrace/internal/envconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/envconfig/envconfig.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/envconfig/envconfig.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go index cec506208d5..0c959a1f3fd 100644 --- a/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/envconfig/envconfig_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/gen.go b/exporters/otlp/otlptrace/internal/gen.go deleted file mode 100644 index 7b9684c2679..00000000000 --- a/exporters/otlp/otlptrace/internal/gen.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" - -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/header.go.tmpl "--data={}" --out=header.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/header_test.go.tmpl "--data={}" --out=header_test.go - -//go:generate gotmpl --body=../../../../internal/shared/otlp/envconfig/envconfig.go.tmpl "--data={}" --out=envconfig/envconfig.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/envconfig/envconfig_test.go.tmpl "--data={}" --out=envconfig/envconfig_test.go - -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig\"}" --out=otlpconfig/envconfig.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl "--data={\"retryImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry\"}" --out=otlpconfig/options.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl "--data={\"envconfigImportPath\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig\"}" --out=otlpconfig/options_test.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl "--data={}" --out=otlpconfig/optiontypes.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl "--data={}" --out=otlpconfig/tls.go - -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl "--data={}" --out=otlptracetest/client.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go - -//go:generate gotmpl --body=../../../../internal/shared/otlp/retry/retry.go.tmpl "--data={}" --out=retry/retry.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/retry/retry_test.go.tmpl "--data={}" --out=retry/retry_test.go - -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl "--data={}" --out=tracetransform/attribute.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl "--data={}" --out=tracetransform/attribute_test.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl "--data={}" --out=tracetransform/instrumentation.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl "--data={}" --out=tracetransform/resource.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl "--data={}" --out=tracetransform/resource_test.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl "--data={}" --out=tracetransform/span.go -//go:generate gotmpl --body=../../../../internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl "--data={}" --out=tracetransform/span_test.go diff --git a/exporters/otlp/otlptrace/internal/header.go b/exporters/otlp/otlptrace/internal/header.go index 44cea4cbd9f..65694a9019a 100644 --- a/exporters/otlp/otlptrace/internal/header.go +++ b/exporters/otlp/otlptrace/internal/header.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/header.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/header_test.go b/exporters/otlp/otlptrace/internal/header_test.go index 4c80b9c28f8..d93340fc0d6 100644 --- a/exporters/otlp/otlptrace/internal/header_test.go +++ b/exporters/otlp/otlptrace/internal/header_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/header_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/doc.go b/exporters/otlp/otlptrace/internal/otlpconfig/doc.go new file mode 100644 index 00000000000..41047e4de95 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/otlpconfig/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package otlpconfig contains common functionality for configuring all OTLP +// trace exporters. +// +// Deprecated: package otlpconfig exists for historical compatibility, it +// should not be used. +package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go index 6e85501dc1d..1b9ecf6f949 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +23,7 @@ import ( "strings" "time" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" // nolint: staticcheck // Atomic deprecation. ) // DefaultEnvOptionsReader is the default environments reader. diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go index e5f396e6fe8..9d99c02365d 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,7 +28,7 @@ import ( "google.golang.org/grpc/encoding/gzip" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" // nolint: staticcheck // Atomic deprecation. ) const ( diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go index 34b04d36f11..e3f83e64616 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" // nolint: staticcheck // Atomic deprecation. ) const ( diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go index 1d276083d85..c2d6c036152 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go b/exporters/otlp/otlptrace/internal/otlpconfig/tls.go index ac7b9a4cc12..7287cf6cfeb 100644 --- a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go +++ b/exporters/otlp/otlptrace/internal/otlpconfig/tls.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/internal/otlptracetest/client.go index 69ec2bbd8ea..aedb8f4a9d2 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/client.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/client.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlptracetest/client.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go index d60e56829a0..865fabba27d 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/data.go b/exporters/otlp/otlptrace/internal/otlptracetest/data.go index 1da7ad7fc2c..d039105cb29 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/data.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/data.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/doc.go b/exporters/otlp/otlptrace/internal/otlptracetest/doc.go new file mode 100644 index 00000000000..16306de6951 --- /dev/null +++ b/exporters/otlp/otlptrace/internal/otlptracetest/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package otlptracetest contains common functionality for testing all OTLP +// trace exporters. +// +// Deprecated: package otlptracetest exists for historical compatibility, it +// should not be used. +package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go index 09e8f75d728..91c098d1539 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/retry/retry.go b/exporters/otlp/otlptrace/internal/retry/retry.go index a8abb55ab2e..1af94419199 100644 --- a/exporters/otlp/otlptrace/internal/retry/retry.go +++ b/exporters/otlp/otlptrace/internal/retry/retry.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/retry/retry.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +15,9 @@ // Package retry provides request retry functionality that can perform // configurable exponential backoff for transient errors and honor any // explicit throttle responses received. +// +// Deprecated: package retry exists for historical compatibility, it should not +// be used. package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" import ( diff --git a/exporters/otlp/otlptrace/internal/retry/retry_test.go b/exporters/otlp/otlptrace/internal/retry/retry_test.go index 9279c7c00ff..de574a73579 100644 --- a/exporters/otlp/otlptrace/internal/retry/retry_test.go +++ b/exporters/otlp/otlptrace/internal/retry/retry_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/retry/retry_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index ff5e1016ee9..ec74f1aad75 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go index bdba00a833d..3f335f12392 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/attribute_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 9bc6faa2f3e..7aaec38d22a 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/instrumentation.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/resource.go b/exporters/otlp/otlptrace/internal/tracetransform/resource.go index 7414e2ba93f..05a1f78adbc 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/resource.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/resource.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/resource.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go b/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go index 13628d63b2d..f214cd6f891 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/resource_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span.go b/exporters/otlp/otlptrace/internal/tracetransform/span.go index 02ce59e3eab..b83cbd72478 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 227711a9e34..7e0be6cabb7 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -1,6 +1,3 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl - // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl deleted file mode 100644 index 507e520d679..00000000000 --- a/internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl +++ /dev/null @@ -1,161 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/attribute.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/resource" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. -func KeyValues(attrs []attribute.KeyValue) []*commonpb.KeyValue { - if len(attrs) == 0 { - return nil - } - - out := make([]*commonpb.KeyValue, 0, len(attrs)) - for _, kv := range attrs { - out = append(out, KeyValue(kv)) - } - return out -} - -// Iterator transforms an attribute iterator into OTLP key-values. -func Iterator(iter attribute.Iterator) []*commonpb.KeyValue { - l := iter.Len() - if l == 0 { - return nil - } - - out := make([]*commonpb.KeyValue, 0, l) - for iter.Next() { - out = append(out, KeyValue(iter.Attribute())) - } - return out -} - -// ResourceAttributes transforms a Resource OTLP key-values. -func ResourceAttributes(res *resource.Resource) []*commonpb.KeyValue { - return Iterator(res.Iter()) -} - -// KeyValue transforms an attribute KeyValue into an OTLP key-value. -func KeyValue(kv attribute.KeyValue) *commonpb.KeyValue { - return &commonpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} -} - -// Value transforms an attribute Value into an OTLP AnyValue. -func Value(v attribute.Value) *commonpb.AnyValue { - av := new(commonpb.AnyValue) - switch v.Type() { - case attribute.BOOL: - av.Value = &commonpb.AnyValue_BoolValue{ - BoolValue: v.AsBool(), - } - case attribute.BOOLSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: boolSliceValues(v.AsBoolSlice()), - }, - } - case attribute.INT64: - av.Value = &commonpb.AnyValue_IntValue{ - IntValue: v.AsInt64(), - } - case attribute.INT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: int64SliceValues(v.AsInt64Slice()), - }, - } - case attribute.FLOAT64: - av.Value = &commonpb.AnyValue_DoubleValue{ - DoubleValue: v.AsFloat64(), - } - case attribute.FLOAT64SLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: float64SliceValues(v.AsFloat64Slice()), - }, - } - case attribute.STRING: - av.Value = &commonpb.AnyValue_StringValue{ - StringValue: v.AsString(), - } - case attribute.STRINGSLICE: - av.Value = &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: stringSliceValues(v.AsStringSlice()), - }, - } - default: - av.Value = &commonpb.AnyValue_StringValue{ - StringValue: "INVALID", - } - } - return av -} - -func boolSliceValues(vals []bool) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: v, - }, - } - } - return converted -} - -func int64SliceValues(vals []int64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: v, - }, - } - } - return converted -} - -func float64SliceValues(vals []float64) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: v, - }, - } - } - return converted -} - -func stringSliceValues(vals []string) []*commonpb.AnyValue { - converted := make([]*commonpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: v, - }, - } - } - return converted -} diff --git a/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl deleted file mode 100644 index bdba00a833d..00000000000 --- a/internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl +++ /dev/null @@ -1,261 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/attribute_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -type attributeTest struct { - attrs []attribute.KeyValue - expected []*commonpb.KeyValue -} - -func TestAttributes(t *testing.T) { - for _, test := range []attributeTest{ - {nil, nil}, - { - []attribute.KeyValue{ - attribute.Int("int to int", 123), - attribute.Int64("int64 to int64", 1234567), - attribute.Float64("float64 to double", 1.61), - attribute.String("string to string", "string"), - attribute.Bool("bool to bool", true), - }, - []*commonpb.KeyValue{ - { - Key: "int to int", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 123, - }, - }, - }, - { - Key: "int64 to int64", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: 1234567, - }, - }, - }, - { - Key: "float64 to double", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: 1.61, - }, - }, - }, - { - Key: "string to string", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "string", - }, - }, - }, - { - Key: "bool to bool", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: true, - }, - }, - }, - }, - }, - } { - got := KeyValues(test.attrs) - if !assert.Len(t, got, len(test.expected)) { - continue - } - for i, actual := range got { - if a, ok := actual.Value.Value.(*commonpb.AnyValue_DoubleValue); ok { - e, ok := test.expected[i].Value.Value.(*commonpb.AnyValue_DoubleValue) - if !ok { - t.Errorf("expected AnyValue_DoubleValue, got %T", test.expected[i].Value.Value) - continue - } - if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { - continue - } - e.DoubleValue = a.DoubleValue - } - assert.Equal(t, test.expected[i], actual) - } - } -} - -func TestArrayAttributes(t *testing.T) { - // Array KeyValue supports only arrays of primitive types: - // "bool", "int", "int64", - // "float64", "string", - for _, test := range []attributeTest{ - {nil, nil}, - { - []attribute.KeyValue{ - { - Key: attribute.Key("invalid"), - Value: attribute.Value{}, - }, - }, - []*commonpb.KeyValue{ - { - Key: "invalid", - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: "INVALID", - }, - }, - }, - }, - }, - { - []attribute.KeyValue{ - attribute.BoolSlice("bool slice to bool array", []bool{true, false}), - attribute.IntSlice("int slice to int64 array", []int{1, 2, 3}), - attribute.Int64Slice("int64 slice to int64 array", []int64{1, 2, 3}), - attribute.Float64Slice("float64 slice to double array", []float64{1.11, 2.22, 3.33}), - attribute.StringSlice("string slice to string array", []string{"foo", "bar", "baz"}), - }, - []*commonpb.KeyValue{ - newOTelBoolArray("bool slice to bool array", []bool{true, false}), - newOTelIntArray("int slice to int64 array", []int64{1, 2, 3}), - newOTelIntArray("int64 slice to int64 array", []int64{1, 2, 3}), - newOTelDoubleArray("float64 slice to double array", []float64{1.11, 2.22, 3.33}), - newOTelStringArray("string slice to string array", []string{"foo", "bar", "baz"}), - }, - }, - } { - actualArrayAttributes := KeyValues(test.attrs) - expectedArrayAttributes := test.expected - if !assert.Len(t, actualArrayAttributes, len(expectedArrayAttributes)) { - continue - } - - for i, actualArrayAttr := range actualArrayAttributes { - expectedArrayAttr := expectedArrayAttributes[i] - expectedKey, actualKey := expectedArrayAttr.Key, actualArrayAttr.Key - if !assert.Equal(t, expectedKey, actualKey) { - continue - } - - expected := expectedArrayAttr.Value.GetArrayValue() - actual := actualArrayAttr.Value.GetArrayValue() - if expected == nil { - assert.Nil(t, actual) - continue - } - if assert.NotNil(t, actual, "expected not nil for %s", actualKey) { - assertExpectedArrayValues(t, expected.Values, actual.Values) - } - } - } -} - -func assertExpectedArrayValues(t *testing.T, expectedValues, actualValues []*commonpb.AnyValue) { - for i, actual := range actualValues { - expected := expectedValues[i] - if a, ok := actual.Value.(*commonpb.AnyValue_DoubleValue); ok { - e, ok := expected.Value.(*commonpb.AnyValue_DoubleValue) - if !ok { - t.Errorf("expected AnyValue_DoubleValue, got %T", expected.Value) - continue - } - if !assert.InDelta(t, e.DoubleValue, a.DoubleValue, 0.01) { - continue - } - e.DoubleValue = a.DoubleValue - } - assert.Equal(t, expected, actual) - } -} - -func newOTelBoolArray(key string, values []bool) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - for _, b := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_BoolValue{ - BoolValue: b, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelIntArray(key string, values []int64) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, i := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_IntValue{ - IntValue: i, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelDoubleArray(key string, values []float64) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, d := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_DoubleValue{ - DoubleValue: d, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelStringArray(key string, values []string) *commonpb.KeyValue { - arrayValues := []*commonpb.AnyValue{} - - for _, s := range values { - arrayValues = append(arrayValues, &commonpb.AnyValue{ - Value: &commonpb.AnyValue_StringValue{ - StringValue: s, - }, - }) - } - - return newOTelArray(key, arrayValues) -} - -func newOTelArray(key string, arrayValues []*commonpb.AnyValue) *commonpb.KeyValue { - return &commonpb.KeyValue{ - Key: key, - Value: &commonpb.AnyValue{ - Value: &commonpb.AnyValue_ArrayValue{ - ArrayValue: &commonpb.ArrayValue{ - Values: arrayValues, - }, - }, - }, - } -} diff --git a/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl deleted file mode 100644 index 13628d63b2d..00000000000 --- a/internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/resource_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/resource" -) - -func TestNilResource(t *testing.T) { - assert.Empty(t, Resource(nil)) -} - -func TestEmptyResource(t *testing.T) { - assert.Empty(t, Resource(&resource.Resource{})) -} - -/* -* This does not include any testing on the ordering of Resource Attributes. -* They are stored as a map internally to the Resource and their order is not -* guaranteed. - */ - -func TestResourceAttributes(t *testing.T) { - attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} - - got := Resource(resource.NewSchemaless(attrs...)).GetAttributes() - if !assert.Len(t, attrs, 2) { - return - } - assert.ElementsMatch(t, KeyValues(attrs), got) -} diff --git a/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl deleted file mode 100644 index 4204b11a59a..00000000000 --- a/internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl +++ /dev/null @@ -1,208 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/span.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform - -import ( - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/instrumentation" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/trace" - tracepb "go.opentelemetry.io/proto/otlp/trace/v1" -) - -// Spans transforms a slice of OpenTelemetry spans into a slice of OTLP -// ResourceSpans. -func Spans(sdl []tracesdk.ReadOnlySpan) []*tracepb.ResourceSpans { - if len(sdl) == 0 { - return nil - } - - rsm := make(map[attribute.Distinct]*tracepb.ResourceSpans) - - type key struct { - r attribute.Distinct - is instrumentation.Scope - } - ssm := make(map[key]*tracepb.ScopeSpans) - - var resources int - for _, sd := range sdl { - if sd == nil { - continue - } - - rKey := sd.Resource().Equivalent() - k := key{ - r: rKey, - is: sd.InstrumentationScope(), - } - scopeSpan, iOk := ssm[k] - if !iOk { - // Either the resource or instrumentation scope were unknown. - scopeSpan = &tracepb.ScopeSpans{ - Scope: InstrumentationScope(sd.InstrumentationScope()), - Spans: []*tracepb.Span{}, - SchemaUrl: sd.InstrumentationScope().SchemaURL, - } - } - scopeSpan.Spans = append(scopeSpan.Spans, span(sd)) - ssm[k] = scopeSpan - - rs, rOk := rsm[rKey] - if !rOk { - resources++ - // The resource was unknown. - rs = &tracepb.ResourceSpans{ - Resource: Resource(sd.Resource()), - ScopeSpans: []*tracepb.ScopeSpans{scopeSpan}, - SchemaUrl: sd.Resource().SchemaURL(), - } - rsm[rKey] = rs - continue - } - - // The resource has been seen before. Check if the instrumentation - // library lookup was unknown because if so we need to add it to the - // ResourceSpans. Otherwise, the instrumentation library has already - // been seen and the append we did above will be included it in the - // ScopeSpans reference. - if !iOk { - rs.ScopeSpans = append(rs.ScopeSpans, scopeSpan) - } - } - - // Transform the categorized map into a slice - rss := make([]*tracepb.ResourceSpans, 0, resources) - for _, rs := range rsm { - rss = append(rss, rs) - } - return rss -} - -// span transforms a Span into an OTLP span. -func span(sd tracesdk.ReadOnlySpan) *tracepb.Span { - if sd == nil { - return nil - } - - tid := sd.SpanContext().TraceID() - sid := sd.SpanContext().SpanID() - - s := &tracepb.Span{ - TraceId: tid[:], - SpanId: sid[:], - TraceState: sd.SpanContext().TraceState().String(), - Status: status(sd.Status().Code, sd.Status().Description), - StartTimeUnixNano: uint64(sd.StartTime().UnixNano()), - EndTimeUnixNano: uint64(sd.EndTime().UnixNano()), - Links: links(sd.Links()), - Kind: spanKind(sd.SpanKind()), - Name: sd.Name(), - Attributes: KeyValues(sd.Attributes()), - Events: spanEvents(sd.Events()), - DroppedAttributesCount: uint32(sd.DroppedAttributes()), - DroppedEventsCount: uint32(sd.DroppedEvents()), - DroppedLinksCount: uint32(sd.DroppedLinks()), - } - - if psid := sd.Parent().SpanID(); psid.IsValid() { - s.ParentSpanId = psid[:] - } - - return s -} - -// status transform a span code and message into an OTLP span status. -func status(status codes.Code, message string) *tracepb.Status { - var c tracepb.Status_StatusCode - switch status { - case codes.Ok: - c = tracepb.Status_STATUS_CODE_OK - case codes.Error: - c = tracepb.Status_STATUS_CODE_ERROR - default: - c = tracepb.Status_STATUS_CODE_UNSET - } - return &tracepb.Status{ - Code: c, - Message: message, - } -} - -// links transforms span Links to OTLP span links. -func links(links []tracesdk.Link) []*tracepb.Span_Link { - if len(links) == 0 { - return nil - } - - sl := make([]*tracepb.Span_Link, 0, len(links)) - for _, otLink := range links { - // This redefinition is necessary to prevent otLink.*ID[:] copies - // being reused -- in short we need a new otLink per iteration. - otLink := otLink - - tid := otLink.SpanContext.TraceID() - sid := otLink.SpanContext.SpanID() - - sl = append(sl, &tracepb.Span_Link{ - TraceId: tid[:], - SpanId: sid[:], - Attributes: KeyValues(otLink.Attributes), - DroppedAttributesCount: uint32(otLink.DroppedAttributeCount), - }) - } - return sl -} - -// spanEvents transforms span Events to an OTLP span events. -func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { - if len(es) == 0 { - return nil - } - - events := make([]*tracepb.Span_Event, len(es)) - // Transform message events - for i := 0; i < len(es); i++ { - events[i] = &tracepb.Span_Event{ - Name: es[i].Name, - TimeUnixNano: uint64(es[i].Time.UnixNano()), - Attributes: KeyValues(es[i].Attributes), - DroppedAttributesCount: uint32(es[i].DroppedAttributeCount), - } - } - return events -} - -// spanKind transforms a SpanKind to an OTLP span kind. -func spanKind(kind trace.SpanKind) tracepb.Span_SpanKind { - switch kind { - case trace.SpanKindInternal: - return tracepb.Span_SPAN_KIND_INTERNAL - case trace.SpanKindClient: - return tracepb.Span_SPAN_KIND_CLIENT - case trace.SpanKindServer: - return tracepb.Span_SPAN_KIND_SERVER - case trace.SpanKindProducer: - return tracepb.Span_SPAN_KIND_PRODUCER - case trace.SpanKindConsumer: - return tracepb.Span_SPAN_KIND_CONSUMER - default: - return tracepb.Span_SPAN_KIND_UNSPECIFIED - } -} diff --git a/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl b/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl deleted file mode 100644 index 227711a9e34..00000000000 --- a/internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl +++ /dev/null @@ -1,336 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/otlp/otlptrace/tracetransform/span_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tracetransform - -import ( - "testing" - "time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/instrumentation" - "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.21.0" - "go.opentelemetry.io/otel/trace" - tracepb "go.opentelemetry.io/proto/otlp/trace/v1" -) - -func TestSpanKind(t *testing.T) { - for _, test := range []struct { - kind trace.SpanKind - expected tracepb.Span_SpanKind - }{ - { - trace.SpanKindInternal, - tracepb.Span_SPAN_KIND_INTERNAL, - }, - { - trace.SpanKindClient, - tracepb.Span_SPAN_KIND_CLIENT, - }, - { - trace.SpanKindServer, - tracepb.Span_SPAN_KIND_SERVER, - }, - { - trace.SpanKindProducer, - tracepb.Span_SPAN_KIND_PRODUCER, - }, - { - trace.SpanKindConsumer, - tracepb.Span_SPAN_KIND_CONSUMER, - }, - { - trace.SpanKind(-1), - tracepb.Span_SPAN_KIND_UNSPECIFIED, - }, - } { - assert.Equal(t, test.expected, spanKind(test.kind)) - } -} - -func TestNilSpanEvent(t *testing.T) { - assert.Nil(t, spanEvents(nil)) -} - -func TestEmptySpanEvent(t *testing.T) { - assert.Nil(t, spanEvents([]tracesdk.Event{})) -} - -func TestSpanEvent(t *testing.T) { - attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} - eventTime := time.Date(2020, 5, 20, 0, 0, 0, 0, time.UTC) - got := spanEvents([]tracesdk.Event{ - { - Name: "test 1", - Attributes: []attribute.KeyValue{}, - Time: eventTime, - }, - { - Name: "test 2", - Attributes: attrs, - Time: eventTime, - DroppedAttributeCount: 2, - }, - }) - if !assert.Len(t, got, 2) { - return - } - eventTimestamp := uint64(1589932800 * 1e9) - assert.Equal(t, &tracepb.Span_Event{Name: "test 1", Attributes: nil, TimeUnixNano: eventTimestamp}, got[0]) - // Do not test Attributes directly, just that the return value goes to the correct field. - assert.Equal(t, &tracepb.Span_Event{Name: "test 2", Attributes: KeyValues(attrs), TimeUnixNano: eventTimestamp, DroppedAttributesCount: 2}, got[1]) -} - -func TestNilLinks(t *testing.T) { - assert.Nil(t, links(nil)) -} - -func TestEmptyLinks(t *testing.T) { - assert.Nil(t, links([]tracesdk.Link{})) -} - -func TestLinks(t *testing.T) { - attrs := []attribute.KeyValue{attribute.Int("one", 1), attribute.Int("two", 2)} - l := []tracesdk.Link{ - { - DroppedAttributeCount: 3, - }, - { - SpanContext: trace.SpanContext{}, - Attributes: attrs, - DroppedAttributeCount: 3, - }, - } - got := links(l) - - // Make sure we get the same number back first. - if !assert.Len(t, got, 2) { - return - } - - // Empty should be empty. - expected := &tracepb.Span_Link{ - TraceId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - SpanId: []uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - DroppedAttributesCount: 3, - } - assert.Equal(t, expected, got[0]) - - // Do not test Attributes directly, just that the return value goes to the correct field. - expected.Attributes = KeyValues(attrs) - assert.Equal(t, expected, got[1]) - - // Changes to our links should not change the produced links. - l[1].SpanContext = l[1].SpanContext.WithTraceID(trace.TraceID{}) - assert.Equal(t, expected, got[1]) - assert.Equal(t, l[1].DroppedAttributeCount, int(got[1].DroppedAttributesCount)) -} - -func TestStatus(t *testing.T) { - for _, test := range []struct { - code codes.Code - message string - otlpStatus tracepb.Status_StatusCode - }{ - { - codes.Ok, - "test Ok", - tracepb.Status_STATUS_CODE_OK, - }, - { - codes.Unset, - "test Unset", - tracepb.Status_STATUS_CODE_UNSET, - }, - { - message: "default code is unset", - otlpStatus: tracepb.Status_STATUS_CODE_UNSET, - }, - { - codes.Error, - "test Error", - tracepb.Status_STATUS_CODE_ERROR, - }, - } { - expected := &tracepb.Status{Code: test.otlpStatus, Message: test.message} - assert.Equal(t, expected, status(test.code, test.message)) - } -} - -func TestNilSpan(t *testing.T) { - assert.Nil(t, span(nil)) -} - -func TestNilSpanData(t *testing.T) { - assert.Nil(t, Spans(nil)) -} - -func TestEmptySpanData(t *testing.T) { - assert.Nil(t, Spans(nil)) -} - -func TestSpanData(t *testing.T) { - // Full test of span data - - // March 31, 2020 5:01:26 1234nanos (UTC) - startTime := time.Unix(1585674086, 1234) - endTime := startTime.Add(10 * time.Second) - traceState, _ := trace.ParseTraceState("key1=val1,key2=val2") - spanData := tracetest.SpanStub{ - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, - SpanID: trace.SpanID{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, - TraceState: traceState, - }), - Parent: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, - SpanID: trace.SpanID{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8}, - TraceState: traceState, - Remote: true, - }), - SpanKind: trace.SpanKindServer, - Name: "span data to span data", - StartTime: startTime, - EndTime: endTime, - Events: []tracesdk.Event{ - {Time: startTime, - Attributes: []attribute.KeyValue{ - attribute.Int64("CompressedByteSize", 512), - }, - }, - {Time: endTime, - Attributes: []attribute.KeyValue{ - attribute.String("EventType", "Recv"), - }, - }, - }, - Links: []tracesdk.Link{ - { - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF}, - SpanID: trace.SpanID{0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7}, - TraceFlags: 0, - }), - Attributes: []attribute.KeyValue{ - attribute.String("LinkType", "Parent"), - }, - DroppedAttributeCount: 0, - }, - { - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF}, - SpanID: trace.SpanID{0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7}, - TraceFlags: 0, - }), - Attributes: []attribute.KeyValue{ - attribute.String("LinkType", "Child"), - }, - DroppedAttributeCount: 0, - }, - }, - Status: tracesdk.Status{ - Code: codes.Error, - Description: "utterly unrecognized", - }, - Attributes: []attribute.KeyValue{ - attribute.Int64("timeout_ns", 12e9), - }, - DroppedAttributes: 1, - DroppedEvents: 2, - DroppedLinks: 3, - Resource: resource.NewWithAttributes( - "http://example.com/custom-resource-schema", - attribute.String("rk1", "rv1"), - attribute.Int64("rk2", 5), - attribute.StringSlice("rk3", []string{"sv1", "sv2"}), - ), - InstrumentationLibrary: instrumentation.Scope{ - Name: "go.opentelemetry.io/test/otel", - Version: "v0.0.1", - SchemaURL: semconv.SchemaURL, - }, - } - - // Not checking resource as the underlying map of our Resource makes - // ordering impossible to guarantee on the output. The Resource - // transform function has unit tests that should suffice. - expectedSpan := &tracepb.Span{ - TraceId: []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}, - SpanId: []byte{0xFF, 0xFE, 0xFD, 0xFC, 0xFB, 0xFA, 0xF9, 0xF8}, - ParentSpanId: []byte{0xEF, 0xEE, 0xED, 0xEC, 0xEB, 0xEA, 0xE9, 0xE8}, - TraceState: "key1=val1,key2=val2", - Name: spanData.Name, - Kind: tracepb.Span_SPAN_KIND_SERVER, - StartTimeUnixNano: uint64(startTime.UnixNano()), - EndTimeUnixNano: uint64(endTime.UnixNano()), - Status: status(spanData.Status.Code, spanData.Status.Description), - Events: spanEvents(spanData.Events), - Links: links(spanData.Links), - Attributes: KeyValues(spanData.Attributes), - DroppedAttributesCount: 1, - DroppedEventsCount: 2, - DroppedLinksCount: 3, - } - - got := Spans(tracetest.SpanStubs{spanData}.Snapshots()) - require.Len(t, got, 1) - - assert.Equal(t, got[0].GetResource(), Resource(spanData.Resource)) - assert.Equal(t, got[0].SchemaUrl, spanData.Resource.SchemaURL()) - scopeSpans := got[0].GetScopeSpans() - require.Len(t, scopeSpans, 1) - assert.Equal(t, scopeSpans[0].SchemaUrl, spanData.InstrumentationLibrary.SchemaURL) - assert.Equal(t, scopeSpans[0].GetScope(), InstrumentationScope(spanData.InstrumentationLibrary)) - require.Len(t, scopeSpans[0].Spans, 1) - actualSpan := scopeSpans[0].Spans[0] - - if diff := cmp.Diff(expectedSpan, actualSpan, cmp.Comparer(proto.Equal)); diff != "" { - t.Fatalf("transformed span differs %v\n", diff) - } -} - -// Empty parent span ID should be treated as root span. -func TestRootSpanData(t *testing.T) { - sd := Spans(tracetest.SpanStubs{ - {}, - }.Snapshots()) - require.Len(t, sd, 1) - rs := sd[0] - scopeSpans := rs.GetScopeSpans() - require.Len(t, scopeSpans, 1) - got := scopeSpans[0].GetSpans()[0].GetParentSpanId() - - // Empty means root span. - assert.Nil(t, got, "incorrect transform of root parent span ID") -} - -func TestSpanDataNilResource(t *testing.T) { - assert.NotPanics(t, func() { - Spans(tracetest.SpanStubs{ - {}, - }.Snapshots()) - }) -} From c513972985f40a3d0814b756e8edd2c3169178c5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 10 Aug 2023 16:00:53 -0700 Subject: [PATCH 653/886] Generate internal/matchers (#4430) --- exporters/jaeger/internal/gen.go | 29 ++ exporters/jaeger/internal/internaltest/gen.go | 25 -- .../jaeger/internal/internaltest/harness.go | 2 +- .../jaeger/internal/matchers/expectation.go | 310 ++++++++++++++++++ .../jaeger/internal/matchers/expecter.go | 39 +++ .../internal/matchers/temporal_matcher.go | 28 ++ exporters/zipkin/internal/gen.go | 29 ++ exporters/zipkin/internal/internaltest/gen.go | 25 -- .../zipkin/internal/internaltest/harness.go | 2 +- .../zipkin/internal/matchers/expectation.go | 310 ++++++++++++++++++ .../zipkin/internal/matchers/expecter.go | 39 +++ .../internal/matchers/temporal_matcher.go | 28 ++ internal/gen.go | 29 ++ internal/internaltest/gen.go | 25 -- internal/matchers/expectation.go | 3 + internal/matchers/expecter.go | 3 + internal/matchers/temporal_matcher.go | 3 + internal/shared/internaltest/harness.go.tmpl | 2 +- internal/shared/matchers/expectation.go.tmpl | 310 ++++++++++++++++++ internal/shared/matchers/expecter.go.tmpl | 39 +++ .../shared/matchers/temporal_matcher.go.tmpl | 28 ++ sdk/internal/gen.go | 29 ++ sdk/internal/internaltest/gen.go | 25 -- sdk/internal/internaltest/harness.go | 2 +- sdk/internal/matchers/expectation.go | 310 ++++++++++++++++++ sdk/internal/matchers/expecter.go | 39 +++ sdk/internal/matchers/temporal_matcher.go | 28 ++ 27 files changed, 1637 insertions(+), 104 deletions(-) create mode 100644 exporters/jaeger/internal/gen.go delete mode 100644 exporters/jaeger/internal/internaltest/gen.go create mode 100644 exporters/jaeger/internal/matchers/expectation.go create mode 100644 exporters/jaeger/internal/matchers/expecter.go create mode 100644 exporters/jaeger/internal/matchers/temporal_matcher.go create mode 100644 exporters/zipkin/internal/gen.go delete mode 100644 exporters/zipkin/internal/internaltest/gen.go create mode 100644 exporters/zipkin/internal/matchers/expectation.go create mode 100644 exporters/zipkin/internal/matchers/expecter.go create mode 100644 exporters/zipkin/internal/matchers/temporal_matcher.go create mode 100644 internal/gen.go delete mode 100644 internal/internaltest/gen.go create mode 100644 internal/shared/matchers/expectation.go.tmpl create mode 100644 internal/shared/matchers/expecter.go.tmpl create mode 100644 internal/shared/matchers/temporal_matcher.go.tmpl create mode 100644 sdk/internal/gen.go delete mode 100644 sdk/internal/internaltest/gen.go create mode 100644 sdk/internal/matchers/expectation.go create mode 100644 sdk/internal/matchers/expecter.go create mode 100644 sdk/internal/matchers/temporal_matcher.go diff --git a/exporters/jaeger/internal/gen.go b/exporters/jaeger/internal/gen.go new file mode 100644 index 00000000000..ceb2b04e3d6 --- /dev/null +++ b/exporters/jaeger/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/jaeger/internal" + +//go:generate gotmpl --body=../../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=../../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=../../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/exporters/jaeger/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/exporters/jaeger/internal/internaltest/gen.go b/exporters/jaeger/internal/internaltest/gen.go deleted file mode 100644 index 3ee9f78234a..00000000000 --- a/exporters/jaeger/internal/internaltest/gen.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -//go:generate gotmpl --body=../../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/exporters/jaeger/internal/internaltest/harness.go b/exporters/jaeger/internal/internaltest/harness.go index 3922726c72d..a938e733965 100644 --- a/exporters/jaeger/internal/internaltest/harness.go +++ b/exporters/jaeger/internal/internaltest/harness.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/jaeger/internal/matchers/expectation.go b/exporters/jaeger/internal/matchers/expectation.go new file mode 100644 index 00000000000..8b1ab860867 --- /dev/null +++ b/exporters/jaeger/internal/matchers/expectation.go @@ -0,0 +1,310 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expectation.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" + +import ( + "fmt" + "reflect" + "regexp" + "runtime/debug" + "strings" + "testing" + "time" +) + +var ( + stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) +) + +type Expectation struct { + t *testing.T + actual interface{} +} + +func (e *Expectation) ToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if !reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) NotToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) ToBeNil() { + if e.actual != nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be nil", e.actual)) + } +} + +func (e *Expectation) NotToBeNil() { + if e.actual == nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to be nil", e.actual)) + } +} + +func (e *Expectation) ToBeTrue() { + switch a := e.actual.(type) { + case bool: + if !a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToBeFalse() { + switch a := e.actual.(type) { + case bool: + if a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) NotToPanic() { + switch a := e.actual.(type) { + case func(): + func() { + defer func() { + if recovered := recover(); recovered != nil { + e.fail(fmt.Sprintf("Expected panic\n\t%v\nto have not been raised", recovered)) + } + }() + + a() + }() + default: + e.fail(fmt.Sprintf("Cannot check if non-func value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToSucceed() { + switch actual := e.actual.(type) { + case error: + if actual != nil { + e.fail(fmt.Sprintf("Expected error\n\t%v\nto have succeeded", actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nsucceeded", actual)) + } +} + +func (e *Expectation) ToMatchError(expected interface{}) { + e.verifyExpectedNotNil(expected) + + actual, ok := e.actual.(error) + if !ok { + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nmatches error", e.actual)) + } + + switch expected := expected.(type) { + case error: + if !reflect.DeepEqual(actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + case string: + if actual.Error() != expected { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + default: + e.fail(fmt.Sprintf("Cannot match\n\t%v\nagainst non-error\n\t%v", actual, expected)) + } +} + +func (e *Expectation) ToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + var contained bool + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + contained = true + break + } + } + + if !contained { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain\n\t%v", e.actual, expectedElem)) + return + } + } +} + +func (e *Expectation) NotToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to contain\n\t%v", e.actual, expectedElem)) + return + } + } + } +} + +func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", expected)) + return + } + + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + if actualKind != expectedKind { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be the same type as\n\t%v", e.actual, expected)) + return + } + + if actualValue.Len() != expectedValue.Len() { + e.fail(fmt.Sprintf("Expected\n\t%v\nto have the same length as\n\t%v", e.actual, expected)) + return + } + + var unmatched []interface{} + + for i := 0; i < expectedValue.Len(); i++ { + unmatched = append(unmatched, expectedValue.Index(i).Interface()) + } + + for i := 0; i < actualValue.Len(); i++ { + var found bool + + for j, elem := range unmatched { + if reflect.DeepEqual(actualValue.Index(i).Interface(), elem) { + found = true + unmatched = append(unmatched[:j], unmatched[j+1:]...) + + break + } + } + + if !found { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain the same elements as\n\t%v", e.actual, expected)) + } + } +} + +func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { + if actual, ok := e.actual.(time.Time); ok { + ct, ok := compareTo.(time.Time) + if !ok { + e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) + return + } + + switch matcher { + case Before: + if !actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) + } + case BeforeOrSameTime: + if actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) + } + case After: + if !actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) + } + case AfterOrSameTime: + if actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) + } + default: + e.fail("Cannot compare times with unexpected temporal matcher") + } + + return + } + + e.fail(fmt.Sprintf("Cannot compare non-temporal value\n\t%v", e.actual)) +} + +func (e *Expectation) verifyExpectedNotNil(expected interface{}) { + if expected == nil { + e.fail("Refusing to compare with . Use `ToBeNil` or `NotToBeNil` instead.") + } +} + +func (e *Expectation) fail(msg string) { + // Prune the stack trace so that it's easier to see relevant lines + stack := strings.Split(string(debug.Stack()), "\n") + var prunedStack []string + + for _, line := range stack { + if !stackTracePruneRE.MatchString(line) { + prunedStack = append(prunedStack, line) + } + } + + e.t.Fatalf("\n%s\n%s\n", strings.Join(prunedStack, "\n"), msg) +} diff --git a/exporters/jaeger/internal/matchers/expecter.go b/exporters/jaeger/internal/matchers/expecter.go new file mode 100644 index 00000000000..54f331025d8 --- /dev/null +++ b/exporters/jaeger/internal/matchers/expecter.go @@ -0,0 +1,39 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expecter.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" + +import ( + "testing" +) + +type Expecter struct { + t *testing.T +} + +func NewExpecter(t *testing.T) *Expecter { + return &Expecter{ + t: t, + } +} + +func (a *Expecter) Expect(actual interface{}) *Expectation { + return &Expectation{ + t: a.t, + actual: actual, + } +} diff --git a/exporters/jaeger/internal/matchers/temporal_matcher.go b/exporters/jaeger/internal/matchers/temporal_matcher.go new file mode 100644 index 00000000000..82871f71089 --- /dev/null +++ b/exporters/jaeger/internal/matchers/temporal_matcher.go @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/temporal_matcher.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" + +type TemporalMatcher byte + +//nolint:revive // ignoring missing comments for unexported constants in an internal package +const ( + Before TemporalMatcher = iota + BeforeOrSameTime + After + AfterOrSameTime +) diff --git a/exporters/zipkin/internal/gen.go b/exporters/zipkin/internal/gen.go new file mode 100644 index 00000000000..c686454cee4 --- /dev/null +++ b/exporters/zipkin/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/exporters/zipkin/internal" + +//go:generate gotmpl --body=../../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=../../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=../../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/exporters/zipkin/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/exporters/zipkin/internal/internaltest/gen.go b/exporters/zipkin/internal/internaltest/gen.go deleted file mode 100644 index c176d366b5f..00000000000 --- a/exporters/zipkin/internal/internaltest/gen.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/zipkin/internal/internaltest" - -//go:generate gotmpl --body=../../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go -//go:generate gotmpl --body=../../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/exporters/zipkin/internal/internaltest/harness.go b/exporters/zipkin/internal/internaltest/harness.go index 33b4f82307d..d8118d4f3b5 100644 --- a/exporters/zipkin/internal/internaltest/harness.go +++ b/exporters/zipkin/internal/internaltest/harness.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/exporters/zipkin/internal/matchers" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/internal/matchers/expectation.go b/exporters/zipkin/internal/matchers/expectation.go new file mode 100644 index 00000000000..411300d5819 --- /dev/null +++ b/exporters/zipkin/internal/matchers/expectation.go @@ -0,0 +1,310 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expectation.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/zipkin/internal/matchers" + +import ( + "fmt" + "reflect" + "regexp" + "runtime/debug" + "strings" + "testing" + "time" +) + +var ( + stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) +) + +type Expectation struct { + t *testing.T + actual interface{} +} + +func (e *Expectation) ToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if !reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) NotToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) ToBeNil() { + if e.actual != nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be nil", e.actual)) + } +} + +func (e *Expectation) NotToBeNil() { + if e.actual == nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to be nil", e.actual)) + } +} + +func (e *Expectation) ToBeTrue() { + switch a := e.actual.(type) { + case bool: + if !a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToBeFalse() { + switch a := e.actual.(type) { + case bool: + if a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) NotToPanic() { + switch a := e.actual.(type) { + case func(): + func() { + defer func() { + if recovered := recover(); recovered != nil { + e.fail(fmt.Sprintf("Expected panic\n\t%v\nto have not been raised", recovered)) + } + }() + + a() + }() + default: + e.fail(fmt.Sprintf("Cannot check if non-func value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToSucceed() { + switch actual := e.actual.(type) { + case error: + if actual != nil { + e.fail(fmt.Sprintf("Expected error\n\t%v\nto have succeeded", actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nsucceeded", actual)) + } +} + +func (e *Expectation) ToMatchError(expected interface{}) { + e.verifyExpectedNotNil(expected) + + actual, ok := e.actual.(error) + if !ok { + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nmatches error", e.actual)) + } + + switch expected := expected.(type) { + case error: + if !reflect.DeepEqual(actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + case string: + if actual.Error() != expected { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + default: + e.fail(fmt.Sprintf("Cannot match\n\t%v\nagainst non-error\n\t%v", actual, expected)) + } +} + +func (e *Expectation) ToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + var contained bool + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + contained = true + break + } + } + + if !contained { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain\n\t%v", e.actual, expectedElem)) + return + } + } +} + +func (e *Expectation) NotToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to contain\n\t%v", e.actual, expectedElem)) + return + } + } + } +} + +func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", expected)) + return + } + + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + if actualKind != expectedKind { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be the same type as\n\t%v", e.actual, expected)) + return + } + + if actualValue.Len() != expectedValue.Len() { + e.fail(fmt.Sprintf("Expected\n\t%v\nto have the same length as\n\t%v", e.actual, expected)) + return + } + + var unmatched []interface{} + + for i := 0; i < expectedValue.Len(); i++ { + unmatched = append(unmatched, expectedValue.Index(i).Interface()) + } + + for i := 0; i < actualValue.Len(); i++ { + var found bool + + for j, elem := range unmatched { + if reflect.DeepEqual(actualValue.Index(i).Interface(), elem) { + found = true + unmatched = append(unmatched[:j], unmatched[j+1:]...) + + break + } + } + + if !found { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain the same elements as\n\t%v", e.actual, expected)) + } + } +} + +func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { + if actual, ok := e.actual.(time.Time); ok { + ct, ok := compareTo.(time.Time) + if !ok { + e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) + return + } + + switch matcher { + case Before: + if !actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) + } + case BeforeOrSameTime: + if actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) + } + case After: + if !actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) + } + case AfterOrSameTime: + if actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) + } + default: + e.fail("Cannot compare times with unexpected temporal matcher") + } + + return + } + + e.fail(fmt.Sprintf("Cannot compare non-temporal value\n\t%v", e.actual)) +} + +func (e *Expectation) verifyExpectedNotNil(expected interface{}) { + if expected == nil { + e.fail("Refusing to compare with . Use `ToBeNil` or `NotToBeNil` instead.") + } +} + +func (e *Expectation) fail(msg string) { + // Prune the stack trace so that it's easier to see relevant lines + stack := strings.Split(string(debug.Stack()), "\n") + var prunedStack []string + + for _, line := range stack { + if !stackTracePruneRE.MatchString(line) { + prunedStack = append(prunedStack, line) + } + } + + e.t.Fatalf("\n%s\n%s\n", strings.Join(prunedStack, "\n"), msg) +} diff --git a/exporters/zipkin/internal/matchers/expecter.go b/exporters/zipkin/internal/matchers/expecter.go new file mode 100644 index 00000000000..e29b15c7914 --- /dev/null +++ b/exporters/zipkin/internal/matchers/expecter.go @@ -0,0 +1,39 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expecter.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/zipkin/internal/matchers" + +import ( + "testing" +) + +type Expecter struct { + t *testing.T +} + +func NewExpecter(t *testing.T) *Expecter { + return &Expecter{ + t: t, + } +} + +func (a *Expecter) Expect(actual interface{}) *Expectation { + return &Expectation{ + t: a.t, + actual: actual, + } +} diff --git a/exporters/zipkin/internal/matchers/temporal_matcher.go b/exporters/zipkin/internal/matchers/temporal_matcher.go new file mode 100644 index 00000000000..dbd2690b4d6 --- /dev/null +++ b/exporters/zipkin/internal/matchers/temporal_matcher.go @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/temporal_matcher.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/exporters/zipkin/internal/matchers" + +type TemporalMatcher byte + +//nolint:revive // ignoring missing comments for unexported constants in an internal package +const ( + Before TemporalMatcher = iota + BeforeOrSameTime + After + AfterOrSameTime +) diff --git a/internal/gen.go b/internal/gen.go new file mode 100644 index 00000000000..f532f07e9e5 --- /dev/null +++ b/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/internal" + +//go:generate gotmpl --body=./shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=./shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=./shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=./shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=./shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=./shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=./shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=./shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=./shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=./shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/internal/internaltest/gen.go b/internal/internaltest/gen.go deleted file mode 100644 index 252143b5bee..00000000000 --- a/internal/internaltest/gen.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/internal/internaltest" - -//go:generate gotmpl --body=../shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go -//go:generate gotmpl --body=../shared/internaltest/env.go.tmpl "--data={}" --out=env.go -//go:generate gotmpl --body=../shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go -//go:generate gotmpl --body=../shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go -//go:generate gotmpl --body=../shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go -//go:generate gotmpl --body=../shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go -//go:generate gotmpl --body=../shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go -//go:generate gotmpl --body=../shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go -//go:generate gotmpl --body=../shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/internal/matchers/expectation.go b/internal/matchers/expectation.go index 0bf26266925..9cf408258b0 100644 --- a/internal/matchers/expectation.go +++ b/internal/matchers/expectation.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expectation.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/matchers/expecter.go b/internal/matchers/expecter.go index 60221d5ec05..fc2ac0fb37e 100644 --- a/internal/matchers/expecter.go +++ b/internal/matchers/expecter.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expecter.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/matchers/temporal_matcher.go b/internal/matchers/temporal_matcher.go index 75ed7dc0380..7e647a56722 100644 --- a/internal/matchers/temporal_matcher.go +++ b/internal/matchers/temporal_matcher.go @@ -1,3 +1,6 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/temporal_matcher.go.tmpl + // Copyright The OpenTelemetry Authors // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/internal/shared/internaltest/harness.go.tmpl b/internal/shared/internaltest/harness.go.tmpl index ced44588894..da3e7f18615 100644 --- a/internal/shared/internaltest/harness.go.tmpl +++ b/internal/shared/internaltest/harness.go.tmpl @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/internal/matchers" + "{{ .matchersImportPath }}" "go.opentelemetry.io/otel/trace" ) diff --git a/internal/shared/matchers/expectation.go.tmpl b/internal/shared/matchers/expectation.go.tmpl new file mode 100644 index 00000000000..bdde84ea78a --- /dev/null +++ b/internal/shared/matchers/expectation.go.tmpl @@ -0,0 +1,310 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expectation.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers + +import ( + "fmt" + "reflect" + "regexp" + "runtime/debug" + "strings" + "testing" + "time" +) + +var ( + stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) +) + +type Expectation struct { + t *testing.T + actual interface{} +} + +func (e *Expectation) ToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if !reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) NotToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) ToBeNil() { + if e.actual != nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be nil", e.actual)) + } +} + +func (e *Expectation) NotToBeNil() { + if e.actual == nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to be nil", e.actual)) + } +} + +func (e *Expectation) ToBeTrue() { + switch a := e.actual.(type) { + case bool: + if !a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToBeFalse() { + switch a := e.actual.(type) { + case bool: + if a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) NotToPanic() { + switch a := e.actual.(type) { + case func(): + func() { + defer func() { + if recovered := recover(); recovered != nil { + e.fail(fmt.Sprintf("Expected panic\n\t%v\nto have not been raised", recovered)) + } + }() + + a() + }() + default: + e.fail(fmt.Sprintf("Cannot check if non-func value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToSucceed() { + switch actual := e.actual.(type) { + case error: + if actual != nil { + e.fail(fmt.Sprintf("Expected error\n\t%v\nto have succeeded", actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nsucceeded", actual)) + } +} + +func (e *Expectation) ToMatchError(expected interface{}) { + e.verifyExpectedNotNil(expected) + + actual, ok := e.actual.(error) + if !ok { + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nmatches error", e.actual)) + } + + switch expected := expected.(type) { + case error: + if !reflect.DeepEqual(actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + case string: + if actual.Error() != expected { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + default: + e.fail(fmt.Sprintf("Cannot match\n\t%v\nagainst non-error\n\t%v", actual, expected)) + } +} + +func (e *Expectation) ToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + var contained bool + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + contained = true + break + } + } + + if !contained { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain\n\t%v", e.actual, expectedElem)) + return + } + } +} + +func (e *Expectation) NotToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to contain\n\t%v", e.actual, expectedElem)) + return + } + } + } +} + +func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", expected)) + return + } + + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + if actualKind != expectedKind { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be the same type as\n\t%v", e.actual, expected)) + return + } + + if actualValue.Len() != expectedValue.Len() { + e.fail(fmt.Sprintf("Expected\n\t%v\nto have the same length as\n\t%v", e.actual, expected)) + return + } + + var unmatched []interface{} + + for i := 0; i < expectedValue.Len(); i++ { + unmatched = append(unmatched, expectedValue.Index(i).Interface()) + } + + for i := 0; i < actualValue.Len(); i++ { + var found bool + + for j, elem := range unmatched { + if reflect.DeepEqual(actualValue.Index(i).Interface(), elem) { + found = true + unmatched = append(unmatched[:j], unmatched[j+1:]...) + + break + } + } + + if !found { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain the same elements as\n\t%v", e.actual, expected)) + } + } +} + +func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { + if actual, ok := e.actual.(time.Time); ok { + ct, ok := compareTo.(time.Time) + if !ok { + e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) + return + } + + switch matcher { + case Before: + if !actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) + } + case BeforeOrSameTime: + if actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) + } + case After: + if !actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) + } + case AfterOrSameTime: + if actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) + } + default: + e.fail("Cannot compare times with unexpected temporal matcher") + } + + return + } + + e.fail(fmt.Sprintf("Cannot compare non-temporal value\n\t%v", e.actual)) +} + +func (e *Expectation) verifyExpectedNotNil(expected interface{}) { + if expected == nil { + e.fail("Refusing to compare with . Use `ToBeNil` or `NotToBeNil` instead.") + } +} + +func (e *Expectation) fail(msg string) { + // Prune the stack trace so that it's easier to see relevant lines + stack := strings.Split(string(debug.Stack()), "\n") + var prunedStack []string + + for _, line := range stack { + if !stackTracePruneRE.MatchString(line) { + prunedStack = append(prunedStack, line) + } + } + + e.t.Fatalf("\n%s\n%s\n", strings.Join(prunedStack, "\n"), msg) +} diff --git a/internal/shared/matchers/expecter.go.tmpl b/internal/shared/matchers/expecter.go.tmpl new file mode 100644 index 00000000000..be06071e4bd --- /dev/null +++ b/internal/shared/matchers/expecter.go.tmpl @@ -0,0 +1,39 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expecter.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers + +import ( + "testing" +) + +type Expecter struct { + t *testing.T +} + +func NewExpecter(t *testing.T) *Expecter { + return &Expecter{ + t: t, + } +} + +func (a *Expecter) Expect(actual interface{}) *Expectation { + return &Expectation{ + t: a.t, + actual: actual, + } +} diff --git a/internal/shared/matchers/temporal_matcher.go.tmpl b/internal/shared/matchers/temporal_matcher.go.tmpl new file mode 100644 index 00000000000..270a3d84f99 --- /dev/null +++ b/internal/shared/matchers/temporal_matcher.go.tmpl @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/temporal_matcher.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers + +type TemporalMatcher byte + +//nolint:revive // ignoring missing comments for unexported constants in an internal package +const ( + Before TemporalMatcher = iota + BeforeOrSameTime + After + AfterOrSameTime +) diff --git a/sdk/internal/gen.go b/sdk/internal/gen.go new file mode 100644 index 00000000000..bd84f624b45 --- /dev/null +++ b/sdk/internal/gen.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package internal // import "go.opentelemetry.io/otel/sdk/internal" + +//go:generate gotmpl --body=../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go +//go:generate gotmpl --body=../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go +//go:generate gotmpl --body=../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go + +//go:generate gotmpl --body=../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go +//go:generate gotmpl --body=../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go +//go:generate gotmpl --body=../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go +//go:generate gotmpl --body=../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go +//go:generate gotmpl --body=../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/sdk/internal/matchers\"}" --out=internaltest/harness.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go +//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/sdk/internal/internaltest/gen.go b/sdk/internal/internaltest/gen.go deleted file mode 100644 index a518c232c0d..00000000000 --- a/sdk/internal/internaltest/gen.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/sdk/internal/internaltest" - -//go:generate gotmpl --body=../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=alignment.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=env.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=env_test.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=errors.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/harness.go.tmpl "--data={}" --out=harness.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=text_map_carrier.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=text_map_carrier_test.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=text_map_propagator.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=text_map_propagator_test.go diff --git a/sdk/internal/internaltest/harness.go b/sdk/internal/internaltest/harness.go index cd0207ca198..f177b0567a9 100644 --- a/sdk/internal/internaltest/harness.go +++ b/sdk/internal/internaltest/harness.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/internal/matchers" + "go.opentelemetry.io/otel/sdk/internal/matchers" "go.opentelemetry.io/otel/trace" ) diff --git a/sdk/internal/matchers/expectation.go b/sdk/internal/matchers/expectation.go new file mode 100644 index 00000000000..84764308651 --- /dev/null +++ b/sdk/internal/matchers/expectation.go @@ -0,0 +1,310 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expectation.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/sdk/internal/matchers" + +import ( + "fmt" + "reflect" + "regexp" + "runtime/debug" + "strings" + "testing" + "time" +) + +var ( + stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) +) + +type Expectation struct { + t *testing.T + actual interface{} +} + +func (e *Expectation) ToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if !reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) NotToEqual(expected interface{}) { + e.verifyExpectedNotNil(expected) + + if reflect.DeepEqual(e.actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to equal\n\t%v", e.actual, expected)) + } +} + +func (e *Expectation) ToBeNil() { + if e.actual != nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be nil", e.actual)) + } +} + +func (e *Expectation) NotToBeNil() { + if e.actual == nil { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to be nil", e.actual)) + } +} + +func (e *Expectation) ToBeTrue() { + switch a := e.actual.(type) { + case bool: + if !a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToBeFalse() { + switch a := e.actual.(type) { + case bool: + if a { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) NotToPanic() { + switch a := e.actual.(type) { + case func(): + func() { + defer func() { + if recovered := recover(); recovered != nil { + e.fail(fmt.Sprintf("Expected panic\n\t%v\nto have not been raised", recovered)) + } + }() + + a() + }() + default: + e.fail(fmt.Sprintf("Cannot check if non-func value\n\t%v\nis truthy", a)) + } +} + +func (e *Expectation) ToSucceed() { + switch actual := e.actual.(type) { + case error: + if actual != nil { + e.fail(fmt.Sprintf("Expected error\n\t%v\nto have succeeded", actual)) + } + default: + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nsucceeded", actual)) + } +} + +func (e *Expectation) ToMatchError(expected interface{}) { + e.verifyExpectedNotNil(expected) + + actual, ok := e.actual.(error) + if !ok { + e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nmatches error", e.actual)) + } + + switch expected := expected.(type) { + case error: + if !reflect.DeepEqual(actual, expected) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + case string: + if actual.Error() != expected { + e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) + } + default: + e.fail(fmt.Sprintf("Cannot match\n\t%v\nagainst non-error\n\t%v", actual, expected)) + } +} + +func (e *Expectation) ToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + var contained bool + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + contained = true + break + } + } + + if !contained { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain\n\t%v", e.actual, expectedElem)) + return + } + } +} + +func (e *Expectation) NotToContain(expected interface{}) { + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + switch actualKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) + return + } + + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + expectedValue = reflect.ValueOf([]interface{}{expected}) + } + + for i := 0; i < expectedValue.Len(); i++ { + expectedElem := expectedValue.Index(i).Interface() + + for j := 0; j < actualValue.Len(); j++ { + if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { + e.fail(fmt.Sprintf("Expected\n\t%v\nnot to contain\n\t%v", e.actual, expectedElem)) + return + } + } + } +} + +func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { + expectedValue := reflect.ValueOf(expected) + expectedKind := expectedValue.Kind() + + switch expectedKind { + case reflect.Array, reflect.Slice: + default: + e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", expected)) + return + } + + actualValue := reflect.ValueOf(e.actual) + actualKind := actualValue.Kind() + + if actualKind != expectedKind { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be the same type as\n\t%v", e.actual, expected)) + return + } + + if actualValue.Len() != expectedValue.Len() { + e.fail(fmt.Sprintf("Expected\n\t%v\nto have the same length as\n\t%v", e.actual, expected)) + return + } + + var unmatched []interface{} + + for i := 0; i < expectedValue.Len(); i++ { + unmatched = append(unmatched, expectedValue.Index(i).Interface()) + } + + for i := 0; i < actualValue.Len(); i++ { + var found bool + + for j, elem := range unmatched { + if reflect.DeepEqual(actualValue.Index(i).Interface(), elem) { + found = true + unmatched = append(unmatched[:j], unmatched[j+1:]...) + + break + } + } + + if !found { + e.fail(fmt.Sprintf("Expected\n\t%v\nto contain the same elements as\n\t%v", e.actual, expected)) + } + } +} + +func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { + if actual, ok := e.actual.(time.Time); ok { + ct, ok := compareTo.(time.Time) + if !ok { + e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) + return + } + + switch matcher { + case Before: + if !actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) + } + case BeforeOrSameTime: + if actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) + } + case After: + if !actual.After(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) + } + case AfterOrSameTime: + if actual.Before(ct) { + e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) + } + default: + e.fail("Cannot compare times with unexpected temporal matcher") + } + + return + } + + e.fail(fmt.Sprintf("Cannot compare non-temporal value\n\t%v", e.actual)) +} + +func (e *Expectation) verifyExpectedNotNil(expected interface{}) { + if expected == nil { + e.fail("Refusing to compare with . Use `ToBeNil` or `NotToBeNil` instead.") + } +} + +func (e *Expectation) fail(msg string) { + // Prune the stack trace so that it's easier to see relevant lines + stack := strings.Split(string(debug.Stack()), "\n") + var prunedStack []string + + for _, line := range stack { + if !stackTracePruneRE.MatchString(line) { + prunedStack = append(prunedStack, line) + } + } + + e.t.Fatalf("\n%s\n%s\n", strings.Join(prunedStack, "\n"), msg) +} diff --git a/sdk/internal/matchers/expecter.go b/sdk/internal/matchers/expecter.go new file mode 100644 index 00000000000..089b6cf6d4b --- /dev/null +++ b/sdk/internal/matchers/expecter.go @@ -0,0 +1,39 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/expecter.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/sdk/internal/matchers" + +import ( + "testing" +) + +type Expecter struct { + t *testing.T +} + +func NewExpecter(t *testing.T) *Expecter { + return &Expecter{ + t: t, + } +} + +func (a *Expecter) Expect(actual interface{}) *Expectation { + return &Expectation{ + t: a.t, + actual: actual, + } +} diff --git a/sdk/internal/matchers/temporal_matcher.go b/sdk/internal/matchers/temporal_matcher.go new file mode 100644 index 00000000000..7703064aced --- /dev/null +++ b/sdk/internal/matchers/temporal_matcher.go @@ -0,0 +1,28 @@ +// Code created by gotmpl. DO NOT MODIFY. +// source: internal/shared/matchers/temporal_matcher.go.tmpl + +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package matchers // import "go.opentelemetry.io/otel/sdk/internal/matchers" + +type TemporalMatcher byte + +//nolint:revive // ignoring missing comments for unexported constants in an internal package +const ( + Before TemporalMatcher = iota + BeforeOrSameTime + After + AfterOrSameTime +) From a9552aaffa8266578d4195db5f844583749a6d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 11 Aug 2023 09:22:21 +0200 Subject: [PATCH 654/886] sdk/metric: Remove Reader.ForceFlush and ManualReader.ForceFlush (#4375) --- CHANGELOG.md | 5 +++++ sdk/metric/config.go | 4 +++- sdk/metric/manual_reader.go | 7 ------- sdk/metric/periodic_reader_test.go | 12 +++++++++++- sdk/metric/provider.go | 3 +++ sdk/metric/reader.go | 10 ---------- sdk/metric/reader_test.go | 20 +++++++------------- 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a262e1c86b6..53588f04d8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) +### Removed + +- Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. + Notice that `PeriodicReader.ForceFlush` is still available. (#4375) + ### Fixed - Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) diff --git a/sdk/metric/config.go b/sdk/metric/config.go index c837df8b76f..0b191128494 100644 --- a/sdk/metric/config.go +++ b/sdk/metric/config.go @@ -37,7 +37,9 @@ func (c config) readerSignals() (forceFlush, shutdown func(context.Context) erro var fFuncs, sFuncs []func(context.Context) error for _, r := range c.readers { sFuncs = append(sFuncs, r.Shutdown) - fFuncs = append(fFuncs, r.ForceFlush) + if f, ok := r.(interface{ ForceFlush(context.Context) error }); ok { + fFuncs = append(fFuncs, f.ForceFlush) + } } return unify(fFuncs), unifyShutdown(sFuncs) diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 898af86edc0..a7715f5b34f 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -91,13 +91,6 @@ func (mr *ManualReader) aggregation(kind InstrumentKind) aggregation.Aggregation return mr.aggregationSelector(kind) } -// ForceFlush is a no-op, it always returns nil. -// -// This method is safe to call concurrently. -func (mr *ManualReader) ForceFlush(context.Context) error { - return nil -} - // Shutdown closes any connections and frees any resources used by the reader. // // This method is safe to call concurrently. diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 0a34b7e9951..0e9d66944c2 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "go.opentelemetry.io/otel" @@ -198,7 +199,7 @@ func (e *fnExporter) Shutdown(ctx context.Context) error { type periodicReaderTestSuite struct { *readerTestSuite - ErrReader Reader + ErrReader *PeriodicReader } func (ts *periodicReaderTestSuite) SetupTest() { @@ -425,6 +426,15 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { }) } +func TestPeriodicReaderMultipleForceFlush(t *testing.T) { + ctx := context.Background() + r := NewPeriodicReader(new(fnExporter)) + r.register(testSDKProducer{}) + r.RegisterProducer(testExternalProducer{}) + require.NoError(t, r.ForceFlush(ctx)) + require.NoError(t, r.ForceFlush(ctx)) +} + func BenchmarkPeriodicReader(b *testing.B) { b.Run("Collect", benchReaderCollectFunc( NewPeriodicReader(new(fnExporter)), diff --git a/sdk/metric/provider.go b/sdk/metric/provider.go index 49dd071c9d3..7d1a9183ce1 100644 --- a/sdk/metric/provider.go +++ b/sdk/metric/provider.go @@ -110,6 +110,9 @@ func (mp *MeterProvider) Meter(name string, options ...metric.MeterOption) metri // telemetry be flushed or all resources have been released in these // situations. // +// ForceFlush calls ForceFlush(context.Context) error +// on all Readers that implements this method. +// // This method is safe to call concurrently. func (mp *MeterProvider) ForceFlush(ctx context.Context) error { if mp.forceFlush != nil { diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index da68ef33686..44dee654bdf 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -84,16 +84,6 @@ type Reader interface { // passed context is expected to be honored. Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error - // ForceFlush flushes all metric measurements held in an export pipeline. - // - // This deadline or cancellation of the passed context are honored. An appropriate - // error will be returned in these situations. There is no guaranteed that all - // telemetry be flushed or all resources have been released in these - // situations. - // - // This method needs to be concurrent safe. - ForceFlush(context.Context) error - // Shutdown flushes all metric measurements held in an export pipeline and releases any // held computational resources. // diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index 8904d68ee40..f2a20c0da27 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -93,14 +93,6 @@ func (ts *readerTestSuite) TestShutdownTwice() { ts.ErrorIs(ts.Reader.Shutdown(ctx), ErrReaderShutdown) } -func (ts *readerTestSuite) TestMultipleForceFlush() { - ctx := context.Background() - ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) - ts.Require().NoError(ts.Reader.ForceFlush(ctx)) - ts.NoError(ts.Reader.ForceFlush(ctx)) -} - func (ts *readerTestSuite) TestMultipleRegister() { p0 := testSDKProducer{ produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { @@ -186,11 +178,13 @@ func (ts *readerTestSuite) TestMethodConcurrentSafe() { _ = ts.Reader.Collect(ctx, nil) }() - wg.Add(1) - go func() { - defer wg.Done() - _ = ts.Reader.ForceFlush(ctx) - }() + if f, ok := ts.Reader.(interface{ ForceFlush(context.Context) error }); ok { + wg.Add(1) + go func() { + defer wg.Done() + _ = f.ForceFlush(ctx) + }() + } wg.Add(1) go func() { From e9014a287c8ab8f6d6f4566791913b0b6c7fcae1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 11 Aug 2023 00:49:47 -0700 Subject: [PATCH 655/886] Increase instrument name maximum length from 63 to 255 characters (#4434) --- CHANGELOG.md | 1 + sdk/metric/meter.go | 6 +++--- sdk/metric/meter_test.go | 9 +++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53588f04d8b..ebfa8d5a9a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) - `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) +- Increase instrument name maximum length from 63 to 255 characters. (#4434) ### Removed diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index caed7387c0a..9d2de67c594 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -28,7 +28,7 @@ import ( var ( // ErrInstrumentName indicates the created instrument has an invalid name. - // Valid names must consist of 63 or fewer characters including alphanumeric, _, ., -, and start with a letter. + // Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, and start with a letter. ErrInstrumentName = errors.New("invalid instrument name") ) @@ -252,8 +252,8 @@ func validateInstrumentName(name string) error { if len(name) == 0 { return fmt.Errorf("%w: %s: is empty", ErrInstrumentName, name) } - if len(name) > 63 { - return fmt.Errorf("%w: %s: longer than 63 characters", ErrInstrumentName, name) + if len(name) > 255 { + return fmt.Errorf("%w: %s: longer than 255 characters", ErrInstrumentName, name) } if !isAlpha([]rune(name)[0]) { return fmt.Errorf("%w: %s: must start with a letter", ErrInstrumentName, name) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 65f5acfa6c8..338d0d7a0e2 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -743,6 +743,11 @@ func TestMeterCreatesInstrumentsValidations(t *testing.T) { } func TestValidateInstrumentName(t *testing.T) { + const longName = "longNameOver255characters" + + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + + "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" testCases := []struct { name string @@ -776,8 +781,8 @@ func TestValidateInstrumentName(t *testing.T) { wantErr: fmt.Errorf("%w: name!: must only contain [A-Za-z0-9_.-]", ErrInstrumentName), }, { - name: "someverylongnamewhichisover63charactersbutallofwhichmatchtheregexp", - wantErr: fmt.Errorf("%w: someverylongnamewhichisover63charactersbutallofwhichmatchtheregexp: longer than 63 characters", ErrInstrumentName), + name: longName, + wantErr: fmt.Errorf("%w: %s: longer than 255 characters", ErrInstrumentName, longName), }, } From 7b9fb7ac873ef242a595d4ef6bcf7c17b1512f9b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 11 Aug 2023 07:35:02 -0700 Subject: [PATCH 656/886] Add lint to check for known cross-module internal packages (#4426) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add depguard conf for cross-mod internal pkg check * Apply feedback * Apply suggestions from code review --------- Co-authored-by: Robert Pająk --- .golangci.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index c0e4b95b23d..61782fbf0dd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -73,6 +73,56 @@ linters-settings: - pkg: "crypto/md5" - pkg: "crypto/sha1" - pkg: "crypto/**/pkix" + otlp-internal: + files: + - "!**/exporters/otlp/internal/**/*.go" + # TODO: remove the following when otlpmetric/internal is removed. + - "!**/exporters/otlp/otlpmetric/internal/oconf/envconfig.go" + - "!**/exporters/otlp/otlpmetric/internal/oconf/options.go" + - "!**/exporters/otlp/otlpmetric/internal/oconf/options_test.go" + - "!**/exporters/otlp/otlpmetric/internal/otest/client_test.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/internal" + desc: Do not use cross-module internal packages. + otlptrace-internal: + files: + - "!**/exporters/otlp/otlptrace/*.go" + - "!**/exporters/otlp/otlptrace/internal/**.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" + desc: Do not use cross-module internal packages. + otlpmetric-internal: + files: + - "!**/exporters/otlp/otlpmetric/internal/*.go" + - "!**/exporters/otlp/otlpmetric/internal/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" + desc: Do not use cross-module internal packages. + otel-internal: + files: + - "**/sdk/*.go" + - "**/sdk/**/*.go" + - "**/exporters/*.go" + - "**/exporters/**/*.go" + - "**/schema/*.go" + - "**/schema/**/*.go" + - "**/metric/*.go" + - "**/metric/**/*.go" + - "**/bridge/*.go" + - "**/bridge/**/*.go" + - "**/example/*.go" + - "**/example/**/*.go" + - "**/trace/*.go" + - "**/trace/**/*.go" + deny: + - pkg: "go.opentelemetry.io/otel/internal$" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/attribute" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/internaltest" + desc: Do not use cross-module internal packages. + - pkg: "go.opentelemetry.io/otel/internal/matchers" + desc: Do not use cross-module internal packages. godot: exclude: # Exclude links. From fe51391dc68dfd368c30e0b4d14078c080ed77c9 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 11 Aug 2023 15:40:39 -0400 Subject: [PATCH 657/886] Change metric.Producer to be an Option on Reader (#4346) * metric.Producer can be passed as an argument to Reader using WithProducer * reproduce data race * revert to atomic.Value --- CHANGELOG.md | 1 + example/opencensus/main.go | 3 +- sdk/metric/manual_reader.go | 20 ++----------- sdk/metric/manual_reader_test.go | 8 +++++- sdk/metric/periodic_reader.go | 23 +++------------ sdk/metric/periodic_reader_test.go | 45 +++++++++++++----------------- sdk/metric/reader.go | 36 +++++++++++++++++++----- sdk/metric/reader_test.go | 38 ++++++++++++------------- 8 files changed, 82 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebfa8d5a9a5..8f801e722f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) - Increase instrument name maximum length from 63 to 255 characters. (#4434) +- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an Option for metric.NewManualReader and metric.NewPeriodicReader, and remove `Reader.RegisterProducer()` (#4346) ### Removed diff --git a/example/opencensus/main.go b/example/opencensus/main.go index 8afbd9e5b9b..c9709bad37a 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -103,9 +103,8 @@ func tracing(otExporter sdktrace.SpanExporter) { // registry or an OpenCensus view. func monitoring(exporter metric.Exporter) error { log.Println("Adding the OpenCensus metric Producer to an OpenTelemetry Reader to export OpenCensus metrics using the OpenTelemetry stdout exporter.") - reader := metric.NewPeriodicReader(exporter) // Register the OpenCensus metric Producer to add metrics from OpenCensus to the output. - reader.RegisterProducer(opencensus.NewMetricProducer()) + reader := metric.NewPeriodicReader(exporter, metric.WithProducer(opencensus.NewMetricProducer())) metric.NewMeterProvider(metric.WithReader(reader)) log.Println("Registering a gauge metric using an OpenCensus registry.") diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index a7715f5b34f..3ab837c00d0 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -50,7 +50,7 @@ func NewManualReader(opts ...ManualReaderOption) *ManualReader { temporalitySelector: cfg.temporalitySelector, aggregationSelector: cfg.aggregationSelector, } - r.externalProducers.Store([]Producer{}) + r.externalProducers.Store(cfg.producers) return r } @@ -64,23 +64,6 @@ func (mr *ManualReader) register(p sdkProducer) { } } -// RegisterProducer stores the external Producer which enables the caller -// to read metrics on demand. -// -// This method is safe to call concurrently. -func (mr *ManualReader) RegisterProducer(p Producer) { - mr.mu.Lock() - defer mr.mu.Unlock() - if mr.isShutdown { - return - } - currentProducers := mr.externalProducers.Load().([]Producer) - newProducers := []Producer{} - newProducers = append(newProducers, currentProducers...) - newProducers = append(newProducers, p) - mr.externalProducers.Store(newProducers) -} - // temporality reports the Temporality for the instrument kind provided. func (mr *ManualReader) temporality(kind InstrumentKind) metricdata.Temporality { return mr.temporalitySelector(kind) @@ -176,6 +159,7 @@ func (r *ManualReader) MarshalLog() interface{} { type manualReaderConfig struct { temporalitySelector TemporalitySelector aggregationSelector AggregationSelector + producers []Producer } // newManualReaderConfig returns a manualReaderConfig configured with options. diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 1c2f63cf504..210a66c1bbe 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -27,7 +27,13 @@ import ( ) func TestManualReader(t *testing.T) { - suite.Run(t, &readerTestSuite{Factory: func() Reader { return NewManualReader() }}) + suite.Run(t, &readerTestSuite{Factory: func(opts ...ReaderOption) Reader { + var mopts []ManualReaderOption + for _, o := range opts { + mopts = append(mopts, o) + } + return NewManualReader(mopts...) + }}) } func BenchmarkManualReader(b *testing.B) { diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index f62a2ae41e3..1d18f961197 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -36,8 +36,9 @@ const ( // periodicReaderConfig contains configuration options for a PeriodicReader. type periodicReaderConfig struct { - interval time.Duration - timeout time.Duration + interval time.Duration + timeout time.Duration + producers []Producer } // newPeriodicReaderConfig returns a periodicReaderConfig configured with @@ -129,7 +130,7 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) *Peri return &metricdata.ResourceMetrics{} }}, } - r.externalProducers.Store([]Producer{}) + r.externalProducers.Store(conf.producers) go func() { defer func() { close(r.done) }() @@ -197,22 +198,6 @@ func (r *PeriodicReader) register(p sdkProducer) { } } -// RegisterProducer registers p as an external Producer of this reader. -// -// This method is safe to call concurrently. -func (r *PeriodicReader) RegisterProducer(p Producer) { - r.mu.Lock() - defer r.mu.Unlock() - if r.isShutdown { - return - } - currentProducers := r.externalProducers.Load().([]Producer) - newProducers := []Producer{} - newProducers = append(newProducers, currentProducers...) - newProducers = append(newProducers, p) - r.externalProducers.Store(newProducers) -} - // temporality reports the Temporality for the instrument kind provided. func (r *PeriodicReader) temporality(kind InstrumentKind) metricdata.Temporality { return r.exporter.Temporality(kind) diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 0e9d66944c2..0a549042313 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -203,7 +203,7 @@ type periodicReaderTestSuite struct { } func (ts *periodicReaderTestSuite) SetupTest() { - ts.readerTestSuite.SetupTest() + ts.Reader = ts.Factory() e := &fnExporter{ exportFunc: func(context.Context, *metricdata.ResourceMetrics) error { return assert.AnError }, @@ -211,9 +211,8 @@ func (ts *periodicReaderTestSuite) SetupTest() { shutdownFunc: func(context.Context) error { return assert.AnError }, } - ts.ErrReader = NewPeriodicReader(e) + ts.ErrReader = NewPeriodicReader(e, WithProducer(testExternalProducer{})) ts.ErrReader.register(testSDKProducer{}) - ts.ErrReader.RegisterProducer(testExternalProducer{}) } func (ts *periodicReaderTestSuite) TearDownTest() { @@ -233,8 +232,12 @@ func (ts *periodicReaderTestSuite) TestShutdownPropagated() { func TestPeriodicReader(t *testing.T) { suite.Run(t, &periodicReaderTestSuite{ readerTestSuite: &readerTestSuite{ - Factory: func() Reader { - return NewPeriodicReader(new(fnExporter)) + Factory: func(opts ...ReaderOption) Reader { + var popts []PeriodicReaderOption + for _, o := range opts { + popts = append(popts, o) + } + return NewPeriodicReader(new(fnExporter), popts...) }, }, }) @@ -291,9 +294,8 @@ func TestPeriodicReaderRun(t *testing.T) { }, } - r := NewPeriodicReader(exp) + r := NewPeriodicReader(exp, WithProducer(testExternalProducer{})) r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{}) trigger <- time.Now() assert.Equal(t, assert.AnError, <-eh.Err) @@ -320,9 +322,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("ForceFlush", func(t *testing.T) { exp, called := expFunc(t) - r := NewPeriodicReader(exp) + r := NewPeriodicReader(exp, WithProducer(testExternalProducer{})) r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{}) assert.Equal(t, assert.AnError, r.ForceFlush(context.Background()), "export error not returned") assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") @@ -333,7 +334,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("ForceFlush timeout on producer", func(t *testing.T) { exp, called := expFunc(t) timeout := time.Millisecond - r := NewPeriodicReader(exp, WithTimeout(timeout)) + r := NewPeriodicReader(exp, WithTimeout(timeout), WithProducer(testExternalProducer{})) r.register(testSDKProducer{ produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { select { @@ -345,7 +346,6 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { } return nil }}) - r.RegisterProducer(testExternalProducer{}) assert.ErrorIs(t, r.ForceFlush(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") @@ -356,9 +356,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("ForceFlush timeout on external producer", func(t *testing.T) { exp, called := expFunc(t) timeout := time.Millisecond - r := NewPeriodicReader(exp, WithTimeout(timeout)) - r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{ + r := NewPeriodicReader(exp, WithTimeout(timeout), WithProducer(testExternalProducer{ produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { select { case <-time.After(timeout + time.Second): @@ -368,7 +366,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { } return []metricdata.ScopeMetrics{testScopeMetricsA}, nil }, - }) + })) + r.register(testSDKProducer{}) assert.ErrorIs(t, r.ForceFlush(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") @@ -378,9 +377,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("Shutdown", func(t *testing.T) { exp, called := expFunc(t) - r := NewPeriodicReader(exp) + r := NewPeriodicReader(exp, WithProducer(testExternalProducer{})) r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{}) assert.Equal(t, assert.AnError, r.Shutdown(context.Background()), "export error not returned") assert.True(t, *called, "exporter Export method not called, pending telemetry not flushed") }) @@ -388,7 +386,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("Shutdown timeout on producer", func(t *testing.T) { exp, called := expFunc(t) timeout := time.Millisecond - r := NewPeriodicReader(exp, WithTimeout(timeout)) + r := NewPeriodicReader(exp, WithTimeout(timeout), WithProducer(testExternalProducer{})) r.register(testSDKProducer{ produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { select { @@ -400,7 +398,6 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { } return nil }}) - r.RegisterProducer(testExternalProducer{}) assert.ErrorIs(t, r.Shutdown(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") }) @@ -408,9 +405,7 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { t.Run("Shutdown timeout on external producer", func(t *testing.T) { exp, called := expFunc(t) timeout := time.Millisecond - r := NewPeriodicReader(exp, WithTimeout(timeout)) - r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{ + r := NewPeriodicReader(exp, WithTimeout(timeout), WithProducer(testExternalProducer{ produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { select { case <-time.After(timeout + time.Second): @@ -420,7 +415,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { } return []metricdata.ScopeMetrics{testScopeMetricsA}, nil }, - }) + })) + r.register(testSDKProducer{}) assert.ErrorIs(t, r.Shutdown(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") }) @@ -428,9 +424,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { func TestPeriodicReaderMultipleForceFlush(t *testing.T) { ctx := context.Background() - r := NewPeriodicReader(new(fnExporter)) + r := NewPeriodicReader(new(fnExporter), WithProducer(testExternalProducer{})) r.register(testSDKProducer{}) - r.RegisterProducer(testExternalProducer{}) require.NoError(t, r.ForceFlush(ctx)) require.NoError(t, r.ForceFlush(ctx)) } diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 44dee654bdf..a4d05944d61 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -57,13 +57,6 @@ type Reader interface { // and send aggregated metric measurements. register(sdkProducer) - // RegisterProducer registers a an external Producer with this Reader. - // The Producer is used as a source of aggregated metric data which is - // incorporated into metrics collected from the SDK. - // - // This method needs to be concurrent safe. - RegisterProducer(Producer) - // temporality reports the Temporality for the instrument kind provided. // // This method needs to be concurrent safe with itself and all the other @@ -166,3 +159,32 @@ func DefaultAggregationSelector(ik InstrumentKind) aggregation.Aggregation { } panic("unknown instrument kind") } + +// ReaderOption is an option which can be applied to manual or Periodic +// readers. +type ReaderOption interface { + PeriodicReaderOption + ManualReaderOption +} + +// WithProducers registers producers as an external Producer of metric data +// for this Reader. +func WithProducer(p Producer) ReaderOption { + return producerOption{p: p} +} + +type producerOption struct { + p Producer +} + +// applyManual returns a manualReaderConfig with option applied. +func (o producerOption) applyManual(c manualReaderConfig) manualReaderConfig { + c.producers = append(c.producers, o.p) + return c +} + +// applyPeriodic returns a periodicReaderConfig with option applied. +func (o producerOption) applyPeriodic(c periodicReaderConfig) periodicReaderConfig { + c.producers = append(c.producers, o.p) + return c +} diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index f2a20c0da27..c2ab66ea08a 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -34,7 +34,7 @@ import ( type readerTestSuite struct { suite.Suite - Factory func() Reader + Factory func(...ReaderOption) Reader Reader Reader } @@ -42,21 +42,19 @@ func (ts *readerTestSuite) SetupSuite() { otel.SetLogger(testr.New(ts.T())) } -func (ts *readerTestSuite) SetupTest() { - ts.Reader = ts.Factory() -} - func (ts *readerTestSuite) TearDownTest() { // Ensure Reader is allowed attempt to clean up. _ = ts.Reader.Shutdown(context.Background()) } func (ts *readerTestSuite) TestErrorForNotRegistered() { + ts.Reader = ts.Factory() err := ts.Reader.Collect(context.Background(), &metricdata.ResourceMetrics{}) ts.ErrorIs(err, ErrReaderNotRegistered) } func (ts *readerTestSuite) TestSDKProducer() { + ts.Reader = ts.Factory() ts.Reader.register(testSDKProducer{}) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(context.Background(), &m) @@ -65,8 +63,8 @@ func (ts *readerTestSuite) TestSDKProducer() { } func (ts *readerTestSuite) TestExternalProducer() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(context.Background(), &m) ts.NoError(err) @@ -74,9 +72,9 @@ func (ts *readerTestSuite) TestExternalProducer() { } func (ts *readerTestSuite) TestCollectAfterShutdown() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) ctx := context.Background() ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.Shutdown(ctx)) m := metricdata.ResourceMetrics{} @@ -86,14 +84,15 @@ func (ts *readerTestSuite) TestCollectAfterShutdown() { } func (ts *readerTestSuite) TestShutdownTwice() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) ctx := context.Background() ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) ts.Require().NoError(ts.Reader.Shutdown(ctx)) ts.ErrorIs(ts.Reader.Shutdown(ctx), ErrReaderShutdown) } func (ts *readerTestSuite) TestMultipleRegister() { + ts.Reader = ts.Factory() p0 := testSDKProducer{ produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { // Differentiate this producer from the second by returning an @@ -113,21 +112,19 @@ func (ts *readerTestSuite) TestMultipleRegister() { } func (ts *readerTestSuite) TestExternalProducerPartialSuccess() { - ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer( - testExternalProducer{ + ts.Reader = ts.Factory( + WithProducer(testExternalProducer{ produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { return []metricdata.ScopeMetrics{}, assert.AnError }, - }, - ) - ts.Reader.RegisterProducer( - testExternalProducer{ + }), + WithProducer(testExternalProducer{ produceFunc: func(ctx context.Context) ([]metricdata.ScopeMetrics, error) { return []metricdata.ScopeMetrics{testScopeMetricsB}, nil }, - }, + }), ) + ts.Reader.register(testSDKProducer{}) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(context.Background(), &m) @@ -136,12 +133,12 @@ func (ts *readerTestSuite) TestExternalProducerPartialSuccess() { } func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) ts.Reader.register(testSDKProducer{ produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { *rm = metricdata.ResourceMetrics{} return assert.AnError }}) - ts.Reader.RegisterProducer(testExternalProducer{}) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(context.Background(), &m) @@ -150,11 +147,11 @@ func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { } func (ts *readerTestSuite) TestMethodConcurrentSafe() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) // Requires the race-detector (a default test option for the project). // All reader methods should be concurrent-safe. ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) ctx := context.Background() var wg sync.WaitGroup @@ -175,7 +172,7 @@ func (ts *readerTestSuite) TestMethodConcurrentSafe() { wg.Add(1) go func() { defer wg.Done() - _ = ts.Reader.Collect(ctx, nil) + _ = ts.Reader.Collect(ctx, &metricdata.ResourceMetrics{}) }() if f, ok := ts.Reader.(interface{ ForceFlush(context.Context) error }); ok { @@ -196,11 +193,11 @@ func (ts *readerTestSuite) TestMethodConcurrentSafe() { } func (ts *readerTestSuite) TestShutdownBeforeRegister() { + ts.Reader = ts.Factory(WithProducer(testExternalProducer{})) ctx := context.Background() ts.Require().NoError(ts.Reader.Shutdown(ctx)) // Registering after shutdown should not revert the shutdown. ts.Reader.register(testSDKProducer{}) - ts.Reader.RegisterProducer(testExternalProducer{}) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(ctx, &m) @@ -209,6 +206,7 @@ func (ts *readerTestSuite) TestShutdownBeforeRegister() { } func (ts *readerTestSuite) TestCollectNilResourceMetricError() { + ts.Reader = ts.Factory() ctx := context.Background() ts.Assert().Error(ts.Reader.Collect(ctx, nil)) } From 29e646431e95060ad966ea41f21aaafc125e6262 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 13 Aug 2023 07:24:39 -0700 Subject: [PATCH 658/886] Bump golang from 1.20-alpine to 1.21-alpine in /example/zipkin (#4438) Bumps golang from 1.20-alpine to 1.21-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- example/zipkin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/zipkin/Dockerfile b/example/zipkin/Dockerfile index e9cfb7557a8..c5335d6ad3b 100644 --- a/example/zipkin/Dockerfile +++ b/example/zipkin/Dockerfile @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.20-alpine +FROM golang:1.21-alpine COPY . /go/src/github.com/open-telemetry/opentelemetry-go/ WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/zipkin/ RUN go install ./main.go From af1d928b2bce98f0b80acafbf02b7495894a56d2 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 13 Aug 2023 07:36:30 -0700 Subject: [PATCH 659/886] dependabot updates Sun Aug 13 14:28:57 UTC 2023 (#4443) Bump github.com/golangci/golangci-lint from 1.53.3 to 1.54.1 in /internal/tools Bump go.opentelemetry.io/build-tools/gotmpl from 0.10.0 to 0.11.0 in /internal/tools Bump golang.org/x/tools from 0.11.1 to 0.12.0 in /internal/tools Bump github.com/openzipkin/zipkin-go from 0.4.1 to 0.4.2 in /exporters/zipkin --- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +- internal/tools/go.mod | 46 ++++++++++---------- internal/tools/go.sum | 94 ++++++++++++++++++++--------------------- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 19fe587bf1e..e86ed2ddd7b 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/openzipkin/zipkin-go v0.4.1 // indirect + github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 7c667d325f2..5a0de303faf 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= -github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= +github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= +github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index d1798c7e81e..ff97e81e252 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -6,7 +6,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 - github.com/openzipkin/zipkin-go v0.4.1 + github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.16.0 go.opentelemetry.io/otel/sdk v1.16.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index f36441265f8..1c34c9c928e 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -7,8 +7,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/openzipkin/zipkin-go v0.4.1 h1:kNd/ST2yLLWhaWrkgchya40TJabe8Hioj9udfPcEO5A= -github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= +github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= +github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 0d20b2312f0..909d2f3912a 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,29 +5,29 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.53.3 + github.com/golangci/golangci-lint v1.54.1 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.11.0 go.opentelemetry.io/build-tools/dbotconf v0.11.0 - go.opentelemetry.io/build-tools/gotmpl v0.10.0 + go.opentelemetry.io/build-tools/gotmpl v0.11.0 go.opentelemetry.io/build-tools/multimod v0.11.0 go.opentelemetry.io/build-tools/semconvgen v0.11.0 - golang.org/x/tools v0.11.1 + golang.org/x/tools v0.12.0 ) require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect dario.cat/mergo v1.0.0 // indirect - github.com/4meepo/tagalign v1.2.2 // indirect - github.com/Abirdcfly/dupword v0.0.11 // indirect + github.com/4meepo/tagalign v1.3.2 // indirect + github.com/Abirdcfly/dupword v0.0.12 // indirect github.com/Antonboom/errname v0.1.10 // indirect github.com/Antonboom/nilnil v0.1.5 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect - github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect + github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect @@ -36,7 +36,7 @@ require ( github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/ashanbrown/forbidigo v1.5.3 // indirect + github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bkielbasa/cyclop v1.2.1 // indirect @@ -51,7 +51,7 @@ require ( github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect - github.com/daixiang0/gci v0.10.1 // indirect + github.com/daixiang0/gci v0.11.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -62,7 +62,7 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/go-critic/go-critic v0.8.1 // indirect + github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.4.1 // indirect github.com/go-git/go-git/v5 v5.8.1 // indirect @@ -84,7 +84,7 @@ require ( github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect - github.com/golangci/misspell v0.4.0 // indirect + github.com/golangci/misspell v0.4.1 // indirect github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.5.9 // indirect @@ -110,7 +110,7 @@ require ( github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.4 // indirect github.com/kulti/thelper v0.6.3 // indirect - github.com/kunwardeep/paralleltest v1.0.7 // indirect + github.com/kunwardeep/paralleltest v1.0.8 // indirect github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/ldez/gomoddirectives v0.2.3 // indirect github.com/ldez/tagliatelle v0.5.0 // indirect @@ -133,17 +133,17 @@ require ( github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.12.1 // indirect + github.com/nunnatsa/ginkgolinter v0.13.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.4.2 // indirect + github.com/polyfloyd/go-errorlint v1.4.3 // indirect github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - github.com/quasilyte/go-ruleguard v0.3.19 // indirect + github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect @@ -181,28 +181,28 @@ require ( github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect - github.com/ultraware/funlen v0.0.3 // indirect + github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.0.5 // indirect - github.com/uudashr/gocognit v1.0.6 // indirect + github.com/uudashr/gocognit v1.0.7 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xen0n/gosmopolitan v1.2.1 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect - github.com/ykadowak/zerologlint v0.1.2 // indirect - gitlab.com/bosi/decorder v0.2.3 // indirect + github.com/ykadowak/zerologlint v0.1.3 // indirect + gitlab.com/bosi/decorder v0.4.0 // indirect go.opentelemetry.io/build-tools v0.11.0 // indirect - go.tmz.dev/musttag v0.7.0 // indirect + go.tmz.dev/musttag v0.7.1 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.12.0 // indirect golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect - golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect + golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.14.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4c022fd8c32..3f509773011 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -42,10 +42,10 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/4meepo/tagalign v1.2.2 h1:kQeUTkFTaBRtd/7jm8OKJl9iHk0gAO+TDFPHGSna0aw= -github.com/4meepo/tagalign v1.2.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= -github.com/Abirdcfly/dupword v0.0.11 h1:z6v8rMETchZXUIuHxYNmlUAuKuB21PeaSymTed16wgU= -github.com/Abirdcfly/dupword v0.0.11/go.mod h1:wH8mVGuf3CP5fsBTkfWwwwKTjDnVVCxtU8d8rgeVYXA= +github.com/4meepo/tagalign v1.3.2 h1:1idD3yxlRGV18VjqtDbqYvQ5pXqQS0wO2dn6M3XstvI= +github.com/4meepo/tagalign v1.3.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= +github.com/Abirdcfly/dupword v0.0.12 h1:56NnOyrXzChj07BDFjeRA+IUzSz01jmzEq+G4kEgFhc= +github.com/Abirdcfly/dupword v0.0.12/go.mod h1:+us/TGct/nI9Ndcbcp3rgNcQzctTj68pq7TcgNpLfdI= github.com/Antonboom/errname v0.1.10 h1:RZ7cYo/GuZqjr1nuJLNe8ZH+a+Jd9DaZzttWzak9Bls= github.com/Antonboom/errname v0.1.10/go.mod h1:xLeiCIrvVNpUtsN0wxAh05bNIZpqE22/qDMnTBTttiA= github.com/Antonboom/nilnil v0.1.5 h1:X2JAdEVcbPaOom2TUa1FxZ3uyuUlex0XMLGYMemu6l0= @@ -56,8 +56,8 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 h1:+r1rSv4gvYn0wmRjC8X7IAzX8QezqtFV9m0MUHFJgts= -github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 h1:3ZBs7LAezy8gh0uECsA6CGU43FF3zsx5f4eah5FxTMA= +github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0/go.mod h1:rZLTje5A9kFBe0pzhpe2TdhRniBF++PRHQuRpR8esVc= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= @@ -82,8 +82,8 @@ github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= -github.com/ashanbrown/forbidigo v1.5.3 h1:jfg+fkm/snMx+V9FBwsl1d340BV/99kZGv5jN9hBoXk= -github.com/ashanbrown/forbidigo v1.5.3/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= +github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= +github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -129,8 +129,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= -github.com/daixiang0/gci v0.10.1 h1:eheNA3ljF6SxnPD/vE4lCBusVHmV3Rs3dkKvFrJ7MR0= -github.com/daixiang0/gci v0.10.1/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= +github.com/daixiang0/gci v0.11.0 h1:XeQbFKkCRxvVyn06EOuNY6LPGBLVuB/W130c8FrnX6A= +github.com/daixiang0/gci v0.11.0/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -161,8 +161,8 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= -github.com/go-critic/go-critic v0.8.1 h1:16omCF1gN3gTzt4j4J6fKI/HnRojhEp+Eks6EuKw3vw= -github.com/go-critic/go-critic v0.8.1/go.mod h1:kpzXl09SIJX1cr9TB/g/sAG+eFEl7ZS9f9cqvZtyNl0= +github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= +github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= @@ -247,14 +247,14 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.53.3 h1:CUcRafczT4t1F+mvdkUm6KuOpxUZTl0yWN/rSU6sSMo= -github.com/golangci/golangci-lint v1.53.3/go.mod h1:W4Gg3ONq6p3Jl+0s/h9Gr0j7yEgHJWWZO2bHl2tBUXM= +github.com/golangci/golangci-lint v1.54.1 h1:0qMrH1gkeIBqCZaaAm5Fwq4xys9rO/lJofHfZURIFFk= +github.com/golangci/golangci-lint v1.54.1/go.mod h1:JK47+qksV/t2mAz9YvndwT0ZLW4A1rvDljOs3g9jblo= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= -github.com/golangci/misspell v0.4.0 h1:KtVB/hTK4bbL/S6bs64rYyk8adjmh1BygbBiaAiX+a0= -github.com/golangci/misspell v0.4.0/go.mod h1:W6O/bwV6lGDxUCChm2ykw9NQdd5bYd1Xkjo88UcWyJc= +github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= +github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= @@ -372,8 +372,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= -github.com/kunwardeep/paralleltest v1.0.7 h1:2uCk94js0+nVNQoHZNLBkAR1DQJrVzw6T0RMzJn55dQ= -github.com/kunwardeep/paralleltest v1.0.7/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= +github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= +github.com/kunwardeep/paralleltest v1.0.8/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= @@ -432,8 +432,8 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.12.1 h1:vwOqb5Nu05OikTXqhvLdHCGcx5uthIYIl0t79UVrERQ= -github.com/nunnatsa/ginkgolinter v0.12.1/go.mod h1:AK8Ab1PypVrcGUusuKD8RDcl2KgsIwvNaaxAlyHSzso= +github.com/nunnatsa/ginkgolinter v0.13.3 h1:wEvjrzSMfDdnoWkctignX9QTf4rT9f4GkQ3uVoXBmiU= +github.com/nunnatsa/ginkgolinter v0.13.3/go.mod h1:aTKXo8WddENYxNEFT+4ZxEgWXqlD9uMD3w9Bfw/ABEc= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= @@ -455,8 +455,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.4.2 h1:CU+O4181IxFDdPH6t/HT7IiDj1I7zxNi1RIUxYwn8d0= -github.com/polyfloyd/go-errorlint v1.4.2/go.mod h1:k6fU/+fQe38ednoZS51T7gSIGQW1y94d6TkSr35OzH8= +github.com/polyfloyd/go-errorlint v1.4.3 h1:P6NALOLV8BrWhm6PsqOraUK05E5h8IZnpXYJ+CIg+0U= +github.com/polyfloyd/go-errorlint v1.4.3/go.mod h1:VPlWPh6hB/wruVG803SuNpLuTGNjLHYlvcdSy4RhdPA= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -483,8 +483,8 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/quasilyte/go-ruleguard v0.3.19 h1:tfMnabXle/HzOb5Xe9CUZYWXKfkS1KwRmZyPmD9nVcc= -github.com/quasilyte/go-ruleguard v0.3.19/go.mod h1:lHSn69Scl48I7Gt9cX3VrbsZYvYiBYszZOZW4A+oTEw= +github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= +github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng= github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 h1:TCg2WBOl980XxGFEZSS6KlBGIV0diGdySzxATTWoqaU= @@ -587,12 +587,12 @@ github.com/tomarrell/wrapcheck/v2 v2.8.1 h1:HxSqDSN0sAt0yJYsrcYVoEeyM4aI9yAm3KQp github.com/tomarrell/wrapcheck/v2 v2.8.1/go.mod h1:/n2Q3NZ4XFT50ho6Hbxg+RV1uyo2Uow/Vdm9NQcl5SE= github.com/tommy-muehle/go-mnd/v2 v2.5.1 h1:NowYhSdyE/1zwK9QCLeRb6USWdoif80Ie+v+yU8u1Zw= github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= -github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= -github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81vI= +github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y= -github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= +github.com/uudashr/gocognit v1.0.7 h1:e9aFXgKgUJrQ5+bs61zBigmj7bFJ/5cC6HmMahVzuDo= +github.com/uudashr/gocognit v1.0.7/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= @@ -603,8 +603,8 @@ github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= -github.com/ykadowak/zerologlint v0.1.2 h1:Um4P5RMmelfjQqQJKtE8ZW+dLZrXrENeIzWWKw800U4= -github.com/ykadowak/zerologlint v0.1.2/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= +github.com/ykadowak/zerologlint v0.1.3 h1:TLy1dTW3Nuc+YE3bYRPToG1Q9Ej78b5UUN6bjbGdxPE= +github.com/ykadowak/zerologlint v0.1.3/go.mod h1:KaUskqF3e/v59oPmdq1U1DnKcuHokl2/K1U4pmIELKg= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -612,8 +612,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= -gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= +gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY= +gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg= go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -627,14 +627,14 @@ go.opentelemetry.io/build-tools/crosslink v0.11.0 h1:K0eJY/AT6SiIaoJSrQyiVquGErc go.opentelemetry.io/build-tools/crosslink v0.11.0/go.mod h1:h5oxbHx+O50aO0/M7mFejZmd7cMONdsmmC+IOmgWoWw= go.opentelemetry.io/build-tools/dbotconf v0.11.0 h1:hG0Zyln9Vv+kwNC+ip/EUcLnd9osTZ8dOYOxe/lHZy4= go.opentelemetry.io/build-tools/dbotconf v0.11.0/go.mod h1:BxYX1iAki4EWzIVXeEPFM75ZWr9e9koqT7pTU5xzad4= -go.opentelemetry.io/build-tools/gotmpl v0.10.0 h1:pytcJ20iHs87Y/gMEb3pDgQuZ9g+wBgYYlexzUSJLV4= -go.opentelemetry.io/build-tools/gotmpl v0.10.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= +go.opentelemetry.io/build-tools/gotmpl v0.11.0 h1:T2KJ7Eli7wLrp+8TXpUQ+Q+wAdZZDiyHYSvrpeER7Pc= +go.opentelemetry.io/build-tools/gotmpl v0.11.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= go.opentelemetry.io/build-tools/multimod v0.11.0 h1:QMo2Y4BlsTsWUR0LXV4gmiv5yEiX2iPLn2qAdAcCE6k= go.opentelemetry.io/build-tools/multimod v0.11.0/go.mod h1:EID7sjEGyk1FWzRdsV6rlWp43IIn8iHXGE5pM4TytyQ= go.opentelemetry.io/build-tools/semconvgen v0.11.0 h1:gQsNzy49l9JjNozybaRUl+vy0EMxYasV8w6aK+IWquc= go.opentelemetry.io/build-tools/semconvgen v0.11.0/go.mod h1:Zy04Bw3w3lT7mORe23V2BwjfJYpoza6Xz1XSMIrLTCg= -go.tmz.dev/musttag v0.7.0 h1:QfytzjTWGXZmChoX0L++7uQN+yRCPfyFm+whsM+lfGc= -go.tmz.dev/musttag v0.7.0/go.mod h1:oTFPvgOkJmp5kYL02S8+jrH0eLrBIl57rzWeA26zDEM= +go.tmz.dev/musttag v0.7.1 h1:9lFmeSFnFfPuMq4IksHGomItE6NgKMNW2Nt2FPOhCfU= +go.tmz.dev/musttag v0.7.1/go.mod h1:oJLkpR56EsIryktZJk/B0IroSMi37YWver47fibGh5U= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -655,8 +655,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -671,8 +671,8 @@ golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQ golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= -golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= +golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -748,8 +748,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -845,7 +845,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -858,8 +858,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -933,8 +933,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc= -golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= +golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 199dc34a09c057fd30da227d689ca04dacc8cecc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 14 Aug 2023 07:21:04 -0700 Subject: [PATCH 660/886] Support default histogram selection in OTLP exporter (#4437) * Support default histogram selection in OTLP exporter * Add changes to changelog --- CHANGELOG.md | 1 + .../internal/oconf/envconfig.go | 26 +++++++ .../internal/oconf/envconfig_test.go | 71 +++++++++++++++++++ .../internal/oconf/envconfig.go | 26 +++++++ .../internal/oconf/envconfig_test.go | 71 +++++++++++++++++++ .../otlp/otlpmetric/oconf/envconfig.go.tmpl | 26 +++++++ .../otlpmetric/oconf/envconfig_test.go.tmpl | 71 +++++++++++++++++++ 7 files changed, 292 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f801e722f2..c93742eb56a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) - Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) - Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) ### Changed diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go index a133a60e402..c08b0b6d483 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go @@ -29,6 +29,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -103,6 +104,7 @@ func getOptionsFromEnv() []GenericOption { envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + withEnvAggPreference("METRICS_DEFAULT_HISTOGRAM_AGGREGATION", func(a metric.AggregationSelector) { opts = append(opts, WithAggregationSelector(a)) }), ) return opts @@ -194,3 +196,27 @@ func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } } + +func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "explicit_bucket_histogram": + fn(metric.DefaultAggregationSelector) + case "base2_exponential_bucket_histogram": + fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + if kind == metric.InstrumentKindHistogram { + return aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + } + } + return metric.DefaultAggregationSelector(kind) + }) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION is set to an invalid value, ignoring.", "value", s) + } + } + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go index d497c8e4b6c..559d9f3bc23 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -104,3 +105,73 @@ func TestWithEnvTemporalityPreference(t *testing.T) { } DefaultEnvOptionsReader.GetEnv = origReader } + +func TestWithEnvAggPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]aggregation.Aggregation + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "explicit_bucket_histogram", + envValue: "explicit_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + { + name: "base2_exponential_bucket_histogram", + envValue: "base2_exponential_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + }, + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.AggregationSelector) + return + } + + require.NotNil(t, cfg.Metrics.AggregationSelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.AggregationSelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go index 0b8e033ace3..67f3b32f618 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go @@ -29,6 +29,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -103,6 +104,7 @@ func getOptionsFromEnv() []GenericOption { envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + withEnvAggPreference("METRICS_DEFAULT_HISTOGRAM_AGGREGATION", func(a metric.AggregationSelector) { opts = append(opts, WithAggregationSelector(a)) }), ) return opts @@ -194,3 +196,27 @@ func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } } + +func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "explicit_bucket_histogram": + fn(metric.DefaultAggregationSelector) + case "base2_exponential_bucket_histogram": + fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + if kind == metric.InstrumentKindHistogram { + return aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + } + } + return metric.DefaultAggregationSelector(kind) + }) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION is set to an invalid value, ignoring.", "value", s) + } + } + } +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go index d497c8e4b6c..559d9f3bc23 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -104,3 +105,73 @@ func TestWithEnvTemporalityPreference(t *testing.T) { } DefaultEnvOptionsReader.GetEnv = origReader } + +func TestWithEnvAggPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]aggregation.Aggregation + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "explicit_bucket_histogram", + envValue: "explicit_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + { + name: "base2_exponential_bucket_histogram", + envValue: "base2_exponential_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + }, + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.AggregationSelector) + return + } + + require.NotNil(t, cfg.Metrics.AggregationSelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.AggregationSelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl index 33e97069ce5..e1dc855b631 100644 --- a/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl @@ -29,6 +29,7 @@ import ( "{{ .envconfigImportPath }}" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -103,6 +104,7 @@ func getOptionsFromEnv() []GenericOption { envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), + withEnvAggPreference("METRICS_DEFAULT_HISTOGRAM_AGGREGATION", func(a metric.AggregationSelector) { opts = append(opts, WithAggregationSelector(a)) }), ) return opts @@ -194,3 +196,27 @@ func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } } + +func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e *envconfig.EnvOptionsReader) { + return func(e *envconfig.EnvOptionsReader) { + if s, ok := e.GetEnvValue(n); ok { + switch strings.ToLower(s) { + case "explicit_bucket_histogram": + fn(metric.DefaultAggregationSelector) + case "base2_exponential_bucket_histogram": + fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + if kind == metric.InstrumentKindHistogram { + return aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + } + } + return metric.DefaultAggregationSelector(kind) + }) + default: + global.Warn("OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION is set to an invalid value, ignoring.", "value", s) + } + } + } +} diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl index d497c8e4b6c..559d9f3bc23 100644 --- a/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl @@ -24,6 +24,7 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -104,3 +105,73 @@ func TestWithEnvTemporalityPreference(t *testing.T) { } DefaultEnvOptionsReader.GetEnv = origReader } + +func TestWithEnvAggPreference(t *testing.T) { + origReader := DefaultEnvOptionsReader.GetEnv + tests := []struct { + name string + envValue string + want map[metric.InstrumentKind]aggregation.Aggregation + }{ + { + name: "default do not set the selector", + envValue: "", + }, + { + name: "non-normative do not set the selector", + envValue: "non-normative", + }, + { + name: "explicit_bucket_histogram", + envValue: "explicit_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + { + name: "base2_exponential_bucket_histogram", + envValue: "base2_exponential_bucket_histogram", + want: map[metric.InstrumentKind]aggregation.Aggregation{ + metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), + metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + NoMinMax: false, + }, + metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), + metric.InstrumentKindObservableCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableCounter), + metric.InstrumentKindObservableUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindObservableUpDownCounter), + metric.InstrumentKindObservableGauge: metric.DefaultAggregationSelector(metric.InstrumentKindObservableGauge), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + DefaultEnvOptionsReader.GetEnv = func(key string) string { + if key == "OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION" { + return tt.envValue + } + return origReader(key) + } + cfg := Config{} + cfg = ApplyGRPCEnvConfigs(cfg) + + if tt.want == nil { + // There is no function set, the SDK's default is used. + assert.Nil(t, cfg.Metrics.AggregationSelector) + return + } + + require.NotNil(t, cfg.Metrics.AggregationSelector) + for ik, want := range tt.want { + assert.Equal(t, want, cfg.Metrics.AggregationSelector(ik)) + } + }) + } + DefaultEnvOptionsReader.GetEnv = origReader +} From 6f64e5b4be16b8ffbde3156dcf5cc2591dc1d39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 14 Aug 2023 16:42:08 +0200 Subject: [PATCH 661/886] Add gorelease Make target (#4431) * Add gorelease Make target * Igonre exit code and add blank line * Add GORELEASE to tools * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update RELEASING.md * Run go mod tidy --------- Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- Makefile | 14 +++++++++++++- RELEASING.md | 6 ++++++ internal/tools/go.mod | 2 +- internal/tools/tools.go | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 55b3a1df7db..c996d227bea 100644 --- a/Makefile +++ b/Makefile @@ -74,8 +74,11 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq GOTMPL = $(TOOLS)/gotmpl $(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl +GORELEASE = $(TOOLS)/gorelease +$(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease + .PHONY: tools -tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) +tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) # Virtualized python tools via docker @@ -267,6 +270,15 @@ semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT) $(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)" $(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)" +.PHONY: gorelease +gorelease: $(OTEL_GO_MOD_DIRS:%=gorelease/%) +gorelease/%: DIR=$* +gorelease/%:| $(GORELEASE) + @echo "gorelease in $(DIR):" \ + && cd $(DIR) \ + && $(GORELEASE) \ + || echo "" + .PHONY: prerelease prerelease: | $(MULTIMOD) @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) diff --git a/RELEASING.md b/RELEASING.md index 9bf31f17e73..82ce3ee46a1 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -21,6 +21,12 @@ make semconv-generate # Uses the exported TAG and OTEL_SEMCONV_REPO. This should create a new sub-package of [`semconv`](./semconv). Ensure things look correct before submitting a pull request to include the addition. +## Breaking changes validation + +You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes done in the public API. + +You can check/report problems with `gorelease` [here](https://golang.org/issues/26420). + ## Pre-Release First, decide which module sets will be released and update their versions diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 909d2f3912a..395990cc8d2 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -14,6 +14,7 @@ require ( go.opentelemetry.io/build-tools/gotmpl v0.11.0 go.opentelemetry.io/build-tools/multimod v0.11.0 go.opentelemetry.io/build-tools/semconvgen v0.11.0 + golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/tools v0.12.0 ) @@ -196,7 +197,6 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect diff --git a/internal/tools/tools.go b/internal/tools/tools.go index 6980285a315..e4b8e4c0fd2 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -29,5 +29,6 @@ import ( _ "go.opentelemetry.io/build-tools/gotmpl" _ "go.opentelemetry.io/build-tools/multimod" _ "go.opentelemetry.io/build-tools/semconvgen" + _ "golang.org/x/exp/cmd/gorelease" _ "golang.org/x/tools/cmd/stringer" ) From 3904523917fb412eae593ea07833bbede14d3ba7 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 14 Aug 2023 08:15:15 -0700 Subject: [PATCH 662/886] Flatten `sdk/metric/aggregation` into `sdk/metric` (#4435) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Deprecate the aggregation pkg * Decouple the internal/aggregate from aggregation pkg * Add Aggregation to the metric pkg * Do not use sdk/metric/aggregation in stdoutmetric exporter * Update all generated templates * Update prom exporter * Fix view example * Add changes to changelog * Update CHANGELOG.md Co-authored-by: Robert Pająk * Rename Sum to AggregationSum * Fix comments * Centralize validation of aggregation in pipeline * Remove validation of agg in manual_reader selector opt * Fix merge --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 3 + example/view/main.go | 3 +- exporters/otlp/otlpmetric/internal/client.go | 3 +- .../otlp/otlpmetric/internal/exporter.go | 5 +- .../otlp/otlpmetric/internal/exporter_test.go | 3 +- .../otlp/otlpmetric/internal/oconf/options.go | 19 +- .../otlpmetric/internal/oconf/options_test.go | 7 +- .../otlpmetric/internal/otest/client_test.go | 3 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 3 +- .../otlpmetric/otlpmetricgrpc/exporter.go | 3 +- .../internal/oconf/envconfig.go | 5 +- .../internal/oconf/envconfig_test.go | 9 +- .../otlpmetricgrpc/internal/oconf/options.go | 19 +- .../internal/oconf/options_test.go | 7 +- .../internal/otest/client_test.go | 3 +- .../otlpmetric/otlpmetrichttp/client_test.go | 3 +- .../otlpmetric/otlpmetrichttp/exporter.go | 3 +- .../internal/oconf/envconfig.go | 5 +- .../internal/oconf/envconfig_test.go | 9 +- .../otlpmetrichttp/internal/oconf/options.go | 19 +- .../internal/oconf/options_test.go | 7 +- .../internal/otest/client_test.go | 3 +- exporters/prometheus/config_test.go | 5 +- exporters/prometheus/exporter_test.go | 3 +- exporters/stdout/stdoutmetric/config.go | 19 +- exporters/stdout/stdoutmetric/exporter.go | 3 +- .../stdout/stdoutmetric/exporter_test.go | 7 +- .../otlp/otlpmetric/oconf/envconfig.go.tmpl | 5 +- .../otlpmetric/oconf/envconfig_test.go.tmpl | 9 +- .../otlp/otlpmetric/oconf/options.go.tmpl | 19 +- .../otlpmetric/oconf/options_test.go.tmpl | 7 +- .../otlp/otlpmetric/otest/client_test.go.tmpl | 3 +- sdk/metric/aggregation.go | 201 ++++++++++++++++++ sdk/metric/aggregation/aggregation.go | 3 + sdk/metric/aggregation_test.go | 95 +++++++++ sdk/metric/benchmark_test.go | 3 +- sdk/metric/config_test.go | 3 +- sdk/metric/exporter.go | 3 +- sdk/metric/instrument.go | 3 +- sdk/metric/internal/aggregate/aggregate.go | 9 +- .../aggregate/exponential_histogram.go | 9 +- .../aggregate/exponential_histogram_test.go | 39 ++-- sdk/metric/internal/aggregate/histogram.go | 7 +- .../internal/aggregate/histogram_test.go | 24 +-- sdk/metric/manual_reader.go | 23 +- sdk/metric/meter_test.go | 11 +- sdk/metric/periodic_reader.go | 3 +- sdk/metric/periodic_reader_test.go | 3 +- sdk/metric/pipeline.go | 49 +++-- sdk/metric/pipeline_registry_test.go | 101 +++++---- sdk/metric/pipeline_test.go | 3 +- sdk/metric/reader.go | 13 +- sdk/metric/reader_test.go | 2 +- sdk/metric/view.go | 7 +- sdk/metric/view_test.go | 22 +- 55 files changed, 513 insertions(+), 347 deletions(-) create mode 100644 sdk/metric/aggregation.go create mode 100644 sdk/metric/aggregation_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c93742eb56a..11549cd77a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) - Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) - Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) - The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) ### Changed @@ -89,6 +90,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig` package is deprecated. (#4425) - The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest` package is deprecated. (#4425) - The `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry` package is deprecated. (#4425) +- The `go.opentelemetry.io/otel/sdk/metric/aggregation` package is deprecated. + Use the aggregation types added to `go.opentelemetry.io/otel/sdk/metric` instead. (#4435) ## [1.16.0/0.39.0] 2023-05-18 diff --git a/example/view/main.go b/example/view/main.go index 0e0175aa5ee..712e325301e 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -29,7 +29,6 @@ import ( api "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) const meterName = "github.com/open-telemetry/opentelemetry-go/example/view" @@ -53,7 +52,7 @@ func main() { }, metric.Stream{ Name: "bar", - Aggregation: aggregation.ExplicitBucketHistogram{ + Aggregation: metric.AggregationExplicitBucketHistogram{ Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, }, }, diff --git a/exporters/otlp/otlpmetric/internal/client.go b/exporters/otlp/otlpmetric/internal/client.go index 7950a4170cd..6c6bf67c1c7 100644 --- a/exporters/otlp/otlpmetric/internal/client.go +++ b/exporters/otlp/otlpmetric/internal/client.go @@ -18,7 +18,6 @@ import ( "context" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -29,7 +28,7 @@ type Client interface { Temporality(metric.InstrumentKind) metricdata.Temporality // Aggregation returns the Aggregation to use for an instrument kind. - Aggregation(metric.InstrumentKind) aggregation.Aggregation + Aggregation(metric.InstrumentKind) metric.Aggregation // UploadMetrics transmits metric data to an OTLP receiver. // diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go index 73c51320ec2..508fecd6bb1 100644 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ b/exporters/otlp/otlpmetric/internal/exporter.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" // nolint: staticcheck // Atomic deprecation. "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -47,7 +46,7 @@ func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { } // Aggregation returns the Aggregation to use for an instrument kind. -func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (e *Exporter) Aggregation(k metric.InstrumentKind) metric.Aggregation { e.clientMu.Lock() defer e.clientMu.Unlock() return e.client.Aggregation(k) @@ -120,7 +119,7 @@ func (c shutdownClient) Temporality(k metric.InstrumentKind) metricdata.Temporal return c.temporalitySelector(k) } -func (c shutdownClient) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c shutdownClient) Aggregation(k metric.InstrumentKind) metric.Aggregation { return c.aggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/internal/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go index bdbe3513840..6814c9dce3d 100644 --- a/exporters/otlp/otlpmetric/internal/exporter_test.go +++ b/exporters/otlp/otlpmetric/internal/exporter_test.go @@ -22,7 +22,6 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -37,7 +36,7 @@ func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go index a5e71a86cfb..5d8f1d25b77 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options.go @@ -33,9 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. "go.opentelemetry.io/otel/exporters/otlp/internal/retry" // nolint: staticcheck // Synchronous deprecation. ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) const ( @@ -340,23 +338,8 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption } func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { - // Deep copy and validate before using. - wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = metric.DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.AggregationSelector = wrapped + cfg.Metrics.AggregationSelector = selector return cfg }) } diff --git a/exporters/otlp/otlpmetric/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go index 77cd9b09e07..80102da7d01 100644 --- a/exporters/otlp/otlpmetric/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/internal/oconf/options_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" // nolint: staticcheck // Synchronous deprecation. "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -415,7 +414,7 @@ func TestConfigs(t *testing.T) { // all" was set. var undefinedKind metric.InstrumentKind got := c.Metrics.AggregationSelector - assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, } @@ -441,8 +440,8 @@ func TestConfigs(t *testing.T) { } } -func dropSelector(metric.InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} +func dropSelector(metric.InstrumentKind) metric.Aggregation { + return metric.AggregationDrop{} } func deltaSelector(metric.InstrumentKind) metricdata.Temporality { diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go index 2c2ddcc9c01..3f7bb848e2c 100644 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/internal/otest/client_test.go @@ -22,7 +22,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" @@ -37,7 +36,7 @@ func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 9908b61a379..1de64a77268 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -137,7 +136,7 @@ type clientShim struct { func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } -func (clientShim) Aggregation(metric.InstrumentKind) aggregation.Aggregation { +func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation { return nil } func (clientShim) ForceFlush(ctx context.Context) error { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go index f5d8b7f9148..826276ba392 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/exporter.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -70,7 +69,7 @@ func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { } // Aggregation returns the Aggregation to use for an instrument kind. -func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (e *Exporter) Aggregation(k metric.InstrumentKind) metric.Aggregation { return e.aggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go index c08b0b6d483..ae100513bad 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -204,9 +203,9 @@ func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e case "explicit_bucket_histogram": fn(metric.DefaultAggregationSelector) case "base2_exponential_bucket_histogram": - fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + fn(func(kind metric.InstrumentKind) metric.Aggregation { if kind == metric.InstrumentKindHistogram { - return aggregation.Base2ExponentialHistogram{ + return metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go index 559d9f3bc23..b3f9f9c3714 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/envconfig_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -111,7 +110,7 @@ func TestWithEnvAggPreference(t *testing.T) { tests := []struct { name string envValue string - want map[metric.InstrumentKind]aggregation.Aggregation + want map[metric.InstrumentKind]metric.Aggregation }{ { name: "default do not set the selector", @@ -124,7 +123,7 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "explicit_bucket_histogram", envValue: "explicit_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), @@ -136,9 +135,9 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "base2_exponential_bucket_histogram", envValue: "base2_exponential_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), - metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + metric.InstrumentKindHistogram: metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go index 36d03a5b398..40a4469f77a 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -32,9 +32,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) const ( @@ -354,23 +352,8 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption } func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { - // Deep copy and validate before using. - wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = metric.DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.AggregationSelector = wrapped + cfg.Metrics.AggregationSelector = selector return cfg }) } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go index 1b5c32e5f94..8687acabcfa 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -417,7 +416,7 @@ func TestConfigs(t *testing.T) { // all" was set. var undefinedKind metric.InstrumentKind got := c.Metrics.AggregationSelector - assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, } @@ -443,8 +442,8 @@ func TestConfigs(t *testing.T) { } } -func dropSelector(metric.InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} +func dropSelector(metric.InstrumentKind) metric.Aggregation { + return metric.AggregationDrop{} } func deltaSelector(metric.InstrumentKind) metricdata.Temporality { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go index 9a6f8fe61f0..e325f16b97e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" @@ -39,7 +38,7 @@ func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index b5af1d61ba1..36075c19ee5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -30,7 +30,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -41,7 +40,7 @@ type clientShim struct { func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } -func (clientShim) Aggregation(metric.InstrumentKind) aggregation.Aggregation { +func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation { return nil } func (clientShim) ForceFlush(ctx context.Context) error { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go index dd6f80b82ed..96991ede5c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/exporter.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" metricpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) @@ -70,7 +69,7 @@ func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { } // Aggregation returns the Aggregation to use for an instrument kind. -func (e *Exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (e *Exporter) Aggregation(k metric.InstrumentKind) metric.Aggregation { return e.aggregationSelector(k) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go index 67f3b32f618..2bab35be6c4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -204,9 +203,9 @@ func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e case "explicit_bucket_histogram": fn(metric.DefaultAggregationSelector) case "base2_exponential_bucket_histogram": - fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + fn(func(kind metric.InstrumentKind) metric.Aggregation { if kind == metric.InstrumentKindHistogram { - return aggregation.Base2ExponentialHistogram{ + return metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go index 559d9f3bc23..b3f9f9c3714 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/envconfig_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -111,7 +110,7 @@ func TestWithEnvAggPreference(t *testing.T) { tests := []struct { name string envValue string - want map[metric.InstrumentKind]aggregation.Aggregation + want map[metric.InstrumentKind]metric.Aggregation }{ { name: "default do not set the selector", @@ -124,7 +123,7 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "explicit_bucket_histogram", envValue: "explicit_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), @@ -136,9 +135,9 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "base2_exponential_bucket_histogram", envValue: "base2_exponential_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), - metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + metric.InstrumentKindHistogram: metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go index de0916313d7..c1ec5ed210a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -32,9 +32,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) const ( @@ -354,23 +352,8 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption } func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { - // Deep copy and validate before using. - wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = metric.DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.AggregationSelector = wrapped + cfg.Metrics.AggregationSelector = selector return cfg }) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go index 5b4ee0358b7..bb34337a1f2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -417,7 +416,7 @@ func TestConfigs(t *testing.T) { // all" was set. var undefinedKind metric.InstrumentKind got := c.Metrics.AggregationSelector - assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, } @@ -443,8 +442,8 @@ func TestConfigs(t *testing.T) { } } -func dropSelector(metric.InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} +func dropSelector(metric.InstrumentKind) metric.Aggregation { + return metric.AggregationDrop{} } func deltaSelector(metric.InstrumentKind) metricdata.Temporality { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go index e51c6dfd0fb..72f4f40b116 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client_test.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" @@ -39,7 +38,7 @@ func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/exporters/prometheus/config_test.go b/exporters/prometheus/config_test.go index 8fc88819b94..3e3ba9c1cb0 100644 --- a/exporters/prometheus/config_test.go +++ b/exporters/prometheus/config_test.go @@ -21,13 +21,12 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) func TestNewConfig(t *testing.T) { registry := prometheus.NewRegistry() - aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil } + aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil } testCases := []struct { name string @@ -142,7 +141,7 @@ func TestNewConfig(t *testing.T) { } func TestConfigManualReaderOptions(t *testing.T) { - aggregationSelector := func(metric.InstrumentKind) aggregation.Aggregation { return nil } + aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil } testCases := []struct { name string diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 3c96983a918..86cc8dc0b20 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) @@ -397,7 +396,7 @@ func TestPrometheusExporter(t *testing.T) { metric.WithReader(exporter), metric.WithView(metric.NewView( metric.Instrument{Name: "histogram_*"}, - metric.Stream{Aggregation: aggregation.ExplicitBucketHistogram{ + metric.Stream{Aggregation: metric.AggregationExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, }}, )), diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 9b62bde5083..6189c019f37 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -17,9 +17,7 @@ import ( "encoding/json" "os" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) // config contains options for the exporter. @@ -100,22 +98,7 @@ func (t temporalitySelectorOption) apply(c config) config { // package or the aggregation explicitly passed for a view matching an // instrument. func WithAggregationSelector(selector metric.AggregationSelector) Option { - // Deep copy and validate before using. - wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = metric.DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - - return aggregationSelectorOption{selector: wrapped} + return aggregationSelectorOption{selector: selector} } type aggregationSelectorOption struct { diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index e3d867e00dc..c223a84da59 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -58,7 +57,7 @@ func (e *exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { return e.temporalitySelector(k) } -func (e *exporter) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (e *exporter) Aggregation(k metric.InstrumentKind) metric.Aggregation { return e.aggregationSelector(k) } diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index 72feb08c2fb..71679d623a1 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -115,8 +114,8 @@ func TestTemporalitySelector(t *testing.T) { assert.Equal(t, metricdata.DeltaTemporality, exp.Temporality(unknownKind)) } -func dropSelector(metric.InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} +func dropSelector(metric.InstrumentKind) metric.Aggregation { + return metric.AggregationDrop{} } func TestAggregationSelector(t *testing.T) { @@ -127,5 +126,5 @@ func TestAggregationSelector(t *testing.T) { require.NoError(t, err) var unknownKind metric.InstrumentKind - assert.Equal(t, aggregation.Drop{}, exp.Aggregation(unknownKind)) + assert.Equal(t, metric.AggregationDrop{}, exp.Aggregation(unknownKind)) } diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl index e1dc855b631..a76a4835ddb 100644 --- a/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig.go.tmpl @@ -29,7 +29,6 @@ import ( "{{ .envconfigImportPath }}" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -204,9 +203,9 @@ func withEnvAggPreference(n string, fn func(metric.AggregationSelector)) func(e case "explicit_bucket_histogram": fn(metric.DefaultAggregationSelector) case "base2_exponential_bucket_histogram": - fn(func(kind metric.InstrumentKind) aggregation.Aggregation { + fn(func(kind metric.InstrumentKind) metric.Aggregation { if kind == metric.InstrumentKindHistogram { - return aggregation.Base2ExponentialHistogram{ + return metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl index 559d9f3bc23..b3f9f9c3714 100644 --- a/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/envconfig_test.go.tmpl @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -111,7 +110,7 @@ func TestWithEnvAggPreference(t *testing.T) { tests := []struct { name string envValue string - want map[metric.InstrumentKind]aggregation.Aggregation + want map[metric.InstrumentKind]metric.Aggregation }{ { name: "default do not set the selector", @@ -124,7 +123,7 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "explicit_bucket_histogram", envValue: "explicit_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), metric.InstrumentKindHistogram: metric.DefaultAggregationSelector(metric.InstrumentKindHistogram), metric.InstrumentKindUpDownCounter: metric.DefaultAggregationSelector(metric.InstrumentKindUpDownCounter), @@ -136,9 +135,9 @@ func TestWithEnvAggPreference(t *testing.T) { { name: "base2_exponential_bucket_histogram", envValue: "base2_exponential_bucket_histogram", - want: map[metric.InstrumentKind]aggregation.Aggregation{ + want: map[metric.InstrumentKind]metric.Aggregation{ metric.InstrumentKindCounter: metric.DefaultAggregationSelector(metric.InstrumentKindCounter), - metric.InstrumentKindHistogram: aggregation.Base2ExponentialHistogram{ + metric.InstrumentKindHistogram: metric.AggregationBase2ExponentialHistogram{ MaxSize: 160, MaxScale: 20, NoMinMax: false, diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl index fb373a634bf..9518b23e8bc 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -32,9 +32,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "{{ .retryImportPath }}" - "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) const ( @@ -354,23 +352,8 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption } func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { - // Deep copy and validate before using. - wrapped := func(ik metric.InstrumentKind) aggregation.Aggregation { - a := selector(ik) - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = metric.DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.AggregationSelector = wrapped + cfg.Metrics.AggregationSelector = selector return cfg }) } diff --git a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl index 3b0a4f1f0c8..16ddfdb7b53 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl @@ -26,7 +26,6 @@ import ( "{{ .envconfigImportPath }}" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -417,7 +416,7 @@ func TestConfigs(t *testing.T) { // all" was set. var undefinedKind metric.InstrumentKind got := c.Metrics.AggregationSelector - assert.Equal(t, aggregation.Drop{}, got(undefinedKind)) + assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, } @@ -443,8 +442,8 @@ func TestConfigs(t *testing.T) { } } -func dropSelector(metric.InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} +func dropSelector(metric.InstrumentKind) metric.Aggregation { + return metric.AggregationDrop{} } func deltaSelector(metric.InstrumentKind) metricdata.Temporality { diff --git a/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl index f02512e966c..b7cfa019fb5 100644 --- a/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/client_test.go.tmpl @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel" "{{ .internalImportPath }}" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" mpb "go.opentelemetry.io/proto/otlp/metrics/v1" @@ -39,7 +38,7 @@ func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { return metric.DefaultTemporalitySelector(k) } -func (c *client) Aggregation(k metric.InstrumentKind) aggregation.Aggregation { +func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { return metric.DefaultAggregationSelector(k) } diff --git a/sdk/metric/aggregation.go b/sdk/metric/aggregation.go new file mode 100644 index 00000000000..08ff6cc3dd8 --- /dev/null +++ b/sdk/metric/aggregation.go @@ -0,0 +1,201 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "errors" + "fmt" +) + +// errAgg is wrapped by misconfigured aggregations. +var errAgg = errors.New("aggregation") + +// Aggregation is the aggregation used to summarize recorded measurements. +type Aggregation interface { + // copy returns a deep copy of the Aggregation. + copy() Aggregation + + // err returns an error for any misconfigured Aggregation. + err() error +} + +// AggregationDrop is an Aggregation that drops all recorded data. +type AggregationDrop struct{} // AggregationDrop has no parameters. + +var _ Aggregation = AggregationDrop{} + +// copy returns a deep copy of d. +func (d AggregationDrop) copy() Aggregation { return d } + +// err returns an error for any misconfiguration. A drop aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (AggregationDrop) err() error { return nil } + +// AggregationDefault is an Aggregation that uses the default instrument kind selection +// mapping to select another Aggregation. A metric reader can be configured to +// make an aggregation selection based on instrument kind that differs from +// the default. This Aggregation ensures the default is used. +// +// See the "go.opentelemetry.io/otel/sdk/metric".DefaultAggregationSelector +// for information about the default instrument kind selection mapping. +type AggregationDefault struct{} // AggregationDefault has no parameters. + +var _ Aggregation = AggregationDefault{} + +// copy returns a deep copy of d. +func (d AggregationDefault) copy() Aggregation { return d } + +// err returns an error for any misconfiguration. A default aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (AggregationDefault) err() error { return nil } + +// AggregationSum is an Aggregation that summarizes a set of measurements as their +// arithmetic sum. +type AggregationSum struct{} // AggregationSum has no parameters. + +var _ Aggregation = AggregationSum{} + +// copy returns a deep copy of s. +func (s AggregationSum) copy() Aggregation { return s } + +// err returns an error for any misconfiguration. A sum aggregation has no +// parameters and cannot be misconfigured, therefore this always returns nil. +func (AggregationSum) err() error { return nil } + +// AggregationLastValue is an Aggregation that summarizes a set of measurements as the +// last one made. +type AggregationLastValue struct{} // AggregationLastValue has no parameters. + +var _ Aggregation = AggregationLastValue{} + +// copy returns a deep copy of l. +func (l AggregationLastValue) copy() Aggregation { return l } + +// err returns an error for any misconfiguration. A last-value aggregation has +// no parameters and cannot be misconfigured, therefore this always returns +// nil. +func (AggregationLastValue) err() error { return nil } + +// AggregationExplicitBucketHistogram is an Aggregation that summarizes a set of +// measurements as an histogram with explicitly defined buckets. +type AggregationExplicitBucketHistogram struct { + // Boundaries are the increasing bucket boundary values. Boundary values + // define bucket upper bounds. Buckets are exclusive of their lower + // boundary and inclusive of their upper bound (except at positive + // infinity). A measurement is defined to fall into the greatest-numbered + // bucket with a boundary that is greater than or equal to the + // measurement. As an example, boundaries defined as: + // + // []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000} + // + // Will define these buckets: + // + // (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, 25.0], (25.0, 50.0], + // (50.0, 75.0], (75.0, 100.0], (100.0, 250.0], (250.0, 500.0], + // (500.0, 1000.0], (1000.0, +∞) + Boundaries []float64 + // NoMinMax indicates whether to not record the min and max of the + // distribution. By default, these extrema are recorded. + // + // Recording these extrema for cumulative data is expected to have little + // value, they will represent the entire life of the instrument instead of + // just the current collection cycle. It is recommended to set this to true + // for that type of data to avoid computing the low-value extrema. + NoMinMax bool +} + +var _ Aggregation = AggregationExplicitBucketHistogram{} + +// errHist is returned by misconfigured ExplicitBucketHistograms. +var errHist = fmt.Errorf("%w: explicit bucket histogram", errAgg) + +// err returns an error for any misconfiguration. +func (h AggregationExplicitBucketHistogram) err() error { + if len(h.Boundaries) <= 1 { + return nil + } + + // Check boundaries are monotonic. + i := h.Boundaries[0] + for _, j := range h.Boundaries[1:] { + if i >= j { + return fmt.Errorf("%w: non-monotonic boundaries: %v", errHist, h.Boundaries) + } + i = j + } + + return nil +} + +// copy returns a deep copy of h. +func (h AggregationExplicitBucketHistogram) copy() Aggregation { + b := make([]float64, len(h.Boundaries)) + copy(b, h.Boundaries) + return AggregationExplicitBucketHistogram{ + Boundaries: b, + NoMinMax: h.NoMinMax, + } +} + +// AggregationBase2ExponentialHistogram is an Aggregation that summarizes a set of +// measurements as an histogram with bucket widths that grow exponentially. +type AggregationBase2ExponentialHistogram struct { + // MaxSize is the maximum number of buckets to use for the histogram. + MaxSize int32 + // MaxScale is the maximum resolution scale to use for the histogram. + // + // MaxScale has a maximum value of 20. Using a value of 20 means the + // maximum number of buckets that can fit within the range of a + // signed 32-bit integer index could be used. + // + // MaxScale has a minimum value of -10. Using a value of -10 means only + // two buckets will be use. + MaxScale int32 + + // NoMinMax indicates whether to not record the min and max of the + // distribution. By default, these extrema are recorded. + // + // Recording these extrema for cumulative data is expected to have little + // value, they will represent the entire life of the instrument instead of + // just the current collection cycle. It is recommended to set this to true + // for that type of data to avoid computing the low-value extrema. + NoMinMax bool +} + +var _ Aggregation = AggregationBase2ExponentialHistogram{} + +// copy returns a deep copy of the Aggregation. +func (e AggregationBase2ExponentialHistogram) copy() Aggregation { + return e +} + +const ( + expoMaxScale = 20 + expoMinScale = -10 +) + +// errExpoHist is returned by misconfigured Base2ExponentialBucketHistograms. +var errExpoHist = fmt.Errorf("%w: exponential histogram", errAgg) + +// err returns an error for any misconfigured Aggregation. +func (e AggregationBase2ExponentialHistogram) err() error { + if e.MaxScale > expoMaxScale { + return fmt.Errorf("%w: max size %d is greater than maximum scale %d", errExpoHist, e.MaxSize, expoMaxScale) + } + if e.MaxSize <= 0 { + return fmt.Errorf("%w: max size %d is less than or equal to zero", errExpoHist, e.MaxSize) + } + return nil +} diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go index 850e309ea37..5d5643eb294 100644 --- a/sdk/metric/aggregation/aggregation.go +++ b/sdk/metric/aggregation/aggregation.go @@ -14,6 +14,9 @@ // Package aggregation contains configuration types that define the // aggregation operation used to summarizes recorded measurements. +// +// Deprecated: Use the aggregation types in go.opentelemetry.io/otel/sdk/metric +// instead. package aggregation // import "go.opentelemetry.io/otel/sdk/metric/aggregation" import ( diff --git a/sdk/metric/aggregation_test.go b/sdk/metric/aggregation_test.go new file mode 100644 index 00000000000..640fd7747e0 --- /dev/null +++ b/sdk/metric/aggregation_test.go @@ -0,0 +1,95 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestAggregationErr(t *testing.T) { + t.Run("DropOperation", func(t *testing.T) { + assert.NoError(t, AggregationDrop{}.err()) + }) + + t.Run("SumOperation", func(t *testing.T) { + assert.NoError(t, AggregationSum{}.err()) + }) + + t.Run("LastValueOperation", func(t *testing.T) { + assert.NoError(t, AggregationLastValue{}.err()) + }) + + t.Run("ExplicitBucketHistogramOperation", func(t *testing.T) { + assert.NoError(t, AggregationExplicitBucketHistogram{}.err()) + + assert.NoError(t, AggregationExplicitBucketHistogram{ + Boundaries: []float64{0}, + NoMinMax: true, + }.err()) + + assert.NoError(t, AggregationExplicitBucketHistogram{ + Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, + }.err()) + }) + + t.Run("NonmonotonicHistogramBoundaries", func(t *testing.T) { + assert.ErrorIs(t, AggregationExplicitBucketHistogram{ + Boundaries: []float64{2, 1}, + }.err(), errAgg) + + assert.ErrorIs(t, AggregationExplicitBucketHistogram{ + Boundaries: []float64{0, 1, 2, 1, 3, 4}, + }.err(), errAgg) + }) + + t.Run("ExponentialHistogramOperation", func(t *testing.T) { + assert.NoError(t, AggregationBase2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + }.err()) + + assert.NoError(t, AggregationBase2ExponentialHistogram{ + MaxSize: 1, + NoMinMax: true, + }.err()) + + assert.NoError(t, AggregationBase2ExponentialHistogram{ + MaxSize: 1024, + MaxScale: -3, + }.err()) + }) + + t.Run("InvalidExponentialHistogramOperation", func(t *testing.T) { + // MazSize must be greater than 0 + assert.ErrorIs(t, AggregationBase2ExponentialHistogram{}.err(), errAgg) + + // MaxScale Must be <=20 + assert.ErrorIs(t, AggregationBase2ExponentialHistogram{ + MaxSize: 1, + MaxScale: 30, + }.err(), errAgg) + }) +} + +func TestExplicitBucketHistogramDeepCopy(t *testing.T) { + const orig = 0.0 + b := []float64{orig} + h := AggregationExplicitBucketHistogram{Boundaries: b} + cpH := h.copy().(AggregationExplicitBucketHistogram) + b[0] = orig + 1 + assert.Equal(t, orig, cpH.Boundaries[0], "changing the underlying slice data should not affect the copy") +} diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index a243738cfb7..dd75de3cd63 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -36,7 +35,7 @@ var viewBenchmarks = []struct { "DropView", []View{NewView( Instrument{Name: "*"}, - Stream{Aggregation: aggregation.Drop{}}, + Stream{Aggregation: AggregationDrop{}}, )}, }, { diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index 6e48a4599ca..ae7159f2d2e 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -22,7 +22,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" ) @@ -39,7 +38,7 @@ type reader struct { var _ Reader = (*reader)(nil) -func (r *reader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (r *reader) aggregation(kind InstrumentKind) Aggregation { // nolint:revive // import-shadow for method scoped by type. return r.aggregationFunc(kind) } diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 7efb8bf2fbe..695cf466c0e 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -18,7 +18,6 @@ import ( "context" "fmt" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -39,7 +38,7 @@ type Exporter interface { // // This method needs to be concurrent safe with itself and all the other // Exporter methods. - Aggregation(InstrumentKind) aggregation.Aggregation + Aggregation(InstrumentKind) Aggregation // Export serializes and transmits metric data to a receiver. // diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 67300d489f6..c09c89361c6 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) @@ -146,7 +145,7 @@ type Stream struct { // Unit is the unit of measurement recorded. Unit string // Aggregation the stream uses for an instrument. - Aggregation aggregation.Aggregation + Aggregation Aggregation // AllowAttributeKeys are an allow-list of attribute keys that will be // preserved for the stream. Any attribute recorded for the stream with a // key not in this slice will be dropped. diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index 6dd531d1cbb..8dec14237b9 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -19,7 +19,6 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -102,8 +101,8 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. -func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistogram, noSum bool) (Measure[N], ComputeAggregation) { - h := newHistogram[N](cfg, noSum) +func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { + h := newHistogram[N](boundaries, noMinMax, noSum) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta @@ -114,8 +113,8 @@ func (b Builder[N]) ExplicitBucketHistogram(cfg aggregation.ExplicitBucketHistog // ExponentialBucketHistogram returns a histogram aggregate function input and // output. -func (b Builder[N]) ExponentialBucketHistogram(cfg aggregation.Base2ExponentialHistogram, noSum bool) (Measure[N], ComputeAggregation) { - h := newExponentialHistogram[N](cfg, noSum) +func (b Builder[N]) ExponentialBucketHistogram(maxSize, maxScale int32, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { + h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index c684c87e600..b46c100de4b 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -23,7 +23,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -326,12 +325,12 @@ func (b *expoBuckets) downscale(delta int) { // newExponentialHistogram returns an Aggregator that summarizes a set of // measurements as an exponential histogram. Each histogram is scoped by attributes // and the aggregation cycle the measurements were made in. -func newExponentialHistogram[N int64 | float64](cfg aggregation.Base2ExponentialHistogram, noSum bool) *expoHistogram[N] { +func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool) *expoHistogram[N] { return &expoHistogram[N]{ expoHistogramValues: newExpoHistValues[N]( - int(cfg.MaxSize), - int(cfg.MaxScale), - cfg.NoMinMax, + int(maxSize), + int(maxScale), + noMinMax, noSum, ), start: now(), diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index de949359ffd..f1db4139cdb 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) @@ -645,31 +644,33 @@ func BenchmarkAppend(b *testing.B) { } } -var expoHistConf = aggregation.Base2ExponentialHistogram{ - MaxSize: 160, - MaxScale: 20, -} - func BenchmarkExponentialHistogram(b *testing.B) { + const ( + maxSize = 160 + maxScale = 20 + noMinMax = false + noSum = false + ) + b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { return Builder[int64]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(expoHistConf, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) })) b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { return Builder[int64]{ Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(expoHistConf, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) })) b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { return Builder[float64]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(expoHistConf, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) })) b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { return Builder[float64]{ Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(expoHistConf, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) })) } @@ -711,10 +712,12 @@ type exponentialHistogramAggregationTestCase[N int64 | float64] struct { } func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { - cfg := aggregation.Base2ExponentialHistogram{ - MaxSize: 4, - MaxScale: 20, - } + const ( + maxSize = 4 + maxScale = 20 + noMinMax = false + noSum = false + ) tests := []exponentialHistogramAggregationTestCase[N]{ { @@ -722,7 +725,7 @@ func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { build: func() (Measure[N], ComputeAggregation) { return Builder[N]{ Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(cfg, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) }, input: [][]N{ {4, 4, 4, 2, 16, 1}, @@ -750,7 +753,7 @@ func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { build: func() (Measure[N], ComputeAggregation) { return Builder[N]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(cfg, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) }, input: [][]N{ {4, 4, 4, 2, 16, 1}, @@ -778,7 +781,7 @@ func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { build: func() (Measure[N], ComputeAggregation) { return Builder[N]{ Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(cfg, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) }, input: [][]N{ {2, 3, 8}, @@ -807,7 +810,7 @@ func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { build: func() (Measure[N], ComputeAggregation) { return Builder[N]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(cfg, false) + }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) }, input: [][]N{ {2, 3, 8}, diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index cd030076fdc..62ec51e1f5e 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -21,7 +21,6 @@ import ( "time" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -109,10 +108,10 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // newHistogram returns an Aggregator that summarizes a set of measurements as // an histogram. -func newHistogram[N int64 | float64](cfg aggregation.ExplicitBucketHistogram, noSum bool) *histogram[N] { +func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool) *histogram[N] { return &histogram[N]{ - histValues: newHistValues[N](cfg.Boundaries, noSum), - noMinMax: cfg.NoMinMax, + histValues: newHistValues[N](boundaries, noSum), + noMinMax: noMinMax, start: now(), } } diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index 68a00f2a90f..ab44607e5f6 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -23,17 +23,13 @@ import ( "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) var ( bounds = []float64{1, 5} - histConf = aggregation.ExplicitBucketHistogram{ - Boundaries: bounds, - NoMinMax: false, - } + noMinMax = false ) func TestHistogram(t *testing.T) { @@ -59,7 +55,7 @@ func testDeltaHist[N int64 | float64](c conf[N]) func(t *testing.T) { in, out := Builder[N]{ Temporality: metricdata.DeltaTemporality, Filter: attrFltr, - }.ExplicitBucketHistogram(histConf, c.noSum) + }.ExplicitBucketHistogram(bounds, noMinMax, c.noSum) ctx := context.Background() return test[N](in, out, []teststep[N]{ { @@ -125,7 +121,7 @@ func testCumulativeHist[N int64 | float64](c conf[N]) func(t *testing.T) { in, out := Builder[N]{ Temporality: metricdata.CumulativeTemporality, Filter: attrFltr, - }.ExplicitBucketHistogram(histConf, c.noSum) + }.ExplicitBucketHistogram(bounds, noMinMax, c.noSum) ctx := context.Background() return test[N](in, out, []teststep[N]{ { @@ -277,7 +273,7 @@ func TestHistogramImmutableBounds(t *testing.T) { cpB := make([]float64, len(b)) copy(cpB, b) - h := newHistogram[int64](aggregation.ExplicitBucketHistogram{Boundaries: b}, false) + h := newHistogram[int64](b, false, false) require.Equal(t, cpB, h.bounds) b[0] = 10 @@ -293,7 +289,7 @@ func TestHistogramImmutableBounds(t *testing.T) { } func TestCumulativeHistogramImutableCounts(t *testing.T) { - h := newHistogram[int64](histConf, false) + h := newHistogram[int64](bounds, noMinMax, false) h.measure(context.Background(), 5, alice) var data metricdata.Aggregation = metricdata.Histogram[int64]{} @@ -311,7 +307,7 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - h := newHistogram[int64](histConf, false) + h := newHistogram[int64](bounds, noMinMax, false) var data metricdata.Aggregation = metricdata.Histogram[int64]{} require.Equal(t, 0, h.delta(&data)) @@ -340,21 +336,21 @@ func BenchmarkHistogram(b *testing.B) { b.Run("Int64/Cumulative", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { return Builder[int64]{ Temporality: metricdata.CumulativeTemporality, - }.ExplicitBucketHistogram(histConf, false) + }.ExplicitBucketHistogram(bounds, noMinMax, false) })) b.Run("Int64/Delta", benchmarkAggregate(func() (Measure[int64], ComputeAggregation) { return Builder[int64]{ Temporality: metricdata.DeltaTemporality, - }.ExplicitBucketHistogram(histConf, false) + }.ExplicitBucketHistogram(bounds, noMinMax, false) })) b.Run("Float64/Cumulative", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { return Builder[float64]{ Temporality: metricdata.CumulativeTemporality, - }.ExplicitBucketHistogram(histConf, false) + }.ExplicitBucketHistogram(bounds, noMinMax, false) })) b.Run("Float64/Delta", benchmarkAggregate(func() (Measure[float64], ComputeAggregation) { return Builder[float64]{ Temporality: metricdata.DeltaTemporality, - }.ExplicitBucketHistogram(histConf, false) + }.ExplicitBucketHistogram(bounds, noMinMax, false) })) } diff --git a/sdk/metric/manual_reader.go b/sdk/metric/manual_reader.go index 3ab837c00d0..7d524de9ea1 100644 --- a/sdk/metric/manual_reader.go +++ b/sdk/metric/manual_reader.go @@ -22,7 +22,6 @@ import ( "sync/atomic" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -70,7 +69,7 @@ func (mr *ManualReader) temporality(kind InstrumentKind) metricdata.Temporality } // aggregation returns what Aggregation to use for kind. -func (mr *ManualReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (mr *ManualReader) aggregation(kind InstrumentKind) Aggregation { // nolint:revive // import-shadow for method scoped by type. return mr.aggregationSelector(kind) } @@ -201,25 +200,7 @@ func (t temporalitySelectorOption) applyManual(mrc manualReaderConfig) manualRea // this option is not used, the reader will use the DefaultAggregationSelector // or the aggregation explicitly passed for a view matching an instrument. func WithAggregationSelector(selector AggregationSelector) ManualReaderOption { - // Deep copy and validate before using. - wrapped := func(ik InstrumentKind) aggregation.Aggregation { - a := selector(ik) - if a == nil { - return nil - } - cpA := a.Copy() - if err := cpA.Err(); err != nil { - cpA = DefaultAggregationSelector(ik) - global.Error( - err, "using default aggregation instead", - "aggregation", a, - "replacement", cpA, - ) - } - return cpA - } - - return aggregationSelectorOption{selector: wrapped} + return aggregationSelectorOption{selector: selector} } type aggregationSelectorOption struct { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 338d0d7a0e2..edb1a400b2d 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -31,7 +31,6 @@ import ( "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/resource" @@ -1137,8 +1136,8 @@ func TestUnregisterUnregisters(t *testing.T) { } func TestRegisterCallbackDropAggregations(t *testing.T) { - aggFn := func(InstrumentKind) aggregation.Aggregation { - return aggregation.Drop{} + aggFn := func(InstrumentKind) Aggregation { + return AggregationDrop{} } r := NewManualReader(WithAggregationSelector(aggFn)) mp := NewMeterProvider(WithReader(r)) @@ -1818,11 +1817,11 @@ func BenchmarkInstrumentCreation(b *testing.B) { } } -func testNilAggregationSelector(InstrumentKind) aggregation.Aggregation { +func testNilAggregationSelector(InstrumentKind) Aggregation { return nil } -func testDefaultAggregationSelector(InstrumentKind) aggregation.Aggregation { - return aggregation.Default{} +func testDefaultAggregationSelector(InstrumentKind) Aggregation { + return AggregationDefault{} } func testUndefinedTemporalitySelector(InstrumentKind) metricdata.Temporality { return metricdata.Temporality(0) diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 1d18f961197..2a85456102a 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -24,7 +24,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -204,7 +203,7 @@ func (r *PeriodicReader) temporality(kind InstrumentKind) metricdata.Temporality } // aggregation returns what Aggregation to use for kind. -func (r *PeriodicReader) aggregation(kind InstrumentKind) aggregation.Aggregation { // nolint:revive // import-shadow for method scoped by type. +func (r *PeriodicReader) aggregation(kind InstrumentKind) Aggregation { // nolint:revive // import-shadow for method scoped by type. return r.exporter.Aggregation(kind) } diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 0a549042313..2f055796dd1 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -25,7 +25,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -168,7 +167,7 @@ func (e *fnExporter) Temporality(k InstrumentKind) metricdata.Temporality { return DefaultTemporalitySelector(k) } -func (e *fnExporter) Aggregation(k InstrumentKind) aggregation.Aggregation { +func (e *fnExporter) Aggregation(k InstrumentKind) Aggregation { if e.aggregationFunc != nil { return e.aggregationFunc(k) } diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 6d1934a76fc..d76231cff7f 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -27,7 +27,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -308,14 +307,28 @@ type aggVal[N int64 | float64] struct { // is returned. func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (meas aggregate.Measure[N], aggID uint64, err error) { switch stream.Aggregation.(type) { - case nil, aggregation.Default: + case nil: // Undefined, nil, means to use the default from the reader. stream.Aggregation = i.pipeline.reader.aggregation(kind) switch stream.Aggregation.(type) { - case nil, aggregation.Default: + case nil, AggregationDefault: // If the reader returns default or nil use the default selector. stream.Aggregation = DefaultAggregationSelector(kind) + default: + // Deep copy and validate before using. + stream.Aggregation = stream.Aggregation.copy() + if err := stream.Aggregation.err(); err != nil { + orig := stream.Aggregation + stream.Aggregation = DefaultAggregationSelector(kind) + global.Error( + err, "using default aggregation instead", + "aggregation", orig, + "replacement", stream.Aggregation, + ) + } } + case AggregationDefault: + stream.Aggregation = DefaultAggregationSelector(kind) } if err := isAggregatorCompatible(kind, stream.Aggregation); err != nil { @@ -423,15 +436,15 @@ func (i *inserter[N]) instID(kind InstrumentKind, stream Stream) instID { // aggregateFunc returns new aggregate functions matching agg, kind, and // monotonic. If the agg is unknown or temporality is invalid, an error is // returned. -func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggregation, kind InstrumentKind) (meas aggregate.Measure[N], comp aggregate.ComputeAggregation, err error) { +func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg Aggregation, kind InstrumentKind) (meas aggregate.Measure[N], comp aggregate.ComputeAggregation, err error) { switch a := agg.(type) { - case aggregation.Default: + case AggregationDefault: return i.aggregateFunc(b, DefaultAggregationSelector(kind), kind) - case aggregation.Drop: + case AggregationDrop: // Return nil in and out to signify the drop aggregator. - case aggregation.LastValue: + case AggregationLastValue: meas, comp = b.LastValue() - case aggregation.Sum: + case AggregationSum: switch kind { case InstrumentKindObservableCounter: meas, comp = b.PrecomputedSum(true) @@ -444,7 +457,7 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // instrumentKindUndefined or other invalid instrument kinds. meas, comp = b.Sum(false) } - case aggregation.ExplicitBucketHistogram: + case AggregationExplicitBucketHistogram: var noSum bool switch kind { case InstrumentKindUpDownCounter, InstrumentKindObservableUpDownCounter, InstrumentKindObservableGauge: @@ -453,8 +466,8 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/sdk.md#histogram-aggregations noSum = true } - meas, comp = b.ExplicitBucketHistogram(a, noSum) - case aggregation.Base2ExponentialHistogram: + meas, comp = b.ExplicitBucketHistogram(a.Boundaries, a.NoMinMax, noSum) + case AggregationBase2ExponentialHistogram: var noSum bool switch kind { case InstrumentKindUpDownCounter, InstrumentKindObservableUpDownCounter, InstrumentKindObservableGauge: @@ -463,7 +476,7 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/metrics/sdk.md#histogram-aggregations noSum = true } - meas, comp = b.ExponentialBucketHistogram(a, noSum) + meas, comp = b.ExponentialBucketHistogram(a.MaxSize, a.MaxScale, a.NoMinMax, noSum) default: err = errUnknownAggregation @@ -483,11 +496,11 @@ func (i *inserter[N]) aggregateFunc(b aggregate.Builder[N], agg aggregation.Aggr // | Observable Counter | ✓ | | ✓ | ✓ | ✓ | // | Observable UpDownCounter | ✓ | | ✓ | ✓ | ✓ | // | Observable Gauge | ✓ | ✓ | | ✓ | ✓ |. -func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) error { +func isAggregatorCompatible(kind InstrumentKind, agg Aggregation) error { switch agg.(type) { - case aggregation.Default: + case AggregationDefault: return nil - case aggregation.ExplicitBucketHistogram, aggregation.Base2ExponentialHistogram: + case AggregationExplicitBucketHistogram, AggregationBase2ExponentialHistogram: switch kind { case InstrumentKindCounter, InstrumentKindUpDownCounter, @@ -499,7 +512,7 @@ func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) er default: return errIncompatibleAggregation } - case aggregation.Sum: + case AggregationSum: switch kind { case InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter, InstrumentKindCounter, InstrumentKindHistogram, InstrumentKindUpDownCounter: return nil @@ -508,14 +521,14 @@ func isAggregatorCompatible(kind InstrumentKind, agg aggregation.Aggregation) er // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 return errIncompatibleAggregation } - case aggregation.LastValue: + case AggregationLastValue: if kind == InstrumentKindObservableGauge { return nil } // TODO: review need for aggregation check after // https://github.com/open-telemetry/opentelemetry-specification/issues/2710 return errIncompatibleAggregation - case aggregation.Drop: + case AggregationDrop: return nil default: // This is used passed checking for default, it should be an error at this point. diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 52fedd12471..89293e679e4 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -26,7 +26,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" @@ -35,14 +34,12 @@ import ( var defaultView = NewView(Instrument{Name: "*"}, Stream{}) -type invalidAggregation struct { - aggregation.Aggregation -} +type invalidAggregation struct{} -func (invalidAggregation) Copy() aggregation.Aggregation { +func (invalidAggregation) copy() Aggregation { return invalidAggregation{} } -func (invalidAggregation) Err() error { +func (invalidAggregation) err() error { return nil } @@ -146,7 +143,7 @@ func assertLastValue[N int64 | float64](t *testing.T, meas []aggregate.Measure[N func testCreateAggregators[N int64 | float64](t *testing.T) { changeAggView := NewView( Instrument{Name: "foo"}, - Stream{Aggregation: aggregation.ExplicitBucketHistogram{ + Stream{Aggregation: AggregationExplicitBucketHistogram{ Boundaries: []float64{0, 100}, NoMinMax: true, }}, @@ -176,7 +173,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { }{ { name: "Default/Drop", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Drop{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDrop{} })), inst: instruments[InstrumentKindCounter], validate: func(t *testing.T, meas []aggregate.Measure[N], comps []aggregate.ComputeAggregation, err error) { t.Helper() @@ -304,37 +301,37 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { }, { name: "Reader/Default/Cumulative/Sum/Monotonic", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindCounter], validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 4}), }, { name: "Reader/Default/Cumulative/Sum/NonMonotonic", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindUpDownCounter], validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 4}), }, { name: "Reader/Default/Cumulative/ExplicitBucketHistogram", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindHistogram], validate: assertHist[N](metricdata.CumulativeTemporality), }, { name: "Reader/Default/Cumulative/PrecomputedSum/Monotonic", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindObservableCounter], validate: assertSum[N](1, metricdata.CumulativeTemporality, true, [2]N{1, 3}), }, { name: "Reader/Default/Cumulative/PrecomputedSum/NonMonotonic", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindObservableUpDownCounter], validate: assertSum[N](1, metricdata.CumulativeTemporality, false, [2]N{1, 3}), }, { name: "Reader/Default/Gauge", - reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Default{} })), + reader: NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationDefault{} })), inst: instruments[InstrumentKindObservableGauge], validate: assertLastValue[N], }, @@ -409,7 +406,7 @@ func TestPipelinesAggregatorForEachReader(t *testing.T) { func TestPipelineRegistryCreateAggregators(t *testing.T) { renameView := NewView(Instrument{Name: "foo"}, Stream{Name: "bar"}) testRdr := NewManualReader() - testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.ExplicitBucketHistogram{} })) + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationExplicitBucketHistogram{} })) testCases := []struct { name string @@ -498,7 +495,7 @@ func TestPipelineRegistryResource(t *testing.T) { } func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { - testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) aggregation.Aggregation { return aggregation.Sum{} })) + testRdrHistogram := NewManualReader(WithAggregationSelector(func(ik InstrumentKind) Aggregation { return AggregationSum{} })) readers := []Reader{testRdrHistogram} views := []View{defaultView} @@ -599,187 +596,187 @@ func TestIsAggregatorCompatible(t *testing.T) { testCases := []struct { name string kind InstrumentKind - agg aggregation.Aggregation + agg Aggregation want error }{ { name: "SyncCounter and Drop", kind: InstrumentKindCounter, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { name: "SyncCounter and LastValue", kind: InstrumentKindCounter, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "SyncCounter and Sum", kind: InstrumentKindCounter, - agg: aggregation.Sum{}, + agg: AggregationSum{}, }, { name: "SyncCounter and ExplicitBucketHistogram", kind: InstrumentKindCounter, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "SyncCounter and ExponentialHistogram", kind: InstrumentKindCounter, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "SyncUpDownCounter and Drop", kind: InstrumentKindUpDownCounter, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { name: "SyncUpDownCounter and LastValue", kind: InstrumentKindUpDownCounter, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "SyncUpDownCounter and Sum", kind: InstrumentKindUpDownCounter, - agg: aggregation.Sum{}, + agg: AggregationSum{}, }, { name: "SyncUpDownCounter and ExplicitBucketHistogram", kind: InstrumentKindUpDownCounter, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "SyncUpDownCounter and ExponentialHistogram", kind: InstrumentKindUpDownCounter, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "SyncHistogram and Drop", kind: InstrumentKindHistogram, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { name: "SyncHistogram and LastValue", kind: InstrumentKindHistogram, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "SyncHistogram and Sum", kind: InstrumentKindHistogram, - agg: aggregation.Sum{}, + agg: AggregationSum{}, }, { name: "SyncHistogram and ExplicitBucketHistogram", kind: InstrumentKindHistogram, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "SyncHistogram and ExponentialHistogram", kind: InstrumentKindHistogram, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "ObservableCounter and Drop", kind: InstrumentKindObservableCounter, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { name: "ObservableCounter and LastValue", kind: InstrumentKindObservableCounter, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "ObservableCounter and Sum", kind: InstrumentKindObservableCounter, - agg: aggregation.Sum{}, + agg: AggregationSum{}, }, { name: "ObservableCounter and ExplicitBucketHistogram", kind: InstrumentKindObservableCounter, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "ObservableCounter and ExponentialHistogram", kind: InstrumentKindObservableCounter, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "ObservableUpDownCounter and Drop", kind: InstrumentKindObservableUpDownCounter, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { name: "ObservableUpDownCounter and LastValue", kind: InstrumentKindObservableUpDownCounter, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "ObservableUpDownCounter and Sum", kind: InstrumentKindObservableUpDownCounter, - agg: aggregation.Sum{}, + agg: AggregationSum{}, }, { name: "ObservableUpDownCounter and ExplicitBucketHistogram", kind: InstrumentKindObservableUpDownCounter, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "ObservableUpDownCounter and ExponentialHistogram", kind: InstrumentKindObservableUpDownCounter, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "ObservableGauge and Drop", kind: InstrumentKindObservableGauge, - agg: aggregation.Drop{}, + agg: AggregationDrop{}, }, { - name: "ObservableGauge and aggregation.LastValue{}", + name: "ObservableGauge and LastValue{}", kind: InstrumentKindObservableGauge, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, }, { name: "ObservableGauge and Sum", kind: InstrumentKindObservableGauge, - agg: aggregation.Sum{}, + agg: AggregationSum{}, want: errIncompatibleAggregation, }, { name: "ObservableGauge and ExplicitBucketHistogram", kind: InstrumentKindObservableGauge, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, }, { name: "ObservableGauge and ExponentialHistogram", kind: InstrumentKindObservableGauge, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, }, { name: "unknown kind with Sum should error", kind: undefinedInstrument, - agg: aggregation.Sum{}, + agg: AggregationSum{}, want: errIncompatibleAggregation, }, { name: "unknown kind with LastValue should error", kind: undefinedInstrument, - agg: aggregation.LastValue{}, + agg: AggregationLastValue{}, want: errIncompatibleAggregation, }, { name: "unknown kind with Histogram should error", kind: undefinedInstrument, - agg: aggregation.ExplicitBucketHistogram{}, + agg: AggregationExplicitBucketHistogram{}, want: errIncompatibleAggregation, }, { name: "unknown kind with Histogram should error", kind: undefinedInstrument, - agg: aggregation.Base2ExponentialHistogram{}, + agg: AggregationBase2ExponentialHistogram{}, want: errIncompatibleAggregation, }, } diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index d30d0015c06..1026fd268ff 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -32,7 +32,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/resource" @@ -366,7 +365,7 @@ func TestInserterCachedAggregatorNameConflict(t *testing.T) { kind := InstrumentKindCounter stream := Stream{ Name: name, - Aggregation: aggregation.Sum{}, + Aggregation: AggregationSum{}, } var vc cache[string, instID] diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index a4d05944d61..639dfc9653a 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -18,7 +18,6 @@ import ( "context" "fmt" - "go.opentelemetry.io/otel/sdk/metric/aggregation" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -67,7 +66,7 @@ type Reader interface { // // This method needs to be concurrent safe with itself and all the other // Reader methods. - aggregation(InstrumentKind) aggregation.Aggregation // nolint:revive // import-shadow for method scoped by type. + aggregation(InstrumentKind) Aggregation // nolint:revive // import-shadow for method scoped by type. // Collect gathers and returns all metric data related to the Reader from // the SDK and stores it in out. An error is returned if this is called @@ -137,7 +136,7 @@ func DefaultTemporalitySelector(InstrumentKind) metricdata.Temporality { // // If the Aggregation returned is nil or DefaultAggregation, the selection from // DefaultAggregationSelector will be used. -type AggregationSelector func(InstrumentKind) aggregation.Aggregation +type AggregationSelector func(InstrumentKind) Aggregation // DefaultAggregationSelector returns the default aggregation and parameters // that will be used to summarize measurement made from an instrument of @@ -145,14 +144,14 @@ type AggregationSelector func(InstrumentKind) aggregation.Aggregation // mapping: Counter ⇨ Sum, Observable Counter ⇨ Sum, UpDownCounter ⇨ Sum, // Observable UpDownCounter ⇨ Sum, Observable Gauge ⇨ LastValue, // Histogram ⇨ ExplicitBucketHistogram. -func DefaultAggregationSelector(ik InstrumentKind) aggregation.Aggregation { +func DefaultAggregationSelector(ik InstrumentKind) Aggregation { switch ik { case InstrumentKindCounter, InstrumentKindUpDownCounter, InstrumentKindObservableCounter, InstrumentKindObservableUpDownCounter: - return aggregation.Sum{} + return AggregationSum{} case InstrumentKindObservableGauge: - return aggregation.LastValue{} + return AggregationLastValue{} case InstrumentKindHistogram: - return aggregation.ExplicitBucketHistogram{ + return AggregationExplicitBucketHistogram{ Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000}, NoMinMax: false, } diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index c2ab66ea08a..a1e9e507b9d 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -316,7 +316,7 @@ func TestDefaultAggregationSelector(t *testing.T) { } for _, ik := range iKinds { - assert.NoError(t, DefaultAggregationSelector(ik).Err(), ik) + assert.NoError(t, DefaultAggregationSelector(ik).err(), ik) } } diff --git a/sdk/metric/view.go b/sdk/metric/view.go index f1df24466bc..2d0fe18d7e9 100644 --- a/sdk/metric/view.go +++ b/sdk/metric/view.go @@ -20,7 +20,6 @@ import ( "strings" "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) var ( @@ -92,10 +91,10 @@ func NewView(criteria Instrument, mask Stream) View { matchFunc = criteria.matches } - var agg aggregation.Aggregation + var agg Aggregation if mask.Aggregation != nil { - agg = mask.Aggregation.Copy() - if err := agg.Err(); err != nil { + agg = mask.Aggregation.copy() + if err := agg.err(); err != nil { global.Error( err, "not using aggregation with view", "criteria", criteria, diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index b8f6c921468..07f0c906cb8 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -28,7 +28,6 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric/aggregation" ) var ( @@ -395,13 +394,13 @@ func TestNewViewReplace(t *testing.T) { }, { name: "Aggregation", - mask: Stream{Aggregation: aggregation.LastValue{}}, + mask: Stream{Aggregation: AggregationLastValue{}}, want: func(i Instrument) Stream { return Stream{ Name: i.Name, Description: i.Description, Unit: i.Unit, - Aggregation: aggregation.LastValue{}, + Aggregation: AggregationLastValue{}, } }, }, @@ -423,14 +422,14 @@ func TestNewViewReplace(t *testing.T) { Name: alt, Description: alt, Unit: "1", - Aggregation: aggregation.LastValue{}, + Aggregation: AggregationLastValue{}, }, want: func(i Instrument) Stream { return Stream{ Name: alt, Description: alt, Unit: "1", - Aggregation: aggregation.LastValue{}, + Aggregation: AggregationLastValue{}, } }, }, @@ -446,20 +445,19 @@ func TestNewViewReplace(t *testing.T) { } type badAgg struct { - aggregation.Aggregation - err error + e error } -func (a badAgg) Copy() aggregation.Aggregation { return a } +func (a badAgg) copy() Aggregation { return a } -func (a badAgg) Err() error { return a.err } +func (a badAgg) err() error { return a.e } func TestNewViewAggregationErrorLogged(t *testing.T) { tLog := testr.NewWithOptions(t, testr.Options{Verbosity: 6}) l := &logCounter{LogSink: tLog.GetSink()} otel.SetLogger(logr.New(l)) - agg := badAgg{err: assert.AnError} + agg := badAgg{e: assert.AnError} mask := Stream{Aggregation: agg} got, match := NewView(completeIP, mask)(completeIP) require.True(t, match, "view did not match exact criteria") @@ -532,7 +530,7 @@ func ExampleNewView_drop() { // library. view := NewView( Instrument{Scope: instrumentation.Scope{Name: "db"}}, - Stream{Aggregation: aggregation.Drop{}}, + Stream{Aggregation: AggregationDrop{}}, ) // The created view can then be registered with the OpenTelemetry metric @@ -548,7 +546,7 @@ func ExampleNewView_drop() { fmt.Printf("aggregation: %#v", stream.Aggregation) // Output: // name: queries - // aggregation: aggregation.Drop{} + // aggregation: metric.AggregationDrop{} } func ExampleNewView_wildcard() { From 14b3a985f545b507d12981fed4f951f0dbc452c9 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Tue, 15 Aug 2023 10:48:44 -0400 Subject: [PATCH 663/886] [baggage] Remove unused private field (#4318) Signed-off-by: Yuri Shkuro --- baggage/baggage.go | 14 ++------------ baggage/baggage_test.go | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 29 deletions(-) diff --git a/baggage/baggage.go b/baggage/baggage.go index 46e523a80e4..9e6b3b7b52a 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -61,11 +61,6 @@ type Property struct { // hasValue indicates if a zero-value value means the property does not // have a value or if it was the zero-value. hasValue bool - - // hasData indicates whether the created property contains data or not. - // Properties that do not contain data are invalid with no other check - // required. - hasData bool } // NewKeyProperty returns a new Property for key. @@ -76,7 +71,7 @@ func NewKeyProperty(key string) (Property, error) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } - p := Property{key: key, hasData: true} + p := Property{key: key} return p, nil } @@ -95,7 +90,6 @@ func NewKeyValueProperty(key, value string) (Property, error) { key: key, value: value, hasValue: true, - hasData: true, } return p, nil } @@ -117,7 +111,7 @@ func parseProperty(property string) (Property, error) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) } - p := Property{hasData: true} + var p Property if match[1] != "" { p.key = match[1] } else { @@ -136,10 +130,6 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } - if !p.hasData { - return errFunc(fmt.Errorf("%w: %q", errInvalidProperty, p)) - } - if !keyRe.MatchString(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 46cf7b90ac7..2b98beace10 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -138,7 +138,7 @@ func TestNewKeyProperty(t *testing.T) { p, err = NewKeyProperty("key") assert.NoError(t, err) - assert.Equal(t, Property{key: "key", hasData: true}, p) + assert.Equal(t, Property{key: "key"}, p) } func TestNewKeyValueProperty(t *testing.T) { @@ -152,14 +152,11 @@ func TestNewKeyValueProperty(t *testing.T) { p, err = NewKeyValueProperty("key", "value") assert.NoError(t, err) - assert.Equal(t, Property{key: "key", value: "value", hasValue: true, hasData: true}, p) + assert.Equal(t, Property{key: "key", value: "value", hasValue: true}, p) } func TestPropertyValidate(t *testing.T) { p := Property{} - assert.ErrorIs(t, p.validate(), errInvalidProperty) - - p.hasData = true assert.ErrorIs(t, p.validate(), errInvalidKey) p.key = "k" @@ -562,7 +559,7 @@ func TestBaggageSetMember(t *testing.T) { assert.Equal(t, 1, len(b1.list)) assert.Equal(t, 1, len(b2.list)) - p := properties{{key: "p", hasData: true}} + p := properties{{key: "p"}} m.properties = p b3, err := b2.SetMember(m) assert.NoError(t, err) @@ -573,10 +570,10 @@ func TestBaggageSetMember(t *testing.T) { // The returned baggage needs to be immutable and should use a copy of the // properties slice. - p[0] = Property{key: "different", hasData: true} + p[0] = Property{key: "different"} assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) // Reset for below. - p[0] = Property{key: "p", hasData: true} + p[0] = Property{key: "p"} m = Member{key: "another", hasData: true} b4, err := b3.SetMember(m) @@ -630,7 +627,7 @@ func TestBaggageSetFalseMembers(t *testing.T) { assert.Equal(t, 1, len(b1.list)) assert.Equal(t, 1, len(b2.list)) - p := properties{{key: "p", hasData: false}} + p := properties{{key: "p"}} m.properties = p b3, err := b2.SetMember(m) assert.NoError(t, err) @@ -641,12 +638,12 @@ func TestBaggageSetFalseMembers(t *testing.T) { // The returned baggage needs to be immutable and should use a copy of the // properties slice. - p[0] = Property{key: "different", hasData: false} + p[0] = Property{key: "different"} assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) // Reset for below. - p[0] = Property{key: "p", hasData: false} + p[0] = Property{key: "p"} - m = Member{key: "another", hasData: false} + m = Member{key: "another"} b4, err := b3.SetMember(m) assert.Error(t, err) assert.Equal(t, baggage.Item{Value: "v", Properties: []baggage.Property{{Key: "p"}}}, b3.list[key]) @@ -757,13 +754,13 @@ func TestNewMember(t *testing.T) { assert.Equal(t, Member{hasData: false}, m) key, val := "k", "v" - p := Property{key: "foo", hasData: true} + p := Property{key: "foo"} m, err = NewMember(key, val, p) assert.NoError(t, err) expected := Member{ key: key, value: val, - properties: properties{{key: "foo", hasData: true}}, + properties: properties{{key: "foo"}}, hasData: true, } assert.Equal(t, expected, m) @@ -779,7 +776,7 @@ func TestNewMember(t *testing.T) { expected = Member{ key: key, value: ";", - properties: properties{{key: "foo", hasData: true}}, + properties: properties{{key: "foo"}}, hasData: true, } assert.NoError(t, err) @@ -791,13 +788,13 @@ func TestNewMember(t *testing.T) { } func TestPropertiesValidate(t *testing.T) { - p := properties{{hasData: true}} + p := properties{{}} assert.ErrorIs(t, p.validate(), errInvalidKey) p[0].key = "foo" assert.NoError(t, p.validate()) - p = append(p, Property{key: "bar", hasData: true}) + p = append(p, Property{key: "bar"}) assert.NoError(t, p.validate()) } From d78820e9050cd63daebdb4b82202f10d9c2b66e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 15 Aug 2023 17:54:50 +0200 Subject: [PATCH 664/886] Deprecate exporters/jaeger (#4423) * Deprecate exporters/jaeger * Delete jaeger example * Remove jaeger exporter from docs * Remove example from docs * Update CHANGELOG.md Co-authored-by: Tyler Yahn * Revert "Delete jaeger example" This reverts commit 1a2b47bc9ac4e8f7e6f64a6cf6fe79e4c9261c23. * Revert "Remove example from docs" This reverts commit 682db01075fb62c6947b26f2b57667b2a4122c56. * Add nolint comment * Remove Jaeger from main README * Deprecate example/jaeger * Apply suggestions from code review Co-authored-by: Tyler Yahn * Apply suggestions from code review Co-authored-by: Tyler Yahn * Update go.mod * Update main.go * fix lint --------- Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 5 +++++ README.md | 1 - example/jaeger/go.mod | 6 ++++++ example/jaeger/main.go | 9 ++++++++- exporters/README.md | 1 - exporters/jaeger/README.md | 6 ++++++ exporters/jaeger/doc.go | 6 ++++++ exporters/jaeger/go.mod | 5 +++++ 8 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11549cd77a4..774ec6edb82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Deprecated +- The `go.opentelemetry.io/otel/exporters/jaeger` package is deprecated. + OpenTelemetry dropped support for Jaeger exporter in July 2023. + Use `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` + or `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` instead. (#4423) +- The `go.opentelemetry.io/otel/example/jaeger` package is deprecated. (#4423) - The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` package is deprecated. (#4420) - The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf` package is deprecated. (#4420) - The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest` package is deprecated. (#4420) diff --git a/README.md b/README.md index 370513054de..652dd175590 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,6 @@ All officially supported exporters for the OpenTelemetry project are contained i | Exporter | Metrics | Traces | |---------------------------------------|:-------:|:------:| -| [Jaeger](./exporters/jaeger/) | | ✓ | | [OTLP](./exporters/otlp/) | ✓ | ✓ | | [Prometheus](./exporters/prometheus/) | ✓ | | | [stdout](./exporters/stdout/) | ✓ | ✓ | diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index ce0267c891e..b2be8745d5a 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -1,3 +1,9 @@ +// Deprecated: This example is no longer supported as +// [go.opentelemetry.io/otel/exporters/jaeger] is no longer supported. +// OpenTelemetry dropped support for Jaeger exporter in July 2023. +// Jaeger officially accepts and recommends using OTLP. +// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] +// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. module go.opentelemetry.io/otel/example/jaeger go 1.19 diff --git a/example/jaeger/main.go b/example/jaeger/main.go index 58b7e8b510e..d4f41f5f316 100644 --- a/example/jaeger/main.go +++ b/example/jaeger/main.go @@ -14,6 +14,13 @@ // Command jaeger is an example program that creates spans // and uploads to Jaeger. +// +// Deprecated: This example is no longer supported as +// [go.opentelemetry.io/otel/exporters/jaeger] is no longer supported. +// OpenTelemetry dropped support for Jaeger exporter in July 2023. +// Jaeger officially accepts and recommends using OTLP. +// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] +// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. package main import ( @@ -23,7 +30,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/jaeger" + "go.opentelemetry.io/otel/exporters/jaeger" //nolint:staticcheck // This is deprecated and will be removed in the next release. "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" diff --git a/exporters/README.md b/exporters/README.md index a43f2b8341b..58561902d43 100644 --- a/exporters/README.md +++ b/exporters/README.md @@ -9,7 +9,6 @@ The following exporter packages are provided with the following OpenTelemetry si | Exporter Package | Metrics | Traces | | :-----------------------------------------------------------------------------: | :-----: | :----: | -| [go.opentelemetry.io/otel/exporters/jaeger](./jaeger) | | ✓ | | [go.opentelemetry.io/otel/exporters/otlp/otlpmetric](./otlp/otlpmetric) | ✓ | | | [go.opentelemetry.io/otel/exporters/otlp/otlptrace](./otlp/otlptrace) | | ✓ | | [go.opentelemetry.io/otel/exporters/prometheus](./prometheus) | ✓ | | diff --git a/exporters/jaeger/README.md b/exporters/jaeger/README.md index 19060ba4fd2..439bf79a90f 100644 --- a/exporters/jaeger/README.md +++ b/exporters/jaeger/README.md @@ -2,6 +2,12 @@ [![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/jaeger.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger) +> **Deprecated:** This module is no longer supported. +> OpenTelemetry dropped support for Jaeger exporter in July 2023. +> Jaeger officially accepts and recommends using OTLP. +> Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) +> or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) instead. + [OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) implementation. ## Installation diff --git a/exporters/jaeger/doc.go b/exporters/jaeger/doc.go index 0d7ba867642..a7359654110 100644 --- a/exporters/jaeger/doc.go +++ b/exporters/jaeger/doc.go @@ -13,4 +13,10 @@ // limitations under the License. // Package jaeger contains an OpenTelemetry tracing exporter for Jaeger. +// +// Deprecated: This module is no longer supported. +// OpenTelemetry dropped support for Jaeger exporter in July 2023. +// Jaeger officially accepts and recommends using OTLP. +// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] +// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index 6e716a24da0..cef7005a963 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -1,3 +1,8 @@ +// Deprecated: This module is no longer supported. +// OpenTelemetry dropped support for Jaeger exporter in July 2023. +// Jaeger officially accepts and recommends using OTLP. +// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] +// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. module go.opentelemetry.io/otel/exporters/jaeger go 1.19 From a5ff7af3f3737213063651caa549cb86bae42461 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 16 Aug 2023 07:11:13 -0700 Subject: [PATCH 665/886] Ignore +/- Inf and NaN for exponential histogram measurement (#4446) * Add acceptance test * Ignore +/- Inf and NaN for expo hist record --- .../aggregate/exponential_histogram.go | 5 ++ .../aggregate/exponential_histogram_test.go | 59 ++++++++++++++++--- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index b46c100de4b..c8f1b630f07 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -113,6 +113,11 @@ func newExpoHistogramDataPoint[N int64 | float64](maxSize, maxScale int, noMinMa // record adds a new measurement to the histogram. It will rescale the buckets if needed. func (p *expoHistogramDataPoint[N]) record(v N) { + // Ignore NaN and infinity. + if math.IsInf(float64(v), 0) || math.IsNaN(float64(v)) { + return + } + p.count++ if !p.noMinMax { diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index f1db4139cdb..4209ffd651d 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -45,10 +45,10 @@ func withHandler(t *testing.T) func() { func TestExpoHistogramDataPointRecord(t *testing.T) { t.Run("float64", testExpoHistogramDataPointRecord[float64]) - t.Run("float64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSum[float64]) + t.Run("float64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSumFloat64) t.Run("float64-2", testExpoHistogramDataPointRecordFloat64) t.Run("int64", testExpoHistogramDataPointRecord[int64]) - t.Run("int64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSum[int64]) + t.Run("int64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSumInt64) } // TODO: This can be defined in the test after we drop support for go1.19. @@ -171,15 +171,15 @@ type expoHistogramDataPointRecordMinMaxSumTestCase[N int64 | float64] struct { expected expectedMinMaxSum[N] } -func testExpoHistogramDataPointRecordMinMaxSum[N int64 | float64](t *testing.T) { - testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[N]{ +func testExpoHistogramDataPointRecordMinMaxSumInt64(t *testing.T) { + testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[int64]{ { - values: []N{2, 4, 1}, - expected: expectedMinMaxSum[N]{1, 4, 7, 3}, + values: []int64{2, 4, 1}, + expected: expectedMinMaxSum[int64]{1, 4, 7, 3}, }, { - values: []N{4, 4, 4, 2, 16, 1}, - expected: expectedMinMaxSum[N]{1, 16, 31, 6}, + values: []int64{4, 4, 4, 2, 16, 1}, + expected: expectedMinMaxSum[int64]{1, 16, 31, 6}, }, } @@ -188,7 +188,48 @@ func testExpoHistogramDataPointRecordMinMaxSum[N int64 | float64](t *testing.T) restore := withHandler(t) defer restore() - dp := newExpoHistogramDataPoint[N](4, 20, false, false) + dp := newExpoHistogramDataPoint[int64](4, 20, false, false) + for _, v := range tt.values { + dp.record(v) + } + + assert.Equal(t, tt.expected.max, dp.max) + assert.Equal(t, tt.expected.min, dp.min) + assert.Equal(t, tt.expected.sum, dp.sum) + }) + } +} + +func testExpoHistogramDataPointRecordMinMaxSumFloat64(t *testing.T) { + testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[float64]{ + { + values: []float64{2, 4, 1}, + expected: expectedMinMaxSum[float64]{1, 4, 7, 3}, + }, + { + values: []float64{2, 4, 1, math.Inf(1)}, + expected: expectedMinMaxSum[float64]{1, 4, 7, 4}, + }, + { + values: []float64{2, 4, 1, math.Inf(-1)}, + expected: expectedMinMaxSum[float64]{1, 4, 7, 4}, + }, + { + values: []float64{2, 4, 1, math.NaN()}, + expected: expectedMinMaxSum[float64]{1, 4, 7, 4}, + }, + { + values: []float64{4, 4, 4, 2, 16, 1}, + expected: expectedMinMaxSum[float64]{1, 16, 31, 6}, + }, + } + + for _, tt := range testCases { + t.Run(fmt.Sprint(tt.values), func(t *testing.T) { + restore := withHandler(t) + defer restore() + + dp := newExpoHistogramDataPoint[float64](4, 20, false, false) for _, v := range tt.values { dp.record(v) } From 9d9b71f58d96c278b90713e3f782e94c0b52e199 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 17 Aug 2023 10:31:02 -0700 Subject: [PATCH 666/886] Remove the expoHistogramValues type (#4450) The types only use is being embedded in the expoHistogram. Just explicitly define the fields for the expoHistogram given that is their only use. --- .../aggregate/exponential_histogram.go | 70 +++++++------------ 1 file changed, 26 insertions(+), 44 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index c8f1b630f07..07d9fd6e22c 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -38,43 +38,6 @@ const ( minInt64 int64 = math.MinInt64 ) -// expoHistogramValues summarizes a set of measurements as expoHistogramDataPoints using -// dynamically scaled buckets. -type expoHistogramValues[N int64 | float64] struct { - noSum bool - noMinMax bool - maxSize int - maxScale int - - values map[attribute.Set]*expoHistogramDataPoint[N] - valuesMu sync.Mutex -} - -func newExpoHistValues[N int64 | float64](maxSize, maxScale int, noMinMax, noSum bool) *expoHistogramValues[N] { - return &expoHistogramValues[N]{ - noSum: noSum, - noMinMax: noMinMax, - maxSize: maxSize, - maxScale: maxScale, - - values: make(map[attribute.Set]*expoHistogramDataPoint[N]), - } -} - -// Aggregate records the measurement, scoped by attr, and aggregates it -// into an aggregation. -func (e *expoHistogramValues[N]) measure(_ context.Context, value N, attr attribute.Set) { - e.valuesMu.Lock() - defer e.valuesMu.Unlock() - - v, ok := e.values[attr] - if !ok { - v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) - e.values[attr] = v - } - v.record(value) -} - // expoHistogramDataPoint is a single data point in an exponential histogram. type expoHistogramDataPoint[N int64 | float64] struct { count uint64 @@ -332,12 +295,13 @@ func (b *expoBuckets) downscale(delta int) { // and the aggregation cycle the measurements were made in. func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool) *expoHistogram[N] { return &expoHistogram[N]{ - expoHistogramValues: newExpoHistValues[N]( - int(maxSize), - int(maxScale), - noMinMax, - noSum, - ), + noSum: noSum, + noMinMax: noMinMax, + maxSize: int(maxSize), + maxScale: int(maxScale), + + values: make(map[attribute.Set]*expoHistogramDataPoint[N]), + start: now(), } } @@ -345,11 +309,29 @@ func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMa // expoHistogram summarizes a set of measurements as an histogram with exponentially // defined buckets. type expoHistogram[N int64 | float64] struct { - *expoHistogramValues[N] + noSum bool + noMinMax bool + maxSize int + maxScale int + + values map[attribute.Set]*expoHistogramDataPoint[N] + valuesMu sync.Mutex start time.Time } +func (e *expoHistogram[N]) measure(_ context.Context, value N, attr attribute.Set) { + e.valuesMu.Lock() + defer e.valuesMu.Unlock() + + v, ok := e.values[attr] + if !ok { + v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) + e.values[attr] = v + } + v.record(value) +} + func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { t := now() From 9b47674bc5cb6cd9bde01fcaa2a35624634b0399 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 17 Aug 2023 15:06:46 -0700 Subject: [PATCH 667/886] Make getBin and scaleChange methods of expoHistogramDataPoint (#4451) Both functions receive parameters from an expoHistogramDataPoint and are only ever used by other methods of an expoHistogramDataPoint. Make the functions methods of expoHistogramDataPoint so the parameter arguments can be dropped and the functions are scoped to the type they are used for. Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- .../aggregate/exponential_histogram.go | 24 +++++++++---------- .../aggregate/exponential_histogram_test.go | 19 ++++++++------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index 07d9fd6e22c..e9ba04eea5e 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -102,7 +102,7 @@ func (p *expoHistogramDataPoint[N]) record(v N) { return } - bin := getBin(absV, p.scale) + bin := p.getBin(absV) bucket := &p.posBuckets if v < 0 { @@ -111,7 +111,7 @@ func (p *expoHistogramDataPoint[N]) record(v N) { // If the new bin would make the counts larger than maxScale, we need to // downscale current measurements. - if scaleDelta := scaleChange(bin, bucket.startBin, len(bucket.counts), p.maxSize); scaleDelta > 0 { + if scaleDelta := p.scaleChange(bin, bucket.startBin, len(bucket.counts)); scaleDelta > 0 { if p.scale-scaleDelta < expoMinScale { // With a scale of -10 there is only two buckets for the whole range of float64 values. // This can only happen if there is a max size of 1. @@ -123,17 +123,16 @@ func (p *expoHistogramDataPoint[N]) record(v N) { p.posBuckets.downscale(scaleDelta) p.negBuckets.downscale(scaleDelta) - bin = getBin(absV, p.scale) + bin = p.getBin(absV) } bucket.record(bin) } -// getBin returns the bin of the bucket that the value v should be recorded -// into at the given scale. -func getBin(v float64, scale int) int { +// getBin returns the bin v should be recorded into. +func (p *expoHistogramDataPoint[N]) getBin(v float64) int { frac, exp := math.Frexp(v) - if scale <= 0 { + if p.scale <= 0 { // Because of the choice of fraction is always 1 power of two higher than we want. correction := 1 if frac == .5 { @@ -141,9 +140,9 @@ func getBin(v float64, scale int) int { // will be one higher than we want. correction = 2 } - return (exp - correction) >> (-scale) + return (exp - correction) >> (-p.scale) } - return exp<= maxSize { + for high-low >= p.maxSize { low = low >> 1 high = high >> 1 count++ diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 4209ffd651d..040370d4729 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -655,7 +655,8 @@ func TestScaleChange(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got := scaleChange(tt.args.bin, tt.args.startBin, tt.args.length, tt.args.maxSize) + p := newExpoHistogramDataPoint[float64](tt.args.maxSize, 20, false, false) + got := p.scaleChange(tt.args.bin, tt.args.startBin, tt.args.length) if got != tt.want { t.Errorf("scaleChange() = %v, want %v", got, tt.want) } @@ -927,15 +928,15 @@ func FuzzGetBin(f *testing.F) { t.Skip("skipping test for zero") } - // GetBin is only used with a range of -10 to 20. - scale = (scale%31+31)%31 - 10 - - got := getBin(v, scale) - if v <= lowerBound(got, scale) { - t.Errorf("v=%x scale =%d had bin %d, but was below lower bound %x", v, scale, got, lowerBound(got, scale)) + p := newExpoHistogramDataPoint[float64](4, 20, false, false) + // scale range is -10 to 20. + p.scale = (scale%31+31)%31 - 10 + got := p.getBin(v) + if v <= lowerBound(got, p.scale) { + t.Errorf("v=%x scale =%d had bin %d, but was below lower bound %x", v, p.scale, got, lowerBound(got, p.scale)) } - if v > lowerBound(got+1, scale) { - t.Errorf("v=%x scale =%d had bin %d, but was above upper bound %x", v, scale, got, lowerBound(got+1, scale)) + if v > lowerBound(got+1, p.scale) { + t.Errorf("v=%x scale =%d had bin %d, but was above upper bound %x", v, p.scale, got, lowerBound(got+1, p.scale)) } }) } From 16ce491d38237ce273ff1b2ff08defdd604bad90 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 18 Aug 2023 06:43:09 -0700 Subject: [PATCH 668/886] Fix guard of measured value to not record empty (#4452) A guard was added in #4446 to prevent non-normal float64 from being recorded. This was added in the low-level `record` method meaning that the higher-level `measure` method will still keep a record of the invalid value measurement, just with a zero-value. This fixes that issue by moving the guard to the `measure` method. --- .../aggregate/exponential_histogram.go | 10 +++++----- .../aggregate/exponential_histogram_test.go | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index e9ba04eea5e..368f0027ec3 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -76,11 +76,6 @@ func newExpoHistogramDataPoint[N int64 | float64](maxSize, maxScale int, noMinMa // record adds a new measurement to the histogram. It will rescale the buckets if needed. func (p *expoHistogramDataPoint[N]) record(v N) { - // Ignore NaN and infinity. - if math.IsInf(float64(v), 0) || math.IsNaN(float64(v)) { - return - } - p.count++ if !p.noMinMax { @@ -321,6 +316,11 @@ type expoHistogram[N int64 | float64] struct { } func (e *expoHistogram[N]) measure(_ context.Context, value N, attr attribute.Set) { + // Ignore NaN and infinity. + if math.IsInf(float64(value), 0) || math.IsNaN(float64(value)) { + return + } + e.valuesMu.Lock() defer e.valuesMu.Unlock() diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 040370d4729..cac734c9312 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -45,10 +45,10 @@ func withHandler(t *testing.T) func() { func TestExpoHistogramDataPointRecord(t *testing.T) { t.Run("float64", testExpoHistogramDataPointRecord[float64]) - t.Run("float64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSumFloat64) + t.Run("float64 MinMaxSum", testExpoHistogramMinMaxSumFloat64) t.Run("float64-2", testExpoHistogramDataPointRecordFloat64) t.Run("int64", testExpoHistogramDataPointRecord[int64]) - t.Run("int64 MinMaxSum", testExpoHistogramDataPointRecordMinMaxSumInt64) + t.Run("int64 MinMaxSum", testExpoHistogramMinMaxSumInt64) } // TODO: This can be defined in the test after we drop support for go1.19. @@ -171,7 +171,7 @@ type expoHistogramDataPointRecordMinMaxSumTestCase[N int64 | float64] struct { expected expectedMinMaxSum[N] } -func testExpoHistogramDataPointRecordMinMaxSumInt64(t *testing.T) { +func testExpoHistogramMinMaxSumInt64(t *testing.T) { testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[int64]{ { values: []int64{2, 4, 1}, @@ -188,10 +188,11 @@ func testExpoHistogramDataPointRecordMinMaxSumInt64(t *testing.T) { restore := withHandler(t) defer restore() - dp := newExpoHistogramDataPoint[int64](4, 20, false, false) + h := newExponentialHistogram[int64](4, 20, false, false) for _, v := range tt.values { - dp.record(v) + h.measure(context.Background(), v, alice) } + dp := h.values[alice] assert.Equal(t, tt.expected.max, dp.max) assert.Equal(t, tt.expected.min, dp.min) @@ -200,7 +201,7 @@ func testExpoHistogramDataPointRecordMinMaxSumInt64(t *testing.T) { } } -func testExpoHistogramDataPointRecordMinMaxSumFloat64(t *testing.T) { +func testExpoHistogramMinMaxSumFloat64(t *testing.T) { testCases := []expoHistogramDataPointRecordMinMaxSumTestCase[float64]{ { values: []float64{2, 4, 1}, @@ -229,10 +230,11 @@ func testExpoHistogramDataPointRecordMinMaxSumFloat64(t *testing.T) { restore := withHandler(t) defer restore() - dp := newExpoHistogramDataPoint[float64](4, 20, false, false) + h := newExponentialHistogram[float64](4, 20, false, false) for _, v := range tt.values { - dp.record(v) + h.measure(context.Background(), v, alice) } + dp := h.values[alice] assert.Equal(t, tt.expected.max, dp.max) assert.Equal(t, tt.expected.min, dp.min) From f15ae160c4acfe3872455f87e6133af87859172b Mon Sep 17 00:00:00 2001 From: Umut Tezduyar Lindskog Date: Fri, 18 Aug 2023 16:24:32 +0200 Subject: [PATCH 669/886] Fix the broken sentence (#4456) Co-authored-by: Tyler Yahn --- sdk/metric/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 639dfc9653a..6ad9680413b 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -40,7 +40,7 @@ var errNonPositiveDuration = fmt.Errorf("non-positive duration") // Reader is the interface used between the SDK and an // exporter. Control flow is bi-directional through the // Reader, since the SDK initiates ForceFlush and Shutdown -// while the initiates collection. The Register() method here +// while the exporter initiates collection. The Register() method here // informs the Reader that it can begin reading, signaling the // start of bi-directional control flow. // From 69611bd01a355466f324cca84068f54e6e388654 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 25 Aug 2023 07:39:43 -0700 Subject: [PATCH 670/886] Switch `Stream` back to having an `AttributeFilter` field and add `New*Filter` functions (#4444) * Add allow/deny attr filters * Revert "Replace `Stream.AttributeFilter` with `AllowAttributeKeys` (#4288)" This reverts commit 1633c74aea5f5b9f05083d255d3c37e2b1412e79. * Rename new attr filter funcs Do not include the term "Attribute" in a creation function of the "attribute" pkg. * Update the AttributeFilter field documentation * Add tests for filter creation funcs * Add change to changelog * Apply feedback * Use NewDenyKeysFilter for allow-all and deny-list filters * Remove links from field docs These links do not render. --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 4 +- attribute/filter.go | 60 +++++++++++++++++++++++++ attribute/filter_test.go | 87 ++++++++++++++++++++++++++++++++++++ attribute/set.go | 7 --- sdk/metric/benchmark_test.go | 2 +- sdk/metric/instrument.go | 31 +++---------- sdk/metric/meter_test.go | 9 ++-- sdk/metric/pipeline.go | 4 +- sdk/metric/view.go | 10 ++--- sdk/metric/view_test.go | 29 +++++++----- 10 files changed, 185 insertions(+), 58 deletions(-) create mode 100644 attribute/filter.go create mode 100644 attribute/filter_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 774ec6edb82..12acf1a39c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) - Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) - The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) +- Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) ### Changed @@ -37,9 +38,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Count the Collect time in the PeriodicReader timeout. (#4221) - `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) - `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) -- ⚠️ Metrics SDK Breaking ⚠️ : the `AttributeFilter` fields of the `Stream` from `go.opentelemetry.io/otel/sdk/metric` is replaced by the `AttributeKeys` field. - The `AttributeKeys` fields allows users to specify an allow-list of attributes allowed to be recorded for a view. - This change is made to ensure compatibility with the OpenTelemetry specification. (#4288) - If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) - If an attribute set is Observed multiple times in an async callback, the values will be summed instead of the last observation winning. (#4289) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) diff --git a/attribute/filter.go b/attribute/filter.go new file mode 100644 index 00000000000..638c213d59a --- /dev/null +++ b/attribute/filter.go @@ -0,0 +1,60 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute // import "go.opentelemetry.io/otel/attribute" + +// Filter supports removing certain attributes from attribute sets. When +// the filter returns true, the attribute will be kept in the filtered +// attribute set. When the filter returns false, the attribute is excluded +// from the filtered attribute set, and the attribute instead appears in +// the removed list of excluded attributes. +type Filter func(KeyValue) bool + +// NewAllowKeysFilter returns a Filter that only allows attributes with one of +// the provided keys. +// +// If keys is empty a deny-all filter is returned. +func NewAllowKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return false } + } + + allowed := make(map[Key]struct{}) + for _, k := range keys { + allowed[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := allowed[kv.Key] + return ok + } +} + +// NewDenyKeysFilter returns a Filter that only allows attributes +// that do not have one of the provided keys. +// +// If keys is empty an allow-all filter is returned. +func NewDenyKeysFilter(keys ...Key) Filter { + if len(keys) <= 0 { + return func(kv KeyValue) bool { return true } + } + + forbid := make(map[Key]struct{}) + for _, k := range keys { + forbid[k] = struct{}{} + } + return func(kv KeyValue) bool { + _, ok := forbid[kv.Key] + return !ok + } +} diff --git a/attribute/filter_test.go b/attribute/filter_test.go new file mode 100644 index 00000000000..c668e260b83 --- /dev/null +++ b/attribute/filter_test.go @@ -0,0 +1,87 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package attribute + +import "testing" + +func TestNewAllowKeysFilter(t *testing.T) { + keys := []string{"zero", "one", "two"} + attrs := []KeyValue{Int(keys[0], 0), Int(keys[1], 1), Int(keys[2], 2)} + + t.Run("Empty", func(t *testing.T) { + empty := NewAllowKeysFilter() + for _, kv := range attrs { + if empty(kv) { + t.Errorf("empty NewAllowKeysFilter filter accepted %v", kv) + } + } + }) + + t.Run("Partial", func(t *testing.T) { + partial := NewAllowKeysFilter(Key(keys[0]), Key(keys[1])) + for _, kv := range attrs[:2] { + if !partial(kv) { + t.Errorf("partial NewAllowKeysFilter filter denied %v", kv) + } + } + if partial(attrs[2]) { + t.Errorf("partial NewAllowKeysFilter filter accepted %v", attrs[2]) + } + }) + + t.Run("Full", func(t *testing.T) { + full := NewAllowKeysFilter(Key(keys[0]), Key(keys[1]), Key(keys[2])) + for _, kv := range attrs { + if !full(kv) { + t.Errorf("full NewAllowKeysFilter filter denied %v", kv) + } + } + }) +} + +func TestNewDenyKeysFilter(t *testing.T) { + keys := []string{"zero", "one", "two"} + attrs := []KeyValue{Int(keys[0], 0), Int(keys[1], 1), Int(keys[2], 2)} + + t.Run("Empty", func(t *testing.T) { + empty := NewDenyKeysFilter() + for _, kv := range attrs { + if !empty(kv) { + t.Errorf("empty NewDenyKeysFilter filter denied %v", kv) + } + } + }) + + t.Run("Partial", func(t *testing.T) { + partial := NewDenyKeysFilter(Key(keys[0]), Key(keys[1])) + for _, kv := range attrs[:2] { + if partial(kv) { + t.Errorf("partial NewDenyKeysFilter filter accepted %v", kv) + } + } + if !partial(attrs[2]) { + t.Errorf("partial NewDenyKeysFilter filter denied %v", attrs[2]) + } + }) + + t.Run("Full", func(t *testing.T) { + full := NewDenyKeysFilter(Key(keys[0]), Key(keys[1]), Key(keys[2])) + for _, kv := range attrs { + if full(kv) { + t.Errorf("full NewDenyKeysFilter filter accepted %v", kv) + } + } + }) +} diff --git a/attribute/set.go b/attribute/set.go index b976367e46d..9f9303d4f15 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -39,13 +39,6 @@ type ( iface interface{} } - // Filter supports removing certain attributes from attribute sets. When - // the filter returns true, the attribute will be kept in the filtered - // attribute set. When the filter returns false, the attribute is excluded - // from the filtered attribute set, and the attribute instead appears in - // the removed list of excluded attributes. - Filter func(KeyValue) bool - // Sortable implements sort.Interface, used for sorting KeyValue. This is // an exported type to support a memory optimization. A pointer to one of // these is needed for the call to sort.Stable(), which the caller may diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index dd75de3cd63..90f88088630 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -42,7 +42,7 @@ var viewBenchmarks = []struct { "AttrFilterView", []View{NewView( Instrument{Name: "*"}, - Stream{AllowAttributeKeys: []attribute.Key{"K"}}, + Stream{AttributeFilter: attribute.NewAllowKeysFilter("K")}, )}, }, } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index c09c89361c6..f7224d4b581 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -146,31 +146,14 @@ type Stream struct { Unit string // Aggregation the stream uses for an instrument. Aggregation Aggregation - // AllowAttributeKeys are an allow-list of attribute keys that will be - // preserved for the stream. Any attribute recorded for the stream with a - // key not in this slice will be dropped. + // AttributeFilter is an attribute Filter applied to the attributes + // recorded for an instrument's measurement. If the filter returns false + // the attribute will not be recorded, otherwise, if it returns true, it + // will record the attribute. // - // If this slice is empty, all attributes will be kept. - AllowAttributeKeys []attribute.Key -} - -// attributeFilter returns an attribute.Filter that only allows attributes -// with keys in s.AttributeKeys. -// -// If s.AttributeKeys is empty an accept-all filter is returned. -func (s Stream) attributeFilter() attribute.Filter { - if len(s.AllowAttributeKeys) <= 0 { - return func(kv attribute.KeyValue) bool { return true } - } - - allowed := make(map[attribute.Key]struct{}) - for _, k := range s.AllowAttributeKeys { - allowed[k] = struct{}{} - } - return func(kv attribute.KeyValue) bool { - _, ok := allowed[kv.Key] - return ok - } + // Use NewAllowKeysFilter from "go.opentelemetry.io/otel/attribute" to + // provide an allow-list of attribute keys here. + AttributeFilter attribute.Filter } // instID are the identifying properties of a instrument. diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index edb1a400b2d..7c1d21f96cd 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1518,7 +1518,7 @@ func testAttributeFilter(temporality metricdata.Temporality) func(*testing.T) { WithReader(rdr), WithView(NewView( Instrument{Name: "*"}, - Stream{AllowAttributeKeys: []attribute.Key{"foo"}}, + Stream{AttributeFilter: attribute.NewAllowKeysFilter("foo")}, )), ).Meter("TestAttributeFilter") require.NoError(t, tt.register(t, mtr)) @@ -1565,8 +1565,11 @@ func TestObservableExample(t *testing.T) { selector := func(InstrumentKind) metricdata.Temporality { return temp } reader := NewManualReader(WithTemporalitySelector(selector)) - noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName}) - filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AllowAttributeKeys: []attribute.Key{"pid"}}) + allowAll := attribute.NewDenyKeysFilter() + noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName, AttributeFilter: allowAll}) + + filter := attribute.NewDenyKeysFilter("tid") + filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AttributeFilter: filter}) mp := NewMeterProvider(WithReader(reader), WithView(noFiltered, filtered)) meter := mp.Meter(scopeName) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index d76231cff7f..c1597a75597 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -351,9 +351,7 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum b := aggregate.Builder[N]{ Temporality: i.pipeline.reader.temporality(kind), } - if len(stream.AllowAttributeKeys) > 0 { - b.Filter = stream.attributeFilter() - } + b.Filter = stream.AttributeFilter in, out, err := i.aggregateFunc(b, stream.Aggregation, kind) if err != nil { return aggVal[N]{0, nil, err} diff --git a/sdk/metric/view.go b/sdk/metric/view.go index 2d0fe18d7e9..e4f350e1912 100644 --- a/sdk/metric/view.go +++ b/sdk/metric/view.go @@ -107,11 +107,11 @@ func NewView(criteria Instrument, mask Stream) View { return func(i Instrument) (Stream, bool) { if matchFunc(i) { return Stream{ - Name: nonZero(mask.Name, i.Name), - Description: nonZero(mask.Description, i.Description), - Unit: nonZero(mask.Unit, i.Unit), - Aggregation: agg, - AllowAttributeKeys: mask.AllowAttributeKeys, + Name: nonZero(mask.Name, i.Name), + Description: nonZero(mask.Description, i.Description), + Unit: nonZero(mask.Unit, i.Unit), + Aggregation: agg, + AttributeFilter: mask.AttributeFilter, }, true } return Stream{}, false diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index 07f0c906cb8..d9e3f9b6c81 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -404,18 +404,6 @@ func TestNewViewReplace(t *testing.T) { } }, }, - { - name: "AttributeKeys", - mask: Stream{AllowAttributeKeys: []attribute.Key{"test"}}, - want: func(i Instrument) Stream { - return Stream{ - Name: i.Name, - Description: i.Description, - Unit: i.Unit, - AllowAttributeKeys: []attribute.Key{"test"}, - } - }, - }, { name: "Complete", mask: Stream{ @@ -442,6 +430,23 @@ func TestNewViewReplace(t *testing.T) { assert.Equal(t, test.want(completeIP), got) }) } + + // Go does not allow for the comparison of function values, even their + // addresses. Therefore, the AttributeFilter field needs an alternative + // testing strategy. + t.Run("AttributeFilter", func(t *testing.T) { + allowed := attribute.String("key", "val") + filter := func(kv attribute.KeyValue) bool { + return kv == allowed + } + mask := Stream{AttributeFilter: filter} + got, match := NewView(completeIP, mask)(completeIP) + require.True(t, match, "view did not match exact criteria") + require.NotNil(t, got.AttributeFilter, "AttributeFilter not set") + assert.True(t, got.AttributeFilter(allowed), "wrong AttributeFilter") + other := attribute.String("key", "other val") + assert.False(t, got.AttributeFilter(other), "wrong AttributeFilter") + }) } type badAgg struct { From 6be116e31e5d7e326ae3300e9cb9245a6e0086f9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 27 Aug 2023 07:18:34 -0700 Subject: [PATCH 671/886] Add testing support for Go 1.21 (#4463) * Add testing support for Go 1.21 * Add PR number in changelog --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/dependabot.yml | 2 +- CHANGELOG.md | 1 + README.md | 5 +++++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 18c29605c96..9877d7ca989 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: "1.20" + DEFAULT_GO_VERSION: "1.21" jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc6290a5e72..a0dc91bfea2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "1.20" + DEFAULT_GO_VERSION: "1.21" jobs: lint: runs-on: ubuntu-latest @@ -99,7 +99,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["1.20", 1.19] + go-version: ["1.21", "1.20", 1.19] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 2de6b06d401..9d4e27a9e6e 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: - go-version: '^1.20.0' + go-version: '^1.21.0' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 12acf1a39c6..7b718896178 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) - The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) - Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) +- Support Go 1.21. (#4463) ### Changed diff --git a/README.md b/README.md index 652dd175590..4e5531f3052 100644 --- a/README.md +++ b/README.md @@ -53,14 +53,19 @@ Currently, this project supports the following environments. | OS | Go Version | Architecture | |---------|------------|--------------| +| Ubuntu | 1.21 | amd64 | | Ubuntu | 1.20 | amd64 | | Ubuntu | 1.19 | amd64 | +| Ubuntu | 1.21 | 386 | | Ubuntu | 1.20 | 386 | | Ubuntu | 1.19 | 386 | +| MacOS | 1.21 | amd64 | | MacOS | 1.20 | amd64 | | MacOS | 1.19 | amd64 | +| Windows | 1.21 | amd64 | | Windows | 1.20 | amd64 | | Windows | 1.19 | amd64 | +| Windows | 1.21 | 386 | | Windows | 1.20 | 386 | | Windows | 1.19 | 386 | From 183e0817bd7bd77a496f1c52d061df910f740116 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 27 Aug 2023 07:31:32 -0700 Subject: [PATCH 672/886] Bump github.com/golangci/golangci-lint in /internal/tools (#4465) Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.54.1 to 1.54.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.54.1...v1.54.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 22 +++++++++---------- internal/tools/go.sum | 51 +++++++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 395990cc8d2..58b523a3f9a 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.54.1 + github.com/golangci/golangci-lint v1.54.2 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -24,8 +24,8 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/4meepo/tagalign v1.3.2 // indirect github.com/Abirdcfly/dupword v0.0.12 // indirect - github.com/Antonboom/errname v0.1.10 // indirect - github.com/Antonboom/nilnil v0.1.5 // indirect + github.com/Antonboom/errname v0.1.12 // indirect + github.com/Antonboom/nilnil v0.1.7 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect @@ -47,6 +47,7 @@ require ( github.com/breml/errchkjson v0.3.1 // indirect github.com/butuzov/ireturn v0.2.0 // indirect github.com/butuzov/mirror v1.1.0 // indirect + github.com/ccojocar/zxcvbn-go v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect @@ -131,15 +132,14 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect - github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.13.3 // indirect + github.com/nunnatsa/ginkgolinter v0.13.5 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.4.3 // indirect + github.com/polyfloyd/go-errorlint v1.4.4 // indirect github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect @@ -153,8 +153,8 @@ require ( github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect - github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect - github.com/securego/gosec/v2 v2.16.0 // indirect + github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect + github.com/securego/gosec/v2 v2.17.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect @@ -177,7 +177,7 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.11 // indirect + github.com/tetafro/godot v1.4.14 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect @@ -192,7 +192,7 @@ require ( github.com/ykadowak/zerologlint v0.1.3 // indirect gitlab.com/bosi/decorder v0.4.0 // indirect go.opentelemetry.io/build-tools v0.11.0 // indirect - go.tmz.dev/musttag v0.7.1 // indirect + go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect @@ -208,7 +208,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.3 // indirect + honnef.co/go/tools v0.4.5 // indirect mvdan.cc/gofumpt v0.5.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 3f509773011..308c7325a01 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -46,10 +46,10 @@ github.com/4meepo/tagalign v1.3.2 h1:1idD3yxlRGV18VjqtDbqYvQ5pXqQS0wO2dn6M3XstvI github.com/4meepo/tagalign v1.3.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= github.com/Abirdcfly/dupword v0.0.12 h1:56NnOyrXzChj07BDFjeRA+IUzSz01jmzEq+G4kEgFhc= github.com/Abirdcfly/dupword v0.0.12/go.mod h1:+us/TGct/nI9Ndcbcp3rgNcQzctTj68pq7TcgNpLfdI= -github.com/Antonboom/errname v0.1.10 h1:RZ7cYo/GuZqjr1nuJLNe8ZH+a+Jd9DaZzttWzak9Bls= -github.com/Antonboom/errname v0.1.10/go.mod h1:xLeiCIrvVNpUtsN0wxAh05bNIZpqE22/qDMnTBTttiA= -github.com/Antonboom/nilnil v0.1.5 h1:X2JAdEVcbPaOom2TUa1FxZ3uyuUlex0XMLGYMemu6l0= -github.com/Antonboom/nilnil v0.1.5/go.mod h1:I24toVuBKhfP5teihGWctrRiPbRKHwZIFOvc6v3HZXk= +github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClDcQY= +github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= +github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTow= +github.com/Antonboom/nilnil v0.1.7/go.mod h1:TP+ScQWVEq0eSIxqU8CbdT5DFWoHp0MbP+KMUO1BKYQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -106,6 +106,8 @@ github.com/butuzov/ireturn v0.2.0/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacM github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/ccojocar/zxcvbn-go v1.0.1 h1:+sxrANSCj6CdadkcMnvde/GWU1vZiiXRbqYSCalV4/4= +github.com/ccojocar/zxcvbn-go v1.0.1/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -247,8 +249,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.54.1 h1:0qMrH1gkeIBqCZaaAm5Fwq4xys9rO/lJofHfZURIFFk= -github.com/golangci/golangci-lint v1.54.1/go.mod h1:JK47+qksV/t2mAz9YvndwT0ZLW4A1rvDljOs3g9jblo= +github.com/golangci/golangci-lint v1.54.2 h1:oR9zxfWYxt7hFqk6+fw6Enr+E7F0SN2nqHhJYyIb0yo= +github.com/golangci/golangci-lint v1.54.2/go.mod h1:vnsaCTPKCI2wreL9tv7RkHDwUrz3htLjed6+6UsvcwU= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -425,19 +427,17 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA= -github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.13.3 h1:wEvjrzSMfDdnoWkctignX9QTf4rT9f4GkQ3uVoXBmiU= -github.com/nunnatsa/ginkgolinter v0.13.3/go.mod h1:aTKXo8WddENYxNEFT+4ZxEgWXqlD9uMD3w9Bfw/ABEc= +github.com/nunnatsa/ginkgolinter v0.13.5 h1:fOsPB4CEZOPkyMqF4B9hoqOpooFWU7vWSVkCSscVpgU= +github.com/nunnatsa/ginkgolinter v0.13.5/go.mod h1:OBHy4536xtuX3102NM63XRtOyxqZOO02chsaeDWXVO8= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -455,8 +455,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.4.3 h1:P6NALOLV8BrWhm6PsqOraUK05E5h8IZnpXYJ+CIg+0U= -github.com/polyfloyd/go-errorlint v1.4.3/go.mod h1:VPlWPh6hB/wruVG803SuNpLuTGNjLHYlvcdSy4RhdPA= +github.com/polyfloyd/go-errorlint v1.4.4 h1:A9gytp+p6TYqeALTYRoxJESYP8wJRETRX2xzGWFsEBU= +github.com/polyfloyd/go-errorlint v1.4.4/go.mod h1:ry5NqF7l9Q77V+XqAfUg1zfryrEtyac3G5+WVpIK0xU= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -505,10 +505,10 @@ github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/ github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= -github.com/sashamelentyev/usestdlibvars v1.23.0 h1:01h+/2Kd+NblNItNeux0veSL5cBF1jbEOPrEhDzGYq0= -github.com/sashamelentyev/usestdlibvars v1.23.0/go.mod h1:YPwr/Y1LATzHI93CqoPUN/2BzGQ/6N/cl/KwgR0B/aU= -github.com/securego/gosec/v2 v2.16.0 h1:Pi0JKoasQQ3NnoRao/ww/N/XdynIB9NRYYZT5CyOs5U= -github.com/securego/gosec/v2 v2.16.0/go.mod h1:xvLcVZqUfo4aAQu56TNv7/Ltz6emAOQAEsrZrt7uGlI= +github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= +github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE= +github.com/securego/gosec/v2 v2.17.0 h1:ZpAStTDKY39insEG9OH6kV3IkhQZPTq9a9eGOLOjcdI= +github.com/securego/gosec/v2 v2.17.0/go.mod h1:lt+mgC91VSmriVoJLentrMkRCYs+HLTBnUFUBuhV2hc= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -554,7 +554,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -577,8 +576,8 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.11 h1:BVoBIqAf/2QdbFmSwAWnaIqDivZdOV0ZRwEm6jivLKw= -github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= +github.com/tetafro/godot v1.4.14 h1:ScO641OHpf9UpHPk8fCknSuXNMpi4iFlwuWoBs3L+1s= +github.com/tetafro/godot v1.4.14/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= @@ -614,7 +613,7 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY= gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg= -go-simpler.org/assert v0.5.0 h1:+5L/lajuQtzmbtEfh69sr5cRf2/xZzyJhFjoOz/PPqs= +go-simpler.org/assert v0.6.0 h1:QxSrXa4oRuo/1eHMXSBFHKvJIpWABayzKldqZyugG7E= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -633,8 +632,8 @@ go.opentelemetry.io/build-tools/multimod v0.11.0 h1:QMo2Y4BlsTsWUR0LXV4gmiv5yEiX go.opentelemetry.io/build-tools/multimod v0.11.0/go.mod h1:EID7sjEGyk1FWzRdsV6rlWp43IIn8iHXGE5pM4TytyQ= go.opentelemetry.io/build-tools/semconvgen v0.11.0 h1:gQsNzy49l9JjNozybaRUl+vy0EMxYasV8w6aK+IWquc= go.opentelemetry.io/build-tools/semconvgen v0.11.0/go.mod h1:Zy04Bw3w3lT7mORe23V2BwjfJYpoza6Xz1XSMIrLTCg= -go.tmz.dev/musttag v0.7.1 h1:9lFmeSFnFfPuMq4IksHGomItE6NgKMNW2Nt2FPOhCfU= -go.tmz.dev/musttag v0.7.1/go.mod h1:oJLkpR56EsIryktZJk/B0IroSMi37YWver47fibGh5U= +go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= +go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -1059,8 +1058,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.3 h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw= -honnef.co/go/tools v0.4.3/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA= +honnef.co/go/tools v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo= +honnef.co/go/tools v0.4.5/go.mod h1:GUV+uIBCLpdf0/v6UhHHG/yzI/z6qPskBeQCjcNB96k= mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= From 3c476ce1816ae6f38758e90cc36d8b77ebcc223b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 28 Aug 2023 07:50:03 -0700 Subject: [PATCH 673/886] Release v1.17.0/v0.40.0/v0.0.5 (#4464) * Bump versions.yaml * Prepare stable-v1 for version v1.17.0 * Prepare experimental-metrics for version v0.40.0 * Prepare experimental-schema for version v0.0.5 * Update changelog * Update changelog release header --- CHANGELOG.md | 51 ++++++++++--------- bridge/opencensus/go.mod | 10 ++-- bridge/opencensus/test/go.mod | 12 ++--- bridge/opentracing/go.mod | 6 +-- bridge/opentracing/test/go.mod | 8 +-- example/fib/go.mod | 10 ++-- example/jaeger/go.mod | 10 ++-- example/namedtracer/go.mod | 10 ++-- example/opencensus/go.mod | 16 +++--- example/otel-collector/go.mod | 12 ++--- example/passthrough/go.mod | 10 ++-- example/prometheus/go.mod | 12 ++--- example/view/go.mod | 12 ++--- example/zipkin/go.mod | 10 ++-- exporters/jaeger/go.mod | 8 +-- exporters/otlp/otlpmetric/go.mod | 12 ++--- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++--- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 12 ++--- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 +-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++-- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 ++-- exporters/stdout/stdoutmetric/go.mod | 10 ++-- exporters/stdout/stdouttrace/go.mod | 8 +-- exporters/zipkin/go.mod | 8 +-- go.mod | 4 +- metric/go.mod | 4 +- sdk/go.mod | 6 +-- sdk/metric/go.mod | 8 +-- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 6 +-- 36 files changed, 171 insertions(+), 166 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b718896178..7aa5c8051f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,24 +8,26 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.17.0/0.40.0/0.0.5] 2023-08-28 + ### Added -- Add `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) -- Add `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Export the `ManualReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) +- Export the `PeriodicReader` struct in `go.opentelemetry.io/otel/sdk/metric`. (#4244) - Add support for exponential histogram aggregations. - A histogram can be configured as an exponential histogram using a view with `go.opentelemetry.io/otel/sdk/metric/aggregation.ExponentialHistogram` as the aggregation. (#4245) -- Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) -- Add `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) -- OTLP Metrics Exporter now supports the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) + A histogram can be configured as an exponential histogram using a view with `"go.opentelemetry.io/otel/sdk/metric".ExponentialHistogram` as the aggregation. (#4245) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4272) +- Export the `Exporter` struct in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4272) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` environment variable. (#4287) - Add `WithoutCounterSuffixes` option in `go.opentelemetry.io/otel/exporters/prometheus` to disable addition of `_total` suffixes. (#4306) -- Add info and debug logging to the metric SDK. (#4315) +- Add info and debug logging to the metric SDK in `go.opentelemetry.io/otel/sdk/metric`. (#4315) - The `go.opentelemetry.io/otel/semconv/v1.21.0` package. The package contains semantic conventions from the `v1.21.0` version of the OpenTelemetry Semantic Conventions. (#4362) - Accept 201 to 299 HTTP status as success in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4365) - Document the `Temporality` and `Aggregation` methods of the `"go.opentelemetry.io/otel/sdk/metric".Exporter"` need to be concurrent safe. (#4381) -- Expand the set of units supported by the prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) +- Expand the set of units supported by the Prometheus exporter, and don't add unit suffixes if they are already present in `go.opentelemetry.op/otel/exporters/prometheus` (#4374) - Move the `Aggregation` interface and its implementations from `go.opentelemetry.io/otel/sdk/metric/aggregation` to `go.opentelemetry.io/otel/sdk/metric`. (#4435) -- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) +- The exporters in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` now support the `OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION` environment variable. (#4437) - Add the `NewAllowKeysFilter` and `NewDenyKeysFilter` functions to `go.opentelemetry.io/otel/attribute` to allow convenient creation of allow-keys and deny-keys filters. (#4444) - Support Go 1.21. (#4463) @@ -33,23 +35,25 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Starting from `v1.21.0` of semantic conventions, `go.opentelemetry.io/otel/semconv/{version}/httpconv` and `go.opentelemetry.io/otel/semconv/{version}/netconv` packages will no longer be published. (#4145) - Log duplicate instrument conflict at a warning level instead of info in `go.opentelemetry.io/otel/sdk/metric`. (#4202) -- Return an error on the creation of new instruments if their name doesn't pass regexp validation. (#4210) +- Return an error on the creation of new instruments in `go.opentelemetry.io/otel/sdk/metric` if their name doesn't pass regexp validation. (#4210) - `NewManualReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*ManualReader` instead of `Reader`. (#4244) - `NewPeriodicReader` in `go.opentelemetry.io/otel/sdk/metric` returns `*PeriodicReader` instead of `Reader`. (#4244) -- Count the Collect time in the PeriodicReader timeout. (#4221) -- `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) -- `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) -- If an attribute set is omitted from an async callback, the previous value will no longer be exported. (#4290) -- If an attribute set is Observed multiple times in an async callback, the values will be summed instead of the last observation winning. (#4289) +- Count the Collect time in the `PeriodicReader` timeout in `go.opentelemetry.io/otel/sdk/metric`. (#4221) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- The function `New` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` returns `*Exporter` instead of `"go.opentelemetry.io/otel/sdk/metric".Exporter`. (#4272) +- If an attribute set is omitted from an async callback, the previous value will no longer be exported in `go.opentelemetry.io/otel/sdk/metric`. (#4290) +- If an attribute set is observed multiple times in an async callback in `go.opentelemetry.io/otel/sdk/metric`, the values will be summed instead of the last observation winning. (#4289) - Allow the explicit bucket histogram aggregation to be used for the up-down counter, observable counter, observable up-down counter, and observable gauge in the `go.opentelemetry.io/otel/sdk/metric` package. (#4332) - Restrict `Meter`s in `go.opentelemetry.io/otel/sdk/metric` to only register and collect instruments it created. (#4333) - `PeriodicReader.Shutdown` and `PeriodicReader.ForceFlush` in `go.opentelemetry.io/otel/sdk/metric` now apply the periodic reader's timeout to the operation if the user provided context does not contain a deadline. (#4356, #4377) - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.21.0`. (#4408) -- Increase instrument name maximum length from 63 to 255 characters. (#4434) -- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an Option for metric.NewManualReader and metric.NewPeriodicReader, and remove `Reader.RegisterProducer()` (#4346) +- Increase instrument name maximum length from 63 to 255 characters in `go.opentelemetry.io/otel/sdk/metric`. (#4434) +- Add `go.opentelemetry.op/otel/sdk/metric.WithProducer` as an `Option` for `"go.opentelemetry.io/otel/sdk/metric".NewManualReader` and `"go.opentelemetry.io/otel/sdk/metric".NewPeriodicReader`. (#4346) ### Removed +- Remove `Reader.RegisterProducer` in `go.opentelemetry.io/otel/metric`. + Use the added `WithProducer` option instead. (#4346) - Remove `Reader.ForceFlush` in `go.opentelemetry.io/otel/metric`. Notice that `PeriodicReader.ForceFlush` is still available. (#4375) @@ -57,21 +61,21 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Correctly format log messages from the `go.opentelemetry.io/otel/exporters/zipkin` exporter. (#4143) - Log an error for calls to `NewView` in `go.opentelemetry.io/otel/sdk/metric` that have empty criteria. (#4307) -- Fix `resource.WithHostID()` to not set an empty `host.id`. (#4317) +- Fix `"go.opentelemetry.io/otel/sdk/resource".WithHostID()` to not set an empty `host.id`. (#4317) - Use the instrument identifying fields to cache aggregators and determine duplicate instrument registrations in `go.opentelemetry.io/otel/sdk/metric`. (#4337) - Detect duplicate instruments for case-insensitive names in `go.opentelemetry.io/otel/sdk/metric`. (#4338) -- The `ManualReader` will not panic if `AggregationSelector` returns `nil`. (#4350) -- If a Reader's AggregationSelector return nil or DefaultAggregation the pipeline will use the default aggregation. (#4350) +- The `ManualReader` will not panic if `AggregationSelector` returns `nil` in `go.opentelemetry.io/otel/sdk/metric`. (#4350) +- If a `Reader`'s `AggregationSelector` returns `nil` or `DefaultAggregation` the pipeline will use the default aggregation. (#4350) - Log a suggested view that fixes instrument conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4349) - Fix possible panic, deadlock and race condition in batch span processor in `go.opentelemetry.io/otel/sdk/trace`. (#4353) -- Improve context cancelation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) +- Improve context cancellation handling in batch span processor's `ForceFlush` in `go.opentelemetry.io/otel/sdk/trace`. (#4369) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` using gotmpl. (#4397, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4404, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal` using gotmpl. (#4407, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4400, #3846) - Decouple `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal` from `go.opentelemetry.io/otel/exporters/otlp/internal` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal` using gotmpl. (#4401, #3846) - Do not block the metric SDK when OTLP metric exports are blocked in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#3925, #4395) -- Do not append _total if the counter already ends in total `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) +- Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) - Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) - Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) @@ -2587,7 +2591,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.17.0...HEAD +[1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 [1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 [1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 [1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index b650a2ac01a..d4515795b46 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 1290cee67be..7ff3ee957b6 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.19 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/bridge/opencensus v0.39.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/bridge/opencensus v0.40.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.39.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.40.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 8772e6f4ac6..8a81f16ae86 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 4d0c5393327..e09614c4f4c 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/bridge/opentracing v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/bridge/opentracing v1.17.0 google.golang.org/grpc v1.57.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.9.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index bfa54170291..3f391b6e4da 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.19 require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod index b2be8745d5a..847ddfeaff3 100644 --- a/example/jaeger/go.mod +++ b/example/jaeger/go.mod @@ -15,16 +15,16 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/jaeger v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/jaeger v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 40a4ca0d780..6e5730dd516 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 5807ecfd1f2..d6601690bf8 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/bridge/opencensus v0.39.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.39.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/bridge/opencensus v0.40.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.40.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index c2d967bda81..63390fe66c7 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 google.golang.org/grpc v1.57.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 4d1ead190fb..6403fbe26bc 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.19 require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 510392cdfce..596b1e690e8 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.19 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/prometheus v0.39.0 - go.opentelemetry.io/otel/metric v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/prometheus v0.40.0 + go.opentelemetry.io/otel/metric v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index bfac7cea8dd..740c76dfdf5 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.19 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/prometheus v0.39.0 - go.opentelemetry.io/otel/metric v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/prometheus v0.40.0 + go.opentelemetry.io/otel/metric v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index e86ed2ddd7b..8c8cc598c8b 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/zipkin v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/zipkin v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect ) diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod index cef7005a963..1a06d5d85cd 100644 --- a/exporters/jaeger/go.mod +++ b/exporters/jaeger/go.mod @@ -12,16 +12,16 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 0f36b495e9e..a01756c663a 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 @@ -24,8 +24,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 4b865521994..f525d64427c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc google.golang.org/grpc v1.57.0 @@ -25,8 +25,8 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9c6c5c1e784..09d4232baf4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.39.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 @@ -24,8 +24,8 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index caec1c40886..de195b0bf8c 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.39.0" + return "0.40.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 9b9d3815751..cef7950ed8a 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -6,9 +6,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 @@ -23,7 +23,7 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8e54df641bc..9ba09a69e25 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc @@ -23,7 +23,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f891821c536..0bf86a8b7ea 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.19 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index db70dc53143..1780b71659b 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.16.0" + return "1.17.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 8c412831e9b..b25c82a818d 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/metric v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/metric v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 2d269fbd80b..28f9a60b1c2 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.19 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/sdk/metric v0.39.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index edfdded4033..a69603ca0d1 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index ff97e81e252..fbd3c1eaf74 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index d6483834b99..73bade0c44a 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel/metric v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index cf27a3f4dfa..35d7e92b104 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel v1.17.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 82fd372ede4..3d136f9b8b3 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/trace v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/trace v1.17.0 golang.org/x/sys v0.11.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index f7f92f4ecc2..285573b6973 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 - go.opentelemetry.io/otel/metric v1.16.0 - go.opentelemetry.io/otel/sdk v1.16.0 + go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/metric v1.17.0 + go.opentelemetry.io/otel/sdk v1.17.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index cd4666b3223..9a3f8fa977e 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "0.39.0" + return "0.40.0" } diff --git a/sdk/version.go b/sdk/version.go index dbef90b0df1..a99bdd38efc 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.16.0" + return "1.17.0" } diff --git a/trace/go.mod b/trace/go.mod index 9b6953dcb8f..21570ab1e3c 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.16.0 + go.opentelemetry.io/otel v1.17.0 ) require ( diff --git a/version.go b/version.go index c2217a28d68..3bce1b1e4f9 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.16.0" + return "1.17.0" } diff --git a/versions.yaml b/versions.yaml index 9dc47532bc2..94f1c919e29 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.16.0 + version: v1.17.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -36,7 +36,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.39.0 + version: v0.40.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus @@ -50,7 +50,7 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/view experimental-schema: - version: v0.0.4 + version: v0.0.5 modules: - go.opentelemetry.io/otel/schema excluded-modules: From f172db89a17c4e6737ba29009f9e68bcb639fd89 Mon Sep 17 00:00:00 2001 From: Pulak Kanti Bhowmick Date: Mon, 28 Aug 2023 23:23:18 +0600 Subject: [PATCH 674/886] handle err in metric example test (#4462) * fix type in metric example test Signed-off-by: Pulak Kanti Bhowmick * handle error in metric example test Signed-off-by: Pulak Kanti Bhowmick * update counter example Signed-off-by: Pulak Kanti Bhowmick * handle the err only Signed-off-by: Pulak Kanti Bhowmick --------- Signed-off-by: Pulak Kanti Bhowmick Co-authored-by: Tyler Yahn --- metric/example_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/metric/example_test.go b/metric/example_test.go index c1f67a1af18..35d7f4218e2 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -76,10 +76,18 @@ func ExampleMeter_asynchronous_multiple() { meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") // This is just a sample of memory stats to record from the Memstats - heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs") - gcCount, _ := meter.Int64ObservableCounter("gcCount") + heapAlloc, err := meter.Int64ObservableUpDownCounter("heapAllocs") + if err != nil { + fmt.Println("failed to register updown counter for heapAllocs") + panic(err) + } + gcCount, err := meter.Int64ObservableCounter("gcCount") + if err != nil { + fmt.Println("failed to register counter for gcCount") + panic(err) + } - _, err := meter.RegisterCallback( + _, err = meter.RegisterCallback( func(_ context.Context, o metric.Observer) error { memStats := &runtime.MemStats{} // This call does work From 537fd53e6ec9ff5744a9ac940a23c3257a497071 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 29 Aug 2023 11:13:25 -0700 Subject: [PATCH 675/886] Remove the deprecated Jaeger exporter and example (#4467) * Remove the deprecated Jaeger exporter * Add changelog stub * Remove the deprecated Jaeger example * Add changelog stub for example rm * Add PR number to changelog * Remove dependabot entries * Remove versions.yaml entries --- .github/dependabot.yml | 18 - CHANGELOG.md | 5 + example/jaeger/go.mod | 33 - example/jaeger/go.sum | 13 - example/jaeger/main.go | 108 - exporters/jaeger/README.md | 56 - exporters/jaeger/agent.go | 213 -- exporters/jaeger/agent_test.go | 189 -- .../jaeger/assertsocketbuffersize_test.go | 49 - .../assertsocketbuffersize_windows_test.go | 34 - exporters/jaeger/doc.go | 22 - exporters/jaeger/env.go | 44 - exporters/jaeger/env_test.go | 242 -- exporters/jaeger/go.mod | 35 - exporters/jaeger/go.sum | 27 - .../gen-go/agent/GoUnusedProtection__.go | 6 - .../internal/gen-go/agent/agent-consts.go | 27 - .../gen-go/agent/agent-remote/agent-remote.go | 210 -- .../jaeger/internal/gen-go/agent/agent.go | 412 --- .../gen-go/jaeger/GoUnusedProtection__.go | 6 - .../collector-remote/collector-remote.go | 180 - .../internal/gen-go/jaeger/jaeger-consts.go | 22 - .../jaeger/internal/gen-go/jaeger/jaeger.go | 3022 ----------------- .../gen-go/zipkincore/GoUnusedProtection__.go | 6 - .../zipkin_collector-remote.go | 180 - .../gen-go/zipkincore/zipkincore-consts.go | 39 - .../internal/gen-go/zipkincore/zipkincore.go | 2067 ----------- exporters/jaeger/internal/gen.go | 29 - .../jaeger/internal/internaltest/alignment.go | 74 - exporters/jaeger/internal/internaltest/env.go | 101 - .../jaeger/internal/internaltest/env_test.go | 237 -- .../jaeger/internal/internaltest/errors.go | 30 - .../jaeger/internal/internaltest/harness.go | 344 -- .../internal/internaltest/text_map_carrier.go | 144 - .../internaltest/text_map_carrier_test.go | 86 - .../internaltest/text_map_propagator.go | 115 - .../internaltest/text_map_propagator_test.go | 72 - .../jaeger/internal/matchers/expectation.go | 310 -- .../jaeger/internal/matchers/expecter.go | 39 - .../internal/matchers/temporal_matcher.go | 28 - .../internal/third_party/thrift/LICENSE | 306 -- .../jaeger/internal/third_party/thrift/NOTICE | 5 - .../lib/go/thrift/application_exception.go | 180 - .../thrift/lib/go/thrift/binary_protocol.go | 555 --- .../lib/go/thrift/buffered_transport.go | 99 - .../thrift/lib/go/thrift/client.go | 109 - .../thrift/lib/go/thrift/compact_protocol.go | 865 ----- .../thrift/lib/go/thrift/configuration.go | 378 --- .../thrift/lib/go/thrift/context.go | 24 - .../thrift/lib/go/thrift/debug_protocol.go | 447 --- .../thrift/lib/go/thrift/deserializer.go | 121 - .../thrift/lib/go/thrift/exception.go | 116 - .../thrift/lib/go/thrift/framed_transport.go | 223 -- .../thrift/lib/go/thrift/header_context.go | 110 - .../thrift/lib/go/thrift/header_protocol.go | 351 -- .../thrift/lib/go/thrift/header_transport.go | 809 ----- .../thrift/lib/go/thrift/http_client.go | 257 -- .../thrift/lib/go/thrift/http_transport.go | 74 - .../lib/go/thrift/iostream_transport.go | 222 -- .../thrift/lib/go/thrift/json_protocol.go | 591 ---- .../thrift/lib/go/thrift/logger.go | 69 - .../thrift/lib/go/thrift/memory_buffer.go | 80 - .../thrift/lib/go/thrift/messagetype.go | 31 - .../thrift/lib/go/thrift/middleware.go | 109 - .../lib/go/thrift/multiplexed_protocol.go | 235 -- .../thrift/lib/go/thrift/numeric.go | 164 - .../thrift/lib/go/thrift/pointerize.go | 52 - .../thrift/lib/go/thrift/processor_factory.go | 80 - .../thrift/lib/go/thrift/protocol.go | 177 - .../lib/go/thrift/protocol_exception.go | 104 - .../thrift/lib/go/thrift/protocol_factory.go | 25 - .../thrift/lib/go/thrift/response_helper.go | 94 - .../thrift/lib/go/thrift/rich_transport.go | 71 - .../thrift/lib/go/thrift/serializer.go | 136 - .../thrift/lib/go/thrift/server.go | 35 - .../thrift/lib/go/thrift/server_socket.go | 137 - .../thrift/lib/go/thrift/server_transport.go | 34 - .../lib/go/thrift/simple_json_protocol.go | 1373 -------- .../thrift/lib/go/thrift/simple_server.go | 332 -- .../thrift/lib/go/thrift/socket.go | 238 -- .../thrift/lib/go/thrift/socket_conn.go | 102 - .../thrift/lib/go/thrift/socket_unix_conn.go | 83 - .../lib/go/thrift/socket_windows_conn.go | 34 - .../thrift/lib/go/thrift/ssl_server_socket.go | 112 - .../thrift/lib/go/thrift/ssl_socket.go | 258 -- .../thrift/lib/go/thrift/transport.go | 70 - .../lib/go/thrift/transport_exception.go | 131 - .../thrift/lib/go/thrift/transport_factory.go | 39 - .../third_party/thrift/lib/go/thrift/type.go | 69 - .../thrift/lib/go/thrift/zlib_transport.go | 137 - exporters/jaeger/jaeger.go | 360 -- exporters/jaeger/jaeger_benchmark_test.go | 115 - exporters/jaeger/jaeger_test.go | 723 ---- exporters/jaeger/reconnecting_udp_client.go | 204 -- .../jaeger/reconnecting_udp_client_test.go | 501 --- exporters/jaeger/uploader.go | 339 -- versions.yaml | 2 - 97 files changed, 5 insertions(+), 21566 deletions(-) delete mode 100644 example/jaeger/go.mod delete mode 100644 example/jaeger/go.sum delete mode 100644 example/jaeger/main.go delete mode 100644 exporters/jaeger/README.md delete mode 100644 exporters/jaeger/agent.go delete mode 100644 exporters/jaeger/agent_test.go delete mode 100644 exporters/jaeger/assertsocketbuffersize_test.go delete mode 100644 exporters/jaeger/assertsocketbuffersize_windows_test.go delete mode 100644 exporters/jaeger/doc.go delete mode 100644 exporters/jaeger/env.go delete mode 100644 exporters/jaeger/env_test.go delete mode 100644 exporters/jaeger/go.mod delete mode 100644 exporters/jaeger/go.sum delete mode 100644 exporters/jaeger/internal/gen-go/agent/GoUnusedProtection__.go delete mode 100644 exporters/jaeger/internal/gen-go/agent/agent-consts.go delete mode 100755 exporters/jaeger/internal/gen-go/agent/agent-remote/agent-remote.go delete mode 100644 exporters/jaeger/internal/gen-go/agent/agent.go delete mode 100644 exporters/jaeger/internal/gen-go/jaeger/GoUnusedProtection__.go delete mode 100755 exporters/jaeger/internal/gen-go/jaeger/collector-remote/collector-remote.go delete mode 100644 exporters/jaeger/internal/gen-go/jaeger/jaeger-consts.go delete mode 100644 exporters/jaeger/internal/gen-go/jaeger/jaeger.go delete mode 100644 exporters/jaeger/internal/gen-go/zipkincore/GoUnusedProtection__.go delete mode 100755 exporters/jaeger/internal/gen-go/zipkincore/zipkin_collector-remote/zipkin_collector-remote.go delete mode 100644 exporters/jaeger/internal/gen-go/zipkincore/zipkincore-consts.go delete mode 100644 exporters/jaeger/internal/gen-go/zipkincore/zipkincore.go delete mode 100644 exporters/jaeger/internal/gen.go delete mode 100644 exporters/jaeger/internal/internaltest/alignment.go delete mode 100644 exporters/jaeger/internal/internaltest/env.go delete mode 100644 exporters/jaeger/internal/internaltest/env_test.go delete mode 100644 exporters/jaeger/internal/internaltest/errors.go delete mode 100644 exporters/jaeger/internal/internaltest/harness.go delete mode 100644 exporters/jaeger/internal/internaltest/text_map_carrier.go delete mode 100644 exporters/jaeger/internal/internaltest/text_map_carrier_test.go delete mode 100644 exporters/jaeger/internal/internaltest/text_map_propagator.go delete mode 100644 exporters/jaeger/internal/internaltest/text_map_propagator_test.go delete mode 100644 exporters/jaeger/internal/matchers/expectation.go delete mode 100644 exporters/jaeger/internal/matchers/expecter.go delete mode 100644 exporters/jaeger/internal/matchers/temporal_matcher.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/LICENSE delete mode 100644 exporters/jaeger/internal/third_party/thrift/NOTICE delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/application_exception.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/binary_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/buffered_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/client.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/compact_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/configuration.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/context.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/debug_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/deserializer.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/framed_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_context.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/iostream_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/json_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/logger.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/memory_buffer.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/messagetype.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/middleware.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/numeric.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/pointerize.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/processor_factory.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_exception.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_factory.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/response_helper.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/rich_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/serializer.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_socket.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_json_protocol.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_server.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_conn.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_windows_conn.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_server_socket.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_socket.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_exception.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_factory.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go delete mode 100644 exporters/jaeger/internal/third_party/thrift/lib/go/thrift/zlib_transport.go delete mode 100644 exporters/jaeger/jaeger.go delete mode 100644 exporters/jaeger/jaeger_benchmark_test.go delete mode 100644 exporters/jaeger/jaeger_test.go delete mode 100644 exporters/jaeger/reconnecting_udp_client.go delete mode 100644 exporters/jaeger/reconnecting_udp_client_test.go delete mode 100644 exporters/jaeger/uploader.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 08b13a0543f..81e039fdf5d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -73,15 +73,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /example/jaeger - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /example/namedtracer labels: @@ -145,15 +136,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /exporters/jaeger - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /exporters/otlp/internal/retry labels: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aa5c8051f9..9be5068fd0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- Remove the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) +- Remove the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) + ## [1.17.0/0.40.0/0.0.5] 2023-08-28 ### Added diff --git a/example/jaeger/go.mod b/example/jaeger/go.mod deleted file mode 100644 index 847ddfeaff3..00000000000 --- a/example/jaeger/go.mod +++ /dev/null @@ -1,33 +0,0 @@ -// Deprecated: This example is no longer supported as -// [go.opentelemetry.io/otel/exporters/jaeger] is no longer supported. -// OpenTelemetry dropped support for Jaeger exporter in July 2023. -// Jaeger officially accepts and recommends using OTLP. -// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] -// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. -module go.opentelemetry.io/otel/example/jaeger - -go 1.19 - -replace ( - go.opentelemetry.io/otel => ../.. - go.opentelemetry.io/otel/exporters/jaeger => ../../exporters/jaeger - go.opentelemetry.io/otel/sdk => ../../sdk -) - -require ( - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/jaeger v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 -) - -require ( - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect -) - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/jaeger/go.sum b/example/jaeger/go.sum deleted file mode 100644 index 8089b278d80..00000000000 --- a/example/jaeger/go.sum +++ /dev/null @@ -1,13 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/jaeger/main.go b/example/jaeger/main.go deleted file mode 100644 index d4f41f5f316..00000000000 --- a/example/jaeger/main.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Command jaeger is an example program that creates spans -// and uploads to Jaeger. -// -// Deprecated: This example is no longer supported as -// [go.opentelemetry.io/otel/exporters/jaeger] is no longer supported. -// OpenTelemetry dropped support for Jaeger exporter in July 2023. -// Jaeger officially accepts and recommends using OTLP. -// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] -// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. -package main - -import ( - "context" - "log" - "time" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/jaeger" //nolint:staticcheck // This is deprecated and will be removed in the next release. - "go.opentelemetry.io/otel/sdk/resource" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" -) - -const ( - service = "trace-demo" - environment = "production" - id = 1 -) - -// tracerProvider returns an OpenTelemetry TracerProvider configured to use -// the Jaeger exporter that will send spans to the provided url. The returned -// TracerProvider will also use a Resource configured with all the information -// about the application. -func tracerProvider(url string) (*tracesdk.TracerProvider, error) { - // Create the Jaeger exporter - exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url))) - if err != nil { - return nil, err - } - tp := tracesdk.NewTracerProvider( - // Always be sure to batch in production. - tracesdk.WithBatcher(exp), - // Record information about this application in a Resource. - tracesdk.WithResource(resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName(service), - attribute.String("environment", environment), - attribute.Int64("ID", id), - )), - ) - return tp, nil -} - -func main() { - tp, err := tracerProvider("http://localhost:14268/api/traces") - if err != nil { - log.Fatal(err) - } - - // Register our TracerProvider as the global so any imported - // instrumentation in the future will default to using it. - otel.SetTracerProvider(tp) - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - // Cleanly shutdown and flush telemetry when the application exits. - defer func(ctx context.Context) { - // Do not make the application hang when it is shutdown. - ctx, cancel = context.WithTimeout(ctx, time.Second*5) - defer cancel() - if err := tp.Shutdown(ctx); err != nil { - log.Fatal(err) - } - }(ctx) - - tr := tp.Tracer("component-main") - - ctx, span := tr.Start(ctx, "foo") - defer span.End() - - bar(ctx) -} - -func bar(ctx context.Context) { - // Use the global TracerProvider. - tr := otel.Tracer("component-bar") - _, span := tr.Start(ctx, "bar") - span.SetAttributes(attribute.Key("testset").String("value")) - defer span.End() - - // Do bar... -} diff --git a/exporters/jaeger/README.md b/exporters/jaeger/README.md deleted file mode 100644 index 439bf79a90f..00000000000 --- a/exporters/jaeger/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# OpenTelemetry-Go Jaeger Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/jaeger.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger) - -> **Deprecated:** This module is no longer supported. -> OpenTelemetry dropped support for Jaeger exporter in July 2023. -> Jaeger officially accepts and recommends using OTLP. -> Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) -> or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) instead. - -[OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) implementation. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/jaeger -``` - -## Example - -See [../../example/jaeger](../../example/jaeger). - -## Configuration - -The exporter can be used to send spans to: - -- Jaeger agent using `jaeger.thrift` over compact thrift protocol via - [`WithAgentEndpoint`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithAgentEndpoint) option. -- Jaeger collector using `jaeger.thrift` over HTTP via - [`WithCollectorEndpoint`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithCollectorEndpoint) option. - -### Environment Variables - -The following environment variables can be used -(instead of options objects) to override the default configuration. - -| Environment variable | Option | Default value | -| --------------------------------- | --------------------------------------------------------------------------------------------- | ----------------------------------- | -| `OTEL_EXPORTER_JAEGER_AGENT_HOST` | [`WithAgentHost`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithAgentHost) | `localhost` | -| `OTEL_EXPORTER_JAEGER_AGENT_PORT` | [`WithAgentPort`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithAgentPort) | `6831` | -| `OTEL_EXPORTER_JAEGER_ENDPOINT` | [`WithEndpoint`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithEndpoint) | `http://localhost:14268/api/traces` | -| `OTEL_EXPORTER_JAEGER_USER` | [`WithUsername`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithUsername) | | -| `OTEL_EXPORTER_JAEGER_PASSWORD` | [`WithPassword`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger#WithPassword) | | - -Configuration using options have precedence over the environment variables. - -## Contributing - -This exporter uses a vendored copy of the Apache Thrift library (v0.14.1) at a custom import path. -When re-generating Thrift code in the future, please adapt import paths as necessary. - -## References - -- [Jaeger](https://www.jaegertracing.io/) -- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) -- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/sdk-environment-variables.md#jaeger-exporter) diff --git a/exporters/jaeger/agent.go b/exporters/jaeger/agent.go deleted file mode 100644 index a050020bb47..00000000000 --- a/exporters/jaeger/agent.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" - -import ( - "context" - "fmt" - "io" - "net" - "strings" - "time" - - "github.com/go-logr/logr" - - genAgent "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/agent" - gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -const ( - // udpPacketMaxLength is the max size of UDP packet we want to send, synced with jaeger-agent. - udpPacketMaxLength = 65000 - // emitBatchOverhead is the additional overhead bytes used for enveloping the datagram, - // synced with jaeger-agent https://github.com/jaegertracing/jaeger-client-go/blob/master/transport_udp.go#L37 - emitBatchOverhead = 70 -) - -// agentClientUDP is a UDP client to Jaeger agent that implements gen.Agent interface. -type agentClientUDP struct { - genAgent.Agent - io.Closer - - connUDP udpConn - client *genAgent.AgentClient - maxPacketSize int // max size of datagram in bytes - thriftBuffer *thrift.TMemoryBuffer // buffer used to calculate byte size of a span - thriftProtocol thrift.TProtocol -} - -type udpConn interface { - Write([]byte) (int, error) - SetWriteBuffer(int) error - Close() error -} - -type agentClientUDPParams struct { - Host string - Port string - MaxPacketSize int - Logger logr.Logger - AttemptReconnecting bool - AttemptReconnectInterval time.Duration -} - -// newAgentClientUDP creates a client that sends spans to Jaeger Agent over UDP. -func newAgentClientUDP(params agentClientUDPParams) (*agentClientUDP, error) { - hostPort := net.JoinHostPort(params.Host, params.Port) - // validate hostport - if _, _, err := net.SplitHostPort(hostPort); err != nil { - return nil, err - } - - if params.MaxPacketSize <= 0 || params.MaxPacketSize > udpPacketMaxLength { - params.MaxPacketSize = udpPacketMaxLength - } - - if params.AttemptReconnecting && params.AttemptReconnectInterval <= 0 { - params.AttemptReconnectInterval = time.Second * 30 - } - - thriftBuffer := thrift.NewTMemoryBufferLen(params.MaxPacketSize) - protocolFactory := thrift.NewTCompactProtocolFactoryConf(&thrift.TConfiguration{}) - thriftProtocol := protocolFactory.GetProtocol(thriftBuffer) - client := genAgent.NewAgentClientFactory(thriftBuffer, protocolFactory) - - var connUDP udpConn - var err error - - if params.AttemptReconnecting { - // host is hostname, setup resolver loop in case host record changes during operation - connUDP, err = newReconnectingUDPConn(hostPort, params.MaxPacketSize, params.AttemptReconnectInterval, net.ResolveUDPAddr, net.DialUDP, params.Logger) - if err != nil { - return nil, err - } - } else { - destAddr, err := net.ResolveUDPAddr("udp", hostPort) - if err != nil { - return nil, err - } - - connUDP, err = net.DialUDP(destAddr.Network(), nil, destAddr) - if err != nil { - return nil, err - } - } - - if err := connUDP.SetWriteBuffer(params.MaxPacketSize); err != nil { - return nil, err - } - - return &agentClientUDP{ - connUDP: connUDP, - client: client, - maxPacketSize: params.MaxPacketSize, - thriftBuffer: thriftBuffer, - thriftProtocol: thriftProtocol, - }, nil -} - -// EmitBatch buffers batch to fit into UDP packets and sends the data to the agent. -func (a *agentClientUDP) EmitBatch(ctx context.Context, batch *gen.Batch) error { - var errs []error - processSize, err := a.calcSizeOfSerializedThrift(ctx, batch.Process) - if err != nil { - // drop the batch if serialization of process fails. - return err - } - - maxPacketSize := a.maxPacketSize - if maxPacketSize > udpPacketMaxLength-emitBatchOverhead { - maxPacketSize = udpPacketMaxLength - emitBatchOverhead - } - totalSize := processSize - var spans []*gen.Span - for _, span := range batch.Spans { - spanSize, err := a.calcSizeOfSerializedThrift(ctx, span) - if err != nil { - errs = append(errs, fmt.Errorf("thrift serialization failed: %v", span)) - continue - } - if spanSize+processSize >= maxPacketSize { - // drop the span that exceeds the limit. - errs = append(errs, fmt.Errorf("span too large to send: %v", span)) - continue - } - if totalSize+spanSize >= maxPacketSize { - if err := a.flush(ctx, &gen.Batch{ - Process: batch.Process, - Spans: spans, - }); err != nil { - errs = append(errs, err) - } - spans = spans[:0] - totalSize = processSize - } - totalSize += spanSize - spans = append(spans, span) - } - - if len(spans) > 0 { - if err := a.flush(ctx, &gen.Batch{ - Process: batch.Process, - Spans: spans, - }); err != nil { - errs = append(errs, err) - } - } - - if len(errs) == 1 { - return errs[0] - } else if len(errs) > 1 { - joined := a.makeJoinedErrorString(errs) - return fmt.Errorf("multiple errors during transform: %s", joined) - } - return nil -} - -// makeJoinedErrorString join all the errors to one error message. -func (a *agentClientUDP) makeJoinedErrorString(errs []error) string { - var errMsgs []string - for _, err := range errs { - errMsgs = append(errMsgs, err.Error()) - } - return strings.Join(errMsgs, ", ") -} - -// flush will send the batch of spans to the agent. -func (a *agentClientUDP) flush(ctx context.Context, batch *gen.Batch) error { - a.thriftBuffer.Reset() - if err := a.client.EmitBatch(ctx, batch); err != nil { - return err - } - if a.thriftBuffer.Len() > a.maxPacketSize { - return fmt.Errorf("data does not fit within one UDP packet; size %d, max %d, spans %d", - a.thriftBuffer.Len(), a.maxPacketSize, len(batch.Spans)) - } - _, err := a.connUDP.Write(a.thriftBuffer.Bytes()) - return err -} - -// calcSizeOfSerializedThrift calculate the serialized thrift packet size. -func (a *agentClientUDP) calcSizeOfSerializedThrift(ctx context.Context, thriftStruct thrift.TStruct) (int, error) { - a.thriftBuffer.Reset() - err := thriftStruct.Write(ctx, a.thriftProtocol) - return a.thriftBuffer.Len(), err -} - -// Close implements Close() of io.Closer and closes the underlying UDP connection. -func (a *agentClientUDP) Close() error { - return a.connUDP.Close() -} diff --git a/exporters/jaeger/agent_test.go b/exporters/jaeger/agent_test.go deleted file mode 100644 index 95070341722..00000000000 --- a/exporters/jaeger/agent_test.go +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger - -import ( - "context" - "net" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/sdk/trace/tracetest" -) - -func TestNewAgentClientUDPWithParamsBadHostport(t *testing.T) { - agentClient, err := newAgentClientUDP(agentClientUDPParams{ - Host: "blahblah", - Port: "", - }) - assert.Error(t, err) - assert.Nil(t, agentClient) -} - -func TestNewAgentClientUDPWithParams(t *testing.T) { - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - agentClient, err := newAgentClientUDP(agentClientUDPParams{ - Host: host, - Port: port, - MaxPacketSize: 25000, - AttemptReconnecting: true, - }) - assert.NoError(t, err) - assert.NotNil(t, agentClient) - assert.Equal(t, 25000, agentClient.maxPacketSize) - - if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { - assert.Equal(t, emptyLogger, agentClient.connUDP.(*reconnectingUDPConn).logger) - } - - assert.NoError(t, agentClient.Close()) -} - -func TestNewAgentClientUDPWithParamsDefaults(t *testing.T) { - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - agentClient, err := newAgentClientUDP(agentClientUDPParams{ - Host: host, - Port: port, - AttemptReconnecting: true, - }) - assert.NoError(t, err) - assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) - - if assert.IsType(t, &reconnectingUDPConn{}, agentClient.connUDP) { - assert.Equal(t, emptyLogger, agentClient.connUDP.(*reconnectingUDPConn).logger) - } - - assert.NoError(t, agentClient.Close()) -} - -func TestNewAgentClientUDPWithParamsReconnectingDisabled(t *testing.T) { - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - agentClient, err := newAgentClientUDP(agentClientUDPParams{ - Host: host, - Port: port, - Logger: emptyLogger, - AttemptReconnecting: false, - }) - assert.NoError(t, err) - assert.NotNil(t, agentClient) - assert.Equal(t, udpPacketMaxLength, agentClient.maxPacketSize) - - assert.IsType(t, &net.UDPConn{}, agentClient.connUDP) - - assert.NoError(t, agentClient.Close()) -} - -type errorHandler struct{ t *testing.T } - -func (eh errorHandler) Handle(err error) { assert.NoError(eh.t, err) } - -func TestJaegerAgentUDPLimitBatching(t *testing.T) { - otel.SetErrorHandler(errorHandler{t}) - - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - // 1500 spans, size 79559, does not fit within one UDP packet with the default size of 65000. - n := 1500 - s := make(tracetest.SpanStubs, n).Snapshots() - - exp, err := New( - WithAgentEndpoint(WithAgentHost(host), WithAgentPort(port)), - ) - require.NoError(t, err) - - ctx := context.Background() - assert.NoError(t, exp.ExportSpans(ctx, s)) - assert.NoError(t, exp.Shutdown(ctx)) -} - -// generateALargeSpan generates a span with a long name. -func generateALargeSpan() tracetest.SpanStub { - return tracetest.SpanStub{ - Name: "a-longer-name-that-makes-it-exceeds-limit", - } -} - -func TestSpanExceedsMaxPacketLimit(t *testing.T) { - otel.SetErrorHandler(errorHandler{t}) - - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - // 106 is the serialized size of a span with default values. - maxSize := 106 - - largeSpans := tracetest.SpanStubs{generateALargeSpan(), {}}.Snapshots() - normalSpans := tracetest.SpanStubs{{}, {}}.Snapshots() - - exp, err := New( - WithAgentEndpoint(WithAgentHost(host), WithAgentPort(port), WithMaxPacketSize(maxSize+1)), - ) - require.NoError(t, err) - - ctx := context.Background() - assert.Error(t, exp.ExportSpans(ctx, largeSpans)) - assert.NoError(t, exp.ExportSpans(ctx, normalSpans)) - assert.NoError(t, exp.Shutdown(ctx)) -} - -func TestEmitBatchWithMultipleErrors(t *testing.T) { - otel.SetErrorHandler(errorHandler{t}) - - mockServer, err := newUDPListener() - require.NoError(t, err) - defer mockServer.Close() - host, port, err := net.SplitHostPort(mockServer.LocalAddr().String()) - assert.NoError(t, err) - - span := generateALargeSpan() - largeSpans := tracetest.SpanStubs{span, span}.Snapshots() - // make max packet size smaller than span - maxSize := len(span.Name) - exp, err := New( - WithAgentEndpoint(WithAgentHost(host), WithAgentPort(port), WithMaxPacketSize(maxSize)), - ) - require.NoError(t, err) - - ctx := context.Background() - err = exp.ExportSpans(ctx, largeSpans) - assert.Error(t, err) - require.Contains(t, err.Error(), "multiple errors") -} diff --git a/exporters/jaeger/assertsocketbuffersize_test.go b/exporters/jaeger/assertsocketbuffersize_test.go deleted file mode 100644 index 8d21f6550df..00000000000 --- a/exporters/jaeger/assertsocketbuffersize_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build !windows -// +build !windows - -package jaeger - -import ( - "net" - "runtime" - "syscall" - "testing" - - "github.com/stretchr/testify/assert" -) - -func assertSockBufferSize(t *testing.T, expectedBytes int, conn *net.UDPConn) bool { - fd, err := conn.File() - if !assert.NoError(t, err) { - return false - } - - bufferBytes, err := syscall.GetsockoptInt(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_SNDBUF) - if !assert.NoError(t, err) { - return false - } - - // The linux kernel doubles SO_SNDBUF value (to allow space for - // bookkeeping overhead) when it is set using setsockopt(2), and this - // doubled value is returned by getsockopt(2) - // https://linux.die.net/man/7/socket - if runtime.GOOS == "linux" { - return assert.GreaterOrEqual(t, expectedBytes*2, bufferBytes) - } - - return assert.Equal(t, expectedBytes, bufferBytes) -} diff --git a/exporters/jaeger/assertsocketbuffersize_windows_test.go b/exporters/jaeger/assertsocketbuffersize_windows_test.go deleted file mode 100644 index 9fba4ba4d34..00000000000 --- a/exporters/jaeger/assertsocketbuffersize_windows_test.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +build windows - -package jaeger - -import ( - "net" - "testing" -) - -func assertSockBufferSize(t *testing.T, expectedBytes int, conn *net.UDPConn) bool { - // The Windows implementation of the net.UDPConn does not implement the - // functionality to return a file handle, instead a "not supported" error - // is returned: - // - // https://github.com/golang/go/blob/6cc8aa7ece96aca282db19f08aa5c98ed13695d9/src/net/fd_windows.go#L175-L178 - // - // This means we are not able to pass the connection to a syscall and - // determine the buffer size. - return true -} diff --git a/exporters/jaeger/doc.go b/exporters/jaeger/doc.go deleted file mode 100644 index a7359654110..00000000000 --- a/exporters/jaeger/doc.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package jaeger contains an OpenTelemetry tracing exporter for Jaeger. -// -// Deprecated: This module is no longer supported. -// OpenTelemetry dropped support for Jaeger exporter in July 2023. -// Jaeger officially accepts and recommends using OTLP. -// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] -// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" diff --git a/exporters/jaeger/env.go b/exporters/jaeger/env.go deleted file mode 100644 index 460fb5e1352..00000000000 --- a/exporters/jaeger/env.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" - -import ( - "os" -) - -// Environment variable names. -const ( - // Hostname for the Jaeger agent, part of address where exporter sends spans - // i.e. "localhost". - envAgentHost = "OTEL_EXPORTER_JAEGER_AGENT_HOST" - // Port for the Jaeger agent, part of address where exporter sends spans - // i.e. 6831. - envAgentPort = "OTEL_EXPORTER_JAEGER_AGENT_PORT" - // The HTTP endpoint for sending spans directly to a collector, - // i.e. http://jaeger-collector:14268/api/traces. - envEndpoint = "OTEL_EXPORTER_JAEGER_ENDPOINT" - // Username to send as part of "Basic" authentication to the collector endpoint. - envUser = "OTEL_EXPORTER_JAEGER_USER" - // Password to send as part of "Basic" authentication to the collector endpoint. - envPassword = "OTEL_EXPORTER_JAEGER_PASSWORD" -) - -// envOr returns an env variable's value if it is exists or the default if not. -func envOr(key, defaultValue string) string { - if v := os.Getenv(key); v != "" { - return v - } - return defaultValue -} diff --git a/exporters/jaeger/env_test.go b/exporters/jaeger/env_test.go deleted file mode 100644 index f9219d28b84..00000000000 --- a/exporters/jaeger/env_test.go +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - ottest "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" -) - -func TestNewRawExporterWithDefault(t *testing.T) { - const ( - collectorEndpoint = "http://localhost:14268/api/traces" - username = "" - password = "" - ) - - // Create Jaeger Exporter with default values - exp, err := New( - WithCollectorEndpoint(), - ) - - assert.NoError(t, err) - - require.IsType(t, &collectorUploader{}, exp.uploader) - uploader := exp.uploader.(*collectorUploader) - assert.Equal(t, collectorEndpoint, uploader.endpoint) - assert.Equal(t, username, uploader.username) - assert.Equal(t, password, uploader.password) -} - -func TestNewRawExporterWithEnv(t *testing.T) { - const ( - collectorEndpoint = "http://localhost" - username = "user" - password = "password" - ) - - envStore, err := ottest.SetEnvVariables(map[string]string{ - envEndpoint: collectorEndpoint, - envUser: username, - envPassword: password, - }) - require.NoError(t, err) - defer func() { - require.NoError(t, envStore.Restore()) - }() - - // Create Jaeger Exporter with environment variables - exp, err := New( - WithCollectorEndpoint(), - ) - - assert.NoError(t, err) - - require.IsType(t, &collectorUploader{}, exp.uploader) - uploader := exp.uploader.(*collectorUploader) - assert.Equal(t, collectorEndpoint, uploader.endpoint) - assert.Equal(t, username, uploader.username) - assert.Equal(t, password, uploader.password) -} - -func TestNewRawExporterWithPassedOption(t *testing.T) { - const ( - collectorEndpoint = "http://localhost" - username = "user" - password = "password" - optionEndpoint = "should not be overwritten" - ) - - envStore, err := ottest.SetEnvVariables(map[string]string{ - envEndpoint: collectorEndpoint, - envUser: username, - envPassword: password, - }) - require.NoError(t, err) - defer func() { - require.NoError(t, envStore.Restore()) - }() - - // Create Jaeger Exporter with passed endpoint option, should be used over envEndpoint - exp, err := New( - WithCollectorEndpoint(WithEndpoint(optionEndpoint)), - ) - - assert.NoError(t, err) - - require.IsType(t, &collectorUploader{}, exp.uploader) - uploader := exp.uploader.(*collectorUploader) - assert.Equal(t, optionEndpoint, uploader.endpoint) - assert.Equal(t, username, uploader.username) - assert.Equal(t, password, uploader.password) -} - -func TestEnvOrWithAgentHostPortFromEnv(t *testing.T) { - testCases := []struct { - name string - envAgentHost string - envAgentPort string - defaultHost string - defaultPort string - expectedHost string - expectedPort string - }{ - { - name: "overrides default host/port values via environment variables", - envAgentHost: "localhost", - envAgentPort: "6832", - defaultHost: "hostNameToBeReplaced", - defaultPort: "8203", - expectedHost: "localhost", - expectedPort: "6832", - }, - { - name: "envAgentHost is empty, will not overwrite default host value", - envAgentHost: "", - envAgentPort: "6832", - defaultHost: "hostNameNotToBeReplaced", - defaultPort: "8203", - expectedHost: "hostNameNotToBeReplaced", - expectedPort: "6832", - }, - { - name: "envAgentPort is empty, will not overwrite default port value", - envAgentHost: "localhost", - envAgentPort: "", - defaultHost: "hostNameToBeReplaced", - defaultPort: "8203", - expectedHost: "localhost", - expectedPort: "8203", - }, - { - name: "envAgentHost and envAgentPort are empty, will not overwrite default host/port values", - envAgentHost: "", - envAgentPort: "", - defaultHost: "hostNameNotToBeReplaced", - defaultPort: "8203", - expectedHost: "hostNameNotToBeReplaced", - expectedPort: "8203", - }, - } - - envStore := ottest.NewEnvStore() - envStore.Record(envAgentHost) - envStore.Record(envAgentPort) - defer func() { - require.NoError(t, envStore.Restore()) - }() - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - require.NoError(t, os.Setenv(envAgentHost, tc.envAgentHost)) - require.NoError(t, os.Setenv(envAgentPort, tc.envAgentPort)) - host := envOr(envAgentHost, tc.defaultHost) - port := envOr(envAgentPort, tc.defaultPort) - assert.Equal(t, tc.expectedHost, host) - assert.Equal(t, tc.expectedPort, port) - }) - } -} - -func TestEnvOrWithCollectorEndpointOptionsFromEnv(t *testing.T) { - testCases := []struct { - name string - envEndpoint string - envUsername string - envPassword string - defaultCollectorEndpointOptions collectorEndpointConfig - expectedCollectorEndpointOptions collectorEndpointConfig - }{ - { - name: "overrides value via environment variables", - envEndpoint: "http://localhost:14252", - envUsername: "username", - envPassword: "password", - defaultCollectorEndpointOptions: collectorEndpointConfig{ - endpoint: "endpoint not to be used", - username: "foo", - password: "bar", - }, - expectedCollectorEndpointOptions: collectorEndpointConfig{ - endpoint: "http://localhost:14252", - username: "username", - password: "password", - }, - }, - { - name: "environment variables is empty, will not overwrite value", - envEndpoint: "", - envUsername: "", - envPassword: "", - defaultCollectorEndpointOptions: collectorEndpointConfig{ - endpoint: "endpoint to be used", - username: "foo", - password: "bar", - }, - expectedCollectorEndpointOptions: collectorEndpointConfig{ - endpoint: "endpoint to be used", - username: "foo", - password: "bar", - }, - }, - } - - envStore := ottest.NewEnvStore() - envStore.Record(envEndpoint) - envStore.Record(envUser) - envStore.Record(envPassword) - defer func() { - require.NoError(t, envStore.Restore()) - }() - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - require.NoError(t, os.Setenv(envEndpoint, tc.envEndpoint)) - require.NoError(t, os.Setenv(envUser, tc.envUsername)) - require.NoError(t, os.Setenv(envPassword, tc.envPassword)) - - endpoint := envOr(envEndpoint, tc.defaultCollectorEndpointOptions.endpoint) - username := envOr(envUser, tc.defaultCollectorEndpointOptions.username) - password := envOr(envPassword, tc.defaultCollectorEndpointOptions.password) - - assert.Equal(t, tc.expectedCollectorEndpointOptions.endpoint, endpoint) - assert.Equal(t, tc.expectedCollectorEndpointOptions.username, username) - assert.Equal(t, tc.expectedCollectorEndpointOptions.password, password) - }) - } -} diff --git a/exporters/jaeger/go.mod b/exporters/jaeger/go.mod deleted file mode 100644 index 1a06d5d85cd..00000000000 --- a/exporters/jaeger/go.mod +++ /dev/null @@ -1,35 +0,0 @@ -// Deprecated: This module is no longer supported. -// OpenTelemetry dropped support for Jaeger exporter in July 2023. -// Jaeger officially accepts and recommends using OTLP. -// Use [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp] -// or [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc] instead. -module go.opentelemetry.io/otel/exporters/jaeger - -go 1.19 - -require ( - github.com/go-logr/logr v1.2.4 - github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/objx v0.5.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/exporters/jaeger/go.sum b/exporters/jaeger/go.sum deleted file mode 100644 index e874ee50e97..00000000000 --- a/exporters/jaeger/go.sum +++ /dev/null @@ -1,27 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/jaeger/internal/gen-go/agent/GoUnusedProtection__.go b/exporters/jaeger/internal/gen-go/agent/GoUnusedProtection__.go deleted file mode 100644 index 54cd3b0867a..00000000000 --- a/exporters/jaeger/internal/gen-go/agent/GoUnusedProtection__.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package agent - -var GoUnusedProtection__ int; - diff --git a/exporters/jaeger/internal/gen-go/agent/agent-consts.go b/exporters/jaeger/internal/gen-go/agent/agent-consts.go deleted file mode 100644 index 3b96e3222ee..00000000000 --- a/exporters/jaeger/internal/gen-go/agent/agent-consts.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package agent - -import ( - "bytes" - "context" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/zipkincore" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -var _ = jaeger.GoUnusedProtection__ -var _ = zipkincore.GoUnusedProtection__ - -func init() { -} diff --git a/exporters/jaeger/internal/gen-go/agent/agent-remote/agent-remote.go b/exporters/jaeger/internal/gen-go/agent/agent-remote/agent-remote.go deleted file mode 100755 index 9ec0d40a865..00000000000 --- a/exporters/jaeger/internal/gen-go/agent/agent-remote/agent-remote.go +++ /dev/null @@ -1,210 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package main - -import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/agent" - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/zipkincore" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -var _ = jaeger.GoUnusedProtection__ -var _ = zipkincore.GoUnusedProtection__ -var _ = agent.GoUnusedProtection__ - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " void emitZipkinBatch( spans)") - fmt.Fprintln(os.Stderr, " void emitBatch(Batch batch)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -type httpHeaders map[string]string - -func (h httpHeaders) String() string { - var m map[string]string = h - return fmt.Sprintf("%s", m) -} - -func (h httpHeaders) Set(value string) error { - parts := strings.Split(value, ": ") - if len(parts) != 2 { - return fmt.Errorf("header should be of format 'Key: Value'") - } - h[parts[0]] = parts[1] - return nil -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - headers := make(httpHeaders) - var parsedUrl *url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")") - flag.Parse() - - if len(urlString) > 0 { - var err error - parsedUrl, err = url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - if len(headers) > 0 { - httptrans := trans.(*thrift.THttpClient) - for key, value := range headers { - httptrans.SetHeader(key, value) - } - } - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - iprot := protocolFactory.GetProtocol(trans) - oprot := protocolFactory.GetProtocol(trans) - client := agent.NewAgentClient(thrift.NewTStandardClient(iprot, oprot)) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "emitZipkinBatch": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "EmitZipkinBatch requires 1 args") - flag.Usage() - } - arg5 := flag.Arg(1) - mbTrans6 := thrift.NewTMemoryBufferLen(len(arg5)) - defer mbTrans6.Close() - _, err7 := mbTrans6.WriteString(arg5) - if err7 != nil { - Usage() - return - } - factory8 := thrift.NewTJSONProtocolFactory() - jsProt9 := factory8.GetProtocol(mbTrans6) - containerStruct0 := agent.NewAgentEmitZipkinBatchArgs() - err10 := containerStruct0.ReadField1(context.Background(), jsProt9) - if err10 != nil { - Usage() - return - } - argvalue0 := containerStruct0.Spans - value0 := argvalue0 - fmt.Print(client.EmitZipkinBatch(context.Background(), value0)) - fmt.Print("\n") - break - case "emitBatch": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "EmitBatch requires 1 args") - flag.Usage() - } - arg11 := flag.Arg(1) - mbTrans12 := thrift.NewTMemoryBufferLen(len(arg11)) - defer mbTrans12.Close() - _, err13 := mbTrans12.WriteString(arg11) - if err13 != nil { - Usage() - return - } - factory14 := thrift.NewTJSONProtocolFactory() - jsProt15 := factory14.GetProtocol(mbTrans12) - argvalue0 := jaeger.NewBatch() - err16 := argvalue0.Read(context.Background(), jsProt15) - if err16 != nil { - Usage() - return - } - value0 := argvalue0 - fmt.Print(client.EmitBatch(context.Background(), value0)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/exporters/jaeger/internal/gen-go/agent/agent.go b/exporters/jaeger/internal/gen-go/agent/agent.go deleted file mode 100644 index c7c8e9ca3e6..00000000000 --- a/exporters/jaeger/internal/gen-go/agent/agent.go +++ /dev/null @@ -1,412 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package agent - -import ( - "bytes" - "context" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/zipkincore" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -var _ = jaeger.GoUnusedProtection__ -var _ = zipkincore.GoUnusedProtection__ - -type Agent interface { - // Parameters: - // - Spans - EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error) - // Parameters: - // - Batch - EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error) -} - -type AgentClient struct { - c thrift.TClient - meta thrift.ResponseMeta -} - -func NewAgentClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AgentClient { - return &AgentClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} - -func NewAgentClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AgentClient { - return &AgentClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} - -func NewAgentClient(c thrift.TClient) *AgentClient { - return &AgentClient{ - c: c, - } -} - -func (p *AgentClient) Client_() thrift.TClient { - return p.c -} - -func (p *AgentClient) LastResponseMeta_() thrift.ResponseMeta { - return p.meta -} - -func (p *AgentClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { - p.meta = meta -} - -// Parameters: -// - Spans -func (p *AgentClient) EmitZipkinBatch(ctx context.Context, spans []*zipkincore.Span) (_err error) { - var _args0 AgentEmitZipkinBatchArgs - _args0.Spans = spans - p.SetLastResponseMeta_(thrift.ResponseMeta{}) - if _, err := p.Client_().Call(ctx, "emitZipkinBatch", &_args0, nil); err != nil { - return err - } - return nil -} - -// Parameters: -// - Batch -func (p *AgentClient) EmitBatch(ctx context.Context, batch *jaeger.Batch) (_err error) { - var _args1 AgentEmitBatchArgs - _args1.Batch = batch - p.SetLastResponseMeta_(thrift.ResponseMeta{}) - if _, err := p.Client_().Call(ctx, "emitBatch", &_args1, nil); err != nil { - return err - } - return nil -} - -type AgentProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler Agent -} - -func (p *AgentProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *AgentProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *AgentProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewAgentProcessor(handler Agent) *AgentProcessor { - - self2 := &AgentProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self2.processorMap["emitZipkinBatch"] = &agentProcessorEmitZipkinBatch{handler: handler} - self2.processorMap["emitBatch"] = &agentProcessorEmitBatch{handler: handler} - return self2 -} - -func (p *AgentProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) - if err2 != nil { - return false, thrift.WrapTException(err2) - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) - } - iprot.Skip(ctx, thrift.STRUCT) - iprot.ReadMessageEnd(ctx) - x3 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) - x3.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, x3 - -} - -type agentProcessorEmitZipkinBatch struct { - handler Agent -} - -func (p *agentProcessorEmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := AgentEmitZipkinBatchArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - return false, thrift.WrapTException(err2) - } - iprot.ReadMessageEnd(ctx) - - tickerCancel := func() {} - _ = tickerCancel - - if err2 = p.handler.EmitZipkinBatch(ctx, args.Spans); err2 != nil { - tickerCancel() - return true, thrift.WrapTException(err2) - } - tickerCancel() - return true, nil -} - -type agentProcessorEmitBatch struct { - handler Agent -} - -func (p *agentProcessorEmitBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := AgentEmitBatchArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - return false, thrift.WrapTException(err2) - } - iprot.ReadMessageEnd(ctx) - - tickerCancel := func() {} - _ = tickerCancel - - if err2 = p.handler.EmitBatch(ctx, args.Batch); err2 != nil { - tickerCancel() - return true, thrift.WrapTException(err2) - } - tickerCancel() - return true, nil -} - -// HELPER FUNCTIONS AND STRUCTURES - -// Attributes: -// - Spans -type AgentEmitZipkinBatchArgs struct { - Spans []*zipkincore.Span `thrift:"spans,1" db:"spans" json:"spans"` -} - -func NewAgentEmitZipkinBatchArgs() *AgentEmitZipkinBatchArgs { - return &AgentEmitZipkinBatchArgs{} -} - -func (p *AgentEmitZipkinBatchArgs) GetSpans() []*zipkincore.Span { - return p.Spans -} -func (p *AgentEmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.LIST { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *AgentEmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*zipkincore.Span, 0, size) - p.Spans = tSlice - for i := 0; i < size; i++ { - _elem4 := &zipkincore.Span{} - if err := _elem4.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) - } - p.Spans = append(p.Spans, _elem4) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *AgentEmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "emitZipkinBatch_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *AgentEmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Spans { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) - } - return err -} - -func (p *AgentEmitZipkinBatchArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("AgentEmitZipkinBatchArgs(%+v)", *p) -} - -// Attributes: -// - Batch -type AgentEmitBatchArgs struct { - Batch *jaeger.Batch `thrift:"batch,1" db:"batch" json:"batch"` -} - -func NewAgentEmitBatchArgs() *AgentEmitBatchArgs { - return &AgentEmitBatchArgs{} -} - -var AgentEmitBatchArgs_Batch_DEFAULT *jaeger.Batch - -func (p *AgentEmitBatchArgs) GetBatch() *jaeger.Batch { - if !p.IsSetBatch() { - return AgentEmitBatchArgs_Batch_DEFAULT - } - return p.Batch -} -func (p *AgentEmitBatchArgs) IsSetBatch() bool { - return p.Batch != nil -} - -func (p *AgentEmitBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *AgentEmitBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Batch = &jaeger.Batch{} - if err := p.Batch.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Batch), err) - } - return nil -} - -func (p *AgentEmitBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "emitBatch_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *AgentEmitBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "batch", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batch: ", p), err) - } - if err := p.Batch.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Batch), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batch: ", p), err) - } - return err -} - -func (p *AgentEmitBatchArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("AgentEmitBatchArgs(%+v)", *p) -} diff --git a/exporters/jaeger/internal/gen-go/jaeger/GoUnusedProtection__.go b/exporters/jaeger/internal/gen-go/jaeger/GoUnusedProtection__.go deleted file mode 100644 index fe45a9f9ad2..00000000000 --- a/exporters/jaeger/internal/gen-go/jaeger/GoUnusedProtection__.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package jaeger - -var GoUnusedProtection__ int; - diff --git a/exporters/jaeger/internal/gen-go/jaeger/collector-remote/collector-remote.go b/exporters/jaeger/internal/gen-go/jaeger/collector-remote/collector-remote.go deleted file mode 100755 index cacf75d00f5..00000000000 --- a/exporters/jaeger/internal/gen-go/jaeger/collector-remote/collector-remote.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package main - -import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -var _ = jaeger.GoUnusedProtection__ - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " submitBatches( batches)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -type httpHeaders map[string]string - -func (h httpHeaders) String() string { - var m map[string]string = h - return fmt.Sprintf("%s", m) -} - -func (h httpHeaders) Set(value string) error { - parts := strings.Split(value, ": ") - if len(parts) != 2 { - return fmt.Errorf("header should be of format 'Key: Value'") - } - h[parts[0]] = parts[1] - return nil -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - headers := make(httpHeaders) - var parsedUrl *url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")") - flag.Parse() - - if len(urlString) > 0 { - var err error - parsedUrl, err = url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - if len(headers) > 0 { - httptrans := trans.(*thrift.THttpClient) - for key, value := range headers { - httptrans.SetHeader(key, value) - } - } - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - iprot := protocolFactory.GetProtocol(trans) - oprot := protocolFactory.GetProtocol(trans) - client := jaeger.NewCollectorClient(thrift.NewTStandardClient(iprot, oprot)) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "submitBatches": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "SubmitBatches requires 1 args") - flag.Usage() - } - arg19 := flag.Arg(1) - mbTrans20 := thrift.NewTMemoryBufferLen(len(arg19)) - defer mbTrans20.Close() - _, err21 := mbTrans20.WriteString(arg19) - if err21 != nil { - Usage() - return - } - factory22 := thrift.NewTJSONProtocolFactory() - jsProt23 := factory22.GetProtocol(mbTrans20) - containerStruct0 := jaeger.NewCollectorSubmitBatchesArgs() - err24 := containerStruct0.ReadField1(context.Background(), jsProt23) - if err24 != nil { - Usage() - return - } - argvalue0 := containerStruct0.Batches - value0 := argvalue0 - fmt.Print(client.SubmitBatches(context.Background(), value0)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/exporters/jaeger/internal/gen-go/jaeger/jaeger-consts.go b/exporters/jaeger/internal/gen-go/jaeger/jaeger-consts.go deleted file mode 100644 index 10162857fbb..00000000000 --- a/exporters/jaeger/internal/gen-go/jaeger/jaeger-consts.go +++ /dev/null @@ -1,22 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package jaeger - -import ( - "bytes" - "context" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -func init() { -} diff --git a/exporters/jaeger/internal/gen-go/jaeger/jaeger.go b/exporters/jaeger/internal/gen-go/jaeger/jaeger.go deleted file mode 100644 index b1fe26c57d9..00000000000 --- a/exporters/jaeger/internal/gen-go/jaeger/jaeger.go +++ /dev/null @@ -1,3022 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package jaeger - -import ( - "bytes" - "context" - "database/sql/driver" - "errors" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -type TagType int64 - -const ( - TagType_STRING TagType = 0 - TagType_DOUBLE TagType = 1 - TagType_BOOL TagType = 2 - TagType_LONG TagType = 3 - TagType_BINARY TagType = 4 -) - -func (p TagType) String() string { - switch p { - case TagType_STRING: - return "STRING" - case TagType_DOUBLE: - return "DOUBLE" - case TagType_BOOL: - return "BOOL" - case TagType_LONG: - return "LONG" - case TagType_BINARY: - return "BINARY" - } - return "" -} - -func TagTypeFromString(s string) (TagType, error) { - switch s { - case "STRING": - return TagType_STRING, nil - case "DOUBLE": - return TagType_DOUBLE, nil - case "BOOL": - return TagType_BOOL, nil - case "LONG": - return TagType_LONG, nil - case "BINARY": - return TagType_BINARY, nil - } - return TagType(0), fmt.Errorf("not a valid TagType string") -} - -func TagTypePtr(v TagType) *TagType { return &v } - -func (p TagType) MarshalText() ([]byte, error) { - return []byte(p.String()), nil -} - -func (p *TagType) UnmarshalText(text []byte) error { - q, err := TagTypeFromString(string(text)) - if err != nil { - return err - } - *p = q - return nil -} - -func (p *TagType) Scan(value interface{}) error { - v, ok := value.(int64) - if !ok { - return errors.New("Scan value is not int64") - } - *p = TagType(v) - return nil -} - -func (p *TagType) Value() (driver.Value, error) { - if p == nil { - return nil, nil - } - return int64(*p), nil -} - -type SpanRefType int64 - -const ( - SpanRefType_CHILD_OF SpanRefType = 0 - SpanRefType_FOLLOWS_FROM SpanRefType = 1 -) - -func (p SpanRefType) String() string { - switch p { - case SpanRefType_CHILD_OF: - return "CHILD_OF" - case SpanRefType_FOLLOWS_FROM: - return "FOLLOWS_FROM" - } - return "" -} - -func SpanRefTypeFromString(s string) (SpanRefType, error) { - switch s { - case "CHILD_OF": - return SpanRefType_CHILD_OF, nil - case "FOLLOWS_FROM": - return SpanRefType_FOLLOWS_FROM, nil - } - return SpanRefType(0), fmt.Errorf("not a valid SpanRefType string") -} - -func SpanRefTypePtr(v SpanRefType) *SpanRefType { return &v } - -func (p SpanRefType) MarshalText() ([]byte, error) { - return []byte(p.String()), nil -} - -func (p *SpanRefType) UnmarshalText(text []byte) error { - q, err := SpanRefTypeFromString(string(text)) - if err != nil { - return err - } - *p = q - return nil -} - -func (p *SpanRefType) Scan(value interface{}) error { - v, ok := value.(int64) - if !ok { - return errors.New("Scan value is not int64") - } - *p = SpanRefType(v) - return nil -} - -func (p *SpanRefType) Value() (driver.Value, error) { - if p == nil { - return nil, nil - } - return int64(*p), nil -} - -// Attributes: -// - Key -// - VType -// - VStr -// - VDouble -// - VBool -// - VLong -// - VBinary -type Tag struct { - Key string `thrift:"key,1,required" db:"key" json:"key"` - VType TagType `thrift:"vType,2,required" db:"vType" json:"vType"` - VStr *string `thrift:"vStr,3" db:"vStr" json:"vStr,omitempty"` - VDouble *float64 `thrift:"vDouble,4" db:"vDouble" json:"vDouble,omitempty"` - VBool *bool `thrift:"vBool,5" db:"vBool" json:"vBool,omitempty"` - VLong *int64 `thrift:"vLong,6" db:"vLong" json:"vLong,omitempty"` - VBinary []byte `thrift:"vBinary,7" db:"vBinary" json:"vBinary,omitempty"` -} - -func NewTag() *Tag { - return &Tag{} -} - -func (p *Tag) GetKey() string { - return p.Key -} - -func (p *Tag) GetVType() TagType { - return p.VType -} - -var Tag_VStr_DEFAULT string - -func (p *Tag) GetVStr() string { - if !p.IsSetVStr() { - return Tag_VStr_DEFAULT - } - return *p.VStr -} - -var Tag_VDouble_DEFAULT float64 - -func (p *Tag) GetVDouble() float64 { - if !p.IsSetVDouble() { - return Tag_VDouble_DEFAULT - } - return *p.VDouble -} - -var Tag_VBool_DEFAULT bool - -func (p *Tag) GetVBool() bool { - if !p.IsSetVBool() { - return Tag_VBool_DEFAULT - } - return *p.VBool -} - -var Tag_VLong_DEFAULT int64 - -func (p *Tag) GetVLong() int64 { - if !p.IsSetVLong() { - return Tag_VLong_DEFAULT - } - return *p.VLong -} - -var Tag_VBinary_DEFAULT []byte - -func (p *Tag) GetVBinary() []byte { - return p.VBinary -} -func (p *Tag) IsSetVStr() bool { - return p.VStr != nil -} - -func (p *Tag) IsSetVDouble() bool { - return p.VDouble != nil -} - -func (p *Tag) IsSetVBool() bool { - return p.VBool != nil -} - -func (p *Tag) IsSetVLong() bool { - return p.VLong != nil -} - -func (p *Tag) IsSetVBinary() bool { - return p.VBinary != nil -} - -func (p *Tag) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetKey bool = false - var issetVType bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetKey = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I32 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetVType = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.DOUBLE { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.I64 { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.STRING { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetKey { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Key is not set")) - } - if !issetVType { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field VType is not set")) - } - return nil -} - -func (p *Tag) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Key = v - } - return nil -} - -func (p *Tag) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - temp := TagType(v) - p.VType = temp - } - return nil -} - -func (p *Tag) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.VStr = &v - } - return nil -} - -func (p *Tag) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadDouble(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.VDouble = &v - } - return nil -} - -func (p *Tag) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - p.VBool = &v - } - return nil -} - -func (p *Tag) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 6: ", err) - } else { - p.VLong = &v - } - return nil -} - -func (p *Tag) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) - } else { - p.VBinary = v - } - return nil -} - -func (p *Tag) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Tag"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - if err := p.writeField5(ctx, oprot); err != nil { - return err - } - if err := p.writeField6(ctx, oprot); err != nil { - return err - } - if err := p.writeField7(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Tag) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Key)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) - } - return err -} - -func (p *Tag) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "vType", thrift.I32, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:vType: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.VType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vType (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:vType: ", p), err) - } - return err -} - -func (p *Tag) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetVStr() { - if err := oprot.WriteFieldBegin(ctx, "vStr", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:vStr: ", p), err) - } - if err := oprot.WriteString(ctx, string(*p.VStr)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vStr (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:vStr: ", p), err) - } - } - return err -} - -func (p *Tag) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetVDouble() { - if err := oprot.WriteFieldBegin(ctx, "vDouble", thrift.DOUBLE, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:vDouble: ", p), err) - } - if err := oprot.WriteDouble(ctx, float64(*p.VDouble)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vDouble (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:vDouble: ", p), err) - } - } - return err -} - -func (p *Tag) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetVBool() { - if err := oprot.WriteFieldBegin(ctx, "vBool", thrift.BOOL, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:vBool: ", p), err) - } - if err := oprot.WriteBool(ctx, bool(*p.VBool)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vBool (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:vBool: ", p), err) - } - } - return err -} - -func (p *Tag) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetVLong() { - if err := oprot.WriteFieldBegin(ctx, "vLong", thrift.I64, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:vLong: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.VLong)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vLong (6) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:vLong: ", p), err) - } - } - return err -} - -func (p *Tag) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetVBinary() { - if err := oprot.WriteFieldBegin(ctx, "vBinary", thrift.STRING, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:vBinary: ", p), err) - } - if err := oprot.WriteBinary(ctx, p.VBinary); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.vBinary (7) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:vBinary: ", p), err) - } - } - return err -} - -func (p *Tag) Equals(other *Tag) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Key != other.Key { - return false - } - if p.VType != other.VType { - return false - } - if p.VStr != other.VStr { - if p.VStr == nil || other.VStr == nil { - return false - } - if (*p.VStr) != (*other.VStr) { - return false - } - } - if p.VDouble != other.VDouble { - if p.VDouble == nil || other.VDouble == nil { - return false - } - if (*p.VDouble) != (*other.VDouble) { - return false - } - } - if p.VBool != other.VBool { - if p.VBool == nil || other.VBool == nil { - return false - } - if (*p.VBool) != (*other.VBool) { - return false - } - } - if p.VLong != other.VLong { - if p.VLong == nil || other.VLong == nil { - return false - } - if (*p.VLong) != (*other.VLong) { - return false - } - } - if bytes.Compare(p.VBinary, other.VBinary) != 0 { - return false - } - return true -} - -func (p *Tag) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Tag(%+v)", *p) -} - -// Attributes: -// - Timestamp -// - Fields -type Log struct { - Timestamp int64 `thrift:"timestamp,1,required" db:"timestamp" json:"timestamp"` - Fields []*Tag `thrift:"fields,2,required" db:"fields" json:"fields"` -} - -func NewLog() *Log { - return &Log{} -} - -func (p *Log) GetTimestamp() int64 { - return p.Timestamp -} - -func (p *Log) GetFields() []*Tag { - return p.Fields -} -func (p *Log) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetTimestamp bool = false - var issetFields bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetTimestamp = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.LIST { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetFields = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetTimestamp { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Timestamp is not set")) - } - if !issetFields { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Fields is not set")) - } - return nil -} - -func (p *Log) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Timestamp = v - } - return nil -} - -func (p *Log) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Tag, 0, size) - p.Fields = tSlice - for i := 0; i < size; i++ { - _elem0 := &Tag{} - if err := _elem0.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) - } - p.Fields = append(p.Fields, _elem0) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Log) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Log"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Log) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) - } - return err -} - -func (p *Log) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "fields", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:fields: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Fields)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Fields { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:fields: ", p), err) - } - return err -} - -func (p *Log) Equals(other *Log) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Timestamp != other.Timestamp { - return false - } - if len(p.Fields) != len(other.Fields) { - return false - } - for i, _tgt := range p.Fields { - _src1 := other.Fields[i] - if !_tgt.Equals(_src1) { - return false - } - } - return true -} - -func (p *Log) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Log(%+v)", *p) -} - -// Attributes: -// - RefType -// - TraceIdLow -// - TraceIdHigh -// - SpanId -type SpanRef struct { - RefType SpanRefType `thrift:"refType,1,required" db:"refType" json:"refType"` - TraceIdLow int64 `thrift:"traceIdLow,2,required" db:"traceIdLow" json:"traceIdLow"` - TraceIdHigh int64 `thrift:"traceIdHigh,3,required" db:"traceIdHigh" json:"traceIdHigh"` - SpanId int64 `thrift:"spanId,4,required" db:"spanId" json:"spanId"` -} - -func NewSpanRef() *SpanRef { - return &SpanRef{} -} - -func (p *SpanRef) GetRefType() SpanRefType { - return p.RefType -} - -func (p *SpanRef) GetTraceIdLow() int64 { - return p.TraceIdLow -} - -func (p *SpanRef) GetTraceIdHigh() int64 { - return p.TraceIdHigh -} - -func (p *SpanRef) GetSpanId() int64 { - return p.SpanId -} -func (p *SpanRef) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetRefType bool = false - var issetTraceIdLow bool = false - var issetTraceIdHigh bool = false - var issetSpanId bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetRefType = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I64 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetTraceIdLow = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetTraceIdHigh = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I64 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetSpanId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetRefType { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field RefType is not set")) - } - if !issetTraceIdLow { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) - } - if !issetTraceIdHigh { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) - } - if !issetSpanId { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) - } - return nil -} - -func (p *SpanRef) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - temp := SpanRefType(v) - p.RefType = temp - } - return nil -} - -func (p *SpanRef) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.TraceIdLow = v - } - return nil -} - -func (p *SpanRef) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.TraceIdHigh = v - } - return nil -} - -func (p *SpanRef) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.SpanId = v - } - return nil -} - -func (p *SpanRef) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "SpanRef"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *SpanRef) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "refType", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:refType: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.RefType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.refType (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:refType: ", p), err) - } - return err -} - -func (p *SpanRef) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdLow: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdLow: ", p), err) - } - return err -} - -func (p *SpanRef) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:traceIdHigh: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:traceIdHigh: ", p), err) - } - return err -} - -func (p *SpanRef) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:spanId: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.spanId (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:spanId: ", p), err) - } - return err -} - -func (p *SpanRef) Equals(other *SpanRef) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.RefType != other.RefType { - return false - } - if p.TraceIdLow != other.TraceIdLow { - return false - } - if p.TraceIdHigh != other.TraceIdHigh { - return false - } - if p.SpanId != other.SpanId { - return false - } - return true -} - -func (p *SpanRef) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("SpanRef(%+v)", *p) -} - -// Attributes: -// - TraceIdLow -// - TraceIdHigh -// - SpanId -// - ParentSpanId -// - OperationName -// - References -// - Flags -// - StartTime -// - Duration -// - Tags -// - Logs -type Span struct { - TraceIdLow int64 `thrift:"traceIdLow,1,required" db:"traceIdLow" json:"traceIdLow"` - TraceIdHigh int64 `thrift:"traceIdHigh,2,required" db:"traceIdHigh" json:"traceIdHigh"` - SpanId int64 `thrift:"spanId,3,required" db:"spanId" json:"spanId"` - ParentSpanId int64 `thrift:"parentSpanId,4,required" db:"parentSpanId" json:"parentSpanId"` - OperationName string `thrift:"operationName,5,required" db:"operationName" json:"operationName"` - References []*SpanRef `thrift:"references,6" db:"references" json:"references,omitempty"` - Flags int32 `thrift:"flags,7,required" db:"flags" json:"flags"` - StartTime int64 `thrift:"startTime,8,required" db:"startTime" json:"startTime"` - Duration int64 `thrift:"duration,9,required" db:"duration" json:"duration"` - Tags []*Tag `thrift:"tags,10" db:"tags" json:"tags,omitempty"` - Logs []*Log `thrift:"logs,11" db:"logs" json:"logs,omitempty"` -} - -func NewSpan() *Span { - return &Span{} -} - -func (p *Span) GetTraceIdLow() int64 { - return p.TraceIdLow -} - -func (p *Span) GetTraceIdHigh() int64 { - return p.TraceIdHigh -} - -func (p *Span) GetSpanId() int64 { - return p.SpanId -} - -func (p *Span) GetParentSpanId() int64 { - return p.ParentSpanId -} - -func (p *Span) GetOperationName() string { - return p.OperationName -} - -var Span_References_DEFAULT []*SpanRef - -func (p *Span) GetReferences() []*SpanRef { - return p.References -} - -func (p *Span) GetFlags() int32 { - return p.Flags -} - -func (p *Span) GetStartTime() int64 { - return p.StartTime -} - -func (p *Span) GetDuration() int64 { - return p.Duration -} - -var Span_Tags_DEFAULT []*Tag - -func (p *Span) GetTags() []*Tag { - return p.Tags -} - -var Span_Logs_DEFAULT []*Log - -func (p *Span) GetLogs() []*Log { - return p.Logs -} -func (p *Span) IsSetReferences() bool { - return p.References != nil -} - -func (p *Span) IsSetTags() bool { - return p.Tags != nil -} - -func (p *Span) IsSetLogs() bool { - return p.Logs != nil -} - -func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetTraceIdLow bool = false - var issetTraceIdHigh bool = false - var issetSpanId bool = false - var issetParentSpanId bool = false - var issetOperationName bool = false - var issetFlags bool = false - var issetStartTime bool = false - var issetDuration bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetTraceIdLow = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I64 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetTraceIdHigh = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetSpanId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I64 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - issetParentSpanId = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.STRING { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - issetOperationName = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.LIST { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 7: - if fieldTypeId == thrift.I32 { - if err := p.ReadField7(ctx, iprot); err != nil { - return err - } - issetFlags = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.I64 { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - issetStartTime = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.I64 { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - issetDuration = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: - if fieldTypeId == thrift.LIST { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 11: - if fieldTypeId == thrift.LIST { - if err := p.ReadField11(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetTraceIdLow { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdLow is not set")) - } - if !issetTraceIdHigh { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TraceIdHigh is not set")) - } - if !issetSpanId { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field SpanId is not set")) - } - if !issetParentSpanId { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ParentSpanId is not set")) - } - if !issetOperationName { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field OperationName is not set")) - } - if !issetFlags { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Flags is not set")) - } - if !issetStartTime { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field StartTime is not set")) - } - if !issetDuration { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Duration is not set")) - } - return nil -} - -func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.TraceIdLow = v - } - return nil -} - -func (p *Span) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.TraceIdHigh = v - } - return nil -} - -func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.SpanId = v - } - return nil -} - -func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.ParentSpanId = v - } - return nil -} - -func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - p.OperationName = v - } - return nil -} - -func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*SpanRef, 0, size) - p.References = tSlice - for i := 0; i < size; i++ { - _elem2 := &SpanRef{} - if err := _elem2.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem2), err) - } - p.References = append(p.References, _elem2) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Span) ReadField7(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 7: ", err) - } else { - p.Flags = v - } - return nil -} - -func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 8: ", err) - } else { - p.StartTime = v - } - return nil -} - -func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) - } else { - p.Duration = v - } - return nil -} - -func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Tag, 0, size) - p.Tags = tSlice - for i := 0; i < size; i++ { - _elem3 := &Tag{} - if err := _elem3.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem3), err) - } - p.Tags = append(p.Tags, _elem3) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Log, 0, size) - p.Logs = tSlice - for i := 0; i < size; i++ { - _elem4 := &Log{} - if err := _elem4.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem4), err) - } - p.Logs = append(p.Logs, _elem4) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Span"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - if err := p.writeField5(ctx, oprot); err != nil { - return err - } - if err := p.writeField6(ctx, oprot); err != nil { - return err - } - if err := p.writeField7(ctx, oprot); err != nil { - return err - } - if err := p.writeField8(ctx, oprot); err != nil { - return err - } - if err := p.writeField9(ctx, oprot); err != nil { - return err - } - if err := p.writeField10(ctx, oprot); err != nil { - return err - } - if err := p.writeField11(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "traceIdLow", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:traceIdLow: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TraceIdLow)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.traceIdLow (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:traceIdLow: ", p), err) - } - return err -} - -func (p *Span) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "traceIdHigh", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:traceIdHigh: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TraceIdHigh)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.traceIdHigh (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:traceIdHigh: ", p), err) - } - return err -} - -func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "spanId", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:spanId: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.SpanId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.spanId (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:spanId: ", p), err) - } - return err -} - -func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "parentSpanId", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:parentSpanId: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.ParentSpanId)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.parentSpanId (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:parentSpanId: ", p), err) - } - return err -} - -func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "operationName", thrift.STRING, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:operationName: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.OperationName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.operationName (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:operationName: ", p), err) - } - return err -} - -func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetReferences() { - if err := oprot.WriteFieldBegin(ctx, "references", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:references: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.References)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.References { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:references: ", p), err) - } - } - return err -} - -func (p *Span) writeField7(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "flags", thrift.I32, 7); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 7:flags: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Flags)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.flags (7) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 7:flags: ", p), err) - } - return err -} - -func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "startTime", thrift.I64, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:startTime: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.StartTime)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.startTime (8) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:startTime: ", p), err) - } - return err -} - -func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:duration: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.Duration)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.duration (9) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:duration: ", p), err) - } - return err -} - -func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTags() { - if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:tags: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Tags { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:tags: ", p), err) - } - } - return err -} - -func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetLogs() { - if err := oprot.WriteFieldBegin(ctx, "logs", thrift.LIST, 11); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:logs: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Logs)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Logs { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 11:logs: ", p), err) - } - } - return err -} - -func (p *Span) Equals(other *Span) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.TraceIdLow != other.TraceIdLow { - return false - } - if p.TraceIdHigh != other.TraceIdHigh { - return false - } - if p.SpanId != other.SpanId { - return false - } - if p.ParentSpanId != other.ParentSpanId { - return false - } - if p.OperationName != other.OperationName { - return false - } - if len(p.References) != len(other.References) { - return false - } - for i, _tgt := range p.References { - _src5 := other.References[i] - if !_tgt.Equals(_src5) { - return false - } - } - if p.Flags != other.Flags { - return false - } - if p.StartTime != other.StartTime { - return false - } - if p.Duration != other.Duration { - return false - } - if len(p.Tags) != len(other.Tags) { - return false - } - for i, _tgt := range p.Tags { - _src6 := other.Tags[i] - if !_tgt.Equals(_src6) { - return false - } - } - if len(p.Logs) != len(other.Logs) { - return false - } - for i, _tgt := range p.Logs { - _src7 := other.Logs[i] - if !_tgt.Equals(_src7) { - return false - } - } - return true -} - -func (p *Span) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Span(%+v)", *p) -} - -// Attributes: -// - ServiceName -// - Tags -type Process struct { - ServiceName string `thrift:"serviceName,1,required" db:"serviceName" json:"serviceName"` - Tags []*Tag `thrift:"tags,2" db:"tags" json:"tags,omitempty"` -} - -func NewProcess() *Process { - return &Process{} -} - -func (p *Process) GetServiceName() string { - return p.ServiceName -} - -var Process_Tags_DEFAULT []*Tag - -func (p *Process) GetTags() []*Tag { - return p.Tags -} -func (p *Process) IsSetTags() bool { - return p.Tags != nil -} - -func (p *Process) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetServiceName bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetServiceName = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.LIST { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetServiceName { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field ServiceName is not set")) - } - return nil -} - -func (p *Process) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *Process) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Tag, 0, size) - p.Tags = tSlice - for i := 0; i < size; i++ { - _elem8 := &Tag{} - if err := _elem8.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem8), err) - } - p.Tags = append(p.Tags, _elem8) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Process) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Process"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Process) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "serviceName", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:serviceName: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.serviceName (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:serviceName: ", p), err) - } - return err -} - -func (p *Process) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTags() { - if err := oprot.WriteFieldBegin(ctx, "tags", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tags: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Tags)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Tags { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tags: ", p), err) - } - } - return err -} - -func (p *Process) Equals(other *Process) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.ServiceName != other.ServiceName { - return false - } - if len(p.Tags) != len(other.Tags) { - return false - } - for i, _tgt := range p.Tags { - _src9 := other.Tags[i] - if !_tgt.Equals(_src9) { - return false - } - } - return true -} - -func (p *Process) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Process(%+v)", *p) -} - -// Attributes: -// - FullQueueDroppedSpans -// - TooLargeDroppedSpans -// - FailedToEmitSpans -type ClientStats struct { - FullQueueDroppedSpans int64 `thrift:"fullQueueDroppedSpans,1,required" db:"fullQueueDroppedSpans" json:"fullQueueDroppedSpans"` - TooLargeDroppedSpans int64 `thrift:"tooLargeDroppedSpans,2,required" db:"tooLargeDroppedSpans" json:"tooLargeDroppedSpans"` - FailedToEmitSpans int64 `thrift:"failedToEmitSpans,3,required" db:"failedToEmitSpans" json:"failedToEmitSpans"` -} - -func NewClientStats() *ClientStats { - return &ClientStats{} -} - -func (p *ClientStats) GetFullQueueDroppedSpans() int64 { - return p.FullQueueDroppedSpans -} - -func (p *ClientStats) GetTooLargeDroppedSpans() int64 { - return p.TooLargeDroppedSpans -} - -func (p *ClientStats) GetFailedToEmitSpans() int64 { - return p.FailedToEmitSpans -} -func (p *ClientStats) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetFullQueueDroppedSpans bool = false - var issetTooLargeDroppedSpans bool = false - var issetFailedToEmitSpans bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetFullQueueDroppedSpans = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I64 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetTooLargeDroppedSpans = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - issetFailedToEmitSpans = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetFullQueueDroppedSpans { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FullQueueDroppedSpans is not set")) - } - if !issetTooLargeDroppedSpans { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field TooLargeDroppedSpans is not set")) - } - if !issetFailedToEmitSpans { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FailedToEmitSpans is not set")) - } - return nil -} - -func (p *ClientStats) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.FullQueueDroppedSpans = v - } - return nil -} - -func (p *ClientStats) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.TooLargeDroppedSpans = v - } - return nil -} - -func (p *ClientStats) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.FailedToEmitSpans = v - } - return nil -} - -func (p *ClientStats) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "ClientStats"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *ClientStats) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "fullQueueDroppedSpans", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:fullQueueDroppedSpans: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.FullQueueDroppedSpans)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.fullQueueDroppedSpans (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:fullQueueDroppedSpans: ", p), err) - } - return err -} - -func (p *ClientStats) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "tooLargeDroppedSpans", thrift.I64, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:tooLargeDroppedSpans: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TooLargeDroppedSpans)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.tooLargeDroppedSpans (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:tooLargeDroppedSpans: ", p), err) - } - return err -} - -func (p *ClientStats) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "failedToEmitSpans", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:failedToEmitSpans: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.FailedToEmitSpans)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.failedToEmitSpans (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:failedToEmitSpans: ", p), err) - } - return err -} - -func (p *ClientStats) Equals(other *ClientStats) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.FullQueueDroppedSpans != other.FullQueueDroppedSpans { - return false - } - if p.TooLargeDroppedSpans != other.TooLargeDroppedSpans { - return false - } - if p.FailedToEmitSpans != other.FailedToEmitSpans { - return false - } - return true -} - -func (p *ClientStats) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ClientStats(%+v)", *p) -} - -// Attributes: -// - Process -// - Spans -// - SeqNo -// - Stats -type Batch struct { - Process *Process `thrift:"process,1,required" db:"process" json:"process"` - Spans []*Span `thrift:"spans,2,required" db:"spans" json:"spans"` - SeqNo *int64 `thrift:"seqNo,3" db:"seqNo" json:"seqNo,omitempty"` - Stats *ClientStats `thrift:"stats,4" db:"stats" json:"stats,omitempty"` -} - -func NewBatch() *Batch { - return &Batch{} -} - -var Batch_Process_DEFAULT *Process - -func (p *Batch) GetProcess() *Process { - if !p.IsSetProcess() { - return Batch_Process_DEFAULT - } - return p.Process -} - -func (p *Batch) GetSpans() []*Span { - return p.Spans -} - -var Batch_SeqNo_DEFAULT int64 - -func (p *Batch) GetSeqNo() int64 { - if !p.IsSetSeqNo() { - return Batch_SeqNo_DEFAULT - } - return *p.SeqNo -} - -var Batch_Stats_DEFAULT *ClientStats - -func (p *Batch) GetStats() *ClientStats { - if !p.IsSetStats() { - return Batch_Stats_DEFAULT - } - return p.Stats -} -func (p *Batch) IsSetProcess() bool { - return p.Process != nil -} - -func (p *Batch) IsSetSeqNo() bool { - return p.SeqNo != nil -} - -func (p *Batch) IsSetStats() bool { - return p.Stats != nil -} - -func (p *Batch) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetProcess bool = false - var issetSpans bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetProcess = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.LIST { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - issetSpans = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I64 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetProcess { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Process is not set")) - } - if !issetSpans { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Spans is not set")) - } - return nil -} - -func (p *Batch) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - p.Process = &Process{} - if err := p.Process.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Process), err) - } - return nil -} - -func (p *Batch) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Span, 0, size) - p.Spans = tSlice - for i := 0; i < size; i++ { - _elem10 := &Span{} - if err := _elem10.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) - } - p.Spans = append(p.Spans, _elem10) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Batch) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.SeqNo = &v - } - return nil -} - -func (p *Batch) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - p.Stats = &ClientStats{} - if err := p.Stats.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Stats), err) - } - return nil -} - -func (p *Batch) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Batch"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Batch) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "process", thrift.STRUCT, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:process: ", p), err) - } - if err := p.Process.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Process), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:process: ", p), err) - } - return err -} - -func (p *Batch) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:spans: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Spans { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:spans: ", p), err) - } - return err -} - -func (p *Batch) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSeqNo() { - if err := oprot.WriteFieldBegin(ctx, "seqNo", thrift.I64, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:seqNo: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.SeqNo)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.seqNo (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:seqNo: ", p), err) - } - } - return err -} - -func (p *Batch) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetStats() { - if err := oprot.WriteFieldBegin(ctx, "stats", thrift.STRUCT, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:stats: ", p), err) - } - if err := p.Stats.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Stats), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:stats: ", p), err) - } - } - return err -} - -func (p *Batch) Equals(other *Batch) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if !p.Process.Equals(other.Process) { - return false - } - if len(p.Spans) != len(other.Spans) { - return false - } - for i, _tgt := range p.Spans { - _src11 := other.Spans[i] - if !_tgt.Equals(_src11) { - return false - } - } - if p.SeqNo != other.SeqNo { - if p.SeqNo == nil || other.SeqNo == nil { - return false - } - if (*p.SeqNo) != (*other.SeqNo) { - return false - } - } - if !p.Stats.Equals(other.Stats) { - return false - } - return true -} - -func (p *Batch) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Batch(%+v)", *p) -} - -// Attributes: -// - Ok -type BatchSubmitResponse struct { - Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"` -} - -func NewBatchSubmitResponse() *BatchSubmitResponse { - return &BatchSubmitResponse{} -} - -func (p *BatchSubmitResponse) GetOk() bool { - return p.Ok -} -func (p *BatchSubmitResponse) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetOk bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetOk = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetOk { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set")) - } - return nil -} - -func (p *BatchSubmitResponse) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Ok = v - } - return nil -} - -func (p *BatchSubmitResponse) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "BatchSubmitResponse"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *BatchSubmitResponse) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) - } - if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) - } - return err -} - -func (p *BatchSubmitResponse) Equals(other *BatchSubmitResponse) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Ok != other.Ok { - return false - } - return true -} - -func (p *BatchSubmitResponse) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("BatchSubmitResponse(%+v)", *p) -} - -type Collector interface { - // Parameters: - // - Batches - SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) -} - -type CollectorClient struct { - c thrift.TClient - meta thrift.ResponseMeta -} - -func NewCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CollectorClient { - return &CollectorClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} - -func NewCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CollectorClient { - return &CollectorClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} - -func NewCollectorClient(c thrift.TClient) *CollectorClient { - return &CollectorClient{ - c: c, - } -} - -func (p *CollectorClient) Client_() thrift.TClient { - return p.c -} - -func (p *CollectorClient) LastResponseMeta_() thrift.ResponseMeta { - return p.meta -} - -func (p *CollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { - p.meta = meta -} - -// Parameters: -// - Batches -func (p *CollectorClient) SubmitBatches(ctx context.Context, batches []*Batch) (_r []*BatchSubmitResponse, _err error) { - var _args12 CollectorSubmitBatchesArgs - _args12.Batches = batches - var _result14 CollectorSubmitBatchesResult - var _meta13 thrift.ResponseMeta - _meta13, _err = p.Client_().Call(ctx, "submitBatches", &_args12, &_result14) - p.SetLastResponseMeta_(_meta13) - if _err != nil { - return - } - return _result14.GetSuccess(), nil -} - -type CollectorProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler Collector -} - -func (p *CollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *CollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *CollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewCollectorProcessor(handler Collector) *CollectorProcessor { - - self15 := &CollectorProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self15.processorMap["submitBatches"] = &collectorProcessorSubmitBatches{handler: handler} - return self15 -} - -func (p *CollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) - if err2 != nil { - return false, thrift.WrapTException(err2) - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) - } - iprot.Skip(ctx, thrift.STRUCT) - iprot.ReadMessageEnd(ctx) - x16 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) - x16.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, x16 - -} - -type collectorProcessorSubmitBatches struct { - handler Collector -} - -func (p *collectorProcessorSubmitBatches) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CollectorSubmitBatchesArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) - } - iprot.ReadMessageEnd(ctx) - - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } - } - } - }(tickerCtx, cancel) - } - - result := CollectorSubmitBatchesResult{} - var retval []*BatchSubmitResponse - if retval, err2 = p.handler.SubmitBatches(ctx, args.Batches); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) - } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitBatches: "+err2.Error()) - oprot.WriteMessageBegin(ctx, "submitBatches", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval - } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "submitBatches", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err != nil { - return - } - return true, err -} - -// HELPER FUNCTIONS AND STRUCTURES - -// Attributes: -// - Batches -type CollectorSubmitBatchesArgs struct { - Batches []*Batch `thrift:"batches,1" db:"batches" json:"batches"` -} - -func NewCollectorSubmitBatchesArgs() *CollectorSubmitBatchesArgs { - return &CollectorSubmitBatchesArgs{} -} - -func (p *CollectorSubmitBatchesArgs) GetBatches() []*Batch { - return p.Batches -} -func (p *CollectorSubmitBatchesArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.LIST { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *CollectorSubmitBatchesArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Batch, 0, size) - p.Batches = tSlice - for i := 0; i < size; i++ { - _elem17 := &Batch{} - if err := _elem17.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err) - } - p.Batches = append(p.Batches, _elem17) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *CollectorSubmitBatchesArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "submitBatches_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *CollectorSubmitBatchesArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "batches", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:batches: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Batches)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Batches { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:batches: ", p), err) - } - return err -} - -func (p *CollectorSubmitBatchesArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("CollectorSubmitBatchesArgs(%+v)", *p) -} - -// Attributes: -// - Success -type CollectorSubmitBatchesResult struct { - Success []*BatchSubmitResponse `thrift:"success,0" db:"success" json:"success,omitempty"` -} - -func NewCollectorSubmitBatchesResult() *CollectorSubmitBatchesResult { - return &CollectorSubmitBatchesResult{} -} - -var CollectorSubmitBatchesResult_Success_DEFAULT []*BatchSubmitResponse - -func (p *CollectorSubmitBatchesResult) GetSuccess() []*BatchSubmitResponse { - return p.Success -} -func (p *CollectorSubmitBatchesResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *CollectorSubmitBatchesResult) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if fieldTypeId == thrift.LIST { - if err := p.ReadField0(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *CollectorSubmitBatchesResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*BatchSubmitResponse, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem18 := &BatchSubmitResponse{} - if err := _elem18.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem18), err) - } - p.Success = append(p.Success, _elem18) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *CollectorSubmitBatchesResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "submitBatches_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField0(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *CollectorSubmitBatchesResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Success { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) - } - } - return err -} - -func (p *CollectorSubmitBatchesResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("CollectorSubmitBatchesResult(%+v)", *p) -} diff --git a/exporters/jaeger/internal/gen-go/zipkincore/GoUnusedProtection__.go b/exporters/jaeger/internal/gen-go/zipkincore/GoUnusedProtection__.go deleted file mode 100644 index ebf43018fe7..00000000000 --- a/exporters/jaeger/internal/gen-go/zipkincore/GoUnusedProtection__.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package zipkincore - -var GoUnusedProtection__ int; - diff --git a/exporters/jaeger/internal/gen-go/zipkincore/zipkin_collector-remote/zipkin_collector-remote.go b/exporters/jaeger/internal/gen-go/zipkincore/zipkin_collector-remote/zipkin_collector-remote.go deleted file mode 100755 index 127f67d05a1..00000000000 --- a/exporters/jaeger/internal/gen-go/zipkincore/zipkin_collector-remote/zipkin_collector-remote.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package main - -import ( - "context" - "flag" - "fmt" - "math" - "net" - "net/url" - "os" - "strconv" - "strings" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/zipkincore" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -var _ = zipkincore.GoUnusedProtection__ - -func Usage() { - fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:") - flag.PrintDefaults() - fmt.Fprintln(os.Stderr, "\nFunctions:") - fmt.Fprintln(os.Stderr, " submitZipkinBatch( spans)") - fmt.Fprintln(os.Stderr) - os.Exit(0) -} - -type httpHeaders map[string]string - -func (h httpHeaders) String() string { - var m map[string]string = h - return fmt.Sprintf("%s", m) -} - -func (h httpHeaders) Set(value string) error { - parts := strings.Split(value, ": ") - if len(parts) != 2 { - return fmt.Errorf("header should be of format 'Key: Value'") - } - h[parts[0]] = parts[1] - return nil -} - -func main() { - flag.Usage = Usage - var host string - var port int - var protocol string - var urlString string - var framed bool - var useHttp bool - headers := make(httpHeaders) - var parsedUrl *url.URL - var trans thrift.TTransport - _ = strconv.Atoi - _ = math.Abs - flag.Usage = Usage - flag.StringVar(&host, "h", "localhost", "Specify host and port") - flag.IntVar(&port, "p", 9090, "Specify port") - flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)") - flag.StringVar(&urlString, "u", "", "Specify the url") - flag.BoolVar(&framed, "framed", false, "Use framed transport") - flag.BoolVar(&useHttp, "http", false, "Use http") - flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")") - flag.Parse() - - if len(urlString) > 0 { - var err error - parsedUrl, err = url.Parse(urlString) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - host = parsedUrl.Host - useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https" - } else if useHttp { - _, err := url.Parse(fmt.Sprint("http://", host, ":", port)) - if err != nil { - fmt.Fprintln(os.Stderr, "Error parsing URL: ", err) - flag.Usage() - } - } - - cmd := flag.Arg(0) - var err error - if useHttp { - trans, err = thrift.NewTHttpClient(parsedUrl.String()) - if len(headers) > 0 { - httptrans := trans.(*thrift.THttpClient) - for key, value := range headers { - httptrans.SetHeader(key, value) - } - } - } else { - portStr := fmt.Sprint(port) - if strings.Contains(host, ":") { - host, portStr, err = net.SplitHostPort(host) - if err != nil { - fmt.Fprintln(os.Stderr, "error with host:", err) - os.Exit(1) - } - } - trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr)) - if err != nil { - fmt.Fprintln(os.Stderr, "error resolving address:", err) - os.Exit(1) - } - if framed { - trans = thrift.NewTFramedTransport(trans) - } - } - if err != nil { - fmt.Fprintln(os.Stderr, "Error creating transport", err) - os.Exit(1) - } - defer trans.Close() - var protocolFactory thrift.TProtocolFactory - switch protocol { - case "compact": - protocolFactory = thrift.NewTCompactProtocolFactory() - break - case "simplejson": - protocolFactory = thrift.NewTSimpleJSONProtocolFactory() - break - case "json": - protocolFactory = thrift.NewTJSONProtocolFactory() - break - case "binary", "": - protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() - break - default: - fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol) - Usage() - os.Exit(1) - } - iprot := protocolFactory.GetProtocol(trans) - oprot := protocolFactory.GetProtocol(trans) - client := zipkincore.NewZipkinCollectorClient(thrift.NewTStandardClient(iprot, oprot)) - if err := trans.Open(); err != nil { - fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err) - os.Exit(1) - } - - switch cmd { - case "submitZipkinBatch": - if flag.NArg()-1 != 1 { - fmt.Fprintln(os.Stderr, "SubmitZipkinBatch requires 1 args") - flag.Usage() - } - arg11 := flag.Arg(1) - mbTrans12 := thrift.NewTMemoryBufferLen(len(arg11)) - defer mbTrans12.Close() - _, err13 := mbTrans12.WriteString(arg11) - if err13 != nil { - Usage() - return - } - factory14 := thrift.NewTJSONProtocolFactory() - jsProt15 := factory14.GetProtocol(mbTrans12) - containerStruct0 := zipkincore.NewZipkinCollectorSubmitZipkinBatchArgs() - err16 := containerStruct0.ReadField1(context.Background(), jsProt15) - if err16 != nil { - Usage() - return - } - argvalue0 := containerStruct0.Spans - value0 := argvalue0 - fmt.Print(client.SubmitZipkinBatch(context.Background(), value0)) - fmt.Print("\n") - break - case "": - Usage() - break - default: - fmt.Fprintln(os.Stderr, "Invalid function ", cmd) - } -} diff --git a/exporters/jaeger/internal/gen-go/zipkincore/zipkincore-consts.go b/exporters/jaeger/internal/gen-go/zipkincore/zipkincore-consts.go deleted file mode 100644 index 043ecba9626..00000000000 --- a/exporters/jaeger/internal/gen-go/zipkincore/zipkincore-consts.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package zipkincore - -import ( - "bytes" - "context" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -const CLIENT_SEND = "cs" -const CLIENT_RECV = "cr" -const SERVER_SEND = "ss" -const SERVER_RECV = "sr" -const MESSAGE_SEND = "ms" -const MESSAGE_RECV = "mr" -const WIRE_SEND = "ws" -const WIRE_RECV = "wr" -const CLIENT_SEND_FRAGMENT = "csf" -const CLIENT_RECV_FRAGMENT = "crf" -const SERVER_SEND_FRAGMENT = "ssf" -const SERVER_RECV_FRAGMENT = "srf" -const LOCAL_COMPONENT = "lc" -const CLIENT_ADDR = "ca" -const SERVER_ADDR = "sa" -const MESSAGE_ADDR = "ma" - -func init() { -} diff --git a/exporters/jaeger/internal/gen-go/zipkincore/zipkincore.go b/exporters/jaeger/internal/gen-go/zipkincore/zipkincore.go deleted file mode 100644 index 7f46810e0d3..00000000000 --- a/exporters/jaeger/internal/gen-go/zipkincore/zipkincore.go +++ /dev/null @@ -1,2067 +0,0 @@ -// Code generated by Thrift Compiler (0.14.1). DO NOT EDIT. - -package zipkincore - -import ( - "bytes" - "context" - "database/sql/driver" - "errors" - "fmt" - "time" - - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// (needed to ensure safety because of naive import list construction.) -var _ = thrift.ZERO -var _ = fmt.Printf -var _ = context.Background -var _ = time.Now -var _ = bytes.Equal - -type AnnotationType int64 - -const ( - AnnotationType_BOOL AnnotationType = 0 - AnnotationType_BYTES AnnotationType = 1 - AnnotationType_I16 AnnotationType = 2 - AnnotationType_I32 AnnotationType = 3 - AnnotationType_I64 AnnotationType = 4 - AnnotationType_DOUBLE AnnotationType = 5 - AnnotationType_STRING AnnotationType = 6 -) - -func (p AnnotationType) String() string { - switch p { - case AnnotationType_BOOL: - return "BOOL" - case AnnotationType_BYTES: - return "BYTES" - case AnnotationType_I16: - return "I16" - case AnnotationType_I32: - return "I32" - case AnnotationType_I64: - return "I64" - case AnnotationType_DOUBLE: - return "DOUBLE" - case AnnotationType_STRING: - return "STRING" - } - return "" -} - -func AnnotationTypeFromString(s string) (AnnotationType, error) { - switch s { - case "BOOL": - return AnnotationType_BOOL, nil - case "BYTES": - return AnnotationType_BYTES, nil - case "I16": - return AnnotationType_I16, nil - case "I32": - return AnnotationType_I32, nil - case "I64": - return AnnotationType_I64, nil - case "DOUBLE": - return AnnotationType_DOUBLE, nil - case "STRING": - return AnnotationType_STRING, nil - } - return AnnotationType(0), fmt.Errorf("not a valid AnnotationType string") -} - -func AnnotationTypePtr(v AnnotationType) *AnnotationType { return &v } - -func (p AnnotationType) MarshalText() ([]byte, error) { - return []byte(p.String()), nil -} - -func (p *AnnotationType) UnmarshalText(text []byte) error { - q, err := AnnotationTypeFromString(string(text)) - if err != nil { - return err - } - *p = q - return nil -} - -func (p *AnnotationType) Scan(value interface{}) error { - v, ok := value.(int64) - if !ok { - return errors.New("Scan value is not int64") - } - *p = AnnotationType(v) - return nil -} - -func (p *AnnotationType) Value() (driver.Value, error) { - if p == nil { - return nil, nil - } - return int64(*p), nil -} - -// Indicates the network context of a service recording an annotation with two -// exceptions. -// -// When a BinaryAnnotation, and key is CLIENT_ADDR or SERVER_ADDR, -// the endpoint indicates the source or destination of an RPC. This exception -// allows zipkin to display network context of uninstrumented services, or -// clients such as web browsers. -// -// Attributes: -// - Ipv4: IPv4 host address packed into 4 bytes. -// -// Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4 -// - Port: IPv4 port -// -// Note: this is to be treated as an unsigned integer, so watch for negatives. -// -// Conventionally, when the port isn't known, port = 0. -// - ServiceName: Service name in lowercase, such as "memcache" or "zipkin-web" -// -// Conventionally, when the service name isn't known, service_name = "unknown". -// - Ipv6: IPv6 host address packed into 16 bytes. Ex Inet6Address.getBytes() -type Endpoint struct { - Ipv4 int32 `thrift:"ipv4,1" db:"ipv4" json:"ipv4"` - Port int16 `thrift:"port,2" db:"port" json:"port"` - ServiceName string `thrift:"service_name,3" db:"service_name" json:"service_name"` - Ipv6 []byte `thrift:"ipv6,4" db:"ipv6" json:"ipv6,omitempty"` -} - -func NewEndpoint() *Endpoint { - return &Endpoint{} -} - -func (p *Endpoint) GetIpv4() int32 { - return p.Ipv4 -} - -func (p *Endpoint) GetPort() int16 { - return p.Port -} - -func (p *Endpoint) GetServiceName() string { - return p.ServiceName -} - -var Endpoint_Ipv6_DEFAULT []byte - -func (p *Endpoint) GetIpv6() []byte { - return p.Ipv6 -} -func (p *Endpoint) IsSetIpv6() bool { - return p.Ipv6 != nil -} - -func (p *Endpoint) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I32 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.I16 { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRING { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *Endpoint) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Ipv4 = v - } - return nil -} - -func (p *Endpoint) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI16(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.Port = v - } - return nil -} - -func (p *Endpoint) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.ServiceName = v - } - return nil -} - -func (p *Endpoint) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.Ipv6 = v - } - return nil -} - -func (p *Endpoint) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Endpoint"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Endpoint) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ipv4", thrift.I32, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ipv4: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.Ipv4)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.ipv4 (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ipv4: ", p), err) - } - return err -} - -func (p *Endpoint) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "port", thrift.I16, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:port: ", p), err) - } - if err := oprot.WriteI16(ctx, int16(p.Port)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.port (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:port: ", p), err) - } - return err -} - -func (p *Endpoint) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "service_name", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:service_name: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.ServiceName)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.service_name (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:service_name: ", p), err) - } - return err -} - -func (p *Endpoint) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetIpv6() { - if err := oprot.WriteFieldBegin(ctx, "ipv6", thrift.STRING, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:ipv6: ", p), err) - } - if err := oprot.WriteBinary(ctx, p.Ipv6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.ipv6 (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:ipv6: ", p), err) - } - } - return err -} - -func (p *Endpoint) Equals(other *Endpoint) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Ipv4 != other.Ipv4 { - return false - } - if p.Port != other.Port { - return false - } - if p.ServiceName != other.ServiceName { - return false - } - if bytes.Compare(p.Ipv6, other.Ipv6) != 0 { - return false - } - return true -} - -func (p *Endpoint) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Endpoint(%+v)", *p) -} - -// An annotation is similar to a log statement. It includes a host field which -// allows these events to be attributed properly, and also aggregatable. -// -// Attributes: -// - Timestamp: Microseconds from epoch. -// -// This value should use the most precise value possible. For example, -// gettimeofday or syncing nanoTime against a tick of currentTimeMillis. -// - Value -// - Host: Always the host that recorded the event. By specifying the host you allow -// rollup of all events (such as client requests to a service) by IP address. -type Annotation struct { - Timestamp int64 `thrift:"timestamp,1" db:"timestamp" json:"timestamp"` - Value string `thrift:"value,2" db:"value" json:"value"` - Host *Endpoint `thrift:"host,3" db:"host" json:"host,omitempty"` -} - -func NewAnnotation() *Annotation { - return &Annotation{} -} - -func (p *Annotation) GetTimestamp() int64 { - return p.Timestamp -} - -func (p *Annotation) GetValue() string { - return p.Value -} - -var Annotation_Host_DEFAULT *Endpoint - -func (p *Annotation) GetHost() *Endpoint { - if !p.IsSetHost() { - return Annotation_Host_DEFAULT - } - return p.Host -} -func (p *Annotation) IsSetHost() bool { - return p.Host != nil -} - -func (p *Annotation) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *Annotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Timestamp = v - } - return nil -} - -func (p *Annotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.Value = v - } - return nil -} - -func (p *Annotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - p.Host = &Endpoint{} - if err := p.Host.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err) - } - return nil -} - -func (p *Annotation) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Annotation"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Annotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:timestamp: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.Timestamp)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamp (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:timestamp: ", p), err) - } - return err -} - -func (p *Annotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Value)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) - } - return err -} - -func (p *Annotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetHost() { - if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:host: ", p), err) - } - if err := p.Host.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:host: ", p), err) - } - } - return err -} - -func (p *Annotation) Equals(other *Annotation) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Timestamp != other.Timestamp { - return false - } - if p.Value != other.Value { - return false - } - if !p.Host.Equals(other.Host) { - return false - } - return true -} - -func (p *Annotation) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Annotation(%+v)", *p) -} - -// Binary annotations are tags applied to a Span to give it context. For -// example, a binary annotation of "http.uri" could the path to a resource in a -// RPC call. -// -// Binary annotations of type STRING are always queryable, though more a -// historical implementation detail than a structural concern. -// -// Binary annotations can repeat, and vary on the host. Similar to Annotation, -// the host indicates who logged the event. This allows you to tell the -// difference between the client and server side of the same key. For example, -// the key "http.uri" might be different on the client and server side due to -// rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field, -// you can see the different points of view, which often help in debugging. -// -// Attributes: -// - Key -// - Value -// - AnnotationType -// - Host: The host that recorded tag, which allows you to differentiate between -// multiple tags with the same key. There are two exceptions to this. -// -// When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or -// destination of an RPC. This exception allows zipkin to display network -// context of uninstrumented services, or clients such as web browsers. -type BinaryAnnotation struct { - Key string `thrift:"key,1" db:"key" json:"key"` - Value []byte `thrift:"value,2" db:"value" json:"value"` - AnnotationType AnnotationType `thrift:"annotation_type,3" db:"annotation_type" json:"annotation_type"` - Host *Endpoint `thrift:"host,4" db:"host" json:"host,omitempty"` -} - -func NewBinaryAnnotation() *BinaryAnnotation { - return &BinaryAnnotation{} -} - -func (p *BinaryAnnotation) GetKey() string { - return p.Key -} - -func (p *BinaryAnnotation) GetValue() []byte { - return p.Value -} - -func (p *BinaryAnnotation) GetAnnotationType() AnnotationType { - return p.AnnotationType -} - -var BinaryAnnotation_Host_DEFAULT *Endpoint - -func (p *BinaryAnnotation) GetHost() *Endpoint { - if !p.IsSetHost() { - return BinaryAnnotation_Host_DEFAULT - } - return p.Host -} -func (p *BinaryAnnotation) IsSetHost() bool { - return p.Host != nil -} - -func (p *BinaryAnnotation) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 2: - if fieldTypeId == thrift.STRING { - if err := p.ReadField2(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.I32 { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.STRUCT { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *BinaryAnnotation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Key = v - } - return nil -} - -func (p *BinaryAnnotation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBinary(ctx); err != nil { - return thrift.PrependError("error reading field 2: ", err) - } else { - p.Value = v - } - return nil -} - -func (p *BinaryAnnotation) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI32(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - temp := AnnotationType(v) - p.AnnotationType = temp - } - return nil -} - -func (p *BinaryAnnotation) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - p.Host = &Endpoint{} - if err := p.Host.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Host), err) - } - return nil -} - -func (p *BinaryAnnotation) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "BinaryAnnotation"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField2(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *BinaryAnnotation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "key", thrift.STRING, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:key: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Key)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.key (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:key: ", p), err) - } - return err -} - -func (p *BinaryAnnotation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "value", thrift.STRING, 2); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:value: ", p), err) - } - if err := oprot.WriteBinary(ctx, p.Value); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.value (2) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 2:value: ", p), err) - } - return err -} - -func (p *BinaryAnnotation) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "annotation_type", thrift.I32, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:annotation_type: ", p), err) - } - if err := oprot.WriteI32(ctx, int32(p.AnnotationType)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.annotation_type (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:annotation_type: ", p), err) - } - return err -} - -func (p *BinaryAnnotation) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetHost() { - if err := oprot.WriteFieldBegin(ctx, "host", thrift.STRUCT, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:host: ", p), err) - } - if err := p.Host.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Host), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:host: ", p), err) - } - } - return err -} - -func (p *BinaryAnnotation) Equals(other *BinaryAnnotation) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Key != other.Key { - return false - } - if bytes.Compare(p.Value, other.Value) != 0 { - return false - } - if p.AnnotationType != other.AnnotationType { - return false - } - if !p.Host.Equals(other.Host) { - return false - } - return true -} - -func (p *BinaryAnnotation) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("BinaryAnnotation(%+v)", *p) -} - -// A trace is a series of spans (often RPC calls) which form a latency tree. -// -// The root span is where trace_id = id and parent_id = Nil. The root span is -// usually the longest interval in the trace, starting with a SERVER_RECV -// annotation and ending with a SERVER_SEND. -// -// Attributes: -// - TraceID -// - Name: Span name in lowercase, rpc method for example -// -// Conventionally, when the span name isn't known, name = "unknown". -// - ID -// - ParentID -// - Annotations -// - BinaryAnnotations -// - Debug -// - Timestamp: Microseconds from epoch of the creation of this span. -// -// This value should be set directly by instrumentation, using the most -// precise value possible. For example, gettimeofday or syncing nanoTime -// against a tick of currentTimeMillis. -// -// For compatibility with instrumentation that precede this field, collectors -// or span stores can derive this via Annotation.timestamp. -// For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp. -// -// This field is optional for compatibility with old data: first-party span -// stores are expected to support this at time of introduction. -// - Duration: Measurement of duration in microseconds, used to support queries. -// -// This value should be set directly, where possible. Doing so encourages -// precise measurement decoupled from problems of clocks, such as skew or NTP -// updates causing time to move backwards. -// -// For compatibility with instrumentation that precede this field, collectors -// or span stores can derive this by subtracting Annotation.timestamp. -// For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp. -// -// If this field is persisted as unset, zipkin will continue to work, except -// duration query support will be implementation-specific. Similarly, setting -// this field non-atomically is implementation-specific. -// -// This field is i64 vs i32 to support spans longer than 35 minutes. -// - TraceIDHigh: Optional unique 8-byte additional identifier for a trace. If non zero, this -// means the trace uses 128 bit traceIds instead of 64 bit. -type Span struct { - TraceID int64 `thrift:"trace_id,1" db:"trace_id" json:"trace_id"` - // unused field # 2 - Name string `thrift:"name,3" db:"name" json:"name"` - ID int64 `thrift:"id,4" db:"id" json:"id"` - ParentID *int64 `thrift:"parent_id,5" db:"parent_id" json:"parent_id,omitempty"` - Annotations []*Annotation `thrift:"annotations,6" db:"annotations" json:"annotations"` - // unused field # 7 - BinaryAnnotations []*BinaryAnnotation `thrift:"binary_annotations,8" db:"binary_annotations" json:"binary_annotations"` - Debug bool `thrift:"debug,9" db:"debug" json:"debug"` - Timestamp *int64 `thrift:"timestamp,10" db:"timestamp" json:"timestamp,omitempty"` - Duration *int64 `thrift:"duration,11" db:"duration" json:"duration,omitempty"` - TraceIDHigh *int64 `thrift:"trace_id_high,12" db:"trace_id_high" json:"trace_id_high,omitempty"` -} - -func NewSpan() *Span { - return &Span{} -} - -func (p *Span) GetTraceID() int64 { - return p.TraceID -} - -func (p *Span) GetName() string { - return p.Name -} - -func (p *Span) GetID() int64 { - return p.ID -} - -var Span_ParentID_DEFAULT int64 - -func (p *Span) GetParentID() int64 { - if !p.IsSetParentID() { - return Span_ParentID_DEFAULT - } - return *p.ParentID -} - -func (p *Span) GetAnnotations() []*Annotation { - return p.Annotations -} - -func (p *Span) GetBinaryAnnotations() []*BinaryAnnotation { - return p.BinaryAnnotations -} - -var Span_Debug_DEFAULT bool = false - -func (p *Span) GetDebug() bool { - return p.Debug -} - -var Span_Timestamp_DEFAULT int64 - -func (p *Span) GetTimestamp() int64 { - if !p.IsSetTimestamp() { - return Span_Timestamp_DEFAULT - } - return *p.Timestamp -} - -var Span_Duration_DEFAULT int64 - -func (p *Span) GetDuration() int64 { - if !p.IsSetDuration() { - return Span_Duration_DEFAULT - } - return *p.Duration -} - -var Span_TraceIDHigh_DEFAULT int64 - -func (p *Span) GetTraceIDHigh() int64 { - if !p.IsSetTraceIDHigh() { - return Span_TraceIDHigh_DEFAULT - } - return *p.TraceIDHigh -} -func (p *Span) IsSetParentID() bool { - return p.ParentID != nil -} - -func (p *Span) IsSetDebug() bool { - return p.Debug != Span_Debug_DEFAULT -} - -func (p *Span) IsSetTimestamp() bool { - return p.Timestamp != nil -} - -func (p *Span) IsSetDuration() bool { - return p.Duration != nil -} - -func (p *Span) IsSetTraceIDHigh() bool { - return p.TraceIDHigh != nil -} - -func (p *Span) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.I64 { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 3: - if fieldTypeId == thrift.STRING { - if err := p.ReadField3(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 4: - if fieldTypeId == thrift.I64 { - if err := p.ReadField4(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 5: - if fieldTypeId == thrift.I64 { - if err := p.ReadField5(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 6: - if fieldTypeId == thrift.LIST { - if err := p.ReadField6(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 8: - if fieldTypeId == thrift.LIST { - if err := p.ReadField8(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 9: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField9(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 10: - if fieldTypeId == thrift.I64 { - if err := p.ReadField10(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 11: - if fieldTypeId == thrift.I64 { - if err := p.ReadField11(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - case 12: - if fieldTypeId == thrift.I64 { - if err := p.ReadField12(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *Span) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.TraceID = v - } - return nil -} - -func (p *Span) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadString(ctx); err != nil { - return thrift.PrependError("error reading field 3: ", err) - } else { - p.Name = v - } - return nil -} - -func (p *Span) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 4: ", err) - } else { - p.ID = v - } - return nil -} - -func (p *Span) ReadField5(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 5: ", err) - } else { - p.ParentID = &v - } - return nil -} - -func (p *Span) ReadField6(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Annotation, 0, size) - p.Annotations = tSlice - for i := 0; i < size; i++ { - _elem0 := &Annotation{} - if err := _elem0.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem0), err) - } - p.Annotations = append(p.Annotations, _elem0) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Span) ReadField8(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*BinaryAnnotation, 0, size) - p.BinaryAnnotations = tSlice - for i := 0; i < size; i++ { - _elem1 := &BinaryAnnotation{} - if err := _elem1.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem1), err) - } - p.BinaryAnnotations = append(p.BinaryAnnotations, _elem1) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *Span) ReadField9(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 9: ", err) - } else { - p.Debug = v - } - return nil -} - -func (p *Span) ReadField10(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 10: ", err) - } else { - p.Timestamp = &v - } - return nil -} - -func (p *Span) ReadField11(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 11: ", err) - } else { - p.Duration = &v - } - return nil -} - -func (p *Span) ReadField12(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadI64(ctx); err != nil { - return thrift.PrependError("error reading field 12: ", err) - } else { - p.TraceIDHigh = &v - } - return nil -} - -func (p *Span) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Span"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - if err := p.writeField3(ctx, oprot); err != nil { - return err - } - if err := p.writeField4(ctx, oprot); err != nil { - return err - } - if err := p.writeField5(ctx, oprot); err != nil { - return err - } - if err := p.writeField6(ctx, oprot); err != nil { - return err - } - if err := p.writeField8(ctx, oprot); err != nil { - return err - } - if err := p.writeField9(ctx, oprot); err != nil { - return err - } - if err := p.writeField10(ctx, oprot); err != nil { - return err - } - if err := p.writeField11(ctx, oprot); err != nil { - return err - } - if err := p.writeField12(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Span) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "trace_id", thrift.I64, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:trace_id: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.TraceID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.trace_id (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:trace_id: ", p), err) - } - return err -} - -func (p *Span) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "name", thrift.STRING, 3); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:name: ", p), err) - } - if err := oprot.WriteString(ctx, string(p.Name)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.name (3) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 3:name: ", p), err) - } - return err -} - -func (p *Span) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "id", thrift.I64, 4); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:id: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(p.ID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.id (4) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 4:id: ", p), err) - } - return err -} - -func (p *Span) writeField5(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetParentID() { - if err := oprot.WriteFieldBegin(ctx, "parent_id", thrift.I64, 5); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 5:parent_id: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.ParentID)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.parent_id (5) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 5:parent_id: ", p), err) - } - } - return err -} - -func (p *Span) writeField6(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "annotations", thrift.LIST, 6); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 6:annotations: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Annotations)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Annotations { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 6:annotations: ", p), err) - } - return err -} - -func (p *Span) writeField8(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "binary_annotations", thrift.LIST, 8); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 8:binary_annotations: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.BinaryAnnotations)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.BinaryAnnotations { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 8:binary_annotations: ", p), err) - } - return err -} - -func (p *Span) writeField9(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetDebug() { - if err := oprot.WriteFieldBegin(ctx, "debug", thrift.BOOL, 9); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 9:debug: ", p), err) - } - if err := oprot.WriteBool(ctx, bool(p.Debug)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.debug (9) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 9:debug: ", p), err) - } - } - return err -} - -func (p *Span) writeField10(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTimestamp() { - if err := oprot.WriteFieldBegin(ctx, "timestamp", thrift.I64, 10); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 10:timestamp: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.Timestamp)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.timestamp (10) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 10:timestamp: ", p), err) - } - } - return err -} - -func (p *Span) writeField11(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetDuration() { - if err := oprot.WriteFieldBegin(ctx, "duration", thrift.I64, 11); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 11:duration: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.Duration)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.duration (11) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 11:duration: ", p), err) - } - } - return err -} - -func (p *Span) writeField12(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetTraceIDHigh() { - if err := oprot.WriteFieldBegin(ctx, "trace_id_high", thrift.I64, 12); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 12:trace_id_high: ", p), err) - } - if err := oprot.WriteI64(ctx, int64(*p.TraceIDHigh)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.trace_id_high (12) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 12:trace_id_high: ", p), err) - } - } - return err -} - -func (p *Span) Equals(other *Span) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.TraceID != other.TraceID { - return false - } - if p.Name != other.Name { - return false - } - if p.ID != other.ID { - return false - } - if p.ParentID != other.ParentID { - if p.ParentID == nil || other.ParentID == nil { - return false - } - if (*p.ParentID) != (*other.ParentID) { - return false - } - } - if len(p.Annotations) != len(other.Annotations) { - return false - } - for i, _tgt := range p.Annotations { - _src2 := other.Annotations[i] - if !_tgt.Equals(_src2) { - return false - } - } - if len(p.BinaryAnnotations) != len(other.BinaryAnnotations) { - return false - } - for i, _tgt := range p.BinaryAnnotations { - _src3 := other.BinaryAnnotations[i] - if !_tgt.Equals(_src3) { - return false - } - } - if p.Debug != other.Debug { - return false - } - if p.Timestamp != other.Timestamp { - if p.Timestamp == nil || other.Timestamp == nil { - return false - } - if (*p.Timestamp) != (*other.Timestamp) { - return false - } - } - if p.Duration != other.Duration { - if p.Duration == nil || other.Duration == nil { - return false - } - if (*p.Duration) != (*other.Duration) { - return false - } - } - if p.TraceIDHigh != other.TraceIDHigh { - if p.TraceIDHigh == nil || other.TraceIDHigh == nil { - return false - } - if (*p.TraceIDHigh) != (*other.TraceIDHigh) { - return false - } - } - return true -} - -func (p *Span) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Span(%+v)", *p) -} - -// Attributes: -// - Ok -type Response struct { - Ok bool `thrift:"ok,1,required" db:"ok" json:"ok"` -} - -func NewResponse() *Response { - return &Response{} -} - -func (p *Response) GetOk() bool { - return p.Ok -} -func (p *Response) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - var issetOk bool = false - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.BOOL { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - issetOk = true - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - if !issetOk { - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Ok is not set")) - } - return nil -} - -func (p *Response) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - if v, err := iprot.ReadBool(ctx); err != nil { - return thrift.PrependError("error reading field 1: ", err) - } else { - p.Ok = v - } - return nil -} - -func (p *Response) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "Response"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *Response) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "ok", thrift.BOOL, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:ok: ", p), err) - } - if err := oprot.WriteBool(ctx, bool(p.Ok)); err != nil { - return thrift.PrependError(fmt.Sprintf("%T.ok (1) field write error: ", p), err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:ok: ", p), err) - } - return err -} - -func (p *Response) Equals(other *Response) bool { - if p == other { - return true - } else if p == nil || other == nil { - return false - } - if p.Ok != other.Ok { - return false - } - return true -} - -func (p *Response) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("Response(%+v)", *p) -} - -type ZipkinCollector interface { - // Parameters: - // - Spans - SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error) -} - -type ZipkinCollectorClient struct { - c thrift.TClient - meta thrift.ResponseMeta -} - -func NewZipkinCollectorClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ZipkinCollectorClient { - return &ZipkinCollectorClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} - -func NewZipkinCollectorClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ZipkinCollectorClient { - return &ZipkinCollectorClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} - -func NewZipkinCollectorClient(c thrift.TClient) *ZipkinCollectorClient { - return &ZipkinCollectorClient{ - c: c, - } -} - -func (p *ZipkinCollectorClient) Client_() thrift.TClient { - return p.c -} - -func (p *ZipkinCollectorClient) LastResponseMeta_() thrift.ResponseMeta { - return p.meta -} - -func (p *ZipkinCollectorClient) SetLastResponseMeta_(meta thrift.ResponseMeta) { - p.meta = meta -} - -// Parameters: -// - Spans -func (p *ZipkinCollectorClient) SubmitZipkinBatch(ctx context.Context, spans []*Span) (_r []*Response, _err error) { - var _args4 ZipkinCollectorSubmitZipkinBatchArgs - _args4.Spans = spans - var _result6 ZipkinCollectorSubmitZipkinBatchResult - var _meta5 thrift.ResponseMeta - _meta5, _err = p.Client_().Call(ctx, "submitZipkinBatch", &_args4, &_result6) - p.SetLastResponseMeta_(_meta5) - if _err != nil { - return - } - return _result6.GetSuccess(), nil -} - -type ZipkinCollectorProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler ZipkinCollector -} - -func (p *ZipkinCollectorProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *ZipkinCollectorProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *ZipkinCollectorProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewZipkinCollectorProcessor(handler ZipkinCollector) *ZipkinCollectorProcessor { - - self7 := &ZipkinCollectorProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self7.processorMap["submitZipkinBatch"] = &zipkinCollectorProcessorSubmitZipkinBatch{handler: handler} - return self7 -} - -func (p *ZipkinCollectorProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err2 := iprot.ReadMessageBegin(ctx) - if err2 != nil { - return false, thrift.WrapTException(err2) - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) - } - iprot.Skip(ctx, thrift.STRUCT) - iprot.ReadMessageEnd(ctx) - x8 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(ctx, name, thrift.EXCEPTION, seqId) - x8.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, x8 - -} - -type zipkinCollectorProcessorSubmitZipkinBatch struct { - handler ZipkinCollector -} - -func (p *zipkinCollectorProcessorSubmitZipkinBatch) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ZipkinCollectorSubmitZipkinBatchArgs{} - var err2 error - if err2 = args.Read(ctx, iprot); err2 != nil { - iprot.ReadMessageEnd(ctx) - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) - oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return false, thrift.WrapTException(err2) - } - iprot.ReadMessageEnd(ctx) - - tickerCancel := func() {} - // Start a goroutine to do server side connectivity check. - if thrift.ServerConnectivityCheckInterval > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - var tickerCtx context.Context - tickerCtx, tickerCancel = context.WithCancel(context.Background()) - defer tickerCancel() - go func(ctx context.Context, cancel context.CancelFunc) { - ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) - defer ticker.Stop() - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - if !iprot.Transport().IsOpen() { - cancel() - return - } - } - } - }(tickerCtx, cancel) - } - - result := ZipkinCollectorSubmitZipkinBatchResult{} - var retval []*Response - if retval, err2 = p.handler.SubmitZipkinBatch(ctx, args.Spans); err2 != nil { - tickerCancel() - if err2 == thrift.ErrAbandonRequest { - return false, thrift.WrapTException(err2) - } - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing submitZipkinBatch: "+err2.Error()) - oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.EXCEPTION, seqId) - x.Write(ctx, oprot) - oprot.WriteMessageEnd(ctx) - oprot.Flush(ctx) - return true, thrift.WrapTException(err2) - } else { - result.Success = retval - } - tickerCancel() - if err2 = oprot.WriteMessageBegin(ctx, "submitZipkinBatch", thrift.REPLY, seqId); err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = result.Write(ctx, oprot); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = oprot.WriteMessageEnd(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = thrift.WrapTException(err2) - } - if err != nil { - return - } - return true, err -} - -// HELPER FUNCTIONS AND STRUCTURES - -// Attributes: -// - Spans -type ZipkinCollectorSubmitZipkinBatchArgs struct { - Spans []*Span `thrift:"spans,1" db:"spans" json:"spans"` -} - -func NewZipkinCollectorSubmitZipkinBatchArgs() *ZipkinCollectorSubmitZipkinBatchArgs { - return &ZipkinCollectorSubmitZipkinBatchArgs{} -} - -func (p *ZipkinCollectorSubmitZipkinBatchArgs) GetSpans() []*Span { - return p.Spans -} -func (p *ZipkinCollectorSubmitZipkinBatchArgs) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 1: - if fieldTypeId == thrift.LIST { - if err := p.ReadField1(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchArgs) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Span, 0, size) - p.Spans = tSlice - for i := 0; i < size; i++ { - _elem9 := &Span{} - if err := _elem9.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem9), err) - } - p.Spans = append(p.Spans, _elem9) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchArgs) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_args"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField1(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchArgs) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { - if err := oprot.WriteFieldBegin(ctx, "spans", thrift.LIST, 1); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:spans: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Spans)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Spans { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 1:spans: ", p), err) - } - return err -} - -func (p *ZipkinCollectorSubmitZipkinBatchArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchArgs(%+v)", *p) -} - -// Attributes: -// - Success -type ZipkinCollectorSubmitZipkinBatchResult struct { - Success []*Response `thrift:"success,0" db:"success" json:"success,omitempty"` -} - -func NewZipkinCollectorSubmitZipkinBatchResult() *ZipkinCollectorSubmitZipkinBatchResult { - return &ZipkinCollectorSubmitZipkinBatchResult{} -} - -var ZipkinCollectorSubmitZipkinBatchResult_Success_DEFAULT []*Response - -func (p *ZipkinCollectorSubmitZipkinBatchResult) GetSuccess() []*Response { - return p.Success -} -func (p *ZipkinCollectorSubmitZipkinBatchResult) IsSetSuccess() bool { - return p.Success != nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchResult) Read(ctx context.Context, iprot thrift.TProtocol) error { - if _, err := iprot.ReadStructBegin(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) - } - - for { - _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) - } - if fieldTypeId == thrift.STOP { - break - } - switch fieldId { - case 0: - if fieldTypeId == thrift.LIST { - if err := p.ReadField0(ctx, iprot); err != nil { - return err - } - } else { - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - default: - if err := iprot.Skip(ctx, fieldTypeId); err != nil { - return err - } - } - if err := iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchResult) ReadField0(ctx context.Context, iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin(ctx) - if err != nil { - return thrift.PrependError("error reading list begin: ", err) - } - tSlice := make([]*Response, 0, size) - p.Success = tSlice - for i := 0; i < size; i++ { - _elem10 := &Response{} - if err := _elem10.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem10), err) - } - p.Success = append(p.Success, _elem10) - } - if err := iprot.ReadListEnd(ctx); err != nil { - return thrift.PrependError("error reading list end: ", err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchResult) Write(ctx context.Context, oprot thrift.TProtocol) error { - if err := oprot.WriteStructBegin(ctx, "submitZipkinBatch_result"); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) - } - if p != nil { - if err := p.writeField0(ctx, oprot); err != nil { - return err - } - } - if err := oprot.WriteFieldStop(ctx); err != nil { - return thrift.PrependError("write field stop error: ", err) - } - if err := oprot.WriteStructEnd(ctx); err != nil { - return thrift.PrependError("write struct stop error: ", err) - } - return nil -} - -func (p *ZipkinCollectorSubmitZipkinBatchResult) writeField0(ctx context.Context, oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err := oprot.WriteFieldBegin(ctx, "success", thrift.LIST, 0); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err) - } - if err := oprot.WriteListBegin(ctx, thrift.STRUCT, len(p.Success)); err != nil { - return thrift.PrependError("error writing list begin: ", err) - } - for _, v := range p.Success { - if err := v.Write(ctx, oprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", v), err) - } - } - if err := oprot.WriteListEnd(ctx); err != nil { - return thrift.PrependError("error writing list end: ", err) - } - if err := oprot.WriteFieldEnd(ctx); err != nil { - return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err) - } - } - return err -} - -func (p *ZipkinCollectorSubmitZipkinBatchResult) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ZipkinCollectorSubmitZipkinBatchResult(%+v)", *p) -} diff --git a/exporters/jaeger/internal/gen.go b/exporters/jaeger/internal/gen.go deleted file mode 100644 index ceb2b04e3d6..00000000000 --- a/exporters/jaeger/internal/gen.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/jaeger/internal" - -//go:generate gotmpl --body=../../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go -//go:generate gotmpl --body=../../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go -//go:generate gotmpl --body=../../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go - -//go:generate gotmpl --body=../../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/exporters/jaeger/internal/matchers\"}" --out=internaltest/harness.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go -//go:generate gotmpl --body=../../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go diff --git a/exporters/jaeger/internal/internaltest/alignment.go b/exporters/jaeger/internal/internaltest/alignment.go deleted file mode 100644 index 6885811cccc..00000000000 --- a/exporters/jaeger/internal/internaltest/alignment.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/alignment.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -/* -This file contains common utilities and objects to validate memory alignment -of Go types. The primary use of this functionality is intended to ensure -`struct` fields that need to be 64-bit aligned so they can be passed as -arguments to 64-bit atomic operations. - -The common workflow is to define a slice of `FieldOffset` and pass them to the -`Aligned8Byte` function from within a `TestMain` function from a package's -tests. It is important to make this call from the `TestMain` function prior -to running the rest of the test suit as it can provide useful diagnostics -about field alignment instead of ambiguous nil pointer dereference and runtime -panic. - -For more information: -https://github.com/open-telemetry/opentelemetry-go/issues/341 -*/ - -import ( - "fmt" - "io" -) - -// FieldOffset is a preprocessor representation of a struct field alignment. -type FieldOffset struct { - // Name of the field. - Name string - - // Offset of the field in bytes. - // - // To compute this at compile time use unsafe.Offsetof. - Offset uintptr -} - -// Aligned8Byte returns if all fields are aligned modulo 8-bytes. -// -// Error messaging is printed to out for any field determined misaligned. -func Aligned8Byte(fields []FieldOffset, out io.Writer) bool { - misaligned := make([]FieldOffset, 0) - for _, f := range fields { - if f.Offset%8 != 0 { - misaligned = append(misaligned, f) - } - } - - if len(misaligned) == 0 { - return true - } - - fmt.Fprintln(out, "struct fields not aligned for 64-bit atomic operations:") - for _, f := range misaligned { - fmt.Fprintf(out, " %s: %d-byte offset\n", f.Name, f.Offset) - } - - return false -} diff --git a/exporters/jaeger/internal/internaltest/env.go b/exporters/jaeger/internal/internaltest/env.go deleted file mode 100644 index 8f05ef4961d..00000000000 --- a/exporters/jaeger/internal/internaltest/env.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/env.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -import ( - "os" -) - -type Env struct { - Name string - Value string - Exists bool -} - -// EnvStore stores and recovers environment variables. -type EnvStore interface { - // Records the environment variable into the store. - Record(key string) - - // Restore recovers the environment variables in the store. - Restore() error -} - -var _ EnvStore = (*envStore)(nil) - -type envStore struct { - store map[string]Env -} - -func (s *envStore) add(env Env) { - s.store[env.Name] = env -} - -func (s *envStore) Restore() error { - var err error - for _, v := range s.store { - if v.Exists { - err = os.Setenv(v.Name, v.Value) - } else { - err = os.Unsetenv(v.Name) - } - if err != nil { - return err - } - } - return nil -} - -func (s *envStore) setEnv(key, value string) error { - s.Record(key) - - err := os.Setenv(key, value) - if err != nil { - return err - } - return nil -} - -func (s *envStore) Record(key string) { - originValue, exists := os.LookupEnv(key) - s.add(Env{ - Name: key, - Value: originValue, - Exists: exists, - }) -} - -func NewEnvStore() EnvStore { - return newEnvStore() -} - -func newEnvStore() *envStore { - return &envStore{store: make(map[string]Env)} -} - -func SetEnvVariables(env map[string]string) (EnvStore, error) { - envStore := newEnvStore() - - for k, v := range env { - err := envStore.setEnv(k, v) - if err != nil { - return nil, err - } - } - return envStore, nil -} diff --git a/exporters/jaeger/internal/internaltest/env_test.go b/exporters/jaeger/internal/internaltest/env_test.go deleted file mode 100644 index dc4dcea8e30..00000000000 --- a/exporters/jaeger/internal/internaltest/env_test.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/env_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" -) - -type EnvStoreTestSuite struct { - suite.Suite -} - -func (s *EnvStoreTestSuite) Test_add() { - envStore := newEnvStore() - - e := Env{ - Name: "name", - Value: "value", - Exists: true, - } - envStore.add(e) - envStore.add(e) - - s.Assert().Len(envStore.store, 1) -} - -func (s *EnvStoreTestSuite) TestRecord() { - testCases := []struct { - name string - env Env - expectedEnvStore *envStore - }{ - { - name: "record exists env", - env: Env{ - Name: "name", - Value: "value", - Exists: true, - }, - expectedEnvStore: &envStore{store: map[string]Env{ - "name": { - Name: "name", - Value: "value", - Exists: true, - }, - }}, - }, - { - name: "record exists env, but its value is empty", - env: Env{ - Name: "name", - Value: "", - Exists: true, - }, - expectedEnvStore: &envStore{store: map[string]Env{ - "name": { - Name: "name", - Value: "", - Exists: true, - }, - }}, - }, - { - name: "record not exists env", - env: Env{ - Name: "name", - Exists: false, - }, - expectedEnvStore: &envStore{store: map[string]Env{ - "name": { - Name: "name", - Exists: false, - }, - }}, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - if tc.env.Exists { - s.Assert().NoError(os.Setenv(tc.env.Name, tc.env.Value)) - } - - envStore := newEnvStore() - envStore.Record(tc.env.Name) - - s.Assert().Equal(tc.expectedEnvStore, envStore) - - if tc.env.Exists { - s.Assert().NoError(os.Unsetenv(tc.env.Name)) - } - }) - } -} - -func (s *EnvStoreTestSuite) TestRestore() { - testCases := []struct { - name string - env Env - expectedEnvValue string - expectedEnvExists bool - }{ - { - name: "exists env", - env: Env{ - Name: "name", - Value: "value", - Exists: true, - }, - expectedEnvValue: "value", - expectedEnvExists: true, - }, - { - name: "no exists env", - env: Env{ - Name: "name", - Exists: false, - }, - expectedEnvExists: false, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - envStore := newEnvStore() - envStore.add(tc.env) - - // Backup - backup := newEnvStore() - backup.Record(tc.env.Name) - - s.Require().NoError(os.Unsetenv(tc.env.Name)) - - s.Assert().NoError(envStore.Restore()) - v, exists := os.LookupEnv(tc.env.Name) - s.Assert().Equal(tc.expectedEnvValue, v) - s.Assert().Equal(tc.expectedEnvExists, exists) - - // Restore - s.Require().NoError(backup.Restore()) - }) - } -} - -func (s *EnvStoreTestSuite) Test_setEnv() { - testCases := []struct { - name string - key string - value string - expectedEnvStore *envStore - expectedEnvValue string - expectedEnvExists bool - }{ - { - name: "normal", - key: "name", - value: "value", - expectedEnvStore: &envStore{store: map[string]Env{ - "name": { - Name: "name", - Value: "other value", - Exists: true, - }, - }}, - expectedEnvValue: "value", - expectedEnvExists: true, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - envStore := newEnvStore() - - // Backup - backup := newEnvStore() - backup.Record(tc.key) - - s.Require().NoError(os.Setenv(tc.key, "other value")) - - s.Assert().NoError(envStore.setEnv(tc.key, tc.value)) - s.Assert().Equal(tc.expectedEnvStore, envStore) - v, exists := os.LookupEnv(tc.key) - s.Assert().Equal(tc.expectedEnvValue, v) - s.Assert().Equal(tc.expectedEnvExists, exists) - - // Restore - s.Require().NoError(backup.Restore()) - }) - } -} - -func TestEnvStoreTestSuite(t *testing.T) { - suite.Run(t, new(EnvStoreTestSuite)) -} - -func TestSetEnvVariables(t *testing.T) { - envs := map[string]string{ - "name1": "value1", - "name2": "value2", - } - - // Backup - backup := newEnvStore() - for k := range envs { - backup.Record(k) - } - defer func() { - require.NoError(t, backup.Restore()) - }() - - store, err := SetEnvVariables(envs) - assert.NoError(t, err) - require.IsType(t, &envStore{}, store) - concreteStore := store.(*envStore) - assert.Len(t, concreteStore.store, 2) - assert.Equal(t, backup, concreteStore) -} diff --git a/exporters/jaeger/internal/internaltest/errors.go b/exporters/jaeger/internal/internaltest/errors.go deleted file mode 100644 index 71d48fdf6e8..00000000000 --- a/exporters/jaeger/internal/internaltest/errors.go +++ /dev/null @@ -1,30 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/errors.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -type TestError string - -var _ error = TestError("") - -func NewTestError(s string) error { - return TestError(s) -} - -func (e TestError) Error() string { - return string(e) -} diff --git a/exporters/jaeger/internal/internaltest/harness.go b/exporters/jaeger/internal/internaltest/harness.go deleted file mode 100644 index a938e733965..00000000000 --- a/exporters/jaeger/internal/internaltest/harness.go +++ /dev/null @@ -1,344 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/harness.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -import ( - "context" - "fmt" - "sync" - "testing" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" - "go.opentelemetry.io/otel/trace" -) - -// Harness is a testing harness used to test implementations of the -// OpenTelemetry API. -type Harness struct { - t *testing.T -} - -// NewHarness returns an instantiated *Harness using t. -func NewHarness(t *testing.T) *Harness { - return &Harness{ - t: t, - } -} - -// TestTracerProvider runs validation tests for an implementation of the OpenTelemetry -// TracerProvider API. -func (h *Harness) TestTracerProvider(subjectFactory func() trace.TracerProvider) { - h.t.Run("#Start", func(t *testing.T) { - t.Run("allow creating an arbitrary number of TracerProvider instances", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - - tp1 := subjectFactory() - tp2 := subjectFactory() - - e.Expect(tp1).NotToEqual(tp2) - }) - t.Run("all methods are safe to be called concurrently", func(t *testing.T) { - t.Parallel() - - runner := func(tp trace.TracerProvider) <-chan struct{} { - done := make(chan struct{}) - go func(tp trace.TracerProvider) { - var wg sync.WaitGroup - for i := 0; i < 20; i++ { - wg.Add(1) - go func(name, version string) { - _ = tp.Tracer(name, trace.WithInstrumentationVersion(version)) - wg.Done() - }(fmt.Sprintf("tracer %d", i%5), fmt.Sprintf("%d", i)) - } - wg.Wait() - done <- struct{}{} - }(tp) - return done - } - - matchers.NewExpecter(t).Expect(func() { - // Run with multiple TracerProvider to ensure they encapsulate - // their own Tracers. - tp1 := subjectFactory() - tp2 := subjectFactory() - - done1 := runner(tp1) - done2 := runner(tp2) - - <-done1 - <-done2 - }).NotToPanic() - }) - }) -} - -// TestTracer runs validation tests for an implementation of the OpenTelemetry -// Tracer API. -func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { - h.t.Run("#Start", func(t *testing.T) { - t.Run("propagates the original context", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - ctxKey := testCtxKey{} - ctxValue := "ctx value" - ctx := context.WithValue(context.Background(), ctxKey, ctxValue) - - ctx, _ = subject.Start(ctx, "test") - - e.Expect(ctx.Value(ctxKey)).ToEqual(ctxValue) - }) - - t.Run("returns a span containing the expected properties", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - _, span := subject.Start(context.Background(), "test") - - e.Expect(span).NotToBeNil() - - e.Expect(span.SpanContext().IsValid()).ToBeTrue() - }) - - t.Run("stores the span on the provided context", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - ctx, span := subject.Start(context.Background(), "test") - - e.Expect(span).NotToBeNil() - e.Expect(span.SpanContext()).NotToEqual(trace.SpanContext{}) - e.Expect(trace.SpanFromContext(ctx)).ToEqual(span) - }) - - t.Run("starts spans with unique trace and span IDs", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - _, span1 := subject.Start(context.Background(), "span1") - _, span2 := subject.Start(context.Background(), "span2") - - sc1 := span1.SpanContext() - sc2 := span2.SpanContext() - - e.Expect(sc1.TraceID()).NotToEqual(sc2.TraceID()) - e.Expect(sc1.SpanID()).NotToEqual(sc2.SpanID()) - }) - - t.Run("propagates a parent's trace ID through the context", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - ctx, parent := subject.Start(context.Background(), "parent") - _, child := subject.Start(ctx, "child") - - psc := parent.SpanContext() - csc := child.SpanContext() - - e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) - e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) - }) - - t.Run("ignores parent's trace ID when new root is requested", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - ctx, parent := subject.Start(context.Background(), "parent") - _, child := subject.Start(ctx, "child", trace.WithNewRoot()) - - psc := parent.SpanContext() - csc := child.SpanContext() - - e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) - e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) - }) - - t.Run("propagates remote parent's trace ID through the context", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - _, remoteParent := subject.Start(context.Background(), "remote parent") - parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) - _, child := subject.Start(parentCtx, "child") - - psc := remoteParent.SpanContext() - csc := child.SpanContext() - - e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) - e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) - }) - - t.Run("ignores remote parent's trace ID when new root is requested", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - subject := subjectFactory() - - _, remoteParent := subject.Start(context.Background(), "remote parent") - parentCtx := trace.ContextWithRemoteSpanContext(context.Background(), remoteParent.SpanContext()) - _, child := subject.Start(parentCtx, "child", trace.WithNewRoot()) - - psc := remoteParent.SpanContext() - csc := child.SpanContext() - - e.Expect(csc.TraceID()).NotToEqual(psc.TraceID()) - e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) - }) - - t.Run("all methods are safe to be called concurrently", func(t *testing.T) { - t.Parallel() - - e := matchers.NewExpecter(t) - tracer := subjectFactory() - - ctx, parent := tracer.Start(context.Background(), "span") - - runner := func(tp trace.Tracer) <-chan struct{} { - done := make(chan struct{}) - go func(tp trace.Tracer) { - var wg sync.WaitGroup - for i := 0; i < 20; i++ { - wg.Add(1) - go func(name string) { - defer wg.Done() - _, child := tp.Start(ctx, name) - - psc := parent.SpanContext() - csc := child.SpanContext() - - e.Expect(csc.TraceID()).ToEqual(psc.TraceID()) - e.Expect(csc.SpanID()).NotToEqual(psc.SpanID()) - }(fmt.Sprintf("span %d", i)) - } - wg.Wait() - done <- struct{}{} - }(tp) - return done - } - - e.Expect(func() { - done := runner(tracer) - - <-done - }).NotToPanic() - }) - }) - - h.testSpan(subjectFactory) -} - -func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { - var methods = map[string]func(span trace.Span){ - "#End": func(span trace.Span) { - span.End() - }, - "#AddEvent": func(span trace.Span) { - span.AddEvent("test event") - }, - "#AddEventWithTimestamp": func(span trace.Span) { - span.AddEvent("test event", trace.WithTimestamp(time.Now().Add(1*time.Second))) - }, - "#SetStatus": func(span trace.Span) { - span.SetStatus(codes.Error, "internal") - }, - "#SetName": func(span trace.Span) { - span.SetName("new name") - }, - "#SetAttributes": func(span trace.Span) { - span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) - }, - } - var mechanisms = map[string]func() trace.Span{ - "Span created via Tracer#Start": func() trace.Span { - tracer := tracerFactory() - _, subject := tracer.Start(context.Background(), "test") - - return subject - }, - "Span created via span.TracerProvider()": func() trace.Span { - ctx, spanA := tracerFactory().Start(context.Background(), "span1") - - _, spanB := spanA.TracerProvider().Tracer("second").Start(ctx, "span2") - return spanB - }, - } - - for mechanismName, mechanism := range mechanisms { - h.t.Run(mechanismName, func(t *testing.T) { - for methodName, method := range methods { - t.Run(methodName, func(t *testing.T) { - t.Run("is thread-safe", func(t *testing.T) { - t.Parallel() - - span := mechanism() - - wg := &sync.WaitGroup{} - wg.Add(2) - - go func() { - defer wg.Done() - - method(span) - }() - - go func() { - defer wg.Done() - - method(span) - }() - - wg.Wait() - }) - }) - } - - t.Run("#End", func(t *testing.T) { - t.Run("can be called multiple times", func(t *testing.T) { - t.Parallel() - - span := mechanism() - - span.End() - span.End() - }) - }) - }) - } -} - -type testCtxKey struct{} diff --git a/exporters/jaeger/internal/internaltest/text_map_carrier.go b/exporters/jaeger/internal/internaltest/text_map_carrier.go deleted file mode 100644 index 5c70e789765..00000000000 --- a/exporters/jaeger/internal/internaltest/text_map_carrier.go +++ /dev/null @@ -1,144 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/text_map_carrier.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -import ( - "sync" - "testing" - - "go.opentelemetry.io/otel/propagation" -) - -// TextMapCarrier is a storage medium for a TextMapPropagator used in testing. -// The methods of a TextMapCarrier are concurrent safe. -type TextMapCarrier struct { - mtx sync.Mutex - - gets []string - sets [][2]string - data map[string]string -} - -var _ propagation.TextMapCarrier = (*TextMapCarrier)(nil) - -// NewTextMapCarrier returns a new *TextMapCarrier populated with data. -func NewTextMapCarrier(data map[string]string) *TextMapCarrier { - copied := make(map[string]string, len(data)) - for k, v := range data { - copied[k] = v - } - return &TextMapCarrier{data: copied} -} - -// Keys returns the keys for which this carrier has a value. -func (c *TextMapCarrier) Keys() []string { - c.mtx.Lock() - defer c.mtx.Unlock() - - result := make([]string, 0, len(c.data)) - for k := range c.data { - result = append(result, k) - } - return result -} - -// Get returns the value associated with the passed key. -func (c *TextMapCarrier) Get(key string) string { - c.mtx.Lock() - defer c.mtx.Unlock() - c.gets = append(c.gets, key) - return c.data[key] -} - -// GotKey tests if c.Get has been called for key. -func (c *TextMapCarrier) GotKey(t *testing.T, key string) bool { - c.mtx.Lock() - defer c.mtx.Unlock() - for _, k := range c.gets { - if k == key { - return true - } - } - t.Errorf("TextMapCarrier.Get(%q) has not been called", key) - return false -} - -// GotN tests if n calls to c.Get have been made. -func (c *TextMapCarrier) GotN(t *testing.T, n int) bool { - c.mtx.Lock() - defer c.mtx.Unlock() - if len(c.gets) != n { - t.Errorf("TextMapCarrier.Get was called %d times, not %d", len(c.gets), n) - return false - } - return true -} - -// Set stores the key-value pair. -func (c *TextMapCarrier) Set(key, value string) { - c.mtx.Lock() - defer c.mtx.Unlock() - c.sets = append(c.sets, [2]string{key, value}) - c.data[key] = value -} - -// SetKeyValue tests if c.Set has been called for the key-value pair. -func (c *TextMapCarrier) SetKeyValue(t *testing.T, key, value string) bool { - c.mtx.Lock() - defer c.mtx.Unlock() - var vals []string - for _, pair := range c.sets { - if key == pair[0] { - if value == pair[1] { - return true - } - vals = append(vals, pair[1]) - } - } - if len(vals) > 0 { - t.Errorf("TextMapCarrier.Set called with %q and %v values, but not %s", key, vals, value) - } - t.Errorf("TextMapCarrier.Set(%q,%q) has not been called", key, value) - return false -} - -// SetN tests if n calls to c.Set have been made. -func (c *TextMapCarrier) SetN(t *testing.T, n int) bool { - c.mtx.Lock() - defer c.mtx.Unlock() - if len(c.sets) != n { - t.Errorf("TextMapCarrier.Set was called %d times, not %d", len(c.sets), n) - return false - } - return true -} - -// Reset zeros out the recording state and sets the carried values to data. -func (c *TextMapCarrier) Reset(data map[string]string) { - copied := make(map[string]string, len(data)) - for k, v := range data { - copied[k] = v - } - - c.mtx.Lock() - defer c.mtx.Unlock() - - c.gets = nil - c.sets = nil - c.data = copied -} diff --git a/exporters/jaeger/internal/internaltest/text_map_carrier_test.go b/exporters/jaeger/internal/internaltest/text_map_carrier_test.go deleted file mode 100644 index faf713cc2d0..00000000000 --- a/exporters/jaeger/internal/internaltest/text_map_carrier_test.go +++ /dev/null @@ -1,86 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/text_map_carrier_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest - -import ( - "reflect" - "testing" -) - -var ( - key, value = "test", "true" -) - -func TestTextMapCarrierKeys(t *testing.T) { - tmc := NewTextMapCarrier(map[string]string{key: value}) - expected, actual := []string{key}, tmc.Keys() - if !reflect.DeepEqual(actual, expected) { - t.Errorf("expected tmc.Keys() to be %v but it was %v", expected, actual) - } -} - -func TestTextMapCarrierGet(t *testing.T) { - tmc := NewTextMapCarrier(map[string]string{key: value}) - tmc.GotN(t, 0) - if got := tmc.Get("empty"); got != "" { - t.Errorf("TextMapCarrier.Get returned %q for an empty key", got) - } - tmc.GotKey(t, "empty") - tmc.GotN(t, 1) - if got := tmc.Get(key); got != value { - t.Errorf("TextMapCarrier.Get(%q) returned %q, want %q", key, got, value) - } - tmc.GotKey(t, key) - tmc.GotN(t, 2) -} - -func TestTextMapCarrierSet(t *testing.T) { - tmc := NewTextMapCarrier(nil) - tmc.SetN(t, 0) - tmc.Set(key, value) - if got, ok := tmc.data[key]; !ok { - t.Errorf("TextMapCarrier.Set(%q,%q) failed to store pair", key, value) - } else if got != value { - t.Errorf("TextMapCarrier.Set(%q,%q) stored (%q,%q), not (%q,%q)", key, value, key, got, key, value) - } - tmc.SetKeyValue(t, key, value) - tmc.SetN(t, 1) -} - -func TestTextMapCarrierReset(t *testing.T) { - tmc := NewTextMapCarrier(map[string]string{key: value}) - tmc.GotN(t, 0) - tmc.SetN(t, 0) - tmc.Reset(nil) - tmc.GotN(t, 0) - tmc.SetN(t, 0) - if got := tmc.Get(key); got != "" { - t.Error("TextMapCarrier.Reset() failed to clear initial data") - } - tmc.GotN(t, 1) - tmc.GotKey(t, key) - tmc.Set(key, value) - tmc.SetKeyValue(t, key, value) - tmc.SetN(t, 1) - tmc.Reset(nil) - tmc.GotN(t, 0) - tmc.SetN(t, 0) - if got := tmc.Get(key); got != "" { - t.Error("TextMapCarrier.Reset() failed to clear data") - } -} diff --git a/exporters/jaeger/internal/internaltest/text_map_propagator.go b/exporters/jaeger/internal/internaltest/text_map_propagator.go deleted file mode 100644 index c1c22117a06..00000000000 --- a/exporters/jaeger/internal/internaltest/text_map_propagator.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/text_map_propagator.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest // import "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - -import ( - "context" - "fmt" - "strconv" - "strings" - "testing" - - "go.opentelemetry.io/otel/propagation" -) - -type ctxKeyType string - -type state struct { - Injections uint64 - Extractions uint64 -} - -func newState(encoded string) state { - if encoded == "" { - return state{} - } - s0, s1, _ := strings.Cut(encoded, ",") - injects, _ := strconv.ParseUint(s0, 10, 64) - extracts, _ := strconv.ParseUint(s1, 10, 64) - return state{ - Injections: injects, - Extractions: extracts, - } -} - -func (s state) String() string { - return fmt.Sprintf("%d,%d", s.Injections, s.Extractions) -} - -// TextMapPropagator is a propagation.TextMapPropagator used for testing. -type TextMapPropagator struct { - name string - ctxKey ctxKeyType -} - -var _ propagation.TextMapPropagator = (*TextMapPropagator)(nil) - -// NewTextMapPropagator returns a new TextMapPropagator for testing. It will -// use name as the key it injects into a TextMapCarrier when Inject is called. -func NewTextMapPropagator(name string) *TextMapPropagator { - return &TextMapPropagator{name: name, ctxKey: ctxKeyType(name)} -} - -func (p *TextMapPropagator) stateFromContext(ctx context.Context) state { - if v := ctx.Value(p.ctxKey); v != nil { - if s, ok := v.(state); ok { - return s - } - } - return state{} -} - -func (p *TextMapPropagator) stateFromCarrier(carrier propagation.TextMapCarrier) state { - return newState(carrier.Get(p.name)) -} - -// Inject sets cross-cutting concerns for p from ctx into carrier. -func (p *TextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { - s := p.stateFromContext(ctx) - s.Injections++ - carrier.Set(p.name, s.String()) -} - -// InjectedN tests if p has made n injections to carrier. -func (p *TextMapPropagator) InjectedN(t *testing.T, carrier *TextMapCarrier, n int) bool { - if actual := p.stateFromCarrier(carrier).Injections; actual != uint64(n) { - t.Errorf("TextMapPropagator{%q} injected %d times, not %d", p.name, actual, n) - return false - } - return true -} - -// Extract reads cross-cutting concerns for p from carrier into ctx. -func (p *TextMapPropagator) Extract(ctx context.Context, carrier propagation.TextMapCarrier) context.Context { - s := p.stateFromCarrier(carrier) - s.Extractions++ - return context.WithValue(ctx, p.ctxKey, s) -} - -// ExtractedN tests if p has made n extractions from the lineage of ctx. -// nolint (context is not first arg) -func (p *TextMapPropagator) ExtractedN(t *testing.T, ctx context.Context, n int) bool { - if actual := p.stateFromContext(ctx).Extractions; actual != uint64(n) { - t.Errorf("TextMapPropagator{%q} extracted %d time, not %d", p.name, actual, n) - return false - } - return true -} - -// Fields returns the name of p as the key who's value is set with Inject. -func (p *TextMapPropagator) Fields() []string { return []string{p.name} } diff --git a/exporters/jaeger/internal/internaltest/text_map_propagator_test.go b/exporters/jaeger/internal/internaltest/text_map_propagator_test.go deleted file mode 100644 index babcc95fc1b..00000000000 --- a/exporters/jaeger/internal/internaltest/text_map_propagator_test.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/internaltest/text_map_propagator_test.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internaltest - -import ( - "context" - "testing" -) - -func TestTextMapPropagatorInjectExtract(t *testing.T) { - name := "testing" - ctx := context.Background() - carrier := NewTextMapCarrier(map[string]string{name: value}) - propagator := NewTextMapPropagator(name) - - propagator.Inject(ctx, carrier) - // Carrier value overridden with state. - if carrier.SetKeyValue(t, name, "1,0") { - // Ensure nothing has been extracted yet. - propagator.ExtractedN(t, ctx, 0) - // Test the injection was counted. - propagator.InjectedN(t, carrier, 1) - } - - ctx = propagator.Extract(ctx, carrier) - v := ctx.Value(ctxKeyType(name)) - if v == nil { - t.Error("TextMapPropagator.Extract failed to extract state") - } - if s, ok := v.(state); !ok { - t.Error("TextMapPropagator.Extract did not extract proper state") - } else if s.Extractions != 1 { - t.Error("TextMapPropagator.Extract did not increment state.Extractions") - } - if carrier.GotKey(t, name) { - // Test the extraction was counted. - propagator.ExtractedN(t, ctx, 1) - // Ensure no additional injection was recorded. - propagator.InjectedN(t, carrier, 1) - } -} - -func TestTextMapPropagatorFields(t *testing.T) { - name := "testing" - propagator := NewTextMapPropagator(name) - if got := propagator.Fields(); len(got) != 1 { - t.Errorf("TextMapPropagator.Fields returned %d fields, want 1", len(got)) - } else if got[0] != name { - t.Errorf("TextMapPropagator.Fields returned %q, want %q", got[0], name) - } -} - -func TestNewStateEmpty(t *testing.T) { - if want, got := (state{}), newState(""); got != want { - t.Errorf("newState(\"\") returned %v, want %v", got, want) - } -} diff --git a/exporters/jaeger/internal/matchers/expectation.go b/exporters/jaeger/internal/matchers/expectation.go deleted file mode 100644 index 8b1ab860867..00000000000 --- a/exporters/jaeger/internal/matchers/expectation.go +++ /dev/null @@ -1,310 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/matchers/expectation.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" - -import ( - "fmt" - "reflect" - "regexp" - "runtime/debug" - "strings" - "testing" - "time" -) - -var ( - stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) -) - -type Expectation struct { - t *testing.T - actual interface{} -} - -func (e *Expectation) ToEqual(expected interface{}) { - e.verifyExpectedNotNil(expected) - - if !reflect.DeepEqual(e.actual, expected) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto equal\n\t%v", e.actual, expected)) - } -} - -func (e *Expectation) NotToEqual(expected interface{}) { - e.verifyExpectedNotNil(expected) - - if reflect.DeepEqual(e.actual, expected) { - e.fail(fmt.Sprintf("Expected\n\t%v\nnot to equal\n\t%v", e.actual, expected)) - } -} - -func (e *Expectation) ToBeNil() { - if e.actual != nil { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be nil", e.actual)) - } -} - -func (e *Expectation) NotToBeNil() { - if e.actual == nil { - e.fail(fmt.Sprintf("Expected\n\t%v\nnot to be nil", e.actual)) - } -} - -func (e *Expectation) ToBeTrue() { - switch a := e.actual.(type) { - case bool: - if !a { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be true", e.actual)) - } - default: - e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) - } -} - -func (e *Expectation) ToBeFalse() { - switch a := e.actual.(type) { - case bool: - if a { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be false", e.actual)) - } - default: - e.fail(fmt.Sprintf("Cannot check if non-bool value\n\t%v\nis truthy", a)) - } -} - -func (e *Expectation) NotToPanic() { - switch a := e.actual.(type) { - case func(): - func() { - defer func() { - if recovered := recover(); recovered != nil { - e.fail(fmt.Sprintf("Expected panic\n\t%v\nto have not been raised", recovered)) - } - }() - - a() - }() - default: - e.fail(fmt.Sprintf("Cannot check if non-func value\n\t%v\nis truthy", a)) - } -} - -func (e *Expectation) ToSucceed() { - switch actual := e.actual.(type) { - case error: - if actual != nil { - e.fail(fmt.Sprintf("Expected error\n\t%v\nto have succeeded", actual)) - } - default: - e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nsucceeded", actual)) - } -} - -func (e *Expectation) ToMatchError(expected interface{}) { - e.verifyExpectedNotNil(expected) - - actual, ok := e.actual.(error) - if !ok { - e.fail(fmt.Sprintf("Cannot check if non-error value\n\t%v\nmatches error", e.actual)) - } - - switch expected := expected.(type) { - case error: - if !reflect.DeepEqual(actual, expected) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) - } - case string: - if actual.Error() != expected { - e.fail(fmt.Sprintf("Expected\n\t%v\nto match error\n\t%v", actual, expected)) - } - default: - e.fail(fmt.Sprintf("Cannot match\n\t%v\nagainst non-error\n\t%v", actual, expected)) - } -} - -func (e *Expectation) ToContain(expected interface{}) { - actualValue := reflect.ValueOf(e.actual) - actualKind := actualValue.Kind() - - switch actualKind { - case reflect.Array, reflect.Slice: - default: - e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) - return - } - - expectedValue := reflect.ValueOf(expected) - expectedKind := expectedValue.Kind() - - switch expectedKind { - case reflect.Array, reflect.Slice: - default: - expectedValue = reflect.ValueOf([]interface{}{expected}) - } - - for i := 0; i < expectedValue.Len(); i++ { - var contained bool - expectedElem := expectedValue.Index(i).Interface() - - for j := 0; j < actualValue.Len(); j++ { - if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { - contained = true - break - } - } - - if !contained { - e.fail(fmt.Sprintf("Expected\n\t%v\nto contain\n\t%v", e.actual, expectedElem)) - return - } - } -} - -func (e *Expectation) NotToContain(expected interface{}) { - actualValue := reflect.ValueOf(e.actual) - actualKind := actualValue.Kind() - - switch actualKind { - case reflect.Array, reflect.Slice: - default: - e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", e.actual)) - return - } - - expectedValue := reflect.ValueOf(expected) - expectedKind := expectedValue.Kind() - - switch expectedKind { - case reflect.Array, reflect.Slice: - default: - expectedValue = reflect.ValueOf([]interface{}{expected}) - } - - for i := 0; i < expectedValue.Len(); i++ { - expectedElem := expectedValue.Index(i).Interface() - - for j := 0; j < actualValue.Len(); j++ { - if reflect.DeepEqual(actualValue.Index(j).Interface(), expectedElem) { - e.fail(fmt.Sprintf("Expected\n\t%v\nnot to contain\n\t%v", e.actual, expectedElem)) - return - } - } - } -} - -func (e *Expectation) ToMatchInAnyOrder(expected interface{}) { - expectedValue := reflect.ValueOf(expected) - expectedKind := expectedValue.Kind() - - switch expectedKind { - case reflect.Array, reflect.Slice: - default: - e.fail(fmt.Sprintf("Expected\n\t%v\nto be an array", expected)) - return - } - - actualValue := reflect.ValueOf(e.actual) - actualKind := actualValue.Kind() - - if actualKind != expectedKind { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be the same type as\n\t%v", e.actual, expected)) - return - } - - if actualValue.Len() != expectedValue.Len() { - e.fail(fmt.Sprintf("Expected\n\t%v\nto have the same length as\n\t%v", e.actual, expected)) - return - } - - var unmatched []interface{} - - for i := 0; i < expectedValue.Len(); i++ { - unmatched = append(unmatched, expectedValue.Index(i).Interface()) - } - - for i := 0; i < actualValue.Len(); i++ { - var found bool - - for j, elem := range unmatched { - if reflect.DeepEqual(actualValue.Index(i).Interface(), elem) { - found = true - unmatched = append(unmatched[:j], unmatched[j+1:]...) - - break - } - } - - if !found { - e.fail(fmt.Sprintf("Expected\n\t%v\nto contain the same elements as\n\t%v", e.actual, expected)) - } - } -} - -func (e *Expectation) ToBeTemporally(matcher TemporalMatcher, compareTo interface{}) { - if actual, ok := e.actual.(time.Time); ok { - ct, ok := compareTo.(time.Time) - if !ok { - e.fail(fmt.Sprintf("Cannot compare to non-temporal value\n\t%v", compareTo)) - return - } - - switch matcher { - case Before: - if !actual.Before(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before\n\t%v", e.actual, compareTo)) - } - case BeforeOrSameTime: - if actual.After(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally before or at the same time as\n\t%v", e.actual, compareTo)) - } - case After: - if !actual.After(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after\n\t%v", e.actual, compareTo)) - } - case AfterOrSameTime: - if actual.Before(ct) { - e.fail(fmt.Sprintf("Expected\n\t%v\nto be temporally after or at the same time as\n\t%v", e.actual, compareTo)) - } - default: - e.fail("Cannot compare times with unexpected temporal matcher") - } - - return - } - - e.fail(fmt.Sprintf("Cannot compare non-temporal value\n\t%v", e.actual)) -} - -func (e *Expectation) verifyExpectedNotNil(expected interface{}) { - if expected == nil { - e.fail("Refusing to compare with . Use `ToBeNil` or `NotToBeNil` instead.") - } -} - -func (e *Expectation) fail(msg string) { - // Prune the stack trace so that it's easier to see relevant lines - stack := strings.Split(string(debug.Stack()), "\n") - var prunedStack []string - - for _, line := range stack { - if !stackTracePruneRE.MatchString(line) { - prunedStack = append(prunedStack, line) - } - } - - e.t.Fatalf("\n%s\n%s\n", strings.Join(prunedStack, "\n"), msg) -} diff --git a/exporters/jaeger/internal/matchers/expecter.go b/exporters/jaeger/internal/matchers/expecter.go deleted file mode 100644 index 54f331025d8..00000000000 --- a/exporters/jaeger/internal/matchers/expecter.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/matchers/expecter.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" - -import ( - "testing" -) - -type Expecter struct { - t *testing.T -} - -func NewExpecter(t *testing.T) *Expecter { - return &Expecter{ - t: t, - } -} - -func (a *Expecter) Expect(actual interface{}) *Expectation { - return &Expectation{ - t: a.t, - actual: actual, - } -} diff --git a/exporters/jaeger/internal/matchers/temporal_matcher.go b/exporters/jaeger/internal/matchers/temporal_matcher.go deleted file mode 100644 index 82871f71089..00000000000 --- a/exporters/jaeger/internal/matchers/temporal_matcher.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code created by gotmpl. DO NOT MODIFY. -// source: internal/shared/matchers/temporal_matcher.go.tmpl - -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package matchers // import "go.opentelemetry.io/otel/exporters/jaeger/internal/matchers" - -type TemporalMatcher byte - -//nolint:revive // ignoring missing comments for unexported constants in an internal package -const ( - Before TemporalMatcher = iota - BeforeOrSameTime - After - AfterOrSameTime -) diff --git a/exporters/jaeger/internal/third_party/thrift/LICENSE b/exporters/jaeger/internal/third_party/thrift/LICENSE deleted file mode 100644 index 2bc6fbbf65c..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/LICENSE +++ /dev/null @@ -1,306 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --------------------------------------------------- -SOFTWARE DISTRIBUTED WITH THRIFT: - -The Apache Thrift software includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - --------------------------------------------------- -Portions of the following files are licensed under the MIT License: - - lib/erl/src/Makefile.am - -Please see doc/otp-base-license.txt for the full terms of this license. - --------------------------------------------------- -For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 components: - -# Copyright (c) 2007 Thomas Porschberg -# -# Copying and distribution of this file, with or without -# modification, are permitted in any medium without royalty provided -# the copyright notice and this notice are preserved. - --------------------------------------------------- -For the lib/nodejs/lib/thrift/json_parse.js: - -/* - json_parse.js - 2015-05-02 - Public Domain. - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - -*/ -(By Douglas Crockford ) - --------------------------------------------------- -For lib/cpp/src/thrift/windows/SocketPair.cpp - -/* socketpair.c - * Copyright 2007 by Nathan C. Myers ; some rights reserved. - * This code is Free Software. It may be copied freely, in original or - * modified form, subject only to the restrictions that (1) the author is - * relieved from all responsibilities for any use for any purpose, and (2) - * this copyright notice must be retained, unchanged, in its entirety. If - * for any reason the author might be held responsible for any consequences - * of copying or use, license is withheld. - */ - - --------------------------------------------------- -For lib/py/compat/win32/stdint.h - -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - - --------------------------------------------------- -Codegen template in t_html_generator.h - -* Bootstrap v2.0.3 -* -* Copyright 2012 Twitter, Inc -* Licensed under the Apache License v2.0 -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Designed and built with all the love in the world @twitter by @mdo and @fat. - ---------------------------------------------------- -For t_cl_generator.cc - - * Copyright (c) 2008- Patrick Collison - * Copyright (c) 2006- Facebook - ---------------------------------------------------- diff --git a/exporters/jaeger/internal/third_party/thrift/NOTICE b/exporters/jaeger/internal/third_party/thrift/NOTICE deleted file mode 100644 index 37824e7fb66..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Thrift -Copyright (C) 2006 - 2019, The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/application_exception.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/application_exception.go deleted file mode 100644 index 32d5b0147a2..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/application_exception.go +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" -) - -const ( - UNKNOWN_APPLICATION_EXCEPTION = 0 - UNKNOWN_METHOD = 1 - INVALID_MESSAGE_TYPE_EXCEPTION = 2 - WRONG_METHOD_NAME = 3 - BAD_SEQUENCE_ID = 4 - MISSING_RESULT = 5 - INTERNAL_ERROR = 6 - PROTOCOL_ERROR = 7 - INVALID_TRANSFORM = 8 - INVALID_PROTOCOL = 9 - UNSUPPORTED_CLIENT_TYPE = 10 -) - -var defaultApplicationExceptionMessage = map[int32]string{ - UNKNOWN_APPLICATION_EXCEPTION: "unknown application exception", - UNKNOWN_METHOD: "unknown method", - INVALID_MESSAGE_TYPE_EXCEPTION: "invalid message type", - WRONG_METHOD_NAME: "wrong method name", - BAD_SEQUENCE_ID: "bad sequence ID", - MISSING_RESULT: "missing result", - INTERNAL_ERROR: "unknown internal error", - PROTOCOL_ERROR: "unknown protocol error", - INVALID_TRANSFORM: "Invalid transform", - INVALID_PROTOCOL: "Invalid protocol", - UNSUPPORTED_CLIENT_TYPE: "Unsupported client type", -} - -// Application level Thrift exception -type TApplicationException interface { - TException - TypeId() int32 - Read(ctx context.Context, iprot TProtocol) error - Write(ctx context.Context, oprot TProtocol) error -} - -type tApplicationException struct { - message string - type_ int32 -} - -var _ TApplicationException = (*tApplicationException)(nil) - -func (tApplicationException) TExceptionType() TExceptionType { - return TExceptionTypeApplication -} - -func (e tApplicationException) Error() string { - if e.message != "" { - return e.message - } - return defaultApplicationExceptionMessage[e.type_] -} - -func NewTApplicationException(type_ int32, message string) TApplicationException { - return &tApplicationException{message, type_} -} - -func (p *tApplicationException) TypeId() int32 { - return p.type_ -} - -func (p *tApplicationException) Read(ctx context.Context, iprot TProtocol) error { - // TODO: this should really be generated by the compiler - _, err := iprot.ReadStructBegin(ctx) - if err != nil { - return err - } - - message := "" - type_ := int32(UNKNOWN_APPLICATION_EXCEPTION) - - for { - _, ttype, id, err := iprot.ReadFieldBegin(ctx) - if err != nil { - return err - } - if ttype == STOP { - break - } - switch id { - case 1: - if ttype == STRING { - if message, err = iprot.ReadString(ctx); err != nil { - return err - } - } else { - if err = SkipDefaultDepth(ctx, iprot, ttype); err != nil { - return err - } - } - case 2: - if ttype == I32 { - if type_, err = iprot.ReadI32(ctx); err != nil { - return err - } - } else { - if err = SkipDefaultDepth(ctx, iprot, ttype); err != nil { - return err - } - } - default: - if err = SkipDefaultDepth(ctx, iprot, ttype); err != nil { - return err - } - } - if err = iprot.ReadFieldEnd(ctx); err != nil { - return err - } - } - if err := iprot.ReadStructEnd(ctx); err != nil { - return err - } - - p.message = message - p.type_ = type_ - - return nil -} - -func (p *tApplicationException) Write(ctx context.Context, oprot TProtocol) (err error) { - err = oprot.WriteStructBegin(ctx, "TApplicationException") - if len(p.Error()) > 0 { - err = oprot.WriteFieldBegin(ctx, "message", STRING, 1) - if err != nil { - return - } - err = oprot.WriteString(ctx, p.Error()) - if err != nil { - return - } - err = oprot.WriteFieldEnd(ctx) - if err != nil { - return - } - } - err = oprot.WriteFieldBegin(ctx, "type", I32, 2) - if err != nil { - return - } - err = oprot.WriteI32(ctx, p.type_) - if err != nil { - return - } - err = oprot.WriteFieldEnd(ctx) - if err != nil { - return - } - err = oprot.WriteFieldStop(ctx) - if err != nil { - return - } - err = oprot.WriteStructEnd(ctx) - return -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/binary_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/binary_protocol.go deleted file mode 100644 index 45c880d32f8..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/binary_protocol.go +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bytes" - "context" - "encoding/binary" - "errors" - "fmt" - "io" - "math" -) - -type TBinaryProtocol struct { - trans TRichTransport - origTransport TTransport - cfg *TConfiguration - buffer [64]byte -} - -type TBinaryProtocolFactory struct { - cfg *TConfiguration -} - -// Deprecated: Use NewTBinaryProtocolConf instead. -func NewTBinaryProtocolTransport(t TTransport) *TBinaryProtocol { - return NewTBinaryProtocolConf(t, &TConfiguration{ - noPropagation: true, - }) -} - -// Deprecated: Use NewTBinaryProtocolConf instead. -func NewTBinaryProtocol(t TTransport, strictRead, strictWrite bool) *TBinaryProtocol { - return NewTBinaryProtocolConf(t, &TConfiguration{ - TBinaryStrictRead: &strictRead, - TBinaryStrictWrite: &strictWrite, - - noPropagation: true, - }) -} - -func NewTBinaryProtocolConf(t TTransport, conf *TConfiguration) *TBinaryProtocol { - PropagateTConfiguration(t, conf) - p := &TBinaryProtocol{ - origTransport: t, - cfg: conf, - } - if et, ok := t.(TRichTransport); ok { - p.trans = et - } else { - p.trans = NewTRichTransport(t) - } - return p -} - -// Deprecated: Use NewTBinaryProtocolFactoryConf instead. -func NewTBinaryProtocolFactoryDefault() *TBinaryProtocolFactory { - return NewTBinaryProtocolFactoryConf(&TConfiguration{ - noPropagation: true, - }) -} - -// Deprecated: Use NewTBinaryProtocolFactoryConf instead. -func NewTBinaryProtocolFactory(strictRead, strictWrite bool) *TBinaryProtocolFactory { - return NewTBinaryProtocolFactoryConf(&TConfiguration{ - TBinaryStrictRead: &strictRead, - TBinaryStrictWrite: &strictWrite, - - noPropagation: true, - }) -} - -func NewTBinaryProtocolFactoryConf(conf *TConfiguration) *TBinaryProtocolFactory { - return &TBinaryProtocolFactory{ - cfg: conf, - } -} - -func (p *TBinaryProtocolFactory) GetProtocol(t TTransport) TProtocol { - return NewTBinaryProtocolConf(t, p.cfg) -} - -func (p *TBinaryProtocolFactory) SetTConfiguration(conf *TConfiguration) { - p.cfg = conf -} - -/** - * Writing Methods - */ - -func (p *TBinaryProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqId int32) error { - if p.cfg.GetTBinaryStrictWrite() { - version := uint32(VERSION_1) | uint32(typeId) - e := p.WriteI32(ctx, int32(version)) - if e != nil { - return e - } - e = p.WriteString(ctx, name) - if e != nil { - return e - } - e = p.WriteI32(ctx, seqId) - return e - } else { - e := p.WriteString(ctx, name) - if e != nil { - return e - } - e = p.WriteByte(ctx, int8(typeId)) - if e != nil { - return e - } - e = p.WriteI32(ctx, seqId) - return e - } - return nil -} - -func (p *TBinaryProtocol) WriteMessageEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteStructBegin(ctx context.Context, name string) error { - return nil -} - -func (p *TBinaryProtocol) WriteStructEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error { - e := p.WriteByte(ctx, int8(typeId)) - if e != nil { - return e - } - e = p.WriteI16(ctx, id) - return e -} - -func (p *TBinaryProtocol) WriteFieldEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteFieldStop(ctx context.Context) error { - e := p.WriteByte(ctx, STOP) - return e -} - -func (p *TBinaryProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - e := p.WriteByte(ctx, int8(keyType)) - if e != nil { - return e - } - e = p.WriteByte(ctx, int8(valueType)) - if e != nil { - return e - } - e = p.WriteI32(ctx, int32(size)) - return e -} - -func (p *TBinaryProtocol) WriteMapEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - e := p.WriteByte(ctx, int8(elemType)) - if e != nil { - return e - } - e = p.WriteI32(ctx, int32(size)) - return e -} - -func (p *TBinaryProtocol) WriteListEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - e := p.WriteByte(ctx, int8(elemType)) - if e != nil { - return e - } - e = p.WriteI32(ctx, int32(size)) - return e -} - -func (p *TBinaryProtocol) WriteSetEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) WriteBool(ctx context.Context, value bool) error { - if value { - return p.WriteByte(ctx, 1) - } - return p.WriteByte(ctx, 0) -} - -func (p *TBinaryProtocol) WriteByte(ctx context.Context, value int8) error { - e := p.trans.WriteByte(byte(value)) - return NewTProtocolException(e) -} - -func (p *TBinaryProtocol) WriteI16(ctx context.Context, value int16) error { - v := p.buffer[0:2] - binary.BigEndian.PutUint16(v, uint16(value)) - _, e := p.trans.Write(v) - return NewTProtocolException(e) -} - -func (p *TBinaryProtocol) WriteI32(ctx context.Context, value int32) error { - v := p.buffer[0:4] - binary.BigEndian.PutUint32(v, uint32(value)) - _, e := p.trans.Write(v) - return NewTProtocolException(e) -} - -func (p *TBinaryProtocol) WriteI64(ctx context.Context, value int64) error { - v := p.buffer[0:8] - binary.BigEndian.PutUint64(v, uint64(value)) - _, err := p.trans.Write(v) - return NewTProtocolException(err) -} - -func (p *TBinaryProtocol) WriteDouble(ctx context.Context, value float64) error { - return p.WriteI64(ctx, int64(math.Float64bits(value))) -} - -func (p *TBinaryProtocol) WriteString(ctx context.Context, value string) error { - e := p.WriteI32(ctx, int32(len(value))) - if e != nil { - return e - } - _, err := p.trans.WriteString(value) - return NewTProtocolException(err) -} - -func (p *TBinaryProtocol) WriteBinary(ctx context.Context, value []byte) error { - e := p.WriteI32(ctx, int32(len(value))) - if e != nil { - return e - } - _, err := p.trans.Write(value) - return NewTProtocolException(err) -} - -/** - * Reading methods - */ - -func (p *TBinaryProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { - size, e := p.ReadI32(ctx) - if e != nil { - return "", typeId, 0, NewTProtocolException(e) - } - if size < 0 { - typeId = TMessageType(size & 0x0ff) - version := int64(int64(size) & VERSION_MASK) - if version != VERSION_1 { - return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Bad version in ReadMessageBegin")) - } - name, e = p.ReadString(ctx) - if e != nil { - return name, typeId, seqId, NewTProtocolException(e) - } - seqId, e = p.ReadI32(ctx) - if e != nil { - return name, typeId, seqId, NewTProtocolException(e) - } - return name, typeId, seqId, nil - } - if p.cfg.GetTBinaryStrictRead() { - return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Missing version in ReadMessageBegin")) - } - name, e2 := p.readStringBody(size) - if e2 != nil { - return name, typeId, seqId, e2 - } - b, e3 := p.ReadByte(ctx) - if e3 != nil { - return name, typeId, seqId, e3 - } - typeId = TMessageType(b) - seqId, e4 := p.ReadI32(ctx) - if e4 != nil { - return name, typeId, seqId, e4 - } - return name, typeId, seqId, nil -} - -func (p *TBinaryProtocol) ReadMessageEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - return -} - -func (p *TBinaryProtocol) ReadStructEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) ReadFieldBegin(ctx context.Context) (name string, typeId TType, seqId int16, err error) { - t, err := p.ReadByte(ctx) - typeId = TType(t) - if err != nil { - return name, typeId, seqId, err - } - if t != STOP { - seqId, err = p.ReadI16(ctx) - } - return name, typeId, seqId, err -} - -func (p *TBinaryProtocol) ReadFieldEnd(ctx context.Context) error { - return nil -} - -var invalidDataLength = NewTProtocolExceptionWithType(INVALID_DATA, errors.New("Invalid data length")) - -func (p *TBinaryProtocol) ReadMapBegin(ctx context.Context) (kType, vType TType, size int, err error) { - k, e := p.ReadByte(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - kType = TType(k) - v, e := p.ReadByte(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - vType = TType(v) - size32, e := p.ReadI32(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - if size32 < 0 { - err = invalidDataLength - return - } - size = int(size32) - return kType, vType, size, nil -} - -func (p *TBinaryProtocol) ReadMapEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, err error) { - b, e := p.ReadByte(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - elemType = TType(b) - size32, e := p.ReadI32(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - if size32 < 0 { - err = invalidDataLength - return - } - size = int(size32) - - return -} - -func (p *TBinaryProtocol) ReadListEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, err error) { - b, e := p.ReadByte(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - elemType = TType(b) - size32, e := p.ReadI32(ctx) - if e != nil { - err = NewTProtocolException(e) - return - } - if size32 < 0 { - err = invalidDataLength - return - } - size = int(size32) - return elemType, size, nil -} - -func (p *TBinaryProtocol) ReadSetEnd(ctx context.Context) error { - return nil -} - -func (p *TBinaryProtocol) ReadBool(ctx context.Context) (bool, error) { - b, e := p.ReadByte(ctx) - v := true - if b != 1 { - v = false - } - return v, e -} - -func (p *TBinaryProtocol) ReadByte(ctx context.Context) (int8, error) { - v, err := p.trans.ReadByte() - return int8(v), err -} - -func (p *TBinaryProtocol) ReadI16(ctx context.Context) (value int16, err error) { - buf := p.buffer[0:2] - err = p.readAll(ctx, buf) - value = int16(binary.BigEndian.Uint16(buf)) - return value, err -} - -func (p *TBinaryProtocol) ReadI32(ctx context.Context) (value int32, err error) { - buf := p.buffer[0:4] - err = p.readAll(ctx, buf) - value = int32(binary.BigEndian.Uint32(buf)) - return value, err -} - -func (p *TBinaryProtocol) ReadI64(ctx context.Context) (value int64, err error) { - buf := p.buffer[0:8] - err = p.readAll(ctx, buf) - value = int64(binary.BigEndian.Uint64(buf)) - return value, err -} - -func (p *TBinaryProtocol) ReadDouble(ctx context.Context) (value float64, err error) { - buf := p.buffer[0:8] - err = p.readAll(ctx, buf) - value = math.Float64frombits(binary.BigEndian.Uint64(buf)) - return value, err -} - -func (p *TBinaryProtocol) ReadString(ctx context.Context) (value string, err error) { - size, e := p.ReadI32(ctx) - if e != nil { - return "", e - } - err = checkSizeForProtocol(size, p.cfg) - if err != nil { - return - } - if size < 0 { - err = invalidDataLength - return - } - if size == 0 { - return "", nil - } - if size < int32(len(p.buffer)) { - // Avoid allocation on small reads - buf := p.buffer[:size] - read, e := io.ReadFull(p.trans, buf) - return string(buf[:read]), NewTProtocolException(e) - } - - return p.readStringBody(size) -} - -func (p *TBinaryProtocol) ReadBinary(ctx context.Context) ([]byte, error) { - size, e := p.ReadI32(ctx) - if e != nil { - return nil, e - } - if err := checkSizeForProtocol(size, p.cfg); err != nil { - return nil, err - } - - buf, err := safeReadBytes(size, p.trans) - return buf, NewTProtocolException(err) -} - -func (p *TBinaryProtocol) Flush(ctx context.Context) (err error) { - return NewTProtocolException(p.trans.Flush(ctx)) -} - -func (p *TBinaryProtocol) Skip(ctx context.Context, fieldType TType) (err error) { - return SkipDefaultDepth(ctx, p, fieldType) -} - -func (p *TBinaryProtocol) Transport() TTransport { - return p.origTransport -} - -func (p *TBinaryProtocol) readAll(ctx context.Context, buf []byte) (err error) { - var read int - _, deadlineSet := ctx.Deadline() - for { - read, err = io.ReadFull(p.trans, buf) - if deadlineSet && read == 0 && isTimeoutError(err) && ctx.Err() == nil { - // This is I/O timeout without anything read, - // and we still have time left, keep retrying. - continue - } - // For anything else, don't retry - break - } - return NewTProtocolException(err) -} - -func (p *TBinaryProtocol) readStringBody(size int32) (value string, err error) { - buf, err := safeReadBytes(size, p.trans) - return string(buf), NewTProtocolException(err) -} - -func (p *TBinaryProtocol) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(p.trans, conf) - PropagateTConfiguration(p.origTransport, conf) - p.cfg = conf -} - -var ( - _ TConfigurationSetter = (*TBinaryProtocolFactory)(nil) - _ TConfigurationSetter = (*TBinaryProtocol)(nil) -) - -// This function is shared between TBinaryProtocol and TCompactProtocol. -// -// It tries to read size bytes from trans, in a way that prevents large -// allocations when size is insanely large (mostly caused by malformed message). -func safeReadBytes(size int32, trans io.Reader) ([]byte, error) { - if size < 0 { - return nil, nil - } - - buf := new(bytes.Buffer) - _, err := io.CopyN(buf, trans, int64(size)) - return buf.Bytes(), err -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/buffered_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/buffered_transport.go deleted file mode 100644 index aa551b4ab37..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/buffered_transport.go +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bufio" - "context" -) - -type TBufferedTransportFactory struct { - size int -} - -type TBufferedTransport struct { - bufio.ReadWriter - tp TTransport -} - -func (p *TBufferedTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - return NewTBufferedTransport(trans, p.size), nil -} - -func NewTBufferedTransportFactory(bufferSize int) *TBufferedTransportFactory { - return &TBufferedTransportFactory{size: bufferSize} -} - -func NewTBufferedTransport(trans TTransport, bufferSize int) *TBufferedTransport { - return &TBufferedTransport{ - ReadWriter: bufio.ReadWriter{ - Reader: bufio.NewReaderSize(trans, bufferSize), - Writer: bufio.NewWriterSize(trans, bufferSize), - }, - tp: trans, - } -} - -func (p *TBufferedTransport) IsOpen() bool { - return p.tp.IsOpen() -} - -func (p *TBufferedTransport) Open() (err error) { - return p.tp.Open() -} - -func (p *TBufferedTransport) Close() (err error) { - return p.tp.Close() -} - -func (p *TBufferedTransport) Read(b []byte) (int, error) { - n, err := p.ReadWriter.Read(b) - if err != nil { - p.ReadWriter.Reader.Reset(p.tp) - } - return n, err -} - -func (p *TBufferedTransport) Write(b []byte) (int, error) { - n, err := p.ReadWriter.Write(b) - if err != nil { - p.ReadWriter.Writer.Reset(p.tp) - } - return n, err -} - -func (p *TBufferedTransport) Flush(ctx context.Context) error { - if err := p.ReadWriter.Flush(); err != nil { - p.ReadWriter.Writer.Reset(p.tp) - return err - } - return p.tp.Flush(ctx) -} - -func (p *TBufferedTransport) RemainingBytes() (num_bytes uint64) { - return p.tp.RemainingBytes() -} - -// SetTConfiguration implements TConfigurationSetter for propagation. -func (p *TBufferedTransport) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(p.tp, conf) -} - -var _ TConfigurationSetter = (*TBufferedTransport)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/client.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/client.go deleted file mode 100644 index ea2c01fdadb..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/client.go +++ /dev/null @@ -1,109 +0,0 @@ -package thrift - -import ( - "context" - "fmt" -) - -// ResponseMeta represents the metadata attached to the response. -type ResponseMeta struct { - // The headers in the response, if any. - // If the underlying transport/protocol is not THeader, this will always be nil. - Headers THeaderMap -} - -type TClient interface { - Call(ctx context.Context, method string, args, result TStruct) (ResponseMeta, error) -} - -type TStandardClient struct { - seqId int32 - iprot, oprot TProtocol -} - -// TStandardClient implements TClient, and uses the standard message format for Thrift. -// It is not safe for concurrent use. -func NewTStandardClient(inputProtocol, outputProtocol TProtocol) *TStandardClient { - return &TStandardClient{ - iprot: inputProtocol, - oprot: outputProtocol, - } -} - -func (p *TStandardClient) Send(ctx context.Context, oprot TProtocol, seqId int32, method string, args TStruct) error { - // Set headers from context object on THeaderProtocol - if headerProt, ok := oprot.(*THeaderProtocol); ok { - headerProt.ClearWriteHeaders() - for _, key := range GetWriteHeaderList(ctx) { - if value, ok := GetHeader(ctx, key); ok { - headerProt.SetWriteHeader(key, value) - } - } - } - - if err := oprot.WriteMessageBegin(ctx, method, CALL, seqId); err != nil { - return err - } - if err := args.Write(ctx, oprot); err != nil { - return err - } - if err := oprot.WriteMessageEnd(ctx); err != nil { - return err - } - return oprot.Flush(ctx) -} - -func (p *TStandardClient) Recv(ctx context.Context, iprot TProtocol, seqId int32, method string, result TStruct) error { - rMethod, rTypeId, rSeqId, err := iprot.ReadMessageBegin(ctx) - if err != nil { - return err - } - - if method != rMethod { - return NewTApplicationException(WRONG_METHOD_NAME, fmt.Sprintf("%s: wrong method name", method)) - } else if seqId != rSeqId { - return NewTApplicationException(BAD_SEQUENCE_ID, fmt.Sprintf("%s: out of order sequence response", method)) - } else if rTypeId == EXCEPTION { - var exception tApplicationException - if err := exception.Read(ctx, iprot); err != nil { - return err - } - - if err := iprot.ReadMessageEnd(ctx); err != nil { - return err - } - - return &exception - } else if rTypeId != REPLY { - return NewTApplicationException(INVALID_MESSAGE_TYPE_EXCEPTION, fmt.Sprintf("%s: invalid message type", method)) - } - - if err := result.Read(ctx, iprot); err != nil { - return err - } - - return iprot.ReadMessageEnd(ctx) -} - -func (p *TStandardClient) Call(ctx context.Context, method string, args, result TStruct) (ResponseMeta, error) { - p.seqId++ - seqId := p.seqId - - if err := p.Send(ctx, p.oprot, seqId, method, args); err != nil { - return ResponseMeta{}, err - } - - // method is oneway - if result == nil { - return ResponseMeta{}, nil - } - - err := p.Recv(ctx, p.iprot, seqId, method, result) - var headers THeaderMap - if hp, ok := p.iprot.(*THeaderProtocol); ok { - headers = hp.transport.readHeaders - } - return ResponseMeta{ - Headers: headers, - }, err -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/compact_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/compact_protocol.go deleted file mode 100644 index a49225dabfb..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/compact_protocol.go +++ /dev/null @@ -1,865 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "encoding/binary" - "errors" - "fmt" - "io" - "math" -) - -const ( - COMPACT_PROTOCOL_ID = 0x082 - COMPACT_VERSION = 1 - COMPACT_VERSION_MASK = 0x1f - COMPACT_TYPE_MASK = 0x0E0 - COMPACT_TYPE_BITS = 0x07 - COMPACT_TYPE_SHIFT_AMOUNT = 5 -) - -type tCompactType byte - -const ( - COMPACT_BOOLEAN_TRUE = 0x01 - COMPACT_BOOLEAN_FALSE = 0x02 - COMPACT_BYTE = 0x03 - COMPACT_I16 = 0x04 - COMPACT_I32 = 0x05 - COMPACT_I64 = 0x06 - COMPACT_DOUBLE = 0x07 - COMPACT_BINARY = 0x08 - COMPACT_LIST = 0x09 - COMPACT_SET = 0x0A - COMPACT_MAP = 0x0B - COMPACT_STRUCT = 0x0C -) - -var ( - ttypeToCompactType map[TType]tCompactType -) - -func init() { - ttypeToCompactType = map[TType]tCompactType{ - STOP: STOP, - BOOL: COMPACT_BOOLEAN_TRUE, - BYTE: COMPACT_BYTE, - I16: COMPACT_I16, - I32: COMPACT_I32, - I64: COMPACT_I64, - DOUBLE: COMPACT_DOUBLE, - STRING: COMPACT_BINARY, - LIST: COMPACT_LIST, - SET: COMPACT_SET, - MAP: COMPACT_MAP, - STRUCT: COMPACT_STRUCT, - } -} - -type TCompactProtocolFactory struct { - cfg *TConfiguration -} - -// Deprecated: Use NewTCompactProtocolFactoryConf instead. -func NewTCompactProtocolFactory() *TCompactProtocolFactory { - return NewTCompactProtocolFactoryConf(&TConfiguration{ - noPropagation: true, - }) -} - -func NewTCompactProtocolFactoryConf(conf *TConfiguration) *TCompactProtocolFactory { - return &TCompactProtocolFactory{ - cfg: conf, - } -} - -func (p *TCompactProtocolFactory) GetProtocol(trans TTransport) TProtocol { - return NewTCompactProtocolConf(trans, p.cfg) -} - -func (p *TCompactProtocolFactory) SetTConfiguration(conf *TConfiguration) { - p.cfg = conf -} - -type TCompactProtocol struct { - trans TRichTransport - origTransport TTransport - - cfg *TConfiguration - - // Used to keep track of the last field for the current and previous structs, - // so we can do the delta stuff. - lastField []int - lastFieldId int - - // If we encounter a boolean field begin, save the TField here so it can - // have the value incorporated. - booleanFieldName string - booleanFieldId int16 - booleanFieldPending bool - - // If we read a field header, and it's a boolean field, save the boolean - // value here so that readBool can use it. - boolValue bool - boolValueIsNotNull bool - buffer [64]byte -} - -// Deprecated: Use NewTCompactProtocolConf instead. -func NewTCompactProtocol(trans TTransport) *TCompactProtocol { - return NewTCompactProtocolConf(trans, &TConfiguration{ - noPropagation: true, - }) -} - -func NewTCompactProtocolConf(trans TTransport, conf *TConfiguration) *TCompactProtocol { - PropagateTConfiguration(trans, conf) - p := &TCompactProtocol{ - origTransport: trans, - cfg: conf, - } - if et, ok := trans.(TRichTransport); ok { - p.trans = et - } else { - p.trans = NewTRichTransport(trans) - } - - return p -} - -// -// Public Writing methods. -// - -// Write a message header to the wire. Compact Protocol messages contain the -// protocol version so we can migrate forwards in the future if need be. -func (p *TCompactProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error { - err := p.writeByteDirect(COMPACT_PROTOCOL_ID) - if err != nil { - return NewTProtocolException(err) - } - err = p.writeByteDirect((COMPACT_VERSION & COMPACT_VERSION_MASK) | ((byte(typeId) << COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_MASK)) - if err != nil { - return NewTProtocolException(err) - } - _, err = p.writeVarint32(seqid) - if err != nil { - return NewTProtocolException(err) - } - e := p.WriteString(ctx, name) - return e - -} - -func (p *TCompactProtocol) WriteMessageEnd(ctx context.Context) error { return nil } - -// Write a struct begin. This doesn't actually put anything on the wire. We -// use it as an opportunity to put special placeholder markers on the field -// stack so we can get the field id deltas correct. -func (p *TCompactProtocol) WriteStructBegin(ctx context.Context, name string) error { - p.lastField = append(p.lastField, p.lastFieldId) - p.lastFieldId = 0 - return nil -} - -// Write a struct end. This doesn't actually put anything on the wire. We use -// this as an opportunity to pop the last field from the current struct off -// of the field stack. -func (p *TCompactProtocol) WriteStructEnd(ctx context.Context) error { - if len(p.lastField) <= 0 { - return NewTProtocolExceptionWithType(INVALID_DATA, errors.New("WriteStructEnd called without matching WriteStructBegin call before")) - } - p.lastFieldId = p.lastField[len(p.lastField)-1] - p.lastField = p.lastField[:len(p.lastField)-1] - return nil -} - -func (p *TCompactProtocol) WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error { - if typeId == BOOL { - // we want to possibly include the value, so we'll wait. - p.booleanFieldName, p.booleanFieldId, p.booleanFieldPending = name, id, true - return nil - } - _, err := p.writeFieldBeginInternal(ctx, name, typeId, id, 0xFF) - return NewTProtocolException(err) -} - -// The workhorse of writeFieldBegin. It has the option of doing a -// 'type override' of the type header. This is used specifically in the -// boolean field case. -func (p *TCompactProtocol) writeFieldBeginInternal(ctx context.Context, name string, typeId TType, id int16, typeOverride byte) (int, error) { - // short lastField = lastField_.pop(); - - // if there's a type override, use that. - var typeToWrite byte - if typeOverride == 0xFF { - typeToWrite = byte(p.getCompactType(typeId)) - } else { - typeToWrite = typeOverride - } - // check if we can use delta encoding for the field id - fieldId := int(id) - written := 0 - if fieldId > p.lastFieldId && fieldId-p.lastFieldId <= 15 { - // write them together - err := p.writeByteDirect(byte((fieldId-p.lastFieldId)<<4) | typeToWrite) - if err != nil { - return 0, err - } - } else { - // write them separate - err := p.writeByteDirect(typeToWrite) - if err != nil { - return 0, err - } - err = p.WriteI16(ctx, id) - written = 1 + 2 - if err != nil { - return 0, err - } - } - - p.lastFieldId = fieldId - return written, nil -} - -func (p *TCompactProtocol) WriteFieldEnd(ctx context.Context) error { return nil } - -func (p *TCompactProtocol) WriteFieldStop(ctx context.Context) error { - err := p.writeByteDirect(STOP) - return NewTProtocolException(err) -} - -func (p *TCompactProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - if size == 0 { - err := p.writeByteDirect(0) - return NewTProtocolException(err) - } - _, err := p.writeVarint32(int32(size)) - if err != nil { - return NewTProtocolException(err) - } - err = p.writeByteDirect(byte(p.getCompactType(keyType))<<4 | byte(p.getCompactType(valueType))) - return NewTProtocolException(err) -} - -func (p *TCompactProtocol) WriteMapEnd(ctx context.Context) error { return nil } - -// Write a list header. -func (p *TCompactProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - _, err := p.writeCollectionBegin(elemType, size) - return NewTProtocolException(err) -} - -func (p *TCompactProtocol) WriteListEnd(ctx context.Context) error { return nil } - -// Write a set header. -func (p *TCompactProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - _, err := p.writeCollectionBegin(elemType, size) - return NewTProtocolException(err) -} - -func (p *TCompactProtocol) WriteSetEnd(ctx context.Context) error { return nil } - -func (p *TCompactProtocol) WriteBool(ctx context.Context, value bool) error { - v := byte(COMPACT_BOOLEAN_FALSE) - if value { - v = byte(COMPACT_BOOLEAN_TRUE) - } - if p.booleanFieldPending { - // we haven't written the field header yet - _, err := p.writeFieldBeginInternal(ctx, p.booleanFieldName, BOOL, p.booleanFieldId, v) - p.booleanFieldPending = false - return NewTProtocolException(err) - } - // we're not part of a field, so just write the value. - err := p.writeByteDirect(v) - return NewTProtocolException(err) -} - -// Write a byte. Nothing to see here! -func (p *TCompactProtocol) WriteByte(ctx context.Context, value int8) error { - err := p.writeByteDirect(byte(value)) - return NewTProtocolException(err) -} - -// Write an I16 as a zigzag varint. -func (p *TCompactProtocol) WriteI16(ctx context.Context, value int16) error { - _, err := p.writeVarint32(p.int32ToZigzag(int32(value))) - return NewTProtocolException(err) -} - -// Write an i32 as a zigzag varint. -func (p *TCompactProtocol) WriteI32(ctx context.Context, value int32) error { - _, err := p.writeVarint32(p.int32ToZigzag(value)) - return NewTProtocolException(err) -} - -// Write an i64 as a zigzag varint. -func (p *TCompactProtocol) WriteI64(ctx context.Context, value int64) error { - _, err := p.writeVarint64(p.int64ToZigzag(value)) - return NewTProtocolException(err) -} - -// Write a double to the wire as 8 bytes. -func (p *TCompactProtocol) WriteDouble(ctx context.Context, value float64) error { - buf := p.buffer[0:8] - binary.LittleEndian.PutUint64(buf, math.Float64bits(value)) - _, err := p.trans.Write(buf) - return NewTProtocolException(err) -} - -// Write a string to the wire with a varint size preceding. -func (p *TCompactProtocol) WriteString(ctx context.Context, value string) error { - _, e := p.writeVarint32(int32(len(value))) - if e != nil { - return NewTProtocolException(e) - } - if len(value) > 0 { - } - _, e = p.trans.WriteString(value) - return e -} - -// Write a byte array, using a varint for the size. -func (p *TCompactProtocol) WriteBinary(ctx context.Context, bin []byte) error { - _, e := p.writeVarint32(int32(len(bin))) - if e != nil { - return NewTProtocolException(e) - } - if len(bin) > 0 { - _, e = p.trans.Write(bin) - return NewTProtocolException(e) - } - return nil -} - -// -// Reading methods. -// - -// Read a message header. -func (p *TCompactProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { - var protocolId byte - - _, deadlineSet := ctx.Deadline() - for { - protocolId, err = p.readByteDirect() - if deadlineSet && isTimeoutError(err) && ctx.Err() == nil { - // keep retrying I/O timeout errors since we still have - // time left - continue - } - // For anything else, don't retry - break - } - if err != nil { - return - } - - if protocolId != COMPACT_PROTOCOL_ID { - e := fmt.Errorf("Expected protocol id %02x but got %02x", COMPACT_PROTOCOL_ID, protocolId) - return "", typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, e) - } - - versionAndType, err := p.readByteDirect() - if err != nil { - return - } - - version := versionAndType & COMPACT_VERSION_MASK - typeId = TMessageType((versionAndType >> COMPACT_TYPE_SHIFT_AMOUNT) & COMPACT_TYPE_BITS) - if version != COMPACT_VERSION { - e := fmt.Errorf("Expected version %02x but got %02x", COMPACT_VERSION, version) - err = NewTProtocolExceptionWithType(BAD_VERSION, e) - return - } - seqId, e := p.readVarint32() - if e != nil { - err = NewTProtocolException(e) - return - } - name, err = p.ReadString(ctx) - return -} - -func (p *TCompactProtocol) ReadMessageEnd(ctx context.Context) error { return nil } - -// Read a struct begin. There's nothing on the wire for this, but it is our -// opportunity to push a new struct begin marker onto the field stack. -func (p *TCompactProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - p.lastField = append(p.lastField, p.lastFieldId) - p.lastFieldId = 0 - return -} - -// Doesn't actually consume any wire data, just removes the last field for -// this struct from the field stack. -func (p *TCompactProtocol) ReadStructEnd(ctx context.Context) error { - // consume the last field we read off the wire. - if len(p.lastField) <= 0 { - return NewTProtocolExceptionWithType(INVALID_DATA, errors.New("ReadStructEnd called without matching ReadStructBegin call before")) - } - p.lastFieldId = p.lastField[len(p.lastField)-1] - p.lastField = p.lastField[:len(p.lastField)-1] - return nil -} - -// Read a field header off the wire. -func (p *TCompactProtocol) ReadFieldBegin(ctx context.Context) (name string, typeId TType, id int16, err error) { - t, err := p.readByteDirect() - if err != nil { - return - } - - // if it's a stop, then we can return immediately, as the struct is over. - if (t & 0x0f) == STOP { - return "", STOP, 0, nil - } - - // mask off the 4 MSB of the type header. it could contain a field id delta. - modifier := int16((t & 0xf0) >> 4) - if modifier == 0 { - // not a delta. look ahead for the zigzag varint field id. - id, err = p.ReadI16(ctx) - if err != nil { - return - } - } else { - // has a delta. add the delta to the last read field id. - id = int16(p.lastFieldId) + modifier - } - typeId, e := p.getTType(tCompactType(t & 0x0f)) - if e != nil { - err = NewTProtocolException(e) - return - } - - // if this happens to be a boolean field, the value is encoded in the type - if p.isBoolType(t) { - // save the boolean value in a special instance variable. - p.boolValue = (byte(t)&0x0f == COMPACT_BOOLEAN_TRUE) - p.boolValueIsNotNull = true - } - - // push the new field onto the field stack so we can keep the deltas going. - p.lastFieldId = int(id) - return -} - -func (p *TCompactProtocol) ReadFieldEnd(ctx context.Context) error { return nil } - -// Read a map header off the wire. If the size is zero, skip reading the key -// and value type. This means that 0-length maps will yield TMaps without the -// "correct" types. -func (p *TCompactProtocol) ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, err error) { - size32, e := p.readVarint32() - if e != nil { - err = NewTProtocolException(e) - return - } - if size32 < 0 { - err = invalidDataLength - return - } - size = int(size32) - - keyAndValueType := byte(STOP) - if size != 0 { - keyAndValueType, err = p.readByteDirect() - if err != nil { - return - } - } - keyType, _ = p.getTType(tCompactType(keyAndValueType >> 4)) - valueType, _ = p.getTType(tCompactType(keyAndValueType & 0xf)) - return -} - -func (p *TCompactProtocol) ReadMapEnd(ctx context.Context) error { return nil } - -// Read a list header off the wire. If the list size is 0-14, the size will -// be packed into the element type header. If it's a longer list, the 4 MSB -// of the element type header will be 0xF, and a varint will follow with the -// true size. -func (p *TCompactProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, err error) { - size_and_type, err := p.readByteDirect() - if err != nil { - return - } - size = int((size_and_type >> 4) & 0x0f) - if size == 15 { - size2, e := p.readVarint32() - if e != nil { - err = NewTProtocolException(e) - return - } - if size2 < 0 { - err = invalidDataLength - return - } - size = int(size2) - } - elemType, e := p.getTType(tCompactType(size_and_type)) - if e != nil { - err = NewTProtocolException(e) - return - } - return -} - -func (p *TCompactProtocol) ReadListEnd(ctx context.Context) error { return nil } - -// Read a set header off the wire. If the set size is 0-14, the size will -// be packed into the element type header. If it's a longer set, the 4 MSB -// of the element type header will be 0xF, and a varint will follow with the -// true size. -func (p *TCompactProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, err error) { - return p.ReadListBegin(ctx) -} - -func (p *TCompactProtocol) ReadSetEnd(ctx context.Context) error { return nil } - -// Read a boolean off the wire. If this is a boolean field, the value should -// already have been read during readFieldBegin, so we'll just consume the -// pre-stored value. Otherwise, read a byte. -func (p *TCompactProtocol) ReadBool(ctx context.Context) (value bool, err error) { - if p.boolValueIsNotNull { - p.boolValueIsNotNull = false - return p.boolValue, nil - } - v, err := p.readByteDirect() - return v == COMPACT_BOOLEAN_TRUE, err -} - -// Read a single byte off the wire. Nothing interesting here. -func (p *TCompactProtocol) ReadByte(ctx context.Context) (int8, error) { - v, err := p.readByteDirect() - if err != nil { - return 0, NewTProtocolException(err) - } - return int8(v), err -} - -// Read an i16 from the wire as a zigzag varint. -func (p *TCompactProtocol) ReadI16(ctx context.Context) (value int16, err error) { - v, err := p.ReadI32(ctx) - return int16(v), err -} - -// Read an i32 from the wire as a zigzag varint. -func (p *TCompactProtocol) ReadI32(ctx context.Context) (value int32, err error) { - v, e := p.readVarint32() - if e != nil { - return 0, NewTProtocolException(e) - } - value = p.zigzagToInt32(v) - return value, nil -} - -// Read an i64 from the wire as a zigzag varint. -func (p *TCompactProtocol) ReadI64(ctx context.Context) (value int64, err error) { - v, e := p.readVarint64() - if e != nil { - return 0, NewTProtocolException(e) - } - value = p.zigzagToInt64(v) - return value, nil -} - -// No magic here - just read a double off the wire. -func (p *TCompactProtocol) ReadDouble(ctx context.Context) (value float64, err error) { - longBits := p.buffer[0:8] - _, e := io.ReadFull(p.trans, longBits) - if e != nil { - return 0.0, NewTProtocolException(e) - } - return math.Float64frombits(p.bytesToUint64(longBits)), nil -} - -// Reads a []byte (via readBinary), and then UTF-8 decodes it. -func (p *TCompactProtocol) ReadString(ctx context.Context) (value string, err error) { - length, e := p.readVarint32() - if e != nil { - return "", NewTProtocolException(e) - } - err = checkSizeForProtocol(length, p.cfg) - if err != nil { - return - } - if length == 0 { - return "", nil - } - if length < int32(len(p.buffer)) { - // Avoid allocation on small reads - buf := p.buffer[:length] - read, e := io.ReadFull(p.trans, buf) - return string(buf[:read]), NewTProtocolException(e) - } - - buf, e := safeReadBytes(length, p.trans) - return string(buf), NewTProtocolException(e) -} - -// Read a []byte from the wire. -func (p *TCompactProtocol) ReadBinary(ctx context.Context) (value []byte, err error) { - length, e := p.readVarint32() - if e != nil { - return nil, NewTProtocolException(e) - } - err = checkSizeForProtocol(length, p.cfg) - if err != nil { - return - } - if length == 0 { - return []byte{}, nil - } - - buf, e := safeReadBytes(length, p.trans) - return buf, NewTProtocolException(e) -} - -func (p *TCompactProtocol) Flush(ctx context.Context) (err error) { - return NewTProtocolException(p.trans.Flush(ctx)) -} - -func (p *TCompactProtocol) Skip(ctx context.Context, fieldType TType) (err error) { - return SkipDefaultDepth(ctx, p, fieldType) -} - -func (p *TCompactProtocol) Transport() TTransport { - return p.origTransport -} - -// -// Internal writing methods -// - -// Abstract method for writing the start of lists and sets. List and sets on -// the wire differ only by the type indicator. -func (p *TCompactProtocol) writeCollectionBegin(elemType TType, size int) (int, error) { - if size <= 14 { - return 1, p.writeByteDirect(byte(int32(size<<4) | int32(p.getCompactType(elemType)))) - } - err := p.writeByteDirect(0xf0 | byte(p.getCompactType(elemType))) - if err != nil { - return 0, err - } - m, err := p.writeVarint32(int32(size)) - return 1 + m, err -} - -// Write an i32 as a varint. Results in 1-5 bytes on the wire. -// TODO(pomack): make a permanent buffer like writeVarint64? -func (p *TCompactProtocol) writeVarint32(n int32) (int, error) { - i32buf := p.buffer[0:5] - idx := 0 - for { - if (n & ^0x7F) == 0 { - i32buf[idx] = byte(n) - idx++ - // p.writeByteDirect(byte(n)); - break - // return; - } else { - i32buf[idx] = byte((n & 0x7F) | 0x80) - idx++ - // p.writeByteDirect(byte(((n & 0x7F) | 0x80))); - u := uint32(n) - n = int32(u >> 7) - } - } - return p.trans.Write(i32buf[0:idx]) -} - -// Write an i64 as a varint. Results in 1-10 bytes on the wire. -func (p *TCompactProtocol) writeVarint64(n int64) (int, error) { - varint64out := p.buffer[0:10] - idx := 0 - for { - if (n & ^0x7F) == 0 { - varint64out[idx] = byte(n) - idx++ - break - } else { - varint64out[idx] = byte((n & 0x7F) | 0x80) - idx++ - u := uint64(n) - n = int64(u >> 7) - } - } - return p.trans.Write(varint64out[0:idx]) -} - -// Convert l into a zigzag long. This allows negative numbers to be -// represented compactly as a varint. -func (p *TCompactProtocol) int64ToZigzag(l int64) int64 { - return (l << 1) ^ (l >> 63) -} - -// Convert l into a zigzag long. This allows negative numbers to be -// represented compactly as a varint. -func (p *TCompactProtocol) int32ToZigzag(n int32) int32 { - return (n << 1) ^ (n >> 31) -} - -func (p *TCompactProtocol) fixedUint64ToBytes(n uint64, buf []byte) { - binary.LittleEndian.PutUint64(buf, n) -} - -func (p *TCompactProtocol) fixedInt64ToBytes(n int64, buf []byte) { - binary.LittleEndian.PutUint64(buf, uint64(n)) -} - -// Writes a byte without any possibility of all that field header nonsense. -// Used internally by other writing methods that know they need to write a byte. -func (p *TCompactProtocol) writeByteDirect(b byte) error { - return p.trans.WriteByte(b) -} - -// Writes a byte without any possibility of all that field header nonsense. -func (p *TCompactProtocol) writeIntAsByteDirect(n int) (int, error) { - return 1, p.writeByteDirect(byte(n)) -} - -// -// Internal reading methods -// - -// Read an i32 from the wire as a varint. The MSB of each byte is set -// if there is another byte to follow. This can read up to 5 bytes. -func (p *TCompactProtocol) readVarint32() (int32, error) { - // if the wire contains the right stuff, this will just truncate the i64 we - // read and get us the right sign. - v, err := p.readVarint64() - return int32(v), err -} - -// Read an i64 from the wire as a proper varint. The MSB of each byte is set -// if there is another byte to follow. This can read up to 10 bytes. -func (p *TCompactProtocol) readVarint64() (int64, error) { - shift := uint(0) - result := int64(0) - for { - b, err := p.readByteDirect() - if err != nil { - return 0, err - } - result |= int64(b&0x7f) << shift - if (b & 0x80) != 0x80 { - break - } - shift += 7 - } - return result, nil -} - -// Read a byte, unlike ReadByte that reads Thrift-byte that is i8. -func (p *TCompactProtocol) readByteDirect() (byte, error) { - return p.trans.ReadByte() -} - -// -// encoding helpers -// - -// Convert from zigzag int to int. -func (p *TCompactProtocol) zigzagToInt32(n int32) int32 { - u := uint32(n) - return int32(u>>1) ^ -(n & 1) -} - -// Convert from zigzag long to long. -func (p *TCompactProtocol) zigzagToInt64(n int64) int64 { - u := uint64(n) - return int64(u>>1) ^ -(n & 1) -} - -// Note that it's important that the mask bytes are long literals, -// otherwise they'll default to ints, and when you shift an int left 56 bits, -// you just get a messed up int. -func (p *TCompactProtocol) bytesToInt64(b []byte) int64 { - return int64(binary.LittleEndian.Uint64(b)) -} - -// Note that it's important that the mask bytes are long literals, -// otherwise they'll default to ints, and when you shift an int left 56 bits, -// you just get a messed up int. -func (p *TCompactProtocol) bytesToUint64(b []byte) uint64 { - return binary.LittleEndian.Uint64(b) -} - -// -// type testing and converting -// - -func (p *TCompactProtocol) isBoolType(b byte) bool { - return (b&0x0f) == COMPACT_BOOLEAN_TRUE || (b&0x0f) == COMPACT_BOOLEAN_FALSE -} - -// Given a tCompactType constant, convert it to its corresponding -// TType value. -func (p *TCompactProtocol) getTType(t tCompactType) (TType, error) { - switch byte(t) & 0x0f { - case STOP: - return STOP, nil - case COMPACT_BOOLEAN_FALSE, COMPACT_BOOLEAN_TRUE: - return BOOL, nil - case COMPACT_BYTE: - return BYTE, nil - case COMPACT_I16: - return I16, nil - case COMPACT_I32: - return I32, nil - case COMPACT_I64: - return I64, nil - case COMPACT_DOUBLE: - return DOUBLE, nil - case COMPACT_BINARY: - return STRING, nil - case COMPACT_LIST: - return LIST, nil - case COMPACT_SET: - return SET, nil - case COMPACT_MAP: - return MAP, nil - case COMPACT_STRUCT: - return STRUCT, nil - } - return STOP, NewTProtocolException(fmt.Errorf("don't know what type: %v", t&0x0f)) -} - -// Given a TType value, find the appropriate TCompactProtocol.Types constant. -func (p *TCompactProtocol) getCompactType(t TType) tCompactType { - return ttypeToCompactType[t] -} - -func (p *TCompactProtocol) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(p.trans, conf) - PropagateTConfiguration(p.origTransport, conf) - p.cfg = conf -} - -var ( - _ TConfigurationSetter = (*TCompactProtocolFactory)(nil) - _ TConfigurationSetter = (*TCompactProtocol)(nil) -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/configuration.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/configuration.go deleted file mode 100644 index 454d9f37748..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/configuration.go +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "crypto/tls" - "fmt" - "time" -) - -// Default TConfiguration values. -const ( - DEFAULT_MAX_MESSAGE_SIZE = 100 * 1024 * 1024 - DEFAULT_MAX_FRAME_SIZE = 16384000 - - DEFAULT_TBINARY_STRICT_READ = false - DEFAULT_TBINARY_STRICT_WRITE = true - - DEFAULT_CONNECT_TIMEOUT = 0 - DEFAULT_SOCKET_TIMEOUT = 0 -) - -// TConfiguration defines some configurations shared between TTransport, -// TProtocol, TTransportFactory, TProtocolFactory, and other implementations. -// -// When constructing TConfiguration, you only need to specify the non-default -// fields. All zero values have sane default values. -// -// Not all configurations defined are applicable to all implementations. -// Implementations are free to ignore the configurations not applicable to them. -// -// All functions attached to this type are nil-safe. -// -// See [1] for spec. -// -// NOTE: When using TConfiguration, fill in all the configurations you want to -// set across the stack, not only the ones you want to set in the immediate -// TTransport/TProtocol. -// -// For example, say you want to migrate this old code into using TConfiguration: -// -// sccket := thrift.NewTSocketTimeout("host:port", time.Second) -// transFactory := thrift.NewTFramedTransportFactoryMaxLength( -// thrift.NewTTransportFactory(), -// 1024 * 1024 * 256, -// ) -// protoFactory := thrift.NewTBinaryProtocolFactory(true, true) -// -// This is the wrong way to do it because in the end the TConfiguration used by -// socket and transFactory will be overwritten by the one used by protoFactory -// because of TConfiguration propagation: -// -// // bad example, DO NOT USE -// sccket := thrift.NewTSocketConf("host:port", &thrift.TConfiguration{ -// ConnectTimeout: time.Second, -// SocketTimeout: time.Second, -// }) -// transFactory := thrift.NewTFramedTransportFactoryConf( -// thrift.NewTTransportFactory(), -// &thrift.TConfiguration{ -// MaxFrameSize: 1024 * 1024 * 256, -// }, -// ) -// protoFactory := thrift.NewTBinaryProtocolFactoryConf(&thrift.TConfiguration{ -// TBinaryStrictRead: thrift.BoolPtr(true), -// TBinaryStrictWrite: thrift.BoolPtr(true), -// }) -// -// This is the correct way to do it: -// -// conf := &thrift.TConfiguration{ -// ConnectTimeout: time.Second, -// SocketTimeout: time.Second, -// -// MaxFrameSize: 1024 * 1024 * 256, -// -// TBinaryStrictRead: thrift.BoolPtr(true), -// TBinaryStrictWrite: thrift.BoolPtr(true), -// } -// sccket := thrift.NewTSocketConf("host:port", conf) -// transFactory := thrift.NewTFramedTransportFactoryConf(thrift.NewTTransportFactory(), conf) -// protoFactory := thrift.NewTBinaryProtocolFactoryConf(conf) -// -// [1]: https://github.com/apache/thrift/blob/master/doc/specs/thrift-tconfiguration.md -type TConfiguration struct { - // If <= 0, DEFAULT_MAX_MESSAGE_SIZE will be used instead. - MaxMessageSize int32 - - // If <= 0, DEFAULT_MAX_FRAME_SIZE will be used instead. - // - // Also if MaxMessageSize < MaxFrameSize, - // MaxMessageSize will be used instead. - MaxFrameSize int32 - - // Connect and socket timeouts to be used by TSocket and TSSLSocket. - // - // 0 means no timeout. - // - // If <0, DEFAULT_CONNECT_TIMEOUT and DEFAULT_SOCKET_TIMEOUT will be - // used. - ConnectTimeout time.Duration - SocketTimeout time.Duration - - // TLS config to be used by TSSLSocket. - TLSConfig *tls.Config - - // Strict read/write configurations for TBinaryProtocol. - // - // BoolPtr helper function is available to use literal values. - TBinaryStrictRead *bool - TBinaryStrictWrite *bool - - // The wrapped protocol id to be used in THeader transport/protocol. - // - // THeaderProtocolIDPtr and THeaderProtocolIDPtrMust helper functions - // are provided to help filling this value. - THeaderProtocolID *THeaderProtocolID - - // Used internally by deprecated constructors, to avoid overriding - // underlying TTransport/TProtocol's cfg by accidental propagations. - // - // For external users this is always false. - noPropagation bool -} - -// GetMaxMessageSize returns the max message size an implementation should -// follow. -// -// It's nil-safe. DEFAULT_MAX_MESSAGE_SIZE will be returned if tc is nil. -func (tc *TConfiguration) GetMaxMessageSize() int32 { - if tc == nil || tc.MaxMessageSize <= 0 { - return DEFAULT_MAX_MESSAGE_SIZE - } - return tc.MaxMessageSize -} - -// GetMaxFrameSize returns the max frame size an implementation should follow. -// -// It's nil-safe. DEFAULT_MAX_FRAME_SIZE will be returned if tc is nil. -// -// If the configured max message size is smaller than the configured max frame -// size, the smaller one will be returned instead. -func (tc *TConfiguration) GetMaxFrameSize() int32 { - if tc == nil { - return DEFAULT_MAX_FRAME_SIZE - } - maxFrameSize := tc.MaxFrameSize - if maxFrameSize <= 0 { - maxFrameSize = DEFAULT_MAX_FRAME_SIZE - } - if maxMessageSize := tc.GetMaxMessageSize(); maxMessageSize < maxFrameSize { - return maxMessageSize - } - return maxFrameSize -} - -// GetConnectTimeout returns the connect timeout should be used by TSocket and -// TSSLSocket. -// -// It's nil-safe. If tc is nil, DEFAULT_CONNECT_TIMEOUT will be returned instead. -func (tc *TConfiguration) GetConnectTimeout() time.Duration { - if tc == nil || tc.ConnectTimeout < 0 { - return DEFAULT_CONNECT_TIMEOUT - } - return tc.ConnectTimeout -} - -// GetSocketTimeout returns the socket timeout should be used by TSocket and -// TSSLSocket. -// -// It's nil-safe. If tc is nil, DEFAULT_SOCKET_TIMEOUT will be returned instead. -func (tc *TConfiguration) GetSocketTimeout() time.Duration { - if tc == nil || tc.SocketTimeout < 0 { - return DEFAULT_SOCKET_TIMEOUT - } - return tc.SocketTimeout -} - -// GetTLSConfig returns the tls config should be used by TSSLSocket. -// -// It's nil-safe. If tc is nil, nil will be returned instead. -func (tc *TConfiguration) GetTLSConfig() *tls.Config { - if tc == nil { - return nil - } - return tc.TLSConfig -} - -// GetTBinaryStrictRead returns the strict read configuration TBinaryProtocol -// should follow. -// -// It's nil-safe. DEFAULT_TBINARY_STRICT_READ will be returned if either tc or -// tc.TBinaryStrictRead is nil. -func (tc *TConfiguration) GetTBinaryStrictRead() bool { - if tc == nil || tc.TBinaryStrictRead == nil { - return DEFAULT_TBINARY_STRICT_READ - } - return *tc.TBinaryStrictRead -} - -// GetTBinaryStrictWrite returns the strict read configuration TBinaryProtocol -// should follow. -// -// It's nil-safe. DEFAULT_TBINARY_STRICT_WRITE will be returned if either tc or -// tc.TBinaryStrictWrite is nil. -func (tc *TConfiguration) GetTBinaryStrictWrite() bool { - if tc == nil || tc.TBinaryStrictWrite == nil { - return DEFAULT_TBINARY_STRICT_WRITE - } - return *tc.TBinaryStrictWrite -} - -// GetTHeaderProtocolID returns the THeaderProtocolID should be used by -// THeaderProtocol clients (for servers, they always use the same one as the -// client instead). -// -// It's nil-safe. If either tc or tc.THeaderProtocolID is nil, -// THeaderProtocolDefault will be returned instead. -// THeaderProtocolDefault will also be returned if configured value is invalid. -func (tc *TConfiguration) GetTHeaderProtocolID() THeaderProtocolID { - if tc == nil || tc.THeaderProtocolID == nil { - return THeaderProtocolDefault - } - protoID := *tc.THeaderProtocolID - if err := protoID.Validate(); err != nil { - return THeaderProtocolDefault - } - return protoID -} - -// THeaderProtocolIDPtr validates and returns the pointer to id. -// -// If id is not a valid THeaderProtocolID, a pointer to THeaderProtocolDefault -// and the validation error will be returned. -func THeaderProtocolIDPtr(id THeaderProtocolID) (*THeaderProtocolID, error) { - err := id.Validate() - if err != nil { - id = THeaderProtocolDefault - } - return &id, err -} - -// THeaderProtocolIDPtrMust validates and returns the pointer to id. -// -// It's similar to THeaderProtocolIDPtr, but it panics on validation errors -// instead of returning them. -func THeaderProtocolIDPtrMust(id THeaderProtocolID) *THeaderProtocolID { - ptr, err := THeaderProtocolIDPtr(id) - if err != nil { - panic(err) - } - return ptr -} - -// TConfigurationSetter is an optional interface TProtocol, TTransport, -// TProtocolFactory, TTransportFactory, and other implementations can implement. -// -// It's intended to be called during intializations. -// The behavior of calling SetTConfiguration on a TTransport/TProtocol in the -// middle of a message is undefined: -// It may or may not change the behavior of the current processing message, -// and it may even cause the current message to fail. -// -// Note for implementations: SetTConfiguration might be called multiple times -// with the same value in quick successions due to the implementation of the -// propagation. Implementations should make SetTConfiguration as simple as -// possible (usually just overwrite the stored configuration and propagate it to -// the wrapped TTransports/TProtocols). -type TConfigurationSetter interface { - SetTConfiguration(*TConfiguration) -} - -// PropagateTConfiguration propagates cfg to impl if impl implements -// TConfigurationSetter and cfg is non-nil, otherwise it does nothing. -// -// NOTE: nil cfg is not propagated. If you want to propagate a TConfiguration -// with everything being default value, use &TConfiguration{} explicitly instead. -func PropagateTConfiguration(impl interface{}, cfg *TConfiguration) { - if cfg == nil || cfg.noPropagation { - return - } - - if setter, ok := impl.(TConfigurationSetter); ok { - setter.SetTConfiguration(cfg) - } -} - -func checkSizeForProtocol(size int32, cfg *TConfiguration) error { - if size < 0 { - return NewTProtocolExceptionWithType( - NEGATIVE_SIZE, - fmt.Errorf("negative size: %d", size), - ) - } - if size > cfg.GetMaxMessageSize() { - return NewTProtocolExceptionWithType( - SIZE_LIMIT, - fmt.Errorf("size exceeded max allowed: %d", size), - ) - } - return nil -} - -type tTransportFactoryConf struct { - delegate TTransportFactory - cfg *TConfiguration -} - -func (f *tTransportFactoryConf) GetTransport(orig TTransport) (TTransport, error) { - trans, err := f.delegate.GetTransport(orig) - if err == nil { - PropagateTConfiguration(orig, f.cfg) - PropagateTConfiguration(trans, f.cfg) - } - return trans, err -} - -func (f *tTransportFactoryConf) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(f.delegate, f.cfg) - f.cfg = cfg -} - -// TTransportFactoryConf wraps a TTransportFactory to propagate -// TConfiguration on the factory's GetTransport calls. -func TTransportFactoryConf(delegate TTransportFactory, conf *TConfiguration) TTransportFactory { - return &tTransportFactoryConf{ - delegate: delegate, - cfg: conf, - } -} - -type tProtocolFactoryConf struct { - delegate TProtocolFactory - cfg *TConfiguration -} - -func (f *tProtocolFactoryConf) GetProtocol(trans TTransport) TProtocol { - proto := f.delegate.GetProtocol(trans) - PropagateTConfiguration(trans, f.cfg) - PropagateTConfiguration(proto, f.cfg) - return proto -} - -func (f *tProtocolFactoryConf) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(f.delegate, f.cfg) - f.cfg = cfg -} - -// TProtocolFactoryConf wraps a TProtocolFactory to propagate -// TConfiguration on the factory's GetProtocol calls. -func TProtocolFactoryConf(delegate TProtocolFactory, conf *TConfiguration) TProtocolFactory { - return &tProtocolFactoryConf{ - delegate: delegate, - cfg: conf, - } -} - -var ( - _ TConfigurationSetter = (*tTransportFactoryConf)(nil) - _ TConfigurationSetter = (*tProtocolFactoryConf)(nil) -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/context.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/context.go deleted file mode 100644 index d15c1bcf894..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/context.go +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import "context" - -var defaultCtx = context.Background() diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/debug_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/debug_protocol.go deleted file mode 100644 index fdf9bfec15e..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/debug_protocol.go +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "fmt" -) - -type TDebugProtocol struct { - // Required. The actual TProtocol to do the read/write. - Delegate TProtocol - - // Optional. The logger and prefix to log all the args/return values - // from Delegate TProtocol calls. - // - // If Logger is nil, StdLogger using stdlib log package with os.Stderr - // will be used. If disable logging is desired, set Logger to NopLogger - // explicitly instead of leaving it as nil/unset. - Logger Logger - LogPrefix string - - // Optional. An TProtocol to duplicate everything read/written from Delegate. - // - // A typical use case of this is to use TSimpleJSONProtocol wrapping - // TMemoryBuffer in a middleware to json logging requests/responses. - // - // This feature is not available from TDebugProtocolFactory. In order to - // use it you have to construct TDebugProtocol directly, or set DuplicateTo - // field after getting a TDebugProtocol from the factory. - DuplicateTo TProtocol -} - -type TDebugProtocolFactory struct { - Underlying TProtocolFactory - LogPrefix string - Logger Logger -} - -// NewTDebugProtocolFactory creates a TDebugProtocolFactory. -// -// Deprecated: Please use NewTDebugProtocolFactoryWithLogger or the struct -// itself instead. This version will use the default logger from standard -// library. -func NewTDebugProtocolFactory(underlying TProtocolFactory, logPrefix string) *TDebugProtocolFactory { - return &TDebugProtocolFactory{ - Underlying: underlying, - LogPrefix: logPrefix, - Logger: StdLogger(nil), - } -} - -// NewTDebugProtocolFactoryWithLogger creates a TDebugProtocolFactory. -func NewTDebugProtocolFactoryWithLogger(underlying TProtocolFactory, logPrefix string, logger Logger) *TDebugProtocolFactory { - return &TDebugProtocolFactory{ - Underlying: underlying, - LogPrefix: logPrefix, - Logger: logger, - } -} - -func (t *TDebugProtocolFactory) GetProtocol(trans TTransport) TProtocol { - return &TDebugProtocol{ - Delegate: t.Underlying.GetProtocol(trans), - LogPrefix: t.LogPrefix, - Logger: fallbackLogger(t.Logger), - } -} - -func (tdp *TDebugProtocol) logf(format string, v ...interface{}) { - fallbackLogger(tdp.Logger)(fmt.Sprintf(format, v...)) -} - -func (tdp *TDebugProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error { - err := tdp.Delegate.WriteMessageBegin(ctx, name, typeId, seqid) - tdp.logf("%sWriteMessageBegin(name=%#v, typeId=%#v, seqid=%#v) => %#v", tdp.LogPrefix, name, typeId, seqid, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMessageBegin(ctx, name, typeId, seqid) - } - return err -} -func (tdp *TDebugProtocol) WriteMessageEnd(ctx context.Context) error { - err := tdp.Delegate.WriteMessageEnd(ctx) - tdp.logf("%sWriteMessageEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMessageEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteStructBegin(ctx context.Context, name string) error { - err := tdp.Delegate.WriteStructBegin(ctx, name) - tdp.logf("%sWriteStructBegin(name=%#v) => %#v", tdp.LogPrefix, name, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteStructBegin(ctx, name) - } - return err -} -func (tdp *TDebugProtocol) WriteStructEnd(ctx context.Context) error { - err := tdp.Delegate.WriteStructEnd(ctx) - tdp.logf("%sWriteStructEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteStructEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error { - err := tdp.Delegate.WriteFieldBegin(ctx, name, typeId, id) - tdp.logf("%sWriteFieldBegin(name=%#v, typeId=%#v, id%#v) => %#v", tdp.LogPrefix, name, typeId, id, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteFieldBegin(ctx, name, typeId, id) - } - return err -} -func (tdp *TDebugProtocol) WriteFieldEnd(ctx context.Context) error { - err := tdp.Delegate.WriteFieldEnd(ctx) - tdp.logf("%sWriteFieldEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteFieldEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteFieldStop(ctx context.Context) error { - err := tdp.Delegate.WriteFieldStop(ctx) - tdp.logf("%sWriteFieldStop() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteFieldStop(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - err := tdp.Delegate.WriteMapBegin(ctx, keyType, valueType, size) - tdp.logf("%sWriteMapBegin(keyType=%#v, valueType=%#v, size=%#v) => %#v", tdp.LogPrefix, keyType, valueType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMapBegin(ctx, keyType, valueType, size) - } - return err -} -func (tdp *TDebugProtocol) WriteMapEnd(ctx context.Context) error { - err := tdp.Delegate.WriteMapEnd(ctx) - tdp.logf("%sWriteMapEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMapEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - err := tdp.Delegate.WriteListBegin(ctx, elemType, size) - tdp.logf("%sWriteListBegin(elemType=%#v, size=%#v) => %#v", tdp.LogPrefix, elemType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteListBegin(ctx, elemType, size) - } - return err -} -func (tdp *TDebugProtocol) WriteListEnd(ctx context.Context) error { - err := tdp.Delegate.WriteListEnd(ctx) - tdp.logf("%sWriteListEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteListEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - err := tdp.Delegate.WriteSetBegin(ctx, elemType, size) - tdp.logf("%sWriteSetBegin(elemType=%#v, size=%#v) => %#v", tdp.LogPrefix, elemType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteSetBegin(ctx, elemType, size) - } - return err -} -func (tdp *TDebugProtocol) WriteSetEnd(ctx context.Context) error { - err := tdp.Delegate.WriteSetEnd(ctx) - tdp.logf("%sWriteSetEnd() => %#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteSetEnd(ctx) - } - return err -} -func (tdp *TDebugProtocol) WriteBool(ctx context.Context, value bool) error { - err := tdp.Delegate.WriteBool(ctx, value) - tdp.logf("%sWriteBool(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteBool(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteByte(ctx context.Context, value int8) error { - err := tdp.Delegate.WriteByte(ctx, value) - tdp.logf("%sWriteByte(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteByte(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteI16(ctx context.Context, value int16) error { - err := tdp.Delegate.WriteI16(ctx, value) - tdp.logf("%sWriteI16(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI16(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteI32(ctx context.Context, value int32) error { - err := tdp.Delegate.WriteI32(ctx, value) - tdp.logf("%sWriteI32(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI32(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteI64(ctx context.Context, value int64) error { - err := tdp.Delegate.WriteI64(ctx, value) - tdp.logf("%sWriteI64(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI64(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteDouble(ctx context.Context, value float64) error { - err := tdp.Delegate.WriteDouble(ctx, value) - tdp.logf("%sWriteDouble(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteDouble(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteString(ctx context.Context, value string) error { - err := tdp.Delegate.WriteString(ctx, value) - tdp.logf("%sWriteString(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteString(ctx, value) - } - return err -} -func (tdp *TDebugProtocol) WriteBinary(ctx context.Context, value []byte) error { - err := tdp.Delegate.WriteBinary(ctx, value) - tdp.logf("%sWriteBinary(value=%#v) => %#v", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteBinary(ctx, value) - } - return err -} - -func (tdp *TDebugProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqid int32, err error) { - name, typeId, seqid, err = tdp.Delegate.ReadMessageBegin(ctx) - tdp.logf("%sReadMessageBegin() (name=%#v, typeId=%#v, seqid=%#v, err=%#v)", tdp.LogPrefix, name, typeId, seqid, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMessageBegin(ctx, name, typeId, seqid) - } - return -} -func (tdp *TDebugProtocol) ReadMessageEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadMessageEnd(ctx) - tdp.logf("%sReadMessageEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMessageEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - name, err = tdp.Delegate.ReadStructBegin(ctx) - tdp.logf("%sReadStructBegin() (name%#v, err=%#v)", tdp.LogPrefix, name, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteStructBegin(ctx, name) - } - return -} -func (tdp *TDebugProtocol) ReadStructEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadStructEnd(ctx) - tdp.logf("%sReadStructEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteStructEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadFieldBegin(ctx context.Context) (name string, typeId TType, id int16, err error) { - name, typeId, id, err = tdp.Delegate.ReadFieldBegin(ctx) - tdp.logf("%sReadFieldBegin() (name=%#v, typeId=%#v, id=%#v, err=%#v)", tdp.LogPrefix, name, typeId, id, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteFieldBegin(ctx, name, typeId, id) - } - return -} -func (tdp *TDebugProtocol) ReadFieldEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadFieldEnd(ctx) - tdp.logf("%sReadFieldEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteFieldEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, err error) { - keyType, valueType, size, err = tdp.Delegate.ReadMapBegin(ctx) - tdp.logf("%sReadMapBegin() (keyType=%#v, valueType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, keyType, valueType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMapBegin(ctx, keyType, valueType, size) - } - return -} -func (tdp *TDebugProtocol) ReadMapEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadMapEnd(ctx) - tdp.logf("%sReadMapEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteMapEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, err error) { - elemType, size, err = tdp.Delegate.ReadListBegin(ctx) - tdp.logf("%sReadListBegin() (elemType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, elemType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteListBegin(ctx, elemType, size) - } - return -} -func (tdp *TDebugProtocol) ReadListEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadListEnd(ctx) - tdp.logf("%sReadListEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteListEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, err error) { - elemType, size, err = tdp.Delegate.ReadSetBegin(ctx) - tdp.logf("%sReadSetBegin() (elemType=%#v, size=%#v, err=%#v)", tdp.LogPrefix, elemType, size, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteSetBegin(ctx, elemType, size) - } - return -} -func (tdp *TDebugProtocol) ReadSetEnd(ctx context.Context) (err error) { - err = tdp.Delegate.ReadSetEnd(ctx) - tdp.logf("%sReadSetEnd() err=%#v", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteSetEnd(ctx) - } - return -} -func (tdp *TDebugProtocol) ReadBool(ctx context.Context) (value bool, err error) { - value, err = tdp.Delegate.ReadBool(ctx) - tdp.logf("%sReadBool() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteBool(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadByte(ctx context.Context) (value int8, err error) { - value, err = tdp.Delegate.ReadByte(ctx) - tdp.logf("%sReadByte() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteByte(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadI16(ctx context.Context) (value int16, err error) { - value, err = tdp.Delegate.ReadI16(ctx) - tdp.logf("%sReadI16() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI16(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadI32(ctx context.Context) (value int32, err error) { - value, err = tdp.Delegate.ReadI32(ctx) - tdp.logf("%sReadI32() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI32(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadI64(ctx context.Context) (value int64, err error) { - value, err = tdp.Delegate.ReadI64(ctx) - tdp.logf("%sReadI64() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteI64(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadDouble(ctx context.Context) (value float64, err error) { - value, err = tdp.Delegate.ReadDouble(ctx) - tdp.logf("%sReadDouble() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteDouble(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadString(ctx context.Context) (value string, err error) { - value, err = tdp.Delegate.ReadString(ctx) - tdp.logf("%sReadString() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteString(ctx, value) - } - return -} -func (tdp *TDebugProtocol) ReadBinary(ctx context.Context) (value []byte, err error) { - value, err = tdp.Delegate.ReadBinary(ctx) - tdp.logf("%sReadBinary() (value=%#v, err=%#v)", tdp.LogPrefix, value, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.WriteBinary(ctx, value) - } - return -} -func (tdp *TDebugProtocol) Skip(ctx context.Context, fieldType TType) (err error) { - err = tdp.Delegate.Skip(ctx, fieldType) - tdp.logf("%sSkip(fieldType=%#v) (err=%#v)", tdp.LogPrefix, fieldType, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.Skip(ctx, fieldType) - } - return -} -func (tdp *TDebugProtocol) Flush(ctx context.Context) (err error) { - err = tdp.Delegate.Flush(ctx) - tdp.logf("%sFlush() (err=%#v)", tdp.LogPrefix, err) - if tdp.DuplicateTo != nil { - tdp.DuplicateTo.Flush(ctx) - } - return -} - -func (tdp *TDebugProtocol) Transport() TTransport { - return tdp.Delegate.Transport() -} - -// SetTConfiguration implements TConfigurationSetter for propagation. -func (tdp *TDebugProtocol) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(tdp.Delegate, conf) - PropagateTConfiguration(tdp.DuplicateTo, conf) -} - -var _ TConfigurationSetter = (*TDebugProtocol)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/deserializer.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/deserializer.go deleted file mode 100644 index cefc7ecda5d..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/deserializer.go +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "sync" -) - -type TDeserializer struct { - Transport *TMemoryBuffer - Protocol TProtocol -} - -func NewTDeserializer() *TDeserializer { - transport := NewTMemoryBufferLen(1024) - protocol := NewTBinaryProtocolTransport(transport) - - return &TDeserializer{ - Transport: transport, - Protocol: protocol, - } -} - -func (t *TDeserializer) ReadString(ctx context.Context, msg TStruct, s string) (err error) { - t.Transport.Reset() - - err = nil - if _, err = t.Transport.Write([]byte(s)); err != nil { - return - } - if err = msg.Read(ctx, t.Protocol); err != nil { - return - } - return -} - -func (t *TDeserializer) Read(ctx context.Context, msg TStruct, b []byte) (err error) { - t.Transport.Reset() - - err = nil - if _, err = t.Transport.Write(b); err != nil { - return - } - if err = msg.Read(ctx, t.Protocol); err != nil { - return - } - return -} - -// TDeserializerPool is the thread-safe version of TDeserializer, -// it uses resource pool of TDeserializer under the hood. -// -// It must be initialized with either NewTDeserializerPool or -// NewTDeserializerPoolSizeFactory. -type TDeserializerPool struct { - pool sync.Pool -} - -// NewTDeserializerPool creates a new TDeserializerPool. -// -// NewTDeserializer can be used as the arg here. -func NewTDeserializerPool(f func() *TDeserializer) *TDeserializerPool { - return &TDeserializerPool{ - pool: sync.Pool{ - New: func() interface{} { - return f() - }, - }, - } -} - -// NewTDeserializerPoolSizeFactory creates a new TDeserializerPool with -// the given size and protocol factory. -// -// Note that the size is not the limit. The TMemoryBuffer underneath can grow -// larger than that. It just dictates the initial size. -func NewTDeserializerPoolSizeFactory(size int, factory TProtocolFactory) *TDeserializerPool { - return &TDeserializerPool{ - pool: sync.Pool{ - New: func() interface{} { - transport := NewTMemoryBufferLen(size) - protocol := factory.GetProtocol(transport) - - return &TDeserializer{ - Transport: transport, - Protocol: protocol, - } - }, - }, - } -} - -func (t *TDeserializerPool) ReadString(ctx context.Context, msg TStruct, s string) error { - d := t.pool.Get().(*TDeserializer) - defer t.pool.Put(d) - return d.ReadString(ctx, msg, s) -} - -func (t *TDeserializerPool) Read(ctx context.Context, msg TStruct, b []byte) error { - d := t.pool.Get().(*TDeserializer) - defer t.pool.Put(d) - return d.Read(ctx, msg, b) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go deleted file mode 100644 index 630b938f004..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/exception.go +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "errors" -) - -// Generic Thrift exception -type TException interface { - error - - TExceptionType() TExceptionType -} - -// Prepends additional information to an error without losing the Thrift exception interface -func PrependError(prepend string, err error) error { - msg := prepend + err.Error() - - var te TException - if errors.As(err, &te) { - switch te.TExceptionType() { - case TExceptionTypeTransport: - if t, ok := err.(TTransportException); ok { - return prependTTransportException(prepend, t) - } - case TExceptionTypeProtocol: - if t, ok := err.(TProtocolException); ok { - return prependTProtocolException(prepend, t) - } - case TExceptionTypeApplication: - var t TApplicationException - if errors.As(err, &t) { - return NewTApplicationException(t.TypeId(), msg) - } - } - - return wrappedTException{ - err: err, - msg: msg, - tExceptionType: te.TExceptionType(), - } - } - - return errors.New(msg) -} - -// TExceptionType is an enum type to categorize different "subclasses" of TExceptions. -type TExceptionType byte - -// TExceptionType values -const ( - TExceptionTypeUnknown TExceptionType = iota - TExceptionTypeCompiled // TExceptions defined in thrift files and generated by thrift compiler - TExceptionTypeApplication // TApplicationExceptions - TExceptionTypeProtocol // TProtocolExceptions - TExceptionTypeTransport // TTransportExceptions -) - -// WrapTException wraps an error into TException. -// -// If err is nil or already TException, it's returned as-is. -// Otherwise it will be wrapped into TException with TExceptionType() returning -// TExceptionTypeUnknown, and Unwrap() returning the original error. -func WrapTException(err error) TException { - if err == nil { - return nil - } - - if te, ok := err.(TException); ok { - return te - } - - return wrappedTException{ - err: err, - msg: err.Error(), - tExceptionType: TExceptionTypeUnknown, - } -} - -type wrappedTException struct { - err error - msg string - tExceptionType TExceptionType -} - -func (w wrappedTException) Error() string { - return w.msg -} - -func (w wrappedTException) TExceptionType() TExceptionType { - return w.tExceptionType -} - -func (w wrappedTException) Unwrap() error { - return w.err -} - -var _ TException = wrappedTException{} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/framed_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/framed_transport.go deleted file mode 100644 index f683e7f544b..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/framed_transport.go +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bufio" - "bytes" - "context" - "encoding/binary" - "fmt" - "io" -) - -// Deprecated: Use DEFAULT_MAX_FRAME_SIZE instead. -const DEFAULT_MAX_LENGTH = 16384000 - -type TFramedTransport struct { - transport TTransport - - cfg *TConfiguration - - writeBuf bytes.Buffer - - reader *bufio.Reader - readBuf bytes.Buffer - - buffer [4]byte -} - -type tFramedTransportFactory struct { - factory TTransportFactory - cfg *TConfiguration -} - -// Deprecated: Use NewTFramedTransportFactoryConf instead. -func NewTFramedTransportFactory(factory TTransportFactory) TTransportFactory { - return NewTFramedTransportFactoryConf(factory, &TConfiguration{ - MaxFrameSize: DEFAULT_MAX_LENGTH, - - noPropagation: true, - }) -} - -// Deprecated: Use NewTFramedTransportFactoryConf instead. -func NewTFramedTransportFactoryMaxLength(factory TTransportFactory, maxLength uint32) TTransportFactory { - return NewTFramedTransportFactoryConf(factory, &TConfiguration{ - MaxFrameSize: int32(maxLength), - - noPropagation: true, - }) -} - -func NewTFramedTransportFactoryConf(factory TTransportFactory, conf *TConfiguration) TTransportFactory { - PropagateTConfiguration(factory, conf) - return &tFramedTransportFactory{ - factory: factory, - cfg: conf, - } -} - -func (p *tFramedTransportFactory) GetTransport(base TTransport) (TTransport, error) { - PropagateTConfiguration(base, p.cfg) - tt, err := p.factory.GetTransport(base) - if err != nil { - return nil, err - } - return NewTFramedTransportConf(tt, p.cfg), nil -} - -func (p *tFramedTransportFactory) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(p.factory, cfg) - p.cfg = cfg -} - -// Deprecated: Use NewTFramedTransportConf instead. -func NewTFramedTransport(transport TTransport) *TFramedTransport { - return NewTFramedTransportConf(transport, &TConfiguration{ - MaxFrameSize: DEFAULT_MAX_LENGTH, - - noPropagation: true, - }) -} - -// Deprecated: Use NewTFramedTransportConf instead. -func NewTFramedTransportMaxLength(transport TTransport, maxLength uint32) *TFramedTransport { - return NewTFramedTransportConf(transport, &TConfiguration{ - MaxFrameSize: int32(maxLength), - - noPropagation: true, - }) -} - -func NewTFramedTransportConf(transport TTransport, conf *TConfiguration) *TFramedTransport { - PropagateTConfiguration(transport, conf) - return &TFramedTransport{ - transport: transport, - reader: bufio.NewReader(transport), - cfg: conf, - } -} - -func (p *TFramedTransport) Open() error { - return p.transport.Open() -} - -func (p *TFramedTransport) IsOpen() bool { - return p.transport.IsOpen() -} - -func (p *TFramedTransport) Close() error { - return p.transport.Close() -} - -func (p *TFramedTransport) Read(buf []byte) (read int, err error) { - read, err = p.readBuf.Read(buf) - if err != io.EOF { - return - } - - // For bytes.Buffer.Read, EOF would only happen when read is zero, - // but still, do a sanity check, - // in case that behavior is changed in a future version of go stdlib. - // When that happens, just return nil error, - // and let the caller call Read again to read the next frame. - if read > 0 { - return read, nil - } - - // Reaching here means that the last Read finished the last frame, - // so we need to read the next frame into readBuf now. - if err = p.readFrame(); err != nil { - return read, err - } - newRead, err := p.Read(buf[read:]) - return read + newRead, err -} - -func (p *TFramedTransport) ReadByte() (c byte, err error) { - buf := p.buffer[:1] - _, err = p.Read(buf) - if err != nil { - return - } - c = buf[0] - return -} - -func (p *TFramedTransport) Write(buf []byte) (int, error) { - n, err := p.writeBuf.Write(buf) - return n, NewTTransportExceptionFromError(err) -} - -func (p *TFramedTransport) WriteByte(c byte) error { - return p.writeBuf.WriteByte(c) -} - -func (p *TFramedTransport) WriteString(s string) (n int, err error) { - return p.writeBuf.WriteString(s) -} - -func (p *TFramedTransport) Flush(ctx context.Context) error { - size := p.writeBuf.Len() - buf := p.buffer[:4] - binary.BigEndian.PutUint32(buf, uint32(size)) - _, err := p.transport.Write(buf) - if err != nil { - p.writeBuf.Reset() - return NewTTransportExceptionFromError(err) - } - if size > 0 { - if _, err := io.Copy(p.transport, &p.writeBuf); err != nil { - p.writeBuf.Reset() - return NewTTransportExceptionFromError(err) - } - } - err = p.transport.Flush(ctx) - return NewTTransportExceptionFromError(err) -} - -func (p *TFramedTransport) readFrame() error { - buf := p.buffer[:4] - if _, err := io.ReadFull(p.reader, buf); err != nil { - return err - } - size := binary.BigEndian.Uint32(buf) - if size < 0 || size > uint32(p.cfg.GetMaxFrameSize()) { - return NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, fmt.Sprintf("Incorrect frame size (%d)", size)) - } - _, err := io.CopyN(&p.readBuf, p.reader, int64(size)) - return NewTTransportExceptionFromError(err) -} - -func (p *TFramedTransport) RemainingBytes() (num_bytes uint64) { - return uint64(p.readBuf.Len()) -} - -// SetTConfiguration implements TConfigurationSetter. -func (p *TFramedTransport) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(p.transport, cfg) - p.cfg = cfg -} - -var ( - _ TConfigurationSetter = (*tFramedTransportFactory)(nil) - _ TConfigurationSetter = (*TFramedTransport)(nil) -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_context.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_context.go deleted file mode 100644 index ac9bd4882be..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_context.go +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" -) - -// See https://godoc.org/context#WithValue on why do we need the unexported typedefs. -type ( - headerKey string - headerKeyList int -) - -// Values for headerKeyList. -const ( - headerKeyListRead headerKeyList = iota - headerKeyListWrite -) - -// SetHeader sets a header in the context. -func SetHeader(ctx context.Context, key, value string) context.Context { - return context.WithValue( - ctx, - headerKey(key), - value, - ) -} - -// UnsetHeader unsets a previously set header in the context. -func UnsetHeader(ctx context.Context, key string) context.Context { - return context.WithValue( - ctx, - headerKey(key), - nil, - ) -} - -// GetHeader returns a value of the given header from the context. -func GetHeader(ctx context.Context, key string) (value string, ok bool) { - if v := ctx.Value(headerKey(key)); v != nil { - value, ok = v.(string) - } - return -} - -// SetReadHeaderList sets the key list of read THeaders in the context. -func SetReadHeaderList(ctx context.Context, keys []string) context.Context { - return context.WithValue( - ctx, - headerKeyListRead, - keys, - ) -} - -// GetReadHeaderList returns the key list of read THeaders from the context. -func GetReadHeaderList(ctx context.Context) []string { - if v := ctx.Value(headerKeyListRead); v != nil { - if value, ok := v.([]string); ok { - return value - } - } - return nil -} - -// SetWriteHeaderList sets the key list of THeaders to write in the context. -func SetWriteHeaderList(ctx context.Context, keys []string) context.Context { - return context.WithValue( - ctx, - headerKeyListWrite, - keys, - ) -} - -// GetWriteHeaderList returns the key list of THeaders to write from the context. -func GetWriteHeaderList(ctx context.Context) []string { - if v := ctx.Value(headerKeyListWrite); v != nil { - if value, ok := v.([]string); ok { - return value - } - } - return nil -} - -// AddReadTHeaderToContext adds the whole THeader headers into context. -func AddReadTHeaderToContext(ctx context.Context, headers THeaderMap) context.Context { - keys := make([]string, 0, len(headers)) - for key, value := range headers { - ctx = SetHeader(ctx, key, value) - keys = append(keys, key) - } - return SetReadHeaderList(ctx, keys) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_protocol.go deleted file mode 100644 index 878041f8df1..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_protocol.go +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "errors" -) - -// THeaderProtocol is a thrift protocol that implements THeader: -// https://github.com/apache/thrift/blob/master/doc/specs/HeaderFormat.md -// -// It supports either binary or compact protocol as the wrapped protocol. -// -// Most of the THeader handlings are happening inside THeaderTransport. -type THeaderProtocol struct { - transport *THeaderTransport - - // Will be initialized on first read/write. - protocol TProtocol - - cfg *TConfiguration -} - -// Deprecated: Use NewTHeaderProtocolConf instead. -func NewTHeaderProtocol(trans TTransport) *THeaderProtocol { - return newTHeaderProtocolConf(trans, &TConfiguration{ - noPropagation: true, - }) -} - -// NewTHeaderProtocolConf creates a new THeaderProtocol from the underlying -// transport with given TConfiguration. -// -// The passed in transport will be wrapped with THeaderTransport. -// -// Note that THeaderTransport handles frame and zlib by itself, -// so the underlying transport should be a raw socket transports (TSocket or TSSLSocket), -// instead of rich transports like TZlibTransport or TFramedTransport. -func NewTHeaderProtocolConf(trans TTransport, conf *TConfiguration) *THeaderProtocol { - return newTHeaderProtocolConf(trans, conf) -} - -func newTHeaderProtocolConf(trans TTransport, cfg *TConfiguration) *THeaderProtocol { - t := NewTHeaderTransportConf(trans, cfg) - p, _ := t.cfg.GetTHeaderProtocolID().GetProtocol(t) - PropagateTConfiguration(p, cfg) - return &THeaderProtocol{ - transport: t, - protocol: p, - cfg: cfg, - } -} - -type tHeaderProtocolFactory struct { - cfg *TConfiguration -} - -func (f tHeaderProtocolFactory) GetProtocol(trans TTransport) TProtocol { - return newTHeaderProtocolConf(trans, f.cfg) -} - -func (f *tHeaderProtocolFactory) SetTConfiguration(cfg *TConfiguration) { - f.cfg = cfg -} - -// Deprecated: Use NewTHeaderProtocolFactoryConf instead. -func NewTHeaderProtocolFactory() TProtocolFactory { - return NewTHeaderProtocolFactoryConf(&TConfiguration{ - noPropagation: true, - }) -} - -// NewTHeaderProtocolFactoryConf creates a factory for THeader with given -// TConfiguration. -func NewTHeaderProtocolFactoryConf(conf *TConfiguration) TProtocolFactory { - return tHeaderProtocolFactory{ - cfg: conf, - } -} - -// Transport returns the underlying transport. -// -// It's guaranteed to be of type *THeaderTransport. -func (p *THeaderProtocol) Transport() TTransport { - return p.transport -} - -// GetReadHeaders returns the THeaderMap read from transport. -func (p *THeaderProtocol) GetReadHeaders() THeaderMap { - return p.transport.GetReadHeaders() -} - -// SetWriteHeader sets a header for write. -func (p *THeaderProtocol) SetWriteHeader(key, value string) { - p.transport.SetWriteHeader(key, value) -} - -// ClearWriteHeaders clears all write headers previously set. -func (p *THeaderProtocol) ClearWriteHeaders() { - p.transport.ClearWriteHeaders() -} - -// AddTransform add a transform for writing. -func (p *THeaderProtocol) AddTransform(transform THeaderTransformID) error { - return p.transport.AddTransform(transform) -} - -func (p *THeaderProtocol) Flush(ctx context.Context) error { - return p.transport.Flush(ctx) -} - -func (p *THeaderProtocol) WriteMessageBegin(ctx context.Context, name string, typeID TMessageType, seqID int32) error { - newProto, err := p.transport.Protocol().GetProtocol(p.transport) - if err != nil { - return err - } - PropagateTConfiguration(newProto, p.cfg) - p.protocol = newProto - p.transport.SequenceID = seqID - return p.protocol.WriteMessageBegin(ctx, name, typeID, seqID) -} - -func (p *THeaderProtocol) WriteMessageEnd(ctx context.Context) error { - if err := p.protocol.WriteMessageEnd(ctx); err != nil { - return err - } - return p.transport.Flush(ctx) -} - -func (p *THeaderProtocol) WriteStructBegin(ctx context.Context, name string) error { - return p.protocol.WriteStructBegin(ctx, name) -} - -func (p *THeaderProtocol) WriteStructEnd(ctx context.Context) error { - return p.protocol.WriteStructEnd(ctx) -} - -func (p *THeaderProtocol) WriteFieldBegin(ctx context.Context, name string, typeID TType, id int16) error { - return p.protocol.WriteFieldBegin(ctx, name, typeID, id) -} - -func (p *THeaderProtocol) WriteFieldEnd(ctx context.Context) error { - return p.protocol.WriteFieldEnd(ctx) -} - -func (p *THeaderProtocol) WriteFieldStop(ctx context.Context) error { - return p.protocol.WriteFieldStop(ctx) -} - -func (p *THeaderProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - return p.protocol.WriteMapBegin(ctx, keyType, valueType, size) -} - -func (p *THeaderProtocol) WriteMapEnd(ctx context.Context) error { - return p.protocol.WriteMapEnd(ctx) -} - -func (p *THeaderProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - return p.protocol.WriteListBegin(ctx, elemType, size) -} - -func (p *THeaderProtocol) WriteListEnd(ctx context.Context) error { - return p.protocol.WriteListEnd(ctx) -} - -func (p *THeaderProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - return p.protocol.WriteSetBegin(ctx, elemType, size) -} - -func (p *THeaderProtocol) WriteSetEnd(ctx context.Context) error { - return p.protocol.WriteSetEnd(ctx) -} - -func (p *THeaderProtocol) WriteBool(ctx context.Context, value bool) error { - return p.protocol.WriteBool(ctx, value) -} - -func (p *THeaderProtocol) WriteByte(ctx context.Context, value int8) error { - return p.protocol.WriteByte(ctx, value) -} - -func (p *THeaderProtocol) WriteI16(ctx context.Context, value int16) error { - return p.protocol.WriteI16(ctx, value) -} - -func (p *THeaderProtocol) WriteI32(ctx context.Context, value int32) error { - return p.protocol.WriteI32(ctx, value) -} - -func (p *THeaderProtocol) WriteI64(ctx context.Context, value int64) error { - return p.protocol.WriteI64(ctx, value) -} - -func (p *THeaderProtocol) WriteDouble(ctx context.Context, value float64) error { - return p.protocol.WriteDouble(ctx, value) -} - -func (p *THeaderProtocol) WriteString(ctx context.Context, value string) error { - return p.protocol.WriteString(ctx, value) -} - -func (p *THeaderProtocol) WriteBinary(ctx context.Context, value []byte) error { - return p.protocol.WriteBinary(ctx, value) -} - -// ReadFrame calls underlying THeaderTransport's ReadFrame function. -func (p *THeaderProtocol) ReadFrame(ctx context.Context) error { - return p.transport.ReadFrame(ctx) -} - -func (p *THeaderProtocol) ReadMessageBegin(ctx context.Context) (name string, typeID TMessageType, seqID int32, err error) { - if err = p.transport.ReadFrame(ctx); err != nil { - return - } - - var newProto TProtocol - newProto, err = p.transport.Protocol().GetProtocol(p.transport) - if err != nil { - var tAppExc TApplicationException - if !errors.As(err, &tAppExc) { - return - } - if e := p.protocol.WriteMessageBegin(ctx, "", EXCEPTION, seqID); e != nil { - return - } - if e := tAppExc.Write(ctx, p.protocol); e != nil { - return - } - if e := p.protocol.WriteMessageEnd(ctx); e != nil { - return - } - if e := p.transport.Flush(ctx); e != nil { - return - } - return - } - PropagateTConfiguration(newProto, p.cfg) - p.protocol = newProto - - return p.protocol.ReadMessageBegin(ctx) -} - -func (p *THeaderProtocol) ReadMessageEnd(ctx context.Context) error { - return p.protocol.ReadMessageEnd(ctx) -} - -func (p *THeaderProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - return p.protocol.ReadStructBegin(ctx) -} - -func (p *THeaderProtocol) ReadStructEnd(ctx context.Context) error { - return p.protocol.ReadStructEnd(ctx) -} - -func (p *THeaderProtocol) ReadFieldBegin(ctx context.Context) (name string, typeID TType, id int16, err error) { - return p.protocol.ReadFieldBegin(ctx) -} - -func (p *THeaderProtocol) ReadFieldEnd(ctx context.Context) error { - return p.protocol.ReadFieldEnd(ctx) -} - -func (p *THeaderProtocol) ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, err error) { - return p.protocol.ReadMapBegin(ctx) -} - -func (p *THeaderProtocol) ReadMapEnd(ctx context.Context) error { - return p.protocol.ReadMapEnd(ctx) -} - -func (p *THeaderProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, err error) { - return p.protocol.ReadListBegin(ctx) -} - -func (p *THeaderProtocol) ReadListEnd(ctx context.Context) error { - return p.protocol.ReadListEnd(ctx) -} - -func (p *THeaderProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, err error) { - return p.protocol.ReadSetBegin(ctx) -} - -func (p *THeaderProtocol) ReadSetEnd(ctx context.Context) error { - return p.protocol.ReadSetEnd(ctx) -} - -func (p *THeaderProtocol) ReadBool(ctx context.Context) (value bool, err error) { - return p.protocol.ReadBool(ctx) -} - -func (p *THeaderProtocol) ReadByte(ctx context.Context) (value int8, err error) { - return p.protocol.ReadByte(ctx) -} - -func (p *THeaderProtocol) ReadI16(ctx context.Context) (value int16, err error) { - return p.protocol.ReadI16(ctx) -} - -func (p *THeaderProtocol) ReadI32(ctx context.Context) (value int32, err error) { - return p.protocol.ReadI32(ctx) -} - -func (p *THeaderProtocol) ReadI64(ctx context.Context) (value int64, err error) { - return p.protocol.ReadI64(ctx) -} - -func (p *THeaderProtocol) ReadDouble(ctx context.Context) (value float64, err error) { - return p.protocol.ReadDouble(ctx) -} - -func (p *THeaderProtocol) ReadString(ctx context.Context) (value string, err error) { - return p.protocol.ReadString(ctx) -} - -func (p *THeaderProtocol) ReadBinary(ctx context.Context) (value []byte, err error) { - return p.protocol.ReadBinary(ctx) -} - -func (p *THeaderProtocol) Skip(ctx context.Context, fieldType TType) error { - return p.protocol.Skip(ctx, fieldType) -} - -// SetTConfiguration implements TConfigurationSetter. -func (p *THeaderProtocol) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(p.transport, cfg) - PropagateTConfiguration(p.protocol, cfg) - p.cfg = cfg -} - -var ( - _ TConfigurationSetter = (*tHeaderProtocolFactory)(nil) - _ TConfigurationSetter = (*THeaderProtocol)(nil) -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go deleted file mode 100644 index 6a99535a459..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/header_transport.go +++ /dev/null @@ -1,809 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bufio" - "bytes" - "compress/zlib" - "context" - "encoding/binary" - "errors" - "fmt" - "io" -) - -// Size in bytes for 32-bit ints. -const size32 = 4 - -type headerMeta struct { - MagicFlags uint32 - SequenceID int32 - HeaderLength uint16 -} - -const headerMetaSize = 10 - -type clientType int - -const ( - clientUnknown clientType = iota - clientHeaders - clientFramedBinary - clientUnframedBinary - clientFramedCompact - clientUnframedCompact -) - -// Constants defined in THeader format: -// https://github.com/apache/thrift/blob/master/doc/specs/HeaderFormat.md -const ( - THeaderHeaderMagic uint32 = 0x0fff0000 - THeaderHeaderMask uint32 = 0xffff0000 - THeaderFlagsMask uint32 = 0x0000ffff - THeaderMaxFrameSize uint32 = 0x3fffffff -) - -// THeaderMap is the type of the header map in THeader transport. -type THeaderMap map[string]string - -// THeaderProtocolID is the wrapped protocol id used in THeader. -type THeaderProtocolID int32 - -// Supported THeaderProtocolID values. -const ( - THeaderProtocolBinary THeaderProtocolID = 0x00 - THeaderProtocolCompact THeaderProtocolID = 0x02 - THeaderProtocolDefault = THeaderProtocolBinary -) - -// Declared globally to avoid repetitive allocations, not really used. -var globalMemoryBuffer = NewTMemoryBuffer() - -// Validate checks whether the THeaderProtocolID is a valid/supported one. -func (id THeaderProtocolID) Validate() error { - _, err := id.GetProtocol(globalMemoryBuffer) - return err -} - -// GetProtocol gets the corresponding TProtocol from the wrapped protocol id. -func (id THeaderProtocolID) GetProtocol(trans TTransport) (TProtocol, error) { - switch id { - default: - return nil, NewTApplicationException( - INVALID_PROTOCOL, - fmt.Sprintf("THeader protocol id %d not supported", id), - ) - case THeaderProtocolBinary: - return NewTBinaryProtocolTransport(trans), nil - case THeaderProtocolCompact: - return NewTCompactProtocol(trans), nil - } -} - -// THeaderTransformID defines the numeric id of the transform used. -type THeaderTransformID int32 - -// THeaderTransformID values. -// -// Values not defined here are not currently supported, namely HMAC and Snappy. -const ( - TransformNone THeaderTransformID = iota // 0, no special handling - TransformZlib // 1, zlib -) - -var supportedTransformIDs = map[THeaderTransformID]bool{ - TransformNone: true, - TransformZlib: true, -} - -// TransformReader is an io.ReadCloser that handles transforms reading. -type TransformReader struct { - io.Reader - - closers []io.Closer -} - -var _ io.ReadCloser = (*TransformReader)(nil) - -// NewTransformReaderWithCapacity initializes a TransformReader with expected -// closers capacity. -// -// If you don't know the closers capacity beforehand, just use -// -// &TransformReader{Reader: baseReader} -// -// instead would be sufficient. -func NewTransformReaderWithCapacity(baseReader io.Reader, capacity int) *TransformReader { - return &TransformReader{ - Reader: baseReader, - closers: make([]io.Closer, 0, capacity), - } -} - -// Close calls the underlying closers in appropriate order, -// stops at and returns the first error encountered. -func (tr *TransformReader) Close() error { - // Call closers in reversed order - for i := len(tr.closers) - 1; i >= 0; i-- { - if err := tr.closers[i].Close(); err != nil { - return err - } - } - return nil -} - -// AddTransform adds a transform. -func (tr *TransformReader) AddTransform(id THeaderTransformID) error { - switch id { - default: - return NewTApplicationException( - INVALID_TRANSFORM, - fmt.Sprintf("THeaderTransformID %d not supported", id), - ) - case TransformNone: - // no-op - case TransformZlib: - readCloser, err := zlib.NewReader(tr.Reader) - if err != nil { - return err - } - tr.Reader = readCloser - tr.closers = append(tr.closers, readCloser) - } - return nil -} - -// TransformWriter is an io.WriteCloser that handles transforms writing. -type TransformWriter struct { - io.Writer - - closers []io.Closer -} - -var _ io.WriteCloser = (*TransformWriter)(nil) - -// NewTransformWriter creates a new TransformWriter with base writer and transforms. -func NewTransformWriter(baseWriter io.Writer, transforms []THeaderTransformID) (io.WriteCloser, error) { - writer := &TransformWriter{ - Writer: baseWriter, - closers: make([]io.Closer, 0, len(transforms)), - } - for _, id := range transforms { - if err := writer.AddTransform(id); err != nil { - return nil, err - } - } - return writer, nil -} - -// Close calls the underlying closers in appropriate order, -// stops at and returns the first error encountered. -func (tw *TransformWriter) Close() error { - // Call closers in reversed order - for i := len(tw.closers) - 1; i >= 0; i-- { - if err := tw.closers[i].Close(); err != nil { - return err - } - } - return nil -} - -// AddTransform adds a transform. -func (tw *TransformWriter) AddTransform(id THeaderTransformID) error { - switch id { - default: - return NewTApplicationException( - INVALID_TRANSFORM, - fmt.Sprintf("THeaderTransformID %d not supported", id), - ) - case TransformNone: - // no-op - case TransformZlib: - writeCloser := zlib.NewWriter(tw.Writer) - tw.Writer = writeCloser - tw.closers = append(tw.closers, writeCloser) - } - return nil -} - -// THeaderInfoType is the type id of the info headers. -type THeaderInfoType int32 - -// Supported THeaderInfoType values. -const ( - _ THeaderInfoType = iota // Skip 0 - InfoKeyValue // 1 - // Rest of the info types are not supported. -) - -// THeaderTransport is a Transport mode that implements THeader. -// -// Note that THeaderTransport handles frame and zlib by itself, -// so the underlying transport should be a raw socket transports (TSocket or TSSLSocket), -// instead of rich transports like TZlibTransport or TFramedTransport. -type THeaderTransport struct { - SequenceID int32 - Flags uint32 - - transport TTransport - - // THeaderMap for read and write - readHeaders THeaderMap - writeHeaders THeaderMap - - // Reading related variables. - reader *bufio.Reader - // When frame is detected, we read the frame fully into frameBuffer. - frameBuffer bytes.Buffer - // When it's non-nil, Read should read from frameReader instead of - // reader, and EOF error indicates end of frame instead of end of all - // transport. - frameReader io.ReadCloser - - // Writing related variables - writeBuffer bytes.Buffer - writeTransforms []THeaderTransformID - - clientType clientType - protocolID THeaderProtocolID - cfg *TConfiguration - - // buffer is used in the following scenarios to avoid repetitive - // allocations, while 4 is big enough for all those scenarios: - // - // * header padding (max size 4) - // * write the frame size (size 4) - buffer [4]byte -} - -var _ TTransport = (*THeaderTransport)(nil) - -// Deprecated: Use NewTHeaderTransportConf instead. -func NewTHeaderTransport(trans TTransport) *THeaderTransport { - return NewTHeaderTransportConf(trans, &TConfiguration{ - noPropagation: true, - }) -} - -// NewTHeaderTransportConf creates THeaderTransport from the -// underlying transport, with given TConfiguration attached. -// -// If trans is already a *THeaderTransport, it will be returned as is, -// but with TConfiguration overridden by the value passed in. -// -// The protocol ID in TConfiguration is only useful for client transports. -// For servers, -// the protocol ID will be overridden again to the one set by the client, -// to ensure that servers always speak the same dialect as the client. -func NewTHeaderTransportConf(trans TTransport, conf *TConfiguration) *THeaderTransport { - if ht, ok := trans.(*THeaderTransport); ok { - ht.SetTConfiguration(conf) - return ht - } - PropagateTConfiguration(trans, conf) - return &THeaderTransport{ - transport: trans, - reader: bufio.NewReader(trans), - writeHeaders: make(THeaderMap), - protocolID: conf.GetTHeaderProtocolID(), - cfg: conf, - } -} - -// Open calls the underlying transport's Open function. -func (t *THeaderTransport) Open() error { - return t.transport.Open() -} - -// IsOpen calls the underlying transport's IsOpen function. -func (t *THeaderTransport) IsOpen() bool { - return t.transport.IsOpen() -} - -// ReadFrame tries to read the frame header, guess the client type, and handle -// unframed clients. -func (t *THeaderTransport) ReadFrame(ctx context.Context) error { - if !t.needReadFrame() { - // No need to read frame, skipping. - return nil - } - - // Peek and handle the first 32 bits. - // They could either be the length field of a framed message, - // or the first bytes of an unframed message. - var buf []byte - var err error - // This is also usually the first read from a connection, - // so handle retries around socket timeouts. - _, deadlineSet := ctx.Deadline() - for { - buf, err = t.reader.Peek(size32) - if deadlineSet && isTimeoutError(err) && ctx.Err() == nil { - // This is I/O timeout and we still have time, - // continue trying - continue - } - // For anything else, do not retry - break - } - if err != nil { - return err - } - - frameSize := binary.BigEndian.Uint32(buf) - if frameSize&VERSION_MASK == VERSION_1 { - t.clientType = clientUnframedBinary - return nil - } - if buf[0] == COMPACT_PROTOCOL_ID && buf[1]&COMPACT_VERSION_MASK == COMPACT_VERSION { - t.clientType = clientUnframedCompact - return nil - } - - // At this point it should be a framed message, - // sanity check on frameSize then discard the peeked part. - if frameSize > THeaderMaxFrameSize || frameSize > uint32(t.cfg.GetMaxFrameSize()) { - return NewTProtocolExceptionWithType( - SIZE_LIMIT, - errors.New("frame too large"), - ) - } - t.reader.Discard(size32) - - // Read the frame fully into frameBuffer. - _, err = io.CopyN(&t.frameBuffer, t.reader, int64(frameSize)) - if err != nil { - return err - } - t.frameReader = io.NopCloser(&t.frameBuffer) - - // Peek and handle the next 32 bits. - buf = t.frameBuffer.Bytes()[:size32] - version := binary.BigEndian.Uint32(buf) - if version&THeaderHeaderMask == THeaderHeaderMagic { - t.clientType = clientHeaders - return t.parseHeaders(ctx, frameSize) - } - if version&VERSION_MASK == VERSION_1 { - t.clientType = clientFramedBinary - return nil - } - if buf[0] == COMPACT_PROTOCOL_ID && buf[1]&COMPACT_VERSION_MASK == COMPACT_VERSION { - t.clientType = clientFramedCompact - return nil - } - if err := t.endOfFrame(); err != nil { - return err - } - return NewTProtocolExceptionWithType( - NOT_IMPLEMENTED, - errors.New("unsupported client transport type"), - ) -} - -// endOfFrame does end of frame handling. -// -// It closes frameReader, and also resets frame related states. -func (t *THeaderTransport) endOfFrame() error { - defer func() { - t.frameBuffer.Reset() - t.frameReader = nil - }() - return t.frameReader.Close() -} - -func (t *THeaderTransport) parseHeaders(ctx context.Context, frameSize uint32) error { - if t.clientType != clientHeaders { - return nil - } - - var err error - var meta headerMeta - if err = binary.Read(&t.frameBuffer, binary.BigEndian, &meta); err != nil { - return err - } - frameSize -= headerMetaSize - t.Flags = meta.MagicFlags & THeaderFlagsMask - t.SequenceID = meta.SequenceID - headerLength := int64(meta.HeaderLength) * 4 - if int64(frameSize) < headerLength { - return NewTProtocolExceptionWithType( - SIZE_LIMIT, - errors.New("header size is larger than the whole frame"), - ) - } - headerBuf := NewTMemoryBuffer() - _, err = io.CopyN(headerBuf, &t.frameBuffer, headerLength) - if err != nil { - return err - } - hp := NewTCompactProtocol(headerBuf) - hp.SetTConfiguration(t.cfg) - - // At this point the header is already read into headerBuf, - // and t.frameBuffer starts from the actual payload. - protoID, err := hp.readVarint32() - if err != nil { - return err - } - t.protocolID = THeaderProtocolID(protoID) - - var transformCount int32 - transformCount, err = hp.readVarint32() - if err != nil { - return err - } - if transformCount > 0 { - reader := NewTransformReaderWithCapacity( - &t.frameBuffer, - int(transformCount), - ) - t.frameReader = reader - transformIDs := make([]THeaderTransformID, transformCount) - for i := 0; i < int(transformCount); i++ { - id, err := hp.readVarint32() - if err != nil { - return err - } - transformIDs[i] = THeaderTransformID(id) - } - // The transform IDs on the wire was added based on the order of - // writing, so on the reading side we need to reverse the order. - for i := transformCount - 1; i >= 0; i-- { - id := transformIDs[i] - if err := reader.AddTransform(id); err != nil { - return err - } - } - } - - // The info part does not use the transforms yet, so it's - // important to continue using headerBuf. - headers := make(THeaderMap) - for { - infoType, err := hp.readVarint32() - if errors.Is(err, io.EOF) { - break - } - if err != nil { - return err - } - if THeaderInfoType(infoType) == InfoKeyValue { - count, err := hp.readVarint32() - if err != nil { - return err - } - for i := 0; i < int(count); i++ { - key, err := hp.ReadString(ctx) - if err != nil { - return err - } - value, err := hp.ReadString(ctx) - if err != nil { - return err - } - headers[key] = value - } - } else { - // Skip reading info section on the first - // unsupported info type. - break - } - } - t.readHeaders = headers - - return nil -} - -func (t *THeaderTransport) needReadFrame() bool { - if t.clientType == clientUnknown { - // This is a new connection that's never read before. - return true - } - if t.isFramed() && t.frameReader == nil { - // We just finished the last frame. - return true - } - return false -} - -func (t *THeaderTransport) Read(p []byte) (read int, err error) { - // Here using context.Background instead of a context passed in is safe. - // First is that there's no way to pass context into this function. - // Then, 99% of the case when calling this Read frame is already read - // into frameReader. ReadFrame here is more of preventing bugs that - // didn't call ReadFrame before calling Read. - err = t.ReadFrame(context.Background()) - if err != nil { - return - } - if t.frameReader != nil { - read, err = t.frameReader.Read(p) - if err == nil && t.frameBuffer.Len() <= 0 { - // the last Read finished the frame, do endOfFrame - // handling here. - err = t.endOfFrame() - } else if err == io.EOF { - err = t.endOfFrame() - if err != nil { - return - } - if read == 0 { - // Try to read the next frame when we hit EOF - // (end of frame) immediately. - // When we got here, it means the last read - // finished the previous frame, but didn't - // do endOfFrame handling yet. - // We have to read the next frame here, - // as otherwise we would return 0 and nil, - // which is a case not handled well by most - // protocol implementations. - return t.Read(p) - } - } - return - } - return t.reader.Read(p) -} - -// Write writes data to the write buffer. -// -// You need to call Flush to actually write them to the transport. -func (t *THeaderTransport) Write(p []byte) (int, error) { - return t.writeBuffer.Write(p) -} - -// Flush writes the appropriate header and the write buffer to the underlying transport. -func (t *THeaderTransport) Flush(ctx context.Context) error { - if t.writeBuffer.Len() == 0 { - return nil - } - - defer t.writeBuffer.Reset() - - switch t.clientType { - default: - fallthrough - case clientUnknown: - t.clientType = clientHeaders - fallthrough - case clientHeaders: - headers := NewTMemoryBuffer() - hp := NewTCompactProtocol(headers) - hp.SetTConfiguration(t.cfg) - if _, err := hp.writeVarint32(int32(t.protocolID)); err != nil { - return NewTTransportExceptionFromError(err) - } - if _, err := hp.writeVarint32(int32(len(t.writeTransforms))); err != nil { - return NewTTransportExceptionFromError(err) - } - for _, transform := range t.writeTransforms { - if _, err := hp.writeVarint32(int32(transform)); err != nil { - return NewTTransportExceptionFromError(err) - } - } - if len(t.writeHeaders) > 0 { - if _, err := hp.writeVarint32(int32(InfoKeyValue)); err != nil { - return NewTTransportExceptionFromError(err) - } - if _, err := hp.writeVarint32(int32(len(t.writeHeaders))); err != nil { - return NewTTransportExceptionFromError(err) - } - for key, value := range t.writeHeaders { - if err := hp.WriteString(ctx, key); err != nil { - return NewTTransportExceptionFromError(err) - } - if err := hp.WriteString(ctx, value); err != nil { - return NewTTransportExceptionFromError(err) - } - } - } - padding := 4 - headers.Len()%4 - if padding < 4 { - buf := t.buffer[:padding] - for i := range buf { - buf[i] = 0 - } - if _, err := headers.Write(buf); err != nil { - return NewTTransportExceptionFromError(err) - } - } - - var payload bytes.Buffer - meta := headerMeta{ - MagicFlags: THeaderHeaderMagic + t.Flags&THeaderFlagsMask, - SequenceID: t.SequenceID, - HeaderLength: uint16(headers.Len() / 4), - } - if err := binary.Write(&payload, binary.BigEndian, meta); err != nil { - return NewTTransportExceptionFromError(err) - } - if _, err := io.Copy(&payload, headers); err != nil { - return NewTTransportExceptionFromError(err) - } - - writer, err := NewTransformWriter(&payload, t.writeTransforms) - if err != nil { - return NewTTransportExceptionFromError(err) - } - if _, err := io.Copy(writer, &t.writeBuffer); err != nil { - return NewTTransportExceptionFromError(err) - } - if err := writer.Close(); err != nil { - return NewTTransportExceptionFromError(err) - } - - // First write frame length - buf := t.buffer[:size32] - binary.BigEndian.PutUint32(buf, uint32(payload.Len())) - if _, err := t.transport.Write(buf); err != nil { - return NewTTransportExceptionFromError(err) - } - // Then write the payload - if _, err := io.Copy(t.transport, &payload); err != nil { - return NewTTransportExceptionFromError(err) - } - - case clientFramedBinary, clientFramedCompact: - buf := t.buffer[:size32] - binary.BigEndian.PutUint32(buf, uint32(t.writeBuffer.Len())) - if _, err := t.transport.Write(buf); err != nil { - return NewTTransportExceptionFromError(err) - } - fallthrough - case clientUnframedBinary, clientUnframedCompact: - if _, err := io.Copy(t.transport, &t.writeBuffer); err != nil { - return NewTTransportExceptionFromError(err) - } - } - - select { - default: - case <-ctx.Done(): - return NewTTransportExceptionFromError(ctx.Err()) - } - - return t.transport.Flush(ctx) -} - -// Close closes the transport, along with its underlying transport. -func (t *THeaderTransport) Close() error { - if err := t.Flush(context.Background()); err != nil { - return err - } - return t.transport.Close() -} - -// RemainingBytes calls underlying transport's RemainingBytes. -// -// Even in framed cases, because of all the possible compression transforms -// involved, the remaining frame size is likely to be different from the actual -// remaining readable bytes, so we don't bother to keep tracking the remaining -// frame size by ourselves and just use the underlying transport's -// RemainingBytes directly. -func (t *THeaderTransport) RemainingBytes() uint64 { - return t.transport.RemainingBytes() -} - -// GetReadHeaders returns the THeaderMap read from transport. -func (t *THeaderTransport) GetReadHeaders() THeaderMap { - return t.readHeaders -} - -// SetWriteHeader sets a header for write. -func (t *THeaderTransport) SetWriteHeader(key, value string) { - t.writeHeaders[key] = value -} - -// ClearWriteHeaders clears all write headers previously set. -func (t *THeaderTransport) ClearWriteHeaders() { - t.writeHeaders = make(THeaderMap) -} - -// AddTransform add a transform for writing. -func (t *THeaderTransport) AddTransform(transform THeaderTransformID) error { - if !supportedTransformIDs[transform] { - return NewTProtocolExceptionWithType( - NOT_IMPLEMENTED, - fmt.Errorf("THeaderTransformID %d not supported", transform), - ) - } - t.writeTransforms = append(t.writeTransforms, transform) - return nil -} - -// Protocol returns the wrapped protocol id used in this THeaderTransport. -func (t *THeaderTransport) Protocol() THeaderProtocolID { - switch t.clientType { - default: - return t.protocolID - case clientFramedBinary, clientUnframedBinary: - return THeaderProtocolBinary - case clientFramedCompact, clientUnframedCompact: - return THeaderProtocolCompact - } -} - -func (t *THeaderTransport) isFramed() bool { - switch t.clientType { - default: - return false - case clientHeaders, clientFramedBinary, clientFramedCompact: - return true - } -} - -// SetTConfiguration implements TConfigurationSetter. -func (t *THeaderTransport) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(t.transport, cfg) - t.cfg = cfg -} - -// THeaderTransportFactory is a TTransportFactory implementation to create -// THeaderTransport. -// -// It also implements TConfigurationSetter. -type THeaderTransportFactory struct { - // The underlying factory, could be nil. - Factory TTransportFactory - - cfg *TConfiguration -} - -// Deprecated: Use NewTHeaderTransportFactoryConf instead. -func NewTHeaderTransportFactory(factory TTransportFactory) TTransportFactory { - return NewTHeaderTransportFactoryConf(factory, &TConfiguration{ - noPropagation: true, - }) -} - -// NewTHeaderTransportFactoryConf creates a new *THeaderTransportFactory with -// the given *TConfiguration. -func NewTHeaderTransportFactoryConf(factory TTransportFactory, conf *TConfiguration) TTransportFactory { - return &THeaderTransportFactory{ - Factory: factory, - - cfg: conf, - } -} - -// GetTransport implements TTransportFactory. -func (f *THeaderTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - if f.Factory != nil { - t, err := f.Factory.GetTransport(trans) - if err != nil { - return nil, err - } - return NewTHeaderTransportConf(t, f.cfg), nil - } - return NewTHeaderTransportConf(trans, f.cfg), nil -} - -// SetTConfiguration implements TConfigurationSetter. -func (f *THeaderTransportFactory) SetTConfiguration(cfg *TConfiguration) { - PropagateTConfiguration(f.Factory, f.cfg) - f.cfg = cfg -} - -var ( - _ TConfigurationSetter = (*THeaderTransportFactory)(nil) - _ TConfigurationSetter = (*THeaderTransport)(nil) -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go deleted file mode 100644 index 9a2cc98cc76..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_client.go +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bytes" - "context" - "errors" - "io" - "net/http" - "net/url" - "strconv" -) - -// Default to using the shared http client. Library users are -// free to change this global client or specify one through -// THttpClientOptions. -var DefaultHttpClient *http.Client = http.DefaultClient - -type THttpClient struct { - client *http.Client - response *http.Response - url *url.URL - requestBuffer *bytes.Buffer - header http.Header - nsecConnectTimeout int64 - nsecReadTimeout int64 -} - -type THttpClientTransportFactory struct { - options THttpClientOptions - url string -} - -func (p *THttpClientTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - if trans != nil { - t, ok := trans.(*THttpClient) - if ok && t.url != nil { - return NewTHttpClientWithOptions(t.url.String(), p.options) - } - } - return NewTHttpClientWithOptions(p.url, p.options) -} - -type THttpClientOptions struct { - // If nil, DefaultHttpClient is used - Client *http.Client -} - -func NewTHttpClientTransportFactory(url string) *THttpClientTransportFactory { - return NewTHttpClientTransportFactoryWithOptions(url, THttpClientOptions{}) -} - -func NewTHttpClientTransportFactoryWithOptions(url string, options THttpClientOptions) *THttpClientTransportFactory { - return &THttpClientTransportFactory{url: url, options: options} -} - -func NewTHttpClientWithOptions(urlstr string, options THttpClientOptions) (TTransport, error) { - parsedURL, err := url.Parse(urlstr) - if err != nil { - return nil, err - } - buf := make([]byte, 0, 1024) - client := options.Client - if client == nil { - client = DefaultHttpClient - } - httpHeader := map[string][]string{"Content-Type": {"application/x-thrift"}} - return &THttpClient{client: client, url: parsedURL, requestBuffer: bytes.NewBuffer(buf), header: httpHeader}, nil -} - -func NewTHttpClient(urlstr string) (TTransport, error) { - return NewTHttpClientWithOptions(urlstr, THttpClientOptions{}) -} - -// Set the HTTP Header for this specific Thrift Transport -// It is important that you first assert the TTransport as a THttpClient type -// like so: -// -// httpTrans := trans.(THttpClient) -// httpTrans.SetHeader("User-Agent","Thrift Client 1.0") -func (p *THttpClient) SetHeader(key string, value string) { - p.header.Add(key, value) -} - -// Get the HTTP Header represented by the supplied Header Key for this specific Thrift Transport -// It is important that you first assert the TTransport as a THttpClient type -// like so: -// -// httpTrans := trans.(THttpClient) -// hdrValue := httpTrans.GetHeader("User-Agent") -func (p *THttpClient) GetHeader(key string) string { - return p.header.Get(key) -} - -// Deletes the HTTP Header given a Header Key for this specific Thrift Transport -// It is important that you first assert the TTransport as a THttpClient type -// like so: -// -// httpTrans := trans.(THttpClient) -// httpTrans.DelHeader("User-Agent") -func (p *THttpClient) DelHeader(key string) { - p.header.Del(key) -} - -func (p *THttpClient) Open() error { - // do nothing - return nil -} - -func (p *THttpClient) IsOpen() bool { - return p.response != nil || p.requestBuffer != nil -} - -func (p *THttpClient) closeResponse() error { - var err error - if p.response != nil && p.response.Body != nil { - // The docs specify that if keepalive is enabled and the response body is not - // read to completion the connection will never be returned to the pool and - // reused. Errors are being ignored here because if the connection is invalid - // and this fails for some reason, the Close() method will do any remaining - // cleanup. - io.Copy(io.Discard, p.response.Body) - - err = p.response.Body.Close() - } - - p.response = nil - return err -} - -func (p *THttpClient) Close() error { - if p.requestBuffer != nil { - p.requestBuffer.Reset() - p.requestBuffer = nil - } - return p.closeResponse() -} - -func (p *THttpClient) Read(buf []byte) (int, error) { - if p.response == nil { - return 0, NewTTransportException(NOT_OPEN, "Response buffer is empty, no request.") - } - n, err := p.response.Body.Read(buf) - if n > 0 && (err == nil || errors.Is(err, io.EOF)) { - return n, nil - } - return n, NewTTransportExceptionFromError(err) -} - -func (p *THttpClient) ReadByte() (c byte, err error) { - if p.response == nil { - return 0, NewTTransportException(NOT_OPEN, "Response buffer is empty, no request.") - } - return readByte(p.response.Body) -} - -func (p *THttpClient) Write(buf []byte) (int, error) { - if p.requestBuffer == nil { - return 0, NewTTransportException(NOT_OPEN, "Request buffer is nil, connection may have been closed.") - } - return p.requestBuffer.Write(buf) -} - -func (p *THttpClient) WriteByte(c byte) error { - if p.requestBuffer == nil { - return NewTTransportException(NOT_OPEN, "Request buffer is nil, connection may have been closed.") - } - return p.requestBuffer.WriteByte(c) -} - -func (p *THttpClient) WriteString(s string) (n int, err error) { - if p.requestBuffer == nil { - return 0, NewTTransportException(NOT_OPEN, "Request buffer is nil, connection may have been closed.") - } - return p.requestBuffer.WriteString(s) -} - -func (p *THttpClient) Flush(ctx context.Context) error { - // Close any previous response body to avoid leaking connections. - p.closeResponse() - - // Give up the ownership of the current request buffer to http request, - // and create a new buffer for the next request. - buf := p.requestBuffer - p.requestBuffer = new(bytes.Buffer) - req, err := http.NewRequest("POST", p.url.String(), buf) - if err != nil { - return NewTTransportExceptionFromError(err) - } - req.Header = p.header - if ctx != nil { - req = req.WithContext(ctx) - } - response, err := p.client.Do(req) - if err != nil { - return NewTTransportExceptionFromError(err) - } - if response.StatusCode != http.StatusOK { - // Close the response to avoid leaking file descriptors. closeResponse does - // more than just call Close(), so temporarily assign it and reuse the logic. - p.response = response - p.closeResponse() - - // TODO(pomack) log bad response - return NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "HTTP Response code: "+strconv.Itoa(response.StatusCode)) - } - p.response = response - return nil -} - -func (p *THttpClient) RemainingBytes() (num_bytes uint64) { - len := p.response.ContentLength - if len >= 0 { - return uint64(len) - } - - const maxSize = ^uint64(0) - return maxSize // the truth is, we just don't know unless framed is used -} - -// Deprecated: Use NewTHttpClientTransportFactory instead. -func NewTHttpPostClientTransportFactory(url string) *THttpClientTransportFactory { - return NewTHttpClientTransportFactoryWithOptions(url, THttpClientOptions{}) -} - -// Deprecated: Use NewTHttpClientTransportFactoryWithOptions instead. -func NewTHttpPostClientTransportFactoryWithOptions(url string, options THttpClientOptions) *THttpClientTransportFactory { - return NewTHttpClientTransportFactoryWithOptions(url, options) -} - -// Deprecated: Use NewTHttpClientWithOptions instead. -func NewTHttpPostClientWithOptions(urlstr string, options THttpClientOptions) (TTransport, error) { - return NewTHttpClientWithOptions(urlstr, options) -} - -// Deprecated: Use NewTHttpClient instead. -func NewTHttpPostClient(urlstr string) (TTransport, error) { - return NewTHttpClientWithOptions(urlstr, THttpClientOptions{}) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_transport.go deleted file mode 100644 index bc6922762ad..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/http_transport.go +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "compress/gzip" - "io" - "net/http" - "strings" - "sync" -) - -// NewThriftHandlerFunc is a function that create a ready to use Apache Thrift Handler function -func NewThriftHandlerFunc(processor TProcessor, - inPfactory, outPfactory TProtocolFactory) func(w http.ResponseWriter, r *http.Request) { - - return gz(func(w http.ResponseWriter, r *http.Request) { - w.Header().Add("Content-Type", "application/x-thrift") - - transport := NewStreamTransport(r.Body, w) - processor.Process(r.Context(), inPfactory.GetProtocol(transport), outPfactory.GetProtocol(transport)) - }) -} - -// gz transparently compresses the HTTP response if the client supports it. -func gz(handler http.HandlerFunc) http.HandlerFunc { - sp := &sync.Pool{ - New: func() interface{} { - return gzip.NewWriter(nil) - }, - } - - return func(w http.ResponseWriter, r *http.Request) { - if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { - handler(w, r) - return - } - w.Header().Set("Content-Encoding", "gzip") - gz := sp.Get().(*gzip.Writer) - gz.Reset(w) - defer func() { - _ = gz.Close() - sp.Put(gz) - }() - gzw := gzipResponseWriter{Writer: gz, ResponseWriter: w} - handler(gzw, r) - } -} - -type gzipResponseWriter struct { - io.Writer - http.ResponseWriter -} - -func (w gzipResponseWriter) Write(b []byte) (int, error) { - return w.Writer.Write(b) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/iostream_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/iostream_transport.go deleted file mode 100644 index 1c477990fea..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/iostream_transport.go +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bufio" - "context" - "io" -) - -// StreamTransport is a Transport made of an io.Reader and/or an io.Writer -type StreamTransport struct { - io.Reader - io.Writer - isReadWriter bool - closed bool -} - -type StreamTransportFactory struct { - Reader io.Reader - Writer io.Writer - isReadWriter bool -} - -func (p *StreamTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - if trans != nil { - t, ok := trans.(*StreamTransport) - if ok { - if t.isReadWriter { - return NewStreamTransportRW(t.Reader.(io.ReadWriter)), nil - } - if t.Reader != nil && t.Writer != nil { - return NewStreamTransport(t.Reader, t.Writer), nil - } - if t.Reader != nil && t.Writer == nil { - return NewStreamTransportR(t.Reader), nil - } - if t.Reader == nil && t.Writer != nil { - return NewStreamTransportW(t.Writer), nil - } - return &StreamTransport{}, nil - } - } - if p.isReadWriter { - return NewStreamTransportRW(p.Reader.(io.ReadWriter)), nil - } - if p.Reader != nil && p.Writer != nil { - return NewStreamTransport(p.Reader, p.Writer), nil - } - if p.Reader != nil && p.Writer == nil { - return NewStreamTransportR(p.Reader), nil - } - if p.Reader == nil && p.Writer != nil { - return NewStreamTransportW(p.Writer), nil - } - return &StreamTransport{}, nil -} - -func NewStreamTransportFactory(reader io.Reader, writer io.Writer, isReadWriter bool) *StreamTransportFactory { - return &StreamTransportFactory{Reader: reader, Writer: writer, isReadWriter: isReadWriter} -} - -func NewStreamTransport(r io.Reader, w io.Writer) *StreamTransport { - return &StreamTransport{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)} -} - -func NewStreamTransportR(r io.Reader) *StreamTransport { - return &StreamTransport{Reader: bufio.NewReader(r)} -} - -func NewStreamTransportW(w io.Writer) *StreamTransport { - return &StreamTransport{Writer: bufio.NewWriter(w)} -} - -func NewStreamTransportRW(rw io.ReadWriter) *StreamTransport { - bufrw := bufio.NewReadWriter(bufio.NewReader(rw), bufio.NewWriter(rw)) - return &StreamTransport{Reader: bufrw, Writer: bufrw, isReadWriter: true} -} - -func (p *StreamTransport) IsOpen() bool { - return !p.closed -} - -// implicitly opened on creation, can't be reopened once closed -func (p *StreamTransport) Open() error { - if !p.closed { - return NewTTransportException(ALREADY_OPEN, "StreamTransport already open.") - } else { - return NewTTransportException(NOT_OPEN, "cannot reopen StreamTransport.") - } -} - -// Closes both the input and output streams. -func (p *StreamTransport) Close() error { - if p.closed { - return NewTTransportException(NOT_OPEN, "StreamTransport already closed.") - } - p.closed = true - closedReader := false - if p.Reader != nil { - c, ok := p.Reader.(io.Closer) - if ok { - e := c.Close() - closedReader = true - if e != nil { - return e - } - } - p.Reader = nil - } - if p.Writer != nil && (!closedReader || !p.isReadWriter) { - c, ok := p.Writer.(io.Closer) - if ok { - e := c.Close() - if e != nil { - return e - } - } - p.Writer = nil - } - return nil -} - -// Flushes the underlying output stream if not null. -func (p *StreamTransport) Flush(ctx context.Context) error { - if p.Writer == nil { - return NewTTransportException(NOT_OPEN, "Cannot flush null outputStream") - } - f, ok := p.Writer.(Flusher) - if ok { - err := f.Flush() - if err != nil { - return NewTTransportExceptionFromError(err) - } - } - return nil -} - -func (p *StreamTransport) Read(c []byte) (n int, err error) { - n, err = p.Reader.Read(c) - if err != nil { - err = NewTTransportExceptionFromError(err) - } - return -} - -func (p *StreamTransport) ReadByte() (c byte, err error) { - f, ok := p.Reader.(io.ByteReader) - if ok { - c, err = f.ReadByte() - } else { - c, err = readByte(p.Reader) - } - if err != nil { - err = NewTTransportExceptionFromError(err) - } - return -} - -func (p *StreamTransport) Write(c []byte) (n int, err error) { - n, err = p.Writer.Write(c) - if err != nil { - err = NewTTransportExceptionFromError(err) - } - return -} - -func (p *StreamTransport) WriteByte(c byte) (err error) { - f, ok := p.Writer.(io.ByteWriter) - if ok { - err = f.WriteByte(c) - } else { - err = writeByte(p.Writer, c) - } - if err != nil { - err = NewTTransportExceptionFromError(err) - } - return -} - -func (p *StreamTransport) WriteString(s string) (n int, err error) { - f, ok := p.Writer.(stringWriter) - if ok { - n, err = f.WriteString(s) - } else { - n, err = p.Writer.Write([]byte(s)) - } - if err != nil { - err = NewTTransportExceptionFromError(err) - } - return -} - -func (p *StreamTransport) RemainingBytes() (num_bytes uint64) { - const maxSize = ^uint64(0) - return maxSize // the truth is, we just don't know unless framed is used -} - -// SetTConfiguration implements TConfigurationSetter for propagation. -func (p *StreamTransport) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(p.Reader, conf) - PropagateTConfiguration(p.Writer, conf) -} - -var _ TConfigurationSetter = (*StreamTransport)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/json_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/json_protocol.go deleted file mode 100644 index 8e59d16cfda..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/json_protocol.go +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "encoding/base64" - "fmt" -) - -const ( - THRIFT_JSON_PROTOCOL_VERSION = 1 -) - -// for references to _ParseContext see tsimplejson_protocol.go - -// JSON protocol implementation for thrift. -// Utilizes Simple JSON protocol -// -type TJSONProtocol struct { - *TSimpleJSONProtocol -} - -// Constructor -func NewTJSONProtocol(t TTransport) *TJSONProtocol { - v := &TJSONProtocol{TSimpleJSONProtocol: NewTSimpleJSONProtocol(t)} - v.parseContextStack.push(_CONTEXT_IN_TOPLEVEL) - v.dumpContext.push(_CONTEXT_IN_TOPLEVEL) - return v -} - -// Factory -type TJSONProtocolFactory struct{} - -func (p *TJSONProtocolFactory) GetProtocol(trans TTransport) TProtocol { - return NewTJSONProtocol(trans) -} - -func NewTJSONProtocolFactory() *TJSONProtocolFactory { - return &TJSONProtocolFactory{} -} - -func (p *TJSONProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqId int32) error { - p.resetContextStack() // THRIFT-3735 - if e := p.OutputListBegin(); e != nil { - return e - } - if e := p.WriteI32(ctx, THRIFT_JSON_PROTOCOL_VERSION); e != nil { - return e - } - if e := p.WriteString(ctx, name); e != nil { - return e - } - if e := p.WriteByte(ctx, int8(typeId)); e != nil { - return e - } - if e := p.WriteI32(ctx, seqId); e != nil { - return e - } - return nil -} - -func (p *TJSONProtocol) WriteMessageEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TJSONProtocol) WriteStructBegin(ctx context.Context, name string) error { - if e := p.OutputObjectBegin(); e != nil { - return e - } - return nil -} - -func (p *TJSONProtocol) WriteStructEnd(ctx context.Context) error { - return p.OutputObjectEnd() -} - -func (p *TJSONProtocol) WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error { - if e := p.WriteI16(ctx, id); e != nil { - return e - } - if e := p.OutputObjectBegin(); e != nil { - return e - } - s, e1 := p.TypeIdToString(typeId) - if e1 != nil { - return e1 - } - if e := p.WriteString(ctx, s); e != nil { - return e - } - return nil -} - -func (p *TJSONProtocol) WriteFieldEnd(ctx context.Context) error { - return p.OutputObjectEnd() -} - -func (p *TJSONProtocol) WriteFieldStop(ctx context.Context) error { return nil } - -func (p *TJSONProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - if e := p.OutputListBegin(); e != nil { - return e - } - s, e1 := p.TypeIdToString(keyType) - if e1 != nil { - return e1 - } - if e := p.WriteString(ctx, s); e != nil { - return e - } - s, e1 = p.TypeIdToString(valueType) - if e1 != nil { - return e1 - } - if e := p.WriteString(ctx, s); e != nil { - return e - } - if e := p.WriteI64(ctx, int64(size)); e != nil { - return e - } - return p.OutputObjectBegin() -} - -func (p *TJSONProtocol) WriteMapEnd(ctx context.Context) error { - if e := p.OutputObjectEnd(); e != nil { - return e - } - return p.OutputListEnd() -} - -func (p *TJSONProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - return p.OutputElemListBegin(elemType, size) -} - -func (p *TJSONProtocol) WriteListEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TJSONProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - return p.OutputElemListBegin(elemType, size) -} - -func (p *TJSONProtocol) WriteSetEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TJSONProtocol) WriteBool(ctx context.Context, b bool) error { - if b { - return p.WriteI32(ctx, 1) - } - return p.WriteI32(ctx, 0) -} - -func (p *TJSONProtocol) WriteByte(ctx context.Context, b int8) error { - return p.WriteI32(ctx, int32(b)) -} - -func (p *TJSONProtocol) WriteI16(ctx context.Context, v int16) error { - return p.WriteI32(ctx, int32(v)) -} - -func (p *TJSONProtocol) WriteI32(ctx context.Context, v int32) error { - return p.OutputI64(int64(v)) -} - -func (p *TJSONProtocol) WriteI64(ctx context.Context, v int64) error { - return p.OutputI64(int64(v)) -} - -func (p *TJSONProtocol) WriteDouble(ctx context.Context, v float64) error { - return p.OutputF64(v) -} - -func (p *TJSONProtocol) WriteString(ctx context.Context, v string) error { - return p.OutputString(v) -} - -func (p *TJSONProtocol) WriteBinary(ctx context.Context, v []byte) error { - // JSON library only takes in a string, - // not an arbitrary byte array, to ensure bytes are transmitted - // efficiently we must convert this into a valid JSON string - // therefore we use base64 encoding to avoid excessive escaping/quoting - if e := p.OutputPreValue(); e != nil { - return e - } - if _, e := p.write(JSON_QUOTE_BYTES); e != nil { - return NewTProtocolException(e) - } - writer := base64.NewEncoder(base64.StdEncoding, p.writer) - if _, e := writer.Write(v); e != nil { - p.writer.Reset(p.trans) // THRIFT-3735 - return NewTProtocolException(e) - } - if e := writer.Close(); e != nil { - return NewTProtocolException(e) - } - if _, e := p.write(JSON_QUOTE_BYTES); e != nil { - return NewTProtocolException(e) - } - return p.OutputPostValue() -} - -// Reading methods. -func (p *TJSONProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { - p.resetContextStack() // THRIFT-3735 - if isNull, err := p.ParseListBegin(); isNull || err != nil { - return name, typeId, seqId, err - } - version, err := p.ReadI32(ctx) - if err != nil { - return name, typeId, seqId, err - } - if version != THRIFT_JSON_PROTOCOL_VERSION { - e := fmt.Errorf("Unknown Protocol version %d, expected version %d", version, THRIFT_JSON_PROTOCOL_VERSION) - return name, typeId, seqId, NewTProtocolExceptionWithType(INVALID_DATA, e) - - } - if name, err = p.ReadString(ctx); err != nil { - return name, typeId, seqId, err - } - bTypeId, err := p.ReadByte(ctx) - typeId = TMessageType(bTypeId) - if err != nil { - return name, typeId, seqId, err - } - if seqId, err = p.ReadI32(ctx); err != nil { - return name, typeId, seqId, err - } - return name, typeId, seqId, nil -} - -func (p *TJSONProtocol) ReadMessageEnd(ctx context.Context) error { - err := p.ParseListEnd() - return err -} - -func (p *TJSONProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - _, err = p.ParseObjectStart() - return "", err -} - -func (p *TJSONProtocol) ReadStructEnd(ctx context.Context) error { - return p.ParseObjectEnd() -} - -func (p *TJSONProtocol) ReadFieldBegin(ctx context.Context) (string, TType, int16, error) { - b, _ := p.reader.Peek(1) - if len(b) < 1 || b[0] == JSON_RBRACE[0] || b[0] == JSON_RBRACKET[0] { - return "", STOP, -1, nil - } - fieldId, err := p.ReadI16(ctx) - if err != nil { - return "", STOP, fieldId, err - } - if _, err = p.ParseObjectStart(); err != nil { - return "", STOP, fieldId, err - } - sType, err := p.ReadString(ctx) - if err != nil { - return "", STOP, fieldId, err - } - fType, err := p.StringToTypeId(sType) - return "", fType, fieldId, err -} - -func (p *TJSONProtocol) ReadFieldEnd(ctx context.Context) error { - return p.ParseObjectEnd() -} - -func (p *TJSONProtocol) ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, e error) { - if isNull, e := p.ParseListBegin(); isNull || e != nil { - return VOID, VOID, 0, e - } - - // read keyType - sKeyType, e := p.ReadString(ctx) - if e != nil { - return keyType, valueType, size, e - } - keyType, e = p.StringToTypeId(sKeyType) - if e != nil { - return keyType, valueType, size, e - } - - // read valueType - sValueType, e := p.ReadString(ctx) - if e != nil { - return keyType, valueType, size, e - } - valueType, e = p.StringToTypeId(sValueType) - if e != nil { - return keyType, valueType, size, e - } - - // read size - iSize, e := p.ReadI64(ctx) - if e != nil { - return keyType, valueType, size, e - } - size = int(iSize) - - _, e = p.ParseObjectStart() - return keyType, valueType, size, e -} - -func (p *TJSONProtocol) ReadMapEnd(ctx context.Context) error { - e := p.ParseObjectEnd() - if e != nil { - return e - } - return p.ParseListEnd() -} - -func (p *TJSONProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, e error) { - return p.ParseElemListBegin() -} - -func (p *TJSONProtocol) ReadListEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TJSONProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, e error) { - return p.ParseElemListBegin() -} - -func (p *TJSONProtocol) ReadSetEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TJSONProtocol) ReadBool(ctx context.Context) (bool, error) { - value, err := p.ReadI32(ctx) - return (value != 0), err -} - -func (p *TJSONProtocol) ReadByte(ctx context.Context) (int8, error) { - v, err := p.ReadI64(ctx) - return int8(v), err -} - -func (p *TJSONProtocol) ReadI16(ctx context.Context) (int16, error) { - v, err := p.ReadI64(ctx) - return int16(v), err -} - -func (p *TJSONProtocol) ReadI32(ctx context.Context) (int32, error) { - v, err := p.ReadI64(ctx) - return int32(v), err -} - -func (p *TJSONProtocol) ReadI64(ctx context.Context) (int64, error) { - v, _, err := p.ParseI64() - return v, err -} - -func (p *TJSONProtocol) ReadDouble(ctx context.Context) (float64, error) { - v, _, err := p.ParseF64() - return v, err -} - -func (p *TJSONProtocol) ReadString(ctx context.Context) (string, error) { - var v string - if err := p.ParsePreValue(); err != nil { - return v, err - } - f, _ := p.reader.Peek(1) - if len(f) > 0 && f[0] == JSON_QUOTE { - p.reader.ReadByte() - value, err := p.ParseStringBody() - v = value - if err != nil { - return v, err - } - } else if len(f) > 0 && f[0] == JSON_NULL[0] { - b := make([]byte, len(JSON_NULL)) - _, err := p.reader.Read(b) - if err != nil { - return v, NewTProtocolException(err) - } - if string(b) != string(JSON_NULL) { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } else { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return v, p.ParsePostValue() -} - -func (p *TJSONProtocol) ReadBinary(ctx context.Context) ([]byte, error) { - var v []byte - if err := p.ParsePreValue(); err != nil { - return nil, err - } - f, _ := p.reader.Peek(1) - if len(f) > 0 && f[0] == JSON_QUOTE { - p.reader.ReadByte() - value, err := p.ParseBase64EncodedBody() - v = value - if err != nil { - return v, err - } - } else if len(f) > 0 && f[0] == JSON_NULL[0] { - b := make([]byte, len(JSON_NULL)) - _, err := p.reader.Read(b) - if err != nil { - return v, NewTProtocolException(err) - } - if string(b) != string(JSON_NULL) { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } else { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - - return v, p.ParsePostValue() -} - -func (p *TJSONProtocol) Flush(ctx context.Context) (err error) { - err = p.writer.Flush() - if err == nil { - err = p.trans.Flush(ctx) - } - return NewTProtocolException(err) -} - -func (p *TJSONProtocol) Skip(ctx context.Context, fieldType TType) (err error) { - return SkipDefaultDepth(ctx, p, fieldType) -} - -func (p *TJSONProtocol) Transport() TTransport { - return p.trans -} - -func (p *TJSONProtocol) OutputElemListBegin(elemType TType, size int) error { - if e := p.OutputListBegin(); e != nil { - return e - } - s, e1 := p.TypeIdToString(elemType) - if e1 != nil { - return e1 - } - if e := p.OutputString(s); e != nil { - return e - } - if e := p.OutputI64(int64(size)); e != nil { - return e - } - return nil -} - -func (p *TJSONProtocol) ParseElemListBegin() (elemType TType, size int, e error) { - if isNull, e := p.ParseListBegin(); isNull || e != nil { - return VOID, 0, e - } - // We don't really use the ctx in ReadString implementation, - // so this is safe for now. - // We might want to add context to ParseElemListBegin if we start to use - // ctx in ReadString implementation in the future. - sElemType, err := p.ReadString(context.Background()) - if err != nil { - return VOID, size, err - } - elemType, err = p.StringToTypeId(sElemType) - if err != nil { - return elemType, size, err - } - nSize, _, err2 := p.ParseI64() - size = int(nSize) - return elemType, size, err2 -} - -func (p *TJSONProtocol) readElemListBegin() (elemType TType, size int, e error) { - if isNull, e := p.ParseListBegin(); isNull || e != nil { - return VOID, 0, e - } - // We don't really use the ctx in ReadString implementation, - // so this is safe for now. - // We might want to add context to ParseElemListBegin if we start to use - // ctx in ReadString implementation in the future. - sElemType, err := p.ReadString(context.Background()) - if err != nil { - return VOID, size, err - } - elemType, err = p.StringToTypeId(sElemType) - if err != nil { - return elemType, size, err - } - nSize, _, err2 := p.ParseI64() - size = int(nSize) - return elemType, size, err2 -} - -func (p *TJSONProtocol) writeElemListBegin(elemType TType, size int) error { - if e := p.OutputListBegin(); e != nil { - return e - } - s, e1 := p.TypeIdToString(elemType) - if e1 != nil { - return e1 - } - if e := p.OutputString(s); e != nil { - return e - } - if e := p.OutputI64(int64(size)); e != nil { - return e - } - return nil -} - -func (p *TJSONProtocol) TypeIdToString(fieldType TType) (string, error) { - switch byte(fieldType) { - case BOOL: - return "tf", nil - case BYTE: - return "i8", nil - case I16: - return "i16", nil - case I32: - return "i32", nil - case I64: - return "i64", nil - case DOUBLE: - return "dbl", nil - case STRING: - return "str", nil - case STRUCT: - return "rec", nil - case MAP: - return "map", nil - case SET: - return "set", nil - case LIST: - return "lst", nil - } - - e := fmt.Errorf("Unknown fieldType: %d", int(fieldType)) - return "", NewTProtocolExceptionWithType(INVALID_DATA, e) -} - -func (p *TJSONProtocol) StringToTypeId(fieldType string) (TType, error) { - switch fieldType { - case "tf": - return TType(BOOL), nil - case "i8": - return TType(BYTE), nil - case "i16": - return TType(I16), nil - case "i32": - return TType(I32), nil - case "i64": - return TType(I64), nil - case "dbl": - return TType(DOUBLE), nil - case "str": - return TType(STRING), nil - case "rec": - return TType(STRUCT), nil - case "map": - return TType(MAP), nil - case "set": - return TType(SET), nil - case "lst": - return TType(LIST), nil - } - - e := fmt.Errorf("Unknown type identifier: %s", fieldType) - return TType(STOP), NewTProtocolExceptionWithType(INVALID_DATA, e) -} - -var _ TConfigurationSetter = (*TJSONProtocol)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/logger.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/logger.go deleted file mode 100644 index c42aac998b7..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/logger.go +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "log" - "os" - "testing" -) - -// Logger is a simple wrapper of a logging function. -// -// In reality the users might actually use different logging libraries, and they -// are not always compatible with each other. -// -// Logger is meant to be a simple common ground that it's easy to wrap whatever -// logging library they use into. -// -// See https://issues.apache.org/jira/browse/THRIFT-4985 for the design -// discussion behind it. -type Logger func(msg string) - -// NopLogger is a Logger implementation that does nothing. -func NopLogger(msg string) {} - -// StdLogger wraps stdlib log package into a Logger. -// -// If logger passed in is nil, it will fallback to use stderr and default flags. -func StdLogger(logger *log.Logger) Logger { - if logger == nil { - logger = log.New(os.Stderr, "", log.LstdFlags) - } - return func(msg string) { - logger.Print(msg) - } -} - -// TestLogger is a Logger implementation can be used in test codes. -// -// It fails the test when being called. -func TestLogger(tb testing.TB) Logger { - return func(msg string) { - tb.Errorf("logger called with msg: %q", msg) - } -} - -func fallbackLogger(logger Logger) Logger { - if logger == nil { - return StdLogger(nil) - } - return logger -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/memory_buffer.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/memory_buffer.go deleted file mode 100644 index 5936d273037..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/memory_buffer.go +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bytes" - "context" -) - -// Memory buffer-based implementation of the TTransport interface. -type TMemoryBuffer struct { - *bytes.Buffer - size int -} - -type TMemoryBufferTransportFactory struct { - size int -} - -func (p *TMemoryBufferTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - if trans != nil { - t, ok := trans.(*TMemoryBuffer) - if ok && t.size > 0 { - return NewTMemoryBufferLen(t.size), nil - } - } - return NewTMemoryBufferLen(p.size), nil -} - -func NewTMemoryBufferTransportFactory(size int) *TMemoryBufferTransportFactory { - return &TMemoryBufferTransportFactory{size: size} -} - -func NewTMemoryBuffer() *TMemoryBuffer { - return &TMemoryBuffer{Buffer: &bytes.Buffer{}, size: 0} -} - -func NewTMemoryBufferLen(size int) *TMemoryBuffer { - buf := make([]byte, 0, size) - return &TMemoryBuffer{Buffer: bytes.NewBuffer(buf), size: size} -} - -func (p *TMemoryBuffer) IsOpen() bool { - return true -} - -func (p *TMemoryBuffer) Open() error { - return nil -} - -func (p *TMemoryBuffer) Close() error { - p.Buffer.Reset() - return nil -} - -// Flushing a memory buffer is a no-op -func (p *TMemoryBuffer) Flush(ctx context.Context) error { - return nil -} - -func (p *TMemoryBuffer) RemainingBytes() (num_bytes uint64) { - return uint64(p.Buffer.Len()) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/messagetype.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/messagetype.go deleted file mode 100644 index 25ab2e98a25..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/messagetype.go +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -// Message type constants in the Thrift protocol. -type TMessageType int32 - -const ( - INVALID_TMESSAGE_TYPE TMessageType = 0 - CALL TMessageType = 1 - REPLY TMessageType = 2 - EXCEPTION TMessageType = 3 - ONEWAY TMessageType = 4 -) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/middleware.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/middleware.go deleted file mode 100644 index 8a788df02be..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/middleware.go +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import "context" - -// ProcessorMiddleware is a function that can be passed to WrapProcessor to wrap the -// TProcessorFunctions for that TProcessor. -// -// Middlewares are passed in the name of the function as set in the processor -// map of the TProcessor. -type ProcessorMiddleware func(name string, next TProcessorFunction) TProcessorFunction - -// WrapProcessor takes an existing TProcessor and wraps each of its inner -// TProcessorFunctions with the middlewares passed in and returns it. -// -// Middlewares will be called in the order that they are defined: -// -// 1. Middlewares[0] -// 2. Middlewares[1] -// ... -// N. Middlewares[n] -func WrapProcessor(processor TProcessor, middlewares ...ProcessorMiddleware) TProcessor { - for name, processorFunc := range processor.ProcessorMap() { - wrapped := processorFunc - // Add middlewares in reverse so the first in the list is the outermost. - for i := len(middlewares) - 1; i >= 0; i-- { - wrapped = middlewares[i](name, wrapped) - } - processor.AddToProcessorMap(name, wrapped) - } - return processor -} - -// WrappedTProcessorFunction is a convenience struct that implements the -// TProcessorFunction interface that can be used when implementing custom -// Middleware. -type WrappedTProcessorFunction struct { - // Wrapped is called by WrappedTProcessorFunction.Process and should be a - // "wrapped" call to a base TProcessorFunc.Process call. - Wrapped func(ctx context.Context, seqId int32, in, out TProtocol) (bool, TException) -} - -// Process implements the TProcessorFunction interface using p.Wrapped. -func (p WrappedTProcessorFunction) Process(ctx context.Context, seqID int32, in, out TProtocol) (bool, TException) { - return p.Wrapped(ctx, seqID, in, out) -} - -// verify that WrappedTProcessorFunction implements TProcessorFunction -var ( - _ TProcessorFunction = WrappedTProcessorFunction{} - _ TProcessorFunction = (*WrappedTProcessorFunction)(nil) -) - -// ClientMiddleware can be passed to WrapClient in order to wrap TClient calls -// with custom middleware. -type ClientMiddleware func(TClient) TClient - -// WrappedTClient is a convenience struct that implements the TClient interface -// using inner Wrapped function. -// -// This is provided to aid in developing ClientMiddleware. -type WrappedTClient struct { - Wrapped func(ctx context.Context, method string, args, result TStruct) (ResponseMeta, error) -} - -// Call implements the TClient interface by calling and returning c.Wrapped. -func (c WrappedTClient) Call(ctx context.Context, method string, args, result TStruct) (ResponseMeta, error) { - return c.Wrapped(ctx, method, args, result) -} - -// verify that WrappedTClient implements TClient -var ( - _ TClient = WrappedTClient{} - _ TClient = (*WrappedTClient)(nil) -) - -// WrapClient wraps the given TClient in the given middlewares. -// -// Middlewares will be called in the order that they are defined: -// -// 1. Middlewares[0] -// 2. Middlewares[1] -// ... -// N. Middlewares[n] -func WrapClient(client TClient, middlewares ...ClientMiddleware) TClient { - // Add middlewares in reverse so the first in the list is the outermost. - for i := len(middlewares) - 1; i >= 0; i-- { - client = middlewares[i](client) - } - return client -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go deleted file mode 100644 index d542b23a998..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/multiplexed_protocol.go +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "fmt" - "strings" -) - -/* -TMultiplexedProtocol is a protocol-independent concrete decorator -that allows a Thrift client to communicate with a multiplexing Thrift server, -by prepending the service name to the function name during function calls. - -NOTE: THIS IS NOT USED BY SERVERS. On the server, use TMultiplexedProcessor to handle request -from a multiplexing client. - -This example uses a single socket transport to invoke two services: - -socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT) -transport := thrift.NewTFramedTransport(socket) -protocol := thrift.NewTBinaryProtocolTransport(transport) - -mp := thrift.NewTMultiplexedProtocol(protocol, "Calculator") -service := Calculator.NewCalculatorClient(mp) - -mp2 := thrift.NewTMultiplexedProtocol(protocol, "WeatherReport") -service2 := WeatherReport.NewWeatherReportClient(mp2) - -err := transport.Open() -if err != nil { - t.Fatal("Unable to open client socket", err) -} - -fmt.Println(service.Add(2,2)) -fmt.Println(service2.GetTemperature()) -*/ - -type TMultiplexedProtocol struct { - TProtocol - serviceName string -} - -const MULTIPLEXED_SEPARATOR = ":" - -func NewTMultiplexedProtocol(protocol TProtocol, serviceName string) *TMultiplexedProtocol { - return &TMultiplexedProtocol{ - TProtocol: protocol, - serviceName: serviceName, - } -} - -func (t *TMultiplexedProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error { - if typeId == CALL || typeId == ONEWAY { - return t.TProtocol.WriteMessageBegin(ctx, t.serviceName+MULTIPLEXED_SEPARATOR+name, typeId, seqid) - } else { - return t.TProtocol.WriteMessageBegin(ctx, name, typeId, seqid) - } -} - -/* -TMultiplexedProcessor is a TProcessor allowing -a single TServer to provide multiple services. - -To do so, you instantiate the processor and then register additional -processors with it, as shown in the following example: - -var processor = thrift.NewTMultiplexedProcessor() - -firstProcessor := -processor.RegisterProcessor("FirstService", firstProcessor) - -processor.registerProcessor( - "Calculator", - Calculator.NewCalculatorProcessor(&CalculatorHandler{}), -) - -processor.registerProcessor( - "WeatherReport", - WeatherReport.NewWeatherReportProcessor(&WeatherReportHandler{}), -) - -serverTransport, err := thrift.NewTServerSocketTimeout(addr, TIMEOUT) -if err != nil { - t.Fatal("Unable to create server socket", err) -} -server := thrift.NewTSimpleServer2(processor, serverTransport) -server.Serve(); -*/ - -type TMultiplexedProcessor struct { - serviceProcessorMap map[string]TProcessor - DefaultProcessor TProcessor -} - -func NewTMultiplexedProcessor() *TMultiplexedProcessor { - return &TMultiplexedProcessor{ - serviceProcessorMap: make(map[string]TProcessor), - } -} - -// ProcessorMap returns a mapping of "{ProcessorName}{MULTIPLEXED_SEPARATOR}{FunctionName}" -// to TProcessorFunction for any registered processors. If there is also a -// DefaultProcessor, the keys for the methods on that processor will simply be -// "{FunctionName}". If the TMultiplexedProcessor has both a DefaultProcessor and -// other registered processors, then the keys will be a mix of both formats. -// -// The implementation differs with other TProcessors in that the map returned is -// a new map, while most TProcessors just return their internal mapping directly. -// This means that edits to the map returned by this implementation of ProcessorMap -// will not affect the underlying mapping within the TMultiplexedProcessor. -func (t *TMultiplexedProcessor) ProcessorMap() map[string]TProcessorFunction { - processorFuncMap := make(map[string]TProcessorFunction) - for name, processor := range t.serviceProcessorMap { - for method, processorFunc := range processor.ProcessorMap() { - processorFuncName := name + MULTIPLEXED_SEPARATOR + method - processorFuncMap[processorFuncName] = processorFunc - } - } - if t.DefaultProcessor != nil { - for method, processorFunc := range t.DefaultProcessor.ProcessorMap() { - processorFuncMap[method] = processorFunc - } - } - return processorFuncMap -} - -// AddToProcessorMap updates the underlying TProcessor ProccessorMaps depending on -// the format of "name". -// -// If "name" is in the format "{ProcessorName}{MULTIPLEXED_SEPARATOR}{FunctionName}", -// then it sets the given TProcessorFunction on the inner TProcessor with the -// ProcessorName component using the FunctionName component. -// -// If "name" is just in the format "{FunctionName}", that is to say there is no -// MULTIPLEXED_SEPARATOR, and the TMultiplexedProcessor has a DefaultProcessor -// configured, then it will set the given TProcessorFunction on the DefaultProcessor -// using the given name. -// -// If there is not a TProcessor available for the given name, then this function -// does nothing. This can happen when there is no TProcessor registered for -// the given ProcessorName or if all that is given is the FunctionName and there -// is no DefaultProcessor set. -func (t *TMultiplexedProcessor) AddToProcessorMap(name string, processorFunc TProcessorFunction) { - processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR) - if !found { - if t.DefaultProcessor != nil { - t.DefaultProcessor.AddToProcessorMap(processorName, processorFunc) - } - return - } - if processor, ok := t.serviceProcessorMap[processorName]; ok { - processor.AddToProcessorMap(funcName, processorFunc) - } - -} - -// verify that TMultiplexedProcessor implements TProcessor -var _ TProcessor = (*TMultiplexedProcessor)(nil) - -func (t *TMultiplexedProcessor) RegisterDefault(processor TProcessor) { - t.DefaultProcessor = processor -} - -func (t *TMultiplexedProcessor) RegisterProcessor(name string, processor TProcessor) { - if t.serviceProcessorMap == nil { - t.serviceProcessorMap = make(map[string]TProcessor) - } - t.serviceProcessorMap[name] = processor -} - -func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol) (bool, TException) { - name, typeId, seqid, err := in.ReadMessageBegin(ctx) - if err != nil { - return false, NewTProtocolException(err) - } - if typeId != CALL && typeId != ONEWAY { - return false, NewTProtocolException(fmt.Errorf("Unexpected message type %v", typeId)) - } - // extract the service name - processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR) - if !found { - if t.DefaultProcessor != nil { - smb := NewStoredMessageProtocol(in, name, typeId, seqid) - return t.DefaultProcessor.Process(ctx, smb, out) - } - return false, NewTProtocolException(fmt.Errorf( - "Service name not found in message name: %s. Did you forget to use a TMultiplexProtocol in your client?", - name, - )) - } - actualProcessor, ok := t.serviceProcessorMap[processorName] - if !ok { - return false, NewTProtocolException(fmt.Errorf( - "Service name not found: %s. Did you forget to call registerProcessor()?", - processorName, - )) - } - smb := NewStoredMessageProtocol(in, funcName, typeId, seqid) - return actualProcessor.Process(ctx, smb, out) -} - -// Protocol that use stored message for ReadMessageBegin -type storedMessageProtocol struct { - TProtocol - name string - typeId TMessageType - seqid int32 -} - -func NewStoredMessageProtocol(protocol TProtocol, name string, typeId TMessageType, seqid int32) *storedMessageProtocol { - return &storedMessageProtocol{protocol, name, typeId, seqid} -} - -func (s *storedMessageProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqid int32, err error) { - return s.name, s.typeId, s.seqid, nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/numeric.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/numeric.go deleted file mode 100644 index e4512d204c0..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/numeric.go +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "math" - "strconv" -) - -type Numeric interface { - Int64() int64 - Int32() int32 - Int16() int16 - Byte() byte - Int() int - Float64() float64 - Float32() float32 - String() string - isNull() bool -} - -type numeric struct { - iValue int64 - dValue float64 - sValue string - isNil bool -} - -var ( - INFINITY Numeric - NEGATIVE_INFINITY Numeric - NAN Numeric - ZERO Numeric - NUMERIC_NULL Numeric -) - -func NewNumericFromDouble(dValue float64) Numeric { - if math.IsInf(dValue, 1) { - return INFINITY - } - if math.IsInf(dValue, -1) { - return NEGATIVE_INFINITY - } - if math.IsNaN(dValue) { - return NAN - } - iValue := int64(dValue) - sValue := strconv.FormatFloat(dValue, 'g', 10, 64) - isNil := false - return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} -} - -func NewNumericFromI64(iValue int64) Numeric { - dValue := float64(iValue) - sValue := strconv.FormatInt(iValue, 10) - isNil := false - return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} -} - -func NewNumericFromI32(iValue int32) Numeric { - dValue := float64(iValue) - sValue := strconv.FormatInt(int64(iValue), 10) - isNil := false - return &numeric{iValue: int64(iValue), dValue: dValue, sValue: sValue, isNil: isNil} -} - -func NewNumericFromString(sValue string) Numeric { - if sValue == INFINITY.String() { - return INFINITY - } - if sValue == NEGATIVE_INFINITY.String() { - return NEGATIVE_INFINITY - } - if sValue == NAN.String() { - return NAN - } - iValue, _ := strconv.ParseInt(sValue, 10, 64) - dValue, _ := strconv.ParseFloat(sValue, 64) - isNil := len(sValue) == 0 - return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNil} -} - -func NewNumericFromJSONString(sValue string, isNull bool) Numeric { - if isNull { - return NewNullNumeric() - } - if sValue == JSON_INFINITY { - return INFINITY - } - if sValue == JSON_NEGATIVE_INFINITY { - return NEGATIVE_INFINITY - } - if sValue == JSON_NAN { - return NAN - } - iValue, _ := strconv.ParseInt(sValue, 10, 64) - dValue, _ := strconv.ParseFloat(sValue, 64) - return &numeric{iValue: iValue, dValue: dValue, sValue: sValue, isNil: isNull} -} - -func NewNullNumeric() Numeric { - return &numeric{iValue: 0, dValue: 0.0, sValue: "", isNil: true} -} - -func (p *numeric) Int64() int64 { - return p.iValue -} - -func (p *numeric) Int32() int32 { - return int32(p.iValue) -} - -func (p *numeric) Int16() int16 { - return int16(p.iValue) -} - -func (p *numeric) Byte() byte { - return byte(p.iValue) -} - -func (p *numeric) Int() int { - return int(p.iValue) -} - -func (p *numeric) Float64() float64 { - return p.dValue -} - -func (p *numeric) Float32() float32 { - return float32(p.dValue) -} - -func (p *numeric) String() string { - return p.sValue -} - -func (p *numeric) isNull() bool { - return p.isNil -} - -func init() { - INFINITY = &numeric{iValue: 0, dValue: math.Inf(1), sValue: "Infinity", isNil: false} - NEGATIVE_INFINITY = &numeric{iValue: 0, dValue: math.Inf(-1), sValue: "-Infinity", isNil: false} - NAN = &numeric{iValue: 0, dValue: math.NaN(), sValue: "NaN", isNil: false} - ZERO = &numeric{iValue: 0, dValue: 0, sValue: "0", isNil: false} - NUMERIC_NULL = &numeric{iValue: 0, dValue: 0, sValue: "0", isNil: true} -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/pointerize.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/pointerize.go deleted file mode 100644 index fb564ea8193..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/pointerize.go +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -/////////////////////////////////////////////////////////////////////////////// -// This file is home to helpers that convert from various base types to -// respective pointer types. This is necessary because Go does not permit -// references to constants, nor can a pointer type to base type be allocated -// and initialized in a single expression. -// -// E.g., this is not allowed: -// -// var ip *int = &5 -// -// But this *is* allowed: -// -// func IntPtr(i int) *int { return &i } -// var ip *int = IntPtr(5) -// -// Since pointers to base types are commonplace as [optional] fields in -// exported thrift structs, we factor such helpers here. -/////////////////////////////////////////////////////////////////////////////// - -func Float32Ptr(v float32) *float32 { return &v } -func Float64Ptr(v float64) *float64 { return &v } -func IntPtr(v int) *int { return &v } -func Int8Ptr(v int8) *int8 { return &v } -func Int16Ptr(v int16) *int16 { return &v } -func Int32Ptr(v int32) *int32 { return &v } -func Int64Ptr(v int64) *int64 { return &v } -func StringPtr(v string) *string { return &v } -func Uint32Ptr(v uint32) *uint32 { return &v } -func Uint64Ptr(v uint64) *uint64 { return &v } -func BoolPtr(v bool) *bool { return &v } -func ByteSlicePtr(v []byte) *[]byte { return &v } diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/processor_factory.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/processor_factory.go deleted file mode 100644 index 245a3ccfc98..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/processor_factory.go +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import "context" - -// A processor is a generic object which operates upon an input stream and -// writes to some output stream. -type TProcessor interface { - Process(ctx context.Context, in, out TProtocol) (bool, TException) - - // ProcessorMap returns a map of thrift method names to TProcessorFunctions. - ProcessorMap() map[string]TProcessorFunction - - // AddToProcessorMap adds the given TProcessorFunction to the internal - // processor map at the given key. - // - // If one is already set at the given key, it will be replaced with the new - // TProcessorFunction. - AddToProcessorMap(string, TProcessorFunction) -} - -type TProcessorFunction interface { - Process(ctx context.Context, seqId int32, in, out TProtocol) (bool, TException) -} - -// The default processor factory just returns a singleton -// instance. -type TProcessorFactory interface { - GetProcessor(trans TTransport) TProcessor -} - -type tProcessorFactory struct { - processor TProcessor -} - -func NewTProcessorFactory(p TProcessor) TProcessorFactory { - return &tProcessorFactory{processor: p} -} - -func (p *tProcessorFactory) GetProcessor(trans TTransport) TProcessor { - return p.processor -} - -/** - * The default processor factory just returns a singleton - * instance. - */ -type TProcessorFunctionFactory interface { - GetProcessorFunction(trans TTransport) TProcessorFunction -} - -type tProcessorFunctionFactory struct { - processor TProcessorFunction -} - -func NewTProcessorFunctionFactory(p TProcessorFunction) TProcessorFunctionFactory { - return &tProcessorFunctionFactory{processor: p} -} - -func (p *tProcessorFunctionFactory) GetProcessorFunction(trans TTransport) TProcessorFunction { - return p.processor -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol.go deleted file mode 100644 index 0a69bd4162d..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol.go +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "errors" - "fmt" -) - -const ( - VERSION_MASK = 0xffff0000 - VERSION_1 = 0x80010000 -) - -type TProtocol interface { - WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqid int32) error - WriteMessageEnd(ctx context.Context) error - WriteStructBegin(ctx context.Context, name string) error - WriteStructEnd(ctx context.Context) error - WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error - WriteFieldEnd(ctx context.Context) error - WriteFieldStop(ctx context.Context) error - WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error - WriteMapEnd(ctx context.Context) error - WriteListBegin(ctx context.Context, elemType TType, size int) error - WriteListEnd(ctx context.Context) error - WriteSetBegin(ctx context.Context, elemType TType, size int) error - WriteSetEnd(ctx context.Context) error - WriteBool(ctx context.Context, value bool) error - WriteByte(ctx context.Context, value int8) error - WriteI16(ctx context.Context, value int16) error - WriteI32(ctx context.Context, value int32) error - WriteI64(ctx context.Context, value int64) error - WriteDouble(ctx context.Context, value float64) error - WriteString(ctx context.Context, value string) error - WriteBinary(ctx context.Context, value []byte) error - - ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqid int32, err error) - ReadMessageEnd(ctx context.Context) error - ReadStructBegin(ctx context.Context) (name string, err error) - ReadStructEnd(ctx context.Context) error - ReadFieldBegin(ctx context.Context) (name string, typeId TType, id int16, err error) - ReadFieldEnd(ctx context.Context) error - ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, err error) - ReadMapEnd(ctx context.Context) error - ReadListBegin(ctx context.Context) (elemType TType, size int, err error) - ReadListEnd(ctx context.Context) error - ReadSetBegin(ctx context.Context) (elemType TType, size int, err error) - ReadSetEnd(ctx context.Context) error - ReadBool(ctx context.Context) (value bool, err error) - ReadByte(ctx context.Context) (value int8, err error) - ReadI16(ctx context.Context) (value int16, err error) - ReadI32(ctx context.Context) (value int32, err error) - ReadI64(ctx context.Context) (value int64, err error) - ReadDouble(ctx context.Context) (value float64, err error) - ReadString(ctx context.Context) (value string, err error) - ReadBinary(ctx context.Context) (value []byte, err error) - - Skip(ctx context.Context, fieldType TType) (err error) - Flush(ctx context.Context) (err error) - - Transport() TTransport -} - -// The maximum recursive depth the skip() function will traverse -const DEFAULT_RECURSION_DEPTH = 64 - -// Skips over the next data element from the provided input TProtocol object. -func SkipDefaultDepth(ctx context.Context, prot TProtocol, typeId TType) (err error) { - return Skip(ctx, prot, typeId, DEFAULT_RECURSION_DEPTH) -} - -// Skips over the next data element from the provided input TProtocol object. -func Skip(ctx context.Context, self TProtocol, fieldType TType, maxDepth int) (err error) { - - if maxDepth <= 0 { - return NewTProtocolExceptionWithType(DEPTH_LIMIT, errors.New("Depth limit exceeded")) - } - - switch fieldType { - case BOOL: - _, err = self.ReadBool(ctx) - return - case BYTE: - _, err = self.ReadByte(ctx) - return - case I16: - _, err = self.ReadI16(ctx) - return - case I32: - _, err = self.ReadI32(ctx) - return - case I64: - _, err = self.ReadI64(ctx) - return - case DOUBLE: - _, err = self.ReadDouble(ctx) - return - case STRING: - _, err = self.ReadString(ctx) - return - case STRUCT: - if _, err = self.ReadStructBegin(ctx); err != nil { - return err - } - for { - _, typeId, _, _ := self.ReadFieldBegin(ctx) - if typeId == STOP { - break - } - err := Skip(ctx, self, typeId, maxDepth-1) - if err != nil { - return err - } - self.ReadFieldEnd(ctx) - } - return self.ReadStructEnd(ctx) - case MAP: - keyType, valueType, size, err := self.ReadMapBegin(ctx) - if err != nil { - return err - } - for i := 0; i < size; i++ { - err := Skip(ctx, self, keyType, maxDepth-1) - if err != nil { - return err - } - self.Skip(ctx, valueType) - } - return self.ReadMapEnd(ctx) - case SET: - elemType, size, err := self.ReadSetBegin(ctx) - if err != nil { - return err - } - for i := 0; i < size; i++ { - err := Skip(ctx, self, elemType, maxDepth-1) - if err != nil { - return err - } - } - return self.ReadSetEnd(ctx) - case LIST: - elemType, size, err := self.ReadListBegin(ctx) - if err != nil { - return err - } - for i := 0; i < size; i++ { - err := Skip(ctx, self, elemType, maxDepth-1) - if err != nil { - return err - } - } - return self.ReadListEnd(ctx) - default: - return NewTProtocolExceptionWithType(INVALID_DATA, errors.New(fmt.Sprintf("Unknown data type %d", fieldType))) - } - return nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_exception.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_exception.go deleted file mode 100644 index 9dcf4bfd94c..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_exception.go +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "encoding/base64" - "errors" -) - -// Thrift Protocol exception -type TProtocolException interface { - TException - TypeId() int -} - -const ( - UNKNOWN_PROTOCOL_EXCEPTION = 0 - INVALID_DATA = 1 - NEGATIVE_SIZE = 2 - SIZE_LIMIT = 3 - BAD_VERSION = 4 - NOT_IMPLEMENTED = 5 - DEPTH_LIMIT = 6 -) - -type tProtocolException struct { - typeId int - err error - msg string -} - -var _ TProtocolException = (*tProtocolException)(nil) - -func (tProtocolException) TExceptionType() TExceptionType { - return TExceptionTypeProtocol -} - -func (p *tProtocolException) TypeId() int { - return p.typeId -} - -func (p *tProtocolException) String() string { - return p.msg -} - -func (p *tProtocolException) Error() string { - return p.msg -} - -func (p *tProtocolException) Unwrap() error { - return p.err -} - -func NewTProtocolException(err error) TProtocolException { - if err == nil { - return nil - } - - if e, ok := err.(TProtocolException); ok { - return e - } - - if errors.As(err, new(base64.CorruptInputError)) { - return NewTProtocolExceptionWithType(INVALID_DATA, err) - } - - return NewTProtocolExceptionWithType(UNKNOWN_PROTOCOL_EXCEPTION, err) -} - -func NewTProtocolExceptionWithType(errType int, err error) TProtocolException { - if err == nil { - return nil - } - return &tProtocolException{ - typeId: errType, - err: err, - msg: err.Error(), - } -} - -func prependTProtocolException(prepend string, err TProtocolException) TProtocolException { - return &tProtocolException{ - typeId: err.TypeId(), - err: err, - msg: prepend + err.Error(), - } -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_factory.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_factory.go deleted file mode 100644 index c40f796d886..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/protocol_factory.go +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -// Factory interface for constructing protocol instances. -type TProtocolFactory interface { - GetProtocol(trans TTransport) TProtocol -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/response_helper.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/response_helper.go deleted file mode 100644 index d884c6ac6c4..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/response_helper.go +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" -) - -// See https://godoc.org/context#WithValue on why do we need the unexported typedefs. -type responseHelperKey struct{} - -// TResponseHelper defines a object with a set of helper functions that can be -// retrieved from the context object passed into server handler functions. -// -// Use GetResponseHelper to retrieve the injected TResponseHelper implementation -// from the context object. -// -// The zero value of TResponseHelper is valid with all helper functions being -// no-op. -type TResponseHelper struct { - // THeader related functions - *THeaderResponseHelper -} - -// THeaderResponseHelper defines THeader related TResponseHelper functions. -// -// The zero value of *THeaderResponseHelper is valid with all helper functions -// being no-op. -type THeaderResponseHelper struct { - proto *THeaderProtocol -} - -// NewTHeaderResponseHelper creates a new THeaderResponseHelper from the -// underlying TProtocol. -func NewTHeaderResponseHelper(proto TProtocol) *THeaderResponseHelper { - if hp, ok := proto.(*THeaderProtocol); ok { - return &THeaderResponseHelper{ - proto: hp, - } - } - return nil -} - -// SetHeader sets a response header. -// -// It's no-op if the underlying protocol/transport does not support THeader. -func (h *THeaderResponseHelper) SetHeader(key, value string) { - if h != nil && h.proto != nil { - h.proto.SetWriteHeader(key, value) - } -} - -// ClearHeaders clears all the response headers previously set. -// -// It's no-op if the underlying protocol/transport does not support THeader. -func (h *THeaderResponseHelper) ClearHeaders() { - if h != nil && h.proto != nil { - h.proto.ClearWriteHeaders() - } -} - -// GetResponseHelper retrieves the TResponseHelper implementation injected into -// the context object. -// -// If no helper was found in the context object, a nop helper with ok == false -// will be returned. -func GetResponseHelper(ctx context.Context) (helper TResponseHelper, ok bool) { - if v := ctx.Value(responseHelperKey{}); v != nil { - helper, ok = v.(TResponseHelper) - } - return -} - -// SetResponseHelper injects TResponseHelper into the context object. -func SetResponseHelper(ctx context.Context, helper TResponseHelper) context.Context { - return context.WithValue(ctx, responseHelperKey{}, helper) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/rich_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/rich_transport.go deleted file mode 100644 index 83fdf29f5cb..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/rich_transport.go +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "errors" - "io" -) - -type RichTransport struct { - TTransport -} - -// Wraps Transport to provide TRichTransport interface -func NewTRichTransport(trans TTransport) *RichTransport { - return &RichTransport{trans} -} - -func (r *RichTransport) ReadByte() (c byte, err error) { - return readByte(r.TTransport) -} - -func (r *RichTransport) WriteByte(c byte) error { - return writeByte(r.TTransport, c) -} - -func (r *RichTransport) WriteString(s string) (n int, err error) { - return r.Write([]byte(s)) -} - -func (r *RichTransport) RemainingBytes() (num_bytes uint64) { - return r.TTransport.RemainingBytes() -} - -func readByte(r io.Reader) (c byte, err error) { - v := [1]byte{0} - n, err := r.Read(v[0:1]) - if n > 0 && (err == nil || errors.Is(err, io.EOF)) { - return v[0], nil - } - if n > 0 && err != nil { - return v[0], err - } - if err != nil { - return 0, err - } - return v[0], nil -} - -func writeByte(w io.Writer, c byte) error { - v := [1]byte{c} - _, err := w.Write(v[0:1]) - return err -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/serializer.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/serializer.go deleted file mode 100644 index c44979094c6..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/serializer.go +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "sync" -) - -type TSerializer struct { - Transport *TMemoryBuffer - Protocol TProtocol -} - -type TStruct interface { - Write(ctx context.Context, p TProtocol) error - Read(ctx context.Context, p TProtocol) error -} - -func NewTSerializer() *TSerializer { - transport := NewTMemoryBufferLen(1024) - protocol := NewTBinaryProtocolTransport(transport) - - return &TSerializer{ - Transport: transport, - Protocol: protocol, - } -} - -func (t *TSerializer) WriteString(ctx context.Context, msg TStruct) (s string, err error) { - t.Transport.Reset() - - if err = msg.Write(ctx, t.Protocol); err != nil { - return - } - - if err = t.Protocol.Flush(ctx); err != nil { - return - } - if err = t.Transport.Flush(ctx); err != nil { - return - } - - return t.Transport.String(), nil -} - -func (t *TSerializer) Write(ctx context.Context, msg TStruct) (b []byte, err error) { - t.Transport.Reset() - - if err = msg.Write(ctx, t.Protocol); err != nil { - return - } - - if err = t.Protocol.Flush(ctx); err != nil { - return - } - - if err = t.Transport.Flush(ctx); err != nil { - return - } - - b = append(b, t.Transport.Bytes()...) - return -} - -// TSerializerPool is the thread-safe version of TSerializer, it uses resource -// pool of TSerializer under the hood. -// -// It must be initialized with either NewTSerializerPool or -// NewTSerializerPoolSizeFactory. -type TSerializerPool struct { - pool sync.Pool -} - -// NewTSerializerPool creates a new TSerializerPool. -// -// NewTSerializer can be used as the arg here. -func NewTSerializerPool(f func() *TSerializer) *TSerializerPool { - return &TSerializerPool{ - pool: sync.Pool{ - New: func() interface{} { - return f() - }, - }, - } -} - -// NewTSerializerPoolSizeFactory creates a new TSerializerPool with the given -// size and protocol factory. -// -// Note that the size is not the limit. The TMemoryBuffer underneath can grow -// larger than that. It just dictates the initial size. -func NewTSerializerPoolSizeFactory(size int, factory TProtocolFactory) *TSerializerPool { - return &TSerializerPool{ - pool: sync.Pool{ - New: func() interface{} { - transport := NewTMemoryBufferLen(size) - protocol := factory.GetProtocol(transport) - - return &TSerializer{ - Transport: transport, - Protocol: protocol, - } - }, - }, - } -} - -func (t *TSerializerPool) WriteString(ctx context.Context, msg TStruct) (string, error) { - s := t.pool.Get().(*TSerializer) - defer t.pool.Put(s) - return s.WriteString(ctx, msg) -} - -func (t *TSerializerPool) Write(ctx context.Context, msg TStruct) ([]byte, error) { - s := t.pool.Get().(*TSerializer) - defer t.pool.Put(s) - return s.Write(ctx, msg) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server.go deleted file mode 100644 index f813fa3532c..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server.go +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -type TServer interface { - ProcessorFactory() TProcessorFactory - ServerTransport() TServerTransport - InputTransportFactory() TTransportFactory - OutputTransportFactory() TTransportFactory - InputProtocolFactory() TProtocolFactory - OutputProtocolFactory() TProtocolFactory - - // Starts the server - Serve() error - // Stops the server. This is optional on a per-implementation basis. Not - // all servers are required to be cleanly stoppable. - Stop() error -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_socket.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_socket.go deleted file mode 100644 index 7dd24ae3648..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_socket.go +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "net" - "sync" - "time" -) - -type TServerSocket struct { - listener net.Listener - addr net.Addr - clientTimeout time.Duration - - // Protects the interrupted value to make it thread safe. - mu sync.RWMutex - interrupted bool -} - -func NewTServerSocket(listenAddr string) (*TServerSocket, error) { - return NewTServerSocketTimeout(listenAddr, 0) -} - -func NewTServerSocketTimeout(listenAddr string, clientTimeout time.Duration) (*TServerSocket, error) { - addr, err := net.ResolveTCPAddr("tcp", listenAddr) - if err != nil { - return nil, err - } - return &TServerSocket{addr: addr, clientTimeout: clientTimeout}, nil -} - -// Creates a TServerSocket from a net.Addr -func NewTServerSocketFromAddrTimeout(addr net.Addr, clientTimeout time.Duration) *TServerSocket { - return &TServerSocket{addr: addr, clientTimeout: clientTimeout} -} - -func (p *TServerSocket) Listen() error { - p.mu.Lock() - defer p.mu.Unlock() - if p.IsListening() { - return nil - } - l, err := net.Listen(p.addr.Network(), p.addr.String()) - if err != nil { - return err - } - p.listener = l - return nil -} - -func (p *TServerSocket) Accept() (TTransport, error) { - p.mu.RLock() - interrupted := p.interrupted - p.mu.RUnlock() - - if interrupted { - return nil, errTransportInterrupted - } - - p.mu.Lock() - listener := p.listener - p.mu.Unlock() - if listener == nil { - return nil, NewTTransportException(NOT_OPEN, "No underlying server socket") - } - - conn, err := listener.Accept() - if err != nil { - return nil, NewTTransportExceptionFromError(err) - } - return NewTSocketFromConnTimeout(conn, p.clientTimeout), nil -} - -// Checks whether the socket is listening. -func (p *TServerSocket) IsListening() bool { - return p.listener != nil -} - -// Connects the socket, creating a new socket object if necessary. -func (p *TServerSocket) Open() error { - p.mu.Lock() - defer p.mu.Unlock() - if p.IsListening() { - return NewTTransportException(ALREADY_OPEN, "Server socket already open") - } - if l, err := net.Listen(p.addr.Network(), p.addr.String()); err != nil { - return err - } else { - p.listener = l - } - return nil -} - -func (p *TServerSocket) Addr() net.Addr { - if p.listener != nil { - return p.listener.Addr() - } - return p.addr -} - -func (p *TServerSocket) Close() error { - var err error - p.mu.Lock() - if p.IsListening() { - err = p.listener.Close() - p.listener = nil - } - p.mu.Unlock() - return err -} - -func (p *TServerSocket) Interrupt() error { - p.mu.Lock() - p.interrupted = true - p.mu.Unlock() - p.Close() - - return nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_transport.go deleted file mode 100644 index 51c40b64a1d..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/server_transport.go +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -// Server transport. Object which provides client transports. -type TServerTransport interface { - Listen() error - Accept() (TTransport, error) - Close() error - - // Optional method implementation. This signals to the server transport - // that it should break out of any accept() or listen() that it is currently - // blocked on. This method, if implemented, MUST be thread safe, as it may - // be called from a different thread context than the other TServerTransport - // methods. - Interrupt() error -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_json_protocol.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_json_protocol.go deleted file mode 100644 index d1a8154532d..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_json_protocol.go +++ /dev/null @@ -1,1373 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "bufio" - "bytes" - "context" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "io" - "math" - "strconv" -) - -type _ParseContext int - -const ( - _CONTEXT_INVALID _ParseContext = iota - _CONTEXT_IN_TOPLEVEL // 1 - _CONTEXT_IN_LIST_FIRST // 2 - _CONTEXT_IN_LIST // 3 - _CONTEXT_IN_OBJECT_FIRST // 4 - _CONTEXT_IN_OBJECT_NEXT_KEY // 5 - _CONTEXT_IN_OBJECT_NEXT_VALUE // 6 -) - -func (p _ParseContext) String() string { - switch p { - case _CONTEXT_IN_TOPLEVEL: - return "TOPLEVEL" - case _CONTEXT_IN_LIST_FIRST: - return "LIST-FIRST" - case _CONTEXT_IN_LIST: - return "LIST" - case _CONTEXT_IN_OBJECT_FIRST: - return "OBJECT-FIRST" - case _CONTEXT_IN_OBJECT_NEXT_KEY: - return "OBJECT-NEXT-KEY" - case _CONTEXT_IN_OBJECT_NEXT_VALUE: - return "OBJECT-NEXT-VALUE" - } - return "UNKNOWN-PARSE-CONTEXT" -} - -type jsonContextStack []_ParseContext - -func (s *jsonContextStack) push(v _ParseContext) { - *s = append(*s, v) -} - -func (s jsonContextStack) peek() (v _ParseContext, ok bool) { - l := len(s) - if l <= 0 { - return - } - return s[l-1], true -} - -func (s *jsonContextStack) pop() (v _ParseContext, ok bool) { - l := len(*s) - if l <= 0 { - return - } - v = (*s)[l-1] - *s = (*s)[0 : l-1] - return v, true -} - -var errEmptyJSONContextStack = NewTProtocolExceptionWithType(INVALID_DATA, errors.New("Unexpected empty json protocol context stack")) - -// Simple JSON protocol implementation for thrift. -// -// This protocol produces/consumes a simple output format -// suitable for parsing by scripting languages. It should not be -// confused with the full-featured TJSONProtocol. -// -type TSimpleJSONProtocol struct { - trans TTransport - - parseContextStack jsonContextStack - dumpContext jsonContextStack - - writer *bufio.Writer - reader *bufio.Reader -} - -// Constructor -func NewTSimpleJSONProtocol(t TTransport) *TSimpleJSONProtocol { - v := &TSimpleJSONProtocol{trans: t, - writer: bufio.NewWriter(t), - reader: bufio.NewReader(t), - } - v.parseContextStack.push(_CONTEXT_IN_TOPLEVEL) - v.dumpContext.push(_CONTEXT_IN_TOPLEVEL) - return v -} - -// Factory -type TSimpleJSONProtocolFactory struct{} - -func (p *TSimpleJSONProtocolFactory) GetProtocol(trans TTransport) TProtocol { - return NewTSimpleJSONProtocol(trans) -} - -func NewTSimpleJSONProtocolFactory() *TSimpleJSONProtocolFactory { - return &TSimpleJSONProtocolFactory{} -} - -var ( - JSON_COMMA []byte - JSON_COLON []byte - JSON_LBRACE []byte - JSON_RBRACE []byte - JSON_LBRACKET []byte - JSON_RBRACKET []byte - JSON_QUOTE byte - JSON_QUOTE_BYTES []byte - JSON_NULL []byte - JSON_TRUE []byte - JSON_FALSE []byte - JSON_INFINITY string - JSON_NEGATIVE_INFINITY string - JSON_NAN string - JSON_INFINITY_BYTES []byte - JSON_NEGATIVE_INFINITY_BYTES []byte - JSON_NAN_BYTES []byte - json_nonbase_map_elem_bytes []byte -) - -func init() { - JSON_COMMA = []byte{','} - JSON_COLON = []byte{':'} - JSON_LBRACE = []byte{'{'} - JSON_RBRACE = []byte{'}'} - JSON_LBRACKET = []byte{'['} - JSON_RBRACKET = []byte{']'} - JSON_QUOTE = '"' - JSON_QUOTE_BYTES = []byte{'"'} - JSON_NULL = []byte{'n', 'u', 'l', 'l'} - JSON_TRUE = []byte{'t', 'r', 'u', 'e'} - JSON_FALSE = []byte{'f', 'a', 'l', 's', 'e'} - JSON_INFINITY = "Infinity" - JSON_NEGATIVE_INFINITY = "-Infinity" - JSON_NAN = "NaN" - JSON_INFINITY_BYTES = []byte{'I', 'n', 'f', 'i', 'n', 'i', 't', 'y'} - JSON_NEGATIVE_INFINITY_BYTES = []byte{'-', 'I', 'n', 'f', 'i', 'n', 'i', 't', 'y'} - JSON_NAN_BYTES = []byte{'N', 'a', 'N'} - json_nonbase_map_elem_bytes = []byte{']', ',', '['} -} - -func jsonQuote(s string) string { - b, _ := json.Marshal(s) - s1 := string(b) - return s1 -} - -func jsonUnquote(s string) (string, bool) { - s1 := new(string) - err := json.Unmarshal([]byte(s), s1) - return *s1, err == nil -} - -func mismatch(expected, actual string) error { - return fmt.Errorf("Expected '%s' but found '%s' while parsing JSON.", expected, actual) -} - -func (p *TSimpleJSONProtocol) WriteMessageBegin(ctx context.Context, name string, typeId TMessageType, seqId int32) error { - p.resetContextStack() // THRIFT-3735 - if e := p.OutputListBegin(); e != nil { - return e - } - if e := p.WriteString(ctx, name); e != nil { - return e - } - if e := p.WriteByte(ctx, int8(typeId)); e != nil { - return e - } - if e := p.WriteI32(ctx, seqId); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) WriteMessageEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TSimpleJSONProtocol) WriteStructBegin(ctx context.Context, name string) error { - if e := p.OutputObjectBegin(); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) WriteStructEnd(ctx context.Context) error { - return p.OutputObjectEnd() -} - -func (p *TSimpleJSONProtocol) WriteFieldBegin(ctx context.Context, name string, typeId TType, id int16) error { - if e := p.WriteString(ctx, name); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) WriteFieldEnd(ctx context.Context) error { - return nil -} - -func (p *TSimpleJSONProtocol) WriteFieldStop(ctx context.Context) error { return nil } - -func (p *TSimpleJSONProtocol) WriteMapBegin(ctx context.Context, keyType TType, valueType TType, size int) error { - if e := p.OutputListBegin(); e != nil { - return e - } - if e := p.WriteByte(ctx, int8(keyType)); e != nil { - return e - } - if e := p.WriteByte(ctx, int8(valueType)); e != nil { - return e - } - return p.WriteI32(ctx, int32(size)) -} - -func (p *TSimpleJSONProtocol) WriteMapEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TSimpleJSONProtocol) WriteListBegin(ctx context.Context, elemType TType, size int) error { - return p.OutputElemListBegin(elemType, size) -} - -func (p *TSimpleJSONProtocol) WriteListEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TSimpleJSONProtocol) WriteSetBegin(ctx context.Context, elemType TType, size int) error { - return p.OutputElemListBegin(elemType, size) -} - -func (p *TSimpleJSONProtocol) WriteSetEnd(ctx context.Context) error { - return p.OutputListEnd() -} - -func (p *TSimpleJSONProtocol) WriteBool(ctx context.Context, b bool) error { - return p.OutputBool(b) -} - -func (p *TSimpleJSONProtocol) WriteByte(ctx context.Context, b int8) error { - return p.WriteI32(ctx, int32(b)) -} - -func (p *TSimpleJSONProtocol) WriteI16(ctx context.Context, v int16) error { - return p.WriteI32(ctx, int32(v)) -} - -func (p *TSimpleJSONProtocol) WriteI32(ctx context.Context, v int32) error { - return p.OutputI64(int64(v)) -} - -func (p *TSimpleJSONProtocol) WriteI64(ctx context.Context, v int64) error { - return p.OutputI64(int64(v)) -} - -func (p *TSimpleJSONProtocol) WriteDouble(ctx context.Context, v float64) error { - return p.OutputF64(v) -} - -func (p *TSimpleJSONProtocol) WriteString(ctx context.Context, v string) error { - return p.OutputString(v) -} - -func (p *TSimpleJSONProtocol) WriteBinary(ctx context.Context, v []byte) error { - // JSON library only takes in a string, - // not an arbitrary byte array, to ensure bytes are transmitted - // efficiently we must convert this into a valid JSON string - // therefore we use base64 encoding to avoid excessive escaping/quoting - if e := p.OutputPreValue(); e != nil { - return e - } - if _, e := p.write(JSON_QUOTE_BYTES); e != nil { - return NewTProtocolException(e) - } - writer := base64.NewEncoder(base64.StdEncoding, p.writer) - if _, e := writer.Write(v); e != nil { - p.writer.Reset(p.trans) // THRIFT-3735 - return NewTProtocolException(e) - } - if e := writer.Close(); e != nil { - return NewTProtocolException(e) - } - if _, e := p.write(JSON_QUOTE_BYTES); e != nil { - return NewTProtocolException(e) - } - return p.OutputPostValue() -} - -// Reading methods. -func (p *TSimpleJSONProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { - p.resetContextStack() // THRIFT-3735 - if isNull, err := p.ParseListBegin(); isNull || err != nil { - return name, typeId, seqId, err - } - if name, err = p.ReadString(ctx); err != nil { - return name, typeId, seqId, err - } - bTypeId, err := p.ReadByte(ctx) - typeId = TMessageType(bTypeId) - if err != nil { - return name, typeId, seqId, err - } - if seqId, err = p.ReadI32(ctx); err != nil { - return name, typeId, seqId, err - } - return name, typeId, seqId, nil -} - -func (p *TSimpleJSONProtocol) ReadMessageEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TSimpleJSONProtocol) ReadStructBegin(ctx context.Context) (name string, err error) { - _, err = p.ParseObjectStart() - return "", err -} - -func (p *TSimpleJSONProtocol) ReadStructEnd(ctx context.Context) error { - return p.ParseObjectEnd() -} - -func (p *TSimpleJSONProtocol) ReadFieldBegin(ctx context.Context) (string, TType, int16, error) { - if err := p.ParsePreValue(); err != nil { - return "", STOP, 0, err - } - b, _ := p.reader.Peek(1) - if len(b) > 0 { - switch b[0] { - case JSON_RBRACE[0]: - return "", STOP, 0, nil - case JSON_QUOTE: - p.reader.ReadByte() - name, err := p.ParseStringBody() - // simplejson is not meant to be read back into thrift - // - see http://wiki.apache.org/thrift/ThriftUsageJava - // - use JSON instead - if err != nil { - return name, STOP, 0, err - } - return name, STOP, -1, p.ParsePostValue() - } - e := fmt.Errorf("Expected \"}\" or '\"', but found: '%s'", string(b)) - return "", STOP, 0, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return "", STOP, 0, NewTProtocolException(io.EOF) -} - -func (p *TSimpleJSONProtocol) ReadFieldEnd(ctx context.Context) error { - return nil -} - -func (p *TSimpleJSONProtocol) ReadMapBegin(ctx context.Context) (keyType TType, valueType TType, size int, e error) { - if isNull, e := p.ParseListBegin(); isNull || e != nil { - return VOID, VOID, 0, e - } - - // read keyType - bKeyType, e := p.ReadByte(ctx) - keyType = TType(bKeyType) - if e != nil { - return keyType, valueType, size, e - } - - // read valueType - bValueType, e := p.ReadByte(ctx) - valueType = TType(bValueType) - if e != nil { - return keyType, valueType, size, e - } - - // read size - iSize, err := p.ReadI64(ctx) - size = int(iSize) - return keyType, valueType, size, err -} - -func (p *TSimpleJSONProtocol) ReadMapEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TSimpleJSONProtocol) ReadListBegin(ctx context.Context) (elemType TType, size int, e error) { - return p.ParseElemListBegin() -} - -func (p *TSimpleJSONProtocol) ReadListEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TSimpleJSONProtocol) ReadSetBegin(ctx context.Context) (elemType TType, size int, e error) { - return p.ParseElemListBegin() -} - -func (p *TSimpleJSONProtocol) ReadSetEnd(ctx context.Context) error { - return p.ParseListEnd() -} - -func (p *TSimpleJSONProtocol) ReadBool(ctx context.Context) (bool, error) { - var value bool - - if err := p.ParsePreValue(); err != nil { - return value, err - } - f, _ := p.reader.Peek(1) - if len(f) > 0 { - switch f[0] { - case JSON_TRUE[0]: - b := make([]byte, len(JSON_TRUE)) - _, err := p.reader.Read(b) - if err != nil { - return false, NewTProtocolException(err) - } - if string(b) == string(JSON_TRUE) { - value = true - } else { - e := fmt.Errorf("Expected \"true\" but found: %s", string(b)) - return value, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - break - case JSON_FALSE[0]: - b := make([]byte, len(JSON_FALSE)) - _, err := p.reader.Read(b) - if err != nil { - return false, NewTProtocolException(err) - } - if string(b) == string(JSON_FALSE) { - value = false - } else { - e := fmt.Errorf("Expected \"false\" but found: %s", string(b)) - return value, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - break - case JSON_NULL[0]: - b := make([]byte, len(JSON_NULL)) - _, err := p.reader.Read(b) - if err != nil { - return false, NewTProtocolException(err) - } - if string(b) == string(JSON_NULL) { - value = false - } else { - e := fmt.Errorf("Expected \"null\" but found: %s", string(b)) - return value, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - default: - e := fmt.Errorf("Expected \"true\", \"false\", or \"null\" but found: %s", string(f)) - return value, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - return value, p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) ReadByte(ctx context.Context) (int8, error) { - v, err := p.ReadI64(ctx) - return int8(v), err -} - -func (p *TSimpleJSONProtocol) ReadI16(ctx context.Context) (int16, error) { - v, err := p.ReadI64(ctx) - return int16(v), err -} - -func (p *TSimpleJSONProtocol) ReadI32(ctx context.Context) (int32, error) { - v, err := p.ReadI64(ctx) - return int32(v), err -} - -func (p *TSimpleJSONProtocol) ReadI64(ctx context.Context) (int64, error) { - v, _, err := p.ParseI64() - return v, err -} - -func (p *TSimpleJSONProtocol) ReadDouble(ctx context.Context) (float64, error) { - v, _, err := p.ParseF64() - return v, err -} - -func (p *TSimpleJSONProtocol) ReadString(ctx context.Context) (string, error) { - var v string - if err := p.ParsePreValue(); err != nil { - return v, err - } - f, _ := p.reader.Peek(1) - if len(f) > 0 && f[0] == JSON_QUOTE { - p.reader.ReadByte() - value, err := p.ParseStringBody() - v = value - if err != nil { - return v, err - } - } else if len(f) > 0 && f[0] == JSON_NULL[0] { - b := make([]byte, len(JSON_NULL)) - _, err := p.reader.Read(b) - if err != nil { - return v, NewTProtocolException(err) - } - if string(b) != string(JSON_NULL) { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } else { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return v, p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) ReadBinary(ctx context.Context) ([]byte, error) { - var v []byte - if err := p.ParsePreValue(); err != nil { - return nil, err - } - f, _ := p.reader.Peek(1) - if len(f) > 0 && f[0] == JSON_QUOTE { - p.reader.ReadByte() - value, err := p.ParseBase64EncodedBody() - v = value - if err != nil { - return v, err - } - } else if len(f) > 0 && f[0] == JSON_NULL[0] { - b := make([]byte, len(JSON_NULL)) - _, err := p.reader.Read(b) - if err != nil { - return v, NewTProtocolException(err) - } - if string(b) != string(JSON_NULL) { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } else { - e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) - return v, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - - return v, p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) Flush(ctx context.Context) (err error) { - return NewTProtocolException(p.writer.Flush()) -} - -func (p *TSimpleJSONProtocol) Skip(ctx context.Context, fieldType TType) (err error) { - return SkipDefaultDepth(ctx, p, fieldType) -} - -func (p *TSimpleJSONProtocol) Transport() TTransport { - return p.trans -} - -func (p *TSimpleJSONProtocol) OutputPreValue() error { - cxt, ok := p.dumpContext.peek() - if !ok { - return errEmptyJSONContextStack - } - switch cxt { - case _CONTEXT_IN_LIST, _CONTEXT_IN_OBJECT_NEXT_KEY: - if _, e := p.write(JSON_COMMA); e != nil { - return NewTProtocolException(e) - } - case _CONTEXT_IN_OBJECT_NEXT_VALUE: - if _, e := p.write(JSON_COLON); e != nil { - return NewTProtocolException(e) - } - } - return nil -} - -func (p *TSimpleJSONProtocol) OutputPostValue() error { - cxt, ok := p.dumpContext.peek() - if !ok { - return errEmptyJSONContextStack - } - switch cxt { - case _CONTEXT_IN_LIST_FIRST: - p.dumpContext.pop() - p.dumpContext.push(_CONTEXT_IN_LIST) - case _CONTEXT_IN_OBJECT_FIRST: - p.dumpContext.pop() - p.dumpContext.push(_CONTEXT_IN_OBJECT_NEXT_VALUE) - case _CONTEXT_IN_OBJECT_NEXT_KEY: - p.dumpContext.pop() - p.dumpContext.push(_CONTEXT_IN_OBJECT_NEXT_VALUE) - case _CONTEXT_IN_OBJECT_NEXT_VALUE: - p.dumpContext.pop() - p.dumpContext.push(_CONTEXT_IN_OBJECT_NEXT_KEY) - } - return nil -} - -func (p *TSimpleJSONProtocol) OutputBool(value bool) error { - if e := p.OutputPreValue(); e != nil { - return e - } - var v string - if value { - v = string(JSON_TRUE) - } else { - v = string(JSON_FALSE) - } - cxt, ok := p.dumpContext.peek() - if !ok { - return errEmptyJSONContextStack - } - switch cxt { - case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: - v = jsonQuote(v) - } - if e := p.OutputStringData(v); e != nil { - return e - } - return p.OutputPostValue() -} - -func (p *TSimpleJSONProtocol) OutputNull() error { - if e := p.OutputPreValue(); e != nil { - return e - } - if _, e := p.write(JSON_NULL); e != nil { - return NewTProtocolException(e) - } - return p.OutputPostValue() -} - -func (p *TSimpleJSONProtocol) OutputF64(value float64) error { - if e := p.OutputPreValue(); e != nil { - return e - } - var v string - if math.IsNaN(value) { - v = string(JSON_QUOTE) + JSON_NAN + string(JSON_QUOTE) - } else if math.IsInf(value, 1) { - v = string(JSON_QUOTE) + JSON_INFINITY + string(JSON_QUOTE) - } else if math.IsInf(value, -1) { - v = string(JSON_QUOTE) + JSON_NEGATIVE_INFINITY + string(JSON_QUOTE) - } else { - cxt, ok := p.dumpContext.peek() - if !ok { - return errEmptyJSONContextStack - } - v = strconv.FormatFloat(value, 'g', -1, 64) - switch cxt { - case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: - v = string(JSON_QUOTE) + v + string(JSON_QUOTE) - } - } - if e := p.OutputStringData(v); e != nil { - return e - } - return p.OutputPostValue() -} - -func (p *TSimpleJSONProtocol) OutputI64(value int64) error { - if e := p.OutputPreValue(); e != nil { - return e - } - cxt, ok := p.dumpContext.peek() - if !ok { - return errEmptyJSONContextStack - } - v := strconv.FormatInt(value, 10) - switch cxt { - case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: - v = jsonQuote(v) - } - if e := p.OutputStringData(v); e != nil { - return e - } - return p.OutputPostValue() -} - -func (p *TSimpleJSONProtocol) OutputString(s string) error { - if e := p.OutputPreValue(); e != nil { - return e - } - if e := p.OutputStringData(jsonQuote(s)); e != nil { - return e - } - return p.OutputPostValue() -} - -func (p *TSimpleJSONProtocol) OutputStringData(s string) error { - _, e := p.write([]byte(s)) - return NewTProtocolException(e) -} - -func (p *TSimpleJSONProtocol) OutputObjectBegin() error { - if e := p.OutputPreValue(); e != nil { - return e - } - if _, e := p.write(JSON_LBRACE); e != nil { - return NewTProtocolException(e) - } - p.dumpContext.push(_CONTEXT_IN_OBJECT_FIRST) - return nil -} - -func (p *TSimpleJSONProtocol) OutputObjectEnd() error { - if _, e := p.write(JSON_RBRACE); e != nil { - return NewTProtocolException(e) - } - _, ok := p.dumpContext.pop() - if !ok { - return errEmptyJSONContextStack - } - if e := p.OutputPostValue(); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) OutputListBegin() error { - if e := p.OutputPreValue(); e != nil { - return e - } - if _, e := p.write(JSON_LBRACKET); e != nil { - return NewTProtocolException(e) - } - p.dumpContext.push(_CONTEXT_IN_LIST_FIRST) - return nil -} - -func (p *TSimpleJSONProtocol) OutputListEnd() error { - if _, e := p.write(JSON_RBRACKET); e != nil { - return NewTProtocolException(e) - } - _, ok := p.dumpContext.pop() - if !ok { - return errEmptyJSONContextStack - } - if e := p.OutputPostValue(); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) OutputElemListBegin(elemType TType, size int) error { - if e := p.OutputListBegin(); e != nil { - return e - } - if e := p.OutputI64(int64(elemType)); e != nil { - return e - } - if e := p.OutputI64(int64(size)); e != nil { - return e - } - return nil -} - -func (p *TSimpleJSONProtocol) ParsePreValue() error { - if e := p.readNonSignificantWhitespace(); e != nil { - return NewTProtocolException(e) - } - cxt, ok := p.parseContextStack.peek() - if !ok { - return errEmptyJSONContextStack - } - b, _ := p.reader.Peek(1) - switch cxt { - case _CONTEXT_IN_LIST: - if len(b) > 0 { - switch b[0] { - case JSON_RBRACKET[0]: - return nil - case JSON_COMMA[0]: - p.reader.ReadByte() - if e := p.readNonSignificantWhitespace(); e != nil { - return NewTProtocolException(e) - } - return nil - default: - e := fmt.Errorf("Expected \"]\" or \",\" in list context, but found \"%s\"", string(b)) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - case _CONTEXT_IN_OBJECT_NEXT_KEY: - if len(b) > 0 { - switch b[0] { - case JSON_RBRACE[0]: - return nil - case JSON_COMMA[0]: - p.reader.ReadByte() - if e := p.readNonSignificantWhitespace(); e != nil { - return NewTProtocolException(e) - } - return nil - default: - e := fmt.Errorf("Expected \"}\" or \",\" in object context, but found \"%s\"", string(b)) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - case _CONTEXT_IN_OBJECT_NEXT_VALUE: - if len(b) > 0 { - switch b[0] { - case JSON_COLON[0]: - p.reader.ReadByte() - if e := p.readNonSignificantWhitespace(); e != nil { - return NewTProtocolException(e) - } - return nil - default: - e := fmt.Errorf("Expected \":\" in object context, but found \"%s\"", string(b)) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - } - return nil -} - -func (p *TSimpleJSONProtocol) ParsePostValue() error { - if e := p.readNonSignificantWhitespace(); e != nil { - return NewTProtocolException(e) - } - cxt, ok := p.parseContextStack.peek() - if !ok { - return errEmptyJSONContextStack - } - switch cxt { - case _CONTEXT_IN_LIST_FIRST: - p.parseContextStack.pop() - p.parseContextStack.push(_CONTEXT_IN_LIST) - case _CONTEXT_IN_OBJECT_FIRST, _CONTEXT_IN_OBJECT_NEXT_KEY: - p.parseContextStack.pop() - p.parseContextStack.push(_CONTEXT_IN_OBJECT_NEXT_VALUE) - case _CONTEXT_IN_OBJECT_NEXT_VALUE: - p.parseContextStack.pop() - p.parseContextStack.push(_CONTEXT_IN_OBJECT_NEXT_KEY) - } - return nil -} - -func (p *TSimpleJSONProtocol) readNonSignificantWhitespace() error { - for { - b, _ := p.reader.Peek(1) - if len(b) < 1 { - return nil - } - switch b[0] { - case ' ', '\r', '\n', '\t': - p.reader.ReadByte() - continue - default: - break - } - break - } - return nil -} - -func (p *TSimpleJSONProtocol) ParseStringBody() (string, error) { - line, err := p.reader.ReadString(JSON_QUOTE) - if err != nil { - return "", NewTProtocolException(err) - } - l := len(line) - // count number of escapes to see if we need to keep going - i := 1 - for ; i < l; i++ { - if line[l-i-1] != '\\' { - break - } - } - if i&0x01 == 1 { - v, ok := jsonUnquote(string(JSON_QUOTE) + line) - if !ok { - return "", NewTProtocolException(err) - } - return v, nil - } - s, err := p.ParseQuotedStringBody() - if err != nil { - return "", NewTProtocolException(err) - } - str := string(JSON_QUOTE) + line + s - v, ok := jsonUnquote(str) - if !ok { - e := fmt.Errorf("Unable to parse as JSON string %s", str) - return "", NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return v, nil -} - -func (p *TSimpleJSONProtocol) ParseQuotedStringBody() (string, error) { - line, err := p.reader.ReadString(JSON_QUOTE) - if err != nil { - return "", NewTProtocolException(err) - } - l := len(line) - // count number of escapes to see if we need to keep going - i := 1 - for ; i < l; i++ { - if line[l-i-1] != '\\' { - break - } - } - if i&0x01 == 1 { - return line, nil - } - s, err := p.ParseQuotedStringBody() - if err != nil { - return "", NewTProtocolException(err) - } - v := line + s - return v, nil -} - -func (p *TSimpleJSONProtocol) ParseBase64EncodedBody() ([]byte, error) { - line, err := p.reader.ReadBytes(JSON_QUOTE) - if err != nil { - return line, NewTProtocolException(err) - } - line2 := line[0 : len(line)-1] - l := len(line2) - if (l % 4) != 0 { - pad := 4 - (l % 4) - fill := [...]byte{'=', '=', '='} - line2 = append(line2, fill[:pad]...) - l = len(line2) - } - output := make([]byte, base64.StdEncoding.DecodedLen(l)) - n, err := base64.StdEncoding.Decode(output, line2) - return output[0:n], NewTProtocolException(err) -} - -func (p *TSimpleJSONProtocol) ParseI64() (int64, bool, error) { - if err := p.ParsePreValue(); err != nil { - return 0, false, err - } - var value int64 - var isnull bool - if p.safePeekContains(JSON_NULL) { - p.reader.Read(make([]byte, len(JSON_NULL))) - isnull = true - } else { - num, err := p.readNumeric() - isnull = (num == nil) - if !isnull { - value = num.Int64() - } - if err != nil { - return value, isnull, err - } - } - return value, isnull, p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) ParseF64() (float64, bool, error) { - if err := p.ParsePreValue(); err != nil { - return 0, false, err - } - var value float64 - var isnull bool - if p.safePeekContains(JSON_NULL) { - p.reader.Read(make([]byte, len(JSON_NULL))) - isnull = true - } else { - num, err := p.readNumeric() - isnull = (num == nil) - if !isnull { - value = num.Float64() - } - if err != nil { - return value, isnull, err - } - } - return value, isnull, p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) ParseObjectStart() (bool, error) { - if err := p.ParsePreValue(); err != nil { - return false, err - } - var b []byte - b, err := p.reader.Peek(1) - if err != nil { - return false, err - } - if len(b) > 0 && b[0] == JSON_LBRACE[0] { - p.reader.ReadByte() - p.parseContextStack.push(_CONTEXT_IN_OBJECT_FIRST) - return false, nil - } else if p.safePeekContains(JSON_NULL) { - return true, nil - } - e := fmt.Errorf("Expected '{' or null, but found '%s'", string(b)) - return false, NewTProtocolExceptionWithType(INVALID_DATA, e) -} - -func (p *TSimpleJSONProtocol) ParseObjectEnd() error { - if isNull, err := p.readIfNull(); isNull || err != nil { - return err - } - cxt, _ := p.parseContextStack.peek() - if (cxt != _CONTEXT_IN_OBJECT_FIRST) && (cxt != _CONTEXT_IN_OBJECT_NEXT_KEY) { - e := fmt.Errorf("Expected to be in the Object Context, but not in Object Context (%d)", cxt) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - } - line, err := p.reader.ReadString(JSON_RBRACE[0]) - if err != nil { - return NewTProtocolException(err) - } - for _, char := range line { - switch char { - default: - e := fmt.Errorf("Expecting end of object \"}\", but found: \"%s\"", line) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - case ' ', '\n', '\r', '\t', '}': - break - } - } - p.parseContextStack.pop() - return p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) ParseListBegin() (isNull bool, err error) { - if e := p.ParsePreValue(); e != nil { - return false, e - } - var b []byte - b, err = p.reader.Peek(1) - if err != nil { - return false, err - } - if len(b) >= 1 && b[0] == JSON_LBRACKET[0] { - p.parseContextStack.push(_CONTEXT_IN_LIST_FIRST) - p.reader.ReadByte() - isNull = false - } else if p.safePeekContains(JSON_NULL) { - isNull = true - } else { - err = fmt.Errorf("Expected \"null\" or \"[\", received %q", b) - } - return isNull, NewTProtocolExceptionWithType(INVALID_DATA, err) -} - -func (p *TSimpleJSONProtocol) ParseElemListBegin() (elemType TType, size int, e error) { - if isNull, e := p.ParseListBegin(); isNull || e != nil { - return VOID, 0, e - } - bElemType, _, err := p.ParseI64() - elemType = TType(bElemType) - if err != nil { - return elemType, size, err - } - nSize, _, err2 := p.ParseI64() - size = int(nSize) - return elemType, size, err2 -} - -func (p *TSimpleJSONProtocol) ParseListEnd() error { - if isNull, err := p.readIfNull(); isNull || err != nil { - return err - } - cxt, _ := p.parseContextStack.peek() - if cxt != _CONTEXT_IN_LIST { - e := fmt.Errorf("Expected to be in the List Context, but not in List Context (%d)", cxt) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - } - line, err := p.reader.ReadString(JSON_RBRACKET[0]) - if err != nil { - return NewTProtocolException(err) - } - for _, char := range line { - switch char { - default: - e := fmt.Errorf("Expecting end of list \"]\", but found: \"%v\"", line) - return NewTProtocolExceptionWithType(INVALID_DATA, e) - case ' ', '\n', '\r', '\t', rune(JSON_RBRACKET[0]): - break - } - } - p.parseContextStack.pop() - if cxt, ok := p.parseContextStack.peek(); !ok { - return errEmptyJSONContextStack - } else if cxt == _CONTEXT_IN_TOPLEVEL { - return nil - } - return p.ParsePostValue() -} - -func (p *TSimpleJSONProtocol) readSingleValue() (interface{}, TType, error) { - e := p.readNonSignificantWhitespace() - if e != nil { - return nil, VOID, NewTProtocolException(e) - } - b, e := p.reader.Peek(1) - if len(b) > 0 { - c := b[0] - switch c { - case JSON_NULL[0]: - buf := make([]byte, len(JSON_NULL)) - _, e := p.reader.Read(buf) - if e != nil { - return nil, VOID, NewTProtocolException(e) - } - if string(JSON_NULL) != string(buf) { - e = mismatch(string(JSON_NULL), string(buf)) - return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return nil, VOID, nil - case JSON_QUOTE: - p.reader.ReadByte() - v, e := p.ParseStringBody() - if e != nil { - return v, UTF8, NewTProtocolException(e) - } - if v == JSON_INFINITY { - return INFINITY, DOUBLE, nil - } else if v == JSON_NEGATIVE_INFINITY { - return NEGATIVE_INFINITY, DOUBLE, nil - } else if v == JSON_NAN { - return NAN, DOUBLE, nil - } - return v, UTF8, nil - case JSON_TRUE[0]: - buf := make([]byte, len(JSON_TRUE)) - _, e := p.reader.Read(buf) - if e != nil { - return true, BOOL, NewTProtocolException(e) - } - if string(JSON_TRUE) != string(buf) { - e := mismatch(string(JSON_TRUE), string(buf)) - return true, BOOL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return true, BOOL, nil - case JSON_FALSE[0]: - buf := make([]byte, len(JSON_FALSE)) - _, e := p.reader.Read(buf) - if e != nil { - return false, BOOL, NewTProtocolException(e) - } - if string(JSON_FALSE) != string(buf) { - e := mismatch(string(JSON_FALSE), string(buf)) - return false, BOOL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return false, BOOL, nil - case JSON_LBRACKET[0]: - _, e := p.reader.ReadByte() - return make([]interface{}, 0), LIST, NewTProtocolException(e) - case JSON_LBRACE[0]: - _, e := p.reader.ReadByte() - return make(map[string]interface{}), STRUCT, NewTProtocolException(e) - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e', 'E', '.', '+', '-', JSON_INFINITY[0], JSON_NAN[0]: - // assume numeric - v, e := p.readNumeric() - return v, DOUBLE, e - default: - e := fmt.Errorf("Expected element in list but found '%s' while parsing JSON.", string(c)) - return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - e = fmt.Errorf("Cannot read a single element while parsing JSON.") - return nil, VOID, NewTProtocolExceptionWithType(INVALID_DATA, e) - -} - -func (p *TSimpleJSONProtocol) readIfNull() (bool, error) { - cont := true - for cont { - b, _ := p.reader.Peek(1) - if len(b) < 1 { - return false, nil - } - switch b[0] { - default: - return false, nil - case JSON_NULL[0]: - cont = false - break - case ' ', '\n', '\r', '\t': - p.reader.ReadByte() - break - } - } - if p.safePeekContains(JSON_NULL) { - p.reader.Read(make([]byte, len(JSON_NULL))) - return true, nil - } - return false, nil -} - -func (p *TSimpleJSONProtocol) readQuoteIfNext() { - b, _ := p.reader.Peek(1) - if len(b) > 0 && b[0] == JSON_QUOTE { - p.reader.ReadByte() - } -} - -func (p *TSimpleJSONProtocol) readNumeric() (Numeric, error) { - isNull, err := p.readIfNull() - if isNull || err != nil { - return NUMERIC_NULL, err - } - hasDecimalPoint := false - nextCanBeSign := true - hasE := false - MAX_LEN := 40 - buf := bytes.NewBuffer(make([]byte, 0, MAX_LEN)) - continueFor := true - inQuotes := false - for continueFor { - c, err := p.reader.ReadByte() - if err != nil { - if err == io.EOF { - break - } - return NUMERIC_NULL, NewTProtocolException(err) - } - switch c { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - buf.WriteByte(c) - nextCanBeSign = false - case '.': - if hasDecimalPoint { - e := fmt.Errorf("Unable to parse number with multiple decimal points '%s.'", buf.String()) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - if hasE { - e := fmt.Errorf("Unable to parse number with decimal points in the exponent '%s.'", buf.String()) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - buf.WriteByte(c) - hasDecimalPoint, nextCanBeSign = true, false - case 'e', 'E': - if hasE { - e := fmt.Errorf("Unable to parse number with multiple exponents '%s%c'", buf.String(), c) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - buf.WriteByte(c) - hasE, nextCanBeSign = true, true - case '-', '+': - if !nextCanBeSign { - e := fmt.Errorf("Negative sign within number") - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - buf.WriteByte(c) - nextCanBeSign = false - case ' ', 0, '\t', '\n', '\r', JSON_RBRACE[0], JSON_RBRACKET[0], JSON_COMMA[0], JSON_COLON[0]: - p.reader.UnreadByte() - continueFor = false - case JSON_NAN[0]: - if buf.Len() == 0 { - buffer := make([]byte, len(JSON_NAN)) - buffer[0] = c - _, e := p.reader.Read(buffer[1:]) - if e != nil { - return NUMERIC_NULL, NewTProtocolException(e) - } - if JSON_NAN != string(buffer) { - e := mismatch(JSON_NAN, string(buffer)) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - if inQuotes { - p.readQuoteIfNext() - } - return NAN, nil - } else { - e := fmt.Errorf("Unable to parse number starting with character '%c'", c) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - case JSON_INFINITY[0]: - if buf.Len() == 0 || (buf.Len() == 1 && buf.Bytes()[0] == '+') { - buffer := make([]byte, len(JSON_INFINITY)) - buffer[0] = c - _, e := p.reader.Read(buffer[1:]) - if e != nil { - return NUMERIC_NULL, NewTProtocolException(e) - } - if JSON_INFINITY != string(buffer) { - e := mismatch(JSON_INFINITY, string(buffer)) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - if inQuotes { - p.readQuoteIfNext() - } - return INFINITY, nil - } else if buf.Len() == 1 && buf.Bytes()[0] == JSON_NEGATIVE_INFINITY[0] { - buffer := make([]byte, len(JSON_NEGATIVE_INFINITY)) - buffer[0] = JSON_NEGATIVE_INFINITY[0] - buffer[1] = c - _, e := p.reader.Read(buffer[2:]) - if e != nil { - return NUMERIC_NULL, NewTProtocolException(e) - } - if JSON_NEGATIVE_INFINITY != string(buffer) { - e := mismatch(JSON_NEGATIVE_INFINITY, string(buffer)) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - if inQuotes { - p.readQuoteIfNext() - } - return NEGATIVE_INFINITY, nil - } else { - e := fmt.Errorf("Unable to parse number starting with character '%c' due to existing buffer %s", c, buf.String()) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - case JSON_QUOTE: - if !inQuotes { - inQuotes = true - } else { - break - } - default: - e := fmt.Errorf("Unable to parse number starting with character '%c'", c) - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - } - if buf.Len() == 0 { - e := fmt.Errorf("Unable to parse number from empty string ''") - return NUMERIC_NULL, NewTProtocolExceptionWithType(INVALID_DATA, e) - } - return NewNumericFromJSONString(buf.String(), false), nil -} - -// Safely peeks into the buffer, reading only what is necessary -func (p *TSimpleJSONProtocol) safePeekContains(b []byte) bool { - for i := 0; i < len(b); i++ { - a, _ := p.reader.Peek(i + 1) - if len(a) < (i+1) || a[i] != b[i] { - return false - } - } - return true -} - -// Reset the context stack to its initial state. -func (p *TSimpleJSONProtocol) resetContextStack() { - p.parseContextStack = jsonContextStack{_CONTEXT_IN_TOPLEVEL} - p.dumpContext = jsonContextStack{_CONTEXT_IN_TOPLEVEL} -} - -func (p *TSimpleJSONProtocol) write(b []byte) (int, error) { - n, err := p.writer.Write(b) - if err != nil { - p.writer.Reset(p.trans) // THRIFT-3735 - } - return n, err -} - -// SetTConfiguration implements TConfigurationSetter for propagation. -func (p *TSimpleJSONProtocol) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(p.trans, conf) -} - -var _ TConfigurationSetter = (*TSimpleJSONProtocol)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_server.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_server.go deleted file mode 100644 index 563cbfc694a..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/simple_server.go +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "errors" - "fmt" - "io" - "sync" - "sync/atomic" - "time" -) - -// ErrAbandonRequest is a special error server handler implementations can -// return to indicate that the request has been abandoned. -// -// TSimpleServer will check for this error, and close the client connection -// instead of writing the response/error back to the client. -// -// It shall only be used when the server handler implementation know that the -// client already abandoned the request (by checking that the passed in context -// is already canceled, for example). -var ErrAbandonRequest = errors.New("request abandoned") - -// ServerConnectivityCheckInterval defines the ticker interval used by -// connectivity check in thrift compiled TProcessorFunc implementations. -// -// It's defined as a variable instead of constant, so that thrift server -// implementations can change its value to control the behavior. -// -// If it's changed to <=0, the feature will be disabled. -var ServerConnectivityCheckInterval = time.Millisecond * 5 - -/* - * This is not a typical TSimpleServer as it is not blocked after accept a socket. - * It is more like a TThreadedServer that can handle different connections in different goroutines. - * This will work if golang user implements a conn-pool like thing in client side. - */ -type TSimpleServer struct { - closed int32 - wg sync.WaitGroup - mu sync.Mutex - - processorFactory TProcessorFactory - serverTransport TServerTransport - inputTransportFactory TTransportFactory - outputTransportFactory TTransportFactory - inputProtocolFactory TProtocolFactory - outputProtocolFactory TProtocolFactory - - // Headers to auto forward in THeaderProtocol - forwardHeaders []string - - logger Logger -} - -func NewTSimpleServer2(processor TProcessor, serverTransport TServerTransport) *TSimpleServer { - return NewTSimpleServerFactory2(NewTProcessorFactory(processor), serverTransport) -} - -func NewTSimpleServer4(processor TProcessor, serverTransport TServerTransport, transportFactory TTransportFactory, protocolFactory TProtocolFactory) *TSimpleServer { - return NewTSimpleServerFactory4(NewTProcessorFactory(processor), - serverTransport, - transportFactory, - protocolFactory, - ) -} - -func NewTSimpleServer6(processor TProcessor, serverTransport TServerTransport, inputTransportFactory TTransportFactory, outputTransportFactory TTransportFactory, inputProtocolFactory TProtocolFactory, outputProtocolFactory TProtocolFactory) *TSimpleServer { - return NewTSimpleServerFactory6(NewTProcessorFactory(processor), - serverTransport, - inputTransportFactory, - outputTransportFactory, - inputProtocolFactory, - outputProtocolFactory, - ) -} - -func NewTSimpleServerFactory2(processorFactory TProcessorFactory, serverTransport TServerTransport) *TSimpleServer { - return NewTSimpleServerFactory6(processorFactory, - serverTransport, - NewTTransportFactory(), - NewTTransportFactory(), - NewTBinaryProtocolFactoryDefault(), - NewTBinaryProtocolFactoryDefault(), - ) -} - -func NewTSimpleServerFactory4(processorFactory TProcessorFactory, serverTransport TServerTransport, transportFactory TTransportFactory, protocolFactory TProtocolFactory) *TSimpleServer { - return NewTSimpleServerFactory6(processorFactory, - serverTransport, - transportFactory, - transportFactory, - protocolFactory, - protocolFactory, - ) -} - -func NewTSimpleServerFactory6(processorFactory TProcessorFactory, serverTransport TServerTransport, inputTransportFactory TTransportFactory, outputTransportFactory TTransportFactory, inputProtocolFactory TProtocolFactory, outputProtocolFactory TProtocolFactory) *TSimpleServer { - return &TSimpleServer{ - processorFactory: processorFactory, - serverTransport: serverTransport, - inputTransportFactory: inputTransportFactory, - outputTransportFactory: outputTransportFactory, - inputProtocolFactory: inputProtocolFactory, - outputProtocolFactory: outputProtocolFactory, - } -} - -func (p *TSimpleServer) ProcessorFactory() TProcessorFactory { - return p.processorFactory -} - -func (p *TSimpleServer) ServerTransport() TServerTransport { - return p.serverTransport -} - -func (p *TSimpleServer) InputTransportFactory() TTransportFactory { - return p.inputTransportFactory -} - -func (p *TSimpleServer) OutputTransportFactory() TTransportFactory { - return p.outputTransportFactory -} - -func (p *TSimpleServer) InputProtocolFactory() TProtocolFactory { - return p.inputProtocolFactory -} - -func (p *TSimpleServer) OutputProtocolFactory() TProtocolFactory { - return p.outputProtocolFactory -} - -func (p *TSimpleServer) Listen() error { - return p.serverTransport.Listen() -} - -// SetForwardHeaders sets the list of header keys that will be auto forwarded -// while using THeaderProtocol. -// -// "forward" means that when the server is also a client to other upstream -// thrift servers, the context object user gets in the processor functions will -// have both read and write headers set, with write headers being forwarded. -// Users can always override the write headers by calling SetWriteHeaderList -// before calling thrift client functions. -func (p *TSimpleServer) SetForwardHeaders(headers []string) { - size := len(headers) - if size == 0 { - p.forwardHeaders = nil - return - } - - keys := make([]string, size) - copy(keys, headers) - p.forwardHeaders = keys -} - -// SetLogger sets the logger used by this TSimpleServer. -// -// If no logger was set before Serve is called, a default logger using standard -// log library will be used. -func (p *TSimpleServer) SetLogger(logger Logger) { - p.logger = logger -} - -func (p *TSimpleServer) innerAccept() (int32, error) { - client, err := p.serverTransport.Accept() - p.mu.Lock() - defer p.mu.Unlock() - closed := atomic.LoadInt32(&p.closed) - if closed != 0 { - return closed, nil - } - if err != nil { - return 0, err - } - if client != nil { - p.wg.Add(1) - go func() { - defer p.wg.Done() - if err := p.processRequests(client); err != nil { - p.logger(fmt.Sprintf("error processing request: %v", err)) - } - }() - } - return 0, nil -} - -func (p *TSimpleServer) AcceptLoop() error { - for { - closed, err := p.innerAccept() - if err != nil { - return err - } - if closed != 0 { - return nil - } - } -} - -func (p *TSimpleServer) Serve() error { - p.logger = fallbackLogger(p.logger) - - err := p.Listen() - if err != nil { - return err - } - p.AcceptLoop() - return nil -} - -func (p *TSimpleServer) Stop() error { - p.mu.Lock() - defer p.mu.Unlock() - if atomic.LoadInt32(&p.closed) != 0 { - return nil - } - atomic.StoreInt32(&p.closed, 1) - p.serverTransport.Interrupt() - p.wg.Wait() - return nil -} - -// If err is actually EOF, return nil, otherwise return err as-is. -func treatEOFErrorsAsNil(err error) error { - if err == nil { - return nil - } - if errors.Is(err, io.EOF) { - return nil - } - var te TTransportException - if errors.As(err, &te) && te.TypeId() == END_OF_FILE { - return nil - } - return err -} - -func (p *TSimpleServer) processRequests(client TTransport) (err error) { - defer func() { - err = treatEOFErrorsAsNil(err) - }() - - processor := p.processorFactory.GetProcessor(client) - inputTransport, err := p.inputTransportFactory.GetTransport(client) - if err != nil { - return err - } - inputProtocol := p.inputProtocolFactory.GetProtocol(inputTransport) - var outputTransport TTransport - var outputProtocol TProtocol - - // for THeaderProtocol, we must use the same protocol instance for - // input and output so that the response is in the same dialect that - // the server detected the request was in. - headerProtocol, ok := inputProtocol.(*THeaderProtocol) - if ok { - outputProtocol = inputProtocol - } else { - oTrans, err := p.outputTransportFactory.GetTransport(client) - if err != nil { - return err - } - outputTransport = oTrans - outputProtocol = p.outputProtocolFactory.GetProtocol(outputTransport) - } - - if inputTransport != nil { - defer inputTransport.Close() - } - if outputTransport != nil { - defer outputTransport.Close() - } - for { - if atomic.LoadInt32(&p.closed) != 0 { - return nil - } - - ctx := SetResponseHelper( - defaultCtx, - TResponseHelper{ - THeaderResponseHelper: NewTHeaderResponseHelper(outputProtocol), - }, - ) - if headerProtocol != nil { - // We need to call ReadFrame here, otherwise we won't - // get any headers on the AddReadTHeaderToContext call. - // - // ReadFrame is safe to be called multiple times so it - // won't break when it's called again later when we - // actually start to read the message. - if err := headerProtocol.ReadFrame(ctx); err != nil { - return err - } - ctx = AddReadTHeaderToContext(ctx, headerProtocol.GetReadHeaders()) - ctx = SetWriteHeaderList(ctx, p.forwardHeaders) - } - - ok, err := processor.Process(ctx, inputProtocol, outputProtocol) - if errors.Is(err, ErrAbandonRequest) { - return client.Close() - } - if errors.As(err, new(TTransportException)) && err != nil { - return err - } - var tae TApplicationException - if errors.As(err, &tae) && tae.TypeId() == UNKNOWN_METHOD { - continue - } - if !ok { - break - } - } - return nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket.go deleted file mode 100644 index e911bf16681..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket.go +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "net" - "time" -) - -type TSocket struct { - conn *socketConn - addr net.Addr - cfg *TConfiguration - - connectTimeout time.Duration - socketTimeout time.Duration -} - -// Deprecated: Use NewTSocketConf instead. -func NewTSocket(hostPort string) (*TSocket, error) { - return NewTSocketConf(hostPort, &TConfiguration{ - noPropagation: true, - }) -} - -// NewTSocketConf creates a net.Conn-backed TTransport, given a host and port. -// -// Example: -// -// trans, err := thrift.NewTSocketConf("localhost:9090", &TConfiguration{ -// ConnectTimeout: time.Second, // Use 0 for no timeout -// SocketTimeout: time.Second, // Use 0 for no timeout -// }) -func NewTSocketConf(hostPort string, conf *TConfiguration) (*TSocket, error) { - addr, err := net.ResolveTCPAddr("tcp", hostPort) - if err != nil { - return nil, err - } - return NewTSocketFromAddrConf(addr, conf), nil -} - -// Deprecated: Use NewTSocketConf instead. -func NewTSocketTimeout(hostPort string, connTimeout time.Duration, soTimeout time.Duration) (*TSocket, error) { - return NewTSocketConf(hostPort, &TConfiguration{ - ConnectTimeout: connTimeout, - SocketTimeout: soTimeout, - - noPropagation: true, - }) -} - -// NewTSocketFromAddrConf creates a TSocket from a net.Addr -func NewTSocketFromAddrConf(addr net.Addr, conf *TConfiguration) *TSocket { - return &TSocket{ - addr: addr, - cfg: conf, - } -} - -// Deprecated: Use NewTSocketFromAddrConf instead. -func NewTSocketFromAddrTimeout(addr net.Addr, connTimeout time.Duration, soTimeout time.Duration) *TSocket { - return NewTSocketFromAddrConf(addr, &TConfiguration{ - ConnectTimeout: connTimeout, - SocketTimeout: soTimeout, - - noPropagation: true, - }) -} - -// NewTSocketFromConnConf creates a TSocket from an existing net.Conn. -func NewTSocketFromConnConf(conn net.Conn, conf *TConfiguration) *TSocket { - return &TSocket{ - conn: wrapSocketConn(conn), - addr: conn.RemoteAddr(), - cfg: conf, - } -} - -// Deprecated: Use NewTSocketFromConnConf instead. -func NewTSocketFromConnTimeout(conn net.Conn, socketTimeout time.Duration) *TSocket { - return NewTSocketFromConnConf(conn, &TConfiguration{ - SocketTimeout: socketTimeout, - - noPropagation: true, - }) -} - -// SetTConfiguration implements TConfigurationSetter. -// -// It can be used to set connect and socket timeouts. -func (p *TSocket) SetTConfiguration(conf *TConfiguration) { - p.cfg = conf -} - -// Sets the connect timeout -func (p *TSocket) SetConnTimeout(timeout time.Duration) error { - if p.cfg == nil { - p.cfg = &TConfiguration{ - noPropagation: true, - } - } - p.cfg.ConnectTimeout = timeout - return nil -} - -// Sets the socket timeout -func (p *TSocket) SetSocketTimeout(timeout time.Duration) error { - if p.cfg == nil { - p.cfg = &TConfiguration{ - noPropagation: true, - } - } - p.cfg.SocketTimeout = timeout - return nil -} - -func (p *TSocket) pushDeadline(read, write bool) { - var t time.Time - if timeout := p.cfg.GetSocketTimeout(); timeout > 0 { - t = time.Now().Add(time.Duration(timeout)) - } - if read && write { - p.conn.SetDeadline(t) - } else if read { - p.conn.SetReadDeadline(t) - } else if write { - p.conn.SetWriteDeadline(t) - } -} - -// Connects the socket, creating a new socket object if necessary. -func (p *TSocket) Open() error { - if p.conn.isValid() { - return NewTTransportException(ALREADY_OPEN, "Socket already connected.") - } - if p.addr == nil { - return NewTTransportException(NOT_OPEN, "Cannot open nil address.") - } - if len(p.addr.Network()) == 0 { - return NewTTransportException(NOT_OPEN, "Cannot open bad network name.") - } - if len(p.addr.String()) == 0 { - return NewTTransportException(NOT_OPEN, "Cannot open bad address.") - } - var err error - if p.conn, err = createSocketConnFromReturn(net.DialTimeout( - p.addr.Network(), - p.addr.String(), - p.cfg.GetConnectTimeout(), - )); err != nil { - return NewTTransportException(NOT_OPEN, err.Error()) - } - return nil -} - -// Retrieve the underlying net.Conn -func (p *TSocket) Conn() net.Conn { - return p.conn -} - -// Returns true if the connection is open -func (p *TSocket) IsOpen() bool { - return p.conn.IsOpen() -} - -// Closes the socket. -func (p *TSocket) Close() error { - // Close the socket - if p.conn != nil { - err := p.conn.Close() - if err != nil { - return err - } - p.conn = nil - } - return nil -} - -//Returns the remote address of the socket. -func (p *TSocket) Addr() net.Addr { - return p.addr -} - -func (p *TSocket) Read(buf []byte) (int, error) { - if !p.conn.isValid() { - return 0, NewTTransportException(NOT_OPEN, "Connection not open") - } - p.pushDeadline(true, false) - // NOTE: Calling any of p.IsOpen, p.conn.read0, or p.conn.IsOpen between - // p.pushDeadline and p.conn.Read could cause the deadline set inside - // p.pushDeadline being reset, thus need to be avoided. - n, err := p.conn.Read(buf) - return n, NewTTransportExceptionFromError(err) -} - -func (p *TSocket) Write(buf []byte) (int, error) { - if !p.conn.isValid() { - return 0, NewTTransportException(NOT_OPEN, "Connection not open") - } - p.pushDeadline(false, true) - return p.conn.Write(buf) -} - -func (p *TSocket) Flush(ctx context.Context) error { - return nil -} - -func (p *TSocket) Interrupt() error { - if !p.conn.isValid() { - return nil - } - return p.conn.Close() -} - -func (p *TSocket) RemainingBytes() (num_bytes uint64) { - const maxSize = ^uint64(0) - return maxSize // the truth is, we just don't know unless framed is used -} - -var _ TConfigurationSetter = (*TSocket)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_conn.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_conn.go deleted file mode 100644 index c1cc30c6cc5..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_conn.go +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "net" -) - -// socketConn is a wrapped net.Conn that tries to do connectivity check. -type socketConn struct { - net.Conn - - buffer [1]byte -} - -var _ net.Conn = (*socketConn)(nil) - -// createSocketConnFromReturn is a language sugar to help create socketConn from -// return values of functions like net.Dial, tls.Dial, net.Listener.Accept, etc. -func createSocketConnFromReturn(conn net.Conn, err error) (*socketConn, error) { - if err != nil { - return nil, err - } - return &socketConn{ - Conn: conn, - }, nil -} - -// wrapSocketConn wraps an existing net.Conn into *socketConn. -func wrapSocketConn(conn net.Conn) *socketConn { - // In case conn is already wrapped, - // return it as-is and avoid double wrapping. - if sc, ok := conn.(*socketConn); ok { - return sc - } - - return &socketConn{ - Conn: conn, - } -} - -// isValid checks whether there's a valid connection. -// -// It's nil safe, and returns false if sc itself is nil, or if the underlying -// connection is nil. -// -// It's the same as the previous implementation of TSocket.IsOpen and -// TSSLSocket.IsOpen before we added connectivity check. -func (sc *socketConn) isValid() bool { - return sc != nil && sc.Conn != nil -} - -// IsOpen checks whether the connection is open. -// -// It's nil safe, and returns false if sc itself is nil, or if the underlying -// connection is nil. -// -// Otherwise, it tries to do a connectivity check and returns the result. -// -// It also has the side effect of resetting the previously set read deadline on -// the socket. As a result, it shouldn't be called between setting read deadline -// and doing actual read. -func (sc *socketConn) IsOpen() bool { - if !sc.isValid() { - return false - } - return sc.checkConn() == nil -} - -// Read implements io.Reader. -// -// On Windows, it behaves the same as the underlying net.Conn.Read. -// -// On non-Windows, it treats len(p) == 0 as a connectivity check instead of -// readability check, which means instead of blocking until there's something to -// read (readability check), or always return (0, nil) (the default behavior of -// go's stdlib implementation on non-Windows), it never blocks, and will return -// an error if the connection is lost. -func (sc *socketConn) Read(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, sc.read0() - } - - return sc.Conn.Read(p) -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go deleted file mode 100644 index f5fab3ab653..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_unix_conn.go +++ /dev/null @@ -1,83 +0,0 @@ -// +build !windows - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "errors" - "io" - "syscall" - "time" -) - -// We rely on this variable to be the zero time, -// but define it as global variable to avoid repetitive allocations. -// Please DO NOT mutate this variable in any way. -var zeroTime time.Time - -func (sc *socketConn) read0() error { - return sc.checkConn() -} - -func (sc *socketConn) checkConn() error { - syscallConn, ok := sc.Conn.(syscall.Conn) - if !ok { - // No way to check, return nil - return nil - } - - // The reading about to be done here is non-blocking so we don't really - // need a read deadline. We just need to clear the previously set read - // deadline, if any. - sc.Conn.SetReadDeadline(zeroTime) - - rc, err := syscallConn.SyscallConn() - if err != nil { - return err - } - - var n int - - if readErr := rc.Read(func(fd uintptr) bool { - n, _, err = syscall.Recvfrom(int(fd), sc.buffer[:], syscall.MSG_PEEK|syscall.MSG_DONTWAIT) - return true - }); readErr != nil { - return readErr - } - - if n > 0 { - // We got something, which means we are good - return nil - } - - if errors.Is(err, syscall.EAGAIN) || errors.Is(err, syscall.EWOULDBLOCK) { - // This means the connection is still open but we don't have - // anything to read right now. - return nil - } - - if err != nil { - return err - } - - // At this point, it means the other side already closed the connection. - return io.EOF -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_windows_conn.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_windows_conn.go deleted file mode 100644 index 679838c3b64..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/socket_windows_conn.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build windows - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -func (sc *socketConn) read0() error { - // On windows, we fallback to the default behavior of reading 0 bytes. - var p []byte - _, err := sc.Conn.Read(p) - return err -} - -func (sc *socketConn) checkConn() error { - // On windows, we always return nil for this check. - return nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_server_socket.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_server_socket.go deleted file mode 100644 index 907afca326f..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_server_socket.go +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "crypto/tls" - "net" - "time" -) - -type TSSLServerSocket struct { - listener net.Listener - addr net.Addr - clientTimeout time.Duration - interrupted bool - cfg *tls.Config -} - -func NewTSSLServerSocket(listenAddr string, cfg *tls.Config) (*TSSLServerSocket, error) { - return NewTSSLServerSocketTimeout(listenAddr, cfg, 0) -} - -func NewTSSLServerSocketTimeout(listenAddr string, cfg *tls.Config, clientTimeout time.Duration) (*TSSLServerSocket, error) { - if cfg.MinVersion == 0 { - cfg.MinVersion = tls.VersionTLS10 - } - addr, err := net.ResolveTCPAddr("tcp", listenAddr) - if err != nil { - return nil, err - } - return &TSSLServerSocket{addr: addr, clientTimeout: clientTimeout, cfg: cfg}, nil -} - -func (p *TSSLServerSocket) Listen() error { - if p.IsListening() { - return nil - } - l, err := tls.Listen(p.addr.Network(), p.addr.String(), p.cfg) - if err != nil { - return err - } - p.listener = l - return nil -} - -func (p *TSSLServerSocket) Accept() (TTransport, error) { - if p.interrupted { - return nil, errTransportInterrupted - } - if p.listener == nil { - return nil, NewTTransportException(NOT_OPEN, "No underlying server socket") - } - conn, err := p.listener.Accept() - if err != nil { - return nil, NewTTransportExceptionFromError(err) - } - return NewTSSLSocketFromConnTimeout(conn, p.cfg, p.clientTimeout), nil -} - -// Checks whether the socket is listening. -func (p *TSSLServerSocket) IsListening() bool { - return p.listener != nil -} - -// Connects the socket, creating a new socket object if necessary. -func (p *TSSLServerSocket) Open() error { - if p.IsListening() { - return NewTTransportException(ALREADY_OPEN, "Server socket already open") - } - if l, err := tls.Listen(p.addr.Network(), p.addr.String(), p.cfg); err != nil { - return err - } else { - p.listener = l - } - return nil -} - -func (p *TSSLServerSocket) Addr() net.Addr { - return p.addr -} - -func (p *TSSLServerSocket) Close() error { - defer func() { - p.listener = nil - }() - if p.IsListening() { - return p.listener.Close() - } - return nil -} - -func (p *TSSLServerSocket) Interrupt() error { - p.interrupted = true - return nil -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_socket.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_socket.go deleted file mode 100644 index 6359a74ceb2..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/ssl_socket.go +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "crypto/tls" - "net" - "time" -) - -type TSSLSocket struct { - conn *socketConn - // hostPort contains host:port (e.g. "asdf.com:12345"). The field is - // only valid if addr is nil. - hostPort string - // addr is nil when hostPort is not "", and is only used when the - // TSSLSocket is constructed from a net.Addr. - addr net.Addr - - cfg *TConfiguration -} - -// NewTSSLSocketConf creates a net.Conn-backed TTransport, given a host and port. -// -// Example: -// -// trans, err := thrift.NewTSSLSocketConf("localhost:9090", nil, &TConfiguration{ -// ConnectTimeout: time.Second, // Use 0 for no timeout -// SocketTimeout: time.Second, // Use 0 for no timeout -// }) -func NewTSSLSocketConf(hostPort string, conf *TConfiguration) (*TSSLSocket, error) { - if cfg := conf.GetTLSConfig(); cfg != nil && cfg.MinVersion == 0 { - cfg.MinVersion = tls.VersionTLS10 - } - return &TSSLSocket{ - hostPort: hostPort, - cfg: conf, - }, nil -} - -// Deprecated: Use NewTSSLSocketConf instead. -func NewTSSLSocket(hostPort string, cfg *tls.Config) (*TSSLSocket, error) { - return NewTSSLSocketConf(hostPort, &TConfiguration{ - TLSConfig: cfg, - - noPropagation: true, - }) -} - -// Deprecated: Use NewTSSLSocketConf instead. -func NewTSSLSocketTimeout(hostPort string, cfg *tls.Config, connectTimeout, socketTimeout time.Duration) (*TSSLSocket, error) { - return NewTSSLSocketConf(hostPort, &TConfiguration{ - ConnectTimeout: connectTimeout, - SocketTimeout: socketTimeout, - TLSConfig: cfg, - - noPropagation: true, - }) -} - -// NewTSSLSocketFromAddrConf creates a TSSLSocket from a net.Addr. -func NewTSSLSocketFromAddrConf(addr net.Addr, conf *TConfiguration) *TSSLSocket { - return &TSSLSocket{ - addr: addr, - cfg: conf, - } -} - -// Deprecated: Use NewTSSLSocketFromAddrConf instead. -func NewTSSLSocketFromAddrTimeout(addr net.Addr, cfg *tls.Config, connectTimeout, socketTimeout time.Duration) *TSSLSocket { - return NewTSSLSocketFromAddrConf(addr, &TConfiguration{ - ConnectTimeout: connectTimeout, - SocketTimeout: socketTimeout, - TLSConfig: cfg, - - noPropagation: true, - }) -} - -// NewTSSLSocketFromConnConf creates a TSSLSocket from an existing net.Conn. -func NewTSSLSocketFromConnConf(conn net.Conn, conf *TConfiguration) *TSSLSocket { - return &TSSLSocket{ - conn: wrapSocketConn(conn), - addr: conn.RemoteAddr(), - cfg: conf, - } -} - -// Deprecated: Use NewTSSLSocketFromConnConf instead. -func NewTSSLSocketFromConnTimeout(conn net.Conn, cfg *tls.Config, socketTimeout time.Duration) *TSSLSocket { - return NewTSSLSocketFromConnConf(conn, &TConfiguration{ - SocketTimeout: socketTimeout, - TLSConfig: cfg, - - noPropagation: true, - }) -} - -// SetTConfiguration implements TConfigurationSetter. -// -// It can be used to change connect and socket timeouts. -func (p *TSSLSocket) SetTConfiguration(conf *TConfiguration) { - p.cfg = conf -} - -// Sets the connect timeout -func (p *TSSLSocket) SetConnTimeout(timeout time.Duration) error { - if p.cfg == nil { - p.cfg = &TConfiguration{} - } - p.cfg.ConnectTimeout = timeout - return nil -} - -// Sets the socket timeout -func (p *TSSLSocket) SetSocketTimeout(timeout time.Duration) error { - if p.cfg == nil { - p.cfg = &TConfiguration{} - } - p.cfg.SocketTimeout = timeout - return nil -} - -func (p *TSSLSocket) pushDeadline(read, write bool) { - var t time.Time - if timeout := p.cfg.GetSocketTimeout(); timeout > 0 { - t = time.Now().Add(time.Duration(timeout)) - } - if read && write { - p.conn.SetDeadline(t) - } else if read { - p.conn.SetReadDeadline(t) - } else if write { - p.conn.SetWriteDeadline(t) - } -} - -// Connects the socket, creating a new socket object if necessary. -func (p *TSSLSocket) Open() error { - var err error - // If we have a hostname, we need to pass the hostname to tls.Dial for - // certificate hostname checks. - if p.hostPort != "" { - if p.conn, err = createSocketConnFromReturn(tls.DialWithDialer( - &net.Dialer{ - Timeout: p.cfg.GetConnectTimeout(), - }, - "tcp", - p.hostPort, - p.cfg.GetTLSConfig(), - )); err != nil { - return NewTTransportException(NOT_OPEN, err.Error()) - } - } else { - if p.conn.isValid() { - return NewTTransportException(ALREADY_OPEN, "Socket already connected.") - } - if p.addr == nil { - return NewTTransportException(NOT_OPEN, "Cannot open nil address.") - } - if len(p.addr.Network()) == 0 { - return NewTTransportException(NOT_OPEN, "Cannot open bad network name.") - } - if len(p.addr.String()) == 0 { - return NewTTransportException(NOT_OPEN, "Cannot open bad address.") - } - if p.conn, err = createSocketConnFromReturn(tls.DialWithDialer( - &net.Dialer{ - Timeout: p.cfg.GetConnectTimeout(), - }, - p.addr.Network(), - p.addr.String(), - p.cfg.GetTLSConfig(), - )); err != nil { - return NewTTransportException(NOT_OPEN, err.Error()) - } - } - return nil -} - -// Retrieve the underlying net.Conn -func (p *TSSLSocket) Conn() net.Conn { - return p.conn -} - -// Returns true if the connection is open -func (p *TSSLSocket) IsOpen() bool { - return p.conn.IsOpen() -} - -// Closes the socket. -func (p *TSSLSocket) Close() error { - // Close the socket - if p.conn != nil { - err := p.conn.Close() - if err != nil { - return err - } - p.conn = nil - } - return nil -} - -func (p *TSSLSocket) Read(buf []byte) (int, error) { - if !p.conn.isValid() { - return 0, NewTTransportException(NOT_OPEN, "Connection not open") - } - p.pushDeadline(true, false) - // NOTE: Calling any of p.IsOpen, p.conn.read0, or p.conn.IsOpen between - // p.pushDeadline and p.conn.Read could cause the deadline set inside - // p.pushDeadline being reset, thus need to be avoided. - n, err := p.conn.Read(buf) - return n, NewTTransportExceptionFromError(err) -} - -func (p *TSSLSocket) Write(buf []byte) (int, error) { - if !p.conn.isValid() { - return 0, NewTTransportException(NOT_OPEN, "Connection not open") - } - p.pushDeadline(false, true) - return p.conn.Write(buf) -} - -func (p *TSSLSocket) Flush(ctx context.Context) error { - return nil -} - -func (p *TSSLSocket) Interrupt() error { - if !p.conn.isValid() { - return nil - } - return p.conn.Close() -} - -func (p *TSSLSocket) RemainingBytes() (num_bytes uint64) { - const maxSize = ^uint64(0) - return maxSize // the truth is, we just don't know unless framed is used -} - -var _ TConfigurationSetter = (*TSSLSocket)(nil) diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go deleted file mode 100644 index d68d0b3179c..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport.go +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "context" - "errors" - "io" -) - -var errTransportInterrupted = errors.New("Transport Interrupted") - -type Flusher interface { - Flush() (err error) -} - -type ContextFlusher interface { - Flush(ctx context.Context) (err error) -} - -type ReadSizeProvider interface { - RemainingBytes() (num_bytes uint64) -} - -// Encapsulates the I/O layer -type TTransport interface { - io.ReadWriteCloser - ContextFlusher - ReadSizeProvider - - // Opens the transport for communication - Open() error - - // Returns true if the transport is open - IsOpen() bool -} - -type stringWriter interface { - WriteString(s string) (n int, err error) -} - -// This is "enhanced" transport with extra capabilities. You need to use one of these -// to construct protocol. -// Notably, TSocket does not implement this interface, and it is always a mistake to use -// TSocket directly in protocol. -type TRichTransport interface { - io.ReadWriter - io.ByteReader - io.ByteWriter - stringWriter - ContextFlusher - ReadSizeProvider -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_exception.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_exception.go deleted file mode 100644 index 0a3f07646d3..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_exception.go +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -import ( - "errors" - "io" -) - -type timeoutable interface { - Timeout() bool -} - -// Thrift Transport exception -type TTransportException interface { - TException - TypeId() int - Err() error -} - -const ( - UNKNOWN_TRANSPORT_EXCEPTION = 0 - NOT_OPEN = 1 - ALREADY_OPEN = 2 - TIMED_OUT = 3 - END_OF_FILE = 4 -) - -type tTransportException struct { - typeId int - err error - msg string -} - -var _ TTransportException = (*tTransportException)(nil) - -func (tTransportException) TExceptionType() TExceptionType { - return TExceptionTypeTransport -} - -func (p *tTransportException) TypeId() int { - return p.typeId -} - -func (p *tTransportException) Error() string { - return p.msg -} - -func (p *tTransportException) Err() error { - return p.err -} - -func (p *tTransportException) Unwrap() error { - return p.err -} - -func (p *tTransportException) Timeout() bool { - return p.typeId == TIMED_OUT -} - -func NewTTransportException(t int, e string) TTransportException { - return &tTransportException{ - typeId: t, - err: errors.New(e), - msg: e, - } -} - -func NewTTransportExceptionFromError(e error) TTransportException { - if e == nil { - return nil - } - - if t, ok := e.(TTransportException); ok { - return t - } - - te := &tTransportException{ - typeId: UNKNOWN_TRANSPORT_EXCEPTION, - err: e, - msg: e.Error(), - } - - if isTimeoutError(e) { - te.typeId = TIMED_OUT - return te - } - - if errors.Is(e, io.EOF) { - te.typeId = END_OF_FILE - return te - } - - return te -} - -func prependTTransportException(prepend string, e TTransportException) TTransportException { - return &tTransportException{ - typeId: e.TypeId(), - err: e, - msg: prepend + e.Error(), - } -} - -// isTimeoutError returns true when err is an error caused by timeout. -// -// Note that this also includes TTransportException wrapped timeout errors. -func isTimeoutError(err error) bool { - var t timeoutable - if errors.As(err, &t) { - return t.Timeout() - } - return false -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_factory.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_factory.go deleted file mode 100644 index c805807940a..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/transport_factory.go +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -// Factory class used to create wrapped instance of Transports. -// This is used primarily in servers, which get Transports from -// a ServerTransport and then may want to mutate them (i.e. create -// a BufferedTransport from the underlying base transport) -type TTransportFactory interface { - GetTransport(trans TTransport) (TTransport, error) -} - -type tTransportFactory struct{} - -// Return a wrapped instance of the base Transport. -func (p *tTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - return trans, nil -} - -func NewTTransportFactory() TTransportFactory { - return &tTransportFactory{} -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go deleted file mode 100644 index b24f1b05c45..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/type.go +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package thrift - -// Type constants in the Thrift protocol -type TType byte - -const ( - STOP = 0 - VOID = 1 - BOOL = 2 - BYTE = 3 - I08 = 3 - DOUBLE = 4 - I16 = 6 - I32 = 8 - I64 = 10 - STRING = 11 - UTF7 = 11 - STRUCT = 12 - MAP = 13 - SET = 14 - LIST = 15 - UTF8 = 16 - UTF16 = 17 - //BINARY = 18 wrong and unused -) - -var typeNames = map[int]string{ - STOP: "STOP", - VOID: "VOID", - BOOL: "BOOL", - BYTE: "BYTE", - DOUBLE: "DOUBLE", - I16: "I16", - I32: "I32", - I64: "I64", - STRING: "STRING", - STRUCT: "STRUCT", - MAP: "MAP", - SET: "SET", - LIST: "LIST", - UTF8: "UTF8", - UTF16: "UTF16", -} - -func (p TType) String() string { - if s, ok := typeNames[int(p)]; ok { - return s - } - return "Unknown" -} diff --git a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/zlib_transport.go b/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/zlib_transport.go deleted file mode 100644 index 259943a627c..00000000000 --- a/exporters/jaeger/internal/third_party/thrift/lib/go/thrift/zlib_transport.go +++ /dev/null @@ -1,137 +0,0 @@ -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. - */ - -package thrift - -import ( - "compress/zlib" - "context" - "io" -) - -// TZlibTransportFactory is a factory for TZlibTransport instances -type TZlibTransportFactory struct { - level int - factory TTransportFactory -} - -// TZlibTransport is a TTransport implementation that makes use of zlib compression. -type TZlibTransport struct { - reader io.ReadCloser - transport TTransport - writer *zlib.Writer -} - -// GetTransport constructs a new instance of NewTZlibTransport -func (p *TZlibTransportFactory) GetTransport(trans TTransport) (TTransport, error) { - if p.factory != nil { - // wrap other factory - var err error - trans, err = p.factory.GetTransport(trans) - if err != nil { - return nil, err - } - } - return NewTZlibTransport(trans, p.level) -} - -// NewTZlibTransportFactory constructs a new instance of NewTZlibTransportFactory -func NewTZlibTransportFactory(level int) *TZlibTransportFactory { - return &TZlibTransportFactory{level: level, factory: nil} -} - -// NewTZlibTransportFactory constructs a new instance of TZlibTransportFactory -// as a wrapper over existing transport factory -func NewTZlibTransportFactoryWithFactory(level int, factory TTransportFactory) *TZlibTransportFactory { - return &TZlibTransportFactory{level: level, factory: factory} -} - -// NewTZlibTransport constructs a new instance of TZlibTransport -func NewTZlibTransport(trans TTransport, level int) (*TZlibTransport, error) { - w, err := zlib.NewWriterLevel(trans, level) - if err != nil { - return nil, err - } - - return &TZlibTransport{ - writer: w, - transport: trans, - }, nil -} - -// Close closes the reader and writer (flushing any unwritten data) and closes -// the underlying transport. -func (z *TZlibTransport) Close() error { - if z.reader != nil { - if err := z.reader.Close(); err != nil { - return err - } - } - if err := z.writer.Close(); err != nil { - return err - } - return z.transport.Close() -} - -// Flush flushes the writer and its underlying transport. -func (z *TZlibTransport) Flush(ctx context.Context) error { - if err := z.writer.Flush(); err != nil { - return err - } - return z.transport.Flush(ctx) -} - -// IsOpen returns true if the transport is open -func (z *TZlibTransport) IsOpen() bool { - return z.transport.IsOpen() -} - -// Open opens the transport for communication -func (z *TZlibTransport) Open() error { - return z.transport.Open() -} - -func (z *TZlibTransport) Read(p []byte) (int, error) { - if z.reader == nil { - r, err := zlib.NewReader(z.transport) - if err != nil { - return 0, NewTTransportExceptionFromError(err) - } - z.reader = r - } - - return z.reader.Read(p) -} - -// RemainingBytes returns the size in bytes of the data that is still to be -// read. -func (z *TZlibTransport) RemainingBytes() uint64 { - return z.transport.RemainingBytes() -} - -func (z *TZlibTransport) Write(p []byte) (int, error) { - return z.writer.Write(p) -} - -// SetTConfiguration implements TConfigurationSetter for propagation. -func (z *TZlibTransport) SetTConfiguration(conf *TConfiguration) { - PropagateTConfiguration(z.transport, conf) -} - -var _ TConfigurationSetter = (*TZlibTransport)(nil) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go deleted file mode 100644 index 9b4a54afc66..00000000000 --- a/exporters/jaeger/jaeger.go +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" - -import ( - "context" - "encoding/binary" - "encoding/json" - "fmt" - "sync" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" - "go.opentelemetry.io/otel/trace" -) - -const ( - keyInstrumentationLibraryName = "otel.library.name" - keyInstrumentationLibraryVersion = "otel.library.version" - keyError = "error" - keySpanKind = "span.kind" - keyStatusCode = "otel.status_code" - keyStatusMessage = "otel.status_description" - keyDroppedAttributeCount = "otel.event.dropped_attributes_count" - keyEventName = "event" -) - -// New returns an OTel Exporter implementation that exports the collected -// spans to Jaeger. -func New(endpointOption EndpointOption) (*Exporter, error) { - uploader, err := endpointOption.newBatchUploader() - if err != nil { - return nil, err - } - - // Fetch default service.name from default resource for backup - var defaultServiceName string - defaultResource := resource.Default() - if value, exists := defaultResource.Set().Value(semconv.ServiceNameKey); exists { - defaultServiceName = value.AsString() - } - if defaultServiceName == "" { - return nil, fmt.Errorf("failed to get service name from default resource") - } - - stopCh := make(chan struct{}) - e := &Exporter{ - uploader: uploader, - stopCh: stopCh, - defaultServiceName: defaultServiceName, - } - return e, nil -} - -// Exporter exports OpenTelemetry spans to a Jaeger agent or collector. -type Exporter struct { - uploader batchUploader - stopOnce sync.Once - stopCh chan struct{} - defaultServiceName string -} - -var _ sdktrace.SpanExporter = (*Exporter)(nil) - -// ExportSpans transforms and exports OpenTelemetry spans to Jaeger. -func (e *Exporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error { - // Return fast if context is already canceled or Exporter shutdown. - select { - case <-ctx.Done(): - return ctx.Err() - case <-e.stopCh: - return nil - default: - } - - // Cancel export if Exporter is shutdown. - var cancel context.CancelFunc - ctx, cancel = context.WithCancel(ctx) - defer cancel() - go func(ctx context.Context, cancel context.CancelFunc) { - select { - case <-ctx.Done(): - case <-e.stopCh: - cancel() - } - }(ctx, cancel) - - for _, batch := range jaegerBatchList(spans, e.defaultServiceName) { - if err := e.uploader.upload(ctx, batch); err != nil { - return err - } - } - - return nil -} - -// Shutdown stops the Exporter. This will close all connections and release -// all resources held by the Exporter. -func (e *Exporter) Shutdown(ctx context.Context) error { - // Stop any active and subsequent exports. - e.stopOnce.Do(func() { close(e.stopCh) }) - select { - case <-ctx.Done(): - return ctx.Err() - default: - } - return e.uploader.shutdown(ctx) -} - -// MarshalLog is the marshaling function used by the logging system to represent this exporter. -func (e *Exporter) MarshalLog() interface{} { - return struct { - Type string - }{ - Type: "jaeger", - } -} - -func spanToThrift(ss sdktrace.ReadOnlySpan) *gen.Span { - attr := ss.Attributes() - tags := make([]*gen.Tag, 0, len(attr)) - for _, kv := range attr { - tag := keyValueToTag(kv) - if tag != nil { - tags = append(tags, tag) - } - } - - if is := ss.InstrumentationScope(); is.Name != "" { - tags = append(tags, getStringTag(keyInstrumentationLibraryName, is.Name)) - if is.Version != "" { - tags = append(tags, getStringTag(keyInstrumentationLibraryVersion, is.Version)) - } - } - - if ss.SpanKind() != trace.SpanKindInternal { - tags = append(tags, - getStringTag(keySpanKind, ss.SpanKind().String()), - ) - } - - if ss.Status().Code != codes.Unset { - switch ss.Status().Code { - case codes.Ok: - tags = append(tags, getStringTag(keyStatusCode, "OK")) - case codes.Error: - tags = append(tags, getBoolTag(keyError, true)) - tags = append(tags, getStringTag(keyStatusCode, "ERROR")) - } - if ss.Status().Description != "" { - tags = append(tags, getStringTag(keyStatusMessage, ss.Status().Description)) - } - } - - var logs []*gen.Log - for _, a := range ss.Events() { - nTags := len(a.Attributes) - if a.Name != "" { - nTags++ - } - if a.DroppedAttributeCount != 0 { - nTags++ - } - fields := make([]*gen.Tag, 0, nTags) - if a.Name != "" { - // If an event contains an attribute with the same key, it needs - // to be given precedence and overwrite this. - fields = append(fields, getStringTag(keyEventName, a.Name)) - } - for _, kv := range a.Attributes { - tag := keyValueToTag(kv) - if tag != nil { - fields = append(fields, tag) - } - } - if a.DroppedAttributeCount != 0 { - fields = append(fields, getInt64Tag(keyDroppedAttributeCount, int64(a.DroppedAttributeCount))) - } - logs = append(logs, &gen.Log{ - Timestamp: a.Time.UnixNano() / 1000, - Fields: fields, - }) - } - - var refs []*gen.SpanRef - for _, link := range ss.Links() { - tid := link.SpanContext.TraceID() - sid := link.SpanContext.SpanID() - refs = append(refs, &gen.SpanRef{ - TraceIdHigh: int64(binary.BigEndian.Uint64(tid[0:8])), - TraceIdLow: int64(binary.BigEndian.Uint64(tid[8:16])), - SpanId: int64(binary.BigEndian.Uint64(sid[:])), - RefType: gen.SpanRefType_FOLLOWS_FROM, - }) - } - - tid := ss.SpanContext().TraceID() - sid := ss.SpanContext().SpanID() - psid := ss.Parent().SpanID() - return &gen.Span{ - TraceIdHigh: int64(binary.BigEndian.Uint64(tid[0:8])), - TraceIdLow: int64(binary.BigEndian.Uint64(tid[8:16])), - SpanId: int64(binary.BigEndian.Uint64(sid[:])), - ParentSpanId: int64(binary.BigEndian.Uint64(psid[:])), - OperationName: ss.Name(), // TODO: if span kind is added then add prefix "Sent"/"Recv" - Flags: int32(ss.SpanContext().TraceFlags()), - StartTime: ss.StartTime().UnixNano() / 1000, - Duration: ss.EndTime().Sub(ss.StartTime()).Nanoseconds() / 1000, - Tags: tags, - Logs: logs, - References: refs, - } -} - -func keyValueToTag(keyValue attribute.KeyValue) *gen.Tag { - var tag *gen.Tag - switch keyValue.Value.Type() { - case attribute.STRING: - s := keyValue.Value.AsString() - tag = &gen.Tag{ - Key: string(keyValue.Key), - VStr: &s, - VType: gen.TagType_STRING, - } - case attribute.BOOL: - b := keyValue.Value.AsBool() - tag = &gen.Tag{ - Key: string(keyValue.Key), - VBool: &b, - VType: gen.TagType_BOOL, - } - case attribute.INT64: - i := keyValue.Value.AsInt64() - tag = &gen.Tag{ - Key: string(keyValue.Key), - VLong: &i, - VType: gen.TagType_LONG, - } - case attribute.FLOAT64: - f := keyValue.Value.AsFloat64() - tag = &gen.Tag{ - Key: string(keyValue.Key), - VDouble: &f, - VType: gen.TagType_DOUBLE, - } - case attribute.BOOLSLICE, - attribute.INT64SLICE, - attribute.FLOAT64SLICE, - attribute.STRINGSLICE: - data, _ := json.Marshal(keyValue.Value.AsInterface()) - a := (string)(data) - tag = &gen.Tag{ - Key: string(keyValue.Key), - VStr: &a, - VType: gen.TagType_STRING, - } - } - return tag -} - -func getInt64Tag(k string, i int64) *gen.Tag { - return &gen.Tag{ - Key: k, - VLong: &i, - VType: gen.TagType_LONG, - } -} - -func getStringTag(k, s string) *gen.Tag { - return &gen.Tag{ - Key: k, - VStr: &s, - VType: gen.TagType_STRING, - } -} - -func getBoolTag(k string, b bool) *gen.Tag { - return &gen.Tag{ - Key: k, - VBool: &b, - VType: gen.TagType_BOOL, - } -} - -// jaegerBatchList transforms a slice of spans into a slice of jaeger Batch. -func jaegerBatchList(ssl []sdktrace.ReadOnlySpan, defaultServiceName string) []*gen.Batch { - if len(ssl) == 0 { - return nil - } - - batchDict := make(map[attribute.Distinct]*gen.Batch) - - for _, ss := range ssl { - if ss == nil { - continue - } - - resourceKey := ss.Resource().Equivalent() - batch, bOK := batchDict[resourceKey] - if !bOK { - batch = &gen.Batch{ - Process: process(ss.Resource(), defaultServiceName), - Spans: []*gen.Span{}, - } - } - batch.Spans = append(batch.Spans, spanToThrift(ss)) - batchDict[resourceKey] = batch - } - - // Transform the categorized map into a slice - batchList := make([]*gen.Batch, 0, len(batchDict)) - for _, batch := range batchDict { - batchList = append(batchList, batch) - } - return batchList -} - -// process transforms an OTel Resource into a jaeger Process. -func process(res *resource.Resource, defaultServiceName string) *gen.Process { - var process gen.Process - - var serviceName attribute.KeyValue - if res != nil { - for iter := res.Iter(); iter.Next(); { - if iter.Attribute().Key == semconv.ServiceNameKey { - serviceName = iter.Attribute() - // Don't convert service.name into tag. - continue - } - if tag := keyValueToTag(iter.Attribute()); tag != nil { - process.Tags = append(process.Tags, tag) - } - } - } - - // If no service.name is contained in a Span's Resource, - // that field MUST be populated from the default Resource. - if serviceName.Value.AsString() == "" { - serviceName = semconv.ServiceName(defaultServiceName) - } - process.ServiceName = serviceName.Value.AsString() - - return &process -} diff --git a/exporters/jaeger/jaeger_benchmark_test.go b/exporters/jaeger/jaeger_benchmark_test.go deleted file mode 100644 index ab96ac8c9ed..00000000000 --- a/exporters/jaeger/jaeger_benchmark_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger - -import ( - "context" - "fmt" - "testing" - "time" - - "go.opentelemetry.io/otel/sdk/instrumentation" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/trace" -) - -var ( - traceID trace.TraceID - spanID trace.SpanID - spanContext trace.SpanContext - - instrLibName = "benchmark.tests" -) - -func init() { - var err error - traceID, err = trace.TraceIDFromHex("0102030405060708090a0b0c0d0e0f10") - if err != nil { - panic(err) - } - spanID, err = trace.SpanIDFromHex("0102030405060708") - if err != nil { - panic(err) - } - spanContext = trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: spanID, - }) -} - -func spans(n int) []tracesdk.ReadOnlySpan { - now := time.Now() - s := make(tracetest.SpanStubs, n) - for i := 0; i < n; i++ { - name := fmt.Sprintf("span %d", i) - s[i] = tracetest.SpanStub{ - SpanContext: spanContext, - Name: name, - StartTime: now, - EndTime: now, - SpanKind: trace.SpanKindClient, - InstrumentationLibrary: instrumentation.Library{ - Name: instrLibName, - }, - } - } - return s.Snapshots() -} - -func benchmarkExportSpans(b *testing.B, o EndpointOption, i int) { - ctx := context.Background() - s := spans(i) - exp, err := New(o) - if err != nil { - b.Fatal(err) - } - - b.ReportAllocs() - b.ResetTimer() - - for n := 0; n < b.N; n++ { - if err := exp.ExportSpans(ctx, s); err != nil { - b.Error(err) - } - } -} - -func benchmarkCollector(b *testing.B, i int) { - benchmarkExportSpans(b, withTestCollectorEndpoint(), i) -} - -func benchmarkAgent(b *testing.B, i int) { - benchmarkExportSpans(b, WithAgentEndpoint(), i) -} - -func BenchmarkCollectorExportSpans1(b *testing.B) { benchmarkCollector(b, 1) } -func BenchmarkCollectorExportSpans10(b *testing.B) { benchmarkCollector(b, 10) } -func BenchmarkCollectorExportSpans100(b *testing.B) { benchmarkCollector(b, 100) } -func BenchmarkCollectorExportSpans1000(b *testing.B) { benchmarkCollector(b, 1000) } -func BenchmarkCollectorExportSpans10000(b *testing.B) { benchmarkCollector(b, 10000) } -func BenchmarkAgentExportSpans1(b *testing.B) { benchmarkAgent(b, 1) } -func BenchmarkAgentExportSpans10(b *testing.B) { benchmarkAgent(b, 10) } -func BenchmarkAgentExportSpans100(b *testing.B) { benchmarkAgent(b, 100) } - -/* -* BUG: These tests are not possible currently because the thrift payload size -* does not fit in a UDP packet with the default size (65000) and will return -* an error. - -func BenchmarkAgentExportSpans1000(b *testing.B) { benchmarkAgent(b, 1000) } -func BenchmarkAgentExportSpans10000(b *testing.B) { benchmarkAgent(b, 10000) } - -*/ diff --git a/exporters/jaeger/jaeger_test.go b/exporters/jaeger/jaeger_test.go deleted file mode 100644 index 312a7fc5ea1..00000000000 --- a/exporters/jaeger/jaeger_test.go +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger - -import ( - "context" - "encoding/binary" - "fmt" - "os" - "sort" - "testing" - "time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - ottest "go.opentelemetry.io/otel/exporters/jaeger/internal/internaltest" - "go.opentelemetry.io/otel/sdk/instrumentation" - "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.21.0" - "go.opentelemetry.io/otel/trace" -) - -func TestNewRawExporter(t *testing.T) { - testCases := []struct { - name string - endpoint EndpointOption - }{ - { - name: "default exporter with collector endpoint", - endpoint: WithCollectorEndpoint(), - }, - { - name: "default exporter with agent endpoint", - endpoint: WithAgentEndpoint(), - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := New(tc.endpoint) - assert.NoError(t, err) - }) - } -} - -func TestNewRawExporterUseEnvVarIfOptionUnset(t *testing.T) { - // Record and restore env - envStore := ottest.NewEnvStore() - envStore.Record(envEndpoint) - defer func() { - require.NoError(t, envStore.Restore()) - }() - - // If the user sets the environment variable OTEL_EXPORTER_JAEGER_ENDPOINT, endpoint will always get a value. - require.NoError(t, os.Unsetenv(envEndpoint)) - _, err := New( - WithCollectorEndpoint(), - ) - - assert.NoError(t, err) -} - -type testCollectorEndpoint struct { - batchesUploaded []*gen.Batch -} - -func (c *testCollectorEndpoint) shutdown(context.Context) error { - return nil -} - -func (c *testCollectorEndpoint) upload(_ context.Context, batch *gen.Batch) error { - c.batchesUploaded = append(c.batchesUploaded, batch) - return nil -} - -var _ batchUploader = (*testCollectorEndpoint)(nil) - -func withTestCollectorEndpoint() EndpointOption { - return endpointOptionFunc(func() (batchUploader, error) { - return &testCollectorEndpoint{}, nil - }) -} - -func withTestCollectorEndpointInjected(ce *testCollectorEndpoint) EndpointOption { - return endpointOptionFunc(func() (batchUploader, error) { - return ce, nil - }) -} - -func TestExporterExportSpan(t *testing.T) { - const ( - serviceName = "test-service" - tagKey = "key" - tagVal = "val" - ) - - testCollector := &testCollectorEndpoint{} - exp, err := New(withTestCollectorEndpointInjected(testCollector)) - require.NoError(t, err) - tp := sdktrace.NewTracerProvider( - sdktrace.WithBatcher(exp), - sdktrace.WithResource(resource.NewSchemaless( - semconv.ServiceName(serviceName), - attribute.String(tagKey, tagVal), - )), - ) - - tracer := tp.Tracer("test-tracer") - - ctx := context.Background() - for i := 0; i < 3; i++ { - _, span := tracer.Start(ctx, fmt.Sprintf("test-span-%d", i)) - span.End() - assert.True(t, span.SpanContext().IsValid()) - } - - require.NoError(t, tp.Shutdown(ctx)) - - batchesUploaded := testCollector.batchesUploaded - require.Len(t, batchesUploaded, 1) - uploadedBatch := batchesUploaded[0] - assert.Equal(t, serviceName, uploadedBatch.GetProcess().GetServiceName()) - assert.Len(t, uploadedBatch.GetSpans(), 3) - - require.Len(t, uploadedBatch.GetProcess().GetTags(), 1) - assert.Equal(t, tagKey, uploadedBatch.GetProcess().GetTags()[0].GetKey()) - assert.Equal(t, tagVal, uploadedBatch.GetProcess().GetTags()[0].GetVStr()) -} - -func TestSpanSnapshotToThrift(t *testing.T) { - now := time.Now() - traceID, _ := trace.TraceIDFromHex("0102030405060708090a0b0c0d0e0f10") - spanID, _ := trace.SpanIDFromHex("0102030405060708") - parentSpanID, _ := trace.SpanIDFromHex("0807060504030201") - - linkTraceID, _ := trace.TraceIDFromHex("0102030405060709090a0b0c0d0e0f11") - linkSpanID, _ := trace.SpanIDFromHex("0102030405060709") - - eventNameValue := "event-test" - eventDropped := int64(10) - keyValue := "value" - statusCodeValue := "ERROR" - doubleValue := 123.456 - intValue := int64(123) - boolTrue := true - arrValue := "[0,1,2,3]" - statusMessage := "this is a problem" - spanKind := "client" - rv1 := "rv11" - rv2 := int64(5) - instrLibName := "instrumentation-library" - instrLibVersion := "semver:1.0.0" - - tests := []struct { - name string - data tracetest.SpanStub - want *gen.Span - }{ - { - name: "no status description", - data: tracetest.SpanStub{ - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: spanID, - }), - Name: "/foo", - StartTime: now, - EndTime: now, - Status: sdktrace.Status{Code: codes.Error}, - SpanKind: trace.SpanKindClient, - InstrumentationLibrary: instrumentation.Library{ - Name: instrLibName, - Version: instrLibVersion, - }, - }, - want: &gen.Span{ - TraceIdLow: 651345242494996240, - TraceIdHigh: 72623859790382856, - SpanId: 72623859790382856, - OperationName: "/foo", - StartTime: now.UnixNano() / 1000, - Duration: 0, - Tags: []*gen.Tag{ - {Key: keyError, VType: gen.TagType_BOOL, VBool: &boolTrue}, - {Key: keyInstrumentationLibraryName, VType: gen.TagType_STRING, VStr: &instrLibName}, - {Key: keyInstrumentationLibraryVersion, VType: gen.TagType_STRING, VStr: &instrLibVersion}, - {Key: keyStatusCode, VType: gen.TagType_STRING, VStr: &statusCodeValue}, - // Should not have a status message because it was unset - {Key: keySpanKind, VType: gen.TagType_STRING, VStr: &spanKind}, - }, - }, - }, - { - name: "no parent", - data: tracetest.SpanStub{ - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: spanID, - }), - Name: "/foo", - StartTime: now, - EndTime: now, - Links: []sdktrace.Link{ - { - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: linkTraceID, - SpanID: linkSpanID, - }), - }, - }, - Attributes: []attribute.KeyValue{ - attribute.String("key", keyValue), - attribute.Float64("double", doubleValue), - attribute.Int64("int", intValue), - }, - Events: []sdktrace.Event{ - { - Name: eventNameValue, - Attributes: []attribute.KeyValue{attribute.String("k1", keyValue)}, - DroppedAttributeCount: int(eventDropped), - Time: now, - }, - }, - Status: sdktrace.Status{ - Code: codes.Error, - Description: statusMessage, - }, - SpanKind: trace.SpanKindClient, - InstrumentationLibrary: instrumentation.Library{ - Name: instrLibName, - Version: instrLibVersion, - }, - }, - want: &gen.Span{ - TraceIdLow: 651345242494996240, - TraceIdHigh: 72623859790382856, - SpanId: 72623859790382856, - OperationName: "/foo", - StartTime: now.UnixNano() / 1000, - Duration: 0, - Tags: []*gen.Tag{ - {Key: "double", VType: gen.TagType_DOUBLE, VDouble: &doubleValue}, - {Key: "key", VType: gen.TagType_STRING, VStr: &keyValue}, - {Key: "int", VType: gen.TagType_LONG, VLong: &intValue}, - {Key: keyError, VType: gen.TagType_BOOL, VBool: &boolTrue}, - {Key: keyInstrumentationLibraryName, VType: gen.TagType_STRING, VStr: &instrLibName}, - {Key: keyInstrumentationLibraryVersion, VType: gen.TagType_STRING, VStr: &instrLibVersion}, - {Key: keyStatusCode, VType: gen.TagType_STRING, VStr: &statusCodeValue}, - {Key: keyStatusMessage, VType: gen.TagType_STRING, VStr: &statusMessage}, - {Key: keySpanKind, VType: gen.TagType_STRING, VStr: &spanKind}, - }, - References: []*gen.SpanRef{ - { - RefType: gen.SpanRefType_FOLLOWS_FROM, - TraceIdHigh: int64(binary.BigEndian.Uint64(linkTraceID[0:8])), - TraceIdLow: int64(binary.BigEndian.Uint64(linkTraceID[8:16])), - SpanId: int64(binary.BigEndian.Uint64(linkSpanID[:])), - }, - }, - Logs: []*gen.Log{ - { - Timestamp: now.UnixNano() / 1000, - Fields: []*gen.Tag{ - { - Key: keyEventName, - VStr: &eventNameValue, - VType: gen.TagType_STRING, - }, - { - Key: "k1", - VStr: &keyValue, - VType: gen.TagType_STRING, - }, - { - Key: keyDroppedAttributeCount, - VLong: &eventDropped, - VType: gen.TagType_LONG, - }, - }, - }, - }, - }, - }, - { - name: "with parent", - data: tracetest.SpanStub{ - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: spanID, - }), - Parent: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: parentSpanID, - }), - Links: []sdktrace.Link{ - { - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: linkTraceID, - SpanID: linkSpanID, - }), - }, - }, - Name: "/foo", - StartTime: now, - EndTime: now, - Attributes: []attribute.KeyValue{ - attribute.IntSlice("arr", []int{0, 1, 2, 3}), - }, - Status: sdktrace.Status{ - Code: codes.Unset, - Description: statusMessage, - }, - SpanKind: trace.SpanKindInternal, - InstrumentationLibrary: instrumentation.Library{ - Name: instrLibName, - Version: instrLibVersion, - }, - }, - want: &gen.Span{ - TraceIdLow: 651345242494996240, - TraceIdHigh: 72623859790382856, - SpanId: 72623859790382856, - ParentSpanId: 578437695752307201, - OperationName: "/foo", - StartTime: now.UnixNano() / 1000, - Duration: 0, - Tags: []*gen.Tag{ - // status code, message and span kind should NOT be populated - {Key: "arr", VType: gen.TagType_STRING, VStr: &arrValue}, - {Key: keyInstrumentationLibraryName, VType: gen.TagType_STRING, VStr: &instrLibName}, - {Key: keyInstrumentationLibraryVersion, VType: gen.TagType_STRING, VStr: &instrLibVersion}, - }, - References: []*gen.SpanRef{ - { - RefType: gen.SpanRefType_FOLLOWS_FROM, - TraceIdHigh: int64(binary.BigEndian.Uint64(linkTraceID[0:8])), - TraceIdLow: int64(binary.BigEndian.Uint64(linkTraceID[8:16])), - SpanId: int64(binary.BigEndian.Uint64(linkSpanID[:])), - }, - }, - }, - }, - { - name: "resources do not affect the tags", - data: tracetest.SpanStub{ - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: spanID, - }), - Parent: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: traceID, - SpanID: parentSpanID, - }), - Name: "/foo", - StartTime: now, - EndTime: now, - Resource: resource.NewSchemaless( - attribute.String("rk1", rv1), - attribute.Int64("rk2", rv2), - semconv.ServiceName("service name"), - ), - Status: sdktrace.Status{ - Code: codes.Unset, - Description: statusMessage, - }, - SpanKind: trace.SpanKindInternal, - InstrumentationLibrary: instrumentation.Library{ - Name: instrLibName, - Version: instrLibVersion, - }, - }, - want: &gen.Span{ - TraceIdLow: 651345242494996240, - TraceIdHigh: 72623859790382856, - SpanId: 72623859790382856, - ParentSpanId: 578437695752307201, - OperationName: "/foo", - StartTime: now.UnixNano() / 1000, - Duration: 0, - Tags: []*gen.Tag{ - {Key: keyInstrumentationLibraryName, VType: gen.TagType_STRING, VStr: &instrLibName}, - {Key: keyInstrumentationLibraryVersion, VType: gen.TagType_STRING, VStr: &instrLibVersion}, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := spanToThrift(tt.data.Snapshot()) - sort.Slice(got.Tags, func(i, j int) bool { - return got.Tags[i].Key < got.Tags[j].Key - }) - sort.Slice(tt.want.Tags, func(i, j int) bool { - return tt.want.Tags[i].Key < tt.want.Tags[j].Key - }) - if diff := cmp.Diff(got, tt.want); diff != "" { - t.Errorf("Diff%v", diff) - } - }) - } -} - -func TestExporterShutdownHonorsCancel(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - e, err := New(withTestCollectorEndpoint()) - require.NoError(t, err) - assert.EqualError(t, e.Shutdown(ctx), context.Canceled.Error()) -} - -func TestExporterShutdownHonorsTimeout(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Nanosecond) - <-ctx.Done() - - e, err := New(withTestCollectorEndpoint()) - require.NoError(t, err) - assert.EqualError(t, e.Shutdown(ctx), context.DeadlineExceeded.Error()) - cancel() -} - -func TestErrorOnExportShutdownExporter(t *testing.T) { - e, err := New(withTestCollectorEndpoint()) - require.NoError(t, err) - assert.NoError(t, e.Shutdown(context.Background())) - assert.NoError(t, e.ExportSpans(context.Background(), nil)) -} - -func TestExporterExportSpansHonorsCancel(t *testing.T) { - e, err := New(withTestCollectorEndpoint()) - require.NoError(t, err) - now := time.Now() - ss := tracetest.SpanStubs{ - { - Name: "s1", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }, - { - Name: "s2", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r2").String("v2"), - ), - StartTime: now, - EndTime: now, - }, - } - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - assert.EqualError(t, e.ExportSpans(ctx, ss.Snapshots()), context.Canceled.Error()) -} - -func TestExporterExportSpansHonorsTimeout(t *testing.T) { - e, err := New(withTestCollectorEndpoint()) - require.NoError(t, err) - now := time.Now() - ss := tracetest.SpanStubs{ - { - Name: "s1", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }, - { - Name: "s2", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r2").String("v2"), - ), - StartTime: now, - EndTime: now, - }, - } - ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) - defer cancel() - <-ctx.Done() - - assert.EqualError(t, e.ExportSpans(ctx, ss.Snapshots()), context.DeadlineExceeded.Error()) -} - -func TestJaegerBatchList(t *testing.T) { - newString := func(value string) *string { - return &value - } - spanKind := "unspecified" - now := time.Now() - - testCases := []struct { - name string - roSpans []sdktrace.ReadOnlySpan - defaultServiceName string - expectedBatchList []*gen.Batch - }{ - { - name: "no span shots", - roSpans: nil, - expectedBatchList: nil, - }, - { - name: "span's snapshot contains nil span", - roSpans: []sdktrace.ReadOnlySpan{ - tracetest.SpanStub{ - Name: "s1", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }.Snapshot(), - nil, - }, - expectedBatchList: []*gen.Batch{ - { - Process: &gen.Process{ - ServiceName: "name", - Tags: []*gen.Tag{ - {Key: "r1", VType: gen.TagType_STRING, VStr: newString("v1")}, - }, - }, - Spans: []*gen.Span{ - { - OperationName: "s1", - Tags: []*gen.Tag{ - {Key: keySpanKind, VType: gen.TagType_STRING, VStr: &spanKind}, - }, - StartTime: now.UnixNano() / 1000, - }, - }, - }, - }, - }, - { - name: "merge spans that have the same resources", - roSpans: tracetest.SpanStubs{ - { - Name: "s1", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }, - { - Name: "s2", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }, - { - Name: "s3", - Resource: resource.NewSchemaless( - semconv.ServiceName("name"), - attribute.Key("r2").String("v2"), - ), - StartTime: now, - EndTime: now, - }, - }.Snapshots(), - expectedBatchList: []*gen.Batch{ - { - Process: &gen.Process{ - ServiceName: "name", - Tags: []*gen.Tag{ - {Key: "r1", VType: gen.TagType_STRING, VStr: newString("v1")}, - }, - }, - Spans: []*gen.Span{ - { - OperationName: "s1", - Tags: []*gen.Tag{ - {Key: "span.kind", VType: gen.TagType_STRING, VStr: &spanKind}, - }, - StartTime: now.UnixNano() / 1000, - }, - { - OperationName: "s2", - Tags: []*gen.Tag{ - {Key: "span.kind", VType: gen.TagType_STRING, VStr: &spanKind}, - }, - StartTime: now.UnixNano() / 1000, - }, - }, - }, - { - Process: &gen.Process{ - ServiceName: "name", - Tags: []*gen.Tag{ - {Key: "r2", VType: gen.TagType_STRING, VStr: newString("v2")}, - }, - }, - Spans: []*gen.Span{ - { - OperationName: "s3", - Tags: []*gen.Tag{ - {Key: "span.kind", VType: gen.TagType_STRING, VStr: &spanKind}, - }, - StartTime: now.UnixNano() / 1000, - }, - }, - }, - }, - }, - { - name: "no service name in spans", - roSpans: tracetest.SpanStubs{ - { - Name: "s1", - Resource: resource.NewSchemaless( - attribute.Key("r1").String("v1"), - ), - StartTime: now, - EndTime: now, - }, - }.Snapshots(), - defaultServiceName: "default service name", - expectedBatchList: []*gen.Batch{ - { - Process: &gen.Process{ - ServiceName: "default service name", - Tags: []*gen.Tag{ - {Key: "r1", VType: gen.TagType_STRING, VStr: newString("v1")}, - }, - }, - Spans: []*gen.Span{ - { - OperationName: "s1", - Tags: []*gen.Tag{ - {Key: "span.kind", VType: gen.TagType_STRING, VStr: &spanKind}, - }, - StartTime: now.UnixNano() / 1000, - }, - }, - }, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - batchList := jaegerBatchList(tc.roSpans, tc.defaultServiceName) - - assert.ElementsMatch(t, tc.expectedBatchList, batchList) - }) - } -} - -func TestProcess(t *testing.T) { - v1 := "v1" - - testCases := []struct { - name string - res *resource.Resource - defaultServiceName string - expectedProcess *gen.Process - }{ - { - name: "resources contain service name", - res: resource.NewSchemaless( - semconv.ServiceName("service name"), - attribute.Key("r1").String("v1"), - ), - defaultServiceName: "default service name", - expectedProcess: &gen.Process{ - ServiceName: "service name", - Tags: []*gen.Tag{ - {Key: "r1", VType: gen.TagType_STRING, VStr: &v1}, - }, - }, - }, - { - name: "resources don't have service name", - res: resource.NewSchemaless(attribute.Key("r1").String("v1")), - defaultServiceName: "default service name", - expectedProcess: &gen.Process{ - ServiceName: "default service name", - Tags: []*gen.Tag{ - {Key: "r1", VType: gen.TagType_STRING, VStr: &v1}, - }, - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - pro := process(tc.res, tc.defaultServiceName) - - assert.Equal(t, tc.expectedProcess, pro) - }) - } -} diff --git a/exporters/jaeger/reconnecting_udp_client.go b/exporters/jaeger/reconnecting_udp_client.go deleted file mode 100644 index 88055c8a300..00000000000 --- a/exporters/jaeger/reconnecting_udp_client.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" - -import ( - "fmt" - "net" - "sync" - "sync/atomic" - "time" - - "github.com/go-logr/logr" -) - -// reconnectingUDPConn is an implementation of udpConn that resolves hostPort every resolveTimeout, if the resolved address is -// different than the current conn then the new address is dialed and the conn is swapped. -type reconnectingUDPConn struct { - // `sync/atomic` expects the first word in an allocated struct to be 64-bit - // aligned on both ARM and x86-32. See https://goo.gl/zW7dgq for more details. - bufferBytes int64 - hostPort string - resolveFunc resolveFunc - dialFunc dialFunc - logger logr.Logger - - connMtx sync.RWMutex - conn *net.UDPConn - destAddr *net.UDPAddr - closeChan chan struct{} -} - -type resolveFunc func(network string, hostPort string) (*net.UDPAddr, error) -type dialFunc func(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error) - -// newReconnectingUDPConn returns a new udpConn that resolves hostPort every resolveTimeout, if the resolved address is -// different than the current conn then the new address is dialed and the conn is swapped. -func newReconnectingUDPConn(hostPort string, bufferBytes int, resolveTimeout time.Duration, resolveFunc resolveFunc, dialFunc dialFunc, logger logr.Logger) (*reconnectingUDPConn, error) { - conn := &reconnectingUDPConn{ - hostPort: hostPort, - resolveFunc: resolveFunc, - dialFunc: dialFunc, - logger: logger, - closeChan: make(chan struct{}), - bufferBytes: int64(bufferBytes), - } - - if err := conn.attemptResolveAndDial(); err != nil { - conn.logf("failed resolving destination address on connection startup, with err: %q. retrying in %s", err.Error(), resolveTimeout) - } - - go conn.reconnectLoop(resolveTimeout) - - return conn, nil -} - -func (c *reconnectingUDPConn) logf(format string, args ...interface{}) { - if c.logger != emptyLogger { - c.logger.Info(format, args...) - } -} - -func (c *reconnectingUDPConn) reconnectLoop(resolveTimeout time.Duration) { - ticker := time.NewTicker(resolveTimeout) - defer ticker.Stop() - - for { - select { - case <-c.closeChan: - return - case <-ticker.C: - if err := c.attemptResolveAndDial(); err != nil { - c.logf("%s", err.Error()) - } - } - } -} - -func (c *reconnectingUDPConn) attemptResolveAndDial() error { - newAddr, err := c.resolveFunc("udp", c.hostPort) - if err != nil { - return fmt.Errorf("failed to resolve new addr for host %q, with err: %w", c.hostPort, err) - } - - c.connMtx.RLock() - curAddr := c.destAddr - c.connMtx.RUnlock() - - // dont attempt dial if an addr was successfully dialed previously and, resolved addr is the same as current conn - if curAddr != nil && newAddr.String() == curAddr.String() { - return nil - } - - if err := c.attemptDialNewAddr(newAddr); err != nil { - return fmt.Errorf("failed to dial newly resolved addr '%s', with err: %w", newAddr, err) - } - - return nil -} - -func (c *reconnectingUDPConn) attemptDialNewAddr(newAddr *net.UDPAddr) error { - connUDP, err := c.dialFunc(newAddr.Network(), nil, newAddr) - if err != nil { - return err - } - - if bufferBytes := int(atomic.LoadInt64(&c.bufferBytes)); bufferBytes != 0 { - if err = connUDP.SetWriteBuffer(bufferBytes); err != nil { - return err - } - } - - c.connMtx.Lock() - c.destAddr = newAddr - // store prev to close later - prevConn := c.conn - c.conn = connUDP - c.connMtx.Unlock() - - if prevConn != nil { - return prevConn.Close() - } - - return nil -} - -// Write calls net.udpConn.Write, if it fails an attempt is made to connect to a new addr, if that succeeds the write is retried before returning. -func (c *reconnectingUDPConn) Write(b []byte) (int, error) { - var bytesWritten int - var err error - - c.connMtx.RLock() - conn := c.conn - c.connMtx.RUnlock() - - if conn == nil { - // if connection is not initialized indicate this with err in order to hook into retry logic - err = fmt.Errorf("UDP connection not yet initialized, an address has not been resolved") - } else { - bytesWritten, err = conn.Write(b) - } - - if err == nil { - return bytesWritten, nil - } - - // attempt to resolve and dial new address in case that's the problem, if resolve and dial succeeds, try write again - if reconnErr := c.attemptResolveAndDial(); reconnErr == nil { - c.connMtx.RLock() - conn := c.conn - c.connMtx.RUnlock() - - return conn.Write(b) - } - - // return original error if reconn fails - return bytesWritten, err -} - -// Close stops the reconnectLoop, then closes the connection via net.udpConn 's implementation. -func (c *reconnectingUDPConn) Close() error { - close(c.closeChan) - - // acquire rw lock before closing conn to ensure calls to Write drain - c.connMtx.Lock() - defer c.connMtx.Unlock() - - if c.conn != nil { - return c.conn.Close() - } - - return nil -} - -// SetWriteBuffer defers to the net.udpConn SetWriteBuffer implementation wrapped with a RLock. if no conn is currently held -// and SetWriteBuffer is called store bufferBytes to be set for new conns. -func (c *reconnectingUDPConn) SetWriteBuffer(bytes int) error { - var err error - - c.connMtx.RLock() - conn := c.conn - c.connMtx.RUnlock() - - if conn != nil { - err = c.conn.SetWriteBuffer(bytes) - } - - if err == nil { - atomic.StoreInt64(&c.bufferBytes, int64(bytes)) - } - - return err -} diff --git a/exporters/jaeger/reconnecting_udp_client_test.go b/exporters/jaeger/reconnecting_udp_client_test.go deleted file mode 100644 index 8d29eaf5eb4..00000000000 --- a/exporters/jaeger/reconnecting_udp_client_test.go +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger - -import ( - "context" - "crypto/rand" - "fmt" - "net" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type mockResolver struct { - mock.Mock -} - -func (m *mockResolver) ResolveUDPAddr(network string, hostPort string) (*net.UDPAddr, error) { - args := m.Called(network, hostPort) - - a0 := args.Get(0) - if a0 == nil { - return (*net.UDPAddr)(nil), args.Error(1) - } - return a0.(*net.UDPAddr), args.Error(1) -} - -type mockDialer struct { - mock.Mock -} - -func (m *mockDialer) DialUDP(network string, laddr, raddr *net.UDPAddr) (*net.UDPConn, error) { - args := m.Called(network, laddr, raddr) - - a0 := args.Get(0) - if a0 == nil { - return (*net.UDPConn)(nil), args.Error(1) - } - - return a0.(*net.UDPConn), args.Error(1) -} - -func newUDPListener() (net.PacketConn, error) { - return net.ListenPacket("udp", "127.0.0.1:0") -} - -func newUDPConn() (net.PacketConn, *net.UDPConn, error) { - mockServer, err := newUDPListener() - if err != nil { - return nil, nil, err - } - - addr, err := net.ResolveUDPAddr("udp", mockServer.LocalAddr().String()) - if err != nil { - // Best effort. - _ = mockServer.Close() - return nil, nil, err - } - - conn, err := net.DialUDP("udp", nil, addr) - if err != nil { - // Best effort. - _ = mockServer.Close() - return nil, nil, err - } - - return mockServer, conn, nil -} - -func assertConnWritable(t *testing.T, conn udpConn, serverConn net.PacketConn) { - expectedString := "yo this is a test" - _, err := conn.Write([]byte(expectedString)) - require.NoError(t, err) - - buf := make([]byte, len(expectedString)) - err = serverConn.SetReadDeadline(time.Now().Add(time.Second)) - require.NoError(t, err) - - _, _, err = serverConn.ReadFrom(buf) - require.NoError(t, err) - require.Equal(t, []byte(expectedString), buf) -} - -func waitForCallWithTimeout(call *mock.Call) bool { - called := make(chan struct{}) - call.Run(func(args mock.Arguments) { - if !isChannelClosed(called) { - close(called) - } - }) - - var wasCalled bool - // wait at most 100 milliseconds for the second call of ResolveUDPAddr that is supposed to fail - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*100) - select { - case <-called: - wasCalled = true - case <-ctx.Done(): - fmt.Println("timed out") - } - cancel() - - return wasCalled -} - -func isChannelClosed(ch <-chan struct{}) bool { - select { - case <-ch: - return true - default: - } - return false -} - -func waitForConnCondition(conn *reconnectingUDPConn, condition func(conn *reconnectingUDPConn) bool) bool { - var conditionVal bool - for i := 0; i < 10; i++ { - conn.connMtx.RLock() - conditionVal = condition(conn) - conn.connMtx.RUnlock() - if conditionVal || i >= 9 { - break - } - - time.Sleep(time.Millisecond * 10) - } - - return conditionVal -} - -func newMockUDPAddr(t *testing.T, port int) *net.UDPAddr { - buf := make([]byte, 4) - // random is not seeded to ensure tests are deterministic (also does not matter if ip is valid) - _, err := rand.Read(buf) - require.NoError(t, err) - - return &net.UDPAddr{ - IP: net.IPv4(buf[0], buf[1], buf[2], buf[3]), - Port: port, - } -} - -func TestNewResolvedUDPConn(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil). - Once() - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil). - Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnWrites(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil). - Once() - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil). - Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Hour, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - assertConnWritable(t, conn, mockServer) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnEventuallyDials(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(nil, fmt.Errorf("failed to resolve")).Once(). - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil) - - dialer := mockDialer{} - dialCall := dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil).Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - err = conn.SetWriteBuffer(udpPacketMaxLength) - assert.NoError(t, err) - - wasCalled := waitForCallWithTimeout(dialCall) - assert.True(t, wasCalled) - - connEstablished := waitForConnCondition(conn, func(conn *reconnectingUDPConn) bool { - return conn.conn != nil - }) - - assert.True(t, connEstablished) - - assertConnWritable(t, conn, mockServer) - assertSockBufferSize(t, udpPacketMaxLength, clientConn) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnNoSwapIfFail(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil).Once() - - failCall := resolver.On("ResolveUDPAddr", "udp", hostPort). - Return(nil, fmt.Errorf("resolve failed")) - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil).Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - wasCalled := waitForCallWithTimeout(failCall) - - assert.True(t, wasCalled) - - assertConnWritable(t, conn, mockServer) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnWriteRetry(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(nil, fmt.Errorf("failed to resolve")).Once(). - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil).Once() - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil).Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - err = conn.SetWriteBuffer(udpPacketMaxLength) - assert.NoError(t, err) - - assertConnWritable(t, conn, mockServer) - assertSockBufferSize(t, udpPacketMaxLength, clientConn) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnWriteRetryFails(t *testing.T) { - hostPort := "blahblah:34322" - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(nil, fmt.Errorf("failed to resolve")).Twice() - - dialer := mockDialer{} - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - err = conn.SetWriteBuffer(udpPacketMaxLength) - assert.NoError(t, err) - - _, err = conn.Write([]byte("yo this is a test")) - - assert.Error(t, err) - - err = conn.Close() - assert.NoError(t, err) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnChanges(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr1 := newMockUDPAddr(t, 34322) - - mockServer2, clientConn2, err := newUDPConn() - require.NoError(t, err) - defer mockServer2.Close() - - mockUDPAddr2 := newMockUDPAddr(t, 34322) - - // ensure address doesn't duplicate mockUDPAddr1 - for i := 0; i < 10 && mockUDPAddr2.IP.Equal(mockUDPAddr1.IP); i++ { - mockUDPAddr2 = newMockUDPAddr(t, 34322) - } - - // this is really unlikely to ever fail the test, but its here as a safeguard - require.False(t, mockUDPAddr2.IP.Equal(mockUDPAddr1.IP)) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr1, nil).Once(). - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr2, nil) - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr1). - Return(clientConn, nil).Once() - - secondDial := dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr2). - Return(clientConn2, nil).Once() - - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, time.Millisecond*10, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - - err = conn.SetWriteBuffer(udpPacketMaxLength) - assert.NoError(t, err) - - wasCalled := waitForCallWithTimeout(secondDial) - assert.True(t, wasCalled) - - connSwapped := waitForConnCondition(conn, func(conn *reconnectingUDPConn) bool { - return conn.conn == clientConn2 - }) - - assert.True(t, connSwapped) - - assertConnWritable(t, conn, mockServer2) - assertSockBufferSize(t, udpPacketMaxLength, clientConn2) - - err = conn.Close() - assert.NoError(t, err) - - // assert the prev connection was closed - assert.Error(t, clientConn.Close()) - - // assert the actual connection was closed - assert.Error(t, clientConn2.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} - -func TestResolvedUDPConnLoopWithoutChanges(t *testing.T) { - hostPort := "blahblah:34322" - - mockServer, clientConn, err := newUDPConn() - require.NoError(t, err) - defer mockServer.Close() - - mockUDPAddr := newMockUDPAddr(t, 34322) - - resolver := mockResolver{} - resolver. - On("ResolveUDPAddr", "udp", hostPort). - Return(mockUDPAddr, nil) - - dialer := mockDialer{} - dialer. - On("DialUDP", "udp", (*net.UDPAddr)(nil), mockUDPAddr). - Return(clientConn, nil). - Once() - - resolveTimeout := 500 * time.Millisecond - conn, err := newReconnectingUDPConn(hostPort, udpPacketMaxLength, resolveTimeout, resolver.ResolveUDPAddr, dialer.DialUDP, emptyLogger) - assert.NoError(t, err) - require.NotNil(t, conn) - assert.Equal(t, mockUDPAddr, conn.destAddr) - - // Waiting for one round of loop - time.Sleep(3 * resolveTimeout) - assert.Equal(t, mockUDPAddr, conn.destAddr) - - err = conn.Close() - assert.NoError(t, err) - - // assert the actual connection was closed - assert.Error(t, clientConn.Close()) - - resolver.AssertExpectations(t) - dialer.AssertExpectations(t) -} diff --git a/exporters/jaeger/uploader.go b/exporters/jaeger/uploader.go deleted file mode 100644 index f65e3a6782a..00000000000 --- a/exporters/jaeger/uploader.go +++ /dev/null @@ -1,339 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package jaeger // import "go.opentelemetry.io/otel/exporters/jaeger" - -import ( - "bytes" - "context" - "fmt" - "io" - "log" - "net/http" - "time" - - "github.com/go-logr/logr" - "github.com/go-logr/stdr" - - gen "go.opentelemetry.io/otel/exporters/jaeger/internal/gen-go/jaeger" - "go.opentelemetry.io/otel/exporters/jaeger/internal/third_party/thrift/lib/go/thrift" -) - -// batchUploader send a batch of spans to Jaeger. -type batchUploader interface { - upload(context.Context, *gen.Batch) error - shutdown(context.Context) error -} - -// EndpointOption configures a Jaeger endpoint. -type EndpointOption interface { - newBatchUploader() (batchUploader, error) -} - -type endpointOptionFunc func() (batchUploader, error) - -func (fn endpointOptionFunc) newBatchUploader() (batchUploader, error) { - return fn() -} - -// WithAgentEndpoint configures the Jaeger exporter to send spans to a Jaeger agent -// over compact thrift protocol. This will use the following environment variables for -// configuration if no explicit option is provided: -// -// - OTEL_EXPORTER_JAEGER_AGENT_HOST is used for the agent address host -// - OTEL_EXPORTER_JAEGER_AGENT_PORT is used for the agent address port -// -// The passed options will take precedence over any environment variables and default values -// will be used if neither are provided. -func WithAgentEndpoint(options ...AgentEndpointOption) EndpointOption { - return endpointOptionFunc(func() (batchUploader, error) { - cfg := agentEndpointConfig{ - agentClientUDPParams{ - AttemptReconnecting: true, - Host: envOr(envAgentHost, "localhost"), - Port: envOr(envAgentPort, "6831"), - }, - } - for _, opt := range options { - cfg = opt.apply(cfg) - } - - client, err := newAgentClientUDP(cfg.agentClientUDPParams) - if err != nil { - return nil, err - } - - return &agentUploader{client: client}, nil - }) -} - -// AgentEndpointOption configures a Jaeger agent endpoint. -type AgentEndpointOption interface { - apply(agentEndpointConfig) agentEndpointConfig -} - -type agentEndpointConfig struct { - agentClientUDPParams -} - -type agentEndpointOptionFunc func(agentEndpointConfig) agentEndpointConfig - -func (fn agentEndpointOptionFunc) apply(cfg agentEndpointConfig) agentEndpointConfig { - return fn(cfg) -} - -// WithAgentHost sets a host to be used in the agent client endpoint. -// This option overrides any value set for the -// OTEL_EXPORTER_JAEGER_AGENT_HOST environment variable. -// If this option is not passed and the env var is not set, "localhost" will be used by default. -func WithAgentHost(host string) AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.Host = host - return o - }) -} - -// WithAgentPort sets a port to be used in the agent client endpoint. -// This option overrides any value set for the -// OTEL_EXPORTER_JAEGER_AGENT_PORT environment variable. -// If this option is not passed and the env var is not set, "6831" will be used by default. -func WithAgentPort(port string) AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.Port = port - return o - }) -} - -var emptyLogger = logr.Logger{} - -// WithLogger sets a logger to be used by agent client. -// WithLogger and WithLogr will overwrite each other. -func WithLogger(logger *log.Logger) AgentEndpointOption { - return WithLogr(stdr.New(logger)) -} - -// WithLogr sets a logr.Logger to be used by agent client. -// WithLogr and WithLogger will overwrite each other. -func WithLogr(logger logr.Logger) AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.Logger = logger - return o - }) -} - -// WithDisableAttemptReconnecting sets option to disable reconnecting udp client. -func WithDisableAttemptReconnecting() AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.AttemptReconnecting = false - return o - }) -} - -// WithAttemptReconnectingInterval sets the interval between attempts to re resolve agent endpoint. -func WithAttemptReconnectingInterval(interval time.Duration) AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.AttemptReconnectInterval = interval - return o - }) -} - -// WithMaxPacketSize sets the maximum UDP packet size for transport to the Jaeger agent. -func WithMaxPacketSize(size int) AgentEndpointOption { - return agentEndpointOptionFunc(func(o agentEndpointConfig) agentEndpointConfig { - o.MaxPacketSize = size - return o - }) -} - -// WithCollectorEndpoint defines the full URL to the Jaeger HTTP Thrift collector. This will -// use the following environment variables for configuration if no explicit option is provided: -// -// - OTEL_EXPORTER_JAEGER_ENDPOINT is the HTTP endpoint for sending spans directly to a collector. -// - OTEL_EXPORTER_JAEGER_USER is the username to be sent as authentication to the collector endpoint. -// - OTEL_EXPORTER_JAEGER_PASSWORD is the password to be sent as authentication to the collector endpoint. -// -// The passed options will take precedence over any environment variables. -// If neither values are provided for the endpoint, the default value of "http://localhost:14268/api/traces" will be used. -// If neither values are provided for the username or the password, they will not be set since there is no default. -func WithCollectorEndpoint(options ...CollectorEndpointOption) EndpointOption { - return endpointOptionFunc(func() (batchUploader, error) { - cfg := collectorEndpointConfig{ - endpoint: envOr(envEndpoint, "http://localhost:14268/api/traces"), - username: envOr(envUser, ""), - password: envOr(envPassword, ""), - httpClient: http.DefaultClient, - } - - for _, opt := range options { - cfg = opt.apply(cfg) - } - - return &collectorUploader{ - endpoint: cfg.endpoint, - username: cfg.username, - password: cfg.password, - httpClient: cfg.httpClient, - }, nil - }) -} - -// CollectorEndpointOption configures a Jaeger collector endpoint. -type CollectorEndpointOption interface { - apply(collectorEndpointConfig) collectorEndpointConfig -} - -type collectorEndpointConfig struct { - // endpoint for sending spans directly to a collector. - endpoint string - - // username to be used for authentication with the collector endpoint. - username string - - // password to be used for authentication with the collector endpoint. - password string - - // httpClient to be used to make requests to the collector endpoint. - httpClient *http.Client -} - -type collectorEndpointOptionFunc func(collectorEndpointConfig) collectorEndpointConfig - -func (fn collectorEndpointOptionFunc) apply(cfg collectorEndpointConfig) collectorEndpointConfig { - return fn(cfg) -} - -// WithEndpoint is the URL for the Jaeger collector that spans are sent to. -// This option overrides any value set for the -// OTEL_EXPORTER_JAEGER_ENDPOINT environment variable. -// If this option is not passed and the environment variable is not set, -// "http://localhost:14268/api/traces" will be used by default. -func WithEndpoint(endpoint string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { - o.endpoint = endpoint - return o - }) -} - -// WithUsername sets the username to be used in the authorization header sent for all requests to the collector. -// This option overrides any value set for the -// OTEL_EXPORTER_JAEGER_USER environment variable. -// If this option is not passed and the environment variable is not set, no username will be set. -func WithUsername(username string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { - o.username = username - return o - }) -} - -// WithPassword sets the password to be used in the authorization header sent for all requests to the collector. -// This option overrides any value set for the -// OTEL_EXPORTER_JAEGER_PASSWORD environment variable. -// If this option is not passed and the environment variable is not set, no password will be set. -func WithPassword(password string) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { - o.password = password - return o - }) -} - -// WithHTTPClient sets the http client to be used to make request to the collector endpoint. -func WithHTTPClient(client *http.Client) CollectorEndpointOption { - return collectorEndpointOptionFunc(func(o collectorEndpointConfig) collectorEndpointConfig { - o.httpClient = client - return o - }) -} - -// agentUploader implements batchUploader interface sending batches to -// Jaeger through the UDP agent. -type agentUploader struct { - client *agentClientUDP -} - -var _ batchUploader = (*agentUploader)(nil) - -func (a *agentUploader) shutdown(ctx context.Context) error { - done := make(chan error, 1) - go func() { - done <- a.client.Close() - }() - - select { - case <-ctx.Done(): - // Prioritize not blocking the calling thread and just leak the - // spawned goroutine to close the client. - return ctx.Err() - case err := <-done: - return err - } -} - -func (a *agentUploader) upload(ctx context.Context, batch *gen.Batch) error { - return a.client.EmitBatch(ctx, batch) -} - -// collectorUploader implements batchUploader interface sending batches to -// Jaeger through the collector http endpoint. -type collectorUploader struct { - endpoint string - username string - password string - httpClient *http.Client -} - -var _ batchUploader = (*collectorUploader)(nil) - -func (c *collectorUploader) shutdown(ctx context.Context) error { - // The Exporter will cancel any active exports and will prevent all - // subsequent exports, so nothing to do here. - return nil -} - -func (c *collectorUploader) upload(ctx context.Context, batch *gen.Batch) error { - body, err := serialize(batch) - if err != nil { - return err - } - req, err := http.NewRequestWithContext(ctx, "POST", c.endpoint, body) - if err != nil { - return err - } - if c.username != "" && c.password != "" { - req.SetBasicAuth(c.username, c.password) - } - req.Header.Set("Content-Type", "application/x-thrift") - - resp, err := c.httpClient.Do(req) - if err != nil { - return err - } - - _, _ = io.Copy(io.Discard, resp.Body) - if err = resp.Body.Close(); err != nil { - return err - } - - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return fmt.Errorf("failed to upload traces; HTTP status code: %d", resp.StatusCode) - } - return nil -} - -func serialize(obj thrift.TStruct) (*bytes.Buffer, error) { - buf := thrift.NewTMemoryBuffer() - if err := obj.Write(context.Background(), thrift.NewTBinaryProtocolConf(buf, &thrift.TConfiguration{})); err != nil { - return nil, err - } - return buf.Buffer, nil -} diff --git a/versions.yaml b/versions.yaml index 94f1c919e29..2b240fd3deb 100644 --- a/versions.yaml +++ b/versions.yaml @@ -20,12 +20,10 @@ module-sets: - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/fib - - go.opentelemetry.io/otel/example/jaeger - go.opentelemetry.io/otel/example/namedtracer - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin - - go.opentelemetry.io/otel/exporters/jaeger - go.opentelemetry.io/otel/exporters/otlp/internal/retry - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc From d702e92c2b8bdd317db8ed06f1a894bf6e53237e Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 29 Aug 2023 13:19:33 -0700 Subject: [PATCH 676/886] Remove the deprecated sdk/metric/aggregation package (#4468) * Remove the deprecated sdk/metric/aggregation package * Update PR number --- CHANGELOG.md | 1 + sdk/metric/aggregation/aggregation.go | 224 --------------------- sdk/metric/aggregation/aggregation_test.go | 95 --------- 3 files changed, 1 insertion(+), 319 deletions(-) delete mode 100644 sdk/metric/aggregation/aggregation.go delete mode 100644 sdk/metric/aggregation/aggregation_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 9be5068fd0f..de2bcbd2da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Remove the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) - Remove the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) ## [1.17.0/0.40.0/0.0.5] 2023-08-28 diff --git a/sdk/metric/aggregation/aggregation.go b/sdk/metric/aggregation/aggregation.go deleted file mode 100644 index 5d5643eb294..00000000000 --- a/sdk/metric/aggregation/aggregation.go +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package aggregation contains configuration types that define the -// aggregation operation used to summarizes recorded measurements. -// -// Deprecated: Use the aggregation types in go.opentelemetry.io/otel/sdk/metric -// instead. -package aggregation // import "go.opentelemetry.io/otel/sdk/metric/aggregation" - -import ( - "errors" - "fmt" -) - -// errAgg is wrapped by misconfigured aggregations. -var errAgg = errors.New("aggregation") - -// Aggregation is the aggregation used to summarize recorded measurements. -type Aggregation interface { - // private attempts to ensure no user-defined Aggregation are allowed. The - // OTel specification does not allow user-defined Aggregation currently. - private() - - // Copy returns a deep copy of the Aggregation. - Copy() Aggregation - - // Err returns an error for any misconfigured Aggregation. - Err() error -} - -// Drop is an aggregation that drops all recorded data. -type Drop struct{} // Drop has no parameters. - -var _ Aggregation = Drop{} - -func (Drop) private() {} - -// Copy returns a deep copy of d. -func (d Drop) Copy() Aggregation { return d } - -// Err returns an error for any misconfiguration. A Drop aggregation has no -// parameters and cannot be misconfigured, therefore this always returns nil. -func (Drop) Err() error { return nil } - -// Default is an aggregation that uses the default instrument kind selection -// mapping to select another aggregation. A metric reader can be configured to -// make an aggregation selection based on instrument kind that differs from -// the default. This aggregation ensures the default is used. -// -// See the "go.opentelemetry.io/otel/sdk/metric".DefaultAggregationSelector -// for information about the default instrument kind selection mapping. -type Default struct{} // Default has no parameters. - -var _ Aggregation = Default{} - -func (Default) private() {} - -// Copy returns a deep copy of d. -func (d Default) Copy() Aggregation { return d } - -// Err returns an error for any misconfiguration. A Default aggregation has no -// parameters and cannot be misconfigured, therefore this always returns nil. -func (Default) Err() error { return nil } - -// Sum is an aggregation that summarizes a set of measurements as their -// arithmetic sum. -type Sum struct{} // Sum has no parameters. - -var _ Aggregation = Sum{} - -func (Sum) private() {} - -// Copy returns a deep copy of s. -func (s Sum) Copy() Aggregation { return s } - -// Err returns an error for any misconfiguration. A Sum aggregation has no -// parameters and cannot be misconfigured, therefore this always returns nil. -func (Sum) Err() error { return nil } - -// LastValue is an aggregation that summarizes a set of measurements as the -// last one made. -type LastValue struct{} // LastValue has no parameters. - -var _ Aggregation = LastValue{} - -func (LastValue) private() {} - -// Copy returns a deep copy of l. -func (l LastValue) Copy() Aggregation { return l } - -// Err returns an error for any misconfiguration. A LastValue aggregation has -// no parameters and cannot be misconfigured, therefore this always returns -// nil. -func (LastValue) Err() error { return nil } - -// ExplicitBucketHistogram is an aggregation that summarizes a set of -// measurements as an histogram with explicitly defined buckets. -type ExplicitBucketHistogram struct { - // Boundaries are the increasing bucket boundary values. Boundary values - // define bucket upper bounds. Buckets are exclusive of their lower - // boundary and inclusive of their upper bound (except at positive - // infinity). A measurement is defined to fall into the greatest-numbered - // bucket with a boundary that is greater than or equal to the - // measurement. As an example, boundaries defined as: - // - // []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000} - // - // Will define these buckets: - // - // (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, 25.0], (25.0, 50.0], - // (50.0, 75.0], (75.0, 100.0], (100.0, 250.0], (250.0, 500.0], - // (500.0, 1000.0], (1000.0, +∞) - Boundaries []float64 - // NoMinMax indicates whether to not record the min and max of the - // distribution. By default, these extrema are recorded. - // - // Recording these extrema for cumulative data is expected to have little - // value, they will represent the entire life of the instrument instead of - // just the current collection cycle. It is recommended to set this to true - // for that type of data to avoid computing the low-value extrema. - NoMinMax bool -} - -var _ Aggregation = ExplicitBucketHistogram{} - -func (ExplicitBucketHistogram) private() {} - -// errHist is returned by misconfigured ExplicitBucketHistograms. -var errHist = fmt.Errorf("%w: explicit bucket histogram", errAgg) - -// Err returns an error for any misconfiguration. -func (h ExplicitBucketHistogram) Err() error { - if len(h.Boundaries) <= 1 { - return nil - } - - // Check boundaries are monotonic. - i := h.Boundaries[0] - for _, j := range h.Boundaries[1:] { - if i >= j { - return fmt.Errorf("%w: non-monotonic boundaries: %v", errHist, h.Boundaries) - } - i = j - } - - return nil -} - -// Copy returns a deep copy of h. -func (h ExplicitBucketHistogram) Copy() Aggregation { - b := make([]float64, len(h.Boundaries)) - copy(b, h.Boundaries) - return ExplicitBucketHistogram{ - Boundaries: b, - NoMinMax: h.NoMinMax, - } -} - -// Base2ExponentialHistogram is an aggregation that summarizes a set of -// measurements as an histogram with bucket widths that grow exponentially. -type Base2ExponentialHistogram struct { - // MaxSize is the maximum number of buckets to use for the histogram. - MaxSize int32 - // MaxScale is the maximum resolution scale to use for the histogram. - // - // MaxScale has a maximum value of 20. Using a value of 20 means the - // maximum number of buckets that can fit within the range of a - // signed 32-bit integer index could be used. - // - // MaxScale has a minimum value of -10. Using a value of -10 means only - // two buckets will be use. - MaxScale int32 - - // NoMinMax indicates whether to not record the min and max of the - // distribution. By default, these extrema are recorded. - // - // Recording these extrema for cumulative data is expected to have little - // value, they will represent the entire life of the instrument instead of - // just the current collection cycle. It is recommended to set this to true - // for that type of data to avoid computing the low-value extrema. - NoMinMax bool -} - -var _ Aggregation = Base2ExponentialHistogram{} - -// private attempts to ensure no user-defined Aggregation is allowed. The -// OTel specification does not allow user-defined Aggregation currently. -func (e Base2ExponentialHistogram) private() {} - -// Copy returns a deep copy of the Aggregation. -func (e Base2ExponentialHistogram) Copy() Aggregation { - return e -} - -const ( - expoMaxScale = 20 - expoMinScale = -10 -) - -// errExpoHist is returned by misconfigured Base2ExponentialBucketHistograms. -var errExpoHist = fmt.Errorf("%w: exponential histogram", errAgg) - -// Err returns an error for any misconfigured Aggregation. -func (e Base2ExponentialHistogram) Err() error { - if e.MaxScale > expoMaxScale { - return fmt.Errorf("%w: max size %d is greater than maximum scale %d", errExpoHist, e.MaxSize, expoMaxScale) - } - if e.MaxSize <= 0 { - return fmt.Errorf("%w: max size %d is less than or equal to zero", errExpoHist, e.MaxSize) - } - return nil -} diff --git a/sdk/metric/aggregation/aggregation_test.go b/sdk/metric/aggregation/aggregation_test.go deleted file mode 100644 index 15bc37f2500..00000000000 --- a/sdk/metric/aggregation/aggregation_test.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package aggregation - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestAggregationErr(t *testing.T) { - t.Run("DropOperation", func(t *testing.T) { - assert.NoError(t, Drop{}.Err()) - }) - - t.Run("SumOperation", func(t *testing.T) { - assert.NoError(t, Sum{}.Err()) - }) - - t.Run("LastValueOperation", func(t *testing.T) { - assert.NoError(t, LastValue{}.Err()) - }) - - t.Run("ExplicitBucketHistogramOperation", func(t *testing.T) { - assert.NoError(t, ExplicitBucketHistogram{}.Err()) - - assert.NoError(t, ExplicitBucketHistogram{ - Boundaries: []float64{0}, - NoMinMax: true, - }.Err()) - - assert.NoError(t, ExplicitBucketHistogram{ - Boundaries: []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 1000}, - }.Err()) - }) - - t.Run("NonmonotonicHistogramBoundaries", func(t *testing.T) { - assert.ErrorIs(t, ExplicitBucketHistogram{ - Boundaries: []float64{2, 1}, - }.Err(), errAgg) - - assert.ErrorIs(t, ExplicitBucketHistogram{ - Boundaries: []float64{0, 1, 2, 1, 3, 4}, - }.Err(), errAgg) - }) - - t.Run("ExponentialHistogramOperation", func(t *testing.T) { - assert.NoError(t, Base2ExponentialHistogram{ - MaxSize: 160, - MaxScale: 20, - }.Err()) - - assert.NoError(t, Base2ExponentialHistogram{ - MaxSize: 1, - NoMinMax: true, - }.Err()) - - assert.NoError(t, Base2ExponentialHistogram{ - MaxSize: 1024, - MaxScale: -3, - }.Err()) - }) - - t.Run("InvalidExponentialHistogramOperation", func(t *testing.T) { - // MazSize must be greater than 0 - assert.ErrorIs(t, Base2ExponentialHistogram{}.Err(), errAgg) - - // MaxScale Must be <=20 - assert.ErrorIs(t, Base2ExponentialHistogram{ - MaxSize: 1, - MaxScale: 30, - }.Err(), errAgg) - }) -} - -func TestExplicitBucketHistogramDeepCopy(t *testing.T) { - const orig = 0.0 - b := []float64{orig} - h := ExplicitBucketHistogram{Boundaries: b} - cpH := h.Copy().(ExplicitBucketHistogram) - b[0] = orig + 1 - assert.Equal(t, orig, cpH.Boundaries[0], "changing the underlying slice data should not affect the copy") -} From e528731853fea898ddf5fd635bcf79ebf26462dc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 29 Aug 2023 14:08:07 -0700 Subject: [PATCH 677/886] Remove the deprecated internal `exporters/otlp*` packages (#4469) * Remove the deprecated otlpmetric/internal pkg * Remove the deprecated otlp/internal pkg * Remove the deprecated otlptrace/internal pkg * Remove the deprecated otlptrace/internal/envconfig pkg * Remove the deprecated otlptrace/internal/otlpconfig pkg * Remove the deprecated otlptrace/internal/otlptracetest pkg * Remove the deprecated otlptrace/internal/retry pkg * Add changelog entry * Remove dependabot entries * Remove versions.yaml entry * Run go mod tidy * Remove linter override for removed pkgs * Run crosslink --- .github/dependabot.yml | 9 - .golangci.yml | 5 - CHANGELOG.md | 5 +- exporters/otlp/internal/config.go | 37 -- exporters/otlp/internal/config_test.go | 83 --- exporters/otlp/internal/envconfig/doc.go | 20 - .../otlp/internal/envconfig/envconfig.go | 199 ------ .../otlp/internal/envconfig/envconfig_test.go | 461 ------------- exporters/otlp/internal/partialsuccess.go | 64 -- .../otlp/internal/partialsuccess_test.go | 43 -- exporters/otlp/internal/retry/go.mod | 16 - exporters/otlp/internal/retry/go.sum | 12 - exporters/otlp/internal/retry/retry.go | 156 ----- exporters/otlp/internal/retry/retry_test.go | 258 -------- exporters/otlp/internal/wrappederror.go | 61 -- exporters/otlp/internal/wrappederror_test.go | 32 - exporters/otlp/otlpmetric/go.mod | 39 +- exporters/otlp/otlpmetric/go.sum | 43 +- exporters/otlp/otlpmetric/internal/client.go | 57 -- .../otlp/otlpmetric/internal/exporter.go | 136 ---- .../otlp/otlpmetric/internal/exporter_test.go | 97 --- exporters/otlp/otlpmetric/internal/header.go | 25 - .../otlp/otlpmetric/internal/header_test.go | 25 - .../otlpmetric/internal/oconf/envconfig.go | 193 ------ .../internal/oconf/envconfig_test.go | 103 --- .../otlp/otlpmetric/internal/oconf/options.go | 345 ---------- .../otlpmetric/internal/oconf/options_test.go | 465 ------------- .../otlpmetric/internal/oconf/optiontypes.go | 55 -- .../otlp/otlpmetric/internal/oconf/tls.go | 46 -- .../otlp/otlpmetric/internal/otest/client.go | 334 ---------- .../otlpmetric/internal/otest/client_test.go | 75 --- .../otlpmetric/internal/otest/collector.go | 440 ------------- .../internal/transform/attribute.go | 152 ----- .../internal/transform/attribute_test.go | 194 ------ .../otlp/otlpmetric/internal/transform/doc.go | 20 - .../otlpmetric/internal/transform/error.go | 111 ---- .../internal/transform/error_test.go | 88 --- .../internal/transform/metricdata.go | 287 -------- .../internal/transform/metricdata_test.go | 610 ------------------ .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 3 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 2 + .../otlp/otlpmetric/otlpmetrichttp/go.mod | 3 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 2 + exporters/otlp/otlptrace/go.mod | 11 +- exporters/otlp/otlptrace/go.sum | 26 +- exporters/otlp/otlptrace/internal/doc.go | 19 - .../otlp/otlptrace/internal/envconfig/doc.go | 20 - .../otlptrace/internal/envconfig/envconfig.go | 199 ------ .../internal/envconfig/envconfig_test.go | 461 ------------- exporters/otlp/otlptrace/internal/header.go | 25 - .../otlp/otlptrace/internal/header_test.go | 25 - .../otlp/otlptrace/internal/otlpconfig/doc.go | 20 - .../internal/otlpconfig/envconfig.go | 150 ----- .../internal/otlpconfig/envconfig_test.go | 15 - .../otlptrace/internal/otlpconfig/options.go | 325 ---------- .../internal/otlpconfig/options_test.go | 486 -------------- .../internal/otlpconfig/optiontypes.go | 48 -- .../otlp/otlptrace/internal/otlpconfig/tls.go | 34 - .../internal/otlptracetest/client.go | 133 ---- .../internal/otlptracetest/collector.go | 103 --- .../otlptrace/internal/otlptracetest/data.go | 63 -- .../otlptrace/internal/otlptracetest/doc.go | 20 - .../internal/otlptracetest/otlptest.go | 125 ---- .../otlp/otlptrace/internal/retry/retry.go | 156 ----- .../otlptrace/internal/retry/retry_test.go | 258 -------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 1 + exporters/otlp/otlptrace/otlptracegrpc/go.sum | 2 + exporters/otlp/otlptrace/otlptracehttp/go.mod | 1 + exporters/otlp/otlptrace/otlptracehttp/go.sum | 2 + versions.yaml | 1 - 70 files changed, 34 insertions(+), 8106 deletions(-) delete mode 100644 exporters/otlp/internal/config.go delete mode 100644 exporters/otlp/internal/config_test.go delete mode 100644 exporters/otlp/internal/envconfig/doc.go delete mode 100644 exporters/otlp/internal/envconfig/envconfig.go delete mode 100644 exporters/otlp/internal/envconfig/envconfig_test.go delete mode 100644 exporters/otlp/internal/partialsuccess.go delete mode 100644 exporters/otlp/internal/partialsuccess_test.go delete mode 100644 exporters/otlp/internal/retry/go.mod delete mode 100644 exporters/otlp/internal/retry/go.sum delete mode 100644 exporters/otlp/internal/retry/retry.go delete mode 100644 exporters/otlp/internal/retry/retry_test.go delete mode 100644 exporters/otlp/internal/wrappederror.go delete mode 100644 exporters/otlp/internal/wrappederror_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/client.go delete mode 100644 exporters/otlp/otlpmetric/internal/exporter.go delete mode 100644 exporters/otlp/otlpmetric/internal/exporter_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/header.go delete mode 100644 exporters/otlp/otlpmetric/internal/header_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/envconfig.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/options.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/options_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/optiontypes.go delete mode 100644 exporters/otlp/otlpmetric/internal/oconf/tls.go delete mode 100644 exporters/otlp/otlpmetric/internal/otest/client.go delete mode 100644 exporters/otlp/otlpmetric/internal/otest/client_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/otest/collector.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/attribute.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/attribute_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/doc.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/error.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/error_test.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/metricdata.go delete mode 100644 exporters/otlp/otlpmetric/internal/transform/metricdata_test.go delete mode 100644 exporters/otlp/otlptrace/internal/doc.go delete mode 100644 exporters/otlp/otlptrace/internal/envconfig/doc.go delete mode 100644 exporters/otlp/otlptrace/internal/envconfig/envconfig.go delete mode 100644 exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go delete mode 100644 exporters/otlp/otlptrace/internal/header.go delete mode 100644 exporters/otlp/otlptrace/internal/header_test.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/doc.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/options.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/options_test.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go delete mode 100644 exporters/otlp/otlptrace/internal/otlpconfig/tls.go delete mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/client.go delete mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/collector.go delete mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/data.go delete mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/doc.go delete mode 100644 exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go delete mode 100644 exporters/otlp/otlptrace/internal/retry/retry.go delete mode 100644 exporters/otlp/otlptrace/internal/retry/retry_test.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 81e039fdf5d..555decd4daf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -136,15 +136,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /exporters/otlp/internal/retry - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlpmetric labels: diff --git a/.golangci.yml b/.golangci.yml index 61782fbf0dd..6e8eeec00fa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -76,11 +76,6 @@ linters-settings: otlp-internal: files: - "!**/exporters/otlp/internal/**/*.go" - # TODO: remove the following when otlpmetric/internal is removed. - - "!**/exporters/otlp/otlpmetric/internal/oconf/envconfig.go" - - "!**/exporters/otlp/otlpmetric/internal/oconf/options.go" - - "!**/exporters/otlp/otlpmetric/internal/oconf/options_test.go" - - "!**/exporters/otlp/otlpmetric/internal/otest/client_test.go" deny: - pkg: "go.opentelemetry.io/otel/exporters/otlp/internal" desc: Do not use cross-module internal packages. diff --git a/CHANGELOG.md b/CHANGELOG.md index de2bcbd2da5..6b5eb947ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Removed -- Remove the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) -- Remove the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) +- Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) - Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) +- Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) ## [1.17.0/0.40.0/0.0.5] 2023-08-28 diff --git a/exporters/otlp/internal/config.go b/exporters/otlp/internal/config.go deleted file mode 100644 index d0998fb1d04..00000000000 --- a/exporters/otlp/internal/config.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package internal contains common functionality for all OTLP exporters. -// -// Deprecated: package internal exists for historical compatibility, it should -// not be used. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -import ( - "fmt" - "path" - "strings" -) - -// CleanPath returns a path with all spaces trimmed and all redundancies removed. If urlPath is empty or cleaning it results in an empty string, defaultPath is returned instead. -func CleanPath(urlPath string, defaultPath string) string { - tmp := path.Clean(strings.TrimSpace(urlPath)) - if tmp == "." { - return defaultPath - } - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - return tmp -} diff --git a/exporters/otlp/internal/config_test.go b/exporters/otlp/internal/config_test.go deleted file mode 100644 index 92a819a1f2b..00000000000 --- a/exporters/otlp/internal/config_test.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import "testing" - -func TestCleanPath(t *testing.T) { - type args struct { - urlPath string - defaultPath string - } - tests := []struct { - name string - args args - want string - }{ - { - name: "clean empty path", - args: args{ - urlPath: "", - defaultPath: "DefaultPath", - }, - want: "DefaultPath", - }, - { - name: "clean metrics path", - args: args{ - urlPath: "/prefix/v1/metrics", - defaultPath: "DefaultMetricsPath", - }, - want: "/prefix/v1/metrics", - }, - { - name: "clean traces path", - args: args{ - urlPath: "https://env_endpoint", - defaultPath: "DefaultTracesPath", - }, - want: "/https:/env_endpoint", - }, - { - name: "spaces trimmed", - args: args{ - urlPath: " /dir", - }, - want: "/dir", - }, - { - name: "clean path empty", - args: args{ - urlPath: "dir/..", - defaultPath: "DefaultTracesPath", - }, - want: "DefaultTracesPath", - }, - { - name: "make absolute", - args: args{ - urlPath: "dir/a", - }, - want: "/dir/a", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := CleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { - t.Errorf("CleanPath() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/exporters/otlp/internal/envconfig/doc.go b/exporters/otlp/internal/envconfig/doc.go deleted file mode 100644 index 327794a5bea..00000000000 --- a/exporters/otlp/internal/envconfig/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package envconfig contains common functionality for all OTLP exporter -// configuration. -// -// Deprecated: package envconfig exists for historical compatibility, it should -// not be used. -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" diff --git a/exporters/otlp/internal/envconfig/envconfig.go b/exporters/otlp/internal/envconfig/envconfig.go deleted file mode 100644 index 444eefbb388..00000000000 --- a/exporters/otlp/internal/envconfig/envconfig.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "net/url" - "strconv" - "strings" - "time" - - "go.opentelemetry.io/otel/internal/global" -) - -// ConfigFn is the generic function used to set a config. -type ConfigFn func(*EnvOptionsReader) - -// EnvOptionsReader reads the required environment variables. -type EnvOptionsReader struct { - GetEnv func(string) string - ReadFile func(string) ([]byte, error) - Namespace string -} - -// Apply runs every ConfigFn. -func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { - for _, o := range opts { - o(e) - } -} - -// GetEnvValue gets an OTLP environment variable value of the specified key -// using the GetEnv function. -// This function prepends the OTLP specified namespace to all key lookups. -func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { - v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) - return v, v != "" -} - -// WithString retrieves the specified config and passes it to ConfigFn as a string. -func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - fn(v) - } - } -} - -// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. -func WithBool(n string, fn func(bool)) ConfigFn { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - b := strings.ToLower(v) == "true" - fn(b) - } - } -} - -// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. -func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - d, err := strconv.Atoi(v) - if err != nil { - global.Error(err, "parse duration", "input", v) - return - } - fn(time.Duration(d) * time.Millisecond) - } - } -} - -// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. -func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - fn(stringToHeader(v)) - } - } -} - -// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. -func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - u, err := url.Parse(v) - if err != nil { - global.Error(err, "parse url", "input", v) - return - } - fn(u) - } - } -} - -// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. -func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - b, err := e.ReadFile(v) - if err != nil { - global.Error(err, "read tls ca cert file", "file", v) - return - } - c, err := createCertPool(b) - if err != nil { - global.Error(err, "create tls cert pool") - return - } - fn(c) - } - } -} - -// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. -func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { - return func(e *EnvOptionsReader) { - vc, okc := e.GetEnvValue(nc) - vk, okk := e.GetEnvValue(nk) - if !okc || !okk { - return - } - cert, err := e.ReadFile(vc) - if err != nil { - global.Error(err, "read tls client cert", "file", vc) - return - } - key, err := e.ReadFile(vk) - if err != nil { - global.Error(err, "read tls client key", "file", vk) - return - } - crt, err := tls.X509KeyPair(cert, key) - if err != nil { - global.Error(err, "create tls client key pair") - return - } - fn(crt) - } -} - -func keyWithNamespace(ns, key string) string { - if ns == "" { - return key - } - return fmt.Sprintf("%s_%s", ns, key) -} - -func stringToHeader(value string) map[string]string { - headersPairs := strings.Split(value, ",") - headers := make(map[string]string) - - for _, header := range headersPairs { - n, v, found := strings.Cut(header, "=") - if !found { - global.Error(errors.New("missing '="), "parse headers", "input", header) - continue - } - name, err := url.QueryUnescape(n) - if err != nil { - global.Error(err, "escape header key", "key", n) - continue - } - trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) - if err != nil { - global.Error(err, "escape header value", "value", v) - continue - } - trimmedValue := strings.TrimSpace(value) - - headers[trimmedName] = trimmedValue - } - - return headers -} - -func createCertPool(certBytes []byte) (*x509.CertPool, error) { - cp := x509.NewCertPool() - if ok := cp.AppendCertsFromPEM(certBytes); !ok { - return nil, errors.New("failed to append certificate to the cert pool") - } - return cp, nil -} diff --git a/exporters/otlp/internal/envconfig/envconfig_test.go b/exporters/otlp/internal/envconfig/envconfig_test.go deleted file mode 100644 index eb2ab8a6806..00000000000 --- a/exporters/otlp/internal/envconfig/envconfig_test.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -const WeakKey = ` ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 -AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB -2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== ------END EC PRIVATE KEY----- -` - -const WeakCertificate = ` ------BEGIN CERTIFICATE----- -MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw -EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 -MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC -AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy -Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK -SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ -BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg -Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu -jVcIxYQqhId5L8p/mAv2PWZS ------END CERTIFICATE----- -` - -type testOption struct { - TestString string - TestBool bool - TestDuration time.Duration - TestHeaders map[string]string - TestURL *url.URL - TestTLS *tls.Config -} - -func TestEnvConfig(t *testing.T) { - parsedURL, err := url.Parse("https://example.com") - assert.NoError(t, err) - - options := []testOption{} - for _, testcase := range []struct { - name string - reader EnvOptionsReader - configs []ConfigFn - expectedOptions []testOption - }{ - { - name: "with no namespace and a matching key", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{ - { - TestString: "world", - }, - }, - }, - { - name: "with no namespace and a non-matching key", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HOLA", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with a namespace and a matching key", - reader: EnvOptionsReader{ - Namespace: "MY_NAMESPACE", - GetEnv: func(n string) string { - if n == "MY_NAMESPACE_HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{ - { - TestString: "world", - }, - }, - }, - { - name: "with no namespace and a non-matching key", - reader: EnvOptionsReader{ - Namespace: "MY_NAMESPACE", - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with a bool config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "true" - } else if n == "WORLD" { - return "false" - } - return "" - }, - }, - configs: []ConfigFn{ - WithBool("HELLO", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - WithBool("WORLD", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - }, - expectedOptions: []testOption{ - { - TestBool: true, - }, - { - TestBool: false, - }, - }, - }, - { - name: "with an invalid bool config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithBool("HELLO", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - }, - expectedOptions: []testOption{ - { - TestBool: false, - }, - }, - }, - { - name: "with a duration config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "60" - } - return "" - }, - }, - configs: []ConfigFn{ - WithDuration("HELLO", func(v time.Duration) { - options = append(options, testOption{TestDuration: v}) - }), - }, - expectedOptions: []testOption{ - { - TestDuration: 60_000_000, // 60 milliseconds - }, - }, - }, - { - name: "with an invalid duration config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithDuration("HELLO", func(v time.Duration) { - options = append(options, testOption{TestDuration: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with headers", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "userId=42,userName=alice" - } - return "" - }, - }, - configs: []ConfigFn{ - WithHeaders("HELLO", func(v map[string]string) { - options = append(options, testOption{TestHeaders: v}) - }), - }, - expectedOptions: []testOption{ - { - TestHeaders: map[string]string{ - "userId": "42", - "userName": "alice", - }, - }, - }, - }, - { - name: "with invalid headers", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithHeaders("HELLO", func(v map[string]string) { - options = append(options, testOption{TestHeaders: v}) - }), - }, - expectedOptions: []testOption{ - { - TestHeaders: map[string]string{}, - }, - }, - }, - { - name: "with URL", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "https://example.com" - } - return "" - }, - }, - configs: []ConfigFn{ - WithURL("HELLO", func(v *url.URL) { - options = append(options, testOption{TestURL: v}) - }), - }, - expectedOptions: []testOption{ - { - TestURL: parsedURL, - }, - }, - }, - { - name: "with invalid URL", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "i nvalid://url" - } - return "" - }, - }, - configs: []ConfigFn{ - WithURL("HELLO", func(v *url.URL) { - options = append(options, testOption{TestURL: v}) - }), - }, - expectedOptions: []testOption{}, - }, - } { - t.Run(testcase.name, func(t *testing.T) { - testcase.reader.Apply(testcase.configs...) - assert.Equal(t, testcase.expectedOptions, options) - options = []testOption{} - }) - } -} - -func TestWithTLSConfig(t *testing.T) { - pool, err := createCertPool([]byte(WeakCertificate)) - assert.NoError(t, err) - - reader := EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "CERTIFICATE" { - return "/path/cert.pem" - } - return "" - }, - ReadFile: func(p string) ([]byte, error) { - if p == "/path/cert.pem" { - return []byte(WeakCertificate), nil - } - return []byte{}, nil - }, - } - - var option testOption - reader.Apply( - WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { - option = testOption{TestTLS: &tls.Config{RootCAs: cp}} - }), - ) - - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) -} - -func TestWithClientCert(t *testing.T) { - cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) - assert.NoError(t, err) - - reader := EnvOptionsReader{ - GetEnv: func(n string) string { - switch n { - case "CLIENT_CERTIFICATE": - return "/path/tls.crt" - case "CLIENT_KEY": - return "/path/tls.key" - } - return "" - }, - ReadFile: func(n string) ([]byte, error) { - switch n { - case "/path/tls.crt": - return []byte(WeakCertificate), nil - case "/path/tls.key": - return []byte(WeakKey), nil - } - return []byte{}, nil - }, - } - - var option testOption - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Equal(t, cert, option.TestTLS.Certificates[0]) - - reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } - option.TestTLS = nil - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Nil(t, option.TestTLS) - - reader.GetEnv = func(s string) string { return "" } - option.TestTLS = nil - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Nil(t, option.TestTLS) -} - -func TestStringToHeader(t *testing.T) { - tests := []struct { - name string - value string - want map[string]string - }{ - { - name: "simple test", - value: "userId=alice", - want: map[string]string{"userId": "alice"}, - }, - { - name: "simple test with spaces", - value: " userId = alice ", - want: map[string]string{"userId": "alice"}, - }, - { - name: "multiples headers encoded", - value: "userId=alice,serverNode=DF%3A28,isProduction=false", - want: map[string]string{ - "userId": "alice", - "serverNode": "DF:28", - "isProduction": "false", - }, - }, - { - name: "invalid headers format", - value: "userId:alice", - want: map[string]string{}, - }, - { - name: "invalid key", - value: "%XX=missing,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - { - name: "invalid value", - value: "missing=%XX,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.want, stringToHeader(tt.value)) - }) - } -} diff --git a/exporters/otlp/internal/partialsuccess.go b/exporters/otlp/internal/partialsuccess.go deleted file mode 100644 index 9ab89b37574..00000000000 --- a/exporters/otlp/internal/partialsuccess.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -import "fmt" - -// PartialSuccess represents the underlying error for all handling -// OTLP partial success messages. Use `errors.Is(err, -// PartialSuccess{})` to test whether an error passed to the OTel -// error handler belongs to this category. -type PartialSuccess struct { - ErrorMessage string - RejectedItems int64 - RejectedKind string -} - -var _ error = PartialSuccess{} - -// Error implements the error interface. -func (ps PartialSuccess) Error() string { - msg := ps.ErrorMessage - if msg == "" { - msg = "empty message" - } - return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) -} - -// Is supports the errors.Is() interface. -func (ps PartialSuccess) Is(err error) bool { - _, ok := err.(PartialSuccess) - return ok -} - -// TracePartialSuccessError returns an error describing a partial success -// response for the trace signal. -func TracePartialSuccessError(itemsRejected int64, errorMessage string) error { - return PartialSuccess{ - ErrorMessage: errorMessage, - RejectedItems: itemsRejected, - RejectedKind: "spans", - } -} - -// MetricPartialSuccessError returns an error describing a partial success -// response for the metric signal. -func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error { - return PartialSuccess{ - ErrorMessage: errorMessage, - RejectedItems: itemsRejected, - RejectedKind: "metric data points", - } -} diff --git a/exporters/otlp/internal/partialsuccess_test.go b/exporters/otlp/internal/partialsuccess_test.go deleted file mode 100644 index 9032f244cc4..00000000000 --- a/exporters/otlp/internal/partialsuccess_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -import ( - "errors" - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -func requireErrorString(t *testing.T, expect string, err error) { - t.Helper() - require.NotNil(t, err) - require.Error(t, err) - require.True(t, errors.Is(err, PartialSuccess{})) - - const pfx = "OTLP partial success: " - - msg := err.Error() - require.True(t, strings.HasPrefix(msg, pfx)) - require.Equal(t, expect, msg[len(pfx):]) -} - -func TestPartialSuccessFormat(t *testing.T) { - requireErrorString(t, "empty message (0 metric data points rejected)", MetricPartialSuccessError(0, "")) - requireErrorString(t, "help help (0 metric data points rejected)", MetricPartialSuccessError(0, "help help")) - requireErrorString(t, "what happened (10 metric data points rejected)", MetricPartialSuccessError(10, "what happened")) - requireErrorString(t, "what happened (15 spans rejected)", TracePartialSuccessError(15, "what happened")) -} diff --git a/exporters/otlp/internal/retry/go.mod b/exporters/otlp/internal/retry/go.mod deleted file mode 100644 index 1f9fec184df..00000000000 --- a/exporters/otlp/internal/retry/go.mod +++ /dev/null @@ -1,16 +0,0 @@ -// Deprecated: package retry exists for historical compatibility, it should not -// be used. -module go.opentelemetry.io/otel/exporters/otlp/internal/retry - -go 1.19 - -require ( - github.com/cenkalti/backoff/v4 v4.2.1 - github.com/stretchr/testify v1.8.4 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/exporters/otlp/internal/retry/go.sum b/exporters/otlp/internal/retry/go.sum deleted file mode 100644 index 987eed906b6..00000000000 --- a/exporters/otlp/internal/retry/go.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/internal/retry/retry.go b/exporters/otlp/internal/retry/retry.go deleted file mode 100644 index 94c4af0e562..00000000000 --- a/exporters/otlp/internal/retry/retry.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package retry provides request retry functionality that can perform -// configurable exponential backoff for transient errors and honor any -// explicit throttle responses received. -// -// Deprecated: package retry exists for historical compatibility, it should not -// be used. -package retry // import "go.opentelemetry.io/otel/exporters/otlp/internal/retry" - -import ( - "context" - "fmt" - "time" - - "github.com/cenkalti/backoff/v4" -) - -// DefaultConfig are the recommended defaults to use. -var DefaultConfig = Config{ - Enabled: true, - InitialInterval: 5 * time.Second, - MaxInterval: 30 * time.Second, - MaxElapsedTime: time.Minute, -} - -// Config defines configuration for retrying batches in case of export failure -// using an exponential backoff. -type Config struct { - // Enabled indicates whether to not retry sending batches in case of - // export failure. - Enabled bool - // InitialInterval the time to wait after the first failure before - // retrying. - InitialInterval time.Duration - // MaxInterval is the upper bound on backoff interval. Once this value is - // reached the delay between consecutive retries will always be - // `MaxInterval`. - MaxInterval time.Duration - // MaxElapsedTime is the maximum amount of time (including retries) spent - // trying to send a request/batch. Once this value is reached, the data - // is discarded. - MaxElapsedTime time.Duration -} - -// RequestFunc wraps a request with retry logic. -type RequestFunc func(context.Context, func(context.Context) error) error - -// EvaluateFunc returns if an error is retry-able and if an explicit throttle -// duration should be honored that was included in the error. -// -// The function must return true if the error argument is retry-able, -// otherwise it must return false for the first return parameter. -// -// The function must return a non-zero time.Duration if the error contains -// explicit throttle duration that should be honored, otherwise it must return -// a zero valued time.Duration. -type EvaluateFunc func(error) (bool, time.Duration) - -// RequestFunc returns a RequestFunc using the evaluate function to determine -// if requests can be retried and based on the exponential backoff -// configuration of c. -func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { - if !c.Enabled { - return func(ctx context.Context, fn func(context.Context) error) error { - return fn(ctx) - } - } - - return func(ctx context.Context, fn func(context.Context) error) error { - // Do not use NewExponentialBackOff since it calls Reset and the code here - // must call Reset after changing the InitialInterval (this saves an - // unnecessary call to Now). - b := &backoff.ExponentialBackOff{ - InitialInterval: c.InitialInterval, - RandomizationFactor: backoff.DefaultRandomizationFactor, - Multiplier: backoff.DefaultMultiplier, - MaxInterval: c.MaxInterval, - MaxElapsedTime: c.MaxElapsedTime, - Stop: backoff.Stop, - Clock: backoff.SystemClock, - } - b.Reset() - - for { - err := fn(ctx) - if err == nil { - return nil - } - - retryable, throttle := evaluate(err) - if !retryable { - return err - } - - bOff := b.NextBackOff() - if bOff == backoff.Stop { - return fmt.Errorf("max retry time elapsed: %w", err) - } - - // Wait for the greater of the backoff or throttle delay. - var delay time.Duration - if bOff > throttle { - delay = bOff - } else { - elapsed := b.GetElapsedTime() - if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { - return fmt.Errorf("max retry time would elapse: %w", err) - } - delay = throttle - } - - if ctxErr := waitFunc(ctx, delay); ctxErr != nil { - return fmt.Errorf("%w: %s", ctxErr, err) - } - } - } -} - -// Allow override for testing. -var waitFunc = wait - -// wait takes the caller's context, and the amount of time to wait. It will -// return nil if the timer fires before or at the same time as the context's -// deadline. This indicates that the call can be retried. -func wait(ctx context.Context, delay time.Duration) error { - timer := time.NewTimer(delay) - defer timer.Stop() - - select { - case <-ctx.Done(): - // Handle the case where the timer and context deadline end - // simultaneously by prioritizing the timer expiration nil value - // response. - select { - case <-timer.C: - default: - return ctx.Err() - } - case <-timer.C: - } - - return nil -} diff --git a/exporters/otlp/internal/retry/retry_test.go b/exporters/otlp/internal/retry/retry_test.go deleted file mode 100644 index de574a73579..00000000000 --- a/exporters/otlp/internal/retry/retry_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package retry - -import ( - "context" - "errors" - "math" - "sync" - "testing" - "time" - - "github.com/cenkalti/backoff/v4" - "github.com/stretchr/testify/assert" -) - -func TestWait(t *testing.T) { - tests := []struct { - ctx context.Context - delay time.Duration - expected error - }{ - { - ctx: context.Background(), - delay: time.Duration(0), - }, - { - ctx: context.Background(), - delay: time.Duration(1), - }, - { - ctx: context.Background(), - delay: time.Duration(-1), - }, - { - ctx: func() context.Context { - ctx, cancel := context.WithCancel(context.Background()) - cancel() - return ctx - }(), - // Ensure the timer and context do not end simultaneously. - delay: 1 * time.Hour, - expected: context.Canceled, - }, - } - - for _, test := range tests { - err := wait(test.ctx, test.delay) - if test.expected == nil { - assert.NoError(t, err) - } else { - assert.ErrorIs(t, err, test.expected) - } - } -} - -func TestNonRetryableError(t *testing.T) { - ev := func(error) (bool, time.Duration) { return false, 0 } - - reqFunc := Config{ - Enabled: true, - InitialInterval: 1 * time.Nanosecond, - MaxInterval: 1 * time.Nanosecond, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - ctx := context.Background() - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - return nil - })) - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }), assert.AnError) -} - -func TestThrottledRetry(t *testing.T) { - // Ensure the throttle delay is used by making longer than backoff delay. - throttleDelay, backoffDelay := time.Second, time.Nanosecond - - ev := func(error) (bool, time.Duration) { - // Retry everything with a throttle delay. - return true, throttleDelay - } - - reqFunc := Config{ - Enabled: true, - InitialInterval: backoffDelay, - MaxInterval: backoffDelay, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - - origWait := waitFunc - var done bool - waitFunc = func(_ context.Context, delay time.Duration) error { - assert.Equal(t, throttleDelay, delay, "retry not throttled") - // Try twice to ensure call is attempted again after delay. - if done { - return assert.AnError - } - done = true - return nil - } - defer func() { waitFunc = origWait }() - - ctx := context.Background() - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return errors.New("not this error") - }), assert.AnError) -} - -func TestBackoffRetry(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - - delay := time.Nanosecond - reqFunc := Config{ - Enabled: true, - InitialInterval: delay, - MaxInterval: delay, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - - origWait := waitFunc - var done bool - waitFunc = func(_ context.Context, d time.Duration) error { - delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) - assert.InDelta(t, delay, d, delta, "retry not backoffed") - // Try twice to ensure call is attempted again after delay. - if done { - return assert.AnError - } - done = true - return nil - } - t.Cleanup(func() { waitFunc = origWait }) - - ctx := context.Background() - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return errors.New("not this error") - }), assert.AnError) -} - -func TestBackoffRetryCanceledContext(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - - delay := time.Millisecond - reqFunc := Config{ - Enabled: true, - InitialInterval: delay, - MaxInterval: delay, - // Never stop retrying. - MaxElapsedTime: 10 * time.Millisecond, - }.RequestFunc(ev) - - ctx, cancel := context.WithCancel(context.Background()) - count := 0 - cancel() - err := reqFunc(ctx, func(context.Context) error { - count++ - return assert.AnError - }) - - assert.ErrorIs(t, err, context.Canceled) - assert.Contains(t, err.Error(), assert.AnError.Error()) - assert.Equal(t, 1, count) -} - -func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { - // Ensure the throttle delay is used by making longer than backoff delay. - tDelay, bDelay := time.Hour, time.Nanosecond - ev := func(error) (bool, time.Duration) { return true, tDelay } - reqFunc := Config{ - Enabled: true, - InitialInterval: bDelay, - MaxInterval: bDelay, - MaxElapsedTime: tDelay - (time.Nanosecond), - }.RequestFunc(ev) - - ctx := context.Background() - assert.Contains(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }).Error(), "max retry time would elapse: ") -} - -func TestMaxElapsedTime(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - delay := time.Nanosecond - reqFunc := Config{ - Enabled: true, - // InitialInterval > MaxElapsedTime means immediate return. - InitialInterval: 2 * delay, - MaxElapsedTime: delay, - }.RequestFunc(ev) - - ctx := context.Background() - assert.Contains(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }).Error(), "max retry time elapsed: ") -} - -func TestRetryNotEnabled(t *testing.T) { - ev := func(error) (bool, time.Duration) { - t.Error("evaluated retry when not enabled") - return false, 0 - } - - reqFunc := Config{}.RequestFunc(ev) - ctx := context.Background() - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - return nil - })) - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }), assert.AnError) -} - -func TestRetryConcurrentSafe(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - reqFunc := Config{ - Enabled: true, - }.RequestFunc(ev) - - var wg sync.WaitGroup - ctx := context.Background() - - for i := 1; i < 5; i++ { - wg.Add(1) - - go func() { - defer wg.Done() - - var done bool - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - if !done { - done = true - return assert.AnError - } - - return nil - })) - }() - } - - wg.Wait() -} diff --git a/exporters/otlp/internal/wrappederror.go b/exporters/otlp/internal/wrappederror.go deleted file mode 100644 index 217751da552..00000000000 --- a/exporters/otlp/internal/wrappederror.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -// ErrorKind is used to identify the kind of export error -// being wrapped. -type ErrorKind int - -const ( - // TracesExport indicates the error comes from the OTLP trace exporter. - TracesExport ErrorKind = iota -) - -// prefix returns a prefix for the Error() string. -func (k ErrorKind) prefix() string { - switch k { - case TracesExport: - return "traces export: " - default: - return "unknown: " - } -} - -// wrappedExportError wraps an OTLP exporter error with the kind of -// signal that produced it. -type wrappedExportError struct { - wrap error - kind ErrorKind -} - -// WrapTracesError wraps an error from the OTLP exporter for traces. -func WrapTracesError(err error) error { - return wrappedExportError{ - wrap: err, - kind: TracesExport, - } -} - -var _ error = wrappedExportError{} - -// Error attaches a prefix corresponding to the kind of exporter. -func (t wrappedExportError) Error() string { - return t.kind.prefix() + t.wrap.Error() -} - -// Unwrap returns the wrapped error. -func (t wrappedExportError) Unwrap() error { - return t.wrap -} diff --git a/exporters/otlp/internal/wrappederror_test.go b/exporters/otlp/internal/wrappederror_test.go deleted file mode 100644 index 995358a9f8e..00000000000 --- a/exporters/otlp/internal/wrappederror_test.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal" - -import ( - "context" - "errors" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestWrappedError(t *testing.T) { - e := WrapTracesError(context.Canceled) - - require.Equal(t, context.Canceled, errors.Unwrap(e)) - require.Equal(t, TracesExport, e.(wrappedExportError).kind) - require.Equal(t, "traces export: context canceled", e.Error()) - require.True(t, errors.Is(e, context.Canceled)) -} diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index a01756c663a..ad1dc908590 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -2,46 +2,13 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric go 1.19 -require ( - github.com/google/go-cmp v0.5.9 - github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 - go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.57.0 - google.golang.org/protobuf v1.31.0 -) +require github.com/stretchr/testify v1.8.4 require ( - github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace go.opentelemetry.io/otel/metric => ../../../metric - -replace go.opentelemetry.io/otel/sdk/metric => ../../../sdk/metric - -replace go.opentelemetry.io/otel => ../../.. - -replace go.opentelemetry.io/otel/sdk => ../../../sdk - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../internal/retry - -replace go.opentelemetry.io/otel/trace => ../../../trace diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum index f6d29fdda91..3ee4af40e76 100644 --- a/exporters/otlp/otlpmetric/go.sum +++ b/exporters/otlp/otlpmetric/go.sum @@ -1,52 +1,23 @@ -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/internal/client.go b/exporters/otlp/otlpmetric/internal/client.go deleted file mode 100644 index 6c6bf67c1c7..00000000000 --- a/exporters/otlp/otlpmetric/internal/client.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - -import ( - "context" - - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// Client handles the transmission of OTLP data to an OTLP receiving endpoint. -type Client interface { - // Temporality returns the Temporality to use for an instrument kind. - Temporality(metric.InstrumentKind) metricdata.Temporality - - // Aggregation returns the Aggregation to use for an instrument kind. - Aggregation(metric.InstrumentKind) metric.Aggregation - - // UploadMetrics transmits metric data to an OTLP receiver. - // - // All retry logic must be handled by UploadMetrics alone, the Exporter - // does not implement any retry logic. All returned errors are considered - // unrecoverable. - UploadMetrics(context.Context, *mpb.ResourceMetrics) error - - // ForceFlush flushes any metric data held by an Client. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - ForceFlush(context.Context) error - - // Shutdown flushes all metric data held by a Client and closes any - // connections it holds open. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - // - // Shutdown will only be called once by the Exporter. Once a return value - // is received by the Exporter from Shutdown the Client will not be used - // anymore. Therefore all computational resources need to be released - // after this is called so the Client can be garbage collected. - Shutdown(context.Context) error -} diff --git a/exporters/otlp/otlpmetric/internal/exporter.go b/exporters/otlp/otlpmetric/internal/exporter.go deleted file mode 100644 index 508fecd6bb1..00000000000 --- a/exporters/otlp/otlpmetric/internal/exporter.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package internal provides common utilities for all otlpmetric exporters. -// -// Deprecated: package internal exists for historical compatibility, it should -// not be used. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - -import ( - "context" - "fmt" - "sync" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" // nolint: staticcheck // Atomic deprecation. - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// Exporter exports metrics data as OTLP. -type Exporter struct { - // Ensure synchronous access to the client across all functionality. - clientMu sync.Mutex - client Client - - shutdownOnce sync.Once -} - -// Temporality returns the Temporality to use for an instrument kind. -func (e *Exporter) Temporality(k metric.InstrumentKind) metricdata.Temporality { - e.clientMu.Lock() - defer e.clientMu.Unlock() - return e.client.Temporality(k) -} - -// Aggregation returns the Aggregation to use for an instrument kind. -func (e *Exporter) Aggregation(k metric.InstrumentKind) metric.Aggregation { - e.clientMu.Lock() - defer e.clientMu.Unlock() - return e.client.Aggregation(k) -} - -// Export transforms and transmits metric data to an OTLP receiver. -func (e *Exporter) Export(ctx context.Context, rm *metricdata.ResourceMetrics) error { - otlpRm, err := transform.ResourceMetrics(rm) - // Best effort upload of transformable metrics. - e.clientMu.Lock() - upErr := e.client.UploadMetrics(ctx, otlpRm) - e.clientMu.Unlock() - if upErr != nil { - if err == nil { - return fmt.Errorf("failed to upload metrics: %w", upErr) - } - // Merge the two errors. - return fmt.Errorf("failed to upload incomplete metrics (%s): %w", err, upErr) - } - return err -} - -// ForceFlush flushes any metric data held by an exporter. -func (e *Exporter) ForceFlush(ctx context.Context) error { - // The Exporter does not hold data, forward the command to the client. - e.clientMu.Lock() - defer e.clientMu.Unlock() - return e.client.ForceFlush(ctx) -} - -var errShutdown = fmt.Errorf("exporter is shutdown") - -// Shutdown flushes all metric data held by an exporter and releases any held -// computational resources. -func (e *Exporter) Shutdown(ctx context.Context) error { - err := errShutdown - e.shutdownOnce.Do(func() { - e.clientMu.Lock() - client := e.client - e.client = shutdownClient{ - temporalitySelector: client.Temporality, - aggregationSelector: client.Aggregation, - } - e.clientMu.Unlock() - err = client.Shutdown(ctx) - }) - return err -} - -// New return an Exporter that uses client to transmits the OTLP data it -// produces. The client is assumed to be fully started and able to communicate -// with its OTLP receiving endpoint. -func New(client Client) *Exporter { - return &Exporter{client: client} -} - -type shutdownClient struct { - temporalitySelector metric.TemporalitySelector - aggregationSelector metric.AggregationSelector -} - -func (c shutdownClient) err(ctx context.Context) error { - if err := ctx.Err(); err != nil { - return err - } - return errShutdown -} - -func (c shutdownClient) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return c.temporalitySelector(k) -} - -func (c shutdownClient) Aggregation(k metric.InstrumentKind) metric.Aggregation { - return c.aggregationSelector(k) -} - -func (c shutdownClient) UploadMetrics(ctx context.Context, _ *mpb.ResourceMetrics) error { - return c.err(ctx) -} - -func (c shutdownClient) ForceFlush(ctx context.Context) error { - return c.err(ctx) -} - -func (c shutdownClient) Shutdown(ctx context.Context) error { - return c.err(ctx) -} diff --git a/exporters/otlp/otlpmetric/internal/exporter_test.go b/exporters/otlp/otlpmetric/internal/exporter_test.go deleted file mode 100644 index 6814c9dce3d..00000000000 --- a/exporters/otlp/otlpmetric/internal/exporter_test.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - -import ( - "context" - "sync" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -type client struct { - // n is incremented by all Client methods. If these methods are called - // concurrently this should fail tests run with the race detector. - n int -} - -func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return metric.DefaultTemporalitySelector(k) -} - -func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { - return metric.DefaultAggregationSelector(k) -} - -func (c *client) UploadMetrics(context.Context, *mpb.ResourceMetrics) error { - c.n++ - return nil -} - -func (c *client) ForceFlush(context.Context) error { - c.n++ - return nil -} - -func (c *client) Shutdown(context.Context) error { - c.n++ - return nil -} - -func TestExporterClientConcurrentSafe(t *testing.T) { - const goroutines = 5 - - exp := New(&client{}) - rm := new(metricdata.ResourceMetrics) - ctx := context.Background() - - done := make(chan struct{}) - var wg, someWork sync.WaitGroup - for i := 0; i < goroutines; i++ { - wg.Add(1) - someWork.Add(1) - go func() { - defer wg.Done() - assert.NoError(t, exp.Export(ctx, rm)) - assert.NoError(t, exp.ForceFlush(ctx)) - - // Ensure some work is done before shutting down. - someWork.Done() - - for { - _ = exp.Export(ctx, rm) - _ = exp.ForceFlush(ctx) - - select { - case <-done: - return - default: - } - } - }() - } - - someWork.Wait() - assert.NoError(t, exp.Shutdown(ctx)) - assert.ErrorIs(t, exp.Shutdown(ctx), errShutdown) - - close(done) - wg.Wait() -} diff --git a/exporters/otlp/otlpmetric/internal/header.go b/exporters/otlp/otlpmetric/internal/header.go deleted file mode 100644 index f07837ea7b6..00000000000 --- a/exporters/otlp/otlpmetric/internal/header.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" - -import ( - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -) - -// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}" -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent -func GetUserAgentHeader() string { - return "OTel OTLP Exporter Go/" + otlpmetric.Version() -} diff --git a/exporters/otlp/otlpmetric/internal/header_test.go b/exporters/otlp/otlpmetric/internal/header_test.go deleted file mode 100644 index 32fc4952970..00000000000 --- a/exporters/otlp/otlpmetric/internal/header_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGetUserAgentHeader(t *testing.T) { - require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", GetUserAgentHeader()) -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig.go deleted file mode 100644 index 540165de933..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/envconfig.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - -import ( - "crypto/tls" - "crypto/x509" - "net/url" - "os" - "path" - "strings" - "time" - - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" // nolint: staticcheck // Synchronous deprecation. - "go.opentelemetry.io/otel/internal/global" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -// DefaultEnvOptionsReader is the default environments reader. -var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ - GetEnv: os.Getenv, - ReadFile: os.ReadFile, - Namespace: "OTEL_EXPORTER_OTLP", -} - -// ApplyGRPCEnvConfigs applies the env configurations for gRPC. -func ApplyGRPCEnvConfigs(cfg Config) Config { - opts := getOptionsFromEnv() - for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) - } - return cfg -} - -// ApplyHTTPEnvConfigs applies the env configurations for HTTP. -func ApplyHTTPEnvConfigs(cfg Config) Config { - opts := getOptionsFromEnv() - for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) - } - return cfg -} - -func getOptionsFromEnv() []GenericOption { - opts := []GenericOption{} - - tlsConf := &tls.Config{} - DefaultEnvOptionsReader.Apply( - envconfig.WithURL("ENDPOINT", func(u *url.URL) { - opts = append(opts, withEndpointScheme(u)) - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Metrics.Endpoint = u.Host - // For OTLP/HTTP endpoint URLs without a per-signal - // configuration, the passed endpoint is used as a base URL - // and the signals are sent to these paths relative to that. - cfg.Metrics.URLPath = path.Join(u.Path, DefaultMetricsPath) - return cfg - }, withEndpointForGRPC(u))) - }), - envconfig.WithURL("METRICS_ENDPOINT", func(u *url.URL) { - opts = append(opts, withEndpointScheme(u)) - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Metrics.Endpoint = u.Host - // For endpoint URLs for OTLP/HTTP per-signal variables, the - // URL MUST be used as-is without any modification. The only - // exception is that if an URL contains no path part, the root - // path / MUST be used. - path := u.Path - if path == "" { - path = "/" - } - cfg.Metrics.URLPath = path - return cfg - }, withEndpointForGRPC(u))) - }), - envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), - envconfig.WithCertPool("METRICS_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), - envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), - envconfig.WithClientCert("METRICS_CLIENT_CERTIFICATE", "METRICS_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), - envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), - envconfig.WithBool("METRICS_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), - withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), - envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), - envconfig.WithHeaders("METRICS_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), - WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), - WithEnvCompression("METRICS_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), - envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), - envconfig.WithDuration("METRICS_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), - withEnvTemporalityPreference("METRICS_TEMPORALITY_PREFERENCE", func(t metric.TemporalitySelector) { opts = append(opts, WithTemporalitySelector(t)) }), - ) - - return opts -} - -func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { - return func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Metrics.Endpoint = path.Join(u.Host, u.Path) - return cfg - } -} - -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. -func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { - return func(e *envconfig.EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - cp := NoCompression - if v == "gzip" { - cp = GzipCompression - } - - fn(cp) - } - } -} - -func withEndpointScheme(u *url.URL) GenericOption { - switch strings.ToLower(u.Scheme) { - case "http", "unix": - return WithInsecure() - default: - return WithSecure() - } -} - -// revive:disable-next-line:flag-parameter -func withInsecure(b bool) GenericOption { - if b { - return WithInsecure() - } - return WithSecure() -} - -func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { - return func(e *envconfig.EnvOptionsReader) { - if c.RootCAs != nil || len(c.Certificates) > 0 { - fn(c) - } - } -} - -func withEnvTemporalityPreference(n string, fn func(metric.TemporalitySelector)) func(e *envconfig.EnvOptionsReader) { - return func(e *envconfig.EnvOptionsReader) { - if s, ok := e.GetEnvValue(n); ok { - switch strings.ToLower(s) { - case "cumulative": - fn(cumulativeTemporality) - case "delta": - fn(deltaTemporality) - case "lowmemory": - fn(lowMemory) - default: - global.Warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to an invalid value, ignoring.", "value", s) - } - } - } -} - -func cumulativeTemporality(metric.InstrumentKind) metricdata.Temporality { - return metricdata.CumulativeTemporality -} - -func deltaTemporality(ik metric.InstrumentKind) metricdata.Temporality { - switch ik { - case metric.InstrumentKindCounter, metric.InstrumentKindHistogram, metric.InstrumentKindObservableCounter: - return metricdata.DeltaTemporality - default: - return metricdata.CumulativeTemporality - } -} - -func lowMemory(ik metric.InstrumentKind) metricdata.Temporality { - switch ik { - case metric.InstrumentKindCounter, metric.InstrumentKindHistogram: - return metricdata.DeltaTemporality - default: - return metricdata.CumulativeTemporality - } -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go b/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go deleted file mode 100644 index 0c54c78e29a..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/envconfig_test.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oconf - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -func TestWithEnvTemporalityPreference(t *testing.T) { - origReader := DefaultEnvOptionsReader.GetEnv - tests := []struct { - name string - envValue string - want map[metric.InstrumentKind]metricdata.Temporality - }{ - { - name: "default do not set the selector", - envValue: "", - }, - { - name: "non-normative do not set the selector", - envValue: "non-normative", - }, - { - name: "cumulative", - envValue: "cumulative", - want: map[metric.InstrumentKind]metricdata.Temporality{ - metric.InstrumentKindCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindHistogram: metricdata.CumulativeTemporality, - metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, - }, - }, - { - name: "delta", - envValue: "delta", - want: map[metric.InstrumentKind]metricdata.Temporality{ - metric.InstrumentKindCounter: metricdata.DeltaTemporality, - metric.InstrumentKindHistogram: metricdata.DeltaTemporality, - metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableCounter: metricdata.DeltaTemporality, - metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, - }, - }, - { - name: "lowmemory", - envValue: "lowmemory", - want: map[metric.InstrumentKind]metricdata.Temporality{ - metric.InstrumentKindCounter: metricdata.DeltaTemporality, - metric.InstrumentKindHistogram: metricdata.DeltaTemporality, - metric.InstrumentKindUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableUpDownCounter: metricdata.CumulativeTemporality, - metric.InstrumentKindObservableGauge: metricdata.CumulativeTemporality, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - DefaultEnvOptionsReader.GetEnv = func(key string) string { - if key == "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE" { - return tt.envValue - } - return origReader(key) - } - cfg := Config{} - cfg = ApplyGRPCEnvConfigs(cfg) - - if tt.want == nil { - // There is no function set, the SDK's default is used. - assert.Nil(t, cfg.Metrics.TemporalitySelector) - return - } - - require.NotNil(t, cfg.Metrics.TemporalitySelector) - for ik, want := range tt.want { - assert.Equal(t, want, cfg.Metrics.TemporalitySelector(ik)) - } - }) - } - DefaultEnvOptionsReader.GetEnv = origReader -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/options.go b/exporters/otlp/otlpmetric/internal/oconf/options.go deleted file mode 100644 index 5d8f1d25b77..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/options.go +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package oconf provides common metric configuration types and functionality -// for all otlpmetric exporters. -// -// Deprecated: package oconf exists for historical compatibility, it should not -// be used. -package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - -import ( - "crypto/tls" - "fmt" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/encoding/gzip" - - "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. - "go.opentelemetry.io/otel/exporters/otlp/internal/retry" // nolint: staticcheck // Synchronous deprecation. - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. - "go.opentelemetry.io/otel/sdk/metric" -) - -const ( - // DefaultMaxAttempts describes how many times the driver - // should retry the sending of the payload in case of a - // retryable error. - DefaultMaxAttempts int = 5 - // DefaultMetricsPath is a default URL path for endpoint that - // receives metrics. - DefaultMetricsPath string = "/v1/metrics" - // DefaultBackoff is a default base backoff time used in the - // exponential backoff strategy. - DefaultBackoff time.Duration = 300 * time.Millisecond - // DefaultTimeout is a default max waiting time for the backend to process - // each span or metrics batch. - DefaultTimeout time.Duration = 10 * time.Second -) - -type ( - SignalConfig struct { - Endpoint string - Insecure bool - TLSCfg *tls.Config - Headers map[string]string - Compression Compression - Timeout time.Duration - URLPath string - - // gRPC configurations - GRPCCredentials credentials.TransportCredentials - - TemporalitySelector metric.TemporalitySelector - AggregationSelector metric.AggregationSelector - } - - Config struct { - // Signal specific configurations - Metrics SignalConfig - - RetryConfig retry.Config - - // gRPC configurations - ReconnectionPeriod time.Duration - ServiceConfig string - DialOptions []grpc.DialOption - GRPCConn *grpc.ClientConn - } -) - -// NewHTTPConfig returns a new Config with all settings applied from opts and -// any unset setting using the default HTTP config values. -func NewHTTPConfig(opts ...HTTPOption) Config { - cfg := Config{ - Metrics: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), - URLPath: DefaultMetricsPath, - Compression: NoCompression, - Timeout: DefaultTimeout, - - TemporalitySelector: metric.DefaultTemporalitySelector, - AggregationSelector: metric.DefaultAggregationSelector, - }, - RetryConfig: retry.DefaultConfig, - } - cfg = ApplyHTTPEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) - } - cfg.Metrics.URLPath = internal.CleanPath(cfg.Metrics.URLPath, DefaultMetricsPath) - return cfg -} - -// NewGRPCConfig returns a new Config with all settings applied from opts and -// any unset setting using the default gRPC config values. -func NewGRPCConfig(opts ...GRPCOption) Config { - cfg := Config{ - Metrics: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), - URLPath: DefaultMetricsPath, - Compression: NoCompression, - Timeout: DefaultTimeout, - - TemporalitySelector: metric.DefaultTemporalitySelector, - AggregationSelector: metric.DefaultAggregationSelector, - }, - RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(ominternal.GetUserAgentHeader())}, - } - cfg = ApplyGRPCEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) - } - - if cfg.ServiceConfig != "" { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) - } - // Priroritize GRPCCredentials over Insecure (passing both is an error). - if cfg.Metrics.GRPCCredentials != nil { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Metrics.GRPCCredentials)) - } else if cfg.Metrics.Insecure { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) - } else { - // Default to using the host's root CA. - creds := credentials.NewTLS(nil) - cfg.Metrics.GRPCCredentials = creds - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) - } - if cfg.Metrics.Compression == GzipCompression { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) - } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } - if cfg.ReconnectionPeriod != 0 { - p := grpc.ConnectParams{ - Backoff: backoff.DefaultConfig, - MinConnectTimeout: cfg.ReconnectionPeriod, - } - cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) - } - - return cfg -} - -type ( - // GenericOption applies an option to the HTTP or gRPC driver. - GenericOption interface { - ApplyHTTPOption(Config) Config - ApplyGRPCOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } - - // HTTPOption applies an option to the HTTP driver. - HTTPOption interface { - ApplyHTTPOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } - - // GRPCOption applies an option to the gRPC driver. - GRPCOption interface { - ApplyGRPCOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } -) - -// genericOption is an option that applies the same logic -// for both gRPC and HTTP. -type genericOption struct { - fn func(Config) Config -} - -func (g *genericOption) ApplyGRPCOption(cfg Config) Config { - return g.fn(cfg) -} - -func (g *genericOption) ApplyHTTPOption(cfg Config) Config { - return g.fn(cfg) -} - -func (genericOption) private() {} - -func newGenericOption(fn func(cfg Config) Config) GenericOption { - return &genericOption{fn: fn} -} - -// splitOption is an option that applies different logics -// for gRPC and HTTP. -type splitOption struct { - httpFn func(Config) Config - grpcFn func(Config) Config -} - -func (g *splitOption) ApplyGRPCOption(cfg Config) Config { - return g.grpcFn(cfg) -} - -func (g *splitOption) ApplyHTTPOption(cfg Config) Config { - return g.httpFn(cfg) -} - -func (splitOption) private() {} - -func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { - return &splitOption{httpFn: httpFn, grpcFn: grpcFn} -} - -// httpOption is an option that is only applied to the HTTP driver. -type httpOption struct { - fn func(Config) Config -} - -func (h *httpOption) ApplyHTTPOption(cfg Config) Config { - return h.fn(cfg) -} - -func (httpOption) private() {} - -func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { - return &httpOption{fn: fn} -} - -// grpcOption is an option that is only applied to the gRPC driver. -type grpcOption struct { - fn func(Config) Config -} - -func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { - return h.fn(cfg) -} - -func (grpcOption) private() {} - -func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { - return &grpcOption{fn: fn} -} - -// Generic Options - -func WithEndpoint(endpoint string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Endpoint = endpoint - return cfg - }) -} - -func WithCompression(compression Compression) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Compression = compression - return cfg - }) -} - -func WithURLPath(urlPath string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.URLPath = urlPath - return cfg - }) -} - -func WithRetry(rc retry.Config) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.RetryConfig = rc - return cfg - }) -} - -func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { - return newSplitOption(func(cfg Config) Config { - cfg.Metrics.TLSCfg = tlsCfg.Clone() - return cfg - }, func(cfg Config) Config { - cfg.Metrics.GRPCCredentials = credentials.NewTLS(tlsCfg) - return cfg - }) -} - -func WithInsecure() GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Insecure = true - return cfg - }) -} - -func WithSecure() GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Insecure = false - return cfg - }) -} - -func WithHeaders(headers map[string]string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Headers = headers - return cfg - }) -} - -func WithTimeout(duration time.Duration) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.Timeout = duration - return cfg - }) -} - -func WithTemporalitySelector(selector metric.TemporalitySelector) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.TemporalitySelector = selector - return cfg - }) -} - -func WithAggregationSelector(selector metric.AggregationSelector) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Metrics.AggregationSelector = selector - return cfg - }) -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/internal/oconf/options_test.go deleted file mode 100644 index 80102da7d01..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/options_test.go +++ /dev/null @@ -1,465 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oconf_test - -import ( - "errors" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/exporters/otlp/internal/envconfig" // nolint: staticcheck // Synchronous deprecation. - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" -) - -const ( - WeakCertificate = ` ------BEGIN CERTIFICATE----- -MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ -MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa -MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 -nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z -sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI -KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA -AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ -1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH -Lhnm4N/QDk5rek0= ------END CERTIFICATE----- -` - WeakPrivateKey = ` ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK -SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf -kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV ------END PRIVATE KEY----- -` -) - -type env map[string]string - -func (e *env) getEnv(env string) string { - return (*e)[env] -} - -type fileReader map[string][]byte - -func (f *fileReader) readFile(filename string) ([]byte, error) { - if b, ok := (*f)[filename]; ok { - return b, nil - } - return nil, errors.New("file not found") -} - -func TestConfigs(t *testing.T) { - tlsCert, err := oconf.CreateTLSConfig([]byte(WeakCertificate)) - assert.NoError(t, err) - - tests := []struct { - name string - opts []oconf.GenericOption - env env - fileReader fileReader - asserts func(t *testing.T, c *oconf.Config, grpcOption bool) - }{ - { - name: "Test default configs", - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) - } else { - assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) - } - assert.Equal(t, oconf.NoCompression, c.Metrics.Compression) - assert.Equal(t, map[string]string(nil), c.Metrics.Headers) - assert.Equal(t, 10*time.Second, c.Metrics.Timeout) - }, - }, - - // Endpoint Tests - { - name: "Test With Endpoint", - opts: []oconf.GenericOption{ - oconf.WithEndpoint("someendpoint"), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "someendpoint", c.Metrics.Endpoint) - }, - }, - { - name: "Test Environment Endpoint", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.False(t, c.Metrics.Insecure) - if grpcOption { - assert.Equal(t, "env.endpoint/prefix", c.Metrics.Endpoint) - } else { - assert.Equal(t, "env.endpoint", c.Metrics.Endpoint) - assert.Equal(t, "/prefix/v1/metrics", c.Metrics.URLPath) - } - }, - }, - { - name: "Test Environment Signal Specific Endpoint", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", - "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "http://env.metrics.endpoint", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.True(t, c.Metrics.Insecure) - assert.Equal(t, "env.metrics.endpoint", c.Metrics.Endpoint) - if !grpcOption { - assert.Equal(t, "/", c.Metrics.URLPath) - } - }, - }, - { - name: "Test Mixed Environment and With Endpoint", - opts: []oconf.GenericOption{ - oconf.WithEndpoint("metrics_endpoint"), - }, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "metrics_endpoint", c.Metrics.Endpoint) - }, - }, - { - name: "Test Environment Endpoint with HTTP scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) - assert.Equal(t, true, c.Metrics.Insecure) - }, - }, - { - name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) - assert.Equal(t, true, c.Metrics.Insecure) - }, - }, - { - name: "Test Environment Endpoint with HTTPS scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Metrics.Endpoint) - assert.Equal(t, false, c.Metrics.Insecure) - }, - }, - { - name: "Test Environment Signal Specific Endpoint with uppercase scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "HtTp://env_metrics_endpoint", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, "env_metrics_endpoint", c.Metrics.Endpoint) - assert.Equal(t, true, c.Metrics.Insecure) - }, - }, - - // Certificate tests - { - name: "Test Default Certificate", - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Metrics.GRPCCredentials) - } else { - assert.Nil(t, c.Metrics.TLSCfg) - } - }, - }, - { - name: "Test With Certificate", - opts: []oconf.GenericOption{ - oconf.WithTLSClientConfig(tlsCert), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - //TODO: make sure gRPC's credentials actually works - assert.NotNil(t, c.Metrics.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Environment Certificate", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Metrics.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Environment Signal Specific Certificate", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - "invalid_cert": []byte("invalid certificate file."), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Metrics.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Metrics.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Mixed Environment and With Certificate", - opts: []oconf.GenericOption{}, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Metrics.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, 1, len(c.Metrics.TLSCfg.RootCAs.Subjects())) - } - }, - }, - - // Headers tests - { - name: "Test With Headers", - opts: []oconf.GenericOption{ - oconf.WithHeaders(map[string]string{"h1": "v1"}), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1"}, c.Metrics.Headers) - }, - }, - { - name: "Test Environment Headers", - env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) - }, - }, - { - name: "Test Environment Signal Specific Headers", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_METRICS_HEADERS": "h1=v1,h2=v2", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Metrics.Headers) - }, - }, - { - name: "Test Mixed Environment and With Headers", - env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - opts: []oconf.GenericOption{ - oconf.WithHeaders(map[string]string{"m1": "mv1"}), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, map[string]string{"m1": "mv1"}, c.Metrics.Headers) - }, - }, - - // Compression Tests - { - name: "Test With Compression", - opts: []oconf.GenericOption{ - oconf.WithCompression(oconf.GzipCompression), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) - }, - }, - { - name: "Test Environment Compression", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) - }, - }, - { - name: "Test Environment Signal Specific Compression", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, oconf.GzipCompression, c.Metrics.Compression) - }, - }, - { - name: "Test Mixed Environment and With Compression", - opts: []oconf.GenericOption{ - oconf.WithCompression(oconf.NoCompression), - }, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_METRICS_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, oconf.NoCompression, c.Metrics.Compression) - }, - }, - - // Timeout Tests - { - name: "Test With Timeout", - opts: []oconf.GenericOption{ - oconf.WithTimeout(time.Duration(5 * time.Second)), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, 5*time.Second, c.Metrics.Timeout) - }, - }, - { - name: "Test Environment Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, c.Metrics.Timeout, 15*time.Second) - }, - }, - { - name: "Test Environment Signal Specific Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, c.Metrics.Timeout, 28*time.Second) - }, - }, - { - name: "Test Mixed Environment and With Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - "OTEL_EXPORTER_OTLP_METRICS_TIMEOUT": "28000", - }, - opts: []oconf.GenericOption{ - oconf.WithTimeout(5 * time.Second), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - assert.Equal(t, c.Metrics.Timeout, 5*time.Second) - }, - }, - - // Temporality Selector Tests - { - name: "WithTemporalitySelector", - opts: []oconf.GenericOption{ - oconf.WithTemporalitySelector(deltaSelector), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - // Function value comparisons are disallowed, test non-default - // behavior of a TemporalitySelector here to ensure our "catch - // all" was set. - var undefinedKind metric.InstrumentKind - got := c.Metrics.TemporalitySelector - assert.Equal(t, metricdata.DeltaTemporality, got(undefinedKind)) - }, - }, - - // Aggregation Selector Tests - { - name: "WithAggregationSelector", - opts: []oconf.GenericOption{ - oconf.WithAggregationSelector(dropSelector), - }, - asserts: func(t *testing.T, c *oconf.Config, grpcOption bool) { - // Function value comparisons are disallowed, test non-default - // behavior of a AggregationSelector here to ensure our "catch - // all" was set. - var undefinedKind metric.InstrumentKind - got := c.Metrics.AggregationSelector - assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - origEOR := oconf.DefaultEnvOptionsReader - oconf.DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ - GetEnv: tt.env.getEnv, - ReadFile: tt.fileReader.readFile, - Namespace: "OTEL_EXPORTER_OTLP", - } - t.Cleanup(func() { oconf.DefaultEnvOptionsReader = origEOR }) - - // Tests Generic options as HTTP Options - cfg := oconf.NewHTTPConfig(asHTTPOptions(tt.opts)...) - tt.asserts(t, &cfg, false) - - // Tests Generic options as gRPC Options - cfg = oconf.NewGRPCConfig(asGRPCOptions(tt.opts)...) - tt.asserts(t, &cfg, true) - }) - } -} - -func dropSelector(metric.InstrumentKind) metric.Aggregation { - return metric.AggregationDrop{} -} - -func deltaSelector(metric.InstrumentKind) metricdata.Temporality { - return metricdata.DeltaTemporality -} - -func asHTTPOptions(opts []oconf.GenericOption) []oconf.HTTPOption { - converted := make([]oconf.HTTPOption, len(opts)) - for i, o := range opts { - converted[i] = oconf.NewHTTPOption(o.ApplyHTTPOption) - } - return converted -} - -func asGRPCOptions(opts []oconf.GenericOption) []oconf.GRPCOption { - converted := make([]oconf.GRPCOption, len(opts)) - for i, o := range opts { - converted[i] = oconf.NewGRPCOption(o.ApplyGRPCOption) - } - return converted -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/optiontypes.go b/exporters/otlp/otlpmetric/internal/oconf/optiontypes.go deleted file mode 100644 index e878ee74104..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/optiontypes.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - -import "time" - -const ( - // DefaultCollectorGRPCPort is the default gRPC port of the collector. - DefaultCollectorGRPCPort uint16 = 4317 - // DefaultCollectorHTTPPort is the default HTTP port of the collector. - DefaultCollectorHTTPPort uint16 = 4318 - // DefaultCollectorHost is the host address the Exporter will attempt - // connect to if no collector address is provided. - DefaultCollectorHost string = "localhost" -) - -// Compression describes the compression used for payloads sent to the -// collector. -type Compression int - -const ( - // NoCompression tells the driver to send payloads without - // compression. - NoCompression Compression = iota - // GzipCompression tells the driver to send payloads after - // compressing them with gzip. - GzipCompression -) - -// RetrySettings defines configuration for retrying batches in case of export failure -// using an exponential backoff. -type RetrySettings struct { - // Enabled indicates whether to not retry sending batches in case of export failure. - Enabled bool - // InitialInterval the time to wait after the first failure before retrying. - InitialInterval time.Duration - // MaxInterval is the upper bound on backoff interval. Once this value is reached the delay between - // consecutive retries will always be `MaxInterval`. - MaxInterval time.Duration - // MaxElapsedTime is the maximum amount of time (including retries) spent trying to send a request/batch. - // Once this value is reached, the data is discarded. - MaxElapsedTime time.Duration -} diff --git a/exporters/otlp/otlpmetric/internal/oconf/tls.go b/exporters/otlp/otlpmetric/internal/oconf/tls.go deleted file mode 100644 index 44bbe326860..00000000000 --- a/exporters/otlp/otlpmetric/internal/oconf/tls.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "os" -) - -// ReadTLSConfigFromFile reads a PEM certificate file and creates -// a tls.Config that will use this certifate to verify a server certificate. -func ReadTLSConfigFromFile(path string) (*tls.Config, error) { - b, err := os.ReadFile(path) - if err != nil { - return nil, err - } - - return CreateTLSConfig(b) -} - -// CreateTLSConfig creates a tls.Config from a raw certificate bytes -// to verify a server certificate. -func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { - cp := x509.NewCertPool() - if ok := cp.AppendCertsFromPEM(certBytes); !ok { - return nil, errors.New("failed to append certificate to the cert pool") - } - - return &tls.Config{ - RootCAs: cp, - }, nil -} diff --git a/exporters/otlp/otlpmetric/internal/otest/client.go b/exporters/otlp/otlpmetric/internal/otest/client.go deleted file mode 100644 index 2200413e49c..00000000000 --- a/exporters/otlp/otlpmetric/internal/otest/client.go +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package otest provides common testing utilities for all otlpmetric -// exporters. -// -// Deprecated: package otest exists for historical compatibility, it should not -// be used. -package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/google/go-cmp/cmp" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/proto" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. - semconv "go.opentelemetry.io/otel/semconv/v1.21.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" - rpb "go.opentelemetry.io/proto/otlp/resource/v1" -) - -var ( - // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) - end = start.Add(30 * time.Second) - - kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, - }} - kvBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, - }} - kvSrvName = &cpb.KeyValue{Key: "service.name", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, - }} - kvSrvVer = &cpb.KeyValue{Key: "service.version", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, - }} - - min, max, sum = 2.0, 4.0, 90.0 - hdp = []*mpb.HistogramDataPoint{{ - Attributes: []*cpb.KeyValue{kvAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Count: 30, - Sum: &sum, - ExplicitBounds: []float64{1, 5}, - BucketCounts: []uint64{0, 30, 0}, - Min: &min, - Max: &max, - }} - - hist = &mpb.Histogram{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: hdp, - } - - dPtsInt64 = []*mpb.NumberDataPoint{ - { - Attributes: []*cpb.KeyValue{kvAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, - }, - { - Attributes: []*cpb.KeyValue{kvBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, - }, - } - dPtsFloat64 = []*mpb.NumberDataPoint{ - { - Attributes: []*cpb.KeyValue{kvAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, - }, - { - Attributes: []*cpb.KeyValue{kvBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, - }, - } - - sumInt64 = &mpb.Sum{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - IsMonotonic: true, - DataPoints: dPtsInt64, - } - sumFloat64 = &mpb.Sum{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - IsMonotonic: false, - DataPoints: dPtsFloat64, - } - - gaugeInt64 = &mpb.Gauge{DataPoints: dPtsInt64} - gaugeFloat64 = &mpb.Gauge{DataPoints: dPtsFloat64} - - metrics = []*mpb.Metric{ - { - Name: "int64-gauge", - Description: "Gauge with int64 values", - Unit: "1", - Data: &mpb.Metric_Gauge{Gauge: gaugeInt64}, - }, - { - Name: "float64-gauge", - Description: "Gauge with float64 values", - Unit: "1", - Data: &mpb.Metric_Gauge{Gauge: gaugeFloat64}, - }, - { - Name: "int64-sum", - Description: "Sum with int64 values", - Unit: "1", - Data: &mpb.Metric_Sum{Sum: sumInt64}, - }, - { - Name: "float64-sum", - Description: "Sum with float64 values", - Unit: "1", - Data: &mpb.Metric_Sum{Sum: sumFloat64}, - }, - { - Name: "histogram", - Description: "Histogram", - Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: hist}, - }, - } - - scope = &cpb.InstrumentationScope{ - Name: "test/code/path", - Version: "v0.1.0", - } - scopeMetrics = []*mpb.ScopeMetrics{{ - Scope: scope, - Metrics: metrics, - SchemaUrl: semconv.SchemaURL, - }} - - res = &rpb.Resource{ - Attributes: []*cpb.KeyValue{kvSrvName, kvSrvVer}, - } - resourceMetrics = &mpb.ResourceMetrics{ - Resource: res, - ScopeMetrics: scopeMetrics, - SchemaUrl: semconv.SchemaURL, - } -) - -// ClientFactory is a function that when called returns a -// internal.Client implementation that is connected to also returned -// Collector implementation. The Client is ready to upload metric data to the -// Collector which is ready to store that data. -// -// If resultCh is not nil, the returned Collector needs to use the responses -// from that channel to send back to the client for every export request. -type ClientFactory func(resultCh <-chan ExportResult) (internal.Client, Collector) - -// RunClientTests runs a suite of Client integration tests. For example: -// -// t.Run("Integration", RunClientTests(factory)) -func RunClientTests(f ClientFactory) func(*testing.T) { - return func(t *testing.T) { - t.Run("ClientHonorsContextErrors", func(t *testing.T) { - t.Run("Shutdown", testCtxErrs(func() func(context.Context) error { - c, _ := f(nil) - return c.Shutdown - })) - - t.Run("ForceFlush", testCtxErrs(func() func(context.Context) error { - c, _ := f(nil) - return c.ForceFlush - })) - - t.Run("UploadMetrics", testCtxErrs(func() func(context.Context) error { - c, _ := f(nil) - return func(ctx context.Context) error { - return c.UploadMetrics(ctx, nil) - } - })) - }) - - t.Run("ForceFlushFlushes", func(t *testing.T) { - ctx := context.Background() - client, collector := f(nil) - require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) - - require.NoError(t, client.ForceFlush(ctx)) - rm := collector.Collect().Dump() - // Data correctness is not important, just it was received. - require.Greater(t, len(rm), 0, "no data uploaded") - - require.NoError(t, client.Shutdown(ctx)) - rm = collector.Collect().Dump() - assert.Len(t, rm, 0, "client did not flush all data") - }) - - t.Run("UploadMetrics", func(t *testing.T) { - ctx := context.Background() - client, coll := f(nil) - - require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) - require.NoError(t, client.Shutdown(ctx)) - got := coll.Collect().Dump() - require.Len(t, got, 1, "upload of one ResourceMetrics") - diff := cmp.Diff(got[0], resourceMetrics, cmp.Comparer(proto.Equal)) - if diff != "" { - t.Fatalf("unexpected ResourceMetrics:\n%s", diff) - } - }) - - t.Run("PartialSuccess", func(t *testing.T) { - const n, msg = 2, "bad data" - rCh := make(chan ExportResult, 3) - rCh <- ExportResult{ - Response: &collpb.ExportMetricsServiceResponse{ - PartialSuccess: &collpb.ExportMetricsPartialSuccess{ - RejectedDataPoints: n, - ErrorMessage: msg, - }, - }, - } - rCh <- ExportResult{ - Response: &collpb.ExportMetricsServiceResponse{ - PartialSuccess: &collpb.ExportMetricsPartialSuccess{ - // Should not be logged. - RejectedDataPoints: 0, - ErrorMessage: "", - }, - }, - } - rCh <- ExportResult{ - Response: &collpb.ExportMetricsServiceResponse{}, - } - - ctx := context.Background() - client, _ := f(rCh) - - defer func(orig otel.ErrorHandler) { - otel.SetErrorHandler(orig) - }(otel.GetErrorHandler()) - - errs := []error{} - eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) - otel.SetErrorHandler(eh) - - require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) - require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) - require.NoError(t, client.UploadMetrics(ctx, resourceMetrics)) - require.NoError(t, client.Shutdown(ctx)) - - require.Equal(t, 1, len(errs)) - want := fmt.Sprintf("%s (%d metric data points rejected)", msg, n) - assert.ErrorContains(t, errs[0], want) - }) - - t.Run("Other HTTP success", func(t *testing.T) { - for code := 201; code <= 299; code++ { - t.Run(fmt.Sprintf("status_%d", code), func(t *testing.T) { - rCh := make(chan ExportResult, 1) - rCh <- ExportResult{ - ResponseStatus: code, - } - - ctx := context.Background() - client, _ := f(rCh) - defer func() { - assert.NoError(t, client.Shutdown(ctx)) - }() - - defer func(orig otel.ErrorHandler) { - otel.SetErrorHandler(orig) - }(otel.GetErrorHandler()) - - errs := []error{} - eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) - otel.SetErrorHandler(eh) - - assert.NoError(t, client.UploadMetrics(ctx, nil)) - assert.Equal(t, 0, len(errs)) - }) - } - }) - } -} - -func testCtxErrs(factory func() func(context.Context) error) func(t *testing.T) { - return func(t *testing.T) { - t.Helper() - ctx, cancel := context.WithCancel(context.Background()) - t.Cleanup(cancel) - - t.Run("DeadlineExceeded", func(t *testing.T) { - innerCtx, innerCancel := context.WithTimeout(ctx, time.Nanosecond) - t.Cleanup(innerCancel) - <-innerCtx.Done() - - f := factory() - assert.ErrorIs(t, f(innerCtx), context.DeadlineExceeded) - }) - - t.Run("Canceled", func(t *testing.T) { - innerCtx, innerCancel := context.WithCancel(ctx) - innerCancel() - - f := factory() - assert.ErrorIs(t, f(innerCtx), context.Canceled) - }) - } -} diff --git a/exporters/otlp/otlpmetric/internal/otest/client_test.go b/exporters/otlp/otlpmetric/internal/otest/client_test.go deleted file mode 100644 index 3f7bb848e2c..00000000000 --- a/exporters/otlp/otlpmetric/internal/otest/client_test.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" - -import ( - "context" - "testing" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/internal" // nolint: staticcheck // Synchronous deprecation. - ominternal "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal" // nolint: staticcheck // Atomic deprecation. - "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/metric/metricdata" - cpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -type client struct { - rCh <-chan ExportResult - storage *Storage -} - -func (c *client) Temporality(k metric.InstrumentKind) metricdata.Temporality { - return metric.DefaultTemporalitySelector(k) -} - -func (c *client) Aggregation(k metric.InstrumentKind) metric.Aggregation { - return metric.DefaultAggregationSelector(k) -} - -func (c *client) Collect() *Storage { - return c.storage -} - -func (c *client) UploadMetrics(ctx context.Context, rm *mpb.ResourceMetrics) error { - c.storage.Add(&cpb.ExportMetricsServiceRequest{ - ResourceMetrics: []*mpb.ResourceMetrics{rm}, - }) - if c.rCh != nil { - r := <-c.rCh - if r.Response != nil && r.Response.GetPartialSuccess() != nil { - msg := r.Response.GetPartialSuccess().GetErrorMessage() - n := r.Response.GetPartialSuccess().GetRejectedDataPoints() - if msg != "" || n > 0 { - otel.Handle(internal.MetricPartialSuccessError(n, msg)) - } - } - return r.Err - } - return ctx.Err() -} - -func (c *client) ForceFlush(ctx context.Context) error { return ctx.Err() } -func (c *client) Shutdown(ctx context.Context) error { return ctx.Err() } - -func TestClientTests(t *testing.T) { - factory := func(rCh <-chan ExportResult) (ominternal.Client, Collector) { - c := &client{rCh: rCh, storage: NewStorage()} - return c, c - } - - t.Run("Integration", RunClientTests(factory)) -} diff --git a/exporters/otlp/otlpmetric/internal/otest/collector.go b/exporters/otlp/otlpmetric/internal/otest/collector.go deleted file mode 100644 index b31e308c965..00000000000 --- a/exporters/otlp/otlpmetric/internal/otest/collector.go +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otest // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/otest" - -import ( - "bytes" - "compress/gzip" - "context" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/tls" - "crypto/x509" - "crypto/x509/pkix" // nolint:depguard // This is for testing. - "encoding/pem" - "errors" - "fmt" - "io" - "math/big" - "net" - "net/http" - "net/url" - "sync" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - "google.golang.org/protobuf/proto" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/oconf" // nolint: staticcheck // Atomic deprecation. - collpb "go.opentelemetry.io/proto/otlp/collector/metrics/v1" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -// Collector is the collection target a Client sends metric uploads to. -type Collector interface { - Collect() *Storage -} - -type ExportResult struct { - Response *collpb.ExportMetricsServiceResponse - ResponseStatus int - Err error -} - -// Storage stores uploaded OTLP metric data in their proto form. -type Storage struct { - dataMu sync.Mutex - data []*mpb.ResourceMetrics -} - -// NewStorage returns a configure storage ready to store received requests. -func NewStorage() *Storage { - return &Storage{} -} - -// Add adds the request to the Storage. -func (s *Storage) Add(request *collpb.ExportMetricsServiceRequest) { - s.dataMu.Lock() - defer s.dataMu.Unlock() - s.data = append(s.data, request.ResourceMetrics...) -} - -// Dump returns all added ResourceMetrics and clears the storage. -func (s *Storage) Dump() []*mpb.ResourceMetrics { - s.dataMu.Lock() - defer s.dataMu.Unlock() - - var data []*mpb.ResourceMetrics - data, s.data = s.data, []*mpb.ResourceMetrics{} - return data -} - -// GRPCCollector is an OTLP gRPC server that collects all requests it receives. -type GRPCCollector struct { - collpb.UnimplementedMetricsServiceServer - - headersMu sync.Mutex - headers metadata.MD - storage *Storage - - resultCh <-chan ExportResult - listener net.Listener - srv *grpc.Server -} - -// NewGRPCCollector returns a *GRPCCollector that is listening at the provided -// endpoint. -// -// If endpoint is an empty string, the returned collector will be listening on -// the localhost interface at an OS chosen port. -// -// If errCh is not nil, the collector will respond to Export calls with errors -// sent on that channel. This means that if errCh is not nil Export calls will -// block until an error is received. -func NewGRPCCollector(endpoint string, resultCh <-chan ExportResult) (*GRPCCollector, error) { - if endpoint == "" { - endpoint = "localhost:0" - } - - c := &GRPCCollector{ - storage: NewStorage(), - resultCh: resultCh, - } - - var err error - c.listener, err = net.Listen("tcp", endpoint) - if err != nil { - return nil, err - } - - c.srv = grpc.NewServer() - collpb.RegisterMetricsServiceServer(c.srv, c) - go func() { _ = c.srv.Serve(c.listener) }() - - return c, nil -} - -// Shutdown shuts down the gRPC server closing all open connections and -// listeners immediately. -func (c *GRPCCollector) Shutdown() { c.srv.Stop() } - -// Addr returns the net.Addr c is listening at. -func (c *GRPCCollector) Addr() net.Addr { - return c.listener.Addr() -} - -// Collect returns the Storage holding all collected requests. -func (c *GRPCCollector) Collect() *Storage { - return c.storage -} - -// Headers returns the headers received for all requests. -func (c *GRPCCollector) Headers() map[string][]string { - // Makes a copy. - c.headersMu.Lock() - defer c.headersMu.Unlock() - return metadata.Join(c.headers) -} - -// Export handles the export req. -func (c *GRPCCollector) Export(ctx context.Context, req *collpb.ExportMetricsServiceRequest) (*collpb.ExportMetricsServiceResponse, error) { - c.storage.Add(req) - - if h, ok := metadata.FromIncomingContext(ctx); ok { - c.headersMu.Lock() - c.headers = metadata.Join(c.headers, h) - c.headersMu.Unlock() - } - - if c.resultCh != nil { - r := <-c.resultCh - if r.Response == nil { - return &collpb.ExportMetricsServiceResponse{}, r.Err - } - return r.Response, r.Err - } - return &collpb.ExportMetricsServiceResponse{}, nil -} - -var emptyExportMetricsServiceResponse = func() []byte { - body := collpb.ExportMetricsServiceResponse{} - r, err := proto.Marshal(&body) - if err != nil { - panic(err) - } - return r -}() - -type HTTPResponseError struct { - Err error - Status int - Header http.Header -} - -func (e *HTTPResponseError) Error() string { - return fmt.Sprintf("%d: %s", e.Status, e.Err) -} - -func (e *HTTPResponseError) Unwrap() error { return e.Err } - -// HTTPCollector is an OTLP HTTP server that collects all requests it receives. -type HTTPCollector struct { - headersMu sync.Mutex - headers http.Header - storage *Storage - - resultCh <-chan ExportResult - listener net.Listener - srv *http.Server -} - -// NewHTTPCollector returns a *HTTPCollector that is listening at the provided -// endpoint. -// -// If endpoint is an empty string, the returned collector will be listening on -// the localhost interface at an OS chosen port, not use TLS, and listen at the -// default OTLP metric endpoint path ("/v1/metrics"). If the endpoint contains -// a prefix of "https" the server will generate weak self-signed TLS -// certificates and use them to server data. If the endpoint contains a path, -// that path will be used instead of the default OTLP metric endpoint path. -// -// If errCh is not nil, the collector will respond to HTTP requests with errors -// sent on that channel. This means that if errCh is not nil Export calls will -// block until an error is received. -func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { - u, err := url.Parse(endpoint) - if err != nil { - return nil, err - } - if u.Host == "" { - u.Host = "localhost:0" - } - if u.Path == "" { - u.Path = oconf.DefaultMetricsPath - } - - c := &HTTPCollector{ - headers: http.Header{}, - storage: NewStorage(), - resultCh: resultCh, - } - - c.listener, err = net.Listen("tcp", u.Host) - if err != nil { - return nil, err - } - - mux := http.NewServeMux() - mux.Handle(u.Path, http.HandlerFunc(c.handler)) - c.srv = &http.Server{Handler: mux} - if u.Scheme == "https" { - cert, err := weakCertificate() - if err != nil { - return nil, err - } - c.srv.TLSConfig = &tls.Config{ - Certificates: []tls.Certificate{cert}, - } - go func() { _ = c.srv.ServeTLS(c.listener, "", "") }() - } else { - go func() { _ = c.srv.Serve(c.listener) }() - } - return c, nil -} - -// Shutdown shuts down the HTTP server closing all open connections and -// listeners. -func (c *HTTPCollector) Shutdown(ctx context.Context) error { - return c.srv.Shutdown(ctx) -} - -// Addr returns the net.Addr c is listening at. -func (c *HTTPCollector) Addr() net.Addr { - return c.listener.Addr() -} - -// Collect returns the Storage holding all collected requests. -func (c *HTTPCollector) Collect() *Storage { - return c.storage -} - -// Headers returns the headers received for all requests. -func (c *HTTPCollector) Headers() map[string][]string { - // Makes a copy. - c.headersMu.Lock() - defer c.headersMu.Unlock() - return c.headers.Clone() -} - -func (c *HTTPCollector) handler(w http.ResponseWriter, r *http.Request) { - c.respond(w, c.record(r)) -} - -func (c *HTTPCollector) record(r *http.Request) ExportResult { - // Currently only supports protobuf. - if v := r.Header.Get("Content-Type"); v != "application/x-protobuf" { - err := fmt.Errorf("content-type not supported: %s", v) - return ExportResult{Err: err} - } - - body, err := c.readBody(r) - if err != nil { - return ExportResult{Err: err} - } - pbRequest := &collpb.ExportMetricsServiceRequest{} - err = proto.Unmarshal(body, pbRequest) - if err != nil { - return ExportResult{ - Err: &HTTPResponseError{ - Err: err, - Status: http.StatusInternalServerError, - }, - } - } - c.storage.Add(pbRequest) - - c.headersMu.Lock() - for k, vals := range r.Header { - for _, v := range vals { - c.headers.Add(k, v) - } - } - c.headersMu.Unlock() - - if c.resultCh != nil { - return <-c.resultCh - } - return ExportResult{Err: err} -} - -func (c *HTTPCollector) readBody(r *http.Request) (body []byte, err error) { - var reader io.ReadCloser - switch r.Header.Get("Content-Encoding") { - case "gzip": - reader, err = gzip.NewReader(r.Body) - if err != nil { - _ = reader.Close() - return nil, &HTTPResponseError{ - Err: err, - Status: http.StatusInternalServerError, - } - } - default: - reader = r.Body - } - - defer func() { - cErr := reader.Close() - if err == nil && cErr != nil { - err = &HTTPResponseError{ - Err: cErr, - Status: http.StatusInternalServerError, - } - } - }() - body, err = io.ReadAll(reader) - if err != nil { - err = &HTTPResponseError{ - Err: err, - Status: http.StatusInternalServerError, - } - } - return body, err -} - -func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { - if resp.Err != nil { - w.Header().Set("Content-Type", "text/plain; charset=utf-8") - w.Header().Set("X-Content-Type-Options", "nosniff") - var e *HTTPResponseError - if errors.As(resp.Err, &e) { - for k, vals := range e.Header { - for _, v := range vals { - w.Header().Add(k, v) - } - } - w.WriteHeader(e.Status) - fmt.Fprintln(w, e.Error()) - } else { - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintln(w, resp.Err.Error()) - } - return - } - - w.Header().Set("Content-Type", "application/x-protobuf") - if resp.ResponseStatus != 0 { - w.WriteHeader(resp.ResponseStatus) - } else { - w.WriteHeader(http.StatusOK) - } - if resp.Response == nil { - _, _ = w.Write(emptyExportMetricsServiceResponse) - } else { - r, err := proto.Marshal(resp.Response) - if err != nil { - panic(err) - } - _, _ = w.Write(r) - } -} - -// Based on https://golang.org/src/crypto/tls/generate_cert.go, -// simplified and weakened. -func weakCertificate() (tls.Certificate, error) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - return tls.Certificate{}, err - } - notBefore := time.Now() - notAfter := notBefore.Add(time.Hour) - max := new(big.Int).Lsh(big.NewInt(1), 128) - sn, err := rand.Int(rand.Reader, max) - if err != nil { - return tls.Certificate{}, err - } - tmpl := x509.Certificate{ - SerialNumber: sn, - Subject: pkix.Name{Organization: []string{"otel-go"}}, - NotBefore: notBefore, - NotAfter: notAfter, - KeyUsage: x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - DNSNames: []string{"localhost"}, - IPAddresses: []net.IP{net.IPv6loopback, net.IPv4(127, 0, 0, 1)}, - } - derBytes, err := x509.CreateCertificate(rand.Reader, &tmpl, &tmpl, &priv.PublicKey, priv) - if err != nil { - return tls.Certificate{}, err - } - var certBuf bytes.Buffer - err = pem.Encode(&certBuf, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) - if err != nil { - return tls.Certificate{}, err - } - privBytes, err := x509.MarshalPKCS8PrivateKey(priv) - if err != nil { - return tls.Certificate{}, err - } - var privBuf bytes.Buffer - err = pem.Encode(&privBuf, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}) - if err != nil { - return tls.Certificate{}, err - } - return tls.X509KeyPair(certBuf.Bytes(), privBuf.Bytes()) -} diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute.go b/exporters/otlp/otlpmetric/internal/transform/attribute.go deleted file mode 100644 index d382fac3576..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/attribute.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "go.opentelemetry.io/otel/attribute" - cpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -// AttrIter transforms an attribute iterator into OTLP key-values. -func AttrIter(iter attribute.Iterator) []*cpb.KeyValue { - l := iter.Len() - if l == 0 { - return nil - } - - out := make([]*cpb.KeyValue, 0, l) - for iter.Next() { - out = append(out, KeyValue(iter.Attribute())) - } - return out -} - -// KeyValues transforms a slice of attribute KeyValues into OTLP key-values. -func KeyValues(attrs []attribute.KeyValue) []*cpb.KeyValue { - if len(attrs) == 0 { - return nil - } - - out := make([]*cpb.KeyValue, 0, len(attrs)) - for _, kv := range attrs { - out = append(out, KeyValue(kv)) - } - return out -} - -// KeyValue transforms an attribute KeyValue into an OTLP key-value. -func KeyValue(kv attribute.KeyValue) *cpb.KeyValue { - return &cpb.KeyValue{Key: string(kv.Key), Value: Value(kv.Value)} -} - -// Value transforms an attribute Value into an OTLP AnyValue. -func Value(v attribute.Value) *cpb.AnyValue { - av := new(cpb.AnyValue) - switch v.Type() { - case attribute.BOOL: - av.Value = &cpb.AnyValue_BoolValue{ - BoolValue: v.AsBool(), - } - case attribute.BOOLSLICE: - av.Value = &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: boolSliceValues(v.AsBoolSlice()), - }, - } - case attribute.INT64: - av.Value = &cpb.AnyValue_IntValue{ - IntValue: v.AsInt64(), - } - case attribute.INT64SLICE: - av.Value = &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: int64SliceValues(v.AsInt64Slice()), - }, - } - case attribute.FLOAT64: - av.Value = &cpb.AnyValue_DoubleValue{ - DoubleValue: v.AsFloat64(), - } - case attribute.FLOAT64SLICE: - av.Value = &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: float64SliceValues(v.AsFloat64Slice()), - }, - } - case attribute.STRING: - av.Value = &cpb.AnyValue_StringValue{ - StringValue: v.AsString(), - } - case attribute.STRINGSLICE: - av.Value = &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: stringSliceValues(v.AsStringSlice()), - }, - } - default: - av.Value = &cpb.AnyValue_StringValue{ - StringValue: "INVALID", - } - } - return av -} - -func boolSliceValues(vals []bool) []*cpb.AnyValue { - converted := make([]*cpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &cpb.AnyValue{ - Value: &cpb.AnyValue_BoolValue{ - BoolValue: v, - }, - } - } - return converted -} - -func int64SliceValues(vals []int64) []*cpb.AnyValue { - converted := make([]*cpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &cpb.AnyValue{ - Value: &cpb.AnyValue_IntValue{ - IntValue: v, - }, - } - } - return converted -} - -func float64SliceValues(vals []float64) []*cpb.AnyValue { - converted := make([]*cpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &cpb.AnyValue{ - Value: &cpb.AnyValue_DoubleValue{ - DoubleValue: v, - }, - } - } - return converted -} - -func stringSliceValues(vals []string) []*cpb.AnyValue { - converted := make([]*cpb.AnyValue, len(vals)) - for i, v := range vals { - converted[i] = &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{ - StringValue: v, - }, - } - } - return converted -} diff --git a/exporters/otlp/otlpmetric/internal/transform/attribute_test.go b/exporters/otlp/otlpmetric/internal/transform/attribute_test.go deleted file mode 100644 index 1dbe674951c..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/attribute_test.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/attribute" - cpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -var ( - attrBool = attribute.Bool("bool", true) - attrBoolSlice = attribute.BoolSlice("bool slice", []bool{true, false}) - attrInt = attribute.Int("int", 1) - attrIntSlice = attribute.IntSlice("int slice", []int{-1, 1}) - attrInt64 = attribute.Int64("int64", 1) - attrInt64Slice = attribute.Int64Slice("int64 slice", []int64{-1, 1}) - attrFloat64 = attribute.Float64("float64", 1) - attrFloat64Slice = attribute.Float64Slice("float64 slice", []float64{-1, 1}) - attrString = attribute.String("string", "o") - attrStringSlice = attribute.StringSlice("string slice", []string{"o", "n"}) - attrInvalid = attribute.KeyValue{ - Key: attribute.Key("invalid"), - Value: attribute.Value{}, - } - - valBoolTrue = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: true}} - valBoolFalse = &cpb.AnyValue{Value: &cpb.AnyValue_BoolValue{BoolValue: false}} - valBoolSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: []*cpb.AnyValue{valBoolTrue, valBoolFalse}, - }, - }} - valIntOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: 1}} - valIntNOne = &cpb.AnyValue{Value: &cpb.AnyValue_IntValue{IntValue: -1}} - valIntSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: []*cpb.AnyValue{valIntNOne, valIntOne}, - }, - }} - valDblOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: 1}} - valDblNOne = &cpb.AnyValue{Value: &cpb.AnyValue_DoubleValue{DoubleValue: -1}} - valDblSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: []*cpb.AnyValue{valDblNOne, valDblOne}, - }, - }} - valStrO = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "o"}} - valStrN = &cpb.AnyValue{Value: &cpb.AnyValue_StringValue{StringValue: "n"}} - valStrSlice = &cpb.AnyValue{Value: &cpb.AnyValue_ArrayValue{ - ArrayValue: &cpb.ArrayValue{ - Values: []*cpb.AnyValue{valStrO, valStrN}, - }, - }} - - kvBool = &cpb.KeyValue{Key: "bool", Value: valBoolTrue} - kvBoolSlice = &cpb.KeyValue{Key: "bool slice", Value: valBoolSlice} - kvInt = &cpb.KeyValue{Key: "int", Value: valIntOne} - kvIntSlice = &cpb.KeyValue{Key: "int slice", Value: valIntSlice} - kvInt64 = &cpb.KeyValue{Key: "int64", Value: valIntOne} - kvInt64Slice = &cpb.KeyValue{Key: "int64 slice", Value: valIntSlice} - kvFloat64 = &cpb.KeyValue{Key: "float64", Value: valDblOne} - kvFloat64Slice = &cpb.KeyValue{Key: "float64 slice", Value: valDblSlice} - kvString = &cpb.KeyValue{Key: "string", Value: valStrO} - kvStringSlice = &cpb.KeyValue{Key: "string slice", Value: valStrSlice} - kvInvalid = &cpb.KeyValue{ - Key: "invalid", - Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "INVALID"}, - }, - } -) - -type attributeTest struct { - name string - in []attribute.KeyValue - want []*cpb.KeyValue -} - -func TestAttributeTransforms(t *testing.T) { - for _, test := range []attributeTest{ - {"nil", nil, nil}, - {"empty", []attribute.KeyValue{}, nil}, - { - "invalid", - []attribute.KeyValue{attrInvalid}, - []*cpb.KeyValue{kvInvalid}, - }, - { - "bool", - []attribute.KeyValue{attrBool}, - []*cpb.KeyValue{kvBool}, - }, - { - "bool slice", - []attribute.KeyValue{attrBoolSlice}, - []*cpb.KeyValue{kvBoolSlice}, - }, - { - "int", - []attribute.KeyValue{attrInt}, - []*cpb.KeyValue{kvInt}, - }, - { - "int slice", - []attribute.KeyValue{attrIntSlice}, - []*cpb.KeyValue{kvIntSlice}, - }, - { - "int64", - []attribute.KeyValue{attrInt64}, - []*cpb.KeyValue{kvInt64}, - }, - { - "int64 slice", - []attribute.KeyValue{attrInt64Slice}, - []*cpb.KeyValue{kvInt64Slice}, - }, - { - "float64", - []attribute.KeyValue{attrFloat64}, - []*cpb.KeyValue{kvFloat64}, - }, - { - "float64 slice", - []attribute.KeyValue{attrFloat64Slice}, - []*cpb.KeyValue{kvFloat64Slice}, - }, - { - "string", - []attribute.KeyValue{attrString}, - []*cpb.KeyValue{kvString}, - }, - { - "string slice", - []attribute.KeyValue{attrStringSlice}, - []*cpb.KeyValue{kvStringSlice}, - }, - { - "all", - []attribute.KeyValue{ - attrBool, - attrBoolSlice, - attrInt, - attrIntSlice, - attrInt64, - attrInt64Slice, - attrFloat64, - attrFloat64Slice, - attrString, - attrStringSlice, - attrInvalid, - }, - []*cpb.KeyValue{ - kvBool, - kvBoolSlice, - kvInt, - kvIntSlice, - kvInt64, - kvInt64Slice, - kvFloat64, - kvFloat64Slice, - kvString, - kvStringSlice, - kvInvalid, - }, - }, - } { - t.Run(test.name, func(t *testing.T) { - t.Run("KeyValues", func(t *testing.T) { - assert.ElementsMatch(t, test.want, KeyValues(test.in)) - }) - t.Run("AttrIter", func(t *testing.T) { - s := attribute.NewSet(test.in...) - assert.ElementsMatch(t, test.want, AttrIter(s.Iter())) - }) - }) - } -} diff --git a/exporters/otlp/otlpmetric/internal/transform/doc.go b/exporters/otlp/otlpmetric/internal/transform/doc.go deleted file mode 100644 index 59c4951e211..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package transform provides transformation functionality from the -// sdk/metric/metricdata data-types into OTLP data-types. -// -// Deprecated: package transform exists for historical compatibility, it should -// not be used. -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" diff --git a/exporters/otlp/otlpmetric/internal/transform/error.go b/exporters/otlp/otlpmetric/internal/transform/error.go deleted file mode 100644 index d98f8e082c9..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/error.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "errors" - "fmt" - "strings" - - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" -) - -var ( - errUnknownAggregation = errors.New("unknown aggregation") - errUnknownTemporality = errors.New("unknown temporality") -) - -type errMetric struct { - m *mpb.Metric - err error -} - -func (e errMetric) Unwrap() error { - return e.err -} - -func (e errMetric) Error() string { - format := "invalid metric (name: %q, description: %q, unit: %q): %s" - return fmt.Sprintf(format, e.m.Name, e.m.Description, e.m.Unit, e.err) -} - -func (e errMetric) Is(target error) bool { - return errors.Is(e.err, target) -} - -// multiErr is used by the data-type transform functions to wrap multiple -// errors into a single return value. The error message will show all errors -// as a list and scope them by the datatype name that is returning them. -type multiErr struct { - datatype string - errs []error -} - -// errOrNil returns nil if e contains no errors, otherwise it returns e. -func (e *multiErr) errOrNil() error { - if len(e.errs) == 0 { - return nil - } - return e -} - -// append adds err to e. If err is a multiErr, its errs are flattened into e. -func (e *multiErr) append(err error) { - // Do not use errors.As here, this should only be flattened one layer. If - // there is a *multiErr several steps down the chain, all the errors above - // it will be discarded if errors.As is used instead. - switch other := err.(type) { - case *multiErr: - // Flatten err errors into e. - e.errs = append(e.errs, other.errs...) - default: - e.errs = append(e.errs, err) - } -} - -func (e *multiErr) Error() string { - es := make([]string, len(e.errs)) - for i, err := range e.errs { - es[i] = fmt.Sprintf("* %s", err) - } - - format := "%d errors occurred transforming %s:\n\t%s" - return fmt.Sprintf(format, len(es), e.datatype, strings.Join(es, "\n\t")) -} - -func (e *multiErr) Unwrap() error { - switch len(e.errs) { - case 0: - return nil - case 1: - return e.errs[0] - } - - // Return a multiErr without the leading error. - cp := &multiErr{ - datatype: e.datatype, - errs: make([]error, len(e.errs)-1), - } - copy(cp.errs, e.errs[1:]) - return cp -} - -func (e *multiErr) Is(target error) bool { - if len(e.errs) == 0 { - return false - } - // Check if the first error is target. - return errors.Is(e.errs[0], target) -} diff --git a/exporters/otlp/otlpmetric/internal/transform/error_test.go b/exporters/otlp/otlpmetric/internal/transform/error_test.go deleted file mode 100644 index 4f407c1b7ab..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/error_test.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -var ( - e0 = errMetric{m: pbMetrics[0], err: errUnknownAggregation} - e1 = errMetric{m: pbMetrics[1], err: errUnknownTemporality} -) - -type testingErr struct{} - -func (testingErr) Error() string { return "testing error" } - -// errFunc is a non-comparable error type. -type errFunc func() string - -func (e errFunc) Error() string { - return e() -} - -func TestMultiErr(t *testing.T) { - const name = "TestMultiErr" - me := &multiErr{datatype: name} - - t.Run("ErrOrNil", func(t *testing.T) { - require.Nil(t, me.errOrNil()) - me.errs = []error{e0} - assert.Error(t, me.errOrNil()) - }) - - var testErr testingErr - t.Run("AppendError", func(t *testing.T) { - me.append(testErr) - assert.Equal(t, testErr, me.errs[len(me.errs)-1]) - }) - - t.Run("AppendFlattens", func(t *testing.T) { - other := &multiErr{datatype: "OtherTestMultiErr", errs: []error{e1}} - me.append(other) - assert.Equal(t, e1, me.errs[len(me.errs)-1]) - }) - - t.Run("ErrorMessage", func(t *testing.T) { - // Test the overall structure of the message, but not the exact - // language so this doesn't become a change-indicator. - msg := me.Error() - lines := strings.Split(msg, "\n") - assert.Equalf(t, 4, len(lines), "expected a 4 line error message, got:\n\n%s", msg) - assert.Contains(t, msg, name) - assert.Contains(t, msg, e0.Error()) - assert.Contains(t, msg, testErr.Error()) - assert.Contains(t, msg, e1.Error()) - }) - - t.Run("ErrorIs", func(t *testing.T) { - assert.ErrorIs(t, me, errUnknownAggregation) - assert.ErrorIs(t, me, e0) - assert.ErrorIs(t, me, testErr) - assert.ErrorIs(t, me, errUnknownTemporality) - assert.ErrorIs(t, me, e1) - - errUnknown := errFunc(func() string { return "unknown error" }) - assert.NotErrorIs(t, me, errUnknown) - - var empty multiErr - assert.NotErrorIs(t, &empty, errUnknownTemporality) - }) -} diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/internal/transform/metricdata.go deleted file mode 100644 index 4ca2f958fa8..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata.go +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "fmt" - "time" - - "go.opentelemetry.io/otel/sdk/metric/metricdata" - cpb "go.opentelemetry.io/proto/otlp/common/v1" - mpb "go.opentelemetry.io/proto/otlp/metrics/v1" - rpb "go.opentelemetry.io/proto/otlp/resource/v1" -) - -// ResourceMetrics returns an OTLP ResourceMetrics generated from rm. If rm -// contains invalid ScopeMetrics, an error will be returned along with an OTLP -// ResourceMetrics that contains partial OTLP ScopeMetrics. -func ResourceMetrics(rm *metricdata.ResourceMetrics) (*mpb.ResourceMetrics, error) { - sms, err := ScopeMetrics(rm.ScopeMetrics) - return &mpb.ResourceMetrics{ - Resource: &rpb.Resource{ - Attributes: AttrIter(rm.Resource.Iter()), - }, - ScopeMetrics: sms, - SchemaUrl: rm.Resource.SchemaURL(), - }, err -} - -// ScopeMetrics returns a slice of OTLP ScopeMetrics generated from sms. If -// sms contains invalid metric values, an error will be returned along with a -// slice that contains partial OTLP ScopeMetrics. -func ScopeMetrics(sms []metricdata.ScopeMetrics) ([]*mpb.ScopeMetrics, error) { - errs := &multiErr{datatype: "ScopeMetrics"} - out := make([]*mpb.ScopeMetrics, 0, len(sms)) - for _, sm := range sms { - ms, err := Metrics(sm.Metrics) - if err != nil { - errs.append(err) - } - - out = append(out, &mpb.ScopeMetrics{ - Scope: &cpb.InstrumentationScope{ - Name: sm.Scope.Name, - Version: sm.Scope.Version, - }, - Metrics: ms, - SchemaUrl: sm.Scope.SchemaURL, - }) - } - return out, errs.errOrNil() -} - -// Metrics returns a slice of OTLP Metric generated from ms. If ms contains -// invalid metric values, an error will be returned along with a slice that -// contains partial OTLP Metrics. -func Metrics(ms []metricdata.Metrics) ([]*mpb.Metric, error) { - errs := &multiErr{datatype: "Metrics"} - out := make([]*mpb.Metric, 0, len(ms)) - for _, m := range ms { - o, err := metric(m) - if err != nil { - // Do not include invalid data. Drop the metric, report the error. - errs.append(errMetric{m: o, err: err}) - continue - } - out = append(out, o) - } - return out, errs.errOrNil() -} - -func metric(m metricdata.Metrics) (*mpb.Metric, error) { - var err error - out := &mpb.Metric{ - Name: m.Name, - Description: m.Description, - Unit: string(m.Unit), - } - switch a := m.Data.(type) { - case metricdata.Gauge[int64]: - out.Data = Gauge[int64](a) - case metricdata.Gauge[float64]: - out.Data = Gauge[float64](a) - case metricdata.Sum[int64]: - out.Data, err = Sum[int64](a) - case metricdata.Sum[float64]: - out.Data, err = Sum[float64](a) - case metricdata.Histogram[int64]: - out.Data, err = Histogram(a) - case metricdata.Histogram[float64]: - out.Data, err = Histogram(a) - case metricdata.ExponentialHistogram[int64]: - out.Data, err = ExponentialHistogram(a) - case metricdata.ExponentialHistogram[float64]: - out.Data, err = ExponentialHistogram(a) - default: - return out, fmt.Errorf("%w: %T", errUnknownAggregation, a) - } - return out, err -} - -// Gauge returns an OTLP Metric_Gauge generated from g. -func Gauge[N int64 | float64](g metricdata.Gauge[N]) *mpb.Metric_Gauge { - return &mpb.Metric_Gauge{ - Gauge: &mpb.Gauge{ - DataPoints: DataPoints(g.DataPoints), - }, - } -} - -// Sum returns an OTLP Metric_Sum generated from s. An error is returned -// if the temporality of s is unknown. -func Sum[N int64 | float64](s metricdata.Sum[N]) (*mpb.Metric_Sum, error) { - t, err := Temporality(s.Temporality) - if err != nil { - return nil, err - } - return &mpb.Metric_Sum{ - Sum: &mpb.Sum{ - AggregationTemporality: t, - IsMonotonic: s.IsMonotonic, - DataPoints: DataPoints(s.DataPoints), - }, - }, nil -} - -// DataPoints returns a slice of OTLP NumberDataPoint generated from dPts. -func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.NumberDataPoint { - out := make([]*mpb.NumberDataPoint, 0, len(dPts)) - for _, dPt := range dPts { - ndp := &mpb.NumberDataPoint{ - Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: timeUnixNano(dPt.StartTime), - TimeUnixNano: timeUnixNano(dPt.Time), - } - switch v := any(dPt.Value).(type) { - case int64: - ndp.Value = &mpb.NumberDataPoint_AsInt{ - AsInt: v, - } - case float64: - ndp.Value = &mpb.NumberDataPoint_AsDouble{ - AsDouble: v, - } - } - out = append(out, ndp) - } - return out -} - -// Histogram returns an OTLP Metric_Histogram generated from h. An error is -// returned if the temporality of h is unknown. -func Histogram[N int64 | float64](h metricdata.Histogram[N]) (*mpb.Metric_Histogram, error) { - t, err := Temporality(h.Temporality) - if err != nil { - return nil, err - } - return &mpb.Metric_Histogram{ - Histogram: &mpb.Histogram{ - AggregationTemporality: t, - DataPoints: HistogramDataPoints(h.DataPoints), - }, - }, nil -} - -// HistogramDataPoints returns a slice of OTLP HistogramDataPoint generated -// from dPts. -func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint[N]) []*mpb.HistogramDataPoint { - out := make([]*mpb.HistogramDataPoint, 0, len(dPts)) - for _, dPt := range dPts { - sum := float64(dPt.Sum) - hdp := &mpb.HistogramDataPoint{ - Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: timeUnixNano(dPt.StartTime), - TimeUnixNano: timeUnixNano(dPt.Time), - Count: dPt.Count, - Sum: &sum, - BucketCounts: dPt.BucketCounts, - ExplicitBounds: dPt.Bounds, - } - if v, ok := dPt.Min.Value(); ok { - vF64 := float64(v) - hdp.Min = &vF64 - } - if v, ok := dPt.Max.Value(); ok { - vF64 := float64(v) - hdp.Max = &vF64 - } - out = append(out, hdp) - } - return out -} - -// ExponentialHistogram returns an OTLP Metric_ExponentialHistogram generated from h. An error is -// returned if the temporality of h is unknown. -func ExponentialHistogram[N int64 | float64](h metricdata.ExponentialHistogram[N]) (*mpb.Metric_ExponentialHistogram, error) { - t, err := Temporality(h.Temporality) - if err != nil { - return nil, err - } - return &mpb.Metric_ExponentialHistogram{ - ExponentialHistogram: &mpb.ExponentialHistogram{ - AggregationTemporality: t, - DataPoints: ExponentialHistogramDataPoints(h.DataPoints), - }, - }, nil -} - -// ExponentialHistogramDataPoints returns a slice of OTLP ExponentialHistogramDataPoint generated -// from dPts. -func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.ExponentialHistogramDataPoint[N]) []*mpb.ExponentialHistogramDataPoint { - out := make([]*mpb.ExponentialHistogramDataPoint, 0, len(dPts)) - for _, dPt := range dPts { - sum := float64(dPt.Sum) - ehdp := &mpb.ExponentialHistogramDataPoint{ - Attributes: AttrIter(dPt.Attributes.Iter()), - StartTimeUnixNano: timeUnixNano(dPt.StartTime), - TimeUnixNano: timeUnixNano(dPt.Time), - Count: dPt.Count, - Sum: &sum, - Scale: dPt.Scale, - ZeroCount: dPt.ZeroCount, - - Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), - Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), - } - if v, ok := dPt.Min.Value(); ok { - vF64 := float64(v) - ehdp.Min = &vF64 - } - if v, ok := dPt.Max.Value(); ok { - vF64 := float64(v) - ehdp.Max = &vF64 - } - out = append(out, ehdp) - } - return out -} - -// ExponentialHistogramDataPointBuckets returns an OTLP ExponentialHistogramDataPoint_Buckets generated -// from bucket. -func ExponentialHistogramDataPointBuckets(bucket metricdata.ExponentialBucket) *mpb.ExponentialHistogramDataPoint_Buckets { - return &mpb.ExponentialHistogramDataPoint_Buckets{ - Offset: bucket.Offset, - BucketCounts: bucket.Counts, - } -} - -// Temporality returns an OTLP AggregationTemporality generated from t. If t -// is unknown, an error is returned along with the invalid -// AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED. -func Temporality(t metricdata.Temporality) (mpb.AggregationTemporality, error) { - switch t { - case metricdata.DeltaTemporality: - return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, nil - case metricdata.CumulativeTemporality: - return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, nil - default: - err := fmt.Errorf("%w: %s", errUnknownTemporality, t) - return mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_UNSPECIFIED, err - } -} - -// timeUnixNano returns t as a Unix time, the number of nanoseconds elapsed -// since January 1, 1970 UTC as uint64. -// The result is undefined if the Unix time -// in nanoseconds cannot be represented by an int64 -// (a date before the year 1678 or after 2262). -// timeUnixNano on the zero Time returns 0. -// The result does not depend on the location associated with t. -func timeUnixNano(t time.Time) uint64 { - if t.IsZero() { - return 0 - } - return uint64(t.UnixNano()) -} diff --git a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go deleted file mode 100644 index e733e7846e0..00000000000 --- a/exporters/otlp/otlpmetric/internal/transform/metricdata_test.go +++ /dev/null @@ -1,610 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package transform // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/internal/transform" - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "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.21.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" -) - -type unknownAggT struct { - metricdata.Aggregation -} - -var ( - // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) - end = start.Add(30 * time.Second) - - alice = attribute.NewSet(attribute.String("user", "alice")) - bob = attribute.NewSet(attribute.String("user", "bob")) - - pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, - }} - pbBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, - }} - - minA, maxA, sumA = 2.0, 4.0, 90.0 - minB, maxB, sumB = 4.0, 150.0, 234.0 - otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{{ - Attributes: alice, - StartTime: start, - Time: end, - Count: 30, - Bounds: []float64{1, 5}, - BucketCounts: []uint64{0, 30, 0}, - Min: metricdata.NewExtrema(int64(minA)), - Max: metricdata.NewExtrema(int64(maxA)), - Sum: int64(sumA), - }, { - Attributes: bob, - StartTime: start, - Time: end, - Count: 3, - Bounds: []float64{1, 5}, - BucketCounts: []uint64{0, 1, 2}, - Min: metricdata.NewExtrema(int64(minB)), - Max: metricdata.NewExtrema(int64(maxB)), - Sum: int64(sumB), - }} - otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{{ - Attributes: alice, - StartTime: start, - Time: end, - Count: 30, - Bounds: []float64{1, 5}, - BucketCounts: []uint64{0, 30, 0}, - Min: metricdata.NewExtrema(minA), - Max: metricdata.NewExtrema(maxA), - Sum: sumA, - }, { - Attributes: bob, - StartTime: start, - Time: end, - Count: 3, - Bounds: []float64{1, 5}, - BucketCounts: []uint64{0, 1, 2}, - Min: metricdata.NewExtrema(minB), - Max: metricdata.NewExtrema(maxB), - Sum: sumB, - }} - - otelEBucketA = metricdata.ExponentialBucket{ - Offset: 5, - Counts: []uint64{0, 5, 0, 5}, - } - otelEBucketB = metricdata.ExponentialBucket{ - Offset: 3, - Counts: []uint64{0, 5, 0, 5}, - } - otelEBucketsC = metricdata.ExponentialBucket{ - Offset: 5, - Counts: []uint64{0, 1}, - } - otelEBucketsD = metricdata.ExponentialBucket{ - Offset: 3, - Counts: []uint64{0, 1}, - } - - otelEHDPInt64 = []metricdata.ExponentialHistogramDataPoint[int64]{{ - Attributes: alice, - StartTime: start, - Time: end, - Count: 30, - Scale: 2, - ZeroCount: 10, - PositiveBucket: otelEBucketA, - NegativeBucket: otelEBucketB, - ZeroThreshold: .01, - Min: metricdata.NewExtrema(int64(minA)), - Max: metricdata.NewExtrema(int64(maxA)), - Sum: int64(sumA), - }, { - Attributes: bob, - StartTime: start, - Time: end, - Count: 3, - Scale: 4, - ZeroCount: 1, - PositiveBucket: otelEBucketsC, - NegativeBucket: otelEBucketsD, - ZeroThreshold: .02, - Min: metricdata.NewExtrema(int64(minB)), - Max: metricdata.NewExtrema(int64(maxB)), - Sum: int64(sumB), - }} - otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{{ - Attributes: alice, - StartTime: start, - Time: end, - Count: 30, - Scale: 2, - ZeroCount: 10, - PositiveBucket: otelEBucketA, - NegativeBucket: otelEBucketB, - ZeroThreshold: .01, - Min: metricdata.NewExtrema(minA), - Max: metricdata.NewExtrema(maxA), - Sum: sumA, - }, { - Attributes: bob, - StartTime: start, - Time: end, - Count: 3, - Scale: 4, - ZeroCount: 1, - PositiveBucket: otelEBucketsC, - NegativeBucket: otelEBucketsD, - ZeroThreshold: .02, - Min: metricdata.NewExtrema(minB), - Max: metricdata.NewExtrema(maxB), - Sum: sumB, - }} - - pbHDP = []*mpb.HistogramDataPoint{{ - Attributes: []*cpb.KeyValue{pbAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Count: 30, - Sum: &sumA, - ExplicitBounds: []float64{1, 5}, - BucketCounts: []uint64{0, 30, 0}, - Min: &minA, - Max: &maxA, - }, { - Attributes: []*cpb.KeyValue{pbBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Count: 3, - Sum: &sumB, - ExplicitBounds: []float64{1, 5}, - BucketCounts: []uint64{0, 1, 2}, - Min: &minB, - Max: &maxB, - }} - - pbEHDPBA = &mpb.ExponentialHistogramDataPoint_Buckets{ - Offset: 5, - BucketCounts: []uint64{0, 5, 0, 5}, - } - pbEHDPBB = &mpb.ExponentialHistogramDataPoint_Buckets{ - Offset: 3, - BucketCounts: []uint64{0, 5, 0, 5}, - } - pbEHDPBC = &mpb.ExponentialHistogramDataPoint_Buckets{ - Offset: 5, - BucketCounts: []uint64{0, 1}, - } - pbEHDPBD = &mpb.ExponentialHistogramDataPoint_Buckets{ - Offset: 3, - BucketCounts: []uint64{0, 1}, - } - - pbEHDP = []*mpb.ExponentialHistogramDataPoint{{ - Attributes: []*cpb.KeyValue{pbAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Count: 30, - Sum: &sumA, - Scale: 2, - ZeroCount: 10, - Positive: pbEHDPBA, - Negative: pbEHDPBB, - Min: &minA, - Max: &maxA, - }, { - Attributes: []*cpb.KeyValue{pbBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Count: 3, - Sum: &sumB, - Scale: 4, - ZeroCount: 1, - Positive: pbEHDPBC, - Negative: pbEHDPBD, - Min: &minB, - Max: &maxB, - }} - - otelHistInt64 = metricdata.Histogram[int64]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: otelHDPInt64, - } - otelHistFloat64 = metricdata.Histogram[float64]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: otelHDPFloat64, - } - invalidTemporality metricdata.Temporality - otelHistInvalid = metricdata.Histogram[int64]{ - Temporality: invalidTemporality, - DataPoints: otelHDPInt64, - } - - otelExpoHistInt64 = metricdata.ExponentialHistogram[int64]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: otelEHDPInt64, - } - otelExpoHistFloat64 = metricdata.ExponentialHistogram[float64]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: otelEHDPFloat64, - } - otelExpoHistInvalid = metricdata.ExponentialHistogram[int64]{ - Temporality: invalidTemporality, - DataPoints: otelEHDPInt64, - } - - pbHist = &mpb.Histogram{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbHDP, - } - - pbExpoHist = &mpb.ExponentialHistogram{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbEHDP, - } - - otelDPtsInt64 = []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1}, - {Attributes: bob, StartTime: start, Time: end, Value: 2}, - } - otelDPtsFloat64 = []metricdata.DataPoint[float64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, - {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, - } - - pbDPtsInt64 = []*mpb.NumberDataPoint{ - { - Attributes: []*cpb.KeyValue{pbAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, - }, - { - Attributes: []*cpb.KeyValue{pbBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, - }, - } - pbDPtsFloat64 = []*mpb.NumberDataPoint{ - { - Attributes: []*cpb.KeyValue{pbAlice}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, - }, - { - Attributes: []*cpb.KeyValue{pbBob}, - StartTimeUnixNano: uint64(start.UnixNano()), - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, - }, - } - - otelSumInt64 = metricdata.Sum[int64]{ - Temporality: metricdata.CumulativeTemporality, - IsMonotonic: true, - DataPoints: otelDPtsInt64, - } - otelSumFloat64 = metricdata.Sum[float64]{ - Temporality: metricdata.DeltaTemporality, - IsMonotonic: false, - DataPoints: otelDPtsFloat64, - } - otelSumInvalid = metricdata.Sum[float64]{ - Temporality: invalidTemporality, - IsMonotonic: false, - DataPoints: otelDPtsFloat64, - } - - pbSumInt64 = &mpb.Sum{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE, - IsMonotonic: true, - DataPoints: pbDPtsInt64, - } - pbSumFloat64 = &mpb.Sum{ - AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - IsMonotonic: false, - DataPoints: pbDPtsFloat64, - } - - otelGaugeInt64 = metricdata.Gauge[int64]{DataPoints: otelDPtsInt64} - otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} - otelGaugeZeroStartTime = metricdata.Gauge[int64]{DataPoints: []metricdata.DataPoint[int64]{{Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}}} - - pbGaugeInt64 = &mpb.Gauge{DataPoints: pbDPtsInt64} - pbGaugeFloat64 = &mpb.Gauge{DataPoints: pbDPtsFloat64} - pbGaugeZeroStartTime = &mpb.Gauge{DataPoints: []*mpb.NumberDataPoint{ - { - Attributes: []*cpb.KeyValue{pbAlice}, - StartTimeUnixNano: 0, - TimeUnixNano: uint64(end.UnixNano()), - Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, - }, - }} - - unknownAgg unknownAggT - otelMetrics = []metricdata.Metrics{ - { - Name: "int64-gauge", - Description: "Gauge with int64 values", - Unit: "1", - Data: otelGaugeInt64, - }, - { - Name: "float64-gauge", - Description: "Gauge with float64 values", - Unit: "1", - Data: otelGaugeFloat64, - }, - { - Name: "int64-sum", - Description: "Sum with int64 values", - Unit: "1", - Data: otelSumInt64, - }, - { - Name: "float64-sum", - Description: "Sum with float64 values", - Unit: "1", - Data: otelSumFloat64, - }, - { - Name: "invalid-sum", - Description: "Sum with invalid temporality", - Unit: "1", - Data: otelSumInvalid, - }, - { - Name: "int64-histogram", - Description: "Histogram", - Unit: "1", - Data: otelHistInt64, - }, - { - Name: "float64-histogram", - Description: "Histogram", - Unit: "1", - Data: otelHistFloat64, - }, - { - Name: "invalid-histogram", - Description: "Invalid histogram", - Unit: "1", - Data: otelHistInvalid, - }, - { - Name: "unknown", - Description: "Unknown aggregation", - Unit: "1", - Data: unknownAgg, - }, - { - Name: "int64-ExponentialHistogram", - Description: "Exponential Histogram", - Unit: "1", - Data: otelExpoHistInt64, - }, - { - Name: "float64-ExponentialHistogram", - Description: "Exponential Histogram", - Unit: "1", - Data: otelExpoHistFloat64, - }, - { - Name: "invalid-ExponentialHistogram", - Description: "Invalid Exponential Histogram", - Unit: "1", - Data: otelExpoHistInvalid, - }, - { - Name: "zero-time", - Description: "Gauge with 0 StartTime", - Unit: "1", - Data: otelGaugeZeroStartTime, - }, - } - - pbMetrics = []*mpb.Metric{ - { - Name: "int64-gauge", - Description: "Gauge with int64 values", - Unit: "1", - Data: &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, - }, - { - Name: "float64-gauge", - Description: "Gauge with float64 values", - Unit: "1", - Data: &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, - }, - { - Name: "int64-sum", - Description: "Sum with int64 values", - Unit: "1", - Data: &mpb.Metric_Sum{Sum: pbSumInt64}, - }, - { - Name: "float64-sum", - Description: "Sum with float64 values", - Unit: "1", - Data: &mpb.Metric_Sum{Sum: pbSumFloat64}, - }, - { - Name: "int64-histogram", - Description: "Histogram", - Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, - }, - { - Name: "float64-histogram", - Description: "Histogram", - Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, - }, - { - Name: "int64-ExponentialHistogram", - Description: "Exponential Histogram", - Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, - }, - { - Name: "float64-ExponentialHistogram", - Description: "Exponential Histogram", - Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, - }, - { - Name: "zero-time", - Description: "Gauge with 0 StartTime", - Unit: "1", - Data: &mpb.Metric_Gauge{Gauge: pbGaugeZeroStartTime}, - }, - } - - otelScopeMetrics = []metricdata.ScopeMetrics{{ - Scope: instrumentation.Scope{ - Name: "test/code/path", - Version: "v0.1.0", - SchemaURL: semconv.SchemaURL, - }, - Metrics: otelMetrics, - }} - - pbScopeMetrics = []*mpb.ScopeMetrics{{ - Scope: &cpb.InstrumentationScope{ - Name: "test/code/path", - Version: "v0.1.0", - }, - Metrics: pbMetrics, - SchemaUrl: semconv.SchemaURL, - }} - - otelRes = resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("test server"), - semconv.ServiceVersion("v0.1.0"), - ) - - pbRes = &rpb.Resource{ - Attributes: []*cpb.KeyValue{ - { - Key: "service.name", - Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "test server"}, - }, - }, - { - Key: "service.version", - Value: &cpb.AnyValue{ - Value: &cpb.AnyValue_StringValue{StringValue: "v0.1.0"}, - }, - }, - }, - } - - otelResourceMetrics = &metricdata.ResourceMetrics{ - Resource: otelRes, - ScopeMetrics: otelScopeMetrics, - } - - pbResourceMetrics = &mpb.ResourceMetrics{ - Resource: pbRes, - ScopeMetrics: pbScopeMetrics, - SchemaUrl: semconv.SchemaURL, - } -) - -func TestTransformations(t *testing.T) { - // Run tests from the "bottom-up" of the metricdata data-types and halt - // when a failure occurs to ensure the clearest failure message (as - // opposed to the opposite of testing from the top-down which will obscure - // errors deep inside the structs). - - // DataPoint types. - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) - assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) - require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) - assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) - - // Aggregations. - h, err := Histogram(otelHistInt64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) - h, err = Histogram(otelHistFloat64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) - h, err = Histogram(otelHistInvalid) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.Nil(t, h) - - s, err := Sum[int64](otelSumInt64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumInt64}, s) - s, err = Sum[float64](otelSumFloat64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Sum{Sum: pbSumFloat64}, s) - s, err = Sum[float64](otelSumInvalid) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.Nil(t, s) - - assert.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeInt64}, Gauge[int64](otelGaugeInt64)) - require.Equal(t, &mpb.Metric_Gauge{Gauge: pbGaugeFloat64}, Gauge[float64](otelGaugeFloat64)) - - e, err := ExponentialHistogram(otelExpoHistInt64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) - e, err = ExponentialHistogram(otelExpoHistFloat64) - assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) - e, err = ExponentialHistogram(otelExpoHistInvalid) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.Nil(t, e) - - // Metrics. - m, err := Metrics(otelMetrics) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.ErrorIs(t, err, errUnknownAggregation) - require.Equal(t, pbMetrics, m) - - // Scope Metrics. - sm, err := ScopeMetrics(otelScopeMetrics) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.ErrorIs(t, err, errUnknownAggregation) - require.Equal(t, pbScopeMetrics, sm) - - // Resource Metrics. - rm, err := ResourceMetrics(otelResourceMetrics) - assert.ErrorIs(t, err, errUnknownTemporality) - assert.ErrorIs(t, err, errUnknownAggregation) - require.Equal(t, pbResourceMetrics, rm) -} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f525d64427c..2889d41e240 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -24,6 +24,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect @@ -45,5 +46,3 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../ replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 9397989cf3d..f66691565f5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -1,5 +1,6 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -18,6 +19,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 09d4232baf4..0e238cf6970 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -23,6 +23,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect @@ -45,5 +46,3 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../ replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace - -replace go.opentelemetry.io/otel/exporters/otlp/internal/retry => ../../internal/retry diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 9397989cf3d..f66691565f5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -1,5 +1,6 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -18,6 +19,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index cef7950ed8a..2650287870b 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,14 +3,12 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.19 require ( - github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.17.0 go.opentelemetry.io/otel/sdk v1.17.0 go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.57.0 google.golang.org/protobuf v1.31.0 ) @@ -18,17 +16,12 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.11.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index f6d29fdda91..e8634b6320f 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -1,5 +1,3 @@ -github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= -github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -8,45 +6,35 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlptrace/internal/doc.go b/exporters/otlp/otlptrace/internal/doc.go deleted file mode 100644 index d1c019d8bb2..00000000000 --- a/exporters/otlp/otlptrace/internal/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package internal contains common functionality for all OTLP trace exporters. -// -// Deprecated: package internal exists for historical compatibility, it should -// not be used. -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" diff --git a/exporters/otlp/otlptrace/internal/envconfig/doc.go b/exporters/otlp/otlptrace/internal/envconfig/doc.go deleted file mode 100644 index f2887ee8ffb..00000000000 --- a/exporters/otlp/otlptrace/internal/envconfig/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package envconfig contains common functionality for all OTLP trace exporters -// to handle environment variable configuration. -// -// Deprecated: package envconfig exists for historical compatibility, it should -// not be used. -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig.go deleted file mode 100644 index 04d87af9e59..00000000000 --- a/exporters/otlp/otlptrace/internal/envconfig/envconfig.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "net/url" - "strconv" - "strings" - "time" - - "go.opentelemetry.io/otel/internal/global" -) - -// ConfigFn is the generic function used to set a config. -type ConfigFn func(*EnvOptionsReader) - -// EnvOptionsReader reads the required environment variables. -type EnvOptionsReader struct { - GetEnv func(string) string - ReadFile func(string) ([]byte, error) - Namespace string -} - -// Apply runs every ConfigFn. -func (e *EnvOptionsReader) Apply(opts ...ConfigFn) { - for _, o := range opts { - o(e) - } -} - -// GetEnvValue gets an OTLP environment variable value of the specified key -// using the GetEnv function. -// This function prepends the OTLP specified namespace to all key lookups. -func (e *EnvOptionsReader) GetEnvValue(key string) (string, bool) { - v := strings.TrimSpace(e.GetEnv(keyWithNamespace(e.Namespace, key))) - return v, v != "" -} - -// WithString retrieves the specified config and passes it to ConfigFn as a string. -func WithString(n string, fn func(string)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - fn(v) - } - } -} - -// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn. -func WithBool(n string, fn func(bool)) ConfigFn { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - b := strings.ToLower(v) == "true" - fn(b) - } - } -} - -// WithDuration retrieves the specified config and passes it to ConfigFn as a duration. -func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - d, err := strconv.Atoi(v) - if err != nil { - global.Error(err, "parse duration", "input", v) - return - } - fn(time.Duration(d) * time.Millisecond) - } - } -} - -// WithHeaders retrieves the specified config and passes it to ConfigFn as a map of HTTP headers. -func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - fn(stringToHeader(v)) - } - } -} - -// WithURL retrieves the specified config and passes it to ConfigFn as a net/url.URL. -func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - u, err := url.Parse(v) - if err != nil { - global.Error(err, "parse url", "input", v) - return - } - fn(u) - } - } -} - -// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn. -func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn { - return func(e *EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - b, err := e.ReadFile(v) - if err != nil { - global.Error(err, "read tls ca cert file", "file", v) - return - } - c, err := createCertPool(b) - if err != nil { - global.Error(err, "create tls cert pool") - return - } - fn(c) - } - } -} - -// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn. -func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn { - return func(e *EnvOptionsReader) { - vc, okc := e.GetEnvValue(nc) - vk, okk := e.GetEnvValue(nk) - if !okc || !okk { - return - } - cert, err := e.ReadFile(vc) - if err != nil { - global.Error(err, "read tls client cert", "file", vc) - return - } - key, err := e.ReadFile(vk) - if err != nil { - global.Error(err, "read tls client key", "file", vk) - return - } - crt, err := tls.X509KeyPair(cert, key) - if err != nil { - global.Error(err, "create tls client key pair") - return - } - fn(crt) - } -} - -func keyWithNamespace(ns, key string) string { - if ns == "" { - return key - } - return fmt.Sprintf("%s_%s", ns, key) -} - -func stringToHeader(value string) map[string]string { - headersPairs := strings.Split(value, ",") - headers := make(map[string]string) - - for _, header := range headersPairs { - n, v, found := strings.Cut(header, "=") - if !found { - global.Error(errors.New("missing '="), "parse headers", "input", header) - continue - } - name, err := url.QueryUnescape(n) - if err != nil { - global.Error(err, "escape header key", "key", n) - continue - } - trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) - if err != nil { - global.Error(err, "escape header value", "value", v) - continue - } - trimmedValue := strings.TrimSpace(value) - - headers[trimmedName] = trimmedValue - } - - return headers -} - -func createCertPool(certBytes []byte) (*x509.CertPool, error) { - cp := x509.NewCertPool() - if ok := cp.AppendCertsFromPEM(certBytes); !ok { - return nil, errors.New("failed to append certificate to the cert pool") - } - return cp, nil -} diff --git a/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go deleted file mode 100644 index 0c959a1f3fd..00000000000 --- a/exporters/otlp/otlptrace/internal/envconfig/envconfig_test.go +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package envconfig - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -const WeakKey = ` ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIEbrSPmnlSOXvVzxCyv+VR3a0HDeUTvOcqrdssZ2k4gFoAoGCCqGSM49 -AwEHoUQDQgAEDMTfv75J315C3K9faptS9iythKOMEeV/Eep73nWX531YAkmmwBSB -2dXRD/brsgLnfG57WEpxZuY7dPRbxu33BA== ------END EC PRIVATE KEY----- -` - -const WeakCertificate = ` ------BEGIN CERTIFICATE----- -MIIBjjCCATWgAwIBAgIUKQSMC66MUw+kPp954ZYOcyKAQDswCgYIKoZIzj0EAwIw -EjEQMA4GA1UECgwHb3RlbC1nbzAeFw0yMjEwMTkwMDA5MTlaFw0yMzEwMTkwMDA5 -MTlaMBIxEDAOBgNVBAoMB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC -AAQMxN+/vknfXkLcr19qm1L2LK2Eo4wR5X8R6nvedZfnfVgCSabAFIHZ1dEP9uuy -Aud8bntYSnFm5jt09FvG7fcEo2kwZzAdBgNVHQ4EFgQUicGuhnTTkYLZwofXMNLK -SHFeCWgwHwYDVR0jBBgwFoAUicGuhnTTkYLZwofXMNLKSHFeCWgwDwYDVR0TAQH/ -BAUwAwEB/zAUBgNVHREEDTALgglsb2NhbGhvc3QwCgYIKoZIzj0EAwIDRwAwRAIg -Lfma8FnnxeSOi6223AsFfYwsNZ2RderNsQrS0PjEHb0CIBkrWacqARUAu7uT4cGu -jVcIxYQqhId5L8p/mAv2PWZS ------END CERTIFICATE----- -` - -type testOption struct { - TestString string - TestBool bool - TestDuration time.Duration - TestHeaders map[string]string - TestURL *url.URL - TestTLS *tls.Config -} - -func TestEnvConfig(t *testing.T) { - parsedURL, err := url.Parse("https://example.com") - assert.NoError(t, err) - - options := []testOption{} - for _, testcase := range []struct { - name string - reader EnvOptionsReader - configs []ConfigFn - expectedOptions []testOption - }{ - { - name: "with no namespace and a matching key", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{ - { - TestString: "world", - }, - }, - }, - { - name: "with no namespace and a non-matching key", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HOLA", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with a namespace and a matching key", - reader: EnvOptionsReader{ - Namespace: "MY_NAMESPACE", - GetEnv: func(n string) string { - if n == "MY_NAMESPACE_HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{ - { - TestString: "world", - }, - }, - }, - { - name: "with no namespace and a non-matching key", - reader: EnvOptionsReader{ - Namespace: "MY_NAMESPACE", - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithString("HELLO", func(v string) { - options = append(options, testOption{TestString: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with a bool config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "true" - } else if n == "WORLD" { - return "false" - } - return "" - }, - }, - configs: []ConfigFn{ - WithBool("HELLO", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - WithBool("WORLD", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - }, - expectedOptions: []testOption{ - { - TestBool: true, - }, - { - TestBool: false, - }, - }, - }, - { - name: "with an invalid bool config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithBool("HELLO", func(b bool) { - options = append(options, testOption{TestBool: b}) - }), - }, - expectedOptions: []testOption{ - { - TestBool: false, - }, - }, - }, - { - name: "with a duration config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "60" - } - return "" - }, - }, - configs: []ConfigFn{ - WithDuration("HELLO", func(v time.Duration) { - options = append(options, testOption{TestDuration: v}) - }), - }, - expectedOptions: []testOption{ - { - TestDuration: 60_000_000, // 60 milliseconds - }, - }, - }, - { - name: "with an invalid duration config", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithDuration("HELLO", func(v time.Duration) { - options = append(options, testOption{TestDuration: v}) - }), - }, - expectedOptions: []testOption{}, - }, - { - name: "with headers", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "userId=42,userName=alice" - } - return "" - }, - }, - configs: []ConfigFn{ - WithHeaders("HELLO", func(v map[string]string) { - options = append(options, testOption{TestHeaders: v}) - }), - }, - expectedOptions: []testOption{ - { - TestHeaders: map[string]string{ - "userId": "42", - "userName": "alice", - }, - }, - }, - }, - { - name: "with invalid headers", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "world" - } - return "" - }, - }, - configs: []ConfigFn{ - WithHeaders("HELLO", func(v map[string]string) { - options = append(options, testOption{TestHeaders: v}) - }), - }, - expectedOptions: []testOption{ - { - TestHeaders: map[string]string{}, - }, - }, - }, - { - name: "with URL", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "https://example.com" - } - return "" - }, - }, - configs: []ConfigFn{ - WithURL("HELLO", func(v *url.URL) { - options = append(options, testOption{TestURL: v}) - }), - }, - expectedOptions: []testOption{ - { - TestURL: parsedURL, - }, - }, - }, - { - name: "with invalid URL", - reader: EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "HELLO" { - return "i nvalid://url" - } - return "" - }, - }, - configs: []ConfigFn{ - WithURL("HELLO", func(v *url.URL) { - options = append(options, testOption{TestURL: v}) - }), - }, - expectedOptions: []testOption{}, - }, - } { - t.Run(testcase.name, func(t *testing.T) { - testcase.reader.Apply(testcase.configs...) - assert.Equal(t, testcase.expectedOptions, options) - options = []testOption{} - }) - } -} - -func TestWithTLSConfig(t *testing.T) { - pool, err := createCertPool([]byte(WeakCertificate)) - assert.NoError(t, err) - - reader := EnvOptionsReader{ - GetEnv: func(n string) string { - if n == "CERTIFICATE" { - return "/path/cert.pem" - } - return "" - }, - ReadFile: func(p string) ([]byte, error) { - if p == "/path/cert.pem" { - return []byte(WeakCertificate), nil - } - return []byte{}, nil - }, - } - - var option testOption - reader.Apply( - WithCertPool("CERTIFICATE", func(cp *x509.CertPool) { - option = testOption{TestTLS: &tls.Config{RootCAs: cp}} - }), - ) - - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, pool.Subjects(), option.TestTLS.RootCAs.Subjects()) -} - -func TestWithClientCert(t *testing.T) { - cert, err := tls.X509KeyPair([]byte(WeakCertificate), []byte(WeakKey)) - assert.NoError(t, err) - - reader := EnvOptionsReader{ - GetEnv: func(n string) string { - switch n { - case "CLIENT_CERTIFICATE": - return "/path/tls.crt" - case "CLIENT_KEY": - return "/path/tls.key" - } - return "" - }, - ReadFile: func(n string) ([]byte, error) { - switch n { - case "/path/tls.crt": - return []byte(WeakCertificate), nil - case "/path/tls.key": - return []byte(WeakKey), nil - } - return []byte{}, nil - }, - } - - var option testOption - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Equal(t, cert, option.TestTLS.Certificates[0]) - - reader.ReadFile = func(s string) ([]byte, error) { return nil, errors.New("oops") } - option.TestTLS = nil - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Nil(t, option.TestTLS) - - reader.GetEnv = func(s string) string { return "" } - option.TestTLS = nil - reader.Apply( - WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { - option = testOption{TestTLS: &tls.Config{Certificates: []tls.Certificate{c}}} - }), - ) - assert.Nil(t, option.TestTLS) -} - -func TestStringToHeader(t *testing.T) { - tests := []struct { - name string - value string - want map[string]string - }{ - { - name: "simple test", - value: "userId=alice", - want: map[string]string{"userId": "alice"}, - }, - { - name: "simple test with spaces", - value: " userId = alice ", - want: map[string]string{"userId": "alice"}, - }, - { - name: "multiples headers encoded", - value: "userId=alice,serverNode=DF%3A28,isProduction=false", - want: map[string]string{ - "userId": "alice", - "serverNode": "DF:28", - "isProduction": "false", - }, - }, - { - name: "invalid headers format", - value: "userId:alice", - want: map[string]string{}, - }, - { - name: "invalid key", - value: "%XX=missing,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - { - name: "invalid value", - value: "missing=%XX,userId=alice", - want: map[string]string{ - "userId": "alice", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equal(t, tt.want, stringToHeader(tt.value)) - }) - } -} diff --git a/exporters/otlp/otlptrace/internal/header.go b/exporters/otlp/otlptrace/internal/header.go deleted file mode 100644 index 65694a9019a..00000000000 --- a/exporters/otlp/otlptrace/internal/header.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal" - -import ( - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" -) - -// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{ .Version }" -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent -func GetUserAgentHeader() string { - return "OTel OTLP Exporter Go/" + otlptrace.Version() -} diff --git a/exporters/otlp/otlptrace/internal/header_test.go b/exporters/otlp/otlptrace/internal/header_test.go deleted file mode 100644 index d93340fc0d6..00000000000 --- a/exporters/otlp/otlptrace/internal/header_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package internal - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestGetUserAgentHeader(t *testing.T) { - require.Regexp(t, "OTel OTLP Exporter Go/1\\..*", GetUserAgentHeader()) -} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/doc.go b/exporters/otlp/otlptrace/internal/otlpconfig/doc.go deleted file mode 100644 index 41047e4de95..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package otlpconfig contains common functionality for configuring all OTLP -// trace exporters. -// -// Deprecated: package otlpconfig exists for historical compatibility, it -// should not be used. -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go deleted file mode 100644 index 1b9ecf6f949..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - -import ( - "crypto/tls" - "crypto/x509" - "net/url" - "os" - "path" - "strings" - "time" - - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" // nolint: staticcheck // Atomic deprecation. -) - -// DefaultEnvOptionsReader is the default environments reader. -var DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ - GetEnv: os.Getenv, - ReadFile: os.ReadFile, - Namespace: "OTEL_EXPORTER_OTLP", -} - -// ApplyGRPCEnvConfigs applies the env configurations for gRPC. -func ApplyGRPCEnvConfigs(cfg Config) Config { - opts := getOptionsFromEnv() - for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) - } - return cfg -} - -// ApplyHTTPEnvConfigs applies the env configurations for HTTP. -func ApplyHTTPEnvConfigs(cfg Config) Config { - opts := getOptionsFromEnv() - for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) - } - return cfg -} - -func getOptionsFromEnv() []GenericOption { - opts := []GenericOption{} - - tlsConf := &tls.Config{} - DefaultEnvOptionsReader.Apply( - envconfig.WithURL("ENDPOINT", func(u *url.URL) { - opts = append(opts, withEndpointScheme(u)) - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Traces.Endpoint = u.Host - // For OTLP/HTTP endpoint URLs without a per-signal - // configuration, the passed endpoint is used as a base URL - // and the signals are sent to these paths relative to that. - cfg.Traces.URLPath = path.Join(u.Path, DefaultTracesPath) - return cfg - }, withEndpointForGRPC(u))) - }), - envconfig.WithURL("TRACES_ENDPOINT", func(u *url.URL) { - opts = append(opts, withEndpointScheme(u)) - opts = append(opts, newSplitOption(func(cfg Config) Config { - cfg.Traces.Endpoint = u.Host - // For endpoint URLs for OTLP/HTTP per-signal variables, the - // URL MUST be used as-is without any modification. The only - // exception is that if an URL contains no path part, the root - // path / MUST be used. - path := u.Path - if path == "" { - path = "/" - } - cfg.Traces.URLPath = path - return cfg - }, withEndpointForGRPC(u))) - }), - envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), - envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), - envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), - envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), - withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), - envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), - envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), - envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), - envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }), - WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), - WithEnvCompression("TRACES_COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }), - envconfig.WithDuration("TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), - envconfig.WithDuration("TRACES_TIMEOUT", func(d time.Duration) { opts = append(opts, WithTimeout(d)) }), - ) - - return opts -} - -func withEndpointScheme(u *url.URL) GenericOption { - switch strings.ToLower(u.Scheme) { - case "http", "unix": - return WithInsecure() - default: - return WithSecure() - } -} - -func withEndpointForGRPC(u *url.URL) func(cfg Config) Config { - return func(cfg Config) Config { - // For OTLP/gRPC endpoints, this is the target to which the - // exporter is going to send telemetry. - cfg.Traces.Endpoint = path.Join(u.Host, u.Path) - return cfg - } -} - -// WithEnvCompression retrieves the specified config and passes it to ConfigFn as a Compression. -func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOptionsReader) { - return func(e *envconfig.EnvOptionsReader) { - if v, ok := e.GetEnvValue(n); ok { - cp := NoCompression - if v == "gzip" { - cp = GzipCompression - } - - fn(cp) - } - } -} - -// revive:disable-next-line:flag-parameter -func withInsecure(b bool) GenericOption { - if b { - return WithInsecure() - } - return WithSecure() -} - -func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) { - return func(e *envconfig.EnvOptionsReader) { - if c.RootCAs != nil || len(c.Certificates) > 0 { - fn(c) - } - } -} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go deleted file mode 100644 index 25021f7328c..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/envconfig_test.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/internal/otlpconfig/options.go deleted file mode 100644 index 9d99c02365d..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options.go +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - -import ( - "crypto/tls" - "fmt" - "path" - "strings" - "time" - - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/encoding/gzip" - - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" // nolint: staticcheck // Atomic deprecation. -) - -const ( - // DefaultTracesPath is a default URL path for endpoint that - // receives spans. - DefaultTracesPath string = "/v1/traces" - // DefaultTimeout is a default max waiting time for the backend to process - // each span batch. - DefaultTimeout time.Duration = 10 * time.Second -) - -type ( - SignalConfig struct { - Endpoint string - Insecure bool - TLSCfg *tls.Config - Headers map[string]string - Compression Compression - Timeout time.Duration - URLPath string - - // gRPC configurations - GRPCCredentials credentials.TransportCredentials - } - - Config struct { - // Signal specific configurations - Traces SignalConfig - - RetryConfig retry.Config - - // gRPC configurations - ReconnectionPeriod time.Duration - ServiceConfig string - DialOptions []grpc.DialOption - GRPCConn *grpc.ClientConn - } -) - -// NewHTTPConfig returns a new Config with all settings applied from opts and -// any unset setting using the default HTTP config values. -func NewHTTPConfig(opts ...HTTPOption) Config { - cfg := Config{ - Traces: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorHTTPPort), - URLPath: DefaultTracesPath, - Compression: NoCompression, - Timeout: DefaultTimeout, - }, - RetryConfig: retry.DefaultConfig, - } - cfg = ApplyHTTPEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.ApplyHTTPOption(cfg) - } - cfg.Traces.URLPath = cleanPath(cfg.Traces.URLPath, DefaultTracesPath) - return cfg -} - -// cleanPath returns a path with all spaces trimmed and all redundancies -// removed. If urlPath is empty or cleaning it results in an empty string, -// defaultPath is returned instead. -func cleanPath(urlPath string, defaultPath string) string { - tmp := path.Clean(strings.TrimSpace(urlPath)) - if tmp == "." { - return defaultPath - } - if !path.IsAbs(tmp) { - tmp = fmt.Sprintf("/%s", tmp) - } - return tmp -} - -// NewGRPCConfig returns a new Config with all settings applied from opts and -// any unset setting using the default gRPC config values. -func NewGRPCConfig(opts ...GRPCOption) Config { - userAgent := "OTel OTLP Exporter Go/" + otlptrace.Version() - cfg := Config{ - Traces: SignalConfig{ - Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), - URLPath: DefaultTracesPath, - Compression: NoCompression, - Timeout: DefaultTimeout, - }, - RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, - } - cfg = ApplyGRPCEnvConfigs(cfg) - for _, opt := range opts { - cfg = opt.ApplyGRPCOption(cfg) - } - - if cfg.ServiceConfig != "" { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultServiceConfig(cfg.ServiceConfig)) - } - // Priroritize GRPCCredentials over Insecure (passing both is an error). - if cfg.Traces.GRPCCredentials != nil { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(cfg.Traces.GRPCCredentials)) - } else if cfg.Traces.Insecure { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) - } else { - // Default to using the host's root CA. - creds := credentials.NewTLS(nil) - cfg.Traces.GRPCCredentials = creds - cfg.DialOptions = append(cfg.DialOptions, grpc.WithTransportCredentials(creds)) - } - if cfg.Traces.Compression == GzipCompression { - cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) - } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } - if cfg.ReconnectionPeriod != 0 { - p := grpc.ConnectParams{ - Backoff: backoff.DefaultConfig, - MinConnectTimeout: cfg.ReconnectionPeriod, - } - cfg.DialOptions = append(cfg.DialOptions, grpc.WithConnectParams(p)) - } - - return cfg -} - -type ( - // GenericOption applies an option to the HTTP or gRPC driver. - GenericOption interface { - ApplyHTTPOption(Config) Config - ApplyGRPCOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } - - // HTTPOption applies an option to the HTTP driver. - HTTPOption interface { - ApplyHTTPOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } - - // GRPCOption applies an option to the gRPC driver. - GRPCOption interface { - ApplyGRPCOption(Config) Config - - // A private method to prevent users implementing the - // interface and so future additions to it will not - // violate compatibility. - private() - } -) - -// genericOption is an option that applies the same logic -// for both gRPC and HTTP. -type genericOption struct { - fn func(Config) Config -} - -func (g *genericOption) ApplyGRPCOption(cfg Config) Config { - return g.fn(cfg) -} - -func (g *genericOption) ApplyHTTPOption(cfg Config) Config { - return g.fn(cfg) -} - -func (genericOption) private() {} - -func newGenericOption(fn func(cfg Config) Config) GenericOption { - return &genericOption{fn: fn} -} - -// splitOption is an option that applies different logics -// for gRPC and HTTP. -type splitOption struct { - httpFn func(Config) Config - grpcFn func(Config) Config -} - -func (g *splitOption) ApplyGRPCOption(cfg Config) Config { - return g.grpcFn(cfg) -} - -func (g *splitOption) ApplyHTTPOption(cfg Config) Config { - return g.httpFn(cfg) -} - -func (splitOption) private() {} - -func newSplitOption(httpFn func(cfg Config) Config, grpcFn func(cfg Config) Config) GenericOption { - return &splitOption{httpFn: httpFn, grpcFn: grpcFn} -} - -// httpOption is an option that is only applied to the HTTP driver. -type httpOption struct { - fn func(Config) Config -} - -func (h *httpOption) ApplyHTTPOption(cfg Config) Config { - return h.fn(cfg) -} - -func (httpOption) private() {} - -func NewHTTPOption(fn func(cfg Config) Config) HTTPOption { - return &httpOption{fn: fn} -} - -// grpcOption is an option that is only applied to the gRPC driver. -type grpcOption struct { - fn func(Config) Config -} - -func (h *grpcOption) ApplyGRPCOption(cfg Config) Config { - return h.fn(cfg) -} - -func (grpcOption) private() {} - -func NewGRPCOption(fn func(cfg Config) Config) GRPCOption { - return &grpcOption{fn: fn} -} - -// Generic Options - -func WithEndpoint(endpoint string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Endpoint = endpoint - return cfg - }) -} - -func WithCompression(compression Compression) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Compression = compression - return cfg - }) -} - -func WithURLPath(urlPath string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.URLPath = urlPath - return cfg - }) -} - -func WithRetry(rc retry.Config) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.RetryConfig = rc - return cfg - }) -} - -func WithTLSClientConfig(tlsCfg *tls.Config) GenericOption { - return newSplitOption(func(cfg Config) Config { - cfg.Traces.TLSCfg = tlsCfg.Clone() - return cfg - }, func(cfg Config) Config { - cfg.Traces.GRPCCredentials = credentials.NewTLS(tlsCfg) - return cfg - }) -} - -func WithInsecure() GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Insecure = true - return cfg - }) -} - -func WithSecure() GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Insecure = false - return cfg - }) -} - -func WithHeaders(headers map[string]string) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Headers = headers - return cfg - }) -} - -func WithTimeout(duration time.Duration) GenericOption { - return newGenericOption(func(cfg Config) Config { - cfg.Traces.Timeout = duration - return cfg - }) -} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go deleted file mode 100644 index e3f83e64616..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/options_test.go +++ /dev/null @@ -1,486 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig - -import ( - "errors" - "testing" - "time" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/envconfig" // nolint: staticcheck // Atomic deprecation. -) - -const ( - WeakCertificate = ` ------BEGIN CERTIFICATE----- -MIIBhzCCASygAwIBAgIRANHpHgAWeTnLZpTSxCKs0ggwCgYIKoZIzj0EAwIwEjEQ -MA4GA1UEChMHb3RlbC1nbzAeFw0yMTA0MDExMzU5MDNaFw0yMTA0MDExNDU5MDNa -MBIxEDAOBgNVBAoTB290ZWwtZ28wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9 -nWSkmPCxShxnp43F+PrOtbGV7sNfkbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0Z -sJCLHGogQsYnWJBXUZOVo2MwYTAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYI -KwYBBQUHAwEwDAYDVR0TAQH/BAIwADAsBgNVHREEJTAjgglsb2NhbGhvc3SHEAAA -AAAAAAAAAAAAAAAAAAGHBH8AAAEwCgYIKoZIzj0EAwIDSQAwRgIhANwZVVKvfvQ/ -1HXsTvgH+xTQswOwSSKYJ1cVHQhqK7ZbAiEAus8NxpTRnp5DiTMuyVmhVNPB+bVH -Lhnm4N/QDk5rek0= ------END CERTIFICATE----- -` - WeakPrivateKey = ` ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgN8HEXiXhvByrJ1zK -SFT6Y2l2KqDWwWzKf+t4CyWrNKehRANCAAS9nWSkmPCxShxnp43F+PrOtbGV7sNf -kbQ/kxzi9Ego0ZJdiXxkmv/C05QFddCW7Y0ZsJCLHGogQsYnWJBXUZOV ------END PRIVATE KEY----- -` -) - -type env map[string]string - -func (e *env) getEnv(env string) string { - return (*e)[env] -} - -type fileReader map[string][]byte - -func (f *fileReader) readFile(filename string) ([]byte, error) { - if b, ok := (*f)[filename]; ok { - return b, nil - } - return nil, errors.New("file not found") -} - -func TestConfigs(t *testing.T) { - tlsCert, err := CreateTLSConfig([]byte(WeakCertificate)) - assert.NoError(t, err) - - tests := []struct { - name string - opts []GenericOption - env env - fileReader fileReader - asserts func(t *testing.T, c *Config, grpcOption bool) - }{ - { - name: "Test default configs", - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - assert.Equal(t, "localhost:4317", c.Traces.Endpoint) - } else { - assert.Equal(t, "localhost:4318", c.Traces.Endpoint) - } - assert.Equal(t, NoCompression, c.Traces.Compression) - assert.Equal(t, map[string]string(nil), c.Traces.Headers) - assert.Equal(t, 10*time.Second, c.Traces.Timeout) - }, - }, - - // Endpoint Tests - { - name: "Test With Endpoint", - opts: []GenericOption{ - WithEndpoint("someendpoint"), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "someendpoint", c.Traces.Endpoint) - }, - }, - { - name: "Test Environment Endpoint", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env.endpoint/prefix", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.False(t, c.Traces.Insecure) - if grpcOption { - assert.Equal(t, "env.endpoint/prefix", c.Traces.Endpoint) - } else { - assert.Equal(t, "env.endpoint", c.Traces.Endpoint) - assert.Equal(t, "/prefix/v1/traces", c.Traces.URLPath) - } - }, - }, - { - name: "Test Environment Signal Specific Endpoint", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://overrode.by.signal.specific/env/var", - "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "http://env.traces.endpoint", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.True(t, c.Traces.Insecure) - assert.Equal(t, "env.traces.endpoint", c.Traces.Endpoint) - if !grpcOption { - assert.Equal(t, "/", c.Traces.URLPath) - } - }, - }, - { - name: "Test Mixed Environment and With Endpoint", - opts: []GenericOption{ - WithEndpoint("traces_endpoint"), - }, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "env_endpoint", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "traces_endpoint", c.Traces.Endpoint) - }, - }, - { - name: "Test Environment Endpoint with HTTP scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "http://env_endpoint", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Traces.Endpoint) - assert.Equal(t, true, c.Traces.Insecure) - }, - }, - { - name: "Test Environment Endpoint with HTTP scheme and leading & trailingspaces", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": " http://env_endpoint ", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Traces.Endpoint) - assert.Equal(t, true, c.Traces.Insecure) - }, - }, - { - name: "Test Environment Endpoint with HTTPS scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "https://env_endpoint", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "env_endpoint", c.Traces.Endpoint) - assert.Equal(t, false, c.Traces.Insecure) - }, - }, - { - name: "Test Environment Signal Specific Endpoint with uppercase scheme", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_ENDPOINT": "HTTPS://overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT": "HtTp://env_traces_endpoint", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, "env_traces_endpoint", c.Traces.Endpoint) - assert.Equal(t, true, c.Traces.Insecure) - }, - }, - - // Certificate tests - { - name: "Test Default Certificate", - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Traces.GRPCCredentials) - } else { - assert.Nil(t, c.Traces.TLSCfg) - } - }, - }, - { - name: "Test With Certificate", - opts: []GenericOption{ - WithTLSClientConfig(tlsCert), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - //TODO: make sure gRPC's credentials actually works - assert.NotNil(t, c.Traces.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Environment Certificate", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Traces.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Environment Signal Specific Certificate", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - "invalid_cert": []byte("invalid certificate file."), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Traces.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) - } - }, - }, - { - name: "Test Mixed Environment and With Certificate", - opts: []GenericOption{}, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_CERTIFICATE": "cert_path", - }, - fileReader: fileReader{ - "cert_path": []byte(WeakCertificate), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - if grpcOption { - assert.NotNil(t, c.Traces.GRPCCredentials) - } else { - // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. - assert.Equal(t, tlsCert.RootCAs.Subjects(), c.Traces.TLSCfg.RootCAs.Subjects()) - } - }, - }, - - // Headers tests - { - name: "Test With Headers", - opts: []GenericOption{ - WithHeaders(map[string]string{"h1": "v1"}), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1"}, c.Traces.Headers) - }, - }, - { - name: "Test Environment Headers", - env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) - }, - }, - { - name: "Test Environment Signal Specific Headers", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_HEADERS": "overrode_by_signal_specific", - "OTEL_EXPORTER_OTLP_TRACES_HEADERS": "h1=v1,h2=v2", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) - }, - }, - { - name: "Test Mixed Environment and With Headers", - env: map[string]string{"OTEL_EXPORTER_OTLP_HEADERS": "h1=v1,h2=v2"}, - opts: []GenericOption{}, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, map[string]string{"h1": "v1", "h2": "v2"}, c.Traces.Headers) - }, - }, - - // Compression Tests - { - name: "Test With Compression", - opts: []GenericOption{ - WithCompression(GzipCompression), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, GzipCompression, c.Traces.Compression) - }, - }, - { - name: "Test Environment Compression", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, GzipCompression, c.Traces.Compression) - }, - }, - { - name: "Test Environment Signal Specific Compression", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, GzipCompression, c.Traces.Compression) - }, - }, - { - name: "Test Mixed Environment and With Compression", - opts: []GenericOption{ - WithCompression(NoCompression), - }, - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TRACES_COMPRESSION": "gzip", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, NoCompression, c.Traces.Compression) - }, - }, - - // Timeout Tests - { - name: "Test With Timeout", - opts: []GenericOption{ - WithTimeout(time.Duration(5 * time.Second)), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, 5*time.Second, c.Traces.Timeout) - }, - }, - { - name: "Test Environment Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, c.Traces.Timeout, 15*time.Second) - }, - }, - { - name: "Test Environment Signal Specific Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, c.Traces.Timeout, 27*time.Second) - }, - }, - { - name: "Test Mixed Environment and With Timeout", - env: map[string]string{ - "OTEL_EXPORTER_OTLP_TIMEOUT": "15000", - "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT": "27000", - }, - opts: []GenericOption{ - WithTimeout(5 * time.Second), - }, - asserts: func(t *testing.T, c *Config, grpcOption bool) { - assert.Equal(t, c.Traces.Timeout, 5*time.Second) - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - origEOR := DefaultEnvOptionsReader - DefaultEnvOptionsReader = envconfig.EnvOptionsReader{ - GetEnv: tt.env.getEnv, - ReadFile: tt.fileReader.readFile, - Namespace: "OTEL_EXPORTER_OTLP", - } - t.Cleanup(func() { DefaultEnvOptionsReader = origEOR }) - - // Tests Generic options as HTTP Options - cfg := NewHTTPConfig(asHTTPOptions(tt.opts)...) - tt.asserts(t, &cfg, false) - - // Tests Generic options as gRPC Options - cfg = NewGRPCConfig(asGRPCOptions(tt.opts)...) - tt.asserts(t, &cfg, true) - }) - } -} - -func asHTTPOptions(opts []GenericOption) []HTTPOption { - converted := make([]HTTPOption, len(opts)) - for i, o := range opts { - converted[i] = NewHTTPOption(o.ApplyHTTPOption) - } - return converted -} - -func asGRPCOptions(opts []GenericOption) []GRPCOption { - converted := make([]GRPCOption, len(opts)) - for i, o := range opts { - converted[i] = NewGRPCOption(o.ApplyGRPCOption) - } - return converted -} - -func TestCleanPath(t *testing.T) { - type args struct { - urlPath string - defaultPath string - } - tests := []struct { - name string - args args - want string - }{ - { - name: "clean empty path", - args: args{ - urlPath: "", - defaultPath: "DefaultPath", - }, - want: "DefaultPath", - }, - { - name: "clean metrics path", - args: args{ - urlPath: "/prefix/v1/metrics", - defaultPath: "DefaultMetricsPath", - }, - want: "/prefix/v1/metrics", - }, - { - name: "clean traces path", - args: args{ - urlPath: "https://env_endpoint", - defaultPath: "DefaultTracesPath", - }, - want: "/https:/env_endpoint", - }, - { - name: "spaces trimmed", - args: args{ - urlPath: " /dir", - }, - want: "/dir", - }, - { - name: "clean path empty", - args: args{ - urlPath: "dir/..", - defaultPath: "DefaultTracesPath", - }, - want: "DefaultTracesPath", - }, - { - name: "make absolute", - args: args{ - urlPath: "dir/a", - }, - want: "/dir/a", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := cleanPath(tt.args.urlPath, tt.args.defaultPath); got != tt.want { - t.Errorf("CleanPath() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go b/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go deleted file mode 100644 index c2d6c036152..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/optiontypes.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - -const ( - // DefaultCollectorGRPCPort is the default gRPC port of the collector. - DefaultCollectorGRPCPort uint16 = 4317 - // DefaultCollectorHTTPPort is the default HTTP port of the collector. - DefaultCollectorHTTPPort uint16 = 4318 - // DefaultCollectorHost is the host address the Exporter will attempt - // connect to if no collector address is provided. - DefaultCollectorHost string = "localhost" -) - -// Compression describes the compression used for payloads sent to the -// collector. -type Compression int - -const ( - // NoCompression tells the driver to send payloads without - // compression. - NoCompression Compression = iota - // GzipCompression tells the driver to send payloads after - // compressing them with gzip. - GzipCompression -) - -// Marshaler describes the kind of message format sent to the collector. -type Marshaler int - -const ( - // MarshalProto tells the driver to send using the protobuf binary format. - MarshalProto Marshaler = iota - // MarshalJSON tells the driver to send using json format. - MarshalJSON -) diff --git a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go b/exporters/otlp/otlptrace/internal/otlpconfig/tls.go deleted file mode 100644 index 7287cf6cfeb..00000000000 --- a/exporters/otlp/otlptrace/internal/otlpconfig/tls.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig" - -import ( - "crypto/tls" - "crypto/x509" - "errors" -) - -// CreateTLSConfig creates a tls.Config from a raw certificate bytes -// to verify a server certificate. -func CreateTLSConfig(certBytes []byte) (*tls.Config, error) { - cp := x509.NewCertPool() - if ok := cp.AppendCertsFromPEM(certBytes); !ok { - return nil, errors.New("failed to append certificate to the cert pool") - } - - return &tls.Config{ - RootCAs: cp, - }, nil -} diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/internal/otlptracetest/client.go deleted file mode 100644 index aedb8f4a9d2..00000000000 --- a/exporters/otlp/otlptrace/internal/otlptracetest/client.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" - -import ( - "context" - "errors" - "sync" - "testing" - "time" - - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" -) - -func RunExporterShutdownTest(t *testing.T, factory func() otlptrace.Client) { - t.Run("testClientStopHonorsTimeout", func(t *testing.T) { - testClientStopHonorsTimeout(t, factory()) - }) - - t.Run("testClientStopHonorsCancel", func(t *testing.T) { - testClientStopHonorsCancel(t, factory()) - }) - - t.Run("testClientStopNoError", func(t *testing.T) { - testClientStopNoError(t, factory()) - }) - - t.Run("testClientStopManyTimes", func(t *testing.T) { - testClientStopManyTimes(t, factory()) - }) -} - -func initializeExporter(t *testing.T, client otlptrace.Client) *otlptrace.Exporter { - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - e, err := otlptrace.New(ctx, client) - if err != nil { - t.Fatalf("failed to create exporter") - } - - return e -} - -func testClientStopHonorsTimeout(t *testing.T, client otlptrace.Client) { - t.Cleanup(func() { - // The test is looking for a failed shut down. Call Stop a second time - // with an un-expired context to give the client a second chance at - // cleaning up. There is not guarantee from the Client interface this - // will succeed, therefore, no need to check the error (just give it a - // best try). - _ = client.Stop(context.Background()) - }) - e := initializeExporter(t, client) - - ctx, cancel := context.WithTimeout(context.Background(), time.Nanosecond) - defer cancel() - <-ctx.Done() - - if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { - t.Errorf("expected context DeadlineExceeded error, got %v", err) - } -} - -func testClientStopHonorsCancel(t *testing.T, client otlptrace.Client) { - t.Cleanup(func() { - // The test is looking for a failed shut down. Call Stop a second time - // with an un-expired context to give the client a second chance at - // cleaning up. There is not guarantee from the Client interface this - // will succeed, therefore, no need to check the error (just give it a - // best try). - _ = client.Stop(context.Background()) - }) - e := initializeExporter(t, client) - - ctx, cancel := context.WithCancel(context.Background()) - cancel() - - if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) { - t.Errorf("expected context canceled error, got %v", err) - } -} - -func testClientStopNoError(t *testing.T, client otlptrace.Client) { - e := initializeExporter(t, client) - - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - if err := e.Shutdown(ctx); err != nil { - t.Errorf("shutdown errored: expected nil, got %v", err) - } -} - -func testClientStopManyTimes(t *testing.T, client otlptrace.Client) { - e := initializeExporter(t, client) - - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) - defer cancel() - - ch := make(chan struct{}) - wg := sync.WaitGroup{} - const num int = 20 - wg.Add(num) - errs := make([]error, num) - for i := 0; i < num; i++ { - go func(idx int) { - defer wg.Done() - <-ch - errs[idx] = e.Shutdown(ctx) - }(i) - } - close(ch) - wg.Wait() - for _, err := range errs { - if err != nil { - t.Errorf("failed to shutdown exporter: %v", err) - return - } - } -} diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go b/exporters/otlp/otlptrace/internal/otlptracetest/collector.go deleted file mode 100644 index 865fabba27d..00000000000 --- a/exporters/otlp/otlptrace/internal/otlptracetest/collector.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" - -import ( - "sort" - - collectortracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" - resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" - tracepb "go.opentelemetry.io/proto/otlp/trace/v1" -) - -// TracesCollector mocks a collector for the end-to-end testing. -type TracesCollector interface { - Stop() error - GetResourceSpans() []*tracepb.ResourceSpans -} - -// SpansStorage stores the spans. Mock collectors can use it to -// store spans they have received. -type SpansStorage struct { - rsm map[string]*tracepb.ResourceSpans - spanCount int -} - -// NewSpansStorage creates a new spans storage. -func NewSpansStorage() SpansStorage { - return SpansStorage{ - rsm: make(map[string]*tracepb.ResourceSpans), - } -} - -// AddSpans adds spans to the spans storage. -func (s *SpansStorage) AddSpans(request *collectortracepb.ExportTraceServiceRequest) { - for _, rs := range request.GetResourceSpans() { - rstr := resourceString(rs.Resource) - if existingRs, ok := s.rsm[rstr]; !ok { - s.rsm[rstr] = rs - // TODO (rghetia): Add support for library Info. - if len(rs.ScopeSpans) == 0 { - rs.ScopeSpans = []*tracepb.ScopeSpans{ - { - Spans: []*tracepb.Span{}, - }, - } - } - s.spanCount += len(rs.ScopeSpans[0].Spans) - } else { - if len(rs.ScopeSpans) > 0 { - newSpans := rs.ScopeSpans[0].GetSpans() - existingRs.ScopeSpans[0].Spans = append(existingRs.ScopeSpans[0].Spans, newSpans...) - s.spanCount += len(newSpans) - } - } - } -} - -// GetSpans returns the stored spans. -func (s *SpansStorage) GetSpans() []*tracepb.Span { - spans := make([]*tracepb.Span, 0, s.spanCount) - for _, rs := range s.rsm { - spans = append(spans, rs.ScopeSpans[0].Spans...) - } - return spans -} - -// GetResourceSpans returns the stored resource spans. -func (s *SpansStorage) GetResourceSpans() []*tracepb.ResourceSpans { - rss := make([]*tracepb.ResourceSpans, 0, len(s.rsm)) - for _, rs := range s.rsm { - rss = append(rss, rs) - } - return rss -} - -func resourceString(res *resourcepb.Resource) string { - sAttrs := sortedAttributes(res.GetAttributes()) - rstr := "" - for _, attr := range sAttrs { - rstr = rstr + attr.String() - } - return rstr -} - -func sortedAttributes(attrs []*commonpb.KeyValue) []*commonpb.KeyValue { - sort.Slice(attrs[:], func(i, j int) bool { - return attrs[i].Key < attrs[j].Key - }) - return attrs -} diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/data.go b/exporters/otlp/otlptrace/internal/otlptracetest/data.go deleted file mode 100644 index d039105cb29..00000000000 --- a/exporters/otlp/otlptrace/internal/otlptracetest/data.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" - -import ( - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/resource" - tracesdk "go.opentelemetry.io/otel/sdk/trace" - "go.opentelemetry.io/otel/sdk/trace/tracetest" - "go.opentelemetry.io/otel/trace" -) - -// SingleReadOnlySpan returns a one-element slice with a read-only span. It -// may be useful for testing driver's trace export. -func SingleReadOnlySpan() []tracesdk.ReadOnlySpan { - return tracetest.SpanStubs{ - { - SpanContext: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, - SpanID: trace.SpanID{3, 4, 5, 6, 7, 8, 9, 0}, - TraceFlags: trace.FlagsSampled, - }), - Parent: trace.NewSpanContext(trace.SpanContextConfig{ - TraceID: trace.TraceID{2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6, 7, 8, 9}, - SpanID: trace.SpanID{1, 2, 3, 4, 5, 6, 7, 8}, - TraceFlags: trace.FlagsSampled, - }), - SpanKind: trace.SpanKindInternal, - Name: "foo", - StartTime: time.Date(2020, time.December, 8, 20, 23, 0, 0, time.UTC), - EndTime: time.Date(2020, time.December, 0, 20, 24, 0, 0, time.UTC), - Attributes: []attribute.KeyValue{}, - Events: []tracesdk.Event{}, - Links: []tracesdk.Link{}, - Status: tracesdk.Status{Code: codes.Ok}, - DroppedAttributes: 0, - DroppedEvents: 0, - DroppedLinks: 0, - ChildSpanCount: 0, - Resource: resource.NewSchemaless(attribute.String("a", "b")), - InstrumentationLibrary: instrumentation.Library{ - Name: "bar", - Version: "0.0.0", - }, - }, - }.Snapshots() -} diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/doc.go b/exporters/otlp/otlptrace/internal/otlptracetest/doc.go deleted file mode 100644 index 16306de6951..00000000000 --- a/exporters/otlp/otlptrace/internal/otlptracetest/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package otlptracetest contains common functionality for testing all OTLP -// trace exporters. -// -// Deprecated: package otlptracetest exists for historical compatibility, it -// should not be used. -package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go b/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go deleted file mode 100644 index 91c098d1539..00000000000 --- a/exporters/otlp/otlptrace/internal/otlptracetest/otlptest.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlptracetest // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlptracetest" - -import ( - "context" - "testing" - "time" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" -) - -// RunEndToEndTest can be used by otlptrace.Client tests to validate -// themselves. -func RunEndToEndTest(ctx context.Context, t *testing.T, exp *otlptrace.Exporter, tracesCollector TracesCollector) { - pOpts := []sdktrace.TracerProviderOption{ - sdktrace.WithSampler(sdktrace.AlwaysSample()), - sdktrace.WithBatcher( - exp, - // add following two options to ensure flush - sdktrace.WithBatchTimeout(5*time.Second), - sdktrace.WithMaxExportBatchSize(10), - ), - } - tp1 := sdktrace.NewTracerProvider(append(pOpts, - sdktrace.WithResource(resource.NewSchemaless( - attribute.String("rk1", "rv11)"), - attribute.Int64("rk2", 5), - )))...) - - tp2 := sdktrace.NewTracerProvider(append(pOpts, - sdktrace.WithResource(resource.NewSchemaless( - attribute.String("rk1", "rv12)"), - attribute.Float64("rk3", 6.5), - )))...) - - tr1 := tp1.Tracer("test-tracer1") - tr2 := tp2.Tracer("test-tracer2") - // Now create few spans - m := 4 - for i := 0; i < m; i++ { - _, span := tr1.Start(ctx, "AlwaysSample") - span.SetAttributes(attribute.Int64("i", int64(i))) - span.End() - - _, span = tr2.Start(ctx, "AlwaysSample") - span.SetAttributes(attribute.Int64("i", int64(i))) - span.End() - } - - func() { - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - if err := tp1.Shutdown(ctx); err != nil { - t.Fatalf("failed to shut down a tracer provider 1: %v", err) - } - if err := tp2.Shutdown(ctx); err != nil { - t.Fatalf("failed to shut down a tracer provider 2: %v", err) - } - }() - - // Wait >2 cycles. - <-time.After(40 * time.Millisecond) - - // Now shutdown the exporter - ctx, cancel := context.WithTimeout(ctx, 10*time.Second) - defer cancel() - if err := exp.Shutdown(ctx); err != nil { - t.Fatalf("failed to stop the exporter: %v", err) - } - - // Shutdown the collector too so that we can begin - // verification checks of expected data back. - if err := tracesCollector.Stop(); err != nil { - t.Fatalf("failed to stop the mock collector: %v", err) - } - - // Now verify that we only got two resources - rss := tracesCollector.GetResourceSpans() - if got, want := len(rss), 2; got != want { - t.Fatalf("resource span count: got %d, want %d\n", got, want) - } - - // Now verify spans and attributes for each resource span. - for _, rs := range rss { - if len(rs.ScopeSpans) == 0 { - t.Fatalf("zero ScopeSpans") - } - if got, want := len(rs.ScopeSpans[0].Spans), m; got != want { - t.Fatalf("span counts: got %d, want %d", got, want) - } - attrMap := map[int64]bool{} - for _, s := range rs.ScopeSpans[0].Spans { - if gotName, want := s.Name, "AlwaysSample"; gotName != want { - t.Fatalf("span name: got %s, want %s", gotName, want) - } - attrMap[s.Attributes[0].Value.Value.(*commonpb.AnyValue_IntValue).IntValue] = true - } - if got, want := len(attrMap), m; got != want { - t.Fatalf("span attribute unique values: got %d want %d", got, want) - } - for i := 0; i < m; i++ { - _, ok := attrMap[int64(i)] - if !ok { - t.Fatalf("span with attribute %d missing", i) - } - } - } -} diff --git a/exporters/otlp/otlptrace/internal/retry/retry.go b/exporters/otlp/otlptrace/internal/retry/retry.go deleted file mode 100644 index 1af94419199..00000000000 --- a/exporters/otlp/otlptrace/internal/retry/retry.go +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package retry provides request retry functionality that can perform -// configurable exponential backoff for transient errors and honor any -// explicit throttle responses received. -// -// Deprecated: package retry exists for historical compatibility, it should not -// be used. -package retry // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/retry" - -import ( - "context" - "fmt" - "time" - - "github.com/cenkalti/backoff/v4" -) - -// DefaultConfig are the recommended defaults to use. -var DefaultConfig = Config{ - Enabled: true, - InitialInterval: 5 * time.Second, - MaxInterval: 30 * time.Second, - MaxElapsedTime: time.Minute, -} - -// Config defines configuration for retrying batches in case of export failure -// using an exponential backoff. -type Config struct { - // Enabled indicates whether to not retry sending batches in case of - // export failure. - Enabled bool - // InitialInterval the time to wait after the first failure before - // retrying. - InitialInterval time.Duration - // MaxInterval is the upper bound on backoff interval. Once this value is - // reached the delay between consecutive retries will always be - // `MaxInterval`. - MaxInterval time.Duration - // MaxElapsedTime is the maximum amount of time (including retries) spent - // trying to send a request/batch. Once this value is reached, the data - // is discarded. - MaxElapsedTime time.Duration -} - -// RequestFunc wraps a request with retry logic. -type RequestFunc func(context.Context, func(context.Context) error) error - -// EvaluateFunc returns if an error is retry-able and if an explicit throttle -// duration should be honored that was included in the error. -// -// The function must return true if the error argument is retry-able, -// otherwise it must return false for the first return parameter. -// -// The function must return a non-zero time.Duration if the error contains -// explicit throttle duration that should be honored, otherwise it must return -// a zero valued time.Duration. -type EvaluateFunc func(error) (bool, time.Duration) - -// RequestFunc returns a RequestFunc using the evaluate function to determine -// if requests can be retried and based on the exponential backoff -// configuration of c. -func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { - if !c.Enabled { - return func(ctx context.Context, fn func(context.Context) error) error { - return fn(ctx) - } - } - - return func(ctx context.Context, fn func(context.Context) error) error { - // Do not use NewExponentialBackOff since it calls Reset and the code here - // must call Reset after changing the InitialInterval (this saves an - // unnecessary call to Now). - b := &backoff.ExponentialBackOff{ - InitialInterval: c.InitialInterval, - RandomizationFactor: backoff.DefaultRandomizationFactor, - Multiplier: backoff.DefaultMultiplier, - MaxInterval: c.MaxInterval, - MaxElapsedTime: c.MaxElapsedTime, - Stop: backoff.Stop, - Clock: backoff.SystemClock, - } - b.Reset() - - for { - err := fn(ctx) - if err == nil { - return nil - } - - retryable, throttle := evaluate(err) - if !retryable { - return err - } - - bOff := b.NextBackOff() - if bOff == backoff.Stop { - return fmt.Errorf("max retry time elapsed: %w", err) - } - - // Wait for the greater of the backoff or throttle delay. - var delay time.Duration - if bOff > throttle { - delay = bOff - } else { - elapsed := b.GetElapsedTime() - if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { - return fmt.Errorf("max retry time would elapse: %w", err) - } - delay = throttle - } - - if ctxErr := waitFunc(ctx, delay); ctxErr != nil { - return fmt.Errorf("%w: %s", ctxErr, err) - } - } - } -} - -// Allow override for testing. -var waitFunc = wait - -// wait takes the caller's context, and the amount of time to wait. It will -// return nil if the timer fires before or at the same time as the context's -// deadline. This indicates that the call can be retried. -func wait(ctx context.Context, delay time.Duration) error { - timer := time.NewTimer(delay) - defer timer.Stop() - - select { - case <-ctx.Done(): - // Handle the case where the timer and context deadline end - // simultaneously by prioritizing the timer expiration nil value - // response. - select { - case <-timer.C: - default: - return ctx.Err() - } - case <-timer.C: - } - - return nil -} diff --git a/exporters/otlp/otlptrace/internal/retry/retry_test.go b/exporters/otlp/otlptrace/internal/retry/retry_test.go deleted file mode 100644 index de574a73579..00000000000 --- a/exporters/otlp/otlptrace/internal/retry/retry_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package retry - -import ( - "context" - "errors" - "math" - "sync" - "testing" - "time" - - "github.com/cenkalti/backoff/v4" - "github.com/stretchr/testify/assert" -) - -func TestWait(t *testing.T) { - tests := []struct { - ctx context.Context - delay time.Duration - expected error - }{ - { - ctx: context.Background(), - delay: time.Duration(0), - }, - { - ctx: context.Background(), - delay: time.Duration(1), - }, - { - ctx: context.Background(), - delay: time.Duration(-1), - }, - { - ctx: func() context.Context { - ctx, cancel := context.WithCancel(context.Background()) - cancel() - return ctx - }(), - // Ensure the timer and context do not end simultaneously. - delay: 1 * time.Hour, - expected: context.Canceled, - }, - } - - for _, test := range tests { - err := wait(test.ctx, test.delay) - if test.expected == nil { - assert.NoError(t, err) - } else { - assert.ErrorIs(t, err, test.expected) - } - } -} - -func TestNonRetryableError(t *testing.T) { - ev := func(error) (bool, time.Duration) { return false, 0 } - - reqFunc := Config{ - Enabled: true, - InitialInterval: 1 * time.Nanosecond, - MaxInterval: 1 * time.Nanosecond, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - ctx := context.Background() - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - return nil - })) - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }), assert.AnError) -} - -func TestThrottledRetry(t *testing.T) { - // Ensure the throttle delay is used by making longer than backoff delay. - throttleDelay, backoffDelay := time.Second, time.Nanosecond - - ev := func(error) (bool, time.Duration) { - // Retry everything with a throttle delay. - return true, throttleDelay - } - - reqFunc := Config{ - Enabled: true, - InitialInterval: backoffDelay, - MaxInterval: backoffDelay, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - - origWait := waitFunc - var done bool - waitFunc = func(_ context.Context, delay time.Duration) error { - assert.Equal(t, throttleDelay, delay, "retry not throttled") - // Try twice to ensure call is attempted again after delay. - if done { - return assert.AnError - } - done = true - return nil - } - defer func() { waitFunc = origWait }() - - ctx := context.Background() - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return errors.New("not this error") - }), assert.AnError) -} - -func TestBackoffRetry(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - - delay := time.Nanosecond - reqFunc := Config{ - Enabled: true, - InitialInterval: delay, - MaxInterval: delay, - // Never stop retrying. - MaxElapsedTime: 0, - }.RequestFunc(ev) - - origWait := waitFunc - var done bool - waitFunc = func(_ context.Context, d time.Duration) error { - delta := math.Ceil(float64(delay) * backoff.DefaultRandomizationFactor) - assert.InDelta(t, delay, d, delta, "retry not backoffed") - // Try twice to ensure call is attempted again after delay. - if done { - return assert.AnError - } - done = true - return nil - } - t.Cleanup(func() { waitFunc = origWait }) - - ctx := context.Background() - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return errors.New("not this error") - }), assert.AnError) -} - -func TestBackoffRetryCanceledContext(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - - delay := time.Millisecond - reqFunc := Config{ - Enabled: true, - InitialInterval: delay, - MaxInterval: delay, - // Never stop retrying. - MaxElapsedTime: 10 * time.Millisecond, - }.RequestFunc(ev) - - ctx, cancel := context.WithCancel(context.Background()) - count := 0 - cancel() - err := reqFunc(ctx, func(context.Context) error { - count++ - return assert.AnError - }) - - assert.ErrorIs(t, err, context.Canceled) - assert.Contains(t, err.Error(), assert.AnError.Error()) - assert.Equal(t, 1, count) -} - -func TestThrottledRetryGreaterThanMaxElapsedTime(t *testing.T) { - // Ensure the throttle delay is used by making longer than backoff delay. - tDelay, bDelay := time.Hour, time.Nanosecond - ev := func(error) (bool, time.Duration) { return true, tDelay } - reqFunc := Config{ - Enabled: true, - InitialInterval: bDelay, - MaxInterval: bDelay, - MaxElapsedTime: tDelay - (time.Nanosecond), - }.RequestFunc(ev) - - ctx := context.Background() - assert.Contains(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }).Error(), "max retry time would elapse: ") -} - -func TestMaxElapsedTime(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - delay := time.Nanosecond - reqFunc := Config{ - Enabled: true, - // InitialInterval > MaxElapsedTime means immediate return. - InitialInterval: 2 * delay, - MaxElapsedTime: delay, - }.RequestFunc(ev) - - ctx := context.Background() - assert.Contains(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }).Error(), "max retry time elapsed: ") -} - -func TestRetryNotEnabled(t *testing.T) { - ev := func(error) (bool, time.Duration) { - t.Error("evaluated retry when not enabled") - return false, 0 - } - - reqFunc := Config{}.RequestFunc(ev) - ctx := context.Background() - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - return nil - })) - assert.ErrorIs(t, reqFunc(ctx, func(context.Context) error { - return assert.AnError - }), assert.AnError) -} - -func TestRetryConcurrentSafe(t *testing.T) { - ev := func(error) (bool, time.Duration) { return true, 0 } - reqFunc := Config{ - Enabled: true, - }.RequestFunc(ev) - - var wg sync.WaitGroup - ctx := context.Background() - - for i := 1; i < 5; i++ { - wg.Add(1) - - go func() { - defer wg.Done() - - var done bool - assert.NoError(t, reqFunc(ctx, func(context.Context) error { - if !done { - done = true - return assert.AnError - } - - return nil - })) - }() - } - - wg.Wait() -} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 9ba09a69e25..a7b78f5ccde 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -22,6 +22,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 7daf373b691..3dc069195a0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -1,5 +1,6 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -17,6 +18,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0bf86a8b7ea..c14958e30d8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -20,6 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 0bace07286a..d9104ccda4b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -1,5 +1,6 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -17,6 +18,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/versions.yaml b/versions.yaml index 2b240fd3deb..2f7b39e81f3 100644 --- a/versions.yaml +++ b/versions.yaml @@ -24,7 +24,6 @@ module-sets: - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin - - go.opentelemetry.io/otel/exporters/otlp/internal/retry - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp From e0a39b8f7d2ff7d3d03b9bf1ae59c4f331e8a2ae Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 29 Aug 2023 15:02:43 -0700 Subject: [PATCH 678/886] Fix `bridge/opencensus` `NewMetricExporter` deprecation notice (#4470) * Fix bridge/opencensus NewMetricExporter dep notice * Link to NewMetricProducer * Add PR number to changelog --- CHANGELOG.md | 5 +++++ bridge/opencensus/metric.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b5eb947ddf..957e5b4d211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Deprecated + +- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). + The deprecation notice format for the function has been corrected to trigger Go documentation and build tooling. (#4470) + ### Removed - Removed the deprecated `go.opentelemetry.io/otel/exporters/jaeger` package. (#4467) diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 870faa23670..c2e0be49052 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -70,7 +70,8 @@ type exporter struct { // NewMetricExporter returns an OpenCensus exporter that exports to an // OpenTelemetry (push) exporter. -// Deprecated: Use NewMetricProducer instead. +// +// Deprecated: Use [NewMetricProducer] instead. func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { return &exporter{base: base, res: res} } From 2d2507d7178a55d4064ca67f7c857cd92fd8e80a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 15:18:40 -0700 Subject: [PATCH 679/886] Bump codespell from 2.2.4 to 2.2.5 (#4472) Bumps [codespell](https://github.com/codespell-project/codespell) from 2.2.4 to 2.2.5. - [Release notes](https://github.com/codespell-project/codespell/releases) - [Commits](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.5) --- updated-dependencies: - dependency-name: codespell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 407f17489c6..ddff454685c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -codespell==2.2.4 +codespell==2.2.5 From 02616a25c68e674a04df01a1b7ba185a2db8cd5a Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 31 Aug 2023 14:17:07 -0400 Subject: [PATCH 680/886] add WithProducer to the prometheus exporter (#4473) --- CHANGELOG.md | 4 +++ exporters/prometheus/config.go | 21 ++++++------ exporters/prometheus/config_test.go | 53 ++++++++++++++--------------- exporters/prometheus/exporter.go | 2 +- 4 files changed, 42 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 957e5b4d211..0d2f1fd908f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) + ### Deprecated - The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index dcaba515900..885fd8b8b39 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -28,7 +28,7 @@ type config struct { disableTargetInfo bool withoutUnits bool withoutCounterSuffixes bool - aggregation metric.AggregationSelector + readerOpts []metric.ManualReaderOption disableScopeInfo bool namespace string } @@ -47,14 +47,6 @@ func newConfig(opts ...Option) config { return cfg } -func (cfg config) manualReaderOptions() []metric.ManualReaderOption { - opts := []metric.ManualReaderOption{} - if cfg.aggregation != nil { - opts = append(opts, metric.WithAggregationSelector(cfg.aggregation)) - } - return opts -} - // Option sets exporter option values. type Option interface { apply(config) config @@ -81,7 +73,16 @@ func WithRegisterer(reg prometheus.Registerer) Option { // used. func WithAggregationSelector(agg metric.AggregationSelector) Option { return optionFunc(func(cfg config) config { - cfg.aggregation = agg + cfg.readerOpts = append(cfg.readerOpts, metric.WithAggregationSelector(agg)) + return cfg + }) +} + +// WithProducer configure the metric Producer the exporter will use as a source +// of external metric data. +func WithProducer(producer metric.Producer) Option { + return optionFunc(func(cfg config) config { + cfg.readerOpts = append(cfg.readerOpts, metric.WithProducer(producer)) return cfg }) } diff --git a/exporters/prometheus/config_test.go b/exporters/prometheus/config_test.go index 3e3ba9c1cb0..d209fdf3fbd 100644 --- a/exporters/prometheus/config_test.go +++ b/exporters/prometheus/config_test.go @@ -15,18 +15,21 @@ package prometheus // import "go.opentelemetry.io/otel/exporters/prometheus" import ( + "context" "testing" "github.com/prometheus/client_golang/prometheus" "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/metric/metricdata" ) func TestNewConfig(t *testing.T) { registry := prometheus.NewRegistry() aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil } + producer := &noopProducer{} testCases := []struct { name string @@ -56,6 +59,17 @@ func TestNewConfig(t *testing.T) { }, wantConfig: config{ registerer: prometheus.DefaultRegisterer, + readerOpts: []metric.ManualReaderOption{metric.WithAggregationSelector(aggregationSelector)}, + }, + }, + { + name: "WithProducer", + options: []Option{ + WithProducer(producer), + }, + wantConfig: config{ + registerer: prometheus.DefaultRegisterer, + readerOpts: []metric.ManualReaderOption{metric.WithProducer(producer)}, }, }, { @@ -63,10 +77,15 @@ func TestNewConfig(t *testing.T) { options: []Option{ WithRegisterer(registry), WithAggregationSelector(aggregationSelector), + WithProducer(producer), }, wantConfig: config{ registerer: registry, + readerOpts: []metric.ManualReaderOption{ + metric.WithAggregationSelector(aggregationSelector), + metric.WithProducer(producer), + }, }, }, { @@ -132,38 +151,18 @@ func TestNewConfig(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { cfg := newConfig(tt.options...) - // tested by TestConfigManualReaderOptions - cfg.aggregation = nil + // only check the length of readerOpts, since they are not compareable + assert.Equal(t, len(tt.wantConfig.readerOpts), len(cfg.readerOpts)) + cfg.readerOpts = nil + tt.wantConfig.readerOpts = nil assert.Equal(t, tt.wantConfig, cfg) }) } } -func TestConfigManualReaderOptions(t *testing.T) { - aggregationSelector := func(metric.InstrumentKind) metric.Aggregation { return nil } - - testCases := []struct { - name string - config config - wantOptionCount int - }{ - { - name: "Default", - config: config{}, - wantOptionCount: 0, - }, +type noopProducer struct{} - { - name: "WithAggregationSelector", - config: config{aggregation: aggregationSelector}, - wantOptionCount: 1, - }, - } - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - opts := tt.config.manualReaderOptions() - assert.Len(t, opts, tt.wantOptionCount) - }) - } +func (*noopProducer) Produce(ctx context.Context) ([]metricdata.ScopeMetrics, error) { + return nil, nil } diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 81b12254f85..c88e82a1385 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -101,7 +101,7 @@ func New(opts ...Option) (*Exporter, error) { // this assumes that the default temporality selector will always return cumulative. // we only support cumulative temporality, so building our own reader enforces this. // TODO (#3244): Enable some way to configure the reader, but not change temporality. - reader := metric.NewManualReader(cfg.manualReaderOptions()...) + reader := metric.NewManualReader(cfg.readerOpts...) collector := &collector{ reader: reader, From b17ad41a0081a628b01cd5e75d32cf122d660428 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Tue, 5 Sep 2023 00:04:55 -0700 Subject: [PATCH 681/886] dependabot updates Tue Sep 5 06:35:43 UTC 2023 (#4477) Bump golang.org/x/sys from 0.11.0 to 0.12.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 46 files changed, 69 insertions(+), 69 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index d4515795b46..b6f936b6878 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 04674f850c3..88bd438f084 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 7ff3ee957b6..a06b3e3c80d 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.40.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 8661ceb6298..8034431e832 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index e09614c4f4c..2267dba0d6e 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 83ef51deb84..84ddaafcd0d 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= diff --git a/example/fib/go.mod b/example/fib/go.mod index 3f391b6e4da..e48997737dc 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index bfe2cc3f315..1880644703c 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 6e5730dd516..79e3280b69d 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index bfe2cc3f315..1880644703c 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index d6601690bf8..b35a09681c4 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 8661ceb6298..8034431e832 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 63390fe66c7..432805ec84f 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 9d85029550d..070aa80bbbe 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 6403fbe26bc..f63406443ed 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index bfe2cc3f315..1880644703c 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 596b1e690e8..7142301336e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/sdk v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index e5afa2cf689..2589fb129f2 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index 740c76dfdf5..1499c8532fc 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index e5afa2cf689..2589fb129f2 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 8c8cc598c8b..a2e094d2864 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 5a0de303faf..db79ebef1b1 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2889d41e240..77e9a31e4e5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index f66691565f5..8afc1f1ef92 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 0e238cf6970..abc327925b8 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index f66691565f5..8afc1f1ef92 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 2650287870b..e0b9cd0378b 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index e8634b6320f..74d3c70ab0f 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a7b78f5ccde..7385f7da9a9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 3dc069195a0..1f688edbcf9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -30,8 +30,8 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index c14958e30d8..8e27ae50fd1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.9.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index d9104ccda4b..bc19362fc78 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index b25c82a818d..4ea48560299 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -27,7 +27,7 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 78b97014e2c..8ca966deec1 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -36,8 +36,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 28f9a60b1c2..a4d7f26c0ea 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 594aa686923..918c4352bc3 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index a69603ca0d1..0db7eea656f 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 594aa686923..918c4352bc3 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index fbd3c1eaf74..47b9a95794e 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 1c34c9c928e..aff8d67cf0b 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 58b523a3f9a..5cc4c0d9613 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -201,7 +201,7 @@ require ( golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 308c7325a01..1fb0b9d15bf 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -835,8 +835,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/sdk/go.mod b/sdk/go.mod index 3d136f9b8b3..14acf886753 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.17.0 go.opentelemetry.io/otel/trace v1.17.0 - golang.org/x/sys v0.11.0 + golang.org/x/sys v0.12.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 7729e42a72e..a5f7da7d45d 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 285573b6973..72424175ea2 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 594aa686923..918c4352bc3 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From fc70923e533295d9c0124b1ed6ed23c0e1151fc6 Mon Sep 17 00:00:00 2001 From: Rangel Reale Date: Tue, 5 Sep 2023 14:00:06 -0300 Subject: [PATCH 682/886] Ignore value option for metricdatatest (#4447) --- CHANGELOG.md | 1 + .../metricdata/metricdatatest/assertion.go | 15 ++ .../metricdatatest/assertion_test.go | 183 ++++++++++++++++++ .../metricdata/metricdatatest/comparisons.go | 101 +++++----- 4 files changed, 253 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d2f1fd908f..96c0579e1a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) +- Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) ### Deprecated diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index f559a6432e8..d19696f583f 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -56,6 +56,7 @@ type Datatypes interface { type config struct { ignoreTimestamp bool ignoreExemplars bool + ignoreValue bool } func newConfig(opts []Option) config { @@ -93,6 +94,20 @@ func IgnoreExemplars() Option { }) } +// IgnoreValue disables checking if values are different. This can be +// useful for non-deterministic values, like measured durations. +// +// This will ignore the value and trace information for Exemplars; +// the buckets, zero count, scale, sum, max, min, and counts of +// ExponentialHistogramDataPoints; the buckets, sum, count, max, +// and min of HistogramDataPoints; the value of DataPoints. +func IgnoreValue() Option { + return fnOption(func(cfg config) config { + cfg.ignoreValue = true + return cfg + }) +} + // AssertEqual asserts that the two concrete data-types from the metricdata // package are equal. func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) bool { diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 3b9d8d6daa1..11ba70ed679 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -85,6 +85,20 @@ var ( SpanID: spanIDA, TraceID: traceIDA, } + exemplarInt64D = metricdata.Exemplar[int64]{ + FilteredAttributes: fltrAttrA, + Time: endA, + Value: 12, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64D = metricdata.Exemplar[float64]{ + FilteredAttributes: fltrAttrA, + Time: endA, + Value: 12.0, + SpanID: spanIDA, + TraceID: traceIDA, + } dataPointInt64A = metricdata.DataPoint[int64]{ Attributes: attrA, @@ -128,6 +142,20 @@ var ( Value: -1.0, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } + dataPointInt64D = metricdata.DataPoint[int64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Value: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + } + dataPointFloat64D = metricdata.DataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Value: 2.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + } minFloat64A = metricdata.NewExtrema(-1.) minInt64A = metricdata.NewExtrema[int64](-1) @@ -204,6 +232,30 @@ var ( Sum: 2, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } + histogramDataPointInt64D = metricdata.HistogramDataPoint[int64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 3, + Bounds: []float64{0, 10, 100}, + BucketCounts: []uint64{1, 1, 1}, + Max: maxInt64B, + Min: minInt64B, + Sum: 3, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + } + histogramDataPointFloat64D = metricdata.HistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 3, + Bounds: []float64{0, 10, 100}, + BucketCounts: []uint64{1, 1, 1}, + Max: maxFloat64B, + Min: minFloat64B, + Sum: 3, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + } exponentialBucket2 = metricdata.ExponentialBucket{ Offset: 2, @@ -301,6 +353,34 @@ var ( NegativeBucket: exponentialBucket2, Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, } + exponentialHistogramDataPointInt64D = metricdata.ExponentialHistogramDataPoint[int64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 6, + Min: minInt64B, + Max: maxInt64B, + Sum: 3, + Scale: 2, + ZeroCount: 3, + PositiveBucket: exponentialBucket4, + NegativeBucket: exponentialBucket5, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + } + exponentialHistogramDataPointFloat64D = metricdata.ExponentialHistogramDataPoint[float64]{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 6, + Min: minFloat64B, + Max: maxFloat64B, + Sum: 3, + Scale: 2, + ZeroCount: 3, + PositiveBucket: exponentialBucket4, + NegativeBucket: exponentialBucket5, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + } gaugeInt64A = metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, @@ -320,6 +400,12 @@ var ( gaugeFloat64C = metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, } + gaugeInt64D = metricdata.Gauge[int64]{ + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64D}, + } + gaugeFloat64D = metricdata.Gauge[float64]{ + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64D}, + } sumInt64A = metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, @@ -351,6 +437,16 @@ var ( IsMonotonic: true, DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, } + sumInt64D = metricdata.Sum[int64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[int64]{dataPointInt64D}, + } + sumFloat64D = metricdata.Sum[float64]{ + Temporality: metricdata.CumulativeTemporality, + IsMonotonic: true, + DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64D}, + } histogramInt64A = metricdata.Histogram[int64]{ Temporality: metricdata.CumulativeTemporality, @@ -376,6 +472,14 @@ var ( Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64C}, } + histogramInt64D = metricdata.Histogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64D}, + } + histogramFloat64D = metricdata.Histogram[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64D}, + } exponentialHistogramInt64A = metricdata.ExponentialHistogram[int64]{ Temporality: metricdata.CumulativeTemporality, @@ -401,6 +505,14 @@ var ( Temporality: metricdata.CumulativeTemporality, DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64C}, } + exponentialHistogramInt64D = metricdata.ExponentialHistogram[int64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64D}, + } + exponentialHistogramFloat64D = metricdata.ExponentialHistogram[float64]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64D}, + } metricsA = metricdata.Metrics{ Name: "A", @@ -420,6 +532,12 @@ var ( Unit: "1", Data: sumInt64C, } + metricsD = metricdata.Metrics{ + Name: "A", + Description: "A desc", + Unit: "1", + Data: sumInt64D, + } scopeMetricsA = metricdata.ScopeMetrics{ Scope: instrumentation.Scope{Name: "A"}, @@ -433,6 +551,10 @@ var ( Scope: instrumentation.Scope{Name: "A"}, Metrics: []metricdata.Metrics{metricsC}, } + scopeMetricsD = metricdata.ScopeMetrics{ + Scope: instrumentation.Scope{Name: "A"}, + Metrics: []metricdata.Metrics{metricsD}, + } resourceMetricsA = metricdata.ResourceMetrics{ Resource: resource.NewSchemaless(attribute.String("resource", "A")), @@ -446,6 +568,10 @@ var ( Resource: resource.NewSchemaless(attribute.String("resource", "A")), ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsC}, } + resourceMetricsD = metricdata.ResourceMetrics{ + Resource: resource.NewSchemaless(attribute.String("resource", "A")), + ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsD}, + } ) type equalFunc[T Datatypes] func(T, T, config) []string @@ -482,6 +608,17 @@ func testDatatypeIgnoreExemplars[T Datatypes](a, b T, f equalFunc[T]) func(*test } } +func testDatatypeIgnoreValue[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { + return func(t *testing.T) { + AssertEqual(t, a, a) + AssertEqual(t, b, b) + + c := newConfig([]Option{IgnoreValue()}) + r := f(a, b, c) + assert.Len(t, r, 0, "unexpected inequality") + } +} + func TestAssertEqual(t *testing.T) { t.Run("ResourceMetrics", testDatatype(resourceMetricsA, resourceMetricsB, equalResourceMetrics)) t.Run("ScopeMetrics", testDatatype(scopeMetricsA, scopeMetricsB, equalScopeMetrics)) @@ -557,6 +694,28 @@ func TestAssertEqualIgnoreExemplars(t *testing.T) { t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreExemplars(exponentialHistogramDataPointFloat64A, ehdpFloat64, equalExponentialHistogramDataPoints[float64])) } +func TestAssertEqualIgnoreValue(t *testing.T) { + t.Run("ResourceMetrics", testDatatypeIgnoreValue(resourceMetricsA, resourceMetricsD, equalResourceMetrics)) + t.Run("ScopeMetrics", testDatatypeIgnoreValue(scopeMetricsA, scopeMetricsD, equalScopeMetrics)) + t.Run("Metrics", testDatatypeIgnoreValue(metricsA, metricsD, equalMetrics)) + t.Run("HistogramInt64", testDatatypeIgnoreValue(histogramInt64A, histogramInt64D, equalHistograms[int64])) + t.Run("HistogramFloat64", testDatatypeIgnoreValue(histogramFloat64A, histogramFloat64D, equalHistograms[float64])) + t.Run("SumInt64", testDatatypeIgnoreValue(sumInt64A, sumInt64D, equalSums[int64])) + t.Run("SumFloat64", testDatatypeIgnoreValue(sumFloat64A, sumFloat64D, equalSums[float64])) + t.Run("GaugeInt64", testDatatypeIgnoreValue(gaugeInt64A, gaugeInt64D, equalGauges[int64])) + t.Run("GaugeFloat64", testDatatypeIgnoreValue(gaugeFloat64A, gaugeFloat64D, equalGauges[float64])) + t.Run("HistogramDataPointInt64", testDatatypeIgnoreValue(histogramDataPointInt64A, histogramDataPointInt64D, equalHistogramDataPoints[int64])) + t.Run("HistogramDataPointFloat64", testDatatypeIgnoreValue(histogramDataPointFloat64A, histogramDataPointFloat64D, equalHistogramDataPoints[float64])) + t.Run("DataPointInt64", testDatatypeIgnoreValue(dataPointInt64A, dataPointInt64D, equalDataPoints[int64])) + t.Run("DataPointFloat64", testDatatypeIgnoreValue(dataPointFloat64A, dataPointFloat64D, equalDataPoints[float64])) + t.Run("ExemplarInt64", testDatatypeIgnoreValue(exemplarInt64A, exemplarInt64D, equalExemplars[int64])) + t.Run("ExemplarFloat64", testDatatypeIgnoreValue(exemplarFloat64A, exemplarFloat64D, equalExemplars[float64])) + t.Run("ExponentialHistogramInt64", testDatatypeIgnoreValue(exponentialHistogramInt64A, exponentialHistogramInt64D, equalExponentialHistograms[int64])) + t.Run("ExponentialHistogramFloat64", testDatatypeIgnoreValue(exponentialHistogramFloat64A, exponentialHistogramFloat64D, equalExponentialHistograms[float64])) + t.Run("ExponentialHistogramDataPointInt64", testDatatypeIgnoreValue(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64D, equalExponentialHistogramDataPoints[int64])) + t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreValue(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64D, equalExponentialHistogramDataPoints[float64])) +} + type unknownAggregation struct { metricdata.Aggregation } @@ -587,47 +746,71 @@ func TestAssertAggregationsEqual(t *testing.T) { r = equalAggregations(sumInt64A, sumInt64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "sums should be equal: %v", r) + r = equalAggregations(sumInt64A, sumInt64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", sumInt64A, sumInt64D) + r = equalAggregations(sumFloat64A, sumFloat64B, config{}) assert.Greaterf(t, len(r), 0, "sums should not be equal: %v == %v", sumFloat64A, sumFloat64B) r = equalAggregations(sumFloat64A, sumFloat64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "sums should be equal: %v", r) + r = equalAggregations(sumFloat64A, sumFloat64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", sumFloat64A, sumFloat64D) + r = equalAggregations(gaugeInt64A, gaugeInt64B, config{}) assert.Greaterf(t, len(r), 0, "gauges should not be equal: %v == %v", gaugeInt64A, gaugeInt64B) r = equalAggregations(gaugeInt64A, gaugeInt64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "gauges should be equal: %v", r) + r = equalAggregations(gaugeInt64A, gaugeInt64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", gaugeInt64A, gaugeInt64D) + r = equalAggregations(gaugeFloat64A, gaugeFloat64B, config{}) assert.Greaterf(t, len(r), 0, "gauges should not be equal: %v == %v", gaugeFloat64A, gaugeFloat64B) r = equalAggregations(gaugeFloat64A, gaugeFloat64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "gauges should be equal: %v", r) + r = equalAggregations(gaugeFloat64A, gaugeFloat64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", gaugeFloat64A, gaugeFloat64D) + r = equalAggregations(histogramInt64A, histogramInt64B, config{}) assert.Greaterf(t, len(r), 0, "histograms should not be equal: %v == %v", histogramInt64A, histogramInt64B) r = equalAggregations(histogramInt64A, histogramInt64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "histograms should be equal: %v", r) + r = equalAggregations(histogramInt64A, histogramInt64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", histogramInt64A, histogramInt64D) + r = equalAggregations(histogramFloat64A, histogramFloat64B, config{}) assert.Greaterf(t, len(r), 0, "histograms should not be equal: %v == %v", histogramFloat64A, histogramFloat64B) r = equalAggregations(histogramFloat64A, histogramFloat64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "histograms should be equal: %v", r) + r = equalAggregations(histogramFloat64A, histogramFloat64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", histogramFloat64A, histogramFloat64D) + r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64B, config{}) assert.Greaterf(t, len(r), 0, "exponential histograms should not be equal: %v == %v", exponentialHistogramInt64A, exponentialHistogramInt64B) r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "exponential histograms should be equal: %v", r) + r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", exponentialHistogramInt64A, exponentialHistogramInt64D) + r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64B, config{}) assert.Greaterf(t, len(r), 0, "exponential histograms should not be equal: %v == %v", exponentialHistogramFloat64A, exponentialHistogramFloat64B) r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64C, config{ignoreTimestamp: true}) assert.Len(t, r, 0, "exponential histograms should be equal: %v", r) + + r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64D, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", exponentialHistogramFloat64A, exponentialHistogramFloat64D) } func TestAssertAttributes(t *testing.T) { diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 4bb3b19fb0b..5cdca6fe2c6 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -252,8 +252,10 @@ func equalDataPoints[N int64 | float64](a, b metricdata.DataPoint[N], cfg config } } - if a.Value != b.Value { - reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + if !cfg.ignoreValue { + if a.Value != b.Value { + reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + } } if !cfg.ignoreExemplars { @@ -290,23 +292,25 @@ func equalHistogramDataPoints[N int64 | float64](a, b metricdata.HistogramDataPo reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) } } - if a.Count != b.Count { - reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) - } - if !equalSlices(a.Bounds, b.Bounds) { - reasons = append(reasons, notEqualStr("Bounds", a.Bounds, b.Bounds)) - } - if !equalSlices(a.BucketCounts, b.BucketCounts) { - reasons = append(reasons, notEqualStr("BucketCounts", a.BucketCounts, b.BucketCounts)) - } - if !eqExtrema(a.Min, b.Min) { - reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) - } - if !eqExtrema(a.Max, b.Max) { - reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) - } - if a.Sum != b.Sum { - reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + if !cfg.ignoreValue { + if a.Count != b.Count { + reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) + } + if !equalSlices(a.Bounds, b.Bounds) { + reasons = append(reasons, notEqualStr("Bounds", a.Bounds, b.Bounds)) + } + if !equalSlices(a.BucketCounts, b.BucketCounts) { + reasons = append(reasons, notEqualStr("BucketCounts", a.BucketCounts, b.BucketCounts)) + } + if !eqExtrema(a.Min, b.Min) { + reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) + } + if !eqExtrema(a.Max, b.Max) { + reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) + } + if a.Sum != b.Sum { + reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + } } if !cfg.ignoreExemplars { r := compareDiff(diffSlices( @@ -366,35 +370,36 @@ func equalExponentialHistogramDataPoints[N int64 | float64](a, b metricdata.Expo reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) } } - if a.Count != b.Count { - reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) - } - if !eqExtrema(a.Min, b.Min) { - reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) - } - if !eqExtrema(a.Max, b.Max) { - reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) - } - if a.Sum != b.Sum { - reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) - } + if !cfg.ignoreValue { + if a.Count != b.Count { + reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) + } + if !eqExtrema(a.Min, b.Min) { + reasons = append(reasons, notEqualStr("Min", a.Min, b.Min)) + } + if !eqExtrema(a.Max, b.Max) { + reasons = append(reasons, notEqualStr("Max", a.Max, b.Max)) + } + if a.Sum != b.Sum { + reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + } - if a.Scale != b.Scale { - reasons = append(reasons, notEqualStr("Scale", a.Scale, b.Scale)) - } - if a.ZeroCount != b.ZeroCount { - reasons = append(reasons, notEqualStr("ZeroCount", a.ZeroCount, b.ZeroCount)) - } + if a.Scale != b.Scale { + reasons = append(reasons, notEqualStr("Scale", a.Scale, b.Scale)) + } + if a.ZeroCount != b.ZeroCount { + reasons = append(reasons, notEqualStr("ZeroCount", a.ZeroCount, b.ZeroCount)) + } - r := equalExponentialBuckets(a.PositiveBucket, b.PositiveBucket, cfg) - if len(r) > 0 { - reasons = append(reasons, r...) - } - r = equalExponentialBuckets(a.NegativeBucket, b.NegativeBucket, cfg) - if len(r) > 0 { - reasons = append(reasons, r...) + r := equalExponentialBuckets(a.PositiveBucket, b.PositiveBucket, cfg) + if len(r) > 0 { + reasons = append(reasons, r...) + } + r = equalExponentialBuckets(a.NegativeBucket, b.NegativeBucket, cfg) + if len(r) > 0 { + reasons = append(reasons, r...) + } } - if !cfg.ignoreExemplars { r := compareDiff(diffSlices( a.Exemplars, @@ -518,8 +523,10 @@ func equalExemplars[N int64 | float64](a, b metricdata.Exemplar[N], cfg config) reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) } } - if a.Value != b.Value { - reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + if !cfg.ignoreValue { + if a.Value != b.Value { + reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + } } if !equalSlices(a.SpanID, b.SpanID) { reasons = append(reasons, notEqualStr("SpanID", a.SpanID, b.SpanID)) From 01d64c3e7757df743d6d85de681b750029da3bf2 Mon Sep 17 00:00:00 2001 From: bryan-aguilar <46550959+bryan-aguilar@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:06:58 -0700 Subject: [PATCH 683/886] Update go versions used in workflows (#4480) --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/dependabot.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9877d7ca989..a9b61f2a9e3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: "1.21" + DEFAULT_GO_VERSION: "~1.21.1" jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0dc91bfea2..1758d02712e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "1.21" + DEFAULT_GO_VERSION: "~1.21.1" jobs: lint: runs-on: ubuntu-latest @@ -99,7 +99,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["1.21", "1.20", 1.19] + go-version: ["~1.21.1", "~1.20.8", 1.19] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 9d4e27a9e6e..550c2e2bbe5 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: - go-version: '^1.21.0' + go-version: '^1.21.1' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: From 76c370f1b128a0dab2d456f0fc26b59c4595fb36 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 6 Sep 2023 13:55:56 -0700 Subject: [PATCH 684/886] Document public metric SDK interfaces to remain stable (#4396) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Document public ifaces to remain stable Resolve #3673 * Revert changes to aggregation pkg * Document reader as an interface that can be extended * Address feedback --------- Co-authored-by: Chester Cheung Co-authored-by: Robert Pająk --- sdk/metric/exporter.go | 10 ++++++++++ sdk/metric/reader.go | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/sdk/metric/exporter.go b/sdk/metric/exporter.go index 695cf466c0e..da8941b378d 100644 --- a/sdk/metric/exporter.go +++ b/sdk/metric/exporter.go @@ -33,12 +33,16 @@ type Exporter interface { // This method needs to be concurrent safe with itself and all the other // Exporter methods. Temporality(InstrumentKind) metricdata.Temporality + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. // Aggregation returns the Aggregation to use for an instrument kind. // // This method needs to be concurrent safe with itself and all the other // Exporter methods. Aggregation(InstrumentKind) Aggregation + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. // Export serializes and transmits metric data to a receiver. // @@ -55,6 +59,8 @@ type Exporter interface { // exporter needs to hold this data after it returns, it needs to make a // copy. Export(context.Context, *metricdata.ResourceMetrics) error + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. // ForceFlush flushes any metric data held by an exporter. // @@ -63,6 +69,8 @@ type Exporter interface { // // This method needs to be concurrent safe. ForceFlush(context.Context) error + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. // Shutdown flushes all metric data held by an exporter and releases any // held computational resources. @@ -75,4 +83,6 @@ type Exporter interface { // // This method needs to be concurrent safe. Shutdown(context.Context) error + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. } diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 6ad9680413b..44e09fb355d 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -50,6 +50,8 @@ var errNonPositiveDuration = fmt.Errorf("non-positive duration") // // Pull-based exporters will typically implement Register // themselves, since they read on demand. +// +// Warning: methods may be added to this interface in minor releases. type Reader interface { // register registers a Reader with a MeterProvider. // The producer argument allows the Reader to signal the sdk to collect @@ -75,6 +77,8 @@ type Reader interface { // This method needs to be concurrent safe, and the cancelation of the // passed context is expected to be honored. Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. // Shutdown flushes all metric measurements held in an export pipeline and releases any // held computational resources. @@ -89,6 +93,8 @@ type Reader interface { // // This method needs to be concurrent safe. Shutdown(context.Context) error + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. } // sdkProducer produces metrics for a Reader. @@ -101,10 +107,15 @@ type sdkProducer interface { // Producer produces metrics for a Reader from an external source. type Producer interface { + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + // Produce returns aggregated metrics from an external source. // // This method should be safe to call concurrently. Produce(context.Context) ([]metricdata.ScopeMetrics, error) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. } // produceHolder is used as an atomic.Value to wrap the non-concrete producer From 6eedabf874a8fffbccbeeea1410d6d0d12784e72 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Thu, 7 Sep 2023 10:46:49 +0200 Subject: [PATCH 685/886] Collector example: add metrics and use official port (#4466) --- example/otel-collector/go.mod | 11 +++- example/otel-collector/main.go | 94 ++++++++++++++++++++++++++++------ 2 files changed, 88 insertions(+), 17 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 432805ec84f..25b45eec11a 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -9,8 +9,11 @@ replace ( require ( go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.40.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 + go.opentelemetry.io/otel/metric v1.17.0 go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/otel/trace v1.17.0 google.golang.org/grpc v1.57.0 ) @@ -21,8 +24,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.12.0 // indirect @@ -39,3 +42,9 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc + +replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric + +replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 21b68d8122e..37986a49abe 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -30,37 +30,30 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" + sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) -// Initializes an OTLP exporter, and configures the corresponding trace and -// metric providers. -func initProvider() (func(context.Context) error, error) { +// Initialize a gRPC connection to be used by both the tracer and meter +// providers. +func initConn() (*grpc.ClientConn, error) { ctx := context.Background() - res, err := resource.New(ctx, - resource.WithAttributes( - // the service name used to display traces in backends - semconv.ServiceName("test-service"), - ), - ) - if err != nil { - return nil, fmt.Errorf("failed to create resource: %w", err) - } - // If the OpenTelemetry Collector is running on a local cluster (minikube or // microk8s), it should be accessible through the NodePort service at the - // `localhost:30080` endpoint. Otherwise, replace `localhost` with the + // `localhost:4317` endpoint. Otherwise, replace `localhost` with the // endpoint of your cluster. If you run the app inside k8s, then you can // probably connect directly to the service through dns. ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - conn, err := grpc.DialContext(ctx, "localhost:30080", + conn, err := grpc.DialContext(ctx, "localhost:4317", // Note the use of insecure transport here. TLS is recommended in production. grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), @@ -69,6 +62,24 @@ func initProvider() (func(context.Context) error, error) { return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err) } + return conn, err +} + +// Initializes an OTLP exporter, and configures the corresponding trace +// provider. +func initTracerProvider(conn *grpc.ClientConn) (func(context.Context) error, error) { + ctx := context.Background() + + res, err := resource.New(ctx, + resource.WithAttributes( + // the service name used to display traces in backends + semconv.ServiceName("test-service"), + ), + ) + if err != nil { + return nil, fmt.Errorf("failed to create resource: %w", err) + } + // Set up a trace exporter traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithGRPCConn(conn)) if err != nil { @@ -92,13 +103,47 @@ func initProvider() (func(context.Context) error, error) { return tracerProvider.Shutdown, nil } +// Initializes an OTLP exporter, and configures the corresponding meter +// provider. +func initMeterProvider(conn *grpc.ClientConn) (func(context.Context) error, error) { + ctx := context.Background() + + res, err := resource.New(ctx, + resource.WithAttributes( + // the service name used to display traces in backends + semconv.ServiceName("test-service"), + ), + ) + if err != nil { + return nil, fmt.Errorf("failed to create resource: %w", err) + } + + metricExporter, err := otlpmetricgrpc.New(ctx, otlpmetricgrpc.WithGRPCConn(conn)) + if err != nil { + return nil, fmt.Errorf("failed to create metrics exporter: %w", err) + } + + meterProvider := sdkmetric.NewMeterProvider( + sdkmetric.WithReader(sdkmetric.NewPeriodicReader(metricExporter)), + sdkmetric.WithResource(res), + ) + otel.SetMeterProvider(meterProvider) + + return meterProvider.Shutdown, nil +} + func main() { log.Printf("Waiting for connection...") ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() - shutdown, err := initProvider() + conn, err := initConn() + if err != nil { + log.Fatal(err) + } + + shutdown, err := initTracerProvider(conn) if err != nil { log.Fatal(err) } @@ -108,7 +153,18 @@ func main() { } }() + shutdown, err = initMeterProvider(conn) + if err != nil { + log.Fatal(err) + } + defer func() { + if err := shutdown(ctx); err != nil { + log.Fatal("failed to shutdown MeterProvider: %w", err) + } + }() + tracer := otel.Tracer("test-tracer") + meter := otel.Meter("test-meter") // Attributes represent additional key-value descriptors that can be bound // to a metric observer or recorder. @@ -118,6 +174,11 @@ func main() { attribute.String("attrC", "vanilla"), } + runCount, err := meter.Int64Counter("run", metric.WithDescription("The number of times the iteration ran")) + if err != nil { + log.Fatal(err) + } + // work begins ctx, span := tracer.Start( ctx, @@ -126,6 +187,7 @@ func main() { defer span.End() for i := 0; i < 10; i++ { _, iSpan := tracer.Start(ctx, fmt.Sprintf("Sample-%d", i)) + runCount.Add(ctx, 1, metric.WithAttributes(commonAttrs...)) log.Printf("Doing really hard work (%d / 10)\n", i+1) <-time.After(time.Second) From 9737995cdbf1cd30234352ec1298f5a68169a0e6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 7 Sep 2023 10:18:29 -0700 Subject: [PATCH 686/886] Drop support for Go 1.19 (#4481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Drop support for Go 1.19 * Add change to changelog * Bump all modules to 1.20 * Update exponential_histogram_test.go --------- Co-authored-by: Robert Pająk --- .github/workflows/ci.yml | 2 +- .github/workflows/create-dependabot-pr.yml | 2 +- CHANGELOG.md | 1 + Makefile | 2 +- README.md | 5 --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/test/go.mod | 2 +- bridge/opentracing/go.mod | 2 +- bridge/opentracing/test/go.mod | 2 +- example/fib/go.mod | 2 +- example/namedtracer/go.mod | 2 +- example/opencensus/go.mod | 2 +- example/otel-collector/go.mod | 2 +- example/passthrough/go.mod | 2 +- example/prometheus/go.mod | 2 +- example/view/go.mod | 2 +- example/zipkin/go.mod | 2 +- exporters/otlp/otlpmetric/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/prometheus/go.mod | 2 +- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/zipkin/go.mod | 2 +- go.mod | 2 +- internal/tools/go.mod | 2 +- metric/go.mod | 2 +- schema/go.mod | 2 +- sdk/go.mod | 2 +- sdk/metric/go.mod | 2 +- .../aggregate/exponential_histogram_test.go | 32 ++++++++----------- trace/go.mod | 2 +- 35 files changed, 46 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1758d02712e..f99926ccf03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["~1.21.1", "~1.20.8", 1.19] + go-version: ["~1.21.1", "~1.20.8"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 6506a59f225..b827d831079 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -10,7 +10,7 @@ jobs: - name: Install Go uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: "~1.21.1" - uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c0579e1a5..8e43e3d620b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Removed the deprecated `go.opentelemetry.io/otel/example/jaeger` package. (#4467) - Removed the deprecated `go.opentelemetry.io/otel/sdk/metric/aggregation` package. (#4468) - Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) +- Dropped guaranteed support for versions of Go less than 1.20. (#4481) ## [1.17.0/0.40.0/0.0.5] 2023-08-28 diff --git a/Makefile b/Makefile index c996d227bea..5c311706b0c 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ go-mod-tidy/%: DIR=$* go-mod-tidy/%: | crosslink @echo "$(GO) mod tidy in $(DIR)" \ && cd $(DIR) \ - && $(GO) mod tidy -compat=1.19 + && $(GO) mod tidy -compat=1.20 .PHONY: lint-modules lint-modules: go-mod-tidy diff --git a/README.md b/README.md index 4e5531f3052..634326ef833 100644 --- a/README.md +++ b/README.md @@ -55,19 +55,14 @@ Currently, this project supports the following environments. |---------|------------|--------------| | Ubuntu | 1.21 | amd64 | | Ubuntu | 1.20 | amd64 | -| Ubuntu | 1.19 | amd64 | | Ubuntu | 1.21 | 386 | | Ubuntu | 1.20 | 386 | -| Ubuntu | 1.19 | 386 | | MacOS | 1.21 | amd64 | | MacOS | 1.20 | amd64 | -| MacOS | 1.19 | amd64 | | Windows | 1.21 | amd64 | | Windows | 1.20 | amd64 | -| Windows | 1.19 | amd64 | | Windows | 1.21 | 386 | | Windows | 1.20 | 386 | -| Windows | 1.19 | 386 | While this project should work for other systems, no compatibility guarantees are made for those systems currently. diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index b6f936b6878..a9f1bb6b34f 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus -go 1.19 +go 1.20 require ( github.com/stretchr/testify v1.8.4 diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index a06b3e3c80d..976af1e1997 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opencensus/test -go 1.19 +go 1.20 require ( go.opencensus.io v0.24.0 diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 8a81f16ae86..9bc855ff228 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing -go 1.19 +go 1.20 replace go.opentelemetry.io/otel => ../.. diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 2267dba0d6e..6c357a4095e 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/bridge/opentracing/test -go 1.19 +go 1.20 replace go.opentelemetry.io/otel => ../../.. diff --git a/example/fib/go.mod b/example/fib/go.mod index e48997737dc..7817316d4fa 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/fib -go 1.19 +go 1.20 require ( go.opentelemetry.io/otel v1.17.0 diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 79e3280b69d..93e5927ee88 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/namedtracer -go 1.19 +go 1.20 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index b35a09681c4..98d05bf934d 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/opencensus -go 1.19 +go 1.20 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 25b45eec11a..43754c76dd6 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/otel-collector -go 1.19 +go 1.20 replace ( go.opentelemetry.io/otel => ../.. diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index f63406443ed..967640ef624 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/passthrough -go 1.19 +go 1.20 require ( go.opentelemetry.io/otel v1.17.0 diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 7142301336e..907c7e8ade6 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/prometheus -go 1.19 +go 1.20 require ( github.com/prometheus/client_golang v1.16.0 diff --git a/example/view/go.mod b/example/view/go.mod index 1499c8532fc..58b90f6cb44 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/view -go 1.19 +go 1.20 require ( github.com/prometheus/client_golang v1.16.0 diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index a2e094d2864..e7c16c56ff3 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/example/zipkin -go 1.19 +go 1.20 replace ( go.opentelemetry.io/otel => ../.. diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index ad1dc908590..33f5411a29d 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric -go 1.19 +go 1.20 require github.com/stretchr/testify v1.8.4 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 77e9a31e4e5..57130d82377 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc -go 1.19 +go 1.20 retract v0.32.2 // Contains unresolvable dependencies. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index abc327925b8..176a3203326 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp -go 1.19 +go 1.20 retract v0.32.2 // Contains unresolvable dependencies. diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e0b9cd0378b..35b59d3d070 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace -go 1.19 +go 1.20 require ( github.com/google/go-cmp v0.5.9 diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7385f7da9a9..fcc19d799d3 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc -go 1.19 +go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 8e27ae50fd1..962c12054f1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp -go 1.19 +go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 4ea48560299..e6a4d7a810b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/prometheus -go 1.19 +go 1.20 require ( github.com/prometheus/client_golang v1.16.0 diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index a4d7f26c0ea..664040073ef 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdoutmetric -go 1.19 +go 1.20 require ( github.com/stretchr/testify v1.8.4 diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 0db7eea656f..999cabde1b8 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/stdout/stdouttrace -go 1.19 +go 1.20 replace ( go.opentelemetry.io/otel => ../../.. diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 47b9a95794e..18b584f07be 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/exporters/zipkin -go 1.19 +go 1.20 require ( github.com/go-logr/logr v1.2.4 diff --git a/go.mod b/go.mod index 73bade0c44a..841f6eb2a7b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel -go 1.19 +go 1.20 require ( github.com/go-logr/logr v1.2.4 diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5cc4c0d9613..f0d316074e4 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/internal/tools -go 1.19 +go 1.20 require ( github.com/client9/misspell v0.3.4 diff --git a/metric/go.mod b/metric/go.mod index 35d7e92b104..ac877bfd675 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/metric -go 1.19 +go 1.20 require ( github.com/stretchr/testify v1.8.4 diff --git a/schema/go.mod b/schema/go.mod index 674b0067f47..0c2d3e6d00f 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/schema -go 1.19 +go 1.20 require ( github.com/Masterminds/semver/v3 v3.2.1 diff --git a/sdk/go.mod b/sdk/go.mod index 14acf886753..9b757208d60 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk -go 1.19 +go 1.20 replace go.opentelemetry.io/otel => ../ diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 72424175ea2..f35dc51a7b8 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/sdk/metric -go 1.19 +go 1.20 require ( github.com/go-logr/logr v1.2.4 diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index cac734c9312..7dbb71b15bd 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -51,16 +51,13 @@ func TestExpoHistogramDataPointRecord(t *testing.T) { t.Run("int64 MinMaxSum", testExpoHistogramMinMaxSumInt64) } -// TODO: This can be defined in the test after we drop support for go1.19. -type expoHistogramDataPointRecordTestCase[N int64 | float64] struct { - maxSize int - values []N - expectedBuckets expoBuckets - expectedScale int -} - func testExpoHistogramDataPointRecord[N int64 | float64](t *testing.T) { - testCases := []expoHistogramDataPointRecordTestCase[N]{ + testCases := []struct { + maxSize int + values []N + expectedBuckets expoBuckets + expectedScale int + }{ { maxSize: 4, values: []N{2, 4, 1}, @@ -746,15 +743,6 @@ func TestExponentialHistogramAggregation(t *testing.T) { t.Run("Float64", testExponentialHistogramAggregation[float64]) } -// TODO: This can be defined in the test after we drop support for go1.19. -type exponentialHistogramAggregationTestCase[N int64 | float64] struct { - name string - build func() (Measure[N], ComputeAggregation) - input [][]N - want metricdata.ExponentialHistogram[N] - wantCount int -} - func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { const ( maxSize = 4 @@ -763,7 +751,13 @@ func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { noSum = false ) - tests := []exponentialHistogramAggregationTestCase[N]{ + tests := []struct { + name string + build func() (Measure[N], ComputeAggregation) + input [][]N + want metricdata.ExponentialHistogram[N] + wantCount int + }{ { name: "Delta Single", build: func() (Measure[N], ComputeAggregation) { diff --git a/trace/go.mod b/trace/go.mod index 21570ab1e3c..a80423d9b4c 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -1,6 +1,6 @@ module go.opentelemetry.io/otel/trace -go 1.19 +go 1.20 replace go.opentelemetry.io/otel => ../ From e44ea5cc7fa82cbbc839e69829e7660b6e0c7536 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 9 Sep 2023 07:52:17 -0700 Subject: [PATCH 687/886] Revert "Collector example: add metrics and use official port (#4466)" (#4487) This reverts commit 6eedabf874a8fffbccbeeea1410d6d0d12784e72. --- example/otel-collector/go.mod | 11 +--- example/otel-collector/main.go | 94 ++++++---------------------------- 2 files changed, 17 insertions(+), 88 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 43754c76dd6..936660e313a 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -9,11 +9,8 @@ replace ( require ( go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.40.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 - go.opentelemetry.io/otel/metric v1.17.0 go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/otel/trace v1.17.0 google.golang.org/grpc v1.57.0 ) @@ -24,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.12.0 // indirect @@ -42,9 +39,3 @@ replace go.opentelemetry.io/otel/exporters/otlp/otlptrace => ../../exporters/otl replace go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc => ../../exporters/otlp/otlptrace/otlptracegrpc replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc => ../../exporters/otlp/otlpmetric/otlpmetricgrpc - -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../../exporters/otlp/otlpmetric - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 37986a49abe..21b68d8122e 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -30,30 +30,37 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" - sdkmetric "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" ) -// Initialize a gRPC connection to be used by both the tracer and meter -// providers. -func initConn() (*grpc.ClientConn, error) { +// Initializes an OTLP exporter, and configures the corresponding trace and +// metric providers. +func initProvider() (func(context.Context) error, error) { ctx := context.Background() + res, err := resource.New(ctx, + resource.WithAttributes( + // the service name used to display traces in backends + semconv.ServiceName("test-service"), + ), + ) + if err != nil { + return nil, fmt.Errorf("failed to create resource: %w", err) + } + // If the OpenTelemetry Collector is running on a local cluster (minikube or // microk8s), it should be accessible through the NodePort service at the - // `localhost:4317` endpoint. Otherwise, replace `localhost` with the + // `localhost:30080` endpoint. Otherwise, replace `localhost` with the // endpoint of your cluster. If you run the app inside k8s, then you can // probably connect directly to the service through dns. ctx, cancel := context.WithTimeout(ctx, time.Second) defer cancel() - conn, err := grpc.DialContext(ctx, "localhost:4317", + conn, err := grpc.DialContext(ctx, "localhost:30080", // Note the use of insecure transport here. TLS is recommended in production. grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), @@ -62,24 +69,6 @@ func initConn() (*grpc.ClientConn, error) { return nil, fmt.Errorf("failed to create gRPC connection to collector: %w", err) } - return conn, err -} - -// Initializes an OTLP exporter, and configures the corresponding trace -// provider. -func initTracerProvider(conn *grpc.ClientConn) (func(context.Context) error, error) { - ctx := context.Background() - - res, err := resource.New(ctx, - resource.WithAttributes( - // the service name used to display traces in backends - semconv.ServiceName("test-service"), - ), - ) - if err != nil { - return nil, fmt.Errorf("failed to create resource: %w", err) - } - // Set up a trace exporter traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithGRPCConn(conn)) if err != nil { @@ -103,47 +92,13 @@ func initTracerProvider(conn *grpc.ClientConn) (func(context.Context) error, err return tracerProvider.Shutdown, nil } -// Initializes an OTLP exporter, and configures the corresponding meter -// provider. -func initMeterProvider(conn *grpc.ClientConn) (func(context.Context) error, error) { - ctx := context.Background() - - res, err := resource.New(ctx, - resource.WithAttributes( - // the service name used to display traces in backends - semconv.ServiceName("test-service"), - ), - ) - if err != nil { - return nil, fmt.Errorf("failed to create resource: %w", err) - } - - metricExporter, err := otlpmetricgrpc.New(ctx, otlpmetricgrpc.WithGRPCConn(conn)) - if err != nil { - return nil, fmt.Errorf("failed to create metrics exporter: %w", err) - } - - meterProvider := sdkmetric.NewMeterProvider( - sdkmetric.WithReader(sdkmetric.NewPeriodicReader(metricExporter)), - sdkmetric.WithResource(res), - ) - otel.SetMeterProvider(meterProvider) - - return meterProvider.Shutdown, nil -} - func main() { log.Printf("Waiting for connection...") ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() - conn, err := initConn() - if err != nil { - log.Fatal(err) - } - - shutdown, err := initTracerProvider(conn) + shutdown, err := initProvider() if err != nil { log.Fatal(err) } @@ -153,18 +108,7 @@ func main() { } }() - shutdown, err = initMeterProvider(conn) - if err != nil { - log.Fatal(err) - } - defer func() { - if err := shutdown(ctx); err != nil { - log.Fatal("failed to shutdown MeterProvider: %w", err) - } - }() - tracer := otel.Tracer("test-tracer") - meter := otel.Meter("test-meter") // Attributes represent additional key-value descriptors that can be bound // to a metric observer or recorder. @@ -174,11 +118,6 @@ func main() { attribute.String("attrC", "vanilla"), } - runCount, err := meter.Int64Counter("run", metric.WithDescription("The number of times the iteration ran")) - if err != nil { - log.Fatal(err) - } - // work begins ctx, span := tracer.Start( ctx, @@ -187,7 +126,6 @@ func main() { defer span.End() for i := 0; i < 10; i++ { _, iSpan := tracer.Start(ctx, fmt.Sprintf("Sample-%d", i)) - runCount.Add(ctx, 1, metric.WithAttributes(commonAttrs...)) log.Printf("Doing really hard work (%d / 10)\n", i+1) <-time.After(time.Second) From 8ef73395ea22daf7627e7fd75223f1a298697fd9 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 10 Sep 2023 07:42:09 -0700 Subject: [PATCH 688/886] dependabot updates Sun Sep 10 14:30:56 UTC 2023 (#4498) Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump golang.org/x/tools from 0.12.0 to 0.13.0 in /internal/tools Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /example/otel-collector Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.57.0 to 1.58.0 in /exporters/otlp/otlptrace/otlptracehttp Bump actions/checkout from 3 to 4 --- bridge/opentracing/test/go.mod | 8 +++---- bridge/opentracing/test/go.sum | 16 +++++++------- example/otel-collector/go.mod | 10 ++++----- example/otel-collector/go.sum | 22 +++++++++---------- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 ++++----- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 22 +++++++++---------- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 10 ++++----- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 22 +++++++++---------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 ++++----- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 22 +++++++++---------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++++----- exporters/otlp/otlptrace/otlptracehttp/go.sum | 22 +++++++++---------- internal/tools/go.mod | 8 +++---- internal/tools/go.sum | 18 +++++++-------- 14 files changed, 105 insertions(+), 105 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 6c357a4095e..cd53853c74f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.17.0 go.opentelemetry.io/otel/bridge/opentracing v1.17.0 - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.58.0 ) require ( @@ -25,10 +25,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/net v0.9.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 84ddaafcd0d..b3b28952647 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -36,26 +36,26 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 936660e313a..1d682859741 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 go.opentelemetry.io/otel/sdk v1.17.0 go.opentelemetry.io/otel/trace v1.17.0 - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.58.0 ) require ( @@ -24,11 +24,11 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 070aa80bbbe..227a74e5462 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -19,20 +19,20 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 57130d82377..023c8435586 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,8 +13,8 @@ require ( go.opentelemetry.io/otel/sdk v1.17.0 go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.57.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 + google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 ) @@ -28,10 +28,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 8afc1f1ef92..e4b12d31f5c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -27,20 +27,20 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 176a3203326..e47de4755ce 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk v1.17.0 go.opentelemetry.io/otel/sdk/metric v0.40.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 ) @@ -27,11 +27,11 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect go.opentelemetry.io/otel/trace v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 8afc1f1ef92..e4b12d31f5c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -27,20 +27,20 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index fcc19d799d3..0698b587700 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,8 +11,8 @@ require ( go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc - google.golang.org/grpc v1.57.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 + google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 ) @@ -25,10 +25,10 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 1f688edbcf9..36088fe05c8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -28,20 +28,20 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 962c12054f1..4add0e917e0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.17.0 go.opentelemetry.io/otel/trace v1.17.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.57.0 + google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 ) @@ -23,11 +23,11 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.17.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.9.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index bc19362fc78..2fd37969a31 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -26,20 +26,20 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e h1:Ao9GzfUMPH3zjVfzXG5rlWlk+Q8MXWKwWpwVQE1MXfw= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc h1:kVKPf/IiYSBWEWtkIn6wZXwWGCnLKcC8oWfZvXjsGnM= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc h1:XSJ8Vk1SWuNr8S18z1NZSziL0CPIXLCCMDOEFtHBOFc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= +google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= +google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index f0d316074e4..ae996729f3d 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.11.0 go.opentelemetry.io/build-tools/semconvgen v0.11.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.12.0 + golang.org/x/tools v0.13.0 ) require ( @@ -196,13 +196,13 @@ require ( go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.12.0 // indirect + golang.org/x/crypto v0.13.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.14.0 // indirect + golang.org/x/net v0.15.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.12.0 // indirect - golang.org/x/text v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 1fb0b9d15bf..6ce63a44950 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -654,8 +654,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -747,8 +747,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -844,7 +844,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -857,8 +857,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -932,8 +932,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss= -golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 77d62375754ce036868cbdf1d4eae4a6faf1f0e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 10 Sep 2023 07:55:55 -0700 Subject: [PATCH 689/886] Bump actions/checkout from 3 to 4 (#4490) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/changelog.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/codespell.yaml | 2 +- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/dependabot.yml | 2 +- .github/workflows/gosec.yml | 2 +- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- .github/workflows/markdown-fail-fast.yml | 4 ++-- .github/workflows/markdown.yml | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a9b61f2a9e3..6d546b9b49c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -10,7 +10,7 @@ jobs: name: Benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index a1bae7d71ce..2cd1e4d2676 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -16,7 +16,7 @@ jobs: if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check for CHANGELOG changes run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f99926ccf03..30b8e1250bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -50,7 +50,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV @@ -113,7 +113,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Environment run: | echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 72ab609eb45..55cb5ddcd19 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/codespell.yaml b/.github/workflows/codespell.yaml index 83b68e1fd41..774c020cb68 100644 --- a/.github/workflows/codespell.yaml +++ b/.github/workflows/codespell.yaml @@ -9,6 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Codespell run: make codespell diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index b827d831079..f054eec1e71 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -12,7 +12,7 @@ jobs: with: go-version: "~1.21.1" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install zsh run: sudo apt-get update; sudo apt-get install zsh diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 550c2e2bbe5..ce38d9f4d82 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -8,7 +8,7 @@ jobs: if: ${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml index c0c1c621b16..2747e0afa59 100644 --- a/.github/workflows/gosec.yml +++ b/.github/workflows/gosec.yml @@ -19,7 +19,7 @@ jobs: GO111MODULE: on steps: - name: Checkout Source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run Gosec Security Scanner uses: securego/gosec@master with: diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 70a2ab0cc2d..cfa1473d162 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -8,7 +8,7 @@ jobs: check-links: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Link Checker uses: lycheeverse/lychee-action@v1.8.0 diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 50184ce597a..423438dbeb5 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Link Checker id: lychee diff --git a/.github/workflows/markdown-fail-fast.yml b/.github/workflows/markdown-fail-fast.yml index 1e4a5cd5342..781be0253e8 100644 --- a/.github/workflows/markdown-fail-fast.yml +++ b/.github/workflows/markdown-fail-fast.yml @@ -12,7 +12,7 @@ jobs: md: ${{ steps.changes.outputs.md }} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get changed files @@ -27,7 +27,7 @@ jobs: if: ${{needs.changedfiles.outputs.md}} steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run linter uses: docker://avtodev/markdown-lint:v1 with: diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index 02725739c75..b82b9002df5 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Run linter id: markdownlint From ac4fca2260ae51e7318a2680e8e57771340e958a Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Mon, 11 Sep 2023 16:26:21 +0200 Subject: [PATCH 690/886] Use a TB interface in metricdatatest (#4483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use testing.TB interface in metricdatatest * add changelog entry * use our own TB interface * Update CHANGELOG.md Co-authored-by: Robert Pająk * rename TB to TestingT * SIG meeting feedback * ensure *testing.T implements TestingT * Update sdk/metric/metricdata/metricdatatest/assertion.go Co-authored-by: Robert Pająk * change formatting for last testing.TB too --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 4 ++++ .../metricdata/metricdatatest/assertion.go | 21 +++++++++++++++---- .../metricdatatest/assertion_test.go | 4 ++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e43e3d620b..b560cff9454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) - Add `IgnoreValue` option in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest` to allow ignoring values when comparing metrics. (#4447) +### Changed + +- Use a `TestingT` interface instead of `*testing.T` struct in `go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest`. (#4483) + ### Deprecated - The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` was deprecated in `v0.35.0` (#3541). diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index d19696f583f..dc8e0d1efaf 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -18,7 +18,6 @@ package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata import ( "fmt" - "testing" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -53,6 +52,20 @@ type Datatypes interface { // Aggregation and Value type from metricdata are not included here. } +// TestingT is an interface that implements [testing.T], but without the +// private method of [testing.TB], so other testing packages can rely on it as +// well. +// The methods in this interface must match the [testing.TB] interface. +type TestingT interface { + Helper() + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. + + Error(...any) + // DO NOT CHANGE: any modification will not be backwards compatible and + // must never be done outside of a new major release. +} + type config struct { ignoreTimestamp bool ignoreExemplars bool @@ -110,7 +123,7 @@ func IgnoreValue() Option { // AssertEqual asserts that the two concrete data-types from the metricdata // package are equal. -func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) bool { +func AssertEqual[T Datatypes](t TestingT, expected, actual T, opts ...Option) bool { t.Helper() cfg := newConfig(opts) @@ -178,7 +191,7 @@ func AssertEqual[T Datatypes](t *testing.T, expected, actual T, opts ...Option) } // AssertAggregationsEqual asserts that two Aggregations are equal. -func AssertAggregationsEqual(t *testing.T, expected, actual metricdata.Aggregation, opts ...Option) bool { +func AssertAggregationsEqual(t TestingT, expected, actual metricdata.Aggregation, opts ...Option) bool { t.Helper() cfg := newConfig(opts) @@ -190,7 +203,7 @@ func AssertAggregationsEqual(t *testing.T, expected, actual metricdata.Aggregati } // AssertHasAttributes asserts that all Datapoints or HistogramDataPoints have all passed attrs. -func AssertHasAttributes[T Datatypes](t *testing.T, actual T, attrs ...attribute.KeyValue) bool { +func AssertHasAttributes[T Datatypes](t TestingT, actual T, attrs ...attribute.KeyValue) bool { t.Helper() var reasons []string diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 11ba70ed679..514f5c03267 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -619,6 +619,10 @@ func testDatatypeIgnoreValue[T Datatypes](a, b T, f equalFunc[T]) func(*testing. } } +func TestTestingTImplementation(t *testing.T) { + assert.Implements(t, (*TestingT)(nil), t) +} + func TestAssertEqual(t *testing.T) { t.Run("ResourceMetrics", testDatatype(resourceMetricsA, resourceMetricsB, equalResourceMetrics)) t.Run("ScopeMetrics", testDatatype(scopeMetricsA, scopeMetricsB, equalScopeMetrics)) From 4242228103c19cabc435a75b02d7aea82aa8bf36 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 12 Sep 2023 07:54:37 -0700 Subject: [PATCH 691/886] Release v1.18.0/v0.41.0/v0.0.6 (#4489) * Bump versions * Prepare stable-v1 for version v1.18.0 * Prepare experimental-metrics for version v0.41.0 * Prepare experimental-schema for version v0.0.6 * Update changelog * Update CHANGELOG.md --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 8 +++++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 6 +++--- 33 files changed, 135 insertions(+), 129 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b560cff9454..a5734521026 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.18.0/0.41.0/0.0.6] 2023-09-12 + +This release drops the compatibility guarantee of [Go 1.19]. + ### Added - Add `WithProducer` option in `go.opentelemetry.op/otel/exporters/prometheus` to restore the ability to register producers on the prometheus exporter's manual reader. (#4473) @@ -2613,7 +2617,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.17.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.18.0...HEAD +[1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 [1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 [1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 [1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1 @@ -2685,5 +2690,6 @@ It contains api and sdk for trace and meter. [Go 1.20]: https://go.dev/doc/go1.20 [Go 1.19]: https://go.dev/doc/go1.19 [Go 1.18]: https://go.dev/doc/go1.18 +[Go 1.19]: https://go.dev/doc/go1.19 [metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a9f1bb6b34f..752bf2794da 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 976af1e1997..c4c1950b328 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/bridge/opencensus v0.40.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/bridge/opencensus v0.41.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.40.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/sdk/metric v0.41.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 9bc855ff228..7bba77e050b 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index cd53853c74f..e67bac8cb8d 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/bridge/opentracing v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/bridge/opentracing v1.18.0 google.golang.org/grpc v1.58.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 7817316d4fa..05b7055d389 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.20 require ( - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 93e5927ee88..1340e16da72 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 98d05bf934d..f5a0fc1dbc3 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/bridge/opencensus v0.40.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.40.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/bridge/opencensus v0.41.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.41.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 1d682859741..bba14370c92 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 google.golang.org/grpc v1.58.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 967640ef624..ac285278df4 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 907c7e8ade6..087729cc6c5 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/prometheus v0.40.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/prometheus v0.41.0 + go.opentelemetry.io/otel/metric v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/sdk v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/sdk v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 58b90f6cb44..993173f2b7d 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/prometheus v0.40.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/prometheus v0.41.0 + go.opentelemetry.io/otel/metric v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index e7c16c56ff3..f6910800cd3 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/zipkin v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/zipkin v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 023c8435586..7f57062cee5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.41.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 google.golang.org/grpc v1.58.0 @@ -26,8 +26,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index e47de4755ce..0978e5d614d 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.40.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.41.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 @@ -25,8 +25,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index de195b0bf8c..371e3b50b0e 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.40.0" + return "0.41.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 35b59d3d070..a6d40e9c98f 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 0698b587700..a424a624dea 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 4add0e917e0..1e93b05047c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 1780b71659b..661c146c223 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.17.0" + return "1.18.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index e6a4d7a810b..f6021df58fb 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/metric v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 664040073ef..128911273f7 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/sdk/metric v0.40.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/sdk/metric v0.41.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 999cabde1b8..a604b804fae 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 18b584f07be..03fc1cef1e8 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 841f6eb2a7b..1d71e9627e4 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel/metric v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index ac877bfd675..49d6e8755ef 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel v1.18.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 9b757208d60..8bbab5328a1 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/trace v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/trace v1.18.0 golang.org/x/sys v0.12.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.17.0 // indirect + go.opentelemetry.io/otel/metric v1.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index f35dc51a7b8..171889f9299 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 - go.opentelemetry.io/otel/metric v1.17.0 - go.opentelemetry.io/otel/sdk v1.17.0 + go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel/metric v1.18.0 + go.opentelemetry.io/otel/sdk v1.18.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.17.0 // indirect + go.opentelemetry.io/otel/trace v1.18.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 9a3f8fa977e..90bdd5c17c4 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "0.40.0" + return "0.41.0" } diff --git a/sdk/version.go b/sdk/version.go index a99bdd38efc..756bfed7588 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.17.0" + return "1.18.0" } diff --git a/trace/go.mod b/trace/go.mod index a80423d9b4c..50128ca4893 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.17.0 + go.opentelemetry.io/otel v1.18.0 ) require ( diff --git a/version.go b/version.go index 3bce1b1e4f9..d5f2746880d 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.17.0" + return "1.18.0" } diff --git a/versions.yaml b/versions.yaml index 2f7b39e81f3..a4952d4934f 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.17.0 + version: v1.18.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -33,7 +33,7 @@ module-sets: - go.opentelemetry.io/otel/sdk - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.40.0 + version: v0.41.0 modules: - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus @@ -47,7 +47,7 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/view experimental-schema: - version: v0.0.5 + version: v0.0.6 modules: - go.opentelemetry.io/otel/schema excluded-modules: From bcbee2ac1aa6b971e9188284a66a4f93b1858a3c Mon Sep 17 00:00:00 2001 From: Aaron Abbott Date: Wed, 13 Sep 2023 12:01:34 -0400 Subject: [PATCH 692/886] Allow '/' character in instrument names (#4501) * Allow '/' character in instrument names * Add changelog * Update CHANGELOG.md Co-authored-by: Tyler Yahn --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 ++++ sdk/metric/meter.go | 6 +++--- sdk/metric/meter_test.go | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5734521026..7e264600fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Allow '/' characters in metric instrument names. (#4501) + ## [1.18.0/0.41.0/0.0.6] 2023-09-12 This release drops the compatibility guarantee of [Go 1.19]. diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 9d2de67c594..e5ec1ad4675 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -28,7 +28,7 @@ import ( var ( // ErrInstrumentName indicates the created instrument has an invalid name. - // Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, and start with a letter. + // Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, / and start with a letter. ErrInstrumentName = errors.New("invalid instrument name") ) @@ -262,8 +262,8 @@ func validateInstrumentName(name string) error { return nil } for _, c := range name[1:] { - if !isAlphanumeric(c) && c != '_' && c != '.' && c != '-' { - return fmt.Errorf("%w: %s: must only contain [A-Za-z0-9_.-]", ErrInstrumentName, name) + if !isAlphanumeric(c) && c != '_' && c != '.' && c != '-' && c != '/' { + return fmt.Errorf("%w: %s: must only contain [A-Za-z0-9_.-/]", ErrInstrumentName, name) } } return nil diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 7c1d21f96cd..34a95ab7026 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -775,9 +775,12 @@ func TestValidateInstrumentName(t *testing.T) { { name: "nam.", }, + { + name: "nam/e", + }, { name: "name!", - wantErr: fmt.Errorf("%w: name!: must only contain [A-Za-z0-9_.-]", ErrInstrumentName), + wantErr: fmt.Errorf("%w: name!: must only contain [A-Za-z0-9_.-/]", ErrInstrumentName), }, { name: longName, From e3d6c8eec242f7641a58e3a73e37d0738f6e1084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 14 Sep 2023 08:17:20 +0200 Subject: [PATCH 693/886] Add and refine metrics examples (#4504) --- .../otlptrace/otlptracehttp/example_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 4 +- exporters/stdout/stdouttrace/example_test.go | 2 +- metric/example_test.go | 183 +++++++++++++++- sdk/metric/doc.go | 9 +- sdk/metric/example_test.go | 196 ++++++++++++++++-- sdk/metric/view_test.go | 133 ------------ 7 files changed, 367 insertions(+), 162 deletions(-) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 56f78af67ef..05f27212059 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -30,7 +30,7 @@ import ( const ( instrumentationName = "github.com/instrumentron" - instrumentationVersion = "v0.1.0" + instrumentationVersion = "0.1.0" ) var ( diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index a3e7377914f..c0e250f4e4c 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -41,7 +41,7 @@ var ( Resource: res, ScopeMetrics: []metricdata.ScopeMetrics{ { - Scope: instrumentation.Scope{Name: "example", Version: "v0.0.1"}, + Scope: instrumentation.Scope{Name: "example", Version: "0.0.1"}, Metrics: []metricdata.Metrics{ { Name: "requests", @@ -173,7 +173,7 @@ func Example() { // { // "Scope": { // "Name": "example", - // "Version": "v0.0.1", + // "Version": "0.0.1", // "SchemaURL": "" // }, // "Metrics": [ diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 5e3a5064568..a3634296e7a 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -29,7 +29,7 @@ import ( const ( instrumentationName = "github.com/instrumentron" - instrumentationVersion = "v0.1.0" + instrumentationVersion = "0.1.0" ) var ( diff --git a/metric/example_test.go b/metric/example_test.go index 35d7f4218e2..5c28d2f2926 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -16,18 +16,23 @@ package metric_test import ( "context" + "database/sql" "fmt" + "net/http" "runtime" "time" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) +var meter = otel.Meter("my-service-meter") + func ExampleMeter_synchronous() { // Create a histogram using the global MeterProvider. - workDuration, err := otel.Meter("go.opentelemetry.io/otel/metric#SyncExample").Int64Histogram( + workDuration, err := meter.Int64Histogram( "workDuration", metric.WithUnit("ms")) if err != nil { @@ -43,8 +48,6 @@ func ExampleMeter_synchronous() { } func ExampleMeter_asynchronous_single() { - meter := otel.Meter("go.opentelemetry.io/otel/metric#AsyncExample") - _, err := meter.Int64ObservableGauge( "DiskUsage", metric.WithUnit("By"), @@ -73,8 +76,6 @@ func ExampleMeter_asynchronous_single() { } func ExampleMeter_asynchronous_multiple() { - meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample") - // This is just a sample of memory stats to record from the Memstats heapAlloc, err := meter.Int64ObservableUpDownCounter("heapAllocs") if err != nil { @@ -106,3 +107,175 @@ func ExampleMeter_asynchronous_multiple() { panic(err) } } + +// Counters can be used to measure a non-negative, increasing value. +// +// Here's how you might report the number of calls for an HTTP handler. +func ExampleMeter_counter() { + apiCounter, err := meter.Int64Counter( + "api.counter", + metric.WithDescription("Number of API calls."), + metric.WithUnit("{call}"), + ) + if err != nil { + panic(err) + } + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + apiCounter.Add(r.Context(), 1) + + // do some work in an API call + }) +} + +// UpDown counters can increment and decrement, allowing you to observe +// a cumulative value that goes up or down. +// +// Here's how you might report the number of items of some collection. +func ExampleMeter_upDownCounter() { + var err error + itemsCounter, err := meter.Int64UpDownCounter( + "items.counter", + metric.WithDescription("Number of items."), + metric.WithUnit("{item}"), + ) + if err != nil { + panic(err) + } + + _ = func() { + // code that adds an item to the collection + itemsCounter.Add(context.Background(), 1) + } + + _ = func() { + // code that removes an item from the collection + itemsCounter.Add(context.Background(), -1) + } +} + +// Histograms are used to measure a distribution of values over time. +// +// Here's how you might report a distribution of response times for an HTTP handler. +func ExampleMeter_histogram() { + histogram, err := meter.Float64Histogram( + "task.duration", + metric.WithDescription("The duration of task execution."), + metric.WithUnit("s"), + ) + if err != nil { + panic(err) + } + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + + // do some work in an API call + + duration := time.Since(start) + histogram.Record(r.Context(), duration.Seconds()) + }) +} + +// Observable counters can be used to measure an additive, non-negative, +// monotonically increasing value. +// +// Here's how you might report time since the application started. +func ExampleMeter_observableCounter() { + start := time.Now() + if _, err := meter.Float64ObservableCounter( + "uptime", + metric.WithDescription("The duration since the application started."), + metric.WithUnit("s"), + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(float64(time.Since(start).Seconds())) + return nil + }), + ); err != nil { + panic(err) + } +} + +// Observable UpDown counters can increment and decrement, allowing you to measure +// an additive, non-negative, non-monotonically increasing cumulative value. +// +// Here's how you might report some database metrics. +func ExampleMeter_observableUpDownCounter() { + // The function registers asynchronous metrics for the provided db. + // Make sure to unregister metric.Registration before closing the provided db. + _ = func(db *sql.DB, meter metric.Meter, poolName string) (metric.Registration, error) { + max, err := meter.Int64ObservableUpDownCounter( + "db.client.connections.max", + metric.WithDescription("The maximum number of open connections allowed."), + metric.WithUnit("{connection}"), + ) + if err != nil { + return nil, err + } + + waitTime, err := meter.Int64ObservableUpDownCounter( + "db.client.connections.wait_time", + metric.WithDescription("The time it took to obtain an open connection from the pool."), + metric.WithUnit("ms"), + ) + if err != nil { + return nil, err + } + + reg, err := meter.RegisterCallback( + func(_ context.Context, o metric.Observer) error { + stats := db.Stats() + o.ObserveInt64(max, int64(stats.MaxOpenConnections)) + o.ObserveInt64(waitTime, int64(stats.WaitDuration)) + return nil + }, + max, + waitTime, + ) + if err != nil { + return nil, err + } + return reg, nil + } +} + +// Observable Gauges should be used to measure non-additive values. +// +// Here's how you might report memory usage of the heap objects used +// in application. +func ExampleMeter_observableGauge() { + if _, err := meter.Int64ObservableGauge( + "memory.heap", + metric.WithDescription( + "Memory usage of the allocated heap objects.", + ), + metric.WithUnit("By"), + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + var m runtime.MemStats + runtime.ReadMemStats(&m) + o.Observe(int64(m.HeapAlloc)) + return nil + }), + ); err != nil { + panic(err) + } +} + +// You can add Attributes by using the [WithAttributeSet] and [WithAttributes] options. +// +// Here's how you might add the HTTP status code attribute to your recordings. +func ExampleMeter_attributes() { + apiCounter, err := meter.Int64UpDownCounter( + "api.finished.counter", + metric.WithDescription("Number of finished API calls."), + metric.WithUnit("{call}"), + ) + if err != nil { + panic(err) + } + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + // do some work in an API call and set the response HTTP status code + statusCode := http.StatusOK + + apiCounter.Add(r.Context(), 1, + metric.WithAttributes(semconv.HTTPStatusCode(statusCode))) + }) +} diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index 92878ce8bc2..53f80c42893 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package metric provides an implementation of the OpenTelemetry metric SDK. +// Package metric provides an implementation of the OpenTelemetry metrics SDK. // // See https://opentelemetry.io/docs/concepts/signals/metrics/ for information // about the concept of OpenTelemetry metrics and @@ -27,8 +27,8 @@ // A MeterProvider needs to be configured to export the measured data, this is // done by configuring it with a Reader implementation (using the WithReader // MeterProviderOption). Readers take two forms: ones that push to an endpoint -// (NewPeriodicReader), and ones that an endpoint pulls from. See the -// go.opentelemetry.io/otel/exporters package for exporters that can be used as +// (NewPeriodicReader), and ones that an endpoint pulls from. See +// [go.opentelemetry.io/otel/exporters] for exporters that can be used as // or with these Readers. // // Each Reader, when registered with the MeterProvider, can be augmented with a @@ -41,4 +41,7 @@ // should be used to describe the unique runtime environment instrumented code // is being run on. That way when multiple instances of the code are collected // at a single endpoint their origin is decipherable. +// +// See [go.opentelemetry.io/otel/metric] for more information about +// the metric API. package metric // import "go.opentelemetry.io/otel/sdk/metric" diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index cf8728deb0f..af86d69b258 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -16,45 +16,207 @@ package metric_test import ( "context" + "fmt" "log" + "regexp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) +// To enable metrics in your application using the SDK, +// you'll need to have an initialized [MeterProvider] +// that will let you create a [go.opentelemetry.io/otel/metric.Meter]. +// +// Here's how you might initialize a metrics provider. func Example() { + // See [go.opentelemetry.io/otel/sdk/resource] for more + // information about how to create and use resources. + res, err := resource.Merge(resource.Default(), + resource.NewWithAttributes(semconv.SchemaURL, + semconv.ServiceName("my-service"), + semconv.ServiceVersion("0.1.0"), + )) + if err != nil { + log.Fatalln(err) + } + // This reader is used as a stand-in for a reader that will actually export - // data. See exporters in the go.opentelemetry.io/otel/exporters package - // for more information. + // data. See [go.opentelemetry.io/otel/exporters] for exporters + // that can be used as or with readers. reader := metric.NewManualReader() - // See the go.opentelemetry.io/otel/sdk/resource package for more - // information about how to create and use Resources. - res := resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("my-service"), - semconv.ServiceVersion("v0.1.0"), - ) - + // Create a meter provider. + // You can pass this instance directly to your instrumented code if it + // accepts a MeterProvider instance. meterProvider := metric.NewMeterProvider( metric.WithResource(res), metric.WithReader(reader), ) + + // Register as global meter provider so that it can + // that can used via [go.opentelemetry.io/otel.Meter] + // and accessed using [go.opentelemetry.io/otel.GetMeterProvider]. + // Most instrumentation libraries use the global meter provider as default. + // If the global meter provider is not set then a no-op implementation + // is used and which fails to generate data. otel.SetMeterProvider(meterProvider) + + // Handle shutdown properly so that nothing leaks. defer func() { err := meterProvider.Shutdown(context.Background()) if err != nil { log.Fatalln(err) } }() - // The MeterProvider is configured and registered globally. You can now run - // your code instrumented with the OpenTelemetry API that uses the global - // MeterProvider without having to pass this MeterProvider instance. Or, - // you can pass this instance directly to your instrumented code if it - // accepts a MeterProvider instance. +} + +func ExampleView() { + // The NewView function provides convenient creation of common Views + // construction. However, it is limited in what it can create. // - // See the go.opentelemetry.io/otel/metric package for more information - // about the metric API. + // When NewView is not able to provide the functionally needed, a custom + // View can be constructed directly. Here a custom View is constructed that + // uses Go's regular expression matching to ensure all data stream names + // have a suffix of the units it uses. + + re := regexp.MustCompile(`[._](ms|byte)$`) + var view metric.View = func(i metric.Instrument) (metric.Stream, bool) { + s := metric.Stream{Name: i.Name, Description: i.Description, Unit: i.Unit} + // Any instrument that does not have a unit suffix defined, but has a + // dimensional unit defined, update the name with a unit suffix. + if re.MatchString(i.Name) { + return s, false + } + switch i.Unit { + case "ms": + s.Name += ".ms" + case "By": + s.Name += ".byte" + default: + return s, false + } + return s, true + } + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) + + // Below is an example of how the view will + // function in the SDK for certain instruments. + stream, _ := view(metric.Instrument{ + Name: "computation.time.ms", + Unit: "ms", + }) + fmt.Println("name:", stream.Name) + + stream, _ = view(metric.Instrument{ + Name: "heap.size", + Unit: "By", + }) + fmt.Println("name:", stream.Name) + // Output: + // name: computation.time.ms + // name: heap.size.byte +} + +func ExampleNewView() { + // Create a view that renames the "latency" instrument from the v0.34.0 + // version of the "http" instrumentation library as "request.latency". + view := metric.NewView(metric.Instrument{ + Name: "latency", + Scope: instrumentation.Scope{ + Name: "http", + Version: "0.34.0", + }, + }, metric.Stream{Name: "request.latency"}) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) + + // Below is an example of how the view will + // function in the SDK for certain instruments. + stream, _ := view(metric.Instrument{ + Name: "latency", + Description: "request latency", + Unit: "ms", + Kind: metric.InstrumentKindCounter, + Scope: instrumentation.Scope{ + Name: "http", + Version: "0.34.0", + SchemaURL: "https://opentelemetry.io/schemas/1.0.0", + }, + }) + fmt.Println("name:", stream.Name) + fmt.Println("description:", stream.Description) + fmt.Println("unit:", stream.Unit) + // Output: + // name: request.latency + // description: request latency + // unit: ms +} + +func ExampleNewView_drop() { + // Create a view that sets the drop aggregator for all instrumentation from + // the "db" library, effectively turning-off all instrumentation from that + // library. + view := metric.NewView( + metric.Instrument{Scope: instrumentation.Scope{Name: "db"}}, + metric.Stream{Aggregation: metric.AggregationDrop{}}, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) + + // Below is an example of how the view will + // function in the SDK for certain instruments. + stream, _ := view(metric.Instrument{ + Name: "queries", + Kind: metric.InstrumentKindCounter, + Scope: instrumentation.Scope{Name: "db", Version: "v0.4.0"}, + }) + fmt.Println("name:", stream.Name) + fmt.Printf("aggregation: %#v", stream.Aggregation) + // Output: + // name: queries + // aggregation: metric.AggregationDrop{} +} + +func ExampleNewView_wildcard() { + // Create a view that sets unit to milliseconds for any instrument with a + // name suffix of ".ms". + view := metric.NewView( + metric.Instrument{Name: "*.ms"}, + metric.Stream{Unit: "ms"}, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) + + // Below is an example of how the view will + // function in the SDK for certain instruments. + stream, _ := view(metric.Instrument{ + Name: "computation.time.ms", + Unit: "1", + }) + fmt.Println("name:", stream.Name) + fmt.Println("unit:", stream.Unit) + // Output: + // name: computation.time.ms + // unit: ms } diff --git a/sdk/metric/view_test.go b/sdk/metric/view_test.go index d9e3f9b6c81..0cf5646f243 100644 --- a/sdk/metric/view_test.go +++ b/sdk/metric/view_test.go @@ -15,8 +15,6 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( - "fmt" - "regexp" "testing" "github.com/go-logr/logr" @@ -493,134 +491,3 @@ func TestNewViewMultiInstMatchErrorLogged(t *testing.T) { }) assert.Contains(t, got, errMultiInst.Error()) } - -func ExampleNewView() { - // Create a view that renames the "latency" instrument from the v0.34.0 - // version of the "http" instrumentation library as "request.latency". - view := NewView(Instrument{ - Name: "latency", - Scope: instrumentation.Scope{ - Name: "http", - Version: "v0.34.0", - }, - }, Stream{Name: "request.latency"}) - - // The created view can then be registered with the OpenTelemetry metric - // SDK using the WithView option. Below is an example of how the view will - // function in the SDK for certain instruments. - - stream, _ := view(Instrument{ - Name: "latency", - Description: "request latency", - Unit: "ms", - Kind: InstrumentKindCounter, - Scope: instrumentation.Scope{ - Name: "http", - Version: "v0.34.0", - SchemaURL: "https://opentelemetry.io/schemas/1.0.0", - }, - }) - fmt.Println("name:", stream.Name) - fmt.Println("description:", stream.Description) - fmt.Println("unit:", stream.Unit) - // Output: - // name: request.latency - // description: request latency - // unit: ms -} - -func ExampleNewView_drop() { - // Create a view that sets the drop aggregator for all instrumentation from - // the "db" library, effectively turning-off all instrumentation from that - // library. - view := NewView( - Instrument{Scope: instrumentation.Scope{Name: "db"}}, - Stream{Aggregation: AggregationDrop{}}, - ) - - // The created view can then be registered with the OpenTelemetry metric - // SDK using the WithView option. Below is an example of how the view will - // function in the SDK for certain instruments. - - stream, _ := view(Instrument{ - Name: "queries", - Kind: InstrumentKindCounter, - Scope: instrumentation.Scope{Name: "db", Version: "v0.4.0"}, - }) - fmt.Println("name:", stream.Name) - fmt.Printf("aggregation: %#v", stream.Aggregation) - // Output: - // name: queries - // aggregation: metric.AggregationDrop{} -} - -func ExampleNewView_wildcard() { - // Create a view that sets unit to milliseconds for any instrument with a - // name suffix of ".ms". - view := NewView( - Instrument{Name: "*.ms"}, - Stream{Unit: "ms"}, - ) - - // The created view can then be registered with the OpenTelemetry metric - // SDK using the WithView option. Below is an example of how the view - // function in the SDK for certain instruments. - - stream, _ := view(Instrument{ - Name: "computation.time.ms", - Unit: "1", - }) - fmt.Println("name:", stream.Name) - fmt.Println("unit:", stream.Unit) - // Output: - // name: computation.time.ms - // unit: ms -} - -func ExampleView() { - // The NewView function provides convenient creation of common Views - // construction. However, it is limited in what it can create. - // - // When NewView is not able to provide the functionally needed, a custom - // View can be constructed directly. Here a custom View is constructed that - // uses Go's regular expression matching to ensure all data stream names - // have a suffix of the units it uses. - - re := regexp.MustCompile(`[._](ms|byte)$`) - var view View = func(i Instrument) (Stream, bool) { - s := Stream{Name: i.Name, Description: i.Description, Unit: i.Unit} - // Any instrument that does not have a unit suffix defined, but has a - // dimensional unit defined, update the name with a unit suffix. - if re.MatchString(i.Name) { - return s, false - } - switch i.Unit { - case "ms": - s.Name += ".ms" - case "By": - s.Name += ".byte" - default: - return s, false - } - return s, true - } - - // The created view can then be registered with the OpenTelemetry metric - // SDK using the WithView option. Below is an example of how the view will - // function in the SDK for certain instruments. - - stream, _ := view(Instrument{ - Name: "computation.time.ms", - Unit: "ms", - }) - fmt.Println("name:", stream.Name) - - stream, _ = view(Instrument{ - Name: "heap.size", - Unit: "By", - }) - fmt.Println("name:", stream.Name) - // Output: - // name: computation.time.ms - // name: heap.size.byte -} From ac5639159f9c8ec161a93b1990e878c74022d49b Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Thu, 14 Sep 2023 09:51:51 +0200 Subject: [PATCH 694/886] Call scopeInfoMetrics only once even if it returns an error (#4499) --- CHANGELOG.md | 4 ++++ exporters/prometheus/exporter.go | 17 ++++++++++++++++- exporters/prometheus/exporter_test.go | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e264600fd4..056f12c45fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,10 @@ This release drops the compatibility guarantee of [Go 1.19]. - Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) - Dropped guaranteed support for versions of Go less than 1.20. (#4481) +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + ## [1.17.0/0.40.0/0.0.5] 2023-08-28 ### Added diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index c88e82a1385..8973b2028e6 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -45,7 +45,11 @@ const ( scopeInfoDescription = "Instrumentation Scope metadata" ) -var scopeInfoKeys = [2]string{"otel_scope_name", "otel_scope_version"} +var ( + scopeInfoKeys = [2]string{"otel_scope_name", "otel_scope_version"} + + errScopeInvalid = errors.New("invalid scope") +) // Exporter is a Prometheus Exporter that embeds the OTel metric.Reader // interface for easy instantiation with a MeterProvider. @@ -87,6 +91,7 @@ type collector struct { disableTargetInfo bool targetInfo prometheus.Metric scopeInfos map[instrumentation.Scope]prometheus.Metric + scopeInfosInvalid map[instrumentation.Scope]struct{} metricFamilies map[string]*dto.MetricFamily } @@ -110,6 +115,7 @@ func New(opts ...Option) (*Exporter, error) { withoutCounterSuffixes: cfg.withoutCounterSuffixes, disableScopeInfo: cfg.disableScopeInfo, scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + scopeInfosInvalid: make(map[instrumentation.Scope]struct{}), metricFamilies: make(map[string]*dto.MetricFamily), namespace: cfg.namespace, } @@ -177,6 +183,10 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { if !c.disableScopeInfo { scopeInfo, err := c.scopeInfo(scopeMetrics.Scope) + if err == errScopeInvalid { + // Do not report the same error multiple times. + continue + } if err != nil { otel.Handle(err) continue @@ -469,8 +479,13 @@ func (c *collector) scopeInfo(scope instrumentation.Scope) (prometheus.Metric, e return scopeInfo, nil } + if _, ok := c.scopeInfosInvalid[scope]; ok { + return nil, errScopeInvalid + } + scopeInfo, err := createScopeInfoMetric(scope) if err != nil { + c.scopeInfosInvalid[scope] = struct{}{} return nil, fmt.Errorf("cannot create scope info metric: %w", err) } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 86cc8dc0b20..89fc87df3b9 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -16,6 +16,7 @@ package prometheus import ( "context" + "io" "os" "sync" "testing" @@ -25,6 +26,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric" @@ -790,6 +792,14 @@ func TestCollectorConcurrentSafe(t *testing.T) { } func TestIncompatibleMeterName(t *testing.T) { + defer func(orig otel.ErrorHandler) { + otel.SetErrorHandler(orig) + }(otel.GetErrorHandler()) + + errs := []error{} + eh := otel.ErrorHandlerFunc(func(e error) { errs = append(errs, e) }) + otel.SetErrorHandler(eh) + // This test checks that Prometheus exporter ignores // when it encounters incompatible meter name. @@ -815,4 +825,13 @@ func TestIncompatibleMeterName(t *testing.T) { err = testutil.GatherAndCompare(registry, file) require.NoError(t, err) + + assert.Equal(t, 1, len(errs)) + + // A second collect shouldn't trigger new errors + _, err = file.Seek(0, io.SeekStart) + assert.NoError(t, err) + err = testutil.GatherAndCompare(registry, file) + require.NoError(t, err) + assert.Equal(t, 1, len(errs)) } From a87d8fd2e8236cdf6e2907c2751e8e7354bf8035 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Thu, 14 Sep 2023 16:33:13 +0200 Subject: [PATCH 695/886] fix changelog entry, as 4499 hasn't been released yet (#4508) --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 056f12c45fb..bd01e6061af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Allow '/' characters in metric instrument names. (#4501) +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) + ## [1.18.0/0.41.0/0.0.6] 2023-09-12 This release drops the compatibility guarantee of [Go 1.19]. @@ -38,10 +42,6 @@ This release drops the compatibility guarantee of [Go 1.19]. - Removed the deprecated internal packages in `go.opentelemetry.io/otel/exporters/otlp` and its sub-packages. (#4469) - Dropped guaranteed support for versions of Go less than 1.20. (#4481) -### Fixed - -- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the prometheus metric on every `Collect` if we know the scope is invalid. (#4499) - ## [1.17.0/0.40.0/0.0.5] 2023-08-28 ### Added From 2ee71fdd4ebaa145c70c906c1300d624aa65f796 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 14 Sep 2023 12:57:45 -0700 Subject: [PATCH 696/886] Release v1.19.0-rc.1/v0.42.0-rc.1 (#4510) * Bump versions.yaml Move go.opentelemetry.io/otel/sdk/metric to stable-v1. * Prepare stable-v1 for version v1.19.0-rc.1 * Prepare experimental-metrics for version v0.42.0-rc.1 * Update changelog --- CHANGELOG.md | 9 ++++++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/fib/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 12 ++++++------ exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 12 ++++++------ 33 files changed, 139 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd01e6061af..dce5247f31b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 + +This is a release candidate for the v1.19.0/v0.42.0 release. +That release is expected to include the `v1` release of the OpenTelemetry Go metric SDK and will provide stability guarantees of that SDK. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ### Changed - Allow '/' characters in metric instrument names. (#4501) @@ -2625,7 +2631,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.18.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.19.0-rc.1...HEAD +[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 [1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 [1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 [1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 752bf2794da..a6277595352 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index c4c1950b328..c1a7fed659b 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/bridge/opencensus v0.41.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.42.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.41.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 7bba77e050b..ac2644745e0 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index e67bac8cb8d..b792ee9eba7 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/bridge/opentracing v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/bridge/opentracing v1.19.0-rc.1 google.golang.org/grpc v1.58.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/example/fib/go.mod b/example/fib/go.mod index 05b7055d389..e66e2d6715d 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.20 require ( - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 1340e16da72..0df5f4074dc 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index f5a0fc1dbc3..c19a2ab2f59 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/bridge/opencensus v0.41.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.41.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v0.42.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index bba14370c92..34e1760e089 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 google.golang.org/grpc v1.58.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index ac285278df4..baa53453602 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 087729cc6c5..3f948242899 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/prometheus v0.41.0 - go.opentelemetry.io/otel/metric v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.42.0-rc.1 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/sdk v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 993173f2b7d..15f149dca13 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/prometheus v0.41.0 - go.opentelemetry.io/otel/metric v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/prometheus v0.42.0-rc.1 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index f6910800cd3..8630ff3d5b5 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/zipkin v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/zipkin v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 7f57062cee5..f14b6772494 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.41.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 google.golang.org/grpc v1.58.0 @@ -26,8 +26,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 0978e5d614d..8bf2cb29da5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.41.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 @@ -25,8 +25,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index 371e3b50b0e..24e075bdf26 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.41.0" + return "0.42.0-rc.1" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index a6d40e9c98f..35003cb4651 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a424a624dea..83fd209bad6 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 1e93b05047c..9f9a3e0638b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.0 google.golang.org/protobuf v1.31.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 661c146c223..7b53186ea97 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.18.0" + return "1.19.0-rc.1" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index f6021df58fb..f6976d65357 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/metric v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 128911273f7..2e3134f9c6f 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/sdk/metric v0.41.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index a604b804fae..3a3bb6e3fb5 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 03fc1cef1e8..f71546b28a0 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 1d71e9627e4..07c536ea9b6 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 49d6e8755ef..b8e7fd5c64f 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 8bbab5328a1..ae55d183b3c 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/trace v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/trace v1.19.0-rc.1 golang.org/x/sys v0.12.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.18.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 171889f9299..ad5e47a5eab 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 - go.opentelemetry.io/otel/metric v1.18.0 - go.opentelemetry.io/otel/sdk v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.18.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 90bdd5c17c4..ea099448117 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "0.41.0" + return "1.19.0-rc.1" } diff --git a/sdk/version.go b/sdk/version.go index 756bfed7588..e6979a9ad31 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.18.0" + return "1.19.0-rc.1" } diff --git a/trace/go.mod b/trace/go.mod index 50128ca4893..4666402332e 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.18.0 + go.opentelemetry.io/otel v1.19.0-rc.1 ) require ( diff --git a/version.go b/version.go index d5f2746880d..a9d57931ffa 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.18.0" + return "1.19.0-rc.1" } diff --git a/versions.yaml b/versions.yaml index a4952d4934f..c34b100aa68 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.18.0 + version: v1.19.0-rc.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -31,21 +31,21 @@ module-sets: - go.opentelemetry.io/otel/exporters/zipkin - go.opentelemetry.io/otel/metric - go.opentelemetry.io/otel/sdk + - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.41.0 + version: v0.42.0-rc.1 modules: + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus + - go.opentelemetry.io/otel/example/view - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - - go.opentelemetry.io/otel/sdk/metric - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/view experimental-schema: version: v0.0.6 modules: From 84f6b36815d5c57ba3bf4595fca971b56ca8101e Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 17 Sep 2023 08:07:54 -0700 Subject: [PATCH 697/886] dependabot updates Sun Sep 17 14:56:30 UTC 2023 (#4525) Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.58.0 to 1.58.1 in /example/otel-collector --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index b792ee9eba7..98816ceee39 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0-rc.1 go.opentelemetry.io/otel/bridge/opentracing v1.19.0-rc.1 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 ) require ( diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index b3b28952647..8e3e0869b5d 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 34e1760e089..882de0e3c4c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0-rc.1 go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/trace v1.19.0-rc.1 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 227a74e5462..2e7c7643dd1 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f14b6772494..2c640e74d8f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -14,7 +14,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index e4b12d31f5c..6cbd3c876c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 8bf2cb29da5..b9e35739c24 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index e4b12d31f5c..6cbd3c876c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 83fd209bad6..611be0d1393 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 36088fe05c8..26e288e6807 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 9f9a3e0638b..63e3179cfb7 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/trace v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.0 + google.golang.org/grpc v1.58.1 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 2fd37969a31..43775f759c2 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o= -google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= +google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= From 2373e9b1e96567016f2f2bbedce63b2d514b8257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 18 Sep 2023 09:44:52 +0200 Subject: [PATCH 698/886] otlptracegrpc: Check error on Shutdown in tests (#4517) --- exporters/otlp/otlptrace/otlptracegrpc/client_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index b25606d232d..aa531eb926e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -188,7 +188,7 @@ func TestNewCollectorOnBadConnection(t *testing.T) { endpoint := fmt.Sprintf("localhost:%s", collectorPortStr) ctx := context.Background() exp := newGRPCExporter(t, ctx, endpoint) - _ = exp.Shutdown(ctx) + require.NoError(t, exp.Shutdown(ctx)) } func TestNewWithEndpoint(t *testing.T) { @@ -197,7 +197,7 @@ func TestNewWithEndpoint(t *testing.T) { ctx := context.Background() exp := newGRPCExporter(t, ctx, mc.endpoint) - _ = exp.Shutdown(ctx) + require.NoError(t, exp.Shutdown(ctx)) } func TestNewWithHeaders(t *testing.T) { From a5190f632f973481cefe4e232bdbd2df022041d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 18 Sep 2023 10:05:33 +0200 Subject: [PATCH 699/886] Add Base2ExponentialHistogram example (#4518) --- sdk/metric/aggregation.go | 6 +++--- sdk/metric/example_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sdk/metric/aggregation.go b/sdk/metric/aggregation.go index 08ff6cc3dd8..faddbb0b61b 100644 --- a/sdk/metric/aggregation.go +++ b/sdk/metric/aggregation.go @@ -48,8 +48,8 @@ func (AggregationDrop) err() error { return nil } // make an aggregation selection based on instrument kind that differs from // the default. This Aggregation ensures the default is used. // -// See the "go.opentelemetry.io/otel/sdk/metric".DefaultAggregationSelector -// for information about the default instrument kind selection mapping. +// See the [DefaultAggregationSelector] for information about the default +// instrument kind selection mapping. type AggregationDefault struct{} // AggregationDefault has no parameters. var _ Aggregation = AggregationDefault{} @@ -161,7 +161,7 @@ type AggregationBase2ExponentialHistogram struct { // signed 32-bit integer index could be used. // // MaxScale has a minimum value of -10. Using a value of -10 means only - // two buckets will be use. + // two buckets will be used. MaxScale int32 // NoMinMax indicates whether to not record the min and max of the diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index af86d69b258..cd77d4263f8 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -85,6 +85,8 @@ func ExampleView() { re := regexp.MustCompile(`[._](ms|byte)$`) var view metric.View = func(i metric.Instrument) (metric.Stream, bool) { + // In a custom View function, you need to explicitly copy + // the name, description, and unit. s := metric.Stream{Name: i.Name, Description: i.Description, Unit: i.Unit} // Any instrument that does not have a unit suffix defined, but has a // dimensional unit defined, update the name with a unit suffix. @@ -220,3 +222,26 @@ func ExampleNewView_wildcard() { // name: computation.time.ms // unit: ms } + +func ExampleNewView_exponentialHistogram() { + // Create a view that makes the "latency" instrument + // to be reported as an exponential histogram. + view := metric.NewView( + metric.Instrument{ + Name: "latency", + Scope: instrumentation.Scope{Name: "http"}, + }, + metric.Stream{ + Aggregation: metric.AggregationBase2ExponentialHistogram{ + MaxSize: 160, + MaxScale: 20, + }, + }, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) +} From be43b929aad83914751400c45c50e8ba2a18f378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 19 Sep 2023 08:06:11 +0200 Subject: [PATCH 700/886] Add ExampleNewView_attributeFilter and refine ExampleNewView_drop (#4527) --- sdk/metric/example_test.go | 68 +++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index cd77d4263f8..29c6780d0d2 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -21,6 +21,7 @@ import ( "regexp" "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" @@ -167,13 +168,12 @@ func ExampleNewView() { // unit: ms } -func ExampleNewView_drop() { - // Create a view that sets the drop aggregator for all instrumentation from - // the "db" library, effectively turning-off all instrumentation from that - // library. +func ExampleNewView_wildcard() { + // Create a view that sets unit to milliseconds for any instrument with a + // name suffix of ".ms". view := metric.NewView( - metric.Instrument{Scope: instrumentation.Scope{Name: "db"}}, - metric.Stream{Aggregation: metric.AggregationDrop{}}, + metric.Instrument{Name: "*.ms"}, + metric.Stream{Unit: "ms"}, ) // The created view can then be registered with the OpenTelemetry metric @@ -185,23 +185,25 @@ func ExampleNewView_drop() { // Below is an example of how the view will // function in the SDK for certain instruments. stream, _ := view(metric.Instrument{ - Name: "queries", - Kind: metric.InstrumentKindCounter, - Scope: instrumentation.Scope{Name: "db", Version: "v0.4.0"}, + Name: "computation.time.ms", + Unit: "1", }) fmt.Println("name:", stream.Name) - fmt.Printf("aggregation: %#v", stream.Aggregation) + fmt.Println("unit:", stream.Unit) // Output: - // name: queries - // aggregation: metric.AggregationDrop{} + // name: computation.time.ms + // unit: ms } -func ExampleNewView_wildcard() { - // Create a view that sets unit to milliseconds for any instrument with a - // name suffix of ".ms". +func ExampleNewView_drop() { + // Create a view that drops the "latency" instrument from the "http" + // instrumentation library. view := metric.NewView( - metric.Instrument{Name: "*.ms"}, - metric.Stream{Unit: "ms"}, + metric.Instrument{ + Name: "latency", + Scope: instrumentation.Scope{Name: "http"}, + }, + metric.Stream{Aggregation: metric.AggregationDrop{}}, ) // The created view can then be registered with the OpenTelemetry metric @@ -209,23 +211,29 @@ func ExampleNewView_wildcard() { _ = metric.NewMeterProvider( metric.WithView(view), ) +} - // Below is an example of how the view will - // function in the SDK for certain instruments. - stream, _ := view(metric.Instrument{ - Name: "computation.time.ms", - Unit: "1", - }) - fmt.Println("name:", stream.Name) - fmt.Println("unit:", stream.Unit) - // Output: - // name: computation.time.ms - // unit: ms +func ExampleNewView_attributeFilter() { + // Create a view removes the "http.request.method" attribute recorded by + // the "latency" instrument from the "http" instrumentation library. + view := metric.NewView( + metric.Instrument{ + Name: "latency", + Scope: instrumentation.Scope{Name: "http"}, + }, + metric.Stream{AttributeFilter: attribute.NewDenyKeysFilter("http.request.method")}, + ) + + // The created view can then be registered with the OpenTelemetry metric + // SDK using the WithView option. + _ = metric.NewMeterProvider( + metric.WithView(view), + ) } func ExampleNewView_exponentialHistogram() { - // Create a view that makes the "latency" instrument - // to be reported as an exponential histogram. + // Create a view that makes the "latency" instrument from the "http" + // instrumentation library to be reported as an exponential histogram. view := metric.NewView( metric.Instrument{ Name: "latency", From 4738218c03ca28d8f9813e3dc4df95ace156bd7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 19 Sep 2023 16:30:26 +0200 Subject: [PATCH 701/886] sdk/metric: Refine NewView wildcard comment (#4530) --- sdk/metric/view.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/metric/view.go b/sdk/metric/view.go index e4f350e1912..65f243befed 100644 --- a/sdk/metric/view.go +++ b/sdk/metric/view.go @@ -42,10 +42,10 @@ type View func(Instrument) (Stream, bool) // view that matches no instruments is returned. If you need to match a // zero-value field, create a View directly. // -// The Name field of criteria supports wildcard pattern matching. The wildcard -// "*" is recognized as matching zero or more characters, and "?" is recognized -// as matching exactly one character. For example, a pattern of "*" will match -// all instrument names. +// The Name field of criteria supports wildcard pattern matching. The "*" +// wildcard is recognized as matching zero or more characters, and "?" is +// recognized as matching exactly one character. For example, a pattern of "*" +// matches all instrument names. // // The Stream mask only applies updates for non-zero-value fields. By default, // the Instrument the View matches against will be use for the Name, From bf54101e32e8a96bdb044b9205c83bf383187f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 19 Sep 2023 16:38:39 +0200 Subject: [PATCH 702/886] Fix comment in ExampleNewView_attributeFilter (#4529) Co-authored-by: Tyler Yahn --- sdk/metric/example_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 29c6780d0d2..bd6d759ee28 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -214,8 +214,8 @@ func ExampleNewView_drop() { } func ExampleNewView_attributeFilter() { - // Create a view removes the "http.request.method" attribute recorded by - // the "latency" instrument from the "http" instrumentation library. + // Create a view that removes the "http.request.method" attribute recorded + // by the "latency" instrument from the "http" instrumentation library. view := metric.NewView( metric.Instrument{ Name: "latency", From fd8eff8402ada93e551ff1e2bf7765a3155b5fb9 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 21 Sep 2023 03:52:17 -0700 Subject: [PATCH 703/886] Upgrade gopkg.io/yaml from v2 to v3 in schema (#4535) --- schema/go.mod | 3 +-- schema/go.sum | 2 -- schema/v1.0/parser.go | 3 ++- schema/v1.0/parser_test.go | 4 ++++ schema/v1.0/testdata/unknown-field.yaml | 15 +++++++++++++++ schema/v1.1/parser.go | 4 ++-- 6 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 schema/v1.0/testdata/unknown-field.yaml diff --git a/schema/go.mod b/schema/go.mod index 0c2d3e6d00f..bfc2ab62789 100644 --- a/schema/go.mod +++ b/schema/go.mod @@ -5,11 +5,10 @@ go 1.20 require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/stretchr/testify v1.8.4 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/schema/go.sum b/schema/go.sum index f9c91c9cccd..839fe61dc7b 100644 --- a/schema/go.sum +++ b/schema/go.sum @@ -8,7 +8,5 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/schema/v1.0/parser.go b/schema/v1.0/parser.go index a284606bd9c..75a09bb0687 100644 --- a/schema/v1.0/parser.go +++ b/schema/v1.0/parser.go @@ -18,7 +18,7 @@ import ( "io" "os" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "go.opentelemetry.io/otel/schema/internal" "go.opentelemetry.io/otel/schema/v1.0/ast" @@ -43,6 +43,7 @@ func ParseFile(schemaFilePath string) (*ast.Schema, error) { func Parse(schemaFileContent io.Reader) (*ast.Schema, error) { var ts ast.Schema d := yaml.NewDecoder(schemaFileContent) + d.KnownFields(true) err := d.Decode(&ts) if err != nil { return nil, err diff --git a/schema/v1.0/parser_test.go b/schema/v1.0/parser_test.go index ab47452db72..36aba51ea5e 100644 --- a/schema/v1.0/parser_test.go +++ b/schema/v1.0/parser_test.go @@ -168,6 +168,10 @@ func TestFailParseSchemaFile(t *testing.T) { ts, err = ParseFile("testdata/invalid-schema-url.yaml") assert.Error(t, err) assert.Nil(t, ts) + + ts, err = ParseFile("testdata/unknown-field.yaml") + assert.ErrorContains(t, err, "field Resources not found in type ast.VersionDef") + assert.Nil(t, ts) } func TestFailParseSchema(t *testing.T) { diff --git a/schema/v1.0/testdata/unknown-field.yaml b/schema/v1.0/testdata/unknown-field.yaml new file mode 100644 index 00000000000..0d344e44cd9 --- /dev/null +++ b/schema/v1.0/testdata/unknown-field.yaml @@ -0,0 +1,15 @@ +file_format: 1.0.0 +schema_url: https://opentelemetry.io/schemas/1.0.0 + +versions: + 1.1.0: + all: # Valid entry. + changes: + - rename_attributes: + k8s.cluster.name: kubernetes.cluster.name + Resources: # Invalid uppercase. + changes: + - rename_attributes: + attribute_map: + browser.user_agent: user_agent.original + 1.0.0: diff --git a/schema/v1.1/parser.go b/schema/v1.1/parser.go index 1e1ca8db56c..43b70524f38 100644 --- a/schema/v1.1/parser.go +++ b/schema/v1.1/parser.go @@ -18,7 +18,7 @@ import ( "io" "os" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "go.opentelemetry.io/otel/schema/internal" "go.opentelemetry.io/otel/schema/v1.1/ast" @@ -43,7 +43,7 @@ func ParseFile(schemaFilePath string) (*ast.Schema, error) { func Parse(schemaFileContent io.Reader) (*ast.Schema, error) { var ts ast.Schema d := yaml.NewDecoder(schemaFileContent) - d.SetStrict(true) // Do not silently drop unknown fields. + d.KnownFields(true) err := d.Decode(&ts) if err != nil { return nil, err From 206ed5544c8a2a5dcda818cbb118a7c7aa5c5c81 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 21 Sep 2023 14:13:08 -0500 Subject: [PATCH 704/886] Update codeql analysis frequency (#4542) --- .github/workflows/codeql-analysis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 55cb5ddcd19..67ad856d2cf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,6 +13,9 @@ on: # │ │ │ │ │ # * * * * * - cron: '30 1 * * *' + push: + branches: [ main ] + pull_request: jobs: CodeQL-Build: From 10b9f90fe4acdb670d0d8110da2c7a77a3272beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 22 Sep 2023 08:04:06 +0200 Subject: [PATCH 705/886] sdk/metric: Update package example (#4540) --- sdk/metric/example_test.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index bd6d759ee28..81a59343bea 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -34,8 +34,7 @@ import ( // // Here's how you might initialize a metrics provider. func Example() { - // See [go.opentelemetry.io/otel/sdk/resource] for more - // information about how to create and use resources. + // Create resource. res, err := resource.Merge(resource.Default(), resource.NewWithAttributes(semconv.SchemaURL, semconv.ServiceName("my-service"), @@ -46,8 +45,8 @@ func Example() { } // This reader is used as a stand-in for a reader that will actually export - // data. See [go.opentelemetry.io/otel/exporters] for exporters - // that can be used as or with readers. + // data. See https://pkg.go.dev/go.opentelemetry.io/otel/exporters for + // exporters that can be used as or with readers. reader := metric.NewManualReader() // Create a meter provider. @@ -58,14 +57,6 @@ func Example() { metric.WithReader(reader), ) - // Register as global meter provider so that it can - // that can used via [go.opentelemetry.io/otel.Meter] - // and accessed using [go.opentelemetry.io/otel.GetMeterProvider]. - // Most instrumentation libraries use the global meter provider as default. - // If the global meter provider is not set then a no-op implementation - // is used and which fails to generate data. - otel.SetMeterProvider(meterProvider) - // Handle shutdown properly so that nothing leaks. defer func() { err := meterProvider.Shutdown(context.Background()) @@ -73,6 +64,13 @@ func Example() { log.Fatalln(err) } }() + + // Register as global meter provider so that it can be used via otel.Meter + // and accessed using otel.GetMeterProvider. + // Most instrumentation libraries use the global meter provider as default. + // If the global meter provider is not set then a no-op implementation + // is used, which fails to generate data. + otel.SetMeterProvider(meterProvider) } func ExampleView() { From 3c1621bdbb9bde9be796195d270bb4f9fc334763 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 24 Sep 2023 07:35:44 -0700 Subject: [PATCH 706/886] dependabot updates Sun Sep 24 14:25:44 UTC 2023 (#4552) Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /example/otel-collector Bump google.golang.org/grpc from 1.58.1 to 1.58.2 in /exporters/otlp/otlptrace/otlptracegrpc --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 98816ceee39..fbe270f753c 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0-rc.1 go.opentelemetry.io/otel/bridge/opentracing v1.19.0-rc.1 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 ) require ( diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 8e3e0869b5d..9849f15acb7 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 882de0e3c4c..dcd3ceaae26 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0-rc.1 go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/trace v1.19.0-rc.1 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 2e7c7643dd1..aed78e17b32 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2c640e74d8f..0297284dd3e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -14,7 +14,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 6cbd3c876c7..b3ae2009b4f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b9e35739c24..7981f6fd650 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 6cbd3c876c7..b3ae2009b4f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 611be0d1393..05ecedd8eeb 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 26e288e6807..1838dbbf406 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 63e3179cfb7..b17203c0c6e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0-rc.1 go.opentelemetry.io/otel/trace v1.19.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.1 + google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 43775f759c2..822ed05cfc9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.1 h1:OL+Vz23DTtrrldqHK49FUOPHyY75rvFqJfXC84NYW58= -google.golang.org/grpc v1.58.1/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= +google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= From 2a8fddaf5818a7e39db7ddf5fb2db345234f4458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 25 Sep 2023 20:27:28 +0200 Subject: [PATCH 707/886] stdouttrace: Fix WithPrettyPrint comment (#4544) --- exporters/stdout/stdouttrace/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/stdout/stdouttrace/config.go b/exporters/stdout/stdouttrace/config.go index 2cb534a75e9..2d765435495 100644 --- a/exporters/stdout/stdouttrace/config.go +++ b/exporters/stdout/stdouttrace/config.go @@ -71,7 +71,7 @@ func (o writerOption) apply(cfg config) config { return cfg } -// WithPrettyPrint sets the export stream format to use JSON. +// WithPrettyPrint prettifies the emitted output. func WithPrettyPrint() Option { return prettyPrintOption(true) } From 612208d0460367525f7aba4db1074f8441695600 Mon Sep 17 00:00:00 2001 From: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> Date: Tue, 26 Sep 2023 01:05:53 -0700 Subject: [PATCH 708/886] Fix typos in comments (#4553) --- exporters/prometheus/config_test.go | 2 +- sdk/metric/reader.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporters/prometheus/config_test.go b/exporters/prometheus/config_test.go index d209fdf3fbd..b759cfe98f5 100644 --- a/exporters/prometheus/config_test.go +++ b/exporters/prometheus/config_test.go @@ -151,7 +151,7 @@ func TestNewConfig(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { cfg := newConfig(tt.options...) - // only check the length of readerOpts, since they are not compareable + // only check the length of readerOpts, since they are not comparable assert.Equal(t, len(tt.wantConfig.readerOpts), len(cfg.readerOpts)) cfg.readerOpts = nil tt.wantConfig.readerOpts = nil diff --git a/sdk/metric/reader.go b/sdk/metric/reader.go index 44e09fb355d..65cedaf3c07 100644 --- a/sdk/metric/reader.go +++ b/sdk/metric/reader.go @@ -74,7 +74,7 @@ type Reader interface { // the SDK and stores it in out. An error is returned if this is called // after Shutdown or if out is nil. // - // This method needs to be concurrent safe, and the cancelation of the + // This method needs to be concurrent safe, and the cancellation of the // passed context is expected to be honored. Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error // DO NOT CHANGE: any modification will not be backwards compatible and From 0425c09c31f7568e2aa56fd6ccd5abcfbe3cfede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 26 Sep 2023 16:10:58 +0200 Subject: [PATCH 709/886] Add dice example (#4539) * Add dice example * Add manual instrumentation * Update changelog * Add comments * Use naked return consistently * Move handleFunc to main * refactor: Extract newHTTPHandler * Fix comment * Improve comments * Update example/dice/otel.go Co-authored-by: Tyler Yahn * Simplify BaseContext * Update doc.go * Update example/dice/main.go Co-authored-by: Phillip Carter * Rename span and metric names --------- Co-authored-by: Tyler Yahn Co-authored-by: Phillip Carter --- .github/dependabot.yml | 9 +++ .gitignore | 1 + CHANGELOG.md | 4 ++ example/dice/doc.go | 16 ++++++ example/dice/go.mod | 35 ++++++++++++ example/dice/go.sum | 16 ++++++ example/dice/main.go | 99 ++++++++++++++++++++++++++++++++ example/dice/otel.go | 118 +++++++++++++++++++++++++++++++++++++++ example/dice/rolldice.go | 59 ++++++++++++++++++++ versions.yaml | 1 + 10 files changed, 358 insertions(+) create mode 100644 example/dice/doc.go create mode 100644 example/dice/go.mod create mode 100644 example/dice/go.sum create mode 100644 example/dice/main.go create mode 100644 example/dice/otel.go create mode 100644 example/dice/rolldice.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 555decd4daf..f4c687ce090 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -64,6 +64,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /example/dice + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /example/fib labels: diff --git a/.gitignore b/.gitignore index aa699376225..f3355c852be 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ go.work.sum gen/ +/example/dice/dice /example/fib/fib /example/fib/traces.txt /example/jaeger/jaeger diff --git a/CHANGELOG.md b/CHANGELOG.md index dce5247f31b..75e6a83b813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) + ## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 This is a release candidate for the v1.19.0/v0.42.0 release. diff --git a/example/dice/doc.go b/example/dice/doc.go new file mode 100644 index 00000000000..5fe156fb977 --- /dev/null +++ b/example/dice/doc.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Dice is the "Roll the dice" getting started example application. +package main diff --git a/example/dice/go.mod b/example/dice/go.mod new file mode 100644 index 00000000000..79b391a4f79 --- /dev/null +++ b/example/dice/go.mod @@ -0,0 +1,35 @@ +module go.opentelemetry.io/otel/example/dice + +go 1.20 + +require ( + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 + go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.41.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 + go.opentelemetry.io/otel/metric v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 +) + +require ( + github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + golang.org/x/sys v0.12.0 // indirect +) + +replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace + +replace go.opentelemetry.io/otel/exporters/stdout/stdoutmetric => ../../exporters/stdout/stdoutmetric + +replace go.opentelemetry.io/otel => ../.. + +replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric + +replace go.opentelemetry.io/otel/sdk => ../../sdk diff --git a/example/dice/go.sum b/example/dice/go.sum new file mode 100644 index 00000000000..b9534f5b329 --- /dev/null +++ b/example/dice/go.sum @@ -0,0 +1,16 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/dice/main.go b/example/dice/main.go new file mode 100644 index 00000000000..f7e0242906f --- /dev/null +++ b/example/dice/main.go @@ -0,0 +1,99 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "context" + "errors" + "log" + "net" + "net/http" + "os" + "os/signal" + "time" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +func main() { + if err := run(); err != nil { + log.Fatalln(err) + } +} + +func run() (err error) { + // Handle SIGINT (CTRL+C) gracefully. + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) + defer stop() + + // Set up OpenTelemetry. + serviceName := "dice" + serviceVersion := "0.1.0" + otelShutdown, err := setupOTelSDK(ctx, serviceName, serviceVersion) + if err != nil { + return + } + // Handle shutdown properly so nothing leaks. + defer func() { + err = errors.Join(err, otelShutdown(context.Background())) + }() + + // Start HTTP server. + srv := &http.Server{ + Addr: ":8080", + BaseContext: func(_ net.Listener) context.Context { return ctx }, + ReadTimeout: time.Second, + WriteTimeout: 10 * time.Second, + Handler: newHTTPHandler(), + } + srvErr := make(chan error, 1) + go func() { + srvErr <- srv.ListenAndServe() + }() + + // Wait for interruption. + select { + case err = <-srvErr: + // Error when starting HTTP server. + return + case <-ctx.Done(): + // Wait for first CTRL+C. + // Stop receiving signal notifications as soon as possible. + stop() + } + + // When Shutdown is called, ListenAndServe immediately returns ErrServerClosed. + err = srv.Shutdown(context.Background()) + return +} + +func newHTTPHandler() http.Handler { + mux := http.NewServeMux() + + // handleFunc is a replacement for mux.HandleFunc + // which enriches the handler's HTTP instrumentation with the pattern as the http.route. + handleFunc := func(pattern string, handlerFunc func(http.ResponseWriter, *http.Request)) { + // Configure the "http.route" for the HTTP instrumentation. + handler := otelhttp.WithRouteTag(pattern, http.HandlerFunc(handlerFunc)) + mux.Handle(pattern, handler) + } + + // Register handlers. + handleFunc("/rolldice", rolldice) + + // Add HTTP instrumentation for the whole server. + handler := otelhttp.NewHandler(mux, "/") + return handler +} diff --git a/example/dice/otel.go b/example/dice/otel.go new file mode 100644 index 00000000000..8612352d959 --- /dev/null +++ b/example/dice/otel.go @@ -0,0 +1,118 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "context" + "errors" + "time" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.21.0" +) + +// setupOTelSDK bootstraps the OpenTelemetry pipeline. +// If it does not return an error, make sure to call shutdown for proper cleanup. +func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shutdown func(context.Context) error, err error) { + var shutdownFuncs []func(context.Context) error + + // shutdown calls cleanup functions registered via shutdownFuncs. + // The errors from the calls are joined. + // Each registered cleanup will be invoked once. + shutdown = func(ctx context.Context) error { + var err error + for _, fn := range shutdownFuncs { + err = errors.Join(err, fn(ctx)) + } + shutdownFuncs = nil + return err + } + + // handleErr calls shutdown for cleanup and makes sure that all errors are returned. + handleErr := func(inErr error) { + err = errors.Join(inErr, shutdown(ctx)) + } + + // Setup resource. + res, err := newResource(serviceName, serviceVersion) + if err != nil { + handleErr(err) + return + } + + // Setup trace provider. + tracerProvider, err := newTraceProvider(res) + if err != nil { + handleErr(err) + return + } + shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown) + otel.SetTracerProvider(tracerProvider) + + // Setup meter provider. + meterProvider, err := newMeterProvider(res) + if err != nil { + handleErr(err) + return + } + shutdownFuncs = append(shutdownFuncs, meterProvider.Shutdown) + otel.SetMeterProvider(meterProvider) + + return +} + +func newResource(serviceName, serviceVersion string) (*resource.Resource, error) { + return resource.Merge(resource.Default(), + resource.NewWithAttributes(semconv.SchemaURL, + semconv.ServiceName(serviceName), + semconv.ServiceVersion(serviceVersion), + )) +} + +func newTraceProvider(res *resource.Resource) (*trace.TracerProvider, error) { + traceExporter, err := stdouttrace.New( + stdouttrace.WithPrettyPrint()) + if err != nil { + return nil, err + } + + traceProvider := trace.NewTracerProvider( + trace.WithBatcher(traceExporter, + // Default is 5s. Set to 1s for demonstrative purposes. + trace.WithBatchTimeout(time.Second)), + trace.WithResource(res), + ) + return traceProvider, nil +} + +func newMeterProvider(res *resource.Resource) (*metric.MeterProvider, error) { + metricExporter, err := stdoutmetric.New() + if err != nil { + return nil, err + } + + meterProvider := metric.NewMeterProvider( + metric.WithResource(res), + metric.WithReader(metric.NewPeriodicReader(metricExporter, + // Default is 1m. Set to 3s for demonstrative purposes. + metric.WithInterval(3*time.Second))), + ) + return meterProvider, nil +} diff --git a/example/dice/rolldice.go b/example/dice/rolldice.go new file mode 100644 index 00000000000..10bd237c325 --- /dev/null +++ b/example/dice/rolldice.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "io" + "log" + "math/rand" + "net/http" + "strconv" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" +) + +var ( + tracer = otel.Tracer("rolldice") + meter = otel.Meter("rolldice") + rollCnt metric.Int64Counter +) + +func init() { + var err error + rollCnt, err = meter.Int64Counter("dice.rolls", + metric.WithDescription("The number of rolls by roll value"), + metric.WithUnit("{roll}")) + if err != nil { + panic(err) + } +} + +func rolldice(w http.ResponseWriter, r *http.Request) { + ctx, span := tracer.Start(r.Context(), "roll") + defer span.End() + + roll := 1 + rand.Intn(6) + + rollValueAttr := attribute.Int("roll.value", roll) + span.SetAttributes(rollValueAttr) + rollCnt.Add(ctx, 1, metric.WithAttributes(rollValueAttr)) + + resp := strconv.Itoa(roll) + "\n" + if _, err := io.WriteString(w, resp); err != nil { + log.Printf("Write failed: %v\n", err) + } +} diff --git a/versions.yaml b/versions.yaml index c34b100aa68..6492d09f1e8 100644 --- a/versions.yaml +++ b/versions.yaml @@ -19,6 +19,7 @@ module-sets: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test + - go.opentelemetry.io/otel/example/dice - go.opentelemetry.io/otel/example/fib - go.opentelemetry.io/otel/example/namedtracer - go.opentelemetry.io/otel/example/otel-collector From 9bbefc6cc31995c7bdd37c69eb153fc2201c3562 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Tue, 26 Sep 2023 07:55:54 -0700 Subject: [PATCH 710/886] dependabot updates Tue Sep 26 14:35:10 UTC 2023 (#4559) Bump go.opentelemetry.io/build-tools/dbotconf from 0.11.0 to 0.12.0 in /internal/tools Bump go.opentelemetry.io/build-tools/gotmpl from 0.11.0 to 0.12.0 in /internal/tools Bump go.opentelemetry.io/build-tools/multimod from 0.11.0 to 0.12.0 in /internal/tools Bump go.opentelemetry.io/build-tools/crosslink from 0.11.0 to 0.12.0 in /internal/tools Bump go.opentelemetry.io/build-tools/semconvgen from 0.11.0 to 0.12.0 in /internal/tools --- internal/tools/go.mod | 22 ++++++++--------- internal/tools/go.sum | 56 +++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index ae996729f3d..b8713b02069 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -9,11 +9,11 @@ require ( github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.4.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad - go.opentelemetry.io/build-tools/crosslink v0.11.0 - go.opentelemetry.io/build-tools/dbotconf v0.11.0 - go.opentelemetry.io/build-tools/gotmpl v0.11.0 - go.opentelemetry.io/build-tools/multimod v0.11.0 - go.opentelemetry.io/build-tools/semconvgen v0.11.0 + go.opentelemetry.io/build-tools/crosslink v0.12.0 + go.opentelemetry.io/build-tools/dbotconf v0.12.0 + go.opentelemetry.io/build-tools/gotmpl v0.12.0 + go.opentelemetry.io/build-tools/multimod v0.12.0 + go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/tools v0.13.0 ) @@ -32,7 +32,7 @@ require ( github.com/Masterminds/semver v1.5.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -53,6 +53,7 @@ require ( github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/daixiang0/gci v0.11.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect @@ -66,8 +67,8 @@ require ( github.com/fzipp/gocyclo v0.6.0 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.4.1 // indirect - github.com/go-git/go-git/v5 v5.8.1 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/go-git/go-git/v5 v5.9.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -191,11 +192,10 @@ require ( github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.3 // indirect gitlab.com/bosi/decorder v0.4.0 // indirect - go.opentelemetry.io/build-tools v0.11.0 // indirect + go.opentelemetry.io/build-tools v0.12.0 // indirect go.tmz.dev/musttag v0.7.2 // indirect - go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.24.0 // indirect + go.uber.org/zap v1.26.0 // indirect golang.org/x/crypto v0.13.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.12.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 6ce63a44950..6b4c7209fe2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -65,8 +65,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/f1kSDVYY= github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= -github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -86,7 +86,6 @@ github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8ger github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= -github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -128,9 +127,10 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/daixiang0/gci v0.11.0 h1:XeQbFKkCRxvVyn06EOuNY6LPGBLVuB/W130c8FrnX6A= github.com/daixiang0/gci v0.11.0/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -138,7 +138,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= -github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 h1:RIB4cRk+lBqKK3Oy0r2gRX4ui7tuhiZq2SuTtTCi0/0= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -167,11 +167,11 @@ github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczK github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= -github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A= -github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo= +github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= +github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -366,12 +366,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.8 h1:Ul2KsqtzFxTlSU7IP0JusWlLiNqQaloB9vguyjbE558= @@ -427,7 +425,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.1 h1:wm28nZjhQY5HyYPx+weN3Q65k6ilSBxDb8v5S81B81U= github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8pzda2l0= github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= @@ -495,7 +492,7 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= @@ -620,27 +617,25 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opentelemetry.io/build-tools v0.11.0 h1:yXTgCJM/vxWZEB8FbgVhKOAFnRlacG2Z3eoTQZ0/gYE= -go.opentelemetry.io/build-tools v0.11.0/go.mod h1:GFpz8YD/DG5shfY1J2f3uuK88zr61U5rVRGOhKMDE9M= -go.opentelemetry.io/build-tools/crosslink v0.11.0 h1:K0eJY/AT6SiIaoJSrQyiVquGErcJEHsx4oHkhxvpj9k= -go.opentelemetry.io/build-tools/crosslink v0.11.0/go.mod h1:h5oxbHx+O50aO0/M7mFejZmd7cMONdsmmC+IOmgWoWw= -go.opentelemetry.io/build-tools/dbotconf v0.11.0 h1:hG0Zyln9Vv+kwNC+ip/EUcLnd9osTZ8dOYOxe/lHZy4= -go.opentelemetry.io/build-tools/dbotconf v0.11.0/go.mod h1:BxYX1iAki4EWzIVXeEPFM75ZWr9e9koqT7pTU5xzad4= -go.opentelemetry.io/build-tools/gotmpl v0.11.0 h1:T2KJ7Eli7wLrp+8TXpUQ+Q+wAdZZDiyHYSvrpeER7Pc= -go.opentelemetry.io/build-tools/gotmpl v0.11.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= -go.opentelemetry.io/build-tools/multimod v0.11.0 h1:QMo2Y4BlsTsWUR0LXV4gmiv5yEiX2iPLn2qAdAcCE6k= -go.opentelemetry.io/build-tools/multimod v0.11.0/go.mod h1:EID7sjEGyk1FWzRdsV6rlWp43IIn8iHXGE5pM4TytyQ= -go.opentelemetry.io/build-tools/semconvgen v0.11.0 h1:gQsNzy49l9JjNozybaRUl+vy0EMxYasV8w6aK+IWquc= -go.opentelemetry.io/build-tools/semconvgen v0.11.0/go.mod h1:Zy04Bw3w3lT7mORe23V2BwjfJYpoza6Xz1XSMIrLTCg= +go.opentelemetry.io/build-tools v0.12.0 h1:ZqK1GuqBp9Mf1RthYO3/jjf9tPWzeHMcVDo0itFi/lI= +go.opentelemetry.io/build-tools v0.12.0/go.mod h1:I76Qvv9cN055XJfTHw9t257EUd5Yp0EofeTMESlZuRU= +go.opentelemetry.io/build-tools/crosslink v0.12.0 h1:GNJQURuabE5rAkIbnrqndIKyXrr7wFy54e/8ujkgjHg= +go.opentelemetry.io/build-tools/crosslink v0.12.0/go.mod h1:QE8Kxf4Ygg2ltSHE+Vdys/67jtQM26j7spJLyjNA2DU= +go.opentelemetry.io/build-tools/dbotconf v0.12.0 h1:I+oaEtAMK+nd660l//r14d3AI1A8BB3A4hKArvUX/n4= +go.opentelemetry.io/build-tools/dbotconf v0.12.0/go.mod h1:K0Xszcb11bbFtVpjieY8gzGWLw9SNarDKvFW1Ti7w4U= +go.opentelemetry.io/build-tools/gotmpl v0.12.0 h1:ysCtNFkoJddyaAdemtdbI6Qn7nb7GYn2WbHmajTW+pM= +go.opentelemetry.io/build-tools/gotmpl v0.12.0/go.mod h1:FzweYUfAJC1i5ATrtFI4KJggnO9QQGPdSVKWA8RHjdE= +go.opentelemetry.io/build-tools/multimod v0.12.0 h1:DKi+A+4EaKrOZDTNDDZz3ijiAduEQDo8j1rzWUaGUHo= +go.opentelemetry.io/build-tools/multimod v0.12.0/go.mod h1:w03q3WgZs7reoBNnmfdClkKdTIA/IHM8ric5E2jEDD0= +go.opentelemetry.io/build-tools/semconvgen v0.12.0 h1:AsjYFwo8sSLAjwjklj+yVwm2xogJUxRf5pxflATg9N0= +go.opentelemetry.io/build-tools/semconvgen v0.12.0/go.mod h1:SRmou8pp+7gBmf1AvdxOTwVts74Syyrgm1/Qx7R8mis= go.tmz.dev/musttag v0.7.2 h1:1J6S9ipDbalBSODNT5jCep8dhZyMr4ttnjQagmGYR5s= go.tmz.dev/musttag v0.7.2/go.mod h1:m6q5NiiSKMnQYokefa2xGoyoXnrswCbJ0AWYzf4Zs28= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= -go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= +go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= +go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -1035,7 +1030,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= From 1410496022e9697d0796b69788373994dd9f1e9d Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Wed, 27 Sep 2023 16:45:10 +0200 Subject: [PATCH 711/886] stdoutmetric: Add WithWriter and WithPrettyPrint options (#4507) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add WithWriter and WithPrettyOptions to stdoutmetric * add changelog * make WithWriter a shortcut to WithEncoder * Update exporters/stdout/stdoutmetric/config.go --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 5 +++ exporters/stdout/stdoutmetric/config.go | 25 +++++++++++- .../stdout/stdoutmetric/exporter_test.go | 38 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e6a83b813..5befdf6241c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettifies the output by default anymore. (#4507) + ### Added - Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) +- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON (#4507). ## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 diff --git a/exporters/stdout/stdoutmetric/config.go b/exporters/stdout/stdoutmetric/config.go index 6189c019f37..cac5afeeb67 100644 --- a/exporters/stdout/stdoutmetric/config.go +++ b/exporters/stdout/stdoutmetric/config.go @@ -15,6 +15,7 @@ package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdout import ( "encoding/json" + "io" "os" "go.opentelemetry.io/otel/sdk/metric" @@ -22,6 +23,7 @@ import ( // config contains options for the exporter. type config struct { + prettyPrint bool encoder *encoderHolder temporalitySelector metric.TemporalitySelector aggregationSelector metric.AggregationSelector @@ -37,10 +39,15 @@ func newConfig(options ...Option) config { if cfg.encoder == nil { enc := json.NewEncoder(os.Stdout) - enc.SetIndent("", "\t") cfg.encoder = &encoderHolder{encoder: enc} } + if cfg.prettyPrint { + if e, ok := cfg.encoder.encoder.(*json.Encoder); ok { + e.SetIndent("", "\t") + } + } + if cfg.temporalitySelector == nil { cfg.temporalitySelector = metric.DefaultTemporalitySelector } @@ -74,6 +81,22 @@ func WithEncoder(encoder Encoder) Option { }) } +// WithWriter sets the export stream destination. +// Using this option overrides any previously set encoder. +func WithWriter(w io.Writer) Option { + return WithEncoder(json.NewEncoder(w)) +} + +// WithPrettyPrint prettifies the emitted output. +// This option only works if the encoder is a *json.Encoder, as is the case +// when using `WithWriter`. +func WithPrettyPrint() Option { + return optionFunc(func(c config) config { + c.prettyPrint = true + return c + }) +} + // WithTemporalitySelector sets the TemporalitySelector the exporter will use // to determine the Temporality of an instrument based on its kind. If this // option is not used, the exporter will use the DefaultTemporalitySelector diff --git a/exporters/stdout/stdoutmetric/exporter_test.go b/exporters/stdout/stdoutmetric/exporter_test.go index 71679d623a1..2dbfe6357a2 100644 --- a/exporters/stdout/stdoutmetric/exporter_test.go +++ b/exporters/stdout/stdoutmetric/exporter_test.go @@ -15,6 +15,7 @@ package stdoutmetric_test // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" import ( + "bytes" "context" "encoding/json" "io" @@ -103,6 +104,43 @@ func deltaSelector(metric.InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } +func TestExportWithOptions(t *testing.T) { + var ( + data = new(metricdata.ResourceMetrics) + ctx = context.Background() + ) + + for _, tt := range []struct { + name string + opts []stdoutmetric.Option + + expectedData string + }{ + { + name: "with no options", + expectedData: "{\"Resource\":null,\"ScopeMetrics\":null}\n", + }, + { + name: "with pretty print", + opts: []stdoutmetric.Option{ + stdoutmetric.WithPrettyPrint(), + }, + expectedData: "{\n\t\"Resource\": null,\n\t\"ScopeMetrics\": null\n}\n", + }, + } { + t.Run(tt.name, func(t *testing.T) { + var b bytes.Buffer + opts := append(tt.opts, stdoutmetric.WithWriter(&b)) + + exp, err := stdoutmetric.New(opts...) + require.NoError(t, err) + require.NoError(t, exp.Export(ctx, data)) + + assert.Equal(t, tt.expectedData, b.String()) + }) + } +} + func TestTemporalitySelector(t *testing.T) { exp, err := stdoutmetric.New( testEncoderOption(), From d3e31c3d939ecb4bc270bafd2b6e45df90339bcc Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 28 Sep 2023 04:19:31 -0400 Subject: [PATCH 712/886] Remove deprecated opencensus.NewMetricExporter (#4566) --- CHANGELOG.md | 4 + bridge/opencensus/metric.go | 40 ---------- bridge/opencensus/metric_test.go | 127 ------------------------------- 3 files changed, 4 insertions(+), 167 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5befdf6241c..47844f6b57f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) - The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON (#4507). +### Removed + +- Remove `"go.opentelemetry.io/otel/bridge/opencensus".NewMetricExporter`, which is replaced by `NewMetricProducer`. (#4566) + ## [1.19.0-rc.1/0.42.0-rc.1] 2023-09-14 This is a release candidate for the v1.19.0/v0.42.0 release. diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index c2e0be49052..1c2496d8c9b 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -18,15 +18,12 @@ import ( "context" ocmetricdata "go.opencensus.io/metric/metricdata" - "go.opencensus.io/metric/metricexport" "go.opencensus.io/metric/metricproducer" - "go.opentelemetry.io/otel" internal "go.opentelemetry.io/otel/bridge/opencensus/internal/ocmetric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/resource" ) const scopeName = "go.opentelemetry.io/otel/bridge/opencensus" @@ -60,40 +57,3 @@ func (p *producer) Produce(context.Context) ([]metricdata.ScopeMetrics, error) { Metrics: otelmetrics, }}, err } - -// exporter implements the OpenCensus metric Exporter interface using an -// OpenTelemetry base exporter. -type exporter struct { - base metric.Exporter - res *resource.Resource -} - -// NewMetricExporter returns an OpenCensus exporter that exports to an -// OpenTelemetry (push) exporter. -// -// Deprecated: Use [NewMetricProducer] instead. -func NewMetricExporter(base metric.Exporter, res *resource.Resource) metricexport.Exporter { - return &exporter{base: base, res: res} -} - -// ExportMetrics implements the OpenCensus metric Exporter interface by sending -// to an OpenTelemetry exporter. -func (e *exporter) ExportMetrics(ctx context.Context, ocmetrics []*ocmetricdata.Metric) error { - otelmetrics, err := internal.ConvertMetrics(ocmetrics) - if err != nil { - otel.Handle(err) - } - if len(otelmetrics) == 0 { - return nil - } - return e.base.Export(ctx, &metricdata.ResourceMetrics{ - Resource: e.res, - ScopeMetrics: []metricdata.ScopeMetrics{ - { - Scope: instrumentation.Scope{ - Name: scopeName, - }, - Metrics: otelmetrics, - }, - }}) -} diff --git a/bridge/opencensus/metric_test.go b/bridge/opencensus/metric_test.go index 58c11aadc0a..29ec835c8ba 100644 --- a/bridge/opencensus/metric_test.go +++ b/bridge/opencensus/metric_test.go @@ -16,7 +16,6 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" import ( "context" - "fmt" "testing" "time" @@ -27,10 +26,8 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" - "go.opentelemetry.io/otel/sdk/resource" ) func TestMetricProducer(t *testing.T) { @@ -160,127 +157,3 @@ type fakeOCProducer struct { func (f *fakeOCProducer) Read() []*ocmetricdata.Metric { return f.metrics } - -func TestPushMetricsExporter(t *testing.T) { - now := time.Now() - for _, tc := range []struct { - desc string - input []*ocmetricdata.Metric - inputResource *resource.Resource - exportErr error - expected *metricdata.ResourceMetrics - expectErr bool - }{ - { - desc: "empty batch isn't sent", - }, - { - desc: "export error", - exportErr: fmt.Errorf("failed to export"), - input: []*ocmetricdata.Metric{ - { - Resource: &ocresource.Resource{ - Labels: map[string]string{ - "R1": "V1", - "R2": "V2", - }, - }, - TimeSeries: []*ocmetricdata.TimeSeries{ - { - StartTime: now, - Points: []ocmetricdata.Point{ - {Value: int64(123), Time: now}, - }, - }, - }, - }, - }, - expectErr: true, - }, - { - desc: "success", - input: []*ocmetricdata.Metric{ - { - Resource: &ocresource.Resource{ - Labels: map[string]string{ - "R1": "V1", - "R2": "V2", - }, - }, - TimeSeries: []*ocmetricdata.TimeSeries{ - { - StartTime: now, - Points: []ocmetricdata.Point{ - {Value: int64(123), Time: now}, - }, - }, - }, - }, - }, - inputResource: resource.NewSchemaless( - attribute.String("R1", "V1"), - attribute.String("R2", "V2"), - ), - expected: &metricdata.ResourceMetrics{ - Resource: resource.NewSchemaless( - attribute.String("R1", "V1"), - attribute.String("R2", "V2"), - ), - ScopeMetrics: []metricdata.ScopeMetrics{ - { - Scope: instrumentation.Scope{ - Name: scopeName, - }, - Metrics: []metricdata.Metrics{ - { - Name: "", - Description: "", - Unit: "", - Data: metricdata.Gauge[int64]{ - DataPoints: []metricdata.DataPoint[int64]{ - { - Attributes: attribute.NewSet(), - StartTime: now, - Time: now, - Value: 123, - }, - }, - }, - }, - }, - }, - }, - }, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - fake := &fakeExporter{err: tc.exportErr} - exporter := NewMetricExporter(fake, tc.inputResource) - err := exporter.ExportMetrics(context.Background(), tc.input) - if tc.expectErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - if tc.expected != nil { - require.NotNil(t, fake.data) - metricdatatest.AssertEqual(t, *tc.expected, *fake.data) - } else { - require.Nil(t, fake.data) - } - }) - } -} - -type fakeExporter struct { - metric.Exporter - data *metricdata.ResourceMetrics - err error -} - -func (f *fakeExporter) Export(ctx context.Context, data *metricdata.ResourceMetrics) error { - if f.err == nil { - f.data = data - } - return f.err -} From acf7146b566054dac9e10576a285bd11ed87b7e2 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 28 Sep 2023 04:31:00 -0400 Subject: [PATCH 713/886] Opencensus bridge: migrate from README to Go docs (#4561) --- bridge/opencensus/README.md | 81 ----------------------- bridge/opencensus/doc.go | 58 +++++++++++----- bridge/opencensus/example_test.go | 44 ++++++++++++ bridge/opencensus/{bridge.go => trace.go} | 0 4 files changed, 87 insertions(+), 96 deletions(-) delete mode 100644 bridge/opencensus/README.md create mode 100644 bridge/opencensus/example_test.go rename bridge/opencensus/{bridge.go => trace.go} (100%) diff --git a/bridge/opencensus/README.md b/bridge/opencensus/README.md deleted file mode 100644 index 3df9dc7eb07..00000000000 --- a/bridge/opencensus/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# OpenCensus Bridge - -The OpenCensus Bridge helps facilitate the migration of an application from OpenCensus to OpenTelemetry. - -## Caveat about OpenCensus - -Installing a metric or tracing bridge will cause OpenCensus telemetry to be exported by OpenTelemetry exporters. Since OpenCensus telemetry uses globals, installing a bridge will result in telemetry collection from _all_ libraries that use OpenCensus, including some you may not expect. For example ([#1928](https://github.com/open-telemetry/opentelemetry-go/issues/1928)), if a client library generates traces with OpenCensus, installing the bridge will cause those traces to be exported by OpenTelemetry. - -## Tracing - -### The Problem: Mixing OpenCensus and OpenTelemetry libraries - -In a perfect world, one would simply migrate their entire go application --including custom instrumentation, libraries, and exporters-- from OpenCensus to OpenTelemetry all at once. In the real world, dependency constraints, third-party ownership of libraries, or other reasons may require mixing OpenCensus and OpenTelemetry libraries in a single application. - -However, if you create the following spans in a go application: - -```go -ctx, ocSpan := opencensus.StartSpan(context.Background(), "OuterSpan") -defer ocSpan.End() -ctx, otSpan := opentelemetryTracer.Start(ctx, "MiddleSpan") -defer otSpan.End() -ctx, ocSpan := opencensus.StartSpan(ctx, "InnerSpan") -defer ocSpan.End() -``` - -OpenCensus reports (to OpenCensus exporters): - -``` -[--------OuterSpan------------] - [----InnerSpan------] -``` - -OpenTelemetry reports (to OpenTelemetry exporters): - -``` - [-----MiddleSpan--------] -``` - -Instead, I would prefer (to a single set of exporters): - -``` -[--------OuterSpan------------] - [-----MiddleSpan--------] - [----InnerSpan------] -``` - -### The bridge solution - -The bridge implements the OpenCensus trace API using OpenTelemetry. This would cause, for example, a span recorded with OpenCensus' `StartSpan()` method to be equivalent to recording a span using OpenTelemetry's `tracer.Start()` method. Funneling all tracing API calls to OpenTelemetry APIs results in the desired unified span hierarchy. - -### User Journey - -Starting from an application using entirely OpenCensus APIs: - -1. Instantiate OpenTelemetry SDK and Exporters -2. Override OpenCensus' DefaultTracer with the bridge -3. Migrate libraries individually from OpenCensus to OpenTelemetry -4. Remove OpenCensus exporters and configuration - -To override OpenCensus' DefaultTracer with the bridge: - -```go -import ( - octrace "go.opencensus.io/trace" - "go.opentelemetry.io/otel/bridge/opencensus" - "go.opentelemetry.io/otel" -) - -tracer := otel.GetTracerProvider().Tracer("bridge") -octrace.DefaultTracer = opencensus.NewTracer(tracer) -``` - -Be sure to set the `Tracer` name to your instrumentation package name instead of `"bridge"`. - -#### Incompatibilities - -OpenCensus and OpenTelemetry APIs are not entirely compatible. If the bridge finds any incompatibilities, it will log them. Incompatibilities include: - -* Custom OpenCensus Samplers specified during StartSpan are ignored. -* Links cannot be added to OpenCensus spans. -* OpenTelemetry Debug or Deferred trace flags are dropped after an OpenCensus span is created. diff --git a/bridge/opencensus/doc.go b/bridge/opencensus/doc.go index 80d80da6f78..ed2a4cfd935 100644 --- a/bridge/opencensus/doc.go +++ b/bridge/opencensus/doc.go @@ -13,23 +13,51 @@ // limitations under the License. // Package opencensus provides a migration bridge from OpenCensus to -// OpenTelemetry. The NewTracer function should be used to create an -// OpenCensus Tracer from an OpenTelemetry Tracer. This Tracer can be use in -// place of any existing OpenCensus Tracer and will generate OpenTelemetry -// spans for traces. These spans will be exported by the OpenTelemetry -// TracerProvider the original OpenTelemetry Tracer came from. +// OpenTelemetry for metrics and traces. The bridge incorporates metrics and +// traces from OpenCensus into the OpenTelemetry SDK, combining them with +// metrics and traces from OpenTelemetry instrumentation. // -// There are known limitations to this bridge: +// # Migration Guide // -// - The AddLink method for OpenCensus Spans is not compatible with the -// OpenTelemetry Span. No link can be added to an OpenTelemetry Span once it -// is started. Any calls to this method for the OpenCensus Span will result -// in an error being sent to the OpenTelemetry default ErrorHandler. +// For most applications, it would be difficult to migrate an application +// from OpenCensus to OpenTelemetry all-at-once. Libraries used by the +// application may still be using OpenCensus, and the application itself may +// have many lines of instrumentation. // -// - The NewContext method of the OpenCensus Tracer cannot embed an OpenCensus -// Span in a context unless that Span was created by that Tracer. +// Bridges help in this situation by allowing your application to have "mixed" +// instrumentation, while incorporating all instrumentation into a single +// export path. To migrate with bridges, a user would: // -// - Conversion of custom OpenCensus Samplers to OpenTelemetry is not -// implemented. An error will be sent to the OpenTelemetry default -// ErrorHandler if this is attempted. +// 1. Configure the OpenTelemetry SDK for metrics and traces, with the OpenTelemetry exporters matching to your current OpenCensus exporters. +// 2. Install this OpenCensus bridge, which sends OpenCensus telemetry to your new OpenTelemetry exporters. +// 3. Over time, migrate your instrumentation from OpenCensus to OpenTelemetry. +// 4. Once all instrumentation is migrated, remove the OpenCensus bridge. +// +// With this approach, you can migrate your telemetry, including in dependent +// libraries over time without disruption. +// +// # Warnings +// +// Installing a metric or tracing bridge will cause OpenCensus telemetry to be +// exported by OpenTelemetry exporters. Since OpenCensus telemetry uses globals, +// installing a bridge will result in telemetry collection from _all_ libraries +// that use OpenCensus, including some you may not expect, such as the +// telemetry exporter itself. +// +// # Limitations +// +// There are known limitations to the trace bridge: +// +// - The AddLink method for OpenCensus Spans is ignored, and an error is sent +// to the OpenTelemetry ErrorHandler. +// - The NewContext method of the OpenCensus Tracer cannot embed an OpenCensus +// Span in a context unless that Span was created by that Tracer. +// - Conversion of custom OpenCensus Samplers to OpenTelemetry is not +// implemented, and An error will be sent to the OpenTelemetry ErrorHandler. +// +// There are known limitations to the metric bridge: +// - Summary-typed metrics are dropped +// - GaugeDistribution-typed metrics are dropped +// - Histogram's SumOfSquaredDeviation field is dropped +// - Exemplars on Histograms are dropped package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" diff --git a/bridge/opencensus/example_test.go b/bridge/opencensus/example_test.go new file mode 100644 index 00000000000..57fef19e168 --- /dev/null +++ b/bridge/opencensus/example_test.go @@ -0,0 +1,44 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus_test + +import ( + octrace "go.opencensus.io/trace" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/bridge/opencensus" + "go.opentelemetry.io/otel/sdk/metric" +) + +func ExampleNewTracer() { + // Create an OpenTelemetry Tracer to use to record spans. + tracer := otel.GetTracerProvider().Tracer("go.opentelemetry.io/otel/bridge/opencensus") + // Overwrite the OpenCensus DefaultTracer so that it uses OpenTelemetry + // rather than OpenCensus. + octrace.DefaultTracer = opencensus.NewTracer(tracer) +} + +func ExampleNewMetricProducer() { + // Create the OpenCensus Metric bridge. + bridge := opencensus.NewMetricProducer() + // Add the bridge as a producer to your reader. + // If using a push exporter, such as OTLP exporter, + // use metric.NewPeriodicReader with metric.WithProducer option. + // If using a pull exporter which acts as a reader, such as prometheus exporter, + // use a dedicated option like prometheus.WithProducer. + reader := metric.NewManualReader(metric.WithProducer(bridge)) + // Add the reader to your MeterProvider. + _ = metric.NewMeterProvider(metric.WithReader(reader)) +} diff --git a/bridge/opencensus/bridge.go b/bridge/opencensus/trace.go similarity index 100% rename from bridge/opencensus/bridge.go rename to bridge/opencensus/trace.go From 60666c554065ac4da502fe28943eea4b938ab479 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 28 Sep 2023 12:28:51 -0700 Subject: [PATCH 714/886] Release v1.19.0/v0.42.0/v0.0.7 (#4568) * Bump versions * Prepare stable-v1 for version v1.19.0 * Prepare experimental-metrics for version v0.42.0 * Prepare experimental-schema for version v0.0.7 * Update changelog --- CHANGELOG.md | 22 +++++++++++++++---- bridge/opencensus/go.mod | 10 ++++----- bridge/opencensus/test/go.mod | 12 +++++----- bridge/opentracing/go.mod | 6 ++--- bridge/opentracing/test/go.mod | 8 +++---- example/dice/go.mod | 14 ++++++------ example/fib/go.mod | 10 ++++----- example/namedtracer/go.mod | 10 ++++----- example/opencensus/go.mod | 16 +++++++------- example/otel-collector/go.mod | 12 +++++----- example/passthrough/go.mod | 10 ++++----- example/prometheus/go.mod | 12 +++++----- example/view/go.mod | 12 +++++----- example/zipkin/go.mod | 10 ++++----- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 +++++----- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 12 +++++----- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 +++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 ++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 ++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 ++++----- exporters/stdout/stdoutmetric/go.mod | 10 ++++----- exporters/stdout/stdouttrace/go.mod | 8 +++---- exporters/zipkin/go.mod | 8 +++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 ++--- sdk/metric/go.mod | 8 +++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 6 ++--- 34 files changed, 153 insertions(+), 139 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47844f6b57f..3e5c35b5dcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,14 +8,26 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] -### Changed +## [1.19.0/0.42.0/0.0.7] 2023-09-28 -- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettifies the output by default anymore. (#4507) +This release contains the first stable release of the OpenTelemetry Go [metric SDK]. +Our project stability guarantees now apply to the `go.opentelemetry.io/otel/sdk/metric` package. +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. ### Added - Add the "Roll the dice" getting started application example in `go.opentelemetry.io/otel/example/dice`. (#4539) -- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON (#4507). +- The `WithWriter` and `WithPrettyPrint` options to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to set a custom `io.Writer`, and allow displaying the output in human-readable JSON. (#4507) + +### Changed + +- Allow '/' characters in metric instrument names. (#4501) +- The exporter in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` does not prettify its output by default anymore. (#4507) +- Upgrade `gopkg.io/yaml` from `v2` to `v3` in `go.opentelemetry.io/otel/schema`. (#4535) + +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, don't try to create the Prometheus metric on every `Collect` if we know the scope is invalid. (#4499) ### Removed @@ -2644,7 +2656,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.19.0-rc.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.19.0...HEAD +[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 [1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 [1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 [1.17.0/0.40.0/0.0.5]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.17.0 @@ -2721,3 +2734,4 @@ It contains api and sdk for trace and meter. [Go 1.19]: https://go.dev/doc/go1.19 [metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric +[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index a6277595352..48f2d2a956d 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index c1a7fed659b..139c3069b03 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.42.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/bridge/opencensus v0.42.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index ac2644745e0..a225a4016cd 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index fbe270f753c..796bd37f4f4 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/bridge/opentracing v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/bridge/opentracing v1.19.0 google.golang.org/grpc v1.58.2 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index 79b391a4f79..d1e13586d73 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.41.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.18.0 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 ) require ( github.com/felixge/httpsnoop v1.0.3 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/fib/go.mod b/example/fib/go.mod index e66e2d6715d..359be6c20de 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/fib go 1.20 require ( - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 0df5f4074dc..50498093e16 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index c19a2ab2f59..cc75b9ae829 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v0.42.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/bridge/opencensus v0.42.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index dcd3ceaae26..6470a15f2e3 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 google.golang.org/grpc v1.58.2 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index baa53453602..7d8c68534b1 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 3f948242899..2c3510a0c24 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.42.0-rc.1 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/prometheus v0.42.0 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 15f149dca13..9b0f6224f19 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -4,11 +4,11 @@ go 1.20 require ( github.com/prometheus/client_golang v1.16.0 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.42.0-rc.1 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/prometheus v0.42.0 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 ) require ( @@ -21,7 +21,7 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 8630ff3d5b5..95588af0609 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/zipkin v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/zipkin v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 0297284dd3e..af9052af4f5 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 google.golang.org/grpc v1.58.2 @@ -26,8 +26,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7981f6fd650..f8da8eeb33c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,10 +8,10 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 @@ -25,8 +25,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index 24e075bdf26..b4ecccdfb40 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.42.0-rc.1" + return "0.42.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 35003cb4651..06c08197355 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 05ecedd8eeb..08f543f4c41 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index b17203c0c6e..ebea9d1f2ad 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.58.2 google.golang.org/protobuf v1.31.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect golang.org/x/sys v0.12.0 // indirect golang.org/x/text v0.11.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 7b53186ea97..10ac73ee3b8 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.19.0-rc.1" + return "1.19.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index f6976d65357..45ab7d28df2 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.16.0 github.com/prometheus/client_model v0.4.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 google.golang.org/protobuf v1.31.0 ) @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 2e3134f9c6f..028903bf998 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/sdk/metric v1.19.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 3a3bb6e3fb5..70177f0d88f 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index f71546b28a0..f1376901874 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.5.9 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 07c536ea9b6..9ecfdb50f74 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index b8e7fd5c64f..9579b924641 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index ae55d183b3c..6d707d62441 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.2.4 github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/trace v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/trace v1.19.0 golang.org/x/sys v0.12.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.19.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index ad5e47a5eab..bf140b694b6 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 - go.opentelemetry.io/otel/metric v1.19.0-rc.1 - go.opentelemetry.io/otel/sdk v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index ea099448117..3de4e06dc4d 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.19.0-rc.1" + return "1.19.0" } diff --git a/sdk/version.go b/sdk/version.go index e6979a9ad31..72d2cb09f7b 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.19.0-rc.1" + return "1.19.0" } diff --git a/trace/go.mod b/trace/go.mod index 4666402332e..d20100801bb 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.5.9 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0-rc.1 + go.opentelemetry.io/otel v1.19.0 ) require ( diff --git a/version.go b/version.go index a9d57931ffa..ad64e199672 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.19.0-rc.1" + return "1.19.0" } diff --git a/versions.yaml b/versions.yaml index 6492d09f1e8..7d212769240 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.19.0-rc.1 + version: v1.19.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -35,7 +35,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.42.0-rc.1 + version: v0.42.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test @@ -48,7 +48,7 @@ module-sets: - go.opentelemetry.io/otel/exporters/prometheus - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric experimental-schema: - version: v0.0.6 + version: v0.0.7 modules: - go.opentelemetry.io/otel/schema excluded-modules: From 0022098fd282ab7bde0a836777c8cac24b81dc80 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 29 Sep 2023 07:04:23 -0700 Subject: [PATCH 715/886] [chore] Update project status (#4569) --- .gitignore | 3 ++- README.md | 15 ++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index f3355c852be..9248055655b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,9 @@ gen/ /example/fib/traces.txt /example/jaeger/jaeger /example/namedtracer/namedtracer +/example/otel-collector/otel-collector /example/opencensus/opencensus /example/passthrough/passthrough /example/prometheus/prometheus +/example/view/view /example/zipkin/zipkin -/example/otel-collector/otel-collector diff --git a/README.md b/README.md index 634326ef833..41bc6a26a67 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,13 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | Project | -|---------|------------|-----------------------| -| Traces | Stable | N/A | -| Metrics | Mixed [1] | [Go: Metric SDK (GA)] | -| Logs | Frozen [2] | N/A | +| Signal | Status | +|---------|--------------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | In Development [1] | -[Go: Metric SDK (GA)]: https://github.com/orgs/open-telemetry/projects/34 - -- [1]: [Metrics API](https://pkg.go.dev/go.opentelemetry.io/otel/metric) is Stable. [Metrics SDK](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric) is Beta. -- [2]: The Logs signal development is halted for this project while we stabilize the Metrics SDK. +- [1]: Currently the logs signal development is in a design phase. No Logs Pull Requests are currently being accepted. Progress and status specific to this repository is tracked in our From 0f09b9b2d8654c05ed35f8b4065c5eddf5f0211c Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 29 Sep 2023 11:07:06 -0400 Subject: [PATCH 716/886] Add options to opencensus bridge, and install tracer instead of returning (#4567) * Add options to opencensus bridge, and install tracer instead of returning * add unit test * update unit tests * fix example * import ordering --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 8 ++++ bridge/opencensus/config.go | 65 +++++++++++++++++++++++++++ bridge/opencensus/config_test.go | 56 +++++++++++++++++++++++ bridge/opencensus/metric.go | 4 +- bridge/opencensus/test/bridge_test.go | 12 ++--- bridge/opencensus/trace.go | 11 +++++ example/opencensus/main.go | 5 +-- 7 files changed, 149 insertions(+), 12 deletions(-) create mode 100644 bridge/opencensus/config.go create mode 100644 bridge/opencensus/config_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e5c35b5dcc..7e551679270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) + +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) + ## [1.19.0/0.42.0/0.0.7] 2023-09-28 This release contains the first stable release of the OpenTelemetry Go [metric SDK]. diff --git a/bridge/opencensus/config.go b/bridge/opencensus/config.go new file mode 100644 index 00000000000..26c94742fb1 --- /dev/null +++ b/bridge/opencensus/config.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +import ( + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/trace" +) + +const scopeName = "go.opentelemetry.io/otel/bridge/opencensus" + +// newTraceConfig returns a config configured with options. +func newTraceConfig(options []TraceOption) traceConfig { + conf := traceConfig{tp: otel.GetTracerProvider()} + for _, o := range options { + conf = o.apply(conf) + } + return conf +} + +type traceConfig struct { + tp trace.TracerProvider +} + +// TraceOption applies a configuration option value to an OpenCensus bridge +// Tracer. +type TraceOption interface { + apply(traceConfig) traceConfig +} + +// traceOptionFunc applies a set of options to a config. +type traceOptionFunc func(traceConfig) traceConfig + +// apply returns a config with option(s) applied. +func (o traceOptionFunc) apply(conf traceConfig) traceConfig { + return o(conf) +} + +// WithTracerProvider specifies a tracer provider to use for creating a tracer. +func WithTracerProvider(tp trace.TracerProvider) TraceOption { + return traceOptionFunc(func(conf traceConfig) traceConfig { + conf.tp = tp + return conf + }) +} + +type metricConfig struct{} + +// MetricOption applies a configuration option value to an OpenCensus bridge +// MetricProducer. +type MetricOption interface { + apply(metricConfig) metricConfig +} diff --git a/bridge/opencensus/config_test.go b/bridge/opencensus/config_test.go new file mode 100644 index 00000000000..bad2dab8019 --- /dev/null +++ b/bridge/opencensus/config_test.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/trace" +) + +func TestNewTraceConfig(t *testing.T) { + globalTP := trace.NewNoopTracerProvider() + customTP := trace.NewNoopTracerProvider() + otel.SetTracerProvider(globalTP) + for _, tc := range []struct { + desc string + opts []TraceOption + expected traceConfig + }{ + { + desc: "default", + expected: traceConfig{ + tp: globalTP, + }, + }, + { + desc: "overridden", + opts: []TraceOption{ + WithTracerProvider(customTP), + }, + expected: traceConfig{ + tp: customTP, + }, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + cfg := newTraceConfig(tc.opts) + assert.Equal(t, tc.expected, cfg) + }) + } +} diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 1c2496d8c9b..d11b1de21ba 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -26,15 +26,13 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -const scopeName = "go.opentelemetry.io/otel/bridge/opencensus" - type producer struct { manager *metricproducer.Manager } // NewMetricProducer returns a metric.Producer that fetches metrics from // OpenCensus. -func NewMetricProducer() metric.Producer { +func NewMetricProducer(opts ...MetricOption) metric.Producer { return &producer{ manager: metricproducer.GlobalManager(), } diff --git a/bridge/opencensus/test/bridge_test.go b/bridge/opencensus/test/bridge_test.go index 5a278be0dfe..98041025c60 100644 --- a/bridge/opencensus/test/bridge_test.go +++ b/bridge/opencensus/test/bridge_test.go @@ -33,7 +33,7 @@ func TestMixedAPIs(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) tracer := tp.Tracer("mixedapitracer") - octrace.DefaultTracer = ocbridge.NewTracer(tracer) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) func() { ctx := context.Background() @@ -77,7 +77,7 @@ func TestMixedAPIs(t *testing.T) { func TestStartOptions(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - octrace.DefaultTracer = ocbridge.NewTracer(tp.Tracer("startoptionstracer")) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) ctx := context.Background() _, span := octrace.StartSpan(ctx, "OpenCensusSpan", octrace.WithSpanKind(octrace.SpanKindClient)) @@ -97,8 +97,8 @@ func TestStartOptions(t *testing.T) { func TestStartSpanWithRemoteParent(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) tracer := tp.Tracer("remoteparent") - octrace.DefaultTracer = ocbridge.NewTracer(tracer) ctx := context.Background() ctx, parent := tracer.Start(ctx, "OpenTelemetrySpan1") @@ -120,8 +120,8 @@ func TestStartSpanWithRemoteParent(t *testing.T) { func TestToFromContext(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) tracer := tp.Tracer("tofromcontext") - octrace.DefaultTracer = ocbridge.NewTracer(tracer) func() { ctx := context.Background() @@ -159,7 +159,7 @@ func TestToFromContext(t *testing.T) { func TestIsRecordingEvents(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - octrace.DefaultTracer = ocbridge.NewTracer(tp.Tracer("isrecordingevents")) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) ctx := context.Background() _, ocspan := octrace.StartSpan(ctx, "OpenCensusSpan1") @@ -179,7 +179,7 @@ func attrsMap(s []attribute.KeyValue) map[attribute.Key]attribute.Value { func TestSetThings(t *testing.T) { sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - octrace.DefaultTracer = ocbridge.NewTracer(tp.Tracer("setthings")) + ocbridge.InstallTraceBridge(ocbridge.WithTracerProvider(tp)) ctx := context.Background() _, ocspan := octrace.StartSpan(ctx, "OpenCensusSpan1") diff --git a/bridge/opencensus/trace.go b/bridge/opencensus/trace.go index 7e6f31202d6..1c45e975cfd 100644 --- a/bridge/opencensus/trace.go +++ b/bridge/opencensus/trace.go @@ -26,10 +26,21 @@ import ( // NewTracer returns an implementation of the OpenCensus Tracer interface which // uses OpenTelemetry APIs. Using this implementation of Tracer "upgrades" // libraries that use OpenCensus to OpenTelemetry to facilitate a migration. +// +// Deprecated: Use InstallTraceBridge instead. func NewTracer(tracer trace.Tracer) octrace.Tracer { return internal.NewTracer(tracer) } +// InstallTraceBridge installs the OpenCensus trace bridge, which overwrites +// the global OpenCensus tracer implementation. Once the bridge is installed, +// spans recorded using OpenCensus are redirected to the OpenTelemetry SDK. +func InstallTraceBridge(opts ...TraceOption) { + cfg := newTraceConfig(opts) + tracer := cfg.tp.Tracer(scopeName) + octrace.DefaultTracer = internal.NewTracer(tracer) +} + // OTelSpanContextToOC converts from an OpenTelemetry SpanContext to an // OpenCensus SpanContext, and handles any incompatibilities with the global // error handler. diff --git a/example/opencensus/main.go b/example/opencensus/main.go index c9709bad37a..4d1d1d04beb 100644 --- a/example/opencensus/main.go +++ b/example/opencensus/main.go @@ -78,8 +78,7 @@ func tracing(otExporter sdktrace.SpanExporter) { otel.SetTracerProvider(tp) log.Println("Installing the OpenCensus bridge to make OpenCensus libraries write spans using OpenTelemetry.") - tracer := tp.Tracer("simple") - octrace.DefaultTracer = opencensus.NewTracer(tracer) + opencensus.InstallTraceBridge() tp.ForceFlush(ctx) log.Println("Creating OpenCensus span, which should be printed out using the OpenTelemetry stdouttrace exporter.\n-- It should have no parent, since it is the first span.") @@ -88,7 +87,7 @@ func tracing(otExporter sdktrace.SpanExporter) { tp.ForceFlush(ctx) log.Println("Creating OpenTelemetry span\n-- It should have the OpenCensus span as a parent, since the OpenCensus span was written with using OpenTelemetry APIs.") - ctx, otspan := tracer.Start(ctx, "OpenTelemetrySpan") + ctx, otspan := tp.Tracer("simple").Start(ctx, "OpenTelemetrySpan") otspan.End() tp.ForceFlush(ctx) From 0e874c3468c2cbc5bbaf075537be6c0f2152b5ef Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 1 Oct 2023 13:00:18 -0700 Subject: [PATCH 717/886] dependabot updates Sun Oct 1 19:00:53 UTC 2023 (#4579) Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 in /exporters/prometheus Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.44.0 to 0.45.0 in /example/dice Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 in /example/prometheus Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 in /example/view --- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/prometheus/go.mod | 8 ++++---- example/prometheus/go.sum | 16 ++++++++-------- example/view/go.mod | 8 ++++---- example/view/go.sum | 16 ++++++++-------- exporters/prometheus/go.mod | 9 ++++----- exporters/prometheus/go.sum | 17 ++++++++--------- internal/tools/go.mod | 8 ++++---- internal/tools/go.sum | 16 ++++++++-------- 10 files changed, 51 insertions(+), 53 deletions(-) diff --git a/example/dice/go.mod b/example/dice/go.mod index d1e13586d73..e22e5dbc254 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/dice go 1.20 require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 diff --git a/example/dice/go.sum b/example/dice/go.sum index b9534f5b329..a5834efc0d4 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -9,8 +9,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 2c3510a0c24..1466c36da7f 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.20 require ( - github.com/prometheus/client_golang v1.16.0 + github.com/prometheus/client_golang v1.17.0 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/prometheus v0.42.0 go.opentelemetry.io/otel/metric v1.19.0 @@ -17,9 +17,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 2589fb129f2..0746a5222fa 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -17,14 +17,14 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= diff --git a/example/view/go.mod b/example/view/go.mod index 9b0f6224f19..d1531d82632 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/view go 1.20 require ( - github.com/prometheus/client_golang v1.16.0 + github.com/prometheus/client_golang v1.17.0 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/prometheus v0.42.0 go.opentelemetry.io/otel/metric v1.19.0 @@ -18,9 +18,9 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/example/view/go.sum b/example/view/go.sum index 2589fb129f2..0746a5222fa 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -17,14 +17,14 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 45ab7d28df2..0c3d8809068 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,8 +3,8 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.20 require ( - github.com/prometheus/client_golang v1.16.0 - github.com/prometheus/client_model v0.4.0 + github.com/prometheus/client_golang v1.17.0 + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/metric v1.19.0 @@ -23,9 +23,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.12.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 8ca966deec1..eed56cc980f 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -23,16 +23,15 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b8713b02069..6ce9f30ad9d 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -141,10 +141,10 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.4 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.4.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 6b4c7209fe2..775ceb8d53e 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -459,27 +459,27 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= From c7f53cc973726dd51222f670acc539e563e6a631 Mon Sep 17 00:00:00 2001 From: Shrey Gupta Date: Tue, 3 Oct 2023 11:42:09 +0530 Subject: [PATCH 718/886] Replace otlptracehttp example to use otlptracehttp instead of otlptrace (#4574) --- exporters/otlp/otlptrace/otlptracehttp/example_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 05f27212059..489d6400e95 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -20,7 +20,6 @@ import ( "log" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" @@ -66,8 +65,7 @@ func newResource() *resource.Resource { } func installExportPipeline(ctx context.Context) (func(context.Context) error, error) { - client := otlptracehttp.NewClient() - exporter, err := otlptrace.New(ctx, client) + exporter, err := otlptracehttp.New(ctx) if err != nil { return nil, fmt.Errorf("creating OTLP trace exporter: %w", err) } From 1c2fbf50df63f7a61b15f9d0ef4f3dd2d14fc682 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:44:40 +0200 Subject: [PATCH 719/886] dependabot updates Mon Oct 9 08:29:23 UTC 2023 (#4596) Bump codespell from 2.2.5 to 2.2.6 Bump golang.org/x/sys from 0.12.0 to 0.13.0 in /sdk Bump stefanzweifel/git-auto-commit-action from 4 to 5 Bump github.com/jcchavezs/porto from 0.4.0 to 0.5.1 in /internal/tools Bump golang.org/x/tools from 0.13.0 to 0.14.0 in /internal/tools Bump github.com/prometheus/client_model from 0.4.1-0.20230718164431-9a2bf3000d16 to 0.5.0 in /exporters/prometheus --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 +-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 +-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 +-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +-- example/prometheus/go.mod | 4 +-- example/prometheus/go.sum | 8 ++--- example/view/go.mod | 4 +-- example/view/go.sum | 8 ++--- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +-- exporters/prometheus/go.mod | 4 +-- exporters/prometheus/go.sum | 8 ++--- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +-- internal/tools/go.mod | 16 ++++----- internal/tools/go.sum | 34 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +-- 48 files changed, 103 insertions(+), 103 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 48f2d2a956d..97f5c9c354f 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 88bd438f084..b9449eb4953 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 139c3069b03..34c82b77b72 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 8034431e832..5fc67bcdc1b 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 796bd37f4f4..244308c20e9 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 9849f15acb7..dc902573fd1 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/example/dice/go.mod b/example/dice/go.mod index e22e5dbc254..0a5d70c24cb 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index a5834efc0d4..6a0e46f1827 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -11,6 +11,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/fib/go.mod b/example/fib/go.mod index 359be6c20de..d1f4c004fbc 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index 1880644703c..5acdbbb0379 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 50498093e16..caf9a21e958 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.4 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 1880644703c..5acdbbb0379 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index cc75b9ae829..1893db97599 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 8034431e832..5fc67bcdc1b 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 6470a15f2e3..093118a9a0a 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index aed78e17b32..875b27a2d84 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 7d8c68534b1..e9340c5a727 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 1880644703c..5acdbbb0379 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 1466c36da7f..6ae665530cd 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -17,12 +17,12 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 0746a5222fa..a8cc3b251e4 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -19,16 +19,16 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index d1531d82632..0941e70f654 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -18,11 +18,11 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index 0746a5222fa..a8cc3b251e4 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -19,16 +19,16 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfr github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 95588af0609..13ac0462a51 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index db79ebef1b1..8439cda9823 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index af9052af4f5..e9625c9e2fd 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index b3ae2009b4f..7ebc4fabd4e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index f8da8eeb33c..a5797f9dc4c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index b3ae2009b4f..7ebc4fabd4e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 06c08197355..09f30b555d8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 74d3c70ab0f..7acae27e250 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 08f543f4c41..1e189498515 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 1838dbbf406..f599b356973 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -30,8 +30,8 @@ go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index ebea9d1f2ad..f8bccdf30fc 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.11.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 822ed05cfc9..006fd89b554 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 0c3d8809068..5917219f473 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/prometheus/client_golang v1.17.0 - github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 + github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/metric v1.19.0 @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index eed56cc980f..2c38653e125 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -25,8 +25,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= @@ -35,8 +35,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 028903bf998..f7f2a53b3ad 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 918c4352bc3..9d15aed349d 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 70177f0d88f..ef74ae0f273 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 918c4352bc3..9d15aed349d 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index f1376901874..09326a72c50 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index aff8d67cf0b..8fc17b7b1af 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 6ce9f30ad9d..ccab504faed 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.54.2 github.com/itchyny/gojq v0.12.13 - github.com/jcchavezs/porto v0.4.0 + github.com/jcchavezs/porto v0.5.1 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.12.0 go.opentelemetry.io/build-tools/dbotconf v0.12.0 @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.13.0 + golang.org/x/tools v0.14.0 ) require ( @@ -142,7 +142,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.4 // indirect github.com/prometheus/client_golang v1.17.0 // indirect - github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect @@ -196,12 +196,12 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.13.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sync v0.3.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/mod v0.13.0 // indirect + golang.org/x/net v0.16.0 // indirect + golang.org/x/sync v0.4.0 // indirect + golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 775ceb8d53e..b1fbe5bb7bc 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -333,8 +333,8 @@ github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jcchavezs/porto v0.4.0 h1:Zj7RligrxmDdKGo6fBO2xYAHxEgrVBfs1YAja20WbV4= -github.com/jcchavezs/porto v0.4.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= +github.com/jcchavezs/porto v0.5.1 h1:Uq3x85zFfgipfdHMeeyoh3gHs/oHM9waGCivLNuzLIc= +github.com/jcchavezs/porto v0.5.1/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= @@ -465,8 +465,8 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= -github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= @@ -649,8 +649,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -697,8 +697,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -742,8 +742,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -767,8 +767,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -830,8 +830,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -839,7 +839,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -927,8 +927,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index 6d707d62441..3ae42be89e0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 - golang.org/x/sys v0.12.0 + golang.org/x/sys v0.13.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index a5f7da7d45d..7320e854ba6 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index bf140b694b6..147a7ad45cf 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.12.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 918c4352bc3..9d15aed349d 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From d9fa13fd260eef5bc118b4695a55be40d4cde3ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:03:54 +0200 Subject: [PATCH 720/886] Bump stefanzweifel/git-auto-commit-action from 4 to 5 (#4592) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4 to 5. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/stefanzweifel/git-auto-commit-action/compare/v4...v5) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index ce38d9f4d82..e040ce1a3ae 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -19,7 +19,7 @@ jobs: with: gomods: '**/go.mod' gomodsum_only: true - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 id: autocommit with: commit_message: Auto-fix go.sum changes in dependent modules From 56766cadc0acdc64b6c2401950583831a8798971 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:34:13 +0200 Subject: [PATCH 721/886] Bump codespell from 2.2.5 to 2.2.6 (#4594) Bumps [codespell](https://github.com/codespell-project/codespell) from 2.2.5 to 2.2.6. - [Release notes](https://github.com/codespell-project/codespell/releases) - [Commits](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6) --- updated-dependencies: - dependency-name: codespell dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ddff454685c..e0a43e13840 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -codespell==2.2.5 +codespell==2.2.6 From 68241aff1da6635ff2491f036aafd471a2bd27c8 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 9 Oct 2023 10:04:32 -0400 Subject: [PATCH 722/886] opencensus.NewMetricProducer returns a struct instead of the metric.Producer (#4583) --- CHANGELOG.md | 4 ++++ bridge/opencensus/metric.go | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e551679270..94870c638d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) +### Changed + +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) + ## [1.19.0/0.42.0/0.0.7] 2023-09-28 This release contains the first stable release of the OpenTelemetry Go [metric SDK]. diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index d11b1de21ba..577c311f3fd 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -26,19 +26,25 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -type producer struct { +// MetricProducer implements the [go.opentelemetry.io/otel/sdk/metric.Producer] to provide metrics +// from OpenCensus to the OpenTelemetry SDK. +type MetricProducer struct { manager *metricproducer.Manager } // NewMetricProducer returns a metric.Producer that fetches metrics from // OpenCensus. -func NewMetricProducer(opts ...MetricOption) metric.Producer { - return &producer{ +func NewMetricProducer(opts ...MetricOption) *MetricProducer { + return &MetricProducer{ manager: metricproducer.GlobalManager(), } } -func (p *producer) Produce(context.Context) ([]metricdata.ScopeMetrics, error) { +var _ metric.Producer = (*MetricProducer)(nil) + +// Produce fetches metrics from the OpenCensus manager, +// translates them to OpenTelemetry's data model, and returns them. +func (p *MetricProducer) Produce(context.Context) ([]metricdata.ScopeMetrics, error) { producers := p.manager.GetAll() data := []*ocmetricdata.Metric{} for _, ocProducer := range producers { From f3b9849323ac55afc34418e69d0ef9ca89a7602a Mon Sep 17 00:00:00 2001 From: sakshi-1505 <147167955+sakshi-1505@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:13:37 +0530 Subject: [PATCH 723/886] enh: add golvulncheck in linting job (#4598) --- Makefile | 13 ++++++++++++- internal/tools/go.mod | 3 ++- internal/tools/go.sum | 8 ++++++-- internal/tools/tools.go | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5c311706b0c..be8a10038e1 100644 --- a/Makefile +++ b/Makefile @@ -77,6 +77,9 @@ $(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl GORELEASE = $(TOOLS)/gorelease $(GORELEASE): PACKAGE=golang.org/x/exp/cmd/gorelease +GOVULNCHECK = $(TOOLS)/govulncheck +$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck + .PHONY: tools tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE) @@ -216,7 +219,7 @@ go-mod-tidy/%: | crosslink lint-modules: go-mod-tidy .PHONY: lint -lint: misspell lint-modules golangci-lint +lint: misspell lint-modules golangci-lint govulncheck .PHONY: vanity-import-check vanity-import-check: | $(PORTO) @@ -226,6 +229,14 @@ vanity-import-check: | $(PORTO) misspell: | $(MISSPELL) @$(MISSPELL) -w $(ALL_DOCS) +.PHONY: govulncheck +govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%) +govulncheck/%: DIR=$* +govulncheck/%: | $(GOVULNCHECK) + @echo "govulncheck ./... in $(DIR)" \ + && cd $(DIR) \ + && $(GOVULNCHECK) ./... + .PHONY: codespell codespell: | $(CODESPELL) @$(DOCKERPY) $(CODESPELL) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index ccab504faed..fe00517f499 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -16,6 +16,7 @@ require ( go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/tools v0.14.0 + golang.org/x/vuln v1.0.1 ) require ( @@ -212,5 +213,5 @@ require ( mvdan.cc/gofumpt v0.5.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect - mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect + mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8 // indirect ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index b1fbe5bb7bc..cf9f25ee84b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -263,6 +263,7 @@ github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSW github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -292,6 +293,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -927,6 +929,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= +golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1060,8 +1064,8 @@ mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wp mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= -mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d h1:3rvTIIM22r9pvXk+q3swxUQAQOxksVMGK7sml4nG57w= -mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d/go.mod h1:IeHQjmn6TOD+e4Z3RFiZMMsLVL+A96Nvptar8Fj71is= +mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8 h1:VuJo4Mt0EVPychre4fNlDWDuE5AjXtPJpRUWqZDQhaI= +mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8/go.mod h1:Oh/d7dEtzsNHGOq1Cdv8aMm3KdKhVvPbRQcM8WFpBR8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/internal/tools/tools.go b/internal/tools/tools.go index e4b8e4c0fd2..44d113314ed 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -31,4 +31,5 @@ import ( _ "go.opentelemetry.io/build-tools/semconvgen" _ "golang.org/x/exp/cmd/gorelease" _ "golang.org/x/tools/cmd/stringer" + _ "golang.org/x/vuln/cmd/govulncheck" ) From 3f17bcb6c309157ec256be9197149014efea1c42 Mon Sep 17 00:00:00 2001 From: Ravan Scafi <6104262+ravanscafi@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:17:23 +0200 Subject: [PATCH 724/886] Fix WithoutCounterSuffixes documentation (#4602) --- exporters/prometheus/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index 885fd8b8b39..fe14212784d 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -112,7 +112,7 @@ func WithoutUnits() Option { }) } -// WithoutUnits disables exporter's addition _total suffixes on counters. +// WithoutCounterSuffixes disables exporter's addition _total suffixes on counters. // // By default, metric names include a _total suffix to follow Prometheus naming // conventions. For example, the counter metric happy.people would become From 1074d64d04560a09e3e69a94629968450438df39 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 11 Oct 2023 02:48:58 -0400 Subject: [PATCH 725/886] Add scope version to opencensus trace and metric bridges (#4584) --- CHANGELOG.md | 1 + bridge/opencensus/metric.go | 3 ++- bridge/opencensus/metric_test.go | 6 +++-- bridge/opencensus/trace.go | 9 ++++++-- bridge/opencensus/trace_test.go | 39 ++++++++++++++++++++++++++++++++ bridge/opencensus/version.go | 20 ++++++++++++++++ 6 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 bridge/opencensus/trace_test.go create mode 100644 bridge/opencensus/version.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 94870c638d6..8d6a4df4b5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) +- Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) ### Deprecated diff --git a/bridge/opencensus/metric.go b/bridge/opencensus/metric.go index 577c311f3fd..888e82f5ff3 100644 --- a/bridge/opencensus/metric.go +++ b/bridge/opencensus/metric.go @@ -56,7 +56,8 @@ func (p *MetricProducer) Produce(context.Context) ([]metricdata.ScopeMetrics, er } return []metricdata.ScopeMetrics{{ Scope: instrumentation.Scope{ - Name: scopeName, + Name: scopeName, + Version: Version(), }, Metrics: otelmetrics, }}, err diff --git a/bridge/opencensus/metric_test.go b/bridge/opencensus/metric_test.go index 29ec835c8ba..901953c3a81 100644 --- a/bridge/opencensus/metric_test.go +++ b/bridge/opencensus/metric_test.go @@ -64,7 +64,8 @@ func TestMetricProducer(t *testing.T) { }, expected: []metricdata.ScopeMetrics{{ Scope: instrumentation.Scope{ - Name: scopeName, + Name: scopeName, + Version: Version(), }, Metrics: []metricdata.Metrics{ { @@ -112,7 +113,8 @@ func TestMetricProducer(t *testing.T) { }, expected: []metricdata.ScopeMetrics{{ Scope: instrumentation.Scope{ - Name: scopeName, + Name: scopeName, + Version: Version(), }, Metrics: []metricdata.Metrics{ { diff --git a/bridge/opencensus/trace.go b/bridge/opencensus/trace.go index 1c45e975cfd..b1df5a3ca6c 100644 --- a/bridge/opencensus/trace.go +++ b/bridge/opencensus/trace.go @@ -36,9 +36,14 @@ func NewTracer(tracer trace.Tracer) octrace.Tracer { // the global OpenCensus tracer implementation. Once the bridge is installed, // spans recorded using OpenCensus are redirected to the OpenTelemetry SDK. func InstallTraceBridge(opts ...TraceOption) { + octrace.DefaultTracer = newTraceBridge(opts) +} + +func newTraceBridge(opts []TraceOption) octrace.Tracer { cfg := newTraceConfig(opts) - tracer := cfg.tp.Tracer(scopeName) - octrace.DefaultTracer = internal.NewTracer(tracer) + return internal.NewTracer( + cfg.tp.Tracer(scopeName, trace.WithInstrumentationVersion(Version())), + ) } // OTelSpanContextToOC converts from an OpenTelemetry SpanContext to an diff --git a/bridge/opencensus/trace_test.go b/bridge/opencensus/trace_test.go new file mode 100644 index 00000000000..529a77070c7 --- /dev/null +++ b/bridge/opencensus/trace_test.go @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +import ( + "context" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/sdk/trace" + "go.opentelemetry.io/otel/sdk/trace/tracetest" +) + +func TestNewTraceBridge(t *testing.T) { + exporter := tracetest.NewInMemoryExporter() + tp := trace.NewTracerProvider(trace.WithSyncer(exporter)) + bridge := newTraceBridge([]TraceOption{WithTracerProvider(tp)}) + _, span := bridge.StartSpan(context.Background(), "foo") + span.End() + gotSpans := exporter.GetSpans() + require.Len(t, gotSpans, 1) + gotSpan := gotSpans[0] + assert.Equal(t, gotSpan.InstrumentationLibrary.Name, scopeName) + assert.Equal(t, gotSpan.InstrumentationLibrary.Version, Version()) +} diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go new file mode 100644 index 00000000000..2ce168e845a --- /dev/null +++ b/bridge/opencensus/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" + +// Version is the current release version of the opencensus bridge. +func Version() string { + return "0.42.0" +} From 960e6ab4255a51b2914ceb4a3daddd5d244f3dc1 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 11 Oct 2023 03:34:00 -0400 Subject: [PATCH 726/886] migrate opencensus bridge to errors.Join (#4599) --- bridge/opencensus/internal/ocmetric/metric.go | 58 ++++++++----------- .../internal/ocmetric/metric_test.go | 12 ++-- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index 3869d318cfb..d656e5d2871 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -25,11 +25,8 @@ import ( ) var ( - errConversion = errors.New("converting from OpenCensus to OpenTelemetry") errAggregationType = errors.New("unsupported OpenCensus aggregation type") errMismatchedValueTypes = errors.New("wrong value type for data point") - errNumberDataPoint = errors.New("converting a number data point") - errHistogramDataPoint = errors.New("converting a histogram data point") errNegativeDistributionCount = errors.New("distribution count is negative") errNegativeBucketCount = errors.New("distribution bucket count is negative") errMismatchedAttributeKeyValues = errors.New("mismatched number of attribute keys and values") @@ -38,14 +35,14 @@ var ( // ConvertMetrics converts metric data from OpenCensus to OpenTelemetry. func ConvertMetrics(ocmetrics []*ocmetricdata.Metric) ([]metricdata.Metrics, error) { otelMetrics := make([]metricdata.Metrics, 0, len(ocmetrics)) - var errInfo []string + var err error for _, ocm := range ocmetrics { if ocm == nil { continue } - agg, err := convertAggregation(ocm) - if err != nil { - errInfo = append(errInfo, err.Error()) + agg, aggregationErr := convertAggregation(ocm) + if aggregationErr != nil { + err = errors.Join(err, fmt.Errorf("error converting metric %v: %w", ocm.Descriptor.Name, aggregationErr)) continue } otelMetrics = append(otelMetrics, metricdata.Metrics{ @@ -55,11 +52,10 @@ func ConvertMetrics(ocmetrics []*ocmetricdata.Metric) ([]metricdata.Metrics, err Data: agg, }) } - var aggregatedError error - if len(errInfo) > 0 { - aggregatedError = fmt.Errorf("%w: %q", errConversion, errInfo) + if err != nil { + return otelMetrics, fmt.Errorf("error converting from OpenCensus to OpenTelemetry: %w", err) } - return otelMetrics, aggregatedError + return otelMetrics, nil } // convertAggregation produces an aggregation based on the OpenCensus Metric. @@ -97,17 +93,17 @@ func convertSum[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocme // convertNumberDataPoints converts OpenCensus TimeSeries to OpenTelemetry DataPoints. func convertNumberDataPoints[N int64 | float64](labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) ([]metricdata.DataPoint[N], error) { var points []metricdata.DataPoint[N] - var errInfo []string + var err error for _, t := range ts { - attrs, err := convertAttrs(labelKeys, t.LabelValues) - if err != nil { - errInfo = append(errInfo, err.Error()) + attrs, attrsErr := convertAttrs(labelKeys, t.LabelValues) + if attrsErr != nil { + err = errors.Join(err, attrsErr) continue } for _, p := range t.Points { v, ok := p.Value.(N) if !ok { - errInfo = append(errInfo, fmt.Sprintf("%v: %q", errMismatchedValueTypes, p.Value)) + err = errors.Join(err, fmt.Errorf("%w: %q", errMismatchedValueTypes, p.Value)) continue } points = append(points, metricdata.DataPoint[N]{ @@ -118,37 +114,33 @@ func convertNumberDataPoints[N int64 | float64](labelKeys []ocmetricdata.LabelKe }) } } - var aggregatedError error - if len(errInfo) > 0 { - aggregatedError = fmt.Errorf("%w: %v", errNumberDataPoint, errInfo) - } - return points, aggregatedError + return points, err } // convertHistogram converts OpenCensus Distribution timeseries to an // OpenTelemetry Histogram aggregation. func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Histogram[float64], error) { points := make([]metricdata.HistogramDataPoint[float64], 0, len(ts)) - var errInfo []string + var err error for _, t := range ts { - attrs, err := convertAttrs(labelKeys, t.LabelValues) - if err != nil { - errInfo = append(errInfo, err.Error()) + attrs, attrsErr := convertAttrs(labelKeys, t.LabelValues) + if attrsErr != nil { + err = errors.Join(err, attrsErr) continue } for _, p := range t.Points { dist, ok := p.Value.(*ocmetricdata.Distribution) if !ok { - errInfo = append(errInfo, fmt.Sprintf("%v: %d", errMismatchedValueTypes, p.Value)) + err = errors.Join(err, fmt.Errorf("%w: %d", errMismatchedValueTypes, p.Value)) continue } - bucketCounts, err := convertBucketCounts(dist.Buckets) - if err != nil { - errInfo = append(errInfo, err.Error()) + bucketCounts, bucketErr := convertBucketCounts(dist.Buckets) + if bucketErr != nil { + err = errors.Join(err, bucketErr) continue } if dist.Count < 0 { - errInfo = append(errInfo, fmt.Sprintf("%v: %d", errNegativeDistributionCount, dist.Count)) + err = errors.Join(err, fmt.Errorf("%w: %d", errNegativeDistributionCount, dist.Count)) continue } // TODO: handle exemplars @@ -163,11 +155,7 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time }) } } - var aggregatedError error - if len(errInfo) > 0 { - aggregatedError = fmt.Errorf("%w: %v", errHistogramDataPoint, errInfo) - } - return metricdata.Histogram[float64]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, aggregatedError + return metricdata.Histogram[float64]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, err } // convertBucketCounts converts from OpenCensus bucket counts to slice of uint64. diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index 0cbb217f293..76acbc80089 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -461,7 +461,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errNegativeDistributionCount, }, { desc: "histogram with negative bucket count", input: []*ocmetricdata.Metric{ @@ -488,7 +488,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errNegativeBucketCount, }, { desc: "histogram with non-histogram datapoint type", input: []*ocmetricdata.Metric{ @@ -509,7 +509,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errMismatchedValueTypes, }, { desc: "sum with non-sum datapoint type", input: []*ocmetricdata.Metric{ @@ -530,7 +530,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errMismatchedValueTypes, }, { desc: "gauge with non-gauge datapoint type", input: []*ocmetricdata.Metric{ @@ -551,7 +551,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errMismatchedValueTypes, }, { desc: "unsupported Gauge Distribution type", input: []*ocmetricdata.Metric{ @@ -564,7 +564,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errConversion, + expectedErr: errAggregationType, }, } { t.Run(tc.desc, func(t *testing.T) { From 7997bb71d9198d83a91040fda8e17f9ad0070f01 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 12 Oct 2023 02:24:09 -0400 Subject: [PATCH 727/886] Update go version to v1.21.3/1.20.10 for CI (#4607) --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/dependabot.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6d546b9b49c..8b5e9183f19 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,7 +4,7 @@ on: branches: - main env: - DEFAULT_GO_VERSION: "~1.21.1" + DEFAULT_GO_VERSION: "~1.21.3" jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30b8e1250bd..cfe8eaf5149 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "~1.21.1" + DEFAULT_GO_VERSION: "~1.21.3" jobs: lint: runs-on: ubuntu-latest @@ -99,7 +99,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["~1.21.1", "~1.20.8"] + go-version: ["~1.21.3", "~1.20.10"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index f054eec1e71..848a92400b4 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -10,7 +10,7 @@ jobs: - name: Install Go uses: actions/setup-go@v4 with: - go-version: "~1.21.1" + go-version: "~1.21.3" - uses: actions/checkout@v4 diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index e040ce1a3ae..6e714196fc7 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: - go-version: '^1.21.1' + go-version: '~1.21.3' - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: From 1ed79e7eed2c80f08eb923e1c04c108ae9bcb0ce Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Thu, 12 Oct 2023 09:18:17 +0200 Subject: [PATCH 728/886] dependabot updates Thu Oct 12 07:09:43 UTC 2023 (#4616) Bump golang.org/x/net from 0.16.0 to 0.17.0 in /internal/tools Bump golang.org/x/net from 0.12.0 to 0.17.0 in /exporters/otlp/otlptrace/otlptracehttp Bump golang.org/x/net from 0.12.0 to 0.17.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump golang.org/x/net from 0.12.0 to 0.17.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump golang.org/x/net from 0.12.0 to 0.17.0 in /bridge/opentracing/test Bump golang.org/x/net from 0.12.0 to 0.17.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump golang.org/x/net from 0.12.0 to 0.17.0 in /example/otel-collector --- bridge/opentracing/test/go.mod | 4 ++-- bridge/opentracing/test/go.sum | 8 ++++---- example/otel-collector/go.mod | 4 ++-- example/otel-collector/go.sum | 8 ++++---- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 8 ++++---- internal/tools/go.mod | 2 +- internal/tools/go.sum | 8 ++++---- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 244308c20e9..c83ab461dc9 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -25,9 +25,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index dc902573fd1..d8616a7a52d 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -36,16 +36,16 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 093118a9a0a..d8d841723eb 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -24,9 +24,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 875b27a2d84..d8c3462a917 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -19,12 +19,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e9625c9e2fd..fa4f0cef49d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -28,9 +28,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 7ebc4fabd4e..7cab1c39a85 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -27,12 +27,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index a5797f9dc4c..0085c2653bb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -27,9 +27,9 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 7ebc4fabd4e..7cab1c39a85 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -27,12 +27,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 1e189498515..27d881fa998 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -25,9 +25,9 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index f599b356973..a098e2d0410 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -28,12 +28,12 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f8bccdf30fc..2bbed7ebef3 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -23,9 +23,9 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/net v0.12.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 006fd89b554..3d0d986e1f5 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -26,12 +26,12 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index fe00517f499..ad4a1ef0407 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -200,7 +200,7 @@ require ( golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.16.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index cf9f25ee84b..0e2ef45914b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -744,8 +744,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -929,10 +929,10 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= -golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= +golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From f14dc1281d10939b8ceaf8ccf5eea9a324732ae2 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 12 Oct 2023 00:34:32 -0700 Subject: [PATCH 729/886] metric: Typo fix in doc (#4608) --- metric/doc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metric/doc.go b/metric/doc.go index ae24e448d91..54716e13b35 100644 --- a/metric/doc.go +++ b/metric/doc.go @@ -149,7 +149,7 @@ of [go.opentelemetry.io/otel/metric]. Finally, an author can embed another implementation in theirs. The embedded implementation will be used for methods not defined by the author. For example, -an author who want to default to silently dropping the call can use +an author who wants to default to silently dropping the call can use [go.opentelemetry.io/otel/metric/noop]: import "go.opentelemetry.io/otel/metric/noop" From 8a923d0c7a7bc67bf4a209826065be0375d0b3de Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:00:18 -0500 Subject: [PATCH 730/886] Update the benchmarks to only record/display select benchmarks. (#4560) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add a benchmark target to makefile * update CI to reflect how the benchmarks will be used * Add auto-push to benchmarks branch. --------- Co-authored-by: Robert Pająk --- .github/workflows/benchmark.yml | 13 +++++++++---- .github/workflows/ci.yml | 16 ++++++++++++++++ Makefile | 12 ++++++++++++ .../aggregate/exponential_histogram_test.go | 2 +- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8b5e9183f19..ba3fffd9d8d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,21 +1,24 @@ name: Benchmark on: push: - branches: - - main + tags: + - v1.* + workflow_dispatch: + env: DEFAULT_GO_VERSION: "~1.21.3" jobs: benchmark: name: Benchmarks runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} - name: Run benchmarks - run: make test-bench | tee output.txt + run: make benchmark | tee output.txt - name: Download previous benchmark data uses: actions/cache@v3 with: @@ -28,6 +31,8 @@ jobs: tool: 'go' output-file-path: output.txt external-data-json-path: ./benchmarks/data.json - auto-push: false + github-token: ${{ secrets.GITHUB_TOKEN }} + gh-pages-branch: benchmarks + auto-push: true fail-on-alert: false alert-threshold: "400%" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfe8eaf5149..76c650b7ebd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,22 @@ jobs: run: make build - name: Check clean repository run: make check-clean-work-tree + test-bench: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Setup Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.DEFAULT_GO_VERSION }} + cache-dependency-path: "**/go.sum" + - name: Run benchmarks to check functionality + run: make test-bench test-race: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index be8a10038e1..0bc54769387 100644 --- a/Makefile +++ b/Makefile @@ -192,6 +192,18 @@ test-coverage: | $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt +# Adding a directory will include all benchmarks in that direcotry if a filter is not specified. +BENCHMARK_TARGETS := sdk/trace +.PHONY: benchmark +benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) +BENCHMARK_FILTER = . +# You can override the filter for a particular directory by adding a rule here. +benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample +benchmark/%: + @echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \ + && cd $* \ + $(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter)) + .PHONY: golangci-lint golangci-lint-fix golangci-lint-fix: ARGS=--fix golangci-lint-fix: golangci-lint diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 7dbb71b15bd..26b89f0ba50 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -676,7 +676,7 @@ func BenchmarkPrepend(b *testing.B) { func BenchmarkAppend(b *testing.B) { for i := 0; i < b.N; i++ { - agg := newExpoHistogramDataPoint[float64](1024, 200, false, false) + agg := newExpoHistogramDataPoint[float64](1024, 20, false, false) n := smallestNonZeroNormalFloat64 for j := 0; j < 1024; j++ { agg.record(n) From 28b459520c17ba001025c2467c9a36a6144b9800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 13 Oct 2023 08:26:35 +0200 Subject: [PATCH 731/886] Deprecate example/fib (#4618) --- CHANGELOG.md | 1 + example/fib/doc.go | 18 ++++++++++++++++++ example/fib/go.mod | 1 + 3 files changed, 20 insertions(+) create mode 100644 example/fib/doc.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6a4df4b5f..1afb77faff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Deprecated - Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) +- Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) ### Changed diff --git a/example/fib/doc.go b/example/fib/doc.go new file mode 100644 index 00000000000..77b63d47614 --- /dev/null +++ b/example/fib/doc.go @@ -0,0 +1,18 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Fib is the "Fibonacci" old getting started example application. +// +// Deprecated: See [go.opentelemetry.io/otel/example/dice] instead. +package main diff --git a/example/fib/go.mod b/example/fib/go.mod index d1f4c004fbc..553ec4b460b 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -1,3 +1,4 @@ +// Deprecated: See go.opentelemetry.io/otel/example/dice instead. module go.opentelemetry.io/otel/example/fib go 1.20 From d943f0fd1b3548163ccaa95aaf7bb94b53881e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 13 Oct 2023 19:51:11 +0200 Subject: [PATCH 732/886] sdk/trace: Fix ParentBased comment (#4604) --- sdk/trace/sampling.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/trace/sampling.go b/sdk/trace/sampling.go index 5ee9715d27b..a7bc125b9e8 100644 --- a/sdk/trace/sampling.go +++ b/sdk/trace/sampling.go @@ -158,9 +158,9 @@ func NeverSample() Sampler { return alwaysOffSampler{} } -// ParentBased returns a composite sampler which behaves differently, +// ParentBased returns a sampler decorator which behaves differently, // based on the parent of the span. If the span has no parent, -// the root(Sampler) is used to make sampling decision. If the span has +// the decorated sampler is used to make sampling decision. If the span has // a parent, depending on whether the parent is remote and whether it // is sampled, one of the following samplers will apply: // - remoteParentSampled(Sampler) (default: AlwaysOn) From c047088605b454f172765621d53107f80b1e6417 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:53:27 +0200 Subject: [PATCH 733/886] dependabot updates Sun Oct 15 14:43:01 UTC 2023 (#4637) Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /trace Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /example/otel-collector Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /exporters/zipkin Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /exporters/otlp/otlptrace Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.58.2 to 1.58.3 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 in /sdk --- bridge/opencensus/go.sum | 2 +- bridge/opencensus/test/go.sum | 2 +- bridge/opentracing/go.sum | 2 +- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 6 +++--- example/dice/go.sum | 2 +- example/fib/go.sum | 2 +- example/namedtracer/go.sum | 2 +- example/opencensus/go.sum | 2 +- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 6 +++--- example/passthrough/go.sum | 2 +- example/prometheus/go.sum | 2 +- example/view/go.sum | 2 +- example/zipkin/go.sum | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 8 ++++---- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 8 ++++---- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 6 +++--- exporters/prometheus/go.sum | 2 +- exporters/stdout/stdoutmetric/go.sum | 2 +- exporters/stdout/stdouttrace/go.sum | 2 +- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- metric/go.sum | 2 +- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.sum | 2 +- trace/go.mod | 2 +- trace/go.sum | 4 ++-- 40 files changed, 62 insertions(+), 62 deletions(-) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index b9449eb4953..4cc565dcb2c 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -34,7 +34,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 5fc67bcdc1b..7baaf57f64a 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -34,7 +34,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index a075e034330..6a160f91b23 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index c83ab461dc9..bbae7b0d6c3 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/bridge/opentracing v1.19.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 ) require ( diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index d8616a7a52d..70f4eef8286 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -18,7 +18,7 @@ github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e h1:4cPxUYdgaGzZIT5/j0IfqOrrXmq6bG8AwvwisMXpdrg= github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/dice/go.sum b/example/dice/go.sum index 6a0e46f1827..a3f42f4ce58 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= diff --git a/example/fib/go.sum b/example/fib/go.sum index 5acdbbb0379..cff0c4e4f6f 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -4,7 +4,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 5acdbbb0379..cff0c4e4f6f 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -4,7 +4,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 5fc67bcdc1b..7baaf57f64a 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -34,7 +34,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d8d841723eb..fd49a4eb820 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index d8c3462a917..f04679ae0b0 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -11,7 +11,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -31,8 +31,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 5acdbbb0379..cff0c4e4f6f 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -4,7 +4,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index a8cc3b251e4..a0c02df46d0 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -13,7 +13,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/view/go.sum b/example/view/go.sum index a8cc3b251e4..a0c02df46d0 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -13,7 +13,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 8439cda9823..b3536f70884 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -4,7 +4,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index fa4f0cef49d..afeb0a12aa6 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -6,7 +6,7 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 @@ -14,7 +14,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 7cab1c39a85..c82a772101f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -13,8 +13,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 0085c2653bb..b56223607d7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -6,14 +6,14 @@ retract v0.32.2 // Contains unresolvable dependencies. require ( github.com/cenkalti/backoff/v4 v4.2.1 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 7cab1c39a85..c82a772101f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -13,8 +13,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 09f30b555d8..03032389c8e 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/otlp/otlptrace go 1.20 require ( - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/sdk v1.19.0 diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 7acae27e250..61d6a3139a5 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -8,8 +8,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 27d881fa998..7e96e3c3e86 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index a098e2d0410..554ad4dada3 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -13,7 +13,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -40,8 +40,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 2bbed7ebef3..fe2cc23bc14 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.2 + google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.31.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 3d0d986e1f5..343ddc2bc9c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -13,7 +13,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -38,8 +38,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1: google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 2c38653e125..0d1e9384cd9 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -15,7 +15,7 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 9d15aed349d..923cb680d72 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -5,7 +5,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 9d15aed349d..923cb680d72 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -5,7 +5,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 09326a72c50..e8707828afd 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 8fc17b7b1af..65a10a4d219 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/go.mod b/go.mod index 9ecfdb50f74..72444a58105 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/go-logr/logr v1.2.4 github.com/go-logr/stdr v1.2.2 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel/metric v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 diff --git a/go.sum b/go.sum index d58b1a3b04c..3abcad55071 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index ad4a1ef0407..8ee7e39e1ce 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -91,7 +91,7 @@ require ( github.com/golangci/misspell v0.4.1 // indirect github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 0e2ef45914b..b8a9db68ed3 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -276,8 +276,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= diff --git a/metric/go.sum b/metric/go.sum index cc053d286a4..db6b079126b 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -5,7 +5,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/sdk/go.mod b/sdk/go.mod index 3ae42be89e0..95a3e3f6630 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -6,7 +6,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/go-logr/logr v1.2.4 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 diff --git a/sdk/go.sum b/sdk/go.sum index 7320e854ba6..64648d865c7 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -5,8 +5,8 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 9d15aed349d..923cb680d72 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -5,7 +5,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/trace/go.mod b/trace/go.mod index d20100801bb..88f8f02b94b 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -5,7 +5,7 @@ go 1.20 replace go.opentelemetry.io/otel => ../ require ( - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 ) diff --git a/trace/go.sum b/trace/go.sum index 6b8b46ca828..55961e4a867 100644 --- a/trace/go.sum +++ b/trace/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= From 99004504777cfe8d8615d5693f1fa87867329f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 16 Oct 2023 11:20:21 +0200 Subject: [PATCH 734/886] [chore] Use check-latest in actions/setup-go (#4617) --- .github/workflows/benchmark.yml | 4 +++- .github/workflows/ci.yml | 27 ++++++---------------- .github/workflows/create-dependabot-pr.yml | 4 +++- .github/workflows/dependabot.yml | 4 +++- 4 files changed, 16 insertions(+), 23 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index ba3fffd9d8d..927a0ae123e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - DEFAULT_GO_VERSION: "~1.21.3" + DEFAULT_GO_VERSION: "1.21" jobs: benchmark: name: Benchmarks @@ -17,6 +17,8 @@ jobs: - uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} + check-latest: true + cache-dependency-path: "**/go.sum" - name: Run benchmarks run: make benchmark | tee output.txt - name: Download previous benchmark data diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76c650b7ebd..b74158d4be0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,28 +14,25 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "~1.21.3" + DEFAULT_GO_VERSION: "1.21" jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Install Go uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} + check-latest: true cache-dependency-path: "**/go.sum" - name: Tools cache uses: actions/cache@v3 env: cache-name: go-tools-cache with: - path: ~/.tools + path: .tools key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/**') }} - name: Generate run: make generate @@ -67,14 +64,11 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Install Go uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} + check-latest: true cache-dependency-path: "**/go.sum" - name: Run tests with race detector run: make test-race @@ -84,14 +78,11 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v4 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Install Go uses: actions/setup-go@v4 with: go-version: ${{ env.DEFAULT_GO_VERSION }} + check-latest: true cache-dependency-path: "**/go.sum" - name: Run coverage tests run: | @@ -115,7 +106,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["~1.21.3", "~1.20.10"] + go-version: ["1.21", "1.20"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner @@ -130,15 +121,11 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Setup Environment - run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - name: Install Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} + check-latest: true cache-dependency-path: "**/go.sum" - name: Run tests env: diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 848a92400b4..12af146fa52 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -10,7 +10,9 @@ jobs: - name: Install Go uses: actions/setup-go@v4 with: - go-version: "~1.21.3" + go-version: "1.21" + check-latest: true + cache-dependency-path: "**/go.sum" - uses: actions/checkout@v4 diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 6e714196fc7..d5a92565362 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,9 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: - go-version: '~1.21.3' + go-version: "1.21" + check-latest: true + cache-dependency-path: "**/go.sum" - uses: evantorrie/mott-the-tidier@v1-beta id: modtidy with: From 5dff273a1ee5b260a81767968d3dd5c6ddf17e55 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 16 Oct 2023 10:02:21 -0700 Subject: [PATCH 735/886] Use gofumpt instead of gofmt (#4623) * Use gofumpt instead of gofmt in golangci-lint conf * Run gofumpt fixes * Format generated templates --------- Co-authored-by: Chester Cheung --- .golangci.yml | 2 +- attribute/key_test.go | 4 +- .../internal/ocmetric/metric_test.go | 28 +++++---- bridge/opentracing/bridge.go | 12 ++-- bridge/opentracing/bridge_test.go | 8 +-- bridge/opentracing/internal/mock.go | 12 ++-- bridge/opentracing/test/bridge_grpc_test.go | 3 + bridge/opentracing/wrapper.go | 6 +- example/namedtracer/foo/foo.go | 4 +- .../otlpmetric/otlpmetricgrpc/client_test.go | 2 + .../internal/oconf/options_test.go | 2 +- .../otlpmetricgrpc/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../otlpmetric/otlpmetrichttp/client_test.go | 2 + .../internal/oconf/options_test.go | 2 +- .../otlpmetrichttp/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- exporters/otlp/otlptrace/exporter.go | 6 +- .../internal/tracetransform/span_test.go | 6 +- .../internal/otlpconfig/options_test.go | 2 +- .../otlptrace/otlptracehttp/example_test.go | 10 ++-- .../internal/otlpconfig/options_test.go | 2 +- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 4 +- exporters/stdout/stdoutmetric/exporter.go | 4 +- exporters/stdout/stdouttrace/example_test.go | 10 ++-- .../zipkin/internal/internaltest/harness.go | 4 +- .../internaltest/text_map_carrier_test.go | 4 +- .../zipkin/internal/matchers/expectation.go | 4 +- internal/attribute/attribute_test.go | 12 ++-- internal/global/instruments.go | 60 +++++++++++-------- internal/global/instruments_test.go | 4 ++ internal/internaltest/harness.go | 4 +- .../internaltest/text_map_carrier_test.go | 4 +- internal/matchers/expectation.go | 4 +- internal/shared/internaltest/harness.go.tmpl | 4 +- .../text_map_carrier_test.go.tmpl | 4 +- internal/shared/matchers/expectation.go.tmpl | 4 +- .../otlpmetric/oconf/options_test.go.tmpl | 2 +- .../otlp/otlpmetric/otest/client.go.tmpl | 2 +- .../transform/metricdata_test.go.tmpl | 2 +- .../otlptrace/otlpconfig/options_test.go.tmpl | 2 +- propagation/propagation_test.go | 4 +- propagation/trace_context.go | 6 +- sdk/internal/internaltest/harness.go | 4 +- .../internaltest/text_map_carrier_test.go | 4 +- sdk/internal/matchers/expectation.go | 4 +- sdk/metric/config_test.go | 1 + sdk/metric/instrument.go | 32 ++++++---- .../aggregate/exponential_histogram.go | 2 +- sdk/metric/manual_reader_test.go | 6 +- sdk/metric/meter.go | 10 ++-- sdk/metric/meter_test.go | 3 + .../metricdata/metricdatatest/comparisons.go | 1 + sdk/metric/periodic_reader.go | 3 +- sdk/metric/periodic_reader_test.go | 6 +- sdk/metric/pipeline_registry_test.go | 3 +- sdk/metric/reader_test.go | 3 +- sdk/resource/auto.go | 10 ++-- sdk/resource/benchmark_test.go | 6 ++ sdk/resource/env.go | 6 +- sdk/resource/export_test.go | 4 +- sdk/resource/os.go | 7 ++- sdk/resource/process.go | 36 ++++++----- sdk/trace/benchmark_test.go | 1 + sdk/trace/span.go | 6 +- .../span_processor_filter_example_test.go | 1 + sdk/trace/trace_test.go | 3 +- sdk/trace/tracetest/span.go | 1 + trace/config.go | 1 + trace/trace.go | 12 ++-- trace/trace_test.go | 14 ++--- trace/tracestate_test.go | 3 +- 73 files changed, 255 insertions(+), 209 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 6e8eeec00fa..7121593d5d2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,7 @@ linters: - depguard - errcheck - godot - - gofmt + - gofumpt - goimports - gosimple - govet diff --git a/attribute/key_test.go b/attribute/key_test.go index 6d9f0fedd65..1c739714e0f 100644 --- a/attribute/key_test.go +++ b/attribute/key_test.go @@ -41,7 +41,7 @@ func TestDefined(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //func (k attribute.Key) Defined() bool { + // func (k attribute.Key) Defined() bool { have := testcase.k.Defined() if have != testcase.want { t.Errorf("Want: %v, but have: %v", testcase.want, have) @@ -91,7 +91,7 @@ func TestEmit(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //proto: func (v attribute.Value) Emit() string { + // proto: func (v attribute.Value) Emit() string { have := testcase.v.Emit() if have != testcase.want { t.Errorf("Want: %s, but have: %s", testcase.want, have) diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index 76acbc80089..a3258c6b1e7 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -56,7 +56,6 @@ func TestConvertMetrics(t *testing.T) { }, TimeSeries: []*ocmetricdata.TimeSeries{ { - LabelValues: []ocmetricdata.LabelValue{ { Value: "hello", @@ -370,7 +369,8 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - }, { + }, + { desc: "histogram without data points", input: []*ocmetricdata.Metric{ { @@ -393,7 +393,8 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - }, { + }, + { desc: "sum without data points", input: []*ocmetricdata.Metric{ { @@ -417,7 +418,8 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - }, { + }, + { desc: "gauge without data points", input: []*ocmetricdata.Metric{ { @@ -439,7 +441,8 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - }, { + }, + { desc: "histogram with negative count", input: []*ocmetricdata.Metric{ { @@ -462,7 +465,8 @@ func TestConvertMetrics(t *testing.T) { }, }, expectedErr: errNegativeDistributionCount, - }, { + }, + { desc: "histogram with negative bucket count", input: []*ocmetricdata.Metric{ { @@ -489,7 +493,8 @@ func TestConvertMetrics(t *testing.T) { }, }, expectedErr: errNegativeBucketCount, - }, { + }, + { desc: "histogram with non-histogram datapoint type", input: []*ocmetricdata.Metric{ { @@ -510,7 +515,8 @@ func TestConvertMetrics(t *testing.T) { }, }, expectedErr: errMismatchedValueTypes, - }, { + }, + { desc: "sum with non-sum datapoint type", input: []*ocmetricdata.Metric{ { @@ -531,7 +537,8 @@ func TestConvertMetrics(t *testing.T) { }, }, expectedErr: errMismatchedValueTypes, - }, { + }, + { desc: "gauge with non-gauge datapoint type", input: []*ocmetricdata.Metric{ { @@ -552,7 +559,8 @@ func TestConvertMetrics(t *testing.T) { }, }, expectedErr: errMismatchedValueTypes, - }, { + }, + { desc: "unsupported Gauge Distribution type", input: []*ocmetricdata.Metric{ { diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 50ff21a191a..7dc81f56a32 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -317,8 +317,10 @@ type BridgeTracer struct { propagator propagation.TextMapPropagator } -var _ ot.Tracer = &BridgeTracer{} -var _ ot.TracerContextWithSpanExtension = &BridgeTracer{} +var ( + _ ot.Tracer = &BridgeTracer{} + _ ot.TracerContextWithSpanExtension = &BridgeTracer{} +) // NewBridgeTracer creates a new BridgeTracer. The new tracer forwards // the calls to the OpenTelemetry Noop tracer, so it should be @@ -829,15 +831,13 @@ func newTextMapWrapperForInject(carrier interface{}) (*textMapWrapper, error) { return t, nil } -type textMapWriter struct { -} +type textMapWriter struct{} func (t *textMapWriter) Set(key string, value string) { // maybe print a warning log. } -type textMapReader struct { -} +type textMapReader struct{} func (t *textMapReader) ForeachKey(handler func(key, val string) error) error { return nil // maybe print a warning log. diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 47d26916a53..bbeb3f9fbfe 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -35,8 +35,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -type testOnlyTextMapReader struct { -} +type testOnlyTextMapReader struct{} func newTestOnlyTextMapReader() *testOnlyTextMapReader { return &testOnlyTextMapReader{} @@ -144,8 +143,7 @@ var ( spanID trace.SpanID = [8]byte{byte(11)} ) -type testTextMapPropagator struct { -} +type testTextMapPropagator struct{} func (t testTextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) { carrier.Set(testHeader, strings.Join([]string{traceID.String(), spanID.String()}, ":")) @@ -163,7 +161,7 @@ func (t testTextMapPropagator) Extract(ctx context.Context, carrier propagation. return ctx } - var exist = false + exist := false for _, key := range carrier.Keys() { if strings.EqualFold(testHeader, key) { diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index 64e95604278..e9d90750a39 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -54,8 +54,10 @@ type MockTracer struct { rand *rand.Rand } -var _ trace.Tracer = &MockTracer{} -var _ migration.DeferredContextSetupTracerExtension = &MockTracer{} +var ( + _ trace.Tracer = &MockTracer{} + _ migration.DeferredContextSetupTracerExtension = &MockTracer{} +) func NewMockTracer() *MockTracer { return &MockTracer{ @@ -195,8 +197,10 @@ type MockSpan struct { Events []MockEvent } -var _ trace.Span = &MockSpan{} -var _ migration.OverrideTracerSpanExtension = &MockSpan{} +var ( + _ trace.Span = &MockSpan{} + _ migration.OverrideTracerSpanExtension = &MockSpan{} +) func (s *MockSpan) SpanContext() trace.SpanContext { return s.spanContext diff --git a/bridge/opentracing/test/bridge_grpc_test.go b/bridge/opentracing/test/bridge_grpc_test.go index 4843cbfd260..6b2208f6d3c 100644 --- a/bridge/opentracing/test/bridge_grpc_test.go +++ b/bridge/opentracing/test/bridge_grpc_test.go @@ -38,12 +38,15 @@ type testGRPCServer struct{} func (*testGRPCServer) UnaryCall(ctx context.Context, r *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { return &testpb.SimpleResponse{Payload: r.Payload * 2}, nil } + func (*testGRPCServer) StreamingOutputCall(*testpb.SimpleRequest, testpb.TestService_StreamingOutputCallServer) error { return nil } + func (*testGRPCServer) StreamingInputCall(testpb.TestService_StreamingInputCallServer) error { return nil } + func (*testGRPCServer) StreamingBidirectionalCall(testpb.TestService_StreamingBidirectionalCallServer) error { return nil } diff --git a/bridge/opentracing/wrapper.go b/bridge/opentracing/wrapper.go index 3e348c45523..c251f8e2c19 100644 --- a/bridge/opentracing/wrapper.go +++ b/bridge/opentracing/wrapper.go @@ -60,8 +60,10 @@ type WrapperTracer struct { tracer trace.Tracer } -var _ trace.Tracer = &WrapperTracer{} -var _ migration.DeferredContextSetupTracerExtension = &WrapperTracer{} +var ( + _ trace.Tracer = &WrapperTracer{} + _ migration.DeferredContextSetupTracerExtension = &WrapperTracer{} +) // NewWrapperTracer wraps the passed tracer and also talks to the // passed bridge tracer when setting up the context with the new diff --git a/example/namedtracer/foo/foo.go b/example/namedtracer/foo/foo.go index 1193f8ad018..074912e26e1 100644 --- a/example/namedtracer/foo/foo.go +++ b/example/namedtracer/foo/foo.go @@ -22,9 +22,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -var ( - lemonsKey = attribute.Key("ex.com/lemons") -) +var lemonsKey = attribute.Key("ex.com/lemons") // SubOperation is an example to demonstrate the use of named tracer. // It creates a named tracer with its package path. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 1de64a77268..bc766f5a26c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -136,9 +136,11 @@ type clientShim struct { func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } + func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation { return nil } + func (clientShim) ForceFlush(ctx context.Context) error { return ctx.Err() } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go index 8687acabcfa..64457efbf08 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go @@ -203,7 +203,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Metrics.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go index 3bb415e441f..154d4dd3c8c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go @@ -38,7 +38,7 @@ import ( var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go index b94c48dae8d..676e5785633 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go @@ -40,7 +40,7 @@ type unknownAggT struct { var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) alice = attribute.NewSet(attribute.String("user", "alice")) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 36075c19ee5..ff06fcf5eb0 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -40,9 +40,11 @@ type clientShim struct { func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } + func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation { return nil } + func (clientShim) ForceFlush(ctx context.Context) error { return ctx.Err() } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go index bb34337a1f2..1da4a6f2f63 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go @@ -203,7 +203,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Metrics.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go index 4169c9d964d..41374b956a4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go @@ -38,7 +38,7 @@ import ( var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go index b94c48dae8d..676e5785633 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go @@ -40,7 +40,7 @@ type unknownAggT struct { var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) alice = attribute.NewSet(attribute.String("user", "alice")) diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index 0dbe15555b3..b46a38d60ab 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -24,9 +24,7 @@ import ( tracesdk "go.opentelemetry.io/otel/sdk/trace" ) -var ( - errAlreadyStarted = errors.New("already started") -) +var errAlreadyStarted = errors.New("already started") // Exporter exports trace data in the OTLP wire format. type Exporter struct { @@ -55,7 +53,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan) // Start establishes a connection to the receiving endpoint. func (e *Exporter) Start(ctx context.Context) error { - var err = errAlreadyStarted + err := errAlreadyStarted e.startOnce.Do(func() { e.mu.Lock() e.started = true diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 7e0be6cabb7..7a4fa1e9185 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -213,12 +213,14 @@ func TestSpanData(t *testing.T) { StartTime: startTime, EndTime: endTime, Events: []tracesdk.Event{ - {Time: startTime, + { + Time: startTime, Attributes: []attribute.KeyValue{ attribute.Int64("CompressedByteSize", 512), }, }, - {Time: endTime, + { + Time: endTime, Attributes: []attribute.KeyValue{ attribute.String("EventType", "Recv"), }, diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go index e947cdcb86e..567f12f1018 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go @@ -201,7 +201,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Traces.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index 489d6400e95..d6bf4b0ab17 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -32,12 +32,10 @@ const ( instrumentationVersion = "0.1.0" ) -var ( - tracer = otel.GetTracerProvider().Tracer( - instrumentationName, - trace.WithInstrumentationVersion(instrumentationVersion), - trace.WithSchemaURL(semconv.SchemaURL), - ) +var tracer = otel.GetTracerProvider().Tracer( + instrumentationName, + trace.WithInstrumentationVersion(instrumentationVersion), + trace.WithSchemaURL(semconv.SchemaURL), ) func add(ctx context.Context, x, y int64) int64 { diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go index 5fbda6d460d..4c7a525a996 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go @@ -201,7 +201,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Traces.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 89fc87df3b9..0f211d8318e 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -746,7 +746,7 @@ func TestDuplicateMetrics(t *testing.T) { tc.recordMetrics(ctx, meterA, meterB) - var match = false + match := false for _, filename := range tc.possibleExpectedFiles { file, ferr := os.Open(filename) require.NoError(t, ferr) diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index c0e250f4e4c..6cc978ebbed 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -31,7 +31,7 @@ import ( var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - now = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + now = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) res = resource.NewSchemaless( semconv.ServiceName("stdoutmetric-example"), @@ -158,7 +158,7 @@ func Example() { // Ensure the periodic reader is cleaned up by shutting down the sdk. _ = sdk.Shutdown(ctx) - //Output: + // Output: // { // "Resource": [ // { diff --git a/exporters/stdout/stdoutmetric/exporter.go b/exporters/stdout/stdoutmetric/exporter.go index c223a84da59..faedf9a9100 100644 --- a/exporters/stdout/stdoutmetric/exporter.go +++ b/exporters/stdout/stdoutmetric/exporter.go @@ -106,9 +106,7 @@ func redactTimestamps(orig *metricdata.ResourceMetrics) { } } -var ( - errUnknownAggType = errors.New("unknown aggregation type") -) +var errUnknownAggType = errors.New("unknown aggregation type") func redactAggregationTimestamps(orig metricdata.Aggregation) metricdata.Aggregation { switch a := orig.(type) { diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index a3634296e7a..0abd72d10e9 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -32,12 +32,10 @@ const ( instrumentationVersion = "0.1.0" ) -var ( - tracer = otel.GetTracerProvider().Tracer( - instrumentationName, - trace.WithInstrumentationVersion(instrumentationVersion), - trace.WithSchemaURL(semconv.SchemaURL), - ) +var tracer = otel.GetTracerProvider().Tracer( + instrumentationName, + trace.WithInstrumentationVersion(instrumentationVersion), + trace.WithSchemaURL(semconv.SchemaURL), ) func add(ctx context.Context, x, y int64) int64 { diff --git a/exporters/zipkin/internal/internaltest/harness.go b/exporters/zipkin/internal/internaltest/harness.go index d8118d4f3b5..53e8b3bf113 100644 --- a/exporters/zipkin/internal/internaltest/harness.go +++ b/exporters/zipkin/internal/internaltest/harness.go @@ -263,7 +263,7 @@ func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { } func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { - var methods = map[string]func(span trace.Span){ + methods := map[string]func(span trace.Span){ "#End": func(span trace.Span) { span.End() }, @@ -283,7 +283,7 @@ func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) }, } - var mechanisms = map[string]func() trace.Span{ + mechanisms := map[string]func() trace.Span{ "Span created via Tracer#Start": func() trace.Span { tracer := tracerFactory() _, subject := tracer.Start(context.Background(), "test") diff --git a/exporters/zipkin/internal/internaltest/text_map_carrier_test.go b/exporters/zipkin/internal/internaltest/text_map_carrier_test.go index faf713cc2d0..086c8af26ea 100644 --- a/exporters/zipkin/internal/internaltest/text_map_carrier_test.go +++ b/exporters/zipkin/internal/internaltest/text_map_carrier_test.go @@ -22,9 +22,7 @@ import ( "testing" ) -var ( - key, value = "test", "true" -) +var key, value = "test", "true" func TestTextMapCarrierKeys(t *testing.T) { tmc := NewTextMapCarrier(map[string]string{key: value}) diff --git a/exporters/zipkin/internal/matchers/expectation.go b/exporters/zipkin/internal/matchers/expectation.go index 411300d5819..f890ca92790 100644 --- a/exporters/zipkin/internal/matchers/expectation.go +++ b/exporters/zipkin/internal/matchers/expectation.go @@ -27,9 +27,7 @@ import ( "time" ) -var ( - stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) -) +var stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) type Expectation struct { t *testing.T diff --git a/internal/attribute/attribute_test.go b/internal/attribute/attribute_test.go index 3cba91173de..05f4a0a5397 100644 --- a/internal/attribute/attribute_test.go +++ b/internal/attribute/attribute_test.go @@ -39,16 +39,20 @@ var wrapBoolSliceValue = func(v interface{}) interface{} { } return nil } + var wrapStringSliceValue = func(v interface{}) interface{} { if vi, ok := v.([]string); ok { return StringSliceValue(vi) } return nil } -var wrapAsBoolSlice = func(v interface{}) interface{} { return AsBoolSlice(v) } -var wrapAsInt64Slice = func(v interface{}) interface{} { return AsInt64Slice(v) } -var wrapAsFloat64Slice = func(v interface{}) interface{} { return AsFloat64Slice(v) } -var wrapAsStringSlice = func(v interface{}) interface{} { return AsStringSlice(v) } + +var ( + wrapAsBoolSlice = func(v interface{}) interface{} { return AsBoolSlice(v) } + wrapAsInt64Slice = func(v interface{}) interface{} { return AsInt64Slice(v) } + wrapAsFloat64Slice = func(v interface{}) interface{} { return AsFloat64Slice(v) } + wrapAsStringSlice = func(v interface{}) interface{} { return AsStringSlice(v) } +) func TestSliceValue(t *testing.T) { type args struct { diff --git a/internal/global/instruments.go b/internal/global/instruments.go index a33eded872a..ebb13c20678 100644 --- a/internal/global/instruments.go +++ b/internal/global/instruments.go @@ -34,11 +34,13 @@ type afCounter struct { name string opts []metric.Float64ObservableCounterOption - delegate atomic.Value //metric.Float64ObservableCounter + delegate atomic.Value // metric.Float64ObservableCounter } -var _ unwrapper = (*afCounter)(nil) -var _ metric.Float64ObservableCounter = (*afCounter)(nil) +var ( + _ unwrapper = (*afCounter)(nil) + _ metric.Float64ObservableCounter = (*afCounter)(nil) +) func (i *afCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableCounter(i.name, i.opts...) @@ -63,11 +65,13 @@ type afUpDownCounter struct { name string opts []metric.Float64ObservableUpDownCounterOption - delegate atomic.Value //metric.Float64ObservableUpDownCounter + delegate atomic.Value // metric.Float64ObservableUpDownCounter } -var _ unwrapper = (*afUpDownCounter)(nil) -var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +var ( + _ unwrapper = (*afUpDownCounter)(nil) + _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil) +) func (i *afUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...) @@ -92,11 +96,13 @@ type afGauge struct { name string opts []metric.Float64ObservableGaugeOption - delegate atomic.Value //metric.Float64ObservableGauge + delegate atomic.Value // metric.Float64ObservableGauge } -var _ unwrapper = (*afGauge)(nil) -var _ metric.Float64ObservableGauge = (*afGauge)(nil) +var ( + _ unwrapper = (*afGauge)(nil) + _ metric.Float64ObservableGauge = (*afGauge)(nil) +) func (i *afGauge) setDelegate(m metric.Meter) { ctr, err := m.Float64ObservableGauge(i.name, i.opts...) @@ -121,11 +127,13 @@ type aiCounter struct { name string opts []metric.Int64ObservableCounterOption - delegate atomic.Value //metric.Int64ObservableCounter + delegate atomic.Value // metric.Int64ObservableCounter } -var _ unwrapper = (*aiCounter)(nil) -var _ metric.Int64ObservableCounter = (*aiCounter)(nil) +var ( + _ unwrapper = (*aiCounter)(nil) + _ metric.Int64ObservableCounter = (*aiCounter)(nil) +) func (i *aiCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableCounter(i.name, i.opts...) @@ -150,11 +158,13 @@ type aiUpDownCounter struct { name string opts []metric.Int64ObservableUpDownCounterOption - delegate atomic.Value //metric.Int64ObservableUpDownCounter + delegate atomic.Value // metric.Int64ObservableUpDownCounter } -var _ unwrapper = (*aiUpDownCounter)(nil) -var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +var ( + _ unwrapper = (*aiUpDownCounter)(nil) + _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil) +) func (i *aiUpDownCounter) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...) @@ -179,11 +189,13 @@ type aiGauge struct { name string opts []metric.Int64ObservableGaugeOption - delegate atomic.Value //metric.Int64ObservableGauge + delegate atomic.Value // metric.Int64ObservableGauge } -var _ unwrapper = (*aiGauge)(nil) -var _ metric.Int64ObservableGauge = (*aiGauge)(nil) +var ( + _ unwrapper = (*aiGauge)(nil) + _ metric.Int64ObservableGauge = (*aiGauge)(nil) +) func (i *aiGauge) setDelegate(m metric.Meter) { ctr, err := m.Int64ObservableGauge(i.name, i.opts...) @@ -208,7 +220,7 @@ type sfCounter struct { name string opts []metric.Float64CounterOption - delegate atomic.Value //metric.Float64Counter + delegate atomic.Value // metric.Float64Counter } var _ metric.Float64Counter = (*sfCounter)(nil) @@ -234,7 +246,7 @@ type sfUpDownCounter struct { name string opts []metric.Float64UpDownCounterOption - delegate atomic.Value //metric.Float64UpDownCounter + delegate atomic.Value // metric.Float64UpDownCounter } var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil) @@ -260,7 +272,7 @@ type sfHistogram struct { name string opts []metric.Float64HistogramOption - delegate atomic.Value //metric.Float64Histogram + delegate atomic.Value // metric.Float64Histogram } var _ metric.Float64Histogram = (*sfHistogram)(nil) @@ -286,7 +298,7 @@ type siCounter struct { name string opts []metric.Int64CounterOption - delegate atomic.Value //metric.Int64Counter + delegate atomic.Value // metric.Int64Counter } var _ metric.Int64Counter = (*siCounter)(nil) @@ -312,7 +324,7 @@ type siUpDownCounter struct { name string opts []metric.Int64UpDownCounterOption - delegate atomic.Value //metric.Int64UpDownCounter + delegate atomic.Value // metric.Int64UpDownCounter } var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil) @@ -338,7 +350,7 @@ type siHistogram struct { name string opts []metric.Int64HistogramOption - delegate atomic.Value //metric.Int64Histogram + delegate atomic.Value // metric.Int64Histogram } var _ metric.Int64Histogram = (*siHistogram)(nil) diff --git a/internal/global/instruments_test.go b/internal/global/instruments_test.go index c0ab914b6c2..7808f77da30 100644 --- a/internal/global/instruments_test.go +++ b/internal/global/instruments_test.go @@ -168,9 +168,11 @@ type testCountingFloatInstrument struct { func (i *testCountingFloatInstrument) observe() { i.count++ } + func (i *testCountingFloatInstrument) Add(context.Context, float64, ...metric.AddOption) { i.count++ } + func (i *testCountingFloatInstrument) Record(context.Context, float64, ...metric.RecordOption) { i.count++ } @@ -190,9 +192,11 @@ type testCountingIntInstrument struct { func (i *testCountingIntInstrument) observe() { i.count++ } + func (i *testCountingIntInstrument) Add(context.Context, int64, ...metric.AddOption) { i.count++ } + func (i *testCountingIntInstrument) Record(context.Context, int64, ...metric.RecordOption) { i.count++ } diff --git a/internal/internaltest/harness.go b/internal/internaltest/harness.go index e84eed9e719..ce8e2035f38 100644 --- a/internal/internaltest/harness.go +++ b/internal/internaltest/harness.go @@ -263,7 +263,7 @@ func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { } func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { - var methods = map[string]func(span trace.Span){ + methods := map[string]func(span trace.Span){ "#End": func(span trace.Span) { span.End() }, @@ -283,7 +283,7 @@ func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) }, } - var mechanisms = map[string]func() trace.Span{ + mechanisms := map[string]func() trace.Span{ "Span created via Tracer#Start": func() trace.Span { tracer := tracerFactory() _, subject := tracer.Start(context.Background(), "test") diff --git a/internal/internaltest/text_map_carrier_test.go b/internal/internaltest/text_map_carrier_test.go index faf713cc2d0..086c8af26ea 100644 --- a/internal/internaltest/text_map_carrier_test.go +++ b/internal/internaltest/text_map_carrier_test.go @@ -22,9 +22,7 @@ import ( "testing" ) -var ( - key, value = "test", "true" -) +var key, value = "test", "true" func TestTextMapCarrierKeys(t *testing.T) { tmc := NewTextMapCarrier(map[string]string{key: value}) diff --git a/internal/matchers/expectation.go b/internal/matchers/expectation.go index 9cf408258b0..f54f63afbb3 100644 --- a/internal/matchers/expectation.go +++ b/internal/matchers/expectation.go @@ -27,9 +27,7 @@ import ( "time" ) -var ( - stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) -) +var stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) type Expectation struct { t *testing.T diff --git a/internal/shared/internaltest/harness.go.tmpl b/internal/shared/internaltest/harness.go.tmpl index da3e7f18615..7223b9d2196 100644 --- a/internal/shared/internaltest/harness.go.tmpl +++ b/internal/shared/internaltest/harness.go.tmpl @@ -263,7 +263,7 @@ func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { } func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { - var methods = map[string]func(span trace.Span){ + methods := map[string]func(span trace.Span){ "#End": func(span trace.Span) { span.End() }, @@ -283,7 +283,7 @@ func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) }, } - var mechanisms = map[string]func() trace.Span{ + mechanisms := map[string]func() trace.Span{ "Span created via Tracer#Start": func() trace.Span { tracer := tracerFactory() _, subject := tracer.Start(context.Background(), "test") diff --git a/internal/shared/internaltest/text_map_carrier_test.go.tmpl b/internal/shared/internaltest/text_map_carrier_test.go.tmpl index faf713cc2d0..086c8af26ea 100644 --- a/internal/shared/internaltest/text_map_carrier_test.go.tmpl +++ b/internal/shared/internaltest/text_map_carrier_test.go.tmpl @@ -22,9 +22,7 @@ import ( "testing" ) -var ( - key, value = "test", "true" -) +var key, value = "test", "true" func TestTextMapCarrierKeys(t *testing.T) { tmc := NewTextMapCarrier(map[string]string{key: value}) diff --git a/internal/shared/matchers/expectation.go.tmpl b/internal/shared/matchers/expectation.go.tmpl index bdde84ea78a..4002fec51f1 100644 --- a/internal/shared/matchers/expectation.go.tmpl +++ b/internal/shared/matchers/expectation.go.tmpl @@ -27,9 +27,7 @@ import ( "time" ) -var ( - stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) -) +var stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) type Expectation struct { t *testing.T diff --git a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl index 16ddfdb7b53..7c52efc51d9 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl @@ -203,7 +203,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Metrics.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl index 6c8be4982e5..37f25c9b468 100644 --- a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl @@ -38,7 +38,7 @@ import ( var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl index b94c48dae8d..676e5785633 100644 --- a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl @@ -40,7 +40,7 @@ type unknownAggT struct { var ( // Sat Jan 01 2000 00:00:00 GMT+0000. - start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0)) + start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0)) end = start.Add(30 * time.Second) alice = attribute.NewSet(attribute.String("user", "alice")) diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl index fcf99f0ad42..b83891a89f6 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl @@ -201,7 +201,7 @@ func TestConfigs(t *testing.T) { }, asserts: func(t *testing.T, c *Config, grpcOption bool) { if grpcOption { - //TODO: make sure gRPC's credentials actually works + // TODO: make sure gRPC's credentials actually works assert.NotNil(t, c.Traces.GRPCCredentials) } else { // nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool. diff --git a/propagation/propagation_test.go b/propagation/propagation_test.go index 488d6551d5b..03fca2ff2d5 100644 --- a/propagation/propagation_test.go +++ b/propagation/propagation_test.go @@ -27,9 +27,7 @@ import ( type ctxKeyType uint -var ( - ctxKey ctxKeyType -) +var ctxKey ctxKeyType type carrier []string diff --git a/propagation/trace_context.go b/propagation/trace_context.go index 902692da082..75a8f3435a5 100644 --- a/propagation/trace_context.go +++ b/propagation/trace_context.go @@ -40,8 +40,10 @@ const ( // their proprietary information. type TraceContext struct{} -var _ TextMapPropagator = TraceContext{} -var traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") +var ( + _ TextMapPropagator = TraceContext{} + traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") +) // Inject set tracecontext from the Context into the carrier. func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { diff --git a/sdk/internal/internaltest/harness.go b/sdk/internal/internaltest/harness.go index f177b0567a9..b2d461ea0d9 100644 --- a/sdk/internal/internaltest/harness.go +++ b/sdk/internal/internaltest/harness.go @@ -263,7 +263,7 @@ func (h *Harness) TestTracer(subjectFactory func() trace.Tracer) { } func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { - var methods = map[string]func(span trace.Span){ + methods := map[string]func(span trace.Span){ "#End": func(span trace.Span) { span.End() }, @@ -283,7 +283,7 @@ func (h *Harness) testSpan(tracerFactory func() trace.Tracer) { span.SetAttributes(attribute.String("key1", "value"), attribute.Int("key2", 123)) }, } - var mechanisms = map[string]func() trace.Span{ + mechanisms := map[string]func() trace.Span{ "Span created via Tracer#Start": func() trace.Span { tracer := tracerFactory() _, subject := tracer.Start(context.Background(), "test") diff --git a/sdk/internal/internaltest/text_map_carrier_test.go b/sdk/internal/internaltest/text_map_carrier_test.go index faf713cc2d0..086c8af26ea 100644 --- a/sdk/internal/internaltest/text_map_carrier_test.go +++ b/sdk/internal/internaltest/text_map_carrier_test.go @@ -22,9 +22,7 @@ import ( "testing" ) -var ( - key, value = "test", "true" -) +var key, value = "test", "true" func TestTextMapCarrierKeys(t *testing.T) { tmc := NewTextMapCarrier(map[string]string{key: value}) diff --git a/sdk/internal/matchers/expectation.go b/sdk/internal/matchers/expectation.go index 84764308651..c48aff036e7 100644 --- a/sdk/internal/matchers/expectation.go +++ b/sdk/internal/matchers/expectation.go @@ -27,9 +27,7 @@ import ( "time" ) -var ( - stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) -) +var stackTracePruneRE = regexp.MustCompile(`runtime\/debug|testing|internal\/matchers`) type Expectation struct { t *testing.T diff --git a/sdk/metric/config_test.go b/sdk/metric/config_test.go index ae7159f2d2e..42bf16a6a96 100644 --- a/sdk/metric/config_test.go +++ b/sdk/metric/config_test.go @@ -47,6 +47,7 @@ func (r *reader) RegisterProducer(p Producer) { r.externalProducers = append(r.e func (r *reader) temporality(kind InstrumentKind) metricdata.Temporality { return r.temporalityFunc(kind) } + func (r *reader) Collect(ctx context.Context, rm *metricdata.ResourceMetrics) error { return r.collectFunc(ctx, rm) } diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index f7224d4b581..bb52f6ec717 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -188,9 +188,11 @@ type int64Inst struct { embedded.Int64Histogram } -var _ metric.Int64Counter = (*int64Inst)(nil) -var _ metric.Int64UpDownCounter = (*int64Inst)(nil) -var _ metric.Int64Histogram = (*int64Inst)(nil) +var ( + _ metric.Int64Counter = (*int64Inst)(nil) + _ metric.Int64UpDownCounter = (*int64Inst)(nil) + _ metric.Int64Histogram = (*int64Inst)(nil) +) func (i *int64Inst) Add(ctx context.Context, val int64, opts ...metric.AddOption) { c := metric.NewAddConfig(opts) @@ -219,9 +221,11 @@ type float64Inst struct { embedded.Float64Histogram } -var _ metric.Float64Counter = (*float64Inst)(nil) -var _ metric.Float64UpDownCounter = (*float64Inst)(nil) -var _ metric.Float64Histogram = (*float64Inst)(nil) +var ( + _ metric.Float64Counter = (*float64Inst)(nil) + _ metric.Float64UpDownCounter = (*float64Inst)(nil) + _ metric.Float64Histogram = (*float64Inst)(nil) +) func (i *float64Inst) Add(ctx context.Context, val float64, opts ...metric.AddOption) { c := metric.NewAddConfig(opts) @@ -260,9 +264,11 @@ type float64Observable struct { embedded.Float64ObservableGauge } -var _ metric.Float64ObservableCounter = float64Observable{} -var _ metric.Float64ObservableUpDownCounter = float64Observable{} -var _ metric.Float64ObservableGauge = float64Observable{} +var ( + _ metric.Float64ObservableCounter = float64Observable{} + _ metric.Float64ObservableUpDownCounter = float64Observable{} + _ metric.Float64ObservableGauge = float64Observable{} +) func newFloat64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable { return float64Observable{ @@ -279,9 +285,11 @@ type int64Observable struct { embedded.Int64ObservableGauge } -var _ metric.Int64ObservableCounter = int64Observable{} -var _ metric.Int64ObservableUpDownCounter = int64Observable{} -var _ metric.Int64ObservableGauge = int64Observable{} +var ( + _ metric.Int64ObservableCounter = int64Observable{} + _ metric.Int64ObservableUpDownCounter = int64Observable{} + _ metric.Int64ObservableGauge = int64Observable{} +) func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable { return int64Observable{ diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index 368f0027ec3..98b7dc1e0fa 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -113,7 +113,7 @@ func (p *expoHistogramDataPoint[N]) record(v N) { otel.Handle(errors.New("exponential histogram scale underflow")) return } - //Downscale + // Downscale p.scale -= scaleDelta p.posBuckets.downscale(scaleDelta) p.negBuckets.downscale(scaleDelta) diff --git a/sdk/metric/manual_reader_test.go b/sdk/metric/manual_reader_test.go index 210a66c1bbe..a2a1476fa83 100644 --- a/sdk/metric/manual_reader_test.go +++ b/sdk/metric/manual_reader_test.go @@ -40,8 +40,10 @@ func BenchmarkManualReader(b *testing.B) { b.Run("Collect", benchReaderCollectFunc(NewManualReader())) } -var deltaTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } -var cumulativeTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } +var ( + deltaTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.DeltaTemporality } + cumulativeTemporalitySelector = func(InstrumentKind) metricdata.Temporality { return metricdata.CumulativeTemporality } +) func TestManualReaderTemporality(t *testing.T) { tests := []struct { diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index e5ec1ad4675..0c17dfb20a5 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -26,11 +26,9 @@ import ( "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) -var ( - // ErrInstrumentName indicates the created instrument has an invalid name. - // Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, / and start with a letter. - ErrInstrumentName = errors.New("invalid instrument name") -) +// ErrInstrumentName indicates the created instrument has an invalid name. +// Valid names must consist of 255 or fewer characters including alphanumeric, _, ., -, / and start with a letter. +var ErrInstrumentName = errors.New("invalid instrument name") // meter handles the creation and coordination of all metric instruments. A // meter represents a single instrumentation scope; all metric telemetry @@ -268,9 +266,11 @@ func validateInstrumentName(name string) error { } return nil } + func isAlpha(c rune) bool { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') } + func isAlphanumeric(c rune) bool { return isAlpha(c) || ('0' <= c && c <= '9') } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 34a95ab7026..e2b2a5938fd 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1826,12 +1826,15 @@ func BenchmarkInstrumentCreation(b *testing.B) { func testNilAggregationSelector(InstrumentKind) Aggregation { return nil } + func testDefaultAggregationSelector(InstrumentKind) Aggregation { return AggregationDefault{} } + func testUndefinedTemporalitySelector(InstrumentKind) metricdata.Temporality { return metricdata.Temporality(0) } + func testInvalidTemporalitySelector(InstrumentKind) metricdata.Temporality { return metricdata.Temporality(255) } diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index 5cdca6fe2c6..bb74c4a1217 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -741,6 +741,7 @@ func hasAttributesScopeMetrics(sm metricdata.ScopeMetrics, attrs ...attribute.Ke } return reasons } + func hasAttributesResourceMetrics(rm metricdata.ResourceMetrics, attrs ...attribute.KeyValue) (reasons []string) { for n, sm := range rm.ScopeMetrics { reas := hasAttributesScopeMetrics(sm, attrs...) diff --git a/sdk/metric/periodic_reader.go b/sdk/metric/periodic_reader.go index 2a85456102a..ff86999c759 100644 --- a/sdk/metric/periodic_reader.go +++ b/sdk/metric/periodic_reader.go @@ -127,7 +127,8 @@ func NewPeriodicReader(exporter Exporter, options ...PeriodicReaderOption) *Peri rmPool: sync.Pool{ New: func() interface{} { return &metricdata.ResourceMetrics{} - }}, + }, + }, } r.externalProducers.Store(conf.producers) diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 2f055796dd1..81cbd11493e 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -344,7 +344,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return ctx.Err() } return nil - }}) + }, + }) assert.ErrorIs(t, r.ForceFlush(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") @@ -396,7 +397,8 @@ func TestPeriodicReaderFlushesPending(t *testing.T) { return ctx.Err() } return nil - }}) + }, + }) assert.ErrorIs(t, r.Shutdown(context.Background()), context.DeadlineExceeded) assert.False(t, *called, "exporter Export method called when it should have failed before export") }) diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index 89293e679e4..b0832a87f52 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -39,6 +39,7 @@ type invalidAggregation struct{} func (invalidAggregation) copy() Aggregation { return invalidAggregation{} } + func (invalidAggregation) err() error { return nil } @@ -155,7 +156,7 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { ) instruments := []Instrument{ - {Name: "foo", Kind: InstrumentKind(0)}, //Unknown kind + {Name: "foo", Kind: InstrumentKind(0)}, // Unknown kind {Name: "foo", Kind: InstrumentKindCounter}, {Name: "foo", Kind: InstrumentKindUpDownCounter}, {Name: "foo", Kind: InstrumentKindHistogram}, diff --git a/sdk/metric/reader_test.go b/sdk/metric/reader_test.go index a1e9e507b9d..48d36155ec6 100644 --- a/sdk/metric/reader_test.go +++ b/sdk/metric/reader_test.go @@ -138,7 +138,8 @@ func (ts *readerTestSuite) TestSDKFailureBlocksExternalProducer() { produceFunc: func(ctx context.Context, rm *metricdata.ResourceMetrics) error { *rm = metricdata.ResourceMetrics{} return assert.AnError - }}) + }, + }) m := metricdata.ResourceMetrics{} err := ts.Reader.Collect(context.Background(), &m) diff --git a/sdk/resource/auto.go b/sdk/resource/auto.go index 324dd4baf24..4279013be88 100644 --- a/sdk/resource/auto.go +++ b/sdk/resource/auto.go @@ -21,12 +21,10 @@ import ( "strings" ) -var ( - // ErrPartialResource is returned by a detector when complete source - // information for a Resource is unavailable or the source information - // contains invalid values that are omitted from the returned Resource. - ErrPartialResource = errors.New("partial resource") -) +// ErrPartialResource is returned by a detector when complete source +// information for a Resource is unavailable or the source information +// contains invalid values that are omitted from the returned Resource. +var ErrPartialResource = errors.New("partial resource") // Detector detects OpenTelemetry resource information. type Detector interface { diff --git a/sdk/resource/benchmark_test.go b/sdk/resource/benchmark_test.go index ea72c5a2186..c43e7a6b8be 100644 --- a/sdk/resource/benchmark_test.go +++ b/sdk/resource/benchmark_test.go @@ -63,21 +63,27 @@ func benchmarkMergeResource(b *testing.B, size int) { func BenchmarkMergeResource_1(b *testing.B) { benchmarkMergeResource(b, 1) } + func BenchmarkMergeResource_2(b *testing.B) { benchmarkMergeResource(b, 2) } + func BenchmarkMergeResource_3(b *testing.B) { benchmarkMergeResource(b, 3) } + func BenchmarkMergeResource_4(b *testing.B) { benchmarkMergeResource(b, 4) } + func BenchmarkMergeResource_6(b *testing.B) { benchmarkMergeResource(b, 6) } + func BenchmarkMergeResource_8(b *testing.B) { benchmarkMergeResource(b, 8) } + func BenchmarkMergeResource_16(b *testing.B) { benchmarkMergeResource(b, 16) } diff --git a/sdk/resource/env.go b/sdk/resource/env.go index a847c50622e..606d5500f26 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -34,10 +34,8 @@ const ( svcNameKey = "OTEL_SERVICE_NAME" ) -var ( - // errMissingValue is returned when a resource value is missing. - errMissingValue = fmt.Errorf("%w: missing value", ErrPartialResource) -) +// errMissingValue is returned when a resource value is missing. +var errMissingValue = fmt.Errorf("%w: missing value", ErrPartialResource) // fromEnv is a Detector that implements the Detector and collects // resources from environment. This Detector is included as a diff --git a/sdk/resource/export_test.go b/sdk/resource/export_test.go index 6c767e595c5..8003e3ec997 100644 --- a/sdk/resource/export_test.go +++ b/sdk/resource/export_test.go @@ -34,6 +34,4 @@ var ( RuntimeArch = runtimeArch ) -var ( - MapRuntimeOSToSemconvOSType = mapRuntimeOSToSemconvOSType -) +var MapRuntimeOSToSemconvOSType = mapRuntimeOSToSemconvOSType diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 84e1c585605..0cbd559739c 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -36,8 +36,10 @@ func setOSDescriptionProvider(osDescriptionProvider osDescriptionProvider) { osDescription = osDescriptionProvider } -type osTypeDetector struct{} -type osDescriptionDetector struct{} +type ( + osTypeDetector struct{} + osDescriptionDetector struct{} +) // Detect returns a *Resource that describes the operating system type the // service is running on. @@ -56,7 +58,6 @@ func (osTypeDetector) Detect(ctx context.Context) (*Resource, error) { // service is running on. func (osDescriptionDetector) Detect(ctx context.Context) (*Resource, error) { description, err := osDescription() - if err != nil { return nil, err } diff --git a/sdk/resource/process.go b/sdk/resource/process.go index e67ff29e26d..ecdd11dd762 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -25,14 +25,16 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.21.0" ) -type pidProvider func() int -type executablePathProvider func() (string, error) -type commandArgsProvider func() []string -type ownerProvider func() (*user.User, error) -type runtimeNameProvider func() string -type runtimeVersionProvider func() string -type runtimeOSProvider func() string -type runtimeArchProvider func() string +type ( + pidProvider func() int + executablePathProvider func() (string, error) + commandArgsProvider func() []string + ownerProvider func() (*user.User, error) + runtimeNameProvider func() string + runtimeVersionProvider func() string + runtimeOSProvider func() string + runtimeArchProvider func() string +) var ( defaultPidProvider pidProvider = os.Getpid @@ -108,14 +110,16 @@ func setUserProviders(ownerProvider ownerProvider) { owner = ownerProvider } -type processPIDDetector struct{} -type processExecutableNameDetector struct{} -type processExecutablePathDetector struct{} -type processCommandArgsDetector struct{} -type processOwnerDetector struct{} -type processRuntimeNameDetector struct{} -type processRuntimeVersionDetector struct{} -type processRuntimeDescriptionDetector struct{} +type ( + processPIDDetector struct{} + processExecutableNameDetector struct{} + processExecutablePathDetector struct{} + processCommandArgsDetector struct{} + processOwnerDetector struct{} + processRuntimeNameDetector struct{} + processRuntimeVersionDetector struct{} + processRuntimeDescriptionDetector struct{} +) // Detect returns a *Resource that describes the process identifier (PID) of the // executing process. diff --git a/sdk/trace/benchmark_test.go b/sdk/trace/benchmark_test.go index b7dde8d96b0..e0172fd1d8c 100644 --- a/sdk/trace/benchmark_test.go +++ b/sdk/trace/benchmark_test.go @@ -285,6 +285,7 @@ func BenchmarkSpanWithEvents_WithStackTrace(b *testing.B) { } }) } + func BenchmarkSpanWithEvents_WithTimestamp(b *testing.B) { traceBenchmark(b, "Benchmark Start With 4 Attributes", func(b *testing.B, t trace.Tracer) { ctx := context.Background() diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 37cdd4a694a..68ac1b01616 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -158,8 +158,10 @@ type recordingSpan struct { tracer *tracer } -var _ ReadWriteSpan = (*recordingSpan)(nil) -var _ runtimeTracer = (*recordingSpan)(nil) +var ( + _ ReadWriteSpan = (*recordingSpan)(nil) + _ runtimeTracer = (*recordingSpan)(nil) +) // SpanContext returns the SpanContext of this span. func (s *recordingSpan) SpanContext() trace.SpanContext { diff --git a/sdk/trace/span_processor_filter_example_test.go b/sdk/trace/span_processor_filter_example_test.go index f5dd84e472a..e0ce9e0d86f 100644 --- a/sdk/trace/span_processor_filter_example_test.go +++ b/sdk/trace/span_processor_filter_example_test.go @@ -66,6 +66,7 @@ func (f InstrumentationBlacklist) Shutdown(ctx context.Context) error { return f func (f InstrumentationBlacklist) ForceFlush(ctx context.Context) error { return f.Next.ForceFlush(ctx) } + func (f InstrumentationBlacklist) OnEnd(s ReadOnlySpan) { if f.Blacklist != nil && f.Blacklist[s.InstrumentationScope().Name] { // Drop spans from this instrumentation diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 56f53d4d2d0..5ad35314192 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1407,7 +1407,8 @@ func TestWithResource(t *testing.T) { name: "last resource wins", options: []TracerProviderOption{ WithResource(resource.NewSchemaless(attribute.String("rk1", "vk1"), attribute.Int64("rk2", 5))), - WithResource(resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10)))}, + WithResource(resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10))), + }, want: mergeResource(t, resource.Environment(), resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10))), }, { diff --git a/sdk/trace/tracetest/span.go b/sdk/trace/tracetest/span.go index bfe73de9c41..ae8eae8e8be 100644 --- a/sdk/trace/tracetest/span.go +++ b/sdk/trace/tracetest/span.go @@ -162,6 +162,7 @@ func (s spanSnapshot) Resource() *resource.Resource { return s.resource } func (s spanSnapshot) InstrumentationScope() instrumentation.Scope { return s.instrumentationScope } + func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library { return s.instrumentationScope } diff --git a/trace/config.go b/trace/config.go index cb3efbb9ad8..3aadc66cf7a 100644 --- a/trace/config.go +++ b/trace/config.go @@ -268,6 +268,7 @@ func (o stackTraceOption) applyEvent(c EventConfig) EventConfig { c.stackTrace = bool(o) return c } + func (o stackTraceOption) applySpan(c SpanConfig) SpanConfig { c.stackTrace = bool(o) return c diff --git a/trace/trace.go b/trace/trace.go index 4aa94f79f46..d3195558761 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -48,8 +48,10 @@ func (e errorConst) Error() string { // nolint:revive // revive complains about stutter of `trace.TraceID`. type TraceID [16]byte -var nilTraceID TraceID -var _ json.Marshaler = nilTraceID +var ( + nilTraceID TraceID + _ json.Marshaler = nilTraceID +) // IsValid checks whether the trace TraceID is valid. A valid trace ID does // not consist of zeros only. @@ -71,8 +73,10 @@ func (t TraceID) String() string { // SpanID is a unique identity of a span in a trace. type SpanID [8]byte -var nilSpanID SpanID -var _ json.Marshaler = nilSpanID +var ( + nilSpanID SpanID + _ json.Marshaler = nilSpanID +) // IsValid checks whether the SpanID is valid. A valid SpanID does not consist // of zeros only. diff --git a/trace/trace_test.go b/trace/trace_test.go index 42003822037..9bde9d8c79b 100644 --- a/trace/trace_test.go +++ b/trace/trace_test.go @@ -309,7 +309,7 @@ func TestSpanContextHasTraceID(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //proto: func (sc SpanContext) HasTraceID() bool{} + // proto: func (sc SpanContext) HasTraceID() bool{} sc := SpanContext{traceID: testcase.tid} have := sc.HasTraceID() if have != testcase.want { @@ -336,7 +336,7 @@ func TestSpanContextHasSpanID(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //proto: func (sc SpanContext) HasSpanID() bool {} + // proto: func (sc SpanContext) HasSpanID() bool {} have := testcase.sc.HasSpanID() if have != testcase.want { t.Errorf("Want: %v, but have: %v", testcase.want, have) @@ -435,7 +435,7 @@ func TestStringTraceID(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //proto: func (t TraceID) String() string {} + // proto: func (t TraceID) String() string {} have := testcase.tid.String() if have != testcase.want { t.Errorf("Want: %s, but have: %s", testcase.want, have) @@ -462,7 +462,7 @@ func TestStringSpanID(t *testing.T) { }, } { t.Run(testcase.name, func(t *testing.T) { - //proto: func (t TraceID) String() string {} + // proto: func (t TraceID) String() string {} have := testcase.sid.String() if have != testcase.want { t.Errorf("Want: %s, but have: %s", testcase.want, have) @@ -481,17 +481,14 @@ func TestValidateSpanKind(t *testing.T) { SpanKindInternal, }, { - SpanKindInternal, SpanKindInternal, }, { - SpanKindServer, SpanKindServer, }, { - SpanKindClient, SpanKindClient, }, @@ -521,17 +518,14 @@ func TestSpanKindString(t *testing.T) { "unspecified", }, { - SpanKindInternal, "internal", }, { - SpanKindServer, "server", }, { - SpanKindClient, "client", }, diff --git a/trace/tracestate_test.go b/trace/tracestate_test.go index 784c1589219..cd6536e6ad1 100644 --- a/trace/tracestate_test.go +++ b/trace/tracestate_test.go @@ -495,7 +495,8 @@ func TestTraceStateInsert(t *testing.T) { ), } }(), - }} + }, + } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { From 78ea0014422f1d6a04b9f180f6d8ba345cb061d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 18 Oct 2023 08:14:16 +0200 Subject: [PATCH 736/886] [chore] Use tilde range to specify Go version (#4643) --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/dependabot.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 927a0ae123e..5eab8d039ba 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - DEFAULT_GO_VERSION: "1.21" + DEFAULT_GO_VERSION: "~1.21.3" jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b74158d4be0..eb8c715f642 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "1.21" + DEFAULT_GO_VERSION: "~1.21.3" jobs: lint: runs-on: ubuntu-latest @@ -106,7 +106,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["1.21", "1.20"] + go-version: ["~1.21.3", "~1.20.10"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 12af146fa52..3d47df56ab1 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -10,7 +10,7 @@ jobs: - name: Install Go uses: actions/setup-go@v4 with: - go-version: "1.21" + go-version: "~1.21.3" check-latest: true cache-dependency-path: "**/go.sum" diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index d5a92565362..c74d60f1638 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - uses: actions/setup-go@v4 with: - go-version: "1.21" + go-version: "~1.21.3" check-latest: true cache-dependency-path: "**/go.sum" - uses: evantorrie/mott-the-tidier@v1-beta From 5b2892194006e1e19e49f63148ca840ed045d2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 19 Oct 2023 08:47:07 +0200 Subject: [PATCH 737/886] [chore] Add gosec via golangci-lint (#4645) --- .github/workflows/gosec.yml | 27 ------------------- .golangci.yml | 15 +++++++++++ example/prometheus/main.go | 2 +- example/view/main.go | 2 +- .../internal/otest/collector.go | 6 ++++- .../internal/otest/collector.go | 6 ++++- .../otlptracehttp/mock_collector_test.go | 5 +++- exporters/zipkin/zipkin_test.go | 4 ++- .../otlp/otlpmetric/otest/collector.go.tmpl | 6 ++++- sdk/resource/env.go | 2 +- 10 files changed, 40 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/gosec.yml diff --git a/.github/workflows/gosec.yml b/.github/workflows/gosec.yml deleted file mode 100644 index 2747e0afa59..00000000000 --- a/.github/workflows/gosec.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Run Gosec -on: - workflow_dispatch: - schedule: - # ┌───────────── minute (0 - 59) - # │ ┌───────────── hour (0 - 23) - # │ │ ┌───────────── day of the month (1 - 31) - # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) - # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) - # │ │ │ │ │ - # │ │ │ │ │ - # │ │ │ │ │ - # * * * * * - - cron: '30 2 * * *' -jobs: - tests: - runs-on: ubuntu-latest - env: - GO111MODULE: on - steps: - - name: Checkout Source - uses: actions/checkout@v4 - - name: Run Gosec Security Scanner - uses: securego/gosec@master - with: - args: ./... - diff --git a/.golangci.yml b/.golangci.yml index 7121593d5d2..a62511f382e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -14,6 +14,7 @@ linters: - godot - gofumpt - goimports + - gosec - gosimple - govet - ineffassign @@ -53,6 +54,20 @@ issues: text: "calls to (.+) only in main[(][)] or init[(][)] functions" linters: - revive + # It's okay to not run gosec in a test. + - path: _test\.go + linters: + - gosec + # Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand) + # as we commonly use it in tests and examples. + - text: "G404:" + linters: + - gosec + # Igonoring gosec G402: TLS MinVersion too low + # as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well. + - text: "G402: TLS MinVersion too low." + linters: + - gosec include: # revive exported should have comment or be unexported. - EXC0012 diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 3c7e4db7976..fee550de6d0 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -91,7 +91,7 @@ func main() { func serveMetrics() { log.Printf("serving metrics at localhost:2223/metrics") http.Handle("/metrics", promhttp.Handler()) - err := http.ListenAndServe(":2223", nil) + err := http.ListenAndServe(":2223", nil) //nolint:gosec // Ignoring G114: Use of net/http serve function that has no support for setting timeouts. if err != nil { fmt.Printf("error serving http: %v", err) return diff --git a/example/view/main.go b/example/view/main.go index 712e325301e..876457052b9 100644 --- a/example/view/main.go +++ b/example/view/main.go @@ -90,7 +90,7 @@ func main() { func serveMetrics() { log.Printf("serving metrics at localhost:2222/metrics") http.Handle("/metrics", promhttp.Handler()) - err := http.ListenAndServe(":2222", nil) + err := http.ListenAndServe(":2222", nil) //nolint:gosec // Ignoring G114: Use of net/http serve function that has no support for setting timeouts. if err != nil { fmt.Printf("error serving http: %v", err) return diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go index f5eb0a4af9c..c96ca1fda6e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go @@ -242,7 +242,11 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle mux := http.NewServeMux() mux.Handle(u.Path, http.HandlerFunc(c.handler)) - c.srv = &http.Server{Handler: mux} + c.srv = &http.Server{ + Handler: mux, + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, + } if u.Scheme == "https" { cert, err := weakCertificate() if err != nil { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go index 0b6b9387167..503eba65bea 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go @@ -242,7 +242,11 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle mux := http.NewServeMux() mux.Handle(u.Path, http.HandlerFunc(c.handler)) - c.srv = &http.Server{Handler: mux} + c.srv = &http.Server{ + Handler: mux, + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, + } if u.Scheme == "https" { cert, err := weakCertificate() if err != nil { diff --git a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go index 919a15fa4df..2b87215d183 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/mock_collector_test.go @@ -25,6 +25,7 @@ import ( "net/http" "sync" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -241,7 +242,9 @@ func runMockCollector(t *testing.T, cfg mockCollectorConfig) *mockCollector { mux := http.NewServeMux() mux.Handle(cfg.TracesURLPath, http.HandlerFunc(m.serveTraces)) server := &http.Server{ - Handler: mux, + Handler: mux, + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, } if cfg.WithTLS { pem, err := generateWeakCertificate() diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index cc90b5f789d..ad720a042b2 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -120,7 +120,9 @@ func startMockZipkinCollector(t *testing.T) *mockZipkinCollector { require.NoError(t, err) collector.url = fmt.Sprintf("http://%s", listener.Addr().String()) server := &http.Server{ - Handler: http.HandlerFunc(collector.handler), + Handler: http.HandlerFunc(collector.handler), + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, } collector.server = server wg := &sync.WaitGroup{} diff --git a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl index 31fc32224b9..1adf55807a5 100644 --- a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl @@ -242,7 +242,11 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle mux := http.NewServeMux() mux.Handle(u.Path, http.HandlerFunc(c.handler)) - c.srv = &http.Server{Handler: mux} + c.srv = &http.Server{ + Handler: mux, + ReadTimeout: 10 * time.Second, + WriteTimeout: 10 * time.Second, + } if u.Scheme == "https" { cert, err := weakCertificate() if err != nil { diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 606d5500f26..7e49ed58116 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -28,7 +28,7 @@ import ( const ( // resourceAttrKey is the environment variable name OpenTelemetry Resource information will be read from. - resourceAttrKey = "OTEL_RESOURCE_ATTRIBUTES" + resourceAttrKey = "OTEL_RESOURCE_ATTRIBUTES" //nolint:gosec // False positive G101: Potential hardcoded credentials // svcNameKey is the environment variable name that Service Name information will be read from. svcNameKey = "OTEL_SERVICE_NAME" From da343ab9c5fe8e50be0af9c222f541620e909698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 19 Oct 2023 09:42:52 +0200 Subject: [PATCH 738/886] example/dice: Add context propagation (#4644) --- CHANGELOG.md | 1 + example/dice/otel.go | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1afb77faff8..58f1514f06d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) - Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) +- Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) ### Deprecated diff --git a/example/dice/otel.go b/example/dice/otel.go index 8612352d959..9c4f9fe8c42 100644 --- a/example/dice/otel.go +++ b/example/dice/otel.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" + "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" @@ -50,14 +51,18 @@ func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shut err = errors.Join(inErr, shutdown(ctx)) } - // Setup resource. + // Set up resource. res, err := newResource(serviceName, serviceVersion) if err != nil { handleErr(err) return } - // Setup trace provider. + // Set up propagator. + prop := newPropagator() + otel.SetTextMapPropagator(prop) + + // Set up trace provider. tracerProvider, err := newTraceProvider(res) if err != nil { handleErr(err) @@ -66,7 +71,7 @@ func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shut shutdownFuncs = append(shutdownFuncs, tracerProvider.Shutdown) otel.SetTracerProvider(tracerProvider) - // Setup meter provider. + // Set up meter provider. meterProvider, err := newMeterProvider(res) if err != nil { handleErr(err) @@ -86,6 +91,13 @@ func newResource(serviceName, serviceVersion string) (*resource.Resource, error) )) } +func newPropagator() propagation.TextMapPropagator { + return propagation.NewCompositeTextMapPropagator( + propagation.TraceContext{}, + propagation.Baggage{}, + ) +} + func newTraceProvider(res *resource.Resource) (*trace.TracerProvider, error) { traceExporter, err := stdouttrace.New( stdouttrace.WithPrettyPrint()) From 1e1cc901a561d44b9e22f39a3d8f27c08232f897 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 19 Oct 2023 10:16:24 -0700 Subject: [PATCH 739/886] Add embedded package to trace API (#4620) * Add trace/embedded * Update trace impl to use trace/embedded * Add noop pkg to replace no-op impl in trace pkg * Use trace/embedded in global impl * Use trace/embedded in SDK impl * Update opencensus bridge * Update opentracing bridge * Add changes to changelog * Update trace/doc.go Co-authored-by: David Ashpole --------- Co-authored-by: David Ashpole --- CHANGELOG.md | 16 +++ bridge/opencensus/config_test.go | 6 +- bridge/opencensus/internal/tracer_test.go | 20 ++-- bridge/opentracing/bridge.go | 3 +- bridge/opentracing/internal/mock.go | 8 +- bridge/opentracing/provider.go | 3 + bridge/opentracing/provider_test.go | 3 +- bridge/opentracing/wrapper.go | 5 + internal/global/state_test.go | 11 +- internal/global/trace.go | 7 ++ internal/global/trace_test.go | 16 ++- sdk/trace/provider.go | 8 +- sdk/trace/span.go | 5 + sdk/trace/tracer.go | 3 + trace/doc.go | 64 ++++++++++++ trace/embedded/embedded.go | 56 ++++++++++ trace/noop.go | 10 +- trace/noop/noop.go | 118 ++++++++++++++++++++++ trace/noop/noop_test.go | 117 +++++++++++++++++++++ trace/trace.go | 28 ++++- trace_test.go | 8 +- 21 files changed, 480 insertions(+), 35 deletions(-) create mode 100644 trace/embedded/embedded.go create mode 100644 trace/noop/noop.go create mode 100644 trace/noop/noop_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 58f1514f06d..2bb7a96733e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,16 +12,32 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) - Add scope version to trace and metric bridges in `go.opentelemetry.io/otel/bridge/opencensus`. (#4584) +- Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) +- Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) - Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) ### Deprecated - Deprecate `go.opentelemetry.io/otel/bridge/opencensus.NewTracer` in favor of `opencensus.InstallTraceBridge`. (#4567) - Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) +- Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. + Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) ### Changed - `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583) +- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. + This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) +- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. + This extends the `Tracer` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) +- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. + This extends the `Span` interface and is is a breaking change for any existing implementation. + Implementors need to update their implementations based on what they want the default behavior of the interface to be. + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) ## [1.19.0/0.42.0/0.0.7] 2023-09-28 diff --git a/bridge/opencensus/config_test.go b/bridge/opencensus/config_test.go index bad2dab8019..5a2011f0c98 100644 --- a/bridge/opencensus/config_test.go +++ b/bridge/opencensus/config_test.go @@ -20,12 +20,12 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" ) func TestNewTraceConfig(t *testing.T) { - globalTP := trace.NewNoopTracerProvider() - customTP := trace.NewNoopTracerProvider() + globalTP := noop.NewTracerProvider() + customTP := noop.NewTracerProvider() otel.SetTracerProvider(globalTP) for _, tc := range []struct { desc string diff --git a/bridge/opencensus/internal/tracer_test.go b/bridge/opencensus/internal/tracer_test.go index 1e3518a7efe..618a7b81567 100644 --- a/bridge/opencensus/internal/tracer_test.go +++ b/bridge/opencensus/internal/tracer_test.go @@ -24,6 +24,8 @@ import ( "go.opentelemetry.io/otel/bridge/opencensus/internal/oc2otel" "go.opentelemetry.io/otel/bridge/opencensus/internal/otel2oc" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) type handler struct{ err error } @@ -38,6 +40,8 @@ func withHandler() (*handler, func()) { } type tracer struct { + embedded.Tracer + ctx context.Context name string opts []trace.SpanStartOption @@ -45,8 +49,8 @@ type tracer struct { func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span) { t.ctx, t.name, t.opts = ctx, name, opts - noop := trace.NewNoopTracerProvider().Tracer("testing") - return noop.Start(ctx, name, opts...) + sub := noop.NewTracerProvider().Tracer("testing") + return sub.Start(ctx, name, opts...) } type ctxKey string @@ -110,11 +114,11 @@ func TestTracerFromContext(t *testing.T) { }) ctx := trace.ContextWithSpanContext(context.Background(), sc) - noop := trace.NewNoopTracerProvider().Tracer("TestTracerFromContext") + tracer := noop.NewTracerProvider().Tracer("TestTracerFromContext") // Test using the fact that the No-Op span will propagate a span context . - ctx, _ = noop.Start(ctx, "test") + ctx, _ = tracer.Start(ctx, "test") - got := internal.NewTracer(noop).FromContext(ctx).SpanContext() + got := internal.NewTracer(tracer).FromContext(ctx).SpanContext() // Do not test the convedsion, only that the propagtion. want := otel2oc.SpanContext(sc) if got != want { @@ -129,11 +133,11 @@ func TestTracerNewContext(t *testing.T) { }) ctx := trace.ContextWithSpanContext(context.Background(), sc) - noop := trace.NewNoopTracerProvider().Tracer("TestTracerNewContext") + tracer := noop.NewTracerProvider().Tracer("TestTracerNewContext") // Test using the fact that the No-Op span will propagate a span context . - _, s := noop.Start(ctx, "test") + _, s := tracer.Start(ctx, "test") - ocTracer := internal.NewTracer(noop) + ocTracer := internal.NewTracer(tracer) ctx = ocTracer.NewContext(context.Background(), internal.NewSpan(s)) got := trace.SpanContextFromContext(ctx) diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index 7dc81f56a32..cc3d7d19c7f 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -33,10 +33,11 @@ import ( iBaggage "go.opentelemetry.io/otel/internal/baggage" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/noop" ) var ( - noopTracer = trace.NewNoopTracerProvider().Tracer("") + noopTracer = noop.NewTracerProvider().Tracer("") noopSpan = func() trace.Span { _, s := noopTracer.Start(context.Background(), "") return s diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index e9d90750a39..d3a8d91a30a 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -26,6 +26,8 @@ import ( "go.opentelemetry.io/otel/codes" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) //nolint:revive // ignoring missing comments for unexported global variables in an internal package. @@ -44,6 +46,8 @@ type MockContextKeyValue struct { } type MockTracer struct { + embedded.Tracer + FinishedSpans []*MockSpan SpareTraceIDs []trace.TraceID SpareSpanIDs []trace.SpanID @@ -184,6 +188,8 @@ type MockEvent struct { } type MockSpan struct { + embedded.Span + mockTracer *MockTracer officialTracer trace.Tracer spanContext trace.SpanContext @@ -295,4 +301,4 @@ func (s *MockSpan) OverrideTracer(tracer trace.Tracer) { s.officialTracer = tracer } -func (s *MockSpan) TracerProvider() trace.TracerProvider { return trace.NewNoopTracerProvider() } +func (s *MockSpan) TracerProvider() trace.TracerProvider { return noop.NewTracerProvider() } diff --git a/bridge/opentracing/provider.go b/bridge/opentracing/provider.go index 941e277baf8..90bad0bd516 100644 --- a/bridge/opentracing/provider.go +++ b/bridge/opentracing/provider.go @@ -18,11 +18,14 @@ import ( "sync" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // TracerProvider is an OpenTelemetry TracerProvider that wraps an OpenTracing // Tracer. type TracerProvider struct { + embedded.TracerProvider + bridge *BridgeTracer provider trace.TracerProvider diff --git a/bridge/opentracing/provider_test.go b/bridge/opentracing/provider_test.go index 8af3796e031..1a4dd5ca5b5 100644 --- a/bridge/opentracing/provider_test.go +++ b/bridge/opentracing/provider_test.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/otel/bridge/opentracing/internal" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) type namedMockTracer struct { @@ -26,7 +27,7 @@ type namedMockTracer struct { *internal.MockTracer } -type namedMockTracerProvider struct{} +type namedMockTracerProvider struct{ embedded.TracerProvider } var _ trace.TracerProvider = (*namedMockTracerProvider)(nil) diff --git a/bridge/opentracing/wrapper.go b/bridge/opentracing/wrapper.go index c251f8e2c19..1e065e3bc62 100644 --- a/bridge/opentracing/wrapper.go +++ b/bridge/opentracing/wrapper.go @@ -19,6 +19,7 @@ import ( "go.opentelemetry.io/otel/bridge/opentracing/migration" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // WrapperTracerProvider is an OpenTelemetry TracerProvider that wraps an @@ -26,6 +27,8 @@ import ( // // Deprecated: Use the TracerProvider from NewTracerProvider(...) instead. type WrapperTracerProvider struct { + embedded.TracerProvider + wTracer *WrapperTracer } @@ -56,6 +59,8 @@ func NewWrappedTracerProvider(bridge *BridgeTracer, tracer trace.Tracer) *Wrappe // aware how to operate in environment where OpenTracing API is also // used. type WrapperTracer struct { + embedded.Tracer + bridge *BridgeTracer tracer trace.Tracer } diff --git a/internal/global/state_test.go b/internal/global/state_test.go index 93bf6b8aae2..5a049edfeed 100644 --- a/internal/global/state_test.go +++ b/internal/global/state_test.go @@ -20,9 +20,10 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + metricnoop "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" + tracenoop "go.opentelemetry.io/otel/trace/noop" ) type nonComparableTracerProvider struct { @@ -55,7 +56,7 @@ func TestSetTracerProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { ResetForTest(t) - SetTracerProvider(trace.NewNoopTracerProvider()) + SetTracerProvider(tracenoop.NewTracerProvider()) _, ok := TracerProvider().(*tracerProvider) if ok { @@ -67,7 +68,7 @@ func TestSetTracerProvider(t *testing.T) { ResetForTest(t) tp := TracerProvider() - SetTracerProvider(trace.NewNoopTracerProvider()) + SetTracerProvider(tracenoop.NewTracerProvider()) ntp := tp.(*tracerProvider) @@ -153,7 +154,7 @@ func TestSetMeterProvider(t *testing.T) { t.Run("First Set() should replace the delegate", func(t *testing.T) { ResetForTest(t) - SetMeterProvider(noop.NewMeterProvider()) + SetMeterProvider(metricnoop.NewMeterProvider()) _, ok := MeterProvider().(*meterProvider) if ok { @@ -166,7 +167,7 @@ func TestSetMeterProvider(t *testing.T) { mp := MeterProvider() - SetMeterProvider(noop.NewMeterProvider()) + SetMeterProvider(metricnoop.NewMeterProvider()) dmp := mp.(*meterProvider) diff --git a/internal/global/trace.go b/internal/global/trace.go index 5f008d0982b..3f61ec12a34 100644 --- a/internal/global/trace.go +++ b/internal/global/trace.go @@ -39,6 +39,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // tracerProvider is a placeholder for a configured SDK TracerProvider. @@ -46,6 +47,8 @@ import ( // All TracerProvider functionality is forwarded to a delegate once // configured. type tracerProvider struct { + embedded.TracerProvider + mtx sync.Mutex tracers map[il]*tracer delegate trace.TracerProvider @@ -119,6 +122,8 @@ type il struct { // All Tracer functionality is forwarded to a delegate once configured. // Otherwise, all functionality is forwarded to a NoopTracer. type tracer struct { + embedded.Tracer + name string opts []trace.TracerOption provider *tracerProvider @@ -156,6 +161,8 @@ func (t *tracer) Start(ctx context.Context, name string, opts ...trace.SpanStart // SpanContext. It performs no operations other than to return the wrapped // SpanContext. type nonRecordingSpan struct { + embedded.Span + sc trace.SpanContext tracer *tracer } diff --git a/internal/global/trace_test.go b/internal/global/trace_test.go index f8f9149d9e0..d9807493854 100644 --- a/internal/global/trace_test.go +++ b/internal/global/trace_test.go @@ -23,9 +23,13 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) type fnTracerProvider struct { + embedded.TracerProvider + tracer func(string, ...trace.TracerOption) trace.Tracer } @@ -34,6 +38,8 @@ func (fn fnTracerProvider) Tracer(instrumentationName string, opts ...trace.Trac } type fnTracer struct { + embedded.Tracer + start func(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) } @@ -72,7 +78,7 @@ func TestTraceProviderDelegation(t *testing.T) { assert.Equal(t, want, spanName) } } - return trace.NewNoopTracerProvider().Tracer(name).Start(ctx, spanName) + return noop.NewTracerProvider().Tracer(name).Start(ctx, spanName) }, } }, @@ -107,7 +113,7 @@ func TestTraceProviderDelegates(t *testing.T) { tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { called = true assert.Equal(t, "abc", name) - return trace.NewNoopTracerProvider().Tracer("") + return noop.NewTracerProvider().Tracer("") }, }) @@ -148,7 +154,7 @@ func TestTraceProviderDelegatesConcurrentSafe(t *testing.T) { // Signal the goroutine to finish. close(quit) } - return trace.NewNoopTracerProvider().Tracer("") + return noop.NewTracerProvider().Tracer("") }, }) @@ -195,7 +201,7 @@ func TestTracerDelegatesConcurrentSafe(t *testing.T) { // Signal the goroutine to finish. close(quit) } - return trace.NewNoopTracerProvider().Tracer("").Start(ctx, spanName) + return noop.NewTracerProvider().Tracer("").Start(ctx, spanName) }, } }, @@ -218,7 +224,7 @@ func TestTraceProviderDelegatesSameInstance(t *testing.T) { SetTracerProvider(fnTracerProvider{ tracer: func(name string, opts ...trace.TracerOption) trace.Tracer { - return trace.NewNoopTracerProvider().Tracer("") + return noop.NewTracerProvider().Tracer("") }, }) diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 0a018c14ded..7d46c4b48e5 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -25,6 +25,8 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) const ( @@ -73,6 +75,8 @@ func (cfg tracerProviderConfig) MarshalLog() interface{} { // TracerProvider is an OpenTelemetry TracerProvider. It provides Tracers to // instrumentation so it can trace operational flow through a system. type TracerProvider struct { + embedded.TracerProvider + mu sync.Mutex namedTracer map[instrumentation.Scope]*tracer spanProcessors atomic.Pointer[spanProcessorStates] @@ -139,7 +143,7 @@ func NewTracerProvider(opts ...TracerProviderOption) *TracerProvider { func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.Tracer { // This check happens before the mutex is acquired to avoid deadlocking if Tracer() is called from within Shutdown(). if p.isShutdown.Load() { - return trace.NewNoopTracerProvider().Tracer(name, opts...) + return noop.NewTracerProvider().Tracer(name, opts...) } c := trace.NewTracerConfig(opts...) if name == "" { @@ -157,7 +161,7 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T // Must check the flag after acquiring the mutex to avoid returning a valid tracer if Shutdown() ran // after the first check above but before we acquired the mutex. if p.isShutdown.Load() { - return trace.NewNoopTracerProvider().Tracer(name, opts...), true + return noop.NewTracerProvider().Tracer(name, opts...), true } t, ok := p.namedTracer[is] if !ok { diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 68ac1b01616..36dbf67764b 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -32,6 +32,7 @@ import ( "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.21.0" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) // ReadOnlySpan allows reading information from the data structure underlying a @@ -108,6 +109,8 @@ type ReadWriteSpan interface { // recordingSpan is an implementation of the OpenTelemetry Span API // representing the individual component of a trace that is sampled. type recordingSpan struct { + embedded.Span + // mu protects the contents of this span. mu sync.Mutex @@ -774,6 +777,8 @@ func (s *recordingSpan) runtimeTrace(ctx context.Context) context.Context { // that wraps a SpanContext. It performs no operations other than to return // the wrapped SpanContext or TracerProvider that created it. type nonRecordingSpan struct { + embedded.Span + // tracer is the SDK tracer that created this span. tracer *tracer sc trace.SpanContext diff --git a/sdk/trace/tracer.go b/sdk/trace/tracer.go index 85a71227f3f..301e1a7abcc 100644 --- a/sdk/trace/tracer.go +++ b/sdk/trace/tracer.go @@ -20,9 +20,12 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" ) type tracer struct { + embedded.Tracer + provider *TracerProvider instrumentationScope instrumentation.Scope } diff --git a/trace/doc.go b/trace/doc.go index ab0346f9664..440f3d7565a 100644 --- a/trace/doc.go +++ b/trace/doc.go @@ -62,5 +62,69 @@ a default. defer span.End() // ... } + +# API Implementations + +This package does not conform to the standard Go versioning policy; all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +[go.opentelemetry.io/otel/trace/embedded]. If an author wants the default +behavior of their implementations to be a compilation failure, signaling to +their users they need to update to the latest version of that implementation, +they need to embed the corresponding interface from +[go.opentelemetry.io/otel/trace/embedded] in their implementation. For +example, + + import "go.opentelemetry.io/otel/trace/embedded" + + type TracerProvider struct { + embedded.TracerProvider + // ... + } + +If an author wants the default behavior of their implementations to panic, they +can embed the API interface directly. + + import "go.opentelemetry.io/otel/trace" + + type TracerProvider struct { + trace.TracerProvider + // ... + } + +This option is not recommended. It will lead to publishing packages that +contain runtime panics when users update to newer versions of +[go.opentelemetry.io/otel/trace], which may be done with a trasitive +dependency. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +[go.opentelemetry.io/otel/trace/noop]: + + import "go.opentelemetry.io/otel/trace/noop" + + type TracerProvider struct { + noop.TracerProvider + // ... + } + +It is strongly recommended that authors only embed +[go.opentelemetry.io/otel/trace/noop] if they choose this default behavior. +That implementation is the only one OpenTelemetry authors can guarantee will +fully implement all the API interfaces when a user updates their API. */ package trace // import "go.opentelemetry.io/otel/trace" diff --git a/trace/embedded/embedded.go b/trace/embedded/embedded.go new file mode 100644 index 00000000000..898db5a7546 --- /dev/null +++ b/trace/embedded/embedded.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry +// trace API]. +// +// Implementers of the [OpenTelemetry trace API] can embed the relevant type +// from this package into their implementation directly. Doing so will result +// in a compilation error for users when the [OpenTelemetry trace API] is +// extended (which is something that can happen without a major version bump of +// the API package). +// +// [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace +package embedded // import "go.opentelemetry.io/otel/trace/embedded" + +// TracerProvider is embedded in +// [go.opentelemetry.io/otel/trace.TracerProvider]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to +// experience a compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +type TracerProvider interface{ tracerProvider() } + +// Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface +// is extended (which is something that can happen without a major version bump +// of the API package). +type Tracer interface{ tracer() } + +// Span is embedded in [go.opentelemetry.io/otel/trace.Span]. +// +// Embed this interface in your implementation of the +// [go.opentelemetry.io/otel/trace.Span] if you want users to experience a +// compilation error, signaling they need to update to your latest +// implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is +// extended (which is something that can happen without a major version bump of +// the API package). +type Span interface{ span() } diff --git a/trace/noop.go b/trace/noop.go index 7cf6c7f3ef9..c125491caeb 100644 --- a/trace/noop.go +++ b/trace/noop.go @@ -19,16 +19,20 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" ) // NewNoopTracerProvider returns an implementation of TracerProvider that // performs no operations. The Tracer and Spans created from the returned // TracerProvider also perform no operations. +// +// Deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] +// instead. func NewNoopTracerProvider() TracerProvider { return noopTracerProvider{} } -type noopTracerProvider struct{} +type noopTracerProvider struct{ embedded.TracerProvider } var _ TracerProvider = noopTracerProvider{} @@ -38,7 +42,7 @@ func (p noopTracerProvider) Tracer(string, ...TracerOption) Tracer { } // noopTracer is an implementation of Tracer that performs no operations. -type noopTracer struct{} +type noopTracer struct{ embedded.Tracer } var _ Tracer = noopTracer{} @@ -54,7 +58,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption } // noopSpan is an implementation of Span that performs no operations. -type noopSpan struct{} +type noopSpan struct{ embedded.Span } var _ Span = noopSpan{} diff --git a/trace/noop/noop.go b/trace/noop/noop.go new file mode 100644 index 00000000000..7f485543c47 --- /dev/null +++ b/trace/noop/noop.go @@ -0,0 +1,118 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package noop provides an implementation of the OpenTelemetry trace API that +// produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry trace API will effectively +// disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry trace API. Doing so will mean the implementation defaults to +// no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/trace/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + + _ trace.TracerProvider = TracerProvider{} + _ trace.Tracer = Tracer{} + _ trace.Span = Span{} +) + +// TracerProvider is an OpenTelemetry No-Op TracerProvider. +type TracerProvider struct{ embedded.TracerProvider } + +// NewTracerProvider returns a TracerProvider that does not record any telemetry. +func NewTracerProvider() TracerProvider { + return TracerProvider{} +} + +// Tracer returns an OpenTelemetry Tracer that does not record any telemetry. +func (TracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer { + return Tracer{} +} + +// Tracer is an OpenTelemetry No-Op Tracer. +type Tracer struct{ embedded.Tracer } + +// Start creates a span. The created span will be set in a child context of ctx +// and returned with the span. +// +// If ctx contains a span context, the returned span will also contain that +// span context. If the span context in ctx is for a non-recording span, that +// span instance will be returned directly. +func (t Tracer) Start(ctx context.Context, _ string, _ ...trace.SpanStartOption) (context.Context, trace.Span) { + span := trace.SpanFromContext(ctx) + + // If the parent context contains a non-zero span context, that span + // context needs to be returned as a non-recording span + // (https://github.com/open-telemetry/opentelemetry-specification/blob/3a1dde966a4ce87cce5adf464359fe369741bbea/specification/trace/api.md#behavior-of-the-api-in-the-absence-of-an-installed-sdk). + var zeroSC trace.SpanContext + if sc := span.SpanContext(); !sc.Equal(zeroSC) { + if !span.IsRecording() { + // If the span is not recording return it directly. + return ctx, span + } + // Otherwise, return the span context needs in a non-recording span. + span = Span{sc: sc} + } else { + // No parent, return a No-Op span with an empty span context. + span = Span{} + } + return trace.ContextWithSpan(ctx, span), span +} + +// Span is an OpenTelemetry No-Op Span. +type Span struct { + embedded.Span + + sc trace.SpanContext +} + +// SpanContext returns an empty span context. +func (s Span) SpanContext() trace.SpanContext { return s.sc } + +// IsRecording always returns false. +func (Span) IsRecording() bool { return false } + +// SetStatus does nothing. +func (Span) SetStatus(codes.Code, string) {} + +// SetAttributes does nothing. +func (Span) SetAttributes(...attribute.KeyValue) {} + +// End does nothing. +func (Span) End(...trace.SpanEndOption) {} + +// RecordError does nothing. +func (Span) RecordError(error, ...trace.EventOption) {} + +// AddEvent does nothing. +func (Span) AddEvent(string, ...trace.EventOption) {} + +// SetName does nothing. +func (Span) SetName(string) {} + +// TracerProvider returns a No-Op TracerProvider. +func (Span) TracerProvider() trace.TracerProvider { return TracerProvider{} } diff --git a/trace/noop/noop_test.go b/trace/noop/noop_test.go new file mode 100644 index 00000000000..2b0f7818e20 --- /dev/null +++ b/trace/noop/noop_test.go @@ -0,0 +1,117 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package noop // import "go.opentelemetry.io/otel/trace/noop" + +import ( + "context" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/trace" +) + +func TestImplementationNoPanics(t *testing.T) { + // Check that if type has an embedded interface and that interface has + // methods added to it than the No-Op implementation implements them. + t.Run("TracerProvider", assertAllExportedMethodNoPanic( + reflect.ValueOf(TracerProvider{}), + reflect.TypeOf((*trace.TracerProvider)(nil)).Elem(), + )) + t.Run("Meter", assertAllExportedMethodNoPanic( + reflect.ValueOf(Tracer{}), + reflect.TypeOf((*trace.Tracer)(nil)).Elem(), + )) + t.Run("Span", assertAllExportedMethodNoPanic( + reflect.ValueOf(Span{}), + reflect.TypeOf((*trace.Span)(nil)).Elem(), + )) +} + +func assertAllExportedMethodNoPanic(rVal reflect.Value, rType reflect.Type) func(*testing.T) { + return func(t *testing.T) { + for n := 0; n < rType.NumMethod(); n++ { + mType := rType.Method(n) + if !mType.IsExported() { + t.Logf("ignoring unexported %s", mType.Name) + continue + } + m := rVal.MethodByName(mType.Name) + if !m.IsValid() { + t.Errorf("unknown method for %s: %s", rVal.Type().Name(), mType.Name) + } + + numIn := mType.Type.NumIn() + if mType.Type.IsVariadic() { + numIn-- + } + args := make([]reflect.Value, numIn) + ctx := context.Background() + for i := range args { + aType := mType.Type.In(i) + if aType.Name() == "Context" { + // Do not panic on a nil context. + args[i] = reflect.ValueOf(ctx) + } else { + args[i] = reflect.New(aType).Elem() + } + } + + assert.NotPanicsf(t, func() { + _ = m.Call(args) + }, "%s.%s", rVal.Type().Name(), mType.Name) + } + } +} + +func TestNewTracerProvider(t *testing.T) { + tp := NewTracerProvider() + assert.Equal(t, tp, TracerProvider{}) + tracer := tp.Tracer("") + assert.Equal(t, tracer, Tracer{}) +} + +func TestTracerStartPropagatesSpanContext(t *testing.T) { + tracer := NewTracerProvider().Tracer("") + spanCtx := trace.SpanContext{} + + ctx := trace.ContextWithSpanContext(context.Background(), spanCtx) + ctx, span := tracer.Start(ctx, "test_span") + assert.Equal(t, spanCtx, trace.SpanContextFromContext(ctx), "empty span context not set in context") + assert.IsType(t, Span{}, span, "non-noop span returned") + assert.Equal(t, spanCtx, span.SpanContext(), "empty span context not returned from span") + assert.False(t, span.IsRecording(), "empty span context returned recording span") + + spanCtx = spanCtx.WithTraceID(trace.TraceID([16]byte{1})) + spanCtx = spanCtx.WithSpanID(trace.SpanID([8]byte{1})) + ctx = trace.ContextWithSpanContext(context.Background(), spanCtx) + ctx, span = tracer.Start(ctx, "test_span") + assert.Equal(t, spanCtx, trace.SpanContextFromContext(ctx), "non-empty span context not set in context") + assert.Equal(t, spanCtx, span.SpanContext(), "non-empty span context not returned from span") + assert.False(t, span.IsRecording(), "non-empty span context returned recording span") + + rSpan := recordingSpan{Span: Span{sc: spanCtx}} + ctx = trace.ContextWithSpan(context.Background(), rSpan) + ctx, span = tracer.Start(ctx, "test_span") + assert.Equal(t, spanCtx, trace.SpanContextFromContext(ctx), "recording span's span context not set in context") + assert.IsType(t, Span{}, span, "non-noop span returned") + assert.Equal(t, spanCtx, span.SpanContext(), "recording span's span context not returned from span") + assert.False(t, span.IsRecording(), "recording span returned") +} + +type recordingSpan struct{ Span } + +func (recordingSpan) IsRecording() bool { return true } diff --git a/trace/trace.go b/trace/trace.go index d3195558761..26a4b2260ec 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -22,6 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace/embedded" ) const ( @@ -342,8 +343,15 @@ func (sc SpanContext) MarshalJSON() ([]byte, error) { // create a Span and it is then up to the operation the Span represents to // properly end the Span when the operation itself ends. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Span interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Span + // End completes the Span. The Span is considered complete and ready to be // delivered through the rest of the telemetry pipeline after this method // is called. Therefore, updates to the Span are not allowed after this @@ -490,8 +498,15 @@ func (sk SpanKind) String() string { // Tracer is the creator of Spans. // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type Tracer interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Tracer + // Start creates a span and a context.Context containing the newly-created span. // // If the context.Context provided in `ctx` contains a Span then the newly-created @@ -522,8 +537,15 @@ type Tracer interface { // at runtime from its users or it can simply use the globally registered one // (see https://pkg.go.dev/go.opentelemetry.io/otel#GetTracerProvider). // -// Warning: methods may be added to this interface in minor releases. +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. type TracerProvider interface { + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.TracerProvider + // Tracer returns a unique Tracer scoped to be used by instrumentation code // to trace computational workflows. The scope and identity of that // instrumentation code is uniquely defined by the name and options passed. diff --git a/trace_test.go b/trace_test.go index 48d245b4116..21829767fd0 100644 --- a/trace_test.go +++ b/trace_test.go @@ -20,19 +20,21 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/trace/embedded" + "go.opentelemetry.io/otel/trace/noop" ) -type testTracerProvider struct{} +type testTracerProvider struct{ embedded.TracerProvider } var _ trace.TracerProvider = &testTracerProvider{} func (*testTracerProvider) Tracer(_ string, _ ...trace.TracerOption) trace.Tracer { - return trace.NewNoopTracerProvider().Tracer("") + return noop.NewTracerProvider().Tracer("") } func TestMultipleGlobalTracerProvider(t *testing.T) { p1 := testTracerProvider{} - p2 := trace.NewNoopTracerProvider() + p2 := noop.NewTracerProvider() SetTracerProvider(&p1) SetTracerProvider(p2) From 16643aea3063604eab37e435ac63e94dda413bbe Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:51:26 +0200 Subject: [PATCH 740/886] dependabot updates Sun Oct 22 14:44:37 UTC 2023 (#4659) Bump github.com/golangci/golangci-lint from 1.54.2 to 1.55.0 in /internal/tools Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.58.3 to 1.59.0 in /example/otel-collector --- bridge/opentracing/test/go.mod | 4 +- bridge/opentracing/test/go.sum | 8 +- example/otel-collector/go.mod | 6 +- example/otel-collector/go.sum | 16 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 16 +-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 16 +-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 16 +-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 16 +-- internal/tools/go.mod | 48 ++++---- internal/tools/go.sum | 103 ++++++++++-------- 14 files changed, 146 insertions(+), 127 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index bbae7b0d6c3..3871051fa8f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/bridge/opentracing v1.19.0 - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 ) require ( @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 70f4eef8286..aa59774d343 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -51,11 +51,11 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index fd49a4eb820..e5f9623ea83 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 ) require ( @@ -27,8 +27,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index f04679ae0b0..ce0274745ce 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -6,7 +6,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -26,13 +26,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index afeb0a12aa6..996836e0765 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,8 +13,8 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.3 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 ) @@ -31,7 +31,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index c82a772101f..de62613ce1f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -8,7 +8,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -34,13 +34,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index b56223607d7..86a8d9ccce7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 ) @@ -30,8 +30,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index c82a772101f..de62613ce1f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -8,7 +8,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -34,13 +34,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 7e96e3c3e86..665c14c1be5 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,8 +11,8 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.2.1 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 - google.golang.org/grpc v1.58.3 + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 ) @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 554ad4dada3..7219e0282b8 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -8,7 +8,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -35,13 +35,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index fe2cc23bc14..db257a0d1ec 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 ) @@ -26,8 +26,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 343ddc2bc9c..56a7834fcc6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -8,7 +8,7 @@ github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -33,13 +33,13 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 h1:Z0hjGZePRE0ZBWotvtrwxFNrNE9CUAGtplaDK5NNI/g= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 h1:FmF5cCW94Ij59cfpoLiwTgodWmm60eEV0CjlsVg2fuw= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 h1:bVf09lpb+OJbByTj913DRJioFFAjf/ZGxEz7MajTp2U= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 8ee7e39e1ce..408b33aa119 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.54.2 + github.com/golangci/golangci-lint v1.55.0 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.5.1 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -23,10 +23,11 @@ require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect dario.cat/mergo v1.0.0 // indirect - github.com/4meepo/tagalign v1.3.2 // indirect - github.com/Abirdcfly/dupword v0.0.12 // indirect + github.com/4meepo/tagalign v1.3.3 // indirect + github.com/Abirdcfly/dupword v0.0.13 // indirect github.com/Antonboom/errname v0.1.12 // indirect github.com/Antonboom/nilnil v0.1.7 // indirect + github.com/Antonboom/testifylint v0.2.3 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect @@ -35,6 +36,7 @@ require ( github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect + github.com/alecthomas/go-check-sumtype v0.1.3 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect @@ -44,18 +46,19 @@ require ( github.com/bkielbasa/cyclop v1.2.1 // indirect github.com/blizzy78/varnamelen v0.8.0 // indirect github.com/bombsimon/wsl/v3 v3.4.0 // indirect - github.com/breml/bidichk v0.2.4 // indirect - github.com/breml/errchkjson v0.3.1 // indirect - github.com/butuzov/ireturn v0.2.0 // indirect + github.com/breml/bidichk v0.2.7 // indirect + github.com/breml/errchkjson v0.3.6 // indirect + github.com/butuzov/ireturn v0.2.1 // indirect github.com/butuzov/mirror v1.1.0 // indirect + github.com/catenacyber/perfsprint v0.2.0 // indirect github.com/ccojocar/zxcvbn-go v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect - github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 // indirect + github.com/chavacava/garif v0.1.0 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect - github.com/daixiang0/gci v0.11.0 // indirect + github.com/daixiang0/gci v0.11.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/denis-tingaikin/go-header v0.4.3 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -66,6 +69,7 @@ require ( github.com/firefart/nonamedreturns v1.0.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect + github.com/ghostiam/protogetter v0.2.3 // indirect github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect @@ -85,11 +89,11 @@ require ( github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect - github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect + github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect github.com/golangci/misspell v0.4.1 // indirect - github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect + github.com/golangci/revgrep v0.5.0 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect @@ -105,7 +109,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect - github.com/jgautheron/goconst v1.5.1 // indirect + github.com/jgautheron/goconst v1.6.0 // indirect github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/julz/importas v0.1.0 // indirect @@ -120,6 +124,7 @@ require ( github.com/ldez/tagliatelle v0.5.0 // indirect github.com/leonklingele/grouper v1.1.1 // indirect github.com/lufeee/execinquery v1.2.1 // indirect + github.com/macabu/inamedparam v0.1.2 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.1 // indirect @@ -129,19 +134,19 @@ require ( github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect - github.com/mgechev/revive v1.3.2 // indirect + github.com/mgechev/revive v1.3.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.13.5 // indirect + github.com/nunnatsa/ginkgolinter v0.14.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.4.4 // indirect + github.com/polyfloyd/go-errorlint v1.4.5 // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect @@ -152,11 +157,11 @@ require ( github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/ryancurrah/gomodguard v1.3.0 // indirect - github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect + github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect - github.com/securego/gosec/v2 v2.17.0 // indirect + github.com/securego/gosec/v2 v2.18.1 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect @@ -179,20 +184,21 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect - github.com/tetafro/godot v1.4.14 // indirect + github.com/tetafro/godot v1.4.15 // indirect github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect github.com/timonwong/loggercheck v0.9.4 // indirect github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.0.5 // indirect - github.com/uudashr/gocognit v1.0.7 // indirect + github.com/uudashr/gocognit v1.1.2 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xen0n/gosmopolitan v1.2.1 // indirect + github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect github.com/ykadowak/zerologlint v0.1.3 // indirect - gitlab.com/bosi/decorder v0.4.0 // indirect + gitlab.com/bosi/decorder v0.4.1 // indirect + go-simpler.org/sloglint v0.1.2 // indirect go.opentelemetry.io/build-tools v0.12.0 // indirect go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -209,7 +215,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - honnef.co/go/tools v0.4.5 // indirect + honnef.co/go/tools v0.4.6 // indirect mvdan.cc/gofumpt v0.5.0 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index b8a9db68ed3..afe903732b1 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -42,14 +42,16 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/4meepo/tagalign v1.3.2 h1:1idD3yxlRGV18VjqtDbqYvQ5pXqQS0wO2dn6M3XstvI= -github.com/4meepo/tagalign v1.3.2/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= -github.com/Abirdcfly/dupword v0.0.12 h1:56NnOyrXzChj07BDFjeRA+IUzSz01jmzEq+G4kEgFhc= -github.com/Abirdcfly/dupword v0.0.12/go.mod h1:+us/TGct/nI9Ndcbcp3rgNcQzctTj68pq7TcgNpLfdI= +github.com/4meepo/tagalign v1.3.3 h1:ZsOxcwGD/jP4U/aw7qeWu58i7dwYemfy5Y+IF1ACoNw= +github.com/4meepo/tagalign v1.3.3/go.mod h1:Q9c1rYMZJc9dPRkbQPpcBNCLEmY2njbAsXhQOZFE2dE= +github.com/Abirdcfly/dupword v0.0.13 h1:SMS17YXypwP000fA7Lr+kfyBQyW14tTT+nRv9ASwUUo= +github.com/Abirdcfly/dupword v0.0.13/go.mod h1:Ut6Ue2KgF/kCOawpW4LnExT+xZLQviJPE4klBPMK/5Y= github.com/Antonboom/errname v0.1.12 h1:oh9ak2zUtsLp5oaEd/erjB4GPu9w19NyoIskZClDcQY= github.com/Antonboom/errname v0.1.12/go.mod h1:bK7todrzvlaZoQagP1orKzWXv59X/x0W0Io2XT1Ssro= github.com/Antonboom/nilnil v0.1.7 h1:ofgL+BA7vlA1K2wNQOsHzLJ2Pw5B5DpWRLdDAVvvTow= github.com/Antonboom/nilnil v0.1.7/go.mod h1:TP+ScQWVEq0eSIxqU8CbdT5DFWoHp0MbP+KMUO1BKYQ= +github.com/Antonboom/testifylint v0.2.3 h1:MFq9zyL+rIVpsvLX4vDPLojgN7qODzWsrnftNX2Qh60= +github.com/Antonboom/testifylint v0.2.3/go.mod h1:IYaXaOX9NbfAyO+Y04nfjGI8wDemC1rUyM/cYolz018= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -69,6 +71,10 @@ github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCv github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= +github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= +github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= +github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= +github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -96,15 +102,17 @@ github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bombsimon/wsl/v3 v3.4.0 h1:RkSxjT3tmlptwfgEgTgU+KYKLI35p/tviNXNXiL2aNU= github.com/bombsimon/wsl/v3 v3.4.0/go.mod h1:KkIB+TXkqy6MvK9BDZVbZxKNYsE1/oLRJbIFtf14qqo= -github.com/breml/bidichk v0.2.4 h1:i3yedFWWQ7YzjdZJHnPo9d/xURinSq3OM+gyM43K4/8= -github.com/breml/bidichk v0.2.4/go.mod h1:7Zk0kRFt1LIZxtQdl9W9JwGAcLTTkOs+tN7wuEYGJ3s= -github.com/breml/errchkjson v0.3.1 h1:hlIeXuspTyt8Y/UmP5qy1JocGNR00KQHgfaNtRAjoxQ= -github.com/breml/errchkjson v0.3.1/go.mod h1:XroxrzKjdiutFyW3nWhw34VGg7kiMsDQox73yWCGI2U= -github.com/butuzov/ireturn v0.2.0 h1:kCHi+YzC150GE98WFuZQu9yrTn6GEydO2AuPLbTgnO4= -github.com/butuzov/ireturn v0.2.0/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= +github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= +github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= +github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= +github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= +github.com/butuzov/ireturn v0.2.1 h1:w5Ks4tnfeFDZskGJ2x1GAkx5gaQV+kdU3NKNr3NEBzY= +github.com/butuzov/ireturn v0.2.1/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/catenacyber/perfsprint v0.2.0 h1:azOocHLscPjqXVJ7Mf14Zjlkn4uNua0+Hcg1wTR6vUo= +github.com/catenacyber/perfsprint v0.2.0/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.1 h1:+sxrANSCj6CdadkcMnvde/GWU1vZiiXRbqYSCalV4/4= github.com/ccojocar/zxcvbn-go v1.0.1/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -114,8 +122,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= -github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8 h1:W9o46d2kbNL06lq7UNDPV0zYLzkrde/bjIqO02eoll0= -github.com/chavacava/garif v0.0.0-20230227094218-b8c73b2037b8/go.mod h1:gakxgyXaaPkxvLw1XQxNGK4I37ys9iBRzNUx/B7pUCo= +github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= +github.com/chavacava/garif v0.1.0/go.mod h1:XMyYCkEL58DF0oyW4qDjjnPWONs2HBqYKI+UIPD+Gww= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -131,8 +139,8 @@ github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDU github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/daixiang0/gci v0.11.0 h1:XeQbFKkCRxvVyn06EOuNY6LPGBLVuB/W130c8FrnX6A= -github.com/daixiang0/gci v0.11.0/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= +github.com/daixiang0/gci v0.11.2 h1:Oji+oPsp3bQ6bNNgX30NBAVT18P4uBH4sRZnlOlTj7Y= +github.com/daixiang0/gci v0.11.2/go.mod h1:xtHP9N7AHdNvtRNfcx9gwTDfw7FRJx4bZUsiEfiNNAI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -162,6 +170,8 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/ghostiam/protogetter v0.2.3 h1:qdv2pzo3BpLqezwqfGDLZ+nHEYmc5bUpIdsMbBVwMjw= +github.com/ghostiam/protogetter v0.2.3/go.mod h1:KmNLOsy1v04hKbvZs8EfGI1fk39AgTdRDxWNYPfXVc4= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= github.com/go-critic/go-critic v0.9.0 h1:Pmys9qvU3pSML/3GEQ2Xd9RZ/ip+aXHKILuxczKGV/U= github.com/go-critic/go-critic v0.9.0/go.mod h1:5P8tdXL7m/6qnyG6oRAlYLORvoXH0WDypYgAEmagT40= @@ -247,18 +257,18 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= -github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 h1:amWTbTGqOZ71ruzrdA+Nx5WA3tV1N0goTspwmKCQvBY= -github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= -github.com/golangci/golangci-lint v1.54.2 h1:oR9zxfWYxt7hFqk6+fw6Enr+E7F0SN2nqHhJYyIb0yo= -github.com/golangci/golangci-lint v1.54.2/go.mod h1:vnsaCTPKCI2wreL9tv7RkHDwUrz3htLjed6+6UsvcwU= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= +github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= +github.com/golangci/golangci-lint v1.55.0 h1:ePpc6YhM1ZV8kHU8dwmHDHAdeedZHdK8cmTXlkkRdi8= +github.com/golangci/golangci-lint v1.55.0/go.mod h1:Z/OawFQ4yqFo2/plDYlIjoZlJeVYkRcqS9dW55p0FXg= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= -github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 h1:DIPQnGy2Gv2FSA4B/hh8Q7xx3B7AIDk3DAMeHclH1vQ= -github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= +github.com/golangci/revgrep v0.5.0 h1:GGBqHFtFOeHiSUQtFVZXPJtVZYOGB4iVlAjaoFRBQvY= +github.com/golangci/revgrep v0.5.0/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -337,8 +347,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jcchavezs/porto v0.5.1 h1:Uq3x85zFfgipfdHMeeyoh3gHs/oHM9waGCivLNuzLIc= github.com/jcchavezs/porto v0.5.1/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= -github.com/jgautheron/goconst v1.5.1 h1:HxVbL1MhydKs8R8n/HE5NPvzfaYmQJA3o879lE4+WcM= -github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA= +github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af h1:KA9BjwUk7KlCh6S9EAGWBt1oExIUv9WyNCiRz5amv48= @@ -386,6 +396,8 @@ github.com/leonklingele/grouper v1.1.1 h1:suWXRU57D4/Enn6pXR0QVqqWWrnJ9Osrz+5rjt github.com/leonklingele/grouper v1.1.1/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/lufeee/execinquery v1.2.1 h1:hf0Ems4SHcUGBxpGN7Jz78z1ppVkP/837ZlETPCEtOM= github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/macabu/inamedparam v0.1.2 h1:RR5cnayM6Q7cDhQol32DE2BGAPGMnffJ31LFE+UklaU= +github.com/macabu/inamedparam v0.1.2/go.mod h1:Xg25QvY7IBRl1KLPV9Rbml8JOMZtF/iAkNkmV7eQgjw= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s93SLMxb2vI= @@ -410,8 +422,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= -github.com/mgechev/revive v1.3.2 h1:Wb8NQKBaALBJ3xrrj4zpwJwqwNA6nDpyJSEQWcCka6U= -github.com/mgechev/revive v1.3.2/go.mod h1:UCLtc7o5vg5aXCwdUTU1kEBQ1v+YXPAkYDIDXbrs5I0= +github.com/mgechev/revive v1.3.4 h1:k/tO3XTaWY4DEHal9tWBkkUMJYO/dLDVyMmAQxmIMDc= +github.com/mgechev/revive v1.3.4/go.mod h1:W+pZCMu9qj8Uhfs1iJMQsEFLRozUfvwFwqVvRbSNLVw= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -431,12 +443,12 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.13.5 h1:fOsPB4CEZOPkyMqF4B9hoqOpooFWU7vWSVkCSscVpgU= -github.com/nunnatsa/ginkgolinter v0.13.5/go.mod h1:OBHy4536xtuX3102NM63XRtOyxqZOO02chsaeDWXVO8= +github.com/nunnatsa/ginkgolinter v0.14.0 h1:XQPNmw+kZz5cC/HbFK3mQutpjzAQv1dHregRA+4CGGg= +github.com/nunnatsa/ginkgolinter v0.14.0/go.mod h1:cm2xaqCUCRd7qcP4DqbVvpcyEMkuLM9CF0wY6VASohk= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA= +github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -454,8 +466,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.4.4 h1:A9gytp+p6TYqeALTYRoxJESYP8wJRETRX2xzGWFsEBU= -github.com/polyfloyd/go-errorlint v1.4.4/go.mod h1:ry5NqF7l9Q77V+XqAfUg1zfryrEtyac3G5+WVpIK0xU= +github.com/polyfloyd/go-errorlint v1.4.5 h1:70YWmMy4FgRHehGNOUask3HtSFSOLKgmDn7ryNe7LqI= +github.com/polyfloyd/go-errorlint v1.4.5/go.mod h1:sIZEbFoDOCnTYYZoVkjc4hTnM459tuWA9H/EkdXwsKk= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= @@ -498,16 +510,16 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryancurrah/gomodguard v1.3.0 h1:q15RT/pd6UggBXVBuLps8BXRvl5GPBcwVA7BJHMLuTw= github.com/ryancurrah/gomodguard v1.3.0/go.mod h1:ggBxb3luypPEzqVtq33ee7YSN35V28XeGnid8dnni50= -github.com/ryanrolds/sqlclosecheck v0.4.0 h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI= -github.com/ryanrolds/sqlclosecheck v0.4.0/go.mod h1:TBRRjzL31JONc9i4XMinicuo+s+E8yKZ5FN8X3G6CKQ= +github.com/ryanrolds/sqlclosecheck v0.5.1 h1:dibWW826u0P8jNLsLN+En7+RqWWTYrjCB9fJfSfdyCU= +github.com/ryanrolds/sqlclosecheck v0.5.1/go.mod h1:2g3dUjoS6AL4huFdv6wn55WpLIDjY7ZgUR4J8HOO/XQ= github.com/sanposhiho/wastedassign/v2 v2.0.7 h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc= github.com/sanposhiho/wastedassign/v2 v2.0.7/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI= github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tMEOsumirXcOJqAw= github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE= -github.com/securego/gosec/v2 v2.17.0 h1:ZpAStTDKY39insEG9OH6kV3IkhQZPTq9a9eGOLOjcdI= -github.com/securego/gosec/v2 v2.17.0/go.mod h1:lt+mgC91VSmriVoJLentrMkRCYs+HLTBnUFUBuhV2hc= +github.com/securego/gosec/v2 v2.18.1 h1:xnnehWg7dIW8qrRPGm8ykY21zp2MueKyC99Vlcuj96I= +github.com/securego/gosec/v2 v2.18.1/go.mod h1:ZUTcKD9gAFip1lLGHWCjkoBQJyaEzePTNzjwlL2HHoE= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= @@ -561,7 +573,6 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -575,8 +586,8 @@ github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY= -github.com/tetafro/godot v1.4.14 h1:ScO641OHpf9UpHPk8fCknSuXNMpi4iFlwuWoBs3L+1s= -github.com/tetafro/godot v1.4.14/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= +github.com/tetafro/godot v1.4.15 h1:QzdIs+XB8q+U1WmQEWKHQbKmCw06QuQM7gLx/dky2RM= +github.com/tetafro/godot v1.4.15/go.mod h1:2oVxTBSftRTh4+MVfUaUXR6bn2GDXCaMcOG4Dk3rfio= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 h1:quvGphlmUVU+nhpFa4gg4yJyTRJ13reZMDHrKwYw53M= github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966/go.mod h1:27bSVNWSBOHm+qRp1T9qzaIpsWEP6TbUnei/43HK+PQ= github.com/timonwong/loggercheck v0.9.4 h1:HKKhqrjcVj8sxL7K77beXh0adEm6DLjV/QOGeMXEVi4= @@ -589,14 +600,14 @@ github.com/ultraware/funlen v0.1.0 h1:BuqclbkY6pO+cvxoq7OsktIXZpgBSkYTQtmwhAK81v github.com/ultraware/funlen v0.1.0/go.mod h1:XJqmOQja6DpxarLj6Jj1U7JuoS8PvL4nEqDaQhy22p4= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= -github.com/uudashr/gocognit v1.0.7 h1:e9aFXgKgUJrQ5+bs61zBigmj7bFJ/5cC6HmMahVzuDo= -github.com/uudashr/gocognit v1.0.7/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= +github.com/uudashr/gocognit v1.1.2 h1:l6BAEKJqQH2UpKAPKdMfZf5kE4W/2xk8pfU1OVLvniI= +github.com/uudashr/gocognit v1.1.2/go.mod h1:aAVdLURqcanke8h3vg35BC++eseDm66Z7KmchI5et4k= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0= github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xen0n/gosmopolitan v1.2.1 h1:3pttnTuFumELBRSh+KQs1zcz4fN6Zy7aB0xlnQSn1Iw= -github.com/xen0n/gosmopolitan v1.2.1/go.mod h1:JsHq/Brs1o050OOdmzHeOr0N7OtlnKRAGAsElF8xBQA= +github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= +github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= @@ -610,9 +621,11 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -gitlab.com/bosi/decorder v0.4.0 h1:HWuxAhSxIvsITcXeP+iIRg9d1cVfvVkmlF7M68GaoDY= -gitlab.com/bosi/decorder v0.4.0/go.mod h1:xarnteyUoJiOTEldDysquWKTVDCKo2TOIOIibSuWqOg= +gitlab.com/bosi/decorder v0.4.1 h1:VdsdfxhstabyhZovHafFw+9eJ6eU0d2CkFNJcZz/NU4= +gitlab.com/bosi/decorder v0.4.1/go.mod h1:jecSqWUew6Yle1pCr2eLWTensJMmsxHsBwt+PVbkAqA= go-simpler.org/assert v0.6.0 h1:QxSrXa4oRuo/1eHMXSBFHKvJIpWABayzKldqZyugG7E= +go-simpler.org/sloglint v0.1.2 h1:IjdhF8NPxyn0Ckn2+fuIof7ntSnVUAqBFcQRrnG9AiM= +go-simpler.org/sloglint v0.1.2/go.mod h1:2LL+QImPfTslD5muNPydAEYmpXIj6o/WYcqnJjLi4o4= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -1056,8 +1069,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo= -honnef.co/go/tools v0.4.5/go.mod h1:GUV+uIBCLpdf0/v6UhHHG/yzI/z6qPskBeQCjcNB96k= +honnef.co/go/tools v0.4.6 h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8= +honnef.co/go/tools v0.4.6/go.mod h1:+rnGS1THNh8zMwnd2oVOTL9QF6vmfyG6ZXBULae2uc0= mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E= mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= From cab95bcdef5ff4602ab0a6c69a19223852991afb Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 23 Oct 2023 11:00:06 -0400 Subject: [PATCH 741/886] Move view example into prometheus example, and deprecate /example/view (#4649) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * move view example into prometheus example, and deprecate /example/view * fix lint --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 2 ++ example/prometheus/go.mod | 2 +- example/prometheus/main.go | 32 +++++++++++++++++++++++++------- example/view/doc.go | 2 ++ example/view/go.mod | 1 + 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb7a96733e..857961257f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the `go.opentelemetry.io/otel/trace/embedded` package to be embedded in the exported trace API interfaces. (#4620) - Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) - Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) +- Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) ### Deprecated @@ -22,6 +23,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Deprecate `go.opentelemetry.io/otel/example/fib` package is in favor of `go.opentelemetry.io/otel/example/dice`. (#4618) - Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) +- Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) ### Changed diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 6ae665530cd..b2c201160a5 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -7,6 +7,7 @@ require ( go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/prometheus v0.42.0 go.opentelemetry.io/otel/metric v1.19.0 + go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 ) @@ -20,7 +21,6 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/example/prometheus/main.go b/example/prometheus/main.go index fee550de6d0..81f23085536 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -29,9 +29,12 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" api "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" ) +const meterName = "github.com/open-telemetry/opentelemetry-go/example/prometheus" + func main() { rng := rand.New(rand.NewSource(time.Now().UnixNano())) ctx := context.Background() @@ -43,8 +46,23 @@ func main() { if err != nil { log.Fatal(err) } - provider := metric.NewMeterProvider(metric.WithReader(exporter)) - meter := provider.Meter("github.com/open-telemetry/opentelemetry-go/example/prometheus") + provider := metric.NewMeterProvider( + metric.WithReader(exporter), + // View to customize histogram buckets and rename a single histogram instrument. + metric.WithView(metric.NewView( + metric.Instrument{ + Name: "baz", + Scope: instrumentation.Scope{Name: meterName}, + }, + metric.Stream{ + Name: "new_baz", + Aggregation: metric.AggregationExplicitBucketHistogram{ + Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, + }, + }, + )), + ) + meter := provider.Meter(meterName) // Start the prometheus HTTP server and pass the exporter Collector to it go serveMetrics() @@ -75,14 +93,14 @@ func main() { } // This is the equivalent of prometheus.NewHistogramVec - histogram, err := meter.Float64Histogram("baz", api.WithDescription("a very nice histogram")) + histogram, err := meter.Float64Histogram("baz", api.WithDescription("a histogram with custom buckets and rename")) if err != nil { log.Fatal(err) } - histogram.Record(ctx, 23, opt) - histogram.Record(ctx, 7, opt) - histogram.Record(ctx, 101, opt) - histogram.Record(ctx, 105, opt) + histogram.Record(ctx, 136, opt) + histogram.Record(ctx, 64, opt) + histogram.Record(ctx, 701, opt) + histogram.Record(ctx, 830, opt) ctx, _ = signal.NotifyContext(ctx, os.Interrupt) <-ctx.Done() diff --git a/example/view/doc.go b/example/view/doc.go index 6307e5f20e3..ccf2a205d98 100644 --- a/example/view/doc.go +++ b/example/view/doc.go @@ -13,4 +13,6 @@ // limitations under the License. // Package main provides a code sample of using metric views to customize instruments. +// +// Deprecated: See [go.opentelemetry.io/otel/example/prometheus] instead. package main diff --git a/example/view/go.mod b/example/view/go.mod index 0941e70f654..2bafabc9946 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -1,3 +1,4 @@ +// Deprecated: see go.opentelemetry.io/otel/example/prometheus instead. module go.opentelemetry.io/otel/example/view go 1.20 From d18277e3c63f64cb1d94608d561786a632187d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 24 Oct 2023 14:20:46 +0200 Subject: [PATCH 742/886] Decouple otlpmetricgrpc and otlpmetrichttp from otlpmetric (#4660) --- CHANGELOG.md | 4 +++ .../otlp/otlpmetric/otlpmetricgrpc/client.go | 6 +++- .../otlpmetric/otlpmetricgrpc/client_test.go | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 4 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 3 +- .../otlpmetricgrpc/internal/oconf/options.go | 3 -- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 20 ++++++++++++ .../otlpmetric/otlpmetricgrpc/version_test.go | 32 +++++++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 3 +- .../otlpmetric/otlpmetrichttp/client_test.go | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 4 +-- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 3 +- .../otlpmetrichttp/internal/oconf/options.go | 3 -- .../otlp/otlpmetric/otlpmetrichttp/version.go | 20 ++++++++++++ .../otlpmetric/otlpmetrichttp/version_test.go | 32 +++++++++++++++++++ .../otlp/otlpmetric/oconf/options.go.tmpl | 3 -- 16 files changed, 122 insertions(+), 22 deletions(-) create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/version.go create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/version_test.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/version.go create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/version_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 857961257f5..33937681837 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) - Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) - Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) +- Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) ### Deprecated @@ -40,6 +42,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm This extends the `Span` interface and is is a breaking change for any existing implementation. Implementors need to update their implementations based on what they want the default behavior of the interface to be. See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) ## [1.19.0/0.42.0/0.0.7] 2023-09-28 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index ff0647deec3..fe1ab3709a7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -61,7 +61,11 @@ func newClient(ctx context.Context, cfg oconf.Config) (*client, error) { if c.conn == nil { // If the caller did not provide a ClientConn when the client was // created, create one using the configuration they did provide. - conn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, cfg.DialOptions...) + userAgent := "OTel Go OTLP over gRPC metrics exporter/" + Version() + dialOpts := []grpc.DialOption{grpc.WithUserAgent(userAgent)} + dialOpts = append(dialOpts, cfg.DialOptions...) + + conn, err := grpc.DialContext(ctx, cfg.Metrics.Endpoint, dialOpts...) if err != nil { return nil, err } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index bc766f5a26c..1e1b3527d79 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -188,7 +188,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() - require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", got) + require.Regexp(t, "OTel Go OTLP over gRPC metrics exporter/[01]\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 996836e0765..f203a4ab5ea 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -9,7 +9,6 @@ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 @@ -26,6 +25,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect @@ -41,8 +41,6 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/sdk/metric => ../../../../sdk/metric -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../ - replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index de62613ce1f..1affe0e2e04 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -22,7 +22,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go index 40a4469f77a..873b207f58c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -30,7 +30,6 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" "go.opentelemetry.io/otel/sdk/metric" ) @@ -122,7 +121,6 @@ func cleanPath(urlPath string, defaultPath string) string { // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { - userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() cfg := Config{ Metrics: SignalConfig{ Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), @@ -134,7 +132,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go new file mode 100644 index 00000000000..edb47814afa --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" + +// Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. +func Version() string { + return "0.42.0" +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version_test.go new file mode 100644 index 00000000000..9b7f0544ad5 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version_test.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetricgrpc + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := Version() + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 33f5474c1aa..385965a9363 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -30,7 +30,6 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" @@ -89,7 +88,7 @@ func newClient(cfg oconf.Config) (*client, error) { return nil, err } - userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() + userAgent := "OTel Go OTLP over HTTP/protobuf metrics exporter/" + Version() req.Header.Set("User-Agent", userAgent) if n := len(cfg.Metrics.Headers); n > 0 { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index ff06fcf5eb0..88cc5be9ee2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -93,7 +93,7 @@ func TestConfig(t *testing.T) { require.NoError(t, exp.Shutdown(ctx)) got := coll.Headers() - require.Regexp(t, "OTel OTLP Exporter Go/[01]\\..*", got) + require.Regexp(t, "OTel Go OTLP over HTTP/protobuf metrics exporter/[01]\\..*", got) require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 86a8d9ccce7..056b3fcf7e4 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -9,7 +9,6 @@ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 @@ -25,6 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect @@ -41,8 +41,6 @@ replace go.opentelemetry.io/otel/sdk => ../../../../sdk replace go.opentelemetry.io/otel/sdk/metric => ../../../../sdk/metric -replace go.opentelemetry.io/otel/exporters/otlp/otlpmetric => ../ - replace go.opentelemetry.io/otel/metric => ../../../../metric replace go.opentelemetry.io/otel/trace => ../../../../trace diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index de62613ce1f..1affe0e2e04 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -22,7 +22,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go index c1ec5ed210a..20cb840388f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -30,7 +30,6 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" "go.opentelemetry.io/otel/sdk/metric" ) @@ -122,7 +121,6 @@ func cleanPath(urlPath string, defaultPath string) string { // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { - userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() cfg := Config{ Metrics: SignalConfig{ Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), @@ -134,7 +132,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go new file mode 100644 index 00000000000..287b63cbd0b --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" + +// Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. +func Version() string { + return "0.42.0" +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version_test.go new file mode 100644 index 00000000000..73091976fcc --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version_test.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlpmetrichttp + +import ( + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 +var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + + `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + + `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) + +func TestVersionSemver(t *testing.T) { + v := Version() + assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) +} diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl index 9518b23e8bc..f4e1b2194e8 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -30,7 +30,6 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" "{{ .retryImportPath }}" "go.opentelemetry.io/otel/sdk/metric" ) @@ -122,7 +121,6 @@ func cleanPath(urlPath string, defaultPath string) string { // NewGRPCConfig returns a new Config with all settings applied from opts and // any unset setting using the default gRPC config values. func NewGRPCConfig(opts ...GRPCOption) Config { - userAgent := "OTel OTLP Exporter Go/" + otlpmetric.Version() cfg := Config{ Metrics: SignalConfig{ Endpoint: fmt.Sprintf("%s:%d", DefaultCollectorHost, DefaultCollectorGRPCPort), @@ -134,7 +132,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { AggregationSelector: metric.DefaultAggregationSelector, }, RetryConfig: retry.DefaultConfig, - DialOptions: []grpc.DialOption{grpc.WithUserAgent(userAgent)}, } cfg = ApplyGRPCEnvConfigs(cfg) for _, opt := range opts { From 7e6da12625133d21149ce246dfd510eba7ed959f Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 25 Oct 2023 10:16:10 -0400 Subject: [PATCH 743/886] Prometheus exporter no longer collects metrics after shutdown (#4648) * prometheus exporter no longer collects metrics after shutdown * use errors.Is --- CHANGELOG.md | 4 ++++ exporters/prometheus/exporter.go | 5 +++- exporters/prometheus/exporter_test.go | 34 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33937681837..b24494ac9a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +### Fixed + +- In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) + ## [1.19.0/0.42.0/0.0.7] 2023-09-28 This release contains the first stable release of the OpenTelemetry Go [metric SDK]. diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 8973b2028e6..92651c38cec 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -148,8 +148,11 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { metrics := metricdata.ResourceMetrics{} err := c.reader.Collect(context.TODO(), &metrics) if err != nil { + if errors.Is(err, metric.ErrReaderShutdown) { + return + } otel.Handle(err) - if err == metric.ErrReaderNotRegistered { + if errors.Is(err, metric.ErrReaderNotRegistered) { return } } diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index 0f211d8318e..bd31657825e 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -16,6 +16,7 @@ package prometheus import ( "context" + "errors" "io" "os" "sync" @@ -835,3 +836,36 @@ func TestIncompatibleMeterName(t *testing.T) { require.NoError(t, err) assert.Equal(t, 1, len(errs)) } + +func TestShutdownExporter(t *testing.T) { + var handledError error + eh := otel.ErrorHandlerFunc(func(e error) { handledError = errors.Join(handledError, e) }) + otel.SetErrorHandler(eh) + + ctx := context.Background() + registry := prometheus.NewRegistry() + + for i := 0; i < 3; i++ { + exporter, err := New(WithRegisterer(registry)) + require.NoError(t, err) + provider := metric.NewMeterProvider( + metric.WithResource(resource.Default()), + metric.WithReader(exporter)) + meter := provider.Meter("testmeter") + cnt, err := meter.Int64Counter("foo") + require.NoError(t, err) + cnt.Add(ctx, 100) + + // verify that metrics added to a previously shutdown MeterProvider + // do not conflict with metrics added in this loop. + _, err = registry.Gather() + require.NoError(t, err) + + // Shutdown should cause future prometheus Gather() calls to no longer + // include metrics from this loop's MeterProvider. + err = provider.Shutdown(ctx) + require.NoError(t, err) + } + // ensure we aren't unnecessarily logging errors from the shutdown MeterProvider + require.NoError(t, handledError) +} From cdd935364130e136051d95d5c67fac92d2abdf8b Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 25 Oct 2023 10:38:19 -0400 Subject: [PATCH 744/886] Add summary data type to metricdata (#4622) * add summary datatype * support comparing summaries * update wording based on SIG meeting feedback Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + sdk/metric/metricdata/data.go | 51 ++++++++++ .../metricdata/metricdatatest/assertion.go | 17 +++- .../metricdatatest/assertion_test.go | 85 ++++++++++++++++ .../metricdata/metricdatatest/comparisons.go | 96 +++++++++++++++++++ 5 files changed, 249 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b24494ac9a0..3826a72584c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) +- Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) ### Deprecated diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index 49bbc0414a2..995d42b38f1 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -240,3 +240,54 @@ type Exemplar[N int64 | float64] struct { // be empty. TraceID []byte `json:",omitempty"` } + +// Summary metric data are used to convey quantile summaries, +// a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary) +// data type. +// +// These data points cannot always be merged in a meaningful way. The Summary +// type is only used by bridges from other metrics libraries, and cannot be +// produced using OpenTelemetry instrumentation. +type Summary struct { + // DataPoints are the individual aggregated measurements with unique + // attributes. + DataPoints []SummaryDataPoint +} + +func (Summary) privateAggregation() {} + +// SummaryDataPoint is a single data point in a timeseries that describes the +// time-varying values of a Summary metric. +type SummaryDataPoint struct { + // Attributes is the set of key value pairs that uniquely identify the + // timeseries. + Attributes attribute.Set + + // StartTime is when the timeseries was started. + StartTime time.Time + // Time is the time when the timeseries was recorded. + Time time.Time + + // Count is the number of updates this summary has been calculated with. + Count uint64 + + // Sum is the sum of the values recorded. + Sum float64 + + // (Optional) list of values at different quantiles of the distribution calculated + // from the current snapshot. The quantiles must be strictly increasing. + QuantileValues []QuantileValue +} + +// QuantileValue is the value at a given quantile of a summary. +type QuantileValue struct { + // Quantile is the quantile of this value. + // + // Must be in the interval [0.0, 1.0]. + Quantile float64 + + // Value is the value at the given quantile of a summary. + // + // Quantile values must NOT be negative. + Value float64 +} diff --git a/sdk/metric/metricdata/metricdatatest/assertion.go b/sdk/metric/metricdata/metricdatatest/assertion.go index dc8e0d1efaf..a65fd99f482 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion.go +++ b/sdk/metric/metricdata/metricdatatest/assertion.go @@ -46,7 +46,10 @@ type Datatypes interface { metricdata.ExponentialHistogram[int64] | metricdata.ExponentialHistogramDataPoint[float64] | metricdata.ExponentialHistogramDataPoint[int64] | - metricdata.ExponentialBucket + metricdata.ExponentialBucket | + metricdata.Summary | + metricdata.SummaryDataPoint | + metricdata.QuantileValue // Interface types are not allowed in union types, therefore the // Aggregation and Value type from metricdata are not included here. @@ -177,6 +180,12 @@ func AssertEqual[T Datatypes](t TestingT, expected, actual T, opts ...Option) bo r = equalExponentialHistogramDataPoints(e, aIface.(metricdata.ExponentialHistogramDataPoint[int64]), cfg) case metricdata.ExponentialBucket: r = equalExponentialBuckets(e, aIface.(metricdata.ExponentialBucket), cfg) + case metricdata.Summary: + r = equalSummary(e, aIface.(metricdata.Summary), cfg) + case metricdata.SummaryDataPoint: + r = equalSummaryDataPoint(e, aIface.(metricdata.SummaryDataPoint), cfg) + case metricdata.QuantileValue: + r = equalQuantileValue(e, aIface.(metricdata.QuantileValue), cfg) default: // We control all types passed to this, panic to signal developers // early they changed things in an incompatible way. @@ -251,6 +260,12 @@ func AssertHasAttributes[T Datatypes](t TestingT, actual T, attrs ...attribute.K reasons = hasAttributesExponentialHistogramDataPoints(e, attrs...) case metricdata.ExponentialBucket: // Nothing to check. + case metricdata.Summary: + reasons = hasAttributesSummary(e, attrs...) + case metricdata.SummaryDataPoint: + reasons = hasAttributesSummaryDataPoint(e, attrs...) + case metricdata.QuantileValue: + // Nothing to check. default: // We control all types passed to this, panic to signal developers // early they changed things in an incompatible way. diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 514f5c03267..9d647a54004 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -257,6 +257,45 @@ var ( Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, } + quantileValueA = metricdata.QuantileValue{ + Quantile: 0.0, + Value: 0.1, + } + quantileValueB = metricdata.QuantileValue{ + Quantile: 0.1, + Value: 0.2, + } + summaryDataPointA = metricdata.SummaryDataPoint{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 2, + Sum: 3, + QuantileValues: []metricdata.QuantileValue{quantileValueA}, + } + summaryDataPointB = metricdata.SummaryDataPoint{ + Attributes: attrB, + StartTime: startB, + Time: endB, + Count: 3, + QuantileValues: []metricdata.QuantileValue{quantileValueB}, + } + summaryDataPointC = metricdata.SummaryDataPoint{ + Attributes: attrA, + StartTime: startB, + Time: endB, + Count: 2, + Sum: 3, + QuantileValues: []metricdata.QuantileValue{quantileValueA}, + } + summaryDataPointD = metricdata.SummaryDataPoint{ + Attributes: attrA, + StartTime: startA, + Time: endA, + Count: 3, + QuantileValues: []metricdata.QuantileValue{quantileValueB}, + } + exponentialBucket2 = metricdata.ExponentialBucket{ Offset: 2, Counts: []uint64{1, 1}, @@ -514,6 +553,22 @@ var ( DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64D}, } + summaryA = metricdata.Summary{ + DataPoints: []metricdata.SummaryDataPoint{summaryDataPointA}, + } + + summaryB = metricdata.Summary{ + DataPoints: []metricdata.SummaryDataPoint{summaryDataPointB}, + } + + summaryC = metricdata.Summary{ + DataPoints: []metricdata.SummaryDataPoint{summaryDataPointC}, + } + + summaryD = metricdata.Summary{ + DataPoints: []metricdata.SummaryDataPoint{summaryDataPointD}, + } + metricsA = metricdata.Metrics{ Name: "A", Description: "A desc", @@ -646,6 +701,9 @@ func TestAssertEqual(t *testing.T) { t.Run("ExponentialHistogramDataPointInt64", testDatatype(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64B, equalExponentialHistogramDataPoints[int64])) t.Run("ExponentialHistogramDataPointFloat64", testDatatype(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64B, equalExponentialHistogramDataPoints[float64])) t.Run("ExponentialBuckets", testDatatype(exponentialBucket2, exponentialBucket3, equalExponentialBuckets)) + t.Run("Summary", testDatatype(summaryA, summaryB, equalSummary)) + t.Run("SummaryDataPoint", testDatatype(summaryDataPointA, summaryDataPointB, equalSummaryDataPoint)) + t.Run("QuantileValues", testDatatype(quantileValueA, quantileValueB, equalQuantileValue)) } func TestAssertEqualIgnoreTime(t *testing.T) { @@ -670,6 +728,8 @@ func TestAssertEqualIgnoreTime(t *testing.T) { t.Run("ExponentialHistogramFloat64", testDatatypeIgnoreTime(exponentialHistogramFloat64A, exponentialHistogramFloat64C, equalExponentialHistograms[float64])) t.Run("ExponentialHistogramDataPointInt64", testDatatypeIgnoreTime(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64C, equalExponentialHistogramDataPoints[int64])) t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreTime(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64C, equalExponentialHistogramDataPoints[float64])) + t.Run("Summary", testDatatypeIgnoreTime(summaryA, summaryC, equalSummary)) + t.Run("SummaryDataPoint", testDatatypeIgnoreTime(summaryDataPointA, summaryDataPointC, equalSummaryDataPoint)) } func TestAssertEqualIgnoreExemplars(t *testing.T) { @@ -718,6 +778,8 @@ func TestAssertEqualIgnoreValue(t *testing.T) { t.Run("ExponentialHistogramFloat64", testDatatypeIgnoreValue(exponentialHistogramFloat64A, exponentialHistogramFloat64D, equalExponentialHistograms[float64])) t.Run("ExponentialHistogramDataPointInt64", testDatatypeIgnoreValue(exponentialHistogramDataPointInt64A, exponentialHistogramDataPointInt64D, equalExponentialHistogramDataPoints[int64])) t.Run("ExponentialHistogramDataPointFloat64", testDatatypeIgnoreValue(exponentialHistogramDataPointFloat64A, exponentialHistogramDataPointFloat64D, equalExponentialHistogramDataPoints[float64])) + t.Run("Summary", testDatatypeIgnoreValue(summaryA, summaryD, equalSummary)) + t.Run("SummaryDataPoint", testDatatypeIgnoreValue(summaryDataPointA, summaryDataPointD, equalSummaryDataPoint)) } type unknownAggregation struct { @@ -734,6 +796,7 @@ func TestAssertAggregationsEqual(t *testing.T) { AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64A) AssertAggregationsEqual(t, exponentialHistogramInt64A, exponentialHistogramInt64A) AssertAggregationsEqual(t, exponentialHistogramFloat64A, exponentialHistogramFloat64A) + AssertAggregationsEqual(t, summaryA, summaryA) r := equalAggregations(sumInt64A, nil, config{}) assert.Len(t, r, 1, "should return nil comparison mismatch only") @@ -815,6 +878,15 @@ func TestAssertAggregationsEqual(t *testing.T) { r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64D, config{ignoreValue: true}) assert.Len(t, r, 0, "value should be ignored: %v == %v", exponentialHistogramFloat64A, exponentialHistogramFloat64D) + + r = equalAggregations(summaryA, summaryB, config{}) + assert.Greaterf(t, len(r), 0, "summaries should not be equal: %v == %v", summaryA, summaryB) + + r = equalAggregations(summaryA, summaryC, config{ignoreTimestamp: true}) + assert.Len(t, r, 0, "summaries should be equal: %v", r) + + r = equalAggregations(summaryA, summaryD, config{ignoreValue: true}) + assert.Len(t, r, 0, "value should be ignored: %v == %v", summaryA, summaryD) } func TestAssertAttributes(t *testing.T) { @@ -839,6 +911,9 @@ func TestAssertAttributes(t *testing.T) { AssertHasAttributes(t, exponentialHistogramInt64A, attribute.Bool("A", true)) AssertHasAttributes(t, exponentialHistogramFloat64A, attribute.Bool("A", true)) AssertHasAttributes(t, exponentialBucket2, attribute.Bool("A", true)) // No-op, always pass. + AssertHasAttributes(t, summaryDataPointA, attribute.Bool("A", true)) + AssertHasAttributes(t, summaryA, attribute.Bool("A", true)) + AssertHasAttributes(t, quantileValueA, attribute.Bool("A", true)) // No-op, always pass. r := hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", true)) assert.Equal(t, len(r), 0, "gaugeInt64A has A=True") @@ -856,6 +931,8 @@ func TestAssertAttributes(t *testing.T) { assert.Equal(t, len(r), 0, "exponentialHistogramInt64A has A=True") r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", true)) assert.Equal(t, len(r), 0, "exponentialHistogramFloat64A has A=True") + r = hasAttributesAggregation(summaryA, attribute.Bool("A", true)) + assert.Equal(t, len(r), 0, "summaryA has A=True") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have A=False") @@ -873,6 +950,8 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "exponentialHistogramInt64A does not have A=False") r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", false)) assert.Greater(t, len(r), 0, "exponentialHistogramFloat64A does not have A=False") + r = hasAttributesAggregation(summaryA, attribute.Bool("A", false)) + assert.Greater(t, len(r), 0, "summaryA does not have A=False") r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "gaugeInt64A does not have Attribute B") @@ -890,6 +969,8 @@ func TestAssertAttributes(t *testing.T) { assert.Greater(t, len(r), 0, "exponentialHistogramIntA does not have Attribute B") r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("B", true)) assert.Greater(t, len(r), 0, "exponentialHistogramFloatA does not have Attribute B") + r = hasAttributesAggregation(summaryA, attribute.Bool("B", true)) + assert.Greater(t, len(r), 0, "summaryA does not have Attribute B") } func TestAssertAttributesFail(t *testing.T) { @@ -914,6 +995,10 @@ func TestAssertAttributesFail(t *testing.T) { assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramDataPointFloat64A, attribute.Bool("B", true))) assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramInt64A, attribute.Bool("A", false))) assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramFloat64A, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, summaryDataPointA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, summaryDataPointA, attribute.Bool("B", true))) + assert.False(t, AssertHasAttributes(fakeT, summaryA, attribute.Bool("A", false))) + assert.False(t, AssertHasAttributes(fakeT, summaryA, attribute.Bool("B", true))) sum := metricdata.Sum[int64]{ Temporality: metricdata.CumulativeTemporality, diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index bb74c4a1217..c6407aca8f8 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -155,6 +155,12 @@ func equalAggregations(a, b metricdata.Aggregation, cfg config) (reasons []strin reasons = append(reasons, "ExponentialHistogram not equal:") reasons = append(reasons, r...) } + case metricdata.Summary: + r := equalSummary(v, b.(metricdata.Summary), cfg) + if len(r) > 0 { + reasons = append(reasons, "Summary not equal:") + reasons = append(reasons, r...) + } default: reasons = append(reasons, fmt.Sprintf("Aggregation of unknown types %T", a)) } @@ -426,6 +432,69 @@ func equalExponentialBuckets(a, b metricdata.ExponentialBucket, _ config) (reaso return reasons } +func equalSummary(a, b metricdata.Summary, cfg config) (reasons []string) { + r := compareDiff(diffSlices( + a.DataPoints, + b.DataPoints, + func(a, b metricdata.SummaryDataPoint) bool { + r := equalSummaryDataPoint(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, fmt.Sprintf("Summary DataPoints not equal:\n%s", r)) + } + return reasons +} + +func equalSummaryDataPoint(a, b metricdata.SummaryDataPoint, cfg config) (reasons []string) { + if !a.Attributes.Equals(&b.Attributes) { + reasons = append(reasons, notEqualStr( + "Attributes", + a.Attributes.Encoded(attribute.DefaultEncoder()), + b.Attributes.Encoded(attribute.DefaultEncoder()), + )) + } + if !cfg.ignoreTimestamp { + if !a.StartTime.Equal(b.StartTime) { + reasons = append(reasons, notEqualStr("StartTime", a.StartTime.UnixNano(), b.StartTime.UnixNano())) + } + if !a.Time.Equal(b.Time) { + reasons = append(reasons, notEqualStr("Time", a.Time.UnixNano(), b.Time.UnixNano())) + } + } + if !cfg.ignoreValue { + if a.Count != b.Count { + reasons = append(reasons, notEqualStr("Count", a.Count, b.Count)) + } + if a.Sum != b.Sum { + reasons = append(reasons, notEqualStr("Sum", a.Sum, b.Sum)) + } + r := compareDiff(diffSlices( + a.QuantileValues, + a.QuantileValues, + func(a, b metricdata.QuantileValue) bool { + r := equalQuantileValue(a, b, cfg) + return len(r) == 0 + }, + )) + if r != "" { + reasons = append(reasons, r) + } + } + return reasons +} + +func equalQuantileValue(a, b metricdata.QuantileValue, _ config) (reasons []string) { + if a.Quantile != b.Quantile { + reasons = append(reasons, notEqualStr("Quantile", a.Quantile, b.Quantile)) + } + if a.Value != b.Value { + reasons = append(reasons, notEqualStr("Value", a.Value, b.Value)) + } + return reasons +} + func notEqualStr(prefix string, expected, actual interface{}) string { return fmt.Sprintf("%s not equal:\nexpected: %v\nactual: %v", prefix, expected, actual) } @@ -716,6 +785,8 @@ func hasAttributesAggregation(agg metricdata.Aggregation, attrs ...attribute.Key reasons = hasAttributesExponentialHistogram(agg, attrs...) case metricdata.ExponentialHistogram[float64]: reasons = hasAttributesExponentialHistogram(agg, attrs...) + case metricdata.Summary: + reasons = hasAttributesSummary(agg, attrs...) default: reasons = []string{fmt.Sprintf("unknown aggregation %T", agg)} } @@ -752,3 +823,28 @@ func hasAttributesResourceMetrics(rm metricdata.ResourceMetrics, attrs ...attrib } return reasons } + +func hasAttributesSummary(summary metricdata.Summary, attrs ...attribute.KeyValue) (reasons []string) { + for n, dp := range summary.DataPoints { + reas := hasAttributesSummaryDataPoint(dp, attrs...) + if len(reas) > 0 { + reasons = append(reasons, fmt.Sprintf("summary datapoint %d attributes:\n", n)) + reasons = append(reasons, reas...) + } + } + return reasons +} + +func hasAttributesSummaryDataPoint(dp metricdata.SummaryDataPoint, attrs ...attribute.KeyValue) (reasons []string) { + for _, attr := range attrs { + val, ok := dp.Attributes.Value(attr.Key) + if !ok { + reasons = append(reasons, missingAttrStr(string(attr.Key))) + continue + } + if val != attr.Value { + reasons = append(reasons, notEqualStr(string(attr.Key), attr.Value.Emit(), val.Emit())) + } + } + return reasons +} From 0f5565af4fc472c7be711b5190e8a97c1e9d28a9 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 26 Oct 2023 13:18:37 -0400 Subject: [PATCH 745/886] Add WithExplicitBucketBoundaries Histogram option to the metric api (#4603) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add WithExplicitBucketBoundaries Histogram option to the metric api * Add note that the option is advisory --------- Co-authored-by: Robert Pająk Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + metric/example_test.go | 1 + metric/instrument.go | 23 +++++++++++++++++++++++ metric/syncfloat64.go | 10 ++++++++-- metric/syncfloat64_test.go | 6 ++++++ metric/syncint64.go | 10 ++++++++-- metric/syncint64_test.go | 6 ++++++ 7 files changed, 53 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3826a72584c..a91d8f99d1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add the `go.opentelemetry.io/otel/trace/noop` package as a default no-op implementation of the trace API. (#4620) - Add context propagation in `go.opentelemetry.io/otel/example/dice`. (#4644) - Add view configuration to `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Add `go.opentelemetry.io/otel/metric.WithExplicitBucketBoundaries`, which allows defining default explicit bucket boundaries when creating histogram instruments. (#4603) - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) - Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) diff --git a/metric/example_test.go b/metric/example_test.go index 5c28d2f2926..758dd6b57f1 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -161,6 +161,7 @@ func ExampleMeter_histogram() { "task.duration", metric.WithDescription("The duration of task execution."), metric.WithUnit("s"), + metric.WithExplicitBucketBoundaries(.005, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10), ) if err != nil { panic(err) diff --git a/metric/instrument.go b/metric/instrument.go index cdca00058c6..be89cd53341 100644 --- a/metric/instrument.go +++ b/metric/instrument.go @@ -39,6 +39,12 @@ type InstrumentOption interface { Float64ObservableGaugeOption } +// HistogramOption applies options to histogram instruments. +type HistogramOption interface { + Int64HistogramOption + Float64HistogramOption +} + type descOpt string func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig { @@ -171,6 +177,23 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob // The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code. func WithUnit(u string) InstrumentOption { return unitOpt(u) } +// WithExplicitBucketBoundaries sets the instrument explicit bucket boundaries. +// +// This option is considered "advisory", and may be ignored by API implementations. +func WithExplicitBucketBoundaries(bounds ...float64) HistogramOption { return bucketOpt(bounds) } + +type bucketOpt []float64 + +func (o bucketOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + +func (o bucketOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig { + c.explicitBucketBoundaries = o + return c +} + // AddOption applies options to an addition measurement. See // [MeasurementOption] for other options that can be used as an AddOption. type AddOption interface { diff --git a/metric/syncfloat64.go b/metric/syncfloat64.go index f0b063721d8..0a4825ae6a7 100644 --- a/metric/syncfloat64.go +++ b/metric/syncfloat64.go @@ -147,8 +147,9 @@ type Float64Histogram interface { // Float64HistogramConfig contains options for synchronous counter instruments // that record int64 values. type Float64HistogramConfig struct { - description string - unit string + description string + unit string + explicitBucketBoundaries []float64 } // NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all @@ -171,6 +172,11 @@ func (c Float64HistogramConfig) Unit() string { return c.unit } +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + // Float64HistogramOption applies options to a [Float64HistogramConfig]. See // [InstrumentOption] for other options that can be used as a // Float64HistogramOption. diff --git a/metric/syncfloat64_test.go b/metric/syncfloat64_test.go index 7132680b131..4b3bbfdec29 100644 --- a/metric/syncfloat64_test.go +++ b/metric/syncfloat64_test.go @@ -51,3 +51,9 @@ type float64Config interface { Description() string Unit() string } + +func TestFloat64ExplicitBucketHistogramConfiguration(t *testing.T) { + bounds := []float64{0.1, 0.5, 1.0} + got := NewFloat64HistogramConfig(WithExplicitBucketBoundaries(bounds...)) + assert.Equal(t, bounds, got.ExplicitBucketBoundaries(), "boundaries") +} diff --git a/metric/syncint64.go b/metric/syncint64.go index 6f508eb66d4..56667d32fc0 100644 --- a/metric/syncint64.go +++ b/metric/syncint64.go @@ -147,8 +147,9 @@ type Int64Histogram interface { // Int64HistogramConfig contains options for synchronous counter instruments // that record int64 values. type Int64HistogramConfig struct { - description string - unit string + description string + unit string + explicitBucketBoundaries []float64 } // NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts @@ -171,6 +172,11 @@ func (c Int64HistogramConfig) Unit() string { return c.unit } +// ExplicitBucketBoundaries returns the configured explicit bucket boundaries. +func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 { + return c.explicitBucketBoundaries +} + // Int64HistogramOption applies options to a [Int64HistogramConfig]. See // [InstrumentOption] for other options that can be used as an // Int64HistogramOption. diff --git a/metric/syncint64_test.go b/metric/syncint64_test.go index 51c02f5e041..ece9c7fbb50 100644 --- a/metric/syncint64_test.go +++ b/metric/syncint64_test.go @@ -51,3 +51,9 @@ type int64Config interface { Description() string Unit() string } + +func TestInt64ExplicitBucketHistogramConfiguration(t *testing.T) { + bounds := []float64{0.1, 0.5, 1.0} + got := NewInt64HistogramConfig(WithExplicitBucketBoundaries(bounds...)) + assert.Equal(t, bounds, got.ExplicitBucketBoundaries(), "boundaries") +} From a2e3e463c0fe2b5c0741519aa5b355a89f0609fc Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 27 Oct 2023 12:56:15 -0400 Subject: [PATCH 746/886] Add exemplar support to OpenCensus bridge (#4585) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add exemplar support to OpenCensus bridge * expand set of translated exemplar attributes --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + bridge/opencensus/doc.go | 1 - bridge/opencensus/internal/ocmetric/metric.go | 182 ++++++++- .../internal/ocmetric/metric_test.go | 347 +++++++++++++++++- 4 files changed, 518 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a91d8f99d1b..15c90b0c6c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4660) - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) - Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) +- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) ### Deprecated diff --git a/bridge/opencensus/doc.go b/bridge/opencensus/doc.go index ed2a4cfd935..df62b1c575e 100644 --- a/bridge/opencensus/doc.go +++ b/bridge/opencensus/doc.go @@ -59,5 +59,4 @@ // - Summary-typed metrics are dropped // - GaugeDistribution-typed metrics are dropped // - Histogram's SumOfSquaredDeviation field is dropped -// - Exemplars on Histograms are dropped package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index d656e5d2871..aeb3479f40b 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -17,8 +17,13 @@ package internal // import "go.opentelemetry.io/otel/bridge/opencensus/internal/ import ( "errors" "fmt" + "math" + "reflect" + "sort" + "strconv" ocmetricdata "go.opencensus.io/metric/metricdata" + octrace "go.opencensus.io/trace" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -30,6 +35,7 @@ var ( errNegativeDistributionCount = errors.New("distribution count is negative") errNegativeBucketCount = errors.New("distribution bucket count is negative") errMismatchedAttributeKeyValues = errors.New("mismatched number of attribute keys and values") + errInvalidExemplarSpanContext = errors.New("span context exemplar attachment does not contain an OpenCensus SpanContext") ) // ConvertMetrics converts metric data from OpenCensus to OpenTelemetry. @@ -134,7 +140,7 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time err = errors.Join(err, fmt.Errorf("%w: %d", errMismatchedValueTypes, p.Value)) continue } - bucketCounts, bucketErr := convertBucketCounts(dist.Buckets) + bucketCounts, exemplars, bucketErr := convertBuckets(dist.Buckets) if bucketErr != nil { err = errors.Join(err, bucketErr) continue @@ -143,7 +149,6 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time err = errors.Join(err, fmt.Errorf("%w: %d", errNegativeDistributionCount, dist.Count)) continue } - // TODO: handle exemplars points = append(points, metricdata.HistogramDataPoint[float64]{ Attributes: attrs, StartTime: t.StartTime, @@ -152,22 +157,187 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time Sum: dist.Sum, Bounds: dist.BucketOptions.Bounds, BucketCounts: bucketCounts, + Exemplars: exemplars, }) } } return metricdata.Histogram[float64]{DataPoints: points, Temporality: metricdata.CumulativeTemporality}, err } -// convertBucketCounts converts from OpenCensus bucket counts to slice of uint64. -func convertBucketCounts(buckets []ocmetricdata.Bucket) ([]uint64, error) { +// convertBuckets converts from OpenCensus bucket counts to slice of uint64, +// and converts OpenCensus exemplars to OpenTelemetry exemplars. +func convertBuckets(buckets []ocmetricdata.Bucket) ([]uint64, []metricdata.Exemplar[float64], error) { bucketCounts := make([]uint64, len(buckets)) + exemplars := []metricdata.Exemplar[float64]{} + var err error for i, bucket := range buckets { if bucket.Count < 0 { - return nil, fmt.Errorf("%w: %q", errNegativeBucketCount, bucket.Count) + err = errors.Join(err, fmt.Errorf("%w: %q", errNegativeBucketCount, bucket.Count)) + continue } bucketCounts[i] = uint64(bucket.Count) + + if bucket.Exemplar != nil { + exemplar, exemplarErr := convertExemplar(bucket.Exemplar) + if exemplarErr != nil { + err = errors.Join(err, exemplarErr) + continue + } + exemplars = append(exemplars, exemplar) + } + } + return bucketCounts, exemplars, err +} + +// convertExemplar converts an OpenCensus exemplar to an OpenTelemetry exemplar. +func convertExemplar(ocExemplar *ocmetricdata.Exemplar) (metricdata.Exemplar[float64], error) { + exemplar := metricdata.Exemplar[float64]{ + Value: ocExemplar.Value, + Time: ocExemplar.Timestamp, + } + var err error + for k, v := range ocExemplar.Attachments { + switch { + case k == ocmetricdata.AttachmentKeySpanContext: + sc, ok := v.(octrace.SpanContext) + if !ok { + err = errors.Join(err, fmt.Errorf("%w; type: %v", errInvalidExemplarSpanContext, reflect.TypeOf(v))) + continue + } + exemplar.SpanID = sc.SpanID[:] + exemplar.TraceID = sc.TraceID[:] + default: + exemplar.FilteredAttributes = append(exemplar.FilteredAttributes, convertKV(k, v)) + } + } + sortable := attribute.Sortable(exemplar.FilteredAttributes) + sort.Sort(&sortable) + return exemplar, err +} + +// convertKV converts an OpenCensus Attachment to an OpenTelemetry KeyValue. +func convertKV(key string, value any) attribute.KeyValue { + switch typedVal := value.(type) { + case bool: + return attribute.Bool(key, typedVal) + case int: + return attribute.Int(key, typedVal) + case int8: + return attribute.Int(key, int(typedVal)) + case int16: + return attribute.Int(key, int(typedVal)) + case int32: + return attribute.Int(key, int(typedVal)) + case int64: + return attribute.Int64(key, typedVal) + case uint: + return uintKV(key, typedVal) + case uint8: + return uintKV(key, uint(typedVal)) + case uint16: + return uintKV(key, uint(typedVal)) + case uint32: + return uintKV(key, uint(typedVal)) + case uintptr: + return uint64KV(key, uint64(typedVal)) + case uint64: + return uint64KV(key, uint64(typedVal)) + case float32: + return attribute.Float64(key, float64(typedVal)) + case float64: + return attribute.Float64(key, typedVal) + case complex64: + return attribute.String(key, complexToString(typedVal)) + case complex128: + return attribute.String(key, complexToString(typedVal)) + case string: + return attribute.String(key, typedVal) + case []bool: + return attribute.BoolSlice(key, typedVal) + case []int: + return attribute.IntSlice(key, typedVal) + case []int8: + return intSliceKV(key, typedVal) + case []int16: + return intSliceKV(key, typedVal) + case []int32: + return intSliceKV(key, typedVal) + case []int64: + return attribute.Int64Slice(key, typedVal) + case []uint: + return uintSliceKV(key, typedVal) + case []uint8: + return uintSliceKV(key, typedVal) + case []uint16: + return uintSliceKV(key, typedVal) + case []uint32: + return uintSliceKV(key, typedVal) + case []uintptr: + return uintSliceKV(key, typedVal) + case []uint64: + return uintSliceKV(key, typedVal) + case []float32: + floatSlice := make([]float64, len(typedVal)) + for i := range typedVal { + floatSlice[i] = float64(typedVal[i]) + } + return attribute.Float64Slice(key, floatSlice) + case []float64: + return attribute.Float64Slice(key, typedVal) + case []complex64: + return complexSliceKV(key, typedVal) + case []complex128: + return complexSliceKV(key, typedVal) + case []string: + return attribute.StringSlice(key, typedVal) + case fmt.Stringer: + return attribute.Stringer(key, typedVal) + default: + return attribute.String(key, fmt.Sprintf("unhandled attribute value: %+v", value)) + } +} + +func intSliceKV[N int8 | int16 | int32](key string, val []N) attribute.KeyValue { + intSlice := make([]int, len(val)) + for i := range val { + intSlice[i] = int(val[i]) + } + return attribute.IntSlice(key, intSlice) +} + +func uintKV(key string, val uint) attribute.KeyValue { + if val > uint(math.MaxInt) { + return attribute.String(key, strconv.FormatUint(uint64(val), 10)) + } + return attribute.Int(key, int(val)) +} + +func uintSliceKV[N uint | uint8 | uint16 | uint32 | uint64 | uintptr](key string, val []N) attribute.KeyValue { + strSlice := make([]string, len(val)) + for i := range val { + strSlice[i] = strconv.FormatUint(uint64(val[i]), 10) } - return bucketCounts, nil + return attribute.StringSlice(key, strSlice) +} + +func uint64KV(key string, val uint64) attribute.KeyValue { + const maxInt64 = ^uint64(0) >> 1 + if val > maxInt64 { + return attribute.String(key, strconv.FormatUint(val, 10)) + } + return attribute.Int64(key, int64(val)) +} + +func complexSliceKV[N complex64 | complex128](key string, val []N) attribute.KeyValue { + strSlice := make([]string, len(val)) + for i := range val { + strSlice[i] = complexToString(val[i]) + } + return attribute.StringSlice(key, strSlice) +} + +func complexToString[N complex64 | complex128](val N) string { + return strconv.FormatComplex(complex128(val), 'f', -1, 64) } // convertAttrs converts from OpenCensus attribute keys and values to an diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index a3258c6b1e7..bf851bc14ad 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -16,10 +16,15 @@ package internal // import "go.opentelemetry.io/otel/bridge/opencensus/opencensu import ( "errors" + "fmt" + "math" + "reflect" "testing" "time" + "github.com/stretchr/testify/assert" ocmetricdata "go.opencensus.io/metric/metricdata" + octrace "go.opencensus.io/trace" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric/metricdata" @@ -28,6 +33,7 @@ import ( func TestConvertMetrics(t *testing.T) { endTime1 := time.Now() + exemplarTime := endTime1.Add(-10 * time.Second) endTime2 := endTime1.Add(-time.Millisecond) startTime := endTime2.Add(-time.Minute) for _, tc := range []struct { @@ -73,9 +79,46 @@ func TestConvertMetrics(t *testing.T) { Bounds: []float64{1.0, 2.0, 3.0}, }, Buckets: []ocmetricdata.Bucket{ - {Count: 1}, - {Count: 2}, - {Count: 5}, + { + Count: 1, + Exemplar: &ocmetricdata.Exemplar{ + Value: 0.8, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{1}), + SpanID: octrace.SpanID([8]byte{2}), + }, + "bool": true, + }, + }, + }, + { + Count: 2, + Exemplar: &ocmetricdata.Exemplar{ + Value: 1.5, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{3}), + SpanID: octrace.SpanID([8]byte{4}), + }, + }, + }, + }, + { + Count: 5, + Exemplar: &ocmetricdata.Exemplar{ + Value: 2.6, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{5}), + SpanID: octrace.SpanID([8]byte{6}), + }, + }, + }, + }, }, }), ocmetricdata.NewDistributionPoint(endTime2, &ocmetricdata.Distribution{ @@ -85,9 +128,45 @@ func TestConvertMetrics(t *testing.T) { Bounds: []float64{1.0, 2.0, 3.0}, }, Buckets: []ocmetricdata.Bucket{ - {Count: 1}, - {Count: 4}, - {Count: 5}, + { + Count: 1, + Exemplar: &ocmetricdata.Exemplar{ + Value: 0.9, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{7}), + SpanID: octrace.SpanID([8]byte{8}), + }, + }, + }, + }, + { + Count: 4, + Exemplar: &ocmetricdata.Exemplar{ + Value: 1.1, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{9}), + SpanID: octrace.SpanID([8]byte{10}), + }, + }, + }, + }, + { + Count: 5, + Exemplar: &ocmetricdata.Exemplar{ + Value: 2.7, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: octrace.SpanContext{ + TraceID: octrace.TraceID([16]byte{11}), + SpanID: octrace.SpanID([8]byte{12}), + }, + }, + }, + }, }, }), }, @@ -229,6 +308,29 @@ func TestConvertMetrics(t *testing.T) { Sum: 100.0, Bounds: []float64{1.0, 2.0, 3.0}, BucketCounts: []uint64{1, 2, 5}, + Exemplars: []metricdata.Exemplar[float64]{ + { + Time: exemplarTime, + Value: 0.8, + TraceID: []byte{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{2, 0, 0, 0, 0, 0, 0, 0}, + FilteredAttributes: []attribute.KeyValue{ + attribute.Bool("bool", true), + }, + }, + { + Time: exemplarTime, + Value: 1.5, + TraceID: []byte{3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{4, 0, 0, 0, 0, 0, 0, 0}, + }, + { + Time: exemplarTime, + Value: 2.6, + TraceID: []byte{5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{6, 0, 0, 0, 0, 0, 0, 0}, + }, + }, }, { Attributes: attribute.NewSet(attribute.KeyValue{ Key: attribute.Key("a"), @@ -243,6 +345,26 @@ func TestConvertMetrics(t *testing.T) { Sum: 110.0, Bounds: []float64{1.0, 2.0, 3.0}, BucketCounts: []uint64{1, 4, 5}, + Exemplars: []metricdata.Exemplar[float64]{ + { + Time: exemplarTime, + Value: 0.9, + TraceID: []byte{7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{8, 0, 0, 0, 0, 0, 0, 0}, + }, + { + Time: exemplarTime, + Value: 1.1, + TraceID: []byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{10, 0, 0, 0, 0, 0, 0, 0}, + }, + { + Time: exemplarTime, + Value: 2.7, + TraceID: []byte{11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + SpanID: []byte{12, 0, 0, 0, 0, 0, 0, 0}, + }, + }, }, }, Temporality: metricdata.CumulativeTemporality, @@ -516,6 +638,46 @@ func TestConvertMetrics(t *testing.T) { }, expectedErr: errMismatchedValueTypes, }, + { + desc: "histogram with invalid span context exemplar", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/histogram-a", + Description: "a testing histogram", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeCumulativeDistribution, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{ + Count: 8, + Sum: 100.0, + BucketOptions: &ocmetricdata.BucketOptions{ + Bounds: []float64{1.0, 2.0, 3.0}, + }, + Buckets: []ocmetricdata.Bucket{ + { + Count: 1, + Exemplar: &ocmetricdata.Exemplar{ + Value: 0.8, + Timestamp: exemplarTime, + Attachments: map[string]interface{}{ + ocmetricdata.AttachmentKeySpanContext: "notaspancontext", + }, + }, + }, + }, + }), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errInvalidExemplarSpanContext, + }, { desc: "sum with non-sum datapoint type", input: []*ocmetricdata.Metric{ @@ -640,3 +802,176 @@ func TestConvertAttributes(t *testing.T) { }) } } + +type fakeStringer string + +func (f fakeStringer) String() string { + return string(f) +} + +func TestConvertKV(t *testing.T) { + key := "foo" + for _, tt := range []struct { + value any + expected attribute.Value + }{ + { + value: bool(true), + expected: attribute.BoolValue(true), + }, + { + value: []bool{true, false}, + expected: attribute.BoolSliceValue([]bool{true, false}), + }, + { + value: int(10), + expected: attribute.IntValue(10), + }, + { + value: []int{10, 20}, + expected: attribute.IntSliceValue([]int{10, 20}), + }, + { + value: int8(10), + expected: attribute.IntValue(10), + }, + { + value: []int8{10, 20}, + expected: attribute.IntSliceValue([]int{10, 20}), + }, + { + value: int16(10), + expected: attribute.IntValue(10), + }, + { + value: []int16{10, 20}, + expected: attribute.IntSliceValue([]int{10, 20}), + }, + { + value: int32(10), + expected: attribute.IntValue(10), + }, + { + value: []int32{10, 20}, + expected: attribute.IntSliceValue([]int{10, 20}), + }, + { + value: int64(10), + expected: attribute.Int64Value(10), + }, + { + value: []int64{10, 20}, + expected: attribute.Int64SliceValue([]int64{10, 20}), + }, + { + value: uint(10), + expected: attribute.IntValue(10), + }, + { + value: uint(math.MaxUint), + expected: attribute.StringValue(fmt.Sprintf("%v", uint(math.MaxUint))), + }, + { + value: []uint{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: uint8(10), + expected: attribute.IntValue(10), + }, + { + value: []uint8{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: uint16(10), + expected: attribute.IntValue(10), + }, + { + value: []uint16{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: uint32(10), + expected: attribute.IntValue(10), + }, + { + value: []uint32{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: uint64(10), + expected: attribute.Int64Value(10), + }, + { + value: uint64(math.MaxUint64), + expected: attribute.StringValue("18446744073709551615"), + }, + { + value: []uint64{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: uintptr(10), + expected: attribute.Int64Value(10), + }, + { + value: []uintptr{10, 20}, + expected: attribute.StringSliceValue([]string{"10", "20"}), + }, + { + value: float32(10), + expected: attribute.Float64Value(10), + }, + { + value: []float32{10, 20}, + expected: attribute.Float64SliceValue([]float64{10, 20}), + }, + { + value: float64(10), + expected: attribute.Float64Value(10), + }, + { + value: []float64{10, 20}, + expected: attribute.Float64SliceValue([]float64{10, 20}), + }, + { + value: complex64(10), + expected: attribute.StringValue("(10+0i)"), + }, + { + value: []complex64{10, 20}, + expected: attribute.StringSliceValue([]string{"(10+0i)", "(20+0i)"}), + }, + { + value: complex128(10), + expected: attribute.StringValue("(10+0i)"), + }, + { + value: []complex128{10, 20}, + expected: attribute.StringSliceValue([]string{"(10+0i)", "(20+0i)"}), + }, + { + value: "string", + expected: attribute.StringValue("string"), + }, + { + value: []string{"string", "slice"}, + expected: attribute.StringSliceValue([]string{"string", "slice"}), + }, + { + value: fakeStringer("stringer"), + expected: attribute.StringValue("stringer"), + }, + { + value: metricdata.Histogram[float64]{}, + expected: attribute.StringValue("unhandled attribute value: {DataPoints:[] Temporality:undefinedTemporality}"), + }, + } { + t.Run(fmt.Sprintf("%v(%+v)", reflect.TypeOf(tt.value), tt.value), func(t *testing.T) { + got := convertKV(key, tt.value) + assert.Equal(t, key, string(got.Key)) + assert.Equal(t, tt.expected, got.Value) + }) + } +} From fcc1129d0a95e260846d014cde649fc51d7eb34b Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 29 Oct 2023 16:33:40 +0100 Subject: [PATCH 747/886] dependabot updates Sun Oct 29 15:19:32 UTC 2023 (#4678) Bump go.uber.org/goleak from 1.2.1 to 1.3.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/golangci/golangci-lint from 1.55.0 to 1.55.1 in /internal/tools Bump github.com/go-logr/logr from 1.2.4 to 1.3.0 in /exporters/zipkin Bump github.com/go-logr/logr from 1.2.4 to 1.3.0 in /sdk Bump github.com/go-logr/logr from 1.2.4 to 1.3.0 in /sdk/metric Bump github.com/go-logr/logr from 1.2.4 to 1.3.0 --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 6 +++--- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 8 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- internal/tools/go.mod | 6 +++--- internal/tools/go.sum | 16 ++++++++-------- metric/go.mod | 2 +- metric/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 54 files changed, 93 insertions(+), 93 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 97f5c9c354f..ada92f8905c 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 4cc565dcb2c..cfd56fdeaf4 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 34c82b77b72..988f35c4ad4 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 7baaf57f64a..22d79bd60ac 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index a225a4016cd..a2c002c8dce 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index 6a160f91b23..b79c74aee78 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 3871051fa8f..f8ebb53982d 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index aa59774d343..bc6445d1064 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/dice/go.mod b/example/dice/go.mod index 0a5d70c24cb..77870b87245 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/felixge/httpsnoop v1.0.3 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect diff --git a/example/dice/go.sum b/example/dice/go.sum index a3f42f4ce58..081d765f395 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/fib/go.mod b/example/fib/go.mod index 553ec4b460b..50fab762f7b 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect diff --git a/example/fib/go.sum b/example/fib/go.sum index cff0c4e4f6f..b9ab5f187ca 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index caf9a21e958..2d605717d90 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect ) diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index cff0c4e4f6f..b9ab5f187ca 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 1893db97599..f7fd9988954 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -19,7 +19,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 7baaf57f64a..22d79bd60ac 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e5f9623ea83..a92ca308082 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index ce0274745ce..37fc941ac8d 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -2,8 +2,8 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -18,7 +18,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index e9340c5a727..7adcfe6b8f5 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -10,7 +10,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index cff0c4e4f6f..b9ab5f187ca 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b2c201160a5..22c43d78c3e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index a0c02df46d0..cc5158e6358 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -4,8 +4,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/example/view/go.mod b/example/view/go.mod index 2bafabc9946..44ebb34ada3 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect diff --git a/example/view/go.sum b/example/view/go.sum index a0c02df46d0..cc5158e6358 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -4,8 +4,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 13ac0462a51..0639e39dfa0 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index b3536f70884..3d6a146da21 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f203a4ab5ea..d3b8a363521 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -19,7 +19,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 1affe0e2e04..fd64699a3da 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 056b3fcf7e4..aa82f47c5b1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 1affe0e2e04..fd64699a3da 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 03032389c8e..2637b9fdc39 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 61d6a3139a5..13a8066f050 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -2,8 +2,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 665c14c1be5..b698f6dbb49 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/proto/otlp v1.0.0 - go.uber.org/goleak v1.2.1 + go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -18,7 +18,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 7219e0282b8..6e4e3d2efed 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -26,8 +26,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= -go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index db257a0d1ec..0b4250ede74 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 56a7834fcc6..ba00a88a8c6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 5917219f473..25e6ee905d9 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -17,7 +17,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 0d1e9384cd9..c4e4936dd4d 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index f7f2a53b3ad..6e69978beb8 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -11,7 +11,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 923cb680d72..73576f88625 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index ef74ae0f273..e333f236abb 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 923cb680d72..73576f88625 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index e8707828afd..57e6abf3f16 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.20 require ( - github.com/go-logr/logr v1.2.4 + github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 65a10a4d219..a0c2f816860 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/go.mod b/go.mod index 72444a58105..501dbba66e0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel go 1.20 require ( - github.com/go-logr/logr v1.2.4 + github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 3abcad55071..95b35a74664 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 408b33aa119..81a9f49c497 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.55.0 + github.com/golangci/golangci-lint v1.55.1 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.5.1 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -93,7 +93,7 @@ require ( github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect github.com/golangci/misspell v0.4.1 // indirect - github.com/golangci/revgrep v0.5.0 // indirect + github.com/golangci/revgrep v0.5.2 // indirect github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect @@ -161,7 +161,7 @@ require ( github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect - github.com/securego/gosec/v2 v2.18.1 // indirect + github.com/securego/gosec/v2 v2.18.2 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect github.com/sirupsen/logrus v1.9.3 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index afe903732b1..4a2ce0be0fc 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -259,16 +259,16 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.55.0 h1:ePpc6YhM1ZV8kHU8dwmHDHAdeedZHdK8cmTXlkkRdi8= -github.com/golangci/golangci-lint v1.55.0/go.mod h1:Z/OawFQ4yqFo2/plDYlIjoZlJeVYkRcqS9dW55p0FXg= +github.com/golangci/golangci-lint v1.55.1 h1:DL2j9Eeapg1N3WEkKnQFX5L40SYtjZZJjGVdyEgNrDc= +github.com/golangci/golangci-lint v1.55.1/go.mod h1:z00biPRqjo5MISKV1+RWgONf2KvrPDmfqxHpHKB6bI4= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g= github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI= -github.com/golangci/revgrep v0.5.0 h1:GGBqHFtFOeHiSUQtFVZXPJtVZYOGB4iVlAjaoFRBQvY= -github.com/golangci/revgrep v0.5.0/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA= +github.com/golangci/revgrep v0.5.2 h1:EndcWoRhcnfj2NHQ+28hyuXpLMF+dQmCN+YaeeIl4FU= +github.com/golangci/revgrep v0.5.2/go.mod h1:bjAMA+Sh/QUfTDcHzxfyHxr4xKvllVr/0sCv2e7jJHA= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -447,8 +447,8 @@ github.com/nunnatsa/ginkgolinter v0.14.0 h1:XQPNmw+kZz5cC/HbFK3mQutpjzAQv1dHregR github.com/nunnatsa/ginkgolinter v0.14.0/go.mod h1:cm2xaqCUCRd7qcP4DqbVvpcyEMkuLM9CF0wY6VASohk= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.12.1 h1:uHNEO1RP2SpuZApSkel9nEh1/Mu+hmQe7Q+Pepg5OYA= -github.com/onsi/gomega v1.28.0 h1:i2rg/p9n/UqIDAMFUJ6qIUUMcsqOuUHgbpbu235Vr1c= +github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/gomega v1.28.1 h1:MijcGUbfYuznzK/5R4CPNoUP/9Xvuo20sXfEm6XxoTA= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -518,8 +518,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.24.0 h1:MKNzmXtGh5N0y74Z/CIaJh4GlB364l0K1RUT08WSWAc= github.com/sashamelentyev/usestdlibvars v1.24.0/go.mod h1:9cYkq+gYJ+a5W2RPdhfaSCnTVUC1OQP/bSiiBhq3OZE= -github.com/securego/gosec/v2 v2.18.1 h1:xnnehWg7dIW8qrRPGm8ykY21zp2MueKyC99Vlcuj96I= -github.com/securego/gosec/v2 v2.18.1/go.mod h1:ZUTcKD9gAFip1lLGHWCjkoBQJyaEzePTNzjwlL2HHoE= +github.com/securego/gosec/v2 v2.18.2 h1:DkDt3wCiOtAHf1XkiXZBhQ6m6mK/b9T/wD257R3/c+I= +github.com/securego/gosec/v2 v2.18.2/go.mod h1:xUuqSF6i0So56Y2wwohWAmB07EdBkUN6crbLlHwbyJs= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= diff --git a/metric/go.mod b/metric/go.mod index 9579b924641..78a763ef2da 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,7 +9,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect diff --git a/metric/go.sum b/metric/go.sum index db6b079126b..130a4f410be 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/sdk/go.mod b/sdk/go.mod index 95a3e3f6630..a708aa4e4e2 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,7 +5,7 @@ go 1.20 replace go.opentelemetry.io/otel => ../ require ( - github.com/go-logr/logr v1.2.4 + github.com/go-logr/logr v1.3.0 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 diff --git a/sdk/go.sum b/sdk/go.sum index 64648d865c7..4e223a1a143 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 147a7ad45cf..c7dc67d5fcd 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/sdk/metric go 1.20 require ( - github.com/go-logr/logr v1.2.4 + github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 923cb680d72..73576f88625 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= From 509c23eb739eebd29b8a97b823c98e8caa62c3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 30 Oct 2023 19:59:57 +0100 Subject: [PATCH 748/886] otlptracehttp, otlpmetrichttp: Retry for 502, 504 HTTP statuses (#4670) --- CHANGELOG.md | 2 ++ exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 5 ++++- .../otlp/otlpmetric/otlpmetrichttp/client_test.go | 12 ++++++++++-- exporters/otlp/otlptrace/otlptracehttp/client.go | 5 ++++- .../otlp/otlptrace/otlptracehttp/client_test.go | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15c90b0c6c8..47f14e879dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) +- Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) ### Fixed diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 385965a9363..af2e40d2782 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -178,7 +178,10 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou } } return nil - case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable: + case sc == http.StatusTooManyRequests, + sc == http.StatusBadGateway, + sc == http.StatusServiceUnavailable, + sc == http.StatusGatewayTimeout: // Retry-able failure. rErr = newResponseError(resp.Header) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 88cc5be9ee2..b14e10c3419 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -127,9 +127,9 @@ func TestConfig(t *testing.T) { t.Run("WithRetry", func(t *testing.T) { emptyErr := errors.New("") - rCh := make(chan otest.ExportResult, 3) + rCh := make(chan otest.ExportResult, 5) header := http.Header{http.CanonicalHeaderKey("Retry-After"): {"10"}} - // Both retryable errors. + // All retryable errors. rCh <- otest.ExportResult{Err: &otest.HTTPResponseError{ Status: http.StatusServiceUnavailable, Err: emptyErr, @@ -139,6 +139,14 @@ func TestConfig(t *testing.T) { Status: http.StatusTooManyRequests, Err: emptyErr, }} + rCh <- otest.ExportResult{Err: &otest.HTTPResponseError{ + Status: http.StatusGatewayTimeout, + Err: emptyErr, + }} + rCh <- otest.ExportResult{Err: &otest.HTTPResponseError{ + Status: http.StatusBadGateway, + Err: emptyErr, + }} rCh <- otest.ExportResult{} exp, coll := factoryFunc("", rCh, WithRetry(RetryConfig{ Enabled: true, diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 3a3cfec0cde..0990b88f147 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -190,7 +190,10 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc } return nil - case sc == http.StatusTooManyRequests, sc == http.StatusServiceUnavailable: + case sc == http.StatusTooManyRequests, + sc == http.StatusBadGateway, + sc == http.StatusServiceUnavailable, + sc == http.StatusGatewayTimeout: // Retry-able failures. Drain the body to reuse the connection. if _, err := io.Copy(io.Discard, resp.Body); err != nil { otel.Handle(err) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 2020b15058b..1fb58fcb69a 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -95,7 +95,7 @@ func TestEndToEnd(t *testing.T) { }), }, mcCfg: mockCollectorConfig{ - InjectHTTPStatus: []int{503, 503}, + InjectHTTPStatus: []int{503, 502}, }, }, { @@ -110,7 +110,7 @@ func TestEndToEnd(t *testing.T) { }), }, mcCfg: mockCollectorConfig{ - InjectHTTPStatus: []int{503}, + InjectHTTPStatus: []int{504}, InjectResponseHeader: []map[string]string{ {"Retry-After": "10"}, }, From aea3eab43af4b38c4da77f7016f1a20e2ad6fead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 30 Oct 2023 22:03:55 +0100 Subject: [PATCH 749/886] otlptracegrpc, otlpmetricgrpc: Retry for RESOURCE_EXHAUSTED only if RetryInfo is returned (#4669) --- CHANGELOG.md | 2 + .../otlp/otlpmetric/otlpmetricgrpc/client.go | 22 +++++--- .../otlpmetric/otlpmetricgrpc/client_test.go | 44 ++++++++++++---- .../otlp/otlptrace/otlptracegrpc/client.go | 22 +++++--- .../otlptracegrpc/client_unit_test.go | 52 +++++++++++++------ 5 files changed, 102 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47f14e879dd..596adea6944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) - Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) +- Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) ### Fixed diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go index fe1ab3709a7..16f9af12b66 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client.go @@ -176,28 +176,36 @@ func (c *client) exportContext(parent context.Context) (context.Context, context // duration to wait for if an explicit throttle time is included in err. func retryable(err error) (bool, time.Duration) { s := status.Convert(err) + return retryableGRPCStatus(s) +} + +func retryableGRPCStatus(s *status.Status) (bool, time.Duration) { switch s.Code() { case codes.Canceled, codes.DeadlineExceeded, - codes.ResourceExhausted, codes.Aborted, codes.OutOfRange, codes.Unavailable, codes.DataLoss: - return true, throttleDelay(s) + // Additionally, handle RetryInfo. + _, d := throttleDelay(s) + return true, d + case codes.ResourceExhausted: + // Retry only if the server signals that the recovery from resource exhaustion is possible. + return throttleDelay(s) } // Not a retry-able error. return false, 0 } -// throttleDelay returns a duration to wait for if an explicit throttle time -// is included in the response status. -func throttleDelay(s *status.Status) time.Duration { +// throttleDelay returns if the status is RetryInfo +// and the duration to wait for if an explicit throttle time is included. +func throttleDelay(s *status.Status) (bool, time.Duration) { for _, detail := range s.Details() { if t, ok := detail.(*errdetails.RetryInfo); ok { - return t.RetryDelay.AsDuration() + return true, t.RetryDelay.AsDuration() } } - return 0 + return false, 0 } diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 1e1b3527d79..03f07d69991 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -33,15 +33,17 @@ import ( "go.opentelemetry.io/otel/sdk/metric/metricdata" ) -func TestThrottleDuration(t *testing.T) { +func TestThrottleDelay(t *testing.T) { c := codes.ResourceExhausted testcases := []struct { - status *status.Status - expected time.Duration + status *status.Status + wantOK bool + wantDuration time.Duration }{ { - status: status.New(c, "NoRetryInfo"), - expected: 0, + status: status.New(c, "NoRetryInfo"), + wantOK: false, + wantDuration: 0, }, { status: func() *status.Status { @@ -53,7 +55,8 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 15 * time.Millisecond, + wantOK: true, + wantDuration: 15 * time.Millisecond, }, { status: func() *status.Status { @@ -63,7 +66,8 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 0, + wantOK: false, + wantDuration: 0, }, { status: func() *status.Status { @@ -76,7 +80,8 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 13 * time.Minute, + wantOK: true, + wantDuration: 13 * time.Minute, }, { status: func() *status.Status { @@ -91,13 +96,16 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 13 * time.Minute, + wantOK: true, + wantDuration: 13 * time.Minute, }, } for _, tc := range testcases { t.Run(tc.status.Message(), func(t *testing.T) { - require.Equal(t, tc.expected, throttleDelay(tc.status)) + ok, d := throttleDelay(tc.status) + assert.Equal(t, tc.wantOK, ok) + assert.Equal(t, tc.wantDuration, d) }) } } @@ -112,7 +120,7 @@ func TestRetryable(t *testing.T) { codes.NotFound: false, codes.AlreadyExists: false, codes.PermissionDenied: false, - codes.ResourceExhausted: true, + codes.ResourceExhausted: false, codes.FailedPrecondition: false, codes.Aborted: true, codes.OutOfRange: true, @@ -129,6 +137,20 @@ func TestRetryable(t *testing.T) { } } +func TestRetryableGRPCStatusResourceExhaustedWithRetryInfo(t *testing.T) { + delay := 15 * time.Millisecond + s, err := status.New(codes.ResourceExhausted, "WithRetryInfo").WithDetails( + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(delay), + }, + ) + require.NoError(t, err) + + ok, d := retryableGRPCStatus(s) + assert.True(t, ok) + assert.Equal(t, delay, d) +} + type clientShim struct { *client } diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index 86fb61a0dec..b4cc21d7a3c 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -260,30 +260,38 @@ func (c *client) exportContext(parent context.Context) (context.Context, context // duration to wait for if an explicit throttle time is included in err. func retryable(err error) (bool, time.Duration) { s := status.Convert(err) + return retryableGRPCStatus(s) +} + +func retryableGRPCStatus(s *status.Status) (bool, time.Duration) { switch s.Code() { case codes.Canceled, codes.DeadlineExceeded, - codes.ResourceExhausted, codes.Aborted, codes.OutOfRange, codes.Unavailable, codes.DataLoss: - return true, throttleDelay(s) + // Additionally handle RetryInfo. + _, d := throttleDelay(s) + return true, d + case codes.ResourceExhausted: + // Retry only if the server signals that the recovery from resource exhaustion is possible. + return throttleDelay(s) } // Not a retry-able error. return false, 0 } -// throttleDelay returns a duration to wait for if an explicit throttle time -// is included in the response status. -func throttleDelay(s *status.Status) time.Duration { +// throttleDelay returns of the status is RetryInfo +// and the its duration to wait for if an explicit throttle time. +func throttleDelay(s *status.Status) (bool, time.Duration) { for _, detail := range s.Details() { if t, ok := detail.(*errdetails.RetryInfo); ok { - return t.RetryDelay.AsDuration() + return true, t.RetryDelay.AsDuration() } } - return 0 + return false, 0 } // MarshalLog is the marshaling function used by the logging system to represent this Client. diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go index 5c43df1e322..df27a208daf 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_unit_test.go @@ -27,19 +27,21 @@ import ( "google.golang.org/protobuf/types/known/durationpb" ) -func TestThrottleDuration(t *testing.T) { +func TestThrottleDelay(t *testing.T) { c := codes.ResourceExhausted testcases := []struct { - status *status.Status - expected time.Duration + status *status.Status + wantOK bool + wantDuration time.Duration }{ { - status: status.New(c, "no retry info"), - expected: 0, + status: status.New(c, "NoRetryInfo"), + wantOK: false, + wantDuration: 0, }, { status: func() *status.Status { - s, err := status.New(c, "single retry info").WithDetails( + s, err := status.New(c, "SingleRetryInfo").WithDetails( &errdetails.RetryInfo{ RetryDelay: durationpb.New(15 * time.Millisecond), }, @@ -47,21 +49,23 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 15 * time.Millisecond, + wantOK: true, + wantDuration: 15 * time.Millisecond, }, { status: func() *status.Status { - s, err := status.New(c, "error info").WithDetails( + s, err := status.New(c, "ErrorInfo").WithDetails( &errdetails.ErrorInfo{Reason: "no throttle detail"}, ) require.NoError(t, err) return s }(), - expected: 0, + wantOK: false, + wantDuration: 0, }, { status: func() *status.Status { - s, err := status.New(c, "error and retry info").WithDetails( + s, err := status.New(c, "ErrorAndRetryInfo").WithDetails( &errdetails.ErrorInfo{Reason: "with throttle detail"}, &errdetails.RetryInfo{ RetryDelay: durationpb.New(13 * time.Minute), @@ -70,11 +74,12 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 13 * time.Minute, + wantOK: true, + wantDuration: 13 * time.Minute, }, { status: func() *status.Status { - s, err := status.New(c, "double retry info").WithDetails( + s, err := status.New(c, "DoubleRetryInfo").WithDetails( &errdetails.RetryInfo{ RetryDelay: durationpb.New(13 * time.Minute), }, @@ -85,13 +90,16 @@ func TestThrottleDuration(t *testing.T) { require.NoError(t, err) return s }(), - expected: 13 * time.Minute, + wantOK: true, + wantDuration: 13 * time.Minute, }, } for _, tc := range testcases { t.Run(tc.status.Message(), func(t *testing.T) { - require.Equal(t, tc.expected, throttleDelay(tc.status)) + ok, d := throttleDelay(tc.status) + assert.Equal(t, tc.wantOK, ok) + assert.Equal(t, tc.wantDuration, d) }) } } @@ -106,7 +114,7 @@ func TestRetryable(t *testing.T) { codes.NotFound: false, codes.AlreadyExists: false, codes.PermissionDenied: false, - codes.ResourceExhausted: true, + codes.ResourceExhausted: false, codes.FailedPrecondition: false, codes.Aborted: true, codes.OutOfRange: true, @@ -123,6 +131,20 @@ func TestRetryable(t *testing.T) { } } +func TestRetryableGRPCStatusResourceExhaustedWithRetryInfo(t *testing.T) { + delay := 15 * time.Millisecond + s, err := status.New(codes.ResourceExhausted, "WithRetryInfo").WithDetails( + &errdetails.RetryInfo{ + RetryDelay: durationpb.New(delay), + }, + ) + require.NoError(t, err) + + ok, d := retryableGRPCStatus(s) + assert.True(t, ok) + assert.Equal(t, delay, d) +} + func TestUnstartedStop(t *testing.T) { client := NewClient() assert.ErrorIs(t, client.Stop(context.Background()), errAlreadyStopped) From 5ec67e83df77751b6c5e6d386b4047d5d813e546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 31 Oct 2023 08:06:25 +0100 Subject: [PATCH 750/886] otlptracehttp, otlpmetrichttp: Retry temporary HTTP request failures (#4679) --- CHANGELOG.md | 2 ++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 5 +++++ .../otlpmetric/otlpmetrichttp/client_test.go | 20 ++++++++----------- .../otlp/otlptrace/otlptracehttp/client.go | 5 +++++ .../otlptrace/otlptracehttp/client_test.go | 6 ++---- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 596adea6944..a77f0e24665 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4670) - Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4669) - Retry for `RESOURCE_EXHAUSTED` only if RetryInfo is returned in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4669) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4679) +- Retry temporary HTTP request failures in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4679) ### Fixed diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index af2e40d2782..7cc6f6ae7bb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -18,6 +18,7 @@ import ( "bytes" "compress/gzip" "context" + "errors" "fmt" "io" "net" @@ -147,6 +148,10 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou request.reset(iCtx) resp, err := c.httpClient.Do(request.Request) + var urlErr *url.Error + if errors.As(err, &urlErr) && urlErr.Temporary() { + return newResponseError(http.Header{}) + } if err != nil { return err } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index b14e10c3419..2f48f472748 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -65,6 +65,13 @@ func TestClient(t *testing.T) { t.Run("Integration", otest.RunClientTests(factory)) } +func TestNewWithInvalidEndpoint(t *testing.T) { + ctx := context.Background() + exp, err := New(ctx, WithEndpoint("host:invalid-port")) + assert.Error(t, err) + assert.Nil(t, exp) +} + func TestConfig(t *testing.T) { factoryFunc := func(ePt string, rCh <-chan otest.ExportResult, o ...Option) (metric.Exporter, *otest.HTTPCollector) { coll, err := otest.NewHTTPCollector(ePt, rCh) @@ -113,7 +120,7 @@ func TestConfig(t *testing.T) { t.Cleanup(func() { close(rCh) }) t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) err := exp.Export(ctx, &metricdata.ResourceMetrics{}) - assert.ErrorContains(t, err, context.DeadlineExceeded.Error()) + assert.ErrorAs(t, err, new(retryableError)) }) t.Run("WithCompressionGZip", func(t *testing.T) { @@ -174,17 +181,6 @@ func TestConfig(t *testing.T) { assert.Len(t, coll.Collect().Dump(), 1) }) - t.Run("WithURLPath", func(t *testing.T) { - path := "/prefix/v2/metrics" - ePt := fmt.Sprintf("http://localhost:0%s", path) - exp, coll := factoryFunc(ePt, nil, WithURLPath(path)) - ctx := context.Background() - t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) - t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) - assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) - assert.Len(t, coll.Collect().Dump(), 1) - }) - t.Run("WithTLSClientConfig", func(t *testing.T) { ePt := "https://localhost:0" tlsCfg := &tls.Config{InsecureSkipVerify: true} diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 0990b88f147..068aef300ee 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -18,6 +18,7 @@ import ( "bytes" "compress/gzip" "context" + "errors" "fmt" "io" "net" @@ -152,6 +153,10 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc request.reset(ctx) resp, err := d.client.Do(request.Request) + var urlErr *url.Error + if errors.As(err, &urlErr) && urlErr.Temporary() { + return newResponseError(http.Header{}) + } if err != nil { return err } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 1fb58fcb69a..21838695c5e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -19,7 +19,6 @@ import ( "errors" "fmt" "net/http" - "os" "strings" "testing" "time" @@ -213,6 +212,7 @@ func TestTimeout(t *testing.T) { otlptracehttp.WithEndpoint(mc.Endpoint()), otlptracehttp.WithInsecure(), otlptracehttp.WithTimeout(time.Nanosecond), + otlptracehttp.WithRetry(otlptracehttp.RetryConfig{Enabled: false}), ) ctx := context.Background() exporter, err := otlptrace.New(ctx, client) @@ -221,9 +221,7 @@ func TestTimeout(t *testing.T) { assert.NoError(t, exporter.Shutdown(ctx)) }() err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) - unwrapped := errors.Unwrap(err) - assert.Equalf(t, true, os.IsTimeout(unwrapped), "expected timeout error, got: %v", unwrapped) - assert.True(t, strings.HasPrefix(err.Error(), "traces export: "), err) + assert.ErrorContains(t, err, "retry-able request failure") } func TestNoRetry(t *testing.T) { From b2bb2ad00f13ef12bb96fe2aa4b7fc5bcdd75bd9 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 31 Oct 2023 03:41:27 -0400 Subject: [PATCH 751/886] Implement WithExplicitBucketBoundaries option in the metric SDK (#4605) --- CHANGELOG.md | 1 + sdk/metric/meter.go | 54 ++++++++++++++++-- sdk/metric/meter_test.go | 83 ++++++++++++++++++++++++++++ sdk/metric/pipeline.go | 81 ++++++++++++++++++--------- sdk/metric/pipeline_registry_test.go | 36 +++++++++++- sdk/metric/pipeline_test.go | 8 ++- 6 files changed, 229 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a77f0e24665..97b79b2b460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `Version` function in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4660) - Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) - `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) +- Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) ### Deprecated diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 0c17dfb20a5..7f51ec512ad 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -95,9 +95,8 @@ func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCou // distribution of int64 measurements during a computational operation. func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) { cfg := metric.NewInt64HistogramConfig(options...) - const kind = InstrumentKindHistogram p := int64InstProvider{m} - i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := p.lookupHistogram(name, cfg) if err != nil { return i, err } @@ -188,9 +187,8 @@ func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDow // distribution of float64 measurements during a computational operation. func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) { cfg := metric.NewFloat64HistogramConfig(options...) - const kind = InstrumentKindHistogram p := float64InstProvider{m} - i, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) + i, err := p.lookupHistogram(name, cfg) if err != nil { return i, err } @@ -456,12 +454,36 @@ func (p int64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([]ag return p.int64Resolver.Aggregators(inst) } +func (p int64InstProvider) histogramAggs(name string, cfg metric.Int64HistogramConfig) ([]aggregate.Measure[int64], error) { + boundaries := cfg.ExplicitBucketBoundaries() + aggError := AggregationExplicitBucketHistogram{Boundaries: boundaries}.err() + if aggError != nil { + // If boundaries are invalid, ignore them. + boundaries = nil + } + inst := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + Scope: p.scope, + } + measures, err := p.int64Resolver.HistogramAggregators(inst, boundaries) + return measures, errors.Join(aggError, err) +} + // lookup returns the resolved instrumentImpl. func (p int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) return &int64Inst{measures: aggs}, err } +// lookupHistogram returns the resolved instrumentImpl. +func (p int64InstProvider) lookupHistogram(name string, cfg metric.Int64HistogramConfig) (*int64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &int64Inst{measures: aggs}, err +} + // float64InstProvider provides float64 OpenTelemetry instruments. type float64InstProvider struct{ *meter } @@ -476,12 +498,36 @@ func (p float64InstProvider) aggs(kind InstrumentKind, name, desc, u string) ([] return p.float64Resolver.Aggregators(inst) } +func (p float64InstProvider) histogramAggs(name string, cfg metric.Float64HistogramConfig) ([]aggregate.Measure[float64], error) { + boundaries := cfg.ExplicitBucketBoundaries() + aggError := AggregationExplicitBucketHistogram{Boundaries: boundaries}.err() + if aggError != nil { + // If boundaries are invalid, ignore them. + boundaries = nil + } + inst := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + Scope: p.scope, + } + measures, err := p.float64Resolver.HistogramAggregators(inst, boundaries) + return measures, errors.Join(aggError, err) +} + // lookup returns the resolved instrumentImpl. func (p float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { aggs, err := p.aggs(kind, name, desc, u) return &float64Inst{measures: aggs}, err } +// lookupHistogram returns the resolved instrumentImpl. +func (p float64InstProvider) lookupHistogram(name string, cfg metric.Float64HistogramConfig) (*float64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &float64Inst{measures: aggs}, err +} + type int64ObservProvider struct{ *meter } func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index e2b2a5938fd..0e082a7be06 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -16,6 +16,7 @@ package metric import ( "context" + "errors" "fmt" "strings" "sync" @@ -550,6 +551,17 @@ func TestMeterCreatesInstrumentsValidations(t *testing.T) { wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), }, + { + name: "Int64Histogram with invalid buckets", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Int64Histogram("histogram", metric.WithExplicitBucketBoundaries(-1, 1, -5)) + assert.NotNil(t, i) + return err + }, + + wantErr: errors.Join(fmt.Errorf("%w: non-monotonic boundaries: %v", errHist, []float64{-1, 1, -5})), + }, { name: "Int64ObservableCounter with no validation issues", @@ -670,6 +682,17 @@ func TestMeterCreatesInstrumentsValidations(t *testing.T) { wantErr: fmt.Errorf("%w: _: must start with a letter", ErrInstrumentName), }, + { + name: "Float64Histogram with invalid buckets", + + fn: func(t *testing.T, m metric.Meter) error { + i, err := m.Float64Histogram("histogram", metric.WithExplicitBucketBoundaries(-1, 1, -5)) + assert.NotNil(t, i) + return err + }, + + wantErr: errors.Join(fmt.Errorf("%w: non-monotonic boundaries: %v", errHist, []float64{-1, 1, -5})), + }, { name: "Float64ObservableCounter with no validation issues", @@ -1970,3 +1993,63 @@ func TestMalformedSelectors(t *testing.T) { }) } } + +func TestHistogramBucketPrecedenceOrdering(t *testing.T) { + defaultBuckets := []float64{0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000} + aggregationSelector := func(InstrumentKind) Aggregation { + return AggregationExplicitBucketHistogram{Boundaries: []float64{0, 1, 2, 3, 4, 5}} + } + for _, tt := range []struct { + desc string + reader Reader + views []View + histogramOpts []metric.Float64HistogramOption + expectedBucketBoundaries []float64 + }{ + { + desc: "default", + reader: NewManualReader(), + expectedBucketBoundaries: defaultBuckets, + }, + { + desc: "custom reader aggregation overrides default", + reader: NewManualReader(WithAggregationSelector(aggregationSelector)), + expectedBucketBoundaries: []float64{0, 1, 2, 3, 4, 5}, + }, + { + desc: "overridden by histogram option", + reader: NewManualReader(WithAggregationSelector(aggregationSelector)), + histogramOpts: []metric.Float64HistogramOption{ + metric.WithExplicitBucketBoundaries(0, 2, 4, 6, 8, 10), + }, + expectedBucketBoundaries: []float64{0, 2, 4, 6, 8, 10}, + }, + { + desc: "overridden by view", + reader: NewManualReader(WithAggregationSelector(aggregationSelector)), + histogramOpts: []metric.Float64HistogramOption{ + metric.WithExplicitBucketBoundaries(0, 2, 4, 6, 8, 10), + }, + views: []View{NewView(Instrument{Name: "*"}, Stream{ + Aggregation: AggregationExplicitBucketHistogram{Boundaries: []float64{0, 3, 6, 9, 12, 15}}, + })}, + expectedBucketBoundaries: []float64{0, 3, 6, 9, 12, 15}, + }, + } { + t.Run(tt.desc, func(t *testing.T) { + meter := NewMeterProvider(WithView(tt.views...), WithReader(tt.reader)).Meter("TestHistogramBucketPrecedenceOrdering") + sfHistogram, err := meter.Float64Histogram("sync.float64.histogram", tt.histogramOpts...) + require.NoError(t, err) + sfHistogram.Record(context.Background(), 1) + var rm metricdata.ResourceMetrics + err = tt.reader.Collect(context.Background(), &rm) + require.NoError(t, err) + require.Len(t, rm.ScopeMetrics, 1) + require.Len(t, rm.ScopeMetrics[0].Metrics, 1) + gotHist, ok := rm.ScopeMetrics[0].Metrics[0].Data.(metricdata.Histogram[float64]) + require.True(t, ok) + require.Len(t, gotHist.DataPoints, 1) + assert.Equal(t, tt.expectedBucketBoundaries, gotHist.DataPoints[0].Bounds) + }) + } +} diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index c1597a75597..48abcc8a7f3 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -231,7 +231,7 @@ func newInserter[N int64 | float64](p *pipeline, vc *cache[string, instID]) *ins // // If an instrument is determined to use a Drop aggregation, that instrument is // not inserted nor returned. -func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error) { +func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) ([]aggregate.Measure[N], error) { var ( matched bool measures []aggregate.Measure[N] @@ -245,8 +245,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error continue } matched = true - - in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) + in, id, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) if err != nil { errs.append(err) } @@ -271,7 +270,7 @@ func (i *inserter[N]) Instrument(inst Instrument) ([]aggregate.Measure[N], error Description: inst.Description, Unit: inst.Unit, } - in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream) + in, _, err := i.cachedAggregator(inst.Scope, inst.Kind, stream, readerAggregation) if err != nil { errs.append(err) } @@ -291,6 +290,31 @@ type aggVal[N int64 | float64] struct { Err error } +// readerDefaultAggregation returns the default aggregation for the instrument +// kind based on the reader's aggregation preferences. This is used unless the +// aggregation is overridden with a view. +func (i *inserter[N]) readerDefaultAggregation(kind InstrumentKind) Aggregation { + aggregation := i.pipeline.reader.aggregation(kind) + switch aggregation.(type) { + case nil, AggregationDefault: + // If the reader returns default or nil use the default selector. + aggregation = DefaultAggregationSelector(kind) + default: + // Deep copy and validate before using. + aggregation = aggregation.copy() + if err := aggregation.err(); err != nil { + orig := aggregation + aggregation = DefaultAggregationSelector(kind) + global.Error( + err, "using default aggregation instead", + "aggregation", orig, + "replacement", aggregation, + ) + } + } + return aggregation +} + // cachedAggregator returns the appropriate aggregate input and output // functions for an instrument configuration. If the exact instrument has been // created within the inst.Scope, those aggregate function instances will be @@ -305,29 +329,14 @@ type aggVal[N int64 | float64] struct { // // If the instrument defines an unknown or incompatible aggregation, an error // is returned. -func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream) (meas aggregate.Measure[N], aggID uint64, err error) { +func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind InstrumentKind, stream Stream, readerAggregation Aggregation) (meas aggregate.Measure[N], aggID uint64, err error) { switch stream.Aggregation.(type) { case nil: - // Undefined, nil, means to use the default from the reader. - stream.Aggregation = i.pipeline.reader.aggregation(kind) - switch stream.Aggregation.(type) { - case nil, AggregationDefault: - // If the reader returns default or nil use the default selector. - stream.Aggregation = DefaultAggregationSelector(kind) - default: - // Deep copy and validate before using. - stream.Aggregation = stream.Aggregation.copy() - if err := stream.Aggregation.err(); err != nil { - orig := stream.Aggregation - stream.Aggregation = DefaultAggregationSelector(kind) - global.Error( - err, "using default aggregation instead", - "aggregation", orig, - "replacement", stream.Aggregation, - ) - } - } + // The aggregation was not overridden with a view. Use the aggregation + // provided by the reader. + stream.Aggregation = readerAggregation case AggregationDefault: + // The view explicitly requested the default aggregation. stream.Aggregation = DefaultAggregationSelector(kind) } @@ -596,7 +605,29 @@ func (r resolver[N]) Aggregators(id Instrument) ([]aggregate.Measure[N], error) errs := &multierror{} for _, i := range r.inserters { - in, err := i.Instrument(id) + in, err := i.Instrument(id, i.readerDefaultAggregation(id.Kind)) + if err != nil { + errs.append(err) + } + measures = append(measures, in...) + } + return measures, errs.errorOrNil() +} + +// HistogramAggregators returns the histogram Aggregators that must be updated by the instrument +// defined by key. If boundaries were provided on instrument instantiation, those take precedence +// over boundaries provided by the reader. +func (r resolver[N]) HistogramAggregators(id Instrument, boundaries []float64) ([]aggregate.Measure[N], error) { + var measures []aggregate.Measure[N] + + errs := &multierror{} + for _, i := range r.inserters { + agg := i.readerDefaultAggregation(id.Kind) + if histAgg, ok := agg.(AggregationExplicitBucketHistogram); ok && len(boundaries) > 0 { + histAgg.Boundaries = boundaries + agg = histAgg + } + in, err := i.Instrument(id, agg) if err != nil { errs.append(err) } diff --git a/sdk/metric/pipeline_registry_test.go b/sdk/metric/pipeline_registry_test.go index b0832a87f52..fe01d6971b3 100644 --- a/sdk/metric/pipeline_registry_test.go +++ b/sdk/metric/pipeline_registry_test.go @@ -351,7 +351,8 @@ func testCreateAggregators[N int64 | float64](t *testing.T) { var c cache[string, instID] p := newPipeline(nil, tt.reader, tt.views) i := newInserter[N](p, &c) - input, err := i.Instrument(tt.inst) + readerAggregation := i.readerDefaultAggregation(tt.inst.Kind) + input, err := i.Instrument(tt.inst, readerAggregation) var comps []aggregate.ComputeAggregation for _, instSyncs := range p.aggregations { for _, i := range instSyncs { @@ -375,7 +376,8 @@ func testInvalidInstrumentShouldPanic[N int64 | float64]() { Name: "foo", Kind: InstrumentKind(255), } - _, _ = i.Instrument(inst) + readerAggregation := i.readerDefaultAggregation(inst.Kind) + _, _ = i.Instrument(inst, readerAggregation) } func TestInvalidInstrumentShouldPanic(t *testing.T) { @@ -460,6 +462,8 @@ func TestPipelineRegistryCreateAggregators(t *testing.T) { p := newPipelines(resource.Empty(), tt.readers, tt.views) testPipelineRegistryResolveIntAggregators(t, p, tt.wantCount) testPipelineRegistryResolveFloatAggregators(t, p, tt.wantCount) + testPipelineRegistryResolveIntHistogramAggregators(t, p, tt.wantCount) + testPipelineRegistryResolveFloatHistogramAggregators(t, p, tt.wantCount) }) } } @@ -484,6 +488,26 @@ func testPipelineRegistryResolveFloatAggregators(t *testing.T, p pipelines, want require.Len(t, aggs, wantCount) } +func testPipelineRegistryResolveIntHistogramAggregators(t *testing.T, p pipelines, wantCount int) { + inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} + var c cache[string, instID] + r := newResolver[int64](p, &c) + aggs, err := r.HistogramAggregators(inst, []float64{1, 2, 3}) + assert.NoError(t, err) + + require.Len(t, aggs, wantCount) +} + +func testPipelineRegistryResolveFloatHistogramAggregators(t *testing.T, p pipelines, wantCount int) { + inst := Instrument{Name: "foo", Kind: InstrumentKindCounter} + var c cache[string, instID] + r := newResolver[float64](p, &c) + aggs, err := r.HistogramAggregators(inst, []float64{1, 2, 3}) + assert.NoError(t, err) + + require.Len(t, aggs, wantCount) +} + func TestPipelineRegistryResource(t *testing.T) { v := NewView(Instrument{Name: "bar"}, Stream{Name: "foo"}) readers := []Reader{NewManualReader()} @@ -513,6 +537,14 @@ func TestPipelineRegistryCreateAggregatorsIncompatibleInstrument(t *testing.T) { floatAggs, err := rf.Aggregators(inst) assert.Error(t, err) assert.Len(t, floatAggs, 0) + + intAggs, err = ri.HistogramAggregators(inst, []float64{1, 2, 3}) + assert.Error(t, err) + assert.Len(t, intAggs, 0) + + floatAggs, err = rf.HistogramAggregators(inst, []float64{1, 2, 3}) + assert.Error(t, err) + assert.Len(t, floatAggs, 0) } type logCounter struct { diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index 1026fd268ff..f585c7a4743 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -146,7 +146,8 @@ func testDefaultViewImplicit[N int64 | float64]() func(t *testing.T) { t.Run(test.name, func(t *testing.T) { var c cache[string, instID] i := newInserter[N](test.pipe, &c) - got, err := i.Instrument(inst) + readerAggregation := i.readerDefaultAggregation(inst.Kind) + got, err := i.Instrument(inst, readerAggregation) require.NoError(t, err) assert.Len(t, got, 1, "default view not applied") for _, in := range got { @@ -372,7 +373,8 @@ func TestInserterCachedAggregatorNameConflict(t *testing.T) { pipe := newPipeline(nil, NewManualReader(), nil) i := newInserter[int64](pipe, &vc) - _, origID, err := i.cachedAggregator(scope, kind, stream) + readerAggregation := i.readerDefaultAggregation(kind) + _, origID, err := i.cachedAggregator(scope, kind, stream, readerAggregation) require.NoError(t, err) require.Len(t, pipe.aggregations, 1) @@ -382,7 +384,7 @@ func TestInserterCachedAggregatorNameConflict(t *testing.T) { require.Equal(t, name, iSync[0].name) stream.Name = "RequestCount" - _, id, err := i.cachedAggregator(scope, kind, stream) + _, id, err := i.cachedAggregator(scope, kind, stream, readerAggregation) require.NoError(t, err) assert.Equal(t, origID, id, "multiple aggregators for equivalent name") From ce7b40afa9a79702610d4cd89810603e9f9b2a25 Mon Sep 17 00:00:00 2001 From: John Bley Date: Tue, 31 Oct 2023 03:51:47 -0400 Subject: [PATCH 752/886] trace: Reduce regexp memory use in tracestate (#4664) --- trace/tracestate.go | 38 ++++++++++++++++++++++++-------------- trace/tracestate_test.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/trace/tracestate.go b/trace/tracestate.go index ca68a82e5f7..d1e47ca2faa 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -28,9 +28,9 @@ const ( // based on the W3C Trace Context specification, see // https://www.w3.org/TR/trace-context-1/#tracestate-header - noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]{0,255}` - withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]{0,240}@[a-z][_0-9a-z\-\*\/]{0,13}` - valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]` + noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]*` + withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]*@[a-z][_0-9a-z\-\*\/]*` + valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]*[\x21-\x2b\x2d-\x3c\x3e-\x7e]` errInvalidKey errorConst = "invalid tracestate key" errInvalidValue errorConst = "invalid tracestate value" @@ -40,9 +40,10 @@ const ( ) var ( - keyRe = regexp.MustCompile(`^((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))$`) - valueRe = regexp.MustCompile(`^(` + valueFormat + `)$`) - memberRe = regexp.MustCompile(`^\s*((` + noTenantKeyFormat + `)|(` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) + noTenantKeyRe = regexp.MustCompile(`^` + noTenantKeyFormat + `$`) + withTenantKeyRe = regexp.MustCompile(`^` + withTenantKeyFormat + `$`) + valueRe = regexp.MustCompile(`^` + valueFormat + `$`) + memberRe = regexp.MustCompile(`^\s*((?:` + noTenantKeyFormat + `)|(?:` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) ) type member struct { @@ -51,10 +52,19 @@ type member struct { } func newMember(key, value string) (member, error) { - if !keyRe.MatchString(key) { + if len(key) > 256 { return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) } - if !valueRe.MatchString(value) { + if !noTenantKeyRe.MatchString(key) { + if !withTenantKeyRe.MatchString(key) { + return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + } + atIndex := strings.LastIndex(key, "@") + if atIndex > 241 || len(key)-1-atIndex > 14 { + return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + } + } + if len(value) > 256 || !valueRe.MatchString(value) { return member{}, fmt.Errorf("%w: %s", errInvalidValue, value) } return member{Key: key, Value: value}, nil @@ -62,14 +72,14 @@ func newMember(key, value string) (member, error) { func parseMember(m string) (member, error) { matches := memberRe.FindStringSubmatch(m) - if len(matches) != 5 { + if len(matches) != 3 { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } - - return member{ - Key: matches[1], - Value: matches[4], - }, nil + result, e := newMember(matches[1], matches[2]) + if e != nil { + return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) + } + return result, nil } // String encodes member into a string compliant with the W3C Trace Context diff --git a/trace/tracestate_test.go b/trace/tracestate_test.go index cd6536e6ad1..c2bccd3b7c6 100644 --- a/trace/tracestate_test.go +++ b/trace/tracestate_test.go @@ -552,3 +552,37 @@ func TestTraceStateImmutable(t *testing.T) { assert.Equal(t, v0, ts2.Get(k0)) assert.Equal(t, "", ts3.Get(k0)) } + +func BenchmarkParseTraceState(b *testing.B) { + benches := []struct { + name string + in string + }{ + { + name: "single key", + in: "somewhatRealisticKeyLength=someValueAbcdefgh1234567890", + }, + { + name: "tenant single key", + in: "somewhatRealisticKeyLength@someTenant=someValueAbcdefgh1234567890", + }, + { + name: "three keys", + in: "someKeyName.One=someValue1,someKeyName.Two=someValue2,someKeyName.Three=someValue3", + }, + { + name: "tenant three keys", + in: "someKeyName.One@tenant=someValue1,someKeyName.Two@tenant=someValue2,someKeyName.Three@tenant=someValue3", + }, + } + for _, bench := range benches { + b.Run(bench.name, func(b *testing.B) { + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = ParseTraceState(bench.in) + } + }) + } +} From bdb9322ebd4aadeba9c769326bd2381c3b47ef38 Mon Sep 17 00:00:00 2001 From: Nathan J Mehl <70606471+n-oden@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:02:17 -0400 Subject: [PATCH 753/886] Use url.PathUnescape rather than url.QueryUnescape in baggage parsing (#4667) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use url.PathUnescape rather than url.QueryUnescape I believe this addresses the majority of the cases described in https://github.com/open-telemetry/opentelemetry-go/issues/3601 Golang's url.QueryUnescape will render url _path_ elements (e.g. /, +) as spaces: `foo+bar` is rendered as `foo bar`. Path elements are (as I read the spec) legal W3C baggage values, and replacing them with spaces fails the value validation regex. url.PathEscape allows path elements through unmolested. Signed-off-by: Nathan J. Mehl * Update CHANGELOG.md address comments Co-authored-by: Robert Pająk --------- Signed-off-by: Nathan J. Mehl Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + baggage/baggage.go | 4 ++-- baggage/baggage_test.go | 49 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b79b2b460..5261ba19d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed +- Fix improper parsing of characters such us `+`, `\` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) - In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) ## [1.19.0/0.42.0/0.0.7] 2023-09-28 diff --git a/baggage/baggage.go b/baggage/baggage.go index 9e6b3b7b52a..84532cb1da3 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -254,7 +254,7 @@ func NewMember(key, value string, props ...Property) (Member, error) { if err := m.validate(); err != nil { return newInvalidMember(), err } - decodedValue, err := url.QueryUnescape(value) + decodedValue, err := url.PathUnescape(value) if err != nil { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } @@ -301,7 +301,7 @@ func parseMember(member string) (Member, error) { // when converting the header into a data structure." key = strings.TrimSpace(k) var err error - value, err = url.QueryUnescape(strings.TrimSpace(v)) + value, err = url.PathUnescape(strings.TrimSpace(v)) if err != nil { return newInvalidMember(), fmt.Errorf("%w: %q", err, value) } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 2b98beace10..4bac6707ea0 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -275,6 +275,48 @@ func TestBaggageParse(t *testing.T) { "foo": {Value: "1"}, }, }, + { + name: "single member no properties plus", + in: "foo=1+1", + want: baggage.List{ + "foo": {Value: "1+1"}, + }, + }, + { + name: "single member no properties plus encoded", + in: "foo=1%2B1", + want: baggage.List{ + "foo": {Value: "1+1"}, + }, + }, + { + name: "single member no properties slash", + in: "foo=1/1", + want: baggage.List{ + "foo": {Value: "1/1"}, + }, + }, + { + name: "single member no properties slash encoded", + in: "foo=1%2F1", + want: baggage.List{ + "foo": {Value: "1/1"}, + }, + }, + { + name: "single member no properties equals", + in: "foo=1=1", + want: baggage.List{ + "foo": {Value: "1=1"}, + }, + }, + { + name: "single member no properties equals encoded", + in: "foo=1%3D1", + want: baggage.List{ + "foo": {Value: "1=1"}, + }, + }, { name: "single member with spaces", in: " foo \t= 1\t\t ", @@ -440,6 +482,13 @@ func TestBaggageString(t *testing.T) { "foo": {Value: "1=1"}, }, }, + { + name: "plus", + out: "foo=1%2B1", + baggage: baggage.List{ + "foo": {Value: "1+1"}, + }, + }, { name: "single member empty value with properties", out: "foo=;red;state=on", From 437bc82bc40c0cd32a43d98038663a8c1e1e4883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 2 Nov 2023 07:49:10 +0100 Subject: [PATCH 754/886] otlptracegrpc otlpmetricgrpc: Remove redundant append of DialOptions (#4684) --- .../otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go | 3 --- .../otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go | 3 --- .../otlptrace/otlptracegrpc/internal/otlpconfig/options.go | 3 --- .../otlptrace/otlptracehttp/internal/otlpconfig/options.go | 3 --- internal/shared/otlp/otlpmetric/oconf/options.go.tmpl | 3 --- internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl | 3 --- 6 files changed, 18 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go index 873b207f58c..a85f2712224 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -155,9 +155,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Metrics.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go index 20cb840388f..59468b9a5ed 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -155,9 +155,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Metrics.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index 19b8434d4d2..dddb1f334de 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -141,9 +141,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Traces.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go index 9a595c36a62..8401bd7f155 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go @@ -141,9 +141,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Traces.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl index f4e1b2194e8..c4f9d0830f4 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -155,9 +155,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Metrics.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl index 99d9e4804e9..9270e506a9c 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl @@ -141,9 +141,6 @@ func NewGRPCConfig(opts ...GRPCOption) Config { if cfg.Traces.Compression == GzipCompression { cfg.DialOptions = append(cfg.DialOptions, grpc.WithDefaultCallOptions(grpc.UseCompressor(gzip.Name))) } - if len(cfg.DialOptions) != 0 { - cfg.DialOptions = append(cfg.DialOptions, cfg.DialOptions...) - } if cfg.ReconnectionPeriod != 0 { p := grpc.ConnectParams{ Backoff: backoff.DefaultConfig, From e3d0c50f099e26a6a077f4ac851b2200b703b772 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 2 Nov 2023 03:02:18 -0400 Subject: [PATCH 755/886] Use WithExplicitBucketBoundaries in the prometheus example (#4686) --- example/prometheus/go.mod | 2 +- example/prometheus/main.go | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 22c43d78c3e..56492f91d81 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -7,7 +7,6 @@ require ( go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/exporters/prometheus v0.42.0 go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk/metric v1.19.0 ) @@ -21,6 +20,7 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/example/prometheus/main.go b/example/prometheus/main.go index 81f23085536..777135cebc2 100644 --- a/example/prometheus/main.go +++ b/example/prometheus/main.go @@ -29,7 +29,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" api "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" ) @@ -46,22 +45,7 @@ func main() { if err != nil { log.Fatal(err) } - provider := metric.NewMeterProvider( - metric.WithReader(exporter), - // View to customize histogram buckets and rename a single histogram instrument. - metric.WithView(metric.NewView( - metric.Instrument{ - Name: "baz", - Scope: instrumentation.Scope{Name: meterName}, - }, - metric.Stream{ - Name: "new_baz", - Aggregation: metric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, - }, - }, - )), - ) + provider := metric.NewMeterProvider(metric.WithReader(exporter)) meter := provider.Meter(meterName) // Start the prometheus HTTP server and pass the exporter Collector to it @@ -93,7 +77,11 @@ func main() { } // This is the equivalent of prometheus.NewHistogramVec - histogram, err := meter.Float64Histogram("baz", api.WithDescription("a histogram with custom buckets and rename")) + histogram, err := meter.Float64Histogram( + "baz", + api.WithDescription("a histogram with custom buckets and rename"), + api.WithExplicitBucketBoundaries(64, 128, 256, 512, 1024, 2048, 4096), + ) if err != nil { log.Fatal(err) } From 480edcc31673d531ad86216f6d06bf5ef00b0656 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 2 Nov 2023 13:30:56 -0500 Subject: [PATCH 756/886] otlpmetricgrpc otlpmetrichttp: Add README.md (#4336) --- Makefile | 4 ++ .../otlp/otlpmetric/otlpmetricgrpc/README.md | 42 ++++++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/README.md | 43 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/README.md create mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/README.md diff --git a/Makefile b/Makefile index 0bc54769387..35fc189961b 100644 --- a/Makefile +++ b/Makefile @@ -312,3 +312,7 @@ COMMIT ?= "HEAD" add-tags: | $(MULTIMOD) @[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 ) $(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT} + +.PHONY: lint-markdown +lint-markdown: + docker run -v "$(CURDIR):$(WORKDIR)" docker://avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md b/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md new file mode 100644 index 00000000000..0b3a39947cc --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md @@ -0,0 +1,42 @@ +# OpenTelemetry-Go OTLP Metric gRPC Exporter + +[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc) + +[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation using gRPC. + +## Installation + +``` +go get -u go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc +``` + +## Usage + +Exporters should be created using the [New](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#New) and used with a [PeriodicReader]. + +## Environment Variables + +The following environment variables can be used (instead of options objects) to override the default configuration. + +| Name | Description | Default | Override with | +|------|-------------|---------|---------------| +| `OTEL_EXPORTER_OTLP_ENDPOINT` | Endpoint to which the exporter is going to send traces or metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, [WithEndpoint()] | +| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Endpoint to which the exporter is going to send metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | [WithEndpoint()] | +| `OTEL_EXPORTER_OTLP_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | `OTEL_EXPORTER_OTLP_METRICS_INSECURE`, [WithInsecure()] | +| `OTEL_EXPORTER_OTLP_METRICS_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | [WithInsecure()] | +| `OTEL_EXPORTER_OTLP_HEADERS` | A list of headers to send with each request | none | `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, [WithHeaders()] | +| `OTEL_EXPORTER_OTLP_METRICS_HEADERS` | A list of headers to send with each request | none | [WithHeaders()] | +| `OTEL_EXPORTER_OTLP_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION`, [WithCompressor()] | +| `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | [WithCompressor()] | +| `OTEL_EXPORTER_OTLP_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT`, [WithTimeout()] | +| `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | [WithTimeout()] | +| `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | The aggregation temporality to use on the basis of instrument kind. Available values are `Cumulative`, `Delta`, and `LowMemory`. See [The OTLP Exporter Specification] for more details | `Cumulative` | [WithTemporalitySelector()] | + +[PeriodicReader]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#NewPeriodicReader +[WithEndpoint()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithEndpoint +[WithInsecure()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithInsecure +[WithHeaders()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithHeaders +[WithCompressor()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithCompressor +[WithTimeout()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithTimeout +[The OTLP Exporter Specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md#additional-configuration +[WithTemporalitySelector()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithTemporalitySelector diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/README.md b/exporters/otlp/otlpmetric/otlpmetrichttp/README.md new file mode 100644 index 00000000000..114c5d32686 --- /dev/null +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/README.md @@ -0,0 +1,43 @@ +# OpenTelemetry-Go OTLP Metric HTTP Exporter + +[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp) + +[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation using HTTP with protobuf-encoded payloads. + +## Installation + +``` +go get -u go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp +``` + +## Usage + +Exporters should be created using the [New](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#New) and used with a [PeriodicReader]. + +## Environment Variables + +The following environment variables can be used (instead of options objects) to override the default configuration. + +| Name | Description | Default | Override with | +|------|-------------|---------|---------------| +| `OTEL_EXPORTER_OTLP_ENDPOINT` | Endpoint to which the exporter is going to send traces or metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, [WithEndpoint()] | +| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Endpoint to which the exporter is going to send metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317/v1/metrics` | [WithEndpoint()] and [WithURLPath()] | +| `OTEL_EXPORTER_OTLP_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | `OTEL_EXPORTER_OTLP_METRICS_INSECURE`, [WithInsecure()] | +| `OTEL_EXPORTER_OTLP_METRICS_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | [WithInsecure()] | +| `OTEL_EXPORTER_OTLP_HEADERS` | A list of headers to send with each request | none | `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, [WithHeaders()] | +| `OTEL_EXPORTER_OTLP_METRICS_HEADERS` | A list of headers to send with each request | none | [WithHeaders()] | +| `OTEL_EXPORTER_OTLP_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION`, [WithCompression()] | +| `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | [WithCompression()] | +| `OTEL_EXPORTER_OTLP_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT`, [WithTimeout()] | +| `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | [WithTimeout()] | +| `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | The aggregation temporality to use on the basis of instrument kind. Available values are `Cumulative`, `Delta`, and `LowMemory`. See [The OTLP Exporter Specification] for more details | `Cumulative` | [WithTemporalitySelector()] | + +[WithEndpoint()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithEndpoint +[WithURLPath()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithURLPath +[WithInsecure()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithInsecure +[WithHeaders()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithHeaders +[WithCompression()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithCompression +[WithCompressor()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithCompressor +[WithTimeout()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithTimeout +[The OTLP Exporter Specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md#additional-configuration +[WithTemporalitySelector()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithTemporalitySelector From 163573775bac7d72822e14f09234effb70976ba2 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Thu, 2 Nov 2023 16:07:41 -0400 Subject: [PATCH 757/886] Add summary support in the OpenCensus bridge (#4668) * support summaries in the OpenCensus bridge * divide quantiles by 100 --- CHANGELOG.md | 1 + bridge/opencensus/doc.go | 1 - bridge/opencensus/internal/ocmetric/metric.go | 66 +++++- .../internal/ocmetric/metric_test.go | 210 +++++++++++++++++- .../metricdata/metricdatatest/comparisons.go | 2 +- 5 files changed, 272 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5261ba19d95..c3c8e07b02c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add Summary, SummaryDataPoint, and QuantileValue to `go.opentelemetry.io/sdk/metric/metricdata`. (#4622) - `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` now supports exemplars from OpenCensus. (#4585) - Add support for `WithExplicitBucketBoundaries` in `go.opentelemetry.io/otel/sdk/metric`. (#4605) +- Add support for Summary metrics in `go.opentelemetry.io/otel/bridge/opencensus`. (#4668) ### Deprecated diff --git a/bridge/opencensus/doc.go b/bridge/opencensus/doc.go index df62b1c575e..70990920474 100644 --- a/bridge/opencensus/doc.go +++ b/bridge/opencensus/doc.go @@ -56,7 +56,6 @@ // implemented, and An error will be sent to the OpenTelemetry ErrorHandler. // // There are known limitations to the metric bridge: -// - Summary-typed metrics are dropped // - GaugeDistribution-typed metrics are dropped // - Histogram's SumOfSquaredDeviation field is dropped package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" diff --git a/bridge/opencensus/internal/ocmetric/metric.go b/bridge/opencensus/internal/ocmetric/metric.go index aeb3479f40b..8fdd0eb6167 100644 --- a/bridge/opencensus/internal/ocmetric/metric.go +++ b/bridge/opencensus/internal/ocmetric/metric.go @@ -32,7 +32,7 @@ import ( var ( errAggregationType = errors.New("unsupported OpenCensus aggregation type") errMismatchedValueTypes = errors.New("wrong value type for data point") - errNegativeDistributionCount = errors.New("distribution count is negative") + errNegativeCount = errors.New("distribution or summary count is negative") errNegativeBucketCount = errors.New("distribution bucket count is negative") errMismatchedAttributeKeyValues = errors.New("mismatched number of attribute keys and values") errInvalidExemplarSpanContext = errors.New("span context exemplar attachment does not contain an OpenCensus SpanContext") @@ -78,7 +78,8 @@ func convertAggregation(metric *ocmetricdata.Metric) (metricdata.Aggregation, er return convertSum[float64](labelKeys, metric.TimeSeries) case ocmetricdata.TypeCumulativeDistribution: return convertHistogram(labelKeys, metric.TimeSeries) - // TODO: Support summaries, once it is in the OTel data types. + case ocmetricdata.TypeSummary: + return convertSummary(labelKeys, metric.TimeSeries) } return nil, fmt.Errorf("%w: %q", errAggregationType, metric.Descriptor.Type) } @@ -146,7 +147,7 @@ func convertHistogram(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.Time continue } if dist.Count < 0 { - err = errors.Join(err, fmt.Errorf("%w: %d", errNegativeDistributionCount, dist.Count)) + err = errors.Join(err, fmt.Errorf("%w: %d", errNegativeCount, dist.Count)) continue } points = append(points, metricdata.HistogramDataPoint[float64]{ @@ -340,6 +341,65 @@ func complexToString[N complex64 | complex128](val N) string { return strconv.FormatComplex(complex128(val), 'f', -1, 64) } +// convertSummary converts OpenCensus Summary timeseries to an +// OpenTelemetry Summary. +func convertSummary(labelKeys []ocmetricdata.LabelKey, ts []*ocmetricdata.TimeSeries) (metricdata.Summary, error) { + points := make([]metricdata.SummaryDataPoint, 0, len(ts)) + var err error + for _, t := range ts { + attrs, attrErr := convertAttrs(labelKeys, t.LabelValues) + if attrErr != nil { + err = errors.Join(err, attrErr) + continue + } + for _, p := range t.Points { + summary, ok := p.Value.(*ocmetricdata.Summary) + if !ok { + err = errors.Join(err, fmt.Errorf("%w: %d", errMismatchedValueTypes, p.Value)) + continue + } + if summary.Count < 0 { + err = errors.Join(err, fmt.Errorf("%w: %d", errNegativeCount, summary.Count)) + continue + } + point := metricdata.SummaryDataPoint{ + Attributes: attrs, + StartTime: t.StartTime, + Time: p.Time, + Count: uint64(summary.Count), + QuantileValues: convertQuantiles(summary.Snapshot), + Sum: summary.Sum, + } + points = append(points, point) + } + } + return metricdata.Summary{DataPoints: points}, err +} + +// convertQuantiles converts an OpenCensus summary snapshot to +// OpenTelemetry quantiles. +func convertQuantiles(snapshot ocmetricdata.Snapshot) []metricdata.QuantileValue { + quantileValues := make([]metricdata.QuantileValue, 0, len(snapshot.Percentiles)) + for quantile, value := range snapshot.Percentiles { + quantileValues = append(quantileValues, metricdata.QuantileValue{ + // OpenCensus quantiles are range (0-100.0], but OpenTelemetry + // quantiles are range [0.0, 1.0]. + Quantile: quantile / 100.0, + Value: value, + }) + } + sort.Sort(byQuantile(quantileValues)) + return quantileValues +} + +// byQuantile implements sort.Interface for []metricdata.QuantileValue +// based on the Quantile field. +type byQuantile []metricdata.QuantileValue + +func (a byQuantile) Len() int { return len(a) } +func (a byQuantile) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byQuantile) Less(i, j int) bool { return a[i].Quantile < a[j].Quantile } + // convertAttrs converts from OpenCensus attribute keys and values to an // OpenTelemetry attribute Set. func convertAttrs(keys []ocmetricdata.LabelKey, values []ocmetricdata.LabelValue) (attribute.Set, error) { diff --git a/bridge/opencensus/internal/ocmetric/metric_test.go b/bridge/opencensus/internal/ocmetric/metric_test.go index bf851bc14ad..b7a25e5c776 100644 --- a/bridge/opencensus/internal/ocmetric/metric_test.go +++ b/bridge/opencensus/internal/ocmetric/metric_test.go @@ -47,7 +47,7 @@ func TestConvertMetrics(t *testing.T) { expected: []metricdata.Metrics{}, }, { - desc: "normal Histogram, gauges, and sums", + desc: "normal Histogram, summary, gauges, and sums", input: []*ocmetricdata.Metric{ { Descriptor: ocmetricdata.Descriptor{ @@ -285,6 +285,54 @@ func TestConvertMetrics(t *testing.T) { }, }, }, + }, { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/summary-a", + Description: "a testing summary", + Unit: ocmetricdata.UnitMilliseconds, + Type: ocmetricdata.TypeSummary, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "g"}, + {Key: "h"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "ding", + Present: true, + }, { + Value: "dong", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewSummaryPoint(endTime1, &ocmetricdata.Summary{ + Count: 10, + Sum: 13.2, + HasCountAndSum: true, + Snapshot: ocmetricdata.Snapshot{ + Percentiles: map[float64]float64{ + 50.0: 1.0, + 0.0: 0.1, + 100.0: 10.4, + }, + }, + }), + ocmetricdata.NewSummaryPoint(endTime2, &ocmetricdata.Summary{ + Count: 12, + Snapshot: ocmetricdata.Snapshot{ + Percentiles: map[float64]float64{ + 0.0: 0.2, + 50.0: 1.1, + 100.0: 10.5, + }, + }, + }), + }, + }, + }, }, }, expected: []metricdata.Metrics{ @@ -489,6 +537,64 @@ func TestConvertMetrics(t *testing.T) { }, }, }, + }, { + Name: "foo.com/summary-a", + Description: "a testing summary", + Unit: "ms", + Data: metricdata.Summary{ + DataPoints: []metricdata.SummaryDataPoint{ + { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("g"), + Value: attribute.StringValue("ding"), + }, attribute.KeyValue{ + Key: attribute.Key("h"), + Value: attribute.StringValue("dong"), + }), + Time: endTime1, + Count: 10, + Sum: 13.2, + QuantileValues: []metricdata.QuantileValue{ + { + Quantile: 0.0, + Value: 0.1, + }, + { + Quantile: 0.5, + Value: 1.0, + }, + { + Quantile: 1.0, + Value: 10.4, + }, + }, + }, { + Attributes: attribute.NewSet(attribute.KeyValue{ + Key: attribute.Key("g"), + Value: attribute.StringValue("ding"), + }, attribute.KeyValue{ + Key: attribute.Key("h"), + Value: attribute.StringValue("dong"), + }), + Time: endTime2, + Count: 12, + QuantileValues: []metricdata.QuantileValue{ + { + Quantile: 0.0, + Value: 0.2, + }, + { + Quantile: 0.5, + Value: 1.1, + }, + { + Quantile: 1.0, + Value: 10.5, + }, + }, + }, + }, + }, }, }, }, @@ -586,7 +692,7 @@ func TestConvertMetrics(t *testing.T) { }, }, }, - expectedErr: errNegativeDistributionCount, + expectedErr: errNegativeCount, }, { desc: "histogram with negative bucket count", @@ -638,6 +744,82 @@ func TestConvertMetrics(t *testing.T) { }, expectedErr: errMismatchedValueTypes, }, + { + desc: "summary with mismatched attributes", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/summary-mismatched", + Description: "a mismatched summary", + Unit: ocmetricdata.UnitMilliseconds, + Type: ocmetricdata.TypeSummary, + LabelKeys: []ocmetricdata.LabelKey{ + {Key: "g"}, + }, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + LabelValues: []ocmetricdata.LabelValue{ + { + Value: "ding", + Present: true, + }, { + Value: "dong", + Present: true, + }, + }, + Points: []ocmetricdata.Point{ + ocmetricdata.NewSummaryPoint(endTime1, &ocmetricdata.Summary{ + Count: 10, + Sum: 13.2, + HasCountAndSum: true, + Snapshot: ocmetricdata.Snapshot{ + Percentiles: map[float64]float64{ + 0.0: 0.1, + 0.5: 1.0, + 1.0: 10.4, + }, + }, + }), + }, + }, + }, + }, + }, + expectedErr: errMismatchedAttributeKeyValues, + }, + { + desc: "summary with negative count", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/summary-negative", + Description: "a negative count summary", + Unit: ocmetricdata.UnitMilliseconds, + Type: ocmetricdata.TypeSummary, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewSummaryPoint(endTime1, &ocmetricdata.Summary{ + Count: -10, + Sum: 13.2, + HasCountAndSum: true, + Snapshot: ocmetricdata.Snapshot{ + Percentiles: map[float64]float64{ + 0.0: 0.1, + 0.5: 1.0, + 1.0: 10.4, + }, + }, + }), + }, + }, + }, + }, + }, + expectedErr: errNegativeCount, + }, { desc: "histogram with invalid span context exemplar", input: []*ocmetricdata.Metric{ @@ -722,6 +904,28 @@ func TestConvertMetrics(t *testing.T) { }, expectedErr: errMismatchedValueTypes, }, + { + desc: "summary with non-summary datapoint type", + input: []*ocmetricdata.Metric{ + { + Descriptor: ocmetricdata.Descriptor{ + Name: "foo.com/bad-point", + Description: "a bad type", + Unit: ocmetricdata.UnitDimensionless, + Type: ocmetricdata.TypeSummary, + }, + TimeSeries: []*ocmetricdata.TimeSeries{ + { + Points: []ocmetricdata.Point{ + ocmetricdata.NewDistributionPoint(endTime1, &ocmetricdata.Distribution{}), + }, + StartTime: startTime, + }, + }, + }, + }, + expectedErr: errMismatchedValueTypes, + }, { desc: "unsupported Gauge Distribution type", input: []*ocmetricdata.Metric{ @@ -740,7 +944,7 @@ func TestConvertMetrics(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { output, err := ConvertMetrics(tc.input) if !errors.Is(err, tc.expectedErr) { - t.Errorf("convertAggregation(%+v) = err(%v), want err(%v)", tc.input, err, tc.expectedErr) + t.Errorf("ConvertMetrics(%+v) = err(%v), want err(%v)", tc.input, err, tc.expectedErr) } metricdatatest.AssertEqual[metricdata.ScopeMetrics](t, metricdata.ScopeMetrics{Metrics: tc.expected}, diff --git a/sdk/metric/metricdata/metricdatatest/comparisons.go b/sdk/metric/metricdata/metricdatatest/comparisons.go index c6407aca8f8..a25c930676f 100644 --- a/sdk/metric/metricdata/metricdatatest/comparisons.go +++ b/sdk/metric/metricdata/metricdatatest/comparisons.go @@ -472,7 +472,7 @@ func equalSummaryDataPoint(a, b metricdata.SummaryDataPoint, cfg config) (reason } r := compareDiff(diffSlices( a.QuantileValues, - a.QuantileValues, + b.QuantileValues, func(a, b metricdata.QuantileValue) bool { r := equalQuantileValue(a, b, cfg) return len(r) == 0 From 3560dc595936fc8fcac4bc65603596cc8e77b1e4 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 5 Nov 2023 12:17:26 -0300 Subject: [PATCH 758/886] dependabot updates Sun Nov 5 15:10:14 UTC 2023 (#4692) Bump github.com/golangci/golangci-lint from 1.55.1 to 1.55.2 in /internal/tools Bump golang.org/x/sys from 0.13.0 to 0.14.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/fib/go.mod | 2 +- example/fib/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/view/go.mod | 2 +- example/view/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 8 ++++---- internal/tools/go.sum | 16 ++++++++-------- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 48 files changed, 81 insertions(+), 81 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index ada92f8905c..72b390c7178 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index cfd56fdeaf4..094035dcfd9 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 988f35c4ad4..9e45c8faa5b 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 22d79bd60ac..f69ee0de170 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index f8ebb53982d..85bfcfb5962 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index bc6445d1064..d9d262b4e0e 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/example/dice/go.mod b/example/dice/go.mod index 77870b87245..ce4bc480b25 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index 081d765f395..5a2d13ec65d 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -11,6 +11,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/fib/go.mod b/example/fib/go.mod index 50fab762f7b..180448b3add 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -14,7 +14,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/fib/go.sum b/example/fib/go.sum index b9ab5f187ca..6133f48461b 100644 --- a/example/fib/go.sum +++ b/example/fib/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 2d605717d90..d7ec6c1403c 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.3.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index b9ab5f187ca..6133f48461b 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index f7fd9988954..c239979a406 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 22d79bd60ac..f69ee0de170 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index a92ca308082..8899e112401 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 37fc941ac8d..659eb759796 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 7adcfe6b8f5..01c33666a9c 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index b9ab5f187ca..6133f48461b 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 56492f91d81..a3e00f86db6 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index cc5158e6358..45bf221777f 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwa github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/view/go.mod b/example/view/go.mod index 44ebb34ada3..6f222f0d315 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.sum b/example/view/go.sum index cc5158e6358..45bf221777f 100644 --- a/example/view/go.sum +++ b/example/view/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwa github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 0639e39dfa0..f9557a79f5a 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 3d6a146da21..7850e803c13 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d3b8a363521..ebe9cb2c87c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index fd64699a3da..a785b78a9d3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index aa82f47c5b1..89d20dbe872 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index fd64699a3da..a785b78a9d3 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 2637b9fdc39..33195ce2028 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 13a8066f050..4d096444b83 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index b698f6dbb49..15ee26b6c99 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 6e4e3d2efed..98f71093fc4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -30,8 +30,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0b4250ede74..b973cb324f8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index ba00a88a8c6..a65cd61a392 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 25e6ee905d9..72bbc29e8f1 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index c4e4936dd4d..be254d22a49 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -35,8 +35,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 6e69978beb8..ab09dd0a90b 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 73576f88625..4b68d1f111b 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index e333f236abb..a055e31e4c8 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 73576f88625..4b68d1f111b 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 57e6abf3f16..9053b0b00fb 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index a0c2f816860..b939da6eb8a 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 81a9f49c497..5f729dd63a1 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 - github.com/golangci/golangci-lint v1.55.1 + github.com/golangci/golangci-lint v1.55.2 github.com/itchyny/gojq v0.12.13 github.com/jcchavezs/porto v0.5.1 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad @@ -48,7 +48,7 @@ require ( github.com/bombsimon/wsl/v3 v3.4.0 // indirect github.com/breml/bidichk v0.2.7 // indirect github.com/breml/errchkjson v0.3.6 // indirect - github.com/butuzov/ireturn v0.2.1 // indirect + github.com/butuzov/ireturn v0.2.2 // indirect github.com/butuzov/mirror v1.1.0 // indirect github.com/catenacyber/perfsprint v0.2.0 // indirect github.com/ccojocar/zxcvbn-go v1.0.1 // indirect @@ -141,7 +141,7 @@ require ( github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.11.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.14.0 // indirect + github.com/nunnatsa/ginkgolinter v0.14.1 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect @@ -208,7 +208,7 @@ require ( golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4a2ce0be0fc..1d6f494ac7b 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -106,8 +106,8 @@ github.com/breml/bidichk v0.2.7 h1:dAkKQPLl/Qrk7hnP6P+E0xOodrq8Us7+U0o4UBOAlQY= github.com/breml/bidichk v0.2.7/go.mod h1:YodjipAGI9fGcYM7II6wFvGhdMYsC5pHDlGzqvEW3tQ= github.com/breml/errchkjson v0.3.6 h1:VLhVkqSBH96AvXEyclMR37rZslRrY2kcyq+31HCsVrA= github.com/breml/errchkjson v0.3.6/go.mod h1:jhSDoFheAF2RSDOlCfhHO9KqhZgAYLyvHe7bRCX8f/U= -github.com/butuzov/ireturn v0.2.1 h1:w5Ks4tnfeFDZskGJ2x1GAkx5gaQV+kdU3NKNr3NEBzY= -github.com/butuzov/ireturn v0.2.1/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= +github.com/butuzov/ireturn v0.2.2 h1:jWI36dxXwVrI+RnXDwux2IZOewpmfv930OuIRfaBUJ0= +github.com/butuzov/ireturn v0.2.2/go.mod h1:RfGHUvvAuFFxoHKf4Z8Yxuh6OjlCw1KvR2zM1NFHeBk= github.com/butuzov/mirror v1.1.0 h1:ZqX54gBVMXu78QLoiqdwpl2mgmoOJTk7s4p4o+0avZI= github.com/butuzov/mirror v1.1.0/go.mod h1:8Q0BdQU6rC6WILDiBM60DBfvV78OLJmMmixe7GF45AE= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= @@ -259,8 +259,8 @@ github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e h1:ULcKCDV1LOZPFxGZaA6TlQbiM3J2GCPnkx/bGF6sX/g= github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e/go.mod h1:Pm5KhLPA8gSnQwrQ6ukebRcapGb/BG9iUkdaiCcGHJM= -github.com/golangci/golangci-lint v1.55.1 h1:DL2j9Eeapg1N3WEkKnQFX5L40SYtjZZJjGVdyEgNrDc= -github.com/golangci/golangci-lint v1.55.1/go.mod h1:z00biPRqjo5MISKV1+RWgONf2KvrPDmfqxHpHKB6bI4= +github.com/golangci/golangci-lint v1.55.2 h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8= +github.com/golangci/golangci-lint v1.55.2/go.mod h1:H60CZ0fuqoTwlTvnbyjhpZPWp7KmsjwV2yupIMiMXbM= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= @@ -443,8 +443,8 @@ github.com/nishanths/exhaustive v0.11.0 h1:T3I8nUGhl/Cwu5Z2hfc92l0e04D2GEW6e0l8p github.com/nishanths/exhaustive v0.11.0/go.mod h1:RqwDsZ1xY0dNdqHho2z6X+bgzizwbLYOWnZbbl2wLB4= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.14.0 h1:XQPNmw+kZz5cC/HbFK3mQutpjzAQv1dHregRA+4CGGg= -github.com/nunnatsa/ginkgolinter v0.14.0/go.mod h1:cm2xaqCUCRd7qcP4DqbVvpcyEMkuLM9CF0wY6VASohk= +github.com/nunnatsa/ginkgolinter v0.14.1 h1:khx0CqR5U4ghsscjJ+lZVthp3zjIFytRXPTaQ/TMiyA= +github.com/nunnatsa/ginkgolinter v0.14.1/go.mod h1:nY0pafUSst7v7F637e7fymaMlQqI9c0Wka2fGsDkzWg= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= @@ -845,8 +845,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/sdk/go.mod b/sdk/go.mod index a708aa4e4e2..04c17d778f0 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel/trace v1.19.0 - golang.org/x/sys v0.13.0 + golang.org/x/sys v0.14.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 4e223a1a143..6efa2c97172 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index c7dc67d5fcd..98c3fdcf47b 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 73576f88625..4b68d1f111b 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 0f5179f4f1774408335ebd078af656540be473f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 6 Nov 2023 19:01:10 +0100 Subject: [PATCH 759/886] Deprecate otlpmetric (#4693) --- CHANGELOG.md | 1 + exporters/otlp/otlpmetric/doc.go | 3 +++ exporters/otlp/otlpmetric/go.mod | 1 + 3 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3c8e07b02c..cd94fbc8e97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Deprecate `go.opentelemetry.io/otel/trace.NewNoopTracerProvider`. Use the added `NewTracerProvider` function in `go.opentelemetry.io/otel/trace/noop` instead. (#4620) - Deprecate `go.opentelemetry.io/otel/example/view` package in favor of `go.opentelemetry.io/otel/example/prometheus`. (#4649) +- Deprecate `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4693) ### Changed diff --git a/exporters/otlp/otlpmetric/doc.go b/exporters/otlp/otlpmetric/doc.go index 31831c415fe..c641071a1cd 100644 --- a/exporters/otlp/otlpmetric/doc.go +++ b/exporters/otlp/otlpmetric/doc.go @@ -17,4 +17,7 @@ // the transformed data to OTLP receivers. The Exporter is configurable to use // different Clients, each using a distinct transport protocol to communicate // to an OTLP receiving endpoint. +// +// Deprecated: Use [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc] +// or [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp] instead. package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod index 33f5411a29d..bd76e6bcc41 100644 --- a/exporters/otlp/otlpmetric/go.mod +++ b/exporters/otlp/otlpmetric/go.mod @@ -1,3 +1,4 @@ +// Deprecated: use go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc or go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp instead. module go.opentelemetry.io/otel/exporters/otlp/otlpmetric go 1.20 From 0c5ebd58562213df399701409dc5ed2928bba11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 8 Nov 2023 17:18:12 +0100 Subject: [PATCH 760/886] otlp: Refine documentation (#4695) --- CHANGELOG.md | 2 + exporters/README.md | 18 ++-- .../otlp/otlpmetric/otlpmetricgrpc/README.md | 42 ---------- .../otlp/otlpmetric/otlpmetricgrpc/config.go | 8 +- .../otlp/otlpmetric/otlpmetricgrpc/doc.go | 83 ++++++++++++++++++- .../otlp/otlpmetric/otlpmetrichttp/README.md | 43 ---------- .../otlp/otlpmetric/otlpmetrichttp/doc.go | 81 +++++++++++++++++- exporters/otlp/otlptrace/README.md | 51 ------------ exporters/otlp/otlptrace/doc.go | 21 +++++ exporters/otlp/otlptrace/otlptracegrpc/doc.go | 77 +++++++++++++++++ .../otlptrace/otlptracegrpc/example_test.go | 42 ++++++++++ .../otlp/otlptrace/otlptracegrpc/options.go | 8 +- exporters/otlp/otlptrace/otlptracehttp/doc.go | 59 ++++++++++++- .../otlptrace/otlptracehttp/example_test.go | 72 +++------------- 14 files changed, 380 insertions(+), 227 deletions(-) delete mode 100644 exporters/otlp/otlpmetric/otlpmetricgrpc/README.md delete mode 100644 exporters/otlp/otlpmetric/otlpmetrichttp/README.md delete mode 100644 exporters/otlp/otlptrace/README.md create mode 100644 exporters/otlp/otlptrace/doc.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/doc.go create mode 100644 exporters/otlp/otlptrace/otlptracegrpc/example_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index cd94fbc8e97..bebd78266fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix improper parsing of characters such us `+`, `\` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) - In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) +- Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) ## [1.19.0/0.42.0/0.0.7] 2023-09-28 diff --git a/exporters/README.md b/exporters/README.md index 58561902d43..995226c8d55 100644 --- a/exporters/README.md +++ b/exporters/README.md @@ -7,14 +7,16 @@ This package contains exporters for this purpose. The following exporter packages are provided with the following OpenTelemetry signal support. -| Exporter Package | Metrics | Traces | -| :-----------------------------------------------------------------------------: | :-----: | :----: | -| [go.opentelemetry.io/otel/exporters/otlp/otlpmetric](./otlp/otlpmetric) | ✓ | | -| [go.opentelemetry.io/otel/exporters/otlp/otlptrace](./otlp/otlptrace) | | ✓ | -| [go.opentelemetry.io/otel/exporters/prometheus](./prometheus) | ✓ | | -| [go.opentelemetry.io/otel/exporters/stdout/stdoutmetric](./stdout/stdoutmetric) | ✓ | | -| [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](./stdout/stdouttrace) | | ✓ | -| [go.opentelemetry.io/otel/exporters/zipkin](./zipkin) | | ✓ | +| Exporter Package | Metrics | Traces | +|:-----------------------------------------------------------------------------------------------------:|:-------:|:------:| +| [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc](./otlp/otlpmetric/otlpmetricgrpc) | ✓ | | +| [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp](./otlp/otlpmetric/otlpmetrichttp) | ✓ | | +| [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc](./otlp/otlptrace/otlptracegrpc) | | ✓ | +| [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](./otlp/otlptrace/otlptracehttp) | | ✓ | +| [go.opentelemetry.io/otel/exporters/prometheus](./prometheus) | ✓ | | +| [go.opentelemetry.io/otel/exporters/stdout/stdoutmetric](./stdout/stdoutmetric) | ✓ | | +| [go.opentelemetry.io/otel/exporters/stdout/stdouttrace](./stdout/stdouttrace) | | ✓ | +| [go.opentelemetry.io/otel/exporters/zipkin](./zipkin) | | ✓ | See the [OpenTelemetry registry] for 3rd-party exporters compatible with this project. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md b/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md deleted file mode 100644 index 0b3a39947cc..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# OpenTelemetry-Go OTLP Metric gRPC Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc) - -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation using gRPC. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc -``` - -## Usage - -Exporters should be created using the [New](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#New) and used with a [PeriodicReader]. - -## Environment Variables - -The following environment variables can be used (instead of options objects) to override the default configuration. - -| Name | Description | Default | Override with | -|------|-------------|---------|---------------| -| `OTEL_EXPORTER_OTLP_ENDPOINT` | Endpoint to which the exporter is going to send traces or metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, [WithEndpoint()] | -| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Endpoint to which the exporter is going to send metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | [WithEndpoint()] | -| `OTEL_EXPORTER_OTLP_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | `OTEL_EXPORTER_OTLP_METRICS_INSECURE`, [WithInsecure()] | -| `OTEL_EXPORTER_OTLP_METRICS_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | [WithInsecure()] | -| `OTEL_EXPORTER_OTLP_HEADERS` | A list of headers to send with each request | none | `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, [WithHeaders()] | -| `OTEL_EXPORTER_OTLP_METRICS_HEADERS` | A list of headers to send with each request | none | [WithHeaders()] | -| `OTEL_EXPORTER_OTLP_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION`, [WithCompressor()] | -| `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | [WithCompressor()] | -| `OTEL_EXPORTER_OTLP_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT`, [WithTimeout()] | -| `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | [WithTimeout()] | -| `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | The aggregation temporality to use on the basis of instrument kind. Available values are `Cumulative`, `Delta`, and `LowMemory`. See [The OTLP Exporter Specification] for more details | `Cumulative` | [WithTemporalitySelector()] | - -[PeriodicReader]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#NewPeriodicReader -[WithEndpoint()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithEndpoint -[WithInsecure()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithInsecure -[WithHeaders()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithHeaders -[WithCompressor()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithCompressor -[WithTimeout()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithTimeout -[The OTLP Exporter Specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md#additional-configuration -[WithTemporalitySelector()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc#WithTemporalitySelector diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go index 6ba3600b1c1..fbd495e7d7d 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -109,13 +109,7 @@ func compressorToCompression(compressor string) oconf.Compression { } // WithCompressor sets the compressor the gRPC client uses. -// -// It is the responsibility of the caller to ensure that the compressor set -// has been registered with google.golang.org/grpc/encoding (see -// encoding.RegisterCompressor for more information). For example, to register -// the gzip compressor import the package: -// -// import _ "google.golang.org/grpc/encoding/gzip" +// Supported compressor values: "gzip". // // If the OTEL_EXPORTER_OTLP_COMPRESSION or // OTEL_EXPORTER_OTLP_METRICS_COMPRESSION environment variable is set, and diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go index 7820619bf60..7be572a79d0 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go @@ -12,6 +12,85 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package otlpmetricgrpc provides an otlpmetric.Exporter that communicates -// with an OTLP receiving endpoint using gRPC. +/* +Package otlpmetricgrpc provides an OTLP metrics exporter using gRPC. +By default the telemetry is sent to https://localhost:4317. + +Exporter should be created using [New] and used with a [metric.PeriodicReader]. + +The environment variables described below can be used for configuration. + +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT (default: "https://localhost:4317") - +target to which the exporter sends telemetry. +The target syntax is defined in https://github.com/grpc/grpc/blob/master/doc/naming.md. +The value must contain a host. +The value may additionally a port, a scheme, and a path. +The value accepts "http" and "https" scheme. +The value should not contain a query string or fragment. +OTEL_EXPORTER_OTLP_METRICS_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. +The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_METRICS_INSECURE (default: "false") - +setting "true" disables client transport security for the exporter's gRPC connection. +You can use this only when an endpoint is provided without the http or https scheme. +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT setting overrides +the scheme defined via OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT. +OTEL_EXPORTER_OTLP_METRICS_INSECURE takes precedence over OTEL_EXPORTER_OTLP_INSECURE. +The configuration can be overridden by [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS (default: none) - +key-value pairs used as gRPC metadata associated with gRPC requests. +The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +except that additional semi-colon delimited metadata is not supported. +Example value: "key1=value1,key2=value2". +OTEL_EXPORTER_OTLP_METRICS_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. +The configuration can be overridden by [WithHeaders] option. + +OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_METRICS_TIMEOUT (default: "10000") - +maximum time in milliseconds the OTLP exporter waits for each batch export. +OTEL_EXPORTER_OTLP_METRICS_TIMEOUT takes precedence over OTEL_EXPORTER_OTLP_TIMEOUT. +The configuration can be overridden by [WithTimeout] option. + +OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_METRICS_COMPRESSION (default: none) - +the gRPC compressor the exporter uses. +Supported value: "gzip". +OTEL_EXPORTER_OTLP_METRICS_COMPRESSION takes precedence over OTEL_EXPORTER_OTLP_COMPRESSION. +The configuration can be overridden by [WithCompressor], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE (default: none) - +the filepath to the trusted certificate to use when verifying a server's TLS credentials. +OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE (default: none) - +the filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY (default: none) - +the filepath to the clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] option. + +OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE (default: "cumulative") - +aggregation temporality to use on the basis of instrument kind. Supported values: + - "cumulative" - Cumulative aggregation temporality for all instrument kinds, + - "delta" - Delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds; + Cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds, + - "lowmemory" - Delta aggregation temporality for Synchronous Counter and Histogram instrument kinds; + Cumulative aggregation temporality for Synchronous UpDownCounter, Asynchronous Counter, and Asynchronous UpDownCounter instrument kinds. + +The configuration can be overridden by [WithTemporalitySelector] option. + +OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION (default: "explicit_bucket_histogram") - +default aggregation to use for histogram instruments. Supported values: + - "explicit_bucket_histogram" - [Explicit Bucket Histogram Aggregation], + - "base2_exponential_bucket_histogram" - [Base2 Exponential Bucket Histogram Aggregation]. + +The configuration can be overridden by [WithAggregationSelector] option. + +[W3C Baggage HTTP Header Content Format]: https://www.w3.org/TR/baggage/#header-content +[Explicit Bucket Histogram Aggregation]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation +[Base2 Exponential Bucket Histogram Aggregation]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/metrics/sdk.md#base2-exponential-bucket-histogram-aggregation +*/ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/README.md b/exporters/otlp/otlpmetric/otlpmetrichttp/README.md deleted file mode 100644 index 114c5d32686..00000000000 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# OpenTelemetry-Go OTLP Metric HTTP Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp) - -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation using HTTP with protobuf-encoded payloads. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp -``` - -## Usage - -Exporters should be created using the [New](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#New) and used with a [PeriodicReader]. - -## Environment Variables - -The following environment variables can be used (instead of options objects) to override the default configuration. - -| Name | Description | Default | Override with | -|------|-------------|---------|---------------| -| `OTEL_EXPORTER_OTLP_ENDPOINT` | Endpoint to which the exporter is going to send traces or metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317` | `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT`, [WithEndpoint()] | -| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | Endpoint to which the exporter is going to send metrics. If the scheme is `http` or `unix` this will also set `OTEL_EXPORTER_OTLP_INSECURE` to true | `https://localhost:4317/v1/metrics` | [WithEndpoint()] and [WithURLPath()] | -| `OTEL_EXPORTER_OTLP_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | `OTEL_EXPORTER_OTLP_METRICS_INSECURE`, [WithInsecure()] | -| `OTEL_EXPORTER_OTLP_METRICS_INSECURE` | If set to true the connection will not attempt to use TLS when connecting | `false` | [WithInsecure()] | -| `OTEL_EXPORTER_OTLP_HEADERS` | A list of headers to send with each request | none | `OTEL_EXPORTER_OTLP_METRICS_HEADERS`, [WithHeaders()] | -| `OTEL_EXPORTER_OTLP_METRICS_HEADERS` | A list of headers to send with each request | none | [WithHeaders()] | -| `OTEL_EXPORTER_OTLP_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION`, [WithCompression()] | -| `OTEL_EXPORTER_OTLP_METRICS_COMPRESSION` | Sets the compressions used in the connection. Supports `none` and `gzip`. Must import the compressor for gzip to work. | none | [WithCompression()] | -| `OTEL_EXPORTER_OTLP_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT`, [WithTimeout()] | -| `OTEL_EXPORTER_OTLP_METRICS_TIMEOUT` | Sets the max amount of time (as milliseconds) an Exporter will attempt an export | `10000` | [WithTimeout()] | -| `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | The aggregation temporality to use on the basis of instrument kind. Available values are `Cumulative`, `Delta`, and `LowMemory`. See [The OTLP Exporter Specification] for more details | `Cumulative` | [WithTemporalitySelector()] | - -[WithEndpoint()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithEndpoint -[WithURLPath()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithURLPath -[WithInsecure()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithInsecure -[WithHeaders()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithHeaders -[WithCompression()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithCompression -[WithCompressor()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithCompressor -[WithTimeout()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithTimeout -[The OTLP Exporter Specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk_exporters/otlp.md#additional-configuration -[WithTemporalitySelector()]: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp#WithTemporalitySelector diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go index a49e2465171..94f8b250d3f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go @@ -12,7 +12,82 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package otlpmetrichttp provides an otlpmetric.Exporter that communicates -// with an OTLP receiving endpoint using protobuf encoded metric data over -// HTTP. +/* +Package otlpmetrichttp provides an OTLP metrics exporter using HTTP with protobuf payloads. +By default the telemetry is sent to https://localhost:4318/v1/metrics. + +Exporter should be created using [New] and used with a [metric.PeriodicReader]. + +The environment variables described below can be used for configuration. + +OTEL_EXPORTER_OTLP_ENDPOINT (default: "https://localhost:4318") - +target base URL ("/v1/metrics" is appended) to which the exporter sends telemetry. +The value must contain a scheme ("http" or "https") and host. +The value may additionally contain a port and a path. +The value should not contain a query string or fragment. +The configuration can be overridden by OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +environment variable and by [WithEndpoint], [WithInsecure] options. + +OTEL_EXPORTER_OTLP_METRICS_ENDPOINT (default: "https://localhost:4318/v1/metrics") - +target URL to which the exporter sends telemetry. +The value must contain a scheme ("http" or "https") and host. +The value may additionally contain a port and a path. +The value should not contain a query string or fragment. +The configuration can be overridden by [WithEndpoint], [WitnInsecure], [WithURLPath] options. + +OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS (default: none) - +key-value pairs used as headers associated with HTTP requests. +The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +except that additional semi-colon delimited metadata is not supported. +Example value: "key1=value1,key2=value2". +OTEL_EXPORTER_OTLP_METRICS_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. +The configuration can be overridden by [WithHeaders] option. + +OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_METRICS_TIMEOUT (default: "10000") - +maximum time in milliseconds the OTLP exporter waits for each batch export. +OTEL_EXPORTER_OTLP_METRICS_TIMEOUT takes precedence over OTEL_EXPORTER_OTLP_TIMEOUT. +The configuration can be overridden by [WithTimeout] option. + +OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_METRICS_COMPRESSION (default: none) - +compression strategy the exporter uses to compress the HTTP body. +Supported values: "gzip". +OTEL_EXPORTER_OTLP_METRICS_COMPRESSION takes precedence over OTEL_EXPORTER_OTLP_COMPRESSION. +The configuration can be overridden by [WithCompression] option. + +OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE (default: none) - +filepath to the trusted certificate to use when verifying a server's TLS credentials. +OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CERTIFICATE. +The configuration can be overridden by [WithTLSClientConfig] option. + +OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE (default: none) - +filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. +The configuration can be overridden by [WithTLSClientConfig] option. + +OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY (default: none) - +filepath to the clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. +The configuration can be overridden by [WithTLSClientConfig] option. + +OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE (default: "cumulative") - +aggregation temporality to use on the basis of instrument kind. Supported values: + - "cumulative" - Cumulative aggregation temporality for all instrument kinds, + - "delta" - Delta aggregation temporality for Counter, Asynchronous Counter and Histogram instrument kinds; + Cumulative aggregation for UpDownCounter and Asynchronous UpDownCounter instrument kinds, + - "lowmemory" - Delta aggregation temporality for Synchronous Counter and Histogram instrument kinds; + Cumulative aggregation temporality for Synchronous UpDownCounter, Asynchronous Counter, and Asynchronous UpDownCounter instrument kinds. + +The configuration can be overridden by [WithTemporalitySelector] option. + +OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION (default: "explicit_bucket_histogram") - +default aggregation to use for histogram instruments. Supported values: + - "explicit_bucket_histogram" - [Explicit Bucket Histogram Aggregation], + - "base2_exponential_bucket_histogram" - [Base2 Exponential Bucket Histogram Aggregation]. + +The configuration can be overridden by [WithAggregationSelector] option. + +[W3C Baggage HTTP Header Content Format]: https://www.w3.org/TR/baggage/#header-content +[Explicit Bucket Histogram Aggregation]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/metrics/sdk.md#explicit-bucket-histogram-aggregation +[Base2 Exponential Bucket Histogram Aggregation]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.26.0/specification/metrics/sdk.md#base2-exponential-bucket-histogram-aggregation +*/ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp" diff --git a/exporters/otlp/otlptrace/README.md b/exporters/otlp/otlptrace/README.md deleted file mode 100644 index 50295223182..00000000000 --- a/exporters/otlp/otlptrace/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# OpenTelemetry-Go OTLP Span Exporter - -[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation. - -## Installation - -``` -go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace -``` - -## Examples - -- [HTTP Exporter setup and examples](./otlptracehttp/example_test.go) -- [Full example of gRPC Exporter sending telemetry to a local collector](../../../example/otel-collector) - -## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) - -The `otlptrace` package provides an exporter implementing the OTel span exporter interface. -This exporter is configured using a client satisfying the `otlptrace.Client` interface. -This client handles the transformation of data into wire format and the transmission of that data to the collector. - -## [`otlptracegrpc`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) - -The `otlptracegrpc` package implements a client for the span exporter that sends trace telemetry data to the collector using gRPC with protobuf-encoded payloads. - -## [`otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) - -The `otlptracehttp` package implements a client for the span exporter that sends trace telemetry data to the collector using HTTP with protobuf-encoded payloads. - -## Configuration - -### Environment Variables - -The following environment variables can be used (instead of options objects) to -override the default configuration. For more information about how each of -these environment variables is interpreted, see [the OpenTelemetry -specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md). - -| Environment variable | Option | Default value | -| ------------------------------------------------------------------------ |------------------------------ | -------------------------------------------------------- | -| `OTEL_EXPORTER_OTLP_ENDPOINT` `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | `WithEndpoint` `WithInsecure` | `https://localhost:4317` or `https://localhost:4318`[^1] | -| `OTEL_EXPORTER_OTLP_CERTIFICATE` `OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE` | `WithTLSClientConfig` | | -| `OTEL_EXPORTER_OTLP_HEADERS` `OTEL_EXPORTER_OTLP_TRACES_HEADERS` | `WithHeaders` | | -| `OTEL_EXPORTER_OTLP_COMPRESSION` `OTEL_EXPORTER_OTLP_TRACES_COMPRESSION` | `WithCompression` | | -| `OTEL_EXPORTER_OTLP_TIMEOUT` `OTEL_EXPORTER_OTLP_TRACES_TIMEOUT` | `WithTimeout` | `10s` | - -[^1]: The gRPC client defaults to `https://localhost:4317` and the HTTP client `https://localhost:4318`. - -Configuration using options have precedence over the environment variables. diff --git a/exporters/otlp/otlptrace/doc.go b/exporters/otlp/otlptrace/doc.go new file mode 100644 index 00000000000..9e642235ade --- /dev/null +++ b/exporters/otlp/otlptrace/doc.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otlptrace contains abstractions for OTLP span exporters. +See the official OTLP span exporter implementations: + - [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc], + - [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp]. +*/ +package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" diff --git a/exporters/otlp/otlptrace/otlptracegrpc/doc.go b/exporters/otlp/otlptrace/otlptracegrpc/doc.go new file mode 100644 index 00000000000..1f514ef9ea3 --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/doc.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package otlptracegrpc provides an OTLP span exporter using gRPC. +By default the telemetry is sent to https://localhost:4317. + +Exporter should be created using [New]. + +The environment variables described below can be used for configuration. + +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (default: "https://localhost:4317") - +target to which the exporter sends telemetry. +The target syntax is defined in https://github.com/grpc/grpc/blob/master/doc/naming.md. +The value must contain a host. +The value may additionally a port, a scheme, and a path. +The value accepts "http" and "https" scheme. +The value should not contain a query string or fragment. +OTEL_EXPORTER_OTLP_TRACES_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. +The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - +setting "true" disables client transport security for the exporter's gRPC connection. +You can use this only when an endpoint is provided without the http or https scheme. +OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT setting overrides +the scheme defined via OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT. +OTEL_EXPORTER_OTLP_TRACES_INSECURE takes precedence over OTEL_EXPORTER_OTLP_INSECURE. +The configuration can be overridden by [WithInsecure], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - +key-value pairs used as gRPC metadata associated with gRPC requests. +The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +except that additional semi-colon delimited metadata is not supported. +Example value: "key1=value1,key2=value2". +OTEL_EXPORTER_OTLP_TRACES_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. +The configuration can be overridden by [WithHeaders] option. + +OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT (default: "10000") - +maximum time in milliseconds the OTLP exporter waits for each batch export. +OTEL_EXPORTER_OTLP_TRACES_TIMEOUT takes precedence over OTEL_EXPORTER_OTLP_TIMEOUT. +The configuration can be overridden by [WithTimeout] option. + +OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TRACES_COMPRESSION (default: none) - +the gRPC compressor the exporter uses. +Supported value: "gzip". +OTEL_EXPORTER_OTLP_TRACES_COMPRESSION takes precedence over OTEL_EXPORTER_OTLP_COMPRESSION. +The configuration can be overridden by [WithCompressor], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE (default: none) - +the filepath to the trusted certificate to use when verifying a server's TLS credentials. +OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE (default: none) - +the filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] options. + +OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY (default: none) - +the filepath to the clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. +The configuration can be overridden by [WithTLSCredentials], [WithGRPCConn] option. + +[W3C Baggage HTTP Header Content Format]: https://www.w3.org/TR/baggage/#header-content +*/ +package otlptracegrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" diff --git a/exporters/otlp/otlptrace/otlptracegrpc/example_test.go b/exporters/otlp/otlptrace/otlptracegrpc/example_test.go new file mode 100644 index 00000000000..ee03d1b505a --- /dev/null +++ b/exporters/otlp/otlptrace/otlptracegrpc/example_test.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package otlptracegrpc_test + +import ( + "context" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" + "go.opentelemetry.io/otel/sdk/trace" +) + +func Example() { + ctx := context.Background() + exp, err := otlptracegrpc.New(ctx) + if err != nil { + panic(err) + } + + tracerProvider := trace.NewTracerProvider(trace.WithBatcher(exp)) + defer func() { + if err := tracerProvider.Shutdown(ctx); err != nil { + panic(err) + } + }() + otel.SetTracerProvider(tracerProvider) + + // From here, the tracerProvider can be used by instrumentation to collect + // telemetry. +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 78ce9ad8f0b..17ffeaf6ef0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -93,13 +93,7 @@ func compressorToCompression(compressor string) otlpconfig.Compression { } // WithCompressor sets the compressor for the gRPC client to use when sending -// requests. It is the responsibility of the caller to ensure that the -// compressor set has been registered with google.golang.org/grpc/encoding. -// This can be done by encoding.RegisterCompressor. Some compressors -// auto-register on import, such as gzip, which can be registered by calling -// `import _ "google.golang.org/grpc/encoding/gzip"`. -// -// This option has no effect if WithGRPCConn is used. +// requests. Supported compressor values: "gzip". func WithCompressor(compressor string) Option { return wrappedOption{otlpconfig.WithCompression(compressorToCompression(compressor))} } diff --git a/exporters/otlp/otlptrace/otlptracehttp/doc.go b/exporters/otlp/otlptrace/otlptracehttp/doc.go index e7f066b43ce..854cc38c8e4 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/doc.go +++ b/exporters/otlp/otlptrace/otlptracehttp/doc.go @@ -13,7 +13,62 @@ // limitations under the License. /* -Package otlptracehttp a client that sends traces to the collector using HTTP -with binary protobuf payloads. +Package otlptracehttp provides an OTLP span exporter using HTTP with protobuf payloads. +By default the telemetry is sent to https://localhost:4318/v1/traces. + +Exporter should be created using [New]. + +The environment variables described below can be used for configuration. + +OTEL_EXPORTER_OTLP_ENDPOINT (default: "https://localhost:4318") - +target base URL ("/v1/traces" is appended) to which the exporter sends telemetry. +The value must contain a scheme ("http" or "https") and host. +The value may additionally contain a port and a path. +The value should not contain a query string or fragment. +The configuration can be overridden by OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +environment variable and by [WithEndpoint], [WithInsecure] options. + +OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (default: "https://localhost:4318/v1/traces") - +target URL to which the exporter sends telemetry. +The value must contain a scheme ("http" or "https") and host. +The value may additionally contain a port and a path. +The value should not contain a query string or fragment. +The configuration can be overridden by [WithEndpoint], [WitnInsecure], [WithURLPath] options. + +OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - +key-value pairs used as headers associated with HTTP requests. +The value is expected to be represented in a format matching to the [W3C Baggage HTTP Header Content Format], +except that additional semi-colon delimited metadata is not supported. +Example value: "key1=value1,key2=value2". +OTEL_EXPORTER_OTLP_TRACES_HEADERS takes precedence over OTEL_EXPORTER_OTLP_HEADERS. +The configuration can be overridden by [WithHeaders] option. + +OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT (default: "10000") - +maximum time in milliseconds the OTLP exporter waits for each batch export. +OTEL_EXPORTER_OTLP_TRACES_TIMEOUT takes precedence over OTEL_EXPORTER_OTLP_TIMEOUT. +The configuration can be overridden by [WithTimeout] option. + +OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TRACES_COMPRESSION (default: none) - +the compression strategy the exporter uses to compress the HTTP body. +Supported value: "gzip". +OTEL_EXPORTER_OTLP_TRACES_COMPRESSION takes precedence over OTEL_EXPORTER_OTLP_COMPRESSION. +The configuration can be overridden by [WithCompression] option. + +OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE (default: none) - +the filepath to the trusted certificate to use when verifying a server's TLS credentials. +OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CERTIFICATE. +The configuration can be overridden by [WithTLSClientConfig] option. + +OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE (default: none) - +the filepath to the client certificate/chain trust for clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE takes precedence over OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE. +The configuration can be overridden by [WithTLSClientConfig] option. + +OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY (default: none) - +the filepath to the clients private key to use in mTLS communication in PEM format. +OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY takes precedence over OTEL_EXPORTER_OTLP_CLIENT_KEY. +The configuration can be overridden by [WithTLSClientConfig] option. + +[W3C Baggage HTTP Header Content Format]: https://www.w3.org/TR/baggage/#header-content */ package otlptracehttp // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" diff --git a/exporters/otlp/otlptrace/otlptracehttp/example_test.go b/exporters/otlp/otlptrace/otlptracehttp/example_test.go index d6bf4b0ab17..d67bdf5afea 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/example_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/example_test.go @@ -16,79 +16,27 @@ package otlptracehttp_test import ( "context" - "fmt" - "log" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" - "go.opentelemetry.io/otel/sdk/resource" - sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" - "go.opentelemetry.io/otel/trace" + "go.opentelemetry.io/otel/sdk/trace" ) -const ( - instrumentationName = "github.com/instrumentron" - instrumentationVersion = "0.1.0" -) - -var tracer = otel.GetTracerProvider().Tracer( - instrumentationName, - trace.WithInstrumentationVersion(instrumentationVersion), - trace.WithSchemaURL(semconv.SchemaURL), -) - -func add(ctx context.Context, x, y int64) int64 { - var span trace.Span - _, span = tracer.Start(ctx, "Addition") - defer span.End() - - return x + y -} - -func multiply(ctx context.Context, x, y int64) int64 { - var span trace.Span - _, span = tracer.Start(ctx, "Multiplication") - defer span.End() - - return x * y -} - -func newResource() *resource.Resource { - return resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("otlptrace-example"), - semconv.ServiceVersion("0.0.1"), - ) -} - -func installExportPipeline(ctx context.Context) (func(context.Context) error, error) { - exporter, err := otlptracehttp.New(ctx) - if err != nil { - return nil, fmt.Errorf("creating OTLP trace exporter: %w", err) - } - - tracerProvider := sdktrace.NewTracerProvider( - sdktrace.WithBatcher(exporter), - sdktrace.WithResource(newResource()), - ) - otel.SetTracerProvider(tracerProvider) - - return tracerProvider.Shutdown, nil -} - func Example() { ctx := context.Background() - // Registers a tracer Provider globally. - shutdown, err := installExportPipeline(ctx) + exp, err := otlptracehttp.New(ctx) if err != nil { - log.Fatal(err) + panic(err) } + + tracerProvider := trace.NewTracerProvider(trace.WithBatcher(exp)) defer func() { - if err := shutdown(ctx); err != nil { - log.Fatal(err) + if err := tracerProvider.Shutdown(ctx); err != nil { + panic(err) } }() + otel.SetTracerProvider(tracerProvider) - log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) + // From here, the tracerProvider can be used by instrumentation to collect + // telemetry. } From be5064a38704694ed75171eb8ff3e11b9f25cd44 Mon Sep 17 00:00:00 2001 From: Michael Blum Date: Thu, 9 Nov 2023 12:51:59 -0600 Subject: [PATCH 761/886] Use url.PathUnescape rather than url.QueryUnescape when parsing OTLP headers and resource attributes env vars (#4698) (#4699) --- CHANGELOG.md | 7 ++++- .../internal/envconfig/envconfig.go | 4 +-- .../internal/envconfig/envconfig_test.go | 17 ++++++++++- .../internal/envconfig/envconfig.go | 4 +-- .../internal/envconfig/envconfig_test.go | 17 ++++++++++- .../internal/envconfig/envconfig.go | 4 +-- .../internal/envconfig/envconfig_test.go | 17 ++++++++++- .../internal/envconfig/envconfig.go | 4 +-- .../internal/envconfig/envconfig_test.go | 17 ++++++++++- .../shared/otlp/envconfig/envconfig.go.tmpl | 4 +-- .../otlp/envconfig/envconfig_test.go.tmpl | 17 ++++++++++- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 30 +++++++++++++++++++ 13 files changed, 127 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bebd78266fa..83c61ef2579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed -- Fix improper parsing of characters such us `+`, `\` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) +- Fix improper parsing of characters such us `+`, `/` by `Parse` in `go.opentelemetry.io/otel/baggage` as they were rendered as a whitespace. (#4667) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_RESOURCE_ATTRIBUTES` in `go.opentelemetry.io/otel/sdk/resource` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_METRICS_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracegrpc` as they were rendered as a whitespace. (#4699) +- Fix improper parsing of characters such us `+`, `/` passed via `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_TRACES_HEADERS` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp` as they were rendered as a whitespace. (#4699) - In `go.opentelemetry.op/otel/exporters/prometheus`, the exporter no longer `Collect`s metrics after `Shutdown` is invoked. (#4648) - Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#4695) - Fix documentation for `WithCompressor` in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4695) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go index 1d571294695..17951ceb451 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig.go @@ -174,13 +174,13 @@ func stringToHeader(value string) map[string]string { global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(n) + name, err := url.PathUnescape(n) if err != nil { global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) + value, err := url.PathUnescape(v) if err != nil { global.Error(err, "escape header value", "value", v) continue diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go index cec506208d5..6cbe0c7ab11 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/envconfig/envconfig_test.go @@ -427,7 +427,12 @@ func TestStringToHeader(t *testing.T) { want: map[string]string{"userId": "alice"}, }, { - name: "multiples headers encoded", + name: "simple header conforms to RFC 3986 spec", + value: " userId = alice+test ", + want: map[string]string{"userId": "alice+test"}, + }, + { + name: "multiple headers encoded", value: "userId=alice,serverNode=DF%3A28,isProduction=false", want: map[string]string{ "userId": "alice", @@ -435,6 +440,16 @@ func TestStringToHeader(t *testing.T) { "isProduction": "false", }, }, + { + name: "multiple headers encoded per RFC 3986 spec", + value: "userId=alice+test,serverNode=DF%3A28,isProduction=false,namespace=localhost/test", + want: map[string]string{ + "userId": "alice+test", + "serverNode": "DF:28", + "isProduction": "false", + "namespace": "localhost/test", + }, + }, { name: "invalid headers format", value: "userId:alice", diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go index 38859fb9342..9dfb55c41bb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig.go @@ -174,13 +174,13 @@ func stringToHeader(value string) map[string]string { global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(n) + name, err := url.PathUnescape(n) if err != nil { global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) + value, err := url.PathUnescape(v) if err != nil { global.Error(err, "escape header value", "value", v) continue diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go index cec506208d5..6cbe0c7ab11 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/envconfig/envconfig_test.go @@ -427,7 +427,12 @@ func TestStringToHeader(t *testing.T) { want: map[string]string{"userId": "alice"}, }, { - name: "multiples headers encoded", + name: "simple header conforms to RFC 3986 spec", + value: " userId = alice+test ", + want: map[string]string{"userId": "alice+test"}, + }, + { + name: "multiple headers encoded", value: "userId=alice,serverNode=DF%3A28,isProduction=false", want: map[string]string{ "userId": "alice", @@ -435,6 +440,16 @@ func TestStringToHeader(t *testing.T) { "isProduction": "false", }, }, + { + name: "multiple headers encoded per RFC 3986 spec", + value: "userId=alice+test,serverNode=DF%3A28,isProduction=false,namespace=localhost/test", + want: map[string]string{ + "userId": "alice+test", + "serverNode": "DF:28", + "isProduction": "false", + "namespace": "localhost/test", + }, + }, { name: "invalid headers format", value: "userId:alice", diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go index becb1f0fbbe..5530119e4cf 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go @@ -174,13 +174,13 @@ func stringToHeader(value string) map[string]string { global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(n) + name, err := url.PathUnescape(n) if err != nil { global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) + value, err := url.PathUnescape(v) if err != nil { global.Error(err, "escape header value", "value", v) continue diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go index cec506208d5..6cbe0c7ab11 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig_test.go @@ -427,7 +427,12 @@ func TestStringToHeader(t *testing.T) { want: map[string]string{"userId": "alice"}, }, { - name: "multiples headers encoded", + name: "simple header conforms to RFC 3986 spec", + value: " userId = alice+test ", + want: map[string]string{"userId": "alice+test"}, + }, + { + name: "multiple headers encoded", value: "userId=alice,serverNode=DF%3A28,isProduction=false", want: map[string]string{ "userId": "alice", @@ -435,6 +440,16 @@ func TestStringToHeader(t *testing.T) { "isProduction": "false", }, }, + { + name: "multiple headers encoded per RFC 3986 spec", + value: "userId=alice+test,serverNode=DF%3A28,isProduction=false,namespace=localhost/test", + want: map[string]string{ + "userId": "alice+test", + "serverNode": "DF:28", + "isProduction": "false", + "namespace": "localhost/test", + }, + }, { name: "invalid headers format", value: "userId:alice", diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go index 5e9e8185d15..8016b7a0b88 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig.go @@ -174,13 +174,13 @@ func stringToHeader(value string) map[string]string { global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(n) + name, err := url.PathUnescape(n) if err != nil { global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) + value, err := url.PathUnescape(v) if err != nil { global.Error(err, "escape header value", "value", v) continue diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go index cec506208d5..6cbe0c7ab11 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/envconfig/envconfig_test.go @@ -427,7 +427,12 @@ func TestStringToHeader(t *testing.T) { want: map[string]string{"userId": "alice"}, }, { - name: "multiples headers encoded", + name: "simple header conforms to RFC 3986 spec", + value: " userId = alice+test ", + want: map[string]string{"userId": "alice+test"}, + }, + { + name: "multiple headers encoded", value: "userId=alice,serverNode=DF%3A28,isProduction=false", want: map[string]string{ "userId": "alice", @@ -435,6 +440,16 @@ func TestStringToHeader(t *testing.T) { "isProduction": "false", }, }, + { + name: "multiple headers encoded per RFC 3986 spec", + value: "userId=alice+test,serverNode=DF%3A28,isProduction=false,namespace=localhost/test", + want: map[string]string{ + "userId": "alice+test", + "serverNode": "DF:28", + "isProduction": "false", + "namespace": "localhost/test", + }, + }, { name: "invalid headers format", value: "userId:alice", diff --git a/internal/shared/otlp/envconfig/envconfig.go.tmpl b/internal/shared/otlp/envconfig/envconfig.go.tmpl index 480f5f3cfd0..b516e9ca2c3 100644 --- a/internal/shared/otlp/envconfig/envconfig.go.tmpl +++ b/internal/shared/otlp/envconfig/envconfig.go.tmpl @@ -174,13 +174,13 @@ func stringToHeader(value string) map[string]string { global.Error(errors.New("missing '="), "parse headers", "input", header) continue } - name, err := url.QueryUnescape(n) + name, err := url.PathUnescape(n) if err != nil { global.Error(err, "escape header key", "key", n) continue } trimmedName := strings.TrimSpace(name) - value, err := url.QueryUnescape(v) + value, err := url.PathUnescape(v) if err != nil { global.Error(err, "escape header value", "value", v) continue diff --git a/internal/shared/otlp/envconfig/envconfig_test.go.tmpl b/internal/shared/otlp/envconfig/envconfig_test.go.tmpl index cec506208d5..6cbe0c7ab11 100644 --- a/internal/shared/otlp/envconfig/envconfig_test.go.tmpl +++ b/internal/shared/otlp/envconfig/envconfig_test.go.tmpl @@ -427,7 +427,12 @@ func TestStringToHeader(t *testing.T) { want: map[string]string{"userId": "alice"}, }, { - name: "multiples headers encoded", + name: "simple header conforms to RFC 3986 spec", + value: " userId = alice+test ", + want: map[string]string{"userId": "alice+test"}, + }, + { + name: "multiple headers encoded", value: "userId=alice,serverNode=DF%3A28,isProduction=false", want: map[string]string{ "userId": "alice", @@ -435,6 +440,16 @@ func TestStringToHeader(t *testing.T) { "isProduction": "false", }, }, + { + name: "multiple headers encoded per RFC 3986 spec", + value: "userId=alice+test,serverNode=DF%3A28,isProduction=false,namespace=localhost/test", + want: map[string]string{ + "userId": "alice+test", + "serverNode": "DF:28", + "isProduction": "false", + "namespace": "localhost/test", + }, + }, { name: "invalid headers format", value: "userId:alice", diff --git a/sdk/resource/env.go b/sdk/resource/env.go index 7e49ed58116..e29ae563a69 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -89,7 +89,7 @@ func constructOTResources(s string) (*Resource, error) { continue } key := strings.TrimSpace(k) - val, err := url.QueryUnescape(strings.TrimSpace(v)) + val, err := url.PathUnescape(strings.TrimSpace(v)) if err != nil { // Retain original value if decoding fails, otherwise it will be // an empty string. diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index e47aaa5babd..a6754f74bc6 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -40,6 +40,19 @@ func TestDetectOnePair(t *testing.T) { assert.Equal(t, NewSchemaless(attribute.String("key", "value")), res) } +func TestDetectURIEncodingOnePair(t *testing.T) { + store, err := ottest.SetEnvVariables(map[string]string{ + resourceAttrKey: "key=x+y+z?q=123", + }) + require.NoError(t, err) + defer func() { require.NoError(t, store.Restore()) }() + + detector := &fromEnv{} + res, err := detector.Detect(context.Background()) + require.NoError(t, err) + assert.Equal(t, NewSchemaless(attribute.String("key", "x+y+z?q=123")), res) +} + func TestDetectMultiPairs(t *testing.T) { store, err := ottest.SetEnvVariables(map[string]string{ "x": "1", @@ -60,6 +73,23 @@ func TestDetectMultiPairs(t *testing.T) { ), res) } +func TestDetectURIEncodingMultiPairs(t *testing.T) { + store, err := ottest.SetEnvVariables(map[string]string{ + "x": "1", + resourceAttrKey: "key=x+y+z,namespace=localhost/test&verify", + }) + require.NoError(t, err) + defer func() { require.NoError(t, store.Restore()) }() + + detector := &fromEnv{} + res, err := detector.Detect(context.Background()) + require.NoError(t, err) + assert.Equal(t, NewSchemaless( + attribute.String("key", "x+y+z"), + attribute.String("namespace", "localhost/test&verify"), + ), res) +} + func TestEmpty(t *testing.T) { store, err := ottest.SetEnvVariables(map[string]string{ resourceAttrKey: " ", From 94a41d7464b4e034d2d47c8b9703907726eed572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 10 Nov 2023 07:32:30 +0100 Subject: [PATCH 762/886] logs: Update project status (#4702) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 41bc6a26a67..2c5b0cc28ab 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | -|---------|--------------------| -| Traces | Stable | -| Metrics | Stable | -| Logs | In Development [1] | +| Signal | Status | +|---------|------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | Design [1] | -- [1]: Currently the logs signal development is in a design phase. +- [1]: Currently the logs signal development is in a design phase ([#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696)). No Logs Pull Requests are currently being accepted. Progress and status specific to this repository is tracked in our From 85e4c467da71aa1ce1423c7bbb7a99f1810f9e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 10 Nov 2023 17:42:33 +0100 Subject: [PATCH 763/886] Release v1.20.0/v0.43.0 (#4705) --- CHANGELOG.md | 15 ++++++++++----- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/fib/go.mod | 10 +++++----- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/view/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlpmetric/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 37 files changed, 145 insertions(+), 140 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83c61ef2579..c4e7ad475f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.20.0/0.43.0] 2023-11-10 + +This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. + ### Added - Add `go.opentelemetry.io/otel/bridge/opencensus.InstallTraceBridge`, which installs the OpenCensus trace bridge, and replaces `opencensus.NewTracer`. (#4567) @@ -39,15 +43,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type. This extends the `TracerProvider` interface and is is a breaking change for any existing implementation. Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type. This extends the `Tracer` interface and is is a breaking change for any existing implementation. Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type. This extends the `Span` interface and is is a breaking change for any existing implementation. Implementors need to update their implementations based on what they want the default behavior of the interface to be. - See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more informatoin about how to accomplish this. (#4620) + See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660) - Retry for `502 Bad Gateway` and `504 Gateway Timeout` HTTP statuses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4670) @@ -2717,7 +2721,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.19.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.20.0...HEAD +[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 [1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 [1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 [1.18.0/0.41.0/0.0.6]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.18.0 @@ -2792,7 +2797,7 @@ It contains api and sdk for trace and meter. [Go 1.20]: https://go.dev/doc/go1.20 [Go 1.19]: https://go.dev/doc/go1.19 [Go 1.18]: https://go.dev/doc/go1.18 -[Go 1.19]: https://go.dev/doc/go1.19 [metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric [metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric +[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 72b390c7178..374822ba851 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 9e45c8faa5b..7fb92727b7c 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/bridge/opencensus v0.42.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/bridge/opencensus v0.43.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 2ce168e845a..6a7931d79f6 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "0.42.0" + return "0.43.0" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index a2c002c8dce..29c3904262b 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 85bfcfb5962..07572924dcf 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/bridge/opentracing v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/bridge/opentracing v1.20.0 google.golang.org/grpc v1.59.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index ce4bc480b25..b5ee7129bd5 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.43.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 ) require ( github.com/felixge/httpsnoop v1.0.3 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/fib/go.mod b/example/fib/go.mod index 180448b3add..2637dc76f33 100644 --- a/example/fib/go.mod +++ b/example/fib/go.mod @@ -4,16 +4,16 @@ module go.opentelemetry.io/otel/example/fib go 1.20 require ( - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index d7ec6c1403c..28d7d5d519f 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index c239979a406..1413220197d 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/bridge/opencensus v0.42.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.42.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/bridge/opencensus v0.43.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.43.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 8899e112401..470f06e9775 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 google.golang.org/grpc v1.59.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 01c33666a9c..ca66eeca256 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index a3e00f86db6..af2614c5e4e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.17.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/prometheus v0.42.0 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/prometheus v0.43.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/sdk v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/sdk v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/view/go.mod b/example/view/go.mod index 6f222f0d315..328dfc304a6 100644 --- a/example/view/go.mod +++ b/example/view/go.mod @@ -5,11 +5,11 @@ go 1.20 require ( github.com/prometheus/client_golang v1.17.0 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/prometheus v0.42.0 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/prometheus v0.43.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 ) require ( @@ -22,7 +22,7 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index f9557a79f5a..038aeb15614 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/zipkin v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/zipkin v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index ebe9cb2c87c..a6b4b53bfb6 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d google.golang.org/grpc v1.59.0 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index edb47814afa..5559d07f166 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "0.42.0" + return "0.43.0" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 89d20dbe872..6e0bfbefac9 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 287b63cbd0b..fddac629584 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "0.42.0" + return "0.43.0" } diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go index b4ecccdfb40..e4e15ca8f34 100644 --- a/exporters/otlp/otlpmetric/version.go +++ b/exporters/otlp/otlpmetric/version.go @@ -16,5 +16,5 @@ package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric // Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. func Version() string { - return "0.42.0" + return "0.43.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 33195ce2028..05be37c0d30 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 15ee26b6c99..2aa516a9da0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index b973cb324f8..d036e834e1e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 10ac73ee3b8..620ea88bf14 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.19.0" + return "1.20.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 72bbc29e8f1..8171dd61e91 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 google.golang.org/protobuf v1.31.0 ) @@ -25,7 +25,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index ab09dd0a90b..24745cf95c5 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/sdk/metric v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk/metric v1.20.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index a055e31e4c8..ed01ce0a33e 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 9053b0b00fb..61e1d88cb31 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 501dbba66e0..f21dd71302d 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 78a763ef2da..4d3aa33b98f 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel v1.20.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 04c17d778f0..995cd01ed41 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.3.0 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/trace v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/trace v1.20.0 golang.org/x/sys v0.14.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.19.0 // indirect + go.opentelemetry.io/otel/metric v1.20.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 98c3fdcf47b..92ed848e9e6 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 - go.opentelemetry.io/otel/metric v1.19.0 - go.opentelemetry.io/otel/sdk v1.19.0 + go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel/metric v1.20.0 + go.opentelemetry.io/otel/sdk v1.20.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.19.0 // indirect + go.opentelemetry.io/otel/trace v1.20.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 3de4e06dc4d..4437747f208 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.19.0" + return "1.20.0" } diff --git a/sdk/version.go b/sdk/version.go index 72d2cb09f7b..7048c788e93 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.19.0" + return "1.20.0" } diff --git a/trace/go.mod b/trace/go.mod index 88f8f02b94b..ddec57195ee 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.19.0 + go.opentelemetry.io/otel v1.20.0 ) require ( diff --git a/version.go b/version.go index ad64e199672..5a92f1d4b6c 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.19.0" + return "1.20.0" } diff --git a/versions.yaml b/versions.yaml index 7d212769240..82366e79981 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.19.0 + version: v1.20.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -35,7 +35,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.42.0 + version: v0.43.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From ca2b22b3bef211c01f5d448296e68c81b3273ffb Mon Sep 17 00:00:00 2001 From: Michael Blum Date: Mon, 13 Nov 2023 01:22:34 -0600 Subject: [PATCH 764/886] Document PR commits preference in CONTRIBUTING.md (#4704) --- CONTRIBUTING.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a00dbca7b08..850606ae692 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,6 +90,10 @@ git push Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull request ID to the entry you added to `CHANGELOG.md`. +Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request. +Rewriting Git history makes it difficult to keep track of iterations during code review. +All pull requests are squashed to a single commit upon merge to `main`. + ### How to Receive Comments * If the PR is not ready for review, please put `[WIP]` in the title, From 491d65cdaa88d8f38830bbf42b06ad3893a9e19a Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 13 Nov 2023 04:38:02 -0300 Subject: [PATCH 765/886] dependabot updates Mon Nov 13 07:28:44 UTC 2023 (#4712) Bump github.com/jcchavezs/porto from 0.5.1 to 0.6.0 in /internal/tools Bump golang.org/x/tools from 0.14.0 to 0.15.0 in /internal/tools Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.45.0 to 0.46.0 in /example/dice --- example/dice/go.mod | 4 ++-- example/dice/go.sum | 8 ++++---- internal/tools/go.mod | 14 +++++++------- internal/tools/go.sum | 30 +++++++++++++++--------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/example/dice/go.mod b/example/dice/go.mod index b5ee7129bd5..a6b78266570 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/dice go 1.20 require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 go.opentelemetry.io/otel v1.20.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.43.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 @@ -13,7 +13,7 @@ require ( ) require ( - github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.20.0 // indirect diff --git a/example/dice/go.sum b/example/dice/go.sum index 5a2d13ec65d..c3b05cb1e89 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -1,6 +1,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -9,8 +9,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 h1:x8Z78aZx8cOF0+Kkazoc7lwUNMGy0LrzEMxTm4BbTxg= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0/go.mod h1:62CPTSry9QZtOaSsE3tOzhx6LzDhHnXJ6xHeMNNiM6Q= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5f729dd63a1..53ea79ff862 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.55.2 github.com/itchyny/gojq v0.12.13 - github.com/jcchavezs/porto v0.5.1 + github.com/jcchavezs/porto v0.6.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.12.0 go.opentelemetry.io/build-tools/dbotconf v0.12.0 @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.14.0 + golang.org/x/tools v0.15.0 golang.org/x/vuln v1.0.1 ) @@ -203,13 +203,13 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.14.0 // indirect + golang.org/x/crypto v0.15.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sync v0.4.0 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.14.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 1d6f494ac7b..fc001456489 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -345,8 +345,8 @@ github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jcchavezs/porto v0.5.1 h1:Uq3x85zFfgipfdHMeeyoh3gHs/oHM9waGCivLNuzLIc= -github.com/jcchavezs/porto v0.5.1/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= +github.com/jcchavezs/porto v0.6.0 h1:AgQLGwsXaxDkPj4Y+paFkVGLAR4n/1RRF0xV5UKinwg= +github.com/jcchavezs/porto v0.6.0/go.mod h1:fESH0gzDHiutHRdX2hv27ojnOVFco37hg1W6E9EZF4A= github.com/jgautheron/goconst v1.6.0 h1:gbMLWKRMkzAc6kYsQL6/TxaoBUg3Jm9LSF/Ih1ADWGA= github.com/jgautheron/goconst v1.6.0/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs= @@ -664,8 +664,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -712,8 +712,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -757,8 +757,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -782,8 +782,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -854,7 +854,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -867,8 +867,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -942,8 +942,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= +golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 27c5c7347b8e6b4fa9007c27fb94b68e7f0d19ed Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Nov 2023 07:27:07 -0800 Subject: [PATCH 766/886] Remove the deprecated NewTracer from OC bridge (#4706) * Remove the deprecated NewTracer from OC bridge * Update PR number in changelog * Remove example test for NewTracer --------- Co-authored-by: David Ashpole --- CHANGELOG.md | 4 ++++ bridge/opencensus/example_test.go | 11 ----------- bridge/opencensus/trace.go | 9 --------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4e7ad475f5..05e0d6564a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Removed + +- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) + ## [1.20.0/0.43.0] 2023-11-10 This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. diff --git a/bridge/opencensus/example_test.go b/bridge/opencensus/example_test.go index 57fef19e168..3fa3b62179c 100644 --- a/bridge/opencensus/example_test.go +++ b/bridge/opencensus/example_test.go @@ -15,21 +15,10 @@ package opencensus_test import ( - octrace "go.opencensus.io/trace" - - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/bridge/opencensus" "go.opentelemetry.io/otel/sdk/metric" ) -func ExampleNewTracer() { - // Create an OpenTelemetry Tracer to use to record spans. - tracer := otel.GetTracerProvider().Tracer("go.opentelemetry.io/otel/bridge/opencensus") - // Overwrite the OpenCensus DefaultTracer so that it uses OpenTelemetry - // rather than OpenCensus. - octrace.DefaultTracer = opencensus.NewTracer(tracer) -} - func ExampleNewMetricProducer() { // Create the OpenCensus Metric bridge. bridge := opencensus.NewMetricProducer() diff --git a/bridge/opencensus/trace.go b/bridge/opencensus/trace.go index b1df5a3ca6c..92ec6d6961a 100644 --- a/bridge/opencensus/trace.go +++ b/bridge/opencensus/trace.go @@ -23,15 +23,6 @@ import ( "go.opentelemetry.io/otel/trace" ) -// NewTracer returns an implementation of the OpenCensus Tracer interface which -// uses OpenTelemetry APIs. Using this implementation of Tracer "upgrades" -// libraries that use OpenCensus to OpenTelemetry to facilitate a migration. -// -// Deprecated: Use InstallTraceBridge instead. -func NewTracer(tracer trace.Tracer) octrace.Tracer { - return internal.NewTracer(tracer) -} - // InstallTraceBridge installs the OpenCensus trace bridge, which overwrites // the global OpenCensus tracer implementation. Once the bridge is installed, // spans recorded using OpenCensus are redirected to the OpenTelemetry SDK. From c8e60d1357918f1349e510d92d38609d7d739dd1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Nov 2023 08:40:40 -0800 Subject: [PATCH 767/886] Remove the deprecated view example (#4708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove the deprecated view example * Update PR number in changelog * Update versions.yaml --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + example/view/doc.go | 18 -------- example/view/go.mod | 40 ------------------ example/view/go.sum | 37 ----------------- example/view/main.go | 98 -------------------------------------------- versions.yaml | 1 - 6 files changed, 1 insertion(+), 194 deletions(-) delete mode 100644 example/view/doc.go delete mode 100644 example/view/go.mod delete mode 100644 example/view/go.sum delete mode 100644 example/view/main.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e0d6564a9..af98ee9cf0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Removed - Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) ## [1.20.0/0.43.0] 2023-11-10 diff --git a/example/view/doc.go b/example/view/doc.go deleted file mode 100644 index ccf2a205d98..00000000000 --- a/example/view/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package main provides a code sample of using metric views to customize instruments. -// -// Deprecated: See [go.opentelemetry.io/otel/example/prometheus] instead. -package main diff --git a/example/view/go.mod b/example/view/go.mod deleted file mode 100644 index 328dfc304a6..00000000000 --- a/example/view/go.mod +++ /dev/null @@ -1,40 +0,0 @@ -// Deprecated: see go.opentelemetry.io/otel/example/prometheus instead. -module go.opentelemetry.io/otel/example/view - -go 1.20 - -require ( - github.com/prometheus/client_golang v1.17.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/prometheus v0.43.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 -) - -require ( - github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect - golang.org/x/sys v0.14.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect -) - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/exporters/prometheus => ../../exporters/prometheus - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/sdk/metric => ../../sdk/metric - -replace go.opentelemetry.io/otel/metric => ../../metric - -replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/view/go.sum b/example/view/go.sum deleted file mode 100644 index 45bf221777f..00000000000 --- a/example/view/go.sum +++ /dev/null @@ -1,37 +0,0 @@ -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/view/main.go b/example/view/main.go deleted file mode 100644 index 876457052b9..00000000000 --- a/example/view/main.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "context" - "fmt" - "log" - "net/http" - "os" - "os/signal" - - "github.com/prometheus/client_golang/prometheus/promhttp" - - "go.opentelemetry.io/otel/attribute" - otelprom "go.opentelemetry.io/otel/exporters/prometheus" - api "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/sdk/instrumentation" - "go.opentelemetry.io/otel/sdk/metric" -) - -const meterName = "github.com/open-telemetry/opentelemetry-go/example/view" - -func main() { - ctx := context.Background() - - // The exporter embeds a default OpenTelemetry Reader, allowing it to be used in WithReader. - exporter, err := otelprom.New() - if err != nil { - log.Fatal(err) - } - - provider := metric.NewMeterProvider( - metric.WithReader(exporter), - // View to customize histogram buckets and rename a single histogram instrument. - metric.WithView(metric.NewView( - metric.Instrument{ - Name: "custom_histogram", - Scope: instrumentation.Scope{Name: meterName}, - }, - metric.Stream{ - Name: "bar", - Aggregation: metric.AggregationExplicitBucketHistogram{ - Boundaries: []float64{64, 128, 256, 512, 1024, 2048, 4096}, - }, - }, - )), - ) - meter := provider.Meter(meterName) - - // Start the prometheus HTTP server and pass the exporter Collector to it - go serveMetrics() - - opt := api.WithAttributes( - attribute.Key("A").String("B"), - attribute.Key("C").String("D"), - ) - - counter, err := meter.Float64Counter("foo", api.WithDescription("a simple counter")) - if err != nil { - log.Fatal(err) - } - counter.Add(ctx, 5, opt) - - histogram, err := meter.Float64Histogram("custom_histogram", api.WithDescription("a histogram with custom buckets and rename")) - if err != nil { - log.Fatal(err) - } - histogram.Record(ctx, 136, opt) - histogram.Record(ctx, 64, opt) - histogram.Record(ctx, 701, opt) - histogram.Record(ctx, 830, opt) - - ctx, _ = signal.NotifyContext(ctx, os.Interrupt) - <-ctx.Done() -} - -func serveMetrics() { - log.Printf("serving metrics at localhost:2222/metrics") - http.Handle("/metrics", promhttp.Handler()) - err := http.ListenAndServe(":2222", nil) //nolint:gosec // Ignoring G114: Use of net/http serve function that has no support for setting timeouts. - if err != nil { - fmt.Printf("error serving http: %v", err) - return - } -} diff --git a/versions.yaml b/versions.yaml index 82366e79981..c8c4ad6e20a 100644 --- a/versions.yaml +++ b/versions.yaml @@ -41,7 +41,6 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/example/view - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp From a2cb6044b2ec10beb38f4612d4421551c48064dc Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 13 Nov 2023 09:20:05 -0800 Subject: [PATCH 768/886] Remove the deprecated otlpmetric module (#4707) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove the deprecated otlpmetric module * Add changelog entry * Update versions.yaml --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + exporters/otlp/otlpmetric/doc.go | 23 --------------- exporters/otlp/otlpmetric/go.mod | 15 ---------- exporters/otlp/otlpmetric/go.sum | 23 --------------- exporters/otlp/otlpmetric/version.go | 20 ------------- exporters/otlp/otlpmetric/version_test.go | 34 ----------------------- versions.yaml | 1 - 7 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 exporters/otlp/otlpmetric/doc.go delete mode 100644 exporters/otlp/otlpmetric/go.mod delete mode 100644 exporters/otlp/otlpmetric/go.sum delete mode 100644 exporters/otlp/otlpmetric/version.go delete mode 100644 exporters/otlp/otlpmetric/version_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index af98ee9cf0a..b11a1e30860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Removed - Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) +- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) - Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) ## [1.20.0/0.43.0] 2023-11-10 diff --git a/exporters/otlp/otlpmetric/doc.go b/exporters/otlp/otlpmetric/doc.go deleted file mode 100644 index c641071a1cd..00000000000 --- a/exporters/otlp/otlpmetric/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package otlpmetric provides an OpenTelemetry metric Exporter that can be -// used with PeriodicReader. It transforms metricdata into OTLP and transmits -// the transformed data to OTLP receivers. The Exporter is configurable to use -// different Clients, each using a distinct transport protocol to communicate -// to an OTLP receiving endpoint. -// -// Deprecated: Use [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc] -// or [go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp] instead. -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" diff --git a/exporters/otlp/otlpmetric/go.mod b/exporters/otlp/otlpmetric/go.mod deleted file mode 100644 index bd76e6bcc41..00000000000 --- a/exporters/otlp/otlpmetric/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -// Deprecated: use go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc or go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp instead. -module go.opentelemetry.io/otel/exporters/otlp/otlpmetric - -go 1.20 - -require github.com/stretchr/testify v1.8.4 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/exporters/otlp/otlpmetric/go.sum b/exporters/otlp/otlpmetric/go.sum deleted file mode 100644 index 3ee4af40e76..00000000000 --- a/exporters/otlp/otlpmetric/go.sum +++ /dev/null @@ -1,23 +0,0 @@ -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/version.go b/exporters/otlp/otlpmetric/version.go deleted file mode 100644 index e4e15ca8f34..00000000000 --- a/exporters/otlp/otlpmetric/version.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" - -// Version is the current release version of the OpenTelemetry OTLP metrics exporter in use. -func Version() string { - return "0.43.0" -} diff --git a/exporters/otlp/otlpmetric/version_test.go b/exporters/otlp/otlpmetric/version_test.go deleted file mode 100644 index e0f3a3ef3b5..00000000000 --- a/exporters/otlp/otlpmetric/version_test.go +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package otlpmetric_test - -import ( - "regexp" - "testing" - - "github.com/stretchr/testify/assert" - - "go.opentelemetry.io/otel/exporters/otlp/otlpmetric" -) - -// regex taken from https://github.com/Masterminds/semver/tree/v3.1.1 -var versionRegex = regexp.MustCompile(`^v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` + - `(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` + - `(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?$`) - -func TestVersionSemver(t *testing.T) { - v := otlpmetric.Version() - assert.NotNil(t, versionRegex.FindStringSubmatch(v), "version is not semver: %s", v) -} diff --git a/versions.yaml b/versions.yaml index c8c4ad6e20a..894593fa2d5 100644 --- a/versions.yaml +++ b/versions.yaml @@ -41,7 +41,6 @@ module-sets: - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus From d96850905fae9957d0d4750717f1eacbe787d59b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 14 Nov 2023 00:56:08 -0800 Subject: [PATCH 769/886] Update dependabot.yml (#4716) --- .github/dependabot.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f4c687ce090..58be33669a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -127,15 +127,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /example/view - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /example/zipkin labels: @@ -145,15 +136,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /exporters/otlp/otlpmetric - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /exporters/otlp/otlpmetric/otlpmetricgrpc labels: From 8ceba1368af548308ebbf61978cc8301243d43fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 16 Nov 2023 18:33:54 +0100 Subject: [PATCH 770/886] otlpmetrichttp otlptracehttp: Do not parse non-protobuf reponses (#4719) --- CHANGELOG.md | 5 +++++ .../internal/otest/collector.go | 22 ++++++++++++++++++- .../otlp/otlpmetric/otlpmetrichttp/client.go | 5 ++++- .../otlpmetric/otlpmetrichttp/client_test.go | 18 +++++++++++++++ .../internal/otest/collector.go | 22 ++++++++++++++++++- .../otlp/otlptrace/otlptracehttp/client.go | 5 ++++- .../otlptrace/otlptracehttp/client_test.go | 21 ++++++++++++++++++ .../otlp/otlpmetric/otest/collector.go.tmpl | 22 ++++++++++++++++++- 8 files changed, 115 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b11a1e30860..465dcd7a48c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) - Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) +### Fixed + +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) +- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) + ## [1.20.0/0.43.0] 2023-11-10 This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go index c96ca1fda6e..f08fbd5c5f7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/collector.go @@ -195,6 +195,8 @@ func (e *HTTPResponseError) Unwrap() error { return e.Err } // HTTPCollector is an OTLP HTTP server that collects all requests it receives. type HTTPCollector struct { + plainTextResponse bool + headersMu sync.Mutex headers http.Header storage *Storage @@ -217,7 +219,7 @@ type HTTPCollector struct { // If errCh is not nil, the collector will respond to HTTP requests with errors // sent on that channel. This means that if errCh is not nil Export calls will // block until an error is received. -func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...func(*HTTPCollector)) (*HTTPCollector, error) { u, err := url.Parse(endpoint) if err != nil { return nil, err @@ -234,6 +236,9 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle storage: NewStorage(), resultCh: resultCh, } + for _, opt := range opts { + opt(c) + } c.listener, err = net.Listen("tcp", u.Host) if err != nil { @@ -262,6 +267,14 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle return c, nil } +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. +func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { + return func(s *HTTPCollector) { + s.plainTextResponse = true + } +} + // Shutdown shuts down the HTTP server closing all open connections and // listeners. func (c *HTTPCollector) Shutdown(ctx context.Context) error { @@ -382,6 +395,13 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { return } + if c.plainTextResponse { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("OK")) + return + } + w.Header().Set("Content-Type", "application/x-protobuf") w.WriteHeader(http.StatusOK) if resp.Response == nil { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 7cc6f6ae7bb..73463c91d5f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -166,8 +166,11 @@ func (c *client) UploadMetrics(ctx context.Context, protoMetrics *metricpb.Resou if _, err := io.Copy(&respData, resp.Body); err != nil { return err } + if respData.Len() == 0 { + return nil + } - if respData.Len() != 0 { + if resp.Header.Get("Content-Type") == "application/x-protobuf" { var respProto colmetricpb.ExportMetricsServiceResponse if err := proto.Unmarshal(respData.Bytes(), &respProto); err != nil { return err diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index 2f48f472748..a4ead01c1f1 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -31,6 +31,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" + mpb "go.opentelemetry.io/proto/otlp/metrics/v1" ) type clientShim struct { @@ -65,6 +66,23 @@ func TestClient(t *testing.T) { t.Run("Integration", otest.RunClientTests(factory)) } +func TestClientWithHTTPCollectorRespondingPlainText(t *testing.T) { + ctx := context.Background() + coll, err := otest.NewHTTPCollector("", nil, otest.WithHTTPCollectorRespondingPlainText()) + require.NoError(t, err) + + addr := coll.Addr().String() + opts := []Option{WithEndpoint(addr), WithInsecure()} + cfg := oconf.NewHTTPConfig(asHTTPOptions(opts)...) + client, err := newClient(cfg) + require.NoError(t, err) + + require.NoError(t, client.UploadMetrics(ctx, &mpb.ResourceMetrics{})) + require.NoError(t, client.Shutdown(ctx)) + got := coll.Collect().Dump() + require.Len(t, got, 1, "upload of one ResourceMetrics") +} + func TestNewWithInvalidEndpoint(t *testing.T) { ctx := context.Background() exp, err := New(ctx, WithEndpoint("host:invalid-port")) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go index 503eba65bea..6398f8ba5ba 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/collector.go @@ -195,6 +195,8 @@ func (e *HTTPResponseError) Unwrap() error { return e.Err } // HTTPCollector is an OTLP HTTP server that collects all requests it receives. type HTTPCollector struct { + plainTextResponse bool + headersMu sync.Mutex headers http.Header storage *Storage @@ -217,7 +219,7 @@ type HTTPCollector struct { // If errCh is not nil, the collector will respond to HTTP requests with errors // sent on that channel. This means that if errCh is not nil Export calls will // block until an error is received. -func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...func(*HTTPCollector)) (*HTTPCollector, error) { u, err := url.Parse(endpoint) if err != nil { return nil, err @@ -234,6 +236,9 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle storage: NewStorage(), resultCh: resultCh, } + for _, opt := range opts { + opt(c) + } c.listener, err = net.Listen("tcp", u.Host) if err != nil { @@ -262,6 +267,14 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle return c, nil } +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. +func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { + return func(s *HTTPCollector) { + s.plainTextResponse = true + } +} + // Shutdown shuts down the HTTP server closing all open connections and // listeners. func (c *HTTPCollector) Shutdown(ctx context.Context) error { @@ -382,6 +395,13 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { return } + if c.plainTextResponse { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("OK")) + return + } + w.Header().Set("Content-Type", "application/x-protobuf") w.WriteHeader(http.StatusOK) if resp.Response == nil { diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 068aef300ee..3b5f3839f27 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -177,8 +177,11 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc if _, err := io.Copy(&respData, resp.Body); err != nil { return err } + if respData.Len() == 0 { + return nil + } - if respData.Len() != 0 { + if resp.Header.Get("Content-Type") == "application/x-protobuf" { var respProto coltracepb.ExportTraceServiceResponse if err := proto.Unmarshal(respData.Bytes(), &respProto); err != nil { return err diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 21838695c5e..63a4cd4f207 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -430,3 +430,24 @@ func TestOtherHTTPSuccess(t *testing.T) { }) } } + +func TestCollectorRespondingNonProtobufContent(t *testing.T) { + mcCfg := mockCollectorConfig{ + InjectContentType: "application/octet-stream", + } + mc := runMockCollector(t, mcCfg) + defer mc.MustStop(t) + driver := otlptracehttp.NewClient( + otlptracehttp.WithEndpoint(mc.Endpoint()), + otlptracehttp.WithInsecure(), + ) + ctx := context.Background() + exporter, err := otlptrace.New(ctx, driver) + require.NoError(t, err) + defer func() { + assert.NoError(t, exporter.Shutdown(context.Background())) + }() + err = exporter.ExportSpans(ctx, otlptracetest.SingleReadOnlySpan()) + assert.NoError(t, err) + assert.Len(t, mc.GetSpans(), 1) +} diff --git a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl index 1adf55807a5..fba237e68fc 100644 --- a/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/collector.go.tmpl @@ -195,6 +195,8 @@ func (e *HTTPResponseError) Unwrap() error { return e.Err } // HTTPCollector is an OTLP HTTP server that collects all requests it receives. type HTTPCollector struct { + plainTextResponse bool + headersMu sync.Mutex headers http.Header storage *Storage @@ -217,7 +219,7 @@ type HTTPCollector struct { // If errCh is not nil, the collector will respond to HTTP requests with errors // sent on that channel. This means that if errCh is not nil Export calls will // block until an error is received. -func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPCollector, error) { +func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult, opts ...func(*HTTPCollector)) (*HTTPCollector, error) { u, err := url.Parse(endpoint) if err != nil { return nil, err @@ -234,6 +236,9 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle storage: NewStorage(), resultCh: resultCh, } + for _, opt := range opts { + opt(c) + } c.listener, err = net.Listen("tcp", u.Host) if err != nil { @@ -262,6 +267,14 @@ func NewHTTPCollector(endpoint string, resultCh <-chan ExportResult) (*HTTPColle return c, nil } +// WithHTTPCollectorRespondingPlainText makes the HTTPCollector return +// a plaintext, instead of protobuf, response. +func WithHTTPCollectorRespondingPlainText() func(*HTTPCollector) { + return func(s *HTTPCollector) { + s.plainTextResponse = true + } +} + // Shutdown shuts down the HTTP server closing all open connections and // listeners. func (c *HTTPCollector) Shutdown(ctx context.Context) error { @@ -382,6 +395,13 @@ func (c *HTTPCollector) respond(w http.ResponseWriter, resp ExportResult) { return } + if c.plainTextResponse { + w.Header().Set("Content-Type", "text/plain; charset=utf-8") + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte("OK")) + return + } + w.Header().Set("Content-Type", "application/x-protobuf") w.WriteHeader(http.StatusOK) if resp.Response == nil { From a27c53b9b52ae293c76942fc0b856437298666ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 16 Nov 2023 19:51:04 +0100 Subject: [PATCH 771/886] Remove example/fib (#4723) --- .github/dependabot.yml | 9 ---- .gitignore | 4 -- CHANGELOG.md | 1 + example/fib/app.go | 104 ----------------------------------------- example/fib/doc.go | 18 ------- example/fib/fib.go | 35 -------------- example/fib/go.mod | 28 ----------- example/fib/go.sum | 12 ----- example/fib/main.go | 101 --------------------------------------- versions.yaml | 1 - 10 files changed, 1 insertion(+), 312 deletions(-) delete mode 100644 example/fib/app.go delete mode 100644 example/fib/doc.go delete mode 100644 example/fib/fib.go delete mode 100644 example/fib/go.mod delete mode 100644 example/fib/go.sum delete mode 100644 example/fib/main.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 58be33669a0..62541218442 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -73,15 +73,6 @@ updates: schedule: interval: weekly day: sunday - - package-ecosystem: gomod - directory: /example/fib - labels: - - dependencies - - go - - Skip Changelog - schedule: - interval: weekly - day: sunday - package-ecosystem: gomod directory: /example/namedtracer labels: diff --git a/.gitignore b/.gitignore index 9248055655b..895c7664beb 100644 --- a/.gitignore +++ b/.gitignore @@ -14,13 +14,9 @@ go.work.sum gen/ /example/dice/dice -/example/fib/fib -/example/fib/traces.txt -/example/jaeger/jaeger /example/namedtracer/namedtracer /example/otel-collector/otel-collector /example/opencensus/opencensus /example/passthrough/passthrough /example/prometheus/prometheus -/example/view/view /example/zipkin/zipkin diff --git a/CHANGELOG.md b/CHANGELOG.md index 465dcd7a48c..ac557daf2df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) - Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707) - Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708) +- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723) ### Fixed diff --git a/example/fib/app.go b/example/fib/app.go deleted file mode 100644 index a92074258fb..00000000000 --- a/example/fib/app.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "context" - "fmt" - "io" - "log" - "strconv" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/trace" -) - -// name is the Tracer name used to identify this instrumentation library. -const name = "fib" - -// App is an Fibonacci computation application. -type App struct { - r io.Reader - l *log.Logger -} - -// NewApp returns a new App. -func NewApp(r io.Reader, l *log.Logger) *App { - return &App{r: r, l: l} -} - -// Run starts polling users for Fibonacci number requests and writes results. -func (a *App) Run(ctx context.Context) error { - for { - // Each execution of the run loop, we should get a new "root" span and context. - newCtx, span := otel.Tracer(name).Start(ctx, "Run") - - n, err := a.Poll(newCtx) - if err != nil { - span.End() - return err - } - - a.Write(newCtx, n) - span.End() - } -} - -// Poll asks a user for input and returns the request. -func (a *App) Poll(ctx context.Context) (uint, error) { - _, span := otel.Tracer(name).Start(ctx, "Poll") - defer span.End() - - a.l.Print("What Fibonacci number would you like to know: ") - - var n uint - _, err := fmt.Fscanf(a.r, "%d\n", &n) - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - return 0, err - } - - // Store n as a string to not overflow an int64. - nStr := strconv.FormatUint(uint64(n), 10) - span.SetAttributes(attribute.String("request.n", nStr)) - - return n, nil -} - -// Write writes the n-th Fibonacci number back to the user. -func (a *App) Write(ctx context.Context, n uint) { - var span trace.Span - ctx, span = otel.Tracer(name).Start(ctx, "Write") - defer span.End() - - f, err := func(ctx context.Context) (uint64, error) { - _, span := otel.Tracer(name).Start(ctx, "Fibonacci") - defer span.End() - f, err := Fibonacci(n) - if err != nil { - span.RecordError(err) - span.SetStatus(codes.Error, err.Error()) - } - return f, err - }(ctx) - if err != nil { - a.l.Printf("Fibonacci(%d): %v\n", n, err) - } else { - a.l.Printf("Fibonacci(%d) = %d\n", n, f) - } -} diff --git a/example/fib/doc.go b/example/fib/doc.go deleted file mode 100644 index 77b63d47614..00000000000 --- a/example/fib/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Fib is the "Fibonacci" old getting started example application. -// -// Deprecated: See [go.opentelemetry.io/otel/example/dice] instead. -package main diff --git a/example/fib/fib.go b/example/fib/fib.go deleted file mode 100644 index 817cc63b104..00000000000 --- a/example/fib/fib.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import "fmt" - -// Fibonacci returns the n-th fibonacci number. -func Fibonacci(n uint) (uint64, error) { - if n <= 1 { - return uint64(n), nil - } - - if n > 93 { - return 0, fmt.Errorf("unsupported fibonacci number %d: too large", n) - } - - var n2, n1 uint64 = 0, 1 - for i := uint(2); i < n; i++ { - n2, n1 = n1, n1+n2 - } - - return n2 + n1, nil -} diff --git a/example/fib/go.mod b/example/fib/go.mod deleted file mode 100644 index 2637dc76f33..00000000000 --- a/example/fib/go.mod +++ /dev/null @@ -1,28 +0,0 @@ -// Deprecated: See go.opentelemetry.io/otel/example/dice instead. -module go.opentelemetry.io/otel/example/fib - -go 1.20 - -require ( - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 -) - -require ( - github.com/go-logr/logr v1.3.0 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - golang.org/x/sys v0.14.0 // indirect -) - -replace go.opentelemetry.io/otel => ../.. - -replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace - -replace go.opentelemetry.io/otel/sdk => ../../sdk - -replace go.opentelemetry.io/otel/trace => ../../trace - -replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/fib/go.sum b/example/fib/go.sum deleted file mode 100644 index 6133f48461b..00000000000 --- a/example/fib/go.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/fib/main.go b/example/fib/main.go deleted file mode 100644 index 7e23b8eda73..00000000000 --- a/example/fib/main.go +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "context" - "io" - "log" - "os" - "os/signal" - - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" - "go.opentelemetry.io/otel/sdk/resource" - "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" -) - -// newExporter returns a console exporter. -func newExporter(w io.Writer) (trace.SpanExporter, error) { - return stdouttrace.New( - stdouttrace.WithWriter(w), - // Use human readable output. - stdouttrace.WithPrettyPrint(), - // Do not print timestamps for the demo. - stdouttrace.WithoutTimestamps(), - ) -} - -// newResource returns a resource describing this application. -func newResource() *resource.Resource { - r, _ := resource.Merge( - resource.Default(), - resource.NewWithAttributes( - semconv.SchemaURL, - semconv.ServiceName("fib"), - semconv.ServiceVersion("v0.1.0"), - attribute.String("environment", "demo"), - ), - ) - return r -} - -func main() { - l := log.New(os.Stdout, "", 0) - - // Write telemetry data to a file. - f, err := os.Create("traces.txt") - if err != nil { - l.Fatal(err) - } - defer f.Close() - - exp, err := newExporter(f) - if err != nil { - l.Fatal(err) - } - - tp := trace.NewTracerProvider( - trace.WithBatcher(exp), - trace.WithResource(newResource()), - ) - defer func() { - if err := tp.Shutdown(context.Background()); err != nil { - l.Fatal(err) - } - }() - otel.SetTracerProvider(tp) - - sigCh := make(chan os.Signal, 1) - signal.Notify(sigCh, os.Interrupt) - - errCh := make(chan error) - app := NewApp(os.Stdin, l) - go func() { - errCh <- app.Run(context.Background()) - }() - - select { - case <-sigCh: - l.Println("\ngoodbye") - return - case err := <-errCh: - if err != nil { - l.Fatal(err) - } - } -} diff --git a/versions.yaml b/versions.yaml index 894593fa2d5..a027f861c42 100644 --- a/versions.yaml +++ b/versions.yaml @@ -20,7 +20,6 @@ module-sets: - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/dice - - go.opentelemetry.io/otel/example/fib - go.opentelemetry.io/otel/example/namedtracer - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough From 98b32a6c3a87fbee5d34c063b9096f416b250897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 16 Nov 2023 21:11:06 +0100 Subject: [PATCH 772/886] Release 1.21.0/0.44.0 (#4724) --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 34 files changed, 127 insertions(+), 124 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac557daf2df..24874f856e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.21.0/0.44.0] 2023-11-16 + ### Removed - Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706) @@ -2733,7 +2735,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.20.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.21.0...HEAD +[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 [1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 [1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 [1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 374822ba851..dff07b9eedc 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 7fb92727b7c..5caaf20e0bc 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/bridge/opencensus v0.43.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/bridge/opencensus v0.44.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 6a7931d79f6..8fb56844e65 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "0.43.0" + return "0.44.0" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 29c3904262b..c24a004e31e 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 07572924dcf..f9102ff99af 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/bridge/opentracing v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/bridge/opentracing v1.21.0 google.golang.org/grpc v1.59.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index a6b78266570..f2b27857459 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.43.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 + go.opentelemetry.io/otel/metric v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 28d7d5d519f..80f4e3e486b 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 1413220197d..f26d1bc4b5f 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/bridge/opencensus v0.43.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.43.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/bridge/opencensus v0.44.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 470f06e9775..82b1a731428 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 google.golang.org/grpc v1.59.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index ca66eeca256..200df00c9b3 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index af2614c5e4e..63c35c721d9 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.17.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/prometheus v0.43.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/prometheus v0.44.0 + go.opentelemetry.io/otel/metric v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 ) require ( @@ -20,8 +20,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 038aeb15614..2bc95e9cc90 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/zipkin v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/zipkin v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index a6b4b53bfb6..e2ac65cbea3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d google.golang.org/grpc v1.59.0 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index 5559d07f166..983968c6a3b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "0.43.0" + return "0.44.0" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 6e0bfbefac9..ee467b8831a 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index fddac629584..59d7c1c2cb9 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "0.43.0" + return "0.44.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 05be37c0d30..cabf87efe00 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.31.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 2aa516a9da0..8aa8e0ad46e 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index d036e834e1e..782fcfb4437 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.14.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 620ea88bf14..8ee285b8d52 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.20.0" + return "1.21.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 8171dd61e91..fb72cc7732a 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/metric v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 google.golang.org/protobuf v1.31.0 ) @@ -25,7 +25,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 24745cf95c5..9b679f995f3 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/sdk/metric v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/sdk/metric v1.21.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index ed01ce0a33e..342d62af111 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 61e1d88cb31..e475587a71d 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index f21dd71302d..e8b192b3f78 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel/metric v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 4d3aa33b98f..d0596d4bea6 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel v1.21.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 995cd01ed41..a9ee37410ee 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.3.0 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/trace v1.21.0 golang.org/x/sys v0.14.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 92ed848e9e6..8a22ee89cc7 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.3.0 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/metric v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel/metric v1.21.0 + go.opentelemetry.io/otel/sdk v1.21.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 4437747f208..edcf7cfc862 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.20.0" + return "1.21.0" } diff --git a/sdk/version.go b/sdk/version.go index 7048c788e93..422d4c964b3 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.20.0" + return "1.21.0" } diff --git a/trace/go.mod b/trace/go.mod index ddec57195ee..4dda77a8cb4 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel v1.21.0 ) require ( diff --git a/version.go b/version.go index 5a92f1d4b6c..e2f743585d1 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.20.0" + return "1.21.0" } diff --git a/versions.yaml b/versions.yaml index a027f861c42..3c153c9d6fc 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.20.0 + version: v1.21.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.43.0 + version: v0.44.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From 47ba653e6962948dab3a481231c469387f11f184 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 19 Nov 2023 07:50:13 -0800 Subject: [PATCH 773/886] Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#4726) Bumps [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.46.0 to 0.46.1. - [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.46.0...zpages/v0.46.1) --- updated-dependencies: - dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/dice/go.mod b/example/dice/go.mod index f2b27857459..0232f4cb593 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/dice go 1.20 require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 diff --git a/example/dice/go.sum b/example/dice/go.sum index c3b05cb1e89..cdb22d24e23 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -9,8 +9,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 204be6157f13594eb92a91914aaa7a7561bfd08a Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Tue, 28 Nov 2023 05:12:11 -0500 Subject: [PATCH 774/886] Fix data race in periodic reader tests (#4731) --- sdk/metric/periodic_reader_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sdk/metric/periodic_reader_test.go b/sdk/metric/periodic_reader_test.go index 81cbd11493e..a5ac94fe367 100644 --- a/sdk/metric/periodic_reader_test.go +++ b/sdk/metric/periodic_reader_test.go @@ -202,8 +202,6 @@ type periodicReaderTestSuite struct { } func (ts *periodicReaderTestSuite) SetupTest() { - ts.Reader = ts.Factory() - e := &fnExporter{ exportFunc: func(context.Context, *metricdata.ResourceMetrics) error { return assert.AnError }, flushFunc: func(context.Context) error { return assert.AnError }, @@ -429,12 +427,13 @@ func TestPeriodicReaderMultipleForceFlush(t *testing.T) { r.register(testSDKProducer{}) require.NoError(t, r.ForceFlush(ctx)) require.NoError(t, r.ForceFlush(ctx)) + require.NoError(t, r.Shutdown(ctx)) } func BenchmarkPeriodicReader(b *testing.B) { - b.Run("Collect", benchReaderCollectFunc( - NewPeriodicReader(new(fnExporter)), - )) + r := NewPeriodicReader(new(fnExporter)) + b.Run("Collect", benchReaderCollectFunc(r)) + require.NoError(b, r.Shutdown(context.Background())) } func TestPeriodiclReaderTemporality(t *testing.T) { From 04054929f165e43124c9311bf7c4b1194214c668 Mon Sep 17 00:00:00 2001 From: xiehuc Date: Thu, 30 Nov 2023 01:32:27 +0800 Subject: [PATCH 775/886] improve trace_context performance (#4721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * improve trace_context performance * using strings.Builder instead of fmt.Sprint * using strings.Cut instead of strings.Split * using hex.Decode instead of hex.DecodeString * avoid use regexp * fix code style * fix build * update changelog * refine code * update comment --------- Co-authored-by: Chester Cheung Co-authored-by: Robert Pająk --- CHANGELOG.md | 4 ++ propagation/trace_context.go | 94 +++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24874f856e3..9b62be0c145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) + ## [1.21.0/0.44.0] 2023-11-16 ### Removed diff --git a/propagation/trace_context.go b/propagation/trace_context.go index 75a8f3435a5..63e5d62221f 100644 --- a/propagation/trace_context.go +++ b/propagation/trace_context.go @@ -18,7 +18,7 @@ import ( "context" "encoding/hex" "fmt" - "regexp" + "strings" "go.opentelemetry.io/otel/trace" ) @@ -28,6 +28,7 @@ const ( maxVersion = 254 traceparentHeader = "traceparent" tracestateHeader = "tracestate" + delimiter = "-" ) // TraceContext is a propagator that supports the W3C Trace Context format @@ -41,8 +42,8 @@ const ( type TraceContext struct{} var ( - _ TextMapPropagator = TraceContext{} - traceCtxRegExp = regexp.MustCompile("^(?P[0-9a-f]{2})-(?P[a-f0-9]{32})-(?P[a-f0-9]{16})-(?P[a-f0-9]{2})(?:-.*)?$") + _ TextMapPropagator = TraceContext{} + versionPart = fmt.Sprintf("%.2X", supportedVersion) ) // Inject set tracecontext from the Context into the carrier. @@ -59,12 +60,19 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) { // Clear all flags other than the trace-context supported sampling bit. flags := sc.TraceFlags() & trace.FlagsSampled - h := fmt.Sprintf("%.2x-%s-%s-%s", - supportedVersion, - sc.TraceID(), - sc.SpanID(), - flags) - carrier.Set(traceparentHeader, h) + var sb strings.Builder + sb.Grow(2 + 32 + 16 + 2 + 3) + _, _ = sb.WriteString(versionPart) + traceID := sc.TraceID() + spanID := sc.SpanID() + flagByte := [1]byte{byte(flags)} + var buf [32]byte + for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} { + _ = sb.WriteByte(delimiter[0]) + n := hex.Encode(buf[:], src) + _, _ = sb.Write(buf[:n]) + } + carrier.Set(traceparentHeader, sb.String()) } // Extract reads tracecontext from the carrier into a returned Context. @@ -86,21 +94,8 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return trace.SpanContext{} } - matches := traceCtxRegExp.FindStringSubmatch(h) - - if len(matches) == 0 { - return trace.SpanContext{} - } - - if len(matches) < 5 { // four subgroups plus the overall match - return trace.SpanContext{} - } - - if len(matches[1]) != 2 { - return trace.SpanContext{} - } - ver, err := hex.DecodeString(matches[1]) - if err != nil { + var ver [1]byte + if !extractPart(ver[:], &h, 2) { return trace.SpanContext{} } version := int(ver[0]) @@ -108,36 +103,24 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return trace.SpanContext{} } - if version == 0 && len(matches) != 5 { // four subgroups plus the overall match - return trace.SpanContext{} - } - - if len(matches[2]) != 32 { - return trace.SpanContext{} - } - var scc trace.SpanContextConfig - - scc.TraceID, err = trace.TraceIDFromHex(matches[2][:32]) - if err != nil { + if !extractPart(scc.TraceID[:], &h, 32) { return trace.SpanContext{} } - - if len(matches[3]) != 16 { - return trace.SpanContext{} - } - scc.SpanID, err = trace.SpanIDFromHex(matches[3]) - if err != nil { + if !extractPart(scc.SpanID[:], &h, 16) { return trace.SpanContext{} } - if len(matches[4]) != 2 { + var opts [1]byte + if !extractPart(opts[:], &h, 2) { return trace.SpanContext{} } - opts, err := hex.DecodeString(matches[4]) - if err != nil || len(opts) < 1 || (version == 0 && opts[0] > 2) { + if version == 0 && (h != "" || opts[0] > 2) { + // version 0 not allow extra + // version 0 not allow other flag return trace.SpanContext{} } + // Clear all flags other than the trace-context supported sampling bit. scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled @@ -155,6 +138,29 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext { return sc } +// upperHex detect hex is upper case Unicode characters. +func upperHex(v string) bool { + for _, c := range v { + if c >= 'A' && c <= 'F' { + return true + } + } + return false +} + +func extractPart(dst []byte, h *string, n int) bool { + part, left, _ := strings.Cut(*h, delimiter) + *h = left + // hex.Decode decodes unsupported upper-case characters, so exclude explicitly. + if len(part) != n || upperHex(part) { + return false + } + if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 { + return false + } + return true +} + // Fields returns the keys who's values are set with Inject. func (tc TraceContext) Fields() []string { return []string{traceparentHeader, tracestateHeader} From 6027c1ae76f2969ee41dcd894011eea3832391fe Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Fri, 1 Dec 2023 07:34:05 -0800 Subject: [PATCH 776/886] add option for resource attributes in metrics for prometheus exporter (#4733) * add option for resource attributes in metrics for prometheus exporter This PR adds the `WithResourceAsConstantLabels` option to the Prometheus exporter to allow users to configure resource attributes to be applied on every metric. Fixes #4732 Signed-off-by: Alex Boten * add test, changelog Signed-off-by: Alex Boten * add test for including only a subset of tags, dont use a ptr Signed-off-by: Alex Boten * Update exporters/prometheus/config.go Co-authored-by: David Ashpole * include feedback from review Signed-off-by: Alex Boten * cache results Signed-off-by: Alex Boten * removed map in favour of single keyVals Signed-off-by: Alex Boten * Update exporters/prometheus/config.go Co-authored-by: Tyler Yahn * move check outside the createResourceAttributes and rename func Signed-off-by: Alex Boten --------- Signed-off-by: Alex Boten Co-authored-by: David Ashpole Co-authored-by: Tyler Yahn --- CHANGELOG.md | 4 + exporters/prometheus/config.go | 27 ++++-- exporters/prometheus/exporter.go | 82 +++++++++++++------ exporters/prometheus/exporter_test.go | 40 +++++++++ .../with_allow_resource_attributes_filter.txt | 9 ++ .../with_resource_attributes_filter.txt | 9 ++ 6 files changed, 137 insertions(+), 34 deletions(-) create mode 100755 exporters/prometheus/testdata/with_allow_resource_attributes_filter.txt create mode 100755 exporters/prometheus/testdata/with_resource_attributes_filter.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b62be0c145..f6a05cca4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) +### Added + +- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) + ## [1.21.0/0.44.0] 2023-11-16 ### Removed diff --git a/exporters/prometheus/config.go b/exporters/prometheus/config.go index fe14212784d..03ce27b131e 100644 --- a/exporters/prometheus/config.go +++ b/exporters/prometheus/config.go @@ -19,18 +19,20 @@ import ( "github.com/prometheus/client_golang/prometheus" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/metric" ) // config contains options for the exporter. type config struct { - registerer prometheus.Registerer - disableTargetInfo bool - withoutUnits bool - withoutCounterSuffixes bool - readerOpts []metric.ManualReaderOption - disableScopeInfo bool - namespace string + registerer prometheus.Registerer + disableTargetInfo bool + withoutUnits bool + withoutCounterSuffixes bool + readerOpts []metric.ManualReaderOption + disableScopeInfo bool + namespace string + resourceAttributesFilter attribute.Filter } // newConfig creates a validated config configured with options. @@ -151,3 +153,14 @@ func WithNamespace(ns string) Option { return cfg }) } + +// WithResourceAsConstantLabels configures the Exporter to add the resource attributes the +// resourceFilter returns true for as attributes on all exported metrics. +// +// The does not affect the target info generated from resource attributes. +func WithResourceAsConstantLabels(resourceFilter attribute.Filter) Option { + return optionFunc(func(cfg config) config { + cfg.resourceAttributesFilter = resourceFilter + return cfg + }) +} diff --git a/exporters/prometheus/exporter.go b/exporters/prometheus/exporter.go index 92651c38cec..16df309be44 100644 --- a/exporters/prometheus/exporter.go +++ b/exporters/prometheus/exporter.go @@ -78,14 +78,21 @@ func (e *Exporter) MarshalLog() interface{} { var _ metric.Reader = &Exporter{} +// keyVals is used to store resource attribute key value pairs. +type keyVals struct { + keys []string + vals []string +} + // collector is used to implement prometheus.Collector. type collector struct { reader metric.Reader - withoutUnits bool - withoutCounterSuffixes bool - disableScopeInfo bool - namespace string + withoutUnits bool + withoutCounterSuffixes bool + disableScopeInfo bool + namespace string + resourceAttributesFilter attribute.Filter mu sync.Mutex // mu protects all members below from the concurrent access. disableTargetInfo bool @@ -93,6 +100,7 @@ type collector struct { scopeInfos map[instrumentation.Scope]prometheus.Metric scopeInfosInvalid map[instrumentation.Scope]struct{} metricFamilies map[string]*dto.MetricFamily + resourceKeyVals keyVals } // prometheus counters MUST have a _total suffix by default: @@ -109,15 +117,16 @@ func New(opts ...Option) (*Exporter, error) { reader := metric.NewManualReader(cfg.readerOpts...) collector := &collector{ - reader: reader, - disableTargetInfo: cfg.disableTargetInfo, - withoutUnits: cfg.withoutUnits, - withoutCounterSuffixes: cfg.withoutCounterSuffixes, - disableScopeInfo: cfg.disableScopeInfo, - scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), - scopeInfosInvalid: make(map[instrumentation.Scope]struct{}), - metricFamilies: make(map[string]*dto.MetricFamily), - namespace: cfg.namespace, + reader: reader, + disableTargetInfo: cfg.disableTargetInfo, + withoutUnits: cfg.withoutUnits, + withoutCounterSuffixes: cfg.withoutCounterSuffixes, + disableScopeInfo: cfg.disableScopeInfo, + scopeInfos: make(map[instrumentation.Scope]prometheus.Metric), + scopeInfosInvalid: make(map[instrumentation.Scope]struct{}), + metricFamilies: make(map[string]*dto.MetricFamily), + namespace: cfg.namespace, + resourceAttributesFilter: cfg.resourceAttributesFilter, } if err := cfg.registerer.Register(collector); err != nil { @@ -181,6 +190,10 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { ch <- c.targetInfo } + if c.resourceAttributesFilter != nil && len(c.resourceKeyVals.keys) == 0 { + c.createResourceAttributes(metrics.Resource) + } + for _, scopeMetrics := range metrics.ScopeMetrics { var keys, values [2]string @@ -219,26 +232,26 @@ func (c *collector) Collect(ch chan<- prometheus.Metric) { switch v := m.Data.(type) { case metricdata.Histogram[int64]: - addHistogramMetric(ch, v, m, keys, values, name) + addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) case metricdata.Histogram[float64]: - addHistogramMetric(ch, v, m, keys, values, name) + addHistogramMetric(ch, v, m, keys, values, name, c.resourceKeyVals) case metricdata.Sum[int64]: - addSumMetric(ch, v, m, keys, values, name) + addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) case metricdata.Sum[float64]: - addSumMetric(ch, v, m, keys, values, name) + addSumMetric(ch, v, m, keys, values, name, c.resourceKeyVals) case metricdata.Gauge[int64]: - addGaugeMetric(ch, v, m, keys, values, name) + addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) case metricdata.Gauge[float64]: - addGaugeMetric(ch, v, m, keys, values, name) + addGaugeMetric(ch, v, m, keys, values, name, c.resourceKeyVals) } } } } -func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string) { +func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogram metricdata.Histogram[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { // TODO(https://github.com/open-telemetry/opentelemetry-go/issues/3163): support exemplars for _, dp := range histogram.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs) + keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) desc := prometheus.NewDesc(name, m.Description, keys, nil) buckets := make(map[float64]uint64, len(dp.Bounds)) @@ -257,14 +270,14 @@ func addHistogramMetric[N int64 | float64](ch chan<- prometheus.Metric, histogra } } -func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string) { +func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata.Sum[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { valueType := prometheus.CounterValue if !sum.IsMonotonic { valueType = prometheus.GaugeValue } for _, dp := range sum.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs) + keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, valueType, float64(dp.Value), values...) @@ -276,9 +289,9 @@ func addSumMetric[N int64 | float64](ch chan<- prometheus.Metric, sum metricdata } } -func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string) { +func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metricdata.Gauge[N], m metricdata.Metrics, ks, vs [2]string, name string, resourceKV keyVals) { for _, dp := range gauge.DataPoints { - keys, values := getAttrs(dp.Attributes, ks, vs) + keys, values := getAttrs(dp.Attributes, ks, vs, resourceKV) desc := prometheus.NewDesc(name, m.Description, keys, nil) m, err := prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(dp.Value), values...) @@ -293,7 +306,7 @@ func addGaugeMetric[N int64 | float64](ch chan<- prometheus.Metric, gauge metric // getAttrs parses the attribute.Set to two lists of matching Prometheus-style // keys and values. It sanitizes invalid characters and handles duplicate keys // (due to sanitization) by sorting and concatenating the values following the spec. -func getAttrs(attrs attribute.Set, ks, vs [2]string) ([]string, []string) { +func getAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]string, []string) { keysMap := make(map[string][]string) itr := attrs.Iter() for itr.Next() { @@ -321,11 +334,17 @@ func getAttrs(attrs attribute.Set, ks, vs [2]string) ([]string, []string) { keys = append(keys, ks[:]...) values = append(values, vs[:]...) } + + for idx := range resourceKV.keys { + keys = append(keys, resourceKV.keys[idx]) + values = append(values, resourceKV.vals[idx]) + } + return keys, values } func createInfoMetric(name, description string, res *resource.Resource) (prometheus.Metric, error) { - keys, values := getAttrs(*res.Set(), [2]string{}, [2]string{}) + keys, values := getAttrs(*res.Set(), [2]string{}, [2]string{}, keyVals{}) desc := prometheus.NewDesc(name, description, keys, nil) return prometheus.NewConstMetric(desc, prometheus.GaugeValue, float64(1), values...) } @@ -473,6 +492,15 @@ func (c *collector) metricType(m metricdata.Metrics) *dto.MetricType { return nil } +func (c *collector) createResourceAttributes(res *resource.Resource) { + c.mu.Lock() + defer c.mu.Unlock() + + resourceAttrs, _ := res.Set().Filter(c.resourceAttributesFilter) + resourceKeys, resourceValues := getAttrs(resourceAttrs, [2]string{}, [2]string{}, keyVals{}) + c.resourceKeyVals = keyVals{keys: resourceKeys, vals: resourceValues} +} + func (c *collector) scopeInfo(scope instrumentation.Scope) (prometheus.Metric, error) { c.mu.Lock() defer c.mu.Unlock() diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index bd31657825e..cb402e10ced 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -368,6 +368,46 @@ func TestPrometheusExporter(t *testing.T) { counter.Add(ctx, 9, opt) }, }, + { + name: "with resource attributes filter", + expectedFile: "testdata/with_resource_attributes_filter.txt", + options: []Option{ + WithResourceAsConstantLabels(attribute.NewDenyKeysFilter()), + }, + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 10.1, opt) + counter.Add(ctx, 9.8, opt) + }, + }, + { + name: "with some resource attributes filter", + expectedFile: "testdata/with_allow_resource_attributes_filter.txt", + options: []Option{ + WithResourceAsConstantLabels(attribute.NewAllowKeysFilter("service.name")), + }, + recordMetrics: func(ctx context.Context, meter otelmetric.Meter) { + opt := otelmetric.WithAttributes( + attribute.Key("A").String("B"), + attribute.Key("C").String("D"), + attribute.Key("E").Bool(true), + attribute.Key("F").Int(42), + ) + counter, err := meter.Float64Counter("foo", otelmetric.WithDescription("a simple counter")) + require.NoError(t, err) + counter.Add(ctx, 5, opt) + counter.Add(ctx, 5.9, opt) + counter.Add(ctx, 5.3, opt) + }, + }, } for _, tc := range testCases { diff --git a/exporters/prometheus/testdata/with_allow_resource_attributes_filter.txt b/exporters/prometheus/testdata/with_allow_resource_attributes_filter.txt new file mode 100755 index 00000000000..9a4ca7793ea --- /dev/null +++ b/exporters/prometheus/testdata/with_allow_resource_attributes_filter.txt @@ -0,0 +1,9 @@ +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",service_name="prometheus_test"} 16.2 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 diff --git a/exporters/prometheus/testdata/with_resource_attributes_filter.txt b/exporters/prometheus/testdata/with_resource_attributes_filter.txt new file mode 100755 index 00000000000..b3ab4f80fab --- /dev/null +++ b/exporters/prometheus/testdata/with_resource_attributes_filter.txt @@ -0,0 +1,9 @@ +# HELP foo_total a simple counter +# TYPE foo_total counter +foo_total{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0",service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 24.9 +# HELP otel_scope_info Instrumentation Scope metadata +# TYPE otel_scope_info gauge +otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 +# HELP target_info Target metadata +# TYPE target_info gauge +target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 From 88da778ba284dd5901d091e861681da03aa44d64 Mon Sep 17 00:00:00 2001 From: xiehuc Date: Sun, 3 Dec 2023 00:58:20 +0800 Subject: [PATCH 777/886] improve tracestate performance (#4722) * improve tracestate performance * use string.Builder to directly construct the result * reduce the redundant copying during Insert * avoid using regex * fix lint * revert changelog * update comment * refine code * fix lint * fix unittest * Update trace/tracestate.go Co-authored-by: Tyler Yahn --------- Co-authored-by: Chester Cheung Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + trace/tracestate.go | 197 +++++++++++++++++++++------- trace/tracestate_benchkmark_test.go | 58 ++++++++ trace/tracestate_test.go | 154 +++++++++++----------- 4 files changed, 289 insertions(+), 121 deletions(-) create mode 100644 trace/tracestate_benchkmark_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f6a05cca4a0..32b9d6b9636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) ### Added diff --git a/trace/tracestate.go b/trace/tracestate.go index d1e47ca2faa..db936ba5b73 100644 --- a/trace/tracestate.go +++ b/trace/tracestate.go @@ -17,20 +17,14 @@ package trace // import "go.opentelemetry.io/otel/trace" import ( "encoding/json" "fmt" - "regexp" "strings" ) const ( maxListMembers = 32 - listDelimiter = "," - - // based on the W3C Trace Context specification, see - // https://www.w3.org/TR/trace-context-1/#tracestate-header - noTenantKeyFormat = `[a-z][_0-9a-z\-\*\/]*` - withTenantKeyFormat = `[a-z0-9][_0-9a-z\-\*\/]*@[a-z][_0-9a-z\-\*\/]*` - valueFormat = `[\x20-\x2b\x2d-\x3c\x3e-\x7e]*[\x21-\x2b\x2d-\x3c\x3e-\x7e]` + listDelimiters = "," + memberDelimiter = "=" errInvalidKey errorConst = "invalid tracestate key" errInvalidValue errorConst = "invalid tracestate value" @@ -39,43 +33,128 @@ const ( errDuplicate errorConst = "duplicate list-member in tracestate" ) -var ( - noTenantKeyRe = regexp.MustCompile(`^` + noTenantKeyFormat + `$`) - withTenantKeyRe = regexp.MustCompile(`^` + withTenantKeyFormat + `$`) - valueRe = regexp.MustCompile(`^` + valueFormat + `$`) - memberRe = regexp.MustCompile(`^\s*((?:` + noTenantKeyFormat + `)|(?:` + withTenantKeyFormat + `))=(` + valueFormat + `)\s*$`) -) - type member struct { Key string Value string } -func newMember(key, value string) (member, error) { - if len(key) > 256 { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) +// according to (chr = %x20 / (nblk-char = %x21-2B / %x2D-3C / %x3E-7E) ) +// means (chr = %x20-2B / %x2D-3C / %x3E-7E) . +func checkValueChar(v byte) bool { + return v >= '\x20' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// according to (nblk-chr = %x21-2B / %x2D-3C / %x3E-7E) . +func checkValueLast(v byte) bool { + return v >= '\x21' && v <= '\x7e' && v != '\x2c' && v != '\x3d' +} + +// based on the W3C Trace Context specification +// +// value = (0*255(chr)) nblk-chr +// nblk-chr = %x21-2B / %x2D-3C / %x3E-7E +// chr = %x20 / nblk-chr +// +// see https://www.w3.org/TR/trace-context-1/#value +func checkValue(val string) bool { + n := len(val) + if n == 0 || n > 256 { + return false + } + for i := 0; i < n-1; i++ { + if !checkValueChar(val[i]) { + return false + } } - if !noTenantKeyRe.MatchString(key) { - if !withTenantKeyRe.MatchString(key) { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + return checkValueLast(val[n-1]) +} + +func checkKeyRemain(key string) bool { + // ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) + for _, v := range key { + if isAlphaNum(byte(v)) { + continue } - atIndex := strings.LastIndex(key, "@") - if atIndex > 241 || len(key)-1-atIndex > 14 { - return member{}, fmt.Errorf("%w: %s", errInvalidKey, key) + switch v { + case '_', '-', '*', '/': + continue } + return false + } + return true +} + +// according to +// +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// +// param n is remain part length, should be 255 in simple-key or 13 in system-id. +func checkKeyPart(key string, n int) bool { + if len(key) == 0 { + return false + } + first := key[0] // key's first char + ret := len(key[1:]) <= n + ret = ret && first >= 'a' && first <= 'z' + return ret && checkKeyRemain(key[1:]) +} + +func isAlphaNum(c byte) bool { + if c >= 'a' && c <= 'z' { + return true } - if len(value) > 256 || !valueRe.MatchString(value) { - return member{}, fmt.Errorf("%w: %s", errInvalidValue, value) + return c >= '0' && c <= '9' +} + +// according to +// +// tenant-id = ( lcalpha / DIGIT ) 0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" ) +// +// param n is remain part length, should be 240 exactly. +func checkKeyTenant(key string, n int) bool { + if len(key) == 0 { + return false + } + return isAlphaNum(key[0]) && len(key[1:]) <= n && checkKeyRemain(key[1:]) +} + +// based on the W3C Trace Context specification +// +// key = simple-key / multi-tenant-key +// simple-key = lcalpha (0*255( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// multi-tenant-key = tenant-id "@" system-id +// tenant-id = ( lcalpha / DIGIT ) (0*240( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// system-id = lcalpha (0*13( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )) +// lcalpha = %x61-7A ; a-z +// +// see https://www.w3.org/TR/trace-context-1/#tracestate-header. +func checkKey(key string) bool { + tenant, system, ok := strings.Cut(key, "@") + if !ok { + return checkKeyPart(key, 255) + } + return checkKeyTenant(tenant, 240) && checkKeyPart(system, 13) +} + +func newMember(key, value string) (member, error) { + if !checkKey(key) { + return member{}, errInvalidKey + } + if !checkValue(value) { + return member{}, errInvalidValue } return member{Key: key, Value: value}, nil } func parseMember(m string) (member, error) { - matches := memberRe.FindStringSubmatch(m) - if len(matches) != 3 { + key, val, ok := strings.Cut(m, memberDelimiter) + if !ok { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } - result, e := newMember(matches[1], matches[2]) + key = strings.TrimLeft(key, " \t") + val = strings.TrimRight(val, " \t") + result, e := newMember(key, val) if e != nil { return member{}, fmt.Errorf("%w: %s", errInvalidMember, m) } @@ -85,7 +164,7 @@ func parseMember(m string) (member, error) { // String encodes member into a string compliant with the W3C Trace Context // specification. func (m member) String() string { - return fmt.Sprintf("%s=%s", m.Key, m.Value) + return m.Key + "=" + m.Value } // TraceState provides additional vendor-specific trace identification @@ -109,8 +188,8 @@ var _ json.Marshaler = TraceState{} // ParseTraceState attempts to decode a TraceState from the passed // string. It returns an error if the input is invalid according to the W3C // Trace Context specification. -func ParseTraceState(tracestate string) (TraceState, error) { - if tracestate == "" { +func ParseTraceState(ts string) (TraceState, error) { + if ts == "" { return TraceState{}, nil } @@ -120,7 +199,9 @@ func ParseTraceState(tracestate string) (TraceState, error) { var members []member found := make(map[string]struct{}) - for _, memberStr := range strings.Split(tracestate, listDelimiter) { + for ts != "" { + var memberStr string + memberStr, ts, _ = strings.Cut(ts, listDelimiters) if len(memberStr) == 0 { continue } @@ -153,11 +234,29 @@ func (ts TraceState) MarshalJSON() ([]byte, error) { // Trace Context specification. The returned string will be invalid if the // TraceState contains any invalid members. func (ts TraceState) String() string { - members := make([]string, len(ts.list)) - for i, m := range ts.list { - members[i] = m.String() + if len(ts.list) == 0 { + return "" + } + var n int + n += len(ts.list) // member delimiters: '=' + n += len(ts.list) - 1 // list delimiters: ',' + for _, mem := range ts.list { + n += len(mem.Key) + n += len(mem.Value) } - return strings.Join(members, listDelimiter) + + var sb strings.Builder + sb.Grow(n) + _, _ = sb.WriteString(ts.list[0].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[0].Value) + for i := 1; i < len(ts.list); i++ { + _ = sb.WriteByte(listDelimiters[0]) + _, _ = sb.WriteString(ts.list[i].Key) + _ = sb.WriteByte('=') + _, _ = sb.WriteString(ts.list[i].Value) + } + return sb.String() } // Get returns the value paired with key from the corresponding TraceState @@ -189,15 +288,25 @@ func (ts TraceState) Insert(key, value string) (TraceState, error) { if err != nil { return ts, err } - - cTS := ts.Delete(key) - if cTS.Len()+1 <= maxListMembers { - cTS.list = append(cTS.list, member{}) + n := len(ts.list) + found := n + for i := range ts.list { + if ts.list[i].Key == key { + found = i + } + } + cTS := TraceState{} + if found == n && n < maxListMembers { + cTS.list = make([]member, n+1) + } else { + cTS.list = make([]member, n) } - // When the number of members exceeds capacity, drop the "right-most". - copy(cTS.list[1:], cTS.list) cTS.list[0] = m - + // When the number of members exceeds capacity, drop the "right-most". + copy(cTS.list[1:], ts.list[0:found]) + if found < n { + copy(cTS.list[1+found:], ts.list[found+1:]) + } return cTS, nil } diff --git a/trace/tracestate_benchkmark_test.go b/trace/tracestate_benchkmark_test.go new file mode 100644 index 00000000000..171e09f00f8 --- /dev/null +++ b/trace/tracestate_benchkmark_test.go @@ -0,0 +1,58 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package trace + +import ( + "testing" +) + +func BenchmarkTraceStateParse(b *testing.B) { + for _, test := range testcases { + b.Run(test.name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + _, _ = ParseTraceState(test.in) + } + }) + } +} + +func BenchmarkTraceStateString(b *testing.B) { + for _, test := range testcases { + if len(test.tracestate.list) == 0 { + continue + } + b.Run(test.name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + _ = test.tracestate.String() + } + }) + } +} + +func BenchmarkTraceStateInsert(b *testing.B) { + for _, test := range insertTestcase { + b.Run(test.name, func(b *testing.B) { + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + _, _ = test.tracestate.Insert(test.key, test.value) + } + }) + } +} diff --git a/trace/tracestate_test.go b/trace/tracestate_test.go index c2bccd3b7c6..4cd0fbc45f3 100644 --- a/trace/tracestate_test.go +++ b/trace/tracestate_test.go @@ -420,85 +420,85 @@ func TestTraceStateDelete(t *testing.T) { } } -func TestTraceStateInsert(t *testing.T) { - ts := TraceState{list: []member{ - {Key: "key1", Value: "val1"}, - {Key: "key2", Value: "val2"}, - {Key: "key3", Value: "val3"}, - }} +var insertTS = TraceState{list: []member{ + {Key: "key1", Value: "val1"}, + {Key: "key2", Value: "val2"}, + {Key: "key3", Value: "val3"}, +}} - testCases := []struct { - name string - tracestate TraceState - key, value string - expected TraceState - err error - }{ - { - name: "add new", - tracestate: ts, - key: "key4@vendor", - value: "val4", - expected: TraceState{list: []member{ - {Key: "key4@vendor", Value: "val4"}, - {Key: "key1", Value: "val1"}, - {Key: "key2", Value: "val2"}, - {Key: "key3", Value: "val3"}, - }}, - }, - { - name: "replace", - tracestate: ts, - key: "key2", - value: "valX", - expected: TraceState{list: []member{ - {Key: "key2", Value: "valX"}, - {Key: "key1", Value: "val1"}, - {Key: "key3", Value: "val3"}, - }}, - }, - { - name: "invalid key", - tracestate: ts, - key: "key!", - value: "val", - expected: ts, - err: errInvalidKey, - }, - { - name: "invalid value", - tracestate: ts, - key: "key", - value: "v=l", - expected: ts, - err: errInvalidValue, - }, - { - name: "invalid key/value", - tracestate: ts, - key: "key!", - value: "v=l", - expected: ts, - err: errInvalidKey, - }, - { - name: "drop the right-most member(oldest) in queue", - tracestate: maxMembers, - key: "keyx", - value: "valx", - expected: func() TraceState { - // Prepend the new element and remove the oldest one, which is over capacity. - return TraceState{ - list: append( - []member{{Key: "keyx", Value: "valx"}}, - maxMembers.list[:len(maxMembers.list)-1]..., - ), - } - }(), - }, - } +var insertTestcase = []struct { + name string + tracestate TraceState + key, value string + expected TraceState + err error +}{ + { + name: "add new", + tracestate: insertTS, + key: "key4@vendor", + value: "val4", + expected: TraceState{list: []member{ + {Key: "key4@vendor", Value: "val4"}, + {Key: "key1", Value: "val1"}, + {Key: "key2", Value: "val2"}, + {Key: "key3", Value: "val3"}, + }}, + }, + { + name: "replace", + tracestate: insertTS, + key: "key2", + value: "valX", + expected: TraceState{list: []member{ + {Key: "key2", Value: "valX"}, + {Key: "key1", Value: "val1"}, + {Key: "key3", Value: "val3"}, + }}, + }, + { + name: "invalid key", + tracestate: insertTS, + key: "key!", + value: "val", + expected: insertTS, + err: errInvalidKey, + }, + { + name: "invalid value", + tracestate: insertTS, + key: "key", + value: "v=l", + expected: insertTS, + err: errInvalidValue, + }, + { + name: "invalid key/value", + tracestate: insertTS, + key: "key!", + value: "v=l", + expected: insertTS, + err: errInvalidKey, + }, + { + name: "drop the right-most member(oldest) in queue", + tracestate: maxMembers, + key: "keyx", + value: "valx", + expected: func() TraceState { + // Prepend the new element and remove the oldest one, which is over capacity. + return TraceState{ + list: append( + []member{{Key: "keyx", Value: "valx"}}, + maxMembers.list[:len(maxMembers.list)-1]..., + ), + } + }(), + }, +} - for _, tc := range testCases { +func TestTraceStateInsert(t *testing.T) { + for _, tc := range insertTestcase { t.Run(tc.name, func(t *testing.T) { actual, err := tc.tracestate.Insert(tc.key, tc.value) assert.ErrorIs(t, err, tc.err, tc.name) From 0905a9d8ab2033ac603683cb0de1c1c1b9f352c0 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 3 Dec 2023 17:38:12 +0100 Subject: [PATCH 778/886] dependabot updates Sun Dec 3 16:09:27 UTC 2023 (#4740) Bump golang.org/x/sys from 0.14.0 to 0.15.0 in /sdk Bump github.com/itchyny/gojq from 0.12.13 to 0.12.14 in /internal/tools Bump golang.org/x/tools from 0.15.0 to 0.16.0 in /internal/tools --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 +-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 +-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 +-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 +-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 +-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 +-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 +-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 +-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 +-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +-- internal/tools/go.mod | 14 ++++----- internal/tools/go.sum | 30 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +-- 44 files changed, 85 insertions(+), 85 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index dff07b9eedc..da514cd9ec8 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 094035dcfd9..92b795a117d 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 5caaf20e0bc..9fe2e306450 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index f69ee0de170..6e76c6aed70 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index f9102ff99af..b694aacb1ba 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index d9d262b4e0e..867315ee275 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/example/dice/go.mod b/example/dice/go.mod index 0232f4cb593..4a974d178aa 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index cdb22d24e23..33f7fb86e66 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -11,6 +11,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 80f4e3e486b..9b29c30a388 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.3.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 6133f48461b..8fd671228e6 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index f26d1bc4b5f..08f23c9f233 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index f69ee0de170..6e76c6aed70 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 82b1a731428..160f549e5c4 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 659eb759796..b4b0ab6d9a6 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 200df00c9b3..46bcb0f0da0 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 6133f48461b..8fd671228e6 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 63c35c721d9..ee7193eac17 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -22,7 +22,7 @@ require ( github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 45bf221777f..5a19e44b683 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -27,8 +27,8 @@ github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwa github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 2bc95e9cc90..8f638e80419 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 7850e803c13..24549e67bc2 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index e2ac65cbea3..5dd47288af3 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index a785b78a9d3..b3410b5f2ff 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index ee467b8831a..812e7a78fde 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index a785b78a9d3..b3410b5f2ff 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index cabf87efe00..8b62d053be6 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 4d096444b83..6cc7fe2eb38 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8aa8e0ad46e..1b87fd3e494 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 98f71093fc4..9d581c2ed07 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -30,8 +30,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 782fcfb4437..0c0be7bc70f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index a65cd61a392..33ae39b89cd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index fb72cc7732a..4c6b075908c 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -26,7 +26,7 @@ require ( github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index be254d22a49..efd6536daa6 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -35,8 +35,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 9b679f995f3..f00e7131d84 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 4b68d1f111b..94020957893 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 342d62af111..d5425c4a842 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 4b68d1f111b..94020957893 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index e475587a71d..efc75303640 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index b939da6eb8a..6d37533b753 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 53ea79ff862..b4f6570cb96 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/client9/misspell v0.3.4 github.com/gogo/protobuf v1.3.2 github.com/golangci/golangci-lint v1.55.2 - github.com/itchyny/gojq v0.12.13 + github.com/itchyny/gojq v0.12.14 github.com/jcchavezs/porto v0.6.0 github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad go.opentelemetry.io/build-tools/crosslink v0.12.0 @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.15.0 + golang.org/x/tools v0.16.0 golang.org/x/vuln v1.0.1 ) @@ -130,8 +130,8 @@ require ( github.com/maratori/testpackage v1.1.1 // indirect github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.4 // indirect @@ -203,12 +203,12 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.15.0 // indirect + golang.org/x/crypto v0.16.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.18.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index fc001456489..d04b80dbd2f 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -339,8 +339,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/itchyny/gojq v0.12.13 h1:IxyYlHYIlspQHHTE0f3cJF0NKDMfajxViuhBLnHd/QU= -github.com/itchyny/gojq v0.12.13/go.mod h1:JzwzAqenfhrPUuwbmEz3nu3JQmFLlQTQMUcOdnu/Sf4= +github.com/itchyny/gojq v0.12.14 h1:6k8vVtsrhQSYgSGg827AD+PVVaB1NLXEdX+dda2oZCc= +github.com/itchyny/gojq v0.12.14/go.mod h1:y1G7oO7XkcR1LPZO59KyoCRy08T3j9vDYRV0GgYSS+s= github.com/itchyny/timefmt-go v0.1.5 h1:G0INE2la8S6ru/ZI5JecgyzbbJNs5lG1RcBqa7Jm6GE= github.com/itchyny/timefmt-go v0.1.5/go.mod h1:nEP7L+2YmAbT2kZ2HfSs1d8Xtw9LY8D2stDBckWakZ8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= @@ -412,11 +412,11 @@ github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwM github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -664,8 +664,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -757,8 +757,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -845,8 +845,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -854,7 +854,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.14.0 h1:LGK9IlZ8T9jvdy6cTdfKUCltatMFOehAQo9SRC46UQ8= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -942,8 +942,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/sdk/go.mod b/sdk/go.mod index a9ee37410ee..7583fc33c6e 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 - golang.org/x/sys v0.14.0 + golang.org/x/sys v0.15.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 6efa2c97172..939feb405bb 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 8a22ee89cc7..24325464289 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.14.0 // indirect + golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 4b68d1f111b..94020957893 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 6cee2b4a4c76b581115d0d0ca150ad8b2e683db6 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 4 Dec 2023 12:21:49 -0800 Subject: [PATCH 779/886] Add semconv v1.22.0 (#4735) --- CHANGELOG.md | 10 +- .../tools/semconvkit/templates/doc.go.tmpl | 4 +- semconv/template.j2 | 20 +- semconv/v1.22.0/attribute_group.go | 2490 ++++++++++++++++ semconv/v1.22.0/doc.go | 20 + semconv/v1.22.0/event.go | 199 ++ semconv/v1.22.0/exception.go | 20 + semconv/v1.22.0/resource.go | 2568 +++++++++++++++++ semconv/v1.22.0/schema.go | 20 + semconv/v1.22.0/trace.go | 2427 ++++++++++++++++ 10 files changed, 7769 insertions(+), 9 deletions(-) create mode 100644 semconv/v1.22.0/attribute_group.go create mode 100644 semconv/v1.22.0/doc.go create mode 100644 semconv/v1.22.0/event.go create mode 100644 semconv/v1.22.0/exception.go create mode 100644 semconv/v1.22.0/resource.go create mode 100644 semconv/v1.22.0/schema.go create mode 100644 semconv/v1.22.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 32b9d6b9636..a0abcf5fb1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,15 +8,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- The `go.opentelemetry.io/otel/semconv/v1.22.0` package. + The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) +- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) + ### Changed - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) -### Added - -- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) - ## [1.21.0/0.44.0] 2023-11-16 ### Removed diff --git a/internal/tools/semconvkit/templates/doc.go.tmpl b/internal/tools/semconvkit/templates/doc.go.tmpl index c8fd7b218ab..4a45fb295da 100644 --- a/internal/tools/semconvkit/templates/doc.go.tmpl +++ b/internal/tools/semconvkit/templates/doc.go.tmpl @@ -15,6 +15,6 @@ // Package semconv implements OpenTelemetry semantic conventions. // // OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the {{.TagVer}} version of the OpenTelemetry specification. +// patterns for OpenTelemetry things. This package represents the {{.TagVer}} +// version of the OpenTelemetry semantic conventions. package semconv // import "go.opentelemetry.io/otel/semconv/{{.TagVer}}" diff --git a/semconv/template.j2 b/semconv/template.j2 index 8d20a41d50d..984f2f01d85 100644 --- a/semconv/template.j2 +++ b/semconv/template.j2 @@ -31,7 +31,11 @@ It represents {% if brief[:2] == "A " or brief[:3] == "An " or brief[:4] == "The {%- endif -%} {%- endmacro -%} {%- macro keydoc(attr) -%} +{%- if attr.stability|string() == "StabilityLevel.DEPRECATED" -%} +{{ to_go_name(attr.fqn) }}Key is the attribute Key conforming to the "{{ attr.fqn }}" semantic conventions. +{%- else -%} {{ to_go_name(attr.fqn) }}Key is the attribute Key conforming to the "{{ attr.fqn }}" semantic conventions. {{ it_reps(attr.brief) }} +{%- endif %} {%- endmacro -%} {%- macro keydetails(attr) -%} {%- if attr.attr_type is string %} @@ -51,18 +55,24 @@ RequirementLevel: Recommended RequirementLevel: Optional {%- endif %} {{ attr.stability | replace("Level.", ": ") | capitalize }} -{%- if attr.deprecated != None %} -Deprecated: {{ attr.deprecated }} -{%- endif %} {%- if attr.examples is iterable %} Examples: {{ attr.examples | pprint | trim("[]") }} {%- endif %} {%- if attr.note %} Note: {{ attr.note }} {%- endif %} +{%- if attr.stability|string() == "StabilityLevel.DEPRECATED" %} +Deprecated: {{ attr.brief | replace("Deprecated, ", "") }} +{%- endif %} {%- endmacro -%} {%- macro fndoc(attr) -%} +{%- if attr.stability|string() == "StabilityLevel.DEPRECATED" -%} +// {{ to_go_name(attr.fqn) }} returns an attribute KeyValue conforming to the "{{ attr.fqn }}" semantic conventions. + +Deprecated: {{ attr.brief | replace("Deprecated, ", "") }} +{%- else -%} // {{ to_go_name(attr.fqn) }} returns an attribute KeyValue conforming to the "{{ attr.fqn }}" semantic conventions. {{ it_reps(attr.brief) }} +{%- endif %} {%- endmacro -%} {%- macro to_go_func(type, name) -%} {%- if type == "string" -%} @@ -124,6 +134,10 @@ const ( var ( {%- for val in attr.attr_type.members %} // {{ val.brief | to_doc_brief }} +{%- if attr.stability|string() == "StabilityLevel.DEPRECATED" %} + // + // Deprecated: {{ attr.brief | replace("Deprecated, ", "") | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }} +{%- endif %} {{to_go_name("{}.{}".format(attr.fqn, val.member_id))}} = {{to_go_name(attr.fqn)}}Key.{{to_go_attr_type(attr.attr_type.enum_type, val.value)}} {%- endfor %} ) diff --git a/semconv/v1.22.0/attribute_group.go b/semconv/v1.22.0/attribute_group.go new file mode 100644 index 00000000000..88b436e0b27 --- /dev/null +++ b/semconv/v1.22.0/attribute_group.go @@ -0,0 +1,2490 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +import "go.opentelemetry.io/otel/attribute" + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup, otherwise IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries (e.g. proxies) if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries (e.g. proxies) if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup, otherwise IP address or +// Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address`. + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port`. + NetHostPortKey = attribute.Key("net.host.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address` on client spans and `client.address` on + // server spans. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port` on client spans and `client.port` on + // server spans. + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + // Deprecated: use `network.protocol.name`. + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + // Deprecated: use `network.protocol.version`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: use `network.local.address`. + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `network.local.port`. + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + // Deprecated: use `network.peer.address`. + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: no replacement at this time. + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + // Deprecated: use `network.peer.port`. + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport`. + NetTransportKey = attribute.Key("net.transport") +) + +var ( + // IPv4 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // ip_tcp + // + // Deprecated: use `network.transport`. + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + // + // Deprecated: use `network.transport`. + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + // + // Deprecated: use `network.transport`. + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + // + // Deprecated: use `network.transport`. + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + // + // Deprecated: use `network.transport`. + NetTransportOther = NetTransportKey.String("other") +) + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. +// +// Deprecated: use `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. +// +// Deprecated: use `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. +// +// Deprecated: use `server.address` on client spans and `client.address` on +// server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. +// +// Deprecated: use `server.port` on client spans and `client.port` on server +// spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. +// +// Deprecated: use `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. +// +// Deprecated: use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. +// +// Deprecated: use `network.local.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. +// +// Deprecated: use `network.local.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. +// +// Deprecated: use `network.peer.address`. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. +// +// Deprecated: no replacement at this time. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. +// +// Deprecated: use `network.peer.port`. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup, otherwise IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries (e.g. proxies) if it's available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup, otherwise IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable and SHOULD have low + // cardinality. + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low, but + // telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time, when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error codes (such as HTTP or + // gRPC status codes), + // it's RECOMMENDED to use a domain-specific attribute and also set + // `error.type` to capture + // all errors, regardless of whether they are defined within the + // domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation does not define a custom value for it + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Describes FaaS attributes. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") + + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes Database attributes +const ( + // PoolNameKey is the attribute Key conforming to the "pool.name" semantic + // conventions. It represents the name of the connection pool; unique + // within the instrumented application. In case the connection pool + // implementation does not provide a name, then the + // [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) + // should be used + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myDataSource' + PoolNameKey = attribute.Key("pool.name") + + // StateKey is the attribute Key conforming to the "state" semantic + // conventions. It represents the state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'idle' + StateKey = attribute.Key("state") +) + +var ( + // idle + StateIdle = StateKey.String("idle") + // used + StateUsed = StateKey.String("used") +) + +// PoolName returns an attribute KeyValue conforming to the "pool.name" +// semantic conventions. It represents the name of the connection pool; unique +// within the instrumented application. In case the connection pool +// implementation does not provide a name, then the +// [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) +// should be used +func PoolName(val string) attribute.KeyValue { + return PoolNameKey.String(val) +} + +// Describes JVM buffer metric attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// Describes System metric attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU metric attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory metric attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // total + SystemMemoryStateTotal = SystemMemoryStateKey.String("total") + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging metric attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes System Disk metric attributes +const ( + // SystemDiskDirectionKey is the attribute Key conforming to the + // "system.disk.direction" semantic conventions. It represents the disk + // operation direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + SystemDiskDirectionKey = attribute.Key("system.disk.direction") +) + +var ( + // read + SystemDiskDirectionRead = SystemDiskDirectionKey.String("read") + // write + SystemDiskDirectionWrite = SystemDiskDirectionKey.String("write") +) + +// Describes Filesystem metric attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network metric attributes +const ( + // SystemNetworkDirectionKey is the attribute Key conforming to the + // "system.network.direction" semantic conventions. It represents the + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + SystemNetworkDirectionKey = attribute.Key("system.network.direction") + + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // transmit + SystemNetworkDirectionTransmit = SystemNetworkDirectionKey.String("transmit") + // receive + SystemNetworkDirectionReceive = SystemNetworkDirectionKey.String("receive") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process metric attributes +const ( + // SystemProcessesStatusKey is the attribute Key conforming to the + // "system.processes.status" semantic conventions. It represents the + // process state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessesStatusKey = attribute.Key("system.processes.status") +) + +var ( + // running + SystemProcessesStatusRunning = SystemProcessesStatusKey.String("running") + // sleeping + SystemProcessesStatusSleeping = SystemProcessesStatusKey.String("sleeping") + // stopped + SystemProcessesStatusStopped = SystemProcessesStatusKey.String("stopped") + // defunct + SystemProcessesStatusDefunct = SystemProcessesStatusKey.String("defunct") +) + +// These attributes may be used for any network related operation. +const ( + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the protocol specified in `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client used has a version of `0.27.2`, but sends HTTP version + // `1.1`, this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://en.wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport, for example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe. See note below + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the protocol specified in `network.protocol.name`. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + // Deprecated: use `http.request.method` instead. + HTTPMethodKey = attribute.Key("http.method") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.request.body.size` instead. + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.response.body.size` instead. + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + // Deprecated: use `url.scheme` instead. + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + // Deprecated: use `http.response.status_code` instead. + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.path` and `url.query` instead. + HTTPTargetKey = attribute.Key("http.target") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.full` instead. + HTTPURLKey = attribute.Key("http.url") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. +// +// Deprecated: use `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. +// +// Deprecated: use `http.request.body.size` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. +// +// Deprecated: use `http.response.body.size` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. +// +// Deprecated: use `url.scheme` instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. +// +// Deprecated: use `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. +// +// Deprecated: use `url.path` and `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. +// +// Deprecated: use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPResendCountKey is the attribute Key conforming to the + // "http.resend_count" semantic conventions. It represents the ordinal + // number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPResendCountKey = attribute.Key("http.resend_count") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route (path template in + // the format used by the respective server framework). See note below + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPResendCount returns an attribute KeyValue conforming to the +// "http.resend_count" semantic conventions. It represents the ordinal number +// of request resending attempt (for any reason, including redirects). +func HTTPResendCount(val int) attribute.KeyValue { + return HTTPResendCountKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route (path template in the +// format used by the respective server framework). See note below +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API does not expose a +// clear notion of client and server). This also covers UDP network +// interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) +// and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server address - domain name if + // available without reverse DNS lookup, otherwise IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent + // the server address behind any intermediaries (e.g. proxies) if it's + // available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries (e.g. proxies) if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server address - +// domain name if available without reverse DNS lookup, otherwise IP address or +// Unix domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API does not expose a clear notion +// of client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup, otherwise IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries (e.g. proxies) if it's available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup, otherwise IP address or +// Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Semantic convention describing per-message attributes populated on messaging +// spans or links. +const ( + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the [conversation ID](#conversations) identifying the conversation to + // which the message belongs, represented as a string. Sometimes called + // "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") +) + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the [conversation ID](#conversations) identifying the +// conversation to which the message belongs, represented as a string. +// Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// Semantic convention for attributes that describe messaging destination on +// broker +const ( + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker does not have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") +) + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// Semantic convention for attributes that describe the publish messaging +// destination on broker. The term Publish Destination refers to the +// destination the message was originally published to. These attributes should +// be used on the consumer side when information about the publish destination +// is available and different than the destination message are consumed from. +const ( + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker does not have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") +) + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// Attributes for RabbitMQ +const ( + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If not empty.) + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") +) + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// Attributes for Apache Kafka +const ( + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If value is `true`. When + // missing, the value is assumed to be `false`.) + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") +) + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// Attributes for Apache RocketMQ +const ( + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delivery timestamp is not specified.) + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the message type is delay + // and delay time level is not specified.) + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// Attributes describing URL. +const ( + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it should be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password should be redacted and attribute's value should be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/search' + // Note: When missing, the value is assumed to be `/` + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") +) + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} diff --git a/semconv/v1.22.0/doc.go b/semconv/v1.22.0/doc.go new file mode 100644 index 00000000000..6f91d345dc4 --- /dev/null +++ b/semconv/v1.22.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.22.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" diff --git a/semconv/v1.22.0/event.go b/semconv/v1.22.0/event.go new file mode 100644 index 00000000000..68d76556fa8 --- /dev/null +++ b/semconv/v1.22.0/event.go @@ -0,0 +1,199 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +import "go.opentelemetry.io/otel/attribute" + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessageTypeKey = attribute.Key("message.type") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.22.0/exception.go b/semconv/v1.22.0/exception.go new file mode 100644 index 00000000000..9f1013f0b69 --- /dev/null +++ b/semconv/v1.22.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.22.0/resource.go b/semconv/v1.22.0/resource.go new file mode 100644 index 00000000000..65c1ca8c0a3 --- /dev/null +++ b/semconv/v1.22.0/resource.go @@ -0,0 +1,2568 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +import "go.opentelemetry.io/otel/attribute" + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// A cloud environment (e.g. GCP, Azure, AWS) +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) +// on Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assinged by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment +// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka +// deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// A serverless instance. +const ( + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// A host's CPU information +const ( + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the numeric value + // specifying the family or generation of the CPU. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the numeric value +// specifying the family or generation of the CPU. +func HostCPUFamily(val int) attribute.KeyValue { + return HostCPUFamilyKey.Int(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val int) attribute.KeyValue { + return HostCPUModelIDKey.Int(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val int) attribute.KeyValue { + return HostCPUSteppingKey.Int(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S does not have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") +) + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") +) + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") +) + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") +) + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") +) + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") +) + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") +) + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + // Deprecated: use the `otel.scope.name` attribute. + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + // Deprecated: use the `otel.scope.version` attribute. + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. +// +// Deprecated: use the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. +// +// Deprecated: use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.22.0/schema.go b/semconv/v1.22.0/schema.go new file mode 100644 index 00000000000..4b00ddee9b9 --- /dev/null +++ b/semconv/v1.22.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.22.0" diff --git a/semconv/v1.22.0/trace.go b/semconv/v1.22.0/trace.go new file mode 100644 index 00000000000..243227a244b --- /dev/null +++ b/semconv/v1.22.0/trace.go @@ -0,0 +1,2427 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.22.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadDaemonKey is the attribute Key conforming to the "thread.daemon" + // semantic conventions. It represents the whether the thread is daemon or + // not. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + ThreadDaemonKey = attribute.Key("thread.daemon") + + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadDaemon returns an attribute KeyValue conforming to the +// "thread.daemon" semantic conventions. It represents the whether the thread +// is daemon or not. +func ThreadDaemon(val bool) attribute.KeyValue { + return ThreadDaemonKey.Bool(val) +} + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span does not depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: experimental + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + DBSystemKey = attribute.Key("db.system") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: experimental + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for Elasticsearch +const ( + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the "X-Found-Handling-Cluster" + // HTTP response header.) + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the + // "X-Found-Handling-Instance" HTTP response header.) + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") +) + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: experimental + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") +) + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") +) + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} + +// General attributes used in messaging systems. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If the span describes an + // operation on a batch of messages.) + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Recommended (If a client id is available) + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation as defined in the [Operation + // names](#operation-names) section above. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // publish + MessagingOperationPublish = MessagingOperationKey.String("publish") + // receive + MessagingOperationReceive = MessagingOperationKey.String("receive") + // process + MessagingOperationProcess = MessagingOperationKey.String("process") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// Semantic conventions for remote procedure calls. +const ( + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// Tech-specific attributes for gRPC. +const ( + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). +const ( + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If response is not successful.) + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // does not specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If other than the default + // version (`1.0`)) + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// does not specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// Tech-specific attributes for Connect RPC. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (If response is not successful + // and if error code available.) + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) From 9ccb0c618c8d0734f2eb85246f4c66b80881fc35 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 5 Dec 2023 11:20:17 -0800 Subject: [PATCH 780/886] Backport semconv doc fix from #4735 (#4736) This version (v1.21.0) of the semantic conventions is generated from the semantic-conventions repository (https://github.com/open-telemetry/semantic-conventions), not the OpenTelemetry specification. --- semconv/v1.21.0/doc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/semconv/v1.21.0/doc.go b/semconv/v1.21.0/doc.go index 7cf424855e9..0318b5ec48f 100644 --- a/semconv/v1.21.0/doc.go +++ b/semconv/v1.21.0/doc.go @@ -15,6 +15,6 @@ // Package semconv implements OpenTelemetry semantic conventions. // // OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the v1.21.0 version of the OpenTelemetry specification. +// patterns for OpenTelemetry things. This package represents the v1.21.0 +// version of the OpenTelemetry semantic conventions. package semconv // import "go.opentelemetry.io/otel/semconv/v1.21.0" From d37d851bbce65577ab340849ec6c540fdc6e3096 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 6 Dec 2023 10:36:21 -0800 Subject: [PATCH 781/886] Add the internal experimental metric feature package (#4715) * Add the internal experimental metric feature pkg * Interpret empty envvar same as unset * Test Exemplars and CardinalityLimit * Fix empty test for CardinalityLimit * Abstract common testing patterns * Add test cases from review feedback * Rename assertions based on review feedback --------- Co-authored-by: Chester Cheung --- sdk/metric/internal/x/x.go | 93 +++++++++++++++++++++++++++++++++ sdk/metric/internal/x/x_test.go | 81 ++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 sdk/metric/internal/x/x.go create mode 100644 sdk/metric/internal/x/x_test.go diff --git a/sdk/metric/internal/x/x.go b/sdk/metric/internal/x/x.go new file mode 100644 index 00000000000..2891395725d --- /dev/null +++ b/sdk/metric/internal/x/x.go @@ -0,0 +1,93 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package x contains support for OTel metric SDK experimental features. +// +// This package should only be used for features defined in the specification. +// It should not be used for experiments or new project ideas. +package x // import "go.opentelemetry.io/otel/sdk/metric/internal/x" + +import ( + "os" + "strconv" + "strings" +) + +var ( + // Exemplars is an experimental feature flag that defines if exemplars + // should be recorded for metric data-points. + // + // To enable this feature set the OTEL_GO_X_EXEMPLAR environment variable + // to the case-insensitive string value of "true" (i.e. "True" and "TRUE" + // will also enable this). + Exemplars = newFeature("EXEMPLAR", func(v string) (string, bool) { + if strings.ToLower(v) == "true" { + return v, true + } + return "", false + }) + + // CardinalityLimit is an experimental feature flag that defines if + // cardinality limits should be applied to the recorded metric data-points. + // + // To enable this feature set the OTEL_GO_X_CARDINALITY_LIMIT environment + // variable to the integer limit value you want to use. + CardinalityLimit = newFeature("CARDINALITY_LIMIT", func(v string) (int, bool) { + n, err := strconv.Atoi(v) + if err != nil { + return 0, false + } + return n, true + }) +) + +// Feature is an experimental feature control flag. It provides a uniform way +// to interact with these feature flags and parse their values. +type Feature[T any] struct { + key string + parse func(v string) (T, bool) +} + +func newFeature[T any](suffix string, parse func(string) (T, bool)) Feature[T] { + const envKeyRoot = "OTEL_GO_X_" + return Feature[T]{ + key: envKeyRoot + suffix, + parse: parse, + } +} + +// Key returns the environment variable key that needs to be set to enable the +// feature. +func (f Feature[T]) Key() string { return f.key } + +// Lookup returns the user configured value for the feature and true if the +// user has enabled the feature. Otherwise, if the feature is not enabled, a +// zero-value and false are returned. +func (f Feature[T]) Lookup() (v T, ok bool) { + // https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value + // + // > The SDK MUST interpret an empty value of an environment variable the + // > same way as when the variable is unset. + vRaw := os.Getenv(f.key) + if vRaw == "" { + return v, ok + } + return f.parse(vRaw) +} + +// Enabled returns if the feature is enabled. +func (f Feature[T]) Enabled() bool { + _, ok := f.Lookup() + return ok +} diff --git a/sdk/metric/internal/x/x_test.go b/sdk/metric/internal/x/x_test.go new file mode 100644 index 00000000000..b643fe265ff --- /dev/null +++ b/sdk/metric/internal/x/x_test.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package x + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestExemplars(t *testing.T) { + const key = "OTEL_GO_X_EXEMPLAR" + require.Equal(t, key, Exemplars.Key()) + + t.Run("true", run(setenv(key, "true"), assertEnabled(Exemplars, "true"))) + t.Run("True", run(setenv(key, "True"), assertEnabled(Exemplars, "True"))) + t.Run("TRUE", run(setenv(key, "TRUE"), assertEnabled(Exemplars, "TRUE"))) + t.Run("false", run(setenv(key, "false"), assertDisabled(Exemplars))) + t.Run("1", run(setenv(key, "1"), assertDisabled(Exemplars))) + t.Run("empty", run(assertDisabled(Exemplars))) +} + +func TestCardinalityLimit(t *testing.T) { + const key = "OTEL_GO_X_CARDINALITY_LIMIT" + require.Equal(t, key, CardinalityLimit.Key()) + + t.Run("100", run(setenv(key, "100"), assertEnabled(CardinalityLimit, 100))) + t.Run("-1", run(setenv(key, "-1"), assertEnabled(CardinalityLimit, -1))) + t.Run("false", run(setenv(key, "false"), assertDisabled(CardinalityLimit))) + t.Run("empty", run(assertDisabled(CardinalityLimit))) +} + +func run(steps ...func(*testing.T)) func(*testing.T) { + return func(t *testing.T) { + t.Helper() + for _, step := range steps { + step(t) + } + } +} + +func setenv(k, v string) func(t *testing.T) { + return func(t *testing.T) { t.Setenv(k, v) } +} + +func assertEnabled[T any](f Feature[T], want T) func(*testing.T) { + return func(t *testing.T) { + t.Helper() + assert.True(t, f.Enabled(), "not enabled") + + v, ok := f.Lookup() + assert.True(t, ok, "Lookup state") + assert.Equal(t, want, v, "Lookup value") + } +} + +func assertDisabled[T any](f Feature[T]) func(*testing.T) { + var zero T + return func(t *testing.T) { + t.Helper() + + assert.False(t, f.Enabled(), "enabled") + + v, ok := f.Lookup() + assert.False(t, ok, "Lookup state") + assert.Equal(t, zero, v, "Lookup value") + } +} From 214d5e075f5a1057c3098497c982829fcc70434a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 7 Dec 2023 07:29:21 +0100 Subject: [PATCH 782/886] Add semconv/v1.23.0 (#4746) --- CHANGELOG.md | 2 + semconv/v1.23.0/attribute_group.go | 3257 ++++++++++++++++++++++++++++ semconv/v1.23.0/doc.go | 20 + semconv/v1.23.0/event.go | 254 +++ semconv/v1.23.0/exception.go | 20 + semconv/v1.23.0/resource.go | 2130 ++++++++++++++++++ semconv/v1.23.0/schema.go | 20 + semconv/v1.23.0/trace.go | 2079 ++++++++++++++++++ 8 files changed, 7782 insertions(+) create mode 100644 semconv/v1.23.0/attribute_group.go create mode 100644 semconv/v1.23.0/doc.go create mode 100644 semconv/v1.23.0/event.go create mode 100644 semconv/v1.23.0/exception.go create mode 100644 semconv/v1.23.0/resource.go create mode 100644 semconv/v1.23.0/schema.go create mode 100644 semconv/v1.23.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index a0abcf5fb1d..38557e32774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/semconv/v1.22.0` package. The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) +- The `go.opentelemetry.io/otel/semconv/v1.23.0` package. + The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) ### Changed diff --git a/semconv/v1.23.0/attribute_group.go b/semconv/v1.23.0/attribute_group.go new file mode 100644 index 00000000000..7225c3bb2cd --- /dev/null +++ b/semconv/v1.23.0/attribute_group.go @@ -0,0 +1,3257 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +import "go.opentelemetry.io/otel/attribute" + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries, for example proxies, if it's + // available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable and SHOULD have low + // cardinality. + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as + // HTTP or gRPC status codes), + // it's RECOMMENDED to: + // * Use a domain-specific attribute + // * Set `error.type` to capture all errors, regardless of whether they + // are defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation doesn't define a custom value + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Describes FaaS attributes. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") + + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes Database attributes +const ( + // PoolNameKey is the attribute Key conforming to the "pool.name" semantic + // conventions. It represents the name of the connection pool; unique + // within the instrumented application. In case the connection pool + // implementation doesn't provide a name, then the + // [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) + // should be used + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myDataSource' + PoolNameKey = attribute.Key("pool.name") + + // StateKey is the attribute Key conforming to the "state" semantic + // conventions. It represents the state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'idle' + StateKey = attribute.Key("state") +) + +var ( + // idle + StateIdle = StateKey.String("idle") + // used + StateUsed = StateKey.String("used") +) + +// PoolName returns an attribute KeyValue conforming to the "pool.name" +// semantic conventions. It represents the name of the connection pool; unique +// within the instrumented application. In case the connection pool +// implementation doesn't provide a name, then the +// [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) +// should be used +func PoolName(val string) attribute.KeyValue { + return PoolNameKey.String(val) +} + +// Describes JVM buffer metric attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// Describes System metric attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU metric attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory metric attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging metric attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes System Disk metric attributes +const ( + // SystemDiskDirectionKey is the attribute Key conforming to the + // "system.disk.direction" semantic conventions. It represents the disk + // operation direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + SystemDiskDirectionKey = attribute.Key("system.disk.direction") +) + +var ( + // read + SystemDiskDirectionRead = SystemDiskDirectionKey.String("read") + // write + SystemDiskDirectionWrite = SystemDiskDirectionKey.String("write") +) + +// Describes Filesystem metric attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network metric attributes +const ( + // SystemNetworkDirectionKey is the attribute Key conforming to the + // "system.network.direction" semantic conventions. It represents the + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + SystemNetworkDirectionKey = attribute.Key("system.network.direction") + + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // transmit + SystemNetworkDirectionTransmit = SystemNetworkDirectionKey.String("transmit") + // receive + SystemNetworkDirectionReceive = SystemNetworkDirectionKey.String("receive") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process metric attributes +const ( + // SystemProcessesStatusKey is the attribute Key conforming to the + // "system.processes.status" semantic conventions. It represents the + // process state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessesStatusKey = attribute.Key("system.processes.status") +) + +var ( + // running + SystemProcessesStatusRunning = SystemProcessesStatusKey.String("running") + // sleeping + SystemProcessesStatusSleeping = SystemProcessesStatusKey.String("sleeping") + // stopped + SystemProcessesStatusStopped = SystemProcessesStatusKey.String("stopped") + // defunct + SystemProcessesStatusDefunct = SystemProcessesStatusKey.String("defunct") +) + +// A cloud environment (e.g. GCP, Azure, AWS). +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on +// Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assinged by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + // Deprecated: use `http.request.method` instead. + HTTPMethodKey = attribute.Key("http.method") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.request.header.content-length` instead. + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.response.header.content-length` instead. + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + // Deprecated: use `url.scheme` instead. + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + // Deprecated: use `http.response.status_code` instead. + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.path` and `url.query` instead. + HTTPTargetKey = attribute.Key("http.target") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.full` instead. + HTTPURLKey = attribute.Key("http.url") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. +// +// Deprecated: use `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. +// +// Deprecated: use `http.request.header.content-length` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. +// +// Deprecated: use `http.response.header.content-length` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. +// +// Deprecated: use `url.scheme` instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. +// +// Deprecated: use `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. +// +// Deprecated: use `url.path` and `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. +// +// Deprecated: use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address`. + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port`. + NetHostPortKey = attribute.Key("net.host.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address` on client spans and `client.address` on + // server spans. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port` on client spans and `client.port` on + // server spans. + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + // Deprecated: use `network.protocol.name`. + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + // Deprecated: use `network.protocol.version`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: use `network.local.address`. + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `network.local.port`. + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + // Deprecated: use `network.peer.address`. + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: no replacement at this time. + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + // Deprecated: use `network.peer.port`. + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport`. + NetTransportKey = attribute.Key("net.transport") +) + +var ( + // IPv4 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // ip_tcp + // + // Deprecated: use `network.transport`. + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + // + // Deprecated: use `network.transport`. + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + // + // Deprecated: use `network.transport`. + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + // + // Deprecated: use `network.transport`. + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + // + // Deprecated: use `network.transport`. + NetTransportOther = NetTransportKey.String("other") +) + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. +// +// Deprecated: use `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. +// +// Deprecated: use `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. +// +// Deprecated: use `server.address` on client spans and `client.address` on +// server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. +// +// Deprecated: use `server.port` on client spans and `client.port` on server +// spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. +// +// Deprecated: use `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. +// +// Deprecated: use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. +// +// Deprecated: use `network.local.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. +// +// Deprecated: use `network.local.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. +// +// Deprecated: use `network.peer.address`. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. +// +// Deprecated: no replacement at this time. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. +// +// Deprecated: use `network.peer.port`. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the + // ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route, that is, the path + // template in the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes describing telemetry around messaging systems and messaging +// activities. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker doesn't have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the conversation ID identifying the conversation to which the message + // belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created + MessagingOperationPublish = MessagingOperationKey.String("publish") + // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios + MessagingOperationCreate = MessagingOperationKey.String("create") + // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages + MessagingOperationReceive = MessagingOperationKey.String("receive") + // One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs + MessagingOperationDeliver = MessagingOperationKey.String("deliver") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the conversation ID identifying the conversation to which the +// message belongs, represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the protocol specified in `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the protocol specified in `network.protocol.name`. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// Attributes for remote procedure calls. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// doesn't specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// Attributes describing URL. +const ( + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it SHOULD be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password SHOULD be redacted and attribute's value SHOULD be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") +) + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent the server address + // behind any intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server domain name +// if available without reverse DNS lookup; otherwise, IP address or Unix +// domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +// When a session reaches end of life, typically due to user inactivity or +// session timeout, a new session identifier will be assigned. The previous +// session identifier may be provided by the instrumentation so that telemetry +// backends can link the two sessions. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries, for example proxies, if it's + // available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} diff --git a/semconv/v1.23.0/doc.go b/semconv/v1.23.0/doc.go new file mode 100644 index 00000000000..ce87d18c6d5 --- /dev/null +++ b/semconv/v1.23.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.23.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" diff --git a/semconv/v1.23.0/event.go b/semconv/v1.23.0/event.go new file mode 100644 index 00000000000..324fbd166fc --- /dev/null +++ b/semconv/v1.23.0/event.go @@ -0,0 +1,254 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +import "go.opentelemetry.io/otel/attribute" + +// This event represents an occurrence of a lifecycle transition on the iOS +// platform. `event.domain` MUST be `device`. +const ( + // IosStateKey is the attribute Key conforming to the "ios.state" semantic + // conventions. It represents the this attribute represents the state the + // application has transitioned into at the occurrence of the event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The iOS lifecycle states are defined in the [UIApplicationDelegate + // documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + // and from which the `OS terminology` column values are derived. + IosStateKey = attribute.Key("ios.state") +) + +var ( + // The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive` + IosStateActive = IosStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive` + IosStateInactive = IosStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground` + IosStateBackground = IosStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground` + IosStateForeground = IosStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification `applicationWillTerminate` + IosStateTerminate = IosStateKey.String("terminate") +) + +// This event represents an occurrence of a lifecycle transition on the Android +// platform. `event.domain` MUST be `device`. +const ( + // AndroidStateKey is the attribute Key conforming to the "android.state" + // semantic conventions. It represents the this attribute represents the + // state the application has transitioned into at the occurrence of the + // event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The Android lifecycle states are defined in [Activity lifecycle + // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + // and from which the `OS identifiers` are derived. + AndroidStateKey = attribute.Key("android.state") +) + +var ( + // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time + AndroidStateCreated = AndroidStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state + AndroidStateBackground = AndroidStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states + AndroidStateForeground = AndroidStateKey.String("foreground") +) + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessageTypeKey = attribute.Key("message.type") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.23.0/exception.go b/semconv/v1.23.0/exception.go new file mode 100644 index 00000000000..a23c61724e9 --- /dev/null +++ b/semconv/v1.23.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.23.0/resource.go b/semconv/v1.23.0/resource.go new file mode 100644 index 00000000000..fdbb4316018 --- /dev/null +++ b/semconv/v1.23.0/resource.go @@ -0,0 +1,2130 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +import "go.opentelemetry.io/otel/attribute" + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) +// (aka deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// A serverless instance. +const ( + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal + // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): + // as hyphen-separated octets in uppercase hexadecimal form from most to + // least significant. + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" +// semantic conventions. It represents the available MAC addresses of the host, +// excluding loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// A host's CPU information +const ( + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the numeric value + // specifying the family or generation of the CPU. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the numeric value +// specifying the family or generation of the CPU. +func HostCPUFamily(val int) attribute.KeyValue { + return HostCPUFamilyKey.Int(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val int) attribute.KeyValue { + return HostCPUModelIDKey.Int(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val int) attribute.KeyValue { + return HostCPUSteppingKey.Int(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S doesn't have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") +) + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") +) + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") +) + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") +) + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") +) + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") +) + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") +) + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + // Deprecated: use the `otel.scope.name` attribute. + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + // Deprecated: use the `otel.scope.version` attribute. + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. +// +// Deprecated: use the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. +// +// Deprecated: use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.23.0/schema.go b/semconv/v1.23.0/schema.go new file mode 100644 index 00000000000..c951dfb7c70 --- /dev/null +++ b/semconv/v1.23.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.23.0" diff --git a/semconv/v1.23.0/trace.go b/semconv/v1.23.0/trace.go new file mode 100644 index 00000000000..532303eed71 --- /dev/null +++ b/semconv/v1.23.0/trace.go @@ -0,0 +1,2079 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.0" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: experimental + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + DBSystemKey = attribute.Key("db.system") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: experimental + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for Elasticsearch +const ( + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the "X-Found-Handling-Cluster" + // HTTP response header.) + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the + // "X-Found-Handling-Instance" HTTP response header.) + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") +) + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: experimental + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") +) + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") +) + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} From b5afa704f1d9e1f1dc1e6e9be1bea742acf98386 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Fri, 8 Dec 2023 17:21:30 -0500 Subject: [PATCH 783/886] Fix multi-reader observable counter double-counting bug (#4742) * fix Fix a bug where using multiple readers resulted in incorrect asynchronous counter values * move addCallback to inserter * restore comment --- CHANGELOG.md | 1 + sdk/metric/instrument.go | 28 ++++-- sdk/metric/meter.go | 182 ++++++++++++++++++++------------------- sdk/metric/meter_test.go | 13 ++- sdk/metric/pipeline.go | 22 ++--- 5 files changed, 130 insertions(+), 116 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38557e32774..f506cba6b0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) - Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) +- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) ## [1.20.0/0.43.0] 2023-11-10 diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index bb52f6ec717..30373038f5e 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -270,9 +270,9 @@ var ( _ metric.Float64ObservableGauge = float64Observable{} ) -func newFloat64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[float64]) float64Observable { +func newFloat64Observable(m *meter, kind InstrumentKind, name, desc, u string) float64Observable { return float64Observable{ - observable: newObservable(m, kind, name, desc, u, meas), + observable: newObservable[float64](m, kind, name, desc, u), } } @@ -291,9 +291,9 @@ var ( _ metric.Int64ObservableGauge = int64Observable{} ) -func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[int64]) int64Observable { +func newInt64Observable(m *meter, kind InstrumentKind, name, desc, u string) int64Observable { return int64Observable{ - observable: newObservable(m, kind, name, desc, u, meas), + observable: newObservable[int64](m, kind, name, desc, u), } } @@ -302,10 +302,10 @@ type observable[N int64 | float64] struct { observablID[N] meter *meter - measures []aggregate.Measure[N] + measures measures[N] } -func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, u string, meas []aggregate.Measure[N]) *observable[N] { +func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, u string) *observable[N] { return &observable[N]{ observablID: observablID[N]{ name: name, @@ -314,14 +314,24 @@ func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, unit: u, scope: m.scope, }, - meter: m, - measures: meas, + meter: m, } } // observe records the val for the set of attrs. func (o *observable[N]) observe(val N, s attribute.Set) { - for _, in := range o.measures { + o.measures.observe(val, s) +} + +func (o *observable[N]) appendMeasures(meas []aggregate.Measure[N]) { + o.measures = append(o.measures, meas...) +} + +type measures[N int64 | float64] []aggregate.Measure[N] + +// observe records the val for the set of attrs. +func (m measures[N]) observe(val N, s attribute.Set) { + for _, in := range m { in(context.Background(), val, s) } } diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 7f51ec512ad..423cba8bdf9 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -104,20 +104,44 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti return i, validateInstrumentName(name) } +// int64ObservableInstrument returns a new observable identified by the Instrument. +// It registers callbacks for each reader's pipeline. +func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int64Callback) (int64Observable, error) { + inst := newInt64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.int64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := int64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } + } + return inst, validateInstrumentName(id.Name) +} + // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. // Only the measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { cfg := metric.NewInt64ObservableCounterConfig(options...) - const kind = InstrumentKindObservableCounter - p := int64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableCounter, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.int64ObservableInstrument(id, cfg.Callbacks()) } // Int64ObservableUpDownCounter returns a new instrument identified by name and @@ -126,14 +150,14 @@ func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64Obser // measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) { cfg := metric.NewInt64ObservableUpDownCounterConfig(options...) - const kind = InstrumentKindObservableUpDownCounter - p := int64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableUpDownCounter, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.int64ObservableInstrument(id, cfg.Callbacks()) } // Int64ObservableGauge returns a new instrument identified by name and @@ -142,14 +166,14 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int6 // Only the measurements recorded during the collection cycle are exported. func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) { cfg := metric.NewInt64ObservableGaugeConfig(options...) - const kind = InstrumentKindObservableGauge - p := int64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableGauge, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.int64ObservableInstrument(id, cfg.Callbacks()) } // Float64Counter returns a new instrument identified by name and configured @@ -196,20 +220,44 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram return i, validateInstrumentName(name) } +// float64ObservableInstrument returns a new observable identified by the Instrument. +// It registers callbacks for each reader's pipeline. +func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Float64Callback) (float64Observable, error) { + inst := newFloat64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.float64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := float64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } + } + return inst, validateInstrumentName(id.Name) +} + // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. // Only the measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { cfg := metric.NewFloat64ObservableCounterConfig(options...) - const kind = InstrumentKindObservableCounter - p := float64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableCounter, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.float64ObservableInstrument(id, cfg.Callbacks()) } // Float64ObservableUpDownCounter returns a new instrument identified by name @@ -218,14 +266,14 @@ func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64O // measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) { cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...) - const kind = InstrumentKindObservableUpDownCounter - p := float64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableUpDownCounter, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.float64ObservableInstrument(id, cfg.Callbacks()) } // Float64ObservableGauge returns a new instrument identified by name and @@ -234,14 +282,14 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Fl // Only the measurements recorded during the collection cycle are exported. func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) { cfg := metric.NewFloat64ObservableGaugeConfig(options...) - const kind = InstrumentKindObservableGauge - p := float64ObservProvider{m} - inst, err := p.lookup(kind, name, cfg.Description(), cfg.Unit()) - if err != nil { - return nil, err + id := Instrument{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindObservableGauge, + Scope: m.scope, } - p.registerCallbacks(inst, cfg.Callbacks()) - return inst, validateInstrumentName(name) + return m.float64ObservableInstrument(id, cfg.Callbacks()) } func validateInstrumentName(name string) error { @@ -528,32 +576,9 @@ func (p float64InstProvider) lookupHistogram(name string, cfg metric.Float64Hist return &float64Inst{measures: aggs}, err } -type int64ObservProvider struct{ *meter } - -func (p int64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (int64Observable, error) { - aggs, err := (int64InstProvider)(p).aggs(kind, name, desc, u) - return newInt64Observable(p.meter, kind, name, desc, u, aggs), err -} - -func (p int64ObservProvider) registerCallbacks(inst int64Observable, cBacks []metric.Int64Callback) { - if inst.observable == nil || len(inst.measures) == 0 { - // Drop aggregator. - return - } - - for _, cBack := range cBacks { - p.pipes.registerCallback(p.callback(inst, cBack)) - } -} - -func (p int64ObservProvider) callback(i int64Observable, f metric.Int64Callback) func(context.Context) error { - inst := int64Observer{int64Observable: i} - return func(ctx context.Context) error { return f(ctx, inst) } -} - type int64Observer struct { embedded.Int64Observer - int64Observable + measures[int64] } func (o int64Observer) Observe(val int64, opts ...metric.ObserveOption) { @@ -561,32 +586,9 @@ func (o int64Observer) Observe(val int64, opts ...metric.ObserveOption) { o.observe(val, c.Attributes()) } -type float64ObservProvider struct{ *meter } - -func (p float64ObservProvider) lookup(kind InstrumentKind, name, desc, u string) (float64Observable, error) { - aggs, err := (float64InstProvider)(p).aggs(kind, name, desc, u) - return newFloat64Observable(p.meter, kind, name, desc, u, aggs), err -} - -func (p float64ObservProvider) registerCallbacks(inst float64Observable, cBacks []metric.Float64Callback) { - if inst.observable == nil || len(inst.measures) == 0 { - // Drop aggregator. - return - } - - for _, cBack := range cBacks { - p.pipes.registerCallback(p.callback(inst, cBack)) - } -} - -func (p float64ObservProvider) callback(i float64Observable, f metric.Float64Callback) func(context.Context) error { - inst := float64Observer{float64Observable: i} - return func(ctx context.Context) error { return f(ctx, inst) } -} - type float64Observer struct { embedded.Float64Observer - float64Observable + measures[float64] } func (o float64Observer) Observe(val float64, opts ...metric.ObserveOption) { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 0e082a7be06..c661a06dabb 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -1589,7 +1589,8 @@ func TestObservableExample(t *testing.T) { ) selector := func(InstrumentKind) metricdata.Temporality { return temp } - reader := NewManualReader(WithTemporalitySelector(selector)) + reader1 := NewManualReader(WithTemporalitySelector(selector)) + reader2 := NewManualReader(WithTemporalitySelector(selector)) allowAll := attribute.NewDenyKeysFilter() noFiltered := NewView(Instrument{Name: instName}, Stream{Name: instName, AttributeFilter: allowAll}) @@ -1597,7 +1598,7 @@ func TestObservableExample(t *testing.T) { filter := attribute.NewDenyKeysFilter("tid") filtered := NewView(Instrument{Name: instName}, Stream{Name: filteredStream, AttributeFilter: filter}) - mp := NewMeterProvider(WithReader(reader), WithView(noFiltered, filtered)) + mp := NewMeterProvider(WithReader(reader1), WithReader(reader2), WithView(noFiltered, filtered)) meter := mp.Meter(scopeName) observations := make(map[attribute.Set]int64) @@ -1644,7 +1645,13 @@ func TestObservableExample(t *testing.T) { collect := func(t *testing.T) { t.Helper() got := metricdata.ResourceMetrics{} - err := reader.Collect(context.Background(), &got) + err := reader1.Collect(context.Background(), &got) + require.NoError(t, err) + require.Len(t, got.ScopeMetrics, 1) + metricdatatest.AssertEqual(t, *want, got.ScopeMetrics[0], metricdatatest.IgnoreTimestamp()) + + got = metricdata.ResourceMetrics{} + err = reader2.Collect(context.Background(), &got) require.NoError(t, err) require.Len(t, got.ScopeMetrics, 1) metricdatatest.AssertEqual(t, *want, got.ScopeMetrics[0], metricdatatest.IgnoreTimestamp()) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 48abcc8a7f3..75e3af49bac 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -93,14 +93,6 @@ func (p *pipeline) addSync(scope instrumentation.Scope, iSync instrumentSync) { p.aggregations[scope] = append(p.aggregations[scope], iSync) } -// addCallback registers a single instrument callback to be run when -// `produce()` is called. -func (p *pipeline) addCallback(cback func(context.Context) error) { - p.Lock() - defer p.Unlock() - p.callbacks = append(p.callbacks, cback) -} - type multiCallback func(context.Context) error // addMultiCallback registers a multi-instrument callback to be run when @@ -281,6 +273,14 @@ func (i *inserter[N]) Instrument(inst Instrument, readerAggregation Aggregation) return measures, errs.errorOrNil() } +// addCallback registers a single instrument callback to be run when +// `produce()` is called. +func (i *inserter[N]) addCallback(cback func(context.Context) error) { + i.pipeline.Lock() + defer i.pipeline.Unlock() + i.pipeline.callbacks = append(i.pipeline.callbacks, cback) +} + var aggIDCount uint64 // aggVal is the cached value in an aggregators cache. @@ -557,12 +557,6 @@ func newPipelines(res *resource.Resource, readers []Reader, views []View) pipeli return pipes } -func (p pipelines) registerCallback(cback func(context.Context) error) { - for _, pipe := range p { - pipe.addCallback(cback) - } -} - func (p pipelines) registerMultiCallback(c multiCallback) metric.Registration { unregs := make([]func(), len(p)) for i, pipe := range p { From 215eae31c780a279428d45bd92a50070c06b9d56 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sat, 9 Dec 2023 08:08:24 -0800 Subject: [PATCH 784/886] Refactor exponential histogram tests to use existing fixtures (#4747) * Refactor expo hist test to use existing fixtures The tests for the exponential histogram create their own testing fixtures. There is nothing these new fixtures do that cannot already be done with the existing testing fixtures used by all the other aggregate functions. Unify the exponential histogram testing to use the existing fixtures. * Add alt input for cumulative test --- .../aggregate/exponential_histogram_test.go | 274 ++++++++++-------- 1 file changed, 146 insertions(+), 128 deletions(-) diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 26b89f0ba50..44a8328bbe5 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -23,10 +23,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) type noErrorHandler struct{ t *testing.T } @@ -739,161 +737,181 @@ func TestSubNormal(t *testing.T) { } func TestExponentialHistogramAggregation(t *testing.T) { - t.Run("Int64", testExponentialHistogramAggregation[int64]) - t.Run("Float64", testExponentialHistogramAggregation[float64]) -} + t.Cleanup(mockTime(now)) -func testExponentialHistogramAggregation[N int64 | float64](t *testing.T) { - const ( - maxSize = 4 - maxScale = 20 - noMinMax = false - noSum = false - ) + t.Run("Int64/Delta", testDeltaExpoHist[int64]()) + t.Run("Float64/Delta", testDeltaExpoHist[float64]()) + t.Run("Int64/Cumulative", testCumulativeExpoHist[int64]()) + t.Run("Float64/Cumulative", testCumulativeExpoHist[float64]()) +} - tests := []struct { - name string - build func() (Measure[N], ComputeAggregation) - input [][]N - want metricdata.ExponentialHistogram[N] - wantCount int - }{ +func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { + in, out := Builder[N]{ + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + }.ExponentialBucketHistogram(4, 20, false, false) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{}, + }, + }, + }, { - name: "Delta Single", - build: func() (Measure[N], ComputeAggregation) { - return Builder[N]{ + input: []arg[N]{ + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 2, alice}, + {ctx, 16, alice}, + {ctx, 1, alice}, + }, + expect: output{ + n: 1, + agg: metricdata.ExponentialHistogram[N]{ Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) - }, - input: [][]N{ - {4, 4, 4, 2, 16, 1}, - }, - want: metricdata.ExponentialHistogram[N]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ - { - Count: 6, - Min: metricdata.NewExtrema[N](1), - Max: metricdata.NewExtrema[N](16), - Sum: 31, - Scale: -1, - PositiveBucket: metricdata.ExponentialBucket{ - Offset: -1, - Counts: []uint64{1, 4, 1}, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, }, }, }, }, - wantCount: 1, }, { - name: "Cumulative Single", - build: func() (Measure[N], ComputeAggregation) { - return Builder[N]{ + // Delta sums are expected to reset. + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{}, + }, + }, + }, + }) +} + +func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { + in, out := Builder[N]{ + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + }.ExponentialBucketHistogram(4, 20, false, false) + ctx := context.Background() + return test[N](in, out, []teststep[N]{ + { + input: []arg[N]{}, + expect: output{ + n: 0, + agg: metricdata.ExponentialHistogram[N]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) - }, - input: [][]N{ - {4, 4, 4, 2, 16, 1}, - }, - want: metricdata.ExponentialHistogram[N]{ - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ - { - Count: 6, - Min: metricdata.NewExtrema[N](1), - Max: metricdata.NewExtrema[N](16), - Sum: 31, - Scale: -1, - PositiveBucket: metricdata.ExponentialBucket{ - Offset: -1, - Counts: []uint64{1, 4, 1}, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{}, + }, + }, + }, + { + input: []arg[N]{ + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 2, alice}, + {ctx, 16, alice}, + {ctx, 1, alice}, + }, + expect: output{ + n: 1, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, }, }, }, }, - wantCount: 1, }, { - name: "Delta Multiple", - build: func() (Measure[N], ComputeAggregation) { - return Builder[N]{ - Temporality: metricdata.DeltaTemporality, - }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) - }, - input: [][]N{ - {2, 3, 8}, - {4, 4, 4, 2, 16, 1}, - }, - want: metricdata.ExponentialHistogram[N]{ - Temporality: metricdata.DeltaTemporality, - DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ - { - Count: 6, - Min: metricdata.NewExtrema[N](1), - Max: metricdata.NewExtrema[N](16), - Sum: 31, - Scale: -1, - PositiveBucket: metricdata.ExponentialBucket{ - Offset: -1, - Counts: []uint64{1, 4, 1}, + input: []arg[N]{ + {ctx, 2, alice}, + {ctx, 3, alice}, + {ctx, 8, alice}, + }, + expect: output{ + n: 1, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 9, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 44, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 6, 2}, + }, }, }, }, }, - wantCount: 1, }, { - name: "Cumulative Multiple ", - build: func() (Measure[N], ComputeAggregation) { - return Builder[N]{ + input: []arg[N]{}, + expect: output{ + n: 1, + agg: metricdata.ExponentialHistogram[N]{ Temporality: metricdata.CumulativeTemporality, - }.ExponentialBucketHistogram(maxSize, maxScale, noMinMax, noSum) - }, - input: [][]N{ - {2, 3, 8}, - {4, 4, 4, 2, 16, 1}, - }, - want: metricdata.ExponentialHistogram[N]{ - Temporality: metricdata.CumulativeTemporality, - DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ - { - Count: 9, - Min: metricdata.NewExtrema[N](1), - Max: metricdata.NewExtrema[N](16), - Sum: 44, - Scale: -1, - PositiveBucket: metricdata.ExponentialBucket{ - Offset: -1, - Counts: []uint64{1, 6, 2}, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 9, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 44, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 6, 2}, + }, }, }, }, }, - wantCount: 1, }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - restore := withHandler(t) - defer restore() - in, out := tt.build() - ctx := context.Background() - - var got metricdata.Aggregation - var count int - for _, n := range tt.input { - for _, v := range n { - in(ctx, v, *attribute.EmptySet()) - } - count = out(&got) - } - - metricdatatest.AssertAggregationsEqual(t, tt.want, got, metricdatatest.IgnoreTimestamp()) - assert.Equal(t, tt.wantCount, count) - }) - } + }) } func FuzzGetBin(f *testing.F) { From 975939b26d32421d9ab3fc6de0f25f095872d36a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 10 Dec 2023 07:58:06 -0800 Subject: [PATCH 785/886] Bump actions/setup-go from 4 to 5 (#4751) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 10 +++++----- .github/workflows/create-dependabot-pr.yml | 2 +- .github/workflows/dependabot.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5eab8d039ba..18b5c1d6c3c 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} check-latest: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb8c715f642..7d98db43101 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} check-latest: true @@ -52,7 +52,7 @@ jobs: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} cache-dependency-path: "**/go.sum" @@ -65,7 +65,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} check-latest: true @@ -79,7 +79,7 @@ jobs: - name: Checkout Repo uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ env.DEFAULT_GO_VERSION }} check-latest: true @@ -122,7 +122,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} check-latest: true diff --git a/.github/workflows/create-dependabot-pr.yml b/.github/workflows/create-dependabot-pr.yml index 3d47df56ab1..bd931aff7c1 100644 --- a/.github/workflows/create-dependabot-pr.yml +++ b/.github/workflows/create-dependabot-pr.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: "~1.21.3" check-latest: true diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index c74d60f1638..117ac33e733 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: "~1.21.3" check-latest: true From 0c1c434c70c83d8d68585f7c510823a06aa318a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Sun, 10 Dec 2023 17:04:52 +0100 Subject: [PATCH 786/886] Add semconv/v1.23.1 (#4749) * Add semconv/v1.23.1 * Update changelog --------- Co-authored-by: Tyler Yahn --- CHANGELOG.md | 2 + semconv/v1.23.1/attribute_group.go | 2799 ++++++++++++++++++++++++++++ semconv/v1.23.1/doc.go | 20 + semconv/v1.23.1/event.go | 254 +++ semconv/v1.23.1/exception.go | 20 + semconv/v1.23.1/resource.go | 2588 +++++++++++++++++++++++++ semconv/v1.23.1/schema.go | 20 + semconv/v1.23.1/trace.go | 2079 +++++++++++++++++++++ 8 files changed, 7782 insertions(+) create mode 100644 semconv/v1.23.1/attribute_group.go create mode 100644 semconv/v1.23.1/doc.go create mode 100644 semconv/v1.23.1/event.go create mode 100644 semconv/v1.23.1/exception.go create mode 100644 semconv/v1.23.1/resource.go create mode 100644 semconv/v1.23.1/schema.go create mode 100644 semconv/v1.23.1/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index f506cba6b0d..6ec88f882c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735) - The `go.opentelemetry.io/otel/semconv/v1.23.0` package. The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) +- The `go.opentelemetry.io/otel/semconv/v1.23.1` package. + The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) ### Changed diff --git a/semconv/v1.23.1/attribute_group.go b/semconv/v1.23.1/attribute_group.go new file mode 100644 index 00000000000..c48a5b15fb0 --- /dev/null +++ b/semconv/v1.23.1/attribute_group.go @@ -0,0 +1,2799 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +import "go.opentelemetry.io/otel/attribute" + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries, for example proxies, if it's + // available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable and SHOULD have low + // cardinality. + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as + // HTTP or gRPC status codes), + // it's RECOMMENDED to: + // * Use a domain-specific attribute + // * Set `error.type` to capture all errors, regardless of whether they + // are defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation doesn't define a custom value + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// Describes FaaS attributes. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventDomainKey is the attribute Key conforming to the "event.domain" + // semantic conventions. It represents the domain identifies the business + // context for the events. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: Events across different domains may have same `event.name`, yet be + // unrelated events. + EventDomainKey = attribute.Key("event.domain") + + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the name identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'click', 'exception' + EventNameKey = attribute.Key("event.name") +) + +var ( + // Events from browser apps + EventDomainBrowser = EventDomainKey.String("browser") + // Events from mobile apps + EventDomainDevice = EventDomainKey.String("device") + // Events from Kubernetes + EventDomainK8S = EventDomainKey.String("k8s") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the name identifies the event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes Database attributes +const ( + // PoolNameKey is the attribute Key conforming to the "pool.name" semantic + // conventions. It represents the name of the connection pool; unique + // within the instrumented application. In case the connection pool + // implementation doesn't provide a name, then the + // [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) + // should be used + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myDataSource' + PoolNameKey = attribute.Key("pool.name") + + // StateKey is the attribute Key conforming to the "state" semantic + // conventions. It represents the state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'idle' + StateKey = attribute.Key("state") +) + +var ( + // idle + StateIdle = StateKey.String("idle") + // used + StateUsed = StateKey.String("used") +) + +// PoolName returns an attribute KeyValue conforming to the "pool.name" +// semantic conventions. It represents the name of the connection pool; unique +// within the instrumented application. In case the connection pool +// implementation doesn't provide a name, then the +// [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) +// should be used +func PoolName(val string) attribute.KeyValue { + return PoolNameKey.String(val) +} + +// Describes JVM buffer metric attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// Describes System metric attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU metric attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory metric attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging metric attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes System Disk metric attributes +const ( + // SystemDiskDirectionKey is the attribute Key conforming to the + // "system.disk.direction" semantic conventions. It represents the disk + // operation direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + SystemDiskDirectionKey = attribute.Key("system.disk.direction") +) + +var ( + // read + SystemDiskDirectionRead = SystemDiskDirectionKey.String("read") + // write + SystemDiskDirectionWrite = SystemDiskDirectionKey.String("write") +) + +// Describes Filesystem metric attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network metric attributes +const ( + // SystemNetworkDirectionKey is the attribute Key conforming to the + // "system.network.direction" semantic conventions. It represents the + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + SystemNetworkDirectionKey = attribute.Key("system.network.direction") + + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // transmit + SystemNetworkDirectionTransmit = SystemNetworkDirectionKey.String("transmit") + // receive + SystemNetworkDirectionReceive = SystemNetworkDirectionKey.String("receive") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process metric attributes +const ( + // SystemProcessesStatusKey is the attribute Key conforming to the + // "system.processes.status" semantic conventions. It represents the + // process state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessesStatusKey = attribute.Key("system.processes.status") +) + +var ( + // running + SystemProcessesStatusRunning = SystemProcessesStatusKey.String("running") + // sleeping + SystemProcessesStatusSleeping = SystemProcessesStatusKey.String("sleeping") + // stopped + SystemProcessesStatusStopped = SystemProcessesStatusKey.String("stopped") + // defunct + SystemProcessesStatusDefunct = SystemProcessesStatusKey.String("defunct") +) + +// Describes deprecated HTTP attributes. +const ( + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + // Deprecated: use `http.request.method` instead. + HTTPMethodKey = attribute.Key("http.method") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.request.header.content-length` instead. + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.response.header.content-length` instead. + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + // Deprecated: use `url.scheme` instead. + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + // Deprecated: use `http.response.status_code` instead. + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.path` and `url.query` instead. + HTTPTargetKey = attribute.Key("http.target") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.full` instead. + HTTPURLKey = attribute.Key("http.url") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. +// +// Deprecated: use `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. +// +// Deprecated: use `http.request.header.content-length` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. +// +// Deprecated: use `http.response.header.content-length` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. +// +// Deprecated: use `url.scheme` instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. +// +// Deprecated: use `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. +// +// Deprecated: use `url.path` and `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. +// +// Deprecated: use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address`. + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port`. + NetHostPortKey = attribute.Key("net.host.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address` on client spans and `client.address` on + // server spans. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port` on client spans and `client.port` on + // server spans. + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + // Deprecated: use `network.protocol.name`. + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + // Deprecated: use `network.protocol.version`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: use `network.local.address`. + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `network.local.port`. + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + // Deprecated: use `network.peer.address`. + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: no replacement at this time. + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + // Deprecated: use `network.peer.port`. + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport`. + NetTransportKey = attribute.Key("net.transport") +) + +var ( + // IPv4 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // ip_tcp + // + // Deprecated: use `network.transport`. + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + // + // Deprecated: use `network.transport`. + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + // + // Deprecated: use `network.transport`. + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + // + // Deprecated: use `network.transport`. + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + // + // Deprecated: use `network.transport`. + NetTransportOther = NetTransportKey.String("other") +) + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. +// +// Deprecated: use `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. +// +// Deprecated: use `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. +// +// Deprecated: use `server.address` on client spans and `client.address` on +// server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. +// +// Deprecated: use `server.port` on client spans and `client.port` on server +// spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. +// +// Deprecated: use `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. +// +// Deprecated: use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. +// +// Deprecated: use `network.local.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. +// +// Deprecated: use `network.local.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. +// +// Deprecated: use `network.peer.address`. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. +// +// Deprecated: no replacement at this time. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. +// +// Deprecated: use `network.peer.port`. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the + // ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route, that is, the path + // template in the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes describing telemetry around messaging systems and messaging +// activities. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker doesn't have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the conversation ID identifying the conversation to which the message + // belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents a string + // identifying the messaging system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created + MessagingOperationPublish = MessagingOperationKey.String("publish") + // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios + MessagingOperationCreate = MessagingOperationKey.String("create") + // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages + MessagingOperationReceive = MessagingOperationKey.String("receive") + // One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs + MessagingOperationDeliver = MessagingOperationKey.String("deliver") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the conversation ID identifying the conversation to which the +// message belongs, represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// MessagingSystem returns an attribute KeyValue conforming to the +// "messaging.system" semantic conventions. It represents a string identifying +// the messaging system. +func MessagingSystem(val string) attribute.KeyValue { + return MessagingSystemKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the protocol specified in `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the protocol specified in `network.protocol.name`. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// Attributes for remote procedure calls. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// doesn't specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// Attributes describing URL. +const ( + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it SHOULD be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password SHOULD be redacted and attribute's value SHOULD be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") +) + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent the server address + // behind any intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server domain name +// if available without reverse DNS lookup; otherwise, IP address or Unix +// domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +// When a session reaches end of life, typically due to user inactivity or +// session timeout, a new session identifier will be assigned. The previous +// session identifier may be provided by the instrumentation so that telemetry +// backends can link the two sessions. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries, for example proxies, if it's + // available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} diff --git a/semconv/v1.23.1/doc.go b/semconv/v1.23.1/doc.go new file mode 100644 index 00000000000..86df4c38b63 --- /dev/null +++ b/semconv/v1.23.1/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.23.1 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" diff --git a/semconv/v1.23.1/event.go b/semconv/v1.23.1/event.go new file mode 100644 index 00000000000..ca4be6eea19 --- /dev/null +++ b/semconv/v1.23.1/event.go @@ -0,0 +1,254 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +import "go.opentelemetry.io/otel/attribute" + +// This event represents an occurrence of a lifecycle transition on the iOS +// platform. `event.domain` MUST be `device`. +const ( + // IosStateKey is the attribute Key conforming to the "ios.state" semantic + // conventions. It represents the this attribute represents the state the + // application has transitioned into at the occurrence of the event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The iOS lifecycle states are defined in the [UIApplicationDelegate + // documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + // and from which the `OS terminology` column values are derived. + IosStateKey = attribute.Key("ios.state") +) + +var ( + // The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive` + IosStateActive = IosStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive` + IosStateInactive = IosStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground` + IosStateBackground = IosStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground` + IosStateForeground = IosStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification `applicationWillTerminate` + IosStateTerminate = IosStateKey.String("terminate") +) + +// This event represents an occurrence of a lifecycle transition on the Android +// platform. `event.domain` MUST be `device`. +const ( + // AndroidStateKey is the attribute Key conforming to the "android.state" + // semantic conventions. It represents the this attribute represents the + // state the application has transitioned into at the occurrence of the + // event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The Android lifecycle states are defined in [Activity lifecycle + // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + // and from which the `OS identifiers` are derived. + AndroidStateKey = attribute.Key("android.state") +) + +var ( + // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time + AndroidStateCreated = AndroidStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state + AndroidStateBackground = AndroidStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states + AndroidStateForeground = AndroidStateKey.String("foreground") +) + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessageTypeKey = attribute.Key("message.type") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} + +// The attributes used to report a single exception associated with a span. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example above](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} diff --git a/semconv/v1.23.1/exception.go b/semconv/v1.23.1/exception.go new file mode 100644 index 00000000000..90af73d7fce --- /dev/null +++ b/semconv/v1.23.1/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.23.1/resource.go b/semconv/v1.23.1/resource.go new file mode 100644 index 00000000000..02aa0b8af36 --- /dev/null +++ b/semconv/v1.23.1/resource.go @@ -0,0 +1,2588 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS). +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on +// Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assinged by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) +// (aka deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// The device on which the process represented by this resource is running. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human readable version of + // the device model rather than a machine readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// A serverless instance. +const ( + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal + // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): + // as hyphen-separated octets in uppercase hexadecimal form from most to + // least significant. + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" +// semantic conventions. It represents the available MAC addresses of the host, +// excluding loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// A host's CPU information +const ( + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the numeric value + // specifying the family or generation of the CPU. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 6 + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the numeric value +// specifying the family or generation of the CPU. +func HostCPUFamily(val int) attribute.KeyValue { + return HostCPUFamilyKey.Int(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val int) attribute.KeyValue { + return HostCPUModelIDKey.Int(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val int) attribute.KeyValue { + return HostCPUSteppingKey.Int(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// A Kubernetes Cluster. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S doesn't have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// A Kubernetes Node object. +const ( + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") +) + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// A Kubernetes Namespace. +const ( + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") +) + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// A Kubernetes Pod object. +const ( + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") +) + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// A container in a +// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). +const ( + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") +) + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// A Kubernetes ReplicaSet object. +const ( + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") +) + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// A Kubernetes Deployment object. +const ( + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") +) + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// A Kubernetes StatefulSet object. +const ( + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// A Kubernetes DaemonSet object. +const ( + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") +) + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// A Kubernetes Job object. +const ( + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") +) + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// A Kubernetes CronJob object. +const ( + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") +) + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: ConditionallyRequired (See alternative attributes + // below.) + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// The single (language) runtime instance which is monitored. +const ( + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") +) + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + // Deprecated: use the `otel.scope.name` attribute. + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + // Deprecated: use the `otel.scope.version` attribute. + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. +// +// Deprecated: use the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. +// +// Deprecated: use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.23.1/schema.go b/semconv/v1.23.1/schema.go new file mode 100644 index 00000000000..68cce768edf --- /dev/null +++ b/semconv/v1.23.1/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.23.1" diff --git a/semconv/v1.23.1/trace.go b/semconv/v1.23.1/trace.go new file mode 100644 index 00000000000..87fbde9e975 --- /dev/null +++ b/semconv/v1.23.1/trace.go @@ -0,0 +1,2079 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.23.1" + +import "go.opentelemetry.io/otel/attribute" + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// The attributes used to perform database client calls. +const ( + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: ConditionallyRequired (If applicable.) + // Stability: experimental + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: ConditionallyRequired (If `db.statement` is not + // applicable.) + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Recommended (Should be collected by default only if + // there is sanitization that excludes sensitive information.) + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + DBSystemKey = attribute.Key("db.system") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// Connection-level attributes for Microsoft SQL Server +const ( + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") +) + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// Call-level attributes for Cassandra +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary table that the operation is acting upon, including the keyspace + // name (if applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary table that the operation is acting upon, including the keyspace name +// (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// Call-level attributes for Redis +const ( + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: ConditionallyRequired (If other than the default + // database (`0`).) + // Stability: experimental + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") +) + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// Call-level attributes for MongoDB +const ( + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") +) + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the collection +// being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// Call-level attributes for Elasticsearch +const ( + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the "X-Found-Handling-Cluster" + // HTTP response header.) + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Recommended (When communicating with an Elastic Cloud + // deployment, this should be collected from the + // "X-Found-Handling-Instance" HTTP response header.) + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") +) + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// Call-level attributes for SQL databases +const ( + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") +) + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// Call-level attributes for Cosmos DB. +const ( + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as + // default)) + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if available) + // Stability: experimental + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: ConditionallyRequired (when performing one of the + // operations in this list) + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: ConditionallyRequired (when available) + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (if response was received) + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: ConditionallyRequired (when response was received and + // contained sub-code.) + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") +) + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") +) + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} From 057f897096639f1ebbd8975497114c55bd73b236 Mon Sep 17 00:00:00 2001 From: Cristian Velazquez Date: Thu, 14 Dec 2023 07:48:28 -0800 Subject: [PATCH 787/886] baggage: Improve performance (#4743) --- CHANGELOG.md | 1 + baggage/baggage.go | 172 ++++++++++++++++++++++++++++++++-------- baggage/baggage_test.go | 15 ++-- 3 files changed, 152 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec88f882c5..a2376a26e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) +- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) ## [1.21.0/0.44.0] 2023-11-16 diff --git a/baggage/baggage.go b/baggage/baggage.go index 84532cb1da3..c1f06fab18c 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -18,7 +18,6 @@ import ( "errors" "fmt" "net/url" - "regexp" "strings" "go.opentelemetry.io/otel/internal/baggage" @@ -32,16 +31,6 @@ const ( listDelimiter = "," keyValueDelimiter = "=" propertyDelimiter = ";" - - keyDef = `([\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5a\x5e-\x7a\x7c\x7e]+)` - valueDef = `([\x21\x23-\x2b\x2d-\x3a\x3c-\x5B\x5D-\x7e]*)` - keyValueDef = `\s*` + keyDef + `\s*` + keyValueDelimiter + `\s*` + valueDef + `\s*` -) - -var ( - keyRe = regexp.MustCompile(`^` + keyDef + `$`) - valueRe = regexp.MustCompile(`^` + valueDef + `$`) - propertyRe = regexp.MustCompile(`^(?:\s*` + keyDef + `\s*|` + keyValueDef + `)$`) ) var ( @@ -67,7 +56,7 @@ type Property struct { // // If key is invalid, an error will be returned. func NewKeyProperty(key string) (Property, error) { - if !keyRe.MatchString(key) { + if !validateKey(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } @@ -79,10 +68,10 @@ func NewKeyProperty(key string) (Property, error) { // // If key or value are invalid, an error will be returned. func NewKeyValueProperty(key, value string) (Property, error) { - if !keyRe.MatchString(key) { + if !validateKey(key) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) } - if !valueRe.MatchString(value) { + if !validateValue(value) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) } @@ -106,20 +95,11 @@ func parseProperty(property string) (Property, error) { return newInvalidProperty(), nil } - match := propertyRe.FindStringSubmatch(property) - if len(match) != 4 { + p, ok := parsePropertyInternal(property) + if !ok { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property) } - var p Property - if match[1] != "" { - p.key = match[1] - } else { - p.key = match[2] - p.value = match[3] - p.hasValue = true - } - return p, nil } @@ -130,10 +110,10 @@ func (p Property) validate() error { return fmt.Errorf("invalid property: %w", err) } - if !keyRe.MatchString(p.key) { + if !validateKey(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } - if p.hasValue && !valueRe.MatchString(p.value) { + if p.hasValue && !validateValue(p.value) { return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value)) } if !p.hasValue && p.value != "" { @@ -305,10 +285,10 @@ func parseMember(member string) (Member, error) { if err != nil { return newInvalidMember(), fmt.Errorf("%w: %q", err, value) } - if !keyRe.MatchString(key) { + if !validateKey(key) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) } - if !valueRe.MatchString(value) { + if !validateValue(value) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) } @@ -323,10 +303,10 @@ func (m Member) validate() error { return fmt.Errorf("%w: %q", errInvalidMember, m) } - if !keyRe.MatchString(m.key) { + if !validateKey(m.key) { return fmt.Errorf("%w: %q", errInvalidKey, m.key) } - if !valueRe.MatchString(m.value) { + if !validateValue(m.value) { return fmt.Errorf("%w: %q", errInvalidValue, m.value) } return m.properties.validate() @@ -550,3 +530,133 @@ func (b Baggage) String() string { } return strings.Join(members, listDelimiter) } + +// parsePropertyInternal attempts to decode a Property from the passed string. +// It follows the spec at https://www.w3.org/TR/baggage/#definition. +func parsePropertyInternal(s string) (p Property, ok bool) { + // For the entire function we will use " key = value " as an example. + // Attempting to parse the key. + // First skip spaces at the beginning "< >key = value " (they could be empty). + index := skipSpace(s, 0) + + // Parse the key: " = value ". + keyStart := index + keyEnd := index + for _, c := range s[keyStart:] { + if !validateKeyChar(c) { + break + } + keyEnd++ + } + + // If we couldn't find any valid key character, + // it means the key is either empty or invalid. + if keyStart == keyEnd { + return + } + + // Skip spaces after the key: " key< >= value ". + index = skipSpace(s, keyEnd) + + if index == len(s) { + // A key can have no value, like: " key ". + ok = true + p.key = s[keyStart:keyEnd] + return + } + + // If we have not reached the end and we can't find the '=' delimiter, + // it means the property is invalid. + if s[index] != keyValueDelimiter[0] { + return + } + + // Attempting to parse the value. + // Match: " key =< >value ". + index = skipSpace(s, index+1) + + // Match the value string: " key = ". + // A valid property can be: " key =". + // Therefore, we don't have to check if the value is empty. + valueStart := index + valueEnd := index + for _, c := range s[valueStart:] { + if !validateValueChar(c) { + break + } + valueEnd++ + } + + // Skip all trailing whitespaces: " key = value< >". + index = skipSpace(s, valueEnd) + + // If after looking for the value and skipping whitespaces + // we have not reached the end, it means the property is + // invalid, something like: " key = value value1". + if index != len(s) { + return + } + + ok = true + p.key = s[keyStart:keyEnd] + p.hasValue = true + p.value = s[valueStart:valueEnd] + return +} + +func skipSpace(s string, offset int) int { + i := offset + for ; i < len(s); i++ { + c := s[i] + if c != ' ' && c != '\t' { + break + } + } + return i +} + +func validateKey(s string) bool { + if len(s) == 0 { + return false + } + + for _, c := range s { + if !validateKeyChar(c) { + return false + } + } + + return true +} + +func validateKeyChar(c int32) bool { + return (c >= 0x23 && c <= 0x27) || + (c >= 0x30 && c <= 0x39) || + (c >= 0x41 && c <= 0x5a) || + (c >= 0x5e && c <= 0x7a) || + c == 0x21 || + c == 0x2a || + c == 0x2b || + c == 0x2d || + c == 0x2e || + c == 0x7c || + c == 0x7e +} + +func validateValue(s string) bool { + for _, c := range s { + if !validateValueChar(c) { + return false + } + } + + return true +} + +func validateValueChar(c int32) bool { + return (c >= 0x23 && c <= 0x2b) || + (c >= 0x2d && c <= 0x3a) || + (c >= 0x3c && c <= 0x5b) || + (c >= 0x5d && c <= 0x7e) || + c == 0x21 +} diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 4bac6707ea0..04395efbca8 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -33,7 +33,7 @@ func init() { rng = rand.New(rand.NewSource(1)) } -func TestKeyRegExp(t *testing.T) { +func TestValidateKeyChar(t *testing.T) { // ASCII only invalidKeyRune := []rune{ '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', @@ -45,11 +45,11 @@ func TestKeyRegExp(t *testing.T) { } for _, ch := range invalidKeyRune { - assert.NotRegexp(t, keyDef, fmt.Sprintf("%c", ch)) + assert.False(t, validateKeyChar(ch)) } } -func TestValueRegExp(t *testing.T) { +func TestValidateValueChar(t *testing.T) { // ASCII only invalidValueRune := []rune{ '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', @@ -60,7 +60,7 @@ func TestValueRegExp(t *testing.T) { } for _, ch := range invalidValueRune { - assert.NotRegexp(t, `^`+valueDef+`$`, fmt.Sprintf("invalid-%c-value", ch)) + assert.False(t, validateValueChar(ch)) } } @@ -415,10 +415,15 @@ func TestBaggageParse(t *testing.T) { err: errInvalidValue, }, { - name: "invalid property: invalid key", + name: "invalid property: no key", in: "foo=1;=v", err: errInvalidProperty, }, + { + name: "invalid property: invalid key", + in: "foo=1;key\\=v", + err: errInvalidProperty, + }, { name: "invalid property: invalid value", in: "foo=1;key=\\", From 8e756513a630cc0e80c8b65528f27161a87a3cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 15 Dec 2023 19:14:16 +0100 Subject: [PATCH 788/886] sdk/metric: Record measurements when context is done (#4671) --- CHANGELOG.md | 2 ++ CONTRIBUTING.md | 20 ++++++++++++++++++++ sdk/metric/instrument.go | 6 ------ sdk/metric/meter_test.go | 16 ++++++++++------ sdk/trace/trace_test.go | 12 ++++++++++++ 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2376a26e50..3c0afb9c957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. + If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 850606ae692..868fdf62c5f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -591,6 +591,26 @@ this. [^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548 +### Ignoring context cancellation + +OpenTelemetry API implementations need to ignore the cancellation of the context that are +passed when recording a value (e.g. starting a span, recording a measurement, emitting a log). +Recording methods should not return an error describing the cancellation state of the context +when they complete, nor should they abort any work. + +This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for +the method. In that case the context cancellation can be used for the timeout with the +restriction that this behavior is documented for the method. Otherwise, timeouts +are expected to be handled by the user calling the API, not the implementation. + +Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method +of a provider. It is assumed the context passed from a user is not used for this purpose. + +Outside of the direct recording of telemetry from the API (e.g. exporting telemetry, +force flushing telemetry, shutting down a signal provider) the context cancellation +should be honored. This means all work done on behalf of the user provided context +should be canceled. + ## Approvers and Maintainers ### Approvers diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index 30373038f5e..d549dc17a20 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -205,9 +205,6 @@ func (i *int64Inst) Record(ctx context.Context, val int64, opts ...metric.Record } func (i *int64Inst) aggregate(ctx context.Context, val int64, s attribute.Set) { // nolint:revive // okay to shadow pkg with method. - if err := ctx.Err(); err != nil { - return - } for _, in := range i.measures { in(ctx, val, s) } @@ -238,9 +235,6 @@ func (i *float64Inst) Record(ctx context.Context, val float64, opts ...metric.Re } func (i *float64Inst) aggregate(ctx context.Context, val float64, s attribute.Set) { - if err := ctx.Err(); err != nil { - return - } for _, in := range i.measures { in(ctx, val, s) } diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index c661a06dabb..adf3cd251e2 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -168,6 +168,10 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { + // The synchronous measurement methods must ignore the context cancelation. + ctx, cancel := context.WithCancel(context.Background()) + cancel() + attrs := attribute.NewSet(attribute.String("name", "alice")) opt := metric.WithAttributeSet(attrs) testCases := []struct { @@ -340,7 +344,7 @@ func TestMeterCreatesInstruments(t *testing.T) { ctr, err := m.Int64Counter("sint") assert.NoError(t, err) - ctr.Add(context.Background(), 3) + ctr.Add(ctx, 3) }, want: metricdata.Metrics{ Name: "sint", @@ -359,7 +363,7 @@ func TestMeterCreatesInstruments(t *testing.T) { ctr, err := m.Int64UpDownCounter("sint") assert.NoError(t, err) - ctr.Add(context.Background(), 11) + ctr.Add(ctx, 11) }, want: metricdata.Metrics{ Name: "sint", @@ -378,7 +382,7 @@ func TestMeterCreatesInstruments(t *testing.T) { gauge, err := m.Int64Histogram("histogram") assert.NoError(t, err) - gauge.Record(context.Background(), 7) + gauge.Record(ctx, 7) }, want: metricdata.Metrics{ Name: "histogram", @@ -404,7 +408,7 @@ func TestMeterCreatesInstruments(t *testing.T) { ctr, err := m.Float64Counter("sfloat") assert.NoError(t, err) - ctr.Add(context.Background(), 3) + ctr.Add(ctx, 3) }, want: metricdata.Metrics{ Name: "sfloat", @@ -423,7 +427,7 @@ func TestMeterCreatesInstruments(t *testing.T) { ctr, err := m.Float64UpDownCounter("sfloat") assert.NoError(t, err) - ctr.Add(context.Background(), 11) + ctr.Add(ctx, 11) }, want: metricdata.Metrics{ Name: "sfloat", @@ -442,7 +446,7 @@ func TestMeterCreatesInstruments(t *testing.T) { gauge, err := m.Float64Histogram("histogram") assert.NoError(t, err) - gauge.Record(context.Background(), 7) + gauge.Record(ctx, 7) }, want: metricdata.Metrics{ Name: "histogram", diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 5ad35314192..469eb12ecba 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1133,6 +1133,18 @@ func TestNilSpanEnd(t *testing.T) { span.End() } +func TestSpanWithCanceledContext(t *testing.T) { + te := NewTestExporter() + tp := NewTracerProvider(WithSyncer(te)) + + ctx, cancel := context.WithCancel(context.Background()) + cancel() + _, span := tp.Tracer(t.Name()).Start(ctx, "span") + span.End() + + assert.Equal(t, 1, te.Len(), "span recording must ignore context cancelation") +} + func TestNonRecordingSpanDoesNotTrackRuntimeTracerTask(t *testing.T) { tp := NewTracerProvider(WithSampler(NeverSample())) tr := tp.Tracer("TestNonRecordingSpanDoesNotTrackRuntimeTracerTask") From 7df13f3435ef074c3decea850fb539e0987de4ee Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 17 Dec 2023 16:25:45 +0100 Subject: [PATCH 789/886] dependabot updates Sun Dec 17 15:19:05 UTC 2023 (#4768) Bump golang.org/x/tools from 0.16.0 to 0.16.1 in /internal/tools Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /example/otel-collector Bump actions/upload-artifact from 3 to 4 Bump github/codeql-action from 2 to 3 Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.59.0 to 1.60.0 in /bridge/opentracing/test --- bridge/opentracing/test/go.mod | 4 ++-- bridge/opentracing/test/go.sum | 8 ++++---- example/otel-collector/go.mod | 6 +++--- example/otel-collector/go.sum | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 14 +++++++------- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 14 +++++++------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 14 +++++++------- exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/go.sum | 14 +++++++------- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 14 files changed, 59 insertions(+), 59 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index b694aacb1ba..6384b209ead 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/bridge/opentracing v1.21.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.60.0 ) require ( @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 867315ee275..534907d2786 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -51,11 +51,11 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 160f549e5c4..d790d59ef1c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.60.0 ) require ( @@ -27,8 +27,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index b4b0ab6d9a6..fccb03a9665 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -26,13 +26,13 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 5dd47288af3..ff7920b273e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -12,8 +12,8 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d - google.golang.org/grpc v1.59.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 ) @@ -31,7 +31,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index b3410b5f2ff..a11b281c8ba 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -35,13 +35,13 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 812e7a78fde..9fddb96df06 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 ) @@ -30,8 +30,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index b3410b5f2ff..a11b281c8ba 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -35,13 +35,13 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 1b87fd3e494..db41d5f91f6 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -11,8 +11,8 @@ require ( go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d - google.golang.org/grpc v1.59.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 ) @@ -28,7 +28,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 9d581c2ed07..53050a619e5 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -35,13 +35,13 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 0c0be7bc70f..207fe2b48fb 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.31.0 ) @@ -26,8 +26,8 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 33ae39b89cd..f4393d79919 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -33,13 +33,13 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= +google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= +google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b4f6570cb96..5b83a004e39 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.16.0 + golang.org/x/tools v0.16.1 golang.org/x/vuln v1.0.1 ) diff --git a/internal/tools/go.sum b/internal/tools/go.sum index d04b80dbd2f..296f2ade66d 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -942,8 +942,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= -golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 528ab1244e4699a6b8dfbc3e4303445d47477261 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Dec 2023 08:20:44 -0800 Subject: [PATCH 790/886] Bump github/codeql-action from 2 to 3 (#4762) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 67ad856d2cf..4402a359965 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -27,13 +27,13 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: go - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 From 42679742006b917dfc0ef15e9e5e117a8037821c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Dec 2023 08:36:18 -0800 Subject: [PATCH 791/886] Bump actions/upload-artifact from 3 to 4 (#4763) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d98db43101..02acf4e0475 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,7 @@ jobs: fail_ci_if_error: true verbose: true - name: Store coverage test output - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: opentelemetry-go-test-output path: ${{ env.TEST_RESULTS }} From 15f0ab964c4c21d3f2004db7f8642a1aa8597ffd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 04:13:58 +0100 Subject: [PATCH 792/886] Bump golang.org/x/crypto from 0.16.0 to 0.17.0 in /internal/tools (#4771) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0. - [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 5b83a004e39..1126b1eb33e 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -203,7 +203,7 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.16.0 // indirect + golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 296f2ade66d..210333c8dd0 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -664,8 +664,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= From 43bd47de6eff944f7f3bdc7d0b768502b9329d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 19 Dec 2023 14:38:58 +0100 Subject: [PATCH 793/886] baggage: Fix Parse to validate member value before percent-decoding (#4755) --- CHANGELOG.md | 4 +++ baggage/baggage.go | 24 ++++++++--------- baggage/baggage_test.go | 9 +++++-- propagation/baggage_test.go | 51 ++++++++++++++++++++++++++++++++++++- 4 files changed, 71 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c0afb9c957..d566dbf251a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +### Fixed + +- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) + ## [1.21.0/0.44.0] 2023-11-16 ### Removed diff --git a/baggage/baggage.go b/baggage/baggage.go index c1f06fab18c..12b9ca6f39c 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -254,11 +254,7 @@ func parseMember(member string) (Member, error) { return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n) } - var ( - key, value string - props properties - ) - + var props properties keyValue, properties, found := strings.Cut(member, propertyDelimiter) if found { // Parse the member properties. @@ -279,19 +275,19 @@ func parseMember(member string) (Member, error) { } // "Leading and trailing whitespaces are allowed but MUST be trimmed // when converting the header into a data structure." - key = strings.TrimSpace(k) - var err error - value, err = url.PathUnescape(strings.TrimSpace(v)) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", err, value) - } + key := strings.TrimSpace(k) if !validateKey(key) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key) } - if !validateValue(value) { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } + val := strings.TrimSpace(v) + if !validateValue(val) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) + } + value, err := url.PathUnescape(val) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %v", errInvalidValue, err) + } return Member{key: key, value: value, properties: props, hasData: true}, nil } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 04395efbca8..82c06949945 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -384,9 +384,9 @@ func TestBaggageParse(t *testing.T) { }, { name: "url encoded value", - in: "key1=val%252", + in: "key1=val%252%2C", want: baggage.List{ - "key1": {Value: "val%2"}, + "key1": {Value: "val%2,"}, }, }, { @@ -414,6 +414,11 @@ func TestBaggageParse(t *testing.T) { in: "foo=\\", err: errInvalidValue, }, + { + name: "invalid member: improper url encoded value", + in: "key1=val%", + err: errInvalidValue, + }, { name: "invalid property: no key", in: "foo=1;=v", diff --git a/propagation/baggage_test.go b/propagation/baggage_test.go index 359b899f7e4..a29e412b9d6 100644 --- a/propagation/baggage_test.go +++ b/propagation/baggage_test.go @@ -47,7 +47,7 @@ func (m member) Member(t *testing.T) baggage.Member { } props = append(props, p) } - bMember, err := baggage.NewMember(m.Key, url.QueryEscape(m.Value), props...) + bMember, err := baggage.NewMember(m.Key, url.PathEscape(m.Value), props...) if err != nil { t.Fatal(err) } @@ -248,6 +248,55 @@ func TestInjectBaggageToHTTPReq(t *testing.T) { } } +func TestBaggageInjectExtractRoundtrip(t *testing.T) { + propagator := propagation.Baggage{} + tests := []struct { + name string + mems members + }{ + { + name: "two simple values", + mems: members{ + {Key: "key1", Value: "val1"}, + {Key: "key2", Value: "val2"}, + }, + }, + { + name: "values with escaped chars", + mems: members{ + {Key: "key1", Value: "val3=4"}, + {Key: "key2", Value: "mess,me%up"}, + }, + }, + { + name: "with properties", + mems: members{ + {Key: "key1", Value: "val1"}, + { + Key: "key2", + Value: "val2", + Properties: []property{ + {Key: "prop", Value: "1"}, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b := tt.mems.Baggage(t) + req, _ := http.NewRequest("GET", "http://example.com", nil) + ctx := baggage.ContextWithBaggage(context.Background(), b) + propagator.Inject(ctx, propagation.HeaderCarrier(req.Header)) + + ctx = propagator.Extract(context.Background(), propagation.HeaderCarrier(req.Header)) + got := baggage.FromContext(ctx) + + assert.Equal(t, b, got) + }) + } +} + func TestBaggagePropagatorGetAllKeys(t *testing.T) { var propagator propagation.Baggage want := []string{"baggage"} From cb8cb2d2697d6932a6e56f5821da12c1aa62c371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 19 Dec 2023 14:44:32 +0100 Subject: [PATCH 794/886] Add semconv v1.24.0 (#4770) --- CHANGELOG.md | 2 + semconv/v1.24.0/attribute_group.go | 4398 ++++++++++++++++++++++++++++ semconv/v1.24.0/doc.go | 20 + semconv/v1.24.0/event.go | 211 ++ semconv/v1.24.0/exception.go | 20 + semconv/v1.24.0/resource.go | 2556 ++++++++++++++++ semconv/v1.24.0/schema.go | 20 + semconv/v1.24.0/trace.go | 1334 +++++++++ 8 files changed, 8561 insertions(+) create mode 100644 semconv/v1.24.0/attribute_group.go create mode 100644 semconv/v1.24.0/doc.go create mode 100644 semconv/v1.24.0/event.go create mode 100644 semconv/v1.24.0/exception.go create mode 100644 semconv/v1.24.0/resource.go create mode 100644 semconv/v1.24.0/schema.go create mode 100644 semconv/v1.24.0/trace.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d566dbf251a..8635a86f746 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746) - The `go.opentelemetry.io/otel/semconv/v1.23.1` package. The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749) +- The `go.opentelemetry.io/otel/semconv/v1.24.0` package. + The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) ### Changed diff --git a/semconv/v1.24.0/attribute_group.go b/semconv/v1.24.0/attribute_group.go new file mode 100644 index 00000000000..31726598d61 --- /dev/null +++ b/semconv/v1.24.0/attribute_group.go @@ -0,0 +1,4398 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// Describes FaaS attributes. +const ( + // FaaSInvokedNameKey is the attribute Key conforming to the + // "faas.invoked_name" semantic conventions. It represents the name of the + // invoked function. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function' + // Note: SHOULD be equal to the `faas.name` resource attribute of the + // invoked function. + FaaSInvokedNameKey = attribute.Key("faas.invoked_name") + + // FaaSInvokedProviderKey is the attribute Key conforming to the + // "faas.invoked_provider" semantic conventions. It represents the cloud + // provider of the invoked function. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: SHOULD be equal to the `cloud.provider` resource attribute of the + // invoked function. + FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") + + // FaaSInvokedRegionKey is the attribute Key conforming to the + // "faas.invoked_region" semantic conventions. It represents the cloud + // region of the invoked function. + // + // Type: string + // RequirementLevel: ConditionallyRequired (For some cloud providers, like + // AWS or GCP, the region in which a function is hosted is essential to + // uniquely identify the function and also part of its endpoint. Since it's + // part of the endpoint being called, the region is always known to + // clients. In these cases, `faas.invoked_region` MUST be set accordingly. + // If the region is unknown to the client or not required for identifying + // the invoked function, setting `faas.invoked_region` is optional.) + // Stability: experimental + // Examples: 'eu-central-1' + // Note: SHOULD be equal to the `cloud.region` resource attribute of the + // invoked function. + FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") + + // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" + // semantic conventions. It represents the type of the trigger which caused + // this function invocation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + FaaSTriggerKey = attribute.Key("faas.trigger") +) + +var ( + // Alibaba Cloud + FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") + // Amazon Web Services + FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") + // Microsoft Azure + FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") + // Google Cloud Platform + FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") + // Tencent Cloud + FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") +) + +var ( + // A response to some data source operation such as a database or filesystem read/write + FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") + // To provide an answer to an inbound HTTP request + FaaSTriggerHTTP = FaaSTriggerKey.String("http") + // A function is set to be executed when messages are sent to a messaging system + FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") + // A function is scheduled to be executed regularly + FaaSTriggerTimer = FaaSTriggerKey.String("timer") + // If none of the others apply + FaaSTriggerOther = FaaSTriggerKey.String("other") +) + +// FaaSInvokedName returns an attribute KeyValue conforming to the +// "faas.invoked_name" semantic conventions. It represents the name of the +// invoked function. +func FaaSInvokedName(val string) attribute.KeyValue { + return FaaSInvokedNameKey.String(val) +} + +// FaaSInvokedRegion returns an attribute KeyValue conforming to the +// "faas.invoked_region" semantic conventions. It represents the cloud region +// of the invoked function. +func FaaSInvokedRegion(val string) attribute.KeyValue { + return FaaSInvokedRegionKey.String(val) +} + +// Attributes for Events represented using Log Records. +const ( + // EventNameKey is the attribute Key conforming to the "event.name" + // semantic conventions. It represents the identifies the class / type of + // event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'browser.mouse.click', 'device.app.lifecycle' + // Note: Event names are subject to the same rules as [attribute + // names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/common/attribute-naming.md). + // Notably, event names are namespaced to avoid collisions and provide a + // clean separation of semantics for events in separate domains like + // browser, mobile, and kubernetes. + EventNameKey = attribute.Key("event.name") +) + +// EventName returns an attribute KeyValue conforming to the "event.name" +// semantic conventions. It represents the identifies the class / type of +// event. +func EventName(val string) attribute.KeyValue { + return EventNameKey.String(val) +} + +// The attributes described in this section are rather generic. They may be +// used in any Log Record they apply to. +const ( + // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" + // semantic conventions. It represents a unique identifier for the Log + // Record. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' + // Note: If an id is provided, other log records with the same id will be + // considered duplicates and can be removed safely. This means, that two + // distinguishable log records MUST have different values. + // The id MAY be an [Universally Unique Lexicographically Sortable + // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers + // (e.g. UUID) may be used as needed. + LogRecordUIDKey = attribute.Key("log.record.uid") +) + +// LogRecordUID returns an attribute KeyValue conforming to the +// "log.record.uid" semantic conventions. It represents a unique identifier for +// the Log Record. +func LogRecordUID(val string) attribute.KeyValue { + return LogRecordUIDKey.String(val) +} + +// Describes Log attributes +const ( + // LogIostreamKey is the attribute Key conforming to the "log.iostream" + // semantic conventions. It represents the stream associated with the log. + // See below for a list of well-known values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + LogIostreamKey = attribute.Key("log.iostream") +) + +var ( + // Logs from stdout stream + LogIostreamStdout = LogIostreamKey.String("stdout") + // Events from stderr stream + LogIostreamStderr = LogIostreamKey.String("stderr") +) + +// A file to which log was emitted. +const ( + // LogFileNameKey is the attribute Key conforming to the "log.file.name" + // semantic conventions. It represents the basename of the file. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'audit.log' + LogFileNameKey = attribute.Key("log.file.name") + + // LogFileNameResolvedKey is the attribute Key conforming to the + // "log.file.name_resolved" semantic conventions. It represents the + // basename of the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'uuid.log' + LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") + + // LogFilePathKey is the attribute Key conforming to the "log.file.path" + // semantic conventions. It represents the full path to the file. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/log/mysql/audit.log' + LogFilePathKey = attribute.Key("log.file.path") + + // LogFilePathResolvedKey is the attribute Key conforming to the + // "log.file.path_resolved" semantic conventions. It represents the full + // path to the file, with symlinks resolved. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/var/lib/docker/uuid.log' + LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") +) + +// LogFileName returns an attribute KeyValue conforming to the +// "log.file.name" semantic conventions. It represents the basename of the +// file. +func LogFileName(val string) attribute.KeyValue { + return LogFileNameKey.String(val) +} + +// LogFileNameResolved returns an attribute KeyValue conforming to the +// "log.file.name_resolved" semantic conventions. It represents the basename of +// the file, with symlinks resolved. +func LogFileNameResolved(val string) attribute.KeyValue { + return LogFileNameResolvedKey.String(val) +} + +// LogFilePath returns an attribute KeyValue conforming to the +// "log.file.path" semantic conventions. It represents the full path to the +// file. +func LogFilePath(val string) attribute.KeyValue { + return LogFilePathKey.String(val) +} + +// LogFilePathResolved returns an attribute KeyValue conforming to the +// "log.file.path_resolved" semantic conventions. It represents the full path +// to the file, with symlinks resolved. +func LogFilePathResolved(val string) attribute.KeyValue { + return LogFilePathResolvedKey.String(val) +} + +// Describes Database attributes +const ( + // PoolNameKey is the attribute Key conforming to the "pool.name" semantic + // conventions. It represents the name of the connection pool; unique + // within the instrumented application. In case the connection pool + // implementation doesn't provide a name, then the + // [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) + // should be used + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myDataSource' + PoolNameKey = attribute.Key("pool.name") + + // StateKey is the attribute Key conforming to the "state" semantic + // conventions. It represents the state of a connection in the pool + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'idle' + StateKey = attribute.Key("state") +) + +var ( + // idle + StateIdle = StateKey.String("idle") + // used + StateUsed = StateKey.String("used") +) + +// PoolName returns an attribute KeyValue conforming to the "pool.name" +// semantic conventions. It represents the name of the connection pool; unique +// within the instrumented application. In case the connection pool +// implementation doesn't provide a name, then the +// [db.connection_string](/docs/database/database-spans.md#connection-level-attributes) +// should be used +func PoolName(val string) attribute.KeyValue { + return PoolNameKey.String(val) +} + +// ASP.NET Core attributes +const ( + // AspnetcoreDiagnosticsHandlerTypeKey is the attribute Key conforming to + // the "aspnetcore.diagnostics.handler.type" semantic conventions. It + // represents the full type name of the + // [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) + // implementation that handled the exception. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if and only if the exception + // was handled by this handler.) + // Stability: experimental + // Examples: 'Contoso.MyHandler' + AspnetcoreDiagnosticsHandlerTypeKey = attribute.Key("aspnetcore.diagnostics.handler.type") + + // AspnetcoreRateLimitingPolicyKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.policy" semantic conventions. It represents + // the rate limiting policy name. + // + // Type: string + // RequirementLevel: ConditionallyRequired (if the matched endpoint for the + // request had a rate-limiting policy.) + // Stability: experimental + // Examples: 'fixed', 'sliding', 'token' + AspnetcoreRateLimitingPolicyKey = attribute.Key("aspnetcore.rate_limiting.policy") + + // AspnetcoreRateLimitingResultKey is the attribute Key conforming to the + // "aspnetcore.rate_limiting.result" semantic conventions. It represents + // the rate-limiting result, shows whether the lease was acquired or + // contains a rejection reason + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Examples: 'acquired', 'request_canceled' + AspnetcoreRateLimitingResultKey = attribute.Key("aspnetcore.rate_limiting.result") + + // AspnetcoreRequestIsUnhandledKey is the attribute Key conforming to the + // "aspnetcore.request.is_unhandled" semantic conventions. It represents + // the flag indicating if request was handled by the application pipeline. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (if and only if the request was + // not handled.) + // Stability: experimental + // Examples: True + AspnetcoreRequestIsUnhandledKey = attribute.Key("aspnetcore.request.is_unhandled") + + // AspnetcoreRoutingIsFallbackKey is the attribute Key conforming to the + // "aspnetcore.routing.is_fallback" semantic conventions. It represents a + // value that indicates whether the matched route is a fallback route. + // + // Type: boolean + // RequirementLevel: ConditionallyRequired (If and only if a route was + // successfully matched.) + // Stability: experimental + // Examples: True + AspnetcoreRoutingIsFallbackKey = attribute.Key("aspnetcore.routing.is_fallback") +) + +var ( + // Lease was acquired + AspnetcoreRateLimitingResultAcquired = AspnetcoreRateLimitingResultKey.String("acquired") + // Lease request was rejected by the endpoint limiter + AspnetcoreRateLimitingResultEndpointLimiter = AspnetcoreRateLimitingResultKey.String("endpoint_limiter") + // Lease request was rejected by the global limiter + AspnetcoreRateLimitingResultGlobalLimiter = AspnetcoreRateLimitingResultKey.String("global_limiter") + // Lease request was canceled + AspnetcoreRateLimitingResultRequestCanceled = AspnetcoreRateLimitingResultKey.String("request_canceled") +) + +// AspnetcoreDiagnosticsHandlerType returns an attribute KeyValue conforming +// to the "aspnetcore.diagnostics.handler.type" semantic conventions. It +// represents the full type name of the +// [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) +// implementation that handled the exception. +func AspnetcoreDiagnosticsHandlerType(val string) attribute.KeyValue { + return AspnetcoreDiagnosticsHandlerTypeKey.String(val) +} + +// AspnetcoreRateLimitingPolicy returns an attribute KeyValue conforming to +// the "aspnetcore.rate_limiting.policy" semantic conventions. It represents +// the rate limiting policy name. +func AspnetcoreRateLimitingPolicy(val string) attribute.KeyValue { + return AspnetcoreRateLimitingPolicyKey.String(val) +} + +// AspnetcoreRequestIsUnhandled returns an attribute KeyValue conforming to +// the "aspnetcore.request.is_unhandled" semantic conventions. It represents +// the flag indicating if request was handled by the application pipeline. +func AspnetcoreRequestIsUnhandled(val bool) attribute.KeyValue { + return AspnetcoreRequestIsUnhandledKey.Bool(val) +} + +// AspnetcoreRoutingIsFallback returns an attribute KeyValue conforming to +// the "aspnetcore.routing.is_fallback" semantic conventions. It represents a +// value that indicates whether the matched route is a fallback route. +func AspnetcoreRoutingIsFallback(val bool) attribute.KeyValue { + return AspnetcoreRoutingIsFallbackKey.Bool(val) +} + +// SignalR attributes +const ( + // SignalrConnectionStatusKey is the attribute Key conforming to the + // "signalr.connection.status" semantic conventions. It represents the + // signalR HTTP connection closure status. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'app_shutdown', 'timeout' + SignalrConnectionStatusKey = attribute.Key("signalr.connection.status") + + // SignalrTransportKey is the attribute Key conforming to the + // "signalr.transport" semantic conventions. It represents the [SignalR + // transport + // type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'web_sockets', 'long_polling' + SignalrTransportKey = attribute.Key("signalr.transport") +) + +var ( + // The connection was closed normally + SignalrConnectionStatusNormalClosure = SignalrConnectionStatusKey.String("normal_closure") + // The connection was closed due to a timeout + SignalrConnectionStatusTimeout = SignalrConnectionStatusKey.String("timeout") + // The connection was closed because the app is shutting down + SignalrConnectionStatusAppShutdown = SignalrConnectionStatusKey.String("app_shutdown") +) + +var ( + // ServerSentEvents protocol + SignalrTransportServerSentEvents = SignalrTransportKey.String("server_sent_events") + // LongPolling protocol + SignalrTransportLongPolling = SignalrTransportKey.String("long_polling") + // WebSockets protocol + SignalrTransportWebSockets = SignalrTransportKey.String("web_sockets") +) + +// Describes JVM buffer metric attributes. +const ( + // JvmBufferPoolNameKey is the attribute Key conforming to the + // "jvm.buffer.pool.name" semantic conventions. It represents the name of + // the buffer pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'mapped', 'direct' + // Note: Pool names are generally obtained via + // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). + JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") +) + +// JvmBufferPoolName returns an attribute KeyValue conforming to the +// "jvm.buffer.pool.name" semantic conventions. It represents the name of the +// buffer pool. +func JvmBufferPoolName(val string) attribute.KeyValue { + return JvmBufferPoolNameKey.String(val) +} + +// Describes JVM memory metric attributes. +const ( + // JvmMemoryPoolNameKey is the attribute Key conforming to the + // "jvm.memory.pool.name" semantic conventions. It represents the name of + // the memory pool. + // + // Type: string + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' + // Note: Pool names are generally obtained via + // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") + + // JvmMemoryTypeKey is the attribute Key conforming to the + // "jvm.memory.type" semantic conventions. It represents the type of + // memory. + // + // Type: Enum + // RequirementLevel: Recommended + // Stability: stable + // Examples: 'heap', 'non_heap' + JvmMemoryTypeKey = attribute.Key("jvm.memory.type") +) + +var ( + // Heap memory + JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") + // Non-heap memory + JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") +) + +// JvmMemoryPoolName returns an attribute KeyValue conforming to the +// "jvm.memory.pool.name" semantic conventions. It represents the name of the +// memory pool. +func JvmMemoryPoolName(val string) attribute.KeyValue { + return JvmMemoryPoolNameKey.String(val) +} + +// Describes System metric attributes +const ( + // SystemDeviceKey is the attribute Key conforming to the "system.device" + // semantic conventions. It represents the device identifier + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '(identifier)' + SystemDeviceKey = attribute.Key("system.device") +) + +// SystemDevice returns an attribute KeyValue conforming to the +// "system.device" semantic conventions. It represents the device identifier +func SystemDevice(val string) attribute.KeyValue { + return SystemDeviceKey.String(val) +} + +// Describes System CPU metric attributes +const ( + // SystemCPULogicalNumberKey is the attribute Key conforming to the + // "system.cpu.logical_number" semantic conventions. It represents the + // logical CPU number [0..n-1] + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") + + // SystemCPUStateKey is the attribute Key conforming to the + // "system.cpu.state" semantic conventions. It represents the state of the + // CPU + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'idle', 'interrupt' + SystemCPUStateKey = attribute.Key("system.cpu.state") +) + +var ( + // user + SystemCPUStateUser = SystemCPUStateKey.String("user") + // system + SystemCPUStateSystem = SystemCPUStateKey.String("system") + // nice + SystemCPUStateNice = SystemCPUStateKey.String("nice") + // idle + SystemCPUStateIdle = SystemCPUStateKey.String("idle") + // iowait + SystemCPUStateIowait = SystemCPUStateKey.String("iowait") + // interrupt + SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") + // steal + SystemCPUStateSteal = SystemCPUStateKey.String("steal") +) + +// SystemCPULogicalNumber returns an attribute KeyValue conforming to the +// "system.cpu.logical_number" semantic conventions. It represents the logical +// CPU number [0..n-1] +func SystemCPULogicalNumber(val int) attribute.KeyValue { + return SystemCPULogicalNumberKey.Int(val) +} + +// Describes System Memory metric attributes +const ( + // SystemMemoryStateKey is the attribute Key conforming to the + // "system.memory.state" semantic conventions. It represents the memory + // state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free', 'cached' + SystemMemoryStateKey = attribute.Key("system.memory.state") +) + +var ( + // used + SystemMemoryStateUsed = SystemMemoryStateKey.String("used") + // free + SystemMemoryStateFree = SystemMemoryStateKey.String("free") + // shared + SystemMemoryStateShared = SystemMemoryStateKey.String("shared") + // buffers + SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") + // cached + SystemMemoryStateCached = SystemMemoryStateKey.String("cached") +) + +// Describes System Memory Paging metric attributes +const ( + // SystemPagingDirectionKey is the attribute Key conforming to the + // "system.paging.direction" semantic conventions. It represents the paging + // access direction + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'in' + SystemPagingDirectionKey = attribute.Key("system.paging.direction") + + // SystemPagingStateKey is the attribute Key conforming to the + // "system.paging.state" semantic conventions. It represents the memory + // paging state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'free' + SystemPagingStateKey = attribute.Key("system.paging.state") + + // SystemPagingTypeKey is the attribute Key conforming to the + // "system.paging.type" semantic conventions. It represents the memory + // paging type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'minor' + SystemPagingTypeKey = attribute.Key("system.paging.type") +) + +var ( + // in + SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") + // out + SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") +) + +var ( + // used + SystemPagingStateUsed = SystemPagingStateKey.String("used") + // free + SystemPagingStateFree = SystemPagingStateKey.String("free") +) + +var ( + // major + SystemPagingTypeMajor = SystemPagingTypeKey.String("major") + // minor + SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") +) + +// Describes Filesystem metric attributes +const ( + // SystemFilesystemModeKey is the attribute Key conforming to the + // "system.filesystem.mode" semantic conventions. It represents the + // filesystem mode + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'rw, ro' + SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") + + // SystemFilesystemMountpointKey is the attribute Key conforming to the + // "system.filesystem.mountpoint" semantic conventions. It represents the + // filesystem mount path + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/mnt/data' + SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") + + // SystemFilesystemStateKey is the attribute Key conforming to the + // "system.filesystem.state" semantic conventions. It represents the + // filesystem state + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'used' + SystemFilesystemStateKey = attribute.Key("system.filesystem.state") + + // SystemFilesystemTypeKey is the attribute Key conforming to the + // "system.filesystem.type" semantic conventions. It represents the + // filesystem type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ext4' + SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") +) + +var ( + // used + SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") + // free + SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") + // reserved + SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") +) + +var ( + // fat32 + SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") + // exfat + SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") + // ntfs + SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") + // refs + SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") + // hfsplus + SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") + // ext4 + SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") +) + +// SystemFilesystemMode returns an attribute KeyValue conforming to the +// "system.filesystem.mode" semantic conventions. It represents the filesystem +// mode +func SystemFilesystemMode(val string) attribute.KeyValue { + return SystemFilesystemModeKey.String(val) +} + +// SystemFilesystemMountpoint returns an attribute KeyValue conforming to +// the "system.filesystem.mountpoint" semantic conventions. It represents the +// filesystem mount path +func SystemFilesystemMountpoint(val string) attribute.KeyValue { + return SystemFilesystemMountpointKey.String(val) +} + +// Describes Network metric attributes +const ( + // SystemNetworkStateKey is the attribute Key conforming to the + // "system.network.state" semantic conventions. It represents a stateless + // protocol MUST NOT set this attribute + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'close_wait' + SystemNetworkStateKey = attribute.Key("system.network.state") +) + +var ( + // close + SystemNetworkStateClose = SystemNetworkStateKey.String("close") + // close_wait + SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") + // closing + SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") + // delete + SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") + // established + SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") + // fin_wait_1 + SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") + // fin_wait_2 + SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") + // last_ack + SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") + // listen + SystemNetworkStateListen = SystemNetworkStateKey.String("listen") + // syn_recv + SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") + // syn_sent + SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") + // time_wait + SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") +) + +// Describes System Process metric attributes +const ( + // SystemProcessesStatusKey is the attribute Key conforming to the + // "system.processes.status" semantic conventions. It represents the + // process state, e.g., [Linux Process State + // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'running' + SystemProcessesStatusKey = attribute.Key("system.processes.status") +) + +var ( + // running + SystemProcessesStatusRunning = SystemProcessesStatusKey.String("running") + // sleeping + SystemProcessesStatusSleeping = SystemProcessesStatusKey.String("sleeping") + // stopped + SystemProcessesStatusStopped = SystemProcessesStatusKey.String("stopped") + // defunct + SystemProcessesStatusDefunct = SystemProcessesStatusKey.String("defunct") +) + +// These attributes may be used to describe the client in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ClientAddressKey is the attribute Key conforming to the "client.address" + // semantic conventions. It represents the client address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.address` SHOULD represent the client address + // behind any intermediaries, for example proxies, if it's available. + ClientAddressKey = attribute.Key("client.address") + + // ClientPortKey is the attribute Key conforming to the "client.port" + // semantic conventions. It represents the client port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + // Note: When observed from the server side, and when communicating through + // an intermediary, `client.port` SHOULD represent the client port behind + // any intermediaries, for example proxies, if it's available. + ClientPortKey = attribute.Key("client.port") +) + +// ClientAddress returns an attribute KeyValue conforming to the +// "client.address" semantic conventions. It represents the client address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func ClientAddress(val string) attribute.KeyValue { + return ClientAddressKey.String(val) +} + +// ClientPort returns an attribute KeyValue conforming to the "client.port" +// semantic conventions. It represents the client port number. +func ClientPort(val int) attribute.KeyValue { + return ClientPortKey.Int(val) +} + +// The attributes used to describe telemetry in the context of databases. +const ( + // DBCassandraConsistencyLevelKey is the attribute Key conforming to the + // "db.cassandra.consistency_level" semantic conventions. It represents the + // consistency level of the query. Based on consistency values from + // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") + + // DBCassandraCoordinatorDCKey is the attribute Key conforming to the + // "db.cassandra.coordinator.dc" semantic conventions. It represents the + // data center of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-west-2' + DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") + + // DBCassandraCoordinatorIDKey is the attribute Key conforming to the + // "db.cassandra.coordinator.id" semantic conventions. It represents the ID + // of the coordinating node for a query. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' + DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") + + // DBCassandraIdempotenceKey is the attribute Key conforming to the + // "db.cassandra.idempotence" semantic conventions. It represents the + // whether or not the query is idempotent. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") + + // DBCassandraPageSizeKey is the attribute Key conforming to the + // "db.cassandra.page_size" semantic conventions. It represents the fetch + // size used for paging, i.e. how many rows will be returned at once. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 5000 + DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") + + // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming + // to the "db.cassandra.speculative_execution_count" semantic conventions. + // It represents the number of times a query was speculatively executed. + // Not set or `0` if the query was not executed speculatively. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") + + // DBCassandraTableKey is the attribute Key conforming to the + // "db.cassandra.table" semantic conventions. It represents the name of the + // primary Cassandra table that the operation is acting upon, including the + // keyspace name (if applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mytable' + // Note: This mirrors the db.sql.table attribute but references cassandra + // rather than sql. It is not recommended to attempt any client-side + // parsing of `db.statement` just to get this property, but it should be + // set if it is provided by the library being instrumented. If the + // operation is acting upon an anonymous table, or more than one table, + // this value MUST NOT be set. + DBCassandraTableKey = attribute.Key("db.cassandra.table") + + // DBConnectionStringKey is the attribute Key conforming to the + // "db.connection_string" semantic conventions. It represents the + // connection string used to connect to the database. It is recommended to + // remove embedded credentials. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' + DBConnectionStringKey = attribute.Key("db.connection_string") + + // DBCosmosDBClientIDKey is the attribute Key conforming to the + // "db.cosmosdb.client_id" semantic conventions. It represents the unique + // Cosmos client instance id. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' + DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") + + // DBCosmosDBConnectionModeKey is the attribute Key conforming to the + // "db.cosmosdb.connection_mode" semantic conventions. It represents the + // cosmos client connection mode. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") + + // DBCosmosDBContainerKey is the attribute Key conforming to the + // "db.cosmosdb.container" semantic conventions. It represents the cosmos + // DB container name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'anystring' + DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") + + // DBCosmosDBOperationTypeKey is the attribute Key conforming to the + // "db.cosmosdb.operation_type" semantic conventions. It represents the + // cosmosDB Operation Type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") + + // DBCosmosDBRequestChargeKey is the attribute Key conforming to the + // "db.cosmosdb.request_charge" semantic conventions. It represents the rU + // consumed for that operation + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 46.18, 1.0 + DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") + + // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the + // "db.cosmosdb.request_content_length" semantic conventions. It represents + // the request payload size in bytes + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") + + // DBCosmosDBStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos + // DB status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 200, 201 + DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") + + // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the + // "db.cosmosdb.sub_status_code" semantic conventions. It represents the + // cosmos DB sub status code. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1000, 1002 + DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") + + // DBElasticsearchClusterNameKey is the attribute Key conforming to the + // "db.elasticsearch.cluster.name" semantic conventions. It represents the + // represents the identifier of an Elasticsearch cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' + DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") + + // DBElasticsearchNodeNameKey is the attribute Key conforming to the + // "db.elasticsearch.node.name" semantic conventions. It represents the + // represents the human-readable identifier of the node/instance to which a + // request was routed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-0000000001' + DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") + + // DBInstanceIDKey is the attribute Key conforming to the "db.instance.id" + // semantic conventions. It represents an identifier (address, unique name, + // or any other identifier) of the database instance that is executing + // queries or mutations on the current connection. This is useful in cases + // where the database is running in a clustered environment and the + // instrumentation is able to record the node executing the query. The + // client may obtain this value in databases like MySQL using queries like + // `select @@hostname`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mysql-e26b99z.example.com' + DBInstanceIDKey = attribute.Key("db.instance.id") + + // DBJDBCDriverClassnameKey is the attribute Key conforming to the + // "db.jdbc.driver_classname" semantic conventions. It represents the + // fully-qualified class name of the [Java Database Connectivity + // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) + // driver used to connect. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'org.postgresql.Driver', + // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' + DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") + + // DBMongoDBCollectionKey is the attribute Key conforming to the + // "db.mongodb.collection" semantic conventions. It represents the MongoDB + // collection being accessed within the database stated in `db.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'customers', 'products' + DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") + + // DBMSSQLInstanceNameKey is the attribute Key conforming to the + // "db.mssql.instance_name" semantic conventions. It represents the + // Microsoft SQL Server [instance + // name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) + // connecting to. This name is used to determine the port of a named + // instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MSSQLSERVER' + // Note: If setting a `db.mssql.instance_name`, `server.port` is no longer + // required (but still recommended if non-standard). + DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") + + // DBNameKey is the attribute Key conforming to the "db.name" semantic + // conventions. It represents the this attribute is used to report the name + // of the database being accessed. For commands that switch the database, + // this should be set to the target database (even if the command fails). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'customers', 'main' + // Note: In some SQL databases, the database name to be used is called + // "schema name". In case there are multiple layers that could be + // considered for database name (e.g. Oracle instance name and schema + // name), the database name to be used is the more specific layer (e.g. + // Oracle schema name). + DBNameKey = attribute.Key("db.name") + + // DBOperationKey is the attribute Key conforming to the "db.operation" + // semantic conventions. It represents the name of the operation being + // executed, e.g. the [MongoDB command + // name](https://docs.mongodb.com/manual/reference/command/#database-operations) + // such as `findAndModify`, or the SQL keyword. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findAndModify', 'HMSET', 'SELECT' + // Note: When setting this to an SQL keyword, it is not recommended to + // attempt any client-side parsing of `db.statement` just to get this + // property, but it should be set if the operation name is provided by the + // library being instrumented. If the SQL statement has an ambiguous + // operation, or performs more than one operation, this value may be + // omitted. + DBOperationKey = attribute.Key("db.operation") + + // DBRedisDBIndexKey is the attribute Key conforming to the + // "db.redis.database_index" semantic conventions. It represents the index + // of the database being accessed as used in the [`SELECT` + // command](https://redis.io/commands/select), provided as an integer. To + // be used instead of the generic `db.name` attribute. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 15 + DBRedisDBIndexKey = attribute.Key("db.redis.database_index") + + // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" + // semantic conventions. It represents the name of the primary table that + // the operation is acting upon, including the database name (if + // applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'public.users', 'customers' + // Note: It is not recommended to attempt any client-side parsing of + // `db.statement` just to get this property, but it should be set if it is + // provided by the library being instrumented. If the operation is acting + // upon an anonymous table, or more than one table, this value MUST NOT be + // set. + DBSQLTableKey = attribute.Key("db.sql.table") + + // DBStatementKey is the attribute Key conforming to the "db.statement" + // semantic conventions. It represents the database statement being + // executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' + DBStatementKey = attribute.Key("db.statement") + + // DBSystemKey is the attribute Key conforming to the "db.system" semantic + // conventions. It represents an identifier for the database management + // system (DBMS) product being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + DBSystemKey = attribute.Key("db.system") + + // DBUserKey is the attribute Key conforming to the "db.user" semantic + // conventions. It represents the username for accessing the database. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'readonly_user', 'reporting_user' + DBUserKey = attribute.Key("db.user") +) + +var ( + // all + DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") + // each_quorum + DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") + // quorum + DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") + // local_quorum + DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") + // one + DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") + // two + DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") + // three + DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") + // local_one + DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") + // any + DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") + // serial + DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") + // local_serial + DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") +) + +var ( + // Gateway (HTTP) connections mode + DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") + // Direct connection + DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") +) + +var ( + // invalid + DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") + // create + DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") + // patch + DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") + // read + DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") + // read_feed + DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") + // delete + DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") + // replace + DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") + // execute + DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") + // query + DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") + // head + DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") + // head_feed + DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") + // upsert + DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") + // batch + DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") + // query_plan + DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") + // execute_javascript + DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") +) + +var ( + // Some other SQL database. Fallback only. See notes + DBSystemOtherSQL = DBSystemKey.String("other_sql") + // Microsoft SQL Server + DBSystemMSSQL = DBSystemKey.String("mssql") + // Microsoft SQL Server Compact + DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") + // MySQL + DBSystemMySQL = DBSystemKey.String("mysql") + // Oracle Database + DBSystemOracle = DBSystemKey.String("oracle") + // IBM DB2 + DBSystemDB2 = DBSystemKey.String("db2") + // PostgreSQL + DBSystemPostgreSQL = DBSystemKey.String("postgresql") + // Amazon Redshift + DBSystemRedshift = DBSystemKey.String("redshift") + // Apache Hive + DBSystemHive = DBSystemKey.String("hive") + // Cloudscape + DBSystemCloudscape = DBSystemKey.String("cloudscape") + // HyperSQL DataBase + DBSystemHSQLDB = DBSystemKey.String("hsqldb") + // Progress Database + DBSystemProgress = DBSystemKey.String("progress") + // SAP MaxDB + DBSystemMaxDB = DBSystemKey.String("maxdb") + // SAP HANA + DBSystemHanaDB = DBSystemKey.String("hanadb") + // Ingres + DBSystemIngres = DBSystemKey.String("ingres") + // FirstSQL + DBSystemFirstSQL = DBSystemKey.String("firstsql") + // EnterpriseDB + DBSystemEDB = DBSystemKey.String("edb") + // InterSystems Caché + DBSystemCache = DBSystemKey.String("cache") + // Adabas (Adaptable Database System) + DBSystemAdabas = DBSystemKey.String("adabas") + // Firebird + DBSystemFirebird = DBSystemKey.String("firebird") + // Apache Derby + DBSystemDerby = DBSystemKey.String("derby") + // FileMaker + DBSystemFilemaker = DBSystemKey.String("filemaker") + // Informix + DBSystemInformix = DBSystemKey.String("informix") + // InstantDB + DBSystemInstantDB = DBSystemKey.String("instantdb") + // InterBase + DBSystemInterbase = DBSystemKey.String("interbase") + // MariaDB + DBSystemMariaDB = DBSystemKey.String("mariadb") + // Netezza + DBSystemNetezza = DBSystemKey.String("netezza") + // Pervasive PSQL + DBSystemPervasive = DBSystemKey.String("pervasive") + // PointBase + DBSystemPointbase = DBSystemKey.String("pointbase") + // SQLite + DBSystemSqlite = DBSystemKey.String("sqlite") + // Sybase + DBSystemSybase = DBSystemKey.String("sybase") + // Teradata + DBSystemTeradata = DBSystemKey.String("teradata") + // Vertica + DBSystemVertica = DBSystemKey.String("vertica") + // H2 + DBSystemH2 = DBSystemKey.String("h2") + // ColdFusion IMQ + DBSystemColdfusion = DBSystemKey.String("coldfusion") + // Apache Cassandra + DBSystemCassandra = DBSystemKey.String("cassandra") + // Apache HBase + DBSystemHBase = DBSystemKey.String("hbase") + // MongoDB + DBSystemMongoDB = DBSystemKey.String("mongodb") + // Redis + DBSystemRedis = DBSystemKey.String("redis") + // Couchbase + DBSystemCouchbase = DBSystemKey.String("couchbase") + // CouchDB + DBSystemCouchDB = DBSystemKey.String("couchdb") + // Microsoft Azure Cosmos DB + DBSystemCosmosDB = DBSystemKey.String("cosmosdb") + // Amazon DynamoDB + DBSystemDynamoDB = DBSystemKey.String("dynamodb") + // Neo4j + DBSystemNeo4j = DBSystemKey.String("neo4j") + // Apache Geode + DBSystemGeode = DBSystemKey.String("geode") + // Elasticsearch + DBSystemElasticsearch = DBSystemKey.String("elasticsearch") + // Memcached + DBSystemMemcached = DBSystemKey.String("memcached") + // CockroachDB + DBSystemCockroachdb = DBSystemKey.String("cockroachdb") + // OpenSearch + DBSystemOpensearch = DBSystemKey.String("opensearch") + // ClickHouse + DBSystemClickhouse = DBSystemKey.String("clickhouse") + // Cloud Spanner + DBSystemSpanner = DBSystemKey.String("spanner") + // Trino + DBSystemTrino = DBSystemKey.String("trino") +) + +// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.dc" semantic conventions. It represents the data +// center of the coordinating node for a query. +func DBCassandraCoordinatorDC(val string) attribute.KeyValue { + return DBCassandraCoordinatorDCKey.String(val) +} + +// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the +// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of +// the coordinating node for a query. +func DBCassandraCoordinatorID(val string) attribute.KeyValue { + return DBCassandraCoordinatorIDKey.String(val) +} + +// DBCassandraIdempotence returns an attribute KeyValue conforming to the +// "db.cassandra.idempotence" semantic conventions. It represents the whether +// or not the query is idempotent. +func DBCassandraIdempotence(val bool) attribute.KeyValue { + return DBCassandraIdempotenceKey.Bool(val) +} + +// DBCassandraPageSize returns an attribute KeyValue conforming to the +// "db.cassandra.page_size" semantic conventions. It represents the fetch size +// used for paging, i.e. how many rows will be returned at once. +func DBCassandraPageSize(val int) attribute.KeyValue { + return DBCassandraPageSizeKey.Int(val) +} + +// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue +// conforming to the "db.cassandra.speculative_execution_count" semantic +// conventions. It represents the number of times a query was speculatively +// executed. Not set or `0` if the query was not executed speculatively. +func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { + return DBCassandraSpeculativeExecutionCountKey.Int(val) +} + +// DBCassandraTable returns an attribute KeyValue conforming to the +// "db.cassandra.table" semantic conventions. It represents the name of the +// primary Cassandra table that the operation is acting upon, including the +// keyspace name (if applicable). +func DBCassandraTable(val string) attribute.KeyValue { + return DBCassandraTableKey.String(val) +} + +// DBConnectionString returns an attribute KeyValue conforming to the +// "db.connection_string" semantic conventions. It represents the connection +// string used to connect to the database. It is recommended to remove embedded +// credentials. +func DBConnectionString(val string) attribute.KeyValue { + return DBConnectionStringKey.String(val) +} + +// DBCosmosDBClientID returns an attribute KeyValue conforming to the +// "db.cosmosdb.client_id" semantic conventions. It represents the unique +// Cosmos client instance id. +func DBCosmosDBClientID(val string) attribute.KeyValue { + return DBCosmosDBClientIDKey.String(val) +} + +// DBCosmosDBContainer returns an attribute KeyValue conforming to the +// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB +// container name. +func DBCosmosDBContainer(val string) attribute.KeyValue { + return DBCosmosDBContainerKey.String(val) +} + +// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the +// "db.cosmosdb.request_charge" semantic conventions. It represents the rU +// consumed for that operation +func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { + return DBCosmosDBRequestChargeKey.Float64(val) +} + +// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming +// to the "db.cosmosdb.request_content_length" semantic conventions. It +// represents the request payload size in bytes +func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { + return DBCosmosDBRequestContentLengthKey.Int(val) +} + +// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB +// status code. +func DBCosmosDBStatusCode(val int) attribute.KeyValue { + return DBCosmosDBStatusCodeKey.Int(val) +} + +// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the +// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos +// DB sub status code. +func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { + return DBCosmosDBSubStatusCodeKey.Int(val) +} + +// DBElasticsearchClusterName returns an attribute KeyValue conforming to +// the "db.elasticsearch.cluster.name" semantic conventions. It represents the +// represents the identifier of an Elasticsearch cluster. +func DBElasticsearchClusterName(val string) attribute.KeyValue { + return DBElasticsearchClusterNameKey.String(val) +} + +// DBElasticsearchNodeName returns an attribute KeyValue conforming to the +// "db.elasticsearch.node.name" semantic conventions. It represents the +// represents the human-readable identifier of the node/instance to which a +// request was routed. +func DBElasticsearchNodeName(val string) attribute.KeyValue { + return DBElasticsearchNodeNameKey.String(val) +} + +// DBInstanceID returns an attribute KeyValue conforming to the +// "db.instance.id" semantic conventions. It represents an identifier (address, +// unique name, or any other identifier) of the database instance that is +// executing queries or mutations on the current connection. This is useful in +// cases where the database is running in a clustered environment and the +// instrumentation is able to record the node executing the query. The client +// may obtain this value in databases like MySQL using queries like `select +// @@hostname`. +func DBInstanceID(val string) attribute.KeyValue { + return DBInstanceIDKey.String(val) +} + +// DBJDBCDriverClassname returns an attribute KeyValue conforming to the +// "db.jdbc.driver_classname" semantic conventions. It represents the +// fully-qualified class name of the [Java Database Connectivity +// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver +// used to connect. +func DBJDBCDriverClassname(val string) attribute.KeyValue { + return DBJDBCDriverClassnameKey.String(val) +} + +// DBMongoDBCollection returns an attribute KeyValue conforming to the +// "db.mongodb.collection" semantic conventions. It represents the MongoDB +// collection being accessed within the database stated in `db.name`. +func DBMongoDBCollection(val string) attribute.KeyValue { + return DBMongoDBCollectionKey.String(val) +} + +// DBMSSQLInstanceName returns an attribute KeyValue conforming to the +// "db.mssql.instance_name" semantic conventions. It represents the Microsoft +// SQL Server [instance +// name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) +// connecting to. This name is used to determine the port of a named instance. +func DBMSSQLInstanceName(val string) attribute.KeyValue { + return DBMSSQLInstanceNameKey.String(val) +} + +// DBName returns an attribute KeyValue conforming to the "db.name" semantic +// conventions. It represents the this attribute is used to report the name of +// the database being accessed. For commands that switch the database, this +// should be set to the target database (even if the command fails). +func DBName(val string) attribute.KeyValue { + return DBNameKey.String(val) +} + +// DBOperation returns an attribute KeyValue conforming to the +// "db.operation" semantic conventions. It represents the name of the operation +// being executed, e.g. the [MongoDB command +// name](https://docs.mongodb.com/manual/reference/command/#database-operations) +// such as `findAndModify`, or the SQL keyword. +func DBOperation(val string) attribute.KeyValue { + return DBOperationKey.String(val) +} + +// DBRedisDBIndex returns an attribute KeyValue conforming to the +// "db.redis.database_index" semantic conventions. It represents the index of +// the database being accessed as used in the [`SELECT` +// command](https://redis.io/commands/select), provided as an integer. To be +// used instead of the generic `db.name` attribute. +func DBRedisDBIndex(val int) attribute.KeyValue { + return DBRedisDBIndexKey.Int(val) +} + +// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" +// semantic conventions. It represents the name of the primary table that the +// operation is acting upon, including the database name (if applicable). +func DBSQLTable(val string) attribute.KeyValue { + return DBSQLTableKey.String(val) +} + +// DBStatement returns an attribute KeyValue conforming to the +// "db.statement" semantic conventions. It represents the database statement +// being executed. +func DBStatement(val string) attribute.KeyValue { + return DBStatementKey.String(val) +} + +// DBUser returns an attribute KeyValue conforming to the "db.user" semantic +// conventions. It represents the username for accessing the database. +func DBUser(val string) attribute.KeyValue { + return DBUserKey.String(val) +} + +// Describes deprecated HTTP attributes. +const ( + // HTTPFlavorKey is the attribute Key conforming to the "http.flavor" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorKey = attribute.Key("http.flavor") + + // HTTPMethodKey is the attribute Key conforming to the "http.method" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'GET', 'POST', 'HEAD' + // Deprecated: use `http.request.method` instead. + HTTPMethodKey = attribute.Key("http.method") + + // HTTPRequestContentLengthKey is the attribute Key conforming to the + // "http.request_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.request.header.content-length` instead. + HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") + + // HTTPResponseContentLengthKey is the attribute Key conforming to the + // "http.response_content_length" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 3495 + // Deprecated: use `http.response.header.content-length` instead. + HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") + + // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'http', 'https' + // Deprecated: use `url.scheme` instead. + HTTPSchemeKey = attribute.Key("http.scheme") + + // HTTPStatusCodeKey is the attribute Key conforming to the + // "http.status_code" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 200 + // Deprecated: use `http.response.status_code` instead. + HTTPStatusCodeKey = attribute.Key("http.status_code") + + // HTTPTargetKey is the attribute Key conforming to the "http.target" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.path` and `url.query` instead. + HTTPTargetKey = attribute.Key("http.target") + + // HTTPURLKey is the attribute Key conforming to the "http.url" semantic + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' + // Deprecated: use `url.full` instead. + HTTPURLKey = attribute.Key("http.url") + + // HTTPUserAgentKey is the attribute Key conforming to the + // "http.user_agent" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + // Deprecated: use `user_agent.original` instead. + HTTPUserAgentKey = attribute.Key("http.user_agent") +) + +var ( + // HTTP/1.0 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP10 = HTTPFlavorKey.String("1.0") + // HTTP/1.1 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP11 = HTTPFlavorKey.String("1.1") + // HTTP/2 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP20 = HTTPFlavorKey.String("2.0") + // HTTP/3 + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorHTTP30 = HTTPFlavorKey.String("3.0") + // SPDY protocol + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorSPDY = HTTPFlavorKey.String("SPDY") + // QUIC protocol + // + // Deprecated: use `network.protocol.name` instead. + HTTPFlavorQUIC = HTTPFlavorKey.String("QUIC") +) + +// HTTPMethod returns an attribute KeyValue conforming to the "http.method" +// semantic conventions. +// +// Deprecated: use `http.request.method` instead. +func HTTPMethod(val string) attribute.KeyValue { + return HTTPMethodKey.String(val) +} + +// HTTPRequestContentLength returns an attribute KeyValue conforming to the +// "http.request_content_length" semantic conventions. +// +// Deprecated: use `http.request.header.content-length` instead. +func HTTPRequestContentLength(val int) attribute.KeyValue { + return HTTPRequestContentLengthKey.Int(val) +} + +// HTTPResponseContentLength returns an attribute KeyValue conforming to the +// "http.response_content_length" semantic conventions. +// +// Deprecated: use `http.response.header.content-length` instead. +func HTTPResponseContentLength(val int) attribute.KeyValue { + return HTTPResponseContentLengthKey.Int(val) +} + +// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" +// semantic conventions. +// +// Deprecated: use `url.scheme` instead. +func HTTPScheme(val string) attribute.KeyValue { + return HTTPSchemeKey.String(val) +} + +// HTTPStatusCode returns an attribute KeyValue conforming to the +// "http.status_code" semantic conventions. +// +// Deprecated: use `http.response.status_code` instead. +func HTTPStatusCode(val int) attribute.KeyValue { + return HTTPStatusCodeKey.Int(val) +} + +// HTTPTarget returns an attribute KeyValue conforming to the "http.target" +// semantic conventions. +// +// Deprecated: use `url.path` and `url.query` instead. +func HTTPTarget(val string) attribute.KeyValue { + return HTTPTargetKey.String(val) +} + +// HTTPURL returns an attribute KeyValue conforming to the "http.url" +// semantic conventions. +// +// Deprecated: use `url.full` instead. +func HTTPURL(val string) attribute.KeyValue { + return HTTPURLKey.String(val) +} + +// HTTPUserAgent returns an attribute KeyValue conforming to the +// "http.user_agent" semantic conventions. +// +// Deprecated: use `user_agent.original` instead. +func HTTPUserAgent(val string) attribute.KeyValue { + return HTTPUserAgentKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetHostNameKey is the attribute Key conforming to the "net.host.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address`. + NetHostNameKey = attribute.Key("net.host.name") + + // NetHostPortKey is the attribute Key conforming to the "net.host.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port`. + NetHostPortKey = attribute.Key("net.host.port") + + // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" + // semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'example.com' + // Deprecated: use `server.address` on client spans and `client.address` on + // server spans. + NetPeerNameKey = attribute.Key("net.peer.name") + + // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" + // semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `server.port` on client spans and `client.port` on + // server spans. + NetPeerPortKey = attribute.Key("net.peer.port") + + // NetProtocolNameKey is the attribute Key conforming to the + // "net.protocol.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'amqp', 'http', 'mqtt' + // Deprecated: use `network.protocol.name`. + NetProtocolNameKey = attribute.Key("net.protocol.name") + + // NetProtocolVersionKey is the attribute Key conforming to the + // "net.protocol.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '3.1.1' + // Deprecated: use `network.protocol.version`. + NetProtocolVersionKey = attribute.Key("net.protocol.version") + + // NetSockFamilyKey is the attribute Key conforming to the + // "net.sock.family" semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyKey = attribute.Key("net.sock.family") + + // NetSockHostAddrKey is the attribute Key conforming to the + // "net.sock.host.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: use `network.local.address`. + NetSockHostAddrKey = attribute.Key("net.sock.host.addr") + + // NetSockHostPortKey is the attribute Key conforming to the + // "net.sock.host.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 8080 + // Deprecated: use `network.local.port`. + NetSockHostPortKey = attribute.Key("net.sock.host.port") + + // NetSockPeerAddrKey is the attribute Key conforming to the + // "net.sock.peer.addr" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '192.168.0.1' + // Deprecated: use `network.peer.address`. + NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") + + // NetSockPeerNameKey is the attribute Key conforming to the + // "net.sock.peer.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '/var/my.sock' + // Deprecated: no replacement at this time. + NetSockPeerNameKey = attribute.Key("net.sock.peer.name") + + // NetSockPeerPortKey is the attribute Key conforming to the + // "net.sock.peer.port" semantic conventions. + // + // Type: int + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 65531 + // Deprecated: use `network.peer.port`. + NetSockPeerPortKey = attribute.Key("net.sock.peer.port") + + // NetTransportKey is the attribute Key conforming to the "net.transport" + // semantic conventions. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: deprecated + // Deprecated: use `network.transport`. + NetTransportKey = attribute.Key("net.transport") +) + +var ( + // IPv4 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet = NetSockFamilyKey.String("inet") + // IPv6 address + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") + // Unix domain socket path + // + // Deprecated: use `network.transport` and `network.type`. + NetSockFamilyUnix = NetSockFamilyKey.String("unix") +) + +var ( + // ip_tcp + // + // Deprecated: use `network.transport`. + NetTransportTCP = NetTransportKey.String("ip_tcp") + // ip_udp + // + // Deprecated: use `network.transport`. + NetTransportUDP = NetTransportKey.String("ip_udp") + // Named or anonymous pipe + // + // Deprecated: use `network.transport`. + NetTransportPipe = NetTransportKey.String("pipe") + // In-process communication + // + // Deprecated: use `network.transport`. + NetTransportInProc = NetTransportKey.String("inproc") + // Something else (non IP-based) + // + // Deprecated: use `network.transport`. + NetTransportOther = NetTransportKey.String("other") +) + +// NetHostName returns an attribute KeyValue conforming to the +// "net.host.name" semantic conventions. +// +// Deprecated: use `server.address`. +func NetHostName(val string) attribute.KeyValue { + return NetHostNameKey.String(val) +} + +// NetHostPort returns an attribute KeyValue conforming to the +// "net.host.port" semantic conventions. +// +// Deprecated: use `server.port`. +func NetHostPort(val int) attribute.KeyValue { + return NetHostPortKey.Int(val) +} + +// NetPeerName returns an attribute KeyValue conforming to the +// "net.peer.name" semantic conventions. +// +// Deprecated: use `server.address` on client spans and `client.address` on +// server spans. +func NetPeerName(val string) attribute.KeyValue { + return NetPeerNameKey.String(val) +} + +// NetPeerPort returns an attribute KeyValue conforming to the +// "net.peer.port" semantic conventions. +// +// Deprecated: use `server.port` on client spans and `client.port` on server +// spans. +func NetPeerPort(val int) attribute.KeyValue { + return NetPeerPortKey.Int(val) +} + +// NetProtocolName returns an attribute KeyValue conforming to the +// "net.protocol.name" semantic conventions. +// +// Deprecated: use `network.protocol.name`. +func NetProtocolName(val string) attribute.KeyValue { + return NetProtocolNameKey.String(val) +} + +// NetProtocolVersion returns an attribute KeyValue conforming to the +// "net.protocol.version" semantic conventions. +// +// Deprecated: use `network.protocol.version`. +func NetProtocolVersion(val string) attribute.KeyValue { + return NetProtocolVersionKey.String(val) +} + +// NetSockHostAddr returns an attribute KeyValue conforming to the +// "net.sock.host.addr" semantic conventions. +// +// Deprecated: use `network.local.address`. +func NetSockHostAddr(val string) attribute.KeyValue { + return NetSockHostAddrKey.String(val) +} + +// NetSockHostPort returns an attribute KeyValue conforming to the +// "net.sock.host.port" semantic conventions. +// +// Deprecated: use `network.local.port`. +func NetSockHostPort(val int) attribute.KeyValue { + return NetSockHostPortKey.Int(val) +} + +// NetSockPeerAddr returns an attribute KeyValue conforming to the +// "net.sock.peer.addr" semantic conventions. +// +// Deprecated: use `network.peer.address`. +func NetSockPeerAddr(val string) attribute.KeyValue { + return NetSockPeerAddrKey.String(val) +} + +// NetSockPeerName returns an attribute KeyValue conforming to the +// "net.sock.peer.name" semantic conventions. +// +// Deprecated: no replacement at this time. +func NetSockPeerName(val string) attribute.KeyValue { + return NetSockPeerNameKey.String(val) +} + +// NetSockPeerPort returns an attribute KeyValue conforming to the +// "net.sock.peer.port" semantic conventions. +// +// Deprecated: use `network.peer.port`. +func NetSockPeerPort(val int) attribute.KeyValue { + return NetSockPeerPortKey.Int(val) +} + +// These attributes may be used to describe the receiver of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // DestinationAddressKey is the attribute Key conforming to the + // "destination.address" semantic conventions. It represents the + // destination address - domain name if available without reverse DNS + // lookup; otherwise, IP address or Unix domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the source side, and when communicating through + // an intermediary, `destination.address` SHOULD represent the destination + // address behind any intermediaries, for example proxies, if it's + // available. + DestinationAddressKey = attribute.Key("destination.address") + + // DestinationPortKey is the attribute Key conforming to the + // "destination.port" semantic conventions. It represents the destination + // port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + DestinationPortKey = attribute.Key("destination.port") +) + +// DestinationAddress returns an attribute KeyValue conforming to the +// "destination.address" semantic conventions. It represents the destination +// address - domain name if available without reverse DNS lookup; otherwise, IP +// address or Unix domain socket name. +func DestinationAddress(val string) attribute.KeyValue { + return DestinationAddressKey.String(val) +} + +// DestinationPort returns an attribute KeyValue conforming to the +// "destination.port" semantic conventions. It represents the destination port +// number +func DestinationPort(val int) attribute.KeyValue { + return DestinationPortKey.Int(val) +} + +// These attributes may be used for any disk related operation. +const ( + // DiskIoDirectionKey is the attribute Key conforming to the + // "disk.io.direction" semantic conventions. It represents the disk IO + // operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read' + DiskIoDirectionKey = attribute.Key("disk.io.direction") +) + +var ( + // read + DiskIoDirectionRead = DiskIoDirectionKey.String("read") + // write + DiskIoDirectionWrite = DiskIoDirectionKey.String("write") +) + +// The shared attributes used to report an error. +const ( + // ErrorTypeKey is the attribute Key conforming to the "error.type" + // semantic conventions. It represents the describes a class of error the + // operation ended with. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'timeout', 'java.net.UnknownHostException', + // 'server_certificate_invalid', '500' + // Note: The `error.type` SHOULD be predictable and SHOULD have low + // cardinality. + // Instrumentations SHOULD document the list of errors they report. + // + // The cardinality of `error.type` within one instrumentation library + // SHOULD be low. + // Telemetry consumers that aggregate data from multiple instrumentation + // libraries and applications + // should be prepared for `error.type` to have high cardinality at query + // time when no + // additional filters are applied. + // + // If the operation has completed successfully, instrumentations SHOULD NOT + // set `error.type`. + // + // If a specific domain defines its own set of error identifiers (such as + // HTTP or gRPC status codes), + // it's RECOMMENDED to: + // + // * Use a domain-specific attribute + // * Set `error.type` to capture all errors, regardless of whether they are + // defined within the domain-specific set or not. + ErrorTypeKey = attribute.Key("error.type") +) + +var ( + // A fallback error value to be used when the instrumentation doesn't define a custom value + ErrorTypeOther = ErrorTypeKey.String("_OTHER") +) + +// The shared attributes used to report a single exception associated with a +// span or log. +const ( + // ExceptionEscapedKey is the attribute Key conforming to the + // "exception.escaped" semantic conventions. It represents the sHOULD be + // set to true if the exception event is recorded at a point where it is + // known that the exception is escaping the scope of the span. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: An exception is considered to have escaped (or left) the scope of + // a span, + // if that span is ended while the exception is still logically "in + // flight". + // This may be actually "in flight" in some languages (e.g. if the + // exception + // is passed to a Context manager's `__exit__` method in Python) but will + // usually be caught at the point of recording the exception in most + // languages. + // + // It is usually not possible to determine at the point where an exception + // is thrown + // whether it will escape the scope of a span. + // However, it is trivial to know that an exception + // will escape, if one checks for an active exception just before ending + // the span, + // as done in the [example for recording span + // exceptions](#recording-an-exception). + // + // It follows that an exception may still escape the scope of the span + // even if the `exception.escaped` attribute was not set or set to false, + // since the event might have been recorded at a time where it was not + // clear whether the exception will escape. + ExceptionEscapedKey = attribute.Key("exception.escaped") + + // ExceptionMessageKey is the attribute Key conforming to the + // "exception.message" semantic conventions. It represents the exception + // message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Division by zero', "Can't convert 'int' object to str + // implicitly" + ExceptionMessageKey = attribute.Key("exception.message") + + // ExceptionStacktraceKey is the attribute Key conforming to the + // "exception.stacktrace" semantic conventions. It represents a stacktrace + // as a string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test + // exception\\n at ' + // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + ExceptionStacktraceKey = attribute.Key("exception.stacktrace") + + // ExceptionTypeKey is the attribute Key conforming to the "exception.type" + // semantic conventions. It represents the type of the exception (its + // fully-qualified class name, if applicable). The dynamic type of the + // exception should be preferred over the static type in languages that + // support it. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'java.net.ConnectException', 'OSError' + ExceptionTypeKey = attribute.Key("exception.type") +) + +// ExceptionEscaped returns an attribute KeyValue conforming to the +// "exception.escaped" semantic conventions. It represents the sHOULD be set to +// true if the exception event is recorded at a point where it is known that +// the exception is escaping the scope of the span. +func ExceptionEscaped(val bool) attribute.KeyValue { + return ExceptionEscapedKey.Bool(val) +} + +// ExceptionMessage returns an attribute KeyValue conforming to the +// "exception.message" semantic conventions. It represents the exception +// message. +func ExceptionMessage(val string) attribute.KeyValue { + return ExceptionMessageKey.String(val) +} + +// ExceptionStacktrace returns an attribute KeyValue conforming to the +// "exception.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func ExceptionStacktrace(val string) attribute.KeyValue { + return ExceptionStacktraceKey.String(val) +} + +// ExceptionType returns an attribute KeyValue conforming to the +// "exception.type" semantic conventions. It represents the type of the +// exception (its fully-qualified class name, if applicable). The dynamic type +// of the exception should be preferred over the static type in languages that +// support it. +func ExceptionType(val string) attribute.KeyValue { + return ExceptionTypeKey.String(val) +} + +// Semantic convention attributes in the HTTP namespace. +const ( + // HTTPRequestBodySizeKey is the attribute Key conforming to the + // "http.request.body.size" semantic conventions. It represents the size of + // the request payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") + + // HTTPRequestMethodKey is the attribute Key conforming to the + // "http.request.method" semantic conventions. It represents the hTTP + // request method. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GET', 'POST', 'HEAD' + // Note: HTTP request method value SHOULD be "known" to the + // instrumentation. + // By default, this convention defines "known" methods as the ones listed + // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + // and the PATCH method defined in + // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + // + // If the HTTP request method is not known to instrumentation, it MUST set + // the `http.request.method` attribute to `_OTHER`. + // + // If the HTTP instrumentation could end up converting valid HTTP request + // methods to `_OTHER`, then it MUST provide a way to override + // the list of known HTTP methods. If this override is done via environment + // variable, then the environment variable MUST be named + // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated + // list of case-sensitive known HTTP methods + // (this list MUST be a full override of the default known method, it is + // not a list of known methods in addition to the defaults). + // + // HTTP method names are case-sensitive and `http.request.method` attribute + // value MUST match a known HTTP method name exactly. + // Instrumentations for specific web frameworks that consider HTTP methods + // to be case insensitive, SHOULD populate a canonical equivalent. + // Tracing instrumentations that do so, MUST also set + // `http.request.method_original` to the original value. + HTTPRequestMethodKey = attribute.Key("http.request.method") + + // HTTPRequestMethodOriginalKey is the attribute Key conforming to the + // "http.request.method_original" semantic conventions. It represents the + // original HTTP method sent by the client in the request line. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'GeT', 'ACL', 'foo' + HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") + + // HTTPRequestResendCountKey is the attribute Key conforming to the + // "http.request.resend_count" semantic conventions. It represents the + // ordinal number of request resending attempt (for any reason, including + // redirects). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 3 + // Note: The resend count SHOULD be updated each time an HTTP request gets + // resent by the client, regardless of what was the cause of the resending + // (e.g. redirection, authorization failure, 503 Server Unavailable, + // network issues, or any other). + HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") + + // HTTPResponseBodySizeKey is the attribute Key conforming to the + // "http.response.body.size" semantic conventions. It represents the size + // of the response payload body in bytes. This is the number of bytes + // transferred excluding headers and is often, but not always, present as + // the + // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + // header. For requests using transport encoding, this should be the + // compressed size. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3495 + HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") + + // HTTPResponseStatusCodeKey is the attribute Key conforming to the + // "http.response.status_code" semantic conventions. It represents the + // [HTTP response status + // code](https://tools.ietf.org/html/rfc7231#section-6). + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 200 + HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") + + // HTTPRouteKey is the attribute Key conforming to the "http.route" + // semantic conventions. It represents the matched route, that is, the path + // template in the format used by the respective server framework. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/users/:userID?', '{controller}/{action}/{id?}' + // Note: MUST NOT be populated when this is not supported by the HTTP + // server framework as the route attribute should have low-cardinality and + // the URI path can NOT substitute it. + // SHOULD include the [application + // root](/docs/http/http-spans.md#http-server-definitions) if there is one. + HTTPRouteKey = attribute.Key("http.route") +) + +var ( + // CONNECT method + HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") + // DELETE method + HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") + // GET method + HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") + // HEAD method + HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") + // OPTIONS method + HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") + // PATCH method + HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") + // POST method + HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") + // PUT method + HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") + // TRACE method + HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") + // Any HTTP method that the instrumentation has no prior knowledge of + HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") +) + +// HTTPRequestBodySize returns an attribute KeyValue conforming to the +// "http.request.body.size" semantic conventions. It represents the size of the +// request payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPRequestBodySize(val int) attribute.KeyValue { + return HTTPRequestBodySizeKey.Int(val) +} + +// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the +// "http.request.method_original" semantic conventions. It represents the +// original HTTP method sent by the client in the request line. +func HTTPRequestMethodOriginal(val string) attribute.KeyValue { + return HTTPRequestMethodOriginalKey.String(val) +} + +// HTTPRequestResendCount returns an attribute KeyValue conforming to the +// "http.request.resend_count" semantic conventions. It represents the ordinal +// number of request resending attempt (for any reason, including redirects). +func HTTPRequestResendCount(val int) attribute.KeyValue { + return HTTPRequestResendCountKey.Int(val) +} + +// HTTPResponseBodySize returns an attribute KeyValue conforming to the +// "http.response.body.size" semantic conventions. It represents the size of +// the response payload body in bytes. This is the number of bytes transferred +// excluding headers and is often, but not always, present as the +// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) +// header. For requests using transport encoding, this should be the compressed +// size. +func HTTPResponseBodySize(val int) attribute.KeyValue { + return HTTPResponseBodySizeKey.Int(val) +} + +// HTTPResponseStatusCode returns an attribute KeyValue conforming to the +// "http.response.status_code" semantic conventions. It represents the [HTTP +// response status code](https://tools.ietf.org/html/rfc7231#section-6). +func HTTPResponseStatusCode(val int) attribute.KeyValue { + return HTTPResponseStatusCodeKey.Int(val) +} + +// HTTPRoute returns an attribute KeyValue conforming to the "http.route" +// semantic conventions. It represents the matched route, that is, the path +// template in the format used by the respective server framework. +func HTTPRoute(val string) attribute.KeyValue { + return HTTPRouteKey.String(val) +} + +// Attributes describing telemetry around messaging systems and messaging +// activities. +const ( + // MessagingBatchMessageCountKey is the attribute Key conforming to the + // "messaging.batch.message_count" semantic conventions. It represents the + // number of messages sent, received, or processed in the scope of the + // batching operation. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1, 2 + // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on + // spans that operate with a single message. When a messaging client + // library supports both batch and single-message API for the same + // operation, instrumentations SHOULD use `messaging.batch.message_count` + // for batching APIs and SHOULD NOT use it for single-message APIs. + MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") + + // MessagingClientIDKey is the attribute Key conforming to the + // "messaging.client_id" semantic conventions. It represents a unique + // identifier for the client that consumes or produces a message. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'client-5', 'myhost@8742@s8083jm' + MessagingClientIDKey = attribute.Key("messaging.client_id") + + // MessagingDestinationAnonymousKey is the attribute Key conforming to the + // "messaging.destination.anonymous" semantic conventions. It represents a + // boolean that is true if the message destination is anonymous (could be + // unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") + + // MessagingDestinationNameKey is the attribute Key conforming to the + // "messaging.destination.name" semantic conventions. It represents the + // message destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: Destination name SHOULD uniquely identify a specific queue, topic + // or other entity within the broker. If + // the broker doesn't have such notion, the destination name SHOULD + // uniquely identify the broker. + MessagingDestinationNameKey = attribute.Key("messaging.destination.name") + + // MessagingDestinationTemplateKey is the attribute Key conforming to the + // "messaging.destination.template" semantic conventions. It represents the + // low cardinality representation of the messaging destination name + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/customers/{customerID}' + // Note: Destination names could be constructed from templates. An example + // would be a destination name involving a user name or product id. + // Although the destination name in this case is of high cardinality, the + // underlying template is of low cardinality and can be effectively used + // for grouping and aggregation. + MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") + + // MessagingDestinationTemporaryKey is the attribute Key conforming to the + // "messaging.destination.temporary" semantic conventions. It represents a + // boolean that is true if the message destination is temporary and might + // not exist anymore after messages are processed. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") + + // MessagingDestinationPublishAnonymousKey is the attribute Key conforming + // to the "messaging.destination_publish.anonymous" semantic conventions. + // It represents a boolean that is true if the publish message destination + // is anonymous (could be unnamed or have auto-generated name). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") + + // MessagingDestinationPublishNameKey is the attribute Key conforming to + // the "messaging.destination_publish.name" semantic conventions. It + // represents the name of the original destination the message was + // published to + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyQueue', 'MyTopic' + // Note: The name SHOULD uniquely identify a specific queue, topic, or + // other entity within the broker. If + // the broker doesn't have such notion, the original destination name + // SHOULD uniquely identify the broker. + MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") + + // MessagingGCPPubsubMessageOrderingKeyKey is the attribute Key conforming + // to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. + // It represents the ordering key for a given message. If the attribute is + // not present, the message does not have an ordering key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ordering_key' + MessagingGCPPubsubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") + + // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the + // "messaging.kafka.consumer.group" semantic conventions. It represents the + // name of the Kafka Consumer Group that is handling the message. Only + // applies to consumers, not producers. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-group' + MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") + + // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to + // the "messaging.kafka.destination.partition" semantic conventions. It + // represents the partition the message is sent to. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2 + MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") + + // MessagingKafkaMessageKeyKey is the attribute Key conforming to the + // "messaging.kafka.message.key" semantic conventions. It represents the + // message keys in Kafka are used for grouping alike messages to ensure + // they're processed on the same partition. They differ from + // `messaging.message.id` in that they're not unique. If the key is `null`, + // the attribute MUST NOT be set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + // Note: If the key type is not string, it's string representation has to + // be supplied for the attribute. If the key has no unambiguous, canonical + // string form, don't include its value. + MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") + + // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the + // "messaging.kafka.message.offset" semantic conventions. It represents the + // offset of a record in the corresponding Kafka partition. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") + + // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the + // "messaging.kafka.message.tombstone" semantic conventions. It represents + // a boolean that is true if the message is a tombstone. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") + + // MessagingMessageBodySizeKey is the attribute Key conforming to the + // "messaging.message.body.size" semantic conventions. It represents the + // size of the message body in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1439 + // Note: This can refer to both the compressed or uncompressed body size. + // If both sizes are known, the uncompressed + // body size should be used. + MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") + + // MessagingMessageConversationIDKey is the attribute Key conforming to the + // "messaging.message.conversation_id" semantic conventions. It represents + // the conversation ID identifying the conversation to which the message + // belongs, represented as a string. Sometimes called "Correlation ID". + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MyConversationID' + MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") + + // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the + // "messaging.message.envelope.size" semantic conventions. It represents + // the size of the message body and metadata in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 2738 + // Note: This can refer to both the compressed or uncompressed size. If + // both sizes are known, the uncompressed + // size should be used. + MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") + + // MessagingMessageIDKey is the attribute Key conforming to the + // "messaging.message.id" semantic conventions. It represents a value used + // by the messaging system as an identifier for the message, represented as + // a string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '452a7c7c7c7048c2f887f61572b18fc2' + MessagingMessageIDKey = attribute.Key("messaging.message.id") + + // MessagingOperationKey is the attribute Key conforming to the + // "messaging.operation" semantic conventions. It represents a string + // identifying the kind of messaging operation. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: If a custom value is used, it MUST be of low cardinality. + MessagingOperationKey = attribute.Key("messaging.operation") + + // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key + // conforming to the "messaging.rabbitmq.destination.routing_key" semantic + // conventions. It represents the rabbitMQ message routing key. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myKey' + MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") + + // MessagingRocketmqClientGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.client_group" semantic conventions. It represents + // the name of the RocketMQ producer/consumer group that is handling the + // message. The client type is identified by the SpanKind. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myConsumerGroup' + MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") + + // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to + // the "messaging.rocketmq.consumption_model" semantic conventions. It + // represents the model of message consumption. This only applies to + // consumer spans. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") + + // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delay_time_level" semantic + // conventions. It represents the delay time level for delay message, which + // determines the message delay time. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3 + MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") + + // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key + // conforming to the "messaging.rocketmq.message.delivery_timestamp" + // semantic conventions. It represents the timestamp in milliseconds that + // the delay message is expected to be delivered to consumer. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1665987217045 + MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") + + // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the + // "messaging.rocketmq.message.group" semantic conventions. It represents + // the it is essential for FIFO message. Messages that belong to the same + // message group are always processed one by one within the same consumer + // group. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myMessageGroup' + MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") + + // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the + // "messaging.rocketmq.message.keys" semantic conventions. It represents + // the key(s) of message, another way to mark message besides message id. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'keyA', 'keyB' + MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") + + // MessagingRocketmqMessageTagKey is the attribute Key conforming to the + // "messaging.rocketmq.message.tag" semantic conventions. It represents the + // secondary classifier of message besides topic. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'tagA' + MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") + + // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the + // "messaging.rocketmq.message.type" semantic conventions. It represents + // the type of message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") + + // MessagingRocketmqNamespaceKey is the attribute Key conforming to the + // "messaging.rocketmq.namespace" semantic conventions. It represents the + // namespace of RocketMQ resources, resources in different namespaces are + // individual. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myNamespace' + MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") + + // MessagingSystemKey is the attribute Key conforming to the + // "messaging.system" semantic conventions. It represents an identifier for + // the messaging system being used. See below for a list of well-known + // identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessagingSystemKey = attribute.Key("messaging.system") +) + +var ( + // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created + MessagingOperationPublish = MessagingOperationKey.String("publish") + // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios + MessagingOperationCreate = MessagingOperationKey.String("create") + // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages + MessagingOperationReceive = MessagingOperationKey.String("receive") + // One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs + MessagingOperationDeliver = MessagingOperationKey.String("deliver") +) + +var ( + // Clustering consumption model + MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") + // Broadcasting consumption model + MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") +) + +var ( + // Normal message + MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") + // FIFO message + MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") + // Delay message + MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") + // Transaction message + MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") +) + +var ( + // Apache ActiveMQ + MessagingSystemActivemq = MessagingSystemKey.String("activemq") + // Amazon Simple Queue Service (SQS) + MessagingSystemAWSSqs = MessagingSystemKey.String("aws_sqs") + // Azure Event Grid + MessagingSystemAzureEventgrid = MessagingSystemKey.String("azure_eventgrid") + // Azure Event Hubs + MessagingSystemAzureEventhubs = MessagingSystemKey.String("azure_eventhubs") + // Azure Service Bus + MessagingSystemAzureServicebus = MessagingSystemKey.String("azure_servicebus") + // Google Cloud Pub/Sub + MessagingSystemGCPPubsub = MessagingSystemKey.String("gcp_pubsub") + // Java Message Service + MessagingSystemJms = MessagingSystemKey.String("jms") + // Apache Kafka + MessagingSystemKafka = MessagingSystemKey.String("kafka") + // RabbitMQ + MessagingSystemRabbitmq = MessagingSystemKey.String("rabbitmq") + // Apache RocketMQ + MessagingSystemRocketmq = MessagingSystemKey.String("rocketmq") +) + +// MessagingBatchMessageCount returns an attribute KeyValue conforming to +// the "messaging.batch.message_count" semantic conventions. It represents the +// number of messages sent, received, or processed in the scope of the batching +// operation. +func MessagingBatchMessageCount(val int) attribute.KeyValue { + return MessagingBatchMessageCountKey.Int(val) +} + +// MessagingClientID returns an attribute KeyValue conforming to the +// "messaging.client_id" semantic conventions. It represents a unique +// identifier for the client that consumes or produces a message. +func MessagingClientID(val string) attribute.KeyValue { + return MessagingClientIDKey.String(val) +} + +// MessagingDestinationAnonymous returns an attribute KeyValue conforming to +// the "messaging.destination.anonymous" semantic conventions. It represents a +// boolean that is true if the message destination is anonymous (could be +// unnamed or have auto-generated name). +func MessagingDestinationAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationAnonymousKey.Bool(val) +} + +// MessagingDestinationName returns an attribute KeyValue conforming to the +// "messaging.destination.name" semantic conventions. It represents the message +// destination name +func MessagingDestinationName(val string) attribute.KeyValue { + return MessagingDestinationNameKey.String(val) +} + +// MessagingDestinationTemplate returns an attribute KeyValue conforming to +// the "messaging.destination.template" semantic conventions. It represents the +// low cardinality representation of the messaging destination name +func MessagingDestinationTemplate(val string) attribute.KeyValue { + return MessagingDestinationTemplateKey.String(val) +} + +// MessagingDestinationTemporary returns an attribute KeyValue conforming to +// the "messaging.destination.temporary" semantic conventions. It represents a +// boolean that is true if the message destination is temporary and might not +// exist anymore after messages are processed. +func MessagingDestinationTemporary(val bool) attribute.KeyValue { + return MessagingDestinationTemporaryKey.Bool(val) +} + +// MessagingDestinationPublishAnonymous returns an attribute KeyValue +// conforming to the "messaging.destination_publish.anonymous" semantic +// conventions. It represents a boolean that is true if the publish message +// destination is anonymous (could be unnamed or have auto-generated name). +func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { + return MessagingDestinationPublishAnonymousKey.Bool(val) +} + +// MessagingDestinationPublishName returns an attribute KeyValue conforming +// to the "messaging.destination_publish.name" semantic conventions. It +// represents the name of the original destination the message was published to +func MessagingDestinationPublishName(val string) attribute.KeyValue { + return MessagingDestinationPublishNameKey.String(val) +} + +// MessagingGCPPubsubMessageOrderingKey returns an attribute KeyValue +// conforming to the "messaging.gcp_pubsub.message.ordering_key" semantic +// conventions. It represents the ordering key for a given message. If the +// attribute is not present, the message does not have an ordering key. +func MessagingGCPPubsubMessageOrderingKey(val string) attribute.KeyValue { + return MessagingGCPPubsubMessageOrderingKeyKey.String(val) +} + +// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to +// the "messaging.kafka.consumer.group" semantic conventions. It represents the +// name of the Kafka Consumer Group that is handling the message. Only applies +// to consumers, not producers. +func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { + return MessagingKafkaConsumerGroupKey.String(val) +} + +// MessagingKafkaDestinationPartition returns an attribute KeyValue +// conforming to the "messaging.kafka.destination.partition" semantic +// conventions. It represents the partition the message is sent to. +func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { + return MessagingKafkaDestinationPartitionKey.Int(val) +} + +// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the +// "messaging.kafka.message.key" semantic conventions. It represents the +// message keys in Kafka are used for grouping alike messages to ensure they're +// processed on the same partition. They differ from `messaging.message.id` in +// that they're not unique. If the key is `null`, the attribute MUST NOT be +// set. +func MessagingKafkaMessageKey(val string) attribute.KeyValue { + return MessagingKafkaMessageKeyKey.String(val) +} + +// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to +// the "messaging.kafka.message.offset" semantic conventions. It represents the +// offset of a record in the corresponding Kafka partition. +func MessagingKafkaMessageOffset(val int) attribute.KeyValue { + return MessagingKafkaMessageOffsetKey.Int(val) +} + +// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming +// to the "messaging.kafka.message.tombstone" semantic conventions. It +// represents a boolean that is true if the message is a tombstone. +func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { + return MessagingKafkaMessageTombstoneKey.Bool(val) +} + +// MessagingMessageBodySize returns an attribute KeyValue conforming to the +// "messaging.message.body.size" semantic conventions. It represents the size +// of the message body in bytes. +func MessagingMessageBodySize(val int) attribute.KeyValue { + return MessagingMessageBodySizeKey.Int(val) +} + +// MessagingMessageConversationID returns an attribute KeyValue conforming +// to the "messaging.message.conversation_id" semantic conventions. It +// represents the conversation ID identifying the conversation to which the +// message belongs, represented as a string. Sometimes called "Correlation ID". +func MessagingMessageConversationID(val string) attribute.KeyValue { + return MessagingMessageConversationIDKey.String(val) +} + +// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to +// the "messaging.message.envelope.size" semantic conventions. It represents +// the size of the message body and metadata in bytes. +func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { + return MessagingMessageEnvelopeSizeKey.Int(val) +} + +// MessagingMessageID returns an attribute KeyValue conforming to the +// "messaging.message.id" semantic conventions. It represents a value used by +// the messaging system as an identifier for the message, represented as a +// string. +func MessagingMessageID(val string) attribute.KeyValue { + return MessagingMessageIDKey.String(val) +} + +// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue +// conforming to the "messaging.rabbitmq.destination.routing_key" semantic +// conventions. It represents the rabbitMQ message routing key. +func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { + return MessagingRabbitmqDestinationRoutingKeyKey.String(val) +} + +// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.client_group" semantic conventions. It represents +// the name of the RocketMQ producer/consumer group that is handling the +// message. The client type is identified by the SpanKind. +func MessagingRocketmqClientGroup(val string) attribute.KeyValue { + return MessagingRocketmqClientGroupKey.String(val) +} + +// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delay_time_level" semantic +// conventions. It represents the delay time level for delay message, which +// determines the message delay time. +func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { + return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) +} + +// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue +// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic +// conventions. It represents the timestamp in milliseconds that the delay +// message is expected to be delivered to consumer. +func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { + return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) +} + +// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.group" semantic conventions. It represents +// the it is essential for FIFO message. Messages that belong to the same +// message group are always processed one by one within the same consumer +// group. +func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { + return MessagingRocketmqMessageGroupKey.String(val) +} + +// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.keys" semantic conventions. It represents +// the key(s) of message, another way to mark message besides message id. +func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { + return MessagingRocketmqMessageKeysKey.StringSlice(val) +} + +// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to +// the "messaging.rocketmq.message.tag" semantic conventions. It represents the +// secondary classifier of message besides topic. +func MessagingRocketmqMessageTag(val string) attribute.KeyValue { + return MessagingRocketmqMessageTagKey.String(val) +} + +// MessagingRocketmqNamespace returns an attribute KeyValue conforming to +// the "messaging.rocketmq.namespace" semantic conventions. It represents the +// namespace of RocketMQ resources, resources in different namespaces are +// individual. +func MessagingRocketmqNamespace(val string) attribute.KeyValue { + return MessagingRocketmqNamespaceKey.String(val) +} + +// These attributes may be used for any network related operation. +const ( + // NetworkCarrierIccKey is the attribute Key conforming to the + // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 + // alpha-2 2-character country code associated with the mobile carrier + // network. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'DE' + NetworkCarrierIccKey = attribute.Key("network.carrier.icc") + + // NetworkCarrierMccKey is the attribute Key conforming to the + // "network.carrier.mcc" semantic conventions. It represents the mobile + // carrier country code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '310' + NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") + + // NetworkCarrierMncKey is the attribute Key conforming to the + // "network.carrier.mnc" semantic conventions. It represents the mobile + // carrier network code. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '001' + NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") + + // NetworkCarrierNameKey is the attribute Key conforming to the + // "network.carrier.name" semantic conventions. It represents the name of + // the mobile carrier. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'sprint' + NetworkCarrierNameKey = attribute.Key("network.carrier.name") + + // NetworkConnectionSubtypeKey is the attribute Key conforming to the + // "network.connection.subtype" semantic conventions. It represents the + // this describes more details regarding the connection.type. It may be the + // type of cell technology connection, but it could be used for describing + // details about a wifi connection. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'LTE' + NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") + + // NetworkConnectionTypeKey is the attribute Key conforming to the + // "network.connection.type" semantic conventions. It represents the + // internet connection type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'wifi' + NetworkConnectionTypeKey = attribute.Key("network.connection.type") + + // NetworkIoDirectionKey is the attribute Key conforming to the + // "network.io.direction" semantic conventions. It represents the network + // IO operation direction. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'transmit' + NetworkIoDirectionKey = attribute.Key("network.io.direction") + + // NetworkLocalAddressKey is the attribute Key conforming to the + // "network.local.address" semantic conventions. It represents the local + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkLocalAddressKey = attribute.Key("network.local.address") + + // NetworkLocalPortKey is the attribute Key conforming to the + // "network.local.port" semantic conventions. It represents the local port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkLocalPortKey = attribute.Key("network.local.port") + + // NetworkPeerAddressKey is the attribute Key conforming to the + // "network.peer.address" semantic conventions. It represents the peer + // address of the network connection - IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '10.1.2.80', '/tmp/my.sock' + NetworkPeerAddressKey = attribute.Key("network.peer.address") + + // NetworkPeerPortKey is the attribute Key conforming to the + // "network.peer.port" semantic conventions. It represents the peer port + // number of the network connection. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 65123 + NetworkPeerPortKey = attribute.Key("network.peer.port") + + // NetworkProtocolNameKey is the attribute Key conforming to the + // "network.protocol.name" semantic conventions. It represents the [OSI + // application layer](https://osi-model.com/application-layer/) or non-OSI + // equivalent. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'amqp', 'http', 'mqtt' + // Note: The value SHOULD be normalized to lowercase. + NetworkProtocolNameKey = attribute.Key("network.protocol.name") + + // NetworkProtocolVersionKey is the attribute Key conforming to the + // "network.protocol.version" semantic conventions. It represents the + // version of the protocol specified in `network.protocol.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '3.1.1' + // Note: `network.protocol.version` refers to the version of the protocol + // used and might be different from the protocol client's version. If the + // HTTP client has a version of `0.27.2`, but sends HTTP version `1.1`, + // this attribute should be set to `1.1`. + NetworkProtocolVersionKey = attribute.Key("network.protocol.version") + + // NetworkTransportKey is the attribute Key conforming to the + // "network.transport" semantic conventions. It represents the [OSI + // transport layer](https://osi-model.com/transport-layer/) or + // [inter-process communication + // method](https://wikipedia.org/wiki/Inter-process_communication). + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'tcp', 'udp' + // Note: The value SHOULD be normalized to lowercase. + // + // Consider always setting the transport when setting a port number, since + // a port number is ambiguous without knowing the transport. For example + // different processes could be listening on TCP port 12345 and UDP port + // 12345. + NetworkTransportKey = attribute.Key("network.transport") + + // NetworkTypeKey is the attribute Key conforming to the "network.type" + // semantic conventions. It represents the [OSI network + // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: stable + // Examples: 'ipv4', 'ipv6' + // Note: The value SHOULD be normalized to lowercase. + NetworkTypeKey = attribute.Key("network.type") +) + +var ( + // GPRS + NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") + // EDGE + NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") + // UMTS + NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") + // CDMA + NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") + // EVDO Rel. 0 + NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") + // EVDO Rev. A + NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") + // CDMA2000 1XRTT + NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") + // HSDPA + NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") + // HSUPA + NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") + // HSPA + NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") + // IDEN + NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") + // EVDO Rev. B + NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") + // LTE + NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") + // EHRPD + NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") + // HSPAP + NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") + // GSM + NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") + // TD-SCDMA + NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") + // IWLAN + NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") + // 5G NR (New Radio) + NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") + // 5G NRNSA (New Radio Non-Standalone) + NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") + // LTE CA + NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") +) + +var ( + // wifi + NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") + // wired + NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") + // cell + NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") + // unavailable + NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") + // unknown + NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") +) + +var ( + // transmit + NetworkIoDirectionTransmit = NetworkIoDirectionKey.String("transmit") + // receive + NetworkIoDirectionReceive = NetworkIoDirectionKey.String("receive") +) + +var ( + // TCP + NetworkTransportTCP = NetworkTransportKey.String("tcp") + // UDP + NetworkTransportUDP = NetworkTransportKey.String("udp") + // Named or anonymous pipe + NetworkTransportPipe = NetworkTransportKey.String("pipe") + // Unix domain socket + NetworkTransportUnix = NetworkTransportKey.String("unix") +) + +var ( + // IPv4 + NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") + // IPv6 + NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") +) + +// NetworkCarrierIcc returns an attribute KeyValue conforming to the +// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 +// alpha-2 2-character country code associated with the mobile carrier network. +func NetworkCarrierIcc(val string) attribute.KeyValue { + return NetworkCarrierIccKey.String(val) +} + +// NetworkCarrierMcc returns an attribute KeyValue conforming to the +// "network.carrier.mcc" semantic conventions. It represents the mobile carrier +// country code. +func NetworkCarrierMcc(val string) attribute.KeyValue { + return NetworkCarrierMccKey.String(val) +} + +// NetworkCarrierMnc returns an attribute KeyValue conforming to the +// "network.carrier.mnc" semantic conventions. It represents the mobile carrier +// network code. +func NetworkCarrierMnc(val string) attribute.KeyValue { + return NetworkCarrierMncKey.String(val) +} + +// NetworkCarrierName returns an attribute KeyValue conforming to the +// "network.carrier.name" semantic conventions. It represents the name of the +// mobile carrier. +func NetworkCarrierName(val string) attribute.KeyValue { + return NetworkCarrierNameKey.String(val) +} + +// NetworkLocalAddress returns an attribute KeyValue conforming to the +// "network.local.address" semantic conventions. It represents the local +// address of the network connection - IP address or Unix domain socket name. +func NetworkLocalAddress(val string) attribute.KeyValue { + return NetworkLocalAddressKey.String(val) +} + +// NetworkLocalPort returns an attribute KeyValue conforming to the +// "network.local.port" semantic conventions. It represents the local port +// number of the network connection. +func NetworkLocalPort(val int) attribute.KeyValue { + return NetworkLocalPortKey.Int(val) +} + +// NetworkPeerAddress returns an attribute KeyValue conforming to the +// "network.peer.address" semantic conventions. It represents the peer address +// of the network connection - IP address or Unix domain socket name. +func NetworkPeerAddress(val string) attribute.KeyValue { + return NetworkPeerAddressKey.String(val) +} + +// NetworkPeerPort returns an attribute KeyValue conforming to the +// "network.peer.port" semantic conventions. It represents the peer port number +// of the network connection. +func NetworkPeerPort(val int) attribute.KeyValue { + return NetworkPeerPortKey.Int(val) +} + +// NetworkProtocolName returns an attribute KeyValue conforming to the +// "network.protocol.name" semantic conventions. It represents the [OSI +// application layer](https://osi-model.com/application-layer/) or non-OSI +// equivalent. +func NetworkProtocolName(val string) attribute.KeyValue { + return NetworkProtocolNameKey.String(val) +} + +// NetworkProtocolVersion returns an attribute KeyValue conforming to the +// "network.protocol.version" semantic conventions. It represents the version +// of the protocol specified in `network.protocol.name`. +func NetworkProtocolVersion(val string) attribute.KeyValue { + return NetworkProtocolVersionKey.String(val) +} + +// Attributes for remote procedure calls. +const ( + // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the + // "rpc.connect_rpc.error_code" semantic conventions. It represents the + // [error codes](https://connect.build/docs/protocol/#error-codes) of the + // Connect request. Error codes are always string values. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") + + // RPCGRPCStatusCodeKey is the attribute Key conforming to the + // "rpc.grpc.status_code" semantic conventions. It represents the [numeric + // status + // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of + // the gRPC request. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") + + // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_code" semantic conventions. It represents the + // `error.code` property of response if it is an error response. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: -32700, 100 + RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") + + // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the + // "rpc.jsonrpc.error_message" semantic conventions. It represents the + // `error.message` property of response if it is an error response. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Parse error', 'User already exists' + RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") + + // RPCJsonrpcRequestIDKey is the attribute Key conforming to the + // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` + // property of request or response. Since protocol allows id to be int, + // string, `null` or missing (for notifications), value is expected to be + // cast to string for simplicity. Use empty string in case of `null` value. + // Omit entirely if this is a notification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '10', 'request-7', '' + RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") + + // RPCJsonrpcVersionKey is the attribute Key conforming to the + // "rpc.jsonrpc.version" semantic conventions. It represents the protocol + // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 + // doesn't specify this, the value can be omitted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0', '1.0' + RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") + + // RPCMethodKey is the attribute Key conforming to the "rpc.method" + // semantic conventions. It represents the name of the (logical) method + // being called, must be equal to the $method part in the span name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'exampleMethod' + // Note: This is the logical name of the method from the RPC interface + // perspective, which can be different from the name of any implementing + // method/function. The `code.function` attribute may be used to store the + // latter (e.g., method actually executing the call on the server side, RPC + // client stub method on the client side). + RPCMethodKey = attribute.Key("rpc.method") + + // RPCServiceKey is the attribute Key conforming to the "rpc.service" + // semantic conventions. It represents the full (logical) name of the + // service being called, including its package name, if applicable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myservice.EchoService' + // Note: This is the logical name of the service from the RPC interface + // perspective, which can be different from the name of any implementing + // class. The `code.namespace` attribute may be used to store the latter + // (despite the attribute name, it may include a class name; e.g., class + // with method actually executing the call on the server side, RPC client + // stub class on the client side). + RPCServiceKey = attribute.Key("rpc.service") + + // RPCSystemKey is the attribute Key conforming to the "rpc.system" + // semantic conventions. It represents a string identifying the remoting + // system. See below for a list of well-known identifiers. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + RPCSystemKey = attribute.Key("rpc.system") +) + +var ( + // cancelled + RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") + // unknown + RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") + // invalid_argument + RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") + // deadline_exceeded + RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") + // not_found + RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") + // already_exists + RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") + // permission_denied + RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") + // resource_exhausted + RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") + // failed_precondition + RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") + // aborted + RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") + // out_of_range + RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") + // unimplemented + RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") + // internal + RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") + // unavailable + RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") + // data_loss + RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") + // unauthenticated + RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") +) + +var ( + // OK + RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) + // CANCELLED + RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) + // UNKNOWN + RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) + // INVALID_ARGUMENT + RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) + // DEADLINE_EXCEEDED + RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) + // NOT_FOUND + RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) + // ALREADY_EXISTS + RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) + // PERMISSION_DENIED + RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) + // RESOURCE_EXHAUSTED + RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) + // FAILED_PRECONDITION + RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) + // ABORTED + RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) + // OUT_OF_RANGE + RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) + // UNIMPLEMENTED + RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) + // INTERNAL + RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) + // UNAVAILABLE + RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) + // DATA_LOSS + RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) + // UNAUTHENTICATED + RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) +) + +var ( + // gRPC + RPCSystemGRPC = RPCSystemKey.String("grpc") + // Java RMI + RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") + // .NET WCF + RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") + // Apache Dubbo + RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") + // Connect RPC + RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") +) + +// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_code" semantic conventions. It represents the +// `error.code` property of response if it is an error response. +func RPCJsonrpcErrorCode(val int) attribute.KeyValue { + return RPCJsonrpcErrorCodeKey.Int(val) +} + +// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.error_message" semantic conventions. It represents the +// `error.message` property of response if it is an error response. +func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { + return RPCJsonrpcErrorMessageKey.String(val) +} + +// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` +// property of request or response. Since protocol allows id to be int, string, +// `null` or missing (for notifications), value is expected to be cast to +// string for simplicity. Use empty string in case of `null` value. Omit +// entirely if this is a notification. +func RPCJsonrpcRequestID(val string) attribute.KeyValue { + return RPCJsonrpcRequestIDKey.String(val) +} + +// RPCJsonrpcVersion returns an attribute KeyValue conforming to the +// "rpc.jsonrpc.version" semantic conventions. It represents the protocol +// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 +// doesn't specify this, the value can be omitted. +func RPCJsonrpcVersion(val string) attribute.KeyValue { + return RPCJsonrpcVersionKey.String(val) +} + +// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" +// semantic conventions. It represents the name of the (logical) method being +// called, must be equal to the $method part in the span name. +func RPCMethod(val string) attribute.KeyValue { + return RPCMethodKey.String(val) +} + +// RPCService returns an attribute KeyValue conforming to the "rpc.service" +// semantic conventions. It represents the full (logical) name of the service +// being called, including its package name, if applicable. +func RPCService(val string) attribute.KeyValue { + return RPCServiceKey.String(val) +} + +// These attributes may be used to describe the server in a connection-based +// network interaction where there is one side that initiates the connection +// (the client is the side that initiates the connection). This covers all TCP +// network interactions since TCP is connection-based and one side initiates +// the connection (an exception is made for peer-to-peer communication over TCP +// where the "user-facing" surface of the protocol / API doesn't expose a clear +// notion of client and server). This also covers UDP network interactions +// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +const ( + // ServerAddressKey is the attribute Key conforming to the "server.address" + // semantic conventions. It represents the server domain name if available + // without reverse DNS lookup; otherwise, IP address or Unix domain socket + // name. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.address` SHOULD represent the server address + // behind any intermediaries, for example proxies, if it's available. + ServerAddressKey = attribute.Key("server.address") + + // ServerPortKey is the attribute Key conforming to the "server.port" + // semantic conventions. It represents the server port number. + // + // Type: int + // RequirementLevel: Optional + // Stability: stable + // Examples: 80, 8080, 443 + // Note: When observed from the client side, and when communicating through + // an intermediary, `server.port` SHOULD represent the server port behind + // any intermediaries, for example proxies, if it's available. + ServerPortKey = attribute.Key("server.port") +) + +// ServerAddress returns an attribute KeyValue conforming to the +// "server.address" semantic conventions. It represents the server domain name +// if available without reverse DNS lookup; otherwise, IP address or Unix +// domain socket name. +func ServerAddress(val string) attribute.KeyValue { + return ServerAddressKey.String(val) +} + +// ServerPort returns an attribute KeyValue conforming to the "server.port" +// semantic conventions. It represents the server port number. +func ServerPort(val int) attribute.KeyValue { + return ServerPortKey.Int(val) +} + +// These attributes may be used to describe the sender of a network +// exchange/packet. These should be used when there is no client/server +// relationship between the two sides, or when that relationship is unknown. +// This covers low-level network interactions (e.g. packet tracing) where you +// don't know if there was a connection or which side initiated it. This also +// covers unidirectional UDP flows and peer-to-peer communication where the +// "user-facing" surface of the protocol / API doesn't expose a clear notion of +// client and server. +const ( + // SourceAddressKey is the attribute Key conforming to the "source.address" + // semantic conventions. It represents the source address - domain name if + // available without reverse DNS lookup; otherwise, IP address or Unix + // domain socket name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' + // Note: When observed from the destination side, and when communicating + // through an intermediary, `source.address` SHOULD represent the source + // address behind any intermediaries, for example proxies, if it's + // available. + SourceAddressKey = attribute.Key("source.address") + + // SourcePortKey is the attribute Key conforming to the "source.port" + // semantic conventions. It represents the source port number + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3389, 2888 + SourcePortKey = attribute.Key("source.port") +) + +// SourceAddress returns an attribute KeyValue conforming to the +// "source.address" semantic conventions. It represents the source address - +// domain name if available without reverse DNS lookup; otherwise, IP address +// or Unix domain socket name. +func SourceAddress(val string) attribute.KeyValue { + return SourceAddressKey.String(val) +} + +// SourcePort returns an attribute KeyValue conforming to the "source.port" +// semantic conventions. It represents the source port number +func SourcePort(val int) attribute.KeyValue { + return SourcePortKey.Int(val) +} + +// Semantic convention attributes in the TLS namespace. +const ( + // TLSCipherKey is the attribute Key conforming to the "tls.cipher" + // semantic conventions. It represents the string indicating the + // [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) + // used during the current connection. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TLS_RSA_WITH_3DES_EDE_CBC_SHA', + // 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256' + // Note: The values allowed for `tls.cipher` MUST be one of the + // `Descriptions` of the [registered TLS Cipher + // Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). + TLSCipherKey = attribute.Key("tls.cipher") + + // TLSClientCertificateKey is the attribute Key conforming to the + // "tls.client.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the client. This is + // usually mutually-exclusive of `client.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSClientCertificateKey = attribute.Key("tls.client.certificate") + + // TLSClientCertificateChainKey is the attribute Key conforming to the + // "tls.client.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the client. This is usually mutually-exclusive of + // `client.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") + + // TLSClientHashMd5Key is the attribute Key conforming to the + // "tls.client.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") + + // TLSClientHashSha1Key is the attribute Key conforming to the + // "tls.client.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") + + // TLSClientHashSha256Key is the attribute Key conforming to the + // "tls.client.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the client. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") + + // TLSClientIssuerKey is the attribute Key conforming to the + // "tls.client.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSClientIssuerKey = attribute.Key("tls.client.issuer") + + // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" + // semantic conventions. It represents a hash that identifies clients based + // on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSClientJa3Key = attribute.Key("tls.client.ja3") + + // TLSClientNotAfterKey is the attribute Key conforming to the + // "tls.client.not_after" semantic conventions. It represents the date/Time + // indicating when client certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSClientNotAfterKey = attribute.Key("tls.client.not_after") + + // TLSClientNotBeforeKey is the attribute Key conforming to the + // "tls.client.not_before" semantic conventions. It represents the + // date/Time indicating when client certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") + + // TLSClientServerNameKey is the attribute Key conforming to the + // "tls.client.server_name" semantic conventions. It represents the also + // called an SNI, this tells the server which hostname to which the client + // is attempting to connect to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry.io' + TLSClientServerNameKey = attribute.Key("tls.client.server_name") + + // TLSClientSubjectKey is the attribute Key conforming to the + // "tls.client.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myclient, OU=Documentation Team, DC=example, DC=com' + TLSClientSubjectKey = attribute.Key("tls.client.subject") + + // TLSClientSupportedCiphersKey is the attribute Key conforming to the + // "tls.client.supported_ciphers" semantic conventions. It represents the + // array of ciphers offered by the client during the client hello. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", + // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "..."' + TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") + + // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic + // conventions. It represents the string indicating the curve used for the + // given cipher, when applicable + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'secp256r1' + TLSCurveKey = attribute.Key("tls.curve") + + // TLSEstablishedKey is the attribute Key conforming to the + // "tls.established" semantic conventions. It represents the boolean flag + // indicating if the TLS negotiation was successful and transitioned to an + // encrypted tunnel. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSEstablishedKey = attribute.Key("tls.established") + + // TLSNextProtocolKey is the attribute Key conforming to the + // "tls.next_protocol" semantic conventions. It represents the string + // indicating the protocol being tunneled. Per the values in the [IANA + // registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), + // this string should be lower case. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'http/1.1' + TLSNextProtocolKey = attribute.Key("tls.next_protocol") + + // TLSProtocolNameKey is the attribute Key conforming to the + // "tls.protocol.name" semantic conventions. It represents the normalized + // lowercase protocol name parsed from original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + TLSProtocolNameKey = attribute.Key("tls.protocol.name") + + // TLSProtocolVersionKey is the attribute Key conforming to the + // "tls.protocol.version" semantic conventions. It represents the numeric + // part of the version parsed from the original string of the negotiated + // [SSL/TLS protocol + // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2', '3' + TLSProtocolVersionKey = attribute.Key("tls.protocol.version") + + // TLSResumedKey is the attribute Key conforming to the "tls.resumed" + // semantic conventions. It represents the boolean flag indicating if this + // TLS connection was resumed from an existing TLS negotiation. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Examples: True + TLSResumedKey = attribute.Key("tls.resumed") + + // TLSServerCertificateKey is the attribute Key conforming to the + // "tls.server.certificate" semantic conventions. It represents the + // pEM-encoded stand-alone certificate offered by the server. This is + // usually mutually-exclusive of `server.certificate_chain` since this + // value also exists in that list. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...' + TLSServerCertificateKey = attribute.Key("tls.server.certificate") + + // TLSServerCertificateChainKey is the attribute Key conforming to the + // "tls.server.certificate_chain" semantic conventions. It represents the + // array of PEM-encoded certificates that make up the certificate chain + // offered by the server. This is usually mutually-exclusive of + // `server.certificate` since that value should be the first certificate in + // the chain. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'MII...', 'MI...' + TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") + + // TLSServerHashMd5Key is the attribute Key conforming to the + // "tls.server.hash.md5" semantic conventions. It represents the + // certificate fingerprint using the MD5 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' + TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") + + // TLSServerHashSha1Key is the attribute Key conforming to the + // "tls.server.hash.sha1" semantic conventions. It represents the + // certificate fingerprint using the SHA1 digest of DER-encoded version of + // certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' + TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") + + // TLSServerHashSha256Key is the attribute Key conforming to the + // "tls.server.hash.sha256" semantic conventions. It represents the + // certificate fingerprint using the SHA256 digest of DER-encoded version + // of certificate offered by the server. For consistency with other hash + // values, this value should be formatted as an uppercase hash. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' + TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") + + // TLSServerIssuerKey is the attribute Key conforming to the + // "tls.server.issuer" semantic conventions. It represents the + // distinguished name of + // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) + // of the issuer of the x.509 certificate presented by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, + // DC=com' + TLSServerIssuerKey = attribute.Key("tls.server.issuer") + + // TLSServerJa3sKey is the attribute Key conforming to the + // "tls.server.ja3s" semantic conventions. It represents a hash that + // identifies servers based on how they perform an SSL/TLS handshake. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'd4e5b18d6b55c71272893221c96ba240' + TLSServerJa3sKey = attribute.Key("tls.server.ja3s") + + // TLSServerNotAfterKey is the attribute Key conforming to the + // "tls.server.not_after" semantic conventions. It represents the date/Time + // indicating when server certificate is no longer considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021-01-01T00:00:00.000Z' + TLSServerNotAfterKey = attribute.Key("tls.server.not_after") + + // TLSServerNotBeforeKey is the attribute Key conforming to the + // "tls.server.not_before" semantic conventions. It represents the + // date/Time indicating when server certificate is first considered valid. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1970-01-01T00:00:00.000Z' + TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") + + // TLSServerSubjectKey is the attribute Key conforming to the + // "tls.server.subject" semantic conventions. It represents the + // distinguished name of subject of the x.509 certificate presented by the + // server. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'CN=myserver, OU=Documentation Team, DC=example, DC=com' + TLSServerSubjectKey = attribute.Key("tls.server.subject") +) + +var ( + // ssl + TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") + // tls + TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") +) + +// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" +// semantic conventions. It represents the string indicating the +// [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used +// during the current connection. +func TLSCipher(val string) attribute.KeyValue { + return TLSCipherKey.String(val) +} + +// TLSClientCertificate returns an attribute KeyValue conforming to the +// "tls.client.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the client. This is usually +// mutually-exclusive of `client.certificate_chain` since this value also +// exists in that list. +func TLSClientCertificate(val string) attribute.KeyValue { + return TLSClientCertificateKey.String(val) +} + +// TLSClientCertificateChain returns an attribute KeyValue conforming to the +// "tls.client.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the client. This is usually mutually-exclusive of `client.certificate` since +// that value should be the first certificate in the chain. +func TLSClientCertificateChain(val ...string) attribute.KeyValue { + return TLSClientCertificateChainKey.StringSlice(val) +} + +// TLSClientHashMd5 returns an attribute KeyValue conforming to the +// "tls.client.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashMd5(val string) attribute.KeyValue { + return TLSClientHashMd5Key.String(val) +} + +// TLSClientHashSha1 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha1(val string) attribute.KeyValue { + return TLSClientHashSha1Key.String(val) +} + +// TLSClientHashSha256 returns an attribute KeyValue conforming to the +// "tls.client.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the client. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSClientHashSha256(val string) attribute.KeyValue { + return TLSClientHashSha256Key.String(val) +} + +// TLSClientIssuer returns an attribute KeyValue conforming to the +// "tls.client.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSClientIssuer(val string) attribute.KeyValue { + return TLSClientIssuerKey.String(val) +} + +// TLSClientJa3 returns an attribute KeyValue conforming to the +// "tls.client.ja3" semantic conventions. It represents a hash that identifies +// clients based on how they perform an SSL/TLS handshake. +func TLSClientJa3(val string) attribute.KeyValue { + return TLSClientJa3Key.String(val) +} + +// TLSClientNotAfter returns an attribute KeyValue conforming to the +// "tls.client.not_after" semantic conventions. It represents the date/Time +// indicating when client certificate is no longer considered valid. +func TLSClientNotAfter(val string) attribute.KeyValue { + return TLSClientNotAfterKey.String(val) +} + +// TLSClientNotBefore returns an attribute KeyValue conforming to the +// "tls.client.not_before" semantic conventions. It represents the date/Time +// indicating when client certificate is first considered valid. +func TLSClientNotBefore(val string) attribute.KeyValue { + return TLSClientNotBeforeKey.String(val) +} + +// TLSClientServerName returns an attribute KeyValue conforming to the +// "tls.client.server_name" semantic conventions. It represents the also called +// an SNI, this tells the server which hostname to which the client is +// attempting to connect to. +func TLSClientServerName(val string) attribute.KeyValue { + return TLSClientServerNameKey.String(val) +} + +// TLSClientSubject returns an attribute KeyValue conforming to the +// "tls.client.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the client. +func TLSClientSubject(val string) attribute.KeyValue { + return TLSClientSubjectKey.String(val) +} + +// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the +// "tls.client.supported_ciphers" semantic conventions. It represents the array +// of ciphers offered by the client during the client hello. +func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { + return TLSClientSupportedCiphersKey.StringSlice(val) +} + +// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" +// semantic conventions. It represents the string indicating the curve used for +// the given cipher, when applicable +func TLSCurve(val string) attribute.KeyValue { + return TLSCurveKey.String(val) +} + +// TLSEstablished returns an attribute KeyValue conforming to the +// "tls.established" semantic conventions. It represents the boolean flag +// indicating if the TLS negotiation was successful and transitioned to an +// encrypted tunnel. +func TLSEstablished(val bool) attribute.KeyValue { + return TLSEstablishedKey.Bool(val) +} + +// TLSNextProtocol returns an attribute KeyValue conforming to the +// "tls.next_protocol" semantic conventions. It represents the string +// indicating the protocol being tunneled. Per the values in the [IANA +// registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), +// this string should be lower case. +func TLSNextProtocol(val string) attribute.KeyValue { + return TLSNextProtocolKey.String(val) +} + +// TLSProtocolVersion returns an attribute KeyValue conforming to the +// "tls.protocol.version" semantic conventions. It represents the numeric part +// of the version parsed from the original string of the negotiated [SSL/TLS +// protocol +// version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) +func TLSProtocolVersion(val string) attribute.KeyValue { + return TLSProtocolVersionKey.String(val) +} + +// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" +// semantic conventions. It represents the boolean flag indicating if this TLS +// connection was resumed from an existing TLS negotiation. +func TLSResumed(val bool) attribute.KeyValue { + return TLSResumedKey.Bool(val) +} + +// TLSServerCertificate returns an attribute KeyValue conforming to the +// "tls.server.certificate" semantic conventions. It represents the pEM-encoded +// stand-alone certificate offered by the server. This is usually +// mutually-exclusive of `server.certificate_chain` since this value also +// exists in that list. +func TLSServerCertificate(val string) attribute.KeyValue { + return TLSServerCertificateKey.String(val) +} + +// TLSServerCertificateChain returns an attribute KeyValue conforming to the +// "tls.server.certificate_chain" semantic conventions. It represents the array +// of PEM-encoded certificates that make up the certificate chain offered by +// the server. This is usually mutually-exclusive of `server.certificate` since +// that value should be the first certificate in the chain. +func TLSServerCertificateChain(val ...string) attribute.KeyValue { + return TLSServerCertificateChainKey.StringSlice(val) +} + +// TLSServerHashMd5 returns an attribute KeyValue conforming to the +// "tls.server.hash.md5" semantic conventions. It represents the certificate +// fingerprint using the MD5 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashMd5(val string) attribute.KeyValue { + return TLSServerHashMd5Key.String(val) +} + +// TLSServerHashSha1 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha1" semantic conventions. It represents the certificate +// fingerprint using the SHA1 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha1(val string) attribute.KeyValue { + return TLSServerHashSha1Key.String(val) +} + +// TLSServerHashSha256 returns an attribute KeyValue conforming to the +// "tls.server.hash.sha256" semantic conventions. It represents the certificate +// fingerprint using the SHA256 digest of DER-encoded version of certificate +// offered by the server. For consistency with other hash values, this value +// should be formatted as an uppercase hash. +func TLSServerHashSha256(val string) attribute.KeyValue { + return TLSServerHashSha256Key.String(val) +} + +// TLSServerIssuer returns an attribute KeyValue conforming to the +// "tls.server.issuer" semantic conventions. It represents the distinguished +// name of +// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of +// the issuer of the x.509 certificate presented by the client. +func TLSServerIssuer(val string) attribute.KeyValue { + return TLSServerIssuerKey.String(val) +} + +// TLSServerJa3s returns an attribute KeyValue conforming to the +// "tls.server.ja3s" semantic conventions. It represents a hash that identifies +// servers based on how they perform an SSL/TLS handshake. +func TLSServerJa3s(val string) attribute.KeyValue { + return TLSServerJa3sKey.String(val) +} + +// TLSServerNotAfter returns an attribute KeyValue conforming to the +// "tls.server.not_after" semantic conventions. It represents the date/Time +// indicating when server certificate is no longer considered valid. +func TLSServerNotAfter(val string) attribute.KeyValue { + return TLSServerNotAfterKey.String(val) +} + +// TLSServerNotBefore returns an attribute KeyValue conforming to the +// "tls.server.not_before" semantic conventions. It represents the date/Time +// indicating when server certificate is first considered valid. +func TLSServerNotBefore(val string) attribute.KeyValue { + return TLSServerNotBeforeKey.String(val) +} + +// TLSServerSubject returns an attribute KeyValue conforming to the +// "tls.server.subject" semantic conventions. It represents the distinguished +// name of subject of the x.509 certificate presented by the server. +func TLSServerSubject(val string) attribute.KeyValue { + return TLSServerSubjectKey.String(val) +} + +// Attributes describing URL. +const ( + // URLFragmentKey is the attribute Key conforming to the "url.fragment" + // semantic conventions. It represents the [URI + // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'SemConv' + URLFragmentKey = attribute.Key("url.fragment") + + // URLFullKey is the attribute Key conforming to the "url.full" semantic + // conventions. It represents the absolute URL describing a network + // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', + // '//localhost' + // Note: For network calls, URL usually has + // `scheme://host[:port][path][?query][#fragment]` format, where the + // fragment is not transmitted over HTTP, but if it is known, it SHOULD be + // included nevertheless. + // `url.full` MUST NOT contain credentials passed via URL in form of + // `https://username:password@www.example.com/`. In such case username and + // password SHOULD be redacted and attribute's value SHOULD be + // `https://REDACTED:REDACTED@www.example.com/`. + // `url.full` SHOULD capture the absolute URL when it is available (or can + // be reconstructed) and SHOULD NOT be validated or modified except for + // sanitizing purposes. + URLFullKey = attribute.Key("url.full") + + // URLPathKey is the attribute Key conforming to the "url.path" semantic + // conventions. It represents the [URI + // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: '/search' + URLPathKey = attribute.Key("url.path") + + // URLQueryKey is the attribute Key conforming to the "url.query" semantic + // conventions. It represents the [URI + // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'q=OpenTelemetry' + // Note: Sensitive content provided in query string SHOULD be scrubbed when + // instrumentations can identify it. + URLQueryKey = attribute.Key("url.query") + + // URLSchemeKey is the attribute Key conforming to the "url.scheme" + // semantic conventions. It represents the [URI + // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component + // identifying the used protocol. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'https', 'ftp', 'telnet' + URLSchemeKey = attribute.Key("url.scheme") +) + +// URLFragment returns an attribute KeyValue conforming to the +// "url.fragment" semantic conventions. It represents the [URI +// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component +func URLFragment(val string) attribute.KeyValue { + return URLFragmentKey.String(val) +} + +// URLFull returns an attribute KeyValue conforming to the "url.full" +// semantic conventions. It represents the absolute URL describing a network +// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) +func URLFull(val string) attribute.KeyValue { + return URLFullKey.String(val) +} + +// URLPath returns an attribute KeyValue conforming to the "url.path" +// semantic conventions. It represents the [URI +// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component +func URLPath(val string) attribute.KeyValue { + return URLPathKey.String(val) +} + +// URLQuery returns an attribute KeyValue conforming to the "url.query" +// semantic conventions. It represents the [URI +// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component +func URLQuery(val string) attribute.KeyValue { + return URLQueryKey.String(val) +} + +// URLScheme returns an attribute KeyValue conforming to the "url.scheme" +// semantic conventions. It represents the [URI +// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component +// identifying the used protocol. +func URLScheme(val string) attribute.KeyValue { + return URLSchemeKey.String(val) +} + +// Describes user-agent attributes. +const ( + // UserAgentOriginalKey is the attribute Key conforming to the + // "user_agent.original" semantic conventions. It represents the value of + // the [HTTP + // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) + // header sent by the client. + // + // Type: string + // RequirementLevel: Optional + // Stability: stable + // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU + // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) + // Version/14.1.2 Mobile/15E148 Safari/604.1' + UserAgentOriginalKey = attribute.Key("user_agent.original") +) + +// UserAgentOriginal returns an attribute KeyValue conforming to the +// "user_agent.original" semantic conventions. It represents the value of the +// [HTTP +// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) +// header sent by the client. +func UserAgentOriginal(val string) attribute.KeyValue { + return UserAgentOriginalKey.String(val) +} + +// Session is defined as the period of time encompassing all activities +// performed by the application and the actions executed by the end user. +// Consequently, a Session is represented as a collection of Logs, Events, and +// Spans emitted by the Client Application throughout the Session's duration. +// Each Session is assigned a unique identifier, which is included as an +// attribute in the Logs, Events, and Spans generated during the Session's +// lifecycle. +// When a session reaches end of life, typically due to user inactivity or +// session timeout, a new session identifier will be assigned. The previous +// session identifier may be provided by the instrumentation so that telemetry +// backends can link the two sessions. +const ( + // SessionIDKey is the attribute Key conforming to the "session.id" + // semantic conventions. It represents a unique id to identify a session. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionIDKey = attribute.Key("session.id") + + // SessionPreviousIDKey is the attribute Key conforming to the + // "session.previous_id" semantic conventions. It represents the previous + // `session.id` for this user, when known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '00112233-4455-6677-8899-aabbccddeeff' + SessionPreviousIDKey = attribute.Key("session.previous_id") +) + +// SessionID returns an attribute KeyValue conforming to the "session.id" +// semantic conventions. It represents a unique id to identify a session. +func SessionID(val string) attribute.KeyValue { + return SessionIDKey.String(val) +} + +// SessionPreviousID returns an attribute KeyValue conforming to the +// "session.previous_id" semantic conventions. It represents the previous +// `session.id` for this user, when known. +func SessionPreviousID(val string) attribute.KeyValue { + return SessionPreviousIDKey.String(val) +} diff --git a/semconv/v1.24.0/doc.go b/semconv/v1.24.0/doc.go new file mode 100644 index 00000000000..9b802db2722 --- /dev/null +++ b/semconv/v1.24.0/doc.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package semconv implements OpenTelemetry semantic conventions. +// +// OpenTelemetry semantic conventions are agreed standardized naming +// patterns for OpenTelemetry things. This package represents the v1.24.0 +// version of the OpenTelemetry semantic conventions. +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" diff --git a/semconv/v1.24.0/event.go b/semconv/v1.24.0/event.go new file mode 100644 index 00000000000..cd3c7162955 --- /dev/null +++ b/semconv/v1.24.0/event.go @@ -0,0 +1,211 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// This event represents an occurrence of a lifecycle transition on the iOS +// platform. +const ( + // IosStateKey is the attribute Key conforming to the "ios.state" semantic + // conventions. It represents the this attribute represents the state the + // application has transitioned into at the occurrence of the event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The iOS lifecycle states are defined in the [UIApplicationDelegate + // documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), + // and from which the `OS terminology` column values are derived. + IosStateKey = attribute.Key("ios.state") +) + +var ( + // The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive` + IosStateActive = IosStateKey.String("active") + // The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive` + IosStateInactive = IosStateKey.String("inactive") + // The app is now in the background. This value is associated with UIKit notification `applicationDidEnterBackground` + IosStateBackground = IosStateKey.String("background") + // The app is now in the foreground. This value is associated with UIKit notification `applicationWillEnterForeground` + IosStateForeground = IosStateKey.String("foreground") + // The app is about to terminate. Associated with UIKit notification `applicationWillTerminate` + IosStateTerminate = IosStateKey.String("terminate") +) + +// This event represents an occurrence of a lifecycle transition on the Android +// platform. +const ( + // AndroidStateKey is the attribute Key conforming to the "android.state" + // semantic conventions. It represents the this attribute represents the + // state the application has transitioned into at the occurrence of the + // event. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + // Note: The Android lifecycle states are defined in [Activity lifecycle + // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), + // and from which the `OS identifiers` are derived. + AndroidStateKey = attribute.Key("android.state") +) + +var ( + // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time + AndroidStateCreated = AndroidStateKey.String("created") + // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state + AndroidStateBackground = AndroidStateKey.String("background") + // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states + AndroidStateForeground = AndroidStateKey.String("foreground") +) + +// This semantic convention defines the attributes used to represent a feature +// flag evaluation as an event. +const ( + // FeatureFlagKeyKey is the attribute Key conforming to the + // "feature_flag.key" semantic conventions. It represents the unique + // identifier of the feature flag. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'logo-color' + FeatureFlagKeyKey = attribute.Key("feature_flag.key") + + // FeatureFlagProviderNameKey is the attribute Key conforming to the + // "feature_flag.provider_name" semantic conventions. It represents the + // name of the service provider that performs the flag evaluation. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'Flag Manager' + FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") + + // FeatureFlagVariantKey is the attribute Key conforming to the + // "feature_flag.variant" semantic conventions. It represents the sHOULD be + // a semantic identifier for a value. If one is unavailable, a stringified + // version of the value can be used. + // + // Type: string + // RequirementLevel: Recommended + // Stability: experimental + // Examples: 'red', 'true', 'on' + // Note: A semantic identifier, commonly referred to as a variant, provides + // a means + // for referring to a value without including the value itself. This can + // provide additional context for understanding the meaning behind a value. + // For example, the variant `red` maybe be used for the value `#c05543`. + // + // A stringified version of the value can be used in situations where a + // semantic identifier is unavailable. String representation of the value + // should be determined by the implementer. + FeatureFlagVariantKey = attribute.Key("feature_flag.variant") +) + +// FeatureFlagKey returns an attribute KeyValue conforming to the +// "feature_flag.key" semantic conventions. It represents the unique identifier +// of the feature flag. +func FeatureFlagKey(val string) attribute.KeyValue { + return FeatureFlagKeyKey.String(val) +} + +// FeatureFlagProviderName returns an attribute KeyValue conforming to the +// "feature_flag.provider_name" semantic conventions. It represents the name of +// the service provider that performs the flag evaluation. +func FeatureFlagProviderName(val string) attribute.KeyValue { + return FeatureFlagProviderNameKey.String(val) +} + +// FeatureFlagVariant returns an attribute KeyValue conforming to the +// "feature_flag.variant" semantic conventions. It represents the sHOULD be a +// semantic identifier for a value. If one is unavailable, a stringified +// version of the value can be used. +func FeatureFlagVariant(val string) attribute.KeyValue { + return FeatureFlagVariantKey.String(val) +} + +// RPC received/sent message. +const ( + // MessageCompressedSizeKey is the attribute Key conforming to the + // "message.compressed_size" semantic conventions. It represents the + // compressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageCompressedSizeKey = attribute.Key("message.compressed_size") + + // MessageIDKey is the attribute Key conforming to the "message.id" + // semantic conventions. It represents the mUST be calculated as two + // different counters starting from `1` one for sent messages and one for + // received message. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Note: This way we guarantee that the values will be consistent between + // different implementations. + MessageIDKey = attribute.Key("message.id") + + // MessageTypeKey is the attribute Key conforming to the "message.type" + // semantic conventions. It represents the whether this is a received or + // sent message. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + MessageTypeKey = attribute.Key("message.type") + + // MessageUncompressedSizeKey is the attribute Key conforming to the + // "message.uncompressed_size" semantic conventions. It represents the + // uncompressed size of the message in bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") +) + +var ( + // sent + MessageTypeSent = MessageTypeKey.String("SENT") + // received + MessageTypeReceived = MessageTypeKey.String("RECEIVED") +) + +// MessageCompressedSize returns an attribute KeyValue conforming to the +// "message.compressed_size" semantic conventions. It represents the compressed +// size of the message in bytes. +func MessageCompressedSize(val int) attribute.KeyValue { + return MessageCompressedSizeKey.Int(val) +} + +// MessageID returns an attribute KeyValue conforming to the "message.id" +// semantic conventions. It represents the mUST be calculated as two different +// counters starting from `1` one for sent messages and one for received +// message. +func MessageID(val int) attribute.KeyValue { + return MessageIDKey.Int(val) +} + +// MessageUncompressedSize returns an attribute KeyValue conforming to the +// "message.uncompressed_size" semantic conventions. It represents the +// uncompressed size of the message in bytes. +func MessageUncompressedSize(val int) attribute.KeyValue { + return MessageUncompressedSizeKey.Int(val) +} diff --git a/semconv/v1.24.0/exception.go b/semconv/v1.24.0/exception.go new file mode 100644 index 00000000000..ef9bbd37a8c --- /dev/null +++ b/semconv/v1.24.0/exception.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +const ( + // ExceptionEventName is the name of the Span event representing an exception. + ExceptionEventName = "exception" +) diff --git a/semconv/v1.24.0/resource.go b/semconv/v1.24.0/resource.go new file mode 100644 index 00000000000..69eda1959f2 --- /dev/null +++ b/semconv/v1.24.0/resource.go @@ -0,0 +1,2556 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// A cloud environment (e.g. GCP, Azure, AWS). +const ( + // CloudAccountIDKey is the attribute Key conforming to the + // "cloud.account.id" semantic conventions. It represents the cloud account + // ID the resource is assigned to. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '111111111111', 'opentelemetry' + CloudAccountIDKey = attribute.Key("cloud.account.id") + + // CloudAvailabilityZoneKey is the attribute Key conforming to the + // "cloud.availability_zone" semantic conventions. It represents the cloud + // regions often have multiple, isolated locations known as zones to + // increase availability. Availability zone represents the zone where the + // resource is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-east-1c' + // Note: Availability zones are called "zones" on Alibaba Cloud and Google + // Cloud. + CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") + + // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" + // semantic conventions. It represents the cloud platform in use. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The prefix of the service SHOULD match the one specified in + // `cloud.provider`. + CloudPlatformKey = attribute.Key("cloud.platform") + + // CloudProviderKey is the attribute Key conforming to the "cloud.provider" + // semantic conventions. It represents the name of the cloud provider. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + CloudProviderKey = attribute.Key("cloud.provider") + + // CloudRegionKey is the attribute Key conforming to the "cloud.region" + // semantic conventions. It represents the geographical region the resource + // is running. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'us-central1', 'us-east-1' + // Note: Refer to your provider's docs to see the available regions, for + // example [Alibaba Cloud + // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS + // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), + // [Azure + // regions](https://azure.microsoft.com/global-infrastructure/geographies/), + // [Google Cloud regions](https://cloud.google.com/about/locations), or + // [Tencent Cloud + // regions](https://www.tencentcloud.com/document/product/213/6091). + CloudRegionKey = attribute.Key("cloud.region") + + // CloudResourceIDKey is the attribute Key conforming to the + // "cloud.resource_id" semantic conventions. It represents the cloud + // provider-specific native identifier of the monitored cloud resource + // (e.g. an + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // on AWS, a [fully qualified resource + // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) + // on Azure, a [full resource + // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // on GCP) + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', + // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', + // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' + // Note: On some cloud providers, it may not be possible to determine the + // full ID at startup, + // so it may be necessary to set `cloud.resource_id` as a span attribute + // instead. + // + // The exact value to use for `cloud.resource_id` depends on the cloud + // provider. + // The following well-known definitions MUST be used if you set this + // attribute and they apply: + // + // * **AWS Lambda:** The function + // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + // Take care not to use the "invoked ARN" directly but replace any + // [alias + // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + // with the resolved function version, as the same runtime instance may + // be invokable with + // multiple different aliases. + // * **GCP:** The [URI of the + // resource](https://cloud.google.com/iam/docs/full-resource-names) + // * **Azure:** The [Fully Qualified Resource + // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) + // of the invoked function, + // *not* the function app, having the form + // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider. + CloudResourceIDKey = attribute.Key("cloud.resource_id") +) + +var ( + // Alibaba Cloud Elastic Compute Service + CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") + // Alibaba Cloud Function Compute + CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") + // Red Hat OpenShift on Alibaba Cloud + CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") + // AWS Elastic Compute Cloud + CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") + // AWS Elastic Container Service + CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") + // AWS Elastic Kubernetes Service + CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") + // AWS Lambda + CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") + // AWS Elastic Beanstalk + CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") + // AWS App Runner + CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") + // Red Hat OpenShift on AWS (ROSA) + CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") + // Azure Virtual Machines + CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") + // Azure Container Instances + CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") + // Azure Kubernetes Service + CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") + // Azure Functions + CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") + // Azure App Service + CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") + // Azure Red Hat OpenShift + CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") + // Google Bare Metal Solution (BMS) + CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") + // Google Cloud Compute Engine (GCE) + CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") + // Google Cloud Run + CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") + // Google Cloud Kubernetes Engine (GKE) + CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") + // Google Cloud Functions (GCF) + CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") + // Google Cloud App Engine (GAE) + CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") + // Red Hat OpenShift on Google Cloud + CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") + // Red Hat OpenShift on IBM Cloud + CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") + // Tencent Cloud Cloud Virtual Machine (CVM) + CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") + // Tencent Cloud Elastic Kubernetes Service (EKS) + CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") + // Tencent Cloud Serverless Cloud Function (SCF) + CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") +) + +var ( + // Alibaba Cloud + CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") + // Amazon Web Services + CloudProviderAWS = CloudProviderKey.String("aws") + // Microsoft Azure + CloudProviderAzure = CloudProviderKey.String("azure") + // Google Cloud Platform + CloudProviderGCP = CloudProviderKey.String("gcp") + // Heroku Platform as a Service + CloudProviderHeroku = CloudProviderKey.String("heroku") + // IBM Cloud + CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") + // Tencent Cloud + CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") +) + +// CloudAccountID returns an attribute KeyValue conforming to the +// "cloud.account.id" semantic conventions. It represents the cloud account ID +// the resource is assigned to. +func CloudAccountID(val string) attribute.KeyValue { + return CloudAccountIDKey.String(val) +} + +// CloudAvailabilityZone returns an attribute KeyValue conforming to the +// "cloud.availability_zone" semantic conventions. It represents the cloud +// regions often have multiple, isolated locations known as zones to increase +// availability. Availability zone represents the zone where the resource is +// running. +func CloudAvailabilityZone(val string) attribute.KeyValue { + return CloudAvailabilityZoneKey.String(val) +} + +// CloudRegion returns an attribute KeyValue conforming to the +// "cloud.region" semantic conventions. It represents the geographical region +// the resource is running. +func CloudRegion(val string) attribute.KeyValue { + return CloudRegionKey.String(val) +} + +// CloudResourceID returns an attribute KeyValue conforming to the +// "cloud.resource_id" semantic conventions. It represents the cloud +// provider-specific native identifier of the monitored cloud resource (e.g. an +// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) +// on AWS, a [fully qualified resource +// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on +// Azure, a [full resource +// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) +// on GCP) +func CloudResourceID(val string) attribute.KeyValue { + return CloudResourceIDKey.String(val) +} + +// A container instance. +const ( + // ContainerCommandKey is the attribute Key conforming to the + // "container.command" semantic conventions. It represents the command used + // to run the container (i.e. the command name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol' + // Note: If using embedded credentials or sensitive data, it is recommended + // to remove them to prevent potential leakage. + ContainerCommandKey = attribute.Key("container.command") + + // ContainerCommandArgsKey is the attribute Key conforming to the + // "container.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) run by the + // container. [2] + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol, --config, config.yaml' + ContainerCommandArgsKey = attribute.Key("container.command_args") + + // ContainerCommandLineKey is the attribute Key conforming to the + // "container.command_line" semantic conventions. It represents the full + // command run by the container as a single string representing the full + // command. [2] + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcontribcol --config config.yaml' + ContainerCommandLineKey = attribute.Key("container.command_line") + + // ContainerIDKey is the attribute Key conforming to the "container.id" + // semantic conventions. It represents the container ID. Usually a UUID, as + // for example used to [identify Docker + // containers](https://docs.docker.com/engine/reference/run/#container-identification). + // The UUID might be abbreviated. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'a3bf90e006b2' + ContainerIDKey = attribute.Key("container.id") + + // ContainerImageIDKey is the attribute Key conforming to the + // "container.image.id" semantic conventions. It represents the runtime + // specific image identifier. Usually a hash algorithm followed by a UUID. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' + // Note: Docker defines a sha256 of the image id; `container.image.id` + // corresponds to the `Image` field from the Docker container inspect + // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) + // endpoint. + // K8S defines a link to the container registry repository with digest + // `"imageID": "registry.azurecr.io + // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. + // The ID is assinged by the container runtime and can vary in different + // environments. Consider using `oci.manifest.digest` if it is important to + // identify the same image in different environments/runtimes. + ContainerImageIDKey = attribute.Key("container.image.id") + + // ContainerImageNameKey is the attribute Key conforming to the + // "container.image.name" semantic conventions. It represents the name of + // the image the container was built on. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'gcr.io/opentelemetry/operator' + ContainerImageNameKey = attribute.Key("container.image.name") + + // ContainerImageRepoDigestsKey is the attribute Key conforming to the + // "container.image.repo_digests" semantic conventions. It represents the + // repo digests of the container image as provided by the container + // runtime. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', + // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' + // Note: + // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) + // and + // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) + // report those under the `RepoDigests` field. + ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") + + // ContainerImageTagsKey is the attribute Key conforming to the + // "container.image.tags" semantic conventions. It represents the container + // image tags. An example can be found in [Docker Image + // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). + // Should be only the `` section of the full name for example from + // `registry.example.com/my-org/my-image:`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'v1.27.1', '3.5.7-0' + ContainerImageTagsKey = attribute.Key("container.image.tags") + + // ContainerNameKey is the attribute Key conforming to the "container.name" + // semantic conventions. It represents the container name used by container + // runtime. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-autoconf' + ContainerNameKey = attribute.Key("container.name") + + // ContainerRuntimeKey is the attribute Key conforming to the + // "container.runtime" semantic conventions. It represents the container + // runtime managing this container. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'docker', 'containerd', 'rkt' + ContainerRuntimeKey = attribute.Key("container.runtime") +) + +// ContainerCommand returns an attribute KeyValue conforming to the +// "container.command" semantic conventions. It represents the command used to +// run the container (i.e. the command name). +func ContainerCommand(val string) attribute.KeyValue { + return ContainerCommandKey.String(val) +} + +// ContainerCommandArgs returns an attribute KeyValue conforming to the +// "container.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) run by the +// container. [2] +func ContainerCommandArgs(val ...string) attribute.KeyValue { + return ContainerCommandArgsKey.StringSlice(val) +} + +// ContainerCommandLine returns an attribute KeyValue conforming to the +// "container.command_line" semantic conventions. It represents the full +// command run by the container as a single string representing the full +// command. [2] +func ContainerCommandLine(val string) attribute.KeyValue { + return ContainerCommandLineKey.String(val) +} + +// ContainerID returns an attribute KeyValue conforming to the +// "container.id" semantic conventions. It represents the container ID. Usually +// a UUID, as for example used to [identify Docker +// containers](https://docs.docker.com/engine/reference/run/#container-identification). +// The UUID might be abbreviated. +func ContainerID(val string) attribute.KeyValue { + return ContainerIDKey.String(val) +} + +// ContainerImageID returns an attribute KeyValue conforming to the +// "container.image.id" semantic conventions. It represents the runtime +// specific image identifier. Usually a hash algorithm followed by a UUID. +func ContainerImageID(val string) attribute.KeyValue { + return ContainerImageIDKey.String(val) +} + +// ContainerImageName returns an attribute KeyValue conforming to the +// "container.image.name" semantic conventions. It represents the name of the +// image the container was built on. +func ContainerImageName(val string) attribute.KeyValue { + return ContainerImageNameKey.String(val) +} + +// ContainerImageRepoDigests returns an attribute KeyValue conforming to the +// "container.image.repo_digests" semantic conventions. It represents the repo +// digests of the container image as provided by the container runtime. +func ContainerImageRepoDigests(val ...string) attribute.KeyValue { + return ContainerImageRepoDigestsKey.StringSlice(val) +} + +// ContainerImageTags returns an attribute KeyValue conforming to the +// "container.image.tags" semantic conventions. It represents the container +// image tags. An example can be found in [Docker Image +// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). +// Should be only the `` section of the full name for example from +// `registry.example.com/my-org/my-image:`. +func ContainerImageTags(val ...string) attribute.KeyValue { + return ContainerImageTagsKey.StringSlice(val) +} + +// ContainerName returns an attribute KeyValue conforming to the +// "container.name" semantic conventions. It represents the container name used +// by container runtime. +func ContainerName(val string) attribute.KeyValue { + return ContainerNameKey.String(val) +} + +// ContainerRuntime returns an attribute KeyValue conforming to the +// "container.runtime" semantic conventions. It represents the container +// runtime managing this container. +func ContainerRuntime(val string) attribute.KeyValue { + return ContainerRuntimeKey.String(val) +} + +// Describes device attributes. +const ( + // DeviceIDKey is the attribute Key conforming to the "device.id" semantic + // conventions. It represents a unique identifier representing the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' + // Note: The device identifier MUST only be defined using the values + // outlined below. This value is not an advertising identifier and MUST NOT + // be used as such. On iOS (Swift or Objective-C), this value MUST be equal + // to the [vendor + // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). + // On Android (Java or Kotlin), this value MUST be equal to the Firebase + // Installation ID or a globally unique UUID which is persisted across + // sessions in your application. More information can be found + // [here](https://developer.android.com/training/articles/user-data-ids) on + // best practices and exact implementation details. Caution should be taken + // when storing personal data or anything which can identify a user. GDPR + // and data protection laws may apply, ensure you do your own due + // diligence. + DeviceIDKey = attribute.Key("device.id") + + // DeviceManufacturerKey is the attribute Key conforming to the + // "device.manufacturer" semantic conventions. It represents the name of + // the device manufacturer + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Apple', 'Samsung' + // Note: The Android OS provides this field via + // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). + // iOS apps SHOULD hardcode the value `Apple`. + DeviceManufacturerKey = attribute.Key("device.manufacturer") + + // DeviceModelIdentifierKey is the attribute Key conforming to the + // "device.model.identifier" semantic conventions. It represents the model + // identifier for the device + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone3,4', 'SM-G920F' + // Note: It's recommended this value represents a machine-readable version + // of the model identifier rather than the market or consumer-friendly name + // of the device. + DeviceModelIdentifierKey = attribute.Key("device.model.identifier") + + // DeviceModelNameKey is the attribute Key conforming to the + // "device.model.name" semantic conventions. It represents the marketing + // name for the device model + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' + // Note: It's recommended this value represents a human-readable version of + // the device model rather than a machine-readable alternative. + DeviceModelNameKey = attribute.Key("device.model.name") +) + +// DeviceID returns an attribute KeyValue conforming to the "device.id" +// semantic conventions. It represents a unique identifier representing the +// device +func DeviceID(val string) attribute.KeyValue { + return DeviceIDKey.String(val) +} + +// DeviceManufacturer returns an attribute KeyValue conforming to the +// "device.manufacturer" semantic conventions. It represents the name of the +// device manufacturer +func DeviceManufacturer(val string) attribute.KeyValue { + return DeviceManufacturerKey.String(val) +} + +// DeviceModelIdentifier returns an attribute KeyValue conforming to the +// "device.model.identifier" semantic conventions. It represents the model +// identifier for the device +func DeviceModelIdentifier(val string) attribute.KeyValue { + return DeviceModelIdentifierKey.String(val) +} + +// DeviceModelName returns an attribute KeyValue conforming to the +// "device.model.name" semantic conventions. It represents the marketing name +// for the device model +func DeviceModelName(val string) attribute.KeyValue { + return DeviceModelNameKey.String(val) +} + +// A host is defined as a computing instance. For example, physical servers, +// virtual machines, switches or disk array. +const ( + // HostArchKey is the attribute Key conforming to the "host.arch" semantic + // conventions. It represents the CPU architecture the host system is + // running on. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + HostArchKey = attribute.Key("host.arch") + + // HostCPUCacheL2SizeKey is the attribute Key conforming to the + // "host.cpu.cache.l2.size" semantic conventions. It represents the amount + // of level 2 memory cache available to the processor (in Bytes). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 12288000 + HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") + + // HostCPUFamilyKey is the attribute Key conforming to the + // "host.cpu.family" semantic conventions. It represents the family or + // generation of the CPU. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', 'PA-RISC 1.1e' + HostCPUFamilyKey = attribute.Key("host.cpu.family") + + // HostCPUModelIDKey is the attribute Key conforming to the + // "host.cpu.model.id" semantic conventions. It represents the model + // identifier. It provides more granular information about the CPU, + // distinguishing it from other CPUs within the same family. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '6', '9000/778/B180L' + HostCPUModelIDKey = attribute.Key("host.cpu.model.id") + + // HostCPUModelNameKey is the attribute Key conforming to the + // "host.cpu.model.name" semantic conventions. It represents the model + // designation of the processor. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' + HostCPUModelNameKey = attribute.Key("host.cpu.model.name") + + // HostCPUSteppingKey is the attribute Key conforming to the + // "host.cpu.stepping" semantic conventions. It represents the stepping or + // core revisions. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1 + HostCPUSteppingKey = attribute.Key("host.cpu.stepping") + + // HostCPUVendorIDKey is the attribute Key conforming to the + // "host.cpu.vendor.id" semantic conventions. It represents the processor + // manufacturer identifier. A maximum 12-character string. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'GenuineIntel' + // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor + // ID string in EBX, EDX and ECX registers. Writing these to memory in this + // order results in a 12-character string. + HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") + + // HostIDKey is the attribute Key conforming to the "host.id" semantic + // conventions. It represents the unique host ID. For Cloud, this must be + // the instance_id assigned by the cloud provider. For non-containerized + // systems, this should be the `machine-id`. See the table below for the + // sources to use to determine the `machine-id` based on operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'fdbf79e8af94cb7f9e8df36789187052' + HostIDKey = attribute.Key("host.id") + + // HostImageIDKey is the attribute Key conforming to the "host.image.id" + // semantic conventions. It represents the vM image ID or host OS image ID. + // For Cloud, this value is from the provider. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ami-07b06b442921831e5' + HostImageIDKey = attribute.Key("host.image.id") + + // HostImageNameKey is the attribute Key conforming to the + // "host.image.name" semantic conventions. It represents the name of the VM + // image or OS install the host was instantiated from. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' + HostImageNameKey = attribute.Key("host.image.name") + + // HostImageVersionKey is the attribute Key conforming to the + // "host.image.version" semantic conventions. It represents the version + // string of the VM image or host OS as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0.1' + HostImageVersionKey = attribute.Key("host.image.version") + + // HostIPKey is the attribute Key conforming to the "host.ip" semantic + // conventions. It represents the available IP addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' + // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 + // addresses MUST be specified in the [RFC + // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. + HostIPKey = attribute.Key("host.ip") + + // HostMacKey is the attribute Key conforming to the "host.mac" semantic + // conventions. It represents the available MAC addresses of the host, + // excluding loopback interfaces. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' + // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal + // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): + // as hyphen-separated octets in uppercase hexadecimal form from most to + // least significant. + HostMacKey = attribute.Key("host.mac") + + // HostNameKey is the attribute Key conforming to the "host.name" semantic + // conventions. It represents the name of the host. On Unix systems, it may + // contain what the hostname command returns, or the fully qualified + // hostname, or another name specified by the user. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-test' + HostNameKey = attribute.Key("host.name") + + // HostTypeKey is the attribute Key conforming to the "host.type" semantic + // conventions. It represents the type of host. For Cloud, this must be the + // machine type. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'n1-standard-1' + HostTypeKey = attribute.Key("host.type") +) + +var ( + // AMD64 + HostArchAMD64 = HostArchKey.String("amd64") + // ARM32 + HostArchARM32 = HostArchKey.String("arm32") + // ARM64 + HostArchARM64 = HostArchKey.String("arm64") + // Itanium + HostArchIA64 = HostArchKey.String("ia64") + // 32-bit PowerPC + HostArchPPC32 = HostArchKey.String("ppc32") + // 64-bit PowerPC + HostArchPPC64 = HostArchKey.String("ppc64") + // IBM z/Architecture + HostArchS390x = HostArchKey.String("s390x") + // 32-bit x86 + HostArchX86 = HostArchKey.String("x86") +) + +// HostCPUCacheL2Size returns an attribute KeyValue conforming to the +// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of +// level 2 memory cache available to the processor (in Bytes). +func HostCPUCacheL2Size(val int) attribute.KeyValue { + return HostCPUCacheL2SizeKey.Int(val) +} + +// HostCPUFamily returns an attribute KeyValue conforming to the +// "host.cpu.family" semantic conventions. It represents the family or +// generation of the CPU. +func HostCPUFamily(val string) attribute.KeyValue { + return HostCPUFamilyKey.String(val) +} + +// HostCPUModelID returns an attribute KeyValue conforming to the +// "host.cpu.model.id" semantic conventions. It represents the model +// identifier. It provides more granular information about the CPU, +// distinguishing it from other CPUs within the same family. +func HostCPUModelID(val string) attribute.KeyValue { + return HostCPUModelIDKey.String(val) +} + +// HostCPUModelName returns an attribute KeyValue conforming to the +// "host.cpu.model.name" semantic conventions. It represents the model +// designation of the processor. +func HostCPUModelName(val string) attribute.KeyValue { + return HostCPUModelNameKey.String(val) +} + +// HostCPUStepping returns an attribute KeyValue conforming to the +// "host.cpu.stepping" semantic conventions. It represents the stepping or core +// revisions. +func HostCPUStepping(val int) attribute.KeyValue { + return HostCPUSteppingKey.Int(val) +} + +// HostCPUVendorID returns an attribute KeyValue conforming to the +// "host.cpu.vendor.id" semantic conventions. It represents the processor +// manufacturer identifier. A maximum 12-character string. +func HostCPUVendorID(val string) attribute.KeyValue { + return HostCPUVendorIDKey.String(val) +} + +// HostID returns an attribute KeyValue conforming to the "host.id" semantic +// conventions. It represents the unique host ID. For Cloud, this must be the +// instance_id assigned by the cloud provider. For non-containerized systems, +// this should be the `machine-id`. See the table below for the sources to use +// to determine the `machine-id` based on operating system. +func HostID(val string) attribute.KeyValue { + return HostIDKey.String(val) +} + +// HostImageID returns an attribute KeyValue conforming to the +// "host.image.id" semantic conventions. It represents the vM image ID or host +// OS image ID. For Cloud, this value is from the provider. +func HostImageID(val string) attribute.KeyValue { + return HostImageIDKey.String(val) +} + +// HostImageName returns an attribute KeyValue conforming to the +// "host.image.name" semantic conventions. It represents the name of the VM +// image or OS install the host was instantiated from. +func HostImageName(val string) attribute.KeyValue { + return HostImageNameKey.String(val) +} + +// HostImageVersion returns an attribute KeyValue conforming to the +// "host.image.version" semantic conventions. It represents the version string +// of the VM image or host OS as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func HostImageVersion(val string) attribute.KeyValue { + return HostImageVersionKey.String(val) +} + +// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic +// conventions. It represents the available IP addresses of the host, excluding +// loopback interfaces. +func HostIP(val ...string) attribute.KeyValue { + return HostIPKey.StringSlice(val) +} + +// HostMac returns an attribute KeyValue conforming to the "host.mac" +// semantic conventions. It represents the available MAC addresses of the host, +// excluding loopback interfaces. +func HostMac(val ...string) attribute.KeyValue { + return HostMacKey.StringSlice(val) +} + +// HostName returns an attribute KeyValue conforming to the "host.name" +// semantic conventions. It represents the name of the host. On Unix systems, +// it may contain what the hostname command returns, or the fully qualified +// hostname, or another name specified by the user. +func HostName(val string) attribute.KeyValue { + return HostNameKey.String(val) +} + +// HostType returns an attribute KeyValue conforming to the "host.type" +// semantic conventions. It represents the type of host. For Cloud, this must +// be the machine type. +func HostType(val string) attribute.KeyValue { + return HostTypeKey.String(val) +} + +// Kubernetes resource attributes. +const ( + // K8SClusterNameKey is the attribute Key conforming to the + // "k8s.cluster.name" semantic conventions. It represents the name of the + // cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-cluster' + K8SClusterNameKey = attribute.Key("k8s.cluster.name") + + // K8SClusterUIDKey is the attribute Key conforming to the + // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for + // the cluster, set to the UID of the `kube-system` namespace. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' + // Note: K8S doesn't have support for obtaining a cluster ID. If this is + // ever + // added, we will recommend collecting the `k8s.cluster.uid` through the + // official APIs. In the meantime, we are able to use the `uid` of the + // `kube-system` namespace as a proxy for cluster ID. Read on for the + // rationale. + // + // Every object created in a K8S cluster is assigned a distinct UID. The + // `kube-system` namespace is used by Kubernetes itself and will exist + // for the lifetime of the cluster. Using the `uid` of the `kube-system` + // namespace is a reasonable proxy for the K8S ClusterID as it will only + // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + // UUIDs as standardized by + // [ISO/IEC 9834-8 and ITU-T + // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + // Which states: + // + // > If generated according to one of the mechanisms defined in Rec. + // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + // different from all other UUIDs generated before 3603 A.D., or is + // extremely likely to be different (depending on the mechanism chosen). + // + // Therefore, UIDs between clusters should be extremely unlikely to + // conflict. + K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") + + // K8SContainerNameKey is the attribute Key conforming to the + // "k8s.container.name" semantic conventions. It represents the name of the + // Container from Pod specification, must be unique within a Pod. Container + // runtime usually uses different globally unique name (`container.name`). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'redis' + K8SContainerNameKey = attribute.Key("k8s.container.name") + + // K8SContainerRestartCountKey is the attribute Key conforming to the + // "k8s.container.restart_count" semantic conventions. It represents the + // number of times the container was restarted. This attribute can be used + // to identify a particular container (running or stopped) within a + // container spec. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 2 + K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") + + // K8SCronJobNameKey is the attribute Key conforming to the + // "k8s.cronjob.name" semantic conventions. It represents the name of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") + + // K8SCronJobUIDKey is the attribute Key conforming to the + // "k8s.cronjob.uid" semantic conventions. It represents the UID of the + // CronJob. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") + + // K8SDaemonSetNameKey is the attribute Key conforming to the + // "k8s.daemonset.name" semantic conventions. It represents the name of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") + + // K8SDaemonSetUIDKey is the attribute Key conforming to the + // "k8s.daemonset.uid" semantic conventions. It represents the UID of the + // DaemonSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") + + // K8SDeploymentNameKey is the attribute Key conforming to the + // "k8s.deployment.name" semantic conventions. It represents the name of + // the Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") + + // K8SDeploymentUIDKey is the attribute Key conforming to the + // "k8s.deployment.uid" semantic conventions. It represents the UID of the + // Deployment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") + + // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" + // semantic conventions. It represents the name of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SJobNameKey = attribute.Key("k8s.job.name") + + // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" + // semantic conventions. It represents the UID of the Job. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SJobUIDKey = attribute.Key("k8s.job.uid") + + // K8SNamespaceNameKey is the attribute Key conforming to the + // "k8s.namespace.name" semantic conventions. It represents the name of the + // namespace that the pod is running in. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'default' + K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") + + // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" + // semantic conventions. It represents the name of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'node-1' + K8SNodeNameKey = attribute.Key("k8s.node.name") + + // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" + // semantic conventions. It represents the UID of the Node. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' + K8SNodeUIDKey = attribute.Key("k8s.node.uid") + + // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" + // semantic conventions. It represents the name of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-pod-autoconf' + K8SPodNameKey = attribute.Key("k8s.pod.name") + + // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" + // semantic conventions. It represents the UID of the Pod. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SPodUIDKey = attribute.Key("k8s.pod.uid") + + // K8SReplicaSetNameKey is the attribute Key conforming to the + // "k8s.replicaset.name" semantic conventions. It represents the name of + // the ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") + + // K8SReplicaSetUIDKey is the attribute Key conforming to the + // "k8s.replicaset.uid" semantic conventions. It represents the UID of the + // ReplicaSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") + + // K8SStatefulSetNameKey is the attribute Key conforming to the + // "k8s.statefulset.name" semantic conventions. It represents the name of + // the StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry' + K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") + + // K8SStatefulSetUIDKey is the attribute Key conforming to the + // "k8s.statefulset.uid" semantic conventions. It represents the UID of the + // StatefulSet. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' + K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") +) + +// K8SClusterName returns an attribute KeyValue conforming to the +// "k8s.cluster.name" semantic conventions. It represents the name of the +// cluster. +func K8SClusterName(val string) attribute.KeyValue { + return K8SClusterNameKey.String(val) +} + +// K8SClusterUID returns an attribute KeyValue conforming to the +// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the +// cluster, set to the UID of the `kube-system` namespace. +func K8SClusterUID(val string) attribute.KeyValue { + return K8SClusterUIDKey.String(val) +} + +// K8SContainerName returns an attribute KeyValue conforming to the +// "k8s.container.name" semantic conventions. It represents the name of the +// Container from Pod specification, must be unique within a Pod. Container +// runtime usually uses different globally unique name (`container.name`). +func K8SContainerName(val string) attribute.KeyValue { + return K8SContainerNameKey.String(val) +} + +// K8SContainerRestartCount returns an attribute KeyValue conforming to the +// "k8s.container.restart_count" semantic conventions. It represents the number +// of times the container was restarted. This attribute can be used to identify +// a particular container (running or stopped) within a container spec. +func K8SContainerRestartCount(val int) attribute.KeyValue { + return K8SContainerRestartCountKey.Int(val) +} + +// K8SCronJobName returns an attribute KeyValue conforming to the +// "k8s.cronjob.name" semantic conventions. It represents the name of the +// CronJob. +func K8SCronJobName(val string) attribute.KeyValue { + return K8SCronJobNameKey.String(val) +} + +// K8SCronJobUID returns an attribute KeyValue conforming to the +// "k8s.cronjob.uid" semantic conventions. It represents the UID of the +// CronJob. +func K8SCronJobUID(val string) attribute.KeyValue { + return K8SCronJobUIDKey.String(val) +} + +// K8SDaemonSetName returns an attribute KeyValue conforming to the +// "k8s.daemonset.name" semantic conventions. It represents the name of the +// DaemonSet. +func K8SDaemonSetName(val string) attribute.KeyValue { + return K8SDaemonSetNameKey.String(val) +} + +// K8SDaemonSetUID returns an attribute KeyValue conforming to the +// "k8s.daemonset.uid" semantic conventions. It represents the UID of the +// DaemonSet. +func K8SDaemonSetUID(val string) attribute.KeyValue { + return K8SDaemonSetUIDKey.String(val) +} + +// K8SDeploymentName returns an attribute KeyValue conforming to the +// "k8s.deployment.name" semantic conventions. It represents the name of the +// Deployment. +func K8SDeploymentName(val string) attribute.KeyValue { + return K8SDeploymentNameKey.String(val) +} + +// K8SDeploymentUID returns an attribute KeyValue conforming to the +// "k8s.deployment.uid" semantic conventions. It represents the UID of the +// Deployment. +func K8SDeploymentUID(val string) attribute.KeyValue { + return K8SDeploymentUIDKey.String(val) +} + +// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" +// semantic conventions. It represents the name of the Job. +func K8SJobName(val string) attribute.KeyValue { + return K8SJobNameKey.String(val) +} + +// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" +// semantic conventions. It represents the UID of the Job. +func K8SJobUID(val string) attribute.KeyValue { + return K8SJobUIDKey.String(val) +} + +// K8SNamespaceName returns an attribute KeyValue conforming to the +// "k8s.namespace.name" semantic conventions. It represents the name of the +// namespace that the pod is running in. +func K8SNamespaceName(val string) attribute.KeyValue { + return K8SNamespaceNameKey.String(val) +} + +// K8SNodeName returns an attribute KeyValue conforming to the +// "k8s.node.name" semantic conventions. It represents the name of the Node. +func K8SNodeName(val string) attribute.KeyValue { + return K8SNodeNameKey.String(val) +} + +// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" +// semantic conventions. It represents the UID of the Node. +func K8SNodeUID(val string) attribute.KeyValue { + return K8SNodeUIDKey.String(val) +} + +// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" +// semantic conventions. It represents the name of the Pod. +func K8SPodName(val string) attribute.KeyValue { + return K8SPodNameKey.String(val) +} + +// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" +// semantic conventions. It represents the UID of the Pod. +func K8SPodUID(val string) attribute.KeyValue { + return K8SPodUIDKey.String(val) +} + +// K8SReplicaSetName returns an attribute KeyValue conforming to the +// "k8s.replicaset.name" semantic conventions. It represents the name of the +// ReplicaSet. +func K8SReplicaSetName(val string) attribute.KeyValue { + return K8SReplicaSetNameKey.String(val) +} + +// K8SReplicaSetUID returns an attribute KeyValue conforming to the +// "k8s.replicaset.uid" semantic conventions. It represents the UID of the +// ReplicaSet. +func K8SReplicaSetUID(val string) attribute.KeyValue { + return K8SReplicaSetUIDKey.String(val) +} + +// K8SStatefulSetName returns an attribute KeyValue conforming to the +// "k8s.statefulset.name" semantic conventions. It represents the name of the +// StatefulSet. +func K8SStatefulSetName(val string) attribute.KeyValue { + return K8SStatefulSetNameKey.String(val) +} + +// K8SStatefulSetUID returns an attribute KeyValue conforming to the +// "k8s.statefulset.uid" semantic conventions. It represents the UID of the +// StatefulSet. +func K8SStatefulSetUID(val string) attribute.KeyValue { + return K8SStatefulSetUIDKey.String(val) +} + +// An OCI image manifest. +const ( + // OciManifestDigestKey is the attribute Key conforming to the + // "oci.manifest.digest" semantic conventions. It represents the digest of + // the OCI image manifest. For container images specifically is the digest + // by which the container image is known. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' + // Note: Follows [OCI Image Manifest + // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), + // and specifically the [Digest + // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). + // An example can be found in [Example Image + // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). + OciManifestDigestKey = attribute.Key("oci.manifest.digest") +) + +// OciManifestDigest returns an attribute KeyValue conforming to the +// "oci.manifest.digest" semantic conventions. It represents the digest of the +// OCI image manifest. For container images specifically is the digest by which +// the container image is known. +func OciManifestDigest(val string) attribute.KeyValue { + return OciManifestDigestKey.String(val) +} + +// The operating system (OS) on which the process represented by this resource +// is running. +const ( + // OSBuildIDKey is the attribute Key conforming to the "os.build_id" + // semantic conventions. It represents the unique identifier for a + // particular build or compilation of the operating system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' + OSBuildIDKey = attribute.Key("os.build_id") + + // OSDescriptionKey is the attribute Key conforming to the "os.description" + // semantic conventions. It represents the human readable (not intended to + // be parsed) OS version information, like e.g. reported by `ver` or + // `lsb_release -a` commands. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 + // LTS' + OSDescriptionKey = attribute.Key("os.description") + + // OSNameKey is the attribute Key conforming to the "os.name" semantic + // conventions. It represents the human readable operating system name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'iOS', 'Android', 'Ubuntu' + OSNameKey = attribute.Key("os.name") + + // OSTypeKey is the attribute Key conforming to the "os.type" semantic + // conventions. It represents the operating system type. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OSTypeKey = attribute.Key("os.type") + + // OSVersionKey is the attribute Key conforming to the "os.version" + // semantic conventions. It represents the version string of the operating + // system as defined in [Version + // Attributes](/docs/resource/README.md#version-attributes). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.2.1', '18.04.1' + OSVersionKey = attribute.Key("os.version") +) + +var ( + // Microsoft Windows + OSTypeWindows = OSTypeKey.String("windows") + // Linux + OSTypeLinux = OSTypeKey.String("linux") + // Apple Darwin + OSTypeDarwin = OSTypeKey.String("darwin") + // FreeBSD + OSTypeFreeBSD = OSTypeKey.String("freebsd") + // NetBSD + OSTypeNetBSD = OSTypeKey.String("netbsd") + // OpenBSD + OSTypeOpenBSD = OSTypeKey.String("openbsd") + // DragonFly BSD + OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") + // HP-UX (Hewlett Packard Unix) + OSTypeHPUX = OSTypeKey.String("hpux") + // AIX (Advanced Interactive eXecutive) + OSTypeAIX = OSTypeKey.String("aix") + // SunOS, Oracle Solaris + OSTypeSolaris = OSTypeKey.String("solaris") + // IBM z/OS + OSTypeZOS = OSTypeKey.String("z_os") +) + +// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" +// semantic conventions. It represents the unique identifier for a particular +// build or compilation of the operating system. +func OSBuildID(val string) attribute.KeyValue { + return OSBuildIDKey.String(val) +} + +// OSDescription returns an attribute KeyValue conforming to the +// "os.description" semantic conventions. It represents the human readable (not +// intended to be parsed) OS version information, like e.g. reported by `ver` +// or `lsb_release -a` commands. +func OSDescription(val string) attribute.KeyValue { + return OSDescriptionKey.String(val) +} + +// OSName returns an attribute KeyValue conforming to the "os.name" semantic +// conventions. It represents the human readable operating system name. +func OSName(val string) attribute.KeyValue { + return OSNameKey.String(val) +} + +// OSVersion returns an attribute KeyValue conforming to the "os.version" +// semantic conventions. It represents the version string of the operating +// system as defined in [Version +// Attributes](/docs/resource/README.md#version-attributes). +func OSVersion(val string) attribute.KeyValue { + return OSVersionKey.String(val) +} + +// An operating system process. +const ( + // ProcessCommandKey is the attribute Key conforming to the + // "process.command" semantic conventions. It represents the command used + // to launch the process (i.e. the command name). On Linux based systems, + // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can + // be set to the first parameter extracted from `GetCommandLineW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otelcol' + ProcessCommandKey = attribute.Key("process.command") + + // ProcessCommandArgsKey is the attribute Key conforming to the + // "process.command_args" semantic conventions. It represents the all the + // command arguments (including the command/executable itself) as received + // by the process. On Linux-based systems (and some other Unixoid systems + // supporting procfs), can be set according to the list of null-delimited + // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, + // this would be the full argv vector passed to `main`. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'cmd/otecol', '--config=config.yaml' + ProcessCommandArgsKey = attribute.Key("process.command_args") + + // ProcessCommandLineKey is the attribute Key conforming to the + // "process.command_line" semantic conventions. It represents the full + // command used to launch the process as a single string representing the + // full command. On Windows, can be set to the result of `GetCommandLineW`. + // Do not set this if you have to assemble it just for monitoring; use + // `process.command_args` instead. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' + ProcessCommandLineKey = attribute.Key("process.command_line") + + // ProcessExecutableNameKey is the attribute Key conforming to the + // "process.executable.name" semantic conventions. It represents the name + // of the process executable. On Linux based systems, can be set to the + // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name + // of `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'otelcol' + ProcessExecutableNameKey = attribute.Key("process.executable.name") + + // ProcessExecutablePathKey is the attribute Key conforming to the + // "process.executable.path" semantic conventions. It represents the full + // path to the process executable. On Linux based systems, can be set to + // the target of `proc/[pid]/exe`. On Windows, can be set to the result of + // `GetProcessImageFileNameW`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/bin/cmd/otelcol' + ProcessExecutablePathKey = attribute.Key("process.executable.path") + + // ProcessOwnerKey is the attribute Key conforming to the "process.owner" + // semantic conventions. It represents the username of the user that owns + // the process. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'root' + ProcessOwnerKey = attribute.Key("process.owner") + + // ProcessParentPIDKey is the attribute Key conforming to the + // "process.parent_pid" semantic conventions. It represents the parent + // Process identifier (PPID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 111 + ProcessParentPIDKey = attribute.Key("process.parent_pid") + + // ProcessPIDKey is the attribute Key conforming to the "process.pid" + // semantic conventions. It represents the process identifier (PID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1234 + ProcessPIDKey = attribute.Key("process.pid") + + // ProcessRuntimeDescriptionKey is the attribute Key conforming to the + // "process.runtime.description" semantic conventions. It represents an + // additional description about the runtime of the process, for example a + // specific vendor customization of the runtime environment. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' + ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") + + // ProcessRuntimeNameKey is the attribute Key conforming to the + // "process.runtime.name" semantic conventions. It represents the name of + // the runtime of this process. For compiled native binaries, this SHOULD + // be the name of the compiler. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'OpenJDK Runtime Environment' + ProcessRuntimeNameKey = attribute.Key("process.runtime.name") + + // ProcessRuntimeVersionKey is the attribute Key conforming to the + // "process.runtime.version" semantic conventions. It represents the + // version of the runtime of this process, as returned by the runtime + // without modification. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '14.0.2' + ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") +) + +// ProcessCommand returns an attribute KeyValue conforming to the +// "process.command" semantic conventions. It represents the command used to +// launch the process (i.e. the command name). On Linux based systems, can be +// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to +// the first parameter extracted from `GetCommandLineW`. +func ProcessCommand(val string) attribute.KeyValue { + return ProcessCommandKey.String(val) +} + +// ProcessCommandArgs returns an attribute KeyValue conforming to the +// "process.command_args" semantic conventions. It represents the all the +// command arguments (including the command/executable itself) as received by +// the process. On Linux-based systems (and some other Unixoid systems +// supporting procfs), can be set according to the list of null-delimited +// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, +// this would be the full argv vector passed to `main`. +func ProcessCommandArgs(val ...string) attribute.KeyValue { + return ProcessCommandArgsKey.StringSlice(val) +} + +// ProcessCommandLine returns an attribute KeyValue conforming to the +// "process.command_line" semantic conventions. It represents the full command +// used to launch the process as a single string representing the full command. +// On Windows, can be set to the result of `GetCommandLineW`. Do not set this +// if you have to assemble it just for monitoring; use `process.command_args` +// instead. +func ProcessCommandLine(val string) attribute.KeyValue { + return ProcessCommandLineKey.String(val) +} + +// ProcessExecutableName returns an attribute KeyValue conforming to the +// "process.executable.name" semantic conventions. It represents the name of +// the process executable. On Linux based systems, can be set to the `Name` in +// `proc/[pid]/status`. On Windows, can be set to the base name of +// `GetProcessImageFileNameW`. +func ProcessExecutableName(val string) attribute.KeyValue { + return ProcessExecutableNameKey.String(val) +} + +// ProcessExecutablePath returns an attribute KeyValue conforming to the +// "process.executable.path" semantic conventions. It represents the full path +// to the process executable. On Linux based systems, can be set to the target +// of `proc/[pid]/exe`. On Windows, can be set to the result of +// `GetProcessImageFileNameW`. +func ProcessExecutablePath(val string) attribute.KeyValue { + return ProcessExecutablePathKey.String(val) +} + +// ProcessOwner returns an attribute KeyValue conforming to the +// "process.owner" semantic conventions. It represents the username of the user +// that owns the process. +func ProcessOwner(val string) attribute.KeyValue { + return ProcessOwnerKey.String(val) +} + +// ProcessParentPID returns an attribute KeyValue conforming to the +// "process.parent_pid" semantic conventions. It represents the parent Process +// identifier (PPID). +func ProcessParentPID(val int) attribute.KeyValue { + return ProcessParentPIDKey.Int(val) +} + +// ProcessPID returns an attribute KeyValue conforming to the "process.pid" +// semantic conventions. It represents the process identifier (PID). +func ProcessPID(val int) attribute.KeyValue { + return ProcessPIDKey.Int(val) +} + +// ProcessRuntimeDescription returns an attribute KeyValue conforming to the +// "process.runtime.description" semantic conventions. It represents an +// additional description about the runtime of the process, for example a +// specific vendor customization of the runtime environment. +func ProcessRuntimeDescription(val string) attribute.KeyValue { + return ProcessRuntimeDescriptionKey.String(val) +} + +// ProcessRuntimeName returns an attribute KeyValue conforming to the +// "process.runtime.name" semantic conventions. It represents the name of the +// runtime of this process. For compiled native binaries, this SHOULD be the +// name of the compiler. +func ProcessRuntimeName(val string) attribute.KeyValue { + return ProcessRuntimeNameKey.String(val) +} + +// ProcessRuntimeVersion returns an attribute KeyValue conforming to the +// "process.runtime.version" semantic conventions. It represents the version of +// the runtime of this process, as returned by the runtime without +// modification. +func ProcessRuntimeVersion(val string) attribute.KeyValue { + return ProcessRuntimeVersionKey.String(val) +} + +// The Android platform on which the Android application is running. +const ( + // AndroidOSAPILevelKey is the attribute Key conforming to the + // "android.os.api_level" semantic conventions. It represents the uniquely + // identifies the framework API revision offered by a version + // (`os.version`) of the android operating system. More information can be + // found + // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '33', '32' + AndroidOSAPILevelKey = attribute.Key("android.os.api_level") +) + +// AndroidOSAPILevel returns an attribute KeyValue conforming to the +// "android.os.api_level" semantic conventions. It represents the uniquely +// identifies the framework API revision offered by a version (`os.version`) of +// the android operating system. More information can be found +// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). +func AndroidOSAPILevel(val string) attribute.KeyValue { + return AndroidOSAPILevelKey.String(val) +} + +// The web browser in which the application represented by the resource is +// running. The `browser.*` attributes MUST be used only for resources that +// represent applications running in a web browser (regardless of whether +// running on a mobile or desktop device). +const ( + // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" + // semantic conventions. It represents the array of brand name and version + // separated by a space + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.brands`). + BrowserBrandsKey = attribute.Key("browser.brands") + + // BrowserLanguageKey is the attribute Key conforming to the + // "browser.language" semantic conventions. It represents the preferred + // language of the user using the browser + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'en', 'en-US', 'fr', 'fr-FR' + // Note: This value is intended to be taken from the Navigator API + // `navigator.language`. + BrowserLanguageKey = attribute.Key("browser.language") + + // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" + // semantic conventions. It represents a boolean that is true if the + // browser is running on a mobile device + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.mobile`). If unavailable, this attribute + // SHOULD be left unset. + BrowserMobileKey = attribute.Key("browser.mobile") + + // BrowserPlatformKey is the attribute Key conforming to the + // "browser.platform" semantic conventions. It represents the platform on + // which the browser is running + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Windows', 'macOS', 'Android' + // Note: This value is intended to be taken from the [UA client hints + // API](https://wicg.github.io/ua-client-hints/#interface) + // (`navigator.userAgentData.platform`). If unavailable, the legacy + // `navigator.platform` API SHOULD NOT be used instead and this attribute + // SHOULD be left unset in order for the values to be consistent. + // The list of possible values is defined in the [W3C User-Agent Client + // Hints + // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). + // Note that some (but not all) of these values can overlap with values in + // the [`os.type` and `os.name` attributes](./os.md). However, for + // consistency, the values in the `browser.platform` attribute should + // capture the exact value that the user agent provides. + BrowserPlatformKey = attribute.Key("browser.platform") +) + +// BrowserBrands returns an attribute KeyValue conforming to the +// "browser.brands" semantic conventions. It represents the array of brand name +// and version separated by a space +func BrowserBrands(val ...string) attribute.KeyValue { + return BrowserBrandsKey.StringSlice(val) +} + +// BrowserLanguage returns an attribute KeyValue conforming to the +// "browser.language" semantic conventions. It represents the preferred +// language of the user using the browser +func BrowserLanguage(val string) attribute.KeyValue { + return BrowserLanguageKey.String(val) +} + +// BrowserMobile returns an attribute KeyValue conforming to the +// "browser.mobile" semantic conventions. It represents a boolean that is true +// if the browser is running on a mobile device +func BrowserMobile(val bool) attribute.KeyValue { + return BrowserMobileKey.Bool(val) +} + +// BrowserPlatform returns an attribute KeyValue conforming to the +// "browser.platform" semantic conventions. It represents the platform on which +// the browser is running +func BrowserPlatform(val string) attribute.KeyValue { + return BrowserPlatformKey.String(val) +} + +// Resources used by AWS Elastic Container Service (ECS). +const ( + // AWSECSClusterARNKey is the attribute Key conforming to the + // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an + // [ECS + // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") + + // AWSECSContainerARNKey is the attribute Key conforming to the + // "aws.ecs.container.arn" semantic conventions. It represents the Amazon + // Resource Name (ARN) of an [ECS container + // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' + AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") + + // AWSECSLaunchtypeKey is the attribute Key conforming to the + // "aws.ecs.launchtype" semantic conventions. It represents the [launch + // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) + // for an ECS task. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") + + // AWSECSTaskARNKey is the attribute Key conforming to the + // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an + // [ECS task + // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") + + // AWSECSTaskFamilyKey is the attribute Key conforming to the + // "aws.ecs.task.family" semantic conventions. It represents the task + // definition family this task definition is a member of. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'opentelemetry-family' + AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") + + // AWSECSTaskRevisionKey is the attribute Key conforming to the + // "aws.ecs.task.revision" semantic conventions. It represents the revision + // for this task definition. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '8', '26' + AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") +) + +var ( + // ec2 + AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") + // fargate + AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") +) + +// AWSECSClusterARN returns an attribute KeyValue conforming to the +// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS +// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). +func AWSECSClusterARN(val string) attribute.KeyValue { + return AWSECSClusterARNKey.String(val) +} + +// AWSECSContainerARN returns an attribute KeyValue conforming to the +// "aws.ecs.container.arn" semantic conventions. It represents the Amazon +// Resource Name (ARN) of an [ECS container +// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). +func AWSECSContainerARN(val string) attribute.KeyValue { + return AWSECSContainerARNKey.String(val) +} + +// AWSECSTaskARN returns an attribute KeyValue conforming to the +// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS +// task +// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). +func AWSECSTaskARN(val string) attribute.KeyValue { + return AWSECSTaskARNKey.String(val) +} + +// AWSECSTaskFamily returns an attribute KeyValue conforming to the +// "aws.ecs.task.family" semantic conventions. It represents the task +// definition family this task definition is a member of. +func AWSECSTaskFamily(val string) attribute.KeyValue { + return AWSECSTaskFamilyKey.String(val) +} + +// AWSECSTaskRevision returns an attribute KeyValue conforming to the +// "aws.ecs.task.revision" semantic conventions. It represents the revision for +// this task definition. +func AWSECSTaskRevision(val string) attribute.KeyValue { + return AWSECSTaskRevisionKey.String(val) +} + +// Resources used by AWS Elastic Kubernetes Service (EKS). +const ( + // AWSEKSClusterARNKey is the attribute Key conforming to the + // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an + // EKS cluster. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' + AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") +) + +// AWSEKSClusterARN returns an attribute KeyValue conforming to the +// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS +// cluster. +func AWSEKSClusterARN(val string) attribute.KeyValue { + return AWSEKSClusterARNKey.String(val) +} + +// Resources specific to Amazon Web Services. +const ( + // AWSLogGroupARNsKey is the attribute Key conforming to the + // "aws.log.group.arns" semantic conventions. It represents the Amazon + // Resource Name(s) (ARN) of the AWS log group(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' + // Note: See the [log group ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") + + // AWSLogGroupNamesKey is the attribute Key conforming to the + // "aws.log.group.names" semantic conventions. It represents the name(s) of + // the AWS log group(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/aws/lambda/my-function', 'opentelemetry-service' + // Note: Multiple log groups must be supported for cases like + // multi-container applications, where a single application has sidecar + // containers, and each write to their own log group. + AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") + + // AWSLogStreamARNsKey is the attribute Key conforming to the + // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of + // the AWS log stream(s). + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + // Note: See the [log stream ARN format + // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + // One log group can contain several log streams, so these ARNs necessarily + // identify both a log group and a log stream. + AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") + + // AWSLogStreamNamesKey is the attribute Key conforming to the + // "aws.log.stream.names" semantic conventions. It represents the name(s) + // of the AWS log stream(s) an application is writing to. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' + AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") +) + +// AWSLogGroupARNs returns an attribute KeyValue conforming to the +// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource +// Name(s) (ARN) of the AWS log group(s). +func AWSLogGroupARNs(val ...string) attribute.KeyValue { + return AWSLogGroupARNsKey.StringSlice(val) +} + +// AWSLogGroupNames returns an attribute KeyValue conforming to the +// "aws.log.group.names" semantic conventions. It represents the name(s) of the +// AWS log group(s) an application is writing to. +func AWSLogGroupNames(val ...string) attribute.KeyValue { + return AWSLogGroupNamesKey.StringSlice(val) +} + +// AWSLogStreamARNs returns an attribute KeyValue conforming to the +// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the +// AWS log stream(s). +func AWSLogStreamARNs(val ...string) attribute.KeyValue { + return AWSLogStreamARNsKey.StringSlice(val) +} + +// AWSLogStreamNames returns an attribute KeyValue conforming to the +// "aws.log.stream.names" semantic conventions. It represents the name(s) of +// the AWS log stream(s) an application is writing to. +func AWSLogStreamNames(val ...string) attribute.KeyValue { + return AWSLogStreamNamesKey.StringSlice(val) +} + +// Resource used by Google Cloud Run. +const ( + // GCPCloudRunJobExecutionKey is the attribute Key conforming to the + // "gcp.cloud_run.job.execution" semantic conventions. It represents the + // name of the Cloud Run + // [execution](https://cloud.google.com/run/docs/managing/job-executions) + // being run for the Job, as set by the + // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'job-name-xxxx', 'sample-job-mdw84' + GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") + + // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the + // "gcp.cloud_run.job.task_index" semantic conventions. It represents the + // index for a task within an execution as provided by the + // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) + // environment variable. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 0, 1 + GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") +) + +// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.execution" semantic conventions. It represents the name +// of the Cloud Run +// [execution](https://cloud.google.com/run/docs/managing/job-executions) being +// run for the Job, as set by the +// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobExecution(val string) attribute.KeyValue { + return GCPCloudRunJobExecutionKey.String(val) +} + +// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the +// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index +// for a task within an execution as provided by the +// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) +// environment variable. +func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { + return GCPCloudRunJobTaskIndexKey.Int(val) +} + +// Resources used by Google Compute Engine (GCE). +const ( + // GCPGceInstanceHostnameKey is the attribute Key conforming to the + // "gcp.gce.instance.hostname" semantic conventions. It represents the + // hostname of a GCE instance. This is the full value of the default or + // [custom + // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-host1234.example.com', + // 'sample-vm.us-west1-b.c.my-project.internal' + GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") + + // GCPGceInstanceNameKey is the attribute Key conforming to the + // "gcp.gce.instance.name" semantic conventions. It represents the instance + // name of a GCE instance. This is the value provided by `host.name`, the + // visible name of the instance in the Cloud Console UI, and the prefix for + // the default hostname of the instance as defined by the [default internal + // DNS + // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'instance-1', 'my-vm-name' + GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") +) + +// GCPGceInstanceHostname returns an attribute KeyValue conforming to the +// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname +// of a GCE instance. This is the full value of the default or [custom +// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). +func GCPGceInstanceHostname(val string) attribute.KeyValue { + return GCPGceInstanceHostnameKey.String(val) +} + +// GCPGceInstanceName returns an attribute KeyValue conforming to the +// "gcp.gce.instance.name" semantic conventions. It represents the instance +// name of a GCE instance. This is the value provided by `host.name`, the +// visible name of the instance in the Cloud Console UI, and the prefix for the +// default hostname of the instance as defined by the [default internal DNS +// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). +func GCPGceInstanceName(val string) attribute.KeyValue { + return GCPGceInstanceNameKey.String(val) +} + +// Heroku dyno metadata +const ( + // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" + // semantic conventions. It represents the unique identifier for the + // application + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' + HerokuAppIDKey = attribute.Key("heroku.app.id") + + // HerokuReleaseCommitKey is the attribute Key conforming to the + // "heroku.release.commit" semantic conventions. It represents the commit + // hash for the current release + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' + HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") + + // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the + // "heroku.release.creation_timestamp" semantic conventions. It represents + // the time and date the release was created + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2022-10-23T18:00:42Z' + HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") +) + +// HerokuAppID returns an attribute KeyValue conforming to the +// "heroku.app.id" semantic conventions. It represents the unique identifier +// for the application +func HerokuAppID(val string) attribute.KeyValue { + return HerokuAppIDKey.String(val) +} + +// HerokuReleaseCommit returns an attribute KeyValue conforming to the +// "heroku.release.commit" semantic conventions. It represents the commit hash +// for the current release +func HerokuReleaseCommit(val string) attribute.KeyValue { + return HerokuReleaseCommitKey.String(val) +} + +// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming +// to the "heroku.release.creation_timestamp" semantic conventions. It +// represents the time and date the release was created +func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { + return HerokuReleaseCreationTimestampKey.String(val) +} + +// The software deployment. +const ( + // DeploymentEnvironmentKey is the attribute Key conforming to the + // "deployment.environment" semantic conventions. It represents the name of + // the [deployment + // environment](https://wikipedia.org/wiki/Deployment_environment) (aka + // deployment tier). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'staging', 'production' + // Note: `deployment.environment` does not affect the uniqueness + // constraints defined through + // the `service.namespace`, `service.name` and `service.instance.id` + // resource attributes. + // This implies that resources carrying the following attribute + // combinations MUST be + // considered to be identifying the same service: + // + // * `service.name=frontend`, `deployment.environment=production` + // * `service.name=frontend`, `deployment.environment=staging`. + DeploymentEnvironmentKey = attribute.Key("deployment.environment") +) + +// DeploymentEnvironment returns an attribute KeyValue conforming to the +// "deployment.environment" semantic conventions. It represents the name of the +// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) +// (aka deployment tier). +func DeploymentEnvironment(val string) attribute.KeyValue { + return DeploymentEnvironmentKey.String(val) +} + +// A serverless instance. +const ( + // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" + // semantic conventions. It represents the execution environment ID as a + // string, that will be potentially reused for other invocations to the + // same function/function version. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' + // Note: * **AWS Lambda:** Use the (full) log stream name. + FaaSInstanceKey = attribute.Key("faas.instance") + + // FaaSMaxMemoryKey is the attribute Key conforming to the + // "faas.max_memory" semantic conventions. It represents the amount of + // memory available to the serverless function converted to Bytes. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 134217728 + // Note: It's recommended to set this attribute since e.g. too little + // memory can easily stop a Java AWS Lambda function from working + // correctly. On AWS Lambda, the environment variable + // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must + // be multiplied by 1,048,576). + FaaSMaxMemoryKey = attribute.Key("faas.max_memory") + + // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic + // conventions. It represents the name of the single function that this + // runtime instance executes. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'my-function', 'myazurefunctionapp/some-function-name' + // Note: This is the name of the function as configured/deployed on the + // FaaS + // platform and is usually different from the name of the callback + // function (which may be stored in the + // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) + // span attributes). + // + // For some cloud providers, the above definition is ambiguous. The + // following + // definition of function name MUST be used for this attribute + // (and consequently the span name) for the listed cloud + // providers/products: + // + // * **Azure:** The full name `/`, i.e., function app name + // followed by a forward slash followed by the function name (this form + // can also be seen in the resource JSON for the function). + // This means that a span attribute MUST be used, as an Azure function + // app can host multiple functions that would usually share + // a TracerProvider (see also the `cloud.resource_id` attribute). + FaaSNameKey = attribute.Key("faas.name") + + // FaaSVersionKey is the attribute Key conforming to the "faas.version" + // semantic conventions. It represents the immutable version of the + // function being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '26', 'pinkfroid-00002' + // Note: Depending on the cloud provider and platform, use: + // + // * **AWS Lambda:** The [function + // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + // (an integer represented as a decimal string). + // * **Google Cloud Run (Services):** The + // [revision](https://cloud.google.com/run/docs/managing/revisions) + // (i.e., the function name plus the revision suffix). + // * **Google Cloud Functions:** The value of the + // [`K_REVISION` environment + // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + // * **Azure Functions:** Not applicable. Do not set this attribute. + FaaSVersionKey = attribute.Key("faas.version") +) + +// FaaSInstance returns an attribute KeyValue conforming to the +// "faas.instance" semantic conventions. It represents the execution +// environment ID as a string, that will be potentially reused for other +// invocations to the same function/function version. +func FaaSInstance(val string) attribute.KeyValue { + return FaaSInstanceKey.String(val) +} + +// FaaSMaxMemory returns an attribute KeyValue conforming to the +// "faas.max_memory" semantic conventions. It represents the amount of memory +// available to the serverless function converted to Bytes. +func FaaSMaxMemory(val int) attribute.KeyValue { + return FaaSMaxMemoryKey.Int(val) +} + +// FaaSName returns an attribute KeyValue conforming to the "faas.name" +// semantic conventions. It represents the name of the single function that +// this runtime instance executes. +func FaaSName(val string) attribute.KeyValue { + return FaaSNameKey.String(val) +} + +// FaaSVersion returns an attribute KeyValue conforming to the +// "faas.version" semantic conventions. It represents the immutable version of +// the function being executed. +func FaaSVersion(val string) attribute.KeyValue { + return FaaSVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceNameKey is the attribute Key conforming to the "service.name" + // semantic conventions. It represents the logical name of the service. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'shoppingcart' + // Note: MUST be the same for all instances of horizontally scaled + // services. If the value was not specified, SDKs MUST fallback to + // `unknown_service:` concatenated with + // [`process.executable.name`](process.md#process), e.g. + // `unknown_service:bash`. If `process.executable.name` is not available, + // the value MUST be set to `unknown_service`. + ServiceNameKey = attribute.Key("service.name") + + // ServiceVersionKey is the attribute Key conforming to the + // "service.version" semantic conventions. It represents the version string + // of the service API or implementation. The format is not defined by these + // conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2.0.0', 'a01dbef8a' + ServiceVersionKey = attribute.Key("service.version") +) + +// ServiceName returns an attribute KeyValue conforming to the +// "service.name" semantic conventions. It represents the logical name of the +// service. +func ServiceName(val string) attribute.KeyValue { + return ServiceNameKey.String(val) +} + +// ServiceVersion returns an attribute KeyValue conforming to the +// "service.version" semantic conventions. It represents the version string of +// the service API or implementation. The format is not defined by these +// conventions. +func ServiceVersion(val string) attribute.KeyValue { + return ServiceVersionKey.String(val) +} + +// A service instance. +const ( + // ServiceInstanceIDKey is the attribute Key conforming to the + // "service.instance.id" semantic conventions. It represents the string ID + // of the service instance. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'my-k8s-pod-deployment-1', + // '627cc493-f310-47de-96bd-71410b7dec09' + // Note: MUST be unique for each instance of the same + // `service.namespace,service.name` pair (in other words + // `service.namespace,service.name,service.instance.id` triplet MUST be + // globally unique). The ID helps to distinguish instances of the same + // service that exist at the same time (e.g. instances of a horizontally + // scaled service). It is preferable for the ID to be persistent and stay + // the same for the lifetime of the service instance, however it is + // acceptable that the ID is ephemeral and changes during important + // lifetime events for the service (e.g. service restarts). If the service + // has no inherent unique ID that can be used as the value of this + // attribute it is recommended to generate a random Version 1 or Version 4 + // RFC 4122 UUID (services aiming for reproducible UUIDs may also use + // Version 5, see RFC 4122 for more recommendations). + ServiceInstanceIDKey = attribute.Key("service.instance.id") + + // ServiceNamespaceKey is the attribute Key conforming to the + // "service.namespace" semantic conventions. It represents a namespace for + // `service.name`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Shop' + // Note: A string value having a meaning that helps to distinguish a group + // of services, for example the team name that owns a group of services. + // `service.name` is expected to be unique within the same namespace. If + // `service.namespace` is not specified in the Resource then `service.name` + // is expected to be unique for all services that have no explicit + // namespace defined (so the empty/unspecified namespace is simply one more + // valid namespace). Zero-length namespace string is assumed equal to + // unspecified namespace. + ServiceNamespaceKey = attribute.Key("service.namespace") +) + +// ServiceInstanceID returns an attribute KeyValue conforming to the +// "service.instance.id" semantic conventions. It represents the string ID of +// the service instance. +func ServiceInstanceID(val string) attribute.KeyValue { + return ServiceInstanceIDKey.String(val) +} + +// ServiceNamespace returns an attribute KeyValue conforming to the +// "service.namespace" semantic conventions. It represents a namespace for +// `service.name`. +func ServiceNamespace(val string) attribute.KeyValue { + return ServiceNamespaceKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetrySDKLanguageKey is the attribute Key conforming to the + // "telemetry.sdk.language" semantic conventions. It represents the + // language of the telemetry SDK. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") + + // TelemetrySDKNameKey is the attribute Key conforming to the + // "telemetry.sdk.name" semantic conventions. It represents the name of the + // telemetry SDK as defined above. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'opentelemetry' + // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute + // to `opentelemetry`. + // If another SDK, like a fork or a vendor-provided implementation, is + // used, this SDK MUST set the + // `telemetry.sdk.name` attribute to the fully-qualified class or module + // name of this SDK's main entry point + // or another suitable identifier depending on the language. + // The identifier `opentelemetry` is reserved and MUST NOT be used in this + // case. + // All custom identifiers SHOULD be stable across different versions of an + // implementation. + TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") + + // TelemetrySDKVersionKey is the attribute Key conforming to the + // "telemetry.sdk.version" semantic conventions. It represents the version + // string of the telemetry SDK. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '1.2.3' + TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") +) + +var ( + // cpp + TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") + // dotnet + TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") + // erlang + TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") + // go + TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") + // java + TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") + // nodejs + TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") + // php + TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") + // python + TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") + // ruby + TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") + // rust + TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") + // swift + TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") + // webjs + TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") +) + +// TelemetrySDKName returns an attribute KeyValue conforming to the +// "telemetry.sdk.name" semantic conventions. It represents the name of the +// telemetry SDK as defined above. +func TelemetrySDKName(val string) attribute.KeyValue { + return TelemetrySDKNameKey.String(val) +} + +// TelemetrySDKVersion returns an attribute KeyValue conforming to the +// "telemetry.sdk.version" semantic conventions. It represents the version +// string of the telemetry SDK. +func TelemetrySDKVersion(val string) attribute.KeyValue { + return TelemetrySDKVersionKey.String(val) +} + +// The telemetry SDK used to capture data recorded by the instrumentation +// libraries. +const ( + // TelemetryDistroNameKey is the attribute Key conforming to the + // "telemetry.distro.name" semantic conventions. It represents the name of + // the auto instrumentation agent or distribution, if used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'parts-unlimited-java' + // Note: Official auto instrumentation agents and distributions SHOULD set + // the `telemetry.distro.name` attribute to + // a string starting with `opentelemetry-`, e.g. + // `opentelemetry-java-instrumentation`. + TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") + + // TelemetryDistroVersionKey is the attribute Key conforming to the + // "telemetry.distro.version" semantic conventions. It represents the + // version string of the auto instrumentation agent or distribution, if + // used. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.2.3' + TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") +) + +// TelemetryDistroName returns an attribute KeyValue conforming to the +// "telemetry.distro.name" semantic conventions. It represents the name of the +// auto instrumentation agent or distribution, if used. +func TelemetryDistroName(val string) attribute.KeyValue { + return TelemetryDistroNameKey.String(val) +} + +// TelemetryDistroVersion returns an attribute KeyValue conforming to the +// "telemetry.distro.version" semantic conventions. It represents the version +// string of the auto instrumentation agent or distribution, if used. +func TelemetryDistroVersion(val string) attribute.KeyValue { + return TelemetryDistroVersionKey.String(val) +} + +// Resource describing the packaged software running the application code. Web +// engines are typically executed using process.runtime. +const ( + // WebEngineDescriptionKey is the attribute Key conforming to the + // "webengine.description" semantic conventions. It represents the + // additional description of the web engine (e.g. detailed version and + // edition information). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - + // 2.2.2.Final' + WebEngineDescriptionKey = attribute.Key("webengine.description") + + // WebEngineNameKey is the attribute Key conforming to the "webengine.name" + // semantic conventions. It represents the name of the web engine. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'WildFly' + WebEngineNameKey = attribute.Key("webengine.name") + + // WebEngineVersionKey is the attribute Key conforming to the + // "webengine.version" semantic conventions. It represents the version of + // the web engine. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '21.0.0' + WebEngineVersionKey = attribute.Key("webengine.version") +) + +// WebEngineDescription returns an attribute KeyValue conforming to the +// "webengine.description" semantic conventions. It represents the additional +// description of the web engine (e.g. detailed version and edition +// information). +func WebEngineDescription(val string) attribute.KeyValue { + return WebEngineDescriptionKey.String(val) +} + +// WebEngineName returns an attribute KeyValue conforming to the +// "webengine.name" semantic conventions. It represents the name of the web +// engine. +func WebEngineName(val string) attribute.KeyValue { + return WebEngineNameKey.String(val) +} + +// WebEngineVersion returns an attribute KeyValue conforming to the +// "webengine.version" semantic conventions. It represents the version of the +// web engine. +func WebEngineVersion(val string) attribute.KeyValue { + return WebEngineVersionKey.String(val) +} + +// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's +// concepts. +const ( + // OTelScopeNameKey is the attribute Key conforming to the + // "otel.scope.name" semantic conventions. It represents the name of the + // instrumentation scope - (`InstrumentationScope.Name` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'io.opentelemetry.contrib.mongodb' + OTelScopeNameKey = attribute.Key("otel.scope.name") + + // OTelScopeVersionKey is the attribute Key conforming to the + // "otel.scope.version" semantic conventions. It represents the version of + // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0.0' + OTelScopeVersionKey = attribute.Key("otel.scope.version") +) + +// OTelScopeName returns an attribute KeyValue conforming to the +// "otel.scope.name" semantic conventions. It represents the name of the +// instrumentation scope - (`InstrumentationScope.Name` in OTLP). +func OTelScopeName(val string) attribute.KeyValue { + return OTelScopeNameKey.String(val) +} + +// OTelScopeVersion returns an attribute KeyValue conforming to the +// "otel.scope.version" semantic conventions. It represents the version of the +// instrumentation scope - (`InstrumentationScope.Version` in OTLP). +func OTelScopeVersion(val string) attribute.KeyValue { + return OTelScopeVersionKey.String(val) +} + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry +// Scope's concepts. +const ( + // OTelLibraryNameKey is the attribute Key conforming to the + // "otel.library.name" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: 'io.opentelemetry.contrib.mongodb' + // Deprecated: use the `otel.scope.name` attribute. + OTelLibraryNameKey = attribute.Key("otel.library.name") + + // OTelLibraryVersionKey is the attribute Key conforming to the + // "otel.library.version" semantic conventions. + // + // Type: string + // RequirementLevel: Optional + // Stability: deprecated + // Examples: '1.0.0' + // Deprecated: use the `otel.scope.version` attribute. + OTelLibraryVersionKey = attribute.Key("otel.library.version") +) + +// OTelLibraryName returns an attribute KeyValue conforming to the +// "otel.library.name" semantic conventions. +// +// Deprecated: use the `otel.scope.name` attribute. +func OTelLibraryName(val string) attribute.KeyValue { + return OTelLibraryNameKey.String(val) +} + +// OTelLibraryVersion returns an attribute KeyValue conforming to the +// "otel.library.version" semantic conventions. +// +// Deprecated: use the `otel.scope.version` attribute. +func OTelLibraryVersion(val string) attribute.KeyValue { + return OTelLibraryVersionKey.String(val) +} diff --git a/semconv/v1.24.0/schema.go b/semconv/v1.24.0/schema.go new file mode 100644 index 00000000000..9733ce888a0 --- /dev/null +++ b/semconv/v1.24.0/schema.go @@ -0,0 +1,20 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +// SchemaURL is the schema URL that matches the version of the semantic conventions +// that this package defines. Semconv packages starting from v1.4.0 must declare +// non-empty schema URL in the form https://opentelemetry.io/schemas/ +const SchemaURL = "https://opentelemetry.io/schemas/1.24.0" diff --git a/semconv/v1.24.0/trace.go b/semconv/v1.24.0/trace.go new file mode 100644 index 00000000000..397174818b7 --- /dev/null +++ b/semconv/v1.24.0/trace.go @@ -0,0 +1,1334 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated from semantic convention specification. DO NOT EDIT. + +package semconv // import "go.opentelemetry.io/otel/semconv/v1.24.0" + +import "go.opentelemetry.io/otel/attribute" + +// Operations that access some remote service. +const ( + // PeerServiceKey is the attribute Key conforming to the "peer.service" + // semantic conventions. It represents the + // [`service.name`](/docs/resource/README.md#service) of the remote + // service. SHOULD be equal to the actual `service.name` resource attribute + // of the remote service if any. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'AuthTokenCache' + PeerServiceKey = attribute.Key("peer.service") +) + +// PeerService returns an attribute KeyValue conforming to the +// "peer.service" semantic conventions. It represents the +// [`service.name`](/docs/resource/README.md#service) of the remote service. +// SHOULD be equal to the actual `service.name` resource attribute of the +// remote service if any. +func PeerService(val string) attribute.KeyValue { + return PeerServiceKey.String(val) +} + +// These attributes may be used for any operation with an authenticated and/or +// authorized enduser. +const ( + // EnduserIDKey is the attribute Key conforming to the "enduser.id" + // semantic conventions. It represents the username or client_id extracted + // from the access token or + // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header + // in the inbound request from outside the system. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'username' + EnduserIDKey = attribute.Key("enduser.id") + + // EnduserRoleKey is the attribute Key conforming to the "enduser.role" + // semantic conventions. It represents the actual/assumed role the client + // is making the request under extracted from token or application security + // context. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'admin' + EnduserRoleKey = attribute.Key("enduser.role") + + // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" + // semantic conventions. It represents the scopes or granted authorities + // the client currently possesses extracted from token or application + // security context. The value would come from the scope associated with an + // [OAuth 2.0 Access + // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute + // value in a [SAML 2.0 + // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'read:message, write:files' + EnduserScopeKey = attribute.Key("enduser.scope") +) + +// EnduserID returns an attribute KeyValue conforming to the "enduser.id" +// semantic conventions. It represents the username or client_id extracted from +// the access token or +// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in +// the inbound request from outside the system. +func EnduserID(val string) attribute.KeyValue { + return EnduserIDKey.String(val) +} + +// EnduserRole returns an attribute KeyValue conforming to the +// "enduser.role" semantic conventions. It represents the actual/assumed role +// the client is making the request under extracted from token or application +// security context. +func EnduserRole(val string) attribute.KeyValue { + return EnduserRoleKey.String(val) +} + +// EnduserScope returns an attribute KeyValue conforming to the +// "enduser.scope" semantic conventions. It represents the scopes or granted +// authorities the client currently possesses extracted from token or +// application security context. The value would come from the scope associated +// with an [OAuth 2.0 Access +// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute +// value in a [SAML 2.0 +// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). +func EnduserScope(val string) attribute.KeyValue { + return EnduserScopeKey.String(val) +} + +// These attributes allow to report this unit of code and therefore to provide +// more context about the span. +const ( + // CodeColumnKey is the attribute Key conforming to the "code.column" + // semantic conventions. It represents the column number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 16 + CodeColumnKey = attribute.Key("code.column") + + // CodeFilepathKey is the attribute Key conforming to the "code.filepath" + // semantic conventions. It represents the source code file name that + // identifies the code unit as uniquely as possible (preferably an absolute + // file path). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '/usr/local/MyApplication/content_root/app/index.php' + CodeFilepathKey = attribute.Key("code.filepath") + + // CodeFunctionKey is the attribute Key conforming to the "code.function" + // semantic conventions. It represents the method or function name, or + // equivalent (usually rightmost part of the code unit's name). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'serveRequest' + CodeFunctionKey = attribute.Key("code.function") + + // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" + // semantic conventions. It represents the line number in `code.filepath` + // best representing the operation. It SHOULD point within the code unit + // named in `code.function`. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + CodeLineNumberKey = attribute.Key("code.lineno") + + // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" + // semantic conventions. It represents the "namespace" within which + // `code.function` is defined. Usually the qualified class or module name, + // such that `code.namespace` + some separator + `code.function` form a + // unique identifier for the code unit. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.example.MyHTTPService' + CodeNamespaceKey = attribute.Key("code.namespace") + + // CodeStacktraceKey is the attribute Key conforming to the + // "code.stacktrace" semantic conventions. It represents a stacktrace as a + // string in the natural representation for the language runtime. The + // representation is to be determined and documented by each language SIG. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'at + // com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' + // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' + // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' + CodeStacktraceKey = attribute.Key("code.stacktrace") +) + +// CodeColumn returns an attribute KeyValue conforming to the "code.column" +// semantic conventions. It represents the column number in `code.filepath` +// best representing the operation. It SHOULD point within the code unit named +// in `code.function`. +func CodeColumn(val int) attribute.KeyValue { + return CodeColumnKey.Int(val) +} + +// CodeFilepath returns an attribute KeyValue conforming to the +// "code.filepath" semantic conventions. It represents the source code file +// name that identifies the code unit as uniquely as possible (preferably an +// absolute file path). +func CodeFilepath(val string) attribute.KeyValue { + return CodeFilepathKey.String(val) +} + +// CodeFunction returns an attribute KeyValue conforming to the +// "code.function" semantic conventions. It represents the method or function +// name, or equivalent (usually rightmost part of the code unit's name). +func CodeFunction(val string) attribute.KeyValue { + return CodeFunctionKey.String(val) +} + +// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" +// semantic conventions. It represents the line number in `code.filepath` best +// representing the operation. It SHOULD point within the code unit named in +// `code.function`. +func CodeLineNumber(val int) attribute.KeyValue { + return CodeLineNumberKey.Int(val) +} + +// CodeNamespace returns an attribute KeyValue conforming to the +// "code.namespace" semantic conventions. It represents the "namespace" within +// which `code.function` is defined. Usually the qualified class or module +// name, such that `code.namespace` + some separator + `code.function` form a +// unique identifier for the code unit. +func CodeNamespace(val string) attribute.KeyValue { + return CodeNamespaceKey.String(val) +} + +// CodeStacktrace returns an attribute KeyValue conforming to the +// "code.stacktrace" semantic conventions. It represents a stacktrace as a +// string in the natural representation for the language runtime. The +// representation is to be determined and documented by each language SIG. +func CodeStacktrace(val string) attribute.KeyValue { + return CodeStacktraceKey.String(val) +} + +// These attributes may be used for any operation to store information about a +// thread that started a span. +const ( + // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic + // conventions. It represents the current "managed" thread ID (as opposed + // to OS thread ID). + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 42 + ThreadIDKey = attribute.Key("thread.id") + + // ThreadNameKey is the attribute Key conforming to the "thread.name" + // semantic conventions. It represents the current thread name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'main' + ThreadNameKey = attribute.Key("thread.name") +) + +// ThreadID returns an attribute KeyValue conforming to the "thread.id" +// semantic conventions. It represents the current "managed" thread ID (as +// opposed to OS thread ID). +func ThreadID(val int) attribute.KeyValue { + return ThreadIDKey.Int(val) +} + +// ThreadName returns an attribute KeyValue conforming to the "thread.name" +// semantic conventions. It represents the current thread name. +func ThreadName(val string) attribute.KeyValue { + return ThreadNameKey.String(val) +} + +// Span attributes used by AWS Lambda (in addition to general `faas` +// attributes). +const ( + // AWSLambdaInvokedARNKey is the attribute Key conforming to the + // "aws.lambda.invoked_arn" semantic conventions. It represents the full + // invoked ARN as provided on the `Context` passed to the function + // (`Lambda-Runtime-Invoked-Function-ARN` header on the + // `/runtime/invocation/next` applicable). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' + // Note: This may be different from `cloud.resource_id` if an alias is + // involved. + AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") +) + +// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the +// "aws.lambda.invoked_arn" semantic conventions. It represents the full +// invoked ARN as provided on the `Context` passed to the function +// (`Lambda-Runtime-Invoked-Function-ARN` header on the +// `/runtime/invocation/next` applicable). +func AWSLambdaInvokedARN(val string) attribute.KeyValue { + return AWSLambdaInvokedARNKey.String(val) +} + +// Attributes for CloudEvents. CloudEvents is a specification on how to define +// event data in a standard way. These attributes can be attached to spans when +// performing operations with CloudEvents, regardless of the protocol being +// used. +const ( + // CloudeventsEventIDKey is the attribute Key conforming to the + // "cloudevents.event_id" semantic conventions. It represents the + // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) + // uniquely identifies the event. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' + CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") + + // CloudeventsEventSourceKey is the attribute Key conforming to the + // "cloudevents.event_source" semantic conventions. It represents the + // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) + // identifies the context in which an event happened. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'https://github.com/cloudevents', + // '/cloudevents/spec/pull/123', 'my-service' + CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") + + // CloudeventsEventSpecVersionKey is the attribute Key conforming to the + // "cloudevents.event_spec_version" semantic conventions. It represents the + // [version of the CloudEvents + // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) + // which the event uses. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '1.0' + CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") + + // CloudeventsEventSubjectKey is the attribute Key conforming to the + // "cloudevents.event_subject" semantic conventions. It represents the + // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) + // of the event in the context of the event producer (identified by + // source). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'mynewfile.jpg' + CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") + + // CloudeventsEventTypeKey is the attribute Key conforming to the + // "cloudevents.event_type" semantic conventions. It represents the + // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) + // contains a value describing the type of event related to the originating + // occurrence. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'com.github.pull_request.opened', + // 'com.example.object.deleted.v2' + CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") +) + +// CloudeventsEventID returns an attribute KeyValue conforming to the +// "cloudevents.event_id" semantic conventions. It represents the +// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) +// uniquely identifies the event. +func CloudeventsEventID(val string) attribute.KeyValue { + return CloudeventsEventIDKey.String(val) +} + +// CloudeventsEventSource returns an attribute KeyValue conforming to the +// "cloudevents.event_source" semantic conventions. It represents the +// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) +// identifies the context in which an event happened. +func CloudeventsEventSource(val string) attribute.KeyValue { + return CloudeventsEventSourceKey.String(val) +} + +// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to +// the "cloudevents.event_spec_version" semantic conventions. It represents the +// [version of the CloudEvents +// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) +// which the event uses. +func CloudeventsEventSpecVersion(val string) attribute.KeyValue { + return CloudeventsEventSpecVersionKey.String(val) +} + +// CloudeventsEventSubject returns an attribute KeyValue conforming to the +// "cloudevents.event_subject" semantic conventions. It represents the +// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) +// of the event in the context of the event producer (identified by source). +func CloudeventsEventSubject(val string) attribute.KeyValue { + return CloudeventsEventSubjectKey.String(val) +} + +// CloudeventsEventType returns an attribute KeyValue conforming to the +// "cloudevents.event_type" semantic conventions. It represents the +// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) +// contains a value describing the type of event related to the originating +// occurrence. +func CloudeventsEventType(val string) attribute.KeyValue { + return CloudeventsEventTypeKey.String(val) +} + +// Semantic conventions for the OpenTracing Shim +const ( + // OpentracingRefTypeKey is the attribute Key conforming to the + // "opentracing.ref_type" semantic conventions. It represents the + // parent-child Reference type + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Note: The causal relationship between a child Span and a parent Span. + OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") +) + +var ( + // The parent Span depends on the child Span in some capacity + OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") + // The parent Span doesn't depend in any way on the result of the child Span + OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") +) + +// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's +// concepts. +const ( + // OTelStatusCodeKey is the attribute Key conforming to the + // "otel.status_code" semantic conventions. It represents the name of the + // code, either "OK" or "ERROR". MUST NOT be set if the status code is + // UNSET. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + OTelStatusCodeKey = attribute.Key("otel.status_code") + + // OTelStatusDescriptionKey is the attribute Key conforming to the + // "otel.status_description" semantic conventions. It represents the + // description of the Status if it has a value, otherwise not set. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'resource not found' + OTelStatusDescriptionKey = attribute.Key("otel.status_description") +) + +var ( + // The operation has been validated by an Application developer or Operator to have completed successfully + OTelStatusCodeOk = OTelStatusCodeKey.String("OK") + // The operation contains an error + OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") +) + +// OTelStatusDescription returns an attribute KeyValue conforming to the +// "otel.status_description" semantic conventions. It represents the +// description of the Status if it has a value, otherwise not set. +func OTelStatusDescription(val string) attribute.KeyValue { + return OTelStatusDescriptionKey.String(val) +} + +// This semantic convention describes an instance of a function that runs +// without provisioning or managing of servers (also known as serverless +// functions or Function as a Service (FaaS)) with spans. +const ( + // FaaSInvocationIDKey is the attribute Key conforming to the + // "faas.invocation_id" semantic conventions. It represents the invocation + // ID of the current function invocation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' + FaaSInvocationIDKey = attribute.Key("faas.invocation_id") +) + +// FaaSInvocationID returns an attribute KeyValue conforming to the +// "faas.invocation_id" semantic conventions. It represents the invocation ID +// of the current function invocation. +func FaaSInvocationID(val string) attribute.KeyValue { + return FaaSInvocationIDKey.String(val) +} + +// Semantic Convention for FaaS triggered as a response to some data source +// operation such as a database or filesystem read/write. +const ( + // FaaSDocumentCollectionKey is the attribute Key conforming to the + // "faas.document.collection" semantic conventions. It represents the name + // of the source on which the triggering operation was performed. For + // example, in Cloud Storage or S3 corresponds to the bucket name, and in + // Cosmos DB to the database name. + // + // Type: string + // RequirementLevel: Required + // Stability: experimental + // Examples: 'myBucketName', 'myDBName' + FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") + + // FaaSDocumentNameKey is the attribute Key conforming to the + // "faas.document.name" semantic conventions. It represents the document + // name/table subjected to the operation. For example, in Cloud Storage or + // S3 is the name of the file, and in Cosmos DB the table name. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'myFile.txt', 'myTableName' + FaaSDocumentNameKey = attribute.Key("faas.document.name") + + // FaaSDocumentOperationKey is the attribute Key conforming to the + // "faas.document.operation" semantic conventions. It represents the + // describes the type of the operation that was performed on the data. + // + // Type: Enum + // RequirementLevel: Required + // Stability: experimental + FaaSDocumentOperationKey = attribute.Key("faas.document.operation") + + // FaaSDocumentTimeKey is the attribute Key conforming to the + // "faas.document.time" semantic conventions. It represents a string + // containing the time when the data was accessed in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSDocumentTimeKey = attribute.Key("faas.document.time") +) + +var ( + // When a new object is created + FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") + // When an object is modified + FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") + // When an object is deleted + FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") +) + +// FaaSDocumentCollection returns an attribute KeyValue conforming to the +// "faas.document.collection" semantic conventions. It represents the name of +// the source on which the triggering operation was performed. For example, in +// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the +// database name. +func FaaSDocumentCollection(val string) attribute.KeyValue { + return FaaSDocumentCollectionKey.String(val) +} + +// FaaSDocumentName returns an attribute KeyValue conforming to the +// "faas.document.name" semantic conventions. It represents the document +// name/table subjected to the operation. For example, in Cloud Storage or S3 +// is the name of the file, and in Cosmos DB the table name. +func FaaSDocumentName(val string) attribute.KeyValue { + return FaaSDocumentNameKey.String(val) +} + +// FaaSDocumentTime returns an attribute KeyValue conforming to the +// "faas.document.time" semantic conventions. It represents a string containing +// the time when the data was accessed in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSDocumentTime(val string) attribute.KeyValue { + return FaaSDocumentTimeKey.String(val) +} + +// Semantic Convention for FaaS scheduled to be executed regularly. +const ( + // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic + // conventions. It represents a string containing the schedule period as + // [Cron + // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '0/5 * * * ? *' + FaaSCronKey = attribute.Key("faas.cron") + + // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic + // conventions. It represents a string containing the function invocation + // time in the [ISO + // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format + // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '2020-01-23T13:47:06Z' + FaaSTimeKey = attribute.Key("faas.time") +) + +// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" +// semantic conventions. It represents a string containing the schedule period +// as [Cron +// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). +func FaaSCron(val string) attribute.KeyValue { + return FaaSCronKey.String(val) +} + +// FaaSTime returns an attribute KeyValue conforming to the "faas.time" +// semantic conventions. It represents a string containing the function +// invocation time in the [ISO +// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format +// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). +func FaaSTime(val string) attribute.KeyValue { + return FaaSTimeKey.String(val) +} + +// Contains additional attributes for incoming FaaS spans. +const ( + // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" + // semantic conventions. It represents a boolean that is true if the + // serverless function is executed for the first time (aka cold-start). + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + FaaSColdstartKey = attribute.Key("faas.coldstart") +) + +// FaaSColdstart returns an attribute KeyValue conforming to the +// "faas.coldstart" semantic conventions. It represents a boolean that is true +// if the serverless function is executed for the first time (aka cold-start). +func FaaSColdstart(val bool) attribute.KeyValue { + return FaaSColdstartKey.Bool(val) +} + +// The `aws` conventions apply to operations using the AWS SDK. They map +// request or response parameters in AWS SDK API calls to attributes on a Span. +// The conventions have been collected over time based on feedback from AWS +// users of tracing and will continue to evolve as new interesting conventions +// are found. +// Some descriptions are also provided for populating general OpenTelemetry +// semantic conventions based on these APIs. +const ( + // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" + // semantic conventions. It represents the AWS request ID as returned in + // the response headers `x-amz-request-id` or `x-amz-requestid`. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' + AWSRequestIDKey = attribute.Key("aws.request_id") +) + +// AWSRequestID returns an attribute KeyValue conforming to the +// "aws.request_id" semantic conventions. It represents the AWS request ID as +// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +func AWSRequestID(val string) attribute.KeyValue { + return AWSRequestIDKey.String(val) +} + +// Attributes that exist for multiple DynamoDB request types. +const ( + // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the + // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the + // value of the `AttributesToGet` request parameter. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'lives', 'id' + AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") + + // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the + // "aws.dynamodb.consistent_read" semantic conventions. It represents the + // value of the `ConsistentRead` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") + + // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the + // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the + // JSON-serialized value of each item in the `ConsumedCapacity` response + // field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { + // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": + // { "CapacityUnits": number, "ReadCapacityUnits": number, + // "WriteCapacityUnits": number }, "TableName": "string", + // "WriteCapacityUnits": number }' + AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") + + // AWSDynamoDBIndexNameKey is the attribute Key conforming to the + // "aws.dynamodb.index_name" semantic conventions. It represents the value + // of the `IndexName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'name_to_group' + AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") + + // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to + // the "aws.dynamodb.item_collection_metrics" semantic conventions. It + // represents the JSON-serialized value of the `ItemCollectionMetrics` + // response field. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": + // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { + // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], + // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, + // "SizeEstimateRangeGB": [ number ] } ] }' + AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") + + // AWSDynamoDBLimitKey is the attribute Key conforming to the + // "aws.dynamodb.limit" semantic conventions. It represents the value of + // the `Limit` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") + + // AWSDynamoDBProjectionKey is the attribute Key conforming to the + // "aws.dynamodb.projection" semantic conventions. It represents the value + // of the `ProjectionExpression` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Title', 'Title, Price, Color', 'Title, Description, + // RelatedItems, ProductReviews' + AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") + + // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to + // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It + // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` + // request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") + + // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming + // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. + // It represents the value of the + // `ProvisionedThroughput.WriteCapacityUnits` request parameter. + // + // Type: double + // RequirementLevel: Optional + // Stability: experimental + // Examples: 1.0, 2.0 + AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") + + // AWSDynamoDBSelectKey is the attribute Key conforming to the + // "aws.dynamodb.select" semantic conventions. It represents the value of + // the `Select` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'ALL_ATTRIBUTES', 'COUNT' + AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") + + // AWSDynamoDBTableNamesKey is the attribute Key conforming to the + // "aws.dynamodb.table_names" semantic conventions. It represents the keys + // in the `RequestItems` object field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'Cats' + AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") +) + +// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to +// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the +// value of the `AttributesToGet` request parameter. +func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributesToGetKey.StringSlice(val) +} + +// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the +// "aws.dynamodb.consistent_read" semantic conventions. It represents the value +// of the `ConsistentRead` request parameter. +func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { + return AWSDynamoDBConsistentReadKey.Bool(val) +} + +// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to +// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the +// JSON-serialized value of each item in the `ConsumedCapacity` response field. +func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { + return AWSDynamoDBConsumedCapacityKey.StringSlice(val) +} + +// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the +// "aws.dynamodb.index_name" semantic conventions. It represents the value of +// the `IndexName` request parameter. +func AWSDynamoDBIndexName(val string) attribute.KeyValue { + return AWSDynamoDBIndexNameKey.String(val) +} + +// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming +// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It +// represents the JSON-serialized value of the `ItemCollectionMetrics` response +// field. +func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { + return AWSDynamoDBItemCollectionMetricsKey.String(val) +} + +// AWSDynamoDBLimit returns an attribute KeyValue conforming to the +// "aws.dynamodb.limit" semantic conventions. It represents the value of the +// `Limit` request parameter. +func AWSDynamoDBLimit(val int) attribute.KeyValue { + return AWSDynamoDBLimitKey.Int(val) +} + +// AWSDynamoDBProjection returns an attribute KeyValue conforming to the +// "aws.dynamodb.projection" semantic conventions. It represents the value of +// the `ProjectionExpression` request parameter. +func AWSDynamoDBProjection(val string) attribute.KeyValue { + return AWSDynamoDBProjectionKey.String(val) +} + +// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.ReadCapacityUnits` request parameter. +func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) +} + +// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue +// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic +// conventions. It represents the value of the +// `ProvisionedThroughput.WriteCapacityUnits` request parameter. +func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { + return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) +} + +// AWSDynamoDBSelect returns an attribute KeyValue conforming to the +// "aws.dynamodb.select" semantic conventions. It represents the value of the +// `Select` request parameter. +func AWSDynamoDBSelect(val string) attribute.KeyValue { + return AWSDynamoDBSelectKey.String(val) +} + +// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_names" semantic conventions. It represents the keys in +// the `RequestItems` object field. +func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { + return AWSDynamoDBTableNamesKey.StringSlice(val) +} + +// DynamoDB.CreateTable +const ( + // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `GlobalSecondaryIndexes` request field + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": + // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ + // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { + // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") + + // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to + // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It + // represents the JSON-serialized value of each item of the + // `LocalSecondaryIndexes` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "IndexARN": "string", "IndexName": "string", + // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' + AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") +) + +// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_indexes" semantic +// conventions. It represents the JSON-serialized value of each item of the +// `GlobalSecondaryIndexes` request field +func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) +} + +// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming +// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It +// represents the JSON-serialized value of each item of the +// `LocalSecondaryIndexes` request field. +func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { + return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) +} + +// DynamoDB.ListTables +const ( + // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the + // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents + // the value of the `ExclusiveStartTableName` request parameter. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'Users', 'CatsTable' + AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") + + // AWSDynamoDBTableCountKey is the attribute Key conforming to the + // "aws.dynamodb.table_count" semantic conventions. It represents the the + // number of items in the `TableNames` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 20 + AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") +) + +// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming +// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It +// represents the value of the `ExclusiveStartTableName` request parameter. +func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { + return AWSDynamoDBExclusiveStartTableKey.String(val) +} + +// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.table_count" semantic conventions. It represents the the +// number of items in the `TableNames` response parameter. +func AWSDynamoDBTableCount(val int) attribute.KeyValue { + return AWSDynamoDBTableCountKey.Int(val) +} + +// DynamoDB.Query +const ( + // AWSDynamoDBScanForwardKey is the attribute Key conforming to the + // "aws.dynamodb.scan_forward" semantic conventions. It represents the + // value of the `ScanIndexForward` request parameter. + // + // Type: boolean + // RequirementLevel: Optional + // Stability: experimental + AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") +) + +// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the +// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of +// the `ScanIndexForward` request parameter. +func AWSDynamoDBScanForward(val bool) attribute.KeyValue { + return AWSDynamoDBScanForwardKey.Bool(val) +} + +// DynamoDB.Scan +const ( + // AWSDynamoDBCountKey is the attribute Key conforming to the + // "aws.dynamodb.count" semantic conventions. It represents the value of + // the `Count` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") + + // AWSDynamoDBScannedCountKey is the attribute Key conforming to the + // "aws.dynamodb.scanned_count" semantic conventions. It represents the + // value of the `ScannedCount` response parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 50 + AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") + + // AWSDynamoDBSegmentKey is the attribute Key conforming to the + // "aws.dynamodb.segment" semantic conventions. It represents the value of + // the `Segment` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 10 + AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") + + // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the + // "aws.dynamodb.total_segments" semantic conventions. It represents the + // value of the `TotalSegments` request parameter. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 100 + AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") +) + +// AWSDynamoDBCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.count" semantic conventions. It represents the value of the +// `Count` response parameter. +func AWSDynamoDBCount(val int) attribute.KeyValue { + return AWSDynamoDBCountKey.Int(val) +} + +// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the +// "aws.dynamodb.scanned_count" semantic conventions. It represents the value +// of the `ScannedCount` response parameter. +func AWSDynamoDBScannedCount(val int) attribute.KeyValue { + return AWSDynamoDBScannedCountKey.Int(val) +} + +// AWSDynamoDBSegment returns an attribute KeyValue conforming to the +// "aws.dynamodb.segment" semantic conventions. It represents the value of the +// `Segment` request parameter. +func AWSDynamoDBSegment(val int) attribute.KeyValue { + return AWSDynamoDBSegmentKey.Int(val) +} + +// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the +// "aws.dynamodb.total_segments" semantic conventions. It represents the value +// of the `TotalSegments` request parameter. +func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { + return AWSDynamoDBTotalSegmentsKey.Int(val) +} + +// DynamoDB.UpdateTable +const ( + // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to + // the "aws.dynamodb.attribute_definitions" semantic conventions. It + // represents the JSON-serialized value of each item in the + // `AttributeDefinitions` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' + AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") + + // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key + // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic + // conventions. It represents the JSON-serialized value of each item in the + // the `GlobalSecondaryIndexUpdates` request field. + // + // Type: string[] + // RequirementLevel: Optional + // Stability: experimental + // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { + // "AttributeName": "string", "KeyType": "string" } ], "Projection": { + // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, + // "ProvisionedThroughput": { "ReadCapacityUnits": number, + // "WriteCapacityUnits": number } }' + AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") +) + +// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming +// to the "aws.dynamodb.attribute_definitions" semantic conventions. It +// represents the JSON-serialized value of each item in the +// `AttributeDefinitions` request field. +func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { + return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) +} + +// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue +// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic +// conventions. It represents the JSON-serialized value of each item in the the +// `GlobalSecondaryIndexUpdates` request field. +func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { + return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) +} + +// Attributes that exist for S3 request types. +const ( + // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" + // semantic conventions. It represents the S3 bucket name the request + // refers to. Corresponds to the `--bucket` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'some-bucket-name' + // Note: The `bucket` attribute is applicable to all S3 operations that + // reference a bucket, i.e. that require the bucket name as a mandatory + // parameter. + // This applies to almost all S3 operations except `list-buckets`. + AWSS3BucketKey = attribute.Key("aws.s3.bucket") + + // AWSS3CopySourceKey is the attribute Key conforming to the + // "aws.s3.copy_source" semantic conventions. It represents the source + // object (in the form `bucket`/`key`) for the copy operation. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `copy_source` attribute applies to S3 copy operations and + // corresponds to the `--copy-source` parameter + // of the [copy-object operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") + + // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" + // semantic conventions. It represents the delete request container that + // specifies the objects to be deleted. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: + // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' + // Note: The `delete` attribute is only applicable to the + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // operation. + // The `delete` attribute corresponds to the `--delete` parameter of the + // [delete-objects operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). + AWSS3DeleteKey = attribute.Key("aws.s3.delete") + + // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic + // conventions. It represents the S3 object key the request refers to. + // Corresponds to the `--key` parameter of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // operations. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'someFile.yml' + // Note: The `key` attribute is applicable to all object-related S3 + // operations, i.e. that require the object key as a mandatory parameter. + // This applies in particular to the following operations: + // + // - + // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + // - + // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + // - + // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + // - + // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + // - + // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + // - + // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + // - + // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3KeyKey = attribute.Key("aws.s3.key") + + // AWSS3PartNumberKey is the attribute Key conforming to the + // "aws.s3.part_number" semantic conventions. It represents the part number + // of the part being uploaded in a multipart-upload operation. This is a + // positive integer between 1 and 10,000. + // + // Type: int + // RequirementLevel: Optional + // Stability: experimental + // Examples: 3456 + // Note: The `part_number` attribute is only applicable to the + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // and + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + // operations. + // The `part_number` attribute corresponds to the `--part-number` parameter + // of the + // [upload-part operation within the S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). + AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") + + // AWSS3UploadIDKey is the attribute Key conforming to the + // "aws.s3.upload_id" semantic conventions. It represents the upload ID + // that identifies the multipart upload. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' + // Note: The `upload_id` attribute applies to S3 multipart-upload + // operations and corresponds to the `--upload-id` parameter + // of the [S3 + // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) + // multipart operations. + // This applies in particular to the following operations: + // + // - + // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + // - + // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + // - + // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + // - + // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) + // - + // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) + AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") +) + +// AWSS3Bucket returns an attribute KeyValue conforming to the +// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the +// request refers to. Corresponds to the `--bucket` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Bucket(val string) attribute.KeyValue { + return AWSS3BucketKey.String(val) +} + +// AWSS3CopySource returns an attribute KeyValue conforming to the +// "aws.s3.copy_source" semantic conventions. It represents the source object +// (in the form `bucket`/`key`) for the copy operation. +func AWSS3CopySource(val string) attribute.KeyValue { + return AWSS3CopySourceKey.String(val) +} + +// AWSS3Delete returns an attribute KeyValue conforming to the +// "aws.s3.delete" semantic conventions. It represents the delete request +// container that specifies the objects to be deleted. +func AWSS3Delete(val string) attribute.KeyValue { + return AWSS3DeleteKey.String(val) +} + +// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" +// semantic conventions. It represents the S3 object key the request refers to. +// Corresponds to the `--key` parameter of the [S3 +// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) +// operations. +func AWSS3Key(val string) attribute.KeyValue { + return AWSS3KeyKey.String(val) +} + +// AWSS3PartNumber returns an attribute KeyValue conforming to the +// "aws.s3.part_number" semantic conventions. It represents the part number of +// the part being uploaded in a multipart-upload operation. This is a positive +// integer between 1 and 10,000. +func AWSS3PartNumber(val int) attribute.KeyValue { + return AWSS3PartNumberKey.Int(val) +} + +// AWSS3UploadID returns an attribute KeyValue conforming to the +// "aws.s3.upload_id" semantic conventions. It represents the upload ID that +// identifies the multipart upload. +func AWSS3UploadID(val string) attribute.KeyValue { + return AWSS3UploadIDKey.String(val) +} + +// Semantic conventions to apply when instrumenting the GraphQL implementation. +// They map GraphQL operations to attributes on a Span. +const ( + // GraphqlDocumentKey is the attribute Key conforming to the + // "graphql.document" semantic conventions. It represents the GraphQL + // document being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query findBookByID { bookByID(id: ?) { name } }' + // Note: The value may be sanitized to exclude sensitive information. + GraphqlDocumentKey = attribute.Key("graphql.document") + + // GraphqlOperationNameKey is the attribute Key conforming to the + // "graphql.operation.name" semantic conventions. It represents the name of + // the operation being executed. + // + // Type: string + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'findBookByID' + GraphqlOperationNameKey = attribute.Key("graphql.operation.name") + + // GraphqlOperationTypeKey is the attribute Key conforming to the + // "graphql.operation.type" semantic conventions. It represents the type of + // the operation being executed. + // + // Type: Enum + // RequirementLevel: Optional + // Stability: experimental + // Examples: 'query', 'mutation', 'subscription' + GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") +) + +var ( + // GraphQL query + GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") + // GraphQL mutation + GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") + // GraphQL subscription + GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") +) + +// GraphqlDocument returns an attribute KeyValue conforming to the +// "graphql.document" semantic conventions. It represents the GraphQL document +// being executed. +func GraphqlDocument(val string) attribute.KeyValue { + return GraphqlDocumentKey.String(val) +} + +// GraphqlOperationName returns an attribute KeyValue conforming to the +// "graphql.operation.name" semantic conventions. It represents the name of the +// operation being executed. +func GraphqlOperationName(val string) attribute.KeyValue { + return GraphqlOperationNameKey.String(val) +} From e3bf787c217c0dcc6c4fb0111318ca8f1790a157 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 19 Dec 2023 07:53:01 -0800 Subject: [PATCH 795/886] Add cardinality limiting to the metric SDK as an experimental feature (#4457) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add agg limiting func * Add unit test for limitAttr * Add limiting to aggregate types * Add internal x pkg for experimental feature-flagging * Connect cardinality limit to metric SDK * Replace limitAttr fn with limiter type The Attribute method is still inlinable. * Use x.CardinalityLimit directly * Simplify limiter test * Add limiter benchmark * Document the AggregationLimit field * Test sum limits * Test limit for last value * Test histogram limit * Refactor expo hist test to use existing fixtures The tests for the exponential histogram create their own testing fixtures. There is nothing these new fixtures do that cannot already be done with the existing testing fixtures used by all the other aggregate functions. Unify the exponential histogram testing to use the existing fixtures. * Test the ExponentialHistogram limit * Fix lint * Add docs * Rename aggregation field to aggLimit --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 2 + sdk/metric/EXPERIMENTAL.md | 50 ++++++ sdk/metric/internal/aggregate/aggregate.go | 18 +- .../internal/aggregate/aggregate_test.go | 4 + .../aggregate/exponential_histogram.go | 5 +- .../aggregate/exponential_histogram_test.go | 114 +++++++++++- sdk/metric/internal/aggregate/histogram.go | 9 +- .../internal/aggregate/histogram_test.go | 54 +++++- sdk/metric/internal/aggregate/lastvalue.go | 9 +- .../internal/aggregate/lastvalue_test.go | 35 +++- sdk/metric/internal/aggregate/limit.go | 53 ++++++ sdk/metric/internal/aggregate/limit_test.go | 67 ++++++++ sdk/metric/internal/aggregate/sum.go | 17 +- sdk/metric/internal/aggregate/sum_test.go | 162 +++++++++++++++++- sdk/metric/internal/x/x.go | 3 + sdk/metric/pipeline.go | 7 + 16 files changed, 570 insertions(+), 39 deletions(-) create mode 100644 sdk/metric/EXPERIMENTAL.md create mode 100644 sdk/metric/internal/aggregate/limit.go create mode 100644 sdk/metric/internal/aggregate/limit_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8635a86f746..5cab19a25be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - The `go.opentelemetry.io/otel/semconv/v1.24.0` package. The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) +- Experimental cardinality limiting is added to the metric SDK. + See [metric documentation](./sdk/metric/EXPERIMENTAL.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) ### Changed diff --git a/sdk/metric/EXPERIMENTAL.md b/sdk/metric/EXPERIMENTAL.md new file mode 100644 index 00000000000..d2a5a0470b6 --- /dev/null +++ b/sdk/metric/EXPERIMENTAL.md @@ -0,0 +1,50 @@ +# Experimental Features + +The metric SDK contains features that have not yet stabilized in the OpenTelemetry specification. +These features are added to the OpenTelemetry Go metric SDK prior to stabilization in the specification so that users can start experimenting with them and provide feedback. + +These feature may change in backwards incompatible ways as feedback is applied. +See the [Compatibility and Stability](#compatibility-and-stability) section for more information. + +## Features + +- [Cardinality Limit](#cardinality-limit) + +### Cardinality Limit + +The cardinality limit is the hard limit on the number of metric streams that can be collected for a single instrument. + +This experimental feature can be enabled by setting the `OTEL_GO_X_CARDINALITY_LIMIT` environment value. +The value must be an integer value. +All other values are ignored. + +If the value set is less than or equal to `0`, no limit will be applied. + +#### Examples + +Set the cardinality limit to 2000. + +```console +export OTEL_GO_X_CARDINALITY_LIMIT=2000 +``` + +Set an infinite cardinality limit (functionally equivalent to disabling the feature). + +```console +export OTEL_GO_X_CARDINALITY_LIMIT=-1 +``` + +Disable the cardinality limit. + +```console +unset OTEL_GO_X_CARDINALITY_LIMIT +``` + +## Compatibility and Stability + +Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../VERSIONING.md). +These features may be removed or modified in successive version releases, including patch versions. + +When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release. +There is no guarantee that any environment variable feature flags that enabled the experimental feature will be supported by the stable version. +If they are supported, they may be accompanied with a deprecation notice stating a timeline for the removal of that support. diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index 8dec14237b9..c61f8513789 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -44,6 +44,14 @@ type Builder[N int64 | float64] struct { // Filter is the attribute filter the aggregate function will use on the // input of measurements. Filter attribute.Filter + // AggregationLimit is the cardinality limit of measurement attributes. Any + // measurement for new attributes once the limit has been reached will be + // aggregated into a single aggregate for the "otel.metric.overflow" + // attribute. + // + // If AggregationLimit is less than or equal to zero there will not be an + // aggregation limit imposed (i.e. unlimited attribute sets). + AggregationLimit int } func (b Builder[N]) filter(f Measure[N]) Measure[N] { @@ -63,7 +71,7 @@ func (b Builder[N]) filter(f Measure[N]) Measure[N] { func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // Delta temporality is the only temporality that makes semantic sense for // a last-value aggregate. - lv := newLastValue[N]() + lv := newLastValue[N](b.AggregationLimit) return b.filter(lv.measure), func(dest *metricdata.Aggregation) int { // Ignore if dest is not a metricdata.Gauge. The chance for memory @@ -79,7 +87,7 @@ func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // PrecomputedSum returns a sum aggregate function input and output. The // arguments passed to the input are expected to be the precomputed sum values. func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newPrecomputedSum[N](monotonic) + s := newPrecomputedSum[N](monotonic, b.AggregationLimit) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -90,7 +98,7 @@ func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregati // Sum returns a sum aggregate function input and output. func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newSum[N](monotonic) + s := newSum[N](monotonic, b.AggregationLimit) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -102,7 +110,7 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newHistogram[N](boundaries, noMinMax, noSum) + h := newHistogram[N](boundaries, noMinMax, noSum, b.AggregationLimit) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta @@ -114,7 +122,7 @@ func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSu // ExponentialBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExponentialBucketHistogram(maxSize, maxScale int32, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum) + h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum, b.AggregationLimit) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta diff --git a/sdk/metric/internal/aggregate/aggregate_test.go b/sdk/metric/internal/aggregate/aggregate_test.go index 79031b40218..384ca51c8cf 100644 --- a/sdk/metric/internal/aggregate/aggregate_test.go +++ b/sdk/metric/internal/aggregate/aggregate_test.go @@ -31,11 +31,15 @@ var ( keyUser = "user" userAlice = attribute.String(keyUser, "Alice") userBob = attribute.String(keyUser, "Bob") + userCarol = attribute.String(keyUser, "Carol") + userDave = attribute.String(keyUser, "Dave") adminTrue = attribute.Bool("admin", true) adminFalse = attribute.Bool("admin", false) alice = attribute.NewSet(userAlice, adminTrue) bob = attribute.NewSet(userBob, adminFalse) + carol = attribute.NewSet(userCarol, adminFalse) + dave = attribute.NewSet(userDave, adminFalse) // Filtered. attrFltr = func(kv attribute.KeyValue) bool { diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index 98b7dc1e0fa..e9c25980aa2 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -288,13 +288,14 @@ func (b *expoBuckets) downscale(delta int) { // newExponentialHistogram returns an Aggregator that summarizes a set of // measurements as an exponential histogram. Each histogram is scoped by attributes // and the aggregation cycle the measurements were made in. -func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool) *expoHistogram[N] { +func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int) *expoHistogram[N] { return &expoHistogram[N]{ noSum: noSum, noMinMax: noMinMax, maxSize: int(maxSize), maxScale: int(maxScale), + limit: newLimiter[*expoHistogramDataPoint[N]](limit), values: make(map[attribute.Set]*expoHistogramDataPoint[N]), start: now(), @@ -309,6 +310,7 @@ type expoHistogram[N int64 | float64] struct { maxSize int maxScale int + limit limiter[*expoHistogramDataPoint[N]] values map[attribute.Set]*expoHistogramDataPoint[N] valuesMu sync.Mutex @@ -324,6 +326,7 @@ func (e *expoHistogram[N]) measure(_ context.Context, value N, attr attribute.Se e.valuesMu.Lock() defer e.valuesMu.Unlock() + attr = e.limit.Attributes(attr, e.values) v, ok := e.values[attr] if !ok { v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 44a8328bbe5..40af402636c 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -183,7 +183,7 @@ func testExpoHistogramMinMaxSumInt64(t *testing.T) { restore := withHandler(t) defer restore() - h := newExponentialHistogram[int64](4, 20, false, false) + h := newExponentialHistogram[int64](4, 20, false, false, 0) for _, v := range tt.values { h.measure(context.Background(), v, alice) } @@ -225,7 +225,7 @@ func testExpoHistogramMinMaxSumFloat64(t *testing.T) { restore := withHandler(t) defer restore() - h := newExponentialHistogram[float64](4, 20, false, false) + h := newExponentialHistogram[float64](4, 20, false, false, 0) for _, v := range tt.values { h.measure(context.Background(), v, alice) } @@ -747,8 +747,9 @@ func TestExponentialHistogramAggregation(t *testing.T) { func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + AggregationLimit: 2, }.ExponentialBucketHistogram(4, 20, false, false) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -805,13 +806,67 @@ func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 4, alice}, + {ctx, 2, alice}, + {ctx, 16, alice}, + {ctx, 1, alice}, + // These will exceed the cardinality limit. + {ctx, 4, bob}, + {ctx, 4, bob}, + {ctx, 4, bob}, + {ctx, 2, carol}, + {ctx, 16, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 2, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + }, + }, + }, + }, }) } func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + AggregationLimit: 2, }.ExponentialBucketHistogram(4, 20, false, false) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -911,6 +966,53 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + // These will exceed the cardinality limit. + {ctx, 4, bob}, + {ctx, 4, bob}, + {ctx, 4, bob}, + {ctx, 2, carol}, + {ctx, 16, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 2, + agg: metricdata.ExponentialHistogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.ExponentialHistogramDataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Count: 9, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 44, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 6, 2}, + }, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Count: 6, + Min: metricdata.NewExtrema[N](1), + Max: metricdata.NewExtrema[N](16), + Sum: 31, + Scale: -1, + PositiveBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1, 4, 1}, + }, + }, + }, + }, + }, + }, }) } diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index 62ec51e1f5e..5d886360bae 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -54,11 +54,12 @@ type histValues[N int64 | float64] struct { noSum bool bounds []float64 + limit limiter[*buckets[N]] values map[attribute.Set]*buckets[N] valuesMu sync.Mutex } -func newHistValues[N int64 | float64](bounds []float64, noSum bool) *histValues[N] { +func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) *histValues[N] { // The responsibility of keeping all buckets correctly associated with the // passed boundaries is ultimately this type's responsibility. Make a copy // here so we can always guarantee this. Or, in the case of failure, have @@ -69,6 +70,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool) *histValues[ return &histValues[N]{ noSum: noSum, bounds: b, + limit: newLimiter[*buckets[N]](limit), values: make(map[attribute.Set]*buckets[N]), } } @@ -86,6 +88,7 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) s.valuesMu.Lock() defer s.valuesMu.Unlock() + attr = s.limit.Attributes(attr, s.values) b, ok := s.values[attr] if !ok { // N+1 buckets. For example: @@ -108,9 +111,9 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // newHistogram returns an Aggregator that summarizes a set of measurements as // an histogram. -func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool) *histogram[N] { +func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int) *histogram[N] { return &histogram[N]{ - histValues: newHistValues[N](boundaries, noSum), + histValues: newHistValues[N](boundaries, noSum, limit), noMinMax: noMinMax, start: now(), } diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index ab44607e5f6..e51e9fc8f29 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -53,8 +53,9 @@ type conf[N int64 | float64] struct { func testDeltaHist[N int64 | float64](c conf[N]) func(t *testing.T) { in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.ExplicitBucketHistogram(bounds, noMinMax, c.noSum) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -114,13 +115,34 @@ func testDeltaHist[N int64 | float64](c conf[N]) func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, 1, bob}, + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 1, 1), + c.hPt(fltrBob, 1, 1), + c.hPt(overflowSet, 1, 2), + }, + }, + }, + }, }) } func testCumulativeHist[N int64 | float64](c conf[N]) func(t *testing.T) { in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.ExplicitBucketHistogram(bounds, noMinMax, c.noSum) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -182,6 +204,24 @@ func testCumulativeHist[N int64 | float64](c conf[N]) func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Histogram[N]{ + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.HistogramDataPoint[N]{ + c.hPt(fltrAlice, 2, 4), + c.hPt(fltrBob, 10, 3), + c.hPt(overflowSet, 1, 2), + }, + }, + }, + }, }) } @@ -273,7 +313,7 @@ func TestHistogramImmutableBounds(t *testing.T) { cpB := make([]float64, len(b)) copy(cpB, b) - h := newHistogram[int64](b, false, false) + h := newHistogram[int64](b, false, false, 0) require.Equal(t, cpB, h.bounds) b[0] = 10 @@ -289,7 +329,7 @@ func TestHistogramImmutableBounds(t *testing.T) { } func TestCumulativeHistogramImutableCounts(t *testing.T) { - h := newHistogram[int64](bounds, noMinMax, false) + h := newHistogram[int64](bounds, noMinMax, false, 0) h.measure(context.Background(), 5, alice) var data metricdata.Aggregation = metricdata.Histogram[int64]{} @@ -307,7 +347,7 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - h := newHistogram[int64](bounds, noMinMax, false) + h := newHistogram[int64](bounds, noMinMax, false, 0) var data metricdata.Aggregation = metricdata.Histogram[int64]{} require.Equal(t, 0, h.delta(&data)) diff --git a/sdk/metric/internal/aggregate/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go index 6af2d606141..b79e80a0c8d 100644 --- a/sdk/metric/internal/aggregate/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -29,20 +29,25 @@ type datapoint[N int64 | float64] struct { value N } -func newLastValue[N int64 | float64]() *lastValue[N] { - return &lastValue[N]{values: make(map[attribute.Set]datapoint[N])} +func newLastValue[N int64 | float64](limit int) *lastValue[N] { + return &lastValue[N]{ + limit: newLimiter[datapoint[N]](limit), + values: make(map[attribute.Set]datapoint[N]), + } } // lastValue summarizes a set of measurements as the last one made. type lastValue[N int64 | float64] struct { sync.Mutex + limit limiter[datapoint[N]] values map[attribute.Set]datapoint[N] } func (s *lastValue[N]) measure(ctx context.Context, value N, attr attribute.Set) { d := datapoint[N]{timestamp: now(), value: value} s.Lock() + attr = s.limit.Attributes(attr, s.values) s.values[attr] = d s.Unlock() } diff --git a/sdk/metric/internal/aggregate/lastvalue_test.go b/sdk/metric/internal/aggregate/lastvalue_test.go index c758eb370c7..479232ad435 100644 --- a/sdk/metric/internal/aggregate/lastvalue_test.go +++ b/sdk/metric/internal/aggregate/lastvalue_test.go @@ -29,7 +29,10 @@ func TestLastValue(t *testing.T) { } func testLastValue[N int64 | float64]() func(*testing.T) { - in, out := Builder[N]{Filter: attrFltr}.LastValue() + in, out := Builder[N]{ + Filter: attrFltr, + AggregationLimit: 3, + }.LastValue() ctx := context.Background() return test[N](in, out, []teststep[N]{ { @@ -87,6 +90,36 @@ func testLastValue[N int64 | float64]() func(*testing.T) { }, }, }, + }, { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, 1, bob}, + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Gauge[N]{ + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + Time: staticTime, + Value: 1, + }, + { + Attributes: fltrBob, + Time: staticTime, + Value: 1, + }, + { + Attributes: overflowSet, + Time: staticTime, + Value: 1, + }, + }, + }, + }, }, }) } diff --git a/sdk/metric/internal/aggregate/limit.go b/sdk/metric/internal/aggregate/limit.go new file mode 100644 index 00000000000..d3de8427200 --- /dev/null +++ b/sdk/metric/internal/aggregate/limit.go @@ -0,0 +1,53 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import "go.opentelemetry.io/otel/attribute" + +// overflowSet is the attribute set used to record a measurement when adding +// another distinct attribute set to the aggregate would exceed the aggregate +// limit. +var overflowSet = attribute.NewSet(attribute.Bool("otel.metric.overflow", true)) + +// limiter limits aggregate values. +type limiter[V any] struct { + // aggLimit is the maximum number of metric streams that can be aggregated. + // + // Any metric stream with attributes distinct from any set already + // aggregated once the aggLimit will be meet will instead be aggregated + // into an "overflow" metric stream. That stream will only contain the + // "otel.metric.overflow"=true attribute. + aggLimit int +} + +// newLimiter returns a new Limiter with the provided aggregation limit. +func newLimiter[V any](aggregation int) limiter[V] { + return limiter[V]{aggLimit: aggregation} +} + +// Attributes checks if adding a measurement for attrs will exceed the +// aggregation cardinality limit for the existing measurements. If it will, +// overflowSet is returned. Otherwise, if it will not exceed the limit, or the +// limit is not set (limit <= 0), attr is returned. +func (l limiter[V]) Attributes(attrs attribute.Set, measurements map[attribute.Set]V) attribute.Set { + if l.aggLimit > 0 { + _, exists := measurements[attrs] + if !exists && len(measurements) >= l.aggLimit-1 { + return overflowSet + } + } + + return attrs +} diff --git a/sdk/metric/internal/aggregate/limit_test.go b/sdk/metric/internal/aggregate/limit_test.go new file mode 100644 index 00000000000..cd524d33966 --- /dev/null +++ b/sdk/metric/internal/aggregate/limit_test.go @@ -0,0 +1,67 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" +) + +func TestLimiterAttributes(t *testing.T) { + m := map[attribute.Set]struct{}{alice: {}} + t.Run("NoLimit", func(t *testing.T) { + l := newLimiter[struct{}](0) + assert.Equal(t, alice, l.Attributes(alice, m)) + assert.Equal(t, bob, l.Attributes(bob, m)) + }) + + t.Run("NotAtLimit/Exists", func(t *testing.T) { + l := newLimiter[struct{}](3) + assert.Equal(t, alice, l.Attributes(alice, m)) + }) + + t.Run("NotAtLimit/DoesNotExist", func(t *testing.T) { + l := newLimiter[struct{}](3) + assert.Equal(t, bob, l.Attributes(bob, m)) + }) + + t.Run("AtLimit/Exists", func(t *testing.T) { + l := newLimiter[struct{}](2) + assert.Equal(t, alice, l.Attributes(alice, m)) + }) + + t.Run("AtLimit/DoesNotExist", func(t *testing.T) { + l := newLimiter[struct{}](2) + assert.Equal(t, overflowSet, l.Attributes(bob, m)) + }) +} + +var limitedAttr attribute.Set + +func BenchmarkLimiterAttributes(b *testing.B) { + m := map[attribute.Set]struct{}{alice: {}} + l := newLimiter[struct{}](2) + + b.ReportAllocs() + b.ResetTimer() + + for n := 0; n < b.N; n++ { + limitedAttr = l.Attributes(alice, m) + limitedAttr = l.Attributes(bob, m) + } +} diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index 1e52ff0d1e5..a0d26e1ddb9 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -26,15 +26,20 @@ import ( // valueMap is the storage for sums. type valueMap[N int64 | float64] struct { sync.Mutex + limit limiter[N] values map[attribute.Set]N } -func newValueMap[N int64 | float64]() *valueMap[N] { - return &valueMap[N]{values: make(map[attribute.Set]N)} +func newValueMap[N int64 | float64](limit int) *valueMap[N] { + return &valueMap[N]{ + limit: newLimiter[N](limit), + values: make(map[attribute.Set]N), + } } func (s *valueMap[N]) measure(_ context.Context, value N, attr attribute.Set) { s.Lock() + attr = s.limit.Attributes(attr, s.values) s.values[attr] += value s.Unlock() } @@ -42,9 +47,9 @@ func (s *valueMap[N]) measure(_ context.Context, value N, attr attribute.Set) { // newSum returns an aggregator that summarizes a set of measurements as their // arithmetic sum. Each sum is scoped by attributes and the aggregation cycle // the measurements were made in. -func newSum[N int64 | float64](monotonic bool) *sum[N] { +func newSum[N int64 | float64](monotonic bool, limit int) *sum[N] { return &sum[N]{ - valueMap: newValueMap[N](), + valueMap: newValueMap[N](limit), monotonic: monotonic, start: now(), } @@ -129,9 +134,9 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { // newPrecomputedSum returns an aggregator that summarizes a set of // observatrions as their arithmetic sum. Each sum is scoped by attributes and // the aggregation cycle the measurements were made in. -func newPrecomputedSum[N int64 | float64](monotonic bool) *precomputedSum[N] { +func newPrecomputedSum[N int64 | float64](monotonic bool, limit int) *precomputedSum[N] { return &precomputedSum[N]{ - valueMap: newValueMap[N](), + valueMap: newValueMap[N](limit), monotonic: monotonic, start: now(), } diff --git a/sdk/metric/internal/aggregate/sum_test.go b/sdk/metric/internal/aggregate/sum_test.go index 3ac675a096b..b169fcad455 100644 --- a/sdk/metric/internal/aggregate/sum_test.go +++ b/sdk/metric/internal/aggregate/sum_test.go @@ -40,8 +40,9 @@ func TestSum(t *testing.T) { func testDeltaSum[N int64 | float64]() func(t *testing.T) { mono := false in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.Sum(mono) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -125,14 +126,51 @@ func testDeltaSum[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, 1, bob}, + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Value: 2, + }, + }, + }, + }, + }, }) } func testCumulativeSum[N int64 | float64]() func(t *testing.T) { mono := false in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.Sum(mono) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -204,14 +242,49 @@ func testCumulativeSum[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 14, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: -8, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Value: 2, + }, + }, + }, + }, + }, }) } func testDeltaPrecomputedSum[N int64 | float64]() func(t *testing.T) { mono := false in, out := Builder[N]{ - Temporality: metricdata.DeltaTemporality, - Filter: attrFltr, + Temporality: metricdata.DeltaTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.PrecomputedSum(mono) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -296,14 +369,51 @@ func testDeltaPrecomputedSum[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, 1, bob}, + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Value: 2, + }, + }, + }, + }, + }, }) } func testCumulativePrecomputedSum[N int64 | float64]() func(t *testing.T) { mono := false in, out := Builder[N]{ - Temporality: metricdata.CumulativeTemporality, - Filter: attrFltr, + Temporality: metricdata.CumulativeTemporality, + Filter: attrFltr, + AggregationLimit: 3, }.PrecomputedSum(mono) ctx := context.Background() return test[N](in, out, []teststep[N]{ @@ -388,6 +498,42 @@ func testCumulativePrecomputedSum[N int64 | float64]() func(t *testing.T) { }, }, }, + { + input: []arg[N]{ + {ctx, 1, alice}, + {ctx, 1, bob}, + // These will exceed cardinality limit. + {ctx, 1, carol}, + {ctx, 1, dave}, + }, + expect: output{ + n: 3, + agg: metricdata.Sum[N]{ + IsMonotonic: mono, + Temporality: metricdata.CumulativeTemporality, + DataPoints: []metricdata.DataPoint[N]{ + { + Attributes: fltrAlice, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: fltrBob, + StartTime: staticTime, + Time: staticTime, + Value: 1, + }, + { + Attributes: overflowSet, + StartTime: staticTime, + Time: staticTime, + Value: 2, + }, + }, + }, + }, + }, }) } diff --git a/sdk/metric/internal/x/x.go b/sdk/metric/internal/x/x.go index 2891395725d..541160f9423 100644 --- a/sdk/metric/internal/x/x.go +++ b/sdk/metric/internal/x/x.go @@ -43,6 +43,9 @@ var ( // // To enable this feature set the OTEL_GO_X_CARDINALITY_LIMIT environment // variable to the integer limit value you want to use. + // + // Setting OTEL_GO_X_CARDINALITY_LIMIT to a value less than or equal to 0 + // will disable the cardinality limits. CardinalityLimit = newFeature("CARDINALITY_LIMIT", func(v string) (int, bool) { n, err := strconv.Atoi(v) if err != nil { diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 75e3af49bac..47d9fe07ada 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -29,6 +29,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/internal" "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" + "go.opentelemetry.io/otel/sdk/metric/internal/x" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/resource" ) @@ -361,6 +362,12 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum Temporality: i.pipeline.reader.temporality(kind), } b.Filter = stream.AttributeFilter + // A value less than or equal to zero will disable the aggregation + // limits for the builder (an all the created aggregates). + // CardinalityLimit.Lookup returns 0 by default if unset (or + // unrecognized input). Use that value directly. + b.AggregationLimit, _ = x.CardinalityLimit.Lookup() + in, out, err := i.aggregateFunc(b, stream.Aggregation, kind) if err != nil { return aggVal[N]{0, nil, err} From 885210bf33238f8c6cc94c3f3711b0036fbe77b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 21 Dec 2023 09:16:13 +0100 Subject: [PATCH 796/886] baggage: Fix escaping in Member.String (#4756) Co-authored-by: Tyler Yahn --- CHANGELOG.md | 1 + baggage/baggage.go | 6 +++-- baggage/baggage_test.go | 52 +++++++++++++++++++++++++++++++------ propagation/baggage_test.go | 4 +-- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cab19a25be..c283b9cbebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) +- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) ## [1.21.0/0.44.0] 2023-11-16 diff --git a/baggage/baggage.go b/baggage/baggage.go index 12b9ca6f39c..5869a4ed696 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -320,8 +320,10 @@ func (m Member) Properties() []Property { return m.properties.Copy() } // String encodes Member into a string compliant with the W3C Baggage // specification. func (m Member) String() string { - // A key is just an ASCII string, but a value is URL encoded UTF-8. - s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, url.QueryEscape(m.value)) + // A key is just an ASCII string. A value is restricted to be + // US-ASCII characters excluding CTLs, whitespace, + // DQUOTE, comma, semicolon, and backslash. + s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, url.PathEscape(m.value)) if len(m.properties) > 0 { s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String()) } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 82c06949945..19b2c6e9459 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -382,6 +382,13 @@ func TestBaggageParse(t *testing.T) { "foo": {Value: "2"}, }, }, + { + name: "= value", + in: "key==", + want: baggage.List{ + "key": {Value: "="}, + }, + }, { name: "url encoded value", in: "key1=val%252%2C", @@ -486,19 +493,46 @@ func TestBaggageString(t *testing.T) { }, }, { - name: "URL encoded value", - out: "foo=1%3D1", + name: "Encoded value", + // Allowed value characters are: + // + // %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E + // + // Meaning, US-ASCII characters excluding CTLs, whitespace, + // DQUOTE, comma, semicolon, and backslash. All excluded + // characters need to be percent encoded. + // + // Ideally, the want result is: + // out: "foo=%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+%2C-./0123456789:%3B<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]^_%60abcdefghijklmnopqrstuvwxyz{|}~%7F", + // However, the following characters are escaped: + // !#'()*/<>?[]^{|} + // It is not necessary, but still provides a correct result. + out: "foo=%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23$%25&%27%28%29%2A+%2C-.%2F0123456789:%3B%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F", baggage: baggage.List{ - "foo": {Value: "1=1"}, + "foo": {Value: func() string { + // All US-ASCII characters. + b := [128]byte{} + for i := range b { + b[i] = byte(i) + } + return string(b[:]) + }()}, }, }, { name: "plus", - out: "foo=1%2B1", + out: "foo=1+1", baggage: baggage.List{ "foo": {Value: "1+1"}, }, }, + { + name: "equal", + out: "foo=1=1", + baggage: baggage.List{ + "foo": {Value: "1=1"}, + }, + }, { name: "single member empty value with properties", out: "foo=;red;state=on", @@ -561,8 +595,10 @@ func TestBaggageString(t *testing.T) { } for _, tc := range testcases { - b := Baggage{tc.baggage} - assert.Equal(t, tc.out, orderer(b.String())) + t.Run(tc.name, func(t *testing.T) { + b := Baggage{tc.baggage} + assert.Equal(t, tc.out, orderer(b.String())) + }) } } @@ -863,9 +899,9 @@ func TestMemberString(t *testing.T) { memberStr := member.String() assert.Equal(t, memberStr, "key=value") // encoded key - member, _ = NewMember("key", "%3B") + member, _ = NewMember("key", "%3B%20") memberStr = member.String() - assert.Equal(t, memberStr, "key=%3B") + assert.Equal(t, memberStr, "key=%3B%20") } var benchBaggage Baggage diff --git a/propagation/baggage_test.go b/propagation/baggage_test.go index a29e412b9d6..8149fbaf833 100644 --- a/propagation/baggage_test.go +++ b/propagation/baggage_test.go @@ -214,9 +214,9 @@ func TestInjectBaggageToHTTPReq(t *testing.T) { { name: "values with escaped chars", mems: members{ - {Key: "key2", Value: "val3=4"}, + {Key: "key2", Value: "val3,4"}, }, - wantInHeader: []string{"key2=val3%3D4"}, + wantInHeader: []string{"key2=val3%2C4"}, }, { name: "with properties", From 1cfd83a1eeaac16edaebbd2938f14b7c70b37c59 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 25 Dec 2023 20:21:38 +0100 Subject: [PATCH 797/886] dependabot updates Sun Dec 24 21:19:11 UTC 2023 (#4797) Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/go-logr/logr from 1.3.0 to 1.4.1 Bump github.com/go-logr/logr from 1.3.0 to 1.4.1 in /sdk/metric Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/prometheus Bump github.com/go-logr/logr from 1.3.0 to 1.4.1 in /sdk Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/otlp/otlptrace Bump github.com/go-logr/logr from 1.3.0 to 1.4.1 in /exporters/zipkin Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /example/otel-collector Bump google.golang.org/grpc from 1.60.0 to 1.60.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/protobuf from 1.31.0 to 1.32.0 in /exporters/otlp/otlptrace/otlptracegrpc --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/go.mod | 2 +- bridge/opentracing/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 6 +++--- bridge/opentracing/test/go.sum | 12 ++++++------ example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 6 +++--- example/otel-collector/go.sum | 12 ++++++------ example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 4 ++-- example/prometheus/go.sum | 8 ++++---- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 12 ++++++------ exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 6 +++--- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 12 ++++++------ exporters/otlp/otlptrace/go.mod | 4 ++-- exporters/otlp/otlptrace/go.sum | 12 ++++-------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 12 ++++++------ exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 +++--- exporters/otlp/otlptrace/otlptracehttp/go.sum | 12 ++++++------ exporters/prometheus/go.mod | 4 ++-- exporters/prometheus/go.sum | 8 ++++---- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- metric/go.mod | 2 +- metric/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 50 files changed, 120 insertions(+), 124 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index da514cd9ec8..f0e79605b6d 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 92b795a117d..ac80eef8dd6 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 9fe2e306450..9bb1cc7e298 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -11,7 +11,7 @@ require ( ) require ( - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 6e76c6aed70..92446012a6b 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index c24a004e31e..2afd00f8f9d 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/bridge/opentracing/go.sum b/bridge/opentracing/go.sum index b79c74aee78..5d0939ce33a 100644 --- a/bridge/opentracing/go.sum +++ b/bridge/opentracing/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 6384b209ead..13e224990eb 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,12 +14,12 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/bridge/opentracing v1.21.0 - google.golang.org/grpc v1.60.0 + google.golang.org/grpc v1.60.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -29,7 +29,7 @@ require ( golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 534907d2786..f537a5a6959 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -54,12 +54,12 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/dice/go.mod b/example/dice/go.mod index 4a974d178aa..75828c0013b 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -14,7 +14,7 @@ require ( require ( github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect diff --git a/example/dice/go.sum b/example/dice/go.sum index 33f7fb86e66..e334de1e4d0 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -2,8 +2,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 9b29c30a388..20613283088 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect ) diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 8fd671228e6..256d60595f7 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 08f23c9f233..d59266f2a04 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -19,7 +19,7 @@ require ( ) require ( - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 6e76c6aed70..92446012a6b 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -11,8 +11,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index d790d59ef1c..7131b75e840 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,12 +12,12 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 - google.golang.org/grpc v1.60.0 + google.golang.org/grpc v1.60.1 ) require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect @@ -29,7 +29,7 @@ require ( golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index fccb03a9665..3238bb95f42 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -2,8 +2,8 @@ github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqy github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -31,10 +31,10 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1: google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 46bcb0f0da0..83a9c212c03 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -10,7 +10,7 @@ require ( ) require ( - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 8fd671228e6..256d60595f7 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index ee7193eac17..3871b954f63 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect @@ -23,7 +23,7 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 5a19e44b683..5ae04a11d73 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -4,8 +4,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -32,6 +32,6 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 8f638e80419..8cbc87f0c79 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -16,7 +16,7 @@ require ( ) require ( - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 24549e67bc2..f8597fe211c 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -1,7 +1,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index ff7920b273e..c44ff7839c7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,13 +13,13 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 - google.golang.org/grpc v1.60.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index a11b281c8ba..bbf086b49e2 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -40,12 +40,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1: google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9fddb96df06..42bbc17fdff 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -12,13 +12,13 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/sdk/metric v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.60.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index a11b281c8ba..bbf086b49e2 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -40,12 +40,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1: google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 8b62d053be6..50e6bc2bfa3 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,12 +9,12 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.32.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 6cc7fe2eb38..be9edbe3b4a 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -2,12 +2,10 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -29,10 +27,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index db41d5f91f6..4a52043cd3f 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,13 +12,13 @@ require ( go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 - google.golang.org/grpc v1.60.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 53050a619e5..658b574d290 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -40,12 +40,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1: google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 207fe2b48fb..f097e571aa3 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,13 +10,13 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/grpc v1.60.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/grpc v1.60.1 + google.golang.org/protobuf v1.32.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index f4393d79919..5efb5f7e146 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -4,8 +4,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= @@ -38,12 +38,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1: google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= +google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 4c6b075908c..6acd16976ba 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,14 +10,14 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 go.opentelemetry.io/otel/sdk v1.21.0 go.opentelemetry.io/otel/sdk/metric v1.21.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.32.0 ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index efd6536daa6..8675108445e 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -40,8 +40,8 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index f00e7131d84..3e13a25a233 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -11,7 +11,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 94020957893..eafb844548c 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index d5425c4a842..d543d83115e 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -16,7 +16,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 94020957893..eafb844548c 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index efc75303640..63053ccaee2 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/zipkin go 1.20 require ( - github.com/go-logr/logr v1.3.0 + github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 6d37533b753..cb8496310a7 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/go.mod b/go.mod index e8b192b3f78..043f5e84822 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel go 1.20 require ( - github.com/go-logr/logr v1.3.0 + github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 diff --git a/go.sum b/go.sum index 95b35a74664..10051f76c68 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 1126b1eb33e..dd98092ef10 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -210,7 +210,7 @@ require ( golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 210333c8dd0..9f246245cae 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -1040,8 +1040,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/metric/go.mod b/metric/go.mod index d0596d4bea6..0d647604b44 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -9,7 +9,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect diff --git a/metric/go.sum b/metric/go.sum index 130a4f410be..75d8b1f55b4 100644 --- a/metric/go.sum +++ b/metric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/sdk/go.mod b/sdk/go.mod index 7583fc33c6e..f2b2c6ba86d 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -5,7 +5,7 @@ go 1.20 replace go.opentelemetry.io/otel => ../ require ( - github.com/go-logr/logr v1.3.0 + github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 diff --git a/sdk/go.sum b/sdk/go.sum index 939feb405bb..b9faa150368 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 24325464289..be238b00edd 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/sdk/metric go 1.20 require ( - github.com/go-logr/logr v1.3.0 + github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 94020957893..eafb844548c 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -1,8 +1,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= From d23c060ced0dc8c878dc4319253cf90c3cbc608a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:15:32 +0100 Subject: [PATCH 798/886] Bump github.com/go-git/go-git/v5 from 5.9.0 to 5.11.0 in /internal/tools (#4800) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.9.0 to 5.11.0. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.9.0...v5.11.0) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 5 ++--- internal/tools/go.sum | 13 +++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index dd98092ef10..39dedce315a 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -35,7 +35,6 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect - github.com/acomagu/bufpipe v1.0.4 // indirect github.com/alecthomas/go-check-sumtype v0.1.3 // indirect github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect @@ -73,7 +72,7 @@ require ( github.com/go-critic/go-critic v0.9.0 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect - github.com/go-git/go-git/v5 v5.9.0 // indirect + github.com/go-git/go-git/v5 v5.11.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.1.0 // indirect @@ -168,7 +167,7 @@ require ( github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/nosnakecase v1.7.0 // indirect github.com/sivchari/tenv v1.7.1 // indirect - github.com/skeema/knownhosts v1.2.0 // indirect + github.com/skeema/knownhosts v1.2.1 // indirect github.com/sonatard/noctx v0.0.2 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect github.com/spf13/afero v1.9.5 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 9f246245cae..dad92dff725 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -69,8 +69,6 @@ github.com/OpenPeeDeeP/depguard/v2 v2.1.0 h1:aQl70G173h/GZYhWf36aE5H0KaujXfVMnn/ github.com/OpenPeeDeeP/depguard/v2 v2.1.0/go.mod h1:PUBgk35fX4i7JDmwzlJwJ+GMe6NfO1723wmJMgPThNQ= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= -github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= -github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/assert/v2 v2.2.2 h1:Z/iVC0xZfWTaFNE6bA3z07T86hd45Xe2eLt6WVy2bbk= github.com/alecthomas/go-check-sumtype v0.1.3 h1:M+tqMxB68hcgccRXBMVCPI4UJ+QUfdSx0xdbypKCqA8= github.com/alecthomas/go-check-sumtype v0.1.3/go.mod h1:WyYPfhfkdhyrdaligV6svFopZV8Lqdzn5pyVBaV6jhQ= @@ -179,9 +177,9 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= -github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= -github.com/go-git/go-git/v5 v5.9.0/go.mod h1:RKIqga24sWdMGZF+1Ekv9kylsDz6LzdTSI2s/OsZWE0= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= +github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -406,7 +404,6 @@ github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1r github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -538,8 +535,8 @@ github.com/sivchari/nosnakecase v1.7.0 h1:7QkpWIRMe8x25gckkFd2A5Pi6Ymo0qgr4JrhGt github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.7.1 h1:PSpuD4bu6fSmtWMxSGWcvqUUgIn7k3yOJhOIzVWn8Ak= github.com/sivchari/tenv v1.7.1/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= -github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= -github.com/skeema/knownhosts v1.2.0/go.mod h1:g4fPeYpque7P0xefxtGzV81ihjC8sX2IqpAoNkjxbMo= +github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/sonatard/noctx v0.0.2 h1:L7Dz4De2zDQhW8S0t+KUjY0MAQJd6SgVwhzNIc4ok00= github.com/sonatard/noctx v0.0.2/go.mod h1:kzFz+CzWSjQ2OzIm46uJZoXuBpa2+0y3T36U18dWqIo= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= From 08b856faeb38931d448bc67062b22abe71da9c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 28 Dec 2023 18:21:44 +0100 Subject: [PATCH 799/886] baggage: Member.String encodes only when necessary (#4775) --- CHANGELOG.md | 1 + baggage/baggage.go | 64 ++++++++++++++++++++++++++++++++++--- baggage/baggage_test.go | 70 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 123 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c283b9cbebb..b94281d2ff5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) ### Fixed diff --git a/baggage/baggage.go b/baggage/baggage.go index 5869a4ed696..89a0664201d 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -323,7 +323,7 @@ func (m Member) String() string { // A key is just an ASCII string. A value is restricted to be // US-ASCII characters excluding CTLs, whitespace, // DQUOTE, comma, semicolon, and backslash. - s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, url.PathEscape(m.value)) + s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, valueEscape(m.value)) if len(m.properties) > 0 { s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String()) } @@ -652,9 +652,65 @@ func validateValue(s string) bool { } func validateValueChar(c int32) bool { - return (c >= 0x23 && c <= 0x2b) || + return c == 0x21 || + (c >= 0x23 && c <= 0x2b) || (c >= 0x2d && c <= 0x3a) || (c >= 0x3c && c <= 0x5b) || - (c >= 0x5d && c <= 0x7e) || - c == 0x21 + (c >= 0x5d && c <= 0x7e) +} + +// valueEscape escapes the string so it can be safely placed inside a baggage value, +// replacing special characters with %XX sequences as needed. +// +// The implementation is based on: +// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285. +func valueEscape(s string) string { + hexCount := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(c) { + hexCount++ + } + } + + if hexCount == 0 { + return s + } + + var buf [64]byte + var t []byte + + required := len(s) + 2*hexCount + if required <= len(buf) { + t = buf[:required] + } else { + t = make([]byte, required) + } + + j := 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(s[i]) { + const upperhex = "0123456789ABCDEF" + t[j] = '%' + t[j+1] = upperhex[c>>4] + t[j+2] = upperhex[c&15] + j += 3 + } else { + t[j] = c + j++ + } + } + + return string(t) +} + +// shouldEscape returns true if the specified byte should be escaped when +// appearing in a baggage value string. +func shouldEscape(c byte) bool { + if c == '%' { + // The percent character must be encoded so that percent-encoding can work. + return true + } + return !validateValueChar(int32(c)) } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index 19b2c6e9459..e6664f0e0af 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -22,6 +22,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "go.opentelemetry.io/otel/internal/baggage" ) @@ -390,12 +391,19 @@ func TestBaggageParse(t *testing.T) { }, }, { - name: "url encoded value", + name: "encoded ASCII string", in: "key1=val%252%2C", want: baggage.List{ "key1": {Value: "val%2,"}, }, }, + { + name: "encoded UTF-8 string", + in: "foo=%C4%85%C5%9B%C4%87", + want: baggage.List{ + "foo": {Value: "ąść"}, + }, + }, { name: "invalid member: empty", in: "foo=,,bar=", @@ -501,13 +509,7 @@ func TestBaggageString(t *testing.T) { // Meaning, US-ASCII characters excluding CTLs, whitespace, // DQUOTE, comma, semicolon, and backslash. All excluded // characters need to be percent encoded. - // - // Ideally, the want result is: - // out: "foo=%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+%2C-./0123456789:%3B<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]^_%60abcdefghijklmnopqrstuvwxyz{|}~%7F", - // However, the following characters are escaped: - // !#'()*/<>?[]^{|} - // It is not necessary, but still provides a correct result. - out: "foo=%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23$%25&%27%28%29%2A+%2C-.%2F0123456789:%3B%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F", + out: "foo=%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+%2C-./0123456789:%3B<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]^_`abcdefghijklmnopqrstuvwxyz{|}~%7F", baggage: baggage.List{ "foo": {Value: func() string { // All US-ASCII characters. @@ -519,6 +521,13 @@ func TestBaggageString(t *testing.T) { }()}, }, }, + { + name: "non-ASCII UTF-8 string", + out: "foo=%C4%85%C5%9B%C4%87", + baggage: baggage.List{ + "foo": {Value: "ąść"}, + }, + }, { name: "plus", out: "foo=1+1", @@ -937,3 +946,48 @@ func BenchmarkParse(b *testing.B) { benchBaggage, _ = Parse(`userId=alice,serverNode = DF28 , isProduction = false,hasProp=stuff;propKey;propWValue=value`) } } + +func BenchmarkString(b *testing.B) { + var members []Member + addMember := func(k, v string) { + m, err := NewMember(k, valueEscape(v)) + require.NoError(b, err) + members = append(members, m) + } + + addMember("key1", "val1") + addMember("key2", " ;,%") + addMember("key3", "Witaj świecie!") + addMember("key4", strings.Repeat("Hello world!", 10)) + + bg, err := New(members...) + require.NoError(b, err) + + b.ReportAllocs() + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _ = bg.String() + } +} + +func BenchmarkValueEscape(b *testing.B) { + testCases := []struct { + name string + in string + }{ + {name: "nothing to escape", in: "value"}, + {name: "requires escaping", in: " ;,%"}, + {name: "long value", in: strings.Repeat("Hello world!", 20)}, + } + + for _, tc := range testCases { + b.Run(tc.name, func(b *testing.B) { + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + _ = valueEscape(tc.in) + } + }) + } +} From 27f70a335008ed7cdb398013eedf6812cc1c44e0 Mon Sep 17 00:00:00 2001 From: CZ Date: Fri, 29 Dec 2023 06:46:17 +1300 Subject: [PATCH 800/886] bridge/opentracing: fix baggage item key is canonicalized (#4776) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Pająk Co-authored-by: Yuri Shkuro --- CHANGELOG.md | 1 + bridge/opentracing/bridge.go | 7 +-- bridge/opentracing/bridge_test.go | 84 +++++++++++++++++++++++++++++++ bridge/opentracing/mix_test.go | 4 +- 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b94281d2ff5..717a990bc7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) - Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) +- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) ## [1.21.0/0.44.0] 2023-11-16 diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index cc3d7d19c7f..f61dc9eee00 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -17,7 +17,6 @@ package opentracing // import "go.opentelemetry.io/otel/bridge/opentracing" import ( "context" "fmt" - "net/http" "strings" "sync" @@ -74,8 +73,7 @@ func (c *bridgeSpanContext) ForeachBaggageItem(handler func(k, v string) bool) { } func (c *bridgeSpanContext) setBaggageItem(restrictedKey, value string) { - crk := http.CanonicalHeaderKey(restrictedKey) - m, err := baggage.NewMember(crk, value) + m, err := baggage.NewMember(restrictedKey, value) if err != nil { return } @@ -83,8 +81,7 @@ func (c *bridgeSpanContext) setBaggageItem(restrictedKey, value string) { } func (c *bridgeSpanContext) baggageItem(restrictedKey string) baggage.Member { - crk := http.CanonicalHeaderKey(restrictedKey) - return c.bag.Member(crk) + return c.bag.Member(restrictedKey) } type bridgeSpan struct { diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index bbeb3f9fbfe..7a3e384424b 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -574,3 +574,87 @@ func TestBridgeSpanContextPromotedMethods(t *testing.T) { assert.True(t, spanContext.(spanContextProvider).HasTraceID()) }) } + +func TestBridgeCarrierBaggagePropagation(t *testing.T) { + carriers := []struct { + name string + carrier interface{} + format ot.BuiltinFormat + }{ + { + name: "TextMapCarrier", + carrier: ot.TextMapCarrier{}, + format: ot.TextMap, + }, + { + name: "HTTPHeadersCarrier", + carrier: ot.HTTPHeadersCarrier{}, + format: ot.HTTPHeaders, + }, + } + + testCases := []struct { + name string + baggageItems []bipBaggage + }{ + { + name: "single baggage item", + baggageItems: []bipBaggage{ + { + key: "foo", + value: "bar", + }, + }, + }, + { + name: "multiple baggage items", + baggageItems: []bipBaggage{ + { + key: "foo", + value: "bar", + }, + { + key: "foo2", + value: "bar2", + }, + }, + }, + } + + for _, c := range carriers { + for _, tc := range testCases { + t.Run(fmt.Sprintf("%s %s", c.name, tc.name), func(t *testing.T) { + mockOtelTracer := internal.NewMockTracer() + b, _ := NewTracerPair(mockOtelTracer) + b.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator( + propagation.TraceContext{}, + propagation.Baggage{}), // Required for baggage propagation. + ) + + // Set baggage items. + span := b.StartSpan("test") + for _, bi := range tc.baggageItems { + span.SetBaggageItem(bi.key, bi.value) + } + defer span.Finish() + + err := b.Inject(span.Context(), c.format, c.carrier) + assert.NoError(t, err) + + spanContext, err := b.Extract(c.format, c.carrier) + assert.NoError(t, err) + + // Check baggage items. + bsc, ok := spanContext.(*bridgeSpanContext) + assert.True(t, ok) + + var got []bipBaggage + for _, m := range bsc.bag.Members() { + got = append(got, bipBaggage{m.Key(), m.Value()}) + } + + assert.ElementsMatch(t, tc.baggageItems, got) + }) + } + } +} diff --git a/bridge/opentracing/mix_test.go b/bridge/opentracing/mix_test.go index 0cd5a667ca5..b57f37e8ea7 100644 --- a/bridge/opentracing/mix_test.go +++ b/bridge/opentracing/mix_test.go @@ -334,7 +334,7 @@ func newBaggageItemsPreservationTest() *baggageItemsPreservationTest { value: "two", }, { - key: "Third", + key: "third", value: "three", }, }, @@ -427,7 +427,7 @@ func newBaggageInteroperationTest() *baggageInteroperationTest { value: "two", }, { - key: "Third", + key: "third", value: "three", }, }, From e6c50b5924a889a391dacacf47eb37227092005b Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Mon, 1 Jan 2024 23:57:47 +0100 Subject: [PATCH 801/886] dependabot updates Mon Jan 1 11:21:58 UTC 2024 (#4807) Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 in /exporters/prometheus Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 in /example/prometheus --- example/prometheus/go.mod | 9 ++++----- example/prometheus/go.sum | 25 ++++++++----------------- exporters/prometheus/go.mod | 9 ++++----- exporters/prometheus/go.sum | 25 ++++++++----------------- internal/tools/go.mod | 9 ++++----- internal/tools/go.sum | 18 ++++++++---------- 6 files changed, 36 insertions(+), 59 deletions(-) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 3871b954f63..a41ef49296f 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/prometheus go 1.20 require ( - github.com/prometheus/client_golang v1.17.0 + github.com/prometheus/client_golang v1.18.0 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/exporters/prometheus v0.44.0 go.opentelemetry.io/otel/metric v1.21.0 @@ -15,11 +15,10 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 5ae04a11d73..ca95f268b7b 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -8,30 +8,21 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 6acd16976ba..c953cf63fce 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/exporters/prometheus go 1.20 require ( - github.com/prometheus/client_golang v1.17.0 + github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 @@ -19,12 +19,11 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/kr/text v0.2.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/sys v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 8675108445e..55f78a4bbfd 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -10,36 +10,27 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 39dedce315a..7f40ad5d2bb 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -84,7 +84,6 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.8.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect @@ -131,7 +130,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect github.com/mbilski/exhaustivestruct v1.2.0 // indirect github.com/mgechev/revive v1.3.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect @@ -146,10 +145,10 @@ require ( github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.5 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.44.0 // indirect - github.com/prometheus/procfs v0.11.1 // indirect + github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect github.com/quasilyte/gogrep v0.5.0 // indirect github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index dad92dff725..e354708f234 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -247,8 +247,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -415,8 +413,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= +github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= github.com/mbilski/exhaustivestruct v1.2.0 h1:wCBmUnSYufAHO6J4AVWY6ff+oxWxsVFrwgOdMUQePUo= github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= github.com/mgechev/revive v1.3.4 h1:k/tO3XTaWY4DEHal9tWBkkUMJYO/dLDVyMmAQxmIMDc= @@ -470,8 +468,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -482,15 +480,15 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= -github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= +github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= -github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/quasilyte/go-ruleguard v0.4.0 h1:DyM6r+TKL+xbKB4Nm7Afd1IQh9kEUKQs2pboWGKtvQo= github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PKk1eh3YGfaEof10= github.com/quasilyte/gogrep v0.5.0 h1:eTKODPXbI8ffJMN+W2aE0+oL0z/nh8/5eNdiO34SOAo= From 7cbe6a842d205d8c9a0f236744f094456e0467ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 Jan 2024 15:34:11 +0100 Subject: [PATCH 802/886] Bump lycheeverse/lychee-action from 1.8.0 to 1.9.0 (#4812) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.8.0 to 1.9.0. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.8.0...v1.9.0) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index cfa1473d162..ddd893be029 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v4 - name: Link Checker - uses: lycheeverse/lychee-action@v1.8.0 + uses: lycheeverse/lychee-action@v1.9.0 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 423438dbeb5..2ed252a5e9a 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.8.0 + uses: lycheeverse/lychee-action@v1.9.0 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 133f943694a7ae87ed391c2690afc3b4946b2885 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 7 Jan 2024 18:00:00 +0100 Subject: [PATCH 803/886] dependabot updates Sun Jan 7 15:43:49 UTC 2024 (#4813) Bump golang.org/x/sys from 0.15.0 to 0.16.0 in /sdk --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 44 files changed, 66 insertions(+), 66 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index f0e79605b6d..6e87574ce00 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index ac80eef8dd6..3c24424ec3f 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 9bb1cc7e298..2b426635e37 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 92446012a6b..00b4f7dbfcc 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 13e224990eb..2338869a2ba 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -26,7 +26,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/protobuf v1.32.0 // indirect diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index f537a5a6959..b4428b93635 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -41,8 +41,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= diff --git a/example/dice/go.mod b/example/dice/go.mod index 75828c0013b..fb9f0987c9e 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index e334de1e4d0..98b582ca643 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -11,6 +11,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 20613283088..f46836e7b0b 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.4.1 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 256d60595f7..d699dc1a86f 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index d59266f2a04..0254e0f84ba 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 92446012a6b..00b4f7dbfcc 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7131b75e840..85c799432ff 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 3238bb95f42..e591845f7e1 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -21,8 +21,8 @@ go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v8 go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 83a9c212c03..cb7c4d4a7bf 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 256d60595f7..d699dc1a86f 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index a41ef49296f..08c8cd0004c 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -21,7 +21,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index ca95f268b7b..d21cccb832e 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -21,8 +21,8 @@ github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGy github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 8cbc87f0c79..77d1d935e54 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index f8597fe211c..ee116ca6b83 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index c44ff7839c7..57b60194bf7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index bbf086b49e2..6c41cd7b22f 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 42bbc17fdff..2a1a058a96b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index bbf086b49e2..6c41cd7b22f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 50e6bc2bfa3..e59e0ef651f 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index be9edbe3b4a..bb9d839f0af 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -25,8 +25,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 4a52043cd3f..4fdcebb65a4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 658b574d290..583e1750640 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -30,8 +30,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index f097e571aa3..9ea2ab60027 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index 5efb5f7e146..d99cfbe7767 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index c953cf63fce..fd35cada775 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 55f78a4bbfd..a434353b938 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -29,8 +29,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 3e13a25a233..382deb64e8d 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index eafb844548c..c5fa9b27769 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index d543d83115e..834ed3ee191 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index eafb844548c..c5fa9b27769 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 63053ccaee2..c3fb870f231 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index cb8496310a7..e72b89d2d1f 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7f40ad5d2bb..7b90c739318 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -206,7 +206,7 @@ require ( golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sync v0.5.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index e354708f234..613ea7933b6 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -840,8 +840,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/sdk/go.mod b/sdk/go.mod index f2b2c6ba86d..d66f7d1e91f 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.21.0 go.opentelemetry.io/otel/trace v1.21.0 - golang.org/x/sys v0.15.0 + golang.org/x/sys v0.16.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index b9faa150368..f8eb9a72baa 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index be238b00edd..bccc2caf9a8 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index eafb844548c..c5fa9b27769 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From deddec38ac0c9e60b3e463b6d2220f636fd1d92b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 8 Jan 2024 07:49:45 -0800 Subject: [PATCH 804/886] Optimize `(attribute.Set).Filter` for no filtered case (#4774) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Optimize Set.Filter for no filtered case When all elements of the Set are kept during a call to Filter, do not allocate a new Set and the dropped attributes slice. Instead, return the immutable Set and nil. To achieve this the functionality of filterSet is broken down into a more generic filteredToFront function. * Apply suggestions from code review Co-authored-by: Robert Pająk * Rename run to benchFn based on review feedback --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 1 + attribute/set.go | 87 ++++++++++++++++---------- attribute/set_test.go | 142 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 717a990bc7a..d33d430d270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) - Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721) - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) +- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) - `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) ### Fixed diff --git a/attribute/set.go b/attribute/set.go index 9f9303d4f15..7e6765b06b7 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -279,52 +279,75 @@ func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (S position-- kvs[offset], kvs[position] = kvs[position], kvs[offset] } + kvs = kvs[position:] + if filter != nil { - return filterSet(kvs[position:], filter) + if div := filteredToFront(kvs, filter); div != 0 { + return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div] + } } - return Set{ - equivalent: computeDistinct(kvs[position:]), - }, nil + return Set{equivalent: computeDistinct(kvs)}, nil } -// filterSet reorders kvs so that included keys are contiguous at the end of -// the slice, while excluded keys precede the included keys. -func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) { - var excluded []KeyValue - - // Move attributes that do not match the filter so they're adjacent before - // calling computeDistinct(). - distinctPosition := len(kvs) - - // Swap indistinct keys forward and distinct keys toward the - // end of the slice. - offset := len(kvs) - 1 - for ; offset >= 0; offset-- { - if filter(kvs[offset]) { - distinctPosition-- - kvs[offset], kvs[distinctPosition] = kvs[distinctPosition], kvs[offset] - continue +// filteredToFront filters slice in-place using keep function. All KeyValues that need to +// be removed are moved to the front. All KeyValues that need to be kept are +// moved (in-order) to the back. The index for the first KeyValue to be kept is +// returned. +func filteredToFront(slice []KeyValue, keep Filter) int { + n := len(slice) + j := n + for i := n - 1; i >= 0; i-- { + if keep(slice[i]) { + j-- + slice[i], slice[j] = slice[j], slice[i] } } - excluded = kvs[:distinctPosition] - - return Set{ - equivalent: computeDistinct(kvs[distinctPosition:]), - }, excluded + return j } // Filter returns a filtered copy of this Set. See the documentation for // NewSetWithSortableFiltered for more details. func (l *Set) Filter(re Filter) (Set, []KeyValue) { if re == nil { - return Set{ - equivalent: l.equivalent, - }, nil + return *l, nil } - // Note: This could be refactored to avoid the temporary slice - // allocation, if it proves to be expensive. - return filterSet(l.ToSlice(), re) + // Iterate in reverse to the first attribute that will be filtered out. + n := l.Len() + first := n - 1 + for ; first >= 0; first-- { + kv, _ := l.Get(first) + if !re(kv) { + break + } + } + + // No attributes will be dropped, return the immutable Set l and nil. + if first < 0 { + return *l, nil + } + + // Copy now that we know we need to return a modified set. + // + // Do not do this in-place on the underlying storage of *Set l. Sets are + // immutable and filtering should not change this. + slice := l.ToSlice() + + // Don't re-iterate the slice if only slice[0] is filtered. + if first == 0 { + // It is safe to assume len(slice) >= 1 given we found at least one + // attribute above that needs to be filtered out. + return Set{equivalent: computeDistinct(slice[1:])}, slice[:1] + } + + // Move the filtered slice[first] to the front (preserving order). + kv := slice[first] + copy(slice[1:first+1], slice[:first]) + slice[0] = kv + + // Do not re-evaluate re(slice[first+1:]). + div := filteredToFront(slice[1:first+1], re) + 1 + return Set{equivalent: computeDistinct(slice[div:])}, slice[:div] } // computeDistinct returns a Distinct using either the fixed- or diff --git a/attribute/set_test.go b/attribute/set_test.go index 4fb47752e5f..4382e9a7c54 100644 --- a/attribute/set_test.go +++ b/attribute/set_test.go @@ -130,6 +130,106 @@ func TestSetDedup(t *testing.T) { } } +func TestFiltering(t *testing.T) { + a := attribute.String("A", "a") + b := attribute.String("B", "b") + c := attribute.String("C", "c") + + tests := []struct { + name string + in []attribute.KeyValue + filter attribute.Filter + kept, drop []attribute.KeyValue + }{ + { + name: "A", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { return kv.Key == "A" }, + kept: []attribute.KeyValue{a}, + drop: []attribute.KeyValue{b, c}, + }, + { + name: "B", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { return kv.Key == "B" }, + kept: []attribute.KeyValue{b}, + drop: []attribute.KeyValue{a, c}, + }, + { + name: "C", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { return kv.Key == "C" }, + kept: []attribute.KeyValue{c}, + drop: []attribute.KeyValue{a, b}, + }, + { + name: "A||B", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { + return kv.Key == "A" || kv.Key == "B" + }, + kept: []attribute.KeyValue{a, b}, + drop: []attribute.KeyValue{c}, + }, + { + name: "B||C", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { + return kv.Key == "B" || kv.Key == "C" + }, + kept: []attribute.KeyValue{b, c}, + drop: []attribute.KeyValue{a}, + }, + { + name: "A||C", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { + return kv.Key == "A" || kv.Key == "C" + }, + kept: []attribute.KeyValue{a, c}, + drop: []attribute.KeyValue{b}, + }, + { + name: "None", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { return false }, + kept: nil, + drop: []attribute.KeyValue{a, b, c}, + }, + { + name: "All", + in: []attribute.KeyValue{a, b, c}, + filter: func(kv attribute.KeyValue) bool { return true }, + kept: []attribute.KeyValue{a, b, c}, + drop: nil, + }, + { + name: "Empty", + in: []attribute.KeyValue{}, + filter: func(kv attribute.KeyValue) bool { return true }, + kept: nil, + drop: nil, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + t.Run("NewSetWithFiltered", func(t *testing.T) { + fltr, drop := attribute.NewSetWithFiltered(test.in, test.filter) + assert.Equal(t, test.kept, fltr.ToSlice(), "filtered") + assert.ElementsMatch(t, test.drop, drop, "dropped") + }) + + t.Run("Set.Filter", func(t *testing.T) { + s := attribute.NewSet(test.in...) + fltr, drop := s.Filter(test.filter) + assert.Equal(t, test.kept, fltr.ToSlice(), "filtered") + assert.ElementsMatch(t, test.drop, drop, "dropped") + }) + }) + } +} + func TestUniqueness(t *testing.T) { short := []attribute.KeyValue{ attribute.String("A", "0"), @@ -225,3 +325,45 @@ func args(m reflect.Method) []reflect.Value { } return out } + +func BenchmarkFiltering(b *testing.B) { + var kvs [26]attribute.KeyValue + buf := [1]byte{'A' - 1} + for i := range kvs { + buf[0]++ // A, B, C ... Z + kvs[i] = attribute.String(string(buf[:]), "") + } + + var result struct { + set attribute.Set + dropped []attribute.KeyValue + } + + benchFn := func(fltr attribute.Filter) func(*testing.B) { + return func(b *testing.B) { + b.Helper() + b.Run("Set.Filter", func(b *testing.B) { + s := attribute.NewSet(kvs[:]...) + b.ResetTimer() + b.ReportAllocs() + for n := 0; n < b.N; n++ { + result.set, result.dropped = s.Filter(fltr) + } + }) + + b.Run("NewSetWithFiltered", func(b *testing.B) { + attrs := kvs[:] + b.ResetTimer() + b.ReportAllocs() + for n := 0; n < b.N; n++ { + result.set, result.dropped = attribute.NewSetWithFiltered(attrs, fltr) + } + }) + } + } + + b.Run("NoFilter", benchFn(nil)) + b.Run("NoFiltered", benchFn(func(attribute.KeyValue) bool { return true })) + b.Run("Filtered", benchFn(func(kv attribute.KeyValue) bool { return kv.Key == "A" })) + b.Run("AllDropped", benchFn(func(attribute.KeyValue) bool { return false })) +} From 6ead8d80e8d27082face6ee11fe9b11844fa797f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 09:06:35 -0800 Subject: [PATCH 805/886] Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/tools (#4815) Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.3.3 to 1.3.7. - [Release notes](https://github.com/cloudflare/circl/releases) - [Commits](https://github.com/cloudflare/circl/compare/v1.3.3...v1.3.7) --- updated-dependencies: - dependency-name: github.com/cloudflare/circl dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 7b90c739318..b18016252c5 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -54,7 +54,7 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect - github.com/cloudflare/circl v1.3.3 // indirect + github.com/cloudflare/circl v1.3.7 // indirect github.com/curioswitch/go-reassign v0.2.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/daixiang0/gci v0.11.2 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 613ea7933b6..ced5cf4deba 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -127,8 +127,9 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= From 259143a6628a9d0b344b4d6a0b704d1e94d69bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 10 Jan 2024 14:02:57 +0100 Subject: [PATCH 806/886] baggage: Add NewMemberRaw and NewKeyValuePropertyRaw (#4804) --- CHANGELOG.md | 3 ++ baggage/baggage.go | 86 ++++++++++++++++++++----------- baggage/baggage_test.go | 83 ++++++++++++++++++++++------- bridge/opentracing/bridge.go | 2 +- bridge/opentracing/bridge_test.go | 24 +++++++-- bridge/opentracing/mix_test.go | 2 +- example/namedtracer/main.go | 4 +- propagation/baggage_test.go | 5 +- 8 files changed, 150 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d33d430d270..6147c177966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) - Experimental cardinality limiting is added to the metric SDK. See [metric documentation](./sdk/metric/EXPERIMENTAL.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) +- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) ### Changed @@ -31,12 +32,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) - Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) - `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) +- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) ### Fixed - Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) - Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) - Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) +- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) ## [1.21.0/0.44.0] 2023-11-16 diff --git a/baggage/baggage.go b/baggage/baggage.go index 89a0664201d..7d27cf77d5c 100644 --- a/baggage/baggage.go +++ b/baggage/baggage.go @@ -66,14 +66,29 @@ func NewKeyProperty(key string) (Property, error) { // NewKeyValueProperty returns a new Property for key with value. // -// If key or value are invalid, an error will be returned. +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be precent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewKeyValuePropertyRaw] instead +// that does not require precent-encoding of the value. func NewKeyValueProperty(key, value string) (Property, error) { - if !validateKey(key) { - return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) - } if !validateValue(value) { return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewKeyValuePropertyRaw(key, decodedValue) +} + +// NewKeyValuePropertyRaw returns a new Property for key with value. +// +// The passed key must be compliant with W3C Baggage specification. +func NewKeyValuePropertyRaw(key, value string) (Property, error) { + if !validateKey(key) { + return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key) + } p := Property{ key: key, @@ -113,9 +128,6 @@ func (p Property) validate() error { if !validateKey(p.key) { return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key)) } - if p.hasValue && !validateValue(p.value) { - return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value)) - } if !p.hasValue && p.value != "" { return errFunc(errors.New("inconsistent value")) } @@ -134,11 +146,11 @@ func (p Property) Value() (string, bool) { return p.value, p.hasValue } -// String encodes Property into a string compliant with the W3C Baggage +// String encodes Property into a header string compliant with the W3C Baggage // specification. func (p Property) String() string { if p.hasValue { - return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, p.value) + return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value)) } return p.key } @@ -198,7 +210,7 @@ func (p properties) validate() error { return nil } -// String encodes properties into a string compliant with the W3C Baggage +// String encodes properties into a header string compliant with the W3C Baggage // specification. func (p properties) String() string { props := make([]string, len(p)) @@ -220,11 +232,28 @@ type Member struct { hasData bool } -// NewMember returns a new Member from the passed arguments. The key will be -// used directly while the value will be url decoded after validation. An error -// is returned if the created Member would be invalid according to the W3C -// Baggage specification. +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +// The passed value must be precent-encoded as defined in W3C Baggage specification. +// +// Notice: Consider using [NewMemberRaw] instead +// that does not require precent-encoding of the value. func NewMember(key, value string, props ...Property) (Member, error) { + if !validateValue(value) { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + decodedValue, err := url.PathUnescape(value) + if err != nil { + return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) + } + return NewMemberRaw(key, decodedValue, props...) +} + +// NewMemberRaw returns a new Member from the passed arguments. +// +// The passed key must be compliant with W3C Baggage specification. +func NewMemberRaw(key, value string, props ...Property) (Member, error) { m := Member{ key: key, value: value, @@ -234,11 +263,6 @@ func NewMember(key, value string, props ...Property) (Member, error) { if err := m.validate(); err != nil { return newInvalidMember(), err } - decodedValue, err := url.PathUnescape(value) - if err != nil { - return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value) - } - m.value = decodedValue return m, nil } @@ -284,6 +308,8 @@ func parseMember(member string) (Member, error) { if !validateValue(val) { return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v) } + + // Decode a precent-encoded value. value, err := url.PathUnescape(val) if err != nil { return newInvalidMember(), fmt.Errorf("%w: %v", errInvalidValue, err) @@ -292,8 +318,7 @@ func parseMember(member string) (Member, error) { } // validate ensures m conforms to the W3C Baggage specification. -// A key is just an ASCII string, but a value must be URL encoded UTF-8, -// returning an error otherwise. +// A key must be an ASCII string, returning an error otherwise. func (m Member) validate() error { if !m.hasData { return fmt.Errorf("%w: %q", errInvalidMember, m) @@ -302,9 +327,6 @@ func (m Member) validate() error { if !validateKey(m.key) { return fmt.Errorf("%w: %q", errInvalidKey, m.key) } - if !validateValue(m.value) { - return fmt.Errorf("%w: %q", errInvalidValue, m.value) - } return m.properties.validate() } @@ -317,7 +339,7 @@ func (m Member) Value() string { return m.value } // Properties returns a copy of the Member properties. func (m Member) Properties() []Property { return m.properties.Copy() } -// String encodes Member into a string compliant with the W3C Baggage +// String encodes Member into a header string compliant with the W3C Baggage // specification. func (m Member) String() string { // A key is just an ASCII string. A value is restricted to be @@ -514,9 +536,8 @@ func (b Baggage) Len() int { return len(b.list) } -// String encodes Baggage into a string compliant with the W3C Baggage -// specification. The returned string will be invalid if the Baggage contains -// any invalid list-members. +// String encodes Baggage into a header string compliant with the W3C Baggage +// specification. func (b Baggage) String() string { members := make([]string, 0, len(b.list)) for k, v := range b.list { @@ -595,10 +616,17 @@ func parsePropertyInternal(s string) (p Property, ok bool) { return } + // Decode a precent-encoded value. + value, err := url.PathUnescape(s[valueStart:valueEnd]) + if err != nil { + return + } + ok = true p.key = s[keyStart:keyEnd] p.hasValue = true - p.value = s[valueStart:valueEnd] + + p.value = value return } diff --git a/baggage/baggage_test.go b/baggage/baggage_test.go index e6664f0e0af..4bacf1ea54b 100644 --- a/baggage/baggage_test.go +++ b/baggage/baggage_test.go @@ -143,7 +143,7 @@ func TestNewKeyProperty(t *testing.T) { } func TestNewKeyValueProperty(t *testing.T) { - p, err := NewKeyValueProperty(" ", "") + p, err := NewKeyValueProperty(" ", "value") assert.ErrorIs(t, err, errInvalidKey) assert.Equal(t, Property{}, p) @@ -156,6 +156,16 @@ func TestNewKeyValueProperty(t *testing.T) { assert.Equal(t, Property{key: "key", value: "value", hasValue: true}, p) } +func TestNewKeyValuePropertyRaw(t *testing.T) { + p, err := NewKeyValuePropertyRaw(" ", "") + assert.ErrorIs(t, err, errInvalidKey) + assert.Equal(t, Property{}, p) + + p, err = NewKeyValuePropertyRaw("key", "Witaj Świecie!") + assert.NoError(t, err) + assert.Equal(t, Property{key: "key", value: "Witaj Świecie!", hasValue: true}, p) +} + func TestPropertyValidate(t *testing.T) { p := Property{} assert.ErrorIs(t, p.validate(), errInvalidKey) @@ -163,13 +173,10 @@ func TestPropertyValidate(t *testing.T) { p.key = "k" assert.NoError(t, p.validate()) - p.value = ";" + p.value = "v" assert.EqualError(t, p.validate(), "invalid property: inconsistent value") p.hasValue = true - assert.ErrorIs(t, p.validate(), errInvalidValue) - - p.value = "v" assert.NoError(t, p.validate()) } @@ -397,6 +404,15 @@ func TestBaggageParse(t *testing.T) { "key1": {Value: "val%2,"}, }, }, + { + name: "encoded property", + in: "key1=;bar=val%252%2C", + want: baggage.List{ + "key1": { + Properties: []baggage.Property{{Key: "bar", HasValue: true, Value: "val%2,"}}, + }, + }, + }, { name: "encoded UTF-8 string", in: "foo=%C4%85%C5%9B%C4%87", @@ -528,6 +544,17 @@ func TestBaggageString(t *testing.T) { "foo": {Value: "ąść"}, }, }, + { + name: "Encoded property value", + out: "foo=;bar=%20", + baggage: baggage.List{ + "foo": { + Properties: []baggage.Property{ + {Key: "bar", Value: " ", HasValue: true}, + }, + }, + }, + }, { name: "plus", out: "foo=1+1", @@ -846,9 +873,6 @@ func TestMemberValidation(t *testing.T) { assert.ErrorIs(t, m.validate(), errInvalidKey) m.key, m.value = "k", "\\" - assert.ErrorIs(t, m.validate(), errInvalidValue) - - m.value = "v" assert.NoError(t, m.validate()) } @@ -891,6 +915,28 @@ func TestNewMember(t *testing.T) { assert.Equal(t, expected, m) } +func TestNewMemberRaw(t *testing.T) { + m, err := NewMemberRaw("", "") + assert.ErrorIs(t, err, errInvalidKey) + assert.Equal(t, Member{hasData: false}, m) + + key, val := "k", "v" + p := Property{key: "foo"} + m, err = NewMemberRaw(key, val, p) + assert.NoError(t, err) + expected := Member{ + key: key, + value: val, + properties: properties{{key: "foo"}}, + hasData: true, + } + assert.Equal(t, expected, m) + + // Ensure new member is immutable. + p.key = "bar" + assert.Equal(t, expected, m) +} + func TestPropertiesValidate(t *testing.T) { p := properties{{}} assert.ErrorIs(t, p.validate(), errInvalidKey) @@ -904,11 +950,12 @@ func TestPropertiesValidate(t *testing.T) { func TestMemberString(t *testing.T) { // normal key value pair - member, _ := NewMember("key", "value") + member, _ := NewMemberRaw("key", "value") memberStr := member.String() assert.Equal(t, memberStr, "key=value") - // encoded key - member, _ = NewMember("key", "%3B%20") + + // encoded value + member, _ = NewMemberRaw("key", "; ") memberStr = member.String() assert.Equal(t, memberStr, "key=%3B%20") } @@ -916,10 +963,10 @@ func TestMemberString(t *testing.T) { var benchBaggage Baggage func BenchmarkNew(b *testing.B) { - mem1, _ := NewMember("key1", "val1") - mem2, _ := NewMember("key2", "val2") - mem3, _ := NewMember("key3", "val3") - mem4, _ := NewMember("key4", "val4") + mem1, _ := NewMemberRaw("key1", "val1") + mem2, _ := NewMemberRaw("key2", "val2") + mem3, _ := NewMemberRaw("key3", "val3") + mem4, _ := NewMemberRaw("key4", "val4") b.ReportAllocs() b.ResetTimer() @@ -931,11 +978,11 @@ func BenchmarkNew(b *testing.B) { var benchMember Member -func BenchmarkNewMember(b *testing.B) { +func BenchmarkNewMemberRaw(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { - benchMember, _ = NewMember("key", "value") + benchMember, _ = NewMemberRaw("key", "value") } } @@ -950,7 +997,7 @@ func BenchmarkParse(b *testing.B) { func BenchmarkString(b *testing.B) { var members []Member addMember := func(k, v string) { - m, err := NewMember(k, valueEscape(v)) + m, err := NewMemberRaw(k, valueEscape(v)) require.NoError(b, err) members = append(members, m) } diff --git a/bridge/opentracing/bridge.go b/bridge/opentracing/bridge.go index f61dc9eee00..6ecb3fc25bf 100644 --- a/bridge/opentracing/bridge.go +++ b/bridge/opentracing/bridge.go @@ -73,7 +73,7 @@ func (c *bridgeSpanContext) ForeachBaggageItem(handler func(k, v string) bool) { } func (c *bridgeSpanContext) setBaggageItem(restrictedKey, value string) { - m, err := baggage.NewMember(restrictedKey, value) + m, err := baggage.NewMemberRaw(restrictedKey, value) if err != nil { return } diff --git a/bridge/opentracing/bridge_test.go b/bridge/opentracing/bridge_test.go index 7a3e384424b..11c21d79496 100644 --- a/bridge/opentracing/bridge_test.go +++ b/bridge/opentracing/bridge_test.go @@ -578,17 +578,17 @@ func TestBridgeSpanContextPromotedMethods(t *testing.T) { func TestBridgeCarrierBaggagePropagation(t *testing.T) { carriers := []struct { name string - carrier interface{} + factory func() interface{} format ot.BuiltinFormat }{ { name: "TextMapCarrier", - carrier: ot.TextMapCarrier{}, + factory: func() interface{} { return ot.TextMapCarrier{} }, format: ot.TextMap, }, { name: "HTTPHeadersCarrier", - carrier: ot.HTTPHeadersCarrier{}, + factory: func() interface{} { return ot.HTTPHeadersCarrier{} }, format: ot.HTTPHeaders, }, } @@ -619,6 +619,19 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) { }, }, }, + { + name: "with characters escaped by baggage propagator", + baggageItems: []bipBaggage{ + { + key: "space", + value: "Hello world!", + }, + { + key: "utf8", + value: "Świat", + }, + }, + }, } for _, c := range carriers { @@ -638,10 +651,11 @@ func TestBridgeCarrierBaggagePropagation(t *testing.T) { } defer span.Finish() - err := b.Inject(span.Context(), c.format, c.carrier) + carrier := c.factory() + err := b.Inject(span.Context(), c.format, carrier) assert.NoError(t, err) - spanContext, err := b.Extract(c.format, c.carrier) + spanContext, err := b.Extract(c.format, carrier) assert.NoError(t, err) // Check baggage items. diff --git a/bridge/opentracing/mix_test.go b/bridge/opentracing/mix_test.go index b57f37e8ea7..7dc902545a6 100644 --- a/bridge/opentracing/mix_test.go +++ b/bridge/opentracing/mix_test.go @@ -515,7 +515,7 @@ func (bio *baggageInteroperationTest) addAndRecordBaggage(t *testing.T, ctx cont otSpan.SetBaggageItem(otKey, value) - m, err := baggage.NewMember(otelKey, value) + m, err := baggage.NewMemberRaw(otelKey, value) if err != nil { t.Error(err) return ctx diff --git a/example/namedtracer/main.go b/example/namedtracer/main.go index 68c51ce45c8..51caa20a3dd 100644 --- a/example/namedtracer/main.go +++ b/example/namedtracer/main.go @@ -67,8 +67,8 @@ func main() { ctx := context.Background() defer func() { _ = tp.Shutdown(ctx) }() - m0, _ := baggage.NewMember(string(fooKey), "foo1") - m1, _ := baggage.NewMember(string(barKey), "bar1") + m0, _ := baggage.NewMemberRaw(string(fooKey), "foo1") + m1, _ := baggage.NewMemberRaw(string(barKey), "bar1") b, _ := baggage.New(m0, m1) ctx = baggage.ContextWithBaggage(ctx, b) diff --git a/propagation/baggage_test.go b/propagation/baggage_test.go index 8149fbaf833..3919c3d1d72 100644 --- a/propagation/baggage_test.go +++ b/propagation/baggage_test.go @@ -17,7 +17,6 @@ package propagation_test import ( "context" "net/http" - "net/url" "strings" "testing" @@ -41,13 +40,13 @@ type member struct { func (m member) Member(t *testing.T) baggage.Member { props := make([]baggage.Property, 0, len(m.Properties)) for _, p := range m.Properties { - p, err := baggage.NewKeyValueProperty(p.Key, p.Value) + p, err := baggage.NewKeyValuePropertyRaw(p.Key, p.Value) if err != nil { t.Fatal(err) } props = append(props, p) } - bMember, err := baggage.NewMember(m.Key, url.PathEscape(m.Value), props...) + bMember, err := baggage.NewMemberRaw(m.Key, m.Value, props...) if err != nil { t.Fatal(err) } From 01472db75fb18ebe8908d417c81cc4df43cabe50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 11 Jan 2024 12:56:07 +0100 Subject: [PATCH 807/886] Upgrade use of semconv to v1.24.0 (#4754) --- CHANGELOG.md | 2 + bridge/opentracing/internal/mock.go | 2 +- example/dice/otel.go | 2 +- example/otel-collector/main.go | 2 +- example/zipkin/main.go | 2 +- .../otlpmetricgrpc/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../otlpmetrichttp/internal/otest/client.go | 2 +- .../internal/transform/metricdata_test.go | 2 +- .../internal/tracetransform/span_test.go | 2 +- exporters/prometheus/exporter_test.go | 2 +- exporters/stdout/stdoutmetric/example_test.go | 2 +- exporters/stdout/stdouttrace/example_test.go | 2 +- exporters/zipkin/model.go | 48 +++-- exporters/zipkin/model_test.go | 186 +++++++++++++++--- exporters/zipkin/zipkin_test.go | 2 +- .../otlp/otlpmetric/otest/client.go.tmpl | 2 +- .../transform/metricdata_test.go.tmpl | 2 +- metric/example_test.go | 4 +- sdk/metric/example_test.go | 2 +- sdk/resource/auto_test.go | 2 +- sdk/resource/builtin.go | 2 +- sdk/resource/container.go | 2 +- sdk/resource/env.go | 2 +- sdk/resource/env_test.go | 2 +- sdk/resource/host_id.go | 2 +- sdk/resource/os.go | 2 +- sdk/resource/os_test.go | 2 +- sdk/resource/process.go | 2 +- sdk/resource/resource_test.go | 2 +- sdk/trace/span.go | 2 +- sdk/trace/trace_test.go | 2 +- 32 files changed, 215 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6147c177966..29541bcdbee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.19.0` version of the OpenTelemetry specification. (#4754) - Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) diff --git a/bridge/opentracing/internal/mock.go b/bridge/opentracing/internal/mock.go index d3a8d91a30a..7d7f00730ef 100644 --- a/bridge/opentracing/internal/mock.go +++ b/bridge/opentracing/internal/mock.go @@ -24,7 +24,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/embedded" "go.opentelemetry.io/otel/trace/noop" diff --git a/example/dice/otel.go b/example/dice/otel.go index 9c4f9fe8c42..0b30735007a 100644 --- a/example/dice/otel.go +++ b/example/dice/otel.go @@ -26,7 +26,7 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) // setupOTelSDK bootstraps the OpenTelemetry pipeline. diff --git a/example/otel-collector/main.go b/example/otel-collector/main.go index 21b68d8122e..dc0d727ef8e 100644 --- a/example/otel-collector/main.go +++ b/example/otel-collector/main.go @@ -34,7 +34,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) diff --git a/example/zipkin/main.go b/example/zipkin/main.go index 14ec07b58a7..1f2c6def86a 100644 --- a/example/zipkin/main.go +++ b/example/zipkin/main.go @@ -28,7 +28,7 @@ import ( "go.opentelemetry.io/otel/exporters/zipkin" "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go index 154d4dd3c8c..1a8350c2488 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/otest/client.go @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go index 676e5785633..778a172c550 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go @@ -28,7 +28,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go index 41374b956a4..a47a9422b55 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/otest/client.go @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go index 676e5785633..778a172c550 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go @@ -28,7 +28,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go index 7a4fa1e9185..546ab60e538 100644 --- a/exporters/otlp/otlptrace/internal/tracetransform/span_test.go +++ b/exporters/otlp/otlptrace/internal/tracetransform/span_test.go @@ -29,7 +29,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) diff --git a/exporters/prometheus/exporter_test.go b/exporters/prometheus/exporter_test.go index cb402e10ced..c7961014c1f 100644 --- a/exporters/prometheus/exporter_test.go +++ b/exporters/prometheus/exporter_test.go @@ -32,7 +32,7 @@ import ( otelmetric "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) func TestPrometheusExporter(t *testing.T) { diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 6cc978ebbed..683d6ee0fe5 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -26,7 +26,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) var ( diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 0abd72d10e9..fd5425c830e 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -23,7 +23,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) diff --git a/exporters/zipkin/model.go b/exporters/zipkin/model.go index 1ac80c1cb3f..50c163b8346 100644 --- a/exporters/zipkin/model.go +++ b/exporters/zipkin/model.go @@ -28,7 +28,9 @@ import ( "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv120 "go.opentelemetry.io/otel/semconv/v1.20.0" + semconv121 "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) @@ -236,15 +238,19 @@ func toZipkinTags(data tracesdk.ReadOnlySpan) map[string]string { } // Rank determines selection order for remote endpoint. See the specification -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin +// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.28.0/specification/trace/sdk_exporters/zipkin.md#otlp---zipkin var remoteEndpointKeyRank = map[attribute.Key]int{ - semconv.PeerServiceKey: 0, - semconv.NetPeerNameKey: 1, - semconv.NetSockPeerNameKey: 2, - semconv.NetSockPeerAddrKey: 3, - keyPeerHostname: 4, - keyPeerAddress: 5, - semconv.DBNameKey: 6, + semconv.PeerServiceKey: 1, + semconv.ServerAddressKey: 2, + semconv120.NetPeerNameKey: 3, + semconv.NetworkPeerAddressKey: 4, + semconv121.ServerSocketDomainKey: 5, + semconv121.ServerSocketAddressKey: 6, + semconv120.NetSockPeerNameKey: 7, + semconv120.NetSockPeerAddrKey: 8, + keyPeerHostname: 9, + keyPeerAddress: 10, + semconv.DBNameKey: 11, } func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint { @@ -273,19 +279,23 @@ func toZipkinRemoteEndpoint(data tracesdk.ReadOnlySpan) *zkmodel.Endpoint { return nil } - if endpointAttr.Key != semconv.NetSockPeerAddrKey && - endpointAttr.Value.Type() == attribute.STRING { - return &zkmodel.Endpoint{ - ServiceName: endpointAttr.Value.AsString(), - } + v := endpointAttr.Value.AsString() + + switch endpointAttr.Key { + case semconv.NetworkPeerAddressKey: + return remoteEndpointPeerIPWithPort(v, semconv.NetworkPeerPortKey, attr) + case semconv121.ServerSocketAddressKey: + return remoteEndpointPeerIPWithPort(v, semconv121.ServerSocketPortKey, attr) + case semconv120.NetSockPeerAddrKey: + return remoteEndpointPeerIPWithPort(v, semconv121.NetSockPeerPortKey, attr) } - return remoteEndpointPeerIPWithPort(endpointAttr.Value.AsString(), attr) + return &zkmodel.Endpoint{ + ServiceName: v, + } } -// Handles `net.peer.ip` remote endpoint separately (should include `net.peer.ip` -// as well, if available). -func remoteEndpointPeerIPWithPort(peerIP string, attrs []attribute.KeyValue) *zkmodel.Endpoint { +func remoteEndpointPeerIPWithPort(peerIP string, portKey attribute.Key, attrs []attribute.KeyValue) *zkmodel.Endpoint { ip := net.ParseIP(peerIP) if ip == nil { return nil @@ -300,7 +310,7 @@ func remoteEndpointPeerIPWithPort(peerIP string, attrs []attribute.KeyValue) *zk } for _, kv := range attrs { - if kv.Key == semconv.NetSockPeerPortKey { + if kv.Key == portKey { port, _ := strconv.ParseUint(kv.Value.Emit(), 10, 16) endpoint.Port = uint16(port) return endpoint diff --git a/exporters/zipkin/model_test.go b/exporters/zipkin/model_test.go index 82c812a49d0..957b521b537 100644 --- a/exporters/zipkin/model_test.go +++ b/exporters/zipkin/model_test.go @@ -32,7 +32,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) @@ -291,8 +291,8 @@ func TestModelConversion(t *testing.T) { attribute.Int64("attr1", 42), attribute.String("attr2", "bar"), attribute.String("peer.hostname", "test-peer-hostname"), - attribute.String("net.sock.peer.addr", "1.2.3.4"), - attribute.Int64("net.sock.peer.port", 9876), + attribute.String("network.peer.address", "1.2.3.4"), + attribute.Int64("network.peer.port", 9876), }, Events: []tracesdk.Event{ { @@ -745,17 +745,17 @@ func TestModelConversion(t *testing.T) { }, }, Tags: map[string]string{ - "attr1": "42", - "attr2": "bar", - "net.sock.peer.addr": "1.2.3.4", - "net.sock.peer.port": "9876", - "peer.hostname": "test-peer-hostname", - "otel.status_code": "ERROR", - "error": "404, file not found", - "service.name": "model-test", - "service.version": "0.1.0", - "resource-attr1": "42", - "resource-attr2": "[0,1,2]", + "attr1": "42", + "attr2": "bar", + "network.peer.address": "1.2.3.4", + "network.peer.port": "9876", + "peer.hostname": "test-peer-hostname", + "otel.status_code": "ERROR", + "error": "404, file not found", + "service.name": "model-test", + "service.version": "0.1.0", + "resource-attr1": "42", + "resource-attr2": "[0,1,2]", }, }, // model for span data of producer kind @@ -1091,13 +1091,13 @@ func TestRemoteEndpointTransformation(t *testing.T) { want: nil, }, { - name: "peer-service-rank", + name: "peer.service-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ semconv.PeerService("peer-service-test"), - semconv.NetPeerName("peer-name-test"), - semconv.NetSockPeerName("net-sock-peer-test"), + semconv.ServerAddress("server-address-test"), + semconv.NetworkPeerAddress("10.1.2.80"), }, }, want: &zkmodel.Endpoint{ @@ -1105,33 +1105,108 @@ func TestRemoteEndpointTransformation(t *testing.T) { }, }, { - name: "net-sock-peer-rank", + name: "server.address-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerName("net-sock-peer-test"), + semconv.ServerAddress("server-address-test"), + attribute.String("net.peer.name", "net-peer-name-test"), + semconv.NetworkPeerAddress("10.1.2.80"), + }, + }, + want: &zkmodel.Endpoint{ + ServiceName: "server-address-test", + }, + }, + { + name: "net.peer.name-rank", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + attribute.String("net.peer.name", "net-peer-name-test"), + semconv.NetworkPeerAddress("10.1.2.80"), + }, + }, + want: &zkmodel.Endpoint{ + ServiceName: "net-peer-name-test", + }, + }, + { + name: "network.peer.address-rank", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + keyPeerHostname.String("peer-hostname-test"), + semconv.NetworkPeerAddress("10.1.2.80"), semconv.DBName("db-name-test"), + attribute.String("server.socket.domain", "server-socket-domain-test"), }, }, want: &zkmodel.Endpoint{ - ServiceName: "net-sock-peer-test", + IPv4: net.ParseIP("10.1.2.80"), }, }, { - name: "db-name-rank", + name: "server.socket.domain-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - attribute.String("foo", "bar"), + keyPeerHostname.String("peer-hostname-test"), semconv.DBName("db-name-test"), + attribute.String("server.socket.domain", "server-socket-domain-test"), + attribute.String("server.socket.address", "10.2.3.4"), }, }, want: &zkmodel.Endpoint{ - ServiceName: "db-name-test", + ServiceName: "server-socket-domain-test", + }, + }, + { + name: "server.socket.address-rank", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + keyPeerHostname.String("peer-hostname-test"), + semconv.DBName("db-name-test"), + attribute.String("net.sock.peer.name", "server-socket-domain-test"), + attribute.String("server.socket.address", "10.2.3.4"), + }, + }, + want: &zkmodel.Endpoint{ + IPv4: net.ParseIP("10.2.3.4"), + }, + }, + { + name: "net.sock.peer.name-rank", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + keyPeerHostname.String("peer-hostname-test"), + semconv.DBName("db-name-test"), + attribute.String("net.sock.peer.name", "net-sock-peer-name-test"), + attribute.String("net.sock.peer.addr", "10.4.8.12"), + }, + }, + want: &zkmodel.Endpoint{ + ServiceName: "net-sock-peer-name-test", }, }, { - name: "peer-hostname-rank", + name: "net.sock.peer.addr-rank", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + keyPeerHostname.String("peer-hostname-test"), + semconv.DBName("db-name-test"), + attribute.String("net.sock.peer.addr", "10.4.8.12"), + }, + }, + want: &zkmodel.Endpoint{ + IPv4: net.ParseIP("10.4.8.12"), + }, + }, + { + name: "peer.hostname-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ @@ -1145,7 +1220,7 @@ func TestRemoteEndpointTransformation(t *testing.T) { }, }, { - name: "peer-address-rank", + name: "peer.address-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ @@ -1158,21 +1233,34 @@ func TestRemoteEndpointTransformation(t *testing.T) { }, }, { - name: "net-peer-invalid-ip", + name: "db.name-rank", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddr("INVALID"), + attribute.String("foo", "bar"), + semconv.DBName("db-name-test"), + }, + }, + want: &zkmodel.Endpoint{ + ServiceName: "db-name-test", + }, + }, + { + name: "network.peer.address-invalid-ip", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + semconv.NetworkPeerAddress("INVALID"), }, }, want: nil, }, { - name: "net-peer-ipv6-no-port", + name: "network.peer.address-ipv6-no-port", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddr("0:0:1:5ee:bad:c0de:0:0"), + semconv.NetworkPeerAddress("0:0:1:5ee:bad:c0de:0:0"), }, }, want: &zkmodel.Endpoint{ @@ -1180,12 +1268,14 @@ func TestRemoteEndpointTransformation(t *testing.T) { }, }, { - name: "net-peer-ipv4-port", + name: "network.peer.address-ipv4-port", data: tracetest.SpanStub{ SpanKind: trace.SpanKindProducer, Attributes: []attribute.KeyValue{ - semconv.NetSockPeerAddr("1.2.3.4"), - semconv.NetSockPeerPort(9876), + semconv.NetworkPeerAddress("1.2.3.4"), + semconv.NetworkPeerPort(9876), + attribute.Int("server.socket.port", 5432), + attribute.Int("net.sock.peer.port", 2345), }, }, want: &zkmodel.Endpoint{ @@ -1193,6 +1283,38 @@ func TestRemoteEndpointTransformation(t *testing.T) { Port: 9876, }, }, + { + name: "server.socket.address-ipv4-port", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + attribute.String("server.socket.address", "1.2.3.4"), + semconv.NetworkPeerPort(9876), + attribute.Int("server.socket.port", 5432), + attribute.Int("net.sock.peer.port", 2345), + }, + }, + want: &zkmodel.Endpoint{ + IPv4: net.ParseIP("1.2.3.4"), + Port: 5432, + }, + }, + { + name: "net.sock.peer.addr-ipv4-port", + data: tracetest.SpanStub{ + SpanKind: trace.SpanKindProducer, + Attributes: []attribute.KeyValue{ + attribute.String("net.sock.peer.addr", "1.2.3.4"), + semconv.NetworkPeerPort(9876), + attribute.Int("server.socket.port", 5432), + attribute.Int("net.sock.peer.port", 2345), + }, + }, + want: &zkmodel.Endpoint{ + IPv4: net.ParseIP("1.2.3.4"), + Port: 2345, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/exporters/zipkin/zipkin_test.go b/exporters/zipkin/zipkin_test.go index ad720a042b2..deb3eafca15 100644 --- a/exporters/zipkin/zipkin_test.go +++ b/exporters/zipkin/zipkin_test.go @@ -38,7 +38,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) diff --git a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl index 37f25c9b468..cefc910c4c5 100644 --- a/internal/shared/otlp/otlpmetric/otest/client.go.tmpl +++ b/internal/shared/otlp/otlpmetric/otest/client.go.tmpl @@ -29,7 +29,7 @@ import ( "google.golang.org/protobuf/proto" "go.opentelemetry.io/otel" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl index 676e5785633..778a172c550 100644 --- a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl @@ -28,7 +28,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.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.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" diff --git a/metric/example_test.go b/metric/example_test.go index 758dd6b57f1..5e1cfb38ec8 100644 --- a/metric/example_test.go +++ b/metric/example_test.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) var meter = otel.Meter("my-service-meter") @@ -277,6 +277,6 @@ func ExampleMeter_attributes() { statusCode := http.StatusOK apiCounter.Add(r.Context(), 1, - metric.WithAttributes(semconv.HTTPStatusCode(statusCode))) + metric.WithAttributes(semconv.HTTPResponseStatusCode(statusCode))) }) } diff --git a/sdk/metric/example_test.go b/sdk/metric/example_test.go index 81a59343bea..cd84590b680 100644 --- a/sdk/metric/example_test.go +++ b/sdk/metric/example_test.go @@ -25,7 +25,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) // To enable metrics in your application using the SDK, diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 4cc1977f986..885aa93ed71 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) func TestDetect(t *testing.T) { diff --git a/sdk/resource/builtin.go b/sdk/resource/builtin.go index c63a0dd1f8c..6a2c08293a8 100644 --- a/sdk/resource/builtin.go +++ b/sdk/resource/builtin.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) type ( diff --git a/sdk/resource/container.go b/sdk/resource/container.go index 3d536228283..c881b2895be 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -22,7 +22,7 @@ import ( "os" "regexp" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) type containerIDProvider func() (string, error) diff --git a/sdk/resource/env.go b/sdk/resource/env.go index e29ae563a69..be4cbe423ea 100644 --- a/sdk/resource/env.go +++ b/sdk/resource/env.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) const ( diff --git a/sdk/resource/env_test.go b/sdk/resource/env_test.go index a6754f74bc6..99ba9a897bf 100644 --- a/sdk/resource/env_test.go +++ b/sdk/resource/env_test.go @@ -24,7 +24,7 @@ import ( "go.opentelemetry.io/otel/attribute" ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) func TestDetectOnePair(t *testing.T) { diff --git a/sdk/resource/host_id.go b/sdk/resource/host_id.go index fb1ebf2cab2..f579329c2c6 100644 --- a/sdk/resource/host_id.go +++ b/sdk/resource/host_id.go @@ -19,7 +19,7 @@ import ( "errors" "strings" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) type hostIDProvider func() (string, error) diff --git a/sdk/resource/os.go b/sdk/resource/os.go index 0cbd559739c..8fbf071c178 100644 --- a/sdk/resource/os.go +++ b/sdk/resource/os.go @@ -19,7 +19,7 @@ import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) type osDescriptionProvider func() (string, error) diff --git a/sdk/resource/os_test.go b/sdk/resource/os_test.go index 8c42fb6e9e3..bb11545ff25 100644 --- a/sdk/resource/os_test.go +++ b/sdk/resource/os_test.go @@ -21,7 +21,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) func mockRuntimeProviders() { diff --git a/sdk/resource/process.go b/sdk/resource/process.go index ecdd11dd762..739ea4512ac 100644 --- a/sdk/resource/process.go +++ b/sdk/resource/process.go @@ -22,7 +22,7 @@ import ( "path/filepath" "runtime" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) type ( diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index 958a0f745b8..baed4a31336 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -32,7 +32,7 @@ import ( "go.opentelemetry.io/otel/sdk" ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) var ( diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 36dbf67764b..8a4a355ca81 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -30,7 +30,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/internal" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/embedded" ) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index 469eb12ecba..e101e78f46a 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -36,7 +36,7 @@ import ( "go.opentelemetry.io/otel/sdk/instrumentation" ottest "go.opentelemetry.io/otel/sdk/internal/internaltest" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.21.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" ) From 7fa7d1b25262d95e1f8e2d08c97137ada84e1bcd Mon Sep 17 00:00:00 2001 From: CZ Date: Fri, 12 Jan 2024 12:27:40 +1300 Subject: [PATCH 808/886] sdk/metric: Fix observable not registered error when the asynchronous instrument has a drop aggregation (#4772) * Fix observable instrument not registered on drop aggregation * Add TestObservableDropAggregation * Add testcase for dropping unregistered observable * Update CHANGELOG * Add observable name const + suggestions * Add suggestions * Only error if the instrument is not dropped * Decrease indentation * Revert "Decrease indentation" This reverts commit 9e7e7729bfacc5fcfc4a5cbd9fe18109f6364a23. --------- Co-authored-by: Chester Cheung --- CHANGELOG.md | 1 + sdk/metric/instrument.go | 5 +- sdk/metric/meter.go | 31 +++--- sdk/metric/meter_test.go | 208 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 231 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29541bcdbee..236b8a467a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755) - Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756) +- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) - Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) - Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) diff --git a/sdk/metric/instrument.go b/sdk/metric/instrument.go index d549dc17a20..a4cfcbb95f1 100644 --- a/sdk/metric/instrument.go +++ b/sdk/metric/instrument.go @@ -295,8 +295,9 @@ type observable[N int64 | float64] struct { metric.Observable observablID[N] - meter *meter - measures measures[N] + meter *meter + measures measures[N] + dropAggregation bool } func newObservable[N int64 | float64](m *meter, kind InstrumentKind, name, desc, u string) *observable[N] { diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 423cba8bdf9..76f1e70a3d1 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/embedded" "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/metric/internal/aggregate" ) @@ -117,6 +118,7 @@ func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int6 } // Drop aggregation if len(in) == 0 { + inst.dropAggregation = true continue } inst.appendMeasures(in) @@ -233,6 +235,7 @@ func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Fl } // Drop aggregation if len(in) == 0 { + inst.dropAggregation = true continue } inst.appendMeasures(in) @@ -437,12 +440,14 @@ func (r observer) ObserveFloat64(o metric.Float64Observable, v float64, opts ... } if _, registered := r.float64[oImpl.observablID]; !registered { - global.Error(errUnregObserver, "failed to record", - "name", oImpl.name, - "description", oImpl.description, - "unit", oImpl.unit, - "number", fmt.Sprintf("%T", float64(0)), - ) + if !oImpl.dropAggregation { + global.Error(errUnregObserver, "failed to record", + "name", oImpl.name, + "description", oImpl.description, + "unit", oImpl.unit, + "number", fmt.Sprintf("%T", float64(0)), + ) + } return } c := metric.NewObserveConfig(opts) @@ -470,12 +475,14 @@ func (r observer) ObserveInt64(o metric.Int64Observable, v int64, opts ...metric } if _, registered := r.int64[oImpl.observablID]; !registered { - global.Error(errUnregObserver, "failed to record", - "name", oImpl.name, - "description", oImpl.description, - "unit", oImpl.unit, - "number", fmt.Sprintf("%T", int64(0)), - ) + if !oImpl.dropAggregation { + global.Error(errUnregObserver, "failed to record", + "name", oImpl.name, + "description", oImpl.description, + "unit", oImpl.unit, + "number", fmt.Sprintf("%T", int64(0)), + ) + } return } c := metric.NewObserveConfig(opts) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index adf3cd251e2..d068ecd4bad 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -16,6 +16,7 @@ package metric import ( "context" + "encoding/json" "errors" "fmt" "strings" @@ -23,6 +24,7 @@ import ( "testing" "github.com/go-logr/logr" + "github.com/go-logr/logr/funcr" "github.com/go-logr/logr/testr" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -2064,3 +2066,209 @@ func TestHistogramBucketPrecedenceOrdering(t *testing.T) { }) } } + +func TestObservableDropAggregation(t *testing.T) { + const ( + intPrefix = "observable.int64." + intCntName = "observable.int64.counter" + intUDCntName = "observable.int64.up.down.counter" + intGaugeName = "observable.int64.gauge" + floatPrefix = "observable.float64." + floatCntName = "observable.float64.counter" + floatUDCntName = "observable.float64.up.down.counter" + floatGaugeName = "observable.float64.gauge" + unregPrefix = "unregistered.observable." + unregIntCntName = "unregistered.observable.int64.counter" + unregFloatCntName = "unregistered.observable.float64.counter" + ) + + type log struct { + name string + number string + } + + testcases := []struct { + name string + views []View + wantObservables []string + wantUnregLogs []log + }{ + { + name: "default", + views: nil, + wantObservables: []string{ + intCntName, intUDCntName, intGaugeName, + floatCntName, floatUDCntName, floatGaugeName, + }, + wantUnregLogs: []log{ + { + name: unregIntCntName, + number: "int64", + }, + { + name: unregFloatCntName, + number: "float64", + }, + }, + }, + { + name: "drop all metrics", + views: []View{ + func(i Instrument) (Stream, bool) { + return Stream{Aggregation: AggregationDrop{}}, true + }, + }, + wantObservables: nil, + wantUnregLogs: nil, + }, + { + name: "drop float64 observable", + views: []View{ + func(i Instrument) (Stream, bool) { + if strings.HasPrefix(i.Name, floatPrefix) { + return Stream{Aggregation: AggregationDrop{}}, true + } + return Stream{}, false + }, + }, + wantObservables: []string{ + intCntName, intUDCntName, intGaugeName, + }, + wantUnregLogs: []log{ + { + name: unregIntCntName, + number: "int64", + }, + { + name: unregFloatCntName, + number: "float64", + }, + }, + }, + { + name: "drop int64 observable", + views: []View{ + func(i Instrument) (Stream, bool) { + if strings.HasPrefix(i.Name, intPrefix) { + return Stream{Aggregation: AggregationDrop{}}, true + } + return Stream{}, false + }, + }, + wantObservables: []string{ + floatCntName, floatUDCntName, floatGaugeName, + }, + wantUnregLogs: []log{ + { + name: unregIntCntName, + number: "int64", + }, + { + name: unregFloatCntName, + number: "float64", + }, + }, + }, + { + name: "drop unregistered observable", + views: []View{ + func(i Instrument) (Stream, bool) { + if strings.HasPrefix(i.Name, unregPrefix) { + return Stream{Aggregation: AggregationDrop{}}, true + } + return Stream{}, false + }, + }, + wantObservables: []string{ + intCntName, intUDCntName, intGaugeName, + floatCntName, floatUDCntName, floatGaugeName, + }, + wantUnregLogs: nil, + }, + } + for _, tt := range testcases { + t.Run(tt.name, func(t *testing.T) { + var unregLogs []log + otel.SetLogger( + funcr.NewJSON( + func(obj string) { + var entry map[string]interface{} + _ = json.Unmarshal([]byte(obj), &entry) + + // All unregistered observables should log `errUnregObserver` error. + // A observable with drop aggregation is also unregistered, + // however this is expected and should not log an error. + assert.Equal(t, errUnregObserver.Error(), entry["error"]) + + unregLogs = append(unregLogs, log{ + name: fmt.Sprintf("%v", entry["name"]), + number: fmt.Sprintf("%v", entry["number"]), + }) + }, + funcr.Options{Verbosity: 0}, + ), + ) + defer otel.SetLogger(logr.Discard()) + + reader := NewManualReader() + meter := NewMeterProvider(WithView(tt.views...), WithReader(reader)).Meter("TestObservableDropAggregation") + + intCnt, err := meter.Int64ObservableCounter(intCntName) + require.NoError(t, err) + intUDCnt, err := meter.Int64ObservableUpDownCounter(intUDCntName) + require.NoError(t, err) + intGaugeCnt, err := meter.Int64ObservableGauge(intGaugeName) + require.NoError(t, err) + + floatCnt, err := meter.Float64ObservableCounter(floatCntName) + require.NoError(t, err) + floatUDCnt, err := meter.Float64ObservableUpDownCounter(floatUDCntName) + require.NoError(t, err) + floatGaugeCnt, err := meter.Float64ObservableGauge(floatGaugeName) + require.NoError(t, err) + + unregIntCnt, err := meter.Int64ObservableCounter(unregIntCntName) + require.NoError(t, err) + unregFloatCnt, err := meter.Float64ObservableCounter(unregFloatCntName) + require.NoError(t, err) + + _, err = meter.RegisterCallback( + func(ctx context.Context, obs metric.Observer) error { + obs.ObserveInt64(intCnt, 1) + obs.ObserveInt64(intUDCnt, 1) + obs.ObserveInt64(intGaugeCnt, 1) + obs.ObserveFloat64(floatCnt, 1) + obs.ObserveFloat64(floatUDCnt, 1) + obs.ObserveFloat64(floatGaugeCnt, 1) + // We deliberately call observe to unregistered observables + obs.ObserveInt64(unregIntCnt, 1) + obs.ObserveFloat64(unregFloatCnt, 1) + + return nil + }, + intCnt, intUDCnt, intGaugeCnt, + floatCnt, floatUDCnt, floatGaugeCnt, + // We deliberately do not register `unregIntCnt` and `unregFloatCnt` + // to test that `errUnregObserver` is logged when observed by callback. + ) + require.NoError(t, err) + + var rm metricdata.ResourceMetrics + err = reader.Collect(context.Background(), &rm) + require.NoError(t, err) + + if len(tt.wantObservables) == 0 { + require.Len(t, rm.ScopeMetrics, 0) + return + } + + require.Len(t, rm.ScopeMetrics, 1) + require.Len(t, rm.ScopeMetrics[0].Metrics, len(tt.wantObservables)) + + for i, m := range rm.ScopeMetrics[0].Metrics { + assert.Equal(t, tt.wantObservables[i], m.Name) + } + assert.Equal(t, tt.wantUnregLogs, unregLogs) + }) + } +} From 19622d38554fbc7dd48571cf275af77d0220a765 Mon Sep 17 00:00:00 2001 From: Liz Fong-Jones Date: Fri, 12 Jan 2024 07:12:25 -0800 Subject: [PATCH 809/886] chore(docs): explicitly mark lizthegrey emeritus (#4822) * chore(docs): explicitly mark lizthegrey emeritus Follow-on to open-telemetry/opentelemetry-go#1745 - we didn't have an emeritus section then, but we do now as of open-telemetry/opentelemetry-go#2888. * lint * sort in order of date --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 868fdf62c5f..31857a61738 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -630,6 +630,7 @@ should be canceled. ### Emeritus +- [Liz Fong-Jones](https://github.com/lizthegrey), Honeycomb - [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep - [Josh MacDonald](https://github.com/jmacd), LightStep From 4491b39db28770af8c1b2bec183cfaa426ef4b1f Mon Sep 17 00:00:00 2001 From: Liz Fong-Jones Date: Fri, 12 Jan 2024 13:42:36 -0800 Subject: [PATCH 810/886] sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() (#4818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * sdk/trace: use slices.Grow() to avoid excessive runtime.growslice() * go1.20 compat * update go.mod/sum * Update CHANGELOG.md * Revert "update go.mod/sum" This reverts commit 1e4fcfa86cb3c42a3ff113df419e16f9a02b3687. * inline slices.Grow as ensureAttributesCapacity * fix comment * add bench * fix inlining * Apply suggestions from code review Co-authored-by: Robert Pająk Co-authored-by: Damien Mathieu <42@dmathieu.com> * add ReportAllocs * add benchmark variations with lower limit * bugfix: we always want to set cap, just the value is a min() * lint --------- Co-authored-by: Robert Pająk Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 1 + sdk/trace/span.go | 17 +++++++++++++++++ sdk/trace/span_test.go | 29 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 236b8a467a9..1603a98c621 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Improve `go.opentelemetry.io/otel/baggage` performance. (#4743) - Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774) - `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775) +- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818) - `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804) ### Fixed diff --git a/sdk/trace/span.go b/sdk/trace/span.go index 8a4a355ca81..85bc702a019 100644 --- a/sdk/trace/span.go +++ b/sdk/trace/span.go @@ -208,6 +208,16 @@ func (s *recordingSpan) SetStatus(code codes.Code, description string) { s.status = status } +// ensureAttributesCapacity inlines functionality from slices.Grow +// so that we can avoid needing to import golang.org/x/exp for go1.20. +// Once support for go1.20 is dropped, we can use slices.Grow available since go1.21 instead. +// Tracking issue: https://github.com/open-telemetry/opentelemetry-go/issues/4819. +func (s *recordingSpan) ensureAttributesCapacity(minCapacity int) { + if n := minCapacity - cap(s.attributes); n > 0 { + s.attributes = append(s.attributes[:cap(s.attributes)], make([]attribute.KeyValue, n)...)[:len(s.attributes)] + } +} + // SetAttributes sets attributes of this span. // // If a key from attributes already exists the value associated with that key @@ -242,6 +252,7 @@ func (s *recordingSpan) SetAttributes(attributes ...attribute.KeyValue) { // Otherwise, add without deduplication. When attributes are read they // will be deduplicated, optimizing the operation. + s.ensureAttributesCapacity(len(s.attributes) + len(attributes)) for _, a := range attributes { if !a.Valid() { // Drop all invalid attributes. @@ -277,6 +288,12 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) { // Now that s.attributes is deduplicated, adding unique attributes up to // the capacity of s will not over allocate s.attributes. + if sum := len(attrs) + len(s.attributes); sum < limit { + // After support for go1.20 is dropped, simplify if-else to min(sum, limit). + s.ensureAttributesCapacity(sum) + } else { + s.ensureAttributesCapacity(limit) + } for _, a := range attrs { if !a.Valid() { // Drop all invalid attributes. diff --git a/sdk/trace/span_test.go b/sdk/trace/span_test.go index 20148a78702..3288b32b087 100644 --- a/sdk/trace/span_test.go +++ b/sdk/trace/span_test.go @@ -16,6 +16,7 @@ package trace import ( "bytes" + "context" "fmt" "testing" @@ -243,3 +244,31 @@ func TestTruncateAttr(t *testing.T) { }) } } + +func BenchmarkRecordingSpanSetAttributes(b *testing.B) { + var attrs []attribute.KeyValue + for i := 0; i < 100; i++ { + attr := attribute.String(fmt.Sprintf("hello.attrib%d", i), fmt.Sprintf("goodbye.attrib%d", i)) + attrs = append(attrs, attr) + } + + ctx := context.Background() + for _, limit := range []bool{false, true} { + b.Run(fmt.Sprintf("WithLimit/%t", limit), func(b *testing.B) { + b.ReportAllocs() + sl := NewSpanLimits() + if limit { + sl.AttributeCountLimit = 50 + } + tp := NewTracerProvider(WithSampler(AlwaysSample()), WithSpanLimits(sl)) + tracer := tp.Tracer("tracer") + + b.ResetTimer() + for n := 0; n < b.N; n++ { + _, span := tracer.Start(ctx, "span") + span.SetAttributes(attrs...) + span.End() + } + }) + } +} From 5ed29d917efe2535052207d789af5047700f37ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 14 Jan 2024 16:55:32 +0100 Subject: [PATCH 811/886] Bump lycheeverse/lychee-action from 1.9.0 to 1.9.1 (#4824) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.9.0 to 1.9.1. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.9.0...v1.9.1) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index ddd893be029..c69d4b1263b 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v4 - name: Link Checker - uses: lycheeverse/lychee-action@v1.9.0 + uses: lycheeverse/lychee-action@v1.9.1 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 2ed252a5e9a..2434706afbd 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.9.0 + uses: lycheeverse/lychee-action@v1.9.1 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 237ed3796b40647cea0cca1ed4420cba65670869 Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Tue, 16 Jan 2024 14:06:37 +0100 Subject: [PATCH 812/886] Fix link changes from instrumentation to languages (#4828) --- README.md | 2 +- RELEASING.md | 6 +++--- doc.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2c5b0cc28ab..44e1bfc9b5e 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ are made for those systems currently. ## Getting Started -You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/). +You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/). OpenTelemetry's goal is to provide a single set of APIs to capture distributed traces and metrics from your application and send them to an observability diff --git a/RELEASING.md b/RELEASING.md index 82ce3ee46a1..d2691d0bd8b 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -123,12 +123,12 @@ Once verified be sure to [make a release for the `contrib` repository](https://g ### Website Documentation -Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go]. +Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go]. Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate. [OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions -[Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/ -[content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go +[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/ +[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go ### Demo Repository diff --git a/doc.go b/doc.go index daa36c89dc6..36d7c24e88e 100644 --- a/doc.go +++ b/doc.go @@ -22,7 +22,7 @@ transmitted anywhere. An implementation of the OpenTelemetry SDK, like the default SDK implementation (go.opentelemetry.io/otel/sdk), and associated exporters are used to process and transport this data. -To read the getting started guide, see https://opentelemetry.io/docs/go/getting-started/. +To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/. To read more about tracing, see go.opentelemetry.io/otel/trace. From 279c549cabf6c9b21b074f35d34634d3190f2343 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:24:10 -0600 Subject: [PATCH 813/886] Release v1.22.0/v0.45.0 (#4821) * Update to v1.22.0 * Prepare stable-v1 for version v1.22.0 * Prepare experimental-metrics for version v0.45.0 --- CHANGELOG.md | 7 +++++-- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 34 files changed, 128 insertions(+), 125 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1603a98c621..fe670d79cc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.22.0/0.45.0] 2024-01-17 + ### Added - The `go.opentelemetry.io/otel/semconv/v1.22.0` package. @@ -44,6 +46,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772) - Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776) - Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804) +- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) ## [1.21.0/0.44.0] 2023-11-16 @@ -58,7 +61,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719) - Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719) -- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742) ## [1.20.0/0.43.0] 2023-11-10 @@ -2773,7 +2775,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.21.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.22.0...HEAD +[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 [1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 [1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 [1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 6e87574ce00..06827b4ef46 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 2b426635e37..05eeac06ccd 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/bridge/opencensus v0.44.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/bridge/opencensus v0.45.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 8fb56844e65..99ef20e621d 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "0.44.0" + return "0.45.0" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 2afd00f8f9d..266b0c550e5 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 2338869a2ba..eaff28a97bf 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/bridge/opentracing v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/bridge/opentracing v1.22.0 google.golang.org/grpc v1.60.1 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index fb9f0987c9e..274a471c241 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 - go.opentelemetry.io/otel/metric v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 + go.opentelemetry.io/otel/metric v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index f46836e7b0b..e960990c32e 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 0254e0f84ba..1afd24c6476 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/bridge/opencensus v0.44.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.44.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/bridge/opencensus v0.45.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 85c799432ff..e4966d6db02 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 google.golang.org/grpc v1.60.1 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index cb7c4d4a7bf..8d719b1cf2e 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 08c8cd0004c..ca78c73575e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/prometheus v0.44.0 - go.opentelemetry.io/otel/metric v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/prometheus v0.45.0 + go.opentelemetry.io/otel/metric v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 ) require ( @@ -19,8 +19,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/sdk v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 77d1d935e54..343ef8bea6f 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/zipkin v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/zipkin v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 57b60194bf7..5773927079b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 google.golang.org/grpc v1.60.1 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index 983968c6a3b..60096200d39 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "0.44.0" + return "0.45.0" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 2a1a058a96b..a2dcc932c91 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 59d7c1c2cb9..59d3064ce17 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "0.44.0" + return "0.45.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e59e0ef651f..e1d215c4ccb 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.32.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 4fdcebb65a4..a4ebc82fefb 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 9ea2ab60027..339f1274295 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 8ee285b8d52..3b3bc35911b 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.21.0" + return "1.22.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index fd35cada775..3cef1563fc0 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/metric v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/metric v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 google.golang.org/protobuf v1.32.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 382deb64e8d..c5a76ca0b55 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/sdk/metric v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/sdk/metric v1.22.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 834ed3ee191..56235f790da 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index c3fb870f231..8f57386a221 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 043f5e84822..160090239d8 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel/metric v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 0d647604b44..d42c6a4ee2b 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel v1.22.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index d66f7d1e91f..d6bfb9edae7 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/trace v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/trace v1.22.0 golang.org/x/sys v0.16.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index bccc2caf9a8..f4e01e40c38 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 - go.opentelemetry.io/otel/metric v1.21.0 - go.opentelemetry.io/otel/sdk v1.21.0 + go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel/metric v1.22.0 + go.opentelemetry.io/otel/sdk v1.22.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index edcf7cfc862..d30a7d1c15a 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.21.0" + return "1.22.0" } diff --git a/sdk/version.go b/sdk/version.go index 422d4c964b3..17b16cc7966 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.21.0" + return "1.22.0" } diff --git a/trace/go.mod b/trace/go.mod index 4dda77a8cb4..4c51d9ad59c 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.21.0 + go.opentelemetry.io/otel v1.22.0 ) require ( diff --git a/version.go b/version.go index e2f743585d1..c7aba1c3f44 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.21.0" + return "1.22.0" } diff --git a/versions.yaml b/versions.yaml index 3c153c9d6fc..a9cfb80ae5c 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.21.0 + version: v1.22.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opentracing @@ -34,7 +34,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.44.0 + version: v0.45.0 modules: - go.opentelemetry.io/otel/bridge/opencensus - go.opentelemetry.io/otel/bridge/opencensus/test From cf93d0db6518aa76c0c159d258248004b4c64203 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:30:45 -0600 Subject: [PATCH 814/886] Add @dashpole (David Ashpole) as a maintainer (#4830) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add David Ashpole as a maintainer * Sort the maintiners by surname. Co-authored-by: Robert Pająk --------- Co-authored-by: Robert Pająk --- CODEOWNERS | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 623740007d4..31d336d9222 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,4 +14,4 @@ * @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu -CODEOWNERS @MrAlias @MadVikingGod @pellared \ No newline at end of file +CODEOWNERS @MrAlias @MadVikingGod @pellared @dashpole \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31857a61738..c9f2bac55bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -617,13 +617,13 @@ should be canceled. - [Evan Torrie](https://github.com/evantorrie), Verizon Media - [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics -- [David Ashpole](https://github.com/dashpole), Google - [Chester Cheung](https://github.com/hanyuancheung), Tencent - [Damien Mathieu](https://github.com/dmathieu), Elastic - [Anthony Mirabella](https://github.com/Aneurysm9), AWS ### Maintainers +- [David Ashpole](https://github.com/dashpole), Google - [Aaron Clawson](https://github.com/MadVikingGod), LightStep - [Robert Pająk](https://github.com/pellared), Splunk - [Tyler Yahn](https://github.com/MrAlias), Splunk From 8f2bdf85ed99c6532b8c76688e7ffcf9e48c3e6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:59:25 -0800 Subject: [PATCH 815/886] Bump golang.org/x/tools from 0.16.1 to 0.17.0 in /internal/tools (#4825) Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.16.1 to 0.17.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.16.1...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- internal/tools/go.mod | 8 ++++---- internal/tools/go.sum | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index b18016252c5..4b976fc83b0 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.16.1 + golang.org/x/tools v0.17.0 golang.org/x/vuln v1.0.1 ) @@ -201,11 +201,11 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.17.0 // indirect + golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sync v0.5.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sync v0.6.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.32.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index ced5cf4deba..66f9ab4386a 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -660,8 +660,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -753,8 +753,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -778,8 +778,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -850,7 +850,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -938,8 +938,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 1e2555f380119f50f36ecdb5ce7a1f7c6f928f3d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 18 Jan 2024 12:26:17 -0800 Subject: [PATCH 816/886] Release v1.23.0-rc.1 (#4832) * Update versions.yaml Move experimental-metrics modules that are stbilizing to the stable-v1 module-set. * Prepare stable-v1 for version v1.23.0-rc.1 * Update changelog --- CHANGELOG.md | 17 ++++++++++++++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 10 +++++----- example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 14 +++++++------- 34 files changed, 143 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe670d79cc2..216d1297f32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,20 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.23.0-rc.1] 2024-01-18 + +This is a release candidate for the v1.23.0 release. +That release is expected to include the `v1` release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ## [1.22.0/0.45.0] 2024-01-17 ### Added @@ -2775,7 +2789,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.22.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.0-rc.1...HEAD +[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 [1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 [1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 [1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 06827b4ef46..4fa97f7e707 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 05eeac06ccd..28216355549 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/bridge/opencensus v0.45.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 99ef20e621d..a42ef920028 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "0.45.0" + return "1.23.0-rc.1" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 266b0c550e5..98bdc956b0d 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index eaff28a97bf..0717cdb9dbf 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/bridge/opentracing v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/bridge/opentracing v1.23.0-rc.1 google.golang.org/grpc v1.60.1 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index 274a471c241..8e3edfb0702 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 - go.opentelemetry.io/otel/metric v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 + go.opentelemetry.io/otel/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index e960990c32e..cb5d9c7fdc0 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 1afd24c6476..4edd1bed577 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/bridge/opencensus v0.45.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.45.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/bridge/opencensus v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e4966d6db02..ce5cc68673c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 google.golang.org/grpc v1.60.1 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 8d719b1cf2e..b6083e0361f 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index ca78c73575e..b77582bf2d2 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/exporters/prometheus v0.45.0 - go.opentelemetry.io/otel/metric v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 ) require ( @@ -19,8 +19,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/sdk v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 343ef8bea6f..c53409024a8 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/zipkin v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/zipkin v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 5773927079b..dc47b0ffc17 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 google.golang.org/grpc v1.60.1 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index 60096200d39..6f1dfc9e9f0 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "0.45.0" + return "1.23.0-rc.1" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index a2dcc932c91..ad49cc73789 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 59d3064ce17..0cf47937c05 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "0.45.0" + return "1.23.0-rc.1" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index e1d215c4ccb..487607ee5c8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/protobuf v1.32.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index a4ebc82fefb..31e5be6fdf9 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 339f1274295..5e24d12e208 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.0.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 3b3bc35911b..7364f4385bd 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.22.0" + return "1.23.0-rc.1" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3cef1563fc0..3d54dcdf8c2 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/metric v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 google.golang.org/protobuf v1.32.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index c5a76ca0b55..01648f480a8 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/sdk/metric v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 56235f790da..58a160c706d 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 8f57386a221..758ddc9142c 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 160090239d8..1cc29d78f85 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index d42c6a4ee2b..b520e155824 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index d6bfb9edae7..1086655bd02 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/trace v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 golang.org/x/sys v0.16.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index f4e01e40c38..f41f6636be7 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,15 +6,15 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 - go.opentelemetry.io/otel/metric v1.22.0 - go.opentelemetry.io/otel/sdk v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel/metric v1.23.0-rc.1 + go.opentelemetry.io/otel/sdk v1.23.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/version.go b/sdk/metric/version.go index d30a7d1c15a..a0dd6dd6509 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.22.0" + return "1.23.0-rc.1" } diff --git a/sdk/version.go b/sdk/version.go index 17b16cc7966..91a9a99a9d0 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.22.0" + return "1.23.0-rc.1" } diff --git a/trace/go.mod b/trace/go.mod index 4c51d9ad59c..b03d03cf202 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.22.0 + go.opentelemetry.io/otel v1.23.0-rc.1 ) require ( diff --git a/version.go b/version.go index c7aba1c3f44..1ed52e2e20c 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.22.0" + return "1.23.0-rc.1" } diff --git a/versions.yaml b/versions.yaml index a9cfb80ae5c..058e515c8ca 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,19 +14,25 @@ module-sets: stable-v1: - version: v1.22.0 + version: v1.23.0-rc.1 modules: - go.opentelemetry.io/otel + - go.opentelemetry.io/otel/bridge/opencensus + - go.opentelemetry.io/otel/bridge/opencensus/test - go.opentelemetry.io/otel/bridge/opentracing - go.opentelemetry.io/otel/bridge/opentracing/test - go.opentelemetry.io/otel/example/dice - go.opentelemetry.io/otel/example/namedtracer + - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/otel-collector - go.opentelemetry.io/otel/example/passthrough - go.opentelemetry.io/otel/example/zipkin + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc + - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/otlp/otlptrace - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp + - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric - go.opentelemetry.io/otel/exporters/stdout/stdouttrace - go.opentelemetry.io/otel/exporters/zipkin - go.opentelemetry.io/otel/metric @@ -36,14 +42,8 @@ module-sets: experimental-metrics: version: v0.45.0 modules: - - go.opentelemetry.io/otel/bridge/opencensus - - go.opentelemetry.io/otel/bridge/opencensus/test - - go.opentelemetry.io/otel/example/opencensus - go.opentelemetry.io/otel/example/prometheus - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc - - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp - go.opentelemetry.io/otel/exporters/prometheus - - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric experimental-schema: version: v0.0.7 modules: From 8778c388326258206688f283fbe38ccccc9edd7f Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Fri, 19 Jan 2024 06:18:16 -0800 Subject: [PATCH 817/886] docs: minor update to docstring (#4833) Signed-off-by: Alex Boten --- attribute/set.go | 2 +- exporters/otlp/otlptrace/exporter.go | 2 +- exporters/stdout/stdouttrace/trace.go | 2 +- exporters/zipkin/zipkin.go | 2 +- sdk/resource/resource.go | 2 +- sdk/trace/batch_span_processor.go | 2 +- sdk/trace/provider.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/attribute/set.go b/attribute/set.go index 7e6765b06b7..fb6da51450c 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -427,7 +427,7 @@ func (l *Set) MarshalJSON() ([]byte, error) { return json.Marshal(l.equivalent.iface) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Set. func (l Set) MarshalLog() interface{} { kvs := make(map[string]string) for _, kv := range l.ToSlice() { diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index b46a38d60ab..cb41c7d58f2 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -104,7 +104,7 @@ func NewUnstarted(client Client) *Exporter { } } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/exporters/stdout/stdouttrace/trace.go b/exporters/stdout/stdouttrace/trace.go index 21658151075..4998d777449 100644 --- a/exporters/stdout/stdouttrace/trace.go +++ b/exporters/stdout/stdouttrace/trace.go @@ -107,7 +107,7 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return nil } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 751e9e3191a..2708e4612e5 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -190,7 +190,7 @@ func (e *Exporter) errf(format string, args ...interface{}) error { return fmt.Errorf(format, args...) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Exporter. func (e *Exporter) MarshalLog() interface{} { return struct { Type string diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 176ff106668..8c69ba25a4f 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -98,7 +98,7 @@ func (r *Resource) String() string { return r.attrs.Encoded(attribute.DefaultEncoder()) } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Resource. func (r *Resource) MarshalLog() interface{} { return struct { Attributes attribute.Set diff --git a/sdk/trace/batch_span_processor.go b/sdk/trace/batch_span_processor.go index c9c7effbf38..fca26f2e70e 100644 --- a/sdk/trace/batch_span_processor.go +++ b/sdk/trace/batch_span_processor.go @@ -406,7 +406,7 @@ func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd ReadOnlySpan) return false } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (bsp *batchSpanProcessor) MarshalLog() interface{} { return struct { Type string diff --git a/sdk/trace/provider.go b/sdk/trace/provider.go index 7d46c4b48e5..b1ac608464a 100644 --- a/sdk/trace/provider.go +++ b/sdk/trace/provider.go @@ -55,7 +55,7 @@ type tracerProviderConfig struct { resource *resource.Resource } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Provider. func (cfg tracerProviderConfig) MarshalLog() interface{} { return struct { SpanProcessors []SpanProcessor From 33f5cf460bc0a2e4648e5f3fd8f2e4faa79ddb0e Mon Sep 17 00:00:00 2001 From: Damien Mathieu Date: Fri, 19 Jan 2024 15:25:10 +0100 Subject: [PATCH 818/886] Add WithEndpointURL option to OTLP over HTTP exporters (#4808) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Pająk --- CHANGELOG.md | 4 ++ .../otlpmetric/otlpmetricgrpc/client_test.go | 14 +++++++ .../otlp/otlpmetric/otlpmetricgrpc/config.go | 23 +++++++++++ .../otlp/otlpmetric/otlpmetricgrpc/doc.go | 2 +- .../otlpmetricgrpc/internal/oconf/options.go | 20 ++++++++++ .../internal/oconf/options_test.go | 36 +++++++++++++++++ .../otlpmetric/otlpmetrichttp/client_test.go | 14 +++++++ .../otlp/otlpmetric/otlpmetrichttp/config.go | 20 ++++++++++ .../otlp/otlpmetric/otlpmetrichttp/doc.go | 4 +- .../otlpmetrichttp/internal/oconf/options.go | 20 ++++++++++ .../internal/oconf/options_test.go | 36 +++++++++++++++++ .../otlptrace/otlptracegrpc/client_test.go | 18 +++++++++ exporters/otlp/otlptrace/otlptracegrpc/doc.go | 2 +- .../internal/otlpconfig/options.go | 20 ++++++++++ .../internal/otlpconfig/options_test.go | 36 +++++++++++++++++ .../otlp/otlptrace/otlptracegrpc/options.go | 34 +++++++++++++++- .../otlptrace/otlptracehttp/client_test.go | 21 +++++++--- exporters/otlp/otlptrace/otlptracehttp/doc.go | 4 +- .../internal/otlpconfig/options.go | 20 ++++++++++ .../internal/otlpconfig/options_test.go | 36 +++++++++++++++++ .../otlp/otlptrace/otlptracehttp/options.go | 39 ++++++++++++++++--- .../otlp/otlpmetric/oconf/options.go.tmpl | 20 ++++++++++ .../otlpmetric/oconf/options_test.go.tmpl | 36 +++++++++++++++++ .../otlp/otlptrace/otlpconfig/options.go.tmpl | 20 ++++++++++ .../otlptrace/otlpconfig/options_test.go.tmpl | 36 +++++++++++++++++ 25 files changed, 516 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 216d1297f32..e175f445b38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) + ## [1.23.0-rc.1] 2024-01-18 This is a release candidate for the v1.23.0 release. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index 03f07d69991..109d5e5a030 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -199,6 +199,20 @@ func TestConfig(t *testing.T) { return exp, coll } + t.Run("WithEndpointURL", func(t *testing.T) { + coll, err := otest.NewGRPCCollector("", nil) + require.NoError(t, err) + t.Cleanup(coll.Shutdown) + + ctx := context.Background() + exp, err := New(ctx, WithEndpointURL("http://"+coll.Addr().String())) + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) + t.Run("WithHeaders", func(t *testing.T) { key := "my-custom-header" headers := map[string]string{key: "custom-value"} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go index fbd495e7d7d..9269f5a01b7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/config.go @@ -80,6 +80,9 @@ func WithInsecure() Option { // value will be used. If both are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT // will take precedence. // +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// // By default, if an environment variable is not set, and this option is not // passed, "localhost:4317" will be used. // @@ -88,6 +91,26 @@ func WithEndpoint(endpoint string) Option { return wrappedOption{oconf.WithEndpoint(endpoint)} } +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{oconf.WithEndpointURL(u)} +} + // WithReconnectionPeriod set the minimum amount of time between connection // attempts to the target endpoint. // diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go index 7be572a79d0..48e63689e00 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/doc.go @@ -28,7 +28,7 @@ The value may additionally a port, a scheme, and a path. The value accepts "http" and "https" scheme. The value should not contain a query string or fragment. OTEL_EXPORTER_OTLP_METRICS_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. -The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithGRPCConn] options. OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_METRICS_INSECURE (default: "false") - setting "true" disables client transport security for the exporter's gRPC connection. diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go index a85f2712224..e2d99dc22c1 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -20,6 +20,7 @@ package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlp import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -31,6 +32,7 @@ import ( "google.golang.org/grpc/encoding/gzip" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/retry" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -279,6 +281,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlpmetric: parse endpoint url", "url", v) + return cfg + } + + cfg.Metrics.Endpoint = u.Host + cfg.Metrics.URLPath = u.Path + if u.Scheme != "https" { + cfg.Metrics.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Metrics.Compression = compression diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go index 64457efbf08..b4631fb22c0 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go @@ -102,6 +102,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Metrics.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, "/v1/metrics", c.Metrics.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index a4ead01c1f1..f631c49fe2e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -107,6 +107,20 @@ func TestConfig(t *testing.T) { return exp, coll } + t.Run("WithEndpointURL", func(t *testing.T) { + coll, err := otest.NewHTTPCollector("", nil) + require.NoError(t, err) + ctx := context.Background() + + exp, err := New(ctx, WithEndpointURL("http://"+coll.Addr().String())) + require.NoError(t, err) + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + t.Cleanup(func() { require.NoError(t, exp.Shutdown(ctx)) }) + + assert.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) + assert.Len(t, coll.Collect().Dump(), 1) + }) + t.Run("WithHeaders", func(t *testing.T) { key := http.CanonicalHeaderKey("my-custom-header") headers := map[string]string{key: "custom-value"} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go index 6eae3e1bbda..5948e2d9d73 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -76,6 +76,26 @@ func WithEndpoint(endpoint string) Option { return wrappedOption{oconf.WithEndpoint(endpoint)} } +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{oconf.WithEndpointURL(u)} +} + // WithCompression sets the compression strategy the Exporter will use to // compress the HTTP body. // diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go index 94f8b250d3f..a707b5ebb71 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/doc.go @@ -26,14 +26,14 @@ The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. The configuration can be overridden by OTEL_EXPORTER_OTLP_METRICS_ENDPOINT -environment variable and by [WithEndpoint], [WithInsecure] options. +environment variable and by [WithEndpoint], [WithEndpointURL], and [WithInsecure] options. OTEL_EXPORTER_OTLP_METRICS_ENDPOINT (default: "https://localhost:4318/v1/metrics") - target URL to which the exporter sends telemetry. The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. -The configuration can be overridden by [WithEndpoint], [WitnInsecure], [WithURLPath] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options. OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS (default: none) - key-value pairs used as headers associated with HTTP requests. diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go index 59468b9a5ed..253539d7a3c 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -20,6 +20,7 @@ package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlp import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -31,6 +32,7 @@ import ( "google.golang.org/grpc/encoding/gzip" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/retry" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -279,6 +281,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlpmetric: parse endpoint url", "url", v) + return cfg + } + + cfg.Metrics.Endpoint = u.Host + cfg.Metrics.URLPath = u.Path + if u.Scheme != "https" { + cfg.Metrics.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Metrics.Compression = compression diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go index 1da4a6f2f63..c20869e60e8 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go @@ -102,6 +102,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Metrics.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, "/v1/metrics", c.Metrics.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index aa531eb926e..d0d06506d06 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -97,6 +97,24 @@ func TestNewEndToEnd(t *testing.T) { } } +func TestWithEndpointURL(t *testing.T) { + mc := runMockCollector(t) + + ctx := context.Background() + exp := newGRPCExporter(t, ctx, "", []otlptracegrpc.Option{ + otlptracegrpc.WithEndpointURL("http://" + mc.endpoint), + }...) + t.Cleanup(func() { + ctx, cancel := contextWithTimeout(ctx, t, 10*time.Second) + defer cancel() + + require.NoError(t, exp.Shutdown(ctx)) + }) + + // RunEndToEndTest closes mc. + otlptracetest.RunEndToEndTest(ctx, t, exp, mc) +} + func newGRPCExporter(t *testing.T, ctx context.Context, endpoint string, additionalOpts ...otlptracegrpc.Option) *otlptrace.Exporter { opts := []otlptracegrpc.Option{ otlptracegrpc.WithInsecure(), diff --git a/exporters/otlp/otlptrace/otlptracegrpc/doc.go b/exporters/otlp/otlptrace/otlptracegrpc/doc.go index 1f514ef9ea3..a3c2690c5d0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/doc.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/doc.go @@ -28,7 +28,7 @@ The value may additionally a port, a scheme, and a path. The value accepts "http" and "https" scheme. The value should not contain a query string or fragment. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT takes precedence over OTEL_EXPORTER_OTLP_ENDPOINT. -The configuration can be overridden by [WithEndpoint], [WithInsecure], [WithGRPCConn] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WithInsecure], and [WithGRPCConn] options. OTEL_EXPORTER_OTLP_INSECURE, OTEL_EXPORTER_OTLP_TRACES_INSECURE (default: "false") - setting "true" disables client transport security for the exporter's gRPC connection. diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index dddb1f334de..f0203cbe723 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -20,6 +20,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -32,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -265,6 +267,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go index 567f12f1018..254d38bef49 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go @@ -100,6 +100,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Traces.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, "/v1/traces", c.Traces.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 17ffeaf6ef0..0fddac75895 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -64,14 +64,44 @@ func WithInsecure() Option { return wrappedOption{otlpconfig.WithInsecure()} } -// WithEndpoint sets the target endpoint the exporter will connect to. If -// unset, localhost:4317 will be used as a default. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. // // This option has no effect if WithGRPCConn is used. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } +// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{otlpconfig.WithEndpointURL(u)} +} + // WithReconnectionPeriod set the minimum amount of time between connection // attempts to the target endpoint. // diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index 63a4cd4f207..73bd3efaedd 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -51,15 +51,20 @@ var ( func TestEndToEnd(t *testing.T) { tests := []struct { - name string - opts []otlptracehttp.Option - mcCfg mockCollectorConfig - tls bool + name string + opts []otlptracehttp.Option + mcCfg mockCollectorConfig + tls bool + withURLEndpoint bool }{ { name: "no extra options", opts: nil, }, + { + name: "with URL endpoint", + withURLEndpoint: true, + }, { name: "with gzip compression", opts: []otlptracehttp.Option{ @@ -162,8 +167,12 @@ func TestEndToEnd(t *testing.T) { t.Run(tc.name, func(t *testing.T) { mc := runMockCollector(t, tc.mcCfg) defer mc.MustStop(t) - allOpts := []otlptracehttp.Option{ - otlptracehttp.WithEndpoint(mc.Endpoint()), + allOpts := []otlptracehttp.Option{} + + if tc.withURLEndpoint { + allOpts = append(allOpts, otlptracehttp.WithEndpointURL("http://"+mc.Endpoint())) + } else { + allOpts = append(allOpts, otlptracehttp.WithEndpoint(mc.Endpoint())) } if tc.tls { tlsConfig := mc.ClientTLSConfig() diff --git a/exporters/otlp/otlptrace/otlptracehttp/doc.go b/exporters/otlp/otlptrace/otlptracehttp/doc.go index 854cc38c8e4..cb4f19ad16b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/doc.go +++ b/exporters/otlp/otlptrace/otlptracehttp/doc.go @@ -26,14 +26,14 @@ The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. The configuration can be overridden by OTEL_EXPORTER_OTLP_TRACES_ENDPOINT -environment variable and by [WithEndpoint], [WithInsecure] options. +environment variable and by [WithEndpoint], [WithEndpointURL], [WithInsecure] options. OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (default: "https://localhost:4318/v1/traces") - target URL to which the exporter sends telemetry. The value must contain a scheme ("http" or "https") and host. The value may additionally contain a port and a path. The value should not contain a query string or fragment. -The configuration can be overridden by [WithEndpoint], [WitnInsecure], [WithURLPath] options. +The configuration can be overridden by [WithEndpoint], [WithEndpointURL], [WitnInsecure], and [WithURLPath] options. OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS (default: none) - key-value pairs used as headers associated with HTTP requests. diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go index 8401bd7f155..3b81641a764 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go @@ -20,6 +20,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -32,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/retry" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -265,6 +267,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go index 4c7a525a996..91d59985286 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go @@ -100,6 +100,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Traces.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, "/v1/traces", c.Traces.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index e3ed6494c5d..ea6b767a27f 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -60,15 +60,44 @@ func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config return w.ApplyHTTPOption(cfg) } -// WithEndpoint allows one to set the address of the collector -// endpoint that the driver will use to send spans. If -// unset, it will instead try to use -// the default endpoint (localhost:4318). Note that the endpoint -// must not contain any URL path. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpointURL are used, the last used option will +// take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } +// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// +// If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT +// environment variable is set, and this option is not passed, that variable +// value will be used. If both are set, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT +// will take precedence. +// +// If both this option and WithEndpoint are used, the last used option will +// take precedence. +// +// If an invalid URL is provided, the default value will be kept. +// +// By default, if an environment variable is not set, and this option is not +// passed, "localhost:4317" will be used. +// +// This option has no effect if WithGRPCConn is used. +func WithEndpointURL(u string) Option { + return wrappedOption{otlpconfig.WithEndpointURL(u)} +} + // WithCompression tells the driver to compress the sent data. func WithCompression(compression Compression) Option { return wrappedOption{otlpconfig.WithCompression(otlpconfig.Compression(compression))} diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl index c4f9d0830f4..8fb706f76c9 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -20,6 +20,7 @@ package oconf import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -31,6 +32,7 @@ import ( "google.golang.org/grpc/encoding/gzip" "{{ .retryImportPath }}" + "go.opentelemetry.io/otel/internal/global" "go.opentelemetry.io/otel/sdk/metric" ) @@ -279,6 +281,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlpmetric: parse endpoint url", "url", v) + return cfg + } + + cfg.Metrics.Endpoint = u.Host + cfg.Metrics.URLPath = u.Path + if u.Scheme != "https" { + cfg.Metrics.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Metrics.Compression = compression diff --git a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl index 7c52efc51d9..abd12c80ca7 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl @@ -102,6 +102,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Metrics.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, true, c.Metrics.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Metrics.Endpoint) + assert.Equal(t, "/somepath", c.Metrics.URLPath) + assert.Equal(t, false, c.Metrics.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Metrics.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Metrics.Endpoint) + } + assert.Equal(t, "/v1/metrics", c.Metrics.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl index 9270e506a9c..1d5613c44fd 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl @@ -20,6 +20,7 @@ package otlpconfig import ( "crypto/tls" "fmt" + "net/url" "path" "strings" "time" @@ -32,6 +33,7 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "{{ .retryImportPath }}" + "go.opentelemetry.io/otel/internal/global" ) const ( @@ -265,6 +267,24 @@ func WithEndpoint(endpoint string) GenericOption { }) } +func WithEndpointURL(v string) GenericOption { + return newGenericOption(func(cfg Config) Config { + u, err := url.Parse(v) + if err != nil { + global.Error(err, "otlptrace: parse endpoint url", "url", v) + return cfg + } + + cfg.Traces.Endpoint = u.Host + cfg.Traces.URLPath = u.Path + if u.Scheme != "https" { + cfg.Traces.Insecure = true + } + + return cfg + }) +} + func WithCompression(compression Compression) GenericOption { return newGenericOption(func(cfg Config) Config { cfg.Traces.Compression = compression diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl index b83891a89f6..8b614b0c47b 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl @@ -100,6 +100,42 @@ func TestConfigs(t *testing.T) { assert.Equal(t, "someendpoint", c.Traces.Endpoint) }, }, + { + name: "Test With Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("http://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, true, c.Traces.Insecure) + }, + }, + { + name: "Test With Secure Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("https://someendpoint/somepath"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Equal(t, "someendpoint", c.Traces.Endpoint) + assert.Equal(t, "/somepath", c.Traces.URLPath) + assert.Equal(t, false, c.Traces.Insecure) + }, + }, + { + name: "Test With Invalid Endpoint URL", + opts: []GenericOption{ + WithEndpointURL("%invalid"), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + if grpcOption { + assert.Equal(t, "localhost:4317", c.Traces.Endpoint) + } else { + assert.Equal(t, "localhost:4318", c.Traces.Endpoint) + } + assert.Equal(t, "/v1/traces", c.Traces.URLPath) + }, + }, { name: "Test Environment Endpoint", env: map[string]string{ From b20691d9a4d09c02133fa099bee0e87c698f1470 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 21 Jan 2024 07:54:08 -0800 Subject: [PATCH 819/886] Bump actions/cache from 3 to 4 (#4839) Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 18b5c1d6c3c..5786b0564fc 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -22,7 +22,7 @@ jobs: - name: Run benchmarks run: make benchmark | tee output.txt - name: Download previous benchmark data - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./benchmarks key: ${{ runner.os }}-benchmark diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02acf4e0475..87ef7e67508 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: check-latest: true cache-dependency-path: "**/go.sum" - name: Tools cache - uses: actions/cache@v3 + uses: actions/cache@v4 env: cache-name: go-tools-cache with: From c158b901244725b89d49d4e6d6a9372cb13d7703 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:03:41 -0800 Subject: [PATCH 820/886] Bump go.opentelemetry.io/proto/otlp (#4837) Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 12 ++++----- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 27 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index dc47b0ffc17..6cdd6cc91e7 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -11,8 +11,8 @@ require ( go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 - go.opentelemetry.io/proto/otlp v1.0.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 + go.opentelemetry.io/proto/otlp v1.1.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -22,16 +22,16 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 6c41cd7b22f..a0973b17eac 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -8,15 +8,14 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -26,20 +25,20 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From f0ea8b76f66a757baf32b307982f7b14b50ca783 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:10:00 -0800 Subject: [PATCH 821/886] Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#4844) Bumps [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.46.1 to 0.47.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.46.1...zpages/v0.47.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/dice/go.mod b/example/dice/go.mod index 8e3edfb0702..5b2ce015e6c 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/dice go 1.20 require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0-rc.1 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 diff --git a/example/dice/go.sum b/example/dice/go.sum index 98b582ca643..8be4f4bfc02 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -9,8 +9,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 71d2b4149711a6eb0d061b664072260f80f02404 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:16:15 -0800 Subject: [PATCH 822/886] Bump go.opentelemetry.io/proto/otlp (#4838) Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 12 ++++----- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 27 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index ad49cc73789..114e261146b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -11,7 +11,7 @@ require ( go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 - go.opentelemetry.io/proto/otlp v1.0.0 + go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -21,17 +21,17 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 6c41cd7b22f..a0973b17eac 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -8,15 +8,14 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -26,20 +25,20 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From edb9b2b87317f63f3bb3b5757b0f1d2cce6cbb5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:33:02 -0800 Subject: [PATCH 823/886] Bump go.opentelemetry.io/proto/otlp from 1.0.0 to 1.1.0 in /exporters/otlp/otlptrace/otlptracegrpc (#4842) * Bump go.opentelemetry.io/proto/otlp Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Run go mod tidy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- example/otel-collector/go.mod | 12 ++++----- example/otel-collector/go.sum | 27 +++++++++---------- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 12 ++++----- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 27 +++++++++---------- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index ce5cc68673c..e3bb6ec5f33 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -20,15 +20,15 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/proto/otlp v1.0.0 // indirect - golang.org/x/net v0.17.0 // indirect + go.opentelemetry.io/proto/otlp v1.1.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index e591845f7e1..07ef3c0add3 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -6,31 +6,30 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 31e5be6fdf9..b0dcf22e888 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -9,9 +9,9 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/trace v1.23.0-rc.1 - go.opentelemetry.io/proto/otlp v1.0.0 + go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -21,14 +21,14 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 583e1750640..471ffacf102 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -8,14 +8,13 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -24,22 +23,22 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From 3f74d77436a6cc1b463c100c8b40eb298046f08c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:39:16 -0800 Subject: [PATCH 824/886] Bump go.opentelemetry.io/proto/otlp from 1.0.0 to 1.1.0 in /exporters/otlp/otlptrace (#4841) * Bump go.opentelemetry.io/proto/otlp in /exporters/otlp/otlptrace Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v1.0.0...v1.1.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/proto/otlp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Run go mod tidy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 +-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 12 ++++----- exporters/otlp/otlptrace/otlptracehttp/go.sum | 27 +++++++++---------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 487607ee5c8..11da29b0356 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -8,7 +8,7 @@ require ( go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/trace v1.23.0-rc.1 - go.opentelemetry.io/proto/otlp v1.0.0 + go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index bb9d839f0af..6d12cac9adc 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -23,8 +23,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 5e24d12e208..ae9a1ed2bc2 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/trace v1.23.0-rc.1 - go.opentelemetry.io/proto/otlp v1.0.0 + go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 ) @@ -19,15 +19,15 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index d99cfbe7767..f1773891403 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -8,14 +8,13 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -24,20 +23,20 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= +go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 h1:YJ5pD9rF8o9Qtta0Cmy9rdBwkSjrTCT6XTiUQVOtIos= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1:rcS6EyEaoCO52hQDupoSfrxI3R6C2Tq741is7X8OvnM= +google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= From 71d13ffc2a2a717d04349cae1f0985b43b7eb253 Mon Sep 17 00:00:00 2001 From: Baptiste Girard-Carrabin Date: Tue, 23 Jan 2024 22:04:46 +0100 Subject: [PATCH 825/886] Fix ContainerID detector on systemd with colon in cgroup path (#4449) Co-authored-by: David Ashpole --- CHANGELOG.md | 1 + sdk/resource/container.go | 2 +- sdk/resource/container_test.go | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e175f445b38..a97b9125ebe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -280,6 +280,7 @@ This release drops the compatibility guarantee of [Go 1.19]. - Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) - Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) - Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) ### Deprecated diff --git a/sdk/resource/container.go b/sdk/resource/container.go index c881b2895be..c1b47193fe7 100644 --- a/sdk/resource/container.go +++ b/sdk/resource/container.go @@ -29,7 +29,7 @@ type containerIDProvider func() (string, error) var ( containerID containerIDProvider = getContainerIDFromCGroup - cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`) + cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`) ) type cgroupContainerIDDetector struct{} diff --git a/sdk/resource/container_test.go b/sdk/resource/container_test.go index b09160da872..e4ec163fb8c 100644 --- a/sdk/resource/container_test.go +++ b/sdk/resource/container_test.go @@ -62,6 +62,11 @@ func TestGetContainerIDFromLine(t *testing.T) { line: " 13:name=systemd:/pod/d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356 ", expectedContainerID: "d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356", }, + { + name: "with colon", + line: " 13:name=systemd:/kuberuntime/containerd/kubepods-pod872d2066_00ef_48ea_a7d8_51b18b72d739:cri-containerd:e857a4bf05a69080a759574949d7a0e69572e27647800fa7faff6a05a8332aa1", + expectedContainerID: "e857a4bf05a69080a759574949d7a0e69572e27647800fa7faff6a05a8332aa1", + }, { name: "invalid hex string", line: "13:name=systemd:/podruntime/docker/kubepods/ac679f8a8319c8cf7d38e1adf263bc08d23zzzz", From cef39a1e17be88753801c6bf550f6f6fcd163c55 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 23 Jan 2024 14:15:04 -0800 Subject: [PATCH 826/886] Fix changelog entry (#4848) Move #4449 entry to unreleased. --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a97b9125ebe..3ba3bf091a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +### Fixed + +- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) + ## [1.23.0-rc.1] 2024-01-18 This is a release candidate for the v1.23.0 release. @@ -280,7 +284,6 @@ This release drops the compatibility guarantee of [Go 1.19]. - Do not append `_total` if the counter already has that suffix for the Prometheus exproter in `go.opentelemetry.io/otel/exporter/prometheus`. (#4373) - Fix resource detection data race in `go.opentelemetry.io/otel/sdk/resource`. (#4409) - Use the first-seen instrument name during instrument name conflicts in `go.opentelemetry.io/otel/sdk/metric`. (#4428) -- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) ### Deprecated From 1978044c55231dc2f1e5d423011d63b1bcc498f8 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 24 Jan 2024 10:42:43 -0500 Subject: [PATCH 827/886] Cache instruments so repeatedly creating identical instruments doesn't leak memory (#4820) * cache instruments to avoid leaking memory * add cacheWithErr to simplify error handling * add wanring on repeated obserbable instrument creation with callbacks * documentation for new behavior * address feedback --------- Co-authored-by: Damien Mathieu --- CHANGELOG.md | 1 + sdk/metric/cache.go | 40 +++++++++ sdk/metric/meter.go | 184 ++++++++++++++++++++++++++++----------- sdk/metric/meter_test.go | 109 +++++++++++++++++++++++ 4 files changed, 284 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ba3bf091a8..9f4f8d87c7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixed - Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) +- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) ## [1.23.0-rc.1] 2024-01-18 diff --git a/sdk/metric/cache.go b/sdk/metric/cache.go index de9d6f0019d..e9c0b38d0bc 100644 --- a/sdk/metric/cache.go +++ b/sdk/metric/cache.go @@ -52,3 +52,43 @@ func (c *cache[K, V]) Lookup(key K, f func() V) V { c.data[key] = val return val } + +// HasKey returns true if Lookup has previously been called with that key +// +// HasKey is safe to call concurrently. +func (c *cache[K, V]) HasKey(key K) bool { + c.Lock() + defer c.Unlock() + _, ok := c.data[key] + return ok +} + +// cacheWithErr is a locking storage used to quickly return already computed values and an error. +// +// The zero value of a cacheWithErr is empty and ready to use. +// +// A cacheWithErr must not be copied after first use. +// +// All methods of a cacheWithErr are safe to call concurrently. +type cacheWithErr[K comparable, V any] struct { + cache[K, valAndErr[V]] +} + +type valAndErr[V any] struct { + val V + err error +} + +// Lookup returns the value stored in the cacheWithErr with the associated key +// if it exists. Otherwise, f is called and its returned value is set in the +// cacheWithErr for key and returned. +// +// Lookup is safe to call concurrently. It will hold the cacheWithErr lock, so f +// should not block excessively. +func (c *cacheWithErr[K, V]) Lookup(key K, f func() (V, error)) (V, error) { + combined := c.cache.Lookup(key, func() valAndErr[V] { + val, err := f() + return valAndErr[V]{val: val, err: err} + }) + return combined.val, combined.err +} diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 76f1e70a3d1..88710563517 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -41,6 +41,11 @@ type meter struct { scope instrumentation.Scope pipes pipelines + int64Insts *cacheWithErr[instID, *int64Inst] + float64Insts *cacheWithErr[instID, *float64Inst] + int64ObservableInsts *cacheWithErr[instID, int64Observable] + float64ObservableInsts *cacheWithErr[instID, float64Observable] + int64Resolver resolver[int64] float64Resolver resolver[float64] } @@ -50,11 +55,20 @@ func newMeter(s instrumentation.Scope, p pipelines) *meter { // meter is asked to create are logged to the user. var viewCache cache[string, instID] + var int64Insts cacheWithErr[instID, *int64Inst] + var float64Insts cacheWithErr[instID, *float64Inst] + var int64ObservableInsts cacheWithErr[instID, int64Observable] + var float64ObservableInsts cacheWithErr[instID, float64Observable] + return &meter{ - scope: s, - pipes: p, - int64Resolver: newResolver[int64](p, &viewCache), - float64Resolver: newResolver[float64](p, &viewCache), + scope: s, + pipes: p, + int64Insts: &int64Insts, + float64Insts: &float64Insts, + int64ObservableInsts: &int64ObservableInsts, + float64ObservableInsts: &float64ObservableInsts, + int64Resolver: newResolver[int64](p, &viewCache), + float64Resolver: newResolver[float64](p, &viewCache), } } @@ -108,32 +122,48 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti // int64ObservableInstrument returns a new observable identified by the Instrument. // It registers callbacks for each reader's pipeline. func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int64Callback) (int64Observable, error) { - inst := newInt64Observable(m, id.Kind, id.Name, id.Description, id.Unit) - for _, insert := range m.int64Resolver.inserters { - // Connect the measure functions for instruments in this pipeline with the - // callbacks for this pipeline. - in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) - if err != nil { - return inst, err - } - // Drop aggregation - if len(in) == 0 { - inst.dropAggregation = true - continue - } - inst.appendMeasures(in) - for _, cback := range callbacks { - inst := int64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + key := instID{ + Name: id.Name, + Description: id.Description, + Unit: id.Unit, + Kind: id.Kind, + } + if m.int64ObservableInsts.HasKey(key) && len(callbacks) > 0 { + warnRepeatedObservableCallbacks(id) + } + return m.int64ObservableInsts.Lookup(key, func() (int64Observable, error) { + inst := newInt64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.int64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + inst.dropAggregation = true + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := int64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } } - } - return inst, validateInstrumentName(id.Name) + return inst, validateInstrumentName(id.Name) + }) } // Int64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing int64 measurements once per a measurement collection cycle. // Only the measurements recorded during the collection cycle are exported. +// +// If Int64ObservableCounter is invoked repeatedly with the same Name, +// Description, and Unit, only the first set of callbacks provided are used. +// Use meter.RegisterCallback and Registration.Unregister to manage callbacks +// if instrumentation can be created multiple times with different callbacks. func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) { cfg := metric.NewInt64ObservableCounterConfig(options...) id := Instrument{ @@ -225,32 +255,48 @@ func (m *meter) Float64Histogram(name string, options ...metric.Float64Histogram // float64ObservableInstrument returns a new observable identified by the Instrument. // It registers callbacks for each reader's pipeline. func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Float64Callback) (float64Observable, error) { - inst := newFloat64Observable(m, id.Kind, id.Name, id.Description, id.Unit) - for _, insert := range m.float64Resolver.inserters { - // Connect the measure functions for instruments in this pipeline with the - // callbacks for this pipeline. - in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) - if err != nil { - return inst, err - } - // Drop aggregation - if len(in) == 0 { - inst.dropAggregation = true - continue - } - inst.appendMeasures(in) - for _, cback := range callbacks { - inst := float64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + key := instID{ + Name: id.Name, + Description: id.Description, + Unit: id.Unit, + Kind: id.Kind, + } + if m.int64ObservableInsts.HasKey(key) && len(callbacks) > 0 { + warnRepeatedObservableCallbacks(id) + } + return m.float64ObservableInsts.Lookup(key, func() (float64Observable, error) { + inst := newFloat64Observable(m, id.Kind, id.Name, id.Description, id.Unit) + for _, insert := range m.float64Resolver.inserters { + // Connect the measure functions for instruments in this pipeline with the + // callbacks for this pipeline. + in, err := insert.Instrument(id, insert.readerDefaultAggregation(id.Kind)) + if err != nil { + return inst, err + } + // Drop aggregation + if len(in) == 0 { + inst.dropAggregation = true + continue + } + inst.appendMeasures(in) + for _, cback := range callbacks { + inst := float64Observer{measures: in} + insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + } } - } - return inst, validateInstrumentName(id.Name) + return inst, validateInstrumentName(id.Name) + }) } // Float64ObservableCounter returns a new instrument identified by name and // configured with options. The instrument is used to asynchronously record // increasing float64 measurements once per a measurement collection cycle. // Only the measurements recorded during the collection cycle are exported. +// +// If Float64ObservableCounter is invoked repeatedly with the same Name, +// Description, and Unit, only the first set of callbacks provided are used. +// Use meter.RegisterCallback and Registration.Unregister to manage callbacks +// if instrumentation can be created multiple times with different callbacks. func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) { cfg := metric.NewFloat64ObservableCounterConfig(options...) id := Instrument{ @@ -324,6 +370,16 @@ func isAlphanumeric(c rune) bool { return isAlpha(c) || ('0' <= c && c <= '9') } +func warnRepeatedObservableCallbacks(id Instrument) { + inst := fmt.Sprintf( + "Instrument{Name: %q, Description: %q, Kind: %q, Unit: %q}", + id.Name, id.Description, "InstrumentKind"+id.Kind.String(), id.Unit, + ) + global.Warn("Repeated observable instrument creation with callbacks. Ignoring new callbacks. Use meter.RegisterCallback and Registration.Unregister to manage callbacks.", + "instrument", inst, + ) +} + // RegisterCallback registers f to be called each collection cycle so it will // make observations for insts during those cycles. // @@ -529,14 +585,28 @@ func (p int64InstProvider) histogramAggs(name string, cfg metric.Int64HistogramC // lookup returns the resolved instrumentImpl. func (p int64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*int64Inst, error) { - aggs, err := p.aggs(kind, name, desc, u) - return &int64Inst{measures: aggs}, err + return p.meter.int64Insts.Lookup(instID{ + Name: name, + Description: desc, + Unit: u, + Kind: kind, + }, func() (*int64Inst, error) { + aggs, err := p.aggs(kind, name, desc, u) + return &int64Inst{measures: aggs}, err + }) } // lookupHistogram returns the resolved instrumentImpl. func (p int64InstProvider) lookupHistogram(name string, cfg metric.Int64HistogramConfig) (*int64Inst, error) { - aggs, err := p.histogramAggs(name, cfg) - return &int64Inst{measures: aggs}, err + return p.meter.int64Insts.Lookup(instID{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + }, func() (*int64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &int64Inst{measures: aggs}, err + }) } // float64InstProvider provides float64 OpenTelemetry instruments. @@ -573,14 +643,28 @@ func (p float64InstProvider) histogramAggs(name string, cfg metric.Float64Histog // lookup returns the resolved instrumentImpl. func (p float64InstProvider) lookup(kind InstrumentKind, name, desc, u string) (*float64Inst, error) { - aggs, err := p.aggs(kind, name, desc, u) - return &float64Inst{measures: aggs}, err + return p.meter.float64Insts.Lookup(instID{ + Name: name, + Description: desc, + Unit: u, + Kind: kind, + }, func() (*float64Inst, error) { + aggs, err := p.aggs(kind, name, desc, u) + return &float64Inst{measures: aggs}, err + }) } // lookupHistogram returns the resolved instrumentImpl. func (p float64InstProvider) lookupHistogram(name string, cfg metric.Float64HistogramConfig) (*float64Inst, error) { - aggs, err := p.histogramAggs(name, cfg) - return &float64Inst{measures: aggs}, err + return p.meter.float64Insts.Lookup(instID{ + Name: name, + Description: cfg.Description(), + Unit: cfg.Unit(), + Kind: InstrumentKindHistogram, + }, func() (*float64Inst, error) { + aggs, err := p.histogramAggs(name, cfg) + return &float64Inst{measures: aggs}, err + }) } type int64Observer struct { diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index d068ecd4bad..037f0cad555 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -2272,3 +2272,112 @@ func TestObservableDropAggregation(t *testing.T) { }) } } + +func TestDuplicateInstrumentCreation(t *testing.T) { + for _, tt := range []struct { + desc string + createInstrument func(metric.Meter) error + }{ + { + desc: "Int64ObservableCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64ObservableCounter("observable.int64.counter") + return err + }, + }, + { + desc: "Int64ObservableUpDownCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64ObservableUpDownCounter("observable.int64.up.down.counter") + return err + }, + }, + { + desc: "Int64ObservableGauge", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64ObservableGauge("observable.int64.gauge") + return err + }, + }, + { + desc: "Float64ObservableCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64ObservableCounter("observable.float64.counter") + return err + }, + }, + { + desc: "Float64ObservableUpDownCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64ObservableUpDownCounter("observable.float64.up.down.counter") + return err + }, + }, + { + desc: "Float64ObservableGauge", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64ObservableGauge("observable.float64.gauge") + return err + }, + }, + { + desc: "Int64Counter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64Counter("sync.int64.counter") + return err + }, + }, + { + desc: "Int64UpDownCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64UpDownCounter("sync.int64.up.down.counter") + return err + }, + }, + { + desc: "Int64Histogram", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Int64Histogram("sync.int64.histogram") + return err + }, + }, + { + desc: "Float64Counter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64Counter("sync.float64.counter") + return err + }, + }, + { + desc: "Float64UpDownCounter", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64UpDownCounter("sync.float64.up.down.counter") + return err + }, + }, + { + desc: "Float64Histogram", + createInstrument: func(meter metric.Meter) error { + _, err := meter.Float64Histogram("sync.float64.histogram") + return err + }, + }, + } { + t.Run(tt.desc, func(t *testing.T) { + reader := NewManualReader() + defer func() { + require.NoError(t, reader.Shutdown(context.Background())) + }() + + m := NewMeterProvider(WithReader(reader)).Meter("TestDuplicateInstrumentCreation") + for i := 0; i < 3; i++ { + require.NoError(t, tt.createInstrument(m)) + } + internalMeter, ok := m.(*meter) + require.True(t, ok) + // check that multiple calls to create the same instrument only create 1 instrument + numInstruments := len(internalMeter.int64Insts.data) + len(internalMeter.float64Insts.data) + len(internalMeter.int64ObservableInsts.data) + len(internalMeter.float64ObservableInsts.data) + require.Equal(t, 1, numInstruments) + }) + } +} From c573785b8ac041fdbe4e8532736737dfae21135f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 24 Jan 2024 08:05:51 -0800 Subject: [PATCH 828/886] Add the `sdk/metric/internal/exemplar` package (#4835) * Add the sdk/metric/internal/exemplar pkg * Rename testReservoir to ReservoirTest This is a test helper function that is not exported outside of testing for the package. Use the exported name so the CI system doesn't complain about it not being used. It will be used in follow-up PRs. * Run go mod tidy --- sdk/metric/go.mod | 2 +- sdk/metric/internal/exemplar/doc.go | 17 ++ sdk/metric/internal/exemplar/reservoir.go | 51 +++++ .../internal/exemplar/reservoir_test.go | 180 ++++++++++++++++++ 4 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 sdk/metric/internal/exemplar/doc.go create mode 100644 sdk/metric/internal/exemplar/reservoir.go create mode 100644 sdk/metric/internal/exemplar/reservoir_test.go diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index f41f6636be7..da93f6e68e5 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -9,12 +9,12 @@ require ( go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/metric v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 + go.opentelemetry.io/otel/trace v1.23.0-rc.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/internal/exemplar/doc.go b/sdk/metric/internal/exemplar/doc.go new file mode 100644 index 00000000000..3caeb542c57 --- /dev/null +++ b/sdk/metric/internal/exemplar/doc.go @@ -0,0 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package exemplar provides an implementation of the OpenTelemetry exemplar +// reservoir to be used in metric collection pipelines. +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" diff --git a/sdk/metric/internal/exemplar/reservoir.go b/sdk/metric/internal/exemplar/reservoir.go new file mode 100644 index 00000000000..b3654414ee7 --- /dev/null +++ b/sdk/metric/internal/exemplar/reservoir.go @@ -0,0 +1,51 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Reservoir holds the sampled exemplar of measurements made. +type Reservoir[N int64 | float64] interface { + // Offer accepts the parameters associated with a measurement. The + // parameters will be stored as an exemplar if the Reservoir decides to + // sample the measurement. + // + // The passed ctx needs to contain any baggage or span that were active + // when the measurement was made. This information may be used by the + // Reservoir in making a sampling decision. + // + // The time t is the time when the measurement was made. The val and attr + // parameters are the value and dropped (filtered) attributes of the + // measurement respectively. + Offer(ctx context.Context, t time.Time, val N, attr []attribute.KeyValue) + + // Collect returns all the held exemplars. + // + // The Reservoir state is preserved after this call. See Flush to + // copy-and-clear instead. + Collect(dest *[]metricdata.Exemplar[N]) + + // Flush returns all the held exemplars. + // + // The Reservoir state is reset after this call. See Collect to preserve + // the state instead. + Flush(dest *[]metricdata.Exemplar[N]) +} diff --git a/sdk/metric/internal/exemplar/reservoir_test.go b/sdk/metric/internal/exemplar/reservoir_test.go new file mode 100644 index 00000000000..9ef8e964538 --- /dev/null +++ b/sdk/metric/internal/exemplar/reservoir_test.go @@ -0,0 +1,180 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/trace" +) + +// Sat Jan 01 2000 00:00:00 GMT+0000. +var staticTime = time.Unix(946684800, 0) + +type factory[N int64 | float64] func(requstedCap int) (r Reservoir[N], actualCap int) + +func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { + return func(t *testing.T) { + t.Helper() + + ctx := context.Background() + + t.Run("CaptureSpanContext", func(t *testing.T) { + t.Helper() + + r, n := f(1) + if n < 1 { + t.Skip("skipping, reservoir capacity less than 1:", n) + } + + tID, sID := trace.TraceID{0x01}, trace.SpanID{0x01} + sc := trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: tID, + SpanID: sID, + TraceFlags: trace.FlagsSampled, + }) + ctx := trace.ContextWithSpanContext(ctx, sc) + + r.Offer(ctx, staticTime, 10, nil) + + var dest []metricdata.Exemplar[N] + r.Collect(&dest) + + want := metricdata.Exemplar[N]{ + Time: staticTime, + Value: 10, + SpanID: []byte(sID[:]), + TraceID: []byte(tID[:]), + } + require.Len(t, dest, 1, "number of collected exemplars") + assert.Equal(t, want, dest[0]) + }) + + t.Run("FilterAttributes", func(t *testing.T) { + t.Helper() + + r, n := f(1) + if n < 1 { + t.Skip("skipping, reservoir capacity less than 1:", n) + } + + adminTrue := attribute.Bool("admin", true) + r.Offer(ctx, staticTime, 10, []attribute.KeyValue{adminTrue}) + + var dest []metricdata.Exemplar[N] + r.Collect(&dest) + + want := metricdata.Exemplar[N]{ + FilteredAttributes: []attribute.KeyValue{adminTrue}, + Time: staticTime, + Value: 10, + } + require.Len(t, dest, 1, "number of collected exemplars") + assert.Equal(t, want, dest[0]) + }) + + t.Run("CollectDoesNotFlush", func(t *testing.T) { + t.Helper() + + r, n := f(1) + if n < 1 { + t.Skip("skipping, reservoir capacity less than 1:", n) + } + + r.Offer(ctx, staticTime, 10, nil) + + var dest []metricdata.Exemplar[N] + r.Collect(&dest) + require.Len(t, dest, 1, "number of collected exemplars") + + dest = dest[:0] + r.Collect(&dest) + assert.Len(t, dest, 1, "Collect flushed reservoir") + }) + + t.Run("FlushFlushes", func(t *testing.T) { + t.Helper() + + r, n := f(1) + if n < 1 { + t.Skip("skipping, reservoir capacity less than 1:", n) + } + + r.Offer(ctx, staticTime, 10, nil) + + var dest []metricdata.Exemplar[N] + r.Flush(&dest) + require.Len(t, dest, 1, "number of flushed exemplars") + + r.Flush(&dest) + assert.Len(t, dest, 0, "Flush did not flush reservoir") + }) + + t.Run("MultipleOffers", func(t *testing.T) { + t.Helper() + + r, n := f(3) + if n < 1 { + t.Skip("skipping, reservoir capacity less than 1:", n) + } + + for i := 0; i < n+1; i++ { + v := N(i) + r.Offer(ctx, staticTime, v, nil) + } + + var dest []metricdata.Exemplar[N] + r.Flush(&dest) + assert.Len(t, dest, n, "multiple offers did not fill reservoir") + + // Ensure the flush reset also resets any couting state. + for i := 0; i < n+1; i++ { + v := N(2 * i) + r.Offer(ctx, staticTime, v, nil) + } + + dest = dest[:0] + r.Flush(&dest) + assert.Len(t, dest, n, "internal count state not reset") + }) + + t.Run("DropAll", func(t *testing.T) { + t.Helper() + + r, n := f(0) + if n > 0 { + t.Skip("skipping, reservoir capacity greater than 0:", n) + } + + r.Offer(context.Background(), staticTime, 10, nil) + + dest := []metricdata.Exemplar[N]{{}} // Should be reset to empty. + r.Collect(&dest) + assert.Len(t, dest, 0, "no exemplars should be collected") + + r.Offer(context.Background(), staticTime, 10, nil) + dest = []metricdata.Exemplar[N]{{}} // Should be reset to empty. + r.Flush(&dest) + assert.Len(t, dest, 0, "no exemplars should be flushed") + }) + } +} From 6f96e67adb351c0cf7f0b0011b59678f0f262b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 25 Jan 2024 19:21:43 +0100 Subject: [PATCH 829/886] example/dice: Do not use semconv (#4849) * example/dice: Do not use semconv * Update docs * Remove resource code and use defaults --- example/dice/doc.go | 6 +++++- example/dice/main.go | 4 +--- example/dice/otel.go | 29 +++++------------------------ 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/example/dice/doc.go b/example/dice/doc.go index 5fe156fb977..31a3f7bfc20 100644 --- a/example/dice/doc.go +++ b/example/dice/doc.go @@ -12,5 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Dice is the "Roll the dice" getting started example application. +// Dice is the "Roll the dice" application. +// +// [Getting Started] uses this example to demonstrate OpenTelemetry Go. +// +// [Getting Started]: https://opentelemetry.io/docs/languages/net/automatic/getting-started/ package main diff --git a/example/dice/main.go b/example/dice/main.go index f7e0242906f..7ba965300d1 100644 --- a/example/dice/main.go +++ b/example/dice/main.go @@ -39,9 +39,7 @@ func run() (err error) { defer stop() // Set up OpenTelemetry. - serviceName := "dice" - serviceVersion := "0.1.0" - otelShutdown, err := setupOTelSDK(ctx, serviceName, serviceVersion) + otelShutdown, err := setupOTelSDK(ctx) if err != nil { return } diff --git a/example/dice/otel.go b/example/dice/otel.go index 0b30735007a..87e64dc6ce8 100644 --- a/example/dice/otel.go +++ b/example/dice/otel.go @@ -24,14 +24,12 @@ import ( "go.opentelemetry.io/otel/exporters/stdout/stdouttrace" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/metric" - "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" - semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) // setupOTelSDK bootstraps the OpenTelemetry pipeline. // If it does not return an error, make sure to call shutdown for proper cleanup. -func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shutdown func(context.Context) error, err error) { +func setupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, err error) { var shutdownFuncs []func(context.Context) error // shutdown calls cleanup functions registered via shutdownFuncs. @@ -51,19 +49,12 @@ func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shut err = errors.Join(inErr, shutdown(ctx)) } - // Set up resource. - res, err := newResource(serviceName, serviceVersion) - if err != nil { - handleErr(err) - return - } - // Set up propagator. prop := newPropagator() otel.SetTextMapPropagator(prop) // Set up trace provider. - tracerProvider, err := newTraceProvider(res) + tracerProvider, err := newTraceProvider() if err != nil { handleErr(err) return @@ -72,7 +63,7 @@ func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shut otel.SetTracerProvider(tracerProvider) // Set up meter provider. - meterProvider, err := newMeterProvider(res) + meterProvider, err := newMeterProvider() if err != nil { handleErr(err) return @@ -83,14 +74,6 @@ func setupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shut return } -func newResource(serviceName, serviceVersion string) (*resource.Resource, error) { - return resource.Merge(resource.Default(), - resource.NewWithAttributes(semconv.SchemaURL, - semconv.ServiceName(serviceName), - semconv.ServiceVersion(serviceVersion), - )) -} - func newPropagator() propagation.TextMapPropagator { return propagation.NewCompositeTextMapPropagator( propagation.TraceContext{}, @@ -98,7 +81,7 @@ func newPropagator() propagation.TextMapPropagator { ) } -func newTraceProvider(res *resource.Resource) (*trace.TracerProvider, error) { +func newTraceProvider() (*trace.TracerProvider, error) { traceExporter, err := stdouttrace.New( stdouttrace.WithPrettyPrint()) if err != nil { @@ -109,19 +92,17 @@ func newTraceProvider(res *resource.Resource) (*trace.TracerProvider, error) { trace.WithBatcher(traceExporter, // Default is 5s. Set to 1s for demonstrative purposes. trace.WithBatchTimeout(time.Second)), - trace.WithResource(res), ) return traceProvider, nil } -func newMeterProvider(res *resource.Resource) (*metric.MeterProvider, error) { +func newMeterProvider() (*metric.MeterProvider, error) { metricExporter, err := stdoutmetric.New() if err != nil { return nil, err } meterProvider := metric.NewMeterProvider( - metric.WithResource(res), metric.WithReader(metric.NewPeriodicReader(metricExporter, // Default is 1m. Set to 3s for demonstrative purposes. metric.WithInterval(3*time.Second))), From 08beb8b7ca3b7dbaaca3f1ecc89d33ab4a93441c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 25 Jan 2024 12:26:08 -0800 Subject: [PATCH 830/886] Add the Drop exemplar Reservoir implementation (#4850) --- sdk/metric/internal/exemplar/drop.go | 41 +++++++++++++++++++++++ sdk/metric/internal/exemplar/drop_test.go | 29 ++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 sdk/metric/internal/exemplar/drop.go create mode 100644 sdk/metric/internal/exemplar/drop_test.go diff --git a/sdk/metric/internal/exemplar/drop.go b/sdk/metric/internal/exemplar/drop.go new file mode 100644 index 00000000000..62a95b55f9a --- /dev/null +++ b/sdk/metric/internal/exemplar/drop.go @@ -0,0 +1,41 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// Drop returns a [Reservoir] that drops all measurements it is offered. +func Drop[N int64 | float64]() Reservoir[N] { return &dropRes[N]{} } + +type dropRes[N int64 | float64] struct{} + +// Offer does nothing, all measurements offered will be dropped. +func (r *dropRes[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) {} + +// Collect resets dest. No exemplars will ever be returned. +func (r *dropRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { + *dest = (*dest)[:0] +} + +// Flush resets dest. No exemplars will ever be returned. +func (r *dropRes[N]) Flush(dest *[]metricdata.Exemplar[N]) { + *dest = (*dest)[:0] +} diff --git a/sdk/metric/internal/exemplar/drop_test.go b/sdk/metric/internal/exemplar/drop_test.go new file mode 100644 index 00000000000..5b02bf09437 --- /dev/null +++ b/sdk/metric/internal/exemplar/drop_test.go @@ -0,0 +1,29 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar + +import ( + "testing" +) + +func TestDrop(t *testing.T) { + t.Run("Int64", ReservoirTest[int64](func(int) (Reservoir[int64], int) { + return Drop[int64](), 0 + })) + + t.Run("Float64", ReservoirTest[float64](func(int) (Reservoir[float64], int) { + return Drop[float64](), 0 + })) +} From 79371c17c107dc300bfc67e19f4b62c9a6a22709 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 25 Jan 2024 12:35:10 -0800 Subject: [PATCH 831/886] Add the SampledFilter exemplar Reservoir impl (#4851) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Reservoir implementaiton is used at the MeterProvider level to pre-filter measurements offered to a wrapped Reservoir. Co-authored-by: Robert Pająk --- sdk/metric/internal/exemplar/filter.go | 40 +++++++++++ sdk/metric/internal/exemplar/filter_test.go | 77 +++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 sdk/metric/internal/exemplar/filter.go create mode 100644 sdk/metric/internal/exemplar/filter_test.go diff --git a/sdk/metric/internal/exemplar/filter.go b/sdk/metric/internal/exemplar/filter.go new file mode 100644 index 00000000000..4f5946fb966 --- /dev/null +++ b/sdk/metric/internal/exemplar/filter.go @@ -0,0 +1,40 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" +) + +// SampledFilter returns a [Reservoir] wrapping r that will only offer measurements +// to r if the passed context associated with the measurement contains a sampled +// [go.opentelemetry.io/otel/trace.SpanContext]. +func SampledFilter[N int64 | float64](r Reservoir[N]) Reservoir[N] { + return filtered[N]{Reservoir: r} +} + +type filtered[N int64 | float64] struct { + Reservoir[N] +} + +func (f filtered[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + if trace.SpanContextFromContext(ctx).IsSampled() { + f.Reservoir.Offer(ctx, t, n, a) + } +} diff --git a/sdk/metric/internal/exemplar/filter_test.go b/sdk/metric/internal/exemplar/filter_test.go new file mode 100644 index 00000000000..ae1e276cb83 --- /dev/null +++ b/sdk/metric/internal/exemplar/filter_test.go @@ -0,0 +1,77 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/trace" +) + +func TestSampledFilter(t *testing.T) { + t.Run("Int64", testSampledFiltered[int64]) + t.Run("Float64", testSampledFiltered[float64]) +} + +func testSampledFiltered[N int64 | float64](t *testing.T) { + under := &res[N]{} + + r := SampledFilter[N](under) + + ctx := context.Background() + r.Offer(ctx, staticTime, 0, nil) + assert.False(t, under.OfferCalled, "underlying Reservoir Offer called") + r.Offer(sample(ctx), staticTime, 0, nil) + assert.True(t, under.OfferCalled, "underlying Reservoir Offer not called") + + r.Collect(nil) + assert.True(t, under.CollectCalled, "underlying Reservoir Collect not called") + + r.Flush(nil) + assert.True(t, under.FlushCalled, "underlying Reservoir Flush not called") +} + +func sample(parent context.Context) context.Context { + sc := trace.NewSpanContext(trace.SpanContextConfig{ + TraceID: trace.TraceID{0x01}, + SpanID: trace.SpanID{0x01}, + TraceFlags: trace.FlagsSampled, + }) + return trace.ContextWithSpanContext(parent, sc) +} + +type res[N int64 | float64] struct { + OfferCalled bool + CollectCalled bool + FlushCalled bool +} + +func (r *res[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) { + r.OfferCalled = true +} + +func (r *res[N]) Collect(*[]metricdata.Exemplar[N]) { + r.CollectCalled = true +} + +func (r *res[N]) Flush(*[]metricdata.Exemplar[N]) { + r.FlushCalled = true +} From 200b2cf43accebf293d5afc29f0e1e069ae8d70f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 28 Jan 2024 10:25:07 -0800 Subject: [PATCH 832/886] Bump codecov/codecov-action from 3.1.4 to 3.1.5 (#4866) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.4 to 3.1.5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.4...v3.1.5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87ef7e67508..35cf86fc13a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: cp coverage.txt $TEST_RESULTS cp coverage.html $TEST_RESULTS - name: Upload coverage report - uses: codecov/codecov-action@v3.1.4 + uses: codecov/codecov-action@v3.1.5 with: file: ./coverage.txt fail_ci_if_error: true From 402998f032905071dbf3117803002e5ddea633fd Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 28 Jan 2024 23:51:19 +0100 Subject: [PATCH 833/886] dependabot updates Sun Jan 28 22:42:16 UTC 2024 (#4869) Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump peter-evans/create-issue-from-file from 4 to 5 Bump benchmark-action/github-action-benchmark from 1.18.0 to 1.19.2 Bump lycheeverse/lychee-action from 1.9.1 to 1.9.2 Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /bridge/opentracing/test Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump golang.org/x/vuln from 1.0.1 to 1.0.3 in /internal/tools Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.60.1 to 1.61.0 in /example/otel-collector --- bridge/opentracing/test/go.mod | 8 ++++---- bridge/opentracing/test/go.sum | 16 ++++++++-------- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 0717cdb9dbf..23c3ab2f4f8 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.23.0-rc.1 go.opentelemetry.io/otel/bridge/opentracing v1.23.0-rc.1 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 ) require ( @@ -25,10 +25,10 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.16.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index b4428b93635..fd0ec2aa874 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -36,26 +36,26 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index e3bb6ec5f33..7d25c3981b9 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0-rc.1 go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/trace v1.23.0-rc.1 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 07ef3c0add3..3463de00553 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -30,8 +30,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 6cdd6cc91e7..d755e64760b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index a0973b17eac..157185285ac 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 114e261146b..cbddfd5cb2f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index a0973b17eac..157185285ac 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index b0dcf22e888..16d13d03280 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 471ffacf102..4c51e48ba79 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index ae9a1ed2bc2..4b3766d24f8 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.23.0-rc.1 go.opentelemetry.io/otel/trace v1.23.0-rc.1 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index f1773891403..c14ce36dfb0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 4b976fc83b0..72d1fae7578 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -16,7 +16,7 @@ require ( go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/tools v0.17.0 - golang.org/x/vuln v1.0.1 + golang.org/x/vuln v1.0.3 ) require ( diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 66f9ab4386a..7ebd5cb05d3 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -940,8 +940,8 @@ golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU= -golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM= +golang.org/x/vuln v1.0.3 h1:k2wzzWGpdntQzNsCOLTabCFk76oTe69BPwad5H52F4w= +golang.org/x/vuln v1.0.3/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 3da38d36d4c18c4c131558ae6ba5bf22c829b757 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 00:33:24 +0100 Subject: [PATCH 834/886] Bump peter-evans/create-issue-from-file from 4 to 5 (#4867) Bumps [peter-evans/create-issue-from-file](https://github.com/peter-evans/create-issue-from-file) from 4 to 5. - [Release notes](https://github.com/peter-evans/create-issue-from-file/releases) - [Commits](https://github.com/peter-evans/create-issue-from-file/compare/v4...v5) --- updated-dependencies: - dependency-name: peter-evans/create-issue-from-file dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links.yml | 2 +- .github/workflows/markdown.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 2434706afbd..d342dbdbe5d 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -20,7 +20,7 @@ jobs: - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v4 + uses: peter-evans/create-issue-from-file@v5 with: title: Link Checker Report content-filepath: ./lychee/out.md diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml index b82b9002df5..99c00b332fb 100644 --- a/.github/workflows/markdown.yml +++ b/.github/workflows/markdown.yml @@ -24,7 +24,7 @@ jobs: - name: Create Issue From File if: steps.markdownlint.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v4 + uses: peter-evans/create-issue-from-file@v5 with: title: Markdown Lint Report content-filepath: ./markdownlint.txt From ce3faf1488b72921921f9589048835dddfe97f33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 00:40:31 +0100 Subject: [PATCH 835/886] Bump lycheeverse/lychee-action from 1.9.1 to 1.9.2 (#4864) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.9.1 to 1.9.2. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.9.1...v1.9.2) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index c69d4b1263b..8b211af5400 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v4 - name: Link Checker - uses: lycheeverse/lychee-action@v1.9.1 + uses: lycheeverse/lychee-action@v1.9.2 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index d342dbdbe5d..59ed13d6055 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.9.1 + uses: lycheeverse/lychee-action@v1.9.2 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From dcfec0c2faf80a08b4d75bfd79d177e371149ec4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 29 Jan 2024 07:26:30 -0800 Subject: [PATCH 836/886] Add the random fixed size exemplar reservoir (#4852) * Add the random fixed size exemplar reservoir * Rename fixed.go to storage.go * Update sdk/metric/internal/exemplar/rand.go Co-authored-by: David Ashpole * Remove stale ref to spec recommendation * Add comments to clarify the reset/advance/Collect methods * Apply comment from feedback * Add random func to gen rand float64 on (0,1) * Use random in TestFixedSizeSamplingCorrectness * Add clarifying algorithm comments Include a high-level overview of the algorithm implemented and clarify parameter names to be consistent. * Fix duplicate word * Update sdk/metric/internal/exemplar/rand.go * Comment TestFixedSizeSamplingCorrectness * Update test delta * Test collect less than cap * Remove measurement.Valid method --------- Co-authored-by: David Ashpole Co-authored-by: Chester Cheung --- sdk/metric/internal/exemplar/rand.go | 200 ++++++++++++++++++ sdk/metric/internal/exemplar/rand_test.go | 62 ++++++ .../internal/exemplar/reservoir_test.go | 16 ++ sdk/metric/internal/exemplar/storage.go | 129 +++++++++++ 4 files changed, 407 insertions(+) create mode 100644 sdk/metric/internal/exemplar/rand.go create mode 100644 sdk/metric/internal/exemplar/rand_test.go create mode 100644 sdk/metric/internal/exemplar/storage.go diff --git a/sdk/metric/internal/exemplar/rand.go b/sdk/metric/internal/exemplar/rand.go new file mode 100644 index 00000000000..aa2c2f64047 --- /dev/null +++ b/sdk/metric/internal/exemplar/rand.go @@ -0,0 +1,200 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "math" + "math/rand" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" +) + +// rng is used to make sampling decisions. +// +// Do not use crypto/rand. There is no reason for the decrease in performance +// given this is not a security sensitive decision. +var rng = rand.New(rand.NewSource(time.Now().UnixNano())) + +// random returns, as a float64, a uniform pseudo-random number in the open +// interval (0.0,1.0). +func random() float64 { + // TODO: This does not return a uniform number. rng.Float64 returns a + // uniformly random int in [0,2^53) that is divided by 2^53. Meaning it + // returns multiples of 2^-53, and not all floating point numbers between 0 + // and 1 (i.e. for values less than 2^-4 the 4 last bits of the significand + // are always going to be 0). + // + // An alternative algorithm should be considered that will actually return + // a uniform number in the interval (0,1). For example, since the default + // rand source provides a uniform distribution for Int63, this can be + // converted following the prototypical code of Mersenne Twister 64 (Takuji + // Nishimura and Makoto Matsumoto: + // http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/VERSIONS/C-LANG/mt19937-64.c) + // + // (float64(rng.Int63()>>11) + 0.5) * (1.0 / 4503599627370496.0) + // + // There are likely many other methods to explore here as well. + + f := rng.Float64() + for f == 0 { + f = rng.Float64() + } + return f +} + +// FixedSize returns a [Reservoir] that samples at most k exemplars. If there +// are k or less measurements made, the Reservoir will sample each one. If +// there are more than k, the Reservoir will then randomly sample all +// additional measurement with a decreasing probability. +func FixedSize[N int64 | float64](k int) Reservoir[N] { + r := &randRes[N]{storage: newStorage[N](k)} + r.reset() + return r +} + +type randRes[N int64 | float64] struct { + *storage[N] + + // count is the number of measurement seen. + count int64 + // next is the next count that will store a measurement at a random index + // once the reservoir has been filled. + next int64 + // w is the largest random number in a distribution that is used to compute + // the next next. + w float64 +} + +func (r *randRes[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + // The following algorithm is "Algorithm L" from Li, Kim-Hung (4 December + // 1994). "Reservoir-Sampling Algorithms of Time Complexity + // O(n(1+log(N/n)))". ACM Transactions on Mathematical Software. 20 (4): + // 481–493 (https://dl.acm.org/doi/10.1145/198429.198435). + // + // A high-level overview of "Algorithm L": + // 0) Pre-calculate the random count greater than the storage size when + // an exemplar will be replaced. + // 1) Accept all measurements offered until the configured storage size is + // reached. + // 2) Loop: + // a) When the pre-calculate count is reached, replace a random + // existing exemplar with the offered measurement. + // b) Calculate the next random count greater than the existing one + // which will replace another exemplars + // + // The way a "replacement" count is computed is by looking at `n` number of + // independent random numbers each corresponding to an offered measurement. + // Of these numbers the smallest `k` (the same size as the storage + // capacity) of them are kept as a subset. The maximum value in this + // subset, called `w` is used to weight another random number generation + // for the next count that will be considered. + // + // By weighting the next count computation like described, it is able to + // perform a uniformly-weighted sampling algorithm based on the number of + // samples the reservoir has seen so far. The sampling will "slow down" as + // more and more samples are offered so as to reduce a bias towards those + // offered just prior to the end of the collection. + // + // This algorithm is preferred because of its balance of simplicity and + // performance. It will compute three random numbers (the bulk of + // computation time) for each item that becomes part of the reservoir, but + // it does not spend any time on items that do not. In particular it has an + // asymptotic runtime of O(k(1 + log(n/k)) where n is the number of + // measurements offered and k is the reservoir size. + // + // See https://en.wikipedia.org/wiki/Reservoir_sampling for an overview of + // this and other reservoir sampling algorithms. See + // https://github.com/MrAlias/reservoir-sampling for a performance + // comparison of reservoir sampling algorithms. + + if int(r.count) < cap(r.store) { + r.store[r.count] = newMeasurement(ctx, t, n, a) + } else { + if r.count == r.next { + // Overwrite a random existing measurement with the one offered. + idx := int(rng.Int63n(int64(cap(r.store)))) + r.store[idx] = newMeasurement(ctx, t, n, a) + r.advance() + } + } + r.count++ +} + +// reset resets r to the initial state. +func (r *randRes[N]) reset() { + // This resets the number of exemplars known. + r.count = 0 + // Random index inserts should only happen after the storage is full. + r.next = int64(cap(r.store)) + + // Initial random number in the series used to generate r.next. + // + // This is set before r.advance to reset or initialize the random number + // series. Without doing so it would always be 0 or never restart a new + // random number series. + // + // This maps the uniform random number in (0,1) to a geometric distribution + // over the same interval. The mean of the distribution is inversely + // proportional to the storage capacity. + r.w = math.Exp(math.Log(random()) / float64(cap(r.store))) + + r.advance() +} + +// advance updates the count at which the offered measurement will overwrite an +// existing exemplar. +func (r *randRes[N]) advance() { + // Calculate the next value in the random number series. + // + // The current value of r.w is based on the max of a distribution of random + // numbers (i.e. `w = max(u_1,u_2,...,u_k)` for `k` equal to the capacity + // of the storage and each `u` in the interval (0,w)). To calculate the + // next r.w we use the fact that when the next exemplar is selected to be + // included in the storage an existing one will be dropped, and the + // corresponding random number in the set used to calculate r.w will also + // be replaced. The replacement random number will also be within (0,w), + // therefore the next r.w will be based on the same distribution (i.e. + // `max(u_1,u_2,...,u_k)`). Therefore, we can sample the next r.w by + // computing the next random number `u` and take r.w as `w * u^(1/k)`. + r.w *= math.Exp(math.Log(random()) / float64(cap(r.store))) + // Use the new random number in the series to calculate the count of the + // next measurement that will be stored. + // + // Given 0 < r.w < 1, each iteration will result in subsequent r.w being + // smaller. This translates here into the next next being selected against + // a distribution with a higher mean (i.e. the expected value will increase + // and replacements become less likely) + // + // Important to note, the new r.next will always be at least 1 more than + // the last r.next. + r.next += int64(math.Log(random())/math.Log(1-r.w)) + 1 +} + +func (r *randRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { + r.storage.Collect(dest) + // Call reset here even though it will reset r.count and restart the random + // number series. This will persist any old exemplars as long as no new + // measurements are offered, but it will also prioritize those new + // measurements that are made over the older collection cycle ones. + r.reset() +} + +func (r *randRes[N]) Flush(dest *[]metricdata.Exemplar[N]) { + r.storage.Flush(dest) + r.reset() +} diff --git a/sdk/metric/internal/exemplar/rand_test.go b/sdk/metric/internal/exemplar/rand_test.go new file mode 100644 index 00000000000..9de7a7058ac --- /dev/null +++ b/sdk/metric/internal/exemplar/rand_test.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar + +import ( + "context" + "math" + "sort" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestFixedSize(t *testing.T) { + t.Run("Int64", ReservoirTest[int64](func(n int) (Reservoir[int64], int) { + return FixedSize[int64](n), n + })) + + t.Run("Float64", ReservoirTest[float64](func(n int) (Reservoir[float64], int) { + return FixedSize[float64](n), n + })) +} + +func TestFixedSizeSamplingCorrectness(t *testing.T) { + intensity := 0.1 + sampleSize := 1000 + + data := make([]float64, sampleSize*1000) + for i := range data { + // Generate exponentially distributed data. + data[i] = (-1.0 / intensity) * math.Log(random()) + } + // Sort to test position bias. + sort.Float64s(data) + + r := FixedSize[float64](sampleSize) + for _, value := range data { + r.Offer(context.Background(), staticTime, value, nil) + } + + var sum float64 + for _, m := range r.(*randRes[float64]).store { + sum += m.Value + } + mean := sum / float64(sampleSize) + + // Check the intensity/rate of the sampled distribution is preserved + // ensuring no bias in our random sampling algorithm. + assert.InDelta(t, 1/mean, intensity, 0.02) // Within 5σ. +} diff --git a/sdk/metric/internal/exemplar/reservoir_test.go b/sdk/metric/internal/exemplar/reservoir_test.go index 9ef8e964538..41c90b7fed7 100644 --- a/sdk/metric/internal/exemplar/reservoir_test.go +++ b/sdk/metric/internal/exemplar/reservoir_test.go @@ -111,6 +111,22 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { assert.Len(t, dest, 1, "Collect flushed reservoir") }) + t.Run("CollectLessThanN", func(t *testing.T) { + t.Helper() + + r, n := f(2) + if n < 2 { + t.Skip("skipping, reservoir capacity less than 2:", n) + } + + r.Offer(ctx, staticTime, 10, nil) + + var dest []metricdata.Exemplar[N] + r.Collect(&dest) + // No empty exemplars are exported. + require.Len(t, dest, 1, "number of collected exemplars") + }) + t.Run("FlushFlushes", func(t *testing.T) { t.Helper() diff --git a/sdk/metric/internal/exemplar/storage.go b/sdk/metric/internal/exemplar/storage.go new file mode 100644 index 00000000000..460b8196d06 --- /dev/null +++ b/sdk/metric/internal/exemplar/storage.go @@ -0,0 +1,129 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "time" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/trace" +) + +// storage is an exemplar storage for [Reservoir] implementations. +type storage[N int64 | float64] struct { + // store are the measurements sampled. + // + // This does not use []metricdata.Exemplar because it potentially would + // require an allocation for trace and span IDs in the hot path of Offer. + store []measurement[N] +} + +func newStorage[N int64 | float64](n int) *storage[N] { + return &storage[N]{store: make([]measurement[N], n)} +} + +// Collect returns all the held exemplars. +// +// The Reservoir state is preserved after this call. See Flush to +// copy-and-clear instead. +func (r *storage[N]) Collect(dest *[]metricdata.Exemplar[N]) { + *dest = reset(*dest, len(r.store), len(r.store)) + var n int + for _, m := range r.store { + if !m.valid { + continue + } + + m.Exemplar(&(*dest)[n]) + n++ + } + *dest = (*dest)[:n] +} + +// Flush returns all the held exemplars. +// +// The Reservoir state is reset after this call. See Collect to preserve the +// state instead. +func (r *storage[N]) Flush(dest *[]metricdata.Exemplar[N]) { + *dest = reset(*dest, len(r.store), len(r.store)) + var n int + for i, m := range r.store { + if !m.valid { + continue + } + + m.Exemplar(&(*dest)[n]) + n++ + + // Reset. + r.store[i] = measurement[N]{} + } + *dest = (*dest)[:n] +} + +// measurement is a measurement made by a telemetry system. +type measurement[N int64 | float64] struct { + // FilteredAttributes are the attributes dropped during the measurement. + FilteredAttributes []attribute.KeyValue + // Time is the time when the measurement was made. + Time time.Time + // Value is the value of the measurement. + Value N + // SpanContext is the SpanContext active when a measurement was made. + SpanContext trace.SpanContext + + valid bool +} + +// newMeasurement returns a new non-empty Measurement. +func newMeasurement[N int64 | float64](ctx context.Context, ts time.Time, v N, droppedAttr []attribute.KeyValue) measurement[N] { + return measurement[N]{ + FilteredAttributes: droppedAttr, + Time: ts, + Value: v, + SpanContext: trace.SpanContextFromContext(ctx), + valid: true, + } +} + +// Exemplar returns m as a [metricdata.Exemplar]. +func (m measurement[N]) Exemplar(dest *metricdata.Exemplar[N]) { + dest.FilteredAttributes = m.FilteredAttributes + dest.Time = m.Time + dest.Value = m.Value + + if m.SpanContext.HasTraceID() { + traceID := m.SpanContext.TraceID() + dest.TraceID = traceID[:] + } else { + dest.TraceID = dest.TraceID[:0] + } + + if m.SpanContext.HasSpanID() { + spanID := m.SpanContext.SpanID() + dest.SpanID = spanID[:] + } else { + dest.SpanID = dest.SpanID[:0] + } +} + +func reset[T any](s []T, length, capacity int) []T { + if cap(s) < capacity { + return make([]T, length, capacity) + } + return s[:length] +} From e6e4c95d88ca1ce4937996d522130ff592c6fdbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:13:15 -0800 Subject: [PATCH 837/886] Bump benchmark-action/github-action-benchmark from 1.18.0 to 1.19.2 (#4865) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.18.0 to 1.19.2. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.18.0...v1.19.2) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5786b0564fc..638ec8b4cc3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -27,7 +27,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.18.0 + uses: benchmark-action/github-action-benchmark@v1.19.2 with: name: Benchmarks tool: 'go' From e7de5715ab5975fbb3405c1befd04e2a134028e4 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 30 Jan 2024 07:46:21 -0800 Subject: [PATCH 838/886] Add the Histogram Reservoir impl (#4870) Co-authored-by: Chester Cheung --- sdk/metric/internal/exemplar/hist.go | 47 +++++++++++++++++++++++ sdk/metric/internal/exemplar/hist_test.go | 28 ++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 sdk/metric/internal/exemplar/hist.go create mode 100644 sdk/metric/internal/exemplar/hist_test.go diff --git a/sdk/metric/internal/exemplar/hist.go b/sdk/metric/internal/exemplar/hist.go new file mode 100644 index 00000000000..6f4fe5524b1 --- /dev/null +++ b/sdk/metric/internal/exemplar/hist.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + +import ( + "context" + "sort" + "time" + + "go.opentelemetry.io/otel/attribute" +) + +// Histogram returns a [Reservoir] that samples the last measurement that falls +// within a histogram bucket. The histogram bucket upper-boundaries are define +// by bounds. +// +// The passed bounds will be sorted by this function. +func Histogram[N int64 | float64](bounds []float64) Reservoir[N] { + sort.Float64s(bounds) + return &histRes[N]{ + bounds: bounds, + storage: newStorage[N](len(bounds) + 1), + } +} + +type histRes[N int64 | float64] struct { + *storage[N] + + // bounds are bucket bounds in ascending order. + bounds []float64 +} + +func (r *histRes[N]) Offer(ctx context.Context, t time.Time, n N, a []attribute.KeyValue) { + r.store[sort.SearchFloat64s(r.bounds, float64(n))] = newMeasurement(ctx, t, n, a) +} diff --git a/sdk/metric/internal/exemplar/hist_test.go b/sdk/metric/internal/exemplar/hist_test.go new file mode 100644 index 00000000000..c85694db78c --- /dev/null +++ b/sdk/metric/internal/exemplar/hist_test.go @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package exemplar + +import "testing" + +func TestHist(t *testing.T) { + bounds := []float64{0, 100} + t.Run("Int64", ReservoirTest[int64](func(int) (Reservoir[int64], int) { + return Histogram[int64](bounds), len(bounds) + })) + + t.Run("Float64", ReservoirTest[float64](func(int) (Reservoir[float64], int) { + return Histogram[float64](bounds), len(bounds) + })) +} From 8d3ae4c5ede1a4c6ceb769f43cc759fdbf3d28f8 Mon Sep 17 00:00:00 2001 From: Leo Xie Date: Wed, 31 Jan 2024 01:19:23 +0800 Subject: [PATCH 839/886] fix: Fix stdouttrace/example_test to make the trace_id same. (#4855) * fix: Fix stdouttrace/example_test to make the trace_id same. * fix: restore Example --------- Co-authored-by: Damien Mathieu --- exporters/stdout/stdouttrace/example_test.go | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index fd5425c830e..33164852343 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -38,20 +38,20 @@ var tracer = otel.GetTracerProvider().Tracer( trace.WithSchemaURL(semconv.SchemaURL), ) -func add(ctx context.Context, x, y int64) int64 { +func add(ctx context.Context, x, y int64) (context.Context, int64) { var span trace.Span - _, span = tracer.Start(ctx, "Addition") + ctx, span = tracer.Start(ctx, "Addition") defer span.End() - return x + y + return ctx, x + y } -func multiply(ctx context.Context, x, y int64) int64 { +func multiply(ctx context.Context, x, y int64) (context.Context, int64) { var span trace.Span - _, span = tracer.Start(ctx, "Multiplication") + ctx, span = tracer.Start(ctx, "Multiplication") defer span.End() - return x * y + return ctx, x * y } func Resource() *resource.Resource { @@ -62,7 +62,7 @@ func Resource() *resource.Resource { ) } -func InstallExportPipeline(ctx context.Context) (func(context.Context) error, error) { +func InstallExportPipeline() (func(context.Context) error, error) { exporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) if err != nil { return nil, fmt.Errorf("creating stdout exporter: %w", err) @@ -81,7 +81,7 @@ func Example() { ctx := context.Background() // Registers a tracer Provider globally. - shutdown, err := InstallExportPipeline(ctx) + shutdown, err := InstallExportPipeline() if err != nil { log.Fatal(err) } @@ -91,5 +91,8 @@ func Example() { } }() - log.Println("the answer is", add(ctx, multiply(ctx, multiply(ctx, 2, 2), 10), 2)) + ctx, ans := multiply(ctx, 2, 2) + ctx, ans = multiply(ctx, ans, 10) + ctx, ans = add(ctx, ans, 2) + log.Println("the answer is", ans) } From bf1ae8cb0467cfd5935c6ad86f73f80e220f1f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 31 Jan 2024 09:17:42 +0100 Subject: [PATCH 840/886] [chore] Fix changelog entry for #4754 (#4874) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f4f8d87c7a..3e128b2e6eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab ### Changed - Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754) -- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.19.0` version of the OpenTelemetry specification. (#4754) +- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754) - Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`. If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671) - Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722) From d9d9507227b30ad83500ec59e5714d0314ac83be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 31 Jan 2024 16:10:28 +0100 Subject: [PATCH 841/886] stdouttrace: Refine example (#4872) --- exporters/stdout/stdouttrace/example_test.go | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exporters/stdout/stdouttrace/example_test.go b/exporters/stdout/stdouttrace/example_test.go index 33164852343..e769aad58ab 100644 --- a/exporters/stdout/stdouttrace/example_test.go +++ b/exporters/stdout/stdouttrace/example_test.go @@ -38,20 +38,18 @@ var tracer = otel.GetTracerProvider().Tracer( trace.WithSchemaURL(semconv.SchemaURL), ) -func add(ctx context.Context, x, y int64) (context.Context, int64) { - var span trace.Span - ctx, span = tracer.Start(ctx, "Addition") +func add(ctx context.Context, x, y int64) int64 { + _, span := tracer.Start(ctx, "Addition") defer span.End() - return ctx, x + y + return x + y } -func multiply(ctx context.Context, x, y int64) (context.Context, int64) { - var span trace.Span - ctx, span = tracer.Start(ctx, "Multiplication") +func multiply(ctx context.Context, x, y int64) int64 { + _, span := tracer.Start(ctx, "Multiplication") defer span.End() - return ctx, x * y + return x * y } func Resource() *resource.Resource { @@ -91,8 +89,10 @@ func Example() { } }() - ctx, ans := multiply(ctx, 2, 2) - ctx, ans = multiply(ctx, ans, 10) - ctx, ans = add(ctx, ans, 2) + ctx, span := tracer.Start(ctx, "Calculation") + defer span.End() + ans := multiply(ctx, 2, 2) + ans = multiply(ctx, ans, 10) + ans = add(ctx, ans, 2) log.Println("the answer is", ans) } From fecb92e366d9f3703c099c9bfbb33335a9736bd5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 31 Jan 2024 13:15:35 -0800 Subject: [PATCH 842/886] Add the experimental exemplar feature (#4871) * Add the experimental exemplar feature * Add exemplars to EXPERIMENTAL.md * Add changelog entry * Fix hist buckets > 1 detection * Collect instead of Flush res about to be deleted * Add e2e test * Do not pre-alloc ResourceMetrics This only has a single use. * Fix grammatical error in comment * Add test cases Default and invalid OTEL_METRICS_EXEMPLAR_FILTER. Test sampled and non-sampled context for trace_based. * Comment nCPU * Doc OTEL_METRICS_EXEMPLAR_FILTER --- CHANGELOG.md | 2 + sdk/metric/EXPERIMENTAL.md | 61 +++++++++ sdk/metric/benchmark_test.go | 89 +++++++++++++ sdk/metric/exemplar.go | 96 ++++++++++++++ sdk/metric/internal/aggregate/aggregate.go | 37 ++++-- .../internal/aggregate/aggregate_test.go | 16 ++- .../aggregate/exponential_histogram.go | 20 ++- .../aggregate/exponential_histogram_test.go | 8 +- sdk/metric/internal/aggregate/histogram.go | 25 +++- .../internal/aggregate/histogram_test.go | 14 +- sdk/metric/internal/aggregate/lastvalue.go | 26 +++- sdk/metric/internal/aggregate/sum.go | 63 ++++++--- sdk/metric/pipeline.go | 3 +- sdk/metric/pipeline_test.go | 121 ++++++++++++++++++ 14 files changed, 522 insertions(+), 59 deletions(-) create mode 100644 sdk/metric/exemplar.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e128b2e6eb..1437444568a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Added - Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) +- Experimental exemplar exporting is added to the metric SDK. + See [metric documentation](./sdk/metric/EXPERIMENTAL.md#exemplars) for more information about this feature and how to enable it. (#4871) ### Fixed diff --git a/sdk/metric/EXPERIMENTAL.md b/sdk/metric/EXPERIMENTAL.md index d2a5a0470b6..658d2027687 100644 --- a/sdk/metric/EXPERIMENTAL.md +++ b/sdk/metric/EXPERIMENTAL.md @@ -40,6 +40,67 @@ Disable the cardinality limit. unset OTEL_GO_X_CARDINALITY_LIMIT ``` +### Exemplars + +A sample of measurements made may be exported directly as a set of exemplars. + +This experimental feature can be enabled by setting the `OTEL_GO_X_EXEMPLAR` environment variable. +The value of must be the case-insensitive string of `"true"` to enable the feature. +All other values are ignored. + +Exemplar filters are a supported. +The exemplar filter applies to all measurements made. +They filter these measurements, only allowing certain measurements to be passed to the underlying exemplar reservoir. + +To change the exemplar filter from the default `"trace_based"` filter set the `OTEL_METRICS_EXEMPLAR_FILTER` environment variable. +The value must be the case-sensitive string defined by the [OpenTelemetry specification]. + +- `"always_on"`: allows all measurements +- `"always_off"`: denies all measurements +- `"trace_based"`: allows only sampled measurements + +All values other than these will result in the default, `"trace_based"`, exemplar filter being used. + +[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification/blob/a6ca2fd484c9e76fe1d8e1c79c99f08f4745b5ee/specification/configuration/sdk-environment-variables.md#exemplar + +#### Examples + +Enable exemplars to be exported. + +```console +export OTEL_GO_X_EXEMPLAR=true +``` + +Disable exemplars from being exported. + +```console +unset OTEL_GO_X_EXEMPLAR +``` + +Set the exemplar filter to allow all measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=always_on +``` + +Set the exemplar filter to deny all measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=always_off +``` + +Set the exemplar filter to only allow sampled measurements. + +```console +export OTEL_METRICS_EXEMPLAR_FILTER=trace_based +``` + +Revert to the default exemplar filter (`"trace_based"`) + +```console +unset OTEL_METRICS_EXEMPLAR_FILTER +``` + ## Compatibility and Stability Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../VERSIONING.md). diff --git a/sdk/metric/benchmark_test.go b/sdk/metric/benchmark_test.go index 90f88088630..fc089687525 100644 --- a/sdk/metric/benchmark_test.go +++ b/sdk/metric/benchmark_test.go @@ -16,6 +16,8 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" import ( "context" + "fmt" + "runtime" "strconv" "testing" @@ -24,6 +26,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" + "go.opentelemetry.io/otel/trace" ) var viewBenchmarks = []struct { @@ -369,3 +372,89 @@ func benchCollectAttrs(setup func(attribute.Set) Reader) func(*testing.B) { b.Run("Attributes/10", run(setup(attribute.NewSet(attrs...)))) } } + +func BenchmarkExemplars(b *testing.B) { + sc := trace.NewSpanContext(trace.SpanContextConfig{ + SpanID: trace.SpanID{0o1}, + TraceID: trace.TraceID{0o1}, + TraceFlags: trace.FlagsSampled, + }) + ctx := trace.ContextWithSpanContext(context.Background(), sc) + + attr := attribute.NewSet( + attribute.String("user", "Alice"), + attribute.Bool("admin", true), + ) + + setup := func(name string) (metric.Meter, Reader) { + r := NewManualReader() + v := NewView(Instrument{Name: "*"}, Stream{ + AttributeFilter: func(kv attribute.KeyValue) bool { + return kv.Key == attribute.Key("user") + }, + }) + mp := NewMeterProvider(WithReader(r), WithView(v)) + return mp.Meter(name), r + } + nCPU := runtime.NumCPU() // Size of the fixed reservoir used. + + b.Setenv("OTEL_GO_X_EXEMPLAR", "true") + + name := fmt.Sprintf("Int64Counter/%d", nCPU) + b.Run(name, func(b *testing.B) { + m, r := setup("Int64Counter") + i, err := m.Int64Counter("int64-counter") + assert.NoError(b, err) + + rm := newRM(metricdata.Sum[int64]{ + DataPoints: []metricdata.DataPoint[int64]{ + {Exemplars: make([]metricdata.Exemplar[int64], 0, nCPU)}, + }, + }) + e := &(rm.ScopeMetrics[0].Metrics[0].Data.(metricdata.Sum[int64]).DataPoints[0].Exemplars) + + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + for j := 0; j < 2*nCPU; j++ { + i.Add(ctx, 1, metric.WithAttributeSet(attr)) + } + + _ = r.Collect(ctx, rm) + assert.Len(b, *e, nCPU) + } + }) + + name = fmt.Sprintf("Int64Histogram/%d", nCPU) + b.Run(name, func(b *testing.B) { + m, r := setup("Int64Counter") + i, err := m.Int64Histogram("int64-histogram") + assert.NoError(b, err) + + rm := newRM(metricdata.Histogram[int64]{ + DataPoints: []metricdata.HistogramDataPoint[int64]{ + {Exemplars: make([]metricdata.Exemplar[int64], 0, 1)}, + }, + }) + e := &(rm.ScopeMetrics[0].Metrics[0].Data.(metricdata.Histogram[int64]).DataPoints[0].Exemplars) + + b.ReportAllocs() + b.ResetTimer() + for n := 0; n < b.N; n++ { + for j := 0; j < 2*nCPU; j++ { + i.Record(ctx, 1, metric.WithAttributeSet(attr)) + } + + _ = r.Collect(ctx, rm) + assert.Len(b, *e, 1) + } + }) +} + +func newRM(a metricdata.Aggregation) *metricdata.ResourceMetrics { + return &metricdata.ResourceMetrics{ + ScopeMetrics: []metricdata.ScopeMetrics{ + {Metrics: []metricdata.Metrics{{Data: a}}}, + }, + } +} diff --git a/sdk/metric/exemplar.go b/sdk/metric/exemplar.go new file mode 100644 index 00000000000..77579acdb40 --- /dev/null +++ b/sdk/metric/exemplar.go @@ -0,0 +1,96 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package metric // import "go.opentelemetry.io/otel/sdk/metric" + +import ( + "os" + "runtime" + + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" + "go.opentelemetry.io/otel/sdk/metric/internal/x" +) + +// reservoirFunc returns the appropriately configured exemplar reservoir +// creation func based on the passed InstrumentKind and user defined +// environment variables. +// +// Note: This will only return non-nil values when the experimental exemplar +// feature is enabled and the OTEL_METRICS_EXEMPLAR_FILTER environment variable +// is not set to always_off. +func reservoirFunc[N int64 | float64](agg Aggregation) func() exemplar.Reservoir[N] { + if !x.Exemplars.Enabled() { + return nil + } + + // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/metrics/sdk.md#exemplar-defaults + resF := func() func() exemplar.Reservoir[N] { + // Explicit bucket histogram aggregation with more than 1 bucket will + // use AlignedHistogramBucketExemplarReservoir. + a, ok := agg.(AggregationExplicitBucketHistogram) + if ok && len(a.Boundaries) > 0 { + cp := make([]float64, len(a.Boundaries)) + copy(cp, a.Boundaries) + return func() exemplar.Reservoir[N] { + bounds := cp + return exemplar.Histogram[N](bounds) + } + } + + var n int + if a, ok := agg.(AggregationBase2ExponentialHistogram); ok { + // Base2 Exponential Histogram Aggregation SHOULD use a + // SimpleFixedSizeExemplarReservoir with a reservoir equal to the + // smaller of the maximum number of buckets configured on the + // aggregation or twenty (e.g. min(20, max_buckets)). + n = int(a.MaxSize) + if n > 20 { + n = 20 + } + } else { + // https://github.com/open-telemetry/opentelemetry-specification/blob/e94af89e3d0c01de30127a0f423e912f6cda7bed/specification/metrics/sdk.md#simplefixedsizeexemplarreservoir + // This Exemplar reservoir MAY take a configuration parameter for + // the size of the reservoir. If no size configuration is + // provided, the default size MAY be the number of possible + // concurrent threads (e.g. numer of CPUs) to help reduce + // contention. Otherwise, a default size of 1 SHOULD be used. + n = runtime.NumCPU() + if n < 1 { + // Should never be the case, but be defensive. + n = 1 + } + } + + return func() exemplar.Reservoir[N] { + return exemplar.FixedSize[N](n) + } + } + + // https://github.com/open-telemetry/opentelemetry-specification/blob/d4b241f451674e8f611bb589477680341006ad2b/specification/configuration/sdk-environment-variables.md#exemplar + const filterEnvKey = "OTEL_METRICS_EXEMPLAR_FILTER" + + switch os.Getenv(filterEnvKey) { + case "always_on": + return resF() + case "always_off": + return exemplar.Drop[N] + case "trace_based": + fallthrough + default: + newR := resF() + return func() exemplar.Reservoir[N] { + return exemplar.SampledFilter(newR()) + } + } +} diff --git a/sdk/metric/internal/aggregate/aggregate.go b/sdk/metric/internal/aggregate/aggregate.go index c61f8513789..4060a2f76d3 100644 --- a/sdk/metric/internal/aggregate/aggregate.go +++ b/sdk/metric/internal/aggregate/aggregate.go @@ -19,6 +19,7 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -44,6 +45,12 @@ type Builder[N int64 | float64] struct { // Filter is the attribute filter the aggregate function will use on the // input of measurements. Filter attribute.Filter + // ReservoirFunc is the factory function used by aggregate functions to + // create new exemplar reservoirs for a new seen attribute set. + // + // If this is not provided a default factory function that returns an + // exemplar.Drop reservoir will be used. + ReservoirFunc func() exemplar.Reservoir[N] // AggregationLimit is the cardinality limit of measurement attributes. Any // measurement for new attributes once the limit has been reached will be // aggregated into a single aggregate for the "otel.metric.overflow" @@ -54,15 +61,27 @@ type Builder[N int64 | float64] struct { AggregationLimit int } -func (b Builder[N]) filter(f Measure[N]) Measure[N] { +func (b Builder[N]) resFunc() func() exemplar.Reservoir[N] { + if b.ReservoirFunc != nil { + return b.ReservoirFunc + } + + return exemplar.Drop[N] +} + +type fltrMeasure[N int64 | float64] func(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) + +func (b Builder[N]) filter(f fltrMeasure[N]) Measure[N] { if b.Filter != nil { fltr := b.Filter // Copy to make it immutable after assignment. return func(ctx context.Context, n N, a attribute.Set) { - fAttr, _ := a.Filter(fltr) - f(ctx, n, fAttr) + fAttr, dropped := a.Filter(fltr) + f(ctx, n, fAttr, dropped) } } - return f + return func(ctx context.Context, n N, a attribute.Set) { + f(ctx, n, a, nil) + } } // LastValue returns a last-value aggregate function input and output. @@ -71,7 +90,7 @@ func (b Builder[N]) filter(f Measure[N]) Measure[N] { func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // Delta temporality is the only temporality that makes semantic sense for // a last-value aggregate. - lv := newLastValue[N](b.AggregationLimit) + lv := newLastValue[N](b.AggregationLimit, b.resFunc()) return b.filter(lv.measure), func(dest *metricdata.Aggregation) int { // Ignore if dest is not a metricdata.Gauge. The chance for memory @@ -87,7 +106,7 @@ func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation) { // PrecomputedSum returns a sum aggregate function input and output. The // arguments passed to the input are expected to be the precomputed sum values. func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newPrecomputedSum[N](monotonic, b.AggregationLimit) + s := newPrecomputedSum[N](monotonic, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -98,7 +117,7 @@ func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregati // Sum returns a sum aggregate function input and output. func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { - s := newSum[N](monotonic, b.AggregationLimit) + s := newSum[N](monotonic, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(s.measure), s.delta @@ -110,7 +129,7 @@ func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation) { // ExplicitBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newHistogram[N](boundaries, noMinMax, noSum, b.AggregationLimit) + h := newHistogram[N](boundaries, noMinMax, noSum, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta @@ -122,7 +141,7 @@ func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSu // ExponentialBucketHistogram returns a histogram aggregate function input and // output. func (b Builder[N]) ExponentialBucketHistogram(maxSize, maxScale int32, noMinMax, noSum bool) (Measure[N], ComputeAggregation) { - h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum, b.AggregationLimit) + h := newExponentialHistogram[N](maxSize, maxScale, noMinMax, noSum, b.AggregationLimit, b.resFunc()) switch b.Temporality { case metricdata.DeltaTemporality: return b.filter(h.measure), h.delta diff --git a/sdk/metric/internal/aggregate/aggregate_test.go b/sdk/metric/internal/aggregate/aggregate_test.go index 384ca51c8cf..be568f14c04 100644 --- a/sdk/metric/internal/aggregate/aggregate_test.go +++ b/sdk/metric/internal/aggregate/aggregate_test.go @@ -23,6 +23,7 @@ import ( "github.com/stretchr/testify/assert" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" ) @@ -59,6 +60,10 @@ var ( } ) +func dropExemplars[N int64 | float64]() exemplar.Reservoir[N] { + return exemplar.Drop[N]() +} + func TestBuilderFilter(t *testing.T) { t.Run("Int64", testBuilderFilter[int64]()) t.Run("Float64", testBuilderFilter[float64]()) @@ -69,20 +74,21 @@ func testBuilderFilter[N int64 | float64]() func(t *testing.T) { t.Helper() value, attr := N(1), alice - run := func(b Builder[N], wantA attribute.Set) func(*testing.T) { + run := func(b Builder[N], wantF attribute.Set, wantD []attribute.KeyValue) func(*testing.T) { return func(t *testing.T) { t.Helper() - meas := b.filter(func(_ context.Context, v N, a attribute.Set) { + meas := b.filter(func(_ context.Context, v N, f attribute.Set, d []attribute.KeyValue) { assert.Equal(t, value, v, "measured incorrect value") - assert.Equal(t, wantA, a, "measured incorrect attributes") + assert.Equal(t, wantF, f, "measured incorrect filtered attributes") + assert.ElementsMatch(t, wantD, d, "measured incorrect dropped attributes") }) meas(context.Background(), value, attr) } } - t.Run("NoFilter", run(Builder[N]{}, attr)) - t.Run("Filter", run(Builder[N]{Filter: attrFltr}, fltrAlice)) + t.Run("NoFilter", run(Builder[N]{}, attr, nil)) + t.Run("Filter", run(Builder[N]{Filter: attrFltr}, fltrAlice, []attribute.KeyValue{adminTrue})) } } diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index e9c25980aa2..660b86071ae 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -23,6 +23,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -40,6 +41,8 @@ const ( // expoHistogramDataPoint is a single data point in an exponential histogram. type expoHistogramDataPoint[N int64 | float64] struct { + res exemplar.Reservoir[N] + count uint64 min N max N @@ -288,13 +291,14 @@ func (b *expoBuckets) downscale(delta int) { // newExponentialHistogram returns an Aggregator that summarizes a set of // measurements as an exponential histogram. Each histogram is scoped by attributes // and the aggregation cycle the measurements were made in. -func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int) *expoHistogram[N] { +func newExponentialHistogram[N int64 | float64](maxSize, maxScale int32, noMinMax, noSum bool, limit int, r func() exemplar.Reservoir[N]) *expoHistogram[N] { return &expoHistogram[N]{ noSum: noSum, noMinMax: noMinMax, maxSize: int(maxSize), maxScale: int(maxScale), + newRes: r, limit: newLimiter[*expoHistogramDataPoint[N]](limit), values: make(map[attribute.Set]*expoHistogramDataPoint[N]), @@ -310,6 +314,7 @@ type expoHistogram[N int64 | float64] struct { maxSize int maxScale int + newRes func() exemplar.Reservoir[N] limit limiter[*expoHistogramDataPoint[N]] values map[attribute.Set]*expoHistogramDataPoint[N] valuesMu sync.Mutex @@ -317,22 +322,27 @@ type expoHistogram[N int64 | float64] struct { start time.Time } -func (e *expoHistogram[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (e *expoHistogram[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { // Ignore NaN and infinity. if math.IsInf(float64(value), 0) || math.IsNaN(float64(value)) { return } + t := now() + e.valuesMu.Lock() defer e.valuesMu.Unlock() - attr = e.limit.Attributes(attr, e.values) + attr := e.limit.Attributes(fltrAttr, e.values) v, ok := e.values[attr] if !ok { v = newExpoHistogramDataPoint[N](e.maxSize, e.maxScale, e.noMinMax, e.noSum) + v.res = e.newRes() + e.values[attr] = v } v.record(value) + v.res.Offer(ctx, t, value, droppedAttr) } func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { @@ -374,6 +384,8 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + delete(e.values, a) i++ } @@ -422,6 +434,8 @@ func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + i++ // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 40af402636c..3fed4897ee2 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -183,9 +183,9 @@ func testExpoHistogramMinMaxSumInt64(t *testing.T) { restore := withHandler(t) defer restore() - h := newExponentialHistogram[int64](4, 20, false, false, 0) + h := newExponentialHistogram[int64](4, 20, false, false, 0, dropExemplars[int64]) for _, v := range tt.values { - h.measure(context.Background(), v, alice) + h.measure(context.Background(), v, alice, nil) } dp := h.values[alice] @@ -225,9 +225,9 @@ func testExpoHistogramMinMaxSumFloat64(t *testing.T) { restore := withHandler(t) defer restore() - h := newExponentialHistogram[float64](4, 20, false, false, 0) + h := newExponentialHistogram[float64](4, 20, false, false, 0, dropExemplars[float64]) for _, v := range tt.values { - h.measure(context.Background(), v, alice) + h.measure(context.Background(), v, alice, nil) } dp := h.values[alice] diff --git a/sdk/metric/internal/aggregate/histogram.go b/sdk/metric/internal/aggregate/histogram.go index 5d886360bae..a9a4706bf00 100644 --- a/sdk/metric/internal/aggregate/histogram.go +++ b/sdk/metric/internal/aggregate/histogram.go @@ -21,10 +21,13 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) type buckets[N int64 | float64] struct { + res exemplar.Reservoir[N] + counts []uint64 count uint64 total N @@ -54,12 +57,13 @@ type histValues[N int64 | float64] struct { noSum bool bounds []float64 + newRes func() exemplar.Reservoir[N] limit limiter[*buckets[N]] values map[attribute.Set]*buckets[N] valuesMu sync.Mutex } -func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) *histValues[N] { +func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int, r func() exemplar.Reservoir[N]) *histValues[N] { // The responsibility of keeping all buckets correctly associated with the // passed boundaries is ultimately this type's responsibility. Make a copy // here so we can always guarantee this. Or, in the case of failure, have @@ -70,6 +74,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) * return &histValues[N]{ noSum: noSum, bounds: b, + newRes: r, limit: newLimiter[*buckets[N]](limit), values: make(map[attribute.Set]*buckets[N]), } @@ -77,7 +82,7 @@ func newHistValues[N int64 | float64](bounds []float64, noSum bool, limit int) * // Aggregate records the measurement value, scoped by attr, and aggregates it // into a histogram. -func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (s *histValues[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { // This search will return an index in the range [0, len(s.bounds)], where // it will return len(s.bounds) if value is greater than the last element // of s.bounds. This aligns with the buckets in that the length of buckets @@ -85,10 +90,12 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // (s.bounds[len(s.bounds)-1], +∞). idx := sort.SearchFloat64s(s.bounds, float64(value)) + t := now() + s.valuesMu.Lock() defer s.valuesMu.Unlock() - attr = s.limit.Attributes(attr, s.values) + attr := s.limit.Attributes(fltrAttr, s.values) b, ok := s.values[attr] if !ok { // N+1 buckets. For example: @@ -99,6 +106,8 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) // // buckets = (-∞, 0], (0, 5.0], (5.0, 10.0], (10.0, +∞) b = newBuckets[N](len(s.bounds) + 1) + b.res = s.newRes() + // Ensure min and max are recorded values (not zero), for new buckets. b.min, b.max = value, value s.values[attr] = b @@ -107,13 +116,14 @@ func (s *histValues[N]) measure(_ context.Context, value N, attr attribute.Set) if !s.noSum { b.sum(value) } + b.res.Offer(ctx, t, value, droppedAttr) } // newHistogram returns an Aggregator that summarizes a set of measurements as // an histogram. -func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int) *histogram[N] { +func newHistogram[N int64 | float64](boundaries []float64, noMinMax, noSum bool, limit int, r func() exemplar.Reservoir[N]) *histogram[N] { return &histogram[N]{ - histValues: newHistValues[N](boundaries, noSum, limit), + histValues: newHistValues[N](boundaries, noSum, limit, r), noMinMax: noMinMax, start: now(), } @@ -164,6 +174,8 @@ func (s *histogram[N]) delta(dest *metricdata.Aggregation) int { hDPts[i].Max = metricdata.NewExtrema(b.max) } + b.res.Collect(&hDPts[i].Exemplars) + // Unused attribute sets do not report. delete(s.values, a) i++ @@ -220,6 +232,9 @@ func (s *histogram[N]) cumulative(dest *metricdata.Aggregation) int { hDPts[i].Min = metricdata.NewExtrema(b.min) hDPts[i].Max = metricdata.NewExtrema(b.max) } + + b.res.Collect(&hDPts[i].Exemplars) + i++ // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute diff --git a/sdk/metric/internal/aggregate/histogram_test.go b/sdk/metric/internal/aggregate/histogram_test.go index e51e9fc8f29..bd88b083492 100644 --- a/sdk/metric/internal/aggregate/histogram_test.go +++ b/sdk/metric/internal/aggregate/histogram_test.go @@ -313,13 +313,13 @@ func TestHistogramImmutableBounds(t *testing.T) { cpB := make([]float64, len(b)) copy(cpB, b) - h := newHistogram[int64](b, false, false, 0) + h := newHistogram[int64](b, false, false, 0, dropExemplars[int64]) require.Equal(t, cpB, h.bounds) b[0] = 10 assert.Equal(t, cpB, h.bounds, "modifying the bounds argument should not change the bounds") - h.measure(context.Background(), 5, alice) + h.measure(context.Background(), 5, alice, nil) var data metricdata.Aggregation = metricdata.Histogram[int64]{} h.cumulative(&data) @@ -329,8 +329,8 @@ func TestHistogramImmutableBounds(t *testing.T) { } func TestCumulativeHistogramImutableCounts(t *testing.T) { - h := newHistogram[int64](bounds, noMinMax, false, 0) - h.measure(context.Background(), 5, alice) + h := newHistogram[int64](bounds, noMinMax, false, 0, dropExemplars[int64]) + h.measure(context.Background(), 5, alice, nil) var data metricdata.Aggregation = metricdata.Histogram[int64]{} h.cumulative(&data) @@ -347,13 +347,13 @@ func TestCumulativeHistogramImutableCounts(t *testing.T) { func TestDeltaHistogramReset(t *testing.T) { t.Cleanup(mockTime(now)) - h := newHistogram[int64](bounds, noMinMax, false, 0) + h := newHistogram[int64](bounds, noMinMax, false, 0, dropExemplars[int64]) var data metricdata.Aggregation = metricdata.Histogram[int64]{} require.Equal(t, 0, h.delta(&data)) require.Len(t, data.(metricdata.Histogram[int64]).DataPoints, 0) - h.measure(context.Background(), 1, alice) + h.measure(context.Background(), 1, alice, nil) expect := metricdata.Histogram[int64]{Temporality: metricdata.DeltaTemporality} expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](alice, 1, 1)} @@ -366,7 +366,7 @@ func TestDeltaHistogramReset(t *testing.T) { assert.Len(t, data.(metricdata.Histogram[int64]).DataPoints, 0) // Aggregating another set should not affect the original (alice). - h.measure(context.Background(), 1, bob) + h.measure(context.Background(), 1, bob, nil) expect.DataPoints = []metricdata.HistogramDataPoint[int64]{hPointSummed[int64](bob, 1, 1)} h.delta(&data) metricdatatest.AssertAggregationsEqual(t, expect, data) diff --git a/sdk/metric/internal/aggregate/lastvalue.go b/sdk/metric/internal/aggregate/lastvalue.go index b79e80a0c8d..5699e728f1f 100644 --- a/sdk/metric/internal/aggregate/lastvalue.go +++ b/sdk/metric/internal/aggregate/lastvalue.go @@ -20,6 +20,7 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -27,10 +28,12 @@ import ( type datapoint[N int64 | float64] struct { timestamp time.Time value N + res exemplar.Reservoir[N] } -func newLastValue[N int64 | float64](limit int) *lastValue[N] { +func newLastValue[N int64 | float64](limit int, r func() exemplar.Reservoir[N]) *lastValue[N] { return &lastValue[N]{ + newRes: r, limit: newLimiter[datapoint[N]](limit), values: make(map[attribute.Set]datapoint[N]), } @@ -40,16 +43,28 @@ func newLastValue[N int64 | float64](limit int) *lastValue[N] { type lastValue[N int64 | float64] struct { sync.Mutex + newRes func() exemplar.Reservoir[N] limit limiter[datapoint[N]] values map[attribute.Set]datapoint[N] } -func (s *lastValue[N]) measure(ctx context.Context, value N, attr attribute.Set) { - d := datapoint[N]{timestamp: now(), value: value} +func (s *lastValue[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { + t := now() + s.Lock() - attr = s.limit.Attributes(attr, s.values) + defer s.Unlock() + + attr := s.limit.Attributes(fltrAttr, s.values) + d, ok := s.values[attr] + if !ok { + d.res = s.newRes() + } + + d.timestamp = t + d.value = value + d.res.Offer(ctx, t, value, droppedAttr) + s.values[attr] = d - s.Unlock() } func (s *lastValue[N]) computeAggregation(dest *[]metricdata.DataPoint[N]) { @@ -66,6 +81,7 @@ func (s *lastValue[N]) computeAggregation(dest *[]metricdata.DataPoint[N]) { // ignored. (*dest)[i].Time = v.timestamp (*dest)[i].Value = v.value + v.res.Collect(&(*dest)[i].Exemplars) // Do not report stale values. delete(s.values, a) i++ diff --git a/sdk/metric/internal/aggregate/sum.go b/sdk/metric/internal/aggregate/sum.go index a0d26e1ddb9..02de2483f3b 100644 --- a/sdk/metric/internal/aggregate/sum.go +++ b/sdk/metric/internal/aggregate/sum.go @@ -20,36 +20,55 @@ import ( "time" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/metric/internal/exemplar" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) +type sumValue[N int64 | float64] struct { + n N + res exemplar.Reservoir[N] +} + // valueMap is the storage for sums. type valueMap[N int64 | float64] struct { sync.Mutex - limit limiter[N] - values map[attribute.Set]N + newRes func() exemplar.Reservoir[N] + limit limiter[sumValue[N]] + values map[attribute.Set]sumValue[N] } -func newValueMap[N int64 | float64](limit int) *valueMap[N] { +func newValueMap[N int64 | float64](limit int, r func() exemplar.Reservoir[N]) *valueMap[N] { return &valueMap[N]{ - limit: newLimiter[N](limit), - values: make(map[attribute.Set]N), + newRes: r, + limit: newLimiter[sumValue[N]](limit), + values: make(map[attribute.Set]sumValue[N]), } } -func (s *valueMap[N]) measure(_ context.Context, value N, attr attribute.Set) { +func (s *valueMap[N]) measure(ctx context.Context, value N, fltrAttr attribute.Set, droppedAttr []attribute.KeyValue) { + t := now() + s.Lock() - attr = s.limit.Attributes(attr, s.values) - s.values[attr] += value - s.Unlock() + defer s.Unlock() + + attr := s.limit.Attributes(fltrAttr, s.values) + v, ok := s.values[attr] + if !ok { + v.res = s.newRes() + } + + v.n += value + v.res.Offer(ctx, t, value, droppedAttr) + + s.values[attr] = v } // newSum returns an aggregator that summarizes a set of measurements as their // arithmetic sum. Each sum is scoped by attributes and the aggregation cycle // the measurements were made in. -func newSum[N int64 | float64](monotonic bool, limit int) *sum[N] { +func newSum[N int64 | float64](monotonic bool, limit int, r func() exemplar.Reservoir[N]) *sum[N] { return &sum[N]{ - valueMap: newValueMap[N](limit), + valueMap: newValueMap[N](limit, r), monotonic: monotonic, start: now(), } @@ -79,11 +98,12 @@ func (s *sum[N]) delta(dest *metricdata.Aggregation) int { dPts := reset(sData.DataPoints, n, n) var i int - for attr, value := range s.values { + for attr, val := range s.values { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = val.n + val.res.Collect(&dPts[i].Exemplars) // Do not report stale values. delete(s.values, attr) i++ @@ -117,7 +137,8 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = value.n + value.res.Collect(&dPts[i].Exemplars) // TODO (#3006): This will use an unbounded amount of memory if there // are unbounded number of attribute sets being aggregated. Attribute // sets that become "stale" need to be forgotten so this will not @@ -134,9 +155,9 @@ func (s *sum[N]) cumulative(dest *metricdata.Aggregation) int { // newPrecomputedSum returns an aggregator that summarizes a set of // observatrions as their arithmetic sum. Each sum is scoped by attributes and // the aggregation cycle the measurements were made in. -func newPrecomputedSum[N int64 | float64](monotonic bool, limit int) *precomputedSum[N] { +func newPrecomputedSum[N int64 | float64](monotonic bool, limit int, r func() exemplar.Reservoir[N]) *precomputedSum[N] { return &precomputedSum[N]{ - valueMap: newValueMap[N](limit), + valueMap: newValueMap[N](limit, r), monotonic: monotonic, start: now(), } @@ -170,14 +191,15 @@ func (s *precomputedSum[N]) delta(dest *metricdata.Aggregation) int { var i int for attr, value := range s.values { - delta := value - s.reported[attr] + delta := value.n - s.reported[attr] dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t dPts[i].Value = delta + value.res.Collect(&dPts[i].Exemplars) - newReported[attr] = value + newReported[attr] = value.n // Unused attribute sets do not report. delete(s.values, attr) i++ @@ -209,11 +231,12 @@ func (s *precomputedSum[N]) cumulative(dest *metricdata.Aggregation) int { dPts := reset(sData.DataPoints, n, n) var i int - for attr, value := range s.values { + for attr, val := range s.values { dPts[i].Attributes = attr dPts[i].StartTime = s.start dPts[i].Time = t - dPts[i].Value = value + dPts[i].Value = val.n + val.res.Collect(&dPts[i].Exemplars) // Unused attribute sets do not report. delete(s.values, attr) diff --git a/sdk/metric/pipeline.go b/sdk/metric/pipeline.go index 47d9fe07ada..da39ab961c1 100644 --- a/sdk/metric/pipeline.go +++ b/sdk/metric/pipeline.go @@ -359,7 +359,8 @@ func (i *inserter[N]) cachedAggregator(scope instrumentation.Scope, kind Instrum normID := id.normalize() cv := i.aggregators.Lookup(normID, func() aggVal[N] { b := aggregate.Builder[N]{ - Temporality: i.pipeline.reader.temporality(kind), + Temporality: i.pipeline.reader.temporality(kind), + ReservoirFunc: reservoirFunc[N](stream.Aggregation), } b.Filter = stream.AttributeFilter // A value less than or equal to zero will disable the aggregation diff --git a/sdk/metric/pipeline_test.go b/sdk/metric/pipeline_test.go index f585c7a4743..d52b9a7fa2c 100644 --- a/sdk/metric/pipeline_test.go +++ b/sdk/metric/pipeline_test.go @@ -19,6 +19,7 @@ import ( "fmt" "log" "os" + "runtime" "strings" "sync" "testing" @@ -31,10 +32,12 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/metric/metricdata" "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/trace" ) func testSumAggregateOutput(dest *metricdata.Aggregation) int { @@ -394,3 +397,121 @@ func TestInserterCachedAggregatorNameConflict(t *testing.T) { require.Len(t, iSync, 1, "registered instrumentSync changed") assert.Equal(t, name, iSync[0].name, "stream name changed") } + +func TestExemplars(t *testing.T) { + nCPU := runtime.NumCPU() + setup := func(name string) (metric.Meter, Reader) { + r := NewManualReader() + v := NewView(Instrument{Name: "int64-expo-histogram"}, Stream{ + Aggregation: AggregationBase2ExponentialHistogram{ + MaxSize: 160, // > 20, reservoir size should default to 20. + MaxScale: 20, + }, + }) + return NewMeterProvider(WithReader(r), WithView(v)).Meter(name), r + } + + measure := func(ctx context.Context, m metric.Meter) { + i, err := m.Int64Counter("int64-counter") + require.NoError(t, err) + + h, err := m.Int64Histogram("int64-histogram") + require.NoError(t, err) + + e, err := m.Int64Histogram("int64-expo-histogram") + require.NoError(t, err) + + for j := 0; j < 20*nCPU; j++ { // will be >= 20 and > nCPU + i.Add(ctx, 1) + h.Record(ctx, 1) + e.Record(ctx, 1) + } + } + + check := func(t *testing.T, r Reader, nSum, nHist, nExpo int) { + t.Helper() + + rm := new(metricdata.ResourceMetrics) + require.NoError(t, r.Collect(context.Background(), rm)) + + require.Len(t, rm.ScopeMetrics, 1, "ScopeMetrics") + sm := rm.ScopeMetrics[0] + require.Len(t, sm.Metrics, 3, "Metrics") + + require.IsType(t, metricdata.Sum[int64]{}, sm.Metrics[0].Data, sm.Metrics[0].Name) + sum := sm.Metrics[0].Data.(metricdata.Sum[int64]) + assert.Len(t, sum.DataPoints[0].Exemplars, nSum) + + require.IsType(t, metricdata.Histogram[int64]{}, sm.Metrics[1].Data, sm.Metrics[1].Name) + hist := sm.Metrics[1].Data.(metricdata.Histogram[int64]) + assert.Len(t, hist.DataPoints[0].Exemplars, nHist) + + require.IsType(t, metricdata.ExponentialHistogram[int64]{}, sm.Metrics[2].Data, sm.Metrics[2].Name) + expo := sm.Metrics[2].Data.(metricdata.ExponentialHistogram[int64]) + assert.Len(t, expo.DataPoints[0].Exemplars, nExpo) + } + + ctx := context.Background() + sc := trace.NewSpanContext(trace.SpanContextConfig{ + SpanID: trace.SpanID{0o1}, + TraceID: trace.TraceID{0o1}, + TraceFlags: trace.FlagsSampled, + }) + sampled := trace.ContextWithSpanContext(context.Background(), sc) + + t.Run("OTEL_GO_X_EXEMPLAR=true", func(t *testing.T) { + t.Setenv("OTEL_GO_X_EXEMPLAR", "true") + + t.Run("Default", func(t *testing.T) { + m, r := setup("default") + measure(ctx, m) + check(t, r, 0, 0, 0) + + measure(sampled, m) + check(t, r, nCPU, 1, 20) + }) + + t.Run("Invalid", func(t *testing.T) { + t.Setenv("OTEL_METRICS_EXEMPLAR_FILTER", "unrecognized") + m, r := setup("default") + measure(ctx, m) + check(t, r, 0, 0, 0) + + measure(sampled, m) + check(t, r, nCPU, 1, 20) + }) + + t.Run("always_on", func(t *testing.T) { + t.Setenv("OTEL_METRICS_EXEMPLAR_FILTER", "always_on") + m, r := setup("always_on") + measure(ctx, m) + check(t, r, nCPU, 1, 20) + }) + + t.Run("always_off", func(t *testing.T) { + t.Setenv("OTEL_METRICS_EXEMPLAR_FILTER", "always_off") + m, r := setup("always_off") + measure(ctx, m) + check(t, r, 0, 0, 0) + }) + + t.Run("trace_based", func(t *testing.T) { + t.Setenv("OTEL_METRICS_EXEMPLAR_FILTER", "trace_based") + m, r := setup("trace_based") + measure(ctx, m) + check(t, r, 0, 0, 0) + + measure(sampled, m) + check(t, r, nCPU, 1, 20) + }) + }) + + t.Run("OTEL_GO_X_EXEMPLAR=false", func(t *testing.T) { + t.Setenv("OTEL_GO_X_EXEMPLAR", "false") + + t.Setenv("OTEL_METRICS_EXEMPLAR_FILTER", "always_on") + m, r := setup("always_on") + measure(ctx, m) + check(t, r, 0, 0, 0) + }) +} From 242d23a1815d00f228e6767e4baea9019fefe50a Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 31 Jan 2024 14:07:40 -0800 Subject: [PATCH 843/886] Remove the Flush method from Exemplar (#4873) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Robert Pająk --- sdk/metric/internal/exemplar/drop.go | 5 -- sdk/metric/internal/exemplar/filter_test.go | 8 --- sdk/metric/internal/exemplar/rand.go | 5 -- sdk/metric/internal/exemplar/reservoir.go | 9 +--- .../internal/exemplar/reservoir_test.go | 50 ++----------------- sdk/metric/internal/exemplar/storage.go | 24 +-------- 6 files changed, 6 insertions(+), 95 deletions(-) diff --git a/sdk/metric/internal/exemplar/drop.go b/sdk/metric/internal/exemplar/drop.go index 62a95b55f9a..39bf37b9e94 100644 --- a/sdk/metric/internal/exemplar/drop.go +++ b/sdk/metric/internal/exemplar/drop.go @@ -34,8 +34,3 @@ func (r *dropRes[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) func (r *dropRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { *dest = (*dest)[:0] } - -// Flush resets dest. No exemplars will ever be returned. -func (r *dropRes[N]) Flush(dest *[]metricdata.Exemplar[N]) { - *dest = (*dest)[:0] -} diff --git a/sdk/metric/internal/exemplar/filter_test.go b/sdk/metric/internal/exemplar/filter_test.go index ae1e276cb83..e32d03c2352 100644 --- a/sdk/metric/internal/exemplar/filter_test.go +++ b/sdk/metric/internal/exemplar/filter_test.go @@ -44,9 +44,6 @@ func testSampledFiltered[N int64 | float64](t *testing.T) { r.Collect(nil) assert.True(t, under.CollectCalled, "underlying Reservoir Collect not called") - - r.Flush(nil) - assert.True(t, under.FlushCalled, "underlying Reservoir Flush not called") } func sample(parent context.Context) context.Context { @@ -61,7 +58,6 @@ func sample(parent context.Context) context.Context { type res[N int64 | float64] struct { OfferCalled bool CollectCalled bool - FlushCalled bool } func (r *res[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) { @@ -71,7 +67,3 @@ func (r *res[N]) Offer(context.Context, time.Time, N, []attribute.KeyValue) { func (r *res[N]) Collect(*[]metricdata.Exemplar[N]) { r.CollectCalled = true } - -func (r *res[N]) Flush(*[]metricdata.Exemplar[N]) { - r.FlushCalled = true -} diff --git a/sdk/metric/internal/exemplar/rand.go b/sdk/metric/internal/exemplar/rand.go index aa2c2f64047..7f9fda5b489 100644 --- a/sdk/metric/internal/exemplar/rand.go +++ b/sdk/metric/internal/exemplar/rand.go @@ -193,8 +193,3 @@ func (r *randRes[N]) Collect(dest *[]metricdata.Exemplar[N]) { // measurements that are made over the older collection cycle ones. r.reset() } - -func (r *randRes[N]) Flush(dest *[]metricdata.Exemplar[N]) { - r.storage.Flush(dest) - r.reset() -} diff --git a/sdk/metric/internal/exemplar/reservoir.go b/sdk/metric/internal/exemplar/reservoir.go index b3654414ee7..7d5276a3411 100644 --- a/sdk/metric/internal/exemplar/reservoir.go +++ b/sdk/metric/internal/exemplar/reservoir.go @@ -39,13 +39,6 @@ type Reservoir[N int64 | float64] interface { // Collect returns all the held exemplars. // - // The Reservoir state is preserved after this call. See Flush to - // copy-and-clear instead. + // The Reservoir state is preserved after this call. Collect(dest *[]metricdata.Exemplar[N]) - - // Flush returns all the held exemplars. - // - // The Reservoir state is reset after this call. See Collect to preserve - // the state instead. - Flush(dest *[]metricdata.Exemplar[N]) } diff --git a/sdk/metric/internal/exemplar/reservoir_test.go b/sdk/metric/internal/exemplar/reservoir_test.go index 41c90b7fed7..65c179dc106 100644 --- a/sdk/metric/internal/exemplar/reservoir_test.go +++ b/sdk/metric/internal/exemplar/reservoir_test.go @@ -92,25 +92,6 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { assert.Equal(t, want, dest[0]) }) - t.Run("CollectDoesNotFlush", func(t *testing.T) { - t.Helper() - - r, n := f(1) - if n < 1 { - t.Skip("skipping, reservoir capacity less than 1:", n) - } - - r.Offer(ctx, staticTime, 10, nil) - - var dest []metricdata.Exemplar[N] - r.Collect(&dest) - require.Len(t, dest, 1, "number of collected exemplars") - - dest = dest[:0] - r.Collect(&dest) - assert.Len(t, dest, 1, "Collect flushed reservoir") - }) - t.Run("CollectLessThanN", func(t *testing.T) { t.Helper() @@ -127,24 +108,6 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { require.Len(t, dest, 1, "number of collected exemplars") }) - t.Run("FlushFlushes", func(t *testing.T) { - t.Helper() - - r, n := f(1) - if n < 1 { - t.Skip("skipping, reservoir capacity less than 1:", n) - } - - r.Offer(ctx, staticTime, 10, nil) - - var dest []metricdata.Exemplar[N] - r.Flush(&dest) - require.Len(t, dest, 1, "number of flushed exemplars") - - r.Flush(&dest) - assert.Len(t, dest, 0, "Flush did not flush reservoir") - }) - t.Run("MultipleOffers", func(t *testing.T) { t.Helper() @@ -159,17 +122,17 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { } var dest []metricdata.Exemplar[N] - r.Flush(&dest) + r.Collect(&dest) assert.Len(t, dest, n, "multiple offers did not fill reservoir") - // Ensure the flush reset also resets any couting state. + // Ensure the collect reset also resets any couting state. for i := 0; i < n+1; i++ { - v := N(2 * i) + v := N(i) r.Offer(ctx, staticTime, v, nil) } dest = dest[:0] - r.Flush(&dest) + r.Collect(&dest) assert.Len(t, dest, n, "internal count state not reset") }) @@ -186,11 +149,6 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { dest := []metricdata.Exemplar[N]{{}} // Should be reset to empty. r.Collect(&dest) assert.Len(t, dest, 0, "no exemplars should be collected") - - r.Offer(context.Background(), staticTime, 10, nil) - dest = []metricdata.Exemplar[N]{{}} // Should be reset to empty. - r.Flush(&dest) - assert.Len(t, dest, 0, "no exemplars should be flushed") }) } } diff --git a/sdk/metric/internal/exemplar/storage.go b/sdk/metric/internal/exemplar/storage.go index 460b8196d06..e2c2b90a351 100644 --- a/sdk/metric/internal/exemplar/storage.go +++ b/sdk/metric/internal/exemplar/storage.go @@ -38,8 +38,7 @@ func newStorage[N int64 | float64](n int) *storage[N] { // Collect returns all the held exemplars. // -// The Reservoir state is preserved after this call. See Flush to -// copy-and-clear instead. +// The Reservoir state is preserved after this call. func (r *storage[N]) Collect(dest *[]metricdata.Exemplar[N]) { *dest = reset(*dest, len(r.store), len(r.store)) var n int @@ -54,27 +53,6 @@ func (r *storage[N]) Collect(dest *[]metricdata.Exemplar[N]) { *dest = (*dest)[:n] } -// Flush returns all the held exemplars. -// -// The Reservoir state is reset after this call. See Collect to preserve the -// state instead. -func (r *storage[N]) Flush(dest *[]metricdata.Exemplar[N]) { - *dest = reset(*dest, len(r.store), len(r.store)) - var n int - for i, m := range r.store { - if !m.valid { - continue - } - - m.Exemplar(&(*dest)[n]) - n++ - - // Reset. - r.store[i] = measurement[N]{} - } - *dest = (*dest)[:n] -} - // measurement is a measurement made by a telemetry system. type measurement[N int64 | float64] struct { // FilteredAttributes are the attributes dropped during the measurement. From 569854e1d1fa981b01c16cc56a27cac6a123c0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pos=C5=82uszny?= Date: Thu, 1 Feb 2024 18:58:42 +0100 Subject: [PATCH 844/886] sdk/metric/metricdata: Add MarshalJSON for Extrema (#4827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * json marshal for Extrema type, makefile typo fix * MarshalText implementation, cleanup * update changelog * changelog fix * Update CHANGELOG.md * MarshalText behavior update on invalid Extrema * Fix Marshal outputs json text representation of nil * Updated mockData to include example with Min and Max values. * null value test, changelog fix --------- Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn Co-authored-by: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> --- CHANGELOG.md | 1 + exporters/stdout/stdoutmetric/example_test.go | 63 ++++++++++++++++++- sdk/metric/metricdata/data.go | 14 +++++ .../metricdatatest/assertion_test.go | 24 +++++++ 4 files changed, 100 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1437444568a..8b1b82d8296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) - Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) +- Fix missing Mix and Max values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for type `Extrema` in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) ## [1.23.0-rc.1] 2024-01-18 diff --git a/exporters/stdout/stdoutmetric/example_test.go b/exporters/stdout/stdoutmetric/example_test.go index 683d6ee0fe5..3086c064d01 100644 --- a/exporters/stdout/stdoutmetric/example_test.go +++ b/exporters/stdout/stdoutmetric/example_test.go @@ -77,6 +77,27 @@ var ( }, }, }, + { + Name: "requests.size", + Description: "Size of received requests", + Unit: "kb", + Data: metricdata.Histogram[int64]{ + Temporality: metricdata.DeltaTemporality, + DataPoints: []metricdata.HistogramDataPoint[int64]{ + { + Attributes: attribute.NewSet(attribute.String("server", "central")), + StartTime: now, + Time: now.Add(1 * time.Second), + Count: 10, + Bounds: []float64{1, 5, 10}, + BucketCounts: []uint64{1, 3, 6, 0}, + Sum: 128, + Min: metricdata.NewExtrema[int64](3), + Max: metricdata.NewExtrema[int64](30), + }, + }, + }, + }, { Name: "latency", Description: "Time spend processing received requests", @@ -228,6 +249,44 @@ func Example() { // } // }, // { + // "Name": "requests.size", + // "Description": "Size of received requests", + // "Unit": "kb", + // "Data": { + // "DataPoints": [ + // { + // "Attributes": [ + // { + // "Key": "server", + // "Value": { + // "Type": "STRING", + // "Value": "central" + // } + // } + // ], + // "StartTime": "0001-01-01T00:00:00Z", + // "Time": "0001-01-01T00:00:00Z", + // "Count": 10, + // "Bounds": [ + // 1, + // 5, + // 10 + // ], + // "BucketCounts": [ + // 1, + // 3, + // 6, + // 0 + // ], + // "Min": 3, + // "Max": 30, + // "Sum": 128 + // } + // ], + // "Temporality": "DeltaTemporality" + // } + // }, + // { // "Name": "latency", // "Description": "Time spend processing received requests", // "Unit": "ms", @@ -257,8 +316,8 @@ func Example() { // 6, // 0 // ], - // "Min": {}, - // "Max": {}, + // "Min": null, + // "Max": null, // "Sum": 57 // } // ], diff --git a/sdk/metric/metricdata/data.go b/sdk/metric/metricdata/data.go index 995d42b38f1..32c17934fc4 100644 --- a/sdk/metric/metricdata/data.go +++ b/sdk/metric/metricdata/data.go @@ -15,6 +15,7 @@ package metricdata // import "go.opentelemetry.io/otel/sdk/metric/metricdata" import ( + "encoding/json" "time" "go.opentelemetry.io/otel/attribute" @@ -211,6 +212,19 @@ type Extrema[N int64 | float64] struct { valid bool } +// MarshalText converts the Extrema value to text. +func (e Extrema[N]) MarshalText() ([]byte, error) { + if !e.valid { + return json.Marshal(nil) + } + return json.Marshal(e.value) +} + +// MarshalJSON converts the Extrema value to JSON number. +func (e *Extrema[N]) MarshalJSON() ([]byte, error) { + return e.MarshalText() +} + // NewExtrema returns an Extrema set to v. func NewExtrema[N int64 | float64](v N) Extrema[N] { return Extrema[N]{value: v, valid: true} diff --git a/sdk/metric/metricdata/metricdatatest/assertion_test.go b/sdk/metric/metricdata/metricdatatest/assertion_test.go index 9d647a54004..4219375c4ba 100644 --- a/sdk/metric/metricdata/metricdatatest/assertion_test.go +++ b/sdk/metric/metricdata/metricdatatest/assertion_test.go @@ -15,6 +15,7 @@ package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" import ( + "encoding/json" "testing" "time" @@ -164,6 +165,8 @@ var ( minFloat64C = metricdata.NewExtrema(-1.) minInt64C = metricdata.NewExtrema[int64](-1) + minFloat64D = metricdata.NewExtrema(-9.999999) + histogramDataPointInt64A = metricdata.HistogramDataPoint[int64]{ Attributes: attrA, StartTime: startA, @@ -1010,3 +1013,24 @@ func TestAssertAttributesFail(t *testing.T) { } assert.False(t, AssertHasAttributes(fakeT, sum, attribute.Bool("A", true))) } + +func AssertMarshal[N int64 | float64](t *testing.T, expected string, i *metricdata.Extrema[N]) { + t.Helper() + + b, err := json.Marshal(i) + assert.NoError(t, err) + assert.Equal(t, expected, string(b)) +} + +func TestAssertMarshal(t *testing.T) { + AssertMarshal(t, "null", &metricdata.Extrema[int64]{}) + + AssertMarshal(t, "-1", &minFloat64A) + AssertMarshal(t, "3", &minFloat64B) + AssertMarshal(t, "-9.999999", &minFloat64D) + AssertMarshal(t, "99", &maxFloat64B) + + AssertMarshal(t, "-1", &minInt64A) + AssertMarshal(t, "3", &minInt64B) + AssertMarshal(t, "99", &maxInt64B) +} From f4e1e043167554ab8df178338bb50a1190ffc06c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 07:39:36 -0800 Subject: [PATCH 845/886] Bump lycheeverse/lychee-action from 1.9.2 to 1.9.3 (#4882) Bumps [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) from 1.9.2 to 1.9.3. - [Release notes](https://github.com/lycheeverse/lychee-action/releases) - [Commits](https://github.com/lycheeverse/lychee-action/compare/v1.9.2...v1.9.3) --- updated-dependencies: - dependency-name: lycheeverse/lychee-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/links-fail-fast.yml | 2 +- .github/workflows/links.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links-fail-fast.yml b/.github/workflows/links-fail-fast.yml index 8b211af5400..12793a196cb 100644 --- a/.github/workflows/links-fail-fast.yml +++ b/.github/workflows/links-fail-fast.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/checkout@v4 - name: Link Checker - uses: lycheeverse/lychee-action@v1.9.2 + uses: lycheeverse/lychee-action@v1.9.3 with: fail: true diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 59ed13d6055..222318339ad 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -16,7 +16,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v1.9.2 + uses: lycheeverse/lychee-action@v1.9.3 - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 From 2c7761d3b0e819b8133029ab88ff53e39c725ded Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 07:24:48 -0800 Subject: [PATCH 846/886] Bump benchmark-action/github-action-benchmark from 1.19.2 to 1.19.3 (#4883) Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.19.2 to 1.19.3. - [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases) - [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md) - [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.19.2...v1.19.3) --- updated-dependencies: - dependency-name: benchmark-action/github-action-benchmark dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 638ec8b4cc3..f2da11a68c4 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -27,7 +27,7 @@ jobs: path: ./benchmarks key: ${{ runner.os }}-benchmark - name: Store benchmarks result - uses: benchmark-action/github-action-benchmark@v1.19.2 + uses: benchmark-action/github-action-benchmark@v1.19.3 with: name: Benchmarks tool: 'go' From eabcef4c2da6149b7e6dbbb8b7294402fcc287c1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 5 Feb 2024 07:33:29 -0800 Subject: [PATCH 847/886] Return merged Resource on schema conflict (#4876) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Return merged Resource on schema conflict * Add changes to changelog * Doc returned resource to have no schema URL * Refactor Merge based on feedback * Add the schema URLs to the returned error * Ensure no schema URL when merge conflict on detect * Replaced isErr with wantErr in TestNew * Update sdk/resource/auto_test.go Co-authored-by: Robert Pająk * Update TestDetect based on feedback --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 9 ++++ sdk/resource/auto.go | 25 ++++++++++- sdk/resource/auto_test.go | 80 ++++++++++++++++++++++++++--------- sdk/resource/resource.go | 77 ++++++++++++++++++++++----------- sdk/resource/resource_test.go | 32 +++++++++----- 5 files changed, 166 insertions(+), 57 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b1b82d8296..7cbd34d225b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) - Experimental exemplar exporting is added to the metric SDK. See [metric documentation](./sdk/metric/EXPERIMENTAL.md#exemplars) for more information about this feature and how to enable it. (#4871) +- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attepted. (#4876) + +### Changed + +- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict. + Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned. + It is up to the user to decide if they want to use the returned `Resource` or not. + It may have desired attributes overwritten or include stale semantic conventions. (#4876) ### Fixed diff --git a/sdk/resource/auto.go b/sdk/resource/auto.go index 4279013be88..aed756c5e70 100644 --- a/sdk/resource/auto.go +++ b/sdk/resource/auto.go @@ -41,8 +41,20 @@ type Detector interface { // must never be done outside of a new major release. } -// Detect calls all input detectors sequentially and merges each result with the previous one. -// It returns the merged error too. +// Detect returns a new [Resource] merged from all the Resources each of the +// detectors produces. Each of the detectors are called sequentially, in the +// order they are passed, merging the produced resource into the previous. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if that error is returned from a detector. It may also +// return a merge-conflicting Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from different detectors results +// in a schema URL conflict. It is up to the caller to determine if this +// returned Resource should be used or not. +// +// If one of the detectors returns an error that is not [ErrPartialResource], +// the resource produced by the detector will not be merged and the returned +// error will wrap that detector's error. func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { r := new(Resource) return r, detect(ctx, r, detectors) @@ -50,6 +62,10 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) { // detect runs all detectors using ctx and merges the result into res. This // assumes res is allocated and not nil, it will panic otherwise. +// +// If the detectors or merging resources produces any errors (i.e. +// [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of +// these errors will be returned. Otherwise, nil is returned. func detect(ctx context.Context, res *Resource, detectors []Detector) error { var ( r *Resource @@ -78,6 +94,11 @@ func detect(ctx context.Context, res *Resource, detectors []Detector) error { if len(errs) == 0 { return nil } + if errors.Is(errs, ErrSchemaURLConflict) { + // If there has been a merge conflict, ensure the resource has no + // schema URL. + res.schemaURL = "" + } return errs } diff --git a/sdk/resource/auto_test.go b/sdk/resource/auto_test.go index 885aa93ed71..fac62f3a344 100644 --- a/sdk/resource/auto_test.go +++ b/sdk/resource/auto_test.go @@ -16,47 +16,89 @@ package resource_test import ( "context" + "errors" "fmt" - "os" "testing" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - semconv "go.opentelemetry.io/otel/semconv/v1.24.0" ) +type detector struct { + SchemaURL string + Attributes []attribute.KeyValue +} + +func newDetector(schemaURL string, attrs ...attribute.KeyValue) resource.Detector { + return detector{schemaURL, attrs} +} + +func (d detector) Detect(context.Context) (*resource.Resource, error) { + return resource.NewWithAttributes(d.SchemaURL, d.Attributes...), nil +} + func TestDetect(t *testing.T) { + v130 := "https://opentelemetry.io/schemas/1.3.0" + v140 := "https://opentelemetry.io/schemas/1.4.0" + v150 := "https://opentelemetry.io/schemas/1.5.0" + + alice := attribute.String("name", "Alice") + bob := attribute.String("name", "Bob") + carol := attribute.String("name", "Carol") + + admin := attribute.Bool("admin", true) + user := attribute.Bool("admin", false) + cases := []struct { - name string - schema1, schema2 string - isErr bool + name string + detectors []resource.Detector + want *resource.Resource + wantErr error }{ { - name: "different schema urls", - schema1: "https://opentelemetry.io/schemas/1.3.0", - schema2: "https://opentelemetry.io/schemas/1.4.0", - isErr: true, + name: "two different schema urls", + detectors: []resource.Detector{ + newDetector(v130, alice, admin), + newDetector(v140, bob, user), + }, + want: resource.NewSchemaless(bob, user), + wantErr: resource.ErrSchemaURLConflict, + }, + { + name: "three different schema urls", + detectors: []resource.Detector{ + newDetector(v130, alice, admin), + newDetector(v140, bob, user), + newDetector(v150, carol), + }, + want: resource.NewSchemaless(carol, user), + wantErr: resource.ErrSchemaURLConflict, }, { - name: "same schema url", - schema1: "https://opentelemetry.io/schemas/1.4.0", - schema2: "https://opentelemetry.io/schemas/1.4.0", - isErr: false, + name: "same schema url", + detectors: []resource.Detector{ + newDetector(v140, alice, admin), + newDetector(v140, bob, user), + }, + want: resource.NewWithAttributes(v140, bob, user), }, } for _, c := range cases { t.Run(fmt.Sprintf("case-%s", c.name), func(t *testing.T) { - d1 := resource.StringDetector(c.schema1, semconv.HostNameKey, os.Hostname) - d2 := resource.StringDetector(c.schema2, semconv.HostNameKey, os.Hostname) - r, err := resource.Detect(context.Background(), d1, d2) - assert.NotNil(t, r) - if c.isErr { - assert.Error(t, err) + r, err := resource.Detect(context.Background(), c.detectors...) + if c.wantErr != nil { + assert.ErrorIs(t, err, c.wantErr) + if errors.Is(c.wantErr, resource.ErrSchemaURLConflict) { + assert.Zero(t, r.SchemaURL()) + } } else { assert.NoError(t, err) } + assert.Equal(t, c.want.SchemaURL(), r.SchemaURL()) + assert.ElementsMatch(t, c.want.Attributes(), r.Attributes()) }) } } diff --git a/sdk/resource/resource.go b/sdk/resource/resource.go index 8c69ba25a4f..cb1ee0a9ceb 100644 --- a/sdk/resource/resource.go +++ b/sdk/resource/resource.go @@ -17,6 +17,7 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource" import ( "context" "errors" + "fmt" "sync" "go.opentelemetry.io/otel" @@ -40,9 +41,20 @@ var ( defaultResourceOnce sync.Once ) -var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflicting Schema URL") +// ErrSchemaURLConflict is an error returned when two Resources are merged +// together that contain different, non-empty, schema URLs. +var ErrSchemaURLConflict = errors.New("conflicting Schema URL") -// New returns a Resource combined from the user-provided detectors. +// New returns a [Resource] built using opts. +// +// This may return a partial Resource along with an error containing +// [ErrPartialResource] if options that provide a [Detector] are used and that +// error is returned from one or more of the Detectors. It may also return a +// merge-conflict Resource along with an error containing +// [ErrSchemaURLConflict] if merging Resources from the opts results in a +// schema URL conflict (see [Resource.Merge] for more information). It is up to +// the caller to determine if this returned Resource should be used or not +// based on these errors. func New(ctx context.Context, opts ...Option) (*Resource, error) { cfg := config{} for _, opt := range opts { @@ -146,16 +158,29 @@ func (r *Resource) Equal(eq *Resource) bool { return r.Equivalent() == eq.Equivalent() } -// Merge creates a new resource by combining resource a and b. +// Merge creates a new [Resource] by merging a and b. +// +// If there are common keys between a and b, then the value from b will +// overwrite the value from a, even if b's value is empty. // -// If there are common keys between resource a and b, then the value -// from resource b will overwrite the value from resource a, even -// if resource b's value is empty. +// The SchemaURL of the resources will be merged according to the +// [OpenTelemetry specification rules]: // -// The SchemaURL of the resources will be merged according to the spec rules: -// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge -// If the resources have different non-empty schemaURL an empty resource and an error -// will be returned. +// - If a's schema URL is empty then the returned Resource's schema URL will +// be set to the schema URL of b, +// - Else if b's schema URL is empty then the returned Resource's schema URL +// will be set to the schema URL of a, +// - Else if the schema URLs of a and b are the same then that will be the +// schema URL of the returned Resource, +// - Else this is a merging error. If the resources have different, +// non-empty, schema URLs an error containing [ErrSchemaURLConflict] will +// be returned with the merged Resource. The merged Resource will have an +// empty schema URL. It may be the case that some unintended attributes +// have been overwritten or old semantic conventions persisted in the +// returned Resource. It is up to the caller to determine if this returned +// Resource should be used or not. +// +// [OpenTelemetry specification rules]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge func Merge(a, b *Resource) (*Resource, error) { if a == nil && b == nil { return Empty(), nil @@ -167,19 +192,6 @@ func Merge(a, b *Resource) (*Resource, error) { return a, nil } - // Merge the schema URL. - var schemaURL string - switch true { - case a.schemaURL == "": - schemaURL = b.schemaURL - case b.schemaURL == "": - schemaURL = a.schemaURL - case a.schemaURL == b.schemaURL: - schemaURL = a.schemaURL - default: - return Empty(), errMergeConflictSchemaURL - } - // Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key() // Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...) mi := attribute.NewMergeIterator(b.Set(), a.Set()) @@ -187,8 +199,23 @@ func Merge(a, b *Resource) (*Resource, error) { for mi.Next() { combine = append(combine, mi.Attribute()) } - merged := NewWithAttributes(schemaURL, combine...) - return merged, nil + + switch { + case a.schemaURL == "": + return NewWithAttributes(b.schemaURL, combine...), nil + case b.schemaURL == "": + return NewWithAttributes(a.schemaURL, combine...), nil + case a.schemaURL == b.schemaURL: + return NewWithAttributes(a.schemaURL, combine...), nil + } + // Return the merged resource with an appropriate error. It is up to + // the user to decide if the returned resource can be used or not. + return NewSchemaless(combine...), fmt.Errorf( + "%w: %s and %s", + ErrSchemaURLConflict, + a.schemaURL, + b.schemaURL, + ) } // Empty returns an instance of Resource with no attributes. It is diff --git a/sdk/resource/resource_test.go b/sdk/resource/resource_test.go index baed4a31336..de5cd9a7c2a 100644 --- a/sdk/resource/resource_test.go +++ b/sdk/resource/resource_test.go @@ -183,7 +183,7 @@ func TestMerge(t *testing.T) { name: "Merge with different schemas", a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv41), b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0", kv42), - want: nil, + want: []attribute.KeyValue{kv42}, isErr: true, }, } @@ -324,7 +324,7 @@ func TestNew(t *testing.T) { resourceValues map[string]string schemaURL string - isErr bool + wantErr error }{ { name: "No Options returns empty resource", @@ -406,9 +406,14 @@ func TestNew(t *testing.T) { ), resource.WithSchemaURL("https://opentelemetry.io/schemas/1.1.0"), }, - resourceValues: map[string]string{}, - schemaURL: "", - isErr: true, + resourceValues: map[string]string{ + string(semconv.HostNameKey): func() (hostname string) { + hostname, _ = os.Hostname() + return hostname + }(), + }, + schemaURL: "", + wantErr: resource.ErrSchemaURLConflict, }, { name: "With conflicting detector schema urls", @@ -420,9 +425,14 @@ func TestNew(t *testing.T) { ), resource.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"), }, - resourceValues: map[string]string{}, - schemaURL: "", - isErr: true, + resourceValues: map[string]string{ + string(semconv.HostNameKey): func() (hostname string) { + hostname, _ = os.Hostname() + return hostname + }(), + }, + schemaURL: "", + wantErr: resource.ErrSchemaURLConflict, }, } for _, tt := range tc { @@ -436,10 +446,10 @@ func TestNew(t *testing.T) { ctx := context.Background() res, err := resource.New(ctx, tt.options...) - if tt.isErr { - require.Error(t, err) + if tt.wantErr != nil { + assert.ErrorIs(t, err, tt.wantErr) } else { - require.NoError(t, err) + assert.NoError(t, err) } require.EqualValues(t, tt.resourceValues, toMap(res)) From e3eb3f7538e790a853c3ce210cf48123ddd5ca20 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 6 Feb 2024 07:50:39 -0800 Subject: [PATCH 848/886] Release v1.23.0/v0.45.1 (#4885) * Bump versions.yaml * Prepare stable-v1 for version v1.23.0 * Prepare experimental-metrics for version v0.45.1 * Update changelog * Update CHANGELOG.md --- CHANGELOG.md | 20 ++++++++++++++++--- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 +++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 ++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 +++++++-------- example/otel-collector/go.mod | 12 +++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 +++++------ example/zipkin/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 34 files changed, 140 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cbd34d225b..ea1f723e264 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,26 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.23.0] 2024-02-06 + +This release contains the first stable, `v1`, release of the following modules: + +- `go.opentelemetry.io/otel/bridge/opencensus` +- `go.opentelemetry.io/otel/bridge/opencensus/test` +- `go.opentelemetry.io/otel/example/opencensus` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` + +See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. + ### Added - Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) - Experimental exemplar exporting is added to the metric SDK. See [metric documentation](./sdk/metric/EXPERIMENTAL.md#exemplars) for more information about this feature and how to enable it. (#4871) - `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. - This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attepted. (#4876) + This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) ### Changed @@ -27,7 +40,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449) - Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820) -- Fix missing Mix and Max values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for type `Extrema` in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) +- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827) ## [1.23.0-rc.1] 2024-01-18 @@ -2810,7 +2823,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.0-rc.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.0...HEAD +[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 [1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 [1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 [1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 4fa97f7e707..c00ae5cda6b 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 28216355549..84506b0c315 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/bridge/opencensus v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index a42ef920028..77a76e3578a 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 98bdc956b0d..d9d88c7dbf8 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 23c3ab2f4f8..cb17362dcc1 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/bridge/opentracing v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/bridge/opentracing v1.23.0 google.golang.org/grpc v1.61.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index 5b2ce015e6c..82df30d0cbd 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 - go.opentelemetry.io/otel/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 + go.opentelemetry.io/otel/metric v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index cb5d9c7fdc0..456bdc56bd0 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 4edd1bed577..b39bf29329a 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/bridge/opencensus v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/bridge/opencensus v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7d25c3981b9..42edd1ab301 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 google.golang.org/grpc v1.61.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index b6083e0361f..26742dddf02 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index b77582bf2d2..44cc19a28f7 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/prometheus v0.45.0 - go.opentelemetry.io/otel/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/prometheus v0.45.1 + go.opentelemetry.io/otel/metric v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 ) require ( @@ -19,8 +19,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/sdk v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index c53409024a8..2070f70377d 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/zipkin v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/zipkin v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index d755e64760b..816f496ba2e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.61.0 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index 6f1dfc9e9f0..475c8e8cc55 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index cbddfd5cb2f..7a1534285cf 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 0cf47937c05..8591114012b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 11da29b0356..31764fe2607 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/protobuf v1.32.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 16d13d03280..cd71d14f286 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 4b3766d24f8..6c26efbc863 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 7364f4385bd..1d00766c6b9 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 3d54dcdf8c2..9aa1f532b1b 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/metric v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 google.golang.org/protobuf v1.32.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 01648f480a8..dbde2c450d3 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk/metric v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/sdk/metric v1.23.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 58a160c706d..9a985317aa1 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 758ddc9142c..189eed2db41 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 1cc29d78f85..9b1290a4c90 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel/metric v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( diff --git a/metric/go.mod b/metric/go.mod index b520e155824..40e56b8d541 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 1086655bd02..e87270f2f77 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 golang.org/x/sys v0.16.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0-rc.1 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index da93f6e68e5..d2120afc678 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,10 +6,10 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 - go.opentelemetry.io/otel/metric v1.23.0-rc.1 - go.opentelemetry.io/otel/sdk v1.23.0-rc.1 - go.opentelemetry.io/otel/trace v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel/metric v1.23.0 + go.opentelemetry.io/otel/sdk v1.23.0 + go.opentelemetry.io/otel/trace v1.23.0 ) require ( diff --git a/sdk/metric/version.go b/sdk/metric/version.go index a0dd6dd6509..4f916d71fec 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/sdk/version.go b/sdk/version.go index 91a9a99a9d0..c340d2690ae 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/trace/go.mod b/trace/go.mod index b03d03cf202..338679d0fc9 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0-rc.1 + go.opentelemetry.io/otel v1.23.0 ) require ( diff --git a/version.go b/version.go index 1ed52e2e20c..38ba951ed79 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.23.0-rc.1" + return "1.23.0" } diff --git a/versions.yaml b/versions.yaml index 058e515c8ca..028393f078d 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.23.0-rc.1 + version: v1.23.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -40,7 +40,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.45.0 + version: v0.45.1 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/prometheus From 11ebd19c46c39896a790db15825d7c769c52577f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 7 Feb 2024 11:59:58 -0800 Subject: [PATCH 849/886] Fix callback registration bug (#4888) * Fix cback reg bug Register all callbacks not just the last passed. * Add changelog entry --- CHANGELOG.md | 4 ++ sdk/metric/meter.go | 6 +- sdk/metric/meter_test.go | 128 +++++++++++++++++++++++++++------------ 3 files changed, 98 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea1f723e264..c7d94884622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Fixed + +- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) + ## [1.23.0] 2024-02-06 This release contains the first stable, `v1`, release of the following modules: diff --git a/sdk/metric/meter.go b/sdk/metric/meter.go index 88710563517..beb7876ec40 100644 --- a/sdk/metric/meter.go +++ b/sdk/metric/meter.go @@ -148,7 +148,8 @@ func (m *meter) int64ObservableInstrument(id Instrument, callbacks []metric.Int6 inst.appendMeasures(in) for _, cback := range callbacks { inst := int64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + fn := cback + insert.addCallback(func(ctx context.Context) error { return fn(ctx, inst) }) } } return inst, validateInstrumentName(id.Name) @@ -281,7 +282,8 @@ func (m *meter) float64ObservableInstrument(id Instrument, callbacks []metric.Fl inst.appendMeasures(in) for _, cback := range callbacks { inst := float64Observer{measures: in} - insert.addCallback(func(ctx context.Context) error { return cback(ctx, inst) }) + fn := cback + insert.addCallback(func(ctx context.Context) error { return fn(ctx, inst) }) } } return inst, validateInstrumentName(id.Name) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 037f0cad555..5bec7c2ce38 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -174,8 +174,18 @@ func TestMeterCreatesInstruments(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() - attrs := attribute.NewSet(attribute.String("name", "alice")) - opt := metric.WithAttributeSet(attrs) + alice := attribute.NewSet( + attribute.String("name", "Alice"), + attribute.Bool("admin", true), + ) + optAlice := metric.WithAttributeSet(alice) + + bob := attribute.NewSet( + attribute.String("name", "Bob"), + attribute.Bool("admin", false), + ) + optBob := metric.WithAttributeSet(bob) + testCases := []struct { name string fn func(*testing.T, metric.Meter) @@ -184,11 +194,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Int64Observer) error { - o.Observe(4, opt) - return nil - } - ctr, err := m.Int64ObservableCounter("aint", metric.WithInt64Callback(cback)) + ctr, err := m.Int64ObservableCounter( + "aint", + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 3) @@ -202,7 +218,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 3}, }, }, @@ -211,11 +228,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Int64Observer) error { - o.Observe(4, opt) - return nil - } - ctr, err := m.Int64ObservableUpDownCounter("aint", metric.WithInt64Callback(cback)) + ctr, err := m.Int64ObservableUpDownCounter( + "aint", + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(ctr, 11) @@ -229,7 +252,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 11}, }, }, @@ -238,11 +262,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableInt64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Int64Observer) error { - o.Observe(4, opt) - return nil - } - gauge, err := m.Int64ObservableGauge("agauge", metric.WithInt64Callback(cback)) + gauge, err := m.Int64ObservableGauge( + "agauge", + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveInt64(gauge, 11) @@ -254,7 +284,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 11}, }, }, @@ -263,11 +294,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Count", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Float64Observer) error { - o.Observe(4, opt) - return nil - } - ctr, err := m.Float64ObservableCounter("afloat", metric.WithFloat64Callback(cback)) + ctr, err := m.Float64ObservableCounter( + "afloat", + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 3) @@ -281,7 +318,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: true, DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 3}, }, }, @@ -290,11 +328,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64UpDownCount", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Float64Observer) error { - o.Observe(4, opt) - return nil - } - ctr, err := m.Float64ObservableUpDownCounter("afloat", metric.WithFloat64Callback(cback)) + ctr, err := m.Float64ObservableUpDownCounter( + "afloat", + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(ctr, 11) @@ -308,7 +352,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Temporality: metricdata.CumulativeTemporality, IsMonotonic: false, DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 11}, }, }, @@ -317,11 +362,17 @@ func TestMeterCreatesInstruments(t *testing.T) { { name: "ObservableFloat64Gauge", fn: func(t *testing.T, m metric.Meter) { - cback := func(_ context.Context, o metric.Float64Observer) error { - o.Observe(4, opt) - return nil - } - gauge, err := m.Float64ObservableGauge("agauge", metric.WithFloat64Callback(cback)) + gauge, err := m.Float64ObservableGauge( + "agauge", + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(4, optAlice) + return nil + }), + metric.WithFloat64Callback(func(_ context.Context, o metric.Float64Observer) error { + o.Observe(5, optBob) + return nil + }), + ) assert.NoError(t, err) _, err = m.RegisterCallback(func(_ context.Context, o metric.Observer) error { o.ObserveFloat64(gauge, 11) @@ -333,7 +384,8 @@ func TestMeterCreatesInstruments(t *testing.T) { Name: "agauge", Data: metricdata.Gauge[float64]{ DataPoints: []metricdata.DataPoint[float64]{ - {Attributes: attrs, Value: 4}, + {Attributes: alice, Value: 4}, + {Attributes: bob, Value: 5}, {Value: 11}, }, }, From c5b112f31b518230277ba21cd98f4391faaec2ca Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 7 Feb 2024 12:41:47 -0800 Subject: [PATCH 850/886] Release v1.23.1/v0.43.2 (#4892) * Bump versions.yaml * Prepare stable-v1 for version v1.23.1 * Prepare experimental-metrics for version v0.45.2 * Add changes to changelog --- CHANGELOG.md | 5 ++++- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 34 files changed, 127 insertions(+), 124 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d94884622..5422ca7dccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.23.1] 2024-02-07 + ### Fixed - Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888) @@ -2827,7 +2829,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.0...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.1...HEAD +[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 [1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 [1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 [1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index c00ae5cda6b..9b462cd52c9 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 84506b0c315..634a2e7f84f 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/bridge/opencensus v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/bridge/opencensus v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/sdk/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 77a76e3578a..563823144eb 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index d9d88c7dbf8..62e08b7f15b 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index cb17362dcc1..d791665784b 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/bridge/opentracing v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/bridge/opentracing v1.23.1 google.golang.org/grpc v1.61.0 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index 82df30d0cbd..d8812b874c5 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 - go.opentelemetry.io/otel/metric v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 456bdc56bd0..ce6a8b5308f 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index b39bf29329a..3a50dbfcd80 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/bridge/opencensus v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/bridge/opencensus v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 42edd1ab301..1ecf55710ce 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 google.golang.org/grpc v1.61.0 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 26742dddf02..a211165257a 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 44cc19a28f7..ff8f2ececb0 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/prometheus v0.45.1 - go.opentelemetry.io/otel/metric v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/prometheus v0.45.2 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 ) require ( @@ -19,8 +19,8 @@ require ( github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/sdk v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/sdk v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 2070f70377d..385e327f941 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/zipkin v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/zipkin v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 816f496ba2e..2f3be7fa09c 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.61.0 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index 475c8e8cc55..cb6217ce5f6 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 7a1534285cf..3194350f3fb 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 8591114012b..776c6cdc46f 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 31764fe2607..4df97207c94 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/protobuf v1.32.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index cd71d14f286..6e589a25118 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 6c26efbc863..66aca15e36e 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.0 google.golang.org/protobuf v1.32.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 1d00766c6b9..54cda3a16a2 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 9aa1f532b1b..cdecb093ac2 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.5.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/metric v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 google.golang.org/protobuf v1.32.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index dbde2c450d3..fd44e4daa04 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/sdk/metric v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/sdk/metric v1.23.1 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index 9a985317aa1..ebed00d78b1 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 189eed2db41..023841971fb 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/sys v0.16.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 9b1290a4c90..990b6d651d0 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( diff --git a/metric/go.mod b/metric/go.mod index 40e56b8d541..8415e29b514 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel v1.23.1 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index e87270f2f77..5226d06a014 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 golang.org/x/sys v0.16.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index d2120afc678..c19fd8726b7 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,10 +6,10 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 - go.opentelemetry.io/otel/metric v1.23.0 - go.opentelemetry.io/otel/sdk v1.23.0 - go.opentelemetry.io/otel/trace v1.23.0 + go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel/metric v1.23.1 + go.opentelemetry.io/otel/sdk v1.23.1 + go.opentelemetry.io/otel/trace v1.23.1 ) require ( diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 4f916d71fec..7433bf7d410 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.23.0" + return "1.23.1" } diff --git a/sdk/version.go b/sdk/version.go index c340d2690ae..b6910a0113d 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/trace/go.mod b/trace/go.mod index 338679d0fc9..514836fa646 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.0 + go.opentelemetry.io/otel v1.23.1 ) require ( diff --git a/version.go b/version.go index 38ba951ed79..0d998bcaf31 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.23.0" + return "1.23.1" } diff --git a/versions.yaml b/versions.yaml index 028393f078d..19a73c626ad 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.23.0 + version: v1.23.1 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -40,7 +40,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.45.1 + version: v0.45.2 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/prometheus From 69b252178ed2d5e778641c8b634940448c61345c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 8 Feb 2024 09:44:35 +0100 Subject: [PATCH 851/886] Support Go 1.22 (#4890) --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 4 ++-- CHANGELOG.md | 9 +++++++++ README.md | 5 +++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index f2da11a68c4..c392312ada0 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - DEFAULT_GO_VERSION: "~1.21.3" + DEFAULT_GO_VERSION: "~1.22.0" jobs: benchmark: name: Benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35cf86fc13a..5956fa7bb33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: # backwards compatibility with the previous two minor releases and we # explicitly test our code for these versions so keeping this at prior # versions does not add value. - DEFAULT_GO_VERSION: "~1.21.3" + DEFAULT_GO_VERSION: "~1.22.0" jobs: lint: runs-on: ubuntu-latest @@ -106,7 +106,7 @@ jobs: compatibility-test: strategy: matrix: - go-version: ["~1.21.3", "~1.20.10"] + go-version: ["~1.22.0", "~1.21.3", "~1.20.10"] os: [ubuntu-latest, macos-latest, windows-latest] # GitHub Actions does not support arm* architectures on default # runners. It is possible to accomplish this with a self-hosted runner diff --git a/CHANGELOG.md b/CHANGELOG.md index 5422ca7dccd..e9f9aa5ed94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +This release is the last to support [Go 1.20]. +The next release will require at least [Go 1.21]. + +### Added + +- Support [Go 1.22]. (#4890) + ## [1.23.1] 2024-02-07 ### Fixed @@ -2907,6 +2914,8 @@ It contains api and sdk for trace and meter. [0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1 [0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0 +[Go 1.22]: https://go.dev/doc/go1.22 +[Go 1.21]: https://go.dev/doc/go1.21 [Go 1.20]: https://go.dev/doc/go1.20 [Go 1.19]: https://go.dev/doc/go1.19 [Go 1.18]: https://go.dev/doc/go1.18 diff --git a/README.md b/README.md index 44e1bfc9b5e..0682805867e 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,19 @@ Currently, this project supports the following environments. | OS | Go Version | Architecture | |---------|------------|--------------| +| Ubuntu | 1.22 | amd64 | | Ubuntu | 1.21 | amd64 | | Ubuntu | 1.20 | amd64 | +| Ubuntu | 1.22 | 386 | | Ubuntu | 1.21 | 386 | | Ubuntu | 1.20 | 386 | +| MacOS | 1.22 | amd64 | | MacOS | 1.21 | amd64 | | MacOS | 1.20 | amd64 | +| Windows | 1.22 | amd64 | | Windows | 1.21 | amd64 | | Windows | 1.20 | amd64 | +| Windows | 1.22 | 386 | | Windows | 1.21 | 386 | | Windows | 1.20 | 386 | From cfaf1f08e9dd4fa95349f7c1e753be6dee5c2aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Thu, 8 Feb 2024 11:51:43 +0100 Subject: [PATCH 852/886] resource: Add testable example (#4887) --- sdk/resource/example_test.go | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sdk/resource/example_test.go diff --git a/sdk/resource/example_test.go b/sdk/resource/example_test.go new file mode 100644 index 00000000000..4c3ee3067e4 --- /dev/null +++ b/sdk/resource/example_test.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package resource_test + +import ( + "context" + "errors" + "fmt" + "log" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/resource" +) + +func ExampleNew() { + res, err := resource.New( + context.Background(), + resource.WithFromEnv(), // Discover and provide attributes from OTEL_RESOURCE_ATTRIBUTES and OTEL_SERVICE_NAME environment variables. + resource.WithTelemetrySDK(), // Discover and provide information about the OpenTelemetry SDK used. + resource.WithProcess(), // Discover and provide process information. + resource.WithOS(), // Discover and provide OS information. + resource.WithContainer(), // Discover and provide container information. + resource.WithHost(), // Discover and provide host information. + resource.WithAttributes(attribute.String("foo", "bar")), // Add custom resource attributes. + // resource.WithDetectors(thirdparty.Detector{}), // Bring your own external Detector implementation. + ) + if errors.Is(err, resource.ErrPartialResource) || errors.Is(err, resource.ErrSchemaURLConflict) { + log.Println(err) // Log non-fatal issues. + } else if err != nil { + log.Fatalln(err) // The error may be fatal. + } + + // Now, you can use the resource (e.g. pass it to a tracer or meter provider). + fmt.Println(res.SchemaURL()) +} From c921815474a1e9832c39a499de842e5b58e594e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 9 Feb 2024 08:27:38 +0100 Subject: [PATCH 853/886] log: Add design doc (#4809) --- Makefile | 2 +- log/DESIGN.md | 781 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 782 insertions(+), 1 deletion(-) create mode 100644 log/DESIGN.md diff --git a/Makefile b/Makefile index 35fc189961b..2cedd200d3c 100644 --- a/Makefile +++ b/Makefile @@ -315,4 +315,4 @@ add-tags: | $(MULTIMOD) .PHONY: lint-markdown lint-markdown: - docker run -v "$(CURDIR):$(WORKDIR)" docker://avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md + docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md diff --git a/log/DESIGN.md b/log/DESIGN.md new file mode 100644 index 00000000000..e748c1179f1 --- /dev/null +++ b/log/DESIGN.md @@ -0,0 +1,781 @@ +# Logs Bridge API + +## Abstract + +`go.opentelemetry.io/otel/log` provides +[Logs Bridge API](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/). + +The initial version of the design and the prototype +was created in [#4725](https://github.com/open-telemetry/opentelemetry-go/pull/4725). + +## Background + +The key challenge is to create a performant API compliant with the [specification](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/) +with an intuitive and user friendly design. +Performance is seen as one of the most important characteristics of logging libraries in Go. + +## Design + +This proposed design aims to: + +- be specification compliant, +- be similar to Trace and Metrics API, +- take advantage of both OpenTelemetry and `slog` experience to achieve acceptable performance. + +### Module structure + +The API is published as a single `go.opentelemetry.io/otel/log` Go module. + +The module name is compliant with +[Artifact Naming](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md#artifact-naming) +and the package structure is the same as for Trace API and Metrics API. + +The Go module consits of the following packages: + +- `go.opentelemetry.io/otel/log` +- `go.opentelemetry.io/otel/log/embedded` +- `go.opentelemetry.io/otel/log/noop` + +Rejected alternative: + +- [Reuse slog](#reuse-slog) + +### LoggerProvider + +The [`LoggerProvider` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#loggerprovider) +is defined as an interface: + +```go +type LoggerProvider interface { + embedded.LoggerProvider + Logger(name string, options ...LoggerOption) Logger +} +``` + +The specification may add new operations to `LoggerProvider`. +The interface may have methods added without a package major version bump. +This embeds `embedded.LoggerProvider` to help inform an API implementation +author about this non-standard API evolution. +This approach is already used in Trace API and Metrics API. + +#### LoggerProvider.Logger + +The `Logger` method implements the [`Get a Logger` operation](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#get-a-logger). + +The required `name` parameter is accepted as a `string` method argument. + +The following options are defined to support optional parameters: + +```go +func WithInstrumentationVersion(version string) LoggerOption +func WithInstrumentationAttributes(attr ...attribute.KeyValue) LoggerOption +func WithSchemaURL(schemaURL string) LoggerOption +``` + +Implementation requirements: + +- The [specification requires](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#concurrency-requirements) + the method to be safe to be called concurrently. + +- The method should use some default name if the passed name is empty + in order to meet the [specification's SDK requirement](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logger-creation) + to return a working logger when an invalid name is passed + as well as to resemble the behavior of getting tracers and meters. + +`Logger` can be extended by adding new `LoggerOption` options +and adding new exported fields to the `LoggerConfig` struct. +This design is already used in Trace API for getting tracers +and in Metrics API for getting meters. + +Rejected alternative: + +- [Passing struct as parameter to LoggerProvider.Logger](#passing-struct-as-parameter-to-loggerproviderlogger). + +### Logger + +The [`Logger` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#logger) +is defined as an interface: + +```go +type Logger interface { + embedded.Logger + Emit(ctx context.Context, record Record) +} +``` + +The specification may add new operations to `Logger`. +The interface may have methods added without a package major version bump. +This embeds `embedded.Logger` to help inform an API implementation +author about this non-standard API evolution. +This approach is already used in Trace API and Metrics API. + +### Logger.Emit + +The `Emit` method implements the [`Emit a LogRecord` operation](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#emit-a-logrecord). + +[`Context` associated with the `LogRecord`](https://opentelemetry.io/docs/specs/otel/context/) +is accepted as a `context.Context` method argument. + +Calls to `Emit` are supposed to be on the hot path. +Therefore, in order to reduce the number of heap allocations, +the [`LogRecord` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#emit-a-logrecord), +is defined as a `Record` type: + +```go +type Record struct { + timestamp time.Time + observedTimestamp time.Time + severity Severity + severityText string + body Value + + // The fields below are for optimizing the implementation of + // attributes. + front [5]KeyValue + nFront int // The number of attributes in front. + back []KeyValue +} +``` + +[`Timestamp`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-timestamp) +is accessed using following methods: + +```go +func (r *Record) Timestamp() time.Time +func (r *Record) SetTimestamp(t time.Time) +``` + +[`ObservedTimestamp`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-observedtimestamp) +is accessed using following methods: + +```go +func (r *Record) ObservedTimestamp() time.Time +func (r *Record) SetObservedTimestamp(t time.Time) +``` + +[`SeverityNumber`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitynumber) +is accessed using following methods: + +```go +func (r *Record) Severity() Severity +func (r *Record) SetSeverity(s Severity) +``` + +`Severity` type is defined and constants are based on +[Displaying Severity recommendation](https://opentelemetry.io/docs/specs/otel/logs/data-model/#displaying-severity). +Additionally, `Severity[Level]1` constants are defined to make the API more readable and user friendly. + +```go +type Severity int + +const ( + SeverityTrace1 Severity = 1 // TRACE + SeverityTrace2 Severity = 2 // TRACE2 + SeverityTrace3 Severity = 3 // TRACE3 + SeverityTrace4 Severity = 4 // TRACE4 + + SeverityDebug1 Severity = 5 // DEBUG + SeverityDebug2 Severity = 6 // DEBUG2 + SeverityDebug3 Severity = 7 // DEBUG3 + SeverityDebug4 Severity = 8 // DEBUG4 + + SeverityInfo1 Severity = 9 // INFO + SeverityInfo2 Severity = 10 // INFO2 + SeverityInfo3 Severity = 11 // INFO3 + SeverityInfo4 Severity = 12 // INFO4 + + SeverityWarn1 Severity = 13 // WARN + SeverityWarn2 Severity = 14 // WARN2 + SeverityWarn3 Severity = 15 // WARN3 + SeverityWarn4 Severity = 16 // WARN4 + + SeverityError1 Severity = 17 // ERROR + SeverityError2 Severity = 18 // ERROR2 + SeverityError3 Severity = 19 // ERROR3 + SeverityError4 Severity = 20 // ERROR4 + + SeverityFatal1 Severity = 21 // FATAL + SeverityFatal2 Severity = 22 // FATAL2 + SeverityFatal3 Severity = 23 // FATAL3 + SeverityFatal4 Severity = 24 // FATAL4 + + SeverityTrace = SeverityTrace1 + SeverityDebug = SeverityDebug1 + SeverityInfo = SeverityInfo1 + SeverityWarn = SeverityWarn1 + SeverityError = SeverityError1 + SeverityFatal = SeverityFatal1 +) +``` + +[`SeverityText`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitytext) +is accessed using following methods: + +```go +func (r *Record) SeverityText() string +func (r *Record) SetSeverityText(s string) +``` + +[`Body`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-body) +is accessed using following methods: + +```go +func (r *Record) Body() Value +func (r *Record) SetBody(v Value) +``` + +[Log record attributes](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-attributes) +are accessed using following methods: + +```go +func (r *Record) WalkAttributes(f func(KeyValue) bool) +func (r *Record) AddAttributes(attrs ...KeyValue) +``` + +`Record` has a `AttributesLen` method that returns +the number of attributes to allow slice preallocation +when converting records to a different representation: + +```go +func (r *Record) AttributesLen() int +``` + +The records attributes design and implemntation is based on +[`slog.Record`](https://pkg.go.dev/log/slog#Record). +It allows achieving high-performance access and manipulation of the attributes +while keeping the API user friendly. +It relieves the user from making his own improvements +for reducing the number of allocations when passing attributes. + +The following defintions are implementing the abstractions +described in [the specification](https://opentelemetry.io/docs/specs/otel/logs/#new-first-party-application-logs): + +```go +type Value struct{} + +type Kind int + +const ( + KindEmpty Kind = iota + KindBool + KindFloat64 + KindInt64 + KindString + KindBytes + KindList + KindMap +) + +func (v Value) Kind() Kind + +// Value factories: + +func StringValue(value string) Value + +func IntValue(v int) Value + +func Int64Value(v int64) Value + +func Float64Value(v float64) Value + +func BoolValue(v bool) Value + +func BytesValue(v []byte) Value + +func ListValue(vs ...Value) Value + +func MapValue(kvs ...KeyValue) Value + +// Value accessors: + +func (v Value) AsAny() any + +func (v Value) AsString() string + +func (v Value) AsInt64() int64 + +func (v Value) AsBool() bool + +func (v Value) AsFloat64() float64 + +func (v Value) AsBytes() []byte + +func (v Value) AsList() []Value + +func (v Value) AsMap() []KeyValue + +func (v Value) Empty() bool + +// Value equality comparison: + +func (v Value) Equal(w Value) bool + + +type KeyValue struct { + Key string + Value Value +} + +// KeyValue factories: + +func String(key, value string) + +func Int64(key string, value int64) KeyValue + +func Int(key string, value int) KeyValue + +func Float64(key string, v float64) KeyValue + +func Bool(key string, v bool) KeyValue + +func Bytes(key string, v []byte) KeyValue + +func List(key string, args ...Value) KeyValue + +func Map(key string, args ...KeyValue) KeyValue + +// KeyValue equality comparison: + +func (a KeyValue) Equal(b KeyValue) bool +``` + +`Value` is representing `any`. +`KeyValue` is representing a key(string)-value(`any`) pair. + +`Kind` is an enumeration used for specifying the underlying value type. +`KindEmpty` is used for an empty (zero) value. +`KindBool` is used for boolean value. +`KindFloat64` is used for a double precision floating point (IEEE 754-1985) value. +`KindInt64` is used for a signed integer value. +`KindString` is used for a string value. +`KindBytes` is used for a slice of bytes (in spec: A byte array). +`KindList` is used for a slice of values (in spec: an array (a list) of any values). +`KindMap` is used for a slice of key-value pairs (in spec: `map`). + +These types are defined in `go.opentelemetry.io/otel/log` package +as their are tightly coupled with the API and different from common attributes. + +The internal implementation of `Value` is based on +[`slog.Value`](https://pkg.go.dev/log/slog#Value) +and the API is mostly inspired by +[`attribute.Value`](https://pkg.go.dev/go.opentelemetry.io/otel/attribute#Value). +The benchmarks[^1] show that the implementation is more performant than +[`attribute.Value`](https://pkg.go.dev/go.opentelemetry.io/otel/attribute#Value). + +The `Severity`, `Kind`, `Value`, `KeyValue` may implement +the [`fmt.Stringer`](https://pkg.go.dev/fmt#Stringer) interface. +However, it is not needed for the first stable release +and the `String` methods can be added later. + +The caller must not subsequently mutate the record passed to `Emit`. +This would allow the implementation to not clone the record, +but simply retain, modify or discard it. +The implementation may still choose to clone the record or copy its attributes +if it needs to retain or modify it, +e.g. in case of asynchronous processing to eliminate the possibility of data races, +because the user can technically reuse the record and add new attributes +after the call (even when the documentation says that the caller must not do it). + +Implementation requirements: + +- The [specification requires](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#concurrency-requirements) + the method to be safe to be called concurrently. + +- The method must not interrupt the record processing if the context is canceled + per ["ignoring context cancellation" guideline](../CONTRIBUTING.md#ignoring-context-cancellation). + +- The [specification requires](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#emit-a-logrecord) + use the current time as observed timestamp if the passed is empty. + +- The method should handle the trace context passed via `ctx` argument in order to meet the + [specification's SDK requirement](https://opentelemetry.io/docs/specs/otel/logs/sdk/#readablelogrecord) + to populate the trace context fields from the resolved context. + +`Emit` can be extended by adding new exported fields to the `Record` struct. + +Rejected alternatives: + +- [Record as interface](#record-as-interface) +- [Options as parameter to Logger.Emit](#options-as-parameter-to-loggeremit) +- [Passing record as pointer to Logger.Emit](#passing-record-as-pointer-to-loggeremit) +- [Logger.WithAttributes](#loggerwithattributes) +- [Record attributes as slice](#record-attributes-as-slice) +- [Use any instead of defining Value](#use-any-instead-of-defining-value) +- [Severity type encapsulating number and text](#severity-type-encapsulating-number-and-text) +- [Reuse attribute package](#reuse-attribute-package) +- [Mix receiver types for Record](#mix-receiver-types-for-record) +- [Add XYZ method to Logger](#add-xyz-method-to-logger) +- [Rename KeyValue to Attr](#rename-keyvalue-to-attr) + +### noop package + +The `go.opentelemetry.io/otel/log/noop` package provides +[Logs Bridge API No-Op Implementation](https://opentelemetry.io/docs/specs/otel/logs/noop/). + +### Trace context correlation + +The bridge implementation should do its best to pass +the `ctx` containing the trace context from the caller +so it can later be passed via `Logger.Emit`. + +It is not expected that users (caller or bridge implementation) reconstruct +a `context.Context`. Reconstructing a `context.Context` with +[`trace.ContextWithSpanContext`](https://pkg.go.dev/go.opentelemetry.io/otel/trace#ContextWithSpanContext) +and [`trace.NewSpanContext`](https://pkg.go.dev/go.opentelemetry.io/otel/trace#NewSpanContext) +would usually involve more memory allocations. + +The logging libraries which have recording methods that accepts `context.Context`, +such us [`slog`](https://pkg.go.dev/log/slog), +[`logrus`](https://pkg.go.dev/github.com/sirupsen/logrus), +[`zerolog`](https://pkg.go.dev/github.com/rs/zerolog), +makes passing the trace context trivial. + +However, some libraries do not accept a `context.Context` in their recording methods. +Structured logging libraries, +such as [`logr`](https://pkg.go.dev/github.com/go-logr/logr) +and [`zap`](https://pkg.go.dev/go.uber.org/zap), +offer passing `any` type as a log attribute/field. +Therefore, their bridge implementations can define a "special" log attributes/field +that will be used to capture the trace context. + +[The prototype](https://github.com/open-telemetry/opentelemetry-go/pull/4725) +has bridge implementations that handle trace context correlation efficiently. + +## Benchmarking + +The benchmarks take inspiration from [`slog`](https://pkg.go.dev/log/slog), +because for the Go team it was also critical to create API that would be fast +and interoperable with existing logging packages.[^2][^3] + +The benchmark results can be found in [the prototype](https://github.com/open-telemetry/opentelemetry-go/pull/4725). + +## Rejected alternatives + +### Reuse slog + +The API must not be coupled to [`slog`](https://pkg.go.dev/log/slog), +nor any other logging library. + +The API needs to evolve orthogonally to `slog`. + +`slog` is not compliant with the [Logs Bridge API](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/). +and we cannot expect the Go team to make `slog` compliant with it. + +The interoperabilty can be achieved using [a log bridge](https://opentelemetry.io/docs/specs/otel/glossary/#log-appender--bridge). + +You can read more about OpenTelemetry Logs design on [opentelemetry.io](https://opentelemetry.io/docs/concepts/signals/logs/). + +### Record as interface + +`Record` is defined as a `struct` because of the following reasons. + +Log record is a value object without any behavior. +It is used as data input for Logger methods. + +The log record resembles the instrument config structs like [metric.Float64CounterConfig](https://pkg.go.dev/go.opentelemetry.io/otel/metric#Float64CounterConfig). + +Using `struct` instead of `interface` improves the performance as e.g. +indirect calls are less optimized, +usage of interfaces tend to increase heap allocations.[^3] + +### Options as parameter to Logger.Emit + +One of the initial ideas was to have: + +```go +type Logger interface{ + embedded.Logger + Emit(ctx context.Context, options ...RecordOption) +} +``` + +The main reason was that design would be similar +to the [Meter API](https://pkg.go.dev/go.opentelemetry.io/otel/metric#Meter) +for creating instruments. + +However, passing `Record` directly, instead of using options, +is more performant as it reduces heap allocations.[^4] + +Another advantage of passing `Record` is that API would not have functions like `NewRecord(options...)`, +which would be used by the SDK and not by the users. + +Finally, the definition would be similar to [`slog.Handler.Handle`](https://pkg.go.dev/log/slog#Handler) +that was designed to provide optimization opportunities.[^2] + +### Passing record as pointer to Logger.Emit + +So far the benchmarks do not show differences that would +favor passing the record via pointer (and vice versa). + +Passing via value feels safer because of the following reasons. + +The user would not be able to pass `nil`. +Therefore, it reduces the possiblity to have a nil pointer dereference. + +It should reduce the possibility of a heap allocation. + +It follows the design of [`slog.Handler`](https://pkg.go.dev/log/slog#Handler). + +If follows one of Google's Go Style Decisions +to prefer [passing values](https://google.github.io/styleguide/go/decisions#pass-values). + +### Passing struct as parameter to LoggerProvider.Logger + +Similarly to `Logger.Emit`, we could have something like: + +```go +type LoggerProvider interface{ + embedded.LoggerProvider + Logger(name context.Context, config LoggerConfig) +} +``` + +The drawback of this idea would be that this would be +a different design from Trace and Metrics API. + +The performance of acquiring a logger is not as critical +as the performance of emitting a log record. While a single +HTTP/RPC handler could write hundreds of logs, it should not +create a new logger for each log entry. +The bridge implementation should reuse loggers whenever possible. + +### Logger.WithAttributes + +We could add `WithAttributes` to the `Logger` interface. +Then `Record` could be a simple struct with only exported fields. +The idea was that the SDK would implement the performance improvements +instead of doing it in the API. +This would allow having different optimization strategies. + +During the analysis[^5], it occurred that the main problem of this proposal +is that the variadic slice passed to an interface method is always heap allocated. + +Moreover, the logger returned by `WithAttribute` was allocated on the heap. + +Lastly, the proposal was not specification compliant. + +### Record attributes as slice + +One of the proposals[^6] was to have `Record` as a simple struct: + +```go +type Record struct { + Timestamp time.Time + ObservedTimestamp time.Time + Severity Severity + SeverityText string + Body Value + Attributes []KeyValue +``` + +The bridge implementations could use [`sync.Pool`](https://pkg.go.dev/sync#Pool) +for reducing the number of allocations when passing attributes. + +The benchmarks results were better. + +In such a design, most bridges would have a `sync.Pool` +to reduce the number of heap allocations. +However, the `sync.Pool` will not work correctly with API implementations +that would take ownership of the record +(e.g. implementations that do not copy records for asynchronous processing). +The current design, even in case of improper API implementation, +has lower chances of encountering a bug as most bridges would +create a record, pass it, and forget about it. + +For reference, here is the reason why `slog` does not use `sync.Pool`[^3] +as well: + +> We can use a sync pool for records though we decided not to. +You can but it's a bad idea for us. Why? +Because users have control of Records. +Handler writers can get their hands on a record +and we'd have to ask them to free it +or try to free it magically at some some point. +But either way, they could get themselves in trouble by freeing it twice +or holding on to one after they free it. +That's a use after free bug and that's why `zerolog` was problematic for us. +`zerolog` as as part of its speed exposes a pool allocated value to users +if you use `zerolog` the normal way, that you'll see in all the examples, +you will never encounter a problem. +But if you do something a little out of the ordinary you can get +use after free bugs and we just didn't want to put that in the standard library. + +Therefore, we decided to not follow the proposal as it is +less user friendly (users and bridges would use e.g. a `sync.Pool` to reduce +the number of heap allocation), less safe (more prone to use after free bugs +and race conditions), and the benchmark differences were not significant. + +### Use any instead of defining Value + +[Logs Data Model](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-body) +defines Body to be `any`. +One could propose to define `Body` (and attribute values) as `any` +instead of a defining a new type (`Value`). + +First of all, [`any` type defined in the specification](https://opentelemetry.io/docs/specs/otel/logs/data-model/#type-any) +is not the same as `any` (`interface{}`) in Go. + +Moreover, using `any` as a field would decrease the performance.[^7] + +Notice it will be still possible to add following kind and factories +in a backwards compatible way: + +```go +const KindMap Kind + +func AnyValue(value any) KeyValue + +func Any(key string, value any) KeyValue +``` + +However, currently, it would not be specification compliant. + +### Severity type encapsulating number and text + +We could combine severity into a single field defining a type: + +```go +type Severity struct { + Number SeverityNumber + Text string +} +``` + +However, the [Logs Data Model](https://opentelemetry.io/docs/specs/otel/logs/data-model/#log-and-event-record-definition) +define it as independent fields. +It should be more user friendly to have them separated. +Especially when having getter and setter methods, setting one value +when the other is already set would be unpleasant. + +## Reuse attribute package + +It was tempting to reuse the existing +[https://pkg.go.dev/go.opentelemetry.io/otel/attribute] package +for defining log attributes and body. + +However, this would be wrong because [the log attribute definition](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-attributes) +is different from [the common attribute definition](https://opentelemetry.io/docs/specs/otel/common/#attribute). + +Moreover, it there is nothing telling that [the body definition](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-body) +has anything in common with a common attribute value. + +Therefore, we define new types representing the abstract types defined +in the [Logs Data Model](https://opentelemetry.io/docs/specs/otel/logs/data-model/#definitions-used-in-this-document). + +## Mix receiver types for Record + +Methods of [`slog.Record`](https://pkg.go.dev/log/slog#Record) +have different receiver types. + +In `log/slog` GitHub issue we can only find that the reason is:[^8] + +>> some receiver of Record struct is by value +> Passing Records by value means they incur no heap allocation. +> That improves performance overall, even though they are copied. + +However, the benchmarks do not show any noticeable differences.[^9] + +The compiler is smart-enough to not make a heap allocation for any of these methods. +The use of a pointer receiver does not cause any heap allocation. +From Go FAQ:[^10] + +> In the current compilers, if a variable has its address taken, +> that variable is a candidate for allocation on the heap. +> However, a basic escape analysis recognizes some cases +> when such variables will not live past the return from the function +> and can reside on the stack. + +The [Understanding Allocations: the Stack and the Heap](https://www.youtube.com/watch?v=ZMZpH4yT7M0) +presentation by Jacob Walker describes the escape analysis with details. + +Moreover, also from Go FAQ:[^10] + +> Also, if a local variable is very large, +> it might make more sense to store it on the heap rather than the stack. + +Therefore, even if we use a value receiver and the value is very large +it may be heap allocated. + +Both [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments#receiver-type) +and [Google's Go Style Decisions](https://google.github.io/styleguide/go/decisions#receiver-type) +highly recommend making the methods for a type either all pointer methods +or all value methods. Google's Go Style Decisions even goes further and says: + +> There is a lot of misinformation about whether passing a value or a pointer +> to a function can affect performance. +> The compiler can choose to pass pointers to values on the stack +> as well as copying values on the stack, +> but these considerations should not outweigh the readability +> and correctness of the code in most circumstances. +> When the performance does matter, it is important to profile both approaches +> with a realistic benchmark before deciding that one approach outperforms the other. + +Because, the benchmarks[^9] do not proof any performance difference +and the general recommendation is to not mix receiver types, +we decided to use pointer receivers for all `Record` methods. + +### Add XYZ method to Logger + +The `Logger` does not have methods like `Enabled`, `SetSeverity`, etc. +as the Bridge API needs to follow (be compliant with) +the [specification](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/) + +Moreover, the Bridge API is intendend to be used to implement bridges. +Applications should not use it directly. The applications should use logging packages +such as [`slog`](https://pkg.go.dev/log/slog), +[`logrus`](https://pkg.go.dev/github.com/sirupsen/logrus), +[`zap`](https://pkg.go.dev/go.uber.org/zap), +[`zerolog`](https://pkg.go.dev/github.com/rs/zerolog), +[`logr`](https://pkg.go.dev/github.com/go-logr/logr). + +### Rename KeyValue to Attr + +There was a proposal to rename `KeyValue` to `Attr` (or `Attribute`).[^11] +New developers may not intuitively know that `log.KeyValue` is an attribute in +the OpenTelemetry parlance. + +During the discussion we agreed to keep the `KeyValue` name. + +The type is used in two semantics: + +- as a log attribute +- as a map item + +As for map item semantics, this type is a key-value pair, not an attribute. +Naming the type as `Attr` would convey semantical meaning +that would not be correct for a map. + +We expect that most of the Bridge API users will be OpenTelemetry contributors. +We plan to implement bridges for the most popular logging libraries ourselves. +Given we will all have the context needed to disambiguate these overlapping +names, developers' confusion should not be an issue. + +For bridges not developed by us, +developers will likely look at our existing bridges for inspiration. +Our correct use of these types will be a reference to them. + +At last, we could consider a design defining both types: `KeyValue` and `Attr`. +However, in this approach we would need have factory functions for both types. +It would make the API surface unnecessarily big, +and we may even have problems naming the functions. + +## Open issues + +The Logs Bridge API MUST NOT be released as stable +before all issues below are closed: + +- [Clarify that log attributes are NOT common attributes](https://github.com/open-telemetry/opentelemetry-specification/issues/3849) +- [Clarify handling empty (null) values in Logs Data Model](https://github.com/open-telemetry/opentelemetry-specification/issues/3835) +- [Clarify attributes parameter type of Get a Logger operation](https://github.com/open-telemetry/opentelemetry-specification/issues/3841) + +[^1]: [Handle structured body and attributes](https://github.com/pellared/opentelemetry-go/pull/7) +[^2]: Jonathan Amsterdam, [The Go Blog: Structured Logging with slog](https://go.dev/blog/slog) +[^3]: Jonathan Amsterdam, [GopherCon Europe 2023: A Fast Structured Logging Package](https://www.youtube.com/watch?v=tC4Jt3i62ns) +[^4]: [Emit definition discussion with benchmarks](https://github.com/open-telemetry/opentelemetry-go/pull/4725#discussion_r1400869566) +[^5]: [Logger.WithAttributes analysis](https://github.com/pellared/opentelemetry-go/pull/3) +[^6]: [Record attributes as field and use sync.Pool for reducing allocations](https://github.com/pellared/opentelemetry-go/pull/4) and [Record attributes based on slog.Record](https://github.com/pellared/opentelemetry-go/pull/6) +[^7]: [Record.Body as any](https://github.com/pellared/opentelemetry-go/pull/5) +[^8]: [log/slog: structured, leveled logging](https://github.com/golang/go/issues/56345#issuecomment-1302563756) +[^9]: [Record with pointer receivers only](https://github.com/pellared/opentelemetry-go/pull/8) +[^10]: [Go FAQ: Stack or heap](https://go.dev/doc/faq#stack_or_heap) +[^11]: [Rename KeyValue to Attr discussion](https://github.com/open-telemetry/opentelemetry-go/pull/4809#discussion_r1476080093) From 15b3f4d776cb06457ddd5679a31a09a2bfcb11cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 9 Feb 2024 09:01:32 +0100 Subject: [PATCH 854/886] Fix TestWithIDGenerator (#4894) --- sdk/trace/trace_test.go | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index e101e78f46a..df8dab7d68c 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1954,25 +1954,29 @@ var _ IDGenerator = (*testIDGenerator)(nil) func TestWithIDGenerator(t *testing.T) { const ( startTraceID = 1 - startSpanID = 1 - numSpan = 10 + startSpanID = 10 + numSpan = 5 ) - gen := &testIDGenerator{traceID: startSpanID, spanID: startSpanID} - + gen := &testIDGenerator{traceID: startTraceID, spanID: startSpanID} + te := NewTestExporter() + tp := NewTracerProvider( + WithSyncer(te), + WithIDGenerator(gen), + ) for i := 0; i < numSpan; i++ { - te := NewTestExporter() - tp := NewTracerProvider( - WithSyncer(te), - WithIDGenerator(gen), - ) - span := startSpan(tp, "TestWithIDGenerator") - got, err := strconv.ParseUint(span.SpanContext().SpanID().String(), 16, 64) - require.NoError(t, err) - want := uint64(startSpanID + i) - assert.Equal(t, got, want) - _, err = endSpan(te, span) - require.NoError(t, err) + func() { + _, span := tp.Tracer(t.Name()).Start(context.Background(), strconv.Itoa(i)) + defer span.End() + + gotSpanID, err := strconv.ParseUint(span.SpanContext().SpanID().String(), 16, 64) + require.NoError(t, err) + assert.Equal(t, uint64(startSpanID+i), gotSpanID) + + gotTraceID, err := strconv.ParseUint(span.SpanContext().TraceID().String(), 16, 64) + require.NoError(t, err) + assert.Equal(t, uint64(startTraceID+i), gotTraceID) + }() } } From dd5d05472c47c74419efe4df2cb23821e9c33b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 9 Feb 2024 09:15:18 +0100 Subject: [PATCH 855/886] sdk/metrics: Move experimental docs to x package (#4895) --- CHANGELOG.md | 4 ++-- sdk/metric/doc.go | 3 +++ sdk/metric/{EXPERIMENTAL.md => internal/x/README.md} | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) rename sdk/metric/{EXPERIMENTAL.md => internal/x/README.md} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f9aa5ed94..be07aae6bd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab - Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808) - Experimental exemplar exporting is added to the metric SDK. - See [metric documentation](./sdk/metric/EXPERIMENTAL.md#exemplars) for more information about this feature and how to enable it. (#4871) + See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871) - `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`. This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876) @@ -83,7 +83,7 @@ See our [versioning policy](VERSIONING.md) for more information about these stab The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770) - Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733) - Experimental cardinality limiting is added to the metric SDK. - See [metric documentation](./sdk/metric/EXPERIMENTAL.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) + See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457) - Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804) ### Changed diff --git a/sdk/metric/doc.go b/sdk/metric/doc.go index 53f80c42893..475d3e39416 100644 --- a/sdk/metric/doc.go +++ b/sdk/metric/doc.go @@ -44,4 +44,7 @@ // // See [go.opentelemetry.io/otel/metric] for more information about // the metric API. +// +// See [go.opentelemetry.io/otel/sdk/metric/internal/x] for information about +// the experimental features. package metric // import "go.opentelemetry.io/otel/sdk/metric" diff --git a/sdk/metric/EXPERIMENTAL.md b/sdk/metric/internal/x/README.md similarity index 97% rename from sdk/metric/EXPERIMENTAL.md rename to sdk/metric/internal/x/README.md index 658d2027687..aba69d65471 100644 --- a/sdk/metric/EXPERIMENTAL.md +++ b/sdk/metric/internal/x/README.md @@ -9,6 +9,7 @@ See the [Compatibility and Stability](#compatibility-and-stability) section for ## Features - [Cardinality Limit](#cardinality-limit) +- [Exemplars](#exemplars) ### Cardinality Limit @@ -103,7 +104,7 @@ unset OTEL_METRICS_EXEMPLAR_FILTER ## Compatibility and Stability -Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../VERSIONING.md). +Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../../../VERSIONING.md). These features may be removed or modified in successive version releases, including patch versions. When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release. From ec03021ff036568a531a95a871e6fd8b1152d186 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Mon, 12 Feb 2024 10:31:18 -0500 Subject: [PATCH 856/886] add exemplar support to the OTLP HTTP and gRPC exporters (#4900) --- CHANGELOG.md | 2 + .../internal/transform/metricdata.go | 28 ++ .../internal/transform/metricdata_test.go | 240 ++++++++++++++++-- .../internal/transform/metricdata.go | 28 ++ .../internal/transform/metricdata_test.go | 240 ++++++++++++++++-- .../otlpmetric/transform/metricdata.go.tmpl | 28 ++ .../transform/metricdata_test.go.tmpl | 240 ++++++++++++++++-- 7 files changed, 737 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be07aae6bd4..6d7249c1e33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The next release will require at least [Go 1.21]. ### Added - Support [Go 1.22]. (#4890) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) +- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) ## [1.23.1] 2024-02-07 diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go index 00d5c74ad90..80f03b4b420 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata.go @@ -148,6 +148,7 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: timeUnixNano(dPt.StartTime), TimeUnixNano: timeUnixNano(dPt.Time), + Exemplars: Exemplars(dPt.Exemplars), } switch v := any(dPt.Value).(type) { case int64: @@ -193,6 +194,7 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint Sum: &sum, BucketCounts: dPt.BucketCounts, ExplicitBounds: dPt.Bounds, + Exemplars: Exemplars(dPt.Exemplars), } if v, ok := dPt.Min.Value(); ok { vF64 := float64(v) @@ -236,6 +238,7 @@ func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.Exponen Sum: &sum, Scale: dPt.Scale, ZeroCount: dPt.ZeroCount, + Exemplars: Exemplars(dPt.Exemplars), Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), @@ -290,3 +293,28 @@ func timeUnixNano(t time.Time) uint64 { } return uint64(t.UnixNano()) } + +// Exemplars returns a slice of OTLP Exemplars generated from exemplars. +func Exemplars[N int64 | float64](exemplars []metricdata.Exemplar[N]) []*mpb.Exemplar { + out := make([]*mpb.Exemplar, 0, len(exemplars)) + for _, exemplar := range exemplars { + e := &mpb.Exemplar{ + FilteredAttributes: KeyValues(exemplar.FilteredAttributes), + TimeUnixNano: timeUnixNano(exemplar.Time), + SpanId: exemplar.SpanID, + TraceId: exemplar.TraceID, + } + switch v := any(exemplar.Value).(type) { + case int64: + e.Value = &mpb.Exemplar_AsInt{ + AsInt: v, + } + case float64: + e.Value = &mpb.Exemplar_AsDouble{ + AsDouble: v, + } + } + out = append(out, e) + } + return out +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go index 778a172c550..2ce09fe6c29 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/transform/metricdata_test.go @@ -46,6 +46,9 @@ var ( alice = attribute.NewSet(attribute.String("user", "alice")) bob = attribute.NewSet(attribute.String("user", "bob")) + filterAlice = []attribute.KeyValue{attribute.String("user", "filter alice")} + filterBob = []attribute.KeyValue{attribute.String("user", "filter bob")} + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, }} @@ -53,6 +56,84 @@ var ( Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, }} + pbFilterAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter alice"}, + }} + pbFilterBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter bob"}, + }} + + spanIDA = []byte{0, 0, 0, 0, 0, 0, 0, 1} + spanIDB = []byte{0, 0, 0, 0, 0, 0, 0, 2} + traceIDA = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + traceIDB = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} + + exemplarInt64A = metricdata.Exemplar[int64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64A = metricdata.Exemplar[float64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10.0, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarInt64B = metricdata.Exemplar[int64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12, + SpanID: spanIDB, + TraceID: traceIDB, + } + exemplarFloat64B = metricdata.Exemplar[float64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12.0, + SpanID: spanIDB, + TraceID: traceIDB, + } + + pbExemplarInt64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: -10, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarInt64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: 12, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + pbExemplarFloat64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: -10.0, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarFloat64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: 12.0, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + minA, maxA, sumA = 2.0, 4.0, 90.0 minB, maxB, sumB = 4.0, 150.0, 234.0 otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ @@ -66,6 +147,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -76,6 +158,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ @@ -89,6 +172,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -99,6 +183,7 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, }, } @@ -133,6 +218,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -146,6 +232,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ @@ -162,6 +249,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -175,10 +263,37 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, + } + + pbHDPInt64 = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } - pbHDP = []*mpb.HistogramDataPoint{ + pbHDPFloat64 = []*mpb.HistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -189,6 +304,7 @@ var ( BucketCounts: []uint64{0, 30, 0}, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -199,6 +315,7 @@ var ( BucketCounts: []uint64{0, 1, 2}, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -219,7 +336,37 @@ var ( BucketCounts: []uint64{0, 1}, } - pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + pbEHDPInt64 = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, + }, + } + + pbEHDPFloat64 = []*mpb.ExponentialHistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -232,6 +379,7 @@ var ( Negative: pbEHDPBB, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -244,6 +392,7 @@ var ( Negative: pbEHDPBD, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -274,23 +423,57 @@ var ( DataPoints: otelEHDPInt64, } - pbHist = &mpb.Histogram{ + pbHistInt64 = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDPInt64, + } + + pbHistFloat64 = &mpb.Histogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbHDP, + DataPoints: pbHDPFloat64, } - pbExpoHist = &mpb.ExponentialHistogram{ + pbExpoHistInt64 = &mpb.ExponentialHistogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbEHDP, + DataPoints: pbEHDPInt64, + } + + pbExpoHistFloat64 = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDPFloat64, } otelDPtsInt64 = []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1}, - {Attributes: bob, StartTime: start, Time: end, Value: 2}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, + }, } otelDPtsFloat64 = []metricdata.DataPoint[float64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, - {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, } pbDPtsInt64 = []*mpb.NumberDataPoint{ @@ -299,12 +482,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } pbDPtsFloat64 = []*mpb.NumberDataPoint{ @@ -313,12 +498,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -353,7 +540,13 @@ var ( otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} otelGaugeZeroStartTime = metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + { + Attributes: alice, + StartTime: time.Time{}, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, }, } @@ -365,6 +558,7 @@ var ( StartTimeUnixNano: 0, TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, }} @@ -479,25 +673,25 @@ var ( Name: "int64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistInt64}, }, { Name: "float64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistFloat64}, }, { Name: "int64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, }, { Name: "float64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, }, { Name: "zero-time", @@ -571,21 +765,21 @@ func TestTransformations(t *testing.T) { // errors deep inside the structs). // DataPoint types. - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbHDPInt64, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDPFloat64, HistogramDataPoints(otelHDPFloat64)) assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPInt64, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDPFloat64, ExponentialHistogramDataPoints(otelEHDPFloat64)) assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) // Aggregations. h, err := Histogram(otelHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistInt64}, h) h, err = Histogram(otelHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistFloat64}, h) h, err = Histogram(otelHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, h) @@ -605,10 +799,10 @@ func TestTransformations(t *testing.T) { e, err := ExponentialHistogram(otelExpoHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, e) e, err = ExponentialHistogram(otelExpoHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, e) e, err = ExponentialHistogram(otelExpoHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, e) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go index 985fcfc6437..c8ab8dbf6a5 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata.go @@ -148,6 +148,7 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: timeUnixNano(dPt.StartTime), TimeUnixNano: timeUnixNano(dPt.Time), + Exemplars: Exemplars(dPt.Exemplars), } switch v := any(dPt.Value).(type) { case int64: @@ -193,6 +194,7 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint Sum: &sum, BucketCounts: dPt.BucketCounts, ExplicitBounds: dPt.Bounds, + Exemplars: Exemplars(dPt.Exemplars), } if v, ok := dPt.Min.Value(); ok { vF64 := float64(v) @@ -236,6 +238,7 @@ func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.Exponen Sum: &sum, Scale: dPt.Scale, ZeroCount: dPt.ZeroCount, + Exemplars: Exemplars(dPt.Exemplars), Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), @@ -290,3 +293,28 @@ func timeUnixNano(t time.Time) uint64 { } return uint64(t.UnixNano()) } + +// Exemplars returns a slice of OTLP Exemplars generated from exemplars. +func Exemplars[N int64 | float64](exemplars []metricdata.Exemplar[N]) []*mpb.Exemplar { + out := make([]*mpb.Exemplar, 0, len(exemplars)) + for _, exemplar := range exemplars { + e := &mpb.Exemplar{ + FilteredAttributes: KeyValues(exemplar.FilteredAttributes), + TimeUnixNano: timeUnixNano(exemplar.Time), + SpanId: exemplar.SpanID, + TraceId: exemplar.TraceID, + } + switch v := any(exemplar.Value).(type) { + case int64: + e.Value = &mpb.Exemplar_AsInt{ + AsInt: v, + } + case float64: + e.Value = &mpb.Exemplar_AsDouble{ + AsDouble: v, + } + } + out = append(out, e) + } + return out +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go index 778a172c550..2ce09fe6c29 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/transform/metricdata_test.go @@ -46,6 +46,9 @@ var ( alice = attribute.NewSet(attribute.String("user", "alice")) bob = attribute.NewSet(attribute.String("user", "bob")) + filterAlice = []attribute.KeyValue{attribute.String("user", "filter alice")} + filterBob = []attribute.KeyValue{attribute.String("user", "filter bob")} + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, }} @@ -53,6 +56,84 @@ var ( Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, }} + pbFilterAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter alice"}, + }} + pbFilterBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter bob"}, + }} + + spanIDA = []byte{0, 0, 0, 0, 0, 0, 0, 1} + spanIDB = []byte{0, 0, 0, 0, 0, 0, 0, 2} + traceIDA = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + traceIDB = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} + + exemplarInt64A = metricdata.Exemplar[int64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64A = metricdata.Exemplar[float64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10.0, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarInt64B = metricdata.Exemplar[int64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12, + SpanID: spanIDB, + TraceID: traceIDB, + } + exemplarFloat64B = metricdata.Exemplar[float64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12.0, + SpanID: spanIDB, + TraceID: traceIDB, + } + + pbExemplarInt64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: -10, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarInt64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: 12, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + pbExemplarFloat64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: -10.0, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarFloat64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: 12.0, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + minA, maxA, sumA = 2.0, 4.0, 90.0 minB, maxB, sumB = 4.0, 150.0, 234.0 otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ @@ -66,6 +147,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -76,6 +158,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ @@ -89,6 +172,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -99,6 +183,7 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, }, } @@ -133,6 +218,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -146,6 +232,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ @@ -162,6 +249,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -175,10 +263,37 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, + } + + pbHDPInt64 = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } - pbHDP = []*mpb.HistogramDataPoint{ + pbHDPFloat64 = []*mpb.HistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -189,6 +304,7 @@ var ( BucketCounts: []uint64{0, 30, 0}, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -199,6 +315,7 @@ var ( BucketCounts: []uint64{0, 1, 2}, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -219,7 +336,37 @@ var ( BucketCounts: []uint64{0, 1}, } - pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + pbEHDPInt64 = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, + }, + } + + pbEHDPFloat64 = []*mpb.ExponentialHistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -232,6 +379,7 @@ var ( Negative: pbEHDPBB, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -244,6 +392,7 @@ var ( Negative: pbEHDPBD, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -274,23 +423,57 @@ var ( DataPoints: otelEHDPInt64, } - pbHist = &mpb.Histogram{ + pbHistInt64 = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDPInt64, + } + + pbHistFloat64 = &mpb.Histogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbHDP, + DataPoints: pbHDPFloat64, } - pbExpoHist = &mpb.ExponentialHistogram{ + pbExpoHistInt64 = &mpb.ExponentialHistogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbEHDP, + DataPoints: pbEHDPInt64, + } + + pbExpoHistFloat64 = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDPFloat64, } otelDPtsInt64 = []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1}, - {Attributes: bob, StartTime: start, Time: end, Value: 2}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, + }, } otelDPtsFloat64 = []metricdata.DataPoint[float64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, - {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, } pbDPtsInt64 = []*mpb.NumberDataPoint{ @@ -299,12 +482,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } pbDPtsFloat64 = []*mpb.NumberDataPoint{ @@ -313,12 +498,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -353,7 +540,13 @@ var ( otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} otelGaugeZeroStartTime = metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + { + Attributes: alice, + StartTime: time.Time{}, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, }, } @@ -365,6 +558,7 @@ var ( StartTimeUnixNano: 0, TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, }} @@ -479,25 +673,25 @@ var ( Name: "int64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistInt64}, }, { Name: "float64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistFloat64}, }, { Name: "int64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, }, { Name: "float64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, }, { Name: "zero-time", @@ -571,21 +765,21 @@ func TestTransformations(t *testing.T) { // errors deep inside the structs). // DataPoint types. - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbHDPInt64, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDPFloat64, HistogramDataPoints(otelHDPFloat64)) assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPInt64, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDPFloat64, ExponentialHistogramDataPoints(otelEHDPFloat64)) assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) // Aggregations. h, err := Histogram(otelHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistInt64}, h) h, err = Histogram(otelHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistFloat64}, h) h, err = Histogram(otelHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, h) @@ -605,10 +799,10 @@ func TestTransformations(t *testing.T) { e, err := ExponentialHistogram(otelExpoHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, e) e, err = ExponentialHistogram(otelExpoHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, e) e, err = ExponentialHistogram(otelExpoHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, e) diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl index 2a4aeedcdfc..35344b46b73 100644 --- a/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl +++ b/internal/shared/otlp/otlpmetric/transform/metricdata.go.tmpl @@ -148,6 +148,7 @@ func DataPoints[N int64 | float64](dPts []metricdata.DataPoint[N]) []*mpb.Number Attributes: AttrIter(dPt.Attributes.Iter()), StartTimeUnixNano: timeUnixNano(dPt.StartTime), TimeUnixNano: timeUnixNano(dPt.Time), + Exemplars: Exemplars(dPt.Exemplars), } switch v := any(dPt.Value).(type) { case int64: @@ -193,6 +194,7 @@ func HistogramDataPoints[N int64 | float64](dPts []metricdata.HistogramDataPoint Sum: &sum, BucketCounts: dPt.BucketCounts, ExplicitBounds: dPt.Bounds, + Exemplars: Exemplars(dPt.Exemplars), } if v, ok := dPt.Min.Value(); ok { vF64 := float64(v) @@ -236,6 +238,7 @@ func ExponentialHistogramDataPoints[N int64 | float64](dPts []metricdata.Exponen Sum: &sum, Scale: dPt.Scale, ZeroCount: dPt.ZeroCount, + Exemplars: Exemplars(dPt.Exemplars), Positive: ExponentialHistogramDataPointBuckets(dPt.PositiveBucket), Negative: ExponentialHistogramDataPointBuckets(dPt.NegativeBucket), @@ -290,3 +293,28 @@ func timeUnixNano(t time.Time) uint64 { } return uint64(t.UnixNano()) } + +// Exemplars returns a slice of OTLP Exemplars generated from exemplars. +func Exemplars[N int64 | float64](exemplars []metricdata.Exemplar[N]) []*mpb.Exemplar { + out := make([]*mpb.Exemplar, 0, len(exemplars)) + for _, exemplar := range exemplars { + e := &mpb.Exemplar{ + FilteredAttributes: KeyValues(exemplar.FilteredAttributes), + TimeUnixNano: timeUnixNano(exemplar.Time), + SpanId: exemplar.SpanID, + TraceId: exemplar.TraceID, + } + switch v := any(exemplar.Value).(type) { + case int64: + e.Value = &mpb.Exemplar_AsInt{ + AsInt: v, + } + case float64: + e.Value = &mpb.Exemplar_AsDouble{ + AsDouble: v, + } + } + out = append(out, e) + } + return out +} diff --git a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl index 778a172c550..2ce09fe6c29 100644 --- a/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/transform/metricdata_test.go.tmpl @@ -46,6 +46,9 @@ var ( alice = attribute.NewSet(attribute.String("user", "alice")) bob = attribute.NewSet(attribute.String("user", "bob")) + filterAlice = []attribute.KeyValue{attribute.String("user", "filter alice")} + filterBob = []attribute.KeyValue{attribute.String("user", "filter bob")} + pbAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ Value: &cpb.AnyValue_StringValue{StringValue: "alice"}, }} @@ -53,6 +56,84 @@ var ( Value: &cpb.AnyValue_StringValue{StringValue: "bob"}, }} + pbFilterAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter alice"}, + }} + pbFilterBob = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{ + Value: &cpb.AnyValue_StringValue{StringValue: "filter bob"}, + }} + + spanIDA = []byte{0, 0, 0, 0, 0, 0, 0, 1} + spanIDB = []byte{0, 0, 0, 0, 0, 0, 0, 2} + traceIDA = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} + traceIDB = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} + + exemplarInt64A = metricdata.Exemplar[int64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarFloat64A = metricdata.Exemplar[float64]{ + FilteredAttributes: filterAlice, + Time: end, + Value: -10.0, + SpanID: spanIDA, + TraceID: traceIDA, + } + exemplarInt64B = metricdata.Exemplar[int64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12, + SpanID: spanIDB, + TraceID: traceIDB, + } + exemplarFloat64B = metricdata.Exemplar[float64]{ + FilteredAttributes: filterBob, + Time: end, + Value: 12.0, + SpanID: spanIDB, + TraceID: traceIDB, + } + + pbExemplarInt64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: -10, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarInt64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsInt{ + AsInt: 12, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + pbExemplarFloat64A = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterAlice}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: -10.0, + }, + SpanId: spanIDA, + TraceId: traceIDA, + } + pbExemplarFloat64B = &mpb.Exemplar{ + FilteredAttributes: []*cpb.KeyValue{pbFilterBob}, + TimeUnixNano: uint64(end.UnixNano()), + Value: &mpb.Exemplar_AsDouble{ + AsDouble: 12.0, + }, + SpanId: spanIDB, + TraceId: traceIDB, + } + minA, maxA, sumA = 2.0, 4.0, 90.0 minB, maxB, sumB = 4.0, 150.0, 234.0 otelHDPInt64 = []metricdata.HistogramDataPoint[int64]{ @@ -66,6 +147,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -76,6 +158,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelHDPFloat64 = []metricdata.HistogramDataPoint[float64]{ @@ -89,6 +172,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -99,6 +183,7 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, }, } @@ -133,6 +218,7 @@ var ( Min: metricdata.NewExtrema(int64(minA)), Max: metricdata.NewExtrema(int64(maxA)), Sum: int64(sumA), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, }, { Attributes: bob, StartTime: start, @@ -146,6 +232,7 @@ var ( Min: metricdata.NewExtrema(int64(minB)), Max: metricdata.NewExtrema(int64(maxB)), Sum: int64(sumB), + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, }, } otelEHDPFloat64 = []metricdata.ExponentialHistogramDataPoint[float64]{ @@ -162,6 +249,7 @@ var ( Min: metricdata.NewExtrema(minA), Max: metricdata.NewExtrema(maxA), Sum: sumA, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, }, { Attributes: bob, StartTime: start, @@ -175,10 +263,37 @@ var ( Min: metricdata.NewExtrema(minB), Max: metricdata.NewExtrema(maxB), Sum: sumB, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, + } + + pbHDPInt64 = []*mpb.HistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 30, 0}, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + ExplicitBounds: []float64{1, 5}, + BucketCounts: []uint64{0, 1, 2}, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } - pbHDP = []*mpb.HistogramDataPoint{ + pbHDPFloat64 = []*mpb.HistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -189,6 +304,7 @@ var ( BucketCounts: []uint64{0, 30, 0}, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -199,6 +315,7 @@ var ( BucketCounts: []uint64{0, 1, 2}, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -219,7 +336,37 @@ var ( BucketCounts: []uint64{0, 1}, } - pbEHDP = []*mpb.ExponentialHistogramDataPoint{ + pbEHDPInt64 = []*mpb.ExponentialHistogramDataPoint{ + { + Attributes: []*cpb.KeyValue{pbAlice}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 30, + Sum: &sumA, + Scale: 2, + ZeroCount: 10, + Positive: pbEHDPBA, + Negative: pbEHDPBB, + Min: &minA, + Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, + }, { + Attributes: []*cpb.KeyValue{pbBob}, + StartTimeUnixNano: uint64(start.UnixNano()), + TimeUnixNano: uint64(end.UnixNano()), + Count: 3, + Sum: &sumB, + Scale: 4, + ZeroCount: 1, + Positive: pbEHDPBC, + Negative: pbEHDPBD, + Min: &minB, + Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, + }, + } + + pbEHDPFloat64 = []*mpb.ExponentialHistogramDataPoint{ { Attributes: []*cpb.KeyValue{pbAlice}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -232,6 +379,7 @@ var ( Negative: pbEHDPBB, Min: &minA, Max: &maxA, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), @@ -244,6 +392,7 @@ var ( Negative: pbEHDPBD, Min: &minB, Max: &maxB, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -274,23 +423,57 @@ var ( DataPoints: otelEHDPInt64, } - pbHist = &mpb.Histogram{ + pbHistInt64 = &mpb.Histogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbHDPInt64, + } + + pbHistFloat64 = &mpb.Histogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbHDP, + DataPoints: pbHDPFloat64, } - pbExpoHist = &mpb.ExponentialHistogram{ + pbExpoHistInt64 = &mpb.ExponentialHistogram{ AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, - DataPoints: pbEHDP, + DataPoints: pbEHDPInt64, + } + + pbExpoHistFloat64 = &mpb.ExponentialHistogram{ + AggregationTemporality: mpb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA, + DataPoints: pbEHDPFloat64, } otelDPtsInt64 = []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1}, - {Attributes: bob, StartTime: start, Time: end, Value: 2}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, + }, } otelDPtsFloat64 = []metricdata.DataPoint[float64]{ - {Attributes: alice, StartTime: start, Time: end, Value: 1.0}, - {Attributes: bob, StartTime: start, Time: end, Value: 2.0}, + { + Attributes: alice, + StartTime: start, + Time: end, + Value: 1.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, + }, + { + Attributes: bob, + StartTime: start, + Time: end, + Value: 2.0, + Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, + }, } pbDPtsInt64 = []*mpb.NumberDataPoint{ @@ -299,12 +482,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 2}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64B}, }, } pbDPtsFloat64 = []*mpb.NumberDataPoint{ @@ -313,12 +498,14 @@ var ( StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 1.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64A}, }, { Attributes: []*cpb.KeyValue{pbBob}, StartTimeUnixNano: uint64(start.UnixNano()), TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsDouble{AsDouble: 2.0}, + Exemplars: []*mpb.Exemplar{pbExemplarFloat64B}, }, } @@ -353,7 +540,13 @@ var ( otelGaugeFloat64 = metricdata.Gauge[float64]{DataPoints: otelDPtsFloat64} otelGaugeZeroStartTime = metricdata.Gauge[int64]{ DataPoints: []metricdata.DataPoint[int64]{ - {Attributes: alice, StartTime: time.Time{}, Time: end, Value: 1}, + { + Attributes: alice, + StartTime: time.Time{}, + Time: end, + Value: 1, + Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, + }, }, } @@ -365,6 +558,7 @@ var ( StartTimeUnixNano: 0, TimeUnixNano: uint64(end.UnixNano()), Value: &mpb.NumberDataPoint_AsInt{AsInt: 1}, + Exemplars: []*mpb.Exemplar{pbExemplarInt64A}, }, }} @@ -479,25 +673,25 @@ var ( Name: "int64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistInt64}, }, { Name: "float64-histogram", Description: "Histogram", Unit: "1", - Data: &mpb.Metric_Histogram{Histogram: pbHist}, + Data: &mpb.Metric_Histogram{Histogram: pbHistFloat64}, }, { Name: "int64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, }, { Name: "float64-ExponentialHistogram", Description: "Exponential Histogram", Unit: "1", - Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, + Data: &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, }, { Name: "zero-time", @@ -571,21 +765,21 @@ func TestTransformations(t *testing.T) { // errors deep inside the structs). // DataPoint types. - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPInt64)) - assert.Equal(t, pbHDP, HistogramDataPoints(otelHDPFloat64)) + assert.Equal(t, pbHDPInt64, HistogramDataPoints(otelHDPInt64)) + assert.Equal(t, pbHDPFloat64, HistogramDataPoints(otelHDPFloat64)) assert.Equal(t, pbDPtsInt64, DataPoints[int64](otelDPtsInt64)) require.Equal(t, pbDPtsFloat64, DataPoints[float64](otelDPtsFloat64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPInt64)) - assert.Equal(t, pbEHDP, ExponentialHistogramDataPoints(otelEHDPFloat64)) + assert.Equal(t, pbEHDPInt64, ExponentialHistogramDataPoints(otelEHDPInt64)) + assert.Equal(t, pbEHDPFloat64, ExponentialHistogramDataPoints(otelEHDPFloat64)) assert.Equal(t, pbEHDPBA, ExponentialHistogramDataPointBuckets(otelEBucketA)) // Aggregations. h, err := Histogram(otelHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistInt64}, h) h, err = Histogram(otelHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHist}, h) + assert.Equal(t, &mpb.Metric_Histogram{Histogram: pbHistFloat64}, h) h, err = Histogram(otelHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, h) @@ -605,10 +799,10 @@ func TestTransformations(t *testing.T) { e, err := ExponentialHistogram(otelExpoHistInt64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistInt64}, e) e, err = ExponentialHistogram(otelExpoHistFloat64) assert.NoError(t, err) - assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHist}, e) + assert.Equal(t, &mpb.Metric_ExponentialHistogram{ExponentialHistogram: pbExpoHistFloat64}, e) e, err = ExponentialHistogram(otelExpoHistInvalid) assert.ErrorIs(t, err, errUnknownTemporality) assert.Nil(t, e) From 9c04afabbf4b8a7a18adb7787616730157856603 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:17:48 -0800 Subject: [PATCH 857/886] Bump golang.org/x/vuln from 1.0.3 to 1.0.4 in /internal/tools (#4902) Bumps [golang.org/x/vuln](https://github.com/golang/vuln) from 1.0.3 to 1.0.4. - [Commits](https://github.com/golang/vuln/compare/v1.0.3...v1.0.4) --- updated-dependencies: - dependency-name: golang.org/x/vuln dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 72d1fae7578..8bc9fa9a026 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -16,7 +16,7 @@ require ( go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea golang.org/x/tools v0.17.0 - golang.org/x/vuln v1.0.3 + golang.org/x/vuln v1.0.4 ) require ( diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 7ebd5cb05d3..f9e33d59ce0 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -940,8 +940,8 @@ golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= -golang.org/x/vuln v1.0.3 h1:k2wzzWGpdntQzNsCOLTabCFk76oTe69BPwad5H52F4w= -golang.org/x/vuln v1.0.3/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ= +golang.org/x/vuln v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I= +golang.org/x/vuln v1.0.4/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From befae906823281aeacbb61ab2e332ba758fe5520 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:23:21 -0800 Subject: [PATCH 858/886] Bump golang from 1.21-alpine to 1.22-alpine in /example/zipkin (#4905) Bumps golang from 1.21-alpine to 1.22-alpine. --- updated-dependencies: - dependency-name: golang dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- example/zipkin/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/zipkin/Dockerfile b/example/zipkin/Dockerfile index c5335d6ad3b..9d610763961 100644 --- a/example/zipkin/Dockerfile +++ b/example/zipkin/Dockerfile @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.21-alpine +FROM golang:1.22-alpine COPY . /go/src/github.com/open-telemetry/opentelemetry-go/ WORKDIR /go/src/github.com/open-telemetry/opentelemetry-go/example/zipkin/ RUN go install ./main.go From e3c6c4c10513e4d51fcc7f8b4ec80c66f3f67fbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:28:33 -0800 Subject: [PATCH 859/886] Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (#4901) Bumps [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) from 0.47.0 to 0.48.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.47.0...zpages/v0.48.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn --- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/dice/go.mod b/example/dice/go.mod index d8812b874c5..93f18b07324 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -3,7 +3,7 @@ module go.opentelemetry.io/otel/example/dice go 1.20 require ( - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 go.opentelemetry.io/otel v1.23.1 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 diff --git a/example/dice/go.sum b/example/dice/go.sum index 8be4f4bfc02..4e740591c3c 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -9,8 +9,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 h1:doUP+ExOpH3spVTLS0FcWGLnQrPct/hD/bCPbDRUEAU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From b423bfdffaec09db5787870133fda61dae8b553b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:39:55 -0800 Subject: [PATCH 860/886] Bump golang.org/x/sys from 0.16.0 to 0.17.0 in /sdk (#4904) * Bump golang.org/x/sys from 0.16.0 to 0.17.0 in /sdk Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.16.0 to 0.17.0. - [Commits](https://github.com/golang/sys/compare/v0.16.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Run go mod tidy --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 ++-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 ++-- example/dice/go.mod | 2 +- example/dice/go.sum | 4 ++-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 ++-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 ++-- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/go.mod | 2 +- exporters/otlp/otlptrace/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 ++-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 ++-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 ++-- sdk/go.mod | 2 +- sdk/go.sum | 4 ++-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 ++-- 40 files changed, 60 insertions(+), 60 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index 9b462cd52c9..e2f92b58ac5 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index 3c24424ec3f..8d982bbb7a4 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 634a2e7f84f..24bdb42fab0 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/sdk/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index 00b4f7dbfcc..34ecbfcd138 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/dice/go.mod b/example/dice/go.mod index 93f18b07324..14425113875 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index 4e740591c3c..770d5b3c6ee 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -11,6 +11,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 h1:doUP+ExOpH3spVTLS0FcWGLnQrPct/hD/bCPbDRUEAU= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index ce6a8b5308f..55b16137130 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.4.1 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index d699dc1a86f..8bc156d8db0 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 3a50dbfcd80..aa2f2d29afb 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index 00b4f7dbfcc..34ecbfcd138 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -68,8 +68,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 1ecf55710ce..57b58b60f72 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -25,7 +25,7 @@ require ( go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 3463de00553..3530db476f6 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -20,8 +20,8 @@ go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7e go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index a211165257a..95403b08f30 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index d699dc1a86f..8bc156d8db0 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -7,6 +7,6 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index ff8f2ececb0..5fb1263a4c9 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -21,7 +21,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/sdk v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index d21cccb832e..6cee4eb4de1 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -21,8 +21,8 @@ github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGy github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 385e327f941..a8600e38741 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index ee116ca6b83..9a3217a09b2 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -9,6 +9,6 @@ github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDO github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 2f3be7fa09c..4895146b132 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 157185285ac..819c64f0d4b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 3194350f3fb..1e36e9c9eca 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 157185285ac..819c64f0d4b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -29,8 +29,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 4df97207c94..055b750156b 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 6d12cac9adc..ea26e3d25fb 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -25,8 +25,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 6e589a25118..442b1ec638d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 4c51e48ba79..8093fdef794 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -29,8 +29,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 66aca15e36e..21795628713 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index c14ce36dfb0..b11735f81b6 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -27,8 +27,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index cdecb093ac2..39dc1c6f2d9 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index a434353b938..f2867706f84 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -29,8 +29,8 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index fd44e4daa04..16783241a17 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect go.opentelemetry.io/otel/trace v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index c5fa9b27769..30f0aa10ffa 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index ebed00d78b1..c80cbb6d86b 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index c5fa9b27769..30f0aa10ffa 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 023841971fb..26f693e36fb 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.23.1 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index e72b89d2d1f..52d6ac18655 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/go.mod b/sdk/go.mod index 5226d06a014..9d718f697fb 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.23.1 go.opentelemetry.io/otel/trace v1.23.1 - golang.org/x/sys v0.16.0 + golang.org/x/sys v0.17.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index f8eb9a72baa..572c786dfdb 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index c19fd8726b7..ff2a1adff78 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index c5fa9b27769..30f0aa10ffa 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -10,8 +10,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From cd289eed0dd8ae1d6ffff904864dc1dc2a84c980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Mon, 12 Feb 2024 19:56:39 +0100 Subject: [PATCH 861/886] [chore] Update Project Status for Logs (#4897) Co-authored-by: Tyler Yahn --- README.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0682805867e..5af9822eaec 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,13 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | -|---------|------------| -| Traces | Stable | -| Metrics | Stable | -| Logs | Design [1] | +| Signal | Status | +|---------|----------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | In development | -- [1]: Currently the logs signal development is in a design phase ([#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696)). - No Logs Pull Requests are currently being accepted. - -Progress and status specific to this repository is tracked in our +Progres and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) and [milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). From 1568559ea8a2dcfe4ef08a515845ecaa1db7068b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 13 Feb 2024 15:39:09 -0800 Subject: [PATCH 862/886] Link logs RC in project status of README (#4917) --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5af9822eaec..13bcc5e590a 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ It provides a set of APIs to directly measure performance and behavior of your s ## Project Status -| Signal | Status | -|---------|----------------| -| Traces | Stable | -| Metrics | Stable | -| Logs | In development | +| Signal | Status | +|---------|--------------------| +| Traces | Stable | +| Metrics | Stable | +| Logs | In development[^1] | Progres and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) @@ -25,6 +25,8 @@ and Project versioning information and stability guarantees can be found in the [versioning documentation](VERSIONING.md). +[^1]: https://github.com/orgs/open-telemetry/projects/43 + ### Compatibility OpenTelemetry-Go ensures compatibility with the current supported versions of From e8973b75b230246545cdae072a548c83877cba09 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 13 Feb 2024 15:47:56 -0800 Subject: [PATCH 863/886] [docs] Log design fix (#4918) Add missing return type to String func. --- log/DESIGN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log/DESIGN.md b/log/DESIGN.md index e748c1179f1..58236059cb0 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -318,7 +318,7 @@ type KeyValue struct { // KeyValue factories: -func String(key, value string) +func String(key, value string) KeyValue func Int64(key string, value int64) KeyValue From 02b61239cdc35da03bf23f43259f276f8b74e2e9 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Thu, 15 Feb 2024 07:30:29 -0800 Subject: [PATCH 864/886] internal/global,trace: fix spelling error (#4920) There is another one in the generated semconv files but I couldn't find where those were being generated from. Co-authored-by: Damien Mathieu --- internal/global/state.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/global/state.go b/internal/global/state.go index 7985005bcb6..386c8bfdc08 100644 --- a/internal/global/state.go +++ b/internal/global/state.go @@ -63,7 +63,7 @@ func SetTracerProvider(tp trace.TracerProvider) { // to itself. Error( errors.New("no delegate configured in tracer provider"), - "Setting tracer provider to it's current value. No delegate will be configured", + "Setting tracer provider to its current value. No delegate will be configured", ) return } @@ -92,7 +92,7 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) { // delegate to itself. Error( errors.New("no delegate configured in text map propagator"), - "Setting text map propagator to it's current value. No delegate will be configured", + "Setting text map propagator to its current value. No delegate will be configured", ) return } @@ -123,7 +123,7 @@ func SetMeterProvider(mp metric.MeterProvider) { // to itself. Error( errors.New("no delegate configured in meter provider"), - "Setting meter provider to it's current value. No delegate will be configured", + "Setting meter provider to its current value. No delegate will be configured", ) return } From d3dcb3999c5689a7bb803cb0529e55a651ed14f1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 16 Feb 2024 07:09:58 -0800 Subject: [PATCH 865/886] Add initial Logs Bridge API scaffolding (#4907) * Add go.mod * Exclude otel/log in versions.yaml * Add package documentation stub * Update dependabot config * Add initial log API scaffolding --- .github/dependabot.yml | 9 +++ log/doc.go | 21 +++++++ log/go.mod | 11 ++++ log/go.sum | 5 ++ log/keyvalue.go | 132 +++++++++++++++++++++++++++++++++++++++++ log/kind_string.go | 30 ++++++++++ log/logger.go | 65 ++++++++++++++++++++ log/provider.go | 32 ++++++++++ log/record.go | 62 +++++++++++++++++++ log/severity.go | 72 ++++++++++++++++++++++ log/severity_string.go | 47 +++++++++++++++ versions.yaml | 1 + 12 files changed, 487 insertions(+) create mode 100644 log/doc.go create mode 100644 log/go.mod create mode 100644 log/go.sum create mode 100644 log/keyvalue.go create mode 100644 log/kind_string.go create mode 100644 log/logger.go create mode 100644 log/provider.go create mode 100644 log/record.go create mode 100644 log/severity.go create mode 100644 log/severity_string.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 62541218442..aa56688077f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -217,6 +217,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /log + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /metric labels: diff --git a/log/doc.go b/log/doc.go new file mode 100644 index 00000000000..8920510c0b5 --- /dev/null +++ b/log/doc.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package log provides the OpenTelemetry Logs Bridge API. +*/ + +// TODO (#4908): expand documentation stub. + +package log // import "go.opentelemetry.io/otel/log" diff --git a/log/go.mod b/log/go.mod new file mode 100644 index 00000000000..715553c4576 --- /dev/null +++ b/log/go.mod @@ -0,0 +1,11 @@ +module go.opentelemetry.io/otel/log + +go 1.20 + +require go.opentelemetry.io/otel v1.23.1 + +replace go.opentelemetry.io/otel/metric => ../metric + +replace go.opentelemetry.io/otel => ../ + +replace go.opentelemetry.io/otel/trace => ../trace diff --git a/log/go.sum b/log/go.sum new file mode 100644 index 00000000000..2d8ac4840ed --- /dev/null +++ b/log/go.sum @@ -0,0 +1,5 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/log/keyvalue.go b/log/keyvalue.go new file mode 100644 index 00000000000..0860e760026 --- /dev/null +++ b/log/keyvalue.go @@ -0,0 +1,132 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:generate stringer -type=Kind -trimprefix=Kind + +package log // import "go.opentelemetry.io/otel/log" + +// Kind is the kind of a [Value]. +type Kind int + +// Kind values. +const ( + KindEmpty Kind = iota + KindBool + KindFloat64 + KindInt64 + KindString + KindBytes + KindList + KindMap +) + +// A Value represents a structured log value. +type Value struct{} // TODO (#4914): implement. + +// StringValue returns a new [Value] for a string. +func StringValue(v string) Value { return Value{} } // TODO (#4914): implement. + +// IntValue returns a [Value] for an int. +func IntValue(v int) Value { return Value{} } // TODO (#4914): implement. + +// Int64Value returns a [Value] for an int64. +func Int64Value(v int64) Value { return Value{} } // TODO (#4914): implement. + +// Float64Value returns a [Value] for a float64. +func Float64Value(v float64) Value { return Value{} } // TODO (#4914): implement. + +// BoolValue returns a [Value] for a bool. +func BoolValue(v bool) Value { //nolint:revive // Not a control flag. + // TODO (#4914): implement. + return Value{} +} + +// BytesValue returns a [Value] for a byte slice. The passed slice must not be +// changed after it is passed. +func BytesValue(v []byte) Value { return Value{} } // TODO (#4914): implement. + +// ListValue returns a [Value] for a slice of [Value]. The passed slice must +// not be changed after it is passed. +func ListValue(vs ...Value) Value { return Value{} } // TODO (#4914): implement. + +// MapValue returns a new [Value] for a slice of key-value pairs. The passed +// slice must not be changed after it is passed. +func MapValue(kvs ...KeyValue) Value { return Value{} } // TODO (#4914): implement. + +// AsAny returns the value held by v as an any. +func (v Value) AsAny() any { return nil } // TODO (#4914): implement + +// AsString returns the value held by v as a string. +func (v Value) AsString() string { return "" } // TODO (#4914): implement + +// AsInt64 returns the value held by v as an int64. +func (v Value) AsInt64() int64 { return 0 } // TODO (#4914): implement + +// AsBool returns the value held by v as a bool. +func (v Value) AsBool() bool { return false } // TODO (#4914): implement + +// AsFloat64 returns the value held by v as a float64. +func (v Value) AsFloat64() float64 { return 0 } // TODO (#4914): implement + +// AsBytes returns the value held by v as a []byte. +func (v Value) AsBytes() []byte { return nil } // TODO (#4914): implement + +// AsList returns the value held by v as a []Value. +func (v Value) AsList() []Value { return nil } // TODO (#4914): implement + +// AsMap returns the value held by v as a []KeyValue. +func (v Value) AsMap() []KeyValue { return nil } // TODO (#4914): implement + +// Kind returns the Kind of v. +func (v Value) Kind() Kind { return KindEmpty } // TODO (#4914): implement. + +// Empty returns if v does not hold any value. +func (v Value) Empty() bool { return false } // TODO (#4914): implement + +// Equal returns if v is equal to w. +func (v Value) Equal(w Value) bool { return false } // TODO (#4914): implement + +// An KeyValue is a key-value pair used to represent a log attribute (a +// superset of [go.opentelemetry.io/otel/attribute.KeyValue]) and map item. +type KeyValue struct { + Key string + Value Value +} + +// Equal returns if a is equal to b. +func (a KeyValue) Equal(b KeyValue) bool { return false } // TODO (#4914): implement + +// String returns an KeyValue for a string value. +func String(key, value string) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Int64 returns an KeyValue for an int64 value. +func Int64(key string, value int64) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Int returns an KeyValue for an int value. +func Int(key string, value int) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Float64 returns an KeyValue for a float64 value. +func Float64(key string, v float64) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Bool returns an KeyValue for a bool value. +func Bool(key string, v bool) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Bytes returns an KeyValue for a []byte value. +func Bytes(key string, v []byte) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// List returns an KeyValue for a []Value value. +func List(key string, args ...Value) KeyValue { return KeyValue{} } // TODO (#4914): implement + +// Map returns an KeyValue for a map value. +func Map(key string, args ...KeyValue) KeyValue { return KeyValue{} } // TODO (#4914): implement diff --git a/log/kind_string.go b/log/kind_string.go new file mode 100644 index 00000000000..c398fb47200 --- /dev/null +++ b/log/kind_string.go @@ -0,0 +1,30 @@ +// Code generated by "stringer -type=Kind -trimprefix=Kind"; DO NOT EDIT. + +package log + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[KindEmpty-0] + _ = x[KindBool-1] + _ = x[KindFloat64-2] + _ = x[KindInt64-3] + _ = x[KindString-4] + _ = x[KindBytes-5] + _ = x[KindList-6] + _ = x[KindMap-7] +} + +const _Kind_name = "EmptyBoolFloat64Int64StringBytesListMap" + +var _Kind_index = [...]uint8{0, 5, 9, 16, 21, 27, 32, 36, 39} + +func (i Kind) String() string { + if i < 0 || i >= Kind(len(_Kind_index)-1) { + return "Kind(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _Kind_name[_Kind_index[i]:_Kind_index[i+1]] +} diff --git a/log/logger.go b/log/logger.go new file mode 100644 index 00000000000..aefc42c2beb --- /dev/null +++ b/log/logger.go @@ -0,0 +1,65 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log // import "go.opentelemetry.io/otel/log" + +import ( + "context" + + "go.opentelemetry.io/otel/attribute" +) + +// Logger emits log records. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type Logger interface { + // TODO (#4909): embed an embedded type from otel/log/embedded. + + // Emit emits a log record. + // + // The record may be held by the implementation. Callers should not mutate + // the record after passed. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Emit(ctx context.Context, record Record) +} + +// LoggerOption applies configuration options to a [Logger]. +type LoggerOption interface { + // applyLogger is used to set a LoggerOption value of a LoggerConfig. + applyLogger(LoggerConfig) LoggerConfig +} + +// LoggerConfig contains options for a [Logger]. +type LoggerConfig struct { + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. +} + +// NewLoggerConfig returns a new [LoggerConfig] with all the opts applied. +func NewLoggerConfig(opts ...LoggerOption) LoggerConfig { return LoggerConfig{} } // TODO (#4911): implement. + +// InstrumentationVersion returns the version of the library providing +// instrumentation. +func (cfg LoggerConfig) InstrumentationVersion() string { return "" } // TODO (#4911): implement. + +// InstrumentationAttributes returns the attributes associated with the library +// providing instrumentation. +func (cfg LoggerConfig) InstrumentationAttributes() attribute.Set { return attribute.NewSet() } // TODO (#4911): implement. + +// SchemaURL returns the schema URL of the library providing instrumentation. +func (cfg LoggerConfig) SchemaURL() string { return "" } // TODO (#4911): implement. diff --git a/log/provider.go b/log/provider.go new file mode 100644 index 00000000000..76c870ac261 --- /dev/null +++ b/log/provider.go @@ -0,0 +1,32 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log // import "go.opentelemetry.io/otel/log" + +// LoggerProvider provides access to [Logger]. +// +// Warning: Methods may be added to this interface in minor releases. See +// package documentation on API implementation for information on how to set +// default behavior for unimplemented methods. +type LoggerProvider interface { + // TODO (#4909): embed an embedded type from otel/log/embedded. + + // Logger returns a new [Logger] with the provided name and configuration. + // + // If name is empty, implementations need to provide a default name. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Logger(name string, options ...LoggerOption) Logger +} diff --git a/log/record.go b/log/record.go new file mode 100644 index 00000000000..334d36d40ab --- /dev/null +++ b/log/record.go @@ -0,0 +1,62 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log // import "go.opentelemetry.io/otel/log" + +import "time" + +// Record represents a log record. +type Record struct{} // TODO (#4913): implement. + +// Timestamp returns the time when the log record occurred. +func (r *Record) Timestamp() time.Time { return time.Time{} } // TODO (#4913): implement. + +// SetTimestamp sets the time when the log record occurred. +func (r *Record) SetTimestamp(t time.Time) {} // TODO (#4913): implement. + +// ObservedTimestamp returns the time when the log record was observed. +func (r *Record) ObservedTimestamp() time.Time { return time.Time{} } // TODO (#4913): implement. + +// SetObservedTimestamp sets the time when the log record was observed. +func (r *Record) SetObservedTimestamp(t time.Time) {} // TODO (#4913): implement. + +// Severity returns the [Severity] of the log record. +func (r *Record) Severity() Severity { return 0 } // TODO (#4913): implement. + +// SetSeverity sets the [Severity] level of the log record. +func (r *Record) SetSeverity(level Severity) {} // TODO (#4913): implement. + +// SeverityText returns severity (also known as log level) text. This is the +// original string representation of the severity as it is known at the source. +func (r *Record) SeverityText() string { return "" } // TODO (#4913): implement. + +// SetSeverityText sets severity (also known as log level) text. This is the +// original string representation of the severity as it is known at the source. +func (r *Record) SetSeverityText(text string) {} // TODO (#4913): implement. + +// Body returns the body of the log record. +func (r *Record) Body() Value { return Value{} } // TODO (#4913): implement. + +// SetBody sets the body of the log record. +func (r *Record) SetBody(v Value) {} // TODO (#4913): implement. + +// WalkAttributes walks all attributes the log record holds by calling f for +// each on each [KeyValue] in the [Record]. Iteration stops if f returns false. +func (r *Record) WalkAttributes(f func(KeyValue) bool) {} // TODO (#4913): implement. + +// AddAttributes adds attributes to the log record. +func (r *Record) AddAttributes(attributes ...KeyValue) {} // TODO (#4913): implement. + +// AttributesLen returns the number of attributes in the log record. +func (r *Record) AttributesLen() int { return 0 } // TODO (#4913): implement. diff --git a/log/severity.go b/log/severity.go new file mode 100644 index 00000000000..45edd681a78 --- /dev/null +++ b/log/severity.go @@ -0,0 +1,72 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:generate stringer -type=Severity -linecomment + +package log // import "go.opentelemetry.io/otel/log" + +// Severity represents a log record severity (also known as log level). Smaller +// numerical values correspond to less severe log records (such as debug +// events), larger numerical values correspond to more severe log records (such +// as errors and critical events). +type Severity int + +// Severity values defined by OpenTelemetry. +const ( + // A fine-grained debugging log record. Typically disabled in default + // configurations. + SeverityTrace1 Severity = 1 // TRACE + SeverityTrace2 Severity = 2 // TRACE2 + SeverityTrace3 Severity = 3 // TRACE3 + SeverityTrace4 Severity = 4 // TRACE4 + + // A debugging log record. + SeverityDebug1 Severity = 5 // DEBUG + SeverityDebug2 Severity = 6 // DEBUG2 + SeverityDebug3 Severity = 7 // DEBUG3 + SeverityDebug4 Severity = 8 // DEBUG4 + + // An informational log record. Indicates that an event happened. + SeverityInfo1 Severity = 9 // INFO + SeverityInfo2 Severity = 10 // INFO2 + SeverityInfo3 Severity = 11 // INFO3 + SeverityInfo4 Severity = 12 // INFO4 + + // A warning log record. Not an error but is likely more important than an + // informational event. + SeverityWarn1 Severity = 13 // WARN + SeverityWarn2 Severity = 14 // WARN2 + SeverityWarn3 Severity = 15 // WARN3 + SeverityWarn4 Severity = 16 // WARN4 + + // An error log record. Something went wrong. + SeverityError1 Severity = 17 // ERROR + SeverityError2 Severity = 18 // ERROR2 + SeverityError3 Severity = 19 // ERROR3 + SeverityError4 Severity = 20 // ERROR4 + + // A fatal log record such as application or system crash. + SeverityFatal1 Severity = 21 // FATAL + SeverityFatal2 Severity = 22 // FATAL2 + SeverityFatal3 Severity = 23 // FATAL3 + SeverityFatal4 Severity = 24 // FATAL4 + + // Convenience definitions for the base severity of each level. + SeverityTrace = SeverityTrace1 + SeverityDebug = SeverityDebug1 + SeverityInfo = SeverityInfo1 + SeverityWarn = SeverityWarn1 + SeverityError = SeverityError1 + SeverityFatal = SeverityFatal1 +) diff --git a/log/severity_string.go b/log/severity_string.go new file mode 100644 index 00000000000..d742ae5fe88 --- /dev/null +++ b/log/severity_string.go @@ -0,0 +1,47 @@ +// Code generated by "stringer -type=Severity -linecomment"; DO NOT EDIT. + +package log + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[SeverityTrace1-1] + _ = x[SeverityTrace2-2] + _ = x[SeverityTrace3-3] + _ = x[SeverityTrace4-4] + _ = x[SeverityDebug1-5] + _ = x[SeverityDebug2-6] + _ = x[SeverityDebug3-7] + _ = x[SeverityDebug4-8] + _ = x[SeverityInfo1-9] + _ = x[SeverityInfo2-10] + _ = x[SeverityInfo3-11] + _ = x[SeverityInfo4-12] + _ = x[SeverityWarn1-13] + _ = x[SeverityWarn2-14] + _ = x[SeverityWarn3-15] + _ = x[SeverityWarn4-16] + _ = x[SeverityError1-17] + _ = x[SeverityError2-18] + _ = x[SeverityError3-19] + _ = x[SeverityError4-20] + _ = x[SeverityFatal1-21] + _ = x[SeverityFatal2-22] + _ = x[SeverityFatal3-23] + _ = x[SeverityFatal4-24] +} + +const _Severity_name = "TRACETRACE2TRACE3TRACE4DEBUGDEBUG2DEBUG3DEBUG4INFOINFO2INFO3INFO4WARNWARN2WARN3WARN4ERRORERROR2ERROR3ERROR4FATALFATAL2FATAL3FATAL4" + +var _Severity_index = [...]uint8{0, 5, 11, 17, 23, 28, 34, 40, 46, 50, 55, 60, 65, 69, 74, 79, 84, 89, 95, 101, 107, 112, 118, 124, 130} + +func (i Severity) String() string { + i -= 1 + if i < 0 || i >= Severity(len(_Severity_index)-1) { + return "Severity(" + strconv.FormatInt(int64(i+1), 10) + ")" + } + return _Severity_name[_Severity_index[i]:_Severity_index[i+1]] +} diff --git a/versions.yaml b/versions.yaml index 19a73c626ad..96480add1db 100644 --- a/versions.yaml +++ b/versions.yaml @@ -50,3 +50,4 @@ module-sets: - go.opentelemetry.io/otel/schema excluded-modules: - go.opentelemetry.io/otel/internal/tools + - go.opentelemetry.io/otel/log From 87396747adaad1d510214d14d5afc386652f8bdf Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:52:57 +0100 Subject: [PATCH 866/886] dependabot updates Fri Feb 16 15:32:59 UTC 2024 (#4934) Bump golang.org/x/tools from 0.17.0 to 0.18.0 in /internal/tools Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /exporters/otlp/otlptrace/otlptracehttp Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /example/otel-collector Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.61.0 to 1.61.1 in /bridge/opentracing/test Bump codecov/codecov-action from 3.1.5 to 4.0.1 --- bridge/opentracing/test/go.mod | 2 +- bridge/opentracing/test/go.sum | 4 ++-- example/otel-collector/go.mod | 2 +- example/otel-collector/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 2 +- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 4 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 2 +- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 2 +- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/go.mod | 2 +- exporters/otlp/otlptrace/otlptracehttp/go.sum | 4 ++-- internal/tools/go.mod | 10 ++++----- internal/tools/go.sum | 22 +++++++++---------- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index d791665784b..06df37a157f 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.23.1 go.opentelemetry.io/otel/bridge/opentracing v1.23.1 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 ) require ( diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index fd0ec2aa874..c9afb3566f6 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -54,8 +54,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 57b58b60f72..b5ecc5c9353 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1 go.opentelemetry.io/otel/sdk v1.23.1 go.opentelemetry.io/otel/trace v1.23.1 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 ) require ( diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 3530db476f6..94cbc1869ca 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -30,8 +30,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 4895146b132..f9228200e10 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index 819c64f0d4b..cccb45af00b 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 1e36e9c9eca..9d701daf738 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/sdk v1.23.1 go.opentelemetry.io/otel/sdk/metric v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index 819c64f0d4b..cccb45af00b 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 442b1ec638d..93530a71c94 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 8093fdef794..9a3c1868c33 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -39,8 +39,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index 21795628713..aa428f6ce30 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/sdk v1.23.1 go.opentelemetry.io/otel/trace v1.23.1 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.61.0 + google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 ) diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index b11735f81b6..f65af23c279 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -37,8 +37,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 h1:6G8oQ016D88m1xAKljMlBOOGWDZkes4kMhgGFlf8WcQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 8bc9fa9a026..d5fa9339242 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.12.0 go.opentelemetry.io/build-tools/semconvgen v0.12.0 golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea - golang.org/x/tools v0.17.0 + golang.org/x/tools v0.18.0 golang.org/x/vuln v1.0.4 ) @@ -201,12 +201,12 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.18.0 // indirect + golang.org/x/crypto v0.19.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.20.0 // indirect + golang.org/x/mod v0.15.0 // indirect + golang.org/x/net v0.21.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index f9e33d59ce0..4e998f5b6d2 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -660,8 +660,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -708,8 +708,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -753,8 +753,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -841,8 +841,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -850,7 +850,7 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -938,8 +938,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= -golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/vuln v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I= golang.org/x/vuln v1.0.4/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 693eb7dbbb59e18e92ceacfcb957a99f64ac29f3 Mon Sep 17 00:00:00 2001 From: Charlie Le <3375195+CharlieTLe@users.noreply.github.com> Date: Sat, 17 Feb 2024 04:36:41 -0800 Subject: [PATCH 867/886] Fix typos in docs and comments (#4940) Ignoring words that would have renamed - nam. -> name - ans -> and --- .codespellignore | 2 ++ Makefile | 2 +- README.md | 2 +- log/DESIGN.md | 8 ++++---- sdk/metric/exemplar.go | 2 +- sdk/metric/internal/exemplar/reservoir_test.go | 2 +- sdk/metric/meter_test.go | 2 +- sdk/trace/trace_test.go | 2 +- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.codespellignore b/.codespellignore index ae6a3bcf12c..120b63a9c7d 100644 --- a/.codespellignore +++ b/.codespellignore @@ -3,3 +3,5 @@ fo te collison consequentially +ans +nam diff --git a/Makefile b/Makefile index 2cedd200d3c..6de95219be7 100644 --- a/Makefile +++ b/Makefile @@ -192,7 +192,7 @@ test-coverage: | $(GOCOVMERGE) done; \ $(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt -# Adding a directory will include all benchmarks in that direcotry if a filter is not specified. +# Adding a directory will include all benchmarks in that directory if a filter is not specified. BENCHMARK_TARGETS := sdk/trace .PHONY: benchmark benchmark: $(BENCHMARK_TARGETS:%=benchmark/%) diff --git a/README.md b/README.md index 13bcc5e590a..7766259a5c1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ It provides a set of APIs to directly measure performance and behavior of your s | Metrics | Stable | | Logs | In development[^1] | -Progres and status specific to this repository is tracked in our +Progress and status specific to this repository is tracked in our [project boards](https://github.com/open-telemetry/opentelemetry-go/projects) and [milestones](https://github.com/open-telemetry/opentelemetry-go/milestones). diff --git a/log/DESIGN.md b/log/DESIGN.md index 58236059cb0..7528d34041d 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -30,7 +30,7 @@ The module name is compliant with [Artifact Naming](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/bridge-api.md#artifact-naming) and the package structure is the same as for Trace API and Metrics API. -The Go module consits of the following packages: +The Go module consists of the following packages: - `go.opentelemetry.io/otel/log` - `go.opentelemetry.io/otel/log/embedded` @@ -240,14 +240,14 @@ when converting records to a different representation: func (r *Record) AttributesLen() int ``` -The records attributes design and implemntation is based on +The records attributes design and implementation is based on [`slog.Record`](https://pkg.go.dev/log/slog#Record). It allows achieving high-performance access and manipulation of the attributes while keeping the API user friendly. It relieves the user from making his own improvements for reducing the number of allocations when passing attributes. -The following defintions are implementing the abstractions +The following definitions are implementing the abstractions described in [the specification](https://opentelemetry.io/docs/specs/otel/logs/#new-first-party-application-logs): ```go @@ -510,7 +510,7 @@ favor passing the record via pointer (and vice versa). Passing via value feels safer because of the following reasons. The user would not be able to pass `nil`. -Therefore, it reduces the possiblity to have a nil pointer dereference. +Therefore, it reduces the possibility to have a nil pointer dereference. It should reduce the possibility of a heap allocation. diff --git a/sdk/metric/exemplar.go b/sdk/metric/exemplar.go index 77579acdb40..3f1ce9f1d88 100644 --- a/sdk/metric/exemplar.go +++ b/sdk/metric/exemplar.go @@ -63,7 +63,7 @@ func reservoirFunc[N int64 | float64](agg Aggregation) func() exemplar.Reservoir // This Exemplar reservoir MAY take a configuration parameter for // the size of the reservoir. If no size configuration is // provided, the default size MAY be the number of possible - // concurrent threads (e.g. numer of CPUs) to help reduce + // concurrent threads (e.g. number of CPUs) to help reduce // contention. Otherwise, a default size of 1 SHOULD be used. n = runtime.NumCPU() if n < 1 { diff --git a/sdk/metric/internal/exemplar/reservoir_test.go b/sdk/metric/internal/exemplar/reservoir_test.go index 65c179dc106..8eafe178647 100644 --- a/sdk/metric/internal/exemplar/reservoir_test.go +++ b/sdk/metric/internal/exemplar/reservoir_test.go @@ -125,7 +125,7 @@ func ReservoirTest[N int64 | float64](f factory[N]) func(*testing.T) { r.Collect(&dest) assert.Len(t, dest, n, "multiple offers did not fill reservoir") - // Ensure the collect reset also resets any couting state. + // Ensure the collect reset also resets any counting state. for i := 0; i < n+1; i++ { v := N(i) r.Offer(ctx, staticTime, v, nil) diff --git a/sdk/metric/meter_test.go b/sdk/metric/meter_test.go index 5bec7c2ce38..080c7e00b33 100644 --- a/sdk/metric/meter_test.go +++ b/sdk/metric/meter_test.go @@ -170,7 +170,7 @@ func TestCallbackUnregisterConcurrency(t *testing.T) { // Instruments should produce correct ResourceMetrics. func TestMeterCreatesInstruments(t *testing.T) { - // The synchronous measurement methods must ignore the context cancelation. + // The synchronous measurement methods must ignore the context cancellation. ctx, cancel := context.WithCancel(context.Background()) cancel() diff --git a/sdk/trace/trace_test.go b/sdk/trace/trace_test.go index df8dab7d68c..feaff2f1974 100644 --- a/sdk/trace/trace_test.go +++ b/sdk/trace/trace_test.go @@ -1142,7 +1142,7 @@ func TestSpanWithCanceledContext(t *testing.T) { _, span := tp.Tracer(t.Name()).Start(ctx, "span") span.End() - assert.Equal(t, 1, te.Len(), "span recording must ignore context cancelation") + assert.Equal(t, 1, te.Len(), "span recording must ignore context cancellation") } func TestNonRecordingSpanDoesNotTrackRuntimeTracerTask(t *testing.T) { From 395800bbd5ae45f9da39a71a0bc73519299455d2 Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 18 Feb 2024 16:42:58 +0100 Subject: [PATCH 868/886] dependabot updates Sun Feb 18 15:37:06 UTC 2024 (#4942) Bump github.com/prometheus/client_model from 0.5.0 to 0.6.0 in /exporters/prometheus --- example/prometheus/go.mod | 2 +- example/prometheus/go.sum | 4 ++-- exporters/prometheus/go.mod | 2 +- exporters/prometheus/go.sum | 4 ++-- internal/tools/go.mod | 2 +- internal/tools/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 5fb1263a4c9..743c37d5028 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -16,7 +16,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/sdk v1.23.1 // indirect diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 6cee4eb4de1..6a767b8484b 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -14,8 +14,8 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQth github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 39dc1c6f2d9..671419e2ad2 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - github.com/prometheus/client_model v0.5.0 + github.com/prometheus/client_model v0.6.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.23.1 go.opentelemetry.io/otel/metric v1.23.1 diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index f2867706f84..466109a5d70 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -20,8 +20,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index d5fa9339242..5d3744be9c1 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -146,7 +146,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/polyfloyd/go-errorlint v1.4.5 // indirect github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quasilyte/go-ruleguard v0.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 4e998f5b6d2..86e1fa98ed4 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -475,8 +475,8 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1: github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= +github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= From 48bb3c8642602f9ecec9bc05d48782a527ea7c66 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 18 Feb 2024 07:51:13 -0800 Subject: [PATCH 869/886] Add the `log/embedded` package (#4932) * Add the log/embedded package * Embed the Logger and LoggerProvider types --- log/embedded/embedded.go | 47 ++++++++++++++++++++++++++++++++++++++++ log/logger.go | 6 ++++- log/provider.go | 7 +++++- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 log/embedded/embedded.go diff --git a/log/embedded/embedded.go b/log/embedded/embedded.go new file mode 100644 index 00000000000..eeecbdae1f2 --- /dev/null +++ b/log/embedded/embedded.go @@ -0,0 +1,47 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package embedded provides interfaces embedded within the [OpenTelemetry Logs +// Bridge API]. +// +// Implementers of the [OpenTelemetry Logs Bridge API] can embed the relevant +// type from this package into their implementation directly. Doing so will +// result in a compilation error for users when the [OpenTelemetry Logs Bridge +// API] is extended (which is something that can happen without a major version +// bump of the API package). +// +// [OpenTelemetry Logs Bridge API]: https://github.com/open-telemetry/opentelemetry-go/tree/d3dcb3999c5689a7bb803cb0529e55a651ed14f1/log +package embedded // import "go.opentelemetry.io/otel/log/embedded" + +// LoggerProvider is embedded in the [Logs Bridge API LoggerProvider]. +// +// Embed this interface in your implementation of the [Logs Bridge API +// LoggerProvider] if you want users to experience a compilation error, +// signaling they need to update to your latest implementation, when the [Logs +// Bridge API LoggerProvider] interface is extended (which is something that +// can happen without a major version bump of the API package). +// +// [Logs Bridge API LoggerProvider]: https://github.com/open-telemetry/opentelemetry-go/blob/d3dcb3999c5689a7bb803cb0529e55a651ed14f1/log/provider.go#L22-L32 +type LoggerProvider interface{ loggerProvider() } + +// Logger is embedded in [Logs Bridge API Logger]. +// +// Embed this interface in your implementation of the [Logs Bridge API Logger] +// if you want users to experience a compilation error, signaling they need to +// update to your latest implementation, when the [Logs Bridge API Logger] +// interface is extended (which is something that can happen without a major +// version bump of the API package). +// +// [Logs Bridge API Logger]: https://github.com/open-telemetry/opentelemetry-go/blob/d3dcb3999c5689a7bb803cb0529e55a651ed14f1/log/logger.go#L28-L39 +type Logger interface{ logger() } diff --git a/log/logger.go b/log/logger.go index aefc42c2beb..2b00ba09457 100644 --- a/log/logger.go +++ b/log/logger.go @@ -18,6 +18,7 @@ import ( "context" "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/log/embedded" ) // Logger emits log records. @@ -26,7 +27,10 @@ import ( // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type Logger interface { - // TODO (#4909): embed an embedded type from otel/log/embedded. + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.Logger // Emit emits a log record. // diff --git a/log/provider.go b/log/provider.go index 76c870ac261..4a0da402367 100644 --- a/log/provider.go +++ b/log/provider.go @@ -14,13 +14,18 @@ package log // import "go.opentelemetry.io/otel/log" +import "go.opentelemetry.io/otel/log/embedded" + // LoggerProvider provides access to [Logger]. // // Warning: Methods may be added to this interface in minor releases. See // package documentation on API implementation for information on how to set // default behavior for unimplemented methods. type LoggerProvider interface { - // TODO (#4909): embed an embedded type from otel/log/embedded. + // Users of the interface can ignore this. This embedded type is only used + // by implementations of this interface. See the "API Implementations" + // section of the package documentation for more information. + embedded.LoggerProvider // Logger returns a new [Logger] with the provided name and configuration. // From 59413575e4d0b1a3febbed6138ddaf5d82de7950 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 18 Feb 2024 08:01:24 -0800 Subject: [PATCH 870/886] Update otel/log package docs (#4935) --- log/doc.go | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/log/doc.go b/log/doc.go index 8920510c0b5..c6f5ad4a725 100644 --- a/log/doc.go +++ b/log/doc.go @@ -14,8 +14,70 @@ /* Package log provides the OpenTelemetry Logs Bridge API. -*/ -// TODO (#4908): expand documentation stub. +This package is intended to be a bridge between existing logging libraries and +OpenTelemetry. It is not designed to be a logging API itself. + +# API Implementations + +This package does not conform to the standard Go versioning policy, all of its +interfaces may have methods added to them without a package major version bump. +This non-standard API evolution could surprise an uninformed implementation +author. They could unknowingly build their implementation in a way that would +result in a runtime panic for their users that update to the new API. + +The API is designed to help inform an instrumentation author about this +non-standard API evolution. It requires them to choose a default behavior for +unimplemented interface methods. There are three behavior choices they can +make: + + - Compilation failure + - Panic + - Default to another implementation + +All interfaces in this API embed a corresponding interface from +go.opentelemetry.io/otel/log/embedded. If an author wants the default behavior +of their implementations to be a compilation failure, signaling to their users +they need to update to the latest version of that implementation, they need to +embed the corresponding interface from go.opentelemetry.io/otel/log/embedded in +their implementation. For example, + + import "go.opentelemetry.io/otel/log/embedded" + + type LoggerProvider struct { + embedded.LoggerProvider + // ... + } +If an author wants the default behavior of their implementations to a panic, +they need to embed the API interface directly. + + import "go.opentelemetry.io/otel/log" + + type LoggerProvider struct { + log.LoggerProvider + // ... + } + +This is not a recommended behavior as it could lead to publishing packages that +contain runtime panics when users update other package that use newer versions +of go.opentelemetry.io/otel/log. + +Finally, an author can embed another implementation in theirs. The embedded +implementation will be used for methods not defined by the author. For example, +an author who wants to default to silently dropping the call can use +o.opentelemetry.io/otel/log/noop: + + import "go.opentelemetry.io/otel/log/noop" + + type LoggerProvider struct { + noop.LoggerProvider + // ... + } + +It is strongly recommended that authors only embed +go.opentelemetry.io/otel/log/noop if they choose this default behavior. That +implementation is the only one OpenTelemetry authors can guarantee will fully +implement all the API interfaces when a user updates their API. +*/ package log // import "go.opentelemetry.io/otel/log" From 6e2bfb69edd9ba7ed388130d45fd8dfe448bd5b0 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 18 Feb 2024 08:08:28 -0800 Subject: [PATCH 871/886] Rename log List value type to Slice (#4936) --- log/DESIGN.md | 10 +++++----- log/keyvalue.go | 14 +++++++------- log/kind_string.go | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/log/DESIGN.md b/log/DESIGN.md index 7528d34041d..f08de5d8431 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -262,7 +262,7 @@ const ( KindInt64 KindString KindBytes - KindList + KindSlice KindMap ) @@ -282,7 +282,7 @@ func BoolValue(v bool) Value func BytesValue(v []byte) Value -func ListValue(vs ...Value) Value +func SliceValue(vs ...Value) Value func MapValue(kvs ...KeyValue) Value @@ -300,7 +300,7 @@ func (v Value) AsFloat64() float64 func (v Value) AsBytes() []byte -func (v Value) AsList() []Value +func (v Value) AsSlice() []Value func (v Value) AsMap() []KeyValue @@ -330,7 +330,7 @@ func Bool(key string, v bool) KeyValue func Bytes(key string, v []byte) KeyValue -func List(key string, args ...Value) KeyValue +func Slice(key string, args ...Value) KeyValue func Map(key string, args ...KeyValue) KeyValue @@ -349,7 +349,7 @@ func (a KeyValue) Equal(b KeyValue) bool `KindInt64` is used for a signed integer value. `KindString` is used for a string value. `KindBytes` is used for a slice of bytes (in spec: A byte array). -`KindList` is used for a slice of values (in spec: an array (a list) of any values). +`KindSlice` is used for a slice of values (in spec: an array (a list) of any values). `KindMap` is used for a slice of key-value pairs (in spec: `map`). These types are defined in `go.opentelemetry.io/otel/log` package diff --git a/log/keyvalue.go b/log/keyvalue.go index 0860e760026..b39c00a4b45 100644 --- a/log/keyvalue.go +++ b/log/keyvalue.go @@ -27,7 +27,7 @@ const ( KindInt64 KindString KindBytes - KindList + KindSlice KindMap ) @@ -56,9 +56,9 @@ func BoolValue(v bool) Value { //nolint:revive // Not a control flag. // changed after it is passed. func BytesValue(v []byte) Value { return Value{} } // TODO (#4914): implement. -// ListValue returns a [Value] for a slice of [Value]. The passed slice must +// SliceValue returns a [Value] for a slice of [Value]. The passed slice must // not be changed after it is passed. -func ListValue(vs ...Value) Value { return Value{} } // TODO (#4914): implement. +func SliceValue(vs ...Value) Value { return Value{} } // TODO (#4914): implement. // MapValue returns a new [Value] for a slice of key-value pairs. The passed // slice must not be changed after it is passed. @@ -82,8 +82,8 @@ func (v Value) AsFloat64() float64 { return 0 } // TODO (#4914): implement // AsBytes returns the value held by v as a []byte. func (v Value) AsBytes() []byte { return nil } // TODO (#4914): implement -// AsList returns the value held by v as a []Value. -func (v Value) AsList() []Value { return nil } // TODO (#4914): implement +// AsSlice returns the value held by v as a []Value. +func (v Value) AsSlice() []Value { return nil } // TODO (#4914): implement // AsMap returns the value held by v as a []KeyValue. func (v Value) AsMap() []KeyValue { return nil } // TODO (#4914): implement @@ -125,8 +125,8 @@ func Bool(key string, v bool) KeyValue { return KeyValue{} } // TODO (#4914): im // Bytes returns an KeyValue for a []byte value. func Bytes(key string, v []byte) KeyValue { return KeyValue{} } // TODO (#4914): implement -// List returns an KeyValue for a []Value value. -func List(key string, args ...Value) KeyValue { return KeyValue{} } // TODO (#4914): implement +// Slice returns an KeyValue for a []Value value. +func Slice(key string, args ...Value) KeyValue { return KeyValue{} } // TODO (#4914): implement // Map returns an KeyValue for a map value. func Map(key string, args ...KeyValue) KeyValue { return KeyValue{} } // TODO (#4914): implement diff --git a/log/kind_string.go b/log/kind_string.go index c398fb47200..bdfaa18665c 100644 --- a/log/kind_string.go +++ b/log/kind_string.go @@ -14,13 +14,13 @@ func _() { _ = x[KindInt64-3] _ = x[KindString-4] _ = x[KindBytes-5] - _ = x[KindList-6] + _ = x[KindSlice-6] _ = x[KindMap-7] } -const _Kind_name = "EmptyBoolFloat64Int64StringBytesListMap" +const _Kind_name = "EmptyBoolFloat64Int64StringBytesSliceMap" -var _Kind_index = [...]uint8{0, 5, 9, 16, 21, 27, 32, 36, 39} +var _Kind_index = [...]uint8{0, 5, 9, 16, 21, 27, 32, 37, 40} func (i Kind) String() string { if i < 0 || i >= Kind(len(_Kind_index)-1) { From e3e8879eb3b8c513815cdbe9fbdb99bbf58427e5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Sun, 18 Feb 2024 08:13:42 -0800 Subject: [PATCH 872/886] Implement the `LoggerConfig` and add the `LoggerOption`s (#4937) * Implement the LoggerConfig * Add the LoggerOptions * Add NewLoggerConfig test --- log/go.mod | 11 ++++++++- log/go.sum | 6 +++++ log/logger.go | 61 ++++++++++++++++++++++++++++++++++++++++++---- log/logger_test.go | 43 ++++++++++++++++++++++++++++++++ 4 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 log/logger_test.go diff --git a/log/go.mod b/log/go.mod index 715553c4576..2dfceaf6ed3 100644 --- a/log/go.mod +++ b/log/go.mod @@ -2,7 +2,16 @@ module go.opentelemetry.io/otel/log go 1.20 -require go.opentelemetry.io/otel v1.23.1 +require ( + github.com/stretchr/testify v1.8.4 + go.opentelemetry.io/otel v1.23.1 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) replace go.opentelemetry.io/otel/metric => ../metric diff --git a/log/go.sum b/log/go.sum index 2d8ac4840ed..a6bcd03a15e 100644 --- a/log/go.sum +++ b/log/go.sum @@ -1,5 +1,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/log/logger.go b/log/logger.go index 2b00ba09457..555365219a5 100644 --- a/log/logger.go +++ b/log/logger.go @@ -52,18 +52,69 @@ type LoggerOption interface { type LoggerConfig struct { // Ensure forward compatibility by explicitly making this not comparable. noCmp [0]func() //nolint: unused // This is indeed used. + + version string + schemaURL string + attrs attribute.Set } -// NewLoggerConfig returns a new [LoggerConfig] with all the opts applied. -func NewLoggerConfig(opts ...LoggerOption) LoggerConfig { return LoggerConfig{} } // TODO (#4911): implement. +// NewLoggerConfig returns a new [LoggerConfig] with all the options applied. +func NewLoggerConfig(options ...LoggerOption) LoggerConfig { + var c LoggerConfig + for _, opt := range options { + c = opt.applyLogger(c) + } + return c +} // InstrumentationVersion returns the version of the library providing // instrumentation. -func (cfg LoggerConfig) InstrumentationVersion() string { return "" } // TODO (#4911): implement. +func (cfg LoggerConfig) InstrumentationVersion() string { + return cfg.version +} // InstrumentationAttributes returns the attributes associated with the library // providing instrumentation. -func (cfg LoggerConfig) InstrumentationAttributes() attribute.Set { return attribute.NewSet() } // TODO (#4911): implement. +func (cfg LoggerConfig) InstrumentationAttributes() attribute.Set { + return cfg.attrs +} // SchemaURL returns the schema URL of the library providing instrumentation. -func (cfg LoggerConfig) SchemaURL() string { return "" } // TODO (#4911): implement. +func (cfg LoggerConfig) SchemaURL() string { + return cfg.schemaURL +} + +type loggerOptionFunc func(LoggerConfig) LoggerConfig + +func (fn loggerOptionFunc) applyLogger(cfg LoggerConfig) LoggerConfig { + return fn(cfg) +} + +// WithInstrumentationVersion returns a [LoggerOption] that sets the +// instrumentation version of a [Logger]. +func WithInstrumentationVersion(version string) LoggerOption { + return loggerOptionFunc(func(config LoggerConfig) LoggerConfig { + config.version = version + return config + }) +} + +// WithInstrumentationAttributes returns a [LoggerOption] that sets the +// instrumentation attributes of a [Logger]. +// +// The passed attributes will be de-duplicated. +func WithInstrumentationAttributes(attr ...attribute.KeyValue) LoggerOption { + return loggerOptionFunc(func(config LoggerConfig) LoggerConfig { + config.attrs = attribute.NewSet(attr...) + return config + }) +} + +// WithSchemaURL returns a [LoggerOption] that sets the schema URL for a +// [Logger]. +func WithSchemaURL(schemaURL string) LoggerOption { + return loggerOptionFunc(func(config LoggerConfig) LoggerConfig { + config.schemaURL = schemaURL + return config + }) +} diff --git a/log/logger_test.go b/log/logger_test.go new file mode 100644 index 00000000000..4367ed33a5d --- /dev/null +++ b/log/logger_test.go @@ -0,0 +1,43 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/log" +) + +func TestNewLoggerConfig(t *testing.T) { + version := "v1.1.1" + schemaURL := "https://opentelemetry.io/schemas/1.0.0" + attr := attribute.NewSet( + attribute.String("user", "alice"), + attribute.Bool("admin", true), + ) + + c := log.NewLoggerConfig( + log.WithInstrumentationVersion(version), + log.WithSchemaURL(schemaURL), + log.WithInstrumentationAttributes(attr.ToSlice()...), + ) + + assert.Equal(t, version, c.InstrumentationVersion(), "instrumentation version") + assert.Equal(t, schemaURL, c.SchemaURL(), "schema URL") + assert.Equal(t, attr, c.InstrumentationAttributes(), "instrumentation attributes") +} From d423033b1f2660dcb9ebc8b38b66fe06f81dd693 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 19 Feb 2024 04:47:24 -0800 Subject: [PATCH 873/886] Test Severity const match OTel spec (#4938) Resolve #4912 --- log/severity_test.go | 220 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 log/severity_test.go diff --git a/log/severity_test.go b/log/severity_test.go new file mode 100644 index 00000000000..12aa5538f07 --- /dev/null +++ b/log/severity_test.go @@ -0,0 +1,220 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/log" +) + +func TestSeverity(t *testing.T) { + // Test the Severity constants match the OTel values and short names. + testCases := []struct { + name string + severity log.Severity + value int + str string + }{ + { + name: "SeverityTrace", + severity: log.SeverityTrace, + value: 1, + str: "TRACE", + }, + { + name: "SeverityTrace1", + severity: log.SeverityTrace1, + value: 1, + str: "TRACE", + }, + { + name: "SeverityTrace2", + severity: log.SeverityTrace2, + value: 2, + str: "TRACE2", + }, + { + name: "SeverityTrace3", + severity: log.SeverityTrace3, + value: 3, + str: "TRACE3", + }, + { + name: "SeverityTrace4", + severity: log.SeverityTrace4, + value: 4, + str: "TRACE4", + }, + { + name: "SeverityDebug", + severity: log.SeverityDebug, + value: 5, + str: "DEBUG", + }, + { + name: "SeverityDebug1", + severity: log.SeverityDebug1, + value: 5, + str: "DEBUG", + }, + { + name: "SeverityDebug2", + severity: log.SeverityDebug2, + value: 6, + str: "DEBUG2", + }, + { + name: "SeverityDebug3", + severity: log.SeverityDebug3, + value: 7, + str: "DEBUG3", + }, + { + name: "SeverityDebug4", + severity: log.SeverityDebug4, + value: 8, + str: "DEBUG4", + }, + { + name: "SeverityInfo", + severity: log.SeverityInfo, + value: 9, + str: "INFO", + }, + { + name: "SeverityInfo1", + severity: log.SeverityInfo1, + value: 9, + str: "INFO", + }, + { + name: "SeverityInfo2", + severity: log.SeverityInfo2, + value: 10, + str: "INFO2", + }, + { + name: "SeverityInfo3", + severity: log.SeverityInfo3, + value: 11, + str: "INFO3", + }, + { + name: "SeverityInfo4", + severity: log.SeverityInfo4, + value: 12, + str: "INFO4", + }, + { + name: "SeverityWarn", + severity: log.SeverityWarn, + value: 13, + str: "WARN", + }, + { + name: "SeverityWarn1", + severity: log.SeverityWarn1, + value: 13, + str: "WARN", + }, + { + name: "SeverityWarn2", + severity: log.SeverityWarn2, + value: 14, + str: "WARN2", + }, + { + name: "SeverityWarn3", + severity: log.SeverityWarn3, + value: 15, + str: "WARN3", + }, + { + name: "SeverityWarn4", + severity: log.SeverityWarn4, + value: 16, + str: "WARN4", + }, + { + name: "SeverityError", + severity: log.SeverityError, + value: 17, + str: "ERROR", + }, + { + name: "SeverityError1", + severity: log.SeverityError1, + value: 17, + str: "ERROR", + }, + { + name: "SeverityError2", + severity: log.SeverityError2, + value: 18, + str: "ERROR2", + }, + { + name: "SeverityError3", + severity: log.SeverityError3, + value: 19, + str: "ERROR3", + }, + { + name: "SeverityError4", + severity: log.SeverityError4, + value: 20, + str: "ERROR4", + }, + { + name: "SeverityFatal", + severity: log.SeverityFatal, + value: 21, + str: "FATAL", + }, + { + name: "SeverityFatal1", + severity: log.SeverityFatal1, + value: 21, + str: "FATAL", + }, + { + name: "SeverityFatal2", + severity: log.SeverityFatal2, + value: 22, + str: "FATAL2", + }, + { + name: "SeverityFatal3", + severity: log.SeverityFatal3, + value: 23, + str: "FATAL3", + }, + { + name: "SeverityFatal4", + severity: log.SeverityFatal4, + value: 24, + str: "FATAL4", + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.value, int(tc.severity), "value does not match OTel") + assert.Equal(t, tc.str, tc.severity.String(), "string does not match OTel") + }) + } +} From 92a13d5a5e8f89f66fb063022ffe16ef58a5ba9f Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 19 Feb 2024 04:57:30 -0800 Subject: [PATCH 874/886] Fix test name in `trace/noop` pkg (#4944) --- trace/noop/noop_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trace/noop/noop_test.go b/trace/noop/noop_test.go index 2b0f7818e20..d35c9a4a5ff 100644 --- a/trace/noop/noop_test.go +++ b/trace/noop/noop_test.go @@ -31,7 +31,7 @@ func TestImplementationNoPanics(t *testing.T) { reflect.ValueOf(TracerProvider{}), reflect.TypeOf((*trace.TracerProvider)(nil)).Elem(), )) - t.Run("Meter", assertAllExportedMethodNoPanic( + t.Run("Tracer", assertAllExportedMethodNoPanic( reflect.ValueOf(Tracer{}), reflect.TypeOf((*trace.Tracer)(nil)).Elem(), )) From b62df520ff9faf116cef2ac44d0eafbe62ef3738 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Mon, 19 Feb 2024 05:08:41 -0800 Subject: [PATCH 875/886] Implement the log Record type (#4939) --- log/record.go | 117 +++++++++++++++++++++++++++++++++++++++------ log/record_test.go | 105 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 208 insertions(+), 14 deletions(-) create mode 100644 log/record_test.go diff --git a/log/record.go b/log/record.go index 334d36d40ab..4647a7ee57f 100644 --- a/log/record.go +++ b/log/record.go @@ -16,47 +16,136 @@ package log // import "go.opentelemetry.io/otel/log" import "time" +// attributesInlineCount is the number of attributes that are efficiently +// stored in an array within a Record. This value is borrowed from slog which +// performed a quantitative survey of log library use and found this value to +// cover 95% of all use-cases (https://go.dev/blog/slog#performance). +const attributesInlineCount = 5 + // Record represents a log record. -type Record struct{} // TODO (#4913): implement. +type Record struct { + timestamp time.Time + observedTimestamp time.Time + severity Severity + severityText string + body Value + + // The fields below are for optimizing the implementation of Attributes and + // AddAttributes. This design is borrowed from the slog Record type: + // https://cs.opensource.google/go/go/+/refs/tags/go1.22.0:src/log/slog/record.go;l=20 + + // Allocation optimization: an inline array sized to hold + // the majority of log calls (based on examination of open-source + // code). It holds the start of the list of attributes. + front [attributesInlineCount]KeyValue + + // The number of attributes in front. + nFront int + + // The list of attributes except for those in front. + // Invariants: + // - len(back) > 0 if nFront == len(front) + // - Unused array elements are zero-ed. Used to detect mistakes. + back []KeyValue +} // Timestamp returns the time when the log record occurred. -func (r *Record) Timestamp() time.Time { return time.Time{} } // TODO (#4913): implement. +func (r *Record) Timestamp() time.Time { + return r.timestamp +} // SetTimestamp sets the time when the log record occurred. -func (r *Record) SetTimestamp(t time.Time) {} // TODO (#4913): implement. +func (r *Record) SetTimestamp(t time.Time) { + r.timestamp = t +} // ObservedTimestamp returns the time when the log record was observed. -func (r *Record) ObservedTimestamp() time.Time { return time.Time{} } // TODO (#4913): implement. +func (r *Record) ObservedTimestamp() time.Time { + return r.observedTimestamp +} // SetObservedTimestamp sets the time when the log record was observed. -func (r *Record) SetObservedTimestamp(t time.Time) {} // TODO (#4913): implement. +func (r *Record) SetObservedTimestamp(t time.Time) { + r.observedTimestamp = t +} // Severity returns the [Severity] of the log record. -func (r *Record) Severity() Severity { return 0 } // TODO (#4913): implement. +func (r *Record) Severity() Severity { + return r.severity +} // SetSeverity sets the [Severity] level of the log record. -func (r *Record) SetSeverity(level Severity) {} // TODO (#4913): implement. +func (r *Record) SetSeverity(level Severity) { + r.severity = level +} // SeverityText returns severity (also known as log level) text. This is the // original string representation of the severity as it is known at the source. -func (r *Record) SeverityText() string { return "" } // TODO (#4913): implement. +func (r *Record) SeverityText() string { + return r.severityText +} // SetSeverityText sets severity (also known as log level) text. This is the // original string representation of the severity as it is known at the source. -func (r *Record) SetSeverityText(text string) {} // TODO (#4913): implement. +func (r *Record) SetSeverityText(text string) { + r.severityText = text +} // Body returns the body of the log record. -func (r *Record) Body() Value { return Value{} } // TODO (#4913): implement. +func (r *Record) Body() Value { + return r.body +} // SetBody sets the body of the log record. -func (r *Record) SetBody(v Value) {} // TODO (#4913): implement. +func (r *Record) SetBody(v Value) { + r.body = v +} // WalkAttributes walks all attributes the log record holds by calling f for // each on each [KeyValue] in the [Record]. Iteration stops if f returns false. -func (r *Record) WalkAttributes(f func(KeyValue) bool) {} // TODO (#4913): implement. +func (r *Record) WalkAttributes(f func(KeyValue) bool) { + for i := 0; i < r.nFront; i++ { + if !f(r.front[i]) { + return + } + } + for _, a := range r.back { + if !f(a) { + return + } + } +} // AddAttributes adds attributes to the log record. -func (r *Record) AddAttributes(attributes ...KeyValue) {} // TODO (#4913): implement. +func (r *Record) AddAttributes(attrs ...KeyValue) { + var i int + for i = 0; i < len(attrs) && r.nFront < len(r.front); i++ { + a := attrs[i] + r.front[r.nFront] = a + r.nFront++ + } + + // TODO: when Go 1.20 is no longer supported, use slices.Grow instead. + r.back = grow(r.back, len(attrs[i:])) + r.back = append(r.back, attrs[i:]...) +} + +// grow increases the slice's capacity, if necessary, to guarantee space for +// another n elements. After grow(n), at least n elements can be appended to +// the slice without another allocation. +// +// This is based on [Grow]. It is not available in Go 1.20 so it is reproduced +// here. +// +// [Grow]: https://pkg.go.dev/slices#Grow +func grow(slice []KeyValue, n int) []KeyValue { + if n -= cap(slice) - len(slice); n > 0 { + slice = append(slice[:cap(slice)], make([]KeyValue, n)...)[:len(slice)] + } + return slice +} // AttributesLen returns the number of attributes in the log record. -func (r *Record) AttributesLen() int { return 0 } // TODO (#4913): implement. +func (r *Record) AttributesLen() int { + return r.nFront + len(r.back) +} diff --git a/log/record_test.go b/log/record_test.go new file mode 100644 index 00000000000..c3eb9539c0a --- /dev/null +++ b/log/record_test.go @@ -0,0 +1,105 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/log" +) + +var y2k = time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC) + +func TestRecordTimestamp(t *testing.T) { + var r log.Record + r.SetTimestamp(y2k) + assert.Equal(t, y2k, r.Timestamp()) +} + +func TestRecordObservedTimestamp(t *testing.T) { + var r log.Record + r.SetObservedTimestamp(y2k) + assert.Equal(t, y2k, r.ObservedTimestamp()) +} + +func TestRecordSeverity(t *testing.T) { + var r log.Record + r.SetSeverity(log.SeverityInfo) + assert.Equal(t, log.SeverityInfo, r.Severity()) +} + +func TestRecordSeverityText(t *testing.T) { + const text = "testing text" + + var r log.Record + r.SetSeverityText(text) + assert.Equal(t, text, r.SeverityText()) +} + +func TestRecordBody(t *testing.T) { + body := log.StringValue("testing body value") + + var r log.Record + r.SetBody(body) + assert.Equal(t, body, r.Body()) +} + +func TestRecordAttributes(t *testing.T) { + attrs := []log.KeyValue{ + log.String("k1", "str"), + log.Float64("k2", 1.0), + log.Int("k3", 2), + log.Bool("k4", true), + log.Bytes("k5", []byte{1}), + log.Slice("k6", log.IntValue(3)), + log.Map("k7", log.Bool("sub1", true)), + log.String("k8", "str"), + log.Float64("k9", 1.0), + log.Int("k10", 2), + log.Bool("k11", true), + log.Bytes("k12", []byte{1}), + log.Slice("k13", log.IntValue(3)), + log.Map("k14", log.Bool("sub1", true)), + {}, // Empty. + } + + var r log.Record + r.AddAttributes(attrs...) + require.Equal(t, len(attrs), r.AttributesLen()) + + t.Run("Correctness", func(t *testing.T) { + var i int + r.WalkAttributes(func(kv log.KeyValue) bool { + assert.Equal(t, attrs[i], kv) + i++ + return true + }) + }) + + t.Run("WalkAttributes/Filtering", func(t *testing.T) { + for i := 1; i <= len(attrs); i++ { + var j int + r.WalkAttributes(func(log.KeyValue) bool { + j++ + return j < i + }) + assert.Equal(t, i, j, "number of attributes walked incorrect") + } + }) +} From 3fe7401645c739304fc3395e136cf115ef7a9e04 Mon Sep 17 00:00:00 2001 From: Yi Zeng Date: Tue, 20 Feb 2024 08:01:33 +0100 Subject: [PATCH 876/886] doc: fix godoc for WithEndpointURL and WithEndpoint (#4947) --- exporters/otlp/otlptrace/otlptracegrpc/options.go | 4 ++-- exporters/otlp/otlptrace/otlptracehttp/options.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exporters/otlp/otlptrace/otlptracegrpc/options.go b/exporters/otlp/otlptrace/otlptracegrpc/options.go index 0fddac75895..461610c6b95 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -64,7 +64,7 @@ func WithInsecure() Option { return wrappedOption{otlpconfig.WithInsecure()} } -// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// WithEndpoint sets the target endpoint the Exporter will connect to. // // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT // environment variable is set, and this option is not passed, that variable @@ -82,7 +82,7 @@ func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } -// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. // // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT // environment variable is set, and this option is not passed, that variable diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index ea6b767a27f..7b4465c4ac9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -60,7 +60,7 @@ func (w wrappedOption) applyHTTPOption(cfg otlpconfig.Config) otlpconfig.Config return w.ApplyHTTPOption(cfg) } -// WithEndpointURL sets the target endpoint URL the Exporter will connect to. +// WithEndpoint sets the target endpoint the Exporter will connect to. // // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT // environment variable is set, and this option is not passed, that variable @@ -78,7 +78,7 @@ func WithEndpoint(endpoint string) Option { return wrappedOption{otlpconfig.WithEndpoint(endpoint)} } -// WithEndpoint sets the target endpoint URL the Exporter will connect to. +// WithEndpointURL sets the target endpoint URL the Exporter will connect to. // // If the OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_EXPORTER_OTLP_METRICS_ENDPOINT // environment variable is set, and this option is not passed, that variable From dd3b00f682a78ddef54578a7dc019c4145193165 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Tue, 20 Feb 2024 08:16:07 -0800 Subject: [PATCH 877/886] Add the `log/noop` package (#4943) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add the `log/noop` package * Add implementation tests --------- Co-authored-by: Robert Pająk --- log/noop/noop.go | 56 ++++++++++++++++++++++++++++++ log/noop/noop_test.go | 81 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 log/noop/noop.go create mode 100644 log/noop/noop_test.go diff --git a/log/noop/noop.go b/log/noop/noop.go new file mode 100644 index 00000000000..936a9f5ff78 --- /dev/null +++ b/log/noop/noop.go @@ -0,0 +1,56 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package noop provides an implementation of the OpenTelemetry Logs Bridge API +// that produces no telemetry and minimizes used computation resources. +// +// Using this package to implement the OpenTelemetry Logs Bridge API will +// effectively disable OpenTelemetry. +// +// This implementation can be embedded in other implementations of the +// OpenTelemetry Logs Bridge API. Doing so will mean the implementation +// defaults to no operation for methods it does not implement. +package noop // import "go.opentelemetry.io/otel/log/noop" + +import ( + "context" + + "go.opentelemetry.io/otel/log" + "go.opentelemetry.io/otel/log/embedded" +) + +var ( + // Compile-time check this implements the OpenTelemetry API. + _ log.LoggerProvider = LoggerProvider{} + _ log.Logger = Logger{} +) + +// LoggerProvider is an OpenTelemetry No-Op LoggerProvider. +type LoggerProvider struct{ embedded.LoggerProvider } + +// NewLoggerProvider returns a LoggerProvider that does not record any telemetry. +func NewLoggerProvider() LoggerProvider { + return LoggerProvider{} +} + +// Logger returns an OpenTelemetry Logger that does not record any telemetry. +func (LoggerProvider) Logger(string, ...log.LoggerOption) log.Logger { + return Logger{} +} + +// Logger is an OpenTelemetry No-Op Logger. +type Logger struct{ embedded.Logger } + +// Emit does nothing. +func (Logger) Emit(context.Context, log.Record) {} diff --git a/log/noop/noop_test.go b/log/noop/noop_test.go new file mode 100644 index 00000000000..079f8f2888f --- /dev/null +++ b/log/noop/noop_test.go @@ -0,0 +1,81 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package noop // import "go.opentelemetry.io/otel/log/noop" + +import ( + "context" + "reflect" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/log" +) + +func TestImplementationNoPanics(t *testing.T) { + // Check that if type has an embedded interface and that interface has + // methods added to it than the No-Op implementation implements them. + t.Run("LoggerProvider", assertAllExportedMethodNoPanic( + reflect.ValueOf(LoggerProvider{}), + reflect.TypeOf((*log.LoggerProvider)(nil)).Elem(), + )) + t.Run("Logger", assertAllExportedMethodNoPanic( + reflect.ValueOf(Logger{}), + reflect.TypeOf((*log.Logger)(nil)).Elem(), + )) +} + +func assertAllExportedMethodNoPanic(rVal reflect.Value, rType reflect.Type) func(*testing.T) { + return func(t *testing.T) { + for n := 0; n < rType.NumMethod(); n++ { + mType := rType.Method(n) + if !mType.IsExported() { + t.Logf("ignoring unexported %s", mType.Name) + continue + } + m := rVal.MethodByName(mType.Name) + if !m.IsValid() { + t.Errorf("unknown method for %s: %s", rVal.Type().Name(), mType.Name) + } + + numIn := mType.Type.NumIn() + if mType.Type.IsVariadic() { + numIn-- + } + args := make([]reflect.Value, numIn) + ctx := context.Background() + for i := range args { + aType := mType.Type.In(i) + if aType.Name() == "Context" { + // Do not panic on a nil context. + args[i] = reflect.ValueOf(ctx) + } else { + args[i] = reflect.New(aType).Elem() + } + } + + assert.NotPanicsf(t, func() { + _ = m.Call(args) + }, "%s.%s", rVal.Type().Name(), mType.Name) + } + } +} + +func TestNewTracerProvider(t *testing.T) { + provider := NewLoggerProvider() + assert.Equal(t, provider, LoggerProvider{}) + logger := provider.Logger("") + assert.Equal(t, logger, Logger{}) +} From c2fdbcaea88641e4c98d44a1c443495826b937f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 21 Feb 2024 07:02:08 +0100 Subject: [PATCH 878/886] design: log value accessors must not panic (#4948) --- log/DESIGN.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/log/DESIGN.md b/log/DESIGN.md index f08de5d8431..2a342bd53f7 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -362,6 +362,18 @@ and the API is mostly inspired by The benchmarks[^1] show that the implementation is more performant than [`attribute.Value`](https://pkg.go.dev/go.opentelemetry.io/otel/attribute#Value). +The value accessors (`func (v Value) As[Kind]` methods) must not panic, +as it would violate the [specification](https://opentelemetry.io/docs/specs/otel/error-handling/): + +> API methods MUST NOT throw unhandled exceptions when used incorrectly by end +> users. The API and SDK SHOULD provide safe defaults for missing or invalid +> arguments. [...] Whenever the library suppresses an error that would otherwise +> have been exposed to the user, the library SHOULD log the error using +> language-specific conventions. + +Therefore, the value accessors should return a zero value +and log an error when a bad accessor is called. + The `Severity`, `Kind`, `Value`, `KeyValue` may implement the [`fmt.Stringer`](https://pkg.go.dev/fmt#Stringer) interface. However, it is not needed for the first stable release From f793a0575d8d5c42dcc4d5a4cdf01675c7207b8f Mon Sep 17 00:00:00 2001 From: ntriamme Date: Wed, 21 Feb 2024 14:36:33 +0700 Subject: [PATCH 879/886] Fix registration of multiple callbacks when using the global meter provider (#4945) --- CHANGELOG.md | 4 ++++ internal/global/meter.go | 4 +++- internal/global/meter_test.go | 21 ++++++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7249c1e33..3d64910dac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ The next release will require at least [Go 1.21]. - Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) - Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) +### Fixed + +- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) + ## [1.23.1] 2024-02-07 ### Fixed diff --git a/internal/global/meter.go b/internal/global/meter.go index 0097db478c6..7ed61c0e256 100644 --- a/internal/global/meter.go +++ b/internal/global/meter.go @@ -130,9 +130,11 @@ func (m *meter) setDelegate(provider metric.MeterProvider) { inst.setDelegate(meter) } - for e := m.registry.Front(); e != nil; e = e.Next() { + var n *list.Element + for e := m.registry.Front(); e != nil; e = n { r := e.Value.(*registration) r.setDelegate(meter) + n = e.Next() m.registry.Remove(e) } diff --git a/internal/global/meter_test.go b/internal/global/meter_test.go index 9ad8d4f5ee7..4d05c82961a 100644 --- a/internal/global/meter_test.go +++ b/internal/global/meter_test.go @@ -354,20 +354,27 @@ func TestRegistrationDelegation(t *testing.T) { require.NoError(t, err) require.Equal(t, 1, mImpl.registry.Len(), "second callback not registered") - mp := &testMeterProvider{} + var called2 bool + _, err = m.RegisterCallback(func(context.Context, metric.Observer) error { + called2 = true + return nil + }, actr) + require.NoError(t, err) + require.Equal(t, 2, mImpl.registry.Len(), "third callback not registered") - // otel.SetMeterProvider(mp) + mp := &testMeterProvider{} globalMeterProvider.setDelegate(mp) testCollect(t, m) // This is a hacky way to emulate a read from an exporter require.False(t, called0, "pre-delegation unregistered callback called") - require.True(t, called1, "callback not called") + require.True(t, called1, "second callback not called") + require.True(t, called2, "third callback not called") - called1 = false assert.NoError(t, reg1.Unregister(), "unregister second callback") - - testCollect(t, m) // This is a hacky way to emulate a read from an exporter - assert.False(t, called1, "unregistered callback called") + called1, called2 = false, false // reset called capture + testCollect(t, m) // This is a hacky way to emulate a read from an exporter + assert.False(t, called1, "unregistered second callback called") + require.True(t, called2, "third callback not called") assert.NotPanics(t, func() { assert.NoError(t, reg1.Unregister(), "duplicate unregister calls") From 7b3382e4dcee645eb9825f12f195e4e275b38760 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 21 Feb 2024 13:19:41 -0800 Subject: [PATCH 880/886] log: Implement Value and KeyValue types (#4949) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement `Value` and `KeyValue` * Add tests for `Value` and `KeyValue` --------- Co-authored-by: Robert Pająk --- log/go.mod | 4 + log/go.sum | 5 + log/keyvalue.go | 306 ++++++++++++++++++++++++++++++++++++++----- log/keyvalue_test.go | 302 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 587 insertions(+), 30 deletions(-) create mode 100644 log/keyvalue_test.go diff --git a/log/go.mod b/log/go.mod index 2dfceaf6ed3..6a974a2ae01 100644 --- a/log/go.mod +++ b/log/go.mod @@ -3,6 +3,8 @@ module go.opentelemetry.io/otel/log go 1.20 require ( + github.com/go-logr/logr v1.4.1 + github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel v1.23.1 ) @@ -10,6 +12,8 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.23.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/log/go.sum b/log/go.sum index a6bcd03a15e..75d8b1f55b4 100644 --- a/log/go.sum +++ b/log/go.sum @@ -1,5 +1,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/log/keyvalue.go b/log/keyvalue.go index b39c00a4b45..12a79b8b7c3 100644 --- a/log/keyvalue.go +++ b/log/keyvalue.go @@ -16,6 +16,18 @@ package log // import "go.opentelemetry.io/otel/log" +import ( + "bytes" + "errors" + "math" + "unsafe" + + "go.opentelemetry.io/otel/internal/global" +) + +// errKind is logged when a Value is decoded to an incompatible type. +var errKind = errors.New("invalid Kind") + // Kind is the kind of a [Value]. type Kind int @@ -32,70 +44,286 @@ const ( ) // A Value represents a structured log value. -type Value struct{} // TODO (#4914): implement. +type Value struct { + // Ensure forward compatibility by explicitly making this not comparable. + noCmp [0]func() //nolint: unused // This is indeed used. + + // num holds the value for Int64, Float64, and Bool. It holds the length + // for String, Bytes, Slice, Map. + num uint64 + // any holds either the KindBool, KindInt64, KindFloat64, stringptr, + // bytesptr, sliceptr, or mapptr. If KindBool, KindInt64, or KindFloat64 + // then the value of Value is in num as described above. Otherwise, it + // contains the value wrapped in the appropriate type. + any any +} + +type ( + // sliceptr represents a value in Value.any for KindString Values. + stringptr *byte + // bytesptr represents a value in Value.any for KindBytes Values. + bytesptr *byte + // sliceptr represents a value in Value.any for KindSlice Values. + sliceptr *Value + // mapptr represents a value in Value.any for KindMap Values. + mapptr *KeyValue +) // StringValue returns a new [Value] for a string. -func StringValue(v string) Value { return Value{} } // TODO (#4914): implement. +func StringValue(v string) Value { + return Value{ + num: uint64(len(v)), + any: stringptr(unsafe.StringData(v)), + } +} // IntValue returns a [Value] for an int. -func IntValue(v int) Value { return Value{} } // TODO (#4914): implement. +func IntValue(v int) Value { return Int64Value(int64(v)) } // Int64Value returns a [Value] for an int64. -func Int64Value(v int64) Value { return Value{} } // TODO (#4914): implement. +func Int64Value(v int64) Value { + return Value{num: uint64(v), any: KindInt64} +} // Float64Value returns a [Value] for a float64. -func Float64Value(v float64) Value { return Value{} } // TODO (#4914): implement. +func Float64Value(v float64) Value { + return Value{num: math.Float64bits(v), any: KindFloat64} +} // BoolValue returns a [Value] for a bool. func BoolValue(v bool) Value { //nolint:revive // Not a control flag. - // TODO (#4914): implement. - return Value{} + var n uint64 + if v { + n = 1 + } + return Value{num: n, any: KindBool} } // BytesValue returns a [Value] for a byte slice. The passed slice must not be // changed after it is passed. -func BytesValue(v []byte) Value { return Value{} } // TODO (#4914): implement. +func BytesValue(v []byte) Value { + return Value{ + num: uint64(len(v)), + any: bytesptr(unsafe.SliceData(v)), + } +} // SliceValue returns a [Value] for a slice of [Value]. The passed slice must // not be changed after it is passed. -func SliceValue(vs ...Value) Value { return Value{} } // TODO (#4914): implement. +func SliceValue(vs ...Value) Value { + return Value{ + num: uint64(len(vs)), + any: sliceptr(unsafe.SliceData(vs)), + } +} // MapValue returns a new [Value] for a slice of key-value pairs. The passed // slice must not be changed after it is passed. -func MapValue(kvs ...KeyValue) Value { return Value{} } // TODO (#4914): implement. +func MapValue(kvs ...KeyValue) Value { + return Value{ + num: uint64(len(kvs)), + any: mapptr(unsafe.SliceData(kvs)), + } +} // AsAny returns the value held by v as an any. -func (v Value) AsAny() any { return nil } // TODO (#4914): implement +func (v Value) AsAny() any { + switch v.Kind() { + case KindMap: + return v.asMap() + case KindSlice: + return v.asSlice() + case KindInt64: + return v.asInt64() + case KindFloat64: + return v.asFloat64() + case KindString: + return v.asString() + case KindBool: + return v.asBool() + case KindBytes: + return v.asBytes() + case KindEmpty: + return nil + default: + global.Error(errKind, "AsAny", "Kind", v.Kind()) + return nil + } +} // AsString returns the value held by v as a string. -func (v Value) AsString() string { return "" } // TODO (#4914): implement +func (v Value) AsString() string { + if sp, ok := v.any.(stringptr); ok { + return unsafe.String(sp, v.num) + } + global.Error(errKind, "AsString", "Kind", v.Kind()) + return "" +} + +// asString returns the value held by v as a string. It will panic if the Value +// is not KindString. +func (v Value) asString() string { + return unsafe.String(v.any.(stringptr), v.num) +} // AsInt64 returns the value held by v as an int64. -func (v Value) AsInt64() int64 { return 0 } // TODO (#4914): implement +func (v Value) AsInt64() int64 { + if v.Kind() != KindInt64 { + global.Error(errKind, "AsInt64", "Kind", v.Kind()) + return 0 + } + return v.asInt64() +} + +// asInt64 returns the value held by v as an int64. If v is not of KindInt64, +// this will return garbage. +func (v Value) asInt64() int64 { return int64(v.num) } // AsBool returns the value held by v as a bool. -func (v Value) AsBool() bool { return false } // TODO (#4914): implement +func (v Value) AsBool() bool { + if v.Kind() != KindBool { + global.Error(errKind, "AsBool", "Kind", v.Kind()) + return false + } + return v.asBool() +} + +// asBool returns the value held by v as a bool. If v is not of KindBool, this +// will return garbage. +func (v Value) asBool() bool { return v.num == 1 } // AsFloat64 returns the value held by v as a float64. -func (v Value) AsFloat64() float64 { return 0 } // TODO (#4914): implement +func (v Value) AsFloat64() float64 { + if v.Kind() != KindFloat64 { + global.Error(errKind, "AsFloat64", "Kind", v.Kind()) + return 0 + } + return v.asFloat64() +} + +// asFloat64 returns the value held by v as a float64. If v is not of +// KindFloat64, this will return garbage. +func (v Value) asFloat64() float64 { return math.Float64frombits(v.num) } // AsBytes returns the value held by v as a []byte. -func (v Value) AsBytes() []byte { return nil } // TODO (#4914): implement +func (v Value) AsBytes() []byte { + if sp, ok := v.any.(bytesptr); ok { + return unsafe.Slice((*byte)(sp), v.num) + } + global.Error(errKind, "AsBytes", "Kind", v.Kind()) + return nil +} + +// asBytes returns the value held by v as a []byte. It will panic if the Value +// is not KindBytes. +func (v Value) asBytes() []byte { + return unsafe.Slice((*byte)(v.any.(bytesptr)), v.num) +} // AsSlice returns the value held by v as a []Value. -func (v Value) AsSlice() []Value { return nil } // TODO (#4914): implement +func (v Value) AsSlice() []Value { + if sp, ok := v.any.(sliceptr); ok { + return unsafe.Slice((*Value)(sp), v.num) + } + global.Error(errKind, "AsSlice", "Kind", v.Kind()) + return nil +} + +// asSlice returns the value held by v as a []Value. It will panic if the Value +// is not KindSlice. +func (v Value) asSlice() []Value { + return unsafe.Slice((*Value)(v.any.(sliceptr)), v.num) +} // AsMap returns the value held by v as a []KeyValue. -func (v Value) AsMap() []KeyValue { return nil } // TODO (#4914): implement +func (v Value) AsMap() []KeyValue { + if sp, ok := v.any.(mapptr); ok { + return unsafe.Slice((*KeyValue)(sp), v.num) + } + global.Error(errKind, "AsMap", "Kind", v.Kind()) + return nil +} + +// asMap returns the value held by v as a []KeyValue. It will panic if the +// Value is not KindMap. +func (v Value) asMap() []KeyValue { + return unsafe.Slice((*KeyValue)(v.any.(mapptr)), v.num) +} // Kind returns the Kind of v. -func (v Value) Kind() Kind { return KindEmpty } // TODO (#4914): implement. +func (v Value) Kind() Kind { + switch x := v.any.(type) { + case Kind: + return x + case stringptr: + return KindString + case bytesptr: + return KindBytes + case sliceptr: + return KindSlice + case mapptr: + return KindMap + default: + return KindEmpty + } +} // Empty returns if v does not hold any value. -func (v Value) Empty() bool { return false } // TODO (#4914): implement +func (v Value) Empty() bool { return v.Kind() == KindEmpty } // Equal returns if v is equal to w. -func (v Value) Equal(w Value) bool { return false } // TODO (#4914): implement +func (v Value) Equal(w Value) bool { + k1 := v.Kind() + k2 := w.Kind() + if k1 != k2 { + return false + } + switch k1 { + case KindInt64, KindBool: + return v.num == w.num + case KindString: + return v.asString() == w.asString() + case KindFloat64: + return v.asFloat64() == w.asFloat64() + case KindSlice: + // TODO: replace with slices.EqualFunc when Go 1.20 support dropped. + return sliceEqualFunc(v.asSlice(), w.asSlice(), Value.Equal) + case KindMap: + // TODO: replace with slices.EqualFunc when Go 1.20 support dropped. + return sliceEqualFunc(v.asMap(), w.asMap(), KeyValue.Equal) + case KindBytes: + return bytes.Equal(v.asBytes(), w.asBytes()) + case KindEmpty: + return true + default: + global.Error(errKind, "Equal", "Kind", k1) + return false + } +} + +// sliceEqualFunc reports whether two slices are equal using an equality +// function on each pair of elements. If the lengths are different, +// sliceEqualFunc returns false. Otherwise, the elements are compared in +// increasing index order, and the comparison stops at the first index for +// which eq returns false. +// +// This is based on [EqualFunc]. It was added to provide backwards +// compatibility for Go 1.20. When Go 1.20 is no longer supported it can be +// removed. +// +// EqualFunc: https://pkg.go.dev/slices#EqualFunc +func sliceEqualFunc[T any](s1 []T, s2 []T, eq func(T, T) bool) bool { + if len(s1) != len(s2) { + return false + } + for i, v1 := range s1 { + v2 := s2[i] + if !eq(v1, v2) { + return false + } + } + return true +} // An KeyValue is a key-value pair used to represent a log attribute (a // superset of [go.opentelemetry.io/otel/attribute.KeyValue]) and map item. @@ -105,28 +333,46 @@ type KeyValue struct { } // Equal returns if a is equal to b. -func (a KeyValue) Equal(b KeyValue) bool { return false } // TODO (#4914): implement +func (a KeyValue) Equal(b KeyValue) bool { + return a.Key == b.Key && a.Value.Equal(b.Value) +} // String returns an KeyValue for a string value. -func String(key, value string) KeyValue { return KeyValue{} } // TODO (#4914): implement +func String(key, value string) KeyValue { + return KeyValue{key, StringValue(value)} +} // Int64 returns an KeyValue for an int64 value. -func Int64(key string, value int64) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Int64(key string, value int64) KeyValue { + return KeyValue{key, Int64Value(value)} +} // Int returns an KeyValue for an int value. -func Int(key string, value int) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Int(key string, value int) KeyValue { + return KeyValue{key, IntValue(value)} +} // Float64 returns an KeyValue for a float64 value. -func Float64(key string, v float64) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Float64(key string, value float64) KeyValue { + return KeyValue{key, Float64Value(value)} +} // Bool returns an KeyValue for a bool value. -func Bool(key string, v bool) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Bool(key string, value bool) KeyValue { + return KeyValue{key, BoolValue(value)} +} // Bytes returns an KeyValue for a []byte value. -func Bytes(key string, v []byte) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Bytes(key string, value []byte) KeyValue { + return KeyValue{key, BytesValue(value)} +} // Slice returns an KeyValue for a []Value value. -func Slice(key string, args ...Value) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Slice(key string, value ...Value) KeyValue { + return KeyValue{key, SliceValue(value...)} +} // Map returns an KeyValue for a map value. -func Map(key string, args ...KeyValue) KeyValue { return KeyValue{} } // TODO (#4914): implement +func Map(key string, value ...KeyValue) KeyValue { + return KeyValue{key, MapValue(value...)} +} diff --git a/log/keyvalue_test.go b/log/keyvalue_test.go new file mode 100644 index 00000000000..4390bfae538 --- /dev/null +++ b/log/keyvalue_test.go @@ -0,0 +1,302 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package log_test + +import ( + golog "log" + "os" + "testing" + + "github.com/go-logr/logr" + "github.com/go-logr/logr/testr" + "github.com/go-logr/stdr" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/log" +) + +func TestKind(t *testing.T) { + testCases := []struct { + kind log.Kind + str string + value int + }{ + {log.KindBool, "Bool", 1}, + {log.KindBytes, "Bytes", 5}, + {log.KindEmpty, "Empty", 0}, + {log.KindFloat64, "Float64", 2}, + {log.KindInt64, "Int64", 3}, + {log.KindSlice, "Slice", 6}, + {log.KindMap, "Map", 7}, + {log.KindString, "String", 4}, + } + for _, tc := range testCases { + t.Run(tc.str, func(t *testing.T) { + assert.Equal(t, tc.value, int(tc.kind), "Kind value") + assert.Equal(t, tc.str, tc.kind.String(), "Kind string") + }) + } +} + +func TestValueEqual(t *testing.T) { + vals := []log.Value{ + {}, + log.Int64Value(1), + log.Int64Value(2), + log.Float64Value(3.5), + log.Float64Value(3.7), + log.BoolValue(true), + log.BoolValue(false), + log.StringValue("hi"), + log.StringValue("bye"), + log.BytesValue([]byte{1, 3, 5}), + log.SliceValue(log.StringValue("foo")), + log.SliceValue(log.IntValue(3), log.StringValue("foo")), + log.MapValue(log.Bool("b", true), log.Int("i", 3)), + log.MapValue( + log.Slice("l", log.IntValue(3), log.StringValue("foo")), + log.Bytes("b", []byte{3, 5, 7}), + ), + } + for i, v1 := range vals { + for j, v2 := range vals { + assert.Equal(t, i == j, v1.Equal(v2), "%v.Equal(%v)", v1, v2) + } + } +} + +func TestEmpty(t *testing.T) { + v := log.Value{} + t.Run("Value.Empty", func(t *testing.T) { + assert.True(t, v.Empty()) + }) + t.Run("Value.AsAny", func(t *testing.T) { + assert.Nil(t, v.AsAny()) + }) + + t.Run("Bytes", func(t *testing.T) { + assert.Nil(t, log.Bytes("b", nil).Value.AsBytes()) + }) + t.Run("Slice", func(t *testing.T) { + assert.Nil(t, log.Slice("s").Value.AsSlice()) + }) + t.Run("Map", func(t *testing.T) { + assert.Nil(t, log.Map("m").Value.AsMap()) + }) +} + +func TestEmptyGroupsPreserved(t *testing.T) { + t.Run("Map", func(t *testing.T) { + assert.Equal(t, []log.KeyValue{ + log.Int("a", 1), + log.Map("g1", log.Map("g2")), + log.Map("g3", log.Map("g4", log.Int("b", 2))), + }, log.MapValue( + log.Int("a", 1), + log.Map("g1", log.Map("g2")), + log.Map("g3", log.Map("g4", log.Int("b", 2))), + ).AsMap()) + }) + + t.Run("Slice", func(t *testing.T) { + assert.Equal(t, []log.Value{{}}, log.SliceValue(log.Value{}).AsSlice()) + }) +} + +func TestBool(t *testing.T) { + const key, val = "key", true + kv := log.Bool(key, val) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindBool + t.Run("AsBool", func(t *testing.T) { + assert.Equal(t, val, kv.Value.AsBool(), "AsBool") + }) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestFloat64(t *testing.T) { + const key, val = "key", 3.0 + kv := log.Float64(key, val) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindFloat64 + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", func(t *testing.T) { + assert.Equal(t, val, v.AsFloat64(), "AsFloat64") + }) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestInt(t *testing.T) { + const key, val = "key", 1 + kv := log.Int(key, val) + testKV[int64](t, key, val, kv) + + v, k := kv.Value, log.KindInt64 + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", func(t *testing.T) { + assert.Equal(t, int64(val), v.AsInt64(), "AsInt64") + }) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestInt64(t *testing.T) { + const key, val = "key", 1 + kv := log.Int64(key, val) + testKV[int64](t, key, val, kv) + + v, k := kv.Value, log.KindInt64 + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", func(t *testing.T) { + assert.Equal(t, int64(val), v.AsInt64(), "AsInt64") + }) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestString(t *testing.T) { + const key, val = "key", "test string value" + kv := log.String(key, val) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindString + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", func(t *testing.T) { + assert.Equal(t, val, v.AsString(), "AsString") + }) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestBytes(t *testing.T) { + const key = "key" + val := []byte{3, 2, 1} + kv := log.Bytes(key, val) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindBytes + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", func(t *testing.T) { + assert.Equal(t, val, v.AsBytes(), "AsBytes") + }) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestSlice(t *testing.T) { + const key = "key" + val := []log.Value{log.IntValue(3), log.StringValue("foo")} + kv := log.Slice(key, val...) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindSlice + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", func(t *testing.T) { + assert.Equal(t, val, v.AsSlice(), "AsSlice") + }) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + +func TestMap(t *testing.T) { + const key = "key" + val := []log.KeyValue{ + log.Slice("l", log.IntValue(3), log.StringValue("foo")), + log.Bytes("b", []byte{3, 5, 7}), + } + kv := log.Map(key, val...) + testKV(t, key, val, kv) + + v, k := kv.Value, log.KindMap + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", func(t *testing.T) { + assert.Equal(t, val, v.AsMap(), "AsMap") + }) +} + +type logSink struct { + logr.LogSink + + err error + msg string + keysAndValues []interface{} +} + +func (l *logSink) Error(err error, msg string, keysAndValues ...interface{}) { + l.err, l.msg, l.keysAndValues = err, msg, keysAndValues + l.LogSink.Error(err, msg, keysAndValues) +} + +var stdLogger = stdr.New(golog.New(os.Stderr, "", golog.LstdFlags|golog.Lshortfile)) + +func testErrKind[T any](f func() T, msg string, k log.Kind) func(*testing.T) { + return func(t *testing.T) { + l := &logSink{LogSink: testr.New(t).GetSink()} + global.SetLogger(logr.New(l)) + t.Cleanup(func() { global.SetLogger(stdLogger) }) + + assert.Zero(t, f()) + + assert.ErrorContains(t, l.err, "invalid Kind") + assert.Equal(t, msg, l.msg) + require.Len(t, l.keysAndValues, 2, "logged attributes") + assert.Equal(t, l.keysAndValues[1], k) + } +} + +func testKV[T any](t *testing.T, key string, val T, kv log.KeyValue) { + t.Helper() + + assert.Equal(t, key, kv.Key, "incorrect key") + assert.False(t, kv.Value.Empty(), "value empty") + assert.Equal(t, kv.Value.AsAny(), T(val), "AsAny wrong value") +} From 6ea99afaa0e266f31bd52da3a1c4d1298e87cce1 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 22 Feb 2024 09:15:43 -0800 Subject: [PATCH 881/886] log: Add benchmark tests (#4958) --- log/keyvalue_bench_test.go | 255 +++++++++++++++++++++++++++++++++++++ log/record_bench_test.go | 120 +++++++++++++++++ 2 files changed, 375 insertions(+) create mode 100644 log/keyvalue_bench_test.go create mode 100644 log/record_bench_test.go diff --git a/log/keyvalue_bench_test.go b/log/keyvalue_bench_test.go new file mode 100644 index 00000000000..ea43cded1d3 --- /dev/null +++ b/log/keyvalue_bench_test.go @@ -0,0 +1,255 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_test + +import ( + "testing" + + "go.opentelemetry.io/otel/log" +) + +// Store results in a file scope var to ensure compiler does not optimize the +// test away. +var ( + outV log.Value + outKV log.KeyValue + + outAny any + outBool bool + outFloat64 float64 + outInt64 int64 + outMap []log.KeyValue + outSlice []log.Value + outStr string +) + +func BenchmarkBool(b *testing.B) { + const k, v = "bool", true + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.BoolValue(v) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Bool(k, v) + } + }) + + kv := log.Bool(k, v) + b.Run("AsBool", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outBool = kv.Value.AsBool() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkFloat64(b *testing.B) { + const k, v = "float64", 3.0 + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.Float64Value(v) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Float64(k, v) + } + }) + + kv := log.Float64(k, v) + b.Run("AsFloat64", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outFloat64 = kv.Value.AsFloat64() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkInt(b *testing.B) { + const k, v = "int", 32 + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.IntValue(v) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Int(k, v) + } + }) + + kv := log.Int(k, v) + b.Run("AsInt64", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outInt64 = kv.Value.AsInt64() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkInt64(b *testing.B) { + const k, v = "int64", int64(32) + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.Int64Value(v) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Int64(k, v) + } + }) + + kv := log.Int64(k, v) + b.Run("AsInt64", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outInt64 = kv.Value.AsInt64() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkMap(b *testing.B) { + const k = "map" + v := []log.KeyValue{log.Bool("b", true), log.Int("i", 1)} + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.MapValue(v...) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Map(k, v...) + } + }) + + kv := log.Map(k, v...) + b.Run("AsMap", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outMap = kv.Value.AsMap() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkSlice(b *testing.B) { + const k = "slice" + v := []log.Value{log.BoolValue(true), log.IntValue(1)} + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.SliceValue(v...) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.Slice(k, v...) + } + }) + + kv := log.Slice(k, v...) + b.Run("AsSlice", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outSlice = kv.Value.AsSlice() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} + +func BenchmarkString(b *testing.B) { + const k, v = "str", "value" + + b.Run("Value", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outV = log.StringValue(v) + } + }) + b.Run("KeyValue", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outKV = log.String(k, v) + } + }) + + kv := log.String(k, v) + b.Run("AsString", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outStr = kv.Value.AsString() + } + }) + b.Run("AsAny", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + outAny = kv.Value.AsAny() + } + }) +} diff --git a/log/record_bench_test.go b/log/record_bench_test.go new file mode 100644 index 00000000000..b83845ad9c7 --- /dev/null +++ b/log/record_bench_test.go @@ -0,0 +1,120 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package log_test + +import ( + "testing" + "time" + + "go.opentelemetry.io/otel/log" +) + +func BenchmarkRecord(b *testing.B) { + var ( + tStamp time.Time + sev log.Severity + text string + body log.Value + attr log.KeyValue + n int + ) + + b.Run("Timestamp", func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + var r log.Record + r.SetTimestamp(y2k) + tStamp = r.Timestamp() + } + }) + + b.Run("ObservedTimestamp", func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + var r log.Record + r.SetObservedTimestamp(y2k) + tStamp = r.ObservedTimestamp() + } + }) + + b.Run("Severity", func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + var r log.Record + r.SetSeverity(log.SeverityDebug) + sev = r.Severity() + } + }) + + b.Run("SeverityText", func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + var r log.Record + r.SetSeverityText("text") + text = r.SeverityText() + } + }) + + bodyVal := log.BoolValue(true) + b.Run("Body", func(b *testing.B) { + b.ReportAllocs() + for n := 0; n < b.N; n++ { + var r log.Record + r.SetBody(bodyVal) + body = r.Body() + } + }) + + attrs10 := []log.KeyValue{ + log.Bool("b1", true), + log.Int("i1", 324), + log.Float64("f1", -230.213), + log.String("s1", "value1"), + log.Map("m1", log.Slice("slice1", log.BoolValue(true))), + log.Bool("b2", false), + log.Int("i2", 39847), + log.Float64("f2", 0.382964329), + log.String("s2", "value2"), + log.Map("m2", log.Slice("slice2", log.BoolValue(false))), + } + attrs5 := attrs10[:5] + walk := func(kv log.KeyValue) bool { + attr = kv + return true + } + b.Run("Attributes", func(b *testing.B) { + b.Run("5", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + var r log.Record + r.AddAttributes(attrs5...) + n = r.AttributesLen() + r.WalkAttributes(walk) + } + }) + b.Run("10", func(b *testing.B) { + b.ReportAllocs() + for i := 0; i < b.N; i++ { + var r log.Record + r.AddAttributes(attrs10...) + n = r.AttributesLen() + r.WalkAttributes(walk) + } + }) + }) + + // Convince the linter these values are used. + _, _, _, _, _, _ = tStamp, sev, text, body, attr, n +} From 7cc660fc0f81e54adc01d88bc5e4af8d6f362d50 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 22 Feb 2024 11:47:40 -0800 Subject: [PATCH 882/886] log: Add allocation tests (#4957) --- log/keyvalue_test.go | 57 +++++++++++++++++++++++++++++++++++++++++ log/record_test.go | 60 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/log/keyvalue_test.go b/log/keyvalue_test.go index 4390bfae538..7a72ae06431 100644 --- a/log/keyvalue_test.go +++ b/log/keyvalue_test.go @@ -300,3 +300,60 @@ func testKV[T any](t *testing.T, key string, val T, kv log.KeyValue) { assert.False(t, kv.Value.Empty(), "value empty") assert.Equal(t, kv.Value.AsAny(), T(val), "AsAny wrong value") } + +func TestAllocationLimits(t *testing.T) { + const ( + runs = 5 + key = "key" + ) + + // Assign testing results to external scope so the compiler doesn't + // optimize away the testing statements. + var ( + i int64 + f float64 + b bool + by []byte + s string + slice []log.Value + m []log.KeyValue + ) + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + b = log.Bool(key, true).Value.AsBool() + }), "Bool.AsBool") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + f = log.Float64(key, 3.0).Value.AsFloat64() + }), "Float.AsFloat64") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + i = log.Int(key, 9).Value.AsInt64() + }), "Int.AsInt64") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + i = log.Int64(key, 8).Value.AsInt64() + }), "Int64.AsInt64") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + s = log.String(key, "value").Value.AsString() + }), "String.AsString") + + byteVal := []byte{1, 3, 4} + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + by = log.Bytes(key, byteVal).Value.AsBytes() + }), "Byte.AsBytes") + + sliceVal := []log.Value{log.BoolValue(true), log.IntValue(32)} + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + slice = log.Slice(key, sliceVal...).Value.AsSlice() + }), "Slice.AsSlice") + + mapVal := []log.KeyValue{log.Bool("b", true), log.Int("i", 32)} + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + m = log.Map(key, mapVal...).Value.AsMap() + }), "Map.AsMap") + + // Convince the linter these values are used. + _, _, _, _, _, _, _ = i, f, b, by, s, slice, m +} diff --git a/log/record_test.go b/log/record_test.go index c3eb9539c0a..f17f4f8d213 100644 --- a/log/record_test.go +++ b/log/record_test.go @@ -103,3 +103,63 @@ func TestRecordAttributes(t *testing.T) { } }) } + +func TestRecordAllocationLimits(t *testing.T) { + const runs = 5 + + // Assign testing results to external scope so the compiler doesn't + // optimize away the testing statements. + var ( + tStamp time.Time + sev log.Severity + text string + body log.Value + n int + attr log.KeyValue + ) + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.SetTimestamp(y2k) + tStamp = r.Timestamp() + }), "Timestamp") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.SetObservedTimestamp(y2k) + tStamp = r.ObservedTimestamp() + }), "ObservedTimestamp") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.SetSeverity(log.SeverityDebug) + sev = r.Severity() + }), "Severity") + + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.SetSeverityText("severity text") + text = r.SeverityText() + }), "SeverityText") + + bodyVal := log.BoolValue(true) + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.SetBody(bodyVal) + body = r.Body() + }), "Body") + + attrVal := []log.KeyValue{log.Bool("k", true), log.Int("i", 1)} + assert.Equal(t, 0.0, testing.AllocsPerRun(runs, func() { + var r log.Record + r.AddAttributes(attrVal...) + n = r.AttributesLen() + r.WalkAttributes(func(kv log.KeyValue) bool { + attr = kv + return true + }) + }), "Attributes") + + // Convince the linter these values are used. + _, _, _, _, _, _ = tStamp, sev, text, body, n, attr +} From 8df89f6aff3fd364c0775fc683b5c11d335123f5 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 22 Feb 2024 11:56:07 -0800 Subject: [PATCH 883/886] log: Remove Value.AsAny (#4963) --- log/DESIGN.md | 2 -- log/keyvalue.go | 25 ---------------------- log/keyvalue_bench_test.go | 43 -------------------------------------- log/keyvalue_test.go | 4 ---- 4 files changed, 74 deletions(-) diff --git a/log/DESIGN.md b/log/DESIGN.md index 2a342bd53f7..e961a45a3b2 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -288,8 +288,6 @@ func MapValue(kvs ...KeyValue) Value // Value accessors: -func (v Value) AsAny() any - func (v Value) AsString() string func (v Value) AsInt64() int64 diff --git a/log/keyvalue.go b/log/keyvalue.go index 12a79b8b7c3..1416284366c 100644 --- a/log/keyvalue.go +++ b/log/keyvalue.go @@ -126,31 +126,6 @@ func MapValue(kvs ...KeyValue) Value { } } -// AsAny returns the value held by v as an any. -func (v Value) AsAny() any { - switch v.Kind() { - case KindMap: - return v.asMap() - case KindSlice: - return v.asSlice() - case KindInt64: - return v.asInt64() - case KindFloat64: - return v.asFloat64() - case KindString: - return v.asString() - case KindBool: - return v.asBool() - case KindBytes: - return v.asBytes() - case KindEmpty: - return nil - default: - global.Error(errKind, "AsAny", "Kind", v.Kind()) - return nil - } -} - // AsString returns the value held by v as a string. func (v Value) AsString() string { if sp, ok := v.any.(stringptr); ok { diff --git a/log/keyvalue_bench_test.go b/log/keyvalue_bench_test.go index ea43cded1d3..15d78838dae 100644 --- a/log/keyvalue_bench_test.go +++ b/log/keyvalue_bench_test.go @@ -26,7 +26,6 @@ var ( outV log.Value outKV log.KeyValue - outAny any outBool bool outFloat64 float64 outInt64 int64 @@ -58,12 +57,6 @@ func BenchmarkBool(b *testing.B) { outBool = kv.Value.AsBool() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkFloat64(b *testing.B) { @@ -89,12 +82,6 @@ func BenchmarkFloat64(b *testing.B) { outFloat64 = kv.Value.AsFloat64() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkInt(b *testing.B) { @@ -120,12 +107,6 @@ func BenchmarkInt(b *testing.B) { outInt64 = kv.Value.AsInt64() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkInt64(b *testing.B) { @@ -151,12 +132,6 @@ func BenchmarkInt64(b *testing.B) { outInt64 = kv.Value.AsInt64() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkMap(b *testing.B) { @@ -183,12 +158,6 @@ func BenchmarkMap(b *testing.B) { outMap = kv.Value.AsMap() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkSlice(b *testing.B) { @@ -215,12 +184,6 @@ func BenchmarkSlice(b *testing.B) { outSlice = kv.Value.AsSlice() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } func BenchmarkString(b *testing.B) { @@ -246,10 +209,4 @@ func BenchmarkString(b *testing.B) { outStr = kv.Value.AsString() } }) - b.Run("AsAny", func(b *testing.B) { - b.ReportAllocs() - for i := 0; i < b.N; i++ { - outAny = kv.Value.AsAny() - } - }) } diff --git a/log/keyvalue_test.go b/log/keyvalue_test.go index 7a72ae06431..c6e4e03a91e 100644 --- a/log/keyvalue_test.go +++ b/log/keyvalue_test.go @@ -88,9 +88,6 @@ func TestEmpty(t *testing.T) { t.Run("Value.Empty", func(t *testing.T) { assert.True(t, v.Empty()) }) - t.Run("Value.AsAny", func(t *testing.T) { - assert.Nil(t, v.AsAny()) - }) t.Run("Bytes", func(t *testing.T) { assert.Nil(t, log.Bytes("b", nil).Value.AsBytes()) @@ -298,7 +295,6 @@ func testKV[T any](t *testing.T, key string, val T, kv log.KeyValue) { assert.Equal(t, key, kv.Key, "incorrect key") assert.False(t, kv.Value.Empty(), "value empty") - assert.Equal(t, kv.Value.AsAny(), T(val), "AsAny wrong value") } func TestAllocationLimits(t *testing.T) { From 27e495d6f94a4236e90180e75765e46559a9af7d Mon Sep 17 00:00:00 2001 From: Erica Yin Date: Thu, 22 Feb 2024 16:51:41 -0500 Subject: [PATCH 884/886] Fix output exponential histogram negative buckets (#4956) * Fix output exponential histogram buckets * Update CHANGELOG --- CHANGELOG.md | 1 + .../aggregate/exponential_histogram.go | 2 + .../aggregate/exponential_histogram_test.go | 63 +++++++++++++------ 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d64910dac2..7d8df3e9b04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The next release will require at least [Go 1.21]. ### Fixed - Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945) +- Fix negative buckets in output of exponential histograms. (#4956) ## [1.23.1] 2024-02-07 diff --git a/sdk/metric/internal/aggregate/exponential_histogram.go b/sdk/metric/internal/aggregate/exponential_histogram.go index 660b86071ae..4139a6d1560 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram.go +++ b/sdk/metric/internal/aggregate/exponential_histogram.go @@ -375,6 +375,7 @@ func (e *expoHistogram[N]) delta(dest *metricdata.Aggregation) int { hDPts[i].NegativeBucket.Offset = int32(b.negBuckets.startBin) hDPts[i].NegativeBucket.Counts = reset(hDPts[i].NegativeBucket.Counts, len(b.negBuckets.counts), len(b.negBuckets.counts)) + copy(hDPts[i].NegativeBucket.Counts, b.negBuckets.counts) if !e.noSum { hDPts[i].Sum = b.sum @@ -425,6 +426,7 @@ func (e *expoHistogram[N]) cumulative(dest *metricdata.Aggregation) int { hDPts[i].NegativeBucket.Offset = int32(b.negBuckets.startBin) hDPts[i].NegativeBucket.Counts = reset(hDPts[i].NegativeBucket.Counts, len(b.negBuckets.counts), len(b.negBuckets.counts)) + copy(hDPts[i].NegativeBucket.Counts, b.negBuckets.counts) if !e.noSum { hDPts[i].Sum = b.sum diff --git a/sdk/metric/internal/aggregate/exponential_histogram_test.go b/sdk/metric/internal/aggregate/exponential_histogram_test.go index 3fed4897ee2..4773ee79845 100644 --- a/sdk/metric/internal/aggregate/exponential_histogram_test.go +++ b/sdk/metric/internal/aggregate/exponential_histogram_test.go @@ -771,6 +771,7 @@ func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { {ctx, 2, alice}, {ctx, 16, alice}, {ctx, 1, alice}, + {ctx, -1, alice}, }, expect: output{ n: 1, @@ -781,15 +782,19 @@ func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 6, - Min: metricdata.NewExtrema[N](1), + Count: 7, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 31, + Sum: 30, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 4, 1}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, }, }, @@ -821,6 +826,7 @@ func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { {ctx, 2, carol}, {ctx, 16, carol}, {ctx, 1, dave}, + {ctx, -1, alice}, }, expect: output{ n: 2, @@ -831,15 +837,19 @@ func testDeltaExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 6, - Min: metricdata.NewExtrema[N](1), + Count: 7, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 31, + Sum: 30, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 4, 1}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, { Attributes: overflowSet, @@ -888,6 +898,7 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { {ctx, 2, alice}, {ctx, 16, alice}, {ctx, 1, alice}, + {ctx, -1, alice}, }, expect: output{ n: 1, @@ -898,15 +909,19 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 6, - Min: metricdata.NewExtrema[N](1), + Count: 7, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 31, + Sum: 30, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 4, 1}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, }, }, @@ -927,15 +942,19 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 9, - Min: metricdata.NewExtrema[N](1), + Count: 10, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 44, + Sum: 43, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 6, 2}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, }, }, @@ -952,15 +971,19 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 9, - Min: metricdata.NewExtrema[N](1), + Count: 10, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 44, + Sum: 43, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 6, 2}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, }, }, @@ -985,15 +1008,19 @@ func testCumulativeExpoHist[N int64 | float64]() func(t *testing.T) { Attributes: fltrAlice, StartTime: staticTime, Time: staticTime, - Count: 9, - Min: metricdata.NewExtrema[N](1), + Count: 10, + Min: metricdata.NewExtrema[N](-1), Max: metricdata.NewExtrema[N](16), - Sum: 44, + Sum: 43, Scale: -1, PositiveBucket: metricdata.ExponentialBucket{ Offset: -1, Counts: []uint64{1, 6, 2}, }, + NegativeBucket: metricdata.ExponentialBucket{ + Offset: -1, + Counts: []uint64{1}, + }, }, { Attributes: overflowSet, From a5ec3fc14b2ae57e9060178b2c94e07eac9f2105 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 23 Feb 2024 02:59:03 -0800 Subject: [PATCH 885/886] Add experimental-logs module set (#4961) Include the go.opentelemetry.io/otel/log module in the new module set. Use the version v0.0.1-alpha for the new module. This follows the go.opentelemetry.io/auto projects use of the alpha suffix to communicate extra clear the alpha state of the module. --- CHANGELOG.md | 4 ++++ versions.yaml | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d8df3e9b04..9e0a7c7da3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ The next release will require at least [Go 1.21]. - Support [Go 1.22]. (#4890) - Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900) - Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) +- The `go.opentelemetry.io/otel/log` module is added. + This module includes OpenTelemetry Go's implementation of the Logs Bridge API. + This module is in an alpha state, it is subject to breaking changes + See our [versioning policy](./VERSIONING.md) for more info. (#4961) ### Fixed diff --git a/versions.yaml b/versions.yaml index 96480add1db..372fc1f62c7 100644 --- a/versions.yaml +++ b/versions.yaml @@ -44,10 +44,13 @@ module-sets: modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/prometheus + experimental-logs: + version: v0.0.1-alpha + modules: + - go.opentelemetry.io/otel/log experimental-schema: version: v0.0.7 modules: - go.opentelemetry.io/otel/schema excluded-modules: - go.opentelemetry.io/otel/internal/tools - - go.opentelemetry.io/otel/log From e6e186bfa485f679e35bb775cba63ca24029590d Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 23 Feb 2024 08:32:44 -0800 Subject: [PATCH 886/886] Release v1.24.0/v0.46.0/v0.0.1-alpha (#4966) * Bump versions * Prepare stable-v1 for version v1.24.0 * Prepare experimental-metrics for version v0.46.0 * Prepare experimental-logs for version v0.0.1-alpha * Update changelog * Fix changelog entry --- CHANGELOG.md | 7 +++++-- bridge/opencensus/go.mod | 10 +++++----- bridge/opencensus/test/go.mod | 12 ++++++------ bridge/opencensus/version.go | 2 +- bridge/opentracing/go.mod | 6 +++--- bridge/opentracing/test/go.mod | 8 ++++---- example/dice/go.mod | 14 +++++++------- example/namedtracer/go.mod | 10 +++++----- example/opencensus/go.mod | 16 ++++++++-------- example/otel-collector/go.mod | 12 ++++++------ example/passthrough/go.mod | 10 +++++----- example/prometheus/go.mod | 12 ++++++------ example/zipkin/go.mod | 10 +++++----- exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetricgrpc/version.go | 2 +- exporters/otlp/otlpmetric/otlpmetrichttp/go.mod | 10 +++++----- .../otlp/otlpmetric/otlpmetrichttp/version.go | 2 +- exporters/otlp/otlptrace/go.mod | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 10 +++++----- exporters/otlp/otlptrace/otlptracehttp/go.mod | 10 +++++----- exporters/otlp/otlptrace/version.go | 2 +- exporters/prometheus/go.mod | 10 +++++----- exporters/stdout/stdoutmetric/go.mod | 10 +++++----- exporters/stdout/stdouttrace/go.mod | 8 ++++---- exporters/zipkin/go.mod | 8 ++++---- go.mod | 4 ++-- log/go.mod | 6 +++--- metric/go.mod | 4 ++-- sdk/go.mod | 6 +++--- sdk/metric/go.mod | 8 ++++---- sdk/metric/version.go | 2 +- sdk/version.go | 2 +- trace/go.mod | 2 +- version.go | 2 +- versions.yaml | 4 ++-- 35 files changed, 131 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0a7c7da3a..98f2d204384 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 + This release is the last to support [Go 1.20]. The next release will require at least [Go 1.21]. @@ -18,7 +20,7 @@ The next release will require at least [Go 1.21]. - Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900) - The `go.opentelemetry.io/otel/log` module is added. This module includes OpenTelemetry Go's implementation of the Logs Bridge API. - This module is in an alpha state, it is subject to breaking changes + This module is in an alpha state, it is subject to breaking changes. See our [versioning policy](./VERSIONING.md) for more info. (#4961) ### Fixed @@ -2847,7 +2849,8 @@ It contains api and sdk for trace and meter. - CircleCI build CI manifest files. - CODEOWNERS file to track owners of this project. -[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.23.1...HEAD +[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.24.0...HEAD +[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0 [1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1 [1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0 [1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1 diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index e2f92b58ac5..482a714cd3f 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index 24bdb42fab0..dd144140262 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -4,18 +4,18 @@ go 1.20 require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/bridge/opencensus v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/bridge/opencensus v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/sdk/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/bridge/opencensus/version.go b/bridge/opencensus/version.go index 563823144eb..8b54f1c29b9 100644 --- a/bridge/opencensus/version.go +++ b/bridge/opencensus/version.go @@ -16,5 +16,5 @@ package opencensus // import "go.opentelemetry.io/otel/bridge/opencensus" // Version is the current release version of the opencensus bridge. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/bridge/opentracing/go.mod b/bridge/opentracing/go.mod index 62e08b7f15b..1e8a5ab8686 100644 --- a/bridge/opentracing/go.mod +++ b/bridge/opentracing/go.mod @@ -9,8 +9,8 @@ replace go.opentelemetry.io/otel/trace => ../../trace require ( github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( @@ -18,7 +18,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 06df37a157f..fd8727aa98a 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -12,8 +12,8 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e github.com/opentracing/opentracing-go v1.2.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/bridge/opentracing v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/bridge/opentracing v1.24.0 google.golang.org/grpc v1.61.1 ) @@ -23,8 +23,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/example/dice/go.mod b/example/dice/go.mod index 14425113875..e90df37b119 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -4,19 +4,19 @@ go 1.20 require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 - go.opentelemetry.io/otel/metric v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 + go.opentelemetry.io/otel/metric v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 ) require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index 55b16137130..0da9e59efc1 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -9,15 +9,15 @@ replace ( require ( github.com/go-logr/stdr v1.2.2 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index aa2f2d29afb..0248a47c535 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -10,20 +10,20 @@ replace ( require ( go.opencensus.io v0.24.0 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/bridge/opencensus v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/bridge/opencensus v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index b5ecc5c9353..c7c00087b0c 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -8,10 +8,10 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 google.golang.org/grpc v1.61.1 ) @@ -21,8 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.17.0 // indirect diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index 95403b08f30..b06d1387b30 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -3,16 +3,16 @@ module go.opentelemetry.io/otel/example/passthrough go 1.20 require ( - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 743c37d5028..71d1bb62f06 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -4,10 +4,10 @@ go 1.20 require ( github.com/prometheus/client_golang v1.18.0 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/prometheus v0.45.2 - go.opentelemetry.io/otel/metric v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/prometheus v0.46.0 + go.opentelemetry.io/otel/metric v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 ) require ( @@ -19,8 +19,8 @@ require ( github.com/prometheus/client_model v0.6.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/sdk v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/sdk v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect google.golang.org/protobuf v1.32.0 // indirect ) diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index a8600e38741..be39ee6e881 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -9,17 +9,17 @@ replace ( ) require ( - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/zipkin v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/zipkin v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect ) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index f9228200e10..e702ea9a667 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 google.golang.org/grpc v1.61.1 @@ -26,8 +26,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go index cb6217ce5f6..a4ce4da3e3e 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/version.go @@ -16,5 +16,5 @@ package otlpmetricgrpc // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over gRPC metrics exporter in use. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 9d701daf738..c0035187322 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 @@ -25,8 +25,8 @@ require ( github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go index 776c6cdc46f..3538f8a7d0e 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/version.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/version.go @@ -16,5 +16,5 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme // Version is the current release version of the OpenTelemetry OTLP over HTTP/protobuf metrics exporter in use. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index 055b750156b..bf91621c2e8 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -5,9 +5,9 @@ go 1.20 require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/protobuf v1.32.0 ) @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.3.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 93530a71c94..8b4729b811d 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 @@ -24,7 +24,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index aa428f6ce30..675dbf642d1 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -5,10 +5,10 @@ go 1.20 require ( github.com/cenkalti/backoff/v4 v4.2.1 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 @@ -22,7 +22,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/net v0.19.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/exporters/otlp/otlptrace/version.go b/exporters/otlp/otlptrace/version.go index 54cda3a16a2..afc89644e63 100644 --- a/exporters/otlp/otlptrace/version.go +++ b/exporters/otlp/otlptrace/version.go @@ -16,5 +16,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 671419e2ad2..732507bfffd 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -6,10 +6,10 @@ require ( github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_model v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/metric v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/metric v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 google.golang.org/protobuf v1.32.0 ) @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index 16783241a17..6cc37bd4290 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/sdk/metric v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/sdk/metric v1.24.0 ) require ( @@ -14,8 +14,8 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c80cbb6d86b..e374bb63b63 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -9,9 +9,9 @@ replace ( require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( @@ -19,7 +19,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index 26f693e36fb..00e68621b90 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -8,15 +8,15 @@ require ( github.com/google/go-cmp v0.6.0 github.com/openzipkin/zipkin-go v0.4.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.17.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.mod b/go.mod index 990b6d651d0..7180f343a69 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/go-logr/stdr v1.2.2 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel/metric v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel/metric v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( diff --git a/log/go.mod b/log/go.mod index 6a974a2ae01..aa71df96752 100644 --- a/log/go.mod +++ b/log/go.mod @@ -6,14 +6,14 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel v1.24.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/metric/go.mod b/metric/go.mod index 8415e29b514..d4bcf5fa04a 100644 --- a/metric/go.mod +++ b/metric/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel v1.24.0 ) require ( @@ -12,7 +12,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/trace v1.23.1 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/go.mod b/sdk/go.mod index 9d718f697fb..56290df1f1d 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -8,8 +8,8 @@ require ( github.com/go-logr/logr v1.4.1 github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 golang.org/x/sys v0.17.0 ) @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v1.23.1 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index ff2a1adff78..c91598546d1 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -6,10 +6,10 @@ require ( github.com/go-logr/logr v1.4.1 github.com/go-logr/stdr v1.2.2 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 - go.opentelemetry.io/otel/metric v1.23.1 - go.opentelemetry.io/otel/sdk v1.23.1 - go.opentelemetry.io/otel/trace v1.23.1 + go.opentelemetry.io/otel v1.24.0 + go.opentelemetry.io/otel/metric v1.24.0 + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 ) require ( diff --git a/sdk/metric/version.go b/sdk/metric/version.go index 7433bf7d410..310fa5a5309 100644 --- a/sdk/metric/version.go +++ b/sdk/metric/version.go @@ -16,5 +16,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric" // version is the current release version of the metric SDK in use. func version() string { - return "1.23.1" + return "1.24.0" } diff --git a/sdk/version.go b/sdk/version.go index b6910a0113d..42de0b9a7c6 100644 --- a/sdk/version.go +++ b/sdk/version.go @@ -16,5 +16,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk" // Version is the current release version of the OpenTelemetry SDK in use. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/trace/go.mod b/trace/go.mod index 514836fa646..f9a5abcc0ec 100644 --- a/trace/go.mod +++ b/trace/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/otel => ../ require ( github.com/google/go-cmp v0.6.0 github.com/stretchr/testify v1.8.4 - go.opentelemetry.io/otel v1.23.1 + go.opentelemetry.io/otel v1.24.0 ) require ( diff --git a/version.go b/version.go index 0d998bcaf31..7b2993a1fef 100644 --- a/version.go +++ b/version.go @@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel" // Version is the current release version of OpenTelemetry in use. func Version() string { - return "1.23.1" + return "1.24.0" } diff --git a/versions.yaml b/versions.yaml index 372fc1f62c7..1b556e6782b 100644 --- a/versions.yaml +++ b/versions.yaml @@ -14,7 +14,7 @@ module-sets: stable-v1: - version: v1.23.1 + version: v1.24.0 modules: - go.opentelemetry.io/otel - go.opentelemetry.io/otel/bridge/opencensus @@ -40,7 +40,7 @@ module-sets: - go.opentelemetry.io/otel/sdk/metric - go.opentelemetry.io/otel/trace experimental-metrics: - version: v0.45.2 + version: v0.46.0 modules: - go.opentelemetry.io/otel/example/prometheus - go.opentelemetry.io/otel/exporters/prometheus